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(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.abr=e():(t.bitmovin=t.bitmovin||{},t.bitmovin.player=t.bitmovin.player||{},t.bitmovin.player.abr=e())}(self,function(){return(self.webpackChunkbitmovin_player=self.webpackChunkbitmovin_player||[]).push([[744],{98154:function(t,e,i){var n=this&&this.__assign||function(){return n=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var r in e=arguments[i])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},n.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.AdaptationApiFactory=void 0;var r=i(23068),o=function(){function t(){}return t.create=function(t){return{setConfig:function(e){"Updating adaptation config with ".concat(JSON.stringify(e)),(0,r.isNumber)(e.qualityStabilityBalance)&&function(e){if(e<0||e>1)"Failed to set qualityStabilityBalance to ".concat(e,", valid range is 0 to 1");else{var i=t.getConfig(!0).adaptation;i&&(i.qualityStabilityBalance=e,"Updated qualityStabilityBalance to ".concat(e))}}(e.qualityStabilityBalance),e.resolution&&function(e){var i=e.maxSelectableVideoHeight,n=e.maxSelectableVideoWidth,r=e.minSelectableVideoHeight,o=e.minSelectableVideoWidth,s=t.getConfig(!0).adaptation.resolution;a(i)&&(s.maxSelectableVideoHeight=i),a(n)&&(s.maxSelectableVideoWidth=n),a(r)&&(s.minSelectableVideoHeight=r),a(o)&&(s.minSelectableVideoWidth=o),"Updated resolution boundaries to ".concat(JSON.stringify(s))}(e.resolution),(0,r.isBoolean)(e.limitToPlayerSize)&&function(e){var i=t.getConfig(!0).adaptation;i&&(i.limitToPlayerSize=e,"Updated limitToPlayerSize to ".concat(e))}(e.limitToPlayerSize)},getConfig:function(){var e=t.getConfig(!0).adaptation,i=e.qualityStabilityBalance,r=e.resolution,o=e.limitToPlayerSize;return{qualityStabilityBalance:i,resolution:n({},r),limitToPlayerSize:o}}}},t}();function a(t){return(0,r.isNumber)(t)&&t>=0}e.AdaptationApiFactory=o},89498:function(t,e,i){var n=this&&this.__assign||function(){return n=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var r in e=arguments[i])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},n.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.AdaptationHandler=void 0;var r=i(80813),o=i(98714),a=i(49859),s=i(91678),u=i(33436),l=i(86897),h=i(93204),p=i(79721),d=i(85434),c=i(70850),f=i(46057),v=i(47151),g=i(79505),y=i(49024),b=i(19119),m=i(43008),R=i(59113),S=i(7676),_=1/0,T=function(){function t(t,e,i){var n,r,o=this;this.context=t,this.mimeType=e,this.constraints=i,this.oO=!1,this.qO=function(t){var e;return void 0===t&&(t=null===(e=o.mO)||void 0===e?void 0:e.getState()),t?(0,a.getPreferredBitrate)((0,a.getAdaptationState)(t),o.mimeType):null},this.fO=(0,y.createAdaptationLogic)(this.context,this.mimeType,{minBitrate:this.constraints.minBitrate,maxBitrate:this.constraints.maxBitrate},null===(r=null===(n=this.context.config)||void 0===n?void 0:n.adaptation)||void 0===r?void 0:r.logic),this.jO=this.GO(this.kO),this.xO()}return Object.defineProperty(t.prototype,"mO",{get:function(){var t=this.context.sourceContext.sourceIdentifier;return this.context.serviceManager.get(r.ServiceName.SourceStoreService,t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pO",{get:function(){var t=this.context.sourceContext.sourceIdentifier;return this.context.serviceManager.get(r.ServiceName.ManifestService,t)},enumerable:!1,configurable:!0}),t.prototype.rO=function(t,e,i){var n,r;return t?this.jO:e&&null!==(r=null===(n=this.fO.findRepresentationForBitrate(e,i))||void 0===n?void 0:n._internalId)&&void 0!==r?r:null},t.prototype.sO=function(t,e){var i,n=this.tO(),r=this.qO();return n||r?this.rO(n,r,e):null!==(i=this.fO.selectRepresentationID(t,e))&&void 0!==i?i:null},t.prototype.tO=function(){return!this.isAuto()&&Boolean(this.yO(this.jO,this.vO()))},t.prototype.uO=function(t){this.gO=t},t.prototype.vO=function(){var t,e,i;return null!==(i=null===(e=null===(t=this.pO)||void 0===t?void 0:t.getAdaptationSet(this.kO))||void 0===e?void 0:e.Representation)&&void 0!==i?i:[]},t.prototype.selectRepresentationID=function(t,e){void 0===t&&(t={});var i=this.zO(null!=e?e:this.vO()),n=this.sO(t,i);return n&&this.uO(n),this.gO},t.prototype.wO=function(){var t=this,e=Boolean(this.iO);this.mO&&!e&&(this.iO=(0,h.subscribe)(this.mO)(l.getBufferStateMap,function(e){var i,n,r=null==e?void 0:e[t.mimeType];if(r){var a=r.rendererRanges;a&&a.length>0&&(null===(i=t.mO)||void 0===i||i.dispatch((0,o.clearPreferredBitrateForMimeTypeAction)(t.mimeType)),null===(n=t.iO)||void 0===n||n.call(t),t.iO=void 0)}}))},t.prototype.xO=function(){var t=this;this.mO&&(this.qO()&&this.wO(),this.hO=(0,h.subscribe)(this.mO)(this.qO,function(){return t.wO()},function(t){return Boolean(t)}))},t.prototype.yO=function(t,e){var i;return e?e.find(function(e){return e._internalId.equals(t)}):null===(i=this.pO)||void 0===i?void 0:i.getRepresentationById(t)},t.prototype.zO=function(t){this.DO();var e=t.map(function(t){return{representation:t,bitrate:t._bandwidth,width:t._width,height:t._height}});return this.AO(e).map(function(t){return t.representation})},t.prototype.AO=function(t){var e=this,i=this.context.config.adaptation.resolution,n=i.minSelectableVideoHeight,r=i.maxSelectableVideoHeight,o=i.minSelectableVideoWidth,a=i.maxSelectableVideoWidth,s=t.filter(function(t){return!((0,m.hasBitrate)(t)&&!w(t.bitrate,e.constraints.minBitrate,e.constraints.maxBitrate))&&(!(0,m.hasResolution)(t)||w(t.width,o,a)&&w(t.height,n,r))});if(s.length>0)return s;var u=this.BO(t);return u?[u]:t},t.prototype.BO=function(t){var e=0!==this.constraints.minBitrate,i=this.constraints.maxBitrate!==_,n=t.filter(m.hasBitrate);return e?(0,S.findMaximum)(n,function(t){return t.bitrate}):i?(0,S.findMinimum)(n,function(t){return t.bitrate}):d.MimeTypeHelper.isVideo(this.mimeType)?this.CO(t):void 0},t.prototype.CO=function(t){var e=this.context.config.adaptation.resolution,i=e.minSelectableVideoHeight,n=e.maxSelectableVideoHeight,r=e.minSelectableVideoWidth,o=e.maxSelectableVideoWidth,a=t.filter(m.hasResolution);return 0!==i?(0,S.findMaximum)(a,function(t){return t.height}):n!==1/0?(0,S.findMinimum)(a,function(t){return t.height}):0!==r?(0,S.findMaximum)(a,function(t){return t.width}):o!==1/0?(0,S.findMinimum)(a,function(t){return t.width}):void 0},t.prototype.DO=function(){d.MimeTypeHelper.isVideo(this.mimeType)&&(this.context.config.adaptation.limitToPlayerSize&&!this.oO?this.FO():!this.context.config.adaptation.limitToPlayerSize&&this.oO&&this.EO())},t.prototype.EO=function(){this.oO=!1,this.context.config.adaptation.onVideoAdaptation=this.nO},t.prototype.FO=function(){var t=this;this.oO=!0;var e=this.context.config.adaptation.onVideoAdaptation;this.nO=e,this.context.config.adaptation.onVideoAdaptation=e&&"function"==typeof e?function(i){var n,r,o;return i.suggested=(0,b.AdaptToPlayerResolution)(t.context.internalPlayer,i.suggested,null!==(r=null===(n=t.lO)||void 0===n?void 0:n.isFullscreen())&&void 0!==r&&r)||i.suggested,null!==(o=(0,c.safeUserCallback)(function(){return e(i)},t.context.logger))&&void 0!==o?o:i.suggested}:function(e){var i,n;return(0,b.AdaptToPlayerResolution)(t.context.internalPlayer,e.suggested,null!==(n=null===(i=t.lO)||void 0===i?void 0:i.isFullscreen())&&void 0!==n&&n)||e.suggested}},t.prototype.GO=function(t){return t?new g.RepresentationId(t,"auto"):new g.RepresentationId(new v.AdaptationSetId(p.DEFAULT_PERIOD_ID,this.mimeType),"auto")},t.prototype.HO=function(t){var e,i={id:t._id,bitrate:t._bandwidth,width:t._width,height:t._height};null===(e=this.context.store)||void 0===e||e.dispatch((0,s.addMetricsValue)(this.mimeType,u.MetricType.DownloadedAdaptationSet,i))},t.prototype.IO=function(){var t,e,i=this;if(this.pO){var r=this.pO.getAdaptationSet(this.kO);if(r){var o=n(n({},r),{Representation:this.zO(r.Representation),_minBandwidth:Math.max(null!==(t=r._minBandwidth)&&void 0!==t?t:0,this.constraints.minBitrate),_maxBandwidth:Math.min(null!==(e=r._maxBandwidth)&&void 0!==e?e:_,this.constraints.maxBitrate)});this.fO.setAdaptationSet(o),(0,f.yieldToMain)().then(function(){return i.HO(o)})}}},t.prototype.JO=function(t){return this.kO&&t&&this.pO?this.pO.getRepresentation(this.kO,t):null},t.prototype.UP=function(){if(this.jO){var t=this.jO.representationId;this.jO=this.GO(this.kO);var e=this.JO(t);e&&(this.jO=e._internalId)}else this.jO=this.GO(this.kO)},t.prototype.setAdaptationSetId=function(t){this.kO=t,this.UP(),this.IO()},t.prototype.setFixedRepresentation=function(t){var e;if("auto"===t)this.jO=new g.RepresentationId(this.kO,"auto");else if(this.kO){var i=null===(e=this.pO)||void 0===e?void 0:e.getRepresentation(this.kO,t);i&&(this.jO=i._internalId,this.selectRepresentationID())}},t.prototype.getFixedRepresentation=function(){return this.gO},t.prototype.getLowestRepresentationId=function(){var t;return this.isAuto()?null===(t=this.fO.getLowestRepresentation())||void 0===t?void 0:t._internalId.representationId:this.jO.representationId},t.prototype.isAuto=function(){return"auto"===this.jO.representationId},t.prototype.shouldDownloadBeCancelled=function(t,e){var i,n,r,o,a,s,u,l=null!==(n=null===(i=this.context.config.adaptation)||void 0===i?void 0:i.disableDownloadCancelling)&&void 0!==n&&n,h=null!==(a=null===(o=null===(r=this.pO)||void 0===r?void 0:r.getAdaptationSet(this.kO))||void 0===o?void 0:o.Representation)&&void 0!==a?a:[],p=1===h.length,d=h.some(function(t){return Boolean(t._bandwidth)});if(!this.isAuto()||l||p||!d)return!1;var c=function(t){if(!(0,S.hasTotalBytes)(t))return 1/0;var e=function(t){var e,i=null!==(e=t.elapsedTime)&&void 0!==e?e:0;return t.loadedBytes>0&&i>0?8*t.loadedBytes/1024/i:0}(t);return e>0?8*t.totalBytes/1024/e:1/0}(t),f=(null!==(u=null===(s=t.responseTiming)||void 0===s?void 0:s.doneTimestamp)&&void 0!==u?u:0)>0,v=!!t.segmentDuration&&c>1.5*t.segmentDuration;return!(f||!v)&&!function(t){return!!(0,S.hasTotalBytes)(t)&&t.loadedBytes>=.9*t.totalBytes}(t)&&this.fO.shouldDownloadBeCancelled(t,e)},t.prototype.setStartupPhase=function(){this.fO.setStartupPhase()},t.prototype.addSample=function(t){this.fO.addSample(n({timestamp:Date.now()},t))},t.prototype.shutdown=function(){this.fO.shutdown()},t.prototype.dispose=function(){var t,e;this.shutdown(),this.fO.dispose(),null===(t=this.hO)||void 0===t||t.call(this),null===(e=this.iO)||void 0===e||e.call(this)},t.prototype.selectQualityBasedOnBitrateMeasurement=function(t){var e=this.AO(t),i=this.qO();if(i)return(0,R.findQualityForBitrate)(i,e);if(this.tO()){var n=this.zO(this.vO()),r=this.yO(this.gO,n);if(r)return(0,R.findQualityForBitrate)(r._bandwidth,e)}return(0,R.findQualityForBitrate)(this.fO.getCurrentBitrateMeasurement(),e)},t}();function w(t,e,i){return t>=e&&t<=i}e.AdaptationHandler=T},49024:function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.createAdaptationLogic=function(t,e,i,l){var h=i.minBitrate,p=i.maxBitrate;return void 0===l&&(l=n.AdaptationLogicType.DOWNLOAD_PREDICTION),l===n.AdaptationLogicType.LOW_LATENCY?new s.LowLatencyAbr(t,e):l===n.AdaptationLogicType.WISH?new u.WishLogic(t,e):l===n.AdaptationLogicType.DOWNLOAD_PREDICTION?new a.DownloadPredictionLogic(t,e):l===n.AdaptationLogicType.BUFFER_FILL_RATE?new r.BufferFillRateLogic(t,e):new o.BufferLogic(t,e,h||0,p||1/0)};var n=i(21281),r=i(48968),o=i(39201),a=i(85696),s=i(24296),u=i(7290)},49541:function(t,e,i){e.X=void 0;var n=i(85434),r=i(89498),o=i(83429),a=function(){function t(t){this.context=t,this.Bk=new Map}return t.prototype.Ck=function(t){if(t){if(!this.Bk.has(t)){var e=function(t,e){var i={minBitrate:0,maxBitrate:1/0};return n.MimeTypeHelper.isVideo(t)?(i.minBitrate=Number(e.MIN_SELECTABLE_VIDEO_BITRATE)||i.minBitrate,i.maxBitrate=Number(e.MAX_SELECTABLE_VIDEO_BITRATE)||i.maxBitrate):n.MimeTypeHelper.isAudio(t)&&(i.minBitrate=Number(e.MIN_SELECTABLE_AUDIO_BITRATE)||i.minBitrate,i.maxBitrate=Number(e.MAX_SELECTABLE_AUDIO_BITRATE)||i.maxBitrate),i}(t,this.context.settings);this.Bk.set(t,new r.AdaptationHandler(this.context,t,e))}return this.Bk.get(t)}},t.prototype.selectRepresentation=function(t,e,i){var n,r;return void 0===e&&(e={}),null!==(r=null===(n=this.Ck(t))||void 0===n?void 0:n.selectRepresentationID(e,i))&&void 0!==r?r:void 0},t.prototype.isAuto=function(t){var e,i;return null===(i=null===(e=this.Ck(t))||void 0===e?void 0:e.isAuto())||void 0===i||i},t.prototype.shouldDownloadBeCancelled=function(t,e,i){var n,r;return null!==(r=null===(n=this.Ck(t))||void 0===n?void 0:n.shouldDownloadBeCancelled(e,i))&&void 0!==r&&r},t.prototype.selectQualityBasedOnBitrateMeasurement=function(t,e){var i=e?this.Bk.get(e):this.Dk(),r=null;i||(r=null!=e?e:n.MimeType.VideoMp4,i=this.Ck(r));var o=null==i?void 0:i.selectQualityBasedOnBitrateMeasurement(t);return r&&this.release(r),null!=o?o:t[0]},t.prototype.Dk=function(){var t=void 0;return this.Bk.forEach(function(e,i){t&&!n.MimeTypeHelper.isVideo(i)||(t=e)}),t},t.prototype.setAdaptationSetId=function(t,e){var i;null===(i=this.Ck(t))||void 0===i||i.setAdaptationSetId(e)},t.prototype.setFixedRepresentation=function(t,e){var i;null===(i=this.Ck(t))||void 0===i||i.setFixedRepresentation(e)},t.prototype.getCurrentRepresentationId=function(t){var e,i;return null!==(i=null===(e=this.Ck(t))||void 0===e?void 0:e.getFixedRepresentation())&&void 0!==i?i:null},t.prototype.getLowestRepresentationId=function(t){var e;return null===(e=this.Ck(t))||void 0===e?void 0:e.getLowestRepresentationId()},t.prototype.setStartupPhase=function(t){var e;null===(e=this.Ck(t))||void 0===e||e.setStartupPhase()},t.prototype.shutdown=function(t){var e;null===(e=this.Ck(t))||void 0===e||e.shutdown()},t.prototype.addSample=function(t,e){var i;null===(i=this.Ck(t))||void 0===i||i.addSample(e)},t.prototype.getUserSelectedRepresentation=function(t,e,i){return(0,o.getUserSelectedRepresentation)(this.context,t,e,i)},t.prototype.release=function(t){var e;null===(e=this.Bk.get(t))||void 0===e||e.dispose(),this.Bk.delete(t)},t.prototype.dispose=function(){this.Bk.forEach(function(t){return t.dispose()}),this.Bk.clear()},t}();e.X=a},81723:function(t,e,i){var n=this&&this.__assign||function(){return n=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var r in e=arguments[i])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},n.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.BaseAdaptationLogic=void 0;var r=i(46151),o=i(15971),a=i(85434),s=i(89927),u=i(88844),l=i(59113),h=i(59406),p=i(70238),d=i(7676),c=function(){function t(t,e){this.context=t,this.mimeType=e,this.lastRateMeasurement=0,this.availableRepresentations=[],this.startupPhase=!0,this.lastDownloadCancelled=!1,this.monitoringMimeType=this.getMonitoringMimeType()}return t.prototype.getMonitoringMimeType=function(){var t,e=null,i=null===(t=this.context.store)||void 0===t?void 0:t.getState();return i&&(e=Object.keys((0,r.getMetricsState)(i)).find(a.MimeTypeHelper.isVideo)),null!=e?e:this.mimeType},t.prototype.updateAvailableRepresentations=function(t){t&&(this.availableRepresentations=t.map(function(t,e){return n(n({},t),{arrayIndex:e})}))},t.prototype.getAvailableRepresentations=function(){var t,e=this;return this.lastDownloadCancelled&&(null===(t=this.lastRepresentation)||void 0===t?void 0:t._bandwidth)?this.availableRepresentations.filter(function(t){var i=t._bandwidth;return e.lastRepresentation&&i<e.lastRepresentation._bandwidth}):this.availableRepresentations},t.prototype.setAdaptationSet=function(t){var e,i,n;if(this.updateAvailableRepresentations(t.Representation),this.lastRepresentation)this.lastRepresentation=this.findRepresentationForBitrate(this.lastRepresentation._bandwidth,t.Representation);else{var r=null===(n=null===(i=null===(e=(0,o.getSourceState)(this.context))||void 0===e?void 0:e.activeTracks)||void 0===i?void 0:i[t._internalId.adaptationSetId])||void 0===n?void 0:n.selectedRepresentationId;this.lastRepresentation=r?this.availableRepresentations.find(function(t){return t._internalId.equals(r)}):void 0}},t.prototype.findRepresentationForBitrate=function(t,e){var i,n;return this.updateAvailableRepresentations(e),null!==(n=null===(i=(0,l.findQualityForBitrate)(t,this.getAvailableRepresentations().map(function(t){return{rep:t,bitrate:Number(t._bandwidth)}})))||void 0===i?void 0:i.rep)&&void 0!==n?n:this.getLowestRepresentation()},t.prototype.checkStartupPhase=function(t){this.startupPhase&&this.mib(t)},t.prototype.getLowestRepresentation=function(){return(0,d.getLowestRepresentation)(this.availableRepresentations)},t.prototype.mib=function(t){var e=this,i=this.context.bufferSettings.getForwardTargetLevel();this.startupPhaseTimerID||(this.startupPhaseTimerID=window.setTimeout(function(){e.startupPhase=!1,e.startupPhaseTimerID=void 0},(0,s.toMilliSeconds)(i))),t.value>=.5*i&&((0,u.clearTimeoutIfDefined)(this.startupPhaseTimerID),this.startupPhase=!1,this.startupPhaseTimerID=void 0)},t.prototype.getRepresentationForNormalChange=function(t,e,i){return this.startupPhase||!i?this.getRepresentationForRateMeasurement(p.SwitchingAggressiveness.Mid):this.getRepresentationToSwitchTo(e.result,t.result)},t.prototype.getCurrentBitrate=function(t){return this.lastDownloadCancelled?this.lastRateMeasurement:t.value},t.prototype.getRepresentationToSwitchTo=function(t,e){if(this.lastDownloadCancelled)return this.switchDown(p.SwitchingAggressiveness.VeryHigh);switch(t){case h.Rules.SHOULD_SWITCH_UP:return this.ifFillStateHigh(e);case h.Rules.SHOULD_STAY:return this.ifFillStateMid(e);case h.Rules.SHOULD_SWITCH_DOWN:return this.ifFillStateLow(e);default:return this.useLastRepresentation()}},t.prototype.switchUp=function(t){var e;if(void 0===t&&(t=p.SwitchingAggressiveness.Conservative),void 0!==(null===(e=this.lastRepresentation)||void 0===e?void 0:e.arrayIndex)&&this.lastRepresentation.arrayIndex>=this.availableRepresentations.length-1)return this.lastRepresentation;var i=this.getRepresentationForRateMeasurement(t);return this.lastRepresentation&&Number(i._bandwidth)<=Number(this.lastRepresentation._bandwidth)?this.lastRepresentation:i},t.prototype.switchDown=function(t){var e,i,n,r;if(void 0===t&&(t=p.SwitchingAggressiveness.VeryHigh),void 0!==(null===(e=this.lastRepresentation)||void 0===e?void 0:e.arrayIndex)&&(null===(i=this.lastRepresentation)||void 0===i?void 0:i.arrayIndex)<1&&null!==(null===(n=this.lastRepresentation)||void 0===n?void 0:n._id))return this.lastRepresentation;var o=this.getRepresentationForRateMeasurement(t);return this.lastRepresentation&&(!o||o._bandwidth>=(null===(r=this.lastRepresentation)||void 0===r?void 0:r._bandwidth))&&(o=this.getOneRepresentationLower()),o},t.prototype.stay=function(){var t;return null!==(t=this.lastRepresentation)&&void 0!==t?t:this.getLowestRepresentation()},t.prototype.ifFillStateHigh=function(t){switch(t){case h.Rules.SHOULD_SWITCH_UP:return this.switchUp(p.SwitchingAggressiveness.VeryHigh);case h.Rules.SHOULD_STAY:return this.switchUp(p.SwitchingAggressiveness.High);case h.Rules.SHOULD_SWITCH_DOWN:default:return this.stay()}},t.prototype.ifFillStateMid=function(t){switch(t){case h.Rules.SHOULD_SWITCH_UP:return this.switchUp(p.SwitchingAggressiveness.Mid);case h.Rules.SHOULD_STAY:return this.stay();case h.Rules.SHOULD_SWITCH_DOWN:return this.switchDown(p.SwitchingAggressiveness.High);default:return this.stay()}},t.prototype.ifFillStateLow=function(t){switch(t){case h.Rules.SHOULD_SWITCH_UP:return this.stay();case h.Rules.SHOULD_STAY:return this.switchDown(p.SwitchingAggressiveness.High);case h.Rules.SHOULD_SWITCH_DOWN:return this.switchDown(p.SwitchingAggressiveness.VeryHigh);default:return this.stay()}},t.prototype.useLastRepresentation=function(){var t;return(null===(t=this.lastRepresentation)||void 0===t?void 0:t._id)?this.lastRepresentation:this.getLowestRepresentation()},t.prototype.getOneRepresentationLower=function(){var t,e,i=Math.max(0,(null!==(e=null===(t=this.lastRepresentation)||void 0===t?void 0:t.arrayIndex)&&void 0!==e?e:0)-1);return this.availableRepresentations[i]},t}();e.BaseAdaptationLogic=c},48968:function(t,e,i){var n=this&&this.__extends||function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();Object.defineProperty(e,"__esModule",{value:!0}),e.BufferFillRateLogic=void 0;var r=i(46151),o=i(33436),a=i(88844),s=i(81723),u=i(4865),l=i(20066),h=i(64463),p=i(70238),d=function(t){function e(e,i){var n=t.call(this,e,i)||this;return n.Bgb=0,n.shouldDownloadBeCancelled=function(t,e){var i,r;return 0!==(null===(i=n.lastRepresentation)||void 0===i?void 0:i.arrayIndex)&&n.Ggb()._id!==(null===(r=n.lastRepresentation)||void 0===r?void 0:r._id)&&(n.lastDownloadCancelled=!0,!0)},n.Agb={bufferFillRate:new l.BufferFillRateRule(n.context,n.monitoringMimeType),bufferFillState:(0,h.BufferFillStateRule)(n.context,n.monitoringMimeType),rateMeasurement:new u.BlockBasedRateMeasurementRule(n.context,n.monitoringMimeType)},n}return n(e,t),e.prototype.getRepresentationForRateMeasurement=function(t){void 0===t&&(t=p.SwitchingAggressiveness.Mid);var e=this.Agb.rateMeasurement.getStatus(t),i=this.context.settings.RATE_SAFETY_MARGIN_PERCENTAGE/100,n=e.value*(1-i);return this.findRepresentationForBitrate(n)},e.prototype.addSample=function(t){Object.values(this.Agb).forEach(function(e){return e.addSample(t)})},e.prototype.Cgb=function(t){return this.switchDown(p.SwitchingAggressiveness.VeryHigh)},e.calcEstimatedDownloadDuration=function(t,e,i,n){var r=parseFloat((i*t/e).toFixed(2));return n&&(r*=2),1.1*r},e.prototype.Dgb=function(t,i,n,r,o){var a=e.calcEstimatedDownloadDuration(n,t,i,o);return a<r||a<=n},e.prototype.Egb=function(t,e,i,n){var r,o,a,s=null==t?void 0:t.hlsDependentSegments;if(s&&null!==(null===(r=this.lastRepresentation)||void 0===r?void 0:r._id)&&(null===(o=this.lastRepresentation)||void 0===o?void 0:o.arrayIndex)!==e.arrayIndex){var u=Math.min.apply(null,this.availableRepresentations.map(function(t){return Number(t._bandwidth)})),l=Number(e._bandwidth);if(!(isFinite(l)&&l===u||this.Dgb(i,e._bandwidth,t.segmentDuration,n,s))){for(var h=!1,p=null!==(a=e.arrayIndex)&&void 0!==a?a:-1;p>=0;p--){var d=this.availableRepresentations[p];if(this.Dgb(i,d._bandwidth,t.segmentDuration,n,s)){e=d,h=!0;break}}h||(e=this.useLastRepresentation())}}return e},e.prototype.Fgb=function(t){var e,i=this.lastRateMeasurement>0&&2*t<=this.lastRateMeasurement;return i&&(null===(e=this.lastRepresentation)||void 0===e?void 0:e._id)?1.5*t<this.lastRepresentation._bandwidth:i},e.prototype.Ggb=function(t){var e,i,n=this.context.store.getState();n&&(i=(0,r.getMetricsState)(n));var a,s=this.Agb.bufferFillState.getStatus(),u=this.Agb.bufferFillRate.getStatus(),l=this.Agb.rateMeasurement.getStatus(1).value,h=null!=i&&this.context.bufferSettings.getForwardTargetLevel()>i.default.bufferLogicActivationThreshold,d=this.Fgb(l);this.checkStartupPhase(s),a=d?this.Cgb(l):this.getRepresentationForNormalChange(u,s,h);var c=(0,r.getMetricsLastEntry)(null!=i?i:{},this.mimeType,o.MetricType.StalledSeconds).value;return c>this.Bgb?(this.Bgb=c,this.switchDown(p.SwitchingAggressiveness.MidHigh)):(a=this.Egb(t,a,l,s.value),this.lastRateMeasurement=l,this.lastDownloadCancelled&&void 0!==a.arrayIndex&&void 0!==(null===(e=this.lastRepresentation)||void 0===e?void 0:e.arrayIndex)&&a.arrayIndex>=this.lastRepresentation.arrayIndex&&(a=this.getOneRepresentationLower(),this.lastDownloadCancelled=!1),a)},e.prototype.selectRepresentationID=function(t,e){return this.updateAvailableRepresentations(e),this.lastRepresentation=this.Ggb(t),this.lastRepresentation._internalId},e.prototype.setAdaptationSet=function(e){var i;t.prototype.setAdaptationSet.call(this,e),null!==(i=this.lastRepresentation)&&void 0!==i||(this.lastRepresentation={_id:null,_bandwidth:0,arrayIndex:-1})},e.prototype.getCurrentBitrateMeasurement=function(){return this.getCurrentBitrate(this.Agb.rateMeasurement.getStatus())},e.prototype.getAvailableRepresentations=function(){return this.availableRepresentations},e.prototype.setStartupPhase=function(){this.startupPhase=!0,(0,a.clearTimeoutIfDefined)(this.startupPhaseTimerID),this.startupPhaseTimerID=void 0,Object.values(this.Agb).forEach(function(t){return t.setStartupPhase()})},e.prototype.shutdown=function(){(0,a.clearTimeoutIfDefined)(this.startupPhaseTimerID),this.startupPhaseTimerID=void 0,this.lastDownloadCancelled=!1,Object.values(this.Agb).forEach(function(t){return t.shutdown()})},e.prototype.dispose=function(){this.shutdown(),Object.values(this.Agb).forEach(function(t){return t.dispose()}),this.Agb={},this.lastRepresentation=void 0,this.availableRepresentations=[]},e}(s.BaseAdaptationLogic);e.BufferFillRateLogic=d},39201:function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.BufferLogic=void 0;var n=i(85434),r=i(96533),o=i(7676),a=function(){function t(t,e,i,r){this.context=t,this.mimeType=e,this.minSelectableBitrate=i,this.maxSelectableBitrate=r,this.Lgb=[],this.Hgb=n.MimeTypeHelper.getMediaType(this.mimeType),this.Kgb={timestamp:Date.now(),bufferLevel:0,bufferTargetLevel:0}}return t.prototype.Mgb=function(t){t&&(this.Lgb=t)},t.prototype.Ngb=function(){return(0,r.findLowestPossibleBandwidthFromRepresentations)(this.Lgb,this.minSelectableBitrate)},t.prototype.Ogb=function(){var t;return null===(t=this.findRepresentationForBitrate(this.maxSelectableBitrate))||void 0===t?void 0:t._bandwidth},t.prototype.Pgb=function(){return this.context.bufferSettings.getForwardTargetLevel(this.Hgb)},t.prototype.Qgb=function(){var t=this.Ngb(),e=this.Ogb();return this.Jgb=this.Pgb(),function(t,e,i){var n=[];0===e&&(e=t);var r=2*Math.floor(.1*i),o=8*Math.floor(.1*i);o<=r&&(o=Math.floor(.9*i)),r<=1&&(r=1);for(var a=(e-t)/(o-r),s=t-a*r,u=0;u<r;u++)n[u]=t;for(u=r;u<o;u++)n[u]=Math.floor(a*u+s);for(u=o;u<=i;u++)n[u]=e;return n}(t,e||t,this.Jgb)},t.prototype.Rgb=function(){var t=this.Pgb();this.Jgb!==t&&(this.Igb=this.Qgb())},t.prototype.findRepresentationForBitrate=function(t,e){return this.Mgb(e),(0,r.getMatchingRepresentationByBandwidth)(this.Lgb,t)},t.prototype.Sgb=function(){var t,e=this.Pgb(),i=this.Kgb.bufferLevel;return(i=Math.floor(i))>e&&(i=e),t=this.Igb.hasOwnProperty(i)?this.Igb[i]:this.Igb[0],this.findRepresentationForBitrate(t)},t.prototype.selectRepresentationID=function(t,e){this.Mgb(e);var i=this.Sgb();return this.Rgb(),i._internalId},t.prototype.setAdaptationSet=function(t){this.Mgb(t.Representation),this.Igb=this.Qgb()},t.prototype.shouldDownloadBeCancelled=function(){return!1},t.prototype.setStartupPhase=function(){},t.prototype.shutdown=function(){},t.prototype.addSample=function(t){this.Kgb=t},t.prototype.dispose=function(){this.Igb=[]},t.prototype.getCurrentBitrateMeasurement=function(){return 0},t.prototype.getLowestRepresentation=function(){return(0,o.getLowestRepresentation)(this.Lgb)},t}();e.BufferLogic=a},11958:function(t,e,i){var n=this&&this.__extends||function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();Object.defineProperty(e,"__esModule",{value:!0}),e.CancellableAdaptationLogic=void 0;var r=i(80813),o=i(4131),a=i(21281),s=i(46151),u=i(33436),l=i(81199),h=i(81723),p=i(39185),d=i(45199),c=i(17006),f=i(70238),v=i(7676),g=function(t){function e(e,i){var n=t.call(this,e,i)||this;return n.shouldDownloadBeCancelled=function(t,e){var i,r,a=null!==(i=t.elapsedTime)&&void 0!==i?i:-1,s=null===(r=n.oib)||void 0===r?void 0:r.isPaused(),u=n.isStartupBitrateInEffect(),l=function(t){var e,i=null!==(e=t.elapsedTime)&&void 0!==e?e:-1;return i<0?0:i-y(t)}(t),h=n.pib(e),p=(0,o.hasLoadedData)(t),d=p?l>n.context.settings.MIN_EFFECTIVE_SEGMENT_DOWNLOAD_TIME:a>n.context.settings.MIN_EFFECTIVE_SEGMENT_DOWNLOAD_TIME;return!(s||u||h||!d)&&n.Mjb(t,l,p,a)},n.timeToFirstByteMeasurementRule=new d.TimeToFirstByteMeasurementRule(n.context,n.monitoringMimeType),n.rateMeasurementRule=new p.SegmentBasedRateMeasurementRule(n.context,n.monitoringMimeType),n}return n(e,t),Object.defineProperty(e.prototype,"nib",{get:function(){return this.context.serviceManager.get(r.ServiceName.ManifestService,this.context.sourceContext.sourceIdentifier)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"oib",{get:function(){return this.context.serviceManager.get(r.ServiceName.PlayerStateService)},enumerable:!1,configurable:!0}),e.prototype.setAdaptationSet=function(e){t.prototype.setAdaptationSet.call(this,e),this.previousRequestProgress=void 0},e.prototype.isStartupBitrateInEffect=function(){var t,e=this.context.store.getState(),i=e?(0,s.getMetricsHistoryFromInstanceState)(e,this.mimeType,u.MetricType.DownloadInformation):[],n=Boolean(null===(t=this.context.config.adaptation)||void 0===t?void 0:t.startupBitrate),r=i.filter(function(t){return Boolean(t.value)}).length>0;return n&&!r},e.prototype.pib=function(t){return!!t&&this.getLowestRepresentation()._internalId.equals(t)},e.prototype.qib=function(){return(0,l.getPlayableBufferLevel)(this.context.internalPlayer)},e.prototype.estimateTimeToFirstByte=function(t){var e;switch(void 0===t&&(t=0),e=0!==t?this.timeToFirstByteMeasurementRule.estimateStatus(t,5,.2).value:this.timeToFirstByteMeasurementRule.getStatus(5,.2).value,function(t){var e,i;return null!==(i=null===(e=t.adaptation)||void 0===e?void 0:e.rttEstimationMethod)&&void 0!==i?i:a.RttEstimationMethod.WeightedAverage}(this.context.config)){case a.RttEstimationMethod.Median:return e.median;case a.RttEstimationMethod.WeightedAverage:default:return e.standardDeviation>e.mean?e.mean+e.standardDeviation:e.weightedAverage}},e.prototype.rib=function(t,e,i,n,r,o){var a,l,h,p,d,f,v,g=n*e/i+r,y=null!==(l=null===(a=this.nib)||void 0===a?void 0:a.isManifestFetchRequired(t))&&void 0!==l&&l,m=!this.tib(t),R=null!==(h=null==o?void 0:o.hlsDependentSegments)&&void 0!==h&&h,S=null!==(d=null===(p=this.nib)||void 0===p?void 0:p.getRepresentationById(t))&&void 0!==d?d:null,_=Boolean(this.lastRepresentation)&&null!==(null===(f=this.lastRepresentation)||void 0===f?void 0:f._id)&&(null===(v=this.lastRepresentation)||void 0===v?void 0:v.arrayIndex)!==(null==S?void 0:S.arrayIndex),T=this.context.store.getState(),w=g;if(w+=function(t,e,i){var n=t?(0,s.getMetricsState)(t):{};return b((0,s.getMetricsHistory)(n,e,u.MetricType.DecryptionTime),i)+b((0,s.getMetricsHistory)(n,e,u.MetricType.TransmuxingTime),i)}(T,this.mimeType,t),R&&_&&(w*=2),m&&(w+=r),y){var M=function(t){var e=t?(0,s.getMetricsState)(t):{};return function(t){var e=(0,s.getMetricsHistory)(t,"default",u.MetricType.DownloadInformation).slice(-3).map(function(t){return t.value.time});return(0,c.calculateExponentialWeightedAverage)(e,.8)}(e)+function(t){var e=(0,s.getMetricsHistory)(t,"default",u.MetricType.ProcessingTime).slice(-3).map(function(t){return t.value});return(0,c.calculateExponentialWeightedAverage)(e,.8)}(e)}(T);w+=Math.max(M,r)}return w},e.prototype.sib=function(t,e,i,n){var r=1-this.context.settings.DOWNLOAD_DURATION_SAFETY_MARGIN,o=(n?this.context.settings.MAXIMUM_DOWNLOAD_DURATION_MULTIPLIER_SAME_QUALITY:this.context.settings.MAXIMUM_DOWNLOAD_DURATION_MULTIPLIER)-r,a=r+Math.min(e,i)*o/i;return Math.min(t*a,i)},e.prototype.isDownloadFeasible=function(t,e,i,n,r,o,a){var s,u=t.arrayIndex===(null===(s=this.lastRepresentation)||void 0===s?void 0:s.arrayIndex),l=this.sib(i,o,a,u);return this.rib(t._internalId,i,e,t._bandwidth,r,{hlsDependentSegments:n})<=l},e.prototype.tib=function(t){var e,i,n=this.context.store.getState(),r=n?(0,s.getMetricsHistoryFromInstanceState)(n,this.mimeType,u.MetricType.CachedInitSegments):[];return 0===r.length?null!==(i=null===(e=this.nib)||void 0===e?void 0:e.hasSelfInitialisingSegments())&&void 0!==i&&i:r.some(function(e){var i=e.hasOwnProperty("value")&&e.value.hasOwnProperty("internalRepId")?e.value.internalRepId:null;return null!==i&&i.equals(t)})},e.prototype.uib=function(t,e,i){var n=this;void 0===i&&(i=this.estimateTimeToFirstByte());var r=this.availableRepresentations.filter(function(t){var e;return n.lastRepresentation&&!t._internalId.equals(null===(e=n.lastRepresentation)||void 0===e?void 0:e._internalId)});return Math.min.apply(Math,r.map(function(r){var o;return n.rib(r._internalId,null!==(o=n.lastSegmentInfo?n.lastSegmentInfo.segmentDuration:e)&&void 0!==o?o:0,t,r._bandwidth,i,n.lastSegmentInfo)}))},e.prototype.vib=function(t){var e,i,n,r,o,a,s=null!==(e=t.elapsedTime)&&void 0!==e?e:0,u=(null===(i=this.previousRequestProgress)||void 0===i?void 0:i.url)===t.url?(t.loadedBytes-(null!==(r=null===(n=this.previousRequestProgress)||void 0===n?void 0:n.loadedBytes)&&void 0!==r?r:0))/(s-(null!==(a=null===(o=this.previousRequestProgress)||void 0===o?void 0:o.elapsedTime)&&void 0!==a?a:0)):-1;return this.previousRequestProgress=t,u},e.prototype.wib=function(t,e){var i,n=e?y(t):null!==(i=t.elapsedTime)&&void 0!==i?i:0;return this.estimateTimeToFirstByte(n)},e.prototype.xib=function(t){return void 0===t&&(t=4),this.lastRepresentation?this.lastRepresentation._bandwidth/8*t*1.2:0},e.prototype.Ijb=function(t,e){var i=(0,o.hasLoadedData)(t),n=i?this.vib(t):0,r=i&&(0,v.hasTotalBytes)(t)?t.totalBytes-t.loadedBytes:this.xib(t.segmentDuration);return Math.min(r/(e/8),n>0?r/n:1/0)},e.prototype.Jjb=function(t,e,i){if((0,o.hasLoadedData)(t))return t.loadedBytes/e*8;var n=this.context.bufferSettings.getForwardTargetLevel(),r=this.rateMeasurementRule.getStatus(f.SwitchingAggressiveness.Mid,i/n);return this.getCurrentBitrate(r)},e.prototype.Kjb=function(t,e,i,n,r){var o=this.Ijb(n,i);return o>e&&o>r&&e<=r+t},e.prototype.Ljb=function(t,e,i,n){var r,o;if(null!==(o=null===(r=this.oib)||void 0===r?void 0:r.isPlay())&&void 0!==o&&o)return!1;var a=function(t){return t.getStatus(5,.2).value.mean}(this.timeToFirstByteMeasurementRule);return n>Math.max(t,3*a)&&e<=i+t},e.prototype.Mjb=function(t,e,i,n){var r,o,a,s=this.qib(),u=this.Jjb(t,e,s),l=this.wib(t,i),h=null!==(a=null!==(r=t.segmentDuration)&&void 0!==r?r:null===(o=this.lastSegmentInfo)||void 0===o?void 0:o.segmentDuration)&&void 0!==a?a:0,p=this.uib(u,h,l);return!!(i?this.Kjb(h,s,u,t,p):this.Ljb(h,s,p,n))&&((0,v.hasTotalBytes)(t)&&(t.loadedBytes/t.totalBytes*100).toFixed(1),this.lastDownloadCancelled=!0,this.lastRateMeasurement=u,!0)},e}(h.BaseAdaptationLogic);function y(t){var e,i,n,r,o=null!==(i=null===(e=t.responseTiming)||void 0===e?void 0:e.openedTimestamp)&&void 0!==i?i:-1,a=null!==(r=null===(n=t.responseTiming)||void 0===n?void 0:n.headersReceivedTimestamp)&&void 0!==r?r:-1;return o<0||a<0?0:a-o}function b(t,e){var i=t.filter(function(t){return t.value.representationId.equals(e)}).slice(-3).map(function(t){return t.value.time});return(0,c.calculateExponentialWeightedAverage)(i,.8)}e.CancellableAdaptationLogic=g},85696:function(t,e,i){var n=this&&this.__extends||function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();Object.defineProperty(e,"__esModule",{value:!0}),e.DownloadPredictionLogic=void 0,i(13531);var r=i(70962),o=i(46151),a=i(88844),s=i(11958),u=i(64463),l=i(43829),h=i(70238),p=i(7676),d=function(t){function e(e,i){var n=t.call(this,e,i)||this;return n.qhb=new l.DownloadRateRule(n.context,n.monitoringMimeType),n.rhb=(0,u.BufferFillStateRule)(n.context,n.monitoringMimeType),n}return n(e,t),e.prototype.getRepresentationForRateMeasurement=function(t){void 0===t&&(t=h.SwitchingAggressiveness.Mid);var e=this.context.bufferSettings.getForwardTargetLevel(),i=this.rhb.getStatus().value,n=this.rateMeasurementRule.getStatus(t,i/e),r=this.getCurrentBitrate(n),o=(0,p.adjustRateToSafetyMargin)(r,this.context.settings.RATE_SAFETY_MARGIN_PERCENTAGE);return this.findRepresentationForBitrate(o)},e.prototype.getCurrentBitrateMeasurement=function(){var t=this.getCurrentBitrate(this.rateMeasurementRule.getStatus());return(0,p.adjustRateToSafetyMargin)(t,this.context.settings.RATE_SAFETY_MARGIN_PERCENTAGE)},e.prototype.addSample=function(t){this.qhb.addSample(t),this.rhb.addSample(t),this.rateMeasurementRule.addSample(),this.timeToFirstByteMeasurementRule.addSample()},e.prototype.shb=function(t,e,i,n,r){var o=this;if(!t.segmentDuration||this.isStartupBitrateInEffect())return e;this.lastSegmentInfo=t;var a=this.availableRepresentations.filter(function(t){return t._bandwidth<=e._bandwidth});if(0===a.length)return this.availableRepresentations[0];var s=r.value||0,u=this.context.bufferSettings.getForwardTargetLevel(),l=(0,p.adjustRateToSafetyMargin)(i,this.context.settings.RATE_SAFETY_MARGIN_PERCENTAGE),h=a.filter(function(e){var i;return o.isDownloadFeasible(e,l,null!==(i=t.segmentDuration)&&void 0!==i?i:0,!1,n,s,u)});return 0===h.length?a[0]:h[h.length-1]},e.prototype.thb=function(t,e,i,n){var a,s;this.checkStartupPhase(e);var u=this.context.store.getState(),l=null!==(s=null===(a=(u?(0,o.getMetricsState)(u):{}).default)||void 0===a?void 0:a.bufferLogicActivationThreshold)&&void 0!==s?s:r.DefaultSettings.BUFFER_LOGIC_ACTIVATION_THRESHOLD,h=this.context.bufferSettings.getForwardTargetLevel()>l,p=this.getRepresentationForNormalChange(i,e,h);if(n){var d=this.estimateTimeToFirstByte();p=this.shb(n,p,t,d,e)}return p},e.prototype.selectRepresentationID=function(t,e){var i,n,r;this.updateAvailableRepresentations(e);var o=this.rateMeasurementRule.getStatus(),a=this.getCurrentBitrate(o),s=this.rhb.getStatus(),u=this.qhb.getStatus(),l=this.thb(a,s,u,t);return this.lastRepresentation&&(null===(n=null===(i=this.lastRepresentation)||void 0===i?void 0:i._internalId)||void 0===n||n.equals(null==l?void 0:l._internalId)),this.lastRepresentation=l,this.lastRateMeasurement=a,this.lastDownloadCancelled=!1,this.previousRequestProgress=void 0,null===(r=this.lastRepresentation)||void 0===r?void 0:r._internalId},e.prototype.setStartupPhase=function(){var t,e,i,n;this.startupPhase=!0,(0,a.clearTimeoutIfDefined)(this.startupPhaseTimerID),this.startupPhaseTimerID=void 0,null===(t=this.qhb)||void 0===t||t.setStartupPhase(),null===(e=this.rhb)||void 0===e||e.setStartupPhase(),null===(i=this.rateMeasurementRule)||void 0===i||i.setStartupPhase(),null===(n=this.timeToFirstByteMeasurementRule)||void 0===n||n.setStartupPhase()},e.prototype.shutdown=function(){var t,e,i,n;(0,a.clearTimeoutIfDefined)(this.startupPhaseTimerID),this.startupPhaseTimerID=void 0,this.lastDownloadCancelled=!1,this.previousRequestProgress=void 0,null===(t=this.qhb)||void 0===t||t.shutdown(),null===(e=this.rhb)||void 0===e||e.shutdown(),null===(i=this.rateMeasurementRule)||void 0===i||i.shutdown(),null===(n=this.timeToFirstByteMeasurementRule)||void 0===n||n.shutdown()},e.prototype.dispose=function(){var t,e,i,n;this.shutdown(),null===(t=this.qhb)||void 0===t||t.dispose(),null===(e=this.rhb)||void 0===e||e.dispose(),null===(i=this.rateMeasurementRule)||void 0===i||i.dispose(),null===(n=this.timeToFirstByteMeasurementRule)||void 0===n||n.dispose(),this.lastRepresentation=void 0,this.availableRepresentations=[]},e}(s.CancellableAdaptationLogic);e.DownloadPredictionLogic=d},76344:function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.AdaptationModuleDefinition=void 0;var n=i(62756),r=i(98154),o=i(7676);e.AdaptationModuleDefinition={name:n.ModuleName.ABR,module:function(){return{AdaptationService:i(49541).X,AdaptToPlayerResolution:i(19119).AdaptToPlayerResolution,AdaptationUtils:o,AdaptationApiFactory:r.AdaptationApiFactory}},dependencies:[n.ModuleName.EngineBitmovin]},e.default=e.AdaptationModuleDefinition},19119:function(t,e){function i(t){return t&&t.clientWidth&&t.clientHeight?{width:t.clientWidth*devicePixelRatio,height:t.clientHeight*devicePixelRatio}:null}Object.defineProperty(e,"__esModule",{value:!0}),e.AdaptToPlayerResolution=function(t,e,n){var r,o=function(t,e){var n=e.getVideoElement();if(!n)return null;var r=n.parentElement,o=r&&r.querySelector("#bitmovinplayer-vr-canvas");return t?{width:screen.width*devicePixelRatio,height:screen.height*devicePixelRatio}:i(n)||o&&i(o)||r&&i(r)}(n,t);if(!o)return e;var a=null!==(r=t.getAvailableVideoQualities())&&void 0!==r?r:[],s=a.find(function(t){return t.id===e});if(!s)return e;var u=function(t,e,i){return t.filter(function(t){var n=t.bitrate<=e,r=function(t,e){var i=e.width/e.height;return t.width/t.height<i?e.width>=t.width:e.height>=t.height}(i,t);return n&&r})}(a,s.bitrate,o);return 0===u.length?e:u[function(t){var e=t.findIndex(function(e){return e.width>t[0].width&&e.height>t[0].height})-1;return Math.max(0,e)}(u)].id}},43008:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.hasBitrate=function(t){return null!=t.bitrate},e.hasBitrateBounds=function(t){return null!=t.minBitrate&&null!=t.maxBitrate},e.hasResolution=function(t){return null!=t.height&&null!=t.width}},59113:function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.findQualityForBitrate=function(t,e){if(e&&0!==e.length)return e.reduce(function(e,i){var n=r(i),o={entry:i,bitrate:n};return e.bitrate>t||n>t?n>e.bitrate?e:o:n>e.bitrate?o:e},{entry:e[0],bitrate:r(e[0])}).entry};var n=i(43008);function r(t){return(0,n.hasBitrate)(t)&&t.bitrate>0?t.bitrate:(0,n.hasBitrateBounds)(t)?(t.maxBitrate+t.minBitrate)/2:0}},17006:function(t,e){function i(t){return t.length>0?t.reduce(function(t,e){return t+e},0)/t.length:0}Object.defineProperty(e,"__esModule",{value:!0}),e.calculateExponentialWeightedAverage=void 0,e.calculateMean=i,e.calculateStandardDeviation=function(t,e){if(void 0===e&&(e=i(t)),t.length<2)return 0;var n=t.reduce(function(t,i){return t+Math.pow(i-e,2)},0),r=1/(t.length-1)*n;return Math.sqrt(r)},e.calculateMedian=function(t){var e=t.slice(0).sort(function(t,e){return t-e});return 0===e.length?0:e.length%2==1?e[Math.floor(e.length/2)]:.5*(e[e.length/2-1]+e[e.length/2])},e.calculateExponentialWeightedAverage=function(t,i,n){return void 0===n&&(n=t.length-1),0===t.length||n<0?0:0===n||0===i?t[n]:i*t[n]+(1-i)*(0,e.calculateExponentialWeightedAverage)(t,i,n-1)}},70238:function(t,e){var i;Object.defineProperty(e,"__esModule",{value:!0}),e.SwitchingAggressiveness=void 0,function(t){t[t.Conservative=10]="Conservative",t[t.VeryLow=8]="VeryLow",t[t.Low=7]="Low",t[t.LowMid=6]="LowMid",t[t.Mid=5]="Mid",t[t.MidHigh=4]="MidHigh",t[t.High=3]="High",t[t.VeryHigh=2]="VeryHigh",t[t.Extreme=1]="Extreme"}(i||(e.SwitchingAggressiveness=i={}))},7676:function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.toMbps=e.toKbps=e.findMaximum=e.findMinimum=void 0,e.getMaxStartupBitrateFromConfig=function(t){var e,i=null===(e=t.config)||void 0===e?void 0:e.adaptation;if(!i)return 0;var r=function(t){return t.maxStartupBitrate?n.Util.extractBitrateFromString("max",t.maxStartupBitrate):1/0}(i);return!isNaN(r)&&isFinite(r)?r:0},e.getStartupBitrateFromConfig=function(t){var e,i=null===(e=t.config)||void 0===e?void 0:e.adaptation,r=t.settings;if(!i||!r)return 0;var o=i.startupBitrate||0;if(!o)return 0;var a=function(t,e){var i=n.Util.extractBitrateFromString("min",t);return i*=1+e/100,i+=8}(o,r.RATE_SAFETY_MARGIN_PERCENTAGE);return!isNaN(a)&&isFinite(a)?a:0},e.findExtremum=r,e.hasTotalBytes=function(t){return void 0!==t.totalBytes},e.adjustRateToSafetyMargin=function(t,e){return t*(1-e/100)},e.getLowestRepresentation=function(t){return(0,e.findMinimum)(t,function(t){return t._bandwidth})};var n=i(70850);function r(t,e){return t[t.reduce(function(i,n,r){return e(t[i],t[r])?i:r},0)]}var o=function(t){return t};e.findMinimum=function(t,e){return void 0===e&&(e=o),r(t,function(t,i){return e(t)<e(i)})},e.findMaximum=function(t,e){return void 0===e&&(e=o),r(t,function(t,i){return e(t)>e(i)})},e.toKbps=function(t){return t/Math.pow(2,10)},e.toMbps=function(t){return t/Math.pow(2,20)}},7290:function(t,e,i){var n=this&&this.__extends||function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();Object.defineProperty(e,"__esModule",{value:!0}),e.WishLogic=void 0;var r=i(44468),o=i(70962),a=i(46151),s=i(33436),u=i(85434),l=i(88844),h=i(11958),p=i(59113),d=i(59406),c=i(70238),f=i(7676),v=i(47577),g=1e-4,y=1e-4,b=function(t){function e(e,i){var n=t.call(this,e,i)||this;return n.context=e,n.mimeType=i,n.Ugb=[],n.Vgb=[],n.Wgb=0,n.bgb(),n.Tgb=e.settings.WISH_ABR_PARAMS,n}return n(e,t),Object.defineProperty(e.prototype,"Xgb",{get:function(){var t,e=u.MimeTypeHelper.isVideo(this.mimeType)?r.MediaType.Video:r.MediaType.Audio,i=null!==(t=this.context.internalPlayer.bufferApi.getLevel(r.BufferType.ForwardDuration,e).level)&&void 0!==t?t:0;return i>this.context.bufferSettings.getTargetLevel(r.BufferType.ForwardDuration,e)+this.Wgb?0:i},enumerable:!1,configurable:!0}),e.prototype.bgb=function(){var t=this.context.settings.WISH_ABR_PARAMS.BITRATE_MODIFIER_FUNCTION_TYPE,e=this.context.settings.WISH_ABR_PARAMS.TARGET_BUFFER_FACTOR,i=this.context.settings.WISH_ABR_PARAMS.TARGET_BITRATE_FACTOR;if(!["log","linear"].includes(t)){var n=o.WishDefaultConfig.BITRATE_MODIFIER_FUNCTION_TYPE;this.context.settings.WISH_ABR_PARAMS.BITRATE_MODIFIER_FUNCTION_TYPE=n}if(e>1||e<g){var r=Math.min(Math.max(e,g),1);this.context.settings.WISH_ABR_PARAMS.TARGET_BUFFER_FACTOR=r}if(i<y){var a=Math.max(i,y);this.context.settings.WISH_ABR_PARAMS.TARGET_BITRATE_FACTOR=a}},e.prototype.getRepresentationForRateMeasurement=function(t){void 0===t&&(t=c.SwitchingAggressiveness.Mid);var e=this.context.bufferSettings.getForwardTargetLevel(),i=this.rateMeasurementRule.getStatus(t,this.Xgb/e),n=this.getCurrentBitrate(i),r=(0,f.adjustRateToSafetyMargin)(n,this.context.settings.RATE_SAFETY_MARGIN_PERCENTAGE);return this.findRepresentationForBitrate(r)},e.prototype.cgb=function(){var t=this.context.store.getState();return(t?(0,a.getMetricsHistoryFromInstanceState)(t,this.mimeType,s.MetricType.DownloadInformation):[]).filter(function(t){return Boolean(t.value)}).length>2},e.prototype.addSample=function(t){(function(t){return null!=t.segmentDuration})(t)&&(this.rateMeasurementRule.addSample(),this.timeToFirstByteMeasurementRule.addSample(),t.segmentDuration!==this.Wgb&&(this.Wgb=t.segmentDuration,this.dgb()))},e.prototype.selectRepresentationID=function(t,e){var i;this.updateAvailableRepresentations(e),this.checkStartupPhase({value:this.Xgb,result:d.Rules.SHOULD_STAY});var n=this.phb(),r=null===(i=n.rep)||void 0===i?void 0:i._internalId,o=n.index;return this.Vgb.push(this.Ugb[o]),this.Vgb.length>20&&(this.Vgb=this.Vgb.slice(-10)),this.lastSegmentInfo=t,this.lastRepresentation=n.rep,this.lastRateMeasurement=this.getCurrentBitrate(this.rateMeasurementRule.getStatus()),this.lastDownloadCancelled=!1,this.previousRequestProgress=void 0,r},e.prototype.getCurrentBitrateMeasurement=function(){return this.rateMeasurementRule.getStatus().value},e.prototype.setAdaptationSet=function(e){t.prototype.setAdaptationSet.call(this,e);var i=this.getAvailableRepresentations().map(function(t){return(0,f.toKbps)(t._bandwidth)});this.Ugb=(0,v.applyQualityFunction)(i,this.Tgb.BITRATE_MODIFIER_FUNCTION_TYPE),this.dgb()},e.prototype.findRepresentationForBitrate=function(t,e){var i,n=(0,p.findQualityForBitrate)(t,this.getAvailableRepresentations().map(function(t){return{rep:t,bitrate:t._bandwidth}}));return null!==(i=null==n?void 0:n.rep)&&void 0!==i?i:this.getLowestRepresentation()},e.prototype.setStartupPhase=function(){this.startupPhase=!0,(0,l.clearTimeoutIfDefined)(this.startupPhaseTimerID),this.startupPhaseTimerID=void 0},e.prototype.shutdown=function(){var t,e;this.lastRateMeasurement=0,this.lastDownloadCancelled=!1,this.previousRequestProgress=void 0,null===(t=this.rateMeasurementRule)||void 0===t||t.shutdown(),null===(e=this.timeToFirstByteMeasurementRule)||void 0===e||e.shutdown()},e.prototype.dispose=function(){var t,e;this.shutdown(),null===(t=this.rateMeasurementRule)||void 0===t||t.dispose(),null===(e=this.timeToFirstByteMeasurementRule)||void 0===e||e.dispose(),this.lastRepresentation=void 0,this.availableRepresentations=[],this.Ugb=[],this.Wgb=0,this.Vgb=[]},e.prototype.dgb=function(){if((0,v.canUseWishAlgorithm)(this.Ugb,this.Wgb)){var t=this.getAvailableRepresentations().map(function(t){return(0,f.toKbps)(t._bandwidth)}),e=u.MimeTypeHelper.isVideo(this.mimeType)?r.MediaType.Video:r.MediaType.Audio,i=this.context.bufferSettings.getTargetLevel(r.BufferType.ForwardDuration,e);this.Ygb=(0,v.computeAlpha)(this.Tgb,t,this.Ugb,this.Wgb,i),this.Zgb=(0,v.computeBeta)(this.Tgb,this.Ygb,i,this.Wgb),this.agb=(0,v.computeGamma)(this.Ygb,this.Zgb)}},e.prototype.ohb=function(t,e,i,n){var r=(0,v.determineBandwidthCost)(t._bandwidth,n),o=(0,v.determineBufferCost)(r,this.Wgb,this.Xgb),a=(0,v.determineQualityCost)(this.Ugb,e,i);return this.Ygb*r+this.Zgb*o+this.agb*a},e.prototype.isStartupBitrateInEffect=function(){var t,e,i=Boolean(null===(t=this.context.config.adaptation)||void 0===t?void 0:t.startupBitrate),n=Boolean(null===(e=this.context.config.adaptation)||void 0===e?void 0:e.maxStartupBitrate);return(i||n)&&!this.cgb()},e.prototype.phb=function(){var t=this;if(this.startupPhase&&(this.isStartupBitrateInEffect()||this.Tgb.USE_RATE_BASED_SELECTION_ON_SEEKING)){var e=this.getRepresentationForRateMeasurement(),i=this.getAvailableRepresentations().indexOf(e);return{rep:e,index:-1!==i?i:0}}if(this.Xgb<this.Wgb||!(0,v.canUseWishAlgorithm)(this.Ugb,this.Wgb))return{rep:this.getAvailableRepresentations()[0],index:0};var n=(0,v.getAverageSelectedQuality)(this.Vgb,10),r=this.rateMeasurementRule.getStatus(5,.325).value,o=this.getCurrentBitrate(this.rateMeasurementRule.getStatus()),a=Math.min(r,o),s=this.getAvailableRepresentations()[0]._bandwidth,u=Math.max(1.1*r,s),l=this.getAvailableRepresentations().filter(function(t){return t._bandwidth<=u}).map(function(e,i){return{rep:e,index:i,cost:t.ohb(e,i,n,a)}}).sort(function(t,e){return t.cost-e.cost});return{rep:l[0].rep,index:l[0].index}},e}(h.CancellableAdaptationLogic);e.WishLogic=b},47577:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.applyQualityFunction=function(t,e){switch(e){case"linear":var i=t[t.length-1];return t.map(function(t){return function(t,e){return t/e}(t,i)});case"log":var n=t[0];return t.map(function(t){return function(t,e){return Math.log(t/e)}(t,n)})}},e.computeAlpha=function(t,e,i,n,r){switch(t.BITRATE_MODIFIER_FUNCTION_TYPE){case"linear":return function(t,e,i,n){var r=t.TARGET_BITRATE_FACTOR,o=t.TARGET_BUFFER_FACTOR,a=i,s=e[0],u=e[e.length-2];return 1/(1+(o*n-a)/i+Math.exp(3-2*s-u)/r)}(t,i,n,r);case"log":return function(t,e,i,n){var r=t.TARGET_BITRATE_FACTOR,o=t.TARGET_BUFFER_FACTOR,a=i,s=e[0],u=e[e.length-1];return 1/(1+(o*n-a)/i+2*u*u/(r*s*e[e.length-2]))}(t,e,n,r)}},e.computeBeta=function(t,e,i,n){return e*((t.TARGET_BUFFER_FACTOR*i-n)/n)},e.computeGamma=function(t,e){return 1-t-e},e.determineBandwidthCost=function(t,e){return e?t/e:1},e.determineBufferCost=function(t,e,i){return i<=e?1/0:t*(e/(i-e))},e.determineQualityCost=function(t,e,i){var n=t[t.length-1],r=t[0],o=t[e];return Math.exp(n+i-2*o)/Math.exp(2*n-2*r)},e.getAverageSelectedQuality=function(t,e){if(0===t.length)return 0;var i=t.slice(-e);return i.reduce(function(t,e){return t+e})/i.length},e.canUseWishAlgorithm=function(t,e){return!(t.length<=1||!e)}},82873:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.BandwidthValueType=void 0,e.getBandwidth=function(t){if(0!==t.length){for(var e=t.length,r=e-1;r>=0;r--){var o=t[r].value,a=o.downloadRate,s=o.segmentBitrate;if(void 0===s||a<s*n)return{rateBps:a,type:i.Accurate}}return{rateBps:t[e-1].value.downloadRate,type:i.Estimated}}};var i,n=.9;!function(t){t.Accurate="accurate",t.Estimated="estimated"}(i||(e.BandwidthValueType=i={}))},24296:function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.LowLatencyAbr=void 0;var n=i(80813),r=i(46151),o=i(33436),a=i(59113),s=i(28922),u=i(7676),l=i(82873),h=i(50265),p=i(52902),d=function(){function t(t,e){this.context=t,this.mimeType=e,this.yhb=new h.RateLimitedCancelCheck}return Object.defineProperty(t.prototype,"zhb",{get:function(){return this.context.serviceManager.get(n.ServiceName.ManifestService,this.context.sourceContext.sourceIdentifier)},enumerable:!1,configurable:!0}),t.prototype.Ahb=function(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];this.context.logger},t.prototype.Bhb=function(){var t=(0,r.getMetricsHistoryFromInstanceState)(this.context.store.getState(),this.mimeType,o.MetricType.ChunkedDownloadInformation),e=this.Chb();return(0,l.getBandwidth)(t.slice(-e))},t.prototype.Chb=function(){var t,e=null===(t=this.context.config.adaptation)||void 0===t?void 0:t.qualityStabilityBalance,i=Math.ceil(20*e);return Math.max(1,i)},t.prototype.Dhb=function(t){var e,i,n,r,o=null!==(n=null===(i=null===(e=this.zhb)||void 0===e?void 0:e.getAdaptationSet(t))||void 0===i?void 0:i.Representation)&&void 0!==n?n:[],a=(0,u.getLowestRepresentation)(o);return null!==(r=null==a?void 0:a._internalId.equals(t))&&void 0!==r&&r},t.prototype.getCurrentBitrateMeasurement=function(){var t,e;return null!==(e=null===(t=this.Bhb())||void 0===t?void 0:t.rateBps)&&void 0!==e?e:0},t.prototype.getLowestRepresentation=function(){var t,e,i;if(this.xhb){var n=null!==(i=null===(e=null===(t=this.zhb)||void 0===t?void 0:t.getAdaptationSet(this.xhb._internalId))||void 0===e?void 0:e.Representation)&&void 0!==i?i:[];return(0,u.getLowestRepresentation)(n)}},t.prototype.selectRepresentationID=function(t,e){var i,n,a,h;if(e&&0!==e.length){var p,d=this.Bhb();if(this.Ahb("current bandwidth",d),!d)return null===(i=(0,u.getLowestRepresentation)(e))||void 0===i?void 0:i._internalId;if(d.type===l.BandwidthValueType.Accurate&&(p=null!==(n=this.findRepresentationForBitrate(d.rateBps,e))&&void 0!==n?n:void 0,this.Ahb("accurate value, selecting ",null==p?void 0:p._bandwidth)),d.type===l.BandwidthValueType.Estimated){var c=null===(a=(0,r.getMetricsLastEntry)((0,r.getMetricsState)(this.context.store.getState()),this.mimeType,o.MetricType.ChunkedDownloadInformation).value)||void 0===a?void 0:a.representationBitrate;void 0!==c&&(p=(0,s.findNextHigherBitrateRepresentation)(e,c),this.Ahb("estimated value, currently on ".concat(c,", selecting ").concat(null==p?void 0:p._bandwidth)))}return p?p._internalId:null===(h=(0,u.getLowestRepresentation)(e))||void 0===h?void 0:h._internalId}},t.prototype.findRepresentationForBitrate=function(t,e){var i,n;if(!e||e.length<1)return null;var r=null===(i=(0,a.findQualityForBitrate)(t,e.map(function(t){return{rep:t,bitrate:t._bandwidth}})))||void 0===i?void 0:i.rep;return null!==(n=null!=r?r:(0,u.getLowestRepresentation)(e))&&void 0!==n?n:null},t.prototype.shouldDownloadBeCancelled=function(t,e){if(this.yhb.shouldExecuteCancelCheck(t)){if(this.Dhb(e))return!1;var i=(0,p.shouldCancelDownload)(t);return i&&this.Ahb("Cancelling segment download, current download rate is significantly lower than segment bitrate"),i}return!1},t.prototype.addSample=function(t){},t.prototype.setAdaptationSet=function(t){this.xhb=t},t.prototype.setStartupPhase=function(){},t.prototype.shutdown=function(){},t.prototype.dispose=function(){this.shutdown()},t}();e.LowLatencyAbr=d},50265:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.RateLimitedCancelCheck=void 0;var i=function(){function t(){this.Pjb=0}return t.prototype.shouldExecuteCancelCheck=function(t){if(void 0===t.segmentDuration||void 0===t.elapsedTime)return!1;this.Qjb(t)&&(this.Pjb=0);var e=this.Pjb+.2;if(t.elapsedTime>=t.segmentDuration*e){var i=t.elapsedTime/t.segmentDuration;return this.Pjb=.2*Math.floor(i/.2),!0}return!1},t.prototype.Qjb=function(t){return t.elapsedTime<this.Pjb*t.segmentDuration},t}();e.RateLimitedCancelCheck=i},52902:function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.shouldCancelDownload=function(t){var e=t.responseTiming;if(!e)return!1;var i=e.progressTimestamp,o=e.headersReceivedTimestamp;if(!((0,n.isNumber)(o)&&o>-1&&(0,n.isNumber)(i)&&i>-1))return!1;var a=i-o,s=(0,r.bytesToBits)(t.loadedBytes)/a,u=1-(0,r.bytesToBits)(t.loadedBytes)/(t.representationBitrate*t.segmentDuration);return s<t.representationBitrate*u};var n=i(23068),r=i(33004)},4865:function(t,e,i){var n=this&&this.__extends||function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();Object.defineProperty(e,"__esModule",{value:!0}),e.BlockBasedRateMeasurementRule=void 0;var r=i(46151),o=i(33436),a=i(70850),s=i(59406),u=1e6,l=function(t){function e(e,i){var n,r,o,s,u=t.call(this,e,i)||this;return u.Sjb=e.settings,u.Rjb=i,u.Xjb=!0,u.Vjb=16e5,null!=(null===(r=null===(n=e.config)||void 0===n?void 0:n.adaptation)||void 0===r?void 0:r.maxStartupBitrate)&&(u.Vjb=a.Util.extractBitrateFromString("max",e.config.adaptation.maxStartupBitrate)),null!=(null===(s=null===(o=e.config)||void 0===o?void 0:o.adaptation)||void 0===s?void 0:s.startupBitrate)&&(u.Tjb=a.Util.extractBitrateFromString("min",e.config.adaptation.startupBitrate)),u.Wjb={bytes:0,time:0},u.Ujb=[],u}return n(e,t),e.calcRateInBps=function(t,e){return 8*t/e},e.prototype.Yjb=function(t){var i=this.Ujb.pop();if((null==i?void 0:i.bytes)===u&&(this.Ujb.push(i),i=void 0),i||(i={bytes:0,time:0,rateInBps:0}),i.bytes+t.bytes<=u){var n=i.bytes+t.bytes,r=i.time+t.time;this.Ujb.push({bytes:n,time:r,rateInBps:e.calcRateInBps(n,r)})}else{var o=(u-i.bytes)/t.bytes;i.bytes+=t.bytes*o,i.time+=t.time*o,i.rateInBps=e.calcRateInBps(i.bytes,i.time),this.Ujb.push(i);for(var a=t.bytes*(1-o),s=t.time*(1-o);a>u;){var l=s/(a/u);this.Ujb.push({bytes:u,time:l,rateInBps:e.calcRateInBps(u,l)}),a-=u,s-=l}this.Ujb.push({bytes:a,time:s,rateInBps:e.calcRateInBps(a,s)})}},e.prototype.Zjb=function(t){if(t&&!isNaN(t.bytes)){var e=this.Wjb;if(e.bytes===t.bytes&&e.time===t.time)return;this.Wjb=t,this.Yjb(t),this.Ujb.length>40&&this.Ujb.shift(),this.cjb()}},e.prototype.ajb=function(t,i){var n,r=-t;null!=i&&(r=-t-i,n=-i);var o=this.Ujb.slice(r,n);if(0===o.length)return 0;var a=o.reduce(function(t,e){return{bytes:t.bytes+e.bytes,time:t.time+e.time,rateInBps:t.rateInBps+e.rateInBps}});return a.rateInBps=e.calcRateInBps(a.bytes,a.time),a.rateInBps},e.prototype.bjb=function(){if(null==this.Tjb)return null;var t=this.Tjb;return t*=1+this.Sjb.RATE_SAFETY_MARGIN_PERCENTAGE/100,t+=8,isNaN(t)?null:{bytes:h(t),time:1}},e.prototype.addSample=function(){if(this.instanceState){var t=(0,r.getMetricsState)(this.instanceState),e=(0,r.getMetricsLastEntry)(t,this.Rjb,o.MetricType.DownloadInformation);if(this.Xjb){this.Xjb=!1;var i=this.bjb();i&&(e={value:i})}if(!e||!e.value||!e.value.bytes){e=e||{};var n=this.djb();n>0&&(e.value={bytes:h(n),time:1}),e&&e.value||(e=(0,r.getMetricsLastEntry)(t,"default",o.MetricType.DownloadInformation));var a=1/0;e&&e.value&&!isNaN(e.value.bytes)&&!isNaN(e.value.time)&&(a=e.value.bytes/e.value.time),a>this.Vjb&&(e.value=e.value||{},e.value.bytes=h(this.Vjb),e.value.time=1)}this.Zjb(e.value)}},e.prototype.getStatus=function(t){0===this.Ujb.length&&this.addSample();var e=this.ajb(t),i=this.ajb(t,1);return{value:e,result:e>1.1*i?s.Rules.SHOULD_SWITCH_UP:e<.9*i?s.Rules.SHOULD_SWITCH_DOWN:s.Rules.SHOULD_STAY}},e.prototype.cjb=function(){if(this.instanceState){var t=(0,r.getMetricsHistoryFromInstanceState)(this.instanceState,this.Rjb,o.MetricType.DownloadInformation).slice(-3).map(function(t){return Math.round(8*t.value.bytes/t.value.time)});this.context.storedConfig.set("b",t),this.context.storedConfig.set("b_t",Date.now())}},e.prototype.djb=function(){var t=this.context.storedConfig.get("b")||[];return Math.round(t.reduce(function(t,e){return t+e},0)/t.length)||-1},e.prototype.shutdown=function(){},e.prototype.setStartupPhase=function(){},e.prototype.dispose=function(){},e}(s.AdaptationRule);function h(t){return t/8}e.BlockBasedRateMeasurementRule=l},20066:function(t,e,i){var n=this&&this.__extends||function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();Object.defineProperty(e,"__esModule",{value:!0}),e.BufferFillRateRule=void 0;var r=i(89927),o=i(88844),a=i(59406),s=function(t){function e(e,i){var n=t.call(this,e,i)||this;return n.ejb=e.bufferSettings,n.fjb=!0,n.hjb=[],n}return n(e,t),e.prototype.ijb=function(){if(0===this.hjb.length)return NaN;var t=this.hjb[this.hjb.length-1],e=t.bufferTargetLevel;if(this.fjb){var i=t.bufferLevel,n=this.hjb[this.hjb.length-2],r=0;n&&(r=n.bufferLevel),i>=t.bufferTargetLevel||r>i?this.fjb=!1:e=i}return e},e.prototype.jjb=function(t){isNaN(t)&&(t=this.ejb.getForwardTargetLevel());for(var e,i=Date.now()-(0,r.toMilliSeconds)(t),n=0,o=0,a=0;a<this.hjb.length;a++)(e=this.hjb[a]).timestamp>=i&&(n+=e.bufferLevel-o),o=e.bufferLevel;return n/=this.ijb(),isNaN(n)?1:n},e.prototype.addSample=function(t){var e=this;this.gjb||(this.gjb=window.setTimeout(function(){e.fjb=!1},(0,r.toMilliSeconds)(this.ejb.getForwardTargetLevel()))),this.hjb.push(t),t.timestamp-this.hjb[0].timestamp>6e4&&this.hjb.shift()},e.prototype.getStatus=function(t){var e=this.jjb(t),i=a.Rules.SHOULD_STAY;return e>.7?i=a.Rules.SHOULD_SWITCH_UP:e<-.5&&(i=a.Rules.SHOULD_SWITCH_DOWN),{value:e,result:i}},e.prototype.setStartupPhase=function(){this.fjb=!0},e.prototype.shutdown=function(){(0,o.clearTimeoutIfDefined)(this.gjb),this.gjb=void 0},e.prototype.dispose=function(){this.shutdown(),this.hjb=[]},e}(a.AdaptationRule);e.BufferFillRateRule=s},64463:function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.BufferFillStateRule=function(t,e){var i,s,u=!0,l={timestamp:Date.now(),bufferTargetLevel:(null===(i=n.DefaultSettings.TARGET_BUFFER_LEVEL.video)||void 0===i?void 0:i.forwardduration)||0,bufferLevel:0},h=function(){(0,o.clearTimeoutIfDefined)(s),s=void 0};return{addSample:function(e){s||(s=window.setTimeout(function(){u=!1},(0,r.toMilliSeconds)(t.bufferSettings.getForwardTargetLevel()))),l=e},getStatus:function(){var t;return l.bufferLevel>.8*l.bufferTargetLevel?(t=a.Rules.SHOULD_SWITCH_UP,u&&(u=!1,(0,o.clearTimeoutIfDefined)(s))):t=l.bufferLevel<.4*l.bufferTargetLevel?a.Rules.SHOULD_SWITCH_DOWN:a.Rules.SHOULD_STAY,u&&(t=a.Rules.SHOULD_STAY),{value:l.bufferLevel,result:t}},setStartupPhase:function(){u=!0},shutdown:h,dispose:function(){h()}}};var n=i(70962),r=i(89927),o=i(88844),a=i(59406)},43829:function(t,e,i){var n=this&&this.__extends||function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();Object.defineProperty(e,"__esModule",{value:!0}),e.DownloadRateRule=void 0;var r=i(89927),o=i(59406),a=function(t){function e(e,i){var n=t.call(this,e,i)||this;return n.kjb=[],n}return n(e,t),e.prototype.ljb=function(t){void 0===t&&(t=this.context.bufferSettings.getForwardTargetLevel());var e=Date.now()-(0,r.toMilliSeconds)(t),i=this.kjb.filter(function(t){return t.timestamp>=e});if(0===i.length)return 1;var n=0;return i.forEach(function(t,e){var o=i[e-1],a=t.segmentDuration,s=a/8,u=Math.min(t.bufferLevel/t.bufferTargetLevel,1),l=Math.max(t.segmentDownloadDuration,s),h=u*(a/l)+a/(o?Math.max(t.timestamp-o.timestamp,s):(0,r.toMilliSeconds)(Math.max(a,l)))*(1-u);n=t.downloadCancelled?n-h:n+h}),n/i.length},e.prototype.addSample=function(t){(function(t){return null!=t.segmentDuration&&null!=t.segmentDownloadDuration})(t)&&(this.kjb.push(t),t.timestamp-this.kjb[0].timestamp>6e4&&this.kjb.shift())},e.prototype.getStatus=function(t,e){var i=this.ljb(t),n=o.Rules.SHOULD_STAY;return i>1.7?n=o.Rules.SHOULD_SWITCH_UP:i<.5&&(n=o.Rules.SHOULD_SWITCH_DOWN),{value:i,result:n}},e.prototype.setStartupPhase=function(){},e.prototype.shutdown=function(){},e.prototype.dispose=function(){this.shutdown(),this.kjb=[]},e}(o.AdaptationRule);e.DownloadRateRule=a},59406:function(t,e){var i;Object.defineProperty(e,"__esModule",{value:!0}),e.AdaptationRule=e.Rules=void 0,function(t){t.SHOULD_SWITCH_UP="SWITCH_UP",t.SHOULD_STAY="STAY",t.SHOULD_SWITCH_DOWN="SWITCH_DOWN"}(i||(e.Rules=i={}));var n=function(){function t(t,e){this.context=t,this.samples=[],this.mimeType=e,this.logger=t.logger,this.Settings=t.settings,this.maxHistorySize=this.Settings.DEFAULT_ADAPTATION_RULE_HISTORY_SIZE}return Object.defineProperty(t.prototype,"instanceState",{get:function(){var t;return null===(t=this.context.store)||void 0===t?void 0:t.getState()},enumerable:!1,configurable:!0}),t.prototype.estimateStatus=function(t,e,i){return this.getStatus(e,i)},t}();e.AdaptationRule=n},39185:function(t,e,i){var n=this&&this.__extends||function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();Object.defineProperty(e,"__esModule",{value:!0}),e.SegmentBasedRateMeasurementRule=void 0;var r=i(46151),o=i(33436),a=i(89927),s=i(70850),u=i(17006),l=i(7676),h=i(59406),p=function(t){function e(e,i){var n=t.call(this,e,i)||this;return n.rjb=-1,n.sjb=.1,n.tjb=!0,n}return n(e,t),e.getBitrateFromPerformanceAPI=function(){if(!performance||"function"!=typeof performance.getEntriesByName)return 0;var t=0,e=0;return performance.getEntriesByType("resource").filter(d).forEach(function(i){t+=8*i.transferSize,e+=(0,a.toSeconds)(i.duration-(i.responseStart-i.requestStart))}),t>0&&e>0?t/e:0},e.prototype.ujb=function(t,e,i){var n;void 0===e&&(e=1),void 0===i&&(i=0);var r=-t-i;return n=0!==i?this.samples.slice(r,-i):this.samples.slice(r),(0,u.calculateExponentialWeightedAverage)(n,1-e)},e.validateDownloadInfo=function(t){if(Boolean(t)&&Boolean(t.value)){var e=Boolean(t.value.bytes),i=!isNaN(t.value.time),n=void 0!==t.value.timeToFirstByte&&!isNaN(t.value.timeToFirstByte);return e&&i&&n}return!1},e.prototype.vjb=function(t){if(!this.instanceState)return 0;var i=(0,r.getMetricsLastEntry)((0,r.getMetricsState)(this.instanceState),t,o.MetricType.DownloadInformation),n=e.validateDownloadInfo(i),a=n&&this.rjb<i.time;return a&&isFinite(i.time)&&(this.rjb=i.time),n&&a?c(i,this.context.settings.MAX_ALLOWED_BANDWIDTH_ESTIMATION):n&&!a?-1:0},e.prototype.wjb=function(){var t=[],i=this.yjb();i>0&&t.push(i);var n=this.vjb("default");n>0&&t.push(n);var r=Math.min.apply(Math,t);return r>0&&isFinite(r)?r:e.getBitrateFromPerformanceAPI()},e.prototype.addSample=function(){var t=this.vjb(this.mimeType),e=0;this.tjb&&(e=function(t,e){var i=(0,l.getStartupBitrateFromConfig)(t),n=(0,l.getMaxStartupBitrateFromConfig)(t);return n=e>0?Math.min(n,e):n,i||n||0}(this.context,t),this.tjb=!1),0===(e=e||t||0)&&(e=this.wjb()),e>0&&(this.samples.push(e),this.samples.length>this.maxHistorySize&&this.samples.splice(0,this.samples.length-this.maxHistorySize)),t>0&&this.xjb()},e.prototype.getStatus=function(t,e){void 0===t&&(t=1),void 0===e&&(e=1),0===this.samples.length&&this.addSample();var i=this.ujb(t,e),n=this.ujb(t,e,1);return{value:i,result:i>n*(1+this.sjb)?h.Rules.SHOULD_SWITCH_UP:i<n*(1-this.sjb)?h.Rules.SHOULD_SWITCH_DOWN:h.Rules.SHOULD_STAY}},e.prototype.xjb=function(){if(this.instanceState){var t=(0,r.getMetricsHistoryFromInstanceState)(this.instanceState,this.mimeType,o.MetricType.DownloadInformation).filter(e.validateDownloadInfo).slice(-3).map(function(t){return c(t)});this.context.storedConfig.set("b",t),this.context.storedConfig.set("b_t",Date.now())}},e.prototype.yjb=function(){var t=this,e=(this.context.storedConfig.get("b")||[]).map(function(e){return f(e,t.context.settings.MAX_ALLOWED_BANDWIDTH_ESTIMATION)});return Math.round(e.reduce(function(t,e){return t+e},0)/e.length)||0},e.prototype.shutdown=function(){},e.prototype.setStartupPhase=function(){},e.prototype.dispose=function(){},e}(h.AdaptationRule);function d(t){return t.transferSize>0&&!/^https?:\/\/localhost(:\d+)?(\/|$)/.test(t.name)}function c(t,e){var i;void 0===e&&(e=1/0);var n=t.value.time-(null!==(i=t.value.timeToFirstByte)&&void 0!==i?i:0);return f(8*t.value.bytes/n,e)}function f(t,e){var i=s.Util.extractBitrateFromString("max",e);return Math.min(t,i)}e.SegmentBasedRateMeasurementRule=p},45199:function(t,e,i){var n=this&&this.__extends||function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),r=this&&this.__spreadArray||function(t,e,i){if(i||2===arguments.length)for(var n,r=0,o=e.length;r<o;r++)!n&&r in e||(n||(n=Array.prototype.slice.call(e,0,r)),n[r]=e[r]);return t.concat(n||Array.prototype.slice.call(e))};Object.defineProperty(e,"__esModule",{value:!0}),e.TimeToFirstByteMeasurementRule=void 0;var o=i(46151),a=i(33436),s=i(17006),u=i(59406),l=function(t){function e(e,i){var n=t.call(this,e,i)||this;return n.zjb=-1,n}return n(e,t),e.prototype.Ajb=function(t){if(!this.instanceState)return 0;var e=(0,o.getMetricsLastEntry)((0,o.getMetricsState)(this.instanceState),t,a.MetricType.DownloadInformation),i=Boolean(e)&&Boolean(e.value),n=i&&void 0!==e.value.timeToFirstByte&&!isNaN(e.value.timeToFirstByte),r=i&&this.zjb<e.time;return r&&isFinite(e.time)&&(this.zjb=e.time),n&&r?e.value.timeToFirstByte:n&&!r?-1:0},e.prototype.addSample=function(){var t=this.Ajb(this.mimeType),e=this.Ajb("default"),i=t||e||0;if(i>0)for(this.samples.push(i);this.samples.length>this.maxHistorySize;)this.samples.shift()},e.prototype.Bjb=function(t){var e=-t;return t>0?this.samples.slice(e):[]},e.prototype.Cjb=function(t,e){var i=(0,s.calculateMean)(t),n=(0,s.calculateExponentialWeightedAverage)(t,e),r=(0,s.calculateStandardDeviation)(t,i);return{value:{median:(0,s.calculateMedian)(t),mean:i,weightedAverage:n,standardDeviation:r},result:u.Rules.SHOULD_STAY}},e.prototype.getStatus=function(t,e){return void 0===t&&(t=1),void 0===e&&(e=1),this.Cjb(this.Bjb(t),e)},e.prototype.estimateStatus=function(t,e,i){void 0===e&&(e=1),void 0===i&&(i=1);var n=r(r([],this.Bjb(e-1),!0),[t],!1);return this.Cjb(n,i)},e.prototype.setStartupPhase=function(){},e.prototype.shutdown=function(){},e.prototype.dispose=function(){},e}(u.AdaptationRule);e.TimeToFirstByteMeasurementRule=l},28922:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.findNextHigherBitrateRepresentation=function(t,e){for(var i,n,r=0,o=t;r<o.length;r++){var a=o[r];a._bandwidth>e&&(void 0===i||a._bandwidth<i._bandwidth)&&(i=a),(void 0===n||a._bandwidth>n._bandwidth)&&(n=a)}return null!=i?i:n}},83429:function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.getUserSelectedRepresentation=function(t,e,i,a){var s,u,l=function(t,e){return r.MimeTypeHelper.isAudio(t)?null==e?void 0:e.onAudioAdaptation:r.MimeTypeHelper.isVideo(t)?null==e?void 0:e.onVideoAdaptation:void 0}(e,t.config.adaptation);if(l){var h=t.serviceManager.maybeCall(n.ServiceName.ManifestService,function(t){return t.getAdaptationSet(i)},null,t.sourceContext.sourceIdentifier),p=null!==(s=null==h?void 0:h.Representation.map(function(t){return{bandwidth:t._bandwidth,id:t._id}}))&&void 0!==s?s:[],d={suggested:a.representationId,isAd:t.sourceContext.isAd,representations:p},c=null!==(u=(0,o.safeUserCallback)(function(){return l(d)},t.logger))&&void 0!==u?u:void 0;return function(t,e,i){return t.serviceManager.maybeCall(n.ServiceName.ManifestService,function(t){return e&&t.getRepresentation(e,i)},void 0,t.sourceContext.sourceIdentifier)||void 0}(t,i,c)}};var n=i(80813),r=i(85434),o=i(70850)}},function(t){return function(){return t(76344)}()}])});
17
+ "use strict";!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.abr=e():(t.bitmovin=t.bitmovin||{},t.bitmovin.player=t.bitmovin.player||{},t.bitmovin.player.abr=e())}(self,function(){return(self.webpackChunkbitmovin_player=self.webpackChunkbitmovin_player||[]).push([[744],{98154:function(t,e,i){var n=this&&this.__assign||function(){return n=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var r in e=arguments[i])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},n.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.AdaptationApiFactory=void 0;var r=i(23068),o=function(){function t(){}return t.create=function(t){return{setConfig:function(e){"Updating adaptation config with ".concat(JSON.stringify(e)),(0,r.isNumber)(e.qualityStabilityBalance)&&function(e){if(e<0||e>1)"Failed to set qualityStabilityBalance to ".concat(e,", valid range is 0 to 1");else{var i=t.getConfig(!0).adaptation;i&&(i.qualityStabilityBalance=e,"Updated qualityStabilityBalance to ".concat(e))}}(e.qualityStabilityBalance),e.resolution&&function(e){var i=e.maxSelectableVideoHeight,n=e.maxSelectableVideoWidth,r=e.minSelectableVideoHeight,o=e.minSelectableVideoWidth,s=t.getConfig(!0).adaptation.resolution;a(i)&&(s.maxSelectableVideoHeight=i),a(n)&&(s.maxSelectableVideoWidth=n),a(r)&&(s.minSelectableVideoHeight=r),a(o)&&(s.minSelectableVideoWidth=o),"Updated resolution boundaries to ".concat(JSON.stringify(s))}(e.resolution),(0,r.isBoolean)(e.limitToPlayerSize)&&function(e){var i=t.getConfig(!0).adaptation;i&&(i.limitToPlayerSize=e,"Updated limitToPlayerSize to ".concat(e))}(e.limitToPlayerSize)},getConfig:function(){var e=t.getConfig(!0).adaptation,i=e.qualityStabilityBalance,r=e.resolution,o=e.limitToPlayerSize;return{qualityStabilityBalance:i,resolution:n({},r),limitToPlayerSize:o}}}},t}();function a(t){return(0,r.isNumber)(t)&&t>=0}e.AdaptationApiFactory=o},89498:function(t,e,i){var n=this&&this.__assign||function(){return n=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var r in e=arguments[i])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},n.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.AdaptationHandler=void 0;var r=i(80813),o=i(98714),a=i(49859),s=i(91678),u=i(33436),l=i(86897),h=i(93204),p=i(79721),d=i(85434),c=i(70850),f=i(46057),v=i(47151),g=i(79505),y=i(49024),b=i(19119),m=i(43008),R=i(59113),S=i(7676),_=1/0,T=function(){function t(t,e,i){var n,r,o=this;this.context=t,this.mimeType=e,this.constraints=i,this.iQ=!1,this.kQ=function(t){var e;return void 0===t&&(t=null===(e=o.gQ)||void 0===e?void 0:e.getState()),t?(0,a.getPreferredBitrate)((0,a.getAdaptationState)(t),o.mimeType):null},this.PP=(0,y.createAdaptationLogic)(this.context,this.mimeType,{minBitrate:this.constraints.minBitrate,maxBitrate:this.constraints.maxBitrate},null===(r=null===(n=this.context.config)||void 0===n?void 0:n.adaptation)||void 0===r?void 0:r.logic),this.TP=this.AQ(this.eQ),this.rQ()}return Object.defineProperty(t.prototype,"gQ",{get:function(){var t=this.context.sourceContext.sourceIdentifier;return this.context.serviceManager.get(r.ServiceName.SourceStoreService,t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"jQ",{get:function(){var t=this.context.sourceContext.sourceIdentifier;return this.context.serviceManager.get(r.ServiceName.ManifestService,t)},enumerable:!1,configurable:!0}),t.prototype.lQ=function(t,e,i){var n,r;return t?this.TP:e&&null!==(r=null===(n=this.PP.findRepresentationForBitrate(e,i))||void 0===n?void 0:n._internalId)&&void 0!==r?r:null},t.prototype.mQ=function(t,e){var i,n=this.nQ(),r=this.kQ();return n||r?this.lQ(n,r,e):null!==(i=this.PP.selectRepresentationID(t,e))&&void 0!==i?i:null},t.prototype.nQ=function(){return!this.isAuto()&&Boolean(this.sQ(this.TP,this.pQ()))},t.prototype.oQ=function(t){this.QP=t},t.prototype.pQ=function(){var t,e,i;return null!==(i=null===(e=null===(t=this.jQ)||void 0===t?void 0:t.getAdaptationSet(this.eQ))||void 0===e?void 0:e.Representation)&&void 0!==i?i:[]},t.prototype.selectRepresentationID=function(t,e){void 0===t&&(t={});var i=this.tQ(null!=e?e:this.pQ()),n=this.mQ(t,i);return n&&this.oQ(n),this.QP},t.prototype.qQ=function(){var t=this,e=Boolean(this.SP);this.gQ&&!e&&(this.SP=(0,h.subscribe)(this.gQ)(l.getBufferStateMap,function(e){var i,n,r=null==e?void 0:e[t.mimeType];if(r){var a=r.rendererRanges;a&&a.length>0&&(null===(i=t.gQ)||void 0===i||i.dispatch((0,o.clearPreferredBitrateForMimeTypeAction)(t.mimeType)),null===(n=t.SP)||void 0===n||n.call(t),t.SP=void 0)}}))},t.prototype.rQ=function(){var t=this;this.gQ&&(this.kQ()&&this.qQ(),this.RP=(0,h.subscribe)(this.gQ)(this.kQ,function(){return t.qQ()},function(t){return Boolean(t)}))},t.prototype.sQ=function(t,e){var i;return e?e.find(function(e){return e._internalId.equals(t)}):null===(i=this.jQ)||void 0===i?void 0:i.getRepresentationById(t)},t.prototype.tQ=function(t){this.xQ();var e=t.map(function(t){return{representation:t,bitrate:t._bandwidth,width:t._width,height:t._height}});return this.uQ(e).map(function(t){return t.representation})},t.prototype.uQ=function(t){var e=this,i=this.context.config.adaptation.resolution,n=i.minSelectableVideoHeight,r=i.maxSelectableVideoHeight,o=i.minSelectableVideoWidth,a=i.maxSelectableVideoWidth,s=t.filter(function(t){return!((0,m.hasBitrate)(t)&&!w(t.bitrate,e.constraints.minBitrate,e.constraints.maxBitrate))&&(!(0,m.hasResolution)(t)||w(t.width,o,a)&&w(t.height,n,r))});if(s.length>0)return s;var u=this.vQ(t);return u?[u]:t},t.prototype.vQ=function(t){var e=0!==this.constraints.minBitrate,i=this.constraints.maxBitrate!==_,n=t.filter(m.hasBitrate);return e?(0,S.findMaximum)(n,function(t){return t.bitrate}):i?(0,S.findMinimum)(n,function(t){return t.bitrate}):d.MimeTypeHelper.isVideo(this.mimeType)?this.wQ(t):void 0},t.prototype.wQ=function(t){var e=this.context.config.adaptation.resolution,i=e.minSelectableVideoHeight,n=e.maxSelectableVideoHeight,r=e.minSelectableVideoWidth,o=e.maxSelectableVideoWidth,a=t.filter(m.hasResolution);return 0!==i?(0,S.findMaximum)(a,function(t){return t.height}):n!==1/0?(0,S.findMinimum)(a,function(t){return t.height}):0!==r?(0,S.findMaximum)(a,function(t){return t.width}):o!==1/0?(0,S.findMinimum)(a,function(t){return t.width}):void 0},t.prototype.xQ=function(){d.MimeTypeHelper.isVideo(this.mimeType)&&(this.context.config.adaptation.limitToPlayerSize&&!this.iQ?this.zQ():!this.context.config.adaptation.limitToPlayerSize&&this.iQ&&this.yQ())},t.prototype.yQ=function(){this.iQ=!1,this.context.config.adaptation.onVideoAdaptation=this.hQ},t.prototype.zQ=function(){var t=this;this.iQ=!0;var e=this.context.config.adaptation.onVideoAdaptation;this.hQ=e,this.context.config.adaptation.onVideoAdaptation=e&&"function"==typeof e?function(i){var n,r,o;return i.suggested=(0,b.AdaptToPlayerResolution)(t.context.internalPlayer,i.suggested,null!==(r=null===(n=t.fQ)||void 0===n?void 0:n.isFullscreen())&&void 0!==r&&r)||i.suggested,null!==(o=(0,c.safeUserCallback)(function(){return e(i)},t.context.logger))&&void 0!==o?o:i.suggested}:function(e){var i,n;return(0,b.AdaptToPlayerResolution)(t.context.internalPlayer,e.suggested,null!==(n=null===(i=t.fQ)||void 0===i?void 0:i.isFullscreen())&&void 0!==n&&n)||e.suggested}},t.prototype.AQ=function(t){return t?new g.RepresentationId(t,"auto"):new g.RepresentationId(new v.AdaptationSetId(p.DEFAULT_PERIOD_ID,this.mimeType),"auto")},t.prototype.BQ=function(t){var e,i={id:t._id,bitrate:t._bandwidth,width:t._width,height:t._height};null===(e=this.context.store)||void 0===e||e.dispatch((0,s.addMetricsValue)(this.mimeType,u.MetricType.DownloadedAdaptationSet,i))},t.prototype.CQ=function(){var t,e,i=this;if(this.jQ){var r=this.jQ.getAdaptationSet(this.eQ);if(r){var o=n(n({},r),{Representation:this.tQ(r.Representation),_minBandwidth:Math.max(null!==(t=r._minBandwidth)&&void 0!==t?t:0,this.constraints.minBitrate),_maxBandwidth:Math.min(null!==(e=r._maxBandwidth)&&void 0!==e?e:_,this.constraints.maxBitrate)});this.PP.setAdaptationSet(o),(0,f.yieldToMain)().then(function(){return i.BQ(o)})}}},t.prototype.DQ=function(t){return this.eQ&&t&&this.jQ?this.jQ.getRepresentation(this.eQ,t):null},t.prototype.EQ=function(){if(this.TP){var t=this.TP.representationId;this.TP=this.AQ(this.eQ);var e=this.DQ(t);e&&(this.TP=e._internalId)}else this.TP=this.AQ(this.eQ)},t.prototype.setAdaptationSetId=function(t){this.eQ=t,this.EQ(),this.CQ()},t.prototype.setFixedRepresentation=function(t){var e;if("auto"===t)this.TP=new g.RepresentationId(this.eQ,"auto");else if(this.eQ){var i=null===(e=this.jQ)||void 0===e?void 0:e.getRepresentation(this.eQ,t);i&&(this.TP=i._internalId,this.selectRepresentationID())}},t.prototype.getFixedRepresentation=function(){return this.QP},t.prototype.getLowestRepresentationId=function(){var t;return this.isAuto()?null===(t=this.PP.getLowestRepresentation())||void 0===t?void 0:t._internalId.representationId:this.TP.representationId},t.prototype.isAuto=function(){return"auto"===this.TP.representationId},t.prototype.shouldDownloadBeCancelled=function(t,e){var i,n,r,o,a,s,u,l=null!==(n=null===(i=this.context.config.adaptation)||void 0===i?void 0:i.disableDownloadCancelling)&&void 0!==n&&n,h=null!==(a=null===(o=null===(r=this.jQ)||void 0===r?void 0:r.getAdaptationSet(this.eQ))||void 0===o?void 0:o.Representation)&&void 0!==a?a:[],p=1===h.length,d=h.some(function(t){return Boolean(t._bandwidth)});if(!this.isAuto()||l||p||!d)return!1;var c=function(t){if(!(0,S.hasTotalBytes)(t))return 1/0;var e=function(t){var e,i=null!==(e=t.elapsedTime)&&void 0!==e?e:0;return t.loadedBytes>0&&i>0?8*t.loadedBytes/1024/i:0}(t);return e>0?8*t.totalBytes/1024/e:1/0}(t),f=(null!==(u=null===(s=t.responseTiming)||void 0===s?void 0:s.doneTimestamp)&&void 0!==u?u:0)>0,v=!!t.segmentDuration&&c>1.5*t.segmentDuration;return!(f||!v)&&!function(t){return!!(0,S.hasTotalBytes)(t)&&t.loadedBytes>=.9*t.totalBytes}(t)&&this.PP.shouldDownloadBeCancelled(t,e)},t.prototype.setStartupPhase=function(){this.PP.setStartupPhase()},t.prototype.addSample=function(t){this.PP.addSample(n({timestamp:Date.now()},t))},t.prototype.shutdown=function(){this.PP.shutdown()},t.prototype.dispose=function(){var t,e;this.shutdown(),this.PP.dispose(),null===(t=this.RP)||void 0===t||t.call(this),null===(e=this.SP)||void 0===e||e.call(this)},t.prototype.selectQualityBasedOnBitrateMeasurement=function(t){var e=this.uQ(t),i=this.kQ();if(i)return(0,R.findQualityForBitrate)(i,e);if(this.nQ()){var n=this.tQ(this.pQ()),r=this.sQ(this.QP,n);if(r)return(0,R.findQualityForBitrate)(r._bandwidth,e)}return(0,R.findQualityForBitrate)(this.PP.getCurrentBitrateMeasurement(),e)},t}();function w(t,e,i){return t>=e&&t<=i}e.AdaptationHandler=T},49024:function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.createAdaptationLogic=function(t,e,i,l){var h=i.minBitrate,p=i.maxBitrate;return void 0===l&&(l=n.AdaptationLogicType.DOWNLOAD_PREDICTION),l===n.AdaptationLogicType.LOW_LATENCY?new s.LowLatencyAbr(t,e):l===n.AdaptationLogicType.WISH?new u.WishLogic(t,e):l===n.AdaptationLogicType.DOWNLOAD_PREDICTION?new a.DownloadPredictionLogic(t,e):l===n.AdaptationLogicType.BUFFER_FILL_RATE?new r.BufferFillRateLogic(t,e):new o.BufferLogic(t,e,h||0,p||1/0)};var n=i(21281),r=i(48968),o=i(39201),a=i(85696),s=i(24296),u=i(7290)},49541:function(t,e,i){e.X=void 0;var n=i(85434),r=i(89498),o=i(83429),a=function(){function t(t){this.context=t,this.jn=new Map}return t.prototype.kn=function(t){if(t){if(!this.jn.has(t)){var e=function(t,e){var i={minBitrate:0,maxBitrate:1/0};return n.MimeTypeHelper.isVideo(t)?(i.minBitrate=Number(e.MIN_SELECTABLE_VIDEO_BITRATE)||i.minBitrate,i.maxBitrate=Number(e.MAX_SELECTABLE_VIDEO_BITRATE)||i.maxBitrate):n.MimeTypeHelper.isAudio(t)&&(i.minBitrate=Number(e.MIN_SELECTABLE_AUDIO_BITRATE)||i.minBitrate,i.maxBitrate=Number(e.MAX_SELECTABLE_AUDIO_BITRATE)||i.maxBitrate),i}(t,this.context.settings);this.jn.set(t,new r.AdaptationHandler(this.context,t,e))}return this.jn.get(t)}},t.prototype.selectRepresentation=function(t,e,i){var n,r;return void 0===e&&(e={}),null!==(r=null===(n=this.kn(t))||void 0===n?void 0:n.selectRepresentationID(e,i))&&void 0!==r?r:void 0},t.prototype.isAuto=function(t){var e,i;return null===(i=null===(e=this.kn(t))||void 0===e?void 0:e.isAuto())||void 0===i||i},t.prototype.shouldDownloadBeCancelled=function(t,e,i){var n,r;return null!==(r=null===(n=this.kn(t))||void 0===n?void 0:n.shouldDownloadBeCancelled(e,i))&&void 0!==r&&r},t.prototype.selectQualityBasedOnBitrateMeasurement=function(t,e){var i=e?this.jn.get(e):this.ln(),r=null;i||(r=null!=e?e:n.MimeType.VideoMp4,i=this.kn(r));var o=null==i?void 0:i.selectQualityBasedOnBitrateMeasurement(t);return r&&this.release(r),null!=o?o:t[0]},t.prototype.ln=function(){var t=void 0;return this.jn.forEach(function(e,i){t&&!n.MimeTypeHelper.isVideo(i)||(t=e)}),t},t.prototype.setAdaptationSetId=function(t,e){var i;null===(i=this.kn(t))||void 0===i||i.setAdaptationSetId(e)},t.prototype.setFixedRepresentation=function(t,e){var i;null===(i=this.kn(t))||void 0===i||i.setFixedRepresentation(e)},t.prototype.getCurrentRepresentationId=function(t){var e,i;return null!==(i=null===(e=this.kn(t))||void 0===e?void 0:e.getFixedRepresentation())&&void 0!==i?i:null},t.prototype.getLowestRepresentationId=function(t){var e;return null===(e=this.kn(t))||void 0===e?void 0:e.getLowestRepresentationId()},t.prototype.setStartupPhase=function(t){var e;null===(e=this.kn(t))||void 0===e||e.setStartupPhase()},t.prototype.shutdown=function(t){var e;null===(e=this.kn(t))||void 0===e||e.shutdown()},t.prototype.addSample=function(t,e){var i;null===(i=this.kn(t))||void 0===i||i.addSample(e)},t.prototype.getUserSelectedRepresentation=function(t,e,i){return(0,o.getUserSelectedRepresentation)(this.context,t,e,i)},t.prototype.release=function(t){var e;null===(e=this.jn.get(t))||void 0===e||e.dispose(),this.jn.delete(t)},t.prototype.dispose=function(){this.jn.forEach(function(t){return t.dispose()}),this.jn.clear()},t}();e.X=a},81723:function(t,e,i){var n=this&&this.__assign||function(){return n=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var r in e=arguments[i])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},n.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.BaseAdaptationLogic=void 0;var r=i(46151),o=i(15971),a=i(85434),s=i(89927),u=i(88844),l=i(59113),h=i(59406),p=i(70238),d=i(7676),c=function(){function t(t,e){this.context=t,this.mimeType=e,this.lastRateMeasurement=0,this.availableRepresentations=[],this.startupPhase=!0,this.lastDownloadCancelled=!1,this.monitoringMimeType=this.getMonitoringMimeType()}return t.prototype.getMonitoringMimeType=function(){var t,e=null,i=null===(t=this.context.store)||void 0===t?void 0:t.getState();return i&&(e=Object.keys((0,r.getMetricsState)(i)).find(a.MimeTypeHelper.isVideo)),null!=e?e:this.mimeType},t.prototype.updateAvailableRepresentations=function(t){t&&(this.availableRepresentations=t.map(function(t,e){return n(n({},t),{arrayIndex:e})}))},t.prototype.getAvailableRepresentations=function(){var t,e=this;return this.lastDownloadCancelled&&(null===(t=this.lastRepresentation)||void 0===t?void 0:t._bandwidth)?this.availableRepresentations.filter(function(t){var i=t._bandwidth;return e.lastRepresentation&&i<e.lastRepresentation._bandwidth}):this.availableRepresentations},t.prototype.setAdaptationSet=function(t){var e,i,n;if(this.updateAvailableRepresentations(t.Representation),this.lastRepresentation)this.lastRepresentation=this.findRepresentationForBitrate(this.lastRepresentation._bandwidth,t.Representation);else{var r=null===(n=null===(i=null===(e=(0,o.getSourceState)(this.context))||void 0===e?void 0:e.activeTracks)||void 0===i?void 0:i[t._internalId.adaptationSetId])||void 0===n?void 0:n.selectedRepresentationId;this.lastRepresentation=r?this.availableRepresentations.find(function(t){return t._internalId.equals(r)}):void 0}},t.prototype.findRepresentationForBitrate=function(t,e){var i,n;return this.updateAvailableRepresentations(e),null!==(n=null===(i=(0,l.findQualityForBitrate)(t,this.getAvailableRepresentations().map(function(t){return{rep:t,bitrate:Number(t._bandwidth)}})))||void 0===i?void 0:i.rep)&&void 0!==n?n:this.getLowestRepresentation()},t.prototype.checkStartupPhase=function(t){this.startupPhase&&this.tib(t)},t.prototype.getLowestRepresentation=function(){return(0,d.getLowestRepresentation)(this.availableRepresentations)},t.prototype.tib=function(t){var e=this,i=this.context.bufferSettings.getForwardTargetLevel();this.startupPhaseTimerID||(this.startupPhaseTimerID=window.setTimeout(function(){e.startupPhase=!1,e.startupPhaseTimerID=void 0},(0,s.toMilliSeconds)(i))),t.value>=.5*i&&((0,u.clearTimeoutIfDefined)(this.startupPhaseTimerID),this.startupPhase=!1,this.startupPhaseTimerID=void 0)},t.prototype.getRepresentationForNormalChange=function(t,e,i){return this.startupPhase||!i?this.getRepresentationForRateMeasurement(p.SwitchingAggressiveness.Mid):this.getRepresentationToSwitchTo(e.result,t.result)},t.prototype.getCurrentBitrate=function(t){return this.lastDownloadCancelled?this.lastRateMeasurement:t.value},t.prototype.getRepresentationToSwitchTo=function(t,e){if(this.lastDownloadCancelled)return this.switchDown(p.SwitchingAggressiveness.VeryHigh);switch(t){case h.Rules.SHOULD_SWITCH_UP:return this.ifFillStateHigh(e);case h.Rules.SHOULD_STAY:return this.ifFillStateMid(e);case h.Rules.SHOULD_SWITCH_DOWN:return this.ifFillStateLow(e);default:return this.useLastRepresentation()}},t.prototype.switchUp=function(t){var e;if(void 0===t&&(t=p.SwitchingAggressiveness.Conservative),void 0!==(null===(e=this.lastRepresentation)||void 0===e?void 0:e.arrayIndex)&&this.lastRepresentation.arrayIndex>=this.availableRepresentations.length-1)return this.lastRepresentation;var i=this.getRepresentationForRateMeasurement(t);return this.lastRepresentation&&Number(i._bandwidth)<=Number(this.lastRepresentation._bandwidth)?this.lastRepresentation:i},t.prototype.switchDown=function(t){var e,i,n,r;if(void 0===t&&(t=p.SwitchingAggressiveness.VeryHigh),void 0!==(null===(e=this.lastRepresentation)||void 0===e?void 0:e.arrayIndex)&&(null===(i=this.lastRepresentation)||void 0===i?void 0:i.arrayIndex)<1&&null!==(null===(n=this.lastRepresentation)||void 0===n?void 0:n._id))return this.lastRepresentation;var o=this.getRepresentationForRateMeasurement(t);return this.lastRepresentation&&(!o||o._bandwidth>=(null===(r=this.lastRepresentation)||void 0===r?void 0:r._bandwidth))&&(o=this.getOneRepresentationLower()),o},t.prototype.stay=function(){var t;return null!==(t=this.lastRepresentation)&&void 0!==t?t:this.getLowestRepresentation()},t.prototype.ifFillStateHigh=function(t){switch(t){case h.Rules.SHOULD_SWITCH_UP:return this.switchUp(p.SwitchingAggressiveness.VeryHigh);case h.Rules.SHOULD_STAY:return this.switchUp(p.SwitchingAggressiveness.High);case h.Rules.SHOULD_SWITCH_DOWN:default:return this.stay()}},t.prototype.ifFillStateMid=function(t){switch(t){case h.Rules.SHOULD_SWITCH_UP:return this.switchUp(p.SwitchingAggressiveness.Mid);case h.Rules.SHOULD_STAY:return this.stay();case h.Rules.SHOULD_SWITCH_DOWN:return this.switchDown(p.SwitchingAggressiveness.High);default:return this.stay()}},t.prototype.ifFillStateLow=function(t){switch(t){case h.Rules.SHOULD_SWITCH_UP:return this.stay();case h.Rules.SHOULD_STAY:return this.switchDown(p.SwitchingAggressiveness.High);case h.Rules.SHOULD_SWITCH_DOWN:return this.switchDown(p.SwitchingAggressiveness.VeryHigh);default:return this.stay()}},t.prototype.useLastRepresentation=function(){var t;return(null===(t=this.lastRepresentation)||void 0===t?void 0:t._id)?this.lastRepresentation:this.getLowestRepresentation()},t.prototype.getOneRepresentationLower=function(){var t,e,i=Math.max(0,(null!==(e=null===(t=this.lastRepresentation)||void 0===t?void 0:t.arrayIndex)&&void 0!==e?e:0)-1);return this.availableRepresentations[i]},t}();e.BaseAdaptationLogic=c},48968:function(t,e,i){var n=this&&this.__extends||function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();Object.defineProperty(e,"__esModule",{value:!0}),e.BufferFillRateLogic=void 0;var r=i(46151),o=i(33436),a=i(88844),s=i(81723),u=i(4865),l=i(20066),h=i(64463),p=i(70238),d=function(t){function e(e,i){var n=t.call(this,e,i)||this;return n.Ugb=0,n.shouldDownloadBeCancelled=function(t,e){var i,r;return 0!==(null===(i=n.lastRepresentation)||void 0===i?void 0:i.arrayIndex)&&n.Zgb()._id!==(null===(r=n.lastRepresentation)||void 0===r?void 0:r._id)&&(n.lastDownloadCancelled=!0,!0)},n.Tgb={bufferFillRate:new l.BufferFillRateRule(n.context,n.monitoringMimeType),bufferFillState:(0,h.BufferFillStateRule)(n.context,n.monitoringMimeType),rateMeasurement:new u.BlockBasedRateMeasurementRule(n.context,n.monitoringMimeType)},n}return n(e,t),e.prototype.getRepresentationForRateMeasurement=function(t){void 0===t&&(t=p.SwitchingAggressiveness.Mid);var e=this.Tgb.rateMeasurement.getStatus(t),i=this.context.settings.RATE_SAFETY_MARGIN_PERCENTAGE/100,n=e.value*(1-i);return this.findRepresentationForBitrate(n)},e.prototype.addSample=function(t){Object.values(this.Tgb).forEach(function(e){return e.addSample(t)})},e.prototype.Vgb=function(t){return this.switchDown(p.SwitchingAggressiveness.VeryHigh)},e.calcEstimatedDownloadDuration=function(t,e,i,n){var r=parseFloat((i*t/e).toFixed(2));return n&&(r*=2),1.1*r},e.prototype.Wgb=function(t,i,n,r,o){var a=e.calcEstimatedDownloadDuration(n,t,i,o);return a<r||a<=n},e.prototype.Xgb=function(t,e,i,n){var r,o,a,s=null==t?void 0:t.hlsDependentSegments;if(s&&null!==(null===(r=this.lastRepresentation)||void 0===r?void 0:r._id)&&(null===(o=this.lastRepresentation)||void 0===o?void 0:o.arrayIndex)!==e.arrayIndex){var u=Math.min.apply(null,this.availableRepresentations.map(function(t){return Number(t._bandwidth)})),l=Number(e._bandwidth);if(!(isFinite(l)&&l===u||this.Wgb(i,e._bandwidth,t.segmentDuration,n,s))){for(var h=!1,p=null!==(a=e.arrayIndex)&&void 0!==a?a:-1;p>=0;p--){var d=this.availableRepresentations[p];if(this.Wgb(i,d._bandwidth,t.segmentDuration,n,s)){e=d,h=!0;break}}h||(e=this.useLastRepresentation())}}return e},e.prototype.Ygb=function(t){var e,i=this.lastRateMeasurement>0&&2*t<=this.lastRateMeasurement;return i&&(null===(e=this.lastRepresentation)||void 0===e?void 0:e._id)?1.5*t<this.lastRepresentation._bandwidth:i},e.prototype.Zgb=function(t){var e,i,n=this.context.store.getState();n&&(i=(0,r.getMetricsState)(n));var a,s=this.Tgb.bufferFillState.getStatus(),u=this.Tgb.bufferFillRate.getStatus(),l=this.Tgb.rateMeasurement.getStatus(1).value,h=null!=i&&this.context.bufferSettings.getForwardTargetLevel()>i.default.bufferLogicActivationThreshold,d=this.Ygb(l);this.checkStartupPhase(s),a=d?this.Vgb(l):this.getRepresentationForNormalChange(u,s,h);var c=(0,r.getMetricsLastEntry)(null!=i?i:{},this.mimeType,o.MetricType.StalledSeconds).value;return c>this.Ugb?(this.Ugb=c,this.switchDown(p.SwitchingAggressiveness.MidHigh)):(a=this.Xgb(t,a,l,s.value),this.lastRateMeasurement=l,this.lastDownloadCancelled&&void 0!==a.arrayIndex&&void 0!==(null===(e=this.lastRepresentation)||void 0===e?void 0:e.arrayIndex)&&a.arrayIndex>=this.lastRepresentation.arrayIndex&&(a=this.getOneRepresentationLower(),this.lastDownloadCancelled=!1),a)},e.prototype.selectRepresentationID=function(t,e){return this.updateAvailableRepresentations(e),this.lastRepresentation=this.Zgb(t),this.lastRepresentation._internalId},e.prototype.setAdaptationSet=function(e){var i;t.prototype.setAdaptationSet.call(this,e),null!==(i=this.lastRepresentation)&&void 0!==i||(this.lastRepresentation={_id:null,_bandwidth:0,arrayIndex:-1})},e.prototype.getCurrentBitrateMeasurement=function(){return this.getCurrentBitrate(this.Tgb.rateMeasurement.getStatus())},e.prototype.getAvailableRepresentations=function(){return this.availableRepresentations},e.prototype.setStartupPhase=function(){this.startupPhase=!0,(0,a.clearTimeoutIfDefined)(this.startupPhaseTimerID),this.startupPhaseTimerID=void 0,Object.values(this.Tgb).forEach(function(t){return t.setStartupPhase()})},e.prototype.shutdown=function(){(0,a.clearTimeoutIfDefined)(this.startupPhaseTimerID),this.startupPhaseTimerID=void 0,this.lastDownloadCancelled=!1,Object.values(this.Tgb).forEach(function(t){return t.shutdown()})},e.prototype.dispose=function(){this.shutdown(),Object.values(this.Tgb).forEach(function(t){return t.dispose()}),this.Tgb={},this.lastRepresentation=void 0,this.availableRepresentations=[]},e}(s.BaseAdaptationLogic);e.BufferFillRateLogic=d},39201:function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.BufferLogic=void 0;var n=i(85434),r=i(96533),o=i(7676),a=function(){function t(t,e,i,r){this.context=t,this.mimeType=e,this.minSelectableBitrate=i,this.maxSelectableBitrate=r,this.ohb=[],this.agb=n.MimeTypeHelper.getMediaType(this.mimeType),this.dgb={timestamp:Date.now(),bufferLevel:0,bufferTargetLevel:0}}return t.prototype.phb=function(t){t&&(this.ohb=t)},t.prototype.qhb=function(){return(0,r.findLowestPossibleBandwidthFromRepresentations)(this.ohb,this.minSelectableBitrate)},t.prototype.rhb=function(){var t;return null===(t=this.findRepresentationForBitrate(this.maxSelectableBitrate))||void 0===t?void 0:t._bandwidth},t.prototype.shb=function(){return this.context.bufferSettings.getForwardTargetLevel(this.agb)},t.prototype.thb=function(){var t=this.qhb(),e=this.rhb();return this.cgb=this.shb(),function(t,e,i){var n=[];0===e&&(e=t);var r=2*Math.floor(.1*i),o=8*Math.floor(.1*i);o<=r&&(o=Math.floor(.9*i)),r<=1&&(r=1);for(var a=(e-t)/(o-r),s=t-a*r,u=0;u<r;u++)n[u]=t;for(u=r;u<o;u++)n[u]=Math.floor(a*u+s);for(u=o;u<=i;u++)n[u]=e;return n}(t,e||t,this.cgb)},t.prototype.uhb=function(){var t=this.shb();this.cgb!==t&&(this.bgb=this.thb())},t.prototype.findRepresentationForBitrate=function(t,e){return this.phb(e),(0,r.getMatchingRepresentationByBandwidth)(this.ohb,t)},t.prototype.vhb=function(){var t,e=this.shb(),i=this.dgb.bufferLevel;return(i=Math.floor(i))>e&&(i=e),t=this.bgb.hasOwnProperty(i)?this.bgb[i]:this.bgb[0],this.findRepresentationForBitrate(t)},t.prototype.selectRepresentationID=function(t,e){this.phb(e);var i=this.vhb();return this.uhb(),i._internalId},t.prototype.setAdaptationSet=function(t){this.phb(t.Representation),this.bgb=this.thb()},t.prototype.shouldDownloadBeCancelled=function(){return!1},t.prototype.setStartupPhase=function(){},t.prototype.shutdown=function(){},t.prototype.addSample=function(t){this.dgb=t},t.prototype.dispose=function(){this.bgb=[]},t.prototype.getCurrentBitrateMeasurement=function(){return 0},t.prototype.getLowestRepresentation=function(){return(0,o.getLowestRepresentation)(this.ohb)},t}();e.BufferLogic=a},11958:function(t,e,i){var n=this&&this.__extends||function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();Object.defineProperty(e,"__esModule",{value:!0}),e.CancellableAdaptationLogic=void 0;var r=i(80813),o=i(4131),a=i(21281),s=i(46151),u=i(33436),l=i(81199),h=i(81723),p=i(39185),d=i(45199),c=i(17006),f=i(70238),v=i(7676),g=function(t){function e(e,i){var n=t.call(this,e,i)||this;return n.shouldDownloadBeCancelled=function(t,e){var i,r,a=null!==(i=t.elapsedTime)&&void 0!==i?i:-1,s=null===(r=n.vib)||void 0===r?void 0:r.isPaused(),u=n.isStartupBitrateInEffect(),l=function(t){var e,i=null!==(e=t.elapsedTime)&&void 0!==e?e:-1;return i<0?0:i-y(t)}(t),h=n.wib(e),p=(0,o.hasLoadedData)(t),d=p?l>n.context.settings.MIN_EFFECTIVE_SEGMENT_DOWNLOAD_TIME:a>n.context.settings.MIN_EFFECTIVE_SEGMENT_DOWNLOAD_TIME;return!(s||u||h||!d)&&n.Tjb(t,l,p,a)},n.timeToFirstByteMeasurementRule=new d.TimeToFirstByteMeasurementRule(n.context,n.monitoringMimeType),n.rateMeasurementRule=new p.SegmentBasedRateMeasurementRule(n.context,n.monitoringMimeType),n}return n(e,t),Object.defineProperty(e.prototype,"uib",{get:function(){return this.context.serviceManager.get(r.ServiceName.ManifestService,this.context.sourceContext.sourceIdentifier)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"vib",{get:function(){return this.context.serviceManager.get(r.ServiceName.PlayerStateService)},enumerable:!1,configurable:!0}),e.prototype.setAdaptationSet=function(e){t.prototype.setAdaptationSet.call(this,e),this.previousRequestProgress=void 0},e.prototype.isStartupBitrateInEffect=function(){var t,e=this.context.store.getState(),i=e?(0,s.getMetricsHistoryFromInstanceState)(e,this.mimeType,u.MetricType.DownloadInformation):[],n=Boolean(null===(t=this.context.config.adaptation)||void 0===t?void 0:t.startupBitrate),r=i.filter(function(t){return Boolean(t.value)}).length>0;return n&&!r},e.prototype.wib=function(t){return!!t&&this.getLowestRepresentation()._internalId.equals(t)},e.prototype.xib=function(){return(0,l.getPlayableBufferLevel)(this.context.internalPlayer)},e.prototype.estimateTimeToFirstByte=function(t){var e;switch(void 0===t&&(t=0),e=0!==t?this.timeToFirstByteMeasurementRule.estimateStatus(t,5,.2).value:this.timeToFirstByteMeasurementRule.getStatus(5,.2).value,function(t){var e,i;return null!==(i=null===(e=t.adaptation)||void 0===e?void 0:e.rttEstimationMethod)&&void 0!==i?i:a.RttEstimationMethod.WeightedAverage}(this.context.config)){case a.RttEstimationMethod.Median:return e.median;case a.RttEstimationMethod.WeightedAverage:default:return e.standardDeviation>e.mean?e.mean+e.standardDeviation:e.weightedAverage}},e.prototype.Ijb=function(t,e,i,n,r,o){var a,l,h,p,d,f,v,g=n*e/i+r,y=null!==(l=null===(a=this.uib)||void 0===a?void 0:a.isManifestFetchRequired(t))&&void 0!==l&&l,m=!this.Kjb(t),R=null!==(h=null==o?void 0:o.hlsDependentSegments)&&void 0!==h&&h,S=null!==(d=null===(p=this.uib)||void 0===p?void 0:p.getRepresentationById(t))&&void 0!==d?d:null,_=Boolean(this.lastRepresentation)&&null!==(null===(f=this.lastRepresentation)||void 0===f?void 0:f._id)&&(null===(v=this.lastRepresentation)||void 0===v?void 0:v.arrayIndex)!==(null==S?void 0:S.arrayIndex),T=this.context.store.getState(),w=g;if(w+=function(t,e,i){var n=t?(0,s.getMetricsState)(t):{};return b((0,s.getMetricsHistory)(n,e,u.MetricType.DecryptionTime),i)+b((0,s.getMetricsHistory)(n,e,u.MetricType.TransmuxingTime),i)}(T,this.mimeType,t),R&&_&&(w*=2),m&&(w+=r),y){var M=function(t){var e=t?(0,s.getMetricsState)(t):{};return function(t){var e=(0,s.getMetricsHistory)(t,"default",u.MetricType.DownloadInformation).slice(-3).map(function(t){return t.value.time});return(0,c.calculateExponentialWeightedAverage)(e,.8)}(e)+function(t){var e=(0,s.getMetricsHistory)(t,"default",u.MetricType.ProcessingTime).slice(-3).map(function(t){return t.value});return(0,c.calculateExponentialWeightedAverage)(e,.8)}(e)}(T);w+=Math.max(M,r)}return w},e.prototype.Jjb=function(t,e,i,n){var r=1-this.context.settings.DOWNLOAD_DURATION_SAFETY_MARGIN,o=(n?this.context.settings.MAXIMUM_DOWNLOAD_DURATION_MULTIPLIER_SAME_QUALITY:this.context.settings.MAXIMUM_DOWNLOAD_DURATION_MULTIPLIER)-r,a=r+Math.min(e,i)*o/i;return Math.min(t*a,i)},e.prototype.isDownloadFeasible=function(t,e,i,n,r,o,a){var s,u=t.arrayIndex===(null===(s=this.lastRepresentation)||void 0===s?void 0:s.arrayIndex),l=this.Jjb(i,o,a,u);return this.Ijb(t._internalId,i,e,t._bandwidth,r,{hlsDependentSegments:n})<=l},e.prototype.Kjb=function(t){var e,i,n=this.context.store.getState(),r=n?(0,s.getMetricsHistoryFromInstanceState)(n,this.mimeType,u.MetricType.CachedInitSegments):[];return 0===r.length?null!==(i=null===(e=this.uib)||void 0===e?void 0:e.hasSelfInitialisingSegments())&&void 0!==i&&i:r.some(function(e){var i=e.hasOwnProperty("value")&&e.value.hasOwnProperty("internalRepId")?e.value.internalRepId:null;return null!==i&&i.equals(t)})},e.prototype.Ljb=function(t,e,i){var n=this;void 0===i&&(i=this.estimateTimeToFirstByte());var r=this.availableRepresentations.filter(function(t){var e;return n.lastRepresentation&&!t._internalId.equals(null===(e=n.lastRepresentation)||void 0===e?void 0:e._internalId)});return Math.min.apply(Math,r.map(function(r){var o;return n.Ijb(r._internalId,null!==(o=n.lastSegmentInfo?n.lastSegmentInfo.segmentDuration:e)&&void 0!==o?o:0,t,r._bandwidth,i,n.lastSegmentInfo)}))},e.prototype.Mjb=function(t){var e,i,n,r,o,a,s=null!==(e=t.elapsedTime)&&void 0!==e?e:0,u=(null===(i=this.previousRequestProgress)||void 0===i?void 0:i.url)===t.url?(t.loadedBytes-(null!==(r=null===(n=this.previousRequestProgress)||void 0===n?void 0:n.loadedBytes)&&void 0!==r?r:0))/(s-(null!==(a=null===(o=this.previousRequestProgress)||void 0===o?void 0:o.elapsedTime)&&void 0!==a?a:0)):-1;return this.previousRequestProgress=t,u},e.prototype.Njb=function(t,e){var i,n=e?y(t):null!==(i=t.elapsedTime)&&void 0!==i?i:0;return this.estimateTimeToFirstByte(n)},e.prototype.Ojb=function(t){return void 0===t&&(t=4),this.lastRepresentation?this.lastRepresentation._bandwidth/8*t*1.2:0},e.prototype.Pjb=function(t,e){var i=(0,o.hasLoadedData)(t),n=i?this.Mjb(t):0,r=i&&(0,v.hasTotalBytes)(t)?t.totalBytes-t.loadedBytes:this.Ojb(t.segmentDuration);return Math.min(r/(e/8),n>0?r/n:1/0)},e.prototype.Qjb=function(t,e,i){if((0,o.hasLoadedData)(t))return t.loadedBytes/e*8;var n=this.context.bufferSettings.getForwardTargetLevel(),r=this.rateMeasurementRule.getStatus(f.SwitchingAggressiveness.Mid,i/n);return this.getCurrentBitrate(r)},e.prototype.Rjb=function(t,e,i,n,r){var o=this.Pjb(n,i);return o>e&&o>r&&e<=r+t},e.prototype.Sjb=function(t,e,i,n){var r,o;if(null!==(o=null===(r=this.vib)||void 0===r?void 0:r.isPlay())&&void 0!==o&&o)return!1;var a=function(t){return t.getStatus(5,.2).value.mean}(this.timeToFirstByteMeasurementRule);return n>Math.max(t,3*a)&&e<=i+t},e.prototype.Tjb=function(t,e,i,n){var r,o,a,s=this.xib(),u=this.Qjb(t,e,s),l=this.Njb(t,i),h=null!==(a=null!==(r=t.segmentDuration)&&void 0!==r?r:null===(o=this.lastSegmentInfo)||void 0===o?void 0:o.segmentDuration)&&void 0!==a?a:0,p=this.Ljb(u,h,l);return!!(i?this.Rjb(h,s,u,t,p):this.Sjb(h,s,p,n))&&((0,v.hasTotalBytes)(t)&&(t.loadedBytes/t.totalBytes*100).toFixed(1),this.lastDownloadCancelled=!0,this.lastRateMeasurement=u,!0)},e}(h.BaseAdaptationLogic);function y(t){var e,i,n,r,o=null!==(i=null===(e=t.responseTiming)||void 0===e?void 0:e.openedTimestamp)&&void 0!==i?i:-1,a=null!==(r=null===(n=t.responseTiming)||void 0===n?void 0:n.headersReceivedTimestamp)&&void 0!==r?r:-1;return o<0||a<0?0:a-o}function b(t,e){var i=t.filter(function(t){return t.value.representationId.equals(e)}).slice(-3).map(function(t){return t.value.time});return(0,c.calculateExponentialWeightedAverage)(i,.8)}e.CancellableAdaptationLogic=g},85696:function(t,e,i){var n=this&&this.__extends||function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();Object.defineProperty(e,"__esModule",{value:!0}),e.DownloadPredictionLogic=void 0,i(13531);var r=i(70962),o=i(46151),a=i(88844),s=i(11958),u=i(64463),l=i(43829),h=i(70238),p=i(7676),d=function(t){function e(e,i){var n=t.call(this,e,i)||this;return n.whb=new l.DownloadRateRule(n.context,n.monitoringMimeType),n.xhb=(0,u.BufferFillStateRule)(n.context,n.monitoringMimeType),n}return n(e,t),e.prototype.getRepresentationForRateMeasurement=function(t){void 0===t&&(t=h.SwitchingAggressiveness.Mid);var e=this.context.bufferSettings.getForwardTargetLevel(),i=this.xhb.getStatus().value,n=this.rateMeasurementRule.getStatus(t,i/e),r=this.getCurrentBitrate(n),o=(0,p.adjustRateToSafetyMargin)(r,this.context.settings.RATE_SAFETY_MARGIN_PERCENTAGE);return this.findRepresentationForBitrate(o)},e.prototype.getCurrentBitrateMeasurement=function(){var t=this.getCurrentBitrate(this.rateMeasurementRule.getStatus());return(0,p.adjustRateToSafetyMargin)(t,this.context.settings.RATE_SAFETY_MARGIN_PERCENTAGE)},e.prototype.addSample=function(t){this.whb.addSample(t),this.xhb.addSample(t),this.rateMeasurementRule.addSample(),this.timeToFirstByteMeasurementRule.addSample()},e.prototype.yhb=function(t,e,i,n,r){var o=this;if(!t.segmentDuration||this.isStartupBitrateInEffect())return e;this.lastSegmentInfo=t;var a=this.availableRepresentations.filter(function(t){return t._bandwidth<=e._bandwidth});if(0===a.length)return this.availableRepresentations[0];var s=r.value||0,u=this.context.bufferSettings.getForwardTargetLevel(),l=(0,p.adjustRateToSafetyMargin)(i,this.context.settings.RATE_SAFETY_MARGIN_PERCENTAGE),h=a.filter(function(e){var i;return o.isDownloadFeasible(e,l,null!==(i=t.segmentDuration)&&void 0!==i?i:0,!1,n,s,u)});return 0===h.length?a[0]:h[h.length-1]},e.prototype.zhb=function(t,e,i,n){var a,s;this.checkStartupPhase(e);var u=this.context.store.getState(),l=null!==(s=null===(a=(u?(0,o.getMetricsState)(u):{}).default)||void 0===a?void 0:a.bufferLogicActivationThreshold)&&void 0!==s?s:r.DefaultSettings.BUFFER_LOGIC_ACTIVATION_THRESHOLD,h=this.context.bufferSettings.getForwardTargetLevel()>l,p=this.getRepresentationForNormalChange(i,e,h);if(n){var d=this.estimateTimeToFirstByte();p=this.yhb(n,p,t,d,e)}return p},e.prototype.selectRepresentationID=function(t,e){var i,n,r;this.updateAvailableRepresentations(e);var o=this.rateMeasurementRule.getStatus(),a=this.getCurrentBitrate(o),s=this.xhb.getStatus(),u=this.whb.getStatus(),l=this.zhb(a,s,u,t);return this.lastRepresentation&&(null===(n=null===(i=this.lastRepresentation)||void 0===i?void 0:i._internalId)||void 0===n||n.equals(null==l?void 0:l._internalId)),this.lastRepresentation=l,this.lastRateMeasurement=a,this.lastDownloadCancelled=!1,this.previousRequestProgress=void 0,null===(r=this.lastRepresentation)||void 0===r?void 0:r._internalId},e.prototype.setStartupPhase=function(){var t,e,i,n;this.startupPhase=!0,(0,a.clearTimeoutIfDefined)(this.startupPhaseTimerID),this.startupPhaseTimerID=void 0,null===(t=this.whb)||void 0===t||t.setStartupPhase(),null===(e=this.xhb)||void 0===e||e.setStartupPhase(),null===(i=this.rateMeasurementRule)||void 0===i||i.setStartupPhase(),null===(n=this.timeToFirstByteMeasurementRule)||void 0===n||n.setStartupPhase()},e.prototype.shutdown=function(){var t,e,i,n;(0,a.clearTimeoutIfDefined)(this.startupPhaseTimerID),this.startupPhaseTimerID=void 0,this.lastDownloadCancelled=!1,this.previousRequestProgress=void 0,null===(t=this.whb)||void 0===t||t.shutdown(),null===(e=this.xhb)||void 0===e||e.shutdown(),null===(i=this.rateMeasurementRule)||void 0===i||i.shutdown(),null===(n=this.timeToFirstByteMeasurementRule)||void 0===n||n.shutdown()},e.prototype.dispose=function(){var t,e,i,n;this.shutdown(),null===(t=this.whb)||void 0===t||t.dispose(),null===(e=this.xhb)||void 0===e||e.dispose(),null===(i=this.rateMeasurementRule)||void 0===i||i.dispose(),null===(n=this.timeToFirstByteMeasurementRule)||void 0===n||n.dispose(),this.lastRepresentation=void 0,this.availableRepresentations=[]},e}(s.CancellableAdaptationLogic);e.DownloadPredictionLogic=d},76344:function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.AdaptationModuleDefinition=void 0;var n=i(62756),r=i(98154),o=i(7676);e.AdaptationModuleDefinition={name:n.ModuleName.ABR,module:function(){return{AdaptationService:i(49541).X,AdaptToPlayerResolution:i(19119).AdaptToPlayerResolution,AdaptationUtils:o,AdaptationApiFactory:r.AdaptationApiFactory}},dependencies:[n.ModuleName.EngineBitmovin]},e.default=e.AdaptationModuleDefinition},19119:function(t,e){function i(t){return t&&t.clientWidth&&t.clientHeight?{width:t.clientWidth*devicePixelRatio,height:t.clientHeight*devicePixelRatio}:null}Object.defineProperty(e,"__esModule",{value:!0}),e.AdaptToPlayerResolution=function(t,e,n){var r,o=function(t,e){var n=e.getVideoElement();if(!n)return null;var r=n.parentElement,o=r&&r.querySelector("#bitmovinplayer-vr-canvas");return t?{width:screen.width*devicePixelRatio,height:screen.height*devicePixelRatio}:i(n)||o&&i(o)||r&&i(r)}(n,t);if(!o)return e;var a=null!==(r=t.getAvailableVideoQualities())&&void 0!==r?r:[],s=a.find(function(t){return t.id===e});if(!s)return e;var u=function(t,e,i){return t.filter(function(t){var n=t.bitrate<=e,r=function(t,e){var i=e.width/e.height;return t.width/t.height<i?e.width>=t.width:e.height>=t.height}(i,t);return n&&r})}(a,s.bitrate,o);return 0===u.length?e:u[function(t){var e=t.findIndex(function(e){return e.width>t[0].width&&e.height>t[0].height})-1;return Math.max(0,e)}(u)].id}},43008:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.hasBitrate=function(t){return null!=t.bitrate},e.hasBitrateBounds=function(t){return null!=t.minBitrate&&null!=t.maxBitrate},e.hasResolution=function(t){return null!=t.height&&null!=t.width}},59113:function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.findQualityForBitrate=function(t,e){if(e&&0!==e.length)return e.reduce(function(e,i){var n=r(i),o={entry:i,bitrate:n};return e.bitrate>t||n>t?n>e.bitrate?e:o:n>e.bitrate?o:e},{entry:e[0],bitrate:r(e[0])}).entry};var n=i(43008);function r(t){return(0,n.hasBitrate)(t)&&t.bitrate>0?t.bitrate:(0,n.hasBitrateBounds)(t)?(t.maxBitrate+t.minBitrate)/2:0}},17006:function(t,e){function i(t){return t.length>0?t.reduce(function(t,e){return t+e},0)/t.length:0}Object.defineProperty(e,"__esModule",{value:!0}),e.calculateExponentialWeightedAverage=void 0,e.calculateMean=i,e.calculateStandardDeviation=function(t,e){if(void 0===e&&(e=i(t)),t.length<2)return 0;var n=t.reduce(function(t,i){return t+Math.pow(i-e,2)},0),r=1/(t.length-1)*n;return Math.sqrt(r)},e.calculateMedian=function(t){var e=t.slice(0).sort(function(t,e){return t-e});return 0===e.length?0:e.length%2==1?e[Math.floor(e.length/2)]:.5*(e[e.length/2-1]+e[e.length/2])},e.calculateExponentialWeightedAverage=function(t,i,n){return void 0===n&&(n=t.length-1),0===t.length||n<0?0:0===n||0===i?t[n]:i*t[n]+(1-i)*(0,e.calculateExponentialWeightedAverage)(t,i,n-1)}},70238:function(t,e){var i;Object.defineProperty(e,"__esModule",{value:!0}),e.SwitchingAggressiveness=void 0,function(t){t[t.Conservative=10]="Conservative",t[t.VeryLow=8]="VeryLow",t[t.Low=7]="Low",t[t.LowMid=6]="LowMid",t[t.Mid=5]="Mid",t[t.MidHigh=4]="MidHigh",t[t.High=3]="High",t[t.VeryHigh=2]="VeryHigh",t[t.Extreme=1]="Extreme"}(i||(e.SwitchingAggressiveness=i={}))},7676:function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.toMbps=e.toKbps=e.findMaximum=e.findMinimum=void 0,e.getMaxStartupBitrateFromConfig=function(t){var e,i=null===(e=t.config)||void 0===e?void 0:e.adaptation;if(!i)return 0;var r=function(t){return t.maxStartupBitrate?n.Util.extractBitrateFromString("max",t.maxStartupBitrate):1/0}(i);return!isNaN(r)&&isFinite(r)?r:0},e.getStartupBitrateFromConfig=function(t){var e,i=null===(e=t.config)||void 0===e?void 0:e.adaptation,r=t.settings;if(!i||!r)return 0;var o=i.startupBitrate||0;if(!o)return 0;var a=function(t,e){var i=n.Util.extractBitrateFromString("min",t);return i*=1+e/100,i+=8}(o,r.RATE_SAFETY_MARGIN_PERCENTAGE);return!isNaN(a)&&isFinite(a)?a:0},e.findExtremum=r,e.hasTotalBytes=function(t){return void 0!==t.totalBytes},e.adjustRateToSafetyMargin=function(t,e){return t*(1-e/100)},e.getLowestRepresentation=function(t){return(0,e.findMinimum)(t,function(t){return t._bandwidth})};var n=i(70850);function r(t,e){return t[t.reduce(function(i,n,r){return e(t[i],t[r])?i:r},0)]}var o=function(t){return t};e.findMinimum=function(t,e){return void 0===e&&(e=o),r(t,function(t,i){return e(t)<e(i)})},e.findMaximum=function(t,e){return void 0===e&&(e=o),r(t,function(t,i){return e(t)>e(i)})},e.toKbps=function(t){return t/Math.pow(2,10)},e.toMbps=function(t){return t/Math.pow(2,20)}},7290:function(t,e,i){var n=this&&this.__extends||function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();Object.defineProperty(e,"__esModule",{value:!0}),e.WishLogic=void 0;var r=i(44468),o=i(70962),a=i(46151),s=i(33436),u=i(85434),l=i(88844),h=i(11958),p=i(59113),d=i(59406),c=i(70238),f=i(7676),v=i(47577),g=1e-4,y=1e-4,b=function(t){function e(e,i){var n=t.call(this,e,i)||this;return n.context=e,n.mimeType=i,n.Bhb=[],n.Chb=[],n.Dhb=0,n.Ihb(),n.Ahb=e.settings.WISH_ABR_PARAMS,n}return n(e,t),Object.defineProperty(e.prototype,"Ehb",{get:function(){var t,e=u.MimeTypeHelper.isVideo(this.mimeType)?r.MediaType.Video:r.MediaType.Audio,i=null!==(t=this.context.internalPlayer.bufferApi.getLevel(r.BufferType.ForwardDuration,e).level)&&void 0!==t?t:0;return i>this.context.bufferSettings.getTargetLevel(r.BufferType.ForwardDuration,e)+this.Dhb?0:i},enumerable:!1,configurable:!0}),e.prototype.Ihb=function(){var t=this.context.settings.WISH_ABR_PARAMS.BITRATE_MODIFIER_FUNCTION_TYPE,e=this.context.settings.WISH_ABR_PARAMS.TARGET_BUFFER_FACTOR,i=this.context.settings.WISH_ABR_PARAMS.TARGET_BITRATE_FACTOR;if(!["log","linear"].includes(t)){var n=o.WishDefaultConfig.BITRATE_MODIFIER_FUNCTION_TYPE;this.context.settings.WISH_ABR_PARAMS.BITRATE_MODIFIER_FUNCTION_TYPE=n}if(e>1||e<g){var r=Math.min(Math.max(e,g),1);this.context.settings.WISH_ABR_PARAMS.TARGET_BUFFER_FACTOR=r}if(i<y){var a=Math.max(i,y);this.context.settings.WISH_ABR_PARAMS.TARGET_BITRATE_FACTOR=a}},e.prototype.getRepresentationForRateMeasurement=function(t){void 0===t&&(t=c.SwitchingAggressiveness.Mid);var e=this.context.bufferSettings.getForwardTargetLevel(),i=this.rateMeasurementRule.getStatus(t,this.Ehb/e),n=this.getCurrentBitrate(i),r=(0,f.adjustRateToSafetyMargin)(n,this.context.settings.RATE_SAFETY_MARGIN_PERCENTAGE);return this.findRepresentationForBitrate(r)},e.prototype.Jhb=function(){var t=this.context.store.getState();return(t?(0,a.getMetricsHistoryFromInstanceState)(t,this.mimeType,s.MetricType.DownloadInformation):[]).filter(function(t){return Boolean(t.value)}).length>2},e.prototype.addSample=function(t){(function(t){return null!=t.segmentDuration})(t)&&(this.rateMeasurementRule.addSample(),this.timeToFirstByteMeasurementRule.addSample(),t.segmentDuration!==this.Dhb&&(this.Dhb=t.segmentDuration,this.Khb()))},e.prototype.selectRepresentationID=function(t,e){var i;this.updateAvailableRepresentations(e),this.checkStartupPhase({value:this.Ehb,result:d.Rules.SHOULD_STAY});var n=this.Mhb(),r=null===(i=n.rep)||void 0===i?void 0:i._internalId,o=n.index;return this.Chb.push(this.Bhb[o]),this.Chb.length>20&&(this.Chb=this.Chb.slice(-10)),this.lastSegmentInfo=t,this.lastRepresentation=n.rep,this.lastRateMeasurement=this.getCurrentBitrate(this.rateMeasurementRule.getStatus()),this.lastDownloadCancelled=!1,this.previousRequestProgress=void 0,r},e.prototype.getCurrentBitrateMeasurement=function(){return this.rateMeasurementRule.getStatus().value},e.prototype.setAdaptationSet=function(e){t.prototype.setAdaptationSet.call(this,e);var i=this.getAvailableRepresentations().map(function(t){return(0,f.toKbps)(t._bandwidth)});this.Bhb=(0,v.applyQualityFunction)(i,this.Ahb.BITRATE_MODIFIER_FUNCTION_TYPE),this.Khb()},e.prototype.findRepresentationForBitrate=function(t,e){var i,n=(0,p.findQualityForBitrate)(t,this.getAvailableRepresentations().map(function(t){return{rep:t,bitrate:t._bandwidth}}));return null!==(i=null==n?void 0:n.rep)&&void 0!==i?i:this.getLowestRepresentation()},e.prototype.setStartupPhase=function(){this.startupPhase=!0,(0,l.clearTimeoutIfDefined)(this.startupPhaseTimerID),this.startupPhaseTimerID=void 0},e.prototype.shutdown=function(){var t,e;this.lastRateMeasurement=0,this.lastDownloadCancelled=!1,this.previousRequestProgress=void 0,null===(t=this.rateMeasurementRule)||void 0===t||t.shutdown(),null===(e=this.timeToFirstByteMeasurementRule)||void 0===e||e.shutdown()},e.prototype.dispose=function(){var t,e;this.shutdown(),null===(t=this.rateMeasurementRule)||void 0===t||t.dispose(),null===(e=this.timeToFirstByteMeasurementRule)||void 0===e||e.dispose(),this.lastRepresentation=void 0,this.availableRepresentations=[],this.Bhb=[],this.Dhb=0,this.Chb=[]},e.prototype.Khb=function(){if((0,v.canUseWishAlgorithm)(this.Bhb,this.Dhb)){var t=this.getAvailableRepresentations().map(function(t){return(0,f.toKbps)(t._bandwidth)}),e=u.MimeTypeHelper.isVideo(this.mimeType)?r.MediaType.Video:r.MediaType.Audio,i=this.context.bufferSettings.getTargetLevel(r.BufferType.ForwardDuration,e);this.Fhb=(0,v.computeAlpha)(this.Ahb,t,this.Bhb,this.Dhb,i),this.Ghb=(0,v.computeBeta)(this.Ahb,this.Fhb,i,this.Dhb),this.Hhb=(0,v.computeGamma)(this.Fhb,this.Ghb)}},e.prototype.Lhb=function(t,e,i,n){var r=(0,v.determineBandwidthCost)(t._bandwidth,n),o=(0,v.determineBufferCost)(r,this.Dhb,this.Ehb),a=(0,v.determineQualityCost)(this.Bhb,e,i);return this.Fhb*r+this.Ghb*o+this.Hhb*a},e.prototype.isStartupBitrateInEffect=function(){var t,e,i=Boolean(null===(t=this.context.config.adaptation)||void 0===t?void 0:t.startupBitrate),n=Boolean(null===(e=this.context.config.adaptation)||void 0===e?void 0:e.maxStartupBitrate);return(i||n)&&!this.Jhb()},e.prototype.Mhb=function(){var t=this;if(this.startupPhase&&(this.isStartupBitrateInEffect()||this.Ahb.USE_RATE_BASED_SELECTION_ON_SEEKING)){var e=this.getRepresentationForRateMeasurement(),i=this.getAvailableRepresentations().indexOf(e);return{rep:e,index:-1!==i?i:0}}if(this.Ehb<this.Dhb||!(0,v.canUseWishAlgorithm)(this.Bhb,this.Dhb))return{rep:this.getAvailableRepresentations()[0],index:0};var n=(0,v.getAverageSelectedQuality)(this.Chb,10),r=this.rateMeasurementRule.getStatus(5,.325).value,o=this.getCurrentBitrate(this.rateMeasurementRule.getStatus()),a=Math.min(r,o),s=this.getAvailableRepresentations()[0]._bandwidth,u=Math.max(1.1*r,s),l=this.getAvailableRepresentations().filter(function(t){return t._bandwidth<=u}).map(function(e,i){return{rep:e,index:i,cost:t.Lhb(e,i,n,a)}}).sort(function(t,e){return t.cost-e.cost});return{rep:l[0].rep,index:l[0].index}},e}(h.CancellableAdaptationLogic);e.WishLogic=b},47577:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.applyQualityFunction=function(t,e){switch(e){case"linear":var i=t[t.length-1];return t.map(function(t){return function(t,e){return t/e}(t,i)});case"log":var n=t[0];return t.map(function(t){return function(t,e){return Math.log(t/e)}(t,n)})}},e.computeAlpha=function(t,e,i,n,r){switch(t.BITRATE_MODIFIER_FUNCTION_TYPE){case"linear":return function(t,e,i,n){var r=t.TARGET_BITRATE_FACTOR,o=t.TARGET_BUFFER_FACTOR,a=i,s=e[0],u=e[e.length-2];return 1/(1+(o*n-a)/i+Math.exp(3-2*s-u)/r)}(t,i,n,r);case"log":return function(t,e,i,n){var r=t.TARGET_BITRATE_FACTOR,o=t.TARGET_BUFFER_FACTOR,a=i,s=e[0],u=e[e.length-1];return 1/(1+(o*n-a)/i+2*u*u/(r*s*e[e.length-2]))}(t,e,n,r)}},e.computeBeta=function(t,e,i,n){return e*((t.TARGET_BUFFER_FACTOR*i-n)/n)},e.computeGamma=function(t,e){return 1-t-e},e.determineBandwidthCost=function(t,e){return e?t/e:1},e.determineBufferCost=function(t,e,i){return i<=e?1/0:t*(e/(i-e))},e.determineQualityCost=function(t,e,i){var n=t[t.length-1],r=t[0],o=t[e];return Math.exp(n+i-2*o)/Math.exp(2*n-2*r)},e.getAverageSelectedQuality=function(t,e){if(0===t.length)return 0;var i=t.slice(-e);return i.reduce(function(t,e){return t+e})/i.length},e.canUseWishAlgorithm=function(t,e){return!(t.length<=1||!e)}},82873:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.BandwidthValueType=void 0,e.getBandwidth=function(t){if(0!==t.length){for(var e=t.length,r=e-1;r>=0;r--){var o=t[r].value,a=o.downloadRate,s=o.segmentBitrate;if(void 0===s||a<s*n)return{rateBps:a,type:i.Accurate}}return{rateBps:t[e-1].value.downloadRate,type:i.Estimated}}};var i,n=.9;!function(t){t.Accurate="accurate",t.Estimated="estimated"}(i||(e.BandwidthValueType=i={}))},24296:function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.LowLatencyAbr=void 0;var n=i(80813),r=i(46151),o=i(33436),a=i(59113),s=i(28922),u=i(7676),l=i(82873),h=i(50265),p=i(52902),d=function(){function t(t,e){this.context=t,this.mimeType=e,this.ahb=new h.RateLimitedCancelCheck}return Object.defineProperty(t.prototype,"bhb",{get:function(){return this.context.serviceManager.get(n.ServiceName.ManifestService,this.context.sourceContext.sourceIdentifier)},enumerable:!1,configurable:!0}),t.prototype.chb=function(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];this.context.logger},t.prototype.dhb=function(){var t=(0,r.getMetricsHistoryFromInstanceState)(this.context.store.getState(),this.mimeType,o.MetricType.ChunkedDownloadInformation),e=this.ehb();return(0,l.getBandwidth)(t.slice(-e))},t.prototype.ehb=function(){var t,e=null===(t=this.context.config.adaptation)||void 0===t?void 0:t.qualityStabilityBalance,i=Math.ceil(20*e);return Math.max(1,i)},t.prototype.fhb=function(t){var e,i,n,r,o=null!==(n=null===(i=null===(e=this.bhb)||void 0===e?void 0:e.getAdaptationSet(t))||void 0===i?void 0:i.Representation)&&void 0!==n?n:[],a=(0,u.getLowestRepresentation)(o);return null!==(r=null==a?void 0:a._internalId.equals(t))&&void 0!==r&&r},t.prototype.getCurrentBitrateMeasurement=function(){var t,e;return null!==(e=null===(t=this.dhb())||void 0===t?void 0:t.rateBps)&&void 0!==e?e:0},t.prototype.getLowestRepresentation=function(){var t,e,i;if(this.Zhb){var n=null!==(i=null===(e=null===(t=this.bhb)||void 0===t?void 0:t.getAdaptationSet(this.Zhb._internalId))||void 0===e?void 0:e.Representation)&&void 0!==i?i:[];return(0,u.getLowestRepresentation)(n)}},t.prototype.selectRepresentationID=function(t,e){var i,n,a,h;if(e&&0!==e.length){var p,d=this.dhb();if(this.chb("current bandwidth",d),!d)return null===(i=(0,u.getLowestRepresentation)(e))||void 0===i?void 0:i._internalId;if(d.type===l.BandwidthValueType.Accurate&&(p=null!==(n=this.findRepresentationForBitrate(d.rateBps,e))&&void 0!==n?n:void 0,this.chb("accurate value, selecting ",null==p?void 0:p._bandwidth)),d.type===l.BandwidthValueType.Estimated){var c=null===(a=(0,r.getMetricsLastEntry)((0,r.getMetricsState)(this.context.store.getState()),this.mimeType,o.MetricType.ChunkedDownloadInformation).value)||void 0===a?void 0:a.representationBitrate;void 0!==c&&(p=(0,s.findNextHigherBitrateRepresentation)(e,c),this.chb("estimated value, currently on ".concat(c,", selecting ").concat(null==p?void 0:p._bandwidth)))}return p?p._internalId:null===(h=(0,u.getLowestRepresentation)(e))||void 0===h?void 0:h._internalId}},t.prototype.findRepresentationForBitrate=function(t,e){var i,n;if(!e||e.length<1)return null;var r=null===(i=(0,a.findQualityForBitrate)(t,e.map(function(t){return{rep:t,bitrate:t._bandwidth}})))||void 0===i?void 0:i.rep;return null!==(n=null!=r?r:(0,u.getLowestRepresentation)(e))&&void 0!==n?n:null},t.prototype.shouldDownloadBeCancelled=function(t,e){if(this.ahb.shouldExecuteCancelCheck(t)){if(this.fhb(e))return!1;var i=(0,p.shouldCancelDownload)(t);return i&&this.chb("Cancelling segment download, current download rate is significantly lower than segment bitrate"),i}return!1},t.prototype.addSample=function(t){},t.prototype.setAdaptationSet=function(t){this.Zhb=t},t.prototype.setStartupPhase=function(){},t.prototype.shutdown=function(){},t.prototype.dispose=function(){this.shutdown()},t}();e.LowLatencyAbr=d},50265:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.RateLimitedCancelCheck=void 0;var i=function(){function t(){this.pjb=0}return t.prototype.shouldExecuteCancelCheck=function(t){if(void 0===t.segmentDuration||void 0===t.elapsedTime)return!1;this.qjb(t)&&(this.pjb=0);var e=this.pjb+.2;if(t.elapsedTime>=t.segmentDuration*e){var i=t.elapsedTime/t.segmentDuration;return this.pjb=.2*Math.floor(i/.2),!0}return!1},t.prototype.qjb=function(t){return t.elapsedTime<this.pjb*t.segmentDuration},t}();e.RateLimitedCancelCheck=i},52902:function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.shouldCancelDownload=function(t){var e=t.responseTiming;if(!e)return!1;var i=e.progressTimestamp,o=e.headersReceivedTimestamp;if(!((0,n.isNumber)(o)&&o>-1&&(0,n.isNumber)(i)&&i>-1))return!1;var a=i-o,s=(0,r.bytesToBits)(t.loadedBytes)/a,u=1-(0,r.bytesToBits)(t.loadedBytes)/(t.representationBitrate*t.segmentDuration);return s<t.representationBitrate*u};var n=i(23068),r=i(33004)},4865:function(t,e,i){var n=this&&this.__extends||function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();Object.defineProperty(e,"__esModule",{value:!0}),e.BlockBasedRateMeasurementRule=void 0;var r=i(46151),o=i(33436),a=i(70850),s=i(59406),u=1e6,l=function(t){function e(e,i){var n,r,o,s,u=t.call(this,e,i)||this;return u.Vjb=e.settings,u.Ujb=i,u.ajb=!0,u.Yjb=16e5,null!=(null===(r=null===(n=e.config)||void 0===n?void 0:n.adaptation)||void 0===r?void 0:r.maxStartupBitrate)&&(u.Yjb=a.Util.extractBitrateFromString("max",e.config.adaptation.maxStartupBitrate)),null!=(null===(s=null===(o=e.config)||void 0===o?void 0:o.adaptation)||void 0===s?void 0:s.startupBitrate)&&(u.Wjb=a.Util.extractBitrateFromString("min",e.config.adaptation.startupBitrate)),u.Zjb={bytes:0,time:0},u.Xjb=[],u}return n(e,t),e.calcRateInBps=function(t,e){return 8*t/e},e.prototype.bjb=function(t){var i=this.Xjb.pop();if((null==i?void 0:i.bytes)===u&&(this.Xjb.push(i),i=void 0),i||(i={bytes:0,time:0,rateInBps:0}),i.bytes+t.bytes<=u){var n=i.bytes+t.bytes,r=i.time+t.time;this.Xjb.push({bytes:n,time:r,rateInBps:e.calcRateInBps(n,r)})}else{var o=(u-i.bytes)/t.bytes;i.bytes+=t.bytes*o,i.time+=t.time*o,i.rateInBps=e.calcRateInBps(i.bytes,i.time),this.Xjb.push(i);for(var a=t.bytes*(1-o),s=t.time*(1-o);a>u;){var l=s/(a/u);this.Xjb.push({bytes:u,time:l,rateInBps:e.calcRateInBps(u,l)}),a-=u,s-=l}this.Xjb.push({bytes:a,time:s,rateInBps:e.calcRateInBps(a,s)})}},e.prototype.cjb=function(t){if(t&&!isNaN(t.bytes)){var e=this.Zjb;if(e.bytes===t.bytes&&e.time===t.time)return;this.Zjb=t,this.bjb(t),this.Xjb.length>40&&this.Xjb.shift(),this.fjb()}},e.prototype.djb=function(t,i){var n,r=-t;null!=i&&(r=-t-i,n=-i);var o=this.Xjb.slice(r,n);if(0===o.length)return 0;var a=o.reduce(function(t,e){return{bytes:t.bytes+e.bytes,time:t.time+e.time,rateInBps:t.rateInBps+e.rateInBps}});return a.rateInBps=e.calcRateInBps(a.bytes,a.time),a.rateInBps},e.prototype.ejb=function(){if(null==this.Wjb)return null;var t=this.Wjb;return t*=1+this.Vjb.RATE_SAFETY_MARGIN_PERCENTAGE/100,t+=8,isNaN(t)?null:{bytes:h(t),time:1}},e.prototype.addSample=function(){if(this.instanceState){var t=(0,r.getMetricsState)(this.instanceState),e=(0,r.getMetricsLastEntry)(t,this.Ujb,o.MetricType.DownloadInformation);if(this.ajb){this.ajb=!1;var i=this.ejb();i&&(e={value:i})}if(!e||!e.value||!e.value.bytes){e=e||{};var n=this.gjb();n>0&&(e.value={bytes:h(n),time:1}),e&&e.value||(e=(0,r.getMetricsLastEntry)(t,"default",o.MetricType.DownloadInformation));var a=1/0;e&&e.value&&!isNaN(e.value.bytes)&&!isNaN(e.value.time)&&(a=e.value.bytes/e.value.time),a>this.Yjb&&(e.value=e.value||{},e.value.bytes=h(this.Yjb),e.value.time=1)}this.cjb(e.value)}},e.prototype.getStatus=function(t){0===this.Xjb.length&&this.addSample();var e=this.djb(t),i=this.djb(t,1);return{value:e,result:e>1.1*i?s.Rules.SHOULD_SWITCH_UP:e<.9*i?s.Rules.SHOULD_SWITCH_DOWN:s.Rules.SHOULD_STAY}},e.prototype.fjb=function(){if(this.instanceState){var t=(0,r.getMetricsHistoryFromInstanceState)(this.instanceState,this.Ujb,o.MetricType.DownloadInformation).slice(-3).map(function(t){return Math.round(8*t.value.bytes/t.value.time)});this.context.storedConfig.set("b",t),this.context.storedConfig.set("b_t",Date.now())}},e.prototype.gjb=function(){var t=this.context.storedConfig.get("b")||[];return Math.round(t.reduce(function(t,e){return t+e},0)/t.length)||-1},e.prototype.shutdown=function(){},e.prototype.setStartupPhase=function(){},e.prototype.dispose=function(){},e}(s.AdaptationRule);function h(t){return t/8}e.BlockBasedRateMeasurementRule=l},20066:function(t,e,i){var n=this&&this.__extends||function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();Object.defineProperty(e,"__esModule",{value:!0}),e.BufferFillRateRule=void 0;var r=i(89927),o=i(88844),a=i(59406),s=function(t){function e(e,i){var n=t.call(this,e,i)||this;return n.hjb=e.bufferSettings,n.ijb=!0,n.kjb=[],n}return n(e,t),e.prototype.ljb=function(){if(0===this.kjb.length)return NaN;var t=this.kjb[this.kjb.length-1],e=t.bufferTargetLevel;if(this.ijb){var i=t.bufferLevel,n=this.kjb[this.kjb.length-2],r=0;n&&(r=n.bufferLevel),i>=t.bufferTargetLevel||r>i?this.ijb=!1:e=i}return e},e.prototype.mjb=function(t){isNaN(t)&&(t=this.hjb.getForwardTargetLevel());for(var e,i=Date.now()-(0,r.toMilliSeconds)(t),n=0,o=0,a=0;a<this.kjb.length;a++)(e=this.kjb[a]).timestamp>=i&&(n+=e.bufferLevel-o),o=e.bufferLevel;return n/=this.ljb(),isNaN(n)?1:n},e.prototype.addSample=function(t){var e=this;this.jjb||(this.jjb=window.setTimeout(function(){e.ijb=!1},(0,r.toMilliSeconds)(this.hjb.getForwardTargetLevel()))),this.kjb.push(t),t.timestamp-this.kjb[0].timestamp>6e4&&this.kjb.shift()},e.prototype.getStatus=function(t){var e=this.mjb(t),i=a.Rules.SHOULD_STAY;return e>.7?i=a.Rules.SHOULD_SWITCH_UP:e<-.5&&(i=a.Rules.SHOULD_SWITCH_DOWN),{value:e,result:i}},e.prototype.setStartupPhase=function(){this.ijb=!0},e.prototype.shutdown=function(){(0,o.clearTimeoutIfDefined)(this.jjb),this.jjb=void 0},e.prototype.dispose=function(){this.shutdown(),this.kjb=[]},e}(a.AdaptationRule);e.BufferFillRateRule=s},64463:function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.BufferFillStateRule=function(t,e){var i,s,u=!0,l={timestamp:Date.now(),bufferTargetLevel:(null===(i=n.DefaultSettings.TARGET_BUFFER_LEVEL.video)||void 0===i?void 0:i.forwardduration)||0,bufferLevel:0},h=function(){(0,o.clearTimeoutIfDefined)(s),s=void 0};return{addSample:function(e){s||(s=window.setTimeout(function(){u=!1},(0,r.toMilliSeconds)(t.bufferSettings.getForwardTargetLevel()))),l=e},getStatus:function(){var t;return l.bufferLevel>.8*l.bufferTargetLevel?(t=a.Rules.SHOULD_SWITCH_UP,u&&(u=!1,(0,o.clearTimeoutIfDefined)(s))):t=l.bufferLevel<.4*l.bufferTargetLevel?a.Rules.SHOULD_SWITCH_DOWN:a.Rules.SHOULD_STAY,u&&(t=a.Rules.SHOULD_STAY),{value:l.bufferLevel,result:t}},setStartupPhase:function(){u=!0},shutdown:h,dispose:function(){h()}}};var n=i(70962),r=i(89927),o=i(88844),a=i(59406)},43829:function(t,e,i){var n=this&&this.__extends||function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();Object.defineProperty(e,"__esModule",{value:!0}),e.DownloadRateRule=void 0;var r=i(89927),o=i(59406),a=function(t){function e(e,i){var n=t.call(this,e,i)||this;return n.njb=[],n}return n(e,t),e.prototype.ojb=function(t){void 0===t&&(t=this.context.bufferSettings.getForwardTargetLevel());var e=Date.now()-(0,r.toMilliSeconds)(t),i=this.njb.filter(function(t){return t.timestamp>=e});if(0===i.length)return 1;var n=0;return i.forEach(function(t,e){var o=i[e-1],a=t.segmentDuration,s=a/8,u=Math.min(t.bufferLevel/t.bufferTargetLevel,1),l=Math.max(t.segmentDownloadDuration,s),h=u*(a/l)+a/(o?Math.max(t.timestamp-o.timestamp,s):(0,r.toMilliSeconds)(Math.max(a,l)))*(1-u);n=t.downloadCancelled?n-h:n+h}),n/i.length},e.prototype.addSample=function(t){(function(t){return null!=t.segmentDuration&&null!=t.segmentDownloadDuration})(t)&&(this.njb.push(t),t.timestamp-this.njb[0].timestamp>6e4&&this.njb.shift())},e.prototype.getStatus=function(t,e){var i=this.ojb(t),n=o.Rules.SHOULD_STAY;return i>1.7?n=o.Rules.SHOULD_SWITCH_UP:i<.5&&(n=o.Rules.SHOULD_SWITCH_DOWN),{value:i,result:n}},e.prototype.setStartupPhase=function(){},e.prototype.shutdown=function(){},e.prototype.dispose=function(){this.shutdown(),this.njb=[]},e}(o.AdaptationRule);e.DownloadRateRule=a},59406:function(t,e){var i;Object.defineProperty(e,"__esModule",{value:!0}),e.AdaptationRule=e.Rules=void 0,function(t){t.SHOULD_SWITCH_UP="SWITCH_UP",t.SHOULD_STAY="STAY",t.SHOULD_SWITCH_DOWN="SWITCH_DOWN"}(i||(e.Rules=i={}));var n=function(){function t(t,e){this.context=t,this.samples=[],this.mimeType=e,this.logger=t.logger,this.Settings=t.settings,this.maxHistorySize=this.Settings.DEFAULT_ADAPTATION_RULE_HISTORY_SIZE}return Object.defineProperty(t.prototype,"instanceState",{get:function(){var t;return null===(t=this.context.store)||void 0===t?void 0:t.getState()},enumerable:!1,configurable:!0}),t.prototype.estimateStatus=function(t,e,i){return this.getStatus(e,i)},t}();e.AdaptationRule=n},39185:function(t,e,i){var n=this&&this.__extends||function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();Object.defineProperty(e,"__esModule",{value:!0}),e.SegmentBasedRateMeasurementRule=void 0;var r=i(46151),o=i(33436),a=i(89927),s=i(70850),u=i(17006),l=i(7676),h=i(59406),p=function(t){function e(e,i){var n=t.call(this,e,i)||this;return n.yjb=-1,n.zjb=.1,n.Ajb=!0,n}return n(e,t),e.getBitrateFromPerformanceAPI=function(){if(!performance||"function"!=typeof performance.getEntriesByName)return 0;var t=0,e=0;return performance.getEntriesByType("resource").filter(d).forEach(function(i){t+=8*i.transferSize,e+=(0,a.toSeconds)(i.duration-(i.responseStart-i.requestStart))}),t>0&&e>0?t/e:0},e.prototype.Bjb=function(t,e,i){var n;void 0===e&&(e=1),void 0===i&&(i=0);var r=-t-i;return n=0!==i?this.samples.slice(r,-i):this.samples.slice(r),(0,u.calculateExponentialWeightedAverage)(n,1-e)},e.validateDownloadInfo=function(t){if(Boolean(t)&&Boolean(t.value)){var e=Boolean(t.value.bytes),i=!isNaN(t.value.time),n=void 0!==t.value.timeToFirstByte&&!isNaN(t.value.timeToFirstByte);return e&&i&&n}return!1},e.prototype.Cjb=function(t){if(!this.instanceState)return 0;var i=(0,r.getMetricsLastEntry)((0,r.getMetricsState)(this.instanceState),t,o.MetricType.DownloadInformation),n=e.validateDownloadInfo(i),a=n&&this.yjb<i.time;return a&&isFinite(i.time)&&(this.yjb=i.time),n&&a?c(i,this.context.settings.MAX_ALLOWED_BANDWIDTH_ESTIMATION):n&&!a?-1:0},e.prototype.Djb=function(){var t=[],i=this.Fjb();i>0&&t.push(i);var n=this.Cjb("default");n>0&&t.push(n);var r=Math.min.apply(Math,t);return r>0&&isFinite(r)?r:e.getBitrateFromPerformanceAPI()},e.prototype.addSample=function(){var t=this.Cjb(this.mimeType),e=0;this.Ajb&&(e=function(t,e){var i=(0,l.getStartupBitrateFromConfig)(t),n=(0,l.getMaxStartupBitrateFromConfig)(t);return n=e>0?Math.min(n,e):n,i||n||0}(this.context,t),this.Ajb=!1),0===(e=e||t||0)&&(e=this.Djb()),e>0&&(this.samples.push(e),this.samples.length>this.maxHistorySize&&this.samples.splice(0,this.samples.length-this.maxHistorySize)),t>0&&this.Ejb()},e.prototype.getStatus=function(t,e){void 0===t&&(t=1),void 0===e&&(e=1),0===this.samples.length&&this.addSample();var i=this.Bjb(t,e),n=this.Bjb(t,e,1);return{value:i,result:i>n*(1+this.zjb)?h.Rules.SHOULD_SWITCH_UP:i<n*(1-this.zjb)?h.Rules.SHOULD_SWITCH_DOWN:h.Rules.SHOULD_STAY}},e.prototype.Ejb=function(){if(this.instanceState){var t=(0,r.getMetricsHistoryFromInstanceState)(this.instanceState,this.mimeType,o.MetricType.DownloadInformation).filter(e.validateDownloadInfo).slice(-3).map(function(t){return c(t)});this.context.storedConfig.set("b",t),this.context.storedConfig.set("b_t",Date.now())}},e.prototype.Fjb=function(){var t=this,e=(this.context.storedConfig.get("b")||[]).map(function(e){return f(e,t.context.settings.MAX_ALLOWED_BANDWIDTH_ESTIMATION)});return Math.round(e.reduce(function(t,e){return t+e},0)/e.length)||0},e.prototype.shutdown=function(){},e.prototype.setStartupPhase=function(){},e.prototype.dispose=function(){},e}(h.AdaptationRule);function d(t){return t.transferSize>0&&!/^https?:\/\/localhost(:\d+)?(\/|$)/.test(t.name)}function c(t,e){var i;void 0===e&&(e=1/0);var n=t.value.time-(null!==(i=t.value.timeToFirstByte)&&void 0!==i?i:0);return f(8*t.value.bytes/n,e)}function f(t,e){var i=s.Util.extractBitrateFromString("max",e);return Math.min(t,i)}e.SegmentBasedRateMeasurementRule=p},45199:function(t,e,i){var n=this&&this.__extends||function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),r=this&&this.__spreadArray||function(t,e,i){if(i||2===arguments.length)for(var n,r=0,o=e.length;r<o;r++)!n&&r in e||(n||(n=Array.prototype.slice.call(e,0,r)),n[r]=e[r]);return t.concat(n||Array.prototype.slice.call(e))};Object.defineProperty(e,"__esModule",{value:!0}),e.TimeToFirstByteMeasurementRule=void 0;var o=i(46151),a=i(33436),s=i(17006),u=i(59406),l=function(t){function e(e,i){var n=t.call(this,e,i)||this;return n.Gjb=-1,n}return n(e,t),e.prototype.Hjb=function(t){if(!this.instanceState)return 0;var e=(0,o.getMetricsLastEntry)((0,o.getMetricsState)(this.instanceState),t,a.MetricType.DownloadInformation),i=Boolean(e)&&Boolean(e.value),n=i&&void 0!==e.value.timeToFirstByte&&!isNaN(e.value.timeToFirstByte),r=i&&this.Gjb<e.time;return r&&isFinite(e.time)&&(this.Gjb=e.time),n&&r?e.value.timeToFirstByte:n&&!r?-1:0},e.prototype.addSample=function(){var t=this.Hjb(this.mimeType),e=this.Hjb("default"),i=t||e||0;if(i>0)for(this.samples.push(i);this.samples.length>this.maxHistorySize;)this.samples.shift()},e.prototype.Skb=function(t){var e=-t;return t>0?this.samples.slice(e):[]},e.prototype.Tkb=function(t,e){var i=(0,s.calculateMean)(t),n=(0,s.calculateExponentialWeightedAverage)(t,e),r=(0,s.calculateStandardDeviation)(t,i);return{value:{median:(0,s.calculateMedian)(t),mean:i,weightedAverage:n,standardDeviation:r},result:u.Rules.SHOULD_STAY}},e.prototype.getStatus=function(t,e){return void 0===t&&(t=1),void 0===e&&(e=1),this.Tkb(this.Skb(t),e)},e.prototype.estimateStatus=function(t,e,i){void 0===e&&(e=1),void 0===i&&(i=1);var n=r(r([],this.Skb(e-1),!0),[t],!1);return this.Tkb(n,i)},e.prototype.setStartupPhase=function(){},e.prototype.shutdown=function(){},e.prototype.dispose=function(){},e}(u.AdaptationRule);e.TimeToFirstByteMeasurementRule=l},28922:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.findNextHigherBitrateRepresentation=function(t,e){for(var i,n,r=0,o=t;r<o.length;r++){var a=o[r];a._bandwidth>e&&(void 0===i||a._bandwidth<i._bandwidth)&&(i=a),(void 0===n||a._bandwidth>n._bandwidth)&&(n=a)}return null!=i?i:n}},83429:function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.getUserSelectedRepresentation=function(t,e,i,a){var s,u,l=function(t,e){return r.MimeTypeHelper.isAudio(t)?null==e?void 0:e.onAudioAdaptation:r.MimeTypeHelper.isVideo(t)?null==e?void 0:e.onVideoAdaptation:void 0}(e,t.config.adaptation);if(l){var h=t.serviceManager.maybeCall(n.ServiceName.ManifestService,function(t){return t.getAdaptationSet(i)},null,t.sourceContext.sourceIdentifier),p=null!==(s=null==h?void 0:h.Representation.map(function(t){return{bandwidth:t._bandwidth,id:t._id}}))&&void 0!==s?s:[],d={suggested:a.representationId,isAd:t.sourceContext.isAd,representations:p},c=null!==(u=(0,o.safeUserCallback)(function(){return l(d)},t.logger))&&void 0!==u?u:void 0;return function(t,e,i){return t.serviceManager.maybeCall(n.ServiceName.ManifestService,function(t){return e&&t.getRepresentation(e,i)},void 0,t.sourceContext.sourceIdentifier)||void 0}(t,i,c)}};var n=i(80813),r=i(85434),o=i(70850)}},function(t){return function(){return t(76344)}()}])});
18
18
  })();