bitmovin-player 8.280.0 → 8.281.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/bitmovinplayer-serviceworker.js +2 -2
  2. package/bitmovinplayer-serviceworker.prod.js +2 -2
  3. package/bitmovinplayer-ui.js +1 -1
  4. package/bitmovinplayer.js +2 -2
  5. package/bitmovinplayer.prod.js +2 -2
  6. package/modules/bitmovinplayer-abr.js +2 -2
  7. package/modules/bitmovinplayer-abr.prod.js +2 -2
  8. package/modules/bitmovinplayer-advertising-bitmovin.js +2 -2
  9. package/modules/bitmovinplayer-advertising-bitmovin.prod.js +2 -2
  10. package/modules/bitmovinplayer-advertising-core.js +2 -2
  11. package/modules/bitmovinplayer-advertising-core.prod.js +2 -2
  12. package/modules/bitmovinplayer-advertising-ima.js +2 -2
  13. package/modules/bitmovinplayer-advertising-ima.prod.js +2 -2
  14. package/modules/bitmovinplayer-advertising-omsdk.js +2 -2
  15. package/modules/bitmovinplayer-advertising-omsdk.prod.js +2 -2
  16. package/modules/bitmovinplayer-analytics.js +2 -2
  17. package/modules/bitmovinplayer-analytics.prod.js +2 -2
  18. package/modules/bitmovinplayer-container-mp4.js +2 -2
  19. package/modules/bitmovinplayer-container-mp4.prod.js +2 -2
  20. package/modules/bitmovinplayer-container-ts.js +2 -2
  21. package/modules/bitmovinplayer-container-ts.prod.js +2 -2
  22. package/modules/bitmovinplayer-container-webm.js +2 -2
  23. package/modules/bitmovinplayer-container-webm.prod.js +2 -2
  24. package/modules/bitmovinplayer-core.js +2 -2
  25. package/modules/bitmovinplayer-core.prod.js +2 -2
  26. package/modules/bitmovinplayer-crypto.js +2 -2
  27. package/modules/bitmovinplayer-crypto.prod.js +2 -2
  28. package/modules/bitmovinplayer-dash.js +2 -2
  29. package/modules/bitmovinplayer-dash.prod.js +2 -2
  30. package/modules/bitmovinplayer-drm.js +2 -2
  31. package/modules/bitmovinplayer-drm.prod.js +2 -2
  32. package/modules/bitmovinplayer-engine-bitmovin.js +2 -2
  33. package/modules/bitmovinplayer-engine-bitmovin.prod.js +2 -2
  34. package/modules/bitmovinplayer-engine-native.js +2 -2
  35. package/modules/bitmovinplayer-engine-native.prod.js +2 -2
  36. package/modules/bitmovinplayer-engine-webrtc.js +2 -2
  37. package/modules/bitmovinplayer-engine-webrtc.prod.js +2 -2
  38. package/modules/bitmovinplayer-envivio.js +1 -1
  39. package/modules/bitmovinplayer-envivio.prod.js +1 -1
  40. package/modules/bitmovinplayer-hls.js +2 -2
  41. package/modules/bitmovinplayer-hls.prod.js +2 -2
  42. package/modules/bitmovinplayer-lowlatency.js +2 -2
  43. package/modules/bitmovinplayer-lowlatency.prod.js +2 -2
  44. package/modules/bitmovinplayer-mserenderer.js +2 -2
  45. package/modules/bitmovinplayer-mserenderer.prod.js +2 -2
  46. package/modules/bitmovinplayer-patch.js +1 -1
  47. package/modules/bitmovinplayer-patch.prod.js +1 -1
  48. package/modules/bitmovinplayer-playstation4.js +2 -2
  49. package/modules/bitmovinplayer-playstation4.prod.js +2 -2
  50. package/modules/bitmovinplayer-playstation5.js +2 -2
  51. package/modules/bitmovinplayer-playstation5.prod.js +2 -2
  52. package/modules/bitmovinplayer-polyfill.js +1 -1
  53. package/modules/bitmovinplayer-polyfill.prod.js +1 -1
  54. package/modules/bitmovinplayer-reactnative.js +1 -1
  55. package/modules/bitmovinplayer-reactnative.prod.js +1 -1
  56. package/modules/bitmovinplayer-remotecontrol.js +2 -2
  57. package/modules/bitmovinplayer-remotecontrol.prod.js +2 -2
  58. package/modules/bitmovinplayer-serviceworker-client.js +2 -2
  59. package/modules/bitmovinplayer-serviceworker-client.prod.js +2 -2
  60. package/modules/bitmovinplayer-serviceworker.js +2 -2
  61. package/modules/bitmovinplayer-serviceworker.prod.js +2 -2
  62. package/modules/bitmovinplayer-sgai.js +2 -2
  63. package/modules/bitmovinplayer-sgai.prod.js +2 -2
  64. package/modules/bitmovinplayer-smooth.js +2 -2
  65. package/modules/bitmovinplayer-smooth.prod.js +2 -2
  66. package/modules/bitmovinplayer-style.js +2 -2
  67. package/modules/bitmovinplayer-style.prod.js +2 -2
  68. package/modules/bitmovinplayer-subtitles-cea608.js +2 -2
  69. package/modules/bitmovinplayer-subtitles-cea608.prod.js +2 -2
  70. package/modules/bitmovinplayer-subtitles-native.js +2 -2
  71. package/modules/bitmovinplayer-subtitles-native.prod.js +2 -2
  72. package/modules/bitmovinplayer-subtitles-ttml.js +2 -2
  73. package/modules/bitmovinplayer-subtitles-ttml.prod.js +2 -2
  74. package/modules/bitmovinplayer-subtitles-vtt.js +2 -2
  75. package/modules/bitmovinplayer-subtitles-vtt.prod.js +2 -2
  76. package/modules/bitmovinplayer-subtitles.js +2 -2
  77. package/modules/bitmovinplayer-subtitles.prod.js +2 -2
  78. package/modules/bitmovinplayer-thumbnail-imp.js +2 -2
  79. package/modules/bitmovinplayer-thumbnail-imp.prod.js +2 -2
  80. package/modules/bitmovinplayer-thumbnail.js +2 -2
  81. package/modules/bitmovinplayer-thumbnail.prod.js +2 -2
  82. package/modules/bitmovinplayer-tizen.js +2 -2
  83. package/modules/bitmovinplayer-tizen.prod.js +2 -2
  84. package/modules/bitmovinplayer-ui.js +2 -2
  85. package/modules/bitmovinplayer-ui.prod.js +2 -2
  86. package/modules/bitmovinplayer-vidaa.js +2 -2
  87. package/modules/bitmovinplayer-vidaa.prod.js +2 -2
  88. package/modules/bitmovinplayer-vr.js +2 -2
  89. package/modules/bitmovinplayer-vr.prod.js +2 -2
  90. package/modules/bitmovinplayer-webos.js +2 -2
  91. package/modules/bitmovinplayer-webos.prod.js +2 -2
  92. package/modules/bitmovinplayer-wpe.js +2 -2
  93. package/modules/bitmovinplayer-wpe.prod.js +2 -2
  94. package/modules/bitmovinplayer-xml.js +1 -1
  95. package/modules/bitmovinplayer-xml.prod.js +1 -1
  96. package/package.json +1 -1
  97. package/types/advertising/API.d.ts +9 -0
  98. package/types/advertising/ConfigAPI.d.ts +6 -5
  99. package/types/core/BufferSettings.d.ts +58 -0
  100. package/types/core/LogLevels.d.ts +54 -0
  101. package/types/core/Logger.d.ts +51 -0
  102. package/types/core/Settings.d.ts +856 -0
  103. package/types/core/network/ManifestMimeType.d.ts +5 -0
  104. package/types/core/util/MimeTypeHelper.d.ts +52 -0
  105. package/types/sgai/SgaiConfigAPI.d.ts +1 -1
  106. package/types/sgai/SgaiErrorCode.d.ts +6 -1
@@ -9,10 +9,10 @@
9
9
  * This software includes open-source components. See THIRD_PARTY_NOTICES
10
10
  * in the distribution for details.
11
11
  *
12
- * Bitmovin Player Version 8.280.0
12
+ * Bitmovin Player Version 8.281.0
13
13
  *
14
14
  ****************************************************************************/
15
15
 
16
16
  (function() {
17
- "use strict";!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.dash=t():(e.bitmovin=e.bitmovin||{},e.bitmovin.player=e.bitmovin.player||{},e.bitmovin.player.dash=t())}(self,function(){return(self.webpackChunkbitmovin_player=self.webpackChunkbitmovin_player||[]).push([[367],{96693:function(e,t,n){var i=this&&this.__assign||function(){return i=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},i.apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.isInitializationStringNode=function(e){return(0,r.isObject)(e)&&null!=e._initialization},t.isInitializationNode=function(e){return(0,r.isObject)(e)&&Array.isArray(e.Initialization)&&e.Initialization.length>0},t.isIndexRangeNode=function(e){return(0,r.isObject)(e)&&null!=e._indexRange},t.provideSegmentInfoFromInitializationProperty=function(e,t){var n=(0,a.default)(e._initialization,t),r=s.URLHelper.concatBaseUrlWithPartial(u(t),n);return i(i({},(0,o.createInitSegmentInfoBase)(t)),{url:r,mediaURL:n})},t.extractBaseUrlFromRepresentation=u,t.provideSegmentInfoFromInitializationNodeProperty=function(e,t){var n=e.Initialization[0],r=function(e,t){return e._sourceURL?e._sourceURL:u(t)}(n,t),a=s.URLHelper.concatBaseUrlWithPartial(u(t),r),l=function(e){var t,n,i=null!==(n=null===(t=e._range)||void 0===t?void 0:t.split("-").map(function(e){return parseInt(e)}))&&void 0!==n?n:[];return i.length>1?{start:i[0],end:i[1]}:null}(n);return i(i({},(0,o.createInitSegmentInfoBase)(t)),{url:a,mediaURL:r,byteRange:l})},t.provideSegmentInfoFromIndexRangeProperty=function(e,t){var n=u(t),r={start:0,end:parseInt(e._indexRange.split("-")[0])-1};return i(i({},(0,o.createInitSegmentInfoBase)(t)),{url:n,mediaURL:n,byteRange:r})};var r=n(94685),s=n(58313),o=n(65439),a=n(4771);function u(e){return e.BaseURL?s.URLHelper.urlObjectToString(e.BaseURL[0]):""}},44908:function(e,t,n){var i=this&&this.__assign||function(){return i=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},i.apply(this,arguments)},r=this&&this.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var i,r=0,s=t.length;r<s;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.MPDLoader=void 0;var s=n(40306),o=n(3336),a=n(80813),u=n(3714),l=n(4129),d=n(85625),h=n(77401),p=n(57456),c=n(29669),f=n(91678),g=n(33436),m=n(89927),v=n(58313),y=n(78340),S=function(){function e(e,t){var n=this;this.Qr=0,this.Yr=function(e){return e.body?n.Zr(e):(n.Or.load(null,null).catch(function(){}),null)},this.ar=function(e,t){n.Rr=function(e,t,n){if((null==t?void 0:t.name)===h.RequestError.Canceled)return null;if((null==t?void 0:t.name)===h.RequestError.TimedOut)return new o.PlayerError(s.ErrorCode.NETWORK_MANIFEST_DOWNLOAD_TIMEOUT,I(e),"Failed to load DASH manifest: the request timed out.",n);var i=(null==e?void 0:e.status)===XMLHttpRequest.UNSENT?"Failed to load the DASH manifest due to CORS restrictions or because the client is offline.":"Failed to load DASH manifest: ".concat(e.status," ").concat(e.statusText,".");return new o.PlayerError(s.ErrorCode.SOURCE_COULD_NOT_LOAD_MANIFEST,I(e),i,n)}(e,t,n.Jr.sourceIdentifier)},this.Ir=e,this.Jr=t,this.Pr=e.settings,this.Lr=new y.MPDParser(e,t),this.Kr=!1,this.Sr=e.eventHandler,this.Nr=[];var i={onFailure:this.ar,maxRetries:this.Pr.MAX_MPD_RETRIES,requestType:c.HttpRequestType.MANIFEST_DASH,resetRetriesWhenOffline:!1};this.Or=new l.DefaultContentLoader(e,i)}return e.prototype.Tr=function(e,t){if(this.Kr)return null;var n=e.trim();return this.Ur(n,t)},e.prototype.Ur=function(e,t){var n,i=this.Ir.serviceManager.get(a.ServiceName.ManifestCachingService),s=null!==(n=null==i?void 0:i.getParsedManifest(this.Mr))&&void 0!==n?n:this.Vr(e,t);return s?(R(s)||null==i||i.cacheParsedManifest(s,this.Mr),this.Nr=s.BaseURL?r(r([],s.Location,!0),s.BaseURL.map(function(e){return e.url}),!0):s.Location,this.Mr=this.Nr[0],s):null},e.prototype.Vr=function(e,t){return this.Lr.parse(e,this.Mr,t)},e.prototype.Wr=function(){this.Or&&this.Or.cancel(),this.Kr=!0,this.Mr=null},e.prototype.dispose=function(){this.Wr(),this.Or.dispose(),this.Lr&&(this.Lr.dispose(),this.Lr=null),this.Pr=null},e.prototype.load=function(e){var t=this;this.Mr=null!=e?e:this.Mr;var n=this.Mr;return this.Rr=null,e&&(this.Kr=!1),n?this.Xr(n).then(function(e){return t.Yr(e)}).then(function(e){return t.Mr!==n&&t.Nr.includes(t.Mr)&&(t.Ir.logger.debug("Switched manifest location to ".concat(t.Mr)),t.Ir.eventHandler.dispatchEvent(u.PlayerEvent.ContentLocationChanged,{sourceLocationId:n,targetLocationId:t.Mr,reason:u.ContentLocationChangedReason.Failover})),e}).catch(function(e){return t.Kr||(null==e?void 0:e.message)===h.RequestError.Canceled?Promise.reject():(t.Ir.logger.debug("Error during loading: "+t.Mr+": ",e),Promise.reject(e))}):(this.Ir.eventHandler.fireError(new o.PlayerError(s.ErrorCode.SOURCE_INVALID,void 0,"Cannot load the manifest: no URL was provided.",this.Jr.sourceIdentifier)),Promise.reject("No manifest url provided"))},e.prototype.Xr=function(e){var t,n=this,i=this.Ir.serviceManager.maybeCall(a.ServiceName.ManifestCachingService,function(t){return t.getHttpResponse(e)});if(i)return Promise.resolve(i);var r=null===(t=this.Jr.source.options)||void 0===t?void 0:t.manifestWithCredentials;return this.Or.load(e,c.HttpRequestMethod.GET,null,null,null,r,d.ManifestMimeType.Dash).catch(function(e){return n.Qr++,n.Qr<n.Nr.length?(n.Mr=v.URLHelper.replaceCdn(n.Mr,n.Nr[n.Qr]),n.Xr(n.Mr)):(n.Ir.logger.debug("no base url left, all tried"),n.Rr&&n.Sr.fireError(n.Rr),n.Rr=null,Promise.reject(e))})},e.prototype.updateRepresentation=function(e){return Promise.resolve(e)},e.prototype.stopRepresentationUpdate=function(e){return Promise.resolve()},e.prototype.Zr=function(e){var t,n,r,s,o=null!==(t=e.elapsedTime)&&void 0!==t?t:0;(0,p.isDownloadTimeInformationValid)(e)&&(this.Ir.logger.debug("Downloaded manifest in: ".concat(o.toFixed(2),", TTFB: ").concat(null===(n=e.timeToFirstByte)||void 0===n?void 0:n.toFixed(2))),this.Ir.store.dispatch((0,f.addMetricsValue)("default",g.MetricType.DownloadInformation,{bytes:e.length,time:o,timeToFirstByte:e.timeToFirstByte}))),this.Mr=e.url;var u=i({},this.Tr(e.body,(0,m.toSeconds)(Math.round(o))));return u._currentLoadingUrl=this.Mr,R(u)?!0===(null===(s=null===(r=this.Ir)||void 0===r?void 0:r.settings)||void 0===s?void 0:s.INFINITE_RETRIES_FOR_LIVE)&&this.Or.setResetRetriesWhenOffline(!0):this.Ir.serviceManager.maybeCall(a.ServiceName.ManifestCachingService,function(t){return t.cacheHttpResponse(e,e.url)}),u},e}();function I(e){return{url:e.url,statusCode:e.status,statusText:e.statusText}}function R(e){return"dynamic"===(null==e?void 0:e._type)}t.MPDLoader=S},78340:function(e,t,n){var i=this&&this.__assign||function(){return i=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},i.apply(this,arguments)},r=this&&this.__runInitializers||function(e,t,n){for(var i=arguments.length>2,r=0;r<t.length;r++)n=i?t[r].call(e,n):t[r].call(e);return i?n:void 0},s=this&&this.__esDecorate||function(e,t,n,i,r,s){function o(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var a,u=i.kind,l="getter"===u?"get":"setter"===u?"set":"value",d=!t&&e?i.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,i.name):{}),p=!1,c=n.length-1;c>=0;c--){var f={};for(var g in i)f[g]="access"===g?{}:i[g];for(var g in i.access)f.access[g]=i.access[g];f.addInitializer=function(e){if(p)throw new TypeError("Cannot add initializers after decoration has completed");s.push(o(e||null))};var m=(0,n[c])("accessor"===u?{get:h.get,set:h.set}:h[l],f);if("accessor"===u){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(a=o(m.get))&&(h.get=a),(a=o(m.set))&&(h.set=a),(a=o(m.init))&&r.unshift(a)}else(a=o(m))&&("field"===u?r.unshift(a):h[l]=a)}d&&Object.defineProperty(d,i.name,h),p=!0},o=this&&this.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var i,r=0,s=t.length;r<s;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.BaseURL=t.MPDParser=void 0,t.mergeCommonAttributes=P,t.parseFraction=x;var a=n(25926),u=n(4224),l=n(3714),d=n(20213),h=n(69957),p=n(44468),c=n(34047),f=n(52424),g=n(21216),m=n(68922),v=n(85434),y=n(58313),S=n(88052),I=n(62756),R=n(92778),T=new RegExp("_(.*:)?label","i"),_=["__text","_byteRange","_serviceLocation","_availabilityTimeOffset","_availabilityTimeComplete"],b=function(){var e,t,n=[];return e=function(){function t(e,t){this.eS=r(this,n),this.eS=e,this.fS=t,this.gS=e.renderer;var i=S.ModuleManager.get(I.ModuleName.XML);this.hS=i.parseXML,this.iS=i.parseJSONtoXML}return t.prototype.jS=function(e,t){return(0,m.applyLabeling)({source:this.fS.source,context:this.eS,streamType:p.StreamType.Dash,labelingType:e},t)},t.prototype.kS=function(e){var t,n,i,r=null!==(i=null===(n=null===(t=e.Label)||void 0===t?void 0:t[0])||void 0===n?void 0:n.value)&&void 0!==i?i:e._label,s={mimeType:e._mimeType,lang:e._lang};return this.jS(m.LabelingType.Tracks,s)||r},t.prototype.lS=function(e,t){var n,i,r,s=null!==(r=null===(i=null===(n=t.Label)||void 0===n?void 0:n[0])||void 0===i?void 0:i.value)&&void 0!==r?r:t._label,o={id:t._id,mimeType:e,bitrate:t._bandwidth,qualityRanking:t._qualityRanking,width:t._width,height:t._height,frameRate:t._framerate};return this.jS(m.LabelingType.Qualities,o)||s},t.prototype.mS=function(e){var t,n=this,i=0;for(var r in e)if(e.hasOwnProperty(r)){if("Accessibility"===r&&this.nS(e,e[r]),"EssentialProperty"===r&&E(e[r]))return this.eS.logger.debug("Ignoring trickplay track ".concat(e._id," from Period ").concat(e._periodId)),null;"Label"===r&&(e.Label=N(e[r])),"SegmentTemplate"===r&&this.oS(e[r]),"SegmentList"===r&&this.pS(e[r]),"SegmentTemplate"===r||0===r.indexOf("_")||Array.isArray(e[r])||(e[r]=[e[r]]),"Representation"===r&&(e[r]=e[r].filter(function(t){var r,s,o=t._mimeType||e._mimeType;if(t._mimeType=t._mimeType||e._mimeType,o&&(o=o.toLowerCase()),"AudioChannelConfiguration"in e){var a=e.AudioChannelConfiguration;null!==(r=(s=t).AudioChannelConfiguration)&&void 0!==r||(s.AudioChannelConfiguration=a)}P(t,e),O(t),M(t,e),"string"==typeof t._bandwidth&&(t._bandwidth=parseFloat(t._bandwidth)),t.Label&&(t.Label=N(t.Label)),t.SegmentTemplate&&n.oS(t.SegmentTemplate),t.SegmentList&&n.pS(t.SegmentList);var u=t._codecs||e._codecs;if(o&&(0===o.indexOf("application")||0===o.indexOf("text")||0===o.indexOf("image")||o.indexOf("mp2t")>=0))i++,t._label=n.lS(o,t);else if(o&&u){if(t._codecs=u,!c.CodecStringHelper.isSupportedByRenderer(n.gS,o,u))return n.eS.logger.debug("Representation not supported ("+o+'; codecs="'+u+'")'),!1;i++,t._label=n.lS(o,t)}return!0}))}if(i>0){if(!e._mimeType){var s=null===(t=e.Representation.find(function(e){return e._mimeType}))||void 0===t?void 0:t._mimeType;s&&(e._mimeType=s)}return e._label=this.kS(e),e.Representation.sort(function(e,t){return e._bandwidth-t._bandwidth}),e}return this.eS.logger.debug("AdaptationSet ".concat(e._id," from Period ").concat(e._periodId," has no supported representations")),null},t.prototype.nS=function(t,n){t.ClosedCaptionLabels={};for(var i=e.filterAccessibilityTagsByScheme(n,"urn:scte:dash:cc:cea-608:2015"),r=e.extractLabelGroups(i),s=0;s<r.length;s++){var o=r[s],a=o.split("="),u=2===a.length?[a[0],a[1]]:["CC"+s,o],l=u[0],d=u[1];t.ClosedCaptionLabels[l]={label:d,lang:d}}},t.prototype.oS=function(e){for(var t,n,i=0,r=e;i<r.length;i++){var s=r[i];if(s.hasOwnProperty("SegmentTimeline"))for(var o=Number(null!==(t=s._timescale)&&void 0!==t?t:"1"),a=0,u=null!==(n=s.SegmentTimeline)&&void 0!==n?n:[];a<u.length;a++){var l=u[a];l.totalDuration=L(l,o)}}},t.prototype.pS=function(e){for(var t,n,i,r,s,o,a=0,u=e;a<u.length;a++){var l=u[a];if(l.hasOwnProperty("SegmentTimeline")){for(var d=Number(null!==(t=l._timescale)&&void 0!==t?t:"1"),h=0,p=null!==(n=l.SegmentTimeline)&&void 0!==n?n:[];h<p.length;h++){var c=p[h];c.totalDuration=L(c,d)}l.totalDuration=null!==(s=null===(r=null===(i=l.SegmentTimeline)||void 0===i?void 0:i[0])||void 0===r?void 0:r.totalDuration)&&void 0!==s?s:0}else if(l.hasOwnProperty("_duration")&&l.hasOwnProperty("SegmentURL")){d=Number(null!==(o=l._timescale)&&void 0!==o?o:"1");var f=Number(l._duration)/d;l.totalDuration=f*l.SegmentURL.length}}},t.filterAccessibilityTagsByScheme=function(e,t){return e&&e.length>0?e.filter(function(e){return e._schemeIdUri===t}):[]},t.extractLabelGroups=function(e){for(var t=[],n=0,i=e;n<i.length;n++){var r=i[n];if(r._value){var s=r._value.split(";");t.push.apply(t,s)}}return t},t.prototype.qS=function(e,t){for(var n=0;n<e.length;n++)if("string"==typeof t&&e[n].url===t||"object"==typeof t&&e[n].url===t.url)return!0;return!1},t.prototype.rS=function(e,t,n,i){var r;Array.isArray(e.BaseURL)||(e.BaseURL=[e.BaseURL]);for(var s=[],o=0;o<e.BaseURL.length;o++){if((r=new D).customAttributes=[],null!=t&&(r.parentIds={},void 0!==t[0]&&null!==t[0]&&(r.parentIds.PeriodID=t[0]),void 0!==t[1]&&null!==t[1]&&(r.parentIds.AdaptationSetID=t[1]),void 0!==t[2]&&null!==t[2]&&(r.parentIds.RepresentationID=t[2])),"string"==typeof e.BaseURL[o])r.url=e.BaseURL[o];else if("object"==typeof e.BaseURL[o])for(var a in e.BaseURL[o].hasOwnProperty("__text")&&(r.url=e.BaseURL[o].__text),e.BaseURL[o].hasOwnProperty("_serviceLocation")&&(r.serviceLocation=e.BaseURL[o]._serviceLocation),e.BaseURL[o].hasOwnProperty("_byteRange")&&(r.serviceLocation=e.BaseURL[o]._byteRange),e.BaseURL[o].hasOwnProperty("_availabilityTimeOffset")&&(r.serviceLocation=e.BaseURL[o]._availabilityTimeOffset),e.BaseURL[o].hasOwnProperty("_availabilityTimeComplete")&&(r.serviceLocation=e.BaseURL[o]._availabilityTimeComplete),e.BaseURL[o])if(e.BaseURL[o].hasOwnProperty(a)&&0===a.indexOf("_")&&-1===_.indexOf(a)){var u={};u[a.substring(1)]=e.BaseURL[o][a],r.customAttributes.push(u)}s.push(r)}for(e.BaseURL=[],o=0;o<s.length;o++){var l=s[o];if(y.URLHelper.isUrlAbsolute(l))this.qS(e.BaseURL,l)||(l.isAbsolute=!0,i.push(l),e.BaseURL.push(l));else for(var d=0;d<n.length;d++){var h=n[d].toString();"/"!==n[d].url[n[d].url.length-1]&&(h+="/");var p=y.URLHelper.concatUrlParts(h,l);this.qS(e.BaseURL,p)||((r=new D).url=p,r.parentIds={},void 0!==t[0]&&null!==t[0]&&(r.parentIds.PeriodID=t[0]),void 0!==t[1]&&null!==t[1]&&(r.parentIds.AdaptationSetID=t[1]),void 0!==t[2]&&null!==t[2]&&(r.parentIds.RepresentationID=t[2]),r.serviceLocation=l.serviceLocation||n[d].serviceLocation,r.byteRange=l.byteRange||n[d].byteRange,r.availabilityTimeOffset=l.availabilityTimeOffset||n[d].availabilityTimeOffset,r.availabilityTimeComplete=l.availabilityTimeComplete||n[d].availabilityTimeComplete,e.BaseURL.push(r),i.push(r))}}return i},t.prototype.sS=function(e,t,n){var i=[];if(t=t||[],n=n||[],"object"!=typeof e)return e;for(var r in e.hasOwnProperty("BaseURL")&&(i=this.rS(e,n,t,i)),i.length<1&&(i=t),e)if(e.hasOwnProperty(r))if("object"==typeof e[r]&&0!==r.indexOf("_")){Array.isArray(e[r])||(e[r]=[e[r]]);for(var s=0;s<e[r].length;s++)if("BaseURL"!==r){var o=e[r][s]._id||s+"";e[r][s]=this.sS(e[r][s],i,n.concat([o])),"Representation"!==r||e[r][s].hasOwnProperty("BaseURL")||(e[r][s].BaseURL=i)}}else 0!==r.indexOf("_")||!T.test(r)&&"_streamName"!==r||(e._label=e[r],"_label"!==r&&delete e[r]);return e},t.prototype.tS=function(e){var t=f.DurationConverter.getDurationInSec(e._timeShiftBufferDepth);return(t=isNaN(t)?Number.NEGATIVE_INFINITY:-t)>0&&t<this.eS.bufferSettings.getForwardTargetLevel()&&(t=this.eS.bufferSettings.getForwardTargetLevel()),t},t.ensureObjectArray=function(e){return null==e?[]:(Array.isArray(e)?e:[e]).filter(function(e){return"object"==typeof e&&null!==e})},t.fillInMissingIds=function(t){t.Period=e.ensureObjectArray(t.Period);for(var n=[],i=[],r=0,s=t.Period;r<s.length;r++){(d=s[r]).AdaptationSet=e.ensureObjectArray(d.AdaptationSet);for(var o=0,a=d.AdaptationSet;o<a.length;o++)(c=a[o]).Representation=e.ensureObjectArray(c.Representation),n.push(c),i.push.apply(i,c.Representation)}e.assignMissingIds(t.Period),e.assignMissingIds(n),e.assignMissingIds(i);for(var u=0,l=t.Period;u<l.length;u++)for(var d,h=0,p=(d=l[u]).AdaptationSet;h<p.length;h++){var c;(c=p[h])._periodId=d._id}},t.assignMissingIds=function(e){for(var t=e.map(function(e){return e._id}).filter(function(e){return Boolean(e)}),n=0,i=0,r=e;i<r.length;i++){var s=r[i];if(!s._id){do{n++}while(t.includes(""+n));s._id=""+n,t.push(s._id)}}},t.prototype.uS=function(e){return"dynamic"===e._type&&(e._timeShiftBufferDepth=this.tS(e)),e},t.prototype.vS=function(e){return e._publishTime&&(e._publishTime=new Date(e._publishTime).getTime()),e},t.prototype.wS=function(e,t){return e.hasOwnProperty("Location")?Array.isArray(e.Location)||(e.Location=[e.Location]):e.Location=[t],e},t.prototype.xS=function(e){e.hasOwnProperty("BaseURL")&&!Array.isArray(e.BaseURL)&&(e.BaseURL=[e.BaseURL]);for(var t=[],n=0;n<e.Location.length;n++){var i=e.Location[n],r=new D;r.url=y.URLHelper.removeLastPathPart(i),t.push(r)}return this.sS(e,t,null)},t.prototype.IT=function(e,t){t._start?t.start=f.DurationConverter.getDurationInSec(t._start):(t.start=e.start+e.duration,t._start="PT"+t.start+"S")},t.prototype.JT=function(e){for(var t={start:0,duration:0,_start:"PT0S",_duration:"PT0S"},n=0;n<e.Period.length;n++){var i=e.Period[n];this.IT(t,i),i._duration?i.duration=f.DurationConverter.getDurationInSec(i._duration):(e.Period[n+1]?i.duration=(f.DurationConverter.getDurationInSec(e.Period[n+1]._start)||0)-i.start:e._mediaPresentationDuration?i.duration=(f.DurationConverter.getDurationInSec(e._mediaPresentationDuration)||0)-i.start:i.duration=1/0,i._duration="PT"+i.duration+"S"),this.eS.logger.debug("period ".concat(n," (id=").concat(i._id,"): ").concat(i.start,"-").concat(i.start+i.duration)),e.Period[n]=i,t=i}return e},t.prototype.KT=function(e){for(var t,n,i=this,r=[],s=[],o=f.DurationConverter.getDurationInSec(e._mediaPresentationDuration),d=function(d){var p=e.Period[d];for(var c in t=f.DurationConverter.getDurationInSec(p._start),n=f.DurationConverter.getDurationInSec(p._duration),isNaN(t)&&0===s.length&&"static"===e._type&&(t=0),isNaN(t)&&s.length>0&&!isNaN(parseFloat(s[s.length-1].start))&&!isNaN(parseFloat(s[s.length-1].duration))&&(t=s[s.length-1].start+s[s.length-1].duration),isNaN(t)&&d===e.Period.length-1&&!isNaN(o)&&(n=o-t),s.length>0&&isNaN(parseFloat(s[s.length-1].duration))&&!isNaN(t)&&(s[s.length-1].duration=t-s[s.length-1].start),s.push({start:t,duration:n}),p)if(p.hasOwnProperty(c)&&["BaseURL","AdaptationSet","EventStream"].includes(c))if(Array.isArray(p[c])||(p[c]=[p[c]]),"AdaptationSet"===c){var g=p[c].map(function(e){var t,n=e._mimeType||(null===(t=e.Representation.find(function(e){return e._mimeType}))||void 0===t?void 0:t._mimeType);return n?v.MimeTypeHelper.extractContentType(n):""}).filter(function(e,t,n){return e&&n.indexOf(e)===t});p[c]=p[c].map(function(e){P(e,p);var t=i.mS(e);return null!==t&&!t.hasOwnProperty("ContentProtection")&&t.Representation[0].hasOwnProperty("ContentProtection")&&(t.ContentProtection=t.Representation[0].ContentProtection),t}).filter(function(e){return Boolean(e)});for(var m=function(e){!p[c].some(function(t){return t._mimeType.includes(e)})&&h.eS.eventHandler.dispatchEvent(l.PlayerEvent.Warning,new a.PlayerWarning(u.WarningCode.SOURCE_CODEC_OR_FILE_FORMAT_NOT_SUPPORTED))},y=0,S=g.filter(function(e){return"audio"===e||"video"===e});y<S.length;y++)m(S[y]);p[c].length<1&&r.push(d)}else if("EventStream"===c)for(var I=0,R=p[c].filter(function(e){return e.Event});I<R.length;I++)for(var T=0,_=R[I].Event;T<_.length;T++){var b=_[T];b.rawXmlRepresentation=h.iS({event:b})}},h=this,p=0;p<e.Period.length;p++)d(p);return r.length>0&&"static"===e._type&&this.LT(r,s,o,e),e=this.JT(e)},t.prototype.LT=function(e,t,n,i){for(var r,s,o;!isNaN(parseInt(r=e.pop()));){if(s=t[r].start,o=t[r].duration,!isNaN(s)&&!isNaN(o)){isNaN(n)||(n-=o,i._mediaPresentationDuration="PT"+n+"S");for(var a=r+1;a<t.length;a++)isNaN(parseFloat(t[a].start))||(t[a].start=t[a].start-o,i.Period[a]._start="PT"+t[a].start+"S")}t.splice(r,1),i.Period.splice(r,1)}},t.parseUTCTimingInformation=function(e,t){var n,i,r,s;e.hasOwnProperty("UTCTiming")&&!Array.isArray(e.UTCTiming)&&(e.UTCTiming=[e.UTCTiming]);for(var o=[],a=function(a){var u={schemeIdUri:a._schemeIdUri,value:""};if("string"==typeof a._value)if(u.schemeIdUri.startsWith("urn:mpeg:dash:utc:http")){var l=null!==(r=null===(i=null===(n=e.BaseURL)||void 0===n?void 0:n[0])||void 0===i?void 0:i.url)&&void 0!==r?r:y.URLHelper.removeLastPathPart(t);u.value=(null!==(s=a._value.match(/\S+/g))&&void 0!==s?s:[a._value]).map(function(e){return y.URLHelper.concatBaseUrlWithPartial(l,e)}).join(" ")}else u.value=a._value;o.push(u)},u=0,l=(e.UTCTiming||[]).filter(function(e){return e.hasOwnProperty("_schemeIdUri")&&"string"==typeof e._schemeIdUri});u<l.length;u++)a(l[u]);return o.length>0?e.UTCTiming=o:delete e.UTCTiming,e},t.prototype.parse=function(t,n,i){var r,s=this.hS(t,{decodeEntities:!0});if(!1===s.success)throw new d.PlayerError(d.ErrorCode.SOURCE_MANIFEST_INVALID,{errorMessage:s.error.message},"DASH manifest is not a valid XML",this.fS.sourceIdentifier);var o=s.parsed.MPD;return o._requestTimestamp=Date.now(),o._downloadTime=i,o._type=null!==(r=o._type)&&void 0!==r?r:"static",e.fillInMissingIds(o),function(e){return e.Period.some(function(e){return e.AdaptationSet.some(function(e){return e.Representation.some(function(t){var n;return Boolean(null!==(n=t._mimeType)&&void 0!==n?n:e._mimeType)})})})}(o)?(o=this.uS(o),o=this.vS(o),o=this.wS(o,n),o=this.xS(o),o=this.KT(o),(o=e.parseUTCTimingInformation(o,n)).originalDashManifest=t,o):(this.eS.eventHandler.fireError(new d.PlayerError(d.ErrorCode.SOURCE_MANIFEST_INVALID,void 0,"DASH manifest contains no representations",this.fS.sourceIdentifier)),null)},t.prototype.dispose=function(){this.gS=null},t}(),function(){var i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;t=[(0,h.trackPerformance)("MPDParser.parse")],s(e,null,t,{kind:"method",name:"parse",static:!1,private:!1,access:{has:function(e){return"parse"in e},get:function(e){return e.parse}},metadata:i},null,n),i&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i})}(),e}();function P(e,t){if(e&&t)for(var n=["SegmentBase","SegmentList","SegmentTemplate"],r=0,s=n;r<s.length;r++){var o=s[r],a=Array.isArray(e[o])&&e[o][0],u=Array.isArray(t[o])&&t[o][0],l=n.find(function(t){return e[t]});u&&a?e[o]=[i(i({},t[o][0]),e[o][0])]:u&&!l&&(e[o]=t[o])}}function x(e){var t=e.split("/");return parseInt(t[0])/(parseInt(t[1])||1)}function L(e,t){return e.S.reduce(function(e,t){var n;return e+Number(t._d)*(Number(null!==(n=t._r)&&void 0!==n?n:"0")+1)},0)/t}function O(e){"string"==typeof e._audioSamplingRate&&(e._audioSamplingRate=parseFloat(e._audioSamplingRate))}function M(e,t){"string"==typeof e._height&&(e._height=parseFloat(e._height)),"string"==typeof e._width&&(e._width=parseFloat(e._width)),"string"==typeof e._frameRate&&(e._frameRate=x(e._frameRate)),e._dynamicRange=function(e,t){var n,i,r,s,a=o(o(o(o([],null!==(n=e.EssentialProperty)&&void 0!==n?n:[],!0),null!==(i=e.SupplementalProperty)&&void 0!==i?i:[],!0),null!==(r=t.EssentialProperty)&&void 0!==r?r:[],!0),null!==(s=t.SupplementalProperty)&&void 0!==s?s:[],!0).filter(function(e){return e._schemeIdUri===R.DashSchemeUri.TransferCharacteristics}).map(function(e){var t=e._value;return(0,g.getDynamicRangeFromTransferCharacteristics)(parseInt(null!=t?t:"",10))}).find(function(e){return e!==p.VideoDynamicRange.Unknown});if(void 0!==a)return a;var u=c.CodecStringHelper.getExtractedCodecStrings(e._codecs||t._codecs);return(0,g.getDynamicRangeFromVideoCodec)(u.video)}(e,t)}function N(e){return"string"==typeof e?[{value:e}]:Array.isArray(e)?e.map(function(e){return{id:e._id,lang:e._lang,value:e.toString()}}):[]}function E(e){var t;return"http://dashif.org/guidelines/trickmode"===(null===(t=null==e?void 0:e[0])||void 0===t?void 0:t._schemeIdUri)}t.MPDParser=b;var D=function(){function e(){this.url=null,this.parentIds=null,this.serviceLocation=null,this.byteRange=null,this.availabilityTimeOffset=null,this.availabilityTimeComplete=null,this.isAbsolute=!1,this.customAttributes=null}return e.prototype.toString=function(){return this.url?""+this.url:""},e}();t.BaseURL=D},66759:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.DASHModuleDefinition=void 0;var i=n(62756),r=n(96693),s=n(44908),o=n(4771),a=n(63889),u=n(12054),l=n(31439),d={isIndexRangeNode:r.isIndexRangeNode,isInitializationNode:r.isInitializationNode,isInitializationStringNode:r.isInitializationStringNode},h={provideSegmentInfoFromInitializationProperty:r.provideSegmentInfoFromInitializationProperty,provideSegmentInfoFromInitializationNodeProperty:r.provideSegmentInfoFromInitializationNodeProperty,provideSegmentInfoFromIndexRangeProperty:r.provideSegmentInfoFromIndexRangeProperty};t.DASHModuleDefinition={name:i.ModuleName.DASH,module:function(){return{MPDLoader:s.MPDLoader,SegmentBaseMPDHandler:a.SegmentBaseMPDHandler,SegmentTemplateMPDHandler:u.SegmentTemplateMPDHandler,SegmentTimelineMPDHandler:l.SegmentTimelineMPDHandler,replaceAllPlaceholders:o.default,initSegmentInfoSourceDetectors:d,initSegmentInfoProviders:h}},dependencies:[i.ModuleName.EngineBitmovin,i.ModuleName.XML]},t.default=t.DASHModuleDefinition},63889:function(e,t,n){var i=this&&this.__assign||function(){return i=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},i.apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.SegmentBaseMPDHandler=void 0;var r=n(40306),s=n(3336),o=n(80813),a=n(56481),u=n(4129),l=n(77401),d=n(29669),h=n(79721),p=n(84568),c=n(58313),f=n(88052),g=n(62756),m=n(13422),v=n(59707),y=n(96693),S=function(){function e(e,t){var n=this;this.context=e,this.dr=0,this.fr=-1,this.As=null,this.Bs=(0,p.memoize)(this.Ps.bind(this),function(e,t){return t._internalId.representationId}),this.Cs=function(e){var t=i({},n.mr.getRepresentationById(n.ir));return n.Bs(e,t).then(function(e){var i;if(n.ys.dispatch((0,v.setRepresentationSegmentIndexAction)(t._internalId,e)),n.ys.dispatch((0,v.setRepresentationIsLoadingAction)(t._internalId,!1)),e||(n.ys.dispatch((0,v.setRepresentationSegmentIndexParsingErrorAction)(t._internalId,!0)),n.context.logger.warn("Error parsing SegmentIndex for representation with id ".concat(null===(i=n.ir)||void 0===i?void 0:i.key()))),n.fr>=0){var r=n.fr;n.fr=-1,n.seekTo(r)}return n.lr=null,n.ir}).catch(function(e){throw n.Bs.invalidate(),e})},this.Ds=function(e){n.lr=null,n.context.logger.debug("Getting segment index failed for representation with id ".concat(n.ir.key()," (Error: ").concat(JSON.stringify(e),")"));var t=n.Es(e);return n.kr&&(n.kr.reject(t),n.kr=null),Promise.reject(t)},this.Is=function(e){return n.kr?Promise.reject("fail"):new Promise(function(t,r){n.kr=i(i({},e),{resolve:t,reject:r})})},this.br=e.settings;var r=t.sourceIdentifier;this.zs=r,this.mr=e.serviceManager.get(o.ServiceName.ManifestService,r);var s=this.mr.getFirstPeriod()||{_id:h.DEFAULT_PERIOD_ID};this.cr=s._id;var a=this.br.MAX_RETRIES;this.jr=new u.DefaultContentLoader(e,{maxRetries:a,retryDelay:this.br.RETRY_DELAY,requestType:d.HttpRequestType.MEDIA_SEGMENTINDEX,onSuccess:function(){n.As=null},onFailure:function(e,t){var i;n.As=null!==(i=null==t?void 0:t.name)&&void 0!==i?i:null}}),this.ys=e.serviceManager.get(o.ServiceName.SourceStoreService,r)}return e.prototype.Es=function(e){if(this.As===l.RequestError.Canceled)return l.RequestError.Canceled;var t=this.As===l.RequestError.TimedOut?r.ErrorCode.NETWORK_SEGMENT_DOWNLOAD_TIMEOUT:r.ErrorCode.NETWORK_ERROR,n=e;return new s.PlayerError(t,{url:null==n?void 0:n.url,statusCode:null==n?void 0:n.status},"Failed to load the segment index",this.zs)},e.prototype.Fs=function(e){var t,n,i=this.mr.getRepresentationById(e);if(i&&i.segmentIndex){var r=this.mr.getPeriodDuration(this.cr);isFinite(r)&&(n=r/i.segmentIndex.references.length);var s=this.mr.getMediaPresentationDuration();0!==s&&(isFinite(s)&&(t=s/i.segmentIndex.references.length),n||(n=t)),i.segmentIndex&&(t=i.segmentIndex.references[0].duration/i.segmentIndex.timescale,n||(n=t))}return n},e.prototype.Gs=function(){var e,t,n=this.mr.getRepresentationById(this.gr);if(null===(t=null===(e=null==n?void 0:n.segmentIndex)||void 0===e?void 0:e.references)||void 0===t?void 0:t.length){var i=n.segmentIndex.timescale||1,r=n.segmentIndex.references[this.dr].time/i,s=this.getTimestampOffset(),o={url:"",byteRange:n.segmentIndex.references[this.dr].byteRange,periodId:n._internalId.periodId,presentationTimeOffset:s,startTime:r-s};return this.dr++,this.er=Math.floor(this.dr*this.getSegmentDuration())+this.Ms(),o}},e.prototype.getInitSegmentInfo=function(e){var t=this.mr.getRepresentationById(e);return t&&t.SegmentBase&&t.BaseURL?i(i({},this.Hs(t)),{codecs:(0,m.getCodecsFromAdaptationSet)(this.mr.getAdaptationSet(e))}):null},e.prototype.Hs=function(e){var t,n=e.SegmentBase[0];return(0,y.isInitializationNode)(n)?(0,y.provideSegmentInfoFromInitializationNodeProperty)(n,e):e.segmentIndex?(0,y.isIndexRangeNode)(n)?(0,y.provideSegmentInfoFromIndexRangeProperty)(n,e):null:(this.context.logger.debug("SegmentIndex for representation ".concat(null===(t=e._internalId)||void 0===t?void 0:t.key()," not parsed yet!")),null)},e.prototype.resolvePendingSegmentInfoRequests=function(){if(this.kr){var e=this.Gs();e&&(this.kr.resolve(e),this.kr=null)}},e.prototype.setAdaptationSetId=function(e){this.hr=e,this.nr=e.adaptationSetId.split("-")[0],this.Js(),this.resolvePendingSegmentInfoRequests()},e.prototype.Js=function(){var e,t=this,n=this.mr.getRepresentationById(this.gr);n&&(e=n._bandwidth);var i=this.mr.getMatchingRepresentationsByBandwidth(this.hr,e),r=this.gr?i.find(function(e){return e._internalId===t.gr}):null,s=null!=r?r:i[0];this.gr=s._internalId,this.cr=this.gr.periodId,s.hasOwnProperty("SegmentBase")&&s.SegmentBase.length>1&&this.context.logger.debug("Representation ".concat(s._id," has more than one SegmentBase! Taking the first one."))},e.prototype.setRepresentationId=function(e){return!!this.mr.getRepresentationById(e)&&(this.gr=e,this.seekTo(this.er),!0)},e.prototype.getSegmentInfos=function(){var e=this.getSeekableRange();return this.Ks(e)},e.prototype.Ks=function(e){var t=this,n={};return this.mr.getAdaptationSet(this.hr).Representation.forEach(function(i){var r=i._id;if(n[r]=[],1===i.BaseURL.length){var s=i.BaseURL[0].url;n[r].push({url:c.URLHelper.appendQueryParametersToUrl(s,t.br.QUERY_PARAMETERS)})}else for(var o=0;o<i.BaseURL.length;o++)s=c.URLHelper.appendQueryParametersToUrl(i.BaseURL[o].url,t.br.QUERY_PARAMETERS),n[r].push({url:s});n[r].forEach(function(t){t.duration=e.end-e.start,t.startTime=e.start})}),n},e.prototype.getNextSegmentInfo=function(e){var t=this.Gs();return t?Promise.resolve(t):this.Is({time:e})},e.prototype.getSubtitleUrl=function(){var e=this.mr.getAvailableBaseURLsForRepresentation(this.gr);return e?e[0]:null},e.prototype.getStartNumber=function(){},e.prototype.getLiveEdgeTime=function(){return-1},e.prototype.getActualTimeShiftBufferDepth=function(){return this.mr.getTimeShiftBufferDepthSeconds()},e.prototype.Ls=function(){var e,t=this;return this.mr.getRepresentationById(this.gr)&&(e=this.Fs(this.gr)),e<0&&(e=this.mr.getAdaptationSet(this.hr).Representation.map(function(e){return t.Fs(e._internalId)}).find(function(e){return e>0})),isFinite(e)?[e,!0]:[1,!1]},e.prototype.getSegmentDuration=function(){return this.Ls()[0]},e.prototype.hasNext=function(){this.resolvePendingSegmentInfoRequests();var e=this.mr.getRepresentationById(this.gr);if(e){if(e.segmentIndex)return this.dr<e.segmentIndex.references.length;if(!this.isSegmentInfoLoaded(this.gr))return!0}return!1},e.prototype.Ms=function(){var e,t,n;return null!==(n=null===(t=null===(e=this.mr)||void 0===e?void 0:e.findPeriod(this.cr))||void 0===t?void 0:t.start)&&void 0!==n?n:0},e.prototype.seekTo=function(e){var t,n;this.er=e;var i=this.Ls(),r=i[0],s=i[1];if((r<0||!s)&&(this.fr=e),r>0&&s&&e>-1){var o=Math.max(e-this.Ms(),0),a=null===(t=this.mr)||void 0===t?void 0:t.getRepresentationById(this.gr);this.gr&&a&&(this.setIndex(Math.floor(o/r)),this.context.logger.debug("seekTo: ".concat(e,", new index: ").concat(this.dr," (representationId: ").concat(null===(n=this.gr)||void 0===n?void 0:n.key(),", ").concat(a._mimeType,")")))}},e.prototype.getTimestampOffset=function(){var e=this.mr.findPeriod(this.cr),t=this.mr.getRepresentationById(this.gr),n=t&&t.SegmentBase?t.SegmentBase[0]:null,i=0;if(n&&n.hasOwnProperty("_presentationTimeOffset")&&n.hasOwnProperty("_timescale")){var r=n.hasOwnProperty("_timescale")?parseInt(n._timescale):1;i=parseInt(n._presentationTimeOffset)/r}return e&&(i-=e.start),i},e.prototype.getIndex=function(){return this.dr},e.prototype.setIndex=function(e){this.dr=e},e.prototype.timeShift=function(e){},e.prototype.updateRepresentation=function(e){var t=this;if(this.isSegmentInfoLoaded(e))return this.context.logger.debug("Skipping updateRepresentation, SIDX info already loaded"),Promise.resolve(e);if(this.lr)return this.lr;var n=this.mr.getRepresentationById(e);if(!n)return this.context.logger.log("Getting segment index failed (Invalid Representation Id: ".concat(null==e?void 0:e.key(),")")),Promise.reject(null);this.context.logger.debug("Going to load segment index (Representation Id: ".concat(null==e?void 0:e.key(),")"));var i=(0,y.extractBaseUrlFromRepresentation)(n),r=n.SegmentBase[0]._indexRange,s=parseInt(r.split("-")[1])+1;return this.ys.dispatch((0,v.setRepresentationAnchorPointAction)(n._internalId,s)),this.ir=e,this.lr=this.jr.load(i,d.HttpRequestMethod.GET,d.HttpResponseType.ARRAYBUFFER,void 0,{Range:"bytes="+r}).then(function(e){return t.Cs(e.body)}).catch(this.Ds),this.lr},e.prototype.isSegmentInfoLoaded=function(e){return this.mr.isSegmentInfoLoaded(e)},e.prototype.rewindOneSegment=function(){return this.dr--,!(this.dr<0&&(this.context.logger.debug("SegmentBase array index is smaller than 0, probably a discontinuity. Using 0."),this.setIndex(0),1))},e.prototype.getSeekableRange=function(){return{start:0,end:this.mr.getMediaPresentationDuration()}},e.prototype.getPendingSegmentInfoRequest=function(){return this.kr},e.prototype.setPendingSegmentInfoRequest=function(e){this.kr=e},e.prototype.canSwitchRepresentation=function(e){return!0},e.prototype.getLatestTimeForPossibleSwitch=function(e){return e},e.prototype.adjustTimeToNextSegmentStart=function(e){return e},e.prototype.dispose=function(){this.br=null,this.mr=null,this.gr=null,this.ys=null,this.jr=(0,a.dispose)(this.jr),this.kr=null,this.Bs=null},e.prototype.setTimestampOffset=function(e,t){},e.prototype.Ns=function(){return this.context.serviceManager.get(o.ServiceName.SegmentService).get(this.nr).getSegment(this.getInitSegmentInfo(this.ir)).then(function(e){return e.read()}).then(function(e){return e.value})},e.prototype.Os=function(e,t){return this.Ns().then(function(n){var i=f.ModuleManager.get(g.ModuleName.ContainerWebM).WebMSegmentIndex,r=f.ModuleManager.get(g.ModuleName.ContainerWebM).WebMInitFile,s=new i(e),o=new r(n.getData()).segment.segmentInfo,a=function(e,t,n){for(var i=e.cues.flatMap(function(e){return e.cuePoints}),r=new Array(i.length),s=t-function(e){var t=e.cues&&e.cues[0],n=t&&t.cuePoints&&t.cuePoints[0],i=n&&n.trackPositions&&n.trackPositions[0];return i&&i.clusterPosition||0}(e),o=i.length-1;o>=0;o--)r[o]={time:i[o].time,byteRange:{start:s+i[o].trackPositions[0].clusterPosition}},o===i.length-1?r[o].duration=n-r[o].time:(r[o].byteRange.end=r[o+1].byteRange.start-1,r[o].duration=r[o+1].time-r[o].time);return r}(s,parseInt(t.SegmentBase[0]._indexRange.split("-")[1])+1,o.getDuration()/o.getTimecodeScale());return{timescale:o.getTimecodeScale(),references:a}})},e.prototype.Ps=function(e,t){return"webm"===this.nr.split("/")[1]?this.Os(e,t):Promise.resolve(this.Qs(e,t.anchorPoint))},e.prototype.Qs=function(e,t){if(!e||!t)return this.context.logger.debug("Error parsing SegmentIndex: Wrong Parameters"),null;var n=f.ModuleManager.get(g.ModuleName.ContainerMP4).parseBuffer(e).boxes.find(function(e){return"sidx"===e.type});return n?{timescale:n.timescale,references:I(n.references,n.first_offset+t,n.earliest_presentation_time)}:(this.context.logger.debug("Error parsing SegmentIndex: No sidx box found"),null)},e}();function I(e,t,n){for(var i=[],r=0,s=e;r<s.length;r++){var o=s[r],a=o.referenced_size,u=o.subsegment_duration,l=t,d=l+a-1;i.push({byteRange:{start:l,end:d},time:n,duration:u}),t+=a,n+=u}return i}t.SegmentBaseMPDHandler=S},12054:function(e,t,n){var i=this&&this.__assign||function(){return i=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},i.apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.SegmentTemplateMPDHandler=void 0,t.getTimescaleFromTemplate=f;var r=n(80813),s=n(77179),o=n(89927),a=n(23068),u=n(58313),l=n(16197),d=n(54053),h=n(96693),p=n(4771),c=function(){function e(e,t){this.context=e,this.sourceContext=t,this.settings=e.settings,this.manifestService=e.serviceManager.get(r.ServiceName.ManifestService,t.sourceIdentifier),this.time=0}return e.prototype.getStartNumber=function(){var e=this.getTemplate(this.currentRepresentationId);return e&&e.hasOwnProperty("_startNumber")?parseInt(e._startNumber):1},e.prototype.Ss=function(){var e=this.getTemplate(this.currentRepresentationId);return e&&e._endNumber?parseInt(e._endNumber):NaN},e.prototype.setAdaptationSetId=function(e,t,n){void 0===t&&(t=null),void 0===n&&(n={isManifestUpdate:!1}),this.currentAdaptationSetId=e,this.currentRepresentationId=t;var i=!this.currentRepresentationId||Boolean(this.manifestService.getRepresentationById(this.currentRepresentationId)),r=this.manifestService.getAdaptationSet(this.currentAdaptationSetId);this.currentRepresentationId&&i||(this.currentRepresentationId=r.Representation[0]._internalId),this.getTemplate(this.currentRepresentationId)?this.Rs||this.setIndex(this.getStartNumber()):this.context.logger.debug("No template found in SegmentTemplateMPDHandler."),this.resolvePendingSegmentInfoRequests()},e.prototype.getCurrentPeriod=function(){return this.manifestService.getPeriod(this.currentRepresentationId||this.currentAdaptationSetId)},e.prototype.setRepresentationId=function(e){return!!this.manifestService.getRepresentationById(e)&&(this.currentRepresentationId=e,!0)},e.prototype.getInitSegmentInfo=function(e){var t=this.getTemplate(e),n=this.manifestService.getRepresentationById(e);return(0,h.isInitializationStringNode)(t)?(0,h.provideSegmentInfoFromInitializationProperty)(t,n):null},e.prototype.Ts=function(){var e=this.getTemplate(this.currentRepresentationId);return parseFloat(e._availabilityTimeOffset)||0},e.prototype.Us=function(e){var t=this.getExpectedPresentationTime(e);return t-=this.Ts(),(0,o.toMilliSeconds)(t+this.getSegmentDuration()+this.settings.LIVE_EDGE_DISTANCE)},e.prototype.getTemplate=function(e){var t=this.manifestService.getRepresentationById(e);if(null==t?void 0:t.SegmentTemplate)return t.SegmentTemplate[0]},e.prototype.Vs=function(){var e;return(null===(e=this.getCurrentPeriod())||void 0===e?void 0:e.start)||0},e.prototype.isExpectedSegmentPlaybackTimeExceedingPeriodDuration=function(e){var t=this.Ss();if(isFinite(t))return e>t;var n=this.getCurrentPeriod(),i=Boolean(null==n?void 0:n._duration)?n.start+n.duration:1/0;return this.getExpectedPresentationTime(e)>=i},e.prototype.checkIfSegmentAvailable=function(e){return this.Us(e)<=Date.now()},e.prototype.getNextSegmentInfo_=function(){var e={isInitSegment:!1,presentationTimeOffset:this.getTimestampOffset()},t=this.getTemplate(this.currentRepresentationId);if(!t||!t._media||!this.manifestService.representationExists(this.currentRepresentationId))return null;if(this.manifestService.isLive()){var n=this.checkIfSegmentAvailable(this.Rs),i=this.isExpectedSegmentPlaybackTimeExceedingPeriodDuration(this.Rs);if(!n||i)return null;e.wallClockTime=this.Us(this.Rs)-(0,o.toMilliSeconds)(this.getSegmentDuration())}var r=this.manifestService.getRepresentationById(this.currentRepresentationId);return e.periodId=null==r?void 0:r._internalId.periodId,e.url=(0,p.default)(t._media,r,this.Rs,this.time),e.segmentNumber=this.Rs,e.startTime=this.getExpectedPresentationTime(this.Rs),this.setIndex(this.Rs+1),e},e.prototype.getNextSegmentInfo=function(e){var t=this.getNextSegmentInfo_();return t?Promise.resolve(t):this.queueSegmentInfoRequest({time:e})},e.prototype.queueSegmentInfoRequest=function(e){var t=this;return this.pendingSegmentInfoRequest?Promise.reject("fail"):new Promise(function(n,r){t.pendingSegmentInfoRequest=i(i({},e),{resolve:n,reject:r})})},e.prototype.resolvePendingSegmentInfoRequests=function(){if(this.pendingSegmentInfoRequest){var e=this.getNextSegmentInfo_(),t=this.isExpectedSegmentPlaybackTimeExceedingPeriodDuration(this.Rs);e?(this.pendingSegmentInfoRequest.resolve(e),this.pendingSegmentInfoRequest=null):t&&(this.pendingSegmentInfoRequest.reject(d.SegmentInfoError.SEGMENT_EXCEEDING_PERIOD_DURATION),this.pendingSegmentInfoRequest=null)}},e.prototype.getSegmentInfos=function(e){var t=this,n={};return this.manifestService.getAdaptationSet(this.currentRepresentationId).Representation.forEach(function(i){var r,s,o,a=i._internalId,l=t.getTemplate(a),d=[],h=t.getSeekableRange().end-t.getSeekableRange().start,c=0,f=t.manifestService.isLive();f?(o=t.time-h,r=t.Rs-h/t.getSegmentDuration(),s=t.Rs):(o=l._presentationTimeOffset||0,r=0,s=parseInt(r+h/t.getSegmentDuration()));for(var g=r;g<=s;g++){var m={};m.duration=t.getSegmentDuration(),m.startTime=f?t.getExpectedPresentationTime(g):c*t.getSegmentDuration();var v=(0,p.default)(l._media,i,r+c,o+c*t.getSegmentDuration());m.url=e?u.URLHelper.concatBaseUrlWithPartial(e,v):v,m.url=u.URLHelper.appendQueryParametersToUrl(m.url,t.settings.QUERY_PARAMETERS),d.push(m),c++}n[a.representationId]=d}),n},e.prototype.getSubtitleUrl=function(){var e=this.manifestService.getRepresentationById(this.currentRepresentationId).BaseURL[0];return e.url||e},e.prototype.Ws=function(){var e=this.getTemplate(this.currentRepresentationId);return e&&e.hasOwnProperty("_liveEdgeNumber")},e.prototype.Xs=function(){if(this.Ws()){var e=this.getTemplate(this.currentRepresentationId);return parseInt(e._liveEdgeNumber)}},e.prototype.getSegmentDuration=function(){var e=this.getTemplate(this.currentRepresentationId),t=Number(null==e?void 0:e._duration),n=Number(null==e?void 0:e._timescale);return isNaN(t)?1:isNaN(n)?t:t/n},e.prototype.seekTo=function(e){e>-1&&this.setIndex(this.Ys(e))},e.prototype.getTimescale=function(){return f(this.getTemplate(this.currentRepresentationId))},e.prototype.getExpectedPresentationTime=function(e){var t=this.Vs();return(e-this.getStartNumber())*this.getSegmentDuration()+t},e.prototype.Ys=function(e){var t=this.getSegmentDuration(),n=this.Vs(),i=Math.max(e-n-t/2,0);return Math.floor(i/t)+this.getStartNumber()},e.prototype.getActualTimeShiftBufferDepth=function(){var e=this.Zs();return e.end-e.start},e.prototype.Zs=function(){var e=(0,s.getStartTimeOffset)(this.bs().getState()),t=this.manifestService.getMediaPresentationDuration()||1/0;return this.manifestService.isLive()?this.ds(t):this.cs(e,t)},e.prototype.bs=function(){return this.context.serviceManager.get(r.ServiceName.SourceStoreService,this.sourceContext.sourceIdentifier)},e.prototype.cs=function(e,t){return{start:e,end:isFinite(t)?e+t:0}},e.prototype.ds=function(e){var t=(this.manifestService.getFirstPeriod()||{start:0}).start,n=-1*this.manifestService.getTimeShiftBufferDepthSeconds(),i=(0,o.toSeconds)(Date.now()-this.manifestService.getAvailabilityStartTime()),r=Math.min(n,i),s=this.getLiveEdgeTime();return{start:Math.max(t,s-r),end:s}},e.prototype.getSeekableRange=function(){var e=this.Zs();if(this.manifestService.isLive()){var t=this.manifestService.getDesiredDistanceToLiveEdge();e.end=Math.max(e.end-t,e.start)}return e},e.prototype.hasNext=function(e){var t=this.isExpectedSegmentPlaybackTimeExceedingPeriodDuration(this.Rs),n=Math.ceil(e/this.getSegmentDuration())+this.getStartNumber()-1;return!t&&this.Rs<=n},e.prototype.getTimestampOffset=function(){var e=this.getCurrentPeriod(),t=0,n=this.getTemplate(this.currentRepresentationId);return n&&n._presentationTimeOffset&&(t=n._presentationTimeOffset/this.getTimescale()),e&&(t-=e.start),t},e.prototype.es=function(e,t){var n=this.manifestService.getPeriod(e)||this.getCurrentPeriod();return this.manifestService.isLastPeriod(e.periodId)?n&&(0,a.isNumber)(n.duration)&&isFinite(n.duration)?n.duration:n&&n.start?(0,o.toSeconds)(t)-n.start:this.manifestService.calculateCumulativePeriodDuration(e.periodId):this.manifestService.getPeriodDuration(e.periodId)},e.prototype.fs=function(e){var t=Date.now(),n=(0,o.toSeconds)(t-this.manifestService.getRequestTimestamp());return this.Ws()?this.Xs()+Math.floor(n/this.getSegmentDuration()):this.manifestService.isLive()&&Boolean(this.manifestService.getManifest()._availabilityStartTime)?Math.floor(this.es(e,t)/this.getSegmentDuration()+this.getStartNumber()):this.getStartNumber()},e.prototype.gs=function(e){return Math.max(this.fs(e),this.getStartNumber())},e.prototype.getIndex=function(){return this.Rs},e.prototype.setIndex=function(e){this.Rs=e},e.prototype.getLiveEdgeTime=function(){return(0,o.toSeconds)(Date.now())},e.prototype.timeShift=function(e,t){if(void 0===t&&(t=this.currentRepresentationId.periodId),this.manifestService.isLive()){var n=this.Rs,i=this.gs(new l.PeriodId(t));0===e?(this.setIndex(i),this.context.logger.debug("timeShift changes index from "+n+" to "+this.Rs+" [back to live edge]")):(this.setIndex(i+Math.floor(e/this.getSegmentDuration())),this.Rs<this.getStartNumber()&&this.setIndex(this.getStartNumber()),this.context.logger.debug("timeShift changes index from "+n+" to "+this.Rs))}},e.prototype.updateRepresentation=function(e){return this.currentRepresentationId=e,Promise.resolve(e)},e.prototype.isSegmentInfoLoaded=function(e){return!0},e.prototype.rewindOneSegment=function(){return this.setIndex(this.Rs-1),this.Rs<this.getStartNumber()&&(this.context.logger.debug("Template number is smaller than start number, probably a discontinuity. Using start number."),this.setIndex(this.getStartNumber())),!0},e.prototype.getPendingSegmentInfoRequest=function(){return this.pendingSegmentInfoRequest},e.prototype.setPendingSegmentInfoRequest=function(e){this.pendingSegmentInfoRequest=e},e.prototype.canSwitchRepresentation=function(e){return!0},e.prototype.getLatestTimeForPossibleSwitch=function(e){return e},e.prototype.adjustTimeToNextSegmentStart=function(e){return e},e.prototype.dispose=function(){this.settings=null,this.manifestService=null,this.currentRepresentationId=null,this.currentAdaptationSetId=null,this.pendingSegmentInfoRequest=null},e.prototype.setTimestampOffset=function(e,t){},e}();function f(e){return e&&null!=e._timescale&&parseInt(e._timescale)||1}t.SegmentTemplateMPDHandler=c},31439:function(e,t,n){var i=this&&this.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),r=this&&this.__assign||function(){return r=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},r.apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.SegmentTimelineMPDHandler=void 0;var s=n(74853),o=n(89927),a=n(58313),u=n(54053),l=n(4771),d=n(12054),h=n(39761),p=function(e){function t(t,n){var i=e.call(this,t,n)||this;return i.hs=0,i.is=null,i.js=[],i.ks=!0,i.os=!1,i.ls=1,i.ms=0,i.ns=0,i}return i(t,e),t.prototype.setAdaptationSetId=function(t,n,i){void 0===n&&(n=null),void 0===i&&(i={isPeriodSwitch:!1,isManifestUpdate:!1}),this.currentAdaptationSetId=t,this.currentRepresentationId=n;var r=!this.currentRepresentationId||Boolean(this.manifestService.getRepresentationById(this.currentRepresentationId)),s=this.manifestService.getAdaptationSet(this.currentAdaptationSetId);this.currentRepresentationId&&r||(this.currentRepresentationId=s.Representation[0]._internalId);var o=this.getTemplate(this.currentRepresentationId);o?(this.setTimeline(o,i.isPeriodSwitch),this.getIndex()||e.prototype.setIndex.call(this,this.getStartNumber())):this.context.logger.debug("No template found in SegmentTemplateMPDHandler."),this.resolvePendingSegmentInfoRequests()},t.prototype.setRepresentationId=function(e){if(this.manifestService.getRepresentationById(e)){this.currentRepresentationId=e;var t=this.getTemplate(this.currentRepresentationId);return t&&this.setTimeline(t),!0}return!1},t.prototype.ps=function(e){return null!=(null==e?void 0:e.start)&&isFinite(e.start)?e.start:0},t.prototype.qs=function(){this.manifestService.isLive()&&this.ks&&(this.os||this.timeShift(0),this.ks=!1)},t.prototype.rs=function(e){return!(null==e?void 0:e._media)||!this.manifestService.representationExists(this.currentRepresentationId)},t.prototype.ss=function(e){var t=this.js[this.hs];t&&(e.wallClockTime=(0,o.toMilliSeconds)(t.ot/this.ls-this.getTimestampOffset()))},t.prototype.getNextSegmentInfo_=function(){var t,n,i={isInitSegment:!1,presentationTimeOffset:this.getTimestampOffset()},r=this.getTemplate(this.currentRepresentationId);if(this.rs(r))return null;if(this.qs(),!(this.js.length>0&&this.hs<this.js.length))return null;var s=this.js[this.hs];e.prototype.setIndex.call(this,s.i),this.time=s.ot,i.duration=s.duration,i.mediaPresentationTime=s.t,i.segmentNumber=s.i;var o=null!==(n=null===(t=this.getCurrentPeriod())||void 0===t?void 0:t.start)&&void 0!==n?n:0;if(i.startTime=s.playbackTime+o,this.manifestService.isLive()){if(this.isExpectedSegmentPlaybackTimeExceedingPeriodDuration(this.hs))return null;this.ss(i)}var a=this.manifestService.getRepresentationById(this.currentRepresentationId);return a?(i.periodId=null==a?void 0:a._internalId.periodId,i.url=(0,l.default)(r._media,a,this.getIndex(),this.time),e.prototype.setIndex.call(this,this.getIndex()+1),this.hs++,i):null},t.prototype.getNextSegmentInfo=function(e){var t=this.getNextSegmentInfo_();return t?Promise.resolve(t):this.queueSegmentInfoRequest({time:e})},t.prototype.queueSegmentInfoRequest=function(e){var t=this;return this.pendingSegmentInfoRequest?Promise.reject("fail"):new Promise(function(n,i){t.pendingSegmentInfoRequest=r(r({},e),{resolve:n,reject:i})})},t.prototype.resolvePendingSegmentInfoRequests=function(){if(this.pendingSegmentInfoRequest){var e=this.getNextSegmentInfo_();if(e)this.pendingSegmentInfoRequest.resolve(e),this.pendingSegmentInfoRequest=null;else if(!this.manifestService.isSmoothManifest()){var t=this.getCurrentPeriod();if(isFinite(t.duration)){var n=this.getTimelineDuration(),i=n/this.getTimelineLength(),r=t.start+n,s=t.duration-i/2;isFinite(s)&&r>=s&&(this.pendingSegmentInfoRequest.reject(u.SegmentInfoError.PERIOD_COMPLETE),this.pendingSegmentInfoRequest=null)}}}},t.prototype.getSegmentInfos=function(e){var t=this,n={};return this.manifestService.getAdaptationSet(this.currentRepresentationId).Representation.forEach(function(i){for(var r=i._internalId,s=t.getTemplate(r),o=[],u=t.manifestService.isLive(),d=t.getTimelineLength(),h=0,p=0;p<d;p++){var c=t.js[p],f={};f.duration=c.duration,u?f.startTime=t.getExpectedPresentationTime(p):(f.startTime=h,h+=c.duration);var g=(0,l.default)(s._media,i,c.i,c.ot);f.url=e?a.URLHelper.concatBaseUrlWithPartial(e,g):g,f.url=a.URLHelper.appendQueryParametersToUrl(f.url,t.settings.QUERY_PARAMETERS),o.push(f)}n[r.representationId]=o}),n},t.prototype.getSubtitleUrl=function(){var e=this.manifestService.getRepresentationById(this.currentRepresentationId).BaseURL[0];return e.url||e},t.prototype.getSegmentDuration=function(){return this.getSegmentDurationCurrentElement()},t.prototype.seekTo=function(t){if(t>-1){var n=this.ps(this.getCurrentPeriod());this.os=!1,isFinite(n)&&(t-=n);for(var i=1;i<this.js.length;i++)if(this.js[i].playbackTime>t)return this.hs=i-1,e.prototype.setIndex.call(this,this.js[this.hs].i),this.ks=!1,this.getIndex();this.hs=Math.max(this.js.length-1,0)}return e.prototype.setIndex.call(this,this.js[this.hs].i),this.getIndex()},t.prototype.getExpectedPresentationTime=function(e){var t,n;return(null!==(n=null===(t=this.getCurrentPeriod())||void 0===t?void 0:t.start)&&void 0!==n?n:0)+this.js[e].playbackTime},t.prototype.hasNext=function(e){if(this.hs<this.js.length){var t=this.js[0].t,n=this.js[this.hs];if(this.isExpectedSegmentPlaybackTimeExceedingPeriodDuration(this.hs))return!1;if(n)return n.t-t<=e*this.ls}return!1},t.prototype.getTimestampOffset=function(){var e=this.getCurrentPeriod(),t=this.ms/this.ls;return e&&(t-=e.start),t},t.prototype.setIndex=function(t){if(e.prototype.setIndex.call(this,t),this.js&&this.js.length>0)for(var n=0;n<this.js.length;n++)this.js[n].i===t&&(this.hs=n)},t.prototype.getLiveEdgeTime=function(){if(!this.manifestService.isLive())return-1;var t=this.manifestService.getLastPeriod(),n=this.getCurrentPeriod();if(null==t||(null==n?void 0:n._id)===t._id)return this.ps(n)+this.ts()/this.ls;var i=(0,h.getFirstAvSegmentTemplateFromPeriod)(t);return(null==i?void 0:i.SegmentTimeline)?this.ps(t)+(0,h.calculateTimelineEnd)(i):e.prototype.getLiveEdgeTime.call(this)},t.prototype.ts=function(){if(!this.js.length)return 0;var e=this.js[this.js.length-1];return e.t+e.d},t.prototype.timeShift=function(t,n){if(this.manifestService.isLive()&&!(this.js.length<1)){this.os=!1;for(var i=this.js[0].t,r=this.ts(),s=t*this.ls,o=Math.max(this.ns,this.settings.MIN_TIMELINE_LIVE_OFFSET)*this.ls,a=Math.max(i+o,r+s),u=this.js.length-1;u>=0;u--)if(this.js[u].t<=a){this.hs=u;break}(this.hs>=this.js.length||this.hs<=0)&&(this.context.logger.debug("timeline index ran out of bounds on timeShift, falling back to 0"),this.hs=0),this.context.logger.debug("timeShift changes index to "+this.hs),this.ks=!1,e.prototype.setIndex.call(this,this.js[this.hs].i)}},t.prototype.updateRepresentation=function(e){return this.currentRepresentationId=e,Promise.resolve(e)},t.prototype.isSegmentInfoLoaded=function(e){return!0},t.prototype.rewindOneSegment=function(){return this.hs--,this.hs<0&&(this.context.logger.debug("Timeline array index is smaller than 0, probably a discontinuity. Using 0."),this.hs=0),!0},t.prototype.us=function(e,t){for(var n,i={entries:[],latestTime:0,latestOriginalTime:0,lastPreviousTimelineEntryIndex:0,index:this.getStartNumber()},r=0,s=0,o=0,a=e;o<a.length;o++)for(var u=0,l=null!==(n=a[o].S)&&void 0!==n?n:[];u<l.length;u++){var d=l[u],p=(0,h.parseStringToNumber)(d._r),f=parseInt(d._d);if(d.hasOwnProperty("_t")){var g=(0,h.parseStringToNumber)(d._t);i.latestOriginalTime=g,i.latestTime=g-this.ms}for(;i.latestTime+f<=0&&p>=0;)this.context.logger.debug("Negative timeline entry detected, discarding segment. Time: ".concat(i.latestTime,", presentationTimeOffset: ").concat(this.ms,".")),i.latestTime+=f,i.latestOriginalTime+=f,p--;for(var m=this.xs(i,t,f,p),v=0;v<m.length;v++)m[v].i=i.index+v;r+=m.length,c(i,m,f);var y=p-m.length+1;s+=y,c(i,this.ws(i,y,f),f)}return this.vs(r,s),i.entries},t.prototype.vs=function(e,t){var n;this.context.logger.debug("[SegmentTimeline][".concat(null===(n=this.currentRepresentationId)||void 0===n?void 0:n.representationId,"] Re-using ").concat(e," entries, adding ").concat(t," new entries"))},t.prototype.ws=function(e,t,n){for(var i=[],r=0;r<t;r++){var s=e.latestTime+n*r,o={d:n,t:s,ot:e.latestOriginalTime+n*r,i:e.index+r,playbackTime:s/this.ls,duration:n/this.ls};i.push(o)}return i},t.prototype.xs=function(e,t,n,i){var r=(0,s.findIndexWithin)(t,e.lastPreviousTimelineEntryIndex,t.length,function(t){return t.t===e.latestTime&&t.d===n});if(-1===r)return[];var o=function(e,t,n,i){for(var r=e[t].t,s=i;s>0;s--){var o=t+s,a=e[o],u=r+n*s;if(a&&a.t===u&&a.d===n)return o}return t}(t,r,n,i);return e.lastPreviousTimelineEntryIndex=o,t.slice(r,o+1)},t.prototype.getTimelineDuration=function(){var e=this;return this.js&&this.js.length>0&&isFinite(this.ls)?this.js.reduce(function(t,n){return t+n.d/e.ls},0):0},t.prototype.getTimelineLength=function(){return this.js?this.js.length:0},t.prototype.setTimeline=function(e,t){void 0===t&&(t=!1);var n=e.SegmentTimeline;if(this.os=this.os||Boolean(t),n&&this.is!==n){this.is=n;var i=this.It(),r=this.getTimescale();this.ls=r,this.ms=parseFloat(String(e._presentationTimeOffset))||0;var s=this.us(n,this.js);s.length>0&&(this.ns=s[0].d/r),this.Jt(s,r,i),this.js=s}},t.prototype.It=function(){return this.js&&this.js.length>0?this.ls:this.getTimescale()},t.prototype.Jt=function(t,n,i){var r,s=!1;if(this.js&&this.js.length>0?r=(s=this.hs>=this.js.length)?this.js[this.js.length-1]:this.js[this.hs]:(this.hs=0,e.prototype.setIndex.call(this,0)),r)for(var o=t.length-1;o>=0;o--)if(m(t[o],n,r,i)){this.hs=o+(s?1:0),e.prototype.setIndex.call(this,t[o].i+(s?1:0));break}},t.prototype.getSegmentDurationCurrentElement=function(){var e=this.js[this.hs];return e?e.d/this.ls:1},t.prototype.dispose=function(){this.settings=null,this.js=[]},t}(d.SegmentTemplateMPDHandler);function c(e,t,n){var i;(i=e.entries).push.apply(i,t),e.latestTime+=n*t.length,e.latestOriginalTime+=n*t.length,e.index+=t.length}t.SegmentTimelineMPDHandler=p;var f=Math.pow(10,8);function g(e){return Math.round(e*f)/f}function m(e,t,n,i){var r=g(e.t/t),s=g(r+e.d/t),o=g(n.t/i);return r<=o&&o<s}},4771:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,n,r){var s=e.match(/(\$((RepresentationID)|(Bandwidth)|(Time)|(Number(%([\d]*[A-Za-z]))?)|())\$)/g),o=null!=n,a=t.hasOwnProperty("_bandwidth"),u=null!=r;function l(e){if(0===e.indexOf("Number")&&o){if(e.indexOf("%")>-1){var i=function(e){var t=parseInt(e.substring(0,e.length-1)),n=e[e.length-1].toLowerCase(),i=0!==e[e.length-1].indexOf(n);return[0===n.indexOf("o")?8:0===n.indexOf("x")?16:(n.indexOf("d"),10),t,i]}(e.substring(e.indexOf("%")+1)),s=i[0],l=i[1],d=i[2];return function(e,t){for(;e.length<t;)e="0"+e;return e}(function(e,t){return t?e.toUpperCase():e.toLowerCase()}(n.toString(s),d),l)}return String(n)}return 0===e.indexOf("RepresentationID")?t._internalId.representationId:0===e.indexOf("Bandwidth")&&a?String(t._bandwidth):0===e.indexOf("Time")&&u?String(r):""===e?"$":void 0}var d=[].concat(s).filter(function(e){return e}).map(function(e){return e.substring(1,e.length-1)}).map(function(e){return[e,l(e)]}).filter(function(e){return e[1].length>0}).reduce(function(e,t){var n=t[0],i=t[1];return e.replace("$".concat(n,"$"),i)},e);return(0,i.forceReallocation)(d)};var i=n(20649)},39761:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.getFirstAvSegmentTemplateFromPeriod=function(e){var t,n=e.AdaptationSet.find(function(e){return i.MimeTypeHelper.isAV(e._mimeType)}),r=null===(t=null==n?void 0:n.Representation[0])||void 0===t?void 0:t.SegmentTemplate;return null==r?void 0:r[0]},t.calculateTimelineEnd=function(e){for(var t,n,i=parseFloat(String(e._presentationTimeOffset))||0,o=(0,r.getTimescaleFromTemplate)(e),a=0,u=0,l=null!==(t=e.SegmentTimeline)&&void 0!==t?t:[];u<l.length;u++)for(var d=0,h=null!==(n=l[u].S)&&void 0!==n?n:[];d<h.length;d++){var p=h[d],c=s(p._r),f=parseInt(p._d);p.hasOwnProperty("_t")&&(a=Math.max(0,s(p._t)-i)),a+=f*(c+1)}return a/o},t.parseStringToNumber=s;var i=n(85434),r=n(12054);function s(e,t){return void 0===t&&(t=0),e?parseInt(e):t}}},function(e){return function(){return e(66759)}()}])});
17
+ "use strict";!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.dash=t():(e.bitmovin=e.bitmovin||{},e.bitmovin.player=e.bitmovin.player||{},e.bitmovin.player.dash=t())}(self,function(){return(self.webpackChunkbitmovin_player=self.webpackChunkbitmovin_player||[]).push([[367],{96693:function(e,t,n){var r=this&&this.__assign||function(){return r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},r.apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.isInitializationStringNode=function(e){return(0,i.isObject)(e)&&null!=e._initialization},t.isInitializationNode=function(e){return(0,i.isObject)(e)&&Array.isArray(e.Initialization)&&e.Initialization.length>0},t.isIndexRangeNode=function(e){return(0,i.isObject)(e)&&null!=e._indexRange},t.provideSegmentInfoFromInitializationProperty=function(e,t){var n=(0,a.default)(e._initialization,t),i=o.URLHelper.concatBaseUrlWithPartial(u(t),n);return r(r({},(0,s.createInitSegmentInfoBase)(t)),{url:i,mediaURL:n})},t.extractBaseUrlFromRepresentation=u,t.provideSegmentInfoFromInitializationNodeProperty=function(e,t){var n=e.Initialization[0],i=function(e,t){return e._sourceURL?e._sourceURL:u(t)}(n,t),a=o.URLHelper.concatBaseUrlWithPartial(u(t),i),l=function(e){var t,n,r=null!==(n=null===(t=e._range)||void 0===t?void 0:t.split("-").map(function(e){return parseInt(e)}))&&void 0!==n?n:[];return r.length>1?{start:r[0],end:r[1]}:null}(n);return r(r({},(0,s.createInitSegmentInfoBase)(t)),{url:a,mediaURL:i,byteRange:l})},t.provideSegmentInfoFromIndexRangeProperty=function(e,t){var n=u(t),i={start:0,end:parseInt(e._indexRange.split("-")[0])-1};return r(r({},(0,s.createInitSegmentInfoBase)(t)),{url:n,mediaURL:n,byteRange:i})};var i=n(94685),o=n(58313),s=n(65439),a=n(4771);function u(e){return e.BaseURL?o.URLHelper.urlObjectToString(e.BaseURL[0]):""}},44908:function(e,t,n){var r=this&&this.__assign||function(){return r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},r.apply(this,arguments)},i=this&&this.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.MPDLoader=void 0;var o=n(40306),s=n(3336),a=n(80813),u=n(3714),l=n(4129),d=n(85625),p=n(77401),h=n(57456),c=n(29669),f=n(91678),g=n(33436),m=n(89927),v=n(58313),y=n(78340),S=function(){function e(e,t){var n=this;this.Vq=0,this.dq=function(e){return e.body?n.or(e):(n.Tq.load(null,null).catch(function(){}),null)},this.pr=function(e,t){n.Wq=function(e,t,n){if((null==t?void 0:t.name)===p.RequestError.Canceled)return null;if((null==t?void 0:t.name)===p.RequestError.TimedOut)return new s.PlayerError(o.ErrorCode.NETWORK_MANIFEST_DOWNLOAD_TIMEOUT,I(e),"Failed to load DASH manifest: the request timed out.",n);var r=(null==e?void 0:e.status)===XMLHttpRequest.UNSENT?"Failed to load the DASH manifest due to CORS restrictions or because the client is offline.":"Failed to load DASH manifest: ".concat(e.status," ").concat(e.statusText,".");return new s.PlayerError(o.ErrorCode.SOURCE_COULD_NOT_LOAD_MANIFEST,I(e),r,n)}(e,t,n.Oq.sourceIdentifier)},this.Nq=e,this.Oq=t,this.Uq=e.settings,this.Qq=new y.MPDParser(e,t),this.Pq=!1,this.Xq=e.eventHandler,this.Sq=[];var r={onFailure:this.pr,maxRetries:this.Uq.MAX_MPD_RETRIES,requestType:c.HttpRequestType.MANIFEST_DASH,resetRetriesWhenOffline:!1};this.Tq=new l.DefaultContentLoader(e,r)}return e.prototype.Yq=function(e,t){if(this.Pq)return null;var n=e.trim();return this.Zq(n,t)},e.prototype.Zq=function(e,t){var n,r=this.Nq.serviceManager.get(a.ServiceName.ManifestCachingService),o=null!==(n=null==r?void 0:r.getParsedManifest(this.Rq))&&void 0!==n?n:this.aq(e,t);return o?(R(o)||null==r||r.cacheParsedManifest(o,this.Rq),this.Sq=o.BaseURL?i(i([],o.Location,!0),o.BaseURL.map(function(e){return e.url}),!0):o.Location,this.Rq=this.Sq[0],o):null},e.prototype.aq=function(e,t){return this.Qq.parse(e,this.Rq,t)},e.prototype.bq=function(){this.Tq&&this.Tq.cancel(),this.Pq=!0,this.Rq=null},e.prototype.dispose=function(){this.bq(),this.Tq.dispose(),this.Qq&&(this.Qq.dispose(),this.Qq=null),this.Uq=null},e.prototype.load=function(e){var t=this;this.Rq=null!=e?e:this.Rq;var n=this.Rq;return this.Wq=null,e&&(this.Pq=!1),n?this.cq(n).then(function(e){return t.dq(e)}).then(function(e){return t.Rq!==n&&t.Sq.includes(t.Rq)&&(t.Nq.logger.debug("Switched manifest location to ".concat(t.Rq)),t.Nq.eventHandler.dispatchEvent(u.PlayerEvent.ContentLocationChanged,{sourceLocationId:n,targetLocationId:t.Rq,reason:u.ContentLocationChangedReason.Failover})),e}).catch(function(e){return t.Pq||(null==e?void 0:e.message)===p.RequestError.Canceled?Promise.reject():(t.Nq.logger.debug("Error during loading: "+t.Rq+": ",e),Promise.reject(e))}):(this.Nq.eventHandler.fireError(new s.PlayerError(o.ErrorCode.SOURCE_INVALID,void 0,"Cannot load the manifest: no URL was provided.",this.Oq.sourceIdentifier)),Promise.reject("No manifest url provided"))},e.prototype.cq=function(e){var t,n=this,r=this.Nq.serviceManager.maybeCall(a.ServiceName.ManifestCachingService,function(t){return t.getHttpResponse(e)});if(r)return Promise.resolve(r);var i=null===(t=this.Oq.source.options)||void 0===t?void 0:t.manifestWithCredentials;return this.Tq.load(e,c.HttpRequestMethod.GET,null,null,null,i,d.ManifestMimeType.Dash).catch(function(e){return n.Vq++,n.Vq<n.Sq.length?(n.Rq=v.URLHelper.replaceCdn(n.Rq,n.Sq[n.Vq]),n.cq(n.Rq)):(n.Nq.logger.debug("no base url left, all tried"),n.Wq&&n.Xq.fireError(n.Wq),n.Wq=null,Promise.reject(e))})},e.prototype.updateRepresentation=function(e){return Promise.resolve(e)},e.prototype.stopRepresentationUpdate=function(e){return Promise.resolve()},e.prototype.or=function(e){var t,n,i,o,s=null!==(t=e.elapsedTime)&&void 0!==t?t:0;(0,h.isDownloadTimeInformationValid)(e)&&(this.Nq.logger.debug("Downloaded manifest in: ".concat(s.toFixed(2),", TTFB: ").concat(null===(n=e.timeToFirstByte)||void 0===n?void 0:n.toFixed(2))),this.Nq.store.dispatch((0,f.addMetricsValue)("default",g.MetricType.DownloadInformation,{bytes:e.length,time:s,timeToFirstByte:e.timeToFirstByte}))),this.Rq=e.url;var u=r({},this.Yq(e.body,(0,m.toSeconds)(Math.round(s))));return u._currentLoadingUrl=this.Rq,R(u)?!0===(null===(o=null===(i=this.Nq)||void 0===i?void 0:i.settings)||void 0===o?void 0:o.INFINITE_RETRIES_FOR_LIVE)&&this.Tq.setResetRetriesWhenOffline(!0):this.Nq.serviceManager.maybeCall(a.ServiceName.ManifestCachingService,function(t){return t.cacheHttpResponse(e,e.url)}),u},e}();function I(e){return{url:e.url,statusCode:e.status,statusText:e.statusText}}function R(e){return"dynamic"===(null==e?void 0:e._type)}t.MPDLoader=S},78340:function(e,t,n){var r=this&&this.__assign||function(){return r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},r.apply(this,arguments)},i=this&&this.__runInitializers||function(e,t,n){for(var r=arguments.length>2,i=0;i<t.length;i++)n=r?t[i].call(e,n):t[i].call(e);return r?n:void 0},o=this&&this.__esDecorate||function(e,t,n,r,i,o){function s(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var a,u=r.kind,l="getter"===u?"get":"setter"===u?"set":"value",d=!t&&e?r.static?e:e.prototype:null,p=t||(d?Object.getOwnPropertyDescriptor(d,r.name):{}),h=!1,c=n.length-1;c>=0;c--){var f={};for(var g in r)f[g]="access"===g?{}:r[g];for(var g in r.access)f.access[g]=r.access[g];f.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");o.push(s(e||null))};var m=(0,n[c])("accessor"===u?{get:p.get,set:p.set}:p[l],f);if("accessor"===u){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(a=s(m.get))&&(p.get=a),(a=s(m.set))&&(p.set=a),(a=s(m.init))&&i.unshift(a)}else(a=s(m))&&("field"===u?i.unshift(a):p[l]=a)}d&&Object.defineProperty(d,r.name,p),h=!0},s=this&&this.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.BaseURL=t.MPDParser=void 0,t.mergeCommonAttributes=b,t.parseFraction=x;var a=n(25926),u=n(4224),l=n(3714),d=n(20213),p=n(69957),h=n(44468),c=n(34047),f=n(52424),g=n(21216),m=n(68922),v=n(85434),y=n(58313),S=n(88052),I=n(62756),R=n(92778),T=new RegExp("_(.*:)?label","i"),_=["__text","_byteRange","_serviceLocation","_availabilityTimeOffset","_availabilityTimeComplete"],P=function(){var e,t,n=[];return e=function(){function t(e,t){this.nR=i(this,n),this.nR=e,this.yS=t,this.zS=e.renderer;var r=S.ModuleManager.get(I.ModuleName.XML);this.AS=r.parseXML,this.BS=r.parseJSONtoXML}return t.prototype.CS=function(e,t){return(0,m.applyLabeling)({source:this.yS.source,context:this.nR,streamType:h.StreamType.Dash,labelingType:e},t)},t.prototype.DS=function(e){var t,n,r,i=null!==(r=null===(n=null===(t=e.Label)||void 0===t?void 0:t[0])||void 0===n?void 0:n.value)&&void 0!==r?r:e._label,o={mimeType:e._mimeType,lang:e._lang};return this.CS(m.LabelingType.Tracks,o)||i},t.prototype.ES=function(e,t){var n,r,i,o=null!==(i=null===(r=null===(n=t.Label)||void 0===n?void 0:n[0])||void 0===r?void 0:r.value)&&void 0!==i?i:t._label,s={id:t._id,mimeType:e,bitrate:t._bandwidth,qualityRanking:t._qualityRanking,width:t._width,height:t._height,frameRate:t._framerate};return this.CS(m.LabelingType.Qualities,s)||o},t.prototype.FS=function(e){var t,n=this,r=0;for(var i in e)if(e.hasOwnProperty(i)){if("Accessibility"===i&&this.GS(e,e[i]),"EssentialProperty"===i&&E(e[i]))return this.nR.logger.debug("Ignoring trickplay track ".concat(e._id," from Period ").concat(e._periodId)),null;"Label"===i&&(e.Label=D(e[i])),"SegmentTemplate"===i&&this.HS(e[i]),"SegmentList"===i&&this.IS(e[i]),"SegmentTemplate"===i||0===i.indexOf("_")||Array.isArray(e[i])||(e[i]=[e[i]]),"Representation"===i&&(e[i]=e[i].filter(function(t){var i,o,s=t._mimeType||e._mimeType;if(t._mimeType=t._mimeType||e._mimeType,s&&(s=s.toLowerCase()),"AudioChannelConfiguration"in e){var a=e.AudioChannelConfiguration;null!==(i=(o=t).AudioChannelConfiguration)&&void 0!==i||(o.AudioChannelConfiguration=a)}b(t,e),O(t),N(t,e),"string"==typeof t._bandwidth&&(t._bandwidth=parseFloat(t._bandwidth)),t.Label&&(t.Label=D(t.Label)),t.SegmentTemplate&&n.HS(t.SegmentTemplate),t.SegmentList&&n.IS(t.SegmentList);var u=t._codecs||e._codecs;if(s&&(0===s.indexOf("application")||0===s.indexOf("text")||0===s.indexOf("image")||s.indexOf("mp2t")>=0))r++,t._label=n.ES(s,t);else if(s&&u){if(t._codecs=u,!c.CodecStringHelper.isSupportedByRenderer(n.zS,s,u))return n.nR.logger.debug("Representation not supported ("+s+'; codecs="'+u+'")'),!1;r++,t._label=n.ES(s,t)}return!0}))}if(r>0){if(!e._mimeType){var o=null===(t=e.Representation.find(function(e){return e._mimeType}))||void 0===t?void 0:t._mimeType;o&&(e._mimeType=o)}return e._label=this.DS(e),e.Representation.sort(function(e,t){return e._bandwidth-t._bandwidth}),e}return this.nR.logger.debug("AdaptationSet ".concat(e._id," from Period ").concat(e._periodId," has no supported representations")),null},t.prototype.GS=function(t,n){t.ClosedCaptionLabels={};for(var r=e.filterAccessibilityTagsByScheme(n,"urn:scte:dash:cc:cea-608:2015"),i=e.extractLabelGroups(r),o=0;o<i.length;o++){var s=i[o],a=s.split("="),u=2===a.length?[a[0],a[1]]:["CC"+o,s],l=u[0],d=u[1];t.ClosedCaptionLabels[l]={label:d,lang:d}}},t.prototype.HS=function(e){for(var t,n,r=0,i=e;r<i.length;r++){var o=i[r];if(o.hasOwnProperty("SegmentTimeline"))for(var s=Number(null!==(t=o._timescale)&&void 0!==t?t:"1"),a=0,u=null!==(n=o.SegmentTimeline)&&void 0!==n?n:[];a<u.length;a++){var l=u[a];l.totalDuration=L(l,s)}}},t.prototype.IS=function(e){for(var t,n,r,i,o,s,a=0,u=e;a<u.length;a++){var l=u[a];if(l.hasOwnProperty("SegmentTimeline")){for(var d=Number(null!==(t=l._timescale)&&void 0!==t?t:"1"),p=0,h=null!==(n=l.SegmentTimeline)&&void 0!==n?n:[];p<h.length;p++){var c=h[p];c.totalDuration=L(c,d)}l.totalDuration=null!==(o=null===(i=null===(r=l.SegmentTimeline)||void 0===r?void 0:r[0])||void 0===i?void 0:i.totalDuration)&&void 0!==o?o:0}else if(l.hasOwnProperty("_duration")&&l.hasOwnProperty("SegmentURL")){d=Number(null!==(s=l._timescale)&&void 0!==s?s:"1");var f=Number(l._duration)/d;l.totalDuration=f*l.SegmentURL.length}}},t.filterAccessibilityTagsByScheme=function(e,t){return e&&e.length>0?e.filter(function(e){return e._schemeIdUri===t}):[]},t.extractLabelGroups=function(e){for(var t=[],n=0,r=e;n<r.length;n++){var i=r[n];if(i._value){var o=i._value.split(";");t.push.apply(t,o)}}return t},t.prototype.JS=function(e,t){for(var n=0;n<e.length;n++)if("string"==typeof t&&e[n].url===t||"object"==typeof t&&e[n].url===t.url)return!0;return!1},t.prototype.KS=function(e,t,n,r){var i;Array.isArray(e.BaseURL)||(e.BaseURL=[e.BaseURL]);for(var o=[],s=0;s<e.BaseURL.length;s++){if((i=new B).customAttributes=[],null!=t&&(i.parentIds={},void 0!==t[0]&&null!==t[0]&&(i.parentIds.PeriodID=t[0]),void 0!==t[1]&&null!==t[1]&&(i.parentIds.AdaptationSetID=t[1]),void 0!==t[2]&&null!==t[2]&&(i.parentIds.RepresentationID=t[2])),"string"==typeof e.BaseURL[s])i.url=e.BaseURL[s];else if("object"==typeof e.BaseURL[s])for(var a in e.BaseURL[s].hasOwnProperty("__text")&&(i.url=e.BaseURL[s].__text),e.BaseURL[s].hasOwnProperty("_serviceLocation")&&(i.serviceLocation=e.BaseURL[s]._serviceLocation),e.BaseURL[s].hasOwnProperty("_byteRange")&&(i.serviceLocation=e.BaseURL[s]._byteRange),e.BaseURL[s].hasOwnProperty("_availabilityTimeOffset")&&(i.serviceLocation=e.BaseURL[s]._availabilityTimeOffset),e.BaseURL[s].hasOwnProperty("_availabilityTimeComplete")&&(i.serviceLocation=e.BaseURL[s]._availabilityTimeComplete),e.BaseURL[s])if(e.BaseURL[s].hasOwnProperty(a)&&0===a.indexOf("_")&&-1===_.indexOf(a)){var u={};u[a.substring(1)]=e.BaseURL[s][a],i.customAttributes.push(u)}o.push(i)}for(e.BaseURL=[],s=0;s<o.length;s++){var l=o[s];if(y.URLHelper.isUrlAbsolute(l))this.JS(e.BaseURL,l)||(l.isAbsolute=!0,r.push(l),e.BaseURL.push(l));else for(var d=0;d<n.length;d++){var p=n[d].toString();"/"!==n[d].url[n[d].url.length-1]&&(p+="/");var h=y.URLHelper.concatUrlParts(p,l);this.JS(e.BaseURL,h)||((i=new B).url=h,i.parentIds={},void 0!==t[0]&&null!==t[0]&&(i.parentIds.PeriodID=t[0]),void 0!==t[1]&&null!==t[1]&&(i.parentIds.AdaptationSetID=t[1]),void 0!==t[2]&&null!==t[2]&&(i.parentIds.RepresentationID=t[2]),i.serviceLocation=l.serviceLocation||n[d].serviceLocation,i.byteRange=l.byteRange||n[d].byteRange,i.availabilityTimeOffset=l.availabilityTimeOffset||n[d].availabilityTimeOffset,i.availabilityTimeComplete=l.availabilityTimeComplete||n[d].availabilityTimeComplete,e.BaseURL.push(i),r.push(i))}}return r},t.prototype.LS=function(e,t,n){var r=[];if(t=t||[],n=n||[],"object"!=typeof e)return e;for(var i in e.hasOwnProperty("BaseURL")&&(r=this.KS(e,n,t,r)),r.length<1&&(r=t),e)if(e.hasOwnProperty(i))if("object"==typeof e[i]&&0!==i.indexOf("_")){Array.isArray(e[i])||(e[i]=[e[i]]);for(var o=0;o<e[i].length;o++)if("BaseURL"!==i){var s=e[i][o]._id||o+"";e[i][o]=this.LS(e[i][o],r,n.concat([s])),"Representation"!==i||e[i][o].hasOwnProperty("BaseURL")||(e[i][o].BaseURL=r)}}else 0!==i.indexOf("_")||!T.test(i)&&"_streamName"!==i||(e._label=e[i],"_label"!==i&&delete e[i]);return e},t.prototype.MS=function(e){var t=f.DurationConverter.getDurationInSec(e._timeShiftBufferDepth);return(t=isNaN(t)?Number.NEGATIVE_INFINITY:-t)>0&&t<this.nR.bufferSettings.getForwardTargetLevel()&&(t=this.nR.bufferSettings.getForwardTargetLevel()),t},t.ensureObjectArray=function(e){return null==e?[]:(Array.isArray(e)?e:[e]).filter(function(e){return"object"==typeof e&&null!==e})},t.fillInMissingIds=function(t){t.Period=e.ensureObjectArray(t.Period);for(var n=[],r=[],i=0,o=t.Period;i<o.length;i++){(d=o[i]).AdaptationSet=e.ensureObjectArray(d.AdaptationSet);for(var s=0,a=d.AdaptationSet;s<a.length;s++)(c=a[s]).Representation=e.ensureObjectArray(c.Representation),n.push(c),r.push.apply(r,c.Representation)}e.assignMissingIds(t.Period),e.assignMissingIds(n),e.assignMissingIds(r);for(var u=0,l=t.Period;u<l.length;u++)for(var d,p=0,h=(d=l[u]).AdaptationSet;p<h.length;p++){var c;(c=h[p])._periodId=d._id}},t.assignMissingIds=function(e){for(var t=e.map(function(e){return e._id}).filter(function(e){return Boolean(e)}),n=0,r=0,i=e;r<i.length;r++){var o=i[r];if(!o._id){do{n++}while(t.includes(""+n));o._id=""+n,t.push(o._id)}}},t.prototype.NS=function(e){return"dynamic"===e._type&&(e._timeShiftBufferDepth=this.MS(e)),e},t.prototype.OS=function(e){return e._publishTime&&(e._publishTime=new Date(e._publishTime).getTime()),e},t.prototype.PS=function(e,t){return e.hasOwnProperty("Location")?Array.isArray(e.Location)||(e.Location=[e.Location]):e.Location=[t],e},t.prototype.QS=function(e){e.hasOwnProperty("BaseURL")&&!Array.isArray(e.BaseURL)&&(e.BaseURL=[e.BaseURL]);for(var t=[],n=0;n<e.Location.length;n++){var r=e.Location[n],i=new B;i.url=y.URLHelper.removeLastPathPart(r),t.push(i)}return this.LS(e,t,null)},t.prototype.RS=function(e,t){t._start?t.start=f.DurationConverter.getDurationInSec(t._start):(t.start=e.start+e.duration,t._start="PT"+t.start+"S")},t.prototype.SS=function(e){for(var t={start:0,duration:0,_start:"PT0S",_duration:"PT0S"},n=0;n<e.Period.length;n++){var r=e.Period[n];this.RS(t,r),r._duration?r.duration=f.DurationConverter.getDurationInSec(r._duration):(e.Period[n+1]?r.duration=(f.DurationConverter.getDurationInSec(e.Period[n+1]._start)||0)-r.start:e._mediaPresentationDuration?r.duration=(f.DurationConverter.getDurationInSec(e._mediaPresentationDuration)||0)-r.start:r.duration=1/0,r._duration="PT"+r.duration+"S"),this.nR.logger.debug("period ".concat(n," (id=").concat(r._id,"): ").concat(r.start,"-").concat(r.start+r.duration)),e.Period[n]=r,t=r}return e},t.prototype.TS=function(e){for(var t,n,r=this,i=[],o=[],s=f.DurationConverter.getDurationInSec(e._mediaPresentationDuration),d=function(d){var h=e.Period[d];for(var c in t=f.DurationConverter.getDurationInSec(h._start),n=f.DurationConverter.getDurationInSec(h._duration),isNaN(t)&&0===o.length&&"static"===e._type&&(t=0),isNaN(t)&&o.length>0&&!isNaN(parseFloat(o[o.length-1].start))&&!isNaN(parseFloat(o[o.length-1].duration))&&(t=o[o.length-1].start+o[o.length-1].duration),isNaN(t)&&d===e.Period.length-1&&!isNaN(s)&&(n=s-t),o.length>0&&isNaN(parseFloat(o[o.length-1].duration))&&!isNaN(t)&&(o[o.length-1].duration=t-o[o.length-1].start),o.push({start:t,duration:n}),h)if(h.hasOwnProperty(c)&&["BaseURL","AdaptationSet","EventStream"].includes(c))if(Array.isArray(h[c])||(h[c]=[h[c]]),"AdaptationSet"===c){var g=h[c].map(function(e){var t,n=e._mimeType||(null===(t=e.Representation.find(function(e){return e._mimeType}))||void 0===t?void 0:t._mimeType);return n?v.MimeTypeHelper.extractContentType(n):""}).filter(function(e,t,n){return e&&n.indexOf(e)===t});h[c]=h[c].map(function(e){b(e,h);var t=r.FS(e);return null!==t&&!t.hasOwnProperty("ContentProtection")&&t.Representation[0].hasOwnProperty("ContentProtection")&&(t.ContentProtection=t.Representation[0].ContentProtection),t}).filter(function(e){return Boolean(e)});for(var m=function(e){!h[c].some(function(t){return t._mimeType.includes(e)})&&p.nR.eventHandler.dispatchEvent(l.PlayerEvent.Warning,new a.PlayerWarning(u.WarningCode.SOURCE_CODEC_OR_FILE_FORMAT_NOT_SUPPORTED))},y=0,S=g.filter(function(e){return"audio"===e||"video"===e});y<S.length;y++)m(S[y]);h[c].length<1&&i.push(d)}else if("EventStream"===c)for(var I=0,R=h[c].filter(function(e){return e.Event});I<R.length;I++)for(var T=0,_=R[I].Event;T<_.length;T++){var P=_[T];P.rawXmlRepresentation=p.BS({event:P})}},p=this,h=0;h<e.Period.length;h++)d(h);return i.length>0&&"static"===e._type&&this.US(i,o,s,e),e=this.SS(e)},t.prototype.US=function(e,t,n,r){for(var i,o,s;!isNaN(parseInt(i=e.pop()));){if(o=t[i].start,s=t[i].duration,!isNaN(o)&&!isNaN(s)){isNaN(n)||(n-=s,r._mediaPresentationDuration="PT"+n+"S");for(var a=i+1;a<t.length;a++)isNaN(parseFloat(t[a].start))||(t[a].start=t[a].start-s,r.Period[a]._start="PT"+t[a].start+"S")}t.splice(i,1),r.Period.splice(i,1)}},t.parseUTCTimingInformation=function(e,t){var n,r,i,o;e.hasOwnProperty("UTCTiming")&&!Array.isArray(e.UTCTiming)&&(e.UTCTiming=[e.UTCTiming]);for(var s=[],a=function(a){var u={schemeIdUri:a._schemeIdUri,value:""};if("string"==typeof a._value)if(u.schemeIdUri.startsWith("urn:mpeg:dash:utc:http")){var l=null!==(i=null===(r=null===(n=e.BaseURL)||void 0===n?void 0:n[0])||void 0===r?void 0:r.url)&&void 0!==i?i:y.URLHelper.removeLastPathPart(t);u.value=(null!==(o=a._value.match(/\S+/g))&&void 0!==o?o:[a._value]).map(function(e){return y.URLHelper.concatBaseUrlWithPartial(l,e)}).join(" ")}else u.value=a._value;s.push(u)},u=0,l=(e.UTCTiming||[]).filter(function(e){return e.hasOwnProperty("_schemeIdUri")&&"string"==typeof e._schemeIdUri});u<l.length;u++)a(l[u]);return s.length>0?e.UTCTiming=s:delete e.UTCTiming,e},t.prototype.parse=function(t,n,r){var i,o=this.AS(t,{decodeEntities:!0});if(!1===o.success)throw new d.PlayerError(d.ErrorCode.SOURCE_MANIFEST_INVALID,{errorMessage:o.error.message},"DASH manifest is not a valid XML",this.yS.sourceIdentifier);var s=o.parsed.MPD;return s._requestTimestamp=Date.now(),s._downloadTime=r,s._type=null!==(i=s._type)&&void 0!==i?i:"static",e.fillInMissingIds(s),function(e){return e.Period.some(function(e){return e.AdaptationSet.some(function(e){return e.Representation.some(function(t){var n;return Boolean(null!==(n=t._mimeType)&&void 0!==n?n:e._mimeType)})})})}(s)?(s=this.NS(s),s=this.OS(s),s=this.PS(s,n),s=this.QS(s),s=this.TS(s),(s=e.parseUTCTimingInformation(s,n)).originalDashManifest=t,s):(this.nR.eventHandler.fireError(new d.PlayerError(d.ErrorCode.SOURCE_MANIFEST_INVALID,void 0,"DASH manifest contains no representations",this.yS.sourceIdentifier)),null)},t.prototype.dispose=function(){this.zS=null},t}(),function(){var r="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;t=[(0,p.trackPerformance)("MPDParser.parse")],o(e,null,t,{kind:"method",name:"parse",static:!1,private:!1,access:{has:function(e){return"parse"in e},get:function(e){return e.parse}},metadata:r},null,n),r&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})}(),e}();function b(e,t){if(e&&t)for(var n=["SegmentBase","SegmentList","SegmentTemplate"],i=0,o=n;i<o.length;i++){var s=o[i],a=Array.isArray(e[s])&&e[s][0],u=Array.isArray(t[s])&&t[s][0],l=n.find(function(t){return e[t]});u&&a?e[s]=[r(r({},t[s][0]),e[s][0])]:u&&!l&&(e[s]=t[s])}}function x(e){var t=e.split("/");return parseInt(t[0])/(parseInt(t[1])||1)}function L(e,t){return e.S.reduce(function(e,t){var n;return e+Number(t._d)*(Number(null!==(n=t._r)&&void 0!==n?n:"0")+1)},0)/t}function O(e){"string"==typeof e._audioSamplingRate&&(e._audioSamplingRate=parseFloat(e._audioSamplingRate))}function N(e,t){"string"==typeof e._height&&(e._height=parseFloat(e._height)),"string"==typeof e._width&&(e._width=parseFloat(e._width)),"string"==typeof e._frameRate&&(e._frameRate=x(e._frameRate)),e._dynamicRange=function(e,t){var n,r,i,o,a=s(s(s(s([],null!==(n=e.EssentialProperty)&&void 0!==n?n:[],!0),null!==(r=e.SupplementalProperty)&&void 0!==r?r:[],!0),null!==(i=t.EssentialProperty)&&void 0!==i?i:[],!0),null!==(o=t.SupplementalProperty)&&void 0!==o?o:[],!0).filter(function(e){return e._schemeIdUri===R.DashSchemeUri.TransferCharacteristics}).map(function(e){var t=e._value;return(0,g.getDynamicRangeFromTransferCharacteristics)(parseInt(null!=t?t:"",10))}).find(function(e){return e!==h.VideoDynamicRange.Unknown});if(void 0!==a)return a;var u=c.CodecStringHelper.getExtractedCodecStrings(e._codecs||t._codecs);return(0,g.getDynamicRangeFromVideoCodec)(u.video)}(e,t)}function D(e){return"string"==typeof e?[{value:e}]:Array.isArray(e)?e.map(function(e){return{id:e._id,lang:e._lang,value:e.toString()}}):[]}function E(e){var t;return"http://dashif.org/guidelines/trickmode"===(null===(t=null==e?void 0:e[0])||void 0===t?void 0:t._schemeIdUri)}t.MPDParser=P;var B=function(){function e(){this.url=null,this.parentIds=null,this.serviceLocation=null,this.byteRange=null,this.availabilityTimeOffset=null,this.availabilityTimeComplete=null,this.isAbsolute=!1,this.customAttributes=null}return e.prototype.toString=function(){return this.url?""+this.url:""},e}();t.BaseURL=B},66759:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.DASHModuleDefinition=void 0;var r=n(62756),i=n(96693),o=n(44908),s=n(4771),a=n(63889),u=n(12054),l=n(31439),d={isIndexRangeNode:i.isIndexRangeNode,isInitializationNode:i.isInitializationNode,isInitializationStringNode:i.isInitializationStringNode},p={provideSegmentInfoFromInitializationProperty:i.provideSegmentInfoFromInitializationProperty,provideSegmentInfoFromInitializationNodeProperty:i.provideSegmentInfoFromInitializationNodeProperty,provideSegmentInfoFromIndexRangeProperty:i.provideSegmentInfoFromIndexRangeProperty};t.DASHModuleDefinition={name:r.ModuleName.DASH,module:function(){return{MPDLoader:o.MPDLoader,SegmentBaseMPDHandler:a.SegmentBaseMPDHandler,SegmentTemplateMPDHandler:u.SegmentTemplateMPDHandler,SegmentTimelineMPDHandler:l.SegmentTimelineMPDHandler,replaceAllPlaceholders:s.default,initSegmentInfoSourceDetectors:d,initSegmentInfoProviders:p}},dependencies:[r.ModuleName.EngineBitmovin,r.ModuleName.XML]},t.default=t.DASHModuleDefinition},63889:function(e,t,n){var r=this&&this.__assign||function(){return r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},r.apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.SegmentBaseMPDHandler=void 0;var i=n(40306),o=n(3336),s=n(80813),a=n(56481),u=n(4129),l=n(77401),d=n(29669),p=n(79721),h=n(84568),c=n(58313),f=n(88052),g=n(62756),m=n(13422),v=n(59707),y=n(96693),S=function(){function e(e,t){var n=this;this.context=e,this.sr=0,this.ur=-1,this.Fr=null,this.Gr=(0,h.memoize)(this.Ur.bind(this),function(e,t){return t._internalId.representationId}),this.Hr=function(e){var t=r({},n.Br.getRepresentationById(n.xr));return n.Gr(e,t).then(function(e){var r;if(n.Dr.dispatch((0,v.setRepresentationSegmentIndexAction)(t._internalId,e)),n.Dr.dispatch((0,v.setRepresentationIsLoadingAction)(t._internalId,!1)),e||(n.Dr.dispatch((0,v.setRepresentationSegmentIndexParsingErrorAction)(t._internalId,!0)),n.context.logger.warn("Error parsing SegmentIndex for representation with id ".concat(null===(r=n.xr)||void 0===r?void 0:r.key()))),n.ur>=0){var i=n.ur;n.ur=-1,n.seekTo(i)}return n.Ar=null,n.xr}).catch(function(e){throw n.Gr.invalidate(),e})},this.Ir=function(e){n.Ar=null,n.context.logger.debug("Getting segment index failed for representation with id ".concat(n.xr.key()," (Error: ").concat(JSON.stringify(e),")"));var t=n.Jr(e);return n.zr&&(n.zr.reject(t),n.zr=null),Promise.reject(t)},this.Nr=function(e){return n.zr?Promise.reject("fail"):new Promise(function(t,i){n.zr=r(r({},e),{resolve:t,reject:i})})},this.qr=e.settings;var i=t.sourceIdentifier;this.Er=i,this.Br=e.serviceManager.get(s.ServiceName.ManifestService,i);var o=this.Br.getFirstPeriod()||{_id:p.DEFAULT_PERIOD_ID};this.rr=o._id;var a=this.qr.MAX_RETRIES;this.yr=new u.DefaultContentLoader(e,{maxRetries:a,retryDelay:this.qr.RETRY_DELAY,requestType:d.HttpRequestType.MEDIA_SEGMENTINDEX,onSuccess:function(){n.Fr=null},onFailure:function(e,t){var r;n.Fr=null!==(r=null==t?void 0:t.name)&&void 0!==r?r:null}}),this.Dr=e.serviceManager.get(s.ServiceName.SourceStoreService,i)}return e.prototype.Jr=function(e){if(this.Fr===l.RequestError.Canceled)return l.RequestError.Canceled;var t=this.Fr===l.RequestError.TimedOut?i.ErrorCode.NETWORK_SEGMENT_DOWNLOAD_TIMEOUT:i.ErrorCode.NETWORK_ERROR,n=e;return new o.PlayerError(t,{url:null==n?void 0:n.url,statusCode:null==n?void 0:n.status},"Failed to load the segment index",this.Er)},e.prototype.Kr=function(e){var t,n,r=this.Br.getRepresentationById(e);if(r&&r.segmentIndex){var i=this.Br.getPeriodDuration(this.rr);isFinite(i)&&(n=i/r.segmentIndex.references.length);var o=this.Br.getMediaPresentationDuration();0!==o&&(isFinite(o)&&(t=o/r.segmentIndex.references.length),n||(n=t)),r.segmentIndex&&(t=r.segmentIndex.references[0].duration/r.segmentIndex.timescale,n||(n=t))}return n},e.prototype.Lr=function(){var e,t,n=this.Br.getRepresentationById(this.vr);if(null===(t=null===(e=null==n?void 0:n.segmentIndex)||void 0===e?void 0:e.references)||void 0===t?void 0:t.length){var r=n.segmentIndex.timescale||1,i=n.segmentIndex.references[this.sr].time/r,o=this.getTimestampOffset(),s={url:"",byteRange:n.segmentIndex.references[this.sr].byteRange,periodId:n._internalId.periodId,presentationTimeOffset:o,startTime:i-o};return this.sr++,this.tr=Math.floor(this.sr*this.getSegmentDuration())+this.Rr(),s}},e.prototype.getInitSegmentInfo=function(e){var t=this.Br.getRepresentationById(e);return t&&t.SegmentBase&&t.BaseURL?r(r({},this.Mr(t)),{codecs:(0,m.getCodecsFromAdaptationSet)(this.Br.getAdaptationSet(e))}):null},e.prototype.Mr=function(e){var t,n=e.SegmentBase[0];return(0,y.isInitializationNode)(n)?(0,y.provideSegmentInfoFromInitializationNodeProperty)(n,e):e.segmentIndex?(0,y.isIndexRangeNode)(n)?(0,y.provideSegmentInfoFromIndexRangeProperty)(n,e):null:(this.context.logger.debug("SegmentIndex for representation ".concat(null===(t=e._internalId)||void 0===t?void 0:t.key()," not parsed yet!")),null)},e.prototype.resolvePendingSegmentInfoRequests=function(){if(this.zr){var e=this.Lr();e&&(this.zr.resolve(e),this.zr=null)}},e.prototype.setAdaptationSetId=function(e){this.wr=e,this.Cr=e.adaptationSetId.split("-")[0],this.Or(),this.resolvePendingSegmentInfoRequests()},e.prototype.Or=function(){var e,t=this,n=this.Br.getRepresentationById(this.vr);n&&(e=n._bandwidth);var r=this.Br.getMatchingRepresentationsByBandwidth(this.wr,e),i=this.vr?r.find(function(e){return e._internalId===t.vr}):null,o=null!=i?i:r[0];this.vr=o._internalId,this.rr=this.vr.periodId,o.hasOwnProperty("SegmentBase")&&o.SegmentBase.length>1&&this.context.logger.debug("Representation ".concat(o._id," has more than one SegmentBase! Taking the first one."))},e.prototype.setRepresentationId=function(e){return!!this.Br.getRepresentationById(e)&&(this.vr=e,this.seekTo(this.tr),!0)},e.prototype.getSegmentInfos=function(){var e=this.getSeekableRange();return this.Pr(e)},e.prototype.Pr=function(e){var t=this,n={};return this.Br.getAdaptationSet(this.wr).Representation.forEach(function(r){var i=r._id;if(n[i]=[],1===r.BaseURL.length){var o=r.BaseURL[0].url;n[i].push({url:c.URLHelper.appendQueryParametersToUrl(o,t.qr.QUERY_PARAMETERS)})}else for(var s=0;s<r.BaseURL.length;s++)o=c.URLHelper.appendQueryParametersToUrl(r.BaseURL[s].url,t.qr.QUERY_PARAMETERS),n[i].push({url:o});n[i].forEach(function(t){t.duration=e.end-e.start,t.startTime=e.start})}),n},e.prototype.getNextSegmentInfo=function(e){var t=this.Lr();return t?Promise.resolve(t):this.Nr({time:e})},e.prototype.getSubtitleUrl=function(){var e=this.Br.getAvailableBaseURLsForRepresentation(this.vr);return e?e[0]:null},e.prototype.getStartNumber=function(){},e.prototype.getLiveEdgeTime=function(){return-1},e.prototype.getActualTimeShiftBufferDepth=function(){return this.Br.getTimeShiftBufferDepthSeconds()},e.prototype.Qr=function(){var e,t=this;return this.Br.getRepresentationById(this.vr)&&(e=this.Kr(this.vr)),e<0&&(e=this.Br.getAdaptationSet(this.wr).Representation.map(function(e){return t.Kr(e._internalId)}).find(function(e){return e>0})),isFinite(e)?[e,!0]:[1,!1]},e.prototype.getSegmentDuration=function(){return this.Qr()[0]},e.prototype.hasNext=function(){this.resolvePendingSegmentInfoRequests();var e=this.Br.getRepresentationById(this.vr);if(e){if(e.segmentIndex)return this.sr<e.segmentIndex.references.length;if(!this.isSegmentInfoLoaded(this.vr))return!0}return!1},e.prototype.Rr=function(){var e,t,n;return null!==(n=null===(t=null===(e=this.Br)||void 0===e?void 0:e.findPeriod(this.rr))||void 0===t?void 0:t.start)&&void 0!==n?n:0},e.prototype.seekTo=function(e){var t,n;this.tr=e;var r=this.Qr(),i=r[0],o=r[1];if((i<0||!o)&&(this.ur=e),i>0&&o&&e>-1){var s=Math.max(e-this.Rr(),0),a=null===(t=this.Br)||void 0===t?void 0:t.getRepresentationById(this.vr);this.vr&&a&&(this.setIndex(Math.floor(s/i)),this.context.logger.debug("seekTo: ".concat(e,", new index: ").concat(this.sr," (representationId: ").concat(null===(n=this.vr)||void 0===n?void 0:n.key(),", ").concat(a._mimeType,")")))}},e.prototype.getTimestampOffset=function(){var e=this.Br.findPeriod(this.rr),t=this.Br.getRepresentationById(this.vr),n=t&&t.SegmentBase?t.SegmentBase[0]:null,r=0;if(n&&n.hasOwnProperty("_presentationTimeOffset")&&n.hasOwnProperty("_timescale")){var i=n.hasOwnProperty("_timescale")?parseInt(n._timescale):1;r=parseInt(n._presentationTimeOffset)/i}return e&&(r-=e.start),r},e.prototype.getIndex=function(){return this.sr},e.prototype.setIndex=function(e){this.sr=e},e.prototype.timeShift=function(e){},e.prototype.updateRepresentation=function(e){var t=this;if(this.isSegmentInfoLoaded(e))return this.context.logger.debug("Skipping updateRepresentation, SIDX info already loaded"),Promise.resolve(e);if(this.Ar)return this.Ar;var n=this.Br.getRepresentationById(e);if(!n)return this.context.logger.log("Getting segment index failed (Invalid Representation Id: ".concat(null==e?void 0:e.key(),")")),Promise.reject(null);this.context.logger.debug("Going to load segment index (Representation Id: ".concat(null==e?void 0:e.key(),")"));var r=(0,y.extractBaseUrlFromRepresentation)(n),i=n.SegmentBase[0]._indexRange,o=parseInt(i.split("-")[1])+1;return this.Dr.dispatch((0,v.setRepresentationAnchorPointAction)(n._internalId,o)),this.xr=e,this.Ar=this.yr.load(r,d.HttpRequestMethod.GET,d.HttpResponseType.ARRAYBUFFER,void 0,{Range:"bytes="+i}).then(function(e){return t.Hr(e.body)}).catch(this.Ir),this.Ar},e.prototype.isSegmentInfoLoaded=function(e){return this.Br.isSegmentInfoLoaded(e)},e.prototype.rewindOneSegment=function(){return this.sr--,!(this.sr<0&&(this.context.logger.debug("SegmentBase array index is smaller than 0, probably a discontinuity. Using 0."),this.setIndex(0),1))},e.prototype.getSeekableRange=function(){return{start:0,end:this.Br.getMediaPresentationDuration()}},e.prototype.getPendingSegmentInfoRequest=function(){return this.zr},e.prototype.setPendingSegmentInfoRequest=function(e){this.zr=e},e.prototype.canSwitchRepresentation=function(e){return!0},e.prototype.getLatestTimeForPossibleSwitch=function(e){return e},e.prototype.adjustTimeToNextSegmentStart=function(e){return e},e.prototype.dispose=function(){this.qr=null,this.Br=null,this.vr=null,this.Dr=null,this.yr=(0,a.dispose)(this.yr),this.zr=null,this.Gr=null},e.prototype.setTimestampOffset=function(e,t){},e.prototype.Sr=function(){return this.context.serviceManager.get(s.ServiceName.SegmentService).get(this.Cr).getSegment(this.getInitSegmentInfo(this.xr)).then(function(e){return e.read()}).then(function(e){return e.value})},e.prototype.Tr=function(e,t){return this.Sr().then(function(n){var r=f.ModuleManager.get(g.ModuleName.ContainerWebM).WebMSegmentIndex,i=f.ModuleManager.get(g.ModuleName.ContainerWebM).WebMInitFile,o=new r(e),s=new i(n.getData()).segment.segmentInfo,a=function(e,t,n){for(var r=e.cues.flatMap(function(e){return e.cuePoints}),i=new Array(r.length),o=t-function(e){var t=e.cues&&e.cues[0],n=t&&t.cuePoints&&t.cuePoints[0],r=n&&n.trackPositions&&n.trackPositions[0];return r&&r.clusterPosition||0}(e),s=r.length-1;s>=0;s--)i[s]={time:r[s].time,byteRange:{start:o+r[s].trackPositions[0].clusterPosition}},s===r.length-1?i[s].duration=n-i[s].time:(i[s].byteRange.end=i[s+1].byteRange.start-1,i[s].duration=i[s+1].time-i[s].time);return i}(o,parseInt(t.SegmentBase[0]._indexRange.split("-")[1])+1,s.getDuration()/s.getTimecodeScale());return{timescale:s.getTimecodeScale(),references:a}})},e.prototype.Ur=function(e,t){return"webm"===this.Cr.split("/")[1]?this.Tr(e,t):Promise.resolve(this.Vr(e,t.anchorPoint))},e.prototype.Vr=function(e,t){if(!e||!t)return this.context.logger.debug("Error parsing SegmentIndex: Wrong Parameters"),null;var n=f.ModuleManager.get(g.ModuleName.ContainerMP4).parseBuffer(e).boxes.find(function(e){return"sidx"===e.type});return n?{timescale:n.timescale,references:I(n.references,n.first_offset+t,n.earliest_presentation_time)}:(this.context.logger.debug("Error parsing SegmentIndex: No sidx box found"),null)},e}();function I(e,t,n){for(var r=[],i=0,o=e;i<o.length;i++){var s=o[i],a=s.referenced_size,u=s.subsegment_duration,l=t,d=l+a-1;r.push({byteRange:{start:l,end:d},time:n,duration:u}),t+=a,n+=u}return r}t.SegmentBaseMPDHandler=S},12054:function(e,t,n){var r=this&&this.__assign||function(){return r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},r.apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.SegmentTemplateMPDHandler=void 0,t.getTimescaleFromTemplate=f;var i=n(80813),o=n(77179),s=n(89927),a=n(23068),u=n(58313),l=n(16197),d=n(54053),p=n(96693),h=n(4771),c=function(){function e(e,t){this.context=e,this.sourceContext=t,this.settings=e.settings,this.manifestService=e.serviceManager.get(i.ServiceName.ManifestService,t.sourceIdentifier),this.time=0}return e.prototype.getStartNumber=function(){var e=this.getTemplate(this.currentRepresentationId);return e&&e.hasOwnProperty("_startNumber")?parseInt(e._startNumber):1},e.prototype.Xr=function(){var e=this.getTemplate(this.currentRepresentationId);return e&&e._endNumber?parseInt(e._endNumber):NaN},e.prototype.setAdaptationSetId=function(e,t,n){void 0===t&&(t=null),void 0===n&&(n={isManifestUpdate:!1}),this.currentAdaptationSetId=e,this.currentRepresentationId=t;var r=!this.currentRepresentationId||Boolean(this.manifestService.getRepresentationById(this.currentRepresentationId)),i=this.manifestService.getAdaptationSet(this.currentAdaptationSetId);this.currentRepresentationId&&r||(this.currentRepresentationId=i.Representation[0]._internalId),this.getTemplate(this.currentRepresentationId)?this.Wr||this.setIndex(this.getStartNumber()):this.context.logger.debug("No template found in SegmentTemplateMPDHandler."),this.resolvePendingSegmentInfoRequests()},e.prototype.getCurrentPeriod=function(){return this.manifestService.getPeriod(this.currentRepresentationId||this.currentAdaptationSetId)},e.prototype.setRepresentationId=function(e){return!!this.manifestService.getRepresentationById(e)&&(this.currentRepresentationId=e,!0)},e.prototype.getInitSegmentInfo=function(e){var t=this.getTemplate(e),n=this.manifestService.getRepresentationById(e);return(0,p.isInitializationStringNode)(t)?(0,p.provideSegmentInfoFromInitializationProperty)(t,n):null},e.prototype.Yr=function(){var e=this.getTemplate(this.currentRepresentationId);return parseFloat(e._availabilityTimeOffset)||0},e.prototype.Zr=function(e){var t=this.getExpectedPresentationTime(e);return t-=this.Yr(),(0,s.toMilliSeconds)(t+this.getSegmentDuration()+this.settings.LIVE_EDGE_DISTANCE)},e.prototype.getTemplate=function(e){var t=this.manifestService.getRepresentationById(e);if(null==t?void 0:t.SegmentTemplate)return t.SegmentTemplate[0]},e.prototype.ar=function(){var e;return(null===(e=this.getCurrentPeriod())||void 0===e?void 0:e.start)||0},e.prototype.isExpectedSegmentPlaybackTimeExceedingPeriodDuration=function(e){var t=this.Xr();if(isFinite(t))return e>t;var n=this.getCurrentPeriod(),r=Boolean(null==n?void 0:n._duration)?n.start+n.duration:1/0;return this.getExpectedPresentationTime(e)>=r},e.prototype.checkIfSegmentAvailable=function(e){return this.Zr(e)<=Date.now()},e.prototype.getNextSegmentInfo_=function(){var e={isInitSegment:!1,presentationTimeOffset:this.getTimestampOffset()},t=this.getTemplate(this.currentRepresentationId);if(!t||!t._media||!this.manifestService.representationExists(this.currentRepresentationId))return null;if(this.manifestService.isLive()){var n=this.checkIfSegmentAvailable(this.Wr),r=this.isExpectedSegmentPlaybackTimeExceedingPeriodDuration(this.Wr);if(!n||r)return null;e.wallClockTime=this.Zr(this.Wr)-(0,s.toMilliSeconds)(this.getSegmentDuration())}var i=this.manifestService.getRepresentationById(this.currentRepresentationId);return e.periodId=null==i?void 0:i._internalId.periodId,e.url=(0,h.default)(t._media,i,this.Wr,this.time),e.segmentNumber=this.Wr,e.startTime=this.getExpectedPresentationTime(this.Wr),this.setIndex(this.Wr+1),e},e.prototype.getNextSegmentInfo=function(e){var t=this.getNextSegmentInfo_();return t?Promise.resolve(t):this.queueSegmentInfoRequest({time:e})},e.prototype.queueSegmentInfoRequest=function(e){var t=this;return this.pendingSegmentInfoRequest?Promise.reject("fail"):new Promise(function(n,i){t.pendingSegmentInfoRequest=r(r({},e),{resolve:n,reject:i})})},e.prototype.resolvePendingSegmentInfoRequests=function(){if(this.pendingSegmentInfoRequest){var e=this.getNextSegmentInfo_(),t=this.isExpectedSegmentPlaybackTimeExceedingPeriodDuration(this.Wr);e?(this.pendingSegmentInfoRequest.resolve(e),this.pendingSegmentInfoRequest=null):t&&(this.pendingSegmentInfoRequest.reject(d.SegmentInfoError.SEGMENT_EXCEEDING_PERIOD_DURATION),this.pendingSegmentInfoRequest=null)}},e.prototype.getSegmentInfos=function(e){var t=this,n={};return this.manifestService.getAdaptationSet(this.currentRepresentationId).Representation.forEach(function(r){var i,o,s,a=r._internalId,l=t.getTemplate(a),d=[],p=t.getSeekableRange().end-t.getSeekableRange().start,c=0,f=t.manifestService.isLive();f?(s=t.time-p,i=t.Wr-p/t.getSegmentDuration(),o=t.Wr):(s=l._presentationTimeOffset||0,i=0,o=parseInt(i+p/t.getSegmentDuration()));for(var g=i;g<=o;g++){var m={};m.duration=t.getSegmentDuration(),m.startTime=f?t.getExpectedPresentationTime(g):c*t.getSegmentDuration();var v=(0,h.default)(l._media,r,i+c,s+c*t.getSegmentDuration());m.url=e?u.URLHelper.concatBaseUrlWithPartial(e,v):v,m.url=u.URLHelper.appendQueryParametersToUrl(m.url,t.settings.QUERY_PARAMETERS),d.push(m),c++}n[a.representationId]=d}),n},e.prototype.getSubtitleUrl=function(){var e=this.manifestService.getRepresentationById(this.currentRepresentationId).BaseURL[0];return e.url||e},e.prototype.br=function(){var e=this.getTemplate(this.currentRepresentationId);return e&&e.hasOwnProperty("_liveEdgeNumber")},e.prototype.cr=function(){if(this.br()){var e=this.getTemplate(this.currentRepresentationId);return parseInt(e._liveEdgeNumber)}},e.prototype.getSegmentDuration=function(){var e=this.getTemplate(this.currentRepresentationId),t=Number(null==e?void 0:e._duration),n=Number(null==e?void 0:e._timescale);return isNaN(t)?1:isNaN(n)?t:t/n},e.prototype.seekTo=function(e){e>-1&&this.setIndex(this.dr(e))},e.prototype.getTimescale=function(){return f(this.getTemplate(this.currentRepresentationId))},e.prototype.getExpectedPresentationTime=function(e){var t=this.ar();return(e-this.getStartNumber())*this.getSegmentDuration()+t},e.prototype.dr=function(e){var t=this.getSegmentDuration(),n=this.ar(),r=Math.max(e-n-t/2,0);return Math.floor(r/t)+this.getStartNumber()},e.prototype.getActualTimeShiftBufferDepth=function(){var e=this.er();return e.end-e.start},e.prototype.er=function(){var e=(0,o.getStartTimeOffset)(this.fr().getState()),t=this.manifestService.getMediaPresentationDuration()||1/0;return this.manifestService.isLive()?this.hr(t):this.gr(e,t)},e.prototype.fr=function(){return this.context.serviceManager.get(i.ServiceName.SourceStoreService,this.sourceContext.sourceIdentifier)},e.prototype.gr=function(e,t){return{start:e,end:isFinite(t)?e+t:0}},e.prototype.hr=function(e){var t=(this.manifestService.getFirstPeriod()||{start:0}).start,n=-1*this.manifestService.getTimeShiftBufferDepthSeconds(),r=(0,s.toSeconds)(Date.now()-this.manifestService.getAvailabilityStartTime()),i=Math.min(n,r),o=this.getLiveEdgeTime();return{start:Math.max(t,o-i),end:o}},e.prototype.getSeekableRange=function(){var e=this.er();if(this.manifestService.isLive()){var t=this.manifestService.getDesiredDistanceToLiveEdge();e.end=Math.max(e.end-t,e.start)}return e},e.prototype.hasNext=function(e){var t=this.isExpectedSegmentPlaybackTimeExceedingPeriodDuration(this.Wr),n=Math.ceil(e/this.getSegmentDuration())+this.getStartNumber()-1;return!t&&this.Wr<=n},e.prototype.getTimestampOffset=function(){var e=this.getCurrentPeriod(),t=0,n=this.getTemplate(this.currentRepresentationId);return n&&n._presentationTimeOffset&&(t=n._presentationTimeOffset/this.getTimescale()),e&&(t-=e.start),t},e.prototype.ir=function(e,t){var n=this.manifestService.getPeriod(e)||this.getCurrentPeriod();return this.manifestService.isLastPeriod(e.periodId)?n&&(0,a.isNumber)(n.duration)&&isFinite(n.duration)?n.duration:n&&n.start?(0,s.toSeconds)(t)-n.start:this.manifestService.calculateCumulativePeriodDuration(e.periodId):this.manifestService.getPeriodDuration(e.periodId)},e.prototype.jr=function(e){var t=Date.now(),n=(0,s.toSeconds)(t-this.manifestService.getRequestTimestamp());return this.br()?this.cr()+Math.floor(n/this.getSegmentDuration()):this.manifestService.isLive()&&Boolean(this.manifestService.getManifest()._availabilityStartTime)?Math.floor(this.ir(e,t)/this.getSegmentDuration()+this.getStartNumber()):this.getStartNumber()},e.prototype.kr=function(e){return Math.max(this.jr(e),this.getStartNumber())},e.prototype.getIndex=function(){return this.Wr},e.prototype.setIndex=function(e){this.Wr=e},e.prototype.getLiveEdgeTime=function(){return(0,s.toSeconds)(Date.now())},e.prototype.timeShift=function(e,t){if(void 0===t&&(t=this.currentRepresentationId.periodId),this.manifestService.isLive()){var n=this.Wr,r=this.kr(new l.PeriodId(t));0===e?(this.setIndex(r),this.context.logger.debug("timeShift changes index from "+n+" to "+this.Wr+" [back to live edge]")):(this.setIndex(r+Math.floor(e/this.getSegmentDuration())),this.Wr<this.getStartNumber()&&this.setIndex(this.getStartNumber()),this.context.logger.debug("timeShift changes index from "+n+" to "+this.Wr))}},e.prototype.updateRepresentation=function(e){return this.currentRepresentationId=e,Promise.resolve(e)},e.prototype.isSegmentInfoLoaded=function(e){return!0},e.prototype.rewindOneSegment=function(){return this.setIndex(this.Wr-1),this.Wr<this.getStartNumber()&&(this.context.logger.debug("Template number is smaller than start number, probably a discontinuity. Using start number."),this.setIndex(this.getStartNumber())),!0},e.prototype.getPendingSegmentInfoRequest=function(){return this.pendingSegmentInfoRequest},e.prototype.setPendingSegmentInfoRequest=function(e){this.pendingSegmentInfoRequest=e},e.prototype.canSwitchRepresentation=function(e){return!0},e.prototype.getLatestTimeForPossibleSwitch=function(e){return e},e.prototype.adjustTimeToNextSegmentStart=function(e){return e},e.prototype.dispose=function(){this.settings=null,this.manifestService=null,this.currentRepresentationId=null,this.currentAdaptationSetId=null,this.pendingSegmentInfoRequest=null},e.prototype.setTimestampOffset=function(e,t){},e}();function f(e){return e&&null!=e._timescale&&parseInt(e._timescale)||1}t.SegmentTemplateMPDHandler=c},31439:function(e,t,n){var r=this&&this.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),i=this&&this.__assign||function(){return i=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},i.apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.SegmentTimelineMPDHandler=void 0;var o=n(74853),s=n(89927),a=n(58313),u=n(54053),l=n(4771),d=n(12054),p=n(39761),h=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.lr=0,r.mr=null,r.nr=[],r.ys=!0,r.Cs=!1,r.zs=1,r.As=0,r.Bs=0,r}return r(t,e),t.prototype.setAdaptationSetId=function(t,n,r){void 0===n&&(n=null),void 0===r&&(r={isPeriodSwitch:!1,isManifestUpdate:!1}),this.currentAdaptationSetId=t,this.currentRepresentationId=n;var i=!this.currentRepresentationId||Boolean(this.manifestService.getRepresentationById(this.currentRepresentationId)),o=this.manifestService.getAdaptationSet(this.currentAdaptationSetId);this.currentRepresentationId&&i||(this.currentRepresentationId=o.Representation[0]._internalId);var s=this.getTemplate(this.currentRepresentationId);s?(this.setTimeline(s,r.isPeriodSwitch),this.getIndex()||e.prototype.setIndex.call(this,this.getStartNumber())):this.context.logger.debug("No template found in SegmentTemplateMPDHandler."),this.resolvePendingSegmentInfoRequests()},t.prototype.setRepresentationId=function(e){if(this.manifestService.getRepresentationById(e)){this.currentRepresentationId=e;var t=this.getTemplate(this.currentRepresentationId);return t&&this.setTimeline(t),!0}return!1},t.prototype.Ds=function(e){return null!=(null==e?void 0:e.start)&&isFinite(e.start)?e.start:0},t.prototype.Es=function(){this.manifestService.isLive()&&this.ys&&(this.Cs||this.timeShift(0),this.ys=!1)},t.prototype.Fs=function(e){return!(null==e?void 0:e._media)||!this.manifestService.representationExists(this.currentRepresentationId)},t.prototype.Gs=function(e){var t=this.nr[this.lr];t&&(e.wallClockTime=(0,s.toMilliSeconds)(t.ot/this.zs-this.getTimestampOffset()))},t.prototype.getNextSegmentInfo_=function(){var t,n,r={isInitSegment:!1,presentationTimeOffset:this.getTimestampOffset()},i=this.getTemplate(this.currentRepresentationId);if(this.Fs(i))return null;if(this.Es(),!(this.nr.length>0&&this.lr<this.nr.length))return null;var o=this.nr[this.lr];e.prototype.setIndex.call(this,o.i),this.time=o.ot,r.duration=o.duration,r.mediaPresentationTime=o.t,r.segmentNumber=o.i;var s=null!==(n=null===(t=this.getCurrentPeriod())||void 0===t?void 0:t.start)&&void 0!==n?n:0;if(r.startTime=o.playbackTime+s,this.manifestService.isLive()){if(this.isExpectedSegmentPlaybackTimeExceedingPeriodDuration(this.lr))return null;this.Gs(r)}var a=this.manifestService.getRepresentationById(this.currentRepresentationId);return a?(r.periodId=null==a?void 0:a._internalId.periodId,r.url=(0,l.default)(i._media,a,this.getIndex(),this.time),e.prototype.setIndex.call(this,this.getIndex()+1),this.lr++,r):null},t.prototype.getNextSegmentInfo=function(e){var t=this.getNextSegmentInfo_();return t?Promise.resolve(t):this.queueSegmentInfoRequest({time:e})},t.prototype.queueSegmentInfoRequest=function(e){var t=this;return this.pendingSegmentInfoRequest?Promise.reject("fail"):new Promise(function(n,r){t.pendingSegmentInfoRequest=i(i({},e),{resolve:n,reject:r})})},t.prototype.resolvePendingSegmentInfoRequests=function(){if(this.pendingSegmentInfoRequest){var e=this.getNextSegmentInfo_();if(e)this.pendingSegmentInfoRequest.resolve(e),this.pendingSegmentInfoRequest=null;else if(!this.manifestService.isSmoothManifest()){var t=this.getCurrentPeriod();if(isFinite(t.duration)){var n=this.getTimelineDuration(),r=n/this.getTimelineLength(),i=t.start+n,o=t.duration-r/2;isFinite(o)&&i>=o&&(this.pendingSegmentInfoRequest.reject(u.SegmentInfoError.PERIOD_COMPLETE),this.pendingSegmentInfoRequest=null)}}}},t.prototype.getSegmentInfos=function(e){var t=this,n={};return this.manifestService.getAdaptationSet(this.currentRepresentationId).Representation.forEach(function(r){for(var i=r._internalId,o=t.getTemplate(i),s=[],u=t.manifestService.isLive(),d=t.getTimelineLength(),p=0,h=0;h<d;h++){var c=t.nr[h],f={};f.duration=c.duration,u?f.startTime=t.getExpectedPresentationTime(h):(f.startTime=p,p+=c.duration);var g=(0,l.default)(o._media,r,c.i,c.ot);f.url=e?a.URLHelper.concatBaseUrlWithPartial(e,g):g,f.url=a.URLHelper.appendQueryParametersToUrl(f.url,t.settings.QUERY_PARAMETERS),s.push(f)}n[i.representationId]=s}),n},t.prototype.getSubtitleUrl=function(){var e=this.manifestService.getRepresentationById(this.currentRepresentationId).BaseURL[0];return e.url||e},t.prototype.getSegmentDuration=function(){return this.getSegmentDurationCurrentElement()},t.prototype.seekTo=function(t){if(t>-1){var n=this.Ds(this.getCurrentPeriod());this.Cs=!1,isFinite(n)&&(t-=n);for(var r=1;r<this.nr.length;r++)if(this.nr[r].playbackTime>t)return this.lr=r-1,e.prototype.setIndex.call(this,this.nr[this.lr].i),this.ys=!1,this.getIndex();this.lr=Math.max(this.nr.length-1,0)}return e.prototype.setIndex.call(this,this.nr[this.lr].i),this.getIndex()},t.prototype.getExpectedPresentationTime=function(e){var t,n;return(null!==(n=null===(t=this.getCurrentPeriod())||void 0===t?void 0:t.start)&&void 0!==n?n:0)+this.nr[e].playbackTime},t.prototype.hasNext=function(e){if(this.lr<this.nr.length){var t=this.nr[0].t,n=this.nr[this.lr];if(this.isExpectedSegmentPlaybackTimeExceedingPeriodDuration(this.lr))return!1;if(n)return n.t-t<=e*this.zs}return!1},t.prototype.getTimestampOffset=function(){var e=this.getCurrentPeriod(),t=this.As/this.zs;return e&&(t-=e.start),t},t.prototype.setIndex=function(t){if(e.prototype.setIndex.call(this,t),this.nr&&this.nr.length>0)for(var n=0;n<this.nr.length;n++)this.nr[n].i===t&&(this.lr=n)},t.prototype.getLiveEdgeTime=function(){if(!this.manifestService.isLive())return-1;var t=this.manifestService.getLastPeriod(),n=this.getCurrentPeriod();if(null==t||(null==n?void 0:n._id)===t._id)return this.Ds(n)+this.Hs()/this.zs;var r=(0,p.getFirstAvSegmentTemplateFromPeriod)(t);return(null==r?void 0:r.SegmentTimeline)?this.Ds(t)+(0,p.calculateTimelineEnd)(r):e.prototype.getLiveEdgeTime.call(this)},t.prototype.Hs=function(){if(!this.nr.length)return 0;var e=this.nr[this.nr.length-1];return e.t+e.d},t.prototype.timeShift=function(t,n){if(this.manifestService.isLive()&&!(this.nr.length<1)){this.Cs=!1;for(var r=this.nr[0].t,i=this.Hs(),o=t*this.zs,s=Math.max(this.Bs,this.settings.MIN_TIMELINE_LIVE_OFFSET)*this.zs,a=Math.max(r+s,i+o),u=this.nr.length-1;u>=0;u--)if(this.nr[u].t<=a){this.lr=u;break}(this.lr>=this.nr.length||this.lr<=0)&&(this.context.logger.debug("timeline index ran out of bounds on timeShift, falling back to 0"),this.lr=0),this.context.logger.debug("timeShift changes index to "+this.lr),this.ys=!1,e.prototype.setIndex.call(this,this.nr[this.lr].i)}},t.prototype.updateRepresentation=function(e){return this.currentRepresentationId=e,Promise.resolve(e)},t.prototype.isSegmentInfoLoaded=function(e){return!0},t.prototype.rewindOneSegment=function(){return this.lr--,this.lr<0&&(this.context.logger.debug("Timeline array index is smaller than 0, probably a discontinuity. Using 0."),this.lr=0),!0},t.prototype.Is=function(e,t){for(var n,r={entries:[],latestTime:0,latestOriginalTime:0,lastPreviousTimelineEntryIndex:0,index:this.getStartNumber()},i=0,o=0,s=0,a=e;s<a.length;s++)for(var u=0,l=null!==(n=a[s].S)&&void 0!==n?n:[];u<l.length;u++){var d=l[u],h=(0,p.parseStringToNumber)(d._r),f=parseInt(d._d);if(d.hasOwnProperty("_t")){var g=(0,p.parseStringToNumber)(d._t);r.latestOriginalTime=g,r.latestTime=g-this.As}for(;r.latestTime+f<=0&&h>=0;)this.context.logger.debug("Negative timeline entry detected, discarding segment. Time: ".concat(r.latestTime,", presentationTimeOffset: ").concat(this.As,".")),r.latestTime+=f,r.latestOriginalTime+=f,h--;for(var m=this.Ls(r,t,f,h),v=0;v<m.length;v++)m[v].i=r.index+v;i+=m.length,c(r,m,f);var y=h-m.length+1;o+=y,c(r,this.Ks(r,y,f),f)}return this.Js(i,o),r.entries},t.prototype.Js=function(e,t){var n;this.context.logger.debug("[SegmentTimeline][".concat(null===(n=this.currentRepresentationId)||void 0===n?void 0:n.representationId,"] Re-using ").concat(e," entries, adding ").concat(t," new entries"))},t.prototype.Ks=function(e,t,n){for(var r=[],i=0;i<t;i++){var o=e.latestTime+n*i,s={d:n,t:o,ot:e.latestOriginalTime+n*i,i:e.index+i,playbackTime:o/this.zs,duration:n/this.zs};r.push(s)}return r},t.prototype.Ls=function(e,t,n,r){var i=(0,o.findIndexWithin)(t,e.lastPreviousTimelineEntryIndex,t.length,function(t){return t.t===e.latestTime&&t.d===n});if(-1===i)return[];var s=function(e,t,n,r){for(var i=e[t].t,o=r;o>0;o--){var s=t+o,a=e[s],u=i+n*o;if(a&&a.t===u&&a.d===n)return s}return t}(t,i,n,r);return e.lastPreviousTimelineEntryIndex=s,t.slice(i,s+1)},t.prototype.getTimelineDuration=function(){var e=this;return this.nr&&this.nr.length>0&&isFinite(this.zs)?this.nr.reduce(function(t,n){return t+n.d/e.zs},0):0},t.prototype.getTimelineLength=function(){return this.nr?this.nr.length:0},t.prototype.setTimeline=function(e,t){void 0===t&&(t=!1);var n=e.SegmentTimeline;if(this.Cs=this.Cs||Boolean(t),n&&this.mr!==n){this.mr=n;var r=this.Ms(),i=this.getTimescale();this.zs=i,this.As=parseFloat(String(e._presentationTimeOffset))||0;var o=this.Is(n,this.nr);o.length>0&&(this.Bs=o[0].d/i),this.Ns(o,i,r),this.nr=o}},t.prototype.Ms=function(){return this.nr&&this.nr.length>0?this.zs:this.getTimescale()},t.prototype.Ns=function(t,n,r){var i,o=!1;if(this.nr&&this.nr.length>0?i=(o=this.lr>=this.nr.length)?this.nr[this.nr.length-1]:this.nr[this.lr]:(this.lr=0,e.prototype.setIndex.call(this,0)),i)for(var s=t.length-1;s>=0;s--)if(m(t[s],n,i,r)){this.lr=s+(o?1:0),e.prototype.setIndex.call(this,t[s].i+(o?1:0));break}},t.prototype.getSegmentDurationCurrentElement=function(){var e=this.nr[this.lr];return e?e.d/this.zs:1},t.prototype.dispose=function(){this.settings=null,this.nr=[]},t}(d.SegmentTemplateMPDHandler);function c(e,t,n){var r;(r=e.entries).push.apply(r,t),e.latestTime+=n*t.length,e.latestOriginalTime+=n*t.length,e.index+=t.length}t.SegmentTimelineMPDHandler=h;var f=Math.pow(10,8);function g(e){return Math.round(e*f)/f}function m(e,t,n,r){var i=g(e.t/t),o=g(i+e.d/t),s=g(n.t/r);return i<=s&&s<o}},4771:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,n,i){var o=e.match(/(\$((RepresentationID)|(Bandwidth)|(Time)|(Number(%([\d]*[A-Za-z]))?)|())\$)/g),s=null!=n,a=t.hasOwnProperty("_bandwidth"),u=null!=i;function l(e){if(0===e.indexOf("Number")&&s){if(e.indexOf("%")>-1){var r=function(e){var t=parseInt(e.substring(0,e.length-1)),n=e[e.length-1].toLowerCase(),r=0!==e[e.length-1].indexOf(n);return[0===n.indexOf("o")?8:0===n.indexOf("x")?16:(n.indexOf("d"),10),t,r]}(e.substring(e.indexOf("%")+1)),o=r[0],l=r[1],d=r[2];return function(e,t){for(;e.length<t;)e="0"+e;return e}(function(e,t){return t?e.toUpperCase():e.toLowerCase()}(n.toString(o),d),l)}return String(n)}return 0===e.indexOf("RepresentationID")?t._internalId.representationId:0===e.indexOf("Bandwidth")&&a?String(t._bandwidth):0===e.indexOf("Time")&&u?String(i):""===e?"$":void 0}var d=[].concat(o).filter(function(e){return e}).map(function(e){return e.substring(1,e.length-1)}).map(function(e){return[e,l(e)]}).filter(function(e){return e[1].length>0}).reduce(function(e,t){var n=t[0],r=t[1];return e.replace("$".concat(n,"$"),r)},e);return(0,r.forceReallocation)(d)};var r=n(20649)},39761:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.getFirstAvSegmentTemplateFromPeriod=function(e){var t,n=e.AdaptationSet.find(function(e){return r.MimeTypeHelper.isAV(e._mimeType)}),i=null===(t=null==n?void 0:n.Representation[0])||void 0===t?void 0:t.SegmentTemplate;return null==i?void 0:i[0]},t.calculateTimelineEnd=function(e){for(var t,n,r=parseFloat(String(e._presentationTimeOffset))||0,s=(0,i.getTimescaleFromTemplate)(e),a=0,u=0,l=null!==(t=e.SegmentTimeline)&&void 0!==t?t:[];u<l.length;u++)for(var d=0,p=null!==(n=l[u].S)&&void 0!==n?n:[];d<p.length;d++){var h=p[d],c=o(h._r),f=parseInt(h._d);h.hasOwnProperty("_t")&&(a=Math.max(0,o(h._t)-r)),a+=f*(c+1)}return a/s},t.parseStringToNumber=o;var r=n(85434),i=n(12054);function o(e,t){return void 0===t&&(t=0),e?parseInt(e):t}}},function(e){return function(){return e(66759)}()}])});
18
18
  })();
@@ -9,10 +9,10 @@
9
9
  * This software includes open-source components. See THIRD_PARTY_NOTICES
10
10
  * in the distribution for details.
11
11
  *
12
- * Bitmovin Player Version 8.280.0
12
+ * Bitmovin Player Version 8.281.0
13
13
  *
14
14
  ****************************************************************************/
15
15
 
16
16
  (function() {
17
- "use strict";!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.dash=t():(e.bitmovin=e.bitmovin||{},e.bitmovin.player=e.bitmovin.player||{},e.bitmovin.player.dash=t())}(self,function(){return(self.webpackChunkbitmovin_player=self.webpackChunkbitmovin_player||[]).push([[367],{96693:function(e,t,n){var i=this&&this.__assign||function(){return i=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},i.apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.isInitializationStringNode=function(e){return(0,r.isObject)(e)&&null!=e._initialization},t.isInitializationNode=function(e){return(0,r.isObject)(e)&&Array.isArray(e.Initialization)&&e.Initialization.length>0},t.isIndexRangeNode=function(e){return(0,r.isObject)(e)&&null!=e._indexRange},t.provideSegmentInfoFromInitializationProperty=function(e,t){var n=(0,a.default)(e._initialization,t),r=o.URLHelper.concatBaseUrlWithPartial(l(t),n);return i(i({},(0,s.createInitSegmentInfoBase)(t)),{url:r,mediaURL:n})},t.extractBaseUrlFromRepresentation=l,t.provideSegmentInfoFromInitializationNodeProperty=function(e,t){var n=e.Initialization[0],r=function(e,t){return e._sourceURL?e._sourceURL:l(t)}(n,t),a=o.URLHelper.concatBaseUrlWithPartial(l(t),r),u=function(e){var t,n,i=null!==(n=null===(t=e._range)||void 0===t?void 0:t.split("-").map(function(e){return parseInt(e)}))&&void 0!==n?n:[];return i.length>1?{start:i[0],end:i[1]}:null}(n);return i(i({},(0,s.createInitSegmentInfoBase)(t)),{url:a,mediaURL:r,byteRange:u})},t.provideSegmentInfoFromIndexRangeProperty=function(e,t){var n=l(t),r={start:0,end:parseInt(e._indexRange.split("-")[0])-1};return i(i({},(0,s.createInitSegmentInfoBase)(t)),{url:n,mediaURL:n,byteRange:r})};var r=n(94685),o=n(58313),s=n(65439),a=n(4771);function l(e){return e.BaseURL?o.URLHelper.urlObjectToString(e.BaseURL[0]):""}},44908:function(e,t,n){var i=this&&this.__assign||function(){return i=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},i.apply(this,arguments)},r=this&&this.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var i,r=0,o=t.length;r<o;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.MPDLoader=void 0;var o=n(40306),s=n(3336),a=n(80813),l=n(3714),u=n(4129),p=n(85625),h=n(77401),m=n(57456),d=n(29669),c=n(91678),f=n(33436),g=n(89927),v=n(58313),y=n(78340),S=function(){function e(e,t){var n=this;this.El=0,this.Ml=function(e){return e.body?n.Nl(e):(n.Cl.load(null,null).catch(function(){}),null)},this.Ol=function(e,t){n.Fl=function(e,t,n){if((null==t?void 0:t.name)===h.RequestError.Canceled)return null;if((null==t?void 0:t.name)===h.RequestError.TimedOut)return new s.PlayerError(o.ErrorCode.NETWORK_MANIFEST_DOWNLOAD_TIMEOUT,R(e),"Failed to load DASH manifest: the request timed out.",n);var i=(null==e?void 0:e.status)===XMLHttpRequest.UNSENT?"Failed to load the DASH manifest due to CORS restrictions or because the client is offline.":"Failed to load DASH manifest: ".concat(e.status," ").concat(e.statusText,".");return new s.PlayerError(o.ErrorCode.SOURCE_COULD_NOT_LOAD_MANIFEST,R(e),i,n)}(e,t,n.xl.sourceIdentifier)},this.wl=e,this.xl=t,this.Dl=e.settings,this.zl=new y.MPDParser(e,t),this.yl=!1,this.Gl=e.eventHandler,this.Bl=[];var i={onFailure:this.Ol,maxRetries:this.Dl.MAX_MPD_RETRIES,requestType:d.HttpRequestType.MANIFEST_DASH,resetRetriesWhenOffline:!1};this.Cl=new u.DefaultContentLoader(e,i)}return e.prototype.Hl=function(e,t){if(this.yl)return null;var n=e.trim();return this.Il(n,t)},e.prototype.Il=function(e,t){var n,i=this.wl.serviceManager.get(a.ServiceName.ManifestCachingService),o=null!==(n=null==i?void 0:i.getParsedManifest(this.Al))&&void 0!==n?n:this.Jl(e,t);return o?(I(o)||null==i||i.cacheParsedManifest(o,this.Al),this.Bl=o.BaseURL?r(r([],o.Location,!0),o.BaseURL.map(function(e){return e.url}),!0):o.Location,this.Al=this.Bl[0],o):null},e.prototype.Jl=function(e,t){return this.zl.parse(e,this.Al,t)},e.prototype.Kl=function(){this.Cl&&this.Cl.cancel(),this.yl=!0,this.Al=null},e.prototype.dispose=function(){this.Kl(),this.Cl.dispose(),this.zl&&(this.zl.dispose(),this.zl=null),this.Dl=null},e.prototype.load=function(e){var t=this;this.Al=null!=e?e:this.Al;var n=this.Al;return this.Fl=null,e&&(this.yl=!1),n?this.Ll(n).then(function(e){return t.Ml(e)}).then(function(e){return t.Al!==n&&t.Bl.includes(t.Al)&&t.wl.eventHandler.dispatchEvent(l.PlayerEvent.ContentLocationChanged,{sourceLocationId:n,targetLocationId:t.Al,reason:l.ContentLocationChangedReason.Failover}),e}).catch(function(e){return t.yl||(null==e?void 0:e.message)===h.RequestError.Canceled?Promise.reject():Promise.reject(e)}):(this.wl.eventHandler.fireError(new s.PlayerError(o.ErrorCode.SOURCE_INVALID,void 0,"Cannot load the manifest: no URL was provided.",this.xl.sourceIdentifier)),Promise.reject("No manifest url provided"))},e.prototype.Ll=function(e){var t,n=this,i=this.wl.serviceManager.maybeCall(a.ServiceName.ManifestCachingService,function(t){return t.getHttpResponse(e)});if(i)return Promise.resolve(i);var r=null===(t=this.xl.source.options)||void 0===t?void 0:t.manifestWithCredentials;return this.Cl.load(e,d.HttpRequestMethod.GET,null,null,null,r,p.ManifestMimeType.Dash).catch(function(e){return n.El++,n.El<n.Bl.length?(n.Al=v.URLHelper.replaceCdn(n.Al,n.Bl[n.El]),n.Ll(n.Al)):(n.Fl&&n.Gl.fireError(n.Fl),n.Fl=null,Promise.reject(e))})},e.prototype.updateRepresentation=function(e){return Promise.resolve(e)},e.prototype.stopRepresentationUpdate=function(e){return Promise.resolve()},e.prototype.Nl=function(e){var t,n,r,o=null!==(t=e.elapsedTime)&&void 0!==t?t:0;(0,m.isDownloadTimeInformationValid)(e)&&this.wl.store.dispatch((0,c.addMetricsValue)("default",f.MetricType.DownloadInformation,{bytes:e.length,time:o,timeToFirstByte:e.timeToFirstByte})),this.Al=e.url;var s=i({},this.Hl(e.body,(0,g.toSeconds)(Math.round(o))));return s._currentLoadingUrl=this.Al,I(s)?!0===(null===(r=null===(n=this.wl)||void 0===n?void 0:n.settings)||void 0===r?void 0:r.INFINITE_RETRIES_FOR_LIVE)&&this.Cl.setResetRetriesWhenOffline(!0):this.wl.serviceManager.maybeCall(a.ServiceName.ManifestCachingService,function(t){return t.cacheHttpResponse(e,e.url)}),s},e}();function R(e){return{url:e.url,statusCode:e.status,statusText:e.statusText}}function I(e){return"dynamic"===(null==e?void 0:e._type)}t.MPDLoader=S},78340:function(e,t,n){var i=this&&this.__assign||function(){return i=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},i.apply(this,arguments)},r=this&&this.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var i,r=0,o=t.length;r<o;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.BaseURL=t.MPDParser=void 0,t.mergeCommonAttributes=_,t.parseFraction=T;var o=n(25926),s=n(4224),a=n(3714),l=n(20213),u=n(44468),p=n(34047),h=n(52424),m=n(21216),d=n(68922),c=n(85434),f=n(58313),g=n(88052),v=n(62756),y=n(92778),S=new RegExp("_(.*:)?label","i"),R=["__text","_byteRange","_serviceLocation","_availabilityTimeOffset","_availabilityTimeComplete"],I=function(){function e(e,t){this.GR=e,this.HR=t,this.IR=e.renderer;var n=g.ModuleManager.get(v.ModuleName.XML);this.JR=n.parseXML,this.KR=n.parseJSONtoXML}return e.prototype.LR=function(e,t){return(0,d.applyLabeling)({source:this.HR.source,context:this.GR,streamType:u.StreamType.Dash,labelingType:e},t)},e.prototype.MR=function(e){var t,n,i,r=null!==(i=null===(n=null===(t=e.Label)||void 0===t?void 0:t[0])||void 0===n?void 0:n.value)&&void 0!==i?i:e._label,o={mimeType:e._mimeType,lang:e._lang};return this.LR(d.LabelingType.Tracks,o)||r},e.prototype.NR=function(e,t){var n,i,r,o=null!==(r=null===(i=null===(n=t.Label)||void 0===n?void 0:n[0])||void 0===i?void 0:i.value)&&void 0!==r?r:t._label,s={id:t._id,mimeType:e,bitrate:t._bandwidth,qualityRanking:t._qualityRanking,width:t._width,height:t._height,frameRate:t._framerate};return this.LR(d.LabelingType.Qualities,s)||o},e.prototype.OR=function(e){var t,n=this,i=0;for(var r in e)if(e.hasOwnProperty(r)){if("Accessibility"===r&&this.PR(e,e[r]),"EssentialProperty"===r&&x(e[r]))return null;"Label"===r&&(e.Label=U(e[r])),"SegmentTemplate"===r&&this.QR(e[r]),"SegmentList"===r&&this.RR(e[r]),"SegmentTemplate"===r||0===r.indexOf("_")||Array.isArray(e[r])||(e[r]=[e[r]]),"Representation"===r&&(e[r]=e[r].filter(function(t){var r,o,s=t._mimeType||e._mimeType;if(t._mimeType=t._mimeType||e._mimeType,s&&(s=s.toLowerCase()),"AudioChannelConfiguration"in e){var a=e.AudioChannelConfiguration;null!==(r=(o=t).AudioChannelConfiguration)&&void 0!==r||(o.AudioChannelConfiguration=a)}_(t,e),b(t),L(t,e),"string"==typeof t._bandwidth&&(t._bandwidth=parseFloat(t._bandwidth)),t.Label&&(t.Label=U(t.Label)),t.SegmentTemplate&&n.QR(t.SegmentTemplate),t.SegmentList&&n.RR(t.SegmentList);var l=t._codecs||e._codecs;if(s&&(0===s.indexOf("application")||0===s.indexOf("text")||0===s.indexOf("image")||s.indexOf("mp2t")>=0))i++,t._label=n.NR(s,t);else if(s&&l){if(t._codecs=l,!p.CodecStringHelper.isSupportedByRenderer(n.IR,s,l))return!1;i++,t._label=n.NR(s,t)}return!0}))}if(i>0){if(!e._mimeType){var o=null===(t=e.Representation.find(function(e){return e._mimeType}))||void 0===t?void 0:t._mimeType;o&&(e._mimeType=o)}return e._label=this.MR(e),e.Representation.sort(function(e,t){return e._bandwidth-t._bandwidth}),e}return null},e.prototype.PR=function(t,n){t.ClosedCaptionLabels={};for(var i=e.filterAccessibilityTagsByScheme(n,"urn:scte:dash:cc:cea-608:2015"),r=e.extractLabelGroups(i),o=0;o<r.length;o++){var s=r[o],a=s.split("="),l=2===a.length?[a[0],a[1]]:["CC"+o,s],u=l[0],p=l[1];t.ClosedCaptionLabels[u]={label:p,lang:p}}},e.prototype.QR=function(e){for(var t,n,i=0,r=e;i<r.length;i++){var o=r[i];if(o.hasOwnProperty("SegmentTimeline"))for(var s=Number(null!==(t=o._timescale)&&void 0!==t?t:"1"),a=0,l=null!==(n=o.SegmentTimeline)&&void 0!==n?n:[];a<l.length;a++){var u=l[a];u.totalDuration=P(u,s)}}},e.prototype.RR=function(e){for(var t,n,i,r,o,s,a=0,l=e;a<l.length;a++){var u=l[a];if(u.hasOwnProperty("SegmentTimeline")){for(var p=Number(null!==(t=u._timescale)&&void 0!==t?t:"1"),h=0,m=null!==(n=u.SegmentTimeline)&&void 0!==n?n:[];h<m.length;h++){var d=m[h];d.totalDuration=P(d,p)}u.totalDuration=null!==(o=null===(r=null===(i=u.SegmentTimeline)||void 0===i?void 0:i[0])||void 0===r?void 0:r.totalDuration)&&void 0!==o?o:0}else if(u.hasOwnProperty("_duration")&&u.hasOwnProperty("SegmentURL")){p=Number(null!==(s=u._timescale)&&void 0!==s?s:"1");var c=Number(u._duration)/p;u.totalDuration=c*u.SegmentURL.length}}},e.filterAccessibilityTagsByScheme=function(e,t){return e&&e.length>0?e.filter(function(e){return e._schemeIdUri===t}):[]},e.extractLabelGroups=function(e){for(var t=[],n=0,i=e;n<i.length;n++){var r=i[n];if(r._value){var o=r._value.split(";");t.push.apply(t,o)}}return t},e.prototype.SR=function(e,t){for(var n=0;n<e.length;n++)if("string"==typeof t&&e[n].url===t||"object"==typeof t&&e[n].url===t.url)return!0;return!1},e.prototype.TR=function(e,t,n,i){var r;Array.isArray(e.BaseURL)||(e.BaseURL=[e.BaseURL]);for(var o=[],s=0;s<e.BaseURL.length;s++){if((r=new O).customAttributes=[],null!=t&&(r.parentIds={},void 0!==t[0]&&null!==t[0]&&(r.parentIds.PeriodID=t[0]),void 0!==t[1]&&null!==t[1]&&(r.parentIds.AdaptationSetID=t[1]),void 0!==t[2]&&null!==t[2]&&(r.parentIds.RepresentationID=t[2])),"string"==typeof e.BaseURL[s])r.url=e.BaseURL[s];else if("object"==typeof e.BaseURL[s])for(var a in e.BaseURL[s].hasOwnProperty("__text")&&(r.url=e.BaseURL[s].__text),e.BaseURL[s].hasOwnProperty("_serviceLocation")&&(r.serviceLocation=e.BaseURL[s]._serviceLocation),e.BaseURL[s].hasOwnProperty("_byteRange")&&(r.serviceLocation=e.BaseURL[s]._byteRange),e.BaseURL[s].hasOwnProperty("_availabilityTimeOffset")&&(r.serviceLocation=e.BaseURL[s]._availabilityTimeOffset),e.BaseURL[s].hasOwnProperty("_availabilityTimeComplete")&&(r.serviceLocation=e.BaseURL[s]._availabilityTimeComplete),e.BaseURL[s])if(e.BaseURL[s].hasOwnProperty(a)&&0===a.indexOf("_")&&-1===R.indexOf(a)){var l={};l[a.substring(1)]=e.BaseURL[s][a],r.customAttributes.push(l)}o.push(r)}for(e.BaseURL=[],s=0;s<o.length;s++){var u=o[s];if(f.URLHelper.isUrlAbsolute(u))this.SR(e.BaseURL,u)||(u.isAbsolute=!0,i.push(u),e.BaseURL.push(u));else for(var p=0;p<n.length;p++){var h=n[p].toString();"/"!==n[p].url[n[p].url.length-1]&&(h+="/");var m=f.URLHelper.concatUrlParts(h,u);this.SR(e.BaseURL,m)||((r=new O).url=m,r.parentIds={},void 0!==t[0]&&null!==t[0]&&(r.parentIds.PeriodID=t[0]),void 0!==t[1]&&null!==t[1]&&(r.parentIds.AdaptationSetID=t[1]),void 0!==t[2]&&null!==t[2]&&(r.parentIds.RepresentationID=t[2]),r.serviceLocation=u.serviceLocation||n[p].serviceLocation,r.byteRange=u.byteRange||n[p].byteRange,r.availabilityTimeOffset=u.availabilityTimeOffset||n[p].availabilityTimeOffset,r.availabilityTimeComplete=u.availabilityTimeComplete||n[p].availabilityTimeComplete,e.BaseURL.push(r),i.push(r))}}return i},e.prototype.UR=function(e,t,n){var i=[];if(t=t||[],n=n||[],"object"!=typeof e)return e;for(var r in e.hasOwnProperty("BaseURL")&&(i=this.TR(e,n,t,i)),i.length<1&&(i=t),e)if(e.hasOwnProperty(r))if("object"==typeof e[r]&&0!==r.indexOf("_")){Array.isArray(e[r])||(e[r]=[e[r]]);for(var o=0;o<e[r].length;o++)if("BaseURL"!==r){var s=e[r][o]._id||o+"";e[r][o]=this.UR(e[r][o],i,n.concat([s])),"Representation"!==r||e[r][o].hasOwnProperty("BaseURL")||(e[r][o].BaseURL=i)}}else 0!==r.indexOf("_")||!S.test(r)&&"_streamName"!==r||(e._label=e[r],"_label"!==r&&delete e[r]);return e},e.prototype.VR=function(e){var t=h.DurationConverter.getDurationInSec(e._timeShiftBufferDepth);return(t=isNaN(t)?Number.NEGATIVE_INFINITY:-t)>0&&t<this.GR.bufferSettings.getForwardTargetLevel()&&(t=this.GR.bufferSettings.getForwardTargetLevel()),t},e.ensureObjectArray=function(e){return null==e?[]:(Array.isArray(e)?e:[e]).filter(function(e){return"object"==typeof e&&null!==e})},e.fillInMissingIds=function(t){t.Period=e.ensureObjectArray(t.Period);for(var n=[],i=[],r=0,o=t.Period;r<o.length;r++){(p=o[r]).AdaptationSet=e.ensureObjectArray(p.AdaptationSet);for(var s=0,a=p.AdaptationSet;s<a.length;s++)(d=a[s]).Representation=e.ensureObjectArray(d.Representation),n.push(d),i.push.apply(i,d.Representation)}e.assignMissingIds(t.Period),e.assignMissingIds(n),e.assignMissingIds(i);for(var l=0,u=t.Period;l<u.length;l++)for(var p,h=0,m=(p=u[l]).AdaptationSet;h<m.length;h++){var d;(d=m[h])._periodId=p._id}},e.assignMissingIds=function(e){for(var t=e.map(function(e){return e._id}).filter(function(e){return Boolean(e)}),n=0,i=0,r=e;i<r.length;i++){var o=r[i];if(!o._id){do{n++}while(t.includes(""+n));o._id=""+n,t.push(o._id)}}},e.prototype.WR=function(e){return"dynamic"===e._type&&(e._timeShiftBufferDepth=this.VR(e)),e},e.prototype.XR=function(e){return e._publishTime&&(e._publishTime=new Date(e._publishTime).getTime()),e},e.prototype.YR=function(e,t){return e.hasOwnProperty("Location")?Array.isArray(e.Location)||(e.Location=[e.Location]):e.Location=[t],e},e.prototype.ZR=function(e){e.hasOwnProperty("BaseURL")&&!Array.isArray(e.BaseURL)&&(e.BaseURL=[e.BaseURL]);for(var t=[],n=0;n<e.Location.length;n++){var i=e.Location[n],r=new O;r.url=f.URLHelper.removeLastPathPart(i),t.push(r)}return this.UR(e,t,null)},e.prototype.aR=function(e,t){t._start?t.start=h.DurationConverter.getDurationInSec(t._start):(t.start=e.start+e.duration,t._start="PT"+t.start+"S")},e.prototype.bR=function(e){for(var t={start:0,duration:0,_start:"PT0S",_duration:"PT0S"},n=0;n<e.Period.length;n++){var i=e.Period[n];this.aR(t,i),i._duration?i.duration=h.DurationConverter.getDurationInSec(i._duration):(e.Period[n+1]?i.duration=(h.DurationConverter.getDurationInSec(e.Period[n+1]._start)||0)-i.start:e._mediaPresentationDuration?i.duration=(h.DurationConverter.getDurationInSec(e._mediaPresentationDuration)||0)-i.start:i.duration=1/0,i._duration="PT"+i.duration+"S"),e.Period[n]=i,t=i}return e},e.prototype.cR=function(e){for(var t,n,i=this,r=[],l=[],u=h.DurationConverter.getDurationInSec(e._mediaPresentationDuration),p=function(p){var d=e.Period[p];for(var f in t=h.DurationConverter.getDurationInSec(d._start),n=h.DurationConverter.getDurationInSec(d._duration),isNaN(t)&&0===l.length&&"static"===e._type&&(t=0),isNaN(t)&&l.length>0&&!isNaN(parseFloat(l[l.length-1].start))&&!isNaN(parseFloat(l[l.length-1].duration))&&(t=l[l.length-1].start+l[l.length-1].duration),isNaN(t)&&p===e.Period.length-1&&!isNaN(u)&&(n=u-t),l.length>0&&isNaN(parseFloat(l[l.length-1].duration))&&!isNaN(t)&&(l[l.length-1].duration=t-l[l.length-1].start),l.push({start:t,duration:n}),d)if(d.hasOwnProperty(f)&&["BaseURL","AdaptationSet","EventStream"].includes(f))if(Array.isArray(d[f])||(d[f]=[d[f]]),"AdaptationSet"===f){var g=d[f].map(function(e){var t,n=e._mimeType||(null===(t=e.Representation.find(function(e){return e._mimeType}))||void 0===t?void 0:t._mimeType);return n?c.MimeTypeHelper.extractContentType(n):""}).filter(function(e,t,n){return e&&n.indexOf(e)===t});d[f]=d[f].map(function(e){_(e,d);var t=i.OR(e);return null!==t&&!t.hasOwnProperty("ContentProtection")&&t.Representation[0].hasOwnProperty("ContentProtection")&&(t.ContentProtection=t.Representation[0].ContentProtection),t}).filter(function(e){return Boolean(e)});for(var v=function(e){!d[f].some(function(t){return t._mimeType.includes(e)})&&m.GR.eventHandler.dispatchEvent(a.PlayerEvent.Warning,new o.PlayerWarning(s.WarningCode.SOURCE_CODEC_OR_FILE_FORMAT_NOT_SUPPORTED))},y=0,S=g.filter(function(e){return"audio"===e||"video"===e});y<S.length;y++)v(S[y]);d[f].length<1&&r.push(p)}else if("EventStream"===f)for(var R=0,I=d[f].filter(function(e){return e.Event});R<I.length;R++)for(var T=0,P=I[R].Event;T<P.length;T++){var b=P[T];b.rawXmlRepresentation=m.KR({event:b})}},m=this,d=0;d<e.Period.length;d++)p(d);return r.length>0&&"static"===e._type&&this.dR(r,l,u,e),e=this.bR(e)},e.prototype.dR=function(e,t,n,i){for(var r,o,s;!isNaN(parseInt(r=e.pop()));){if(o=t[r].start,s=t[r].duration,!isNaN(o)&&!isNaN(s)){isNaN(n)||(n-=s,i._mediaPresentationDuration="PT"+n+"S");for(var a=r+1;a<t.length;a++)isNaN(parseFloat(t[a].start))||(t[a].start=t[a].start-s,i.Period[a]._start="PT"+t[a].start+"S")}t.splice(r,1),i.Period.splice(r,1)}},e.parseUTCTimingInformation=function(e,t){var n,i,r,o;e.hasOwnProperty("UTCTiming")&&!Array.isArray(e.UTCTiming)&&(e.UTCTiming=[e.UTCTiming]);for(var s=[],a=function(a){var l={schemeIdUri:a._schemeIdUri,value:""};if("string"==typeof a._value)if(l.schemeIdUri.startsWith("urn:mpeg:dash:utc:http")){var u=null!==(r=null===(i=null===(n=e.BaseURL)||void 0===n?void 0:n[0])||void 0===i?void 0:i.url)&&void 0!==r?r:f.URLHelper.removeLastPathPart(t);l.value=(null!==(o=a._value.match(/\S+/g))&&void 0!==o?o:[a._value]).map(function(e){return f.URLHelper.concatBaseUrlWithPartial(u,e)}).join(" ")}else l.value=a._value;s.push(l)},l=0,u=(e.UTCTiming||[]).filter(function(e){return e.hasOwnProperty("_schemeIdUri")&&"string"==typeof e._schemeIdUri});l<u.length;l++)a(u[l]);return s.length>0?e.UTCTiming=s:delete e.UTCTiming,e},e.prototype.parse=function(t,n,i){var r,o=this.JR(t,{decodeEntities:!0});if(!1===o.success)throw new l.PlayerError(l.ErrorCode.SOURCE_MANIFEST_INVALID,{errorMessage:o.error.message},"DASH manifest is not a valid XML",this.HR.sourceIdentifier);var s=o.parsed.MPD;return s._requestTimestamp=Date.now(),s._downloadTime=i,s._type=null!==(r=s._type)&&void 0!==r?r:"static",e.fillInMissingIds(s),function(e){return e.Period.some(function(e){return e.AdaptationSet.some(function(e){return e.Representation.some(function(t){var n;return Boolean(null!==(n=t._mimeType)&&void 0!==n?n:e._mimeType)})})})}(s)?(s=this.WR(s),s=this.XR(s),s=this.YR(s,n),s=this.ZR(s),s=this.cR(s),(s=e.parseUTCTimingInformation(s,n)).originalDashManifest=t,s):(this.GR.eventHandler.fireError(new l.PlayerError(l.ErrorCode.SOURCE_MANIFEST_INVALID,void 0,"DASH manifest contains no representations",this.HR.sourceIdentifier)),null)},e.prototype.dispose=function(){this.IR=null},e}();function _(e,t){if(e&&t)for(var n=["SegmentBase","SegmentList","SegmentTemplate"],r=0,o=n;r<o.length;r++){var s=o[r],a=Array.isArray(e[s])&&e[s][0],l=Array.isArray(t[s])&&t[s][0],u=n.find(function(t){return e[t]});l&&a?e[s]=[i(i({},t[s][0]),e[s][0])]:l&&!u&&(e[s]=t[s])}}function T(e){var t=e.split("/");return parseInt(t[0])/(parseInt(t[1])||1)}function P(e,t){return e.S.reduce(function(e,t){var n;return e+Number(t._d)*(Number(null!==(n=t._r)&&void 0!==n?n:"0")+1)},0)/t}function b(e){"string"==typeof e._audioSamplingRate&&(e._audioSamplingRate=parseFloat(e._audioSamplingRate))}function L(e,t){"string"==typeof e._height&&(e._height=parseFloat(e._height)),"string"==typeof e._width&&(e._width=parseFloat(e._width)),"string"==typeof e._frameRate&&(e._frameRate=T(e._frameRate)),e._dynamicRange=function(e,t){var n,i,o,s,a=r(r(r(r([],null!==(n=e.EssentialProperty)&&void 0!==n?n:[],!0),null!==(i=e.SupplementalProperty)&&void 0!==i?i:[],!0),null!==(o=t.EssentialProperty)&&void 0!==o?o:[],!0),null!==(s=t.SupplementalProperty)&&void 0!==s?s:[],!0).filter(function(e){return e._schemeIdUri===y.DashSchemeUri.TransferCharacteristics}).map(function(e){var t=e._value;return(0,m.getDynamicRangeFromTransferCharacteristics)(parseInt(null!=t?t:"",10))}).find(function(e){return e!==u.VideoDynamicRange.Unknown});if(void 0!==a)return a;var l=p.CodecStringHelper.getExtractedCodecStrings(e._codecs||t._codecs);return(0,m.getDynamicRangeFromVideoCodec)(l.video)}(e,t)}function U(e){return"string"==typeof e?[{value:e}]:Array.isArray(e)?e.map(function(e){return{id:e._id,lang:e._lang,value:e.toString()}}):[]}function x(e){var t;return"http://dashif.org/guidelines/trickmode"===(null===(t=null==e?void 0:e[0])||void 0===t?void 0:t._schemeIdUri)}t.MPDParser=I;var O=function(){function e(){this.url=null,this.parentIds=null,this.serviceLocation=null,this.byteRange=null,this.availabilityTimeOffset=null,this.availabilityTimeComplete=null,this.isAbsolute=!1,this.customAttributes=null}return e.prototype.toString=function(){return this.url?""+this.url:""},e}();t.BaseURL=O},66759:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.DASHModuleDefinition=void 0;var i=n(62756),r=n(96693),o=n(44908),s=n(4771),a=n(63889),l=n(12054),u=n(31439),p={isIndexRangeNode:r.isIndexRangeNode,isInitializationNode:r.isInitializationNode,isInitializationStringNode:r.isInitializationStringNode},h={provideSegmentInfoFromInitializationProperty:r.provideSegmentInfoFromInitializationProperty,provideSegmentInfoFromInitializationNodeProperty:r.provideSegmentInfoFromInitializationNodeProperty,provideSegmentInfoFromIndexRangeProperty:r.provideSegmentInfoFromIndexRangeProperty};t.DASHModuleDefinition={name:i.ModuleName.DASH,module:function(){return{MPDLoader:o.MPDLoader,SegmentBaseMPDHandler:a.SegmentBaseMPDHandler,SegmentTemplateMPDHandler:l.SegmentTemplateMPDHandler,SegmentTimelineMPDHandler:u.SegmentTimelineMPDHandler,replaceAllPlaceholders:s.default,initSegmentInfoSourceDetectors:p,initSegmentInfoProviders:h}},dependencies:[i.ModuleName.EngineBitmovin,i.ModuleName.XML]},t.default=t.DASHModuleDefinition},63889:function(e,t,n){var i=this&&this.__assign||function(){return i=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},i.apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.SegmentBaseMPDHandler=void 0;var r=n(40306),o=n(3336),s=n(80813),a=n(56481),l=n(4129),u=n(77401),p=n(29669),h=n(79721),m=n(84568),d=n(58313),c=n(88052),f=n(62756),g=n(13422),v=n(59707),y=n(96693),S=function(){function e(e,t){var n=this;this.context=e,this.Rl=0,this.Tl=-1,this.el=null,this.fl=(0,m.memoize)(this.Dm.bind(this),function(e,t){return t._internalId.representationId}),this.qm=function(e){var t=i({},n.al.getRepresentationById(n.Wl));return n.fl(e,t).then(function(e){if(n.cl.dispatch((0,v.setRepresentationSegmentIndexAction)(t._internalId,e)),n.cl.dispatch((0,v.setRepresentationIsLoadingAction)(t._internalId,!1)),e||n.cl.dispatch((0,v.setRepresentationSegmentIndexParsingErrorAction)(t._internalId,!0)),n.Tl>=0){var i=n.Tl;n.Tl=-1,n.seekTo(i)}return n.Zl=null,n.Wl}).catch(function(e){throw n.fl.invalidate(),e})},this.rm=function(e){n.Zl=null;var t=n.sm(e);return n.Yl&&(n.Yl.reject(t),n.Yl=null),Promise.reject(t)},this.wm=function(e){return n.Yl?Promise.reject("fail"):new Promise(function(t,r){n.Yl=i(i({},e),{resolve:t,reject:r})})},this.Pl=e.settings;var r=t.sourceIdentifier;this.dl=r,this.al=e.serviceManager.get(s.ServiceName.ManifestService,r);var o=this.al.getFirstPeriod()||{_id:h.DEFAULT_PERIOD_ID};this.Ql=o._id;var a=this.Pl.MAX_RETRIES;this.Xl=new l.DefaultContentLoader(e,{maxRetries:a,retryDelay:this.Pl.RETRY_DELAY,requestType:p.HttpRequestType.MEDIA_SEGMENTINDEX,onSuccess:function(){n.el=null},onFailure:function(e,t){var i;n.el=null!==(i=null==t?void 0:t.name)&&void 0!==i?i:null}}),this.cl=e.serviceManager.get(s.ServiceName.SourceStoreService,r)}return e.prototype.sm=function(e){if(this.el===u.RequestError.Canceled)return u.RequestError.Canceled;var t=this.el===u.RequestError.TimedOut?r.ErrorCode.NETWORK_SEGMENT_DOWNLOAD_TIMEOUT:r.ErrorCode.NETWORK_ERROR,n=e;return new o.PlayerError(t,{url:null==n?void 0:n.url,statusCode:null==n?void 0:n.status},"Failed to load the segment index",this.dl)},e.prototype.tm=function(e){var t,n,i=this.al.getRepresentationById(e);if(i&&i.segmentIndex){var r=this.al.getPeriodDuration(this.Ql);isFinite(r)&&(n=r/i.segmentIndex.references.length);var o=this.al.getMediaPresentationDuration();0!==o&&(isFinite(o)&&(t=o/i.segmentIndex.references.length),n||(n=t)),i.segmentIndex&&(t=i.segmentIndex.references[0].duration/i.segmentIndex.timescale,n||(n=t))}return n},e.prototype.um=function(){var e,t,n=this.al.getRepresentationById(this.Ul);if(null===(t=null===(e=null==n?void 0:n.segmentIndex)||void 0===e?void 0:e.references)||void 0===t?void 0:t.length){var i=n.segmentIndex.timescale||1,r=n.segmentIndex.references[this.Rl].time/i,o=this.getTimestampOffset(),s={url:"",byteRange:n.segmentIndex.references[this.Rl].byteRange,periodId:n._internalId.periodId,presentationTimeOffset:o,startTime:r-o};return this.Rl++,this.Sl=Math.floor(this.Rl*this.getSegmentDuration())+this.Am(),s}},e.prototype.getInitSegmentInfo=function(e){var t=this.al.getRepresentationById(e);return t&&t.SegmentBase&&t.BaseURL?i(i({},this.vm(t)),{codecs:(0,g.getCodecsFromAdaptationSet)(this.al.getAdaptationSet(e))}):null},e.prototype.vm=function(e){var t=e.SegmentBase[0];return(0,y.isInitializationNode)(t)?(0,y.provideSegmentInfoFromInitializationNodeProperty)(t,e):e.segmentIndex&&(0,y.isIndexRangeNode)(t)?(0,y.provideSegmentInfoFromIndexRangeProperty)(t,e):null},e.prototype.resolvePendingSegmentInfoRequests=function(){if(this.Yl){var e=this.um();e&&(this.Yl.resolve(e),this.Yl=null)}},e.prototype.setAdaptationSetId=function(e){this.Vl=e,this.bl=e.adaptationSetId.split("-")[0],this.xm(),this.resolvePendingSegmentInfoRequests()},e.prototype.xm=function(){var e,t=this,n=this.al.getRepresentationById(this.Ul);n&&(e=n._bandwidth);var i=this.al.getMatchingRepresentationsByBandwidth(this.Vl,e),r=this.Ul?i.find(function(e){return e._internalId===t.Ul}):null,o=null!=r?r:i[0];this.Ul=o._internalId,this.Ql=this.Ul.periodId,o.hasOwnProperty("SegmentBase")&&o.SegmentBase.length},e.prototype.setRepresentationId=function(e){return!!this.al.getRepresentationById(e)&&(this.Ul=e,this.seekTo(this.Sl),!0)},e.prototype.getSegmentInfos=function(){var e=this.getSeekableRange();return this.ym(e)},e.prototype.ym=function(e){var t=this,n={};return this.al.getAdaptationSet(this.Vl).Representation.forEach(function(i){var r=i._id;if(n[r]=[],1===i.BaseURL.length){var o=i.BaseURL[0].url;n[r].push({url:d.URLHelper.appendQueryParametersToUrl(o,t.Pl.QUERY_PARAMETERS)})}else for(var s=0;s<i.BaseURL.length;s++)o=d.URLHelper.appendQueryParametersToUrl(i.BaseURL[s].url,t.Pl.QUERY_PARAMETERS),n[r].push({url:o});n[r].forEach(function(t){t.duration=e.end-e.start,t.startTime=e.start})}),n},e.prototype.getNextSegmentInfo=function(e){var t=this.um();return t?Promise.resolve(t):this.wm({time:e})},e.prototype.getSubtitleUrl=function(){var e=this.al.getAvailableBaseURLsForRepresentation(this.Ul);return e?e[0]:null},e.prototype.getStartNumber=function(){},e.prototype.getLiveEdgeTime=function(){return-1},e.prototype.getActualTimeShiftBufferDepth=function(){return this.al.getTimeShiftBufferDepthSeconds()},e.prototype.zm=function(){var e,t=this;return this.al.getRepresentationById(this.Ul)&&(e=this.tm(this.Ul)),e<0&&(e=this.al.getAdaptationSet(this.Vl).Representation.map(function(e){return t.tm(e._internalId)}).find(function(e){return e>0})),isFinite(e)?[e,!0]:[1,!1]},e.prototype.getSegmentDuration=function(){return this.zm()[0]},e.prototype.hasNext=function(){this.resolvePendingSegmentInfoRequests();var e=this.al.getRepresentationById(this.Ul);if(e){if(e.segmentIndex)return this.Rl<e.segmentIndex.references.length;if(!this.isSegmentInfoLoaded(this.Ul))return!0}return!1},e.prototype.Am=function(){var e,t,n;return null!==(n=null===(t=null===(e=this.al)||void 0===e?void 0:e.findPeriod(this.Ql))||void 0===t?void 0:t.start)&&void 0!==n?n:0},e.prototype.seekTo=function(e){var t;this.Sl=e;var n=this.zm(),i=n[0],r=n[1];if((i<0||!r)&&(this.Tl=e),i>0&&r&&e>-1){var o=Math.max(e-this.Am(),0),s=null===(t=this.al)||void 0===t?void 0:t.getRepresentationById(this.Ul);this.Ul&&s&&this.setIndex(Math.floor(o/i))}},e.prototype.getTimestampOffset=function(){var e=this.al.findPeriod(this.Ql),t=this.al.getRepresentationById(this.Ul),n=t&&t.SegmentBase?t.SegmentBase[0]:null,i=0;if(n&&n.hasOwnProperty("_presentationTimeOffset")&&n.hasOwnProperty("_timescale")){var r=n.hasOwnProperty("_timescale")?parseInt(n._timescale):1;i=parseInt(n._presentationTimeOffset)/r}return e&&(i-=e.start),i},e.prototype.getIndex=function(){return this.Rl},e.prototype.setIndex=function(e){this.Rl=e},e.prototype.timeShift=function(e){},e.prototype.updateRepresentation=function(e){var t=this;if(this.isSegmentInfoLoaded(e))return Promise.resolve(e);if(this.Zl)return this.Zl;var n=this.al.getRepresentationById(e);if(!n)return Promise.reject(null);var i=(0,y.extractBaseUrlFromRepresentation)(n),r=n.SegmentBase[0]._indexRange,o=parseInt(r.split("-")[1])+1;return this.cl.dispatch((0,v.setRepresentationAnchorPointAction)(n._internalId,o)),this.Wl=e,this.Zl=this.Xl.load(i,p.HttpRequestMethod.GET,p.HttpResponseType.ARRAYBUFFER,void 0,{Range:"bytes="+r}).then(function(e){return t.qm(e.body)}).catch(this.rm),this.Zl},e.prototype.isSegmentInfoLoaded=function(e){return this.al.isSegmentInfoLoaded(e)},e.prototype.rewindOneSegment=function(){return this.Rl--,!(this.Rl<0&&(this.setIndex(0),1))},e.prototype.getSeekableRange=function(){return{start:0,end:this.al.getMediaPresentationDuration()}},e.prototype.getPendingSegmentInfoRequest=function(){return this.Yl},e.prototype.setPendingSegmentInfoRequest=function(e){this.Yl=e},e.prototype.canSwitchRepresentation=function(e){return!0},e.prototype.getLatestTimeForPossibleSwitch=function(e){return e},e.prototype.adjustTimeToNextSegmentStart=function(e){return e},e.prototype.dispose=function(){this.Pl=null,this.al=null,this.Ul=null,this.cl=null,this.Xl=(0,a.dispose)(this.Xl),this.Yl=null,this.fl=null},e.prototype.setTimestampOffset=function(e,t){},e.prototype.Bm=function(){return this.context.serviceManager.get(s.ServiceName.SegmentService).get(this.bl).getSegment(this.getInitSegmentInfo(this.Wl)).then(function(e){return e.read()}).then(function(e){return e.value})},e.prototype.Cm=function(e,t){return this.Bm().then(function(n){var i=c.ModuleManager.get(f.ModuleName.ContainerWebM).WebMSegmentIndex,r=c.ModuleManager.get(f.ModuleName.ContainerWebM).WebMInitFile,o=new i(e),s=new r(n.getData()).segment.segmentInfo,a=function(e,t,n){for(var i=e.cues.flatMap(function(e){return e.cuePoints}),r=new Array(i.length),o=t-function(e){var t=e.cues&&e.cues[0],n=t&&t.cuePoints&&t.cuePoints[0],i=n&&n.trackPositions&&n.trackPositions[0];return i&&i.clusterPosition||0}(e),s=i.length-1;s>=0;s--)r[s]={time:i[s].time,byteRange:{start:o+i[s].trackPositions[0].clusterPosition}},s===i.length-1?r[s].duration=n-r[s].time:(r[s].byteRange.end=r[s+1].byteRange.start-1,r[s].duration=r[s+1].time-r[s].time);return r}(o,parseInt(t.SegmentBase[0]._indexRange.split("-")[1])+1,s.getDuration()/s.getTimecodeScale());return{timescale:s.getTimecodeScale(),references:a}})},e.prototype.Dm=function(e,t){return"webm"===this.bl.split("/")[1]?this.Cm(e,t):Promise.resolve(this.Em(e,t.anchorPoint))},e.prototype.Em=function(e,t){if(!e||!t)return null;var n=c.ModuleManager.get(f.ModuleName.ContainerMP4).parseBuffer(e).boxes.find(function(e){return"sidx"===e.type});return n?{timescale:n.timescale,references:R(n.references,n.first_offset+t,n.earliest_presentation_time)}:null},e}();function R(e,t,n){for(var i=[],r=0,o=e;r<o.length;r++){var s=o[r],a=s.referenced_size,l=s.subsegment_duration,u=t,p=u+a-1;i.push({byteRange:{start:u,end:p},time:n,duration:l}),t+=a,n+=l}return i}t.SegmentBaseMPDHandler=S},12054:function(e,t,n){var i=this&&this.__assign||function(){return i=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},i.apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.SegmentTemplateMPDHandler=void 0,t.getTimescaleFromTemplate=c;var r=n(80813),o=n(77179),s=n(89927),a=n(23068),l=n(58313),u=n(16197),p=n(54053),h=n(96693),m=n(4771),d=function(){function e(e,t){this.context=e,this.sourceContext=t,this.settings=e.settings,this.manifestService=e.serviceManager.get(r.ServiceName.ManifestService,t.sourceIdentifier),this.time=0}return e.prototype.getStartNumber=function(){var e=this.getTemplate(this.currentRepresentationId);return e&&e.hasOwnProperty("_startNumber")?parseInt(e._startNumber):1},e.prototype.Gm=function(){var e=this.getTemplate(this.currentRepresentationId);return e&&e._endNumber?parseInt(e._endNumber):NaN},e.prototype.setAdaptationSetId=function(e,t,n){void 0===t&&(t=null),void 0===n&&(n={isManifestUpdate:!1}),this.currentAdaptationSetId=e,this.currentRepresentationId=t;var i=!this.currentRepresentationId||Boolean(this.manifestService.getRepresentationById(this.currentRepresentationId)),r=this.manifestService.getAdaptationSet(this.currentAdaptationSetId);this.currentRepresentationId&&i||(this.currentRepresentationId=r.Representation[0]._internalId),this.getTemplate(this.currentRepresentationId)&&(this.Fm||this.setIndex(this.getStartNumber())),this.resolvePendingSegmentInfoRequests()},e.prototype.getCurrentPeriod=function(){return this.manifestService.getPeriod(this.currentRepresentationId||this.currentAdaptationSetId)},e.prototype.setRepresentationId=function(e){return!!this.manifestService.getRepresentationById(e)&&(this.currentRepresentationId=e,!0)},e.prototype.getInitSegmentInfo=function(e){var t=this.getTemplate(e),n=this.manifestService.getRepresentationById(e);return(0,h.isInitializationStringNode)(t)?(0,h.provideSegmentInfoFromInitializationProperty)(t,n):null},e.prototype.Hm=function(){var e=this.getTemplate(this.currentRepresentationId);return parseFloat(e._availabilityTimeOffset)||0},e.prototype.Im=function(e){var t=this.getExpectedPresentationTime(e);return t-=this.Hm(),(0,s.toMilliSeconds)(t+this.getSegmentDuration()+this.settings.LIVE_EDGE_DISTANCE)},e.prototype.getTemplate=function(e){var t=this.manifestService.getRepresentationById(e);if(null==t?void 0:t.SegmentTemplate)return t.SegmentTemplate[0]},e.prototype.Jm=function(){var e;return(null===(e=this.getCurrentPeriod())||void 0===e?void 0:e.start)||0},e.prototype.isExpectedSegmentPlaybackTimeExceedingPeriodDuration=function(e){var t=this.Gm();if(isFinite(t))return e>t;var n=this.getCurrentPeriod(),i=Boolean(null==n?void 0:n._duration)?n.start+n.duration:1/0;return this.getExpectedPresentationTime(e)>=i},e.prototype.checkIfSegmentAvailable=function(e){return this.Im(e)<=Date.now()},e.prototype.getNextSegmentInfo_=function(){var e={isInitSegment:!1,presentationTimeOffset:this.getTimestampOffset()},t=this.getTemplate(this.currentRepresentationId);if(!t||!t._media||!this.manifestService.representationExists(this.currentRepresentationId))return null;if(this.manifestService.isLive()){var n=this.checkIfSegmentAvailable(this.Fm),i=this.isExpectedSegmentPlaybackTimeExceedingPeriodDuration(this.Fm);if(!n||i)return null;e.wallClockTime=this.Im(this.Fm)-(0,s.toMilliSeconds)(this.getSegmentDuration())}var r=this.manifestService.getRepresentationById(this.currentRepresentationId);return e.periodId=null==r?void 0:r._internalId.periodId,e.url=(0,m.default)(t._media,r,this.Fm,this.time),e.segmentNumber=this.Fm,e.startTime=this.getExpectedPresentationTime(this.Fm),this.setIndex(this.Fm+1),e},e.prototype.getNextSegmentInfo=function(e){var t=this.getNextSegmentInfo_();return t?Promise.resolve(t):this.queueSegmentInfoRequest({time:e})},e.prototype.queueSegmentInfoRequest=function(e){var t=this;return this.pendingSegmentInfoRequest?Promise.reject("fail"):new Promise(function(n,r){t.pendingSegmentInfoRequest=i(i({},e),{resolve:n,reject:r})})},e.prototype.resolvePendingSegmentInfoRequests=function(){if(this.pendingSegmentInfoRequest){var e=this.getNextSegmentInfo_(),t=this.isExpectedSegmentPlaybackTimeExceedingPeriodDuration(this.Fm);e?(this.pendingSegmentInfoRequest.resolve(e),this.pendingSegmentInfoRequest=null):t&&(this.pendingSegmentInfoRequest.reject(p.SegmentInfoError.SEGMENT_EXCEEDING_PERIOD_DURATION),this.pendingSegmentInfoRequest=null)}},e.prototype.getSegmentInfos=function(e){var t=this,n={};return this.manifestService.getAdaptationSet(this.currentRepresentationId).Representation.forEach(function(i){var r,o,s,a=i._internalId,u=t.getTemplate(a),p=[],h=t.getSeekableRange().end-t.getSeekableRange().start,d=0,c=t.manifestService.isLive();c?(s=t.time-h,r=t.Fm-h/t.getSegmentDuration(),o=t.Fm):(s=u._presentationTimeOffset||0,r=0,o=parseInt(r+h/t.getSegmentDuration()));for(var f=r;f<=o;f++){var g={};g.duration=t.getSegmentDuration(),g.startTime=c?t.getExpectedPresentationTime(f):d*t.getSegmentDuration();var v=(0,m.default)(u._media,i,r+d,s+d*t.getSegmentDuration());g.url=e?l.URLHelper.concatBaseUrlWithPartial(e,v):v,g.url=l.URLHelper.appendQueryParametersToUrl(g.url,t.settings.QUERY_PARAMETERS),p.push(g),d++}n[a.representationId]=p}),n},e.prototype.getSubtitleUrl=function(){var e=this.manifestService.getRepresentationById(this.currentRepresentationId).BaseURL[0];return e.url||e},e.prototype.Km=function(){var e=this.getTemplate(this.currentRepresentationId);return e&&e.hasOwnProperty("_liveEdgeNumber")},e.prototype.Lm=function(){if(this.Km()){var e=this.getTemplate(this.currentRepresentationId);return parseInt(e._liveEdgeNumber)}},e.prototype.getSegmentDuration=function(){var e=this.getTemplate(this.currentRepresentationId),t=Number(null==e?void 0:e._duration),n=Number(null==e?void 0:e._timescale);return isNaN(t)?1:isNaN(n)?t:t/n},e.prototype.seekTo=function(e){e>-1&&this.setIndex(this.Mm(e))},e.prototype.getTimescale=function(){return c(this.getTemplate(this.currentRepresentationId))},e.prototype.getExpectedPresentationTime=function(e){var t=this.Jm();return(e-this.getStartNumber())*this.getSegmentDuration()+t},e.prototype.Mm=function(e){var t=this.getSegmentDuration(),n=this.Jm(),i=Math.max(e-n-t/2,0);return Math.floor(i/t)+this.getStartNumber()},e.prototype.getActualTimeShiftBufferDepth=function(){var e=this.Nm();return e.end-e.start},e.prototype.Nm=function(){var e=(0,o.getStartTimeOffset)(this.Om().getState()),t=this.manifestService.getMediaPresentationDuration()||1/0;return this.manifestService.isLive()?this.Qm(t):this.Pm(e,t)},e.prototype.Om=function(){return this.context.serviceManager.get(r.ServiceName.SourceStoreService,this.sourceContext.sourceIdentifier)},e.prototype.Pm=function(e,t){return{start:e,end:isFinite(t)?e+t:0}},e.prototype.Qm=function(e){var t=(this.manifestService.getFirstPeriod()||{start:0}).start,n=-1*this.manifestService.getTimeShiftBufferDepthSeconds(),i=(0,s.toSeconds)(Date.now()-this.manifestService.getAvailabilityStartTime()),r=Math.min(n,i),o=this.getLiveEdgeTime();return{start:Math.max(t,o-r),end:o}},e.prototype.getSeekableRange=function(){var e=this.Nm();if(this.manifestService.isLive()){var t=this.manifestService.getDesiredDistanceToLiveEdge();e.end=Math.max(e.end-t,e.start)}return e},e.prototype.hasNext=function(e){var t=this.isExpectedSegmentPlaybackTimeExceedingPeriodDuration(this.Fm),n=Math.ceil(e/this.getSegmentDuration())+this.getStartNumber()-1;return!t&&this.Fm<=n},e.prototype.getTimestampOffset=function(){var e=this.getCurrentPeriod(),t=0,n=this.getTemplate(this.currentRepresentationId);return n&&n._presentationTimeOffset&&(t=n._presentationTimeOffset/this.getTimescale()),e&&(t-=e.start),t},e.prototype.Rm=function(e,t){var n=this.manifestService.getPeriod(e)||this.getCurrentPeriod();return this.manifestService.isLastPeriod(e.periodId)?n&&(0,a.isNumber)(n.duration)&&isFinite(n.duration)?n.duration:n&&n.start?(0,s.toSeconds)(t)-n.start:this.manifestService.calculateCumulativePeriodDuration(e.periodId):this.manifestService.getPeriodDuration(e.periodId)},e.prototype.Sm=function(e){var t=Date.now(),n=(0,s.toSeconds)(t-this.manifestService.getRequestTimestamp());return this.Km()?this.Lm()+Math.floor(n/this.getSegmentDuration()):this.manifestService.isLive()&&Boolean(this.manifestService.getManifest()._availabilityStartTime)?Math.floor(this.Rm(e,t)/this.getSegmentDuration()+this.getStartNumber()):this.getStartNumber()},e.prototype.Tm=function(e){return Math.max(this.Sm(e),this.getStartNumber())},e.prototype.getIndex=function(){return this.Fm},e.prototype.setIndex=function(e){this.Fm=e},e.prototype.getLiveEdgeTime=function(){return(0,s.toSeconds)(Date.now())},e.prototype.timeShift=function(e,t){if(void 0===t&&(t=this.currentRepresentationId.periodId),this.manifestService.isLive()){this.Fm;var n=this.Tm(new u.PeriodId(t));0===e?this.setIndex(n):(this.setIndex(n+Math.floor(e/this.getSegmentDuration())),this.Fm<this.getStartNumber()&&this.setIndex(this.getStartNumber()))}},e.prototype.updateRepresentation=function(e){return this.currentRepresentationId=e,Promise.resolve(e)},e.prototype.isSegmentInfoLoaded=function(e){return!0},e.prototype.rewindOneSegment=function(){return this.setIndex(this.Fm-1),this.Fm<this.getStartNumber()&&this.setIndex(this.getStartNumber()),!0},e.prototype.getPendingSegmentInfoRequest=function(){return this.pendingSegmentInfoRequest},e.prototype.setPendingSegmentInfoRequest=function(e){this.pendingSegmentInfoRequest=e},e.prototype.canSwitchRepresentation=function(e){return!0},e.prototype.getLatestTimeForPossibleSwitch=function(e){return e},e.prototype.adjustTimeToNextSegmentStart=function(e){return e},e.prototype.dispose=function(){this.settings=null,this.manifestService=null,this.currentRepresentationId=null,this.currentAdaptationSetId=null,this.pendingSegmentInfoRequest=null},e.prototype.setTimestampOffset=function(e,t){},e}();function c(e){return e&&null!=e._timescale&&parseInt(e._timescale)||1}t.SegmentTemplateMPDHandler=d},31439:function(e,t,n){var i=this&&this.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),r=this&&this.__assign||function(){return r=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},r.apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.SegmentTimelineMPDHandler=void 0;var o=n(74853),s=n(89927),a=n(58313),l=n(54053),u=n(4771),p=n(12054),h=n(39761),m=function(e){function t(t,n){var i=e.call(this,t,n)||this;return i.Um=0,i.Vm=null,i.Wm=[],i.Xm=!0,i.bm=!1,i.Ym=1,i.Zm=0,i.am=0,i}return i(t,e),t.prototype.setAdaptationSetId=function(t,n,i){void 0===n&&(n=null),void 0===i&&(i={isPeriodSwitch:!1,isManifestUpdate:!1}),this.currentAdaptationSetId=t,this.currentRepresentationId=n;var r=!this.currentRepresentationId||Boolean(this.manifestService.getRepresentationById(this.currentRepresentationId)),o=this.manifestService.getAdaptationSet(this.currentAdaptationSetId);this.currentRepresentationId&&r||(this.currentRepresentationId=o.Representation[0]._internalId);var s=this.getTemplate(this.currentRepresentationId);s&&(this.setTimeline(s,i.isPeriodSwitch),this.getIndex()||e.prototype.setIndex.call(this,this.getStartNumber())),this.resolvePendingSegmentInfoRequests()},t.prototype.setRepresentationId=function(e){if(this.manifestService.getRepresentationById(e)){this.currentRepresentationId=e;var t=this.getTemplate(this.currentRepresentationId);return t&&this.setTimeline(t),!0}return!1},t.prototype.cm=function(e){return null!=(null==e?void 0:e.start)&&isFinite(e.start)?e.start:0},t.prototype.dm=function(){this.manifestService.isLive()&&this.Xm&&(this.bm||this.timeShift(0),this.Xm=!1)},t.prototype.em=function(e){return!(null==e?void 0:e._media)||!this.manifestService.representationExists(this.currentRepresentationId)},t.prototype.fm=function(e){var t=this.Wm[this.Um];t&&(e.wallClockTime=(0,s.toMilliSeconds)(t.ot/this.Ym-this.getTimestampOffset()))},t.prototype.getNextSegmentInfo_=function(){var t,n,i={isInitSegment:!1,presentationTimeOffset:this.getTimestampOffset()},r=this.getTemplate(this.currentRepresentationId);if(this.em(r))return null;if(this.dm(),!(this.Wm.length>0&&this.Um<this.Wm.length))return null;var o=this.Wm[this.Um];e.prototype.setIndex.call(this,o.i),this.time=o.ot,i.duration=o.duration,i.mediaPresentationTime=o.t,i.segmentNumber=o.i;var s=null!==(n=null===(t=this.getCurrentPeriod())||void 0===t?void 0:t.start)&&void 0!==n?n:0;if(i.startTime=o.playbackTime+s,this.manifestService.isLive()){if(this.isExpectedSegmentPlaybackTimeExceedingPeriodDuration(this.Um))return null;this.fm(i)}var a=this.manifestService.getRepresentationById(this.currentRepresentationId);return a?(i.periodId=null==a?void 0:a._internalId.periodId,i.url=(0,u.default)(r._media,a,this.getIndex(),this.time),e.prototype.setIndex.call(this,this.getIndex()+1),this.Um++,i):null},t.prototype.getNextSegmentInfo=function(e){var t=this.getNextSegmentInfo_();return t?Promise.resolve(t):this.queueSegmentInfoRequest({time:e})},t.prototype.queueSegmentInfoRequest=function(e){var t=this;return this.pendingSegmentInfoRequest?Promise.reject("fail"):new Promise(function(n,i){t.pendingSegmentInfoRequest=r(r({},e),{resolve:n,reject:i})})},t.prototype.resolvePendingSegmentInfoRequests=function(){if(this.pendingSegmentInfoRequest){var e=this.getNextSegmentInfo_();if(e)this.pendingSegmentInfoRequest.resolve(e),this.pendingSegmentInfoRequest=null;else if(!this.manifestService.isSmoothManifest()){var t=this.getCurrentPeriod();if(isFinite(t.duration)){var n=this.getTimelineDuration(),i=n/this.getTimelineLength(),r=t.start+n,o=t.duration-i/2;isFinite(o)&&r>=o&&(this.pendingSegmentInfoRequest.reject(l.SegmentInfoError.PERIOD_COMPLETE),this.pendingSegmentInfoRequest=null)}}}},t.prototype.getSegmentInfos=function(e){var t=this,n={};return this.manifestService.getAdaptationSet(this.currentRepresentationId).Representation.forEach(function(i){for(var r=i._internalId,o=t.getTemplate(r),s=[],l=t.manifestService.isLive(),p=t.getTimelineLength(),h=0,m=0;m<p;m++){var d=t.Wm[m],c={};c.duration=d.duration,l?c.startTime=t.getExpectedPresentationTime(m):(c.startTime=h,h+=d.duration);var f=(0,u.default)(o._media,i,d.i,d.ot);c.url=e?a.URLHelper.concatBaseUrlWithPartial(e,f):f,c.url=a.URLHelper.appendQueryParametersToUrl(c.url,t.settings.QUERY_PARAMETERS),s.push(c)}n[r.representationId]=s}),n},t.prototype.getSubtitleUrl=function(){var e=this.manifestService.getRepresentationById(this.currentRepresentationId).BaseURL[0];return e.url||e},t.prototype.getSegmentDuration=function(){return this.getSegmentDurationCurrentElement()},t.prototype.seekTo=function(t){if(t>-1){var n=this.cm(this.getCurrentPeriod());this.bm=!1,isFinite(n)&&(t-=n);for(var i=1;i<this.Wm.length;i++)if(this.Wm[i].playbackTime>t)return this.Um=i-1,e.prototype.setIndex.call(this,this.Wm[this.Um].i),this.Xm=!1,this.getIndex();this.Um=Math.max(this.Wm.length-1,0)}return e.prototype.setIndex.call(this,this.Wm[this.Um].i),this.getIndex()},t.prototype.getExpectedPresentationTime=function(e){var t,n;return(null!==(n=null===(t=this.getCurrentPeriod())||void 0===t?void 0:t.start)&&void 0!==n?n:0)+this.Wm[e].playbackTime},t.prototype.hasNext=function(e){if(this.Um<this.Wm.length){var t=this.Wm[0].t,n=this.Wm[this.Um];if(this.isExpectedSegmentPlaybackTimeExceedingPeriodDuration(this.Um))return!1;if(n)return n.t-t<=e*this.Ym}return!1},t.prototype.getTimestampOffset=function(){var e=this.getCurrentPeriod(),t=this.Zm/this.Ym;return e&&(t-=e.start),t},t.prototype.setIndex=function(t){if(e.prototype.setIndex.call(this,t),this.Wm&&this.Wm.length>0)for(var n=0;n<this.Wm.length;n++)this.Wm[n].i===t&&(this.Um=n)},t.prototype.getLiveEdgeTime=function(){if(!this.manifestService.isLive())return-1;var t=this.manifestService.getLastPeriod(),n=this.getCurrentPeriod();if(null==t||(null==n?void 0:n._id)===t._id)return this.cm(n)+this.gm()/this.Ym;var i=(0,h.getFirstAvSegmentTemplateFromPeriod)(t);return(null==i?void 0:i.SegmentTimeline)?this.cm(t)+(0,h.calculateTimelineEnd)(i):e.prototype.getLiveEdgeTime.call(this)},t.prototype.gm=function(){if(!this.Wm.length)return 0;var e=this.Wm[this.Wm.length-1];return e.t+e.d},t.prototype.timeShift=function(t,n){if(this.manifestService.isLive()&&!(this.Wm.length<1)){this.bm=!1;for(var i=this.Wm[0].t,r=this.gm(),o=t*this.Ym,s=Math.max(this.am,this.settings.MIN_TIMELINE_LIVE_OFFSET)*this.Ym,a=Math.max(i+s,r+o),l=this.Wm.length-1;l>=0;l--)if(this.Wm[l].t<=a){this.Um=l;break}(this.Um>=this.Wm.length||this.Um<=0)&&(this.Um=0),this.Xm=!1,e.prototype.setIndex.call(this,this.Wm[this.Um].i)}},t.prototype.updateRepresentation=function(e){return this.currentRepresentationId=e,Promise.resolve(e)},t.prototype.isSegmentInfoLoaded=function(e){return!0},t.prototype.rewindOneSegment=function(){return this.Um--,this.Um<0&&(this.Um=0),!0},t.prototype.hm=function(e,t){for(var n,i={entries:[],latestTime:0,latestOriginalTime:0,lastPreviousTimelineEntryIndex:0,index:this.getStartNumber()},r=0,o=0,s=0,a=e;s<a.length;s++)for(var l=0,u=null!==(n=a[s].S)&&void 0!==n?n:[];l<u.length;l++){var p=u[l],m=(0,h.parseStringToNumber)(p._r),c=parseInt(p._d);if(p.hasOwnProperty("_t")){var f=(0,h.parseStringToNumber)(p._t);i.latestOriginalTime=f,i.latestTime=f-this.Zm}for(;i.latestTime+c<=0&&m>=0;)i.latestTime+=c,i.latestOriginalTime+=c,m--;for(var g=this.km(i,t,c,m),v=0;v<g.length;v++)g[v].i=i.index+v;r+=g.length,d(i,g,c);var y=m-g.length+1;o+=y,d(i,this.jm(i,y,c),c)}return this.im(r,o),i.entries},t.prototype.im=function(e,t){},t.prototype.jm=function(e,t,n){for(var i=[],r=0;r<t;r++){var o=e.latestTime+n*r,s={d:n,t:o,ot:e.latestOriginalTime+n*r,i:e.index+r,playbackTime:o/this.Ym,duration:n/this.Ym};i.push(s)}return i},t.prototype.km=function(e,t,n,i){var r=(0,o.findIndexWithin)(t,e.lastPreviousTimelineEntryIndex,t.length,function(t){return t.t===e.latestTime&&t.d===n});if(-1===r)return[];var s=function(e,t,n,i){for(var r=e[t].t,o=i;o>0;o--){var s=t+o,a=e[s],l=r+n*o;if(a&&a.t===l&&a.d===n)return s}return t}(t,r,n,i);return e.lastPreviousTimelineEntryIndex=s,t.slice(r,s+1)},t.prototype.getTimelineDuration=function(){var e=this;return this.Wm&&this.Wm.length>0&&isFinite(this.Ym)?this.Wm.reduce(function(t,n){return t+n.d/e.Ym},0):0},t.prototype.getTimelineLength=function(){return this.Wm?this.Wm.length:0},t.prototype.setTimeline=function(e,t){void 0===t&&(t=!1);var n=e.SegmentTimeline;if(this.bm=this.bm||Boolean(t),n&&this.Vm!==n){this.Vm=n;var i=this.lm(),r=this.getTimescale();this.Ym=r,this.Zm=parseFloat(String(e._presentationTimeOffset))||0;var o=this.hm(n,this.Wm);o.length>0&&(this.am=o[0].d/r),this.mm(o,r,i),this.Wm=o}},t.prototype.lm=function(){return this.Wm&&this.Wm.length>0?this.Ym:this.getTimescale()},t.prototype.mm=function(t,n,i){var r,o=!1;if(this.Wm&&this.Wm.length>0?r=(o=this.Um>=this.Wm.length)?this.Wm[this.Wm.length-1]:this.Wm[this.Um]:(this.Um=0,e.prototype.setIndex.call(this,0)),r)for(var s=t.length-1;s>=0;s--)if(g(t[s],n,r,i)){this.Um=s+(o?1:0),e.prototype.setIndex.call(this,t[s].i+(o?1:0));break}},t.prototype.getSegmentDurationCurrentElement=function(){var e=this.Wm[this.Um];return e?e.d/this.Ym:1},t.prototype.dispose=function(){this.settings=null,this.Wm=[]},t}(p.SegmentTemplateMPDHandler);function d(e,t,n){var i;(i=e.entries).push.apply(i,t),e.latestTime+=n*t.length,e.latestOriginalTime+=n*t.length,e.index+=t.length}t.SegmentTimelineMPDHandler=m;var c=Math.pow(10,8);function f(e){return Math.round(e*c)/c}function g(e,t,n,i){var r=f(e.t/t),o=f(r+e.d/t),s=f(n.t/i);return r<=s&&s<o}},4771:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,n,r){var o=e.match(/(\$((RepresentationID)|(Bandwidth)|(Time)|(Number(%([\d]*[A-Za-z]))?)|())\$)/g),s=null!=n,a=t.hasOwnProperty("_bandwidth"),l=null!=r;function u(e){if(0===e.indexOf("Number")&&s){if(e.indexOf("%")>-1){var i=function(e){var t=parseInt(e.substring(0,e.length-1)),n=e[e.length-1].toLowerCase(),i=0!==e[e.length-1].indexOf(n);return[0===n.indexOf("o")?8:0===n.indexOf("x")?16:(n.indexOf("d"),10),t,i]}(e.substring(e.indexOf("%")+1)),o=i[0],u=i[1],p=i[2];return function(e,t){for(;e.length<t;)e="0"+e;return e}(function(e,t){return t?e.toUpperCase():e.toLowerCase()}(n.toString(o),p),u)}return String(n)}return 0===e.indexOf("RepresentationID")?t._internalId.representationId:0===e.indexOf("Bandwidth")&&a?String(t._bandwidth):0===e.indexOf("Time")&&l?String(r):""===e?"$":void 0}var p=[].concat(o).filter(function(e){return e}).map(function(e){return e.substring(1,e.length-1)}).map(function(e){return[e,u(e)]}).filter(function(e){return e[1].length>0}).reduce(function(e,t){var n=t[0],i=t[1];return e.replace("$".concat(n,"$"),i)},e);return(0,i.forceReallocation)(p)};var i=n(20649)},39761:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.getFirstAvSegmentTemplateFromPeriod=function(e){var t,n=e.AdaptationSet.find(function(e){return i.MimeTypeHelper.isAV(e._mimeType)}),r=null===(t=null==n?void 0:n.Representation[0])||void 0===t?void 0:t.SegmentTemplate;return null==r?void 0:r[0]},t.calculateTimelineEnd=function(e){for(var t,n,i=parseFloat(String(e._presentationTimeOffset))||0,s=(0,r.getTimescaleFromTemplate)(e),a=0,l=0,u=null!==(t=e.SegmentTimeline)&&void 0!==t?t:[];l<u.length;l++)for(var p=0,h=null!==(n=u[l].S)&&void 0!==n?n:[];p<h.length;p++){var m=h[p],d=o(m._r),c=parseInt(m._d);m.hasOwnProperty("_t")&&(a=Math.max(0,o(m._t)-i)),a+=c*(d+1)}return a/s},t.parseStringToNumber=o;var i=n(85434),r=n(12054);function o(e,t){return void 0===t&&(t=0),e?parseInt(e):t}}},function(e){return function(){return e(66759)}()}])});
17
+ "use strict";!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.dash=t():(e.bitmovin=e.bitmovin||{},e.bitmovin.player=e.bitmovin.player||{},e.bitmovin.player.dash=t())}(self,function(){return(self.webpackChunkbitmovin_player=self.webpackChunkbitmovin_player||[]).push([[367],{96693:function(e,t,n){var i=this&&this.__assign||function(){return i=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},i.apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.isInitializationStringNode=function(e){return(0,r.isObject)(e)&&null!=e._initialization},t.isInitializationNode=function(e){return(0,r.isObject)(e)&&Array.isArray(e.Initialization)&&e.Initialization.length>0},t.isIndexRangeNode=function(e){return(0,r.isObject)(e)&&null!=e._indexRange},t.provideSegmentInfoFromInitializationProperty=function(e,t){var n=(0,a.default)(e._initialization,t),r=s.URLHelper.concatBaseUrlWithPartial(u(t),n);return i(i({},(0,o.createInitSegmentInfoBase)(t)),{url:r,mediaURL:n})},t.extractBaseUrlFromRepresentation=u,t.provideSegmentInfoFromInitializationNodeProperty=function(e,t){var n=e.Initialization[0],r=function(e,t){return e._sourceURL?e._sourceURL:u(t)}(n,t),a=s.URLHelper.concatBaseUrlWithPartial(u(t),r),l=function(e){var t,n,i=null!==(n=null===(t=e._range)||void 0===t?void 0:t.split("-").map(function(e){return parseInt(e)}))&&void 0!==n?n:[];return i.length>1?{start:i[0],end:i[1]}:null}(n);return i(i({},(0,o.createInitSegmentInfoBase)(t)),{url:a,mediaURL:r,byteRange:l})},t.provideSegmentInfoFromIndexRangeProperty=function(e,t){var n=u(t),r={start:0,end:parseInt(e._indexRange.split("-")[0])-1};return i(i({},(0,o.createInitSegmentInfoBase)(t)),{url:n,mediaURL:n,byteRange:r})};var r=n(94685),s=n(58313),o=n(65439),a=n(4771);function u(e){return e.BaseURL?s.URLHelper.urlObjectToString(e.BaseURL[0]):""}},44908:function(e,t,n){var i=this&&this.__assign||function(){return i=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},i.apply(this,arguments)},r=this&&this.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var i,r=0,s=t.length;r<s;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.MPDLoader=void 0;var s=n(40306),o=n(3336),a=n(80813),u=n(3714),l=n(4129),p=n(85625),h=n(77401),d=n(57456),c=n(29669),f=n(91678),m=n(33436),g=n(89927),v=n(58313),y=n(78340),S=function(){function e(e,t){var n=this;this.Rr=0,this.Zr=function(e){return e.body?n.ar(e):(n.Pr.load(null,null).catch(function(){}),null)},this.br=function(e,t){n.Sr=function(e,t,n){if((null==t?void 0:t.name)===h.RequestError.Canceled)return null;if((null==t?void 0:t.name)===h.RequestError.TimedOut)return new o.PlayerError(s.ErrorCode.NETWORK_MANIFEST_DOWNLOAD_TIMEOUT,I(e),"Failed to load DASH manifest: the request timed out.",n);var i=(null==e?void 0:e.status)===XMLHttpRequest.UNSENT?"Failed to load the DASH manifest due to CORS restrictions or because the client is offline.":"Failed to load DASH manifest: ".concat(e.status," ").concat(e.statusText,".");return new o.PlayerError(s.ErrorCode.SOURCE_COULD_NOT_LOAD_MANIFEST,I(e),i,n)}(e,t,n.Kr.sourceIdentifier)},this.Jr=e,this.Kr=t,this.Qr=e.settings,this.Mr=new y.MPDParser(e,t),this.Lr=!1,this.Tr=e.eventHandler,this.Or=[];var i={onFailure:this.br,maxRetries:this.Qr.MAX_MPD_RETRIES,requestType:c.HttpRequestType.MANIFEST_DASH,resetRetriesWhenOffline:!1};this.Pr=new l.DefaultContentLoader(e,i)}return e.prototype.Ur=function(e,t){if(this.Lr)return null;var n=e.trim();return this.Vr(n,t)},e.prototype.Vr=function(e,t){var n,i=this.Jr.serviceManager.get(a.ServiceName.ManifestCachingService),s=null!==(n=null==i?void 0:i.getParsedManifest(this.Nr))&&void 0!==n?n:this.Wr(e,t);return s?(R(s)||null==i||i.cacheParsedManifest(s,this.Nr),this.Or=s.BaseURL?r(r([],s.Location,!0),s.BaseURL.map(function(e){return e.url}),!0):s.Location,this.Nr=this.Or[0],s):null},e.prototype.Wr=function(e,t){return this.Mr.parse(e,this.Nr,t)},e.prototype.Xr=function(){this.Pr&&this.Pr.cancel(),this.Lr=!0,this.Nr=null},e.prototype.dispose=function(){this.Xr(),this.Pr.dispose(),this.Mr&&(this.Mr.dispose(),this.Mr=null),this.Qr=null},e.prototype.load=function(e){var t=this;this.Nr=null!=e?e:this.Nr;var n=this.Nr;return this.Sr=null,e&&(this.Lr=!1),n?this.Yr(n).then(function(e){return t.Zr(e)}).then(function(e){return t.Nr!==n&&t.Or.includes(t.Nr)&&t.Jr.eventHandler.dispatchEvent(u.PlayerEvent.ContentLocationChanged,{sourceLocationId:n,targetLocationId:t.Nr,reason:u.ContentLocationChangedReason.Failover}),e}).catch(function(e){return t.Lr||(null==e?void 0:e.message)===h.RequestError.Canceled?Promise.reject():Promise.reject(e)}):(this.Jr.eventHandler.fireError(new o.PlayerError(s.ErrorCode.SOURCE_INVALID,void 0,"Cannot load the manifest: no URL was provided.",this.Kr.sourceIdentifier)),Promise.reject("No manifest url provided"))},e.prototype.Yr=function(e){var t,n=this,i=this.Jr.serviceManager.maybeCall(a.ServiceName.ManifestCachingService,function(t){return t.getHttpResponse(e)});if(i)return Promise.resolve(i);var r=null===(t=this.Kr.source.options)||void 0===t?void 0:t.manifestWithCredentials;return this.Pr.load(e,c.HttpRequestMethod.GET,null,null,null,r,p.ManifestMimeType.Dash).catch(function(e){return n.Rr++,n.Rr<n.Or.length?(n.Nr=v.URLHelper.replaceCdn(n.Nr,n.Or[n.Rr]),n.Yr(n.Nr)):(n.Sr&&n.Tr.fireError(n.Sr),n.Sr=null,Promise.reject(e))})},e.prototype.updateRepresentation=function(e){return Promise.resolve(e)},e.prototype.stopRepresentationUpdate=function(e){return Promise.resolve()},e.prototype.ar=function(e){var t,n,r,s=null!==(t=e.elapsedTime)&&void 0!==t?t:0;(0,d.isDownloadTimeInformationValid)(e)&&this.Jr.store.dispatch((0,f.addMetricsValue)("default",m.MetricType.DownloadInformation,{bytes:e.length,time:s,timeToFirstByte:e.timeToFirstByte})),this.Nr=e.url;var o=i({},this.Ur(e.body,(0,g.toSeconds)(Math.round(s))));return o._currentLoadingUrl=this.Nr,R(o)?!0===(null===(r=null===(n=this.Jr)||void 0===n?void 0:n.settings)||void 0===r?void 0:r.INFINITE_RETRIES_FOR_LIVE)&&this.Pr.setResetRetriesWhenOffline(!0):this.Jr.serviceManager.maybeCall(a.ServiceName.ManifestCachingService,function(t){return t.cacheHttpResponse(e,e.url)}),o},e}();function I(e){return{url:e.url,statusCode:e.status,statusText:e.statusText}}function R(e){return"dynamic"===(null==e?void 0:e._type)}t.MPDLoader=S},78340:function(e,t,n){var i=this&&this.__assign||function(){return i=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},i.apply(this,arguments)},r=this&&this.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var i,r=0,s=t.length;r<s;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.BaseURL=t.MPDParser=void 0,t.mergeCommonAttributes=T,t.parseFraction=_;var s=n(25926),o=n(4224),a=n(3714),u=n(20213),l=n(44468),p=n(34047),h=n(52424),d=n(21216),c=n(68922),f=n(85434),m=n(58313),g=n(88052),v=n(62756),y=n(92778),S=new RegExp("_(.*:)?label","i"),I=["__text","_byteRange","_serviceLocation","_availabilityTimeOffset","_availabilityTimeComplete"],R=function(){function e(e,t){this.lS=e,this.mS=t,this.nS=e.renderer;var n=g.ModuleManager.get(v.ModuleName.XML);this.oS=n.parseXML,this.pS=n.parseJSONtoXML}return e.prototype.qS=function(e,t){return(0,c.applyLabeling)({source:this.mS.source,context:this.lS,streamType:l.StreamType.Dash,labelingType:e},t)},e.prototype.rS=function(e){var t,n,i,r=null!==(i=null===(n=null===(t=e.Label)||void 0===t?void 0:t[0])||void 0===n?void 0:n.value)&&void 0!==i?i:e._label,s={mimeType:e._mimeType,lang:e._lang};return this.qS(c.LabelingType.Tracks,s)||r},e.prototype.sS=function(e,t){var n,i,r,s=null!==(r=null===(i=null===(n=t.Label)||void 0===n?void 0:n[0])||void 0===i?void 0:i.value)&&void 0!==r?r:t._label,o={id:t._id,mimeType:e,bitrate:t._bandwidth,qualityRanking:t._qualityRanking,width:t._width,height:t._height,frameRate:t._framerate};return this.qS(c.LabelingType.Qualities,o)||s},e.prototype.tS=function(e){var t,n=this,i=0;for(var r in e)if(e.hasOwnProperty(r)){if("Accessibility"===r&&this.uS(e,e[r]),"EssentialProperty"===r&&O(e[r]))return null;"Label"===r&&(e.Label=N(e[r])),"SegmentTemplate"===r&&this.vS(e[r]),"SegmentList"===r&&this.wS(e[r]),"SegmentTemplate"===r||0===r.indexOf("_")||Array.isArray(e[r])||(e[r]=[e[r]]),"Representation"===r&&(e[r]=e[r].filter(function(t){var r,s,o=t._mimeType||e._mimeType;if(t._mimeType=t._mimeType||e._mimeType,o&&(o=o.toLowerCase()),"AudioChannelConfiguration"in e){var a=e.AudioChannelConfiguration;null!==(r=(s=t).AudioChannelConfiguration)&&void 0!==r||(s.AudioChannelConfiguration=a)}T(t,e),b(t),L(t,e),"string"==typeof t._bandwidth&&(t._bandwidth=parseFloat(t._bandwidth)),t.Label&&(t.Label=N(t.Label)),t.SegmentTemplate&&n.vS(t.SegmentTemplate),t.SegmentList&&n.wS(t.SegmentList);var u=t._codecs||e._codecs;if(o&&(0===o.indexOf("application")||0===o.indexOf("text")||0===o.indexOf("image")||o.indexOf("mp2t")>=0))i++,t._label=n.sS(o,t);else if(o&&u){if(t._codecs=u,!p.CodecStringHelper.isSupportedByRenderer(n.nS,o,u))return!1;i++,t._label=n.sS(o,t)}return!0}))}if(i>0){if(!e._mimeType){var s=null===(t=e.Representation.find(function(e){return e._mimeType}))||void 0===t?void 0:t._mimeType;s&&(e._mimeType=s)}return e._label=this.rS(e),e.Representation.sort(function(e,t){return e._bandwidth-t._bandwidth}),e}return null},e.prototype.uS=function(t,n){t.ClosedCaptionLabels={};for(var i=e.filterAccessibilityTagsByScheme(n,"urn:scte:dash:cc:cea-608:2015"),r=e.extractLabelGroups(i),s=0;s<r.length;s++){var o=r[s],a=o.split("="),u=2===a.length?[a[0],a[1]]:["CC"+s,o],l=u[0],p=u[1];t.ClosedCaptionLabels[l]={label:p,lang:p}}},e.prototype.vS=function(e){for(var t,n,i=0,r=e;i<r.length;i++){var s=r[i];if(s.hasOwnProperty("SegmentTimeline"))for(var o=Number(null!==(t=s._timescale)&&void 0!==t?t:"1"),a=0,u=null!==(n=s.SegmentTimeline)&&void 0!==n?n:[];a<u.length;a++){var l=u[a];l.totalDuration=P(l,o)}}},e.prototype.wS=function(e){for(var t,n,i,r,s,o,a=0,u=e;a<u.length;a++){var l=u[a];if(l.hasOwnProperty("SegmentTimeline")){for(var p=Number(null!==(t=l._timescale)&&void 0!==t?t:"1"),h=0,d=null!==(n=l.SegmentTimeline)&&void 0!==n?n:[];h<d.length;h++){var c=d[h];c.totalDuration=P(c,p)}l.totalDuration=null!==(s=null===(r=null===(i=l.SegmentTimeline)||void 0===i?void 0:i[0])||void 0===r?void 0:r.totalDuration)&&void 0!==s?s:0}else if(l.hasOwnProperty("_duration")&&l.hasOwnProperty("SegmentURL")){p=Number(null!==(o=l._timescale)&&void 0!==o?o:"1");var f=Number(l._duration)/p;l.totalDuration=f*l.SegmentURL.length}}},e.filterAccessibilityTagsByScheme=function(e,t){return e&&e.length>0?e.filter(function(e){return e._schemeIdUri===t}):[]},e.extractLabelGroups=function(e){for(var t=[],n=0,i=e;n<i.length;n++){var r=i[n];if(r._value){var s=r._value.split(";");t.push.apply(t,s)}}return t},e.prototype.xS=function(e,t){for(var n=0;n<e.length;n++)if("string"==typeof t&&e[n].url===t||"object"==typeof t&&e[n].url===t.url)return!0;return!1},e.prototype.IT=function(e,t,n,i){var r;Array.isArray(e.BaseURL)||(e.BaseURL=[e.BaseURL]);for(var s=[],o=0;o<e.BaseURL.length;o++){if((r=new x).customAttributes=[],null!=t&&(r.parentIds={},void 0!==t[0]&&null!==t[0]&&(r.parentIds.PeriodID=t[0]),void 0!==t[1]&&null!==t[1]&&(r.parentIds.AdaptationSetID=t[1]),void 0!==t[2]&&null!==t[2]&&(r.parentIds.RepresentationID=t[2])),"string"==typeof e.BaseURL[o])r.url=e.BaseURL[o];else if("object"==typeof e.BaseURL[o])for(var a in e.BaseURL[o].hasOwnProperty("__text")&&(r.url=e.BaseURL[o].__text),e.BaseURL[o].hasOwnProperty("_serviceLocation")&&(r.serviceLocation=e.BaseURL[o]._serviceLocation),e.BaseURL[o].hasOwnProperty("_byteRange")&&(r.serviceLocation=e.BaseURL[o]._byteRange),e.BaseURL[o].hasOwnProperty("_availabilityTimeOffset")&&(r.serviceLocation=e.BaseURL[o]._availabilityTimeOffset),e.BaseURL[o].hasOwnProperty("_availabilityTimeComplete")&&(r.serviceLocation=e.BaseURL[o]._availabilityTimeComplete),e.BaseURL[o])if(e.BaseURL[o].hasOwnProperty(a)&&0===a.indexOf("_")&&-1===I.indexOf(a)){var u={};u[a.substring(1)]=e.BaseURL[o][a],r.customAttributes.push(u)}s.push(r)}for(e.BaseURL=[],o=0;o<s.length;o++){var l=s[o];if(m.URLHelper.isUrlAbsolute(l))this.xS(e.BaseURL,l)||(l.isAbsolute=!0,i.push(l),e.BaseURL.push(l));else for(var p=0;p<n.length;p++){var h=n[p].toString();"/"!==n[p].url[n[p].url.length-1]&&(h+="/");var d=m.URLHelper.concatUrlParts(h,l);this.xS(e.BaseURL,d)||((r=new x).url=d,r.parentIds={},void 0!==t[0]&&null!==t[0]&&(r.parentIds.PeriodID=t[0]),void 0!==t[1]&&null!==t[1]&&(r.parentIds.AdaptationSetID=t[1]),void 0!==t[2]&&null!==t[2]&&(r.parentIds.RepresentationID=t[2]),r.serviceLocation=l.serviceLocation||n[p].serviceLocation,r.byteRange=l.byteRange||n[p].byteRange,r.availabilityTimeOffset=l.availabilityTimeOffset||n[p].availabilityTimeOffset,r.availabilityTimeComplete=l.availabilityTimeComplete||n[p].availabilityTimeComplete,e.BaseURL.push(r),i.push(r))}}return i},e.prototype.JT=function(e,t,n){var i=[];if(t=t||[],n=n||[],"object"!=typeof e)return e;for(var r in e.hasOwnProperty("BaseURL")&&(i=this.IT(e,n,t,i)),i.length<1&&(i=t),e)if(e.hasOwnProperty(r))if("object"==typeof e[r]&&0!==r.indexOf("_")){Array.isArray(e[r])||(e[r]=[e[r]]);for(var s=0;s<e[r].length;s++)if("BaseURL"!==r){var o=e[r][s]._id||s+"";e[r][s]=this.JT(e[r][s],i,n.concat([o])),"Representation"!==r||e[r][s].hasOwnProperty("BaseURL")||(e[r][s].BaseURL=i)}}else 0!==r.indexOf("_")||!S.test(r)&&"_streamName"!==r||(e._label=e[r],"_label"!==r&&delete e[r]);return e},e.prototype.KT=function(e){var t=h.DurationConverter.getDurationInSec(e._timeShiftBufferDepth);return(t=isNaN(t)?Number.NEGATIVE_INFINITY:-t)>0&&t<this.lS.bufferSettings.getForwardTargetLevel()&&(t=this.lS.bufferSettings.getForwardTargetLevel()),t},e.ensureObjectArray=function(e){return null==e?[]:(Array.isArray(e)?e:[e]).filter(function(e){return"object"==typeof e&&null!==e})},e.fillInMissingIds=function(t){t.Period=e.ensureObjectArray(t.Period);for(var n=[],i=[],r=0,s=t.Period;r<s.length;r++){(p=s[r]).AdaptationSet=e.ensureObjectArray(p.AdaptationSet);for(var o=0,a=p.AdaptationSet;o<a.length;o++)(c=a[o]).Representation=e.ensureObjectArray(c.Representation),n.push(c),i.push.apply(i,c.Representation)}e.assignMissingIds(t.Period),e.assignMissingIds(n),e.assignMissingIds(i);for(var u=0,l=t.Period;u<l.length;u++)for(var p,h=0,d=(p=l[u]).AdaptationSet;h<d.length;h++){var c;(c=d[h])._periodId=p._id}},e.assignMissingIds=function(e){for(var t=e.map(function(e){return e._id}).filter(function(e){return Boolean(e)}),n=0,i=0,r=e;i<r.length;i++){var s=r[i];if(!s._id){do{n++}while(t.includes(""+n));s._id=""+n,t.push(s._id)}}},e.prototype.LT=function(e){return"dynamic"===e._type&&(e._timeShiftBufferDepth=this.KT(e)),e},e.prototype.MT=function(e){return e._publishTime&&(e._publishTime=new Date(e._publishTime).getTime()),e},e.prototype.NT=function(e,t){return e.hasOwnProperty("Location")?Array.isArray(e.Location)||(e.Location=[e.Location]):e.Location=[t],e},e.prototype.OT=function(e){e.hasOwnProperty("BaseURL")&&!Array.isArray(e.BaseURL)&&(e.BaseURL=[e.BaseURL]);for(var t=[],n=0;n<e.Location.length;n++){var i=e.Location[n],r=new x;r.url=m.URLHelper.removeLastPathPart(i),t.push(r)}return this.JT(e,t,null)},e.prototype.PT=function(e,t){t._start?t.start=h.DurationConverter.getDurationInSec(t._start):(t.start=e.start+e.duration,t._start="PT"+t.start+"S")},e.prototype.QT=function(e){for(var t={start:0,duration:0,_start:"PT0S",_duration:"PT0S"},n=0;n<e.Period.length;n++){var i=e.Period[n];this.PT(t,i),i._duration?i.duration=h.DurationConverter.getDurationInSec(i._duration):(e.Period[n+1]?i.duration=(h.DurationConverter.getDurationInSec(e.Period[n+1]._start)||0)-i.start:e._mediaPresentationDuration?i.duration=(h.DurationConverter.getDurationInSec(e._mediaPresentationDuration)||0)-i.start:i.duration=1/0,i._duration="PT"+i.duration+"S"),e.Period[n]=i,t=i}return e},e.prototype.RT=function(e){for(var t,n,i=this,r=[],u=[],l=h.DurationConverter.getDurationInSec(e._mediaPresentationDuration),p=function(p){var c=e.Period[p];for(var m in t=h.DurationConverter.getDurationInSec(c._start),n=h.DurationConverter.getDurationInSec(c._duration),isNaN(t)&&0===u.length&&"static"===e._type&&(t=0),isNaN(t)&&u.length>0&&!isNaN(parseFloat(u[u.length-1].start))&&!isNaN(parseFloat(u[u.length-1].duration))&&(t=u[u.length-1].start+u[u.length-1].duration),isNaN(t)&&p===e.Period.length-1&&!isNaN(l)&&(n=l-t),u.length>0&&isNaN(parseFloat(u[u.length-1].duration))&&!isNaN(t)&&(u[u.length-1].duration=t-u[u.length-1].start),u.push({start:t,duration:n}),c)if(c.hasOwnProperty(m)&&["BaseURL","AdaptationSet","EventStream"].includes(m))if(Array.isArray(c[m])||(c[m]=[c[m]]),"AdaptationSet"===m){var g=c[m].map(function(e){var t,n=e._mimeType||(null===(t=e.Representation.find(function(e){return e._mimeType}))||void 0===t?void 0:t._mimeType);return n?f.MimeTypeHelper.extractContentType(n):""}).filter(function(e,t,n){return e&&n.indexOf(e)===t});c[m]=c[m].map(function(e){T(e,c);var t=i.tS(e);return null!==t&&!t.hasOwnProperty("ContentProtection")&&t.Representation[0].hasOwnProperty("ContentProtection")&&(t.ContentProtection=t.Representation[0].ContentProtection),t}).filter(function(e){return Boolean(e)});for(var v=function(e){!c[m].some(function(t){return t._mimeType.includes(e)})&&d.lS.eventHandler.dispatchEvent(a.PlayerEvent.Warning,new s.PlayerWarning(o.WarningCode.SOURCE_CODEC_OR_FILE_FORMAT_NOT_SUPPORTED))},y=0,S=g.filter(function(e){return"audio"===e||"video"===e});y<S.length;y++)v(S[y]);c[m].length<1&&r.push(p)}else if("EventStream"===m)for(var I=0,R=c[m].filter(function(e){return e.Event});I<R.length;I++)for(var _=0,P=R[I].Event;_<P.length;_++){var b=P[_];b.rawXmlRepresentation=d.pS({event:b})}},d=this,c=0;c<e.Period.length;c++)p(c);return r.length>0&&"static"===e._type&&this.ST(r,u,l,e),e=this.QT(e)},e.prototype.ST=function(e,t,n,i){for(var r,s,o;!isNaN(parseInt(r=e.pop()));){if(s=t[r].start,o=t[r].duration,!isNaN(s)&&!isNaN(o)){isNaN(n)||(n-=o,i._mediaPresentationDuration="PT"+n+"S");for(var a=r+1;a<t.length;a++)isNaN(parseFloat(t[a].start))||(t[a].start=t[a].start-o,i.Period[a]._start="PT"+t[a].start+"S")}t.splice(r,1),i.Period.splice(r,1)}},e.parseUTCTimingInformation=function(e,t){var n,i,r,s;e.hasOwnProperty("UTCTiming")&&!Array.isArray(e.UTCTiming)&&(e.UTCTiming=[e.UTCTiming]);for(var o=[],a=function(a){var u={schemeIdUri:a._schemeIdUri,value:""};if("string"==typeof a._value)if(u.schemeIdUri.startsWith("urn:mpeg:dash:utc:http")){var l=null!==(r=null===(i=null===(n=e.BaseURL)||void 0===n?void 0:n[0])||void 0===i?void 0:i.url)&&void 0!==r?r:m.URLHelper.removeLastPathPart(t);u.value=(null!==(s=a._value.match(/\S+/g))&&void 0!==s?s:[a._value]).map(function(e){return m.URLHelper.concatBaseUrlWithPartial(l,e)}).join(" ")}else u.value=a._value;o.push(u)},u=0,l=(e.UTCTiming||[]).filter(function(e){return e.hasOwnProperty("_schemeIdUri")&&"string"==typeof e._schemeIdUri});u<l.length;u++)a(l[u]);return o.length>0?e.UTCTiming=o:delete e.UTCTiming,e},e.prototype.parse=function(t,n,i){var r,s=this.oS(t,{decodeEntities:!0});if(!1===s.success)throw new u.PlayerError(u.ErrorCode.SOURCE_MANIFEST_INVALID,{errorMessage:s.error.message},"DASH manifest is not a valid XML",this.mS.sourceIdentifier);var o=s.parsed.MPD;return o._requestTimestamp=Date.now(),o._downloadTime=i,o._type=null!==(r=o._type)&&void 0!==r?r:"static",e.fillInMissingIds(o),function(e){return e.Period.some(function(e){return e.AdaptationSet.some(function(e){return e.Representation.some(function(t){var n;return Boolean(null!==(n=t._mimeType)&&void 0!==n?n:e._mimeType)})})})}(o)?(o=this.LT(o),o=this.MT(o),o=this.NT(o,n),o=this.OT(o),o=this.RT(o),(o=e.parseUTCTimingInformation(o,n)).originalDashManifest=t,o):(this.lS.eventHandler.fireError(new u.PlayerError(u.ErrorCode.SOURCE_MANIFEST_INVALID,void 0,"DASH manifest contains no representations",this.mS.sourceIdentifier)),null)},e.prototype.dispose=function(){this.nS=null},e}();function T(e,t){if(e&&t)for(var n=["SegmentBase","SegmentList","SegmentTemplate"],r=0,s=n;r<s.length;r++){var o=s[r],a=Array.isArray(e[o])&&e[o][0],u=Array.isArray(t[o])&&t[o][0],l=n.find(function(t){return e[t]});u&&a?e[o]=[i(i({},t[o][0]),e[o][0])]:u&&!l&&(e[o]=t[o])}}function _(e){var t=e.split("/");return parseInt(t[0])/(parseInt(t[1])||1)}function P(e,t){return e.S.reduce(function(e,t){var n;return e+Number(t._d)*(Number(null!==(n=t._r)&&void 0!==n?n:"0")+1)},0)/t}function b(e){"string"==typeof e._audioSamplingRate&&(e._audioSamplingRate=parseFloat(e._audioSamplingRate))}function L(e,t){"string"==typeof e._height&&(e._height=parseFloat(e._height)),"string"==typeof e._width&&(e._width=parseFloat(e._width)),"string"==typeof e._frameRate&&(e._frameRate=_(e._frameRate)),e._dynamicRange=function(e,t){var n,i,s,o,a=r(r(r(r([],null!==(n=e.EssentialProperty)&&void 0!==n?n:[],!0),null!==(i=e.SupplementalProperty)&&void 0!==i?i:[],!0),null!==(s=t.EssentialProperty)&&void 0!==s?s:[],!0),null!==(o=t.SupplementalProperty)&&void 0!==o?o:[],!0).filter(function(e){return e._schemeIdUri===y.DashSchemeUri.TransferCharacteristics}).map(function(e){var t=e._value;return(0,d.getDynamicRangeFromTransferCharacteristics)(parseInt(null!=t?t:"",10))}).find(function(e){return e!==l.VideoDynamicRange.Unknown});if(void 0!==a)return a;var u=p.CodecStringHelper.getExtractedCodecStrings(e._codecs||t._codecs);return(0,d.getDynamicRangeFromVideoCodec)(u.video)}(e,t)}function N(e){return"string"==typeof e?[{value:e}]:Array.isArray(e)?e.map(function(e){return{id:e._id,lang:e._lang,value:e.toString()}}):[]}function O(e){var t;return"http://dashif.org/guidelines/trickmode"===(null===(t=null==e?void 0:e[0])||void 0===t?void 0:t._schemeIdUri)}t.MPDParser=R;var x=function(){function e(){this.url=null,this.parentIds=null,this.serviceLocation=null,this.byteRange=null,this.availabilityTimeOffset=null,this.availabilityTimeComplete=null,this.isAbsolute=!1,this.customAttributes=null}return e.prototype.toString=function(){return this.url?""+this.url:""},e}();t.BaseURL=x},66759:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.DASHModuleDefinition=void 0;var i=n(62756),r=n(96693),s=n(44908),o=n(4771),a=n(63889),u=n(12054),l=n(31439),p={isIndexRangeNode:r.isIndexRangeNode,isInitializationNode:r.isInitializationNode,isInitializationStringNode:r.isInitializationStringNode},h={provideSegmentInfoFromInitializationProperty:r.provideSegmentInfoFromInitializationProperty,provideSegmentInfoFromInitializationNodeProperty:r.provideSegmentInfoFromInitializationNodeProperty,provideSegmentInfoFromIndexRangeProperty:r.provideSegmentInfoFromIndexRangeProperty};t.DASHModuleDefinition={name:i.ModuleName.DASH,module:function(){return{MPDLoader:s.MPDLoader,SegmentBaseMPDHandler:a.SegmentBaseMPDHandler,SegmentTemplateMPDHandler:u.SegmentTemplateMPDHandler,SegmentTimelineMPDHandler:l.SegmentTimelineMPDHandler,replaceAllPlaceholders:o.default,initSegmentInfoSourceDetectors:p,initSegmentInfoProviders:h}},dependencies:[i.ModuleName.EngineBitmovin,i.ModuleName.XML]},t.default=t.DASHModuleDefinition},63889:function(e,t,n){var i=this&&this.__assign||function(){return i=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},i.apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.SegmentBaseMPDHandler=void 0;var r=n(40306),s=n(3336),o=n(80813),a=n(56481),u=n(4129),l=n(77401),p=n(29669),h=n(79721),d=n(84568),c=n(58313),f=n(88052),m=n(62756),g=n(13422),v=n(59707),y=n(96693),S=function(){function e(e,t){var n=this;this.context=e,this.er=0,this.gr=-1,this.Bs=null,this.Cs=(0,d.memoize)(this.Qs.bind(this),function(e,t){return t._internalId.representationId}),this.Ds=function(e){var t=i({},n.nr.getRepresentationById(n.jr));return n.Cs(e,t).then(function(e){if(n.zs.dispatch((0,v.setRepresentationSegmentIndexAction)(t._internalId,e)),n.zs.dispatch((0,v.setRepresentationIsLoadingAction)(t._internalId,!1)),e||n.zs.dispatch((0,v.setRepresentationSegmentIndexParsingErrorAction)(t._internalId,!0)),n.gr>=0){var i=n.gr;n.gr=-1,n.seekTo(i)}return n.mr=null,n.jr}).catch(function(e){throw n.Cs.invalidate(),e})},this.Es=function(e){n.mr=null;var t=n.Fs(e);return n.lr&&(n.lr.reject(t),n.lr=null),Promise.reject(t)},this.Js=function(e){return n.lr?Promise.reject("fail"):new Promise(function(t,r){n.lr=i(i({},e),{resolve:t,reject:r})})},this.cr=e.settings;var r=t.sourceIdentifier;this.As=r,this.nr=e.serviceManager.get(o.ServiceName.ManifestService,r);var s=this.nr.getFirstPeriod()||{_id:h.DEFAULT_PERIOD_ID};this.dr=s._id;var a=this.cr.MAX_RETRIES;this.kr=new u.DefaultContentLoader(e,{maxRetries:a,retryDelay:this.cr.RETRY_DELAY,requestType:p.HttpRequestType.MEDIA_SEGMENTINDEX,onSuccess:function(){n.Bs=null},onFailure:function(e,t){var i;n.Bs=null!==(i=null==t?void 0:t.name)&&void 0!==i?i:null}}),this.zs=e.serviceManager.get(o.ServiceName.SourceStoreService,r)}return e.prototype.Fs=function(e){if(this.Bs===l.RequestError.Canceled)return l.RequestError.Canceled;var t=this.Bs===l.RequestError.TimedOut?r.ErrorCode.NETWORK_SEGMENT_DOWNLOAD_TIMEOUT:r.ErrorCode.NETWORK_ERROR,n=e;return new s.PlayerError(t,{url:null==n?void 0:n.url,statusCode:null==n?void 0:n.status},"Failed to load the segment index",this.As)},e.prototype.Gs=function(e){var t,n,i=this.nr.getRepresentationById(e);if(i&&i.segmentIndex){var r=this.nr.getPeriodDuration(this.dr);isFinite(r)&&(n=r/i.segmentIndex.references.length);var s=this.nr.getMediaPresentationDuration();0!==s&&(isFinite(s)&&(t=s/i.segmentIndex.references.length),n||(n=t)),i.segmentIndex&&(t=i.segmentIndex.references[0].duration/i.segmentIndex.timescale,n||(n=t))}return n},e.prototype.Hs=function(){var e,t,n=this.nr.getRepresentationById(this.hr);if(null===(t=null===(e=null==n?void 0:n.segmentIndex)||void 0===e?void 0:e.references)||void 0===t?void 0:t.length){var i=n.segmentIndex.timescale||1,r=n.segmentIndex.references[this.er].time/i,s=this.getTimestampOffset(),o={url:"",byteRange:n.segmentIndex.references[this.er].byteRange,periodId:n._internalId.periodId,presentationTimeOffset:s,startTime:r-s};return this.er++,this.fr=Math.floor(this.er*this.getSegmentDuration())+this.Ns(),o}},e.prototype.getInitSegmentInfo=function(e){var t=this.nr.getRepresentationById(e);return t&&t.SegmentBase&&t.BaseURL?i(i({},this.Is(t)),{codecs:(0,g.getCodecsFromAdaptationSet)(this.nr.getAdaptationSet(e))}):null},e.prototype.Is=function(e){var t=e.SegmentBase[0];return(0,y.isInitializationNode)(t)?(0,y.provideSegmentInfoFromInitializationNodeProperty)(t,e):e.segmentIndex&&(0,y.isIndexRangeNode)(t)?(0,y.provideSegmentInfoFromIndexRangeProperty)(t,e):null},e.prototype.resolvePendingSegmentInfoRequests=function(){if(this.lr){var e=this.Hs();e&&(this.lr.resolve(e),this.lr=null)}},e.prototype.setAdaptationSetId=function(e){this.ir=e,this.ys=e.adaptationSetId.split("-")[0],this.Ks(),this.resolvePendingSegmentInfoRequests()},e.prototype.Ks=function(){var e,t=this,n=this.nr.getRepresentationById(this.hr);n&&(e=n._bandwidth);var i=this.nr.getMatchingRepresentationsByBandwidth(this.ir,e),r=this.hr?i.find(function(e){return e._internalId===t.hr}):null,s=null!=r?r:i[0];this.hr=s._internalId,this.dr=this.hr.periodId,s.hasOwnProperty("SegmentBase")&&s.SegmentBase.length},e.prototype.setRepresentationId=function(e){return!!this.nr.getRepresentationById(e)&&(this.hr=e,this.seekTo(this.fr),!0)},e.prototype.getSegmentInfos=function(){var e=this.getSeekableRange();return this.Ls(e)},e.prototype.Ls=function(e){var t=this,n={};return this.nr.getAdaptationSet(this.ir).Representation.forEach(function(i){var r=i._id;if(n[r]=[],1===i.BaseURL.length){var s=i.BaseURL[0].url;n[r].push({url:c.URLHelper.appendQueryParametersToUrl(s,t.cr.QUERY_PARAMETERS)})}else for(var o=0;o<i.BaseURL.length;o++)s=c.URLHelper.appendQueryParametersToUrl(i.BaseURL[o].url,t.cr.QUERY_PARAMETERS),n[r].push({url:s});n[r].forEach(function(t){t.duration=e.end-e.start,t.startTime=e.start})}),n},e.prototype.getNextSegmentInfo=function(e){var t=this.Hs();return t?Promise.resolve(t):this.Js({time:e})},e.prototype.getSubtitleUrl=function(){var e=this.nr.getAvailableBaseURLsForRepresentation(this.hr);return e?e[0]:null},e.prototype.getStartNumber=function(){},e.prototype.getLiveEdgeTime=function(){return-1},e.prototype.getActualTimeShiftBufferDepth=function(){return this.nr.getTimeShiftBufferDepthSeconds()},e.prototype.Ms=function(){var e,t=this;return this.nr.getRepresentationById(this.hr)&&(e=this.Gs(this.hr)),e<0&&(e=this.nr.getAdaptationSet(this.ir).Representation.map(function(e){return t.Gs(e._internalId)}).find(function(e){return e>0})),isFinite(e)?[e,!0]:[1,!1]},e.prototype.getSegmentDuration=function(){return this.Ms()[0]},e.prototype.hasNext=function(){this.resolvePendingSegmentInfoRequests();var e=this.nr.getRepresentationById(this.hr);if(e){if(e.segmentIndex)return this.er<e.segmentIndex.references.length;if(!this.isSegmentInfoLoaded(this.hr))return!0}return!1},e.prototype.Ns=function(){var e,t,n;return null!==(n=null===(t=null===(e=this.nr)||void 0===e?void 0:e.findPeriod(this.dr))||void 0===t?void 0:t.start)&&void 0!==n?n:0},e.prototype.seekTo=function(e){var t;this.fr=e;var n=this.Ms(),i=n[0],r=n[1];if((i<0||!r)&&(this.gr=e),i>0&&r&&e>-1){var s=Math.max(e-this.Ns(),0),o=null===(t=this.nr)||void 0===t?void 0:t.getRepresentationById(this.hr);this.hr&&o&&this.setIndex(Math.floor(s/i))}},e.prototype.getTimestampOffset=function(){var e=this.nr.findPeriod(this.dr),t=this.nr.getRepresentationById(this.hr),n=t&&t.SegmentBase?t.SegmentBase[0]:null,i=0;if(n&&n.hasOwnProperty("_presentationTimeOffset")&&n.hasOwnProperty("_timescale")){var r=n.hasOwnProperty("_timescale")?parseInt(n._timescale):1;i=parseInt(n._presentationTimeOffset)/r}return e&&(i-=e.start),i},e.prototype.getIndex=function(){return this.er},e.prototype.setIndex=function(e){this.er=e},e.prototype.timeShift=function(e){},e.prototype.updateRepresentation=function(e){var t=this;if(this.isSegmentInfoLoaded(e))return Promise.resolve(e);if(this.mr)return this.mr;var n=this.nr.getRepresentationById(e);if(!n)return Promise.reject(null);var i=(0,y.extractBaseUrlFromRepresentation)(n),r=n.SegmentBase[0]._indexRange,s=parseInt(r.split("-")[1])+1;return this.zs.dispatch((0,v.setRepresentationAnchorPointAction)(n._internalId,s)),this.jr=e,this.mr=this.kr.load(i,p.HttpRequestMethod.GET,p.HttpResponseType.ARRAYBUFFER,void 0,{Range:"bytes="+r}).then(function(e){return t.Ds(e.body)}).catch(this.Es),this.mr},e.prototype.isSegmentInfoLoaded=function(e){return this.nr.isSegmentInfoLoaded(e)},e.prototype.rewindOneSegment=function(){return this.er--,!(this.er<0&&(this.setIndex(0),1))},e.prototype.getSeekableRange=function(){return{start:0,end:this.nr.getMediaPresentationDuration()}},e.prototype.getPendingSegmentInfoRequest=function(){return this.lr},e.prototype.setPendingSegmentInfoRequest=function(e){this.lr=e},e.prototype.canSwitchRepresentation=function(e){return!0},e.prototype.getLatestTimeForPossibleSwitch=function(e){return e},e.prototype.adjustTimeToNextSegmentStart=function(e){return e},e.prototype.dispose=function(){this.cr=null,this.nr=null,this.hr=null,this.zs=null,this.kr=(0,a.dispose)(this.kr),this.lr=null,this.Cs=null},e.prototype.setTimestampOffset=function(e,t){},e.prototype.Os=function(){return this.context.serviceManager.get(o.ServiceName.SegmentService).get(this.ys).getSegment(this.getInitSegmentInfo(this.jr)).then(function(e){return e.read()}).then(function(e){return e.value})},e.prototype.Ps=function(e,t){return this.Os().then(function(n){var i=f.ModuleManager.get(m.ModuleName.ContainerWebM).WebMSegmentIndex,r=f.ModuleManager.get(m.ModuleName.ContainerWebM).WebMInitFile,s=new i(e),o=new r(n.getData()).segment.segmentInfo,a=function(e,t,n){for(var i=e.cues.flatMap(function(e){return e.cuePoints}),r=new Array(i.length),s=t-function(e){var t=e.cues&&e.cues[0],n=t&&t.cuePoints&&t.cuePoints[0],i=n&&n.trackPositions&&n.trackPositions[0];return i&&i.clusterPosition||0}(e),o=i.length-1;o>=0;o--)r[o]={time:i[o].time,byteRange:{start:s+i[o].trackPositions[0].clusterPosition}},o===i.length-1?r[o].duration=n-r[o].time:(r[o].byteRange.end=r[o+1].byteRange.start-1,r[o].duration=r[o+1].time-r[o].time);return r}(s,parseInt(t.SegmentBase[0]._indexRange.split("-")[1])+1,o.getDuration()/o.getTimecodeScale());return{timescale:o.getTimecodeScale(),references:a}})},e.prototype.Qs=function(e,t){return"webm"===this.ys.split("/")[1]?this.Ps(e,t):Promise.resolve(this.Rs(e,t.anchorPoint))},e.prototype.Rs=function(e,t){if(!e||!t)return null;var n=f.ModuleManager.get(m.ModuleName.ContainerMP4).parseBuffer(e).boxes.find(function(e){return"sidx"===e.type});return n?{timescale:n.timescale,references:I(n.references,n.first_offset+t,n.earliest_presentation_time)}:null},e}();function I(e,t,n){for(var i=[],r=0,s=e;r<s.length;r++){var o=s[r],a=o.referenced_size,u=o.subsegment_duration,l=t,p=l+a-1;i.push({byteRange:{start:l,end:p},time:n,duration:u}),t+=a,n+=u}return i}t.SegmentBaseMPDHandler=S},12054:function(e,t,n){var i=this&&this.__assign||function(){return i=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},i.apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.SegmentTemplateMPDHandler=void 0,t.getTimescaleFromTemplate=f;var r=n(80813),s=n(77179),o=n(89927),a=n(23068),u=n(58313),l=n(16197),p=n(54053),h=n(96693),d=n(4771),c=function(){function e(e,t){this.context=e,this.sourceContext=t,this.settings=e.settings,this.manifestService=e.serviceManager.get(r.ServiceName.ManifestService,t.sourceIdentifier),this.time=0}return e.prototype.getStartNumber=function(){var e=this.getTemplate(this.currentRepresentationId);return e&&e.hasOwnProperty("_startNumber")?parseInt(e._startNumber):1},e.prototype.Ts=function(){var e=this.getTemplate(this.currentRepresentationId);return e&&e._endNumber?parseInt(e._endNumber):NaN},e.prototype.setAdaptationSetId=function(e,t,n){void 0===t&&(t=null),void 0===n&&(n={isManifestUpdate:!1}),this.currentAdaptationSetId=e,this.currentRepresentationId=t;var i=!this.currentRepresentationId||Boolean(this.manifestService.getRepresentationById(this.currentRepresentationId)),r=this.manifestService.getAdaptationSet(this.currentAdaptationSetId);this.currentRepresentationId&&i||(this.currentRepresentationId=r.Representation[0]._internalId),this.getTemplate(this.currentRepresentationId)&&(this.Ss||this.setIndex(this.getStartNumber())),this.resolvePendingSegmentInfoRequests()},e.prototype.getCurrentPeriod=function(){return this.manifestService.getPeriod(this.currentRepresentationId||this.currentAdaptationSetId)},e.prototype.setRepresentationId=function(e){return!!this.manifestService.getRepresentationById(e)&&(this.currentRepresentationId=e,!0)},e.prototype.getInitSegmentInfo=function(e){var t=this.getTemplate(e),n=this.manifestService.getRepresentationById(e);return(0,h.isInitializationStringNode)(t)?(0,h.provideSegmentInfoFromInitializationProperty)(t,n):null},e.prototype.Us=function(){var e=this.getTemplate(this.currentRepresentationId);return parseFloat(e._availabilityTimeOffset)||0},e.prototype.Vs=function(e){var t=this.getExpectedPresentationTime(e);return t-=this.Us(),(0,o.toMilliSeconds)(t+this.getSegmentDuration()+this.settings.LIVE_EDGE_DISTANCE)},e.prototype.getTemplate=function(e){var t=this.manifestService.getRepresentationById(e);if(null==t?void 0:t.SegmentTemplate)return t.SegmentTemplate[0]},e.prototype.Ws=function(){var e;return(null===(e=this.getCurrentPeriod())||void 0===e?void 0:e.start)||0},e.prototype.isExpectedSegmentPlaybackTimeExceedingPeriodDuration=function(e){var t=this.Ts();if(isFinite(t))return e>t;var n=this.getCurrentPeriod(),i=Boolean(null==n?void 0:n._duration)?n.start+n.duration:1/0;return this.getExpectedPresentationTime(e)>=i},e.prototype.checkIfSegmentAvailable=function(e){return this.Vs(e)<=Date.now()},e.prototype.getNextSegmentInfo_=function(){var e={isInitSegment:!1,presentationTimeOffset:this.getTimestampOffset()},t=this.getTemplate(this.currentRepresentationId);if(!t||!t._media||!this.manifestService.representationExists(this.currentRepresentationId))return null;if(this.manifestService.isLive()){var n=this.checkIfSegmentAvailable(this.Ss),i=this.isExpectedSegmentPlaybackTimeExceedingPeriodDuration(this.Ss);if(!n||i)return null;e.wallClockTime=this.Vs(this.Ss)-(0,o.toMilliSeconds)(this.getSegmentDuration())}var r=this.manifestService.getRepresentationById(this.currentRepresentationId);return e.periodId=null==r?void 0:r._internalId.periodId,e.url=(0,d.default)(t._media,r,this.Ss,this.time),e.segmentNumber=this.Ss,e.startTime=this.getExpectedPresentationTime(this.Ss),this.setIndex(this.Ss+1),e},e.prototype.getNextSegmentInfo=function(e){var t=this.getNextSegmentInfo_();return t?Promise.resolve(t):this.queueSegmentInfoRequest({time:e})},e.prototype.queueSegmentInfoRequest=function(e){var t=this;return this.pendingSegmentInfoRequest?Promise.reject("fail"):new Promise(function(n,r){t.pendingSegmentInfoRequest=i(i({},e),{resolve:n,reject:r})})},e.prototype.resolvePendingSegmentInfoRequests=function(){if(this.pendingSegmentInfoRequest){var e=this.getNextSegmentInfo_(),t=this.isExpectedSegmentPlaybackTimeExceedingPeriodDuration(this.Ss);e?(this.pendingSegmentInfoRequest.resolve(e),this.pendingSegmentInfoRequest=null):t&&(this.pendingSegmentInfoRequest.reject(p.SegmentInfoError.SEGMENT_EXCEEDING_PERIOD_DURATION),this.pendingSegmentInfoRequest=null)}},e.prototype.getSegmentInfos=function(e){var t=this,n={};return this.manifestService.getAdaptationSet(this.currentRepresentationId).Representation.forEach(function(i){var r,s,o,a=i._internalId,l=t.getTemplate(a),p=[],h=t.getSeekableRange().end-t.getSeekableRange().start,c=0,f=t.manifestService.isLive();f?(o=t.time-h,r=t.Ss-h/t.getSegmentDuration(),s=t.Ss):(o=l._presentationTimeOffset||0,r=0,s=parseInt(r+h/t.getSegmentDuration()));for(var m=r;m<=s;m++){var g={};g.duration=t.getSegmentDuration(),g.startTime=f?t.getExpectedPresentationTime(m):c*t.getSegmentDuration();var v=(0,d.default)(l._media,i,r+c,o+c*t.getSegmentDuration());g.url=e?u.URLHelper.concatBaseUrlWithPartial(e,v):v,g.url=u.URLHelper.appendQueryParametersToUrl(g.url,t.settings.QUERY_PARAMETERS),p.push(g),c++}n[a.representationId]=p}),n},e.prototype.getSubtitleUrl=function(){var e=this.manifestService.getRepresentationById(this.currentRepresentationId).BaseURL[0];return e.url||e},e.prototype.Xs=function(){var e=this.getTemplate(this.currentRepresentationId);return e&&e.hasOwnProperty("_liveEdgeNumber")},e.prototype.Ys=function(){if(this.Xs()){var e=this.getTemplate(this.currentRepresentationId);return parseInt(e._liveEdgeNumber)}},e.prototype.getSegmentDuration=function(){var e=this.getTemplate(this.currentRepresentationId),t=Number(null==e?void 0:e._duration),n=Number(null==e?void 0:e._timescale);return isNaN(t)?1:isNaN(n)?t:t/n},e.prototype.seekTo=function(e){e>-1&&this.setIndex(this.Zs(e))},e.prototype.getTimescale=function(){return f(this.getTemplate(this.currentRepresentationId))},e.prototype.getExpectedPresentationTime=function(e){var t=this.Ws();return(e-this.getStartNumber())*this.getSegmentDuration()+t},e.prototype.Zs=function(e){var t=this.getSegmentDuration(),n=this.Ws(),i=Math.max(e-n-t/2,0);return Math.floor(i/t)+this.getStartNumber()},e.prototype.getActualTimeShiftBufferDepth=function(){var e=this.bs();return e.end-e.start},e.prototype.bs=function(){var e=(0,s.getStartTimeOffset)(this.cs().getState()),t=this.manifestService.getMediaPresentationDuration()||1/0;return this.manifestService.isLive()?this.es(t):this.ds(e,t)},e.prototype.cs=function(){return this.context.serviceManager.get(r.ServiceName.SourceStoreService,this.sourceContext.sourceIdentifier)},e.prototype.ds=function(e,t){return{start:e,end:isFinite(t)?e+t:0}},e.prototype.es=function(e){var t=(this.manifestService.getFirstPeriod()||{start:0}).start,n=-1*this.manifestService.getTimeShiftBufferDepthSeconds(),i=(0,o.toSeconds)(Date.now()-this.manifestService.getAvailabilityStartTime()),r=Math.min(n,i),s=this.getLiveEdgeTime();return{start:Math.max(t,s-r),end:s}},e.prototype.getSeekableRange=function(){var e=this.bs();if(this.manifestService.isLive()){var t=this.manifestService.getDesiredDistanceToLiveEdge();e.end=Math.max(e.end-t,e.start)}return e},e.prototype.hasNext=function(e){var t=this.isExpectedSegmentPlaybackTimeExceedingPeriodDuration(this.Ss),n=Math.ceil(e/this.getSegmentDuration())+this.getStartNumber()-1;return!t&&this.Ss<=n},e.prototype.getTimestampOffset=function(){var e=this.getCurrentPeriod(),t=0,n=this.getTemplate(this.currentRepresentationId);return n&&n._presentationTimeOffset&&(t=n._presentationTimeOffset/this.getTimescale()),e&&(t-=e.start),t},e.prototype.fs=function(e,t){var n=this.manifestService.getPeriod(e)||this.getCurrentPeriod();return this.manifestService.isLastPeriod(e.periodId)?n&&(0,a.isNumber)(n.duration)&&isFinite(n.duration)?n.duration:n&&n.start?(0,o.toSeconds)(t)-n.start:this.manifestService.calculateCumulativePeriodDuration(e.periodId):this.manifestService.getPeriodDuration(e.periodId)},e.prototype.gs=function(e){var t=Date.now(),n=(0,o.toSeconds)(t-this.manifestService.getRequestTimestamp());return this.Xs()?this.Ys()+Math.floor(n/this.getSegmentDuration()):this.manifestService.isLive()&&Boolean(this.manifestService.getManifest()._availabilityStartTime)?Math.floor(this.fs(e,t)/this.getSegmentDuration()+this.getStartNumber()):this.getStartNumber()},e.prototype.hs=function(e){return Math.max(this.gs(e),this.getStartNumber())},e.prototype.getIndex=function(){return this.Ss},e.prototype.setIndex=function(e){this.Ss=e},e.prototype.getLiveEdgeTime=function(){return(0,o.toSeconds)(Date.now())},e.prototype.timeShift=function(e,t){if(void 0===t&&(t=this.currentRepresentationId.periodId),this.manifestService.isLive()){this.Ss;var n=this.hs(new l.PeriodId(t));0===e?this.setIndex(n):(this.setIndex(n+Math.floor(e/this.getSegmentDuration())),this.Ss<this.getStartNumber()&&this.setIndex(this.getStartNumber()))}},e.prototype.updateRepresentation=function(e){return this.currentRepresentationId=e,Promise.resolve(e)},e.prototype.isSegmentInfoLoaded=function(e){return!0},e.prototype.rewindOneSegment=function(){return this.setIndex(this.Ss-1),this.Ss<this.getStartNumber()&&this.setIndex(this.getStartNumber()),!0},e.prototype.getPendingSegmentInfoRequest=function(){return this.pendingSegmentInfoRequest},e.prototype.setPendingSegmentInfoRequest=function(e){this.pendingSegmentInfoRequest=e},e.prototype.canSwitchRepresentation=function(e){return!0},e.prototype.getLatestTimeForPossibleSwitch=function(e){return e},e.prototype.adjustTimeToNextSegmentStart=function(e){return e},e.prototype.dispose=function(){this.settings=null,this.manifestService=null,this.currentRepresentationId=null,this.currentAdaptationSetId=null,this.pendingSegmentInfoRequest=null},e.prototype.setTimestampOffset=function(e,t){},e}();function f(e){return e&&null!=e._timescale&&parseInt(e._timescale)||1}t.SegmentTemplateMPDHandler=c},31439:function(e,t,n){var i=this&&this.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),r=this&&this.__assign||function(){return r=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},r.apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.SegmentTimelineMPDHandler=void 0;var s=n(74853),o=n(89927),a=n(58313),u=n(54053),l=n(4771),p=n(12054),h=n(39761),d=function(e){function t(t,n){var i=e.call(this,t,n)||this;return i.is=0,i.js=null,i.ks=[],i.ls=!0,i.ps=!1,i.ms=1,i.ns=0,i.os=0,i}return i(t,e),t.prototype.setAdaptationSetId=function(t,n,i){void 0===n&&(n=null),void 0===i&&(i={isPeriodSwitch:!1,isManifestUpdate:!1}),this.currentAdaptationSetId=t,this.currentRepresentationId=n;var r=!this.currentRepresentationId||Boolean(this.manifestService.getRepresentationById(this.currentRepresentationId)),s=this.manifestService.getAdaptationSet(this.currentAdaptationSetId);this.currentRepresentationId&&r||(this.currentRepresentationId=s.Representation[0]._internalId);var o=this.getTemplate(this.currentRepresentationId);o&&(this.setTimeline(o,i.isPeriodSwitch),this.getIndex()||e.prototype.setIndex.call(this,this.getStartNumber())),this.resolvePendingSegmentInfoRequests()},t.prototype.setRepresentationId=function(e){if(this.manifestService.getRepresentationById(e)){this.currentRepresentationId=e;var t=this.getTemplate(this.currentRepresentationId);return t&&this.setTimeline(t),!0}return!1},t.prototype.qs=function(e){return null!=(null==e?void 0:e.start)&&isFinite(e.start)?e.start:0},t.prototype.rs=function(){this.manifestService.isLive()&&this.ls&&(this.ps||this.timeShift(0),this.ls=!1)},t.prototype.ss=function(e){return!(null==e?void 0:e._media)||!this.manifestService.representationExists(this.currentRepresentationId)},t.prototype.ts=function(e){var t=this.ks[this.is];t&&(e.wallClockTime=(0,o.toMilliSeconds)(t.ot/this.ms-this.getTimestampOffset()))},t.prototype.getNextSegmentInfo_=function(){var t,n,i={isInitSegment:!1,presentationTimeOffset:this.getTimestampOffset()},r=this.getTemplate(this.currentRepresentationId);if(this.ss(r))return null;if(this.rs(),!(this.ks.length>0&&this.is<this.ks.length))return null;var s=this.ks[this.is];e.prototype.setIndex.call(this,s.i),this.time=s.ot,i.duration=s.duration,i.mediaPresentationTime=s.t,i.segmentNumber=s.i;var o=null!==(n=null===(t=this.getCurrentPeriod())||void 0===t?void 0:t.start)&&void 0!==n?n:0;if(i.startTime=s.playbackTime+o,this.manifestService.isLive()){if(this.isExpectedSegmentPlaybackTimeExceedingPeriodDuration(this.is))return null;this.ts(i)}var a=this.manifestService.getRepresentationById(this.currentRepresentationId);return a?(i.periodId=null==a?void 0:a._internalId.periodId,i.url=(0,l.default)(r._media,a,this.getIndex(),this.time),e.prototype.setIndex.call(this,this.getIndex()+1),this.is++,i):null},t.prototype.getNextSegmentInfo=function(e){var t=this.getNextSegmentInfo_();return t?Promise.resolve(t):this.queueSegmentInfoRequest({time:e})},t.prototype.queueSegmentInfoRequest=function(e){var t=this;return this.pendingSegmentInfoRequest?Promise.reject("fail"):new Promise(function(n,i){t.pendingSegmentInfoRequest=r(r({},e),{resolve:n,reject:i})})},t.prototype.resolvePendingSegmentInfoRequests=function(){if(this.pendingSegmentInfoRequest){var e=this.getNextSegmentInfo_();if(e)this.pendingSegmentInfoRequest.resolve(e),this.pendingSegmentInfoRequest=null;else if(!this.manifestService.isSmoothManifest()){var t=this.getCurrentPeriod();if(isFinite(t.duration)){var n=this.getTimelineDuration(),i=n/this.getTimelineLength(),r=t.start+n,s=t.duration-i/2;isFinite(s)&&r>=s&&(this.pendingSegmentInfoRequest.reject(u.SegmentInfoError.PERIOD_COMPLETE),this.pendingSegmentInfoRequest=null)}}}},t.prototype.getSegmentInfos=function(e){var t=this,n={};return this.manifestService.getAdaptationSet(this.currentRepresentationId).Representation.forEach(function(i){for(var r=i._internalId,s=t.getTemplate(r),o=[],u=t.manifestService.isLive(),p=t.getTimelineLength(),h=0,d=0;d<p;d++){var c=t.ks[d],f={};f.duration=c.duration,u?f.startTime=t.getExpectedPresentationTime(d):(f.startTime=h,h+=c.duration);var m=(0,l.default)(s._media,i,c.i,c.ot);f.url=e?a.URLHelper.concatBaseUrlWithPartial(e,m):m,f.url=a.URLHelper.appendQueryParametersToUrl(f.url,t.settings.QUERY_PARAMETERS),o.push(f)}n[r.representationId]=o}),n},t.prototype.getSubtitleUrl=function(){var e=this.manifestService.getRepresentationById(this.currentRepresentationId).BaseURL[0];return e.url||e},t.prototype.getSegmentDuration=function(){return this.getSegmentDurationCurrentElement()},t.prototype.seekTo=function(t){if(t>-1){var n=this.qs(this.getCurrentPeriod());this.ps=!1,isFinite(n)&&(t-=n);for(var i=1;i<this.ks.length;i++)if(this.ks[i].playbackTime>t)return this.is=i-1,e.prototype.setIndex.call(this,this.ks[this.is].i),this.ls=!1,this.getIndex();this.is=Math.max(this.ks.length-1,0)}return e.prototype.setIndex.call(this,this.ks[this.is].i),this.getIndex()},t.prototype.getExpectedPresentationTime=function(e){var t,n;return(null!==(n=null===(t=this.getCurrentPeriod())||void 0===t?void 0:t.start)&&void 0!==n?n:0)+this.ks[e].playbackTime},t.prototype.hasNext=function(e){if(this.is<this.ks.length){var t=this.ks[0].t,n=this.ks[this.is];if(this.isExpectedSegmentPlaybackTimeExceedingPeriodDuration(this.is))return!1;if(n)return n.t-t<=e*this.ms}return!1},t.prototype.getTimestampOffset=function(){var e=this.getCurrentPeriod(),t=this.ns/this.ms;return e&&(t-=e.start),t},t.prototype.setIndex=function(t){if(e.prototype.setIndex.call(this,t),this.ks&&this.ks.length>0)for(var n=0;n<this.ks.length;n++)this.ks[n].i===t&&(this.is=n)},t.prototype.getLiveEdgeTime=function(){if(!this.manifestService.isLive())return-1;var t=this.manifestService.getLastPeriod(),n=this.getCurrentPeriod();if(null==t||(null==n?void 0:n._id)===t._id)return this.qs(n)+this.us()/this.ms;var i=(0,h.getFirstAvSegmentTemplateFromPeriod)(t);return(null==i?void 0:i.SegmentTimeline)?this.qs(t)+(0,h.calculateTimelineEnd)(i):e.prototype.getLiveEdgeTime.call(this)},t.prototype.us=function(){if(!this.ks.length)return 0;var e=this.ks[this.ks.length-1];return e.t+e.d},t.prototype.timeShift=function(t,n){if(this.manifestService.isLive()&&!(this.ks.length<1)){this.ps=!1;for(var i=this.ks[0].t,r=this.us(),s=t*this.ms,o=Math.max(this.os,this.settings.MIN_TIMELINE_LIVE_OFFSET)*this.ms,a=Math.max(i+o,r+s),u=this.ks.length-1;u>=0;u--)if(this.ks[u].t<=a){this.is=u;break}(this.is>=this.ks.length||this.is<=0)&&(this.is=0),this.ls=!1,e.prototype.setIndex.call(this,this.ks[this.is].i)}},t.prototype.updateRepresentation=function(e){return this.currentRepresentationId=e,Promise.resolve(e)},t.prototype.isSegmentInfoLoaded=function(e){return!0},t.prototype.rewindOneSegment=function(){return this.is--,this.is<0&&(this.is=0),!0},t.prototype.vs=function(e,t){for(var n,i={entries:[],latestTime:0,latestOriginalTime:0,lastPreviousTimelineEntryIndex:0,index:this.getStartNumber()},r=0,s=0,o=0,a=e;o<a.length;o++)for(var u=0,l=null!==(n=a[o].S)&&void 0!==n?n:[];u<l.length;u++){var p=l[u],d=(0,h.parseStringToNumber)(p._r),f=parseInt(p._d);if(p.hasOwnProperty("_t")){var m=(0,h.parseStringToNumber)(p._t);i.latestOriginalTime=m,i.latestTime=m-this.ns}for(;i.latestTime+f<=0&&d>=0;)i.latestTime+=f,i.latestOriginalTime+=f,d--;for(var g=this.It(i,t,f,d),v=0;v<g.length;v++)g[v].i=i.index+v;r+=g.length,c(i,g,f);var y=d-g.length+1;s+=y,c(i,this.xs(i,y,f),f)}return this.ws(r,s),i.entries},t.prototype.ws=function(e,t){},t.prototype.xs=function(e,t,n){for(var i=[],r=0;r<t;r++){var s=e.latestTime+n*r,o={d:n,t:s,ot:e.latestOriginalTime+n*r,i:e.index+r,playbackTime:s/this.ms,duration:n/this.ms};i.push(o)}return i},t.prototype.It=function(e,t,n,i){var r=(0,s.findIndexWithin)(t,e.lastPreviousTimelineEntryIndex,t.length,function(t){return t.t===e.latestTime&&t.d===n});if(-1===r)return[];var o=function(e,t,n,i){for(var r=e[t].t,s=i;s>0;s--){var o=t+s,a=e[o],u=r+n*s;if(a&&a.t===u&&a.d===n)return o}return t}(t,r,n,i);return e.lastPreviousTimelineEntryIndex=o,t.slice(r,o+1)},t.prototype.getTimelineDuration=function(){var e=this;return this.ks&&this.ks.length>0&&isFinite(this.ms)?this.ks.reduce(function(t,n){return t+n.d/e.ms},0):0},t.prototype.getTimelineLength=function(){return this.ks?this.ks.length:0},t.prototype.setTimeline=function(e,t){void 0===t&&(t=!1);var n=e.SegmentTimeline;if(this.ps=this.ps||Boolean(t),n&&this.js!==n){this.js=n;var i=this.Jt(),r=this.getTimescale();this.ms=r,this.ns=parseFloat(String(e._presentationTimeOffset))||0;var s=this.vs(n,this.ks);s.length>0&&(this.os=s[0].d/r),this.Kt(s,r,i),this.ks=s}},t.prototype.Jt=function(){return this.ks&&this.ks.length>0?this.ms:this.getTimescale()},t.prototype.Kt=function(t,n,i){var r,s=!1;if(this.ks&&this.ks.length>0?r=(s=this.is>=this.ks.length)?this.ks[this.ks.length-1]:this.ks[this.is]:(this.is=0,e.prototype.setIndex.call(this,0)),r)for(var o=t.length-1;o>=0;o--)if(g(t[o],n,r,i)){this.is=o+(s?1:0),e.prototype.setIndex.call(this,t[o].i+(s?1:0));break}},t.prototype.getSegmentDurationCurrentElement=function(){var e=this.ks[this.is];return e?e.d/this.ms:1},t.prototype.dispose=function(){this.settings=null,this.ks=[]},t}(p.SegmentTemplateMPDHandler);function c(e,t,n){var i;(i=e.entries).push.apply(i,t),e.latestTime+=n*t.length,e.latestOriginalTime+=n*t.length,e.index+=t.length}t.SegmentTimelineMPDHandler=d;var f=Math.pow(10,8);function m(e){return Math.round(e*f)/f}function g(e,t,n,i){var r=m(e.t/t),s=m(r+e.d/t),o=m(n.t/i);return r<=o&&o<s}},4771:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,n,r){var s=e.match(/(\$((RepresentationID)|(Bandwidth)|(Time)|(Number(%([\d]*[A-Za-z]))?)|())\$)/g),o=null!=n,a=t.hasOwnProperty("_bandwidth"),u=null!=r;function l(e){if(0===e.indexOf("Number")&&o){if(e.indexOf("%")>-1){var i=function(e){var t=parseInt(e.substring(0,e.length-1)),n=e[e.length-1].toLowerCase(),i=0!==e[e.length-1].indexOf(n);return[0===n.indexOf("o")?8:0===n.indexOf("x")?16:(n.indexOf("d"),10),t,i]}(e.substring(e.indexOf("%")+1)),s=i[0],l=i[1],p=i[2];return function(e,t){for(;e.length<t;)e="0"+e;return e}(function(e,t){return t?e.toUpperCase():e.toLowerCase()}(n.toString(s),p),l)}return String(n)}return 0===e.indexOf("RepresentationID")?t._internalId.representationId:0===e.indexOf("Bandwidth")&&a?String(t._bandwidth):0===e.indexOf("Time")&&u?String(r):""===e?"$":void 0}var p=[].concat(s).filter(function(e){return e}).map(function(e){return e.substring(1,e.length-1)}).map(function(e){return[e,l(e)]}).filter(function(e){return e[1].length>0}).reduce(function(e,t){var n=t[0],i=t[1];return e.replace("$".concat(n,"$"),i)},e);return(0,i.forceReallocation)(p)};var i=n(20649)},39761:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.getFirstAvSegmentTemplateFromPeriod=function(e){var t,n=e.AdaptationSet.find(function(e){return i.MimeTypeHelper.isAV(e._mimeType)}),r=null===(t=null==n?void 0:n.Representation[0])||void 0===t?void 0:t.SegmentTemplate;return null==r?void 0:r[0]},t.calculateTimelineEnd=function(e){for(var t,n,i=parseFloat(String(e._presentationTimeOffset))||0,o=(0,r.getTimescaleFromTemplate)(e),a=0,u=0,l=null!==(t=e.SegmentTimeline)&&void 0!==t?t:[];u<l.length;u++)for(var p=0,h=null!==(n=l[u].S)&&void 0!==n?n:[];p<h.length;p++){var d=h[p],c=s(d._r),f=parseInt(d._d);d.hasOwnProperty("_t")&&(a=Math.max(0,s(d._t)-i)),a+=f*(c+1)}return a/o},t.parseStringToNumber=s;var i=n(85434),r=n(12054);function s(e,t){return void 0===t&&(t=0),e?parseInt(e):t}}},function(e){return function(){return e(66759)}()}])});
18
18
  })();