From e6c7c5dc8889ab164a29f06f587f202d4219514f Mon Sep 17 00:00:00 2001 From: klatoszewski-oke <62993073+klatoszewski-oke@users.noreply.github.com> Date: Wed, 6 Sep 2023 10:25:36 +0200 Subject: [PATCH 1/5] Implement checking Dolby Atmos --- dist/rx-player.min.js | 2 +- src/manifest/representation.ts | 4 ++++ src/parsers/manifest/dash/common/parse_representations.ts | 5 +++++ .../manifest/dash/js-parser/node_parsers/Representation.ts | 7 +++++++ src/parsers/manifest/dash/node_parser_types.ts | 2 ++ src/parsers/manifest/local/parse_local_manifest.ts | 1 + src/parsers/manifest/local/types.ts | 2 ++ src/parsers/manifest/metaplaylist/metaplaylist_parser.ts | 1 + src/parsers/manifest/types.ts | 2 ++ src/public_types.ts | 1 + 10 files changed, 26 insertions(+), 1 deletion(-) diff --git a/dist/rx-player.min.js b/dist/rx-player.min.js index a771ca4af7f..7c489a5e561 100644 --- a/dist/rx-player.min.js +++ b/dist/rx-player.min.js @@ -1,2 +1,2 @@ /*! For license information please see rx-player.min.js.LICENSE.txt */ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.RxPlayer=t():e.RxPlayer=t()}(self,(function(){return function(){var e={3774:function(e,t,n){"use strict";n.d(t,{J:function(){return a},c:function(){return o}});var r=n(1946),i=n(2203).Z?void 0:window,a=void 0===i?void 0:(0,r.Z)(i.MediaSource)?(0,r.Z)(i.MozMediaSource)?(0,r.Z)(i.WebKitMediaSource)?i.MSMediaSource:i.WebKitMediaSource:i.MozMediaSource:i.MediaSource,o={HAVE_NOTHING:0,HAVE_METADATA:1,HAVE_CURRENT_DATA:2,HAVE_FUTURE_DATA:3,HAVE_ENOUGH_DATA:4}},3666:function(e,t,n){"use strict";n.d(t,{$u:function(){return p},SB:function(){return c},YM:function(){return u},fq:function(){return s},kD:function(){return o},lV:function(){return m},l_:function(){return h},op:function(){return f},vS:function(){return d},vU:function(){return l},yS:function(){return v}});var r,i,a=n(2203),o=!1,s=!1,u=!1,l=!1,d=!1,c=!1,f=!1,v=!1,p=!1,h=!1,m=!1;a.Z||(void 0!==window.MSInputMethodContext&&void 0!==document.documentMode?(s=!0,u=!0):"Microsoft Internet Explorer"===navigator.appName||"Netscape"===navigator.appName&&/(Trident|Edge)\//.test(navigator.userAgent)?u=!0:-1!==navigator.userAgent.toLowerCase().indexOf("edg/")?o=!0:-1!==navigator.userAgent.toLowerCase().indexOf("firefox")?l=!0:"string"==typeof navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)?c=!0:(Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor")>=0||"[object SafariRemoteNotification]"===(null===(i=null===(r=window.safari)||void 0===r?void 0:r.pushNotification)||void 0===i?void 0:i.toString()))&&(d=!0),/SamsungBrowser/.test(navigator.userAgent)&&(f=!0),-1!==navigator.userAgent.indexOf("PlayStation 5")?m=!0:/Tizen/.test(navigator.userAgent)?v=!0:/[Ww]eb[O0]S/.test(navigator.userAgent)?(p=!0,/[Ww]eb[O0]S.TV-2022/.test(navigator.userAgent)||/[Cc]hr[o0]me\/87/.test(navigator.userAgent)||(/[Ww]eb[O0]S.TV-2021/.test(navigator.userAgent)||/[Cc]hr[o0]me\/79/.test(navigator.userAgent))):/[Pp]anasonic/.test(navigator.userAgent)&&(h=!0))},5767:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(3887),i=n(1946);function a(e){var t=e.textTracks;if(!(0,i.Z)(t)){for(var n=0;n=0;o--)if("track"===a[o].nodeName)try{e.removeChild(a[o])}catch(e){r.Z.warn("Compat: Could not remove text track child from element.")}}e.src="",e.removeAttribute("src")}},6139:function(e,t,n){"use strict";n.d(t,{N:function(){return M},Y:function(){return C}});var r,i=n(3714),a=n(811),o=n(3666),s=n(2203),u=n(5059),l=n(1656),d=function(){function e(e,t,n){this._keyType=e,this._mediaKeys=t,this._configuration=n}var t=e.prototype;return t.createMediaKeys=function(){var e=this;return new Promise((function(t){return t(e._mediaKeys)}))},t.getConfiguration=function(){return this._configuration},(0,l.Z)(e,[{key:"keySystem",get:function(){return this._keyType}}]),e}();if(!s.Z){var c=window.MSMediaKeys;void 0!==c&&void 0!==c.prototype&&"function"==typeof c.isTypeSupported&&"function"==typeof c.prototype.createSession&&(r=c)}var f,v=n(4578),p=n(1959),h=n(288),m=n(3038),g=function(e){function t(t){var n;return(n=e.call(this)||this).expiration=NaN,n.keyStatuses=new Map,n._mk=t,n._sessionClosingCanceller=new h.ZP,n.closed=new Promise((function(e){n._sessionClosingCanceller.signal.register((function(){return e()}))})),n.update=function(e){return new Promise((function(t,r){if(void 0===n._ss)return r("MediaKeySession not set.");try{t(n._ss.update(e,""))}catch(e){r(e)}}))},n}(0,v.Z)(t,e);var n=t.prototype;return n.generateRequest=function(e,t){var n=this;return new Promise((function(e){var r=t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer);n._ss=n._mk.createSession("video/mp4",r),m.RV(n._ss,(function(e){var t;n.trigger(null!==(t=e.type)&&void 0!==t?t:"message",e)}),n._sessionClosingCanceller.signal),m.kk(n._ss,(function(e){var t;n.trigger(null!==(t=e.type)&&void 0!==t?t:"keyadded",e)}),n._sessionClosingCanceller.signal),m.Dl(n._ss,(function(e){var t;n.trigger(null!==(t=e.type)&&void 0!==t?t:"keyerror",e)}),n._sessionClosingCanceller.signal),e()}))},n.close=function(){var e=this;return new Promise((function(t){null!=e._ss&&(e._ss.close(),e._ss=void 0),e._sessionClosingCanceller.cancel(),t()}))},n.load=function(){return Promise.resolve(!1)},n.remove=function(){return Promise.resolve()},(0,l.Z)(t,[{key:"sessionId",get:function(){var e,t;return null!==(t=null===(e=this._ss)||void 0===e?void 0:e.sessionId)&&void 0!==t?t:""}}]),t}(p.Z),y=function(){function e(e){if(void 0===r)throw new Error("No MSMediaKeys API.");this._mediaKeys=new r(e)}var t=e.prototype;return t._setVideo=function(e){if(this._videoElement=e,void 0!==this._videoElement.msSetMediaKeys)return this._videoElement.msSetMediaKeys(this._mediaKeys)},t.createSession=function(){if(void 0===this._videoElement||void 0===this._mediaKeys)throw new Error("Video not attached to the MediaKeys");return new g(this._mediaKeys)},t.setServerCertificate=function(){throw new Error("Server certificate is not implemented in your browser")},e}();if(!s.Z){var _=window.MozMediaKeys;void 0!==_&&void 0!==_.prototype&&"function"==typeof _.isTypeSupported&&"function"==typeof _.prototype.createSession&&(f=_)}var b=n(9689),S=n(8894),T=n(3635);function E(e){return"function"==typeof e.webkitGenerateKeyRequest}var k=function(e){function t(t,n){var r;(r=e.call(this)||this)._vid=t,r._key=n,r.sessionId="",r._closeSession=S.Z,r.keyStatuses=new Map,r.expiration=NaN;var i=function(e){r.trigger(e.type,e)};return r.closed=new Promise((function(e){r._closeSession=function(){["keymessage","message","keyadded","ready","keyerror","error"].forEach((function(e){t.removeEventListener(e,i),t.removeEventListener("webkit"+e,i)})),e()}})),["keymessage","message","keyadded","ready","keyerror","error"].forEach((function(e){t.addEventListener(e,i),t.addEventListener("webkit"+e,i)})),r}(0,v.Z)(t,e);var n=t.prototype;return n.update=function(e){var t=this;return new Promise((function(n,r){try{if(t._key.indexOf("clearkey")>=0){var i=e instanceof ArrayBuffer?new Uint8Array(e):e,a=JSON.parse((0,T.uR)(i)),o=(0,b.K)(a.keys[0].k),s=(0,b.K)(a.keys[0].kid);n(t._vid.webkitAddKey(t._key,o,s,""))}else n(t._vid.webkitAddKey(t._key,e,null,""))}catch(e){r(e)}}))},n.generateRequest=function(e,t){var n=this;return new Promise((function(e){n._vid.webkitGenerateKeyRequest(n._key,t),e()}))},n.close=function(){var e=this;return new Promise((function(t){e._closeSession(),t()}))},n.load=function(){return Promise.resolve(!1)},n.remove=function(){return Promise.resolve()},t}(p.Z),w=function(){function e(e){this._keySystem=e}var t=e.prototype;return t._setVideo=function(e){if(!E(e))throw new Error("Video not attached to the MediaKeys");this._videoElement=e},t.createSession=function(){if(null==this._videoElement)throw new Error("Video not attached to the MediaKeys");return new k(this._videoElement,this._keySystem)},t.setServerCertificate=function(){throw new Error("Server certificate is not implemented in your browser")},e}();var A=n(6968);var I=n(158);function Z(e,t){var n=e;if(void 0===n.webkitSetMediaKeys)throw new Error("No webKitMediaKeys API.");return n.webkitSetMediaKeys(t)}var R=function(e){function t(t,n,r){var i;return(i=e.call(this)||this)._serverCertificate=r,i._videoElement=t,i._keyType=n,i._unbindSession=S.Z,i._closeSession=S.Z,i.closed=new Promise((function(e){i._closeSession=e})),i.keyStatuses=new Map,i.expiration=NaN,i}(0,v.Z)(t,e);var n=t.prototype;return n.update=function(e){var t=this;return new Promise((function(n,r){if(void 0===t._nativeSession||void 0===t._nativeSession.update||"function"!=typeof t._nativeSession.update)return r("Unavailable WebKit key session.");try{var i;i=e instanceof ArrayBuffer?new Uint8Array(e):e instanceof Uint8Array?e:new Uint8Array(e.buffer),n(t._nativeSession.update(i))}catch(e){r(e)}}))},n.generateRequest=function(e,t){var n=this;return new Promise((function(e){var r,i,a,o=n._videoElement;if(void 0===(null===(r=o.webkitKeys)||void 0===r?void 0:r.createSession))throw new Error("No WebKitMediaKeys API.");if("com.apple.fps.1_0"===(a=n._keyType)||"com.apple.fps.2_0"===a){if(void 0===n._serverCertificate)throw new Error("A server certificate is needed for creating fairplay session.");i=function(e,t){var n=e instanceof Uint8Array?e:new Uint8Array(e),r=t instanceof Uint8Array?t:new Uint8Array(t);if((0,A.dN)(n,0)+4!==n.length)throw new Error("Unsupported WebKit initData.");var i=(0,T.wV)(n),a=i.indexOf("skd://"),o=a>-1?i.substring(a+6):i,s=(0,T.TZ)(o),u=0,l=new Uint8Array(n.byteLength+4+s.byteLength+4+r.byteLength);return l.set(n),u+=n.length,l.set((0,A.O_)(s.byteLength),u),u+=4,l.set(s,u),u+=s.byteLength,l.set((0,A.O_)(r.byteLength),u),u+=4,l.set(r,u),l}(t,n._serverCertificate)}else i=t;var s=o.webkitKeys.createSession("video/mp4",i);if(null==s)throw new Error("Impossible to get the key sessions");n._listenEvent(s),n._nativeSession=s,e()}))},n.close=function(){var e=this;return new Promise((function(t,n){e._unbindSession(),e._closeSession(),void 0!==e._nativeSession?(e._nativeSession.close(),t()):n("No session to close.")}))},n.load=function(){return Promise.resolve(!1)},n.remove=function(){return Promise.resolve()},n._listenEvent=function(e){var t=this;this._unbindSession();var n=function(e){t.trigger(e.type,e)};["keymessage","message","keyadded","ready","keyerror","error"].forEach((function(t){e.addEventListener(t,n),e.addEventListener("webkit"+t,n)})),this._unbindSession=function(){["keymessage","message","keyadded","ready","keyerror","error"].forEach((function(t){e.removeEventListener(t,n),e.removeEventListener("webkit"+t,n)}))}},(0,l.Z)(t,[{key:"sessionId",get:function(){var e,t;return null!==(t=null===(e=this._nativeSession)||void 0===e?void 0:e.sessionId)&&void 0!==t?t:""}}]),t}(p.Z),x=function(){function e(e){if(void 0===I.t)throw new Error("No WebKitMediaKeys API.");this._keyType=e,this._mediaKeys=new I.t(e)}var t=e.prototype;return t._setVideo=function(e){if(this._videoElement=e,void 0===this._videoElement)throw new Error("Video not attached to the MediaKeys");return Z(this._videoElement,this._mediaKeys)},t.createSession=function(){if(void 0===this._videoElement||void 0===this._mediaKeys)throw new Error("Video not attached to the MediaKeys");return new R(this._videoElement,this._keyType,this._serverCertificate)},t.setServerCertificate=function(e){return this._serverCertificate=e,Promise.resolve()},e}();var M=null,C=function(e,t){var n=e;return"function"==typeof n.setMediaKeys?n.setMediaKeys(t):"function"==typeof n.webkitSetMediaKeys?n.webkitSetMediaKeys(t):"function"==typeof n.mozSetMediaKeys?n.mozSetMediaKeys(t):"function"==typeof n.msSetMediaKeys&&null!==t?n.msSetMediaKeys(t):void 0};if(s.Z||null!=navigator.requestMediaKeySystemAccess&&!(0,u.Z)())M=function(){var e;return(e=navigator).requestMediaKeySystemAccess.apply(e,arguments)};else{var P,D;if(E(HTMLVideoElement.prototype)){var N={isTypeSupported:function(e){var t=document.querySelector("video");return null==t&&(t=document.createElement("video")),null!=t&&"function"==typeof t.canPlayType&&!!t.canPlayType("video/mp4",e)},createCustomMediaKeys:function(e){return new w(e)},setMediaKeys:function(e,t){if(null!==t){if(!(t instanceof w))throw new Error("Custom setMediaKeys is supposed to be called with old webkit custom MediaKeys.");return t._setVideo(e)}}};P=N.isTypeSupported,D=N.createCustomMediaKeys,C=N.setMediaKeys}else if(void 0!==I.t){var O=function(){if(void 0===I.t)throw new Error("No WebKitMediaKeys API.");return{isTypeSupported:I.t.isTypeSupported,createCustomMediaKeys:function(e){return new x(e)},setMediaKeys:function(e,t){if(null===t)return Z(e,t);if(!(t instanceof x))throw new Error("Custom setMediaKeys is supposed to be called with webkit custom MediaKeys.");return t._setVideo(e)}}}();P=O.isTypeSupported,D=O.createCustomMediaKeys,C=O.setMediaKeys}else if(o.fq&&void 0!==r){var L={isTypeSupported:function(e,t){if(void 0===r)throw new Error("No MSMediaKeys API.");return void 0!==t?r.isTypeSupported(e,t):r.isTypeSupported(e)},createCustomMediaKeys:function(e){return new y(e)},setMediaKeys:function(e,t){if(null!==t){if(!(t instanceof y))throw new Error("Custom setMediaKeys is supposed to be called with IE11 custom MediaKeys.");return t._setVideo(e)}}};P=L.isTypeSupported,D=L.createCustomMediaKeys,C=L.setMediaKeys}else if(void 0!==f){var U={isTypeSupported:function(e,t){if(void 0===f)throw new Error("No MozMediaKeys API.");return void 0!==t?f.isTypeSupported(e,t):f.isTypeSupported(e)},createCustomMediaKeys:function(e){if(void 0===f)throw new Error("No MozMediaKeys API.");return new f(e)},setMediaKeys:function(e,t){var n=e;if(void 0===n.mozSetMediaKeys||"function"!=typeof n.mozSetMediaKeys)throw new Error("Can't set video on MozMediaKeys.");return n.mozSetMediaKeys(t)}};P=U.isTypeSupported,D=U.createCustomMediaKeys,C=U.setMediaKeys}else{var B=window.MediaKeys,F=function(){if(void 0===B)throw new i.Z("MEDIA_KEYS_NOT_SUPPORTED","No `MediaKeys` implementation found in the current browser.");if(void 0===B.isTypeSupported){throw new Error("This browser seems to be unable to play encrypted contents currently. Note: Some browsers do not allow decryption in some situations, like when not using HTTPS.")}};P=function(e){return F(),(0,a.Z)("function"==typeof B.isTypeSupported),B.isTypeSupported(e)},D=function(e){return F(),new B(e)}}M=function(e,t){if(!P(e))return Promise.reject(new Error("Unsupported key type"));for(var n=0;n=t)return r.Z.warn("Compat: Invalid cue times: "+e+" - "+t),null;if((0,i.Z)(window.VTTCue)){if((0,i.Z)(window.TextTrackCue))throw new Error("VTT cues not supported in your target");return new TextTrackCue(e,t,n)}return new VTTCue(e,t,n)}},5059:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(3666),i=n(158);function a(){return(r.vS||r.SB)&&void 0!==i.t}},1669:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(3666);function i(){return r.op}},6872:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r={DEFAULT_UNMUTED_VOLUME:.1,DEFAULT_REQUEST_TIMEOUT:3e4,DEFAULT_TEXT_TRACK_MODE:"native",DEFAULT_MANUAL_BITRATE_SWITCHING_MODE:"seamless",DEFAULT_ENABLE_FAST_SWITCHING:!0,DEFAULT_AUDIO_TRACK_SWITCHING_MODE:"seamless",DELTA_POSITION_AFTER_RELOAD:{bitrateSwitch:-.1,trackSwitch:{audio:-.7,video:-.1,other:0}},DEFAULT_CODEC_SWITCHING_BEHAVIOR:"continue",DEFAULT_AUTO_PLAY:!1,DEFAULT_SHOW_NATIVE_SUBTITLE:!0,DEFAULT_STOP_AT_END:!0,DEFAULT_WANTED_BUFFER_AHEAD:30,DEFAULT_MAX_BUFFER_AHEAD:1/0,DEFAULT_MAX_BUFFER_BEHIND:1/0,DEFAULT_MAX_VIDEO_BUFFER_SIZE:1/0,MAXIMUM_MAX_BUFFER_AHEAD:{text:18e3},MAXIMUM_MAX_BUFFER_BEHIND:{text:18e3},DEFAULT_INITIAL_BITRATES:{audio:0,video:0,other:0},DEFAULT_MIN_BITRATES:{audio:0,video:0,other:0},DEFAULT_MAX_BITRATES:{audio:1/0,video:1/0,other:1/0},INACTIVITY_DELAY:6e4,DEFAULT_THROTTLE_WHEN_HIDDEN:!1,DEFAULT_THROTTLE_VIDEO_BITRATE_WHEN_HIDDEN:!1,DEFAULT_LIMIT_VIDEO_WIDTH:!1,DEFAULT_LIVE_GAP:{DEFAULT:10,LOW_LATENCY:3.5},BUFFER_DISCONTINUITY_THRESHOLD:.2,FORCE_DISCONTINUITY_SEEK_DELAY:5e3,BITRATE_REBUFFERING_RATIO:1.5,BUFFER_GC_GAPS:{CALM:240,BEEFY:30},DEFAULT_MAX_MANIFEST_REQUEST_RETRY:4,DEFAULT_CDN_DOWNGRADE_TIME:60,DEFAULT_MAX_REQUESTS_RETRY_ON_ERROR:4,DEFAULT_MAX_REQUESTS_RETRY_ON_OFFLINE:1/0,INITIAL_BACKOFF_DELAY_BASE:{REGULAR:200,LOW_LATENCY:50},MAX_BACKOFF_DELAY_BASE:{REGULAR:3e3,LOW_LATENCY:1e3},SAMPLING_INTERVAL_MEDIASOURCE:1e3,SAMPLING_INTERVAL_LOW_LATENCY:250,SAMPLING_INTERVAL_NO_MEDIASOURCE:500,ABR_ENTER_BUFFER_BASED_ALGO:10,ABR_EXIT_BUFFER_BASED_ALGO:5,ABR_MINIMUM_TOTAL_BYTES:15e4,ABR_MINIMUM_CHUNK_SIZE:16e3,ABR_STARVATION_FACTOR:{DEFAULT:.72,LOW_LATENCY:.72},ABR_REGULAR_FACTOR:{DEFAULT:.72,LOW_LATENCY:.72},ABR_STARVATION_GAP:{DEFAULT:5,LOW_LATENCY:5},OUT_OF_STARVATION_GAP:{DEFAULT:7,LOW_LATENCY:7},ABR_STARVATION_DURATION_DELTA:.1,ABR_FAST_EMA:2,ABR_SLOW_EMA:10,RESUME_GAP_AFTER_SEEKING:{DEFAULT:1.5,LOW_LATENCY:.5},RESUME_GAP_AFTER_NOT_ENOUGH_DATA:{DEFAULT:.5,LOW_LATENCY:.5},RESUME_GAP_AFTER_BUFFERING:{DEFAULT:5,LOW_LATENCY:.5},REBUFFERING_GAP:{DEFAULT:.5,LOW_LATENCY:.2},MINIMUM_BUFFER_AMOUNT_BEFORE_FREEZING:2,UNFREEZING_SEEK_DELAY:6e3,FREEZING_STALLED_DELAY:600,UNFREEZING_DELTA_POSITION:.001,MAX_TIME_MISSING_FROM_COMPLETE_SEGMENT:.15,MAX_MANIFEST_BUFFERED_START_END_DIFFERENCE:.4,MAX_MANIFEST_BUFFERED_DURATION_DIFFERENCE:.3,MINIMUM_SEGMENT_SIZE:.005,APPEND_WINDOW_SECURITIES:{START:.2,END:.1},MAXIMUM_HTML_TEXT_TRACK_UPDATE_INTERVAL:50,TEXT_TRACK_SIZE_CHECKS_INTERVAL:250,BUFFER_PADDING:{audio:1,video:3,other:1},SEGMENT_PRIORITIES_STEPS:[2,4,8,12,18,25],MAX_HIGH_PRIORITY_LEVEL:1,MIN_CANCELABLE_PRIORITY:3,EME_DEFAULT_VIDEO_CODECS:['video/mp4;codecs="avc1.4d401e"','video/mp4;codecs="avc1.42e01e"','video/webm;codecs="vp8"'],EME_DEFAULT_AUDIO_CODECS:['audio/mp4;codecs="mp4a.40.2"',"audio/webm;codecs=opus"],EME_DEFAULT_WIDEVINE_ROBUSTNESSES:["HW_SECURE_ALL","HW_SECURE_DECODE","HW_SECURE_CRYPTO","SW_SECURE_DECODE","SW_SECURE_CRYPTO"],EME_DEFAULT_PLAYREADY_ROBUSTNESSES:["3000","2000"],EME_KEY_SYSTEMS:{clearkey:["webkit-org.w3.clearkey","org.w3.clearkey"],widevine:["com.widevine.alpha"],playready:["com.microsoft.playready.recommendation","com.microsoft.playready","com.chromecast.playready","com.youtube.playready"],fairplay:["com.apple.fps.1_0"]},MAX_CONSECUTIVE_MANIFEST_PARSING_IN_UNSAFE_MODE:10,MIN_MANIFEST_PARSING_TIME_TO_ENTER_UNSAFE_MODE:200,MIN_DASH_S_ELEMENTS_TO_PARSE_UNSAFELY:300,OUT_OF_SYNC_MANIFEST_REFRESH_DELAY:3e3,FAILED_PARTIAL_UPDATE_MANIFEST_REFRESH_DELAY:3e3,DASH_FALLBACK_LIFETIME_WHEN_MINIMUM_UPDATE_PERIOD_EQUAL_0:3,EME_DEFAULT_MAX_SIMULTANEOUS_MEDIA_KEY_SESSIONS:15,EME_MAX_STORED_PERSISTENT_SESSION_INFORMATION:1e3,EME_WAITING_DELAY_LOADED_SESSION_EMPTY_KEYSTATUSES:100,FORCED_ENDED_THRESHOLD:8e-4,ADAPTATION_SWITCH_BUFFER_PADDINGS:{video:{before:5,after:5},audio:{before:2,after:2.5},text:{before:0,after:0},image:{before:0,after:0}},SOURCE_BUFFER_FLUSHING_INTERVAL:500,CONTENT_REPLACEMENT_PADDING:1.2,CACHE_LOAD_DURATION_THRESHOLDS:{video:50,audio:10},STREAM_EVENT_EMITTER_POLL_INTERVAL:250,DEFAULT_MAXIMUM_TIME_ROUNDING_ERROR:.001,BUFFERED_HISTORY_RETENTION_TIME:6e4,BUFFERED_HISTORY_MAXIMUM_ENTRIES:200,MIN_BUFFER_AHEAD:5,UPTO_CURRENT_POSITION_CLEANUP:5},i=n(8026);function a(e){return null!=e&&!Array.isArray(e)&&"object"==typeof e}function o(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r=e.length||(e[t].enabled=!0)}(this._audioTracks.map((function(e){return e.nativeTrack})),e)},t}(a.Z);function f(e){for(var t=0;te.length)return u.Z.warn("Compat: Unrecognized initialization data. Use as is."),[{systemId:void 0,data:e}];var i=e.subarray(n,n+r),a={systemId:(0,l.Y)(i,8),data:i};p(t,a)?u.Z.warn("Compat: Duplicated PSSH found in initialization data, removing it."):t.push(a),n+=r}return n!==e.length?(u.Z.warn("Compat: Unrecognized initialization data. Use as is."),[{systemId:void 0,data:e}]):t}(new Uint8Array(t));return{type:n,values:r}}var m=n(6872),g=n(5157),y=n(5389),_=n(3274),b=n(7714),S=n(1959),T=n(1946),E=n(288),k=n(6139),w=n(770);function A(e){w.Z.setState(e,null),(0,k.Y)(e,null)}function I(){return(I=(0,r.Z)(o().mark((function e(t,n,r){var i,a,s,l,d,c;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=n.keySystemOptions,a=n.loadedSessionsStore,s=n.mediaKeySystemAccess,l=n.mediaKeys,d=w.Z.getState(t),c=null!==d&&d.loadedSessionsStore!==a?d.loadedSessionsStore.closeAllSessions():Promise.resolve(),e.next=5,c;case 5:if(!r.isCancelled()){e.next=7;break}throw r.cancellationError;case 7:if(w.Z.setState(t,{keySystemOptions:i,mediaKeySystemAccess:s,mediaKeys:l,loadedSessionsStore:a}),t.mediaKeys!==l){e.next=10;break}return e.abrupt("return");case 10:u.Z.info("DRM: Attaching MediaKeys to the media element"),(0,k.Y)(t,l),u.Z.info("DRM: MediaKeys attached with success");case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Z(e){if(""===e.sessionId)return!1;var t=e.keyStatuses,n=[];return t.forEach((function(e){n.push(e)})),n.length<=0?(u.Z.debug("DRM: isSessionUsable: MediaKeySession given has an empty keyStatuses",e.sessionId),!1):(0,b.Z)(n,"expired")?(u.Z.debug("DRM: isSessionUsable: MediaKeySession given has an expired key",e.sessionId),!1):(0,b.Z)(n,"internal-error")?(u.Z.debug("DRM: isSessionUsable: MediaKeySession given has a key with an internal-error",e.sessionId),!1):(u.Z.debug("DRM: isSessionUsable: MediaKeySession is usable",e.sessionId),!0)}function R(e,t,n,r){var i=e.loadedSessionsStore,a=e.persistentSessionsStore;return"temporary"===n?x(i,t):null===a?(u.Z.warn("DRM: Cannot create persistent MediaKeySession, PersistentSessionsStore not created."),x(i,t)):function(e,t,n,r){return M.apply(this,arguments)}(i,a,t,r)}function x(e,t){u.Z.info("DRM: Creating a new temporary session");var n=e.createSession(t,"temporary");return Promise.resolve({type:"created-session",value:n})}function M(){return M=(0,r.Z)(o().mark((function e(t,n,i,a){var s,l,d,c,f,v;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(v=function(){return v=(0,r.Z)(o().mark((function e(){var r,l;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===a.cancellationError){e.next=2;break}throw a.cancellationError;case 2:return u.Z.info("DRM: Removing previous persistent session."),null!==(r=n.get(i))&&n.delete(r.sessionId),e.prev=5,e.next=8,t.closeSession(s.mediaKeySession);case 8:e.next=15;break;case 10:if(e.prev=10,e.t0=e.catch(5),""===s.mediaKeySession.sessionId){e.next=14;break}throw e.t0;case 14:t.removeSessionWithoutClosingIt(s.mediaKeySession);case 15:if(null===a.cancellationError){e.next=17;break}throw a.cancellationError;case 17:return l=t.createSession(i,"persistent-license"),e.abrupt("return",{type:"created-session",value:l});case 19:case"end":return e.stop()}}),e,null,[[5,10]])}))),v.apply(this,arguments)},f=function(){return v.apply(this,arguments)},null===a.cancellationError){e.next=4;break}throw a.cancellationError;case 4:if(u.Z.info("DRM: Creating persistent MediaKeySession"),s=t.createSession(i,"persistent-license"),null!==(l=n.getAndReuse(i))){e.next=9;break}return e.abrupt("return",{type:"created-session",value:s});case 9:return e.prev=9,e.next=12,t.loadPersistentSession(s.mediaKeySession,l.sessionId);case 12:if(d=e.sent){e.next=19;break}return u.Z.warn("DRM: No data stored for the loaded session"),n.delete(l.sessionId),t.removeSessionWithoutClosingIt(s.mediaKeySession),c=t.createSession(i,"persistent-license"),e.abrupt("return",{type:"created-session",value:c});case 19:if(!d||!Z(s.mediaKeySession)){e.next=23;break}return n.add(i,i.keyIds,s.mediaKeySession),u.Z.info("DRM: Succeeded to load persistent session."),e.abrupt("return",{type:"loaded-persistent-session",value:s});case 23:return u.Z.warn("DRM: Previous persistent session not usable anymore."),e.abrupt("return",f());case 27:return e.prev=27,e.t0=e.catch(9),u.Z.warn("DRM: Unable to load persistent session: "+(e.t0 instanceof Error?e.t0.toString():"Unknown Error")),e.abrupt("return",f());case 31:case"end":return e.stop()}}),e,null,[[9,27]])}))),M.apply(this,arguments)}function C(e,t){return P.apply(this,arguments)}function P(){return(P=(0,r.Z)(o().mark((function e(t,n){var r,i,a,s,l;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n<0||n>=t.getLength())){e.next=2;break}return e.abrupt("return");case 2:for(u.Z.info("DRM: LSS cache limit exceeded",n,t.getLength()),r=[],i=t.getAll().slice(),a=i.length-n,s=0;s=s.length)){e.next=2;break}throw new g.Z("INCOMPATIBLE_KEYSYSTEMS","No key system compatible with your wanted configuration has been found in the current browser.");case 2:if(null!=k.N){e.next=4;break}throw new Error("requestMediaKeySystemAccess is not implemented in your browser.");case 4:return r=s[t],i=r.keyName,a=r.keyType,d=r.keySystemOptions,c=B(i,a,d),u.Z.debug("DRM: Request keysystem access "+a+","+(t+1)+" of "+s.length),e.prev=7,e.next=10,(0,k.N)(a,c);case 10:return f=e.sent,u.Z.info("DRM: Found compatible keysystem",a,t+1),e.abrupt("return",{type:"create-media-key-system-access",value:{options:d,mediaKeySystemAccess:f}});case 15:if(e.prev=15,e.t0=e.catch(7),u.Z.debug("DRM: Rejected access to keysystem",a,t+1),null===n.cancellationError){e.next=20;break}throw n.cancellationError;case 20:return e.abrupt("return",l(t+1));case 21:case"end":return e.stop()}}),e,null,[[7,15]])})))).apply(this,arguments)}}var V=n(2297);function z(e,t,n){var r;u.Z.debug("Compat: Calling generateRequest on the MediaKeySession");try{r=function(e){u.Z.info("Compat: Trying to move CENC PSSH from init data at the end of it.");for(var t=!1,n=new Uint8Array,r=new Uint8Array,i=0;ie.length)throw u.Z.warn("Compat: unrecognized initialization data. Cannot patch it."),new Error("Compat: unrecognized initialization data. Cannot patch it.");var o=e.subarray(i,i+a);if(16===e[i+12]&&119===e[i+13]&&239===e[i+14]&&236===e[i+15]&&192===e[i+16]&&178===e[i+17]&&77===e[i+18]&&2===e[i+19]&&172===e[i+20]&&227===e[i+21]&&60===e[i+22]&&30===e[i+23]&&82===e[i+24]&&226===e[i+25]&&251===e[i+26]&&75===e[i+27]){var s=(0,V.Xj)(o),l=null===s?void 0:o[s[1]];u.Z.info("Compat: CENC PSSH found with version",l),void 0===l?u.Z.warn("Compat: could not read version of CENC PSSH"):t===(1===l)?n=(0,c.zo)(n,o):1===l?(u.Z.warn("Compat: cenc version 1 encountered, removing every other cenc pssh box."),n=o,t=!0):u.Z.warn("Compat: filtering out cenc pssh box with wrong version",l)}else r=(0,c.zo)(r,o);i+=a}if(i!==e.length)throw u.Z.warn("Compat: unrecognized initialization data. Cannot patch it."),new Error("Compat: unrecognized initialization data. Cannot patch it.");return(0,c.zo)(r,n)}(n)}catch(e){r=n}var i=null!=t?t:"";return e.generateRequest(i,r).catch((function(t){if(""!==i||!(t instanceof TypeError))throw t;return u.Z.warn('Compat: error while calling `generateRequest` with an empty initialization data type. Retrying with a default "cenc" value.',t),e.generateRequest("cenc",r)}))}var K=100;function G(e,t){return W.apply(this,arguments)}function W(){return(W=(0,r.Z)(o().mark((function e(t,n){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u.Z.info("DRM: Load persisted session",n),e.next=3,t.load(n);case 3:if((r=e.sent)&&!(t.keyStatuses.size>0)){e.next=6;break}return e.abrupt("return",r);case 6:return e.abrupt("return",new Promise((function(e){t.addEventListener("keystatuseschange",i);var n=setTimeout(i,K);function i(){clearTimeout(n),t.removeEventListener("keystatuseschange",i),e(r)}})));case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var H=n(7864);function j(e){var t=new E.ZP;return Promise.race([e.close().then((function(){t.cancel()})),e.closed.then((function(){t.cancel()})),function(){return n.apply(this,arguments)}()]);function n(){return(n=(0,r.Z)(o().mark((function e(){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,(0,H.Z)(1e3,t.signal);case 3:return e.next=5,i();case 5:e.next=13;break;case 7:if(e.prev=7,e.t0=e.catch(0),!(e.t0 instanceof E.FU)){e.next=11;break}return e.abrupt("return");case 11:n=e.t0 instanceof Error?e.t0.message:"Unknown error made it impossible to close the session",u.Z.error("DRM: "+n);case 13:case"end":return e.stop()}}),e,null,[[0,7]])})))).apply(this,arguments)}function i(){return a.apply(this,arguments)}function a(){return(a=(0,r.Z)(o().mark((function n(){return o().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,n.next=3,e.update(new Uint8Array(1));case 3:n.next=13;break;case 5:if(n.prev=5,n.t0=n.catch(0),!t.isUsed()){n.next=9;break}return n.abrupt("return");case 9:if(!(n.t0 instanceof Error&&"The session is already closed."===n.t0.message)){n.next=11;break}return n.abrupt("return");case 11:return n.next=13,(0,H.Z)(1e3,t.signal);case 13:if(!t.isUsed()){n.next=15;break}return n.abrupt("return");case 15:throw new Error("Compat: Couldn't know if session is closed");case 16:case"end":return n.stop()}}),n,null,[[0,5]])})))).apply(this,arguments)}}var q=n(811);function Y(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return X(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return X(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function X(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function te(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0){if(null!==this._keyIds&&J(t,this._keyIds))return!0;if(void 0!==this._initializationData.keyIds)return J(t,this._initializationData.keyIds)}return this._checkInitializationDataCompatibility(e)},t._checkInitializationDataCompatibility=function(e){return void 0!==e.keyIds&&e.keyIds.length>0&&void 0!==this._initializationData.keyIds?J(e.keyIds,this._initializationData.keyIds):this._initializationData.type===e.type&&this._initializationData.values.isCompatibleWith(e.values)},e}();function re(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return ie(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ie(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ie(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0&&n._storage[e].mediaKeySession===i&&n._storage.splice(e,1)})).catch((function(e){u.Z.warn("DRM-LSS: MediaKeySession.closed rejected: "+e)})),this._storage.push(Object.assign({},a)),u.Z.debug("DRM-LSS: MediaKeySession added",a.sessionType,this._storage.length),a},t.reuse=function(e){for(var t=this._storage.length-1;t>=0;t--){var n=this._storage[t];if(n.keySessionRecord.isCompatibleWith(e))return this._storage.splice(t,1),this._storage.push(n),u.Z.debug("DRM-LSS: Reusing session:",n.mediaKeySession.sessionId,n.sessionType),Object.assign({},n)}return null},t.getEntryForSession=function(e){for(var t=this._storage.length-1;t>=0;t--){var n=this._storage[t];if(n.mediaKeySession===e)return Object.assign({},n)}return null},t.generateLicenseRequest=function(){var e=(0,r.Z)(o().mark((function e(t,n,r){var i,a,s,l;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:a=re(this._storage);case 1:if((s=a()).done){e.next=8;break}if((l=s.value).mediaKeySession!==t){e.next=6;break}return i=l,e.abrupt("break",8);case 6:e.next=1;break;case 8:if(void 0!==i){e.next=11;break}return u.Z.error("DRM-LSS: generateRequest error. No MediaKeySession found with the given initData and initDataType"),e.abrupt("return",z(t,n,r));case 11:if(i.isGeneratingRequest=!0,"none"===i.closingStatus.type){e.next=14;break}throw new Error("The `MediaKeySession` is being closed.");case 14:return e.prev=14,e.next=17,z(t,n,r);case 17:e.next=26;break;case 19:if(e.prev=19,e.t0=e.catch(14),void 0!==i){e.next=23;break}throw e.t0;case 23:throw i.isGeneratingRequest=!1,"awaiting"===i.closingStatus.type&&i.closingStatus.start(),e.t0;case 26:if(void 0!==i){e.next=28;break}return e.abrupt("return",void 0);case 28:i.isGeneratingRequest=!1,"awaiting"===i.closingStatus.type&&i.closingStatus.start();case 30:case"end":return e.stop()}}),e,this,[[14,19]])})));return function(t,n,r){return e.apply(this,arguments)}}(),t.loadPersistentSession=function(){var e=(0,r.Z)(o().mark((function e(t,n){var r,i,a,s,l;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=re(this._storage);case 1:if((a=i()).done){e.next=8;break}if((s=a.value).mediaKeySession!==t){e.next=6;break}return r=s,e.abrupt("break",8);case 6:e.next=1;break;case 8:if(void 0!==r){e.next=11;break}return u.Z.error("DRM-LSS: loadPersistentSession error. No MediaKeySession found with the given initData and initDataType"),e.abrupt("return",G(t,n));case 11:if(r.isLoadingPersistentSession=!0,"none"===r.closingStatus.type){e.next=14;break}throw new Error("The `MediaKeySession` is being closed.");case 14:return e.prev=14,e.next=17,G(t,n);case 17:l=e.sent,e.next=27;break;case 20:if(e.prev=20,e.t0=e.catch(14),void 0!==r){e.next=24;break}throw e.t0;case 24:throw r.isLoadingPersistentSession=!1,"awaiting"===r.closingStatus.type&&r.closingStatus.start(),e.t0;case 27:if(void 0!==r){e.next=29;break}return e.abrupt("return",l);case 29:return r.isLoadingPersistentSession=!1,"awaiting"===r.closingStatus.type&&r.closingStatus.start(),e.abrupt("return",l);case 32:case"end":return e.stop()}}),e,this,[[14,20]])})));return function(t,n){return e.apply(this,arguments)}}(),t.closeSession=function(){var e=(0,r.Z)(o().mark((function e(t){var n,r,i,a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=re(this._storage);case 1:if((i=r()).done){e.next=8;break}if((a=i.value).mediaKeySession!==t){e.next=6;break}return n=a,e.abrupt("break",8);case 6:e.next=1;break;case 8:if(void 0!==n){e.next=11;break}return u.Z.warn("DRM-LSS: No MediaKeySession found with the given initData and initDataType"),e.abrupt("return",Promise.resolve(!1));case 11:return e.abrupt("return",this._closeEntry(n));case 12:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.getLength=function(){return this._storage.length},t.getAll=function(){return this._storage},t.closeAllSessions=function(){var e=(0,r.Z)(o().mark((function e(){var t,n,r=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this._storage,u.Z.debug("DRM-LSS: Closing all current MediaKeySessions",t.length),this._storage=[],n=t.map((function(e){return r._closeEntry(e)})),e.next=6,Promise.all(n);case 6:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),t.removeSessionWithoutClosingIt=function(e){(0,q.Z)(""===e.sessionId,"Initialized `MediaKeySession`s should always be properly closed");for(var t=this._storage.length-1;t>=0;t--){if(this._storage[t].mediaKeySession===e)return u.Z.debug("DRM-LSS: Removing session without closing it",e.sessionId),this._storage.splice(t,1),!0}return!1},t.getIndex=function(e){for(var t=0;t=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function he(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0){var o=void 0===t?3:4,s=this._entries[a];if((null!==(r=s.version)&&void 0!==r?r:-1)>=o&&i===s.sessionId)return;u.Z.info("DRM-PSS: Updating session info.",i),this._entries.splice(a,1)}else u.Z.info("DRM-PSS: Add new session",i);var l=e.values.getFormattedValues().map((function(e){var t=e.systemId,n=e.data;return{systemId:t,hash:e.hash,data:new ce(n)}}));void 0===t?this._entries.push({version:3,sessionId:i,values:l,initDataType:e.type}):this._entries.push({version:4,sessionId:i,keyIds:t.map((function(e){return new ce(e)})),values:l,initDataType:e.type}),this._save()}else u.Z.warn("DRM-PSS: Invalid Persisten Session given.")},t.delete=function(e){for(var t=-1,n=0;n0&&(r=new g.Z("KEY_STATUS_CHANGE_ERROR","One or several problematic key statuses have been encountered",{keyStatuses:c})),{warning:r,blacklistedKeyIds:l,whitelistedKeyIds:d}}var Pe=s.Dl,De=s.RV,Ne=s.qo;function Oe(e,t,n,i,a){u.Z.info("DRM: Binding session events",e.sessionId);var s=t.getLicenseConfig,l=void 0===s?{}:s,d=new E.ZP;return d.linkToSignal(a),(0,T.Z)(e.closed)||e.closed.then((function(){return d.cancel()})).catch((function(e){a.isCancelled()||(d.cancel(),i.onError(e))})),Pe(e,(function(e){d.cancel(),i.onError(new g.Z("KEY_ERROR",e.type))}),d.signal),Ne(e,(function(e){(function(e){return c.apply(this,arguments)})(e).catch((function(e){a.isCancelled()||d.isUsed()&&e instanceof E.XG||(d.cancel(),i.onError(e))}))}),d.signal),De(e,(function(n){var a,s=n,c=new Uint8Array(s.message),f=(0,de.Z)(s.messageType)?s.messageType:"license-request";u.Z.info("DRM: Received message event, type "+f,e.sessionId),function(e,t,n){var i=t.baseDelay,a=t.maxDelay,s=t.totalRetry,u=t.shouldRetry,l=t.onRetry,d=0;return c();function c(){return f.apply(this,arguments)}function f(){return(f=(0,r.Z)(o().mark((function t(){var r,f,v,p;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null===n.cancellationError){t.next=2;break}throw n.cancellationError;case 2:return t.prev=2,t.next=5,e();case 5:return r=t.sent,t.abrupt("return",r);case 9:if(t.prev=9,t.t0=t.catch(2),null===n.cancellationError){t.next=13;break}throw n.cancellationError;case 13:if(!(!(0,T.Z)(u)&&!u(t.t0)||d++>=s)){t.next=15;break}throw t.t0;case 15:return"function"==typeof l&&l(t.t0,d),f=Math.min(i*Math.pow(2,d-1),a),v=(0,Ie.Z)(f),t.next=20,Ze(v);case 20:return p=c(),t.abrupt("return",p);case 22:case"end":return t.stop()}}),t,null,[[2,9]])})))).apply(this,arguments)}}((function(){return function(e,n){var r;return new Promise((function(i,a){try{u.Z.debug("DRM: Calling `getLicense`",n);var o=t.getLicense(e,n),s=(0,T.Z)(l.timeout)?1e4:l.timeout;s>=0&&(r=setTimeout((function(){a(new Ve('"getLicense" timeout exceeded ('+s+" ms)"))}),s)),Promise.resolve(o).then(d,c)}catch(e){c(e)}function d(e){void 0!==r&&clearTimeout(r),i(e)}function c(e){void 0!==r&&clearTimeout(r),a(e)}}))}(c,f)}),{totalRetry:null!=(a=l.retry)?a:2,baseDelay:200,maxDelay:3e3,shouldRetry:function(e){return e instanceof Ve||(0,T.Z)(e)||!0!==e.noRetry},onRetry:function(e){return i.onWarning(Le(e))}},d.signal).then((function(t){if(d.isUsed())return Promise.resolve();if((0,T.Z)(t))u.Z.info("DRM: No license given, skipping session.update");else try{return Ue(e,t)}catch(e){d.cancel(),i.onError(e)}})).catch((function(e){if(!d.isUsed()){d.cancel();var t=Le(e);if(!(0,T.Z)(e))if(!0===e.fallbackOnLastTry)return u.Z.warn("DRM: Last `getLicense` attempt failed. Blacklisting the current session."),void i.onError(new Fe(t));i.onError(t)}}))}),d.signal),void f();function c(){return c=(0,r.Z)(o().mark((function n(i){var s,l;return o().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return l=function(){return(l=(0,r.Z)(o().mark((function n(){var r,s;return o().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!d.isUsed()){n.next=2;break}return n.abrupt("return");case 2:if("function"!=typeof t.onKeyStatusesChange){n.next=24;break}return n.prev=3,n.next=6,t.onKeyStatusesChange(i,e);case 6:if(r=n.sent,!d.isUsed()){n.next=9;break}return n.abrupt("return");case 9:n.next=18;break;case 11:if(n.prev=11,n.t0=n.catch(3),!a.isCancelled()){n.next=15;break}return n.abrupt("return");case 15:throw s=new g.Z("KEY_STATUS_CHANGE_ERROR","Unknown `onKeyStatusesChange` error"),!(0,T.Z)(n.t0)&&(0,de.Z)(n.t0.message)&&(s.message=n.t0.message),s;case 18:if(!(0,T.Z)(r)){n.next=22;break}u.Z.info("DRM: No license given, skipping session.update"),n.next=24;break;case 22:return n.next=24,Ue(e,r);case 24:case"end":return n.stop()}}),n,null,[[3,11]])})))).apply(this,arguments)},s=function(){return l.apply(this,arguments)},u.Z.info("DRM: keystatuseschange event received",e.sessionId),n.next=5,Promise.all([s(),Promise.resolve(f())]);case 5:case"end":return n.stop()}}),n)}))),c.apply(this,arguments)}function f(){if(!d.isUsed()&&0!==e.keyStatuses.size){var r=Ce(e,t,n),a=r.warning,o=r.blacklistedKeyIds,s=r.whitelistedKeyIds;void 0!==a&&(i.onWarning(a),d.isUsed())||i.onKeyUpdate({whitelistedKeyIds:s,blacklistedKeyIds:o})}}}function Le(e){if(e instanceof Ve)return new g.Z("KEY_LOAD_TIMEOUT","The license server took too much time to respond.");var t=new g.Z("KEY_LOAD_ERROR","An error occured when calling `getLicense`.");return!(0,T.Z)(e)&&(0,de.Z)(e.message)&&(t.message=e.message),t}function Ue(e,t){return Be.apply(this,arguments)}function Be(){return(Be=(0,r.Z)(o().mark((function e(t,n){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u.Z.info("DRM: Updating MediaKeySession with message"),e.prev=1,e.next=4,t.update(n);case 4:e.next=10;break;case 6:throw e.prev=6,e.t0=e.catch(1),r=e.t0 instanceof Error?e.t0.toString():"`session.update` failed",new g.Z("KEY_UPDATE_ERROR",r);case 10:u.Z.info("DRM: MediaKeySession update succeeded.");case 11:case"end":return e.stop()}}),e,null,[[1,6]])})))).apply(this,arguments)}var Fe=function(e){function t(n){var r;return r=e.call(this)||this,Object.setPrototypeOf((0,we.Z)(r),t.prototype),r.sessionError=n,r}return(0,i.Z)(t,e),t}((0,Ae.Z)(Error)),Ve=function(e){function t(t){var n;return n=e.call(this)||this,Object.setPrototypeOf((0,we.Z)(n),Fe.prototype),n.message=t,n}return(0,i.Z)(t,e),t}((0,Ae.Z)(Error)),ze=n(9822);function Ke(e,t){return Ge.apply(this,arguments)}function Ge(){return(Ge=(0,r.Z)(o().mark((function e(t,n){var r,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t.setServerCertificate(n);case 3:return r=e.sent,e.abrupt("return",r);case 7:throw e.prev=7,e.t0=e.catch(0),u.Z.warn("DRM: mediaKeys.setServerCertificate returned an error",e.t0 instanceof Error?e.t0:""),i=e.t0 instanceof Error?e.t0.toString():"`setServerCertificate` error",new g.Z("LICENSE_SERVER_CERTIFICATE_ERROR",i);case 12:case"end":return e.stop()}}),e,null,[[0,7]])})))).apply(this,arguments)}function We(e,t){return He.apply(this,arguments)}function He(){return(He=(0,r.Z)(o().mark((function e(t,n){var r,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!0!==ye.hasOne(t)){e.next=3;break}return u.Z.info("DRM: The MediaKeys already has a server certificate, skipping..."),e.abrupt("return",{type:"already-has-one"});case 3:if("function"==typeof t.setServerCertificate){e.next=6;break}return u.Z.warn("DRM: Could not set the server certificate. mediaKeys.setServerCertificate is not a function"),e.abrupt("return",{type:"method-not-implemented"});case 6:return u.Z.info("DRM: Setting server certificate on the MediaKeys"),ye.prepare(t),e.prev=8,e.next=11,Ke(t,n);case 11:return r=e.sent,ye.set(t,n),e.abrupt("return",{type:"success",value:r});case 16:return e.prev=16,e.t0=e.catch(8),i=(0,ze.Z)(e.t0)?e.t0:new g.Z("LICENSE_SERVER_CERTIFICATE_ERROR","Unknown error when setting the server certificate."),e.abrupt("return",{type:"error",value:i});case 20:case"end":return e.stop()}}),e,null,[[8,16]])})))).apply(this,arguments)}function je(e,t){if(!(isNaN(t)||t<0||t>=e.getLength())){var n=e.getLength(),r=n-t;u.Z.info("DRM: Too many stored persistent sessions, removing some.",n,r),e.deleteOldSessions(r)}}var qe=n(9252);var Ye=function(){function e(e){this._innerValues=e,this._lazyFormattedValues=null}var t=e.prototype;return t.constructRequestData=function(){return c.zo.apply(void 0,this._innerValues.map((function(e){return e.data})))},t.isCompatibleWith=function(t){var n=t instanceof e?t.getFormattedValues():t;return fe(this.getFormattedValues(),n)},t.getFormattedValues=function(){return null===this._lazyFormattedValues&&(this._lazyFormattedValues=this._innerValues.slice().sort((function(e,t){return e.systemId===t.systemId?0:void 0===e.systemId?1:void 0===t.systemId||e.systemId=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Qe(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0&&K._currentSessions.splice(r),void 0!==t.content&&nt(t.content.manifest,[],[],N.record.getAssociatedKeyIds()),null===(n=i.persistentSessionsStore)||void 0===n||n.delete(L.sessionId),i.loadedSessionsStore.closeSession(L).catch((function(e){var t=e instanceof Error?e:"unknown error";u.Z.warn("DRM: failed to close expired session",t)})).then((function(){return K._unlockInitDataQueue()})).catch((function(e){return K._onFatalError(e)})),void(K._isStopped()||K.trigger("warning",e.reason))}if(e instanceof Fe){if(N.blacklistedSessionError=e,void 0!==t.content){var a=t.content.manifest;u.Z.info("DRM: blacklisting Representations based on protection data."),rt(a,t)}K._unlockInitDataQueue()}else K._onFatalError(e)}},this._canceller.signal),void 0!==a.singleLicensePer&&"init-data"!==a.singleLicensePer||this._unlockInitDataQueue(),"created-session"!==P.type){e.next=67;break}return F=t.values.constructRequestData(),e.prev=54,e.next=57,i.loadedSessionsStore.generateLicenseRequest(L,t.type,F);case 57:e.next=67;break;case 59:if(e.prev=59,e.t0=e.catch(54),null!==(V=i.loadedSessionsStore.getEntryForSession(L))&&"none"===V.closingStatus.type){e.next=66;break}return(z=this._currentSessions.indexOf(N))>=0&&this._currentSessions.splice(z,1),e.abrupt("return",Promise.resolve());case 66:throw new g.Z("KEY_GENERATE_REQUEST_ERROR",e.t0 instanceof Error?e.t0.toString():"Unknown error");case 67:return e.abrupt("return",Promise.resolve());case 68:case"end":return e.stop()}}),e,this,[[54,59]])})));return function(t,n){return e.apply(this,arguments)}}(),n._tryToUseAlreadyCreatedSession=function(e,t){var n=t.stores,r=t.options,i=(0,_.Z)(this._currentSessions,(function(t){return t.record.isCompatibleWith(e)}));if(void 0===i)return!1;var a=i.blacklistedSessionError;if(!(0,T.Z)(a))return void 0===e.type||void 0===e.content?(u.Z.error("DRM: This initialization data has already been blacklisted but the current content is not known."),!0):(u.Z.info("DRM: This initialization data has already been blacklisted. Blacklisting the related content."),rt(e.content.manifest,e),!0);if(void 0!==e.keyIds){var o;if(void 0===r.singleLicensePer||"init-data"===r.singleLicensePer){var s=i.keyStatuses.blacklisted;o=function(e,t){for(var n,r=function(){var e=n.value;if(t.some((function(t){return Q(t,e)})))return{v:!0}},i=Y(e);!(n=i()).done;){var a=r();if("object"==typeof a)return a.v}return!1}(e.keyIds,s)}else{var l=i.keyStatuses.whitelisted;o=!J(e.keyIds,l)}if(o)return void 0===e.content?(u.Z.error("DRM: Cannot forbid key id, the content is unknown."),!0):(u.Z.info("DRM: Current initialization data is linked to blacklisted keys. Marking Representations as not decipherable"),nt(e.content.manifest,[],e.keyIds,[]),!0)}if(null!==n.loadedSessionsStore.reuse(e))return u.Z.debug("DRM: Init data already processed. Skipping it."),!0;var d=this._currentSessions.indexOf(i);return-1===d?u.Z.error("DRM: Unable to remove processed init data: not found."):(u.Z.debug("DRM: A session from a processed init data is not available anymore. Re-processing it."),this._currentSessions.splice(d,1)),!1},n._onFatalError=function(e){if(!this._canceller.isUsed()){var t=e instanceof Error?e:new y.Z("NONE","Unknown decryption error");this.error=t,this._initDataQueue.length=0,this._stateData={state:$e.Error,isMediaKeysAttached:void 0,isInitDataQueueLocked:void 0,data:null},this._canceller.cancel(),this.trigger("error",t),this._stateData.state===$e.Error&&this.trigger("stateChange",this._stateData.state)}},n._isStopped=function(){return this._stateData.state===$e.Disposed||this._stateData.state===$e.Error},n._processCurrentInitDataQueue=function(){for(;!1===this._stateData.isInitDataQueueLocked;){var e=this._initDataQueue.shift();if(void 0===e)return;this.onInitializationData(e)}},n._lockInitDataQueue=function(){!1===this._stateData.isInitDataQueueLocked&&(this._stateData.isInitDataQueueLocked=!0)},n._unlockInitDataQueue=function(){!0===this._stateData.isMediaKeysAttached?(this._stateData.isInitDataQueueLocked=!1,this._processCurrentInitDataQueue()):u.Z.error("DRM: Trying to unlock in the wrong state")},t}(S.Z);function tt(e){var t=e.getConfiguration().sessionTypes;return void 0!==t&&(0,b.Z)(t,"persistent-license")}function nt(e,t,n,r){e.updateRepresentationsDeciperability((function(e){if(void 0===e.contentProtections)return e.decipherable;var i=e.contentProtections.keyIds;if(void 0!==i)for(var a,o=Xe(i);!(a=o()).done;){for(var s,u=a.value,l=Xe(n);!(s=l()).done;){if(Q(s.value,u.keyId))return!1}for(var d,c=Xe(t);!(d=c()).done;){if(Q(d.value,u.keyId))return!0}for(var f,v=Xe(r);!(f=v()).done;){if(Q(f.value,u.keyId))return}}return e.decipherable}))}function rt(e,t){e.updateRepresentationsDeciperability((function(e){var n,r;if(!1===e.decipherable)return!1;for(var i,a=function(){var e=i.value;if((void 0===t.type||e.type===t.type)&&t.values.getFormattedValues().every((function(t){return e.values.some((function(e){return(void 0===t.systemId||e.systemId===t.systemId)&&(0,d.Z)(e.data,t.data)}))})))return{v:!1}},o=Xe(null!==(r=null===(n=e.contentProtections)||void 0===n?void 0:n.initData)&&void 0!==r?r:[]);!(i=o()).done;){var s=a();if("object"==typeof s)return s.v}return e.decipherable}))}function it(e,t,n,r,i,a){for(var o,s,l=[].concat(i,a),d=function(){var e=s.value;l.some((function(t){return Q(t,e)}))||(u.Z.hasLevel("DEBUG")&&u.Z.debug("DRM: KeySessionRecord's key missing in the license, blacklisting it",(0,f.ci)(e)),l.push(e))},c=Xe(t.getAssociatedKeyIds());!(s=c()).done;)d();if(void 0!==n&&"init-data"!==n){var v=e.keyIds,p=e.content;if(void 0!==v){var h=v.filter((function(e){return!l.some((function(t){return Q(t,e)}))}));h.length>0&&(u.Z.hasLevel("DEBUG")&&u.Z.debug("DRM: init data keys missing in the license, blacklisting them",h.map((function(e){return(0,f.ci)(e)})).join(", ")),l.push.apply(l,h))}if(r&&void 0!==p)if("content"===n){for(var m,g=new Set,y=Xe(p.manifest.periods);!(m=y()).done;){ot(g,m.value)}at(g,l)}else if("periods"===n)for(var _,b=Xe(p.manifest.periods);!(_=b()).done;){var S=_.value,T=new Set;if(ot(T,S),(null===(o=e.content)||void 0===o?void 0:o.period.id)===S.id)at(T,l);else for(var E=Array.from(T),k=function(){var e=A[w];if(l.some((function(t){return Q(t,e)})))return at(T,l),"break"},w=0,A=E;w=100?n:r<=0?0:n*(+r/100)}return 0}(e,s);return a.Z.debug("Init: Initial time calculated:",t),t}),o,(function(e){return n.trigger("warning",e)}),r).autoPlayResult.then((function(){return(0,l.Z)(t,e,!0,r).onUpdate((function(e,t){e&&(t(),n.trigger("loaded",{segmentBuffersStore:null}))}),{emitCurrentValue:!0,clearSignal:r})})).catch((function(e){r.isCancelled()||n._onFatalError(e)}))},t}(u.K)},379:function(e,t,n){"use strict";n.d(t,{K:function(){return i}});var r=n(4578),i=function(e){function t(){return e.apply(this,arguments)||this}return(0,r.Z)(t,e),t}(n(1959).Z)},1757:function(e,t,n){"use strict";n.d(t,{Z:function(){return s}});var r=n(3666);var i=n(1669),a=n(5095),o=n(288);function s(e,t,n,s){var u=new o.ZP;u.linkToSignal(s);var l=(0,a.ZP)(!1,u.signal);return e.listen((function(e){if(null===e.rebuffering&&null===e.freezing&&0!==e.readyState)return!function(e,t){return!e||!r.SB||t}(n,t.hasAttribute("playsinline"))&&t.duration>0||e.readyState>=3&&null!==e.currentRange&&(!(0,i.Z)()||t.duration>0)?(l.setValue(!0),void u.cancel()):void 0}),{includeLastObservation:!0,clearSignal:u.signal}),l}},8833:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r=n(1669),i=n(3774),a=n(3714),o=n(3887),s=n(5095);function u(e,t,n,u,l,d){var c,f,v=new Promise((function(e,t){c=e,f=t})),p=(0,s.$l)(!1,d),h=(0,s.$l)(!1,d);e.addEventListener("loadedmetadata",g),e.readyState>=i.c.HAVE_METADATA&&g();var m=d.register((function(t){e.removeEventListener("loadedmetadata",g),f(t)}));return{autoPlayResult:v,initialPlayPerformed:h,initialSeekPerformed:p};function g(){e.removeEventListener("loadedmetadata",g);var i="function"==typeof n?n():n;if(o.Z.info("Init: Set initial time",i),t.setCurrentTime(i),p.setValue(!0),p.finish(),(0,r.Z)()&&0===e.duration){var s=new a.Z("MEDIA_ERR_NOT_LOADED_METADATA","Cannot load automatically: your browser falsely announced having loaded the content.");l(s)}d.isCancelled()||t.listen((function(t,n){!t.seeking&&null===t.rebuffering&&t.readyState>=1&&(n(),function(){var t,n;if(o.Z.info("Init: Can begin to play content"),!u)return e.autoplay&&o.Z.warn("Init: autoplay is enabled on HTML media element. Media will play as soon as possible."),h.setValue(!0),h.finish(),m(),c({type:"skipped"});try{n=null!==(t=e.play())&&void 0!==t?t:Promise.resolve()}catch(e){return m(),f(e)}n.then((function(){if(!d.isCancelled())return h.setValue(!0),h.finish(),m(),c({type:"autoplay"})})).catch((function(e){if(m(),!d.isCancelled()){if(e instanceof Error&&"NotAllowedError"===e.name){o.Z.warn("Init: Media element can't play. It may be due to browser auto-play policies.");var t=new a.Z("MEDIA_ERR_BLOCKED_AUTOPLAY","Cannot trigger auto-play automatically: your browser does not allow it.");if(l(t),d.isCancelled())return;return c({type:"autoplay-blocked"})}f(e)}}))}())}),{includeLastObservation:!0,clearSignal:d})}}},8799:function(e,t,n){"use strict";n.d(t,{Z:function(){return d}});var r=n(6139);var i=n(5157),a=n(3887),o=n(5095),s=n(288),u=n(1266),l=n(1960);function d(e,t,n,d,c){if(0===t.length){n.onUpdate((function(e,t){if(null!==e){t(),a.Z.error("Init: Encrypted event but EME feature not activated");var n=new i.Z("MEDIA_IS_ENCRYPTED_ERROR","EME feature not activated.");d.onError(n)}}),{clearSignal:c});var f=(0,o.ZP)({initializationState:{type:"initialized",value:null},drmSystemId:void 0});return f.finish(),f}if("function"!=typeof r.N){n.onUpdate((function(e,t){if(null!==e){t(),a.Z.error("Init: Encrypted event but no EME API available");var n=new i.Z("MEDIA_IS_ENCRYPTED_ERROR","Encryption APIs not found.");d.onError(n)}}),{clearSignal:c});var v=(0,o.ZP)({initializationState:{type:"initialized",value:null},drmSystemId:void 0});return v.finish(),v}var p=new s.ZP;p.linkToSignal(c);var h=(0,o.ZP)({initializationState:{type:"uninitialized",value:null},drmSystemId:void 0},c);a.Z.debug("Init: Creating ContentDecryptor");var m=new u.ZP(e,t);return m.addEventListener("stateChange",(function(e){if(e===l.u.WaitingForAttachment){var t=(0,o.ZP)(!1);t.onUpdate((function(t,n){t&&(n(),e===l.u.WaitingForAttachment&&m.attach())}),{clearSignal:p.signal}),h.setValue({initializationState:{type:"awaiting-media-link",value:{isMediaLinked:t}},drmSystemId:m.systemId})}else e===l.u.ReadyForContent&&(h.setValue({initializationState:{type:"initialized",value:null},drmSystemId:m.systemId}),m.removeEventListener("stateChange"))})),m.addEventListener("error",(function(e){p.cancel(),d.onError(e)})),m.addEventListener("warning",(function(e){d.onWarning(e)})),n.onUpdate((function(e){null!==e&&m.onInitializationData(e)}),{clearSignal:p.signal}),p.signal.register((function(){m.dispose()})),h}},6199:function(e,t,n){"use strict";n.d(t,{Z:function(){return f}});var r=n(4578),i=n(3666).yS,a=n(6872),o=n(3714),s=n(3887),u=n(1959),l=n(2829),d=n(288),c=1/60,f=function(e){function t(t,n,r){var i;return(i=e.call(this)||this)._playbackObserver=t,i._manifest=n,i._speed=r,i._discontinuitiesStore=[],i._isStarted=!1,i._canceller=new d.ZP,i}(0,r.Z)(t,e);var n=t.prototype;return n.start=function(){var e=this;if(!this._isStarted){var t;this._isStarted=!0;var n=null,r=new h(this._playbackObserver,this._speed);this._canceller.signal.register((function(){r.dispose()}));var o=null;this._playbackObserver.listen((function(u){var d,f,v=e._discontinuitiesStore,h=u.buffered,m=u.position,g=u.readyState,y=u.rebuffering,_=u.freezing,b=a.Z.getCurrent(),S=b.BUFFER_DISCONTINUITY_THRESHOLD,T=b.FORCE_DISCONTINUITY_SEEK_DELAY,E=b.FREEZING_STALLED_DELAY,k=b.UNFREEZING_SEEK_DELAY,w=b.UNFREEZING_DELTA_POSITION;if(!u.seeking&&i&&null===n&&null!==t&&u.positionk&&(s.Z.warn("Init: trying to seek to un-freeze player"),e._playbackObserver.setCurrentTime(e._playbackObserver.getCurrentTime()+w),o={attemptTimestamp:I}),I-_.timestamp>E)return null===y||null!==n?r.stopRebuffering():r.startRebuffering(),void e.trigger("stalled","freezing")}else o=null;if(null===y)return r.stopRebuffering(),1===g?(f=u.seeking?null!==u.pendingInternalSeek?"internal-seek":"seeking":"not-ready",void e.trigger("stalled",f)):void e.trigger("unstalled",null);var Z="seeking"===y.reason&&null!==u.pendingInternalSeek?"internal-seek":y.reason;if(null!==n){var R=performance.now();if(R-n0){var M=function(e,t,n){if(0===e.length)return null;for(var r=null,i=0;in)return r;var o=void 0;if(void 0===a.end||a.end>n){var u=e[i],l=u.discontinuity,d=u.position,f=l.start,v=l.end;if(n>=(null!=f?f:d)-c)if(null===v){var p=t.getPeriodAfter(a);null!==p?o=p.start+c:s.Z.warn("Init: discontinuity at Period's end but no next Period")}else no?r:o)}}return r}(v,e._manifest,x);if(null!==M){var C=M+.001;if(!(C<=e._playbackObserver.getCurrentTime()))return s.Z.warn("SA: skippable discontinuity found in the stream",m,C),e._playbackObserver.setCurrentTime(C),void e.trigger("warning",p(x,C));s.Z.info("Init: position to seek already reached, no seeking",e._playbackObserver.getCurrentTime(),C)}}var P=null!=x?x:m,D=(0,l.XS)(h,P);if(e._speed.getValue()>0&&D=0;O--){var L=e._manifest.periods[O];if(void 0!==L.end&&L.end<=P){if(e._manifest.periods[O+1].start>P&&e._manifest.periods[O+1].start>e._playbackObserver.getCurrentTime()){var U=e._manifest.periods[O+1];return e._playbackObserver.setCurrentTime(U.start),void e.trigger("warning",p(P,U.start))}break}}e.trigger("stalled",Z)}else e.trigger("stalled",Z)}),{includeLastObservation:!0,clearSignal:this._canceller.signal})}},n.updateDiscontinuityInfo=function(e){this._isStarted||this.start();var t=this._playbackObserver.getReference().getValue();!function(e,t,n){for(;e.length>0&&void 0!==e[0].period.end&&e[0].period.end+10r.start)return void(v(t)&&e.splice(a,0,t));v(t)&&e.push(t)}(this._discontinuitiesStore,e,t)},n.onLockedStream=function(e,t){var n;this._isStarted||this.start();var r=this._playbackObserver.getReference().getValue();if(!(!r.rebuffering||r.paused||this._speed.getValue()<=0||"audio"!==e&&"video"!==e)){var i=r.position,a=null!==(n=r.rebuffering.position)&&void 0!==n?n:i,o=t.start;i=0;n--){if(e[n].startt)return e.slice(n,e.length)}return[]}function m(e,t,n){var r=Math.max(e.start,t),i=p(e.cues,t),a={start:e.start,end:r,cues:i},o=Math.min(n,e.end),s=h(e.cues,n);return[a,{start:o,end:e.end,cues:s}]}var g=function(){function e(){this._cuesBuffer=[]}var t=e.prototype;return t.get=function(e){for(var t=this._cuesBuffer,n=[],r=t.length-1;r>=0;r--){var i=t[r];if(e=i.start){for(var a=i.cues,o=0;o=a[o].start&&ee){var a=r[i];if(a.start>=n)return;if(a.end>=n){if(e<=a.start)a.cues=h(a.cues,n),a.start=n;else{var o=m(a,e,n),s=o[0],u=o[1];this._cuesBuffer[i]=s,r.splice(i+1,0,u)}return}a.start>=e?(r.splice(i,1),i--):(a.cues=p(a.cues,e),a.end=Math.max(e,a.start))}},t.insert=function(e,t,n){var r=this._cuesBuffer,i={start:t,end:n,cues:e};function a(e){var t=r[e];void 0===t||v(i.end,t.end)?r[e]=i:(t.start>=i.end||(t.cues=h(t.cues,i.end),t.start=i.end),r.splice(e,0,i))}for(var o=0;os.end);return void a(o)}if(ts.end);return void a(o)}if(v(s.end,n))return s.cues=p(s.cues,t),s.end=t,void r.splice(o+1,0,i);if(s.end>n){var u=m(s,t,n),l=u[0],d=u[1];return this._cuesBuffer[o]=l,r.splice(o+1,0,i),void r.splice(o+2,0,d)}s.cues=p(s.cues,t),s.end=t;var c=o+1;for(s=r[c];void 0!==s&&n>s.end;)r.splice(c,1),s=r[c];return void a(c)}}r.push(i)},e}();function y(e,t,n,r){for(var i=[t/n.columns,e/n.rows],a=r.getElementsByClassName("proportional-style"),o=0;o0}var _=i.M4,b=i.bQ,S=i.Q$;function T(e,t){try{e.removeChild(t)}catch(e){a.Z.warn("HTSB: Can't remove text track: not in the element.")}}function E(e){var t=e.getAttribute("data-resolution-rows"),n=e.getAttribute("data-resolution-columns");if(null===t||null===n)return null;var r=parseInt(t,10),i=parseInt(n,10);return null===r||null===i?null:{rows:r,columns:i}}var k=function(e){function t(t,n){var r;return a.Z.debug("HTSB: Creating HTMLTextSegmentBuffer"),(r=e.call(this)||this).bufferType="text",r._buffered=new c.Z,r._videoElement=t,r._textTrackElement=n,r._sizeUpdateCanceller=new l.ZP,r._canceller=new l.ZP,r._buffer=new g,r._currentCues=[],r.autoRefreshSubtitles(r._canceller.signal),r}(0,r.Z)(t,e);var n=t.prototype;return n.pushChunk=function(e){try{this.pushChunkSync(e)}catch(e){return Promise.reject(e)}return Promise.resolve()},n.removeBuffer=function(e,t){return this.removeBufferSync(e,t),Promise.resolve()},n.endOfSegment=function(e){return this._segmentInventory.completeSegment(e,this._buffered),Promise.resolve()},n.getBufferedRanges=function(){return this._buffered},n.dispose=function(){a.Z.debug("HTSB: Disposing HTMLTextSegmentBuffer"),this._disableCurrentCues(),this._buffer.remove(0,1/0),this._buffered.remove(0,1/0),this._canceller.cancel()},n.pushChunkSync=function(e){var t,n;a.Z.debug("HTSB: Appending new html text tracks");var r=e.data,i=r.timestampOffset,o=r.appendWindow,s=r.chunk;if(null!==s){var u,l,d=s.start,c=s.end,v=s.data,p=s.type,h=s.language,m=null!==(t=o[0])&&void 0!==t?t:0,g=null!==(n=o[1])&&void 0!==n?n:1/0,y=function(e,t,n,r){a.Z.debug("HTSB: Finding parser for html text tracks:",e);var i=f.Z.htmlTextTracksParsers[e];if("function"!=typeof i)throw new Error("no parser found for the given text track");a.Z.debug("HTSB: Parser found, parsing...");var o=i(t,n,r);return a.Z.debug("HTTB: Parsed successfully!",o.length),o}(p,v,i,h);if(0!==m&&g!==1/0){for(var _=0;_=0&&y[_].start>=g;)_--;for(y.splice(_,y.length),_=y.length-1;_>=0&&y[_].end>g;)y[_].end=g,_--}if(void 0!==d)u=Math.max(m,d);else{if(y.length<=0)return void a.Z.warn("HTSB: Current text tracks have no cues nor start time. Aborting");a.Z.warn("HTSB: No start time given. Guessing from cues."),u=y[0].start}if(void 0!==c)l=Math.min(g,c);else{if(y.length<=0)return void a.Z.warn("HTSB: Current text tracks have no cues nor end time. Aborting");a.Z.warn("HTSB: No end time given. Guessing from cues."),l=y[y.length-1].end}l<=u?a.Z.warn("HTSB: Invalid text track appended: ","the start time is inferior or equal to the end time."):(null!==e.inventoryInfos&&this._segmentInventory.insertChunk(e.inventoryInfos),this._buffer.insert(y,u,l),this._buffered.insert(u,l))}},n.removeBufferSync=function(e,t){a.Z.debug("HTSB: Removing html text track data",e,t),this._buffer.remove(e,t),this._buffered.remove(e,t)},n._disableCurrentCues=function(){if(this._sizeUpdateCanceller.cancel(),this._currentCues.length>0){for(var e=0;e0){this._sizeUpdateCanceller=new l.ZP,this._sizeUpdateCanceller.linkToSignal(this._canceller.signal);var c=u.Z.getCurrent().TEXT_TRACK_SIZE_CHECKS_INTERVAL,f=function(e,t,n){var r=e.getBoundingClientRect(),i=r.height,u=r.width,l=(0,o.ZP)({height:i,width:u},n),d=i,c=u;if(void 0!==s){var f=new s((function(e){if(0!==e.length){var t=e[0].contentRect,n=t.height,r=t.width;n===d&&r===c||(d=n,c=r,l.setValue({height:n,width:r}))}else a.Z.error("Compat: Resized but no observed element.")}));f.observe(e),n.register((function(){f.disconnect()}))}else{var v=setInterval((function(){var t=e.getBoundingClientRect(),n=t.height,r=t.width;n===d&&r===c||(d=n,c=r,l.setValue({height:n,width:r}))}),t);n.register((function(){clearInterval(v)}))}return l}(this._textTrackElement,c,this._sizeUpdateCanceller.signal);f.onUpdate((function(e){for(var t=e.height,n=e.width,r=0;r0?e.textTracks[u-1]:e.addTextTrack(s)).mode=t?null!==(n=a.HIDDEN)&&void 0!==n?n:"hidden":null!==(r=a.SHOWING)&&void 0!==r?r:"showing"}else o=document.createElement("track"),e.appendChild(o),a=o.track,o.kind=s,a.mode=t?"hidden":"showing";return{track:a,trackElement:o}}(t,n),s=o.track,l=o.trackElement;return r.bufferType="text",r._buffered=new u.Z,r._videoElement=t,r._track=s,r._trackElement=l,r}(0,r.Z)(t,e);var n=t.prototype;return n.pushChunk=function(e){var t,n;if(a.Z.debug("NTSB: Appending new native text tracks"),null===e.data.chunk)return Promise.resolve();var r=e.data,i=r.timestampOffset,o=r.appendWindow,s=r.chunk,u=s.start,d=s.end,c=s.data,f=s.type,v=s.language,p=null!==(t=o[0])&&void 0!==t?t:0,h=null!==(n=o[1])&&void 0!==n?n:1/0;try{var m,g,y=function(e,t,n,r){a.Z.debug("NTSB: Finding parser for native text tracks:",e);var i=l.Z.nativeTextTracksParsers[e];if("function"!=typeof i)throw new Error("no parser found for the given text track");a.Z.debug("NTSB: Parser found, parsing...");var o=i(t,n,r);return a.Z.debug("NTSB: Parsed successfully!",o.length),o}(f,c,i,v);if(0!==p&&h!==1/0){for(var _=0;_=0&&y[_].startTime>=h;)_--;for(y.splice(_,y.length),_=y.length-1;_>=0&&y[_].endTime>h;)y[_].endTime=h,_--}if(void 0!==u)m=Math.max(p,u);else{if(y.length<=0)return a.Z.warn("NTSB: Current text tracks have no cues nor start time. Aborting"),Promise.resolve();a.Z.warn("NTSB: No start time given. Guessing from cues."),m=y[0].startTime}if(void 0!==d)g=Math.min(h,d);else{if(y.length<=0)return a.Z.warn("NTSB: Current text tracks have no cues nor end time. Aborting"),Promise.resolve();a.Z.warn("NTSB: No end time given. Guessing from cues."),g=y[y.length-1].endTime}if(g<=m)return a.Z.warn("NTSB: Invalid text track appended: ","the start time is inferior or equal to the end time."),Promise.resolve();if(y.length>0){var b=y[0],S=this._track.cues;null!==S&&S.length>0&&b.startTime=0;i--){var s=r[i],u=s.startTime,l=s.endTime;u>=e&&u<=t&&l<=t&&o(n,s)}this._buffered.remove(e,t)},t}(s.C)},9612:function(e,t,n){"use strict";n.d(t,{C:function(){return _},f:function(){return g}});var r=n(6872),i=n(3887),a=n(520),o=n(5278);function s(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return u(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&(this._history=this._history.splice(r)),this._history.length>this._maxHistoryLength){var a=this._history.length-this._maxHistoryLength;this._history=this._history.splice(a)}},e}();function d(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return c(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return c(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0){var _=t[p+y-1];g={end:(0,o.Z)(_.bufferedEnd,_.end),precizeEnd:_.precizeEnd},i.Z.debug("SI: "+y+" segments GCed.",u);for(var b,S=d(t.splice(p,y));!(b=S()).done;){var T=b.value;void 0===T.bufferedStart&&void 0===T.bufferedEnd&&this._bufferedHistory.addBufferedSegment(T.infos,null)}n=p}if(void 0===a)return;if(v-(0,o.Z)(a.bufferedStart,a.start)>=s){if(h(a,f,g,u),n===t.length-1)return void m(a,v,u);a=t[++n];for(var E=(0,o.Z)(a.bufferedStart,a.start),k=(0,o.Z)(a.bufferedEnd,a.end),w=c=s&&(void 0===w||v-E>=k-w);){var A=t[n-1];void 0===A.bufferedEnd&&(A.bufferedEnd=a.precizeStart?a.start:A.end,i.Z.debug("SI: calculating buffered end of contiguous segment",u,A.bufferedEnd,A.end)),a.bufferedStart=A.bufferedEnd,void 0!==(a=t[++n])&&(E=(0,o.Z)(a.bufferedStart,a.start),k=(0,o.Z)(a.bufferedEnd,a.end))}}var I=t[n-1];void 0!==I&&m(I,v,u)}}if(null!=a){i.Z.debug("SI: last segments have been GCed",u,n,t.length);for(var Z,R=d(t.splice(n,t.length-n));!(Z=R()).done;){var x=Z.value;void 0===x.bufferedStart&&void 0===x.bufferedEnd&&this._bufferedHistory.addBufferedSegment(x.infos,null)}}void 0!==u&&i.Z.hasLevel("DEBUG")&&i.Z.debug("SI: current "+u+" inventory timeline:\n"+function(e){var t=1/60,n={},r=[],i=null,a=null;function o(e){var t=String.fromCharCode(r.length+65);return r.push({letter:t,periodId:e.period.id,representationId:e.representation.id,bitrate:e.representation.bitrate}),t}for(var s="",u=0;u=u)i.Z.warn("SI: Invalid chunked inserted: starts before it ends",l,s,u);else{for(var d=this._inventory,c={partiallyPushed:!0,chunkSize:o,splitted:!1,start:s,end:u,precizeStart:!1,precizeEnd:!1,bufferedStart:void 0,bufferedEnd:void 0,infos:{segment:a,period:t,adaptation:n,representation:r}},f=d.length-1;f>=0;f--){var v=d[f];if(v.start<=s){if(v.end<=s){for(i.Z.debug("SI: Pushing segment strictly after previous one.",l,s,v.end),this._inventory.splice(f+1,0,c),f+=2;fc.end)return i.Z.debug("SI: Segment pushed updates the start of the next one",l,c.end,d[f].start),d[f].start=c.end,d[f].bufferedStart=void 0,void(d[f].precizeStart=d[f].precizeStart&&c.precizeEnd);i.Z.debug("SI: Segment pushed removes the next one",l,s,u,d[f].start,d[f].end),d.splice(f,1)}return}if(v.start===s){if(v.end<=u){for(i.Z.debug("SI: Segment pushed replace another one",l,s,u,v.end),this._inventory.splice(f,1,c),f+=1;fc.end)return i.Z.debug("SI: Segment pushed updates the start of the next one",l,c.end,d[f].start),d[f].start=c.end,d[f].bufferedStart=void 0,void(d[f].precizeStart=d[f].precizeStart&&c.precizeEnd);i.Z.debug("SI: Segment pushed removes the next one",l,s,u,d[f].start,d[f].end),d.splice(f,1)}return}return i.Z.debug("SI: Segment pushed ends before another with the same start",l,s,u,v.end),d.splice(f,0,c),v.start=c.end,v.bufferedStart=void 0,void(v.precizeStart=v.precizeStart&&c.precizeEnd)}if(v.end<=c.end){for(i.Z.debug("SI: Segment pushed updates end of previous one",l,s,u,v.start,v.end),this._inventory.splice(f+1,0,c),v.end=c.start,v.bufferedEnd=void 0,v.precizeEnd=v.precizeEnd&&c.precizeStart,f+=2;fc.end)return i.Z.debug("SI: Segment pushed updates the start of the next one",l,c.end,d[f].start),d[f].start=c.end,d[f].bufferedStart=void 0,void(d[f].precizeStart=d[f].precizeStart&&c.precizeEnd);i.Z.debug("SI: Segment pushed removes the next one",l,s,u,d[f].start,d[f].end),d.splice(f,1)}return}i.Z.warn("SI: Segment pushed is contained in a previous one",l,s,u,v.start,v.end);var p={partiallyPushed:v.partiallyPushed,chunkSize:v.chunkSize,splitted:!0,start:c.end,end:v.end,precizeStart:v.precizeStart&&v.precizeEnd&&c.precizeEnd,precizeEnd:v.precizeEnd,bufferedStart:void 0,bufferedEnd:v.end,infos:v.infos};return v.end=c.start,v.splitted=!0,v.bufferedEnd=void 0,v.precizeEnd=v.precizeEnd&&c.precizeStart,d.splice(f+1,0,c),void d.splice(f+2,0,p)}}var h=this._inventory[0];if(void 0===h)return i.Z.debug("SI: first segment pushed",l,s,u),void this._inventory.push(c);if(!(h.start>=u)){if(h.end<=u){for(i.Z.debug("SI: Segment pushed starts before and completely recovers the previous first one",l,s,u,h.start,h.end),this._inventory.splice(0,1,c);d.length>1&&d[1].startc.end)return i.Z.debug("SI: Segment pushed updates the start of the next one",l,c.end,d[1].start),d[1].start=c.end,d[1].bufferedStart=void 0,void(d[1].precizeStart=c.precizeEnd);i.Z.debug("SI: Segment pushed removes the next one",l,s,u,d[1].start,d[1].end),d.splice(1,1)}return}return i.Z.debug("SI: Segment pushed start of the next one",l,s,u,h.start,h.end),h.start=u,h.bufferedStart=void 0,h.precizeStart=c.precizeEnd,void this._inventory.splice(0,0,c)}i.Z.debug("SI: Segment pushed comes before all previous ones",l,s,u,h.start),this._inventory.splice(0,0,c)}}},t.completeSegment=function(e,t){if(!e.segment.isInit){for(var n=this._inventory,r=[],o=0;o0&&(s=!0,1===r.length&&(i.Z.warn("SI: Completed Segment is splitted.",e.segment.id,e.segment.time,e.segment.end),r[0].splitted=!0));var u=o,l=n[o].chunkSize;for(o+=1;o0&&(this._inventory.splice(u+1,v),o-=v),this._inventory[u].partiallyPushed=!1,this._inventory[u].chunkSize=l,this._inventory[u].end=p,this._inventory[u].bufferedEnd=h,this._inventory[u].splitted=s,r.push(this._inventory[u])}if(0===r.length)i.Z.warn("SI: Completed Segment not found",e.segment.id,e.segment.time);else{this.synchronizeBuffered(t);for(var m,g=d(r);!(m=g()).done;){var y=m.value;void 0!==y.bufferedStart&&void 0!==y.bufferedEnd?this._bufferedHistory.addBufferedSegment(y.infos,{start:y.bufferedStart,end:y.bufferedEnd}):i.Z.debug("SI: buffered range not known after sync. Skipping history.",y.start,y.end)}}}},t.getInventory=function(){return this._inventory},t.getHistoryFor=function(e){return this._bufferedHistory.getHistoryFor(e)},e}();function v(e){if(void 0===e.bufferedStart||e.partiallyPushed)return!1;var t=e.start,n=e.end-t,i=r.Z.getCurrent(),a=i.MAX_MANIFEST_BUFFERED_START_END_DIFFERENCE,o=i.MAX_MANIFEST_BUFFERED_DURATION_DIFFERENCE;return Math.abs(t-e.bufferedStart)<=a&&(void 0===e.bufferedEnd||e.bufferedEnd>e.bufferedStart&&Math.abs(e.bufferedEnd-e.bufferedStart-n)<=Math.min(o,n/3))}function p(e){if(void 0===e.bufferedEnd||e.partiallyPushed)return!1;var t=e.start,n=e.end,i=n-t,a=r.Z.getCurrent(),o=a.MAX_MANIFEST_BUFFERED_START_END_DIFFERENCE,s=a.MAX_MANIFEST_BUFFERED_DURATION_DIFFERENCE;return Math.abs(n-e.bufferedEnd)<=o&&null!=e.bufferedStart&&e.bufferedEnd>e.bufferedStart&&Math.abs(e.bufferedEnd-e.bufferedStart-i)<=Math.min(s,i/3)}function h(e,t,n,a){var o=r.Z.getCurrent().MAX_MANIFEST_BUFFERED_START_END_DIFFERENCE;void 0!==e.bufferedStart?(e.bufferedStartt&&(n.precizeEnd||e.start-n.end<=o)?(i.Z.debug("SI: buffered start is end of previous segment",a,t,e.start,n.end),e.bufferedStart=n.end,v(e)&&(e.start=n.end,e.precizeStart=!0)):e.start-t<=o?(i.Z.debug("SI: found true buffered start",a,t,e.start),e.bufferedStart=t,v(e)&&(e.start=t,e.precizeStart=!0)):tt&&(i.Z.debug("SI: Segment partially GCed at the end",n,e.bufferedEnd,t),e.bufferedEnd=t),!e.precizeEnd&&t-e.end<=a&&p(e)&&(e.precizeEnd=!0,e.end=t)):e.precizeEnd?(i.Z.debug("SI: buffered end is precize end",n,e.end),e.bufferedEnd=e.end):t-e.end<=a?(i.Z.debug("SI: found true buffered end",n,t,e.end),e.bufferedEnd=t,p(e)&&(e.end=t,e.precizeEnd=!0)):t>e.end?(i.Z.debug("SI: range end too far from expected end",n,t,e.end),e.bufferedEnd=e.end):(i.Z.debug("SI: Segment appears immediately garbage collected at the end",n,e.bufferedEnd,t),e.bufferedEnd=t)}var g,y=f,_=function(){function e(){this._segmentInventory=new y}var t=e.prototype;return t.synchronizeInventory=function(){this._segmentInventory.synchronizeBuffered(this.getBufferedRanges())},t.getInventory=function(){return this._segmentInventory.getInventory()},t.getPendingOperations=function(){return[]},t.getSegmentHistory=function(e){return this._segmentInventory.getHistoryFor(e)},e}();!function(e){e[e.Push=0]="Push",e[e.Remove=1]="Remove",e[e.EndOfSegment=2]="EndOfSegment"}(g||(g={}))},4309:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(2829),i=function(){function e(){this._ranges=[],this.length=0}var t=e.prototype;return t.insert=function(e,t){(0,r.kR)(this._ranges,{start:e,end:t}),this.length=this._ranges.length},t.remove=function(e,t){var n=[];e>0&&n.push({start:0,end:e}),t<1/0&&n.push({start:t,end:1/0}),this._ranges=(0,r.tn)(this._ranges,n),this.length=this._ranges.length},t.start=function(e){if(e>=this._ranges.length)throw new Error("INDEX_SIZE_ERROR");return this._ranges[e].start},t.end=function(e){if(e>=this._ranges.length)throw new Error("INDEX_SIZE_ERROR");return this._ranges[e].end},e}()},7839:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(7326),i=n(4578),a=function(e){function t(n,i,a,o){var s;return s=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(s),t.prototype),s.name="CustomLoaderError",s.message=n,s.canRetry=i,s.isOfflineError=a,s.xhr=o,s}return(0,i.Z)(t,e),t}((0,n(2146).Z)(Error))},5157:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r=n(7326),i=n(4578),a=n(2146),o=n(5992),s=n(7367),u=function(e){function t(n,i,a){var u;return u=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(u),t.prototype),u.name="EncryptedMediaError",u.type=o.ZB.ENCRYPTED_MEDIA_ERROR,u.code=n,u.message=(0,s.Z)(u.name,u.code,i),u.fatal=!1,"string"==typeof(null==a?void 0:a.keyStatuses)&&(u.keyStatuses=a.keyStatuses),u}return(0,i.Z)(t,e),t}((0,a.Z)(Error))},5992:function(e,t,n){"use strict";n.d(t,{SM:function(){return a},ZB:function(){return r},br:function(){return i}});var r={NETWORK_ERROR:"NETWORK_ERROR",MEDIA_ERROR:"MEDIA_ERROR",ENCRYPTED_MEDIA_ERROR:"ENCRYPTED_MEDIA_ERROR",OTHER_ERROR:"OTHER_ERROR"},i={TIMEOUT:"TIMEOUT",ERROR_EVENT:"ERROR_EVENT",ERROR_HTTP_CODE:"ERROR_HTTP_CODE",PARSE_ERROR:"PARSE_ERROR"},a={PIPELINE_LOAD_ERROR:"PIPELINE_LOAD_ERROR",PIPELINE_PARSE_ERROR:"PIPELINE_PARSE_ERROR",INTEGRITY_ERROR:"INTEGRITY_ERROR",MANIFEST_PARSE_ERROR:"MANIFEST_PARSE_ERROR",MANIFEST_INCOMPATIBLE_CODECS_ERROR:"MANIFEST_INCOMPATIBLE_CODECS_ERROR",MANIFEST_UPDATE_ERROR:"MANIFEST_UPDATE_ERROR",MANIFEST_UNSUPPORTED_ADAPTATION_TYPE:"MANIFEST_UNSUPPORTED_ADAPTATION_TYPE",MEDIA_STARTING_TIME_NOT_FOUND:"MEDIA_STARTING_TIME_NOT_FOUND",MEDIA_TIME_BEFORE_MANIFEST:"MEDIA_TIME_BEFORE_MANIFEST",MEDIA_TIME_AFTER_MANIFEST:"MEDIA_TIME_AFTER_MANIFEST",MEDIA_TIME_NOT_FOUND:"MEDIA_TIME_NOT_FOUND",NO_PLAYABLE_REPRESENTATION:"NO_PLAYABLE_REPRESENTATION",MEDIA_IS_ENCRYPTED_ERROR:"MEDIA_IS_ENCRYPTED_ERROR",CREATE_MEDIA_KEYS_ERROR:"CREATE_MEDIA_KEYS_ERROR",KEY_ERROR:"KEY_ERROR",KEY_STATUS_CHANGE_ERROR:"KEY_STATUS_CHANGE_ERROR",KEY_UPDATE_ERROR:"KEY_UPDATE_ERROR",KEY_LOAD_ERROR:"KEY_LOAD_ERROR",KEY_LOAD_TIMEOUT:"KEY_LOAD_TIMEOUT",KEY_GENERATE_REQUEST_ERROR:"KEY_GENERATE_REQUEST_ERROR",INCOMPATIBLE_KEYSYSTEMS:"INCOMPATIBLE_KEYSYSTEMS",INVALID_ENCRYPTED_EVENT:"INVALID_ENCRYPTED_EVENT",INVALID_KEY_SYSTEM:"INVALID_KEY_SYSTEM",LICENSE_SERVER_CERTIFICATE_ERROR:"LICENSE_SERVER_CERTIFICATE_ERROR",MULTIPLE_SESSIONS_SAME_INIT_DATA:"MULTIPLE_SESSIONS_SAME_INIT_DATA",BUFFER_APPEND_ERROR:"BUFFER_APPEND_ERROR",BUFFER_FULL_ERROR:"BUFFER_FULL_ERROR",BUFFER_TYPE_UNKNOWN:"BUFFER_TYPE_UNKNOWN",MEDIA_ERR_BLOCKED_AUTOPLAY:"MEDIA_ERR_BLOCKED_AUTOPLAY",MEDIA_ERR_PLAY_NOT_ALLOWED:"MEDIA_ERR_PLAY_NOT_ALLOWED",MEDIA_ERR_NOT_LOADED_METADATA:"MEDIA_ERR_NOT_LOADED_METADATA",MEDIA_ERR_ABORTED:"MEDIA_ERR_ABORTED",MEDIA_ERR_NETWORK:"MEDIA_ERR_NETWORK",MEDIA_ERR_DECODE:"MEDIA_ERR_DECODE",MEDIA_ERR_SRC_NOT_SUPPORTED:"MEDIA_ERR_SRC_NOT_SUPPORTED",MEDIA_ERR_UNKNOWN:"MEDIA_ERR_UNKNOWN",MEDIA_SOURCE_NOT_SUPPORTED:"MEDIA_SOURCE_NOT_SUPPORTED",MEDIA_KEYS_NOT_SUPPORTED:"MEDIA_KEYS_NOT_SUPPORTED",DISCONTINUITY_ENCOUNTERED:"DISCONTINUITY_ENCOUNTERED",NONE:"NONE"}},7367:function(e,t,n){"use strict";function r(e,t,n){return e+" ("+t+") "+n}n.d(t,{Z:function(){return r}})},8750:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(9822),i=n(5389);function a(e,t){var n=t.defaultCode,a=t.defaultReason;if((0,r.Z)(e))return e;var o=e instanceof Error?e.toString():a;return new i.Z(n,o)}},9822:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r=n(5157),i=n(5992),a=n(3714),o=n(9362),s=n(5389);function u(e){return(e instanceof r.Z||e instanceof a.Z||e instanceof s.Z||e instanceof o.Z)&&Object.keys(i.ZB).indexOf(e.type)>=0}},3714:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r=n(7326),i=n(4578),a=n(2146),o=n(5992),s=n(7367),u=function(e){function t(n,i,a){var u;u=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(u),t.prototype),u.name="MediaError",u.type=o.ZB.MEDIA_ERROR,u.code=n,u.message=(0,s.Z)(u.name,u.code,i),u.fatal=!1;var l=null==a?void 0:a.adaptation;if(void 0!==l)switch(l.type){case"audio":u.trackInfo={type:"audio",track:l.toAudioTrack()};break;case"video":u.trackInfo={type:"video",track:l.toVideoTrack()};break;case"text":u.trackInfo={type:"text",track:l.toTextTrack()}}return u}return(0,i.Z)(t,e),t}((0,a.Z)(Error))},9362:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r=n(7326),i=n(4578),a=n(2146),o=n(5992),s=n(7367),u=function(e){function t(n,i){var a;return a=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(a),t.prototype),a.name="NetworkError",a.type=o.ZB.NETWORK_ERROR,a.xhr=void 0===i.xhr?null:i.xhr,a.url=i.url,a.status=i.status,a.errorType=i.type,a.code=n,a.message=(0,s.Z)(a.name,a.code,i.message),a.fatal=!1,a}return(0,i.Z)(t,e),t.prototype.isHttpError=function(e){return this.errorType===o.br.ERROR_HTTP_CODE&&this.status===e},t}((0,a.Z)(Error))},5389:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r=n(7326),i=n(4578),a=n(2146),o=n(5992),s=n(7367),u=function(e){function t(n,i){var a;return a=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(a),t.prototype),a.name="OtherError",a.type=o.ZB.OTHER_ERROR,a.code=n,a.message=(0,s.Z)(a.name,a.code,i),a.fatal=!1,a}return(0,i.Z)(t,e),t}((0,a.Z)(Error))},9105:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(7326),i=n(4578),a=function(e){function t(n,i,a,o){var s;return s=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(s),t.prototype),s.name="RequestError",s.url=n,void 0!==o&&(s.xhr=o),s.status=i,s.type=a,s.message=a,s}return(0,i.Z)(t,e),t}((0,n(2146).Z)(Error))},7273:function(e,t){"use strict";t.Z={dashParsers:{wasm:null,js:null},createDebugElement:null,directfile:null,ContentDecryptor:null,htmlTextTracksBuffer:null,htmlTextTracksParsers:{},imageBuffer:null,imageParser:null,nativeTextTracksBuffer:null,nativeTextTracksParsers:{},transports:{}}},7874:function(e,t,n){"use strict";var r=n(7273);t.Z=r.Z},3887:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(8894),i=new(function(){function e(){this.error=r.Z,this.warn=r.Z,this.info=r.Z,this.debug=r.Z,this._levels={NONE:0,ERROR:1,WARNING:2,INFO:3,DEBUG:4},this._currentLevel="NONE"}var t=e.prototype;return t.setLevel=function(e){var t,n=this._levels[e];"number"==typeof n?(t=n,this._currentLevel=e):(t=0,this._currentLevel="NONE"),this.error=t>=this._levels.ERROR?console.error.bind(console):r.Z,this.warn=t>=this._levels.WARNING?console.warn.bind(console):r.Z,this.info=t>=this._levels.INFO?console.info.bind(console):r.Z,this.debug=t>=this._levels.DEBUG?console.log.bind(console):r.Z},t.getLevel=function(){return this._currentLevel},t.hasLevel=function(e){return this._levels[e]>=this._levels[this._currentLevel]},e}())},8999:function(e,t,n){"use strict";n.d(t,{r:function(){return v},Z:function(){return p}});var r=n(3887),i=n(3274),a=n(1946),o=n(7829);var s="undefined"!=typeof window&&"function"==typeof window.Set&&"function"==typeof Array.from?function(e){return Array.from(new Set(e))}:function(e){return e.filter((function(e,t,n){return n.indexOf(e)===t}))},u=n(3774);var l=n(4791);function d(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return c(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return c(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&(this.trickModeTracks=i.map((function(t){return new e(t)})));for(var d=t.representations,c=[],v=!1,p=0;p0&&!r.isSupported){var i=new a.Z("MANIFEST_INCOMPATIBLE_CODECS_ERROR","An Adaptation contains only incompatible codecs.",{adaptation:r});n.contentWarnings.push(i)}return r})).filter((function(e){return e.representations.length>0}));if(s.every((function(e){return!e.isSupported}))&&o.length>0&&("video"===i||"audio"===i))throw new a.Z("MANIFEST_PARSE_ERROR","No supported "+i+" adaptations");return s.length>0&&(r[i]=s),r}),{}),!Array.isArray(this.adaptations.video)&&!Array.isArray(this.adaptations.audio))throw new a.Z("MANIFEST_PARSE_ERROR","No supported audio and video tracks.");this.duration=e.duration,this.start=e.start,null!=this.duration&&null!=this.start&&(this.end=this.start+this.duration),this.streamEvents=void 0===e.streamEvents?[]:e.streamEvents}var t=e.prototype;return t.getAdaptations=function(){var e=this.adaptations;return(0,v.Z)(e).reduce((function(e,t){return null!=t?e.concat(t):e}),[])},t.getAdaptationsForType=function(e){var t=this.adaptations[e];return null==t?[]:t},t.getAdaptation=function(e){return(0,s.Z)(this.getAdaptations(),(function(t){var n=t.id;return e===n}))},t.getSupportedAdaptations=function(e){if(void 0===e)return this.getAdaptations().filter((function(e){return e.isSupported}));var t=this.adaptations[e];return void 0===t?[]:t.filter((function(e){return e.isSupported}))},t.containsTime=function(e){return e>=this.start&&(void 0===this.end||e=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0)o.Z.warn("Manifest: "+y.length+" new Representations found when merging."),(h=t.representations).push.apply(h,y),v.push.apply(v,y)}l=e},l=0;l0){o.Z.warn("Manifest: "+s.length+" new Adaptations found when merging.");for(var d,c=g(s);!(d=c()).done;){var f=d.value,v=e.adaptations[f.type];void 0===v?e.adaptations[f.type]=[f]:v.push(f),i.addedAdaptations.push(f)}}return i}function b(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return S(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return S(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function S(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&r._addSupplementaryImageAdaptations(u),o.length>0&&r._addSupplementaryTextAdaptations(o),r}(0,i.Z)(t,e);var n=t.prototype;return n.getPeriod=function(e){return(0,s.Z)(this.periods,(function(t){return e===t.id}))},n.getPeriodForTime=function(e){return(0,s.Z)(this.periods,(function(t){return e>=t.start&&(void 0===t.end||t.end>e)}))},n.getNextPeriod=function(e){return(0,s.Z)(this.periods,(function(t){return t.start>e}))},n.getPeriodAfter=function(e){var t=e.end;if(void 0===t)return null;var n=(0,s.Z)(this.periods,(function(e){return void 0===e.end||t0&&this.trigger("decipherabilityUpdate",t)},n.getAdaptations=function(){(0,c.Z)("manifest.getAdaptations() is deprecated. Please use manifest.period[].getAdaptations() instead");var e=this.periods[0];if(void 0===e)return[];var t=e.adaptations,n=[];for(var r in t)if(t.hasOwnProperty(r)){var i=t[r];n.push.apply(n,i)}return n},n.getAdaptationsForType=function(e){(0,c.Z)("manifest.getAdaptationsForType(type) is deprecated. Please use manifest.period[].getAdaptationsForType(type) instead");var t=this.periods[0];if(void 0===t)return[];var n=t.adaptations[e];return void 0===n?[]:n},n.getAdaptation=function(e){return(0,c.Z)("manifest.getAdaptation(id) is deprecated. Please use manifest.period[].getAdaptation(id) instead"),(0,s.Z)(this.getAdaptations(),(function(t){var n=t.id;return e===n}))},n._addSupplementaryImageAdaptations=function(e){var t=this,n=(Array.isArray(e)?e:[e]).map((function(e){var n=e.mimeType,r=e.url,i="gen-image-ada-"+T(),o="gen-image-rep-"+T(),s=(0,d.$)(r),u=r.substring(0,s),l=r.substring(s),c=new f.Z({id:i,type:"image",representations:[{bitrate:0,cdnMetadata:[{baseUrl:u}],id:o,mimeType:n,index:new h({media:l})}]},{isManuallyAdded:!0});if(c.representations.length>0&&!c.isSupported){var v=new a.Z("MANIFEST_INCOMPATIBLE_CODECS_ERROR","An Adaptation contains only incompatible codecs.",{adaptation:c});t.contentWarnings.push(v)}return c}));if(n.length>0&&this.periods.length>0){var r=this.periods[0].adaptations;r.image=null!=r.image?r.image.concat(n):n}},n._addSupplementaryTextAdaptations=function(e){var t=this,n=(Array.isArray(e)?e:[e]).reduce((function(e,n){var r=n.mimeType,i=n.codecs,o=n.url,s=n.language,u=n.languages,l=n.closedCaption,c=null!=s?[s]:null!=u?u:[],v=(0,d.$)(o),p=o.substring(0,v),m=o.substring(v);return e.concat(c.map((function(e){var n="gen-text-ada-"+T(),o="gen-text-rep-"+T(),s=new f.Z({id:n,type:"text",language:e,closedCaption:l,representations:[{bitrate:0,cdnMetadata:[{baseUrl:p}],id:o,mimeType:r,codecs:i,index:new h({media:m})}]},{isManuallyAdded:!0});if(s.representations.length>0&&!s.isSupported){var u=new a.Z("MANIFEST_INCOMPATIBLE_CODECS_ERROR","An Adaptation contains only incompatible codecs.",{adaptation:s});t.contentWarnings.push(u)}return s})))}),[]);if(n.length>0&&this.periods.length>0){var r=this.periods[0].adaptations;r.text=null!=r.text?r.text.concat(n):n}},n._performUpdate=function(e,t){var n;if(this.availabilityStartTime=e.availabilityStartTime,this.expired=e.expired,this.isDynamic=e.isDynamic,this.isLive=e.isLive,this.isLastPeriodKnown=e.isLastPeriodKnown,this.lifetime=e.lifetime,this.contentWarnings=e.contentWarnings,this.suggestedPresentationDelay=e.suggestedPresentationDelay,this.transport=e.transport,this.publishTime=e.publishTime,t===r.Full)this._timeBounds=e._timeBounds,this.uris=e.uris,n=function(e,t){for(var n={updatedPeriods:[],addedPeriods:[],removedPeriods:[]},i=0,a=0;ae.length)return o.Z.error("Manifest: error when updating Periods"),n;if(i0&&(e.push.apply(e,b),(y=n.addedPeriods).push.apply(y,b)),n}(this.periods,e.periods);else{this._timeBounds.maximumTimeData=e._timeBounds.maximumTimeData,this.updateUrl=e.uris[0],n=function(e,t){var n,i={updatedPeriods:[],addedPeriods:[],removedPeriods:[]};if(0===e.length)return e.splice.apply(e,[0,0].concat(t)),(n=i.addedPeriods).push.apply(n,t),i;if(0===t.length)return i;var s=e[e.length-1];if(s.startc){var E;o.Z.warn("Manifest: old Periods not found in new when updating, removing");var k=e.splice(c,p-c);(E=i.removedPeriods).push.apply(E,k),p=c}var w=_(e[p],v,r.Full);i.updatedPeriods.push({period:e[p],result:w})}c++}if(c0;){var s=this.periods[0];if(void 0===s.end||s.end>i)break;this.periods.shift()}}this.adaptations=void 0===this.periods[0]?{}:this.periods[0].adaptations,this.trigger("manifestUpdate",n)},t}(u.Z);var w=k},520:function(e,t,n){"use strict";n.d(t,{K:function(){return a},z:function(){return i}});var r=n(1946);function i(e,t){return e.segment.id===t.segment.id&&e.representation.id===t.representation.id&&e.adaptation.id===t.adaptation.id&&e.period.id===t.period.id}function a(e){if((0,r.Z)(e))return"";var t=e.period,n=e.adaptation,i=e.representation,a=e.segment;return n.type+" P: "+t.id+" A: "+n.id+" R: "+i.id+" S: "+(a.isInit?"init":a.complete?a.time+"-"+a.duration:""+a.time)}},2689:function(e,t,n){"use strict";n.d(t,{s:function(){return r}});var r=Math.pow(2,32)-1},2297:function(e,t,n){"use strict";n.d(t,{Qy:function(){return f},Xj:function(){return p},iz:function(){return c},lp:function(){return d},nR:function(){return v},t_:function(){return l},vA:function(){return u}});var r=n(3887),i=n(811),a=n(6968);function o(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return s(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return s(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);ni)return null;s=(0,a.pV)(e,r),r+=8}if(s<0)throw new Error("ISOBMFF: Size out of range");if(n===t)return 1970628964===t&&(r+=16),[o,r,o+s];o+=s}return null}function v(e,t,n,r,i){for(var o,s=e.length,u=0;us)return;o=(0,a.pV)(e,l),l+=8}if(1970628964===d&&l+16<=s&&(0,a.pX)(e,l)===t&&(0,a.pX)(e,l+4)===n&&(0,a.pX)(e,l+8)===r&&(0,a.pX)(e,l+12)===i)return l+=16,e.subarray(l,u+o)}}function p(e){var t=e.length;if(t<8)return r.Z.warn("ISOBMFF: box inferior to 8 bytes, cannot find offsets"),null;var n=0,i=(0,a.pX)(e,n);n+=4;var o=(0,a.pX)(e,n);if(n+=4,0===i)i=t;else if(1===i){if(n+8>t)return r.Z.warn("ISOBMFF: box too short, cannot find offsets"),null;i=(0,a.pV)(e,n),n+=8}if(i<0)throw new Error("ISOBMFF: Size out of range");return 1970628964===o&&(n+=16),[0,n,i]}},6807:function(e,t,n){"use strict";n.d(t,{E3:function(){return u},Le:function(){return o},XA:function(){return i},fs:function(){return s},uq:function(){return a}});var r=n(2297);function i(e){var t=(0,r.t_)(e,1836019558);return null===t?null:(0,r.t_)(t,1953653094)}function a(e){return(0,r.lp)(e,1836019558).reduce((function(e,t){var n=(0,r.t_)(t,1953653094);return null!==n&&e.push(n),e}),[])}function o(e){return(0,r.t_)(e,1835295092)}function s(e){var t=(0,r.t_)(e,1836019574);if(null===t)return null;var n=(0,r.t_)(t,1953653099);return null===n?null:(0,r.t_)(n,1835297121)}function u(e,t){return void 0===t&&(t=0),(0,r.t_)(e.subarray(t),1701671783)}},6490:function(e,t,n){"use strict";n.d(t,{Z:function(){return s},Y:function(){return u}});var r=n(3887);var i="function"==typeof Uint8Array.prototype.slice?function(e,t,n){return e.slice(t,n)}:function(e,t,n){return new Uint8Array(Array.prototype.slice.call(e,t,n))},a=n(3635),o=n(2297);function s(e){var t=0,n=(0,o.t_)(e,1836019574);if(null===n)return[];for(var a=[];t1)r.Z.warn("ISOBMFF: un-handled PSSH version");else{var n=t+4;if(!(n+16>e.length)){var o=i(e,n,n+16);return(0,a.ci)(o)}}}},4644:function(e,t,n){"use strict";n.d(t,{J6:function(){return m},LD:function(){return h},MM:function(){return p},Qx:function(){return f},R0:function(){return y},Wf:function(){return c},s9:function(){return g}});var r=n(3887),i=n(6968),a=n(3635),o=n(2689),s=n(2297),u=n(6807);function l(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return d(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return d(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0;){var v=(0,i.pX)(e,o);o+=4;var p=2147483647&v;if(1===(2147483648&v)>>>31)throw new Error("sidx with reference_type `1` not yet implemented");var h=(0,i.pX)(e,o);o+=4,o+=4,c.push({time:l,duration:h,timescale:d,range:[r,r+p-1]}),l+=h,r+=p}return c}function f(e){var t=(0,u.XA)(e);if(null!==t){var n=(0,s.t_)(t,1952867444);if(null!==n){var r=n[0];return 1===r?(0,i.pV)(n,4):0===r?(0,i.pX)(n,4):void 0}}}function v(e){var t=(0,s.t_)(e,1952868452);if(null!==t){var n=1,r=(0,i.QI)(t,n);if(n+=3,(8&r)>0)return n+=4,(1&r)>0&&(n+=8),(2&r)>0&&(n+=4),(0,i.pX)(t,n)}}function p(e){var t=(0,u.uq)(e);if(0!==t.length){for(var n,r=0,a=l(t);!(n=a()).done;){var o=n.value,d=(0,s.t_)(o,1953658222);if(null===d)return;var c=0,f=d[c];if(c+=1,f>1)return;var p=(0,i.QI)(d,c);c+=3;var h=(256&p)>0,m=0;if(!h&&void 0===(m=v(o)))return;var g=(1&p)>0,y=(4&p)>0,_=(512&p)>0,b=(1024&p)>0,S=(2048&p)>0,T=(0,i.pX)(d,c);c+=4,g&&(c+=4),y&&(c+=4);for(var E=T,k=0;E-- >0;)h?(k+=(0,i.pX)(d,c),c+=4):k+=m,_&&(c+=4),b&&(c+=4),S&&(c+=4);r+=k}return r}}function h(e){var t=(0,u.fs)(e);if(null!==t){var n=(0,s.t_)(t,1835296868);if(null!==n){var r=0,a=n[r];return r+=4,1===a?(0,i.pX)(n,r+16):0===a?(0,i.pX)(n,r+8):void 0}}}function m(e){var t=e.length;if(t<4)throw new Error("Cannot update box length: box too short");var n=(0,i.pX)(e,0);if(0===n){if(t>o.s){var r=new Uint8Array(t+8);return r.set((0,i.kh)(1),0),r.set(e.subarray(4,8),4),r.set((0,i.el)(t+8),8),r.set(e.subarray(8,t),16),r}return e.set((0,i.kh)(t),0),e}if(1===n){if(t<16)throw new Error("Cannot update box length: box too short");return e.set((0,i.el)(t),8),e}if(t<=o.s)return e.set((0,i.kh)(t),0),e;var a=new Uint8Array(t+8);return a.set((0,i.kh)(1),0),a.set(e.subarray(4,8),4),a.set((0,i.el)(t+8),8),a.set(e.subarray(8,t),16),a}function g(e){for(var t=[],n=0;n0)throw new Error("Unhandled version: "+s);var c=(0,r.dN)(e,t);t+=4;var f=(0,r.dN)(e,t);t+=4;var v=(0,i.uR)(e.subarray(t,t+4));t+=4;var p=(0,r.qb)(e,t);t+=2;var h=(0,r.qb)(e,t),m=[e[t+=2],e[t+1]].join(":"),g=1===e[t+=2];t=64;var y=[];if(0===c)throw new Error("bif: no images to parse");for(var _=0,b=null;t0,this._isEMSGWhitelisted=c}var t=e.prototype;return t.getInitSegment=function(){return(0,a.Z)(this._index,this._isEMSGWhitelisted)},t.getSegments=function(e,t){return(0,o.Z)(this._index,e,t,this._isEMSGWhitelisted,this._scaledPeriodEnd)},t.shouldRefresh=function(){return!1},t.getFirstAvailablePosition=function(){var e=this._index;return 0===e.timeline.length?null:(0,i.zG)(Math.max(this._scaledPeriodStart,e.timeline[0].start),e)},t.getLastAvailablePosition=function(){var e,t=this._index.timeline;if(0===t.length)return null;var n=t[t.length-1],r=Math.min((0,i.jH)(n,null,this._scaledPeriodEnd),null!==(e=this._scaledPeriodEnd)&&void 0!==e?e:1/0);return(0,i.zG)(r,this._index)},t.getEnd=function(){return this.getLastAvailablePosition()},t.awaitSegmentBetween=function(){return!1},t.isSegmentStillAvailable=function(){return!0},t.checkDiscontinuity=function(){return null},t.initializeIndex=function(e){for(var t=0;t0?Math.floor(u/s):0),I=T+A*S;Ih)break;var R=null===v?null:(0,i.QB)(I,Z)(v),x=I-e.indexTimeOffset,M=S;x<0&&(M=S+x,x=0);var C={id:String(I),time:x/f,end:(x+M)/f,duration:M/f,isInit:!1,range:E,timescale:1,url:R,number:Z,timestampOffset:-e.indexTimeOffset/f,complete:w,privateInfos:{isEMSGWhitelisted:a}};g.push(C),I=T+ ++A*S}if(I>=d)return g;if(m+=k+1,void 0!==h&&m>h)return g}return g}},4784:function(e,t,n){"use strict";n.d(t,{QB:function(){return o},zA:function(){return a}});var r=n(6923);function i(e){return function(t,n,i){var a,o,s,u=(0,r.Z)(i)?parseInt(i,10):1;return a=String(e),o=u,(s=a.toString()).length>=o?s:(new Array(o+1).join("0")+s).slice(-o)}}function a(e,t,n){return function(e,t,n){return-1===e.indexOf("$")?e:e.replace(/\$\$/g,"$").replace(/\$RepresentationID\$/g,String(t)).replace(/\$Bandwidth(\%0(\d+)d)?\$/g,i(void 0===n?0:n))}(e,t,n)}function o(e,t){return function(n){return-1===n.indexOf("$")?n:n.replace(/\$\$/g,"$").replace(/\$Number(\%0(\d+)d)?\$/g,(function(e,n,r){if(void 0===t)throw new Error("Segment number not defined in a $Number$ scheme");return i(t)(e,n,r)})).replace(/\$Time(\%0(\d+)d)?\$/g,(function(t,n,r){if(void 0===e)throw new Error("Segment time not defined in a $Time$ scheme");return i(e)(t,n,r)}))}}},4541:function(e,t,n){"use strict";n.d(t,{Z:function(){return je}});var r=n(7904),i=n(1946),a=n(6872),o=n(3887),s=n(3274),u=n(9829);function l(e){var t=Date.parse(e)-performance.now();if(!isNaN(t))return t;o.Z.warn("DASH Parser: Invalid clock received: ",e)}function d(e){for(var t=e.representations,n=null,r=0;r=0;t--){var n=e[t].adaptations,r=void 0===n.audio?void 0:n.audio[0],i=void 0===n.video?void 0:n.video[0];if(void 0!==r||void 0!==i){var a=null,s=null;if(void 0!==r){var u=d(r);if(void 0===u)return{safe:void 0,unsafe:void 0};a=u}if(void 0!==i){var l=d(i);if(void 0===l)return{safe:void 0,unsafe:void 0};s=l}if(void 0!==r&&null===a||void 0!==i&&null===s)return o.Z.info("Parser utils: found Period with no segment. ","Going to previous one to calculate last position"),{safe:void 0,unsafe:void 0};if(null!==s)return null!==a?{safe:Math.min(a,s),unsafe:Math.max(a,s)}:{safe:s,unsafe:s};if(null!==a)return{safe:a,unsafe:a}}}return{safe:void 0,unsafe:void 0}}(e);return{minimumSafePosition:t,maximumSafePosition:n.safe,maximumUnsafePosition:n.unsafe}}var v=n(9592),p=n(908),h=n(1679),m=n(3635);var g=function(){function e(e){this._isDynamic=e.isDynamic,this._timeShiftBufferDepth=e.isDynamic&&void 0!==e.timeShiftBufferDepth?e.timeShiftBufferDepth:null}var t=e.prototype;return t.setLastPosition=function(e,t){this._lastPosition=e,this._positionTime=t},t.lastPositionIsKnown=function(){return this._isDynamic?null!=this._positionTime&&null!=this._lastPosition:null!=this._lastPosition},t.estimateMinimumBound=function(){if(!this._isDynamic||null===this._timeShiftBufferDepth)return 0;var e=this.estimateMaximumBound();return void 0!==e?e-this._timeShiftBufferDepth:void 0},t.estimateMaximumBound=function(){return this._isDynamic&&null!=this._positionTime&&null!=this._lastPosition?Math.max(this._lastPosition-this._positionTime+performance.now()/1e3,0):this._lastPosition},e}(),y=n(8999),_=n(5138),b=n(7714),S=n(6923);function T(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return E(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return E(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function E(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0){var s=i-a.start;if(s%a.duration==0&&s/a.duration<=a.repeatCount)return{repeatNumberInPrevSegments:s/a.duration,prevSegmentsIdx:o,newElementsIdx:0,repeatNumberInNewElements:0}}if(++o>=e.length)return null;if((a=e[o]).start===i)return{prevSegmentsIdx:o,newElementsIdx:0,repeatNumberInPrevSegments:0,repeatNumberInNewElements:0};if(a.start>i)return null}else for(var u=0,l=t[0],d=i;;){var c=l.getAttribute("d"),f=null===c?null:parseInt(c,10);if(null===f||Number.isNaN(f))return null;var v=l.getAttribute("r"),p=null===v?null:parseInt(v,10);if(null!==p){if(Number.isNaN(p)||p<0)return null;if(p>0){var h=n-d;if(h%f==0&&h/f<=p)return{repeatNumberInPrevSegments:0,repeatNumberInNewElements:h/f,prevSegmentsIdx:0,newElementsIdx:u}}d+=f*(p+1)}else d+=f;if(++u>=t.length)return null;var m=(l=t[u]).getAttribute("t"),g=null===m?null:parseInt(m,10);if(null!==g){if(Number.isNaN(g))return null;d=g}if(d===n)return{newElementsIdx:u,prevSegmentsIdx:0,repeatNumberInPrevSegments:0,repeatNumberInNewElements:0};if(d>i)return null}}(t,e);if(null===r)return o.Z.warn('DASH: Cannot perform "based" update. Common segment not found.'),z(e);var i=r.prevSegmentsIdx,a=r.newElementsIdx,s=r.repeatNumberInPrevSegments,u=r.repeatNumberInNewElements,l=t.length-i+a-1;if(l>=e.length)return o.Z.info('DASH: Cannot perform "based" update. New timeline too short'),z(e);var d=t.slice(i);if(s>0){var c=d[0];c.start+=c.duration*s,d[0].repeatCount-=s}if(u>0&&0!==a)return o.Z.info('DASH: Cannot perform "based" update. The new timeline has a different form.'),z(e);var f=d[d.length-1],v=V(e[l]),p=(null!==(n=v.repeatCount)&&void 0!==n?n:0)-u;if(v.duration!==f.duration||f.repeatCount>p)return o.Z.info('DASH: Cannot perform "based" update. The new timeline has a different form at the beginning.'),z(e);void 0!==v.repeatCount&&v.repeatCount>f.repeatCount&&(f.repeatCount=v.repeatCount);for(var h=[],m=[],g=l+1;g0){var s=i[i.length-1];if((0,R.jH)(s,null,this._scaledPeriodEnd)+a>=Math.min(o,null!==(n=this._scaledPeriodEnd)&&void 0!==n?n:1/0))return!1}return void 0===this._scaledPeriodEnd?o+a>this._scaledPeriodStart&&void 0:(0,R.gT)(e,this._index)-athis._scaledPeriodStart},t.isSegmentStillAvailable=function(e){if(e.isInit)return!0;this._refreshTimeline(),null===this._index.timeline&&(this._index.timeline=this._getTimeline());var t=this._index,n=t.timeline,r=t.timescale,i=t.indexTimeOffset;return(0,O.Z)(e,n,r,i)},t.checkDiscontinuity=function(e){this._refreshTimeline();var t=this._index.timeline;return null===t&&(t=this._getTimeline(),this._index.timeline=t),(0,R._j)({timeline:t,timescale:this._index.timescale,indexTimeOffset:this._index.indexTimeOffset},e,this._scaledPeriodEnd)},t.canBeOutOfSyncError=function(e){return!!this._isDynamic&&(e instanceof P.Z&&e.isHttpError(404))},t._replace=function(e){this._parseTimeline=e._parseTimeline,this._index=e._index,this._isDynamic=e._isDynamic,this._scaledPeriodStart=e._scaledPeriodStart,this._scaledPeriodEnd=e._scaledPeriodEnd,this._lastUpdate=e._lastUpdate,this._manifestBoundsCalculator=e._manifestBoundsCalculator,this._isLastPeriod=e._isLastPeriod},t._update=function(e){null===this._index.timeline&&(this._index.timeline=this._getTimeline()),null===e._index.timeline&&(e._index.timeline=e._getTimeline()),(0,L.Z)(this._index.timeline,e._index.timeline)&&(this._index.startNumber=e._index.startNumber),this._index.endNumber=e._index.endNumber,this._isDynamic=e._isDynamic,this._scaledPeriodStart=e._scaledPeriodStart,this._scaledPeriodEnd=e._scaledPeriodEnd,this._lastUpdate=e._lastUpdate,this._isLastPeriod=e._isLastPeriod},t.isFinished=function(){if(!this._isDynamic||!this._isLastPeriod)return!0;null===this._index.timeline&&(this._index.timeline=this._getTimeline());var e=this._index.timeline;if(void 0===this._scaledPeriodEnd||0===e.length)return!1;var t=e[e.length-1];return(0,R.jH)(t,null,this._scaledPeriodEnd)+B(this._index.timescale)>=this._scaledPeriodEnd},t.isInitialized=function(){return!0},e.isTimelineIndexArgument=function(e){return"function"==typeof e.timelineParser||Array.isArray(e.timeline)},t._refreshTimeline=function(){if(null===this._index.timeline&&(this._index.timeline=this._getTimeline()),this._isDynamic){var e=this._manifestBoundsCalculator.estimateMinimumBound();if(null!=e){var t=(0,R.gT)(e,this._index),n=(0,N.Z)(this._index.timeline,t);void 0!==this._index.startNumber?this._index.startNumber+=n:void 0!==this._index.endNumber&&(this._index.startNumber=n+1)}}},e.getIndexEnd=function(e,t){return e.length<=0?null:Math.min((0,R.jH)(e[e.length-1],null,t),null!=t?t:1/0)},t._getTimeline=function(){if(null===this._parseTimeline)return null!==this._index.timeline?this._index.timeline:(o.Z.error("DASH: Timeline already lazily parsed."),[]);var e=this._parseTimeline();this._parseTimeline=null;var t,n=a.Z.getCurrent().MIN_DASH_S_ELEMENTS_TO_PARSE_UNSAFELY;return null===this._unsafelyBaseOnPreviousIndex||e.lengthn){if(r===n+1)return e.slice(0,i+1);var o=e.slice(0,i),s=Object.assign({},a),u=r-a.repeatCount-1;return s.repeatCount=Math.max(0,n-u),o.push(s),o}}return e}var H=G,j=function(){function e(e,t){var n,r,i=t.aggressiveMode,a=t.availabilityTimeOffset,o=t.manifestBoundsCalculator,s=t.isDynamic,u=t.periodEnd,l=t.periodStart,d=t.representationId,c=t.representationBitrate,f=t.isEMSGWhitelisted,v=null!==(n=e.timescale)&&void 0!==n?n:1;this._availabilityTimeOffset=a,this._manifestBoundsCalculator=o,this._aggressiveMode=i;var p=null!=e.presentationTimeOffset?e.presentationTimeOffset:0,h=p-l*v;if(void 0===e.duration)throw new Error("Invalid SegmentTemplate: no duration");var m=void 0===(null===(r=e.initialization)||void 0===r?void 0:r.media)?null:(0,M.zA)(e.initialization.media,d,c),g=void 0===e.media?null:(0,M.zA)(e.media,d,c);this._index={duration:e.duration,timescale:v,indexRange:e.indexRange,indexTimeOffset:h,initialization:null==e.initialization?void 0:{url:m,range:e.initialization.range},url:g,presentationTimeOffset:p,startNumber:e.startNumber,endNumber:e.endNumber},this._isDynamic=s,this._periodStart=l,this._scaledRelativePeriodEnd=void 0===u?void 0:(u-l)*v,this._isEMSGWhitelisted=f}var t=e.prototype;return t.getInitSegment=function(){return(0,x.Z)(this._index,this._isEMSGWhitelisted)},t.getSegments=function(e,t){var n=this._index,r=n.duration,i=n.startNumber,a=n.endNumber,o=n.timescale,s=n.url,u=this._periodStart*o,l=this._scaledRelativePeriodEnd,d=e*o-u,c=(e+t)*o-u,f=this._getFirstSegmentStart(),v=this._getLastSegmentStart();if(null==f||null==v)return[];var p=Math.max(f,d),h=Math.min(v,c);if(h+r<=p)return[];for(var m=[],g=null!=i?i:1,y=Math.floor(p/r),_=y*r;_<=h;_+=r){var b=y+g;if(void 0!==a&&b>a)return m;var S=null!=l&&_+r>l?l-_:r,T=_+u,E=_+this._index.presentationTimeOffset,k=null===s?null:(0,M.QB)(E,b)(s),w={id:String(b),number:b,time:T/o,end:(T+S)/o,duration:S/o,timescale:1,isInit:!1,scaledDuration:S/o,url:k,timestampOffset:-n.indexTimeOffset/o,complete:!0,privateInfos:{isEMSGWhitelisted:this._isEMSGWhitelisted}};m.push(w),y++}return m},t.getFirstAvailablePosition=function(){var e=this._getFirstSegmentStart();return null==e?e:e/this._index.timescale+this._periodStart},t.getLastAvailablePosition=function(){var e=this._getLastSegmentStart();if((0,i.Z)(e))return e;var t=this._estimateRelativeScaledEnd();return Math.min(e+this._index.duration,null!=t?t:1/0)/this._index.timescale+this._periodStart},t.getEnd=function(){if(!this._isDynamic)return this.getLastAvailablePosition();var e=this._estimateRelativeScaledEnd();if(void 0!==e){var t=this._index.timescale;return(e+this._periodStart*t)/t}},t.awaitSegmentBetween=function(e,t){if((0,D.Z)(e<=t),!this._isDynamic)return!1;var n=this._index.timescale,r=B(n),i=this._periodStart*n,a=t*n-i,o=this._estimateRelativeScaledEnd();return void 0===o?a+r>=0:e*n-i-r=e},t.isInitialized=function(){return!0},t._replace=function(e){this._index=e._index,this._aggressiveMode=e._aggressiveMode,this._isDynamic=e._isDynamic,this._periodStart=e._periodStart,this._scaledRelativePeriodEnd=e._scaledRelativePeriodEnd,this._manifestBoundsCalculator=e._manifestBoundsCalculator},t._update=function(e){this._replace(e)},t._getFirstSegmentStart=function(){if(!this._isDynamic)return 0;if(0===this._scaledRelativePeriodEnd||void 0===this._scaledRelativePeriodEnd){var e=this._manifestBoundsCalculator.estimateMaximumBound();if(void 0!==e&&ethis._periodStart?(i-this._periodStart)*r:0;return Math.floor(a/n)*n}},t._getLastSegmentStart=function(){var e,t=this._index,n=t.duration,r=t.timescale,i=t.endNumber,o=t.startNumber,s=void 0===o?1:o;if(this._isDynamic){var u=this._manifestBoundsCalculator.estimateMaximumBound();if(void 0===u)return;var l=this._aggressiveMode?n/r:0;if(void 0!==this._scaledRelativePeriodEnd&&this._scaledRelativePeriodEnd<(u+l-this._periodStart)*this._index.timescale){var d=Math.ceil(this._scaledRelativePeriodEnd/n);return void 0!==i&&i-s+1g||h<2?m:(h-2)*n},t._estimateRelativeScaledEnd=function(){var e,t;if(void 0!==this._index.endNumber){var n=this._index.endNumber-(null!==(e=this._index.startNumber)&&void 0!==e?e:1)+1;return Math.max(Math.min(n*this._index.duration,null!==(t=this._scaledRelativePeriodEnd)&&void 0!==t?t:1/0),0)}if(void 0!==this._scaledRelativePeriodEnd)return Math.max(this._scaledRelativePeriodEnd,0)},e}();function q(e,t){var n;if(0===t.length)return e;var r=t.map((function(e){return{url:e.value}}));if(0===e.length)return r;for(var i=[],a=0;a=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function X(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0){var y=t.parentSegmentTemplates.slice(),_=e.children.segmentTemplate;void 0!==_&&y.push(_);var b=I.Z.apply(void 0,[{}].concat(y));h.availabilityTimeComplete=null!==(n=b.availabilityTimeComplete)&&void 0!==n?n:t.availabilityTimeComplete,h.availabilityTimeOffset=(null!==(r=b.availabilityTimeOffset)&&void 0!==r?r:0)+t.availabilityTimeOffset,i=H.isTimelineIndexArgument(b)?new H(b,h):new j(b,h)}else{var S=t.adaptation.children;if(void 0!==S.segmentBase){var T=S.segmentBase;i=new Z.Z(T,h)}else if(void 0!==S.segmentList){var E=S.segmentList;i=new C(E,h)}else i=new j({duration:Number.MAX_VALUE,timescale:1,startNumber:0,media:""},h)}return i}(e,(0,I.Z)({},n,{availabilityTimeOffset:m,availabilityTimeComplete:h,unsafelyBaseOnPreviousRepresentation:v,adaptation:t,inbandEventStreams:p}));null==e.attributes.bitrate?(o.Z.warn("DASH: No usable bitrate found in the Representation."),f=0):f=e.attributes.bitrate;var y,_=q(n.baseURLs,e.children.baseURLs),b={bitrate:f,cdnMetadata:0===_.length?[{baseUrl:"",id:void 0}]:_.map((function(e){return{baseUrl:e.url,id:e.serviceLocation}})),index:g,id:c};null!=e.attributes.codecs?y=e.attributes.codecs:null!=t.attributes.codecs&&(y=t.attributes.codecs),null!=y&&(y="mp4a.40.02"===y?"mp4a.40.2":y,b.codecs=y),null!=e.attributes.frameRate?b.frameRate=e.attributes.frameRate:null!=t.attributes.frameRate&&(b.frameRate=t.attributes.frameRate),null!=e.attributes.height?b.height=e.attributes.height:null!=t.attributes.height&&(b.height=t.attributes.height),null!=e.attributes.mimeType?b.mimeType=e.attributes.mimeType:null!=t.attributes.mimeType&&(b.mimeType=t.attributes.mimeType),null!=e.attributes.width?b.width=e.attributes.width:null!=t.attributes.width&&(b.width=t.attributes.width);var S=void 0!==t.children.contentProtections?t.children.contentProtections:[];if(void 0!==e.children.contentProtections&&S.push.apply(S,e.children.contentProtections),S.length>0){var T=S.reduce((function(e,t){var n;if(void 0!==t.attributes.schemeIdUri&&"urn:uuid:"===t.attributes.schemeIdUri.substring(0,9)&&(n=t.attributes.schemeIdUri.substring(9).replace(/-/g,"").toLowerCase()),void 0!==t.attributes.keyId&&t.attributes.keyId.length>0){var r={keyId:t.attributes.keyId,systemId:n};void 0===e.keyIds?e.keyIds=[r]:e.keyIds.push(r)}if(void 0!==n){for(var i,a=[],o=Y(t.children.cencPssh);!(i=o()).done;){var u=i.value;a.push({systemId:n,data:u})}if(a.length>0){var l,d=(0,s.Z)(e.initData,(function(e){return"cenc"===e.type}));if(void 0===d)e.initData.push({type:"cenc",values:a});else(l=d.values).push.apply(l,a)}}return e}),{keyIds:void 0,initData:[]});(Object.keys(T.initData).length>0||void 0!==T.keyIds&&T.keyIds.length>0)&&(b.contentProtections=T)}b.hdrInfo=Q({adaptationProfiles:t.attributes.profiles,supplementalProperties:t.children.supplementalProperties,essentialProperties:t.children.essentialProperties,manifestProfiles:n.manifestProfiles,codecs:y}),d.push(b)},f=Y(e);!(l=f()).done;)c();return d}function J(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return ee(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ee(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ee(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ue(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&(n.sort(oe),e[t]=n.map((function(e){return e[0]}))),e}),{});return d.video.sort(oe),k(le,c),le}(I.children.adaptations,V),K=(null!==(u=t.xmlNamespaces)&&void 0!==u?u:[]).concat(null!==(l=I.attributes.namespaces)&&void 0!==l?l:[]),G=function(e,t,n){for(var r,i,a,o=[],s=se(e);!(a=s()).done;)for(var u,l=a.value,d=l.attributes,c=d.schemeIdUri,f=void 0===c?"":c,v=d.timescale,p=void 0===v?1:v,h=n.concat(null!==(r=l.attributes.namespaces)&&void 0!==r?r:[]),g=se(l.children.events);!(u=g()).done;){var y=u.value;if(void 0!==y.eventStreamData){var _=(null!==(i=y.presentationTime)&&void 0!==i?i:0)/p+t,b=void 0===y.duration?void 0:_+y.duration/p,S=void 0;if(y.eventStreamData instanceof Element)S=y.eventStreamData;else{var T=h.reduce((function(e,t){return e+"xmlns:"+t.key+'="'+t.value+'" '}),"","application/xml").documentElement.childNodes[0]}o.push({start:_,end:b,id:y.id,data:{type:"dash-event-stream",value:{schemeIdUri:f,timescale:p,element:S}}})}}return o}(I.children.eventStreams,M,K),W={id:g,start:M,end:P,duration:C,adaptations:z,streamEvents:G};if(d.unshift(W),!T.lastPositionIsKnown()){var H=function(e){for(var t,n=null,r=!0,i=(0,h.Z)(e).filter((function(e){return null!=e})),a=se((0,v.Z)(i,(function(e){return e})));!(t=a()).done;)for(var o,s=se(t.value.representations);!(o=s()).done;){var u=o.value.index.getLastAvailablePosition();null!==u&&(r=!1,"number"==typeof u&&(n=null==n?u:Math.max(n,u)))}if(null!=n)return n;if(r)return null;return}(z);if(f)if("number"==typeof H){var j=performance.now()/1e3;T.setLastPosition(H,j)}else{var Y=ce(t,M);if(void 0!==Y){var X=Y[0],Q=Y[1];T.setLastPosition(X,Q)}}else"number"==typeof H&&T.setLastPosition(H)}},w=e.length-1;w>=0;w--)E();if(t.isDynamic&&!T.lastPositionIsKnown()){var I=ce(t,0);if(void 0!==I){var Z=I[0],R=I[1];T.setLastPosition(Z,R)}}return function(e){if(0===e.length)return[];for(var t=[e[0]],n=1;nr.start)&&(o.Z.warn("DASH: Updating overlapping Periods.",null==i?void 0:i.start,r.start),i.duration=r.start-i.start,i.end=r.start,!(i.duration>0));)t.pop(),i=t[t.length-1];t.push(r)}return t}(d)}function ce(e,t){if(null!=e.clockOffset){var n=e.clockOffset/1e3-e.availabilityStartTime,r=performance.now()/1e3,i=r+n;if(i>=t)return[i,r]}else{var a=Date.now()/1e3;if(a>=t)return o.Z.warn("DASH Parser: no clock synchronization mechanism found. Using the system clock instead."),[a-e.availabilityStartTime,performance.now()/1e3]}}function fe(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return ve(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ve(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ve(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0?t[0].value:void 0}(t);if(null!=y&&y.length>0)return{type:"needs-clock",value:{url:y,continue:function(i){return i.success?(n.externalClockOffset=l(i.data),e(t,n,r,!0)):(r.push(i.error),o.Z.warn("DASH Parser: Error on fetching the clock ressource",i.error),e(t,n,r,!0))}}}}}for(var _=[],b=0;b=0&&(d=0===h.minimumUpdatePeriod?a.Z.getCurrent().DASH_FALLBACK_LIFETIME_WHEN_MINIMUM_UPDATE_PERIOD_EQUAL_0:h.minimumUpdatePeriod);var I=f(k),Z=I.minimumSafePosition,R=I.maximumSafePosition,x=I.maximumUnsafePosition,M=performance.now();if(m){var C,P;if(c=Z,A=null!=b?b:null,void 0!==x&&(P=x),void 0!==R)C=R;else{var D=null!=_?_:0,N=t.externalClockOffset;if(void 0===N)o.Z.warn("DASH Parser: use system clock to define maximum position"),C=Date.now()/1e3-D;else C=(performance.now()+N)/1e3-D}void 0===P&&(P=C),v={isLinear:!0,maximumSafePosition:C,livePosition:P,time:M},null!==A&&void 0!==c&&C-c>A&&(A=C-c)}else{c=void 0!==Z?Z:void 0!==(null===(i=k[0])||void 0===i?void 0:i.start)?k[0].start:0;var O=null!=w?w:1/0;if(void 0!==k[k.length-1]){var L=k[k.length-1],U=null!==(s=L.end)&&void 0!==s?s:void 0!==L.duration?L.start+L.duration:void 0;void 0!==U&&U=0;o--){var s,u=_[o].index,l=a[o],f=l.parsed,v=l.warnings,p=l.receivedTime,h=l.sendingTime,m=l.url;v.length>0&&r.push.apply(r,v);for(var g,y=fe(f);!(g=y()).done;){var b=g.value;d.set(b,{receivedTime:p,sendingTime:h,url:m})}(s=c.periods).splice.apply(s,[u,1].concat(f))}return e(t,n,r,i,d)}}}};function he(e){var t=e.textContent,n=[];return null===t||0===t.length?[void 0,n]:[{value:t},n]}function me(e){for(var t={},n=0;n0){var s=xe(a,"cenc:pssh"),u=s[0],l=s[1];null!==l&&(o.Z.warn(l.message),t.push(l)),null!==u&&n.push(u)}}}return[{cencPssh:n},t]}(e.childNodes),n=t[0],r=t[1];return[{children:n,attributes:function(e){for(var t={},n=0;n0&&(r=r.concat(c));break;case"SegmentList":var f=Ue(a),v=f[0],p=f[1];r=r.concat(p),t.segmentList=v;break;case"SegmentTemplate":var h=Fe(a),m=h[0],g=h[1];r=r.concat(g),t.segmentTemplate=m;break;case"ContentProtection":var y=De(a),_=y[0],b=y[1];b.length>0&&(r=r.concat(b)),void 0!==_&&n.push(_)}}return n.length>0&&(t.contentProtections=n),[t,r]}(e.childNodes),n=t[0],r=t[1],i=function(e){for(var t={},n=[],r=Ce(t,n),i=0;i0&&(r=r.concat(u));break;case"ContentComponent":t.contentComponent=me(a);break;case"EssentialProperty":null==t.essentialProperties?t.essentialProperties=[Me(a)]:t.essentialProperties.push(Me(a));break;case"InbandEventStream":void 0===t.inbandEventStreams&&(t.inbandEventStreams=[]),t.inbandEventStreams.push(Me(a));break;case"Label":var l=a.textContent;null!=l&&(t.label=l);break;case"Representation":var d=Ve(a),c=d[0],f=d[1];t.representations.push(c),f.length>0&&(r=r.concat(f));break;case"Role":null==t.roles?t.roles=[Me(a)]:t.roles.push(Me(a));break;case"SupplementalProperty":null==t.supplementalProperties?t.supplementalProperties=[Me(a)]:t.supplementalProperties.push(Me(a));break;case"SegmentBase":var v=Oe(a),p=v[0],h=v[1];t.segmentBase=p,h.length>0&&(r=r.concat(h));break;case"SegmentList":var m=Ue(a),g=m[0],y=m[1];t.segmentList=g,y.length>0&&(r=r.concat(y));break;case"SegmentTemplate":var _=Fe(a),b=_[0],S=_[1];t.segmentTemplate=b,S.length>0&&(r=r.concat(S));break;case"ContentProtection":var T=De(a),E=T[0],k=T[1];k.length>0&&(r=r.concat(k)),void 0!==E&&n.push(E)}}return n.length>0&&(t.contentProtections=n),[t,r]}(e.childNodes),n=t[0],r=t[1],i=function(e){for(var t={},n=[],r=Ce(t,n),i=0;i0&&(n=n.concat(d))}}return[t,n]}function Ge(e){for(var t={eventStreamData:e},n=[],r=Ce(t,n),i=0;i0&&(i=i.concat(_))}}return[{baseURLs:n,adaptations:r,eventStreams:a,segmentTemplate:t},i]}(e.childNodes),n=t[0],r=t[1],i=function(e){for(var t={},n=[],r=Ce(t,n),i=0;i",c=(new DOMParser).parseFromString(d,"text/xml");if(null==c||0===c.children.length)throw new Error("DASH parser: Invalid external ressources");for(var f=c.children[0].children,v=[],p=[],h=0;h0;){var r=e[0];if(r.start>=t)return n;if(-1===r.repeatCount)return n;if(0===r.repeatCount)e.shift(),n+=1;else{var i=e[1];if(void 0!==i&&i.start<=t)e.shift(),n+=1;else{if(r.duration<=0)return n;for(var a=r.start+r.duration,o=1;ar.repeatCount)){var s=r.repeatCount-o;return r.start=a,r.repeatCount=s,n+=o}e.shift(),n=r.repeatCount+1}}}return n}n.d(t,{Z:function(){return r}})},3911:function(e,t,n){"use strict";n.d(t,{KF:function(){return i},PZ:function(){return u},_j:function(){return l},gT:function(){return o},jH:function(){return a},zG:function(){return s}});var r=n(1946);function i(e,t,n){var i,a=e.repeatCount;return a>=0?a:(i=(0,r.Z)(t)?void 0!==n?n:Number.MAX_VALUE:t.start,Math.ceil((i-e.start)/e.duration)-1)}function a(e,t,n){var r=e.start,a=e.duration;return a<=0?r:r+(i(e,t,n)+1)*a}function o(e,t){var n;return e*t.timescale+(null!==(n=t.indexTimeOffset)&&void 0!==n?n:0)}function s(e,t){var n;return(e-(null!==(n=t.indexTimeOffset)&&void 0!==n?n:0))/t.timescale}function u(e,t,n){return[e*n,(e+t)*n]}function l(e,t,n){var r=e.timeline,i=o(t,e);if(i<0)return null;var u=function(e,t){for(var n=0,r=e.length;n>>1;e[i].start<=t?n=i+1:r=i}return n-1}(r,i);if(u<0||u>=r.length-1)return null;var l=r[u];if(l.duration<=0)return null;var d=r[u+1];if(void 0===d)return null;var c=d.start;return i>=a(l,d,n)&&ie.time)return!1;if(o===e.time)return void 0===a.range?void 0===e.range:null!=e.range&&a.range[0]===e.range[0]&&a.range[1]===e.range[1];if(a.repeatCount>=0&&void 0!==a.duration){var s=(o-a.start)/a.duration-1;return s%1==0&&s<=a.repeatCount}}return!1}n.d(t,{Z:function(){return r}})},5505:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var r=n(3714),i=n(3887),a=n(3911);function o(e,t){if(0===e.length)return e.push.apply(e,t),!0;if(0===t.length)return!1;var n=e.length,o=t[0].start,s=e[n-1];if((0,a.jH)(s,t[0])=0;u--){var l=e[u].start;if(l===o){var d=n-u;return e.splice.apply(e,[u,d].concat(t)),!1}if(lo)return i.Z.warn("RepresentationIndex: Manifest update removed all previous segments"),e.splice.apply(e,[0,n].concat(t)),!0;if(void 0===c.repeatCount||c.repeatCount<=0)return c.repeatCount<0&&(c.repeatCount=Math.floor((o-c.start)/c.duration)-1),e.splice.apply(e,[u+1,n-(u+1)].concat(t)),!1;if(c.start+c.duration*(c.repeatCount+1)<=o)return e.splice.apply(e,[u+1,n-(u+1)].concat(t)),!1;var f=(o-c.start)/c.duration-1;if(f%1==0&&c.duration===t[0].duration){var v=t[0].repeatCount<0?-1:t[0].repeatCount+f+1;return e.splice.apply(e,[u,n-u].concat(t)),e[u].start=c.start,e[u].repeatCount=v,!1}return i.Z.warn("RepresentationIndex: Manifest update removed previous segments"),e[u].repeatCount=Math.floor(f),e.splice.apply(e,[u+1,n-(u+1)].concat(t)),!1}}var p=e[e.length-1],h=t[t.length-1];return void 0!==p.repeatCount&&p.repeatCount<0?p.start>h.start?(i.Z.warn("RepresentationIndex: The new index is older than the previous one"),!1):(i.Z.warn('RepresentationIndex: The new index is "bigger" than the previous one'),e.splice.apply(e,[0,n].concat(t)),!0):p.start+p.duration*(p.repeatCount+1)>=h.start+h.duration*(h.repeatCount+1)?(i.Z.warn("RepresentationIndex: The new index is older than the previous one"),!1):(i.Z.warn('RepresentationIndex: The new index is "bigger" than the previous one'),e.splice.apply(e,[0,n].concat(t)),!0)}},5734:function(e,t,n){"use strict";var r=n(6923),i=/&#([0-9]+);/g,a=/
/gi,o=/]*>([\s\S]*?)<\/style[^>]*>/i,s=/\s*

]+))?>(.*)/i,u=/]+?start="?([0-9]*)"?[^0-9]/i;function l(e,t){var n=new RegExp("\\s*"+t+":\\s*(\\S+);","i").exec(e);return Array.isArray(n)?n[1]:null}t.Z=function(e,t,n){var d,c,f=/]/gi,v=/]|<\/body>/gi,p=[],h=o.exec(e),m=Array.isArray(h)?h[1]:"";v.exec(e);var g,y=function(e){for(var t=/\.(\S+)\s*{([^}]*)}/gi,n={},r=t.exec(e);null!==r;){var i=r[1],a=l(r[2],"lang");null!=i&&null!=a&&(n[a]=i),r=t.exec(e)}return n}(m),_=function(e){var t=/p\s*{([^}]*)}/gi.exec(e);return null===t?"":t[1]}(m);if((0,r.Z)(n)&&void 0===(g=y[n]))throw new Error("sami: could not find lang "+n+" in CSS");for(;d=f.exec(e),c=v.exec(e),null!==d||null!==c;){if(null===d||null===c||d.index>=c.index)throw new Error("parse error");var b=e.slice(d.index,c.index),S=u.exec(b);if(!Array.isArray(S))throw new Error("parse error (sync time attribute)");var T=+S[1];if(isNaN(T))throw new Error("parse error (sync time attribute NaN)");E(b.split("\n"),T/1e3)}return p;function E(e,n){for(var o=e.length;--o>=0;){var u=s.exec(e[o]);if(Array.isArray(u)){var l=u[1],d=u[2];if(g===l)if(" "===d)p[p.length-1].end=n;else{var c=document.createElement("DIV");c.className="rxp-texttrack-region";var f=document.createElement("DIV");f.className="rxp-texttrack-div",f.style.position="absolute",f.style.bottom="0",f.style.width="100%",f.style.color="#fff",f.style.textShadow="-1px -1px 0 #000,1px -1px 0 #000,-1px 1px 0 #000,1px 1px 0 #000";var v=document.createElement("div");v.className="rxp-texttrack-p",(0,r.Z)(_)&&(v.style.cssText=_);for(var h=d.split(a),m=0;m/gi,s=/]*>([\s\S]*?)<\/style[^>]*>/i,u=/\s*

]+))?>(.*)/i,l=/]+?start="?([0-9]*)"?[^0-9]/i;function d(e,t){var n=new RegExp("\\s*"+t+":\\s*(\\S+);","i").exec(e);return Array.isArray(n)?n[1]:null}t.Z=function(e,t,n){var c,f,v=/]/gi,p=/]|<\/body>/gi,h=[],m=s.exec(e),g=null!==m?m[1]:"";p.exec(e);var y,_=function(e){for(var t=/\.(\S+)\s*{([^}]*)}/gi,n={},r=t.exec(e);Array.isArray(r);){var i=r[1],a=d(r[2],"lang");null!=i&&null!=a&&(n[a]=i),r=t.exec(e)}return n}(g);if((0,i.Z)(n)&&void 0===(y=_[n]))throw new Error("sami: could not find lang "+n+" in CSS");for(;c=v.exec(e),f=p.exec(e),null!==c||null!==f;){if(null===c||null===f||c.index>=f.index)throw new Error("parse error");var b=e.slice(c.index,f.index),S=l.exec(b);if(null===S)throw new Error("parse error (sync time attribute)");var T=+S[1];if(isNaN(T))throw new Error("parse error (sync time attribute NaN)");E(b.split("\n"),T/1e3)}return function(e){for(var t=[],n=0;n=0;)if(null!==(r=u.exec(e[s]))){var l=r,d=l[1],c=l[2];y===d&&(" "===c?h[h.length-1].end=n:h.push({text:(i=c,i.replace(o,"\n").replace(a,(function(e,t){return String.fromCharCode(Number(t))}))),start:n+t}))}}}},2061:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(6923);function i(e,t){for(var n=t+1;(0,r.Z)(e[n]);)n++;return n}function a(e){for(var t=[],n=0;n0&&(1===o.length?o[0].indexOf("--\x3e")>=0&&t.push(o):(o[1].indexOf("--\x3e")>=0||o[0].indexOf("--\x3e")>=0)&&t.push(o)),n=a}return t}},8675:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(2061),i=n(788);function a(e,t){for(var n=e.split(/\r\n|\n|\r/),a=(0,r.Z)(n),s=[],u=0;u0){var l=document.createTextNode(o[s]);r.appendChild(l)}}else if("B"===a.nodeName){var d=e(a);d.style.fontWeight="bold",r.appendChild(d)}else if("I"===a.nodeName){var c=e(a);c.style.fontStyle="italic",r.appendChild(c)}else if("U"===a.nodeName){var f=e(a);f.style.textDecoration="underline",r.appendChild(f)}else if(u(a)&&"string"==typeof a.color){var v=e(a);v.style.color=a.color,r.appendChild(v)}else{var p=e(a);r.appendChild(p)}}return r}(t)}function u(e){return"FONT"===e.nodeName&&"color"in e}},8057:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var r=n(7253),i=n(2061),a=n(788);function o(e,t){for(var n,o,s,u,l,d=e.split(/\r\n|\n|\r/),c=(0,i.Z)(d),f=[],v=0;v0){var _=p.getAttribute("xml:space"),b=(0,l.Z)(_)?"default"===_:o,T=(0,d.Z)({},i,(0,c.U)(g,[p],n,t));u.push.apply(u,e(p,T,[p].concat(a),b))}}return u}(e,(0,d.Z)({},r),[],i)}(e,n,r,i,s),T=0;T|\u2265/g,">").replace(/\u200E/g,"‎").replace(/\u200F/g,"‏").replace(/\u00A0/g," ")}else if((0,l.OE)(s))i+="\n";else if((0,l.jg)(s)&&s.nodeType===Node.ELEMENT_NODE&&s.childNodes.length>0){var c=s.getAttribute("xml:space");i+=n(s,(0,o.Z)(c)?"default"===c:t)}}return i}return n(e,t)}(t,v),y=(0,i.Z)(h+n,m+n,g);return null===y?null:((0,a.Z)(y)&&function(e,t){var n=t.extent;if((0,o.Z)(n)){var r=u._0.exec(n);null!=r&&(e.size=Number(r[1]))}switch(t.writingMode){case"tb":case"tblr":e.vertical="lr";break;case"tbrl":e.vertical="rl"}var i=t.origin;if((0,o.Z)(i))u._0.exec(i);var a=t.align;if((0,o.Z)(a)){e.align=a,"center"===a&&("center"!==e.align&&(e.align="middle"),e.position="auto");var s=c[a];e.positionAlign=void 0===s?"":s;var l=d[a];e.lineAlign=void 0===l?"":l}}(y,r),y)}var v=function(e,t){for(var n=(0,r.Z)(e,t),i=[],a=0;a0&&(t=n)}return t}function a(e){var t=e.getElementsByTagName("body");if(t.length>0)return t[0];var n=e.getElementsByTagName("tt:body");return n.length>0?n[0]:null}function o(e){var t=e.getElementsByTagName("style");if(t.length>0)return t;var n=e.getElementsByTagName("tt:style");return n.length>0?n:t}function s(e){var t=e.getElementsByTagName("region");if(t.length>0)return t;var n=e.getElementsByTagName("tt:region");return n.length>0?n:t}function u(e){var t=e.getElementsByTagName("p");if(t.length>0)return t;var n=e.getElementsByTagName("tt:p");return n.length>0?n:t}function l(e){return"br"===e.nodeName||"tt:br"===e.nodeName}function d(e){return"span"===e.nodeName||"tt:span"===e.nodeName}n.d(t,{DM:function(){return s},H:function(){return a},OE:function(){return l},jF:function(){return i},jg:function(){return d},kd:function(){return u},vU:function(){return o}})},1138:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(6923),i=n(360);function a(e,t){for(var n=[],a=t;a=2)for(var r=function(r){var o=e[r];if(Array.isArray(/::cue {/.exec(o)))for(o=e[++r];(0,i.Z)(o)&&!Array.isArray(/}/.exec(o))&&0!==o.length;)n+=o,o=e[++r];else{for(var s=[],u=/::cue\(\.?(.*?)\)(?:,| {)/.exec(o);(0,i.Z)(o)&&Array.isArray(u);)s.push(u[1]),o=e[++r],u=/::cue\(\.?(.*?)\)(?:,| {)/.exec(o);for(var l="";(0,i.Z)(o)&&!Array.isArray(/}/.exec(o))&&0!==o.length;)l+=o,o=e[++r];s.forEach((function(e){void 0===t[e]?t[e]=l:t[e]+=l}))}a=r},a=1;a0&&n.appendChild(document.createElement("br")),o[s].length>0){var u=document.createTextNode(o[s]);n.appendChild(u)}}else{var c=e.nodeName.toLowerCase().split("."),f=[];if(c.forEach((function(e){(0,i.Z)(t[e])&&f.push(t[e])})),0!==f.length){var v=document.createAttribute("style");f.forEach((function(e){v.value+=e}));var p=(0,l.Z)(r,a)?a:"span";(n=document.createElement(p)).setAttributeNode(v)}else{var h=(0,l.Z)(r,a)?a:"span";n=document.createElement(h)}for(var m=0;m/,"").replace(/<([u,i,b,c])(\..*?)?(?: .*?)?>(.*?)<\/\1>/g,"<$1$2>$3"),r=(new DOMParser).parseFromString(n,"text/html").body.childNodes,i=[],a=0;a=2){var a=parseInt(i[1],10);isNaN(a)||(t.position=a,void 0!==i[2]&&(t.positionAlign=i[2]))}}(0,u.Z)(e.size)&&(t.size=e.size),"string"==typeof e.align&&(0,s.Z)(["start","center","end","left"],e.align)&&(t.align=e.align)}var d=n(7253);var c=function(e,t){var n=e.split(/\r\n|\n|\r/);if(!/^WEBVTT($| |\t)/.test(n[0]))throw new Error("Can't parse WebVTT: Invalid file.");for(var s,u,c,f,v=(0,o.yE)(n),p=(0,i.Z)(n,v),h=[],m=0;m/;if(o.test(e[0]))n=e[0],r=e.slice(1,e.length);else{if(!o.test(e[1]))return null;a=e[0],n=e[1],r=e.slice(2,e.length)}var s=function(e){var t=/^([\d:.]+)[ |\t]+-->[ |\t]+([\d:.]+)[ |\t]*(.*)$/.exec(e);if(null===t)return null;var n=i(t[1]),r=i(t[2]);return null==n||null==r?null:{start:n,end:r,settings:t[3].split(/ |\t/).reduce((function(e,t){var n=t.split(":");return 2===n.length&&(e[n[0]]=n[1]),e}),{})}}(n);return null===s?null:{start:s.start+t,end:s.end+t,settings:s.settings,payload:r,header:a}}},360:function(e,t,n){"use strict";n.d(t,{$4:function(){return s},JF:function(){return a},tq:function(){return o},yE:function(){return i}});var r=n(6923);function i(e){for(var t=0;t=0)return!0;var r=e[t+1];return void 0!==r&&r.indexOf("--\x3e")>=0}function s(e,t){for(var n=t+1;(0,r.Z)(e[n]);)n++;return n}},85:function(e,t,n){"use strict";n.d(t,{Z:function(){return fe}});var r=n(7874),i=n(8791),a=n(5861),o=n(4687),s=n.n(o),u=n(4597),l=n(5278),d=n(9829);function c(e,t){return null===e?null:null===t.url?e.baseUrl:(0,d.Z)(e.baseUrl,t.url)}function f(e,t,n,r,i){return v.apply(this,arguments)}function v(){return(v=(0,a.Z)(s().mark((function e(t,n,r,i,a){var o,l,d;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=n.segment,l=c(t,o),!o.isInit&&null!==l){e.next=4;break}return e.abrupt("return",{resultType:"segment-created",resultData:null});case 4:return e.next=6,(0,u.ZP)({url:l,responseType:"arraybuffer",timeout:r.timeout,onProgress:a.onProgress,cancelSignal:i});case 6:return d=e.sent,e.abrupt("return",{resultType:"segment-loaded",resultData:d});case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function p(e,t){var n=t.segment,i=t.period,a=e.data,o=e.isChunked;if(t.segment.isInit)return{segmentType:"init",initializationData:null,initializationDataSize:0,protectionDataUpdate:!1,initTimescale:void 0};if(o)throw new Error("Image data should not be downloaded in chunks");var s=(0,l.Z)(n.timestampOffset,0);return null===a||null===r.Z.imageParser?{segmentType:"media",chunkData:null,chunkSize:0,chunkInfos:{duration:n.duration,time:n.time},chunkOffset:s,protectionDataUpdate:!1,appendWindow:[i.start,i.end]}:{segmentType:"media",chunkData:{data:r.Z.imageParser(new Uint8Array(a)).thumbs,start:0,end:Number.MAX_VALUE,timescale:1,type:"bif"},chunkSize:void 0,chunkInfos:{time:0,duration:Number.MAX_VALUE},chunkOffset:s,protectionDataUpdate:!1,appendWindow:[i.start,i.end]}}var h=n(6872),m=n(8750),g=n(3887),y=n(1989),_=n(8026),b=n(3635);function S(e){var t=e.aggressiveMode,n=e.referenceDateTime,i=void 0!==e.serverSyncInfos?e.serverSyncInfos.serverTimestamp-e.serverSyncInfos.clientTime:void 0;return function(a,o,s,l,d){var c,f=a.responseData,v=o.externalClockOffset,p=null!==(c=a.url)&&void 0!==c?c:o.originalUrl,S=null!=i?i:v,T={aggressiveMode:!0===t,unsafelyBaseOnPreviousManifest:o.unsafeMode?o.previousManifest:null,url:p,referenceDateTime:n,externalClockOffset:S},E=r.Z.dashParsers;if(null===E.wasm||"uninitialized"===E.wasm.status||"failure"===E.wasm.status)return g.Z.debug("DASH: WASM MPD Parser not initialized. Running JS one."),w();var k=function(e){if(e instanceof ArrayBuffer)return e;if("string"==typeof e)return(0,b.tG)(e).buffer;if(e instanceof Document)return(0,b.tG)(e.documentElement.innerHTML).buffer;throw new Error("DASH Manifest Parser: Unrecognized Manifest format")}(f);return function(e){var t=new DataView(e);if(61371===t.getUint16(0)&&191===t.getUint8(2))return!0;if(65279===t.getUint16(0)||65534===t.getUint16(0))return!1;return!0}(k)?"initialized"===E.wasm.status?(g.Z.debug("DASH: Running WASM MPD Parser."),A(E.wasm.runWasmParser(k,T))):(g.Z.debug("DASH: Awaiting WASM initialization before parsing the MPD."),E.wasm.waitForInitialization().catch((function(){})).then((function(){return null===E.wasm||"initialized"!==E.wasm.status?(g.Z.warn("DASH: WASM MPD parser initialization failed. Running JS parser instead"),w()):(g.Z.debug("DASH: Running WASM MPD Parser."),A(E.wasm.runWasmParser(k,T)))}))):(g.Z.info("DASH: MPD doesn't seem to be UTF-8-encoded. Running JS parser instead of the WASM one."),w());function w(){if(null===E.js)throw new Error("No MPD parser is imported");var e=function(e){if(e instanceof ArrayBuffer)return(new DOMParser).parseFromString((0,b.uR)(new Uint8Array(e)),"text/xml");if("string"==typeof e)return(new DOMParser).parseFromString(e,"text/xml");if(e instanceof Document)return e;throw new Error("DASH Manifest Parser: Unrecognized Manifest format")}(f);return A(E.js(e,T))}function A(t){if("done"===t.type)return t.value.warnings.length>0&&s(t.value.warnings),l.isCancelled()?Promise.reject(l.cancellationError):{manifest:new y.ZP(t.value.parsed,e),url:p};var n=t.value,r=n.urls.map((function(e){return d((function(){var t=h.Z.getCurrent().DEFAULT_REQUEST_TIMEOUT;return"string"===n.format?(0,u.ZP)({url:e,responseType:"text",timeout:t,cancelSignal:l}):(0,u.ZP)({url:e,responseType:"arraybuffer",timeout:t,cancelSignal:l})})).then((function(e){if("string"===n.format){if("string"!=typeof e.responseData)throw new Error("External DASH resources should have been a string");return(0,_.Z)(e,{responseData:{success:!0,data:e.responseData}})}if(!(e.responseData instanceof ArrayBuffer))throw new Error("External DASH resources should have been ArrayBuffers");return(0,_.Z)(e,{responseData:{success:!0,data:e.responseData}})}),(function(e){var t=(0,m.Z)(e,{defaultCode:"PIPELINE_PARSE_ERROR",defaultReason:"An unknown error occured when parsing ressources."});return(0,_.Z)({},{size:void 0,requestDuration:void 0,responseData:{success:!1,error:t}})}))}));return Promise.all(r).then((function(e){return n.format,A(n.continue(e))}))}}}var T=n(7839),E=n(9105),k=n(5992),w=n(1946),A="function"==typeof Headers?Headers:null,I="function"==typeof AbortController?AbortController:null;function Z(){return"function"==typeof window.fetch&&!(0,w.Z)(I)&&!(0,w.Z)(A)}var R=n(8806),x=n(281);function M(e,t){return"audio"===e||"video"===e?"video/mp4"===t.mimeType||"audio/mp4"===t.mimeType?"mp4":"video/webm"===t.mimeType||"audio/webm"===t.mimeType?"webm":void 0:"text"===e&&"application/mp4"===t.mimeType?"mp4":void 0}var C=n(288),P=n(4460);function D(e){return function(t,n,r,i,a){return new Promise((function(s,u){var l=new C.ZP,d=l.linkToSignal(i);function c(){l.signal.deregister(u),d()}l.signal.register(u),e(t,n,r,l.signal,Object.assign(Object.assign({},a),{onNewChunk:function(e){try{o(e),a.onNewChunk(e)}catch(e){c(),l.cancel(),u(e)}}})).then((function(e){if(c(),!l.isUsed()){if("segment-loaded"===e.resultType)try{o(e.resultData.responseData)}catch(e){return void u(e)}s(e)}}),(function(e){c(),u(e)}))}));function o(e){(e instanceof ArrayBuffer||e instanceof Uint8Array)&&"mp4"===M(n.adaptation.type,n.representation)&&(0,P.Z)(new Uint8Array(e),n.segment.isInit)}}}var N=n(6968);function O(e,t,n,r,i){if(void 0===t.range)return(0,u.ZP)({url:e,responseType:"arraybuffer",timeout:n.timeout,cancelSignal:r,onProgress:i.onProgress}).then((function(e){return{resultType:"segment-loaded",resultData:e}}));if(void 0===t.indexRange)return(0,u.ZP)({url:e,headers:{Range:(0,x.Z)(t.range)},responseType:"arraybuffer",timeout:n.timeout,cancelSignal:r,onProgress:i.onProgress}).then((function(e){return{resultType:"segment-loaded",resultData:e}}));if(t.range[1]+1===t.indexRange[0])return(0,u.ZP)({url:e,headers:{Range:(0,x.Z)([t.range[0],t.indexRange[1]])},responseType:"arraybuffer",timeout:n.timeout,cancelSignal:r,onProgress:i.onProgress}).then((function(e){return{resultType:"segment-loaded",resultData:e}}));var a=(0,u.ZP)({url:e,headers:{Range:(0,x.Z)(t.range)},responseType:"arraybuffer",timeout:n.timeout,cancelSignal:r,onProgress:i.onProgress}),o=(0,u.ZP)({url:e,headers:{Range:(0,x.Z)(t.indexRange)},responseType:"arraybuffer",timeout:n.timeout,cancelSignal:r,onProgress:i.onProgress});return Promise.all([a,o]).then((function(t){var n=t[0],r=t[1],i=(0,N.zo)(new Uint8Array(n.responseData),new Uint8Array(r.responseData)),a=Math.min(n.sendingTime,r.sendingTime),o=Math.max(n.receivedTime,r.receivedTime);return{resultType:"segment-loaded",resultData:{url:e,responseData:i,size:n.size+r.size,requestDuration:o-a,sendingTime:a,receivedTime:o}}}))}var L=n(8766);function U(e,t,n,r,i){var o=t.segment,u=void 0!==o.range?{Range:(0,x.Z)(o.range)}:void 0,l=null;return function(e){var t;if(!(0,w.Z)(e.headers))if((0,w.Z)(A))t=e.headers;else{t=new A;for(var n=Object.keys(e.headers),r=0;r=300)throw g.Z.warn("Fetch: Request HTTP Error",t.status,t.url),new E.Z(t.url,t.status,k.br.ERROR_HTTP_CODE);if((0,w.Z)(t.body))throw new E.Z(t.url,t.status,k.br.PARSE_ERROR);var n=t.headers.get("Content-Length"),r=(0,w.Z)(n)||isNaN(+n)?void 0:+n,i=t.body.getReader(),u=0;return l();function l(){return c.apply(this,arguments)}function c(){return(c=(0,a.Z)(s().mark((function n(){var a,o,c,f,p;return s().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,i.read();case 2:if((a=n.sent).done||(0,w.Z)(a.value)){n.next=11;break}return u+=a.value.byteLength,o=performance.now(),c={url:t.url,currentTime:o,duration:o-d,sendingTime:d,chunkSize:a.value.byteLength,chunk:a.value.buffer,size:u,totalSize:r},e.onData(c),n.abrupt("return",l());case 11:if(!a.done){n.next=16;break}return v(),f=performance.now(),p=f-d,n.abrupt("return",{requestDuration:p,receivedTime:f,sendingTime:d,size:u,status:t.status,url:t.url});case 16:return n.abrupt("return",l());case 17:case"end":return n.stop()}}),n)})))).apply(this,arguments)}})).catch((function(t){if(null!==u)throw u;if(v(),l)throw g.Z.warn("Fetch: Request timeouted."),new E.Z(e.url,0,k.br.TIMEOUT);if(t instanceof E.Z)throw t;throw g.Z.warn("Fetch: Request Error",t instanceof Error?t.toString():""),new E.Z(e.url,0,k.br.ERROR_EVENT)}))}({url:e,headers:u,onData:function(e){var t=new Uint8Array(e.chunk),n=function(e){for(var t=0,n=[];te.length)return[n,r];var o=(0,L.Z)(r,1835295092);if(o<0)return[n,r];var s=t+o+(0,N.pX)(e,o+t);if(s>e.length)return[n,r];var u=Math.max(a,s),l=e.subarray(t,u);n.push(l),t=u}return[n,null]}(null!==l?(0,N.zo)(l,t):t),a=n[0];l=n[1];for(var o=0;o0)for(var v=0;v=Math.pow(2,8-n))return n}function te(e,t){var n=ee(e,t);if(null==n)return g.Z.warn("webm: unrepresentable length"),null;if(t+n>e.length)return g.Z.warn("webm: impossible length"),null;for(var r=0,i=0;ie.length)return g.Z.warn("webm: impossible length"),null;for(var r=(e[t]&(1<<8-n)-1)*Math.pow(2,8*(n-1)),i=1;i=i)return!0}return!1}(r,t);return{inbandEvents:a,needsManifestRefresh:o}}}function se(e){var t=e.__priv_patchLastSegmentInSidx;return function(e,n,r){var i,a=n.period,o=n.adaptation,s=n.representation,u=n.segment,d=n.manifest,c=e.data,f=e.isChunked,v=[a.start,a.end];if(null===c)return u.isInit?{segmentType:"init",initializationData:null,initializationDataSize:0,protectionDataUpdate:!1,initTimescale:void 0}:{segmentType:"media",chunkData:null,chunkSize:0,chunkInfos:null,chunkOffset:0,protectionDataUpdate:!1,appendWindow:v};var p=c instanceof Uint8Array?c:new Uint8Array(c),h=M(o.type,s),m="mp4"===h||void 0===h,g=!1;if(m){var y,_=(0,F.Z)(p);u.isInit&&(y=null!==(i=(0,V.R0)(p))&&void 0!==i?i:void 0),(_.length>0||void 0!==y)&&(g=s._addProtectionData("cenc",y,_))}if(!u.isInit){var b=m?ae(p,f,u,r):null,S=(0,l.Z)(u.timestampOffset,0);if(m){var T=(0,V.s9)(p);if(void 0!==T){var E=oe(T.filter((function(e){return void 0!==u.privateInfos&&void 0!==u.privateInfos.isEMSGWhitelisted&&u.privateInfos.isEMSGWhitelisted(e)})),d.publishTime);if(void 0!==E){var k=E.needsManifestRefresh,A=E.inbandEvents;return{segmentType:"media",chunkData:p,chunkSize:p.length,chunkInfos:b,chunkOffset:S,appendWindow:v,inbandEvents:A,protectionDataUpdate:g,needsManifestRefresh:k}}}}return{segmentType:"media",chunkData:p,chunkSize:p.length,chunkInfos:b,chunkOffset:S,protectionDataUpdate:g,appendWindow:v}}var I=u.indexRange,Z=null;if("webm"===h)Z=function(e,t){var n=Q(z,[],e,[t,e.length]);if(null==n)return null;var r=n[0],i=n[1],a=$(e,r);if(null==a)return null;var o=J(e,r);if(null==o)return null;var s=Q(H,[],e,[r,i]);if(null==s)return null;for(var u=[],l=s[0];l0)){var R=Z[Z.length-1];Array.isArray(R.range)&&(R.range[1]=1/0)}s.index instanceof ie.Z&&null!==Z&&Z.length>0&&s.index.initializeIndex(Z);var x=m?(0,V.LD)(p):"webm"===h?$(p,0):void 0,C=(0,w.Z)(x)?void 0:x;return{segmentType:"init",initializationData:p,initializationDataSize:p.length,protectionDataUpdate:g,initTimescale:C}}}var ue=n(6807);function le(e,t,n,r){var i,a,o=e.segment,s=e.adaptation,u=e.representation;if(o.isInit)return null;null===n?r?(i=o.time,a=o.end):g.Z.warn("Transport: Unavailable time data for current text track."):(i=n.time,void 0!==n.duration?a=i+n.duration:!r&&o.complete&&(a=i+o.duration));var l=function(e){var t=e.codec;if(void 0===t)throw new Error("Cannot parse subtitles: unknown format");switch(t.toLowerCase()){case"stpp":case"stpp.ttml.im1t":return"ttml";case"wvtt":return"vtt"}throw new Error('The codec used for the subtitles "'+t+'" is not managed yet.')}(u),d=function(e){var t=(0,ue.Le)(e);return null===t?"":(0,b.uR)(t)}(t);return{data:d,type:l,language:s.language,start:i,end:a}}function de(e,t,n){var r,i,a=e.segment,o=e.adaptation,s=e.representation;if(a.isInit)return null;n?g.Z.warn("Transport: Unavailable time data for current text track."):(r=a.time,a.complete&&(i=a.time+a.duration));var u=function(e){var t=e.mimeType,n=void 0===t?"":t;switch(e.mimeType){case"application/ttml+xml":return"ttml";case"application/x-sami":case"application/smil":return"sami";case"text/vtt":return"vtt"}var r=e.codec;if("srt"===(void 0===r?"":r).toLowerCase())return"srt";throw new Error("could not find a text-track parser for the type "+n)}(s);return{data:t,type:u,language:o.language,start:r,end:i}}function ce(e){var t=e.__priv_patchLastSegmentInSidx;return function(e,n,r){var i,a=n.period,o=n.adaptation,s=n.representation,u=n.segment,d=e.data,c=e.isChunked;if(null===d)return u.isInit?{segmentType:"init",initializationData:null,initializationDataSize:0,protectionDataUpdate:!1,initTimescale:void 0}:{segmentType:"media",chunkData:null,chunkSize:0,chunkInfos:null,chunkOffset:null!==(i=u.timestampOffset)&&void 0!==i?i:0,protectionDataUpdate:!1,appendWindow:[a.start,a.end]};var f=M(o.type,s);if("webm"===f)throw new Error("Text tracks with a WEBM container are not yet handled.");return"mp4"===f?function(e,t,n,r,i){var a=n.period,o=n.representation,s=n.segment,u=s.isInit,d=s.indexRange,c="string"==typeof e?(0,b.tG)(e):e instanceof Uint8Array?e:new Uint8Array(e);if(u){var f=(0,V.Wf)(c,Array.isArray(d)?d[0]:0);if(!0===i&&null!==f&&f.length>0){var v=f[f.length-1];Array.isArray(v.range)&&(v.range[1]=1/0)}var p=(0,V.LD)(c);return o.index instanceof ie.Z&&null!==f&&f.length>0&&o.index.initializeIndex(f),{segmentType:"init",initializationData:null,initializationDataSize:0,protectionDataUpdate:!1,initTimescale:p}}var h=ae(c,t,s,r),m=le(n,c,h,t),g=(0,l.Z)(s.timestampOffset,0);return{segmentType:"media",chunkData:m,chunkSize:c.length,chunkInfos:h,chunkOffset:g,protectionDataUpdate:!1,appendWindow:[a.start,a.end]}}(d,c,n,r,t):function(e,t,n){var r,i,a=n.period,o=n.segment,s=o.timestampOffset,u=void 0===s?0:s;if(o.isInit)return{segmentType:"init",initializationData:null,initializationDataSize:0,protectionDataUpdate:!1,initTimescale:void 0};if("string"!=typeof e){var l=e instanceof Uint8Array?e:new Uint8Array(e);r=(0,b.uR)(l),i=l.length}else r=e;return{segmentType:"media",chunkData:de(n,r,t),chunkSize:i,chunkInfos:null,chunkOffset:u,protectionDataUpdate:!1,appendWindow:[a.start,a.end]}}(d,c,n)}}var fe=function(e){var t=(0,i.Z)({customManifestLoader:e.manifestLoader},null===r.Z.dashParsers.wasm||"initialized"!==r.Z.dashParsers.wasm.status&&"initializing"!==r.Z.dashParsers.wasm.status?"arraybuffer":"text"),n=S(e),a=function(e){var t=e.lowLatencyMode,n=e.segmentLoader;return!0!==e.checkMediaSegmentIntegrity?r:D(r);function r(e,r,i,a,o){var s=c(e,r.segment);if(null==s)return Promise.resolve({resultType:"segment-created",resultData:null});if(t||void 0===n)return B(s,r,t,i,o,a);var u={adaptation:r.adaptation,manifest:r.manifest,period:r.period,representation:r.representation,segment:r.segment,transport:"dash",timeout:i.timeout,url:s};return new Promise((function(e,l){var d=!1,c=n(u,{reject:function(e){var t,n,r;if(!d&&!a.isCancelled()){d=!0,a.deregister(f);var i=e,o=null!==(t=null==i?void 0:i.message)&&void 0!==t?t:"Unknown error when fetching a DASH segment through a custom segmentLoader.",s=new T.Z(o,null!==(n=null==i?void 0:i.canRetry)&&void 0!==n&&n,null!==(r=null==i?void 0:i.isOfflineError)&&void 0!==r&&r,null==i?void 0:i.xhr);l(s)}},resolve:function(t){d||a.isCancelled()||(d=!0,a.deregister(f),e({resultType:"segment-loaded",resultData:{responseData:t.data,size:t.size,requestDuration:t.duration}}))},progress:function(e){d||a.isCancelled()||o.onProgress({duration:e.duration,size:e.size,totalSize:e.totalSize})},fallback:function(){d||a.isCancelled()||(d=!0,a.deregister(f),B(s,r,t,i,o,a).then(e,l))}});function f(e){d||(d=!0,"function"==typeof c&&c(),l(e))}a.register(f)}))}}(e),o=se(e),s=function(e){var t=e.lowLatencyMode;return!0!==e.checkMediaSegmentIntegrity?n:D(n);function n(e,n,r,i,a){var o=n.adaptation,s=n.representation,l=n.segment,d=l.range,f=c(e,l);if(null===f)return Promise.resolve({resultType:"segment-created",resultData:null});if(l.isInit)return O(f,l,r,i,a);var v=M(o.type,s),p="mp4"===v||void 0===v;if(t&&p){if(Z())return U(f,n,r,a,i);(0,R.Z)("DASH: Your browser does not have the fetch API. You will have a higher chance of rebuffering when playing close to the live edge")}return p?(0,u.ZP)({url:f,responseType:"arraybuffer",headers:Array.isArray(d)?{Range:(0,x.Z)(d)}:null,timeout:r.timeout,onProgress:a.onProgress,cancelSignal:i}).then((function(e){return{resultType:"segment-loaded",resultData:e}})):(0,u.ZP)({url:f,responseType:"text",headers:Array.isArray(d)?{Range:(0,x.Z)(d)}:null,timeout:r.timeout,onProgress:a.onProgress,cancelSignal:i}).then((function(e){return{resultType:"segment-loaded",resultData:e}}))}}(e);return{manifest:{loadManifest:t,parseManifest:n},audio:{loadSegment:a,parseSegment:o},video:{loadSegment:a,parseSegment:o},text:{loadSegment:s,parseSegment:ce(e)},image:{loadSegment:f,parseSegment:p}}}},2339:function(e,t,n){"use strict";n.d(t,{Z:function(){return ye}});var r=n(5861),i=n(4687),a=n.n(i),o=n(7874),s=n(3887),u=n(1989),l=n(6807),d=n(9362),c=n(811),f=n(8232),v=n(3911),p=n(1091),h=n(5505);function m(e,t,n){var r=e.timeline,i=e.timescale,a=r[r.length-1],o=t.timescale===i?{time:t.time,duration:t.duration}:{time:t.time/t.timescale*i,duration:t.duration/t.timescale*i};return!(n.time===o.time)&&(o.time>=(0,v.jH)(a,null)&&(a.duration===o.duration?a.repeatCount++:e.timeline.push({duration:o.duration,start:o.time,repeatCount:0}),!0))}function g(e,t){return e.replace(/\{start time\}/g,String(t))}function y(e,t,n){var r=t-e;return r>0?Math.floor(r/n):0}function _(e,t){var n=e.repeatCount;if(null!=e.duration&&n<0){var r=void 0!==t?t.start:1/0;n=Math.ceil((r-e.start)/e.duration)-1}return n}var b=function(){function e(e,t){var n=t.aggressiveMode,r=t.isLive,i=t.segmentPrivateInfos,a=t.timeShiftBufferDepth,o=null==t.manifestReceivedTime?performance.now():t.manifestReceivedTime;if(this._index=e,this._indexValidityTime=o,this._timeShiftBufferDepth=a,this._initSegmentInfos={bitsPerSample:i.bitsPerSample,channels:i.channels,codecPrivateData:i.codecPrivateData,packetSize:i.packetSize,samplingRate:i.samplingRate,timescale:e.timescale,protection:i.protection},this._isAggressiveMode=n,this._isLive=r,0!==e.timeline.length){var s=e.timeline[e.timeline.length-1],u=(0,v.jH)(s,null);if(this._initialScaledLastPosition=u,r){var l=o/1e3*e.timescale;this._scaledLiveGap=l-u}}}var t=e.prototype;return t.getInitSegment=function(){return{id:"init",isInit:!0,privateInfos:{smoothInitSegment:this._initSegmentInfos},url:null,time:0,end:0,duration:0,timescale:1,complete:!0}},t.getSegments=function(e,t){this._refreshTimeline();for(var n,r=function(e,t,n){var r=void 0===e.timescale||0===e.timescale?1:e.timescale;return{up:t*r,to:(t+n)*r}}(this._index,e,t),i=r.up,a=r.to,o=this._index,s=o.timeline,u=o.timescale,l=o.media,d=this._isAggressiveMode,c=[],f=s.length,v=null==this._scaledLiveGap?void 0:performance.now()/1e3*u-this._scaledLiveGap,p=0;p=a)return c;null!=n&&(n+=S+1)}return c},t.shouldRefresh=function(e,t){if(this._refreshTimeline(),!this._isLive)return!1;var n=this._index,r=n.timeline,i=n.timescale,a=r[r.length-1];if(void 0===a)return!1;var o=a.repeatCount,s=a.start+(o+1)*a.duration;return!(t*i=s||e*i>a.start+o*a.duration)},t.getFirstAvailablePosition=function(){this._refreshTimeline();var e=this._index;return 0===e.timeline.length?null:e.timeline[0].start/e.timescale},t.getLastAvailablePosition=function(){this._refreshTimeline();var e=this._index;if(null==this._scaledLiveGap){var t=e.timeline[e.timeline.length-1];return(0,v.jH)(t,null)/e.timescale}for(var n=e.timeline.length-1;n>=0;n--)for(var r=e.timeline[n],i=performance.now()/1e3*e.timescale,a=r.start,o=r.duration,s=r.repeatCount;s>=0;s--){var u=a+o*(s+1);if((this._isAggressiveMode?u-o:u)<=i-this._scaledLiveGap)return u/e.timescale}},t.getEnd=function(){if(!this._isLive)return this.getLastAvailablePosition()},t.awaitSegmentBetween=function(e,t){var n;if((0,c.Z)(e<=t),this.isFinished())return!1;var r=this.getLastAvailablePosition();return!(void 0!==r&&t(null!==(n=this.getFirstAvailablePosition())&&void 0!==n?n:0)&&void 0)},t.checkDiscontinuity=function(e){return this._refreshTimeline(),(0,v._j)(this._index,e,void 0)},t.isSegmentStillAvailable=function(e){if(e.isInit)return!0;this._refreshTimeline();var t=this._index,n=t.timeline,r=t.timescale;return(0,p.Z)(e,n,r,0)},t.canBeOutOfSyncError=function(e){return!!this._isLive&&(e instanceof d.Z&&(e.isHttpError(404)||e.isHttpError(412)))},t._replace=function(e){var t=this._index.timeline,n=e._index.timeline,r=this._index.timescale,i=e._index.timescale;if(this._index=e._index,this._initialScaledLastPosition=e._initialScaledLastPosition,this._indexValidityTime=e._indexValidityTime,this._scaledLiveGap=e._scaledLiveGap,0!==t.length&&0!==n.length&&r===i){var a=t[t.length-1],o=n[n.length-1],u=(0,v.jH)(o,null);if(!((0,v.jH)(a,null)<=u))for(var l=0;lu){if(d.duration!==o.duration)return;var f=u-d.start;if(0===f)return s.Z.warn("Smooth Parser: a discontinuity detected in the previous manifest has been resolved."),void(this._index.timeline=this._index.timeline.concat(t.slice(l)));if(f<0||f%d.duration!=0)return;var p=f/d.duration-1,h=d.repeatCount-p;if(h<0)return;o.repeatCount+=h;var m=t.slice(l+1);return void(this._index.timeline=this._index.timeline.concat(m))}}}},t._update=function(e){(0,h.Z)(this._index.timeline,e._index.timeline),this._initialScaledLastPosition=e._initialScaledLastPosition,this._indexValidityTime=e._indexValidityTime,this._scaledLiveGap=e._scaledLiveGap},t.isFinished=function(){return!this._isLive},t.isInitialized=function(){return!0},t.addNewSegments=function(e,t){this._refreshTimeline();for(var n=0;n>3:2)?"mp4a.40.2":"mp4a.40."+n}(u,l);return{audiotag:void 0!==i?parseInt(i,10):i,bitrate:v,bitsPerSample:void 0!==a?parseInt(a,10):a,channels:void 0!==o?parseInt(o,10):o,codecPrivateData:u,codecs:p,customAttributes:n,mimeType:void 0!==l?F[l]:l,packetSize:void 0!==d?parseInt(d,10):d,samplingRate:void 0!==c?parseInt(c,10):c};case"video":var h=r("CodecPrivateData"),m=r("FourCC"),g=r("MaxWidth"),y=r("MaxHeight"),_=r("Bitrate"),b=void 0===_||isNaN(parseInt(_,10))?0:parseInt(_,10);if(void 0!==m&&void 0===F[m]||void 0===h)return s.Z.warn("Smooth parser: Unsupported video codec. Ignoring quality level."),null;var S=function(e){var t=/00000001\d7([0-9a-fA-F]{6})/.exec(e);return null!==t&&(0,k.Z)(t[1])?"avc1."+t[1]:"avc1.4D401E"}(h);return{bitrate:b,customAttributes:n,mimeType:void 0!==m?F[m]:m,codecPrivateData:h,codecs:S,width:void 0!==g?parseInt(g,10):void 0,height:void 0!==y?parseInt(y,10):void 0};case"text":var T=r("CodecPrivateData"),E=r("FourCC"),w=r("Bitrate");return{bitrate:void 0===w||isNaN(parseInt(w,10))?0:parseInt(w,10),customAttributes:n,mimeType:void 0!==E?F[E]:E,codecPrivateData:(0,Z.Z)(T,"")};default:return s.Z.error("Smooth Parser: Unrecognized StreamIndex type: "+t),null}}function o(t){var r=t.root,i=t.timescale,o=t.baseUrl,u=t.protections,l=t.timeShiftBufferDepth,d=t.manifestReceivedTime,f=t.isLive,v=r.getAttribute("Timescale"),p=null===v||isNaN(+v)?i:+v,h=r.getAttribute("Type");if(null===h)throw new Error("StreamIndex without type.");(0,T.Z)(S.r,h)||s.Z.warn("Smooth Parser: Unrecognized adaptation type:",h);var m=h,g=r.getAttribute("Subtype"),y=r.getAttribute("Language"),_=r.getAttribute("Url"),A=null===_?"":_;var Z,R=U(r,(function(e,t,r){switch(t){case"QualityLevel":var i=a(r,m);if(null===i)return e;("video"!==m||i.bitrate>n)&&e.qualityLevels.push(i);break;case"c":e.cNodes.push(r)}return e}),{qualityLevels:[],cNodes:[]}),x=R.qualityLevels,M=R.cNodes,P={timeline:(Z=M,Z.reduce((function(e,t,n){var r=t.getAttribute("d"),i=t.getAttribute("t"),a=t.getAttribute("r"),o=null!==a?+a-1:0,s=null!==i?+i:void 0,u=null!==r?+r:void 0;if(0===n)s=void 0===s||isNaN(s)?0:s;else{var l=e[n-1];if(null==s||isNaN(s)){if(null==l.duration||isNaN(l.duration))throw new Error("Smooth: Invalid CNodes. Missing timestamp.");s=l.start+l.duration*(l.repeatCount+1)}}if(null==u||isNaN(u)){var d=Z[n+1];if(void 0===d)return e;var c=d.getAttribute("t"),f=(0,k.Z)(c)?+c:null;if(null===f)throw new Error("Can't build index timeline from Smooth Manifest.");u=f-s}return e.push({duration:u,start:s,repeatCount:o}),e}),[])),timescale:p};(0,c.Z)(0!==x.length,"Adaptation should have at least one playable representation.");var D=m+((0,k.Z)(y)?"_"+y:""),N=x.map((function(t){var n,r,i,a,s={timeline:P.timeline,timescale:P.timescale,media:(n=A,r=t.bitrate,i=t.customAttributes,n.replace(/\{bitrate\}/g,String(r)).replace(/{CustomAttributes}/g,i.length>0?i[0]:""))},c=(0,k.Z)(t.mimeType)?t.mimeType:B[m],v=t.codecs,p=D+"_"+(null!=m?m+"-":"")+(null!=c?c+"-":"")+(null!=v?v+"-":"")+String(t.bitrate),h=[];u.length>0&&(a=u[0],u.forEach((function(e){var t=e.keyId;e.keySystems.forEach((function(e){h.push({keyId:t,systemId:e.systemId})}))})));var g={bitsPerSample:t.bitsPerSample,channels:t.channels,codecPrivateData:t.codecPrivateData,packetSize:t.packetSize,samplingRate:t.samplingRate,protection:null!=a?{keyId:a.keyId}:void 0},y=null!=e.aggressiveMode&&e.aggressiveMode,_=new b(s,{aggressiveMode:y,isLive:f,manifestReceivedTime:d,segmentPrivateInfos:g,timeShiftBufferDepth:l}),S=(0,w.Z)({},t,{index:_,cdnMetadata:[{baseUrl:o}],mimeType:c,codecs:v,id:p});if(h.length>0||void 0!==a){var T=void 0===a?[]:a.keySystems.map((function(e){var t=e.systemId,n=e.privateData,r=t.replace(/-/g,""),i=function(e,t){if(32!==e.length)throw new Error("HSS: wrong system id length");var n=0;return C("pssh",(0,E.zo)([n,0,0,0],(0,I.nr)(e),(0,E.kh)(t.length),t))}(r,n);return{systemId:r,data:i}}));if(T.length>0){var Z=[{type:"cenc",values:T}];S.contentProtections={keyIds:h,initData:Z}}else S.contentProtections={keyIds:h,initData:[]}}return S}));if("ADVT"===g)return null;var O={id:D,type:m,representations:N,language:null==y?void 0:y};return"text"===m&&"DESC"===g&&(O.closedCaption=!0),O}return function(n,r,a){var s="";if(void 0!==r){var u=(0,A.$)(r);s=r.substring(0,u)}var l=n.documentElement;if(null==l||"SmoothStreamingMedia"!==l.nodeName)throw new Error("document root should be SmoothStreamingMedia");var d=l.getAttribute("MajorVersion"),c=l.getAttribute("MinorVersion");if(null===d||null===c||!/^[2]-[0-2]$/.test(d+"-"+c))throw new Error("Version should be 2.0, 2.1 or 2.2");var f,v,p=l.getAttribute("Timescale"),h=(0,k.Z)(p)?isNaN(+p)?1e7:+p:1e7,m=U(l,(function(t,n,r){switch(n){case"Protection":t.protections.push(L(r,e.keySystems));break;case"StreamIndex":t.adaptationNodes.push(r)}return t}),{adaptationNodes:[],protections:[]}),g=m.protections,y=m.adaptationNodes,_="boolean"==typeof(f=l.getAttribute("IsLive"))?f:"string"==typeof f&&"TRUE"===f.toUpperCase();if(_){var b=l.getAttribute("DVRWindowLength");null==b||isNaN(+b)||0==+b||(v=+b/h)}var S,T,E,w,I,Z,R,x=y.reduce((function(e,t){var n=o({root:t,baseUrl:s,timescale:h,protections:g,isLive:_,timeShiftBufferDepth:v,manifestReceivedTime:a});if(null===n)return e;var r=n.type,i=e[r];return void 0===i?e[r]=[n]:i.push(n),e}),{}),M=null,C=void 0!==x.video?x.video[0]:void 0,P=void 0!==x.audio?x.audio[0]:void 0;if(void 0!==C||void 0!==P){var N=[],O=[];if(void 0!==C){var B=C.representations[0];if(void 0!==B){var F=B.index.getFirstAvailablePosition(),V=B.index.getLastAvailablePosition();null!=F&&N.push(F),null!=V&&O.push(V)}}if(void 0!==P){var z=P.representations[0];if(void 0!==z){var K=z.index.getFirstAvailablePosition(),G=z.index.getLastAvailablePosition();null!=K&&N.push(K),null!=G&&O.push(G)}}N.length>0&&(I=Math.max.apply(Math,N)),O.length>0&&(Z=Math.min.apply(Math,O),R=Math.max.apply(Math,O))}var W=l.getAttribute("Duration"),H=null!==W&&0!=+W?+W/h:void 0;if(_){S=e.suggestedPresentationDelay,T=t,E=null!=I?I:T;var j=R;void 0===j&&(j=Date.now()/1e3-T);var q=Z;void 0===q&&(q=j),w={isLinear:!0,maximumSafePosition:q,livePosition:j,time:performance.now()},M=null!=v?v:null}else{E=null!=I?I:0,w={isLinear:!1,maximumSafePosition:void 0!==Z?Z:void 0!==H?E+H:1/0,livePosition:void 0,time:performance.now()}}var Y=_?0:E,X=_?void 0:w.maximumSafePosition,Q={availabilityStartTime:void 0===T?0:T,clockOffset:i,isLive:_,isDynamic:_,isLastPeriodKnown:!0,timeBounds:{minimumSafePosition:E,timeshiftDepth:M,maximumTimeData:w},periods:[{adaptations:x,duration:void 0!==X?X-Y:H,end:X,id:"gen-smooth-period-0",start:Y}],suggestedPresentationDelay:S,transportType:"smooth",uris:null==r?[]:[r]};return D(Q),Q}},z=V,K=n(4597),G=n(8806),W=n(4460),H=n(8791),j=n(4644),q=n(2297);function Y(e,t,n,r,i){var a,o,u,d=[];if(i){var c=(0,l.XA)(e);null!==c?(u=function(e){var t=(0,q.nR)(e,3565190898,3392751253,2387879627,2655430559);if(void 0===t)return[];for(var n=[],r=t[0],i=t[4],a=0;a0;if(n)return e;var r=new Uint8Array(e.length+4);return r.set(e.subarray(0,t+8),0),r[t+3]=1|r[t+3],r.set([0,0,0,0],t+8),r.set(e.subarray(t+8,e.length),t+12),(0,j.J6)(r)}(l,s[1]-s[0]),f=te(u,d,c,i,(0,q.nR)(a,2721664850,1520127764,2722393154,2086964724)),v=P("moof",[i,f]),p=(0,q.Qy)(v,1836019558),h=(0,q.Qy)(f,1953653094),m=(0,q.Qy)(c,1953658222);if(null===p||null===h||null===m)throw new Error("Smooth: Invalid moof, trun or traf generation");var g=p[1]-p[0]+i.length+(h[1]-h[0])+u.length+d.length+(m[1]-m[0])+8,y=n[2]-n[0],_=v.length-y,b=(0,q.Qy)(e,1835295092);if(null===b)throw new Error("Smooth: Invalid ISOBMFF given");if(!X.YM&&(0===_||_<=-8)){var S=b[1];return v.set((0,E.kh)(S),g),e.set(v,n[0]),_<=-8&&e.set(C("free",new Uint8Array(-_-8)),v.length),e}var T=b[1]+_;v.set((0,E.kh)(T),g);var k=new Uint8Array(e.length+_),w=e.subarray(0,n[0]),A=e.subarray(n[2],e.length);return k.set(w,0),k.set(v,w.length),k.set(A,w.length+v.length),k}var re=n(7839),ie=n(281);function ae(e,t,n,r,i,a){var o,s,u,l=P("stbl",[n,C("stts",new Uint8Array(8)),C("stsc",new Uint8Array(8)),C("stsz",new Uint8Array(12)),C("stco",new Uint8Array(8))]),d=function(e){return C("dref",(0,E.zo)(7,[1],e))}(C("url ",new Uint8Array([0,0,0,1]))),c=P("dinf",[d]),f=P("minf",[r,c,l]),v=function(e){var t,n;switch(e){case"video":t="vide",n="VideoHandler";break;case"audio":t="soun",n="SoundHandler";break;default:t="hint",n=""}return C("hdlr",(0,E.zo)(8,(0,I.tG)(t),12,(0,I.tG)(n),1))}(t),p=function(e){return C("mdhd",(0,E.zo)(12,(0,E.kh)(e),8))}(e),h=P("mdia",[p,v,f]),m=function(e,t,n){return C("tkhd",(0,E.zo)((0,E.kh)(7),8,(0,E.kh)(n),20,[1,0,0,0],[0,1,0,0],12,[0,1,0,0],12,[64,0,0,0],(0,E.XT)(e),2,(0,E.XT)(t),2))}(i,a,1),g=P("trak",[m,h]),y=P("mvex",[(o=1,C("trex",(0,E.zo)(4,(0,E.kh)(o),[0,0,0,1],12)))]),_=function(e,t){return C("mvhd",(0,E.zo)(12,(0,E.kh)(e),4,[0,1],2,[1,0],10,[0,1],14,[0,1],14,[64,0,0,0],26,(0,E.XT)(t+1)))}(e,1),b=function(e,t,n){return P("moov",[e,t,n])}(_,y,g),S=(s="isom",u=["isom","iso2","iso6","avc1","dash"],C("ftyp",E.zo.apply(void 0,[(0,I.tG)(s),[0,0,0,1]].concat(u.map(I.tG)))));return(0,E.zo)(S,b)}function oe(e,t,n,r,i,a,o,s){var u=o.split("00000001"),l=u[1],d=u[2];if(void 0===l||void 0===d)throw new Error("Smooth: unsupported codec private data.");var c,f,v=function(e,t,n){var r=2===n?1:4===n?3:0,i=e[1],a=e[2],o=e[3];return C("avcC",(0,E.zo)([1,i,a,o,252|r,225],(0,E.XT)(e.length),e,[1],(0,E.XT)(t.length),t))}((0,I.nr)(l),(0,I.nr)(d),a);if(void 0===s){var p=function(e,t,n,r,i,a,o){return C("avc1",(0,E.zo)(6,(0,E.XT)(1),16,(0,E.XT)(e),(0,E.XT)(t),(0,E.XT)(n),2,(0,E.XT)(r),6,[0,1,i.length],(0,I.tG)(i),31-i.length,(0,E.XT)(a),[255,255],o))}(t,n,r,i,"AVC Coding",24,v);c=J([p])}else{var h=P("schi",[ee(1,8,s)]),m=Q("cenc",65536),g=function(e,t,n,r,i,a,o,s){return C("encv",(0,E.zo)(6,(0,E.XT)(1),16,(0,E.XT)(e),(0,E.XT)(t),(0,E.XT)(n),2,(0,E.XT)(r),6,[0,1,i.length],(0,I.tG)(i),31-i.length,(0,E.XT)(a),[255,255],o,s))}(t,n,r,i,"AVC Coding",24,v,P("sinf",[$("avc1"),m,h]));c=J([g])}return ae(e,"video",c,((f=new Uint8Array(12))[3]=1,C("vmhd",f)),t,n)}var se=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];function ue(e,t,n,r,i,a,o){var s,u,l,d=function(e,t){return C("esds",(0,E.zo)(4,[3,25],(0,E.XT)(e),[0,4,17,64,21],11,[5,2],(0,I.nr)(t),[6,1,2]))}(1,0===a.length?(s=i,u=t,l=((l=((l=(63&2)<<4)|31&se.indexOf(s))<<4)|31&u)<<3,(0,I.ci)((0,E.XT)(l))):a),c=function(){if(void 0===o){var e=function(e,t,n,r,i,a){return C("mp4a",(0,E.zo)(6,(0,E.XT)(e),8,(0,E.XT)(t),(0,E.XT)(n),2,(0,E.XT)(r),(0,E.XT)(i),2,a))}(1,t,n,r,i,d);return J([e])}var a=P("schi",[ee(1,8,o)]),s=Q("cenc",65536),u=P("sinf",[$("mp4a"),s,a]),l=function(e,t,n,r,i,a,o){return C("enca",(0,E.zo)(6,(0,E.XT)(e),8,(0,E.XT)(t),(0,E.XT)(n),2,(0,E.XT)(r),(0,E.XT)(i),2,a,o))}(1,t,n,r,i,d,u);return J([l])}();return ae(e,"audio",c,C("smhd",new Uint8Array(8)),0,0)}var le=/(\.isml?)(\?token=\S+)?$/,de=/\?token=(\S+)/;function ce(e,t){return(0,k.Z)(t)?e.replace(de,"?token="+t):e.replace(de,"")}function fe(e){return"string"==typeof e.mimeType&&e.mimeType.indexOf("mp4")>=0}function ve(e,t){return null===e?null:null===t.url?e.baseUrl:(0,A.Z)(e.baseUrl,t.url)}function pe(e,t,n,r,i,a){var o,s=t.segment.range;return Array.isArray(s)&&(o={Range:(0,ie.Z)(s)}),(0,K.ZP)({url:e,responseType:"arraybuffer",headers:o,timeout:r.timeout,cancelSignal:i,onProgress:n.onProgress}).then((function(e){if(!fe(t.representation)||!0!==a)return{resultType:"segment-loaded",resultData:e};var n=new Uint8Array(e.responseData);return(0,W.Z)(n,t.segment.isInit),{resultType:"segment-loaded",resultData:Object.assign(Object.assign({},e),{responseData:n})}}))}var he=function(e){var t=e.checkMediaSegmentIntegrity,n=e.customSegmentLoader;return function(e,r,i,a,o){var s=r.segment,u=r.manifest,l=r.period,d=r.adaptation,c=r.representation;if(s.isInit){if(void 0===s.privateInfos||void 0===s.privateInfos.smoothInitSegment)throw new Error("Smooth: Invalid segment format");var f,v=s.privateInfos.smoothInitSegment,p=v.codecPrivateData,h=v.timescale,m=v.protection,g=void 0===m?{keyId:void 0,keySystems:void 0}:m;if(void 0===p)throw new Error("Smooth: no codec private data.");switch(d.type){case"video":var y=c.width,_=void 0===y?0:y,b=c.height;f=oe(h,_,void 0===b?0:b,72,72,4,p,g.keyId);break;case"audio":var S=v.channels,T=void 0===S?0:S,E=v.bitsPerSample,k=void 0===E?0:E,w=v.packetSize,A=void 0===w?0:w,I=v.samplingRate;f=ue(h,T,k,A,void 0===I?0:I,p,g.keyId);break;default:0,f=new Uint8Array(0)}return Promise.resolve({resultType:"segment-created",resultData:f})}if(null===e)return Promise.resolve({resultType:"segment-created",resultData:null});var Z={adaptation:d,manifest:u,period:l,representation:c,segment:s,transport:"smooth",timeout:i.timeout,url:e};return"function"!=typeof n?pe(e,r,o,i,a,t):new Promise((function(s,u){var l=!1,d=n(Z,{reject:function(e){var t,n,r;if(!l&&!a.isCancelled()){l=!0,a.deregister(c);var i=e,o=null!==(t=null==i?void 0:i.message)&&void 0!==t?t:"Unknown error when fetching a Smooth segment through a custom segmentLoader.",s=new re.Z(o,null!==(n=null==i?void 0:i.canRetry)&&void 0!==n&&n,null!==(r=null==i?void 0:i.isOfflineError)&&void 0!==r&&r,null==i?void 0:i.xhr);u(s)}},resolve:function(e){if(!l&&!a.isCancelled()){l=!0,a.deregister(c),fe(r.representation)&&!0===t||s({resultType:"segment-loaded",resultData:{responseData:e.data,size:e.size,requestDuration:e.duration}});var n=e.data instanceof Uint8Array?e.data:new Uint8Array(e.data);(0,W.Z)(n,r.segment.isInit),s({resultType:"segment-loaded",resultData:{responseData:n,size:e.size,requestDuration:e.duration}})}},fallback:function(){l||a.isCancelled()||(l=!0,a.deregister(c),pe(e,r,o,i,a,t).then(s,u))},progress:function(e){l||a.isCancelled()||o.onProgress({duration:e.duration,size:e.size,totalSize:e.totalSize})}});function c(e){l||((l=!0)||"function"!=typeof d||d(),u(e))}a.register(c)}))}},me=/\.wsx?(\?token=\S+)?/;function ge(e,t,n){var r;s.Z.debug("Smooth Parser: update segments information.");for(var i=e.representations,a=0;a0&&ge(o,v,a),{segmentType:"media",chunkData:h,chunkInfos:p,chunkOffset:0,chunkSize:h.length,protectionDataUpdate:!1,appendWindow:[void 0,void 0]}}},c={loadSegment:function(t,n,r,i,a){var o=n.segment,s=n.representation,u=ve(t,o);return o.isInit||null===u?Promise.resolve({resultType:"segment-created",resultData:null}):fe(s)?(0,K.ZP)({url:u,responseType:"arraybuffer",timeout:r.timeout,cancelSignal:i,onProgress:a.onProgress}).then((function(t){if(!0!==e.checkMediaSegmentIntegrity)return{resultType:"segment-loaded",resultData:t};var r=new Uint8Array(t.responseData);return(0,W.Z)(r,n.segment.isInit),{resultType:"segment-loaded",resultData:Object.assign(Object.assign({},t),{responseData:r})}})):(0,K.ZP)({url:u,responseType:"text",timeout:r.timeout,cancelSignal:i,onProgress:a.onProgress}).then((function(e){return{resultType:"segment-loaded",resultData:e}}))},parseSegment:function(e,t,n){var r,i,a,o=t.manifest,u=t.adaptation,d=t.representation,c=t.segment,f=u.language,v=fe(d),p=d.mimeType,h=void 0===p?"":p,m=d.codec,g=void 0===m?"":m,y=e.data,_=e.isChunked;if(c.isInit)return{segmentType:"init",initializationData:null,initializationDataSize:0,protectionDataUpdate:!1,initTimescale:void 0};if(null===y)return{segmentType:"media",chunkData:null,chunkInfos:null,chunkOffset:0,chunkSize:0,protectionDataUpdate:!1,appendWindow:[void 0,void 0]};var b,S,T,E,k=null;if(v){var w;i=(w="string"==typeof y?(0,I.tG)(y):y instanceof Uint8Array?y:new Uint8Array(y)).length;var A=void 0!==n?Y(w,_,n,c,o.isLive):null;a=null==A?void 0:A.nextSegments,null===(k=null!==(r=null==A?void 0:A.chunkInfos)&&void 0!==r?r:null)?_?s.Z.warn("Smooth: Unavailable time data for current text track."):(b=c.time,S=c.end):(b=k.time,S=void 0!==k.duration?k.time+k.duration:c.end);var Z=g.toLowerCase();if("application/ttml+xml+mp4"===h||"stpp"===Z||"stpp.ttml.im1t"===Z)E="ttml";else{if("wvtt"!==Z)throw new Error("could not find a text-track parser for the type "+h);E="vtt"}var R=(0,l.Le)(w);T=null===R?"":(0,I.uR)(R)}else{var x;if(b=c.time,S=c.end,"string"!=typeof y){var M=y instanceof Uint8Array?y:new Uint8Array(y);i=M.length,x=(0,I.uR)(M)}else x=y;switch(h){case"application/x-sami":case"application/smil":E="sami";break;case"application/ttml+xml":E="ttml";break;case"text/vtt":E="vtt"}if(void 0===E){if("srt"!==g.toLowerCase())throw new Error("could not find a text-track parser for the type "+h);E="srt"}T=x}return null!==k&&Array.isArray(a)&&a.length>0&&ge(u,a,c),{segmentType:"media",chunkData:{type:E,data:T,start:b,end:S,language:f},chunkSize:i,chunkInfos:k,chunkOffset:null!=b?b:0,protectionDataUpdate:!1,appendWindow:[void 0,void 0]}}};return{manifest:{resolveManifestUrl:function(e,t){if(void 0===e)return Promise.resolve(void 0);var n;me.test(e)?((0,G.Z)("Giving WSX URL to loadVideo is deprecated. You should only give Manifest URLs."),n=(0,K.ZP)({url:ce(e,""),responseType:"document",cancelSignal:t}).then((function(e){var t=e.responseData.getElementsByTagName("media")[0].getAttribute("src");if(null===t||0===t.length)throw new Error("Invalid ISML");return t}))):n=Promise.resolve(e);var r=function(e){var t=de.exec(e);if(null!==t){var n=t[1];if(void 0!==n)return n}return""}(e);return n.then((function(e){return ce(function(e){return le.test(e)?((0,G.Z)("Giving a isml URL to loadVideo is deprecated. Please give the Manifest URL directly"),e.replace(le,"$1/manifest$2")):e}(e),r)}))},loadManifest:(0,H.Z)(i,"text"),parseManifest:function(n,r){var i,a=null!==(i=n.url)&&void 0!==i?i:r.originalUrl,o=n.receivedTime,s=n.responseData,l="string"==typeof s?(new DOMParser).parseFromString(s,"text/xml"):s,d=t(l,a,o);return{manifest:new u.ZP(d,{representationFilter:e.representationFilter,supplementaryImageTracks:e.supplementaryImageTracks,supplementaryTextTracks:e.supplementaryTextTracks}),url:a}}},audio:d,video:d,text:c,image:{loadSegment:function(e,t,n,i,o){return(0,r.Z)(a().mark((function r(){var s,u,l;return a().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(s=t.segment,u=ve(e,s),!s.isInit&&null!==u){r.next=4;break}return r.abrupt("return",{resultType:"segment-created",resultData:null});case 4:return r.next=6,(0,K.ZP)({url:u,responseType:"arraybuffer",timeout:n.timeout,onProgress:o.onProgress,cancelSignal:i});case 6:return l=r.sent,r.abrupt("return",{resultType:"segment-loaded",resultData:l});case 8:case"end":return r.stop()}}),r)})))()},parseSegment:function(e,t,n){var r=e.data,i=e.isChunked;if(t.segment.isInit)return{segmentType:"init",initializationData:null,initializationDataSize:0,protectionDataUpdate:!1,initTimescale:void 0};if(i)throw new Error("Image data should not be downloaded in chunks");return null===r||null===o.Z.imageParser?{segmentType:"media",chunkData:null,chunkInfos:null,chunkOffset:0,chunkSize:0,protectionDataUpdate:!1,appendWindow:[void 0,void 0]}:{segmentType:"media",chunkData:{data:o.Z.imageParser(new Uint8Array(r)).thumbs,start:0,end:Number.MAX_VALUE,timescale:1,type:"bif"},chunkInfos:{time:0,duration:Number.MAX_VALUE},chunkSize:void 0,chunkOffset:0,protectionDataUpdate:!1,appendWindow:[void 0,void 0]}}}}}},281:function(e,t,n){"use strict";function r(e){var t=e[0],n=e[1];return n===1/0?"bytes="+t+"-":"bytes="+t+"-"+n}n.d(t,{Z:function(){return r}})},4460:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(5389),i=n(8766);function a(e,t){if(t){if((0,i.Z)(e,1718909296)<0)throw new r.Z("INTEGRITY_ERROR","Incomplete `ftyp` box");if((0,i.Z)(e,1836019574)<0)throw new r.Z("INTEGRITY_ERROR","Incomplete `moov` box")}else{if((0,i.Z)(e,1836019558)<0)throw new r.Z("INTEGRITY_ERROR","Incomplete `moof` box");if((0,i.Z)(e,1835295092)<0)throw new r.Z("INTEGRITY_ERROR","Incomplete `mdat` box")}}},8766:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(6968);function i(e,t){for(var n=e.length,i=0;i+8<=n;){var a=(0,r.pX)(e,i);if(0===a)a=n-i;else if(1===a){if(i+16>n)return-1;a=(0,r.pV)(e,i+8)}if(isNaN(a)||a<=0)return-1;if((0,r.pX)(e,i+4)===t)return i+a<=n?i:-1;i+=a}return-1}},8791:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var r=n(7904),i=n(4597),a=n(7839);function o(e,t){var n=e.customManifestLoader,o=function(e){return function(t,n,a){if(void 0===t)throw new Error("Cannot perform HTTP(s) request. URL not known");switch(e){case"arraybuffer":return(0,i.ZP)({url:t,responseType:"arraybuffer",timeout:n.timeout,cancelSignal:a});case"text":return(0,i.ZP)({url:t,responseType:"text",timeout:n.timeout,cancelSignal:a});case"document":return(0,i.ZP)({url:t,responseType:"document",timeout:n.timeout,cancelSignal:a});default:(0,r.Z)(e)}}}(t);return"function"!=typeof n?o:function(e,t){return function(n,r,i){return new Promise((function(o,s){var u=Date.now()-performance.now(),l=!1,d=e(n,{reject:function(e){var t,n,r;if(!l&&!i.isCancelled()){l=!0,i.deregister(c);var o=e,u=null!==(t=null==o?void 0:o.message)&&void 0!==t?t:"Unknown error when fetching the Manifest through a custom manifestLoader.",d=new a.Z(u,null!==(n=null==o?void 0:o.canRetry)&&void 0!==n&&n,null!==(r=null==o?void 0:o.isOfflineError)&&void 0!==r&&r,null==o?void 0:o.xhr);s(d)}},resolve:function(e){if(!l&&!i.isCancelled()){l=!0,i.deregister(c);var t=void 0!==e.receivingTime?e.receivingTime-u:void 0,n=void 0!==e.sendingTime?e.sendingTime-u:void 0;o({responseData:e.data,size:e.size,requestDuration:e.duration,url:e.url,receivedTime:t,sendingTime:n})}},fallback:function(){l||i.isCancelled()||(l=!0,i.deregister(c),t(n,r,i).then(o,s))}},{timeout:r.timeout});function c(e){l||(l=!0,"function"==typeof d&&d(),s(e))}i.register(c)}))}}(n,o)}},4791:function(e,t,n){"use strict";function r(e,t){if(e.length!==t.length)return!1;for(var n=e.length-1;n>=0;n--)if(e[n]!==t[n])return!1;return!0}n.d(t,{Z:function(){return r}})},3274:function(e,t,n){"use strict";function r(e,t,n){if("function"==typeof Array.prototype.find)return e.find(t,n);for(var r=e.length>>>0,i=0;i>>0,i=0;i>>0;if(0===r)return!1;for(var i,a,o=0|n,s=o>=0?Math.min(o,r-1):Math.max(r+o,0);s=a.length)throw new Error("Unable to parse base64 string.");var t=a[e];if(255===t)throw new Error("Unable to parse base64 string.");return t}function s(e){var t,n="",r=e.length;for(t=2;t>2],n+=i[(3&e[t-2])<<4|e[t-1]>>4],n+=i[(15&e[t-1])<<2|e[t]>>6],n+=i[63&e[t]];return t===r+1&&(n+=i[e[t-2]>>2],n+=i[(3&e[t-2])<<4],n+="=="),t===r&&(n+=i[e[t-2]>>2],n+=i[(3&e[t-2])<<4|e[t-1]>>4],n+=i[(15&e[t-1])<<2],n+="="),n}function u(e){var t=e.length%4,n=e;0!==t&&(r.Z.warn("base64ToBytes: base64 given miss padding"),n+=3===t?"=":2===t?"==":"===");var i=n.indexOf("=");if(-1!==i&&i>16,l[c+1]=a>>8&255,l[c+2]=255&a;return l.subarray(0,l.length-s)}},6968:function(e,t,n){"use strict";function r(){for(var e,t=arguments.length,n=-1,r=0;++n0&&(i.set(e,a),a+=e.length);return i}function i(e,t){return(e[t+0]<<8)+(e[t+1]<<0)}function a(e,t){return 65536*e[t+0]+256*e[t+1]+e[t+2]}function o(e,t){return 16777216*e[t+0]+65536*e[t+1]+256*e[t+2]+e[t+3]}function s(e,t){return 4294967296*(16777216*e[t+0]+65536*e[t+1]+256*e[t+2]+e[t+3])+16777216*e[t+4]+65536*e[t+5]+256*e[t+6]+e[t+7]}function u(e){return new Uint8Array([e>>>8&255,255&e])}function l(e){return new Uint8Array([e>>>24&255,e>>>16&255,e>>>8&255,255&e])}function d(e){var t=e%4294967296,n=(e-t)/4294967296;return new Uint8Array([n>>>24&255,n>>>16&255,n>>>8&255,255&n,t>>>24&255,t>>>16&255,t>>>8&255,255&t])}function c(e,t){return(e[t+0]<<0)+(e[t+1]<<8)}function f(e,t){return e[t+0]+256*e[t+1]+65536*e[t+2]+16777216*e[t+3]}function v(e){return new Uint8Array([255&e,e>>>8&255,e>>>16&255,e>>>24&255])}function p(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer)}n.d(t,{O_:function(){return v},QI:function(){return a},XT:function(){return u},_f:function(){return p},dN:function(){return f},el:function(){return d},kh:function(){return l},pV:function(){return s},pX:function(){return o},qb:function(){return c},zK:function(){return i},zo:function(){return r}})},7864:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(7733);function i(e,t){return(0,r.Z)(t,(function(t){var n=setTimeout((function(){return t()}),e);return function(){return clearTimeout(n)}}))}},7733:function(e,t,n){"use strict";function r(e,t){var n;return new Promise((function(r,i){if(null!==e.cancellationError)return i(e.cancellationError);var a=!1;function o(e){void 0!==n&&n(),i(e)}n=t((function(t){e.deregister(o),a=!0,r(t)}),(function(t){e.deregister(o),a=!0,i(t)})),a||e.register(o)}))}n.d(t,{Z:function(){return r}})},1959:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(3887),i=n(1946),a=function(){function e(){this._listeners={}}var t=e.prototype;return t.addEventListener=function(e,t,n){var r=this,i=this._listeners[e];Array.isArray(i)?i.push(t):this._listeners[e]=[t],void 0!==n&&n.register((function(){r.removeEventListener(e,t)}))},t.removeEventListener=function(e,t){if((0,i.Z)(e))this._listeners={};else{var n=this._listeners[e];if(Array.isArray(n))if((0,i.Z)(t))delete this._listeners[e];else{var r=n.indexOf(t);-1!==r&&n.splice(r,1),0===n.length&&delete this._listeners[e]}}},t.trigger=function(e,t){var n=this._listeners[e];Array.isArray(n)&&n.slice().forEach((function(e){try{e(t)}catch(e){r.Z.error("EventEmitter: listener error",e instanceof Error?e:null)}}))},e}()},9592:function(e,t,n){"use strict";function r(e,t){return"function"==typeof Array.prototype.flatMap?e.flatMap(t):e.reduce((function(e,n){var r=t(n);return Array.isArray(r)?(e.push.apply(e,r),e):(e.push(r),e)}),[])}n.d(t,{Z:function(){return r}})},2572:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=.3;function i(e){return e*((2*Math.random()-1)*r+1)}},2870:function(e,t,n){"use strict";function r(e){for(var t=0,n=0;n=Number.MAX_SAFE_INTEGER&&(e+="0",t=0),e+String(t)}}n.d(t,{Z:function(){return r}})},6923:function(e,t,n){"use strict";function r(e){return"string"==typeof e&&e.length>0}n.d(t,{Z:function(){return r}})},1946:function(e,t,n){"use strict";function r(e){return null==e}n.d(t,{Z:function(){return r}})},7829:function(e,t,n){"use strict";var r=n(5553);t.ZP=r.ZP},5553:function(e,t,n){"use strict";n.d(t,{ZP:function(){return d},iH:function(){return l},Y1:function(){return u}});var r=n(6923),i=n(1946),a={aa:"aar",ab:"abk",ae:"ave",af:"afr",ak:"aka",am:"amh",an:"arg",ar:"ara",as:"asm",av:"ava",ay:"aym",az:"aze",ba:"bak",be:"bel",bg:"bul",bi:"bis",bm:"bam",bn:"ben",bo:"bod",br:"bre",bs:"bos",ca:"cat",ce:"che",ch:"cha",co:"cos",cr:"cre",cs:"ces",cu:"chu",cv:"chv",cy:"cym",da:"dan",de:"deu",dv:"div",dz:"dzo",ee:"ewe",el:"ell",en:"eng",eo:"epo",es:"spa",et:"est",eu:"eus",fa:"fas",ff:"ful",fi:"fin",fj:"fij",fo:"fao",fr:"fra",fy:"fry",ga:"gle",gd:"gla",gl:"glg",gn:"grn",gu:"guj",gv:"glv",ha:"hau",he:"heb",hi:"hin",ho:"hmo",hr:"hrv",ht:"hat",hu:"hun",hy:"hye",hz:"her",ia:"ina",id:"ind",ie:"ile",ig:"ibo",ii:"iii",ik:"ipk",io:"ido",is:"isl",it:"ita",iu:"iku",ja:"jpn",jv:"jav",ka:"kat",kg:"kon",ki:"kik",kj:"kua",kk:"kaz",kl:"kal",km:"khm",kn:"kan",ko:"kor",kr:"kau",ks:"kas",ku:"kur",kv:"kom",kw:"cor",ky:"kir",la:"lat",lb:"ltz",lg:"lug",li:"lim",ln:"lin",lo:"lao",lt:"lit",lu:"lub",lv:"lav",mg:"mlg",mh:"mah",mi:"mri",mk:"mkd",ml:"mal",mn:"mon",mr:"mar",ms:"msa",mt:"mlt",my:"mya",na:"nau",nb:"nob",nd:"nde",ne:"nep",ng:"ndo",nl:"nld",nn:"nno",no:"nor",nr:"nbl",nv:"nav",ny:"nya",oc:"oci",oj:"oji",om:"orm",or:"ori",os:"oss",pa:"pan",pi:"pli",pl:"pol",ps:"pus",pt:"por",qu:"que",rm:"roh",rn:"run",ro:"ron",ru:"rus",rw:"kin",sa:"san",sc:"srd",sd:"snd",se:"sme",sg:"sag",si:"sin",sk:"slk",sl:"slv",sm:"smo",sn:"sna",so:"som",sq:"sqi",sr:"srp",ss:"ssw",st:"sot",su:"sun",sv:"swe",sw:"swa",ta:"tam",te:"tel",tg:"tgk",th:"tha",ti:"tir",tk:"tuk",tl:"tgl",tn:"tsn",to:"ton",tr:"tur",ts:"tso",tt:"tat",tw:"twi",ty:"tah",ug:"uig",uk:"ukr",ur:"urd",uz:"uzb",ve:"ven",vi:"vie",vo:"vol",wa:"wln",wo:"wol",xh:"xho",yi:"yid",yo:"yor",za:"zha",zh:"zho",zu:"zul"},o={alb:"sqi",arm:"hye",baq:"eus",bur:"mya",chi:"zho",cze:"ces",dut:"nld",fre:"fra",geo:"kat",ger:"deu",gre:"ell",ice:"isl",mac:"mkd",mao:"mri",may:"msa",per:"fas",slo:"slk",rum:"ron",tib:"bod",wel:"cym"};function s(e){if((0,i.Z)(e)||""===e)return"";var t=function(e){var t;switch(e.length){case 2:t=a[e];break;case 3:t=o[e]}return t}((""+e).toLowerCase().split("-")[0]);return(0,r.Z)(t)?t:e}function u(e){if(!(0,i.Z)(e)){var t,n=!1;return"string"==typeof e?t=e:(t=e.language,!0===e.closedCaption&&(n=!0)),{language:t,closedCaption:n,normalized:s(t)}}return e}function l(e){if((0,i.Z)(e))return e;if("string"==typeof e)return{language:e,audioDescription:!1,normalized:s(e)};var t={language:e.language,audioDescription:!0===e.audioDescription,normalized:s(s(e.language))};return!0===e.isDub&&(t.isDub=!0),t}var d=s},8894:function(e,t,n){"use strict";function r(){}n.d(t,{Z:function(){return r}})},8026:function(e,t){"use strict";t.Z="function"==typeof Object.assign?Object.assign:function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=0;n<(arguments.length<=1?0:arguments.length-1);n++){var r=n+1<1||arguments.length<=n+1?void 0:arguments[n+1];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t}},1679:function(e,t,n){"use strict";t.Z="function"==typeof Object.values?Object.values:function(e){return Object.keys(e).map((function(t){return e[t]}))}},2829:function(e,t,n){"use strict";n.d(t,{A1:function(){return s},DD:function(){return m},F_:function(){return p},JN:function(){return c},L7:function(){return g},Ti:function(){return u},XS:function(){return v},at:function(){return h},kR:function(){return y},rx:function(){return f},tn:function(){return b},uH:function(){return S}});var r=1/60;function i(e,t){return Math.abs(e-t)=0;n--){var r=e.start(n);if(t>=r){var i=e.end(n);if(t=o?r.push({start:a,end:o}):n={start:a,end:o}}return{outerRanges:r,innerRange:n}}function h(e,t){var n=f(e,t);return null!==n?n.end-n.start:0}function m(e,t){var n=f(e,t);return null!==n?t-n.start:0}function g(e,t){var n=f(e,t);return null!==n?n.end-t:1/0}function y(e,t){if(t.start===t.end)return e;for(var n=t,r=0;r0)for(var o=0;o0)for(var s=0;sl&&n.push({start:l,end:a[d].start}),l=a[d].end;l=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0&&i.splice(e,1)}}i.push(r),!0===(null==t?void 0:t.emitCurrentValue)&&e(n,o),a||r.hasBeenCleared?o():void 0!==(null==t?void 0:t.clearSignal)&&t.clearSignal.register(o)},waitUntilDefined:function(e,t){this.onUpdate((function(t,r){void 0!==t&&(r(),e(n))}),{clearSignal:null==t?void 0:t.clearSignal,emitCurrentValue:!0})},finish:o};function o(){void 0!==t&&t.deregister(o),a=!0;for(var e,n=r(i.slice());!(e=n()).done;){var s=e.value;try{s.hasBeenCleared||(s.complete(),s.hasBeenCleared=!0)}catch(e){}}i.length=0}}function o(e,t,n){var r=a(t(e.getValue()),n);return e.onUpdate((function(e){r.setValue(t(e))}),{clearSignal:n}),r}n.d(t,{$l:function(){return a},ZP:function(){return a},lR:function(){return o}})},4597:function(e,t,n){"use strict";n.d(t,{ZP:function(){return o}});var r=n(9105),i=n(6923),a=n(1946);var o=function(e){var t={url:e.url,headers:e.headers,responseType:(0,a.Z)(e.responseType)?"json":e.responseType,timeout:e.timeout};return new Promise((function(n,o){var s,u=e.onProgress,l=e.cancelSignal,d=t.url,c=t.headers,f=t.responseType,v=t.timeout,p=new XMLHttpRequest;if(p.open("GET",d,!0),void 0!==v&&(p.timeout=v,s=window.setTimeout((function(){_(),o(new r.Z(d,p.status,"TIMEOUT",p))}),v+3e3)),p.responseType=f,"document"===p.responseType&&p.overrideMimeType("text/xml"),!(0,a.Z)(c)){var h=c;for(var m in h)h.hasOwnProperty(m)&&p.setRequestHeader(m,h[m])}var g=performance.now(),y=null;function _(){void 0!==s&&clearTimeout(s),null!==y&&y()}void 0!==l&&(y=l.register((function(e){_(),(0,a.Z)(p)||4===p.readyState||p.abort(),o(e)})),l.isCancelled())||(p.onerror=function(){_(),o(new r.Z(d,p.status,"ERROR_EVENT",p))},p.ontimeout=function(){_(),o(new r.Z(d,p.status,"TIMEOUT",p))},void 0!==u&&(p.onprogress=function(e){var t=performance.now();u({url:d,duration:t-g,sendingTime:g,currentTime:t,size:e.loaded,totalSize:e.total})}),p.onload=function(e){if(4===p.readyState)if(_(),p.status>=200&&p.status<300){var t,s=performance.now(),u=p.response instanceof ArrayBuffer?p.response.byteLength:e.total,l=p.status,c=p.responseType,f=(0,i.Z)(p.responseURL)?p.responseURL:d;if(t="json"===c?"object"==typeof p.response?p.response:function(e){try{return JSON.parse(e)}catch(e){return null}}(p.responseText):p.response,(0,a.Z)(t))return void o(new r.Z(d,p.status,"PARSE_ERROR",p));n({status:l,url:f,responseType:c,sendingTime:g,receivedTime:s,requestDuration:s-g,size:u,responseData:t})}else o(new r.Z(d,p.status,"ERROR_HTTP_CODE",p))},p.send())}))}},9829:function(e,t,n){"use strict";n.d(t,{$:function(){return o},Z:function(){return a}});var r=/^(?:[a-z]+:)?\/\//i,i=/\/\.{1,2}\//;function a(){var e=arguments.length;if(0===e)return"";for(var t="",n=0;n=0&&t===n+1)return e.length}var i=e.indexOf("?");return i>=0&&i>8&255}return n}function u(e){if(a)try{return new TextDecoder("utf-16le").decode(e)}catch(e){var t=e instanceof Error?e:"";r.Z.warn("Utils: could not use TextDecoder to parse UTF-16LE, fallbacking to another implementation",t)}for(var n="",i=0;i=t?n:new Array(t-n.length+1).join("0")+n}function c(e){if(a)try{return(new TextDecoder).decode(e)}catch(e){var t=e instanceof Error?e:"";r.Z.warn("Utils: could not use TextDecoder to parse UTF-8, fallbacking to another implementation",t)}var n=e;239===n[0]&&187===n[1]&&191===n[2]&&(n=n.subarray(3));var i,o=function(e){for(var t="",n=0;n=256?"%u"+d(l,4):"%"+d(l,2)}}return decodeURIComponent(i)}function f(e){for(var t=e.length,n=new Uint8Array(t/2),r=0,i=0;r>>4).toString(16),n+=(15&e[r]).toString(16),t.length>0&&r0;)try{var n=t._listeners.pop();null==n||n(e)}catch(e){o.Z.error("Error while calling clean up listener",e instanceof Error?e.toString():"Unknown error")}}))}var t=e.prototype;return t.isCancelled=function(){return this._isCancelled},t.register=function(e){var t=this;return this._isCancelled?((0,s.Z)(null!==this.cancellationError),e(this.cancellationError),u.Z):(this._listeners.push(e),function(){return t.deregister(e)})},t.deregister=function(e){for(var t=this._listeners.length-1;t>=0;t--)this._listeners[t]===e&&this._listeners.splice(t,1)},e}(),c=function(e){function t(){var n;return n=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(n),t.prototype),n.name="CancellationError",n.message="This task was cancelled.",n}return(0,i.Z)(t,e),t}((0,a.Z)(Error))},8806:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(7714),i=[];function a(e){(0,r.Z)(i,e)||(console.warn(e),i.push(e))}},7473:function(e){"use strict";var t=function(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return e},n=function(e){var n,r,i=document.createTextNode(""),a=0;return new e((function(){var e;if(n)r&&(n=r.concat(n));else{if(!r)return;n=r}if(r=n,n=null,"function"==typeof r)return e=r,r=null,void e();for(i.data=a=++a%2;r;)e=r.shift(),r.length||(r=null),e()})).observe(i,{characterData:!0}),function(e){t(e),n?"function"==typeof n?n=[n,e]:n.push(e):(n=e,i.data=a=++a%2)}};e.exports=function(){if("object"==typeof process&&process&&"function"==typeof process.nextTick)return process.nextTick;if("function"==typeof queueMicrotask)return function(e){queueMicrotask(t(e))};if("object"==typeof document&&document){if("function"==typeof MutationObserver)return n(MutationObserver);if("function"==typeof WebKitMutationObserver)return n(WebKitMutationObserver)}return"function"==typeof setImmediate?function(e){setImmediate(t(e))}:"function"==typeof setTimeout||"object"==typeof setTimeout?function(e){setTimeout(t(e),0)}:null}()},7061:function(e,t,n){var r=n(8698).default;function i(){"use strict";e.exports=i=function(){return t},e.exports.__esModule=!0,e.exports.default=e.exports;var t={},n=Object.prototype,a=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},s="function"==typeof Symbol?Symbol:{},u=s.iterator||"@@iterator",l=s.asyncIterator||"@@asyncIterator",d=s.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function f(e,t,n,r){var i=t&&t.prototype instanceof h?t:h,a=Object.create(i.prototype),s=new Z(r||[]);return o(a,"_invoke",{value:k(e,n,s)}),a}function v(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=f;var p={};function h(){}function m(){}function g(){}var y={};c(y,u,(function(){return this}));var _=Object.getPrototypeOf,b=_&&_(_(R([])));b&&b!==n&&a.call(b,u)&&(y=b);var S=g.prototype=h.prototype=Object.create(y);function T(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function E(e,t){function n(i,o,s,u){var l=v(e[i],e,o);if("throw"!==l.type){var d=l.arg,c=d.value;return c&&"object"==r(c)&&a.call(c,"__await")?t.resolve(c.__await).then((function(e){n("next",e,s,u)}),(function(e){n("throw",e,s,u)})):t.resolve(c).then((function(e){d.value=e,s(d)}),(function(e){return n("throw",e,s,u)}))}u(l.arg)}var i;o(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,i){n(e,r,t,i)}))}return i=i?i.then(a,a):a()}})}function k(e,t,n){var r="suspendedStart";return function(i,a){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw a;return x()}for(n.method=i,n.arg=a;;){var o=n.delegate;if(o){var s=w(o,n);if(s){if(s===p)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=v(e,t,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===p)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}function w(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),p;var i=v(r,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,p;var a=i.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,p):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,p)}function A(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function Z(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(A,this),this.reset(!0)}function R(e){if(e){var t=e[u];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function t(){for(;++n=0;--r){var i=this.tryEntries[r],o=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=a.call(i,"catchLoc"),u=a.call(i,"finallyLoc");if(s&&u){if(this.prev=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&a.call(r,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),I(n),p}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;I(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:R(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),p}},t}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports},8698:function(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},4687:function(e,t,n){var r=n(7061)();e.exports=r;try{regeneratorRuntime=r}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}},7326:function(e,t,n){"use strict";function r(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}n.d(t,{Z:function(){return r}})},5861:function(e,t,n){"use strict";function r(e,t,n,r,i,a,o){try{var s=e[a](o),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function i(e){return function(){var t=this,n=arguments;return new Promise((function(i,a){var o=e.apply(t,n);function s(e){r(o,i,a,s,u,"next",e)}function u(e){r(o,i,a,s,u,"throw",e)}s(void 0)}))}}n.d(t,{Z:function(){return i}})},1656:function(e,t,n){"use strict";function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function i(e){var t=function(e,t){if("object"!==r(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!==r(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===r(t)?t:String(t)}function a(e,t){for(var n=0;ni)break}if(u<0||n.length!==t.length)return l.Z.error("ABR: Current Bitrate not found in the calculated levels"),n[0];void 0!==a&&(s=0===o?a.score:a.score/o);var f=isFinite(r)?r:0,v=performance.now();if(f=0;m--)if(f>=t[m])return n[m];return n[0]}if(void 0!==this._lastUnsuitableQualityTimestamp&&v-this._lastUnsuitableQualityTimestampg)return e}();if(void 0!==y&&r>=t[y])return l.Z.debug("ABR: Raising quality in BufferBasedChooser",n[y]),n[y];return i},e}(),z=n(3274),K=function(){function e(e){this._alpha=Math.exp(Math.log(.5)/e),this._lastEstimate=0,this._totalWeight=0}var t=e.prototype;return t.addSample=function(e,t){var n=Math.pow(this._alpha,e),r=t*(1-n)+n*this._lastEstimate;isNaN(r)||(this._lastEstimate=r,this._totalWeight+=e)},t.getEstimate=function(){var e=1-Math.pow(this._alpha,this._totalWeight);return this._lastEstimate/e},e}();function G(e){if(!(e.progress.length<5)){for(var t=new K(2),n=e.progress,r=1;r=s.outOfStarvationGap&&(l.Z.info("ABR: exit starvation mode."),this._inStarvationMode=!1):this._inStarvationMode&&(l.Z.info("ABR: exit starvation mode."),this._inStarvationMode=!1),this._inStarvationMode&&(o=function(e,t,n,r,i){if(!r){var a=t.bufferGap,o=t.speed,s=t.position,u=isFinite(a)?a:0,l=function(e,t){for(var n=-1,r=0;r-1.2){n=r;break}if(a>t&&t-i.time>-1.2){n=r;break}}}if(n<0)return[];for(var o=e[n],s=o.content.segment.time,u=[o],l=n+1;l0?d.progress[d.progress.length-1]:void 0,p=G(d);if(void 0!==v&&void 0!==p){var h=W(v,p);if((c-v.timestamp)/1e3<=h&&h-u/o>2500)return p}if(d.content.segment.complete){var m=d.content.segment.duration,g=(c-d.requestTimestamp)/1e3;if(null!=n&&!(g<=(1.5*m+2)/o)){var y=m/g,_=n.bitrate*Math.min(.7,y);return void 0===i||_1&&(a/=e.speed),{bandwidthEstimate:o,bitrateChosen:a}},t.isUrgent=function(e,t,n,r){return null===t||!(e>=t.bitrate)&&function(e,t,n){if(n)return!0;var r=isFinite(e.bufferGap)?e.bufferGap:0,i=e.position.last+r,a=(0,z.Z)(t,(function(e){var t=e.content;return t.segment.duration>0&&t.segment.time+t.segment.duration>i}));if(void 0===a)return!0;var o=performance.now(),s=a.progress.length>0?a.progress[a.progress.length-1]:void 0,u=G(a);if(void 0===s||void 0===u)return!0;var l=W(s,u);return(o-s.timestamp)/1e3>1.2*l||l-r/e.speed>-1.5}(r,n,this._lowLatencyMode)},e}();function j(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return q(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return q(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function q(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);ns.bitrate)return 2===this._lastAbrEstimate.algorithmType&&(null!==this._lastAbrEstimate.representation&&(this._lastMaintanableBitrate=this._lastAbrEstimate.representation.bitrate),this._consecutiveWrongGuesses=0),null;var u=this._scoreCalculator.getEstimate(n);if(2!==this._lastAbrEstimate.algorithmType){if(void 0===u)return null;if(this._canGuessHigher(a,o,u)){var d=X(e,n);if(null!==d)return d}return null}if(this._isLastGuessValidated(s,r,u)&&(l.Z.debug("ABR: Guessed Representation validated",s.bitrate),this._lastMaintanableBitrate=s.bitrate,this._consecutiveWrongGuesses=0),n.id!==s.id)return s;if(this._shouldStopGuess(n,u,a,i))return this._consecutiveWrongGuesses++,this._blockGuessesUntil=performance.now()+Math.min(15e3*this._consecutiveWrongGuesses,12e4),function(e,t){var n=(0,B.Z)(e,(function(e){return e.id===t.id}));if(n<0)return l.Z.error("ABR: Current Representation not found."),null;for(;--n>=0;)if(e[n].bitrate=2.5&&performance.now()>this._blockGuessesUntil&&1===i&&r/t>1.01},t._shouldStopGuess=function(e,t,n,r){if(void 0!==t&&t.score<1.01)return!0;if((void 0===t||t.score<1.2)&&n<.6)return!0;for(var i,a=r.filter((function(t){return t.content.representation.id===e.id})),o=performance.now(),s=j(a);!(i=s()).done;){var u=i.value,l=o-u.requestTimestamp;if(u.content.segment.isInit){if(l>1e3)return!0}else{if(l>1e3*u.content.segment.duration+200)return!0;var d=G(u);if(void 0!==d&&d<.8*e.bitrate)return!0}}return!1},t._isLastGuessValidated=function(e,t,n){return void 0!==n&&1===n.confidenceLevel&&n.score>1.5||t>=e.bitrate&&(null===this._lastMaintanableBitrate||this._lastMaintanableBitratet.bitrate)return e[r];return null}var Q=function(){function e(){var e=c.Z.getCurrent(),t=e.ABR_FAST_EMA,n=e.ABR_SLOW_EMA;this._fastEWMA=new K(t),this._slowEWMA=new K(n),this._bytesSampled=0}var t=e.prototype;return t.addSample=function(e,t){if(!(t1&&this._lastRepresentationWithGoodScore!==e&&(l.Z.debug("ABR: New last stable representation",e.bitrate),this._lastRepresentationWithGoodScore=e)},t.getEstimate=function(e){if(null!==this._currentRepresentationData&&this._currentRepresentationData.representation.id===e.id){var t=this._currentRepresentationData,n=t.ewma,r=t.loadedSegments,i=t.loadedDuration;return{score:n.getEstimate(),confidenceLevel:r>=5&&i>=10?1:0}}},t.getLastStableRepresentation=function(){return this._lastRepresentationWithGoodScore},e}();function ne(e,t,n,r){var i=t<=n?n:t>=r?r:t,a=(0,B.Z)(e,(function(e){return e.bitrate>i}));return-1===a?e[e.length-1]:0===a?e[0]:e[a-1]}var re=(0,k.ZP)(-1);re.finish();var ie=(0,k.ZP)(0);ie.finish();var ae=(0,k.ZP)(1/0);ae.finish();var oe=(0,k.ZP)(void 0);oe.finish();var se=(0,k.ZP)(1/0);se.finish();var ue=function(e){var t={},n=e.manualBitrates,r=e.minAutoBitrates,i=e.maxAutoBitrates,a=e.initialBitrates,o=e.throttlers,s=e.lowLatencyMode;return function(e,u,d,f,v){var p=e.adaptation.type,h=function(e){var n=t[e];if(null==n){l.Z.debug("ABR: Creating new BandwidthEstimator for ",e);var r=new Q;return t[e]=r,r}return n}(p),m=(0,U.Z)(n[p],re),g=(0,U.Z)(r[p],ie),y=(0,U.Z)(i[p],ae),_=(0,U.Z)(a[p],0);return function(e,t){var n=e.bandwidthEstimator,r=e.context,i=e.currentRepresentation,a=e.filters,o=e.initialBitrate,s=e.lowLatencyMode,u=e.manualBitrate,d=e.maxAutoBitrate,f=e.minAutoBitrate,v=e.playbackObserver,p=e.representations,h=new te,m=new H(null!=o?o:0,s),g=new ee,y=L.Z,_={metrics:I,requestBegin:Z,requestProgress:R,requestEnd:x,addedSegment:function(e){y(e)}},b=new w.ZP;b.linkToSignal(t);var S=T(u.getValue(),p.getValue(),b.signal);return u.onUpdate(A,{clearSignal:t}),p.onUpdate(A,{clearSignal:t}),{estimates:S,callbacks:_};function T(e,t,o){if(0===t.length)return(0,k.ZP)({representation:null,bitrate:void 0,knownStableBitrate:void 0,manual:!1,urgent:!0});if(e>=0){var u=ne(t,e,0,1/0);return(0,k.ZP)({representation:u,bitrate:void 0,knownStableBitrate:void 0,manual:!0,urgent:!0})}if(1===t.length)return(0,k.ZP)({bitrate:void 0,representation:t[0],manual:!1,urgent:!0,knownStableBitrate:void 0});var p,_=!1,b=t.map((function(e){return e.bitrate})),S=new V(b),T=new $,w=new Y(h,T),A=v.getReference().getValue(),I=(0,k.ZP)(R());return v.listen((function(e){A=e,Z()}),{includeLastObservation:!1,clearSignal:o}),y=function(e){if(null!==A){var t=A,n=t.position,r=t.speed,i=e.buffered,a=(0,E.L7)(i,n.last),o=e.content.representation,s=h.getEstimate(o),u={bufferGap:a,currentBitrate:o.bitrate,currentScore:s,speed:r};p=S.getEstimate(u),Z()}},f.onUpdate(Z,{clearSignal:o}),d.onUpdate(Z,{clearSignal:o}),a.limitWidth.onUpdate(Z,{clearSignal:o}),a.limitWidth.onUpdate(Z,{clearSignal:o}),I;function Z(){I.setValue(R())}function R(){var e=A,o=e.bufferGap,u=e.position,v=e.maximumPosition,y=a.limitWidth.getValue(),b=a.throttleBitrate.getValue(),S=i.getValue(),E=f.getValue(),k=d.getValue(),I=function(e,t,n){var r=e;n<1/0&&(r=function(e,t){if(0===e.length)return[];e.sort((function(e,t){return e.bitrate-t.bitrate}));var n=e[0].bitrate,r=Math.max(t,n),i=(0,B.Z)(e,(function(e){return e.bitrate>r}));return-1===i?e:e.slice(0,i)}(r,n));void 0!==t&&(r=function(e,t){var n=e.slice().sort((function(e,t){return(0,U.Z)(e.width,0)-(0,U.Z)(t.width,0)})),r=(0,z.Z)(n,(function(e){return"number"==typeof e.width&&e.width>=t}));if(void 0===r)return e;var i="number"==typeof r.width?r.width:0;return e.filter((function(e){return"number"!=typeof e.width||e.width<=i}))}(r,t));return r}(t,y,b),Z=g.getRequests(),R=m.getBandwidthEstimate(A,n,S,Z,T.bandwidth),x=R.bandwidthEstimate,M=R.bitrateChosen,C=h.getLastStableRepresentation(),P=null===C?void 0:C.bitrate/(A.speed>0?A.speed:1),D=c.Z.getCurrent(),N=D.ABR_ENTER_BUFFER_BASED_ALGO,O=D.ABR_EXIT_BUFFER_BASED_ALGO;_&&o<=O?_=!1:!_&&isFinite(o)&&o>=N&&(_=!0);var L=ne(I,M,E,k),F=L.bitrate,V=null;_&&void 0!==p&&p>F&&(F=(V=ne(I,p,E,k)).bitrate);var K=null;return s&&null!==S&&r.manifest.isDynamic&&v-u.last<40&&(K=w.getGuess(t,A,S,F,Z)),null!==K&&K.bitrate>F?(l.Z.debug("ABR: Choosing representation with guess-based estimation.",K.bitrate,K.id),T.update(K,x,2),{bitrate:x,representation:K,urgent:null===S||K.bitrate=500||404===e.status||415===e.status||412===e.status:e.type===p.br.TIMEOUT||e.type===p.br.ERROR_EVENT:e instanceof ve.Z?"boolean"==typeof e.canRetry?e.canRetry:void 0!==e.xhr&&(e.xhr.status>=500||404===e.xhr.status||415===e.xhr.status||412===e.xhr.status):(0,pe.Z)(e)&&"INTEGRITY_ERROR"===e.code}function ye(e){return e instanceof de.Z?e.type===p.br.ERROR_EVENT&&!1===navigator.onLine:e instanceof ve.Z&&e.isOfflineError}function _e(e,t,n,r,i){return be.apply(this,arguments)}function be(){return be=(0,I.Z)(R().mark((function e(t,n,r,i,a){var o,s,u,d,c,f,v,p,h,m,g,y,_,b;return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(b=function(e){var t;if(0===f.size)return e[0];var n=performance.now();return null===(t=e.filter((function(e){var t;return!0!==(null===(t=f.get(e))||void 0===t?void 0:t.isBlacklisted)})).reduce((function(e,t){var r,i=null===(r=f.get(t))||void 0===r?void 0:r.blockedUntil;return void 0!==i&&i<=n&&(i=void 0),void 0===e?[t,i]:void 0===i?void 0===e[1]?e:[t,void 0]:void 0===e[1]?e:iv?(c.blockedUntil=void 0,c.isBlacklisted=!0):(p=c.errorCounter,h=Math.min(o*Math.pow(2,p-1),s),m=(0,me.Z)(h),c.blockedUntil=performance.now()+m),e.abrupt("return",g(e.t0));case 22:case"end":return e.stop()}var y}),e,null,[[0,7]])})))).apply(this,arguments)},h=function(e){return m.apply(this,arguments)},p=function(){if(null===t){var e=f.get(null);if(void 0!==e&&e.isBlacklisted)return;return null}if(null===n)return b(t);var r=n.getCdnPreferenceForResource(t);return b(r)},null===a.cancellationError){e.next=9;break}return e.abrupt("return",Promise.reject(a.cancellationError));case 9:if(o=i.baseDelay,s=i.maxDelay,u=i.maxRetryRegular,d=i.maxRetryOffline,c=i.onRetry,null!==t&&0===t.length&&l.Z.warn("Fetchers: no CDN given to `scheduleRequestWithCdns`."),f=new Map,void 0!==(v=p())){e.next=15;break}throw new Error("No CDN to request");case 15:return e.abrupt("return",h(v));case 16:case"end":return e.stop()}}),e)}))),be.apply(this,arguments)}function Se(e,t,n){return _e(null,null,e,t,n)}function Te(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Ee(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ee(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Ee(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0?this._consecutiveUnsafeMode=u,v=void 0===r?0:performance.now()-r,p=Math.max(this._settings.minimumManifestUpdateInterval-v,0),h=new w.ZP;if(h.linkToSignal(this._canceller.signal),this.scheduleManualRefresh=function(t){var i=t.enablePartialRefresh,a=t.delay,o=t.canUseUnsafeMode&&f,s=void 0===r?0:performance.now()-r,u=Math.max(n._settings.minimumManifestUpdateInterval-s,0),l=setTimeout((function(){h.cancel(),n._triggerNextManifestRefresh(e,{enablePartialRefresh:i,unsafeMode:o})}),Math.max((null!=a?a:0)-s,u));h.signal.register((function(){clearTimeout(l)}))},null!==e.expired){var m=setTimeout((function(){var t;null===(t=e.expired)||void 0===t||t.then((function(){h.cancel(),n._triggerNextManifestRefresh(e,{enablePartialRefresh:!1,unsafeMode:f})}),L.Z)}),p);h.signal.register((function(){clearTimeout(m)}))}if(void 0!==e.lifetime&&e.lifetime>=0){var g,y=1e3*e.lifetime-v;void 0===d?g=y:e.lifetime<3&&d>=100?(g=Math.min(Math.max(3e3-v,Math.max(y,0)+d),6*y),l.Z.info("MUS: Manifest update rythm is too frequent. Postponing next request.",y,g)):d>=1e3*e.lifetime/10?(g=Math.min(Math.max(y,0)+d,6*y),l.Z.info("MUS: Manifest took too long to parse. Postponing next request",g,g)):g=y;var _=setTimeout((function(){h.cancel(),n._triggerNextManifestRefresh(e,{enablePartialRefresh:!1,unsafeMode:f})}),Math.max(g,p));h.signal.register((function(){clearTimeout(_)}))}},r._triggerNextManifestRefresh=function(e,t){var n,r,i=this,a=t.enablePartialRefresh,o=t.unsafeMode,s=e.updateUrl;null!==this._prioritizedContentUrl?(n=!0,r=this._prioritizedContentUrl,this._prioritizedContentUrl=null):r=(n=!a||void 0===s)?e.getUrl():s;var u=e.clockOffset;o?(this._consecutiveUnsafeMode+=1,l.Z.info('Init: Refreshing the Manifest in "unsafeMode" for the '+String(this._consecutiveUnsafeMode)+" consecutive time.")):this._consecutiveUnsafeMode>0&&(l.Z.info('Init: Not parsing the Manifest in "unsafeMode" anymore after '+String(this._consecutiveUnsafeMode)+" consecutive times."),this._consecutiveUnsafeMode=0),this._isRefreshPending||(this._isRefreshPending=!0,this._fetchManifest(r).then((function(t){return t.parse({externalClockOffset:u,previousManifest:e,unsafeMode:o})})).then((function(t){i._isRefreshPending=!1;var r=t.manifest,a=t.sendingTime,o=t.parsingTime,s=performance.now();if(n)e.replace(r);else try{e.update(r)}catch(t){var u=t instanceof Error?t.message:"unknown error";l.Z.warn("MUS: Attempt to update Manifest failed: "+u,"Re-downloading the Manifest fully");var d=c.Z.getCurrent().FAILED_PARTIAL_UPDATE_MANIFEST_REFRESH_DELAY,f=void 0===a?0:performance.now()-a,v=Math.max(i._settings.minimumManifestUpdateInterval-f,0),p=L.Z,h=setTimeout((function(){p(),i._triggerNextManifestRefresh(e,{enablePartialRefresh:!1,unsafeMode:!1})}),Math.max(d-f,v));return void(p=i._canceller.signal.register((function(){clearTimeout(h)})))}var m=performance.now()-s;i._recursivelyRefreshManifest(e,{sendingTime:a,parsingTime:o,updatingTime:m})})).catch((function(e){i._isRefreshPending=!1,i._onFatalError(e)})))},r._onFatalError=function(e){this._canceller.isUsed()||(this.trigger("error",e),this.dispose())},n}(_.Z);var we=ke;function Ae(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Ie(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ie(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Ie(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0&&this._removeIndexFromDowngradeList(n);var r=c.Z.getCurrent().DEFAULT_CDN_DOWNGRADE_TIME;this._downgradedCdnList.metadata.push(e);var i=window.setTimeout((function(){var n=Re(t._downgradedCdnList.metadata,e);n>=0&&t._removeIndexFromDowngradeList(n),t.trigger("priorityChange",null)}),r);this._downgradedCdnList.timeouts.push(i),this.trigger("priorityChange",null)},r._innerGetCdnPreferenceForResource=function(e){var t=this,n=e.reduce((function(e,n){return t._downgradedCdnList.metadata.some((function(e){return e.id===n.id&&e.baseUrl===n.baseUrl}))?e[1].push(n):e[0].push(n),e}),[[],[]]),r=n[0],i=n[1];return r.concat(i)},r._removeIndexFromDowngradeList=function(e){this._downgradedCdnList.metadata.splice(e,1);var t=this._downgradedCdnList.timeouts.splice(e,1);clearTimeout(t[0])},n}(_.Z);function Re(e,t){return 0===e.length?-1:void 0!==t.id?(0,B.Z)(e,(function(e){return e.id===t.id})):(0,B.Z)(e,(function(e){return e.baseUrl===t.baseUrl}))}var xe=n(520),Me=function(){function e(){this._cache=new WeakMap}var t=e.prototype;return t.add=function(e,t){var n=e.representation;e.segment.isInit&&this._cache.set(n,t)},t.get=function(e){var t=e.representation;if(e.segment.isInit){var n=this._cache.get(t);if(void 0!==n)return n}return null},e}(),Ce=(0,b.Z)();var Pe=function(){function e(e){var t=e.prioritySteps;if(this._minPendingPriority=null,this._waitingQueue=[],this._pendingTasks=[],this._prioritySteps=t,this._prioritySteps.high>=this._prioritySteps.low)throw new Error("TP: the max high level priority should be given a lowerpriority number than the min low priority.")}var t=e.prototype;return t.create=function(e,t,n,r){var i,a=this;return(0,O.Z)(r,(function(o,s){return i={hasEnded:!1,priority:t,trigger:function(){if(!i.hasEnded){var e=function(){u(),a._endTask(i)},t=new w.ZP,u=t.linkToSignal(r);i.interrupter=t,t.signal.register((function(){i.interrupter=null,r.isCancelled()||n.beforeInterrupted()})),a._minPendingPriority=null===a._minPendingPriority?i.priority:Math.min(a._minPendingPriority,i.priority),a._pendingTasks.push(i),i.taskFn(t.signal).then((function(t){n.beforeEnded(),e(),o(t)})).catch((function(n){!r.isCancelled()&&t.isUsed()&&n instanceof w.FU||function(t){e(),s(t)}(n)}))}},taskFn:e,interrupter:null},a._canBeStartedNow(i)?(i.trigger(),a._isRunningHighPriorityTasks()&&a._interruptCancellableTasks()):a._waitingQueue.push(i),function(){return a._endTask(i)}}))},t._endTask=function(e){e.hasEnded=!0;var t=De(e.taskFn,this._waitingQueue);if(t>=0)this._waitingQueue.splice(t,1);else{var n=De(e.taskFn,this._pendingTasks);if(n<0)return;this._pendingTasks.splice(n,1),this._pendingTasks.length>0?this._minPendingPriority===e.priority&&(this._minPendingPriority=Math.min.apply(Math,this._pendingTasks.map((function(e){return e.priority})))):this._minPendingPriority=null,this._loopThroughWaitingQueue()}},t.updatePriority=function(e,t){var n=De(e,this._waitingQueue);if(n>=0){var r=this._waitingQueue[n];if(r.priority===t)return;if(r.priority=t,!this._canBeStartedNow(r))return;return this._findAndRunWaitingQueueTask(n),void(this._isRunningHighPriorityTasks()&&this._interruptCancellableTasks())}var i=De(e,this._pendingTasks);if(i<0)l.Z.warn("TP: request to update the priority of a non-existent task");else{var a=this._pendingTasks[i];if(a.priority!==t){var o=a.priority;a.priority=t,null===this._minPendingPriority||tt.priority?t.priority:e}),null);if(!(null===e||null!==this._minPendingPriority&&this._minPendingPriority=this._prioritySteps.low)return this._interruptPendingTask(t),this._interruptCancellableTasks()}},t._findAndRunWaitingQueueTask=function(e){return e>=this._waitingQueue.length||e<0?(l.Z.warn("TP : Tried to start a non existing task"),!1):(this._waitingQueue.splice(e,1)[0].trigger(),!0)},t._interruptPendingTask=function(e){var t,n=De(e.taskFn,this._pendingTasks);n<0?l.Z.warn("TP: Interrupting a non-existent pending task. Aborting..."):(this._pendingTasks.splice(n,1),this._waitingQueue.push(e),0===this._pendingTasks.length?this._minPendingPriority=null:this._minPendingPriority===e.priority&&(this._minPendingPriority=Math.min.apply(Math,this._pendingTasks.map((function(e){return e.priority})))),null===(t=e.interrupter)||void 0===t||t.cancel())},t._canBeStartedNow=function(e){return null===this._minPendingPriority||e.priority<=this._minPendingPriority},t._isRunningHighPriorityTasks=function(){return null!==this._minPendingPriority&&this._minPendingPriority<=this._prioritySteps.high},e}();function De(e,t){return(0,B.Z)(t,(function(t){return t.taskFn===e}))}var Ne=function(){function e(e,t,n){var r=new Ze(n),i=c.Z.getCurrent(),a=i.MIN_CANCELABLE_PRIORITY,o=i.MAX_HIGH_PRIORITY_LEVEL;this._transport=e,this._prioritizer=new Pe({prioritySteps:{high:o,low:a}}),this._cdnPrioritizer=r,this._backoffOptions=t}return e.prototype.createSegmentFetcher=function(e,t){var n,r,i,a=function(e,t){var n=t.maxRetryRegular,r=t.maxRetryOffline,i=t.lowLatencyMode,a=t.requestTimeout,o=c.Z.getCurrent(),s=o.DEFAULT_MAX_REQUESTS_RETRY_ON_ERROR,u=o.DEFAULT_REQUEST_TIMEOUT,l=o.DEFAULT_MAX_REQUESTS_RETRY_ON_OFFLINE,d=o.INITIAL_BACKOFF_DELAY_BASE,f=o.MAX_BACKOFF_DELAY_BASE;return{maxRetryRegular:"image"===e?0:null!=n?n:s,maxRetryOffline:null!=r?r:l,baseDelay:i?d.LOW_LATENCY:d.REGULAR,maxDelay:i?f.LOW_LATENCY:f.REGULAR,requestTimeout:(0,S.Z)(a)?u:a}}(e,this._backoffOptions),o=function(e,t,n,r,i){var a={timeout:i.requestTimeout<0?void 0:i.requestTimeout},o=(0,g.Z)(["audio","video"],e)?new Me:void 0,s=t.loadSegment,u=t.parseSegment;return function(){var e=(0,I.Z)(R().mark((function e(t,d,c){var v,p,h,m,g,y,_,b,E,k,A,I,Z,x,M,C,P,D;return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(D=function(){var e;E||!(0,S.Z)(y)&&void 0!==y.size&&void 0!==y.requestDuration&&_.length>0&&_.every((function(e){return e}))&&(E=!0,null===(e=r.onMetrics)||void 0===e||e.call(r,{size:y.size,requestDuration:y.requestDuration,content:t,segmentDuration:b}))},P=function(e){d.onRetry(fe(e))},C=function(e,n){_.push(!1);var r=_.length-1;return function(i){var a={data:e,isChunked:n};try{var o=u(a,t,i);return _[r]||(b=void 0!==b&&"media"===o.segmentType&&null!==o.chunkInfos&&void 0!==o.chunkInfos.duration?b+o.chunkInfos.duration:void 0,_[r]=!0,D()),o}catch(e){throw(0,f.Z)(e,{defaultCode:"PIPELINE_PARSE_ERROR",defaultReason:"Unknown parsing error"})}}},M=function(e){return s(e,t,a,c,k)},x=function(){var e;void 0===y&&(l.Z.debug("SF: Segment request cancelled",m),y=null,null===(e=r.onRequestEnd)||void 0===e||e.call(r,{id:g}))},m=(0,xe.K)(t),g=Ce(),_=[],b=0,E=!1,k={onProgress:function(e){var t;void 0===y&&void 0!==e.totalSize&&e.size0;){var e=this._queue.shift();void 0!==e&&e.reject(new w.FU)}if("open"===this._mediaSource.readyState)try{this._sourceBuffer.abort()}catch(e){l.Z.warn("AVSB: Failed to abort a "+this.bufferType+" SourceBuffer:",e instanceof Error?e:"")}},r._onPendingTaskError=function(e){if(this._lastInitSegment=null,null!==this._pendingTask){var t=e instanceof Error?e:new Error("An unknown error occured when doing operations on the SourceBuffer");this._pendingTask.reject(t)}},r._addToQueue=function(e,t){var n=this;return(0,O.Z)(t,(function(t,r){var i=0===n._queue.length&&null===n._pendingTask,a=(0,T.Z)({resolve:t,reject:r},e);return n._queue.push(a),i&&n._flush(),function(){var e=n._queue.indexOf(a);e>=0&&n._queue.splice(e,1),a.resolve=L.Z,a.reject=L.Z}}))},r._flush=function(){if(!this._sourceBuffer.updating){if(null!==this._pendingTask){var e=this._pendingTask;if(e.type!==Ve.f.Push||0===e.data.length){switch(e.type){case Ve.f.Push:null!==e.inventoryData&&this._segmentInventory.insertChunk(e.inventoryData);break;case Ve.f.EndOfSegment:this._segmentInventory.completeSegment(e.value,this.getBufferedRanges());break;case Ve.f.Remove:this.synchronizeInventory();break;default:(0,Ue.Z)(e)}var t=e.resolve;return this._pendingTask=null,t(),void this._flush()}}else{var n=this._queue.shift();if(void 0===n)return;if(n.type!==Ve.f.Push)this._pendingTask=n;else{var r,i=n.value;try{r=this._preparePushOperation(i.data)}catch(e){this._pendingTask=(0,T.Z)({data:[],inventoryData:i.inventoryInfos},n);var a=e instanceof Error?e:new Error("An unknown error occured when preparing a push operation");return this._lastInitSegment=null,void n.reject(a)}this._pendingTask=(0,T.Z)({data:r,inventoryData:i.inventoryInfos},n)}}try{switch(this._pendingTask.type){case Ve.f.EndOfSegment:return l.Z.debug("AVSB: Acknowledging complete segment",(0,xe.K)(this._pendingTask.value)),void this._flush();case Ve.f.Push:var o=this._pendingTask.data.shift();if(void 0===o)return void this._flush();l.Z.debug("AVSB: pushing segment",this.bufferType,(0,xe.K)(this._pendingTask.inventoryData)),this._sourceBuffer.appendBuffer(o);break;case Ve.f.Remove:var s=this._pendingTask.value,u=s.start,d=s.end;l.Z.debug("AVSB: removing data from SourceBuffer",this.bufferType,u,d),this._sourceBuffer.remove(u,d);break;default:(0,Ue.Z)(this._pendingTask)}}catch(e){this._onPendingTaskError(e)}}},r._preparePushOperation=function(e){var t=[],n=e.codec,r=e.timestampOffset,i=e.appendWindow,a=!1;if(void 0!==n&&n!==this.codec&&(l.Z.debug("AVSB: updating codec",n),a=function(e,t){if("function"==typeof e.changeType){try{e.changeType(t)}catch(e){return l.Z.warn("Could not call 'changeType' on the given SourceBuffer:",e instanceof Error?e:""),!1}return!0}return!1}(this._sourceBuffer,n),a?this.codec=n:l.Z.debug("AVSB: could not update codec",n,this.codec)),this._sourceBuffer.timestampOffset!==r){var o=r;l.Z.debug("AVSB: updating timestampOffset",this.bufferType,this._sourceBuffer.timestampOffset,o),this._sourceBuffer.timestampOffset=o}if(void 0===i[0]?this._sourceBuffer.appendWindowStart>0&&(this._sourceBuffer.appendWindowStart=0):i[0]!==this._sourceBuffer.appendWindowStart&&(i[0]>=this._sourceBuffer.appendWindowEnd&&(this._sourceBuffer.appendWindowEnd=i[0]+1),this._sourceBuffer.appendWindowStart=i[0]),void 0===i[1]?this._sourceBuffer.appendWindowEnd!==1/0&&(this._sourceBuffer.appendWindowEnd=1/0):i[1]!==this._sourceBuffer.appendWindowEnd&&(this._sourceBuffer.appendWindowEnd=i[1]),null!==e.initSegment&&(a||!this._isLastInitSegment(e.initSegment))){var s=e.initSegment;t.push(s);var u=(0,Be._f)(s);this._lastInitSegment={data:u,hash:(0,Fe.Z)(u)}}return null!==e.chunk&&t.push(e.chunk),t},r._isLastInitSegment=function(e){if(null===this._lastInitSegment)return!1;if(this._lastInitSegment.data===e)return!0;var t=this._lastInitSegment.data;if(t.byteLength===e.byteLength){var n=(0,Be._f)(e);if((0,Fe.Z)(n)===this._lastInitSegment.hash&&(0,m.Z)(t,n))return!0}return!1},n}(Ve.C),Ke=["audio","video","text","image"];function Ge(e){return"audio"===e||"video"===e}var We=function(){function e(e,t){this._mediaElement=e,this._mediaSource=t,this._initializedSegmentBuffers={},this._onNativeBufferAddedOrDisabled=[]}e.isNative=function(e){return Ge(e)};var t=e.prototype;return t.getBufferTypes=function(){var e=this.getNativeBufferTypes();return null==h.Z.nativeTextTracksBuffer&&null==h.Z.htmlTextTracksBuffer||e.push("text"),null!=h.Z.imageBuffer&&e.push("image"),e},t.getNativeBufferTypes=function(){return"AUDIO"===this._mediaElement.nodeName?["audio"]:["video","audio"]},t.getStatus=function(e){var t=this._initializedSegmentBuffers[e];return void 0===t?{type:"uninitialized"}:null===t?{type:"disabled"}:{type:"initialized",value:t}},t.waitForUsableBuffers=function(e){var t=this;return this._areNativeBuffersUsable()?Promise.resolve():(0,O.Z)(e,(function(e){var n,r=function(){var e=t._onNativeBufferAddedOrDisabled.indexOf(n);e>=0&&t._onNativeBufferAddedOrDisabled.splice(e,1)};return n=function(){t._areNativeBuffersUsable()&&(r(),e())},t._onNativeBufferAddedOrDisabled.push(n),r}))},t.disableSegmentBuffer=function(t){var n=this._initializedSegmentBuffers[t];if(null!==n){if(void 0!==n)throw new Error("Cannot disable an active SegmentBuffer.");this._initializedSegmentBuffers[t]=null,e.isNative(t)&&this._onNativeBufferAddedOrDisabled.forEach((function(e){return e()}))}else l.Z.warn("SBS: The "+t+" SegmentBuffer was already disabled.")},t.createSegmentBuffer=function(e,t,n){void 0===n&&(n={});var r,i=this._initializedSegmentBuffers[e];if(Ge(e)){if(null!=i)return i instanceof ze&&i.codec!==t?l.Z.warn("SB: Reusing native SegmentBuffer with codec",i.codec,"for codec",t):l.Z.info("SB: Reusing native SegmentBuffer with codec",t),i;l.Z.info("SB: Adding native SegmentBuffer with codec",t);var a=new ze(e,t,this._mediaSource);return this._initializedSegmentBuffers[e]=a,this._onNativeBufferAddedOrDisabled.forEach((function(e){return e()})),a}if(null!=i)return l.Z.info("SB: Reusing a previous custom SegmentBuffer for the type",e),i;if("text"===e){if(l.Z.info("SB: Creating a new text SegmentBuffer"),"html"===n.textTrackMode){if(null==h.Z.htmlTextTracksBuffer)throw new Error("HTML Text track feature not activated");r=new h.Z.htmlTextTracksBuffer(this._mediaElement,n.textTrackElement)}else{if(null==h.Z.nativeTextTracksBuffer)throw new Error("Native Text track feature not activated");r=new h.Z.nativeTextTracksBuffer(this._mediaElement,!0===n.hideNativeSubtitle)}return this._initializedSegmentBuffers.text=r,r}if("image"===e){if(null==h.Z.imageBuffer)throw new Error("Image buffer feature not activated");return l.Z.info("SB: Creating a new image SegmentBuffer"),r=new h.Z.imageBuffer,this._initializedSegmentBuffers.image=r,r}throw l.Z.error("SB: Unknown buffer type:",e),new v.Z("BUFFER_TYPE_UNKNOWN","The player wants to create a SegmentBuffer of an unknown type.")},t.disposeSegmentBuffer=function(e){var t=this._initializedSegmentBuffers[e];null!=t?(l.Z.info("SB: Aborting SegmentBuffer",e),t.dispose(),delete this._initializedSegmentBuffers[e]):l.Z.warn("SB: Trying to dispose a SegmentBuffer that does not exist")},t.disposeAll=function(){var e=this;Ke.forEach((function(t){"initialized"===e.getStatus(t).type&&e.disposeSegmentBuffer(t)}))},t._areNativeBuffersUsable=function(){var e=this,t=this.getNativeBufferTypes();return!t.some((function(t){return void 0===e._initializedSegmentBuffers[t]}))&&!t.every((function(t){return null===e._initializedSegmentBuffers[t]}))},e}(),He=n(7473),je=n.n(He),qe=function(){function e(e){this._array=[],this._sortingFn=e}var t=e.prototype;return t.add=function(){for(var e=arguments.length,t=new Array(e),n=0;n=this._array.length)throw new Error("Invalid index.");return this._array[e]},t.toArray=function(){return this._array.slice()},t.findFirst=function(e){return(0,z.Z)(this._array,e)},t.has=function(e){return(0,g.Z)(this._array,e)},t.removeElement=function(e){var t=this._array.indexOf(e);if(t>=0)return this._array.splice(t,1),t},t.head=function(){return this._array[0]},t.last=function(){return this._array[this._array.length-1]},t.shift=function(){return this._array.shift()},t.pop=function(){return this._array.pop()},e}(),Ye=function(){function e(e){this._weakMap=new WeakMap,this._fn=e}var t=e.prototype;return t.get=function(e){var t=this._weakMap.get(e);if(void 0===t){var n=this._fn(e);return this._weakMap.set(e,n),n}return t},t.destroy=function(e){this._weakMap.delete(e)},e}();function Xe(e,t){var n,r=e.segmentBuffer,i=e.playbackObserver,a=e.maxBufferBehind,o=e.maxBufferAhead;function s(){(function(e,t,n,r,i){return Qe.apply(this,arguments)})(r,n,a.getValue(),o.getValue(),t).catch((function(e){var t=e instanceof Error?e.message:"Unknown error";l.Z.error("Could not run BufferGarbageCollector:",t)}))}i.listen((function(e){var t;n=null!==(t=e.position.pending)&&void 0!==t?t:e.position.last,s()}),{includeLastObservation:!0,clearSignal:t}),a.onUpdate(s,{clearSignal:t}),o.onUpdate(s,{clearSignal:t}),s()}function Qe(){return(Qe=(0,I.Z)(R().mark((function e(t,n,r,i,a){var o,s,u,d,c,f,v,p;return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(isFinite(r)||isFinite(i)){e.next=2;break}return e.abrupt("return",Promise.resolve());case 2:o=[],s=(0,E.F_)(t.getBufferedRanges(),n),u=s.innerRange,d=s.outerRanges,c=function(){if(isFinite(i)){for(var e=0;et.start&&o.push({start:n+i,end:t.end})}null!=u&&n+i=t.end?o.push(t):n>=t.end&&n-r>t.start&&n-ru.start&&o.push({start:u.start,end:n-r})}}(),c(),f=0,v=o;case 9:if(!(f0&&n[0].segment.id===e._mediaSegmentAwaitingInitMetadata)){var r=e._mediaSegmentRequest;if(0===n.length){if(null===r)return;return l.Z.debug("Stream: no more media segment to request. Cancelling queue.",e._content.adaptation.type),void e._restartMediaSegmentDownloadingQueue()}if(null===r)return l.Z.debug("Stream: Media segments now need to be requested. Starting queue.",e._content.adaptation.type,n.length),void e._restartMediaSegmentDownloadingQueue();var i=n[0];return r.segment.id!==i.segment.id?(l.Z.debug("Stream: Next media segment changed, cancelling previous",e._content.adaptation.type),void e._restartMediaSegmentDownloadingQueue()):void(r.priority!==i.priority&&(l.Z.debug("Stream: Priority of next media segment changed, updating",e._content.adaptation.type,r.priority,i.priority),e._segmentFetcher.updatePriority(r.request,i.priority)))}}),{emitCurrentValue:!0,clearSignal:this._currentCanceller.signal}),this._downloadQueue.onUpdate((function(t){var n,r=e._initSegmentRequest;null===t.initSegment||null===r?(null===(n=t.initSegment)||void 0===n?void 0:n.segment.id)!==(null==r?void 0:r.segment.id)&&(null===t.initSegment&&l.Z.debug("Stream: no more init segment to request. Cancelling queue.",e._content.adaptation.type),e._restartInitSegmentDownloadingQueue(t.initSegment)):t.initSegment.priority!==r.priority&&e._segmentFetcher.updatePriority(r.request,t.initSegment.priority)}),{emitCurrentValue:!0,clearSignal:this._currentCanceller.signal}))},r.stop=function(){var e;null===(e=this._currentCanceller)||void 0===e||e.cancel(),this._currentCanceller=null},r._restartMediaSegmentDownloadingQueue=function(){var e=this;null!==this._mediaSegmentRequest&&this._mediaSegmentRequest.canceller.cancel();!function t(n){if(null!==e._currentCanceller&&e._currentCanceller.isUsed())e._mediaSegmentRequest=null;else{if(void 0===n)return e._mediaSegmentRequest=null,void e.trigger("emptyQueue",null);var r=new w.ZP,i=null===e._currentCanceller?L.Z:r.linkToSignal(e._currentCanceller.signal),a=n.segment,o=n.priority,s=(0,T.Z)({segment:a},e._content),u=!1,d=!1;r.signal.register((function(){e._mediaSegmentRequest=null,u||(e._mediaSegmentAwaitingInitMetadata===a.id&&(e._mediaSegmentAwaitingInitMetadata=null),u=!0,d=!1)}));var c=function(t){(0,y.Z)("media"===t.segmentType,"Should have loaded a media segment."),e.trigger("parsedMediaSegment",(0,T.Z)({},t,{segment:a}))},f=function(){var n=e._downloadQueue.getValue().segmentQueue;if(0===n.length)return u=!0,void e.trigger("emptyQueue",null);n[0].segment.id===a.id&&n.shift(),u=!0,t(n[0])},v=e._segmentFetcher.createRequest(s,o,{onRetry:function(t){e.trigger("requestRetry",{segment:a,error:t})},beforeInterrupted:function(){l.Z.info("Stream: segment request interrupted temporarly.",a.id,a.time)},onChunk:function(t){var n=e._initSegmentInfoRef.getValue();void 0!==n?c(t(null!=n?n:void 0)):(d=!0,e._initSegmentInfoRef.waitUntilDefined((function(e){c(t(null!=e?e:void 0))}),{clearSignal:r.signal}))},onAllChunksReceived:function(){d?(e._mediaSegmentAwaitingInitMetadata=a.id,e._initSegmentInfoRef.waitUntilDefined((function(){e._mediaSegmentAwaitingInitMetadata=null,d=!1,e.trigger("fullyLoadedSegment",a)}),{clearSignal:r.signal})):e.trigger("fullyLoadedSegment",a)},beforeEnded:function(){i(),e._mediaSegmentRequest=null,d?e._initSegmentInfoRef.waitUntilDefined(f,{clearSignal:r.signal}):f()}},r.signal);v.catch((function(t){i(),u||(u=!0,e.stop(),e.trigger("error",t))})),e._mediaSegmentRequest={segment:a,priority:o,request:v,canceller:r}}}(this._downloadQueue.getValue().segmentQueue[0])},r._restartInitSegmentDownloadingQueue=function(e){var t=this;if((null===this._currentCanceller||!this._currentCanceller.isUsed())&&(null!==this._initSegmentRequest&&this._initSegmentRequest.canceller.cancel(),null!==e)){var n=new w.ZP,r=null===this._currentCanceller?L.Z:n.linkToSignal(this._currentCanceller.signal),i=e.segment,a=e.priority,o=(0,T.Z)({segment:i},this._content),s=!1,u=this._segmentFetcher.createRequest(o,a,{onRetry:function(e){t.trigger("requestRetry",{segment:i,error:e})},beforeInterrupted:function(){l.Z.info("Stream: init segment request interrupted temporarly.",i.id)},beforeEnded:function(){r(),t._initSegmentRequest=null,s=!0},onChunk:function(e){var n,r=e(void 0);(0,y.Z)("init"===r.segmentType,"Should have loaded an init segment."),t.trigger("parsedInitSegment",(0,T.Z)({},r,{segment:i})),"init"===r.segmentType&&t._initSegmentInfoRef.setValue(null!==(n=r.initTimescale)&&void 0!==n?n:null)},onAllChunksReceived:function(){t.trigger("fullyLoadedSegment",i)}},n.signal);u.catch((function(e){r(),s||(s=!0,t.stop(),t.trigger("error",e))})),n.signal.register((function(){t._initSegmentRequest=null,s||(s=!0)})),this._initSegmentRequest={segment:i,priority:a,request:u,canceller:n}}},n}(_.Z);function Je(e,t,n,r,i){var a=e.period,o=e.adaptation,s=e.representation,u=function(e,t){for(var n=0;n=t.end)return null;if(r.bufferedEnd>t.start)return n}return null}(i,t);if(null===u){if(null===n){if(r&&void 0!==a.end&&t.end>=a.end)return{start:void 0,end:null};var d=s.index.checkDiscontinuity(t.start);if(null!==d)return{start:void 0,end:d}}return null}var c=i[u];if(void 0!==c.bufferedStart&&c.bufferedStart>t.start&&(null===n||c.infos.segment.end<=n)){var f=c.bufferedStart;return r||!1===s.index.awaitSegmentBetween(t.start,f)?(l.Z.debug("RS: current discontinuity encountered",o.type,c.bufferedStart),{start:void 0,end:f}):null}var v=function(e,t,n){if(n<=0)return l.Z.error("RS: Asked to check a discontinuity before the first chunk."),null;for(var r=n;r=t.end)return null;if(i.bufferedStart-a.bufferedEnd>0)return r}return null}(i,t,u+1);if(null!==v){var p=i[v-1],h=i[v];if(null===n||h.infos.segment.end<=n){if(!r&&!1!==s.index.awaitSegmentBetween(p.infos.segment.end,h.infos.segment.time))return null;var m=p.bufferedEnd,g=h.bufferedStart;return l.Z.debug("RS: future discontinuity encountered",o.type,m,g),{start:m,end:g}}}if(null===n){if(r&&void 0!==a.end){if(t.end=0;n--){var r=e[n];if(void 0===r.bufferedStart)return null;if(r.bufferedStart=a.end)return null;for(var b=i.length-1;b>=0;b--){var S=i[b];if(void 0===S.bufferedStart)break;if(S.bufferedStart=n.length-1?null:n[t+1],s=null;if(function(e,t,n){var r=c.Z.getCurrent().MAX_TIME_MISSING_FROM_COMPLETE_SEGMENT;if(void 0===e.bufferedStart)return l.Z.warn("Stream: Start of a segment unknown. Assuming it is garbage collected by default.",e.start),!0;if(null!==t&&void 0!==t.bufferedEnd&&e.bufferedStart-t.bufferedEnd<.1)return!1;if(nr)return l.Z.info("Stream: The start of the wanted segment has been garbage collected",e.start,e.bufferedStart),!0;return!1}(e,r,o.start)){if(function(e,t){var n,r;if(e.length<2)return!0;var i=e[e.length-1],a=null===(n=i.buffered)||void 0===n?void 0:n.start;if(void 0!==t&&void 0!==a&&t-a>.05)return!0;var o=e[e.length-2],s=null===(r=o.buffered)||void 0===r?void 0:r.start;if(void 0===s||void 0===a)return!0;return Math.abs(s-a)>.01}(s=a(e.infos),e.bufferedStart))return!1;l.Z.debug("Stream: skipping segment gc-ed at the start",e.start,e.bufferedStart)}if(function(e,t,n){var r=c.Z.getCurrent().MAX_TIME_MISSING_FROM_COMPLETE_SEGMENT;if(void 0===e.bufferedEnd)return l.Z.warn("Stream: End of a segment unknown. Assuming it is garbage collected by default.",e.end),!0;if(null!==t&&void 0!==t.bufferedStart&&t.bufferedStart-e.bufferedEnd<.1)return!1;if(n>e.bufferedEnd&&e.end-e.bufferedEnd>r)return l.Z.info("Stream: The end of the wanted segment has been garbage collected",e.start,e.bufferedStart),!0;return!1}(e,i,o.end)){if(function(e,t){var n,r;if(e.length<2)return!0;var i=e[e.length-1],a=null===(n=i.buffered)||void 0===n?void 0:n.end;if(void 0!==t&&void 0!==a&&a-t>.05)return!0;var o=e[e.length-2],s=null===(r=o.buffered)||void 0===r?void 0:r.end;if(void 0===s||void 0===a)return!0;return Math.abs(s-a)>.01}(s=null!=s?s:a(e.infos),e.bufferedEnd))return!1;l.Z.debug("Stream: skipping segment gc-ed at the end",e.end,e.bufferedEnd)}return!0})),m=c.Z.getCurrent(),g=m.MINIMUM_SEGMENT_SIZE,y=m.MIN_BUFFER_AHEAD,_=!1,b=Math.min(1/60,g),S=!1,E=[],k=p.filter((function(e){var t=(0,T.Z)({segment:e},n);if(s.length>0&&s.some((function(e){return(0,xe.z)(t,e)})))return!1;var u=e.duration,c=e.time,p=e.end;if(e.isInit)return!0;if(_)return E.push(e),!1;if(e.complete&&u0&&s.some((function(e){if(e.period.id!==n.period.id||e.adaptation.id!==n.adaptation.id)return!1;var a=e.segment;return!(a.time-b>c)&&(!(a.end+b-b&&w.end-p>-b)return!1}}var A=u*n.representation.bitrate;if(v-A<0&&(S=!0,c>o.start+y))return _=!0,E.push(e),!1;var I=a(t);if(I.length>1){var Z=I[I.length-1],R=I[I.length-2];if(null===Z.buffered&&null===R.buffered)return l.Z.warn("Stream: Segment GCed multiple times in a row, ignoring it.","If this happens a lot and lead to unpleasant experience, please check your device's available memory. If it's low when this message is emitted, you might want to update the RxPlayer's settings (`maxBufferAhead`, `maxVideoBufferSize` etc.) so less memory is used by regular media data buffering."+d.type,f.id,e.time),!1}for(var x=0;xc){var C=M.start>c+b||tt(h,x).ende[n].start;)n++;return e[--n]}function nt(e,t,n,r){var i=c.Z.getCurrent().CONTENT_REPLACEMENT_PADDING;return e.period.id===t.period.id&&(!(e.segment.timea}return rr}(e.representation,t.representation,r)))}function rt(e,t){for(var n=e-t,r=c.Z.getCurrent().SEGMENT_PRIORITIES_STEPS,i=0;i=u&&l.isInitialized()&&l.isFinished()&&function(e,t,n){var r;return t.containsTime(n)&&e.isLastPeriodKnown&&t.id===(null===(r=e.periods[e.periods.length-1])||void 0===r?void 0:r.id)}(a,o,t)?u-1:t-.1;var d,c=i+n;d=!(!s.index.isInitialized()||!s.index.isFinished()||void 0===o.end)&&(void 0===u?c>=o.end:null===u||c>=u);return{start:Math.max(i,o.start),end:Math.min(c,null!==(r=o.end)&&void 0!==r?r:1/0),hasReachedPeriodEnd:d}}(e,u,i),d=s.index.shouldRefresh(l.start,l.end),f=o.getPendingOperations().filter((function(e){return e.type===Ve.f.EndOfSegment})).map((function(e){return e.value})),v=function(e,t){for(var n=c.Z.getCurrent().MINIMUM_SEGMENT_SIZE,r=Math.max(1/60,n),i=e.start+r,a=e.end-r,o=[],s=t.length-1;s>=0;s--){var u=t[s],l=u.infos.representation;if(!u.partiallyPushed&&!1!==l.decipherable&&l.isSupported){var d=u.infos.segment,f=d.time/d.timescale;((d.complete?f+d.duration/d.timescale:u.end)>i&&fi&&u.start0&&(b=Math.min.apply(Math,f.map((function(e){return e.segment.time})))),m.length>0&&(b=null!==b?Math.min(b,m[0].time):m[0].time),y.length>0&&(b=null!==b?Math.min(b,y[0].segment.time):y[0].segment.time),{imminentDiscontinuity:Je(e,l,b,_,v),hasFinishedLoading:_,neededSegments:y,isBufferFull:g,shouldRefreshManifest:d}}function at(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return ot(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ot(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ot(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);nu.end||e+ni.start&&o.push({start:i.start,end:e-n}),e+n0&&Z.every((function(e){return void 0!==e.keyIds}))&&(I=!0,t.encryptionDataEncountered(Z.map((function(e){return(0,T.Z)({content:r},e)}))),_.isUsed()))return}var R=new $e(r,E,s,A);return R.addEventListener("error",(function(e){b.signal.isCancelled()||(_.cancel(),t.error(e))})),R.addEventListener("parsedInitSegment",M),R.addEventListener("parsedMediaSegment",M),R.addEventListener("emptyQueue",x),R.addEventListener("requestRetry",(function(e){if(t.warning(e.error),!b.signal.isCancelled()){var n=e.segment,r=v.index;!1===r.isSegmentStillAvailable(n)?x():r.canBeOutOfSyncError(e.error,n)&&t.manifestMightBeOufOfSync()}})),R.addEventListener("fullyLoadedSegment",(function(e){o.endOfSegment((0,T.Z)({segment:e},r),_.signal).catch(C)})),R.start(),b.signal.register((function(){R.removeEventListener(),R.stop()})),a.listen(x,{includeLastObservation:!1,clearSignal:b.signal}),p.onUpdate(x,{emitCurrentValue:!1,clearSignal:b.signal}),h.onUpdate(x,{emitCurrentValue:!1,clearSignal:b.signal}),u.onUpdate(x,{emitCurrentValue:!1,clearSignal:b.signal}),void x();function x(){var e,n;if(!b.isUsed()){var i=a.getReference().getValue(),s=null!==(e=i.position.pending)&&void 0!==e?e:i.position.last,f=it(r,s,a,g.getValue(),p.getValue(),h.getValue(),o),m=f.neededSegments,T=null;if(v.index.isInitialized()){if(m.length>0&&!S.isLoaded&&null!==S.segment){var k=m[0].priority;T={segment:S.segment,priority:k}}}else if(null===S.segment)l.Z.warn("Stream: Uninitialized index without an initialization segment");else if(S.isLoaded)l.Z.warn("Stream: Uninitialized index with an already loaded initialization segment");else{var w=null!==(n=i.position.pending)&&void 0!==n?n:i.position.last;T={segment:S.segment,priority:rt(d.start,w)}}var A=u.getValue();if(null===A)E.setValue({initSegment:T,segmentQueue:m});else{if(A.urgent)return l.Z.debug("Stream: Urgent switch, terminate now.",y),E.setValue({initSegment:null,segmentQueue:[]}),E.finish(),b.cancel(),void t.terminating();var I=m[0],Z=R.getRequestedInitSegment(),x=R.getRequestedMediaSegment(),M=null===x||void 0===I||x.id!==I.segment.id?[]:[I],P=null===Z?null:T;if(E.setValue({initSegment:P,segmentQueue:M}),0===M.length&&null===P)return l.Z.debug("Stream: No request left, terminate",y),E.finish(),b.cancel(),void t.terminating()}if(t.streamStatusUpdate({period:d,position:i.position.last,bufferType:y,imminentDiscontinuity:f.imminentDiscontinuity,isEmptyStream:!1,hasFinishedLoading:f.hasFinishedLoading,neededSegments:f.neededSegments}),!b.signal.isCancelled()){var D=c.Z.getCurrent().UPTO_CURRENT_POSITION_CLEANUP;if(f.isBufferFull){var N=Math.max(0,s-D);N>0&&o.removeBuffer(0,N,_.signal).catch(C)}f.shouldRefreshManifest&&t.needsManifestRefresh()}}}function M(e){if(!_.isUsed())if("init"===e.segmentType){if(S.segmentData=e.initializationData,S.isLoaded=!0,!I){var n=v.getAllEncryptionData();n.length>0&&t.encryptionDataEncountered(n.map((function(e){return(0,T.Z)({content:r},e)})))}(function(e,t){return ft.apply(this,arguments)})({playbackObserver:a,content:r,segment:e.segment,segmentData:e.initializationData,segmentBuffer:o},_.signal).then((function(e){null!==e&&t.addedSegment(e)})).catch(C),x()}else{var i=e.inbandEvents,s=e.needsManifestRefresh,u=e.protectionDataUpdate;if(!I&&u){var l=v.getAllEncryptionData();if(l.length>0&&(t.encryptionDataEncountered(l.map((function(e){return(0,T.Z)({content:r},e)}))),_.isUsed()))return}if(!0===s&&(t.needsManifestRefresh(),_.isUsed()))return;if(void 0!==i&&i.length>0&&(t.inbandEvent(i),_.isUsed()))return;var d=S.segmentData;(function(e,t){return vt.apply(this,arguments)})({playbackObserver:a,content:r,initSegmentData:d,parsedSegment:e,segment:e.segment,segmentBuffer:o},_.signal).then((function(e){null!==e&&t.addedSegment(e)})).catch(C)}}function C(e){_.isUsed()&&e instanceof w.FU||(_.cancel(),t.error(e))}};var ht=function(e,t,n){var r=e.playbackObserver,i=e.content,a=e.options,o=e.representationEstimator,s=e.segmentBuffer,u=e.segmentFetcherCreator,d=e.wantedBufferAhead,p=e.maxVideoBufferSize,h="direct"===a.manualBitrateSwitchingMode,m=i.manifest,g=i.period,y=i.adaptation,_=new w.ZP;_.linkToSignal(n);var b,S=new Map,E=(0,k.$l)(null,_.signal),A=function(e,t,n,r,i,a){var o=e.manifest,s=e.adaptation,u=(0,k.ZP)([],a);f(),o.addEventListener("decipherabilityUpdate",f);var l=a.register(p),d=t(e,n,u,r,a),c=d.estimates;return{abrCallbacks:d.callbacks,estimateRef:c};function f(){var e=s.getPlayableRepresentations();if(0===e.length){var t=new v.Z("NO_PLAYABLE_REPRESENTATION","No Representation in the chosen "+s.type+" Adaptation can be played",{adaptation:s});return p(),void i(t)}var n=u.getValue();n.length===e.length&&n.every((function(t,n){return t.id===e[n].id}))||u.setValue(e)}function p(){o.removeEventListener("decipherabilityUpdate",f),void 0!==l&&l()}}(i,o,E,r,(function(e){_.cancel(),t.error(e)}),_.signal),I=A.estimateRef,Z=A.abrCallbacks,R=u.createSegmentFetcher(y.type,{onRequestBegin:Z.requestBegin,onRequestEnd:Z.requestEnd,onProgress:Z.requestProgress,onMetrics:Z.metrics});function x(e,t,n,i){var o=new w.ZP;o.linkToSignal(_.signal);var u=(0,k.lR)(d,(function(t){return t*function(e){var t=S.get(e.id),n=void 0!==t?t:1;void 0===t&&S.set(e.id,n);return n}(e)}),o.signal),c="video"===y.type?p:(0,k.$l)(1/0);l.Z.info("Stream: changing representation",y.type,e.id,e.bitrate);var v=(0,T.Z)({},i,{error:function(r){var a,o=(0,f.Z)(r,{defaultCode:"NONE",defaultReason:"Unknown `RepresentationStream` error"});if("BUFFER_FULL_ERROR"!==o.code)i.error(r);else{var s=d.getValue(),u=.7*(null!==(a=S.get(e.id))&&void 0!==a?a:1);if(u<=.05||s*u<=2)throw o;S.set(e.id,u),(0,he.Z)(4e3,_.signal).then((function(){return x(e,t,n,i)})).catch(L.Z)}},terminating:function(){o.cancel(),i.terminating()}});pt({playbackObserver:r,content:{representation:e,adaptation:y,period:g,manifest:m},segmentBuffer:s,segmentFetcher:R,terminate:t,options:{bufferGoal:u,maxBufferSize:c,drmSystemId:a.drmSystemId,fastSwitchThreshold:n}},v,_.signal)}I.onUpdate((function(e){var n=e.bitrate;void 0!==n&&n!==b&&(b=n,l.Z.debug("Stream: new "+y.type+" bitrate estimate",n),t.bitrateEstimationChange({type:y.type,bitrate:n}))}),{emitCurrentValue:!0,clearSignal:_.signal}),function e(n){var i=new w.ZP;i.linkToSignal(_.signal);var o=I.getValue(),s=o.representation,u=o.manual;if(null===s)return;if(h&&u&&!n){var d=c.Z.getCurrent().DELTA_POSITION_AFTER_RELOAD;return je()((function(){r.listen((function(e){var n,i;if(I.getValue().manual){var a=r.getCurrentTime()+d.bitrateSwitch,o=Math.min(Math.max(g.start,a),null!==(n=g.end)&&void 0!==n?n:1/0),s=!(null!==(i=e.paused.pending)&&void 0!==i?i:r.getIsPaused());return t.waitingMediaSourceReload({bufferType:y.type,period:g,position:o,autoPlay:s})}}),{includeLastObservation:!0,clearSignal:i.signal})}))}var f=(0,k.$l)(null,i.signal);I.onUpdate((function(e){if(null!==e.representation&&e.representation.id!==s.id)return e.urgent?(l.Z.info("Stream: urgent Representation switch",y.type),f.setValue({urgent:!0})):(l.Z.info("Stream: slow Representation switch",y.type),f.setValue({urgent:!1}))}),{clearSignal:i.signal,emitCurrentValue:!0});var v=(0,k.$l)(0);a.enableFastSwitching&&I.onUpdate((function(e){v.setValueIfChanged(null==e?void 0:e.knownStableBitrate)}),{clearSignal:i.signal,emitCurrentValue:!0});var p={type:y.type,period:g,representation:s};if(E.setValue(s),_.isUsed())return;if(t.representationChange(p),_.isUsed())return;var m={streamStatusUpdate:t.streamStatusUpdate,encryptionDataEncountered:t.encryptionDataEncountered,manifestMightBeOufOfSync:t.manifestMightBeOufOfSync,needsManifestRefresh:t.needsManifestRefresh,inbandEvent:t.inbandEvent,warning:t.warning,error:function(e){_.cancel(),t.error(e)},addedSegment:function(e){Z.addedSegment(e),_.isUsed()||t.addedSegment(e)},terminating:function(){if(!i.isUsed())return i.cancel(),e(!1)}};x(s,f,v,m)}(!0)},mt=n(9252);var gt=function(e,t){var n=e.split(";"),r=n[0],i=n.slice(1),a=t.split(";"),o=a[0],s=a.slice(1);if(r!==o)return!1;var u=(0,z.Z)(i,(function(e){return(0,mt.Z)(e,"codecs=")})),l=(0,z.Z)(s,(function(e){return(0,mt.Z)(e,"codecs=")}));if(void 0===u||void 0===l)return!1;var d=u.substring(7),c=l.substring(7);return d.split(".")[0]===c.split(".")[0]};function yt(e,t,n,r,i){if(void 0!==e.codec&&"reload"===i.onCodecSwitch&&!function(e,t){return e.getPlayableRepresentations().some((function(e){return gt(e.getMimeTypeString(),t)}))}(n,e.codec))return{type:"needs-reload",value:void 0};var a=e.getBufferedRanges();if(0===a.length)return{type:"continue",value:void 0};var o=(0,E.JN)(a),s=t.start,u=null==t.end?1/0:t.end,l=(0,E.tn)(o,[{start:s,end:u}]);if(0===l.length)return{type:"continue",value:void 0};e.synchronizeInventory();var d=e.getInventory();if(!d.some((function(e){return e.infos.period.id===t.id&&e.infos.adaptation.id!==n.id})))return{type:"continue",value:void 0};var f=function(e,t,n){return e.reduce((function(e,r){if(r.infos.period.id!==t.id||r.infos.adaptation.id!==n.id)return e;var i=r.bufferedStart,a=r.bufferedEnd;return void 0===i||void 0===a||e.push({start:i,end:a}),e}),[])}(d,t,n),v=(0,E.uH)(l,f);if(0===v.length)return{type:"continue",value:void 0};var p=r.currentTime,h=i.audioTrackSwitchingMode;if(("video"===n.type||"audio"===n.type&&"reload"===h)&&(0,E.Ti)({start:s,end:u},p)&&(r.readyState>1||!n.getPlayableRepresentations().some((function(t){var n;return gt(t.getMimeTypeString(),null!==(n=e.codec)&&void 0!==n?n:"")})))&&!(0,E.A1)(f,p))return{type:"needs-reload",value:void 0};var m="audio"===n.type&&"direct"===h,g=[],y=function(e,t){for(var n=0;n=t.start)return n>0?e[n-1]:null;return e.length>0?e[e.length-1]:null}(d,t);null!==y&&(void 0===y.bufferedEnd||t.start-y.bufferedEnd<1)&&g.push({start:0,end:t.start+1});var _=n.type,b=c.Z.getCurrent().ADAPTATION_SWITCH_BUFFER_PADDINGS,S=b[_].before;null==S&&(S=0);var T=b[_].after;if(null==T&&(T=0),m||g.push({start:p-S,end:p+T}),void 0!==t.end){var k=function(e,t){for(var n=0;nt.start)return e[n];return null}(d,t);null!==k&&(void 0===k.bufferedStart||k.bufferedStart-t.end<1)&&g.push({start:t.end-1,end:Number.MAX_VALUE})}var w=(0,E.uH)(v,g);return 0===w.length?{type:"continue",value:void 0}:m?{type:"flush-buffer",value:w}:{type:"clean-buffer",value:w}}function _t(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return bt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return bt(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function bt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=o.end&&(l.Z.debug('Stream: full "empty" AdaptationStream',n),s=!0),i.streamStatusUpdate({period:o,bufferType:n,position:u,imminentDiscontinuity:null,isEmptyStream:!0,hasFinishedLoading:s,neededSegments:[]})}t.onUpdate(u,{emitCurrentValue:!1,clearSignal:a}),e.listen(u,{includeLastObservation:!1,clearSignal:a}),u()}var Et=function(e,t,n){var r=e.bufferType,i=e.content,a=e.garbageCollectors,o=e.playbackObserver,s=e.representationEstimator,u=e.segmentFetcherCreator,d=e.segmentBuffersStore,v=e.options,p=e.wantedBufferAhead,h=e.maxVideoBufferSize,m=i.period,g=(0,k.ZP)(void 0,n);if(t.periodStreamReady({type:r,period:m,adaptationRef:g}),!n.isCancelled()){var y,_=!0;g.onUpdate((function(e){(0,I.Z)(R().mark((function i(){var s,u,f,h,g,T,E,k,A,I,Z,x,M,C,P,D;return R().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(void 0!==e){i.next=2;break}return i.abrupt("return");case 2:if((u=new w.ZP).linkToSignal(n),null==y||y.cancel(),y=u,null!==e){i.next=34;break}if(l.Z.info("Stream: Set no "+r+" Adaptation. P:",m.start),"initialized"!==(f=d.getStatus(r)).type){i.next=26;break}if(l.Z.info("Stream: Clearing previous "+r+" SegmentBuffer"),!We.isNative(r)){i.next=15;break}return i.abrupt("return",S(0,u.signal));case 15:if(h=null!==(s=m.end)&&void 0!==s?s:1/0,!(m.start>h)){i.next=20;break}l.Z.warn("Stream: Can't free buffer: period's start is after its end"),i.next=24;break;case 20:return i.next=22,f.value.removeBuffer(m.start,h,u.signal);case 22:if(!u.isUsed()){i.next=24;break}return i.abrupt("return");case 24:i.next=30;break;case 26:if("uninitialized"!==f.type){i.next=30;break}if(d.disableSegmentBuffer(r),!u.isUsed()){i.next=30;break}return i.abrupt("return");case 30:if(t.adaptationChange({type:r,adaptation:null,period:m}),!u.isUsed()){i.next=33;break}return i.abrupt("return");case 33:return i.abrupt("return",Tt(o,p,r,{period:m},t,u.signal));case 34:if(g=c.Z.getCurrent(),T=g.DELTA_POSITION_AFTER_RELOAD,E=_?0:"audio"===r?T.trackSwitch.audio:"video"===r?T.trackSwitch.video:T.trackSwitch.other,_=!1,!We.isNative(r)||"disabled"!==d.getStatus(r).type){i.next=39;break}return i.abrupt("return",S(E,u.signal));case 39:if(l.Z.info("Stream: Updating "+r+" adaptation","A: "+e.id,"P: "+m.start),t.adaptationChange({type:r,adaptation:e,period:m}),!u.isUsed()){i.next=43;break}return i.abrupt("return");case 43:if(k=o.getReadyState(),A=St(d,r,e,v),I={currentTime:o.getCurrentTime(),readyState:k},"needs-reload"!==(Z=yt(A,m,e,I,v)).type){i.next=49;break}return i.abrupt("return",S(E,u.signal));case 49:return i.next=51,d.waitForUsableBuffers(u.signal);case 51:if(!u.isUsed()){i.next=53;break}return i.abrupt("return");case 53:if("flush-buffer"!==Z.type&&"clean-buffer"!==Z.type){i.next=67;break}x=_t(Z.value);case 55:if((M=x()).done){i.next=63;break}return C=M.value,P=C.start,D=C.end,i.next=59,A.removeBuffer(P,D,u.signal);case 59:if(!u.isUsed()){i.next=61;break}return i.abrupt("return");case 61:i.next=55;break;case 63:if("flush-buffer"!==Z.type){i.next=67;break}if(t.needsBufferFlush(),!u.isUsed()){i.next=67;break}return i.abrupt("return");case 67:a.get(A)(u.signal),b(e,A,u.signal);case 69:case"end":return i.stop()}}),i)})))().catch((function(e){e instanceof w.FU||(null==y||y.cancel(),t.error(e))}))}),{clearSignal:n,emitCurrentValue:!0})}function b(e,n,a){var c=i.manifest,g=function(e,t){return e.deriveReadOnlyObserver((function(e,n){var r=(0,k.ZP)(i(),n);return e.onUpdate(a,{clearSignal:n,emitCurrentValue:!1}),r;function i(){var n=e.getValue(),r=t.getBufferedRanges(),i=(0,E.L7)(r,n.position.last);return(0,T.Z)({},n,{bufferGap:i})}function a(){r.setValue(i())}}))}(o,n);ht({content:{manifest:c,period:m,adaptation:e},options:v,playbackObserver:g,representationEstimator:s,segmentBuffer:n,segmentFetcherCreator:u,wantedBufferAhead:p,maxVideoBufferSize:h},Object.assign(Object.assign({},t),{error:function(e){if(!We.isNative(r)){l.Z.error("Stream: "+r+" Stream crashed. Aborting it.",e instanceof Error?e:""),d.disposeSegmentBuffer(r);var n=(0,f.Z)(e,{defaultCode:"NONE",defaultReason:"Unknown `AdaptationStream` error"});if(t.warning(n),a.isCancelled())return;return Tt(o,p,r,{period:m},t,a)}l.Z.error("Stream: "+r+" Stream crashed. Stopping playback.",e instanceof Error?e:""),t.error(e)}}),a)}function S(e,n){je()((function(){o.listen((function(n){var i,a,s=o.getCurrentTime()+e,u=Math.min(Math.max(m.start,s),null!==(i=m.end)&&void 0!==i?i:1/0),l=!(null!==(a=n.paused.pending)&&void 0!==a?a:o.getIsPaused());t.waitingMediaSourceReload({bufferType:r,period:m,position:u,autoPlay:l})}),{includeLastObservation:!0,clearSignal:n})}))}};function kt(e,t){if(0===t.length)return[];e.synchronizeInventory();for(var n=[],r=e.getInventory(),i=function(){var i=r[a];if(t.some((function(e){return i.infos.period.id===e.period.id&&i.infos.adaptation.id===e.adaptation.id&&i.infos.representation.id===e.representation.id}))){var o=i.bufferedStart,s=i.bufferedEnd;if(void 0===o||void 0===s){l.Z.warn("SO: No buffered start or end found from a segment.");var u=e.getBufferedRanges(),d=u.length;return 0===d?{v:[]}:{v:[{start:u.start(0),end:u.end(d-1)}]}}var c=n[n.length-1];void 0!==c&&c.end===o?c.end=s:n.push({start:o,end:s})}},a=0;a=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function At(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0?t[t.length-1].end>=n-5:t[0].start<=n+5}var Zt=function(e,t,n,r,i,a,o,s){for(var u,d=e.manifest,f=e.initialPeriod,p=a.maxBufferAhead,h=a.maxBufferBehind,m=a.wantedBufferAhead,g=a.maxVideoBufferSize,y=c.Z.getCurrent(),_=y.MAXIMUM_MAX_BUFFER_AHEAD,b=y.MAXIMUM_MAX_BUFFER_BEHIND,S=new Ye((function(e){var n=e.bufferType,r=null!=b[n]?b[n]:1/0,i=null!=_[n]?_[n]:1/0;return function(n){Xe({segmentBuffer:e,playbackObserver:t,maxBufferBehind:(0,k.lR)(h,(function(e){return Math.min(e,r)}),n),maxBufferAhead:(0,k.lR)(p,(function(e){return Math.min(e,i)}),n)},n)}})),T=wt(r.getBufferTypes());!(u=T()).done;){E(u.value,f)}function E(e,n){var i=new qe((function(e,t){return e.start-t.start})),a=!1,u=new w.ZP;return u.linkToSignal(s),t.listen((function(t){var n,r,f=t.position,v=null!==(n=f.pending)&&void 0!==n?n:f.last;if(a&&function(e){var t=i.head(),n=i.last();if(null==t||null==n)return!0;return t.start>e||(null==n.end?1/0:n.end)0;){var p=i.get(i.length()-1);i.removeElement(p),o.periodStreamCleared({type:e,period:p})}u.cancel(),(u=new w.ZP).linkToSignal(s);var h=null!==(r=d.getPeriodForTime(v))&&void 0!==r?r:d.getNextPeriod(v);void 0!==h?c(h):l.Z.warn("Stream: The wanted position is not found in the Manifest.")}}),{clearSignal:s,includeLastObservation:!0}),d.addEventListener("decipherabilityUpdate",(function(e){(function(e){return f.apply(this,arguments)})(e).catch((function(e){u.cancel(),o.error(e)}))}),s),c(n);function c(t){var n=Object.assign(Object.assign({},o),{waitingMediaSourceReload:function(e){var t=i.head();if(void 0===t||t.id!==e.period.id)o.lockedStream({bufferType:e.bufferType,period:e.period});else{var n=e.position,r=e.autoPlay;o.needsMediaSourceReload({position:n,autoPlay:r})}},periodStreamReady:function(e){a=!0,i.add(e.period),o.periodStreamReady(e)},periodStreamCleared:function(e){i.removeElement(e.period),o.periodStreamCleared(e)},error:function(e){u.cancel(),o.error(e)}});A(e,t,n,u.signal)}function f(){return f=(0,I.Z)(R().mark((function n(f){var p,h,m,g,y,_,b,S,T,E,k,A,I;return R().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(p=r.getStatus(e),0!==(h=f.filter((function(t){return t.adaptation.type===e}))).length&&"initialized"===p.type&&!h.every((function(e){return!0===e.representation.decipherable}))){n.next=4;break}return n.abrupt("return");case 4:for(m=p.value,g=h.filter((function(e){return void 0===e.representation.decipherable})),y=h.filter((function(e){return!1===e.representation.decipherable})),_=kt(m,y),b=kt(m,g),a=!1,l.Z.info("Stream: Destroying all PeriodStreams for decipherability matters",e);i.length()>0;)S=i.get(i.length()-1),i.removeElement(S),o.periodStreamCleared({type:e,period:S});u.cancel(),(u=new w.ZP).linkToSignal(s),T=0,E=[].concat(_,b);case 16:if(!(T=o.end&&(l.Z.info("Stream: Destroying PeriodStream as the current playhead moved above it",e,o.start,null!==(i=a.pending)&&void 0!==i?i:a.last,o.end),n(),s.periodStreamCleared({type:e,period:o}),f.cancel())}),{clearSignal:u,includeLastObservation:!0});var v={bufferType:e,content:{manifest:d,period:o},garbageCollectors:S,maxVideoBufferSize:g,segmentFetcherCreator:i,segmentBuffersStore:r,options:a,playbackObserver:t,representationEstimator:n,wantedBufferAhead:m},p=Object.assign(Object.assign({},s),{streamStatusUpdate:function(t){if(t.hasFinishedLoading){var n=d.getPeriodAfter(o);null!==n&&function(t){if(null!==c){if(c.period.id===t.id)return;l.Z.warn("Stream: Creating next `PeriodStream` while one was already created.",e,t.id,c.period.id),s.periodStreamCleared({type:e,period:c.period}),c.canceller.cancel()}var n=new w.ZP;n.linkToSignal(u),c={canceller:n,period:t},A(e,t,s,c.canceller.signal)}(n)}else null!==c&&(l.Z.info("Stream: Destroying next PeriodStream due to current one being active",e,c.period.start),s.periodStreamCleared({type:e,period:c.period}),c.canceller.cancel(),c=null);s.streamStatusUpdate(t)},error:function(e){null!==c&&(c.canceller.cancel(),c=null),f.cancel(),s.error(e)}});Et(v,p,f.signal)}},Rt=Zt,xt=n(379);function Mt(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Ct(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ct(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Ct(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);na.getMaximumAvailablePosition()){var u=new v.Z("MEDIA_TIME_AFTER_MANIFEST","The current position is after the latest time announced in the Manifest.");i.trigger("warning",u)}}),{includeLastObservation:!0,clearSignal:o}),t.addEventListener("manifestUpdate",(function(){i.trigger("durationUpdate",i._getManifestDuration()),o.isCancelled()||i._checkEndOfStream()}),o),i}(0,t.Z)(n,e);var r=n.prototype;return r.getCurrentDuration=function(){return this._getManifestDuration()},r.onAdaptationChange=function(e,t,n){if(this._manifest.isLastPeriodKnown){var r=this._manifest.periods[this._manifest.periods.length-1];if(t.id===(null==r?void 0:r.id)&&("audio"===e||"video"===e)){"audio"===e?this._maximumPositionCalculator.updateLastAudioAdaptation(n):this._maximumPositionCalculator.updateLastVideoAdaptation(n);var i=this._maximumPositionCalculator.getEndingPosition(),a=void 0!==i?{isEnd:!0,duration:i}:{isEnd:!1,duration:this._maximumPositionCalculator.getMaximumAvailablePosition()};this.trigger("durationUpdate",a)}}this._canceller.isUsed()||null===n&&this._addActivelyLoadedPeriod(t,e)},r.onRepresentationChange=function(e,t){this._addActivelyLoadedPeriod(t,e)},r.onPeriodCleared=function(e,t){this._removeActivelyLoadedPeriod(t,e)},r.onLastSegmentFinishedLoading=function(e){var t=this._lazilyCreateActiveStreamInfo(e);t.hasFinishedLoadingLastPeriod||(t.hasFinishedLoadingLastPeriod=!0,this._checkEndOfStream())},r.onLastSegmentLoadingResume=function(e){var t=this._lazilyCreateActiveStreamInfo(e);t.hasFinishedLoadingLastPeriod&&(t.hasFinishedLoadingLastPeriod=!1,this._checkEndOfStream())},r.dispose=function(){this.removeEventListener(),this._canceller.cancel()},r._addActivelyLoadedPeriod=function(e,t){var n=this._lazilyCreateActiveStreamInfo(t);n.activePeriods.has(e)||(n.activePeriods.add(e),this._checkCurrentPeriod())},r._removeActivelyLoadedPeriod=function(e,t){var n=this._activeStreams.get(t);void 0!==n&&n.activePeriods.has(e)&&(n.activePeriods.removeElement(e),this._checkCurrentPeriod())},r._checkCurrentPeriod=function(){var e=this;if(0!==this._allBufferTypes.length){var t=this._activeStreams.get(this._allBufferTypes[0]);if(void 0!==t)for(var n,r=function(){for(var t=n.value,r=!0,i=1;i=0;a--){var o=i[a];try{"open"===r&&(l.Z.info("Init: Removing SourceBuffer from mediaSource"),o.abort()),t.removeSourceBuffer(o)}catch(e){l.Z.warn("Init: Error while disposing SourceBuffer",e instanceof Error?e:"")}}i.length>0&&l.Z.warn("Init: Not all SourceBuffers could have been removed.")}if((0,Lt.Z)(e),null!==n)try{l.Z.debug("Init: Revoking previous URL"),URL.revokeObjectURL(n)}catch(e){l.Z.warn("Init: Error while revoking the media source URL",e instanceof Error?e:"")}}function Vt(e,t){return(0,O.Z)(t,(function(n){var r=function(e,t){if(null==Ut.J)throw new v.Z("MEDIA_SOURCE_NOT_SUPPORTED","No MediaSource Object was found in the current browser.");var n=(0,Bt.Z)(e.src)?e.src:null;Ft(e,null,n),l.Z.info("Init: Creating MediaSource");var r=new Ut.J,i=URL.createObjectURL(r);return l.Z.info("Init: Attaching MediaSource URL to the media element",i),e.src=i,t.register((function(){Ft(e,r,i)})),r}(e,t);i.u_(r,(function(){n(r)}),t)}))}function zt(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Kt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Kt(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Kt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0?r:Math.max(i,r+u)}if(!(0,S.Z)(n.percentage)){l.Z.debug("Init: using startAt.percentage");var d=n.percentage;return d>100?r:d<0?i:i+(r-i)*(+d/100)}}var f=e.getMinimumSafePosition();if(e.isLive){var v,p=e.suggestedPresentationDelay,h=e.clockOffset,m=e.getMaximumSafePosition(),g=c.Z.getCurrent().DEFAULT_LIVE_GAP;if(void 0===h)l.Z.info("Init: no clock offset found for a live content, starting close to maximum available position"),v=m;else{l.Z.info("Init: clock offset found for a live content, checking if we can start close to it");var y=void 0===e.availabilityStartTime?0:e.availabilityStartTime,_=(performance.now()+h)/1e3-y;v=Math.min(m,_)}var b=void 0!==p?p:t?g.LOW_LATENCY:g.DEFAULT;return l.Z.debug("Init: "+v+" defined as the live time, applying a live gap of "+b),Math.max(v-b,f)}return l.Z.info("Init: starting at the minimum available position:",f),f}var Yt=n(1757),Xt=n(8833),Qt=n(8799);var $t=31536e3,Jt=function(){function e(e){this._mediaSource=e,this._currentMediaSourceDurationUpdateCanceller=null}var t=e.prototype;return t.updateDuration=function(e,t){null!==this._currentMediaSourceDurationUpdateCanceller&&this._currentMediaSourceDurationUpdateCanceller.cancel(),this._currentMediaSourceDurationUpdateCanceller=new w.ZP;var n=this._mediaSource,r=this._currentMediaSourceDurationUpdateCanceller.signal,a=function(e,t){var n=(0,k.ZP)("open"===e.readyState,t);return(0,i.u_)(e,(function(){n.setValueIfChanged(!0)}),t),(0,i.N8)(e,(function(){n.setValueIfChanged(!1)}),t),(0,i.k6)(e,(function(){n.setValueIfChanged(!1)}),t),n}(n,r),o=new w.ZP;o.linkToSignal(r),a.onUpdate((function(){if(o.cancel(),!a.getValue())return;(o=new w.ZP).linkToSignal(r);var i=function(e,t){if(0===e.length){var n=(0,k.ZP)(!1);return n.finish(),n}var r=(0,k.ZP)(!1,t);o();for(var i=function(){var n=e[a];n.addEventListener("updatestart",o),n.addEventListener("update",o),t.register((function(){n.removeEventListener("updatestart",o),n.removeEventListener("update",o)}))},a=0;a0&&(i=Math.max(o.buffered.end(s-1)))}if(r===e.duration)return"success";if(i>r){if(i=.1?c=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function un(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);nl||void 0!==h&&l>=h)&&(ln(v)&&c.push(v.publicEvent),o.delete(v)):p<=l&&void 0!==h&&l=(null!=h?h:p)&&(u?d.push({type:"stream-event-skip",value:v.publicEvent}):(d.push({type:"stream-event",value:v.publicEvent}),ln(v)&&c.push(v.publicEvent)))}if(d.length>0)for(var m,g=sn(d);!(m=g()).done;){var y=m.value;if("stream-event"===y.type?r(y.value):i(y.value),a.isCancelled())return}if(c.length>0)for(var _,b=sn(c);!(_=b()).done;){var S=_.value;if("function"==typeof S.onExit&&S.onExit(),a.isCancelled())return}}(s.getValue(),d,e,l.signal),d=e}function h(){var e=n.getReference().getValue().seeking;return{currentTime:t.currentTime,isSeeking:e}}}),{emitCurrentValue:!0,clearSignal:a})},cn=n(4576);function fn(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return vn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return vn(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function vn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);nd.end&&(n=d.end-1)}}else n=s;return{maximumPosition:e.getMaximumSafePosition(),position:{last:u.position,pending:n},duration:u.duration,paused:{last:u.paused,pending:i.getValue()||!r===u.paused?void 0:!r},readyState:u.readyState,speed:l}}function d(){u.setValue(l())}}))}(u,f,{autoPlay:a,initialPlayPerformed:E,initialSeekPerformed:w,speed:g,startTime:s}),I=this._createRebufferingController(f,u,g,n),Z=this._createContentTimeBoundariesObserver(u,d,A,b,n);T.then((function(){(0,Yt.Z)(f,l,!1,n).onUpdate((function(e,t){e&&(t(),i.trigger("loaded",{segmentBuffersStore:b}))}),{emitCurrentValue:!0,clearSignal:n})})).catch((function(e){n.isCancelled()||i._onFatalError(e)}));var R=this;Rt({manifest:u,initialPeriod:y},A,h,b,m,o,{needsBufferFlush:function(){var e=l.currentTime+.001;f.setCurrentTime(e),f.listen((function(t,n){(null!==t.currentRange||t.position>e+.1)&&(n(),f.setCurrentTime(t.position+.001))}),{includeLastObservation:!1,clearSignal:n})},streamStatusUpdate:function(e){var t=e.period,r=e.bufferType,i=e.imminentDiscontinuity,a=e.position;I.updateDiscontinuityInfo({period:t,bufferType:r,discontinuity:i,position:a}),n.isCancelled()||u.isLastPeriodKnown&&e.period.id===u.periods[u.periods.length-1].id&&(e.hasFinishedLoading||e.isEmptyStream?Z.onLastSegmentFinishedLoading(e.bufferType):Z.onLastSegmentLoadingResume(e.bufferType))},needsManifestRefresh:function(){return R._manifestFetcher.scheduleManualRefresh({enablePartialRefresh:!0,canUseUnsafeMode:!0})},manifestMightBeOufOfSync:function(){var e=c.Z.getCurrent().OUT_OF_SYNC_MANIFEST_REFRESH_DELAY;R._manifestFetcher.scheduleManualRefresh({enablePartialRefresh:!1,canUseUnsafeMode:!1,delay:e})},lockedStream:function(e){return I.onLockedStream(e.bufferType,e.period)},adaptationChange:function(e){R.trigger("adaptationChange",e),n.isCancelled()||Z.onAdaptationChange(e.type,e.period,e.adaptation)},representationChange:function(e){R.trigger("representationChange",e),n.isCancelled()||Z.onRepresentationChange(e.type,e.period)},inbandEvent:function(e){return R.trigger("inbandEvents",e)},warning:function(e){return R.trigger("warning",e)},periodStreamReady:function(e){return R.trigger("periodStreamReady",e)},periodStreamCleared:function(e){Z.onPeriodCleared(e.type,e.period),n.isCancelled()||R.trigger("periodStreamCleared",e)},bitrateEstimationChange:function(e){return R.trigger("bitrateEstimationChange",e)},addedSegment:function(e){return R.trigger("addedSegment",e)},needsMediaSourceReload:function(e){return t(e)},needsDecipherabilityFlush:function(e){var n,r=D(l);void 0===(n=null==r?void 0:r[0])||n.indexOf("widevine")<0?t(e):e.position+.001=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function gn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&(i="internal-seeking",r=t._internalSeeksIncoming.shift());var a=null!=e?e:t._generateInitialObservation(),o=Sn(t._mediaElement,i,t._withMediaSource),s=null;o.seeking&&("number"==typeof r?s=r:null!==a.pendingInternalSeek&&"seeking"!==n&&(s=a.pendingInternalSeek));var u=function(e,t,n){var r,i,a=n.withMediaSource,o=n.lowLatencyMode,s=c.Z.getCurrent().REBUFFERING_GAP,u=t.event,l=t.position,d=t.bufferGap,f=t.currentRange,v=t.duration,p=t.paused,h=t.readyState,m=t.ended,g=e.rebuffering,y=e.event,_=e.position,b=function(e,t,n,r,i){var a=c.Z.getCurrent().REBUFFERING_GAP,o=i?"LOW_LATENCY":"DEFAULT";if(void 0===t)return n&&Math.abs(r-e)<=a[o];return null!==t&&r-t.end<=a[o]}(l,f,m,v,o),S=h>=1&&"loadedmetadata"!==u&&null===g&&!(b||m),T=null,E=o?s.LOW_LATENCY:s.DEFAULT;if(a){if(S)d===1/0?(r=!0,T=l):void 0===d?h<3&&(r=!0,T=void 0):d<=E&&(r=!0,T=l+d);else if(null!==g){var k=bn(g,o);!0!==r&&null!==g&&h>1&&(b||m||void 0!==d&&isFinite(d)&&d>k)||void 0===d&&h>=3?i=!0:void 0===d?T=void 0:d===1/0?T=l:d<=k&&(T=l+d)}}else S&&(!p&&"timeupdate"===u&&"timeupdate"===y&&l===_||"seeking"===u&&(d===1/0||void 0===d&&h<3))?r=!0:null!==g&&("seeking"!==u&&l!==_||"canplay"===u||void 0===d&&h>=3||void 0!==d&&d<1/0&&(d>bn(g,o)||b||m))&&(i=!0);if(!0===i)return null;var w;if(!0===r||null!==g)return w="seeking"===u||null!==g&&"seeking"===g.reason||t.seeking?"seeking":1===h?"not-ready":"buffering",null!==g&&g.reason===w?{reason:g.reason,timestamp:g.timestamp,position:T}:{reason:w,timestamp:performance.now(),position:T};return null}(a,o,{lowLatencyMode:t._lowLatencyMode,withMediaSource:t._withMediaSource}),d=function(e,t){var n=c.Z.getCurrent().MINIMUM_BUFFER_AMOUNT_BEFORE_FREEZING;if(e.freezing)return t.ended||t.paused||0===t.readyState||0===t.playbackRate||e.position!==t.position?null:e.freezing;return"timeupdate"===t.event&&void 0!==t.bufferGap&&t.bufferGap>n&&!t.ended&&!t.paused&&t.readyState>=1&&0!==t.playbackRate&&t.position===e.position?{timestamp:performance.now()}:null}(a,o),f=(0,T.Z)({},{rebuffering:u,freezing:d,pendingInternalSeek:s},o);return l.Z.hasLevel("DEBUG")&&l.Z.debug("API: current media element state tick","event",f.event,"position",f.position,"seeking",f.seeking,"internalSeek",f.pendingInternalSeek,"rebuffering",null!==f.rebuffering,"freezing",null!==f.freezing,"ended",f.ended,"paused",f.paused,"playbackRate",f.playbackRate,"readyState",f.readyState),f},s=(0,k.ZP)(o("init"),this._canceller.signal),u=function(t){var n=o(t);l.Z.hasLevel("DEBUG")&&l.Z.debug("API: current playback timeline:\n"+function(e,t){for(var n="",r="",i=0;it){var d=n.length-Math.floor(l.length/2);r=" ".repeat(d)+"^"+t}if(i=3?(r=void 0,i=void 0):i=null!==(r=(0,E.rx)(a,o))?r.end-o:1/0,{bufferGap:i,buffered:a,currentRange:r,position:o,duration:s,ended:u,paused:l,playbackRate:d,readyState:c,seeking:f,event:t}}function Tn(e,t,n){var r=t(e.getReference(),n);return{getCurrentTime:function(){return e.getCurrentTime()},getReadyState:function(){return e.getReadyState()},getPlaybackRate:function(){return e.getPlaybackRate()},getIsPaused:function(){return e.getIsPaused()},getReference:function(){return r},listen:function(e,t){var i;n.isCancelled()||!0===(null===(i=null==t?void 0:t.clearSignal)||void 0===i?void 0:i.isCancelled())||r.onUpdate(e,{clearSignal:null==t?void 0:t.clearSignal,emitCurrentValue:null==t?void 0:t.includeLastObservation})},deriveReadOnlyObserver:function(e){return Tn(this,e,n)}}}var En=n(7829);function kn(e){return e.map((function(e){return null===e?e:{normalized:void 0===e.language?void 0:(0,En.ZP)(e.language),audioDescription:e.audioDescription,codec:e.codec}}))}function wn(e){return e.map((function(e){return null===e?e:{normalized:(0,En.ZP)(e.language),forced:e.forced,closedCaption:e.closedCaption}}))}var An=function(){function e(e){this._periods=new qe((function(e,t){return e.period.start-t.period.start})),this._audioChoiceMemory=new WeakMap,this._textChoiceMemory=new WeakMap,this._videoChoiceMemory=new WeakMap,this._preferredAudioTracks=[],this._preferredTextTracks=[],this._preferredVideoTracks=[],this.trickModeTrackEnabled=e.preferTrickModeTracks}var t=e.prototype;return t.setPreferredAudioTracks=function(e,t){this._preferredAudioTracks=e,t&&this._applyAudioPreferences()},t.setPreferredTextTracks=function(e,t){this._preferredTextTracks=e,t&&this._applyTextPreferences()},t.setPreferredVideoTracks=function(e,t){this._preferredVideoTracks=e,t&&this._applyVideoPreferences()},t.addPeriod=function(e,t,n){var r=Pn(this._periods,t),i=t.getSupportedAdaptations(e);if(void 0!==r){if(void 0!==r[e])return void l.Z.warn("TrackChoiceManager: "+e+" already added for period",t.start);r[e]={adaptations:i,adaptationRef:n}}else{var a;this._periods.add(((a={period:t})[e]={adaptations:i,adaptationRef:n},a))}},t.removePeriod=function(e,t){var n=function(e,t){for(var n=0;n0;)this._periods.pop()},t.update=function(){this._resetChosenAudioTracks(),this._resetChosenTextTracks(),this._resetChosenVideoTracks()},t.setInitialAudioTrack=function(e){var t=Pn(this._periods,e),n=void 0!==t?t.audio:null;if((0,S.Z)(n)||void 0===t)throw new Error("TrackChoiceManager: Given Period not found.");var r=e.getSupportedAdaptations("audio"),i=this._audioChoiceMemory.get(e);if(null===i)n.adaptationRef.setValue(null);else if(void 0!==i&&(0,g.Z)(r,i))n.adaptationRef.setValue(i);else{var a=Zn(r,kn(this._preferredAudioTracks));this._audioChoiceMemory.set(e,a),n.adaptationRef.setValue(a)}},t.setInitialTextTrack=function(e){var t=Pn(this._periods,e),n=void 0!==t?t.text:null;if((0,S.Z)(n)||void 0===t)throw new Error("TrackChoiceManager: Given Period not found.");var r=e.getSupportedAdaptations("text"),i=this._textChoiceMemory.get(e);if(null===i)n.adaptationRef.setValue(null);else if(void 0!==i&&(0,g.Z)(r,i))n.adaptationRef.setValue(i);else{var a=xn(r,wn(this._preferredTextTracks),this._audioChoiceMemory.get(e));this._textChoiceMemory.set(e,a),n.adaptationRef.setValue(a)}},t.setInitialVideoTrack=function(e){var t=Pn(this._periods,e),n=void 0!==t?t.video:null;if((0,S.Z)(n)||void 0===t)throw new Error("TrackChoiceManager: Given Period not found.");var r,i=e.getSupportedAdaptations("video"),a=this._videoChoiceMemory.get(e);if(null===a)r=null;else if(void 0!==a&&(0,g.Z)(i,a.baseAdaptation))r=a.baseAdaptation;else{r=Cn(i,this._preferredVideoTracks)}if(null===r)return this._videoChoiceMemory.set(e,null),void n.adaptationRef.setValue(null);var o=Dn(r,this.trickModeTrackEnabled);this._videoChoiceMemory.set(e,{baseAdaptation:r,adaptation:o}),n.adaptationRef.setValue(o)},t.setAudioTrackByID=function(e,t){var n=Pn(this._periods,e),r=void 0!==n?n.audio:null;if((0,S.Z)(r))throw new Error("TrackChoiceManager: Given Period not found.");var i=(0,z.Z)(r.adaptations,(function(e){return e.id===t}));if(void 0===i)throw new Error("Audio Track not found.");this._audioChoiceMemory.get(e)!==i&&(this._audioChoiceMemory.set(e,i),r.adaptationRef.setValue(i))},t.setTextTrackByID=function(e,t){var n=Pn(this._periods,e),r=void 0!==n?n.text:null;if((0,S.Z)(r))throw new Error("TrackChoiceManager: Given Period not found.");var i=(0,z.Z)(r.adaptations,(function(e){return e.id===t}));if(void 0===i)throw new Error("Text Track not found.");this._textChoiceMemory.get(e)!==i&&(this._textChoiceMemory.set(e,i),r.adaptationRef.setValue(i))},t.setVideoTrackByID=function(e,t){var n=Pn(this._periods,e),r=void 0!==n?n.video:null;if((0,S.Z)(r))throw new Error("LanguageManager: Given Period not found.");var i=(0,z.Z)(r.adaptations,(function(e){return e.id===t}));if(void 0===i)throw new Error("Video Track not found.");var a=Dn(i,this.trickModeTrackEnabled);this._videoChoiceMemory.set(e,{baseAdaptation:i,adaptation:a}),r.adaptationRef.setValue(a)},t.disableTextTrack=function(e){var t=Pn(this._periods,e),n=void 0!==t?t.text:null;if((0,S.Z)(n))throw new Error("TrackChoiceManager: Given Period not found.");null!==this._textChoiceMemory.get(e)&&(this._textChoiceMemory.set(e,null),n.adaptationRef.setValue(null))},t.disableVideoTrack=function(e){var t=Pn(this._periods,e),n=null==t?void 0:t.video;if(void 0===n)throw new Error("TrackManager: Given Period not found.");null!==this._videoChoiceMemory.get(e)&&(this._videoChoiceMemory.set(e,null),n.adaptationRef.setValue(null))},t.disableVideoTrickModeTracks=function(){this.trickModeTrackEnabled=!1,this._resetChosenVideoTracks()},t.enableVideoTrickModeTracks=function(){this.trickModeTrackEnabled=!0,this._resetChosenVideoTracks()},t.isTrickModeEnabled=function(){return this.trickModeTrackEnabled},t.getChosenAudioTrack=function(e){var t=Pn(this._periods,e),n=void 0!==t?t.audio:null;if((0,S.Z)(n))return null;var r=this._audioChoiceMemory.get(e);return(0,S.Z)(r)?null:r.toAudioTrack()},t.getChosenTextTrack=function(e){var t=Pn(this._periods,e),n=void 0!==t?t.text:null;if((0,S.Z)(n))return null;var r=this._textChoiceMemory.get(e);return(0,S.Z)(r)?null:r.toTextTrack()},t.getChosenVideoTrack=function(e){var t=Pn(this._periods,e),n=void 0!==t?t.video:null;if((0,S.Z)(n))return null;var r=this._videoChoiceMemory.get(e);return(0,S.Z)(r)?null:r.adaptation.toVideoTrack()},t.getAvailableAudioTracks=function(e){var t=Pn(this._periods,e),n=void 0!==t?t.audio:null;if((0,S.Z)(n))return[];var r=this._audioChoiceMemory.get(e),i=(0,S.Z)(r)?null:r.id;return n.adaptations.map((function(e){var t=null!==i&&i===e.id;return(0,T.Z)(e.toAudioTrack(),{active:t})}))},t.getAvailableTextTracks=function(e){var t=Pn(this._periods,e),n=void 0!==t?t.text:null;if((0,S.Z)(n))return[];var r=this._textChoiceMemory.get(e),i=(0,S.Z)(r)?null:r.id;return n.adaptations.map((function(e){var t=null!==i&&i===e.id;return(0,T.Z)(e.toTextTrack(),{active:t})}))},t.getAvailableVideoTracks=function(e){var t,n=Pn(this._periods,e),r=void 0!==n?n.video:null;if((0,S.Z)(r))return[];var i=this._videoChoiceMemory.get(e),a=void 0===i?void 0:null!==(t=null==i?void 0:i.adaptation.id)&&void 0!==t?t:void 0;return r.adaptations.map((function(e){var t=null!==a&&a===e.id,n=e.toVideoTrack(),r=void 0!==n.trickModeTracks?n.trickModeTracks.map((function(e){var t=null!==a&&a===e.id;return(0,T.Z)(e,{active:t})})):[],i=(0,T.Z)(n,{active:t});return void 0!==r&&(i.trickModeTracks=r),i}))},t._applyAudioPreferences=function(){this._audioChoiceMemory=new WeakMap,this._resetChosenAudioTracks()},t._applyTextPreferences=function(){this._textChoiceMemory=new WeakMap,this._resetChosenTextTracks()},t._applyVideoPreferences=function(){this._videoChoiceMemory=new WeakMap,this._resetChosenVideoTracks()},t._resetChosenAudioTracks=function(){var e=this,t=kn(this._preferredAudioTracks);!function n(r){if(!(r>=e._periods.length())){var i=e._periods.get(r);if((0,S.Z)(i.audio))n(r+1);else{var a=i.period,o=i.audio,s=a.getSupportedAdaptations("audio"),u=e._audioChoiceMemory.get(a);if(null===u||void 0!==u&&(0,g.Z)(s,u))n(r+1);else{var l=Zn(s,t);e._audioChoiceMemory.set(a,l),o.adaptationRef.setValue(l),n(0)}}}}(0)},t._resetChosenTextTracks=function(){var e=this,t=wn(this._preferredTextTracks);!function n(r){if(!(r>=e._periods.length())){var i=e._periods.get(r);if((0,S.Z)(i.text))n(r+1);else{var a=i.period,o=i.text,s=a.getSupportedAdaptations("text"),u=e._textChoiceMemory.get(a);if(null===u||void 0!==u&&(0,g.Z)(s,u))n(r+1);else{var l=xn(s,t,e._audioChoiceMemory.get(a));e._textChoiceMemory.set(a,l),o.adaptationRef.setValue(l),n(0)}}}}(0)},t._resetChosenVideoTracks=function(){var e=this,t=this._preferredVideoTracks;!function n(r){if(!(r>=e._periods.length())){var i=e._periods.get(r);if((0,S.Z)(i.video))n(r+1);else{var a=i.period,o=i.video,s=a.getSupportedAdaptations("video"),u=e._videoChoiceMemory.get(a);if(null!==u){if(void 0!==u&&(0,g.Z)(s,u.baseAdaptation)){var l=Dn(u.baseAdaptation,e.trickModeTrackEnabled);return l.id===u.adaptation.id?void n(r+1):(e._videoChoiceMemory.set(a,{baseAdaptation:u.baseAdaptation,adaptation:l}),o.adaptationRef.setValue(l),n(0))}var d=Cn(s,t);if(null===d)return e._videoChoiceMemory.set(a,null),o.adaptationRef.setValue(null),n(0);var c=Dn(d,e.trickModeTrackEnabled);return e._videoChoiceMemory.set(a,{baseAdaptation:d,adaptation:c}),o.adaptationRef.setValue(c),n(0)}n(r+1)}}}(0)},e}();function In(e){return function(t){var n;if(void 0!==e.normalized&&(null!==(n=t.normalizedLanguage)&&void 0!==n?n:"")!==e.normalized)return!1;if(void 0!==e.audioDescription)if(e.audioDescription){if(!0!==t.isAudioDescription)return!1}else if(!0===t.isAudioDescription)return!1;if(void 0===e.codec)return!0;var r=e.codec.test,i=function(e){return void 0!==e.codec&&r.test(e.codec)};return e.codec.all?t.representations.every(i):t.representations.some(i)}}function Zn(e,t){if(0===e.length)return null;for(var n=0;n0){if(null!=n){var l=(0,z.Z)(u,(function(e){return e.normalizedLanguage===n.normalizedLanguage}));if(void 0!==l)return l}return null!==(r=(0,z.Z)(u,(function(e){return void 0===e.normalizedLanguage})))&&void 0!==r?r:null}return null}function Mn(e){return function(t){if(void 0!==e.signInterpreted&&e.signInterpreted!==t.isSignInterpreted)return!1;if(void 0===e.codec)return!0;var n=e.codec.test,r=function(e){return void 0!==e.codec&&n.test(e.codec)};return e.codec.all?t.representations.every(r):t.representations.some(r)}}function Cn(e,t){if(0===e.length)return null;for(var n=0;n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Un(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);ng)throw new Error('Invalid maxVideoBitrate parameter. Its value, "'+g+'", is inferior to the set minVideoBitrate, "'+h+'"')}if((0,S.Z)(e.maxAudioBitrate))m=E.audio;else{if(m=Number(e.maxAudioBitrate),isNaN(m))throw new Error("Invalid maxAudioBitrate parameter. Should be a number.");if(p>m)throw new Error('Invalid maxAudioBitrate parameter. Its value, "'+m+'", is inferior to the set minAudioBitrate, "'+p+'"')}return{maxBufferAhead:t,maxBufferBehind:n,limitVideoWidth:C,videoElement:d,wantedBufferAhead:r,maxVideoBufferSize:i,throttleWhenHidden:a,throttleVideoBitrateWhenHidden:o,preferredAudioTracks:s,preferredTextTracks:u,preferredVideoTracks:l,initialAudioBitrate:v,initialVideoBitrate:f,minAudioBitrate:p,minVideoBitrate:h,maxAudioBitrate:m,maxVideoBitrate:g,stopAtEnd:(0,S.Z)(e.stopAtEnd)?Z:!!e.stopAtEnd}}(e),o=a.initialAudioBitrate,s=a.initialVideoBitrate,u=a.limitVideoWidth,d=a.minAudioBitrate,f=a.minVideoBitrate,v=a.maxAudioBitrate,p=a.maxBufferAhead,h=a.maxBufferBehind,m=a.maxVideoBitrate,g=a.preferredAudioTracks,y=a.preferredTextTracks,_=a.preferredVideoTracks,b=a.throttleWhenHidden,T=a.throttleVideoBitrateWhenHidden,E=a.videoElement,I=a.wantedBufferAhead,Z=a.maxVideoBufferSize,R=a.stopAtEnd,x=c.Z.getCurrent().DEFAULT_UNMUTED_VOLUME;E.preload="auto",t.version="3.31.0",t.log=l.Z,t.state="STOPPED",t.videoElement=E;var M=new w.ZP;t._destroyCanceller=M,t._priv_pictureInPictureRef=Vn(E,M.signal),Gn(E,(function(){t.trigger("fullscreenChange",t.isFullscreen())}),M.signal);for(var C=[],P=0;P<(null===(r=E.textTracks)||void 0===r?void 0:r.length);P++){var D=null===(i=E.textTracks)||void 0===i?void 0:i[P];(0,S.Z)(D)||C.push(D)}var N=function(e){for(var n=e.target,r=[],i=0;i0?e.textTracks[0]:null},i.getPlayerState=function(){return this.state},i.isContentLoaded=function(){return!(0,g.Z)(["LOADING","RELOADING","STOPPED"],this.state)},i.isBuffering=function(){return(0,g.Z)(["BUFFERING","SEEKING","LOADING","RELOADING"],this.state)},i.isPaused=function(){return!this.videoElement||((0,g.Z)(["LOADING","RELOADING"],this.state)?!this._priv_lastAutoPlay:this.videoElement.paused)},i.isLive=function(){if(null===this._priv_contentInfos)return!1;var e=this._priv_contentInfos,t=e.isDirectFile,n=e.manifest;return!t&&null!==n&&n.isLive},i.areTrickModeTracksEnabled=function(){return this._priv_preferTrickModeTracks},i.getUrl=function(){if(null!==this._priv_contentInfos){var e=this._priv_contentInfos,t=e.isDirectFile,n=e.manifest,r=e.originalUrl;return t?r:null!==n?n.getUrl():void 0}},i.updateContentUrls=function(e,t){if(null===this._priv_contentInfos)throw new Error("No content loaded");var n=!0===(null==t?void 0:t.refresh);this._priv_contentInfos.initializer.updateContentUrls(e,n)},i.getVideoDuration=function(){if(null===this.videoElement)throw new Error("Disposed player");return this.videoElement.duration},i.getVideoBufferGap=function(){if(null===this.videoElement)throw new Error("Disposed player");var e=this.videoElement;return(0,E.L7)(e.buffered,e.currentTime)},i.getVideoLoadedTime=function(){if((0,A.Z)("`getVideoLoadedTime` is deprecated and won't be present in the next major version"),null===this.videoElement)throw new Error("Disposed player");var e=this.videoElement;return(0,E.at)(e.buffered,e.currentTime)},i.getVideoPlayedTime=function(){if((0,A.Z)("`getVideoPlayedTime` is deprecated and won't be present in the next major version"),null===this.videoElement)throw new Error("Disposed player");var e=this.videoElement;return(0,E.DD)(e.buffered,e.currentTime)},i.getWallClockTime=function(){if(null===this.videoElement)throw new Error("Disposed player");if(null===this._priv_contentInfos)return this.videoElement.currentTime;var e=this._priv_contentInfos,t=e.isDirectFile,n=e.manifest;if(t){var r=a(this.videoElement);return(null!=r?r:0)+this.videoElement.currentTime}return null!==n?this.videoElement.currentTime+(void 0!==n.availabilityStartTime?n.availabilityStartTime:0):0},i.getPosition=function(){if(null===this.videoElement)throw new Error("Disposed player");return this.videoElement.currentTime},i.getLastStoredContentPosition=function(){return this._priv_reloadingMetadata.reloadPosition},i.getPlaybackRate=function(){return this._priv_speed.getValue()},i.setPlaybackRate=function(e,t){var n;e!==this._priv_speed.getValue()&&this._priv_speed.setValue(e);var r=null==t?void 0:t.preferTrickModeTracks;if("boolean"==typeof r){this._priv_preferTrickModeTracks=r;var i=null===(n=this._priv_contentInfos)||void 0===n?void 0:n.trackChoiceManager;(0,S.Z)(i)||(r&&!i.isTrickModeEnabled()?i.enableVideoTrickModeTracks():!r&&i.isTrickModeEnabled()&&i.disableVideoTrickModeTracks())}},i.getAvailableVideoBitrates=function(){if(null===this._priv_contentInfos)return[];var e=this._priv_contentInfos,t=e.currentPeriod,n=e.activeAdaptations;if(null===t||null===n)return[];var r=n[t.id];return void 0===r||(0,S.Z)(r.video)?[]:r.video.getAvailableBitrates()},i.getAvailableAudioBitrates=function(){if(null===this._priv_contentInfos)return[];var e=this._priv_contentInfos,t=e.currentPeriod,n=e.activeAdaptations;if(null===t||null===n)return[];var r=n[t.id];return void 0===r||(0,S.Z)(r.audio)?[]:r.audio.getAvailableBitrates()},i.getManualAudioBitrate=function(){return this._priv_bitrateInfos.manualBitrates.audio.getValue()},i.getManualVideoBitrate=function(){return this._priv_bitrateInfos.manualBitrates.video.getValue()},i.getVideoBitrate=function(){var e=this._priv_getCurrentRepresentations();if(null!==e&&!(0,S.Z)(e.video))return e.video.bitrate},i.getAudioBitrate=function(){var e=this._priv_getCurrentRepresentations();if(null!==e&&!(0,S.Z)(e.audio))return e.audio.bitrate},i.getMinVideoBitrate=function(){return this._priv_bitrateInfos.minAutoBitrates.video.getValue()},i.getMinAudioBitrate=function(){return this._priv_bitrateInfos.minAutoBitrates.audio.getValue()},i.getMaxVideoBitrate=function(){return this._priv_bitrateInfos.maxAutoBitrates.video.getValue()},i.getMaxAudioBitrate=function(){return this._priv_bitrateInfos.maxAutoBitrates.audio.getValue()},i.play=function(){var e=this;if(null===this.videoElement)throw new Error("Disposed player");var t=this.videoElement.play();return(0,S.Z)(t)||"function"!=typeof t.catch?Promise.resolve():t.catch((function(t){if("NotAllowedError"===t.name){var n=new v.Z("MEDIA_ERR_PLAY_NOT_ALLOWED",t.toString());e.trigger("warning",n)}throw t}))},i.pause=function(){if(null===this.videoElement)throw new Error("Disposed player");this.videoElement.pause()},i.seekTo=function(e){var t;if(null===this.videoElement)throw new Error("Disposed player");if(null===this._priv_contentInfos)throw new Error("player: no content loaded");var n,r=this._priv_contentInfos,i=r.isDirectFile,o=r.manifest;if(!i&&null===o)throw new Error("player: the content did not load yet");if("number"==typeof e)n=e;else if("object"==typeof e){var s=e,u=this.videoElement.currentTime;if((0,S.Z)(s.relative))if((0,S.Z)(s.position)){if((0,S.Z)(s.wallClockTime))throw new Error('invalid time object. You must set one of the following properties: "relative", "position" or "wallClockTime"');if(null!==o)n=s.wallClockTime-(null!==(t=o.availabilityStartTime)&&void 0!==t?t:0);else if(i&&null!==this.videoElement){var d=a(this.videoElement);void 0!==d&&(n=s.wallClockTime-d)}void 0===n&&(n=s.wallClockTime)}else n=s.position;else n=u+s.relative}if(void 0===n)throw new Error("invalid time given");return l.Z.info("API: API Seek to",n),this.videoElement.currentTime=n,n},i.isFullscreen=function(){return(0,A.Z)("isFullscreen is deprecated. Fullscreen management should now be managed by the application"),s()},i.setFullscreen=function(e){if(void 0===e&&(e=!0),(0,A.Z)("setFullscreen is deprecated. Fullscreen management should now be managed by the application"),null===this.videoElement)throw new Error("Disposed player");e?function(e){if(!s()){var t=e;"function"==typeof t.requestFullscreen?t.requestFullscreen():"function"==typeof t.msRequestFullscreen?t.msRequestFullscreen():"function"==typeof t.mozRequestFullScreen?t.mozRequestFullScreen():"function"==typeof t.webkitRequestFullscreen&&t.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT)}}(this.videoElement):o()},i.exitFullscreen=function(){(0,A.Z)("exitFullscreen is deprecated. Fullscreen management should now be managed by the application"),o()},i.getVolume=function(){if(null===this.videoElement)throw new Error("Disposed player");return this.videoElement.volume},i.setVolume=function(e){if(null===this.videoElement)throw new Error("Disposed player");var t=this.videoElement;e!==t.volume&&(t.volume=e,this.trigger("volumeChange",e))},i.isMute=function(){return 0===this.getVolume()},i.mute=function(){this._priv_mutedMemory=this.getVolume(),this.setVolume(0)},i.unMute=function(){var e=c.Z.getCurrent().DEFAULT_UNMUTED_VOLUME;0===this.getVolume()&&this.setVolume(0===this._priv_mutedMemory?e:this._priv_mutedMemory)},i.setVideoBitrate=function(e){this._priv_bitrateInfos.manualBitrates.video.setValue(e)},i.setAudioBitrate=function(e){this._priv_bitrateInfos.manualBitrates.audio.setValue(e)},i.setMinVideoBitrate=function(e){var t=this._priv_bitrateInfos.maxAutoBitrates.video.getValue();if(e>t)throw new Error('Invalid minimum video bitrate given. Its value, "'+e+'" is superior the current maximum video birate, "'+t+'".');this._priv_bitrateInfos.minAutoBitrates.video.setValue(e)},i.setMinAudioBitrate=function(e){var t=this._priv_bitrateInfos.maxAutoBitrates.audio.getValue();if(e>t)throw new Error('Invalid minimum audio bitrate given. Its value, "'+e+'" is superior the current maximum audio birate, "'+t+'".');this._priv_bitrateInfos.minAutoBitrates.audio.setValue(e)},i.setMaxVideoBitrate=function(e){var t=this._priv_bitrateInfos.minAutoBitrates.video.getValue();if(e0||c.result.removedAdaptations.length>0)){var f=u.getAvailableAudioTracks(s);r._priv_triggerEventIfNotStopped("availableAudioTracksChange",null!=f?f:[],i);var v=u.getAvailableTextTracks(s);r._priv_triggerEventIfNotStopped("availableTextTracksChange",null!=v?v:[],i);var p=u.getAvailableVideoTracks(s);r._priv_triggerEventIfNotStopped("availableVideoTracksChange",null!=p?p:[],i)}return}}),e.currentContentCanceller.signal)}},i._priv_onActivePeriodChanged=function(e,t){var n,r,i,a,o,s,u,l,d=t.period;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){e.currentPeriod=d;var c=e.currentContentCanceller.signal;this._priv_contentEventsMemory.periodChange!==d&&(this._priv_contentEventsMemory.periodChange=d,this._priv_triggerEventIfNotStopped("periodChange",d,c)),this._priv_triggerEventIfNotStopped("availableAudioTracksChange",this.getAvailableAudioTracks(),c),this._priv_triggerEventIfNotStopped("availableTextTracksChange",this.getAvailableTextTracks(),c),this._priv_triggerEventIfNotStopped("availableVideoTracksChange",this.getAvailableVideoTracks(),c);var f=null===(r=this._priv_contentInfos)||void 0===r?void 0:r.trackChoiceManager;if((0,S.Z)(f))this._priv_triggerEventIfNotStopped("audioTrackChange",null,c),this._priv_triggerEventIfNotStopped("textTrackChange",null,c),this._priv_triggerEventIfNotStopped("videoTrackChange",null,c);else{var v=f.getChosenAudioTrack(d);this._priv_triggerEventIfNotStopped("audioTrackChange",v,c);var p=f.getChosenTextTrack(d);this._priv_triggerEventIfNotStopped("textTrackChange",p,c);var h=f.getChosenVideoTrack(d);this._priv_triggerEventIfNotStopped("videoTrackChange",h,c)}if(this._priv_triggerAvailableBitratesChangeEvent("availableAudioBitratesChange",this.getAvailableAudioBitrates(),c),!e.currentContentCanceller.isUsed()&&(this._priv_triggerAvailableBitratesChangeEvent("availableVideoBitratesChange",this.getAvailableVideoBitrates(),c),!e.currentContentCanceller.isUsed())){var m=null!==(o=null===(a=null===(i=this._priv_getCurrentRepresentations())||void 0===i?void 0:i.audio)||void 0===a?void 0:a.bitrate)&&void 0!==o?o:-1;if(this._priv_triggerCurrentBitrateChangeEvent("audioBitrateChange",m,c),!e.currentContentCanceller.isUsed()){var g=null!==(l=null===(u=null===(s=this._priv_getCurrentRepresentations())||void 0===s?void 0:s.video)||void 0===u?void 0:u.bitrate)&&void 0!==l?l:-1;this._priv_triggerCurrentBitrateChangeEvent("videoBitrateChange",g,c)}}}},i._priv_onPeriodStreamReady=function(e,t){var n;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){var r=t.type,i=t.period,a=t.adaptationRef,o=e.trackChoiceManager;switch(r){case"video":(0,S.Z)(o)?(l.Z.error("API: TrackChoiceManager not instanciated for a new video period"),a.setValue(null)):(o.addPeriod(r,i,a),o.setInitialVideoTrack(i));break;case"audio":(0,S.Z)(o)?(l.Z.error("API: TrackChoiceManager not instanciated for a new "+r+" period"),a.setValue(null)):(o.addPeriod(r,i,a),o.setInitialAudioTrack(i));break;case"text":(0,S.Z)(o)?(l.Z.error("API: TrackChoiceManager not instanciated for a new "+r+" period"),a.setValue(null)):(o.addPeriod(r,i,a),o.setInitialTextTrack(i));break;default:var s=i.adaptations[r];!(0,S.Z)(s)&&s.length>0?a.setValue(s[0]):a.setValue(null)}}},i._priv_onPeriodStreamCleared=function(e,t){var n;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){var r=t.type,i=t.period,a=e.trackChoiceManager;switch(r){case"audio":case"text":case"video":(0,S.Z)(a)||a.removePeriod(r,i)}var o=e.activeAdaptations,s=e.activeRepresentations;if(!(0,S.Z)(o)&&!(0,S.Z)(o[i.id])){var u=o[i.id];delete u[r],0===Object.keys(u).length&&delete o[i.id]}if(!(0,S.Z)(s)&&!(0,S.Z)(s[i.id])){var l=s[i.id];delete l[r],0===Object.keys(l).length&&delete s[i.id]}}},i._priv_onAdaptationChange=function(e,t){var n,r=t.type,i=t.adaptation,a=t.period;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){null===e.activeAdaptations&&(e.activeAdaptations={});var o,s=e.activeAdaptations,u=e.currentPeriod,l=s[a.id];if((0,S.Z)(l))s[a.id]=((o={})[r]=i,o);else l[r]=i;var d=e.trackChoiceManager,c=e.currentContentCanceller.signal;if(null!==d&&null!==u&&!(0,S.Z)(a)&&a.id===u.id)switch(r){case"audio":var f=d.getChosenAudioTrack(u);this._priv_triggerEventIfNotStopped("audioTrackChange",f,c);var v=this.getAvailableAudioBitrates();this._priv_triggerAvailableBitratesChangeEvent("availableAudioBitratesChange",v,c);break;case"text":var p=d.getChosenTextTrack(u);this._priv_triggerEventIfNotStopped("textTrackChange",p,c);break;case"video":var h=d.getChosenVideoTrack(u);this._priv_triggerEventIfNotStopped("videoTrackChange",h,c);var m=this.getAvailableVideoBitrates();this._priv_triggerAvailableBitratesChangeEvent("availableVideoBitratesChange",m,c)}}},i._priv_onRepresentationChange=function(e,t){var n,r,i=t.type,a=t.period,o=t.representation;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){null===e.activeRepresentations&&(e.activeRepresentations={});var s,u=e.activeRepresentations,l=e.currentPeriod,d=u[a.id];if((0,S.Z)(d))u[a.id]=((s={})[i]=o,s);else d[i]=o;var c=null!==(r=null==o?void 0:o.bitrate)&&void 0!==r?r:-1;if(!(0,S.Z)(a)&&null!==l&&l.id===a.id){var f=this._priv_contentInfos.currentContentCanceller.signal;"video"===i?this._priv_triggerCurrentBitrateChangeEvent("videoBitrateChange",c,f):"audio"===i&&this._priv_triggerCurrentBitrateChangeEvent("audioBitrateChange",c,f)}}},i._priv_onBitrateEstimationChange=function(e){var t=e.type,n=e.bitrate;void 0!==n&&(this._priv_bitrateInfos.lastBitrates[t]=n),this.trigger("bitrateEstimationChange",{type:t,bitrate:n})},i._priv_onNativeTextTracksNext=function(e){this.trigger("nativeTextTracksChange",e)},i._priv_setPlayerState=function(e){this.state!==e&&(this.state=e,l.Z.info("API: playerStateChange event",e),this.trigger("playerStateChange",e))},i._priv_triggerPositionUpdate=function(e,t){var n,r;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){var i=e.isDirectFile,o=e.manifest;if((i||null!==o)&&!(0,S.Z)(t)){var s=null!==o?o.getMaximumSafePosition():void 0,u={position:t.position,duration:t.duration,playbackRate:t.playbackRate,maximumBufferTime:s,bufferGap:void 0!==t.bufferGap&&isFinite(t.bufferGap)?t.bufferGap:0};if(null!==o&&o.isLive&&t.position>0){var l=null!==(r=o.availabilityStartTime)&&void 0!==r?r:0;u.wallClockTime=t.position+l;var d=o.getLivePosition();void 0!==d&&(u.liveGap=d-t.position)}else if(i&&null!==this.videoElement){var c=a(this.videoElement);void 0!==c&&(u.wallClockTime=c+t.position)}this.trigger("positionUpdate",u)}}},i._priv_triggerAvailableBitratesChangeEvent=function(e,t,n){var r=this._priv_contentEventsMemory[e];n.isCancelled()||void 0!==r&&(0,m.Z)(t,r)||(this._priv_contentEventsMemory[e]=t,this.trigger(e,t))},i._priv_triggerCurrentBitrateChangeEvent=function(e,t,n){n.isCancelled()||t===this._priv_contentEventsMemory[e]||(this._priv_contentEventsMemory[e]=t,this.trigger(e,t))},i._priv_getCurrentRepresentations=function(){if(null===this._priv_contentInfos)return null;var e=this._priv_contentInfos,t=e.currentPeriod,n=e.activeRepresentations;return null===t||null===n||(0,S.Z)(n[t.id])?null:n[t.id]},i._priv_triggerEventIfNotStopped=function(e,t,n){n.isCancelled()||this.trigger(e,t)},i._priv_initializeMediaElementTrackChoiceManager=function(e,t,n){var r,i,a,o=this;(0,y.Z)(null!==h.Z.directfile,"Initializing `MediaElementTrackChoiceManager` without Directfile feature"),(0,y.Z)(null!==this.videoElement,"Initializing `MediaElementTrackChoiceManager` on a disposed RxPlayer");var s=new h.Z.directfile.mediaElementTrackChoiceManager(this.videoElement),u=void 0===e?this._priv_preferredAudioTracks:[e];s.setPreferredAudioTracks(u,!0);var l=void 0===t?this._priv_preferredTextTracks:[t];return s.setPreferredTextTracks(l,!0),s.setPreferredVideoTracks(this._priv_preferredVideoTracks,!0),this._priv_triggerEventIfNotStopped("availableAudioTracksChange",s.getAvailableAudioTracks(),n),this._priv_triggerEventIfNotStopped("availableVideoTracksChange",s.getAvailableVideoTracks(),n),this._priv_triggerEventIfNotStopped("availableTextTracksChange",s.getAvailableTextTracks(),n),this._priv_triggerEventIfNotStopped("audioTrackChange",null!==(r=s.getChosenAudioTrack())&&void 0!==r?r:null,n),this._priv_triggerEventIfNotStopped("textTrackChange",null!==(i=s.getChosenTextTrack())&&void 0!==i?i:null,n),this._priv_triggerEventIfNotStopped("videoTrackChange",null!==(a=s.getChosenVideoTrack())&&void 0!==a?a:null,n),s.addEventListener("availableVideoTracksChange",(function(e){return o.trigger("availableVideoTracksChange",e)})),s.addEventListener("availableAudioTracksChange",(function(e){return o.trigger("availableAudioTracksChange",e)})),s.addEventListener("availableTextTracksChange",(function(e){return o.trigger("availableTextTracksChange",e)})),s.addEventListener("audioTrackChange",(function(e){return o.trigger("audioTrackChange",e)})),s.addEventListener("videoTrackChange",(function(e){return o.trigger("videoTrackChange",e)})),s.addEventListener("textTrackChange",(function(e){return o.trigger("textTrackChange",e)})),s},(0,e.Z)(r,null,[{key:"ErrorTypes",get:function(){return p.ZB}},{key:"ErrorCodes",get:function(){return p.SM}},{key:"LogLevel",get:function(){return l.Z.getLevel()},set:function(e){l.Z.setLevel(e)}}]),r}(_.Z);jn.version="3.31.0";var qn=jn,Yn=n(7273);!function(){Yn.Z.ContentDecryptor=n(1266).ZP,Yn.Z.imageBuffer=n(7127).Z,Yn.Z.imageParser=n(3203).Z,Yn.Z.transports.smooth=n(2339).Z,Yn.Z.transports.dash=n(85).Z,Yn.Z.dashParsers.js=n(4541).Z,Yn.Z.nativeTextTracksBuffer=n(9059).Z,Yn.Z.nativeTextTracksParsers.vtt=n(9405).Z,Yn.Z.nativeTextTracksParsers.ttml=n(1570).Z,Yn.Z.nativeTextTracksParsers.sami=n(1812).Z,Yn.Z.nativeTextTracksParsers.srt=n(8057).Z,Yn.Z.htmlTextTracksBuffer=n(5192).Z,Yn.Z.htmlTextTracksParsers.sami=n(5734).Z,Yn.Z.htmlTextTracksParsers.ttml=n(7439).Z,Yn.Z.htmlTextTracksParsers.srt=n(8675).Z,Yn.Z.htmlTextTracksParsers.vtt=n(4099).Z;var e=n(9372).Z,t=n(6796).Z;Yn.Z.directfile={initDirectFile:e,mediaElementTrackChoiceManager:t}}(),"boolean"==typeof __RX_PLAYER_DEBUG_MODE__&&__RX_PLAYER_DEBUG_MODE__&&l.Z.setLevel("DEBUG");var Xn=qn}(),r=r.default}()})); \ No newline at end of file +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.RxPlayer=t():e.RxPlayer=t()}(self,(function(){return function(){var e={3774:function(e,t,n){"use strict";n.d(t,{J:function(){return a},c:function(){return o}});var r=n(1946),i=n(2203).Z?void 0:window,a=void 0===i?void 0:(0,r.Z)(i.MediaSource)?(0,r.Z)(i.MozMediaSource)?(0,r.Z)(i.WebKitMediaSource)?i.MSMediaSource:i.WebKitMediaSource:i.MozMediaSource:i.MediaSource,o={HAVE_NOTHING:0,HAVE_METADATA:1,HAVE_CURRENT_DATA:2,HAVE_FUTURE_DATA:3,HAVE_ENOUGH_DATA:4}},3666:function(e,t,n){"use strict";n.d(t,{$u:function(){return p},SB:function(){return c},YM:function(){return u},fq:function(){return s},kD:function(){return o},lV:function(){return m},l_:function(){return h},op:function(){return f},vS:function(){return d},vU:function(){return l},yS:function(){return v}});var r,i,a=n(2203),o=!1,s=!1,u=!1,l=!1,d=!1,c=!1,f=!1,v=!1,p=!1,h=!1,m=!1;a.Z||(void 0!==window.MSInputMethodContext&&void 0!==document.documentMode?(s=!0,u=!0):"Microsoft Internet Explorer"===navigator.appName||"Netscape"===navigator.appName&&/(Trident|Edge)\//.test(navigator.userAgent)?u=!0:-1!==navigator.userAgent.toLowerCase().indexOf("edg/")?o=!0:-1!==navigator.userAgent.toLowerCase().indexOf("firefox")?l=!0:"string"==typeof navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)?c=!0:(Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor")>=0||"[object SafariRemoteNotification]"===(null===(i=null===(r=window.safari)||void 0===r?void 0:r.pushNotification)||void 0===i?void 0:i.toString()))&&(d=!0),/SamsungBrowser/.test(navigator.userAgent)&&(f=!0),-1!==navigator.userAgent.indexOf("PlayStation 5")?m=!0:/Tizen/.test(navigator.userAgent)?v=!0:/[Ww]eb[O0]S/.test(navigator.userAgent)?(p=!0,/[Ww]eb[O0]S.TV-2022/.test(navigator.userAgent)||/[Cc]hr[o0]me\/87/.test(navigator.userAgent)||(/[Ww]eb[O0]S.TV-2021/.test(navigator.userAgent)||/[Cc]hr[o0]me\/79/.test(navigator.userAgent))):/[Pp]anasonic/.test(navigator.userAgent)&&(h=!0))},5767:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(3887),i=n(1946);function a(e){var t=e.textTracks;if(!(0,i.Z)(t)){for(var n=0;n=0;o--)if("track"===a[o].nodeName)try{e.removeChild(a[o])}catch(e){r.Z.warn("Compat: Could not remove text track child from element.")}}e.src="",e.removeAttribute("src")}},3038:function(e,t,n){"use strict";n.d(t,{Dl:function(){return R},M4:function(){return P},N8:function(){return k},O0:function(){return y},Q$:function(){return M},Q4:function(){return S},RV:function(){return I},S1:function(){return f},XR:function(){return p},bQ:function(){return C},it:function(){return g},k6:function(){return E},kJ:function(){return b},kk:function(){return Z},qo:function(){return x},u_:function(){return T},w0:function(){return m},x6:function(){return A},y4:function(){return w},zU:function(){return _}});var r=n(6872),i=n(6923),a=n(1946),o=n(8894),s=n(5095),u=n(2203),l=["","webkit","moz","ms"],d=u.Z||null==window.devicePixelRatio||0===window.devicePixelRatio?1:window.devicePixelRatio;function c(e,t){return t.filter((function(t){return function(e,t){var n=document.createElement(e.tagName),r="on"+t;return r in n||(n.setAttribute(r,"return;"),"function"==typeof n[r])}(e,t)}))[0]}function f(e,t){var n,r=function(e,t){return e.reduce((function(e,n){return e.concat((void 0===t?l:t).map((function(e){return e+n})))}),[])}(e,t);return function(e,t,a){if(!a.isCancelled()){if(e instanceof HTMLElement){if(void 0===n&&(n=c(e,r)),!(0,i.Z)(n))return void 0;e.addEventListener(n,t),a.register((function(){void 0!==n&&e.removeEventListener(n,t)}))}r.forEach((function(n){var r=!1;"function"==typeof e.addEventListener?e.addEventListener(n,t):(r=!0,e["on"+n]=t),a.register((function(){"function"==typeof e.removeEventListener&&e.removeEventListener(n,t),r&&delete e["on"+n]}))}))}}}function v(e){var t,n=document;null!=n.hidden?t="":null!=n.mozHidden?t="moz":null!=n.msHidden?t="ms":null!=n.webkitHidden&&(t="webkit");var r=(0,i.Z)(t)?t+"Hidden":"hidden",a=(0,i.Z)(t)?t+"visibilitychange":"visibilitychange",o=document[r],u=(0,s.ZP)(!o,e);return D(document,a,(function(){var e=!document[r];u.setValueIfChanged(e)}),e),u}function p(e){var t,n=v(e),i=(0,s.ZP)(!0,e);return e.register((function(){clearTimeout(t),t=void 0})),n.onUpdate((function(e){if(clearTimeout(t),t=void 0,!e){var n=r.Z.getCurrent().INACTIVITY_DELAY;t=window.setTimeout((function(){i.setValueIfChanged(!1)}),n)}i.setValueIfChanged(!0)}),{clearSignal:e,emitCurrentValue:!0}),i}function h(e,t){var n=t.width,r=t.height/(e.clientHeight/e.clientWidth);return Math.min(n,r)}function m(e,t){var n=e;if(!0===n.webkitSupportsPresentationMode&&"function"==typeof n.webkitSetPresentationMode){var r="picture-in-picture"===n.webkitPresentationMode,i=(0,s.ZP)({isEnabled:r,pipWindow:null},t);return D(n,"webkitpresentationmodechanged",(function(){var e="picture-in-picture"===n.webkitPresentationMode;i.setValue({isEnabled:e,pipWindow:null})}),t),i}var a=document.pictureInPictureElement===n,o=(0,s.ZP)({isEnabled:a,pipWindow:null},t);return D(n,"enterpictureinpicture",(function(e){var t;o.setValue({isEnabled:!0,pipWindow:null!==(t=e.pictureInPictureWindow)&&void 0!==t?t:null})}),t),D(n,"leavepictureinpicture",(function(){o.setValue({isEnabled:!1,pipWindow:null})}),t),o}function g(e,t){var n,i=v(t),a=(0,s.ZP)(!0,t);return t.register((function(){clearTimeout(n),n=void 0})),i.onUpdate(o,{clearSignal:t}),e.onUpdate(o,{clearSignal:t}),o(),a;function o(){if(clearTimeout(n),n=void 0,e.getValue().isEnabled||i.getValue())a.setValueIfChanged(!0);else{var t=r.Z.getCurrent().INACTIVITY_DELAY;n=window.setTimeout((function(){a.setValueIfChanged(!1)}),t)}}}function y(e,t,n){var r=(0,s.ZP)(e.clientWidth*d,n),i=o.Z;t.onUpdate(l,{clearSignal:n}),D(window,"resize",l,n);var u=window.setInterval(l,2e4);return l(),n.register((function(){i(),clearInterval(u)})),r;function l(){i();var n=t.getValue();if(n.isEnabled)if((0,a.Z)(n.pipWindow))r.setValueIfChanged(1/0);else{var s=n.pipWindow,u=h(e,s),l=function(){r.setValueIfChanged(h(e,s)*d)};s.addEventListener("resize",l),i=function(){s.removeEventListener("resize",l),i=o.Z},r.setValueIfChanged(u*d)}else r.setValueIfChanged(e.clientWidth*d)}}f(["loadedmetadata"]),f(["timeupdate"]);var _=f(["fullscreenchange","FullscreenChange"],l.concat("MS")),b=f(["addtrack"]),S=f(["removetrack"]),T=f(["sourceopen","webkitsourceopen"]),E=f(["sourceclose","webkitsourceclose"]),k=f(["sourceended","webkitsourceended"]),w=f(["update"]),A=f(["removesourcebuffer"]),I=f(["keymessage","message"]),Z=f(["keyadded","ready"]),R=f(["keyerror","error"]),x=f(["keystatuseschange"]),M=f(["seeking"]),C=f(["seeked"]),P=f(["ended"]);function D(e,t,n,r){e.addEventListener(t,n),r.register((function(){e.removeEventListener(t,n)}))}},2203:function(e,t){"use strict";var n="undefined"==typeof window;t.Z=n},1988:function(e,t,n){"use strict";function r(e){return"function"==typeof window.VTTCue&&e instanceof window.VTTCue}n.d(t,{Z:function(){return r}})},7253:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(3887),i=n(1946);function a(e,t,n){if(e>=t)return r.Z.warn("Compat: Invalid cue times: "+e+" - "+t),null;if((0,i.Z)(window.VTTCue)){if((0,i.Z)(window.TextTrackCue))throw new Error("VTT cues not supported in your target");return new TextTrackCue(e,t,n)}return new VTTCue(e,t,n)}},1669:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(3666);function i(){return r.op}},6872:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r={DEFAULT_UNMUTED_VOLUME:.1,DEFAULT_REQUEST_TIMEOUT:3e4,DEFAULT_TEXT_TRACK_MODE:"native",DEFAULT_MANUAL_BITRATE_SWITCHING_MODE:"seamless",DEFAULT_ENABLE_FAST_SWITCHING:!0,DEFAULT_AUDIO_TRACK_SWITCHING_MODE:"seamless",DELTA_POSITION_AFTER_RELOAD:{bitrateSwitch:-.1,trackSwitch:{audio:-.7,video:-.1,other:0}},DEFAULT_CODEC_SWITCHING_BEHAVIOR:"continue",DEFAULT_AUTO_PLAY:!1,DEFAULT_SHOW_NATIVE_SUBTITLE:!0,DEFAULT_STOP_AT_END:!0,DEFAULT_WANTED_BUFFER_AHEAD:30,DEFAULT_MAX_BUFFER_AHEAD:1/0,DEFAULT_MAX_BUFFER_BEHIND:1/0,DEFAULT_MAX_VIDEO_BUFFER_SIZE:1/0,MAXIMUM_MAX_BUFFER_AHEAD:{text:18e3},MAXIMUM_MAX_BUFFER_BEHIND:{text:18e3},DEFAULT_INITIAL_BITRATES:{audio:0,video:0,other:0},DEFAULT_MIN_BITRATES:{audio:0,video:0,other:0},DEFAULT_MAX_BITRATES:{audio:1/0,video:1/0,other:1/0},INACTIVITY_DELAY:6e4,DEFAULT_THROTTLE_WHEN_HIDDEN:!1,DEFAULT_THROTTLE_VIDEO_BITRATE_WHEN_HIDDEN:!1,DEFAULT_LIMIT_VIDEO_WIDTH:!1,DEFAULT_LIVE_GAP:{DEFAULT:10,LOW_LATENCY:3.5},BUFFER_DISCONTINUITY_THRESHOLD:.2,FORCE_DISCONTINUITY_SEEK_DELAY:5e3,BITRATE_REBUFFERING_RATIO:1.5,BUFFER_GC_GAPS:{CALM:240,BEEFY:30},DEFAULT_MAX_MANIFEST_REQUEST_RETRY:4,DEFAULT_CDN_DOWNGRADE_TIME:60,DEFAULT_MAX_REQUESTS_RETRY_ON_ERROR:4,DEFAULT_MAX_REQUESTS_RETRY_ON_OFFLINE:1/0,INITIAL_BACKOFF_DELAY_BASE:{REGULAR:200,LOW_LATENCY:50},MAX_BACKOFF_DELAY_BASE:{REGULAR:3e3,LOW_LATENCY:1e3},SAMPLING_INTERVAL_MEDIASOURCE:1e3,SAMPLING_INTERVAL_LOW_LATENCY:250,SAMPLING_INTERVAL_NO_MEDIASOURCE:500,ABR_ENTER_BUFFER_BASED_ALGO:10,ABR_EXIT_BUFFER_BASED_ALGO:5,ABR_MINIMUM_TOTAL_BYTES:15e4,ABR_MINIMUM_CHUNK_SIZE:16e3,ABR_STARVATION_FACTOR:{DEFAULT:.72,LOW_LATENCY:.72},ABR_REGULAR_FACTOR:{DEFAULT:.72,LOW_LATENCY:.72},ABR_STARVATION_GAP:{DEFAULT:5,LOW_LATENCY:5},OUT_OF_STARVATION_GAP:{DEFAULT:7,LOW_LATENCY:7},ABR_STARVATION_DURATION_DELTA:.1,ABR_FAST_EMA:2,ABR_SLOW_EMA:10,RESUME_GAP_AFTER_SEEKING:{DEFAULT:1.5,LOW_LATENCY:.5},RESUME_GAP_AFTER_NOT_ENOUGH_DATA:{DEFAULT:.5,LOW_LATENCY:.5},RESUME_GAP_AFTER_BUFFERING:{DEFAULT:5,LOW_LATENCY:.5},REBUFFERING_GAP:{DEFAULT:.5,LOW_LATENCY:.2},MINIMUM_BUFFER_AMOUNT_BEFORE_FREEZING:2,UNFREEZING_SEEK_DELAY:6e3,FREEZING_STALLED_DELAY:600,UNFREEZING_DELTA_POSITION:.001,MAX_TIME_MISSING_FROM_COMPLETE_SEGMENT:.15,MAX_MANIFEST_BUFFERED_START_END_DIFFERENCE:.4,MAX_MANIFEST_BUFFERED_DURATION_DIFFERENCE:.3,MINIMUM_SEGMENT_SIZE:.005,APPEND_WINDOW_SECURITIES:{START:.2,END:.1},MAXIMUM_HTML_TEXT_TRACK_UPDATE_INTERVAL:50,TEXT_TRACK_SIZE_CHECKS_INTERVAL:250,BUFFER_PADDING:{audio:1,video:3,other:1},SEGMENT_PRIORITIES_STEPS:[2,4,8,12,18,25],MAX_HIGH_PRIORITY_LEVEL:1,MIN_CANCELABLE_PRIORITY:3,EME_DEFAULT_VIDEO_CODECS:['video/mp4;codecs="avc1.4d401e"','video/mp4;codecs="avc1.42e01e"','video/webm;codecs="vp8"'],EME_DEFAULT_AUDIO_CODECS:['audio/mp4;codecs="mp4a.40.2"',"audio/webm;codecs=opus"],EME_DEFAULT_WIDEVINE_ROBUSTNESSES:["HW_SECURE_ALL","HW_SECURE_DECODE","HW_SECURE_CRYPTO","SW_SECURE_DECODE","SW_SECURE_CRYPTO"],EME_DEFAULT_PLAYREADY_ROBUSTNESSES:["3000","2000"],EME_KEY_SYSTEMS:{clearkey:["webkit-org.w3.clearkey","org.w3.clearkey"],widevine:["com.widevine.alpha"],playready:["com.microsoft.playready.recommendation","com.microsoft.playready","com.chromecast.playready","com.youtube.playready"],fairplay:["com.apple.fps.1_0"]},MAX_CONSECUTIVE_MANIFEST_PARSING_IN_UNSAFE_MODE:10,MIN_MANIFEST_PARSING_TIME_TO_ENTER_UNSAFE_MODE:200,MIN_DASH_S_ELEMENTS_TO_PARSE_UNSAFELY:300,OUT_OF_SYNC_MANIFEST_REFRESH_DELAY:3e3,FAILED_PARTIAL_UPDATE_MANIFEST_REFRESH_DELAY:3e3,DASH_FALLBACK_LIFETIME_WHEN_MINIMUM_UPDATE_PERIOD_EQUAL_0:3,EME_DEFAULT_MAX_SIMULTANEOUS_MEDIA_KEY_SESSIONS:15,EME_MAX_STORED_PERSISTENT_SESSION_INFORMATION:1e3,EME_WAITING_DELAY_LOADED_SESSION_EMPTY_KEYSTATUSES:100,FORCED_ENDED_THRESHOLD:8e-4,ADAPTATION_SWITCH_BUFFER_PADDINGS:{video:{before:5,after:5},audio:{before:2,after:2.5},text:{before:0,after:0},image:{before:0,after:0}},SOURCE_BUFFER_FLUSHING_INTERVAL:500,CONTENT_REPLACEMENT_PADDING:1.2,CACHE_LOAD_DURATION_THRESHOLDS:{video:50,audio:10},STREAM_EVENT_EMITTER_POLL_INTERVAL:250,DEFAULT_MAXIMUM_TIME_ROUNDING_ERROR:.001,BUFFERED_HISTORY_RETENTION_TIME:6e4,BUFFERED_HISTORY_MAXIMUM_ENTRIES:200,MIN_BUFFER_AHEAD:5,UPTO_CURRENT_POSITION_CLEANUP:5},i=n(8026);function a(e){return null!=e&&!Array.isArray(e)&&"object"==typeof e}function o(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r=e.length||(e[t].enabled=!0)}(this._audioTracks.map((function(e){return e.nativeTrack})),e)},t}(a.Z);function f(e){for(var t=0;t=0){var i=e instanceof ArrayBuffer?new Uint8Array(e):e,a=JSON.parse((0,Z.uR)(i)),o=(0,A.K)(a.keys[0].k),s=(0,A.K)(a.keys[0].kid);n(t._vid.webkitAddKey(t._key,o,s,""))}else n(t._vid.webkitAddKey(t._key,e,null,""))}catch(e){r(e)}}))},n.generateRequest=function(e,t){var n=this;return new Promise((function(e){n._vid.webkitGenerateKeyRequest(n._key,t),e()}))},n.close=function(){var e=this;return new Promise((function(t){e._closeSession(),t()}))},n.load=function(){return Promise.resolve(!1)},n.remove=function(){return Promise.resolve()},t}(_.Z),M=function(){function e(e){this._keySystem=e}var t=e.prototype;return t._setVideo=function(e){var t=this;return S((function(){if(!R(e))throw new Error("Video not attached to the MediaKeys");t._videoElement=e}))},t.createSession=function(){if(null==this._videoElement)throw new Error("Video not attached to the MediaKeys");return new x(this._videoElement,this._keySystem)},t.setServerCertificate=function(){throw new Error("Server certificate is not implemented in your browser")},e}();var C=n(9252),P=n(6968);function D(e,t){var n=e;return S((function(){if(void 0===n.webkitSetMediaKeys)throw new Error("No webKitMediaKeys API.");n.webkitSetMediaKeys(t)}))}var N=function(e){function t(t,n,r){var i;return(i=e.call(this)||this)._serverCertificate=r,i._videoElement=t,i._keyType=n,i._unbindSession=I.Z,i._closeSession=I.Z,i.closed=new Promise((function(e){i._closeSession=e})),i.keyStatuses=new Map,i.expiration=NaN,i}(0,a.Z)(t,e);var n=t.prototype;return n.update=function(e){var t=this;return new Promise((function(n,r){if(void 0===t._nativeSession||void 0===t._nativeSession.update||"function"!=typeof t._nativeSession.update)return r("Unavailable WebKit key session.");try{var i;i=e instanceof ArrayBuffer?new Uint8Array(e):e instanceof Uint8Array?e:new Uint8Array(e.buffer),n(t._nativeSession.update(i))}catch(e){r(e)}}))},n.generateRequest=function(e,t){var n=this;return new Promise((function(e){var r,i,a,o=n._videoElement;if(void 0===(null===(r=o.webkitKeys)||void 0===r?void 0:r.createSession))throw new Error("No WebKitMediaKeys API.");if(a=n._keyType,(0,C.Z)(a,"com.apple.fps")){if(void 0===n._serverCertificate)throw new Error("A server certificate is needed for creating fairplay session.");i=function(e,t){var n=e instanceof Uint8Array?e:new Uint8Array(e),r=t instanceof Uint8Array?t:new Uint8Array(t);if((0,P.dN)(n,0)+4!==n.length)throw new Error("Unsupported WebKit initData.");var i=(0,Z.wV)(n),a=i.indexOf("skd://"),o=a>-1?i.substring(a+6):i,s=(0,Z.TZ)(o),u=0,l=new Uint8Array(n.byteLength+4+s.byteLength+4+r.byteLength);return l.set(n),u+=n.length,l.set((0,P.O_)(s.byteLength),u),u+=4,l.set(s,u),u+=s.byteLength,l.set((0,P.O_)(r.byteLength),u),u+=4,l.set(r,u),l}(t,n._serverCertificate)}else i=t;var s=o.webkitKeys.createSession("video/mp4",i);if(null==s)throw new Error("Impossible to get the key sessions");n._listenEvent(s),n._nativeSession=s,e()}))},n.close=function(){var e=this;return new Promise((function(t,n){e._unbindSession(),e._closeSession(),void 0!==e._nativeSession?(e._nativeSession.close(),t()):n("No session to close.")}))},n.load=function(){return Promise.resolve(!1)},n.remove=function(){return Promise.resolve()},n._listenEvent=function(e){var t=this;this._unbindSession();var n=function(e){t.trigger(e.type,e)};["keymessage","message","keyadded","ready","keyerror","error"].forEach((function(t){e.addEventListener(t,n),e.addEventListener("webkit"+t,n)})),this._unbindSession=function(){["keymessage","message","keyadded","ready","keyerror","error"].forEach((function(t){e.removeEventListener(t,n),e.removeEventListener("webkit"+t,n)}))}},(0,m.Z)(t,[{key:"sessionId",get:function(){var e,t;return null!==(t=null===(e=this._nativeSession)||void 0===e?void 0:e.sessionId)&&void 0!==t?t:""}}]),t}(_.Z),O=function(){function e(e){if(void 0===r)throw new Error("No WebKitMediaKeys API.");this._keyType=e,this._mediaKeys=new r(e)}var t=e.prototype;return t._setVideo=function(e){if(this._videoElement=e,void 0===this._videoElement)throw new Error("Video not attached to the MediaKeys");return D(this._videoElement,this._mediaKeys)},t.createSession=function(){if(void 0===this._videoElement||void 0===this._mediaKeys)throw new Error("Video not attached to the MediaKeys");return new N(this._videoElement,this._keyType,this._serverCertificate)},t.setServerCertificate=function(e){return this._serverCertificate=e,Promise.resolve()},e}();function L(){if(void 0===r)throw new Error("No WebKitMediaKeys API.");return{isTypeSupported:r.isTypeSupported,createCustomMediaKeys:function(e){return new O(e)},setMediaKeys:function(e,t){if(null===t)return D(e,t);if(!(t instanceof O))throw new Error("Custom setMediaKeys is supposed to be called with webkit custom MediaKeys.");return t._setVideo(e)}}}var U=function(e){var t,n,i,a=B;if("standard"!==e&&("auto"!==e||(c.vS||c.SB)&&void 0!==r)||!v.Z&&(0,d.Z)(navigator.requestMediaKeySystemAccess)){var o,s;if("webkit"===e&&void 0!==r){n=(0,f.S1)(["needkey"]);var p=L();o=p.isTypeSupported,s=p.createCustomMediaKeys,a=p.setMediaKeys,i="webkit"}else if(R(HTMLVideoElement.prototype)){n=(0,f.S1)(["needkey"]);var m={isTypeSupported:function(e){var t=document.querySelector("video");return null==t&&(t=document.createElement("video")),null!=t&&"function"==typeof t.canPlayType&&!!t.canPlayType("video/mp4",e)},createCustomMediaKeys:function(e){return new M(e)},setMediaKeys:function(e,t){if(null===t)return Promise.resolve(void 0);if(!(t instanceof M))throw new Error("Custom setMediaKeys is supposed to be called with old webkit custom MediaKeys.");return t._setVideo(e)}};o=m.isTypeSupported,s=m.createCustomMediaKeys,a=m.setMediaKeys,i="older-webkit"}else if(void 0!==r){n=(0,f.S1)(["needkey"]);var y=L();o=y.isTypeSupported,s=y.createCustomMediaKeys,a=y.setMediaKeys,i="webkit"}else if(c.fq&&void 0!==h){n=(0,f.S1)(["encrypted","needkey"]);var _={isTypeSupported:function(e,t){if(void 0===h)throw new Error("No MSMediaKeys API.");return void 0!==t?h.isTypeSupported(e,t):h.isTypeSupported(e)},createCustomMediaKeys:function(e){return new k(e)},setMediaKeys:function(e,t){if(null===t)return Promise.resolve(void 0);if(!(t instanceof k))throw new Error("Custom setMediaKeys is supposed to be called with IE11 custom MediaKeys.");return t._setVideo(e)}};o=_.isTypeSupported,s=_.createCustomMediaKeys,a=_.setMediaKeys,i="ms"}else if(void 0!==T){n=(0,f.S1)(["encrypted","needkey"]);var b={isTypeSupported:function(e,t){if(void 0===T)throw new Error("No MozMediaKeys API.");return void 0!==t?T.isTypeSupported(e,t):T.isTypeSupported(e)},createCustomMediaKeys:function(e){if(void 0===T)throw new Error("No MozMediaKeys API.");return new T(e)},setMediaKeys:function(e,t){return S((function(){var n=e;if(void 0===n.mozSetMediaKeys||"function"!=typeof n.mozSetMediaKeys)throw new Error("Can't set video on MozMediaKeys.");return n.mozSetMediaKeys(t)}))}};o=b.isTypeSupported,s=b.createCustomMediaKeys,a=b.setMediaKeys,i="moz"}else{n=(0,f.S1)(["encrypted","needkey"]);var E=window.MediaKeys,w=function(){if(void 0===E)throw new u.Z("MEDIA_KEYS_NOT_SUPPORTED","No `MediaKeys` implementation found in the current browser.");if(void 0===E.isTypeSupported){throw new Error("This browser seems to be unable to play encrypted contents currently.Note: Some browsers do not allow decryption in some situations, like when not using HTTPS.")}};o=function(e){return w(),(0,l.Z)("function"==typeof E.isTypeSupported),E.isTypeSupported(e)},s=function(e){return w(),new E(e)},i="unknown"}t=function(e,t){if(!o(e))return Promise.reject(new Error("Unsupported key type"));for(var n=0;ne.length)return V.Z.warn("Compat: Unrecognized initialization data. Use as is."),[{systemId:void 0,data:e}];var i=e.subarray(n,n+r),a={systemId:(0,z.Y)(i,8),data:i};W(t,a)?V.Z.warn("Compat: Duplicated PSSH found in initialization data, removing it."):t.push(a),n+=r}return n!==e.length?(V.Z.warn("Compat: Unrecognized initialization data. Use as is."),[{systemId:void 0,data:e}]):t}(new Uint8Array(t));return{type:n,values:r}}var j=n(6872),q=n(5157),Y=n(5389),X=n(3274),Q=n(7714),$=n(770);function J(e){$.Z.setState(e,null),F.setMediaKeys(e,null).then((function(){V.Z.info("DRM: MediaKeys disabled with success")})).catch((function(e){V.Z.error("DRM: Could not disable MediaKeys",e instanceof Error?e:"Unknown Error")}))}function ee(){return(ee=(0,i.Z)(s().mark((function e(t,n,r){var i,a,o,u,l,d,c;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=n.emeImplementation,a=n.keySystemOptions,o=n.loadedSessionsStore,u=n.mediaKeySystemAccess,l=n.mediaKeys,d=$.Z.getState(t),c=null!==d&&d.loadedSessionsStore!==o?d.loadedSessionsStore.closeAllSessions():Promise.resolve(),e.next=5,c;case 5:if(!r.isCancelled()){e.next=7;break}throw r.cancellationError;case 7:if($.Z.setState(t,{emeImplementation:i,keySystemOptions:a,mediaKeySystemAccess:u,mediaKeys:l,loadedSessionsStore:o}),t.mediaKeys!==l){e.next=10;break}return e.abrupt("return");case 10:V.Z.info("DRM: Attaching MediaKeys to the media element"),i.setMediaKeys(t,l).then((function(){V.Z.info("DRM: MediaKeys attached with success")})).catch((function(e){V.Z.error("DRM: Could not set MediaKeys",e instanceof Error?e:"Unknown Error")}));case 12:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function te(e){if(""===e.sessionId)return!1;var t=e.keyStatuses,n=[];return t.forEach((function(e){n.push(e)})),n.length<=0?(V.Z.debug("DRM: isSessionUsable: MediaKeySession given has an empty keyStatuses",e.sessionId),!1):(0,Q.Z)(n,"expired")?(V.Z.debug("DRM: isSessionUsable: MediaKeySession given has an expired key",e.sessionId),!1):(0,Q.Z)(n,"internal-error")?(V.Z.debug("DRM: isSessionUsable: MediaKeySession given has a key with an internal-error",e.sessionId),!1):(V.Z.debug("DRM: isSessionUsable: MediaKeySession is usable",e.sessionId),!0)}function ne(e,t,n,r){var i=e.loadedSessionsStore,a=e.persistentSessionsStore;return"temporary"===n?re(i,t):null===a?(V.Z.warn("DRM: Cannot create persistent MediaKeySession, PersistentSessionsStore not created."),re(i,t)):function(e,t,n,r){return ie.apply(this,arguments)}(i,a,t,r)}function re(e,t){V.Z.info("DRM: Creating a new temporary session");var n=e.createSession(t,"temporary");return Promise.resolve({type:"created-session",value:n})}function ie(){return ie=(0,i.Z)(s().mark((function e(t,n,r,a){var o,u,l,d,c,f;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(f=function(){return f=(0,i.Z)(s().mark((function e(){var i,u;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===a.cancellationError){e.next=2;break}throw a.cancellationError;case 2:return V.Z.info("DRM: Removing previous persistent session."),null!==(i=n.get(r))&&n.delete(i.sessionId),e.prev=5,e.next=8,t.closeSession(o.mediaKeySession);case 8:e.next=15;break;case 10:if(e.prev=10,e.t0=e.catch(5),""===o.mediaKeySession.sessionId){e.next=14;break}throw e.t0;case 14:t.removeSessionWithoutClosingIt(o.mediaKeySession);case 15:if(null===a.cancellationError){e.next=17;break}throw a.cancellationError;case 17:return u=t.createSession(r,"persistent-license"),e.abrupt("return",{type:"created-session",value:u});case 19:case"end":return e.stop()}}),e,null,[[5,10]])}))),f.apply(this,arguments)},c=function(){return f.apply(this,arguments)},null===a.cancellationError){e.next=4;break}throw a.cancellationError;case 4:if(V.Z.info("DRM: Creating persistent MediaKeySession"),o=t.createSession(r,"persistent-license"),null!==(u=n.getAndReuse(r))){e.next=9;break}return e.abrupt("return",{type:"created-session",value:o});case 9:return e.prev=9,e.next=12,t.loadPersistentSession(o.mediaKeySession,u.sessionId);case 12:if(l=e.sent){e.next=19;break}return V.Z.warn("DRM: No data stored for the loaded session"),n.delete(u.sessionId),t.removeSessionWithoutClosingIt(o.mediaKeySession),d=t.createSession(r,"persistent-license"),e.abrupt("return",{type:"created-session",value:d});case 19:if(!l||!te(o.mediaKeySession)){e.next=23;break}return n.add(r,r.keyIds,o.mediaKeySession),V.Z.info("DRM: Succeeded to load persistent session."),e.abrupt("return",{type:"loaded-persistent-session",value:o});case 23:return V.Z.warn("DRM: Previous persistent session not usable anymore."),e.abrupt("return",c());case 27:return e.prev=27,e.t0=e.catch(9),V.Z.warn("DRM: Unable to load persistent session: "+(e.t0 instanceof Error?e.t0.toString():"Unknown Error")),e.abrupt("return",c());case 31:case"end":return e.stop()}}),e,null,[[9,27]])}))),ie.apply(this,arguments)}function ae(e,t){return oe.apply(this,arguments)}function oe(){return(oe=(0,i.Z)(s().mark((function e(t,n){var r,i,a,o,u;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n<0||n>=t.getLength())){e.next=2;break}return e.abrupt("return");case 2:for(V.Z.info("DRM: LSS cache limit exceeded",n,t.getLength()),r=[],i=t.getAll().slice(),a=i.length-n,o=0;o=o.length)){e.next=2;break}throw new q.Z("INCOMPATIBLE_KEYSYSTEMS","No key system compatible with your wanted configuration has been found in the current browser.");case 2:if(null!=F.requestMediaKeySystemAccess){e.next=4;break}throw new Error("requestMediaKeySystemAccess is not implemented in your browser.");case 4:return r=o[t],i=r.keyName,a=r.keyType,l=r.keySystemOptions,d=ce(i,a,l),V.Z.debug("DRM: Request keysystem access "+a+","+(t+1)+" of "+o.length),e.prev=7,e.next=10,F.requestMediaKeySystemAccess(a,d);case 10:return c=e.sent,V.Z.info("DRM: Found compatible keysystem",a,t+1),e.abrupt("return",{type:"create-media-key-system-access",value:{options:l,mediaKeySystemAccess:c}});case 15:if(e.prev=15,e.t0=e.catch(7),V.Z.debug("DRM: Rejected access to keysystem",a,t+1),null===n.cancellationError){e.next=20;break}throw n.cancellationError;case 20:return e.abrupt("return",u(t+1));case 21:case"end":return e.stop()}}),e,null,[[7,15]])})))).apply(this,arguments)}}var ve=n(2297);function pe(e,t,n){var r;V.Z.debug("Compat: Calling generateRequest on the MediaKeySession");try{r=function(e){V.Z.info("Compat: Trying to move CENC PSSH from init data at the end of it.");for(var t=!1,n=new Uint8Array,r=new Uint8Array,i=0;ie.length)throw V.Z.warn("Compat: unrecognized initialization data. Cannot patch it."),new Error("Compat: unrecognized initialization data. Cannot patch it.");var o=e.subarray(i,i+a);if(16===e[i+12]&&119===e[i+13]&&239===e[i+14]&&236===e[i+15]&&192===e[i+16]&&178===e[i+17]&&77===e[i+18]&&2===e[i+19]&&172===e[i+20]&&227===e[i+21]&&60===e[i+22]&&30===e[i+23]&&82===e[i+24]&&226===e[i+25]&&251===e[i+26]&&75===e[i+27]){var s=(0,ve.Xj)(o),u=null===s?void 0:o[s[1]];V.Z.info("Compat: CENC PSSH found with version",u),void 0===u?V.Z.warn("Compat: could not read version of CENC PSSH"):t===(1===u)?n=(0,P.zo)(n,o):1===u?(V.Z.warn("Compat: cenc version 1 encountered, removing every other cenc pssh box."),n=o,t=!0):V.Z.warn("Compat: filtering out cenc pssh box with wrong version",u)}else r=(0,P.zo)(r,o);i+=a}if(i!==e.length)throw V.Z.warn("Compat: unrecognized initialization data. Cannot patch it."),new Error("Compat: unrecognized initialization data. Cannot patch it.");return(0,P.zo)(r,n)}(n)}catch(e){r=n}var i=null!=t?t:"";return e.generateRequest(i,r).catch((function(t){if(""!==i||!(t instanceof TypeError))throw t;return V.Z.warn('Compat: error while calling `generateRequest` with an empty initialization data type. Retrying with a default "cenc" value.',t),e.generateRequest("cenc",r)}))}var he=100;function me(e,t){return ge.apply(this,arguments)}function ge(){return(ge=(0,i.Z)(s().mark((function e(t,n){var r;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return V.Z.info("DRM: Load persisted session",n),e.next=3,t.load(n);case 3:if((r=e.sent)&&!(t.keyStatuses.size>0)){e.next=6;break}return e.abrupt("return",r);case 6:return e.abrupt("return",new Promise((function(e){t.addEventListener("keystatuseschange",i);var n=setTimeout(i,he);function i(){clearTimeout(n),t.removeEventListener("keystatuseschange",i),e(r)}})));case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var ye=n(7864);function _e(e){var t=new b.ZP;return Promise.race([e.close().then((function(){t.cancel()})),e.closed.then((function(){t.cancel()})),function(){return n.apply(this,arguments)}()]);function n(){return(n=(0,i.Z)(s().mark((function e(){var n;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,(0,ye.Z)(1e3,t.signal);case 3:return e.next=5,r();case 5:e.next=13;break;case 7:if(e.prev=7,e.t0=e.catch(0),!(e.t0 instanceof b.FU)){e.next=11;break}return e.abrupt("return");case 11:n=e.t0 instanceof Error?e.t0.message:"Unknown error made it impossible to close the session",V.Z.error("DRM: "+n);case 13:case"end":return e.stop()}}),e,null,[[0,7]])})))).apply(this,arguments)}function r(){return a.apply(this,arguments)}function a(){return(a=(0,i.Z)(s().mark((function n(){return s().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,n.next=3,e.update(new Uint8Array(1));case 3:n.next=13;break;case 5:if(n.prev=5,n.t0=n.catch(0),!t.isUsed()){n.next=9;break}return n.abrupt("return");case 9:if(!(n.t0 instanceof Error&&"The session is already closed."===n.t0.message)){n.next=11;break}return n.abrupt("return");case 11:return n.next=13,(0,ye.Z)(1e3,t.signal);case 13:if(!t.isUsed()){n.next=15;break}return n.abrupt("return");case 15:throw new Error("Compat: Couldn't know if session is closed");case 16:case"end":return n.stop()}}),n,null,[[0,5]])})))).apply(this,arguments)}}function be(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Se(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Se(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Se(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Ae(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0){if(null!==this._keyIds&&ke(t,this._keyIds))return!0;if(void 0!==this._initializationData.keyIds)return ke(t,this._initializationData.keyIds)}return this._checkInitializationDataCompatibility(e)},t._checkInitializationDataCompatibility=function(e){return void 0!==e.keyIds&&e.keyIds.length>0&&void 0!==this._initializationData.keyIds?ke(e.keyIds,this._initializationData.keyIds):this._initializationData.type===e.type&&this._initializationData.values.isCompatibleWith(e.values)},e}();function Ze(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Re(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Re(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Re(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0&&n._storage[e].mediaKeySession===i&&n._storage.splice(e,1)})).catch((function(e){V.Z.warn("DRM-LSS: MediaKeySession.closed rejected: "+e)})),this._storage.push(Object.assign({},a)),V.Z.debug("DRM-LSS: MediaKeySession added",a.sessionType,this._storage.length),a},t.reuse=function(e){for(var t=this._storage.length-1;t>=0;t--){var n=this._storage[t];if(n.keySessionRecord.isCompatibleWith(e))return this._storage.splice(t,1),this._storage.push(n),V.Z.debug("DRM-LSS: Reusing session:",n.mediaKeySession.sessionId,n.sessionType),Object.assign({},n)}return null},t.getEntryForSession=function(e){for(var t=this._storage.length-1;t>=0;t--){var n=this._storage[t];if(n.mediaKeySession===e)return Object.assign({},n)}return null},t.generateLicenseRequest=function(){var e=(0,i.Z)(s().mark((function e(t,n,r){var i,a,o,u;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:a=Ze(this._storage);case 1:if((o=a()).done){e.next=8;break}if((u=o.value).mediaKeySession!==t){e.next=6;break}return i=u,e.abrupt("break",8);case 6:e.next=1;break;case 8:if(void 0!==i){e.next=11;break}return V.Z.error("DRM-LSS: generateRequest error. No MediaKeySession found with the given initData and initDataType"),e.abrupt("return",pe(t,n,r));case 11:if(i.isGeneratingRequest=!0,"none"===i.closingStatus.type){e.next=14;break}throw new Error("The `MediaKeySession` is being closed.");case 14:return e.prev=14,e.next=17,pe(t,n,r);case 17:e.next=26;break;case 19:if(e.prev=19,e.t0=e.catch(14),void 0!==i){e.next=23;break}throw e.t0;case 23:throw i.isGeneratingRequest=!1,"awaiting"===i.closingStatus.type&&i.closingStatus.start(),e.t0;case 26:if(void 0!==i){e.next=28;break}return e.abrupt("return",void 0);case 28:i.isGeneratingRequest=!1,"awaiting"===i.closingStatus.type&&i.closingStatus.start();case 30:case"end":return e.stop()}}),e,this,[[14,19]])})));return function(t,n,r){return e.apply(this,arguments)}}(),t.loadPersistentSession=function(){var e=(0,i.Z)(s().mark((function e(t,n){var r,i,a,o,u;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=Ze(this._storage);case 1:if((a=i()).done){e.next=8;break}if((o=a.value).mediaKeySession!==t){e.next=6;break}return r=o,e.abrupt("break",8);case 6:e.next=1;break;case 8:if(void 0!==r){e.next=11;break}return V.Z.error("DRM-LSS: loadPersistentSession error. No MediaKeySession found with the given initData and initDataType"),e.abrupt("return",me(t,n));case 11:if(r.isLoadingPersistentSession=!0,"none"===r.closingStatus.type){e.next=14;break}throw new Error("The `MediaKeySession` is being closed.");case 14:return e.prev=14,e.next=17,me(t,n);case 17:u=e.sent,e.next=27;break;case 20:if(e.prev=20,e.t0=e.catch(14),void 0!==r){e.next=24;break}throw e.t0;case 24:throw r.isLoadingPersistentSession=!1,"awaiting"===r.closingStatus.type&&r.closingStatus.start(),e.t0;case 27:if(void 0!==r){e.next=29;break}return e.abrupt("return",u);case 29:return r.isLoadingPersistentSession=!1,"awaiting"===r.closingStatus.type&&r.closingStatus.start(),e.abrupt("return",u);case 32:case"end":return e.stop()}}),e,this,[[14,20]])})));return function(t,n){return e.apply(this,arguments)}}(),t.closeSession=function(){var e=(0,i.Z)(s().mark((function e(t){var n,r,i,a;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=Ze(this._storage);case 1:if((i=r()).done){e.next=8;break}if((a=i.value).mediaKeySession!==t){e.next=6;break}return n=a,e.abrupt("break",8);case 6:e.next=1;break;case 8:if(void 0!==n){e.next=11;break}return V.Z.warn("DRM-LSS: No MediaKeySession found with the given initData and initDataType"),e.abrupt("return",Promise.resolve(!1));case 11:return e.abrupt("return",this._closeEntry(n));case 12:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.getLength=function(){return this._storage.length},t.getAll=function(){return this._storage},t.closeAllSessions=function(){var e=(0,i.Z)(s().mark((function e(){var t,n,r=this;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this._storage,V.Z.debug("DRM-LSS: Closing all current MediaKeySessions",t.length),this._storage=[],n=t.map((function(e){return r._closeEntry(e)})),e.next=6,Promise.all(n);case 6:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),t.removeSessionWithoutClosingIt=function(e){(0,l.Z)(""===e.sessionId,"Initialized `MediaKeySession`s should always be properly closed");for(var t=this._storage.length-1;t>=0;t--){if(this._storage[t].mediaKeySession===e)return V.Z.debug("DRM-LSS: Removing session without closing it",e.sessionId),this._storage.splice(t,1),!0}return!1},t.getIndex=function(e){for(var t=0;t=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Be(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0){var o=void 0===t?3:4,s=this._entries[a];if((null!==(r=s.version)&&void 0!==r?r:-1)>=o&&i===s.sessionId)return;V.Z.info("DRM-PSS: Updating session info.",i),this._entries.splice(a,1)}else V.Z.info("DRM-PSS: Add new session",i);var u=e.values.getFormattedValues().map((function(e){var t=e.systemId,n=e.data;return{systemId:t,hash:e.hash,data:new Ne(n)}}));void 0===t?this._entries.push({version:3,sessionId:i,values:u,initDataType:e.type}):this._entries.push({version:4,sessionId:i,keyIds:t.map((function(e){return new Ne(e)})),values:u,initDataType:e.type}),this._save()}else V.Z.warn("DRM-PSS: Invalid Persisten Session given.")},t.delete=function(e){for(var t=-1,n=0;n0&&(r=new q.Z("KEY_STATUS_CHANGE_ERROR","One or several problematic key statuses have been encountered",{keyStatuses:d})),{warning:r,blacklistedKeyIds:u,whitelistedKeyIds:l}}var rt=f.Dl,it=f.RV,at=f.qo;function ot(e,t,n,r,a){V.Z.info("DRM: Binding session events",e.sessionId);var o=t.getLicenseConfig,u=void 0===o?{}:o,l=new b.ZP;return l.linkToSignal(a),(0,d.Z)(e.closed)||e.closed.then((function(){return l.cancel()})).catch((function(e){a.isCancelled()||(l.cancel(),r.onError(e))})),rt(e,(function(e){l.cancel(),r.onError(new q.Z("KEY_ERROR",e.type))}),l.signal),at(e,(function(e){(function(e){return c.apply(this,arguments)})(e).catch((function(e){a.isCancelled()||l.isUsed()&&e instanceof b.XG||(l.cancel(),r.onError(e))}))}),l.signal),it(e,(function(n){var a,o=n,c=new Uint8Array(o.message),f=(0,De.Z)(o.messageType)?o.messageType:"license-request";V.Z.info("DRM: Received message event, type "+f,e.sessionId),function(e,t,n){var r=t.baseDelay,a=t.maxDelay,o=t.totalRetry,u=t.shouldRetry,l=t.onRetry,c=0;return f();function f(){return v.apply(this,arguments)}function v(){return(v=(0,i.Z)(s().mark((function t(){var i,v,p,h;return s().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null===n.cancellationError){t.next=2;break}throw n.cancellationError;case 2:return t.prev=2,t.next=5,e();case 5:return i=t.sent,t.abrupt("return",i);case 9:if(t.prev=9,t.t0=t.catch(2),null===n.cancellationError){t.next=13;break}throw n.cancellationError;case 13:if(!(!(0,d.Z)(u)&&!u(t.t0)||c++>=o)){t.next=15;break}throw t.t0;case 15:return"function"==typeof l&&l(t.t0,c),v=Math.min(r*Math.pow(2,c-1),a),p=(0,Qe.Z)(v),t.next=20,(0,$e.Z)(p);case 20:return h=f(),t.abrupt("return",h);case 22:case"end":return t.stop()}}),t,null,[[2,9]])})))).apply(this,arguments)}}((function(){return function(e,n){var r;return new Promise((function(i,a){try{V.Z.debug("DRM: Calling `getLicense`",n);var o=t.getLicense(e,n),s=(0,d.Z)(u.timeout)?1e4:u.timeout;s>=0&&(r=setTimeout((function(){a(new ct('"getLicense" timeout exceeded ('+s+" ms)"))}),s)),Promise.resolve(o).then(l,c)}catch(e){c(e)}function l(e){void 0!==r&&clearTimeout(r),i(e)}function c(e){void 0!==r&&clearTimeout(r),a(e)}}))}(c,f)}),{totalRetry:null!=(a=u.retry)?a:2,baseDelay:200,maxDelay:3e3,shouldRetry:function(e){return e instanceof ct||(0,d.Z)(e)||!0!==e.noRetry},onRetry:function(e){return r.onWarning(st(e))}},l.signal).then((function(t){if(l.isUsed())return Promise.resolve();if((0,d.Z)(t))V.Z.info("DRM: No license given, skipping session.update");else try{return ut(e,t)}catch(e){l.cancel(),r.onError(e)}})).catch((function(e){if(!l.isUsed()){l.cancel();var t=st(e);if(!(0,d.Z)(e))if(!0===e.fallbackOnLastTry)return V.Z.warn("DRM: Last `getLicense` attempt failed. Blacklisting the current session."),void r.onError(new dt(t));r.onError(t)}}))}),l.signal),void f();function c(){return c=(0,i.Z)(s().mark((function n(r){var o,u;return s().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return u=function(){return(u=(0,i.Z)(s().mark((function n(){var i,o;return s().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!l.isUsed()){n.next=2;break}return n.abrupt("return");case 2:if("function"!=typeof t.onKeyStatusesChange){n.next=24;break}return n.prev=3,n.next=6,t.onKeyStatusesChange(r,e);case 6:if(i=n.sent,!l.isUsed()){n.next=9;break}return n.abrupt("return");case 9:n.next=18;break;case 11:if(n.prev=11,n.t0=n.catch(3),!a.isCancelled()){n.next=15;break}return n.abrupt("return");case 15:throw o=new q.Z("KEY_STATUS_CHANGE_ERROR","Unknown `onKeyStatusesChange` error"),!(0,d.Z)(n.t0)&&(0,De.Z)(n.t0.message)&&(o.message=n.t0.message),o;case 18:if(!(0,d.Z)(i)){n.next=22;break}V.Z.info("DRM: No license given, skipping session.update"),n.next=24;break;case 22:return n.next=24,ut(e,i);case 24:case"end":return n.stop()}}),n,null,[[3,11]])})))).apply(this,arguments)},o=function(){return u.apply(this,arguments)},V.Z.info("DRM: keystatuseschange event received",e.sessionId),n.next=5,Promise.all([o(),Promise.resolve(f())]);case 5:case"end":return n.stop()}}),n)}))),c.apply(this,arguments)}function f(){if(!l.isUsed()&&0!==e.keyStatuses.size){var i=nt(e,t,n),a=i.warning,o=i.blacklistedKeyIds,s=i.whitelistedKeyIds;void 0!==a&&(r.onWarning(a),l.isUsed())||r.onKeyUpdate({whitelistedKeyIds:s,blacklistedKeyIds:o})}}}function st(e){if(e instanceof ct)return new q.Z("KEY_LOAD_TIMEOUT","The license server took too much time to respond.");var t=new q.Z("KEY_LOAD_ERROR","An error occured when calling `getLicense`.");return!(0,d.Z)(e)&&(0,De.Z)(e.message)&&(t.message=e.message),t}function ut(e,t){return lt.apply(this,arguments)}function lt(){return(lt=(0,i.Z)(s().mark((function e(t,n){var r;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return V.Z.info("DRM: Updating MediaKeySession with message"),e.prev=1,e.next=4,t.update(n);case 4:e.next=10;break;case 6:throw e.prev=6,e.t0=e.catch(1),r=e.t0 instanceof Error?e.t0.toString():"`session.update` failed",new q.Z("KEY_UPDATE_ERROR",r);case 10:V.Z.info("DRM: MediaKeySession update succeeded.");case 11:case"end":return e.stop()}}),e,null,[[1,6]])})))).apply(this,arguments)}var dt=function(e){function t(n){var r;return r=e.call(this)||this,Object.setPrototypeOf((0,Ye.Z)(r),t.prototype),r.sessionError=n,r}return(0,a.Z)(t,e),t}((0,Xe.Z)(Error)),ct=function(e){function t(t){var n;return n=e.call(this)||this,Object.setPrototypeOf((0,Ye.Z)(n),dt.prototype),n.message=t,n}return(0,a.Z)(t,e),t}((0,Xe.Z)(Error)),ft=n(9822);function vt(e,t){return pt.apply(this,arguments)}function pt(){return(pt=(0,i.Z)(s().mark((function e(t,n){var r,i;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t.setServerCertificate(n);case 3:return r=e.sent,e.abrupt("return",r);case 7:throw e.prev=7,e.t0=e.catch(0),V.Z.warn("DRM: mediaKeys.setServerCertificate returned an error",e.t0 instanceof Error?e.t0:""),i=e.t0 instanceof Error?e.t0.toString():"`setServerCertificate` error",new q.Z("LICENSE_SERVER_CERTIFICATE_ERROR",i);case 12:case"end":return e.stop()}}),e,null,[[0,7]])})))).apply(this,arguments)}function ht(e,t){return mt.apply(this,arguments)}function mt(){return(mt=(0,i.Z)(s().mark((function e(t,n){var r,i;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!0!==ze.hasOne(t)){e.next=3;break}return V.Z.info("DRM: The MediaKeys already has a server certificate, skipping..."),e.abrupt("return",{type:"already-has-one"});case 3:if("function"==typeof t.setServerCertificate){e.next=6;break}return V.Z.warn("DRM: Could not set the server certificate. mediaKeys.setServerCertificate is not a function"),e.abrupt("return",{type:"method-not-implemented"});case 6:return V.Z.info("DRM: Setting server certificate on the MediaKeys"),ze.prepare(t),e.prev=8,e.next=11,vt(t,n);case 11:return r=e.sent,ze.set(t,n),e.abrupt("return",{type:"success",value:r});case 16:return e.prev=16,e.t0=e.catch(8),i=(0,ft.Z)(e.t0)?e.t0:new q.Z("LICENSE_SERVER_CERTIFICATE_ERROR","Unknown error when setting the server certificate."),e.abrupt("return",{type:"error",value:i});case 20:case"end":return e.stop()}}),e,null,[[8,16]])})))).apply(this,arguments)}var gt=n(4339);function yt(e,t){if(!(isNaN(t)||t<0||t>=e.getLength())){var n=e.getLength(),r=n-t;V.Z.info("DRM: Too many stored persistent sessions, removing some.",n,r),e.deleteOldSessions(r)}}var _t=function(){function e(e){this._innerValues=e,this._lazyFormattedValues=null}var t=e.prototype;return t.constructRequestData=function(){return P.zo.apply(void 0,this._innerValues.map((function(e){return e.data})))},t.isCompatibleWith=function(t){var n=t instanceof e?t.getFormattedValues():t;return Oe(this.getFormattedValues(),n)},t.getFormattedValues=function(){return null===this._lazyFormattedValues&&(this._lazyFormattedValues=this._innerValues.slice().sort((function(e,t){return e.systemId===t.systemId?0:void 0===e.systemId?1:void 0===t.systemId||e.systemId=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function St(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0&&U._currentSessions.splice(r),void 0!==t.content&&kt(t.content.manifest,[],[],x.record.getAssociatedKeyIds()),null===(n=i.persistentSessionsStore)||void 0===n||n.delete(C.sessionId),i.loadedSessionsStore.closeSession(C).catch((function(e){var t=e instanceof Error?e:"unknown error";V.Z.warn("DRM: failed to close expired session",t)})).then((function(){return U._unlockInitDataQueue()})).catch((function(e){return U._onFatalError(e)})),void(U._isStopped()||U.trigger("warning",e.reason))}if(e instanceof dt){if(x.blacklistedSessionError=e,void 0!==t.content){var a=t.content.manifest;V.Z.info("DRM: blacklisting Representations based on protection data."),wt(a,t)}U._unlockInitDataQueue()}else U._onFatalError(e)}},this._canceller.signal),void 0!==a.singleLicensePer&&"init-data"!==a.singleLicensePer||this._unlockInitDataQueue(),"created-session"!==R.type){e.next=67;break}return N=t.values.constructRequestData(),e.prev=54,e.next=57,i.loadedSessionsStore.generateLicenseRequest(C,t.type,N);case 57:e.next=67;break;case 59:if(e.prev=59,e.t0=e.catch(54),null!==(O=i.loadedSessionsStore.getEntryForSession(C))&&"none"===O.closingStatus.type){e.next=66;break}return(L=this._currentSessions.indexOf(x))>=0&&this._currentSessions.splice(L,1),e.abrupt("return",Promise.resolve());case 66:throw new q.Z("KEY_GENERATE_REQUEST_ERROR",e.t0 instanceof Error?e.t0.toString():"Unknown error");case 67:return e.abrupt("return",Promise.resolve());case 68:case"end":return e.stop()}}),e,this,[[54,59]])})));return function(t,n){return e.apply(this,arguments)}}(),n._tryToUseAlreadyCreatedSession=function(e,t){var n=t.stores,r=t.options,i=(0,X.Z)(this._currentSessions,(function(t){return t.record.isCompatibleWith(e)}));if(void 0===i)return!1;var a=i.blacklistedSessionError;if(!(0,d.Z)(a))return void 0===e.type||void 0===e.content?(V.Z.error("DRM: This initialization data has already been blacklisted but the current content is not known."),!0):(V.Z.info("DRM: This initialization data has already been blacklisted. Blacklisting the related content."),wt(e.content.manifest,e),!0);if(void 0!==e.keyIds){var o;if(void 0===r.singleLicensePer||"init-data"===r.singleLicensePer){var s=i.keyStatuses.blacklisted;o=function(e,t){for(var n,r,i=function(){var e=r.value;if(t.some((function(t){return Te(t,e)})))return{v:!0}},a=be(e);!(r=a()).done;)if(n=i())return n.v;return!1}(e.keyIds,s)}else{var u=i.keyStatuses.whitelisted;o=!ke(e.keyIds,u)}if(o)return void 0===e.content?(V.Z.error("DRM: Cannot forbid key id, the content is unknown."),!0):(V.Z.info("DRM: Current initialization data is linked to blacklisted keys. Marking Representations as not decipherable"),kt(e.content.manifest,[],e.keyIds,[]),!0)}if(null!==n.loadedSessionsStore.reuse(e))return V.Z.debug("DRM: Init data already processed. Skipping it."),!0;var l=this._currentSessions.indexOf(i);return-1===l?V.Z.error("DRM: Unable to remove processed init data: not found."):(V.Z.debug("DRM: A session from a processed init data is not available anymore. Re-processing it."),this._currentSessions.splice(l,1)),!1},n._onFatalError=function(e){if(!this._canceller.isUsed()){var t=e instanceof Error?e:new Y.Z("NONE","Unknown decryption error");this.error=t,this._initDataQueue.length=0,this._stateData={state:gt.u.Error,isMediaKeysAttached:void 0,isInitDataQueueLocked:void 0,data:null},this._canceller.cancel(),this.trigger("error",t),this._stateData.state===gt.u.Error&&this.trigger("stateChange",this._stateData.state)}},n._isStopped=function(){return this._stateData.state===gt.u.Disposed||this._stateData.state===gt.u.Error},n._processCurrentInitDataQueue=function(){for(;!1===this._stateData.isInitDataQueueLocked;){var e=this._initDataQueue.shift();if(void 0===e)return;this.onInitializationData(e)}},n._lockInitDataQueue=function(){!1===this._stateData.isInitDataQueueLocked&&(this._stateData.isInitDataQueueLocked=!0)},n._unlockInitDataQueue=function(){2===this._stateData.isMediaKeysAttached?(this._stateData.isInitDataQueueLocked=!1,this._processCurrentInitDataQueue()):V.Z.error("DRM: Trying to unlock in the wrong state")},t}(_.Z);function Et(e){var t=e.getConfiguration().sessionTypes;return void 0!==t&&(0,Q.Z)(t,"persistent-license")}function kt(e,t,n,r){e.updateRepresentationsDeciperability((function(e){if(void 0===e.contentProtections)return e.decipherable;var i=e.contentProtections.keyIds;if(void 0!==i)for(var a,o=bt(i);!(a=o()).done;){for(var s,u=a.value,l=bt(n);!(s=l()).done;){if(Te(s.value,u.keyId))return!1}for(var d,c=bt(t);!(d=c()).done;){if(Te(d.value,u.keyId))return!0}for(var f,v=bt(r);!(f=v()).done;){if(Te(f.value,u.keyId))return}}return e.decipherable}))}function wt(e,t){e.updateRepresentationsDeciperability((function(e){var n,r;if(!1===e.decipherable)return!1;for(var i,a,o=function(){var e=a.value;if((void 0===t.type||e.type===t.type)&&t.values.getFormattedValues().every((function(t){return e.values.some((function(e){return(void 0===t.systemId||e.systemId===t.systemId)&&(0,K.Z)(e.data,t.data)}))})))return{v:!1}},s=bt(null!==(r=null===(n=e.contentProtections)||void 0===n?void 0:n.initData)&&void 0!==r?r:[]);!(a=s()).done;)if(i=o())return i.v;return e.decipherable}))}function At(e,t,n,r,i,a){for(var o,s,u=[].concat(i,a),l=function(){var e=s.value;u.some((function(t){return Te(t,e)}))||(V.Z.hasLevel("DEBUG")&&V.Z.debug("DRM: KeySessionRecord's key missing in the license, blacklisting it",(0,Z.ci)(e)),u.push(e))},d=bt(t.getAssociatedKeyIds());!(s=d()).done;)l();if(void 0!==n&&"init-data"!==n){var c=e.keyIds,f=e.content;if(void 0!==c){var v=c.filter((function(e){return!u.some((function(t){return Te(t,e)}))}));v.length>0&&(V.Z.hasLevel("DEBUG")&&V.Z.debug("DRM: init data keys missing in the license, blacklisting them",v.map((function(e){return(0,Z.ci)(e)})).join(", ")),u.push.apply(u,v))}if(r&&void 0!==f)if("content"===n){for(var p,h=new Set,m=bt(f.manifest.periods);!(p=m()).done;){Zt(h,p.value)}It(h,u)}else if("periods"===n)for(var g,y=bt(f.manifest.periods);!(g=y()).done;){var _=g.value,b=new Set;if(Zt(b,_),(null===(o=e.content)||void 0===o?void 0:o.period.id)===_.id)It(b,u);else for(var S=Array.from(b),T=function(){var e=k[E];if(u.some((function(t){return Te(t,e)})))return It(b,u),1},E=0,k=S;E=100?n:r<=0?0:n*(+r/100)}return 0}(e,s);return a.Z.debug("Init: Initial time calculated:",t),t}),o,(function(e){return n.trigger("warning",e)}),r).autoPlayResult.then((function(){return(0,d.Z)(t,e,!0,r).onUpdate((function(e,t){e&&(t(),n.trigger("loaded",{segmentBuffersStore:null}))}),{emitCurrentValue:!0,clearSignal:r})})).catch((function(e){r.isCancelled()||n._onFatalError(e)}))},t}(l.K)},9420:function(e,t,n){"use strict";n.d(t,{K:function(){return i}});var r=n(4578),i=function(e){function t(){return e.apply(this,arguments)||this}return(0,r.Z)(t,e),t}(n(1959).Z)},379:function(e,t,n){"use strict";n.d(t,{Z:function(){return s}});var r=n(3666);var i=n(1669),a=n(5095),o=n(288);function s(e,t,n,s){var u=new o.ZP;u.linkToSignal(s);var l=(0,a.ZP)(!1,u.signal);return e.listen((function(e){if(null===e.rebuffering&&null===e.freezing&&0!==e.readyState){if(!function(e,t){return!e||!r.SB||t}(n,t.hasAttribute("playsinline"))&&t.duration>0)return l.setValue(!0),void u.cancel();var a=r.lV?4:3;return e.readyState>=a&&null!==e.currentRange&&(!(0,i.Z)()||t.duration>0)?(l.setValue(!0),void u.cancel()):void 0}}),{includeLastObservation:!0,clearSignal:u.signal}),l}},8833:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r=n(1669),i=n(3774),a=n(3714),o=n(3887),s=n(5095);function u(e,t,n,u,l,d){var c,f,v=new Promise((function(e,t){c=e,f=t})),p=(0,s.$l)(!1,d),h=(0,s.$l)(!1,d);e.addEventListener("loadedmetadata",g),e.readyState>=i.c.HAVE_METADATA&&g();var m=d.register((function(t){e.removeEventListener("loadedmetadata",g),f(t)}));return{autoPlayResult:v,initialPlayPerformed:h,initialSeekPerformed:p};function g(){e.removeEventListener("loadedmetadata",g);var i="function"==typeof n?n():n;if(o.Z.info("Init: Set initial time",i),t.setCurrentTime(i),p.setValue(!0),p.finish(),(0,r.Z)()&&0===e.duration){var s=new a.Z("MEDIA_ERR_NOT_LOADED_METADATA","Cannot load automatically: your browser falsely announced having loaded the content.");l(s)}d.isCancelled()||t.listen((function(t,n){!t.seeking&&null===t.rebuffering&&t.readyState>=1&&(n(),function(){var t,n;if(o.Z.info("Init: Can begin to play content"),!u)return e.autoplay&&o.Z.warn("Init: autoplay is enabled on HTML media element. Media will play as soon as possible."),h.setValue(!0),h.finish(),m(),c({type:"skipped"});try{n=null!==(t=e.play())&&void 0!==t?t:Promise.resolve()}catch(e){return m(),f(e)}n.then((function(){if(!d.isCancelled())return h.setValue(!0),h.finish(),m(),c({type:"autoplay"})})).catch((function(e){if(m(),!d.isCancelled()){if(e instanceof Error&&"NotAllowedError"===e.name){o.Z.warn("Init: Media element can't play. It may be due to browser auto-play policies.");var t=new a.Z("MEDIA_ERR_BLOCKED_AUTOPLAY","Cannot trigger auto-play automatically: your browser does not allow it.");if(l(t),d.isCancelled())return;return c({type:"autoplay-blocked"})}f(e)}}))}())}),{includeLastObservation:!0,clearSignal:d})}}},7794:function(e,t,n){"use strict";n.d(t,{Z:function(){return l}});var r=n(5157),i=n(7874),a=n(3887),o=n(5095),s=n(288),u=n(4339);function l(e,t,n,l,d){if(0===t.length)return h("No `keySystems` option given.");if(null===i.Z.decrypt)return h("EME feature not activated.");var c=new s.ZP;c.linkToSignal(d);var f=(0,o.ZP)({initializationState:{type:"uninitialized",value:null},drmSystemId:void 0},d);a.Z.debug("Init: Creating ContentDecryptor");var v=i.Z.decrypt;if(!v.hasEmeApis())return h("EME API not available on the current page.");var p=new v(e,t);return p.addEventListener("stateChange",(function(e){if(e===u.u.WaitingForAttachment){var t=(0,o.ZP)(!1);t.onUpdate((function(t,n){t&&(n(),e===u.u.WaitingForAttachment&&p.attach())}),{clearSignal:c.signal}),f.setValue({initializationState:{type:"awaiting-media-link",value:{isMediaLinked:t}},drmSystemId:p.systemId})}else e===u.u.ReadyForContent&&(f.setValue({initializationState:{type:"initialized",value:null},drmSystemId:p.systemId}),p.removeEventListener("stateChange"))})),p.addEventListener("error",(function(e){c.cancel(),l.onError(e)})),p.addEventListener("warning",(function(e){l.onWarning(e)})),n.onUpdate((function(e){null!==e&&p.onInitializationData(e)}),{clearSignal:c.signal}),c.signal.register((function(){p.dispose()})),f;function h(e){n.onUpdate((function(t,n){if(null!==t){n();var i=new r.Z("MEDIA_IS_ENCRYPTED_ERROR",e);l.onError(i)}}),{clearSignal:d});var t=(0,o.ZP)({initializationState:{type:"initialized",value:null},drmSystemId:void 0});return t.finish(),t}}},6199:function(e,t,n){"use strict";n.d(t,{Z:function(){return f}});var r=n(4578),i=n(3666).yS,a=n(6872),o=n(3714),s=n(3887),u=n(1959),l=n(2829),d=n(288),c=1/60,f=function(e){function t(t,n,r){var i;return(i=e.call(this)||this)._playbackObserver=t,i._manifest=n,i._speed=r,i._discontinuitiesStore=[],i._isStarted=!1,i._canceller=new d.ZP,i}(0,r.Z)(t,e);var n=t.prototype;return n.start=function(){var e=this;if(!this._isStarted){var t;this._isStarted=!0;var n=null,r=new h(this._playbackObserver,this._speed);this._canceller.signal.register((function(){r.dispose()}));var o=null;this._playbackObserver.listen((function(u){var d,f,v=e._discontinuitiesStore,h=u.buffered,m=u.position,g=u.readyState,y=u.rebuffering,_=u.freezing,b=a.Z.getCurrent(),S=b.BUFFER_DISCONTINUITY_THRESHOLD,T=b.FORCE_DISCONTINUITY_SEEK_DELAY,E=b.FREEZING_STALLED_DELAY,k=b.UNFREEZING_SEEK_DELAY,w=b.UNFREEZING_DELTA_POSITION;if(!u.seeking&&i&&null===n&&null!==t&&u.positionk&&(s.Z.warn("Init: trying to seek to un-freeze player"),e._playbackObserver.setCurrentTime(e._playbackObserver.getCurrentTime()+w),o={attemptTimestamp:I}),I-_.timestamp>E)return null===y||null!==n?r.stopRebuffering():r.startRebuffering(),void e.trigger("stalled","freezing")}else o=null;if(null===y)return r.stopRebuffering(),1===g?(f=u.seeking?null!==u.pendingInternalSeek?"internal-seek":"seeking":"not-ready",void e.trigger("stalled",f)):void e.trigger("unstalled",null);var Z="seeking"===y.reason&&null!==u.pendingInternalSeek?"internal-seek":y.reason;if(null!==n){var R=performance.now();if(R-n0){var M=function(e,t,n){if(0===e.length)return null;for(var r=null,i=0;in)return r;var o=void 0;if(void 0===a.end||a.end>n){var u=e[i],l=u.discontinuity,d=u.position,f=l.start,v=l.end;if(n>=(null!=f?f:d)-c)if(null===v){var p=t.getPeriodAfter(a);null!==p?o=p.start+c:s.Z.warn("Init: discontinuity at Period's end but no next Period")}else no?r:o)}}return r}(v,e._manifest,x);if(null!==M){var C=M+.001;if(!(C<=e._playbackObserver.getCurrentTime()))return s.Z.warn("SA: skippable discontinuity found in the stream",m,C),e._playbackObserver.setCurrentTime(C),void e.trigger("warning",p(x,C));s.Z.info("Init: position to seek already reached, no seeking",e._playbackObserver.getCurrentTime(),C)}}var P=null!=x?x:m,D=(0,l.XS)(h,P);if(e._speed.getValue()>0&&D=0;O--){var L=e._manifest.periods[O];if(void 0!==L.end&&L.end<=P){if(e._manifest.periods[O+1].start>P&&e._manifest.periods[O+1].start>e._playbackObserver.getCurrentTime()){var U=e._manifest.periods[O+1];return e._playbackObserver.setCurrentTime(U.start),void e.trigger("warning",p(P,U.start))}break}}e.trigger("stalled",Z)}else e.trigger("stalled",Z)}),{includeLastObservation:!0,clearSignal:this._canceller.signal})}},n.updateDiscontinuityInfo=function(e){this._isStarted||this.start();var t=this._playbackObserver.getReference().getValue();!function(e,t,n){for(;e.length>0&&void 0!==e[0].period.end&&e[0].period.end+10r.start)return void(v(t)&&e.splice(a,0,t));v(t)&&e.push(t)}(this._discontinuitiesStore,e,t)},n.onLockedStream=function(e,t){var n;this._isStarted||this.start();var r=this._playbackObserver.getReference().getValue();if(!(!r.rebuffering||r.paused||this._speed.getValue()<=0||"audio"!==e&&"video"!==e)){var i=r.position,a=null!==(n=r.rebuffering.position)&&void 0!==n?n:i,o=t.start;i=0;n--){if(e[n].startt)return e.slice(n,e.length)}return[]}function m(e,t,n){var r=Math.max(e.start,t),i=p(e.cues,t),a={start:e.start,end:r,cues:i},o=Math.min(n,e.end),s=h(e.cues,n);return[a,{start:o,end:e.end,cues:s}]}var g=function(){function e(){this._cuesBuffer=[]}var t=e.prototype;return t.get=function(e){for(var t=this._cuesBuffer,n=[],r=t.length-1;r>=0;r--){var i=t[r];if(e=i.start){for(var a=i.cues,o=0;o=a[o].start&&ee){var a=r[i];if(a.start>=n)return;if(a.end>=n){if(e<=a.start)a.cues=h(a.cues,n),a.start=n;else{var o=m(a,e,n),s=o[0],u=o[1];this._cuesBuffer[i]=s,r.splice(i+1,0,u)}return}a.start>=e?(r.splice(i,1),i--):(a.cues=p(a.cues,e),a.end=Math.max(e,a.start))}},t.insert=function(e,t,n){var r=this._cuesBuffer,i={start:t,end:n,cues:e};function a(e){var t=r[e];void 0===t||v(i.end,t.end)?r[e]=i:(t.start>=i.end||(t.cues=h(t.cues,i.end),t.start=i.end),r.splice(e,0,i))}for(var o=0;os.end);return void a(o)}if(ts.end);return void a(o)}if(v(s.end,n))return s.cues=p(s.cues,t),s.end=t,void r.splice(o+1,0,i);if(s.end>n){var u=m(s,t,n),l=u[0],d=u[1];return this._cuesBuffer[o]=l,r.splice(o+1,0,i),void r.splice(o+2,0,d)}s.cues=p(s.cues,t),s.end=t;var c=o+1;for(s=r[c];void 0!==s&&n>s.end;)r.splice(c,1),s=r[c];return void a(c)}}r.push(i)},e}();function y(e,t,n,r){for(var i=[t/n.columns,e/n.rows],a=r.getElementsByClassName("proportional-style"),o=0;o0}var _=i.M4,b=i.bQ,S=i.Q$;function T(e,t){try{e.removeChild(t)}catch(e){a.Z.warn("HTSB: Can't remove text track: not in the element.")}}function E(e){var t=e.getAttribute("data-resolution-rows"),n=e.getAttribute("data-resolution-columns");if(null===t||null===n)return null;var r=parseInt(t,10),i=parseInt(n,10);return null===r||null===i?null:{rows:r,columns:i}}var k=function(e){function t(t,n){var r;return a.Z.debug("HTSB: Creating HTMLTextSegmentBuffer"),(r=e.call(this)||this).bufferType="text",r._buffered=new c.Z,r._videoElement=t,r._textTrackElement=n,r._sizeUpdateCanceller=new l.ZP,r._canceller=new l.ZP,r._buffer=new g,r._currentCues=[],r.autoRefreshSubtitles(r._canceller.signal),r}(0,r.Z)(t,e);var n=t.prototype;return n.pushChunk=function(e){try{this.pushChunkSync(e)}catch(e){return Promise.reject(e)}return Promise.resolve()},n.removeBuffer=function(e,t){return this.removeBufferSync(e,t),Promise.resolve()},n.endOfSegment=function(e){return this._segmentInventory.completeSegment(e,this._buffered),Promise.resolve()},n.getBufferedRanges=function(){return this._buffered},n.dispose=function(){a.Z.debug("HTSB: Disposing HTMLTextSegmentBuffer"),this._disableCurrentCues(),this._buffer.remove(0,1/0),this._buffered.remove(0,1/0),this._canceller.cancel()},n.pushChunkSync=function(e){var t,n;a.Z.debug("HTSB: Appending new html text tracks");var r=e.data,i=r.timestampOffset,o=r.appendWindow,s=r.chunk;if(null!==s){var u,l,d=s.start,c=s.end,v=s.data,p=s.type,h=s.language,m=null!==(t=o[0])&&void 0!==t?t:0,g=null!==(n=o[1])&&void 0!==n?n:1/0,y=function(e,t,n,r){a.Z.debug("HTSB: Finding parser for html text tracks:",e);var i=f.Z.htmlTextTracksParsers[e];if("function"!=typeof i)throw new Error("no parser found for the given text track");a.Z.debug("HTSB: Parser found, parsing...");var o=i(t,n,r);return a.Z.debug("HTTB: Parsed successfully!",o.length),o}(p,v,i,h);if(0!==m&&g!==1/0){for(var _=0;_=0&&y[_].start>=g;)_--;for(y.splice(_,y.length),_=y.length-1;_>=0&&y[_].end>g;)y[_].end=g,_--}if(void 0!==d)u=Math.max(m,d);else{if(y.length<=0)return void a.Z.warn("HTSB: Current text tracks have no cues nor start time. Aborting");a.Z.warn("HTSB: No start time given. Guessing from cues."),u=y[0].start}if(void 0!==c)l=Math.min(g,c);else{if(y.length<=0)return void a.Z.warn("HTSB: Current text tracks have no cues nor end time. Aborting");a.Z.warn("HTSB: No end time given. Guessing from cues."),l=y[y.length-1].end}l<=u?a.Z.warn("HTSB: Invalid text track appended: ","the start time is inferior or equal to the end time."):(null!==e.inventoryInfos&&this._segmentInventory.insertChunk(e.inventoryInfos),this._buffer.insert(y,u,l),this._buffered.insert(u,l))}},n.removeBufferSync=function(e,t){a.Z.debug("HTSB: Removing html text track data",e,t),this._buffer.remove(e,t),this._buffered.remove(e,t)},n._disableCurrentCues=function(){if(this._sizeUpdateCanceller.cancel(),this._currentCues.length>0){for(var e=0;e0){this._sizeUpdateCanceller=new l.ZP,this._sizeUpdateCanceller.linkToSignal(this._canceller.signal);var c=u.Z.getCurrent().TEXT_TRACK_SIZE_CHECKS_INTERVAL,f=function(e,t,n){var r=e.getBoundingClientRect(),i=r.height,u=r.width,l=(0,o.ZP)({height:i,width:u},n),d=i,c=u;if(void 0!==s){var f=new s((function(e){if(0!==e.length){var t=e[0].contentRect,n=t.height,r=t.width;n===d&&r===c||(d=n,c=r,l.setValue({height:n,width:r}))}else a.Z.error("Compat: Resized but no observed element.")}));f.observe(e),n.register((function(){f.disconnect()}))}else{var v=setInterval((function(){var t=e.getBoundingClientRect(),n=t.height,r=t.width;n===d&&r===c||(d=n,c=r,l.setValue({height:n,width:r}))}),t);n.register((function(){clearInterval(v)}))}return l}(this._textTrackElement,c,this._sizeUpdateCanceller.signal);f.onUpdate((function(e){for(var t=e.height,n=e.width,r=0;r0?e.textTracks[u-1]:e.addTextTrack(s)).mode=t?null!==(n=a.HIDDEN)&&void 0!==n?n:"hidden":null!==(r=a.SHOWING)&&void 0!==r?r:"showing"}else o=document.createElement("track"),e.appendChild(o),a=o.track,o.kind=s,a.mode=t?"hidden":"showing";return{track:a,trackElement:o}}(t,n),s=o.track,l=o.trackElement;return r.bufferType="text",r._buffered=new u.Z,r._videoElement=t,r._track=s,r._trackElement=l,r}(0,r.Z)(t,e);var n=t.prototype;return n.pushChunk=function(e){var t,n;if(a.Z.debug("NTSB: Appending new native text tracks"),null===e.data.chunk)return Promise.resolve();var r=e.data,i=r.timestampOffset,o=r.appendWindow,s=r.chunk,u=s.start,d=s.end,c=s.data,f=s.type,v=s.language,p=null!==(t=o[0])&&void 0!==t?t:0,h=null!==(n=o[1])&&void 0!==n?n:1/0;try{var m,g,y=function(e,t,n,r){a.Z.debug("NTSB: Finding parser for native text tracks:",e);var i=l.Z.nativeTextTracksParsers[e];if("function"!=typeof i)throw new Error("no parser found for the given text track");a.Z.debug("NTSB: Parser found, parsing...");var o=i(t,n,r);return a.Z.debug("NTSB: Parsed successfully!",o.length),o}(f,c,i,v);if(0!==p&&h!==1/0){for(var _=0;_=0&&y[_].startTime>=h;)_--;for(y.splice(_,y.length),_=y.length-1;_>=0&&y[_].endTime>h;)y[_].endTime=h,_--}if(void 0!==u)m=Math.max(p,u);else{if(y.length<=0)return a.Z.warn("NTSB: Current text tracks have no cues nor start time. Aborting"),Promise.resolve();a.Z.warn("NTSB: No start time given. Guessing from cues."),m=y[0].startTime}if(void 0!==d)g=Math.min(h,d);else{if(y.length<=0)return a.Z.warn("NTSB: Current text tracks have no cues nor end time. Aborting"),Promise.resolve();a.Z.warn("NTSB: No end time given. Guessing from cues."),g=y[y.length-1].endTime}if(g<=m)return a.Z.warn("NTSB: Invalid text track appended: ","the start time is inferior or equal to the end time."),Promise.resolve();if(y.length>0){var b=y[0],S=this._track.cues;null!==S&&S.length>0&&b.startTime=0;i--){var s=r[i],u=s.startTime,l=s.endTime;u>=e&&u<=t&&l<=t&&o(n,s)}this._buffered.remove(e,t)},t}(s.C)},9612:function(e,t,n){"use strict";n.d(t,{C:function(){return _},f:function(){return g}});var r=n(6872),i=n(3887),a=n(520),o=n(5278);function s(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return u(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&(this._history=this._history.splice(r)),this._history.length>this._maxHistoryLength){var a=this._history.length-this._maxHistoryLength;this._history=this._history.splice(a)}},e}();function d(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return c(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return c(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0){var _=t[p+y-1];g={end:(0,o.Z)(_.bufferedEnd,_.end),precizeEnd:_.precizeEnd},i.Z.debug("SI: "+y+" segments GCed.",u);for(var b,S=d(t.splice(p,y));!(b=S()).done;){var T=b.value;void 0===T.bufferedStart&&void 0===T.bufferedEnd&&this._bufferedHistory.addBufferedSegment(T.infos,null)}n=p}if(void 0===a)return;if(v-(0,o.Z)(a.bufferedStart,a.start)>=s){if(h(a,f,g,u),n===t.length-1)return void m(a,v,u);a=t[++n];for(var E=(0,o.Z)(a.bufferedStart,a.start),k=(0,o.Z)(a.bufferedEnd,a.end),w=c=s&&(void 0===w||v-E>=k-w);){var A=t[n-1];void 0===A.bufferedEnd&&(A.bufferedEnd=a.precizeStart?a.start:A.end,i.Z.debug("SI: calculating buffered end of contiguous segment",u,A.bufferedEnd,A.end)),a.bufferedStart=A.bufferedEnd,void 0!==(a=t[++n])&&(E=(0,o.Z)(a.bufferedStart,a.start),k=(0,o.Z)(a.bufferedEnd,a.end))}}var I=t[n-1];void 0!==I&&m(I,v,u)}}if(null!=a){i.Z.debug("SI: last segments have been GCed",u,n,t.length);for(var Z,R=d(t.splice(n,t.length-n));!(Z=R()).done;){var x=Z.value;void 0===x.bufferedStart&&void 0===x.bufferedEnd&&this._bufferedHistory.addBufferedSegment(x.infos,null)}}void 0!==u&&i.Z.hasLevel("DEBUG")&&i.Z.debug("SI: current "+u+" inventory timeline:\n"+function(e){var t=1/60,n={},r=[],i=null,a=null;function o(e){var t=String.fromCharCode(r.length+65);return r.push({letter:t,periodId:e.period.id,representationId:e.representation.id,bitrate:e.representation.bitrate}),t}for(var s="",u=0;u=u)i.Z.warn("SI: Invalid chunked inserted: starts before it ends",l,s,u);else{for(var d=this._inventory,c={partiallyPushed:!0,chunkSize:o,splitted:!1,start:s,end:u,precizeStart:!1,precizeEnd:!1,bufferedStart:void 0,bufferedEnd:void 0,infos:{segment:a,period:t,adaptation:n,representation:r}},f=d.length-1;f>=0;f--){var v=d[f];if(v.start<=s){if(v.end<=s){for(i.Z.debug("SI: Pushing segment strictly after previous one.",l,s,v.end),this._inventory.splice(f+1,0,c),f+=2;fc.end)return i.Z.debug("SI: Segment pushed updates the start of the next one",l,c.end,d[f].start),d[f].start=c.end,d[f].bufferedStart=void 0,void(d[f].precizeStart=d[f].precizeStart&&c.precizeEnd);i.Z.debug("SI: Segment pushed removes the next one",l,s,u,d[f].start,d[f].end),d.splice(f,1)}return}if(v.start===s){if(v.end<=u){for(i.Z.debug("SI: Segment pushed replace another one",l,s,u,v.end),this._inventory.splice(f,1,c),f+=1;fc.end)return i.Z.debug("SI: Segment pushed updates the start of the next one",l,c.end,d[f].start),d[f].start=c.end,d[f].bufferedStart=void 0,void(d[f].precizeStart=d[f].precizeStart&&c.precizeEnd);i.Z.debug("SI: Segment pushed removes the next one",l,s,u,d[f].start,d[f].end),d.splice(f,1)}return}return i.Z.debug("SI: Segment pushed ends before another with the same start",l,s,u,v.end),d.splice(f,0,c),v.start=c.end,v.bufferedStart=void 0,void(v.precizeStart=v.precizeStart&&c.precizeEnd)}if(v.end<=c.end){for(i.Z.debug("SI: Segment pushed updates end of previous one",l,s,u,v.start,v.end),this._inventory.splice(f+1,0,c),v.end=c.start,v.bufferedEnd=void 0,v.precizeEnd=v.precizeEnd&&c.precizeStart,f+=2;fc.end)return i.Z.debug("SI: Segment pushed updates the start of the next one",l,c.end,d[f].start),d[f].start=c.end,d[f].bufferedStart=void 0,void(d[f].precizeStart=d[f].precizeStart&&c.precizeEnd);i.Z.debug("SI: Segment pushed removes the next one",l,s,u,d[f].start,d[f].end),d.splice(f,1)}return}i.Z.warn("SI: Segment pushed is contained in a previous one",l,s,u,v.start,v.end);var p={partiallyPushed:v.partiallyPushed,chunkSize:v.chunkSize,splitted:!0,start:c.end,end:v.end,precizeStart:v.precizeStart&&v.precizeEnd&&c.precizeEnd,precizeEnd:v.precizeEnd,bufferedStart:void 0,bufferedEnd:v.end,infos:v.infos};return v.end=c.start,v.splitted=!0,v.bufferedEnd=void 0,v.precizeEnd=v.precizeEnd&&c.precizeStart,d.splice(f+1,0,c),void d.splice(f+2,0,p)}}var h=this._inventory[0];if(void 0===h)return i.Z.debug("SI: first segment pushed",l,s,u),void this._inventory.push(c);if(!(h.start>=u)){if(h.end<=u){for(i.Z.debug("SI: Segment pushed starts before and completely recovers the previous first one",l,s,u,h.start,h.end),this._inventory.splice(0,1,c);d.length>1&&d[1].startc.end)return i.Z.debug("SI: Segment pushed updates the start of the next one",l,c.end,d[1].start),d[1].start=c.end,d[1].bufferedStart=void 0,void(d[1].precizeStart=c.precizeEnd);i.Z.debug("SI: Segment pushed removes the next one",l,s,u,d[1].start,d[1].end),d.splice(1,1)}return}return i.Z.debug("SI: Segment pushed start of the next one",l,s,u,h.start,h.end),h.start=u,h.bufferedStart=void 0,h.precizeStart=c.precizeEnd,void this._inventory.splice(0,0,c)}i.Z.debug("SI: Segment pushed comes before all previous ones",l,s,u,h.start),this._inventory.splice(0,0,c)}}},t.completeSegment=function(e,t){if(!e.segment.isInit){for(var n=this._inventory,r=[],o=0;o0&&(s=!0,1===r.length&&(i.Z.warn("SI: Completed Segment is splitted.",e.segment.id,e.segment.time,e.segment.end),r[0].splitted=!0));var u=o,l=n[o].chunkSize;for(o+=1;o0&&(this._inventory.splice(u+1,v),o-=v),this._inventory[u].partiallyPushed=!1,this._inventory[u].chunkSize=l,this._inventory[u].end=p,this._inventory[u].bufferedEnd=h,this._inventory[u].splitted=s,r.push(this._inventory[u])}if(0===r.length)i.Z.warn("SI: Completed Segment not found",e.segment.id,e.segment.time);else{this.synchronizeBuffered(t);for(var m,g=d(r);!(m=g()).done;){var y=m.value;void 0!==y.bufferedStart&&void 0!==y.bufferedEnd?this._bufferedHistory.addBufferedSegment(y.infos,{start:y.bufferedStart,end:y.bufferedEnd}):i.Z.debug("SI: buffered range not known after sync. Skipping history.",y.start,y.end)}}}},t.getInventory=function(){return this._inventory},t.getHistoryFor=function(e){return this._bufferedHistory.getHistoryFor(e)},e}();function v(e){if(void 0===e.bufferedStart||e.partiallyPushed)return!1;var t=e.start,n=e.end-t,i=r.Z.getCurrent(),a=i.MAX_MANIFEST_BUFFERED_START_END_DIFFERENCE,o=i.MAX_MANIFEST_BUFFERED_DURATION_DIFFERENCE;return Math.abs(t-e.bufferedStart)<=a&&(void 0===e.bufferedEnd||e.bufferedEnd>e.bufferedStart&&Math.abs(e.bufferedEnd-e.bufferedStart-n)<=Math.min(o,n/3))}function p(e){if(void 0===e.bufferedEnd||e.partiallyPushed)return!1;var t=e.start,n=e.end,i=n-t,a=r.Z.getCurrent(),o=a.MAX_MANIFEST_BUFFERED_START_END_DIFFERENCE,s=a.MAX_MANIFEST_BUFFERED_DURATION_DIFFERENCE;return Math.abs(n-e.bufferedEnd)<=o&&null!=e.bufferedStart&&e.bufferedEnd>e.bufferedStart&&Math.abs(e.bufferedEnd-e.bufferedStart-i)<=Math.min(s,i/3)}function h(e,t,n,a){var o=r.Z.getCurrent().MAX_MANIFEST_BUFFERED_START_END_DIFFERENCE;void 0!==e.bufferedStart?(e.bufferedStartt&&(n.precizeEnd||e.start-n.end<=o)?(i.Z.debug("SI: buffered start is end of previous segment",a,t,e.start,n.end),e.bufferedStart=n.end,v(e)&&(e.start=n.end,e.precizeStart=!0)):e.start-t<=o?(i.Z.debug("SI: found true buffered start",a,t,e.start),e.bufferedStart=t,v(e)&&(e.start=t,e.precizeStart=!0)):tt&&(i.Z.debug("SI: Segment partially GCed at the end",n,e.bufferedEnd,t),e.bufferedEnd=t),!e.precizeEnd&&t-e.end<=a&&p(e)&&(e.precizeEnd=!0,e.end=t)):e.precizeEnd?(i.Z.debug("SI: buffered end is precize end",n,e.end),e.bufferedEnd=e.end):t-e.end<=a?(i.Z.debug("SI: found true buffered end",n,t,e.end),e.bufferedEnd=t,p(e)&&(e.end=t,e.precizeEnd=!0)):t>e.end?(i.Z.debug("SI: range end too far from expected end",n,t,e.end),e.bufferedEnd=e.end):(i.Z.debug("SI: Segment appears immediately garbage collected at the end",n,e.bufferedEnd,t),e.bufferedEnd=t)}var g,y=f,_=function(){function e(){this._segmentInventory=new y}var t=e.prototype;return t.synchronizeInventory=function(){this._segmentInventory.synchronizeBuffered(this.getBufferedRanges())},t.getInventory=function(){return this._segmentInventory.getInventory()},t.getPendingOperations=function(){return[]},t.getSegmentHistory=function(e){return this._segmentInventory.getHistoryFor(e)},e}();!function(e){e[e.Push=0]="Push",e[e.Remove=1]="Remove",e[e.EndOfSegment=2]="EndOfSegment"}(g||(g={}))},4309:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(2829),i=function(){function e(){this._ranges=[],this.length=0}var t=e.prototype;return t.insert=function(e,t){(0,r.kR)(this._ranges,{start:e,end:t}),this.length=this._ranges.length},t.remove=function(e,t){var n=[];e>0&&n.push({start:0,end:e}),t<1/0&&n.push({start:t,end:1/0}),this._ranges=(0,r.tn)(this._ranges,n),this.length=this._ranges.length},t.start=function(e){if(e>=this._ranges.length)throw new Error("INDEX_SIZE_ERROR");return this._ranges[e].start},t.end=function(e){if(e>=this._ranges.length)throw new Error("INDEX_SIZE_ERROR");return this._ranges[e].end},e}()},7839:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(7326),i=n(4578),a=function(e){function t(n,i,a,o){var s;return s=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(s),t.prototype),s.name="CustomLoaderError",s.message=n,s.canRetry=i,s.isOfflineError=a,s.xhr=o,s}return(0,i.Z)(t,e),t}((0,n(2146).Z)(Error))},5157:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r=n(7326),i=n(4578),a=n(2146),o=n(5992),s=n(7367),u=function(e){function t(n,i,a){var u;return u=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(u),t.prototype),u.name="EncryptedMediaError",u.type=o.ZB.ENCRYPTED_MEDIA_ERROR,u.code=n,u.message=(0,s.Z)(u.name,u.code,i),u.fatal=!1,"string"==typeof(null==a?void 0:a.keyStatuses)&&(u.keyStatuses=a.keyStatuses),u}return(0,i.Z)(t,e),t}((0,a.Z)(Error))},5992:function(e,t,n){"use strict";n.d(t,{SM:function(){return a},ZB:function(){return r},br:function(){return i}});var r={NETWORK_ERROR:"NETWORK_ERROR",MEDIA_ERROR:"MEDIA_ERROR",ENCRYPTED_MEDIA_ERROR:"ENCRYPTED_MEDIA_ERROR",OTHER_ERROR:"OTHER_ERROR"},i={TIMEOUT:"TIMEOUT",ERROR_EVENT:"ERROR_EVENT",ERROR_HTTP_CODE:"ERROR_HTTP_CODE",PARSE_ERROR:"PARSE_ERROR"},a={PIPELINE_LOAD_ERROR:"PIPELINE_LOAD_ERROR",PIPELINE_PARSE_ERROR:"PIPELINE_PARSE_ERROR",INTEGRITY_ERROR:"INTEGRITY_ERROR",MANIFEST_PARSE_ERROR:"MANIFEST_PARSE_ERROR",MANIFEST_INCOMPATIBLE_CODECS_ERROR:"MANIFEST_INCOMPATIBLE_CODECS_ERROR",MANIFEST_UPDATE_ERROR:"MANIFEST_UPDATE_ERROR",MANIFEST_UNSUPPORTED_ADAPTATION_TYPE:"MANIFEST_UNSUPPORTED_ADAPTATION_TYPE",MEDIA_STARTING_TIME_NOT_FOUND:"MEDIA_STARTING_TIME_NOT_FOUND",MEDIA_TIME_BEFORE_MANIFEST:"MEDIA_TIME_BEFORE_MANIFEST",MEDIA_TIME_AFTER_MANIFEST:"MEDIA_TIME_AFTER_MANIFEST",MEDIA_TIME_NOT_FOUND:"MEDIA_TIME_NOT_FOUND",NO_PLAYABLE_REPRESENTATION:"NO_PLAYABLE_REPRESENTATION",MEDIA_IS_ENCRYPTED_ERROR:"MEDIA_IS_ENCRYPTED_ERROR",CREATE_MEDIA_KEYS_ERROR:"CREATE_MEDIA_KEYS_ERROR",KEY_ERROR:"KEY_ERROR",KEY_STATUS_CHANGE_ERROR:"KEY_STATUS_CHANGE_ERROR",KEY_UPDATE_ERROR:"KEY_UPDATE_ERROR",KEY_LOAD_ERROR:"KEY_LOAD_ERROR",KEY_LOAD_TIMEOUT:"KEY_LOAD_TIMEOUT",KEY_GENERATE_REQUEST_ERROR:"KEY_GENERATE_REQUEST_ERROR",INCOMPATIBLE_KEYSYSTEMS:"INCOMPATIBLE_KEYSYSTEMS",INVALID_ENCRYPTED_EVENT:"INVALID_ENCRYPTED_EVENT",INVALID_KEY_SYSTEM:"INVALID_KEY_SYSTEM",LICENSE_SERVER_CERTIFICATE_ERROR:"LICENSE_SERVER_CERTIFICATE_ERROR",MULTIPLE_SESSIONS_SAME_INIT_DATA:"MULTIPLE_SESSIONS_SAME_INIT_DATA",BUFFER_APPEND_ERROR:"BUFFER_APPEND_ERROR",BUFFER_FULL_ERROR:"BUFFER_FULL_ERROR",BUFFER_TYPE_UNKNOWN:"BUFFER_TYPE_UNKNOWN",MEDIA_ERR_BLOCKED_AUTOPLAY:"MEDIA_ERR_BLOCKED_AUTOPLAY",MEDIA_ERR_PLAY_NOT_ALLOWED:"MEDIA_ERR_PLAY_NOT_ALLOWED",MEDIA_ERR_NOT_LOADED_METADATA:"MEDIA_ERR_NOT_LOADED_METADATA",MEDIA_ERR_ABORTED:"MEDIA_ERR_ABORTED",MEDIA_ERR_NETWORK:"MEDIA_ERR_NETWORK",MEDIA_ERR_DECODE:"MEDIA_ERR_DECODE",MEDIA_ERR_SRC_NOT_SUPPORTED:"MEDIA_ERR_SRC_NOT_SUPPORTED",MEDIA_ERR_UNKNOWN:"MEDIA_ERR_UNKNOWN",MEDIA_SOURCE_NOT_SUPPORTED:"MEDIA_SOURCE_NOT_SUPPORTED",MEDIA_KEYS_NOT_SUPPORTED:"MEDIA_KEYS_NOT_SUPPORTED",DISCONTINUITY_ENCOUNTERED:"DISCONTINUITY_ENCOUNTERED",NONE:"NONE"}},7367:function(e,t,n){"use strict";function r(e,t,n){return e+" ("+t+") "+n}n.d(t,{Z:function(){return r}})},8750:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(9822),i=n(5389);function a(e,t){var n=t.defaultCode,a=t.defaultReason;if((0,r.Z)(e))return e;var o=e instanceof Error?e.toString():a;return new i.Z(n,o)}},9822:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r=n(5157),i=n(5992),a=n(3714),o=n(9362),s=n(5389);function u(e){return(e instanceof r.Z||e instanceof a.Z||e instanceof s.Z||e instanceof o.Z)&&Object.keys(i.ZB).indexOf(e.type)>=0}},3714:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r=n(7326),i=n(4578),a=n(2146),o=n(5992),s=n(7367),u=function(e){function t(n,i,a){var u;u=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(u),t.prototype),u.name="MediaError",u.type=o.ZB.MEDIA_ERROR,u.code=n,u.message=(0,s.Z)(u.name,u.code,i),u.fatal=!1;var l=null==a?void 0:a.adaptation;if(void 0!==l)switch(l.type){case"audio":u.trackInfo={type:"audio",track:l.toAudioTrack()};break;case"video":u.trackInfo={type:"video",track:l.toVideoTrack()};break;case"text":u.trackInfo={type:"text",track:l.toTextTrack()}}return u}return(0,i.Z)(t,e),t}((0,a.Z)(Error))},9362:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r=n(7326),i=n(4578),a=n(2146),o=n(5992),s=n(7367),u=function(e){function t(n,i){var a;return a=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(a),t.prototype),a.name="NetworkError",a.type=o.ZB.NETWORK_ERROR,a.xhr=void 0===i.xhr?null:i.xhr,a.url=i.url,a.status=i.status,a.errorType=i.type,a.code=n,a.message=(0,s.Z)(a.name,a.code,i.message),a.fatal=!1,a}return(0,i.Z)(t,e),t.prototype.isHttpError=function(e){return this.errorType===o.br.ERROR_HTTP_CODE&&this.status===e},t}((0,a.Z)(Error))},5389:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r=n(7326),i=n(4578),a=n(2146),o=n(5992),s=n(7367),u=function(e){function t(n,i){var a;return a=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(a),t.prototype),a.name="OtherError",a.type=o.ZB.OTHER_ERROR,a.code=n,a.message=(0,s.Z)(a.name,a.code,i),a.fatal=!1,a}return(0,i.Z)(t,e),t}((0,a.Z)(Error))},9105:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(7326),i=n(4578),a=function(e){function t(n,i,a,o){var s;return s=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(s),t.prototype),s.name="RequestError",s.url=n,void 0!==o&&(s.xhr=o),s.status=i,s.type=a,s.message=a,s}return(0,i.Z)(t,e),t}((0,n(2146).Z)(Error))},7273:function(e,t){"use strict";t.Z={dashParsers:{wasm:null,js:null},createDebugElement:null,directfile:null,decrypt:null,htmlTextTracksBuffer:null,htmlTextTracksParsers:{},imageBuffer:null,imageParser:null,nativeTextTracksBuffer:null,nativeTextTracksParsers:{},transports:{}}},7874:function(e,t,n){"use strict";var r=n(7273);t.Z=r.Z},3887:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(8894),i=new(function(){function e(){this.error=r.Z,this.warn=r.Z,this.info=r.Z,this.debug=r.Z,this._levels={NONE:0,ERROR:1,WARNING:2,INFO:3,DEBUG:4},this._currentLevel="NONE"}var t=e.prototype;return t.setLevel=function(e){var t,n=this._levels[e];"number"==typeof n?(t=n,this._currentLevel=e):(t=0,this._currentLevel="NONE"),this.error=t>=this._levels.ERROR?console.error.bind(console):r.Z,this.warn=t>=this._levels.WARNING?console.warn.bind(console):r.Z,this.info=t>=this._levels.INFO?console.info.bind(console):r.Z,this.debug=t>=this._levels.DEBUG?console.log.bind(console):r.Z},t.getLevel=function(){return this._currentLevel},t.hasLevel=function(e){return this._levels[e]>=this._levels[this._currentLevel]},e}())},8999:function(e,t,n){"use strict";n.d(t,{r:function(){return v},Z:function(){return p}});var r=n(3887),i=n(3274),a=n(1946),o=n(7829);var s="undefined"!=typeof window&&"function"==typeof window.Set&&"function"==typeof Array.from?function(e){return Array.from(new Set(e))}:function(e){return e.filter((function(e,t,n){return n.indexOf(e)===t}))},u=n(3774);var l=n(4791);function d(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return c(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return c(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&(this.trickModeTracks=i.map((function(t){return new e(t)})));for(var d=t.representations,c=[],v=!1,p=0;p0&&!r.isSupported){var i=new a.Z("MANIFEST_INCOMPATIBLE_CODECS_ERROR","An Adaptation contains only incompatible codecs.",{adaptation:r});n.contentWarnings.push(i)}return r})).filter((function(e){return e.representations.length>0}));if(s.every((function(e){return!e.isSupported}))&&o.length>0&&("video"===i||"audio"===i))throw new a.Z("MANIFEST_PARSE_ERROR","No supported "+i+" adaptations");return s.length>0&&(r[i]=s),r}),{}),!Array.isArray(this.adaptations.video)&&!Array.isArray(this.adaptations.audio))throw new a.Z("MANIFEST_PARSE_ERROR","No supported audio and video tracks.");this.duration=e.duration,this.start=e.start,null!=this.duration&&null!=this.start&&(this.end=this.start+this.duration),this.streamEvents=void 0===e.streamEvents?[]:e.streamEvents}var t=e.prototype;return t.getAdaptations=function(){var e=this.adaptations;return(0,v.Z)(e).reduce((function(e,t){return null!=t?e.concat(t):e}),[])},t.getAdaptationsForType=function(e){var t=this.adaptations[e];return null==t?[]:t},t.getAdaptation=function(e){return(0,s.Z)(this.getAdaptations(),(function(t){var n=t.id;return e===n}))},t.getSupportedAdaptations=function(e){if(void 0===e)return this.getAdaptations().filter((function(e){return e.isSupported}));var t=this.adaptations[e];return void 0===t?[]:t.filter((function(e){return e.isSupported}))},t.containsTime=function(e){return e>=this.start&&(void 0===this.end||e=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0)o.Z.warn("Manifest: "+y.length+" new Representations found when merging."),(h=t.representations).push.apply(h,y),v.push.apply(v,y)}l=e},l=0;l0){o.Z.warn("Manifest: "+s.length+" new Adaptations found when merging.");for(var d,c=g(s);!(d=c()).done;){var f=d.value,v=e.adaptations[f.type];void 0===v?e.adaptations[f.type]=[f]:v.push(f),i.addedAdaptations.push(f)}}return i}function b(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return S(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return S(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function S(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&r._addSupplementaryImageAdaptations(u),o.length>0&&r._addSupplementaryTextAdaptations(o),r}(0,i.Z)(t,e);var n=t.prototype;return n.getPeriod=function(e){return(0,s.Z)(this.periods,(function(t){return e===t.id}))},n.getPeriodForTime=function(e){return(0,s.Z)(this.periods,(function(t){return e>=t.start&&(void 0===t.end||t.end>e)}))},n.getNextPeriod=function(e){return(0,s.Z)(this.periods,(function(t){return t.start>e}))},n.getPeriodAfter=function(e){var t=e.end;if(void 0===t)return null;var n=(0,s.Z)(this.periods,(function(e){return void 0===e.end||t0&&this.trigger("decipherabilityUpdate",t)},n.getAdaptations=function(){(0,c.Z)("manifest.getAdaptations() is deprecated. Please use manifest.period[].getAdaptations() instead");var e=this.periods[0];if(void 0===e)return[];var t=e.adaptations,n=[];for(var r in t)if(t.hasOwnProperty(r)){var i=t[r];n.push.apply(n,i)}return n},n.getAdaptationsForType=function(e){(0,c.Z)("manifest.getAdaptationsForType(type) is deprecated. Please use manifest.period[].getAdaptationsForType(type) instead");var t=this.periods[0];if(void 0===t)return[];var n=t.adaptations[e];return void 0===n?[]:n},n.getAdaptation=function(e){return(0,c.Z)("manifest.getAdaptation(id) is deprecated. Please use manifest.period[].getAdaptation(id) instead"),(0,s.Z)(this.getAdaptations(),(function(t){var n=t.id;return e===n}))},n._addSupplementaryImageAdaptations=function(e){var t=this,n=(Array.isArray(e)?e:[e]).map((function(e){var n=e.mimeType,r=e.url,i="gen-image-ada-"+T(),o="gen-image-rep-"+T(),s=(0,d.$)(r),u=r.substring(0,s),l=r.substring(s),c=new f.Z({id:i,type:"image",representations:[{bitrate:0,cdnMetadata:[{baseUrl:u}],id:o,mimeType:n,index:new h({media:l})}]},{isManuallyAdded:!0});if(c.representations.length>0&&!c.isSupported){var v=new a.Z("MANIFEST_INCOMPATIBLE_CODECS_ERROR","An Adaptation contains only incompatible codecs.",{adaptation:c});t.contentWarnings.push(v)}return c}));if(n.length>0&&this.periods.length>0){var r=this.periods[0].adaptations;r.image=null!=r.image?r.image.concat(n):n}},n._addSupplementaryTextAdaptations=function(e){var t=this,n=(Array.isArray(e)?e:[e]).reduce((function(e,n){var r=n.mimeType,i=n.codecs,o=n.url,s=n.language,u=n.languages,l=n.closedCaption,c=null!=s?[s]:null!=u?u:[],v=(0,d.$)(o),p=o.substring(0,v),m=o.substring(v);return e.concat(c.map((function(e){var n="gen-text-ada-"+T(),o="gen-text-rep-"+T(),s=new f.Z({id:n,type:"text",language:e,closedCaption:l,representations:[{bitrate:0,cdnMetadata:[{baseUrl:p}],id:o,mimeType:r,codecs:i,index:new h({media:m})}]},{isManuallyAdded:!0});if(s.representations.length>0&&!s.isSupported){var u=new a.Z("MANIFEST_INCOMPATIBLE_CODECS_ERROR","An Adaptation contains only incompatible codecs.",{adaptation:s});t.contentWarnings.push(u)}return s})))}),[]);if(n.length>0&&this.periods.length>0){var r=this.periods[0].adaptations;r.text=null!=r.text?r.text.concat(n):n}},n._performUpdate=function(e,t){var n;if(this.availabilityStartTime=e.availabilityStartTime,this.expired=e.expired,this.isDynamic=e.isDynamic,this.isLive=e.isLive,this.isLastPeriodKnown=e.isLastPeriodKnown,this.lifetime=e.lifetime,this.contentWarnings=e.contentWarnings,this.suggestedPresentationDelay=e.suggestedPresentationDelay,this.transport=e.transport,this.publishTime=e.publishTime,t===r.Full)this._timeBounds=e._timeBounds,this.uris=e.uris,n=function(e,t){for(var n={updatedPeriods:[],addedPeriods:[],removedPeriods:[]},i=0,a=0;ae.length)return o.Z.error("Manifest: error when updating Periods"),n;if(i0&&(e.push.apply(e,b),(y=n.addedPeriods).push.apply(y,b)),n}(this.periods,e.periods);else{this._timeBounds.maximumTimeData=e._timeBounds.maximumTimeData,this.updateUrl=e.uris[0],n=function(e,t){var n,i={updatedPeriods:[],addedPeriods:[],removedPeriods:[]};if(0===e.length)return e.splice.apply(e,[0,0].concat(t)),(n=i.addedPeriods).push.apply(n,t),i;if(0===t.length)return i;var s=e[e.length-1];if(s.startc){var E;o.Z.warn("Manifest: old Periods not found in new when updating, removing");var k=e.splice(c,p-c);(E=i.removedPeriods).push.apply(E,k),p=c}var w=_(e[p],v,r.Full);i.updatedPeriods.push({period:e[p],result:w})}c++}if(c0;){var s=this.periods[0];if(void 0===s.end||s.end>i)break;this.periods.shift()}}this.adaptations=void 0===this.periods[0]?{}:this.periods[0].adaptations,this.trigger("manifestUpdate",n)},t}(u.Z);var w=k},520:function(e,t,n){"use strict";n.d(t,{K:function(){return a},z:function(){return i}});var r=n(1946);function i(e,t){return e.segment.id===t.segment.id&&e.representation.id===t.representation.id&&e.adaptation.id===t.adaptation.id&&e.period.id===t.period.id}function a(e){if((0,r.Z)(e))return"";var t=e.period,n=e.adaptation,i=e.representation,a=e.segment;return n.type+" P: "+t.id+" A: "+n.id+" R: "+i.id+" S: "+(a.isInit?"init":a.complete?a.time+"-"+a.duration:""+a.time)}},2689:function(e,t,n){"use strict";n.d(t,{s:function(){return r}});var r=Math.pow(2,32)-1},2297:function(e,t,n){"use strict";n.d(t,{Qy:function(){return f},Xj:function(){return p},iz:function(){return c},lp:function(){return d},nR:function(){return v},t_:function(){return l},vA:function(){return u}});var r=n(3887),i=n(811),a=n(6968);function o(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return s(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return s(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);ni)return null;s=(0,a.pV)(e,r),r+=8}if(s<0)throw new Error("ISOBMFF: Size out of range");if(n===t)return 1970628964===t&&(r+=16),[o,r,o+s];o+=s}return null}function v(e,t,n,r,i){for(var o,s=e.length,u=0;us)return;o=(0,a.pV)(e,l),l+=8}if(1970628964===d&&l+16<=s&&(0,a.pX)(e,l)===t&&(0,a.pX)(e,l+4)===n&&(0,a.pX)(e,l+8)===r&&(0,a.pX)(e,l+12)===i)return l+=16,e.subarray(l,u+o)}}function p(e){var t=e.length;if(t<8)return r.Z.warn("ISOBMFF: box inferior to 8 bytes, cannot find offsets"),null;var n=0,i=(0,a.pX)(e,n);n+=4;var o=(0,a.pX)(e,n);if(n+=4,0===i)i=t;else if(1===i){if(n+8>t)return r.Z.warn("ISOBMFF: box too short, cannot find offsets"),null;i=(0,a.pV)(e,n),n+=8}if(i<0)throw new Error("ISOBMFF: Size out of range");return 1970628964===o&&(n+=16),[0,n,i]}},6807:function(e,t,n){"use strict";n.d(t,{E3:function(){return u},Le:function(){return o},XA:function(){return i},fs:function(){return s},uq:function(){return a}});var r=n(2297);function i(e){var t=(0,r.t_)(e,1836019558);return null===t?null:(0,r.t_)(t,1953653094)}function a(e){return(0,r.lp)(e,1836019558).reduce((function(e,t){var n=(0,r.t_)(t,1953653094);return null!==n&&e.push(n),e}),[])}function o(e){return(0,r.t_)(e,1835295092)}function s(e){var t=(0,r.t_)(e,1836019574);if(null===t)return null;var n=(0,r.t_)(t,1953653099);return null===n?null:(0,r.t_)(n,1835297121)}function u(e,t){return void 0===t&&(t=0),(0,r.t_)(e.subarray(t),1701671783)}},6490:function(e,t,n){"use strict";n.d(t,{Z:function(){return s},Y:function(){return u}});var r=n(3887);var i="function"==typeof Uint8Array.prototype.slice?function(e,t,n){return e.slice(t,n)}:function(e,t,n){return new Uint8Array(Array.prototype.slice.call(e,t,n))},a=n(3635),o=n(2297);function s(e){var t=0,n=(0,o.t_)(e,1836019574);if(null===n)return[];for(var a=[];t1)r.Z.warn("ISOBMFF: un-handled PSSH version");else{var n=t+4;if(!(n+16>e.length)){var o=i(e,n,n+16);return(0,a.ci)(o)}}}},4644:function(e,t,n){"use strict";n.d(t,{J6:function(){return m},LD:function(){return h},MM:function(){return p},Qx:function(){return f},R0:function(){return y},Wf:function(){return c},s9:function(){return g}});var r=n(3887),i=n(6968),a=n(3635),o=n(2689),s=n(2297),u=n(6807);function l(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return d(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return d(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0;){var v=(0,i.pX)(e,o);o+=4;var p=2147483647&v;if(1===(2147483648&v)>>>31)throw new Error("sidx with reference_type `1` not yet implemented");var h=(0,i.pX)(e,o);o+=4,o+=4,c.push({time:l,duration:h,timescale:d,range:[r,r+p-1]}),l+=h,r+=p}return c}function f(e){var t=(0,u.XA)(e);if(null!==t){var n=(0,s.t_)(t,1952867444);if(null!==n){var r=n[0];return 1===r?(0,i.pV)(n,4):0===r?(0,i.pX)(n,4):void 0}}}function v(e){var t=(0,s.t_)(e,1952868452);if(null!==t){var n=1,r=(0,i.QI)(t,n);if(n+=3,(8&r)>0)return n+=4,(1&r)>0&&(n+=8),(2&r)>0&&(n+=4),(0,i.pX)(t,n)}}function p(e){var t=(0,u.uq)(e);if(0!==t.length){for(var n,r=0,a=l(t);!(n=a()).done;){var o=n.value,d=(0,s.t_)(o,1953658222);if(null===d)return;var c=0,f=d[c];if(c+=1,f>1)return;var p=(0,i.QI)(d,c);c+=3;var h=(256&p)>0,m=0;if(!h&&void 0===(m=v(o)))return;var g=(1&p)>0,y=(4&p)>0,_=(512&p)>0,b=(1024&p)>0,S=(2048&p)>0,T=(0,i.pX)(d,c);c+=4,g&&(c+=4),y&&(c+=4);for(var E=T,k=0;E-- >0;)h?(k+=(0,i.pX)(d,c),c+=4):k+=m,_&&(c+=4),b&&(c+=4),S&&(c+=4);r+=k}return r}}function h(e){var t=(0,u.fs)(e);if(null!==t){var n=(0,s.t_)(t,1835296868);if(null!==n){var r=0,a=n[r];return r+=4,1===a?(0,i.pX)(n,r+16):0===a?(0,i.pX)(n,r+8):void 0}}}function m(e){var t=e.length;if(t<4)throw new Error("Cannot update box length: box too short");var n=(0,i.pX)(e,0);if(0===n){if(t>o.s){var r=new Uint8Array(t+8);return r.set((0,i.kh)(1),0),r.set(e.subarray(4,8),4),r.set((0,i.el)(t+8),8),r.set(e.subarray(8,t),16),r}return e.set((0,i.kh)(t),0),e}if(1===n){if(t<16)throw new Error("Cannot update box length: box too short");return e.set((0,i.el)(t),8),e}if(t<=o.s)return e.set((0,i.kh)(t),0),e;var a=new Uint8Array(t+8);return a.set((0,i.kh)(1),0),a.set(e.subarray(4,8),4),a.set((0,i.el)(t+8),8),a.set(e.subarray(8,t),16),a}function g(e){for(var t=[],n=0;n0)throw new Error("Unhandled version: "+s);var c=(0,r.dN)(e,t);t+=4;var f=(0,r.dN)(e,t);t+=4;var v=(0,i.uR)(e.subarray(t,t+4));t+=4;var p=(0,r.qb)(e,t);t+=2;var h=(0,r.qb)(e,t),m=[e[t+=2],e[t+1]].join(":"),g=1===e[t+=2];t=64;var y=[];if(0===c)throw new Error("bif: no images to parse");for(var _=0,b=null;t0,this._isEMSGWhitelisted=c}var t=e.prototype;return t.getInitSegment=function(){return(0,a.Z)(this._index,this._isEMSGWhitelisted)},t.getSegments=function(e,t){return(0,o.Z)(this._index,e,t,this._isEMSGWhitelisted,this._scaledPeriodEnd)},t.shouldRefresh=function(){return!1},t.getFirstAvailablePosition=function(){var e=this._index;return 0===e.timeline.length?null:(0,i.zG)(Math.max(this._scaledPeriodStart,e.timeline[0].start),e)},t.getLastAvailablePosition=function(){var e,t=this._index.timeline;if(0===t.length)return null;var n=t[t.length-1],r=Math.min((0,i.jH)(n,null,this._scaledPeriodEnd),null!==(e=this._scaledPeriodEnd)&&void 0!==e?e:1/0);return(0,i.zG)(r,this._index)},t.getEnd=function(){return this.getLastAvailablePosition()},t.awaitSegmentBetween=function(){return!1},t.isSegmentStillAvailable=function(){return!0},t.checkDiscontinuity=function(){return null},t.initializeIndex=function(e){for(var t=0;t0?Math.floor(u/s):0),I=T+A*S;Ih)break;var R=null===v?null:(0,i.QB)(I,Z)(v),x=I-e.indexTimeOffset,M=S;x<0&&(M=S+x,x=0);var C={id:String(I),time:x/f,end:(x+M)/f,duration:M/f,isInit:!1,range:E,timescale:1,url:R,number:Z,timestampOffset:-e.indexTimeOffset/f,complete:w,privateInfos:{isEMSGWhitelisted:a}};g.push(C),I=T+ ++A*S}if(I>=d)return g;if(m+=k+1,void 0!==h&&m>h)return g}return g}},4784:function(e,t,n){"use strict";n.d(t,{QB:function(){return o},zA:function(){return a}});var r=n(6923);function i(e){return function(t,n,i){var a,o,s,u=(0,r.Z)(i)?parseInt(i,10):1;return a=String(e),o=u,(s=a.toString()).length>=o?s:(new Array(o+1).join("0")+s).slice(-o)}}function a(e,t,n){return function(e,t,n){return-1===e.indexOf("$")?e:e.replace(/\$\$/g,"$").replace(/\$RepresentationID\$/g,String(t)).replace(/\$Bandwidth(\%0(\d+)d)?\$/g,i(void 0===n?0:n))}(e,t,n)}function o(e,t){return function(n){return-1===n.indexOf("$")?n:n.replace(/\$\$/g,"$").replace(/\$Number(\%0(\d+)d)?\$/g,(function(e,n,r){if(void 0===t)throw new Error("Segment number not defined in a $Number$ scheme");return i(t)(e,n,r)})).replace(/\$Time(\%0(\d+)d)?\$/g,(function(t,n,r){if(void 0===e)throw new Error("Segment time not defined in a $Time$ scheme");return i(e)(t,n,r)}))}}},4541:function(e,t,n){"use strict";n.d(t,{Z:function(){return je}});var r=n(7904),i=n(1946),a=n(6872),o=n(3887),s=n(3274),u=n(9829);function l(e){var t=Date.parse(e)-performance.now();if(!isNaN(t))return t;o.Z.warn("DASH Parser: Invalid clock received: ",e)}function d(e){for(var t=e.representations,n=null,r=0;r=0;t--){var n=e[t].adaptations,r=void 0===n.audio?void 0:n.audio[0],i=void 0===n.video?void 0:n.video[0];if(void 0!==r||void 0!==i){var a=null,s=null;if(void 0!==r){var u=d(r);if(void 0===u)return{safe:void 0,unsafe:void 0};a=u}if(void 0!==i){var l=d(i);if(void 0===l)return{safe:void 0,unsafe:void 0};s=l}if(void 0!==r&&null===a||void 0!==i&&null===s)return o.Z.info("Parser utils: found Period with no segment. ","Going to previous one to calculate last position"),{safe:void 0,unsafe:void 0};if(null!==s)return null!==a?{safe:Math.min(a,s),unsafe:Math.max(a,s)}:{safe:s,unsafe:s};if(null!==a)return{safe:a,unsafe:a}}}return{safe:void 0,unsafe:void 0}}(e);return{minimumSafePosition:t,maximumSafePosition:n.safe,maximumUnsafePosition:n.unsafe}}var v=n(9592),p=n(908),h=n(1679),m=n(3635);var g=function(){function e(e){this._isDynamic=e.isDynamic,this._timeShiftBufferDepth=e.isDynamic&&void 0!==e.timeShiftBufferDepth?e.timeShiftBufferDepth:null}var t=e.prototype;return t.setLastPosition=function(e,t){this._lastPosition=e,this._positionTime=t},t.lastPositionIsKnown=function(){return this._isDynamic?null!=this._positionTime&&null!=this._lastPosition:null!=this._lastPosition},t.estimateMinimumBound=function(){if(!this._isDynamic||null===this._timeShiftBufferDepth)return 0;var e=this.estimateMaximumBound();return void 0!==e?e-this._timeShiftBufferDepth:void 0},t.estimateMaximumBound=function(){return this._isDynamic&&null!=this._positionTime&&null!=this._lastPosition?Math.max(this._lastPosition-this._positionTime+performance.now()/1e3,0):this._lastPosition},e}(),y=n(8999),_=n(5138),b=n(7714),S=n(6923);function T(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return E(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return E(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function E(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0){var s=i-a.start;if(s%a.duration==0&&s/a.duration<=a.repeatCount)return{repeatNumberInPrevSegments:s/a.duration,prevSegmentsIdx:o,newElementsIdx:0,repeatNumberInNewElements:0}}if(++o>=e.length)return null;if((a=e[o]).start===i)return{prevSegmentsIdx:o,newElementsIdx:0,repeatNumberInPrevSegments:0,repeatNumberInNewElements:0};if(a.start>i)return null}else for(var u=0,l=t[0],d=i;;){var c=l.getAttribute("d"),f=null===c?null:parseInt(c,10);if(null===f||Number.isNaN(f))return null;var v=l.getAttribute("r"),p=null===v?null:parseInt(v,10);if(null!==p){if(Number.isNaN(p)||p<0)return null;if(p>0){var h=n-d;if(h%f==0&&h/f<=p)return{repeatNumberInPrevSegments:0,repeatNumberInNewElements:h/f,prevSegmentsIdx:0,newElementsIdx:u}}d+=f*(p+1)}else d+=f;if(++u>=t.length)return null;var m=(l=t[u]).getAttribute("t"),g=null===m?null:parseInt(m,10);if(null!==g){if(Number.isNaN(g))return null;d=g}if(d===n)return{newElementsIdx:u,prevSegmentsIdx:0,repeatNumberInPrevSegments:0,repeatNumberInNewElements:0};if(d>i)return null}}(t,e);if(null===r)return o.Z.warn('DASH: Cannot perform "based" update. Common segment not found.'),z(e);var i=r.prevSegmentsIdx,a=r.newElementsIdx,s=r.repeatNumberInPrevSegments,u=r.repeatNumberInNewElements,l=t.length-i+a-1;if(l>=e.length)return o.Z.info('DASH: Cannot perform "based" update. New timeline too short'),z(e);var d=t.slice(i);if(s>0){var c=d[0];c.start+=c.duration*s,d[0].repeatCount-=s}if(u>0&&0!==a)return o.Z.info('DASH: Cannot perform "based" update. The new timeline has a different form.'),z(e);var f=d[d.length-1],v=V(e[l]),p=(null!==(n=v.repeatCount)&&void 0!==n?n:0)-u;if(v.duration!==f.duration||f.repeatCount>p)return o.Z.info('DASH: Cannot perform "based" update. The new timeline has a different form at the beginning.'),z(e);void 0!==v.repeatCount&&v.repeatCount>f.repeatCount&&(f.repeatCount=v.repeatCount);for(var h=[],m=[],g=l+1;g0){var s=i[i.length-1];if((0,R.jH)(s,null,this._scaledPeriodEnd)+a>=Math.min(o,null!==(n=this._scaledPeriodEnd)&&void 0!==n?n:1/0))return!1}return void 0===this._scaledPeriodEnd?o+a>this._scaledPeriodStart&&void 0:(0,R.gT)(e,this._index)-athis._scaledPeriodStart},t.isSegmentStillAvailable=function(e){if(e.isInit)return!0;this._refreshTimeline(),null===this._index.timeline&&(this._index.timeline=this._getTimeline());var t=this._index,n=t.timeline,r=t.timescale,i=t.indexTimeOffset;return(0,O.Z)(e,n,r,i)},t.checkDiscontinuity=function(e){this._refreshTimeline();var t=this._index.timeline;return null===t&&(t=this._getTimeline(),this._index.timeline=t),(0,R._j)({timeline:t,timescale:this._index.timescale,indexTimeOffset:this._index.indexTimeOffset},e,this._scaledPeriodEnd)},t.canBeOutOfSyncError=function(e){return!!this._isDynamic&&(e instanceof P.Z&&e.isHttpError(404))},t._replace=function(e){this._parseTimeline=e._parseTimeline,this._index=e._index,this._isDynamic=e._isDynamic,this._scaledPeriodStart=e._scaledPeriodStart,this._scaledPeriodEnd=e._scaledPeriodEnd,this._lastUpdate=e._lastUpdate,this._manifestBoundsCalculator=e._manifestBoundsCalculator,this._isLastPeriod=e._isLastPeriod},t._update=function(e){null===this._index.timeline&&(this._index.timeline=this._getTimeline()),null===e._index.timeline&&(e._index.timeline=e._getTimeline()),(0,L.Z)(this._index.timeline,e._index.timeline)&&(this._index.startNumber=e._index.startNumber),this._index.endNumber=e._index.endNumber,this._isDynamic=e._isDynamic,this._scaledPeriodStart=e._scaledPeriodStart,this._scaledPeriodEnd=e._scaledPeriodEnd,this._lastUpdate=e._lastUpdate,this._isLastPeriod=e._isLastPeriod},t.isFinished=function(){if(!this._isDynamic||!this._isLastPeriod)return!0;null===this._index.timeline&&(this._index.timeline=this._getTimeline());var e=this._index.timeline;if(void 0===this._scaledPeriodEnd||0===e.length)return!1;var t=e[e.length-1];return(0,R.jH)(t,null,this._scaledPeriodEnd)+B(this._index.timescale)>=this._scaledPeriodEnd},t.isInitialized=function(){return!0},e.isTimelineIndexArgument=function(e){return"function"==typeof e.timelineParser||Array.isArray(e.timeline)},t._refreshTimeline=function(){if(null===this._index.timeline&&(this._index.timeline=this._getTimeline()),this._isDynamic){var e=this._manifestBoundsCalculator.estimateMinimumBound();if(null!=e){var t=(0,R.gT)(e,this._index),n=(0,N.Z)(this._index.timeline,t);void 0!==this._index.startNumber?this._index.startNumber+=n:void 0!==this._index.endNumber&&(this._index.startNumber=n+1)}}},e.getIndexEnd=function(e,t){return e.length<=0?null:Math.min((0,R.jH)(e[e.length-1],null,t),null!=t?t:1/0)},t._getTimeline=function(){if(null===this._parseTimeline)return null!==this._index.timeline?this._index.timeline:(o.Z.error("DASH: Timeline already lazily parsed."),[]);var e=this._parseTimeline();this._parseTimeline=null;var t,n=a.Z.getCurrent().MIN_DASH_S_ELEMENTS_TO_PARSE_UNSAFELY;return null===this._unsafelyBaseOnPreviousIndex||e.lengthn){if(r===n+1)return e.slice(0,i+1);var o=e.slice(0,i),s=Object.assign({},a),u=r-a.repeatCount-1;return s.repeatCount=Math.max(0,n-u),o.push(s),o}}return e}var H=G,j=function(){function e(e,t){var n,r,i=t.aggressiveMode,a=t.availabilityTimeOffset,o=t.manifestBoundsCalculator,s=t.isDynamic,u=t.periodEnd,l=t.periodStart,d=t.representationId,c=t.representationBitrate,f=t.isEMSGWhitelisted,v=null!==(n=e.timescale)&&void 0!==n?n:1;this._availabilityTimeOffset=a,this._manifestBoundsCalculator=o,this._aggressiveMode=i;var p=null!=e.presentationTimeOffset?e.presentationTimeOffset:0,h=p-l*v;if(void 0===e.duration)throw new Error("Invalid SegmentTemplate: no duration");var m=void 0===(null===(r=e.initialization)||void 0===r?void 0:r.media)?null:(0,M.zA)(e.initialization.media,d,c),g=void 0===e.media?null:(0,M.zA)(e.media,d,c);this._index={duration:e.duration,timescale:v,indexRange:e.indexRange,indexTimeOffset:h,initialization:null==e.initialization?void 0:{url:m,range:e.initialization.range},url:g,presentationTimeOffset:p,startNumber:e.startNumber,endNumber:e.endNumber},this._isDynamic=s,this._periodStart=l,this._scaledRelativePeriodEnd=void 0===u?void 0:(u-l)*v,this._isEMSGWhitelisted=f}var t=e.prototype;return t.getInitSegment=function(){return(0,x.Z)(this._index,this._isEMSGWhitelisted)},t.getSegments=function(e,t){var n=this._index,r=n.duration,i=n.startNumber,a=n.endNumber,o=n.timescale,s=n.url,u=this._periodStart*o,l=this._scaledRelativePeriodEnd,d=e*o-u,c=(e+t)*o-u,f=this._getFirstSegmentStart(),v=this._getLastSegmentStart();if(null==f||null==v)return[];var p=Math.max(f,d),h=Math.min(v,c);if(h+r<=p)return[];for(var m=[],g=null!=i?i:1,y=Math.floor(p/r),_=y*r;_<=h;_+=r){var b=y+g;if(void 0!==a&&b>a)return m;var S=null!=l&&_+r>l?l-_:r,T=_+u,E=_+this._index.presentationTimeOffset,k=null===s?null:(0,M.QB)(E,b)(s),w={id:String(b),number:b,time:T/o,end:(T+S)/o,duration:S/o,timescale:1,isInit:!1,scaledDuration:S/o,url:k,timestampOffset:-n.indexTimeOffset/o,complete:!0,privateInfos:{isEMSGWhitelisted:this._isEMSGWhitelisted}};m.push(w),y++}return m},t.getFirstAvailablePosition=function(){var e=this._getFirstSegmentStart();return null==e?e:e/this._index.timescale+this._periodStart},t.getLastAvailablePosition=function(){var e=this._getLastSegmentStart();if((0,i.Z)(e))return e;var t=this._estimateRelativeScaledEnd();return Math.min(e+this._index.duration,null!=t?t:1/0)/this._index.timescale+this._periodStart},t.getEnd=function(){if(!this._isDynamic)return this.getLastAvailablePosition();var e=this._estimateRelativeScaledEnd();if(void 0!==e){var t=this._index.timescale;return(e+this._periodStart*t)/t}},t.awaitSegmentBetween=function(e,t){if((0,D.Z)(e<=t),!this._isDynamic)return!1;var n=this._index.timescale,r=B(n),i=this._periodStart*n,a=t*n-i,o=this._estimateRelativeScaledEnd();return void 0===o?a+r>=0:e*n-i-r=e},t.isInitialized=function(){return!0},t._replace=function(e){this._index=e._index,this._aggressiveMode=e._aggressiveMode,this._isDynamic=e._isDynamic,this._periodStart=e._periodStart,this._scaledRelativePeriodEnd=e._scaledRelativePeriodEnd,this._manifestBoundsCalculator=e._manifestBoundsCalculator},t._update=function(e){this._replace(e)},t._getFirstSegmentStart=function(){if(!this._isDynamic)return 0;if(0===this._scaledRelativePeriodEnd||void 0===this._scaledRelativePeriodEnd){var e=this._manifestBoundsCalculator.estimateMaximumBound();if(void 0!==e&&ethis._periodStart?(i-this._periodStart)*r:0;return Math.floor(a/n)*n}},t._getLastSegmentStart=function(){var e,t=this._index,n=t.duration,r=t.timescale,i=t.endNumber,o=t.startNumber,s=void 0===o?1:o;if(this._isDynamic){var u=this._manifestBoundsCalculator.estimateMaximumBound();if(void 0===u)return;var l=this._aggressiveMode?n/r:0;if(void 0!==this._scaledRelativePeriodEnd&&this._scaledRelativePeriodEnd<(u+l-this._periodStart)*this._index.timescale){var d=Math.ceil(this._scaledRelativePeriodEnd/n);return void 0!==i&&i-s+1g||h<2?m:(h-2)*n},t._estimateRelativeScaledEnd=function(){var e,t;if(void 0!==this._index.endNumber){var n=this._index.endNumber-(null!==(e=this._index.startNumber)&&void 0!==e?e:1)+1;return Math.max(Math.min(n*this._index.duration,null!==(t=this._scaledRelativePeriodEnd)&&void 0!==t?t:1/0),0)}if(void 0!==this._scaledRelativePeriodEnd)return Math.max(this._scaledRelativePeriodEnd,0)},e}();function q(e,t){var n;if(0===t.length)return e;var r=t.map((function(e){return{url:e.value}}));if(0===e.length)return r;for(var i=[],a=0;a=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function X(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0){var y=t.parentSegmentTemplates.slice(),_=e.children.segmentTemplate;void 0!==_&&y.push(_);var b=I.Z.apply(void 0,[{}].concat(y));h.availabilityTimeComplete=null!==(n=b.availabilityTimeComplete)&&void 0!==n?n:t.availabilityTimeComplete,h.availabilityTimeOffset=(null!==(r=b.availabilityTimeOffset)&&void 0!==r?r:0)+t.availabilityTimeOffset,i=H.isTimelineIndexArgument(b)?new H(b,h):new j(b,h)}else{var S=t.adaptation.children;if(void 0!==S.segmentBase){var T=S.segmentBase;i=new Z.Z(T,h)}else if(void 0!==S.segmentList){var E=S.segmentList;i=new C(E,h)}else i=new j({duration:Number.MAX_VALUE,timescale:1,startNumber:0,media:""},h)}return i}(e,(0,I.Z)({},n,{availabilityTimeOffset:m,availabilityTimeComplete:h,unsafelyBaseOnPreviousRepresentation:v,adaptation:t,inbandEventStreams:p}));null==e.attributes.bitrate?(o.Z.warn("DASH: No usable bitrate found in the Representation."),f=0):f=e.attributes.bitrate;var y,_=q(n.baseURLs,e.children.baseURLs),b={bitrate:f,cdnMetadata:0===_.length?[{baseUrl:"",id:void 0}]:_.map((function(e){return{baseUrl:e.url,id:e.serviceLocation}})),index:g,isSpatialAudio:!(!e.children.supplementalProperties||!(0,s.Z)(e.children.supplementalProperties,(function(e){return"JOC"===e.value}))),id:c};null!=e.attributes.codecs?y=e.attributes.codecs:null!=t.attributes.codecs&&(y=t.attributes.codecs),null!=y&&(y="mp4a.40.02"===y?"mp4a.40.2":y,b.codecs=y),null!=e.attributes.frameRate?b.frameRate=e.attributes.frameRate:null!=t.attributes.frameRate&&(b.frameRate=t.attributes.frameRate),null!=e.attributes.height?b.height=e.attributes.height:null!=t.attributes.height&&(b.height=t.attributes.height),null!=e.attributes.mimeType?b.mimeType=e.attributes.mimeType:null!=t.attributes.mimeType&&(b.mimeType=t.attributes.mimeType),null!=e.attributes.width?b.width=e.attributes.width:null!=t.attributes.width&&(b.width=t.attributes.width);var S=void 0!==t.children.contentProtections?t.children.contentProtections:[];if(void 0!==e.children.contentProtections&&S.push.apply(S,e.children.contentProtections),S.length>0){var T=S.reduce((function(e,t){var n;if(void 0!==t.attributes.schemeIdUri&&"urn:uuid:"===t.attributes.schemeIdUri.substring(0,9)&&(n=t.attributes.schemeIdUri.substring(9).replace(/-/g,"").toLowerCase()),void 0!==t.attributes.keyId&&t.attributes.keyId.length>0){var r={keyId:t.attributes.keyId,systemId:n};void 0===e.keyIds?e.keyIds=[r]:e.keyIds.push(r)}if(void 0!==n){for(var i,a=[],o=Y(t.children.cencPssh);!(i=o()).done;){var u=i.value;a.push({systemId:n,data:u})}if(a.length>0){var l,d=(0,s.Z)(e.initData,(function(e){return"cenc"===e.type}));if(void 0===d)e.initData.push({type:"cenc",values:a});else(l=d.values).push.apply(l,a)}}return e}),{keyIds:void 0,initData:[]});(Object.keys(T.initData).length>0||void 0!==T.keyIds&&T.keyIds.length>0)&&(b.contentProtections=T)}b.hdrInfo=Q({adaptationProfiles:t.attributes.profiles,supplementalProperties:t.children.supplementalProperties,essentialProperties:t.children.essentialProperties,manifestProfiles:n.manifestProfiles,codecs:y}),d.push(b)},f=Y(e);!(l=f()).done;)c();return d}function J(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return ee(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ee(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ee(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ue(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&(n.sort(oe),e[t]=n.map((function(e){return e[0]}))),e}),{});return d.video.sort(oe),k(le,c),le}(I.children.adaptations,V),K=(null!==(u=t.xmlNamespaces)&&void 0!==u?u:[]).concat(null!==(l=I.attributes.namespaces)&&void 0!==l?l:[]),G=function(e,t,n){for(var r,i,a,o=[],s=se(e);!(a=s()).done;)for(var u,l=a.value,d=l.attributes,c=d.schemeIdUri,f=void 0===c?"":c,v=d.timescale,p=void 0===v?1:v,h=n.concat(null!==(r=l.attributes.namespaces)&&void 0!==r?r:[]),g=se(l.children.events);!(u=g()).done;){var y=u.value;if(void 0!==y.eventStreamData){var _=(null!==(i=y.presentationTime)&&void 0!==i?i:0)/p+t,b=void 0===y.duration?void 0:_+y.duration/p,S=void 0;if(y.eventStreamData instanceof Element)S=y.eventStreamData;else{var T=h.reduce((function(e,t){return e+"xmlns:"+t.key+'="'+t.value+'" '}),"","application/xml").documentElement.childNodes[0]}o.push({start:_,end:b,id:y.id,data:{type:"dash-event-stream",value:{schemeIdUri:f,timescale:p,element:S}}})}}return o}(I.children.eventStreams,M,K),W={id:g,start:M,end:P,duration:C,adaptations:z,streamEvents:G};if(d.unshift(W),!T.lastPositionIsKnown()){var H=function(e){for(var t,n=null,r=!0,i=(0,h.Z)(e).filter((function(e){return null!=e})),a=se((0,v.Z)(i,(function(e){return e})));!(t=a()).done;)for(var o,s=se(t.value.representations);!(o=s()).done;){var u=o.value.index.getLastAvailablePosition();null!==u&&(r=!1,"number"==typeof u&&(n=null==n?u:Math.max(n,u)))}if(null!=n)return n;if(r)return null;return}(z);if(f)if("number"==typeof H){var j=performance.now()/1e3;T.setLastPosition(H,j)}else{var Y=ce(t,M);if(void 0!==Y){var X=Y[0],Q=Y[1];T.setLastPosition(X,Q)}}else"number"==typeof H&&T.setLastPosition(H)}},w=e.length-1;w>=0;w--)E();if(t.isDynamic&&!T.lastPositionIsKnown()){var I=ce(t,0);if(void 0!==I){var Z=I[0],R=I[1];T.setLastPosition(Z,R)}}return function(e){if(0===e.length)return[];for(var t=[e[0]],n=1;nr.start)&&(o.Z.warn("DASH: Updating overlapping Periods.",null==i?void 0:i.start,r.start),i.duration=r.start-i.start,i.end=r.start,!(i.duration>0));)t.pop(),i=t[t.length-1];t.push(r)}return t}(d)}function ce(e,t){if(null!=e.clockOffset){var n=e.clockOffset/1e3-e.availabilityStartTime,r=performance.now()/1e3,i=r+n;if(i>=t)return[i,r]}else{var a=Date.now()/1e3;if(a>=t)return o.Z.warn("DASH Parser: no clock synchronization mechanism found. Using the system clock instead."),[a-e.availabilityStartTime,performance.now()/1e3]}}function fe(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return ve(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ve(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ve(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0?t[0].value:void 0}(t);if(null!=y&&y.length>0)return{type:"needs-clock",value:{url:y,continue:function(i){return i.success?(n.externalClockOffset=l(i.data),e(t,n,r,!0)):(r.push(i.error),o.Z.warn("DASH Parser: Error on fetching the clock ressource",i.error),e(t,n,r,!0))}}}}}for(var _=[],b=0;b=0&&(d=0===h.minimumUpdatePeriod?a.Z.getCurrent().DASH_FALLBACK_LIFETIME_WHEN_MINIMUM_UPDATE_PERIOD_EQUAL_0:h.minimumUpdatePeriod);var I=f(k),Z=I.minimumSafePosition,R=I.maximumSafePosition,x=I.maximumUnsafePosition,M=performance.now();if(m){var C,P;if(c=Z,A=null!=b?b:null,void 0!==x&&(P=x),void 0!==R)C=R;else{var D=null!=_?_:0,N=t.externalClockOffset;if(void 0===N)o.Z.warn("DASH Parser: use system clock to define maximum position"),C=Date.now()/1e3-D;else C=(performance.now()+N)/1e3-D}void 0===P&&(P=C),v={isLinear:!0,maximumSafePosition:C,livePosition:P,time:M},null!==A&&void 0!==c&&C-c>A&&(A=C-c)}else{c=void 0!==Z?Z:void 0!==(null===(i=k[0])||void 0===i?void 0:i.start)?k[0].start:0;var O=null!=w?w:1/0;if(void 0!==k[k.length-1]){var L=k[k.length-1],U=null!==(s=L.end)&&void 0!==s?s:void 0!==L.duration?L.start+L.duration:void 0;void 0!==U&&U=0;o--){var s,u=_[o].index,l=a[o],f=l.parsed,v=l.warnings,p=l.receivedTime,h=l.sendingTime,m=l.url;v.length>0&&r.push.apply(r,v);for(var g,y=fe(f);!(g=y()).done;){var b=g.value;d.set(b,{receivedTime:p,sendingTime:h,url:m})}(s=c.periods).splice.apply(s,[u,1].concat(f))}return e(t,n,r,i,d)}}}};function he(e){var t=e.textContent,n=[];return null===t||0===t.length?[void 0,n]:[{value:t},n]}function me(e){for(var t={},n=0;n0){var s=xe(a,"cenc:pssh"),u=s[0],l=s[1];null!==l&&(o.Z.warn(l.message),t.push(l)),null!==u&&n.push(u)}}}return[{cencPssh:n},t]}(e.childNodes),n=t[0],r=t[1];return[{children:n,attributes:function(e){for(var t={},n=0;n0&&(r=r.concat(c));break;case"SegmentList":var f=Ue(a),v=f[0],p=f[1];r=r.concat(p),t.segmentList=v;break;case"SegmentTemplate":var h=Fe(a),m=h[0],g=h[1];r=r.concat(g),t.segmentTemplate=m;break;case"ContentProtection":var y=De(a),_=y[0],b=y[1];b.length>0&&(r=r.concat(b)),void 0!==_&&n.push(_);break;case"SupplementalProperty":null==t.supplementalProperties?t.supplementalProperties=[Me(a)]:t.supplementalProperties.push(Me(a))}}return n.length>0&&(t.contentProtections=n),[t,r]}(e.childNodes),n=t[0],r=t[1],i=function(e){for(var t={},n=[],r=Ce(t,n),i=0;i0&&(r=r.concat(u));break;case"ContentComponent":t.contentComponent=me(a);break;case"EssentialProperty":null==t.essentialProperties?t.essentialProperties=[Me(a)]:t.essentialProperties.push(Me(a));break;case"InbandEventStream":void 0===t.inbandEventStreams&&(t.inbandEventStreams=[]),t.inbandEventStreams.push(Me(a));break;case"Label":var l=a.textContent;null!=l&&(t.label=l);break;case"Representation":var d=Ve(a),c=d[0],f=d[1];t.representations.push(c),f.length>0&&(r=r.concat(f));break;case"Role":null==t.roles?t.roles=[Me(a)]:t.roles.push(Me(a));break;case"SupplementalProperty":null==t.supplementalProperties?t.supplementalProperties=[Me(a)]:t.supplementalProperties.push(Me(a));break;case"SegmentBase":var v=Oe(a),p=v[0],h=v[1];t.segmentBase=p,h.length>0&&(r=r.concat(h));break;case"SegmentList":var m=Ue(a),g=m[0],y=m[1];t.segmentList=g,y.length>0&&(r=r.concat(y));break;case"SegmentTemplate":var _=Fe(a),b=_[0],S=_[1];t.segmentTemplate=b,S.length>0&&(r=r.concat(S));break;case"ContentProtection":var T=De(a),E=T[0],k=T[1];k.length>0&&(r=r.concat(k)),void 0!==E&&n.push(E)}}return n.length>0&&(t.contentProtections=n),[t,r]}(e.childNodes),n=t[0],r=t[1],i=function(e){for(var t={},n=[],r=Ce(t,n),i=0;i0&&(n=n.concat(d))}}return[t,n]}function Ge(e){for(var t={eventStreamData:e},n=[],r=Ce(t,n),i=0;i0&&(i=i.concat(_))}}return[{baseURLs:n,adaptations:r,eventStreams:a,segmentTemplate:t},i]}(e.childNodes),n=t[0],r=t[1],i=function(e){for(var t={},n=[],r=Ce(t,n),i=0;i",c=(new DOMParser).parseFromString(d,"text/xml");if(null==c||0===c.children.length)throw new Error("DASH parser: Invalid external ressources");for(var f=c.children[0].children,v=[],p=[],h=0;h0;){var r=e[0];if(r.start>=t)return n;if(-1===r.repeatCount)return n;if(0===r.repeatCount)e.shift(),n+=1;else{var i=e[1];if(void 0!==i&&i.start<=t)e.shift(),n+=1;else{if(r.duration<=0)return n;for(var a=r.start+r.duration,o=1;ar.repeatCount)){var s=r.repeatCount-o;return r.start=a,r.repeatCount=s,n+=o}e.shift(),n=r.repeatCount+1}}}return n}n.d(t,{Z:function(){return r}})},3911:function(e,t,n){"use strict";n.d(t,{KF:function(){return i},PZ:function(){return u},_j:function(){return l},gT:function(){return o},jH:function(){return a},zG:function(){return s}});var r=n(1946);function i(e,t,n){var i,a=e.repeatCount;return a>=0?a:(i=(0,r.Z)(t)?void 0!==n?n:Number.MAX_VALUE:t.start,Math.ceil((i-e.start)/e.duration)-1)}function a(e,t,n){var r=e.start,a=e.duration;return a<=0?r:r+(i(e,t,n)+1)*a}function o(e,t){var n;return e*t.timescale+(null!==(n=t.indexTimeOffset)&&void 0!==n?n:0)}function s(e,t){var n;return(e-(null!==(n=t.indexTimeOffset)&&void 0!==n?n:0))/t.timescale}function u(e,t,n){return[e*n,(e+t)*n]}function l(e,t,n){var r=e.timeline,i=o(t,e);if(i<0)return null;var u=function(e,t){for(var n=0,r=e.length;n>>1;e[i].start<=t?n=i+1:r=i}return n-1}(r,i);if(u<0||u>=r.length-1)return null;var l=r[u];if(l.duration<=0)return null;var d=r[u+1];if(void 0===d)return null;var c=d.start;return i>=a(l,d,n)&&ie.time)return!1;if(o===e.time)return void 0===a.range?void 0===e.range:null!=e.range&&a.range[0]===e.range[0]&&a.range[1]===e.range[1];if(a.repeatCount>=0&&void 0!==a.duration){var s=(o-a.start)/a.duration-1;return s%1==0&&s<=a.repeatCount}}return!1}n.d(t,{Z:function(){return r}})},5505:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var r=n(3714),i=n(3887),a=n(3911);function o(e,t){if(0===e.length)return e.push.apply(e,t),!0;if(0===t.length)return!1;var n=e.length,o=t[0].start,s=e[n-1];if((0,a.jH)(s,t[0])=0;u--){var l=e[u].start;if(l===o){var d=n-u;return e.splice.apply(e,[u,d].concat(t)),!1}if(lo)return i.Z.warn("RepresentationIndex: Manifest update removed all previous segments"),e.splice.apply(e,[0,n].concat(t)),!0;if(void 0===c.repeatCount||c.repeatCount<=0)return c.repeatCount<0&&(c.repeatCount=Math.floor((o-c.start)/c.duration)-1),e.splice.apply(e,[u+1,n-(u+1)].concat(t)),!1;if(c.start+c.duration*(c.repeatCount+1)<=o)return e.splice.apply(e,[u+1,n-(u+1)].concat(t)),!1;var f=(o-c.start)/c.duration-1;if(f%1==0&&c.duration===t[0].duration){var v=t[0].repeatCount<0?-1:t[0].repeatCount+f+1;return e.splice.apply(e,[u,n-u].concat(t)),e[u].start=c.start,e[u].repeatCount=v,!1}return i.Z.warn("RepresentationIndex: Manifest update removed previous segments"),e[u].repeatCount=Math.floor(f),e.splice.apply(e,[u+1,n-(u+1)].concat(t)),!1}}var p=e[e.length-1],h=t[t.length-1];return void 0!==p.repeatCount&&p.repeatCount<0?p.start>h.start?(i.Z.warn("RepresentationIndex: The new index is older than the previous one"),!1):(i.Z.warn('RepresentationIndex: The new index is "bigger" than the previous one'),e.splice.apply(e,[0,n].concat(t)),!0):p.start+p.duration*(p.repeatCount+1)>=h.start+h.duration*(h.repeatCount+1)?(i.Z.warn("RepresentationIndex: The new index is older than the previous one"),!1):(i.Z.warn('RepresentationIndex: The new index is "bigger" than the previous one'),e.splice.apply(e,[0,n].concat(t)),!0)}},5734:function(e,t,n){"use strict";var r=n(6923),i=/&#([0-9]+);/g,a=/
/gi,o=/]*>([\s\S]*?)<\/style[^>]*>/i,s=/\s*

]+))?>(.*)/i,u=/]+?start="?([0-9]*)"?[^0-9]/i;function l(e,t){var n=new RegExp("\\s*"+t+":\\s*(\\S+);","i").exec(e);return Array.isArray(n)?n[1]:null}t.Z=function(e,t,n){var d,c,f=/]/gi,v=/]|<\/body>/gi,p=[],h=o.exec(e),m=Array.isArray(h)?h[1]:"";v.exec(e);var g,y=function(e){for(var t=/\.(\S+)\s*{([^}]*)}/gi,n={},r=t.exec(e);null!==r;){var i=r[1],a=l(r[2],"lang");null!=i&&null!=a&&(n[a]=i),r=t.exec(e)}return n}(m),_=function(e){var t=/p\s*{([^}]*)}/gi.exec(e);return null===t?"":t[1]}(m);if((0,r.Z)(n)&&void 0===(g=y[n]))throw new Error("sami: could not find lang "+n+" in CSS");for(;d=f.exec(e),c=v.exec(e),null!==d||null!==c;){if(null===d||null===c||d.index>=c.index)throw new Error("parse error");var b=e.slice(d.index,c.index),S=u.exec(b);if(!Array.isArray(S))throw new Error("parse error (sync time attribute)");var T=+S[1];if(isNaN(T))throw new Error("parse error (sync time attribute NaN)");E(b.split("\n"),T/1e3)}return p;function E(e,n){for(var o=e.length;--o>=0;){var u=s.exec(e[o]);if(Array.isArray(u)){var l=u[1],d=u[2];if(g===l)if(" "===d)p[p.length-1].end=n;else{var c=document.createElement("DIV");c.className="rxp-texttrack-region";var f=document.createElement("DIV");f.className="rxp-texttrack-div",f.style.position="absolute",f.style.bottom="0",f.style.width="100%",f.style.color="#fff",f.style.textShadow="-1px -1px 0 #000,1px -1px 0 #000,-1px 1px 0 #000,1px 1px 0 #000";var v=document.createElement("div");v.className="rxp-texttrack-p",(0,r.Z)(_)&&(v.style.cssText=_);for(var h=d.split(a),m=0;m/gi,s=/]*>([\s\S]*?)<\/style[^>]*>/i,u=/\s*

]+))?>(.*)/i,l=/]+?start="?([0-9]*)"?[^0-9]/i;function d(e,t){var n=new RegExp("\\s*"+t+":\\s*(\\S+);","i").exec(e);return Array.isArray(n)?n[1]:null}t.Z=function(e,t,n){var c,f,v=/]/gi,p=/]|<\/body>/gi,h=[],m=s.exec(e),g=null!==m?m[1]:"";p.exec(e);var y,_=function(e){for(var t=/\.(\S+)\s*{([^}]*)}/gi,n={},r=t.exec(e);Array.isArray(r);){var i=r[1],a=d(r[2],"lang");null!=i&&null!=a&&(n[a]=i),r=t.exec(e)}return n}(g);if((0,i.Z)(n)&&void 0===(y=_[n]))throw new Error("sami: could not find lang "+n+" in CSS");for(;c=v.exec(e),f=p.exec(e),null!==c||null!==f;){if(null===c||null===f||c.index>=f.index)throw new Error("parse error");var b=e.slice(c.index,f.index),S=l.exec(b);if(null===S)throw new Error("parse error (sync time attribute)");var T=+S[1];if(isNaN(T))throw new Error("parse error (sync time attribute NaN)");E(b.split("\n"),T/1e3)}return function(e){for(var t=[],n=0;n=0;)if(null!==(r=u.exec(e[s]))){var l=r,d=l[1],c=l[2];y===d&&(" "===c?h[h.length-1].end=n:h.push({text:(i=c,i.replace(o,"\n").replace(a,(function(e,t){return String.fromCharCode(Number(t))}))),start:n+t}))}}}},2061:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(6923);function i(e,t){for(var n=t+1;(0,r.Z)(e[n]);)n++;return n}function a(e){for(var t=[],n=0;n0&&(1===o.length?o[0].indexOf("--\x3e")>=0&&t.push(o):(o[1].indexOf("--\x3e")>=0||o[0].indexOf("--\x3e")>=0)&&t.push(o)),n=a}return t}},8675:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(2061),i=n(788);function a(e,t){for(var n=e.split(/\r\n|\n|\r/),a=(0,r.Z)(n),s=[],u=0;u0){var l=document.createTextNode(o[s]);r.appendChild(l)}}else if("B"===a.nodeName){var d=e(a);d.style.fontWeight="bold",r.appendChild(d)}else if("I"===a.nodeName){var c=e(a);c.style.fontStyle="italic",r.appendChild(c)}else if("U"===a.nodeName){var f=e(a);f.style.textDecoration="underline",r.appendChild(f)}else if(u(a)&&"string"==typeof a.color){var v=e(a);v.style.color=a.color,r.appendChild(v)}else{var p=e(a);r.appendChild(p)}}return r}(t)}function u(e){return"FONT"===e.nodeName&&"color"in e}},8057:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var r=n(7253),i=n(2061),a=n(788);function o(e,t){for(var n,o,s,u,l,d=e.split(/\r\n|\n|\r/),c=(0,i.Z)(d),f=[],v=0;v0){var _=p.getAttribute("xml:space"),b=(0,l.Z)(_)?"default"===_:o,T=(0,d.Z)({},i,(0,c.U)(g,[p],n,t));u.push.apply(u,e(p,T,[p].concat(a),b))}}return u}(e,(0,d.Z)({},r),[],i)}(e,n,r,i,s),T=0;T|\u2265/g,">").replace(/\u200E/g,"‎").replace(/\u200F/g,"‏").replace(/\u00A0/g," ")}else if((0,l.OE)(s))i+="\n";else if((0,l.jg)(s)&&s.nodeType===Node.ELEMENT_NODE&&s.childNodes.length>0){var c=s.getAttribute("xml:space");i+=n(s,(0,o.Z)(c)?"default"===c:t)}}return i}return n(e,t)}(t,v),y=(0,i.Z)(h+n,m+n,g);return null===y?null:((0,a.Z)(y)&&function(e,t){var n=t.extent;if((0,o.Z)(n)){var r=u._0.exec(n);null!=r&&(e.size=Number(r[1]))}switch(t.writingMode){case"tb":case"tblr":e.vertical="lr";break;case"tbrl":e.vertical="rl"}var i=t.origin;if((0,o.Z)(i))u._0.exec(i);var a=t.align;if((0,o.Z)(a)){e.align=a,"center"===a&&("center"!==e.align&&(e.align="middle"),e.position="auto");var s=c[a];e.positionAlign=void 0===s?"":s;var l=d[a];e.lineAlign=void 0===l?"":l}}(y,r),y)}var v=function(e,t){for(var n=(0,r.Z)(e,t),i=[],a=0;a0&&(t=n)}return t}function a(e){var t=e.getElementsByTagName("body");if(t.length>0)return t[0];var n=e.getElementsByTagName("tt:body");return n.length>0?n[0]:null}function o(e){var t=e.getElementsByTagName("style");if(t.length>0)return t;var n=e.getElementsByTagName("tt:style");return n.length>0?n:t}function s(e){var t=e.getElementsByTagName("region");if(t.length>0)return t;var n=e.getElementsByTagName("tt:region");return n.length>0?n:t}function u(e){var t=e.getElementsByTagName("p");if(t.length>0)return t;var n=e.getElementsByTagName("tt:p");return n.length>0?n:t}function l(e){return"br"===e.nodeName||"tt:br"===e.nodeName}function d(e){return"span"===e.nodeName||"tt:span"===e.nodeName}n.d(t,{DM:function(){return s},H:function(){return a},OE:function(){return l},jF:function(){return i},jg:function(){return d},kd:function(){return u},vU:function(){return o}})},1138:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(6923),i=n(360);function a(e,t){for(var n=[],a=t;a=2)for(var r=function(r){var o=e[r];if(Array.isArray(/::cue {/.exec(o)))for(o=e[++r];(0,i.Z)(o)&&!Array.isArray(/}/.exec(o))&&0!==o.length;)n+=o,o=e[++r];else{for(var s=[],u=/::cue\(\.?(.*?)\)(?:,| {)/.exec(o);(0,i.Z)(o)&&Array.isArray(u);)s.push(u[1]),o=e[++r],u=/::cue\(\.?(.*?)\)(?:,| {)/.exec(o);for(var l="";(0,i.Z)(o)&&!Array.isArray(/}/.exec(o))&&0!==o.length;)l+=o,o=e[++r];s.forEach((function(e){void 0===t[e]?t[e]=l:t[e]+=l}))}a=r},a=1;a0&&n.appendChild(document.createElement("br")),o[s].length>0){var u=document.createTextNode(o[s]);n.appendChild(u)}}else{var c=e.nodeName.toLowerCase().split("."),f=[];if(c.forEach((function(e){(0,i.Z)(t[e])&&f.push(t[e])})),0!==f.length){var v=document.createAttribute("style");f.forEach((function(e){v.value+=e}));var p=(0,l.Z)(r,a)?a:"span";(n=document.createElement(p)).setAttributeNode(v)}else{var h=(0,l.Z)(r,a)?a:"span";n=document.createElement(h)}for(var m=0;m/,"").replace(/<([u,i,b,c])(\..*?)?(?: .*?)?>(.*?)<\/\1>/g,"<$1$2>$3"),r=(new DOMParser).parseFromString(n,"text/html").body.childNodes,i=[],a=0;a=2){var a=parseInt(i[1],10);isNaN(a)||(t.position=a,void 0!==i[2]&&(t.positionAlign=i[2]))}}(0,u.Z)(e.size)&&(t.size=e.size),"string"==typeof e.align&&(0,s.Z)(["start","center","end","left"],e.align)&&(t.align=e.align)}var d=n(7253);var c=function(e,t){var n=e.split(/\r\n|\n|\r/);if(!/^WEBVTT($| |\t)/.test(n[0]))throw new Error("Can't parse WebVTT: Invalid file.");for(var s,u,c,f,v=(0,o.yE)(n),p=(0,i.Z)(n,v),h=[],m=0;m/;if(o.test(e[0]))n=e[0],r=e.slice(1,e.length);else{if(!o.test(e[1]))return null;a=e[0],n=e[1],r=e.slice(2,e.length)}var s=function(e){var t=/^([\d:.]+)[ |\t]+-->[ |\t]+([\d:.]+)[ |\t]*(.*)$/.exec(e);if(null===t)return null;var n=i(t[1]),r=i(t[2]);return null==n||null==r?null:{start:n,end:r,settings:t[3].split(/ |\t/).reduce((function(e,t){var n=t.split(":");return 2===n.length&&(e[n[0]]=n[1]),e}),{})}}(n);return null===s?null:{start:s.start+t,end:s.end+t,settings:s.settings,payload:r,header:a}}},360:function(e,t,n){"use strict";n.d(t,{$4:function(){return s},JF:function(){return a},tq:function(){return o},yE:function(){return i}});var r=n(6923);function i(e){for(var t=0;t=0)return!0;var r=e[t+1];return void 0!==r&&r.indexOf("--\x3e")>=0}function s(e,t){for(var n=t+1;(0,r.Z)(e[n]);)n++;return n}},85:function(e,t,n){"use strict";n.d(t,{Z:function(){return fe}});var r=n(7874),i=n(8791),a=n(5861),o=n(4687),s=n.n(o),u=n(4597),l=n(5278),d=n(9829);function c(e,t){return null===e?null:null===t.url?e.baseUrl:(0,d.Z)(e.baseUrl,t.url)}function f(e,t,n,r,i){return v.apply(this,arguments)}function v(){return(v=(0,a.Z)(s().mark((function e(t,n,r,i,a){var o,l,d;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=n.segment,l=c(t,o),!o.isInit&&null!==l){e.next=4;break}return e.abrupt("return",{resultType:"segment-created",resultData:null});case 4:return e.next=6,(0,u.ZP)({url:l,responseType:"arraybuffer",timeout:r.timeout,onProgress:a.onProgress,cancelSignal:i});case 6:return d=e.sent,e.abrupt("return",{resultType:"segment-loaded",resultData:d});case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function p(e,t){var n=t.segment,i=t.period,a=e.data,o=e.isChunked;if(t.segment.isInit)return{segmentType:"init",initializationData:null,initializationDataSize:0,protectionDataUpdate:!1,initTimescale:void 0};if(o)throw new Error("Image data should not be downloaded in chunks");var s=(0,l.Z)(n.timestampOffset,0);return null===a||null===r.Z.imageParser?{segmentType:"media",chunkData:null,chunkSize:0,chunkInfos:{duration:n.duration,time:n.time},chunkOffset:s,protectionDataUpdate:!1,appendWindow:[i.start,i.end]}:{segmentType:"media",chunkData:{data:r.Z.imageParser(new Uint8Array(a)).thumbs,start:0,end:Number.MAX_VALUE,timescale:1,type:"bif"},chunkSize:void 0,chunkInfos:{time:0,duration:Number.MAX_VALUE},chunkOffset:s,protectionDataUpdate:!1,appendWindow:[i.start,i.end]}}var h=n(6872),m=n(8750),g=n(3887),y=n(1989),_=n(8026),b=n(3635);function S(e){var t=e.aggressiveMode,n=e.referenceDateTime,i=void 0!==e.serverSyncInfos?e.serverSyncInfos.serverTimestamp-e.serverSyncInfos.clientTime:void 0;return function(a,o,s,l,d){var c,f=a.responseData,v=o.externalClockOffset,p=null!==(c=a.url)&&void 0!==c?c:o.originalUrl,S=null!=i?i:v,T={aggressiveMode:!0===t,unsafelyBaseOnPreviousManifest:o.unsafeMode?o.previousManifest:null,url:p,referenceDateTime:n,externalClockOffset:S},E=r.Z.dashParsers;if(null===E.wasm||"uninitialized"===E.wasm.status||"failure"===E.wasm.status)return g.Z.debug("DASH: WASM MPD Parser not initialized. Running JS one."),w();var k=function(e){if(e instanceof ArrayBuffer)return e;if("string"==typeof e)return(0,b.tG)(e).buffer;if(e instanceof Document)return(0,b.tG)(e.documentElement.innerHTML).buffer;throw new Error("DASH Manifest Parser: Unrecognized Manifest format")}(f);return function(e){var t=new DataView(e);if(61371===t.getUint16(0)&&191===t.getUint8(2))return!0;if(65279===t.getUint16(0)||65534===t.getUint16(0))return!1;return!0}(k)?"initialized"===E.wasm.status?(g.Z.debug("DASH: Running WASM MPD Parser."),A(E.wasm.runWasmParser(k,T))):(g.Z.debug("DASH: Awaiting WASM initialization before parsing the MPD."),E.wasm.waitForInitialization().catch((function(){})).then((function(){return null===E.wasm||"initialized"!==E.wasm.status?(g.Z.warn("DASH: WASM MPD parser initialization failed. Running JS parser instead"),w()):(g.Z.debug("DASH: Running WASM MPD Parser."),A(E.wasm.runWasmParser(k,T)))}))):(g.Z.info("DASH: MPD doesn't seem to be UTF-8-encoded. Running JS parser instead of the WASM one."),w());function w(){if(null===E.js)throw new Error("No MPD parser is imported");var e=function(e){if(e instanceof ArrayBuffer)return(new DOMParser).parseFromString((0,b.uR)(new Uint8Array(e)),"text/xml");if("string"==typeof e)return(new DOMParser).parseFromString(e,"text/xml");if(e instanceof Document)return e;throw new Error("DASH Manifest Parser: Unrecognized Manifest format")}(f);return A(E.js(e,T))}function A(t){if("done"===t.type)return t.value.warnings.length>0&&s(t.value.warnings),l.isCancelled()?Promise.reject(l.cancellationError):{manifest:new y.ZP(t.value.parsed,e),url:p};var n=t.value,r=n.urls.map((function(e){return d((function(){var t=h.Z.getCurrent().DEFAULT_REQUEST_TIMEOUT;return"string"===n.format?(0,u.ZP)({url:e,responseType:"text",timeout:t,cancelSignal:l}):(0,u.ZP)({url:e,responseType:"arraybuffer",timeout:t,cancelSignal:l})})).then((function(e){if("string"===n.format){if("string"!=typeof e.responseData)throw new Error("External DASH resources should have been a string");return(0,_.Z)(e,{responseData:{success:!0,data:e.responseData}})}if(!(e.responseData instanceof ArrayBuffer))throw new Error("External DASH resources should have been ArrayBuffers");return(0,_.Z)(e,{responseData:{success:!0,data:e.responseData}})}),(function(e){var t=(0,m.Z)(e,{defaultCode:"PIPELINE_PARSE_ERROR",defaultReason:"An unknown error occured when parsing ressources."});return(0,_.Z)({},{size:void 0,requestDuration:void 0,responseData:{success:!1,error:t}})}))}));return Promise.all(r).then((function(e){return n.format,A(n.continue(e))}))}}}var T=n(7839),E=n(9105),k=n(5992),w=n(1946),A="function"==typeof Headers?Headers:null,I="function"==typeof AbortController?AbortController:null;function Z(){return"function"==typeof window.fetch&&!(0,w.Z)(I)&&!(0,w.Z)(A)}var R=n(8806),x=n(281);function M(e,t){return"audio"===e||"video"===e?"video/mp4"===t.mimeType||"audio/mp4"===t.mimeType?"mp4":"video/webm"===t.mimeType||"audio/webm"===t.mimeType?"webm":void 0:"text"===e&&"application/mp4"===t.mimeType?"mp4":void 0}var C=n(288),P=n(4460);function D(e){return function(t,n,r,i,a){return new Promise((function(s,u){var l=new C.ZP,d=l.linkToSignal(i);function c(){l.signal.deregister(u),d()}l.signal.register(u),e(t,n,r,l.signal,Object.assign(Object.assign({},a),{onNewChunk:function(e){try{o(e),a.onNewChunk(e)}catch(e){c(),l.cancel(),u(e)}}})).then((function(e){if(c(),!l.isUsed()){if("segment-loaded"===e.resultType)try{o(e.resultData.responseData)}catch(e){return void u(e)}s(e)}}),(function(e){c(),u(e)}))}));function o(e){(e instanceof ArrayBuffer||e instanceof Uint8Array)&&"mp4"===M(n.adaptation.type,n.representation)&&(0,P.Z)(new Uint8Array(e),n.segment.isInit)}}}var N=n(6968);function O(e,t,n,r,i){if(void 0===t.range)return(0,u.ZP)({url:e,responseType:"arraybuffer",timeout:n.timeout,cancelSignal:r,onProgress:i.onProgress}).then((function(e){return{resultType:"segment-loaded",resultData:e}}));if(void 0===t.indexRange)return(0,u.ZP)({url:e,headers:{Range:(0,x.Z)(t.range)},responseType:"arraybuffer",timeout:n.timeout,cancelSignal:r,onProgress:i.onProgress}).then((function(e){return{resultType:"segment-loaded",resultData:e}}));if(t.range[1]+1===t.indexRange[0])return(0,u.ZP)({url:e,headers:{Range:(0,x.Z)([t.range[0],t.indexRange[1]])},responseType:"arraybuffer",timeout:n.timeout,cancelSignal:r,onProgress:i.onProgress}).then((function(e){return{resultType:"segment-loaded",resultData:e}}));var a=(0,u.ZP)({url:e,headers:{Range:(0,x.Z)(t.range)},responseType:"arraybuffer",timeout:n.timeout,cancelSignal:r,onProgress:i.onProgress}),o=(0,u.ZP)({url:e,headers:{Range:(0,x.Z)(t.indexRange)},responseType:"arraybuffer",timeout:n.timeout,cancelSignal:r,onProgress:i.onProgress});return Promise.all([a,o]).then((function(t){var n=t[0],r=t[1],i=(0,N.zo)(new Uint8Array(n.responseData),new Uint8Array(r.responseData)),a=Math.min(n.sendingTime,r.sendingTime),o=Math.max(n.receivedTime,r.receivedTime);return{resultType:"segment-loaded",resultData:{url:e,responseData:i,size:n.size+r.size,requestDuration:o-a,sendingTime:a,receivedTime:o}}}))}var L=n(8766);function U(e,t,n,r,i){var o=t.segment,u=void 0!==o.range?{Range:(0,x.Z)(o.range)}:void 0,l=null;return function(e){var t;if(!(0,w.Z)(e.headers))if((0,w.Z)(A))t=e.headers;else{t=new A;for(var n=Object.keys(e.headers),r=0;r=300)throw g.Z.warn("Fetch: Request HTTP Error",t.status,t.url),new E.Z(t.url,t.status,k.br.ERROR_HTTP_CODE);if((0,w.Z)(t.body))throw new E.Z(t.url,t.status,k.br.PARSE_ERROR);var n=t.headers.get("Content-Length"),r=(0,w.Z)(n)||isNaN(+n)?void 0:+n,i=t.body.getReader(),u=0;return l();function l(){return c.apply(this,arguments)}function c(){return(c=(0,a.Z)(s().mark((function n(){var a,o,c,f,p;return s().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,i.read();case 2:if((a=n.sent).done||(0,w.Z)(a.value)){n.next=11;break}return u+=a.value.byteLength,o=performance.now(),c={url:t.url,currentTime:o,duration:o-d,sendingTime:d,chunkSize:a.value.byteLength,chunk:a.value.buffer,size:u,totalSize:r},e.onData(c),n.abrupt("return",l());case 11:if(!a.done){n.next=16;break}return v(),f=performance.now(),p=f-d,n.abrupt("return",{requestDuration:p,receivedTime:f,sendingTime:d,size:u,status:t.status,url:t.url});case 16:return n.abrupt("return",l());case 17:case"end":return n.stop()}}),n)})))).apply(this,arguments)}})).catch((function(t){if(null!==u)throw u;if(v(),l)throw g.Z.warn("Fetch: Request timeouted."),new E.Z(e.url,0,k.br.TIMEOUT);if(t instanceof E.Z)throw t;throw g.Z.warn("Fetch: Request Error",t instanceof Error?t.toString():""),new E.Z(e.url,0,k.br.ERROR_EVENT)}))}({url:e,headers:u,onData:function(e){var t=new Uint8Array(e.chunk),n=function(e){for(var t=0,n=[];te.length)return[n,r];var o=(0,L.Z)(r,1835295092);if(o<0)return[n,r];var s=t+o+(0,N.pX)(e,o+t);if(s>e.length)return[n,r];var u=Math.max(a,s),l=e.subarray(t,u);n.push(l),t=u}return[n,null]}(null!==l?(0,N.zo)(l,t):t),a=n[0];l=n[1];for(var o=0;o0)for(var v=0;v=Math.pow(2,8-n))return n}function te(e,t){var n=ee(e,t);if(null==n)return g.Z.warn("webm: unrepresentable length"),null;if(t+n>e.length)return g.Z.warn("webm: impossible length"),null;for(var r=0,i=0;ie.length)return g.Z.warn("webm: impossible length"),null;for(var r=(e[t]&(1<<8-n)-1)*Math.pow(2,8*(n-1)),i=1;i=i)return!0}return!1}(r,t);return{inbandEvents:a,needsManifestRefresh:o}}}function se(e){var t=e.__priv_patchLastSegmentInSidx;return function(e,n,r){var i,a=n.period,o=n.adaptation,s=n.representation,u=n.segment,d=n.manifest,c=e.data,f=e.isChunked,v=[a.start,a.end];if(null===c)return u.isInit?{segmentType:"init",initializationData:null,initializationDataSize:0,protectionDataUpdate:!1,initTimescale:void 0}:{segmentType:"media",chunkData:null,chunkSize:0,chunkInfos:null,chunkOffset:0,protectionDataUpdate:!1,appendWindow:v};var p=c instanceof Uint8Array?c:new Uint8Array(c),h=M(o.type,s),m="mp4"===h||void 0===h,g=!1;if(m){var y,_=(0,F.Z)(p);u.isInit&&(y=null!==(i=(0,V.R0)(p))&&void 0!==i?i:void 0),(_.length>0||void 0!==y)&&(g=s._addProtectionData("cenc",y,_))}if(!u.isInit){var b=m?ae(p,f,u,r):null,S=(0,l.Z)(u.timestampOffset,0);if(m){var T=(0,V.s9)(p);if(void 0!==T){var E=oe(T.filter((function(e){return void 0!==u.privateInfos&&void 0!==u.privateInfos.isEMSGWhitelisted&&u.privateInfos.isEMSGWhitelisted(e)})),d.publishTime);if(void 0!==E){var k=E.needsManifestRefresh,A=E.inbandEvents;return{segmentType:"media",chunkData:p,chunkSize:p.length,chunkInfos:b,chunkOffset:S,appendWindow:v,inbandEvents:A,protectionDataUpdate:g,needsManifestRefresh:k}}}}return{segmentType:"media",chunkData:p,chunkSize:p.length,chunkInfos:b,chunkOffset:S,protectionDataUpdate:g,appendWindow:v}}var I=u.indexRange,Z=null;if("webm"===h)Z=function(e,t){var n=Q(z,[],e,[t,e.length]);if(null==n)return null;var r=n[0],i=n[1],a=$(e,r);if(null==a)return null;var o=J(e,r);if(null==o)return null;var s=Q(H,[],e,[r,i]);if(null==s)return null;for(var u=[],l=s[0];l0)){var R=Z[Z.length-1];Array.isArray(R.range)&&(R.range[1]=1/0)}s.index instanceof ie.Z&&null!==Z&&Z.length>0&&s.index.initializeIndex(Z);var x=m?(0,V.LD)(p):"webm"===h?$(p,0):void 0,C=(0,w.Z)(x)?void 0:x;return{segmentType:"init",initializationData:p,initializationDataSize:p.length,protectionDataUpdate:g,initTimescale:C}}}var ue=n(6807);function le(e,t,n,r){var i,a,o=e.segment,s=e.adaptation,u=e.representation;if(o.isInit)return null;null===n?r?(i=o.time,a=o.end):g.Z.warn("Transport: Unavailable time data for current text track."):(i=n.time,void 0!==n.duration?a=i+n.duration:!r&&o.complete&&(a=i+o.duration));var l=function(e){var t=e.codec;if(void 0===t)throw new Error("Cannot parse subtitles: unknown format");switch(t.toLowerCase()){case"stpp":case"stpp.ttml.im1t":return"ttml";case"wvtt":return"vtt"}throw new Error('The codec used for the subtitles "'+t+'" is not managed yet.')}(u),d=function(e){var t=(0,ue.Le)(e);return null===t?"":(0,b.uR)(t)}(t);return{data:d,type:l,language:s.language,start:i,end:a}}function de(e,t,n){var r,i,a=e.segment,o=e.adaptation,s=e.representation;if(a.isInit)return null;n?g.Z.warn("Transport: Unavailable time data for current text track."):(r=a.time,a.complete&&(i=a.time+a.duration));var u=function(e){var t=e.mimeType,n=void 0===t?"":t;switch(e.mimeType){case"application/ttml+xml":return"ttml";case"application/x-sami":case"application/smil":return"sami";case"text/vtt":return"vtt"}var r=e.codec;if("srt"===(void 0===r?"":r).toLowerCase())return"srt";throw new Error("could not find a text-track parser for the type "+n)}(s);return{data:t,type:u,language:o.language,start:r,end:i}}function ce(e){var t=e.__priv_patchLastSegmentInSidx;return function(e,n,r){var i,a=n.period,o=n.adaptation,s=n.representation,u=n.segment,d=e.data,c=e.isChunked;if(null===d)return u.isInit?{segmentType:"init",initializationData:null,initializationDataSize:0,protectionDataUpdate:!1,initTimescale:void 0}:{segmentType:"media",chunkData:null,chunkSize:0,chunkInfos:null,chunkOffset:null!==(i=u.timestampOffset)&&void 0!==i?i:0,protectionDataUpdate:!1,appendWindow:[a.start,a.end]};var f=M(o.type,s);if("webm"===f)throw new Error("Text tracks with a WEBM container are not yet handled.");return"mp4"===f?function(e,t,n,r,i){var a=n.period,o=n.representation,s=n.segment,u=s.isInit,d=s.indexRange,c="string"==typeof e?(0,b.tG)(e):e instanceof Uint8Array?e:new Uint8Array(e);if(u){var f=(0,V.Wf)(c,Array.isArray(d)?d[0]:0);if(!0===i&&null!==f&&f.length>0){var v=f[f.length-1];Array.isArray(v.range)&&(v.range[1]=1/0)}var p=(0,V.LD)(c);return o.index instanceof ie.Z&&null!==f&&f.length>0&&o.index.initializeIndex(f),{segmentType:"init",initializationData:null,initializationDataSize:0,protectionDataUpdate:!1,initTimescale:p}}var h=ae(c,t,s,r),m=le(n,c,h,t),g=(0,l.Z)(s.timestampOffset,0);return{segmentType:"media",chunkData:m,chunkSize:c.length,chunkInfos:h,chunkOffset:g,protectionDataUpdate:!1,appendWindow:[a.start,a.end]}}(d,c,n,r,t):function(e,t,n){var r,i,a=n.period,o=n.segment,s=o.timestampOffset,u=void 0===s?0:s;if(o.isInit)return{segmentType:"init",initializationData:null,initializationDataSize:0,protectionDataUpdate:!1,initTimescale:void 0};if("string"!=typeof e){var l=e instanceof Uint8Array?e:new Uint8Array(e);r=(0,b.uR)(l),i=l.length}else r=e;return{segmentType:"media",chunkData:de(n,r,t),chunkSize:i,chunkInfos:null,chunkOffset:u,protectionDataUpdate:!1,appendWindow:[a.start,a.end]}}(d,c,n)}}var fe=function(e){var t=(0,i.Z)({customManifestLoader:e.manifestLoader},null===r.Z.dashParsers.wasm||"initialized"!==r.Z.dashParsers.wasm.status&&"initializing"!==r.Z.dashParsers.wasm.status?"arraybuffer":"text"),n=S(e),a=function(e){var t=e.lowLatencyMode,n=e.segmentLoader;return!0!==e.checkMediaSegmentIntegrity?r:D(r);function r(e,r,i,a,o){var s=c(e,r.segment);if(null==s)return Promise.resolve({resultType:"segment-created",resultData:null});if(t||void 0===n)return B(s,r,t,i,o,a);var u={adaptation:r.adaptation,manifest:r.manifest,period:r.period,representation:r.representation,segment:r.segment,transport:"dash",timeout:i.timeout,url:s};return new Promise((function(e,l){var d=!1,c=n(u,{reject:function(e){var t,n,r;if(!d&&!a.isCancelled()){d=!0,a.deregister(f);var i=e,o=null!==(t=null==i?void 0:i.message)&&void 0!==t?t:"Unknown error when fetching a DASH segment through a custom segmentLoader.",s=new T.Z(o,null!==(n=null==i?void 0:i.canRetry)&&void 0!==n&&n,null!==(r=null==i?void 0:i.isOfflineError)&&void 0!==r&&r,null==i?void 0:i.xhr);l(s)}},resolve:function(t){d||a.isCancelled()||(d=!0,a.deregister(f),e({resultType:"segment-loaded",resultData:{responseData:t.data,size:t.size,requestDuration:t.duration}}))},progress:function(e){d||a.isCancelled()||o.onProgress({duration:e.duration,size:e.size,totalSize:e.totalSize})},fallback:function(){d||a.isCancelled()||(d=!0,a.deregister(f),B(s,r,t,i,o,a).then(e,l))}});function f(e){d||(d=!0,"function"==typeof c&&c(),l(e))}a.register(f)}))}}(e),o=se(e),s=function(e){var t=e.lowLatencyMode;return!0!==e.checkMediaSegmentIntegrity?n:D(n);function n(e,n,r,i,a){var o=n.adaptation,s=n.representation,l=n.segment,d=l.range,f=c(e,l);if(null===f)return Promise.resolve({resultType:"segment-created",resultData:null});if(l.isInit)return O(f,l,r,i,a);var v=M(o.type,s),p="mp4"===v||void 0===v;if(t&&p){if(Z())return U(f,n,r,a,i);(0,R.Z)("DASH: Your browser does not have the fetch API. You will have a higher chance of rebuffering when playing close to the live edge")}return p?(0,u.ZP)({url:f,responseType:"arraybuffer",headers:Array.isArray(d)?{Range:(0,x.Z)(d)}:null,timeout:r.timeout,onProgress:a.onProgress,cancelSignal:i}).then((function(e){return{resultType:"segment-loaded",resultData:e}})):(0,u.ZP)({url:f,responseType:"text",headers:Array.isArray(d)?{Range:(0,x.Z)(d)}:null,timeout:r.timeout,onProgress:a.onProgress,cancelSignal:i}).then((function(e){return{resultType:"segment-loaded",resultData:e}}))}}(e);return{manifest:{loadManifest:t,parseManifest:n},audio:{loadSegment:a,parseSegment:o},video:{loadSegment:a,parseSegment:o},text:{loadSegment:s,parseSegment:ce(e)},image:{loadSegment:f,parseSegment:p}}}},2339:function(e,t,n){"use strict";n.d(t,{Z:function(){return ye}});var r=n(5861),i=n(4687),a=n.n(i),o=n(7874),s=n(3887),u=n(1989),l=n(6807),d=n(9362),c=n(811),f=n(8232),v=n(3911),p=n(1091),h=n(5505);function m(e,t,n){var r=e.timeline,i=e.timescale,a=r[r.length-1],o=t.timescale===i?{time:t.time,duration:t.duration}:{time:t.time/t.timescale*i,duration:t.duration/t.timescale*i};return!(n.time===o.time)&&(o.time>=(0,v.jH)(a,null)&&(a.duration===o.duration?a.repeatCount++:e.timeline.push({duration:o.duration,start:o.time,repeatCount:0}),!0))}function g(e,t){return e.replace(/\{start time\}/g,String(t))}function y(e,t,n){var r=t-e;return r>0?Math.floor(r/n):0}function _(e,t){var n=e.repeatCount;if(null!=e.duration&&n<0){var r=void 0!==t?t.start:1/0;n=Math.ceil((r-e.start)/e.duration)-1}return n}var b=function(){function e(e,t){var n=t.aggressiveMode,r=t.isLive,i=t.segmentPrivateInfos,a=t.timeShiftBufferDepth,o=null==t.manifestReceivedTime?performance.now():t.manifestReceivedTime;if(this._index=e,this._indexValidityTime=o,this._timeShiftBufferDepth=a,this._initSegmentInfos={bitsPerSample:i.bitsPerSample,channels:i.channels,codecPrivateData:i.codecPrivateData,packetSize:i.packetSize,samplingRate:i.samplingRate,timescale:e.timescale,protection:i.protection},this._isAggressiveMode=n,this._isLive=r,0!==e.timeline.length){var s=e.timeline[e.timeline.length-1],u=(0,v.jH)(s,null);if(this._initialScaledLastPosition=u,r){var l=o/1e3*e.timescale;this._scaledLiveGap=l-u}}}var t=e.prototype;return t.getInitSegment=function(){return{id:"init",isInit:!0,privateInfos:{smoothInitSegment:this._initSegmentInfos},url:null,time:0,end:0,duration:0,timescale:1,complete:!0}},t.getSegments=function(e,t){this._refreshTimeline();for(var n,r=function(e,t,n){var r=void 0===e.timescale||0===e.timescale?1:e.timescale;return{up:t*r,to:(t+n)*r}}(this._index,e,t),i=r.up,a=r.to,o=this._index,s=o.timeline,u=o.timescale,l=o.media,d=this._isAggressiveMode,c=[],f=s.length,v=null==this._scaledLiveGap?void 0:performance.now()/1e3*u-this._scaledLiveGap,p=0;p=a)return c;null!=n&&(n+=S+1)}return c},t.shouldRefresh=function(e,t){if(this._refreshTimeline(),!this._isLive)return!1;var n=this._index,r=n.timeline,i=n.timescale,a=r[r.length-1];if(void 0===a)return!1;var o=a.repeatCount,s=a.start+(o+1)*a.duration;return!(t*i=s||e*i>a.start+o*a.duration)},t.getFirstAvailablePosition=function(){this._refreshTimeline();var e=this._index;return 0===e.timeline.length?null:e.timeline[0].start/e.timescale},t.getLastAvailablePosition=function(){this._refreshTimeline();var e=this._index;if(null==this._scaledLiveGap){var t=e.timeline[e.timeline.length-1];return(0,v.jH)(t,null)/e.timescale}for(var n=e.timeline.length-1;n>=0;n--)for(var r=e.timeline[n],i=performance.now()/1e3*e.timescale,a=r.start,o=r.duration,s=r.repeatCount;s>=0;s--){var u=a+o*(s+1);if((this._isAggressiveMode?u-o:u)<=i-this._scaledLiveGap)return u/e.timescale}},t.getEnd=function(){if(!this._isLive)return this.getLastAvailablePosition()},t.awaitSegmentBetween=function(e,t){var n;if((0,c.Z)(e<=t),this.isFinished())return!1;var r=this.getLastAvailablePosition();return!(void 0!==r&&t(null!==(n=this.getFirstAvailablePosition())&&void 0!==n?n:0)&&void 0)},t.checkDiscontinuity=function(e){return this._refreshTimeline(),(0,v._j)(this._index,e,void 0)},t.isSegmentStillAvailable=function(e){if(e.isInit)return!0;this._refreshTimeline();var t=this._index,n=t.timeline,r=t.timescale;return(0,p.Z)(e,n,r,0)},t.canBeOutOfSyncError=function(e){return!!this._isLive&&(e instanceof d.Z&&(e.isHttpError(404)||e.isHttpError(412)))},t._replace=function(e){var t=this._index.timeline,n=e._index.timeline,r=this._index.timescale,i=e._index.timescale;if(this._index=e._index,this._initialScaledLastPosition=e._initialScaledLastPosition,this._indexValidityTime=e._indexValidityTime,this._scaledLiveGap=e._scaledLiveGap,0!==t.length&&0!==n.length&&r===i){var a=t[t.length-1],o=n[n.length-1],u=(0,v.jH)(o,null);if(!((0,v.jH)(a,null)<=u))for(var l=0;lu){if(d.duration!==o.duration)return;var f=u-d.start;if(0===f)return s.Z.warn("Smooth Parser: a discontinuity detected in the previous manifest has been resolved."),void(this._index.timeline=this._index.timeline.concat(t.slice(l)));if(f<0||f%d.duration!=0)return;var p=f/d.duration-1,h=d.repeatCount-p;if(h<0)return;o.repeatCount+=h;var m=t.slice(l+1);return void(this._index.timeline=this._index.timeline.concat(m))}}}},t._update=function(e){(0,h.Z)(this._index.timeline,e._index.timeline),this._initialScaledLastPosition=e._initialScaledLastPosition,this._indexValidityTime=e._indexValidityTime,this._scaledLiveGap=e._scaledLiveGap},t.isFinished=function(){return!this._isLive},t.isInitialized=function(){return!0},t.addNewSegments=function(e,t){this._refreshTimeline();for(var n=0;n>3:2)?"mp4a.40.2":"mp4a.40."+n}(u,l);return{audiotag:void 0!==i?parseInt(i,10):i,bitrate:v,bitsPerSample:void 0!==a?parseInt(a,10):a,channels:void 0!==o?parseInt(o,10):o,codecPrivateData:u,codecs:p,customAttributes:n,mimeType:void 0!==l?F[l]:l,packetSize:void 0!==d?parseInt(d,10):d,samplingRate:void 0!==c?parseInt(c,10):c};case"video":var h=r("CodecPrivateData"),m=r("FourCC"),g=r("MaxWidth"),y=r("MaxHeight"),_=r("Bitrate"),b=void 0===_||isNaN(parseInt(_,10))?0:parseInt(_,10);if(void 0!==m&&void 0===F[m]||void 0===h)return s.Z.warn("Smooth parser: Unsupported video codec. Ignoring quality level."),null;var S=function(e){var t=/00000001\d7([0-9a-fA-F]{6})/.exec(e);return null!==t&&(0,k.Z)(t[1])?"avc1."+t[1]:"avc1.4D401E"}(h);return{bitrate:b,customAttributes:n,mimeType:void 0!==m?F[m]:m,codecPrivateData:h,codecs:S,width:void 0!==g?parseInt(g,10):void 0,height:void 0!==y?parseInt(y,10):void 0};case"text":var T=r("CodecPrivateData"),E=r("FourCC"),w=r("Bitrate");return{bitrate:void 0===w||isNaN(parseInt(w,10))?0:parseInt(w,10),customAttributes:n,mimeType:void 0!==E?F[E]:E,codecPrivateData:(0,Z.Z)(T,"")};default:return s.Z.error("Smooth Parser: Unrecognized StreamIndex type: "+t),null}}function o(t){var r=t.root,i=t.timescale,o=t.baseUrl,u=t.protections,l=t.timeShiftBufferDepth,d=t.manifestReceivedTime,f=t.isLive,v=r.getAttribute("Timescale"),p=null===v||isNaN(+v)?i:+v,h=r.getAttribute("Type");if(null===h)throw new Error("StreamIndex without type.");(0,T.Z)(S.r,h)||s.Z.warn("Smooth Parser: Unrecognized adaptation type:",h);var m=h,g=r.getAttribute("Subtype"),y=r.getAttribute("Language"),_=r.getAttribute("Url"),A=null===_?"":_;var Z,R=U(r,(function(e,t,r){switch(t){case"QualityLevel":var i=a(r,m);if(null===i)return e;("video"!==m||i.bitrate>n)&&e.qualityLevels.push(i);break;case"c":e.cNodes.push(r)}return e}),{qualityLevels:[],cNodes:[]}),x=R.qualityLevels,M=R.cNodes,P={timeline:(Z=M,Z.reduce((function(e,t,n){var r=t.getAttribute("d"),i=t.getAttribute("t"),a=t.getAttribute("r"),o=null!==a?+a-1:0,s=null!==i?+i:void 0,u=null!==r?+r:void 0;if(0===n)s=void 0===s||isNaN(s)?0:s;else{var l=e[n-1];if(null==s||isNaN(s)){if(null==l.duration||isNaN(l.duration))throw new Error("Smooth: Invalid CNodes. Missing timestamp.");s=l.start+l.duration*(l.repeatCount+1)}}if(null==u||isNaN(u)){var d=Z[n+1];if(void 0===d)return e;var c=d.getAttribute("t"),f=(0,k.Z)(c)?+c:null;if(null===f)throw new Error("Can't build index timeline from Smooth Manifest.");u=f-s}return e.push({duration:u,start:s,repeatCount:o}),e}),[])),timescale:p};(0,c.Z)(0!==x.length,"Adaptation should have at least one playable representation.");var D=m+((0,k.Z)(y)?"_"+y:""),N=x.map((function(t){var n,r,i,a,s={timeline:P.timeline,timescale:P.timescale,media:(n=A,r=t.bitrate,i=t.customAttributes,n.replace(/\{bitrate\}/g,String(r)).replace(/{CustomAttributes}/g,i.length>0?i[0]:""))},c=(0,k.Z)(t.mimeType)?t.mimeType:B[m],v=t.codecs,p=D+"_"+(null!=m?m+"-":"")+(null!=c?c+"-":"")+(null!=v?v+"-":"")+String(t.bitrate),h=[];u.length>0&&(a=u[0],u.forEach((function(e){var t=e.keyId;e.keySystems.forEach((function(e){h.push({keyId:t,systemId:e.systemId})}))})));var g={bitsPerSample:t.bitsPerSample,channels:t.channels,codecPrivateData:t.codecPrivateData,packetSize:t.packetSize,samplingRate:t.samplingRate,protection:null!=a?{keyId:a.keyId}:void 0},y=null!=e.aggressiveMode&&e.aggressiveMode,_=new b(s,{aggressiveMode:y,isLive:f,manifestReceivedTime:d,segmentPrivateInfos:g,timeShiftBufferDepth:l}),S=(0,w.Z)({},t,{index:_,cdnMetadata:[{baseUrl:o}],mimeType:c,codecs:v,id:p});if(h.length>0||void 0!==a){var T=void 0===a?[]:a.keySystems.map((function(e){var t=e.systemId,n=e.privateData,r=t.replace(/-/g,""),i=function(e,t){if(32!==e.length)throw new Error("HSS: wrong system id length");var n=0;return C("pssh",(0,E.zo)([n,0,0,0],(0,I.nr)(e),(0,E.kh)(t.length),t))}(r,n);return{systemId:r,data:i}}));if(T.length>0){var Z=[{type:"cenc",values:T}];S.contentProtections={keyIds:h,initData:Z}}else S.contentProtections={keyIds:h,initData:[]}}return S}));if("ADVT"===g)return null;var O={id:D,type:m,representations:N,language:null==y?void 0:y};return"text"===m&&"DESC"===g&&(O.closedCaption=!0),O}return function(n,r,a){var s="";if(void 0!==r){var u=(0,A.$)(r);s=r.substring(0,u)}var l=n.documentElement;if(null==l||"SmoothStreamingMedia"!==l.nodeName)throw new Error("document root should be SmoothStreamingMedia");var d=l.getAttribute("MajorVersion"),c=l.getAttribute("MinorVersion");if(null===d||null===c||!/^[2]-[0-2]$/.test(d+"-"+c))throw new Error("Version should be 2.0, 2.1 or 2.2");var f,v,p=l.getAttribute("Timescale"),h=(0,k.Z)(p)?isNaN(+p)?1e7:+p:1e7,m=U(l,(function(t,n,r){switch(n){case"Protection":t.protections.push(L(r,e.keySystems));break;case"StreamIndex":t.adaptationNodes.push(r)}return t}),{adaptationNodes:[],protections:[]}),g=m.protections,y=m.adaptationNodes,_="boolean"==typeof(f=l.getAttribute("IsLive"))?f:"string"==typeof f&&"TRUE"===f.toUpperCase();if(_){var b=l.getAttribute("DVRWindowLength");null==b||isNaN(+b)||0==+b||(v=+b/h)}var S,T,E,w,I,Z,R,x=y.reduce((function(e,t){var n=o({root:t,baseUrl:s,timescale:h,protections:g,isLive:_,timeShiftBufferDepth:v,manifestReceivedTime:a});if(null===n)return e;var r=n.type,i=e[r];return void 0===i?e[r]=[n]:i.push(n),e}),{}),M=null,C=void 0!==x.video?x.video[0]:void 0,P=void 0!==x.audio?x.audio[0]:void 0;if(void 0!==C||void 0!==P){var N=[],O=[];if(void 0!==C){var B=C.representations[0];if(void 0!==B){var F=B.index.getFirstAvailablePosition(),V=B.index.getLastAvailablePosition();null!=F&&N.push(F),null!=V&&O.push(V)}}if(void 0!==P){var z=P.representations[0];if(void 0!==z){var K=z.index.getFirstAvailablePosition(),G=z.index.getLastAvailablePosition();null!=K&&N.push(K),null!=G&&O.push(G)}}N.length>0&&(I=Math.max.apply(Math,N)),O.length>0&&(Z=Math.min.apply(Math,O),R=Math.max.apply(Math,O))}var W=l.getAttribute("Duration"),H=null!==W&&0!=+W?+W/h:void 0;if(_){S=e.suggestedPresentationDelay,T=t,E=null!=I?I:T;var j=R;void 0===j&&(j=Date.now()/1e3-T);var q=Z;void 0===q&&(q=j),w={isLinear:!0,maximumSafePosition:q,livePosition:j,time:performance.now()},M=null!=v?v:null}else{E=null!=I?I:0,w={isLinear:!1,maximumSafePosition:void 0!==Z?Z:void 0!==H?E+H:1/0,livePosition:void 0,time:performance.now()}}var Y=_?0:E,X=_?void 0:w.maximumSafePosition,Q={availabilityStartTime:void 0===T?0:T,clockOffset:i,isLive:_,isDynamic:_,isLastPeriodKnown:!0,timeBounds:{minimumSafePosition:E,timeshiftDepth:M,maximumTimeData:w},periods:[{adaptations:x,duration:void 0!==X?X-Y:H,end:X,id:"gen-smooth-period-0",start:Y}],suggestedPresentationDelay:S,transportType:"smooth",uris:null==r?[]:[r]};return D(Q),Q}},z=V,K=n(4597),G=n(8806),W=n(4460),H=n(8791),j=n(4644),q=n(2297);function Y(e,t,n,r,i){var a,o,u,d=[];if(i){var c=(0,l.XA)(e);null!==c?(u=function(e){var t=(0,q.nR)(e,3565190898,3392751253,2387879627,2655430559);if(void 0===t)return[];for(var n=[],r=t[0],i=t[4],a=0;a0;if(n)return e;var r=new Uint8Array(e.length+4);return r.set(e.subarray(0,t+8),0),r[t+3]=1|r[t+3],r.set([0,0,0,0],t+8),r.set(e.subarray(t+8,e.length),t+12),(0,j.J6)(r)}(l,s[1]-s[0]),f=te(u,d,c,i,(0,q.nR)(a,2721664850,1520127764,2722393154,2086964724)),v=P("moof",[i,f]),p=(0,q.Qy)(v,1836019558),h=(0,q.Qy)(f,1953653094),m=(0,q.Qy)(c,1953658222);if(null===p||null===h||null===m)throw new Error("Smooth: Invalid moof, trun or traf generation");var g=p[1]-p[0]+i.length+(h[1]-h[0])+u.length+d.length+(m[1]-m[0])+8,y=n[2]-n[0],_=v.length-y,b=(0,q.Qy)(e,1835295092);if(null===b)throw new Error("Smooth: Invalid ISOBMFF given");if(!X.YM&&(0===_||_<=-8)){var S=b[1];return v.set((0,E.kh)(S),g),e.set(v,n[0]),_<=-8&&e.set(C("free",new Uint8Array(-_-8)),v.length),e}var T=b[1]+_;v.set((0,E.kh)(T),g);var k=new Uint8Array(e.length+_),w=e.subarray(0,n[0]),A=e.subarray(n[2],e.length);return k.set(w,0),k.set(v,w.length),k.set(A,w.length+v.length),k}var re=n(7839),ie=n(281);function ae(e,t,n,r,i,a){var o,s,u,l=P("stbl",[n,C("stts",new Uint8Array(8)),C("stsc",new Uint8Array(8)),C("stsz",new Uint8Array(12)),C("stco",new Uint8Array(8))]),d=function(e){return C("dref",(0,E.zo)(7,[1],e))}(C("url ",new Uint8Array([0,0,0,1]))),c=P("dinf",[d]),f=P("minf",[r,c,l]),v=function(e){var t,n;switch(e){case"video":t="vide",n="VideoHandler";break;case"audio":t="soun",n="SoundHandler";break;default:t="hint",n=""}return C("hdlr",(0,E.zo)(8,(0,I.tG)(t),12,(0,I.tG)(n),1))}(t),p=function(e){return C("mdhd",(0,E.zo)(12,(0,E.kh)(e),8))}(e),h=P("mdia",[p,v,f]),m=function(e,t,n){return C("tkhd",(0,E.zo)((0,E.kh)(7),8,(0,E.kh)(n),20,[1,0,0,0],[0,1,0,0],12,[0,1,0,0],12,[64,0,0,0],(0,E.XT)(e),2,(0,E.XT)(t),2))}(i,a,1),g=P("trak",[m,h]),y=P("mvex",[(o=1,C("trex",(0,E.zo)(4,(0,E.kh)(o),[0,0,0,1],12)))]),_=function(e,t){return C("mvhd",(0,E.zo)(12,(0,E.kh)(e),4,[0,1],2,[1,0],10,[0,1],14,[0,1],14,[64,0,0,0],26,(0,E.XT)(t+1)))}(e,1),b=function(e,t,n){return P("moov",[e,t,n])}(_,y,g),S=(s="isom",u=["isom","iso2","iso6","avc1","dash"],C("ftyp",E.zo.apply(void 0,[(0,I.tG)(s),[0,0,0,1]].concat(u.map(I.tG)))));return(0,E.zo)(S,b)}function oe(e,t,n,r,i,a,o,s){var u=o.split("00000001"),l=u[1],d=u[2];if(void 0===l||void 0===d)throw new Error("Smooth: unsupported codec private data.");var c,f,v=function(e,t,n){var r=2===n?1:4===n?3:0,i=e[1],a=e[2],o=e[3];return C("avcC",(0,E.zo)([1,i,a,o,252|r,225],(0,E.XT)(e.length),e,[1],(0,E.XT)(t.length),t))}((0,I.nr)(l),(0,I.nr)(d),a);if(void 0===s){var p=function(e,t,n,r,i,a,o){return C("avc1",(0,E.zo)(6,(0,E.XT)(1),16,(0,E.XT)(e),(0,E.XT)(t),(0,E.XT)(n),2,(0,E.XT)(r),6,[0,1,i.length],(0,I.tG)(i),31-i.length,(0,E.XT)(a),[255,255],o))}(t,n,r,i,"AVC Coding",24,v);c=J([p])}else{var h=P("schi",[ee(1,8,s)]),m=Q("cenc",65536),g=function(e,t,n,r,i,a,o,s){return C("encv",(0,E.zo)(6,(0,E.XT)(1),16,(0,E.XT)(e),(0,E.XT)(t),(0,E.XT)(n),2,(0,E.XT)(r),6,[0,1,i.length],(0,I.tG)(i),31-i.length,(0,E.XT)(a),[255,255],o,s))}(t,n,r,i,"AVC Coding",24,v,P("sinf",[$("avc1"),m,h]));c=J([g])}return ae(e,"video",c,((f=new Uint8Array(12))[3]=1,C("vmhd",f)),t,n)}var se=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];function ue(e,t,n,r,i,a,o){var s,u,l,d=function(e,t){return C("esds",(0,E.zo)(4,[3,25],(0,E.XT)(e),[0,4,17,64,21],11,[5,2],(0,I.nr)(t),[6,1,2]))}(1,0===a.length?(s=i,u=t,l=((l=((l=(63&2)<<4)|31&se.indexOf(s))<<4)|31&u)<<3,(0,I.ci)((0,E.XT)(l))):a),c=function(){if(void 0===o){var e=function(e,t,n,r,i,a){return C("mp4a",(0,E.zo)(6,(0,E.XT)(e),8,(0,E.XT)(t),(0,E.XT)(n),2,(0,E.XT)(r),(0,E.XT)(i),2,a))}(1,t,n,r,i,d);return J([e])}var a=P("schi",[ee(1,8,o)]),s=Q("cenc",65536),u=P("sinf",[$("mp4a"),s,a]),l=function(e,t,n,r,i,a,o){return C("enca",(0,E.zo)(6,(0,E.XT)(e),8,(0,E.XT)(t),(0,E.XT)(n),2,(0,E.XT)(r),(0,E.XT)(i),2,a,o))}(1,t,n,r,i,d,u);return J([l])}();return ae(e,"audio",c,C("smhd",new Uint8Array(8)),0,0)}var le=/(\.isml?)(\?token=\S+)?$/,de=/\?token=(\S+)/;function ce(e,t){return(0,k.Z)(t)?e.replace(de,"?token="+t):e.replace(de,"")}function fe(e){return"string"==typeof e.mimeType&&e.mimeType.indexOf("mp4")>=0}function ve(e,t){return null===e?null:null===t.url?e.baseUrl:(0,A.Z)(e.baseUrl,t.url)}function pe(e,t,n,r,i,a){var o,s=t.segment.range;return Array.isArray(s)&&(o={Range:(0,ie.Z)(s)}),(0,K.ZP)({url:e,responseType:"arraybuffer",headers:o,timeout:r.timeout,cancelSignal:i,onProgress:n.onProgress}).then((function(e){if(!fe(t.representation)||!0!==a)return{resultType:"segment-loaded",resultData:e};var n=new Uint8Array(e.responseData);return(0,W.Z)(n,t.segment.isInit),{resultType:"segment-loaded",resultData:Object.assign(Object.assign({},e),{responseData:n})}}))}var he=function(e){var t=e.checkMediaSegmentIntegrity,n=e.customSegmentLoader;return function(e,r,i,a,o){var s=r.segment,u=r.manifest,l=r.period,d=r.adaptation,c=r.representation;if(s.isInit){if(void 0===s.privateInfos||void 0===s.privateInfos.smoothInitSegment)throw new Error("Smooth: Invalid segment format");var f,v=s.privateInfos.smoothInitSegment,p=v.codecPrivateData,h=v.timescale,m=v.protection,g=void 0===m?{keyId:void 0,keySystems:void 0}:m;if(void 0===p)throw new Error("Smooth: no codec private data.");switch(d.type){case"video":var y=c.width,_=void 0===y?0:y,b=c.height;f=oe(h,_,void 0===b?0:b,72,72,4,p,g.keyId);break;case"audio":var S=v.channels,T=void 0===S?0:S,E=v.bitsPerSample,k=void 0===E?0:E,w=v.packetSize,A=void 0===w?0:w,I=v.samplingRate;f=ue(h,T,k,A,void 0===I?0:I,p,g.keyId);break;default:0,f=new Uint8Array(0)}return Promise.resolve({resultType:"segment-created",resultData:f})}if(null===e)return Promise.resolve({resultType:"segment-created",resultData:null});var Z={adaptation:d,manifest:u,period:l,representation:c,segment:s,transport:"smooth",timeout:i.timeout,url:e};return"function"!=typeof n?pe(e,r,o,i,a,t):new Promise((function(s,u){var l=!1,d=n(Z,{reject:function(e){var t,n,r;if(!l&&!a.isCancelled()){l=!0,a.deregister(c);var i=e,o=null!==(t=null==i?void 0:i.message)&&void 0!==t?t:"Unknown error when fetching a Smooth segment through a custom segmentLoader.",s=new re.Z(o,null!==(n=null==i?void 0:i.canRetry)&&void 0!==n&&n,null!==(r=null==i?void 0:i.isOfflineError)&&void 0!==r&&r,null==i?void 0:i.xhr);u(s)}},resolve:function(e){if(!l&&!a.isCancelled()){l=!0,a.deregister(c),fe(r.representation)&&!0===t||s({resultType:"segment-loaded",resultData:{responseData:e.data,size:e.size,requestDuration:e.duration}});var n=e.data instanceof Uint8Array?e.data:new Uint8Array(e.data);(0,W.Z)(n,r.segment.isInit),s({resultType:"segment-loaded",resultData:{responseData:n,size:e.size,requestDuration:e.duration}})}},fallback:function(){l||a.isCancelled()||(l=!0,a.deregister(c),pe(e,r,o,i,a,t).then(s,u))},progress:function(e){l||a.isCancelled()||o.onProgress({duration:e.duration,size:e.size,totalSize:e.totalSize})}});function c(e){l||((l=!0)||"function"!=typeof d||d(),u(e))}a.register(c)}))}},me=/\.wsx?(\?token=\S+)?/;function ge(e,t,n){var r;s.Z.debug("Smooth Parser: update segments information.");for(var i=e.representations,a=0;a0&&ge(o,v,a),{segmentType:"media",chunkData:h,chunkInfos:p,chunkOffset:0,chunkSize:h.length,protectionDataUpdate:!1,appendWindow:[void 0,void 0]}}},c={loadSegment:function(t,n,r,i,a){var o=n.segment,s=n.representation,u=ve(t,o);return o.isInit||null===u?Promise.resolve({resultType:"segment-created",resultData:null}):fe(s)?(0,K.ZP)({url:u,responseType:"arraybuffer",timeout:r.timeout,cancelSignal:i,onProgress:a.onProgress}).then((function(t){if(!0!==e.checkMediaSegmentIntegrity)return{resultType:"segment-loaded",resultData:t};var r=new Uint8Array(t.responseData);return(0,W.Z)(r,n.segment.isInit),{resultType:"segment-loaded",resultData:Object.assign(Object.assign({},t),{responseData:r})}})):(0,K.ZP)({url:u,responseType:"text",timeout:r.timeout,cancelSignal:i,onProgress:a.onProgress}).then((function(e){return{resultType:"segment-loaded",resultData:e}}))},parseSegment:function(e,t,n){var r,i,a,o=t.manifest,u=t.adaptation,d=t.representation,c=t.segment,f=u.language,v=fe(d),p=d.mimeType,h=void 0===p?"":p,m=d.codec,g=void 0===m?"":m,y=e.data,_=e.isChunked;if(c.isInit)return{segmentType:"init",initializationData:null,initializationDataSize:0,protectionDataUpdate:!1,initTimescale:void 0};if(null===y)return{segmentType:"media",chunkData:null,chunkInfos:null,chunkOffset:0,chunkSize:0,protectionDataUpdate:!1,appendWindow:[void 0,void 0]};var b,S,T,E,k=null;if(v){var w;i=(w="string"==typeof y?(0,I.tG)(y):y instanceof Uint8Array?y:new Uint8Array(y)).length;var A=void 0!==n?Y(w,_,n,c,o.isLive):null;a=null==A?void 0:A.nextSegments,null===(k=null!==(r=null==A?void 0:A.chunkInfos)&&void 0!==r?r:null)?_?s.Z.warn("Smooth: Unavailable time data for current text track."):(b=c.time,S=c.end):(b=k.time,S=void 0!==k.duration?k.time+k.duration:c.end);var Z=g.toLowerCase();if("application/ttml+xml+mp4"===h||"stpp"===Z||"stpp.ttml.im1t"===Z)E="ttml";else{if("wvtt"!==Z)throw new Error("could not find a text-track parser for the type "+h);E="vtt"}var R=(0,l.Le)(w);T=null===R?"":(0,I.uR)(R)}else{var x;if(b=c.time,S=c.end,"string"!=typeof y){var M=y instanceof Uint8Array?y:new Uint8Array(y);i=M.length,x=(0,I.uR)(M)}else x=y;switch(h){case"application/x-sami":case"application/smil":E="sami";break;case"application/ttml+xml":E="ttml";break;case"text/vtt":E="vtt"}if(void 0===E){if("srt"!==g.toLowerCase())throw new Error("could not find a text-track parser for the type "+h);E="srt"}T=x}return null!==k&&Array.isArray(a)&&a.length>0&&ge(u,a,c),{segmentType:"media",chunkData:{type:E,data:T,start:b,end:S,language:f},chunkSize:i,chunkInfos:k,chunkOffset:null!=b?b:0,protectionDataUpdate:!1,appendWindow:[void 0,void 0]}}};return{manifest:{resolveManifestUrl:function(e,t){if(void 0===e)return Promise.resolve(void 0);var n;me.test(e)?((0,G.Z)("Giving WSX URL to loadVideo is deprecated. You should only give Manifest URLs."),n=(0,K.ZP)({url:ce(e,""),responseType:"document",cancelSignal:t}).then((function(e){var t=e.responseData.getElementsByTagName("media")[0].getAttribute("src");if(null===t||0===t.length)throw new Error("Invalid ISML");return t}))):n=Promise.resolve(e);var r=function(e){var t=de.exec(e);if(null!==t){var n=t[1];if(void 0!==n)return n}return""}(e);return n.then((function(e){return ce(function(e){return le.test(e)?((0,G.Z)("Giving a isml URL to loadVideo is deprecated. Please give the Manifest URL directly"),e.replace(le,"$1/manifest$2")):e}(e),r)}))},loadManifest:(0,H.Z)(i,"text"),parseManifest:function(n,r){var i,a=null!==(i=n.url)&&void 0!==i?i:r.originalUrl,o=n.receivedTime,s=n.responseData,l="string"==typeof s?(new DOMParser).parseFromString(s,"text/xml"):s,d=t(l,a,o);return{manifest:new u.ZP(d,{representationFilter:e.representationFilter,supplementaryImageTracks:e.supplementaryImageTracks,supplementaryTextTracks:e.supplementaryTextTracks}),url:a}}},audio:d,video:d,text:c,image:{loadSegment:function(e,t,n,i,o){return(0,r.Z)(a().mark((function r(){var s,u,l;return a().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(s=t.segment,u=ve(e,s),!s.isInit&&null!==u){r.next=4;break}return r.abrupt("return",{resultType:"segment-created",resultData:null});case 4:return r.next=6,(0,K.ZP)({url:u,responseType:"arraybuffer",timeout:n.timeout,onProgress:o.onProgress,cancelSignal:i});case 6:return l=r.sent,r.abrupt("return",{resultType:"segment-loaded",resultData:l});case 8:case"end":return r.stop()}}),r)})))()},parseSegment:function(e,t,n){var r=e.data,i=e.isChunked;if(t.segment.isInit)return{segmentType:"init",initializationData:null,initializationDataSize:0,protectionDataUpdate:!1,initTimescale:void 0};if(i)throw new Error("Image data should not be downloaded in chunks");return null===r||null===o.Z.imageParser?{segmentType:"media",chunkData:null,chunkInfos:null,chunkOffset:0,chunkSize:0,protectionDataUpdate:!1,appendWindow:[void 0,void 0]}:{segmentType:"media",chunkData:{data:o.Z.imageParser(new Uint8Array(r)).thumbs,start:0,end:Number.MAX_VALUE,timescale:1,type:"bif"},chunkInfos:{time:0,duration:Number.MAX_VALUE},chunkSize:void 0,chunkOffset:0,protectionDataUpdate:!1,appendWindow:[void 0,void 0]}}}}}},281:function(e,t,n){"use strict";function r(e){var t=e[0],n=e[1];return n===1/0?"bytes="+t+"-":"bytes="+t+"-"+n}n.d(t,{Z:function(){return r}})},4460:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(5389),i=n(8766);function a(e,t){if(t){if((0,i.Z)(e,1718909296)<0)throw new r.Z("INTEGRITY_ERROR","Incomplete `ftyp` box");if((0,i.Z)(e,1836019574)<0)throw new r.Z("INTEGRITY_ERROR","Incomplete `moov` box")}else{if((0,i.Z)(e,1836019558)<0)throw new r.Z("INTEGRITY_ERROR","Incomplete `moof` box");if((0,i.Z)(e,1835295092)<0)throw new r.Z("INTEGRITY_ERROR","Incomplete `mdat` box")}}},8766:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(6968);function i(e,t){for(var n=e.length,i=0;i+8<=n;){var a=(0,r.pX)(e,i);if(0===a)a=n-i;else if(1===a){if(i+16>n)return-1;a=(0,r.pV)(e,i+8)}if(isNaN(a)||a<=0)return-1;if((0,r.pX)(e,i+4)===t)return i+a<=n?i:-1;i+=a}return-1}},8791:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var r=n(7904),i=n(4597),a=n(7839);function o(e,t){var n=e.customManifestLoader,o=function(e){return function(t,n,a){if(void 0===t)throw new Error("Cannot perform HTTP(s) request. URL not known");switch(e){case"arraybuffer":return(0,i.ZP)({url:t,responseType:"arraybuffer",timeout:n.timeout,cancelSignal:a});case"text":return(0,i.ZP)({url:t,responseType:"text",timeout:n.timeout,cancelSignal:a});case"document":return(0,i.ZP)({url:t,responseType:"document",timeout:n.timeout,cancelSignal:a});default:(0,r.Z)(e)}}}(t);return"function"!=typeof n?o:function(e,t){return function(n,r,i){return new Promise((function(o,s){var u=Date.now()-performance.now(),l=!1,d=e(n,{reject:function(e){var t,n,r;if(!l&&!i.isCancelled()){l=!0,i.deregister(c);var o=e,u=null!==(t=null==o?void 0:o.message)&&void 0!==t?t:"Unknown error when fetching the Manifest through a custom manifestLoader.",d=new a.Z(u,null!==(n=null==o?void 0:o.canRetry)&&void 0!==n&&n,null!==(r=null==o?void 0:o.isOfflineError)&&void 0!==r&&r,null==o?void 0:o.xhr);s(d)}},resolve:function(e){if(!l&&!i.isCancelled()){l=!0,i.deregister(c);var t=void 0!==e.receivingTime?e.receivingTime-u:void 0,n=void 0!==e.sendingTime?e.sendingTime-u:void 0;o({responseData:e.data,size:e.size,requestDuration:e.duration,url:e.url,receivedTime:t,sendingTime:n})}},fallback:function(){l||i.isCancelled()||(l=!0,i.deregister(c),t(n,r,i).then(o,s))}},{timeout:r.timeout});function c(e){l||(l=!0,"function"==typeof d&&d(),s(e))}i.register(c)}))}}(n,o)}},4791:function(e,t,n){"use strict";function r(e,t){if(e.length!==t.length)return!1;for(var n=e.length-1;n>=0;n--)if(e[n]!==t[n])return!1;return!0}n.d(t,{Z:function(){return r}})},3274:function(e,t,n){"use strict";function r(e,t,n){if("function"==typeof Array.prototype.find)return e.find(t,n);for(var r=e.length>>>0,i=0;i>>0,i=0;i>>0;if(0===r)return!1;for(var i,a,o=0|n,s=o>=0?Math.min(o,r-1):Math.max(r+o,0);s=a.length)throw new Error("Unable to parse base64 string.");var t=a[e];if(255===t)throw new Error("Unable to parse base64 string.");return t}function s(e){var t,n="",r=e.length;for(t=2;t>2],n+=i[(3&e[t-2])<<4|e[t-1]>>4],n+=i[(15&e[t-1])<<2|e[t]>>6],n+=i[63&e[t]];return t===r+1&&(n+=i[e[t-2]>>2],n+=i[(3&e[t-2])<<4],n+="=="),t===r&&(n+=i[e[t-2]>>2],n+=i[(3&e[t-2])<<4|e[t-1]>>4],n+=i[(15&e[t-1])<<2],n+="="),n}function u(e){var t=e.length%4,n=e;0!==t&&(r.Z.warn("base64ToBytes: base64 given miss padding"),n+=3===t?"=":2===t?"==":"===");var i=n.indexOf("=");if(-1!==i&&i>16,l[c+1]=a>>8&255,l[c+2]=255&a;return l.subarray(0,l.length-s)}},6968:function(e,t,n){"use strict";function r(){for(var e,t=arguments.length,n=-1,r=0;++n0&&(i.set(e,a),a+=e.length);return i}function i(e,t){return(e[t+0]<<8)+(e[t+1]<<0)}function a(e,t){return 65536*e[t+0]+256*e[t+1]+e[t+2]}function o(e,t){return 16777216*e[t+0]+65536*e[t+1]+256*e[t+2]+e[t+3]}function s(e,t){return 4294967296*(16777216*e[t+0]+65536*e[t+1]+256*e[t+2]+e[t+3])+16777216*e[t+4]+65536*e[t+5]+256*e[t+6]+e[t+7]}function u(e){return new Uint8Array([e>>>8&255,255&e])}function l(e){return new Uint8Array([e>>>24&255,e>>>16&255,e>>>8&255,255&e])}function d(e){var t=e%4294967296,n=(e-t)/4294967296;return new Uint8Array([n>>>24&255,n>>>16&255,n>>>8&255,255&n,t>>>24&255,t>>>16&255,t>>>8&255,255&t])}function c(e,t){return(e[t+0]<<0)+(e[t+1]<<8)}function f(e,t){return e[t+0]+256*e[t+1]+65536*e[t+2]+16777216*e[t+3]}function v(e){return new Uint8Array([255&e,e>>>8&255,e>>>16&255,e>>>24&255])}function p(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer)}n.d(t,{O_:function(){return v},QI:function(){return a},XT:function(){return u},_f:function(){return p},dN:function(){return f},el:function(){return d},kh:function(){return l},pV:function(){return s},pX:function(){return o},qb:function(){return c},zK:function(){return i},zo:function(){return r}})},7864:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(7733);function i(e,t){return(0,r.Z)(t,(function(t){var n=setTimeout((function(){return t()}),e);return function(){return clearTimeout(n)}}))}},7733:function(e,t,n){"use strict";function r(e,t){var n;return new Promise((function(r,i){if(null!==e.cancellationError)return i(e.cancellationError);var a=!1;function o(e){void 0!==n&&n(),i(e)}n=t((function(t){e.deregister(o),a=!0,r(t)}),(function(t){e.deregister(o),a=!0,i(t)})),a||e.register(o)}))}n.d(t,{Z:function(){return r}})},1959:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(3887),i=n(1946),a=function(){function e(){this._listeners={}}var t=e.prototype;return t.addEventListener=function(e,t,n){var r=this,i=this._listeners[e];Array.isArray(i)?i.push(t):this._listeners[e]=[t],void 0!==n&&n.register((function(){r.removeEventListener(e,t)}))},t.removeEventListener=function(e,t){if((0,i.Z)(e))this._listeners={};else{var n=this._listeners[e];if(Array.isArray(n))if((0,i.Z)(t))delete this._listeners[e];else{var r=n.indexOf(t);-1!==r&&n.splice(r,1),0===n.length&&delete this._listeners[e]}}},t.trigger=function(e,t){var n=this._listeners[e];Array.isArray(n)&&n.slice().forEach((function(e){try{e(t)}catch(e){r.Z.error("EventEmitter: listener error",e instanceof Error?e:null)}}))},e}()},9592:function(e,t,n){"use strict";function r(e,t){return"function"==typeof Array.prototype.flatMap?e.flatMap(t):e.reduce((function(e,n){var r=t(n);return Array.isArray(r)?(e.push.apply(e,r),e):(e.push(r),e)}),[])}n.d(t,{Z:function(){return r}})},2572:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=.3;function i(e){return e*((2*Math.random()-1)*r+1)}},2870:function(e,t,n){"use strict";function r(e){for(var t=0,n=0;n=Number.MAX_SAFE_INTEGER&&(e+="0",t=0),e+String(t)}}n.d(t,{Z:function(){return r}})},6923:function(e,t,n){"use strict";function r(e){return"string"==typeof e&&e.length>0}n.d(t,{Z:function(){return r}})},1946:function(e,t,n){"use strict";function r(e){return null==e}n.d(t,{Z:function(){return r}})},7829:function(e,t,n){"use strict";var r=n(5553);t.ZP=r.ZP},5553:function(e,t,n){"use strict";n.d(t,{ZP:function(){return d},iH:function(){return l},Y1:function(){return u}});var r=n(6923),i=n(1946),a={aa:"aar",ab:"abk",ae:"ave",af:"afr",ak:"aka",am:"amh",an:"arg",ar:"ara",as:"asm",av:"ava",ay:"aym",az:"aze",ba:"bak",be:"bel",bg:"bul",bi:"bis",bm:"bam",bn:"ben",bo:"bod",br:"bre",bs:"bos",ca:"cat",ce:"che",ch:"cha",co:"cos",cr:"cre",cs:"ces",cu:"chu",cv:"chv",cy:"cym",da:"dan",de:"deu",dv:"div",dz:"dzo",ee:"ewe",el:"ell",en:"eng",eo:"epo",es:"spa",et:"est",eu:"eus",fa:"fas",ff:"ful",fi:"fin",fj:"fij",fo:"fao",fr:"fra",fy:"fry",ga:"gle",gd:"gla",gl:"glg",gn:"grn",gu:"guj",gv:"glv",ha:"hau",he:"heb",hi:"hin",ho:"hmo",hr:"hrv",ht:"hat",hu:"hun",hy:"hye",hz:"her",ia:"ina",id:"ind",ie:"ile",ig:"ibo",ii:"iii",ik:"ipk",io:"ido",is:"isl",it:"ita",iu:"iku",ja:"jpn",jv:"jav",ka:"kat",kg:"kon",ki:"kik",kj:"kua",kk:"kaz",kl:"kal",km:"khm",kn:"kan",ko:"kor",kr:"kau",ks:"kas",ku:"kur",kv:"kom",kw:"cor",ky:"kir",la:"lat",lb:"ltz",lg:"lug",li:"lim",ln:"lin",lo:"lao",lt:"lit",lu:"lub",lv:"lav",mg:"mlg",mh:"mah",mi:"mri",mk:"mkd",ml:"mal",mn:"mon",mr:"mar",ms:"msa",mt:"mlt",my:"mya",na:"nau",nb:"nob",nd:"nde",ne:"nep",ng:"ndo",nl:"nld",nn:"nno",no:"nor",nr:"nbl",nv:"nav",ny:"nya",oc:"oci",oj:"oji",om:"orm",or:"ori",os:"oss",pa:"pan",pi:"pli",pl:"pol",ps:"pus",pt:"por",qu:"que",rm:"roh",rn:"run",ro:"ron",ru:"rus",rw:"kin",sa:"san",sc:"srd",sd:"snd",se:"sme",sg:"sag",si:"sin",sk:"slk",sl:"slv",sm:"smo",sn:"sna",so:"som",sq:"sqi",sr:"srp",ss:"ssw",st:"sot",su:"sun",sv:"swe",sw:"swa",ta:"tam",te:"tel",tg:"tgk",th:"tha",ti:"tir",tk:"tuk",tl:"tgl",tn:"tsn",to:"ton",tr:"tur",ts:"tso",tt:"tat",tw:"twi",ty:"tah",ug:"uig",uk:"ukr",ur:"urd",uz:"uzb",ve:"ven",vi:"vie",vo:"vol",wa:"wln",wo:"wol",xh:"xho",yi:"yid",yo:"yor",za:"zha",zh:"zho",zu:"zul"},o={alb:"sqi",arm:"hye",baq:"eus",bur:"mya",chi:"zho",cze:"ces",dut:"nld",fre:"fra",geo:"kat",ger:"deu",gre:"ell",ice:"isl",mac:"mkd",mao:"mri",may:"msa",per:"fas",slo:"slk",rum:"ron",tib:"bod",wel:"cym"};function s(e){if((0,i.Z)(e)||""===e)return"";var t=function(e){var t;switch(e.length){case 2:t=a[e];break;case 3:t=o[e]}return t}((""+e).toLowerCase().split("-")[0]);return(0,r.Z)(t)?t:e}function u(e){if(!(0,i.Z)(e)){var t,n=!1;return"string"==typeof e?t=e:(t=e.language,!0===e.closedCaption&&(n=!0)),{language:t,closedCaption:n,normalized:s(t)}}return e}function l(e){if((0,i.Z)(e))return e;if("string"==typeof e)return{language:e,audioDescription:!1,normalized:s(e)};var t={language:e.language,audioDescription:!0===e.audioDescription,normalized:s(s(e.language))};return!0===e.isDub&&(t.isDub=!0),t}var d=s},8894:function(e,t,n){"use strict";function r(){}n.d(t,{Z:function(){return r}})},8026:function(e,t){"use strict";t.Z="function"==typeof Object.assign?Object.assign:function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=0;n<(arguments.length<=1?0:arguments.length-1);n++){var r=n+1<1||arguments.length<=n+1?void 0:arguments[n+1];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t}},1679:function(e,t,n){"use strict";t.Z="function"==typeof Object.values?Object.values:function(e){return Object.keys(e).map((function(t){return e[t]}))}},2829:function(e,t,n){"use strict";n.d(t,{A1:function(){return s},DD:function(){return m},F_:function(){return p},JN:function(){return c},L7:function(){return g},Ti:function(){return u},XS:function(){return v},at:function(){return h},kR:function(){return y},rx:function(){return f},tn:function(){return b},uH:function(){return S}});var r=1/60;function i(e,t){return Math.abs(e-t)=0;n--){var r=e.start(n);if(t>=r){var i=e.end(n);if(t=o?r.push({start:a,end:o}):n={start:a,end:o}}return{outerRanges:r,innerRange:n}}function h(e,t){var n=f(e,t);return null!==n?n.end-n.start:0}function m(e,t){var n=f(e,t);return null!==n?t-n.start:0}function g(e,t){var n=f(e,t);return null!==n?n.end-t:1/0}function y(e,t){if(t.start===t.end)return e;for(var n=t,r=0;r0)for(var o=0;o0)for(var s=0;sl&&n.push({start:l,end:a[d].start}),l=a[d].end;l=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0&&i.splice(e,1)}}i.push(r),!0===(null==t?void 0:t.emitCurrentValue)&&e(n,o),a||r.hasBeenCleared?o():void 0!==(null==t?void 0:t.clearSignal)&&t.clearSignal.register(o)},waitUntilDefined:function(e,t){this.onUpdate((function(t,r){void 0!==t&&(r(),e(n))}),{clearSignal:null==t?void 0:t.clearSignal,emitCurrentValue:!0})},finish:o};function o(){void 0!==t&&t.deregister(o),a=!0;for(var e,n=r(i.slice());!(e=n()).done;){var s=e.value;try{s.hasBeenCleared||(s.complete(),s.hasBeenCleared=!0)}catch(e){}}i.length=0}}function o(e,t,n){var r=a(t(e.getValue()),n);return e.onUpdate((function(e){r.setValue(t(e))}),{clearSignal:n}),r}n.d(t,{$l:function(){return a},ZP:function(){return a},lR:function(){return o}})},4597:function(e,t,n){"use strict";n.d(t,{ZP:function(){return o}});var r=n(9105),i=n(6923),a=n(1946);var o=function(e){var t={url:e.url,headers:e.headers,responseType:(0,a.Z)(e.responseType)?"json":e.responseType,timeout:e.timeout};return new Promise((function(n,o){var s,u=e.onProgress,l=e.cancelSignal,d=t.url,c=t.headers,f=t.responseType,v=t.timeout,p=new XMLHttpRequest;if(p.open("GET",d,!0),void 0!==v&&(p.timeout=v,s=window.setTimeout((function(){_(),o(new r.Z(d,p.status,"TIMEOUT",p))}),v+3e3)),p.responseType=f,"document"===p.responseType&&p.overrideMimeType("text/xml"),!(0,a.Z)(c)){var h=c;for(var m in h)h.hasOwnProperty(m)&&p.setRequestHeader(m,h[m])}var g=performance.now(),y=null;function _(){void 0!==s&&clearTimeout(s),null!==y&&y()}void 0!==l&&(y=l.register((function(e){_(),(0,a.Z)(p)||4===p.readyState||p.abort(),o(e)})),l.isCancelled())||(p.onerror=function(){_(),o(new r.Z(d,p.status,"ERROR_EVENT",p))},p.ontimeout=function(){_(),o(new r.Z(d,p.status,"TIMEOUT",p))},void 0!==u&&(p.onprogress=function(e){var t=performance.now();u({url:d,duration:t-g,sendingTime:g,currentTime:t,size:e.loaded,totalSize:e.total})}),p.onload=function(e){if(4===p.readyState)if(_(),p.status>=200&&p.status<300){var t,s=performance.now(),u=p.response instanceof ArrayBuffer?p.response.byteLength:e.total,l=p.status,c=p.responseType,f=(0,i.Z)(p.responseURL)?p.responseURL:d;if(t="json"===c?"object"==typeof p.response?p.response:function(e){try{return JSON.parse(e)}catch(e){return null}}(p.responseText):p.response,(0,a.Z)(t))return void o(new r.Z(d,p.status,"PARSE_ERROR",p));n({status:l,url:f,responseType:c,sendingTime:g,receivedTime:s,requestDuration:s-g,size:u,responseData:t})}else o(new r.Z(d,p.status,"ERROR_HTTP_CODE",p))},p.send())}))}},9829:function(e,t,n){"use strict";n.d(t,{$:function(){return o},Z:function(){return a}});var r=/^(?:[a-z]+:)?\/\//i,i=/\/\.{1,2}\//;function a(){var e=arguments.length;if(0===e)return"";for(var t="",n=0;n=0&&t===n+1)return e.length}var i=e.indexOf("?");return i>=0&&i>8&255}return n}function u(e){if(a)try{return new TextDecoder("utf-16le").decode(e)}catch(e){var t=e instanceof Error?e:"";r.Z.warn("Utils: could not use TextDecoder to parse UTF-16LE, fallbacking to another implementation",t)}for(var n="",i=0;i=t?n:new Array(t-n.length+1).join("0")+n}function c(e){if(a)try{return(new TextDecoder).decode(e)}catch(e){var t=e instanceof Error?e:"";r.Z.warn("Utils: could not use TextDecoder to parse UTF-8, fallbacking to another implementation",t)}var n=e;239===n[0]&&187===n[1]&&191===n[2]&&(n=n.subarray(3));var i,o=function(e){for(var t="",n=0;n=256?"%u"+d(l,4):"%"+d(l,2)}}return decodeURIComponent(i)}function f(e){for(var t=e.length,n=new Uint8Array(t/2),r=0,i=0;r>>4).toString(16),n+=(15&e[r]).toString(16),t.length>0&&r0;)try{var n=t._listeners.pop();null==n||n(e)}catch(e){o.Z.error("Error while calling clean up listener",e instanceof Error?e.toString():"Unknown error")}}))}var t=e.prototype;return t.isCancelled=function(){return this._isCancelled},t.register=function(e){var t=this;return this._isCancelled?((0,s.Z)(null!==this.cancellationError),e(this.cancellationError),u.Z):(this._listeners.push(e),function(){return t.deregister(e)})},t.deregister=function(e){for(var t=this._listeners.length-1;t>=0;t--)this._listeners[t]===e&&this._listeners.splice(t,1)},e}(),c=function(e){function t(){var n;return n=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(n),t.prototype),n.name="CancellationError",n.message="This task was cancelled.",n}return(0,i.Z)(t,e),t}((0,a.Z)(Error))},8806:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(7714),i=[];function a(e){(0,r.Z)(i,e)||(console.warn(e),i.push(e))}},7473:function(e){"use strict";var t=function(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return e},n=function(e){var n,r,i=document.createTextNode(""),a=0;return new e((function(){var e;if(n)r&&(n=r.concat(n));else{if(!r)return;n=r}if(r=n,n=null,"function"==typeof r)return e=r,r=null,void e();for(i.data=a=++a%2;r;)e=r.shift(),r.length||(r=null),e()})).observe(i,{characterData:!0}),function(e){t(e),n?"function"==typeof n?n=[n,e]:n.push(e):(n=e,i.data=a=++a%2)}};e.exports=function(){if("object"==typeof process&&process&&"function"==typeof process.nextTick)return process.nextTick;if("function"==typeof queueMicrotask)return function(e){queueMicrotask(t(e))};if("object"==typeof document&&document){if("function"==typeof MutationObserver)return n(MutationObserver);if("function"==typeof WebKitMutationObserver)return n(WebKitMutationObserver)}return"function"==typeof setImmediate?function(e){setImmediate(t(e))}:"function"==typeof setTimeout||"object"==typeof setTimeout?function(e){setTimeout(t(e),0)}:null}()},7061:function(e,t,n){var r=n(8698).default;function i(){"use strict";e.exports=i=function(){return n},e.exports.__esModule=!0,e.exports.default=e.exports;var t,n={},a=Object.prototype,o=a.hasOwnProperty,s=Object.defineProperty||function(e,t,n){e[t]=n.value},u="function"==typeof Symbol?Symbol:{},l=u.iterator||"@@iterator",d=u.asyncIterator||"@@asyncIterator",c=u.toStringTag||"@@toStringTag";function f(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{f({},"")}catch(t){f=function(e,t,n){return e[t]=n}}function v(e,t,n,r){var i=t&&t.prototype instanceof b?t:b,a=Object.create(i.prototype),o=new P(r||[]);return s(a,"_invoke",{value:R(e,n,o)}),a}function p(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}n.wrap=v;var h="suspendedStart",m="suspendedYield",g="executing",y="completed",_={};function b(){}function S(){}function T(){}var E={};f(E,l,(function(){return this}));var k=Object.getPrototypeOf,w=k&&k(k(D([])));w&&w!==a&&o.call(w,l)&&(E=w);var A=T.prototype=b.prototype=Object.create(E);function I(e){["next","throw","return"].forEach((function(t){f(e,t,(function(e){return this._invoke(t,e)}))}))}function Z(e,t){function n(i,a,s,u){var l=p(e[i],e,a);if("throw"!==l.type){var d=l.arg,c=d.value;return c&&"object"==r(c)&&o.call(c,"__await")?t.resolve(c.__await).then((function(e){n("next",e,s,u)}),(function(e){n("throw",e,s,u)})):t.resolve(c).then((function(e){d.value=e,s(d)}),(function(e){return n("throw",e,s,u)}))}u(l.arg)}var i;s(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,i){n(e,r,t,i)}))}return i=i?i.then(a,a):a()}})}function R(e,n,r){var i=h;return function(a,o){if(i===g)throw new Error("Generator is already running");if(i===y){if("throw"===a)throw o;return{value:t,done:!0}}for(r.method=a,r.arg=o;;){var s=r.delegate;if(s){var u=x(s,r);if(u){if(u===_)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===h)throw i=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=g;var l=p(e,n,r);if("normal"===l.type){if(i=r.done?y:m,l.arg===_)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(i=y,r.method="throw",r.arg=l.arg)}}}function x(e,n){var r=n.method,i=e.iterator[r];if(i===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,x(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),_;var a=p(i,e.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,_;var o=a.arg;return o?o.done?(n[e.resultName]=o.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,_):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,_)}function M(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(M,this),this.reset(!0)}function D(e){if(e||""===e){var n=e[l];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,a=function n(){for(;++i=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var u=o.call(a,"catchLoc"),l=o.call(a,"finallyLoc");if(u&&l){if(this.prev=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&o.call(r,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),C(n),_}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;C(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:D(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),_}},n}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports},8698:function(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},4687:function(e,t,n){var r=n(7061)();e.exports=r;try{regeneratorRuntime=r}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}},7326:function(e,t,n){"use strict";function r(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}n.d(t,{Z:function(){return r}})},5861:function(e,t,n){"use strict";function r(e,t,n,r,i,a,o){try{var s=e[a](o),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function i(e){return function(){var t=this,n=arguments;return new Promise((function(i,a){var o=e.apply(t,n);function s(e){r(o,i,a,s,u,"next",e)}function u(e){r(o,i,a,s,u,"throw",e)}s(void 0)}))}}n.d(t,{Z:function(){return i}})},1656:function(e,t,n){"use strict";function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function i(e){var t=function(e,t){if("object"!==r(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!==r(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===r(t)?t:String(t)}function a(e,t){for(var n=0;ni)break}if(u<0||n.length!==t.length)return l.Z.error("ABR: Current Bitrate not found in the calculated levels"),void(this._currentEstimate=n[0]);void 0!==a&&(s=0===o?a.score:a.score/o);var f=isFinite(r)?r:0,v=performance.now();if(f=0;m--)if(f>=t[m])return void(this._currentEstimate=n[m]);this._currentEstimate=n[0]}else if(void 0!==this._lastUnsuitableQualityTimestamp&&v-this._lastUnsuitableQualityTimestampg)return e}();if(void 0!==y)if(r>=t[y])return l.Z.debug("ABR: Raising quality in BufferBasedChooser",n[y]),void(this._currentEstimate=n[y]);this._currentEstimate=i}}else this._currentEstimate=n[0]},t.getLastEstimate=function(){return this._currentEstimate},e}(),z=n(3274),K=function(){function e(e){this._alpha=Math.exp(Math.log(.5)/e),this._lastEstimate=0,this._totalWeight=0}var t=e.prototype;return t.addSample=function(e,t){var n=Math.pow(this._alpha,e),r=t*(1-n)+n*this._lastEstimate;isNaN(r)||(this._lastEstimate=r,this._totalWeight+=e)},t.getEstimate=function(){var e=1-Math.pow(this._alpha,this._totalWeight);return this._lastEstimate/e},e}();function G(e){if(!(e.progress.length<5)){for(var t=new K(2),n=e.progress,r=1;r=s.outOfStarvationGap&&(l.Z.info("ABR: exit starvation mode."),this._inStarvationMode=!1):this._inStarvationMode&&(l.Z.info("ABR: exit starvation mode."),this._inStarvationMode=!1),this._inStarvationMode&&(o=function(e,t,n,r,i){if(!r){var a=t.bufferGap,o=t.speed,s=t.position,u=isFinite(a)?a:0,l=function(e,t){for(var n=-1,r=0;r-1.2){n=r;break}if(a>t&&t-i.time>-1.2){n=r;break}}}if(n<0)return[];for(var o=e[n],s=o.content.segment.time,u=[o],l=n+1;l0?d.progress[d.progress.length-1]:void 0,p=G(d);if(void 0!==v&&void 0!==p){var h=W(v,p);if((c-v.timestamp)/1e3<=h&&h-u/o>2500)return p}if(d.content.segment.complete){var m=d.content.segment.duration,g=(c-d.requestTimestamp)/1e3;if(null!=n&&!(g<=(1.5*m+2)/o)){var y=m/g,_=n.bitrate*Math.min(.7,y);return void 0===i||_1&&(a/=e.speed),{bandwidthEstimate:o,bitrateChosen:a}},t.isUrgent=function(e,t,n,r){return null===t||!(e>=t.bitrate)&&function(e,t,n){if(n)return!0;var r=isFinite(e.bufferGap)?e.bufferGap:0,i=e.position.last+r,a=(0,z.Z)(t,(function(e){var t=e.content;return t.segment.duration>0&&t.segment.time+t.segment.duration>i}));if(void 0===a)return!0;var o=performance.now(),s=a.progress.length>0?a.progress[a.progress.length-1]:void 0,u=G(a);if(void 0===s||void 0===u)return!0;var l=W(s,u);return(o-s.timestamp)/1e3>1.2*l||l-r/e.speed>-1.5}(r,n,this._lowLatencyMode)},e}();function j(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return q(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return q(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function q(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);ns.bitrate)return 2===this._lastAbrEstimate.algorithmType&&(null!==this._lastAbrEstimate.representation&&(this._lastMaintanableBitrate=this._lastAbrEstimate.representation.bitrate),this._consecutiveWrongGuesses=0),null;var u=this._scoreCalculator.getEstimate(n);if(2!==this._lastAbrEstimate.algorithmType){if(void 0===u)return null;if(this._canGuessHigher(a,o,u)){var d=X(e,n);if(null!==d)return d}return null}if(this._isLastGuessValidated(s,r,u)&&(l.Z.debug("ABR: Guessed Representation validated",s.bitrate),this._lastMaintanableBitrate=s.bitrate,this._consecutiveWrongGuesses=0),n.id!==s.id)return s;if(this._shouldStopGuess(n,u,a,i))return this._consecutiveWrongGuesses++,this._blockGuessesUntil=performance.now()+Math.min(15e3*this._consecutiveWrongGuesses,12e4),function(e,t){var n=(0,B.Z)(e,(function(e){return e.id===t.id}));if(n<0)return l.Z.error("ABR: Current Representation not found."),null;for(;--n>=0;)if(e[n].bitrate=2.5&&performance.now()>this._blockGuessesUntil&&1===i&&r/t>1.01},t._shouldStopGuess=function(e,t,n,r){if(void 0!==t&&t.score<1.01)return!0;if((void 0===t||t.score<1.2)&&n<.6)return!0;for(var i,a=r.filter((function(t){return t.content.representation.id===e.id})),o=performance.now(),s=j(a);!(i=s()).done;){var u=i.value,l=o-u.requestTimestamp;if(u.content.segment.isInit){if(l>1e3)return!0}else{if(l>1e3*u.content.segment.duration+200)return!0;var d=G(u);if(void 0!==d&&d<.8*e.bitrate)return!0}}return!1},t._isLastGuessValidated=function(e,t,n){return void 0!==n&&1===n.confidenceLevel&&n.score>1.5||t>=e.bitrate&&(null===this._lastMaintanableBitrate||this._lastMaintanableBitratet.bitrate)return e[r];return null}var Q=function(){function e(){var e=c.Z.getCurrent(),t=e.ABR_FAST_EMA,n=e.ABR_SLOW_EMA;this._fastEWMA=new K(t),this._slowEWMA=new K(n),this._bytesSampled=0}var t=e.prototype;return t.addSample=function(e,t){if(!(t1&&this._lastRepresentationWithGoodScore!==e&&(l.Z.debug("ABR: New last stable representation",e.bitrate),this._lastRepresentationWithGoodScore=e)},t.getEstimate=function(e){if(null!==this._currentRepresentationData&&this._currentRepresentationData.representation.id===e.id){var t=this._currentRepresentationData,n=t.ewma,r=t.loadedSegments,i=t.loadedDuration;return{score:n.getEstimate(),confidenceLevel:r>=5&&i>=10?1:0}}},t.getLastStableRepresentation=function(){return this._lastRepresentationWithGoodScore},e}();function ne(e,t,n,r){var i=t<=n?n:t>=r?r:t,a=(0,B.Z)(e,(function(e){return e.bitrate>i}));return-1===a?e[e.length-1]:0===a?e[0]:e[a-1]}var re=(0,k.ZP)(-1);re.finish();var ie=(0,k.ZP)(0);ie.finish();var ae=(0,k.ZP)(1/0);ae.finish();var oe=(0,k.ZP)(void 0);oe.finish();var se=(0,k.ZP)(1/0);se.finish();var ue=function(e){var t={},n=e.manualBitrates,r=e.minAutoBitrates,i=e.maxAutoBitrates,a=e.initialBitrates,o=e.throttlers,s=e.lowLatencyMode;return function(e,u,d,f,v){var p=e.adaptation.type,h=function(e){var n=t[e];if(null==n){l.Z.debug("ABR: Creating new BandwidthEstimator for ",e);var r=new Q;return t[e]=r,r}return n}(p),m=(0,U.Z)(n[p],re),g=(0,U.Z)(r[p],ie),y=(0,U.Z)(i[p],ae),_=(0,U.Z)(a[p],0);return function(e,t){var n=e.bandwidthEstimator,r=e.context,i=e.currentRepresentation,a=e.filters,o=e.initialBitrate,s=e.lowLatencyMode,u=e.manualBitrate,d=e.maxAutoBitrate,f=e.minAutoBitrate,v=e.playbackObserver,p=e.representations,h=new te,m=new H(null!=o?o:0,s),g=new ee,y=L.Z,_={metrics:I,requestBegin:Z,requestProgress:R,requestEnd:x,addedSegment:function(e){y(e)}},b=new w.ZP;b.linkToSignal(t);var S=T(p.getValue(),b.signal);return p.onUpdate(A,{clearSignal:t}),{estimates:S,callbacks:_};function T(e,t){if(0===e.length)return(0,k.ZP)({representation:null,bitrate:void 0,knownStableBitrate:void 0,manual:!1,urgent:!0});if(1===e.length)return(0,k.ZP)({bitrate:void 0,representation:e[0],manual:!1,urgent:!0,knownStableBitrate:void 0});var o=!1,p=new V(e.map((function(e){return e.bitrate}))),_=new $,b=new Y(h,_),S=v.getReference().getValue(),T=(0,k.ZP)(A());return v.listen((function(e){S=e,w()}),{includeLastObservation:!1,clearSignal:t}),y=function(e){if(null!==S){var t=S,n=t.position,r=t.speed,i=e.buffered,a=(0,E.L7)(i,n.last),o=e.content.representation,s=h.getEstimate(o),u={bufferGap:a,currentBitrate:o.bitrate,currentScore:s,speed:r};p.onAddedSegment(u),w()}},t.register((function(){y=L.Z})),u.onUpdate(w,{clearSignal:t}),f.onUpdate(w,{clearSignal:t}),d.onUpdate(w,{clearSignal:t}),a.limitWidth.onUpdate(w,{clearSignal:t}),a.limitWidth.onUpdate(w,{clearSignal:t}),T;function w(){T.setValue(A())}function A(){var t=u.getValue();if(t>=0)return{representation:ne(e,t,0,1/0),bitrate:void 0,knownStableBitrate:void 0,manual:!0,urgent:!0};var v=S,y=v.bufferGap,T=v.position,E=v.maximumPosition,k=a.limitWidth.getValue(),w=a.throttleBitrate.getValue(),A=i.getValue(),I=f.getValue(),Z=d.getValue(),R=function(e,t,n){var r=e;n<1/0&&(r=function(e,t){if(0===e.length)return[];e.sort((function(e,t){return e.bitrate-t.bitrate}));var n=e[0].bitrate,r=Math.max(t,n),i=(0,B.Z)(e,(function(e){return e.bitrate>r}));return-1===i?e:e.slice(0,i)}(r,n));void 0!==t&&(r=function(e,t){var n=e.slice().sort((function(e,t){return(0,U.Z)(e.width,0)-(0,U.Z)(t.width,0)})),r=(0,z.Z)(n,(function(e){return"number"==typeof e.width&&e.width>=t}));if(void 0===r)return e;var i="number"==typeof r.width?r.width:0;return e.filter((function(e){return"number"!=typeof e.width||e.width<=i}))}(r,t));return r}(e,k,w),x=g.getRequests(),M=m.getBandwidthEstimate(S,n,A,x,_.bandwidth),C=M.bandwidthEstimate,P=M.bitrateChosen,D=h.getLastStableRepresentation(),N=null===D?void 0:D.bitrate/(S.speed>0?S.speed:1),O=c.Z.getCurrent(),L=O.ABR_ENTER_BUFFER_BASED_ALGO,F=O.ABR_EXIT_BUFFER_BASED_ALGO;o&&y<=F?o=!1:!o&&isFinite(y)&&y>=L&&(o=!0);var V=ne(R,P,I,Z),K=p.getLastEstimate(),G=V.bitrate,W=null;o&&void 0!==K&&K>G&&(G=(W=ne(R,K,I,Z)).bitrate);var H=null;return s&&null!==A&&r.manifest.isDynamic&&E-T.last<40&&(H=b.getGuess(e,S,A,G,x)),null!==H&&H.bitrate>G?(l.Z.debug("ABR: Choosing representation with guess-based estimation.",H.bitrate,H.id),_.update(H,C,2),{bitrate:C,representation:H,urgent:null===A||H.bitrate=500||404===e.status||415===e.status||412===e.status:e.type===p.br.TIMEOUT||e.type===p.br.ERROR_EVENT:e instanceof ve.Z?"boolean"==typeof e.canRetry?e.canRetry:void 0!==e.xhr&&(e.xhr.status>=500||404===e.xhr.status||415===e.xhr.status||412===e.xhr.status):(0,pe.Z)(e)&&"INTEGRITY_ERROR"===e.code}function ye(e){return e instanceof de.Z?e.type===p.br.ERROR_EVENT&&!1===navigator.onLine:e instanceof ve.Z&&e.isOfflineError}function _e(e,t,n,r,i){return be.apply(this,arguments)}function be(){return be=(0,I.Z)(R().mark((function e(t,n,r,i,a){var o,s,u,d,c,f,v,p,h,m,g,y,_,b;return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(b=function(e){var t;if(0===f.size)return e[0];var n=performance.now();return null===(t=e.filter((function(e){var t;return!0!==(null===(t=f.get(e))||void 0===t?void 0:t.isBlacklisted)})).reduce((function(e,t){var r,i=null===(r=f.get(t))||void 0===r?void 0:r.blockedUntil;return void 0!==i&&i<=n&&(i=void 0),void 0===e?[t,i]:void 0===i?void 0===e[1]?e:[t,void 0]:void 0===e[1]?e:iv?(c.blockedUntil=void 0,c.isBlacklisted=!0):(p=c.errorCounter,h=Math.min(o*Math.pow(2,p-1),s),m=(0,me.Z)(h),c.blockedUntil=performance.now()+m),e.abrupt("return",g(e.t0));case 22:case"end":return e.stop()}var y}),e,null,[[0,7]])})))).apply(this,arguments)},h=function(e){return m.apply(this,arguments)},p=function(){if(null===t){var e=f.get(null);if(void 0!==e&&e.isBlacklisted)return;return null}if(null===n)return b(t);var r=n.getCdnPreferenceForResource(t);return b(r)},null===a.cancellationError){e.next=9;break}return e.abrupt("return",Promise.reject(a.cancellationError));case 9:if(o=i.baseDelay,s=i.maxDelay,u=i.maxRetryRegular,d=i.maxRetryOffline,c=i.onRetry,null!==t&&0===t.length&&l.Z.warn("Fetchers: no CDN given to `scheduleRequestWithCdns`."),f=new Map,void 0!==(v=p())){e.next=15;break}throw new Error("No CDN to request");case 15:return e.abrupt("return",h(v));case 16:case"end":return e.stop()}}),e)}))),be.apply(this,arguments)}function Se(e,t,n){return _e(null,null,e,t,n)}function Te(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Ee(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ee(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Ee(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0?this._consecutiveUnsafeMode=u,v=void 0===r?0:performance.now()-r,p=Math.max(this._settings.minimumManifestUpdateInterval-v,0),h=new w.ZP;if(h.linkToSignal(this._canceller.signal),this.scheduleManualRefresh=function(t){var i=t.enablePartialRefresh,a=t.delay,o=t.canUseUnsafeMode&&f,s=void 0===r?0:performance.now()-r,u=Math.max(n._settings.minimumManifestUpdateInterval-s,0),l=setTimeout((function(){h.cancel(),n._triggerNextManifestRefresh(e,{enablePartialRefresh:i,unsafeMode:o})}),Math.max((null!=a?a:0)-s,u));h.signal.register((function(){clearTimeout(l)}))},null!==e.expired){var m=setTimeout((function(){var t;null===(t=e.expired)||void 0===t||t.then((function(){h.cancel(),n._triggerNextManifestRefresh(e,{enablePartialRefresh:!1,unsafeMode:f})}),L.Z)}),p);h.signal.register((function(){clearTimeout(m)}))}if(void 0!==e.lifetime&&e.lifetime>=0){var g,y=1e3*e.lifetime-v;void 0===d?g=y:e.lifetime<3&&d>=100?(g=Math.min(Math.max(3e3-v,Math.max(y,0)+d),6*y),l.Z.info("MUS: Manifest update rythm is too frequent. Postponing next request.",y,g)):d>=1e3*e.lifetime/10?(g=Math.min(Math.max(y,0)+d,6*y),l.Z.info("MUS: Manifest took too long to parse. Postponing next request",g,g)):g=y;var _=setTimeout((function(){h.cancel(),n._triggerNextManifestRefresh(e,{enablePartialRefresh:!1,unsafeMode:f})}),Math.max(g,p));h.signal.register((function(){clearTimeout(_)}))}},r._triggerNextManifestRefresh=function(e,t){var n,r,i=this,a=t.enablePartialRefresh,o=t.unsafeMode,s=e.updateUrl;null!==this._prioritizedContentUrl?(n=!0,r=this._prioritizedContentUrl,this._prioritizedContentUrl=null):r=(n=!a||void 0===s)?e.getUrl():s;var u=e.clockOffset;o?(this._consecutiveUnsafeMode+=1,l.Z.info('Init: Refreshing the Manifest in "unsafeMode" for the '+String(this._consecutiveUnsafeMode)+" consecutive time.")):this._consecutiveUnsafeMode>0&&(l.Z.info('Init: Not parsing the Manifest in "unsafeMode" anymore after '+String(this._consecutiveUnsafeMode)+" consecutive times."),this._consecutiveUnsafeMode=0),this._isRefreshPending||(this._isRefreshPending=!0,this._fetchManifest(r).then((function(t){return t.parse({externalClockOffset:u,previousManifest:e,unsafeMode:o})})).then((function(t){i._isRefreshPending=!1;var r=t.manifest,a=t.sendingTime,o=t.parsingTime,s=performance.now();if(n)e.replace(r);else try{e.update(r)}catch(t){var u=t instanceof Error?t.message:"unknown error";l.Z.warn("MUS: Attempt to update Manifest failed: "+u,"Re-downloading the Manifest fully");var d=c.Z.getCurrent().FAILED_PARTIAL_UPDATE_MANIFEST_REFRESH_DELAY,f=void 0===a?0:performance.now()-a,v=Math.max(i._settings.minimumManifestUpdateInterval-f,0),p=L.Z,h=setTimeout((function(){p(),i._triggerNextManifestRefresh(e,{enablePartialRefresh:!1,unsafeMode:!1})}),Math.max(d-f,v));return void(p=i._canceller.signal.register((function(){clearTimeout(h)})))}var m=performance.now()-s;i._recursivelyRefreshManifest(e,{sendingTime:a,parsingTime:o,updatingTime:m})})).catch((function(e){i._isRefreshPending=!1,i._onFatalError(e)})))},r._onFatalError=function(e){this._canceller.isUsed()||(this.trigger("error",e),this.dispose())},n}(_.Z);var we=ke;function Ae(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Ie(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ie(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Ie(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0&&this._removeIndexFromDowngradeList(n);var r=c.Z.getCurrent().DEFAULT_CDN_DOWNGRADE_TIME;this._downgradedCdnList.metadata.push(e);var i=window.setTimeout((function(){var n=Re(t._downgradedCdnList.metadata,e);n>=0&&t._removeIndexFromDowngradeList(n),t.trigger("priorityChange",null)}),r);this._downgradedCdnList.timeouts.push(i),this.trigger("priorityChange",null)},r._innerGetCdnPreferenceForResource=function(e){var t=this,n=e.reduce((function(e,n){return t._downgradedCdnList.metadata.some((function(e){return e.id===n.id&&e.baseUrl===n.baseUrl}))?e[1].push(n):e[0].push(n),e}),[[],[]]),r=n[0],i=n[1];return r.concat(i)},r._removeIndexFromDowngradeList=function(e){this._downgradedCdnList.metadata.splice(e,1);var t=this._downgradedCdnList.timeouts.splice(e,1);clearTimeout(t[0])},n}(_.Z);function Re(e,t){return 0===e.length?-1:void 0!==t.id?(0,B.Z)(e,(function(e){return e.id===t.id})):(0,B.Z)(e,(function(e){return e.baseUrl===t.baseUrl}))}var xe=n(520),Me=function(){function e(){this._cache=new WeakMap}var t=e.prototype;return t.add=function(e,t){var n=e.representation;e.segment.isInit&&this._cache.set(n,t)},t.get=function(e){var t=e.representation;if(e.segment.isInit){var n=this._cache.get(t);if(void 0!==n)return n}return null},e}(),Ce=(0,b.Z)();var Pe=function(){function e(e){var t=e.prioritySteps;if(this._minPendingPriority=null,this._waitingQueue=[],this._pendingTasks=[],this._prioritySteps=t,this._prioritySteps.high>=this._prioritySteps.low)throw new Error("TP: the max high level priority should be given a lowerpriority number than the min low priority.")}var t=e.prototype;return t.create=function(e,t,n,r){var i,a=this;return(0,O.Z)(r,(function(o,s){return i={hasEnded:!1,priority:t,trigger:function(){if(!i.hasEnded){var e=function(){u(),a._endTask(i)},t=new w.ZP,u=t.linkToSignal(r);i.interrupter=t,t.signal.register((function(){i.interrupter=null,r.isCancelled()||n.beforeInterrupted()})),a._minPendingPriority=null===a._minPendingPriority?i.priority:Math.min(a._minPendingPriority,i.priority),a._pendingTasks.push(i),i.taskFn(t.signal).then((function(t){n.beforeEnded(),e(),o(t)})).catch((function(n){!r.isCancelled()&&t.isUsed()&&n instanceof w.FU||function(t){e(),s(t)}(n)}))}},taskFn:e,interrupter:null},a._canBeStartedNow(i)?(i.trigger(),a._isRunningHighPriorityTasks()&&a._interruptCancellableTasks()):a._waitingQueue.push(i),function(){return a._endTask(i)}}))},t._endTask=function(e){e.hasEnded=!0;var t=De(e.taskFn,this._waitingQueue);if(t>=0)this._waitingQueue.splice(t,1);else{var n=De(e.taskFn,this._pendingTasks);if(n<0)return;this._pendingTasks.splice(n,1),this._pendingTasks.length>0?this._minPendingPriority===e.priority&&(this._minPendingPriority=Math.min.apply(Math,this._pendingTasks.map((function(e){return e.priority})))):this._minPendingPriority=null,this._loopThroughWaitingQueue()}},t.updatePriority=function(e,t){var n=De(e,this._waitingQueue);if(n>=0){var r=this._waitingQueue[n];if(r.priority===t)return;if(r.priority=t,!this._canBeStartedNow(r))return;return this._findAndRunWaitingQueueTask(n),void(this._isRunningHighPriorityTasks()&&this._interruptCancellableTasks())}var i=De(e,this._pendingTasks);if(i<0)l.Z.warn("TP: request to update the priority of a non-existent task");else{var a=this._pendingTasks[i];if(a.priority!==t){var o=a.priority;a.priority=t,null===this._minPendingPriority||tt.priority?t.priority:e}),null);if(!(null===e||null!==this._minPendingPriority&&this._minPendingPriority=this._prioritySteps.low)return this._interruptPendingTask(t),this._interruptCancellableTasks()}},t._findAndRunWaitingQueueTask=function(e){return e>=this._waitingQueue.length||e<0?(l.Z.warn("TP : Tried to start a non existing task"),!1):(this._waitingQueue.splice(e,1)[0].trigger(),!0)},t._interruptPendingTask=function(e){var t,n=De(e.taskFn,this._pendingTasks);n<0?l.Z.warn("TP: Interrupting a non-existent pending task. Aborting..."):(this._pendingTasks.splice(n,1),this._waitingQueue.push(e),0===this._pendingTasks.length?this._minPendingPriority=null:this._minPendingPriority===e.priority&&(this._minPendingPriority=Math.min.apply(Math,this._pendingTasks.map((function(e){return e.priority})))),null===(t=e.interrupter)||void 0===t||t.cancel())},t._canBeStartedNow=function(e){return null===this._minPendingPriority||e.priority<=this._minPendingPriority},t._isRunningHighPriorityTasks=function(){return null!==this._minPendingPriority&&this._minPendingPriority<=this._prioritySteps.high},e}();function De(e,t){return(0,B.Z)(t,(function(t){return t.taskFn===e}))}var Ne=function(){function e(e,t,n){var r=new Ze(n),i=c.Z.getCurrent(),a=i.MIN_CANCELABLE_PRIORITY,o=i.MAX_HIGH_PRIORITY_LEVEL;this._transport=e,this._prioritizer=new Pe({prioritySteps:{high:o,low:a}}),this._cdnPrioritizer=r,this._backoffOptions=t}return e.prototype.createSegmentFetcher=function(e,t){var n,r,i,a=function(e,t){var n=t.maxRetryRegular,r=t.maxRetryOffline,i=t.lowLatencyMode,a=t.requestTimeout,o=c.Z.getCurrent(),s=o.DEFAULT_MAX_REQUESTS_RETRY_ON_ERROR,u=o.DEFAULT_REQUEST_TIMEOUT,l=o.DEFAULT_MAX_REQUESTS_RETRY_ON_OFFLINE,d=o.INITIAL_BACKOFF_DELAY_BASE,f=o.MAX_BACKOFF_DELAY_BASE;return{maxRetryRegular:"image"===e?0:null!=n?n:s,maxRetryOffline:null!=r?r:l,baseDelay:i?d.LOW_LATENCY:d.REGULAR,maxDelay:i?f.LOW_LATENCY:f.REGULAR,requestTimeout:(0,S.Z)(a)?u:a}}(e,this._backoffOptions),o=function(e,t,n,r,i){var a={timeout:i.requestTimeout<0?void 0:i.requestTimeout},o=(0,g.Z)(["audio","video"],e)?new Me:void 0,s=t.loadSegment,u=t.parseSegment;return function(){var e=(0,I.Z)(R().mark((function e(t,d,c){var v,p,h,m,g,y,_,b,E,k,A,I,Z,x,M,C,P,D;return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(D=function(){var e;E||!(0,S.Z)(y)&&void 0!==y.size&&void 0!==y.requestDuration&&_.length>0&&_.every((function(e){return e}))&&(E=!0,null===(e=r.onMetrics)||void 0===e||e.call(r,{size:y.size,requestDuration:y.requestDuration,content:t,segmentDuration:b}))},P=function(e){d.onRetry(fe(e))},C=function(e,n){_.push(!1);var r=_.length-1;return function(i){var a={data:e,isChunked:n};try{var o=u(a,t,i);return _[r]||(b=void 0!==b&&"media"===o.segmentType&&null!==o.chunkInfos&&void 0!==o.chunkInfos.duration?b+o.chunkInfos.duration:void 0,_[r]=!0,D()),o}catch(e){throw(0,f.Z)(e,{defaultCode:"PIPELINE_PARSE_ERROR",defaultReason:"Unknown parsing error"})}}},M=function(e){return s(e,t,a,c,k)},x=function(){var e;void 0===y&&(l.Z.debug("SF: Segment request cancelled",m),y=null,null===(e=r.onRequestEnd)||void 0===e||e.call(r,{id:g}))},m=(0,xe.K)(t),g=Ce(),_=[],b=0,E=!1,k={onProgress:function(e){var t;void 0===y&&void 0!==e.totalSize&&e.size0;){var e=this._queue.shift();void 0!==e&&e.reject(new w.FU)}if("open"===this._mediaSource.readyState)try{l.Z.debug("AVSB: Calling `abort` on the SourceBuffer"),this._sourceBuffer.abort()}catch(e){l.Z.warn("AVSB: Failed to abort a "+this.bufferType+" SourceBuffer:",e instanceof Error?e:"")}},r._onPendingTaskError=function(e){if(this._lastInitSegment=null,null!==this._pendingTask){var t=e instanceof Error?e:new Error("An unknown error occured when doing operations on the SourceBuffer");this._pendingTask.reject(t)}},r._addToQueue=function(e,t){var n=this;return(0,O.Z)(t,(function(t,r){var i=0===n._queue.length&&null===n._pendingTask,a=(0,T.Z)({resolve:t,reject:r},e);return n._queue.push(a),i&&n._flush(),function(){var e=n._queue.indexOf(a);e>=0&&n._queue.splice(e,1),a.resolve=L.Z,a.reject=L.Z}}))},r._flush=function(){if(!this._sourceBuffer.updating){if(null!==this._pendingTask){var e=this._pendingTask;if(e.type!==Ve.f.Push||0===e.data.length){switch(e.type){case Ve.f.Push:null!==e.inventoryData&&this._segmentInventory.insertChunk(e.inventoryData);break;case Ve.f.EndOfSegment:this._segmentInventory.completeSegment(e.value,this.getBufferedRanges());break;case Ve.f.Remove:this.synchronizeInventory();break;default:(0,Ue.Z)(e)}var t=e.resolve;return this._pendingTask=null,t(),void this._flush()}}else{var n=this._queue.shift();if(void 0===n)return;if(n.type!==Ve.f.Push)this._pendingTask=n;else{var r,i=n.value;try{r=this._preparePushOperation(i.data)}catch(e){this._pendingTask=(0,T.Z)({data:[],inventoryData:i.inventoryInfos},n);var a=e instanceof Error?e:new Error("An unknown error occured when preparing a push operation");return this._lastInitSegment=null,void n.reject(a)}this._pendingTask=(0,T.Z)({data:r,inventoryData:i.inventoryInfos},n)}}try{switch(this._pendingTask.type){case Ve.f.EndOfSegment:return l.Z.debug("AVSB: Acknowledging complete segment",(0,xe.K)(this._pendingTask.value)),void this._flush();case Ve.f.Push:var o=this._pendingTask.data.shift();if(void 0===o)return void this._flush();l.Z.debug("AVSB: pushing segment",this.bufferType,(0,xe.K)(this._pendingTask.inventoryData)),this._sourceBuffer.appendBuffer(o);break;case Ve.f.Remove:var s=this._pendingTask.value,u=s.start,d=s.end;l.Z.debug("AVSB: removing data from SourceBuffer",this.bufferType,u,d),this._sourceBuffer.remove(u,d);break;default:(0,Ue.Z)(this._pendingTask)}}catch(e){this._onPendingTaskError(e)}}},r._preparePushOperation=function(e){var t=[],n=e.codec,r=e.timestampOffset,i=e.appendWindow,a=!1;if(void 0!==n&&n!==this.codec&&(l.Z.debug("AVSB: updating codec",n),a=function(e,t){if("function"==typeof e.changeType){try{e.changeType(t)}catch(e){return l.Z.warn("Could not call 'changeType' on the given SourceBuffer:",e instanceof Error?e:""),!1}return!0}return!1}(this._sourceBuffer,n),a?this.codec=n:l.Z.debug("AVSB: could not update codec",n,this.codec)),this._sourceBuffer.timestampOffset!==r){var o=r;l.Z.debug("AVSB: updating timestampOffset",this.bufferType,this._sourceBuffer.timestampOffset,o),this._sourceBuffer.timestampOffset=o}if(void 0===i[0])this._sourceBuffer.appendWindowStart>0&&(l.Z.debug("AVSB: re-setting `appendWindowStart` to `0`"),this._sourceBuffer.appendWindowStart=0);else if(i[0]!==this._sourceBuffer.appendWindowStart){if(i[0]>=this._sourceBuffer.appendWindowEnd){var s=i[0]+1;l.Z.debug("AVSB: pre-updating `appendWindowEnd`",s),this._sourceBuffer.appendWindowEnd=s}l.Z.debug("AVSB: setting `appendWindowStart`",i[0]),this._sourceBuffer.appendWindowStart=i[0]}if(void 0===i[1]?this._sourceBuffer.appendWindowEnd!==1/0&&(l.Z.debug("AVSB: re-setting `appendWindowEnd` to `Infinity`"),this._sourceBuffer.appendWindowEnd=1/0):i[1]!==this._sourceBuffer.appendWindowEnd&&(l.Z.debug("AVSB: setting `appendWindowEnd`",i[1]),this._sourceBuffer.appendWindowEnd=i[1]),null!==e.initSegment&&(a||!this._isLastInitSegment(e.initSegment))){var u=e.initSegment;t.push(u);var d=(0,Be._f)(u);this._lastInitSegment={data:d,hash:(0,Fe.Z)(d)}}return null!==e.chunk&&t.push(e.chunk),t},r._isLastInitSegment=function(e){if(null===this._lastInitSegment)return!1;if(this._lastInitSegment.data===e)return!0;var t=this._lastInitSegment.data;if(t.byteLength===e.byteLength){var n=(0,Be._f)(e);if((0,Fe.Z)(n)===this._lastInitSegment.hash&&(0,m.Z)(t,n))return!0}return!1},n}(Ve.C),Ke=["audio","video","text","image"];function Ge(e){return"audio"===e||"video"===e}var We=function(){function e(e,t){this._mediaElement=e,this._mediaSource=t,this._initializedSegmentBuffers={},this._onNativeBufferAddedOrDisabled=[]}e.isNative=function(e){return Ge(e)};var t=e.prototype;return t.getBufferTypes=function(){var e=this.getNativeBufferTypes();return null==h.Z.nativeTextTracksBuffer&&null==h.Z.htmlTextTracksBuffer||e.push("text"),null!=h.Z.imageBuffer&&e.push("image"),e},t.getNativeBufferTypes=function(){return"AUDIO"===this._mediaElement.nodeName?["audio"]:["video","audio"]},t.getStatus=function(e){var t=this._initializedSegmentBuffers[e];return void 0===t?{type:"uninitialized"}:null===t?{type:"disabled"}:{type:"initialized",value:t}},t.waitForUsableBuffers=function(e){var t=this;return this._areNativeBuffersUsable()?Promise.resolve():(0,O.Z)(e,(function(e){var n,r=function(){var e=t._onNativeBufferAddedOrDisabled.indexOf(n);e>=0&&t._onNativeBufferAddedOrDisabled.splice(e,1)};return n=function(){t._areNativeBuffersUsable()&&(r(),e())},t._onNativeBufferAddedOrDisabled.push(n),r}))},t.disableSegmentBuffer=function(t){var n=this._initializedSegmentBuffers[t];if(null!==n){if(void 0!==n)throw new Error("Cannot disable an active SegmentBuffer.");this._initializedSegmentBuffers[t]=null,e.isNative(t)&&this._onNativeBufferAddedOrDisabled.forEach((function(e){return e()}))}else l.Z.warn("SBS: The "+t+" SegmentBuffer was already disabled.")},t.createSegmentBuffer=function(e,t,n){void 0===n&&(n={});var r,i=this._initializedSegmentBuffers[e];if(Ge(e)){if(null!=i)return i instanceof ze&&i.codec!==t?l.Z.warn("SB: Reusing native SegmentBuffer with codec",i.codec,"for codec",t):l.Z.info("SB: Reusing native SegmentBuffer with codec",t),i;l.Z.info("SB: Adding native SegmentBuffer with codec",t);var a=new ze(e,t,this._mediaSource);return this._initializedSegmentBuffers[e]=a,this._onNativeBufferAddedOrDisabled.forEach((function(e){return e()})),a}if(null!=i)return l.Z.info("SB: Reusing a previous custom SegmentBuffer for the type",e),i;if("text"===e){if(l.Z.info("SB: Creating a new text SegmentBuffer"),"html"===n.textTrackMode){if(null==h.Z.htmlTextTracksBuffer)throw new Error("HTML Text track feature not activated");r=new h.Z.htmlTextTracksBuffer(this._mediaElement,n.textTrackElement)}else{if(null==h.Z.nativeTextTracksBuffer)throw new Error("Native Text track feature not activated");r=new h.Z.nativeTextTracksBuffer(this._mediaElement,!0===n.hideNativeSubtitle)}return this._initializedSegmentBuffers.text=r,r}if("image"===e){if(null==h.Z.imageBuffer)throw new Error("Image buffer feature not activated");return l.Z.info("SB: Creating a new image SegmentBuffer"),r=new h.Z.imageBuffer,this._initializedSegmentBuffers.image=r,r}throw l.Z.error("SB: Unknown buffer type:",e),new v.Z("BUFFER_TYPE_UNKNOWN","The player wants to create a SegmentBuffer of an unknown type.")},t.disposeSegmentBuffer=function(e){var t=this._initializedSegmentBuffers[e];null!=t?(l.Z.info("SB: Aborting SegmentBuffer",e),t.dispose(),delete this._initializedSegmentBuffers[e]):l.Z.warn("SB: Trying to dispose a SegmentBuffer that does not exist")},t.disposeAll=function(){var e=this;Ke.forEach((function(t){"initialized"===e.getStatus(t).type&&e.disposeSegmentBuffer(t)}))},t._areNativeBuffersUsable=function(){var e=this,t=this.getNativeBufferTypes();return!t.some((function(t){return void 0===e._initializedSegmentBuffers[t]}))&&!t.every((function(t){return null===e._initializedSegmentBuffers[t]}))},e}(),He=n(7473),je=n.n(He),qe=function(){function e(e){this._array=[],this._sortingFn=e}var t=e.prototype;return t.add=function(){for(var e=arguments.length,t=new Array(e),n=0;n=this._array.length)throw new Error("Invalid index.");return this._array[e]},t.toArray=function(){return this._array.slice()},t.findFirst=function(e){return(0,z.Z)(this._array,e)},t.has=function(e){return(0,g.Z)(this._array,e)},t.removeElement=function(e){var t=this._array.indexOf(e);if(t>=0)return this._array.splice(t,1),t},t.head=function(){return this._array[0]},t.last=function(){return this._array[this._array.length-1]},t.shift=function(){return this._array.shift()},t.pop=function(){return this._array.pop()},e}(),Ye=function(){function e(e){this._weakMap=new WeakMap,this._fn=e}var t=e.prototype;return t.get=function(e){var t=this._weakMap.get(e);if(void 0===t){var n=this._fn(e);return this._weakMap.set(e,n),n}return t},t.destroy=function(e){this._weakMap.delete(e)},e}();function Xe(e,t){var n,r=e.segmentBuffer,i=e.playbackObserver,a=e.maxBufferBehind,o=e.maxBufferAhead;function s(){(function(e,t,n,r,i){return Qe.apply(this,arguments)})(r,n,a.getValue(),o.getValue(),t).catch((function(e){var t=e instanceof Error?e.message:"Unknown error";l.Z.error("Could not run BufferGarbageCollector:",t)}))}i.listen((function(e){var t;n=null!==(t=e.position.pending)&&void 0!==t?t:e.position.last,s()}),{includeLastObservation:!0,clearSignal:t}),a.onUpdate(s,{clearSignal:t}),o.onUpdate(s,{clearSignal:t}),s()}function Qe(){return(Qe=(0,I.Z)(R().mark((function e(t,n,r,i,a){var o,s,u,d,c,f,v,p;return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(isFinite(r)||isFinite(i)){e.next=2;break}return e.abrupt("return",Promise.resolve());case 2:o=[],s=(0,E.F_)(t.getBufferedRanges(),n),u=s.innerRange,d=s.outerRanges,c=function(){if(isFinite(i)){for(var e=0;et.start&&o.push({start:n+i,end:t.end})}null!=u&&n+i=t.end?o.push(t):n>=t.end&&n-r>t.start&&n-ru.start&&o.push({start:u.start,end:n-r})}}(),c(),f=0,v=o;case 9:if(!(f0&&n[0].segment.id===e._mediaSegmentAwaitingInitMetadata)){var r=e._mediaSegmentRequest;if(0===n.length){if(null===r)return;return l.Z.debug("Stream: no more media segment to request. Cancelling queue.",e._content.adaptation.type),void e._restartMediaSegmentDownloadingQueue()}if(null===r)return l.Z.debug("Stream: Media segments now need to be requested. Starting queue.",e._content.adaptation.type,n.length),void e._restartMediaSegmentDownloadingQueue();var i=n[0];return r.segment.id!==i.segment.id?(l.Z.debug("Stream: Next media segment changed, cancelling previous",e._content.adaptation.type),void e._restartMediaSegmentDownloadingQueue()):void(r.priority!==i.priority&&(l.Z.debug("Stream: Priority of next media segment changed, updating",e._content.adaptation.type,r.priority,i.priority),e._segmentFetcher.updatePriority(r.request,i.priority)))}}),{emitCurrentValue:!0,clearSignal:this._currentCanceller.signal}),this._downloadQueue.onUpdate((function(t){var n,r=e._initSegmentRequest;null===t.initSegment||null===r?(null===(n=t.initSegment)||void 0===n?void 0:n.segment.id)!==(null==r?void 0:r.segment.id)&&(null===t.initSegment&&l.Z.debug("Stream: no more init segment to request. Cancelling queue.",e._content.adaptation.type),e._restartInitSegmentDownloadingQueue(t.initSegment)):t.initSegment.priority!==r.priority&&e._segmentFetcher.updatePriority(r.request,t.initSegment.priority)}),{emitCurrentValue:!0,clearSignal:this._currentCanceller.signal}))},r.stop=function(){var e;null===(e=this._currentCanceller)||void 0===e||e.cancel(),this._currentCanceller=null},r._restartMediaSegmentDownloadingQueue=function(){var e=this;null!==this._mediaSegmentRequest&&this._mediaSegmentRequest.canceller.cancel();!function t(n){if(null!==e._currentCanceller&&e._currentCanceller.isUsed())e._mediaSegmentRequest=null;else{if(void 0===n)return e._mediaSegmentRequest=null,void e.trigger("emptyQueue",null);var r=new w.ZP,i=null===e._currentCanceller?L.Z:r.linkToSignal(e._currentCanceller.signal),a=n.segment,o=n.priority,s=(0,T.Z)({segment:a},e._content),u=!1,d=!1;r.signal.register((function(){e._mediaSegmentRequest=null,u||(e._mediaSegmentAwaitingInitMetadata===a.id&&(e._mediaSegmentAwaitingInitMetadata=null),u=!0,d=!1)}));var c=function(t){(0,y.Z)("media"===t.segmentType,"Should have loaded a media segment."),e.trigger("parsedMediaSegment",(0,T.Z)({},t,{segment:a}))},f=function(){var n=e._downloadQueue.getValue().segmentQueue;if(0===n.length)return u=!0,void e.trigger("emptyQueue",null);n[0].segment.id===a.id&&n.shift(),u=!0,t(n[0])},v=e._segmentFetcher.createRequest(s,o,{onRetry:function(t){e.trigger("requestRetry",{segment:a,error:t})},beforeInterrupted:function(){l.Z.info("Stream: segment request interrupted temporarly.",a.id,a.time)},onChunk:function(t){var n=e._initSegmentInfoRef.getValue();void 0!==n?c(t(null!=n?n:void 0)):(d=!0,e._initSegmentInfoRef.waitUntilDefined((function(e){c(t(null!=e?e:void 0))}),{clearSignal:r.signal}))},onAllChunksReceived:function(){d?(e._mediaSegmentAwaitingInitMetadata=a.id,e._initSegmentInfoRef.waitUntilDefined((function(){e._mediaSegmentAwaitingInitMetadata=null,d=!1,e.trigger("fullyLoadedSegment",a)}),{clearSignal:r.signal})):e.trigger("fullyLoadedSegment",a)},beforeEnded:function(){i(),e._mediaSegmentRequest=null,d?e._initSegmentInfoRef.waitUntilDefined(f,{clearSignal:r.signal}):f()}},r.signal);v.catch((function(t){i(),u||(u=!0,e.stop(),e.trigger("error",t))})),e._mediaSegmentRequest={segment:a,priority:o,request:v,canceller:r}}}(this._downloadQueue.getValue().segmentQueue[0])},r._restartInitSegmentDownloadingQueue=function(e){var t=this;if((null===this._currentCanceller||!this._currentCanceller.isUsed())&&(null!==this._initSegmentRequest&&this._initSegmentRequest.canceller.cancel(),null!==e)){var n=new w.ZP,r=null===this._currentCanceller?L.Z:n.linkToSignal(this._currentCanceller.signal),i=e.segment,a=e.priority,o=(0,T.Z)({segment:i},this._content),s=!1,u=this._segmentFetcher.createRequest(o,a,{onRetry:function(e){t.trigger("requestRetry",{segment:i,error:e})},beforeInterrupted:function(){l.Z.info("Stream: init segment request interrupted temporarly.",i.id)},beforeEnded:function(){r(),t._initSegmentRequest=null,s=!0},onChunk:function(e){var n,r=e(void 0);(0,y.Z)("init"===r.segmentType,"Should have loaded an init segment."),t.trigger("parsedInitSegment",(0,T.Z)({},r,{segment:i})),"init"===r.segmentType&&t._initSegmentInfoRef.setValue(null!==(n=r.initTimescale)&&void 0!==n?n:null)},onAllChunksReceived:function(){t.trigger("fullyLoadedSegment",i)}},n.signal);u.catch((function(e){r(),s||(s=!0,t.stop(),t.trigger("error",e))})),n.signal.register((function(){t._initSegmentRequest=null,s||(s=!0)})),this._initSegmentRequest={segment:i,priority:a,request:u,canceller:n}}},n}(_.Z);function Je(e,t,n,r,i){var a=e.period,o=e.adaptation,s=e.representation,u=function(e,t){for(var n=0;n=t.end)return null;if(r.bufferedEnd>t.start)return n}return null}(i,t);if(null===u){if(null===n){if(r&&void 0!==a.end&&t.end>=a.end)return{start:void 0,end:null};var d=s.index.checkDiscontinuity(t.start);if(null!==d)return{start:void 0,end:d}}return null}var c=i[u];if(void 0!==c.bufferedStart&&c.bufferedStart>t.start&&(null===n||c.infos.segment.end<=n)){var f=c.bufferedStart;return r||!1===s.index.awaitSegmentBetween(t.start,f)?(l.Z.debug("RS: current discontinuity encountered",o.type,c.bufferedStart),{start:void 0,end:f}):null}var v=function(e,t,n){if(n<=0)return l.Z.error("RS: Asked to check a discontinuity before the first chunk."),null;for(var r=n;r=t.end)return null;if(i.bufferedStart-a.bufferedEnd>0)return r}return null}(i,t,u+1);if(null!==v){var p=i[v-1],h=i[v];if(null===n||h.infos.segment.end<=n){if(!r&&!1!==s.index.awaitSegmentBetween(p.infos.segment.end,h.infos.segment.time))return null;var m=p.bufferedEnd,g=h.bufferedStart;return l.Z.debug("RS: future discontinuity encountered",o.type,m,g),{start:m,end:g}}}if(null===n){if(r&&void 0!==a.end){if(t.end=0;n--){var r=e[n];if(void 0===r.bufferedStart)return null;if(r.bufferedStart=a.end)return null;for(var b=i.length-1;b>=0;b--){var S=i[b];if(void 0===S.bufferedStart)break;if(S.bufferedStart=n.length-1?null:n[t+1],s=null;if(function(e,t,n){var r=c.Z.getCurrent().MAX_TIME_MISSING_FROM_COMPLETE_SEGMENT;if(void 0===e.bufferedStart)return l.Z.warn("Stream: Start of a segment unknown. Assuming it is garbage collected by default.",e.start),!0;if(null!==t&&void 0!==t.bufferedEnd&&e.bufferedStart-t.bufferedEnd<.1)return!1;if(nr)return l.Z.info("Stream: The start of the wanted segment has been garbage collected",e.start,e.bufferedStart),!0;return!1}(e,r,o.start)){if(function(e,t){var n,r;if(e.length<2)return!0;var i=e[e.length-1],a=null===(n=i.buffered)||void 0===n?void 0:n.start;if(void 0!==t&&void 0!==a&&t-a>.05)return!0;var o=e[e.length-2],s=null===(r=o.buffered)||void 0===r?void 0:r.start;if(void 0===s||void 0===a)return!0;return Math.abs(s-a)>.01}(s=a(e.infos),e.bufferedStart))return!1;l.Z.debug("Stream: skipping segment gc-ed at the start",e.start,e.bufferedStart)}if(function(e,t,n){var r=c.Z.getCurrent().MAX_TIME_MISSING_FROM_COMPLETE_SEGMENT;if(void 0===e.bufferedEnd)return l.Z.warn("Stream: End of a segment unknown. Assuming it is garbage collected by default.",e.end),!0;if(null!==t&&void 0!==t.bufferedStart&&t.bufferedStart-e.bufferedEnd<.1)return!1;if(n>e.bufferedEnd&&e.end-e.bufferedEnd>r)return l.Z.info("Stream: The end of the wanted segment has been garbage collected",e.start,e.bufferedStart),!0;return!1}(e,i,o.end)){if(function(e,t){var n,r;if(e.length<2)return!0;var i=e[e.length-1],a=null===(n=i.buffered)||void 0===n?void 0:n.end;if(void 0!==t&&void 0!==a&&a-t>.05)return!0;var o=e[e.length-2],s=null===(r=o.buffered)||void 0===r?void 0:r.end;if(void 0===s||void 0===a)return!0;return Math.abs(s-a)>.01}(s=null!=s?s:a(e.infos),e.bufferedEnd))return!1;l.Z.debug("Stream: skipping segment gc-ed at the end",e.end,e.bufferedEnd)}return!0})),m=c.Z.getCurrent(),g=m.MINIMUM_SEGMENT_SIZE,y=m.MIN_BUFFER_AHEAD,_=!1,b=Math.min(1/60,g),S=!1,E=[],k=p.filter((function(e){var t=(0,T.Z)({segment:e},n);if(s.length>0&&s.some((function(e){return(0,xe.z)(t,e)})))return!1;var u=e.duration,c=e.time,p=e.end;if(e.isInit)return!0;if(_)return E.push(e),!1;if(e.complete&&u0&&s.some((function(e){if(e.period.id!==n.period.id||e.adaptation.id!==n.adaptation.id)return!1;var a=e.segment;return!(a.time-b>c)&&(!(a.end+b-b&&w.end-p>-b)return!1}}var A=u*n.representation.bitrate;if(v-A<0&&(S=!0,c>o.start+y))return _=!0,E.push(e),!1;var I=a(t);if(I.length>1){var Z=I[I.length-1],R=I[I.length-2];if(null===Z.buffered&&null===R.buffered)return l.Z.warn("Stream: Segment GCed multiple times in a row, ignoring it.","If this happens a lot and lead to unpleasant experience, please check your device's available memory. If it's low when this message is emitted, you might want to update the RxPlayer's settings (`maxBufferAhead`, `maxVideoBufferSize` etc.) so less memory is used by regular media data buffering."+d.type,f.id,e.time),!1}for(var x=0;xc){var C=M.start>c+b||tt(h,x).ende[n].start;)n++;return e[--n]}function nt(e,t,n,r){var i=c.Z.getCurrent().CONTENT_REPLACEMENT_PADDING;return e.period.id===t.period.id&&(!(e.segment.timea}return rr}(e.representation,t.representation,r)))}function rt(e,t){for(var n=e-t,r=c.Z.getCurrent().SEGMENT_PRIORITIES_STEPS,i=0;i=u&&l.isInitialized()&&l.isFinished()&&function(e,t,n){var r;return t.containsTime(n)&&e.isLastPeriodKnown&&t.id===(null===(r=e.periods[e.periods.length-1])||void 0===r?void 0:r.id)}(a,o,t)?u-1:t-.1;var d,c=i+n;d=!(!s.index.isInitialized()||!s.index.isFinished()||void 0===o.end)&&(void 0===u?c>=o.end:null===u||c>=u);return{start:Math.max(i,o.start),end:Math.min(c,null!==(r=o.end)&&void 0!==r?r:1/0),hasReachedPeriodEnd:d}}(e,u,i),d=s.index.shouldRefresh(l.start,l.end),f=o.getPendingOperations().filter((function(e){return e.type===Ve.f.EndOfSegment})).map((function(e){return e.value})),v=function(e,t){for(var n=c.Z.getCurrent().MINIMUM_SEGMENT_SIZE,r=Math.max(1/60,n),i=e.start+r,a=e.end-r,o=[],s=t.length-1;s>=0;s--){var u=t[s],l=u.infos.representation;if(!u.partiallyPushed&&!1!==l.decipherable&&l.isSupported){var d=u.infos.segment,f=d.time/d.timescale;((d.complete?f+d.duration/d.timescale:u.end)>i&&fi&&u.start0&&(b=Math.min.apply(Math,f.map((function(e){return e.segment.time})))),m.length>0&&(b=null!==b?Math.min(b,m[0].time):m[0].time),y.length>0&&(b=null!==b?Math.min(b,y[0].segment.time):y[0].segment.time),{imminentDiscontinuity:Je(e,l,b,_,v),hasFinishedLoading:_,neededSegments:y,isBufferFull:g,shouldRefreshManifest:d}}function at(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return ot(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ot(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ot(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);nu.end||e+ni.start&&o.push({start:i.start,end:e-n}),e+n0&&Z.every((function(e){return void 0!==e.keyIds}))&&(I=!0,t.encryptionDataEncountered(Z.map((function(e){return(0,T.Z)({content:r},e)}))),_.isUsed()))return}var R=new $e(r,E,s,A);return R.addEventListener("error",(function(e){b.signal.isCancelled()||(_.cancel(),t.error(e))})),R.addEventListener("parsedInitSegment",M),R.addEventListener("parsedMediaSegment",M),R.addEventListener("emptyQueue",x),R.addEventListener("requestRetry",(function(e){if(t.warning(e.error),!b.signal.isCancelled()){var n=e.segment,r=v.index;!1===r.isSegmentStillAvailable(n)?x():r.canBeOutOfSyncError(e.error,n)&&t.manifestMightBeOufOfSync()}})),R.addEventListener("fullyLoadedSegment",(function(e){o.endOfSegment((0,T.Z)({segment:e},r),_.signal).catch(C)})),R.start(),b.signal.register((function(){R.removeEventListener(),R.stop()})),a.listen(x,{includeLastObservation:!1,clearSignal:b.signal}),p.onUpdate(x,{emitCurrentValue:!1,clearSignal:b.signal}),h.onUpdate(x,{emitCurrentValue:!1,clearSignal:b.signal}),u.onUpdate(x,{emitCurrentValue:!1,clearSignal:b.signal}),void x();function x(){var e,n;if(!b.isUsed()){var i=a.getReference().getValue(),s=null!==(e=i.position.pending)&&void 0!==e?e:i.position.last,f=it(r,s,a,g.getValue(),p.getValue(),h.getValue(),o),m=f.neededSegments,T=null;if(v.index.isInitialized()){if(m.length>0&&!S.isLoaded&&null!==S.segment){var k=m[0].priority;T={segment:S.segment,priority:k}}}else if(null===S.segment)l.Z.warn("Stream: Uninitialized index without an initialization segment");else if(S.isLoaded)l.Z.warn("Stream: Uninitialized index with an already loaded initialization segment");else{var w=null!==(n=i.position.pending)&&void 0!==n?n:i.position.last;T={segment:S.segment,priority:rt(d.start,w)}}var A=u.getValue();if(null===A)E.setValue({initSegment:T,segmentQueue:m});else{if(A.urgent)return l.Z.debug("Stream: Urgent switch, terminate now.",y),E.setValue({initSegment:null,segmentQueue:[]}),E.finish(),b.cancel(),void t.terminating();var I=m[0],Z=R.getRequestedInitSegment(),x=R.getRequestedMediaSegment(),M=null===x||void 0===I||x.id!==I.segment.id?[]:[I],P=null===Z?null:T;if(E.setValue({initSegment:P,segmentQueue:M}),0===M.length&&null===P)return l.Z.debug("Stream: No request left, terminate",y),E.finish(),b.cancel(),void t.terminating()}if(t.streamStatusUpdate({period:d,position:i.position.last,bufferType:y,imminentDiscontinuity:f.imminentDiscontinuity,isEmptyStream:!1,hasFinishedLoading:f.hasFinishedLoading,neededSegments:f.neededSegments}),!b.signal.isCancelled()){var D=c.Z.getCurrent().UPTO_CURRENT_POSITION_CLEANUP;if(f.isBufferFull){var N=Math.max(0,s-D);N>0&&o.removeBuffer(0,N,_.signal).catch(C)}f.shouldRefreshManifest&&t.needsManifestRefresh()}}}function M(e){if(!_.isUsed())if("init"===e.segmentType){if(S.segmentData=e.initializationData,S.isLoaded=!0,!I){var n=v.getAllEncryptionData();n.length>0&&t.encryptionDataEncountered(n.map((function(e){return(0,T.Z)({content:r},e)})))}(function(e,t){return ft.apply(this,arguments)})({playbackObserver:a,content:r,segment:e.segment,segmentData:e.initializationData,segmentBuffer:o},_.signal).then((function(e){null!==e&&t.addedSegment(e)})).catch(C),x()}else{var i=e.inbandEvents,s=e.needsManifestRefresh,u=e.protectionDataUpdate;if(!I&&u){var l=v.getAllEncryptionData();if(l.length>0&&(t.encryptionDataEncountered(l.map((function(e){return(0,T.Z)({content:r},e)}))),_.isUsed()))return}if(!0===s&&(t.needsManifestRefresh(),_.isUsed()))return;if(void 0!==i&&i.length>0&&(t.inbandEvent(i),_.isUsed()))return;var d=S.segmentData;(function(e,t){return vt.apply(this,arguments)})({playbackObserver:a,content:r,initSegmentData:d,parsedSegment:e,segment:e.segment,segmentBuffer:o},_.signal).then((function(e){null!==e&&t.addedSegment(e)})).catch(C)}}function C(e){_.isUsed()&&e instanceof w.FU||(_.cancel(),t.error(e))}};var ht=function(e,t,n){var r=e.playbackObserver,i=e.content,a=e.options,o=e.representationEstimator,s=e.segmentBuffer,u=e.segmentFetcherCreator,d=e.wantedBufferAhead,p=e.maxVideoBufferSize,h="direct"===a.manualBitrateSwitchingMode,m=i.manifest,g=i.period,y=i.adaptation,_=new w.ZP;_.linkToSignal(n);var b,S=new Map,E=(0,k.$l)(null,_.signal),A=function(e,t,n,r,i,a){var o=e.manifest,s=e.adaptation,u=(0,k.ZP)([],a);f(),o.addEventListener("decipherabilityUpdate",f);var l=a.register(p),d=t(e,n,u,r,a),c=d.estimates;return{abrCallbacks:d.callbacks,estimateRef:c};function f(){var e=s.getPlayableRepresentations();if(0===e.length){var t=new v.Z("NO_PLAYABLE_REPRESENTATION","No Representation in the chosen "+s.type+" Adaptation can be played",{adaptation:s});return p(),void i(t)}var n=u.getValue();n.length===e.length&&n.every((function(t,n){return t.id===e[n].id}))||u.setValue(e)}function p(){o.removeEventListener("decipherabilityUpdate",f),void 0!==l&&l()}}(i,o,E,r,(function(e){_.cancel(),t.error(e)}),_.signal),I=A.estimateRef,Z=A.abrCallbacks,R=u.createSegmentFetcher(y.type,{onRequestBegin:Z.requestBegin,onRequestEnd:Z.requestEnd,onProgress:Z.requestProgress,onMetrics:Z.metrics});function x(e,t,n,i){var o=new w.ZP;o.linkToSignal(_.signal);var u=(0,k.lR)(d,(function(t){return t*function(e){var t=S.get(e.id),n=void 0!==t?t:1;void 0===t&&S.set(e.id,n);return n}(e)}),o.signal),c="video"===y.type?p:(0,k.$l)(1/0);l.Z.info("Stream: changing representation",y.type,e.id,e.bitrate);var v=(0,T.Z)({},i,{error:function(r){var a,o=(0,f.Z)(r,{defaultCode:"NONE",defaultReason:"Unknown `RepresentationStream` error"});if("BUFFER_FULL_ERROR"!==o.code)i.error(r);else{var s=d.getValue(),u=.7*(null!==(a=S.get(e.id))&&void 0!==a?a:1);if(u<=.05||s*u<=2)throw o;S.set(e.id,u),(0,he.Z)(4e3,_.signal).then((function(){return x(e,t,n,i)})).catch(L.Z)}},terminating:function(){o.cancel(),i.terminating()}});pt({playbackObserver:r,content:{representation:e,adaptation:y,period:g,manifest:m},segmentBuffer:s,segmentFetcher:R,terminate:t,options:{bufferGoal:u,maxBufferSize:c,drmSystemId:a.drmSystemId,fastSwitchThreshold:n}},v,_.signal)}I.onUpdate((function(e){var n=e.bitrate;void 0!==n&&n!==b&&(b=n,l.Z.debug("Stream: new "+y.type+" bitrate estimate",n),t.bitrateEstimationChange({type:y.type,bitrate:n}))}),{emitCurrentValue:!0,clearSignal:_.signal}),function e(n){var i=new w.ZP;i.linkToSignal(_.signal);var o=I.getValue(),s=o.representation,u=o.manual;if(null===s)return;if(h&&u&&!n){var d=c.Z.getCurrent().DELTA_POSITION_AFTER_RELOAD;return je()((function(){r.listen((function(e){var n,i;if(I.getValue().manual){var a=r.getCurrentTime()+d.bitrateSwitch,o=Math.min(Math.max(g.start,a),null!==(n=g.end)&&void 0!==n?n:1/0),s=!(null!==(i=e.paused.pending)&&void 0!==i?i:r.getIsPaused());return t.waitingMediaSourceReload({bufferType:y.type,period:g,position:o,autoPlay:s})}}),{includeLastObservation:!0,clearSignal:i.signal})}))}var f=(0,k.$l)(null,i.signal);I.onUpdate((function(e){if(null!==e.representation&&e.representation.id!==s.id)return e.urgent?(l.Z.info("Stream: urgent Representation switch",y.type),f.setValue({urgent:!0})):(l.Z.info("Stream: slow Representation switch",y.type),f.setValue({urgent:!1}))}),{clearSignal:i.signal,emitCurrentValue:!0});var v=(0,k.$l)(0);a.enableFastSwitching&&I.onUpdate((function(e){v.setValueIfChanged(null==e?void 0:e.knownStableBitrate)}),{clearSignal:i.signal,emitCurrentValue:!0});var p={type:y.type,period:g,representation:s};if(E.setValue(s),_.isUsed())return;if(t.representationChange(p),_.isUsed())return;var m={streamStatusUpdate:t.streamStatusUpdate,encryptionDataEncountered:t.encryptionDataEncountered,manifestMightBeOufOfSync:t.manifestMightBeOufOfSync,needsManifestRefresh:t.needsManifestRefresh,inbandEvent:t.inbandEvent,warning:t.warning,error:function(e){_.cancel(),t.error(e)},addedSegment:function(e){Z.addedSegment(e),_.isUsed()||t.addedSegment(e)},terminating:function(){if(!i.isUsed())return i.cancel(),e(!1)}};x(s,f,v,m)}(!0)},mt=n(9252);var gt=function(e,t){var n=e.split(";"),r=n[0],i=n.slice(1),a=t.split(";"),o=a[0],s=a.slice(1);if(r!==o)return!1;var u=(0,z.Z)(i,(function(e){return(0,mt.Z)(e,"codecs=")})),l=(0,z.Z)(s,(function(e){return(0,mt.Z)(e,"codecs=")}));if(void 0===u||void 0===l)return!1;var d=u.substring(7),c=l.substring(7);return d.split(".")[0]===c.split(".")[0]};function yt(e,t,n,r,i){if(void 0!==e.codec&&"reload"===i.onCodecSwitch&&!function(e,t){return e.getPlayableRepresentations().some((function(e){return gt(e.getMimeTypeString(),t)}))}(n,e.codec))return{type:"needs-reload",value:void 0};var a=e.getBufferedRanges();if(0===a.length)return{type:"continue",value:void 0};var o=(0,E.JN)(a),s=t.start,u=null==t.end?1/0:t.end,l=(0,E.tn)(o,[{start:s,end:u}]);if(0===l.length)return{type:"continue",value:void 0};e.synchronizeInventory();var d=e.getInventory();if(!d.some((function(e){return e.infos.period.id===t.id&&e.infos.adaptation.id!==n.id})))return{type:"continue",value:void 0};var f=function(e,t,n){return e.reduce((function(e,r){if(r.infos.period.id!==t.id||r.infos.adaptation.id!==n.id)return e;var i=r.bufferedStart,a=r.bufferedEnd;return void 0===i||void 0===a||e.push({start:i,end:a}),e}),[])}(d,t,n),v=(0,E.uH)(l,f);if(0===v.length)return{type:"continue",value:void 0};var p=r.currentTime,h=i.audioTrackSwitchingMode;if(("video"===n.type||"audio"===n.type&&"reload"===h)&&(0,E.Ti)({start:s,end:u},p)&&(r.readyState>1||!n.getPlayableRepresentations().some((function(t){var n;return gt(t.getMimeTypeString(),null!==(n=e.codec)&&void 0!==n?n:"")})))&&!(0,E.A1)(f,p))return{type:"needs-reload",value:void 0};var m="audio"===n.type&&"direct"===h,g=[],y=function(e,t){for(var n=0;n=t.start)return n>0?e[n-1]:null;return e.length>0?e[e.length-1]:null}(d,t);null!==y&&(void 0===y.bufferedEnd||t.start-y.bufferedEnd<1)&&g.push({start:0,end:t.start+1});var _=n.type,b=c.Z.getCurrent().ADAPTATION_SWITCH_BUFFER_PADDINGS,S=b[_].before;null==S&&(S=0);var T=b[_].after;if(null==T&&(T=0),m||g.push({start:p-S,end:p+T}),void 0!==t.end){var k=function(e,t){for(var n=0;nt.start)return e[n];return null}(d,t);null!==k&&(void 0===k.bufferedStart||k.bufferedStart-t.end<1)&&g.push({start:t.end-1,end:Number.MAX_VALUE})}var w=(0,E.uH)(v,g);return 0===w.length?{type:"continue",value:void 0}:m?{type:"flush-buffer",value:w}:{type:"clean-buffer",value:w}}function _t(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return bt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return bt(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function bt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=o.end&&(l.Z.debug('Stream: full "empty" AdaptationStream',n),s=!0),i.streamStatusUpdate({period:o,bufferType:n,position:u,imminentDiscontinuity:null,isEmptyStream:!0,hasFinishedLoading:s,neededSegments:[]})}t.onUpdate(u,{emitCurrentValue:!1,clearSignal:a}),e.listen(u,{includeLastObservation:!1,clearSignal:a}),u()}var Et=function(e,t,n){var r=e.bufferType,i=e.content,a=e.garbageCollectors,o=e.playbackObserver,s=e.representationEstimator,u=e.segmentFetcherCreator,d=e.segmentBuffersStore,v=e.options,p=e.wantedBufferAhead,h=e.maxVideoBufferSize,m=i.period,g=(0,k.ZP)(void 0,n);if(t.periodStreamReady({type:r,period:m,adaptationRef:g}),!n.isCancelled()){var y,_=!0;g.onUpdate((function(e){(0,I.Z)(R().mark((function i(){var s,u,f,h,g,T,E,k,A,I,Z,x,M,C,P,D;return R().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(void 0!==e){i.next=2;break}return i.abrupt("return");case 2:if((u=new w.ZP).linkToSignal(n),null==y||y.cancel(),y=u,null!==e){i.next=34;break}if(l.Z.info("Stream: Set no "+r+" Adaptation. P:",m.start),"initialized"!==(f=d.getStatus(r)).type){i.next=26;break}if(l.Z.info("Stream: Clearing previous "+r+" SegmentBuffer"),!We.isNative(r)){i.next=15;break}return i.abrupt("return",S(0,u.signal));case 15:if(h=null!==(s=m.end)&&void 0!==s?s:1/0,!(m.start>h)){i.next=20;break}l.Z.warn("Stream: Can't free buffer: period's start is after its end"),i.next=24;break;case 20:return i.next=22,f.value.removeBuffer(m.start,h,u.signal);case 22:if(!u.isUsed()){i.next=24;break}return i.abrupt("return");case 24:i.next=30;break;case 26:if("uninitialized"!==f.type){i.next=30;break}if(d.disableSegmentBuffer(r),!u.isUsed()){i.next=30;break}return i.abrupt("return");case 30:if(t.adaptationChange({type:r,adaptation:null,period:m}),!u.isUsed()){i.next=33;break}return i.abrupt("return");case 33:return i.abrupt("return",Tt(o,p,r,{period:m},t,u.signal));case 34:if(g=c.Z.getCurrent(),T=g.DELTA_POSITION_AFTER_RELOAD,E=_?0:"audio"===r?T.trackSwitch.audio:"video"===r?T.trackSwitch.video:T.trackSwitch.other,_=!1,!We.isNative(r)||"disabled"!==d.getStatus(r).type){i.next=39;break}return i.abrupt("return",S(E,u.signal));case 39:if(l.Z.info("Stream: Updating "+r+" adaptation","A: "+e.id,"P: "+m.start),t.adaptationChange({type:r,adaptation:e,period:m}),!u.isUsed()){i.next=43;break}return i.abrupt("return");case 43:if(k=o.getReadyState(),A=St(d,r,e,v),I={currentTime:o.getCurrentTime(),readyState:k},"needs-reload"!==(Z=yt(A,m,e,I,v)).type){i.next=49;break}return i.abrupt("return",S(E,u.signal));case 49:return i.next=51,d.waitForUsableBuffers(u.signal);case 51:if(!u.isUsed()){i.next=53;break}return i.abrupt("return");case 53:if("flush-buffer"!==Z.type&&"clean-buffer"!==Z.type){i.next=67;break}x=_t(Z.value);case 55:if((M=x()).done){i.next=63;break}return C=M.value,P=C.start,D=C.end,i.next=59,A.removeBuffer(P,D,u.signal);case 59:if(!u.isUsed()){i.next=61;break}return i.abrupt("return");case 61:i.next=55;break;case 63:if("flush-buffer"!==Z.type){i.next=67;break}if(t.needsBufferFlush(),!u.isUsed()){i.next=67;break}return i.abrupt("return");case 67:a.get(A)(u.signal),b(e,A,u.signal);case 69:case"end":return i.stop()}}),i)})))().catch((function(e){e instanceof w.FU||(null==y||y.cancel(),t.error(e))}))}),{clearSignal:n,emitCurrentValue:!0})}function b(e,n,a){var c=i.manifest,g=function(e,t){return e.deriveReadOnlyObserver((function(e,n){var r=(0,k.ZP)(i(),n);return e.onUpdate(a,{clearSignal:n,emitCurrentValue:!1}),r;function i(){var n=e.getValue(),r=t.getBufferedRanges(),i=(0,E.L7)(r,n.position.last);return(0,T.Z)({},n,{bufferGap:i})}function a(){r.setValue(i())}}))}(o,n);ht({content:{manifest:c,period:m,adaptation:e},options:v,playbackObserver:g,representationEstimator:s,segmentBuffer:n,segmentFetcherCreator:u,wantedBufferAhead:p,maxVideoBufferSize:h},Object.assign(Object.assign({},t),{error:function(e){if(!We.isNative(r)){l.Z.error("Stream: "+r+" Stream crashed. Aborting it.",e instanceof Error?e:""),d.disposeSegmentBuffer(r);var n=(0,f.Z)(e,{defaultCode:"NONE",defaultReason:"Unknown `AdaptationStream` error"});if(t.warning(n),a.isCancelled())return;return Tt(o,p,r,{period:m},t,a)}l.Z.error("Stream: "+r+" Stream crashed. Stopping playback.",e instanceof Error?e:""),t.error(e)}}),a)}function S(e,n){je()((function(){o.listen((function(n){var i,a,s=o.getCurrentTime()+e,u=Math.min(Math.max(m.start,s),null!==(i=m.end)&&void 0!==i?i:1/0),l=!(null!==(a=n.paused.pending)&&void 0!==a?a:o.getIsPaused());t.waitingMediaSourceReload({bufferType:r,period:m,position:u,autoPlay:l})}),{includeLastObservation:!0,clearSignal:n})}))}};function kt(e,t){if(0===t.length)return[];e.synchronizeInventory();for(var n,r=[],i=e.getInventory(),a=function(){var n=i[o];if(t.some((function(e){return n.infos.period.id===e.period.id&&n.infos.adaptation.id===e.adaptation.id&&n.infos.representation.id===e.representation.id}))){var a=n.bufferedStart,s=n.bufferedEnd;if(void 0===a||void 0===s){l.Z.warn("SO: No buffered start or end found from a segment.");var u=e.getBufferedRanges(),d=u.length;return 0===d?{v:[]}:{v:[{start:u.start(0),end:u.end(d-1)}]}}var c=r[r.length-1];void 0!==c&&c.end===a?c.end=s:r.push({start:a,end:s})}},o=0;o=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function At(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0?t[t.length-1].end>=n-5:t[0].start<=n+5}var Zt=function(e,t,n,r,i,a,o,s){for(var u,d=e.manifest,f=e.initialPeriod,p=a.maxBufferAhead,h=a.maxBufferBehind,m=a.wantedBufferAhead,g=a.maxVideoBufferSize,y=c.Z.getCurrent(),_=y.MAXIMUM_MAX_BUFFER_AHEAD,b=y.MAXIMUM_MAX_BUFFER_BEHIND,S=new Ye((function(e){var n=e.bufferType,r=null!=b[n]?b[n]:1/0,i=null!=_[n]?_[n]:1/0;return function(n){Xe({segmentBuffer:e,playbackObserver:t,maxBufferBehind:(0,k.lR)(h,(function(e){return Math.min(e,r)}),n),maxBufferAhead:(0,k.lR)(p,(function(e){return Math.min(e,i)}),n)},n)}})),T=wt(r.getBufferTypes());!(u=T()).done;){E(u.value,f)}function E(e,n){var i=new qe((function(e,t){return e.start-t.start})),a=!1,u=new w.ZP;return u.linkToSignal(s),t.listen((function(t){var n,r,f=t.position,v=null!==(n=f.pending)&&void 0!==n?n:f.last;if(a&&function(e){var t=i.head(),n=i.last();if(null==t||null==n)return!0;return t.start>e||(null==n.end?1/0:n.end)0;){var p=i.get(i.length()-1);i.removeElement(p),o.periodStreamCleared({type:e,period:p})}u.cancel(),(u=new w.ZP).linkToSignal(s);var h=null!==(r=d.getPeriodForTime(v))&&void 0!==r?r:d.getNextPeriod(v);void 0!==h?c(h):l.Z.warn("Stream: The wanted position is not found in the Manifest.")}}),{clearSignal:s,includeLastObservation:!0}),d.addEventListener("decipherabilityUpdate",(function(e){(function(e){return f.apply(this,arguments)})(e).catch((function(e){u.cancel(),o.error(e)}))}),s),c(n);function c(t){var n=Object.assign(Object.assign({},o),{waitingMediaSourceReload:function(e){var t=i.head();if(void 0===t||t.id!==e.period.id)o.lockedStream({bufferType:e.bufferType,period:e.period});else{var n=e.position,r=e.autoPlay;o.needsMediaSourceReload({position:n,autoPlay:r})}},periodStreamReady:function(e){a=!0,i.add(e.period),o.periodStreamReady(e)},periodStreamCleared:function(e){i.removeElement(e.period),o.periodStreamCleared(e)},error:function(e){u.cancel(),o.error(e)}});A(e,t,n,u.signal)}function f(){return f=(0,I.Z)(R().mark((function n(f){var p,h,m,g,y,_,b,S,T,E,k,A,I;return R().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(p=r.getStatus(e),0!==(h=f.filter((function(t){return t.adaptation.type===e}))).length&&"initialized"===p.type&&!h.every((function(e){return!0===e.representation.decipherable}))){n.next=4;break}return n.abrupt("return");case 4:for(m=p.value,g=h.filter((function(e){return void 0===e.representation.decipherable})),y=h.filter((function(e){return!1===e.representation.decipherable})),_=kt(m,y),b=kt(m,g),a=!1,l.Z.info("Stream: Destroying all PeriodStreams for decipherability matters",e);i.length()>0;)S=i.get(i.length()-1),i.removeElement(S),o.periodStreamCleared({type:e,period:S});u.cancel(),(u=new w.ZP).linkToSignal(s),T=0,E=[].concat(_,b);case 16:if(!(T=o.end&&(l.Z.info("Stream: Destroying PeriodStream as the current playhead moved above it",e,o.start,null!==(i=a.pending)&&void 0!==i?i:a.last,o.end),n(),s.periodStreamCleared({type:e,period:o}),f.cancel())}),{clearSignal:u,includeLastObservation:!0});var v={bufferType:e,content:{manifest:d,period:o},garbageCollectors:S,maxVideoBufferSize:g,segmentFetcherCreator:i,segmentBuffersStore:r,options:a,playbackObserver:t,representationEstimator:n,wantedBufferAhead:m},p=Object.assign(Object.assign({},s),{streamStatusUpdate:function(t){if(t.hasFinishedLoading){var n=d.getPeriodAfter(o);null!==n&&function(t){if(null!==c){if(c.period.id===t.id)return;l.Z.warn("Stream: Creating next `PeriodStream` while one was already created.",e,t.id,c.period.id),s.periodStreamCleared({type:e,period:c.period}),c.canceller.cancel()}var n=new w.ZP;n.linkToSignal(u),c={canceller:n,period:t},A(e,t,s,c.canceller.signal)}(n)}else null!==c&&(l.Z.info("Stream: Destroying next PeriodStream due to current one being active",e,c.period.start),s.periodStreamCleared({type:e,period:c.period}),c.canceller.cancel(),c=null);s.streamStatusUpdate(t)},error:function(e){null!==c&&(c.canceller.cancel(),c=null),f.cancel(),s.error(e)}});Et(v,p,f.signal)}},Rt=Zt,xt=n(9420);function Mt(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Ct(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ct(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Ct(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);na.getMaximumAvailablePosition()){var u=new v.Z("MEDIA_TIME_AFTER_MANIFEST","The current position is after the latest time announced in the Manifest.");i.trigger("warning",u)}}),{includeLastObservation:!0,clearSignal:o}),t.addEventListener("manifestUpdate",(function(){i.trigger("durationUpdate",i._getManifestDuration()),o.isCancelled()||i._checkEndOfStream()}),o),i}(0,t.Z)(n,e);var r=n.prototype;return r.getCurrentDuration=function(){return this._getManifestDuration()},r.onAdaptationChange=function(e,t,n){if(this._manifest.isLastPeriodKnown){var r=this._manifest.periods[this._manifest.periods.length-1];if(t.id===(null==r?void 0:r.id)&&("audio"===e||"video"===e)){"audio"===e?this._maximumPositionCalculator.updateLastAudioAdaptation(n):this._maximumPositionCalculator.updateLastVideoAdaptation(n);var i=this._maximumPositionCalculator.getEndingPosition(),a=void 0!==i?{isEnd:!0,duration:i}:{isEnd:!1,duration:this._maximumPositionCalculator.getMaximumAvailablePosition()};this.trigger("durationUpdate",a)}}this._canceller.isUsed()||null===n&&this._addActivelyLoadedPeriod(t,e)},r.onRepresentationChange=function(e,t){this._addActivelyLoadedPeriod(t,e)},r.onPeriodCleared=function(e,t){this._removeActivelyLoadedPeriod(t,e)},r.onLastSegmentFinishedLoading=function(e){var t=this._lazilyCreateActiveStreamInfo(e);t.hasFinishedLoadingLastPeriod||(t.hasFinishedLoadingLastPeriod=!0,this._checkEndOfStream())},r.onLastSegmentLoadingResume=function(e){var t=this._lazilyCreateActiveStreamInfo(e);t.hasFinishedLoadingLastPeriod&&(t.hasFinishedLoadingLastPeriod=!1,this._checkEndOfStream())},r.dispose=function(){this.removeEventListener(),this._canceller.cancel()},r._addActivelyLoadedPeriod=function(e,t){var n=this._lazilyCreateActiveStreamInfo(t);n.activePeriods.has(e)||(n.activePeriods.add(e),this._checkCurrentPeriod())},r._removeActivelyLoadedPeriod=function(e,t){var n=this._activeStreams.get(t);void 0!==n&&n.activePeriods.has(e)&&(n.activePeriods.removeElement(e),this._checkCurrentPeriod())},r._checkCurrentPeriod=function(){var e=this;if(0!==this._allBufferTypes.length){var t=this._activeStreams.get(this._allBufferTypes[0]);if(void 0!==t)for(var n,r,i=function(){for(var t=r.value,n=!0,i=1;i=0;a--){var o=i[a];try{"open"===r&&(l.Z.info("Init: Aborting SourceBuffer before removing"),o.abort()),l.Z.info("Init: Removing SourceBuffer from mediaSource"),t.removeSourceBuffer(o)}catch(e){l.Z.warn("Init: Error while disposing SourceBuffer",e instanceof Error?e:"")}}i.length>0&&l.Z.warn("Init: Not all SourceBuffers could have been removed.")}if(l.Z.info("Init: Clearing HTMLMediaElement's src"),(0,Lt.Z)(e),null!==n)try{l.Z.debug("Init: Revoking previous URL"),URL.revokeObjectURL(n)}catch(e){l.Z.warn("Init: Error while revoking the media source URL",e instanceof Error?e:"")}}function Vt(e,t){return(0,O.Z)(t,(function(n){var r=function(e,t){if(null==Ut.J)throw new v.Z("MEDIA_SOURCE_NOT_SUPPORTED","No MediaSource Object was found in the current browser.");var n=(0,Bt.Z)(e.src)?e.src:null;Ft(e,null,n),l.Z.info("Init: Creating MediaSource");var r=new Ut.J,i=URL.createObjectURL(r);return l.Z.info("Init: Attaching MediaSource URL to the media element",i),e.src=i,t.register((function(){Ft(e,r,i)})),r}(e,t);i.u_(r,(function(){l.Z.info("Init: MediaSource opened"),n(r)}),t)}))}function zt(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Kt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Kt(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Kt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0?r:Math.max(i,r+u)}if(!(0,S.Z)(n.percentage)){l.Z.debug("Init: using startAt.percentage");var d=n.percentage;return d>100?r:d<0?i:i+(r-i)*(+d/100)}}var f=e.getMinimumSafePosition();if(e.isLive){var v,p=e.suggestedPresentationDelay,h=e.clockOffset,m=e.getMaximumSafePosition(),g=c.Z.getCurrent().DEFAULT_LIVE_GAP;if(void 0===h)l.Z.info("Init: no clock offset found for a live content, starting close to maximum available position"),v=m;else{l.Z.info("Init: clock offset found for a live content, checking if we can start close to it");var y=void 0===e.availabilityStartTime?0:e.availabilityStartTime,_=(performance.now()+h)/1e3-y;v=Math.min(m,_)}var b=void 0!==p?p:t?g.LOW_LATENCY:g.DEFAULT;return l.Z.debug("Init: "+v+" defined as the live time, applying a live gap of "+b),Math.max(v-b,f)}return l.Z.info("Init: starting at the minimum available position:",f),f}var Yt=n(379),Xt=n(8833),Qt=n(7794);var $t=31536e3,Jt=function(){function e(e){this._mediaSource=e,this._currentMediaSourceDurationUpdateCanceller=null}var t=e.prototype;return t.updateDuration=function(e,t){null!==this._currentMediaSourceDurationUpdateCanceller&&this._currentMediaSourceDurationUpdateCanceller.cancel(),this._currentMediaSourceDurationUpdateCanceller=new w.ZP;var n=this._mediaSource,r=this._currentMediaSourceDurationUpdateCanceller.signal,a=function(e,t){var n=(0,k.ZP)("open"===e.readyState,t);return(0,i.u_)(e,(function(){l.Z.debug("Init: Reacting to MediaSource open in duration updater"),n.setValueIfChanged(!0)}),t),(0,i.N8)(e,(function(){l.Z.debug("Init: Reacting to MediaSource ended in duration updater"),n.setValueIfChanged(!1)}),t),(0,i.k6)(e,(function(){l.Z.debug("Init: Reacting to MediaSource close in duration updater"),n.setValueIfChanged(!1)}),t),n}(n,r),o=new w.ZP;o.linkToSignal(r),a.onUpdate((function(){if(o.cancel(),!a.getValue())return;(o=new w.ZP).linkToSignal(r);var i=function(e,t){if(0===e.length){var n=(0,k.ZP)(!1);return n.finish(),n}var r=(0,k.ZP)(!1,t);o();for(var i=function(){var n=e[a];n.addEventListener("updatestart",o),n.addEventListener("update",o),t.register((function(){n.removeEventListener("updatestart",o),n.removeEventListener("update",o)}))},a=0;a0&&(i=Math.max(o.buffered.end(s-1)))}if(r===e.duration)return"success";if(i>r){if(i=.1?f=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function un(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);nl||void 0!==h&&l>=h)&&(ln(v)&&c.push(v.publicEvent),o.delete(v)):p<=l&&void 0!==h&&l=(null!=h?h:p)&&(u?d.push({type:"stream-event-skip",value:v.publicEvent}):(d.push({type:"stream-event",value:v.publicEvent}),ln(v)&&c.push(v.publicEvent)))}if(d.length>0)for(var m,g=sn(d);!(m=g()).done;){var y=m.value;if("stream-event"===y.type?r(y.value):i(y.value),a.isCancelled())return}if(c.length>0)for(var _,b=sn(c);!(_=b()).done;){var S=_.value;if("function"==typeof S.onExit&&S.onExit(),a.isCancelled())return}}(s.getValue(),d,e,l.signal),d=e}function h(){var e=n.getReference().getValue().seeking;return{currentTime:t.currentTime,isSeeking:e}}}),{emitCurrentValue:!0,clearSignal:a})},cn=n(4576);function fn(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return vn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return vn(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function vn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);nd.end&&(n=d.end-1)}}else n=s;return{maximumPosition:e.getMaximumSafePosition(),position:{last:u.position,pending:n},duration:u.duration,paused:{last:u.paused,pending:i.getValue()||!r===u.paused?void 0:!r},readyState:u.readyState,speed:l}}function d(){u.setValue(l())}}))}(u,f,{autoPlay:a,initialPlayPerformed:E,initialSeekPerformed:w,speed:g,startTime:s}),I=this._createRebufferingController(f,u,g,n),Z=this._createContentTimeBoundariesObserver(u,d,A,b,n);T.then((function(){(0,Yt.Z)(f,l,!1,n).onUpdate((function(e,t){e&&(t(),i.trigger("loaded",{segmentBuffersStore:b}))}),{emitCurrentValue:!0,clearSignal:n})})).catch((function(e){n.isCancelled()||i._onFatalError(e)}));var R=this;Rt({manifest:u,initialPeriod:y},A,h,b,m,o,{needsBufferFlush:function(){var e=l.currentTime+.001;f.setCurrentTime(e),f.listen((function(t,n){(null!==t.currentRange||t.position>e+.1)&&(n(),f.setCurrentTime(t.position+.001))}),{includeLastObservation:!1,clearSignal:n})},streamStatusUpdate:function(e){var t=e.period,r=e.bufferType,i=e.imminentDiscontinuity,a=e.position;I.updateDiscontinuityInfo({period:t,bufferType:r,discontinuity:i,position:a}),n.isCancelled()||u.isLastPeriodKnown&&e.period.id===u.periods[u.periods.length-1].id&&(e.hasFinishedLoading||e.isEmptyStream?Z.onLastSegmentFinishedLoading(e.bufferType):Z.onLastSegmentLoadingResume(e.bufferType))},needsManifestRefresh:function(){return R._manifestFetcher.scheduleManualRefresh({enablePartialRefresh:!0,canUseUnsafeMode:!0})},manifestMightBeOufOfSync:function(){var e=c.Z.getCurrent().OUT_OF_SYNC_MANIFEST_REFRESH_DELAY;R._manifestFetcher.scheduleManualRefresh({enablePartialRefresh:!1,canUseUnsafeMode:!1,delay:e})},lockedStream:function(e){return I.onLockedStream(e.bufferType,e.period)},adaptationChange:function(e){R.trigger("adaptationChange",e),n.isCancelled()||Z.onAdaptationChange(e.type,e.period,e.adaptation)},representationChange:function(e){R.trigger("representationChange",e),n.isCancelled()||Z.onRepresentationChange(e.type,e.period)},inbandEvent:function(e){return R.trigger("inbandEvents",e)},warning:function(e){return R.trigger("warning",e)},periodStreamReady:function(e){return R.trigger("periodStreamReady",e)},periodStreamCleared:function(e){Z.onPeriodCleared(e.type,e.period),n.isCancelled()||R.trigger("periodStreamCleared",e)},bitrateEstimationChange:function(e){return R.trigger("bitrateEstimationChange",e)},addedSegment:function(e){return R.trigger("addedSegment",e)},needsMediaSourceReload:function(e){return t(e)},needsDecipherabilityFlush:function(e){var n,r=D(l);void 0===(n=null==r?void 0:r[0])||n.indexOf("widevine")<0?t(e):e.position+.001=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function gn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&(i="internal-seeking",r=t._internalSeeksIncoming.shift());var a=null!=e?e:t._generateInitialObservation(),o=Sn(t._mediaElement,i,t._withMediaSource),s=null;o.seeking&&("number"==typeof r?s=r:null!==a.pendingInternalSeek&&"seeking"!==n&&(s=a.pendingInternalSeek));var u=function(e,t,n){var r,i,a=n.withMediaSource,o=n.lowLatencyMode,s=c.Z.getCurrent().REBUFFERING_GAP,u=t.event,l=t.position,d=t.bufferGap,f=t.currentRange,v=t.duration,p=t.paused,h=t.readyState,m=t.ended,g=e.rebuffering,y=e.event,_=e.position,b=function(e,t,n,r,i){var a=c.Z.getCurrent().REBUFFERING_GAP,o=i?"LOW_LATENCY":"DEFAULT";if(void 0===t)return n&&Math.abs(r-e)<=a[o];return null!==t&&r-t.end<=a[o]}(l,f,m,v,o),S=h>=1&&"loadedmetadata"!==u&&null===g&&!(b||m),T=null,E=o?s.LOW_LATENCY:s.DEFAULT;if(a){if(S)d===1/0?(r=!0,T=l):void 0===d?h<3&&(r=!0,T=void 0):d<=E&&(r=!0,T=l+d);else if(null!==g){var k=bn(g,o);!0!==r&&null!==g&&h>1&&(b||m||void 0!==d&&isFinite(d)&&d>k)||void 0===d&&h>=3?i=!0:void 0===d?T=void 0:d===1/0?T=l:d<=k&&(T=l+d)}}else S&&(!p&&"timeupdate"===u&&"timeupdate"===y&&l===_||"seeking"===u&&(d===1/0||void 0===d&&h<3))?r=!0:null!==g&&("seeking"!==u&&l!==_||"canplay"===u||void 0===d&&h>=3||void 0!==d&&d<1/0&&(d>bn(g,o)||b||m))&&(i=!0);if(!0===i)return null;var w;if(!0===r||null!==g)return w="seeking"===u||null!==g&&"seeking"===g.reason||t.seeking?"seeking":1===h?"not-ready":"buffering",null!==g&&g.reason===w?{reason:g.reason,timestamp:g.timestamp,position:T}:{reason:w,timestamp:performance.now(),position:T};return null}(a,o,{lowLatencyMode:t._lowLatencyMode,withMediaSource:t._withMediaSource}),d=function(e,t){var n=c.Z.getCurrent().MINIMUM_BUFFER_AMOUNT_BEFORE_FREEZING;if(e.freezing)return t.ended||t.paused||0===t.readyState||0===t.playbackRate||e.position!==t.position?null:e.freezing;return"timeupdate"===t.event&&void 0!==t.bufferGap&&t.bufferGap>n&&!t.ended&&!t.paused&&t.readyState>=1&&0!==t.playbackRate&&t.position===e.position?{timestamp:performance.now()}:null}(a,o),f=(0,T.Z)({},{rebuffering:u,freezing:d,pendingInternalSeek:s},o);return l.Z.hasLevel("DEBUG")&&l.Z.debug("API: current media element state tick","event",f.event,"position",f.position,"seeking",f.seeking,"internalSeek",f.pendingInternalSeek,"rebuffering",null!==f.rebuffering,"freezing",null!==f.freezing,"ended",f.ended,"paused",f.paused,"playbackRate",f.playbackRate,"readyState",f.readyState),f},s=(0,k.ZP)(o("init"),this._canceller.signal),u=function(t){var n=o(t);l.Z.hasLevel("DEBUG")&&l.Z.debug("API: current playback timeline:\n"+function(e,t){for(var n="",r="",i=0;it){var d=n.length-Math.floor(l.length/2);r=" ".repeat(d)+"^"+t}if(i=3?(r=void 0,i=void 0):i=null!==(r=(0,E.rx)(a,o))?r.end-o:1/0,{bufferGap:i,buffered:a,currentRange:r,position:o,duration:s,ended:u,paused:l,playbackRate:d,readyState:c,seeking:f,event:t}}function Tn(e,t,n){var r=t(e.getReference(),n);return{getCurrentTime:function(){return e.getCurrentTime()},getReadyState:function(){return e.getReadyState()},getPlaybackRate:function(){return e.getPlaybackRate()},getIsPaused:function(){return e.getIsPaused()},getReference:function(){return r},listen:function(e,t){var i;n.isCancelled()||!0===(null===(i=null==t?void 0:t.clearSignal)||void 0===i?void 0:i.isCancelled())||r.onUpdate(e,{clearSignal:null==t?void 0:t.clearSignal,emitCurrentValue:null==t?void 0:t.includeLastObservation})},deriveReadOnlyObserver:function(e){return Tn(this,e,n)}}}var En=n(7829);function kn(e){return e.map((function(e){return null===e?e:{normalized:void 0===e.language?void 0:(0,En.ZP)(e.language),audioDescription:e.audioDescription,codec:e.codec}}))}function wn(e){return e.map((function(e){return null===e?e:{normalized:(0,En.ZP)(e.language),forced:e.forced,closedCaption:e.closedCaption}}))}var An=function(){function e(e){this._periods=new qe((function(e,t){return e.period.start-t.period.start})),this._audioChoiceMemory=new WeakMap,this._textChoiceMemory=new WeakMap,this._videoChoiceMemory=new WeakMap,this._preferredAudioTracks=[],this._preferredTextTracks=[],this._preferredVideoTracks=[],this.trickModeTrackEnabled=e.preferTrickModeTracks}var t=e.prototype;return t.setPreferredAudioTracks=function(e,t){this._preferredAudioTracks=e,t&&this._applyAudioPreferences()},t.setPreferredTextTracks=function(e,t){this._preferredTextTracks=e,t&&this._applyTextPreferences()},t.setPreferredVideoTracks=function(e,t){this._preferredVideoTracks=e,t&&this._applyVideoPreferences()},t.addPeriod=function(e,t,n){var r=Pn(this._periods,t),i=t.getSupportedAdaptations(e);if(void 0!==r){if(void 0!==r[e])return void l.Z.warn("TrackChoiceManager: "+e+" already added for period",t.start);r[e]={adaptations:i,adaptationRef:n}}else{var a;this._periods.add(((a={period:t})[e]={adaptations:i,adaptationRef:n},a))}},t.removePeriod=function(e,t){var n=function(e,t){for(var n=0;n0;)this._periods.pop()},t.update=function(){this._resetChosenAudioTracks(),this._resetChosenTextTracks(),this._resetChosenVideoTracks()},t.setInitialAudioTrack=function(e){var t=Pn(this._periods,e),n=void 0!==t?t.audio:null;if((0,S.Z)(n)||void 0===t)throw new Error("TrackChoiceManager: Given Period not found.");var r=e.getSupportedAdaptations("audio"),i=this._audioChoiceMemory.get(e);if(null===i)n.adaptationRef.setValue(null);else if(void 0!==i&&(0,g.Z)(r,i))n.adaptationRef.setValue(i);else{var a=Zn(r,kn(this._preferredAudioTracks));this._audioChoiceMemory.set(e,a),n.adaptationRef.setValue(a)}},t.setInitialTextTrack=function(e){var t=Pn(this._periods,e),n=void 0!==t?t.text:null;if((0,S.Z)(n)||void 0===t)throw new Error("TrackChoiceManager: Given Period not found.");var r=e.getSupportedAdaptations("text"),i=this._textChoiceMemory.get(e);if(null===i)n.adaptationRef.setValue(null);else if(void 0!==i&&(0,g.Z)(r,i))n.adaptationRef.setValue(i);else{var a=xn(r,wn(this._preferredTextTracks),this._audioChoiceMemory.get(e));this._textChoiceMemory.set(e,a),n.adaptationRef.setValue(a)}},t.setInitialVideoTrack=function(e){var t=Pn(this._periods,e),n=void 0!==t?t.video:null;if((0,S.Z)(n)||void 0===t)throw new Error("TrackChoiceManager: Given Period not found.");var r,i=e.getSupportedAdaptations("video"),a=this._videoChoiceMemory.get(e);if(null===a)r=null;else if(void 0!==a&&(0,g.Z)(i,a.baseAdaptation))r=a.baseAdaptation;else{r=Cn(i,this._preferredVideoTracks)}if(null===r)return this._videoChoiceMemory.set(e,null),void n.adaptationRef.setValue(null);var o=Dn(r,this.trickModeTrackEnabled);this._videoChoiceMemory.set(e,{baseAdaptation:r,adaptation:o}),n.adaptationRef.setValue(o)},t.setAudioTrackByID=function(e,t){var n=Pn(this._periods,e),r=void 0!==n?n.audio:null;if((0,S.Z)(r))throw new Error("TrackChoiceManager: Given Period not found.");var i=(0,z.Z)(r.adaptations,(function(e){return e.id===t}));if(void 0===i)throw new Error("Audio Track not found.");this._audioChoiceMemory.get(e)!==i&&(this._audioChoiceMemory.set(e,i),r.adaptationRef.setValue(i))},t.setTextTrackByID=function(e,t){var n=Pn(this._periods,e),r=void 0!==n?n.text:null;if((0,S.Z)(r))throw new Error("TrackChoiceManager: Given Period not found.");var i=(0,z.Z)(r.adaptations,(function(e){return e.id===t}));if(void 0===i)throw new Error("Text Track not found.");this._textChoiceMemory.get(e)!==i&&(this._textChoiceMemory.set(e,i),r.adaptationRef.setValue(i))},t.setVideoTrackByID=function(e,t){var n=Pn(this._periods,e),r=void 0!==n?n.video:null;if((0,S.Z)(r))throw new Error("LanguageManager: Given Period not found.");var i=(0,z.Z)(r.adaptations,(function(e){return e.id===t}));if(void 0===i)throw new Error("Video Track not found.");var a=Dn(i,this.trickModeTrackEnabled);this._videoChoiceMemory.set(e,{baseAdaptation:i,adaptation:a}),r.adaptationRef.setValue(a)},t.disableTextTrack=function(e){var t=Pn(this._periods,e),n=void 0!==t?t.text:null;if((0,S.Z)(n))throw new Error("TrackChoiceManager: Given Period not found.");null!==this._textChoiceMemory.get(e)&&(this._textChoiceMemory.set(e,null),n.adaptationRef.setValue(null))},t.disableVideoTrack=function(e){var t=Pn(this._periods,e),n=null==t?void 0:t.video;if(void 0===n)throw new Error("TrackManager: Given Period not found.");null!==this._videoChoiceMemory.get(e)&&(this._videoChoiceMemory.set(e,null),n.adaptationRef.setValue(null))},t.disableVideoTrickModeTracks=function(){this.trickModeTrackEnabled=!1,this._resetChosenVideoTracks()},t.enableVideoTrickModeTracks=function(){this.trickModeTrackEnabled=!0,this._resetChosenVideoTracks()},t.isTrickModeEnabled=function(){return this.trickModeTrackEnabled},t.getChosenAudioTrack=function(e){var t=Pn(this._periods,e),n=void 0!==t?t.audio:null;if((0,S.Z)(n))return null;var r=this._audioChoiceMemory.get(e);return(0,S.Z)(r)?null:r.toAudioTrack()},t.getChosenTextTrack=function(e){var t=Pn(this._periods,e),n=void 0!==t?t.text:null;if((0,S.Z)(n))return null;var r=this._textChoiceMemory.get(e);return(0,S.Z)(r)?null:r.toTextTrack()},t.getChosenVideoTrack=function(e){var t=Pn(this._periods,e),n=void 0!==t?t.video:null;if((0,S.Z)(n))return null;var r=this._videoChoiceMemory.get(e);return(0,S.Z)(r)?null:r.adaptation.toVideoTrack()},t.getAvailableAudioTracks=function(e){var t=Pn(this._periods,e),n=void 0!==t?t.audio:null;if((0,S.Z)(n))return[];var r=this._audioChoiceMemory.get(e),i=(0,S.Z)(r)?null:r.id;return n.adaptations.map((function(e){var t=null!==i&&i===e.id;return(0,T.Z)(e.toAudioTrack(),{active:t})}))},t.getAvailableTextTracks=function(e){var t=Pn(this._periods,e),n=void 0!==t?t.text:null;if((0,S.Z)(n))return[];var r=this._textChoiceMemory.get(e),i=(0,S.Z)(r)?null:r.id;return n.adaptations.map((function(e){var t=null!==i&&i===e.id;return(0,T.Z)(e.toTextTrack(),{active:t})}))},t.getAvailableVideoTracks=function(e){var t,n=Pn(this._periods,e),r=void 0!==n?n.video:null;if((0,S.Z)(r))return[];var i=this._videoChoiceMemory.get(e),a=void 0===i?void 0:null!==(t=null==i?void 0:i.adaptation.id)&&void 0!==t?t:void 0;return r.adaptations.map((function(e){var t=null!==a&&a===e.id,n=e.toVideoTrack(),r=void 0!==n.trickModeTracks?n.trickModeTracks.map((function(e){var t=null!==a&&a===e.id;return(0,T.Z)(e,{active:t})})):[],i=(0,T.Z)(n,{active:t});return void 0!==r&&(i.trickModeTracks=r),i}))},t._applyAudioPreferences=function(){this._audioChoiceMemory=new WeakMap,this._resetChosenAudioTracks()},t._applyTextPreferences=function(){this._textChoiceMemory=new WeakMap,this._resetChosenTextTracks()},t._applyVideoPreferences=function(){this._videoChoiceMemory=new WeakMap,this._resetChosenVideoTracks()},t._resetChosenAudioTracks=function(){var e=this,t=kn(this._preferredAudioTracks);!function n(r){if(!(r>=e._periods.length())){var i=e._periods.get(r);if((0,S.Z)(i.audio))n(r+1);else{var a=i.period,o=i.audio,s=a.getSupportedAdaptations("audio"),u=e._audioChoiceMemory.get(a);if(null===u||void 0!==u&&(0,g.Z)(s,u))n(r+1);else{var l=Zn(s,t);e._audioChoiceMemory.set(a,l),o.adaptationRef.setValue(l),n(0)}}}}(0)},t._resetChosenTextTracks=function(){var e=this,t=wn(this._preferredTextTracks);!function n(r){if(!(r>=e._periods.length())){var i=e._periods.get(r);if((0,S.Z)(i.text))n(r+1);else{var a=i.period,o=i.text,s=a.getSupportedAdaptations("text"),u=e._textChoiceMemory.get(a);if(null===u||void 0!==u&&(0,g.Z)(s,u))n(r+1);else{var l=xn(s,t,e._audioChoiceMemory.get(a));e._textChoiceMemory.set(a,l),o.adaptationRef.setValue(l),n(0)}}}}(0)},t._resetChosenVideoTracks=function(){var e=this,t=this._preferredVideoTracks;!function n(r){if(!(r>=e._periods.length())){var i=e._periods.get(r);if((0,S.Z)(i.video))n(r+1);else{var a=i.period,o=i.video,s=a.getSupportedAdaptations("video"),u=e._videoChoiceMemory.get(a);if(null!==u){if(void 0!==u&&(0,g.Z)(s,u.baseAdaptation)){var l=Dn(u.baseAdaptation,e.trickModeTrackEnabled);return l.id===u.adaptation.id?void n(r+1):(e._videoChoiceMemory.set(a,{baseAdaptation:u.baseAdaptation,adaptation:l}),o.adaptationRef.setValue(l),n(0))}var d=Cn(s,t);if(null===d)return e._videoChoiceMemory.set(a,null),o.adaptationRef.setValue(null),n(0);var c=Dn(d,e.trickModeTrackEnabled);return e._videoChoiceMemory.set(a,{baseAdaptation:d,adaptation:c}),o.adaptationRef.setValue(c),n(0)}n(r+1)}}}(0)},e}();function In(e){return function(t){var n;if(void 0!==e.normalized&&(null!==(n=t.normalizedLanguage)&&void 0!==n?n:"")!==e.normalized)return!1;if(void 0!==e.audioDescription)if(e.audioDescription){if(!0!==t.isAudioDescription)return!1}else if(!0===t.isAudioDescription)return!1;if(void 0===e.codec)return!0;var r=e.codec.test,i=function(e){return void 0!==e.codec&&r.test(e.codec)};return e.codec.all?t.representations.every(i):t.representations.some(i)}}function Zn(e,t){if(0===e.length)return null;for(var n=0;n0){if(null!=n){var l=(0,z.Z)(u,(function(e){return e.normalizedLanguage===n.normalizedLanguage}));if(void 0!==l)return l}return null!==(r=(0,z.Z)(u,(function(e){return void 0===e.normalizedLanguage})))&&void 0!==r?r:null}return null}function Mn(e){return function(t){if(void 0!==e.signInterpreted&&e.signInterpreted!==t.isSignInterpreted)return!1;if(void 0===e.codec)return!0;var n=e.codec.test,r=function(e){return void 0!==e.codec&&n.test(e.codec)};return e.codec.all?t.representations.every(r):t.representations.some(r)}}function Cn(e,t){if(0===e.length)return null;for(var n=0;n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Un(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);ng)throw new Error('Invalid maxVideoBitrate parameter. Its value, "'+g+'", is inferior to the set minVideoBitrate, "'+h+'"')}if((0,S.Z)(e.maxAudioBitrate))m=E.audio;else{if(m=Number(e.maxAudioBitrate),isNaN(m))throw new Error("Invalid maxAudioBitrate parameter. Should be a number.");if(p>m)throw new Error('Invalid maxAudioBitrate parameter. Its value, "'+m+'", is inferior to the set minAudioBitrate, "'+p+'"')}return{maxBufferAhead:t,maxBufferBehind:n,limitVideoWidth:C,videoElement:d,wantedBufferAhead:r,maxVideoBufferSize:i,throttleWhenHidden:a,throttleVideoBitrateWhenHidden:o,preferredAudioTracks:s,preferredTextTracks:u,preferredVideoTracks:l,initialAudioBitrate:v,initialVideoBitrate:f,minAudioBitrate:p,minVideoBitrate:h,maxAudioBitrate:m,maxVideoBitrate:g,stopAtEnd:(0,S.Z)(e.stopAtEnd)?Z:!!e.stopAtEnd}}(e),o=a.initialAudioBitrate,s=a.initialVideoBitrate,u=a.limitVideoWidth,d=a.minAudioBitrate,f=a.minVideoBitrate,v=a.maxAudioBitrate,p=a.maxBufferAhead,h=a.maxBufferBehind,m=a.maxVideoBitrate,g=a.preferredAudioTracks,y=a.preferredTextTracks,_=a.preferredVideoTracks,b=a.throttleWhenHidden,T=a.throttleVideoBitrateWhenHidden,E=a.videoElement,I=a.wantedBufferAhead,Z=a.maxVideoBufferSize,R=a.stopAtEnd,x=c.Z.getCurrent().DEFAULT_UNMUTED_VOLUME;E.preload="auto",t.version="3.31.0",t.log=l.Z,t.state="STOPPED",t.videoElement=E;var M=new w.ZP;t._destroyCanceller=M,t._priv_pictureInPictureRef=Vn(E,M.signal),Gn(E,(function(){t.trigger("fullscreenChange",t.isFullscreen())}),M.signal);for(var C=[],P=0;P<(null===(r=E.textTracks)||void 0===r?void 0:r.length);P++){var D=null===(i=E.textTracks)||void 0===i?void 0:i[P];(0,S.Z)(D)||C.push(D)}var N=function(e){for(var n=e.target,r=[],i=0;i0?e.textTracks[0]:null},i.getPlayerState=function(){return this.state},i.isContentLoaded=function(){return!(0,g.Z)(["LOADING","RELOADING","STOPPED"],this.state)},i.isBuffering=function(){return(0,g.Z)(["BUFFERING","SEEKING","LOADING","RELOADING"],this.state)},i.isPaused=function(){return!this.videoElement||((0,g.Z)(["LOADING","RELOADING"],this.state)?!this._priv_lastAutoPlay:this.videoElement.paused)},i.isLive=function(){if(null===this._priv_contentInfos)return!1;var e=this._priv_contentInfos,t=e.isDirectFile,n=e.manifest;return!t&&null!==n&&n.isLive},i.areTrickModeTracksEnabled=function(){return this._priv_preferTrickModeTracks},i.getUrl=function(){if(null!==this._priv_contentInfos){var e=this._priv_contentInfos,t=e.isDirectFile,n=e.manifest,r=e.originalUrl;return t?r:null!==n?n.getUrl():void 0}},i.updateContentUrls=function(e,t){if(null===this._priv_contentInfos)throw new Error("No content loaded");var n=!0===(null==t?void 0:t.refresh);this._priv_contentInfos.initializer.updateContentUrls(e,n)},i.getVideoDuration=function(){if(null===this.videoElement)throw new Error("Disposed player");return this.videoElement.duration},i.getVideoBufferGap=function(){if(null===this.videoElement)throw new Error("Disposed player");var e=this.videoElement;return(0,E.L7)(e.buffered,e.currentTime)},i.getVideoLoadedTime=function(){if((0,A.Z)("`getVideoLoadedTime` is deprecated and won't be present in the next major version"),null===this.videoElement)throw new Error("Disposed player");var e=this.videoElement;return(0,E.at)(e.buffered,e.currentTime)},i.getVideoPlayedTime=function(){if((0,A.Z)("`getVideoPlayedTime` is deprecated and won't be present in the next major version"),null===this.videoElement)throw new Error("Disposed player");var e=this.videoElement;return(0,E.DD)(e.buffered,e.currentTime)},i.getWallClockTime=function(){if(null===this.videoElement)throw new Error("Disposed player");if(null===this._priv_contentInfos)return this.videoElement.currentTime;var e=this._priv_contentInfos,t=e.isDirectFile,n=e.manifest;if(t){var r=a(this.videoElement);return(null!=r?r:0)+this.videoElement.currentTime}return null!==n?this.videoElement.currentTime+(void 0!==n.availabilityStartTime?n.availabilityStartTime:0):0},i.getPosition=function(){if(null===this.videoElement)throw new Error("Disposed player");return this.videoElement.currentTime},i.getLastStoredContentPosition=function(){return this._priv_reloadingMetadata.reloadPosition},i.getPlaybackRate=function(){return this._priv_speed.getValue()},i.setPlaybackRate=function(e,t){var n;e!==this._priv_speed.getValue()&&this._priv_speed.setValue(e);var r=null==t?void 0:t.preferTrickModeTracks;if("boolean"==typeof r){this._priv_preferTrickModeTracks=r;var i=null===(n=this._priv_contentInfos)||void 0===n?void 0:n.trackChoiceManager;(0,S.Z)(i)||(r&&!i.isTrickModeEnabled()?i.enableVideoTrickModeTracks():!r&&i.isTrickModeEnabled()&&i.disableVideoTrickModeTracks())}},i.getAvailableVideoBitrates=function(){if(null===this._priv_contentInfos)return[];var e=this._priv_contentInfos,t=e.currentPeriod,n=e.activeAdaptations;if(null===t||null===n)return[];var r=n[t.id];return void 0===r||(0,S.Z)(r.video)?[]:r.video.getAvailableBitrates()},i.getAvailableAudioBitrates=function(){if(null===this._priv_contentInfos)return[];var e=this._priv_contentInfos,t=e.currentPeriod,n=e.activeAdaptations;if(null===t||null===n)return[];var r=n[t.id];return void 0===r||(0,S.Z)(r.audio)?[]:r.audio.getAvailableBitrates()},i.getManualAudioBitrate=function(){return this._priv_bitrateInfos.manualBitrates.audio.getValue()},i.getManualVideoBitrate=function(){return this._priv_bitrateInfos.manualBitrates.video.getValue()},i.getVideoBitrate=function(){var e=this._priv_getCurrentRepresentations();if(null!==e&&!(0,S.Z)(e.video))return e.video.bitrate},i.getAudioBitrate=function(){var e=this._priv_getCurrentRepresentations();if(null!==e&&!(0,S.Z)(e.audio))return e.audio.bitrate},i.getMinVideoBitrate=function(){return this._priv_bitrateInfos.minAutoBitrates.video.getValue()},i.getMinAudioBitrate=function(){return this._priv_bitrateInfos.minAutoBitrates.audio.getValue()},i.getMaxVideoBitrate=function(){return this._priv_bitrateInfos.maxAutoBitrates.video.getValue()},i.getMaxAudioBitrate=function(){return this._priv_bitrateInfos.maxAutoBitrates.audio.getValue()},i.play=function(){var e=this;if(null===this.videoElement)throw new Error("Disposed player");var t=this.videoElement.play();return(0,S.Z)(t)||"function"!=typeof t.catch?Promise.resolve():t.catch((function(t){if("NotAllowedError"===t.name){var n=new v.Z("MEDIA_ERR_PLAY_NOT_ALLOWED",t.toString());e.trigger("warning",n)}throw t}))},i.pause=function(){if(null===this.videoElement)throw new Error("Disposed player");this.videoElement.pause()},i.seekTo=function(e){var t;if(null===this.videoElement)throw new Error("Disposed player");if(null===this._priv_contentInfos)throw new Error("player: no content loaded");var n,r=this._priv_contentInfos,i=r.isDirectFile,o=r.manifest;if(!i&&null===o)throw new Error("player: the content did not load yet");if("number"==typeof e)n=e;else if("object"==typeof e){var s=e,u=this.videoElement.currentTime;if((0,S.Z)(s.relative))if((0,S.Z)(s.position)){if((0,S.Z)(s.wallClockTime))throw new Error('invalid time object. You must set one of the following properties: "relative", "position" or "wallClockTime"');if(null!==o)n=s.wallClockTime-(null!==(t=o.availabilityStartTime)&&void 0!==t?t:0);else if(i&&null!==this.videoElement){var d=a(this.videoElement);void 0!==d&&(n=s.wallClockTime-d)}void 0===n&&(n=s.wallClockTime)}else n=s.position;else n=u+s.relative}if(void 0===n)throw new Error("invalid time given");return l.Z.info("API: API Seek to",n),this.videoElement.currentTime=n,n},i.isFullscreen=function(){return(0,A.Z)("isFullscreen is deprecated. Fullscreen management should now be managed by the application"),s()},i.setFullscreen=function(e){if(void 0===e&&(e=!0),(0,A.Z)("setFullscreen is deprecated. Fullscreen management should now be managed by the application"),null===this.videoElement)throw new Error("Disposed player");e?function(e){if(!s()){var t=e;"function"==typeof t.requestFullscreen?t.requestFullscreen():"function"==typeof t.msRequestFullscreen?t.msRequestFullscreen():"function"==typeof t.mozRequestFullScreen?t.mozRequestFullScreen():"function"==typeof t.webkitRequestFullscreen&&t.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT)}}(this.videoElement):o()},i.exitFullscreen=function(){(0,A.Z)("exitFullscreen is deprecated. Fullscreen management should now be managed by the application"),o()},i.getVolume=function(){if(null===this.videoElement)throw new Error("Disposed player");return this.videoElement.volume},i.setVolume=function(e){if(null===this.videoElement)throw new Error("Disposed player");var t=this.videoElement;e!==t.volume&&(t.volume=e,this.trigger("volumeChange",e))},i.isMute=function(){return 0===this.getVolume()},i.mute=function(){this._priv_mutedMemory=this.getVolume(),this.setVolume(0)},i.unMute=function(){var e=c.Z.getCurrent().DEFAULT_UNMUTED_VOLUME;0===this.getVolume()&&this.setVolume(0===this._priv_mutedMemory?e:this._priv_mutedMemory)},i.setVideoBitrate=function(e){this._priv_bitrateInfos.manualBitrates.video.setValue(e)},i.setAudioBitrate=function(e){this._priv_bitrateInfos.manualBitrates.audio.setValue(e)},i.setMinVideoBitrate=function(e){var t=this._priv_bitrateInfos.maxAutoBitrates.video.getValue();if(e>t)throw new Error('Invalid minimum video bitrate given. Its value, "'+e+'" is superior the current maximum video birate, "'+t+'".');this._priv_bitrateInfos.minAutoBitrates.video.setValue(e)},i.setMinAudioBitrate=function(e){var t=this._priv_bitrateInfos.maxAutoBitrates.audio.getValue();if(e>t)throw new Error('Invalid minimum audio bitrate given. Its value, "'+e+'" is superior the current maximum audio birate, "'+t+'".');this._priv_bitrateInfos.minAutoBitrates.audio.setValue(e)},i.setMaxVideoBitrate=function(e){var t=this._priv_bitrateInfos.minAutoBitrates.video.getValue();if(e0||c.result.removedAdaptations.length>0)){var f=u.getAvailableAudioTracks(s);r._priv_triggerEventIfNotStopped("availableAudioTracksChange",null!=f?f:[],i);var v=u.getAvailableTextTracks(s);r._priv_triggerEventIfNotStopped("availableTextTracksChange",null!=v?v:[],i);var p=u.getAvailableVideoTracks(s);r._priv_triggerEventIfNotStopped("availableVideoTracksChange",null!=p?p:[],i)}return}}),e.currentContentCanceller.signal)}},i._priv_onActivePeriodChanged=function(e,t){var n,r,i,a,o,s,u,l,d=t.period;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){e.currentPeriod=d;var c=e.currentContentCanceller.signal;this._priv_contentEventsMemory.periodChange!==d&&(this._priv_contentEventsMemory.periodChange=d,this._priv_triggerEventIfNotStopped("periodChange",d,c)),this._priv_triggerEventIfNotStopped("availableAudioTracksChange",this.getAvailableAudioTracks(),c),this._priv_triggerEventIfNotStopped("availableTextTracksChange",this.getAvailableTextTracks(),c),this._priv_triggerEventIfNotStopped("availableVideoTracksChange",this.getAvailableVideoTracks(),c);var f=null===(r=this._priv_contentInfos)||void 0===r?void 0:r.trackChoiceManager;if((0,S.Z)(f))this._priv_triggerEventIfNotStopped("audioTrackChange",null,c),this._priv_triggerEventIfNotStopped("textTrackChange",null,c),this._priv_triggerEventIfNotStopped("videoTrackChange",null,c);else{var v=f.getChosenAudioTrack(d);this._priv_triggerEventIfNotStopped("audioTrackChange",v,c);var p=f.getChosenTextTrack(d);this._priv_triggerEventIfNotStopped("textTrackChange",p,c);var h=f.getChosenVideoTrack(d);this._priv_triggerEventIfNotStopped("videoTrackChange",h,c)}if(this._priv_triggerAvailableBitratesChangeEvent("availableAudioBitratesChange",this.getAvailableAudioBitrates(),c),!e.currentContentCanceller.isUsed()&&(this._priv_triggerAvailableBitratesChangeEvent("availableVideoBitratesChange",this.getAvailableVideoBitrates(),c),!e.currentContentCanceller.isUsed())){var m=null!==(o=null===(a=null===(i=this._priv_getCurrentRepresentations())||void 0===i?void 0:i.audio)||void 0===a?void 0:a.bitrate)&&void 0!==o?o:-1;if(this._priv_triggerCurrentBitrateChangeEvent("audioBitrateChange",m,c),!e.currentContentCanceller.isUsed()){var g=null!==(l=null===(u=null===(s=this._priv_getCurrentRepresentations())||void 0===s?void 0:s.video)||void 0===u?void 0:u.bitrate)&&void 0!==l?l:-1;this._priv_triggerCurrentBitrateChangeEvent("videoBitrateChange",g,c)}}}},i._priv_onPeriodStreamReady=function(e,t){var n;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){var r=t.type,i=t.period,a=t.adaptationRef,o=e.trackChoiceManager;switch(r){case"video":(0,S.Z)(o)?(l.Z.error("API: TrackChoiceManager not instanciated for a new video period"),a.setValue(null)):(o.addPeriod(r,i,a),o.setInitialVideoTrack(i));break;case"audio":(0,S.Z)(o)?(l.Z.error("API: TrackChoiceManager not instanciated for a new "+r+" period"),a.setValue(null)):(o.addPeriod(r,i,a),o.setInitialAudioTrack(i));break;case"text":(0,S.Z)(o)?(l.Z.error("API: TrackChoiceManager not instanciated for a new "+r+" period"),a.setValue(null)):(o.addPeriod(r,i,a),o.setInitialTextTrack(i));break;default:var s=i.adaptations[r];!(0,S.Z)(s)&&s.length>0?a.setValue(s[0]):a.setValue(null)}}},i._priv_onPeriodStreamCleared=function(e,t){var n;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){var r=t.type,i=t.period,a=e.trackChoiceManager;switch(r){case"audio":case"text":case"video":(0,S.Z)(a)||a.removePeriod(r,i)}var o=e.activeAdaptations,s=e.activeRepresentations;if(!(0,S.Z)(o)&&!(0,S.Z)(o[i.id])){var u=o[i.id];delete u[r],0===Object.keys(u).length&&delete o[i.id]}if(!(0,S.Z)(s)&&!(0,S.Z)(s[i.id])){var l=s[i.id];delete l[r],0===Object.keys(l).length&&delete s[i.id]}}},i._priv_onAdaptationChange=function(e,t){var n,r=t.type,i=t.adaptation,a=t.period;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){null===e.activeAdaptations&&(e.activeAdaptations={});var o,s=e.activeAdaptations,u=e.currentPeriod,l=s[a.id];if((0,S.Z)(l))s[a.id]=((o={})[r]=i,o);else l[r]=i;var d=e.trackChoiceManager,c=e.currentContentCanceller.signal;if(null!==d&&null!==u&&!(0,S.Z)(a)&&a.id===u.id)switch(r){case"audio":var f=d.getChosenAudioTrack(u);this._priv_triggerEventIfNotStopped("audioTrackChange",f,c);var v=this.getAvailableAudioBitrates();this._priv_triggerAvailableBitratesChangeEvent("availableAudioBitratesChange",v,c);break;case"text":var p=d.getChosenTextTrack(u);this._priv_triggerEventIfNotStopped("textTrackChange",p,c);break;case"video":var h=d.getChosenVideoTrack(u);this._priv_triggerEventIfNotStopped("videoTrackChange",h,c);var m=this.getAvailableVideoBitrates();this._priv_triggerAvailableBitratesChangeEvent("availableVideoBitratesChange",m,c)}}},i._priv_onRepresentationChange=function(e,t){var n,r,i=t.type,a=t.period,o=t.representation;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){null===e.activeRepresentations&&(e.activeRepresentations={});var s,u=e.activeRepresentations,l=e.currentPeriod,d=u[a.id];if((0,S.Z)(d))u[a.id]=((s={})[i]=o,s);else d[i]=o;var c=null!==(r=null==o?void 0:o.bitrate)&&void 0!==r?r:-1;if(!(0,S.Z)(a)&&null!==l&&l.id===a.id){var f=this._priv_contentInfos.currentContentCanceller.signal;"video"===i?this._priv_triggerCurrentBitrateChangeEvent("videoBitrateChange",c,f):"audio"===i&&this._priv_triggerCurrentBitrateChangeEvent("audioBitrateChange",c,f)}}},i._priv_onBitrateEstimationChange=function(e){var t=e.type,n=e.bitrate;void 0!==n&&(this._priv_bitrateInfos.lastBitrates[t]=n),this.trigger("bitrateEstimationChange",{type:t,bitrate:n})},i._priv_onNativeTextTracksNext=function(e){this.trigger("nativeTextTracksChange",e)},i._priv_setPlayerState=function(e){this.state!==e&&(this.state=e,l.Z.info("API: playerStateChange event",e),this.trigger("playerStateChange",e))},i._priv_triggerPositionUpdate=function(e,t){var n,r;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){var i=e.isDirectFile,o=e.manifest;if((i||null!==o)&&!(0,S.Z)(t)){var s=null!==o?o.getMaximumSafePosition():void 0,u={position:t.position,duration:t.duration,playbackRate:t.playbackRate,maximumBufferTime:s,bufferGap:void 0!==t.bufferGap&&isFinite(t.bufferGap)?t.bufferGap:0};if(null!==o&&o.isLive&&t.position>0){var l=null!==(r=o.availabilityStartTime)&&void 0!==r?r:0;u.wallClockTime=t.position+l;var d=o.getLivePosition();void 0!==d&&(u.liveGap=d-t.position)}else if(i&&null!==this.videoElement){var c=a(this.videoElement);void 0!==c&&(u.wallClockTime=c+t.position)}this.trigger("positionUpdate",u)}}},i._priv_triggerAvailableBitratesChangeEvent=function(e,t,n){var r=this._priv_contentEventsMemory[e];n.isCancelled()||void 0!==r&&(0,m.Z)(t,r)||(this._priv_contentEventsMemory[e]=t,this.trigger(e,t))},i._priv_triggerCurrentBitrateChangeEvent=function(e,t,n){n.isCancelled()||t===this._priv_contentEventsMemory[e]||(this._priv_contentEventsMemory[e]=t,this.trigger(e,t))},i._priv_getCurrentRepresentations=function(){if(null===this._priv_contentInfos)return null;var e=this._priv_contentInfos,t=e.currentPeriod,n=e.activeRepresentations;return null===t||null===n||(0,S.Z)(n[t.id])?null:n[t.id]},i._priv_triggerEventIfNotStopped=function(e,t,n){n.isCancelled()||this.trigger(e,t)},i._priv_initializeMediaElementTrackChoiceManager=function(e,t,n){var r,i,a,o=this;(0,y.Z)(null!==h.Z.directfile,"Initializing `MediaElementTrackChoiceManager` without Directfile feature"),(0,y.Z)(null!==this.videoElement,"Initializing `MediaElementTrackChoiceManager` on a disposed RxPlayer");var s=new h.Z.directfile.mediaElementTrackChoiceManager(this.videoElement),u=void 0===e?this._priv_preferredAudioTracks:[e];s.setPreferredAudioTracks(u,!0);var l=void 0===t?this._priv_preferredTextTracks:[t];return s.setPreferredTextTracks(l,!0),s.setPreferredVideoTracks(this._priv_preferredVideoTracks,!0),this._priv_triggerEventIfNotStopped("availableAudioTracksChange",s.getAvailableAudioTracks(),n),this._priv_triggerEventIfNotStopped("availableVideoTracksChange",s.getAvailableVideoTracks(),n),this._priv_triggerEventIfNotStopped("availableTextTracksChange",s.getAvailableTextTracks(),n),this._priv_triggerEventIfNotStopped("audioTrackChange",null!==(r=s.getChosenAudioTrack())&&void 0!==r?r:null,n),this._priv_triggerEventIfNotStopped("textTrackChange",null!==(i=s.getChosenTextTrack())&&void 0!==i?i:null,n),this._priv_triggerEventIfNotStopped("videoTrackChange",null!==(a=s.getChosenVideoTrack())&&void 0!==a?a:null,n),s.addEventListener("availableVideoTracksChange",(function(e){return o.trigger("availableVideoTracksChange",e)})),s.addEventListener("availableAudioTracksChange",(function(e){return o.trigger("availableAudioTracksChange",e)})),s.addEventListener("availableTextTracksChange",(function(e){return o.trigger("availableTextTracksChange",e)})),s.addEventListener("audioTrackChange",(function(e){return o.trigger("audioTrackChange",e)})),s.addEventListener("videoTrackChange",(function(e){return o.trigger("videoTrackChange",e)})),s.addEventListener("textTrackChange",(function(e){return o.trigger("textTrackChange",e)})),s},(0,e.Z)(r,null,[{key:"ErrorTypes",get:function(){return p.ZB}},{key:"ErrorCodes",get:function(){return p.SM}},{key:"LogLevel",get:function(){return l.Z.getLevel()},set:function(e){l.Z.setLevel(e)}}]),r}(_.Z);jn.version="3.31.0";var qn=jn,Yn=n(7273);!function(){Yn.Z.decrypt=n(2206).ZP,Yn.Z.imageBuffer=n(7127).Z,Yn.Z.imageParser=n(3203).Z,Yn.Z.transports.smooth=n(2339).Z,Yn.Z.transports.dash=n(85).Z,Yn.Z.dashParsers.js=n(4541).Z,Yn.Z.nativeTextTracksBuffer=n(9059).Z,Yn.Z.nativeTextTracksParsers.vtt=n(9405).Z,Yn.Z.nativeTextTracksParsers.ttml=n(1570).Z,Yn.Z.nativeTextTracksParsers.sami=n(1812).Z,Yn.Z.nativeTextTracksParsers.srt=n(8057).Z,Yn.Z.htmlTextTracksBuffer=n(5192).Z,Yn.Z.htmlTextTracksParsers.sami=n(5734).Z,Yn.Z.htmlTextTracksParsers.ttml=n(7439).Z,Yn.Z.htmlTextTracksParsers.srt=n(8675).Z,Yn.Z.htmlTextTracksParsers.vtt=n(4099).Z;var e=n(9372).Z,t=n(6796).Z;Yn.Z.directfile={initDirectFile:e,mediaElementTrackChoiceManager:t}}(),"boolean"==typeof __RX_PLAYER_DEBUG_MODE__&&__RX_PLAYER_DEBUG_MODE__&&l.Z.setLevel("DEBUG");var Xn=qn}(),r=r.default}()})); \ No newline at end of file diff --git a/src/manifest/representation.ts b/src/manifest/representation.ts index 3976c03ea97..b8bfd1b271d 100644 --- a/src/manifest/representation.ts +++ b/src/manifest/representation.ts @@ -67,6 +67,9 @@ class Representation { */ public frameRate? : string; + /** `true` if audio has Dolby Atmos. */ + public isSpatialAudio? : boolean | undefined; + /** * A string describing the codec used for this Representation. * undefined if we do not know. @@ -121,6 +124,7 @@ class Representation { this.id = args.id; this.bitrate = args.bitrate; this.codec = args.codecs; + this.isSpatialAudio = args.isSpatialAudio; if (args.height !== undefined) { this.height = args.height; diff --git a/src/parsers/manifest/dash/common/parse_representations.ts b/src/parsers/manifest/dash/common/parse_representations.ts index 40ca70ca393..6edc15e749d 100644 --- a/src/parsers/manifest/dash/common/parse_representations.ts +++ b/src/parsers/manifest/dash/common/parse_representations.ts @@ -185,11 +185,16 @@ export default function parseRepresentations( [ { baseUrl: "", id: undefined } ] : representationBaseURLs.map(x => ({ baseUrl: x.url, id: x.serviceLocation })); + const isSpatialAudio = + !!(representation.children.supplementalProperties && + arrayFind(representation.children.supplementalProperties, r => r.value === "JOC")); + // Construct Representation Base const parsedRepresentation : IParsedRepresentation = { bitrate: representationBitrate, cdnMetadata, index: representationIndex, + isSpatialAudio, id: representationID }; // Add optional attributes diff --git a/src/parsers/manifest/dash/js-parser/node_parsers/Representation.ts b/src/parsers/manifest/dash/js-parser/node_parsers/Representation.ts index 2e642db0d21..2f74e985864 100644 --- a/src/parsers/manifest/dash/js-parser/node_parsers/Representation.ts +++ b/src/parsers/manifest/dash/js-parser/node_parsers/Representation.ts @@ -93,6 +93,13 @@ function parseRepresentationChildren( contentProtections.push(contentProtection); } break; + case "SupplementalProperty": + if (children.supplementalProperties == null) { + children.supplementalProperties = [parseScheme(currentElement)]; + } else { + children.supplementalProperties.push(parseScheme(currentElement)); + } + break; } } } diff --git a/src/parsers/manifest/dash/node_parser_types.ts b/src/parsers/manifest/dash/node_parser_types.ts index dec2ec3cb73..6e35c2eeb75 100644 --- a/src/parsers/manifest/dash/node_parser_types.ts +++ b/src/parsers/manifest/dash/node_parser_types.ts @@ -201,6 +201,7 @@ export interface IAdaptationSetChildren { segmentList? : ISegmentListIntermediateRepresentation | undefined; segmentTemplate? : ISegmentTemplateIntermediateRepresentation | undefined; label? : string | undefined; + isSpatialAudio? : boolean | undefined; } /* Intermediate representation for An AdaptationSet node's attributes. */ @@ -253,6 +254,7 @@ export interface IRepresentationChildren { segmentBase? : ISegmentBaseIntermediateRepresentation; segmentList? : ISegmentListIntermediateRepresentation; segmentTemplate? : ISegmentTemplateIntermediateRepresentation; + supplementalProperties? : IScheme[] | undefined; } /* Intermediate representation for A Representation node's attributes. */ diff --git a/src/parsers/manifest/local/parse_local_manifest.ts b/src/parsers/manifest/local/parse_local_manifest.ts index d2fdf3e76ab..488498741af 100644 --- a/src/parsers/manifest/local/parse_local_manifest.ts +++ b/src/parsers/manifest/local/parse_local_manifest.ts @@ -138,6 +138,7 @@ function parseRepresentation( height: representation.height, width: representation.width, codecs: representation.codecs, + isSpatialAudio: representation.isSpatialAudio, mimeType: representation.mimeType, index: new LocalRepresentationIndex(representation.index, id), contentProtections }; diff --git a/src/parsers/manifest/local/types.ts b/src/parsers/manifest/local/types.ts index c76ef4dbe45..61d326daf92 100644 --- a/src/parsers/manifest/local/types.ts +++ b/src/parsers/manifest/local/types.ts @@ -193,6 +193,8 @@ export interface ILocalRepresentation { height? : number; /** Interface allowing to retrieve media segments for this quality. */ index : ILocalIndex; + /** `true` if audio has Dolby Atmos. */ + isSpatialAudio : boolean; } /** A "track"" of a "local" Manifest. */ diff --git a/src/parsers/manifest/metaplaylist/metaplaylist_parser.ts b/src/parsers/manifest/metaplaylist/metaplaylist_parser.ts index ddc97266449..26894e14e83 100644 --- a/src/parsers/manifest/metaplaylist/metaplaylist_parser.ts +++ b/src/parsers/manifest/metaplaylist/metaplaylist_parser.ts @@ -221,6 +221,7 @@ function createManifest( mimeType: currentRepresentation.mimeType, frameRate: currentRepresentation.frameRate, codecs: currentRepresentation.codec, + isSpatialAudio: currentRepresentation.isSpatialAudio, contentProtections: currentRepresentation.contentProtections, }); } diff --git a/src/parsers/manifest/types.ts b/src/parsers/manifest/types.ts index 73332dd8bf2..28b8caa0f49 100644 --- a/src/parsers/manifest/types.ts +++ b/src/parsers/manifest/types.ts @@ -158,6 +158,8 @@ export interface IParsedRepresentation { * Information about the HDR characteristic of a content. */ hdrInfo?: IHDRInformation | undefined; + /** `true` if audio has Dolby Atmos. */ + isSpatialAudio?: boolean | undefined; } /** Every possible types an Adaptation can have. */ diff --git a/src/public_types.ts b/src/public_types.ts index c1cd6a919f1..60359211d42 100644 --- a/src/public_types.ts +++ b/src/public_types.ts @@ -759,6 +759,7 @@ export interface IBifObject { fileFormat : string; * RxPlayer. */ export interface IAudioRepresentation { id : string|number; + isSpatialAudio? : boolean | undefined; bitrate : number; codec? : string | undefined; } From a7a3fc52eb1c332c76d58dcacb6a73e0937fcdd1 Mon Sep 17 00:00:00 2001 From: klatoszewski-oke <62993073+klatoszewski-oke@users.noreply.github.com> Date: Fri, 8 Sep 2023 09:17:58 +0200 Subject: [PATCH 2/5] revert rx-player.min.js --- dist/rx-player.min.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/rx-player.min.js b/dist/rx-player.min.js index 7c489a5e561..a771ca4af7f 100644 --- a/dist/rx-player.min.js +++ b/dist/rx-player.min.js @@ -1,2 +1,2 @@ /*! For license information please see rx-player.min.js.LICENSE.txt */ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.RxPlayer=t():e.RxPlayer=t()}(self,(function(){return function(){var e={3774:function(e,t,n){"use strict";n.d(t,{J:function(){return a},c:function(){return o}});var r=n(1946),i=n(2203).Z?void 0:window,a=void 0===i?void 0:(0,r.Z)(i.MediaSource)?(0,r.Z)(i.MozMediaSource)?(0,r.Z)(i.WebKitMediaSource)?i.MSMediaSource:i.WebKitMediaSource:i.MozMediaSource:i.MediaSource,o={HAVE_NOTHING:0,HAVE_METADATA:1,HAVE_CURRENT_DATA:2,HAVE_FUTURE_DATA:3,HAVE_ENOUGH_DATA:4}},3666:function(e,t,n){"use strict";n.d(t,{$u:function(){return p},SB:function(){return c},YM:function(){return u},fq:function(){return s},kD:function(){return o},lV:function(){return m},l_:function(){return h},op:function(){return f},vS:function(){return d},vU:function(){return l},yS:function(){return v}});var r,i,a=n(2203),o=!1,s=!1,u=!1,l=!1,d=!1,c=!1,f=!1,v=!1,p=!1,h=!1,m=!1;a.Z||(void 0!==window.MSInputMethodContext&&void 0!==document.documentMode?(s=!0,u=!0):"Microsoft Internet Explorer"===navigator.appName||"Netscape"===navigator.appName&&/(Trident|Edge)\//.test(navigator.userAgent)?u=!0:-1!==navigator.userAgent.toLowerCase().indexOf("edg/")?o=!0:-1!==navigator.userAgent.toLowerCase().indexOf("firefox")?l=!0:"string"==typeof navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)?c=!0:(Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor")>=0||"[object SafariRemoteNotification]"===(null===(i=null===(r=window.safari)||void 0===r?void 0:r.pushNotification)||void 0===i?void 0:i.toString()))&&(d=!0),/SamsungBrowser/.test(navigator.userAgent)&&(f=!0),-1!==navigator.userAgent.indexOf("PlayStation 5")?m=!0:/Tizen/.test(navigator.userAgent)?v=!0:/[Ww]eb[O0]S/.test(navigator.userAgent)?(p=!0,/[Ww]eb[O0]S.TV-2022/.test(navigator.userAgent)||/[Cc]hr[o0]me\/87/.test(navigator.userAgent)||(/[Ww]eb[O0]S.TV-2021/.test(navigator.userAgent)||/[Cc]hr[o0]me\/79/.test(navigator.userAgent))):/[Pp]anasonic/.test(navigator.userAgent)&&(h=!0))},5767:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(3887),i=n(1946);function a(e){var t=e.textTracks;if(!(0,i.Z)(t)){for(var n=0;n=0;o--)if("track"===a[o].nodeName)try{e.removeChild(a[o])}catch(e){r.Z.warn("Compat: Could not remove text track child from element.")}}e.src="",e.removeAttribute("src")}},3038:function(e,t,n){"use strict";n.d(t,{Dl:function(){return R},M4:function(){return P},N8:function(){return k},O0:function(){return y},Q$:function(){return M},Q4:function(){return S},RV:function(){return I},S1:function(){return f},XR:function(){return p},bQ:function(){return C},it:function(){return g},k6:function(){return E},kJ:function(){return b},kk:function(){return Z},qo:function(){return x},u_:function(){return T},w0:function(){return m},x6:function(){return A},y4:function(){return w},zU:function(){return _}});var r=n(6872),i=n(6923),a=n(1946),o=n(8894),s=n(5095),u=n(2203),l=["","webkit","moz","ms"],d=u.Z||null==window.devicePixelRatio||0===window.devicePixelRatio?1:window.devicePixelRatio;function c(e,t){return t.filter((function(t){return function(e,t){var n=document.createElement(e.tagName),r="on"+t;return r in n||(n.setAttribute(r,"return;"),"function"==typeof n[r])}(e,t)}))[0]}function f(e,t){var n,r=function(e,t){return e.reduce((function(e,n){return e.concat((void 0===t?l:t).map((function(e){return e+n})))}),[])}(e,t);return function(e,t,a){if(!a.isCancelled()){if(e instanceof HTMLElement){if(void 0===n&&(n=c(e,r)),!(0,i.Z)(n))return void 0;e.addEventListener(n,t),a.register((function(){void 0!==n&&e.removeEventListener(n,t)}))}r.forEach((function(n){var r=!1;"function"==typeof e.addEventListener?e.addEventListener(n,t):(r=!0,e["on"+n]=t),a.register((function(){"function"==typeof e.removeEventListener&&e.removeEventListener(n,t),r&&delete e["on"+n]}))}))}}}function v(e){var t,n=document;null!=n.hidden?t="":null!=n.mozHidden?t="moz":null!=n.msHidden?t="ms":null!=n.webkitHidden&&(t="webkit");var r=(0,i.Z)(t)?t+"Hidden":"hidden",a=(0,i.Z)(t)?t+"visibilitychange":"visibilitychange",o=document[r],u=(0,s.ZP)(!o,e);return D(document,a,(function(){var e=!document[r];u.setValueIfChanged(e)}),e),u}function p(e){var t,n=v(e),i=(0,s.ZP)(!0,e);return e.register((function(){clearTimeout(t),t=void 0})),n.onUpdate((function(e){if(clearTimeout(t),t=void 0,!e){var n=r.Z.getCurrent().INACTIVITY_DELAY;t=window.setTimeout((function(){i.setValueIfChanged(!1)}),n)}i.setValueIfChanged(!0)}),{clearSignal:e,emitCurrentValue:!0}),i}function h(e,t){var n=t.width,r=t.height/(e.clientHeight/e.clientWidth);return Math.min(n,r)}function m(e,t){var n=e;if(!0===n.webkitSupportsPresentationMode&&"function"==typeof n.webkitSetPresentationMode){var r="picture-in-picture"===n.webkitPresentationMode,i=(0,s.ZP)({isEnabled:r,pipWindow:null},t);return D(n,"webkitpresentationmodechanged",(function(){var e="picture-in-picture"===n.webkitPresentationMode;i.setValue({isEnabled:e,pipWindow:null})}),t),i}var a=document.pictureInPictureElement===n,o=(0,s.ZP)({isEnabled:a,pipWindow:null},t);return D(n,"enterpictureinpicture",(function(e){var t;o.setValue({isEnabled:!0,pipWindow:null!==(t=e.pictureInPictureWindow)&&void 0!==t?t:null})}),t),D(n,"leavepictureinpicture",(function(){o.setValue({isEnabled:!1,pipWindow:null})}),t),o}function g(e,t){var n,i=v(t),a=(0,s.ZP)(!0,t);return t.register((function(){clearTimeout(n),n=void 0})),i.onUpdate(o,{clearSignal:t}),e.onUpdate(o,{clearSignal:t}),o(),a;function o(){if(clearTimeout(n),n=void 0,e.getValue().isEnabled||i.getValue())a.setValueIfChanged(!0);else{var t=r.Z.getCurrent().INACTIVITY_DELAY;n=window.setTimeout((function(){a.setValueIfChanged(!1)}),t)}}}function y(e,t,n){var r=(0,s.ZP)(e.clientWidth*d,n),i=o.Z;t.onUpdate(l,{clearSignal:n}),D(window,"resize",l,n);var u=window.setInterval(l,2e4);return l(),n.register((function(){i(),clearInterval(u)})),r;function l(){i();var n=t.getValue();if(n.isEnabled)if((0,a.Z)(n.pipWindow))r.setValueIfChanged(1/0);else{var s=n.pipWindow,u=h(e,s),l=function(){r.setValueIfChanged(h(e,s)*d)};s.addEventListener("resize",l),i=function(){s.removeEventListener("resize",l),i=o.Z},r.setValueIfChanged(u*d)}else r.setValueIfChanged(e.clientWidth*d)}}f(["loadedmetadata"]),f(["timeupdate"]);var _=f(["fullscreenchange","FullscreenChange"],l.concat("MS")),b=f(["addtrack"]),S=f(["removetrack"]),T=f(["sourceopen","webkitsourceopen"]),E=f(["sourceclose","webkitsourceclose"]),k=f(["sourceended","webkitsourceended"]),w=f(["update"]),A=f(["removesourcebuffer"]),I=f(["keymessage","message"]),Z=f(["keyadded","ready"]),R=f(["keyerror","error"]),x=f(["keystatuseschange"]),M=f(["seeking"]),C=f(["seeked"]),P=f(["ended"]);function D(e,t,n,r){e.addEventListener(t,n),r.register((function(){e.removeEventListener(t,n)}))}},2203:function(e,t){"use strict";var n="undefined"==typeof window;t.Z=n},1988:function(e,t,n){"use strict";function r(e){return"function"==typeof window.VTTCue&&e instanceof window.VTTCue}n.d(t,{Z:function(){return r}})},7253:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(3887),i=n(1946);function a(e,t,n){if(e>=t)return r.Z.warn("Compat: Invalid cue times: "+e+" - "+t),null;if((0,i.Z)(window.VTTCue)){if((0,i.Z)(window.TextTrackCue))throw new Error("VTT cues not supported in your target");return new TextTrackCue(e,t,n)}return new VTTCue(e,t,n)}},1669:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(3666);function i(){return r.op}},6872:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r={DEFAULT_UNMUTED_VOLUME:.1,DEFAULT_REQUEST_TIMEOUT:3e4,DEFAULT_TEXT_TRACK_MODE:"native",DEFAULT_MANUAL_BITRATE_SWITCHING_MODE:"seamless",DEFAULT_ENABLE_FAST_SWITCHING:!0,DEFAULT_AUDIO_TRACK_SWITCHING_MODE:"seamless",DELTA_POSITION_AFTER_RELOAD:{bitrateSwitch:-.1,trackSwitch:{audio:-.7,video:-.1,other:0}},DEFAULT_CODEC_SWITCHING_BEHAVIOR:"continue",DEFAULT_AUTO_PLAY:!1,DEFAULT_SHOW_NATIVE_SUBTITLE:!0,DEFAULT_STOP_AT_END:!0,DEFAULT_WANTED_BUFFER_AHEAD:30,DEFAULT_MAX_BUFFER_AHEAD:1/0,DEFAULT_MAX_BUFFER_BEHIND:1/0,DEFAULT_MAX_VIDEO_BUFFER_SIZE:1/0,MAXIMUM_MAX_BUFFER_AHEAD:{text:18e3},MAXIMUM_MAX_BUFFER_BEHIND:{text:18e3},DEFAULT_INITIAL_BITRATES:{audio:0,video:0,other:0},DEFAULT_MIN_BITRATES:{audio:0,video:0,other:0},DEFAULT_MAX_BITRATES:{audio:1/0,video:1/0,other:1/0},INACTIVITY_DELAY:6e4,DEFAULT_THROTTLE_WHEN_HIDDEN:!1,DEFAULT_THROTTLE_VIDEO_BITRATE_WHEN_HIDDEN:!1,DEFAULT_LIMIT_VIDEO_WIDTH:!1,DEFAULT_LIVE_GAP:{DEFAULT:10,LOW_LATENCY:3.5},BUFFER_DISCONTINUITY_THRESHOLD:.2,FORCE_DISCONTINUITY_SEEK_DELAY:5e3,BITRATE_REBUFFERING_RATIO:1.5,BUFFER_GC_GAPS:{CALM:240,BEEFY:30},DEFAULT_MAX_MANIFEST_REQUEST_RETRY:4,DEFAULT_CDN_DOWNGRADE_TIME:60,DEFAULT_MAX_REQUESTS_RETRY_ON_ERROR:4,DEFAULT_MAX_REQUESTS_RETRY_ON_OFFLINE:1/0,INITIAL_BACKOFF_DELAY_BASE:{REGULAR:200,LOW_LATENCY:50},MAX_BACKOFF_DELAY_BASE:{REGULAR:3e3,LOW_LATENCY:1e3},SAMPLING_INTERVAL_MEDIASOURCE:1e3,SAMPLING_INTERVAL_LOW_LATENCY:250,SAMPLING_INTERVAL_NO_MEDIASOURCE:500,ABR_ENTER_BUFFER_BASED_ALGO:10,ABR_EXIT_BUFFER_BASED_ALGO:5,ABR_MINIMUM_TOTAL_BYTES:15e4,ABR_MINIMUM_CHUNK_SIZE:16e3,ABR_STARVATION_FACTOR:{DEFAULT:.72,LOW_LATENCY:.72},ABR_REGULAR_FACTOR:{DEFAULT:.72,LOW_LATENCY:.72},ABR_STARVATION_GAP:{DEFAULT:5,LOW_LATENCY:5},OUT_OF_STARVATION_GAP:{DEFAULT:7,LOW_LATENCY:7},ABR_STARVATION_DURATION_DELTA:.1,ABR_FAST_EMA:2,ABR_SLOW_EMA:10,RESUME_GAP_AFTER_SEEKING:{DEFAULT:1.5,LOW_LATENCY:.5},RESUME_GAP_AFTER_NOT_ENOUGH_DATA:{DEFAULT:.5,LOW_LATENCY:.5},RESUME_GAP_AFTER_BUFFERING:{DEFAULT:5,LOW_LATENCY:.5},REBUFFERING_GAP:{DEFAULT:.5,LOW_LATENCY:.2},MINIMUM_BUFFER_AMOUNT_BEFORE_FREEZING:2,UNFREEZING_SEEK_DELAY:6e3,FREEZING_STALLED_DELAY:600,UNFREEZING_DELTA_POSITION:.001,MAX_TIME_MISSING_FROM_COMPLETE_SEGMENT:.15,MAX_MANIFEST_BUFFERED_START_END_DIFFERENCE:.4,MAX_MANIFEST_BUFFERED_DURATION_DIFFERENCE:.3,MINIMUM_SEGMENT_SIZE:.005,APPEND_WINDOW_SECURITIES:{START:.2,END:.1},MAXIMUM_HTML_TEXT_TRACK_UPDATE_INTERVAL:50,TEXT_TRACK_SIZE_CHECKS_INTERVAL:250,BUFFER_PADDING:{audio:1,video:3,other:1},SEGMENT_PRIORITIES_STEPS:[2,4,8,12,18,25],MAX_HIGH_PRIORITY_LEVEL:1,MIN_CANCELABLE_PRIORITY:3,EME_DEFAULT_VIDEO_CODECS:['video/mp4;codecs="avc1.4d401e"','video/mp4;codecs="avc1.42e01e"','video/webm;codecs="vp8"'],EME_DEFAULT_AUDIO_CODECS:['audio/mp4;codecs="mp4a.40.2"',"audio/webm;codecs=opus"],EME_DEFAULT_WIDEVINE_ROBUSTNESSES:["HW_SECURE_ALL","HW_SECURE_DECODE","HW_SECURE_CRYPTO","SW_SECURE_DECODE","SW_SECURE_CRYPTO"],EME_DEFAULT_PLAYREADY_ROBUSTNESSES:["3000","2000"],EME_KEY_SYSTEMS:{clearkey:["webkit-org.w3.clearkey","org.w3.clearkey"],widevine:["com.widevine.alpha"],playready:["com.microsoft.playready.recommendation","com.microsoft.playready","com.chromecast.playready","com.youtube.playready"],fairplay:["com.apple.fps.1_0"]},MAX_CONSECUTIVE_MANIFEST_PARSING_IN_UNSAFE_MODE:10,MIN_MANIFEST_PARSING_TIME_TO_ENTER_UNSAFE_MODE:200,MIN_DASH_S_ELEMENTS_TO_PARSE_UNSAFELY:300,OUT_OF_SYNC_MANIFEST_REFRESH_DELAY:3e3,FAILED_PARTIAL_UPDATE_MANIFEST_REFRESH_DELAY:3e3,DASH_FALLBACK_LIFETIME_WHEN_MINIMUM_UPDATE_PERIOD_EQUAL_0:3,EME_DEFAULT_MAX_SIMULTANEOUS_MEDIA_KEY_SESSIONS:15,EME_MAX_STORED_PERSISTENT_SESSION_INFORMATION:1e3,EME_WAITING_DELAY_LOADED_SESSION_EMPTY_KEYSTATUSES:100,FORCED_ENDED_THRESHOLD:8e-4,ADAPTATION_SWITCH_BUFFER_PADDINGS:{video:{before:5,after:5},audio:{before:2,after:2.5},text:{before:0,after:0},image:{before:0,after:0}},SOURCE_BUFFER_FLUSHING_INTERVAL:500,CONTENT_REPLACEMENT_PADDING:1.2,CACHE_LOAD_DURATION_THRESHOLDS:{video:50,audio:10},STREAM_EVENT_EMITTER_POLL_INTERVAL:250,DEFAULT_MAXIMUM_TIME_ROUNDING_ERROR:.001,BUFFERED_HISTORY_RETENTION_TIME:6e4,BUFFERED_HISTORY_MAXIMUM_ENTRIES:200,MIN_BUFFER_AHEAD:5,UPTO_CURRENT_POSITION_CLEANUP:5},i=n(8026);function a(e){return null!=e&&!Array.isArray(e)&&"object"==typeof e}function o(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r=e.length||(e[t].enabled=!0)}(this._audioTracks.map((function(e){return e.nativeTrack})),e)},t}(a.Z);function f(e){for(var t=0;t=0){var i=e instanceof ArrayBuffer?new Uint8Array(e):e,a=JSON.parse((0,Z.uR)(i)),o=(0,A.K)(a.keys[0].k),s=(0,A.K)(a.keys[0].kid);n(t._vid.webkitAddKey(t._key,o,s,""))}else n(t._vid.webkitAddKey(t._key,e,null,""))}catch(e){r(e)}}))},n.generateRequest=function(e,t){var n=this;return new Promise((function(e){n._vid.webkitGenerateKeyRequest(n._key,t),e()}))},n.close=function(){var e=this;return new Promise((function(t){e._closeSession(),t()}))},n.load=function(){return Promise.resolve(!1)},n.remove=function(){return Promise.resolve()},t}(_.Z),M=function(){function e(e){this._keySystem=e}var t=e.prototype;return t._setVideo=function(e){var t=this;return S((function(){if(!R(e))throw new Error("Video not attached to the MediaKeys");t._videoElement=e}))},t.createSession=function(){if(null==this._videoElement)throw new Error("Video not attached to the MediaKeys");return new x(this._videoElement,this._keySystem)},t.setServerCertificate=function(){throw new Error("Server certificate is not implemented in your browser")},e}();var C=n(9252),P=n(6968);function D(e,t){var n=e;return S((function(){if(void 0===n.webkitSetMediaKeys)throw new Error("No webKitMediaKeys API.");n.webkitSetMediaKeys(t)}))}var N=function(e){function t(t,n,r){var i;return(i=e.call(this)||this)._serverCertificate=r,i._videoElement=t,i._keyType=n,i._unbindSession=I.Z,i._closeSession=I.Z,i.closed=new Promise((function(e){i._closeSession=e})),i.keyStatuses=new Map,i.expiration=NaN,i}(0,a.Z)(t,e);var n=t.prototype;return n.update=function(e){var t=this;return new Promise((function(n,r){if(void 0===t._nativeSession||void 0===t._nativeSession.update||"function"!=typeof t._nativeSession.update)return r("Unavailable WebKit key session.");try{var i;i=e instanceof ArrayBuffer?new Uint8Array(e):e instanceof Uint8Array?e:new Uint8Array(e.buffer),n(t._nativeSession.update(i))}catch(e){r(e)}}))},n.generateRequest=function(e,t){var n=this;return new Promise((function(e){var r,i,a,o=n._videoElement;if(void 0===(null===(r=o.webkitKeys)||void 0===r?void 0:r.createSession))throw new Error("No WebKitMediaKeys API.");if(a=n._keyType,(0,C.Z)(a,"com.apple.fps")){if(void 0===n._serverCertificate)throw new Error("A server certificate is needed for creating fairplay session.");i=function(e,t){var n=e instanceof Uint8Array?e:new Uint8Array(e),r=t instanceof Uint8Array?t:new Uint8Array(t);if((0,P.dN)(n,0)+4!==n.length)throw new Error("Unsupported WebKit initData.");var i=(0,Z.wV)(n),a=i.indexOf("skd://"),o=a>-1?i.substring(a+6):i,s=(0,Z.TZ)(o),u=0,l=new Uint8Array(n.byteLength+4+s.byteLength+4+r.byteLength);return l.set(n),u+=n.length,l.set((0,P.O_)(s.byteLength),u),u+=4,l.set(s,u),u+=s.byteLength,l.set((0,P.O_)(r.byteLength),u),u+=4,l.set(r,u),l}(t,n._serverCertificate)}else i=t;var s=o.webkitKeys.createSession("video/mp4",i);if(null==s)throw new Error("Impossible to get the key sessions");n._listenEvent(s),n._nativeSession=s,e()}))},n.close=function(){var e=this;return new Promise((function(t,n){e._unbindSession(),e._closeSession(),void 0!==e._nativeSession?(e._nativeSession.close(),t()):n("No session to close.")}))},n.load=function(){return Promise.resolve(!1)},n.remove=function(){return Promise.resolve()},n._listenEvent=function(e){var t=this;this._unbindSession();var n=function(e){t.trigger(e.type,e)};["keymessage","message","keyadded","ready","keyerror","error"].forEach((function(t){e.addEventListener(t,n),e.addEventListener("webkit"+t,n)})),this._unbindSession=function(){["keymessage","message","keyadded","ready","keyerror","error"].forEach((function(t){e.removeEventListener(t,n),e.removeEventListener("webkit"+t,n)}))}},(0,m.Z)(t,[{key:"sessionId",get:function(){var e,t;return null!==(t=null===(e=this._nativeSession)||void 0===e?void 0:e.sessionId)&&void 0!==t?t:""}}]),t}(_.Z),O=function(){function e(e){if(void 0===r)throw new Error("No WebKitMediaKeys API.");this._keyType=e,this._mediaKeys=new r(e)}var t=e.prototype;return t._setVideo=function(e){if(this._videoElement=e,void 0===this._videoElement)throw new Error("Video not attached to the MediaKeys");return D(this._videoElement,this._mediaKeys)},t.createSession=function(){if(void 0===this._videoElement||void 0===this._mediaKeys)throw new Error("Video not attached to the MediaKeys");return new N(this._videoElement,this._keyType,this._serverCertificate)},t.setServerCertificate=function(e){return this._serverCertificate=e,Promise.resolve()},e}();function L(){if(void 0===r)throw new Error("No WebKitMediaKeys API.");return{isTypeSupported:r.isTypeSupported,createCustomMediaKeys:function(e){return new O(e)},setMediaKeys:function(e,t){if(null===t)return D(e,t);if(!(t instanceof O))throw new Error("Custom setMediaKeys is supposed to be called with webkit custom MediaKeys.");return t._setVideo(e)}}}var U=function(e){var t,n,i,a=B;if("standard"!==e&&("auto"!==e||(c.vS||c.SB)&&void 0!==r)||!v.Z&&(0,d.Z)(navigator.requestMediaKeySystemAccess)){var o,s;if("webkit"===e&&void 0!==r){n=(0,f.S1)(["needkey"]);var p=L();o=p.isTypeSupported,s=p.createCustomMediaKeys,a=p.setMediaKeys,i="webkit"}else if(R(HTMLVideoElement.prototype)){n=(0,f.S1)(["needkey"]);var m={isTypeSupported:function(e){var t=document.querySelector("video");return null==t&&(t=document.createElement("video")),null!=t&&"function"==typeof t.canPlayType&&!!t.canPlayType("video/mp4",e)},createCustomMediaKeys:function(e){return new M(e)},setMediaKeys:function(e,t){if(null===t)return Promise.resolve(void 0);if(!(t instanceof M))throw new Error("Custom setMediaKeys is supposed to be called with old webkit custom MediaKeys.");return t._setVideo(e)}};o=m.isTypeSupported,s=m.createCustomMediaKeys,a=m.setMediaKeys,i="older-webkit"}else if(void 0!==r){n=(0,f.S1)(["needkey"]);var y=L();o=y.isTypeSupported,s=y.createCustomMediaKeys,a=y.setMediaKeys,i="webkit"}else if(c.fq&&void 0!==h){n=(0,f.S1)(["encrypted","needkey"]);var _={isTypeSupported:function(e,t){if(void 0===h)throw new Error("No MSMediaKeys API.");return void 0!==t?h.isTypeSupported(e,t):h.isTypeSupported(e)},createCustomMediaKeys:function(e){return new k(e)},setMediaKeys:function(e,t){if(null===t)return Promise.resolve(void 0);if(!(t instanceof k))throw new Error("Custom setMediaKeys is supposed to be called with IE11 custom MediaKeys.");return t._setVideo(e)}};o=_.isTypeSupported,s=_.createCustomMediaKeys,a=_.setMediaKeys,i="ms"}else if(void 0!==T){n=(0,f.S1)(["encrypted","needkey"]);var b={isTypeSupported:function(e,t){if(void 0===T)throw new Error("No MozMediaKeys API.");return void 0!==t?T.isTypeSupported(e,t):T.isTypeSupported(e)},createCustomMediaKeys:function(e){if(void 0===T)throw new Error("No MozMediaKeys API.");return new T(e)},setMediaKeys:function(e,t){return S((function(){var n=e;if(void 0===n.mozSetMediaKeys||"function"!=typeof n.mozSetMediaKeys)throw new Error("Can't set video on MozMediaKeys.");return n.mozSetMediaKeys(t)}))}};o=b.isTypeSupported,s=b.createCustomMediaKeys,a=b.setMediaKeys,i="moz"}else{n=(0,f.S1)(["encrypted","needkey"]);var E=window.MediaKeys,w=function(){if(void 0===E)throw new u.Z("MEDIA_KEYS_NOT_SUPPORTED","No `MediaKeys` implementation found in the current browser.");if(void 0===E.isTypeSupported){throw new Error("This browser seems to be unable to play encrypted contents currently.Note: Some browsers do not allow decryption in some situations, like when not using HTTPS.")}};o=function(e){return w(),(0,l.Z)("function"==typeof E.isTypeSupported),E.isTypeSupported(e)},s=function(e){return w(),new E(e)},i="unknown"}t=function(e,t){if(!o(e))return Promise.reject(new Error("Unsupported key type"));for(var n=0;ne.length)return V.Z.warn("Compat: Unrecognized initialization data. Use as is."),[{systemId:void 0,data:e}];var i=e.subarray(n,n+r),a={systemId:(0,z.Y)(i,8),data:i};W(t,a)?V.Z.warn("Compat: Duplicated PSSH found in initialization data, removing it."):t.push(a),n+=r}return n!==e.length?(V.Z.warn("Compat: Unrecognized initialization data. Use as is."),[{systemId:void 0,data:e}]):t}(new Uint8Array(t));return{type:n,values:r}}var j=n(6872),q=n(5157),Y=n(5389),X=n(3274),Q=n(7714),$=n(770);function J(e){$.Z.setState(e,null),F.setMediaKeys(e,null).then((function(){V.Z.info("DRM: MediaKeys disabled with success")})).catch((function(e){V.Z.error("DRM: Could not disable MediaKeys",e instanceof Error?e:"Unknown Error")}))}function ee(){return(ee=(0,i.Z)(s().mark((function e(t,n,r){var i,a,o,u,l,d,c;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=n.emeImplementation,a=n.keySystemOptions,o=n.loadedSessionsStore,u=n.mediaKeySystemAccess,l=n.mediaKeys,d=$.Z.getState(t),c=null!==d&&d.loadedSessionsStore!==o?d.loadedSessionsStore.closeAllSessions():Promise.resolve(),e.next=5,c;case 5:if(!r.isCancelled()){e.next=7;break}throw r.cancellationError;case 7:if($.Z.setState(t,{emeImplementation:i,keySystemOptions:a,mediaKeySystemAccess:u,mediaKeys:l,loadedSessionsStore:o}),t.mediaKeys!==l){e.next=10;break}return e.abrupt("return");case 10:V.Z.info("DRM: Attaching MediaKeys to the media element"),i.setMediaKeys(t,l).then((function(){V.Z.info("DRM: MediaKeys attached with success")})).catch((function(e){V.Z.error("DRM: Could not set MediaKeys",e instanceof Error?e:"Unknown Error")}));case 12:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function te(e){if(""===e.sessionId)return!1;var t=e.keyStatuses,n=[];return t.forEach((function(e){n.push(e)})),n.length<=0?(V.Z.debug("DRM: isSessionUsable: MediaKeySession given has an empty keyStatuses",e.sessionId),!1):(0,Q.Z)(n,"expired")?(V.Z.debug("DRM: isSessionUsable: MediaKeySession given has an expired key",e.sessionId),!1):(0,Q.Z)(n,"internal-error")?(V.Z.debug("DRM: isSessionUsable: MediaKeySession given has a key with an internal-error",e.sessionId),!1):(V.Z.debug("DRM: isSessionUsable: MediaKeySession is usable",e.sessionId),!0)}function ne(e,t,n,r){var i=e.loadedSessionsStore,a=e.persistentSessionsStore;return"temporary"===n?re(i,t):null===a?(V.Z.warn("DRM: Cannot create persistent MediaKeySession, PersistentSessionsStore not created."),re(i,t)):function(e,t,n,r){return ie.apply(this,arguments)}(i,a,t,r)}function re(e,t){V.Z.info("DRM: Creating a new temporary session");var n=e.createSession(t,"temporary");return Promise.resolve({type:"created-session",value:n})}function ie(){return ie=(0,i.Z)(s().mark((function e(t,n,r,a){var o,u,l,d,c,f;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(f=function(){return f=(0,i.Z)(s().mark((function e(){var i,u;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===a.cancellationError){e.next=2;break}throw a.cancellationError;case 2:return V.Z.info("DRM: Removing previous persistent session."),null!==(i=n.get(r))&&n.delete(i.sessionId),e.prev=5,e.next=8,t.closeSession(o.mediaKeySession);case 8:e.next=15;break;case 10:if(e.prev=10,e.t0=e.catch(5),""===o.mediaKeySession.sessionId){e.next=14;break}throw e.t0;case 14:t.removeSessionWithoutClosingIt(o.mediaKeySession);case 15:if(null===a.cancellationError){e.next=17;break}throw a.cancellationError;case 17:return u=t.createSession(r,"persistent-license"),e.abrupt("return",{type:"created-session",value:u});case 19:case"end":return e.stop()}}),e,null,[[5,10]])}))),f.apply(this,arguments)},c=function(){return f.apply(this,arguments)},null===a.cancellationError){e.next=4;break}throw a.cancellationError;case 4:if(V.Z.info("DRM: Creating persistent MediaKeySession"),o=t.createSession(r,"persistent-license"),null!==(u=n.getAndReuse(r))){e.next=9;break}return e.abrupt("return",{type:"created-session",value:o});case 9:return e.prev=9,e.next=12,t.loadPersistentSession(o.mediaKeySession,u.sessionId);case 12:if(l=e.sent){e.next=19;break}return V.Z.warn("DRM: No data stored for the loaded session"),n.delete(u.sessionId),t.removeSessionWithoutClosingIt(o.mediaKeySession),d=t.createSession(r,"persistent-license"),e.abrupt("return",{type:"created-session",value:d});case 19:if(!l||!te(o.mediaKeySession)){e.next=23;break}return n.add(r,r.keyIds,o.mediaKeySession),V.Z.info("DRM: Succeeded to load persistent session."),e.abrupt("return",{type:"loaded-persistent-session",value:o});case 23:return V.Z.warn("DRM: Previous persistent session not usable anymore."),e.abrupt("return",c());case 27:return e.prev=27,e.t0=e.catch(9),V.Z.warn("DRM: Unable to load persistent session: "+(e.t0 instanceof Error?e.t0.toString():"Unknown Error")),e.abrupt("return",c());case 31:case"end":return e.stop()}}),e,null,[[9,27]])}))),ie.apply(this,arguments)}function ae(e,t){return oe.apply(this,arguments)}function oe(){return(oe=(0,i.Z)(s().mark((function e(t,n){var r,i,a,o,u;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n<0||n>=t.getLength())){e.next=2;break}return e.abrupt("return");case 2:for(V.Z.info("DRM: LSS cache limit exceeded",n,t.getLength()),r=[],i=t.getAll().slice(),a=i.length-n,o=0;o=o.length)){e.next=2;break}throw new q.Z("INCOMPATIBLE_KEYSYSTEMS","No key system compatible with your wanted configuration has been found in the current browser.");case 2:if(null!=F.requestMediaKeySystemAccess){e.next=4;break}throw new Error("requestMediaKeySystemAccess is not implemented in your browser.");case 4:return r=o[t],i=r.keyName,a=r.keyType,l=r.keySystemOptions,d=ce(i,a,l),V.Z.debug("DRM: Request keysystem access "+a+","+(t+1)+" of "+o.length),e.prev=7,e.next=10,F.requestMediaKeySystemAccess(a,d);case 10:return c=e.sent,V.Z.info("DRM: Found compatible keysystem",a,t+1),e.abrupt("return",{type:"create-media-key-system-access",value:{options:l,mediaKeySystemAccess:c}});case 15:if(e.prev=15,e.t0=e.catch(7),V.Z.debug("DRM: Rejected access to keysystem",a,t+1),null===n.cancellationError){e.next=20;break}throw n.cancellationError;case 20:return e.abrupt("return",u(t+1));case 21:case"end":return e.stop()}}),e,null,[[7,15]])})))).apply(this,arguments)}}var ve=n(2297);function pe(e,t,n){var r;V.Z.debug("Compat: Calling generateRequest on the MediaKeySession");try{r=function(e){V.Z.info("Compat: Trying to move CENC PSSH from init data at the end of it.");for(var t=!1,n=new Uint8Array,r=new Uint8Array,i=0;ie.length)throw V.Z.warn("Compat: unrecognized initialization data. Cannot patch it."),new Error("Compat: unrecognized initialization data. Cannot patch it.");var o=e.subarray(i,i+a);if(16===e[i+12]&&119===e[i+13]&&239===e[i+14]&&236===e[i+15]&&192===e[i+16]&&178===e[i+17]&&77===e[i+18]&&2===e[i+19]&&172===e[i+20]&&227===e[i+21]&&60===e[i+22]&&30===e[i+23]&&82===e[i+24]&&226===e[i+25]&&251===e[i+26]&&75===e[i+27]){var s=(0,ve.Xj)(o),u=null===s?void 0:o[s[1]];V.Z.info("Compat: CENC PSSH found with version",u),void 0===u?V.Z.warn("Compat: could not read version of CENC PSSH"):t===(1===u)?n=(0,P.zo)(n,o):1===u?(V.Z.warn("Compat: cenc version 1 encountered, removing every other cenc pssh box."),n=o,t=!0):V.Z.warn("Compat: filtering out cenc pssh box with wrong version",u)}else r=(0,P.zo)(r,o);i+=a}if(i!==e.length)throw V.Z.warn("Compat: unrecognized initialization data. Cannot patch it."),new Error("Compat: unrecognized initialization data. Cannot patch it.");return(0,P.zo)(r,n)}(n)}catch(e){r=n}var i=null!=t?t:"";return e.generateRequest(i,r).catch((function(t){if(""!==i||!(t instanceof TypeError))throw t;return V.Z.warn('Compat: error while calling `generateRequest` with an empty initialization data type. Retrying with a default "cenc" value.',t),e.generateRequest("cenc",r)}))}var he=100;function me(e,t){return ge.apply(this,arguments)}function ge(){return(ge=(0,i.Z)(s().mark((function e(t,n){var r;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return V.Z.info("DRM: Load persisted session",n),e.next=3,t.load(n);case 3:if((r=e.sent)&&!(t.keyStatuses.size>0)){e.next=6;break}return e.abrupt("return",r);case 6:return e.abrupt("return",new Promise((function(e){t.addEventListener("keystatuseschange",i);var n=setTimeout(i,he);function i(){clearTimeout(n),t.removeEventListener("keystatuseschange",i),e(r)}})));case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var ye=n(7864);function _e(e){var t=new b.ZP;return Promise.race([e.close().then((function(){t.cancel()})),e.closed.then((function(){t.cancel()})),function(){return n.apply(this,arguments)}()]);function n(){return(n=(0,i.Z)(s().mark((function e(){var n;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,(0,ye.Z)(1e3,t.signal);case 3:return e.next=5,r();case 5:e.next=13;break;case 7:if(e.prev=7,e.t0=e.catch(0),!(e.t0 instanceof b.FU)){e.next=11;break}return e.abrupt("return");case 11:n=e.t0 instanceof Error?e.t0.message:"Unknown error made it impossible to close the session",V.Z.error("DRM: "+n);case 13:case"end":return e.stop()}}),e,null,[[0,7]])})))).apply(this,arguments)}function r(){return a.apply(this,arguments)}function a(){return(a=(0,i.Z)(s().mark((function n(){return s().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,n.next=3,e.update(new Uint8Array(1));case 3:n.next=13;break;case 5:if(n.prev=5,n.t0=n.catch(0),!t.isUsed()){n.next=9;break}return n.abrupt("return");case 9:if(!(n.t0 instanceof Error&&"The session is already closed."===n.t0.message)){n.next=11;break}return n.abrupt("return");case 11:return n.next=13,(0,ye.Z)(1e3,t.signal);case 13:if(!t.isUsed()){n.next=15;break}return n.abrupt("return");case 15:throw new Error("Compat: Couldn't know if session is closed");case 16:case"end":return n.stop()}}),n,null,[[0,5]])})))).apply(this,arguments)}}function be(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Se(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Se(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Se(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Ae(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0){if(null!==this._keyIds&&ke(t,this._keyIds))return!0;if(void 0!==this._initializationData.keyIds)return ke(t,this._initializationData.keyIds)}return this._checkInitializationDataCompatibility(e)},t._checkInitializationDataCompatibility=function(e){return void 0!==e.keyIds&&e.keyIds.length>0&&void 0!==this._initializationData.keyIds?ke(e.keyIds,this._initializationData.keyIds):this._initializationData.type===e.type&&this._initializationData.values.isCompatibleWith(e.values)},e}();function Ze(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Re(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Re(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Re(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0&&n._storage[e].mediaKeySession===i&&n._storage.splice(e,1)})).catch((function(e){V.Z.warn("DRM-LSS: MediaKeySession.closed rejected: "+e)})),this._storage.push(Object.assign({},a)),V.Z.debug("DRM-LSS: MediaKeySession added",a.sessionType,this._storage.length),a},t.reuse=function(e){for(var t=this._storage.length-1;t>=0;t--){var n=this._storage[t];if(n.keySessionRecord.isCompatibleWith(e))return this._storage.splice(t,1),this._storage.push(n),V.Z.debug("DRM-LSS: Reusing session:",n.mediaKeySession.sessionId,n.sessionType),Object.assign({},n)}return null},t.getEntryForSession=function(e){for(var t=this._storage.length-1;t>=0;t--){var n=this._storage[t];if(n.mediaKeySession===e)return Object.assign({},n)}return null},t.generateLicenseRequest=function(){var e=(0,i.Z)(s().mark((function e(t,n,r){var i,a,o,u;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:a=Ze(this._storage);case 1:if((o=a()).done){e.next=8;break}if((u=o.value).mediaKeySession!==t){e.next=6;break}return i=u,e.abrupt("break",8);case 6:e.next=1;break;case 8:if(void 0!==i){e.next=11;break}return V.Z.error("DRM-LSS: generateRequest error. No MediaKeySession found with the given initData and initDataType"),e.abrupt("return",pe(t,n,r));case 11:if(i.isGeneratingRequest=!0,"none"===i.closingStatus.type){e.next=14;break}throw new Error("The `MediaKeySession` is being closed.");case 14:return e.prev=14,e.next=17,pe(t,n,r);case 17:e.next=26;break;case 19:if(e.prev=19,e.t0=e.catch(14),void 0!==i){e.next=23;break}throw e.t0;case 23:throw i.isGeneratingRequest=!1,"awaiting"===i.closingStatus.type&&i.closingStatus.start(),e.t0;case 26:if(void 0!==i){e.next=28;break}return e.abrupt("return",void 0);case 28:i.isGeneratingRequest=!1,"awaiting"===i.closingStatus.type&&i.closingStatus.start();case 30:case"end":return e.stop()}}),e,this,[[14,19]])})));return function(t,n,r){return e.apply(this,arguments)}}(),t.loadPersistentSession=function(){var e=(0,i.Z)(s().mark((function e(t,n){var r,i,a,o,u;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=Ze(this._storage);case 1:if((a=i()).done){e.next=8;break}if((o=a.value).mediaKeySession!==t){e.next=6;break}return r=o,e.abrupt("break",8);case 6:e.next=1;break;case 8:if(void 0!==r){e.next=11;break}return V.Z.error("DRM-LSS: loadPersistentSession error. No MediaKeySession found with the given initData and initDataType"),e.abrupt("return",me(t,n));case 11:if(r.isLoadingPersistentSession=!0,"none"===r.closingStatus.type){e.next=14;break}throw new Error("The `MediaKeySession` is being closed.");case 14:return e.prev=14,e.next=17,me(t,n);case 17:u=e.sent,e.next=27;break;case 20:if(e.prev=20,e.t0=e.catch(14),void 0!==r){e.next=24;break}throw e.t0;case 24:throw r.isLoadingPersistentSession=!1,"awaiting"===r.closingStatus.type&&r.closingStatus.start(),e.t0;case 27:if(void 0!==r){e.next=29;break}return e.abrupt("return",u);case 29:return r.isLoadingPersistentSession=!1,"awaiting"===r.closingStatus.type&&r.closingStatus.start(),e.abrupt("return",u);case 32:case"end":return e.stop()}}),e,this,[[14,20]])})));return function(t,n){return e.apply(this,arguments)}}(),t.closeSession=function(){var e=(0,i.Z)(s().mark((function e(t){var n,r,i,a;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=Ze(this._storage);case 1:if((i=r()).done){e.next=8;break}if((a=i.value).mediaKeySession!==t){e.next=6;break}return n=a,e.abrupt("break",8);case 6:e.next=1;break;case 8:if(void 0!==n){e.next=11;break}return V.Z.warn("DRM-LSS: No MediaKeySession found with the given initData and initDataType"),e.abrupt("return",Promise.resolve(!1));case 11:return e.abrupt("return",this._closeEntry(n));case 12:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.getLength=function(){return this._storage.length},t.getAll=function(){return this._storage},t.closeAllSessions=function(){var e=(0,i.Z)(s().mark((function e(){var t,n,r=this;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this._storage,V.Z.debug("DRM-LSS: Closing all current MediaKeySessions",t.length),this._storage=[],n=t.map((function(e){return r._closeEntry(e)})),e.next=6,Promise.all(n);case 6:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),t.removeSessionWithoutClosingIt=function(e){(0,l.Z)(""===e.sessionId,"Initialized `MediaKeySession`s should always be properly closed");for(var t=this._storage.length-1;t>=0;t--){if(this._storage[t].mediaKeySession===e)return V.Z.debug("DRM-LSS: Removing session without closing it",e.sessionId),this._storage.splice(t,1),!0}return!1},t.getIndex=function(e){for(var t=0;t=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Be(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0){var o=void 0===t?3:4,s=this._entries[a];if((null!==(r=s.version)&&void 0!==r?r:-1)>=o&&i===s.sessionId)return;V.Z.info("DRM-PSS: Updating session info.",i),this._entries.splice(a,1)}else V.Z.info("DRM-PSS: Add new session",i);var u=e.values.getFormattedValues().map((function(e){var t=e.systemId,n=e.data;return{systemId:t,hash:e.hash,data:new Ne(n)}}));void 0===t?this._entries.push({version:3,sessionId:i,values:u,initDataType:e.type}):this._entries.push({version:4,sessionId:i,keyIds:t.map((function(e){return new Ne(e)})),values:u,initDataType:e.type}),this._save()}else V.Z.warn("DRM-PSS: Invalid Persisten Session given.")},t.delete=function(e){for(var t=-1,n=0;n0&&(r=new q.Z("KEY_STATUS_CHANGE_ERROR","One or several problematic key statuses have been encountered",{keyStatuses:d})),{warning:r,blacklistedKeyIds:u,whitelistedKeyIds:l}}var rt=f.Dl,it=f.RV,at=f.qo;function ot(e,t,n,r,a){V.Z.info("DRM: Binding session events",e.sessionId);var o=t.getLicenseConfig,u=void 0===o?{}:o,l=new b.ZP;return l.linkToSignal(a),(0,d.Z)(e.closed)||e.closed.then((function(){return l.cancel()})).catch((function(e){a.isCancelled()||(l.cancel(),r.onError(e))})),rt(e,(function(e){l.cancel(),r.onError(new q.Z("KEY_ERROR",e.type))}),l.signal),at(e,(function(e){(function(e){return c.apply(this,arguments)})(e).catch((function(e){a.isCancelled()||l.isUsed()&&e instanceof b.XG||(l.cancel(),r.onError(e))}))}),l.signal),it(e,(function(n){var a,o=n,c=new Uint8Array(o.message),f=(0,De.Z)(o.messageType)?o.messageType:"license-request";V.Z.info("DRM: Received message event, type "+f,e.sessionId),function(e,t,n){var r=t.baseDelay,a=t.maxDelay,o=t.totalRetry,u=t.shouldRetry,l=t.onRetry,c=0;return f();function f(){return v.apply(this,arguments)}function v(){return(v=(0,i.Z)(s().mark((function t(){var i,v,p,h;return s().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null===n.cancellationError){t.next=2;break}throw n.cancellationError;case 2:return t.prev=2,t.next=5,e();case 5:return i=t.sent,t.abrupt("return",i);case 9:if(t.prev=9,t.t0=t.catch(2),null===n.cancellationError){t.next=13;break}throw n.cancellationError;case 13:if(!(!(0,d.Z)(u)&&!u(t.t0)||c++>=o)){t.next=15;break}throw t.t0;case 15:return"function"==typeof l&&l(t.t0,c),v=Math.min(r*Math.pow(2,c-1),a),p=(0,Qe.Z)(v),t.next=20,(0,$e.Z)(p);case 20:return h=f(),t.abrupt("return",h);case 22:case"end":return t.stop()}}),t,null,[[2,9]])})))).apply(this,arguments)}}((function(){return function(e,n){var r;return new Promise((function(i,a){try{V.Z.debug("DRM: Calling `getLicense`",n);var o=t.getLicense(e,n),s=(0,d.Z)(u.timeout)?1e4:u.timeout;s>=0&&(r=setTimeout((function(){a(new ct('"getLicense" timeout exceeded ('+s+" ms)"))}),s)),Promise.resolve(o).then(l,c)}catch(e){c(e)}function l(e){void 0!==r&&clearTimeout(r),i(e)}function c(e){void 0!==r&&clearTimeout(r),a(e)}}))}(c,f)}),{totalRetry:null!=(a=u.retry)?a:2,baseDelay:200,maxDelay:3e3,shouldRetry:function(e){return e instanceof ct||(0,d.Z)(e)||!0!==e.noRetry},onRetry:function(e){return r.onWarning(st(e))}},l.signal).then((function(t){if(l.isUsed())return Promise.resolve();if((0,d.Z)(t))V.Z.info("DRM: No license given, skipping session.update");else try{return ut(e,t)}catch(e){l.cancel(),r.onError(e)}})).catch((function(e){if(!l.isUsed()){l.cancel();var t=st(e);if(!(0,d.Z)(e))if(!0===e.fallbackOnLastTry)return V.Z.warn("DRM: Last `getLicense` attempt failed. Blacklisting the current session."),void r.onError(new dt(t));r.onError(t)}}))}),l.signal),void f();function c(){return c=(0,i.Z)(s().mark((function n(r){var o,u;return s().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return u=function(){return(u=(0,i.Z)(s().mark((function n(){var i,o;return s().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!l.isUsed()){n.next=2;break}return n.abrupt("return");case 2:if("function"!=typeof t.onKeyStatusesChange){n.next=24;break}return n.prev=3,n.next=6,t.onKeyStatusesChange(r,e);case 6:if(i=n.sent,!l.isUsed()){n.next=9;break}return n.abrupt("return");case 9:n.next=18;break;case 11:if(n.prev=11,n.t0=n.catch(3),!a.isCancelled()){n.next=15;break}return n.abrupt("return");case 15:throw o=new q.Z("KEY_STATUS_CHANGE_ERROR","Unknown `onKeyStatusesChange` error"),!(0,d.Z)(n.t0)&&(0,De.Z)(n.t0.message)&&(o.message=n.t0.message),o;case 18:if(!(0,d.Z)(i)){n.next=22;break}V.Z.info("DRM: No license given, skipping session.update"),n.next=24;break;case 22:return n.next=24,ut(e,i);case 24:case"end":return n.stop()}}),n,null,[[3,11]])})))).apply(this,arguments)},o=function(){return u.apply(this,arguments)},V.Z.info("DRM: keystatuseschange event received",e.sessionId),n.next=5,Promise.all([o(),Promise.resolve(f())]);case 5:case"end":return n.stop()}}),n)}))),c.apply(this,arguments)}function f(){if(!l.isUsed()&&0!==e.keyStatuses.size){var i=nt(e,t,n),a=i.warning,o=i.blacklistedKeyIds,s=i.whitelistedKeyIds;void 0!==a&&(r.onWarning(a),l.isUsed())||r.onKeyUpdate({whitelistedKeyIds:s,blacklistedKeyIds:o})}}}function st(e){if(e instanceof ct)return new q.Z("KEY_LOAD_TIMEOUT","The license server took too much time to respond.");var t=new q.Z("KEY_LOAD_ERROR","An error occured when calling `getLicense`.");return!(0,d.Z)(e)&&(0,De.Z)(e.message)&&(t.message=e.message),t}function ut(e,t){return lt.apply(this,arguments)}function lt(){return(lt=(0,i.Z)(s().mark((function e(t,n){var r;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return V.Z.info("DRM: Updating MediaKeySession with message"),e.prev=1,e.next=4,t.update(n);case 4:e.next=10;break;case 6:throw e.prev=6,e.t0=e.catch(1),r=e.t0 instanceof Error?e.t0.toString():"`session.update` failed",new q.Z("KEY_UPDATE_ERROR",r);case 10:V.Z.info("DRM: MediaKeySession update succeeded.");case 11:case"end":return e.stop()}}),e,null,[[1,6]])})))).apply(this,arguments)}var dt=function(e){function t(n){var r;return r=e.call(this)||this,Object.setPrototypeOf((0,Ye.Z)(r),t.prototype),r.sessionError=n,r}return(0,a.Z)(t,e),t}((0,Xe.Z)(Error)),ct=function(e){function t(t){var n;return n=e.call(this)||this,Object.setPrototypeOf((0,Ye.Z)(n),dt.prototype),n.message=t,n}return(0,a.Z)(t,e),t}((0,Xe.Z)(Error)),ft=n(9822);function vt(e,t){return pt.apply(this,arguments)}function pt(){return(pt=(0,i.Z)(s().mark((function e(t,n){var r,i;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t.setServerCertificate(n);case 3:return r=e.sent,e.abrupt("return",r);case 7:throw e.prev=7,e.t0=e.catch(0),V.Z.warn("DRM: mediaKeys.setServerCertificate returned an error",e.t0 instanceof Error?e.t0:""),i=e.t0 instanceof Error?e.t0.toString():"`setServerCertificate` error",new q.Z("LICENSE_SERVER_CERTIFICATE_ERROR",i);case 12:case"end":return e.stop()}}),e,null,[[0,7]])})))).apply(this,arguments)}function ht(e,t){return mt.apply(this,arguments)}function mt(){return(mt=(0,i.Z)(s().mark((function e(t,n){var r,i;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!0!==ze.hasOne(t)){e.next=3;break}return V.Z.info("DRM: The MediaKeys already has a server certificate, skipping..."),e.abrupt("return",{type:"already-has-one"});case 3:if("function"==typeof t.setServerCertificate){e.next=6;break}return V.Z.warn("DRM: Could not set the server certificate. mediaKeys.setServerCertificate is not a function"),e.abrupt("return",{type:"method-not-implemented"});case 6:return V.Z.info("DRM: Setting server certificate on the MediaKeys"),ze.prepare(t),e.prev=8,e.next=11,vt(t,n);case 11:return r=e.sent,ze.set(t,n),e.abrupt("return",{type:"success",value:r});case 16:return e.prev=16,e.t0=e.catch(8),i=(0,ft.Z)(e.t0)?e.t0:new q.Z("LICENSE_SERVER_CERTIFICATE_ERROR","Unknown error when setting the server certificate."),e.abrupt("return",{type:"error",value:i});case 20:case"end":return e.stop()}}),e,null,[[8,16]])})))).apply(this,arguments)}var gt=n(4339);function yt(e,t){if(!(isNaN(t)||t<0||t>=e.getLength())){var n=e.getLength(),r=n-t;V.Z.info("DRM: Too many stored persistent sessions, removing some.",n,r),e.deleteOldSessions(r)}}var _t=function(){function e(e){this._innerValues=e,this._lazyFormattedValues=null}var t=e.prototype;return t.constructRequestData=function(){return P.zo.apply(void 0,this._innerValues.map((function(e){return e.data})))},t.isCompatibleWith=function(t){var n=t instanceof e?t.getFormattedValues():t;return Oe(this.getFormattedValues(),n)},t.getFormattedValues=function(){return null===this._lazyFormattedValues&&(this._lazyFormattedValues=this._innerValues.slice().sort((function(e,t){return e.systemId===t.systemId?0:void 0===e.systemId?1:void 0===t.systemId||e.systemId=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function St(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0&&U._currentSessions.splice(r),void 0!==t.content&&kt(t.content.manifest,[],[],x.record.getAssociatedKeyIds()),null===(n=i.persistentSessionsStore)||void 0===n||n.delete(C.sessionId),i.loadedSessionsStore.closeSession(C).catch((function(e){var t=e instanceof Error?e:"unknown error";V.Z.warn("DRM: failed to close expired session",t)})).then((function(){return U._unlockInitDataQueue()})).catch((function(e){return U._onFatalError(e)})),void(U._isStopped()||U.trigger("warning",e.reason))}if(e instanceof dt){if(x.blacklistedSessionError=e,void 0!==t.content){var a=t.content.manifest;V.Z.info("DRM: blacklisting Representations based on protection data."),wt(a,t)}U._unlockInitDataQueue()}else U._onFatalError(e)}},this._canceller.signal),void 0!==a.singleLicensePer&&"init-data"!==a.singleLicensePer||this._unlockInitDataQueue(),"created-session"!==R.type){e.next=67;break}return N=t.values.constructRequestData(),e.prev=54,e.next=57,i.loadedSessionsStore.generateLicenseRequest(C,t.type,N);case 57:e.next=67;break;case 59:if(e.prev=59,e.t0=e.catch(54),null!==(O=i.loadedSessionsStore.getEntryForSession(C))&&"none"===O.closingStatus.type){e.next=66;break}return(L=this._currentSessions.indexOf(x))>=0&&this._currentSessions.splice(L,1),e.abrupt("return",Promise.resolve());case 66:throw new q.Z("KEY_GENERATE_REQUEST_ERROR",e.t0 instanceof Error?e.t0.toString():"Unknown error");case 67:return e.abrupt("return",Promise.resolve());case 68:case"end":return e.stop()}}),e,this,[[54,59]])})));return function(t,n){return e.apply(this,arguments)}}(),n._tryToUseAlreadyCreatedSession=function(e,t){var n=t.stores,r=t.options,i=(0,X.Z)(this._currentSessions,(function(t){return t.record.isCompatibleWith(e)}));if(void 0===i)return!1;var a=i.blacklistedSessionError;if(!(0,d.Z)(a))return void 0===e.type||void 0===e.content?(V.Z.error("DRM: This initialization data has already been blacklisted but the current content is not known."),!0):(V.Z.info("DRM: This initialization data has already been blacklisted. Blacklisting the related content."),wt(e.content.manifest,e),!0);if(void 0!==e.keyIds){var o;if(void 0===r.singleLicensePer||"init-data"===r.singleLicensePer){var s=i.keyStatuses.blacklisted;o=function(e,t){for(var n,r,i=function(){var e=r.value;if(t.some((function(t){return Te(t,e)})))return{v:!0}},a=be(e);!(r=a()).done;)if(n=i())return n.v;return!1}(e.keyIds,s)}else{var u=i.keyStatuses.whitelisted;o=!ke(e.keyIds,u)}if(o)return void 0===e.content?(V.Z.error("DRM: Cannot forbid key id, the content is unknown."),!0):(V.Z.info("DRM: Current initialization data is linked to blacklisted keys. Marking Representations as not decipherable"),kt(e.content.manifest,[],e.keyIds,[]),!0)}if(null!==n.loadedSessionsStore.reuse(e))return V.Z.debug("DRM: Init data already processed. Skipping it."),!0;var l=this._currentSessions.indexOf(i);return-1===l?V.Z.error("DRM: Unable to remove processed init data: not found."):(V.Z.debug("DRM: A session from a processed init data is not available anymore. Re-processing it."),this._currentSessions.splice(l,1)),!1},n._onFatalError=function(e){if(!this._canceller.isUsed()){var t=e instanceof Error?e:new Y.Z("NONE","Unknown decryption error");this.error=t,this._initDataQueue.length=0,this._stateData={state:gt.u.Error,isMediaKeysAttached:void 0,isInitDataQueueLocked:void 0,data:null},this._canceller.cancel(),this.trigger("error",t),this._stateData.state===gt.u.Error&&this.trigger("stateChange",this._stateData.state)}},n._isStopped=function(){return this._stateData.state===gt.u.Disposed||this._stateData.state===gt.u.Error},n._processCurrentInitDataQueue=function(){for(;!1===this._stateData.isInitDataQueueLocked;){var e=this._initDataQueue.shift();if(void 0===e)return;this.onInitializationData(e)}},n._lockInitDataQueue=function(){!1===this._stateData.isInitDataQueueLocked&&(this._stateData.isInitDataQueueLocked=!0)},n._unlockInitDataQueue=function(){2===this._stateData.isMediaKeysAttached?(this._stateData.isInitDataQueueLocked=!1,this._processCurrentInitDataQueue()):V.Z.error("DRM: Trying to unlock in the wrong state")},t}(_.Z);function Et(e){var t=e.getConfiguration().sessionTypes;return void 0!==t&&(0,Q.Z)(t,"persistent-license")}function kt(e,t,n,r){e.updateRepresentationsDeciperability((function(e){if(void 0===e.contentProtections)return e.decipherable;var i=e.contentProtections.keyIds;if(void 0!==i)for(var a,o=bt(i);!(a=o()).done;){for(var s,u=a.value,l=bt(n);!(s=l()).done;){if(Te(s.value,u.keyId))return!1}for(var d,c=bt(t);!(d=c()).done;){if(Te(d.value,u.keyId))return!0}for(var f,v=bt(r);!(f=v()).done;){if(Te(f.value,u.keyId))return}}return e.decipherable}))}function wt(e,t){e.updateRepresentationsDeciperability((function(e){var n,r;if(!1===e.decipherable)return!1;for(var i,a,o=function(){var e=a.value;if((void 0===t.type||e.type===t.type)&&t.values.getFormattedValues().every((function(t){return e.values.some((function(e){return(void 0===t.systemId||e.systemId===t.systemId)&&(0,K.Z)(e.data,t.data)}))})))return{v:!1}},s=bt(null!==(r=null===(n=e.contentProtections)||void 0===n?void 0:n.initData)&&void 0!==r?r:[]);!(a=s()).done;)if(i=o())return i.v;return e.decipherable}))}function At(e,t,n,r,i,a){for(var o,s,u=[].concat(i,a),l=function(){var e=s.value;u.some((function(t){return Te(t,e)}))||(V.Z.hasLevel("DEBUG")&&V.Z.debug("DRM: KeySessionRecord's key missing in the license, blacklisting it",(0,Z.ci)(e)),u.push(e))},d=bt(t.getAssociatedKeyIds());!(s=d()).done;)l();if(void 0!==n&&"init-data"!==n){var c=e.keyIds,f=e.content;if(void 0!==c){var v=c.filter((function(e){return!u.some((function(t){return Te(t,e)}))}));v.length>0&&(V.Z.hasLevel("DEBUG")&&V.Z.debug("DRM: init data keys missing in the license, blacklisting them",v.map((function(e){return(0,Z.ci)(e)})).join(", ")),u.push.apply(u,v))}if(r&&void 0!==f)if("content"===n){for(var p,h=new Set,m=bt(f.manifest.periods);!(p=m()).done;){Zt(h,p.value)}It(h,u)}else if("periods"===n)for(var g,y=bt(f.manifest.periods);!(g=y()).done;){var _=g.value,b=new Set;if(Zt(b,_),(null===(o=e.content)||void 0===o?void 0:o.period.id)===_.id)It(b,u);else for(var S=Array.from(b),T=function(){var e=k[E];if(u.some((function(t){return Te(t,e)})))return It(b,u),1},E=0,k=S;E=100?n:r<=0?0:n*(+r/100)}return 0}(e,s);return a.Z.debug("Init: Initial time calculated:",t),t}),o,(function(e){return n.trigger("warning",e)}),r).autoPlayResult.then((function(){return(0,d.Z)(t,e,!0,r).onUpdate((function(e,t){e&&(t(),n.trigger("loaded",{segmentBuffersStore:null}))}),{emitCurrentValue:!0,clearSignal:r})})).catch((function(e){r.isCancelled()||n._onFatalError(e)}))},t}(l.K)},9420:function(e,t,n){"use strict";n.d(t,{K:function(){return i}});var r=n(4578),i=function(e){function t(){return e.apply(this,arguments)||this}return(0,r.Z)(t,e),t}(n(1959).Z)},379:function(e,t,n){"use strict";n.d(t,{Z:function(){return s}});var r=n(3666);var i=n(1669),a=n(5095),o=n(288);function s(e,t,n,s){var u=new o.ZP;u.linkToSignal(s);var l=(0,a.ZP)(!1,u.signal);return e.listen((function(e){if(null===e.rebuffering&&null===e.freezing&&0!==e.readyState){if(!function(e,t){return!e||!r.SB||t}(n,t.hasAttribute("playsinline"))&&t.duration>0)return l.setValue(!0),void u.cancel();var a=r.lV?4:3;return e.readyState>=a&&null!==e.currentRange&&(!(0,i.Z)()||t.duration>0)?(l.setValue(!0),void u.cancel()):void 0}}),{includeLastObservation:!0,clearSignal:u.signal}),l}},8833:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r=n(1669),i=n(3774),a=n(3714),o=n(3887),s=n(5095);function u(e,t,n,u,l,d){var c,f,v=new Promise((function(e,t){c=e,f=t})),p=(0,s.$l)(!1,d),h=(0,s.$l)(!1,d);e.addEventListener("loadedmetadata",g),e.readyState>=i.c.HAVE_METADATA&&g();var m=d.register((function(t){e.removeEventListener("loadedmetadata",g),f(t)}));return{autoPlayResult:v,initialPlayPerformed:h,initialSeekPerformed:p};function g(){e.removeEventListener("loadedmetadata",g);var i="function"==typeof n?n():n;if(o.Z.info("Init: Set initial time",i),t.setCurrentTime(i),p.setValue(!0),p.finish(),(0,r.Z)()&&0===e.duration){var s=new a.Z("MEDIA_ERR_NOT_LOADED_METADATA","Cannot load automatically: your browser falsely announced having loaded the content.");l(s)}d.isCancelled()||t.listen((function(t,n){!t.seeking&&null===t.rebuffering&&t.readyState>=1&&(n(),function(){var t,n;if(o.Z.info("Init: Can begin to play content"),!u)return e.autoplay&&o.Z.warn("Init: autoplay is enabled on HTML media element. Media will play as soon as possible."),h.setValue(!0),h.finish(),m(),c({type:"skipped"});try{n=null!==(t=e.play())&&void 0!==t?t:Promise.resolve()}catch(e){return m(),f(e)}n.then((function(){if(!d.isCancelled())return h.setValue(!0),h.finish(),m(),c({type:"autoplay"})})).catch((function(e){if(m(),!d.isCancelled()){if(e instanceof Error&&"NotAllowedError"===e.name){o.Z.warn("Init: Media element can't play. It may be due to browser auto-play policies.");var t=new a.Z("MEDIA_ERR_BLOCKED_AUTOPLAY","Cannot trigger auto-play automatically: your browser does not allow it.");if(l(t),d.isCancelled())return;return c({type:"autoplay-blocked"})}f(e)}}))}())}),{includeLastObservation:!0,clearSignal:d})}}},7794:function(e,t,n){"use strict";n.d(t,{Z:function(){return l}});var r=n(5157),i=n(7874),a=n(3887),o=n(5095),s=n(288),u=n(4339);function l(e,t,n,l,d){if(0===t.length)return h("No `keySystems` option given.");if(null===i.Z.decrypt)return h("EME feature not activated.");var c=new s.ZP;c.linkToSignal(d);var f=(0,o.ZP)({initializationState:{type:"uninitialized",value:null},drmSystemId:void 0},d);a.Z.debug("Init: Creating ContentDecryptor");var v=i.Z.decrypt;if(!v.hasEmeApis())return h("EME API not available on the current page.");var p=new v(e,t);return p.addEventListener("stateChange",(function(e){if(e===u.u.WaitingForAttachment){var t=(0,o.ZP)(!1);t.onUpdate((function(t,n){t&&(n(),e===u.u.WaitingForAttachment&&p.attach())}),{clearSignal:c.signal}),f.setValue({initializationState:{type:"awaiting-media-link",value:{isMediaLinked:t}},drmSystemId:p.systemId})}else e===u.u.ReadyForContent&&(f.setValue({initializationState:{type:"initialized",value:null},drmSystemId:p.systemId}),p.removeEventListener("stateChange"))})),p.addEventListener("error",(function(e){c.cancel(),l.onError(e)})),p.addEventListener("warning",(function(e){l.onWarning(e)})),n.onUpdate((function(e){null!==e&&p.onInitializationData(e)}),{clearSignal:c.signal}),c.signal.register((function(){p.dispose()})),f;function h(e){n.onUpdate((function(t,n){if(null!==t){n();var i=new r.Z("MEDIA_IS_ENCRYPTED_ERROR",e);l.onError(i)}}),{clearSignal:d});var t=(0,o.ZP)({initializationState:{type:"initialized",value:null},drmSystemId:void 0});return t.finish(),t}}},6199:function(e,t,n){"use strict";n.d(t,{Z:function(){return f}});var r=n(4578),i=n(3666).yS,a=n(6872),o=n(3714),s=n(3887),u=n(1959),l=n(2829),d=n(288),c=1/60,f=function(e){function t(t,n,r){var i;return(i=e.call(this)||this)._playbackObserver=t,i._manifest=n,i._speed=r,i._discontinuitiesStore=[],i._isStarted=!1,i._canceller=new d.ZP,i}(0,r.Z)(t,e);var n=t.prototype;return n.start=function(){var e=this;if(!this._isStarted){var t;this._isStarted=!0;var n=null,r=new h(this._playbackObserver,this._speed);this._canceller.signal.register((function(){r.dispose()}));var o=null;this._playbackObserver.listen((function(u){var d,f,v=e._discontinuitiesStore,h=u.buffered,m=u.position,g=u.readyState,y=u.rebuffering,_=u.freezing,b=a.Z.getCurrent(),S=b.BUFFER_DISCONTINUITY_THRESHOLD,T=b.FORCE_DISCONTINUITY_SEEK_DELAY,E=b.FREEZING_STALLED_DELAY,k=b.UNFREEZING_SEEK_DELAY,w=b.UNFREEZING_DELTA_POSITION;if(!u.seeking&&i&&null===n&&null!==t&&u.positionk&&(s.Z.warn("Init: trying to seek to un-freeze player"),e._playbackObserver.setCurrentTime(e._playbackObserver.getCurrentTime()+w),o={attemptTimestamp:I}),I-_.timestamp>E)return null===y||null!==n?r.stopRebuffering():r.startRebuffering(),void e.trigger("stalled","freezing")}else o=null;if(null===y)return r.stopRebuffering(),1===g?(f=u.seeking?null!==u.pendingInternalSeek?"internal-seek":"seeking":"not-ready",void e.trigger("stalled",f)):void e.trigger("unstalled",null);var Z="seeking"===y.reason&&null!==u.pendingInternalSeek?"internal-seek":y.reason;if(null!==n){var R=performance.now();if(R-n0){var M=function(e,t,n){if(0===e.length)return null;for(var r=null,i=0;in)return r;var o=void 0;if(void 0===a.end||a.end>n){var u=e[i],l=u.discontinuity,d=u.position,f=l.start,v=l.end;if(n>=(null!=f?f:d)-c)if(null===v){var p=t.getPeriodAfter(a);null!==p?o=p.start+c:s.Z.warn("Init: discontinuity at Period's end but no next Period")}else no?r:o)}}return r}(v,e._manifest,x);if(null!==M){var C=M+.001;if(!(C<=e._playbackObserver.getCurrentTime()))return s.Z.warn("SA: skippable discontinuity found in the stream",m,C),e._playbackObserver.setCurrentTime(C),void e.trigger("warning",p(x,C));s.Z.info("Init: position to seek already reached, no seeking",e._playbackObserver.getCurrentTime(),C)}}var P=null!=x?x:m,D=(0,l.XS)(h,P);if(e._speed.getValue()>0&&D=0;O--){var L=e._manifest.periods[O];if(void 0!==L.end&&L.end<=P){if(e._manifest.periods[O+1].start>P&&e._manifest.periods[O+1].start>e._playbackObserver.getCurrentTime()){var U=e._manifest.periods[O+1];return e._playbackObserver.setCurrentTime(U.start),void e.trigger("warning",p(P,U.start))}break}}e.trigger("stalled",Z)}else e.trigger("stalled",Z)}),{includeLastObservation:!0,clearSignal:this._canceller.signal})}},n.updateDiscontinuityInfo=function(e){this._isStarted||this.start();var t=this._playbackObserver.getReference().getValue();!function(e,t,n){for(;e.length>0&&void 0!==e[0].period.end&&e[0].period.end+10r.start)return void(v(t)&&e.splice(a,0,t));v(t)&&e.push(t)}(this._discontinuitiesStore,e,t)},n.onLockedStream=function(e,t){var n;this._isStarted||this.start();var r=this._playbackObserver.getReference().getValue();if(!(!r.rebuffering||r.paused||this._speed.getValue()<=0||"audio"!==e&&"video"!==e)){var i=r.position,a=null!==(n=r.rebuffering.position)&&void 0!==n?n:i,o=t.start;i=0;n--){if(e[n].startt)return e.slice(n,e.length)}return[]}function m(e,t,n){var r=Math.max(e.start,t),i=p(e.cues,t),a={start:e.start,end:r,cues:i},o=Math.min(n,e.end),s=h(e.cues,n);return[a,{start:o,end:e.end,cues:s}]}var g=function(){function e(){this._cuesBuffer=[]}var t=e.prototype;return t.get=function(e){for(var t=this._cuesBuffer,n=[],r=t.length-1;r>=0;r--){var i=t[r];if(e=i.start){for(var a=i.cues,o=0;o=a[o].start&&ee){var a=r[i];if(a.start>=n)return;if(a.end>=n){if(e<=a.start)a.cues=h(a.cues,n),a.start=n;else{var o=m(a,e,n),s=o[0],u=o[1];this._cuesBuffer[i]=s,r.splice(i+1,0,u)}return}a.start>=e?(r.splice(i,1),i--):(a.cues=p(a.cues,e),a.end=Math.max(e,a.start))}},t.insert=function(e,t,n){var r=this._cuesBuffer,i={start:t,end:n,cues:e};function a(e){var t=r[e];void 0===t||v(i.end,t.end)?r[e]=i:(t.start>=i.end||(t.cues=h(t.cues,i.end),t.start=i.end),r.splice(e,0,i))}for(var o=0;os.end);return void a(o)}if(ts.end);return void a(o)}if(v(s.end,n))return s.cues=p(s.cues,t),s.end=t,void r.splice(o+1,0,i);if(s.end>n){var u=m(s,t,n),l=u[0],d=u[1];return this._cuesBuffer[o]=l,r.splice(o+1,0,i),void r.splice(o+2,0,d)}s.cues=p(s.cues,t),s.end=t;var c=o+1;for(s=r[c];void 0!==s&&n>s.end;)r.splice(c,1),s=r[c];return void a(c)}}r.push(i)},e}();function y(e,t,n,r){for(var i=[t/n.columns,e/n.rows],a=r.getElementsByClassName("proportional-style"),o=0;o0}var _=i.M4,b=i.bQ,S=i.Q$;function T(e,t){try{e.removeChild(t)}catch(e){a.Z.warn("HTSB: Can't remove text track: not in the element.")}}function E(e){var t=e.getAttribute("data-resolution-rows"),n=e.getAttribute("data-resolution-columns");if(null===t||null===n)return null;var r=parseInt(t,10),i=parseInt(n,10);return null===r||null===i?null:{rows:r,columns:i}}var k=function(e){function t(t,n){var r;return a.Z.debug("HTSB: Creating HTMLTextSegmentBuffer"),(r=e.call(this)||this).bufferType="text",r._buffered=new c.Z,r._videoElement=t,r._textTrackElement=n,r._sizeUpdateCanceller=new l.ZP,r._canceller=new l.ZP,r._buffer=new g,r._currentCues=[],r.autoRefreshSubtitles(r._canceller.signal),r}(0,r.Z)(t,e);var n=t.prototype;return n.pushChunk=function(e){try{this.pushChunkSync(e)}catch(e){return Promise.reject(e)}return Promise.resolve()},n.removeBuffer=function(e,t){return this.removeBufferSync(e,t),Promise.resolve()},n.endOfSegment=function(e){return this._segmentInventory.completeSegment(e,this._buffered),Promise.resolve()},n.getBufferedRanges=function(){return this._buffered},n.dispose=function(){a.Z.debug("HTSB: Disposing HTMLTextSegmentBuffer"),this._disableCurrentCues(),this._buffer.remove(0,1/0),this._buffered.remove(0,1/0),this._canceller.cancel()},n.pushChunkSync=function(e){var t,n;a.Z.debug("HTSB: Appending new html text tracks");var r=e.data,i=r.timestampOffset,o=r.appendWindow,s=r.chunk;if(null!==s){var u,l,d=s.start,c=s.end,v=s.data,p=s.type,h=s.language,m=null!==(t=o[0])&&void 0!==t?t:0,g=null!==(n=o[1])&&void 0!==n?n:1/0,y=function(e,t,n,r){a.Z.debug("HTSB: Finding parser for html text tracks:",e);var i=f.Z.htmlTextTracksParsers[e];if("function"!=typeof i)throw new Error("no parser found for the given text track");a.Z.debug("HTSB: Parser found, parsing...");var o=i(t,n,r);return a.Z.debug("HTTB: Parsed successfully!",o.length),o}(p,v,i,h);if(0!==m&&g!==1/0){for(var _=0;_=0&&y[_].start>=g;)_--;for(y.splice(_,y.length),_=y.length-1;_>=0&&y[_].end>g;)y[_].end=g,_--}if(void 0!==d)u=Math.max(m,d);else{if(y.length<=0)return void a.Z.warn("HTSB: Current text tracks have no cues nor start time. Aborting");a.Z.warn("HTSB: No start time given. Guessing from cues."),u=y[0].start}if(void 0!==c)l=Math.min(g,c);else{if(y.length<=0)return void a.Z.warn("HTSB: Current text tracks have no cues nor end time. Aborting");a.Z.warn("HTSB: No end time given. Guessing from cues."),l=y[y.length-1].end}l<=u?a.Z.warn("HTSB: Invalid text track appended: ","the start time is inferior or equal to the end time."):(null!==e.inventoryInfos&&this._segmentInventory.insertChunk(e.inventoryInfos),this._buffer.insert(y,u,l),this._buffered.insert(u,l))}},n.removeBufferSync=function(e,t){a.Z.debug("HTSB: Removing html text track data",e,t),this._buffer.remove(e,t),this._buffered.remove(e,t)},n._disableCurrentCues=function(){if(this._sizeUpdateCanceller.cancel(),this._currentCues.length>0){for(var e=0;e0){this._sizeUpdateCanceller=new l.ZP,this._sizeUpdateCanceller.linkToSignal(this._canceller.signal);var c=u.Z.getCurrent().TEXT_TRACK_SIZE_CHECKS_INTERVAL,f=function(e,t,n){var r=e.getBoundingClientRect(),i=r.height,u=r.width,l=(0,o.ZP)({height:i,width:u},n),d=i,c=u;if(void 0!==s){var f=new s((function(e){if(0!==e.length){var t=e[0].contentRect,n=t.height,r=t.width;n===d&&r===c||(d=n,c=r,l.setValue({height:n,width:r}))}else a.Z.error("Compat: Resized but no observed element.")}));f.observe(e),n.register((function(){f.disconnect()}))}else{var v=setInterval((function(){var t=e.getBoundingClientRect(),n=t.height,r=t.width;n===d&&r===c||(d=n,c=r,l.setValue({height:n,width:r}))}),t);n.register((function(){clearInterval(v)}))}return l}(this._textTrackElement,c,this._sizeUpdateCanceller.signal);f.onUpdate((function(e){for(var t=e.height,n=e.width,r=0;r0?e.textTracks[u-1]:e.addTextTrack(s)).mode=t?null!==(n=a.HIDDEN)&&void 0!==n?n:"hidden":null!==(r=a.SHOWING)&&void 0!==r?r:"showing"}else o=document.createElement("track"),e.appendChild(o),a=o.track,o.kind=s,a.mode=t?"hidden":"showing";return{track:a,trackElement:o}}(t,n),s=o.track,l=o.trackElement;return r.bufferType="text",r._buffered=new u.Z,r._videoElement=t,r._track=s,r._trackElement=l,r}(0,r.Z)(t,e);var n=t.prototype;return n.pushChunk=function(e){var t,n;if(a.Z.debug("NTSB: Appending new native text tracks"),null===e.data.chunk)return Promise.resolve();var r=e.data,i=r.timestampOffset,o=r.appendWindow,s=r.chunk,u=s.start,d=s.end,c=s.data,f=s.type,v=s.language,p=null!==(t=o[0])&&void 0!==t?t:0,h=null!==(n=o[1])&&void 0!==n?n:1/0;try{var m,g,y=function(e,t,n,r){a.Z.debug("NTSB: Finding parser for native text tracks:",e);var i=l.Z.nativeTextTracksParsers[e];if("function"!=typeof i)throw new Error("no parser found for the given text track");a.Z.debug("NTSB: Parser found, parsing...");var o=i(t,n,r);return a.Z.debug("NTSB: Parsed successfully!",o.length),o}(f,c,i,v);if(0!==p&&h!==1/0){for(var _=0;_=0&&y[_].startTime>=h;)_--;for(y.splice(_,y.length),_=y.length-1;_>=0&&y[_].endTime>h;)y[_].endTime=h,_--}if(void 0!==u)m=Math.max(p,u);else{if(y.length<=0)return a.Z.warn("NTSB: Current text tracks have no cues nor start time. Aborting"),Promise.resolve();a.Z.warn("NTSB: No start time given. Guessing from cues."),m=y[0].startTime}if(void 0!==d)g=Math.min(h,d);else{if(y.length<=0)return a.Z.warn("NTSB: Current text tracks have no cues nor end time. Aborting"),Promise.resolve();a.Z.warn("NTSB: No end time given. Guessing from cues."),g=y[y.length-1].endTime}if(g<=m)return a.Z.warn("NTSB: Invalid text track appended: ","the start time is inferior or equal to the end time."),Promise.resolve();if(y.length>0){var b=y[0],S=this._track.cues;null!==S&&S.length>0&&b.startTime=0;i--){var s=r[i],u=s.startTime,l=s.endTime;u>=e&&u<=t&&l<=t&&o(n,s)}this._buffered.remove(e,t)},t}(s.C)},9612:function(e,t,n){"use strict";n.d(t,{C:function(){return _},f:function(){return g}});var r=n(6872),i=n(3887),a=n(520),o=n(5278);function s(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return u(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&(this._history=this._history.splice(r)),this._history.length>this._maxHistoryLength){var a=this._history.length-this._maxHistoryLength;this._history=this._history.splice(a)}},e}();function d(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return c(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return c(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0){var _=t[p+y-1];g={end:(0,o.Z)(_.bufferedEnd,_.end),precizeEnd:_.precizeEnd},i.Z.debug("SI: "+y+" segments GCed.",u);for(var b,S=d(t.splice(p,y));!(b=S()).done;){var T=b.value;void 0===T.bufferedStart&&void 0===T.bufferedEnd&&this._bufferedHistory.addBufferedSegment(T.infos,null)}n=p}if(void 0===a)return;if(v-(0,o.Z)(a.bufferedStart,a.start)>=s){if(h(a,f,g,u),n===t.length-1)return void m(a,v,u);a=t[++n];for(var E=(0,o.Z)(a.bufferedStart,a.start),k=(0,o.Z)(a.bufferedEnd,a.end),w=c=s&&(void 0===w||v-E>=k-w);){var A=t[n-1];void 0===A.bufferedEnd&&(A.bufferedEnd=a.precizeStart?a.start:A.end,i.Z.debug("SI: calculating buffered end of contiguous segment",u,A.bufferedEnd,A.end)),a.bufferedStart=A.bufferedEnd,void 0!==(a=t[++n])&&(E=(0,o.Z)(a.bufferedStart,a.start),k=(0,o.Z)(a.bufferedEnd,a.end))}}var I=t[n-1];void 0!==I&&m(I,v,u)}}if(null!=a){i.Z.debug("SI: last segments have been GCed",u,n,t.length);for(var Z,R=d(t.splice(n,t.length-n));!(Z=R()).done;){var x=Z.value;void 0===x.bufferedStart&&void 0===x.bufferedEnd&&this._bufferedHistory.addBufferedSegment(x.infos,null)}}void 0!==u&&i.Z.hasLevel("DEBUG")&&i.Z.debug("SI: current "+u+" inventory timeline:\n"+function(e){var t=1/60,n={},r=[],i=null,a=null;function o(e){var t=String.fromCharCode(r.length+65);return r.push({letter:t,periodId:e.period.id,representationId:e.representation.id,bitrate:e.representation.bitrate}),t}for(var s="",u=0;u=u)i.Z.warn("SI: Invalid chunked inserted: starts before it ends",l,s,u);else{for(var d=this._inventory,c={partiallyPushed:!0,chunkSize:o,splitted:!1,start:s,end:u,precizeStart:!1,precizeEnd:!1,bufferedStart:void 0,bufferedEnd:void 0,infos:{segment:a,period:t,adaptation:n,representation:r}},f=d.length-1;f>=0;f--){var v=d[f];if(v.start<=s){if(v.end<=s){for(i.Z.debug("SI: Pushing segment strictly after previous one.",l,s,v.end),this._inventory.splice(f+1,0,c),f+=2;fc.end)return i.Z.debug("SI: Segment pushed updates the start of the next one",l,c.end,d[f].start),d[f].start=c.end,d[f].bufferedStart=void 0,void(d[f].precizeStart=d[f].precizeStart&&c.precizeEnd);i.Z.debug("SI: Segment pushed removes the next one",l,s,u,d[f].start,d[f].end),d.splice(f,1)}return}if(v.start===s){if(v.end<=u){for(i.Z.debug("SI: Segment pushed replace another one",l,s,u,v.end),this._inventory.splice(f,1,c),f+=1;fc.end)return i.Z.debug("SI: Segment pushed updates the start of the next one",l,c.end,d[f].start),d[f].start=c.end,d[f].bufferedStart=void 0,void(d[f].precizeStart=d[f].precizeStart&&c.precizeEnd);i.Z.debug("SI: Segment pushed removes the next one",l,s,u,d[f].start,d[f].end),d.splice(f,1)}return}return i.Z.debug("SI: Segment pushed ends before another with the same start",l,s,u,v.end),d.splice(f,0,c),v.start=c.end,v.bufferedStart=void 0,void(v.precizeStart=v.precizeStart&&c.precizeEnd)}if(v.end<=c.end){for(i.Z.debug("SI: Segment pushed updates end of previous one",l,s,u,v.start,v.end),this._inventory.splice(f+1,0,c),v.end=c.start,v.bufferedEnd=void 0,v.precizeEnd=v.precizeEnd&&c.precizeStart,f+=2;fc.end)return i.Z.debug("SI: Segment pushed updates the start of the next one",l,c.end,d[f].start),d[f].start=c.end,d[f].bufferedStart=void 0,void(d[f].precizeStart=d[f].precizeStart&&c.precizeEnd);i.Z.debug("SI: Segment pushed removes the next one",l,s,u,d[f].start,d[f].end),d.splice(f,1)}return}i.Z.warn("SI: Segment pushed is contained in a previous one",l,s,u,v.start,v.end);var p={partiallyPushed:v.partiallyPushed,chunkSize:v.chunkSize,splitted:!0,start:c.end,end:v.end,precizeStart:v.precizeStart&&v.precizeEnd&&c.precizeEnd,precizeEnd:v.precizeEnd,bufferedStart:void 0,bufferedEnd:v.end,infos:v.infos};return v.end=c.start,v.splitted=!0,v.bufferedEnd=void 0,v.precizeEnd=v.precizeEnd&&c.precizeStart,d.splice(f+1,0,c),void d.splice(f+2,0,p)}}var h=this._inventory[0];if(void 0===h)return i.Z.debug("SI: first segment pushed",l,s,u),void this._inventory.push(c);if(!(h.start>=u)){if(h.end<=u){for(i.Z.debug("SI: Segment pushed starts before and completely recovers the previous first one",l,s,u,h.start,h.end),this._inventory.splice(0,1,c);d.length>1&&d[1].startc.end)return i.Z.debug("SI: Segment pushed updates the start of the next one",l,c.end,d[1].start),d[1].start=c.end,d[1].bufferedStart=void 0,void(d[1].precizeStart=c.precizeEnd);i.Z.debug("SI: Segment pushed removes the next one",l,s,u,d[1].start,d[1].end),d.splice(1,1)}return}return i.Z.debug("SI: Segment pushed start of the next one",l,s,u,h.start,h.end),h.start=u,h.bufferedStart=void 0,h.precizeStart=c.precizeEnd,void this._inventory.splice(0,0,c)}i.Z.debug("SI: Segment pushed comes before all previous ones",l,s,u,h.start),this._inventory.splice(0,0,c)}}},t.completeSegment=function(e,t){if(!e.segment.isInit){for(var n=this._inventory,r=[],o=0;o0&&(s=!0,1===r.length&&(i.Z.warn("SI: Completed Segment is splitted.",e.segment.id,e.segment.time,e.segment.end),r[0].splitted=!0));var u=o,l=n[o].chunkSize;for(o+=1;o0&&(this._inventory.splice(u+1,v),o-=v),this._inventory[u].partiallyPushed=!1,this._inventory[u].chunkSize=l,this._inventory[u].end=p,this._inventory[u].bufferedEnd=h,this._inventory[u].splitted=s,r.push(this._inventory[u])}if(0===r.length)i.Z.warn("SI: Completed Segment not found",e.segment.id,e.segment.time);else{this.synchronizeBuffered(t);for(var m,g=d(r);!(m=g()).done;){var y=m.value;void 0!==y.bufferedStart&&void 0!==y.bufferedEnd?this._bufferedHistory.addBufferedSegment(y.infos,{start:y.bufferedStart,end:y.bufferedEnd}):i.Z.debug("SI: buffered range not known after sync. Skipping history.",y.start,y.end)}}}},t.getInventory=function(){return this._inventory},t.getHistoryFor=function(e){return this._bufferedHistory.getHistoryFor(e)},e}();function v(e){if(void 0===e.bufferedStart||e.partiallyPushed)return!1;var t=e.start,n=e.end-t,i=r.Z.getCurrent(),a=i.MAX_MANIFEST_BUFFERED_START_END_DIFFERENCE,o=i.MAX_MANIFEST_BUFFERED_DURATION_DIFFERENCE;return Math.abs(t-e.bufferedStart)<=a&&(void 0===e.bufferedEnd||e.bufferedEnd>e.bufferedStart&&Math.abs(e.bufferedEnd-e.bufferedStart-n)<=Math.min(o,n/3))}function p(e){if(void 0===e.bufferedEnd||e.partiallyPushed)return!1;var t=e.start,n=e.end,i=n-t,a=r.Z.getCurrent(),o=a.MAX_MANIFEST_BUFFERED_START_END_DIFFERENCE,s=a.MAX_MANIFEST_BUFFERED_DURATION_DIFFERENCE;return Math.abs(n-e.bufferedEnd)<=o&&null!=e.bufferedStart&&e.bufferedEnd>e.bufferedStart&&Math.abs(e.bufferedEnd-e.bufferedStart-i)<=Math.min(s,i/3)}function h(e,t,n,a){var o=r.Z.getCurrent().MAX_MANIFEST_BUFFERED_START_END_DIFFERENCE;void 0!==e.bufferedStart?(e.bufferedStartt&&(n.precizeEnd||e.start-n.end<=o)?(i.Z.debug("SI: buffered start is end of previous segment",a,t,e.start,n.end),e.bufferedStart=n.end,v(e)&&(e.start=n.end,e.precizeStart=!0)):e.start-t<=o?(i.Z.debug("SI: found true buffered start",a,t,e.start),e.bufferedStart=t,v(e)&&(e.start=t,e.precizeStart=!0)):tt&&(i.Z.debug("SI: Segment partially GCed at the end",n,e.bufferedEnd,t),e.bufferedEnd=t),!e.precizeEnd&&t-e.end<=a&&p(e)&&(e.precizeEnd=!0,e.end=t)):e.precizeEnd?(i.Z.debug("SI: buffered end is precize end",n,e.end),e.bufferedEnd=e.end):t-e.end<=a?(i.Z.debug("SI: found true buffered end",n,t,e.end),e.bufferedEnd=t,p(e)&&(e.end=t,e.precizeEnd=!0)):t>e.end?(i.Z.debug("SI: range end too far from expected end",n,t,e.end),e.bufferedEnd=e.end):(i.Z.debug("SI: Segment appears immediately garbage collected at the end",n,e.bufferedEnd,t),e.bufferedEnd=t)}var g,y=f,_=function(){function e(){this._segmentInventory=new y}var t=e.prototype;return t.synchronizeInventory=function(){this._segmentInventory.synchronizeBuffered(this.getBufferedRanges())},t.getInventory=function(){return this._segmentInventory.getInventory()},t.getPendingOperations=function(){return[]},t.getSegmentHistory=function(e){return this._segmentInventory.getHistoryFor(e)},e}();!function(e){e[e.Push=0]="Push",e[e.Remove=1]="Remove",e[e.EndOfSegment=2]="EndOfSegment"}(g||(g={}))},4309:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(2829),i=function(){function e(){this._ranges=[],this.length=0}var t=e.prototype;return t.insert=function(e,t){(0,r.kR)(this._ranges,{start:e,end:t}),this.length=this._ranges.length},t.remove=function(e,t){var n=[];e>0&&n.push({start:0,end:e}),t<1/0&&n.push({start:t,end:1/0}),this._ranges=(0,r.tn)(this._ranges,n),this.length=this._ranges.length},t.start=function(e){if(e>=this._ranges.length)throw new Error("INDEX_SIZE_ERROR");return this._ranges[e].start},t.end=function(e){if(e>=this._ranges.length)throw new Error("INDEX_SIZE_ERROR");return this._ranges[e].end},e}()},7839:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(7326),i=n(4578),a=function(e){function t(n,i,a,o){var s;return s=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(s),t.prototype),s.name="CustomLoaderError",s.message=n,s.canRetry=i,s.isOfflineError=a,s.xhr=o,s}return(0,i.Z)(t,e),t}((0,n(2146).Z)(Error))},5157:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r=n(7326),i=n(4578),a=n(2146),o=n(5992),s=n(7367),u=function(e){function t(n,i,a){var u;return u=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(u),t.prototype),u.name="EncryptedMediaError",u.type=o.ZB.ENCRYPTED_MEDIA_ERROR,u.code=n,u.message=(0,s.Z)(u.name,u.code,i),u.fatal=!1,"string"==typeof(null==a?void 0:a.keyStatuses)&&(u.keyStatuses=a.keyStatuses),u}return(0,i.Z)(t,e),t}((0,a.Z)(Error))},5992:function(e,t,n){"use strict";n.d(t,{SM:function(){return a},ZB:function(){return r},br:function(){return i}});var r={NETWORK_ERROR:"NETWORK_ERROR",MEDIA_ERROR:"MEDIA_ERROR",ENCRYPTED_MEDIA_ERROR:"ENCRYPTED_MEDIA_ERROR",OTHER_ERROR:"OTHER_ERROR"},i={TIMEOUT:"TIMEOUT",ERROR_EVENT:"ERROR_EVENT",ERROR_HTTP_CODE:"ERROR_HTTP_CODE",PARSE_ERROR:"PARSE_ERROR"},a={PIPELINE_LOAD_ERROR:"PIPELINE_LOAD_ERROR",PIPELINE_PARSE_ERROR:"PIPELINE_PARSE_ERROR",INTEGRITY_ERROR:"INTEGRITY_ERROR",MANIFEST_PARSE_ERROR:"MANIFEST_PARSE_ERROR",MANIFEST_INCOMPATIBLE_CODECS_ERROR:"MANIFEST_INCOMPATIBLE_CODECS_ERROR",MANIFEST_UPDATE_ERROR:"MANIFEST_UPDATE_ERROR",MANIFEST_UNSUPPORTED_ADAPTATION_TYPE:"MANIFEST_UNSUPPORTED_ADAPTATION_TYPE",MEDIA_STARTING_TIME_NOT_FOUND:"MEDIA_STARTING_TIME_NOT_FOUND",MEDIA_TIME_BEFORE_MANIFEST:"MEDIA_TIME_BEFORE_MANIFEST",MEDIA_TIME_AFTER_MANIFEST:"MEDIA_TIME_AFTER_MANIFEST",MEDIA_TIME_NOT_FOUND:"MEDIA_TIME_NOT_FOUND",NO_PLAYABLE_REPRESENTATION:"NO_PLAYABLE_REPRESENTATION",MEDIA_IS_ENCRYPTED_ERROR:"MEDIA_IS_ENCRYPTED_ERROR",CREATE_MEDIA_KEYS_ERROR:"CREATE_MEDIA_KEYS_ERROR",KEY_ERROR:"KEY_ERROR",KEY_STATUS_CHANGE_ERROR:"KEY_STATUS_CHANGE_ERROR",KEY_UPDATE_ERROR:"KEY_UPDATE_ERROR",KEY_LOAD_ERROR:"KEY_LOAD_ERROR",KEY_LOAD_TIMEOUT:"KEY_LOAD_TIMEOUT",KEY_GENERATE_REQUEST_ERROR:"KEY_GENERATE_REQUEST_ERROR",INCOMPATIBLE_KEYSYSTEMS:"INCOMPATIBLE_KEYSYSTEMS",INVALID_ENCRYPTED_EVENT:"INVALID_ENCRYPTED_EVENT",INVALID_KEY_SYSTEM:"INVALID_KEY_SYSTEM",LICENSE_SERVER_CERTIFICATE_ERROR:"LICENSE_SERVER_CERTIFICATE_ERROR",MULTIPLE_SESSIONS_SAME_INIT_DATA:"MULTIPLE_SESSIONS_SAME_INIT_DATA",BUFFER_APPEND_ERROR:"BUFFER_APPEND_ERROR",BUFFER_FULL_ERROR:"BUFFER_FULL_ERROR",BUFFER_TYPE_UNKNOWN:"BUFFER_TYPE_UNKNOWN",MEDIA_ERR_BLOCKED_AUTOPLAY:"MEDIA_ERR_BLOCKED_AUTOPLAY",MEDIA_ERR_PLAY_NOT_ALLOWED:"MEDIA_ERR_PLAY_NOT_ALLOWED",MEDIA_ERR_NOT_LOADED_METADATA:"MEDIA_ERR_NOT_LOADED_METADATA",MEDIA_ERR_ABORTED:"MEDIA_ERR_ABORTED",MEDIA_ERR_NETWORK:"MEDIA_ERR_NETWORK",MEDIA_ERR_DECODE:"MEDIA_ERR_DECODE",MEDIA_ERR_SRC_NOT_SUPPORTED:"MEDIA_ERR_SRC_NOT_SUPPORTED",MEDIA_ERR_UNKNOWN:"MEDIA_ERR_UNKNOWN",MEDIA_SOURCE_NOT_SUPPORTED:"MEDIA_SOURCE_NOT_SUPPORTED",MEDIA_KEYS_NOT_SUPPORTED:"MEDIA_KEYS_NOT_SUPPORTED",DISCONTINUITY_ENCOUNTERED:"DISCONTINUITY_ENCOUNTERED",NONE:"NONE"}},7367:function(e,t,n){"use strict";function r(e,t,n){return e+" ("+t+") "+n}n.d(t,{Z:function(){return r}})},8750:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(9822),i=n(5389);function a(e,t){var n=t.defaultCode,a=t.defaultReason;if((0,r.Z)(e))return e;var o=e instanceof Error?e.toString():a;return new i.Z(n,o)}},9822:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r=n(5157),i=n(5992),a=n(3714),o=n(9362),s=n(5389);function u(e){return(e instanceof r.Z||e instanceof a.Z||e instanceof s.Z||e instanceof o.Z)&&Object.keys(i.ZB).indexOf(e.type)>=0}},3714:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r=n(7326),i=n(4578),a=n(2146),o=n(5992),s=n(7367),u=function(e){function t(n,i,a){var u;u=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(u),t.prototype),u.name="MediaError",u.type=o.ZB.MEDIA_ERROR,u.code=n,u.message=(0,s.Z)(u.name,u.code,i),u.fatal=!1;var l=null==a?void 0:a.adaptation;if(void 0!==l)switch(l.type){case"audio":u.trackInfo={type:"audio",track:l.toAudioTrack()};break;case"video":u.trackInfo={type:"video",track:l.toVideoTrack()};break;case"text":u.trackInfo={type:"text",track:l.toTextTrack()}}return u}return(0,i.Z)(t,e),t}((0,a.Z)(Error))},9362:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r=n(7326),i=n(4578),a=n(2146),o=n(5992),s=n(7367),u=function(e){function t(n,i){var a;return a=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(a),t.prototype),a.name="NetworkError",a.type=o.ZB.NETWORK_ERROR,a.xhr=void 0===i.xhr?null:i.xhr,a.url=i.url,a.status=i.status,a.errorType=i.type,a.code=n,a.message=(0,s.Z)(a.name,a.code,i.message),a.fatal=!1,a}return(0,i.Z)(t,e),t.prototype.isHttpError=function(e){return this.errorType===o.br.ERROR_HTTP_CODE&&this.status===e},t}((0,a.Z)(Error))},5389:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r=n(7326),i=n(4578),a=n(2146),o=n(5992),s=n(7367),u=function(e){function t(n,i){var a;return a=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(a),t.prototype),a.name="OtherError",a.type=o.ZB.OTHER_ERROR,a.code=n,a.message=(0,s.Z)(a.name,a.code,i),a.fatal=!1,a}return(0,i.Z)(t,e),t}((0,a.Z)(Error))},9105:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(7326),i=n(4578),a=function(e){function t(n,i,a,o){var s;return s=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(s),t.prototype),s.name="RequestError",s.url=n,void 0!==o&&(s.xhr=o),s.status=i,s.type=a,s.message=a,s}return(0,i.Z)(t,e),t}((0,n(2146).Z)(Error))},7273:function(e,t){"use strict";t.Z={dashParsers:{wasm:null,js:null},createDebugElement:null,directfile:null,decrypt:null,htmlTextTracksBuffer:null,htmlTextTracksParsers:{},imageBuffer:null,imageParser:null,nativeTextTracksBuffer:null,nativeTextTracksParsers:{},transports:{}}},7874:function(e,t,n){"use strict";var r=n(7273);t.Z=r.Z},3887:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(8894),i=new(function(){function e(){this.error=r.Z,this.warn=r.Z,this.info=r.Z,this.debug=r.Z,this._levels={NONE:0,ERROR:1,WARNING:2,INFO:3,DEBUG:4},this._currentLevel="NONE"}var t=e.prototype;return t.setLevel=function(e){var t,n=this._levels[e];"number"==typeof n?(t=n,this._currentLevel=e):(t=0,this._currentLevel="NONE"),this.error=t>=this._levels.ERROR?console.error.bind(console):r.Z,this.warn=t>=this._levels.WARNING?console.warn.bind(console):r.Z,this.info=t>=this._levels.INFO?console.info.bind(console):r.Z,this.debug=t>=this._levels.DEBUG?console.log.bind(console):r.Z},t.getLevel=function(){return this._currentLevel},t.hasLevel=function(e){return this._levels[e]>=this._levels[this._currentLevel]},e}())},8999:function(e,t,n){"use strict";n.d(t,{r:function(){return v},Z:function(){return p}});var r=n(3887),i=n(3274),a=n(1946),o=n(7829);var s="undefined"!=typeof window&&"function"==typeof window.Set&&"function"==typeof Array.from?function(e){return Array.from(new Set(e))}:function(e){return e.filter((function(e,t,n){return n.indexOf(e)===t}))},u=n(3774);var l=n(4791);function d(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return c(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return c(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&(this.trickModeTracks=i.map((function(t){return new e(t)})));for(var d=t.representations,c=[],v=!1,p=0;p0&&!r.isSupported){var i=new a.Z("MANIFEST_INCOMPATIBLE_CODECS_ERROR","An Adaptation contains only incompatible codecs.",{adaptation:r});n.contentWarnings.push(i)}return r})).filter((function(e){return e.representations.length>0}));if(s.every((function(e){return!e.isSupported}))&&o.length>0&&("video"===i||"audio"===i))throw new a.Z("MANIFEST_PARSE_ERROR","No supported "+i+" adaptations");return s.length>0&&(r[i]=s),r}),{}),!Array.isArray(this.adaptations.video)&&!Array.isArray(this.adaptations.audio))throw new a.Z("MANIFEST_PARSE_ERROR","No supported audio and video tracks.");this.duration=e.duration,this.start=e.start,null!=this.duration&&null!=this.start&&(this.end=this.start+this.duration),this.streamEvents=void 0===e.streamEvents?[]:e.streamEvents}var t=e.prototype;return t.getAdaptations=function(){var e=this.adaptations;return(0,v.Z)(e).reduce((function(e,t){return null!=t?e.concat(t):e}),[])},t.getAdaptationsForType=function(e){var t=this.adaptations[e];return null==t?[]:t},t.getAdaptation=function(e){return(0,s.Z)(this.getAdaptations(),(function(t){var n=t.id;return e===n}))},t.getSupportedAdaptations=function(e){if(void 0===e)return this.getAdaptations().filter((function(e){return e.isSupported}));var t=this.adaptations[e];return void 0===t?[]:t.filter((function(e){return e.isSupported}))},t.containsTime=function(e){return e>=this.start&&(void 0===this.end||e=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0)o.Z.warn("Manifest: "+y.length+" new Representations found when merging."),(h=t.representations).push.apply(h,y),v.push.apply(v,y)}l=e},l=0;l0){o.Z.warn("Manifest: "+s.length+" new Adaptations found when merging.");for(var d,c=g(s);!(d=c()).done;){var f=d.value,v=e.adaptations[f.type];void 0===v?e.adaptations[f.type]=[f]:v.push(f),i.addedAdaptations.push(f)}}return i}function b(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return S(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return S(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function S(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&r._addSupplementaryImageAdaptations(u),o.length>0&&r._addSupplementaryTextAdaptations(o),r}(0,i.Z)(t,e);var n=t.prototype;return n.getPeriod=function(e){return(0,s.Z)(this.periods,(function(t){return e===t.id}))},n.getPeriodForTime=function(e){return(0,s.Z)(this.periods,(function(t){return e>=t.start&&(void 0===t.end||t.end>e)}))},n.getNextPeriod=function(e){return(0,s.Z)(this.periods,(function(t){return t.start>e}))},n.getPeriodAfter=function(e){var t=e.end;if(void 0===t)return null;var n=(0,s.Z)(this.periods,(function(e){return void 0===e.end||t0&&this.trigger("decipherabilityUpdate",t)},n.getAdaptations=function(){(0,c.Z)("manifest.getAdaptations() is deprecated. Please use manifest.period[].getAdaptations() instead");var e=this.periods[0];if(void 0===e)return[];var t=e.adaptations,n=[];for(var r in t)if(t.hasOwnProperty(r)){var i=t[r];n.push.apply(n,i)}return n},n.getAdaptationsForType=function(e){(0,c.Z)("manifest.getAdaptationsForType(type) is deprecated. Please use manifest.period[].getAdaptationsForType(type) instead");var t=this.periods[0];if(void 0===t)return[];var n=t.adaptations[e];return void 0===n?[]:n},n.getAdaptation=function(e){return(0,c.Z)("manifest.getAdaptation(id) is deprecated. Please use manifest.period[].getAdaptation(id) instead"),(0,s.Z)(this.getAdaptations(),(function(t){var n=t.id;return e===n}))},n._addSupplementaryImageAdaptations=function(e){var t=this,n=(Array.isArray(e)?e:[e]).map((function(e){var n=e.mimeType,r=e.url,i="gen-image-ada-"+T(),o="gen-image-rep-"+T(),s=(0,d.$)(r),u=r.substring(0,s),l=r.substring(s),c=new f.Z({id:i,type:"image",representations:[{bitrate:0,cdnMetadata:[{baseUrl:u}],id:o,mimeType:n,index:new h({media:l})}]},{isManuallyAdded:!0});if(c.representations.length>0&&!c.isSupported){var v=new a.Z("MANIFEST_INCOMPATIBLE_CODECS_ERROR","An Adaptation contains only incompatible codecs.",{adaptation:c});t.contentWarnings.push(v)}return c}));if(n.length>0&&this.periods.length>0){var r=this.periods[0].adaptations;r.image=null!=r.image?r.image.concat(n):n}},n._addSupplementaryTextAdaptations=function(e){var t=this,n=(Array.isArray(e)?e:[e]).reduce((function(e,n){var r=n.mimeType,i=n.codecs,o=n.url,s=n.language,u=n.languages,l=n.closedCaption,c=null!=s?[s]:null!=u?u:[],v=(0,d.$)(o),p=o.substring(0,v),m=o.substring(v);return e.concat(c.map((function(e){var n="gen-text-ada-"+T(),o="gen-text-rep-"+T(),s=new f.Z({id:n,type:"text",language:e,closedCaption:l,representations:[{bitrate:0,cdnMetadata:[{baseUrl:p}],id:o,mimeType:r,codecs:i,index:new h({media:m})}]},{isManuallyAdded:!0});if(s.representations.length>0&&!s.isSupported){var u=new a.Z("MANIFEST_INCOMPATIBLE_CODECS_ERROR","An Adaptation contains only incompatible codecs.",{adaptation:s});t.contentWarnings.push(u)}return s})))}),[]);if(n.length>0&&this.periods.length>0){var r=this.periods[0].adaptations;r.text=null!=r.text?r.text.concat(n):n}},n._performUpdate=function(e,t){var n;if(this.availabilityStartTime=e.availabilityStartTime,this.expired=e.expired,this.isDynamic=e.isDynamic,this.isLive=e.isLive,this.isLastPeriodKnown=e.isLastPeriodKnown,this.lifetime=e.lifetime,this.contentWarnings=e.contentWarnings,this.suggestedPresentationDelay=e.suggestedPresentationDelay,this.transport=e.transport,this.publishTime=e.publishTime,t===r.Full)this._timeBounds=e._timeBounds,this.uris=e.uris,n=function(e,t){for(var n={updatedPeriods:[],addedPeriods:[],removedPeriods:[]},i=0,a=0;ae.length)return o.Z.error("Manifest: error when updating Periods"),n;if(i0&&(e.push.apply(e,b),(y=n.addedPeriods).push.apply(y,b)),n}(this.periods,e.periods);else{this._timeBounds.maximumTimeData=e._timeBounds.maximumTimeData,this.updateUrl=e.uris[0],n=function(e,t){var n,i={updatedPeriods:[],addedPeriods:[],removedPeriods:[]};if(0===e.length)return e.splice.apply(e,[0,0].concat(t)),(n=i.addedPeriods).push.apply(n,t),i;if(0===t.length)return i;var s=e[e.length-1];if(s.startc){var E;o.Z.warn("Manifest: old Periods not found in new when updating, removing");var k=e.splice(c,p-c);(E=i.removedPeriods).push.apply(E,k),p=c}var w=_(e[p],v,r.Full);i.updatedPeriods.push({period:e[p],result:w})}c++}if(c0;){var s=this.periods[0];if(void 0===s.end||s.end>i)break;this.periods.shift()}}this.adaptations=void 0===this.periods[0]?{}:this.periods[0].adaptations,this.trigger("manifestUpdate",n)},t}(u.Z);var w=k},520:function(e,t,n){"use strict";n.d(t,{K:function(){return a},z:function(){return i}});var r=n(1946);function i(e,t){return e.segment.id===t.segment.id&&e.representation.id===t.representation.id&&e.adaptation.id===t.adaptation.id&&e.period.id===t.period.id}function a(e){if((0,r.Z)(e))return"";var t=e.period,n=e.adaptation,i=e.representation,a=e.segment;return n.type+" P: "+t.id+" A: "+n.id+" R: "+i.id+" S: "+(a.isInit?"init":a.complete?a.time+"-"+a.duration:""+a.time)}},2689:function(e,t,n){"use strict";n.d(t,{s:function(){return r}});var r=Math.pow(2,32)-1},2297:function(e,t,n){"use strict";n.d(t,{Qy:function(){return f},Xj:function(){return p},iz:function(){return c},lp:function(){return d},nR:function(){return v},t_:function(){return l},vA:function(){return u}});var r=n(3887),i=n(811),a=n(6968);function o(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return s(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return s(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);ni)return null;s=(0,a.pV)(e,r),r+=8}if(s<0)throw new Error("ISOBMFF: Size out of range");if(n===t)return 1970628964===t&&(r+=16),[o,r,o+s];o+=s}return null}function v(e,t,n,r,i){for(var o,s=e.length,u=0;us)return;o=(0,a.pV)(e,l),l+=8}if(1970628964===d&&l+16<=s&&(0,a.pX)(e,l)===t&&(0,a.pX)(e,l+4)===n&&(0,a.pX)(e,l+8)===r&&(0,a.pX)(e,l+12)===i)return l+=16,e.subarray(l,u+o)}}function p(e){var t=e.length;if(t<8)return r.Z.warn("ISOBMFF: box inferior to 8 bytes, cannot find offsets"),null;var n=0,i=(0,a.pX)(e,n);n+=4;var o=(0,a.pX)(e,n);if(n+=4,0===i)i=t;else if(1===i){if(n+8>t)return r.Z.warn("ISOBMFF: box too short, cannot find offsets"),null;i=(0,a.pV)(e,n),n+=8}if(i<0)throw new Error("ISOBMFF: Size out of range");return 1970628964===o&&(n+=16),[0,n,i]}},6807:function(e,t,n){"use strict";n.d(t,{E3:function(){return u},Le:function(){return o},XA:function(){return i},fs:function(){return s},uq:function(){return a}});var r=n(2297);function i(e){var t=(0,r.t_)(e,1836019558);return null===t?null:(0,r.t_)(t,1953653094)}function a(e){return(0,r.lp)(e,1836019558).reduce((function(e,t){var n=(0,r.t_)(t,1953653094);return null!==n&&e.push(n),e}),[])}function o(e){return(0,r.t_)(e,1835295092)}function s(e){var t=(0,r.t_)(e,1836019574);if(null===t)return null;var n=(0,r.t_)(t,1953653099);return null===n?null:(0,r.t_)(n,1835297121)}function u(e,t){return void 0===t&&(t=0),(0,r.t_)(e.subarray(t),1701671783)}},6490:function(e,t,n){"use strict";n.d(t,{Z:function(){return s},Y:function(){return u}});var r=n(3887);var i="function"==typeof Uint8Array.prototype.slice?function(e,t,n){return e.slice(t,n)}:function(e,t,n){return new Uint8Array(Array.prototype.slice.call(e,t,n))},a=n(3635),o=n(2297);function s(e){var t=0,n=(0,o.t_)(e,1836019574);if(null===n)return[];for(var a=[];t1)r.Z.warn("ISOBMFF: un-handled PSSH version");else{var n=t+4;if(!(n+16>e.length)){var o=i(e,n,n+16);return(0,a.ci)(o)}}}},4644:function(e,t,n){"use strict";n.d(t,{J6:function(){return m},LD:function(){return h},MM:function(){return p},Qx:function(){return f},R0:function(){return y},Wf:function(){return c},s9:function(){return g}});var r=n(3887),i=n(6968),a=n(3635),o=n(2689),s=n(2297),u=n(6807);function l(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return d(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return d(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0;){var v=(0,i.pX)(e,o);o+=4;var p=2147483647&v;if(1===(2147483648&v)>>>31)throw new Error("sidx with reference_type `1` not yet implemented");var h=(0,i.pX)(e,o);o+=4,o+=4,c.push({time:l,duration:h,timescale:d,range:[r,r+p-1]}),l+=h,r+=p}return c}function f(e){var t=(0,u.XA)(e);if(null!==t){var n=(0,s.t_)(t,1952867444);if(null!==n){var r=n[0];return 1===r?(0,i.pV)(n,4):0===r?(0,i.pX)(n,4):void 0}}}function v(e){var t=(0,s.t_)(e,1952868452);if(null!==t){var n=1,r=(0,i.QI)(t,n);if(n+=3,(8&r)>0)return n+=4,(1&r)>0&&(n+=8),(2&r)>0&&(n+=4),(0,i.pX)(t,n)}}function p(e){var t=(0,u.uq)(e);if(0!==t.length){for(var n,r=0,a=l(t);!(n=a()).done;){var o=n.value,d=(0,s.t_)(o,1953658222);if(null===d)return;var c=0,f=d[c];if(c+=1,f>1)return;var p=(0,i.QI)(d,c);c+=3;var h=(256&p)>0,m=0;if(!h&&void 0===(m=v(o)))return;var g=(1&p)>0,y=(4&p)>0,_=(512&p)>0,b=(1024&p)>0,S=(2048&p)>0,T=(0,i.pX)(d,c);c+=4,g&&(c+=4),y&&(c+=4);for(var E=T,k=0;E-- >0;)h?(k+=(0,i.pX)(d,c),c+=4):k+=m,_&&(c+=4),b&&(c+=4),S&&(c+=4);r+=k}return r}}function h(e){var t=(0,u.fs)(e);if(null!==t){var n=(0,s.t_)(t,1835296868);if(null!==n){var r=0,a=n[r];return r+=4,1===a?(0,i.pX)(n,r+16):0===a?(0,i.pX)(n,r+8):void 0}}}function m(e){var t=e.length;if(t<4)throw new Error("Cannot update box length: box too short");var n=(0,i.pX)(e,0);if(0===n){if(t>o.s){var r=new Uint8Array(t+8);return r.set((0,i.kh)(1),0),r.set(e.subarray(4,8),4),r.set((0,i.el)(t+8),8),r.set(e.subarray(8,t),16),r}return e.set((0,i.kh)(t),0),e}if(1===n){if(t<16)throw new Error("Cannot update box length: box too short");return e.set((0,i.el)(t),8),e}if(t<=o.s)return e.set((0,i.kh)(t),0),e;var a=new Uint8Array(t+8);return a.set((0,i.kh)(1),0),a.set(e.subarray(4,8),4),a.set((0,i.el)(t+8),8),a.set(e.subarray(8,t),16),a}function g(e){for(var t=[],n=0;n0)throw new Error("Unhandled version: "+s);var c=(0,r.dN)(e,t);t+=4;var f=(0,r.dN)(e,t);t+=4;var v=(0,i.uR)(e.subarray(t,t+4));t+=4;var p=(0,r.qb)(e,t);t+=2;var h=(0,r.qb)(e,t),m=[e[t+=2],e[t+1]].join(":"),g=1===e[t+=2];t=64;var y=[];if(0===c)throw new Error("bif: no images to parse");for(var _=0,b=null;t0,this._isEMSGWhitelisted=c}var t=e.prototype;return t.getInitSegment=function(){return(0,a.Z)(this._index,this._isEMSGWhitelisted)},t.getSegments=function(e,t){return(0,o.Z)(this._index,e,t,this._isEMSGWhitelisted,this._scaledPeriodEnd)},t.shouldRefresh=function(){return!1},t.getFirstAvailablePosition=function(){var e=this._index;return 0===e.timeline.length?null:(0,i.zG)(Math.max(this._scaledPeriodStart,e.timeline[0].start),e)},t.getLastAvailablePosition=function(){var e,t=this._index.timeline;if(0===t.length)return null;var n=t[t.length-1],r=Math.min((0,i.jH)(n,null,this._scaledPeriodEnd),null!==(e=this._scaledPeriodEnd)&&void 0!==e?e:1/0);return(0,i.zG)(r,this._index)},t.getEnd=function(){return this.getLastAvailablePosition()},t.awaitSegmentBetween=function(){return!1},t.isSegmentStillAvailable=function(){return!0},t.checkDiscontinuity=function(){return null},t.initializeIndex=function(e){for(var t=0;t0?Math.floor(u/s):0),I=T+A*S;Ih)break;var R=null===v?null:(0,i.QB)(I,Z)(v),x=I-e.indexTimeOffset,M=S;x<0&&(M=S+x,x=0);var C={id:String(I),time:x/f,end:(x+M)/f,duration:M/f,isInit:!1,range:E,timescale:1,url:R,number:Z,timestampOffset:-e.indexTimeOffset/f,complete:w,privateInfos:{isEMSGWhitelisted:a}};g.push(C),I=T+ ++A*S}if(I>=d)return g;if(m+=k+1,void 0!==h&&m>h)return g}return g}},4784:function(e,t,n){"use strict";n.d(t,{QB:function(){return o},zA:function(){return a}});var r=n(6923);function i(e){return function(t,n,i){var a,o,s,u=(0,r.Z)(i)?parseInt(i,10):1;return a=String(e),o=u,(s=a.toString()).length>=o?s:(new Array(o+1).join("0")+s).slice(-o)}}function a(e,t,n){return function(e,t,n){return-1===e.indexOf("$")?e:e.replace(/\$\$/g,"$").replace(/\$RepresentationID\$/g,String(t)).replace(/\$Bandwidth(\%0(\d+)d)?\$/g,i(void 0===n?0:n))}(e,t,n)}function o(e,t){return function(n){return-1===n.indexOf("$")?n:n.replace(/\$\$/g,"$").replace(/\$Number(\%0(\d+)d)?\$/g,(function(e,n,r){if(void 0===t)throw new Error("Segment number not defined in a $Number$ scheme");return i(t)(e,n,r)})).replace(/\$Time(\%0(\d+)d)?\$/g,(function(t,n,r){if(void 0===e)throw new Error("Segment time not defined in a $Time$ scheme");return i(e)(t,n,r)}))}}},4541:function(e,t,n){"use strict";n.d(t,{Z:function(){return je}});var r=n(7904),i=n(1946),a=n(6872),o=n(3887),s=n(3274),u=n(9829);function l(e){var t=Date.parse(e)-performance.now();if(!isNaN(t))return t;o.Z.warn("DASH Parser: Invalid clock received: ",e)}function d(e){for(var t=e.representations,n=null,r=0;r=0;t--){var n=e[t].adaptations,r=void 0===n.audio?void 0:n.audio[0],i=void 0===n.video?void 0:n.video[0];if(void 0!==r||void 0!==i){var a=null,s=null;if(void 0!==r){var u=d(r);if(void 0===u)return{safe:void 0,unsafe:void 0};a=u}if(void 0!==i){var l=d(i);if(void 0===l)return{safe:void 0,unsafe:void 0};s=l}if(void 0!==r&&null===a||void 0!==i&&null===s)return o.Z.info("Parser utils: found Period with no segment. ","Going to previous one to calculate last position"),{safe:void 0,unsafe:void 0};if(null!==s)return null!==a?{safe:Math.min(a,s),unsafe:Math.max(a,s)}:{safe:s,unsafe:s};if(null!==a)return{safe:a,unsafe:a}}}return{safe:void 0,unsafe:void 0}}(e);return{minimumSafePosition:t,maximumSafePosition:n.safe,maximumUnsafePosition:n.unsafe}}var v=n(9592),p=n(908),h=n(1679),m=n(3635);var g=function(){function e(e){this._isDynamic=e.isDynamic,this._timeShiftBufferDepth=e.isDynamic&&void 0!==e.timeShiftBufferDepth?e.timeShiftBufferDepth:null}var t=e.prototype;return t.setLastPosition=function(e,t){this._lastPosition=e,this._positionTime=t},t.lastPositionIsKnown=function(){return this._isDynamic?null!=this._positionTime&&null!=this._lastPosition:null!=this._lastPosition},t.estimateMinimumBound=function(){if(!this._isDynamic||null===this._timeShiftBufferDepth)return 0;var e=this.estimateMaximumBound();return void 0!==e?e-this._timeShiftBufferDepth:void 0},t.estimateMaximumBound=function(){return this._isDynamic&&null!=this._positionTime&&null!=this._lastPosition?Math.max(this._lastPosition-this._positionTime+performance.now()/1e3,0):this._lastPosition},e}(),y=n(8999),_=n(5138),b=n(7714),S=n(6923);function T(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return E(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return E(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function E(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0){var s=i-a.start;if(s%a.duration==0&&s/a.duration<=a.repeatCount)return{repeatNumberInPrevSegments:s/a.duration,prevSegmentsIdx:o,newElementsIdx:0,repeatNumberInNewElements:0}}if(++o>=e.length)return null;if((a=e[o]).start===i)return{prevSegmentsIdx:o,newElementsIdx:0,repeatNumberInPrevSegments:0,repeatNumberInNewElements:0};if(a.start>i)return null}else for(var u=0,l=t[0],d=i;;){var c=l.getAttribute("d"),f=null===c?null:parseInt(c,10);if(null===f||Number.isNaN(f))return null;var v=l.getAttribute("r"),p=null===v?null:parseInt(v,10);if(null!==p){if(Number.isNaN(p)||p<0)return null;if(p>0){var h=n-d;if(h%f==0&&h/f<=p)return{repeatNumberInPrevSegments:0,repeatNumberInNewElements:h/f,prevSegmentsIdx:0,newElementsIdx:u}}d+=f*(p+1)}else d+=f;if(++u>=t.length)return null;var m=(l=t[u]).getAttribute("t"),g=null===m?null:parseInt(m,10);if(null!==g){if(Number.isNaN(g))return null;d=g}if(d===n)return{newElementsIdx:u,prevSegmentsIdx:0,repeatNumberInPrevSegments:0,repeatNumberInNewElements:0};if(d>i)return null}}(t,e);if(null===r)return o.Z.warn('DASH: Cannot perform "based" update. Common segment not found.'),z(e);var i=r.prevSegmentsIdx,a=r.newElementsIdx,s=r.repeatNumberInPrevSegments,u=r.repeatNumberInNewElements,l=t.length-i+a-1;if(l>=e.length)return o.Z.info('DASH: Cannot perform "based" update. New timeline too short'),z(e);var d=t.slice(i);if(s>0){var c=d[0];c.start+=c.duration*s,d[0].repeatCount-=s}if(u>0&&0!==a)return o.Z.info('DASH: Cannot perform "based" update. The new timeline has a different form.'),z(e);var f=d[d.length-1],v=V(e[l]),p=(null!==(n=v.repeatCount)&&void 0!==n?n:0)-u;if(v.duration!==f.duration||f.repeatCount>p)return o.Z.info('DASH: Cannot perform "based" update. The new timeline has a different form at the beginning.'),z(e);void 0!==v.repeatCount&&v.repeatCount>f.repeatCount&&(f.repeatCount=v.repeatCount);for(var h=[],m=[],g=l+1;g0){var s=i[i.length-1];if((0,R.jH)(s,null,this._scaledPeriodEnd)+a>=Math.min(o,null!==(n=this._scaledPeriodEnd)&&void 0!==n?n:1/0))return!1}return void 0===this._scaledPeriodEnd?o+a>this._scaledPeriodStart&&void 0:(0,R.gT)(e,this._index)-athis._scaledPeriodStart},t.isSegmentStillAvailable=function(e){if(e.isInit)return!0;this._refreshTimeline(),null===this._index.timeline&&(this._index.timeline=this._getTimeline());var t=this._index,n=t.timeline,r=t.timescale,i=t.indexTimeOffset;return(0,O.Z)(e,n,r,i)},t.checkDiscontinuity=function(e){this._refreshTimeline();var t=this._index.timeline;return null===t&&(t=this._getTimeline(),this._index.timeline=t),(0,R._j)({timeline:t,timescale:this._index.timescale,indexTimeOffset:this._index.indexTimeOffset},e,this._scaledPeriodEnd)},t.canBeOutOfSyncError=function(e){return!!this._isDynamic&&(e instanceof P.Z&&e.isHttpError(404))},t._replace=function(e){this._parseTimeline=e._parseTimeline,this._index=e._index,this._isDynamic=e._isDynamic,this._scaledPeriodStart=e._scaledPeriodStart,this._scaledPeriodEnd=e._scaledPeriodEnd,this._lastUpdate=e._lastUpdate,this._manifestBoundsCalculator=e._manifestBoundsCalculator,this._isLastPeriod=e._isLastPeriod},t._update=function(e){null===this._index.timeline&&(this._index.timeline=this._getTimeline()),null===e._index.timeline&&(e._index.timeline=e._getTimeline()),(0,L.Z)(this._index.timeline,e._index.timeline)&&(this._index.startNumber=e._index.startNumber),this._index.endNumber=e._index.endNumber,this._isDynamic=e._isDynamic,this._scaledPeriodStart=e._scaledPeriodStart,this._scaledPeriodEnd=e._scaledPeriodEnd,this._lastUpdate=e._lastUpdate,this._isLastPeriod=e._isLastPeriod},t.isFinished=function(){if(!this._isDynamic||!this._isLastPeriod)return!0;null===this._index.timeline&&(this._index.timeline=this._getTimeline());var e=this._index.timeline;if(void 0===this._scaledPeriodEnd||0===e.length)return!1;var t=e[e.length-1];return(0,R.jH)(t,null,this._scaledPeriodEnd)+B(this._index.timescale)>=this._scaledPeriodEnd},t.isInitialized=function(){return!0},e.isTimelineIndexArgument=function(e){return"function"==typeof e.timelineParser||Array.isArray(e.timeline)},t._refreshTimeline=function(){if(null===this._index.timeline&&(this._index.timeline=this._getTimeline()),this._isDynamic){var e=this._manifestBoundsCalculator.estimateMinimumBound();if(null!=e){var t=(0,R.gT)(e,this._index),n=(0,N.Z)(this._index.timeline,t);void 0!==this._index.startNumber?this._index.startNumber+=n:void 0!==this._index.endNumber&&(this._index.startNumber=n+1)}}},e.getIndexEnd=function(e,t){return e.length<=0?null:Math.min((0,R.jH)(e[e.length-1],null,t),null!=t?t:1/0)},t._getTimeline=function(){if(null===this._parseTimeline)return null!==this._index.timeline?this._index.timeline:(o.Z.error("DASH: Timeline already lazily parsed."),[]);var e=this._parseTimeline();this._parseTimeline=null;var t,n=a.Z.getCurrent().MIN_DASH_S_ELEMENTS_TO_PARSE_UNSAFELY;return null===this._unsafelyBaseOnPreviousIndex||e.lengthn){if(r===n+1)return e.slice(0,i+1);var o=e.slice(0,i),s=Object.assign({},a),u=r-a.repeatCount-1;return s.repeatCount=Math.max(0,n-u),o.push(s),o}}return e}var H=G,j=function(){function e(e,t){var n,r,i=t.aggressiveMode,a=t.availabilityTimeOffset,o=t.manifestBoundsCalculator,s=t.isDynamic,u=t.periodEnd,l=t.periodStart,d=t.representationId,c=t.representationBitrate,f=t.isEMSGWhitelisted,v=null!==(n=e.timescale)&&void 0!==n?n:1;this._availabilityTimeOffset=a,this._manifestBoundsCalculator=o,this._aggressiveMode=i;var p=null!=e.presentationTimeOffset?e.presentationTimeOffset:0,h=p-l*v;if(void 0===e.duration)throw new Error("Invalid SegmentTemplate: no duration");var m=void 0===(null===(r=e.initialization)||void 0===r?void 0:r.media)?null:(0,M.zA)(e.initialization.media,d,c),g=void 0===e.media?null:(0,M.zA)(e.media,d,c);this._index={duration:e.duration,timescale:v,indexRange:e.indexRange,indexTimeOffset:h,initialization:null==e.initialization?void 0:{url:m,range:e.initialization.range},url:g,presentationTimeOffset:p,startNumber:e.startNumber,endNumber:e.endNumber},this._isDynamic=s,this._periodStart=l,this._scaledRelativePeriodEnd=void 0===u?void 0:(u-l)*v,this._isEMSGWhitelisted=f}var t=e.prototype;return t.getInitSegment=function(){return(0,x.Z)(this._index,this._isEMSGWhitelisted)},t.getSegments=function(e,t){var n=this._index,r=n.duration,i=n.startNumber,a=n.endNumber,o=n.timescale,s=n.url,u=this._periodStart*o,l=this._scaledRelativePeriodEnd,d=e*o-u,c=(e+t)*o-u,f=this._getFirstSegmentStart(),v=this._getLastSegmentStart();if(null==f||null==v)return[];var p=Math.max(f,d),h=Math.min(v,c);if(h+r<=p)return[];for(var m=[],g=null!=i?i:1,y=Math.floor(p/r),_=y*r;_<=h;_+=r){var b=y+g;if(void 0!==a&&b>a)return m;var S=null!=l&&_+r>l?l-_:r,T=_+u,E=_+this._index.presentationTimeOffset,k=null===s?null:(0,M.QB)(E,b)(s),w={id:String(b),number:b,time:T/o,end:(T+S)/o,duration:S/o,timescale:1,isInit:!1,scaledDuration:S/o,url:k,timestampOffset:-n.indexTimeOffset/o,complete:!0,privateInfos:{isEMSGWhitelisted:this._isEMSGWhitelisted}};m.push(w),y++}return m},t.getFirstAvailablePosition=function(){var e=this._getFirstSegmentStart();return null==e?e:e/this._index.timescale+this._periodStart},t.getLastAvailablePosition=function(){var e=this._getLastSegmentStart();if((0,i.Z)(e))return e;var t=this._estimateRelativeScaledEnd();return Math.min(e+this._index.duration,null!=t?t:1/0)/this._index.timescale+this._periodStart},t.getEnd=function(){if(!this._isDynamic)return this.getLastAvailablePosition();var e=this._estimateRelativeScaledEnd();if(void 0!==e){var t=this._index.timescale;return(e+this._periodStart*t)/t}},t.awaitSegmentBetween=function(e,t){if((0,D.Z)(e<=t),!this._isDynamic)return!1;var n=this._index.timescale,r=B(n),i=this._periodStart*n,a=t*n-i,o=this._estimateRelativeScaledEnd();return void 0===o?a+r>=0:e*n-i-r=e},t.isInitialized=function(){return!0},t._replace=function(e){this._index=e._index,this._aggressiveMode=e._aggressiveMode,this._isDynamic=e._isDynamic,this._periodStart=e._periodStart,this._scaledRelativePeriodEnd=e._scaledRelativePeriodEnd,this._manifestBoundsCalculator=e._manifestBoundsCalculator},t._update=function(e){this._replace(e)},t._getFirstSegmentStart=function(){if(!this._isDynamic)return 0;if(0===this._scaledRelativePeriodEnd||void 0===this._scaledRelativePeriodEnd){var e=this._manifestBoundsCalculator.estimateMaximumBound();if(void 0!==e&&ethis._periodStart?(i-this._periodStart)*r:0;return Math.floor(a/n)*n}},t._getLastSegmentStart=function(){var e,t=this._index,n=t.duration,r=t.timescale,i=t.endNumber,o=t.startNumber,s=void 0===o?1:o;if(this._isDynamic){var u=this._manifestBoundsCalculator.estimateMaximumBound();if(void 0===u)return;var l=this._aggressiveMode?n/r:0;if(void 0!==this._scaledRelativePeriodEnd&&this._scaledRelativePeriodEnd<(u+l-this._periodStart)*this._index.timescale){var d=Math.ceil(this._scaledRelativePeriodEnd/n);return void 0!==i&&i-s+1g||h<2?m:(h-2)*n},t._estimateRelativeScaledEnd=function(){var e,t;if(void 0!==this._index.endNumber){var n=this._index.endNumber-(null!==(e=this._index.startNumber)&&void 0!==e?e:1)+1;return Math.max(Math.min(n*this._index.duration,null!==(t=this._scaledRelativePeriodEnd)&&void 0!==t?t:1/0),0)}if(void 0!==this._scaledRelativePeriodEnd)return Math.max(this._scaledRelativePeriodEnd,0)},e}();function q(e,t){var n;if(0===t.length)return e;var r=t.map((function(e){return{url:e.value}}));if(0===e.length)return r;for(var i=[],a=0;a=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function X(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0){var y=t.parentSegmentTemplates.slice(),_=e.children.segmentTemplate;void 0!==_&&y.push(_);var b=I.Z.apply(void 0,[{}].concat(y));h.availabilityTimeComplete=null!==(n=b.availabilityTimeComplete)&&void 0!==n?n:t.availabilityTimeComplete,h.availabilityTimeOffset=(null!==(r=b.availabilityTimeOffset)&&void 0!==r?r:0)+t.availabilityTimeOffset,i=H.isTimelineIndexArgument(b)?new H(b,h):new j(b,h)}else{var S=t.adaptation.children;if(void 0!==S.segmentBase){var T=S.segmentBase;i=new Z.Z(T,h)}else if(void 0!==S.segmentList){var E=S.segmentList;i=new C(E,h)}else i=new j({duration:Number.MAX_VALUE,timescale:1,startNumber:0,media:""},h)}return i}(e,(0,I.Z)({},n,{availabilityTimeOffset:m,availabilityTimeComplete:h,unsafelyBaseOnPreviousRepresentation:v,adaptation:t,inbandEventStreams:p}));null==e.attributes.bitrate?(o.Z.warn("DASH: No usable bitrate found in the Representation."),f=0):f=e.attributes.bitrate;var y,_=q(n.baseURLs,e.children.baseURLs),b={bitrate:f,cdnMetadata:0===_.length?[{baseUrl:"",id:void 0}]:_.map((function(e){return{baseUrl:e.url,id:e.serviceLocation}})),index:g,isSpatialAudio:!(!e.children.supplementalProperties||!(0,s.Z)(e.children.supplementalProperties,(function(e){return"JOC"===e.value}))),id:c};null!=e.attributes.codecs?y=e.attributes.codecs:null!=t.attributes.codecs&&(y=t.attributes.codecs),null!=y&&(y="mp4a.40.02"===y?"mp4a.40.2":y,b.codecs=y),null!=e.attributes.frameRate?b.frameRate=e.attributes.frameRate:null!=t.attributes.frameRate&&(b.frameRate=t.attributes.frameRate),null!=e.attributes.height?b.height=e.attributes.height:null!=t.attributes.height&&(b.height=t.attributes.height),null!=e.attributes.mimeType?b.mimeType=e.attributes.mimeType:null!=t.attributes.mimeType&&(b.mimeType=t.attributes.mimeType),null!=e.attributes.width?b.width=e.attributes.width:null!=t.attributes.width&&(b.width=t.attributes.width);var S=void 0!==t.children.contentProtections?t.children.contentProtections:[];if(void 0!==e.children.contentProtections&&S.push.apply(S,e.children.contentProtections),S.length>0){var T=S.reduce((function(e,t){var n;if(void 0!==t.attributes.schemeIdUri&&"urn:uuid:"===t.attributes.schemeIdUri.substring(0,9)&&(n=t.attributes.schemeIdUri.substring(9).replace(/-/g,"").toLowerCase()),void 0!==t.attributes.keyId&&t.attributes.keyId.length>0){var r={keyId:t.attributes.keyId,systemId:n};void 0===e.keyIds?e.keyIds=[r]:e.keyIds.push(r)}if(void 0!==n){for(var i,a=[],o=Y(t.children.cencPssh);!(i=o()).done;){var u=i.value;a.push({systemId:n,data:u})}if(a.length>0){var l,d=(0,s.Z)(e.initData,(function(e){return"cenc"===e.type}));if(void 0===d)e.initData.push({type:"cenc",values:a});else(l=d.values).push.apply(l,a)}}return e}),{keyIds:void 0,initData:[]});(Object.keys(T.initData).length>0||void 0!==T.keyIds&&T.keyIds.length>0)&&(b.contentProtections=T)}b.hdrInfo=Q({adaptationProfiles:t.attributes.profiles,supplementalProperties:t.children.supplementalProperties,essentialProperties:t.children.essentialProperties,manifestProfiles:n.manifestProfiles,codecs:y}),d.push(b)},f=Y(e);!(l=f()).done;)c();return d}function J(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return ee(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ee(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ee(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ue(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&(n.sort(oe),e[t]=n.map((function(e){return e[0]}))),e}),{});return d.video.sort(oe),k(le,c),le}(I.children.adaptations,V),K=(null!==(u=t.xmlNamespaces)&&void 0!==u?u:[]).concat(null!==(l=I.attributes.namespaces)&&void 0!==l?l:[]),G=function(e,t,n){for(var r,i,a,o=[],s=se(e);!(a=s()).done;)for(var u,l=a.value,d=l.attributes,c=d.schemeIdUri,f=void 0===c?"":c,v=d.timescale,p=void 0===v?1:v,h=n.concat(null!==(r=l.attributes.namespaces)&&void 0!==r?r:[]),g=se(l.children.events);!(u=g()).done;){var y=u.value;if(void 0!==y.eventStreamData){var _=(null!==(i=y.presentationTime)&&void 0!==i?i:0)/p+t,b=void 0===y.duration?void 0:_+y.duration/p,S=void 0;if(y.eventStreamData instanceof Element)S=y.eventStreamData;else{var T=h.reduce((function(e,t){return e+"xmlns:"+t.key+'="'+t.value+'" '}),"","application/xml").documentElement.childNodes[0]}o.push({start:_,end:b,id:y.id,data:{type:"dash-event-stream",value:{schemeIdUri:f,timescale:p,element:S}}})}}return o}(I.children.eventStreams,M,K),W={id:g,start:M,end:P,duration:C,adaptations:z,streamEvents:G};if(d.unshift(W),!T.lastPositionIsKnown()){var H=function(e){for(var t,n=null,r=!0,i=(0,h.Z)(e).filter((function(e){return null!=e})),a=se((0,v.Z)(i,(function(e){return e})));!(t=a()).done;)for(var o,s=se(t.value.representations);!(o=s()).done;){var u=o.value.index.getLastAvailablePosition();null!==u&&(r=!1,"number"==typeof u&&(n=null==n?u:Math.max(n,u)))}if(null!=n)return n;if(r)return null;return}(z);if(f)if("number"==typeof H){var j=performance.now()/1e3;T.setLastPosition(H,j)}else{var Y=ce(t,M);if(void 0!==Y){var X=Y[0],Q=Y[1];T.setLastPosition(X,Q)}}else"number"==typeof H&&T.setLastPosition(H)}},w=e.length-1;w>=0;w--)E();if(t.isDynamic&&!T.lastPositionIsKnown()){var I=ce(t,0);if(void 0!==I){var Z=I[0],R=I[1];T.setLastPosition(Z,R)}}return function(e){if(0===e.length)return[];for(var t=[e[0]],n=1;nr.start)&&(o.Z.warn("DASH: Updating overlapping Periods.",null==i?void 0:i.start,r.start),i.duration=r.start-i.start,i.end=r.start,!(i.duration>0));)t.pop(),i=t[t.length-1];t.push(r)}return t}(d)}function ce(e,t){if(null!=e.clockOffset){var n=e.clockOffset/1e3-e.availabilityStartTime,r=performance.now()/1e3,i=r+n;if(i>=t)return[i,r]}else{var a=Date.now()/1e3;if(a>=t)return o.Z.warn("DASH Parser: no clock synchronization mechanism found. Using the system clock instead."),[a-e.availabilityStartTime,performance.now()/1e3]}}function fe(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return ve(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ve(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ve(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0?t[0].value:void 0}(t);if(null!=y&&y.length>0)return{type:"needs-clock",value:{url:y,continue:function(i){return i.success?(n.externalClockOffset=l(i.data),e(t,n,r,!0)):(r.push(i.error),o.Z.warn("DASH Parser: Error on fetching the clock ressource",i.error),e(t,n,r,!0))}}}}}for(var _=[],b=0;b=0&&(d=0===h.minimumUpdatePeriod?a.Z.getCurrent().DASH_FALLBACK_LIFETIME_WHEN_MINIMUM_UPDATE_PERIOD_EQUAL_0:h.minimumUpdatePeriod);var I=f(k),Z=I.minimumSafePosition,R=I.maximumSafePosition,x=I.maximumUnsafePosition,M=performance.now();if(m){var C,P;if(c=Z,A=null!=b?b:null,void 0!==x&&(P=x),void 0!==R)C=R;else{var D=null!=_?_:0,N=t.externalClockOffset;if(void 0===N)o.Z.warn("DASH Parser: use system clock to define maximum position"),C=Date.now()/1e3-D;else C=(performance.now()+N)/1e3-D}void 0===P&&(P=C),v={isLinear:!0,maximumSafePosition:C,livePosition:P,time:M},null!==A&&void 0!==c&&C-c>A&&(A=C-c)}else{c=void 0!==Z?Z:void 0!==(null===(i=k[0])||void 0===i?void 0:i.start)?k[0].start:0;var O=null!=w?w:1/0;if(void 0!==k[k.length-1]){var L=k[k.length-1],U=null!==(s=L.end)&&void 0!==s?s:void 0!==L.duration?L.start+L.duration:void 0;void 0!==U&&U=0;o--){var s,u=_[o].index,l=a[o],f=l.parsed,v=l.warnings,p=l.receivedTime,h=l.sendingTime,m=l.url;v.length>0&&r.push.apply(r,v);for(var g,y=fe(f);!(g=y()).done;){var b=g.value;d.set(b,{receivedTime:p,sendingTime:h,url:m})}(s=c.periods).splice.apply(s,[u,1].concat(f))}return e(t,n,r,i,d)}}}};function he(e){var t=e.textContent,n=[];return null===t||0===t.length?[void 0,n]:[{value:t},n]}function me(e){for(var t={},n=0;n0){var s=xe(a,"cenc:pssh"),u=s[0],l=s[1];null!==l&&(o.Z.warn(l.message),t.push(l)),null!==u&&n.push(u)}}}return[{cencPssh:n},t]}(e.childNodes),n=t[0],r=t[1];return[{children:n,attributes:function(e){for(var t={},n=0;n0&&(r=r.concat(c));break;case"SegmentList":var f=Ue(a),v=f[0],p=f[1];r=r.concat(p),t.segmentList=v;break;case"SegmentTemplate":var h=Fe(a),m=h[0],g=h[1];r=r.concat(g),t.segmentTemplate=m;break;case"ContentProtection":var y=De(a),_=y[0],b=y[1];b.length>0&&(r=r.concat(b)),void 0!==_&&n.push(_);break;case"SupplementalProperty":null==t.supplementalProperties?t.supplementalProperties=[Me(a)]:t.supplementalProperties.push(Me(a))}}return n.length>0&&(t.contentProtections=n),[t,r]}(e.childNodes),n=t[0],r=t[1],i=function(e){for(var t={},n=[],r=Ce(t,n),i=0;i0&&(r=r.concat(u));break;case"ContentComponent":t.contentComponent=me(a);break;case"EssentialProperty":null==t.essentialProperties?t.essentialProperties=[Me(a)]:t.essentialProperties.push(Me(a));break;case"InbandEventStream":void 0===t.inbandEventStreams&&(t.inbandEventStreams=[]),t.inbandEventStreams.push(Me(a));break;case"Label":var l=a.textContent;null!=l&&(t.label=l);break;case"Representation":var d=Ve(a),c=d[0],f=d[1];t.representations.push(c),f.length>0&&(r=r.concat(f));break;case"Role":null==t.roles?t.roles=[Me(a)]:t.roles.push(Me(a));break;case"SupplementalProperty":null==t.supplementalProperties?t.supplementalProperties=[Me(a)]:t.supplementalProperties.push(Me(a));break;case"SegmentBase":var v=Oe(a),p=v[0],h=v[1];t.segmentBase=p,h.length>0&&(r=r.concat(h));break;case"SegmentList":var m=Ue(a),g=m[0],y=m[1];t.segmentList=g,y.length>0&&(r=r.concat(y));break;case"SegmentTemplate":var _=Fe(a),b=_[0],S=_[1];t.segmentTemplate=b,S.length>0&&(r=r.concat(S));break;case"ContentProtection":var T=De(a),E=T[0],k=T[1];k.length>0&&(r=r.concat(k)),void 0!==E&&n.push(E)}}return n.length>0&&(t.contentProtections=n),[t,r]}(e.childNodes),n=t[0],r=t[1],i=function(e){for(var t={},n=[],r=Ce(t,n),i=0;i0&&(n=n.concat(d))}}return[t,n]}function Ge(e){for(var t={eventStreamData:e},n=[],r=Ce(t,n),i=0;i0&&(i=i.concat(_))}}return[{baseURLs:n,adaptations:r,eventStreams:a,segmentTemplate:t},i]}(e.childNodes),n=t[0],r=t[1],i=function(e){for(var t={},n=[],r=Ce(t,n),i=0;i",c=(new DOMParser).parseFromString(d,"text/xml");if(null==c||0===c.children.length)throw new Error("DASH parser: Invalid external ressources");for(var f=c.children[0].children,v=[],p=[],h=0;h0;){var r=e[0];if(r.start>=t)return n;if(-1===r.repeatCount)return n;if(0===r.repeatCount)e.shift(),n+=1;else{var i=e[1];if(void 0!==i&&i.start<=t)e.shift(),n+=1;else{if(r.duration<=0)return n;for(var a=r.start+r.duration,o=1;ar.repeatCount)){var s=r.repeatCount-o;return r.start=a,r.repeatCount=s,n+=o}e.shift(),n=r.repeatCount+1}}}return n}n.d(t,{Z:function(){return r}})},3911:function(e,t,n){"use strict";n.d(t,{KF:function(){return i},PZ:function(){return u},_j:function(){return l},gT:function(){return o},jH:function(){return a},zG:function(){return s}});var r=n(1946);function i(e,t,n){var i,a=e.repeatCount;return a>=0?a:(i=(0,r.Z)(t)?void 0!==n?n:Number.MAX_VALUE:t.start,Math.ceil((i-e.start)/e.duration)-1)}function a(e,t,n){var r=e.start,a=e.duration;return a<=0?r:r+(i(e,t,n)+1)*a}function o(e,t){var n;return e*t.timescale+(null!==(n=t.indexTimeOffset)&&void 0!==n?n:0)}function s(e,t){var n;return(e-(null!==(n=t.indexTimeOffset)&&void 0!==n?n:0))/t.timescale}function u(e,t,n){return[e*n,(e+t)*n]}function l(e,t,n){var r=e.timeline,i=o(t,e);if(i<0)return null;var u=function(e,t){for(var n=0,r=e.length;n>>1;e[i].start<=t?n=i+1:r=i}return n-1}(r,i);if(u<0||u>=r.length-1)return null;var l=r[u];if(l.duration<=0)return null;var d=r[u+1];if(void 0===d)return null;var c=d.start;return i>=a(l,d,n)&&ie.time)return!1;if(o===e.time)return void 0===a.range?void 0===e.range:null!=e.range&&a.range[0]===e.range[0]&&a.range[1]===e.range[1];if(a.repeatCount>=0&&void 0!==a.duration){var s=(o-a.start)/a.duration-1;return s%1==0&&s<=a.repeatCount}}return!1}n.d(t,{Z:function(){return r}})},5505:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var r=n(3714),i=n(3887),a=n(3911);function o(e,t){if(0===e.length)return e.push.apply(e,t),!0;if(0===t.length)return!1;var n=e.length,o=t[0].start,s=e[n-1];if((0,a.jH)(s,t[0])=0;u--){var l=e[u].start;if(l===o){var d=n-u;return e.splice.apply(e,[u,d].concat(t)),!1}if(lo)return i.Z.warn("RepresentationIndex: Manifest update removed all previous segments"),e.splice.apply(e,[0,n].concat(t)),!0;if(void 0===c.repeatCount||c.repeatCount<=0)return c.repeatCount<0&&(c.repeatCount=Math.floor((o-c.start)/c.duration)-1),e.splice.apply(e,[u+1,n-(u+1)].concat(t)),!1;if(c.start+c.duration*(c.repeatCount+1)<=o)return e.splice.apply(e,[u+1,n-(u+1)].concat(t)),!1;var f=(o-c.start)/c.duration-1;if(f%1==0&&c.duration===t[0].duration){var v=t[0].repeatCount<0?-1:t[0].repeatCount+f+1;return e.splice.apply(e,[u,n-u].concat(t)),e[u].start=c.start,e[u].repeatCount=v,!1}return i.Z.warn("RepresentationIndex: Manifest update removed previous segments"),e[u].repeatCount=Math.floor(f),e.splice.apply(e,[u+1,n-(u+1)].concat(t)),!1}}var p=e[e.length-1],h=t[t.length-1];return void 0!==p.repeatCount&&p.repeatCount<0?p.start>h.start?(i.Z.warn("RepresentationIndex: The new index is older than the previous one"),!1):(i.Z.warn('RepresentationIndex: The new index is "bigger" than the previous one'),e.splice.apply(e,[0,n].concat(t)),!0):p.start+p.duration*(p.repeatCount+1)>=h.start+h.duration*(h.repeatCount+1)?(i.Z.warn("RepresentationIndex: The new index is older than the previous one"),!1):(i.Z.warn('RepresentationIndex: The new index is "bigger" than the previous one'),e.splice.apply(e,[0,n].concat(t)),!0)}},5734:function(e,t,n){"use strict";var r=n(6923),i=/&#([0-9]+);/g,a=/
/gi,o=/]*>([\s\S]*?)<\/style[^>]*>/i,s=/\s*

]+))?>(.*)/i,u=/]+?start="?([0-9]*)"?[^0-9]/i;function l(e,t){var n=new RegExp("\\s*"+t+":\\s*(\\S+);","i").exec(e);return Array.isArray(n)?n[1]:null}t.Z=function(e,t,n){var d,c,f=/]/gi,v=/]|<\/body>/gi,p=[],h=o.exec(e),m=Array.isArray(h)?h[1]:"";v.exec(e);var g,y=function(e){for(var t=/\.(\S+)\s*{([^}]*)}/gi,n={},r=t.exec(e);null!==r;){var i=r[1],a=l(r[2],"lang");null!=i&&null!=a&&(n[a]=i),r=t.exec(e)}return n}(m),_=function(e){var t=/p\s*{([^}]*)}/gi.exec(e);return null===t?"":t[1]}(m);if((0,r.Z)(n)&&void 0===(g=y[n]))throw new Error("sami: could not find lang "+n+" in CSS");for(;d=f.exec(e),c=v.exec(e),null!==d||null!==c;){if(null===d||null===c||d.index>=c.index)throw new Error("parse error");var b=e.slice(d.index,c.index),S=u.exec(b);if(!Array.isArray(S))throw new Error("parse error (sync time attribute)");var T=+S[1];if(isNaN(T))throw new Error("parse error (sync time attribute NaN)");E(b.split("\n"),T/1e3)}return p;function E(e,n){for(var o=e.length;--o>=0;){var u=s.exec(e[o]);if(Array.isArray(u)){var l=u[1],d=u[2];if(g===l)if(" "===d)p[p.length-1].end=n;else{var c=document.createElement("DIV");c.className="rxp-texttrack-region";var f=document.createElement("DIV");f.className="rxp-texttrack-div",f.style.position="absolute",f.style.bottom="0",f.style.width="100%",f.style.color="#fff",f.style.textShadow="-1px -1px 0 #000,1px -1px 0 #000,-1px 1px 0 #000,1px 1px 0 #000";var v=document.createElement("div");v.className="rxp-texttrack-p",(0,r.Z)(_)&&(v.style.cssText=_);for(var h=d.split(a),m=0;m/gi,s=/]*>([\s\S]*?)<\/style[^>]*>/i,u=/\s*

]+))?>(.*)/i,l=/]+?start="?([0-9]*)"?[^0-9]/i;function d(e,t){var n=new RegExp("\\s*"+t+":\\s*(\\S+);","i").exec(e);return Array.isArray(n)?n[1]:null}t.Z=function(e,t,n){var c,f,v=/]/gi,p=/]|<\/body>/gi,h=[],m=s.exec(e),g=null!==m?m[1]:"";p.exec(e);var y,_=function(e){for(var t=/\.(\S+)\s*{([^}]*)}/gi,n={},r=t.exec(e);Array.isArray(r);){var i=r[1],a=d(r[2],"lang");null!=i&&null!=a&&(n[a]=i),r=t.exec(e)}return n}(g);if((0,i.Z)(n)&&void 0===(y=_[n]))throw new Error("sami: could not find lang "+n+" in CSS");for(;c=v.exec(e),f=p.exec(e),null!==c||null!==f;){if(null===c||null===f||c.index>=f.index)throw new Error("parse error");var b=e.slice(c.index,f.index),S=l.exec(b);if(null===S)throw new Error("parse error (sync time attribute)");var T=+S[1];if(isNaN(T))throw new Error("parse error (sync time attribute NaN)");E(b.split("\n"),T/1e3)}return function(e){for(var t=[],n=0;n=0;)if(null!==(r=u.exec(e[s]))){var l=r,d=l[1],c=l[2];y===d&&(" "===c?h[h.length-1].end=n:h.push({text:(i=c,i.replace(o,"\n").replace(a,(function(e,t){return String.fromCharCode(Number(t))}))),start:n+t}))}}}},2061:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(6923);function i(e,t){for(var n=t+1;(0,r.Z)(e[n]);)n++;return n}function a(e){for(var t=[],n=0;n0&&(1===o.length?o[0].indexOf("--\x3e")>=0&&t.push(o):(o[1].indexOf("--\x3e")>=0||o[0].indexOf("--\x3e")>=0)&&t.push(o)),n=a}return t}},8675:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(2061),i=n(788);function a(e,t){for(var n=e.split(/\r\n|\n|\r/),a=(0,r.Z)(n),s=[],u=0;u0){var l=document.createTextNode(o[s]);r.appendChild(l)}}else if("B"===a.nodeName){var d=e(a);d.style.fontWeight="bold",r.appendChild(d)}else if("I"===a.nodeName){var c=e(a);c.style.fontStyle="italic",r.appendChild(c)}else if("U"===a.nodeName){var f=e(a);f.style.textDecoration="underline",r.appendChild(f)}else if(u(a)&&"string"==typeof a.color){var v=e(a);v.style.color=a.color,r.appendChild(v)}else{var p=e(a);r.appendChild(p)}}return r}(t)}function u(e){return"FONT"===e.nodeName&&"color"in e}},8057:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var r=n(7253),i=n(2061),a=n(788);function o(e,t){for(var n,o,s,u,l,d=e.split(/\r\n|\n|\r/),c=(0,i.Z)(d),f=[],v=0;v0){var _=p.getAttribute("xml:space"),b=(0,l.Z)(_)?"default"===_:o,T=(0,d.Z)({},i,(0,c.U)(g,[p],n,t));u.push.apply(u,e(p,T,[p].concat(a),b))}}return u}(e,(0,d.Z)({},r),[],i)}(e,n,r,i,s),T=0;T|\u2265/g,">").replace(/\u200E/g,"‎").replace(/\u200F/g,"‏").replace(/\u00A0/g," ")}else if((0,l.OE)(s))i+="\n";else if((0,l.jg)(s)&&s.nodeType===Node.ELEMENT_NODE&&s.childNodes.length>0){var c=s.getAttribute("xml:space");i+=n(s,(0,o.Z)(c)?"default"===c:t)}}return i}return n(e,t)}(t,v),y=(0,i.Z)(h+n,m+n,g);return null===y?null:((0,a.Z)(y)&&function(e,t){var n=t.extent;if((0,o.Z)(n)){var r=u._0.exec(n);null!=r&&(e.size=Number(r[1]))}switch(t.writingMode){case"tb":case"tblr":e.vertical="lr";break;case"tbrl":e.vertical="rl"}var i=t.origin;if((0,o.Z)(i))u._0.exec(i);var a=t.align;if((0,o.Z)(a)){e.align=a,"center"===a&&("center"!==e.align&&(e.align="middle"),e.position="auto");var s=c[a];e.positionAlign=void 0===s?"":s;var l=d[a];e.lineAlign=void 0===l?"":l}}(y,r),y)}var v=function(e,t){for(var n=(0,r.Z)(e,t),i=[],a=0;a0&&(t=n)}return t}function a(e){var t=e.getElementsByTagName("body");if(t.length>0)return t[0];var n=e.getElementsByTagName("tt:body");return n.length>0?n[0]:null}function o(e){var t=e.getElementsByTagName("style");if(t.length>0)return t;var n=e.getElementsByTagName("tt:style");return n.length>0?n:t}function s(e){var t=e.getElementsByTagName("region");if(t.length>0)return t;var n=e.getElementsByTagName("tt:region");return n.length>0?n:t}function u(e){var t=e.getElementsByTagName("p");if(t.length>0)return t;var n=e.getElementsByTagName("tt:p");return n.length>0?n:t}function l(e){return"br"===e.nodeName||"tt:br"===e.nodeName}function d(e){return"span"===e.nodeName||"tt:span"===e.nodeName}n.d(t,{DM:function(){return s},H:function(){return a},OE:function(){return l},jF:function(){return i},jg:function(){return d},kd:function(){return u},vU:function(){return o}})},1138:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(6923),i=n(360);function a(e,t){for(var n=[],a=t;a=2)for(var r=function(r){var o=e[r];if(Array.isArray(/::cue {/.exec(o)))for(o=e[++r];(0,i.Z)(o)&&!Array.isArray(/}/.exec(o))&&0!==o.length;)n+=o,o=e[++r];else{for(var s=[],u=/::cue\(\.?(.*?)\)(?:,| {)/.exec(o);(0,i.Z)(o)&&Array.isArray(u);)s.push(u[1]),o=e[++r],u=/::cue\(\.?(.*?)\)(?:,| {)/.exec(o);for(var l="";(0,i.Z)(o)&&!Array.isArray(/}/.exec(o))&&0!==o.length;)l+=o,o=e[++r];s.forEach((function(e){void 0===t[e]?t[e]=l:t[e]+=l}))}a=r},a=1;a0&&n.appendChild(document.createElement("br")),o[s].length>0){var u=document.createTextNode(o[s]);n.appendChild(u)}}else{var c=e.nodeName.toLowerCase().split("."),f=[];if(c.forEach((function(e){(0,i.Z)(t[e])&&f.push(t[e])})),0!==f.length){var v=document.createAttribute("style");f.forEach((function(e){v.value+=e}));var p=(0,l.Z)(r,a)?a:"span";(n=document.createElement(p)).setAttributeNode(v)}else{var h=(0,l.Z)(r,a)?a:"span";n=document.createElement(h)}for(var m=0;m/,"").replace(/<([u,i,b,c])(\..*?)?(?: .*?)?>(.*?)<\/\1>/g,"<$1$2>$3"),r=(new DOMParser).parseFromString(n,"text/html").body.childNodes,i=[],a=0;a=2){var a=parseInt(i[1],10);isNaN(a)||(t.position=a,void 0!==i[2]&&(t.positionAlign=i[2]))}}(0,u.Z)(e.size)&&(t.size=e.size),"string"==typeof e.align&&(0,s.Z)(["start","center","end","left"],e.align)&&(t.align=e.align)}var d=n(7253);var c=function(e,t){var n=e.split(/\r\n|\n|\r/);if(!/^WEBVTT($| |\t)/.test(n[0]))throw new Error("Can't parse WebVTT: Invalid file.");for(var s,u,c,f,v=(0,o.yE)(n),p=(0,i.Z)(n,v),h=[],m=0;m/;if(o.test(e[0]))n=e[0],r=e.slice(1,e.length);else{if(!o.test(e[1]))return null;a=e[0],n=e[1],r=e.slice(2,e.length)}var s=function(e){var t=/^([\d:.]+)[ |\t]+-->[ |\t]+([\d:.]+)[ |\t]*(.*)$/.exec(e);if(null===t)return null;var n=i(t[1]),r=i(t[2]);return null==n||null==r?null:{start:n,end:r,settings:t[3].split(/ |\t/).reduce((function(e,t){var n=t.split(":");return 2===n.length&&(e[n[0]]=n[1]),e}),{})}}(n);return null===s?null:{start:s.start+t,end:s.end+t,settings:s.settings,payload:r,header:a}}},360:function(e,t,n){"use strict";n.d(t,{$4:function(){return s},JF:function(){return a},tq:function(){return o},yE:function(){return i}});var r=n(6923);function i(e){for(var t=0;t=0)return!0;var r=e[t+1];return void 0!==r&&r.indexOf("--\x3e")>=0}function s(e,t){for(var n=t+1;(0,r.Z)(e[n]);)n++;return n}},85:function(e,t,n){"use strict";n.d(t,{Z:function(){return fe}});var r=n(7874),i=n(8791),a=n(5861),o=n(4687),s=n.n(o),u=n(4597),l=n(5278),d=n(9829);function c(e,t){return null===e?null:null===t.url?e.baseUrl:(0,d.Z)(e.baseUrl,t.url)}function f(e,t,n,r,i){return v.apply(this,arguments)}function v(){return(v=(0,a.Z)(s().mark((function e(t,n,r,i,a){var o,l,d;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=n.segment,l=c(t,o),!o.isInit&&null!==l){e.next=4;break}return e.abrupt("return",{resultType:"segment-created",resultData:null});case 4:return e.next=6,(0,u.ZP)({url:l,responseType:"arraybuffer",timeout:r.timeout,onProgress:a.onProgress,cancelSignal:i});case 6:return d=e.sent,e.abrupt("return",{resultType:"segment-loaded",resultData:d});case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function p(e,t){var n=t.segment,i=t.period,a=e.data,o=e.isChunked;if(t.segment.isInit)return{segmentType:"init",initializationData:null,initializationDataSize:0,protectionDataUpdate:!1,initTimescale:void 0};if(o)throw new Error("Image data should not be downloaded in chunks");var s=(0,l.Z)(n.timestampOffset,0);return null===a||null===r.Z.imageParser?{segmentType:"media",chunkData:null,chunkSize:0,chunkInfos:{duration:n.duration,time:n.time},chunkOffset:s,protectionDataUpdate:!1,appendWindow:[i.start,i.end]}:{segmentType:"media",chunkData:{data:r.Z.imageParser(new Uint8Array(a)).thumbs,start:0,end:Number.MAX_VALUE,timescale:1,type:"bif"},chunkSize:void 0,chunkInfos:{time:0,duration:Number.MAX_VALUE},chunkOffset:s,protectionDataUpdate:!1,appendWindow:[i.start,i.end]}}var h=n(6872),m=n(8750),g=n(3887),y=n(1989),_=n(8026),b=n(3635);function S(e){var t=e.aggressiveMode,n=e.referenceDateTime,i=void 0!==e.serverSyncInfos?e.serverSyncInfos.serverTimestamp-e.serverSyncInfos.clientTime:void 0;return function(a,o,s,l,d){var c,f=a.responseData,v=o.externalClockOffset,p=null!==(c=a.url)&&void 0!==c?c:o.originalUrl,S=null!=i?i:v,T={aggressiveMode:!0===t,unsafelyBaseOnPreviousManifest:o.unsafeMode?o.previousManifest:null,url:p,referenceDateTime:n,externalClockOffset:S},E=r.Z.dashParsers;if(null===E.wasm||"uninitialized"===E.wasm.status||"failure"===E.wasm.status)return g.Z.debug("DASH: WASM MPD Parser not initialized. Running JS one."),w();var k=function(e){if(e instanceof ArrayBuffer)return e;if("string"==typeof e)return(0,b.tG)(e).buffer;if(e instanceof Document)return(0,b.tG)(e.documentElement.innerHTML).buffer;throw new Error("DASH Manifest Parser: Unrecognized Manifest format")}(f);return function(e){var t=new DataView(e);if(61371===t.getUint16(0)&&191===t.getUint8(2))return!0;if(65279===t.getUint16(0)||65534===t.getUint16(0))return!1;return!0}(k)?"initialized"===E.wasm.status?(g.Z.debug("DASH: Running WASM MPD Parser."),A(E.wasm.runWasmParser(k,T))):(g.Z.debug("DASH: Awaiting WASM initialization before parsing the MPD."),E.wasm.waitForInitialization().catch((function(){})).then((function(){return null===E.wasm||"initialized"!==E.wasm.status?(g.Z.warn("DASH: WASM MPD parser initialization failed. Running JS parser instead"),w()):(g.Z.debug("DASH: Running WASM MPD Parser."),A(E.wasm.runWasmParser(k,T)))}))):(g.Z.info("DASH: MPD doesn't seem to be UTF-8-encoded. Running JS parser instead of the WASM one."),w());function w(){if(null===E.js)throw new Error("No MPD parser is imported");var e=function(e){if(e instanceof ArrayBuffer)return(new DOMParser).parseFromString((0,b.uR)(new Uint8Array(e)),"text/xml");if("string"==typeof e)return(new DOMParser).parseFromString(e,"text/xml");if(e instanceof Document)return e;throw new Error("DASH Manifest Parser: Unrecognized Manifest format")}(f);return A(E.js(e,T))}function A(t){if("done"===t.type)return t.value.warnings.length>0&&s(t.value.warnings),l.isCancelled()?Promise.reject(l.cancellationError):{manifest:new y.ZP(t.value.parsed,e),url:p};var n=t.value,r=n.urls.map((function(e){return d((function(){var t=h.Z.getCurrent().DEFAULT_REQUEST_TIMEOUT;return"string"===n.format?(0,u.ZP)({url:e,responseType:"text",timeout:t,cancelSignal:l}):(0,u.ZP)({url:e,responseType:"arraybuffer",timeout:t,cancelSignal:l})})).then((function(e){if("string"===n.format){if("string"!=typeof e.responseData)throw new Error("External DASH resources should have been a string");return(0,_.Z)(e,{responseData:{success:!0,data:e.responseData}})}if(!(e.responseData instanceof ArrayBuffer))throw new Error("External DASH resources should have been ArrayBuffers");return(0,_.Z)(e,{responseData:{success:!0,data:e.responseData}})}),(function(e){var t=(0,m.Z)(e,{defaultCode:"PIPELINE_PARSE_ERROR",defaultReason:"An unknown error occured when parsing ressources."});return(0,_.Z)({},{size:void 0,requestDuration:void 0,responseData:{success:!1,error:t}})}))}));return Promise.all(r).then((function(e){return n.format,A(n.continue(e))}))}}}var T=n(7839),E=n(9105),k=n(5992),w=n(1946),A="function"==typeof Headers?Headers:null,I="function"==typeof AbortController?AbortController:null;function Z(){return"function"==typeof window.fetch&&!(0,w.Z)(I)&&!(0,w.Z)(A)}var R=n(8806),x=n(281);function M(e,t){return"audio"===e||"video"===e?"video/mp4"===t.mimeType||"audio/mp4"===t.mimeType?"mp4":"video/webm"===t.mimeType||"audio/webm"===t.mimeType?"webm":void 0:"text"===e&&"application/mp4"===t.mimeType?"mp4":void 0}var C=n(288),P=n(4460);function D(e){return function(t,n,r,i,a){return new Promise((function(s,u){var l=new C.ZP,d=l.linkToSignal(i);function c(){l.signal.deregister(u),d()}l.signal.register(u),e(t,n,r,l.signal,Object.assign(Object.assign({},a),{onNewChunk:function(e){try{o(e),a.onNewChunk(e)}catch(e){c(),l.cancel(),u(e)}}})).then((function(e){if(c(),!l.isUsed()){if("segment-loaded"===e.resultType)try{o(e.resultData.responseData)}catch(e){return void u(e)}s(e)}}),(function(e){c(),u(e)}))}));function o(e){(e instanceof ArrayBuffer||e instanceof Uint8Array)&&"mp4"===M(n.adaptation.type,n.representation)&&(0,P.Z)(new Uint8Array(e),n.segment.isInit)}}}var N=n(6968);function O(e,t,n,r,i){if(void 0===t.range)return(0,u.ZP)({url:e,responseType:"arraybuffer",timeout:n.timeout,cancelSignal:r,onProgress:i.onProgress}).then((function(e){return{resultType:"segment-loaded",resultData:e}}));if(void 0===t.indexRange)return(0,u.ZP)({url:e,headers:{Range:(0,x.Z)(t.range)},responseType:"arraybuffer",timeout:n.timeout,cancelSignal:r,onProgress:i.onProgress}).then((function(e){return{resultType:"segment-loaded",resultData:e}}));if(t.range[1]+1===t.indexRange[0])return(0,u.ZP)({url:e,headers:{Range:(0,x.Z)([t.range[0],t.indexRange[1]])},responseType:"arraybuffer",timeout:n.timeout,cancelSignal:r,onProgress:i.onProgress}).then((function(e){return{resultType:"segment-loaded",resultData:e}}));var a=(0,u.ZP)({url:e,headers:{Range:(0,x.Z)(t.range)},responseType:"arraybuffer",timeout:n.timeout,cancelSignal:r,onProgress:i.onProgress}),o=(0,u.ZP)({url:e,headers:{Range:(0,x.Z)(t.indexRange)},responseType:"arraybuffer",timeout:n.timeout,cancelSignal:r,onProgress:i.onProgress});return Promise.all([a,o]).then((function(t){var n=t[0],r=t[1],i=(0,N.zo)(new Uint8Array(n.responseData),new Uint8Array(r.responseData)),a=Math.min(n.sendingTime,r.sendingTime),o=Math.max(n.receivedTime,r.receivedTime);return{resultType:"segment-loaded",resultData:{url:e,responseData:i,size:n.size+r.size,requestDuration:o-a,sendingTime:a,receivedTime:o}}}))}var L=n(8766);function U(e,t,n,r,i){var o=t.segment,u=void 0!==o.range?{Range:(0,x.Z)(o.range)}:void 0,l=null;return function(e){var t;if(!(0,w.Z)(e.headers))if((0,w.Z)(A))t=e.headers;else{t=new A;for(var n=Object.keys(e.headers),r=0;r=300)throw g.Z.warn("Fetch: Request HTTP Error",t.status,t.url),new E.Z(t.url,t.status,k.br.ERROR_HTTP_CODE);if((0,w.Z)(t.body))throw new E.Z(t.url,t.status,k.br.PARSE_ERROR);var n=t.headers.get("Content-Length"),r=(0,w.Z)(n)||isNaN(+n)?void 0:+n,i=t.body.getReader(),u=0;return l();function l(){return c.apply(this,arguments)}function c(){return(c=(0,a.Z)(s().mark((function n(){var a,o,c,f,p;return s().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,i.read();case 2:if((a=n.sent).done||(0,w.Z)(a.value)){n.next=11;break}return u+=a.value.byteLength,o=performance.now(),c={url:t.url,currentTime:o,duration:o-d,sendingTime:d,chunkSize:a.value.byteLength,chunk:a.value.buffer,size:u,totalSize:r},e.onData(c),n.abrupt("return",l());case 11:if(!a.done){n.next=16;break}return v(),f=performance.now(),p=f-d,n.abrupt("return",{requestDuration:p,receivedTime:f,sendingTime:d,size:u,status:t.status,url:t.url});case 16:return n.abrupt("return",l());case 17:case"end":return n.stop()}}),n)})))).apply(this,arguments)}})).catch((function(t){if(null!==u)throw u;if(v(),l)throw g.Z.warn("Fetch: Request timeouted."),new E.Z(e.url,0,k.br.TIMEOUT);if(t instanceof E.Z)throw t;throw g.Z.warn("Fetch: Request Error",t instanceof Error?t.toString():""),new E.Z(e.url,0,k.br.ERROR_EVENT)}))}({url:e,headers:u,onData:function(e){var t=new Uint8Array(e.chunk),n=function(e){for(var t=0,n=[];te.length)return[n,r];var o=(0,L.Z)(r,1835295092);if(o<0)return[n,r];var s=t+o+(0,N.pX)(e,o+t);if(s>e.length)return[n,r];var u=Math.max(a,s),l=e.subarray(t,u);n.push(l),t=u}return[n,null]}(null!==l?(0,N.zo)(l,t):t),a=n[0];l=n[1];for(var o=0;o0)for(var v=0;v=Math.pow(2,8-n))return n}function te(e,t){var n=ee(e,t);if(null==n)return g.Z.warn("webm: unrepresentable length"),null;if(t+n>e.length)return g.Z.warn("webm: impossible length"),null;for(var r=0,i=0;ie.length)return g.Z.warn("webm: impossible length"),null;for(var r=(e[t]&(1<<8-n)-1)*Math.pow(2,8*(n-1)),i=1;i=i)return!0}return!1}(r,t);return{inbandEvents:a,needsManifestRefresh:o}}}function se(e){var t=e.__priv_patchLastSegmentInSidx;return function(e,n,r){var i,a=n.period,o=n.adaptation,s=n.representation,u=n.segment,d=n.manifest,c=e.data,f=e.isChunked,v=[a.start,a.end];if(null===c)return u.isInit?{segmentType:"init",initializationData:null,initializationDataSize:0,protectionDataUpdate:!1,initTimescale:void 0}:{segmentType:"media",chunkData:null,chunkSize:0,chunkInfos:null,chunkOffset:0,protectionDataUpdate:!1,appendWindow:v};var p=c instanceof Uint8Array?c:new Uint8Array(c),h=M(o.type,s),m="mp4"===h||void 0===h,g=!1;if(m){var y,_=(0,F.Z)(p);u.isInit&&(y=null!==(i=(0,V.R0)(p))&&void 0!==i?i:void 0),(_.length>0||void 0!==y)&&(g=s._addProtectionData("cenc",y,_))}if(!u.isInit){var b=m?ae(p,f,u,r):null,S=(0,l.Z)(u.timestampOffset,0);if(m){var T=(0,V.s9)(p);if(void 0!==T){var E=oe(T.filter((function(e){return void 0!==u.privateInfos&&void 0!==u.privateInfos.isEMSGWhitelisted&&u.privateInfos.isEMSGWhitelisted(e)})),d.publishTime);if(void 0!==E){var k=E.needsManifestRefresh,A=E.inbandEvents;return{segmentType:"media",chunkData:p,chunkSize:p.length,chunkInfos:b,chunkOffset:S,appendWindow:v,inbandEvents:A,protectionDataUpdate:g,needsManifestRefresh:k}}}}return{segmentType:"media",chunkData:p,chunkSize:p.length,chunkInfos:b,chunkOffset:S,protectionDataUpdate:g,appendWindow:v}}var I=u.indexRange,Z=null;if("webm"===h)Z=function(e,t){var n=Q(z,[],e,[t,e.length]);if(null==n)return null;var r=n[0],i=n[1],a=$(e,r);if(null==a)return null;var o=J(e,r);if(null==o)return null;var s=Q(H,[],e,[r,i]);if(null==s)return null;for(var u=[],l=s[0];l0)){var R=Z[Z.length-1];Array.isArray(R.range)&&(R.range[1]=1/0)}s.index instanceof ie.Z&&null!==Z&&Z.length>0&&s.index.initializeIndex(Z);var x=m?(0,V.LD)(p):"webm"===h?$(p,0):void 0,C=(0,w.Z)(x)?void 0:x;return{segmentType:"init",initializationData:p,initializationDataSize:p.length,protectionDataUpdate:g,initTimescale:C}}}var ue=n(6807);function le(e,t,n,r){var i,a,o=e.segment,s=e.adaptation,u=e.representation;if(o.isInit)return null;null===n?r?(i=o.time,a=o.end):g.Z.warn("Transport: Unavailable time data for current text track."):(i=n.time,void 0!==n.duration?a=i+n.duration:!r&&o.complete&&(a=i+o.duration));var l=function(e){var t=e.codec;if(void 0===t)throw new Error("Cannot parse subtitles: unknown format");switch(t.toLowerCase()){case"stpp":case"stpp.ttml.im1t":return"ttml";case"wvtt":return"vtt"}throw new Error('The codec used for the subtitles "'+t+'" is not managed yet.')}(u),d=function(e){var t=(0,ue.Le)(e);return null===t?"":(0,b.uR)(t)}(t);return{data:d,type:l,language:s.language,start:i,end:a}}function de(e,t,n){var r,i,a=e.segment,o=e.adaptation,s=e.representation;if(a.isInit)return null;n?g.Z.warn("Transport: Unavailable time data for current text track."):(r=a.time,a.complete&&(i=a.time+a.duration));var u=function(e){var t=e.mimeType,n=void 0===t?"":t;switch(e.mimeType){case"application/ttml+xml":return"ttml";case"application/x-sami":case"application/smil":return"sami";case"text/vtt":return"vtt"}var r=e.codec;if("srt"===(void 0===r?"":r).toLowerCase())return"srt";throw new Error("could not find a text-track parser for the type "+n)}(s);return{data:t,type:u,language:o.language,start:r,end:i}}function ce(e){var t=e.__priv_patchLastSegmentInSidx;return function(e,n,r){var i,a=n.period,o=n.adaptation,s=n.representation,u=n.segment,d=e.data,c=e.isChunked;if(null===d)return u.isInit?{segmentType:"init",initializationData:null,initializationDataSize:0,protectionDataUpdate:!1,initTimescale:void 0}:{segmentType:"media",chunkData:null,chunkSize:0,chunkInfos:null,chunkOffset:null!==(i=u.timestampOffset)&&void 0!==i?i:0,protectionDataUpdate:!1,appendWindow:[a.start,a.end]};var f=M(o.type,s);if("webm"===f)throw new Error("Text tracks with a WEBM container are not yet handled.");return"mp4"===f?function(e,t,n,r,i){var a=n.period,o=n.representation,s=n.segment,u=s.isInit,d=s.indexRange,c="string"==typeof e?(0,b.tG)(e):e instanceof Uint8Array?e:new Uint8Array(e);if(u){var f=(0,V.Wf)(c,Array.isArray(d)?d[0]:0);if(!0===i&&null!==f&&f.length>0){var v=f[f.length-1];Array.isArray(v.range)&&(v.range[1]=1/0)}var p=(0,V.LD)(c);return o.index instanceof ie.Z&&null!==f&&f.length>0&&o.index.initializeIndex(f),{segmentType:"init",initializationData:null,initializationDataSize:0,protectionDataUpdate:!1,initTimescale:p}}var h=ae(c,t,s,r),m=le(n,c,h,t),g=(0,l.Z)(s.timestampOffset,0);return{segmentType:"media",chunkData:m,chunkSize:c.length,chunkInfos:h,chunkOffset:g,protectionDataUpdate:!1,appendWindow:[a.start,a.end]}}(d,c,n,r,t):function(e,t,n){var r,i,a=n.period,o=n.segment,s=o.timestampOffset,u=void 0===s?0:s;if(o.isInit)return{segmentType:"init",initializationData:null,initializationDataSize:0,protectionDataUpdate:!1,initTimescale:void 0};if("string"!=typeof e){var l=e instanceof Uint8Array?e:new Uint8Array(e);r=(0,b.uR)(l),i=l.length}else r=e;return{segmentType:"media",chunkData:de(n,r,t),chunkSize:i,chunkInfos:null,chunkOffset:u,protectionDataUpdate:!1,appendWindow:[a.start,a.end]}}(d,c,n)}}var fe=function(e){var t=(0,i.Z)({customManifestLoader:e.manifestLoader},null===r.Z.dashParsers.wasm||"initialized"!==r.Z.dashParsers.wasm.status&&"initializing"!==r.Z.dashParsers.wasm.status?"arraybuffer":"text"),n=S(e),a=function(e){var t=e.lowLatencyMode,n=e.segmentLoader;return!0!==e.checkMediaSegmentIntegrity?r:D(r);function r(e,r,i,a,o){var s=c(e,r.segment);if(null==s)return Promise.resolve({resultType:"segment-created",resultData:null});if(t||void 0===n)return B(s,r,t,i,o,a);var u={adaptation:r.adaptation,manifest:r.manifest,period:r.period,representation:r.representation,segment:r.segment,transport:"dash",timeout:i.timeout,url:s};return new Promise((function(e,l){var d=!1,c=n(u,{reject:function(e){var t,n,r;if(!d&&!a.isCancelled()){d=!0,a.deregister(f);var i=e,o=null!==(t=null==i?void 0:i.message)&&void 0!==t?t:"Unknown error when fetching a DASH segment through a custom segmentLoader.",s=new T.Z(o,null!==(n=null==i?void 0:i.canRetry)&&void 0!==n&&n,null!==(r=null==i?void 0:i.isOfflineError)&&void 0!==r&&r,null==i?void 0:i.xhr);l(s)}},resolve:function(t){d||a.isCancelled()||(d=!0,a.deregister(f),e({resultType:"segment-loaded",resultData:{responseData:t.data,size:t.size,requestDuration:t.duration}}))},progress:function(e){d||a.isCancelled()||o.onProgress({duration:e.duration,size:e.size,totalSize:e.totalSize})},fallback:function(){d||a.isCancelled()||(d=!0,a.deregister(f),B(s,r,t,i,o,a).then(e,l))}});function f(e){d||(d=!0,"function"==typeof c&&c(),l(e))}a.register(f)}))}}(e),o=se(e),s=function(e){var t=e.lowLatencyMode;return!0!==e.checkMediaSegmentIntegrity?n:D(n);function n(e,n,r,i,a){var o=n.adaptation,s=n.representation,l=n.segment,d=l.range,f=c(e,l);if(null===f)return Promise.resolve({resultType:"segment-created",resultData:null});if(l.isInit)return O(f,l,r,i,a);var v=M(o.type,s),p="mp4"===v||void 0===v;if(t&&p){if(Z())return U(f,n,r,a,i);(0,R.Z)("DASH: Your browser does not have the fetch API. You will have a higher chance of rebuffering when playing close to the live edge")}return p?(0,u.ZP)({url:f,responseType:"arraybuffer",headers:Array.isArray(d)?{Range:(0,x.Z)(d)}:null,timeout:r.timeout,onProgress:a.onProgress,cancelSignal:i}).then((function(e){return{resultType:"segment-loaded",resultData:e}})):(0,u.ZP)({url:f,responseType:"text",headers:Array.isArray(d)?{Range:(0,x.Z)(d)}:null,timeout:r.timeout,onProgress:a.onProgress,cancelSignal:i}).then((function(e){return{resultType:"segment-loaded",resultData:e}}))}}(e);return{manifest:{loadManifest:t,parseManifest:n},audio:{loadSegment:a,parseSegment:o},video:{loadSegment:a,parseSegment:o},text:{loadSegment:s,parseSegment:ce(e)},image:{loadSegment:f,parseSegment:p}}}},2339:function(e,t,n){"use strict";n.d(t,{Z:function(){return ye}});var r=n(5861),i=n(4687),a=n.n(i),o=n(7874),s=n(3887),u=n(1989),l=n(6807),d=n(9362),c=n(811),f=n(8232),v=n(3911),p=n(1091),h=n(5505);function m(e,t,n){var r=e.timeline,i=e.timescale,a=r[r.length-1],o=t.timescale===i?{time:t.time,duration:t.duration}:{time:t.time/t.timescale*i,duration:t.duration/t.timescale*i};return!(n.time===o.time)&&(o.time>=(0,v.jH)(a,null)&&(a.duration===o.duration?a.repeatCount++:e.timeline.push({duration:o.duration,start:o.time,repeatCount:0}),!0))}function g(e,t){return e.replace(/\{start time\}/g,String(t))}function y(e,t,n){var r=t-e;return r>0?Math.floor(r/n):0}function _(e,t){var n=e.repeatCount;if(null!=e.duration&&n<0){var r=void 0!==t?t.start:1/0;n=Math.ceil((r-e.start)/e.duration)-1}return n}var b=function(){function e(e,t){var n=t.aggressiveMode,r=t.isLive,i=t.segmentPrivateInfos,a=t.timeShiftBufferDepth,o=null==t.manifestReceivedTime?performance.now():t.manifestReceivedTime;if(this._index=e,this._indexValidityTime=o,this._timeShiftBufferDepth=a,this._initSegmentInfos={bitsPerSample:i.bitsPerSample,channels:i.channels,codecPrivateData:i.codecPrivateData,packetSize:i.packetSize,samplingRate:i.samplingRate,timescale:e.timescale,protection:i.protection},this._isAggressiveMode=n,this._isLive=r,0!==e.timeline.length){var s=e.timeline[e.timeline.length-1],u=(0,v.jH)(s,null);if(this._initialScaledLastPosition=u,r){var l=o/1e3*e.timescale;this._scaledLiveGap=l-u}}}var t=e.prototype;return t.getInitSegment=function(){return{id:"init",isInit:!0,privateInfos:{smoothInitSegment:this._initSegmentInfos},url:null,time:0,end:0,duration:0,timescale:1,complete:!0}},t.getSegments=function(e,t){this._refreshTimeline();for(var n,r=function(e,t,n){var r=void 0===e.timescale||0===e.timescale?1:e.timescale;return{up:t*r,to:(t+n)*r}}(this._index,e,t),i=r.up,a=r.to,o=this._index,s=o.timeline,u=o.timescale,l=o.media,d=this._isAggressiveMode,c=[],f=s.length,v=null==this._scaledLiveGap?void 0:performance.now()/1e3*u-this._scaledLiveGap,p=0;p=a)return c;null!=n&&(n+=S+1)}return c},t.shouldRefresh=function(e,t){if(this._refreshTimeline(),!this._isLive)return!1;var n=this._index,r=n.timeline,i=n.timescale,a=r[r.length-1];if(void 0===a)return!1;var o=a.repeatCount,s=a.start+(o+1)*a.duration;return!(t*i=s||e*i>a.start+o*a.duration)},t.getFirstAvailablePosition=function(){this._refreshTimeline();var e=this._index;return 0===e.timeline.length?null:e.timeline[0].start/e.timescale},t.getLastAvailablePosition=function(){this._refreshTimeline();var e=this._index;if(null==this._scaledLiveGap){var t=e.timeline[e.timeline.length-1];return(0,v.jH)(t,null)/e.timescale}for(var n=e.timeline.length-1;n>=0;n--)for(var r=e.timeline[n],i=performance.now()/1e3*e.timescale,a=r.start,o=r.duration,s=r.repeatCount;s>=0;s--){var u=a+o*(s+1);if((this._isAggressiveMode?u-o:u)<=i-this._scaledLiveGap)return u/e.timescale}},t.getEnd=function(){if(!this._isLive)return this.getLastAvailablePosition()},t.awaitSegmentBetween=function(e,t){var n;if((0,c.Z)(e<=t),this.isFinished())return!1;var r=this.getLastAvailablePosition();return!(void 0!==r&&t(null!==(n=this.getFirstAvailablePosition())&&void 0!==n?n:0)&&void 0)},t.checkDiscontinuity=function(e){return this._refreshTimeline(),(0,v._j)(this._index,e,void 0)},t.isSegmentStillAvailable=function(e){if(e.isInit)return!0;this._refreshTimeline();var t=this._index,n=t.timeline,r=t.timescale;return(0,p.Z)(e,n,r,0)},t.canBeOutOfSyncError=function(e){return!!this._isLive&&(e instanceof d.Z&&(e.isHttpError(404)||e.isHttpError(412)))},t._replace=function(e){var t=this._index.timeline,n=e._index.timeline,r=this._index.timescale,i=e._index.timescale;if(this._index=e._index,this._initialScaledLastPosition=e._initialScaledLastPosition,this._indexValidityTime=e._indexValidityTime,this._scaledLiveGap=e._scaledLiveGap,0!==t.length&&0!==n.length&&r===i){var a=t[t.length-1],o=n[n.length-1],u=(0,v.jH)(o,null);if(!((0,v.jH)(a,null)<=u))for(var l=0;lu){if(d.duration!==o.duration)return;var f=u-d.start;if(0===f)return s.Z.warn("Smooth Parser: a discontinuity detected in the previous manifest has been resolved."),void(this._index.timeline=this._index.timeline.concat(t.slice(l)));if(f<0||f%d.duration!=0)return;var p=f/d.duration-1,h=d.repeatCount-p;if(h<0)return;o.repeatCount+=h;var m=t.slice(l+1);return void(this._index.timeline=this._index.timeline.concat(m))}}}},t._update=function(e){(0,h.Z)(this._index.timeline,e._index.timeline),this._initialScaledLastPosition=e._initialScaledLastPosition,this._indexValidityTime=e._indexValidityTime,this._scaledLiveGap=e._scaledLiveGap},t.isFinished=function(){return!this._isLive},t.isInitialized=function(){return!0},t.addNewSegments=function(e,t){this._refreshTimeline();for(var n=0;n>3:2)?"mp4a.40.2":"mp4a.40."+n}(u,l);return{audiotag:void 0!==i?parseInt(i,10):i,bitrate:v,bitsPerSample:void 0!==a?parseInt(a,10):a,channels:void 0!==o?parseInt(o,10):o,codecPrivateData:u,codecs:p,customAttributes:n,mimeType:void 0!==l?F[l]:l,packetSize:void 0!==d?parseInt(d,10):d,samplingRate:void 0!==c?parseInt(c,10):c};case"video":var h=r("CodecPrivateData"),m=r("FourCC"),g=r("MaxWidth"),y=r("MaxHeight"),_=r("Bitrate"),b=void 0===_||isNaN(parseInt(_,10))?0:parseInt(_,10);if(void 0!==m&&void 0===F[m]||void 0===h)return s.Z.warn("Smooth parser: Unsupported video codec. Ignoring quality level."),null;var S=function(e){var t=/00000001\d7([0-9a-fA-F]{6})/.exec(e);return null!==t&&(0,k.Z)(t[1])?"avc1."+t[1]:"avc1.4D401E"}(h);return{bitrate:b,customAttributes:n,mimeType:void 0!==m?F[m]:m,codecPrivateData:h,codecs:S,width:void 0!==g?parseInt(g,10):void 0,height:void 0!==y?parseInt(y,10):void 0};case"text":var T=r("CodecPrivateData"),E=r("FourCC"),w=r("Bitrate");return{bitrate:void 0===w||isNaN(parseInt(w,10))?0:parseInt(w,10),customAttributes:n,mimeType:void 0!==E?F[E]:E,codecPrivateData:(0,Z.Z)(T,"")};default:return s.Z.error("Smooth Parser: Unrecognized StreamIndex type: "+t),null}}function o(t){var r=t.root,i=t.timescale,o=t.baseUrl,u=t.protections,l=t.timeShiftBufferDepth,d=t.manifestReceivedTime,f=t.isLive,v=r.getAttribute("Timescale"),p=null===v||isNaN(+v)?i:+v,h=r.getAttribute("Type");if(null===h)throw new Error("StreamIndex without type.");(0,T.Z)(S.r,h)||s.Z.warn("Smooth Parser: Unrecognized adaptation type:",h);var m=h,g=r.getAttribute("Subtype"),y=r.getAttribute("Language"),_=r.getAttribute("Url"),A=null===_?"":_;var Z,R=U(r,(function(e,t,r){switch(t){case"QualityLevel":var i=a(r,m);if(null===i)return e;("video"!==m||i.bitrate>n)&&e.qualityLevels.push(i);break;case"c":e.cNodes.push(r)}return e}),{qualityLevels:[],cNodes:[]}),x=R.qualityLevels,M=R.cNodes,P={timeline:(Z=M,Z.reduce((function(e,t,n){var r=t.getAttribute("d"),i=t.getAttribute("t"),a=t.getAttribute("r"),o=null!==a?+a-1:0,s=null!==i?+i:void 0,u=null!==r?+r:void 0;if(0===n)s=void 0===s||isNaN(s)?0:s;else{var l=e[n-1];if(null==s||isNaN(s)){if(null==l.duration||isNaN(l.duration))throw new Error("Smooth: Invalid CNodes. Missing timestamp.");s=l.start+l.duration*(l.repeatCount+1)}}if(null==u||isNaN(u)){var d=Z[n+1];if(void 0===d)return e;var c=d.getAttribute("t"),f=(0,k.Z)(c)?+c:null;if(null===f)throw new Error("Can't build index timeline from Smooth Manifest.");u=f-s}return e.push({duration:u,start:s,repeatCount:o}),e}),[])),timescale:p};(0,c.Z)(0!==x.length,"Adaptation should have at least one playable representation.");var D=m+((0,k.Z)(y)?"_"+y:""),N=x.map((function(t){var n,r,i,a,s={timeline:P.timeline,timescale:P.timescale,media:(n=A,r=t.bitrate,i=t.customAttributes,n.replace(/\{bitrate\}/g,String(r)).replace(/{CustomAttributes}/g,i.length>0?i[0]:""))},c=(0,k.Z)(t.mimeType)?t.mimeType:B[m],v=t.codecs,p=D+"_"+(null!=m?m+"-":"")+(null!=c?c+"-":"")+(null!=v?v+"-":"")+String(t.bitrate),h=[];u.length>0&&(a=u[0],u.forEach((function(e){var t=e.keyId;e.keySystems.forEach((function(e){h.push({keyId:t,systemId:e.systemId})}))})));var g={bitsPerSample:t.bitsPerSample,channels:t.channels,codecPrivateData:t.codecPrivateData,packetSize:t.packetSize,samplingRate:t.samplingRate,protection:null!=a?{keyId:a.keyId}:void 0},y=null!=e.aggressiveMode&&e.aggressiveMode,_=new b(s,{aggressiveMode:y,isLive:f,manifestReceivedTime:d,segmentPrivateInfos:g,timeShiftBufferDepth:l}),S=(0,w.Z)({},t,{index:_,cdnMetadata:[{baseUrl:o}],mimeType:c,codecs:v,id:p});if(h.length>0||void 0!==a){var T=void 0===a?[]:a.keySystems.map((function(e){var t=e.systemId,n=e.privateData,r=t.replace(/-/g,""),i=function(e,t){if(32!==e.length)throw new Error("HSS: wrong system id length");var n=0;return C("pssh",(0,E.zo)([n,0,0,0],(0,I.nr)(e),(0,E.kh)(t.length),t))}(r,n);return{systemId:r,data:i}}));if(T.length>0){var Z=[{type:"cenc",values:T}];S.contentProtections={keyIds:h,initData:Z}}else S.contentProtections={keyIds:h,initData:[]}}return S}));if("ADVT"===g)return null;var O={id:D,type:m,representations:N,language:null==y?void 0:y};return"text"===m&&"DESC"===g&&(O.closedCaption=!0),O}return function(n,r,a){var s="";if(void 0!==r){var u=(0,A.$)(r);s=r.substring(0,u)}var l=n.documentElement;if(null==l||"SmoothStreamingMedia"!==l.nodeName)throw new Error("document root should be SmoothStreamingMedia");var d=l.getAttribute("MajorVersion"),c=l.getAttribute("MinorVersion");if(null===d||null===c||!/^[2]-[0-2]$/.test(d+"-"+c))throw new Error("Version should be 2.0, 2.1 or 2.2");var f,v,p=l.getAttribute("Timescale"),h=(0,k.Z)(p)?isNaN(+p)?1e7:+p:1e7,m=U(l,(function(t,n,r){switch(n){case"Protection":t.protections.push(L(r,e.keySystems));break;case"StreamIndex":t.adaptationNodes.push(r)}return t}),{adaptationNodes:[],protections:[]}),g=m.protections,y=m.adaptationNodes,_="boolean"==typeof(f=l.getAttribute("IsLive"))?f:"string"==typeof f&&"TRUE"===f.toUpperCase();if(_){var b=l.getAttribute("DVRWindowLength");null==b||isNaN(+b)||0==+b||(v=+b/h)}var S,T,E,w,I,Z,R,x=y.reduce((function(e,t){var n=o({root:t,baseUrl:s,timescale:h,protections:g,isLive:_,timeShiftBufferDepth:v,manifestReceivedTime:a});if(null===n)return e;var r=n.type,i=e[r];return void 0===i?e[r]=[n]:i.push(n),e}),{}),M=null,C=void 0!==x.video?x.video[0]:void 0,P=void 0!==x.audio?x.audio[0]:void 0;if(void 0!==C||void 0!==P){var N=[],O=[];if(void 0!==C){var B=C.representations[0];if(void 0!==B){var F=B.index.getFirstAvailablePosition(),V=B.index.getLastAvailablePosition();null!=F&&N.push(F),null!=V&&O.push(V)}}if(void 0!==P){var z=P.representations[0];if(void 0!==z){var K=z.index.getFirstAvailablePosition(),G=z.index.getLastAvailablePosition();null!=K&&N.push(K),null!=G&&O.push(G)}}N.length>0&&(I=Math.max.apply(Math,N)),O.length>0&&(Z=Math.min.apply(Math,O),R=Math.max.apply(Math,O))}var W=l.getAttribute("Duration"),H=null!==W&&0!=+W?+W/h:void 0;if(_){S=e.suggestedPresentationDelay,T=t,E=null!=I?I:T;var j=R;void 0===j&&(j=Date.now()/1e3-T);var q=Z;void 0===q&&(q=j),w={isLinear:!0,maximumSafePosition:q,livePosition:j,time:performance.now()},M=null!=v?v:null}else{E=null!=I?I:0,w={isLinear:!1,maximumSafePosition:void 0!==Z?Z:void 0!==H?E+H:1/0,livePosition:void 0,time:performance.now()}}var Y=_?0:E,X=_?void 0:w.maximumSafePosition,Q={availabilityStartTime:void 0===T?0:T,clockOffset:i,isLive:_,isDynamic:_,isLastPeriodKnown:!0,timeBounds:{minimumSafePosition:E,timeshiftDepth:M,maximumTimeData:w},periods:[{adaptations:x,duration:void 0!==X?X-Y:H,end:X,id:"gen-smooth-period-0",start:Y}],suggestedPresentationDelay:S,transportType:"smooth",uris:null==r?[]:[r]};return D(Q),Q}},z=V,K=n(4597),G=n(8806),W=n(4460),H=n(8791),j=n(4644),q=n(2297);function Y(e,t,n,r,i){var a,o,u,d=[];if(i){var c=(0,l.XA)(e);null!==c?(u=function(e){var t=(0,q.nR)(e,3565190898,3392751253,2387879627,2655430559);if(void 0===t)return[];for(var n=[],r=t[0],i=t[4],a=0;a0;if(n)return e;var r=new Uint8Array(e.length+4);return r.set(e.subarray(0,t+8),0),r[t+3]=1|r[t+3],r.set([0,0,0,0],t+8),r.set(e.subarray(t+8,e.length),t+12),(0,j.J6)(r)}(l,s[1]-s[0]),f=te(u,d,c,i,(0,q.nR)(a,2721664850,1520127764,2722393154,2086964724)),v=P("moof",[i,f]),p=(0,q.Qy)(v,1836019558),h=(0,q.Qy)(f,1953653094),m=(0,q.Qy)(c,1953658222);if(null===p||null===h||null===m)throw new Error("Smooth: Invalid moof, trun or traf generation");var g=p[1]-p[0]+i.length+(h[1]-h[0])+u.length+d.length+(m[1]-m[0])+8,y=n[2]-n[0],_=v.length-y,b=(0,q.Qy)(e,1835295092);if(null===b)throw new Error("Smooth: Invalid ISOBMFF given");if(!X.YM&&(0===_||_<=-8)){var S=b[1];return v.set((0,E.kh)(S),g),e.set(v,n[0]),_<=-8&&e.set(C("free",new Uint8Array(-_-8)),v.length),e}var T=b[1]+_;v.set((0,E.kh)(T),g);var k=new Uint8Array(e.length+_),w=e.subarray(0,n[0]),A=e.subarray(n[2],e.length);return k.set(w,0),k.set(v,w.length),k.set(A,w.length+v.length),k}var re=n(7839),ie=n(281);function ae(e,t,n,r,i,a){var o,s,u,l=P("stbl",[n,C("stts",new Uint8Array(8)),C("stsc",new Uint8Array(8)),C("stsz",new Uint8Array(12)),C("stco",new Uint8Array(8))]),d=function(e){return C("dref",(0,E.zo)(7,[1],e))}(C("url ",new Uint8Array([0,0,0,1]))),c=P("dinf",[d]),f=P("minf",[r,c,l]),v=function(e){var t,n;switch(e){case"video":t="vide",n="VideoHandler";break;case"audio":t="soun",n="SoundHandler";break;default:t="hint",n=""}return C("hdlr",(0,E.zo)(8,(0,I.tG)(t),12,(0,I.tG)(n),1))}(t),p=function(e){return C("mdhd",(0,E.zo)(12,(0,E.kh)(e),8))}(e),h=P("mdia",[p,v,f]),m=function(e,t,n){return C("tkhd",(0,E.zo)((0,E.kh)(7),8,(0,E.kh)(n),20,[1,0,0,0],[0,1,0,0],12,[0,1,0,0],12,[64,0,0,0],(0,E.XT)(e),2,(0,E.XT)(t),2))}(i,a,1),g=P("trak",[m,h]),y=P("mvex",[(o=1,C("trex",(0,E.zo)(4,(0,E.kh)(o),[0,0,0,1],12)))]),_=function(e,t){return C("mvhd",(0,E.zo)(12,(0,E.kh)(e),4,[0,1],2,[1,0],10,[0,1],14,[0,1],14,[64,0,0,0],26,(0,E.XT)(t+1)))}(e,1),b=function(e,t,n){return P("moov",[e,t,n])}(_,y,g),S=(s="isom",u=["isom","iso2","iso6","avc1","dash"],C("ftyp",E.zo.apply(void 0,[(0,I.tG)(s),[0,0,0,1]].concat(u.map(I.tG)))));return(0,E.zo)(S,b)}function oe(e,t,n,r,i,a,o,s){var u=o.split("00000001"),l=u[1],d=u[2];if(void 0===l||void 0===d)throw new Error("Smooth: unsupported codec private data.");var c,f,v=function(e,t,n){var r=2===n?1:4===n?3:0,i=e[1],a=e[2],o=e[3];return C("avcC",(0,E.zo)([1,i,a,o,252|r,225],(0,E.XT)(e.length),e,[1],(0,E.XT)(t.length),t))}((0,I.nr)(l),(0,I.nr)(d),a);if(void 0===s){var p=function(e,t,n,r,i,a,o){return C("avc1",(0,E.zo)(6,(0,E.XT)(1),16,(0,E.XT)(e),(0,E.XT)(t),(0,E.XT)(n),2,(0,E.XT)(r),6,[0,1,i.length],(0,I.tG)(i),31-i.length,(0,E.XT)(a),[255,255],o))}(t,n,r,i,"AVC Coding",24,v);c=J([p])}else{var h=P("schi",[ee(1,8,s)]),m=Q("cenc",65536),g=function(e,t,n,r,i,a,o,s){return C("encv",(0,E.zo)(6,(0,E.XT)(1),16,(0,E.XT)(e),(0,E.XT)(t),(0,E.XT)(n),2,(0,E.XT)(r),6,[0,1,i.length],(0,I.tG)(i),31-i.length,(0,E.XT)(a),[255,255],o,s))}(t,n,r,i,"AVC Coding",24,v,P("sinf",[$("avc1"),m,h]));c=J([g])}return ae(e,"video",c,((f=new Uint8Array(12))[3]=1,C("vmhd",f)),t,n)}var se=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];function ue(e,t,n,r,i,a,o){var s,u,l,d=function(e,t){return C("esds",(0,E.zo)(4,[3,25],(0,E.XT)(e),[0,4,17,64,21],11,[5,2],(0,I.nr)(t),[6,1,2]))}(1,0===a.length?(s=i,u=t,l=((l=((l=(63&2)<<4)|31&se.indexOf(s))<<4)|31&u)<<3,(0,I.ci)((0,E.XT)(l))):a),c=function(){if(void 0===o){var e=function(e,t,n,r,i,a){return C("mp4a",(0,E.zo)(6,(0,E.XT)(e),8,(0,E.XT)(t),(0,E.XT)(n),2,(0,E.XT)(r),(0,E.XT)(i),2,a))}(1,t,n,r,i,d);return J([e])}var a=P("schi",[ee(1,8,o)]),s=Q("cenc",65536),u=P("sinf",[$("mp4a"),s,a]),l=function(e,t,n,r,i,a,o){return C("enca",(0,E.zo)(6,(0,E.XT)(e),8,(0,E.XT)(t),(0,E.XT)(n),2,(0,E.XT)(r),(0,E.XT)(i),2,a,o))}(1,t,n,r,i,d,u);return J([l])}();return ae(e,"audio",c,C("smhd",new Uint8Array(8)),0,0)}var le=/(\.isml?)(\?token=\S+)?$/,de=/\?token=(\S+)/;function ce(e,t){return(0,k.Z)(t)?e.replace(de,"?token="+t):e.replace(de,"")}function fe(e){return"string"==typeof e.mimeType&&e.mimeType.indexOf("mp4")>=0}function ve(e,t){return null===e?null:null===t.url?e.baseUrl:(0,A.Z)(e.baseUrl,t.url)}function pe(e,t,n,r,i,a){var o,s=t.segment.range;return Array.isArray(s)&&(o={Range:(0,ie.Z)(s)}),(0,K.ZP)({url:e,responseType:"arraybuffer",headers:o,timeout:r.timeout,cancelSignal:i,onProgress:n.onProgress}).then((function(e){if(!fe(t.representation)||!0!==a)return{resultType:"segment-loaded",resultData:e};var n=new Uint8Array(e.responseData);return(0,W.Z)(n,t.segment.isInit),{resultType:"segment-loaded",resultData:Object.assign(Object.assign({},e),{responseData:n})}}))}var he=function(e){var t=e.checkMediaSegmentIntegrity,n=e.customSegmentLoader;return function(e,r,i,a,o){var s=r.segment,u=r.manifest,l=r.period,d=r.adaptation,c=r.representation;if(s.isInit){if(void 0===s.privateInfos||void 0===s.privateInfos.smoothInitSegment)throw new Error("Smooth: Invalid segment format");var f,v=s.privateInfos.smoothInitSegment,p=v.codecPrivateData,h=v.timescale,m=v.protection,g=void 0===m?{keyId:void 0,keySystems:void 0}:m;if(void 0===p)throw new Error("Smooth: no codec private data.");switch(d.type){case"video":var y=c.width,_=void 0===y?0:y,b=c.height;f=oe(h,_,void 0===b?0:b,72,72,4,p,g.keyId);break;case"audio":var S=v.channels,T=void 0===S?0:S,E=v.bitsPerSample,k=void 0===E?0:E,w=v.packetSize,A=void 0===w?0:w,I=v.samplingRate;f=ue(h,T,k,A,void 0===I?0:I,p,g.keyId);break;default:0,f=new Uint8Array(0)}return Promise.resolve({resultType:"segment-created",resultData:f})}if(null===e)return Promise.resolve({resultType:"segment-created",resultData:null});var Z={adaptation:d,manifest:u,period:l,representation:c,segment:s,transport:"smooth",timeout:i.timeout,url:e};return"function"!=typeof n?pe(e,r,o,i,a,t):new Promise((function(s,u){var l=!1,d=n(Z,{reject:function(e){var t,n,r;if(!l&&!a.isCancelled()){l=!0,a.deregister(c);var i=e,o=null!==(t=null==i?void 0:i.message)&&void 0!==t?t:"Unknown error when fetching a Smooth segment through a custom segmentLoader.",s=new re.Z(o,null!==(n=null==i?void 0:i.canRetry)&&void 0!==n&&n,null!==(r=null==i?void 0:i.isOfflineError)&&void 0!==r&&r,null==i?void 0:i.xhr);u(s)}},resolve:function(e){if(!l&&!a.isCancelled()){l=!0,a.deregister(c),fe(r.representation)&&!0===t||s({resultType:"segment-loaded",resultData:{responseData:e.data,size:e.size,requestDuration:e.duration}});var n=e.data instanceof Uint8Array?e.data:new Uint8Array(e.data);(0,W.Z)(n,r.segment.isInit),s({resultType:"segment-loaded",resultData:{responseData:n,size:e.size,requestDuration:e.duration}})}},fallback:function(){l||a.isCancelled()||(l=!0,a.deregister(c),pe(e,r,o,i,a,t).then(s,u))},progress:function(e){l||a.isCancelled()||o.onProgress({duration:e.duration,size:e.size,totalSize:e.totalSize})}});function c(e){l||((l=!0)||"function"!=typeof d||d(),u(e))}a.register(c)}))}},me=/\.wsx?(\?token=\S+)?/;function ge(e,t,n){var r;s.Z.debug("Smooth Parser: update segments information.");for(var i=e.representations,a=0;a0&&ge(o,v,a),{segmentType:"media",chunkData:h,chunkInfos:p,chunkOffset:0,chunkSize:h.length,protectionDataUpdate:!1,appendWindow:[void 0,void 0]}}},c={loadSegment:function(t,n,r,i,a){var o=n.segment,s=n.representation,u=ve(t,o);return o.isInit||null===u?Promise.resolve({resultType:"segment-created",resultData:null}):fe(s)?(0,K.ZP)({url:u,responseType:"arraybuffer",timeout:r.timeout,cancelSignal:i,onProgress:a.onProgress}).then((function(t){if(!0!==e.checkMediaSegmentIntegrity)return{resultType:"segment-loaded",resultData:t};var r=new Uint8Array(t.responseData);return(0,W.Z)(r,n.segment.isInit),{resultType:"segment-loaded",resultData:Object.assign(Object.assign({},t),{responseData:r})}})):(0,K.ZP)({url:u,responseType:"text",timeout:r.timeout,cancelSignal:i,onProgress:a.onProgress}).then((function(e){return{resultType:"segment-loaded",resultData:e}}))},parseSegment:function(e,t,n){var r,i,a,o=t.manifest,u=t.adaptation,d=t.representation,c=t.segment,f=u.language,v=fe(d),p=d.mimeType,h=void 0===p?"":p,m=d.codec,g=void 0===m?"":m,y=e.data,_=e.isChunked;if(c.isInit)return{segmentType:"init",initializationData:null,initializationDataSize:0,protectionDataUpdate:!1,initTimescale:void 0};if(null===y)return{segmentType:"media",chunkData:null,chunkInfos:null,chunkOffset:0,chunkSize:0,protectionDataUpdate:!1,appendWindow:[void 0,void 0]};var b,S,T,E,k=null;if(v){var w;i=(w="string"==typeof y?(0,I.tG)(y):y instanceof Uint8Array?y:new Uint8Array(y)).length;var A=void 0!==n?Y(w,_,n,c,o.isLive):null;a=null==A?void 0:A.nextSegments,null===(k=null!==(r=null==A?void 0:A.chunkInfos)&&void 0!==r?r:null)?_?s.Z.warn("Smooth: Unavailable time data for current text track."):(b=c.time,S=c.end):(b=k.time,S=void 0!==k.duration?k.time+k.duration:c.end);var Z=g.toLowerCase();if("application/ttml+xml+mp4"===h||"stpp"===Z||"stpp.ttml.im1t"===Z)E="ttml";else{if("wvtt"!==Z)throw new Error("could not find a text-track parser for the type "+h);E="vtt"}var R=(0,l.Le)(w);T=null===R?"":(0,I.uR)(R)}else{var x;if(b=c.time,S=c.end,"string"!=typeof y){var M=y instanceof Uint8Array?y:new Uint8Array(y);i=M.length,x=(0,I.uR)(M)}else x=y;switch(h){case"application/x-sami":case"application/smil":E="sami";break;case"application/ttml+xml":E="ttml";break;case"text/vtt":E="vtt"}if(void 0===E){if("srt"!==g.toLowerCase())throw new Error("could not find a text-track parser for the type "+h);E="srt"}T=x}return null!==k&&Array.isArray(a)&&a.length>0&&ge(u,a,c),{segmentType:"media",chunkData:{type:E,data:T,start:b,end:S,language:f},chunkSize:i,chunkInfos:k,chunkOffset:null!=b?b:0,protectionDataUpdate:!1,appendWindow:[void 0,void 0]}}};return{manifest:{resolveManifestUrl:function(e,t){if(void 0===e)return Promise.resolve(void 0);var n;me.test(e)?((0,G.Z)("Giving WSX URL to loadVideo is deprecated. You should only give Manifest URLs."),n=(0,K.ZP)({url:ce(e,""),responseType:"document",cancelSignal:t}).then((function(e){var t=e.responseData.getElementsByTagName("media")[0].getAttribute("src");if(null===t||0===t.length)throw new Error("Invalid ISML");return t}))):n=Promise.resolve(e);var r=function(e){var t=de.exec(e);if(null!==t){var n=t[1];if(void 0!==n)return n}return""}(e);return n.then((function(e){return ce(function(e){return le.test(e)?((0,G.Z)("Giving a isml URL to loadVideo is deprecated. Please give the Manifest URL directly"),e.replace(le,"$1/manifest$2")):e}(e),r)}))},loadManifest:(0,H.Z)(i,"text"),parseManifest:function(n,r){var i,a=null!==(i=n.url)&&void 0!==i?i:r.originalUrl,o=n.receivedTime,s=n.responseData,l="string"==typeof s?(new DOMParser).parseFromString(s,"text/xml"):s,d=t(l,a,o);return{manifest:new u.ZP(d,{representationFilter:e.representationFilter,supplementaryImageTracks:e.supplementaryImageTracks,supplementaryTextTracks:e.supplementaryTextTracks}),url:a}}},audio:d,video:d,text:c,image:{loadSegment:function(e,t,n,i,o){return(0,r.Z)(a().mark((function r(){var s,u,l;return a().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(s=t.segment,u=ve(e,s),!s.isInit&&null!==u){r.next=4;break}return r.abrupt("return",{resultType:"segment-created",resultData:null});case 4:return r.next=6,(0,K.ZP)({url:u,responseType:"arraybuffer",timeout:n.timeout,onProgress:o.onProgress,cancelSignal:i});case 6:return l=r.sent,r.abrupt("return",{resultType:"segment-loaded",resultData:l});case 8:case"end":return r.stop()}}),r)})))()},parseSegment:function(e,t,n){var r=e.data,i=e.isChunked;if(t.segment.isInit)return{segmentType:"init",initializationData:null,initializationDataSize:0,protectionDataUpdate:!1,initTimescale:void 0};if(i)throw new Error("Image data should not be downloaded in chunks");return null===r||null===o.Z.imageParser?{segmentType:"media",chunkData:null,chunkInfos:null,chunkOffset:0,chunkSize:0,protectionDataUpdate:!1,appendWindow:[void 0,void 0]}:{segmentType:"media",chunkData:{data:o.Z.imageParser(new Uint8Array(r)).thumbs,start:0,end:Number.MAX_VALUE,timescale:1,type:"bif"},chunkInfos:{time:0,duration:Number.MAX_VALUE},chunkSize:void 0,chunkOffset:0,protectionDataUpdate:!1,appendWindow:[void 0,void 0]}}}}}},281:function(e,t,n){"use strict";function r(e){var t=e[0],n=e[1];return n===1/0?"bytes="+t+"-":"bytes="+t+"-"+n}n.d(t,{Z:function(){return r}})},4460:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(5389),i=n(8766);function a(e,t){if(t){if((0,i.Z)(e,1718909296)<0)throw new r.Z("INTEGRITY_ERROR","Incomplete `ftyp` box");if((0,i.Z)(e,1836019574)<0)throw new r.Z("INTEGRITY_ERROR","Incomplete `moov` box")}else{if((0,i.Z)(e,1836019558)<0)throw new r.Z("INTEGRITY_ERROR","Incomplete `moof` box");if((0,i.Z)(e,1835295092)<0)throw new r.Z("INTEGRITY_ERROR","Incomplete `mdat` box")}}},8766:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(6968);function i(e,t){for(var n=e.length,i=0;i+8<=n;){var a=(0,r.pX)(e,i);if(0===a)a=n-i;else if(1===a){if(i+16>n)return-1;a=(0,r.pV)(e,i+8)}if(isNaN(a)||a<=0)return-1;if((0,r.pX)(e,i+4)===t)return i+a<=n?i:-1;i+=a}return-1}},8791:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var r=n(7904),i=n(4597),a=n(7839);function o(e,t){var n=e.customManifestLoader,o=function(e){return function(t,n,a){if(void 0===t)throw new Error("Cannot perform HTTP(s) request. URL not known");switch(e){case"arraybuffer":return(0,i.ZP)({url:t,responseType:"arraybuffer",timeout:n.timeout,cancelSignal:a});case"text":return(0,i.ZP)({url:t,responseType:"text",timeout:n.timeout,cancelSignal:a});case"document":return(0,i.ZP)({url:t,responseType:"document",timeout:n.timeout,cancelSignal:a});default:(0,r.Z)(e)}}}(t);return"function"!=typeof n?o:function(e,t){return function(n,r,i){return new Promise((function(o,s){var u=Date.now()-performance.now(),l=!1,d=e(n,{reject:function(e){var t,n,r;if(!l&&!i.isCancelled()){l=!0,i.deregister(c);var o=e,u=null!==(t=null==o?void 0:o.message)&&void 0!==t?t:"Unknown error when fetching the Manifest through a custom manifestLoader.",d=new a.Z(u,null!==(n=null==o?void 0:o.canRetry)&&void 0!==n&&n,null!==(r=null==o?void 0:o.isOfflineError)&&void 0!==r&&r,null==o?void 0:o.xhr);s(d)}},resolve:function(e){if(!l&&!i.isCancelled()){l=!0,i.deregister(c);var t=void 0!==e.receivingTime?e.receivingTime-u:void 0,n=void 0!==e.sendingTime?e.sendingTime-u:void 0;o({responseData:e.data,size:e.size,requestDuration:e.duration,url:e.url,receivedTime:t,sendingTime:n})}},fallback:function(){l||i.isCancelled()||(l=!0,i.deregister(c),t(n,r,i).then(o,s))}},{timeout:r.timeout});function c(e){l||(l=!0,"function"==typeof d&&d(),s(e))}i.register(c)}))}}(n,o)}},4791:function(e,t,n){"use strict";function r(e,t){if(e.length!==t.length)return!1;for(var n=e.length-1;n>=0;n--)if(e[n]!==t[n])return!1;return!0}n.d(t,{Z:function(){return r}})},3274:function(e,t,n){"use strict";function r(e,t,n){if("function"==typeof Array.prototype.find)return e.find(t,n);for(var r=e.length>>>0,i=0;i>>0,i=0;i>>0;if(0===r)return!1;for(var i,a,o=0|n,s=o>=0?Math.min(o,r-1):Math.max(r+o,0);s=a.length)throw new Error("Unable to parse base64 string.");var t=a[e];if(255===t)throw new Error("Unable to parse base64 string.");return t}function s(e){var t,n="",r=e.length;for(t=2;t>2],n+=i[(3&e[t-2])<<4|e[t-1]>>4],n+=i[(15&e[t-1])<<2|e[t]>>6],n+=i[63&e[t]];return t===r+1&&(n+=i[e[t-2]>>2],n+=i[(3&e[t-2])<<4],n+="=="),t===r&&(n+=i[e[t-2]>>2],n+=i[(3&e[t-2])<<4|e[t-1]>>4],n+=i[(15&e[t-1])<<2],n+="="),n}function u(e){var t=e.length%4,n=e;0!==t&&(r.Z.warn("base64ToBytes: base64 given miss padding"),n+=3===t?"=":2===t?"==":"===");var i=n.indexOf("=");if(-1!==i&&i>16,l[c+1]=a>>8&255,l[c+2]=255&a;return l.subarray(0,l.length-s)}},6968:function(e,t,n){"use strict";function r(){for(var e,t=arguments.length,n=-1,r=0;++n0&&(i.set(e,a),a+=e.length);return i}function i(e,t){return(e[t+0]<<8)+(e[t+1]<<0)}function a(e,t){return 65536*e[t+0]+256*e[t+1]+e[t+2]}function o(e,t){return 16777216*e[t+0]+65536*e[t+1]+256*e[t+2]+e[t+3]}function s(e,t){return 4294967296*(16777216*e[t+0]+65536*e[t+1]+256*e[t+2]+e[t+3])+16777216*e[t+4]+65536*e[t+5]+256*e[t+6]+e[t+7]}function u(e){return new Uint8Array([e>>>8&255,255&e])}function l(e){return new Uint8Array([e>>>24&255,e>>>16&255,e>>>8&255,255&e])}function d(e){var t=e%4294967296,n=(e-t)/4294967296;return new Uint8Array([n>>>24&255,n>>>16&255,n>>>8&255,255&n,t>>>24&255,t>>>16&255,t>>>8&255,255&t])}function c(e,t){return(e[t+0]<<0)+(e[t+1]<<8)}function f(e,t){return e[t+0]+256*e[t+1]+65536*e[t+2]+16777216*e[t+3]}function v(e){return new Uint8Array([255&e,e>>>8&255,e>>>16&255,e>>>24&255])}function p(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer)}n.d(t,{O_:function(){return v},QI:function(){return a},XT:function(){return u},_f:function(){return p},dN:function(){return f},el:function(){return d},kh:function(){return l},pV:function(){return s},pX:function(){return o},qb:function(){return c},zK:function(){return i},zo:function(){return r}})},7864:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(7733);function i(e,t){return(0,r.Z)(t,(function(t){var n=setTimeout((function(){return t()}),e);return function(){return clearTimeout(n)}}))}},7733:function(e,t,n){"use strict";function r(e,t){var n;return new Promise((function(r,i){if(null!==e.cancellationError)return i(e.cancellationError);var a=!1;function o(e){void 0!==n&&n(),i(e)}n=t((function(t){e.deregister(o),a=!0,r(t)}),(function(t){e.deregister(o),a=!0,i(t)})),a||e.register(o)}))}n.d(t,{Z:function(){return r}})},1959:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(3887),i=n(1946),a=function(){function e(){this._listeners={}}var t=e.prototype;return t.addEventListener=function(e,t,n){var r=this,i=this._listeners[e];Array.isArray(i)?i.push(t):this._listeners[e]=[t],void 0!==n&&n.register((function(){r.removeEventListener(e,t)}))},t.removeEventListener=function(e,t){if((0,i.Z)(e))this._listeners={};else{var n=this._listeners[e];if(Array.isArray(n))if((0,i.Z)(t))delete this._listeners[e];else{var r=n.indexOf(t);-1!==r&&n.splice(r,1),0===n.length&&delete this._listeners[e]}}},t.trigger=function(e,t){var n=this._listeners[e];Array.isArray(n)&&n.slice().forEach((function(e){try{e(t)}catch(e){r.Z.error("EventEmitter: listener error",e instanceof Error?e:null)}}))},e}()},9592:function(e,t,n){"use strict";function r(e,t){return"function"==typeof Array.prototype.flatMap?e.flatMap(t):e.reduce((function(e,n){var r=t(n);return Array.isArray(r)?(e.push.apply(e,r),e):(e.push(r),e)}),[])}n.d(t,{Z:function(){return r}})},2572:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=.3;function i(e){return e*((2*Math.random()-1)*r+1)}},2870:function(e,t,n){"use strict";function r(e){for(var t=0,n=0;n=Number.MAX_SAFE_INTEGER&&(e+="0",t=0),e+String(t)}}n.d(t,{Z:function(){return r}})},6923:function(e,t,n){"use strict";function r(e){return"string"==typeof e&&e.length>0}n.d(t,{Z:function(){return r}})},1946:function(e,t,n){"use strict";function r(e){return null==e}n.d(t,{Z:function(){return r}})},7829:function(e,t,n){"use strict";var r=n(5553);t.ZP=r.ZP},5553:function(e,t,n){"use strict";n.d(t,{ZP:function(){return d},iH:function(){return l},Y1:function(){return u}});var r=n(6923),i=n(1946),a={aa:"aar",ab:"abk",ae:"ave",af:"afr",ak:"aka",am:"amh",an:"arg",ar:"ara",as:"asm",av:"ava",ay:"aym",az:"aze",ba:"bak",be:"bel",bg:"bul",bi:"bis",bm:"bam",bn:"ben",bo:"bod",br:"bre",bs:"bos",ca:"cat",ce:"che",ch:"cha",co:"cos",cr:"cre",cs:"ces",cu:"chu",cv:"chv",cy:"cym",da:"dan",de:"deu",dv:"div",dz:"dzo",ee:"ewe",el:"ell",en:"eng",eo:"epo",es:"spa",et:"est",eu:"eus",fa:"fas",ff:"ful",fi:"fin",fj:"fij",fo:"fao",fr:"fra",fy:"fry",ga:"gle",gd:"gla",gl:"glg",gn:"grn",gu:"guj",gv:"glv",ha:"hau",he:"heb",hi:"hin",ho:"hmo",hr:"hrv",ht:"hat",hu:"hun",hy:"hye",hz:"her",ia:"ina",id:"ind",ie:"ile",ig:"ibo",ii:"iii",ik:"ipk",io:"ido",is:"isl",it:"ita",iu:"iku",ja:"jpn",jv:"jav",ka:"kat",kg:"kon",ki:"kik",kj:"kua",kk:"kaz",kl:"kal",km:"khm",kn:"kan",ko:"kor",kr:"kau",ks:"kas",ku:"kur",kv:"kom",kw:"cor",ky:"kir",la:"lat",lb:"ltz",lg:"lug",li:"lim",ln:"lin",lo:"lao",lt:"lit",lu:"lub",lv:"lav",mg:"mlg",mh:"mah",mi:"mri",mk:"mkd",ml:"mal",mn:"mon",mr:"mar",ms:"msa",mt:"mlt",my:"mya",na:"nau",nb:"nob",nd:"nde",ne:"nep",ng:"ndo",nl:"nld",nn:"nno",no:"nor",nr:"nbl",nv:"nav",ny:"nya",oc:"oci",oj:"oji",om:"orm",or:"ori",os:"oss",pa:"pan",pi:"pli",pl:"pol",ps:"pus",pt:"por",qu:"que",rm:"roh",rn:"run",ro:"ron",ru:"rus",rw:"kin",sa:"san",sc:"srd",sd:"snd",se:"sme",sg:"sag",si:"sin",sk:"slk",sl:"slv",sm:"smo",sn:"sna",so:"som",sq:"sqi",sr:"srp",ss:"ssw",st:"sot",su:"sun",sv:"swe",sw:"swa",ta:"tam",te:"tel",tg:"tgk",th:"tha",ti:"tir",tk:"tuk",tl:"tgl",tn:"tsn",to:"ton",tr:"tur",ts:"tso",tt:"tat",tw:"twi",ty:"tah",ug:"uig",uk:"ukr",ur:"urd",uz:"uzb",ve:"ven",vi:"vie",vo:"vol",wa:"wln",wo:"wol",xh:"xho",yi:"yid",yo:"yor",za:"zha",zh:"zho",zu:"zul"},o={alb:"sqi",arm:"hye",baq:"eus",bur:"mya",chi:"zho",cze:"ces",dut:"nld",fre:"fra",geo:"kat",ger:"deu",gre:"ell",ice:"isl",mac:"mkd",mao:"mri",may:"msa",per:"fas",slo:"slk",rum:"ron",tib:"bod",wel:"cym"};function s(e){if((0,i.Z)(e)||""===e)return"";var t=function(e){var t;switch(e.length){case 2:t=a[e];break;case 3:t=o[e]}return t}((""+e).toLowerCase().split("-")[0]);return(0,r.Z)(t)?t:e}function u(e){if(!(0,i.Z)(e)){var t,n=!1;return"string"==typeof e?t=e:(t=e.language,!0===e.closedCaption&&(n=!0)),{language:t,closedCaption:n,normalized:s(t)}}return e}function l(e){if((0,i.Z)(e))return e;if("string"==typeof e)return{language:e,audioDescription:!1,normalized:s(e)};var t={language:e.language,audioDescription:!0===e.audioDescription,normalized:s(s(e.language))};return!0===e.isDub&&(t.isDub=!0),t}var d=s},8894:function(e,t,n){"use strict";function r(){}n.d(t,{Z:function(){return r}})},8026:function(e,t){"use strict";t.Z="function"==typeof Object.assign?Object.assign:function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=0;n<(arguments.length<=1?0:arguments.length-1);n++){var r=n+1<1||arguments.length<=n+1?void 0:arguments[n+1];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t}},1679:function(e,t,n){"use strict";t.Z="function"==typeof Object.values?Object.values:function(e){return Object.keys(e).map((function(t){return e[t]}))}},2829:function(e,t,n){"use strict";n.d(t,{A1:function(){return s},DD:function(){return m},F_:function(){return p},JN:function(){return c},L7:function(){return g},Ti:function(){return u},XS:function(){return v},at:function(){return h},kR:function(){return y},rx:function(){return f},tn:function(){return b},uH:function(){return S}});var r=1/60;function i(e,t){return Math.abs(e-t)=0;n--){var r=e.start(n);if(t>=r){var i=e.end(n);if(t=o?r.push({start:a,end:o}):n={start:a,end:o}}return{outerRanges:r,innerRange:n}}function h(e,t){var n=f(e,t);return null!==n?n.end-n.start:0}function m(e,t){var n=f(e,t);return null!==n?t-n.start:0}function g(e,t){var n=f(e,t);return null!==n?n.end-t:1/0}function y(e,t){if(t.start===t.end)return e;for(var n=t,r=0;r0)for(var o=0;o0)for(var s=0;sl&&n.push({start:l,end:a[d].start}),l=a[d].end;l=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0&&i.splice(e,1)}}i.push(r),!0===(null==t?void 0:t.emitCurrentValue)&&e(n,o),a||r.hasBeenCleared?o():void 0!==(null==t?void 0:t.clearSignal)&&t.clearSignal.register(o)},waitUntilDefined:function(e,t){this.onUpdate((function(t,r){void 0!==t&&(r(),e(n))}),{clearSignal:null==t?void 0:t.clearSignal,emitCurrentValue:!0})},finish:o};function o(){void 0!==t&&t.deregister(o),a=!0;for(var e,n=r(i.slice());!(e=n()).done;){var s=e.value;try{s.hasBeenCleared||(s.complete(),s.hasBeenCleared=!0)}catch(e){}}i.length=0}}function o(e,t,n){var r=a(t(e.getValue()),n);return e.onUpdate((function(e){r.setValue(t(e))}),{clearSignal:n}),r}n.d(t,{$l:function(){return a},ZP:function(){return a},lR:function(){return o}})},4597:function(e,t,n){"use strict";n.d(t,{ZP:function(){return o}});var r=n(9105),i=n(6923),a=n(1946);var o=function(e){var t={url:e.url,headers:e.headers,responseType:(0,a.Z)(e.responseType)?"json":e.responseType,timeout:e.timeout};return new Promise((function(n,o){var s,u=e.onProgress,l=e.cancelSignal,d=t.url,c=t.headers,f=t.responseType,v=t.timeout,p=new XMLHttpRequest;if(p.open("GET",d,!0),void 0!==v&&(p.timeout=v,s=window.setTimeout((function(){_(),o(new r.Z(d,p.status,"TIMEOUT",p))}),v+3e3)),p.responseType=f,"document"===p.responseType&&p.overrideMimeType("text/xml"),!(0,a.Z)(c)){var h=c;for(var m in h)h.hasOwnProperty(m)&&p.setRequestHeader(m,h[m])}var g=performance.now(),y=null;function _(){void 0!==s&&clearTimeout(s),null!==y&&y()}void 0!==l&&(y=l.register((function(e){_(),(0,a.Z)(p)||4===p.readyState||p.abort(),o(e)})),l.isCancelled())||(p.onerror=function(){_(),o(new r.Z(d,p.status,"ERROR_EVENT",p))},p.ontimeout=function(){_(),o(new r.Z(d,p.status,"TIMEOUT",p))},void 0!==u&&(p.onprogress=function(e){var t=performance.now();u({url:d,duration:t-g,sendingTime:g,currentTime:t,size:e.loaded,totalSize:e.total})}),p.onload=function(e){if(4===p.readyState)if(_(),p.status>=200&&p.status<300){var t,s=performance.now(),u=p.response instanceof ArrayBuffer?p.response.byteLength:e.total,l=p.status,c=p.responseType,f=(0,i.Z)(p.responseURL)?p.responseURL:d;if(t="json"===c?"object"==typeof p.response?p.response:function(e){try{return JSON.parse(e)}catch(e){return null}}(p.responseText):p.response,(0,a.Z)(t))return void o(new r.Z(d,p.status,"PARSE_ERROR",p));n({status:l,url:f,responseType:c,sendingTime:g,receivedTime:s,requestDuration:s-g,size:u,responseData:t})}else o(new r.Z(d,p.status,"ERROR_HTTP_CODE",p))},p.send())}))}},9829:function(e,t,n){"use strict";n.d(t,{$:function(){return o},Z:function(){return a}});var r=/^(?:[a-z]+:)?\/\//i,i=/\/\.{1,2}\//;function a(){var e=arguments.length;if(0===e)return"";for(var t="",n=0;n=0&&t===n+1)return e.length}var i=e.indexOf("?");return i>=0&&i>8&255}return n}function u(e){if(a)try{return new TextDecoder("utf-16le").decode(e)}catch(e){var t=e instanceof Error?e:"";r.Z.warn("Utils: could not use TextDecoder to parse UTF-16LE, fallbacking to another implementation",t)}for(var n="",i=0;i=t?n:new Array(t-n.length+1).join("0")+n}function c(e){if(a)try{return(new TextDecoder).decode(e)}catch(e){var t=e instanceof Error?e:"";r.Z.warn("Utils: could not use TextDecoder to parse UTF-8, fallbacking to another implementation",t)}var n=e;239===n[0]&&187===n[1]&&191===n[2]&&(n=n.subarray(3));var i,o=function(e){for(var t="",n=0;n=256?"%u"+d(l,4):"%"+d(l,2)}}return decodeURIComponent(i)}function f(e){for(var t=e.length,n=new Uint8Array(t/2),r=0,i=0;r>>4).toString(16),n+=(15&e[r]).toString(16),t.length>0&&r0;)try{var n=t._listeners.pop();null==n||n(e)}catch(e){o.Z.error("Error while calling clean up listener",e instanceof Error?e.toString():"Unknown error")}}))}var t=e.prototype;return t.isCancelled=function(){return this._isCancelled},t.register=function(e){var t=this;return this._isCancelled?((0,s.Z)(null!==this.cancellationError),e(this.cancellationError),u.Z):(this._listeners.push(e),function(){return t.deregister(e)})},t.deregister=function(e){for(var t=this._listeners.length-1;t>=0;t--)this._listeners[t]===e&&this._listeners.splice(t,1)},e}(),c=function(e){function t(){var n;return n=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(n),t.prototype),n.name="CancellationError",n.message="This task was cancelled.",n}return(0,i.Z)(t,e),t}((0,a.Z)(Error))},8806:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(7714),i=[];function a(e){(0,r.Z)(i,e)||(console.warn(e),i.push(e))}},7473:function(e){"use strict";var t=function(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return e},n=function(e){var n,r,i=document.createTextNode(""),a=0;return new e((function(){var e;if(n)r&&(n=r.concat(n));else{if(!r)return;n=r}if(r=n,n=null,"function"==typeof r)return e=r,r=null,void e();for(i.data=a=++a%2;r;)e=r.shift(),r.length||(r=null),e()})).observe(i,{characterData:!0}),function(e){t(e),n?"function"==typeof n?n=[n,e]:n.push(e):(n=e,i.data=a=++a%2)}};e.exports=function(){if("object"==typeof process&&process&&"function"==typeof process.nextTick)return process.nextTick;if("function"==typeof queueMicrotask)return function(e){queueMicrotask(t(e))};if("object"==typeof document&&document){if("function"==typeof MutationObserver)return n(MutationObserver);if("function"==typeof WebKitMutationObserver)return n(WebKitMutationObserver)}return"function"==typeof setImmediate?function(e){setImmediate(t(e))}:"function"==typeof setTimeout||"object"==typeof setTimeout?function(e){setTimeout(t(e),0)}:null}()},7061:function(e,t,n){var r=n(8698).default;function i(){"use strict";e.exports=i=function(){return n},e.exports.__esModule=!0,e.exports.default=e.exports;var t,n={},a=Object.prototype,o=a.hasOwnProperty,s=Object.defineProperty||function(e,t,n){e[t]=n.value},u="function"==typeof Symbol?Symbol:{},l=u.iterator||"@@iterator",d=u.asyncIterator||"@@asyncIterator",c=u.toStringTag||"@@toStringTag";function f(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{f({},"")}catch(t){f=function(e,t,n){return e[t]=n}}function v(e,t,n,r){var i=t&&t.prototype instanceof b?t:b,a=Object.create(i.prototype),o=new P(r||[]);return s(a,"_invoke",{value:R(e,n,o)}),a}function p(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}n.wrap=v;var h="suspendedStart",m="suspendedYield",g="executing",y="completed",_={};function b(){}function S(){}function T(){}var E={};f(E,l,(function(){return this}));var k=Object.getPrototypeOf,w=k&&k(k(D([])));w&&w!==a&&o.call(w,l)&&(E=w);var A=T.prototype=b.prototype=Object.create(E);function I(e){["next","throw","return"].forEach((function(t){f(e,t,(function(e){return this._invoke(t,e)}))}))}function Z(e,t){function n(i,a,s,u){var l=p(e[i],e,a);if("throw"!==l.type){var d=l.arg,c=d.value;return c&&"object"==r(c)&&o.call(c,"__await")?t.resolve(c.__await).then((function(e){n("next",e,s,u)}),(function(e){n("throw",e,s,u)})):t.resolve(c).then((function(e){d.value=e,s(d)}),(function(e){return n("throw",e,s,u)}))}u(l.arg)}var i;s(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,i){n(e,r,t,i)}))}return i=i?i.then(a,a):a()}})}function R(e,n,r){var i=h;return function(a,o){if(i===g)throw new Error("Generator is already running");if(i===y){if("throw"===a)throw o;return{value:t,done:!0}}for(r.method=a,r.arg=o;;){var s=r.delegate;if(s){var u=x(s,r);if(u){if(u===_)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===h)throw i=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=g;var l=p(e,n,r);if("normal"===l.type){if(i=r.done?y:m,l.arg===_)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(i=y,r.method="throw",r.arg=l.arg)}}}function x(e,n){var r=n.method,i=e.iterator[r];if(i===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,x(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),_;var a=p(i,e.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,_;var o=a.arg;return o?o.done?(n[e.resultName]=o.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,_):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,_)}function M(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(M,this),this.reset(!0)}function D(e){if(e||""===e){var n=e[l];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,a=function n(){for(;++i=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var u=o.call(a,"catchLoc"),l=o.call(a,"finallyLoc");if(u&&l){if(this.prev=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&o.call(r,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),C(n),_}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;C(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:D(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),_}},n}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports},8698:function(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},4687:function(e,t,n){var r=n(7061)();e.exports=r;try{regeneratorRuntime=r}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}},7326:function(e,t,n){"use strict";function r(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}n.d(t,{Z:function(){return r}})},5861:function(e,t,n){"use strict";function r(e,t,n,r,i,a,o){try{var s=e[a](o),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function i(e){return function(){var t=this,n=arguments;return new Promise((function(i,a){var o=e.apply(t,n);function s(e){r(o,i,a,s,u,"next",e)}function u(e){r(o,i,a,s,u,"throw",e)}s(void 0)}))}}n.d(t,{Z:function(){return i}})},1656:function(e,t,n){"use strict";function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function i(e){var t=function(e,t){if("object"!==r(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!==r(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===r(t)?t:String(t)}function a(e,t){for(var n=0;ni)break}if(u<0||n.length!==t.length)return l.Z.error("ABR: Current Bitrate not found in the calculated levels"),void(this._currentEstimate=n[0]);void 0!==a&&(s=0===o?a.score:a.score/o);var f=isFinite(r)?r:0,v=performance.now();if(f=0;m--)if(f>=t[m])return void(this._currentEstimate=n[m]);this._currentEstimate=n[0]}else if(void 0!==this._lastUnsuitableQualityTimestamp&&v-this._lastUnsuitableQualityTimestampg)return e}();if(void 0!==y)if(r>=t[y])return l.Z.debug("ABR: Raising quality in BufferBasedChooser",n[y]),void(this._currentEstimate=n[y]);this._currentEstimate=i}}else this._currentEstimate=n[0]},t.getLastEstimate=function(){return this._currentEstimate},e}(),z=n(3274),K=function(){function e(e){this._alpha=Math.exp(Math.log(.5)/e),this._lastEstimate=0,this._totalWeight=0}var t=e.prototype;return t.addSample=function(e,t){var n=Math.pow(this._alpha,e),r=t*(1-n)+n*this._lastEstimate;isNaN(r)||(this._lastEstimate=r,this._totalWeight+=e)},t.getEstimate=function(){var e=1-Math.pow(this._alpha,this._totalWeight);return this._lastEstimate/e},e}();function G(e){if(!(e.progress.length<5)){for(var t=new K(2),n=e.progress,r=1;r=s.outOfStarvationGap&&(l.Z.info("ABR: exit starvation mode."),this._inStarvationMode=!1):this._inStarvationMode&&(l.Z.info("ABR: exit starvation mode."),this._inStarvationMode=!1),this._inStarvationMode&&(o=function(e,t,n,r,i){if(!r){var a=t.bufferGap,o=t.speed,s=t.position,u=isFinite(a)?a:0,l=function(e,t){for(var n=-1,r=0;r-1.2){n=r;break}if(a>t&&t-i.time>-1.2){n=r;break}}}if(n<0)return[];for(var o=e[n],s=o.content.segment.time,u=[o],l=n+1;l0?d.progress[d.progress.length-1]:void 0,p=G(d);if(void 0!==v&&void 0!==p){var h=W(v,p);if((c-v.timestamp)/1e3<=h&&h-u/o>2500)return p}if(d.content.segment.complete){var m=d.content.segment.duration,g=(c-d.requestTimestamp)/1e3;if(null!=n&&!(g<=(1.5*m+2)/o)){var y=m/g,_=n.bitrate*Math.min(.7,y);return void 0===i||_1&&(a/=e.speed),{bandwidthEstimate:o,bitrateChosen:a}},t.isUrgent=function(e,t,n,r){return null===t||!(e>=t.bitrate)&&function(e,t,n){if(n)return!0;var r=isFinite(e.bufferGap)?e.bufferGap:0,i=e.position.last+r,a=(0,z.Z)(t,(function(e){var t=e.content;return t.segment.duration>0&&t.segment.time+t.segment.duration>i}));if(void 0===a)return!0;var o=performance.now(),s=a.progress.length>0?a.progress[a.progress.length-1]:void 0,u=G(a);if(void 0===s||void 0===u)return!0;var l=W(s,u);return(o-s.timestamp)/1e3>1.2*l||l-r/e.speed>-1.5}(r,n,this._lowLatencyMode)},e}();function j(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return q(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return q(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function q(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);ns.bitrate)return 2===this._lastAbrEstimate.algorithmType&&(null!==this._lastAbrEstimate.representation&&(this._lastMaintanableBitrate=this._lastAbrEstimate.representation.bitrate),this._consecutiveWrongGuesses=0),null;var u=this._scoreCalculator.getEstimate(n);if(2!==this._lastAbrEstimate.algorithmType){if(void 0===u)return null;if(this._canGuessHigher(a,o,u)){var d=X(e,n);if(null!==d)return d}return null}if(this._isLastGuessValidated(s,r,u)&&(l.Z.debug("ABR: Guessed Representation validated",s.bitrate),this._lastMaintanableBitrate=s.bitrate,this._consecutiveWrongGuesses=0),n.id!==s.id)return s;if(this._shouldStopGuess(n,u,a,i))return this._consecutiveWrongGuesses++,this._blockGuessesUntil=performance.now()+Math.min(15e3*this._consecutiveWrongGuesses,12e4),function(e,t){var n=(0,B.Z)(e,(function(e){return e.id===t.id}));if(n<0)return l.Z.error("ABR: Current Representation not found."),null;for(;--n>=0;)if(e[n].bitrate=2.5&&performance.now()>this._blockGuessesUntil&&1===i&&r/t>1.01},t._shouldStopGuess=function(e,t,n,r){if(void 0!==t&&t.score<1.01)return!0;if((void 0===t||t.score<1.2)&&n<.6)return!0;for(var i,a=r.filter((function(t){return t.content.representation.id===e.id})),o=performance.now(),s=j(a);!(i=s()).done;){var u=i.value,l=o-u.requestTimestamp;if(u.content.segment.isInit){if(l>1e3)return!0}else{if(l>1e3*u.content.segment.duration+200)return!0;var d=G(u);if(void 0!==d&&d<.8*e.bitrate)return!0}}return!1},t._isLastGuessValidated=function(e,t,n){return void 0!==n&&1===n.confidenceLevel&&n.score>1.5||t>=e.bitrate&&(null===this._lastMaintanableBitrate||this._lastMaintanableBitratet.bitrate)return e[r];return null}var Q=function(){function e(){var e=c.Z.getCurrent(),t=e.ABR_FAST_EMA,n=e.ABR_SLOW_EMA;this._fastEWMA=new K(t),this._slowEWMA=new K(n),this._bytesSampled=0}var t=e.prototype;return t.addSample=function(e,t){if(!(t1&&this._lastRepresentationWithGoodScore!==e&&(l.Z.debug("ABR: New last stable representation",e.bitrate),this._lastRepresentationWithGoodScore=e)},t.getEstimate=function(e){if(null!==this._currentRepresentationData&&this._currentRepresentationData.representation.id===e.id){var t=this._currentRepresentationData,n=t.ewma,r=t.loadedSegments,i=t.loadedDuration;return{score:n.getEstimate(),confidenceLevel:r>=5&&i>=10?1:0}}},t.getLastStableRepresentation=function(){return this._lastRepresentationWithGoodScore},e}();function ne(e,t,n,r){var i=t<=n?n:t>=r?r:t,a=(0,B.Z)(e,(function(e){return e.bitrate>i}));return-1===a?e[e.length-1]:0===a?e[0]:e[a-1]}var re=(0,k.ZP)(-1);re.finish();var ie=(0,k.ZP)(0);ie.finish();var ae=(0,k.ZP)(1/0);ae.finish();var oe=(0,k.ZP)(void 0);oe.finish();var se=(0,k.ZP)(1/0);se.finish();var ue=function(e){var t={},n=e.manualBitrates,r=e.minAutoBitrates,i=e.maxAutoBitrates,a=e.initialBitrates,o=e.throttlers,s=e.lowLatencyMode;return function(e,u,d,f,v){var p=e.adaptation.type,h=function(e){var n=t[e];if(null==n){l.Z.debug("ABR: Creating new BandwidthEstimator for ",e);var r=new Q;return t[e]=r,r}return n}(p),m=(0,U.Z)(n[p],re),g=(0,U.Z)(r[p],ie),y=(0,U.Z)(i[p],ae),_=(0,U.Z)(a[p],0);return function(e,t){var n=e.bandwidthEstimator,r=e.context,i=e.currentRepresentation,a=e.filters,o=e.initialBitrate,s=e.lowLatencyMode,u=e.manualBitrate,d=e.maxAutoBitrate,f=e.minAutoBitrate,v=e.playbackObserver,p=e.representations,h=new te,m=new H(null!=o?o:0,s),g=new ee,y=L.Z,_={metrics:I,requestBegin:Z,requestProgress:R,requestEnd:x,addedSegment:function(e){y(e)}},b=new w.ZP;b.linkToSignal(t);var S=T(p.getValue(),b.signal);return p.onUpdate(A,{clearSignal:t}),{estimates:S,callbacks:_};function T(e,t){if(0===e.length)return(0,k.ZP)({representation:null,bitrate:void 0,knownStableBitrate:void 0,manual:!1,urgent:!0});if(1===e.length)return(0,k.ZP)({bitrate:void 0,representation:e[0],manual:!1,urgent:!0,knownStableBitrate:void 0});var o=!1,p=new V(e.map((function(e){return e.bitrate}))),_=new $,b=new Y(h,_),S=v.getReference().getValue(),T=(0,k.ZP)(A());return v.listen((function(e){S=e,w()}),{includeLastObservation:!1,clearSignal:t}),y=function(e){if(null!==S){var t=S,n=t.position,r=t.speed,i=e.buffered,a=(0,E.L7)(i,n.last),o=e.content.representation,s=h.getEstimate(o),u={bufferGap:a,currentBitrate:o.bitrate,currentScore:s,speed:r};p.onAddedSegment(u),w()}},t.register((function(){y=L.Z})),u.onUpdate(w,{clearSignal:t}),f.onUpdate(w,{clearSignal:t}),d.onUpdate(w,{clearSignal:t}),a.limitWidth.onUpdate(w,{clearSignal:t}),a.limitWidth.onUpdate(w,{clearSignal:t}),T;function w(){T.setValue(A())}function A(){var t=u.getValue();if(t>=0)return{representation:ne(e,t,0,1/0),bitrate:void 0,knownStableBitrate:void 0,manual:!0,urgent:!0};var v=S,y=v.bufferGap,T=v.position,E=v.maximumPosition,k=a.limitWidth.getValue(),w=a.throttleBitrate.getValue(),A=i.getValue(),I=f.getValue(),Z=d.getValue(),R=function(e,t,n){var r=e;n<1/0&&(r=function(e,t){if(0===e.length)return[];e.sort((function(e,t){return e.bitrate-t.bitrate}));var n=e[0].bitrate,r=Math.max(t,n),i=(0,B.Z)(e,(function(e){return e.bitrate>r}));return-1===i?e:e.slice(0,i)}(r,n));void 0!==t&&(r=function(e,t){var n=e.slice().sort((function(e,t){return(0,U.Z)(e.width,0)-(0,U.Z)(t.width,0)})),r=(0,z.Z)(n,(function(e){return"number"==typeof e.width&&e.width>=t}));if(void 0===r)return e;var i="number"==typeof r.width?r.width:0;return e.filter((function(e){return"number"!=typeof e.width||e.width<=i}))}(r,t));return r}(e,k,w),x=g.getRequests(),M=m.getBandwidthEstimate(S,n,A,x,_.bandwidth),C=M.bandwidthEstimate,P=M.bitrateChosen,D=h.getLastStableRepresentation(),N=null===D?void 0:D.bitrate/(S.speed>0?S.speed:1),O=c.Z.getCurrent(),L=O.ABR_ENTER_BUFFER_BASED_ALGO,F=O.ABR_EXIT_BUFFER_BASED_ALGO;o&&y<=F?o=!1:!o&&isFinite(y)&&y>=L&&(o=!0);var V=ne(R,P,I,Z),K=p.getLastEstimate(),G=V.bitrate,W=null;o&&void 0!==K&&K>G&&(G=(W=ne(R,K,I,Z)).bitrate);var H=null;return s&&null!==A&&r.manifest.isDynamic&&E-T.last<40&&(H=b.getGuess(e,S,A,G,x)),null!==H&&H.bitrate>G?(l.Z.debug("ABR: Choosing representation with guess-based estimation.",H.bitrate,H.id),_.update(H,C,2),{bitrate:C,representation:H,urgent:null===A||H.bitrate=500||404===e.status||415===e.status||412===e.status:e.type===p.br.TIMEOUT||e.type===p.br.ERROR_EVENT:e instanceof ve.Z?"boolean"==typeof e.canRetry?e.canRetry:void 0!==e.xhr&&(e.xhr.status>=500||404===e.xhr.status||415===e.xhr.status||412===e.xhr.status):(0,pe.Z)(e)&&"INTEGRITY_ERROR"===e.code}function ye(e){return e instanceof de.Z?e.type===p.br.ERROR_EVENT&&!1===navigator.onLine:e instanceof ve.Z&&e.isOfflineError}function _e(e,t,n,r,i){return be.apply(this,arguments)}function be(){return be=(0,I.Z)(R().mark((function e(t,n,r,i,a){var o,s,u,d,c,f,v,p,h,m,g,y,_,b;return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(b=function(e){var t;if(0===f.size)return e[0];var n=performance.now();return null===(t=e.filter((function(e){var t;return!0!==(null===(t=f.get(e))||void 0===t?void 0:t.isBlacklisted)})).reduce((function(e,t){var r,i=null===(r=f.get(t))||void 0===r?void 0:r.blockedUntil;return void 0!==i&&i<=n&&(i=void 0),void 0===e?[t,i]:void 0===i?void 0===e[1]?e:[t,void 0]:void 0===e[1]?e:iv?(c.blockedUntil=void 0,c.isBlacklisted=!0):(p=c.errorCounter,h=Math.min(o*Math.pow(2,p-1),s),m=(0,me.Z)(h),c.blockedUntil=performance.now()+m),e.abrupt("return",g(e.t0));case 22:case"end":return e.stop()}var y}),e,null,[[0,7]])})))).apply(this,arguments)},h=function(e){return m.apply(this,arguments)},p=function(){if(null===t){var e=f.get(null);if(void 0!==e&&e.isBlacklisted)return;return null}if(null===n)return b(t);var r=n.getCdnPreferenceForResource(t);return b(r)},null===a.cancellationError){e.next=9;break}return e.abrupt("return",Promise.reject(a.cancellationError));case 9:if(o=i.baseDelay,s=i.maxDelay,u=i.maxRetryRegular,d=i.maxRetryOffline,c=i.onRetry,null!==t&&0===t.length&&l.Z.warn("Fetchers: no CDN given to `scheduleRequestWithCdns`."),f=new Map,void 0!==(v=p())){e.next=15;break}throw new Error("No CDN to request");case 15:return e.abrupt("return",h(v));case 16:case"end":return e.stop()}}),e)}))),be.apply(this,arguments)}function Se(e,t,n){return _e(null,null,e,t,n)}function Te(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Ee(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ee(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Ee(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0?this._consecutiveUnsafeMode=u,v=void 0===r?0:performance.now()-r,p=Math.max(this._settings.minimumManifestUpdateInterval-v,0),h=new w.ZP;if(h.linkToSignal(this._canceller.signal),this.scheduleManualRefresh=function(t){var i=t.enablePartialRefresh,a=t.delay,o=t.canUseUnsafeMode&&f,s=void 0===r?0:performance.now()-r,u=Math.max(n._settings.minimumManifestUpdateInterval-s,0),l=setTimeout((function(){h.cancel(),n._triggerNextManifestRefresh(e,{enablePartialRefresh:i,unsafeMode:o})}),Math.max((null!=a?a:0)-s,u));h.signal.register((function(){clearTimeout(l)}))},null!==e.expired){var m=setTimeout((function(){var t;null===(t=e.expired)||void 0===t||t.then((function(){h.cancel(),n._triggerNextManifestRefresh(e,{enablePartialRefresh:!1,unsafeMode:f})}),L.Z)}),p);h.signal.register((function(){clearTimeout(m)}))}if(void 0!==e.lifetime&&e.lifetime>=0){var g,y=1e3*e.lifetime-v;void 0===d?g=y:e.lifetime<3&&d>=100?(g=Math.min(Math.max(3e3-v,Math.max(y,0)+d),6*y),l.Z.info("MUS: Manifest update rythm is too frequent. Postponing next request.",y,g)):d>=1e3*e.lifetime/10?(g=Math.min(Math.max(y,0)+d,6*y),l.Z.info("MUS: Manifest took too long to parse. Postponing next request",g,g)):g=y;var _=setTimeout((function(){h.cancel(),n._triggerNextManifestRefresh(e,{enablePartialRefresh:!1,unsafeMode:f})}),Math.max(g,p));h.signal.register((function(){clearTimeout(_)}))}},r._triggerNextManifestRefresh=function(e,t){var n,r,i=this,a=t.enablePartialRefresh,o=t.unsafeMode,s=e.updateUrl;null!==this._prioritizedContentUrl?(n=!0,r=this._prioritizedContentUrl,this._prioritizedContentUrl=null):r=(n=!a||void 0===s)?e.getUrl():s;var u=e.clockOffset;o?(this._consecutiveUnsafeMode+=1,l.Z.info('Init: Refreshing the Manifest in "unsafeMode" for the '+String(this._consecutiveUnsafeMode)+" consecutive time.")):this._consecutiveUnsafeMode>0&&(l.Z.info('Init: Not parsing the Manifest in "unsafeMode" anymore after '+String(this._consecutiveUnsafeMode)+" consecutive times."),this._consecutiveUnsafeMode=0),this._isRefreshPending||(this._isRefreshPending=!0,this._fetchManifest(r).then((function(t){return t.parse({externalClockOffset:u,previousManifest:e,unsafeMode:o})})).then((function(t){i._isRefreshPending=!1;var r=t.manifest,a=t.sendingTime,o=t.parsingTime,s=performance.now();if(n)e.replace(r);else try{e.update(r)}catch(t){var u=t instanceof Error?t.message:"unknown error";l.Z.warn("MUS: Attempt to update Manifest failed: "+u,"Re-downloading the Manifest fully");var d=c.Z.getCurrent().FAILED_PARTIAL_UPDATE_MANIFEST_REFRESH_DELAY,f=void 0===a?0:performance.now()-a,v=Math.max(i._settings.minimumManifestUpdateInterval-f,0),p=L.Z,h=setTimeout((function(){p(),i._triggerNextManifestRefresh(e,{enablePartialRefresh:!1,unsafeMode:!1})}),Math.max(d-f,v));return void(p=i._canceller.signal.register((function(){clearTimeout(h)})))}var m=performance.now()-s;i._recursivelyRefreshManifest(e,{sendingTime:a,parsingTime:o,updatingTime:m})})).catch((function(e){i._isRefreshPending=!1,i._onFatalError(e)})))},r._onFatalError=function(e){this._canceller.isUsed()||(this.trigger("error",e),this.dispose())},n}(_.Z);var we=ke;function Ae(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Ie(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ie(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Ie(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0&&this._removeIndexFromDowngradeList(n);var r=c.Z.getCurrent().DEFAULT_CDN_DOWNGRADE_TIME;this._downgradedCdnList.metadata.push(e);var i=window.setTimeout((function(){var n=Re(t._downgradedCdnList.metadata,e);n>=0&&t._removeIndexFromDowngradeList(n),t.trigger("priorityChange",null)}),r);this._downgradedCdnList.timeouts.push(i),this.trigger("priorityChange",null)},r._innerGetCdnPreferenceForResource=function(e){var t=this,n=e.reduce((function(e,n){return t._downgradedCdnList.metadata.some((function(e){return e.id===n.id&&e.baseUrl===n.baseUrl}))?e[1].push(n):e[0].push(n),e}),[[],[]]),r=n[0],i=n[1];return r.concat(i)},r._removeIndexFromDowngradeList=function(e){this._downgradedCdnList.metadata.splice(e,1);var t=this._downgradedCdnList.timeouts.splice(e,1);clearTimeout(t[0])},n}(_.Z);function Re(e,t){return 0===e.length?-1:void 0!==t.id?(0,B.Z)(e,(function(e){return e.id===t.id})):(0,B.Z)(e,(function(e){return e.baseUrl===t.baseUrl}))}var xe=n(520),Me=function(){function e(){this._cache=new WeakMap}var t=e.prototype;return t.add=function(e,t){var n=e.representation;e.segment.isInit&&this._cache.set(n,t)},t.get=function(e){var t=e.representation;if(e.segment.isInit){var n=this._cache.get(t);if(void 0!==n)return n}return null},e}(),Ce=(0,b.Z)();var Pe=function(){function e(e){var t=e.prioritySteps;if(this._minPendingPriority=null,this._waitingQueue=[],this._pendingTasks=[],this._prioritySteps=t,this._prioritySteps.high>=this._prioritySteps.low)throw new Error("TP: the max high level priority should be given a lowerpriority number than the min low priority.")}var t=e.prototype;return t.create=function(e,t,n,r){var i,a=this;return(0,O.Z)(r,(function(o,s){return i={hasEnded:!1,priority:t,trigger:function(){if(!i.hasEnded){var e=function(){u(),a._endTask(i)},t=new w.ZP,u=t.linkToSignal(r);i.interrupter=t,t.signal.register((function(){i.interrupter=null,r.isCancelled()||n.beforeInterrupted()})),a._minPendingPriority=null===a._minPendingPriority?i.priority:Math.min(a._minPendingPriority,i.priority),a._pendingTasks.push(i),i.taskFn(t.signal).then((function(t){n.beforeEnded(),e(),o(t)})).catch((function(n){!r.isCancelled()&&t.isUsed()&&n instanceof w.FU||function(t){e(),s(t)}(n)}))}},taskFn:e,interrupter:null},a._canBeStartedNow(i)?(i.trigger(),a._isRunningHighPriorityTasks()&&a._interruptCancellableTasks()):a._waitingQueue.push(i),function(){return a._endTask(i)}}))},t._endTask=function(e){e.hasEnded=!0;var t=De(e.taskFn,this._waitingQueue);if(t>=0)this._waitingQueue.splice(t,1);else{var n=De(e.taskFn,this._pendingTasks);if(n<0)return;this._pendingTasks.splice(n,1),this._pendingTasks.length>0?this._minPendingPriority===e.priority&&(this._minPendingPriority=Math.min.apply(Math,this._pendingTasks.map((function(e){return e.priority})))):this._minPendingPriority=null,this._loopThroughWaitingQueue()}},t.updatePriority=function(e,t){var n=De(e,this._waitingQueue);if(n>=0){var r=this._waitingQueue[n];if(r.priority===t)return;if(r.priority=t,!this._canBeStartedNow(r))return;return this._findAndRunWaitingQueueTask(n),void(this._isRunningHighPriorityTasks()&&this._interruptCancellableTasks())}var i=De(e,this._pendingTasks);if(i<0)l.Z.warn("TP: request to update the priority of a non-existent task");else{var a=this._pendingTasks[i];if(a.priority!==t){var o=a.priority;a.priority=t,null===this._minPendingPriority||tt.priority?t.priority:e}),null);if(!(null===e||null!==this._minPendingPriority&&this._minPendingPriority=this._prioritySteps.low)return this._interruptPendingTask(t),this._interruptCancellableTasks()}},t._findAndRunWaitingQueueTask=function(e){return e>=this._waitingQueue.length||e<0?(l.Z.warn("TP : Tried to start a non existing task"),!1):(this._waitingQueue.splice(e,1)[0].trigger(),!0)},t._interruptPendingTask=function(e){var t,n=De(e.taskFn,this._pendingTasks);n<0?l.Z.warn("TP: Interrupting a non-existent pending task. Aborting..."):(this._pendingTasks.splice(n,1),this._waitingQueue.push(e),0===this._pendingTasks.length?this._minPendingPriority=null:this._minPendingPriority===e.priority&&(this._minPendingPriority=Math.min.apply(Math,this._pendingTasks.map((function(e){return e.priority})))),null===(t=e.interrupter)||void 0===t||t.cancel())},t._canBeStartedNow=function(e){return null===this._minPendingPriority||e.priority<=this._minPendingPriority},t._isRunningHighPriorityTasks=function(){return null!==this._minPendingPriority&&this._minPendingPriority<=this._prioritySteps.high},e}();function De(e,t){return(0,B.Z)(t,(function(t){return t.taskFn===e}))}var Ne=function(){function e(e,t,n){var r=new Ze(n),i=c.Z.getCurrent(),a=i.MIN_CANCELABLE_PRIORITY,o=i.MAX_HIGH_PRIORITY_LEVEL;this._transport=e,this._prioritizer=new Pe({prioritySteps:{high:o,low:a}}),this._cdnPrioritizer=r,this._backoffOptions=t}return e.prototype.createSegmentFetcher=function(e,t){var n,r,i,a=function(e,t){var n=t.maxRetryRegular,r=t.maxRetryOffline,i=t.lowLatencyMode,a=t.requestTimeout,o=c.Z.getCurrent(),s=o.DEFAULT_MAX_REQUESTS_RETRY_ON_ERROR,u=o.DEFAULT_REQUEST_TIMEOUT,l=o.DEFAULT_MAX_REQUESTS_RETRY_ON_OFFLINE,d=o.INITIAL_BACKOFF_DELAY_BASE,f=o.MAX_BACKOFF_DELAY_BASE;return{maxRetryRegular:"image"===e?0:null!=n?n:s,maxRetryOffline:null!=r?r:l,baseDelay:i?d.LOW_LATENCY:d.REGULAR,maxDelay:i?f.LOW_LATENCY:f.REGULAR,requestTimeout:(0,S.Z)(a)?u:a}}(e,this._backoffOptions),o=function(e,t,n,r,i){var a={timeout:i.requestTimeout<0?void 0:i.requestTimeout},o=(0,g.Z)(["audio","video"],e)?new Me:void 0,s=t.loadSegment,u=t.parseSegment;return function(){var e=(0,I.Z)(R().mark((function e(t,d,c){var v,p,h,m,g,y,_,b,E,k,A,I,Z,x,M,C,P,D;return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(D=function(){var e;E||!(0,S.Z)(y)&&void 0!==y.size&&void 0!==y.requestDuration&&_.length>0&&_.every((function(e){return e}))&&(E=!0,null===(e=r.onMetrics)||void 0===e||e.call(r,{size:y.size,requestDuration:y.requestDuration,content:t,segmentDuration:b}))},P=function(e){d.onRetry(fe(e))},C=function(e,n){_.push(!1);var r=_.length-1;return function(i){var a={data:e,isChunked:n};try{var o=u(a,t,i);return _[r]||(b=void 0!==b&&"media"===o.segmentType&&null!==o.chunkInfos&&void 0!==o.chunkInfos.duration?b+o.chunkInfos.duration:void 0,_[r]=!0,D()),o}catch(e){throw(0,f.Z)(e,{defaultCode:"PIPELINE_PARSE_ERROR",defaultReason:"Unknown parsing error"})}}},M=function(e){return s(e,t,a,c,k)},x=function(){var e;void 0===y&&(l.Z.debug("SF: Segment request cancelled",m),y=null,null===(e=r.onRequestEnd)||void 0===e||e.call(r,{id:g}))},m=(0,xe.K)(t),g=Ce(),_=[],b=0,E=!1,k={onProgress:function(e){var t;void 0===y&&void 0!==e.totalSize&&e.size0;){var e=this._queue.shift();void 0!==e&&e.reject(new w.FU)}if("open"===this._mediaSource.readyState)try{l.Z.debug("AVSB: Calling `abort` on the SourceBuffer"),this._sourceBuffer.abort()}catch(e){l.Z.warn("AVSB: Failed to abort a "+this.bufferType+" SourceBuffer:",e instanceof Error?e:"")}},r._onPendingTaskError=function(e){if(this._lastInitSegment=null,null!==this._pendingTask){var t=e instanceof Error?e:new Error("An unknown error occured when doing operations on the SourceBuffer");this._pendingTask.reject(t)}},r._addToQueue=function(e,t){var n=this;return(0,O.Z)(t,(function(t,r){var i=0===n._queue.length&&null===n._pendingTask,a=(0,T.Z)({resolve:t,reject:r},e);return n._queue.push(a),i&&n._flush(),function(){var e=n._queue.indexOf(a);e>=0&&n._queue.splice(e,1),a.resolve=L.Z,a.reject=L.Z}}))},r._flush=function(){if(!this._sourceBuffer.updating){if(null!==this._pendingTask){var e=this._pendingTask;if(e.type!==Ve.f.Push||0===e.data.length){switch(e.type){case Ve.f.Push:null!==e.inventoryData&&this._segmentInventory.insertChunk(e.inventoryData);break;case Ve.f.EndOfSegment:this._segmentInventory.completeSegment(e.value,this.getBufferedRanges());break;case Ve.f.Remove:this.synchronizeInventory();break;default:(0,Ue.Z)(e)}var t=e.resolve;return this._pendingTask=null,t(),void this._flush()}}else{var n=this._queue.shift();if(void 0===n)return;if(n.type!==Ve.f.Push)this._pendingTask=n;else{var r,i=n.value;try{r=this._preparePushOperation(i.data)}catch(e){this._pendingTask=(0,T.Z)({data:[],inventoryData:i.inventoryInfos},n);var a=e instanceof Error?e:new Error("An unknown error occured when preparing a push operation");return this._lastInitSegment=null,void n.reject(a)}this._pendingTask=(0,T.Z)({data:r,inventoryData:i.inventoryInfos},n)}}try{switch(this._pendingTask.type){case Ve.f.EndOfSegment:return l.Z.debug("AVSB: Acknowledging complete segment",(0,xe.K)(this._pendingTask.value)),void this._flush();case Ve.f.Push:var o=this._pendingTask.data.shift();if(void 0===o)return void this._flush();l.Z.debug("AVSB: pushing segment",this.bufferType,(0,xe.K)(this._pendingTask.inventoryData)),this._sourceBuffer.appendBuffer(o);break;case Ve.f.Remove:var s=this._pendingTask.value,u=s.start,d=s.end;l.Z.debug("AVSB: removing data from SourceBuffer",this.bufferType,u,d),this._sourceBuffer.remove(u,d);break;default:(0,Ue.Z)(this._pendingTask)}}catch(e){this._onPendingTaskError(e)}}},r._preparePushOperation=function(e){var t=[],n=e.codec,r=e.timestampOffset,i=e.appendWindow,a=!1;if(void 0!==n&&n!==this.codec&&(l.Z.debug("AVSB: updating codec",n),a=function(e,t){if("function"==typeof e.changeType){try{e.changeType(t)}catch(e){return l.Z.warn("Could not call 'changeType' on the given SourceBuffer:",e instanceof Error?e:""),!1}return!0}return!1}(this._sourceBuffer,n),a?this.codec=n:l.Z.debug("AVSB: could not update codec",n,this.codec)),this._sourceBuffer.timestampOffset!==r){var o=r;l.Z.debug("AVSB: updating timestampOffset",this.bufferType,this._sourceBuffer.timestampOffset,o),this._sourceBuffer.timestampOffset=o}if(void 0===i[0])this._sourceBuffer.appendWindowStart>0&&(l.Z.debug("AVSB: re-setting `appendWindowStart` to `0`"),this._sourceBuffer.appendWindowStart=0);else if(i[0]!==this._sourceBuffer.appendWindowStart){if(i[0]>=this._sourceBuffer.appendWindowEnd){var s=i[0]+1;l.Z.debug("AVSB: pre-updating `appendWindowEnd`",s),this._sourceBuffer.appendWindowEnd=s}l.Z.debug("AVSB: setting `appendWindowStart`",i[0]),this._sourceBuffer.appendWindowStart=i[0]}if(void 0===i[1]?this._sourceBuffer.appendWindowEnd!==1/0&&(l.Z.debug("AVSB: re-setting `appendWindowEnd` to `Infinity`"),this._sourceBuffer.appendWindowEnd=1/0):i[1]!==this._sourceBuffer.appendWindowEnd&&(l.Z.debug("AVSB: setting `appendWindowEnd`",i[1]),this._sourceBuffer.appendWindowEnd=i[1]),null!==e.initSegment&&(a||!this._isLastInitSegment(e.initSegment))){var u=e.initSegment;t.push(u);var d=(0,Be._f)(u);this._lastInitSegment={data:d,hash:(0,Fe.Z)(d)}}return null!==e.chunk&&t.push(e.chunk),t},r._isLastInitSegment=function(e){if(null===this._lastInitSegment)return!1;if(this._lastInitSegment.data===e)return!0;var t=this._lastInitSegment.data;if(t.byteLength===e.byteLength){var n=(0,Be._f)(e);if((0,Fe.Z)(n)===this._lastInitSegment.hash&&(0,m.Z)(t,n))return!0}return!1},n}(Ve.C),Ke=["audio","video","text","image"];function Ge(e){return"audio"===e||"video"===e}var We=function(){function e(e,t){this._mediaElement=e,this._mediaSource=t,this._initializedSegmentBuffers={},this._onNativeBufferAddedOrDisabled=[]}e.isNative=function(e){return Ge(e)};var t=e.prototype;return t.getBufferTypes=function(){var e=this.getNativeBufferTypes();return null==h.Z.nativeTextTracksBuffer&&null==h.Z.htmlTextTracksBuffer||e.push("text"),null!=h.Z.imageBuffer&&e.push("image"),e},t.getNativeBufferTypes=function(){return"AUDIO"===this._mediaElement.nodeName?["audio"]:["video","audio"]},t.getStatus=function(e){var t=this._initializedSegmentBuffers[e];return void 0===t?{type:"uninitialized"}:null===t?{type:"disabled"}:{type:"initialized",value:t}},t.waitForUsableBuffers=function(e){var t=this;return this._areNativeBuffersUsable()?Promise.resolve():(0,O.Z)(e,(function(e){var n,r=function(){var e=t._onNativeBufferAddedOrDisabled.indexOf(n);e>=0&&t._onNativeBufferAddedOrDisabled.splice(e,1)};return n=function(){t._areNativeBuffersUsable()&&(r(),e())},t._onNativeBufferAddedOrDisabled.push(n),r}))},t.disableSegmentBuffer=function(t){var n=this._initializedSegmentBuffers[t];if(null!==n){if(void 0!==n)throw new Error("Cannot disable an active SegmentBuffer.");this._initializedSegmentBuffers[t]=null,e.isNative(t)&&this._onNativeBufferAddedOrDisabled.forEach((function(e){return e()}))}else l.Z.warn("SBS: The "+t+" SegmentBuffer was already disabled.")},t.createSegmentBuffer=function(e,t,n){void 0===n&&(n={});var r,i=this._initializedSegmentBuffers[e];if(Ge(e)){if(null!=i)return i instanceof ze&&i.codec!==t?l.Z.warn("SB: Reusing native SegmentBuffer with codec",i.codec,"for codec",t):l.Z.info("SB: Reusing native SegmentBuffer with codec",t),i;l.Z.info("SB: Adding native SegmentBuffer with codec",t);var a=new ze(e,t,this._mediaSource);return this._initializedSegmentBuffers[e]=a,this._onNativeBufferAddedOrDisabled.forEach((function(e){return e()})),a}if(null!=i)return l.Z.info("SB: Reusing a previous custom SegmentBuffer for the type",e),i;if("text"===e){if(l.Z.info("SB: Creating a new text SegmentBuffer"),"html"===n.textTrackMode){if(null==h.Z.htmlTextTracksBuffer)throw new Error("HTML Text track feature not activated");r=new h.Z.htmlTextTracksBuffer(this._mediaElement,n.textTrackElement)}else{if(null==h.Z.nativeTextTracksBuffer)throw new Error("Native Text track feature not activated");r=new h.Z.nativeTextTracksBuffer(this._mediaElement,!0===n.hideNativeSubtitle)}return this._initializedSegmentBuffers.text=r,r}if("image"===e){if(null==h.Z.imageBuffer)throw new Error("Image buffer feature not activated");return l.Z.info("SB: Creating a new image SegmentBuffer"),r=new h.Z.imageBuffer,this._initializedSegmentBuffers.image=r,r}throw l.Z.error("SB: Unknown buffer type:",e),new v.Z("BUFFER_TYPE_UNKNOWN","The player wants to create a SegmentBuffer of an unknown type.")},t.disposeSegmentBuffer=function(e){var t=this._initializedSegmentBuffers[e];null!=t?(l.Z.info("SB: Aborting SegmentBuffer",e),t.dispose(),delete this._initializedSegmentBuffers[e]):l.Z.warn("SB: Trying to dispose a SegmentBuffer that does not exist")},t.disposeAll=function(){var e=this;Ke.forEach((function(t){"initialized"===e.getStatus(t).type&&e.disposeSegmentBuffer(t)}))},t._areNativeBuffersUsable=function(){var e=this,t=this.getNativeBufferTypes();return!t.some((function(t){return void 0===e._initializedSegmentBuffers[t]}))&&!t.every((function(t){return null===e._initializedSegmentBuffers[t]}))},e}(),He=n(7473),je=n.n(He),qe=function(){function e(e){this._array=[],this._sortingFn=e}var t=e.prototype;return t.add=function(){for(var e=arguments.length,t=new Array(e),n=0;n=this._array.length)throw new Error("Invalid index.");return this._array[e]},t.toArray=function(){return this._array.slice()},t.findFirst=function(e){return(0,z.Z)(this._array,e)},t.has=function(e){return(0,g.Z)(this._array,e)},t.removeElement=function(e){var t=this._array.indexOf(e);if(t>=0)return this._array.splice(t,1),t},t.head=function(){return this._array[0]},t.last=function(){return this._array[this._array.length-1]},t.shift=function(){return this._array.shift()},t.pop=function(){return this._array.pop()},e}(),Ye=function(){function e(e){this._weakMap=new WeakMap,this._fn=e}var t=e.prototype;return t.get=function(e){var t=this._weakMap.get(e);if(void 0===t){var n=this._fn(e);return this._weakMap.set(e,n),n}return t},t.destroy=function(e){this._weakMap.delete(e)},e}();function Xe(e,t){var n,r=e.segmentBuffer,i=e.playbackObserver,a=e.maxBufferBehind,o=e.maxBufferAhead;function s(){(function(e,t,n,r,i){return Qe.apply(this,arguments)})(r,n,a.getValue(),o.getValue(),t).catch((function(e){var t=e instanceof Error?e.message:"Unknown error";l.Z.error("Could not run BufferGarbageCollector:",t)}))}i.listen((function(e){var t;n=null!==(t=e.position.pending)&&void 0!==t?t:e.position.last,s()}),{includeLastObservation:!0,clearSignal:t}),a.onUpdate(s,{clearSignal:t}),o.onUpdate(s,{clearSignal:t}),s()}function Qe(){return(Qe=(0,I.Z)(R().mark((function e(t,n,r,i,a){var o,s,u,d,c,f,v,p;return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(isFinite(r)||isFinite(i)){e.next=2;break}return e.abrupt("return",Promise.resolve());case 2:o=[],s=(0,E.F_)(t.getBufferedRanges(),n),u=s.innerRange,d=s.outerRanges,c=function(){if(isFinite(i)){for(var e=0;et.start&&o.push({start:n+i,end:t.end})}null!=u&&n+i=t.end?o.push(t):n>=t.end&&n-r>t.start&&n-ru.start&&o.push({start:u.start,end:n-r})}}(),c(),f=0,v=o;case 9:if(!(f0&&n[0].segment.id===e._mediaSegmentAwaitingInitMetadata)){var r=e._mediaSegmentRequest;if(0===n.length){if(null===r)return;return l.Z.debug("Stream: no more media segment to request. Cancelling queue.",e._content.adaptation.type),void e._restartMediaSegmentDownloadingQueue()}if(null===r)return l.Z.debug("Stream: Media segments now need to be requested. Starting queue.",e._content.adaptation.type,n.length),void e._restartMediaSegmentDownloadingQueue();var i=n[0];return r.segment.id!==i.segment.id?(l.Z.debug("Stream: Next media segment changed, cancelling previous",e._content.adaptation.type),void e._restartMediaSegmentDownloadingQueue()):void(r.priority!==i.priority&&(l.Z.debug("Stream: Priority of next media segment changed, updating",e._content.adaptation.type,r.priority,i.priority),e._segmentFetcher.updatePriority(r.request,i.priority)))}}),{emitCurrentValue:!0,clearSignal:this._currentCanceller.signal}),this._downloadQueue.onUpdate((function(t){var n,r=e._initSegmentRequest;null===t.initSegment||null===r?(null===(n=t.initSegment)||void 0===n?void 0:n.segment.id)!==(null==r?void 0:r.segment.id)&&(null===t.initSegment&&l.Z.debug("Stream: no more init segment to request. Cancelling queue.",e._content.adaptation.type),e._restartInitSegmentDownloadingQueue(t.initSegment)):t.initSegment.priority!==r.priority&&e._segmentFetcher.updatePriority(r.request,t.initSegment.priority)}),{emitCurrentValue:!0,clearSignal:this._currentCanceller.signal}))},r.stop=function(){var e;null===(e=this._currentCanceller)||void 0===e||e.cancel(),this._currentCanceller=null},r._restartMediaSegmentDownloadingQueue=function(){var e=this;null!==this._mediaSegmentRequest&&this._mediaSegmentRequest.canceller.cancel();!function t(n){if(null!==e._currentCanceller&&e._currentCanceller.isUsed())e._mediaSegmentRequest=null;else{if(void 0===n)return e._mediaSegmentRequest=null,void e.trigger("emptyQueue",null);var r=new w.ZP,i=null===e._currentCanceller?L.Z:r.linkToSignal(e._currentCanceller.signal),a=n.segment,o=n.priority,s=(0,T.Z)({segment:a},e._content),u=!1,d=!1;r.signal.register((function(){e._mediaSegmentRequest=null,u||(e._mediaSegmentAwaitingInitMetadata===a.id&&(e._mediaSegmentAwaitingInitMetadata=null),u=!0,d=!1)}));var c=function(t){(0,y.Z)("media"===t.segmentType,"Should have loaded a media segment."),e.trigger("parsedMediaSegment",(0,T.Z)({},t,{segment:a}))},f=function(){var n=e._downloadQueue.getValue().segmentQueue;if(0===n.length)return u=!0,void e.trigger("emptyQueue",null);n[0].segment.id===a.id&&n.shift(),u=!0,t(n[0])},v=e._segmentFetcher.createRequest(s,o,{onRetry:function(t){e.trigger("requestRetry",{segment:a,error:t})},beforeInterrupted:function(){l.Z.info("Stream: segment request interrupted temporarly.",a.id,a.time)},onChunk:function(t){var n=e._initSegmentInfoRef.getValue();void 0!==n?c(t(null!=n?n:void 0)):(d=!0,e._initSegmentInfoRef.waitUntilDefined((function(e){c(t(null!=e?e:void 0))}),{clearSignal:r.signal}))},onAllChunksReceived:function(){d?(e._mediaSegmentAwaitingInitMetadata=a.id,e._initSegmentInfoRef.waitUntilDefined((function(){e._mediaSegmentAwaitingInitMetadata=null,d=!1,e.trigger("fullyLoadedSegment",a)}),{clearSignal:r.signal})):e.trigger("fullyLoadedSegment",a)},beforeEnded:function(){i(),e._mediaSegmentRequest=null,d?e._initSegmentInfoRef.waitUntilDefined(f,{clearSignal:r.signal}):f()}},r.signal);v.catch((function(t){i(),u||(u=!0,e.stop(),e.trigger("error",t))})),e._mediaSegmentRequest={segment:a,priority:o,request:v,canceller:r}}}(this._downloadQueue.getValue().segmentQueue[0])},r._restartInitSegmentDownloadingQueue=function(e){var t=this;if((null===this._currentCanceller||!this._currentCanceller.isUsed())&&(null!==this._initSegmentRequest&&this._initSegmentRequest.canceller.cancel(),null!==e)){var n=new w.ZP,r=null===this._currentCanceller?L.Z:n.linkToSignal(this._currentCanceller.signal),i=e.segment,a=e.priority,o=(0,T.Z)({segment:i},this._content),s=!1,u=this._segmentFetcher.createRequest(o,a,{onRetry:function(e){t.trigger("requestRetry",{segment:i,error:e})},beforeInterrupted:function(){l.Z.info("Stream: init segment request interrupted temporarly.",i.id)},beforeEnded:function(){r(),t._initSegmentRequest=null,s=!0},onChunk:function(e){var n,r=e(void 0);(0,y.Z)("init"===r.segmentType,"Should have loaded an init segment."),t.trigger("parsedInitSegment",(0,T.Z)({},r,{segment:i})),"init"===r.segmentType&&t._initSegmentInfoRef.setValue(null!==(n=r.initTimescale)&&void 0!==n?n:null)},onAllChunksReceived:function(){t.trigger("fullyLoadedSegment",i)}},n.signal);u.catch((function(e){r(),s||(s=!0,t.stop(),t.trigger("error",e))})),n.signal.register((function(){t._initSegmentRequest=null,s||(s=!0)})),this._initSegmentRequest={segment:i,priority:a,request:u,canceller:n}}},n}(_.Z);function Je(e,t,n,r,i){var a=e.period,o=e.adaptation,s=e.representation,u=function(e,t){for(var n=0;n=t.end)return null;if(r.bufferedEnd>t.start)return n}return null}(i,t);if(null===u){if(null===n){if(r&&void 0!==a.end&&t.end>=a.end)return{start:void 0,end:null};var d=s.index.checkDiscontinuity(t.start);if(null!==d)return{start:void 0,end:d}}return null}var c=i[u];if(void 0!==c.bufferedStart&&c.bufferedStart>t.start&&(null===n||c.infos.segment.end<=n)){var f=c.bufferedStart;return r||!1===s.index.awaitSegmentBetween(t.start,f)?(l.Z.debug("RS: current discontinuity encountered",o.type,c.bufferedStart),{start:void 0,end:f}):null}var v=function(e,t,n){if(n<=0)return l.Z.error("RS: Asked to check a discontinuity before the first chunk."),null;for(var r=n;r=t.end)return null;if(i.bufferedStart-a.bufferedEnd>0)return r}return null}(i,t,u+1);if(null!==v){var p=i[v-1],h=i[v];if(null===n||h.infos.segment.end<=n){if(!r&&!1!==s.index.awaitSegmentBetween(p.infos.segment.end,h.infos.segment.time))return null;var m=p.bufferedEnd,g=h.bufferedStart;return l.Z.debug("RS: future discontinuity encountered",o.type,m,g),{start:m,end:g}}}if(null===n){if(r&&void 0!==a.end){if(t.end=0;n--){var r=e[n];if(void 0===r.bufferedStart)return null;if(r.bufferedStart=a.end)return null;for(var b=i.length-1;b>=0;b--){var S=i[b];if(void 0===S.bufferedStart)break;if(S.bufferedStart=n.length-1?null:n[t+1],s=null;if(function(e,t,n){var r=c.Z.getCurrent().MAX_TIME_MISSING_FROM_COMPLETE_SEGMENT;if(void 0===e.bufferedStart)return l.Z.warn("Stream: Start of a segment unknown. Assuming it is garbage collected by default.",e.start),!0;if(null!==t&&void 0!==t.bufferedEnd&&e.bufferedStart-t.bufferedEnd<.1)return!1;if(nr)return l.Z.info("Stream: The start of the wanted segment has been garbage collected",e.start,e.bufferedStart),!0;return!1}(e,r,o.start)){if(function(e,t){var n,r;if(e.length<2)return!0;var i=e[e.length-1],a=null===(n=i.buffered)||void 0===n?void 0:n.start;if(void 0!==t&&void 0!==a&&t-a>.05)return!0;var o=e[e.length-2],s=null===(r=o.buffered)||void 0===r?void 0:r.start;if(void 0===s||void 0===a)return!0;return Math.abs(s-a)>.01}(s=a(e.infos),e.bufferedStart))return!1;l.Z.debug("Stream: skipping segment gc-ed at the start",e.start,e.bufferedStart)}if(function(e,t,n){var r=c.Z.getCurrent().MAX_TIME_MISSING_FROM_COMPLETE_SEGMENT;if(void 0===e.bufferedEnd)return l.Z.warn("Stream: End of a segment unknown. Assuming it is garbage collected by default.",e.end),!0;if(null!==t&&void 0!==t.bufferedStart&&t.bufferedStart-e.bufferedEnd<.1)return!1;if(n>e.bufferedEnd&&e.end-e.bufferedEnd>r)return l.Z.info("Stream: The end of the wanted segment has been garbage collected",e.start,e.bufferedStart),!0;return!1}(e,i,o.end)){if(function(e,t){var n,r;if(e.length<2)return!0;var i=e[e.length-1],a=null===(n=i.buffered)||void 0===n?void 0:n.end;if(void 0!==t&&void 0!==a&&a-t>.05)return!0;var o=e[e.length-2],s=null===(r=o.buffered)||void 0===r?void 0:r.end;if(void 0===s||void 0===a)return!0;return Math.abs(s-a)>.01}(s=null!=s?s:a(e.infos),e.bufferedEnd))return!1;l.Z.debug("Stream: skipping segment gc-ed at the end",e.end,e.bufferedEnd)}return!0})),m=c.Z.getCurrent(),g=m.MINIMUM_SEGMENT_SIZE,y=m.MIN_BUFFER_AHEAD,_=!1,b=Math.min(1/60,g),S=!1,E=[],k=p.filter((function(e){var t=(0,T.Z)({segment:e},n);if(s.length>0&&s.some((function(e){return(0,xe.z)(t,e)})))return!1;var u=e.duration,c=e.time,p=e.end;if(e.isInit)return!0;if(_)return E.push(e),!1;if(e.complete&&u0&&s.some((function(e){if(e.period.id!==n.period.id||e.adaptation.id!==n.adaptation.id)return!1;var a=e.segment;return!(a.time-b>c)&&(!(a.end+b-b&&w.end-p>-b)return!1}}var A=u*n.representation.bitrate;if(v-A<0&&(S=!0,c>o.start+y))return _=!0,E.push(e),!1;var I=a(t);if(I.length>1){var Z=I[I.length-1],R=I[I.length-2];if(null===Z.buffered&&null===R.buffered)return l.Z.warn("Stream: Segment GCed multiple times in a row, ignoring it.","If this happens a lot and lead to unpleasant experience, please check your device's available memory. If it's low when this message is emitted, you might want to update the RxPlayer's settings (`maxBufferAhead`, `maxVideoBufferSize` etc.) so less memory is used by regular media data buffering."+d.type,f.id,e.time),!1}for(var x=0;xc){var C=M.start>c+b||tt(h,x).ende[n].start;)n++;return e[--n]}function nt(e,t,n,r){var i=c.Z.getCurrent().CONTENT_REPLACEMENT_PADDING;return e.period.id===t.period.id&&(!(e.segment.timea}return rr}(e.representation,t.representation,r)))}function rt(e,t){for(var n=e-t,r=c.Z.getCurrent().SEGMENT_PRIORITIES_STEPS,i=0;i=u&&l.isInitialized()&&l.isFinished()&&function(e,t,n){var r;return t.containsTime(n)&&e.isLastPeriodKnown&&t.id===(null===(r=e.periods[e.periods.length-1])||void 0===r?void 0:r.id)}(a,o,t)?u-1:t-.1;var d,c=i+n;d=!(!s.index.isInitialized()||!s.index.isFinished()||void 0===o.end)&&(void 0===u?c>=o.end:null===u||c>=u);return{start:Math.max(i,o.start),end:Math.min(c,null!==(r=o.end)&&void 0!==r?r:1/0),hasReachedPeriodEnd:d}}(e,u,i),d=s.index.shouldRefresh(l.start,l.end),f=o.getPendingOperations().filter((function(e){return e.type===Ve.f.EndOfSegment})).map((function(e){return e.value})),v=function(e,t){for(var n=c.Z.getCurrent().MINIMUM_SEGMENT_SIZE,r=Math.max(1/60,n),i=e.start+r,a=e.end-r,o=[],s=t.length-1;s>=0;s--){var u=t[s],l=u.infos.representation;if(!u.partiallyPushed&&!1!==l.decipherable&&l.isSupported){var d=u.infos.segment,f=d.time/d.timescale;((d.complete?f+d.duration/d.timescale:u.end)>i&&fi&&u.start0&&(b=Math.min.apply(Math,f.map((function(e){return e.segment.time})))),m.length>0&&(b=null!==b?Math.min(b,m[0].time):m[0].time),y.length>0&&(b=null!==b?Math.min(b,y[0].segment.time):y[0].segment.time),{imminentDiscontinuity:Je(e,l,b,_,v),hasFinishedLoading:_,neededSegments:y,isBufferFull:g,shouldRefreshManifest:d}}function at(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return ot(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ot(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ot(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);nu.end||e+ni.start&&o.push({start:i.start,end:e-n}),e+n0&&Z.every((function(e){return void 0!==e.keyIds}))&&(I=!0,t.encryptionDataEncountered(Z.map((function(e){return(0,T.Z)({content:r},e)}))),_.isUsed()))return}var R=new $e(r,E,s,A);return R.addEventListener("error",(function(e){b.signal.isCancelled()||(_.cancel(),t.error(e))})),R.addEventListener("parsedInitSegment",M),R.addEventListener("parsedMediaSegment",M),R.addEventListener("emptyQueue",x),R.addEventListener("requestRetry",(function(e){if(t.warning(e.error),!b.signal.isCancelled()){var n=e.segment,r=v.index;!1===r.isSegmentStillAvailable(n)?x():r.canBeOutOfSyncError(e.error,n)&&t.manifestMightBeOufOfSync()}})),R.addEventListener("fullyLoadedSegment",(function(e){o.endOfSegment((0,T.Z)({segment:e},r),_.signal).catch(C)})),R.start(),b.signal.register((function(){R.removeEventListener(),R.stop()})),a.listen(x,{includeLastObservation:!1,clearSignal:b.signal}),p.onUpdate(x,{emitCurrentValue:!1,clearSignal:b.signal}),h.onUpdate(x,{emitCurrentValue:!1,clearSignal:b.signal}),u.onUpdate(x,{emitCurrentValue:!1,clearSignal:b.signal}),void x();function x(){var e,n;if(!b.isUsed()){var i=a.getReference().getValue(),s=null!==(e=i.position.pending)&&void 0!==e?e:i.position.last,f=it(r,s,a,g.getValue(),p.getValue(),h.getValue(),o),m=f.neededSegments,T=null;if(v.index.isInitialized()){if(m.length>0&&!S.isLoaded&&null!==S.segment){var k=m[0].priority;T={segment:S.segment,priority:k}}}else if(null===S.segment)l.Z.warn("Stream: Uninitialized index without an initialization segment");else if(S.isLoaded)l.Z.warn("Stream: Uninitialized index with an already loaded initialization segment");else{var w=null!==(n=i.position.pending)&&void 0!==n?n:i.position.last;T={segment:S.segment,priority:rt(d.start,w)}}var A=u.getValue();if(null===A)E.setValue({initSegment:T,segmentQueue:m});else{if(A.urgent)return l.Z.debug("Stream: Urgent switch, terminate now.",y),E.setValue({initSegment:null,segmentQueue:[]}),E.finish(),b.cancel(),void t.terminating();var I=m[0],Z=R.getRequestedInitSegment(),x=R.getRequestedMediaSegment(),M=null===x||void 0===I||x.id!==I.segment.id?[]:[I],P=null===Z?null:T;if(E.setValue({initSegment:P,segmentQueue:M}),0===M.length&&null===P)return l.Z.debug("Stream: No request left, terminate",y),E.finish(),b.cancel(),void t.terminating()}if(t.streamStatusUpdate({period:d,position:i.position.last,bufferType:y,imminentDiscontinuity:f.imminentDiscontinuity,isEmptyStream:!1,hasFinishedLoading:f.hasFinishedLoading,neededSegments:f.neededSegments}),!b.signal.isCancelled()){var D=c.Z.getCurrent().UPTO_CURRENT_POSITION_CLEANUP;if(f.isBufferFull){var N=Math.max(0,s-D);N>0&&o.removeBuffer(0,N,_.signal).catch(C)}f.shouldRefreshManifest&&t.needsManifestRefresh()}}}function M(e){if(!_.isUsed())if("init"===e.segmentType){if(S.segmentData=e.initializationData,S.isLoaded=!0,!I){var n=v.getAllEncryptionData();n.length>0&&t.encryptionDataEncountered(n.map((function(e){return(0,T.Z)({content:r},e)})))}(function(e,t){return ft.apply(this,arguments)})({playbackObserver:a,content:r,segment:e.segment,segmentData:e.initializationData,segmentBuffer:o},_.signal).then((function(e){null!==e&&t.addedSegment(e)})).catch(C),x()}else{var i=e.inbandEvents,s=e.needsManifestRefresh,u=e.protectionDataUpdate;if(!I&&u){var l=v.getAllEncryptionData();if(l.length>0&&(t.encryptionDataEncountered(l.map((function(e){return(0,T.Z)({content:r},e)}))),_.isUsed()))return}if(!0===s&&(t.needsManifestRefresh(),_.isUsed()))return;if(void 0!==i&&i.length>0&&(t.inbandEvent(i),_.isUsed()))return;var d=S.segmentData;(function(e,t){return vt.apply(this,arguments)})({playbackObserver:a,content:r,initSegmentData:d,parsedSegment:e,segment:e.segment,segmentBuffer:o},_.signal).then((function(e){null!==e&&t.addedSegment(e)})).catch(C)}}function C(e){_.isUsed()&&e instanceof w.FU||(_.cancel(),t.error(e))}};var ht=function(e,t,n){var r=e.playbackObserver,i=e.content,a=e.options,o=e.representationEstimator,s=e.segmentBuffer,u=e.segmentFetcherCreator,d=e.wantedBufferAhead,p=e.maxVideoBufferSize,h="direct"===a.manualBitrateSwitchingMode,m=i.manifest,g=i.period,y=i.adaptation,_=new w.ZP;_.linkToSignal(n);var b,S=new Map,E=(0,k.$l)(null,_.signal),A=function(e,t,n,r,i,a){var o=e.manifest,s=e.adaptation,u=(0,k.ZP)([],a);f(),o.addEventListener("decipherabilityUpdate",f);var l=a.register(p),d=t(e,n,u,r,a),c=d.estimates;return{abrCallbacks:d.callbacks,estimateRef:c};function f(){var e=s.getPlayableRepresentations();if(0===e.length){var t=new v.Z("NO_PLAYABLE_REPRESENTATION","No Representation in the chosen "+s.type+" Adaptation can be played",{adaptation:s});return p(),void i(t)}var n=u.getValue();n.length===e.length&&n.every((function(t,n){return t.id===e[n].id}))||u.setValue(e)}function p(){o.removeEventListener("decipherabilityUpdate",f),void 0!==l&&l()}}(i,o,E,r,(function(e){_.cancel(),t.error(e)}),_.signal),I=A.estimateRef,Z=A.abrCallbacks,R=u.createSegmentFetcher(y.type,{onRequestBegin:Z.requestBegin,onRequestEnd:Z.requestEnd,onProgress:Z.requestProgress,onMetrics:Z.metrics});function x(e,t,n,i){var o=new w.ZP;o.linkToSignal(_.signal);var u=(0,k.lR)(d,(function(t){return t*function(e){var t=S.get(e.id),n=void 0!==t?t:1;void 0===t&&S.set(e.id,n);return n}(e)}),o.signal),c="video"===y.type?p:(0,k.$l)(1/0);l.Z.info("Stream: changing representation",y.type,e.id,e.bitrate);var v=(0,T.Z)({},i,{error:function(r){var a,o=(0,f.Z)(r,{defaultCode:"NONE",defaultReason:"Unknown `RepresentationStream` error"});if("BUFFER_FULL_ERROR"!==o.code)i.error(r);else{var s=d.getValue(),u=.7*(null!==(a=S.get(e.id))&&void 0!==a?a:1);if(u<=.05||s*u<=2)throw o;S.set(e.id,u),(0,he.Z)(4e3,_.signal).then((function(){return x(e,t,n,i)})).catch(L.Z)}},terminating:function(){o.cancel(),i.terminating()}});pt({playbackObserver:r,content:{representation:e,adaptation:y,period:g,manifest:m},segmentBuffer:s,segmentFetcher:R,terminate:t,options:{bufferGoal:u,maxBufferSize:c,drmSystemId:a.drmSystemId,fastSwitchThreshold:n}},v,_.signal)}I.onUpdate((function(e){var n=e.bitrate;void 0!==n&&n!==b&&(b=n,l.Z.debug("Stream: new "+y.type+" bitrate estimate",n),t.bitrateEstimationChange({type:y.type,bitrate:n}))}),{emitCurrentValue:!0,clearSignal:_.signal}),function e(n){var i=new w.ZP;i.linkToSignal(_.signal);var o=I.getValue(),s=o.representation,u=o.manual;if(null===s)return;if(h&&u&&!n){var d=c.Z.getCurrent().DELTA_POSITION_AFTER_RELOAD;return je()((function(){r.listen((function(e){var n,i;if(I.getValue().manual){var a=r.getCurrentTime()+d.bitrateSwitch,o=Math.min(Math.max(g.start,a),null!==(n=g.end)&&void 0!==n?n:1/0),s=!(null!==(i=e.paused.pending)&&void 0!==i?i:r.getIsPaused());return t.waitingMediaSourceReload({bufferType:y.type,period:g,position:o,autoPlay:s})}}),{includeLastObservation:!0,clearSignal:i.signal})}))}var f=(0,k.$l)(null,i.signal);I.onUpdate((function(e){if(null!==e.representation&&e.representation.id!==s.id)return e.urgent?(l.Z.info("Stream: urgent Representation switch",y.type),f.setValue({urgent:!0})):(l.Z.info("Stream: slow Representation switch",y.type),f.setValue({urgent:!1}))}),{clearSignal:i.signal,emitCurrentValue:!0});var v=(0,k.$l)(0);a.enableFastSwitching&&I.onUpdate((function(e){v.setValueIfChanged(null==e?void 0:e.knownStableBitrate)}),{clearSignal:i.signal,emitCurrentValue:!0});var p={type:y.type,period:g,representation:s};if(E.setValue(s),_.isUsed())return;if(t.representationChange(p),_.isUsed())return;var m={streamStatusUpdate:t.streamStatusUpdate,encryptionDataEncountered:t.encryptionDataEncountered,manifestMightBeOufOfSync:t.manifestMightBeOufOfSync,needsManifestRefresh:t.needsManifestRefresh,inbandEvent:t.inbandEvent,warning:t.warning,error:function(e){_.cancel(),t.error(e)},addedSegment:function(e){Z.addedSegment(e),_.isUsed()||t.addedSegment(e)},terminating:function(){if(!i.isUsed())return i.cancel(),e(!1)}};x(s,f,v,m)}(!0)},mt=n(9252);var gt=function(e,t){var n=e.split(";"),r=n[0],i=n.slice(1),a=t.split(";"),o=a[0],s=a.slice(1);if(r!==o)return!1;var u=(0,z.Z)(i,(function(e){return(0,mt.Z)(e,"codecs=")})),l=(0,z.Z)(s,(function(e){return(0,mt.Z)(e,"codecs=")}));if(void 0===u||void 0===l)return!1;var d=u.substring(7),c=l.substring(7);return d.split(".")[0]===c.split(".")[0]};function yt(e,t,n,r,i){if(void 0!==e.codec&&"reload"===i.onCodecSwitch&&!function(e,t){return e.getPlayableRepresentations().some((function(e){return gt(e.getMimeTypeString(),t)}))}(n,e.codec))return{type:"needs-reload",value:void 0};var a=e.getBufferedRanges();if(0===a.length)return{type:"continue",value:void 0};var o=(0,E.JN)(a),s=t.start,u=null==t.end?1/0:t.end,l=(0,E.tn)(o,[{start:s,end:u}]);if(0===l.length)return{type:"continue",value:void 0};e.synchronizeInventory();var d=e.getInventory();if(!d.some((function(e){return e.infos.period.id===t.id&&e.infos.adaptation.id!==n.id})))return{type:"continue",value:void 0};var f=function(e,t,n){return e.reduce((function(e,r){if(r.infos.period.id!==t.id||r.infos.adaptation.id!==n.id)return e;var i=r.bufferedStart,a=r.bufferedEnd;return void 0===i||void 0===a||e.push({start:i,end:a}),e}),[])}(d,t,n),v=(0,E.uH)(l,f);if(0===v.length)return{type:"continue",value:void 0};var p=r.currentTime,h=i.audioTrackSwitchingMode;if(("video"===n.type||"audio"===n.type&&"reload"===h)&&(0,E.Ti)({start:s,end:u},p)&&(r.readyState>1||!n.getPlayableRepresentations().some((function(t){var n;return gt(t.getMimeTypeString(),null!==(n=e.codec)&&void 0!==n?n:"")})))&&!(0,E.A1)(f,p))return{type:"needs-reload",value:void 0};var m="audio"===n.type&&"direct"===h,g=[],y=function(e,t){for(var n=0;n=t.start)return n>0?e[n-1]:null;return e.length>0?e[e.length-1]:null}(d,t);null!==y&&(void 0===y.bufferedEnd||t.start-y.bufferedEnd<1)&&g.push({start:0,end:t.start+1});var _=n.type,b=c.Z.getCurrent().ADAPTATION_SWITCH_BUFFER_PADDINGS,S=b[_].before;null==S&&(S=0);var T=b[_].after;if(null==T&&(T=0),m||g.push({start:p-S,end:p+T}),void 0!==t.end){var k=function(e,t){for(var n=0;nt.start)return e[n];return null}(d,t);null!==k&&(void 0===k.bufferedStart||k.bufferedStart-t.end<1)&&g.push({start:t.end-1,end:Number.MAX_VALUE})}var w=(0,E.uH)(v,g);return 0===w.length?{type:"continue",value:void 0}:m?{type:"flush-buffer",value:w}:{type:"clean-buffer",value:w}}function _t(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return bt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return bt(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function bt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=o.end&&(l.Z.debug('Stream: full "empty" AdaptationStream',n),s=!0),i.streamStatusUpdate({period:o,bufferType:n,position:u,imminentDiscontinuity:null,isEmptyStream:!0,hasFinishedLoading:s,neededSegments:[]})}t.onUpdate(u,{emitCurrentValue:!1,clearSignal:a}),e.listen(u,{includeLastObservation:!1,clearSignal:a}),u()}var Et=function(e,t,n){var r=e.bufferType,i=e.content,a=e.garbageCollectors,o=e.playbackObserver,s=e.representationEstimator,u=e.segmentFetcherCreator,d=e.segmentBuffersStore,v=e.options,p=e.wantedBufferAhead,h=e.maxVideoBufferSize,m=i.period,g=(0,k.ZP)(void 0,n);if(t.periodStreamReady({type:r,period:m,adaptationRef:g}),!n.isCancelled()){var y,_=!0;g.onUpdate((function(e){(0,I.Z)(R().mark((function i(){var s,u,f,h,g,T,E,k,A,I,Z,x,M,C,P,D;return R().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(void 0!==e){i.next=2;break}return i.abrupt("return");case 2:if((u=new w.ZP).linkToSignal(n),null==y||y.cancel(),y=u,null!==e){i.next=34;break}if(l.Z.info("Stream: Set no "+r+" Adaptation. P:",m.start),"initialized"!==(f=d.getStatus(r)).type){i.next=26;break}if(l.Z.info("Stream: Clearing previous "+r+" SegmentBuffer"),!We.isNative(r)){i.next=15;break}return i.abrupt("return",S(0,u.signal));case 15:if(h=null!==(s=m.end)&&void 0!==s?s:1/0,!(m.start>h)){i.next=20;break}l.Z.warn("Stream: Can't free buffer: period's start is after its end"),i.next=24;break;case 20:return i.next=22,f.value.removeBuffer(m.start,h,u.signal);case 22:if(!u.isUsed()){i.next=24;break}return i.abrupt("return");case 24:i.next=30;break;case 26:if("uninitialized"!==f.type){i.next=30;break}if(d.disableSegmentBuffer(r),!u.isUsed()){i.next=30;break}return i.abrupt("return");case 30:if(t.adaptationChange({type:r,adaptation:null,period:m}),!u.isUsed()){i.next=33;break}return i.abrupt("return");case 33:return i.abrupt("return",Tt(o,p,r,{period:m},t,u.signal));case 34:if(g=c.Z.getCurrent(),T=g.DELTA_POSITION_AFTER_RELOAD,E=_?0:"audio"===r?T.trackSwitch.audio:"video"===r?T.trackSwitch.video:T.trackSwitch.other,_=!1,!We.isNative(r)||"disabled"!==d.getStatus(r).type){i.next=39;break}return i.abrupt("return",S(E,u.signal));case 39:if(l.Z.info("Stream: Updating "+r+" adaptation","A: "+e.id,"P: "+m.start),t.adaptationChange({type:r,adaptation:e,period:m}),!u.isUsed()){i.next=43;break}return i.abrupt("return");case 43:if(k=o.getReadyState(),A=St(d,r,e,v),I={currentTime:o.getCurrentTime(),readyState:k},"needs-reload"!==(Z=yt(A,m,e,I,v)).type){i.next=49;break}return i.abrupt("return",S(E,u.signal));case 49:return i.next=51,d.waitForUsableBuffers(u.signal);case 51:if(!u.isUsed()){i.next=53;break}return i.abrupt("return");case 53:if("flush-buffer"!==Z.type&&"clean-buffer"!==Z.type){i.next=67;break}x=_t(Z.value);case 55:if((M=x()).done){i.next=63;break}return C=M.value,P=C.start,D=C.end,i.next=59,A.removeBuffer(P,D,u.signal);case 59:if(!u.isUsed()){i.next=61;break}return i.abrupt("return");case 61:i.next=55;break;case 63:if("flush-buffer"!==Z.type){i.next=67;break}if(t.needsBufferFlush(),!u.isUsed()){i.next=67;break}return i.abrupt("return");case 67:a.get(A)(u.signal),b(e,A,u.signal);case 69:case"end":return i.stop()}}),i)})))().catch((function(e){e instanceof w.FU||(null==y||y.cancel(),t.error(e))}))}),{clearSignal:n,emitCurrentValue:!0})}function b(e,n,a){var c=i.manifest,g=function(e,t){return e.deriveReadOnlyObserver((function(e,n){var r=(0,k.ZP)(i(),n);return e.onUpdate(a,{clearSignal:n,emitCurrentValue:!1}),r;function i(){var n=e.getValue(),r=t.getBufferedRanges(),i=(0,E.L7)(r,n.position.last);return(0,T.Z)({},n,{bufferGap:i})}function a(){r.setValue(i())}}))}(o,n);ht({content:{manifest:c,period:m,adaptation:e},options:v,playbackObserver:g,representationEstimator:s,segmentBuffer:n,segmentFetcherCreator:u,wantedBufferAhead:p,maxVideoBufferSize:h},Object.assign(Object.assign({},t),{error:function(e){if(!We.isNative(r)){l.Z.error("Stream: "+r+" Stream crashed. Aborting it.",e instanceof Error?e:""),d.disposeSegmentBuffer(r);var n=(0,f.Z)(e,{defaultCode:"NONE",defaultReason:"Unknown `AdaptationStream` error"});if(t.warning(n),a.isCancelled())return;return Tt(o,p,r,{period:m},t,a)}l.Z.error("Stream: "+r+" Stream crashed. Stopping playback.",e instanceof Error?e:""),t.error(e)}}),a)}function S(e,n){je()((function(){o.listen((function(n){var i,a,s=o.getCurrentTime()+e,u=Math.min(Math.max(m.start,s),null!==(i=m.end)&&void 0!==i?i:1/0),l=!(null!==(a=n.paused.pending)&&void 0!==a?a:o.getIsPaused());t.waitingMediaSourceReload({bufferType:r,period:m,position:u,autoPlay:l})}),{includeLastObservation:!0,clearSignal:n})}))}};function kt(e,t){if(0===t.length)return[];e.synchronizeInventory();for(var n,r=[],i=e.getInventory(),a=function(){var n=i[o];if(t.some((function(e){return n.infos.period.id===e.period.id&&n.infos.adaptation.id===e.adaptation.id&&n.infos.representation.id===e.representation.id}))){var a=n.bufferedStart,s=n.bufferedEnd;if(void 0===a||void 0===s){l.Z.warn("SO: No buffered start or end found from a segment.");var u=e.getBufferedRanges(),d=u.length;return 0===d?{v:[]}:{v:[{start:u.start(0),end:u.end(d-1)}]}}var c=r[r.length-1];void 0!==c&&c.end===a?c.end=s:r.push({start:a,end:s})}},o=0;o=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function At(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0?t[t.length-1].end>=n-5:t[0].start<=n+5}var Zt=function(e,t,n,r,i,a,o,s){for(var u,d=e.manifest,f=e.initialPeriod,p=a.maxBufferAhead,h=a.maxBufferBehind,m=a.wantedBufferAhead,g=a.maxVideoBufferSize,y=c.Z.getCurrent(),_=y.MAXIMUM_MAX_BUFFER_AHEAD,b=y.MAXIMUM_MAX_BUFFER_BEHIND,S=new Ye((function(e){var n=e.bufferType,r=null!=b[n]?b[n]:1/0,i=null!=_[n]?_[n]:1/0;return function(n){Xe({segmentBuffer:e,playbackObserver:t,maxBufferBehind:(0,k.lR)(h,(function(e){return Math.min(e,r)}),n),maxBufferAhead:(0,k.lR)(p,(function(e){return Math.min(e,i)}),n)},n)}})),T=wt(r.getBufferTypes());!(u=T()).done;){E(u.value,f)}function E(e,n){var i=new qe((function(e,t){return e.start-t.start})),a=!1,u=new w.ZP;return u.linkToSignal(s),t.listen((function(t){var n,r,f=t.position,v=null!==(n=f.pending)&&void 0!==n?n:f.last;if(a&&function(e){var t=i.head(),n=i.last();if(null==t||null==n)return!0;return t.start>e||(null==n.end?1/0:n.end)0;){var p=i.get(i.length()-1);i.removeElement(p),o.periodStreamCleared({type:e,period:p})}u.cancel(),(u=new w.ZP).linkToSignal(s);var h=null!==(r=d.getPeriodForTime(v))&&void 0!==r?r:d.getNextPeriod(v);void 0!==h?c(h):l.Z.warn("Stream: The wanted position is not found in the Manifest.")}}),{clearSignal:s,includeLastObservation:!0}),d.addEventListener("decipherabilityUpdate",(function(e){(function(e){return f.apply(this,arguments)})(e).catch((function(e){u.cancel(),o.error(e)}))}),s),c(n);function c(t){var n=Object.assign(Object.assign({},o),{waitingMediaSourceReload:function(e){var t=i.head();if(void 0===t||t.id!==e.period.id)o.lockedStream({bufferType:e.bufferType,period:e.period});else{var n=e.position,r=e.autoPlay;o.needsMediaSourceReload({position:n,autoPlay:r})}},periodStreamReady:function(e){a=!0,i.add(e.period),o.periodStreamReady(e)},periodStreamCleared:function(e){i.removeElement(e.period),o.periodStreamCleared(e)},error:function(e){u.cancel(),o.error(e)}});A(e,t,n,u.signal)}function f(){return f=(0,I.Z)(R().mark((function n(f){var p,h,m,g,y,_,b,S,T,E,k,A,I;return R().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(p=r.getStatus(e),0!==(h=f.filter((function(t){return t.adaptation.type===e}))).length&&"initialized"===p.type&&!h.every((function(e){return!0===e.representation.decipherable}))){n.next=4;break}return n.abrupt("return");case 4:for(m=p.value,g=h.filter((function(e){return void 0===e.representation.decipherable})),y=h.filter((function(e){return!1===e.representation.decipherable})),_=kt(m,y),b=kt(m,g),a=!1,l.Z.info("Stream: Destroying all PeriodStreams for decipherability matters",e);i.length()>0;)S=i.get(i.length()-1),i.removeElement(S),o.periodStreamCleared({type:e,period:S});u.cancel(),(u=new w.ZP).linkToSignal(s),T=0,E=[].concat(_,b);case 16:if(!(T=o.end&&(l.Z.info("Stream: Destroying PeriodStream as the current playhead moved above it",e,o.start,null!==(i=a.pending)&&void 0!==i?i:a.last,o.end),n(),s.periodStreamCleared({type:e,period:o}),f.cancel())}),{clearSignal:u,includeLastObservation:!0});var v={bufferType:e,content:{manifest:d,period:o},garbageCollectors:S,maxVideoBufferSize:g,segmentFetcherCreator:i,segmentBuffersStore:r,options:a,playbackObserver:t,representationEstimator:n,wantedBufferAhead:m},p=Object.assign(Object.assign({},s),{streamStatusUpdate:function(t){if(t.hasFinishedLoading){var n=d.getPeriodAfter(o);null!==n&&function(t){if(null!==c){if(c.period.id===t.id)return;l.Z.warn("Stream: Creating next `PeriodStream` while one was already created.",e,t.id,c.period.id),s.periodStreamCleared({type:e,period:c.period}),c.canceller.cancel()}var n=new w.ZP;n.linkToSignal(u),c={canceller:n,period:t},A(e,t,s,c.canceller.signal)}(n)}else null!==c&&(l.Z.info("Stream: Destroying next PeriodStream due to current one being active",e,c.period.start),s.periodStreamCleared({type:e,period:c.period}),c.canceller.cancel(),c=null);s.streamStatusUpdate(t)},error:function(e){null!==c&&(c.canceller.cancel(),c=null),f.cancel(),s.error(e)}});Et(v,p,f.signal)}},Rt=Zt,xt=n(9420);function Mt(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Ct(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ct(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Ct(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);na.getMaximumAvailablePosition()){var u=new v.Z("MEDIA_TIME_AFTER_MANIFEST","The current position is after the latest time announced in the Manifest.");i.trigger("warning",u)}}),{includeLastObservation:!0,clearSignal:o}),t.addEventListener("manifestUpdate",(function(){i.trigger("durationUpdate",i._getManifestDuration()),o.isCancelled()||i._checkEndOfStream()}),o),i}(0,t.Z)(n,e);var r=n.prototype;return r.getCurrentDuration=function(){return this._getManifestDuration()},r.onAdaptationChange=function(e,t,n){if(this._manifest.isLastPeriodKnown){var r=this._manifest.periods[this._manifest.periods.length-1];if(t.id===(null==r?void 0:r.id)&&("audio"===e||"video"===e)){"audio"===e?this._maximumPositionCalculator.updateLastAudioAdaptation(n):this._maximumPositionCalculator.updateLastVideoAdaptation(n);var i=this._maximumPositionCalculator.getEndingPosition(),a=void 0!==i?{isEnd:!0,duration:i}:{isEnd:!1,duration:this._maximumPositionCalculator.getMaximumAvailablePosition()};this.trigger("durationUpdate",a)}}this._canceller.isUsed()||null===n&&this._addActivelyLoadedPeriod(t,e)},r.onRepresentationChange=function(e,t){this._addActivelyLoadedPeriod(t,e)},r.onPeriodCleared=function(e,t){this._removeActivelyLoadedPeriod(t,e)},r.onLastSegmentFinishedLoading=function(e){var t=this._lazilyCreateActiveStreamInfo(e);t.hasFinishedLoadingLastPeriod||(t.hasFinishedLoadingLastPeriod=!0,this._checkEndOfStream())},r.onLastSegmentLoadingResume=function(e){var t=this._lazilyCreateActiveStreamInfo(e);t.hasFinishedLoadingLastPeriod&&(t.hasFinishedLoadingLastPeriod=!1,this._checkEndOfStream())},r.dispose=function(){this.removeEventListener(),this._canceller.cancel()},r._addActivelyLoadedPeriod=function(e,t){var n=this._lazilyCreateActiveStreamInfo(t);n.activePeriods.has(e)||(n.activePeriods.add(e),this._checkCurrentPeriod())},r._removeActivelyLoadedPeriod=function(e,t){var n=this._activeStreams.get(t);void 0!==n&&n.activePeriods.has(e)&&(n.activePeriods.removeElement(e),this._checkCurrentPeriod())},r._checkCurrentPeriod=function(){var e=this;if(0!==this._allBufferTypes.length){var t=this._activeStreams.get(this._allBufferTypes[0]);if(void 0!==t)for(var n,r,i=function(){for(var t=r.value,n=!0,i=1;i=0;a--){var o=i[a];try{"open"===r&&(l.Z.info("Init: Aborting SourceBuffer before removing"),o.abort()),l.Z.info("Init: Removing SourceBuffer from mediaSource"),t.removeSourceBuffer(o)}catch(e){l.Z.warn("Init: Error while disposing SourceBuffer",e instanceof Error?e:"")}}i.length>0&&l.Z.warn("Init: Not all SourceBuffers could have been removed.")}if(l.Z.info("Init: Clearing HTMLMediaElement's src"),(0,Lt.Z)(e),null!==n)try{l.Z.debug("Init: Revoking previous URL"),URL.revokeObjectURL(n)}catch(e){l.Z.warn("Init: Error while revoking the media source URL",e instanceof Error?e:"")}}function Vt(e,t){return(0,O.Z)(t,(function(n){var r=function(e,t){if(null==Ut.J)throw new v.Z("MEDIA_SOURCE_NOT_SUPPORTED","No MediaSource Object was found in the current browser.");var n=(0,Bt.Z)(e.src)?e.src:null;Ft(e,null,n),l.Z.info("Init: Creating MediaSource");var r=new Ut.J,i=URL.createObjectURL(r);return l.Z.info("Init: Attaching MediaSource URL to the media element",i),e.src=i,t.register((function(){Ft(e,r,i)})),r}(e,t);i.u_(r,(function(){l.Z.info("Init: MediaSource opened"),n(r)}),t)}))}function zt(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Kt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Kt(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Kt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0?r:Math.max(i,r+u)}if(!(0,S.Z)(n.percentage)){l.Z.debug("Init: using startAt.percentage");var d=n.percentage;return d>100?r:d<0?i:i+(r-i)*(+d/100)}}var f=e.getMinimumSafePosition();if(e.isLive){var v,p=e.suggestedPresentationDelay,h=e.clockOffset,m=e.getMaximumSafePosition(),g=c.Z.getCurrent().DEFAULT_LIVE_GAP;if(void 0===h)l.Z.info("Init: no clock offset found for a live content, starting close to maximum available position"),v=m;else{l.Z.info("Init: clock offset found for a live content, checking if we can start close to it");var y=void 0===e.availabilityStartTime?0:e.availabilityStartTime,_=(performance.now()+h)/1e3-y;v=Math.min(m,_)}var b=void 0!==p?p:t?g.LOW_LATENCY:g.DEFAULT;return l.Z.debug("Init: "+v+" defined as the live time, applying a live gap of "+b),Math.max(v-b,f)}return l.Z.info("Init: starting at the minimum available position:",f),f}var Yt=n(379),Xt=n(8833),Qt=n(7794);var $t=31536e3,Jt=function(){function e(e){this._mediaSource=e,this._currentMediaSourceDurationUpdateCanceller=null}var t=e.prototype;return t.updateDuration=function(e,t){null!==this._currentMediaSourceDurationUpdateCanceller&&this._currentMediaSourceDurationUpdateCanceller.cancel(),this._currentMediaSourceDurationUpdateCanceller=new w.ZP;var n=this._mediaSource,r=this._currentMediaSourceDurationUpdateCanceller.signal,a=function(e,t){var n=(0,k.ZP)("open"===e.readyState,t);return(0,i.u_)(e,(function(){l.Z.debug("Init: Reacting to MediaSource open in duration updater"),n.setValueIfChanged(!0)}),t),(0,i.N8)(e,(function(){l.Z.debug("Init: Reacting to MediaSource ended in duration updater"),n.setValueIfChanged(!1)}),t),(0,i.k6)(e,(function(){l.Z.debug("Init: Reacting to MediaSource close in duration updater"),n.setValueIfChanged(!1)}),t),n}(n,r),o=new w.ZP;o.linkToSignal(r),a.onUpdate((function(){if(o.cancel(),!a.getValue())return;(o=new w.ZP).linkToSignal(r);var i=function(e,t){if(0===e.length){var n=(0,k.ZP)(!1);return n.finish(),n}var r=(0,k.ZP)(!1,t);o();for(var i=function(){var n=e[a];n.addEventListener("updatestart",o),n.addEventListener("update",o),t.register((function(){n.removeEventListener("updatestart",o),n.removeEventListener("update",o)}))},a=0;a0&&(i=Math.max(o.buffered.end(s-1)))}if(r===e.duration)return"success";if(i>r){if(i=.1?f=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function un(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);nl||void 0!==h&&l>=h)&&(ln(v)&&c.push(v.publicEvent),o.delete(v)):p<=l&&void 0!==h&&l=(null!=h?h:p)&&(u?d.push({type:"stream-event-skip",value:v.publicEvent}):(d.push({type:"stream-event",value:v.publicEvent}),ln(v)&&c.push(v.publicEvent)))}if(d.length>0)for(var m,g=sn(d);!(m=g()).done;){var y=m.value;if("stream-event"===y.type?r(y.value):i(y.value),a.isCancelled())return}if(c.length>0)for(var _,b=sn(c);!(_=b()).done;){var S=_.value;if("function"==typeof S.onExit&&S.onExit(),a.isCancelled())return}}(s.getValue(),d,e,l.signal),d=e}function h(){var e=n.getReference().getValue().seeking;return{currentTime:t.currentTime,isSeeking:e}}}),{emitCurrentValue:!0,clearSignal:a})},cn=n(4576);function fn(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return vn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return vn(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function vn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);nd.end&&(n=d.end-1)}}else n=s;return{maximumPosition:e.getMaximumSafePosition(),position:{last:u.position,pending:n},duration:u.duration,paused:{last:u.paused,pending:i.getValue()||!r===u.paused?void 0:!r},readyState:u.readyState,speed:l}}function d(){u.setValue(l())}}))}(u,f,{autoPlay:a,initialPlayPerformed:E,initialSeekPerformed:w,speed:g,startTime:s}),I=this._createRebufferingController(f,u,g,n),Z=this._createContentTimeBoundariesObserver(u,d,A,b,n);T.then((function(){(0,Yt.Z)(f,l,!1,n).onUpdate((function(e,t){e&&(t(),i.trigger("loaded",{segmentBuffersStore:b}))}),{emitCurrentValue:!0,clearSignal:n})})).catch((function(e){n.isCancelled()||i._onFatalError(e)}));var R=this;Rt({manifest:u,initialPeriod:y},A,h,b,m,o,{needsBufferFlush:function(){var e=l.currentTime+.001;f.setCurrentTime(e),f.listen((function(t,n){(null!==t.currentRange||t.position>e+.1)&&(n(),f.setCurrentTime(t.position+.001))}),{includeLastObservation:!1,clearSignal:n})},streamStatusUpdate:function(e){var t=e.period,r=e.bufferType,i=e.imminentDiscontinuity,a=e.position;I.updateDiscontinuityInfo({period:t,bufferType:r,discontinuity:i,position:a}),n.isCancelled()||u.isLastPeriodKnown&&e.period.id===u.periods[u.periods.length-1].id&&(e.hasFinishedLoading||e.isEmptyStream?Z.onLastSegmentFinishedLoading(e.bufferType):Z.onLastSegmentLoadingResume(e.bufferType))},needsManifestRefresh:function(){return R._manifestFetcher.scheduleManualRefresh({enablePartialRefresh:!0,canUseUnsafeMode:!0})},manifestMightBeOufOfSync:function(){var e=c.Z.getCurrent().OUT_OF_SYNC_MANIFEST_REFRESH_DELAY;R._manifestFetcher.scheduleManualRefresh({enablePartialRefresh:!1,canUseUnsafeMode:!1,delay:e})},lockedStream:function(e){return I.onLockedStream(e.bufferType,e.period)},adaptationChange:function(e){R.trigger("adaptationChange",e),n.isCancelled()||Z.onAdaptationChange(e.type,e.period,e.adaptation)},representationChange:function(e){R.trigger("representationChange",e),n.isCancelled()||Z.onRepresentationChange(e.type,e.period)},inbandEvent:function(e){return R.trigger("inbandEvents",e)},warning:function(e){return R.trigger("warning",e)},periodStreamReady:function(e){return R.trigger("periodStreamReady",e)},periodStreamCleared:function(e){Z.onPeriodCleared(e.type,e.period),n.isCancelled()||R.trigger("periodStreamCleared",e)},bitrateEstimationChange:function(e){return R.trigger("bitrateEstimationChange",e)},addedSegment:function(e){return R.trigger("addedSegment",e)},needsMediaSourceReload:function(e){return t(e)},needsDecipherabilityFlush:function(e){var n,r=D(l);void 0===(n=null==r?void 0:r[0])||n.indexOf("widevine")<0?t(e):e.position+.001=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function gn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&(i="internal-seeking",r=t._internalSeeksIncoming.shift());var a=null!=e?e:t._generateInitialObservation(),o=Sn(t._mediaElement,i,t._withMediaSource),s=null;o.seeking&&("number"==typeof r?s=r:null!==a.pendingInternalSeek&&"seeking"!==n&&(s=a.pendingInternalSeek));var u=function(e,t,n){var r,i,a=n.withMediaSource,o=n.lowLatencyMode,s=c.Z.getCurrent().REBUFFERING_GAP,u=t.event,l=t.position,d=t.bufferGap,f=t.currentRange,v=t.duration,p=t.paused,h=t.readyState,m=t.ended,g=e.rebuffering,y=e.event,_=e.position,b=function(e,t,n,r,i){var a=c.Z.getCurrent().REBUFFERING_GAP,o=i?"LOW_LATENCY":"DEFAULT";if(void 0===t)return n&&Math.abs(r-e)<=a[o];return null!==t&&r-t.end<=a[o]}(l,f,m,v,o),S=h>=1&&"loadedmetadata"!==u&&null===g&&!(b||m),T=null,E=o?s.LOW_LATENCY:s.DEFAULT;if(a){if(S)d===1/0?(r=!0,T=l):void 0===d?h<3&&(r=!0,T=void 0):d<=E&&(r=!0,T=l+d);else if(null!==g){var k=bn(g,o);!0!==r&&null!==g&&h>1&&(b||m||void 0!==d&&isFinite(d)&&d>k)||void 0===d&&h>=3?i=!0:void 0===d?T=void 0:d===1/0?T=l:d<=k&&(T=l+d)}}else S&&(!p&&"timeupdate"===u&&"timeupdate"===y&&l===_||"seeking"===u&&(d===1/0||void 0===d&&h<3))?r=!0:null!==g&&("seeking"!==u&&l!==_||"canplay"===u||void 0===d&&h>=3||void 0!==d&&d<1/0&&(d>bn(g,o)||b||m))&&(i=!0);if(!0===i)return null;var w;if(!0===r||null!==g)return w="seeking"===u||null!==g&&"seeking"===g.reason||t.seeking?"seeking":1===h?"not-ready":"buffering",null!==g&&g.reason===w?{reason:g.reason,timestamp:g.timestamp,position:T}:{reason:w,timestamp:performance.now(),position:T};return null}(a,o,{lowLatencyMode:t._lowLatencyMode,withMediaSource:t._withMediaSource}),d=function(e,t){var n=c.Z.getCurrent().MINIMUM_BUFFER_AMOUNT_BEFORE_FREEZING;if(e.freezing)return t.ended||t.paused||0===t.readyState||0===t.playbackRate||e.position!==t.position?null:e.freezing;return"timeupdate"===t.event&&void 0!==t.bufferGap&&t.bufferGap>n&&!t.ended&&!t.paused&&t.readyState>=1&&0!==t.playbackRate&&t.position===e.position?{timestamp:performance.now()}:null}(a,o),f=(0,T.Z)({},{rebuffering:u,freezing:d,pendingInternalSeek:s},o);return l.Z.hasLevel("DEBUG")&&l.Z.debug("API: current media element state tick","event",f.event,"position",f.position,"seeking",f.seeking,"internalSeek",f.pendingInternalSeek,"rebuffering",null!==f.rebuffering,"freezing",null!==f.freezing,"ended",f.ended,"paused",f.paused,"playbackRate",f.playbackRate,"readyState",f.readyState),f},s=(0,k.ZP)(o("init"),this._canceller.signal),u=function(t){var n=o(t);l.Z.hasLevel("DEBUG")&&l.Z.debug("API: current playback timeline:\n"+function(e,t){for(var n="",r="",i=0;it){var d=n.length-Math.floor(l.length/2);r=" ".repeat(d)+"^"+t}if(i=3?(r=void 0,i=void 0):i=null!==(r=(0,E.rx)(a,o))?r.end-o:1/0,{bufferGap:i,buffered:a,currentRange:r,position:o,duration:s,ended:u,paused:l,playbackRate:d,readyState:c,seeking:f,event:t}}function Tn(e,t,n){var r=t(e.getReference(),n);return{getCurrentTime:function(){return e.getCurrentTime()},getReadyState:function(){return e.getReadyState()},getPlaybackRate:function(){return e.getPlaybackRate()},getIsPaused:function(){return e.getIsPaused()},getReference:function(){return r},listen:function(e,t){var i;n.isCancelled()||!0===(null===(i=null==t?void 0:t.clearSignal)||void 0===i?void 0:i.isCancelled())||r.onUpdate(e,{clearSignal:null==t?void 0:t.clearSignal,emitCurrentValue:null==t?void 0:t.includeLastObservation})},deriveReadOnlyObserver:function(e){return Tn(this,e,n)}}}var En=n(7829);function kn(e){return e.map((function(e){return null===e?e:{normalized:void 0===e.language?void 0:(0,En.ZP)(e.language),audioDescription:e.audioDescription,codec:e.codec}}))}function wn(e){return e.map((function(e){return null===e?e:{normalized:(0,En.ZP)(e.language),forced:e.forced,closedCaption:e.closedCaption}}))}var An=function(){function e(e){this._periods=new qe((function(e,t){return e.period.start-t.period.start})),this._audioChoiceMemory=new WeakMap,this._textChoiceMemory=new WeakMap,this._videoChoiceMemory=new WeakMap,this._preferredAudioTracks=[],this._preferredTextTracks=[],this._preferredVideoTracks=[],this.trickModeTrackEnabled=e.preferTrickModeTracks}var t=e.prototype;return t.setPreferredAudioTracks=function(e,t){this._preferredAudioTracks=e,t&&this._applyAudioPreferences()},t.setPreferredTextTracks=function(e,t){this._preferredTextTracks=e,t&&this._applyTextPreferences()},t.setPreferredVideoTracks=function(e,t){this._preferredVideoTracks=e,t&&this._applyVideoPreferences()},t.addPeriod=function(e,t,n){var r=Pn(this._periods,t),i=t.getSupportedAdaptations(e);if(void 0!==r){if(void 0!==r[e])return void l.Z.warn("TrackChoiceManager: "+e+" already added for period",t.start);r[e]={adaptations:i,adaptationRef:n}}else{var a;this._periods.add(((a={period:t})[e]={adaptations:i,adaptationRef:n},a))}},t.removePeriod=function(e,t){var n=function(e,t){for(var n=0;n0;)this._periods.pop()},t.update=function(){this._resetChosenAudioTracks(),this._resetChosenTextTracks(),this._resetChosenVideoTracks()},t.setInitialAudioTrack=function(e){var t=Pn(this._periods,e),n=void 0!==t?t.audio:null;if((0,S.Z)(n)||void 0===t)throw new Error("TrackChoiceManager: Given Period not found.");var r=e.getSupportedAdaptations("audio"),i=this._audioChoiceMemory.get(e);if(null===i)n.adaptationRef.setValue(null);else if(void 0!==i&&(0,g.Z)(r,i))n.adaptationRef.setValue(i);else{var a=Zn(r,kn(this._preferredAudioTracks));this._audioChoiceMemory.set(e,a),n.adaptationRef.setValue(a)}},t.setInitialTextTrack=function(e){var t=Pn(this._periods,e),n=void 0!==t?t.text:null;if((0,S.Z)(n)||void 0===t)throw new Error("TrackChoiceManager: Given Period not found.");var r=e.getSupportedAdaptations("text"),i=this._textChoiceMemory.get(e);if(null===i)n.adaptationRef.setValue(null);else if(void 0!==i&&(0,g.Z)(r,i))n.adaptationRef.setValue(i);else{var a=xn(r,wn(this._preferredTextTracks),this._audioChoiceMemory.get(e));this._textChoiceMemory.set(e,a),n.adaptationRef.setValue(a)}},t.setInitialVideoTrack=function(e){var t=Pn(this._periods,e),n=void 0!==t?t.video:null;if((0,S.Z)(n)||void 0===t)throw new Error("TrackChoiceManager: Given Period not found.");var r,i=e.getSupportedAdaptations("video"),a=this._videoChoiceMemory.get(e);if(null===a)r=null;else if(void 0!==a&&(0,g.Z)(i,a.baseAdaptation))r=a.baseAdaptation;else{r=Cn(i,this._preferredVideoTracks)}if(null===r)return this._videoChoiceMemory.set(e,null),void n.adaptationRef.setValue(null);var o=Dn(r,this.trickModeTrackEnabled);this._videoChoiceMemory.set(e,{baseAdaptation:r,adaptation:o}),n.adaptationRef.setValue(o)},t.setAudioTrackByID=function(e,t){var n=Pn(this._periods,e),r=void 0!==n?n.audio:null;if((0,S.Z)(r))throw new Error("TrackChoiceManager: Given Period not found.");var i=(0,z.Z)(r.adaptations,(function(e){return e.id===t}));if(void 0===i)throw new Error("Audio Track not found.");this._audioChoiceMemory.get(e)!==i&&(this._audioChoiceMemory.set(e,i),r.adaptationRef.setValue(i))},t.setTextTrackByID=function(e,t){var n=Pn(this._periods,e),r=void 0!==n?n.text:null;if((0,S.Z)(r))throw new Error("TrackChoiceManager: Given Period not found.");var i=(0,z.Z)(r.adaptations,(function(e){return e.id===t}));if(void 0===i)throw new Error("Text Track not found.");this._textChoiceMemory.get(e)!==i&&(this._textChoiceMemory.set(e,i),r.adaptationRef.setValue(i))},t.setVideoTrackByID=function(e,t){var n=Pn(this._periods,e),r=void 0!==n?n.video:null;if((0,S.Z)(r))throw new Error("LanguageManager: Given Period not found.");var i=(0,z.Z)(r.adaptations,(function(e){return e.id===t}));if(void 0===i)throw new Error("Video Track not found.");var a=Dn(i,this.trickModeTrackEnabled);this._videoChoiceMemory.set(e,{baseAdaptation:i,adaptation:a}),r.adaptationRef.setValue(a)},t.disableTextTrack=function(e){var t=Pn(this._periods,e),n=void 0!==t?t.text:null;if((0,S.Z)(n))throw new Error("TrackChoiceManager: Given Period not found.");null!==this._textChoiceMemory.get(e)&&(this._textChoiceMemory.set(e,null),n.adaptationRef.setValue(null))},t.disableVideoTrack=function(e){var t=Pn(this._periods,e),n=null==t?void 0:t.video;if(void 0===n)throw new Error("TrackManager: Given Period not found.");null!==this._videoChoiceMemory.get(e)&&(this._videoChoiceMemory.set(e,null),n.adaptationRef.setValue(null))},t.disableVideoTrickModeTracks=function(){this.trickModeTrackEnabled=!1,this._resetChosenVideoTracks()},t.enableVideoTrickModeTracks=function(){this.trickModeTrackEnabled=!0,this._resetChosenVideoTracks()},t.isTrickModeEnabled=function(){return this.trickModeTrackEnabled},t.getChosenAudioTrack=function(e){var t=Pn(this._periods,e),n=void 0!==t?t.audio:null;if((0,S.Z)(n))return null;var r=this._audioChoiceMemory.get(e);return(0,S.Z)(r)?null:r.toAudioTrack()},t.getChosenTextTrack=function(e){var t=Pn(this._periods,e),n=void 0!==t?t.text:null;if((0,S.Z)(n))return null;var r=this._textChoiceMemory.get(e);return(0,S.Z)(r)?null:r.toTextTrack()},t.getChosenVideoTrack=function(e){var t=Pn(this._periods,e),n=void 0!==t?t.video:null;if((0,S.Z)(n))return null;var r=this._videoChoiceMemory.get(e);return(0,S.Z)(r)?null:r.adaptation.toVideoTrack()},t.getAvailableAudioTracks=function(e){var t=Pn(this._periods,e),n=void 0!==t?t.audio:null;if((0,S.Z)(n))return[];var r=this._audioChoiceMemory.get(e),i=(0,S.Z)(r)?null:r.id;return n.adaptations.map((function(e){var t=null!==i&&i===e.id;return(0,T.Z)(e.toAudioTrack(),{active:t})}))},t.getAvailableTextTracks=function(e){var t=Pn(this._periods,e),n=void 0!==t?t.text:null;if((0,S.Z)(n))return[];var r=this._textChoiceMemory.get(e),i=(0,S.Z)(r)?null:r.id;return n.adaptations.map((function(e){var t=null!==i&&i===e.id;return(0,T.Z)(e.toTextTrack(),{active:t})}))},t.getAvailableVideoTracks=function(e){var t,n=Pn(this._periods,e),r=void 0!==n?n.video:null;if((0,S.Z)(r))return[];var i=this._videoChoiceMemory.get(e),a=void 0===i?void 0:null!==(t=null==i?void 0:i.adaptation.id)&&void 0!==t?t:void 0;return r.adaptations.map((function(e){var t=null!==a&&a===e.id,n=e.toVideoTrack(),r=void 0!==n.trickModeTracks?n.trickModeTracks.map((function(e){var t=null!==a&&a===e.id;return(0,T.Z)(e,{active:t})})):[],i=(0,T.Z)(n,{active:t});return void 0!==r&&(i.trickModeTracks=r),i}))},t._applyAudioPreferences=function(){this._audioChoiceMemory=new WeakMap,this._resetChosenAudioTracks()},t._applyTextPreferences=function(){this._textChoiceMemory=new WeakMap,this._resetChosenTextTracks()},t._applyVideoPreferences=function(){this._videoChoiceMemory=new WeakMap,this._resetChosenVideoTracks()},t._resetChosenAudioTracks=function(){var e=this,t=kn(this._preferredAudioTracks);!function n(r){if(!(r>=e._periods.length())){var i=e._periods.get(r);if((0,S.Z)(i.audio))n(r+1);else{var a=i.period,o=i.audio,s=a.getSupportedAdaptations("audio"),u=e._audioChoiceMemory.get(a);if(null===u||void 0!==u&&(0,g.Z)(s,u))n(r+1);else{var l=Zn(s,t);e._audioChoiceMemory.set(a,l),o.adaptationRef.setValue(l),n(0)}}}}(0)},t._resetChosenTextTracks=function(){var e=this,t=wn(this._preferredTextTracks);!function n(r){if(!(r>=e._periods.length())){var i=e._periods.get(r);if((0,S.Z)(i.text))n(r+1);else{var a=i.period,o=i.text,s=a.getSupportedAdaptations("text"),u=e._textChoiceMemory.get(a);if(null===u||void 0!==u&&(0,g.Z)(s,u))n(r+1);else{var l=xn(s,t,e._audioChoiceMemory.get(a));e._textChoiceMemory.set(a,l),o.adaptationRef.setValue(l),n(0)}}}}(0)},t._resetChosenVideoTracks=function(){var e=this,t=this._preferredVideoTracks;!function n(r){if(!(r>=e._periods.length())){var i=e._periods.get(r);if((0,S.Z)(i.video))n(r+1);else{var a=i.period,o=i.video,s=a.getSupportedAdaptations("video"),u=e._videoChoiceMemory.get(a);if(null!==u){if(void 0!==u&&(0,g.Z)(s,u.baseAdaptation)){var l=Dn(u.baseAdaptation,e.trickModeTrackEnabled);return l.id===u.adaptation.id?void n(r+1):(e._videoChoiceMemory.set(a,{baseAdaptation:u.baseAdaptation,adaptation:l}),o.adaptationRef.setValue(l),n(0))}var d=Cn(s,t);if(null===d)return e._videoChoiceMemory.set(a,null),o.adaptationRef.setValue(null),n(0);var c=Dn(d,e.trickModeTrackEnabled);return e._videoChoiceMemory.set(a,{baseAdaptation:d,adaptation:c}),o.adaptationRef.setValue(c),n(0)}n(r+1)}}}(0)},e}();function In(e){return function(t){var n;if(void 0!==e.normalized&&(null!==(n=t.normalizedLanguage)&&void 0!==n?n:"")!==e.normalized)return!1;if(void 0!==e.audioDescription)if(e.audioDescription){if(!0!==t.isAudioDescription)return!1}else if(!0===t.isAudioDescription)return!1;if(void 0===e.codec)return!0;var r=e.codec.test,i=function(e){return void 0!==e.codec&&r.test(e.codec)};return e.codec.all?t.representations.every(i):t.representations.some(i)}}function Zn(e,t){if(0===e.length)return null;for(var n=0;n0){if(null!=n){var l=(0,z.Z)(u,(function(e){return e.normalizedLanguage===n.normalizedLanguage}));if(void 0!==l)return l}return null!==(r=(0,z.Z)(u,(function(e){return void 0===e.normalizedLanguage})))&&void 0!==r?r:null}return null}function Mn(e){return function(t){if(void 0!==e.signInterpreted&&e.signInterpreted!==t.isSignInterpreted)return!1;if(void 0===e.codec)return!0;var n=e.codec.test,r=function(e){return void 0!==e.codec&&n.test(e.codec)};return e.codec.all?t.representations.every(r):t.representations.some(r)}}function Cn(e,t){if(0===e.length)return null;for(var n=0;n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Un(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);ng)throw new Error('Invalid maxVideoBitrate parameter. Its value, "'+g+'", is inferior to the set minVideoBitrate, "'+h+'"')}if((0,S.Z)(e.maxAudioBitrate))m=E.audio;else{if(m=Number(e.maxAudioBitrate),isNaN(m))throw new Error("Invalid maxAudioBitrate parameter. Should be a number.");if(p>m)throw new Error('Invalid maxAudioBitrate parameter. Its value, "'+m+'", is inferior to the set minAudioBitrate, "'+p+'"')}return{maxBufferAhead:t,maxBufferBehind:n,limitVideoWidth:C,videoElement:d,wantedBufferAhead:r,maxVideoBufferSize:i,throttleWhenHidden:a,throttleVideoBitrateWhenHidden:o,preferredAudioTracks:s,preferredTextTracks:u,preferredVideoTracks:l,initialAudioBitrate:v,initialVideoBitrate:f,minAudioBitrate:p,minVideoBitrate:h,maxAudioBitrate:m,maxVideoBitrate:g,stopAtEnd:(0,S.Z)(e.stopAtEnd)?Z:!!e.stopAtEnd}}(e),o=a.initialAudioBitrate,s=a.initialVideoBitrate,u=a.limitVideoWidth,d=a.minAudioBitrate,f=a.minVideoBitrate,v=a.maxAudioBitrate,p=a.maxBufferAhead,h=a.maxBufferBehind,m=a.maxVideoBitrate,g=a.preferredAudioTracks,y=a.preferredTextTracks,_=a.preferredVideoTracks,b=a.throttleWhenHidden,T=a.throttleVideoBitrateWhenHidden,E=a.videoElement,I=a.wantedBufferAhead,Z=a.maxVideoBufferSize,R=a.stopAtEnd,x=c.Z.getCurrent().DEFAULT_UNMUTED_VOLUME;E.preload="auto",t.version="3.31.0",t.log=l.Z,t.state="STOPPED",t.videoElement=E;var M=new w.ZP;t._destroyCanceller=M,t._priv_pictureInPictureRef=Vn(E,M.signal),Gn(E,(function(){t.trigger("fullscreenChange",t.isFullscreen())}),M.signal);for(var C=[],P=0;P<(null===(r=E.textTracks)||void 0===r?void 0:r.length);P++){var D=null===(i=E.textTracks)||void 0===i?void 0:i[P];(0,S.Z)(D)||C.push(D)}var N=function(e){for(var n=e.target,r=[],i=0;i0?e.textTracks[0]:null},i.getPlayerState=function(){return this.state},i.isContentLoaded=function(){return!(0,g.Z)(["LOADING","RELOADING","STOPPED"],this.state)},i.isBuffering=function(){return(0,g.Z)(["BUFFERING","SEEKING","LOADING","RELOADING"],this.state)},i.isPaused=function(){return!this.videoElement||((0,g.Z)(["LOADING","RELOADING"],this.state)?!this._priv_lastAutoPlay:this.videoElement.paused)},i.isLive=function(){if(null===this._priv_contentInfos)return!1;var e=this._priv_contentInfos,t=e.isDirectFile,n=e.manifest;return!t&&null!==n&&n.isLive},i.areTrickModeTracksEnabled=function(){return this._priv_preferTrickModeTracks},i.getUrl=function(){if(null!==this._priv_contentInfos){var e=this._priv_contentInfos,t=e.isDirectFile,n=e.manifest,r=e.originalUrl;return t?r:null!==n?n.getUrl():void 0}},i.updateContentUrls=function(e,t){if(null===this._priv_contentInfos)throw new Error("No content loaded");var n=!0===(null==t?void 0:t.refresh);this._priv_contentInfos.initializer.updateContentUrls(e,n)},i.getVideoDuration=function(){if(null===this.videoElement)throw new Error("Disposed player");return this.videoElement.duration},i.getVideoBufferGap=function(){if(null===this.videoElement)throw new Error("Disposed player");var e=this.videoElement;return(0,E.L7)(e.buffered,e.currentTime)},i.getVideoLoadedTime=function(){if((0,A.Z)("`getVideoLoadedTime` is deprecated and won't be present in the next major version"),null===this.videoElement)throw new Error("Disposed player");var e=this.videoElement;return(0,E.at)(e.buffered,e.currentTime)},i.getVideoPlayedTime=function(){if((0,A.Z)("`getVideoPlayedTime` is deprecated and won't be present in the next major version"),null===this.videoElement)throw new Error("Disposed player");var e=this.videoElement;return(0,E.DD)(e.buffered,e.currentTime)},i.getWallClockTime=function(){if(null===this.videoElement)throw new Error("Disposed player");if(null===this._priv_contentInfos)return this.videoElement.currentTime;var e=this._priv_contentInfos,t=e.isDirectFile,n=e.manifest;if(t){var r=a(this.videoElement);return(null!=r?r:0)+this.videoElement.currentTime}return null!==n?this.videoElement.currentTime+(void 0!==n.availabilityStartTime?n.availabilityStartTime:0):0},i.getPosition=function(){if(null===this.videoElement)throw new Error("Disposed player");return this.videoElement.currentTime},i.getLastStoredContentPosition=function(){return this._priv_reloadingMetadata.reloadPosition},i.getPlaybackRate=function(){return this._priv_speed.getValue()},i.setPlaybackRate=function(e,t){var n;e!==this._priv_speed.getValue()&&this._priv_speed.setValue(e);var r=null==t?void 0:t.preferTrickModeTracks;if("boolean"==typeof r){this._priv_preferTrickModeTracks=r;var i=null===(n=this._priv_contentInfos)||void 0===n?void 0:n.trackChoiceManager;(0,S.Z)(i)||(r&&!i.isTrickModeEnabled()?i.enableVideoTrickModeTracks():!r&&i.isTrickModeEnabled()&&i.disableVideoTrickModeTracks())}},i.getAvailableVideoBitrates=function(){if(null===this._priv_contentInfos)return[];var e=this._priv_contentInfos,t=e.currentPeriod,n=e.activeAdaptations;if(null===t||null===n)return[];var r=n[t.id];return void 0===r||(0,S.Z)(r.video)?[]:r.video.getAvailableBitrates()},i.getAvailableAudioBitrates=function(){if(null===this._priv_contentInfos)return[];var e=this._priv_contentInfos,t=e.currentPeriod,n=e.activeAdaptations;if(null===t||null===n)return[];var r=n[t.id];return void 0===r||(0,S.Z)(r.audio)?[]:r.audio.getAvailableBitrates()},i.getManualAudioBitrate=function(){return this._priv_bitrateInfos.manualBitrates.audio.getValue()},i.getManualVideoBitrate=function(){return this._priv_bitrateInfos.manualBitrates.video.getValue()},i.getVideoBitrate=function(){var e=this._priv_getCurrentRepresentations();if(null!==e&&!(0,S.Z)(e.video))return e.video.bitrate},i.getAudioBitrate=function(){var e=this._priv_getCurrentRepresentations();if(null!==e&&!(0,S.Z)(e.audio))return e.audio.bitrate},i.getMinVideoBitrate=function(){return this._priv_bitrateInfos.minAutoBitrates.video.getValue()},i.getMinAudioBitrate=function(){return this._priv_bitrateInfos.minAutoBitrates.audio.getValue()},i.getMaxVideoBitrate=function(){return this._priv_bitrateInfos.maxAutoBitrates.video.getValue()},i.getMaxAudioBitrate=function(){return this._priv_bitrateInfos.maxAutoBitrates.audio.getValue()},i.play=function(){var e=this;if(null===this.videoElement)throw new Error("Disposed player");var t=this.videoElement.play();return(0,S.Z)(t)||"function"!=typeof t.catch?Promise.resolve():t.catch((function(t){if("NotAllowedError"===t.name){var n=new v.Z("MEDIA_ERR_PLAY_NOT_ALLOWED",t.toString());e.trigger("warning",n)}throw t}))},i.pause=function(){if(null===this.videoElement)throw new Error("Disposed player");this.videoElement.pause()},i.seekTo=function(e){var t;if(null===this.videoElement)throw new Error("Disposed player");if(null===this._priv_contentInfos)throw new Error("player: no content loaded");var n,r=this._priv_contentInfos,i=r.isDirectFile,o=r.manifest;if(!i&&null===o)throw new Error("player: the content did not load yet");if("number"==typeof e)n=e;else if("object"==typeof e){var s=e,u=this.videoElement.currentTime;if((0,S.Z)(s.relative))if((0,S.Z)(s.position)){if((0,S.Z)(s.wallClockTime))throw new Error('invalid time object. You must set one of the following properties: "relative", "position" or "wallClockTime"');if(null!==o)n=s.wallClockTime-(null!==(t=o.availabilityStartTime)&&void 0!==t?t:0);else if(i&&null!==this.videoElement){var d=a(this.videoElement);void 0!==d&&(n=s.wallClockTime-d)}void 0===n&&(n=s.wallClockTime)}else n=s.position;else n=u+s.relative}if(void 0===n)throw new Error("invalid time given");return l.Z.info("API: API Seek to",n),this.videoElement.currentTime=n,n},i.isFullscreen=function(){return(0,A.Z)("isFullscreen is deprecated. Fullscreen management should now be managed by the application"),s()},i.setFullscreen=function(e){if(void 0===e&&(e=!0),(0,A.Z)("setFullscreen is deprecated. Fullscreen management should now be managed by the application"),null===this.videoElement)throw new Error("Disposed player");e?function(e){if(!s()){var t=e;"function"==typeof t.requestFullscreen?t.requestFullscreen():"function"==typeof t.msRequestFullscreen?t.msRequestFullscreen():"function"==typeof t.mozRequestFullScreen?t.mozRequestFullScreen():"function"==typeof t.webkitRequestFullscreen&&t.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT)}}(this.videoElement):o()},i.exitFullscreen=function(){(0,A.Z)("exitFullscreen is deprecated. Fullscreen management should now be managed by the application"),o()},i.getVolume=function(){if(null===this.videoElement)throw new Error("Disposed player");return this.videoElement.volume},i.setVolume=function(e){if(null===this.videoElement)throw new Error("Disposed player");var t=this.videoElement;e!==t.volume&&(t.volume=e,this.trigger("volumeChange",e))},i.isMute=function(){return 0===this.getVolume()},i.mute=function(){this._priv_mutedMemory=this.getVolume(),this.setVolume(0)},i.unMute=function(){var e=c.Z.getCurrent().DEFAULT_UNMUTED_VOLUME;0===this.getVolume()&&this.setVolume(0===this._priv_mutedMemory?e:this._priv_mutedMemory)},i.setVideoBitrate=function(e){this._priv_bitrateInfos.manualBitrates.video.setValue(e)},i.setAudioBitrate=function(e){this._priv_bitrateInfos.manualBitrates.audio.setValue(e)},i.setMinVideoBitrate=function(e){var t=this._priv_bitrateInfos.maxAutoBitrates.video.getValue();if(e>t)throw new Error('Invalid minimum video bitrate given. Its value, "'+e+'" is superior the current maximum video birate, "'+t+'".');this._priv_bitrateInfos.minAutoBitrates.video.setValue(e)},i.setMinAudioBitrate=function(e){var t=this._priv_bitrateInfos.maxAutoBitrates.audio.getValue();if(e>t)throw new Error('Invalid minimum audio bitrate given. Its value, "'+e+'" is superior the current maximum audio birate, "'+t+'".');this._priv_bitrateInfos.minAutoBitrates.audio.setValue(e)},i.setMaxVideoBitrate=function(e){var t=this._priv_bitrateInfos.minAutoBitrates.video.getValue();if(e0||c.result.removedAdaptations.length>0)){var f=u.getAvailableAudioTracks(s);r._priv_triggerEventIfNotStopped("availableAudioTracksChange",null!=f?f:[],i);var v=u.getAvailableTextTracks(s);r._priv_triggerEventIfNotStopped("availableTextTracksChange",null!=v?v:[],i);var p=u.getAvailableVideoTracks(s);r._priv_triggerEventIfNotStopped("availableVideoTracksChange",null!=p?p:[],i)}return}}),e.currentContentCanceller.signal)}},i._priv_onActivePeriodChanged=function(e,t){var n,r,i,a,o,s,u,l,d=t.period;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){e.currentPeriod=d;var c=e.currentContentCanceller.signal;this._priv_contentEventsMemory.periodChange!==d&&(this._priv_contentEventsMemory.periodChange=d,this._priv_triggerEventIfNotStopped("periodChange",d,c)),this._priv_triggerEventIfNotStopped("availableAudioTracksChange",this.getAvailableAudioTracks(),c),this._priv_triggerEventIfNotStopped("availableTextTracksChange",this.getAvailableTextTracks(),c),this._priv_triggerEventIfNotStopped("availableVideoTracksChange",this.getAvailableVideoTracks(),c);var f=null===(r=this._priv_contentInfos)||void 0===r?void 0:r.trackChoiceManager;if((0,S.Z)(f))this._priv_triggerEventIfNotStopped("audioTrackChange",null,c),this._priv_triggerEventIfNotStopped("textTrackChange",null,c),this._priv_triggerEventIfNotStopped("videoTrackChange",null,c);else{var v=f.getChosenAudioTrack(d);this._priv_triggerEventIfNotStopped("audioTrackChange",v,c);var p=f.getChosenTextTrack(d);this._priv_triggerEventIfNotStopped("textTrackChange",p,c);var h=f.getChosenVideoTrack(d);this._priv_triggerEventIfNotStopped("videoTrackChange",h,c)}if(this._priv_triggerAvailableBitratesChangeEvent("availableAudioBitratesChange",this.getAvailableAudioBitrates(),c),!e.currentContentCanceller.isUsed()&&(this._priv_triggerAvailableBitratesChangeEvent("availableVideoBitratesChange",this.getAvailableVideoBitrates(),c),!e.currentContentCanceller.isUsed())){var m=null!==(o=null===(a=null===(i=this._priv_getCurrentRepresentations())||void 0===i?void 0:i.audio)||void 0===a?void 0:a.bitrate)&&void 0!==o?o:-1;if(this._priv_triggerCurrentBitrateChangeEvent("audioBitrateChange",m,c),!e.currentContentCanceller.isUsed()){var g=null!==(l=null===(u=null===(s=this._priv_getCurrentRepresentations())||void 0===s?void 0:s.video)||void 0===u?void 0:u.bitrate)&&void 0!==l?l:-1;this._priv_triggerCurrentBitrateChangeEvent("videoBitrateChange",g,c)}}}},i._priv_onPeriodStreamReady=function(e,t){var n;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){var r=t.type,i=t.period,a=t.adaptationRef,o=e.trackChoiceManager;switch(r){case"video":(0,S.Z)(o)?(l.Z.error("API: TrackChoiceManager not instanciated for a new video period"),a.setValue(null)):(o.addPeriod(r,i,a),o.setInitialVideoTrack(i));break;case"audio":(0,S.Z)(o)?(l.Z.error("API: TrackChoiceManager not instanciated for a new "+r+" period"),a.setValue(null)):(o.addPeriod(r,i,a),o.setInitialAudioTrack(i));break;case"text":(0,S.Z)(o)?(l.Z.error("API: TrackChoiceManager not instanciated for a new "+r+" period"),a.setValue(null)):(o.addPeriod(r,i,a),o.setInitialTextTrack(i));break;default:var s=i.adaptations[r];!(0,S.Z)(s)&&s.length>0?a.setValue(s[0]):a.setValue(null)}}},i._priv_onPeriodStreamCleared=function(e,t){var n;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){var r=t.type,i=t.period,a=e.trackChoiceManager;switch(r){case"audio":case"text":case"video":(0,S.Z)(a)||a.removePeriod(r,i)}var o=e.activeAdaptations,s=e.activeRepresentations;if(!(0,S.Z)(o)&&!(0,S.Z)(o[i.id])){var u=o[i.id];delete u[r],0===Object.keys(u).length&&delete o[i.id]}if(!(0,S.Z)(s)&&!(0,S.Z)(s[i.id])){var l=s[i.id];delete l[r],0===Object.keys(l).length&&delete s[i.id]}}},i._priv_onAdaptationChange=function(e,t){var n,r=t.type,i=t.adaptation,a=t.period;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){null===e.activeAdaptations&&(e.activeAdaptations={});var o,s=e.activeAdaptations,u=e.currentPeriod,l=s[a.id];if((0,S.Z)(l))s[a.id]=((o={})[r]=i,o);else l[r]=i;var d=e.trackChoiceManager,c=e.currentContentCanceller.signal;if(null!==d&&null!==u&&!(0,S.Z)(a)&&a.id===u.id)switch(r){case"audio":var f=d.getChosenAudioTrack(u);this._priv_triggerEventIfNotStopped("audioTrackChange",f,c);var v=this.getAvailableAudioBitrates();this._priv_triggerAvailableBitratesChangeEvent("availableAudioBitratesChange",v,c);break;case"text":var p=d.getChosenTextTrack(u);this._priv_triggerEventIfNotStopped("textTrackChange",p,c);break;case"video":var h=d.getChosenVideoTrack(u);this._priv_triggerEventIfNotStopped("videoTrackChange",h,c);var m=this.getAvailableVideoBitrates();this._priv_triggerAvailableBitratesChangeEvent("availableVideoBitratesChange",m,c)}}},i._priv_onRepresentationChange=function(e,t){var n,r,i=t.type,a=t.period,o=t.representation;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){null===e.activeRepresentations&&(e.activeRepresentations={});var s,u=e.activeRepresentations,l=e.currentPeriod,d=u[a.id];if((0,S.Z)(d))u[a.id]=((s={})[i]=o,s);else d[i]=o;var c=null!==(r=null==o?void 0:o.bitrate)&&void 0!==r?r:-1;if(!(0,S.Z)(a)&&null!==l&&l.id===a.id){var f=this._priv_contentInfos.currentContentCanceller.signal;"video"===i?this._priv_triggerCurrentBitrateChangeEvent("videoBitrateChange",c,f):"audio"===i&&this._priv_triggerCurrentBitrateChangeEvent("audioBitrateChange",c,f)}}},i._priv_onBitrateEstimationChange=function(e){var t=e.type,n=e.bitrate;void 0!==n&&(this._priv_bitrateInfos.lastBitrates[t]=n),this.trigger("bitrateEstimationChange",{type:t,bitrate:n})},i._priv_onNativeTextTracksNext=function(e){this.trigger("nativeTextTracksChange",e)},i._priv_setPlayerState=function(e){this.state!==e&&(this.state=e,l.Z.info("API: playerStateChange event",e),this.trigger("playerStateChange",e))},i._priv_triggerPositionUpdate=function(e,t){var n,r;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){var i=e.isDirectFile,o=e.manifest;if((i||null!==o)&&!(0,S.Z)(t)){var s=null!==o?o.getMaximumSafePosition():void 0,u={position:t.position,duration:t.duration,playbackRate:t.playbackRate,maximumBufferTime:s,bufferGap:void 0!==t.bufferGap&&isFinite(t.bufferGap)?t.bufferGap:0};if(null!==o&&o.isLive&&t.position>0){var l=null!==(r=o.availabilityStartTime)&&void 0!==r?r:0;u.wallClockTime=t.position+l;var d=o.getLivePosition();void 0!==d&&(u.liveGap=d-t.position)}else if(i&&null!==this.videoElement){var c=a(this.videoElement);void 0!==c&&(u.wallClockTime=c+t.position)}this.trigger("positionUpdate",u)}}},i._priv_triggerAvailableBitratesChangeEvent=function(e,t,n){var r=this._priv_contentEventsMemory[e];n.isCancelled()||void 0!==r&&(0,m.Z)(t,r)||(this._priv_contentEventsMemory[e]=t,this.trigger(e,t))},i._priv_triggerCurrentBitrateChangeEvent=function(e,t,n){n.isCancelled()||t===this._priv_contentEventsMemory[e]||(this._priv_contentEventsMemory[e]=t,this.trigger(e,t))},i._priv_getCurrentRepresentations=function(){if(null===this._priv_contentInfos)return null;var e=this._priv_contentInfos,t=e.currentPeriod,n=e.activeRepresentations;return null===t||null===n||(0,S.Z)(n[t.id])?null:n[t.id]},i._priv_triggerEventIfNotStopped=function(e,t,n){n.isCancelled()||this.trigger(e,t)},i._priv_initializeMediaElementTrackChoiceManager=function(e,t,n){var r,i,a,o=this;(0,y.Z)(null!==h.Z.directfile,"Initializing `MediaElementTrackChoiceManager` without Directfile feature"),(0,y.Z)(null!==this.videoElement,"Initializing `MediaElementTrackChoiceManager` on a disposed RxPlayer");var s=new h.Z.directfile.mediaElementTrackChoiceManager(this.videoElement),u=void 0===e?this._priv_preferredAudioTracks:[e];s.setPreferredAudioTracks(u,!0);var l=void 0===t?this._priv_preferredTextTracks:[t];return s.setPreferredTextTracks(l,!0),s.setPreferredVideoTracks(this._priv_preferredVideoTracks,!0),this._priv_triggerEventIfNotStopped("availableAudioTracksChange",s.getAvailableAudioTracks(),n),this._priv_triggerEventIfNotStopped("availableVideoTracksChange",s.getAvailableVideoTracks(),n),this._priv_triggerEventIfNotStopped("availableTextTracksChange",s.getAvailableTextTracks(),n),this._priv_triggerEventIfNotStopped("audioTrackChange",null!==(r=s.getChosenAudioTrack())&&void 0!==r?r:null,n),this._priv_triggerEventIfNotStopped("textTrackChange",null!==(i=s.getChosenTextTrack())&&void 0!==i?i:null,n),this._priv_triggerEventIfNotStopped("videoTrackChange",null!==(a=s.getChosenVideoTrack())&&void 0!==a?a:null,n),s.addEventListener("availableVideoTracksChange",(function(e){return o.trigger("availableVideoTracksChange",e)})),s.addEventListener("availableAudioTracksChange",(function(e){return o.trigger("availableAudioTracksChange",e)})),s.addEventListener("availableTextTracksChange",(function(e){return o.trigger("availableTextTracksChange",e)})),s.addEventListener("audioTrackChange",(function(e){return o.trigger("audioTrackChange",e)})),s.addEventListener("videoTrackChange",(function(e){return o.trigger("videoTrackChange",e)})),s.addEventListener("textTrackChange",(function(e){return o.trigger("textTrackChange",e)})),s},(0,e.Z)(r,null,[{key:"ErrorTypes",get:function(){return p.ZB}},{key:"ErrorCodes",get:function(){return p.SM}},{key:"LogLevel",get:function(){return l.Z.getLevel()},set:function(e){l.Z.setLevel(e)}}]),r}(_.Z);jn.version="3.31.0";var qn=jn,Yn=n(7273);!function(){Yn.Z.decrypt=n(2206).ZP,Yn.Z.imageBuffer=n(7127).Z,Yn.Z.imageParser=n(3203).Z,Yn.Z.transports.smooth=n(2339).Z,Yn.Z.transports.dash=n(85).Z,Yn.Z.dashParsers.js=n(4541).Z,Yn.Z.nativeTextTracksBuffer=n(9059).Z,Yn.Z.nativeTextTracksParsers.vtt=n(9405).Z,Yn.Z.nativeTextTracksParsers.ttml=n(1570).Z,Yn.Z.nativeTextTracksParsers.sami=n(1812).Z,Yn.Z.nativeTextTracksParsers.srt=n(8057).Z,Yn.Z.htmlTextTracksBuffer=n(5192).Z,Yn.Z.htmlTextTracksParsers.sami=n(5734).Z,Yn.Z.htmlTextTracksParsers.ttml=n(7439).Z,Yn.Z.htmlTextTracksParsers.srt=n(8675).Z,Yn.Z.htmlTextTracksParsers.vtt=n(4099).Z;var e=n(9372).Z,t=n(6796).Z;Yn.Z.directfile={initDirectFile:e,mediaElementTrackChoiceManager:t}}(),"boolean"==typeof __RX_PLAYER_DEBUG_MODE__&&__RX_PLAYER_DEBUG_MODE__&&l.Z.setLevel("DEBUG");var Xn=qn}(),r=r.default}()})); \ No newline at end of file +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.RxPlayer=t():e.RxPlayer=t()}(self,(function(){return function(){var e={3774:function(e,t,n){"use strict";n.d(t,{J:function(){return a},c:function(){return o}});var r=n(1946),i=n(2203).Z?void 0:window,a=void 0===i?void 0:(0,r.Z)(i.MediaSource)?(0,r.Z)(i.MozMediaSource)?(0,r.Z)(i.WebKitMediaSource)?i.MSMediaSource:i.WebKitMediaSource:i.MozMediaSource:i.MediaSource,o={HAVE_NOTHING:0,HAVE_METADATA:1,HAVE_CURRENT_DATA:2,HAVE_FUTURE_DATA:3,HAVE_ENOUGH_DATA:4}},3666:function(e,t,n){"use strict";n.d(t,{$u:function(){return p},SB:function(){return c},YM:function(){return u},fq:function(){return s},kD:function(){return o},lV:function(){return m},l_:function(){return h},op:function(){return f},vS:function(){return d},vU:function(){return l},yS:function(){return v}});var r,i,a=n(2203),o=!1,s=!1,u=!1,l=!1,d=!1,c=!1,f=!1,v=!1,p=!1,h=!1,m=!1;a.Z||(void 0!==window.MSInputMethodContext&&void 0!==document.documentMode?(s=!0,u=!0):"Microsoft Internet Explorer"===navigator.appName||"Netscape"===navigator.appName&&/(Trident|Edge)\//.test(navigator.userAgent)?u=!0:-1!==navigator.userAgent.toLowerCase().indexOf("edg/")?o=!0:-1!==navigator.userAgent.toLowerCase().indexOf("firefox")?l=!0:"string"==typeof navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)?c=!0:(Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor")>=0||"[object SafariRemoteNotification]"===(null===(i=null===(r=window.safari)||void 0===r?void 0:r.pushNotification)||void 0===i?void 0:i.toString()))&&(d=!0),/SamsungBrowser/.test(navigator.userAgent)&&(f=!0),-1!==navigator.userAgent.indexOf("PlayStation 5")?m=!0:/Tizen/.test(navigator.userAgent)?v=!0:/[Ww]eb[O0]S/.test(navigator.userAgent)?(p=!0,/[Ww]eb[O0]S.TV-2022/.test(navigator.userAgent)||/[Cc]hr[o0]me\/87/.test(navigator.userAgent)||(/[Ww]eb[O0]S.TV-2021/.test(navigator.userAgent)||/[Cc]hr[o0]me\/79/.test(navigator.userAgent))):/[Pp]anasonic/.test(navigator.userAgent)&&(h=!0))},5767:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(3887),i=n(1946);function a(e){var t=e.textTracks;if(!(0,i.Z)(t)){for(var n=0;n=0;o--)if("track"===a[o].nodeName)try{e.removeChild(a[o])}catch(e){r.Z.warn("Compat: Could not remove text track child from element.")}}e.src="",e.removeAttribute("src")}},6139:function(e,t,n){"use strict";n.d(t,{N:function(){return M},Y:function(){return C}});var r,i=n(3714),a=n(811),o=n(3666),s=n(2203),u=n(5059),l=n(1656),d=function(){function e(e,t,n){this._keyType=e,this._mediaKeys=t,this._configuration=n}var t=e.prototype;return t.createMediaKeys=function(){var e=this;return new Promise((function(t){return t(e._mediaKeys)}))},t.getConfiguration=function(){return this._configuration},(0,l.Z)(e,[{key:"keySystem",get:function(){return this._keyType}}]),e}();if(!s.Z){var c=window.MSMediaKeys;void 0!==c&&void 0!==c.prototype&&"function"==typeof c.isTypeSupported&&"function"==typeof c.prototype.createSession&&(r=c)}var f,v=n(4578),p=n(1959),h=n(288),m=n(3038),g=function(e){function t(t){var n;return(n=e.call(this)||this).expiration=NaN,n.keyStatuses=new Map,n._mk=t,n._sessionClosingCanceller=new h.ZP,n.closed=new Promise((function(e){n._sessionClosingCanceller.signal.register((function(){return e()}))})),n.update=function(e){return new Promise((function(t,r){if(void 0===n._ss)return r("MediaKeySession not set.");try{t(n._ss.update(e,""))}catch(e){r(e)}}))},n}(0,v.Z)(t,e);var n=t.prototype;return n.generateRequest=function(e,t){var n=this;return new Promise((function(e){var r=t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer);n._ss=n._mk.createSession("video/mp4",r),m.RV(n._ss,(function(e){var t;n.trigger(null!==(t=e.type)&&void 0!==t?t:"message",e)}),n._sessionClosingCanceller.signal),m.kk(n._ss,(function(e){var t;n.trigger(null!==(t=e.type)&&void 0!==t?t:"keyadded",e)}),n._sessionClosingCanceller.signal),m.Dl(n._ss,(function(e){var t;n.trigger(null!==(t=e.type)&&void 0!==t?t:"keyerror",e)}),n._sessionClosingCanceller.signal),e()}))},n.close=function(){var e=this;return new Promise((function(t){null!=e._ss&&(e._ss.close(),e._ss=void 0),e._sessionClosingCanceller.cancel(),t()}))},n.load=function(){return Promise.resolve(!1)},n.remove=function(){return Promise.resolve()},(0,l.Z)(t,[{key:"sessionId",get:function(){var e,t;return null!==(t=null===(e=this._ss)||void 0===e?void 0:e.sessionId)&&void 0!==t?t:""}}]),t}(p.Z),y=function(){function e(e){if(void 0===r)throw new Error("No MSMediaKeys API.");this._mediaKeys=new r(e)}var t=e.prototype;return t._setVideo=function(e){if(this._videoElement=e,void 0!==this._videoElement.msSetMediaKeys)return this._videoElement.msSetMediaKeys(this._mediaKeys)},t.createSession=function(){if(void 0===this._videoElement||void 0===this._mediaKeys)throw new Error("Video not attached to the MediaKeys");return new g(this._mediaKeys)},t.setServerCertificate=function(){throw new Error("Server certificate is not implemented in your browser")},e}();if(!s.Z){var _=window.MozMediaKeys;void 0!==_&&void 0!==_.prototype&&"function"==typeof _.isTypeSupported&&"function"==typeof _.prototype.createSession&&(f=_)}var b=n(9689),S=n(8894),T=n(3635);function E(e){return"function"==typeof e.webkitGenerateKeyRequest}var k=function(e){function t(t,n){var r;(r=e.call(this)||this)._vid=t,r._key=n,r.sessionId="",r._closeSession=S.Z,r.keyStatuses=new Map,r.expiration=NaN;var i=function(e){r.trigger(e.type,e)};return r.closed=new Promise((function(e){r._closeSession=function(){["keymessage","message","keyadded","ready","keyerror","error"].forEach((function(e){t.removeEventListener(e,i),t.removeEventListener("webkit"+e,i)})),e()}})),["keymessage","message","keyadded","ready","keyerror","error"].forEach((function(e){t.addEventListener(e,i),t.addEventListener("webkit"+e,i)})),r}(0,v.Z)(t,e);var n=t.prototype;return n.update=function(e){var t=this;return new Promise((function(n,r){try{if(t._key.indexOf("clearkey")>=0){var i=e instanceof ArrayBuffer?new Uint8Array(e):e,a=JSON.parse((0,T.uR)(i)),o=(0,b.K)(a.keys[0].k),s=(0,b.K)(a.keys[0].kid);n(t._vid.webkitAddKey(t._key,o,s,""))}else n(t._vid.webkitAddKey(t._key,e,null,""))}catch(e){r(e)}}))},n.generateRequest=function(e,t){var n=this;return new Promise((function(e){n._vid.webkitGenerateKeyRequest(n._key,t),e()}))},n.close=function(){var e=this;return new Promise((function(t){e._closeSession(),t()}))},n.load=function(){return Promise.resolve(!1)},n.remove=function(){return Promise.resolve()},t}(p.Z),w=function(){function e(e){this._keySystem=e}var t=e.prototype;return t._setVideo=function(e){if(!E(e))throw new Error("Video not attached to the MediaKeys");this._videoElement=e},t.createSession=function(){if(null==this._videoElement)throw new Error("Video not attached to the MediaKeys");return new k(this._videoElement,this._keySystem)},t.setServerCertificate=function(){throw new Error("Server certificate is not implemented in your browser")},e}();var A=n(6968);var I=n(158);function Z(e,t){var n=e;if(void 0===n.webkitSetMediaKeys)throw new Error("No webKitMediaKeys API.");return n.webkitSetMediaKeys(t)}var R=function(e){function t(t,n,r){var i;return(i=e.call(this)||this)._serverCertificate=r,i._videoElement=t,i._keyType=n,i._unbindSession=S.Z,i._closeSession=S.Z,i.closed=new Promise((function(e){i._closeSession=e})),i.keyStatuses=new Map,i.expiration=NaN,i}(0,v.Z)(t,e);var n=t.prototype;return n.update=function(e){var t=this;return new Promise((function(n,r){if(void 0===t._nativeSession||void 0===t._nativeSession.update||"function"!=typeof t._nativeSession.update)return r("Unavailable WebKit key session.");try{var i;i=e instanceof ArrayBuffer?new Uint8Array(e):e instanceof Uint8Array?e:new Uint8Array(e.buffer),n(t._nativeSession.update(i))}catch(e){r(e)}}))},n.generateRequest=function(e,t){var n=this;return new Promise((function(e){var r,i,a,o=n._videoElement;if(void 0===(null===(r=o.webkitKeys)||void 0===r?void 0:r.createSession))throw new Error("No WebKitMediaKeys API.");if("com.apple.fps.1_0"===(a=n._keyType)||"com.apple.fps.2_0"===a){if(void 0===n._serverCertificate)throw new Error("A server certificate is needed for creating fairplay session.");i=function(e,t){var n=e instanceof Uint8Array?e:new Uint8Array(e),r=t instanceof Uint8Array?t:new Uint8Array(t);if((0,A.dN)(n,0)+4!==n.length)throw new Error("Unsupported WebKit initData.");var i=(0,T.wV)(n),a=i.indexOf("skd://"),o=a>-1?i.substring(a+6):i,s=(0,T.TZ)(o),u=0,l=new Uint8Array(n.byteLength+4+s.byteLength+4+r.byteLength);return l.set(n),u+=n.length,l.set((0,A.O_)(s.byteLength),u),u+=4,l.set(s,u),u+=s.byteLength,l.set((0,A.O_)(r.byteLength),u),u+=4,l.set(r,u),l}(t,n._serverCertificate)}else i=t;var s=o.webkitKeys.createSession("video/mp4",i);if(null==s)throw new Error("Impossible to get the key sessions");n._listenEvent(s),n._nativeSession=s,e()}))},n.close=function(){var e=this;return new Promise((function(t,n){e._unbindSession(),e._closeSession(),void 0!==e._nativeSession?(e._nativeSession.close(),t()):n("No session to close.")}))},n.load=function(){return Promise.resolve(!1)},n.remove=function(){return Promise.resolve()},n._listenEvent=function(e){var t=this;this._unbindSession();var n=function(e){t.trigger(e.type,e)};["keymessage","message","keyadded","ready","keyerror","error"].forEach((function(t){e.addEventListener(t,n),e.addEventListener("webkit"+t,n)})),this._unbindSession=function(){["keymessage","message","keyadded","ready","keyerror","error"].forEach((function(t){e.removeEventListener(t,n),e.removeEventListener("webkit"+t,n)}))}},(0,l.Z)(t,[{key:"sessionId",get:function(){var e,t;return null!==(t=null===(e=this._nativeSession)||void 0===e?void 0:e.sessionId)&&void 0!==t?t:""}}]),t}(p.Z),x=function(){function e(e){if(void 0===I.t)throw new Error("No WebKitMediaKeys API.");this._keyType=e,this._mediaKeys=new I.t(e)}var t=e.prototype;return t._setVideo=function(e){if(this._videoElement=e,void 0===this._videoElement)throw new Error("Video not attached to the MediaKeys");return Z(this._videoElement,this._mediaKeys)},t.createSession=function(){if(void 0===this._videoElement||void 0===this._mediaKeys)throw new Error("Video not attached to the MediaKeys");return new R(this._videoElement,this._keyType,this._serverCertificate)},t.setServerCertificate=function(e){return this._serverCertificate=e,Promise.resolve()},e}();var M=null,C=function(e,t){var n=e;return"function"==typeof n.setMediaKeys?n.setMediaKeys(t):"function"==typeof n.webkitSetMediaKeys?n.webkitSetMediaKeys(t):"function"==typeof n.mozSetMediaKeys?n.mozSetMediaKeys(t):"function"==typeof n.msSetMediaKeys&&null!==t?n.msSetMediaKeys(t):void 0};if(s.Z||null!=navigator.requestMediaKeySystemAccess&&!(0,u.Z)())M=function(){var e;return(e=navigator).requestMediaKeySystemAccess.apply(e,arguments)};else{var P,D;if(E(HTMLVideoElement.prototype)){var N={isTypeSupported:function(e){var t=document.querySelector("video");return null==t&&(t=document.createElement("video")),null!=t&&"function"==typeof t.canPlayType&&!!t.canPlayType("video/mp4",e)},createCustomMediaKeys:function(e){return new w(e)},setMediaKeys:function(e,t){if(null!==t){if(!(t instanceof w))throw new Error("Custom setMediaKeys is supposed to be called with old webkit custom MediaKeys.");return t._setVideo(e)}}};P=N.isTypeSupported,D=N.createCustomMediaKeys,C=N.setMediaKeys}else if(void 0!==I.t){var O=function(){if(void 0===I.t)throw new Error("No WebKitMediaKeys API.");return{isTypeSupported:I.t.isTypeSupported,createCustomMediaKeys:function(e){return new x(e)},setMediaKeys:function(e,t){if(null===t)return Z(e,t);if(!(t instanceof x))throw new Error("Custom setMediaKeys is supposed to be called with webkit custom MediaKeys.");return t._setVideo(e)}}}();P=O.isTypeSupported,D=O.createCustomMediaKeys,C=O.setMediaKeys}else if(o.fq&&void 0!==r){var L={isTypeSupported:function(e,t){if(void 0===r)throw new Error("No MSMediaKeys API.");return void 0!==t?r.isTypeSupported(e,t):r.isTypeSupported(e)},createCustomMediaKeys:function(e){return new y(e)},setMediaKeys:function(e,t){if(null!==t){if(!(t instanceof y))throw new Error("Custom setMediaKeys is supposed to be called with IE11 custom MediaKeys.");return t._setVideo(e)}}};P=L.isTypeSupported,D=L.createCustomMediaKeys,C=L.setMediaKeys}else if(void 0!==f){var U={isTypeSupported:function(e,t){if(void 0===f)throw new Error("No MozMediaKeys API.");return void 0!==t?f.isTypeSupported(e,t):f.isTypeSupported(e)},createCustomMediaKeys:function(e){if(void 0===f)throw new Error("No MozMediaKeys API.");return new f(e)},setMediaKeys:function(e,t){var n=e;if(void 0===n.mozSetMediaKeys||"function"!=typeof n.mozSetMediaKeys)throw new Error("Can't set video on MozMediaKeys.");return n.mozSetMediaKeys(t)}};P=U.isTypeSupported,D=U.createCustomMediaKeys,C=U.setMediaKeys}else{var B=window.MediaKeys,F=function(){if(void 0===B)throw new i.Z("MEDIA_KEYS_NOT_SUPPORTED","No `MediaKeys` implementation found in the current browser.");if(void 0===B.isTypeSupported){throw new Error("This browser seems to be unable to play encrypted contents currently. Note: Some browsers do not allow decryption in some situations, like when not using HTTPS.")}};P=function(e){return F(),(0,a.Z)("function"==typeof B.isTypeSupported),B.isTypeSupported(e)},D=function(e){return F(),new B(e)}}M=function(e,t){if(!P(e))return Promise.reject(new Error("Unsupported key type"));for(var n=0;n=t)return r.Z.warn("Compat: Invalid cue times: "+e+" - "+t),null;if((0,i.Z)(window.VTTCue)){if((0,i.Z)(window.TextTrackCue))throw new Error("VTT cues not supported in your target");return new TextTrackCue(e,t,n)}return new VTTCue(e,t,n)}},5059:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(3666),i=n(158);function a(){return(r.vS||r.SB)&&void 0!==i.t}},1669:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(3666);function i(){return r.op}},6872:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r={DEFAULT_UNMUTED_VOLUME:.1,DEFAULT_REQUEST_TIMEOUT:3e4,DEFAULT_TEXT_TRACK_MODE:"native",DEFAULT_MANUAL_BITRATE_SWITCHING_MODE:"seamless",DEFAULT_ENABLE_FAST_SWITCHING:!0,DEFAULT_AUDIO_TRACK_SWITCHING_MODE:"seamless",DELTA_POSITION_AFTER_RELOAD:{bitrateSwitch:-.1,trackSwitch:{audio:-.7,video:-.1,other:0}},DEFAULT_CODEC_SWITCHING_BEHAVIOR:"continue",DEFAULT_AUTO_PLAY:!1,DEFAULT_SHOW_NATIVE_SUBTITLE:!0,DEFAULT_STOP_AT_END:!0,DEFAULT_WANTED_BUFFER_AHEAD:30,DEFAULT_MAX_BUFFER_AHEAD:1/0,DEFAULT_MAX_BUFFER_BEHIND:1/0,DEFAULT_MAX_VIDEO_BUFFER_SIZE:1/0,MAXIMUM_MAX_BUFFER_AHEAD:{text:18e3},MAXIMUM_MAX_BUFFER_BEHIND:{text:18e3},DEFAULT_INITIAL_BITRATES:{audio:0,video:0,other:0},DEFAULT_MIN_BITRATES:{audio:0,video:0,other:0},DEFAULT_MAX_BITRATES:{audio:1/0,video:1/0,other:1/0},INACTIVITY_DELAY:6e4,DEFAULT_THROTTLE_WHEN_HIDDEN:!1,DEFAULT_THROTTLE_VIDEO_BITRATE_WHEN_HIDDEN:!1,DEFAULT_LIMIT_VIDEO_WIDTH:!1,DEFAULT_LIVE_GAP:{DEFAULT:10,LOW_LATENCY:3.5},BUFFER_DISCONTINUITY_THRESHOLD:.2,FORCE_DISCONTINUITY_SEEK_DELAY:5e3,BITRATE_REBUFFERING_RATIO:1.5,BUFFER_GC_GAPS:{CALM:240,BEEFY:30},DEFAULT_MAX_MANIFEST_REQUEST_RETRY:4,DEFAULT_CDN_DOWNGRADE_TIME:60,DEFAULT_MAX_REQUESTS_RETRY_ON_ERROR:4,DEFAULT_MAX_REQUESTS_RETRY_ON_OFFLINE:1/0,INITIAL_BACKOFF_DELAY_BASE:{REGULAR:200,LOW_LATENCY:50},MAX_BACKOFF_DELAY_BASE:{REGULAR:3e3,LOW_LATENCY:1e3},SAMPLING_INTERVAL_MEDIASOURCE:1e3,SAMPLING_INTERVAL_LOW_LATENCY:250,SAMPLING_INTERVAL_NO_MEDIASOURCE:500,ABR_ENTER_BUFFER_BASED_ALGO:10,ABR_EXIT_BUFFER_BASED_ALGO:5,ABR_MINIMUM_TOTAL_BYTES:15e4,ABR_MINIMUM_CHUNK_SIZE:16e3,ABR_STARVATION_FACTOR:{DEFAULT:.72,LOW_LATENCY:.72},ABR_REGULAR_FACTOR:{DEFAULT:.72,LOW_LATENCY:.72},ABR_STARVATION_GAP:{DEFAULT:5,LOW_LATENCY:5},OUT_OF_STARVATION_GAP:{DEFAULT:7,LOW_LATENCY:7},ABR_STARVATION_DURATION_DELTA:.1,ABR_FAST_EMA:2,ABR_SLOW_EMA:10,RESUME_GAP_AFTER_SEEKING:{DEFAULT:1.5,LOW_LATENCY:.5},RESUME_GAP_AFTER_NOT_ENOUGH_DATA:{DEFAULT:.5,LOW_LATENCY:.5},RESUME_GAP_AFTER_BUFFERING:{DEFAULT:5,LOW_LATENCY:.5},REBUFFERING_GAP:{DEFAULT:.5,LOW_LATENCY:.2},MINIMUM_BUFFER_AMOUNT_BEFORE_FREEZING:2,UNFREEZING_SEEK_DELAY:6e3,FREEZING_STALLED_DELAY:600,UNFREEZING_DELTA_POSITION:.001,MAX_TIME_MISSING_FROM_COMPLETE_SEGMENT:.15,MAX_MANIFEST_BUFFERED_START_END_DIFFERENCE:.4,MAX_MANIFEST_BUFFERED_DURATION_DIFFERENCE:.3,MINIMUM_SEGMENT_SIZE:.005,APPEND_WINDOW_SECURITIES:{START:.2,END:.1},MAXIMUM_HTML_TEXT_TRACK_UPDATE_INTERVAL:50,TEXT_TRACK_SIZE_CHECKS_INTERVAL:250,BUFFER_PADDING:{audio:1,video:3,other:1},SEGMENT_PRIORITIES_STEPS:[2,4,8,12,18,25],MAX_HIGH_PRIORITY_LEVEL:1,MIN_CANCELABLE_PRIORITY:3,EME_DEFAULT_VIDEO_CODECS:['video/mp4;codecs="avc1.4d401e"','video/mp4;codecs="avc1.42e01e"','video/webm;codecs="vp8"'],EME_DEFAULT_AUDIO_CODECS:['audio/mp4;codecs="mp4a.40.2"',"audio/webm;codecs=opus"],EME_DEFAULT_WIDEVINE_ROBUSTNESSES:["HW_SECURE_ALL","HW_SECURE_DECODE","HW_SECURE_CRYPTO","SW_SECURE_DECODE","SW_SECURE_CRYPTO"],EME_DEFAULT_PLAYREADY_ROBUSTNESSES:["3000","2000"],EME_KEY_SYSTEMS:{clearkey:["webkit-org.w3.clearkey","org.w3.clearkey"],widevine:["com.widevine.alpha"],playready:["com.microsoft.playready.recommendation","com.microsoft.playready","com.chromecast.playready","com.youtube.playready"],fairplay:["com.apple.fps.1_0"]},MAX_CONSECUTIVE_MANIFEST_PARSING_IN_UNSAFE_MODE:10,MIN_MANIFEST_PARSING_TIME_TO_ENTER_UNSAFE_MODE:200,MIN_DASH_S_ELEMENTS_TO_PARSE_UNSAFELY:300,OUT_OF_SYNC_MANIFEST_REFRESH_DELAY:3e3,FAILED_PARTIAL_UPDATE_MANIFEST_REFRESH_DELAY:3e3,DASH_FALLBACK_LIFETIME_WHEN_MINIMUM_UPDATE_PERIOD_EQUAL_0:3,EME_DEFAULT_MAX_SIMULTANEOUS_MEDIA_KEY_SESSIONS:15,EME_MAX_STORED_PERSISTENT_SESSION_INFORMATION:1e3,EME_WAITING_DELAY_LOADED_SESSION_EMPTY_KEYSTATUSES:100,FORCED_ENDED_THRESHOLD:8e-4,ADAPTATION_SWITCH_BUFFER_PADDINGS:{video:{before:5,after:5},audio:{before:2,after:2.5},text:{before:0,after:0},image:{before:0,after:0}},SOURCE_BUFFER_FLUSHING_INTERVAL:500,CONTENT_REPLACEMENT_PADDING:1.2,CACHE_LOAD_DURATION_THRESHOLDS:{video:50,audio:10},STREAM_EVENT_EMITTER_POLL_INTERVAL:250,DEFAULT_MAXIMUM_TIME_ROUNDING_ERROR:.001,BUFFERED_HISTORY_RETENTION_TIME:6e4,BUFFERED_HISTORY_MAXIMUM_ENTRIES:200,MIN_BUFFER_AHEAD:5,UPTO_CURRENT_POSITION_CLEANUP:5},i=n(8026);function a(e){return null!=e&&!Array.isArray(e)&&"object"==typeof e}function o(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r=e.length||(e[t].enabled=!0)}(this._audioTracks.map((function(e){return e.nativeTrack})),e)},t}(a.Z);function f(e){for(var t=0;te.length)return u.Z.warn("Compat: Unrecognized initialization data. Use as is."),[{systemId:void 0,data:e}];var i=e.subarray(n,n+r),a={systemId:(0,l.Y)(i,8),data:i};p(t,a)?u.Z.warn("Compat: Duplicated PSSH found in initialization data, removing it."):t.push(a),n+=r}return n!==e.length?(u.Z.warn("Compat: Unrecognized initialization data. Use as is."),[{systemId:void 0,data:e}]):t}(new Uint8Array(t));return{type:n,values:r}}var m=n(6872),g=n(5157),y=n(5389),_=n(3274),b=n(7714),S=n(1959),T=n(1946),E=n(288),k=n(6139),w=n(770);function A(e){w.Z.setState(e,null),(0,k.Y)(e,null)}function I(){return(I=(0,r.Z)(o().mark((function e(t,n,r){var i,a,s,l,d,c;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=n.keySystemOptions,a=n.loadedSessionsStore,s=n.mediaKeySystemAccess,l=n.mediaKeys,d=w.Z.getState(t),c=null!==d&&d.loadedSessionsStore!==a?d.loadedSessionsStore.closeAllSessions():Promise.resolve(),e.next=5,c;case 5:if(!r.isCancelled()){e.next=7;break}throw r.cancellationError;case 7:if(w.Z.setState(t,{keySystemOptions:i,mediaKeySystemAccess:s,mediaKeys:l,loadedSessionsStore:a}),t.mediaKeys!==l){e.next=10;break}return e.abrupt("return");case 10:u.Z.info("DRM: Attaching MediaKeys to the media element"),(0,k.Y)(t,l),u.Z.info("DRM: MediaKeys attached with success");case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Z(e){if(""===e.sessionId)return!1;var t=e.keyStatuses,n=[];return t.forEach((function(e){n.push(e)})),n.length<=0?(u.Z.debug("DRM: isSessionUsable: MediaKeySession given has an empty keyStatuses",e.sessionId),!1):(0,b.Z)(n,"expired")?(u.Z.debug("DRM: isSessionUsable: MediaKeySession given has an expired key",e.sessionId),!1):(0,b.Z)(n,"internal-error")?(u.Z.debug("DRM: isSessionUsable: MediaKeySession given has a key with an internal-error",e.sessionId),!1):(u.Z.debug("DRM: isSessionUsable: MediaKeySession is usable",e.sessionId),!0)}function R(e,t,n,r){var i=e.loadedSessionsStore,a=e.persistentSessionsStore;return"temporary"===n?x(i,t):null===a?(u.Z.warn("DRM: Cannot create persistent MediaKeySession, PersistentSessionsStore not created."),x(i,t)):function(e,t,n,r){return M.apply(this,arguments)}(i,a,t,r)}function x(e,t){u.Z.info("DRM: Creating a new temporary session");var n=e.createSession(t,"temporary");return Promise.resolve({type:"created-session",value:n})}function M(){return M=(0,r.Z)(o().mark((function e(t,n,i,a){var s,l,d,c,f,v;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(v=function(){return v=(0,r.Z)(o().mark((function e(){var r,l;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===a.cancellationError){e.next=2;break}throw a.cancellationError;case 2:return u.Z.info("DRM: Removing previous persistent session."),null!==(r=n.get(i))&&n.delete(r.sessionId),e.prev=5,e.next=8,t.closeSession(s.mediaKeySession);case 8:e.next=15;break;case 10:if(e.prev=10,e.t0=e.catch(5),""===s.mediaKeySession.sessionId){e.next=14;break}throw e.t0;case 14:t.removeSessionWithoutClosingIt(s.mediaKeySession);case 15:if(null===a.cancellationError){e.next=17;break}throw a.cancellationError;case 17:return l=t.createSession(i,"persistent-license"),e.abrupt("return",{type:"created-session",value:l});case 19:case"end":return e.stop()}}),e,null,[[5,10]])}))),v.apply(this,arguments)},f=function(){return v.apply(this,arguments)},null===a.cancellationError){e.next=4;break}throw a.cancellationError;case 4:if(u.Z.info("DRM: Creating persistent MediaKeySession"),s=t.createSession(i,"persistent-license"),null!==(l=n.getAndReuse(i))){e.next=9;break}return e.abrupt("return",{type:"created-session",value:s});case 9:return e.prev=9,e.next=12,t.loadPersistentSession(s.mediaKeySession,l.sessionId);case 12:if(d=e.sent){e.next=19;break}return u.Z.warn("DRM: No data stored for the loaded session"),n.delete(l.sessionId),t.removeSessionWithoutClosingIt(s.mediaKeySession),c=t.createSession(i,"persistent-license"),e.abrupt("return",{type:"created-session",value:c});case 19:if(!d||!Z(s.mediaKeySession)){e.next=23;break}return n.add(i,i.keyIds,s.mediaKeySession),u.Z.info("DRM: Succeeded to load persistent session."),e.abrupt("return",{type:"loaded-persistent-session",value:s});case 23:return u.Z.warn("DRM: Previous persistent session not usable anymore."),e.abrupt("return",f());case 27:return e.prev=27,e.t0=e.catch(9),u.Z.warn("DRM: Unable to load persistent session: "+(e.t0 instanceof Error?e.t0.toString():"Unknown Error")),e.abrupt("return",f());case 31:case"end":return e.stop()}}),e,null,[[9,27]])}))),M.apply(this,arguments)}function C(e,t){return P.apply(this,arguments)}function P(){return(P=(0,r.Z)(o().mark((function e(t,n){var r,i,a,s,l;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n<0||n>=t.getLength())){e.next=2;break}return e.abrupt("return");case 2:for(u.Z.info("DRM: LSS cache limit exceeded",n,t.getLength()),r=[],i=t.getAll().slice(),a=i.length-n,s=0;s=s.length)){e.next=2;break}throw new g.Z("INCOMPATIBLE_KEYSYSTEMS","No key system compatible with your wanted configuration has been found in the current browser.");case 2:if(null!=k.N){e.next=4;break}throw new Error("requestMediaKeySystemAccess is not implemented in your browser.");case 4:return r=s[t],i=r.keyName,a=r.keyType,d=r.keySystemOptions,c=B(i,a,d),u.Z.debug("DRM: Request keysystem access "+a+","+(t+1)+" of "+s.length),e.prev=7,e.next=10,(0,k.N)(a,c);case 10:return f=e.sent,u.Z.info("DRM: Found compatible keysystem",a,t+1),e.abrupt("return",{type:"create-media-key-system-access",value:{options:d,mediaKeySystemAccess:f}});case 15:if(e.prev=15,e.t0=e.catch(7),u.Z.debug("DRM: Rejected access to keysystem",a,t+1),null===n.cancellationError){e.next=20;break}throw n.cancellationError;case 20:return e.abrupt("return",l(t+1));case 21:case"end":return e.stop()}}),e,null,[[7,15]])})))).apply(this,arguments)}}var V=n(2297);function z(e,t,n){var r;u.Z.debug("Compat: Calling generateRequest on the MediaKeySession");try{r=function(e){u.Z.info("Compat: Trying to move CENC PSSH from init data at the end of it.");for(var t=!1,n=new Uint8Array,r=new Uint8Array,i=0;ie.length)throw u.Z.warn("Compat: unrecognized initialization data. Cannot patch it."),new Error("Compat: unrecognized initialization data. Cannot patch it.");var o=e.subarray(i,i+a);if(16===e[i+12]&&119===e[i+13]&&239===e[i+14]&&236===e[i+15]&&192===e[i+16]&&178===e[i+17]&&77===e[i+18]&&2===e[i+19]&&172===e[i+20]&&227===e[i+21]&&60===e[i+22]&&30===e[i+23]&&82===e[i+24]&&226===e[i+25]&&251===e[i+26]&&75===e[i+27]){var s=(0,V.Xj)(o),l=null===s?void 0:o[s[1]];u.Z.info("Compat: CENC PSSH found with version",l),void 0===l?u.Z.warn("Compat: could not read version of CENC PSSH"):t===(1===l)?n=(0,c.zo)(n,o):1===l?(u.Z.warn("Compat: cenc version 1 encountered, removing every other cenc pssh box."),n=o,t=!0):u.Z.warn("Compat: filtering out cenc pssh box with wrong version",l)}else r=(0,c.zo)(r,o);i+=a}if(i!==e.length)throw u.Z.warn("Compat: unrecognized initialization data. Cannot patch it."),new Error("Compat: unrecognized initialization data. Cannot patch it.");return(0,c.zo)(r,n)}(n)}catch(e){r=n}var i=null!=t?t:"";return e.generateRequest(i,r).catch((function(t){if(""!==i||!(t instanceof TypeError))throw t;return u.Z.warn('Compat: error while calling `generateRequest` with an empty initialization data type. Retrying with a default "cenc" value.',t),e.generateRequest("cenc",r)}))}var K=100;function G(e,t){return W.apply(this,arguments)}function W(){return(W=(0,r.Z)(o().mark((function e(t,n){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u.Z.info("DRM: Load persisted session",n),e.next=3,t.load(n);case 3:if((r=e.sent)&&!(t.keyStatuses.size>0)){e.next=6;break}return e.abrupt("return",r);case 6:return e.abrupt("return",new Promise((function(e){t.addEventListener("keystatuseschange",i);var n=setTimeout(i,K);function i(){clearTimeout(n),t.removeEventListener("keystatuseschange",i),e(r)}})));case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var H=n(7864);function j(e){var t=new E.ZP;return Promise.race([e.close().then((function(){t.cancel()})),e.closed.then((function(){t.cancel()})),function(){return n.apply(this,arguments)}()]);function n(){return(n=(0,r.Z)(o().mark((function e(){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,(0,H.Z)(1e3,t.signal);case 3:return e.next=5,i();case 5:e.next=13;break;case 7:if(e.prev=7,e.t0=e.catch(0),!(e.t0 instanceof E.FU)){e.next=11;break}return e.abrupt("return");case 11:n=e.t0 instanceof Error?e.t0.message:"Unknown error made it impossible to close the session",u.Z.error("DRM: "+n);case 13:case"end":return e.stop()}}),e,null,[[0,7]])})))).apply(this,arguments)}function i(){return a.apply(this,arguments)}function a(){return(a=(0,r.Z)(o().mark((function n(){return o().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,n.next=3,e.update(new Uint8Array(1));case 3:n.next=13;break;case 5:if(n.prev=5,n.t0=n.catch(0),!t.isUsed()){n.next=9;break}return n.abrupt("return");case 9:if(!(n.t0 instanceof Error&&"The session is already closed."===n.t0.message)){n.next=11;break}return n.abrupt("return");case 11:return n.next=13,(0,H.Z)(1e3,t.signal);case 13:if(!t.isUsed()){n.next=15;break}return n.abrupt("return");case 15:throw new Error("Compat: Couldn't know if session is closed");case 16:case"end":return n.stop()}}),n,null,[[0,5]])})))).apply(this,arguments)}}var q=n(811);function Y(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return X(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return X(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function X(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function te(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0){if(null!==this._keyIds&&J(t,this._keyIds))return!0;if(void 0!==this._initializationData.keyIds)return J(t,this._initializationData.keyIds)}return this._checkInitializationDataCompatibility(e)},t._checkInitializationDataCompatibility=function(e){return void 0!==e.keyIds&&e.keyIds.length>0&&void 0!==this._initializationData.keyIds?J(e.keyIds,this._initializationData.keyIds):this._initializationData.type===e.type&&this._initializationData.values.isCompatibleWith(e.values)},e}();function re(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return ie(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ie(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ie(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0&&n._storage[e].mediaKeySession===i&&n._storage.splice(e,1)})).catch((function(e){u.Z.warn("DRM-LSS: MediaKeySession.closed rejected: "+e)})),this._storage.push(Object.assign({},a)),u.Z.debug("DRM-LSS: MediaKeySession added",a.sessionType,this._storage.length),a},t.reuse=function(e){for(var t=this._storage.length-1;t>=0;t--){var n=this._storage[t];if(n.keySessionRecord.isCompatibleWith(e))return this._storage.splice(t,1),this._storage.push(n),u.Z.debug("DRM-LSS: Reusing session:",n.mediaKeySession.sessionId,n.sessionType),Object.assign({},n)}return null},t.getEntryForSession=function(e){for(var t=this._storage.length-1;t>=0;t--){var n=this._storage[t];if(n.mediaKeySession===e)return Object.assign({},n)}return null},t.generateLicenseRequest=function(){var e=(0,r.Z)(o().mark((function e(t,n,r){var i,a,s,l;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:a=re(this._storage);case 1:if((s=a()).done){e.next=8;break}if((l=s.value).mediaKeySession!==t){e.next=6;break}return i=l,e.abrupt("break",8);case 6:e.next=1;break;case 8:if(void 0!==i){e.next=11;break}return u.Z.error("DRM-LSS: generateRequest error. No MediaKeySession found with the given initData and initDataType"),e.abrupt("return",z(t,n,r));case 11:if(i.isGeneratingRequest=!0,"none"===i.closingStatus.type){e.next=14;break}throw new Error("The `MediaKeySession` is being closed.");case 14:return e.prev=14,e.next=17,z(t,n,r);case 17:e.next=26;break;case 19:if(e.prev=19,e.t0=e.catch(14),void 0!==i){e.next=23;break}throw e.t0;case 23:throw i.isGeneratingRequest=!1,"awaiting"===i.closingStatus.type&&i.closingStatus.start(),e.t0;case 26:if(void 0!==i){e.next=28;break}return e.abrupt("return",void 0);case 28:i.isGeneratingRequest=!1,"awaiting"===i.closingStatus.type&&i.closingStatus.start();case 30:case"end":return e.stop()}}),e,this,[[14,19]])})));return function(t,n,r){return e.apply(this,arguments)}}(),t.loadPersistentSession=function(){var e=(0,r.Z)(o().mark((function e(t,n){var r,i,a,s,l;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=re(this._storage);case 1:if((a=i()).done){e.next=8;break}if((s=a.value).mediaKeySession!==t){e.next=6;break}return r=s,e.abrupt("break",8);case 6:e.next=1;break;case 8:if(void 0!==r){e.next=11;break}return u.Z.error("DRM-LSS: loadPersistentSession error. No MediaKeySession found with the given initData and initDataType"),e.abrupt("return",G(t,n));case 11:if(r.isLoadingPersistentSession=!0,"none"===r.closingStatus.type){e.next=14;break}throw new Error("The `MediaKeySession` is being closed.");case 14:return e.prev=14,e.next=17,G(t,n);case 17:l=e.sent,e.next=27;break;case 20:if(e.prev=20,e.t0=e.catch(14),void 0!==r){e.next=24;break}throw e.t0;case 24:throw r.isLoadingPersistentSession=!1,"awaiting"===r.closingStatus.type&&r.closingStatus.start(),e.t0;case 27:if(void 0!==r){e.next=29;break}return e.abrupt("return",l);case 29:return r.isLoadingPersistentSession=!1,"awaiting"===r.closingStatus.type&&r.closingStatus.start(),e.abrupt("return",l);case 32:case"end":return e.stop()}}),e,this,[[14,20]])})));return function(t,n){return e.apply(this,arguments)}}(),t.closeSession=function(){var e=(0,r.Z)(o().mark((function e(t){var n,r,i,a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=re(this._storage);case 1:if((i=r()).done){e.next=8;break}if((a=i.value).mediaKeySession!==t){e.next=6;break}return n=a,e.abrupt("break",8);case 6:e.next=1;break;case 8:if(void 0!==n){e.next=11;break}return u.Z.warn("DRM-LSS: No MediaKeySession found with the given initData and initDataType"),e.abrupt("return",Promise.resolve(!1));case 11:return e.abrupt("return",this._closeEntry(n));case 12:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.getLength=function(){return this._storage.length},t.getAll=function(){return this._storage},t.closeAllSessions=function(){var e=(0,r.Z)(o().mark((function e(){var t,n,r=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this._storage,u.Z.debug("DRM-LSS: Closing all current MediaKeySessions",t.length),this._storage=[],n=t.map((function(e){return r._closeEntry(e)})),e.next=6,Promise.all(n);case 6:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),t.removeSessionWithoutClosingIt=function(e){(0,q.Z)(""===e.sessionId,"Initialized `MediaKeySession`s should always be properly closed");for(var t=this._storage.length-1;t>=0;t--){if(this._storage[t].mediaKeySession===e)return u.Z.debug("DRM-LSS: Removing session without closing it",e.sessionId),this._storage.splice(t,1),!0}return!1},t.getIndex=function(e){for(var t=0;t=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function he(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0){var o=void 0===t?3:4,s=this._entries[a];if((null!==(r=s.version)&&void 0!==r?r:-1)>=o&&i===s.sessionId)return;u.Z.info("DRM-PSS: Updating session info.",i),this._entries.splice(a,1)}else u.Z.info("DRM-PSS: Add new session",i);var l=e.values.getFormattedValues().map((function(e){var t=e.systemId,n=e.data;return{systemId:t,hash:e.hash,data:new ce(n)}}));void 0===t?this._entries.push({version:3,sessionId:i,values:l,initDataType:e.type}):this._entries.push({version:4,sessionId:i,keyIds:t.map((function(e){return new ce(e)})),values:l,initDataType:e.type}),this._save()}else u.Z.warn("DRM-PSS: Invalid Persisten Session given.")},t.delete=function(e){for(var t=-1,n=0;n0&&(r=new g.Z("KEY_STATUS_CHANGE_ERROR","One or several problematic key statuses have been encountered",{keyStatuses:c})),{warning:r,blacklistedKeyIds:l,whitelistedKeyIds:d}}var Pe=s.Dl,De=s.RV,Ne=s.qo;function Oe(e,t,n,i,a){u.Z.info("DRM: Binding session events",e.sessionId);var s=t.getLicenseConfig,l=void 0===s?{}:s,d=new E.ZP;return d.linkToSignal(a),(0,T.Z)(e.closed)||e.closed.then((function(){return d.cancel()})).catch((function(e){a.isCancelled()||(d.cancel(),i.onError(e))})),Pe(e,(function(e){d.cancel(),i.onError(new g.Z("KEY_ERROR",e.type))}),d.signal),Ne(e,(function(e){(function(e){return c.apply(this,arguments)})(e).catch((function(e){a.isCancelled()||d.isUsed()&&e instanceof E.XG||(d.cancel(),i.onError(e))}))}),d.signal),De(e,(function(n){var a,s=n,c=new Uint8Array(s.message),f=(0,de.Z)(s.messageType)?s.messageType:"license-request";u.Z.info("DRM: Received message event, type "+f,e.sessionId),function(e,t,n){var i=t.baseDelay,a=t.maxDelay,s=t.totalRetry,u=t.shouldRetry,l=t.onRetry,d=0;return c();function c(){return f.apply(this,arguments)}function f(){return(f=(0,r.Z)(o().mark((function t(){var r,f,v,p;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null===n.cancellationError){t.next=2;break}throw n.cancellationError;case 2:return t.prev=2,t.next=5,e();case 5:return r=t.sent,t.abrupt("return",r);case 9:if(t.prev=9,t.t0=t.catch(2),null===n.cancellationError){t.next=13;break}throw n.cancellationError;case 13:if(!(!(0,T.Z)(u)&&!u(t.t0)||d++>=s)){t.next=15;break}throw t.t0;case 15:return"function"==typeof l&&l(t.t0,d),f=Math.min(i*Math.pow(2,d-1),a),v=(0,Ie.Z)(f),t.next=20,Ze(v);case 20:return p=c(),t.abrupt("return",p);case 22:case"end":return t.stop()}}),t,null,[[2,9]])})))).apply(this,arguments)}}((function(){return function(e,n){var r;return new Promise((function(i,a){try{u.Z.debug("DRM: Calling `getLicense`",n);var o=t.getLicense(e,n),s=(0,T.Z)(l.timeout)?1e4:l.timeout;s>=0&&(r=setTimeout((function(){a(new Ve('"getLicense" timeout exceeded ('+s+" ms)"))}),s)),Promise.resolve(o).then(d,c)}catch(e){c(e)}function d(e){void 0!==r&&clearTimeout(r),i(e)}function c(e){void 0!==r&&clearTimeout(r),a(e)}}))}(c,f)}),{totalRetry:null!=(a=l.retry)?a:2,baseDelay:200,maxDelay:3e3,shouldRetry:function(e){return e instanceof Ve||(0,T.Z)(e)||!0!==e.noRetry},onRetry:function(e){return i.onWarning(Le(e))}},d.signal).then((function(t){if(d.isUsed())return Promise.resolve();if((0,T.Z)(t))u.Z.info("DRM: No license given, skipping session.update");else try{return Ue(e,t)}catch(e){d.cancel(),i.onError(e)}})).catch((function(e){if(!d.isUsed()){d.cancel();var t=Le(e);if(!(0,T.Z)(e))if(!0===e.fallbackOnLastTry)return u.Z.warn("DRM: Last `getLicense` attempt failed. Blacklisting the current session."),void i.onError(new Fe(t));i.onError(t)}}))}),d.signal),void f();function c(){return c=(0,r.Z)(o().mark((function n(i){var s,l;return o().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return l=function(){return(l=(0,r.Z)(o().mark((function n(){var r,s;return o().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!d.isUsed()){n.next=2;break}return n.abrupt("return");case 2:if("function"!=typeof t.onKeyStatusesChange){n.next=24;break}return n.prev=3,n.next=6,t.onKeyStatusesChange(i,e);case 6:if(r=n.sent,!d.isUsed()){n.next=9;break}return n.abrupt("return");case 9:n.next=18;break;case 11:if(n.prev=11,n.t0=n.catch(3),!a.isCancelled()){n.next=15;break}return n.abrupt("return");case 15:throw s=new g.Z("KEY_STATUS_CHANGE_ERROR","Unknown `onKeyStatusesChange` error"),!(0,T.Z)(n.t0)&&(0,de.Z)(n.t0.message)&&(s.message=n.t0.message),s;case 18:if(!(0,T.Z)(r)){n.next=22;break}u.Z.info("DRM: No license given, skipping session.update"),n.next=24;break;case 22:return n.next=24,Ue(e,r);case 24:case"end":return n.stop()}}),n,null,[[3,11]])})))).apply(this,arguments)},s=function(){return l.apply(this,arguments)},u.Z.info("DRM: keystatuseschange event received",e.sessionId),n.next=5,Promise.all([s(),Promise.resolve(f())]);case 5:case"end":return n.stop()}}),n)}))),c.apply(this,arguments)}function f(){if(!d.isUsed()&&0!==e.keyStatuses.size){var r=Ce(e,t,n),a=r.warning,o=r.blacklistedKeyIds,s=r.whitelistedKeyIds;void 0!==a&&(i.onWarning(a),d.isUsed())||i.onKeyUpdate({whitelistedKeyIds:s,blacklistedKeyIds:o})}}}function Le(e){if(e instanceof Ve)return new g.Z("KEY_LOAD_TIMEOUT","The license server took too much time to respond.");var t=new g.Z("KEY_LOAD_ERROR","An error occured when calling `getLicense`.");return!(0,T.Z)(e)&&(0,de.Z)(e.message)&&(t.message=e.message),t}function Ue(e,t){return Be.apply(this,arguments)}function Be(){return(Be=(0,r.Z)(o().mark((function e(t,n){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u.Z.info("DRM: Updating MediaKeySession with message"),e.prev=1,e.next=4,t.update(n);case 4:e.next=10;break;case 6:throw e.prev=6,e.t0=e.catch(1),r=e.t0 instanceof Error?e.t0.toString():"`session.update` failed",new g.Z("KEY_UPDATE_ERROR",r);case 10:u.Z.info("DRM: MediaKeySession update succeeded.");case 11:case"end":return e.stop()}}),e,null,[[1,6]])})))).apply(this,arguments)}var Fe=function(e){function t(n){var r;return r=e.call(this)||this,Object.setPrototypeOf((0,we.Z)(r),t.prototype),r.sessionError=n,r}return(0,i.Z)(t,e),t}((0,Ae.Z)(Error)),Ve=function(e){function t(t){var n;return n=e.call(this)||this,Object.setPrototypeOf((0,we.Z)(n),Fe.prototype),n.message=t,n}return(0,i.Z)(t,e),t}((0,Ae.Z)(Error)),ze=n(9822);function Ke(e,t){return Ge.apply(this,arguments)}function Ge(){return(Ge=(0,r.Z)(o().mark((function e(t,n){var r,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t.setServerCertificate(n);case 3:return r=e.sent,e.abrupt("return",r);case 7:throw e.prev=7,e.t0=e.catch(0),u.Z.warn("DRM: mediaKeys.setServerCertificate returned an error",e.t0 instanceof Error?e.t0:""),i=e.t0 instanceof Error?e.t0.toString():"`setServerCertificate` error",new g.Z("LICENSE_SERVER_CERTIFICATE_ERROR",i);case 12:case"end":return e.stop()}}),e,null,[[0,7]])})))).apply(this,arguments)}function We(e,t){return He.apply(this,arguments)}function He(){return(He=(0,r.Z)(o().mark((function e(t,n){var r,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!0!==ye.hasOne(t)){e.next=3;break}return u.Z.info("DRM: The MediaKeys already has a server certificate, skipping..."),e.abrupt("return",{type:"already-has-one"});case 3:if("function"==typeof t.setServerCertificate){e.next=6;break}return u.Z.warn("DRM: Could not set the server certificate. mediaKeys.setServerCertificate is not a function"),e.abrupt("return",{type:"method-not-implemented"});case 6:return u.Z.info("DRM: Setting server certificate on the MediaKeys"),ye.prepare(t),e.prev=8,e.next=11,Ke(t,n);case 11:return r=e.sent,ye.set(t,n),e.abrupt("return",{type:"success",value:r});case 16:return e.prev=16,e.t0=e.catch(8),i=(0,ze.Z)(e.t0)?e.t0:new g.Z("LICENSE_SERVER_CERTIFICATE_ERROR","Unknown error when setting the server certificate."),e.abrupt("return",{type:"error",value:i});case 20:case"end":return e.stop()}}),e,null,[[8,16]])})))).apply(this,arguments)}function je(e,t){if(!(isNaN(t)||t<0||t>=e.getLength())){var n=e.getLength(),r=n-t;u.Z.info("DRM: Too many stored persistent sessions, removing some.",n,r),e.deleteOldSessions(r)}}var qe=n(9252);var Ye=function(){function e(e){this._innerValues=e,this._lazyFormattedValues=null}var t=e.prototype;return t.constructRequestData=function(){return c.zo.apply(void 0,this._innerValues.map((function(e){return e.data})))},t.isCompatibleWith=function(t){var n=t instanceof e?t.getFormattedValues():t;return fe(this.getFormattedValues(),n)},t.getFormattedValues=function(){return null===this._lazyFormattedValues&&(this._lazyFormattedValues=this._innerValues.slice().sort((function(e,t){return e.systemId===t.systemId?0:void 0===e.systemId?1:void 0===t.systemId||e.systemId=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Qe(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0&&K._currentSessions.splice(r),void 0!==t.content&&nt(t.content.manifest,[],[],N.record.getAssociatedKeyIds()),null===(n=i.persistentSessionsStore)||void 0===n||n.delete(L.sessionId),i.loadedSessionsStore.closeSession(L).catch((function(e){var t=e instanceof Error?e:"unknown error";u.Z.warn("DRM: failed to close expired session",t)})).then((function(){return K._unlockInitDataQueue()})).catch((function(e){return K._onFatalError(e)})),void(K._isStopped()||K.trigger("warning",e.reason))}if(e instanceof Fe){if(N.blacklistedSessionError=e,void 0!==t.content){var a=t.content.manifest;u.Z.info("DRM: blacklisting Representations based on protection data."),rt(a,t)}K._unlockInitDataQueue()}else K._onFatalError(e)}},this._canceller.signal),void 0!==a.singleLicensePer&&"init-data"!==a.singleLicensePer||this._unlockInitDataQueue(),"created-session"!==P.type){e.next=67;break}return F=t.values.constructRequestData(),e.prev=54,e.next=57,i.loadedSessionsStore.generateLicenseRequest(L,t.type,F);case 57:e.next=67;break;case 59:if(e.prev=59,e.t0=e.catch(54),null!==(V=i.loadedSessionsStore.getEntryForSession(L))&&"none"===V.closingStatus.type){e.next=66;break}return(z=this._currentSessions.indexOf(N))>=0&&this._currentSessions.splice(z,1),e.abrupt("return",Promise.resolve());case 66:throw new g.Z("KEY_GENERATE_REQUEST_ERROR",e.t0 instanceof Error?e.t0.toString():"Unknown error");case 67:return e.abrupt("return",Promise.resolve());case 68:case"end":return e.stop()}}),e,this,[[54,59]])})));return function(t,n){return e.apply(this,arguments)}}(),n._tryToUseAlreadyCreatedSession=function(e,t){var n=t.stores,r=t.options,i=(0,_.Z)(this._currentSessions,(function(t){return t.record.isCompatibleWith(e)}));if(void 0===i)return!1;var a=i.blacklistedSessionError;if(!(0,T.Z)(a))return void 0===e.type||void 0===e.content?(u.Z.error("DRM: This initialization data has already been blacklisted but the current content is not known."),!0):(u.Z.info("DRM: This initialization data has already been blacklisted. Blacklisting the related content."),rt(e.content.manifest,e),!0);if(void 0!==e.keyIds){var o;if(void 0===r.singleLicensePer||"init-data"===r.singleLicensePer){var s=i.keyStatuses.blacklisted;o=function(e,t){for(var n,r=function(){var e=n.value;if(t.some((function(t){return Q(t,e)})))return{v:!0}},i=Y(e);!(n=i()).done;){var a=r();if("object"==typeof a)return a.v}return!1}(e.keyIds,s)}else{var l=i.keyStatuses.whitelisted;o=!J(e.keyIds,l)}if(o)return void 0===e.content?(u.Z.error("DRM: Cannot forbid key id, the content is unknown."),!0):(u.Z.info("DRM: Current initialization data is linked to blacklisted keys. Marking Representations as not decipherable"),nt(e.content.manifest,[],e.keyIds,[]),!0)}if(null!==n.loadedSessionsStore.reuse(e))return u.Z.debug("DRM: Init data already processed. Skipping it."),!0;var d=this._currentSessions.indexOf(i);return-1===d?u.Z.error("DRM: Unable to remove processed init data: not found."):(u.Z.debug("DRM: A session from a processed init data is not available anymore. Re-processing it."),this._currentSessions.splice(d,1)),!1},n._onFatalError=function(e){if(!this._canceller.isUsed()){var t=e instanceof Error?e:new y.Z("NONE","Unknown decryption error");this.error=t,this._initDataQueue.length=0,this._stateData={state:$e.Error,isMediaKeysAttached:void 0,isInitDataQueueLocked:void 0,data:null},this._canceller.cancel(),this.trigger("error",t),this._stateData.state===$e.Error&&this.trigger("stateChange",this._stateData.state)}},n._isStopped=function(){return this._stateData.state===$e.Disposed||this._stateData.state===$e.Error},n._processCurrentInitDataQueue=function(){for(;!1===this._stateData.isInitDataQueueLocked;){var e=this._initDataQueue.shift();if(void 0===e)return;this.onInitializationData(e)}},n._lockInitDataQueue=function(){!1===this._stateData.isInitDataQueueLocked&&(this._stateData.isInitDataQueueLocked=!0)},n._unlockInitDataQueue=function(){!0===this._stateData.isMediaKeysAttached?(this._stateData.isInitDataQueueLocked=!1,this._processCurrentInitDataQueue()):u.Z.error("DRM: Trying to unlock in the wrong state")},t}(S.Z);function tt(e){var t=e.getConfiguration().sessionTypes;return void 0!==t&&(0,b.Z)(t,"persistent-license")}function nt(e,t,n,r){e.updateRepresentationsDeciperability((function(e){if(void 0===e.contentProtections)return e.decipherable;var i=e.contentProtections.keyIds;if(void 0!==i)for(var a,o=Xe(i);!(a=o()).done;){for(var s,u=a.value,l=Xe(n);!(s=l()).done;){if(Q(s.value,u.keyId))return!1}for(var d,c=Xe(t);!(d=c()).done;){if(Q(d.value,u.keyId))return!0}for(var f,v=Xe(r);!(f=v()).done;){if(Q(f.value,u.keyId))return}}return e.decipherable}))}function rt(e,t){e.updateRepresentationsDeciperability((function(e){var n,r;if(!1===e.decipherable)return!1;for(var i,a=function(){var e=i.value;if((void 0===t.type||e.type===t.type)&&t.values.getFormattedValues().every((function(t){return e.values.some((function(e){return(void 0===t.systemId||e.systemId===t.systemId)&&(0,d.Z)(e.data,t.data)}))})))return{v:!1}},o=Xe(null!==(r=null===(n=e.contentProtections)||void 0===n?void 0:n.initData)&&void 0!==r?r:[]);!(i=o()).done;){var s=a();if("object"==typeof s)return s.v}return e.decipherable}))}function it(e,t,n,r,i,a){for(var o,s,l=[].concat(i,a),d=function(){var e=s.value;l.some((function(t){return Q(t,e)}))||(u.Z.hasLevel("DEBUG")&&u.Z.debug("DRM: KeySessionRecord's key missing in the license, blacklisting it",(0,f.ci)(e)),l.push(e))},c=Xe(t.getAssociatedKeyIds());!(s=c()).done;)d();if(void 0!==n&&"init-data"!==n){var v=e.keyIds,p=e.content;if(void 0!==v){var h=v.filter((function(e){return!l.some((function(t){return Q(t,e)}))}));h.length>0&&(u.Z.hasLevel("DEBUG")&&u.Z.debug("DRM: init data keys missing in the license, blacklisting them",h.map((function(e){return(0,f.ci)(e)})).join(", ")),l.push.apply(l,h))}if(r&&void 0!==p)if("content"===n){for(var m,g=new Set,y=Xe(p.manifest.periods);!(m=y()).done;){ot(g,m.value)}at(g,l)}else if("periods"===n)for(var _,b=Xe(p.manifest.periods);!(_=b()).done;){var S=_.value,T=new Set;if(ot(T,S),(null===(o=e.content)||void 0===o?void 0:o.period.id)===S.id)at(T,l);else for(var E=Array.from(T),k=function(){var e=A[w];if(l.some((function(t){return Q(t,e)})))return at(T,l),"break"},w=0,A=E;w=100?n:r<=0?0:n*(+r/100)}return 0}(e,s);return a.Z.debug("Init: Initial time calculated:",t),t}),o,(function(e){return n.trigger("warning",e)}),r).autoPlayResult.then((function(){return(0,l.Z)(t,e,!0,r).onUpdate((function(e,t){e&&(t(),n.trigger("loaded",{segmentBuffersStore:null}))}),{emitCurrentValue:!0,clearSignal:r})})).catch((function(e){r.isCancelled()||n._onFatalError(e)}))},t}(u.K)},379:function(e,t,n){"use strict";n.d(t,{K:function(){return i}});var r=n(4578),i=function(e){function t(){return e.apply(this,arguments)||this}return(0,r.Z)(t,e),t}(n(1959).Z)},1757:function(e,t,n){"use strict";n.d(t,{Z:function(){return s}});var r=n(3666);var i=n(1669),a=n(5095),o=n(288);function s(e,t,n,s){var u=new o.ZP;u.linkToSignal(s);var l=(0,a.ZP)(!1,u.signal);return e.listen((function(e){if(null===e.rebuffering&&null===e.freezing&&0!==e.readyState)return!function(e,t){return!e||!r.SB||t}(n,t.hasAttribute("playsinline"))&&t.duration>0||e.readyState>=3&&null!==e.currentRange&&(!(0,i.Z)()||t.duration>0)?(l.setValue(!0),void u.cancel()):void 0}),{includeLastObservation:!0,clearSignal:u.signal}),l}},8833:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r=n(1669),i=n(3774),a=n(3714),o=n(3887),s=n(5095);function u(e,t,n,u,l,d){var c,f,v=new Promise((function(e,t){c=e,f=t})),p=(0,s.$l)(!1,d),h=(0,s.$l)(!1,d);e.addEventListener("loadedmetadata",g),e.readyState>=i.c.HAVE_METADATA&&g();var m=d.register((function(t){e.removeEventListener("loadedmetadata",g),f(t)}));return{autoPlayResult:v,initialPlayPerformed:h,initialSeekPerformed:p};function g(){e.removeEventListener("loadedmetadata",g);var i="function"==typeof n?n():n;if(o.Z.info("Init: Set initial time",i),t.setCurrentTime(i),p.setValue(!0),p.finish(),(0,r.Z)()&&0===e.duration){var s=new a.Z("MEDIA_ERR_NOT_LOADED_METADATA","Cannot load automatically: your browser falsely announced having loaded the content.");l(s)}d.isCancelled()||t.listen((function(t,n){!t.seeking&&null===t.rebuffering&&t.readyState>=1&&(n(),function(){var t,n;if(o.Z.info("Init: Can begin to play content"),!u)return e.autoplay&&o.Z.warn("Init: autoplay is enabled on HTML media element. Media will play as soon as possible."),h.setValue(!0),h.finish(),m(),c({type:"skipped"});try{n=null!==(t=e.play())&&void 0!==t?t:Promise.resolve()}catch(e){return m(),f(e)}n.then((function(){if(!d.isCancelled())return h.setValue(!0),h.finish(),m(),c({type:"autoplay"})})).catch((function(e){if(m(),!d.isCancelled()){if(e instanceof Error&&"NotAllowedError"===e.name){o.Z.warn("Init: Media element can't play. It may be due to browser auto-play policies.");var t=new a.Z("MEDIA_ERR_BLOCKED_AUTOPLAY","Cannot trigger auto-play automatically: your browser does not allow it.");if(l(t),d.isCancelled())return;return c({type:"autoplay-blocked"})}f(e)}}))}())}),{includeLastObservation:!0,clearSignal:d})}}},8799:function(e,t,n){"use strict";n.d(t,{Z:function(){return d}});var r=n(6139);var i=n(5157),a=n(3887),o=n(5095),s=n(288),u=n(1266),l=n(1960);function d(e,t,n,d,c){if(0===t.length){n.onUpdate((function(e,t){if(null!==e){t(),a.Z.error("Init: Encrypted event but EME feature not activated");var n=new i.Z("MEDIA_IS_ENCRYPTED_ERROR","EME feature not activated.");d.onError(n)}}),{clearSignal:c});var f=(0,o.ZP)({initializationState:{type:"initialized",value:null},drmSystemId:void 0});return f.finish(),f}if("function"!=typeof r.N){n.onUpdate((function(e,t){if(null!==e){t(),a.Z.error("Init: Encrypted event but no EME API available");var n=new i.Z("MEDIA_IS_ENCRYPTED_ERROR","Encryption APIs not found.");d.onError(n)}}),{clearSignal:c});var v=(0,o.ZP)({initializationState:{type:"initialized",value:null},drmSystemId:void 0});return v.finish(),v}var p=new s.ZP;p.linkToSignal(c);var h=(0,o.ZP)({initializationState:{type:"uninitialized",value:null},drmSystemId:void 0},c);a.Z.debug("Init: Creating ContentDecryptor");var m=new u.ZP(e,t);return m.addEventListener("stateChange",(function(e){if(e===l.u.WaitingForAttachment){var t=(0,o.ZP)(!1);t.onUpdate((function(t,n){t&&(n(),e===l.u.WaitingForAttachment&&m.attach())}),{clearSignal:p.signal}),h.setValue({initializationState:{type:"awaiting-media-link",value:{isMediaLinked:t}},drmSystemId:m.systemId})}else e===l.u.ReadyForContent&&(h.setValue({initializationState:{type:"initialized",value:null},drmSystemId:m.systemId}),m.removeEventListener("stateChange"))})),m.addEventListener("error",(function(e){p.cancel(),d.onError(e)})),m.addEventListener("warning",(function(e){d.onWarning(e)})),n.onUpdate((function(e){null!==e&&m.onInitializationData(e)}),{clearSignal:p.signal}),p.signal.register((function(){m.dispose()})),h}},6199:function(e,t,n){"use strict";n.d(t,{Z:function(){return f}});var r=n(4578),i=n(3666).yS,a=n(6872),o=n(3714),s=n(3887),u=n(1959),l=n(2829),d=n(288),c=1/60,f=function(e){function t(t,n,r){var i;return(i=e.call(this)||this)._playbackObserver=t,i._manifest=n,i._speed=r,i._discontinuitiesStore=[],i._isStarted=!1,i._canceller=new d.ZP,i}(0,r.Z)(t,e);var n=t.prototype;return n.start=function(){var e=this;if(!this._isStarted){var t;this._isStarted=!0;var n=null,r=new h(this._playbackObserver,this._speed);this._canceller.signal.register((function(){r.dispose()}));var o=null;this._playbackObserver.listen((function(u){var d,f,v=e._discontinuitiesStore,h=u.buffered,m=u.position,g=u.readyState,y=u.rebuffering,_=u.freezing,b=a.Z.getCurrent(),S=b.BUFFER_DISCONTINUITY_THRESHOLD,T=b.FORCE_DISCONTINUITY_SEEK_DELAY,E=b.FREEZING_STALLED_DELAY,k=b.UNFREEZING_SEEK_DELAY,w=b.UNFREEZING_DELTA_POSITION;if(!u.seeking&&i&&null===n&&null!==t&&u.positionk&&(s.Z.warn("Init: trying to seek to un-freeze player"),e._playbackObserver.setCurrentTime(e._playbackObserver.getCurrentTime()+w),o={attemptTimestamp:I}),I-_.timestamp>E)return null===y||null!==n?r.stopRebuffering():r.startRebuffering(),void e.trigger("stalled","freezing")}else o=null;if(null===y)return r.stopRebuffering(),1===g?(f=u.seeking?null!==u.pendingInternalSeek?"internal-seek":"seeking":"not-ready",void e.trigger("stalled",f)):void e.trigger("unstalled",null);var Z="seeking"===y.reason&&null!==u.pendingInternalSeek?"internal-seek":y.reason;if(null!==n){var R=performance.now();if(R-n0){var M=function(e,t,n){if(0===e.length)return null;for(var r=null,i=0;in)return r;var o=void 0;if(void 0===a.end||a.end>n){var u=e[i],l=u.discontinuity,d=u.position,f=l.start,v=l.end;if(n>=(null!=f?f:d)-c)if(null===v){var p=t.getPeriodAfter(a);null!==p?o=p.start+c:s.Z.warn("Init: discontinuity at Period's end but no next Period")}else no?r:o)}}return r}(v,e._manifest,x);if(null!==M){var C=M+.001;if(!(C<=e._playbackObserver.getCurrentTime()))return s.Z.warn("SA: skippable discontinuity found in the stream",m,C),e._playbackObserver.setCurrentTime(C),void e.trigger("warning",p(x,C));s.Z.info("Init: position to seek already reached, no seeking",e._playbackObserver.getCurrentTime(),C)}}var P=null!=x?x:m,D=(0,l.XS)(h,P);if(e._speed.getValue()>0&&D=0;O--){var L=e._manifest.periods[O];if(void 0!==L.end&&L.end<=P){if(e._manifest.periods[O+1].start>P&&e._manifest.periods[O+1].start>e._playbackObserver.getCurrentTime()){var U=e._manifest.periods[O+1];return e._playbackObserver.setCurrentTime(U.start),void e.trigger("warning",p(P,U.start))}break}}e.trigger("stalled",Z)}else e.trigger("stalled",Z)}),{includeLastObservation:!0,clearSignal:this._canceller.signal})}},n.updateDiscontinuityInfo=function(e){this._isStarted||this.start();var t=this._playbackObserver.getReference().getValue();!function(e,t,n){for(;e.length>0&&void 0!==e[0].period.end&&e[0].period.end+10r.start)return void(v(t)&&e.splice(a,0,t));v(t)&&e.push(t)}(this._discontinuitiesStore,e,t)},n.onLockedStream=function(e,t){var n;this._isStarted||this.start();var r=this._playbackObserver.getReference().getValue();if(!(!r.rebuffering||r.paused||this._speed.getValue()<=0||"audio"!==e&&"video"!==e)){var i=r.position,a=null!==(n=r.rebuffering.position)&&void 0!==n?n:i,o=t.start;i=0;n--){if(e[n].startt)return e.slice(n,e.length)}return[]}function m(e,t,n){var r=Math.max(e.start,t),i=p(e.cues,t),a={start:e.start,end:r,cues:i},o=Math.min(n,e.end),s=h(e.cues,n);return[a,{start:o,end:e.end,cues:s}]}var g=function(){function e(){this._cuesBuffer=[]}var t=e.prototype;return t.get=function(e){for(var t=this._cuesBuffer,n=[],r=t.length-1;r>=0;r--){var i=t[r];if(e=i.start){for(var a=i.cues,o=0;o=a[o].start&&ee){var a=r[i];if(a.start>=n)return;if(a.end>=n){if(e<=a.start)a.cues=h(a.cues,n),a.start=n;else{var o=m(a,e,n),s=o[0],u=o[1];this._cuesBuffer[i]=s,r.splice(i+1,0,u)}return}a.start>=e?(r.splice(i,1),i--):(a.cues=p(a.cues,e),a.end=Math.max(e,a.start))}},t.insert=function(e,t,n){var r=this._cuesBuffer,i={start:t,end:n,cues:e};function a(e){var t=r[e];void 0===t||v(i.end,t.end)?r[e]=i:(t.start>=i.end||(t.cues=h(t.cues,i.end),t.start=i.end),r.splice(e,0,i))}for(var o=0;os.end);return void a(o)}if(ts.end);return void a(o)}if(v(s.end,n))return s.cues=p(s.cues,t),s.end=t,void r.splice(o+1,0,i);if(s.end>n){var u=m(s,t,n),l=u[0],d=u[1];return this._cuesBuffer[o]=l,r.splice(o+1,0,i),void r.splice(o+2,0,d)}s.cues=p(s.cues,t),s.end=t;var c=o+1;for(s=r[c];void 0!==s&&n>s.end;)r.splice(c,1),s=r[c];return void a(c)}}r.push(i)},e}();function y(e,t,n,r){for(var i=[t/n.columns,e/n.rows],a=r.getElementsByClassName("proportional-style"),o=0;o0}var _=i.M4,b=i.bQ,S=i.Q$;function T(e,t){try{e.removeChild(t)}catch(e){a.Z.warn("HTSB: Can't remove text track: not in the element.")}}function E(e){var t=e.getAttribute("data-resolution-rows"),n=e.getAttribute("data-resolution-columns");if(null===t||null===n)return null;var r=parseInt(t,10),i=parseInt(n,10);return null===r||null===i?null:{rows:r,columns:i}}var k=function(e){function t(t,n){var r;return a.Z.debug("HTSB: Creating HTMLTextSegmentBuffer"),(r=e.call(this)||this).bufferType="text",r._buffered=new c.Z,r._videoElement=t,r._textTrackElement=n,r._sizeUpdateCanceller=new l.ZP,r._canceller=new l.ZP,r._buffer=new g,r._currentCues=[],r.autoRefreshSubtitles(r._canceller.signal),r}(0,r.Z)(t,e);var n=t.prototype;return n.pushChunk=function(e){try{this.pushChunkSync(e)}catch(e){return Promise.reject(e)}return Promise.resolve()},n.removeBuffer=function(e,t){return this.removeBufferSync(e,t),Promise.resolve()},n.endOfSegment=function(e){return this._segmentInventory.completeSegment(e,this._buffered),Promise.resolve()},n.getBufferedRanges=function(){return this._buffered},n.dispose=function(){a.Z.debug("HTSB: Disposing HTMLTextSegmentBuffer"),this._disableCurrentCues(),this._buffer.remove(0,1/0),this._buffered.remove(0,1/0),this._canceller.cancel()},n.pushChunkSync=function(e){var t,n;a.Z.debug("HTSB: Appending new html text tracks");var r=e.data,i=r.timestampOffset,o=r.appendWindow,s=r.chunk;if(null!==s){var u,l,d=s.start,c=s.end,v=s.data,p=s.type,h=s.language,m=null!==(t=o[0])&&void 0!==t?t:0,g=null!==(n=o[1])&&void 0!==n?n:1/0,y=function(e,t,n,r){a.Z.debug("HTSB: Finding parser for html text tracks:",e);var i=f.Z.htmlTextTracksParsers[e];if("function"!=typeof i)throw new Error("no parser found for the given text track");a.Z.debug("HTSB: Parser found, parsing...");var o=i(t,n,r);return a.Z.debug("HTTB: Parsed successfully!",o.length),o}(p,v,i,h);if(0!==m&&g!==1/0){for(var _=0;_=0&&y[_].start>=g;)_--;for(y.splice(_,y.length),_=y.length-1;_>=0&&y[_].end>g;)y[_].end=g,_--}if(void 0!==d)u=Math.max(m,d);else{if(y.length<=0)return void a.Z.warn("HTSB: Current text tracks have no cues nor start time. Aborting");a.Z.warn("HTSB: No start time given. Guessing from cues."),u=y[0].start}if(void 0!==c)l=Math.min(g,c);else{if(y.length<=0)return void a.Z.warn("HTSB: Current text tracks have no cues nor end time. Aborting");a.Z.warn("HTSB: No end time given. Guessing from cues."),l=y[y.length-1].end}l<=u?a.Z.warn("HTSB: Invalid text track appended: ","the start time is inferior or equal to the end time."):(null!==e.inventoryInfos&&this._segmentInventory.insertChunk(e.inventoryInfos),this._buffer.insert(y,u,l),this._buffered.insert(u,l))}},n.removeBufferSync=function(e,t){a.Z.debug("HTSB: Removing html text track data",e,t),this._buffer.remove(e,t),this._buffered.remove(e,t)},n._disableCurrentCues=function(){if(this._sizeUpdateCanceller.cancel(),this._currentCues.length>0){for(var e=0;e0){this._sizeUpdateCanceller=new l.ZP,this._sizeUpdateCanceller.linkToSignal(this._canceller.signal);var c=u.Z.getCurrent().TEXT_TRACK_SIZE_CHECKS_INTERVAL,f=function(e,t,n){var r=e.getBoundingClientRect(),i=r.height,u=r.width,l=(0,o.ZP)({height:i,width:u},n),d=i,c=u;if(void 0!==s){var f=new s((function(e){if(0!==e.length){var t=e[0].contentRect,n=t.height,r=t.width;n===d&&r===c||(d=n,c=r,l.setValue({height:n,width:r}))}else a.Z.error("Compat: Resized but no observed element.")}));f.observe(e),n.register((function(){f.disconnect()}))}else{var v=setInterval((function(){var t=e.getBoundingClientRect(),n=t.height,r=t.width;n===d&&r===c||(d=n,c=r,l.setValue({height:n,width:r}))}),t);n.register((function(){clearInterval(v)}))}return l}(this._textTrackElement,c,this._sizeUpdateCanceller.signal);f.onUpdate((function(e){for(var t=e.height,n=e.width,r=0;r0?e.textTracks[u-1]:e.addTextTrack(s)).mode=t?null!==(n=a.HIDDEN)&&void 0!==n?n:"hidden":null!==(r=a.SHOWING)&&void 0!==r?r:"showing"}else o=document.createElement("track"),e.appendChild(o),a=o.track,o.kind=s,a.mode=t?"hidden":"showing";return{track:a,trackElement:o}}(t,n),s=o.track,l=o.trackElement;return r.bufferType="text",r._buffered=new u.Z,r._videoElement=t,r._track=s,r._trackElement=l,r}(0,r.Z)(t,e);var n=t.prototype;return n.pushChunk=function(e){var t,n;if(a.Z.debug("NTSB: Appending new native text tracks"),null===e.data.chunk)return Promise.resolve();var r=e.data,i=r.timestampOffset,o=r.appendWindow,s=r.chunk,u=s.start,d=s.end,c=s.data,f=s.type,v=s.language,p=null!==(t=o[0])&&void 0!==t?t:0,h=null!==(n=o[1])&&void 0!==n?n:1/0;try{var m,g,y=function(e,t,n,r){a.Z.debug("NTSB: Finding parser for native text tracks:",e);var i=l.Z.nativeTextTracksParsers[e];if("function"!=typeof i)throw new Error("no parser found for the given text track");a.Z.debug("NTSB: Parser found, parsing...");var o=i(t,n,r);return a.Z.debug("NTSB: Parsed successfully!",o.length),o}(f,c,i,v);if(0!==p&&h!==1/0){for(var _=0;_=0&&y[_].startTime>=h;)_--;for(y.splice(_,y.length),_=y.length-1;_>=0&&y[_].endTime>h;)y[_].endTime=h,_--}if(void 0!==u)m=Math.max(p,u);else{if(y.length<=0)return a.Z.warn("NTSB: Current text tracks have no cues nor start time. Aborting"),Promise.resolve();a.Z.warn("NTSB: No start time given. Guessing from cues."),m=y[0].startTime}if(void 0!==d)g=Math.min(h,d);else{if(y.length<=0)return a.Z.warn("NTSB: Current text tracks have no cues nor end time. Aborting"),Promise.resolve();a.Z.warn("NTSB: No end time given. Guessing from cues."),g=y[y.length-1].endTime}if(g<=m)return a.Z.warn("NTSB: Invalid text track appended: ","the start time is inferior or equal to the end time."),Promise.resolve();if(y.length>0){var b=y[0],S=this._track.cues;null!==S&&S.length>0&&b.startTime=0;i--){var s=r[i],u=s.startTime,l=s.endTime;u>=e&&u<=t&&l<=t&&o(n,s)}this._buffered.remove(e,t)},t}(s.C)},9612:function(e,t,n){"use strict";n.d(t,{C:function(){return _},f:function(){return g}});var r=n(6872),i=n(3887),a=n(520),o=n(5278);function s(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return u(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&(this._history=this._history.splice(r)),this._history.length>this._maxHistoryLength){var a=this._history.length-this._maxHistoryLength;this._history=this._history.splice(a)}},e}();function d(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return c(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return c(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0){var _=t[p+y-1];g={end:(0,o.Z)(_.bufferedEnd,_.end),precizeEnd:_.precizeEnd},i.Z.debug("SI: "+y+" segments GCed.",u);for(var b,S=d(t.splice(p,y));!(b=S()).done;){var T=b.value;void 0===T.bufferedStart&&void 0===T.bufferedEnd&&this._bufferedHistory.addBufferedSegment(T.infos,null)}n=p}if(void 0===a)return;if(v-(0,o.Z)(a.bufferedStart,a.start)>=s){if(h(a,f,g,u),n===t.length-1)return void m(a,v,u);a=t[++n];for(var E=(0,o.Z)(a.bufferedStart,a.start),k=(0,o.Z)(a.bufferedEnd,a.end),w=c=s&&(void 0===w||v-E>=k-w);){var A=t[n-1];void 0===A.bufferedEnd&&(A.bufferedEnd=a.precizeStart?a.start:A.end,i.Z.debug("SI: calculating buffered end of contiguous segment",u,A.bufferedEnd,A.end)),a.bufferedStart=A.bufferedEnd,void 0!==(a=t[++n])&&(E=(0,o.Z)(a.bufferedStart,a.start),k=(0,o.Z)(a.bufferedEnd,a.end))}}var I=t[n-1];void 0!==I&&m(I,v,u)}}if(null!=a){i.Z.debug("SI: last segments have been GCed",u,n,t.length);for(var Z,R=d(t.splice(n,t.length-n));!(Z=R()).done;){var x=Z.value;void 0===x.bufferedStart&&void 0===x.bufferedEnd&&this._bufferedHistory.addBufferedSegment(x.infos,null)}}void 0!==u&&i.Z.hasLevel("DEBUG")&&i.Z.debug("SI: current "+u+" inventory timeline:\n"+function(e){var t=1/60,n={},r=[],i=null,a=null;function o(e){var t=String.fromCharCode(r.length+65);return r.push({letter:t,periodId:e.period.id,representationId:e.representation.id,bitrate:e.representation.bitrate}),t}for(var s="",u=0;u=u)i.Z.warn("SI: Invalid chunked inserted: starts before it ends",l,s,u);else{for(var d=this._inventory,c={partiallyPushed:!0,chunkSize:o,splitted:!1,start:s,end:u,precizeStart:!1,precizeEnd:!1,bufferedStart:void 0,bufferedEnd:void 0,infos:{segment:a,period:t,adaptation:n,representation:r}},f=d.length-1;f>=0;f--){var v=d[f];if(v.start<=s){if(v.end<=s){for(i.Z.debug("SI: Pushing segment strictly after previous one.",l,s,v.end),this._inventory.splice(f+1,0,c),f+=2;fc.end)return i.Z.debug("SI: Segment pushed updates the start of the next one",l,c.end,d[f].start),d[f].start=c.end,d[f].bufferedStart=void 0,void(d[f].precizeStart=d[f].precizeStart&&c.precizeEnd);i.Z.debug("SI: Segment pushed removes the next one",l,s,u,d[f].start,d[f].end),d.splice(f,1)}return}if(v.start===s){if(v.end<=u){for(i.Z.debug("SI: Segment pushed replace another one",l,s,u,v.end),this._inventory.splice(f,1,c),f+=1;fc.end)return i.Z.debug("SI: Segment pushed updates the start of the next one",l,c.end,d[f].start),d[f].start=c.end,d[f].bufferedStart=void 0,void(d[f].precizeStart=d[f].precizeStart&&c.precizeEnd);i.Z.debug("SI: Segment pushed removes the next one",l,s,u,d[f].start,d[f].end),d.splice(f,1)}return}return i.Z.debug("SI: Segment pushed ends before another with the same start",l,s,u,v.end),d.splice(f,0,c),v.start=c.end,v.bufferedStart=void 0,void(v.precizeStart=v.precizeStart&&c.precizeEnd)}if(v.end<=c.end){for(i.Z.debug("SI: Segment pushed updates end of previous one",l,s,u,v.start,v.end),this._inventory.splice(f+1,0,c),v.end=c.start,v.bufferedEnd=void 0,v.precizeEnd=v.precizeEnd&&c.precizeStart,f+=2;fc.end)return i.Z.debug("SI: Segment pushed updates the start of the next one",l,c.end,d[f].start),d[f].start=c.end,d[f].bufferedStart=void 0,void(d[f].precizeStart=d[f].precizeStart&&c.precizeEnd);i.Z.debug("SI: Segment pushed removes the next one",l,s,u,d[f].start,d[f].end),d.splice(f,1)}return}i.Z.warn("SI: Segment pushed is contained in a previous one",l,s,u,v.start,v.end);var p={partiallyPushed:v.partiallyPushed,chunkSize:v.chunkSize,splitted:!0,start:c.end,end:v.end,precizeStart:v.precizeStart&&v.precizeEnd&&c.precizeEnd,precizeEnd:v.precizeEnd,bufferedStart:void 0,bufferedEnd:v.end,infos:v.infos};return v.end=c.start,v.splitted=!0,v.bufferedEnd=void 0,v.precizeEnd=v.precizeEnd&&c.precizeStart,d.splice(f+1,0,c),void d.splice(f+2,0,p)}}var h=this._inventory[0];if(void 0===h)return i.Z.debug("SI: first segment pushed",l,s,u),void this._inventory.push(c);if(!(h.start>=u)){if(h.end<=u){for(i.Z.debug("SI: Segment pushed starts before and completely recovers the previous first one",l,s,u,h.start,h.end),this._inventory.splice(0,1,c);d.length>1&&d[1].startc.end)return i.Z.debug("SI: Segment pushed updates the start of the next one",l,c.end,d[1].start),d[1].start=c.end,d[1].bufferedStart=void 0,void(d[1].precizeStart=c.precizeEnd);i.Z.debug("SI: Segment pushed removes the next one",l,s,u,d[1].start,d[1].end),d.splice(1,1)}return}return i.Z.debug("SI: Segment pushed start of the next one",l,s,u,h.start,h.end),h.start=u,h.bufferedStart=void 0,h.precizeStart=c.precizeEnd,void this._inventory.splice(0,0,c)}i.Z.debug("SI: Segment pushed comes before all previous ones",l,s,u,h.start),this._inventory.splice(0,0,c)}}},t.completeSegment=function(e,t){if(!e.segment.isInit){for(var n=this._inventory,r=[],o=0;o0&&(s=!0,1===r.length&&(i.Z.warn("SI: Completed Segment is splitted.",e.segment.id,e.segment.time,e.segment.end),r[0].splitted=!0));var u=o,l=n[o].chunkSize;for(o+=1;o0&&(this._inventory.splice(u+1,v),o-=v),this._inventory[u].partiallyPushed=!1,this._inventory[u].chunkSize=l,this._inventory[u].end=p,this._inventory[u].bufferedEnd=h,this._inventory[u].splitted=s,r.push(this._inventory[u])}if(0===r.length)i.Z.warn("SI: Completed Segment not found",e.segment.id,e.segment.time);else{this.synchronizeBuffered(t);for(var m,g=d(r);!(m=g()).done;){var y=m.value;void 0!==y.bufferedStart&&void 0!==y.bufferedEnd?this._bufferedHistory.addBufferedSegment(y.infos,{start:y.bufferedStart,end:y.bufferedEnd}):i.Z.debug("SI: buffered range not known after sync. Skipping history.",y.start,y.end)}}}},t.getInventory=function(){return this._inventory},t.getHistoryFor=function(e){return this._bufferedHistory.getHistoryFor(e)},e}();function v(e){if(void 0===e.bufferedStart||e.partiallyPushed)return!1;var t=e.start,n=e.end-t,i=r.Z.getCurrent(),a=i.MAX_MANIFEST_BUFFERED_START_END_DIFFERENCE,o=i.MAX_MANIFEST_BUFFERED_DURATION_DIFFERENCE;return Math.abs(t-e.bufferedStart)<=a&&(void 0===e.bufferedEnd||e.bufferedEnd>e.bufferedStart&&Math.abs(e.bufferedEnd-e.bufferedStart-n)<=Math.min(o,n/3))}function p(e){if(void 0===e.bufferedEnd||e.partiallyPushed)return!1;var t=e.start,n=e.end,i=n-t,a=r.Z.getCurrent(),o=a.MAX_MANIFEST_BUFFERED_START_END_DIFFERENCE,s=a.MAX_MANIFEST_BUFFERED_DURATION_DIFFERENCE;return Math.abs(n-e.bufferedEnd)<=o&&null!=e.bufferedStart&&e.bufferedEnd>e.bufferedStart&&Math.abs(e.bufferedEnd-e.bufferedStart-i)<=Math.min(s,i/3)}function h(e,t,n,a){var o=r.Z.getCurrent().MAX_MANIFEST_BUFFERED_START_END_DIFFERENCE;void 0!==e.bufferedStart?(e.bufferedStartt&&(n.precizeEnd||e.start-n.end<=o)?(i.Z.debug("SI: buffered start is end of previous segment",a,t,e.start,n.end),e.bufferedStart=n.end,v(e)&&(e.start=n.end,e.precizeStart=!0)):e.start-t<=o?(i.Z.debug("SI: found true buffered start",a,t,e.start),e.bufferedStart=t,v(e)&&(e.start=t,e.precizeStart=!0)):tt&&(i.Z.debug("SI: Segment partially GCed at the end",n,e.bufferedEnd,t),e.bufferedEnd=t),!e.precizeEnd&&t-e.end<=a&&p(e)&&(e.precizeEnd=!0,e.end=t)):e.precizeEnd?(i.Z.debug("SI: buffered end is precize end",n,e.end),e.bufferedEnd=e.end):t-e.end<=a?(i.Z.debug("SI: found true buffered end",n,t,e.end),e.bufferedEnd=t,p(e)&&(e.end=t,e.precizeEnd=!0)):t>e.end?(i.Z.debug("SI: range end too far from expected end",n,t,e.end),e.bufferedEnd=e.end):(i.Z.debug("SI: Segment appears immediately garbage collected at the end",n,e.bufferedEnd,t),e.bufferedEnd=t)}var g,y=f,_=function(){function e(){this._segmentInventory=new y}var t=e.prototype;return t.synchronizeInventory=function(){this._segmentInventory.synchronizeBuffered(this.getBufferedRanges())},t.getInventory=function(){return this._segmentInventory.getInventory()},t.getPendingOperations=function(){return[]},t.getSegmentHistory=function(e){return this._segmentInventory.getHistoryFor(e)},e}();!function(e){e[e.Push=0]="Push",e[e.Remove=1]="Remove",e[e.EndOfSegment=2]="EndOfSegment"}(g||(g={}))},4309:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(2829),i=function(){function e(){this._ranges=[],this.length=0}var t=e.prototype;return t.insert=function(e,t){(0,r.kR)(this._ranges,{start:e,end:t}),this.length=this._ranges.length},t.remove=function(e,t){var n=[];e>0&&n.push({start:0,end:e}),t<1/0&&n.push({start:t,end:1/0}),this._ranges=(0,r.tn)(this._ranges,n),this.length=this._ranges.length},t.start=function(e){if(e>=this._ranges.length)throw new Error("INDEX_SIZE_ERROR");return this._ranges[e].start},t.end=function(e){if(e>=this._ranges.length)throw new Error("INDEX_SIZE_ERROR");return this._ranges[e].end},e}()},7839:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(7326),i=n(4578),a=function(e){function t(n,i,a,o){var s;return s=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(s),t.prototype),s.name="CustomLoaderError",s.message=n,s.canRetry=i,s.isOfflineError=a,s.xhr=o,s}return(0,i.Z)(t,e),t}((0,n(2146).Z)(Error))},5157:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r=n(7326),i=n(4578),a=n(2146),o=n(5992),s=n(7367),u=function(e){function t(n,i,a){var u;return u=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(u),t.prototype),u.name="EncryptedMediaError",u.type=o.ZB.ENCRYPTED_MEDIA_ERROR,u.code=n,u.message=(0,s.Z)(u.name,u.code,i),u.fatal=!1,"string"==typeof(null==a?void 0:a.keyStatuses)&&(u.keyStatuses=a.keyStatuses),u}return(0,i.Z)(t,e),t}((0,a.Z)(Error))},5992:function(e,t,n){"use strict";n.d(t,{SM:function(){return a},ZB:function(){return r},br:function(){return i}});var r={NETWORK_ERROR:"NETWORK_ERROR",MEDIA_ERROR:"MEDIA_ERROR",ENCRYPTED_MEDIA_ERROR:"ENCRYPTED_MEDIA_ERROR",OTHER_ERROR:"OTHER_ERROR"},i={TIMEOUT:"TIMEOUT",ERROR_EVENT:"ERROR_EVENT",ERROR_HTTP_CODE:"ERROR_HTTP_CODE",PARSE_ERROR:"PARSE_ERROR"},a={PIPELINE_LOAD_ERROR:"PIPELINE_LOAD_ERROR",PIPELINE_PARSE_ERROR:"PIPELINE_PARSE_ERROR",INTEGRITY_ERROR:"INTEGRITY_ERROR",MANIFEST_PARSE_ERROR:"MANIFEST_PARSE_ERROR",MANIFEST_INCOMPATIBLE_CODECS_ERROR:"MANIFEST_INCOMPATIBLE_CODECS_ERROR",MANIFEST_UPDATE_ERROR:"MANIFEST_UPDATE_ERROR",MANIFEST_UNSUPPORTED_ADAPTATION_TYPE:"MANIFEST_UNSUPPORTED_ADAPTATION_TYPE",MEDIA_STARTING_TIME_NOT_FOUND:"MEDIA_STARTING_TIME_NOT_FOUND",MEDIA_TIME_BEFORE_MANIFEST:"MEDIA_TIME_BEFORE_MANIFEST",MEDIA_TIME_AFTER_MANIFEST:"MEDIA_TIME_AFTER_MANIFEST",MEDIA_TIME_NOT_FOUND:"MEDIA_TIME_NOT_FOUND",NO_PLAYABLE_REPRESENTATION:"NO_PLAYABLE_REPRESENTATION",MEDIA_IS_ENCRYPTED_ERROR:"MEDIA_IS_ENCRYPTED_ERROR",CREATE_MEDIA_KEYS_ERROR:"CREATE_MEDIA_KEYS_ERROR",KEY_ERROR:"KEY_ERROR",KEY_STATUS_CHANGE_ERROR:"KEY_STATUS_CHANGE_ERROR",KEY_UPDATE_ERROR:"KEY_UPDATE_ERROR",KEY_LOAD_ERROR:"KEY_LOAD_ERROR",KEY_LOAD_TIMEOUT:"KEY_LOAD_TIMEOUT",KEY_GENERATE_REQUEST_ERROR:"KEY_GENERATE_REQUEST_ERROR",INCOMPATIBLE_KEYSYSTEMS:"INCOMPATIBLE_KEYSYSTEMS",INVALID_ENCRYPTED_EVENT:"INVALID_ENCRYPTED_EVENT",INVALID_KEY_SYSTEM:"INVALID_KEY_SYSTEM",LICENSE_SERVER_CERTIFICATE_ERROR:"LICENSE_SERVER_CERTIFICATE_ERROR",MULTIPLE_SESSIONS_SAME_INIT_DATA:"MULTIPLE_SESSIONS_SAME_INIT_DATA",BUFFER_APPEND_ERROR:"BUFFER_APPEND_ERROR",BUFFER_FULL_ERROR:"BUFFER_FULL_ERROR",BUFFER_TYPE_UNKNOWN:"BUFFER_TYPE_UNKNOWN",MEDIA_ERR_BLOCKED_AUTOPLAY:"MEDIA_ERR_BLOCKED_AUTOPLAY",MEDIA_ERR_PLAY_NOT_ALLOWED:"MEDIA_ERR_PLAY_NOT_ALLOWED",MEDIA_ERR_NOT_LOADED_METADATA:"MEDIA_ERR_NOT_LOADED_METADATA",MEDIA_ERR_ABORTED:"MEDIA_ERR_ABORTED",MEDIA_ERR_NETWORK:"MEDIA_ERR_NETWORK",MEDIA_ERR_DECODE:"MEDIA_ERR_DECODE",MEDIA_ERR_SRC_NOT_SUPPORTED:"MEDIA_ERR_SRC_NOT_SUPPORTED",MEDIA_ERR_UNKNOWN:"MEDIA_ERR_UNKNOWN",MEDIA_SOURCE_NOT_SUPPORTED:"MEDIA_SOURCE_NOT_SUPPORTED",MEDIA_KEYS_NOT_SUPPORTED:"MEDIA_KEYS_NOT_SUPPORTED",DISCONTINUITY_ENCOUNTERED:"DISCONTINUITY_ENCOUNTERED",NONE:"NONE"}},7367:function(e,t,n){"use strict";function r(e,t,n){return e+" ("+t+") "+n}n.d(t,{Z:function(){return r}})},8750:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(9822),i=n(5389);function a(e,t){var n=t.defaultCode,a=t.defaultReason;if((0,r.Z)(e))return e;var o=e instanceof Error?e.toString():a;return new i.Z(n,o)}},9822:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r=n(5157),i=n(5992),a=n(3714),o=n(9362),s=n(5389);function u(e){return(e instanceof r.Z||e instanceof a.Z||e instanceof s.Z||e instanceof o.Z)&&Object.keys(i.ZB).indexOf(e.type)>=0}},3714:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r=n(7326),i=n(4578),a=n(2146),o=n(5992),s=n(7367),u=function(e){function t(n,i,a){var u;u=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(u),t.prototype),u.name="MediaError",u.type=o.ZB.MEDIA_ERROR,u.code=n,u.message=(0,s.Z)(u.name,u.code,i),u.fatal=!1;var l=null==a?void 0:a.adaptation;if(void 0!==l)switch(l.type){case"audio":u.trackInfo={type:"audio",track:l.toAudioTrack()};break;case"video":u.trackInfo={type:"video",track:l.toVideoTrack()};break;case"text":u.trackInfo={type:"text",track:l.toTextTrack()}}return u}return(0,i.Z)(t,e),t}((0,a.Z)(Error))},9362:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r=n(7326),i=n(4578),a=n(2146),o=n(5992),s=n(7367),u=function(e){function t(n,i){var a;return a=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(a),t.prototype),a.name="NetworkError",a.type=o.ZB.NETWORK_ERROR,a.xhr=void 0===i.xhr?null:i.xhr,a.url=i.url,a.status=i.status,a.errorType=i.type,a.code=n,a.message=(0,s.Z)(a.name,a.code,i.message),a.fatal=!1,a}return(0,i.Z)(t,e),t.prototype.isHttpError=function(e){return this.errorType===o.br.ERROR_HTTP_CODE&&this.status===e},t}((0,a.Z)(Error))},5389:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r=n(7326),i=n(4578),a=n(2146),o=n(5992),s=n(7367),u=function(e){function t(n,i){var a;return a=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(a),t.prototype),a.name="OtherError",a.type=o.ZB.OTHER_ERROR,a.code=n,a.message=(0,s.Z)(a.name,a.code,i),a.fatal=!1,a}return(0,i.Z)(t,e),t}((0,a.Z)(Error))},9105:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(7326),i=n(4578),a=function(e){function t(n,i,a,o){var s;return s=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(s),t.prototype),s.name="RequestError",s.url=n,void 0!==o&&(s.xhr=o),s.status=i,s.type=a,s.message=a,s}return(0,i.Z)(t,e),t}((0,n(2146).Z)(Error))},7273:function(e,t){"use strict";t.Z={dashParsers:{wasm:null,js:null},createDebugElement:null,directfile:null,ContentDecryptor:null,htmlTextTracksBuffer:null,htmlTextTracksParsers:{},imageBuffer:null,imageParser:null,nativeTextTracksBuffer:null,nativeTextTracksParsers:{},transports:{}}},7874:function(e,t,n){"use strict";var r=n(7273);t.Z=r.Z},3887:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(8894),i=new(function(){function e(){this.error=r.Z,this.warn=r.Z,this.info=r.Z,this.debug=r.Z,this._levels={NONE:0,ERROR:1,WARNING:2,INFO:3,DEBUG:4},this._currentLevel="NONE"}var t=e.prototype;return t.setLevel=function(e){var t,n=this._levels[e];"number"==typeof n?(t=n,this._currentLevel=e):(t=0,this._currentLevel="NONE"),this.error=t>=this._levels.ERROR?console.error.bind(console):r.Z,this.warn=t>=this._levels.WARNING?console.warn.bind(console):r.Z,this.info=t>=this._levels.INFO?console.info.bind(console):r.Z,this.debug=t>=this._levels.DEBUG?console.log.bind(console):r.Z},t.getLevel=function(){return this._currentLevel},t.hasLevel=function(e){return this._levels[e]>=this._levels[this._currentLevel]},e}())},8999:function(e,t,n){"use strict";n.d(t,{r:function(){return v},Z:function(){return p}});var r=n(3887),i=n(3274),a=n(1946),o=n(7829);var s="undefined"!=typeof window&&"function"==typeof window.Set&&"function"==typeof Array.from?function(e){return Array.from(new Set(e))}:function(e){return e.filter((function(e,t,n){return n.indexOf(e)===t}))},u=n(3774);var l=n(4791);function d(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return c(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return c(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&(this.trickModeTracks=i.map((function(t){return new e(t)})));for(var d=t.representations,c=[],v=!1,p=0;p0&&!r.isSupported){var i=new a.Z("MANIFEST_INCOMPATIBLE_CODECS_ERROR","An Adaptation contains only incompatible codecs.",{adaptation:r});n.contentWarnings.push(i)}return r})).filter((function(e){return e.representations.length>0}));if(s.every((function(e){return!e.isSupported}))&&o.length>0&&("video"===i||"audio"===i))throw new a.Z("MANIFEST_PARSE_ERROR","No supported "+i+" adaptations");return s.length>0&&(r[i]=s),r}),{}),!Array.isArray(this.adaptations.video)&&!Array.isArray(this.adaptations.audio))throw new a.Z("MANIFEST_PARSE_ERROR","No supported audio and video tracks.");this.duration=e.duration,this.start=e.start,null!=this.duration&&null!=this.start&&(this.end=this.start+this.duration),this.streamEvents=void 0===e.streamEvents?[]:e.streamEvents}var t=e.prototype;return t.getAdaptations=function(){var e=this.adaptations;return(0,v.Z)(e).reduce((function(e,t){return null!=t?e.concat(t):e}),[])},t.getAdaptationsForType=function(e){var t=this.adaptations[e];return null==t?[]:t},t.getAdaptation=function(e){return(0,s.Z)(this.getAdaptations(),(function(t){var n=t.id;return e===n}))},t.getSupportedAdaptations=function(e){if(void 0===e)return this.getAdaptations().filter((function(e){return e.isSupported}));var t=this.adaptations[e];return void 0===t?[]:t.filter((function(e){return e.isSupported}))},t.containsTime=function(e){return e>=this.start&&(void 0===this.end||e=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0)o.Z.warn("Manifest: "+y.length+" new Representations found when merging."),(h=t.representations).push.apply(h,y),v.push.apply(v,y)}l=e},l=0;l0){o.Z.warn("Manifest: "+s.length+" new Adaptations found when merging.");for(var d,c=g(s);!(d=c()).done;){var f=d.value,v=e.adaptations[f.type];void 0===v?e.adaptations[f.type]=[f]:v.push(f),i.addedAdaptations.push(f)}}return i}function b(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return S(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return S(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function S(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&r._addSupplementaryImageAdaptations(u),o.length>0&&r._addSupplementaryTextAdaptations(o),r}(0,i.Z)(t,e);var n=t.prototype;return n.getPeriod=function(e){return(0,s.Z)(this.periods,(function(t){return e===t.id}))},n.getPeriodForTime=function(e){return(0,s.Z)(this.periods,(function(t){return e>=t.start&&(void 0===t.end||t.end>e)}))},n.getNextPeriod=function(e){return(0,s.Z)(this.periods,(function(t){return t.start>e}))},n.getPeriodAfter=function(e){var t=e.end;if(void 0===t)return null;var n=(0,s.Z)(this.periods,(function(e){return void 0===e.end||t0&&this.trigger("decipherabilityUpdate",t)},n.getAdaptations=function(){(0,c.Z)("manifest.getAdaptations() is deprecated. Please use manifest.period[].getAdaptations() instead");var e=this.periods[0];if(void 0===e)return[];var t=e.adaptations,n=[];for(var r in t)if(t.hasOwnProperty(r)){var i=t[r];n.push.apply(n,i)}return n},n.getAdaptationsForType=function(e){(0,c.Z)("manifest.getAdaptationsForType(type) is deprecated. Please use manifest.period[].getAdaptationsForType(type) instead");var t=this.periods[0];if(void 0===t)return[];var n=t.adaptations[e];return void 0===n?[]:n},n.getAdaptation=function(e){return(0,c.Z)("manifest.getAdaptation(id) is deprecated. Please use manifest.period[].getAdaptation(id) instead"),(0,s.Z)(this.getAdaptations(),(function(t){var n=t.id;return e===n}))},n._addSupplementaryImageAdaptations=function(e){var t=this,n=(Array.isArray(e)?e:[e]).map((function(e){var n=e.mimeType,r=e.url,i="gen-image-ada-"+T(),o="gen-image-rep-"+T(),s=(0,d.$)(r),u=r.substring(0,s),l=r.substring(s),c=new f.Z({id:i,type:"image",representations:[{bitrate:0,cdnMetadata:[{baseUrl:u}],id:o,mimeType:n,index:new h({media:l})}]},{isManuallyAdded:!0});if(c.representations.length>0&&!c.isSupported){var v=new a.Z("MANIFEST_INCOMPATIBLE_CODECS_ERROR","An Adaptation contains only incompatible codecs.",{adaptation:c});t.contentWarnings.push(v)}return c}));if(n.length>0&&this.periods.length>0){var r=this.periods[0].adaptations;r.image=null!=r.image?r.image.concat(n):n}},n._addSupplementaryTextAdaptations=function(e){var t=this,n=(Array.isArray(e)?e:[e]).reduce((function(e,n){var r=n.mimeType,i=n.codecs,o=n.url,s=n.language,u=n.languages,l=n.closedCaption,c=null!=s?[s]:null!=u?u:[],v=(0,d.$)(o),p=o.substring(0,v),m=o.substring(v);return e.concat(c.map((function(e){var n="gen-text-ada-"+T(),o="gen-text-rep-"+T(),s=new f.Z({id:n,type:"text",language:e,closedCaption:l,representations:[{bitrate:0,cdnMetadata:[{baseUrl:p}],id:o,mimeType:r,codecs:i,index:new h({media:m})}]},{isManuallyAdded:!0});if(s.representations.length>0&&!s.isSupported){var u=new a.Z("MANIFEST_INCOMPATIBLE_CODECS_ERROR","An Adaptation contains only incompatible codecs.",{adaptation:s});t.contentWarnings.push(u)}return s})))}),[]);if(n.length>0&&this.periods.length>0){var r=this.periods[0].adaptations;r.text=null!=r.text?r.text.concat(n):n}},n._performUpdate=function(e,t){var n;if(this.availabilityStartTime=e.availabilityStartTime,this.expired=e.expired,this.isDynamic=e.isDynamic,this.isLive=e.isLive,this.isLastPeriodKnown=e.isLastPeriodKnown,this.lifetime=e.lifetime,this.contentWarnings=e.contentWarnings,this.suggestedPresentationDelay=e.suggestedPresentationDelay,this.transport=e.transport,this.publishTime=e.publishTime,t===r.Full)this._timeBounds=e._timeBounds,this.uris=e.uris,n=function(e,t){for(var n={updatedPeriods:[],addedPeriods:[],removedPeriods:[]},i=0,a=0;ae.length)return o.Z.error("Manifest: error when updating Periods"),n;if(i0&&(e.push.apply(e,b),(y=n.addedPeriods).push.apply(y,b)),n}(this.periods,e.periods);else{this._timeBounds.maximumTimeData=e._timeBounds.maximumTimeData,this.updateUrl=e.uris[0],n=function(e,t){var n,i={updatedPeriods:[],addedPeriods:[],removedPeriods:[]};if(0===e.length)return e.splice.apply(e,[0,0].concat(t)),(n=i.addedPeriods).push.apply(n,t),i;if(0===t.length)return i;var s=e[e.length-1];if(s.startc){var E;o.Z.warn("Manifest: old Periods not found in new when updating, removing");var k=e.splice(c,p-c);(E=i.removedPeriods).push.apply(E,k),p=c}var w=_(e[p],v,r.Full);i.updatedPeriods.push({period:e[p],result:w})}c++}if(c0;){var s=this.periods[0];if(void 0===s.end||s.end>i)break;this.periods.shift()}}this.adaptations=void 0===this.periods[0]?{}:this.periods[0].adaptations,this.trigger("manifestUpdate",n)},t}(u.Z);var w=k},520:function(e,t,n){"use strict";n.d(t,{K:function(){return a},z:function(){return i}});var r=n(1946);function i(e,t){return e.segment.id===t.segment.id&&e.representation.id===t.representation.id&&e.adaptation.id===t.adaptation.id&&e.period.id===t.period.id}function a(e){if((0,r.Z)(e))return"";var t=e.period,n=e.adaptation,i=e.representation,a=e.segment;return n.type+" P: "+t.id+" A: "+n.id+" R: "+i.id+" S: "+(a.isInit?"init":a.complete?a.time+"-"+a.duration:""+a.time)}},2689:function(e,t,n){"use strict";n.d(t,{s:function(){return r}});var r=Math.pow(2,32)-1},2297:function(e,t,n){"use strict";n.d(t,{Qy:function(){return f},Xj:function(){return p},iz:function(){return c},lp:function(){return d},nR:function(){return v},t_:function(){return l},vA:function(){return u}});var r=n(3887),i=n(811),a=n(6968);function o(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return s(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return s(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);ni)return null;s=(0,a.pV)(e,r),r+=8}if(s<0)throw new Error("ISOBMFF: Size out of range");if(n===t)return 1970628964===t&&(r+=16),[o,r,o+s];o+=s}return null}function v(e,t,n,r,i){for(var o,s=e.length,u=0;us)return;o=(0,a.pV)(e,l),l+=8}if(1970628964===d&&l+16<=s&&(0,a.pX)(e,l)===t&&(0,a.pX)(e,l+4)===n&&(0,a.pX)(e,l+8)===r&&(0,a.pX)(e,l+12)===i)return l+=16,e.subarray(l,u+o)}}function p(e){var t=e.length;if(t<8)return r.Z.warn("ISOBMFF: box inferior to 8 bytes, cannot find offsets"),null;var n=0,i=(0,a.pX)(e,n);n+=4;var o=(0,a.pX)(e,n);if(n+=4,0===i)i=t;else if(1===i){if(n+8>t)return r.Z.warn("ISOBMFF: box too short, cannot find offsets"),null;i=(0,a.pV)(e,n),n+=8}if(i<0)throw new Error("ISOBMFF: Size out of range");return 1970628964===o&&(n+=16),[0,n,i]}},6807:function(e,t,n){"use strict";n.d(t,{E3:function(){return u},Le:function(){return o},XA:function(){return i},fs:function(){return s},uq:function(){return a}});var r=n(2297);function i(e){var t=(0,r.t_)(e,1836019558);return null===t?null:(0,r.t_)(t,1953653094)}function a(e){return(0,r.lp)(e,1836019558).reduce((function(e,t){var n=(0,r.t_)(t,1953653094);return null!==n&&e.push(n),e}),[])}function o(e){return(0,r.t_)(e,1835295092)}function s(e){var t=(0,r.t_)(e,1836019574);if(null===t)return null;var n=(0,r.t_)(t,1953653099);return null===n?null:(0,r.t_)(n,1835297121)}function u(e,t){return void 0===t&&(t=0),(0,r.t_)(e.subarray(t),1701671783)}},6490:function(e,t,n){"use strict";n.d(t,{Z:function(){return s},Y:function(){return u}});var r=n(3887);var i="function"==typeof Uint8Array.prototype.slice?function(e,t,n){return e.slice(t,n)}:function(e,t,n){return new Uint8Array(Array.prototype.slice.call(e,t,n))},a=n(3635),o=n(2297);function s(e){var t=0,n=(0,o.t_)(e,1836019574);if(null===n)return[];for(var a=[];t1)r.Z.warn("ISOBMFF: un-handled PSSH version");else{var n=t+4;if(!(n+16>e.length)){var o=i(e,n,n+16);return(0,a.ci)(o)}}}},4644:function(e,t,n){"use strict";n.d(t,{J6:function(){return m},LD:function(){return h},MM:function(){return p},Qx:function(){return f},R0:function(){return y},Wf:function(){return c},s9:function(){return g}});var r=n(3887),i=n(6968),a=n(3635),o=n(2689),s=n(2297),u=n(6807);function l(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return d(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return d(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0;){var v=(0,i.pX)(e,o);o+=4;var p=2147483647&v;if(1===(2147483648&v)>>>31)throw new Error("sidx with reference_type `1` not yet implemented");var h=(0,i.pX)(e,o);o+=4,o+=4,c.push({time:l,duration:h,timescale:d,range:[r,r+p-1]}),l+=h,r+=p}return c}function f(e){var t=(0,u.XA)(e);if(null!==t){var n=(0,s.t_)(t,1952867444);if(null!==n){var r=n[0];return 1===r?(0,i.pV)(n,4):0===r?(0,i.pX)(n,4):void 0}}}function v(e){var t=(0,s.t_)(e,1952868452);if(null!==t){var n=1,r=(0,i.QI)(t,n);if(n+=3,(8&r)>0)return n+=4,(1&r)>0&&(n+=8),(2&r)>0&&(n+=4),(0,i.pX)(t,n)}}function p(e){var t=(0,u.uq)(e);if(0!==t.length){for(var n,r=0,a=l(t);!(n=a()).done;){var o=n.value,d=(0,s.t_)(o,1953658222);if(null===d)return;var c=0,f=d[c];if(c+=1,f>1)return;var p=(0,i.QI)(d,c);c+=3;var h=(256&p)>0,m=0;if(!h&&void 0===(m=v(o)))return;var g=(1&p)>0,y=(4&p)>0,_=(512&p)>0,b=(1024&p)>0,S=(2048&p)>0,T=(0,i.pX)(d,c);c+=4,g&&(c+=4),y&&(c+=4);for(var E=T,k=0;E-- >0;)h?(k+=(0,i.pX)(d,c),c+=4):k+=m,_&&(c+=4),b&&(c+=4),S&&(c+=4);r+=k}return r}}function h(e){var t=(0,u.fs)(e);if(null!==t){var n=(0,s.t_)(t,1835296868);if(null!==n){var r=0,a=n[r];return r+=4,1===a?(0,i.pX)(n,r+16):0===a?(0,i.pX)(n,r+8):void 0}}}function m(e){var t=e.length;if(t<4)throw new Error("Cannot update box length: box too short");var n=(0,i.pX)(e,0);if(0===n){if(t>o.s){var r=new Uint8Array(t+8);return r.set((0,i.kh)(1),0),r.set(e.subarray(4,8),4),r.set((0,i.el)(t+8),8),r.set(e.subarray(8,t),16),r}return e.set((0,i.kh)(t),0),e}if(1===n){if(t<16)throw new Error("Cannot update box length: box too short");return e.set((0,i.el)(t),8),e}if(t<=o.s)return e.set((0,i.kh)(t),0),e;var a=new Uint8Array(t+8);return a.set((0,i.kh)(1),0),a.set(e.subarray(4,8),4),a.set((0,i.el)(t+8),8),a.set(e.subarray(8,t),16),a}function g(e){for(var t=[],n=0;n0)throw new Error("Unhandled version: "+s);var c=(0,r.dN)(e,t);t+=4;var f=(0,r.dN)(e,t);t+=4;var v=(0,i.uR)(e.subarray(t,t+4));t+=4;var p=(0,r.qb)(e,t);t+=2;var h=(0,r.qb)(e,t),m=[e[t+=2],e[t+1]].join(":"),g=1===e[t+=2];t=64;var y=[];if(0===c)throw new Error("bif: no images to parse");for(var _=0,b=null;t0,this._isEMSGWhitelisted=c}var t=e.prototype;return t.getInitSegment=function(){return(0,a.Z)(this._index,this._isEMSGWhitelisted)},t.getSegments=function(e,t){return(0,o.Z)(this._index,e,t,this._isEMSGWhitelisted,this._scaledPeriodEnd)},t.shouldRefresh=function(){return!1},t.getFirstAvailablePosition=function(){var e=this._index;return 0===e.timeline.length?null:(0,i.zG)(Math.max(this._scaledPeriodStart,e.timeline[0].start),e)},t.getLastAvailablePosition=function(){var e,t=this._index.timeline;if(0===t.length)return null;var n=t[t.length-1],r=Math.min((0,i.jH)(n,null,this._scaledPeriodEnd),null!==(e=this._scaledPeriodEnd)&&void 0!==e?e:1/0);return(0,i.zG)(r,this._index)},t.getEnd=function(){return this.getLastAvailablePosition()},t.awaitSegmentBetween=function(){return!1},t.isSegmentStillAvailable=function(){return!0},t.checkDiscontinuity=function(){return null},t.initializeIndex=function(e){for(var t=0;t0?Math.floor(u/s):0),I=T+A*S;Ih)break;var R=null===v?null:(0,i.QB)(I,Z)(v),x=I-e.indexTimeOffset,M=S;x<0&&(M=S+x,x=0);var C={id:String(I),time:x/f,end:(x+M)/f,duration:M/f,isInit:!1,range:E,timescale:1,url:R,number:Z,timestampOffset:-e.indexTimeOffset/f,complete:w,privateInfos:{isEMSGWhitelisted:a}};g.push(C),I=T+ ++A*S}if(I>=d)return g;if(m+=k+1,void 0!==h&&m>h)return g}return g}},4784:function(e,t,n){"use strict";n.d(t,{QB:function(){return o},zA:function(){return a}});var r=n(6923);function i(e){return function(t,n,i){var a,o,s,u=(0,r.Z)(i)?parseInt(i,10):1;return a=String(e),o=u,(s=a.toString()).length>=o?s:(new Array(o+1).join("0")+s).slice(-o)}}function a(e,t,n){return function(e,t,n){return-1===e.indexOf("$")?e:e.replace(/\$\$/g,"$").replace(/\$RepresentationID\$/g,String(t)).replace(/\$Bandwidth(\%0(\d+)d)?\$/g,i(void 0===n?0:n))}(e,t,n)}function o(e,t){return function(n){return-1===n.indexOf("$")?n:n.replace(/\$\$/g,"$").replace(/\$Number(\%0(\d+)d)?\$/g,(function(e,n,r){if(void 0===t)throw new Error("Segment number not defined in a $Number$ scheme");return i(t)(e,n,r)})).replace(/\$Time(\%0(\d+)d)?\$/g,(function(t,n,r){if(void 0===e)throw new Error("Segment time not defined in a $Time$ scheme");return i(e)(t,n,r)}))}}},4541:function(e,t,n){"use strict";n.d(t,{Z:function(){return je}});var r=n(7904),i=n(1946),a=n(6872),o=n(3887),s=n(3274),u=n(9829);function l(e){var t=Date.parse(e)-performance.now();if(!isNaN(t))return t;o.Z.warn("DASH Parser: Invalid clock received: ",e)}function d(e){for(var t=e.representations,n=null,r=0;r=0;t--){var n=e[t].adaptations,r=void 0===n.audio?void 0:n.audio[0],i=void 0===n.video?void 0:n.video[0];if(void 0!==r||void 0!==i){var a=null,s=null;if(void 0!==r){var u=d(r);if(void 0===u)return{safe:void 0,unsafe:void 0};a=u}if(void 0!==i){var l=d(i);if(void 0===l)return{safe:void 0,unsafe:void 0};s=l}if(void 0!==r&&null===a||void 0!==i&&null===s)return o.Z.info("Parser utils: found Period with no segment. ","Going to previous one to calculate last position"),{safe:void 0,unsafe:void 0};if(null!==s)return null!==a?{safe:Math.min(a,s),unsafe:Math.max(a,s)}:{safe:s,unsafe:s};if(null!==a)return{safe:a,unsafe:a}}}return{safe:void 0,unsafe:void 0}}(e);return{minimumSafePosition:t,maximumSafePosition:n.safe,maximumUnsafePosition:n.unsafe}}var v=n(9592),p=n(908),h=n(1679),m=n(3635);var g=function(){function e(e){this._isDynamic=e.isDynamic,this._timeShiftBufferDepth=e.isDynamic&&void 0!==e.timeShiftBufferDepth?e.timeShiftBufferDepth:null}var t=e.prototype;return t.setLastPosition=function(e,t){this._lastPosition=e,this._positionTime=t},t.lastPositionIsKnown=function(){return this._isDynamic?null!=this._positionTime&&null!=this._lastPosition:null!=this._lastPosition},t.estimateMinimumBound=function(){if(!this._isDynamic||null===this._timeShiftBufferDepth)return 0;var e=this.estimateMaximumBound();return void 0!==e?e-this._timeShiftBufferDepth:void 0},t.estimateMaximumBound=function(){return this._isDynamic&&null!=this._positionTime&&null!=this._lastPosition?Math.max(this._lastPosition-this._positionTime+performance.now()/1e3,0):this._lastPosition},e}(),y=n(8999),_=n(5138),b=n(7714),S=n(6923);function T(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return E(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return E(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function E(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0){var s=i-a.start;if(s%a.duration==0&&s/a.duration<=a.repeatCount)return{repeatNumberInPrevSegments:s/a.duration,prevSegmentsIdx:o,newElementsIdx:0,repeatNumberInNewElements:0}}if(++o>=e.length)return null;if((a=e[o]).start===i)return{prevSegmentsIdx:o,newElementsIdx:0,repeatNumberInPrevSegments:0,repeatNumberInNewElements:0};if(a.start>i)return null}else for(var u=0,l=t[0],d=i;;){var c=l.getAttribute("d"),f=null===c?null:parseInt(c,10);if(null===f||Number.isNaN(f))return null;var v=l.getAttribute("r"),p=null===v?null:parseInt(v,10);if(null!==p){if(Number.isNaN(p)||p<0)return null;if(p>0){var h=n-d;if(h%f==0&&h/f<=p)return{repeatNumberInPrevSegments:0,repeatNumberInNewElements:h/f,prevSegmentsIdx:0,newElementsIdx:u}}d+=f*(p+1)}else d+=f;if(++u>=t.length)return null;var m=(l=t[u]).getAttribute("t"),g=null===m?null:parseInt(m,10);if(null!==g){if(Number.isNaN(g))return null;d=g}if(d===n)return{newElementsIdx:u,prevSegmentsIdx:0,repeatNumberInPrevSegments:0,repeatNumberInNewElements:0};if(d>i)return null}}(t,e);if(null===r)return o.Z.warn('DASH: Cannot perform "based" update. Common segment not found.'),z(e);var i=r.prevSegmentsIdx,a=r.newElementsIdx,s=r.repeatNumberInPrevSegments,u=r.repeatNumberInNewElements,l=t.length-i+a-1;if(l>=e.length)return o.Z.info('DASH: Cannot perform "based" update. New timeline too short'),z(e);var d=t.slice(i);if(s>0){var c=d[0];c.start+=c.duration*s,d[0].repeatCount-=s}if(u>0&&0!==a)return o.Z.info('DASH: Cannot perform "based" update. The new timeline has a different form.'),z(e);var f=d[d.length-1],v=V(e[l]),p=(null!==(n=v.repeatCount)&&void 0!==n?n:0)-u;if(v.duration!==f.duration||f.repeatCount>p)return o.Z.info('DASH: Cannot perform "based" update. The new timeline has a different form at the beginning.'),z(e);void 0!==v.repeatCount&&v.repeatCount>f.repeatCount&&(f.repeatCount=v.repeatCount);for(var h=[],m=[],g=l+1;g0){var s=i[i.length-1];if((0,R.jH)(s,null,this._scaledPeriodEnd)+a>=Math.min(o,null!==(n=this._scaledPeriodEnd)&&void 0!==n?n:1/0))return!1}return void 0===this._scaledPeriodEnd?o+a>this._scaledPeriodStart&&void 0:(0,R.gT)(e,this._index)-athis._scaledPeriodStart},t.isSegmentStillAvailable=function(e){if(e.isInit)return!0;this._refreshTimeline(),null===this._index.timeline&&(this._index.timeline=this._getTimeline());var t=this._index,n=t.timeline,r=t.timescale,i=t.indexTimeOffset;return(0,O.Z)(e,n,r,i)},t.checkDiscontinuity=function(e){this._refreshTimeline();var t=this._index.timeline;return null===t&&(t=this._getTimeline(),this._index.timeline=t),(0,R._j)({timeline:t,timescale:this._index.timescale,indexTimeOffset:this._index.indexTimeOffset},e,this._scaledPeriodEnd)},t.canBeOutOfSyncError=function(e){return!!this._isDynamic&&(e instanceof P.Z&&e.isHttpError(404))},t._replace=function(e){this._parseTimeline=e._parseTimeline,this._index=e._index,this._isDynamic=e._isDynamic,this._scaledPeriodStart=e._scaledPeriodStart,this._scaledPeriodEnd=e._scaledPeriodEnd,this._lastUpdate=e._lastUpdate,this._manifestBoundsCalculator=e._manifestBoundsCalculator,this._isLastPeriod=e._isLastPeriod},t._update=function(e){null===this._index.timeline&&(this._index.timeline=this._getTimeline()),null===e._index.timeline&&(e._index.timeline=e._getTimeline()),(0,L.Z)(this._index.timeline,e._index.timeline)&&(this._index.startNumber=e._index.startNumber),this._index.endNumber=e._index.endNumber,this._isDynamic=e._isDynamic,this._scaledPeriodStart=e._scaledPeriodStart,this._scaledPeriodEnd=e._scaledPeriodEnd,this._lastUpdate=e._lastUpdate,this._isLastPeriod=e._isLastPeriod},t.isFinished=function(){if(!this._isDynamic||!this._isLastPeriod)return!0;null===this._index.timeline&&(this._index.timeline=this._getTimeline());var e=this._index.timeline;if(void 0===this._scaledPeriodEnd||0===e.length)return!1;var t=e[e.length-1];return(0,R.jH)(t,null,this._scaledPeriodEnd)+B(this._index.timescale)>=this._scaledPeriodEnd},t.isInitialized=function(){return!0},e.isTimelineIndexArgument=function(e){return"function"==typeof e.timelineParser||Array.isArray(e.timeline)},t._refreshTimeline=function(){if(null===this._index.timeline&&(this._index.timeline=this._getTimeline()),this._isDynamic){var e=this._manifestBoundsCalculator.estimateMinimumBound();if(null!=e){var t=(0,R.gT)(e,this._index),n=(0,N.Z)(this._index.timeline,t);void 0!==this._index.startNumber?this._index.startNumber+=n:void 0!==this._index.endNumber&&(this._index.startNumber=n+1)}}},e.getIndexEnd=function(e,t){return e.length<=0?null:Math.min((0,R.jH)(e[e.length-1],null,t),null!=t?t:1/0)},t._getTimeline=function(){if(null===this._parseTimeline)return null!==this._index.timeline?this._index.timeline:(o.Z.error("DASH: Timeline already lazily parsed."),[]);var e=this._parseTimeline();this._parseTimeline=null;var t,n=a.Z.getCurrent().MIN_DASH_S_ELEMENTS_TO_PARSE_UNSAFELY;return null===this._unsafelyBaseOnPreviousIndex||e.lengthn){if(r===n+1)return e.slice(0,i+1);var o=e.slice(0,i),s=Object.assign({},a),u=r-a.repeatCount-1;return s.repeatCount=Math.max(0,n-u),o.push(s),o}}return e}var H=G,j=function(){function e(e,t){var n,r,i=t.aggressiveMode,a=t.availabilityTimeOffset,o=t.manifestBoundsCalculator,s=t.isDynamic,u=t.periodEnd,l=t.periodStart,d=t.representationId,c=t.representationBitrate,f=t.isEMSGWhitelisted,v=null!==(n=e.timescale)&&void 0!==n?n:1;this._availabilityTimeOffset=a,this._manifestBoundsCalculator=o,this._aggressiveMode=i;var p=null!=e.presentationTimeOffset?e.presentationTimeOffset:0,h=p-l*v;if(void 0===e.duration)throw new Error("Invalid SegmentTemplate: no duration");var m=void 0===(null===(r=e.initialization)||void 0===r?void 0:r.media)?null:(0,M.zA)(e.initialization.media,d,c),g=void 0===e.media?null:(0,M.zA)(e.media,d,c);this._index={duration:e.duration,timescale:v,indexRange:e.indexRange,indexTimeOffset:h,initialization:null==e.initialization?void 0:{url:m,range:e.initialization.range},url:g,presentationTimeOffset:p,startNumber:e.startNumber,endNumber:e.endNumber},this._isDynamic=s,this._periodStart=l,this._scaledRelativePeriodEnd=void 0===u?void 0:(u-l)*v,this._isEMSGWhitelisted=f}var t=e.prototype;return t.getInitSegment=function(){return(0,x.Z)(this._index,this._isEMSGWhitelisted)},t.getSegments=function(e,t){var n=this._index,r=n.duration,i=n.startNumber,a=n.endNumber,o=n.timescale,s=n.url,u=this._periodStart*o,l=this._scaledRelativePeriodEnd,d=e*o-u,c=(e+t)*o-u,f=this._getFirstSegmentStart(),v=this._getLastSegmentStart();if(null==f||null==v)return[];var p=Math.max(f,d),h=Math.min(v,c);if(h+r<=p)return[];for(var m=[],g=null!=i?i:1,y=Math.floor(p/r),_=y*r;_<=h;_+=r){var b=y+g;if(void 0!==a&&b>a)return m;var S=null!=l&&_+r>l?l-_:r,T=_+u,E=_+this._index.presentationTimeOffset,k=null===s?null:(0,M.QB)(E,b)(s),w={id:String(b),number:b,time:T/o,end:(T+S)/o,duration:S/o,timescale:1,isInit:!1,scaledDuration:S/o,url:k,timestampOffset:-n.indexTimeOffset/o,complete:!0,privateInfos:{isEMSGWhitelisted:this._isEMSGWhitelisted}};m.push(w),y++}return m},t.getFirstAvailablePosition=function(){var e=this._getFirstSegmentStart();return null==e?e:e/this._index.timescale+this._periodStart},t.getLastAvailablePosition=function(){var e=this._getLastSegmentStart();if((0,i.Z)(e))return e;var t=this._estimateRelativeScaledEnd();return Math.min(e+this._index.duration,null!=t?t:1/0)/this._index.timescale+this._periodStart},t.getEnd=function(){if(!this._isDynamic)return this.getLastAvailablePosition();var e=this._estimateRelativeScaledEnd();if(void 0!==e){var t=this._index.timescale;return(e+this._periodStart*t)/t}},t.awaitSegmentBetween=function(e,t){if((0,D.Z)(e<=t),!this._isDynamic)return!1;var n=this._index.timescale,r=B(n),i=this._periodStart*n,a=t*n-i,o=this._estimateRelativeScaledEnd();return void 0===o?a+r>=0:e*n-i-r=e},t.isInitialized=function(){return!0},t._replace=function(e){this._index=e._index,this._aggressiveMode=e._aggressiveMode,this._isDynamic=e._isDynamic,this._periodStart=e._periodStart,this._scaledRelativePeriodEnd=e._scaledRelativePeriodEnd,this._manifestBoundsCalculator=e._manifestBoundsCalculator},t._update=function(e){this._replace(e)},t._getFirstSegmentStart=function(){if(!this._isDynamic)return 0;if(0===this._scaledRelativePeriodEnd||void 0===this._scaledRelativePeriodEnd){var e=this._manifestBoundsCalculator.estimateMaximumBound();if(void 0!==e&&ethis._periodStart?(i-this._periodStart)*r:0;return Math.floor(a/n)*n}},t._getLastSegmentStart=function(){var e,t=this._index,n=t.duration,r=t.timescale,i=t.endNumber,o=t.startNumber,s=void 0===o?1:o;if(this._isDynamic){var u=this._manifestBoundsCalculator.estimateMaximumBound();if(void 0===u)return;var l=this._aggressiveMode?n/r:0;if(void 0!==this._scaledRelativePeriodEnd&&this._scaledRelativePeriodEnd<(u+l-this._periodStart)*this._index.timescale){var d=Math.ceil(this._scaledRelativePeriodEnd/n);return void 0!==i&&i-s+1g||h<2?m:(h-2)*n},t._estimateRelativeScaledEnd=function(){var e,t;if(void 0!==this._index.endNumber){var n=this._index.endNumber-(null!==(e=this._index.startNumber)&&void 0!==e?e:1)+1;return Math.max(Math.min(n*this._index.duration,null!==(t=this._scaledRelativePeriodEnd)&&void 0!==t?t:1/0),0)}if(void 0!==this._scaledRelativePeriodEnd)return Math.max(this._scaledRelativePeriodEnd,0)},e}();function q(e,t){var n;if(0===t.length)return e;var r=t.map((function(e){return{url:e.value}}));if(0===e.length)return r;for(var i=[],a=0;a=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function X(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0){var y=t.parentSegmentTemplates.slice(),_=e.children.segmentTemplate;void 0!==_&&y.push(_);var b=I.Z.apply(void 0,[{}].concat(y));h.availabilityTimeComplete=null!==(n=b.availabilityTimeComplete)&&void 0!==n?n:t.availabilityTimeComplete,h.availabilityTimeOffset=(null!==(r=b.availabilityTimeOffset)&&void 0!==r?r:0)+t.availabilityTimeOffset,i=H.isTimelineIndexArgument(b)?new H(b,h):new j(b,h)}else{var S=t.adaptation.children;if(void 0!==S.segmentBase){var T=S.segmentBase;i=new Z.Z(T,h)}else if(void 0!==S.segmentList){var E=S.segmentList;i=new C(E,h)}else i=new j({duration:Number.MAX_VALUE,timescale:1,startNumber:0,media:""},h)}return i}(e,(0,I.Z)({},n,{availabilityTimeOffset:m,availabilityTimeComplete:h,unsafelyBaseOnPreviousRepresentation:v,adaptation:t,inbandEventStreams:p}));null==e.attributes.bitrate?(o.Z.warn("DASH: No usable bitrate found in the Representation."),f=0):f=e.attributes.bitrate;var y,_=q(n.baseURLs,e.children.baseURLs),b={bitrate:f,cdnMetadata:0===_.length?[{baseUrl:"",id:void 0}]:_.map((function(e){return{baseUrl:e.url,id:e.serviceLocation}})),index:g,id:c};null!=e.attributes.codecs?y=e.attributes.codecs:null!=t.attributes.codecs&&(y=t.attributes.codecs),null!=y&&(y="mp4a.40.02"===y?"mp4a.40.2":y,b.codecs=y),null!=e.attributes.frameRate?b.frameRate=e.attributes.frameRate:null!=t.attributes.frameRate&&(b.frameRate=t.attributes.frameRate),null!=e.attributes.height?b.height=e.attributes.height:null!=t.attributes.height&&(b.height=t.attributes.height),null!=e.attributes.mimeType?b.mimeType=e.attributes.mimeType:null!=t.attributes.mimeType&&(b.mimeType=t.attributes.mimeType),null!=e.attributes.width?b.width=e.attributes.width:null!=t.attributes.width&&(b.width=t.attributes.width);var S=void 0!==t.children.contentProtections?t.children.contentProtections:[];if(void 0!==e.children.contentProtections&&S.push.apply(S,e.children.contentProtections),S.length>0){var T=S.reduce((function(e,t){var n;if(void 0!==t.attributes.schemeIdUri&&"urn:uuid:"===t.attributes.schemeIdUri.substring(0,9)&&(n=t.attributes.schemeIdUri.substring(9).replace(/-/g,"").toLowerCase()),void 0!==t.attributes.keyId&&t.attributes.keyId.length>0){var r={keyId:t.attributes.keyId,systemId:n};void 0===e.keyIds?e.keyIds=[r]:e.keyIds.push(r)}if(void 0!==n){for(var i,a=[],o=Y(t.children.cencPssh);!(i=o()).done;){var u=i.value;a.push({systemId:n,data:u})}if(a.length>0){var l,d=(0,s.Z)(e.initData,(function(e){return"cenc"===e.type}));if(void 0===d)e.initData.push({type:"cenc",values:a});else(l=d.values).push.apply(l,a)}}return e}),{keyIds:void 0,initData:[]});(Object.keys(T.initData).length>0||void 0!==T.keyIds&&T.keyIds.length>0)&&(b.contentProtections=T)}b.hdrInfo=Q({adaptationProfiles:t.attributes.profiles,supplementalProperties:t.children.supplementalProperties,essentialProperties:t.children.essentialProperties,manifestProfiles:n.manifestProfiles,codecs:y}),d.push(b)},f=Y(e);!(l=f()).done;)c();return d}function J(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return ee(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ee(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ee(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ue(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&(n.sort(oe),e[t]=n.map((function(e){return e[0]}))),e}),{});return d.video.sort(oe),k(le,c),le}(I.children.adaptations,V),K=(null!==(u=t.xmlNamespaces)&&void 0!==u?u:[]).concat(null!==(l=I.attributes.namespaces)&&void 0!==l?l:[]),G=function(e,t,n){for(var r,i,a,o=[],s=se(e);!(a=s()).done;)for(var u,l=a.value,d=l.attributes,c=d.schemeIdUri,f=void 0===c?"":c,v=d.timescale,p=void 0===v?1:v,h=n.concat(null!==(r=l.attributes.namespaces)&&void 0!==r?r:[]),g=se(l.children.events);!(u=g()).done;){var y=u.value;if(void 0!==y.eventStreamData){var _=(null!==(i=y.presentationTime)&&void 0!==i?i:0)/p+t,b=void 0===y.duration?void 0:_+y.duration/p,S=void 0;if(y.eventStreamData instanceof Element)S=y.eventStreamData;else{var T=h.reduce((function(e,t){return e+"xmlns:"+t.key+'="'+t.value+'" '}),"","application/xml").documentElement.childNodes[0]}o.push({start:_,end:b,id:y.id,data:{type:"dash-event-stream",value:{schemeIdUri:f,timescale:p,element:S}}})}}return o}(I.children.eventStreams,M,K),W={id:g,start:M,end:P,duration:C,adaptations:z,streamEvents:G};if(d.unshift(W),!T.lastPositionIsKnown()){var H=function(e){for(var t,n=null,r=!0,i=(0,h.Z)(e).filter((function(e){return null!=e})),a=se((0,v.Z)(i,(function(e){return e})));!(t=a()).done;)for(var o,s=se(t.value.representations);!(o=s()).done;){var u=o.value.index.getLastAvailablePosition();null!==u&&(r=!1,"number"==typeof u&&(n=null==n?u:Math.max(n,u)))}if(null!=n)return n;if(r)return null;return}(z);if(f)if("number"==typeof H){var j=performance.now()/1e3;T.setLastPosition(H,j)}else{var Y=ce(t,M);if(void 0!==Y){var X=Y[0],Q=Y[1];T.setLastPosition(X,Q)}}else"number"==typeof H&&T.setLastPosition(H)}},w=e.length-1;w>=0;w--)E();if(t.isDynamic&&!T.lastPositionIsKnown()){var I=ce(t,0);if(void 0!==I){var Z=I[0],R=I[1];T.setLastPosition(Z,R)}}return function(e){if(0===e.length)return[];for(var t=[e[0]],n=1;nr.start)&&(o.Z.warn("DASH: Updating overlapping Periods.",null==i?void 0:i.start,r.start),i.duration=r.start-i.start,i.end=r.start,!(i.duration>0));)t.pop(),i=t[t.length-1];t.push(r)}return t}(d)}function ce(e,t){if(null!=e.clockOffset){var n=e.clockOffset/1e3-e.availabilityStartTime,r=performance.now()/1e3,i=r+n;if(i>=t)return[i,r]}else{var a=Date.now()/1e3;if(a>=t)return o.Z.warn("DASH Parser: no clock synchronization mechanism found. Using the system clock instead."),[a-e.availabilityStartTime,performance.now()/1e3]}}function fe(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return ve(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ve(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ve(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0?t[0].value:void 0}(t);if(null!=y&&y.length>0)return{type:"needs-clock",value:{url:y,continue:function(i){return i.success?(n.externalClockOffset=l(i.data),e(t,n,r,!0)):(r.push(i.error),o.Z.warn("DASH Parser: Error on fetching the clock ressource",i.error),e(t,n,r,!0))}}}}}for(var _=[],b=0;b=0&&(d=0===h.minimumUpdatePeriod?a.Z.getCurrent().DASH_FALLBACK_LIFETIME_WHEN_MINIMUM_UPDATE_PERIOD_EQUAL_0:h.minimumUpdatePeriod);var I=f(k),Z=I.minimumSafePosition,R=I.maximumSafePosition,x=I.maximumUnsafePosition,M=performance.now();if(m){var C,P;if(c=Z,A=null!=b?b:null,void 0!==x&&(P=x),void 0!==R)C=R;else{var D=null!=_?_:0,N=t.externalClockOffset;if(void 0===N)o.Z.warn("DASH Parser: use system clock to define maximum position"),C=Date.now()/1e3-D;else C=(performance.now()+N)/1e3-D}void 0===P&&(P=C),v={isLinear:!0,maximumSafePosition:C,livePosition:P,time:M},null!==A&&void 0!==c&&C-c>A&&(A=C-c)}else{c=void 0!==Z?Z:void 0!==(null===(i=k[0])||void 0===i?void 0:i.start)?k[0].start:0;var O=null!=w?w:1/0;if(void 0!==k[k.length-1]){var L=k[k.length-1],U=null!==(s=L.end)&&void 0!==s?s:void 0!==L.duration?L.start+L.duration:void 0;void 0!==U&&U=0;o--){var s,u=_[o].index,l=a[o],f=l.parsed,v=l.warnings,p=l.receivedTime,h=l.sendingTime,m=l.url;v.length>0&&r.push.apply(r,v);for(var g,y=fe(f);!(g=y()).done;){var b=g.value;d.set(b,{receivedTime:p,sendingTime:h,url:m})}(s=c.periods).splice.apply(s,[u,1].concat(f))}return e(t,n,r,i,d)}}}};function he(e){var t=e.textContent,n=[];return null===t||0===t.length?[void 0,n]:[{value:t},n]}function me(e){for(var t={},n=0;n0){var s=xe(a,"cenc:pssh"),u=s[0],l=s[1];null!==l&&(o.Z.warn(l.message),t.push(l)),null!==u&&n.push(u)}}}return[{cencPssh:n},t]}(e.childNodes),n=t[0],r=t[1];return[{children:n,attributes:function(e){for(var t={},n=0;n0&&(r=r.concat(c));break;case"SegmentList":var f=Ue(a),v=f[0],p=f[1];r=r.concat(p),t.segmentList=v;break;case"SegmentTemplate":var h=Fe(a),m=h[0],g=h[1];r=r.concat(g),t.segmentTemplate=m;break;case"ContentProtection":var y=De(a),_=y[0],b=y[1];b.length>0&&(r=r.concat(b)),void 0!==_&&n.push(_)}}return n.length>0&&(t.contentProtections=n),[t,r]}(e.childNodes),n=t[0],r=t[1],i=function(e){for(var t={},n=[],r=Ce(t,n),i=0;i0&&(r=r.concat(u));break;case"ContentComponent":t.contentComponent=me(a);break;case"EssentialProperty":null==t.essentialProperties?t.essentialProperties=[Me(a)]:t.essentialProperties.push(Me(a));break;case"InbandEventStream":void 0===t.inbandEventStreams&&(t.inbandEventStreams=[]),t.inbandEventStreams.push(Me(a));break;case"Label":var l=a.textContent;null!=l&&(t.label=l);break;case"Representation":var d=Ve(a),c=d[0],f=d[1];t.representations.push(c),f.length>0&&(r=r.concat(f));break;case"Role":null==t.roles?t.roles=[Me(a)]:t.roles.push(Me(a));break;case"SupplementalProperty":null==t.supplementalProperties?t.supplementalProperties=[Me(a)]:t.supplementalProperties.push(Me(a));break;case"SegmentBase":var v=Oe(a),p=v[0],h=v[1];t.segmentBase=p,h.length>0&&(r=r.concat(h));break;case"SegmentList":var m=Ue(a),g=m[0],y=m[1];t.segmentList=g,y.length>0&&(r=r.concat(y));break;case"SegmentTemplate":var _=Fe(a),b=_[0],S=_[1];t.segmentTemplate=b,S.length>0&&(r=r.concat(S));break;case"ContentProtection":var T=De(a),E=T[0],k=T[1];k.length>0&&(r=r.concat(k)),void 0!==E&&n.push(E)}}return n.length>0&&(t.contentProtections=n),[t,r]}(e.childNodes),n=t[0],r=t[1],i=function(e){for(var t={},n=[],r=Ce(t,n),i=0;i0&&(n=n.concat(d))}}return[t,n]}function Ge(e){for(var t={eventStreamData:e},n=[],r=Ce(t,n),i=0;i0&&(i=i.concat(_))}}return[{baseURLs:n,adaptations:r,eventStreams:a,segmentTemplate:t},i]}(e.childNodes),n=t[0],r=t[1],i=function(e){for(var t={},n=[],r=Ce(t,n),i=0;i",c=(new DOMParser).parseFromString(d,"text/xml");if(null==c||0===c.children.length)throw new Error("DASH parser: Invalid external ressources");for(var f=c.children[0].children,v=[],p=[],h=0;h0;){var r=e[0];if(r.start>=t)return n;if(-1===r.repeatCount)return n;if(0===r.repeatCount)e.shift(),n+=1;else{var i=e[1];if(void 0!==i&&i.start<=t)e.shift(),n+=1;else{if(r.duration<=0)return n;for(var a=r.start+r.duration,o=1;ar.repeatCount)){var s=r.repeatCount-o;return r.start=a,r.repeatCount=s,n+=o}e.shift(),n=r.repeatCount+1}}}return n}n.d(t,{Z:function(){return r}})},3911:function(e,t,n){"use strict";n.d(t,{KF:function(){return i},PZ:function(){return u},_j:function(){return l},gT:function(){return o},jH:function(){return a},zG:function(){return s}});var r=n(1946);function i(e,t,n){var i,a=e.repeatCount;return a>=0?a:(i=(0,r.Z)(t)?void 0!==n?n:Number.MAX_VALUE:t.start,Math.ceil((i-e.start)/e.duration)-1)}function a(e,t,n){var r=e.start,a=e.duration;return a<=0?r:r+(i(e,t,n)+1)*a}function o(e,t){var n;return e*t.timescale+(null!==(n=t.indexTimeOffset)&&void 0!==n?n:0)}function s(e,t){var n;return(e-(null!==(n=t.indexTimeOffset)&&void 0!==n?n:0))/t.timescale}function u(e,t,n){return[e*n,(e+t)*n]}function l(e,t,n){var r=e.timeline,i=o(t,e);if(i<0)return null;var u=function(e,t){for(var n=0,r=e.length;n>>1;e[i].start<=t?n=i+1:r=i}return n-1}(r,i);if(u<0||u>=r.length-1)return null;var l=r[u];if(l.duration<=0)return null;var d=r[u+1];if(void 0===d)return null;var c=d.start;return i>=a(l,d,n)&&ie.time)return!1;if(o===e.time)return void 0===a.range?void 0===e.range:null!=e.range&&a.range[0]===e.range[0]&&a.range[1]===e.range[1];if(a.repeatCount>=0&&void 0!==a.duration){var s=(o-a.start)/a.duration-1;return s%1==0&&s<=a.repeatCount}}return!1}n.d(t,{Z:function(){return r}})},5505:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var r=n(3714),i=n(3887),a=n(3911);function o(e,t){if(0===e.length)return e.push.apply(e,t),!0;if(0===t.length)return!1;var n=e.length,o=t[0].start,s=e[n-1];if((0,a.jH)(s,t[0])=0;u--){var l=e[u].start;if(l===o){var d=n-u;return e.splice.apply(e,[u,d].concat(t)),!1}if(lo)return i.Z.warn("RepresentationIndex: Manifest update removed all previous segments"),e.splice.apply(e,[0,n].concat(t)),!0;if(void 0===c.repeatCount||c.repeatCount<=0)return c.repeatCount<0&&(c.repeatCount=Math.floor((o-c.start)/c.duration)-1),e.splice.apply(e,[u+1,n-(u+1)].concat(t)),!1;if(c.start+c.duration*(c.repeatCount+1)<=o)return e.splice.apply(e,[u+1,n-(u+1)].concat(t)),!1;var f=(o-c.start)/c.duration-1;if(f%1==0&&c.duration===t[0].duration){var v=t[0].repeatCount<0?-1:t[0].repeatCount+f+1;return e.splice.apply(e,[u,n-u].concat(t)),e[u].start=c.start,e[u].repeatCount=v,!1}return i.Z.warn("RepresentationIndex: Manifest update removed previous segments"),e[u].repeatCount=Math.floor(f),e.splice.apply(e,[u+1,n-(u+1)].concat(t)),!1}}var p=e[e.length-1],h=t[t.length-1];return void 0!==p.repeatCount&&p.repeatCount<0?p.start>h.start?(i.Z.warn("RepresentationIndex: The new index is older than the previous one"),!1):(i.Z.warn('RepresentationIndex: The new index is "bigger" than the previous one'),e.splice.apply(e,[0,n].concat(t)),!0):p.start+p.duration*(p.repeatCount+1)>=h.start+h.duration*(h.repeatCount+1)?(i.Z.warn("RepresentationIndex: The new index is older than the previous one"),!1):(i.Z.warn('RepresentationIndex: The new index is "bigger" than the previous one'),e.splice.apply(e,[0,n].concat(t)),!0)}},5734:function(e,t,n){"use strict";var r=n(6923),i=/&#([0-9]+);/g,a=/
/gi,o=/]*>([\s\S]*?)<\/style[^>]*>/i,s=/\s*

]+))?>(.*)/i,u=/]+?start="?([0-9]*)"?[^0-9]/i;function l(e,t){var n=new RegExp("\\s*"+t+":\\s*(\\S+);","i").exec(e);return Array.isArray(n)?n[1]:null}t.Z=function(e,t,n){var d,c,f=/]/gi,v=/]|<\/body>/gi,p=[],h=o.exec(e),m=Array.isArray(h)?h[1]:"";v.exec(e);var g,y=function(e){for(var t=/\.(\S+)\s*{([^}]*)}/gi,n={},r=t.exec(e);null!==r;){var i=r[1],a=l(r[2],"lang");null!=i&&null!=a&&(n[a]=i),r=t.exec(e)}return n}(m),_=function(e){var t=/p\s*{([^}]*)}/gi.exec(e);return null===t?"":t[1]}(m);if((0,r.Z)(n)&&void 0===(g=y[n]))throw new Error("sami: could not find lang "+n+" in CSS");for(;d=f.exec(e),c=v.exec(e),null!==d||null!==c;){if(null===d||null===c||d.index>=c.index)throw new Error("parse error");var b=e.slice(d.index,c.index),S=u.exec(b);if(!Array.isArray(S))throw new Error("parse error (sync time attribute)");var T=+S[1];if(isNaN(T))throw new Error("parse error (sync time attribute NaN)");E(b.split("\n"),T/1e3)}return p;function E(e,n){for(var o=e.length;--o>=0;){var u=s.exec(e[o]);if(Array.isArray(u)){var l=u[1],d=u[2];if(g===l)if(" "===d)p[p.length-1].end=n;else{var c=document.createElement("DIV");c.className="rxp-texttrack-region";var f=document.createElement("DIV");f.className="rxp-texttrack-div",f.style.position="absolute",f.style.bottom="0",f.style.width="100%",f.style.color="#fff",f.style.textShadow="-1px -1px 0 #000,1px -1px 0 #000,-1px 1px 0 #000,1px 1px 0 #000";var v=document.createElement("div");v.className="rxp-texttrack-p",(0,r.Z)(_)&&(v.style.cssText=_);for(var h=d.split(a),m=0;m/gi,s=/]*>([\s\S]*?)<\/style[^>]*>/i,u=/\s*

]+))?>(.*)/i,l=/]+?start="?([0-9]*)"?[^0-9]/i;function d(e,t){var n=new RegExp("\\s*"+t+":\\s*(\\S+);","i").exec(e);return Array.isArray(n)?n[1]:null}t.Z=function(e,t,n){var c,f,v=/]/gi,p=/]|<\/body>/gi,h=[],m=s.exec(e),g=null!==m?m[1]:"";p.exec(e);var y,_=function(e){for(var t=/\.(\S+)\s*{([^}]*)}/gi,n={},r=t.exec(e);Array.isArray(r);){var i=r[1],a=d(r[2],"lang");null!=i&&null!=a&&(n[a]=i),r=t.exec(e)}return n}(g);if((0,i.Z)(n)&&void 0===(y=_[n]))throw new Error("sami: could not find lang "+n+" in CSS");for(;c=v.exec(e),f=p.exec(e),null!==c||null!==f;){if(null===c||null===f||c.index>=f.index)throw new Error("parse error");var b=e.slice(c.index,f.index),S=l.exec(b);if(null===S)throw new Error("parse error (sync time attribute)");var T=+S[1];if(isNaN(T))throw new Error("parse error (sync time attribute NaN)");E(b.split("\n"),T/1e3)}return function(e){for(var t=[],n=0;n=0;)if(null!==(r=u.exec(e[s]))){var l=r,d=l[1],c=l[2];y===d&&(" "===c?h[h.length-1].end=n:h.push({text:(i=c,i.replace(o,"\n").replace(a,(function(e,t){return String.fromCharCode(Number(t))}))),start:n+t}))}}}},2061:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(6923);function i(e,t){for(var n=t+1;(0,r.Z)(e[n]);)n++;return n}function a(e){for(var t=[],n=0;n0&&(1===o.length?o[0].indexOf("--\x3e")>=0&&t.push(o):(o[1].indexOf("--\x3e")>=0||o[0].indexOf("--\x3e")>=0)&&t.push(o)),n=a}return t}},8675:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(2061),i=n(788);function a(e,t){for(var n=e.split(/\r\n|\n|\r/),a=(0,r.Z)(n),s=[],u=0;u0){var l=document.createTextNode(o[s]);r.appendChild(l)}}else if("B"===a.nodeName){var d=e(a);d.style.fontWeight="bold",r.appendChild(d)}else if("I"===a.nodeName){var c=e(a);c.style.fontStyle="italic",r.appendChild(c)}else if("U"===a.nodeName){var f=e(a);f.style.textDecoration="underline",r.appendChild(f)}else if(u(a)&&"string"==typeof a.color){var v=e(a);v.style.color=a.color,r.appendChild(v)}else{var p=e(a);r.appendChild(p)}}return r}(t)}function u(e){return"FONT"===e.nodeName&&"color"in e}},8057:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var r=n(7253),i=n(2061),a=n(788);function o(e,t){for(var n,o,s,u,l,d=e.split(/\r\n|\n|\r/),c=(0,i.Z)(d),f=[],v=0;v0){var _=p.getAttribute("xml:space"),b=(0,l.Z)(_)?"default"===_:o,T=(0,d.Z)({},i,(0,c.U)(g,[p],n,t));u.push.apply(u,e(p,T,[p].concat(a),b))}}return u}(e,(0,d.Z)({},r),[],i)}(e,n,r,i,s),T=0;T|\u2265/g,">").replace(/\u200E/g,"‎").replace(/\u200F/g,"‏").replace(/\u00A0/g," ")}else if((0,l.OE)(s))i+="\n";else if((0,l.jg)(s)&&s.nodeType===Node.ELEMENT_NODE&&s.childNodes.length>0){var c=s.getAttribute("xml:space");i+=n(s,(0,o.Z)(c)?"default"===c:t)}}return i}return n(e,t)}(t,v),y=(0,i.Z)(h+n,m+n,g);return null===y?null:((0,a.Z)(y)&&function(e,t){var n=t.extent;if((0,o.Z)(n)){var r=u._0.exec(n);null!=r&&(e.size=Number(r[1]))}switch(t.writingMode){case"tb":case"tblr":e.vertical="lr";break;case"tbrl":e.vertical="rl"}var i=t.origin;if((0,o.Z)(i))u._0.exec(i);var a=t.align;if((0,o.Z)(a)){e.align=a,"center"===a&&("center"!==e.align&&(e.align="middle"),e.position="auto");var s=c[a];e.positionAlign=void 0===s?"":s;var l=d[a];e.lineAlign=void 0===l?"":l}}(y,r),y)}var v=function(e,t){for(var n=(0,r.Z)(e,t),i=[],a=0;a0&&(t=n)}return t}function a(e){var t=e.getElementsByTagName("body");if(t.length>0)return t[0];var n=e.getElementsByTagName("tt:body");return n.length>0?n[0]:null}function o(e){var t=e.getElementsByTagName("style");if(t.length>0)return t;var n=e.getElementsByTagName("tt:style");return n.length>0?n:t}function s(e){var t=e.getElementsByTagName("region");if(t.length>0)return t;var n=e.getElementsByTagName("tt:region");return n.length>0?n:t}function u(e){var t=e.getElementsByTagName("p");if(t.length>0)return t;var n=e.getElementsByTagName("tt:p");return n.length>0?n:t}function l(e){return"br"===e.nodeName||"tt:br"===e.nodeName}function d(e){return"span"===e.nodeName||"tt:span"===e.nodeName}n.d(t,{DM:function(){return s},H:function(){return a},OE:function(){return l},jF:function(){return i},jg:function(){return d},kd:function(){return u},vU:function(){return o}})},1138:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(6923),i=n(360);function a(e,t){for(var n=[],a=t;a=2)for(var r=function(r){var o=e[r];if(Array.isArray(/::cue {/.exec(o)))for(o=e[++r];(0,i.Z)(o)&&!Array.isArray(/}/.exec(o))&&0!==o.length;)n+=o,o=e[++r];else{for(var s=[],u=/::cue\(\.?(.*?)\)(?:,| {)/.exec(o);(0,i.Z)(o)&&Array.isArray(u);)s.push(u[1]),o=e[++r],u=/::cue\(\.?(.*?)\)(?:,| {)/.exec(o);for(var l="";(0,i.Z)(o)&&!Array.isArray(/}/.exec(o))&&0!==o.length;)l+=o,o=e[++r];s.forEach((function(e){void 0===t[e]?t[e]=l:t[e]+=l}))}a=r},a=1;a0&&n.appendChild(document.createElement("br")),o[s].length>0){var u=document.createTextNode(o[s]);n.appendChild(u)}}else{var c=e.nodeName.toLowerCase().split("."),f=[];if(c.forEach((function(e){(0,i.Z)(t[e])&&f.push(t[e])})),0!==f.length){var v=document.createAttribute("style");f.forEach((function(e){v.value+=e}));var p=(0,l.Z)(r,a)?a:"span";(n=document.createElement(p)).setAttributeNode(v)}else{var h=(0,l.Z)(r,a)?a:"span";n=document.createElement(h)}for(var m=0;m/,"").replace(/<([u,i,b,c])(\..*?)?(?: .*?)?>(.*?)<\/\1>/g,"<$1$2>$3"),r=(new DOMParser).parseFromString(n,"text/html").body.childNodes,i=[],a=0;a=2){var a=parseInt(i[1],10);isNaN(a)||(t.position=a,void 0!==i[2]&&(t.positionAlign=i[2]))}}(0,u.Z)(e.size)&&(t.size=e.size),"string"==typeof e.align&&(0,s.Z)(["start","center","end","left"],e.align)&&(t.align=e.align)}var d=n(7253);var c=function(e,t){var n=e.split(/\r\n|\n|\r/);if(!/^WEBVTT($| |\t)/.test(n[0]))throw new Error("Can't parse WebVTT: Invalid file.");for(var s,u,c,f,v=(0,o.yE)(n),p=(0,i.Z)(n,v),h=[],m=0;m/;if(o.test(e[0]))n=e[0],r=e.slice(1,e.length);else{if(!o.test(e[1]))return null;a=e[0],n=e[1],r=e.slice(2,e.length)}var s=function(e){var t=/^([\d:.]+)[ |\t]+-->[ |\t]+([\d:.]+)[ |\t]*(.*)$/.exec(e);if(null===t)return null;var n=i(t[1]),r=i(t[2]);return null==n||null==r?null:{start:n,end:r,settings:t[3].split(/ |\t/).reduce((function(e,t){var n=t.split(":");return 2===n.length&&(e[n[0]]=n[1]),e}),{})}}(n);return null===s?null:{start:s.start+t,end:s.end+t,settings:s.settings,payload:r,header:a}}},360:function(e,t,n){"use strict";n.d(t,{$4:function(){return s},JF:function(){return a},tq:function(){return o},yE:function(){return i}});var r=n(6923);function i(e){for(var t=0;t=0)return!0;var r=e[t+1];return void 0!==r&&r.indexOf("--\x3e")>=0}function s(e,t){for(var n=t+1;(0,r.Z)(e[n]);)n++;return n}},85:function(e,t,n){"use strict";n.d(t,{Z:function(){return fe}});var r=n(7874),i=n(8791),a=n(5861),o=n(4687),s=n.n(o),u=n(4597),l=n(5278),d=n(9829);function c(e,t){return null===e?null:null===t.url?e.baseUrl:(0,d.Z)(e.baseUrl,t.url)}function f(e,t,n,r,i){return v.apply(this,arguments)}function v(){return(v=(0,a.Z)(s().mark((function e(t,n,r,i,a){var o,l,d;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=n.segment,l=c(t,o),!o.isInit&&null!==l){e.next=4;break}return e.abrupt("return",{resultType:"segment-created",resultData:null});case 4:return e.next=6,(0,u.ZP)({url:l,responseType:"arraybuffer",timeout:r.timeout,onProgress:a.onProgress,cancelSignal:i});case 6:return d=e.sent,e.abrupt("return",{resultType:"segment-loaded",resultData:d});case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function p(e,t){var n=t.segment,i=t.period,a=e.data,o=e.isChunked;if(t.segment.isInit)return{segmentType:"init",initializationData:null,initializationDataSize:0,protectionDataUpdate:!1,initTimescale:void 0};if(o)throw new Error("Image data should not be downloaded in chunks");var s=(0,l.Z)(n.timestampOffset,0);return null===a||null===r.Z.imageParser?{segmentType:"media",chunkData:null,chunkSize:0,chunkInfos:{duration:n.duration,time:n.time},chunkOffset:s,protectionDataUpdate:!1,appendWindow:[i.start,i.end]}:{segmentType:"media",chunkData:{data:r.Z.imageParser(new Uint8Array(a)).thumbs,start:0,end:Number.MAX_VALUE,timescale:1,type:"bif"},chunkSize:void 0,chunkInfos:{time:0,duration:Number.MAX_VALUE},chunkOffset:s,protectionDataUpdate:!1,appendWindow:[i.start,i.end]}}var h=n(6872),m=n(8750),g=n(3887),y=n(1989),_=n(8026),b=n(3635);function S(e){var t=e.aggressiveMode,n=e.referenceDateTime,i=void 0!==e.serverSyncInfos?e.serverSyncInfos.serverTimestamp-e.serverSyncInfos.clientTime:void 0;return function(a,o,s,l,d){var c,f=a.responseData,v=o.externalClockOffset,p=null!==(c=a.url)&&void 0!==c?c:o.originalUrl,S=null!=i?i:v,T={aggressiveMode:!0===t,unsafelyBaseOnPreviousManifest:o.unsafeMode?o.previousManifest:null,url:p,referenceDateTime:n,externalClockOffset:S},E=r.Z.dashParsers;if(null===E.wasm||"uninitialized"===E.wasm.status||"failure"===E.wasm.status)return g.Z.debug("DASH: WASM MPD Parser not initialized. Running JS one."),w();var k=function(e){if(e instanceof ArrayBuffer)return e;if("string"==typeof e)return(0,b.tG)(e).buffer;if(e instanceof Document)return(0,b.tG)(e.documentElement.innerHTML).buffer;throw new Error("DASH Manifest Parser: Unrecognized Manifest format")}(f);return function(e){var t=new DataView(e);if(61371===t.getUint16(0)&&191===t.getUint8(2))return!0;if(65279===t.getUint16(0)||65534===t.getUint16(0))return!1;return!0}(k)?"initialized"===E.wasm.status?(g.Z.debug("DASH: Running WASM MPD Parser."),A(E.wasm.runWasmParser(k,T))):(g.Z.debug("DASH: Awaiting WASM initialization before parsing the MPD."),E.wasm.waitForInitialization().catch((function(){})).then((function(){return null===E.wasm||"initialized"!==E.wasm.status?(g.Z.warn("DASH: WASM MPD parser initialization failed. Running JS parser instead"),w()):(g.Z.debug("DASH: Running WASM MPD Parser."),A(E.wasm.runWasmParser(k,T)))}))):(g.Z.info("DASH: MPD doesn't seem to be UTF-8-encoded. Running JS parser instead of the WASM one."),w());function w(){if(null===E.js)throw new Error("No MPD parser is imported");var e=function(e){if(e instanceof ArrayBuffer)return(new DOMParser).parseFromString((0,b.uR)(new Uint8Array(e)),"text/xml");if("string"==typeof e)return(new DOMParser).parseFromString(e,"text/xml");if(e instanceof Document)return e;throw new Error("DASH Manifest Parser: Unrecognized Manifest format")}(f);return A(E.js(e,T))}function A(t){if("done"===t.type)return t.value.warnings.length>0&&s(t.value.warnings),l.isCancelled()?Promise.reject(l.cancellationError):{manifest:new y.ZP(t.value.parsed,e),url:p};var n=t.value,r=n.urls.map((function(e){return d((function(){var t=h.Z.getCurrent().DEFAULT_REQUEST_TIMEOUT;return"string"===n.format?(0,u.ZP)({url:e,responseType:"text",timeout:t,cancelSignal:l}):(0,u.ZP)({url:e,responseType:"arraybuffer",timeout:t,cancelSignal:l})})).then((function(e){if("string"===n.format){if("string"!=typeof e.responseData)throw new Error("External DASH resources should have been a string");return(0,_.Z)(e,{responseData:{success:!0,data:e.responseData}})}if(!(e.responseData instanceof ArrayBuffer))throw new Error("External DASH resources should have been ArrayBuffers");return(0,_.Z)(e,{responseData:{success:!0,data:e.responseData}})}),(function(e){var t=(0,m.Z)(e,{defaultCode:"PIPELINE_PARSE_ERROR",defaultReason:"An unknown error occured when parsing ressources."});return(0,_.Z)({},{size:void 0,requestDuration:void 0,responseData:{success:!1,error:t}})}))}));return Promise.all(r).then((function(e){return n.format,A(n.continue(e))}))}}}var T=n(7839),E=n(9105),k=n(5992),w=n(1946),A="function"==typeof Headers?Headers:null,I="function"==typeof AbortController?AbortController:null;function Z(){return"function"==typeof window.fetch&&!(0,w.Z)(I)&&!(0,w.Z)(A)}var R=n(8806),x=n(281);function M(e,t){return"audio"===e||"video"===e?"video/mp4"===t.mimeType||"audio/mp4"===t.mimeType?"mp4":"video/webm"===t.mimeType||"audio/webm"===t.mimeType?"webm":void 0:"text"===e&&"application/mp4"===t.mimeType?"mp4":void 0}var C=n(288),P=n(4460);function D(e){return function(t,n,r,i,a){return new Promise((function(s,u){var l=new C.ZP,d=l.linkToSignal(i);function c(){l.signal.deregister(u),d()}l.signal.register(u),e(t,n,r,l.signal,Object.assign(Object.assign({},a),{onNewChunk:function(e){try{o(e),a.onNewChunk(e)}catch(e){c(),l.cancel(),u(e)}}})).then((function(e){if(c(),!l.isUsed()){if("segment-loaded"===e.resultType)try{o(e.resultData.responseData)}catch(e){return void u(e)}s(e)}}),(function(e){c(),u(e)}))}));function o(e){(e instanceof ArrayBuffer||e instanceof Uint8Array)&&"mp4"===M(n.adaptation.type,n.representation)&&(0,P.Z)(new Uint8Array(e),n.segment.isInit)}}}var N=n(6968);function O(e,t,n,r,i){if(void 0===t.range)return(0,u.ZP)({url:e,responseType:"arraybuffer",timeout:n.timeout,cancelSignal:r,onProgress:i.onProgress}).then((function(e){return{resultType:"segment-loaded",resultData:e}}));if(void 0===t.indexRange)return(0,u.ZP)({url:e,headers:{Range:(0,x.Z)(t.range)},responseType:"arraybuffer",timeout:n.timeout,cancelSignal:r,onProgress:i.onProgress}).then((function(e){return{resultType:"segment-loaded",resultData:e}}));if(t.range[1]+1===t.indexRange[0])return(0,u.ZP)({url:e,headers:{Range:(0,x.Z)([t.range[0],t.indexRange[1]])},responseType:"arraybuffer",timeout:n.timeout,cancelSignal:r,onProgress:i.onProgress}).then((function(e){return{resultType:"segment-loaded",resultData:e}}));var a=(0,u.ZP)({url:e,headers:{Range:(0,x.Z)(t.range)},responseType:"arraybuffer",timeout:n.timeout,cancelSignal:r,onProgress:i.onProgress}),o=(0,u.ZP)({url:e,headers:{Range:(0,x.Z)(t.indexRange)},responseType:"arraybuffer",timeout:n.timeout,cancelSignal:r,onProgress:i.onProgress});return Promise.all([a,o]).then((function(t){var n=t[0],r=t[1],i=(0,N.zo)(new Uint8Array(n.responseData),new Uint8Array(r.responseData)),a=Math.min(n.sendingTime,r.sendingTime),o=Math.max(n.receivedTime,r.receivedTime);return{resultType:"segment-loaded",resultData:{url:e,responseData:i,size:n.size+r.size,requestDuration:o-a,sendingTime:a,receivedTime:o}}}))}var L=n(8766);function U(e,t,n,r,i){var o=t.segment,u=void 0!==o.range?{Range:(0,x.Z)(o.range)}:void 0,l=null;return function(e){var t;if(!(0,w.Z)(e.headers))if((0,w.Z)(A))t=e.headers;else{t=new A;for(var n=Object.keys(e.headers),r=0;r=300)throw g.Z.warn("Fetch: Request HTTP Error",t.status,t.url),new E.Z(t.url,t.status,k.br.ERROR_HTTP_CODE);if((0,w.Z)(t.body))throw new E.Z(t.url,t.status,k.br.PARSE_ERROR);var n=t.headers.get("Content-Length"),r=(0,w.Z)(n)||isNaN(+n)?void 0:+n,i=t.body.getReader(),u=0;return l();function l(){return c.apply(this,arguments)}function c(){return(c=(0,a.Z)(s().mark((function n(){var a,o,c,f,p;return s().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,i.read();case 2:if((a=n.sent).done||(0,w.Z)(a.value)){n.next=11;break}return u+=a.value.byteLength,o=performance.now(),c={url:t.url,currentTime:o,duration:o-d,sendingTime:d,chunkSize:a.value.byteLength,chunk:a.value.buffer,size:u,totalSize:r},e.onData(c),n.abrupt("return",l());case 11:if(!a.done){n.next=16;break}return v(),f=performance.now(),p=f-d,n.abrupt("return",{requestDuration:p,receivedTime:f,sendingTime:d,size:u,status:t.status,url:t.url});case 16:return n.abrupt("return",l());case 17:case"end":return n.stop()}}),n)})))).apply(this,arguments)}})).catch((function(t){if(null!==u)throw u;if(v(),l)throw g.Z.warn("Fetch: Request timeouted."),new E.Z(e.url,0,k.br.TIMEOUT);if(t instanceof E.Z)throw t;throw g.Z.warn("Fetch: Request Error",t instanceof Error?t.toString():""),new E.Z(e.url,0,k.br.ERROR_EVENT)}))}({url:e,headers:u,onData:function(e){var t=new Uint8Array(e.chunk),n=function(e){for(var t=0,n=[];te.length)return[n,r];var o=(0,L.Z)(r,1835295092);if(o<0)return[n,r];var s=t+o+(0,N.pX)(e,o+t);if(s>e.length)return[n,r];var u=Math.max(a,s),l=e.subarray(t,u);n.push(l),t=u}return[n,null]}(null!==l?(0,N.zo)(l,t):t),a=n[0];l=n[1];for(var o=0;o0)for(var v=0;v=Math.pow(2,8-n))return n}function te(e,t){var n=ee(e,t);if(null==n)return g.Z.warn("webm: unrepresentable length"),null;if(t+n>e.length)return g.Z.warn("webm: impossible length"),null;for(var r=0,i=0;ie.length)return g.Z.warn("webm: impossible length"),null;for(var r=(e[t]&(1<<8-n)-1)*Math.pow(2,8*(n-1)),i=1;i=i)return!0}return!1}(r,t);return{inbandEvents:a,needsManifestRefresh:o}}}function se(e){var t=e.__priv_patchLastSegmentInSidx;return function(e,n,r){var i,a=n.period,o=n.adaptation,s=n.representation,u=n.segment,d=n.manifest,c=e.data,f=e.isChunked,v=[a.start,a.end];if(null===c)return u.isInit?{segmentType:"init",initializationData:null,initializationDataSize:0,protectionDataUpdate:!1,initTimescale:void 0}:{segmentType:"media",chunkData:null,chunkSize:0,chunkInfos:null,chunkOffset:0,protectionDataUpdate:!1,appendWindow:v};var p=c instanceof Uint8Array?c:new Uint8Array(c),h=M(o.type,s),m="mp4"===h||void 0===h,g=!1;if(m){var y,_=(0,F.Z)(p);u.isInit&&(y=null!==(i=(0,V.R0)(p))&&void 0!==i?i:void 0),(_.length>0||void 0!==y)&&(g=s._addProtectionData("cenc",y,_))}if(!u.isInit){var b=m?ae(p,f,u,r):null,S=(0,l.Z)(u.timestampOffset,0);if(m){var T=(0,V.s9)(p);if(void 0!==T){var E=oe(T.filter((function(e){return void 0!==u.privateInfos&&void 0!==u.privateInfos.isEMSGWhitelisted&&u.privateInfos.isEMSGWhitelisted(e)})),d.publishTime);if(void 0!==E){var k=E.needsManifestRefresh,A=E.inbandEvents;return{segmentType:"media",chunkData:p,chunkSize:p.length,chunkInfos:b,chunkOffset:S,appendWindow:v,inbandEvents:A,protectionDataUpdate:g,needsManifestRefresh:k}}}}return{segmentType:"media",chunkData:p,chunkSize:p.length,chunkInfos:b,chunkOffset:S,protectionDataUpdate:g,appendWindow:v}}var I=u.indexRange,Z=null;if("webm"===h)Z=function(e,t){var n=Q(z,[],e,[t,e.length]);if(null==n)return null;var r=n[0],i=n[1],a=$(e,r);if(null==a)return null;var o=J(e,r);if(null==o)return null;var s=Q(H,[],e,[r,i]);if(null==s)return null;for(var u=[],l=s[0];l0)){var R=Z[Z.length-1];Array.isArray(R.range)&&(R.range[1]=1/0)}s.index instanceof ie.Z&&null!==Z&&Z.length>0&&s.index.initializeIndex(Z);var x=m?(0,V.LD)(p):"webm"===h?$(p,0):void 0,C=(0,w.Z)(x)?void 0:x;return{segmentType:"init",initializationData:p,initializationDataSize:p.length,protectionDataUpdate:g,initTimescale:C}}}var ue=n(6807);function le(e,t,n,r){var i,a,o=e.segment,s=e.adaptation,u=e.representation;if(o.isInit)return null;null===n?r?(i=o.time,a=o.end):g.Z.warn("Transport: Unavailable time data for current text track."):(i=n.time,void 0!==n.duration?a=i+n.duration:!r&&o.complete&&(a=i+o.duration));var l=function(e){var t=e.codec;if(void 0===t)throw new Error("Cannot parse subtitles: unknown format");switch(t.toLowerCase()){case"stpp":case"stpp.ttml.im1t":return"ttml";case"wvtt":return"vtt"}throw new Error('The codec used for the subtitles "'+t+'" is not managed yet.')}(u),d=function(e){var t=(0,ue.Le)(e);return null===t?"":(0,b.uR)(t)}(t);return{data:d,type:l,language:s.language,start:i,end:a}}function de(e,t,n){var r,i,a=e.segment,o=e.adaptation,s=e.representation;if(a.isInit)return null;n?g.Z.warn("Transport: Unavailable time data for current text track."):(r=a.time,a.complete&&(i=a.time+a.duration));var u=function(e){var t=e.mimeType,n=void 0===t?"":t;switch(e.mimeType){case"application/ttml+xml":return"ttml";case"application/x-sami":case"application/smil":return"sami";case"text/vtt":return"vtt"}var r=e.codec;if("srt"===(void 0===r?"":r).toLowerCase())return"srt";throw new Error("could not find a text-track parser for the type "+n)}(s);return{data:t,type:u,language:o.language,start:r,end:i}}function ce(e){var t=e.__priv_patchLastSegmentInSidx;return function(e,n,r){var i,a=n.period,o=n.adaptation,s=n.representation,u=n.segment,d=e.data,c=e.isChunked;if(null===d)return u.isInit?{segmentType:"init",initializationData:null,initializationDataSize:0,protectionDataUpdate:!1,initTimescale:void 0}:{segmentType:"media",chunkData:null,chunkSize:0,chunkInfos:null,chunkOffset:null!==(i=u.timestampOffset)&&void 0!==i?i:0,protectionDataUpdate:!1,appendWindow:[a.start,a.end]};var f=M(o.type,s);if("webm"===f)throw new Error("Text tracks with a WEBM container are not yet handled.");return"mp4"===f?function(e,t,n,r,i){var a=n.period,o=n.representation,s=n.segment,u=s.isInit,d=s.indexRange,c="string"==typeof e?(0,b.tG)(e):e instanceof Uint8Array?e:new Uint8Array(e);if(u){var f=(0,V.Wf)(c,Array.isArray(d)?d[0]:0);if(!0===i&&null!==f&&f.length>0){var v=f[f.length-1];Array.isArray(v.range)&&(v.range[1]=1/0)}var p=(0,V.LD)(c);return o.index instanceof ie.Z&&null!==f&&f.length>0&&o.index.initializeIndex(f),{segmentType:"init",initializationData:null,initializationDataSize:0,protectionDataUpdate:!1,initTimescale:p}}var h=ae(c,t,s,r),m=le(n,c,h,t),g=(0,l.Z)(s.timestampOffset,0);return{segmentType:"media",chunkData:m,chunkSize:c.length,chunkInfos:h,chunkOffset:g,protectionDataUpdate:!1,appendWindow:[a.start,a.end]}}(d,c,n,r,t):function(e,t,n){var r,i,a=n.period,o=n.segment,s=o.timestampOffset,u=void 0===s?0:s;if(o.isInit)return{segmentType:"init",initializationData:null,initializationDataSize:0,protectionDataUpdate:!1,initTimescale:void 0};if("string"!=typeof e){var l=e instanceof Uint8Array?e:new Uint8Array(e);r=(0,b.uR)(l),i=l.length}else r=e;return{segmentType:"media",chunkData:de(n,r,t),chunkSize:i,chunkInfos:null,chunkOffset:u,protectionDataUpdate:!1,appendWindow:[a.start,a.end]}}(d,c,n)}}var fe=function(e){var t=(0,i.Z)({customManifestLoader:e.manifestLoader},null===r.Z.dashParsers.wasm||"initialized"!==r.Z.dashParsers.wasm.status&&"initializing"!==r.Z.dashParsers.wasm.status?"arraybuffer":"text"),n=S(e),a=function(e){var t=e.lowLatencyMode,n=e.segmentLoader;return!0!==e.checkMediaSegmentIntegrity?r:D(r);function r(e,r,i,a,o){var s=c(e,r.segment);if(null==s)return Promise.resolve({resultType:"segment-created",resultData:null});if(t||void 0===n)return B(s,r,t,i,o,a);var u={adaptation:r.adaptation,manifest:r.manifest,period:r.period,representation:r.representation,segment:r.segment,transport:"dash",timeout:i.timeout,url:s};return new Promise((function(e,l){var d=!1,c=n(u,{reject:function(e){var t,n,r;if(!d&&!a.isCancelled()){d=!0,a.deregister(f);var i=e,o=null!==(t=null==i?void 0:i.message)&&void 0!==t?t:"Unknown error when fetching a DASH segment through a custom segmentLoader.",s=new T.Z(o,null!==(n=null==i?void 0:i.canRetry)&&void 0!==n&&n,null!==(r=null==i?void 0:i.isOfflineError)&&void 0!==r&&r,null==i?void 0:i.xhr);l(s)}},resolve:function(t){d||a.isCancelled()||(d=!0,a.deregister(f),e({resultType:"segment-loaded",resultData:{responseData:t.data,size:t.size,requestDuration:t.duration}}))},progress:function(e){d||a.isCancelled()||o.onProgress({duration:e.duration,size:e.size,totalSize:e.totalSize})},fallback:function(){d||a.isCancelled()||(d=!0,a.deregister(f),B(s,r,t,i,o,a).then(e,l))}});function f(e){d||(d=!0,"function"==typeof c&&c(),l(e))}a.register(f)}))}}(e),o=se(e),s=function(e){var t=e.lowLatencyMode;return!0!==e.checkMediaSegmentIntegrity?n:D(n);function n(e,n,r,i,a){var o=n.adaptation,s=n.representation,l=n.segment,d=l.range,f=c(e,l);if(null===f)return Promise.resolve({resultType:"segment-created",resultData:null});if(l.isInit)return O(f,l,r,i,a);var v=M(o.type,s),p="mp4"===v||void 0===v;if(t&&p){if(Z())return U(f,n,r,a,i);(0,R.Z)("DASH: Your browser does not have the fetch API. You will have a higher chance of rebuffering when playing close to the live edge")}return p?(0,u.ZP)({url:f,responseType:"arraybuffer",headers:Array.isArray(d)?{Range:(0,x.Z)(d)}:null,timeout:r.timeout,onProgress:a.onProgress,cancelSignal:i}).then((function(e){return{resultType:"segment-loaded",resultData:e}})):(0,u.ZP)({url:f,responseType:"text",headers:Array.isArray(d)?{Range:(0,x.Z)(d)}:null,timeout:r.timeout,onProgress:a.onProgress,cancelSignal:i}).then((function(e){return{resultType:"segment-loaded",resultData:e}}))}}(e);return{manifest:{loadManifest:t,parseManifest:n},audio:{loadSegment:a,parseSegment:o},video:{loadSegment:a,parseSegment:o},text:{loadSegment:s,parseSegment:ce(e)},image:{loadSegment:f,parseSegment:p}}}},2339:function(e,t,n){"use strict";n.d(t,{Z:function(){return ye}});var r=n(5861),i=n(4687),a=n.n(i),o=n(7874),s=n(3887),u=n(1989),l=n(6807),d=n(9362),c=n(811),f=n(8232),v=n(3911),p=n(1091),h=n(5505);function m(e,t,n){var r=e.timeline,i=e.timescale,a=r[r.length-1],o=t.timescale===i?{time:t.time,duration:t.duration}:{time:t.time/t.timescale*i,duration:t.duration/t.timescale*i};return!(n.time===o.time)&&(o.time>=(0,v.jH)(a,null)&&(a.duration===o.duration?a.repeatCount++:e.timeline.push({duration:o.duration,start:o.time,repeatCount:0}),!0))}function g(e,t){return e.replace(/\{start time\}/g,String(t))}function y(e,t,n){var r=t-e;return r>0?Math.floor(r/n):0}function _(e,t){var n=e.repeatCount;if(null!=e.duration&&n<0){var r=void 0!==t?t.start:1/0;n=Math.ceil((r-e.start)/e.duration)-1}return n}var b=function(){function e(e,t){var n=t.aggressiveMode,r=t.isLive,i=t.segmentPrivateInfos,a=t.timeShiftBufferDepth,o=null==t.manifestReceivedTime?performance.now():t.manifestReceivedTime;if(this._index=e,this._indexValidityTime=o,this._timeShiftBufferDepth=a,this._initSegmentInfos={bitsPerSample:i.bitsPerSample,channels:i.channels,codecPrivateData:i.codecPrivateData,packetSize:i.packetSize,samplingRate:i.samplingRate,timescale:e.timescale,protection:i.protection},this._isAggressiveMode=n,this._isLive=r,0!==e.timeline.length){var s=e.timeline[e.timeline.length-1],u=(0,v.jH)(s,null);if(this._initialScaledLastPosition=u,r){var l=o/1e3*e.timescale;this._scaledLiveGap=l-u}}}var t=e.prototype;return t.getInitSegment=function(){return{id:"init",isInit:!0,privateInfos:{smoothInitSegment:this._initSegmentInfos},url:null,time:0,end:0,duration:0,timescale:1,complete:!0}},t.getSegments=function(e,t){this._refreshTimeline();for(var n,r=function(e,t,n){var r=void 0===e.timescale||0===e.timescale?1:e.timescale;return{up:t*r,to:(t+n)*r}}(this._index,e,t),i=r.up,a=r.to,o=this._index,s=o.timeline,u=o.timescale,l=o.media,d=this._isAggressiveMode,c=[],f=s.length,v=null==this._scaledLiveGap?void 0:performance.now()/1e3*u-this._scaledLiveGap,p=0;p=a)return c;null!=n&&(n+=S+1)}return c},t.shouldRefresh=function(e,t){if(this._refreshTimeline(),!this._isLive)return!1;var n=this._index,r=n.timeline,i=n.timescale,a=r[r.length-1];if(void 0===a)return!1;var o=a.repeatCount,s=a.start+(o+1)*a.duration;return!(t*i=s||e*i>a.start+o*a.duration)},t.getFirstAvailablePosition=function(){this._refreshTimeline();var e=this._index;return 0===e.timeline.length?null:e.timeline[0].start/e.timescale},t.getLastAvailablePosition=function(){this._refreshTimeline();var e=this._index;if(null==this._scaledLiveGap){var t=e.timeline[e.timeline.length-1];return(0,v.jH)(t,null)/e.timescale}for(var n=e.timeline.length-1;n>=0;n--)for(var r=e.timeline[n],i=performance.now()/1e3*e.timescale,a=r.start,o=r.duration,s=r.repeatCount;s>=0;s--){var u=a+o*(s+1);if((this._isAggressiveMode?u-o:u)<=i-this._scaledLiveGap)return u/e.timescale}},t.getEnd=function(){if(!this._isLive)return this.getLastAvailablePosition()},t.awaitSegmentBetween=function(e,t){var n;if((0,c.Z)(e<=t),this.isFinished())return!1;var r=this.getLastAvailablePosition();return!(void 0!==r&&t(null!==(n=this.getFirstAvailablePosition())&&void 0!==n?n:0)&&void 0)},t.checkDiscontinuity=function(e){return this._refreshTimeline(),(0,v._j)(this._index,e,void 0)},t.isSegmentStillAvailable=function(e){if(e.isInit)return!0;this._refreshTimeline();var t=this._index,n=t.timeline,r=t.timescale;return(0,p.Z)(e,n,r,0)},t.canBeOutOfSyncError=function(e){return!!this._isLive&&(e instanceof d.Z&&(e.isHttpError(404)||e.isHttpError(412)))},t._replace=function(e){var t=this._index.timeline,n=e._index.timeline,r=this._index.timescale,i=e._index.timescale;if(this._index=e._index,this._initialScaledLastPosition=e._initialScaledLastPosition,this._indexValidityTime=e._indexValidityTime,this._scaledLiveGap=e._scaledLiveGap,0!==t.length&&0!==n.length&&r===i){var a=t[t.length-1],o=n[n.length-1],u=(0,v.jH)(o,null);if(!((0,v.jH)(a,null)<=u))for(var l=0;lu){if(d.duration!==o.duration)return;var f=u-d.start;if(0===f)return s.Z.warn("Smooth Parser: a discontinuity detected in the previous manifest has been resolved."),void(this._index.timeline=this._index.timeline.concat(t.slice(l)));if(f<0||f%d.duration!=0)return;var p=f/d.duration-1,h=d.repeatCount-p;if(h<0)return;o.repeatCount+=h;var m=t.slice(l+1);return void(this._index.timeline=this._index.timeline.concat(m))}}}},t._update=function(e){(0,h.Z)(this._index.timeline,e._index.timeline),this._initialScaledLastPosition=e._initialScaledLastPosition,this._indexValidityTime=e._indexValidityTime,this._scaledLiveGap=e._scaledLiveGap},t.isFinished=function(){return!this._isLive},t.isInitialized=function(){return!0},t.addNewSegments=function(e,t){this._refreshTimeline();for(var n=0;n>3:2)?"mp4a.40.2":"mp4a.40."+n}(u,l);return{audiotag:void 0!==i?parseInt(i,10):i,bitrate:v,bitsPerSample:void 0!==a?parseInt(a,10):a,channels:void 0!==o?parseInt(o,10):o,codecPrivateData:u,codecs:p,customAttributes:n,mimeType:void 0!==l?F[l]:l,packetSize:void 0!==d?parseInt(d,10):d,samplingRate:void 0!==c?parseInt(c,10):c};case"video":var h=r("CodecPrivateData"),m=r("FourCC"),g=r("MaxWidth"),y=r("MaxHeight"),_=r("Bitrate"),b=void 0===_||isNaN(parseInt(_,10))?0:parseInt(_,10);if(void 0!==m&&void 0===F[m]||void 0===h)return s.Z.warn("Smooth parser: Unsupported video codec. Ignoring quality level."),null;var S=function(e){var t=/00000001\d7([0-9a-fA-F]{6})/.exec(e);return null!==t&&(0,k.Z)(t[1])?"avc1."+t[1]:"avc1.4D401E"}(h);return{bitrate:b,customAttributes:n,mimeType:void 0!==m?F[m]:m,codecPrivateData:h,codecs:S,width:void 0!==g?parseInt(g,10):void 0,height:void 0!==y?parseInt(y,10):void 0};case"text":var T=r("CodecPrivateData"),E=r("FourCC"),w=r("Bitrate");return{bitrate:void 0===w||isNaN(parseInt(w,10))?0:parseInt(w,10),customAttributes:n,mimeType:void 0!==E?F[E]:E,codecPrivateData:(0,Z.Z)(T,"")};default:return s.Z.error("Smooth Parser: Unrecognized StreamIndex type: "+t),null}}function o(t){var r=t.root,i=t.timescale,o=t.baseUrl,u=t.protections,l=t.timeShiftBufferDepth,d=t.manifestReceivedTime,f=t.isLive,v=r.getAttribute("Timescale"),p=null===v||isNaN(+v)?i:+v,h=r.getAttribute("Type");if(null===h)throw new Error("StreamIndex without type.");(0,T.Z)(S.r,h)||s.Z.warn("Smooth Parser: Unrecognized adaptation type:",h);var m=h,g=r.getAttribute("Subtype"),y=r.getAttribute("Language"),_=r.getAttribute("Url"),A=null===_?"":_;var Z,R=U(r,(function(e,t,r){switch(t){case"QualityLevel":var i=a(r,m);if(null===i)return e;("video"!==m||i.bitrate>n)&&e.qualityLevels.push(i);break;case"c":e.cNodes.push(r)}return e}),{qualityLevels:[],cNodes:[]}),x=R.qualityLevels,M=R.cNodes,P={timeline:(Z=M,Z.reduce((function(e,t,n){var r=t.getAttribute("d"),i=t.getAttribute("t"),a=t.getAttribute("r"),o=null!==a?+a-1:0,s=null!==i?+i:void 0,u=null!==r?+r:void 0;if(0===n)s=void 0===s||isNaN(s)?0:s;else{var l=e[n-1];if(null==s||isNaN(s)){if(null==l.duration||isNaN(l.duration))throw new Error("Smooth: Invalid CNodes. Missing timestamp.");s=l.start+l.duration*(l.repeatCount+1)}}if(null==u||isNaN(u)){var d=Z[n+1];if(void 0===d)return e;var c=d.getAttribute("t"),f=(0,k.Z)(c)?+c:null;if(null===f)throw new Error("Can't build index timeline from Smooth Manifest.");u=f-s}return e.push({duration:u,start:s,repeatCount:o}),e}),[])),timescale:p};(0,c.Z)(0!==x.length,"Adaptation should have at least one playable representation.");var D=m+((0,k.Z)(y)?"_"+y:""),N=x.map((function(t){var n,r,i,a,s={timeline:P.timeline,timescale:P.timescale,media:(n=A,r=t.bitrate,i=t.customAttributes,n.replace(/\{bitrate\}/g,String(r)).replace(/{CustomAttributes}/g,i.length>0?i[0]:""))},c=(0,k.Z)(t.mimeType)?t.mimeType:B[m],v=t.codecs,p=D+"_"+(null!=m?m+"-":"")+(null!=c?c+"-":"")+(null!=v?v+"-":"")+String(t.bitrate),h=[];u.length>0&&(a=u[0],u.forEach((function(e){var t=e.keyId;e.keySystems.forEach((function(e){h.push({keyId:t,systemId:e.systemId})}))})));var g={bitsPerSample:t.bitsPerSample,channels:t.channels,codecPrivateData:t.codecPrivateData,packetSize:t.packetSize,samplingRate:t.samplingRate,protection:null!=a?{keyId:a.keyId}:void 0},y=null!=e.aggressiveMode&&e.aggressiveMode,_=new b(s,{aggressiveMode:y,isLive:f,manifestReceivedTime:d,segmentPrivateInfos:g,timeShiftBufferDepth:l}),S=(0,w.Z)({},t,{index:_,cdnMetadata:[{baseUrl:o}],mimeType:c,codecs:v,id:p});if(h.length>0||void 0!==a){var T=void 0===a?[]:a.keySystems.map((function(e){var t=e.systemId,n=e.privateData,r=t.replace(/-/g,""),i=function(e,t){if(32!==e.length)throw new Error("HSS: wrong system id length");var n=0;return C("pssh",(0,E.zo)([n,0,0,0],(0,I.nr)(e),(0,E.kh)(t.length),t))}(r,n);return{systemId:r,data:i}}));if(T.length>0){var Z=[{type:"cenc",values:T}];S.contentProtections={keyIds:h,initData:Z}}else S.contentProtections={keyIds:h,initData:[]}}return S}));if("ADVT"===g)return null;var O={id:D,type:m,representations:N,language:null==y?void 0:y};return"text"===m&&"DESC"===g&&(O.closedCaption=!0),O}return function(n,r,a){var s="";if(void 0!==r){var u=(0,A.$)(r);s=r.substring(0,u)}var l=n.documentElement;if(null==l||"SmoothStreamingMedia"!==l.nodeName)throw new Error("document root should be SmoothStreamingMedia");var d=l.getAttribute("MajorVersion"),c=l.getAttribute("MinorVersion");if(null===d||null===c||!/^[2]-[0-2]$/.test(d+"-"+c))throw new Error("Version should be 2.0, 2.1 or 2.2");var f,v,p=l.getAttribute("Timescale"),h=(0,k.Z)(p)?isNaN(+p)?1e7:+p:1e7,m=U(l,(function(t,n,r){switch(n){case"Protection":t.protections.push(L(r,e.keySystems));break;case"StreamIndex":t.adaptationNodes.push(r)}return t}),{adaptationNodes:[],protections:[]}),g=m.protections,y=m.adaptationNodes,_="boolean"==typeof(f=l.getAttribute("IsLive"))?f:"string"==typeof f&&"TRUE"===f.toUpperCase();if(_){var b=l.getAttribute("DVRWindowLength");null==b||isNaN(+b)||0==+b||(v=+b/h)}var S,T,E,w,I,Z,R,x=y.reduce((function(e,t){var n=o({root:t,baseUrl:s,timescale:h,protections:g,isLive:_,timeShiftBufferDepth:v,manifestReceivedTime:a});if(null===n)return e;var r=n.type,i=e[r];return void 0===i?e[r]=[n]:i.push(n),e}),{}),M=null,C=void 0!==x.video?x.video[0]:void 0,P=void 0!==x.audio?x.audio[0]:void 0;if(void 0!==C||void 0!==P){var N=[],O=[];if(void 0!==C){var B=C.representations[0];if(void 0!==B){var F=B.index.getFirstAvailablePosition(),V=B.index.getLastAvailablePosition();null!=F&&N.push(F),null!=V&&O.push(V)}}if(void 0!==P){var z=P.representations[0];if(void 0!==z){var K=z.index.getFirstAvailablePosition(),G=z.index.getLastAvailablePosition();null!=K&&N.push(K),null!=G&&O.push(G)}}N.length>0&&(I=Math.max.apply(Math,N)),O.length>0&&(Z=Math.min.apply(Math,O),R=Math.max.apply(Math,O))}var W=l.getAttribute("Duration"),H=null!==W&&0!=+W?+W/h:void 0;if(_){S=e.suggestedPresentationDelay,T=t,E=null!=I?I:T;var j=R;void 0===j&&(j=Date.now()/1e3-T);var q=Z;void 0===q&&(q=j),w={isLinear:!0,maximumSafePosition:q,livePosition:j,time:performance.now()},M=null!=v?v:null}else{E=null!=I?I:0,w={isLinear:!1,maximumSafePosition:void 0!==Z?Z:void 0!==H?E+H:1/0,livePosition:void 0,time:performance.now()}}var Y=_?0:E,X=_?void 0:w.maximumSafePosition,Q={availabilityStartTime:void 0===T?0:T,clockOffset:i,isLive:_,isDynamic:_,isLastPeriodKnown:!0,timeBounds:{minimumSafePosition:E,timeshiftDepth:M,maximumTimeData:w},periods:[{adaptations:x,duration:void 0!==X?X-Y:H,end:X,id:"gen-smooth-period-0",start:Y}],suggestedPresentationDelay:S,transportType:"smooth",uris:null==r?[]:[r]};return D(Q),Q}},z=V,K=n(4597),G=n(8806),W=n(4460),H=n(8791),j=n(4644),q=n(2297);function Y(e,t,n,r,i){var a,o,u,d=[];if(i){var c=(0,l.XA)(e);null!==c?(u=function(e){var t=(0,q.nR)(e,3565190898,3392751253,2387879627,2655430559);if(void 0===t)return[];for(var n=[],r=t[0],i=t[4],a=0;a0;if(n)return e;var r=new Uint8Array(e.length+4);return r.set(e.subarray(0,t+8),0),r[t+3]=1|r[t+3],r.set([0,0,0,0],t+8),r.set(e.subarray(t+8,e.length),t+12),(0,j.J6)(r)}(l,s[1]-s[0]),f=te(u,d,c,i,(0,q.nR)(a,2721664850,1520127764,2722393154,2086964724)),v=P("moof",[i,f]),p=(0,q.Qy)(v,1836019558),h=(0,q.Qy)(f,1953653094),m=(0,q.Qy)(c,1953658222);if(null===p||null===h||null===m)throw new Error("Smooth: Invalid moof, trun or traf generation");var g=p[1]-p[0]+i.length+(h[1]-h[0])+u.length+d.length+(m[1]-m[0])+8,y=n[2]-n[0],_=v.length-y,b=(0,q.Qy)(e,1835295092);if(null===b)throw new Error("Smooth: Invalid ISOBMFF given");if(!X.YM&&(0===_||_<=-8)){var S=b[1];return v.set((0,E.kh)(S),g),e.set(v,n[0]),_<=-8&&e.set(C("free",new Uint8Array(-_-8)),v.length),e}var T=b[1]+_;v.set((0,E.kh)(T),g);var k=new Uint8Array(e.length+_),w=e.subarray(0,n[0]),A=e.subarray(n[2],e.length);return k.set(w,0),k.set(v,w.length),k.set(A,w.length+v.length),k}var re=n(7839),ie=n(281);function ae(e,t,n,r,i,a){var o,s,u,l=P("stbl",[n,C("stts",new Uint8Array(8)),C("stsc",new Uint8Array(8)),C("stsz",new Uint8Array(12)),C("stco",new Uint8Array(8))]),d=function(e){return C("dref",(0,E.zo)(7,[1],e))}(C("url ",new Uint8Array([0,0,0,1]))),c=P("dinf",[d]),f=P("minf",[r,c,l]),v=function(e){var t,n;switch(e){case"video":t="vide",n="VideoHandler";break;case"audio":t="soun",n="SoundHandler";break;default:t="hint",n=""}return C("hdlr",(0,E.zo)(8,(0,I.tG)(t),12,(0,I.tG)(n),1))}(t),p=function(e){return C("mdhd",(0,E.zo)(12,(0,E.kh)(e),8))}(e),h=P("mdia",[p,v,f]),m=function(e,t,n){return C("tkhd",(0,E.zo)((0,E.kh)(7),8,(0,E.kh)(n),20,[1,0,0,0],[0,1,0,0],12,[0,1,0,0],12,[64,0,0,0],(0,E.XT)(e),2,(0,E.XT)(t),2))}(i,a,1),g=P("trak",[m,h]),y=P("mvex",[(o=1,C("trex",(0,E.zo)(4,(0,E.kh)(o),[0,0,0,1],12)))]),_=function(e,t){return C("mvhd",(0,E.zo)(12,(0,E.kh)(e),4,[0,1],2,[1,0],10,[0,1],14,[0,1],14,[64,0,0,0],26,(0,E.XT)(t+1)))}(e,1),b=function(e,t,n){return P("moov",[e,t,n])}(_,y,g),S=(s="isom",u=["isom","iso2","iso6","avc1","dash"],C("ftyp",E.zo.apply(void 0,[(0,I.tG)(s),[0,0,0,1]].concat(u.map(I.tG)))));return(0,E.zo)(S,b)}function oe(e,t,n,r,i,a,o,s){var u=o.split("00000001"),l=u[1],d=u[2];if(void 0===l||void 0===d)throw new Error("Smooth: unsupported codec private data.");var c,f,v=function(e,t,n){var r=2===n?1:4===n?3:0,i=e[1],a=e[2],o=e[3];return C("avcC",(0,E.zo)([1,i,a,o,252|r,225],(0,E.XT)(e.length),e,[1],(0,E.XT)(t.length),t))}((0,I.nr)(l),(0,I.nr)(d),a);if(void 0===s){var p=function(e,t,n,r,i,a,o){return C("avc1",(0,E.zo)(6,(0,E.XT)(1),16,(0,E.XT)(e),(0,E.XT)(t),(0,E.XT)(n),2,(0,E.XT)(r),6,[0,1,i.length],(0,I.tG)(i),31-i.length,(0,E.XT)(a),[255,255],o))}(t,n,r,i,"AVC Coding",24,v);c=J([p])}else{var h=P("schi",[ee(1,8,s)]),m=Q("cenc",65536),g=function(e,t,n,r,i,a,o,s){return C("encv",(0,E.zo)(6,(0,E.XT)(1),16,(0,E.XT)(e),(0,E.XT)(t),(0,E.XT)(n),2,(0,E.XT)(r),6,[0,1,i.length],(0,I.tG)(i),31-i.length,(0,E.XT)(a),[255,255],o,s))}(t,n,r,i,"AVC Coding",24,v,P("sinf",[$("avc1"),m,h]));c=J([g])}return ae(e,"video",c,((f=new Uint8Array(12))[3]=1,C("vmhd",f)),t,n)}var se=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];function ue(e,t,n,r,i,a,o){var s,u,l,d=function(e,t){return C("esds",(0,E.zo)(4,[3,25],(0,E.XT)(e),[0,4,17,64,21],11,[5,2],(0,I.nr)(t),[6,1,2]))}(1,0===a.length?(s=i,u=t,l=((l=((l=(63&2)<<4)|31&se.indexOf(s))<<4)|31&u)<<3,(0,I.ci)((0,E.XT)(l))):a),c=function(){if(void 0===o){var e=function(e,t,n,r,i,a){return C("mp4a",(0,E.zo)(6,(0,E.XT)(e),8,(0,E.XT)(t),(0,E.XT)(n),2,(0,E.XT)(r),(0,E.XT)(i),2,a))}(1,t,n,r,i,d);return J([e])}var a=P("schi",[ee(1,8,o)]),s=Q("cenc",65536),u=P("sinf",[$("mp4a"),s,a]),l=function(e,t,n,r,i,a,o){return C("enca",(0,E.zo)(6,(0,E.XT)(e),8,(0,E.XT)(t),(0,E.XT)(n),2,(0,E.XT)(r),(0,E.XT)(i),2,a,o))}(1,t,n,r,i,d,u);return J([l])}();return ae(e,"audio",c,C("smhd",new Uint8Array(8)),0,0)}var le=/(\.isml?)(\?token=\S+)?$/,de=/\?token=(\S+)/;function ce(e,t){return(0,k.Z)(t)?e.replace(de,"?token="+t):e.replace(de,"")}function fe(e){return"string"==typeof e.mimeType&&e.mimeType.indexOf("mp4")>=0}function ve(e,t){return null===e?null:null===t.url?e.baseUrl:(0,A.Z)(e.baseUrl,t.url)}function pe(e,t,n,r,i,a){var o,s=t.segment.range;return Array.isArray(s)&&(o={Range:(0,ie.Z)(s)}),(0,K.ZP)({url:e,responseType:"arraybuffer",headers:o,timeout:r.timeout,cancelSignal:i,onProgress:n.onProgress}).then((function(e){if(!fe(t.representation)||!0!==a)return{resultType:"segment-loaded",resultData:e};var n=new Uint8Array(e.responseData);return(0,W.Z)(n,t.segment.isInit),{resultType:"segment-loaded",resultData:Object.assign(Object.assign({},e),{responseData:n})}}))}var he=function(e){var t=e.checkMediaSegmentIntegrity,n=e.customSegmentLoader;return function(e,r,i,a,o){var s=r.segment,u=r.manifest,l=r.period,d=r.adaptation,c=r.representation;if(s.isInit){if(void 0===s.privateInfos||void 0===s.privateInfos.smoothInitSegment)throw new Error("Smooth: Invalid segment format");var f,v=s.privateInfos.smoothInitSegment,p=v.codecPrivateData,h=v.timescale,m=v.protection,g=void 0===m?{keyId:void 0,keySystems:void 0}:m;if(void 0===p)throw new Error("Smooth: no codec private data.");switch(d.type){case"video":var y=c.width,_=void 0===y?0:y,b=c.height;f=oe(h,_,void 0===b?0:b,72,72,4,p,g.keyId);break;case"audio":var S=v.channels,T=void 0===S?0:S,E=v.bitsPerSample,k=void 0===E?0:E,w=v.packetSize,A=void 0===w?0:w,I=v.samplingRate;f=ue(h,T,k,A,void 0===I?0:I,p,g.keyId);break;default:0,f=new Uint8Array(0)}return Promise.resolve({resultType:"segment-created",resultData:f})}if(null===e)return Promise.resolve({resultType:"segment-created",resultData:null});var Z={adaptation:d,manifest:u,period:l,representation:c,segment:s,transport:"smooth",timeout:i.timeout,url:e};return"function"!=typeof n?pe(e,r,o,i,a,t):new Promise((function(s,u){var l=!1,d=n(Z,{reject:function(e){var t,n,r;if(!l&&!a.isCancelled()){l=!0,a.deregister(c);var i=e,o=null!==(t=null==i?void 0:i.message)&&void 0!==t?t:"Unknown error when fetching a Smooth segment through a custom segmentLoader.",s=new re.Z(o,null!==(n=null==i?void 0:i.canRetry)&&void 0!==n&&n,null!==(r=null==i?void 0:i.isOfflineError)&&void 0!==r&&r,null==i?void 0:i.xhr);u(s)}},resolve:function(e){if(!l&&!a.isCancelled()){l=!0,a.deregister(c),fe(r.representation)&&!0===t||s({resultType:"segment-loaded",resultData:{responseData:e.data,size:e.size,requestDuration:e.duration}});var n=e.data instanceof Uint8Array?e.data:new Uint8Array(e.data);(0,W.Z)(n,r.segment.isInit),s({resultType:"segment-loaded",resultData:{responseData:n,size:e.size,requestDuration:e.duration}})}},fallback:function(){l||a.isCancelled()||(l=!0,a.deregister(c),pe(e,r,o,i,a,t).then(s,u))},progress:function(e){l||a.isCancelled()||o.onProgress({duration:e.duration,size:e.size,totalSize:e.totalSize})}});function c(e){l||((l=!0)||"function"!=typeof d||d(),u(e))}a.register(c)}))}},me=/\.wsx?(\?token=\S+)?/;function ge(e,t,n){var r;s.Z.debug("Smooth Parser: update segments information.");for(var i=e.representations,a=0;a0&&ge(o,v,a),{segmentType:"media",chunkData:h,chunkInfos:p,chunkOffset:0,chunkSize:h.length,protectionDataUpdate:!1,appendWindow:[void 0,void 0]}}},c={loadSegment:function(t,n,r,i,a){var o=n.segment,s=n.representation,u=ve(t,o);return o.isInit||null===u?Promise.resolve({resultType:"segment-created",resultData:null}):fe(s)?(0,K.ZP)({url:u,responseType:"arraybuffer",timeout:r.timeout,cancelSignal:i,onProgress:a.onProgress}).then((function(t){if(!0!==e.checkMediaSegmentIntegrity)return{resultType:"segment-loaded",resultData:t};var r=new Uint8Array(t.responseData);return(0,W.Z)(r,n.segment.isInit),{resultType:"segment-loaded",resultData:Object.assign(Object.assign({},t),{responseData:r})}})):(0,K.ZP)({url:u,responseType:"text",timeout:r.timeout,cancelSignal:i,onProgress:a.onProgress}).then((function(e){return{resultType:"segment-loaded",resultData:e}}))},parseSegment:function(e,t,n){var r,i,a,o=t.manifest,u=t.adaptation,d=t.representation,c=t.segment,f=u.language,v=fe(d),p=d.mimeType,h=void 0===p?"":p,m=d.codec,g=void 0===m?"":m,y=e.data,_=e.isChunked;if(c.isInit)return{segmentType:"init",initializationData:null,initializationDataSize:0,protectionDataUpdate:!1,initTimescale:void 0};if(null===y)return{segmentType:"media",chunkData:null,chunkInfos:null,chunkOffset:0,chunkSize:0,protectionDataUpdate:!1,appendWindow:[void 0,void 0]};var b,S,T,E,k=null;if(v){var w;i=(w="string"==typeof y?(0,I.tG)(y):y instanceof Uint8Array?y:new Uint8Array(y)).length;var A=void 0!==n?Y(w,_,n,c,o.isLive):null;a=null==A?void 0:A.nextSegments,null===(k=null!==(r=null==A?void 0:A.chunkInfos)&&void 0!==r?r:null)?_?s.Z.warn("Smooth: Unavailable time data for current text track."):(b=c.time,S=c.end):(b=k.time,S=void 0!==k.duration?k.time+k.duration:c.end);var Z=g.toLowerCase();if("application/ttml+xml+mp4"===h||"stpp"===Z||"stpp.ttml.im1t"===Z)E="ttml";else{if("wvtt"!==Z)throw new Error("could not find a text-track parser for the type "+h);E="vtt"}var R=(0,l.Le)(w);T=null===R?"":(0,I.uR)(R)}else{var x;if(b=c.time,S=c.end,"string"!=typeof y){var M=y instanceof Uint8Array?y:new Uint8Array(y);i=M.length,x=(0,I.uR)(M)}else x=y;switch(h){case"application/x-sami":case"application/smil":E="sami";break;case"application/ttml+xml":E="ttml";break;case"text/vtt":E="vtt"}if(void 0===E){if("srt"!==g.toLowerCase())throw new Error("could not find a text-track parser for the type "+h);E="srt"}T=x}return null!==k&&Array.isArray(a)&&a.length>0&&ge(u,a,c),{segmentType:"media",chunkData:{type:E,data:T,start:b,end:S,language:f},chunkSize:i,chunkInfos:k,chunkOffset:null!=b?b:0,protectionDataUpdate:!1,appendWindow:[void 0,void 0]}}};return{manifest:{resolveManifestUrl:function(e,t){if(void 0===e)return Promise.resolve(void 0);var n;me.test(e)?((0,G.Z)("Giving WSX URL to loadVideo is deprecated. You should only give Manifest URLs."),n=(0,K.ZP)({url:ce(e,""),responseType:"document",cancelSignal:t}).then((function(e){var t=e.responseData.getElementsByTagName("media")[0].getAttribute("src");if(null===t||0===t.length)throw new Error("Invalid ISML");return t}))):n=Promise.resolve(e);var r=function(e){var t=de.exec(e);if(null!==t){var n=t[1];if(void 0!==n)return n}return""}(e);return n.then((function(e){return ce(function(e){return le.test(e)?((0,G.Z)("Giving a isml URL to loadVideo is deprecated. Please give the Manifest URL directly"),e.replace(le,"$1/manifest$2")):e}(e),r)}))},loadManifest:(0,H.Z)(i,"text"),parseManifest:function(n,r){var i,a=null!==(i=n.url)&&void 0!==i?i:r.originalUrl,o=n.receivedTime,s=n.responseData,l="string"==typeof s?(new DOMParser).parseFromString(s,"text/xml"):s,d=t(l,a,o);return{manifest:new u.ZP(d,{representationFilter:e.representationFilter,supplementaryImageTracks:e.supplementaryImageTracks,supplementaryTextTracks:e.supplementaryTextTracks}),url:a}}},audio:d,video:d,text:c,image:{loadSegment:function(e,t,n,i,o){return(0,r.Z)(a().mark((function r(){var s,u,l;return a().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(s=t.segment,u=ve(e,s),!s.isInit&&null!==u){r.next=4;break}return r.abrupt("return",{resultType:"segment-created",resultData:null});case 4:return r.next=6,(0,K.ZP)({url:u,responseType:"arraybuffer",timeout:n.timeout,onProgress:o.onProgress,cancelSignal:i});case 6:return l=r.sent,r.abrupt("return",{resultType:"segment-loaded",resultData:l});case 8:case"end":return r.stop()}}),r)})))()},parseSegment:function(e,t,n){var r=e.data,i=e.isChunked;if(t.segment.isInit)return{segmentType:"init",initializationData:null,initializationDataSize:0,protectionDataUpdate:!1,initTimescale:void 0};if(i)throw new Error("Image data should not be downloaded in chunks");return null===r||null===o.Z.imageParser?{segmentType:"media",chunkData:null,chunkInfos:null,chunkOffset:0,chunkSize:0,protectionDataUpdate:!1,appendWindow:[void 0,void 0]}:{segmentType:"media",chunkData:{data:o.Z.imageParser(new Uint8Array(r)).thumbs,start:0,end:Number.MAX_VALUE,timescale:1,type:"bif"},chunkInfos:{time:0,duration:Number.MAX_VALUE},chunkSize:void 0,chunkOffset:0,protectionDataUpdate:!1,appendWindow:[void 0,void 0]}}}}}},281:function(e,t,n){"use strict";function r(e){var t=e[0],n=e[1];return n===1/0?"bytes="+t+"-":"bytes="+t+"-"+n}n.d(t,{Z:function(){return r}})},4460:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(5389),i=n(8766);function a(e,t){if(t){if((0,i.Z)(e,1718909296)<0)throw new r.Z("INTEGRITY_ERROR","Incomplete `ftyp` box");if((0,i.Z)(e,1836019574)<0)throw new r.Z("INTEGRITY_ERROR","Incomplete `moov` box")}else{if((0,i.Z)(e,1836019558)<0)throw new r.Z("INTEGRITY_ERROR","Incomplete `moof` box");if((0,i.Z)(e,1835295092)<0)throw new r.Z("INTEGRITY_ERROR","Incomplete `mdat` box")}}},8766:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(6968);function i(e,t){for(var n=e.length,i=0;i+8<=n;){var a=(0,r.pX)(e,i);if(0===a)a=n-i;else if(1===a){if(i+16>n)return-1;a=(0,r.pV)(e,i+8)}if(isNaN(a)||a<=0)return-1;if((0,r.pX)(e,i+4)===t)return i+a<=n?i:-1;i+=a}return-1}},8791:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var r=n(7904),i=n(4597),a=n(7839);function o(e,t){var n=e.customManifestLoader,o=function(e){return function(t,n,a){if(void 0===t)throw new Error("Cannot perform HTTP(s) request. URL not known");switch(e){case"arraybuffer":return(0,i.ZP)({url:t,responseType:"arraybuffer",timeout:n.timeout,cancelSignal:a});case"text":return(0,i.ZP)({url:t,responseType:"text",timeout:n.timeout,cancelSignal:a});case"document":return(0,i.ZP)({url:t,responseType:"document",timeout:n.timeout,cancelSignal:a});default:(0,r.Z)(e)}}}(t);return"function"!=typeof n?o:function(e,t){return function(n,r,i){return new Promise((function(o,s){var u=Date.now()-performance.now(),l=!1,d=e(n,{reject:function(e){var t,n,r;if(!l&&!i.isCancelled()){l=!0,i.deregister(c);var o=e,u=null!==(t=null==o?void 0:o.message)&&void 0!==t?t:"Unknown error when fetching the Manifest through a custom manifestLoader.",d=new a.Z(u,null!==(n=null==o?void 0:o.canRetry)&&void 0!==n&&n,null!==(r=null==o?void 0:o.isOfflineError)&&void 0!==r&&r,null==o?void 0:o.xhr);s(d)}},resolve:function(e){if(!l&&!i.isCancelled()){l=!0,i.deregister(c);var t=void 0!==e.receivingTime?e.receivingTime-u:void 0,n=void 0!==e.sendingTime?e.sendingTime-u:void 0;o({responseData:e.data,size:e.size,requestDuration:e.duration,url:e.url,receivedTime:t,sendingTime:n})}},fallback:function(){l||i.isCancelled()||(l=!0,i.deregister(c),t(n,r,i).then(o,s))}},{timeout:r.timeout});function c(e){l||(l=!0,"function"==typeof d&&d(),s(e))}i.register(c)}))}}(n,o)}},4791:function(e,t,n){"use strict";function r(e,t){if(e.length!==t.length)return!1;for(var n=e.length-1;n>=0;n--)if(e[n]!==t[n])return!1;return!0}n.d(t,{Z:function(){return r}})},3274:function(e,t,n){"use strict";function r(e,t,n){if("function"==typeof Array.prototype.find)return e.find(t,n);for(var r=e.length>>>0,i=0;i>>0,i=0;i>>0;if(0===r)return!1;for(var i,a,o=0|n,s=o>=0?Math.min(o,r-1):Math.max(r+o,0);s=a.length)throw new Error("Unable to parse base64 string.");var t=a[e];if(255===t)throw new Error("Unable to parse base64 string.");return t}function s(e){var t,n="",r=e.length;for(t=2;t>2],n+=i[(3&e[t-2])<<4|e[t-1]>>4],n+=i[(15&e[t-1])<<2|e[t]>>6],n+=i[63&e[t]];return t===r+1&&(n+=i[e[t-2]>>2],n+=i[(3&e[t-2])<<4],n+="=="),t===r&&(n+=i[e[t-2]>>2],n+=i[(3&e[t-2])<<4|e[t-1]>>4],n+=i[(15&e[t-1])<<2],n+="="),n}function u(e){var t=e.length%4,n=e;0!==t&&(r.Z.warn("base64ToBytes: base64 given miss padding"),n+=3===t?"=":2===t?"==":"===");var i=n.indexOf("=");if(-1!==i&&i>16,l[c+1]=a>>8&255,l[c+2]=255&a;return l.subarray(0,l.length-s)}},6968:function(e,t,n){"use strict";function r(){for(var e,t=arguments.length,n=-1,r=0;++n0&&(i.set(e,a),a+=e.length);return i}function i(e,t){return(e[t+0]<<8)+(e[t+1]<<0)}function a(e,t){return 65536*e[t+0]+256*e[t+1]+e[t+2]}function o(e,t){return 16777216*e[t+0]+65536*e[t+1]+256*e[t+2]+e[t+3]}function s(e,t){return 4294967296*(16777216*e[t+0]+65536*e[t+1]+256*e[t+2]+e[t+3])+16777216*e[t+4]+65536*e[t+5]+256*e[t+6]+e[t+7]}function u(e){return new Uint8Array([e>>>8&255,255&e])}function l(e){return new Uint8Array([e>>>24&255,e>>>16&255,e>>>8&255,255&e])}function d(e){var t=e%4294967296,n=(e-t)/4294967296;return new Uint8Array([n>>>24&255,n>>>16&255,n>>>8&255,255&n,t>>>24&255,t>>>16&255,t>>>8&255,255&t])}function c(e,t){return(e[t+0]<<0)+(e[t+1]<<8)}function f(e,t){return e[t+0]+256*e[t+1]+65536*e[t+2]+16777216*e[t+3]}function v(e){return new Uint8Array([255&e,e>>>8&255,e>>>16&255,e>>>24&255])}function p(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer)}n.d(t,{O_:function(){return v},QI:function(){return a},XT:function(){return u},_f:function(){return p},dN:function(){return f},el:function(){return d},kh:function(){return l},pV:function(){return s},pX:function(){return o},qb:function(){return c},zK:function(){return i},zo:function(){return r}})},7864:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(7733);function i(e,t){return(0,r.Z)(t,(function(t){var n=setTimeout((function(){return t()}),e);return function(){return clearTimeout(n)}}))}},7733:function(e,t,n){"use strict";function r(e,t){var n;return new Promise((function(r,i){if(null!==e.cancellationError)return i(e.cancellationError);var a=!1;function o(e){void 0!==n&&n(),i(e)}n=t((function(t){e.deregister(o),a=!0,r(t)}),(function(t){e.deregister(o),a=!0,i(t)})),a||e.register(o)}))}n.d(t,{Z:function(){return r}})},1959:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(3887),i=n(1946),a=function(){function e(){this._listeners={}}var t=e.prototype;return t.addEventListener=function(e,t,n){var r=this,i=this._listeners[e];Array.isArray(i)?i.push(t):this._listeners[e]=[t],void 0!==n&&n.register((function(){r.removeEventListener(e,t)}))},t.removeEventListener=function(e,t){if((0,i.Z)(e))this._listeners={};else{var n=this._listeners[e];if(Array.isArray(n))if((0,i.Z)(t))delete this._listeners[e];else{var r=n.indexOf(t);-1!==r&&n.splice(r,1),0===n.length&&delete this._listeners[e]}}},t.trigger=function(e,t){var n=this._listeners[e];Array.isArray(n)&&n.slice().forEach((function(e){try{e(t)}catch(e){r.Z.error("EventEmitter: listener error",e instanceof Error?e:null)}}))},e}()},9592:function(e,t,n){"use strict";function r(e,t){return"function"==typeof Array.prototype.flatMap?e.flatMap(t):e.reduce((function(e,n){var r=t(n);return Array.isArray(r)?(e.push.apply(e,r),e):(e.push(r),e)}),[])}n.d(t,{Z:function(){return r}})},2572:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=.3;function i(e){return e*((2*Math.random()-1)*r+1)}},2870:function(e,t,n){"use strict";function r(e){for(var t=0,n=0;n=Number.MAX_SAFE_INTEGER&&(e+="0",t=0),e+String(t)}}n.d(t,{Z:function(){return r}})},6923:function(e,t,n){"use strict";function r(e){return"string"==typeof e&&e.length>0}n.d(t,{Z:function(){return r}})},1946:function(e,t,n){"use strict";function r(e){return null==e}n.d(t,{Z:function(){return r}})},7829:function(e,t,n){"use strict";var r=n(5553);t.ZP=r.ZP},5553:function(e,t,n){"use strict";n.d(t,{ZP:function(){return d},iH:function(){return l},Y1:function(){return u}});var r=n(6923),i=n(1946),a={aa:"aar",ab:"abk",ae:"ave",af:"afr",ak:"aka",am:"amh",an:"arg",ar:"ara",as:"asm",av:"ava",ay:"aym",az:"aze",ba:"bak",be:"bel",bg:"bul",bi:"bis",bm:"bam",bn:"ben",bo:"bod",br:"bre",bs:"bos",ca:"cat",ce:"che",ch:"cha",co:"cos",cr:"cre",cs:"ces",cu:"chu",cv:"chv",cy:"cym",da:"dan",de:"deu",dv:"div",dz:"dzo",ee:"ewe",el:"ell",en:"eng",eo:"epo",es:"spa",et:"est",eu:"eus",fa:"fas",ff:"ful",fi:"fin",fj:"fij",fo:"fao",fr:"fra",fy:"fry",ga:"gle",gd:"gla",gl:"glg",gn:"grn",gu:"guj",gv:"glv",ha:"hau",he:"heb",hi:"hin",ho:"hmo",hr:"hrv",ht:"hat",hu:"hun",hy:"hye",hz:"her",ia:"ina",id:"ind",ie:"ile",ig:"ibo",ii:"iii",ik:"ipk",io:"ido",is:"isl",it:"ita",iu:"iku",ja:"jpn",jv:"jav",ka:"kat",kg:"kon",ki:"kik",kj:"kua",kk:"kaz",kl:"kal",km:"khm",kn:"kan",ko:"kor",kr:"kau",ks:"kas",ku:"kur",kv:"kom",kw:"cor",ky:"kir",la:"lat",lb:"ltz",lg:"lug",li:"lim",ln:"lin",lo:"lao",lt:"lit",lu:"lub",lv:"lav",mg:"mlg",mh:"mah",mi:"mri",mk:"mkd",ml:"mal",mn:"mon",mr:"mar",ms:"msa",mt:"mlt",my:"mya",na:"nau",nb:"nob",nd:"nde",ne:"nep",ng:"ndo",nl:"nld",nn:"nno",no:"nor",nr:"nbl",nv:"nav",ny:"nya",oc:"oci",oj:"oji",om:"orm",or:"ori",os:"oss",pa:"pan",pi:"pli",pl:"pol",ps:"pus",pt:"por",qu:"que",rm:"roh",rn:"run",ro:"ron",ru:"rus",rw:"kin",sa:"san",sc:"srd",sd:"snd",se:"sme",sg:"sag",si:"sin",sk:"slk",sl:"slv",sm:"smo",sn:"sna",so:"som",sq:"sqi",sr:"srp",ss:"ssw",st:"sot",su:"sun",sv:"swe",sw:"swa",ta:"tam",te:"tel",tg:"tgk",th:"tha",ti:"tir",tk:"tuk",tl:"tgl",tn:"tsn",to:"ton",tr:"tur",ts:"tso",tt:"tat",tw:"twi",ty:"tah",ug:"uig",uk:"ukr",ur:"urd",uz:"uzb",ve:"ven",vi:"vie",vo:"vol",wa:"wln",wo:"wol",xh:"xho",yi:"yid",yo:"yor",za:"zha",zh:"zho",zu:"zul"},o={alb:"sqi",arm:"hye",baq:"eus",bur:"mya",chi:"zho",cze:"ces",dut:"nld",fre:"fra",geo:"kat",ger:"deu",gre:"ell",ice:"isl",mac:"mkd",mao:"mri",may:"msa",per:"fas",slo:"slk",rum:"ron",tib:"bod",wel:"cym"};function s(e){if((0,i.Z)(e)||""===e)return"";var t=function(e){var t;switch(e.length){case 2:t=a[e];break;case 3:t=o[e]}return t}((""+e).toLowerCase().split("-")[0]);return(0,r.Z)(t)?t:e}function u(e){if(!(0,i.Z)(e)){var t,n=!1;return"string"==typeof e?t=e:(t=e.language,!0===e.closedCaption&&(n=!0)),{language:t,closedCaption:n,normalized:s(t)}}return e}function l(e){if((0,i.Z)(e))return e;if("string"==typeof e)return{language:e,audioDescription:!1,normalized:s(e)};var t={language:e.language,audioDescription:!0===e.audioDescription,normalized:s(s(e.language))};return!0===e.isDub&&(t.isDub=!0),t}var d=s},8894:function(e,t,n){"use strict";function r(){}n.d(t,{Z:function(){return r}})},8026:function(e,t){"use strict";t.Z="function"==typeof Object.assign?Object.assign:function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=0;n<(arguments.length<=1?0:arguments.length-1);n++){var r=n+1<1||arguments.length<=n+1?void 0:arguments[n+1];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t}},1679:function(e,t,n){"use strict";t.Z="function"==typeof Object.values?Object.values:function(e){return Object.keys(e).map((function(t){return e[t]}))}},2829:function(e,t,n){"use strict";n.d(t,{A1:function(){return s},DD:function(){return m},F_:function(){return p},JN:function(){return c},L7:function(){return g},Ti:function(){return u},XS:function(){return v},at:function(){return h},kR:function(){return y},rx:function(){return f},tn:function(){return b},uH:function(){return S}});var r=1/60;function i(e,t){return Math.abs(e-t)=0;n--){var r=e.start(n);if(t>=r){var i=e.end(n);if(t=o?r.push({start:a,end:o}):n={start:a,end:o}}return{outerRanges:r,innerRange:n}}function h(e,t){var n=f(e,t);return null!==n?n.end-n.start:0}function m(e,t){var n=f(e,t);return null!==n?t-n.start:0}function g(e,t){var n=f(e,t);return null!==n?n.end-t:1/0}function y(e,t){if(t.start===t.end)return e;for(var n=t,r=0;r0)for(var o=0;o0)for(var s=0;sl&&n.push({start:l,end:a[d].start}),l=a[d].end;l=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0&&i.splice(e,1)}}i.push(r),!0===(null==t?void 0:t.emitCurrentValue)&&e(n,o),a||r.hasBeenCleared?o():void 0!==(null==t?void 0:t.clearSignal)&&t.clearSignal.register(o)},waitUntilDefined:function(e,t){this.onUpdate((function(t,r){void 0!==t&&(r(),e(n))}),{clearSignal:null==t?void 0:t.clearSignal,emitCurrentValue:!0})},finish:o};function o(){void 0!==t&&t.deregister(o),a=!0;for(var e,n=r(i.slice());!(e=n()).done;){var s=e.value;try{s.hasBeenCleared||(s.complete(),s.hasBeenCleared=!0)}catch(e){}}i.length=0}}function o(e,t,n){var r=a(t(e.getValue()),n);return e.onUpdate((function(e){r.setValue(t(e))}),{clearSignal:n}),r}n.d(t,{$l:function(){return a},ZP:function(){return a},lR:function(){return o}})},4597:function(e,t,n){"use strict";n.d(t,{ZP:function(){return o}});var r=n(9105),i=n(6923),a=n(1946);var o=function(e){var t={url:e.url,headers:e.headers,responseType:(0,a.Z)(e.responseType)?"json":e.responseType,timeout:e.timeout};return new Promise((function(n,o){var s,u=e.onProgress,l=e.cancelSignal,d=t.url,c=t.headers,f=t.responseType,v=t.timeout,p=new XMLHttpRequest;if(p.open("GET",d,!0),void 0!==v&&(p.timeout=v,s=window.setTimeout((function(){_(),o(new r.Z(d,p.status,"TIMEOUT",p))}),v+3e3)),p.responseType=f,"document"===p.responseType&&p.overrideMimeType("text/xml"),!(0,a.Z)(c)){var h=c;for(var m in h)h.hasOwnProperty(m)&&p.setRequestHeader(m,h[m])}var g=performance.now(),y=null;function _(){void 0!==s&&clearTimeout(s),null!==y&&y()}void 0!==l&&(y=l.register((function(e){_(),(0,a.Z)(p)||4===p.readyState||p.abort(),o(e)})),l.isCancelled())||(p.onerror=function(){_(),o(new r.Z(d,p.status,"ERROR_EVENT",p))},p.ontimeout=function(){_(),o(new r.Z(d,p.status,"TIMEOUT",p))},void 0!==u&&(p.onprogress=function(e){var t=performance.now();u({url:d,duration:t-g,sendingTime:g,currentTime:t,size:e.loaded,totalSize:e.total})}),p.onload=function(e){if(4===p.readyState)if(_(),p.status>=200&&p.status<300){var t,s=performance.now(),u=p.response instanceof ArrayBuffer?p.response.byteLength:e.total,l=p.status,c=p.responseType,f=(0,i.Z)(p.responseURL)?p.responseURL:d;if(t="json"===c?"object"==typeof p.response?p.response:function(e){try{return JSON.parse(e)}catch(e){return null}}(p.responseText):p.response,(0,a.Z)(t))return void o(new r.Z(d,p.status,"PARSE_ERROR",p));n({status:l,url:f,responseType:c,sendingTime:g,receivedTime:s,requestDuration:s-g,size:u,responseData:t})}else o(new r.Z(d,p.status,"ERROR_HTTP_CODE",p))},p.send())}))}},9829:function(e,t,n){"use strict";n.d(t,{$:function(){return o},Z:function(){return a}});var r=/^(?:[a-z]+:)?\/\//i,i=/\/\.{1,2}\//;function a(){var e=arguments.length;if(0===e)return"";for(var t="",n=0;n=0&&t===n+1)return e.length}var i=e.indexOf("?");return i>=0&&i>8&255}return n}function u(e){if(a)try{return new TextDecoder("utf-16le").decode(e)}catch(e){var t=e instanceof Error?e:"";r.Z.warn("Utils: could not use TextDecoder to parse UTF-16LE, fallbacking to another implementation",t)}for(var n="",i=0;i=t?n:new Array(t-n.length+1).join("0")+n}function c(e){if(a)try{return(new TextDecoder).decode(e)}catch(e){var t=e instanceof Error?e:"";r.Z.warn("Utils: could not use TextDecoder to parse UTF-8, fallbacking to another implementation",t)}var n=e;239===n[0]&&187===n[1]&&191===n[2]&&(n=n.subarray(3));var i,o=function(e){for(var t="",n=0;n=256?"%u"+d(l,4):"%"+d(l,2)}}return decodeURIComponent(i)}function f(e){for(var t=e.length,n=new Uint8Array(t/2),r=0,i=0;r>>4).toString(16),n+=(15&e[r]).toString(16),t.length>0&&r0;)try{var n=t._listeners.pop();null==n||n(e)}catch(e){o.Z.error("Error while calling clean up listener",e instanceof Error?e.toString():"Unknown error")}}))}var t=e.prototype;return t.isCancelled=function(){return this._isCancelled},t.register=function(e){var t=this;return this._isCancelled?((0,s.Z)(null!==this.cancellationError),e(this.cancellationError),u.Z):(this._listeners.push(e),function(){return t.deregister(e)})},t.deregister=function(e){for(var t=this._listeners.length-1;t>=0;t--)this._listeners[t]===e&&this._listeners.splice(t,1)},e}(),c=function(e){function t(){var n;return n=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(n),t.prototype),n.name="CancellationError",n.message="This task was cancelled.",n}return(0,i.Z)(t,e),t}((0,a.Z)(Error))},8806:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(7714),i=[];function a(e){(0,r.Z)(i,e)||(console.warn(e),i.push(e))}},7473:function(e){"use strict";var t=function(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return e},n=function(e){var n,r,i=document.createTextNode(""),a=0;return new e((function(){var e;if(n)r&&(n=r.concat(n));else{if(!r)return;n=r}if(r=n,n=null,"function"==typeof r)return e=r,r=null,void e();for(i.data=a=++a%2;r;)e=r.shift(),r.length||(r=null),e()})).observe(i,{characterData:!0}),function(e){t(e),n?"function"==typeof n?n=[n,e]:n.push(e):(n=e,i.data=a=++a%2)}};e.exports=function(){if("object"==typeof process&&process&&"function"==typeof process.nextTick)return process.nextTick;if("function"==typeof queueMicrotask)return function(e){queueMicrotask(t(e))};if("object"==typeof document&&document){if("function"==typeof MutationObserver)return n(MutationObserver);if("function"==typeof WebKitMutationObserver)return n(WebKitMutationObserver)}return"function"==typeof setImmediate?function(e){setImmediate(t(e))}:"function"==typeof setTimeout||"object"==typeof setTimeout?function(e){setTimeout(t(e),0)}:null}()},7061:function(e,t,n){var r=n(8698).default;function i(){"use strict";e.exports=i=function(){return t},e.exports.__esModule=!0,e.exports.default=e.exports;var t={},n=Object.prototype,a=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},s="function"==typeof Symbol?Symbol:{},u=s.iterator||"@@iterator",l=s.asyncIterator||"@@asyncIterator",d=s.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function f(e,t,n,r){var i=t&&t.prototype instanceof h?t:h,a=Object.create(i.prototype),s=new Z(r||[]);return o(a,"_invoke",{value:k(e,n,s)}),a}function v(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=f;var p={};function h(){}function m(){}function g(){}var y={};c(y,u,(function(){return this}));var _=Object.getPrototypeOf,b=_&&_(_(R([])));b&&b!==n&&a.call(b,u)&&(y=b);var S=g.prototype=h.prototype=Object.create(y);function T(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function E(e,t){function n(i,o,s,u){var l=v(e[i],e,o);if("throw"!==l.type){var d=l.arg,c=d.value;return c&&"object"==r(c)&&a.call(c,"__await")?t.resolve(c.__await).then((function(e){n("next",e,s,u)}),(function(e){n("throw",e,s,u)})):t.resolve(c).then((function(e){d.value=e,s(d)}),(function(e){return n("throw",e,s,u)}))}u(l.arg)}var i;o(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,i){n(e,r,t,i)}))}return i=i?i.then(a,a):a()}})}function k(e,t,n){var r="suspendedStart";return function(i,a){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw a;return x()}for(n.method=i,n.arg=a;;){var o=n.delegate;if(o){var s=w(o,n);if(s){if(s===p)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=v(e,t,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===p)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}function w(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),p;var i=v(r,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,p;var a=i.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,p):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,p)}function A(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function Z(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(A,this),this.reset(!0)}function R(e){if(e){var t=e[u];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function t(){for(;++n=0;--r){var i=this.tryEntries[r],o=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=a.call(i,"catchLoc"),u=a.call(i,"finallyLoc");if(s&&u){if(this.prev=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&a.call(r,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),I(n),p}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;I(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:R(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),p}},t}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports},8698:function(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},4687:function(e,t,n){var r=n(7061)();e.exports=r;try{regeneratorRuntime=r}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}},7326:function(e,t,n){"use strict";function r(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}n.d(t,{Z:function(){return r}})},5861:function(e,t,n){"use strict";function r(e,t,n,r,i,a,o){try{var s=e[a](o),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function i(e){return function(){var t=this,n=arguments;return new Promise((function(i,a){var o=e.apply(t,n);function s(e){r(o,i,a,s,u,"next",e)}function u(e){r(o,i,a,s,u,"throw",e)}s(void 0)}))}}n.d(t,{Z:function(){return i}})},1656:function(e,t,n){"use strict";function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function i(e){var t=function(e,t){if("object"!==r(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!==r(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===r(t)?t:String(t)}function a(e,t){for(var n=0;ni)break}if(u<0||n.length!==t.length)return l.Z.error("ABR: Current Bitrate not found in the calculated levels"),n[0];void 0!==a&&(s=0===o?a.score:a.score/o);var f=isFinite(r)?r:0,v=performance.now();if(f=0;m--)if(f>=t[m])return n[m];return n[0]}if(void 0!==this._lastUnsuitableQualityTimestamp&&v-this._lastUnsuitableQualityTimestampg)return e}();if(void 0!==y&&r>=t[y])return l.Z.debug("ABR: Raising quality in BufferBasedChooser",n[y]),n[y];return i},e}(),z=n(3274),K=function(){function e(e){this._alpha=Math.exp(Math.log(.5)/e),this._lastEstimate=0,this._totalWeight=0}var t=e.prototype;return t.addSample=function(e,t){var n=Math.pow(this._alpha,e),r=t*(1-n)+n*this._lastEstimate;isNaN(r)||(this._lastEstimate=r,this._totalWeight+=e)},t.getEstimate=function(){var e=1-Math.pow(this._alpha,this._totalWeight);return this._lastEstimate/e},e}();function G(e){if(!(e.progress.length<5)){for(var t=new K(2),n=e.progress,r=1;r=s.outOfStarvationGap&&(l.Z.info("ABR: exit starvation mode."),this._inStarvationMode=!1):this._inStarvationMode&&(l.Z.info("ABR: exit starvation mode."),this._inStarvationMode=!1),this._inStarvationMode&&(o=function(e,t,n,r,i){if(!r){var a=t.bufferGap,o=t.speed,s=t.position,u=isFinite(a)?a:0,l=function(e,t){for(var n=-1,r=0;r-1.2){n=r;break}if(a>t&&t-i.time>-1.2){n=r;break}}}if(n<0)return[];for(var o=e[n],s=o.content.segment.time,u=[o],l=n+1;l0?d.progress[d.progress.length-1]:void 0,p=G(d);if(void 0!==v&&void 0!==p){var h=W(v,p);if((c-v.timestamp)/1e3<=h&&h-u/o>2500)return p}if(d.content.segment.complete){var m=d.content.segment.duration,g=(c-d.requestTimestamp)/1e3;if(null!=n&&!(g<=(1.5*m+2)/o)){var y=m/g,_=n.bitrate*Math.min(.7,y);return void 0===i||_1&&(a/=e.speed),{bandwidthEstimate:o,bitrateChosen:a}},t.isUrgent=function(e,t,n,r){return null===t||!(e>=t.bitrate)&&function(e,t,n){if(n)return!0;var r=isFinite(e.bufferGap)?e.bufferGap:0,i=e.position.last+r,a=(0,z.Z)(t,(function(e){var t=e.content;return t.segment.duration>0&&t.segment.time+t.segment.duration>i}));if(void 0===a)return!0;var o=performance.now(),s=a.progress.length>0?a.progress[a.progress.length-1]:void 0,u=G(a);if(void 0===s||void 0===u)return!0;var l=W(s,u);return(o-s.timestamp)/1e3>1.2*l||l-r/e.speed>-1.5}(r,n,this._lowLatencyMode)},e}();function j(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return q(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return q(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function q(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);ns.bitrate)return 2===this._lastAbrEstimate.algorithmType&&(null!==this._lastAbrEstimate.representation&&(this._lastMaintanableBitrate=this._lastAbrEstimate.representation.bitrate),this._consecutiveWrongGuesses=0),null;var u=this._scoreCalculator.getEstimate(n);if(2!==this._lastAbrEstimate.algorithmType){if(void 0===u)return null;if(this._canGuessHigher(a,o,u)){var d=X(e,n);if(null!==d)return d}return null}if(this._isLastGuessValidated(s,r,u)&&(l.Z.debug("ABR: Guessed Representation validated",s.bitrate),this._lastMaintanableBitrate=s.bitrate,this._consecutiveWrongGuesses=0),n.id!==s.id)return s;if(this._shouldStopGuess(n,u,a,i))return this._consecutiveWrongGuesses++,this._blockGuessesUntil=performance.now()+Math.min(15e3*this._consecutiveWrongGuesses,12e4),function(e,t){var n=(0,B.Z)(e,(function(e){return e.id===t.id}));if(n<0)return l.Z.error("ABR: Current Representation not found."),null;for(;--n>=0;)if(e[n].bitrate=2.5&&performance.now()>this._blockGuessesUntil&&1===i&&r/t>1.01},t._shouldStopGuess=function(e,t,n,r){if(void 0!==t&&t.score<1.01)return!0;if((void 0===t||t.score<1.2)&&n<.6)return!0;for(var i,a=r.filter((function(t){return t.content.representation.id===e.id})),o=performance.now(),s=j(a);!(i=s()).done;){var u=i.value,l=o-u.requestTimestamp;if(u.content.segment.isInit){if(l>1e3)return!0}else{if(l>1e3*u.content.segment.duration+200)return!0;var d=G(u);if(void 0!==d&&d<.8*e.bitrate)return!0}}return!1},t._isLastGuessValidated=function(e,t,n){return void 0!==n&&1===n.confidenceLevel&&n.score>1.5||t>=e.bitrate&&(null===this._lastMaintanableBitrate||this._lastMaintanableBitratet.bitrate)return e[r];return null}var Q=function(){function e(){var e=c.Z.getCurrent(),t=e.ABR_FAST_EMA,n=e.ABR_SLOW_EMA;this._fastEWMA=new K(t),this._slowEWMA=new K(n),this._bytesSampled=0}var t=e.prototype;return t.addSample=function(e,t){if(!(t1&&this._lastRepresentationWithGoodScore!==e&&(l.Z.debug("ABR: New last stable representation",e.bitrate),this._lastRepresentationWithGoodScore=e)},t.getEstimate=function(e){if(null!==this._currentRepresentationData&&this._currentRepresentationData.representation.id===e.id){var t=this._currentRepresentationData,n=t.ewma,r=t.loadedSegments,i=t.loadedDuration;return{score:n.getEstimate(),confidenceLevel:r>=5&&i>=10?1:0}}},t.getLastStableRepresentation=function(){return this._lastRepresentationWithGoodScore},e}();function ne(e,t,n,r){var i=t<=n?n:t>=r?r:t,a=(0,B.Z)(e,(function(e){return e.bitrate>i}));return-1===a?e[e.length-1]:0===a?e[0]:e[a-1]}var re=(0,k.ZP)(-1);re.finish();var ie=(0,k.ZP)(0);ie.finish();var ae=(0,k.ZP)(1/0);ae.finish();var oe=(0,k.ZP)(void 0);oe.finish();var se=(0,k.ZP)(1/0);se.finish();var ue=function(e){var t={},n=e.manualBitrates,r=e.minAutoBitrates,i=e.maxAutoBitrates,a=e.initialBitrates,o=e.throttlers,s=e.lowLatencyMode;return function(e,u,d,f,v){var p=e.adaptation.type,h=function(e){var n=t[e];if(null==n){l.Z.debug("ABR: Creating new BandwidthEstimator for ",e);var r=new Q;return t[e]=r,r}return n}(p),m=(0,U.Z)(n[p],re),g=(0,U.Z)(r[p],ie),y=(0,U.Z)(i[p],ae),_=(0,U.Z)(a[p],0);return function(e,t){var n=e.bandwidthEstimator,r=e.context,i=e.currentRepresentation,a=e.filters,o=e.initialBitrate,s=e.lowLatencyMode,u=e.manualBitrate,d=e.maxAutoBitrate,f=e.minAutoBitrate,v=e.playbackObserver,p=e.representations,h=new te,m=new H(null!=o?o:0,s),g=new ee,y=L.Z,_={metrics:I,requestBegin:Z,requestProgress:R,requestEnd:x,addedSegment:function(e){y(e)}},b=new w.ZP;b.linkToSignal(t);var S=T(u.getValue(),p.getValue(),b.signal);return u.onUpdate(A,{clearSignal:t}),p.onUpdate(A,{clearSignal:t}),{estimates:S,callbacks:_};function T(e,t,o){if(0===t.length)return(0,k.ZP)({representation:null,bitrate:void 0,knownStableBitrate:void 0,manual:!1,urgent:!0});if(e>=0){var u=ne(t,e,0,1/0);return(0,k.ZP)({representation:u,bitrate:void 0,knownStableBitrate:void 0,manual:!0,urgent:!0})}if(1===t.length)return(0,k.ZP)({bitrate:void 0,representation:t[0],manual:!1,urgent:!0,knownStableBitrate:void 0});var p,_=!1,b=t.map((function(e){return e.bitrate})),S=new V(b),T=new $,w=new Y(h,T),A=v.getReference().getValue(),I=(0,k.ZP)(R());return v.listen((function(e){A=e,Z()}),{includeLastObservation:!1,clearSignal:o}),y=function(e){if(null!==A){var t=A,n=t.position,r=t.speed,i=e.buffered,a=(0,E.L7)(i,n.last),o=e.content.representation,s=h.getEstimate(o),u={bufferGap:a,currentBitrate:o.bitrate,currentScore:s,speed:r};p=S.getEstimate(u),Z()}},f.onUpdate(Z,{clearSignal:o}),d.onUpdate(Z,{clearSignal:o}),a.limitWidth.onUpdate(Z,{clearSignal:o}),a.limitWidth.onUpdate(Z,{clearSignal:o}),I;function Z(){I.setValue(R())}function R(){var e=A,o=e.bufferGap,u=e.position,v=e.maximumPosition,y=a.limitWidth.getValue(),b=a.throttleBitrate.getValue(),S=i.getValue(),E=f.getValue(),k=d.getValue(),I=function(e,t,n){var r=e;n<1/0&&(r=function(e,t){if(0===e.length)return[];e.sort((function(e,t){return e.bitrate-t.bitrate}));var n=e[0].bitrate,r=Math.max(t,n),i=(0,B.Z)(e,(function(e){return e.bitrate>r}));return-1===i?e:e.slice(0,i)}(r,n));void 0!==t&&(r=function(e,t){var n=e.slice().sort((function(e,t){return(0,U.Z)(e.width,0)-(0,U.Z)(t.width,0)})),r=(0,z.Z)(n,(function(e){return"number"==typeof e.width&&e.width>=t}));if(void 0===r)return e;var i="number"==typeof r.width?r.width:0;return e.filter((function(e){return"number"!=typeof e.width||e.width<=i}))}(r,t));return r}(t,y,b),Z=g.getRequests(),R=m.getBandwidthEstimate(A,n,S,Z,T.bandwidth),x=R.bandwidthEstimate,M=R.bitrateChosen,C=h.getLastStableRepresentation(),P=null===C?void 0:C.bitrate/(A.speed>0?A.speed:1),D=c.Z.getCurrent(),N=D.ABR_ENTER_BUFFER_BASED_ALGO,O=D.ABR_EXIT_BUFFER_BASED_ALGO;_&&o<=O?_=!1:!_&&isFinite(o)&&o>=N&&(_=!0);var L=ne(I,M,E,k),F=L.bitrate,V=null;_&&void 0!==p&&p>F&&(F=(V=ne(I,p,E,k)).bitrate);var K=null;return s&&null!==S&&r.manifest.isDynamic&&v-u.last<40&&(K=w.getGuess(t,A,S,F,Z)),null!==K&&K.bitrate>F?(l.Z.debug("ABR: Choosing representation with guess-based estimation.",K.bitrate,K.id),T.update(K,x,2),{bitrate:x,representation:K,urgent:null===S||K.bitrate=500||404===e.status||415===e.status||412===e.status:e.type===p.br.TIMEOUT||e.type===p.br.ERROR_EVENT:e instanceof ve.Z?"boolean"==typeof e.canRetry?e.canRetry:void 0!==e.xhr&&(e.xhr.status>=500||404===e.xhr.status||415===e.xhr.status||412===e.xhr.status):(0,pe.Z)(e)&&"INTEGRITY_ERROR"===e.code}function ye(e){return e instanceof de.Z?e.type===p.br.ERROR_EVENT&&!1===navigator.onLine:e instanceof ve.Z&&e.isOfflineError}function _e(e,t,n,r,i){return be.apply(this,arguments)}function be(){return be=(0,I.Z)(R().mark((function e(t,n,r,i,a){var o,s,u,d,c,f,v,p,h,m,g,y,_,b;return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(b=function(e){var t;if(0===f.size)return e[0];var n=performance.now();return null===(t=e.filter((function(e){var t;return!0!==(null===(t=f.get(e))||void 0===t?void 0:t.isBlacklisted)})).reduce((function(e,t){var r,i=null===(r=f.get(t))||void 0===r?void 0:r.blockedUntil;return void 0!==i&&i<=n&&(i=void 0),void 0===e?[t,i]:void 0===i?void 0===e[1]?e:[t,void 0]:void 0===e[1]?e:iv?(c.blockedUntil=void 0,c.isBlacklisted=!0):(p=c.errorCounter,h=Math.min(o*Math.pow(2,p-1),s),m=(0,me.Z)(h),c.blockedUntil=performance.now()+m),e.abrupt("return",g(e.t0));case 22:case"end":return e.stop()}var y}),e,null,[[0,7]])})))).apply(this,arguments)},h=function(e){return m.apply(this,arguments)},p=function(){if(null===t){var e=f.get(null);if(void 0!==e&&e.isBlacklisted)return;return null}if(null===n)return b(t);var r=n.getCdnPreferenceForResource(t);return b(r)},null===a.cancellationError){e.next=9;break}return e.abrupt("return",Promise.reject(a.cancellationError));case 9:if(o=i.baseDelay,s=i.maxDelay,u=i.maxRetryRegular,d=i.maxRetryOffline,c=i.onRetry,null!==t&&0===t.length&&l.Z.warn("Fetchers: no CDN given to `scheduleRequestWithCdns`."),f=new Map,void 0!==(v=p())){e.next=15;break}throw new Error("No CDN to request");case 15:return e.abrupt("return",h(v));case 16:case"end":return e.stop()}}),e)}))),be.apply(this,arguments)}function Se(e,t,n){return _e(null,null,e,t,n)}function Te(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Ee(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ee(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Ee(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0?this._consecutiveUnsafeMode=u,v=void 0===r?0:performance.now()-r,p=Math.max(this._settings.minimumManifestUpdateInterval-v,0),h=new w.ZP;if(h.linkToSignal(this._canceller.signal),this.scheduleManualRefresh=function(t){var i=t.enablePartialRefresh,a=t.delay,o=t.canUseUnsafeMode&&f,s=void 0===r?0:performance.now()-r,u=Math.max(n._settings.minimumManifestUpdateInterval-s,0),l=setTimeout((function(){h.cancel(),n._triggerNextManifestRefresh(e,{enablePartialRefresh:i,unsafeMode:o})}),Math.max((null!=a?a:0)-s,u));h.signal.register((function(){clearTimeout(l)}))},null!==e.expired){var m=setTimeout((function(){var t;null===(t=e.expired)||void 0===t||t.then((function(){h.cancel(),n._triggerNextManifestRefresh(e,{enablePartialRefresh:!1,unsafeMode:f})}),L.Z)}),p);h.signal.register((function(){clearTimeout(m)}))}if(void 0!==e.lifetime&&e.lifetime>=0){var g,y=1e3*e.lifetime-v;void 0===d?g=y:e.lifetime<3&&d>=100?(g=Math.min(Math.max(3e3-v,Math.max(y,0)+d),6*y),l.Z.info("MUS: Manifest update rythm is too frequent. Postponing next request.",y,g)):d>=1e3*e.lifetime/10?(g=Math.min(Math.max(y,0)+d,6*y),l.Z.info("MUS: Manifest took too long to parse. Postponing next request",g,g)):g=y;var _=setTimeout((function(){h.cancel(),n._triggerNextManifestRefresh(e,{enablePartialRefresh:!1,unsafeMode:f})}),Math.max(g,p));h.signal.register((function(){clearTimeout(_)}))}},r._triggerNextManifestRefresh=function(e,t){var n,r,i=this,a=t.enablePartialRefresh,o=t.unsafeMode,s=e.updateUrl;null!==this._prioritizedContentUrl?(n=!0,r=this._prioritizedContentUrl,this._prioritizedContentUrl=null):r=(n=!a||void 0===s)?e.getUrl():s;var u=e.clockOffset;o?(this._consecutiveUnsafeMode+=1,l.Z.info('Init: Refreshing the Manifest in "unsafeMode" for the '+String(this._consecutiveUnsafeMode)+" consecutive time.")):this._consecutiveUnsafeMode>0&&(l.Z.info('Init: Not parsing the Manifest in "unsafeMode" anymore after '+String(this._consecutiveUnsafeMode)+" consecutive times."),this._consecutiveUnsafeMode=0),this._isRefreshPending||(this._isRefreshPending=!0,this._fetchManifest(r).then((function(t){return t.parse({externalClockOffset:u,previousManifest:e,unsafeMode:o})})).then((function(t){i._isRefreshPending=!1;var r=t.manifest,a=t.sendingTime,o=t.parsingTime,s=performance.now();if(n)e.replace(r);else try{e.update(r)}catch(t){var u=t instanceof Error?t.message:"unknown error";l.Z.warn("MUS: Attempt to update Manifest failed: "+u,"Re-downloading the Manifest fully");var d=c.Z.getCurrent().FAILED_PARTIAL_UPDATE_MANIFEST_REFRESH_DELAY,f=void 0===a?0:performance.now()-a,v=Math.max(i._settings.minimumManifestUpdateInterval-f,0),p=L.Z,h=setTimeout((function(){p(),i._triggerNextManifestRefresh(e,{enablePartialRefresh:!1,unsafeMode:!1})}),Math.max(d-f,v));return void(p=i._canceller.signal.register((function(){clearTimeout(h)})))}var m=performance.now()-s;i._recursivelyRefreshManifest(e,{sendingTime:a,parsingTime:o,updatingTime:m})})).catch((function(e){i._isRefreshPending=!1,i._onFatalError(e)})))},r._onFatalError=function(e){this._canceller.isUsed()||(this.trigger("error",e),this.dispose())},n}(_.Z);var we=ke;function Ae(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Ie(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ie(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Ie(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0&&this._removeIndexFromDowngradeList(n);var r=c.Z.getCurrent().DEFAULT_CDN_DOWNGRADE_TIME;this._downgradedCdnList.metadata.push(e);var i=window.setTimeout((function(){var n=Re(t._downgradedCdnList.metadata,e);n>=0&&t._removeIndexFromDowngradeList(n),t.trigger("priorityChange",null)}),r);this._downgradedCdnList.timeouts.push(i),this.trigger("priorityChange",null)},r._innerGetCdnPreferenceForResource=function(e){var t=this,n=e.reduce((function(e,n){return t._downgradedCdnList.metadata.some((function(e){return e.id===n.id&&e.baseUrl===n.baseUrl}))?e[1].push(n):e[0].push(n),e}),[[],[]]),r=n[0],i=n[1];return r.concat(i)},r._removeIndexFromDowngradeList=function(e){this._downgradedCdnList.metadata.splice(e,1);var t=this._downgradedCdnList.timeouts.splice(e,1);clearTimeout(t[0])},n}(_.Z);function Re(e,t){return 0===e.length?-1:void 0!==t.id?(0,B.Z)(e,(function(e){return e.id===t.id})):(0,B.Z)(e,(function(e){return e.baseUrl===t.baseUrl}))}var xe=n(520),Me=function(){function e(){this._cache=new WeakMap}var t=e.prototype;return t.add=function(e,t){var n=e.representation;e.segment.isInit&&this._cache.set(n,t)},t.get=function(e){var t=e.representation;if(e.segment.isInit){var n=this._cache.get(t);if(void 0!==n)return n}return null},e}(),Ce=(0,b.Z)();var Pe=function(){function e(e){var t=e.prioritySteps;if(this._minPendingPriority=null,this._waitingQueue=[],this._pendingTasks=[],this._prioritySteps=t,this._prioritySteps.high>=this._prioritySteps.low)throw new Error("TP: the max high level priority should be given a lowerpriority number than the min low priority.")}var t=e.prototype;return t.create=function(e,t,n,r){var i,a=this;return(0,O.Z)(r,(function(o,s){return i={hasEnded:!1,priority:t,trigger:function(){if(!i.hasEnded){var e=function(){u(),a._endTask(i)},t=new w.ZP,u=t.linkToSignal(r);i.interrupter=t,t.signal.register((function(){i.interrupter=null,r.isCancelled()||n.beforeInterrupted()})),a._minPendingPriority=null===a._minPendingPriority?i.priority:Math.min(a._minPendingPriority,i.priority),a._pendingTasks.push(i),i.taskFn(t.signal).then((function(t){n.beforeEnded(),e(),o(t)})).catch((function(n){!r.isCancelled()&&t.isUsed()&&n instanceof w.FU||function(t){e(),s(t)}(n)}))}},taskFn:e,interrupter:null},a._canBeStartedNow(i)?(i.trigger(),a._isRunningHighPriorityTasks()&&a._interruptCancellableTasks()):a._waitingQueue.push(i),function(){return a._endTask(i)}}))},t._endTask=function(e){e.hasEnded=!0;var t=De(e.taskFn,this._waitingQueue);if(t>=0)this._waitingQueue.splice(t,1);else{var n=De(e.taskFn,this._pendingTasks);if(n<0)return;this._pendingTasks.splice(n,1),this._pendingTasks.length>0?this._minPendingPriority===e.priority&&(this._minPendingPriority=Math.min.apply(Math,this._pendingTasks.map((function(e){return e.priority})))):this._minPendingPriority=null,this._loopThroughWaitingQueue()}},t.updatePriority=function(e,t){var n=De(e,this._waitingQueue);if(n>=0){var r=this._waitingQueue[n];if(r.priority===t)return;if(r.priority=t,!this._canBeStartedNow(r))return;return this._findAndRunWaitingQueueTask(n),void(this._isRunningHighPriorityTasks()&&this._interruptCancellableTasks())}var i=De(e,this._pendingTasks);if(i<0)l.Z.warn("TP: request to update the priority of a non-existent task");else{var a=this._pendingTasks[i];if(a.priority!==t){var o=a.priority;a.priority=t,null===this._minPendingPriority||tt.priority?t.priority:e}),null);if(!(null===e||null!==this._minPendingPriority&&this._minPendingPriority=this._prioritySteps.low)return this._interruptPendingTask(t),this._interruptCancellableTasks()}},t._findAndRunWaitingQueueTask=function(e){return e>=this._waitingQueue.length||e<0?(l.Z.warn("TP : Tried to start a non existing task"),!1):(this._waitingQueue.splice(e,1)[0].trigger(),!0)},t._interruptPendingTask=function(e){var t,n=De(e.taskFn,this._pendingTasks);n<0?l.Z.warn("TP: Interrupting a non-existent pending task. Aborting..."):(this._pendingTasks.splice(n,1),this._waitingQueue.push(e),0===this._pendingTasks.length?this._minPendingPriority=null:this._minPendingPriority===e.priority&&(this._minPendingPriority=Math.min.apply(Math,this._pendingTasks.map((function(e){return e.priority})))),null===(t=e.interrupter)||void 0===t||t.cancel())},t._canBeStartedNow=function(e){return null===this._minPendingPriority||e.priority<=this._minPendingPriority},t._isRunningHighPriorityTasks=function(){return null!==this._minPendingPriority&&this._minPendingPriority<=this._prioritySteps.high},e}();function De(e,t){return(0,B.Z)(t,(function(t){return t.taskFn===e}))}var Ne=function(){function e(e,t,n){var r=new Ze(n),i=c.Z.getCurrent(),a=i.MIN_CANCELABLE_PRIORITY,o=i.MAX_HIGH_PRIORITY_LEVEL;this._transport=e,this._prioritizer=new Pe({prioritySteps:{high:o,low:a}}),this._cdnPrioritizer=r,this._backoffOptions=t}return e.prototype.createSegmentFetcher=function(e,t){var n,r,i,a=function(e,t){var n=t.maxRetryRegular,r=t.maxRetryOffline,i=t.lowLatencyMode,a=t.requestTimeout,o=c.Z.getCurrent(),s=o.DEFAULT_MAX_REQUESTS_RETRY_ON_ERROR,u=o.DEFAULT_REQUEST_TIMEOUT,l=o.DEFAULT_MAX_REQUESTS_RETRY_ON_OFFLINE,d=o.INITIAL_BACKOFF_DELAY_BASE,f=o.MAX_BACKOFF_DELAY_BASE;return{maxRetryRegular:"image"===e?0:null!=n?n:s,maxRetryOffline:null!=r?r:l,baseDelay:i?d.LOW_LATENCY:d.REGULAR,maxDelay:i?f.LOW_LATENCY:f.REGULAR,requestTimeout:(0,S.Z)(a)?u:a}}(e,this._backoffOptions),o=function(e,t,n,r,i){var a={timeout:i.requestTimeout<0?void 0:i.requestTimeout},o=(0,g.Z)(["audio","video"],e)?new Me:void 0,s=t.loadSegment,u=t.parseSegment;return function(){var e=(0,I.Z)(R().mark((function e(t,d,c){var v,p,h,m,g,y,_,b,E,k,A,I,Z,x,M,C,P,D;return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(D=function(){var e;E||!(0,S.Z)(y)&&void 0!==y.size&&void 0!==y.requestDuration&&_.length>0&&_.every((function(e){return e}))&&(E=!0,null===(e=r.onMetrics)||void 0===e||e.call(r,{size:y.size,requestDuration:y.requestDuration,content:t,segmentDuration:b}))},P=function(e){d.onRetry(fe(e))},C=function(e,n){_.push(!1);var r=_.length-1;return function(i){var a={data:e,isChunked:n};try{var o=u(a,t,i);return _[r]||(b=void 0!==b&&"media"===o.segmentType&&null!==o.chunkInfos&&void 0!==o.chunkInfos.duration?b+o.chunkInfos.duration:void 0,_[r]=!0,D()),o}catch(e){throw(0,f.Z)(e,{defaultCode:"PIPELINE_PARSE_ERROR",defaultReason:"Unknown parsing error"})}}},M=function(e){return s(e,t,a,c,k)},x=function(){var e;void 0===y&&(l.Z.debug("SF: Segment request cancelled",m),y=null,null===(e=r.onRequestEnd)||void 0===e||e.call(r,{id:g}))},m=(0,xe.K)(t),g=Ce(),_=[],b=0,E=!1,k={onProgress:function(e){var t;void 0===y&&void 0!==e.totalSize&&e.size0;){var e=this._queue.shift();void 0!==e&&e.reject(new w.FU)}if("open"===this._mediaSource.readyState)try{this._sourceBuffer.abort()}catch(e){l.Z.warn("AVSB: Failed to abort a "+this.bufferType+" SourceBuffer:",e instanceof Error?e:"")}},r._onPendingTaskError=function(e){if(this._lastInitSegment=null,null!==this._pendingTask){var t=e instanceof Error?e:new Error("An unknown error occured when doing operations on the SourceBuffer");this._pendingTask.reject(t)}},r._addToQueue=function(e,t){var n=this;return(0,O.Z)(t,(function(t,r){var i=0===n._queue.length&&null===n._pendingTask,a=(0,T.Z)({resolve:t,reject:r},e);return n._queue.push(a),i&&n._flush(),function(){var e=n._queue.indexOf(a);e>=0&&n._queue.splice(e,1),a.resolve=L.Z,a.reject=L.Z}}))},r._flush=function(){if(!this._sourceBuffer.updating){if(null!==this._pendingTask){var e=this._pendingTask;if(e.type!==Ve.f.Push||0===e.data.length){switch(e.type){case Ve.f.Push:null!==e.inventoryData&&this._segmentInventory.insertChunk(e.inventoryData);break;case Ve.f.EndOfSegment:this._segmentInventory.completeSegment(e.value,this.getBufferedRanges());break;case Ve.f.Remove:this.synchronizeInventory();break;default:(0,Ue.Z)(e)}var t=e.resolve;return this._pendingTask=null,t(),void this._flush()}}else{var n=this._queue.shift();if(void 0===n)return;if(n.type!==Ve.f.Push)this._pendingTask=n;else{var r,i=n.value;try{r=this._preparePushOperation(i.data)}catch(e){this._pendingTask=(0,T.Z)({data:[],inventoryData:i.inventoryInfos},n);var a=e instanceof Error?e:new Error("An unknown error occured when preparing a push operation");return this._lastInitSegment=null,void n.reject(a)}this._pendingTask=(0,T.Z)({data:r,inventoryData:i.inventoryInfos},n)}}try{switch(this._pendingTask.type){case Ve.f.EndOfSegment:return l.Z.debug("AVSB: Acknowledging complete segment",(0,xe.K)(this._pendingTask.value)),void this._flush();case Ve.f.Push:var o=this._pendingTask.data.shift();if(void 0===o)return void this._flush();l.Z.debug("AVSB: pushing segment",this.bufferType,(0,xe.K)(this._pendingTask.inventoryData)),this._sourceBuffer.appendBuffer(o);break;case Ve.f.Remove:var s=this._pendingTask.value,u=s.start,d=s.end;l.Z.debug("AVSB: removing data from SourceBuffer",this.bufferType,u,d),this._sourceBuffer.remove(u,d);break;default:(0,Ue.Z)(this._pendingTask)}}catch(e){this._onPendingTaskError(e)}}},r._preparePushOperation=function(e){var t=[],n=e.codec,r=e.timestampOffset,i=e.appendWindow,a=!1;if(void 0!==n&&n!==this.codec&&(l.Z.debug("AVSB: updating codec",n),a=function(e,t){if("function"==typeof e.changeType){try{e.changeType(t)}catch(e){return l.Z.warn("Could not call 'changeType' on the given SourceBuffer:",e instanceof Error?e:""),!1}return!0}return!1}(this._sourceBuffer,n),a?this.codec=n:l.Z.debug("AVSB: could not update codec",n,this.codec)),this._sourceBuffer.timestampOffset!==r){var o=r;l.Z.debug("AVSB: updating timestampOffset",this.bufferType,this._sourceBuffer.timestampOffset,o),this._sourceBuffer.timestampOffset=o}if(void 0===i[0]?this._sourceBuffer.appendWindowStart>0&&(this._sourceBuffer.appendWindowStart=0):i[0]!==this._sourceBuffer.appendWindowStart&&(i[0]>=this._sourceBuffer.appendWindowEnd&&(this._sourceBuffer.appendWindowEnd=i[0]+1),this._sourceBuffer.appendWindowStart=i[0]),void 0===i[1]?this._sourceBuffer.appendWindowEnd!==1/0&&(this._sourceBuffer.appendWindowEnd=1/0):i[1]!==this._sourceBuffer.appendWindowEnd&&(this._sourceBuffer.appendWindowEnd=i[1]),null!==e.initSegment&&(a||!this._isLastInitSegment(e.initSegment))){var s=e.initSegment;t.push(s);var u=(0,Be._f)(s);this._lastInitSegment={data:u,hash:(0,Fe.Z)(u)}}return null!==e.chunk&&t.push(e.chunk),t},r._isLastInitSegment=function(e){if(null===this._lastInitSegment)return!1;if(this._lastInitSegment.data===e)return!0;var t=this._lastInitSegment.data;if(t.byteLength===e.byteLength){var n=(0,Be._f)(e);if((0,Fe.Z)(n)===this._lastInitSegment.hash&&(0,m.Z)(t,n))return!0}return!1},n}(Ve.C),Ke=["audio","video","text","image"];function Ge(e){return"audio"===e||"video"===e}var We=function(){function e(e,t){this._mediaElement=e,this._mediaSource=t,this._initializedSegmentBuffers={},this._onNativeBufferAddedOrDisabled=[]}e.isNative=function(e){return Ge(e)};var t=e.prototype;return t.getBufferTypes=function(){var e=this.getNativeBufferTypes();return null==h.Z.nativeTextTracksBuffer&&null==h.Z.htmlTextTracksBuffer||e.push("text"),null!=h.Z.imageBuffer&&e.push("image"),e},t.getNativeBufferTypes=function(){return"AUDIO"===this._mediaElement.nodeName?["audio"]:["video","audio"]},t.getStatus=function(e){var t=this._initializedSegmentBuffers[e];return void 0===t?{type:"uninitialized"}:null===t?{type:"disabled"}:{type:"initialized",value:t}},t.waitForUsableBuffers=function(e){var t=this;return this._areNativeBuffersUsable()?Promise.resolve():(0,O.Z)(e,(function(e){var n,r=function(){var e=t._onNativeBufferAddedOrDisabled.indexOf(n);e>=0&&t._onNativeBufferAddedOrDisabled.splice(e,1)};return n=function(){t._areNativeBuffersUsable()&&(r(),e())},t._onNativeBufferAddedOrDisabled.push(n),r}))},t.disableSegmentBuffer=function(t){var n=this._initializedSegmentBuffers[t];if(null!==n){if(void 0!==n)throw new Error("Cannot disable an active SegmentBuffer.");this._initializedSegmentBuffers[t]=null,e.isNative(t)&&this._onNativeBufferAddedOrDisabled.forEach((function(e){return e()}))}else l.Z.warn("SBS: The "+t+" SegmentBuffer was already disabled.")},t.createSegmentBuffer=function(e,t,n){void 0===n&&(n={});var r,i=this._initializedSegmentBuffers[e];if(Ge(e)){if(null!=i)return i instanceof ze&&i.codec!==t?l.Z.warn("SB: Reusing native SegmentBuffer with codec",i.codec,"for codec",t):l.Z.info("SB: Reusing native SegmentBuffer with codec",t),i;l.Z.info("SB: Adding native SegmentBuffer with codec",t);var a=new ze(e,t,this._mediaSource);return this._initializedSegmentBuffers[e]=a,this._onNativeBufferAddedOrDisabled.forEach((function(e){return e()})),a}if(null!=i)return l.Z.info("SB: Reusing a previous custom SegmentBuffer for the type",e),i;if("text"===e){if(l.Z.info("SB: Creating a new text SegmentBuffer"),"html"===n.textTrackMode){if(null==h.Z.htmlTextTracksBuffer)throw new Error("HTML Text track feature not activated");r=new h.Z.htmlTextTracksBuffer(this._mediaElement,n.textTrackElement)}else{if(null==h.Z.nativeTextTracksBuffer)throw new Error("Native Text track feature not activated");r=new h.Z.nativeTextTracksBuffer(this._mediaElement,!0===n.hideNativeSubtitle)}return this._initializedSegmentBuffers.text=r,r}if("image"===e){if(null==h.Z.imageBuffer)throw new Error("Image buffer feature not activated");return l.Z.info("SB: Creating a new image SegmentBuffer"),r=new h.Z.imageBuffer,this._initializedSegmentBuffers.image=r,r}throw l.Z.error("SB: Unknown buffer type:",e),new v.Z("BUFFER_TYPE_UNKNOWN","The player wants to create a SegmentBuffer of an unknown type.")},t.disposeSegmentBuffer=function(e){var t=this._initializedSegmentBuffers[e];null!=t?(l.Z.info("SB: Aborting SegmentBuffer",e),t.dispose(),delete this._initializedSegmentBuffers[e]):l.Z.warn("SB: Trying to dispose a SegmentBuffer that does not exist")},t.disposeAll=function(){var e=this;Ke.forEach((function(t){"initialized"===e.getStatus(t).type&&e.disposeSegmentBuffer(t)}))},t._areNativeBuffersUsable=function(){var e=this,t=this.getNativeBufferTypes();return!t.some((function(t){return void 0===e._initializedSegmentBuffers[t]}))&&!t.every((function(t){return null===e._initializedSegmentBuffers[t]}))},e}(),He=n(7473),je=n.n(He),qe=function(){function e(e){this._array=[],this._sortingFn=e}var t=e.prototype;return t.add=function(){for(var e=arguments.length,t=new Array(e),n=0;n=this._array.length)throw new Error("Invalid index.");return this._array[e]},t.toArray=function(){return this._array.slice()},t.findFirst=function(e){return(0,z.Z)(this._array,e)},t.has=function(e){return(0,g.Z)(this._array,e)},t.removeElement=function(e){var t=this._array.indexOf(e);if(t>=0)return this._array.splice(t,1),t},t.head=function(){return this._array[0]},t.last=function(){return this._array[this._array.length-1]},t.shift=function(){return this._array.shift()},t.pop=function(){return this._array.pop()},e}(),Ye=function(){function e(e){this._weakMap=new WeakMap,this._fn=e}var t=e.prototype;return t.get=function(e){var t=this._weakMap.get(e);if(void 0===t){var n=this._fn(e);return this._weakMap.set(e,n),n}return t},t.destroy=function(e){this._weakMap.delete(e)},e}();function Xe(e,t){var n,r=e.segmentBuffer,i=e.playbackObserver,a=e.maxBufferBehind,o=e.maxBufferAhead;function s(){(function(e,t,n,r,i){return Qe.apply(this,arguments)})(r,n,a.getValue(),o.getValue(),t).catch((function(e){var t=e instanceof Error?e.message:"Unknown error";l.Z.error("Could not run BufferGarbageCollector:",t)}))}i.listen((function(e){var t;n=null!==(t=e.position.pending)&&void 0!==t?t:e.position.last,s()}),{includeLastObservation:!0,clearSignal:t}),a.onUpdate(s,{clearSignal:t}),o.onUpdate(s,{clearSignal:t}),s()}function Qe(){return(Qe=(0,I.Z)(R().mark((function e(t,n,r,i,a){var o,s,u,d,c,f,v,p;return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(isFinite(r)||isFinite(i)){e.next=2;break}return e.abrupt("return",Promise.resolve());case 2:o=[],s=(0,E.F_)(t.getBufferedRanges(),n),u=s.innerRange,d=s.outerRanges,c=function(){if(isFinite(i)){for(var e=0;et.start&&o.push({start:n+i,end:t.end})}null!=u&&n+i=t.end?o.push(t):n>=t.end&&n-r>t.start&&n-ru.start&&o.push({start:u.start,end:n-r})}}(),c(),f=0,v=o;case 9:if(!(f0&&n[0].segment.id===e._mediaSegmentAwaitingInitMetadata)){var r=e._mediaSegmentRequest;if(0===n.length){if(null===r)return;return l.Z.debug("Stream: no more media segment to request. Cancelling queue.",e._content.adaptation.type),void e._restartMediaSegmentDownloadingQueue()}if(null===r)return l.Z.debug("Stream: Media segments now need to be requested. Starting queue.",e._content.adaptation.type,n.length),void e._restartMediaSegmentDownloadingQueue();var i=n[0];return r.segment.id!==i.segment.id?(l.Z.debug("Stream: Next media segment changed, cancelling previous",e._content.adaptation.type),void e._restartMediaSegmentDownloadingQueue()):void(r.priority!==i.priority&&(l.Z.debug("Stream: Priority of next media segment changed, updating",e._content.adaptation.type,r.priority,i.priority),e._segmentFetcher.updatePriority(r.request,i.priority)))}}),{emitCurrentValue:!0,clearSignal:this._currentCanceller.signal}),this._downloadQueue.onUpdate((function(t){var n,r=e._initSegmentRequest;null===t.initSegment||null===r?(null===(n=t.initSegment)||void 0===n?void 0:n.segment.id)!==(null==r?void 0:r.segment.id)&&(null===t.initSegment&&l.Z.debug("Stream: no more init segment to request. Cancelling queue.",e._content.adaptation.type),e._restartInitSegmentDownloadingQueue(t.initSegment)):t.initSegment.priority!==r.priority&&e._segmentFetcher.updatePriority(r.request,t.initSegment.priority)}),{emitCurrentValue:!0,clearSignal:this._currentCanceller.signal}))},r.stop=function(){var e;null===(e=this._currentCanceller)||void 0===e||e.cancel(),this._currentCanceller=null},r._restartMediaSegmentDownloadingQueue=function(){var e=this;null!==this._mediaSegmentRequest&&this._mediaSegmentRequest.canceller.cancel();!function t(n){if(null!==e._currentCanceller&&e._currentCanceller.isUsed())e._mediaSegmentRequest=null;else{if(void 0===n)return e._mediaSegmentRequest=null,void e.trigger("emptyQueue",null);var r=new w.ZP,i=null===e._currentCanceller?L.Z:r.linkToSignal(e._currentCanceller.signal),a=n.segment,o=n.priority,s=(0,T.Z)({segment:a},e._content),u=!1,d=!1;r.signal.register((function(){e._mediaSegmentRequest=null,u||(e._mediaSegmentAwaitingInitMetadata===a.id&&(e._mediaSegmentAwaitingInitMetadata=null),u=!0,d=!1)}));var c=function(t){(0,y.Z)("media"===t.segmentType,"Should have loaded a media segment."),e.trigger("parsedMediaSegment",(0,T.Z)({},t,{segment:a}))},f=function(){var n=e._downloadQueue.getValue().segmentQueue;if(0===n.length)return u=!0,void e.trigger("emptyQueue",null);n[0].segment.id===a.id&&n.shift(),u=!0,t(n[0])},v=e._segmentFetcher.createRequest(s,o,{onRetry:function(t){e.trigger("requestRetry",{segment:a,error:t})},beforeInterrupted:function(){l.Z.info("Stream: segment request interrupted temporarly.",a.id,a.time)},onChunk:function(t){var n=e._initSegmentInfoRef.getValue();void 0!==n?c(t(null!=n?n:void 0)):(d=!0,e._initSegmentInfoRef.waitUntilDefined((function(e){c(t(null!=e?e:void 0))}),{clearSignal:r.signal}))},onAllChunksReceived:function(){d?(e._mediaSegmentAwaitingInitMetadata=a.id,e._initSegmentInfoRef.waitUntilDefined((function(){e._mediaSegmentAwaitingInitMetadata=null,d=!1,e.trigger("fullyLoadedSegment",a)}),{clearSignal:r.signal})):e.trigger("fullyLoadedSegment",a)},beforeEnded:function(){i(),e._mediaSegmentRequest=null,d?e._initSegmentInfoRef.waitUntilDefined(f,{clearSignal:r.signal}):f()}},r.signal);v.catch((function(t){i(),u||(u=!0,e.stop(),e.trigger("error",t))})),e._mediaSegmentRequest={segment:a,priority:o,request:v,canceller:r}}}(this._downloadQueue.getValue().segmentQueue[0])},r._restartInitSegmentDownloadingQueue=function(e){var t=this;if((null===this._currentCanceller||!this._currentCanceller.isUsed())&&(null!==this._initSegmentRequest&&this._initSegmentRequest.canceller.cancel(),null!==e)){var n=new w.ZP,r=null===this._currentCanceller?L.Z:n.linkToSignal(this._currentCanceller.signal),i=e.segment,a=e.priority,o=(0,T.Z)({segment:i},this._content),s=!1,u=this._segmentFetcher.createRequest(o,a,{onRetry:function(e){t.trigger("requestRetry",{segment:i,error:e})},beforeInterrupted:function(){l.Z.info("Stream: init segment request interrupted temporarly.",i.id)},beforeEnded:function(){r(),t._initSegmentRequest=null,s=!0},onChunk:function(e){var n,r=e(void 0);(0,y.Z)("init"===r.segmentType,"Should have loaded an init segment."),t.trigger("parsedInitSegment",(0,T.Z)({},r,{segment:i})),"init"===r.segmentType&&t._initSegmentInfoRef.setValue(null!==(n=r.initTimescale)&&void 0!==n?n:null)},onAllChunksReceived:function(){t.trigger("fullyLoadedSegment",i)}},n.signal);u.catch((function(e){r(),s||(s=!0,t.stop(),t.trigger("error",e))})),n.signal.register((function(){t._initSegmentRequest=null,s||(s=!0)})),this._initSegmentRequest={segment:i,priority:a,request:u,canceller:n}}},n}(_.Z);function Je(e,t,n,r,i){var a=e.period,o=e.adaptation,s=e.representation,u=function(e,t){for(var n=0;n=t.end)return null;if(r.bufferedEnd>t.start)return n}return null}(i,t);if(null===u){if(null===n){if(r&&void 0!==a.end&&t.end>=a.end)return{start:void 0,end:null};var d=s.index.checkDiscontinuity(t.start);if(null!==d)return{start:void 0,end:d}}return null}var c=i[u];if(void 0!==c.bufferedStart&&c.bufferedStart>t.start&&(null===n||c.infos.segment.end<=n)){var f=c.bufferedStart;return r||!1===s.index.awaitSegmentBetween(t.start,f)?(l.Z.debug("RS: current discontinuity encountered",o.type,c.bufferedStart),{start:void 0,end:f}):null}var v=function(e,t,n){if(n<=0)return l.Z.error("RS: Asked to check a discontinuity before the first chunk."),null;for(var r=n;r=t.end)return null;if(i.bufferedStart-a.bufferedEnd>0)return r}return null}(i,t,u+1);if(null!==v){var p=i[v-1],h=i[v];if(null===n||h.infos.segment.end<=n){if(!r&&!1!==s.index.awaitSegmentBetween(p.infos.segment.end,h.infos.segment.time))return null;var m=p.bufferedEnd,g=h.bufferedStart;return l.Z.debug("RS: future discontinuity encountered",o.type,m,g),{start:m,end:g}}}if(null===n){if(r&&void 0!==a.end){if(t.end=0;n--){var r=e[n];if(void 0===r.bufferedStart)return null;if(r.bufferedStart=a.end)return null;for(var b=i.length-1;b>=0;b--){var S=i[b];if(void 0===S.bufferedStart)break;if(S.bufferedStart=n.length-1?null:n[t+1],s=null;if(function(e,t,n){var r=c.Z.getCurrent().MAX_TIME_MISSING_FROM_COMPLETE_SEGMENT;if(void 0===e.bufferedStart)return l.Z.warn("Stream: Start of a segment unknown. Assuming it is garbage collected by default.",e.start),!0;if(null!==t&&void 0!==t.bufferedEnd&&e.bufferedStart-t.bufferedEnd<.1)return!1;if(nr)return l.Z.info("Stream: The start of the wanted segment has been garbage collected",e.start,e.bufferedStart),!0;return!1}(e,r,o.start)){if(function(e,t){var n,r;if(e.length<2)return!0;var i=e[e.length-1],a=null===(n=i.buffered)||void 0===n?void 0:n.start;if(void 0!==t&&void 0!==a&&t-a>.05)return!0;var o=e[e.length-2],s=null===(r=o.buffered)||void 0===r?void 0:r.start;if(void 0===s||void 0===a)return!0;return Math.abs(s-a)>.01}(s=a(e.infos),e.bufferedStart))return!1;l.Z.debug("Stream: skipping segment gc-ed at the start",e.start,e.bufferedStart)}if(function(e,t,n){var r=c.Z.getCurrent().MAX_TIME_MISSING_FROM_COMPLETE_SEGMENT;if(void 0===e.bufferedEnd)return l.Z.warn("Stream: End of a segment unknown. Assuming it is garbage collected by default.",e.end),!0;if(null!==t&&void 0!==t.bufferedStart&&t.bufferedStart-e.bufferedEnd<.1)return!1;if(n>e.bufferedEnd&&e.end-e.bufferedEnd>r)return l.Z.info("Stream: The end of the wanted segment has been garbage collected",e.start,e.bufferedStart),!0;return!1}(e,i,o.end)){if(function(e,t){var n,r;if(e.length<2)return!0;var i=e[e.length-1],a=null===(n=i.buffered)||void 0===n?void 0:n.end;if(void 0!==t&&void 0!==a&&a-t>.05)return!0;var o=e[e.length-2],s=null===(r=o.buffered)||void 0===r?void 0:r.end;if(void 0===s||void 0===a)return!0;return Math.abs(s-a)>.01}(s=null!=s?s:a(e.infos),e.bufferedEnd))return!1;l.Z.debug("Stream: skipping segment gc-ed at the end",e.end,e.bufferedEnd)}return!0})),m=c.Z.getCurrent(),g=m.MINIMUM_SEGMENT_SIZE,y=m.MIN_BUFFER_AHEAD,_=!1,b=Math.min(1/60,g),S=!1,E=[],k=p.filter((function(e){var t=(0,T.Z)({segment:e},n);if(s.length>0&&s.some((function(e){return(0,xe.z)(t,e)})))return!1;var u=e.duration,c=e.time,p=e.end;if(e.isInit)return!0;if(_)return E.push(e),!1;if(e.complete&&u0&&s.some((function(e){if(e.period.id!==n.period.id||e.adaptation.id!==n.adaptation.id)return!1;var a=e.segment;return!(a.time-b>c)&&(!(a.end+b-b&&w.end-p>-b)return!1}}var A=u*n.representation.bitrate;if(v-A<0&&(S=!0,c>o.start+y))return _=!0,E.push(e),!1;var I=a(t);if(I.length>1){var Z=I[I.length-1],R=I[I.length-2];if(null===Z.buffered&&null===R.buffered)return l.Z.warn("Stream: Segment GCed multiple times in a row, ignoring it.","If this happens a lot and lead to unpleasant experience, please check your device's available memory. If it's low when this message is emitted, you might want to update the RxPlayer's settings (`maxBufferAhead`, `maxVideoBufferSize` etc.) so less memory is used by regular media data buffering."+d.type,f.id,e.time),!1}for(var x=0;xc){var C=M.start>c+b||tt(h,x).ende[n].start;)n++;return e[--n]}function nt(e,t,n,r){var i=c.Z.getCurrent().CONTENT_REPLACEMENT_PADDING;return e.period.id===t.period.id&&(!(e.segment.timea}return rr}(e.representation,t.representation,r)))}function rt(e,t){for(var n=e-t,r=c.Z.getCurrent().SEGMENT_PRIORITIES_STEPS,i=0;i=u&&l.isInitialized()&&l.isFinished()&&function(e,t,n){var r;return t.containsTime(n)&&e.isLastPeriodKnown&&t.id===(null===(r=e.periods[e.periods.length-1])||void 0===r?void 0:r.id)}(a,o,t)?u-1:t-.1;var d,c=i+n;d=!(!s.index.isInitialized()||!s.index.isFinished()||void 0===o.end)&&(void 0===u?c>=o.end:null===u||c>=u);return{start:Math.max(i,o.start),end:Math.min(c,null!==(r=o.end)&&void 0!==r?r:1/0),hasReachedPeriodEnd:d}}(e,u,i),d=s.index.shouldRefresh(l.start,l.end),f=o.getPendingOperations().filter((function(e){return e.type===Ve.f.EndOfSegment})).map((function(e){return e.value})),v=function(e,t){for(var n=c.Z.getCurrent().MINIMUM_SEGMENT_SIZE,r=Math.max(1/60,n),i=e.start+r,a=e.end-r,o=[],s=t.length-1;s>=0;s--){var u=t[s],l=u.infos.representation;if(!u.partiallyPushed&&!1!==l.decipherable&&l.isSupported){var d=u.infos.segment,f=d.time/d.timescale;((d.complete?f+d.duration/d.timescale:u.end)>i&&fi&&u.start0&&(b=Math.min.apply(Math,f.map((function(e){return e.segment.time})))),m.length>0&&(b=null!==b?Math.min(b,m[0].time):m[0].time),y.length>0&&(b=null!==b?Math.min(b,y[0].segment.time):y[0].segment.time),{imminentDiscontinuity:Je(e,l,b,_,v),hasFinishedLoading:_,neededSegments:y,isBufferFull:g,shouldRefreshManifest:d}}function at(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return ot(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ot(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ot(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);nu.end||e+ni.start&&o.push({start:i.start,end:e-n}),e+n0&&Z.every((function(e){return void 0!==e.keyIds}))&&(I=!0,t.encryptionDataEncountered(Z.map((function(e){return(0,T.Z)({content:r},e)}))),_.isUsed()))return}var R=new $e(r,E,s,A);return R.addEventListener("error",(function(e){b.signal.isCancelled()||(_.cancel(),t.error(e))})),R.addEventListener("parsedInitSegment",M),R.addEventListener("parsedMediaSegment",M),R.addEventListener("emptyQueue",x),R.addEventListener("requestRetry",(function(e){if(t.warning(e.error),!b.signal.isCancelled()){var n=e.segment,r=v.index;!1===r.isSegmentStillAvailable(n)?x():r.canBeOutOfSyncError(e.error,n)&&t.manifestMightBeOufOfSync()}})),R.addEventListener("fullyLoadedSegment",(function(e){o.endOfSegment((0,T.Z)({segment:e},r),_.signal).catch(C)})),R.start(),b.signal.register((function(){R.removeEventListener(),R.stop()})),a.listen(x,{includeLastObservation:!1,clearSignal:b.signal}),p.onUpdate(x,{emitCurrentValue:!1,clearSignal:b.signal}),h.onUpdate(x,{emitCurrentValue:!1,clearSignal:b.signal}),u.onUpdate(x,{emitCurrentValue:!1,clearSignal:b.signal}),void x();function x(){var e,n;if(!b.isUsed()){var i=a.getReference().getValue(),s=null!==(e=i.position.pending)&&void 0!==e?e:i.position.last,f=it(r,s,a,g.getValue(),p.getValue(),h.getValue(),o),m=f.neededSegments,T=null;if(v.index.isInitialized()){if(m.length>0&&!S.isLoaded&&null!==S.segment){var k=m[0].priority;T={segment:S.segment,priority:k}}}else if(null===S.segment)l.Z.warn("Stream: Uninitialized index without an initialization segment");else if(S.isLoaded)l.Z.warn("Stream: Uninitialized index with an already loaded initialization segment");else{var w=null!==(n=i.position.pending)&&void 0!==n?n:i.position.last;T={segment:S.segment,priority:rt(d.start,w)}}var A=u.getValue();if(null===A)E.setValue({initSegment:T,segmentQueue:m});else{if(A.urgent)return l.Z.debug("Stream: Urgent switch, terminate now.",y),E.setValue({initSegment:null,segmentQueue:[]}),E.finish(),b.cancel(),void t.terminating();var I=m[0],Z=R.getRequestedInitSegment(),x=R.getRequestedMediaSegment(),M=null===x||void 0===I||x.id!==I.segment.id?[]:[I],P=null===Z?null:T;if(E.setValue({initSegment:P,segmentQueue:M}),0===M.length&&null===P)return l.Z.debug("Stream: No request left, terminate",y),E.finish(),b.cancel(),void t.terminating()}if(t.streamStatusUpdate({period:d,position:i.position.last,bufferType:y,imminentDiscontinuity:f.imminentDiscontinuity,isEmptyStream:!1,hasFinishedLoading:f.hasFinishedLoading,neededSegments:f.neededSegments}),!b.signal.isCancelled()){var D=c.Z.getCurrent().UPTO_CURRENT_POSITION_CLEANUP;if(f.isBufferFull){var N=Math.max(0,s-D);N>0&&o.removeBuffer(0,N,_.signal).catch(C)}f.shouldRefreshManifest&&t.needsManifestRefresh()}}}function M(e){if(!_.isUsed())if("init"===e.segmentType){if(S.segmentData=e.initializationData,S.isLoaded=!0,!I){var n=v.getAllEncryptionData();n.length>0&&t.encryptionDataEncountered(n.map((function(e){return(0,T.Z)({content:r},e)})))}(function(e,t){return ft.apply(this,arguments)})({playbackObserver:a,content:r,segment:e.segment,segmentData:e.initializationData,segmentBuffer:o},_.signal).then((function(e){null!==e&&t.addedSegment(e)})).catch(C),x()}else{var i=e.inbandEvents,s=e.needsManifestRefresh,u=e.protectionDataUpdate;if(!I&&u){var l=v.getAllEncryptionData();if(l.length>0&&(t.encryptionDataEncountered(l.map((function(e){return(0,T.Z)({content:r},e)}))),_.isUsed()))return}if(!0===s&&(t.needsManifestRefresh(),_.isUsed()))return;if(void 0!==i&&i.length>0&&(t.inbandEvent(i),_.isUsed()))return;var d=S.segmentData;(function(e,t){return vt.apply(this,arguments)})({playbackObserver:a,content:r,initSegmentData:d,parsedSegment:e,segment:e.segment,segmentBuffer:o},_.signal).then((function(e){null!==e&&t.addedSegment(e)})).catch(C)}}function C(e){_.isUsed()&&e instanceof w.FU||(_.cancel(),t.error(e))}};var ht=function(e,t,n){var r=e.playbackObserver,i=e.content,a=e.options,o=e.representationEstimator,s=e.segmentBuffer,u=e.segmentFetcherCreator,d=e.wantedBufferAhead,p=e.maxVideoBufferSize,h="direct"===a.manualBitrateSwitchingMode,m=i.manifest,g=i.period,y=i.adaptation,_=new w.ZP;_.linkToSignal(n);var b,S=new Map,E=(0,k.$l)(null,_.signal),A=function(e,t,n,r,i,a){var o=e.manifest,s=e.adaptation,u=(0,k.ZP)([],a);f(),o.addEventListener("decipherabilityUpdate",f);var l=a.register(p),d=t(e,n,u,r,a),c=d.estimates;return{abrCallbacks:d.callbacks,estimateRef:c};function f(){var e=s.getPlayableRepresentations();if(0===e.length){var t=new v.Z("NO_PLAYABLE_REPRESENTATION","No Representation in the chosen "+s.type+" Adaptation can be played",{adaptation:s});return p(),void i(t)}var n=u.getValue();n.length===e.length&&n.every((function(t,n){return t.id===e[n].id}))||u.setValue(e)}function p(){o.removeEventListener("decipherabilityUpdate",f),void 0!==l&&l()}}(i,o,E,r,(function(e){_.cancel(),t.error(e)}),_.signal),I=A.estimateRef,Z=A.abrCallbacks,R=u.createSegmentFetcher(y.type,{onRequestBegin:Z.requestBegin,onRequestEnd:Z.requestEnd,onProgress:Z.requestProgress,onMetrics:Z.metrics});function x(e,t,n,i){var o=new w.ZP;o.linkToSignal(_.signal);var u=(0,k.lR)(d,(function(t){return t*function(e){var t=S.get(e.id),n=void 0!==t?t:1;void 0===t&&S.set(e.id,n);return n}(e)}),o.signal),c="video"===y.type?p:(0,k.$l)(1/0);l.Z.info("Stream: changing representation",y.type,e.id,e.bitrate);var v=(0,T.Z)({},i,{error:function(r){var a,o=(0,f.Z)(r,{defaultCode:"NONE",defaultReason:"Unknown `RepresentationStream` error"});if("BUFFER_FULL_ERROR"!==o.code)i.error(r);else{var s=d.getValue(),u=.7*(null!==(a=S.get(e.id))&&void 0!==a?a:1);if(u<=.05||s*u<=2)throw o;S.set(e.id,u),(0,he.Z)(4e3,_.signal).then((function(){return x(e,t,n,i)})).catch(L.Z)}},terminating:function(){o.cancel(),i.terminating()}});pt({playbackObserver:r,content:{representation:e,adaptation:y,period:g,manifest:m},segmentBuffer:s,segmentFetcher:R,terminate:t,options:{bufferGoal:u,maxBufferSize:c,drmSystemId:a.drmSystemId,fastSwitchThreshold:n}},v,_.signal)}I.onUpdate((function(e){var n=e.bitrate;void 0!==n&&n!==b&&(b=n,l.Z.debug("Stream: new "+y.type+" bitrate estimate",n),t.bitrateEstimationChange({type:y.type,bitrate:n}))}),{emitCurrentValue:!0,clearSignal:_.signal}),function e(n){var i=new w.ZP;i.linkToSignal(_.signal);var o=I.getValue(),s=o.representation,u=o.manual;if(null===s)return;if(h&&u&&!n){var d=c.Z.getCurrent().DELTA_POSITION_AFTER_RELOAD;return je()((function(){r.listen((function(e){var n,i;if(I.getValue().manual){var a=r.getCurrentTime()+d.bitrateSwitch,o=Math.min(Math.max(g.start,a),null!==(n=g.end)&&void 0!==n?n:1/0),s=!(null!==(i=e.paused.pending)&&void 0!==i?i:r.getIsPaused());return t.waitingMediaSourceReload({bufferType:y.type,period:g,position:o,autoPlay:s})}}),{includeLastObservation:!0,clearSignal:i.signal})}))}var f=(0,k.$l)(null,i.signal);I.onUpdate((function(e){if(null!==e.representation&&e.representation.id!==s.id)return e.urgent?(l.Z.info("Stream: urgent Representation switch",y.type),f.setValue({urgent:!0})):(l.Z.info("Stream: slow Representation switch",y.type),f.setValue({urgent:!1}))}),{clearSignal:i.signal,emitCurrentValue:!0});var v=(0,k.$l)(0);a.enableFastSwitching&&I.onUpdate((function(e){v.setValueIfChanged(null==e?void 0:e.knownStableBitrate)}),{clearSignal:i.signal,emitCurrentValue:!0});var p={type:y.type,period:g,representation:s};if(E.setValue(s),_.isUsed())return;if(t.representationChange(p),_.isUsed())return;var m={streamStatusUpdate:t.streamStatusUpdate,encryptionDataEncountered:t.encryptionDataEncountered,manifestMightBeOufOfSync:t.manifestMightBeOufOfSync,needsManifestRefresh:t.needsManifestRefresh,inbandEvent:t.inbandEvent,warning:t.warning,error:function(e){_.cancel(),t.error(e)},addedSegment:function(e){Z.addedSegment(e),_.isUsed()||t.addedSegment(e)},terminating:function(){if(!i.isUsed())return i.cancel(),e(!1)}};x(s,f,v,m)}(!0)},mt=n(9252);var gt=function(e,t){var n=e.split(";"),r=n[0],i=n.slice(1),a=t.split(";"),o=a[0],s=a.slice(1);if(r!==o)return!1;var u=(0,z.Z)(i,(function(e){return(0,mt.Z)(e,"codecs=")})),l=(0,z.Z)(s,(function(e){return(0,mt.Z)(e,"codecs=")}));if(void 0===u||void 0===l)return!1;var d=u.substring(7),c=l.substring(7);return d.split(".")[0]===c.split(".")[0]};function yt(e,t,n,r,i){if(void 0!==e.codec&&"reload"===i.onCodecSwitch&&!function(e,t){return e.getPlayableRepresentations().some((function(e){return gt(e.getMimeTypeString(),t)}))}(n,e.codec))return{type:"needs-reload",value:void 0};var a=e.getBufferedRanges();if(0===a.length)return{type:"continue",value:void 0};var o=(0,E.JN)(a),s=t.start,u=null==t.end?1/0:t.end,l=(0,E.tn)(o,[{start:s,end:u}]);if(0===l.length)return{type:"continue",value:void 0};e.synchronizeInventory();var d=e.getInventory();if(!d.some((function(e){return e.infos.period.id===t.id&&e.infos.adaptation.id!==n.id})))return{type:"continue",value:void 0};var f=function(e,t,n){return e.reduce((function(e,r){if(r.infos.period.id!==t.id||r.infos.adaptation.id!==n.id)return e;var i=r.bufferedStart,a=r.bufferedEnd;return void 0===i||void 0===a||e.push({start:i,end:a}),e}),[])}(d,t,n),v=(0,E.uH)(l,f);if(0===v.length)return{type:"continue",value:void 0};var p=r.currentTime,h=i.audioTrackSwitchingMode;if(("video"===n.type||"audio"===n.type&&"reload"===h)&&(0,E.Ti)({start:s,end:u},p)&&(r.readyState>1||!n.getPlayableRepresentations().some((function(t){var n;return gt(t.getMimeTypeString(),null!==(n=e.codec)&&void 0!==n?n:"")})))&&!(0,E.A1)(f,p))return{type:"needs-reload",value:void 0};var m="audio"===n.type&&"direct"===h,g=[],y=function(e,t){for(var n=0;n=t.start)return n>0?e[n-1]:null;return e.length>0?e[e.length-1]:null}(d,t);null!==y&&(void 0===y.bufferedEnd||t.start-y.bufferedEnd<1)&&g.push({start:0,end:t.start+1});var _=n.type,b=c.Z.getCurrent().ADAPTATION_SWITCH_BUFFER_PADDINGS,S=b[_].before;null==S&&(S=0);var T=b[_].after;if(null==T&&(T=0),m||g.push({start:p-S,end:p+T}),void 0!==t.end){var k=function(e,t){for(var n=0;nt.start)return e[n];return null}(d,t);null!==k&&(void 0===k.bufferedStart||k.bufferedStart-t.end<1)&&g.push({start:t.end-1,end:Number.MAX_VALUE})}var w=(0,E.uH)(v,g);return 0===w.length?{type:"continue",value:void 0}:m?{type:"flush-buffer",value:w}:{type:"clean-buffer",value:w}}function _t(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return bt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return bt(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function bt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=o.end&&(l.Z.debug('Stream: full "empty" AdaptationStream',n),s=!0),i.streamStatusUpdate({period:o,bufferType:n,position:u,imminentDiscontinuity:null,isEmptyStream:!0,hasFinishedLoading:s,neededSegments:[]})}t.onUpdate(u,{emitCurrentValue:!1,clearSignal:a}),e.listen(u,{includeLastObservation:!1,clearSignal:a}),u()}var Et=function(e,t,n){var r=e.bufferType,i=e.content,a=e.garbageCollectors,o=e.playbackObserver,s=e.representationEstimator,u=e.segmentFetcherCreator,d=e.segmentBuffersStore,v=e.options,p=e.wantedBufferAhead,h=e.maxVideoBufferSize,m=i.period,g=(0,k.ZP)(void 0,n);if(t.periodStreamReady({type:r,period:m,adaptationRef:g}),!n.isCancelled()){var y,_=!0;g.onUpdate((function(e){(0,I.Z)(R().mark((function i(){var s,u,f,h,g,T,E,k,A,I,Z,x,M,C,P,D;return R().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(void 0!==e){i.next=2;break}return i.abrupt("return");case 2:if((u=new w.ZP).linkToSignal(n),null==y||y.cancel(),y=u,null!==e){i.next=34;break}if(l.Z.info("Stream: Set no "+r+" Adaptation. P:",m.start),"initialized"!==(f=d.getStatus(r)).type){i.next=26;break}if(l.Z.info("Stream: Clearing previous "+r+" SegmentBuffer"),!We.isNative(r)){i.next=15;break}return i.abrupt("return",S(0,u.signal));case 15:if(h=null!==(s=m.end)&&void 0!==s?s:1/0,!(m.start>h)){i.next=20;break}l.Z.warn("Stream: Can't free buffer: period's start is after its end"),i.next=24;break;case 20:return i.next=22,f.value.removeBuffer(m.start,h,u.signal);case 22:if(!u.isUsed()){i.next=24;break}return i.abrupt("return");case 24:i.next=30;break;case 26:if("uninitialized"!==f.type){i.next=30;break}if(d.disableSegmentBuffer(r),!u.isUsed()){i.next=30;break}return i.abrupt("return");case 30:if(t.adaptationChange({type:r,adaptation:null,period:m}),!u.isUsed()){i.next=33;break}return i.abrupt("return");case 33:return i.abrupt("return",Tt(o,p,r,{period:m},t,u.signal));case 34:if(g=c.Z.getCurrent(),T=g.DELTA_POSITION_AFTER_RELOAD,E=_?0:"audio"===r?T.trackSwitch.audio:"video"===r?T.trackSwitch.video:T.trackSwitch.other,_=!1,!We.isNative(r)||"disabled"!==d.getStatus(r).type){i.next=39;break}return i.abrupt("return",S(E,u.signal));case 39:if(l.Z.info("Stream: Updating "+r+" adaptation","A: "+e.id,"P: "+m.start),t.adaptationChange({type:r,adaptation:e,period:m}),!u.isUsed()){i.next=43;break}return i.abrupt("return");case 43:if(k=o.getReadyState(),A=St(d,r,e,v),I={currentTime:o.getCurrentTime(),readyState:k},"needs-reload"!==(Z=yt(A,m,e,I,v)).type){i.next=49;break}return i.abrupt("return",S(E,u.signal));case 49:return i.next=51,d.waitForUsableBuffers(u.signal);case 51:if(!u.isUsed()){i.next=53;break}return i.abrupt("return");case 53:if("flush-buffer"!==Z.type&&"clean-buffer"!==Z.type){i.next=67;break}x=_t(Z.value);case 55:if((M=x()).done){i.next=63;break}return C=M.value,P=C.start,D=C.end,i.next=59,A.removeBuffer(P,D,u.signal);case 59:if(!u.isUsed()){i.next=61;break}return i.abrupt("return");case 61:i.next=55;break;case 63:if("flush-buffer"!==Z.type){i.next=67;break}if(t.needsBufferFlush(),!u.isUsed()){i.next=67;break}return i.abrupt("return");case 67:a.get(A)(u.signal),b(e,A,u.signal);case 69:case"end":return i.stop()}}),i)})))().catch((function(e){e instanceof w.FU||(null==y||y.cancel(),t.error(e))}))}),{clearSignal:n,emitCurrentValue:!0})}function b(e,n,a){var c=i.manifest,g=function(e,t){return e.deriveReadOnlyObserver((function(e,n){var r=(0,k.ZP)(i(),n);return e.onUpdate(a,{clearSignal:n,emitCurrentValue:!1}),r;function i(){var n=e.getValue(),r=t.getBufferedRanges(),i=(0,E.L7)(r,n.position.last);return(0,T.Z)({},n,{bufferGap:i})}function a(){r.setValue(i())}}))}(o,n);ht({content:{manifest:c,period:m,adaptation:e},options:v,playbackObserver:g,representationEstimator:s,segmentBuffer:n,segmentFetcherCreator:u,wantedBufferAhead:p,maxVideoBufferSize:h},Object.assign(Object.assign({},t),{error:function(e){if(!We.isNative(r)){l.Z.error("Stream: "+r+" Stream crashed. Aborting it.",e instanceof Error?e:""),d.disposeSegmentBuffer(r);var n=(0,f.Z)(e,{defaultCode:"NONE",defaultReason:"Unknown `AdaptationStream` error"});if(t.warning(n),a.isCancelled())return;return Tt(o,p,r,{period:m},t,a)}l.Z.error("Stream: "+r+" Stream crashed. Stopping playback.",e instanceof Error?e:""),t.error(e)}}),a)}function S(e,n){je()((function(){o.listen((function(n){var i,a,s=o.getCurrentTime()+e,u=Math.min(Math.max(m.start,s),null!==(i=m.end)&&void 0!==i?i:1/0),l=!(null!==(a=n.paused.pending)&&void 0!==a?a:o.getIsPaused());t.waitingMediaSourceReload({bufferType:r,period:m,position:u,autoPlay:l})}),{includeLastObservation:!0,clearSignal:n})}))}};function kt(e,t){if(0===t.length)return[];e.synchronizeInventory();for(var n=[],r=e.getInventory(),i=function(){var i=r[a];if(t.some((function(e){return i.infos.period.id===e.period.id&&i.infos.adaptation.id===e.adaptation.id&&i.infos.representation.id===e.representation.id}))){var o=i.bufferedStart,s=i.bufferedEnd;if(void 0===o||void 0===s){l.Z.warn("SO: No buffered start or end found from a segment.");var u=e.getBufferedRanges(),d=u.length;return 0===d?{v:[]}:{v:[{start:u.start(0),end:u.end(d-1)}]}}var c=n[n.length-1];void 0!==c&&c.end===o?c.end=s:n.push({start:o,end:s})}},a=0;a=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function At(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0?t[t.length-1].end>=n-5:t[0].start<=n+5}var Zt=function(e,t,n,r,i,a,o,s){for(var u,d=e.manifest,f=e.initialPeriod,p=a.maxBufferAhead,h=a.maxBufferBehind,m=a.wantedBufferAhead,g=a.maxVideoBufferSize,y=c.Z.getCurrent(),_=y.MAXIMUM_MAX_BUFFER_AHEAD,b=y.MAXIMUM_MAX_BUFFER_BEHIND,S=new Ye((function(e){var n=e.bufferType,r=null!=b[n]?b[n]:1/0,i=null!=_[n]?_[n]:1/0;return function(n){Xe({segmentBuffer:e,playbackObserver:t,maxBufferBehind:(0,k.lR)(h,(function(e){return Math.min(e,r)}),n),maxBufferAhead:(0,k.lR)(p,(function(e){return Math.min(e,i)}),n)},n)}})),T=wt(r.getBufferTypes());!(u=T()).done;){E(u.value,f)}function E(e,n){var i=new qe((function(e,t){return e.start-t.start})),a=!1,u=new w.ZP;return u.linkToSignal(s),t.listen((function(t){var n,r,f=t.position,v=null!==(n=f.pending)&&void 0!==n?n:f.last;if(a&&function(e){var t=i.head(),n=i.last();if(null==t||null==n)return!0;return t.start>e||(null==n.end?1/0:n.end)0;){var p=i.get(i.length()-1);i.removeElement(p),o.periodStreamCleared({type:e,period:p})}u.cancel(),(u=new w.ZP).linkToSignal(s);var h=null!==(r=d.getPeriodForTime(v))&&void 0!==r?r:d.getNextPeriod(v);void 0!==h?c(h):l.Z.warn("Stream: The wanted position is not found in the Manifest.")}}),{clearSignal:s,includeLastObservation:!0}),d.addEventListener("decipherabilityUpdate",(function(e){(function(e){return f.apply(this,arguments)})(e).catch((function(e){u.cancel(),o.error(e)}))}),s),c(n);function c(t){var n=Object.assign(Object.assign({},o),{waitingMediaSourceReload:function(e){var t=i.head();if(void 0===t||t.id!==e.period.id)o.lockedStream({bufferType:e.bufferType,period:e.period});else{var n=e.position,r=e.autoPlay;o.needsMediaSourceReload({position:n,autoPlay:r})}},periodStreamReady:function(e){a=!0,i.add(e.period),o.periodStreamReady(e)},periodStreamCleared:function(e){i.removeElement(e.period),o.periodStreamCleared(e)},error:function(e){u.cancel(),o.error(e)}});A(e,t,n,u.signal)}function f(){return f=(0,I.Z)(R().mark((function n(f){var p,h,m,g,y,_,b,S,T,E,k,A,I;return R().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(p=r.getStatus(e),0!==(h=f.filter((function(t){return t.adaptation.type===e}))).length&&"initialized"===p.type&&!h.every((function(e){return!0===e.representation.decipherable}))){n.next=4;break}return n.abrupt("return");case 4:for(m=p.value,g=h.filter((function(e){return void 0===e.representation.decipherable})),y=h.filter((function(e){return!1===e.representation.decipherable})),_=kt(m,y),b=kt(m,g),a=!1,l.Z.info("Stream: Destroying all PeriodStreams for decipherability matters",e);i.length()>0;)S=i.get(i.length()-1),i.removeElement(S),o.periodStreamCleared({type:e,period:S});u.cancel(),(u=new w.ZP).linkToSignal(s),T=0,E=[].concat(_,b);case 16:if(!(T=o.end&&(l.Z.info("Stream: Destroying PeriodStream as the current playhead moved above it",e,o.start,null!==(i=a.pending)&&void 0!==i?i:a.last,o.end),n(),s.periodStreamCleared({type:e,period:o}),f.cancel())}),{clearSignal:u,includeLastObservation:!0});var v={bufferType:e,content:{manifest:d,period:o},garbageCollectors:S,maxVideoBufferSize:g,segmentFetcherCreator:i,segmentBuffersStore:r,options:a,playbackObserver:t,representationEstimator:n,wantedBufferAhead:m},p=Object.assign(Object.assign({},s),{streamStatusUpdate:function(t){if(t.hasFinishedLoading){var n=d.getPeriodAfter(o);null!==n&&function(t){if(null!==c){if(c.period.id===t.id)return;l.Z.warn("Stream: Creating next `PeriodStream` while one was already created.",e,t.id,c.period.id),s.periodStreamCleared({type:e,period:c.period}),c.canceller.cancel()}var n=new w.ZP;n.linkToSignal(u),c={canceller:n,period:t},A(e,t,s,c.canceller.signal)}(n)}else null!==c&&(l.Z.info("Stream: Destroying next PeriodStream due to current one being active",e,c.period.start),s.periodStreamCleared({type:e,period:c.period}),c.canceller.cancel(),c=null);s.streamStatusUpdate(t)},error:function(e){null!==c&&(c.canceller.cancel(),c=null),f.cancel(),s.error(e)}});Et(v,p,f.signal)}},Rt=Zt,xt=n(379);function Mt(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Ct(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ct(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Ct(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);na.getMaximumAvailablePosition()){var u=new v.Z("MEDIA_TIME_AFTER_MANIFEST","The current position is after the latest time announced in the Manifest.");i.trigger("warning",u)}}),{includeLastObservation:!0,clearSignal:o}),t.addEventListener("manifestUpdate",(function(){i.trigger("durationUpdate",i._getManifestDuration()),o.isCancelled()||i._checkEndOfStream()}),o),i}(0,t.Z)(n,e);var r=n.prototype;return r.getCurrentDuration=function(){return this._getManifestDuration()},r.onAdaptationChange=function(e,t,n){if(this._manifest.isLastPeriodKnown){var r=this._manifest.periods[this._manifest.periods.length-1];if(t.id===(null==r?void 0:r.id)&&("audio"===e||"video"===e)){"audio"===e?this._maximumPositionCalculator.updateLastAudioAdaptation(n):this._maximumPositionCalculator.updateLastVideoAdaptation(n);var i=this._maximumPositionCalculator.getEndingPosition(),a=void 0!==i?{isEnd:!0,duration:i}:{isEnd:!1,duration:this._maximumPositionCalculator.getMaximumAvailablePosition()};this.trigger("durationUpdate",a)}}this._canceller.isUsed()||null===n&&this._addActivelyLoadedPeriod(t,e)},r.onRepresentationChange=function(e,t){this._addActivelyLoadedPeriod(t,e)},r.onPeriodCleared=function(e,t){this._removeActivelyLoadedPeriod(t,e)},r.onLastSegmentFinishedLoading=function(e){var t=this._lazilyCreateActiveStreamInfo(e);t.hasFinishedLoadingLastPeriod||(t.hasFinishedLoadingLastPeriod=!0,this._checkEndOfStream())},r.onLastSegmentLoadingResume=function(e){var t=this._lazilyCreateActiveStreamInfo(e);t.hasFinishedLoadingLastPeriod&&(t.hasFinishedLoadingLastPeriod=!1,this._checkEndOfStream())},r.dispose=function(){this.removeEventListener(),this._canceller.cancel()},r._addActivelyLoadedPeriod=function(e,t){var n=this._lazilyCreateActiveStreamInfo(t);n.activePeriods.has(e)||(n.activePeriods.add(e),this._checkCurrentPeriod())},r._removeActivelyLoadedPeriod=function(e,t){var n=this._activeStreams.get(t);void 0!==n&&n.activePeriods.has(e)&&(n.activePeriods.removeElement(e),this._checkCurrentPeriod())},r._checkCurrentPeriod=function(){var e=this;if(0!==this._allBufferTypes.length){var t=this._activeStreams.get(this._allBufferTypes[0]);if(void 0!==t)for(var n,r=function(){for(var t=n.value,r=!0,i=1;i=0;a--){var o=i[a];try{"open"===r&&(l.Z.info("Init: Removing SourceBuffer from mediaSource"),o.abort()),t.removeSourceBuffer(o)}catch(e){l.Z.warn("Init: Error while disposing SourceBuffer",e instanceof Error?e:"")}}i.length>0&&l.Z.warn("Init: Not all SourceBuffers could have been removed.")}if((0,Lt.Z)(e),null!==n)try{l.Z.debug("Init: Revoking previous URL"),URL.revokeObjectURL(n)}catch(e){l.Z.warn("Init: Error while revoking the media source URL",e instanceof Error?e:"")}}function Vt(e,t){return(0,O.Z)(t,(function(n){var r=function(e,t){if(null==Ut.J)throw new v.Z("MEDIA_SOURCE_NOT_SUPPORTED","No MediaSource Object was found in the current browser.");var n=(0,Bt.Z)(e.src)?e.src:null;Ft(e,null,n),l.Z.info("Init: Creating MediaSource");var r=new Ut.J,i=URL.createObjectURL(r);return l.Z.info("Init: Attaching MediaSource URL to the media element",i),e.src=i,t.register((function(){Ft(e,r,i)})),r}(e,t);i.u_(r,(function(){n(r)}),t)}))}function zt(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Kt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Kt(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Kt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0?r:Math.max(i,r+u)}if(!(0,S.Z)(n.percentage)){l.Z.debug("Init: using startAt.percentage");var d=n.percentage;return d>100?r:d<0?i:i+(r-i)*(+d/100)}}var f=e.getMinimumSafePosition();if(e.isLive){var v,p=e.suggestedPresentationDelay,h=e.clockOffset,m=e.getMaximumSafePosition(),g=c.Z.getCurrent().DEFAULT_LIVE_GAP;if(void 0===h)l.Z.info("Init: no clock offset found for a live content, starting close to maximum available position"),v=m;else{l.Z.info("Init: clock offset found for a live content, checking if we can start close to it");var y=void 0===e.availabilityStartTime?0:e.availabilityStartTime,_=(performance.now()+h)/1e3-y;v=Math.min(m,_)}var b=void 0!==p?p:t?g.LOW_LATENCY:g.DEFAULT;return l.Z.debug("Init: "+v+" defined as the live time, applying a live gap of "+b),Math.max(v-b,f)}return l.Z.info("Init: starting at the minimum available position:",f),f}var Yt=n(1757),Xt=n(8833),Qt=n(8799);var $t=31536e3,Jt=function(){function e(e){this._mediaSource=e,this._currentMediaSourceDurationUpdateCanceller=null}var t=e.prototype;return t.updateDuration=function(e,t){null!==this._currentMediaSourceDurationUpdateCanceller&&this._currentMediaSourceDurationUpdateCanceller.cancel(),this._currentMediaSourceDurationUpdateCanceller=new w.ZP;var n=this._mediaSource,r=this._currentMediaSourceDurationUpdateCanceller.signal,a=function(e,t){var n=(0,k.ZP)("open"===e.readyState,t);return(0,i.u_)(e,(function(){n.setValueIfChanged(!0)}),t),(0,i.N8)(e,(function(){n.setValueIfChanged(!1)}),t),(0,i.k6)(e,(function(){n.setValueIfChanged(!1)}),t),n}(n,r),o=new w.ZP;o.linkToSignal(r),a.onUpdate((function(){if(o.cancel(),!a.getValue())return;(o=new w.ZP).linkToSignal(r);var i=function(e,t){if(0===e.length){var n=(0,k.ZP)(!1);return n.finish(),n}var r=(0,k.ZP)(!1,t);o();for(var i=function(){var n=e[a];n.addEventListener("updatestart",o),n.addEventListener("update",o),t.register((function(){n.removeEventListener("updatestart",o),n.removeEventListener("update",o)}))},a=0;a0&&(i=Math.max(o.buffered.end(s-1)))}if(r===e.duration)return"success";if(i>r){if(i=.1?c=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function un(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);nl||void 0!==h&&l>=h)&&(ln(v)&&c.push(v.publicEvent),o.delete(v)):p<=l&&void 0!==h&&l=(null!=h?h:p)&&(u?d.push({type:"stream-event-skip",value:v.publicEvent}):(d.push({type:"stream-event",value:v.publicEvent}),ln(v)&&c.push(v.publicEvent)))}if(d.length>0)for(var m,g=sn(d);!(m=g()).done;){var y=m.value;if("stream-event"===y.type?r(y.value):i(y.value),a.isCancelled())return}if(c.length>0)for(var _,b=sn(c);!(_=b()).done;){var S=_.value;if("function"==typeof S.onExit&&S.onExit(),a.isCancelled())return}}(s.getValue(),d,e,l.signal),d=e}function h(){var e=n.getReference().getValue().seeking;return{currentTime:t.currentTime,isSeeking:e}}}),{emitCurrentValue:!0,clearSignal:a})},cn=n(4576);function fn(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return vn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return vn(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function vn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);nd.end&&(n=d.end-1)}}else n=s;return{maximumPosition:e.getMaximumSafePosition(),position:{last:u.position,pending:n},duration:u.duration,paused:{last:u.paused,pending:i.getValue()||!r===u.paused?void 0:!r},readyState:u.readyState,speed:l}}function d(){u.setValue(l())}}))}(u,f,{autoPlay:a,initialPlayPerformed:E,initialSeekPerformed:w,speed:g,startTime:s}),I=this._createRebufferingController(f,u,g,n),Z=this._createContentTimeBoundariesObserver(u,d,A,b,n);T.then((function(){(0,Yt.Z)(f,l,!1,n).onUpdate((function(e,t){e&&(t(),i.trigger("loaded",{segmentBuffersStore:b}))}),{emitCurrentValue:!0,clearSignal:n})})).catch((function(e){n.isCancelled()||i._onFatalError(e)}));var R=this;Rt({manifest:u,initialPeriod:y},A,h,b,m,o,{needsBufferFlush:function(){var e=l.currentTime+.001;f.setCurrentTime(e),f.listen((function(t,n){(null!==t.currentRange||t.position>e+.1)&&(n(),f.setCurrentTime(t.position+.001))}),{includeLastObservation:!1,clearSignal:n})},streamStatusUpdate:function(e){var t=e.period,r=e.bufferType,i=e.imminentDiscontinuity,a=e.position;I.updateDiscontinuityInfo({period:t,bufferType:r,discontinuity:i,position:a}),n.isCancelled()||u.isLastPeriodKnown&&e.period.id===u.periods[u.periods.length-1].id&&(e.hasFinishedLoading||e.isEmptyStream?Z.onLastSegmentFinishedLoading(e.bufferType):Z.onLastSegmentLoadingResume(e.bufferType))},needsManifestRefresh:function(){return R._manifestFetcher.scheduleManualRefresh({enablePartialRefresh:!0,canUseUnsafeMode:!0})},manifestMightBeOufOfSync:function(){var e=c.Z.getCurrent().OUT_OF_SYNC_MANIFEST_REFRESH_DELAY;R._manifestFetcher.scheduleManualRefresh({enablePartialRefresh:!1,canUseUnsafeMode:!1,delay:e})},lockedStream:function(e){return I.onLockedStream(e.bufferType,e.period)},adaptationChange:function(e){R.trigger("adaptationChange",e),n.isCancelled()||Z.onAdaptationChange(e.type,e.period,e.adaptation)},representationChange:function(e){R.trigger("representationChange",e),n.isCancelled()||Z.onRepresentationChange(e.type,e.period)},inbandEvent:function(e){return R.trigger("inbandEvents",e)},warning:function(e){return R.trigger("warning",e)},periodStreamReady:function(e){return R.trigger("periodStreamReady",e)},periodStreamCleared:function(e){Z.onPeriodCleared(e.type,e.period),n.isCancelled()||R.trigger("periodStreamCleared",e)},bitrateEstimationChange:function(e){return R.trigger("bitrateEstimationChange",e)},addedSegment:function(e){return R.trigger("addedSegment",e)},needsMediaSourceReload:function(e){return t(e)},needsDecipherabilityFlush:function(e){var n,r=D(l);void 0===(n=null==r?void 0:r[0])||n.indexOf("widevine")<0?t(e):e.position+.001=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function gn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&(i="internal-seeking",r=t._internalSeeksIncoming.shift());var a=null!=e?e:t._generateInitialObservation(),o=Sn(t._mediaElement,i,t._withMediaSource),s=null;o.seeking&&("number"==typeof r?s=r:null!==a.pendingInternalSeek&&"seeking"!==n&&(s=a.pendingInternalSeek));var u=function(e,t,n){var r,i,a=n.withMediaSource,o=n.lowLatencyMode,s=c.Z.getCurrent().REBUFFERING_GAP,u=t.event,l=t.position,d=t.bufferGap,f=t.currentRange,v=t.duration,p=t.paused,h=t.readyState,m=t.ended,g=e.rebuffering,y=e.event,_=e.position,b=function(e,t,n,r,i){var a=c.Z.getCurrent().REBUFFERING_GAP,o=i?"LOW_LATENCY":"DEFAULT";if(void 0===t)return n&&Math.abs(r-e)<=a[o];return null!==t&&r-t.end<=a[o]}(l,f,m,v,o),S=h>=1&&"loadedmetadata"!==u&&null===g&&!(b||m),T=null,E=o?s.LOW_LATENCY:s.DEFAULT;if(a){if(S)d===1/0?(r=!0,T=l):void 0===d?h<3&&(r=!0,T=void 0):d<=E&&(r=!0,T=l+d);else if(null!==g){var k=bn(g,o);!0!==r&&null!==g&&h>1&&(b||m||void 0!==d&&isFinite(d)&&d>k)||void 0===d&&h>=3?i=!0:void 0===d?T=void 0:d===1/0?T=l:d<=k&&(T=l+d)}}else S&&(!p&&"timeupdate"===u&&"timeupdate"===y&&l===_||"seeking"===u&&(d===1/0||void 0===d&&h<3))?r=!0:null!==g&&("seeking"!==u&&l!==_||"canplay"===u||void 0===d&&h>=3||void 0!==d&&d<1/0&&(d>bn(g,o)||b||m))&&(i=!0);if(!0===i)return null;var w;if(!0===r||null!==g)return w="seeking"===u||null!==g&&"seeking"===g.reason||t.seeking?"seeking":1===h?"not-ready":"buffering",null!==g&&g.reason===w?{reason:g.reason,timestamp:g.timestamp,position:T}:{reason:w,timestamp:performance.now(),position:T};return null}(a,o,{lowLatencyMode:t._lowLatencyMode,withMediaSource:t._withMediaSource}),d=function(e,t){var n=c.Z.getCurrent().MINIMUM_BUFFER_AMOUNT_BEFORE_FREEZING;if(e.freezing)return t.ended||t.paused||0===t.readyState||0===t.playbackRate||e.position!==t.position?null:e.freezing;return"timeupdate"===t.event&&void 0!==t.bufferGap&&t.bufferGap>n&&!t.ended&&!t.paused&&t.readyState>=1&&0!==t.playbackRate&&t.position===e.position?{timestamp:performance.now()}:null}(a,o),f=(0,T.Z)({},{rebuffering:u,freezing:d,pendingInternalSeek:s},o);return l.Z.hasLevel("DEBUG")&&l.Z.debug("API: current media element state tick","event",f.event,"position",f.position,"seeking",f.seeking,"internalSeek",f.pendingInternalSeek,"rebuffering",null!==f.rebuffering,"freezing",null!==f.freezing,"ended",f.ended,"paused",f.paused,"playbackRate",f.playbackRate,"readyState",f.readyState),f},s=(0,k.ZP)(o("init"),this._canceller.signal),u=function(t){var n=o(t);l.Z.hasLevel("DEBUG")&&l.Z.debug("API: current playback timeline:\n"+function(e,t){for(var n="",r="",i=0;it){var d=n.length-Math.floor(l.length/2);r=" ".repeat(d)+"^"+t}if(i=3?(r=void 0,i=void 0):i=null!==(r=(0,E.rx)(a,o))?r.end-o:1/0,{bufferGap:i,buffered:a,currentRange:r,position:o,duration:s,ended:u,paused:l,playbackRate:d,readyState:c,seeking:f,event:t}}function Tn(e,t,n){var r=t(e.getReference(),n);return{getCurrentTime:function(){return e.getCurrentTime()},getReadyState:function(){return e.getReadyState()},getPlaybackRate:function(){return e.getPlaybackRate()},getIsPaused:function(){return e.getIsPaused()},getReference:function(){return r},listen:function(e,t){var i;n.isCancelled()||!0===(null===(i=null==t?void 0:t.clearSignal)||void 0===i?void 0:i.isCancelled())||r.onUpdate(e,{clearSignal:null==t?void 0:t.clearSignal,emitCurrentValue:null==t?void 0:t.includeLastObservation})},deriveReadOnlyObserver:function(e){return Tn(this,e,n)}}}var En=n(7829);function kn(e){return e.map((function(e){return null===e?e:{normalized:void 0===e.language?void 0:(0,En.ZP)(e.language),audioDescription:e.audioDescription,codec:e.codec}}))}function wn(e){return e.map((function(e){return null===e?e:{normalized:(0,En.ZP)(e.language),forced:e.forced,closedCaption:e.closedCaption}}))}var An=function(){function e(e){this._periods=new qe((function(e,t){return e.period.start-t.period.start})),this._audioChoiceMemory=new WeakMap,this._textChoiceMemory=new WeakMap,this._videoChoiceMemory=new WeakMap,this._preferredAudioTracks=[],this._preferredTextTracks=[],this._preferredVideoTracks=[],this.trickModeTrackEnabled=e.preferTrickModeTracks}var t=e.prototype;return t.setPreferredAudioTracks=function(e,t){this._preferredAudioTracks=e,t&&this._applyAudioPreferences()},t.setPreferredTextTracks=function(e,t){this._preferredTextTracks=e,t&&this._applyTextPreferences()},t.setPreferredVideoTracks=function(e,t){this._preferredVideoTracks=e,t&&this._applyVideoPreferences()},t.addPeriod=function(e,t,n){var r=Pn(this._periods,t),i=t.getSupportedAdaptations(e);if(void 0!==r){if(void 0!==r[e])return void l.Z.warn("TrackChoiceManager: "+e+" already added for period",t.start);r[e]={adaptations:i,adaptationRef:n}}else{var a;this._periods.add(((a={period:t})[e]={adaptations:i,adaptationRef:n},a))}},t.removePeriod=function(e,t){var n=function(e,t){for(var n=0;n0;)this._periods.pop()},t.update=function(){this._resetChosenAudioTracks(),this._resetChosenTextTracks(),this._resetChosenVideoTracks()},t.setInitialAudioTrack=function(e){var t=Pn(this._periods,e),n=void 0!==t?t.audio:null;if((0,S.Z)(n)||void 0===t)throw new Error("TrackChoiceManager: Given Period not found.");var r=e.getSupportedAdaptations("audio"),i=this._audioChoiceMemory.get(e);if(null===i)n.adaptationRef.setValue(null);else if(void 0!==i&&(0,g.Z)(r,i))n.adaptationRef.setValue(i);else{var a=Zn(r,kn(this._preferredAudioTracks));this._audioChoiceMemory.set(e,a),n.adaptationRef.setValue(a)}},t.setInitialTextTrack=function(e){var t=Pn(this._periods,e),n=void 0!==t?t.text:null;if((0,S.Z)(n)||void 0===t)throw new Error("TrackChoiceManager: Given Period not found.");var r=e.getSupportedAdaptations("text"),i=this._textChoiceMemory.get(e);if(null===i)n.adaptationRef.setValue(null);else if(void 0!==i&&(0,g.Z)(r,i))n.adaptationRef.setValue(i);else{var a=xn(r,wn(this._preferredTextTracks),this._audioChoiceMemory.get(e));this._textChoiceMemory.set(e,a),n.adaptationRef.setValue(a)}},t.setInitialVideoTrack=function(e){var t=Pn(this._periods,e),n=void 0!==t?t.video:null;if((0,S.Z)(n)||void 0===t)throw new Error("TrackChoiceManager: Given Period not found.");var r,i=e.getSupportedAdaptations("video"),a=this._videoChoiceMemory.get(e);if(null===a)r=null;else if(void 0!==a&&(0,g.Z)(i,a.baseAdaptation))r=a.baseAdaptation;else{r=Cn(i,this._preferredVideoTracks)}if(null===r)return this._videoChoiceMemory.set(e,null),void n.adaptationRef.setValue(null);var o=Dn(r,this.trickModeTrackEnabled);this._videoChoiceMemory.set(e,{baseAdaptation:r,adaptation:o}),n.adaptationRef.setValue(o)},t.setAudioTrackByID=function(e,t){var n=Pn(this._periods,e),r=void 0!==n?n.audio:null;if((0,S.Z)(r))throw new Error("TrackChoiceManager: Given Period not found.");var i=(0,z.Z)(r.adaptations,(function(e){return e.id===t}));if(void 0===i)throw new Error("Audio Track not found.");this._audioChoiceMemory.get(e)!==i&&(this._audioChoiceMemory.set(e,i),r.adaptationRef.setValue(i))},t.setTextTrackByID=function(e,t){var n=Pn(this._periods,e),r=void 0!==n?n.text:null;if((0,S.Z)(r))throw new Error("TrackChoiceManager: Given Period not found.");var i=(0,z.Z)(r.adaptations,(function(e){return e.id===t}));if(void 0===i)throw new Error("Text Track not found.");this._textChoiceMemory.get(e)!==i&&(this._textChoiceMemory.set(e,i),r.adaptationRef.setValue(i))},t.setVideoTrackByID=function(e,t){var n=Pn(this._periods,e),r=void 0!==n?n.video:null;if((0,S.Z)(r))throw new Error("LanguageManager: Given Period not found.");var i=(0,z.Z)(r.adaptations,(function(e){return e.id===t}));if(void 0===i)throw new Error("Video Track not found.");var a=Dn(i,this.trickModeTrackEnabled);this._videoChoiceMemory.set(e,{baseAdaptation:i,adaptation:a}),r.adaptationRef.setValue(a)},t.disableTextTrack=function(e){var t=Pn(this._periods,e),n=void 0!==t?t.text:null;if((0,S.Z)(n))throw new Error("TrackChoiceManager: Given Period not found.");null!==this._textChoiceMemory.get(e)&&(this._textChoiceMemory.set(e,null),n.adaptationRef.setValue(null))},t.disableVideoTrack=function(e){var t=Pn(this._periods,e),n=null==t?void 0:t.video;if(void 0===n)throw new Error("TrackManager: Given Period not found.");null!==this._videoChoiceMemory.get(e)&&(this._videoChoiceMemory.set(e,null),n.adaptationRef.setValue(null))},t.disableVideoTrickModeTracks=function(){this.trickModeTrackEnabled=!1,this._resetChosenVideoTracks()},t.enableVideoTrickModeTracks=function(){this.trickModeTrackEnabled=!0,this._resetChosenVideoTracks()},t.isTrickModeEnabled=function(){return this.trickModeTrackEnabled},t.getChosenAudioTrack=function(e){var t=Pn(this._periods,e),n=void 0!==t?t.audio:null;if((0,S.Z)(n))return null;var r=this._audioChoiceMemory.get(e);return(0,S.Z)(r)?null:r.toAudioTrack()},t.getChosenTextTrack=function(e){var t=Pn(this._periods,e),n=void 0!==t?t.text:null;if((0,S.Z)(n))return null;var r=this._textChoiceMemory.get(e);return(0,S.Z)(r)?null:r.toTextTrack()},t.getChosenVideoTrack=function(e){var t=Pn(this._periods,e),n=void 0!==t?t.video:null;if((0,S.Z)(n))return null;var r=this._videoChoiceMemory.get(e);return(0,S.Z)(r)?null:r.adaptation.toVideoTrack()},t.getAvailableAudioTracks=function(e){var t=Pn(this._periods,e),n=void 0!==t?t.audio:null;if((0,S.Z)(n))return[];var r=this._audioChoiceMemory.get(e),i=(0,S.Z)(r)?null:r.id;return n.adaptations.map((function(e){var t=null!==i&&i===e.id;return(0,T.Z)(e.toAudioTrack(),{active:t})}))},t.getAvailableTextTracks=function(e){var t=Pn(this._periods,e),n=void 0!==t?t.text:null;if((0,S.Z)(n))return[];var r=this._textChoiceMemory.get(e),i=(0,S.Z)(r)?null:r.id;return n.adaptations.map((function(e){var t=null!==i&&i===e.id;return(0,T.Z)(e.toTextTrack(),{active:t})}))},t.getAvailableVideoTracks=function(e){var t,n=Pn(this._periods,e),r=void 0!==n?n.video:null;if((0,S.Z)(r))return[];var i=this._videoChoiceMemory.get(e),a=void 0===i?void 0:null!==(t=null==i?void 0:i.adaptation.id)&&void 0!==t?t:void 0;return r.adaptations.map((function(e){var t=null!==a&&a===e.id,n=e.toVideoTrack(),r=void 0!==n.trickModeTracks?n.trickModeTracks.map((function(e){var t=null!==a&&a===e.id;return(0,T.Z)(e,{active:t})})):[],i=(0,T.Z)(n,{active:t});return void 0!==r&&(i.trickModeTracks=r),i}))},t._applyAudioPreferences=function(){this._audioChoiceMemory=new WeakMap,this._resetChosenAudioTracks()},t._applyTextPreferences=function(){this._textChoiceMemory=new WeakMap,this._resetChosenTextTracks()},t._applyVideoPreferences=function(){this._videoChoiceMemory=new WeakMap,this._resetChosenVideoTracks()},t._resetChosenAudioTracks=function(){var e=this,t=kn(this._preferredAudioTracks);!function n(r){if(!(r>=e._periods.length())){var i=e._periods.get(r);if((0,S.Z)(i.audio))n(r+1);else{var a=i.period,o=i.audio,s=a.getSupportedAdaptations("audio"),u=e._audioChoiceMemory.get(a);if(null===u||void 0!==u&&(0,g.Z)(s,u))n(r+1);else{var l=Zn(s,t);e._audioChoiceMemory.set(a,l),o.adaptationRef.setValue(l),n(0)}}}}(0)},t._resetChosenTextTracks=function(){var e=this,t=wn(this._preferredTextTracks);!function n(r){if(!(r>=e._periods.length())){var i=e._periods.get(r);if((0,S.Z)(i.text))n(r+1);else{var a=i.period,o=i.text,s=a.getSupportedAdaptations("text"),u=e._textChoiceMemory.get(a);if(null===u||void 0!==u&&(0,g.Z)(s,u))n(r+1);else{var l=xn(s,t,e._audioChoiceMemory.get(a));e._textChoiceMemory.set(a,l),o.adaptationRef.setValue(l),n(0)}}}}(0)},t._resetChosenVideoTracks=function(){var e=this,t=this._preferredVideoTracks;!function n(r){if(!(r>=e._periods.length())){var i=e._periods.get(r);if((0,S.Z)(i.video))n(r+1);else{var a=i.period,o=i.video,s=a.getSupportedAdaptations("video"),u=e._videoChoiceMemory.get(a);if(null!==u){if(void 0!==u&&(0,g.Z)(s,u.baseAdaptation)){var l=Dn(u.baseAdaptation,e.trickModeTrackEnabled);return l.id===u.adaptation.id?void n(r+1):(e._videoChoiceMemory.set(a,{baseAdaptation:u.baseAdaptation,adaptation:l}),o.adaptationRef.setValue(l),n(0))}var d=Cn(s,t);if(null===d)return e._videoChoiceMemory.set(a,null),o.adaptationRef.setValue(null),n(0);var c=Dn(d,e.trickModeTrackEnabled);return e._videoChoiceMemory.set(a,{baseAdaptation:d,adaptation:c}),o.adaptationRef.setValue(c),n(0)}n(r+1)}}}(0)},e}();function In(e){return function(t){var n;if(void 0!==e.normalized&&(null!==(n=t.normalizedLanguage)&&void 0!==n?n:"")!==e.normalized)return!1;if(void 0!==e.audioDescription)if(e.audioDescription){if(!0!==t.isAudioDescription)return!1}else if(!0===t.isAudioDescription)return!1;if(void 0===e.codec)return!0;var r=e.codec.test,i=function(e){return void 0!==e.codec&&r.test(e.codec)};return e.codec.all?t.representations.every(i):t.representations.some(i)}}function Zn(e,t){if(0===e.length)return null;for(var n=0;n0){if(null!=n){var l=(0,z.Z)(u,(function(e){return e.normalizedLanguage===n.normalizedLanguage}));if(void 0!==l)return l}return null!==(r=(0,z.Z)(u,(function(e){return void 0===e.normalizedLanguage})))&&void 0!==r?r:null}return null}function Mn(e){return function(t){if(void 0!==e.signInterpreted&&e.signInterpreted!==t.isSignInterpreted)return!1;if(void 0===e.codec)return!0;var n=e.codec.test,r=function(e){return void 0!==e.codec&&n.test(e.codec)};return e.codec.all?t.representations.every(r):t.representations.some(r)}}function Cn(e,t){if(0===e.length)return null;for(var n=0;n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Un(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);ng)throw new Error('Invalid maxVideoBitrate parameter. Its value, "'+g+'", is inferior to the set minVideoBitrate, "'+h+'"')}if((0,S.Z)(e.maxAudioBitrate))m=E.audio;else{if(m=Number(e.maxAudioBitrate),isNaN(m))throw new Error("Invalid maxAudioBitrate parameter. Should be a number.");if(p>m)throw new Error('Invalid maxAudioBitrate parameter. Its value, "'+m+'", is inferior to the set minAudioBitrate, "'+p+'"')}return{maxBufferAhead:t,maxBufferBehind:n,limitVideoWidth:C,videoElement:d,wantedBufferAhead:r,maxVideoBufferSize:i,throttleWhenHidden:a,throttleVideoBitrateWhenHidden:o,preferredAudioTracks:s,preferredTextTracks:u,preferredVideoTracks:l,initialAudioBitrate:v,initialVideoBitrate:f,minAudioBitrate:p,minVideoBitrate:h,maxAudioBitrate:m,maxVideoBitrate:g,stopAtEnd:(0,S.Z)(e.stopAtEnd)?Z:!!e.stopAtEnd}}(e),o=a.initialAudioBitrate,s=a.initialVideoBitrate,u=a.limitVideoWidth,d=a.minAudioBitrate,f=a.minVideoBitrate,v=a.maxAudioBitrate,p=a.maxBufferAhead,h=a.maxBufferBehind,m=a.maxVideoBitrate,g=a.preferredAudioTracks,y=a.preferredTextTracks,_=a.preferredVideoTracks,b=a.throttleWhenHidden,T=a.throttleVideoBitrateWhenHidden,E=a.videoElement,I=a.wantedBufferAhead,Z=a.maxVideoBufferSize,R=a.stopAtEnd,x=c.Z.getCurrent().DEFAULT_UNMUTED_VOLUME;E.preload="auto",t.version="3.31.0",t.log=l.Z,t.state="STOPPED",t.videoElement=E;var M=new w.ZP;t._destroyCanceller=M,t._priv_pictureInPictureRef=Vn(E,M.signal),Gn(E,(function(){t.trigger("fullscreenChange",t.isFullscreen())}),M.signal);for(var C=[],P=0;P<(null===(r=E.textTracks)||void 0===r?void 0:r.length);P++){var D=null===(i=E.textTracks)||void 0===i?void 0:i[P];(0,S.Z)(D)||C.push(D)}var N=function(e){for(var n=e.target,r=[],i=0;i0?e.textTracks[0]:null},i.getPlayerState=function(){return this.state},i.isContentLoaded=function(){return!(0,g.Z)(["LOADING","RELOADING","STOPPED"],this.state)},i.isBuffering=function(){return(0,g.Z)(["BUFFERING","SEEKING","LOADING","RELOADING"],this.state)},i.isPaused=function(){return!this.videoElement||((0,g.Z)(["LOADING","RELOADING"],this.state)?!this._priv_lastAutoPlay:this.videoElement.paused)},i.isLive=function(){if(null===this._priv_contentInfos)return!1;var e=this._priv_contentInfos,t=e.isDirectFile,n=e.manifest;return!t&&null!==n&&n.isLive},i.areTrickModeTracksEnabled=function(){return this._priv_preferTrickModeTracks},i.getUrl=function(){if(null!==this._priv_contentInfos){var e=this._priv_contentInfos,t=e.isDirectFile,n=e.manifest,r=e.originalUrl;return t?r:null!==n?n.getUrl():void 0}},i.updateContentUrls=function(e,t){if(null===this._priv_contentInfos)throw new Error("No content loaded");var n=!0===(null==t?void 0:t.refresh);this._priv_contentInfos.initializer.updateContentUrls(e,n)},i.getVideoDuration=function(){if(null===this.videoElement)throw new Error("Disposed player");return this.videoElement.duration},i.getVideoBufferGap=function(){if(null===this.videoElement)throw new Error("Disposed player");var e=this.videoElement;return(0,E.L7)(e.buffered,e.currentTime)},i.getVideoLoadedTime=function(){if((0,A.Z)("`getVideoLoadedTime` is deprecated and won't be present in the next major version"),null===this.videoElement)throw new Error("Disposed player");var e=this.videoElement;return(0,E.at)(e.buffered,e.currentTime)},i.getVideoPlayedTime=function(){if((0,A.Z)("`getVideoPlayedTime` is deprecated and won't be present in the next major version"),null===this.videoElement)throw new Error("Disposed player");var e=this.videoElement;return(0,E.DD)(e.buffered,e.currentTime)},i.getWallClockTime=function(){if(null===this.videoElement)throw new Error("Disposed player");if(null===this._priv_contentInfos)return this.videoElement.currentTime;var e=this._priv_contentInfos,t=e.isDirectFile,n=e.manifest;if(t){var r=a(this.videoElement);return(null!=r?r:0)+this.videoElement.currentTime}return null!==n?this.videoElement.currentTime+(void 0!==n.availabilityStartTime?n.availabilityStartTime:0):0},i.getPosition=function(){if(null===this.videoElement)throw new Error("Disposed player");return this.videoElement.currentTime},i.getLastStoredContentPosition=function(){return this._priv_reloadingMetadata.reloadPosition},i.getPlaybackRate=function(){return this._priv_speed.getValue()},i.setPlaybackRate=function(e,t){var n;e!==this._priv_speed.getValue()&&this._priv_speed.setValue(e);var r=null==t?void 0:t.preferTrickModeTracks;if("boolean"==typeof r){this._priv_preferTrickModeTracks=r;var i=null===(n=this._priv_contentInfos)||void 0===n?void 0:n.trackChoiceManager;(0,S.Z)(i)||(r&&!i.isTrickModeEnabled()?i.enableVideoTrickModeTracks():!r&&i.isTrickModeEnabled()&&i.disableVideoTrickModeTracks())}},i.getAvailableVideoBitrates=function(){if(null===this._priv_contentInfos)return[];var e=this._priv_contentInfos,t=e.currentPeriod,n=e.activeAdaptations;if(null===t||null===n)return[];var r=n[t.id];return void 0===r||(0,S.Z)(r.video)?[]:r.video.getAvailableBitrates()},i.getAvailableAudioBitrates=function(){if(null===this._priv_contentInfos)return[];var e=this._priv_contentInfos,t=e.currentPeriod,n=e.activeAdaptations;if(null===t||null===n)return[];var r=n[t.id];return void 0===r||(0,S.Z)(r.audio)?[]:r.audio.getAvailableBitrates()},i.getManualAudioBitrate=function(){return this._priv_bitrateInfos.manualBitrates.audio.getValue()},i.getManualVideoBitrate=function(){return this._priv_bitrateInfos.manualBitrates.video.getValue()},i.getVideoBitrate=function(){var e=this._priv_getCurrentRepresentations();if(null!==e&&!(0,S.Z)(e.video))return e.video.bitrate},i.getAudioBitrate=function(){var e=this._priv_getCurrentRepresentations();if(null!==e&&!(0,S.Z)(e.audio))return e.audio.bitrate},i.getMinVideoBitrate=function(){return this._priv_bitrateInfos.minAutoBitrates.video.getValue()},i.getMinAudioBitrate=function(){return this._priv_bitrateInfos.minAutoBitrates.audio.getValue()},i.getMaxVideoBitrate=function(){return this._priv_bitrateInfos.maxAutoBitrates.video.getValue()},i.getMaxAudioBitrate=function(){return this._priv_bitrateInfos.maxAutoBitrates.audio.getValue()},i.play=function(){var e=this;if(null===this.videoElement)throw new Error("Disposed player");var t=this.videoElement.play();return(0,S.Z)(t)||"function"!=typeof t.catch?Promise.resolve():t.catch((function(t){if("NotAllowedError"===t.name){var n=new v.Z("MEDIA_ERR_PLAY_NOT_ALLOWED",t.toString());e.trigger("warning",n)}throw t}))},i.pause=function(){if(null===this.videoElement)throw new Error("Disposed player");this.videoElement.pause()},i.seekTo=function(e){var t;if(null===this.videoElement)throw new Error("Disposed player");if(null===this._priv_contentInfos)throw new Error("player: no content loaded");var n,r=this._priv_contentInfos,i=r.isDirectFile,o=r.manifest;if(!i&&null===o)throw new Error("player: the content did not load yet");if("number"==typeof e)n=e;else if("object"==typeof e){var s=e,u=this.videoElement.currentTime;if((0,S.Z)(s.relative))if((0,S.Z)(s.position)){if((0,S.Z)(s.wallClockTime))throw new Error('invalid time object. You must set one of the following properties: "relative", "position" or "wallClockTime"');if(null!==o)n=s.wallClockTime-(null!==(t=o.availabilityStartTime)&&void 0!==t?t:0);else if(i&&null!==this.videoElement){var d=a(this.videoElement);void 0!==d&&(n=s.wallClockTime-d)}void 0===n&&(n=s.wallClockTime)}else n=s.position;else n=u+s.relative}if(void 0===n)throw new Error("invalid time given");return l.Z.info("API: API Seek to",n),this.videoElement.currentTime=n,n},i.isFullscreen=function(){return(0,A.Z)("isFullscreen is deprecated. Fullscreen management should now be managed by the application"),s()},i.setFullscreen=function(e){if(void 0===e&&(e=!0),(0,A.Z)("setFullscreen is deprecated. Fullscreen management should now be managed by the application"),null===this.videoElement)throw new Error("Disposed player");e?function(e){if(!s()){var t=e;"function"==typeof t.requestFullscreen?t.requestFullscreen():"function"==typeof t.msRequestFullscreen?t.msRequestFullscreen():"function"==typeof t.mozRequestFullScreen?t.mozRequestFullScreen():"function"==typeof t.webkitRequestFullscreen&&t.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT)}}(this.videoElement):o()},i.exitFullscreen=function(){(0,A.Z)("exitFullscreen is deprecated. Fullscreen management should now be managed by the application"),o()},i.getVolume=function(){if(null===this.videoElement)throw new Error("Disposed player");return this.videoElement.volume},i.setVolume=function(e){if(null===this.videoElement)throw new Error("Disposed player");var t=this.videoElement;e!==t.volume&&(t.volume=e,this.trigger("volumeChange",e))},i.isMute=function(){return 0===this.getVolume()},i.mute=function(){this._priv_mutedMemory=this.getVolume(),this.setVolume(0)},i.unMute=function(){var e=c.Z.getCurrent().DEFAULT_UNMUTED_VOLUME;0===this.getVolume()&&this.setVolume(0===this._priv_mutedMemory?e:this._priv_mutedMemory)},i.setVideoBitrate=function(e){this._priv_bitrateInfos.manualBitrates.video.setValue(e)},i.setAudioBitrate=function(e){this._priv_bitrateInfos.manualBitrates.audio.setValue(e)},i.setMinVideoBitrate=function(e){var t=this._priv_bitrateInfos.maxAutoBitrates.video.getValue();if(e>t)throw new Error('Invalid minimum video bitrate given. Its value, "'+e+'" is superior the current maximum video birate, "'+t+'".');this._priv_bitrateInfos.minAutoBitrates.video.setValue(e)},i.setMinAudioBitrate=function(e){var t=this._priv_bitrateInfos.maxAutoBitrates.audio.getValue();if(e>t)throw new Error('Invalid minimum audio bitrate given. Its value, "'+e+'" is superior the current maximum audio birate, "'+t+'".');this._priv_bitrateInfos.minAutoBitrates.audio.setValue(e)},i.setMaxVideoBitrate=function(e){var t=this._priv_bitrateInfos.minAutoBitrates.video.getValue();if(e0||c.result.removedAdaptations.length>0)){var f=u.getAvailableAudioTracks(s);r._priv_triggerEventIfNotStopped("availableAudioTracksChange",null!=f?f:[],i);var v=u.getAvailableTextTracks(s);r._priv_triggerEventIfNotStopped("availableTextTracksChange",null!=v?v:[],i);var p=u.getAvailableVideoTracks(s);r._priv_triggerEventIfNotStopped("availableVideoTracksChange",null!=p?p:[],i)}return}}),e.currentContentCanceller.signal)}},i._priv_onActivePeriodChanged=function(e,t){var n,r,i,a,o,s,u,l,d=t.period;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){e.currentPeriod=d;var c=e.currentContentCanceller.signal;this._priv_contentEventsMemory.periodChange!==d&&(this._priv_contentEventsMemory.periodChange=d,this._priv_triggerEventIfNotStopped("periodChange",d,c)),this._priv_triggerEventIfNotStopped("availableAudioTracksChange",this.getAvailableAudioTracks(),c),this._priv_triggerEventIfNotStopped("availableTextTracksChange",this.getAvailableTextTracks(),c),this._priv_triggerEventIfNotStopped("availableVideoTracksChange",this.getAvailableVideoTracks(),c);var f=null===(r=this._priv_contentInfos)||void 0===r?void 0:r.trackChoiceManager;if((0,S.Z)(f))this._priv_triggerEventIfNotStopped("audioTrackChange",null,c),this._priv_triggerEventIfNotStopped("textTrackChange",null,c),this._priv_triggerEventIfNotStopped("videoTrackChange",null,c);else{var v=f.getChosenAudioTrack(d);this._priv_triggerEventIfNotStopped("audioTrackChange",v,c);var p=f.getChosenTextTrack(d);this._priv_triggerEventIfNotStopped("textTrackChange",p,c);var h=f.getChosenVideoTrack(d);this._priv_triggerEventIfNotStopped("videoTrackChange",h,c)}if(this._priv_triggerAvailableBitratesChangeEvent("availableAudioBitratesChange",this.getAvailableAudioBitrates(),c),!e.currentContentCanceller.isUsed()&&(this._priv_triggerAvailableBitratesChangeEvent("availableVideoBitratesChange",this.getAvailableVideoBitrates(),c),!e.currentContentCanceller.isUsed())){var m=null!==(o=null===(a=null===(i=this._priv_getCurrentRepresentations())||void 0===i?void 0:i.audio)||void 0===a?void 0:a.bitrate)&&void 0!==o?o:-1;if(this._priv_triggerCurrentBitrateChangeEvent("audioBitrateChange",m,c),!e.currentContentCanceller.isUsed()){var g=null!==(l=null===(u=null===(s=this._priv_getCurrentRepresentations())||void 0===s?void 0:s.video)||void 0===u?void 0:u.bitrate)&&void 0!==l?l:-1;this._priv_triggerCurrentBitrateChangeEvent("videoBitrateChange",g,c)}}}},i._priv_onPeriodStreamReady=function(e,t){var n;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){var r=t.type,i=t.period,a=t.adaptationRef,o=e.trackChoiceManager;switch(r){case"video":(0,S.Z)(o)?(l.Z.error("API: TrackChoiceManager not instanciated for a new video period"),a.setValue(null)):(o.addPeriod(r,i,a),o.setInitialVideoTrack(i));break;case"audio":(0,S.Z)(o)?(l.Z.error("API: TrackChoiceManager not instanciated for a new "+r+" period"),a.setValue(null)):(o.addPeriod(r,i,a),o.setInitialAudioTrack(i));break;case"text":(0,S.Z)(o)?(l.Z.error("API: TrackChoiceManager not instanciated for a new "+r+" period"),a.setValue(null)):(o.addPeriod(r,i,a),o.setInitialTextTrack(i));break;default:var s=i.adaptations[r];!(0,S.Z)(s)&&s.length>0?a.setValue(s[0]):a.setValue(null)}}},i._priv_onPeriodStreamCleared=function(e,t){var n;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){var r=t.type,i=t.period,a=e.trackChoiceManager;switch(r){case"audio":case"text":case"video":(0,S.Z)(a)||a.removePeriod(r,i)}var o=e.activeAdaptations,s=e.activeRepresentations;if(!(0,S.Z)(o)&&!(0,S.Z)(o[i.id])){var u=o[i.id];delete u[r],0===Object.keys(u).length&&delete o[i.id]}if(!(0,S.Z)(s)&&!(0,S.Z)(s[i.id])){var l=s[i.id];delete l[r],0===Object.keys(l).length&&delete s[i.id]}}},i._priv_onAdaptationChange=function(e,t){var n,r=t.type,i=t.adaptation,a=t.period;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){null===e.activeAdaptations&&(e.activeAdaptations={});var o,s=e.activeAdaptations,u=e.currentPeriod,l=s[a.id];if((0,S.Z)(l))s[a.id]=((o={})[r]=i,o);else l[r]=i;var d=e.trackChoiceManager,c=e.currentContentCanceller.signal;if(null!==d&&null!==u&&!(0,S.Z)(a)&&a.id===u.id)switch(r){case"audio":var f=d.getChosenAudioTrack(u);this._priv_triggerEventIfNotStopped("audioTrackChange",f,c);var v=this.getAvailableAudioBitrates();this._priv_triggerAvailableBitratesChangeEvent("availableAudioBitratesChange",v,c);break;case"text":var p=d.getChosenTextTrack(u);this._priv_triggerEventIfNotStopped("textTrackChange",p,c);break;case"video":var h=d.getChosenVideoTrack(u);this._priv_triggerEventIfNotStopped("videoTrackChange",h,c);var m=this.getAvailableVideoBitrates();this._priv_triggerAvailableBitratesChangeEvent("availableVideoBitratesChange",m,c)}}},i._priv_onRepresentationChange=function(e,t){var n,r,i=t.type,a=t.period,o=t.representation;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){null===e.activeRepresentations&&(e.activeRepresentations={});var s,u=e.activeRepresentations,l=e.currentPeriod,d=u[a.id];if((0,S.Z)(d))u[a.id]=((s={})[i]=o,s);else d[i]=o;var c=null!==(r=null==o?void 0:o.bitrate)&&void 0!==r?r:-1;if(!(0,S.Z)(a)&&null!==l&&l.id===a.id){var f=this._priv_contentInfos.currentContentCanceller.signal;"video"===i?this._priv_triggerCurrentBitrateChangeEvent("videoBitrateChange",c,f):"audio"===i&&this._priv_triggerCurrentBitrateChangeEvent("audioBitrateChange",c,f)}}},i._priv_onBitrateEstimationChange=function(e){var t=e.type,n=e.bitrate;void 0!==n&&(this._priv_bitrateInfos.lastBitrates[t]=n),this.trigger("bitrateEstimationChange",{type:t,bitrate:n})},i._priv_onNativeTextTracksNext=function(e){this.trigger("nativeTextTracksChange",e)},i._priv_setPlayerState=function(e){this.state!==e&&(this.state=e,l.Z.info("API: playerStateChange event",e),this.trigger("playerStateChange",e))},i._priv_triggerPositionUpdate=function(e,t){var n,r;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){var i=e.isDirectFile,o=e.manifest;if((i||null!==o)&&!(0,S.Z)(t)){var s=null!==o?o.getMaximumSafePosition():void 0,u={position:t.position,duration:t.duration,playbackRate:t.playbackRate,maximumBufferTime:s,bufferGap:void 0!==t.bufferGap&&isFinite(t.bufferGap)?t.bufferGap:0};if(null!==o&&o.isLive&&t.position>0){var l=null!==(r=o.availabilityStartTime)&&void 0!==r?r:0;u.wallClockTime=t.position+l;var d=o.getLivePosition();void 0!==d&&(u.liveGap=d-t.position)}else if(i&&null!==this.videoElement){var c=a(this.videoElement);void 0!==c&&(u.wallClockTime=c+t.position)}this.trigger("positionUpdate",u)}}},i._priv_triggerAvailableBitratesChangeEvent=function(e,t,n){var r=this._priv_contentEventsMemory[e];n.isCancelled()||void 0!==r&&(0,m.Z)(t,r)||(this._priv_contentEventsMemory[e]=t,this.trigger(e,t))},i._priv_triggerCurrentBitrateChangeEvent=function(e,t,n){n.isCancelled()||t===this._priv_contentEventsMemory[e]||(this._priv_contentEventsMemory[e]=t,this.trigger(e,t))},i._priv_getCurrentRepresentations=function(){if(null===this._priv_contentInfos)return null;var e=this._priv_contentInfos,t=e.currentPeriod,n=e.activeRepresentations;return null===t||null===n||(0,S.Z)(n[t.id])?null:n[t.id]},i._priv_triggerEventIfNotStopped=function(e,t,n){n.isCancelled()||this.trigger(e,t)},i._priv_initializeMediaElementTrackChoiceManager=function(e,t,n){var r,i,a,o=this;(0,y.Z)(null!==h.Z.directfile,"Initializing `MediaElementTrackChoiceManager` without Directfile feature"),(0,y.Z)(null!==this.videoElement,"Initializing `MediaElementTrackChoiceManager` on a disposed RxPlayer");var s=new h.Z.directfile.mediaElementTrackChoiceManager(this.videoElement),u=void 0===e?this._priv_preferredAudioTracks:[e];s.setPreferredAudioTracks(u,!0);var l=void 0===t?this._priv_preferredTextTracks:[t];return s.setPreferredTextTracks(l,!0),s.setPreferredVideoTracks(this._priv_preferredVideoTracks,!0),this._priv_triggerEventIfNotStopped("availableAudioTracksChange",s.getAvailableAudioTracks(),n),this._priv_triggerEventIfNotStopped("availableVideoTracksChange",s.getAvailableVideoTracks(),n),this._priv_triggerEventIfNotStopped("availableTextTracksChange",s.getAvailableTextTracks(),n),this._priv_triggerEventIfNotStopped("audioTrackChange",null!==(r=s.getChosenAudioTrack())&&void 0!==r?r:null,n),this._priv_triggerEventIfNotStopped("textTrackChange",null!==(i=s.getChosenTextTrack())&&void 0!==i?i:null,n),this._priv_triggerEventIfNotStopped("videoTrackChange",null!==(a=s.getChosenVideoTrack())&&void 0!==a?a:null,n),s.addEventListener("availableVideoTracksChange",(function(e){return o.trigger("availableVideoTracksChange",e)})),s.addEventListener("availableAudioTracksChange",(function(e){return o.trigger("availableAudioTracksChange",e)})),s.addEventListener("availableTextTracksChange",(function(e){return o.trigger("availableTextTracksChange",e)})),s.addEventListener("audioTrackChange",(function(e){return o.trigger("audioTrackChange",e)})),s.addEventListener("videoTrackChange",(function(e){return o.trigger("videoTrackChange",e)})),s.addEventListener("textTrackChange",(function(e){return o.trigger("textTrackChange",e)})),s},(0,e.Z)(r,null,[{key:"ErrorTypes",get:function(){return p.ZB}},{key:"ErrorCodes",get:function(){return p.SM}},{key:"LogLevel",get:function(){return l.Z.getLevel()},set:function(e){l.Z.setLevel(e)}}]),r}(_.Z);jn.version="3.31.0";var qn=jn,Yn=n(7273);!function(){Yn.Z.ContentDecryptor=n(1266).ZP,Yn.Z.imageBuffer=n(7127).Z,Yn.Z.imageParser=n(3203).Z,Yn.Z.transports.smooth=n(2339).Z,Yn.Z.transports.dash=n(85).Z,Yn.Z.dashParsers.js=n(4541).Z,Yn.Z.nativeTextTracksBuffer=n(9059).Z,Yn.Z.nativeTextTracksParsers.vtt=n(9405).Z,Yn.Z.nativeTextTracksParsers.ttml=n(1570).Z,Yn.Z.nativeTextTracksParsers.sami=n(1812).Z,Yn.Z.nativeTextTracksParsers.srt=n(8057).Z,Yn.Z.htmlTextTracksBuffer=n(5192).Z,Yn.Z.htmlTextTracksParsers.sami=n(5734).Z,Yn.Z.htmlTextTracksParsers.ttml=n(7439).Z,Yn.Z.htmlTextTracksParsers.srt=n(8675).Z,Yn.Z.htmlTextTracksParsers.vtt=n(4099).Z;var e=n(9372).Z,t=n(6796).Z;Yn.Z.directfile={initDirectFile:e,mediaElementTrackChoiceManager:t}}(),"boolean"==typeof __RX_PLAYER_DEBUG_MODE__&&__RX_PLAYER_DEBUG_MODE__&&l.Z.setLevel("DEBUG");var Xn=qn}(),r=r.default}()})); \ No newline at end of file From afece6df041e2d41604d9672dd4aebf6d3558df8 Mon Sep 17 00:00:00 2001 From: klatoszewski-oke <62993073+klatoszewski-oke@users.noreply.github.com> Date: Fri, 8 Sep 2023 10:09:14 +0200 Subject: [PATCH 3/5] review fix --- doc/api/Player_Errors.md | 3 +++ doc/api/Track_Selection/getAudioTrack.md | 3 +++ doc/api/Track_Selection/getAvailableAudioTracks.md | 3 +++ src/manifest/representation.ts | 4 ++-- 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/doc/api/Player_Errors.md b/doc/api/Player_Errors.md index c405903b0cf..e380a80f088 100644 --- a/doc/api/Player_Errors.md +++ b/doc/api/Player_Errors.md @@ -352,6 +352,9 @@ contains the following properties: - `codec` (`string|undefined`): The audio codec the Representation is in, as announced in the corresponding Manifest. + - `isSpatialAudio` (`Boolean|undefined`): If set to `true`, this Representation + has spatial audio. + ##### For text tracks When `trackInfo.type` is set to `"text"`, `track` describes a text track. It diff --git a/doc/api/Track_Selection/getAudioTrack.md b/doc/api/Track_Selection/getAudioTrack.md index 3ceb90a34ec..347cb1b0436 100644 --- a/doc/api/Track_Selection/getAudioTrack.md +++ b/doc/api/Track_Selection/getAudioTrack.md @@ -51,6 +51,9 @@ return an object with the following properties: - `codec` (`string|undefined`): The audio codec the Representation is in, as announced in the corresponding Manifest. + - `isSpatialAudio` (`Boolean|undefined`): If set to `true`, this Representation + has spatial audio. + `undefined` if no audio content has been loaded yet or if its information is unknown. diff --git a/doc/api/Track_Selection/getAvailableAudioTracks.md b/doc/api/Track_Selection/getAvailableAudioTracks.md index 0a439c512d9..ab3b7dda0f2 100644 --- a/doc/api/Track_Selection/getAvailableAudioTracks.md +++ b/doc/api/Track_Selection/getAvailableAudioTracks.md @@ -47,6 +47,9 @@ Each of the objects in the returned array have the following properties: - `codec` (`string|undefined`): The audio codec the Representation is in, as announced in the corresponding Manifest. + - `isSpatialAudio` (`Boolean|undefined`): If set to `true`, this Representation + has spatial audio. +

Note for multi-Period contents:
diff --git a/src/manifest/representation.ts b/src/manifest/representation.ts index b8bfd1b271d..eebd3da56d8 100644 --- a/src/manifest/representation.ts +++ b/src/manifest/representation.ts @@ -348,8 +348,8 @@ class Representation { * @returns {Object} */ public toAudioRepresentation(): IAudioRepresentation { - const { id, bitrate, codec } = this; - return { id, bitrate, codec }; + const { id, isSpatialAudio, bitrate, codec } = this; + return { id, isSpatialAudio, bitrate, codec }; } /** From cfaa5f9bc6669ac96ab3262c00fb66d77bd9ef59 Mon Sep 17 00:00:00 2001 From: Paul Berberian Date: Tue, 12 Sep 2023 16:21:41 +0200 Subject: [PATCH 4/5] Add Representation-level SupplementalProperties parsing for the wasm parser --- .../dash/wasm-parser/ts/generators/Representation.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/parsers/manifest/dash/wasm-parser/ts/generators/Representation.ts b/src/parsers/manifest/dash/wasm-parser/ts/generators/Representation.ts index d7b35707ed2..266a16b630b 100644 --- a/src/parsers/manifest/dash/wasm-parser/ts/generators/Representation.ts +++ b/src/parsers/manifest/dash/wasm-parser/ts/generators/Representation.ts @@ -84,6 +84,18 @@ export function generateRepresentationChildrenParser( break; } + case TagName.SupplementalProperty: { + const supplementalProperty = {}; + if (childrenObj.supplementalProperties === undefined) { + childrenObj.supplementalProperties = []; + } + childrenObj.supplementalProperties.push(supplementalProperty); + const attributeParser = generateSchemeAttrParser(supplementalProperty, + linearMemory); + parsersStack.pushParsers(nodeId, noop, attributeParser); + break; + } + case TagName.SegmentBase: { const segmentBaseObj = {}; childrenObj.segmentBase = segmentBaseObj; From 6fa0917efa2bc2df8d982721b6ce64226a7ca94f Mon Sep 17 00:00:00 2001 From: Paul Berberian Date: Tue, 12 Sep 2023 16:50:06 +0200 Subject: [PATCH 5/5] Some finishing steps on spatial audio PR --- doc/api/Miscellaneous/Local_Contents.md | 11 +++++++++++ src/manifest/representation.ts | 17 +++++++++++++++-- .../dash/common/parse_representations.ts | 15 ++++++++++----- src/parsers/manifest/dash/node_parser_types.ts | 1 - src/parsers/manifest/local/types.ts | 2 +- 5 files changed, 37 insertions(+), 9 deletions(-) diff --git a/doc/api/Miscellaneous/Local_Contents.md b/doc/api/Miscellaneous/Local_Contents.md index f6bb5f47059..bf83b573ba3 100644 --- a/doc/api/Miscellaneous/Local_Contents.md +++ b/doc/api/Miscellaneous/Local_Contents.md @@ -419,6 +419,7 @@ For audio tracks, it can looks like: bitrate: 200000, mimeType: "audio/mp4", codecs: "mp4a.40.5", + isSpatialAudio: false, index: { loadInitSegment(callbacks) { /* ... */ }, loadSegment(segment, callbacks) { /* ... */, @@ -470,6 +471,16 @@ We'll now explain what each property is for, before going deeper into the - height (`number|undefined`): When relevant (mostly video contents), the height of the media, in pixels +- isSpatialAudio (`boolean|undefined`): When relevant (mostly audio contents), + it can be set to `true` if the corresponding media is linked to a spatial + audio technology, for example a content relying on Dolby Atmos technology. + + If set to `false`, it means that it is known that this media does not contain + any spatial audio. + + For cases where you don't know and for cases where no audio is contained, this + can just be left undefined. + - index (`object`): Object allowing the RxPlayer to know the list of segments as well as to fetch them. Described in the next chapter. diff --git a/src/manifest/representation.ts b/src/manifest/representation.ts index eebd3da56d8..e53c60438d5 100644 --- a/src/manifest/representation.ts +++ b/src/manifest/representation.ts @@ -67,7 +67,17 @@ class Representation { */ public frameRate? : string; - /** `true` if audio has Dolby Atmos. */ + /** + * `true` if this `Representation` is linked to a spatial audio technology. + * For example, it may be set to `true` if the Representation relies on the + * "Dolby Atmos". technology. + * + * `false` if it is known that this `Representation` does not contain any + * spatial audio. + * + * `undefined` if we do not know whether this `Representation` contains + * spatial audio or not. + */ public isSpatialAudio? : boolean | undefined; /** @@ -124,7 +134,10 @@ class Representation { this.id = args.id; this.bitrate = args.bitrate; this.codec = args.codecs; - this.isSpatialAudio = args.isSpatialAudio; + + if (args.isSpatialAudio !== undefined) { + this.isSpatialAudio = args.isSpatialAudio; + } if (args.height !== undefined) { this.height = args.height; diff --git a/src/parsers/manifest/dash/common/parse_representations.ts b/src/parsers/manifest/dash/common/parse_representations.ts index 6edc15e749d..8379a7a3f29 100644 --- a/src/parsers/manifest/dash/common/parse_representations.ts +++ b/src/parsers/manifest/dash/common/parse_representations.ts @@ -185,18 +185,23 @@ export default function parseRepresentations( [ { baseUrl: "", id: undefined } ] : representationBaseURLs.map(x => ({ baseUrl: x.url, id: x.serviceLocation })); - const isSpatialAudio = - !!(representation.children.supplementalProperties && - arrayFind(representation.children.supplementalProperties, r => r.value === "JOC")); - // Construct Representation Base const parsedRepresentation : IParsedRepresentation = { bitrate: representationBitrate, cdnMetadata, index: representationIndex, - isSpatialAudio, id: representationID }; + if ( + representation.children.supplementalProperties !== undefined && + arrayFind(representation.children.supplementalProperties, r => + r.schemeIdUri === "tag:dolby.com,2018:dash:EC3_ExtensionType:2018" && + r.value === "JOC" + ) + ) { + parsedRepresentation.isSpatialAudio = true; + } + // Add optional attributes let codecs : string|undefined; if (representation.attributes.codecs != null) { diff --git a/src/parsers/manifest/dash/node_parser_types.ts b/src/parsers/manifest/dash/node_parser_types.ts index 6e35c2eeb75..dc24b076dd7 100644 --- a/src/parsers/manifest/dash/node_parser_types.ts +++ b/src/parsers/manifest/dash/node_parser_types.ts @@ -201,7 +201,6 @@ export interface IAdaptationSetChildren { segmentList? : ISegmentListIntermediateRepresentation | undefined; segmentTemplate? : ISegmentTemplateIntermediateRepresentation | undefined; label? : string | undefined; - isSpatialAudio? : boolean | undefined; } /* Intermediate representation for An AdaptationSet node's attributes. */ diff --git a/src/parsers/manifest/local/types.ts b/src/parsers/manifest/local/types.ts index 61d326daf92..32d3b10511e 100644 --- a/src/parsers/manifest/local/types.ts +++ b/src/parsers/manifest/local/types.ts @@ -194,7 +194,7 @@ export interface ILocalRepresentation { /** Interface allowing to retrieve media segments for this quality. */ index : ILocalIndex; /** `true` if audio has Dolby Atmos. */ - isSpatialAudio : boolean; + isSpatialAudio? : boolean; } /** A "track"" of a "local" Manifest. */