rx-player 4.0.0-beta.2 → 4.0.0-beta.3

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 (909) hide show
  1. package/.eslintrc.js +9 -0
  2. package/CHANGELOG.md +173 -63
  3. package/CONTRIBUTING.md +27 -13
  4. package/FILES.md +0 -4
  5. package/README.md +0 -25
  6. package/VERSION +1 -1
  7. package/dist/_esm5.processed/compat/add_class_name.js +6 -3
  8. package/dist/_esm5.processed/compat/add_text_track.js +11 -8
  9. package/dist/_esm5.processed/compat/browser_compatibility_types.d.ts +0 -1
  10. package/dist/_esm5.processed/compat/browser_compatibility_types.js +16 -11
  11. package/dist/_esm5.processed/compat/browser_detection.js +49 -33
  12. package/dist/_esm5.processed/compat/browser_version.js +11 -8
  13. package/dist/_esm5.processed/compat/can_patch_isobmff.js +6 -3
  14. package/dist/_esm5.processed/compat/can_rely_on_video_visibility_and_size.js +9 -6
  15. package/dist/_esm5.processed/compat/can_reuse_media_keys.js +6 -3
  16. package/dist/_esm5.processed/compat/change_source_buffer_type.js +6 -3
  17. package/dist/_esm5.processed/compat/clear_element_src.js +12 -9
  18. package/dist/_esm5.processed/compat/eme/close_session.js +45 -106
  19. package/dist/_esm5.processed/compat/eme/constants.js +6 -3
  20. package/dist/_esm5.processed/compat/eme/custom_key_system_access.js +18 -22
  21. package/dist/_esm5.processed/compat/eme/custom_media_keys/ie11_media_keys.d.ts +2 -2
  22. package/dist/_esm5.processed/compat/eme/custom_media_keys/ie11_media_keys.js +81 -101
  23. package/dist/_esm5.processed/compat/eme/custom_media_keys/index.d.ts +6 -27
  24. package/dist/_esm5.processed/compat/eme/custom_media_keys/index.js +16 -159
  25. package/dist/_esm5.processed/compat/eme/custom_media_keys/moz_media_keys_constructor.d.ts +1 -1
  26. package/dist/_esm5.processed/compat/eme/custom_media_keys/moz_media_keys_constructor.js +31 -26
  27. package/dist/_esm5.processed/compat/eme/custom_media_keys/ms_media_keys_constructor.js +14 -14
  28. package/dist/_esm5.processed/compat/eme/custom_media_keys/old_webkit_media_keys.d.ts +2 -2
  29. package/dist/_esm5.processed/compat/eme/custom_media_keys/old_webkit_media_keys.js +75 -89
  30. package/dist/_esm5.processed/compat/eme/custom_media_keys/types.d.ts +1 -1
  31. package/dist/_esm5.processed/compat/eme/custom_media_keys/types.js +2 -1
  32. package/dist/_esm5.processed/compat/eme/custom_media_keys/webkit_media_keys.d.ts +2 -2
  33. package/dist/_esm5.processed/compat/eme/custom_media_keys/webkit_media_keys.js +97 -119
  34. package/dist/_esm5.processed/compat/eme/custom_media_keys/webkit_media_keys_constructor.js +14 -16
  35. package/dist/_esm5.processed/compat/eme/eme-api-implementation.d.ts +78 -0
  36. package/dist/_esm5.processed/compat/eme/eme-api-implementation.js +198 -0
  37. package/dist/_esm5.processed/compat/eme/generate_key_request.js +36 -31
  38. package/dist/_esm5.processed/compat/eme/get_init_data.js +28 -25
  39. package/dist/_esm5.processed/compat/eme/get_uuid_kid_from_keystatus_kid.js +8 -5
  40. package/dist/_esm5.processed/compat/eme/get_webkit_fairplay_initdata.js +17 -14
  41. package/dist/_esm5.processed/compat/eme/index.d.ts +5 -3
  42. package/dist/_esm5.processed/compat/eme/index.js +13 -7
  43. package/dist/_esm5.processed/compat/eme/load_session.js +26 -69
  44. package/dist/_esm5.processed/compat/enable_audio_track.js +7 -4
  45. package/dist/_esm5.processed/compat/event_listeners.d.ts +13 -5
  46. package/dist/_esm5.processed/compat/event_listeners.js +132 -108
  47. package/dist/_esm5.processed/compat/get_start_date.js +7 -4
  48. package/dist/_esm5.processed/compat/global_scope.d.ts +9 -0
  49. package/dist/_esm5.processed/compat/global_scope.js +15 -0
  50. package/dist/_esm5.processed/compat/has_issues_with_high_media_source_duration.js +6 -3
  51. package/dist/_esm5.processed/compat/index.d.ts +2 -3
  52. package/dist/_esm5.processed/compat/index.js +47 -25
  53. package/dist/_esm5.processed/compat/is_codec_supported.js +8 -5
  54. package/dist/_esm5.processed/compat/is_debug_mode_enabled.d.ts +7 -0
  55. package/dist/_esm5.processed/compat/is_debug_mode_enabled.js +12 -0
  56. package/dist/_esm5.processed/compat/is_node.d.ts +1 -0
  57. package/dist/_esm5.processed/compat/is_node.js +6 -2
  58. package/dist/_esm5.processed/compat/is_seeking_approximate.js +5 -3
  59. package/dist/_esm5.processed/compat/is_vtt_cue.js +6 -2
  60. package/dist/_esm5.processed/compat/is_worker.d.ts +5 -0
  61. package/dist/_esm5.processed/compat/is_worker.js +7 -0
  62. package/dist/_esm5.processed/compat/make_vtt_cue.js +10 -6
  63. package/dist/_esm5.processed/compat/on_height_width_change.js +25 -27
  64. package/dist/_esm5.processed/compat/patch_webkit_source_buffer.js +19 -16
  65. package/dist/_esm5.processed/compat/remove_cue.js +12 -9
  66. package/dist/_esm5.processed/compat/should_favour_custom_safari_EME.js +7 -4
  67. package/dist/_esm5.processed/compat/should_reload_media_source_on_decipherability_update.js +4 -1
  68. package/dist/_esm5.processed/compat/should_renew_media_key_system_access.js +6 -3
  69. package/dist/_esm5.processed/compat/should_unset_media_keys.js +6 -3
  70. package/dist/_esm5.processed/compat/should_validate_metadata.js +6 -3
  71. package/dist/_esm5.processed/compat/should_wait_for_data_before_loaded.js +6 -3
  72. package/dist/_esm5.processed/compat/should_wait_for_have_enough_data.d.ts +13 -0
  73. package/dist/_esm5.processed/compat/should_wait_for_have_enough_data.js +19 -0
  74. package/dist/_esm5.processed/config.js +15 -14
  75. package/dist/_esm5.processed/core/adaptive/adaptive_representation_selector.js +136 -104
  76. package/dist/_esm5.processed/core/adaptive/buffer_based_chooser.d.ts +19 -3
  77. package/dist/_esm5.processed/core/adaptive/buffer_based_chooser.js +66 -46
  78. package/dist/_esm5.processed/core/adaptive/guess_based_chooser.js +37 -43
  79. package/dist/_esm5.processed/core/adaptive/index.js +4 -2
  80. package/dist/_esm5.processed/core/adaptive/network_analyzer.js +75 -73
  81. package/dist/_esm5.processed/core/adaptive/utils/bandwidth_estimator.js +24 -23
  82. package/dist/_esm5.processed/core/adaptive/utils/ewma.js +13 -12
  83. package/dist/_esm5.processed/core/adaptive/utils/filter_by_bitrate.js +9 -6
  84. package/dist/_esm5.processed/core/adaptive/utils/filter_by_resolution.js +18 -19
  85. package/dist/_esm5.processed/core/adaptive/utils/get_buffer_levels.js +10 -7
  86. package/dist/_esm5.processed/core/adaptive/utils/last_estimate_storage.js +8 -7
  87. package/dist/_esm5.processed/core/adaptive/utils/pending_requests_store.d.ts +13 -3
  88. package/dist/_esm5.processed/core/adaptive/utils/pending_requests_store.js +26 -23
  89. package/dist/_esm5.processed/core/adaptive/utils/representation_score_calculator.js +25 -23
  90. package/dist/_esm5.processed/core/adaptive/utils/select_optimal_representation.js +6 -3
  91. package/dist/_esm5.processed/core/api/debug/buffer_graph.js +41 -40
  92. package/dist/_esm5.processed/core/api/debug/buffer_size_graph.js +31 -29
  93. package/dist/_esm5.processed/core/api/debug/constants.js +4 -1
  94. package/dist/_esm5.processed/core/api/debug/index.js +4 -2
  95. package/dist/_esm5.processed/core/api/debug/modules/general_info.js +64 -72
  96. package/dist/_esm5.processed/core/api/debug/modules/segment_buffer_content.js +49 -46
  97. package/dist/_esm5.processed/core/api/debug/modules/segment_buffer_size.js +15 -12
  98. package/dist/_esm5.processed/core/api/debug/render.js +16 -13
  99. package/dist/_esm5.processed/core/api/debug/utils.js +18 -13
  100. package/dist/_esm5.processed/core/api/index.js +7 -4
  101. package/dist/_esm5.processed/core/api/option_utils.d.ts +1 -1
  102. package/dist/_esm5.processed/core/api/option_utils.js +86 -59
  103. package/dist/_esm5.processed/core/api/playback_observer.d.ts +8 -2
  104. package/dist/_esm5.processed/core/api/playback_observer.js +135 -123
  105. package/dist/_esm5.processed/core/api/public_api.d.ts +6 -0
  106. package/dist/_esm5.processed/core/api/public_api.js +614 -676
  107. package/dist/_esm5.processed/core/api/track_management/index.js +19 -3
  108. package/dist/_esm5.processed/core/api/track_management/media_element_tracks_store.js +233 -248
  109. package/dist/_esm5.processed/core/api/track_management/track_dispatcher.d.ts +2 -2
  110. package/dist/_esm5.processed/core/api/track_management/track_dispatcher.js +47 -58
  111. package/dist/_esm5.processed/core/api/track_management/tracks_store.d.ts +50 -29
  112. package/dist/_esm5.processed/core/api/track_management/tracks_store.js +325 -351
  113. package/dist/_esm5.processed/core/api/utils.js +32 -24
  114. package/dist/_esm5.processed/core/decrypt/__tests__/__global__/utils.d.ts +3 -3
  115. package/dist/_esm5.processed/core/decrypt/__tests__/__global__/utils.js +167 -190
  116. package/dist/_esm5.processed/core/decrypt/attach_media_keys.d.ts +8 -2
  117. package/dist/_esm5.processed/core/decrypt/attach_media_keys.js +44 -72
  118. package/dist/_esm5.processed/core/decrypt/clear_on_stop.d.ts +1 -1
  119. package/dist/_esm5.processed/core/decrypt/clear_on_stop.js +15 -12
  120. package/dist/_esm5.processed/core/decrypt/content_decryptor.d.ts +9 -67
  121. package/dist/_esm5.processed/core/decrypt/content_decryptor.js +400 -542
  122. package/dist/_esm5.processed/core/decrypt/create_or_load_session.d.ts +1 -1
  123. package/dist/_esm5.processed/core/decrypt/create_or_load_session.js +44 -90
  124. package/dist/_esm5.processed/core/decrypt/create_session.d.ts +1 -1
  125. package/dist/_esm5.processed/core/decrypt/create_session.js +90 -149
  126. package/dist/_esm5.processed/core/decrypt/dispose_decryption_resources.d.ts +1 -1
  127. package/dist/_esm5.processed/core/decrypt/dispose_decryption_resources.js +24 -60
  128. package/dist/_esm5.processed/core/decrypt/find_key_system.d.ts +1 -1
  129. package/dist/_esm5.processed/core/decrypt/find_key_system.js +104 -162
  130. package/dist/_esm5.processed/core/decrypt/get_key_system_configuration.js +6 -3
  131. package/dist/_esm5.processed/core/decrypt/get_media_keys.d.ts +1 -1
  132. package/dist/_esm5.processed/core/decrypt/get_media_keys.js +59 -109
  133. package/dist/_esm5.processed/core/decrypt/index.d.ts +2 -2
  134. package/dist/_esm5.processed/core/decrypt/index.js +26 -7
  135. package/dist/_esm5.processed/core/decrypt/init_media_keys.js +17 -59
  136. package/dist/_esm5.processed/core/decrypt/session_events_listener.d.ts +1 -1
  137. package/dist/_esm5.processed/core/decrypt/session_events_listener.js +84 -155
  138. package/dist/_esm5.processed/core/decrypt/set_server_certificate.d.ts +1 -1
  139. package/dist/_esm5.processed/core/decrypt/set_server_certificate.js +50 -103
  140. package/dist/_esm5.processed/core/decrypt/types.d.ts +61 -0
  141. package/dist/_esm5.processed/core/decrypt/types.js +43 -1
  142. package/dist/_esm5.processed/core/decrypt/utils/are_init_values_compatible.js +22 -19
  143. package/dist/_esm5.processed/core/decrypt/utils/check_key_statuses.d.ts +1 -1
  144. package/dist/_esm5.processed/core/decrypt/utils/check_key_statuses.js +40 -61
  145. package/dist/_esm5.processed/core/decrypt/utils/clean_old_loaded_sessions.js +17 -61
  146. package/dist/_esm5.processed/core/decrypt/utils/clean_old_stored_persistent_info.js +8 -5
  147. package/dist/_esm5.processed/core/decrypt/utils/get_drm_system_id.js +8 -5
  148. package/dist/_esm5.processed/core/decrypt/utils/init_data_values_container.js +23 -23
  149. package/dist/_esm5.processed/core/decrypt/utils/is_session_usable.d.ts +1 -1
  150. package/dist/_esm5.processed/core/decrypt/utils/is_session_usable.js +15 -12
  151. package/dist/_esm5.processed/core/decrypt/utils/key_id_comparison.d.ts +0 -13
  152. package/dist/_esm5.processed/core/decrypt/utils/key_id_comparison.js +14 -38
  153. package/dist/_esm5.processed/core/decrypt/utils/key_session_record.js +26 -26
  154. package/dist/_esm5.processed/core/decrypt/utils/loaded_sessions_store.d.ts +1 -1
  155. package/dist/_esm5.processed/core/decrypt/utils/loaded_sessions_store.js +206 -310
  156. package/dist/_esm5.processed/core/decrypt/utils/media_keys_infos_store.d.ts +2 -1
  157. package/dist/_esm5.processed/core/decrypt/utils/media_keys_infos_store.js +8 -6
  158. package/dist/_esm5.processed/core/decrypt/utils/persistent_sessions_store.d.ts +1 -1
  159. package/dist/_esm5.processed/core/decrypt/utils/persistent_sessions_store.js +103 -103
  160. package/dist/_esm5.processed/core/decrypt/utils/serializable_bytes.js +13 -12
  161. package/dist/_esm5.processed/core/decrypt/utils/server_certificate_store.d.ts +1 -1
  162. package/dist/_esm5.processed/core/decrypt/utils/server_certificate_store.js +18 -16
  163. package/dist/_esm5.processed/core/fetchers/cdn_prioritizer.js +37 -56
  164. package/dist/_esm5.processed/core/fetchers/index.js +7 -3
  165. package/dist/_esm5.processed/core/fetchers/manifest/index.js +4 -2
  166. package/dist/_esm5.processed/core/fetchers/manifest/manifest_fetcher.js +233 -312
  167. package/dist/_esm5.processed/core/fetchers/segment/index.js +4 -2
  168. package/dist/_esm5.processed/core/fetchers/segment/prioritized_segment_fetcher.js +12 -9
  169. package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.js +218 -233
  170. package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher_creator.js +20 -19
  171. package/dist/_esm5.processed/core/fetchers/segment/task_prioritizer.js +73 -74
  172. package/dist/_esm5.processed/core/fetchers/utils/error_selector.js +8 -5
  173. package/dist/_esm5.processed/core/fetchers/utils/schedule_request.js +210 -260
  174. package/dist/_esm5.processed/core/init/directfile_content_initializer.d.ts +60 -1
  175. package/dist/_esm5.processed/core/init/directfile_content_initializer.js +122 -105
  176. package/dist/_esm5.processed/core/init/index.d.ts +1 -4
  177. package/dist/_esm5.processed/core/init/index.js +5 -3
  178. package/dist/_esm5.processed/core/init/media_source_content_initializer.js +269 -307
  179. package/dist/_esm5.processed/core/init/types.d.ts +3 -17
  180. package/dist/_esm5.processed/core/init/types.js +7 -24
  181. package/dist/_esm5.processed/core/init/utils/content_time_boundaries_observer.js +109 -135
  182. package/dist/_esm5.processed/core/init/utils/create_media_source.js +35 -27
  183. package/dist/_esm5.processed/core/init/utils/create_stream_playback_observer.d.ts +9 -4
  184. package/dist/_esm5.processed/core/init/utils/create_stream_playback_observer.js +22 -14
  185. package/dist/_esm5.processed/core/init/utils/end_of_stream.js +30 -25
  186. package/dist/_esm5.processed/core/init/utils/get_initial_time.js +41 -37
  187. package/dist/_esm5.processed/core/init/utils/get_loaded_reference.js +15 -10
  188. package/dist/_esm5.processed/core/init/utils/initial_seek_and_play.js +31 -28
  189. package/dist/_esm5.processed/core/init/utils/initialize_content_decryption.d.ts +3 -3
  190. package/dist/_esm5.processed/core/init/utils/initialize_content_decryption.js +48 -53
  191. package/dist/_esm5.processed/core/init/utils/media_source_duration_updater.js +61 -58
  192. package/dist/_esm5.processed/core/init/utils/rebuffering_controller.d.ts +3 -3
  193. package/dist/_esm5.processed/core/init/utils/rebuffering_controller.js +141 -160
  194. package/dist/_esm5.processed/core/init/utils/stream_events_emitter/are_same_stream_events.js +3 -1
  195. package/dist/_esm5.processed/core/init/utils/stream_events_emitter/index.js +4 -2
  196. package/dist/_esm5.processed/core/init/utils/stream_events_emitter/refresh_scheduled_events_list.js +28 -14
  197. package/dist/_esm5.processed/core/init/utils/stream_events_emitter/stream_events_emitter.d.ts +31 -9
  198. package/dist/_esm5.processed/core/init/utils/stream_events_emitter/stream_events_emitter.js +103 -79
  199. package/dist/_esm5.processed/core/init/utils/stream_events_emitter/types.js +2 -1
  200. package/dist/_esm5.processed/core/init/utils/throw_on_media_error.js +16 -13
  201. package/dist/_esm5.processed/core/segment_buffers/garbage_collector.js +75 -126
  202. package/dist/_esm5.processed/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.js +131 -140
  203. package/dist/_esm5.processed/core/segment_buffers/implementations/audio_video/index.js +4 -2
  204. package/dist/_esm5.processed/core/segment_buffers/implementations/index.js +20 -3
  205. package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/html_text_segment_buffer.d.ts +2 -2
  206. package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/html_text_segment_buffer.js +109 -128
  207. package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/index.js +4 -2
  208. package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/parsers.js +11 -8
  209. package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/text_track_cues_store.js +48 -47
  210. package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/types.js +2 -1
  211. package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/update_proportional_elements.js +18 -15
  212. package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/utils.js +22 -15
  213. package/dist/_esm5.processed/core/segment_buffers/implementations/text/native/index.js +4 -2
  214. package/dist/_esm5.processed/core/segment_buffers/implementations/text/native/native_text_segment_buffer.js +65 -82
  215. package/dist/_esm5.processed/core/segment_buffers/implementations/text/native/parsers.js +11 -8
  216. package/dist/_esm5.processed/core/segment_buffers/implementations/types.js +19 -17
  217. package/dist/_esm5.processed/core/segment_buffers/implementations/utils/manual_time_ranges.js +23 -22
  218. package/dist/_esm5.processed/core/segment_buffers/index.js +13 -6
  219. package/dist/_esm5.processed/core/segment_buffers/inventory/buffered_history.d.ts +2 -2
  220. package/dist/_esm5.processed/core/segment_buffers/inventory/buffered_history.js +25 -22
  221. package/dist/_esm5.processed/core/segment_buffers/inventory/index.js +8 -3
  222. package/dist/_esm5.processed/core/segment_buffers/inventory/segment_inventory.js +152 -150
  223. package/dist/_esm5.processed/core/segment_buffers/inventory/types.js +2 -1
  224. package/dist/_esm5.processed/core/segment_buffers/inventory/utils.js +9 -4
  225. package/dist/_esm5.processed/core/segment_buffers/segment_buffers_store.js +82 -89
  226. package/dist/_esm5.processed/core/stream/adaptation/adaptation_stream.d.ts +1 -1
  227. package/dist/_esm5.processed/core/stream/adaptation/adaptation_stream.js +130 -171
  228. package/dist/_esm5.processed/core/stream/adaptation/get_representations_switch_strategy.js +31 -28
  229. package/dist/_esm5.processed/core/stream/adaptation/index.js +19 -3
  230. package/dist/_esm5.processed/core/stream/adaptation/types.d.ts +14 -8
  231. package/dist/_esm5.processed/core/stream/adaptation/types.js +2 -1
  232. package/dist/_esm5.processed/core/stream/index.d.ts +2 -2
  233. package/dist/_esm5.processed/core/stream/index.js +4 -2
  234. package/dist/_esm5.processed/core/stream/orchestrator/get_time_ranges_for_content.js +14 -21
  235. package/dist/_esm5.processed/core/stream/orchestrator/index.d.ts +2 -2
  236. package/dist/_esm5.processed/core/stream/orchestrator/index.js +4 -2
  237. package/dist/_esm5.processed/core/stream/orchestrator/stream_orchestrator.d.ts +15 -29
  238. package/dist/_esm5.processed/core/stream/orchestrator/stream_orchestrator.js +193 -235
  239. package/dist/_esm5.processed/core/stream/period/index.js +19 -3
  240. package/dist/_esm5.processed/core/stream/period/period_stream.js +204 -228
  241. package/dist/_esm5.processed/core/stream/period/types.d.ts +3 -3
  242. package/dist/_esm5.processed/core/stream/period/types.js +2 -1
  243. package/dist/_esm5.processed/core/stream/period/utils/get_adaptation_switch_strategy.d.ts +18 -4
  244. package/dist/_esm5.processed/core/stream/period/utils/get_adaptation_switch_strategy.js +34 -33
  245. package/dist/_esm5.processed/core/stream/representation/index.js +19 -3
  246. package/dist/_esm5.processed/core/stream/representation/representation_stream.d.ts +1 -1
  247. package/dist/_esm5.processed/core/stream/representation/representation_stream.js +81 -68
  248. package/dist/_esm5.processed/core/stream/representation/types.d.ts +3 -4
  249. package/dist/_esm5.processed/core/stream/representation/types.js +2 -1
  250. package/dist/_esm5.processed/core/stream/representation/utils/append_segment_to_buffer.js +33 -84
  251. package/dist/_esm5.processed/core/stream/representation/utils/check_for_discontinuity.js +32 -29
  252. package/dist/_esm5.processed/core/stream/representation/utils/downloading_queue.d.ts +1 -1
  253. package/dist/_esm5.processed/core/stream/representation/utils/downloading_queue.js +126 -145
  254. package/dist/_esm5.processed/core/stream/representation/utils/force_garbage_collection.js +32 -88
  255. package/dist/_esm5.processed/core/stream/representation/utils/get_buffer_status.js +61 -47
  256. package/dist/_esm5.processed/core/stream/representation/utils/get_needed_segments.js +71 -69
  257. package/dist/_esm5.processed/core/stream/representation/utils/get_segment_priority.js +8 -5
  258. package/dist/_esm5.processed/core/stream/representation/utils/push_init_segment.d.ts +2 -2
  259. package/dist/_esm5.processed/core/stream/representation/utils/push_init_segment.js +22 -63
  260. package/dist/_esm5.processed/core/stream/representation/utils/push_media_segment.d.ts +1 -1
  261. package/dist/_esm5.processed/core/stream/representation/utils/push_media_segment.js +49 -86
  262. package/dist/_esm5.processed/default_config.js +4 -2
  263. package/dist/_esm5.processed/errors/assertion_error.js +10 -26
  264. package/dist/_esm5.processed/errors/custom_loader_error.js +12 -28
  265. package/dist/_esm5.processed/errors/encrypted_media_error.js +16 -32
  266. package/dist/_esm5.processed/errors/error_codes.js +9 -4
  267. package/dist/_esm5.processed/errors/error_message.d.ts +1 -2
  268. package/dist/_esm5.processed/errors/error_message.js +5 -3
  269. package/dist/_esm5.processed/errors/format_error.js +9 -7
  270. package/dist/_esm5.processed/errors/index.js +25 -11
  271. package/dist/_esm5.processed/errors/is_known_error.js +14 -11
  272. package/dist/_esm5.processed/errors/media_error.d.ts +2 -2
  273. package/dist/_esm5.processed/errors/media_error.js +34 -47
  274. package/dist/_esm5.processed/errors/network_error.js +21 -37
  275. package/dist/_esm5.processed/errors/other_error.js +15 -31
  276. package/dist/_esm5.processed/errors/request_error.js +27 -29
  277. package/dist/_esm5.processed/experimental/features/dash_wasm.js +15 -9
  278. package/dist/_esm5.processed/experimental/features/debug_element.js +7 -4
  279. package/dist/_esm5.processed/experimental/features/index.d.ts +0 -1
  280. package/dist/_esm5.processed/experimental/features/index.js +9 -4
  281. package/dist/_esm5.processed/experimental/features/local.js +10 -4
  282. package/dist/_esm5.processed/experimental/features/metaplaylist.js +10 -4
  283. package/dist/_esm5.processed/experimental/index.js +5 -2
  284. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/features/dash.js +6 -3
  285. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/features/metaplaylist.js +6 -3
  286. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/index.js +7 -3
  287. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/load_and_push_segment.js +22 -16
  288. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/prepare_source_buffer.js +22 -19
  289. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/remove_buffer_around_time.js +6 -3
  290. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/types.js +2 -1
  291. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.js +125 -186
  292. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader_error.js +11 -27
  293. package/dist/_esm5.processed/experimental/tools/createMetaplaylist/get_duration_from_manifest.js +76 -119
  294. package/dist/_esm5.processed/experimental/tools/createMetaplaylist/index.js +24 -15
  295. package/dist/_esm5.processed/experimental/tools/index.js +11 -5
  296. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/api/index.d.ts +1 -1
  297. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/api/index.js +39 -44
  298. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/api/probeMediaConfiguration.d.ts +1 -1
  299. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/api/probeMediaConfiguration.js +34 -36
  300. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/capabilities.js +21 -18
  301. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/index.js +4 -2
  302. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/log.js +5 -3
  303. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/DRMInfos.d.ts +1 -1
  304. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/DRMInfos.js +21 -17
  305. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/HDCPPolicy.js +21 -17
  306. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/decodingInfo.js +13 -10
  307. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/defaultCodecsFinder.js +16 -13
  308. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/index.js +16 -14
  309. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/mediaContentType.js +14 -11
  310. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/mediaContentTypeWithFeatures/format.js +14 -11
  311. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/mediaContentTypeWithFeatures/index.js +19 -15
  312. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/mediaDisplayInfos.js +11 -7
  313. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/types.js +5 -2
  314. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/utils.js +25 -22
  315. package/dist/_esm5.processed/experimental/tools/parseBIFThumbnails.js +7 -4
  316. package/dist/_esm5.processed/features/add_features.js +11 -8
  317. package/dist/_esm5.processed/features/features_object.js +6 -3
  318. package/dist/_esm5.processed/features/index.js +7 -4
  319. package/dist/_esm5.processed/features/list/dash.js +12 -6
  320. package/dist/_esm5.processed/features/list/directfile.js +9 -5
  321. package/dist/_esm5.processed/features/list/eme.js +7 -4
  322. package/dist/_esm5.processed/features/list/html_sami_parser.js +9 -4
  323. package/dist/_esm5.processed/features/list/html_srt_parser.js +9 -4
  324. package/dist/_esm5.processed/features/list/html_text_buffer.js +7 -4
  325. package/dist/_esm5.processed/features/list/html_ttml_parser.js +9 -4
  326. package/dist/_esm5.processed/features/list/html_vtt_parser.js +9 -4
  327. package/dist/_esm5.processed/features/list/index.js +31 -14
  328. package/dist/_esm5.processed/features/list/native_sami_parser.js +10 -4
  329. package/dist/_esm5.processed/features/list/native_srt_parser.js +10 -4
  330. package/dist/_esm5.processed/features/list/native_text_buffer.js +8 -4
  331. package/dist/_esm5.processed/features/list/native_ttml_parser.js +10 -4
  332. package/dist/_esm5.processed/features/list/native_vtt_parser.js +10 -4
  333. package/dist/_esm5.processed/features/list/smooth.js +10 -4
  334. package/dist/_esm5.processed/features/types.d.ts +84 -7
  335. package/dist/_esm5.processed/features/types.js +2 -1
  336. package/dist/_esm5.processed/index.d.ts +0 -4
  337. package/dist/_esm5.processed/index.js +24 -8
  338. package/dist/_esm5.processed/log.js +5 -3
  339. package/dist/_esm5.processed/manifest/adaptation.js +52 -55
  340. package/dist/_esm5.processed/manifest/index.js +32 -13
  341. package/dist/_esm5.processed/manifest/manifest.d.ts +4 -7
  342. package/dist/_esm5.processed/manifest/manifest.js +117 -135
  343. package/dist/_esm5.processed/manifest/period.d.ts +2 -7
  344. package/dist/_esm5.processed/manifest/period.js +39 -46
  345. package/dist/_esm5.processed/manifest/representation.d.ts +12 -0
  346. package/dist/_esm5.processed/manifest/representation.js +81 -63
  347. package/dist/_esm5.processed/manifest/representation_index/index.js +5 -2
  348. package/dist/_esm5.processed/manifest/representation_index/static.js +43 -42
  349. package/dist/_esm5.processed/manifest/representation_index/types.js +2 -1
  350. package/dist/_esm5.processed/manifest/types.js +5 -2
  351. package/dist/_esm5.processed/manifest/update_period_in_place.js +38 -48
  352. package/dist/_esm5.processed/manifest/update_periods.js +59 -69
  353. package/dist/_esm5.processed/manifest/utils.js +14 -9
  354. package/dist/_esm5.processed/minimal.d.ts +1 -17
  355. package/dist/_esm5.processed/minimal.js +9 -39
  356. package/dist/_esm5.processed/parsers/containers/isobmff/constants.js +4 -1
  357. package/dist/_esm5.processed/parsers/containers/isobmff/create_box.js +14 -10
  358. package/dist/_esm5.processed/parsers/containers/isobmff/drm/index.js +5 -1
  359. package/dist/_esm5.processed/parsers/containers/isobmff/drm/playready.js +15 -11
  360. package/dist/_esm5.processed/parsers/containers/isobmff/get_box.js +48 -40
  361. package/dist/_esm5.processed/parsers/containers/isobmff/index.js +27 -6
  362. package/dist/_esm5.processed/parsers/containers/isobmff/read.js +20 -14
  363. package/dist/_esm5.processed/parsers/containers/isobmff/take_pssh_out.js +25 -20
  364. package/dist/_esm5.processed/parsers/containers/isobmff/utils.js +130 -112
  365. package/dist/_esm5.processed/parsers/containers/matroska/index.js +6 -1
  366. package/dist/_esm5.processed/parsers/containers/matroska/utils.js +67 -63
  367. package/dist/_esm5.processed/parsers/images/bif.js +40 -29
  368. package/dist/_esm5.processed/parsers/manifest/dash/common/attach_trickmode_track.js +10 -12
  369. package/dist/_esm5.processed/parsers/manifest/dash/common/flatten_overlapping_periods.js +10 -7
  370. package/dist/_esm5.processed/parsers/manifest/dash/common/get_clock_offset.d.ts +3 -3
  371. package/dist/_esm5.processed/parsers/manifest/dash/common/get_clock_offset.js +11 -7
  372. package/dist/_esm5.processed/parsers/manifest/dash/common/get_hdr_information.js +10 -6
  373. package/dist/_esm5.processed/parsers/manifest/dash/common/get_http_utc-timing_url.js +7 -6
  374. package/dist/_esm5.processed/parsers/manifest/dash/common/get_minimum_and_maximum_positions.js +10 -6
  375. package/dist/_esm5.processed/parsers/manifest/dash/common/get_periods_time_infos.js +14 -9
  376. package/dist/_esm5.processed/parsers/manifest/dash/common/index.js +10 -4
  377. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/base.js +73 -67
  378. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/get_init_segment.js +9 -4
  379. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/get_segments_from_timeline.js +32 -25
  380. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/index.js +11 -5
  381. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/list.js +81 -70
  382. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/template.js +130 -123
  383. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_elements.js +15 -12
  384. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_previous_timeline.js +35 -32
  385. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/convert_element_to_index_segment.js +14 -9
  386. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/find_first_common_start_time.js +30 -22
  387. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/index.js +4 -2
  388. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/parse_s_element.js +14 -11
  389. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.d.ts +5 -3
  390. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.js +131 -128
  391. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/tokens.js +16 -10
  392. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/utils.js +7 -3
  393. package/dist/_esm5.processed/parsers/manifest/dash/common/infer_adaptation_type.js +19 -18
  394. package/dist/_esm5.processed/parsers/manifest/dash/common/manifest_bounds_calculator.d.ts +8 -4
  395. package/dist/_esm5.processed/parsers/manifest/dash/common/manifest_bounds_calculator.js +22 -19
  396. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_adaptation_sets.js +111 -108
  397. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_availability_start_time.js +4 -1
  398. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_mpd.d.ts +6 -3
  399. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_mpd.js +86 -84
  400. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_periods.d.ts +4 -0
  401. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_periods.js +101 -84
  402. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representation_index.d.ts +2 -2
  403. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representation_index.js +39 -37
  404. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representations.js +64 -65
  405. package/dist/_esm5.processed/parsers/manifest/dash/common/resolve_base_urls.js +12 -9
  406. package/dist/_esm5.processed/parsers/manifest/dash/index.js +8 -1
  407. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/index.js +4 -2
  408. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/AdaptationSet.js +66 -62
  409. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/BaseURL.js +7 -4
  410. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/ContentComponent.js +7 -4
  411. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/ContentProtection.js +22 -19
  412. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/EventStream.js +22 -19
  413. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/Initialization.js +11 -8
  414. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/MPD.js +38 -34
  415. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/Period.js +34 -30
  416. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/Representation.js +50 -38
  417. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/SegmentBase.js +24 -21
  418. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/SegmentList.js +15 -12
  419. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/SegmentTemplate.js +21 -18
  420. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/SegmentTimeline.js +6 -3
  421. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/SegmentURL.js +12 -9
  422. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/utils.js +60 -64
  423. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/parse_from_document.js +33 -27
  424. package/dist/_esm5.processed/parsers/manifest/dash/node_parser_types.d.ts +1 -0
  425. package/dist/_esm5.processed/parsers/manifest/dash/node_parser_types.js +2 -1
  426. package/dist/_esm5.processed/parsers/manifest/dash/parsers_types.d.ts +4 -4
  427. package/dist/_esm5.processed/parsers/manifest/dash/parsers_types.js +2 -1
  428. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/index.js +4 -2
  429. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/dash-wasm-parser.js +192 -237
  430. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/AdaptationSet.js +67 -62
  431. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/BaseURL.js +8 -4
  432. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/ContentComponent.js +11 -7
  433. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/ContentProtection.js +17 -13
  434. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/EventStream.js +29 -24
  435. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/MPD.js +38 -33
  436. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/Period.js +37 -32
  437. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/Representation.js +50 -35
  438. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/Scheme.js +9 -5
  439. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/SegmentBase.js +16 -12
  440. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/SegmentList.js +11 -7
  441. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/SegmentTemplate.js +20 -16
  442. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/SegmentUrl.js +11 -7
  443. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/XLink.js +11 -7
  444. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/index.js +5 -1
  445. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/root.js +10 -6
  446. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/parsers_stack.js +22 -20
  447. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/types.js +2 -1
  448. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/utils.js +6 -2
  449. package/dist/_esm5.processed/parsers/manifest/index.js +17 -1
  450. package/dist/_esm5.processed/parsers/manifest/local/index.js +4 -2
  451. package/dist/_esm5.processed/parsers/manifest/local/parse_local_manifest.js +31 -26
  452. package/dist/_esm5.processed/parsers/manifest/local/representation_index.js +71 -84
  453. package/dist/_esm5.processed/parsers/manifest/local/types.d.ts +2 -0
  454. package/dist/_esm5.processed/parsers/manifest/local/types.js +2 -1
  455. package/dist/_esm5.processed/parsers/manifest/metaplaylist/index.js +4 -2
  456. package/dist/_esm5.processed/parsers/manifest/metaplaylist/metaplaylist_parser.js +76 -71
  457. package/dist/_esm5.processed/parsers/manifest/metaplaylist/representation_index.js +52 -52
  458. package/dist/_esm5.processed/parsers/manifest/smooth/create_parser.js +200 -175
  459. package/dist/_esm5.processed/parsers/manifest/smooth/get_codecs.js +13 -8
  460. package/dist/_esm5.processed/parsers/manifest/smooth/index.js +7 -4
  461. package/dist/_esm5.processed/parsers/manifest/smooth/parse_C_nodes.js +17 -14
  462. package/dist/_esm5.processed/parsers/manifest/smooth/parse_protection_node.js +17 -15
  463. package/dist/_esm5.processed/parsers/manifest/smooth/representation_index.d.ts +3 -3
  464. package/dist/_esm5.processed/parsers/manifest/smooth/representation_index.js +102 -97
  465. package/dist/_esm5.processed/parsers/manifest/smooth/shared_smooth_segment_timeline.d.ts +3 -3
  466. package/dist/_esm5.processed/parsers/manifest/smooth/shared_smooth_segment_timeline.js +49 -47
  467. package/dist/_esm5.processed/parsers/manifest/smooth/utils/add_segment_infos.js +10 -7
  468. package/dist/_esm5.processed/parsers/manifest/smooth/utils/parseBoolean.js +4 -1
  469. package/dist/_esm5.processed/parsers/manifest/smooth/utils/reduceChildren.js +6 -3
  470. package/dist/_esm5.processed/parsers/manifest/smooth/utils/tokens.js +5 -1
  471. package/dist/_esm5.processed/parsers/manifest/types.d.ts +6 -4
  472. package/dist/_esm5.processed/parsers/manifest/types.js +2 -1
  473. package/dist/_esm5.processed/parsers/manifest/utils/check_manifest_ids.js +27 -24
  474. package/dist/_esm5.processed/parsers/manifest/utils/clear_timeline_from_position.js +10 -7
  475. package/dist/_esm5.processed/parsers/manifest/utils/get_first_time_from_adaptation.js +8 -5
  476. package/dist/_esm5.processed/parsers/manifest/utils/get_last_time_from_adaptation.js +8 -5
  477. package/dist/_esm5.processed/parsers/manifest/utils/get_maximum_positions.js +15 -12
  478. package/dist/_esm5.processed/parsers/manifest/utils/get_minimum_position.js +15 -12
  479. package/dist/_esm5.processed/parsers/manifest/utils/index_helpers.js +31 -22
  480. package/dist/_esm5.processed/parsers/manifest/utils/is_segment_still_available.js +9 -6
  481. package/dist/_esm5.processed/parsers/manifest/utils/update_segment_timeline.js +38 -45
  482. package/dist/_esm5.processed/parsers/texttracks/index.js +2 -1
  483. package/dist/_esm5.processed/parsers/texttracks/sami/html.js +45 -43
  484. package/dist/_esm5.processed/parsers/texttracks/sami/native.js +41 -39
  485. package/dist/_esm5.processed/parsers/texttracks/srt/find_end_of_cue_block.js +7 -4
  486. package/dist/_esm5.processed/parsers/texttracks/srt/get_cue_blocks.js +11 -8
  487. package/dist/_esm5.processed/parsers/texttracks/srt/html.js +32 -29
  488. package/dist/_esm5.processed/parsers/texttracks/srt/native.js +16 -13
  489. package/dist/_esm5.processed/parsers/texttracks/srt/parse_cue.js +21 -18
  490. package/dist/_esm5.processed/parsers/texttracks/srt/parse_timestamp.js +10 -7
  491. package/dist/_esm5.processed/parsers/texttracks/ttml/get_parameters.js +37 -30
  492. package/dist/_esm5.processed/parsers/texttracks/ttml/get_styling.js +48 -48
  493. package/dist/_esm5.processed/parsers/texttracks/ttml/get_time_delimiters.js +14 -11
  494. package/dist/_esm5.processed/parsers/texttracks/ttml/html/apply_default_ttml_paragraph_style.js +7 -2
  495. package/dist/_esm5.processed/parsers/texttracks/ttml/html/apply_extent.js +15 -12
  496. package/dist/_esm5.processed/parsers/texttracks/ttml/html/apply_font_size.js +15 -12
  497. package/dist/_esm5.processed/parsers/texttracks/ttml/html/apply_line_height.js +11 -8
  498. package/dist/_esm5.processed/parsers/texttracks/ttml/html/apply_origin.js +15 -12
  499. package/dist/_esm5.processed/parsers/texttracks/ttml/html/apply_padding.js +25 -22
  500. package/dist/_esm5.processed/parsers/texttracks/ttml/html/create_element.js +117 -124
  501. package/dist/_esm5.processed/parsers/texttracks/ttml/html/generate_css_test_outline.js +11 -8
  502. package/dist/_esm5.processed/parsers/texttracks/ttml/html/index.js +4 -2
  503. package/dist/_esm5.processed/parsers/texttracks/ttml/html/parse_cue.js +12 -8
  504. package/dist/_esm5.processed/parsers/texttracks/ttml/html/parse_ttml_to_div.js +14 -11
  505. package/dist/_esm5.processed/parsers/texttracks/ttml/html/ttml_color_to_css_color.js +10 -7
  506. package/dist/_esm5.processed/parsers/texttracks/ttml/native/index.js +4 -2
  507. package/dist/_esm5.processed/parsers/texttracks/ttml/native/parse_cue.js +38 -35
  508. package/dist/_esm5.processed/parsers/texttracks/ttml/native/parse_ttml_to_vtt.js +11 -8
  509. package/dist/_esm5.processed/parsers/texttracks/ttml/parse_ttml.js +58 -58
  510. package/dist/_esm5.processed/parsers/texttracks/ttml/regexps.js +27 -13
  511. package/dist/_esm5.processed/parsers/texttracks/ttml/resolve_styles_inheritance.js +18 -18
  512. package/dist/_esm5.processed/parsers/texttracks/ttml/time_parsing.js +28 -26
  513. package/dist/_esm5.processed/parsers/texttracks/ttml/xml_utils.js +37 -25
  514. package/dist/_esm5.processed/parsers/texttracks/types.js +2 -1
  515. package/dist/_esm5.processed/parsers/texttracks/webvtt/get_cue_blocks.js +12 -9
  516. package/dist/_esm5.processed/parsers/texttracks/webvtt/get_style_blocks.js +14 -11
  517. package/dist/_esm5.processed/parsers/texttracks/webvtt/html/convert_payload_to_html.js +11 -8
  518. package/dist/_esm5.processed/parsers/texttracks/webvtt/html/create_default_style_elements.js +8 -5
  519. package/dist/_esm5.processed/parsers/texttracks/webvtt/html/create_style_attribute.js +60 -60
  520. package/dist/_esm5.processed/parsers/texttracks/webvtt/html/create_styled_element.js +30 -27
  521. package/dist/_esm5.processed/parsers/texttracks/webvtt/html/index.js +4 -2
  522. package/dist/_esm5.processed/parsers/texttracks/webvtt/html/parse_style_block.js +23 -26
  523. package/dist/_esm5.processed/parsers/texttracks/webvtt/html/parse_webvtt_to_div.js +20 -17
  524. package/dist/_esm5.processed/parsers/texttracks/webvtt/html/to_html.js +23 -18
  525. package/dist/_esm5.processed/parsers/texttracks/webvtt/native/index.js +4 -2
  526. package/dist/_esm5.processed/parsers/texttracks/webvtt/native/parse_vtt_to_cues.js +19 -16
  527. package/dist/_esm5.processed/parsers/texttracks/webvtt/native/set_settings_on_cue.js +20 -17
  528. package/dist/_esm5.processed/parsers/texttracks/webvtt/native/to_native_cue.js +8 -5
  529. package/dist/_esm5.processed/parsers/texttracks/webvtt/parse_cue_block.js +26 -18
  530. package/dist/_esm5.processed/parsers/texttracks/webvtt/parse_timestamp.js +10 -7
  531. package/dist/_esm5.processed/parsers/texttracks/webvtt/utils.js +15 -7
  532. package/dist/_esm5.processed/public_types.d.ts +6 -8
  533. package/dist/_esm5.processed/public_types.js +2 -1
  534. package/dist/_esm5.processed/tools/TextTrackRenderer/index.js +13 -6
  535. package/dist/_esm5.processed/tools/TextTrackRenderer/text_track_renderer.js +26 -24
  536. package/dist/_esm5.processed/tools/index.js +6 -4
  537. package/dist/_esm5.processed/tools/string_utils.js +10 -1
  538. package/dist/_esm5.processed/transports/dash/add_segment_integrity_checks_to_loader.js +16 -24
  539. package/dist/_esm5.processed/transports/dash/construct_segment_url.js +6 -3
  540. package/dist/_esm5.processed/transports/dash/extract_complete_chunks.js +17 -14
  541. package/dist/_esm5.processed/transports/dash/get_events_out_of_emsgs.js +19 -16
  542. package/dist/_esm5.processed/transports/dash/index.js +4 -2
  543. package/dist/_esm5.processed/transports/dash/init_segment_loader.js +47 -27
  544. package/dist/_esm5.processed/transports/dash/low_latency_segment_loader.js +23 -16
  545. package/dist/_esm5.processed/transports/dash/manifest_parser.js +68 -59
  546. package/dist/_esm5.processed/transports/dash/pipelines.js +20 -17
  547. package/dist/_esm5.processed/transports/dash/segment_loader.js +49 -39
  548. package/dist/_esm5.processed/transports/dash/segment_parser.js +58 -39
  549. package/dist/_esm5.processed/transports/dash/text_loader.js +36 -30
  550. package/dist/_esm5.processed/transports/dash/text_parser.js +39 -29
  551. package/dist/_esm5.processed/transports/index.js +17 -1
  552. package/dist/_esm5.processed/transports/local/index.js +4 -2
  553. package/dist/_esm5.processed/transports/local/pipelines.js +26 -22
  554. package/dist/_esm5.processed/transports/local/segment_loader.js +26 -23
  555. package/dist/_esm5.processed/transports/local/segment_parser.js +36 -25
  556. package/dist/_esm5.processed/transports/local/text_parser.js +42 -27
  557. package/dist/_esm5.processed/transports/metaplaylist/index.js +4 -2
  558. package/dist/_esm5.processed/transports/metaplaylist/manifest_loader.js +11 -7
  559. package/dist/_esm5.processed/transports/metaplaylist/pipelines.js +92 -96
  560. package/dist/_esm5.processed/transports/smooth/extract_timings_infos.js +26 -20
  561. package/dist/_esm5.processed/transports/smooth/index.js +4 -2
  562. package/dist/_esm5.processed/transports/smooth/is_mp4_embedded_track.js +4 -1
  563. package/dist/_esm5.processed/transports/smooth/isobmff/create_audio_init_segment.js +22 -19
  564. package/dist/_esm5.processed/transports/smooth/isobmff/create_boxes.js +92 -67
  565. package/dist/_esm5.processed/transports/smooth/isobmff/create_init_segment.js +29 -26
  566. package/dist/_esm5.processed/transports/smooth/isobmff/create_traf_box.js +9 -6
  567. package/dist/_esm5.processed/transports/smooth/isobmff/create_video_init_segment.js +23 -20
  568. package/dist/_esm5.processed/transports/smooth/isobmff/get_aaces_header.js +10 -7
  569. package/dist/_esm5.processed/transports/smooth/isobmff/index.js +13 -6
  570. package/dist/_esm5.processed/transports/smooth/isobmff/parse_tfrf.js +19 -16
  571. package/dist/_esm5.processed/transports/smooth/isobmff/parse_tfxd.js +9 -6
  572. package/dist/_esm5.processed/transports/smooth/isobmff/patch_segment.js +41 -38
  573. package/dist/_esm5.processed/transports/smooth/pipelines.js +107 -96
  574. package/dist/_esm5.processed/transports/smooth/segment_loader.js +149 -153
  575. package/dist/_esm5.processed/transports/smooth/utils.js +7 -3
  576. package/dist/_esm5.processed/transports/types.d.ts +17 -8
  577. package/dist/_esm5.processed/transports/types.js +2 -1
  578. package/dist/_esm5.processed/transports/utils/byte_range.js +6 -4
  579. package/dist/_esm5.processed/transports/utils/call_custom_manifest_loader.js +23 -17
  580. package/dist/_esm5.processed/transports/utils/check_isobmff_integrity.js +14 -11
  581. package/dist/_esm5.processed/transports/utils/find_complete_box.js +11 -8
  582. package/dist/_esm5.processed/transports/utils/generate_manifest_loader.js +22 -14
  583. package/dist/_esm5.processed/transports/utils/get_isobmff_timing_infos.d.ts +0 -3
  584. package/dist/_esm5.processed/transports/utils/get_isobmff_timing_infos.js +13 -13
  585. package/dist/_esm5.processed/transports/utils/infer_segment_container.js +4 -1
  586. package/dist/_esm5.processed/transports/utils/parse_text_track.js +40 -26
  587. package/dist/_esm5.processed/utils/are_arrays_of_numbers_equal.js +8 -2
  588. package/dist/_esm5.processed/utils/are_codecs_compatible.js +11 -9
  589. package/dist/_esm5.processed/utils/array_find.js +7 -4
  590. package/dist/_esm5.processed/utils/array_find_index.js +6 -3
  591. package/dist/_esm5.processed/utils/array_includes.js +12 -11
  592. package/dist/_esm5.processed/utils/assert.js +15 -10
  593. package/dist/_esm5.processed/utils/assert_unreachable.js +6 -3
  594. package/dist/_esm5.processed/utils/base64.js +23 -18
  595. package/dist/_esm5.processed/utils/byte_parsing.js +30 -17
  596. package/dist/_esm5.processed/utils/cancellable_sleep.js +8 -5
  597. package/dist/_esm5.processed/utils/create_cancellable_promise.js +7 -4
  598. package/dist/_esm5.processed/utils/deep_merge.d.ts +2 -5
  599. package/dist/_esm5.processed/utils/deep_merge.js +10 -21
  600. package/dist/_esm5.processed/utils/event_emitter.js +24 -24
  601. package/dist/_esm5.processed/utils/flat_map.js +7 -4
  602. package/dist/_esm5.processed/utils/get_fuzzed_delay.js +6 -3
  603. package/dist/_esm5.processed/utils/hash_buffer.js +7 -4
  604. package/dist/_esm5.processed/utils/id_generator.js +6 -3
  605. package/dist/_esm5.processed/utils/initialization_segment_cache.js +11 -12
  606. package/dist/_esm5.processed/utils/is_non_empty_string.js +4 -1
  607. package/dist/_esm5.processed/utils/is_null_or_undefined.js +4 -1
  608. package/dist/_esm5.processed/utils/languages/ISO_639-1_to_ISO_639-3.js +4 -2
  609. package/dist/_esm5.processed/utils/languages/ISO_639-2_to_ISO_639-3.js +4 -2
  610. package/dist/_esm5.processed/utils/languages/index.js +7 -3
  611. package/dist/_esm5.processed/utils/languages/normalize.js +26 -20
  612. package/dist/_esm5.processed/utils/logger.js +24 -23
  613. package/dist/_esm5.processed/utils/monotonic_timestamp.d.ts +9 -0
  614. package/dist/_esm5.processed/utils/monotonic_timestamp.js +15 -0
  615. package/dist/_esm5.processed/utils/noop.js +4 -1
  616. package/dist/_esm5.processed/utils/object_assign.js +8 -10
  617. package/dist/_esm5.processed/utils/object_values.js +6 -3
  618. package/dist/_esm5.processed/utils/ranges.d.ts +50 -8
  619. package/dist/_esm5.processed/utils/ranges.js +163 -64
  620. package/dist/_esm5.processed/utils/reference.d.ts +78 -37
  621. package/dist/_esm5.processed/utils/reference.js +235 -155
  622. package/dist/_esm5.processed/utils/request/fetch.d.ts +4 -4
  623. package/dist/_esm5.processed/utils/request/fetch.js +79 -107
  624. package/dist/_esm5.processed/utils/request/index.js +9 -4
  625. package/dist/_esm5.processed/utils/request/xhr.js +49 -36
  626. package/dist/_esm5.processed/utils/resolve_url.js +18 -18
  627. package/dist/_esm5.processed/utils/retry_promise_with_backoff.js +34 -81
  628. package/dist/_esm5.processed/utils/sleep.js +5 -2
  629. package/dist/_esm5.processed/utils/slice_uint8array.js +3 -1
  630. package/dist/_esm5.processed/utils/sorted_list.js +37 -40
  631. package/dist/_esm5.processed/utils/starts_with.js +5 -2
  632. package/dist/_esm5.processed/utils/string_parsing.js +84 -72
  633. package/dist/_esm5.processed/utils/take_first_set.js +9 -10
  634. package/dist/_esm5.processed/utils/task_canceller.js +51 -71
  635. package/dist/_esm5.processed/utils/warn_once.js +7 -4
  636. package/dist/_esm5.processed/utils/weak_map_memory.js +12 -11
  637. package/dist/_esm5.processed/utils/wrapInPromise.d.ts +7 -0
  638. package/dist/_esm5.processed/utils/wrapInPromise.js +25 -0
  639. package/dist/mpd-parser.wasm +0 -0
  640. package/dist/rx-player.js +42885 -44008
  641. package/dist/rx-player.min.js +1 -1
  642. package/jest.config.js +1 -22
  643. package/package.json +56 -57
  644. package/scripts/build/constants.d.ts +1 -23
  645. package/scripts/build/generate_build.js +1 -1
  646. package/scripts/check_nodejs_import_compatibility.js +1 -1
  647. package/scripts/list-npm-scripts.js +146 -38
  648. package/scripts/update-version +1 -4
  649. package/sonar-project.properties +1 -1
  650. package/src/compat/__tests__/browser_compatibility_types.test.ts +51 -72
  651. package/src/compat/__tests__/is_vtt_cue.test.ts +20 -16
  652. package/src/compat/__tests__/make_vtt_cue.test.ts +11 -9
  653. package/src/compat/__tests__/patch_webkit_source_buffer.test.ts +26 -25
  654. package/src/compat/__tests__/should_favour_custom_safari_EME.test.ts +11 -9
  655. package/src/compat/__tests__/should_wait_for_have_enough_data.test.ts +36 -0
  656. package/src/compat/browser_compatibility_types.ts +9 -16
  657. package/src/compat/browser_detection.ts +11 -8
  658. package/src/compat/eme/custom_media_keys/ie11_media_keys.ts +11 -8
  659. package/src/compat/eme/custom_media_keys/index.ts +8 -184
  660. package/src/compat/eme/custom_media_keys/moz_media_keys_constructor.ts +26 -22
  661. package/src/compat/eme/custom_media_keys/ms_media_keys_constructor.ts +13 -15
  662. package/src/compat/eme/custom_media_keys/old_webkit_media_keys.ts +11 -8
  663. package/src/compat/eme/custom_media_keys/types.ts +1 -1
  664. package/src/compat/eme/custom_media_keys/webkit_media_keys.ts +15 -11
  665. package/src/compat/eme/custom_media_keys/webkit_media_keys_constructor.ts +14 -16
  666. package/src/compat/eme/eme-api-implementation.ts +319 -0
  667. package/src/compat/eme/index.ts +8 -6
  668. package/src/compat/event_listeners.ts +32 -39
  669. package/src/compat/global_scope.ts +18 -0
  670. package/src/compat/index.ts +2 -24
  671. package/src/compat/is_debug_mode_enabled.ts +12 -0
  672. package/src/compat/is_node.ts +4 -1
  673. package/src/compat/is_vtt_cue.ts +2 -1
  674. package/src/compat/is_worker.ts +9 -0
  675. package/src/compat/make_vtt_cue.ts +3 -2
  676. package/src/compat/on_height_width_change.ts +4 -9
  677. package/src/compat/patch_webkit_source_buffer.ts +4 -3
  678. package/src/compat/should_wait_for_have_enough_data.ts +17 -0
  679. package/src/core/adaptive/__tests__/buffer_based_chooser.test.ts +245 -102
  680. package/src/core/adaptive/adaptive_representation_selector.ts +52 -35
  681. package/src/core/adaptive/buffer_based_chooser.ts +41 -13
  682. package/src/core/adaptive/guess_based_chooser.ts +4 -3
  683. package/src/core/adaptive/network_analyzer.ts +8 -6
  684. package/src/core/adaptive/utils/pending_requests_store.ts +15 -5
  685. package/src/core/api/debug/buffer_size_graph.ts +3 -1
  686. package/src/core/api/option_utils.ts +2 -2
  687. package/src/core/api/playback_observer.ts +16 -9
  688. package/src/core/api/public_api.ts +47 -31
  689. package/src/core/api/track_management/track_dispatcher.ts +9 -6
  690. package/src/core/api/track_management/tracks_store.ts +112 -90
  691. package/src/core/api/utils.ts +3 -3
  692. package/src/core/decrypt/__tests__/__global__/get_license.test.ts +3 -3
  693. package/src/core/decrypt/__tests__/__global__/init_data.test.ts +24 -14
  694. package/src/core/decrypt/__tests__/__global__/media_key_system_access.test.ts +74 -48
  695. package/src/core/decrypt/__tests__/__global__/media_keys.test.ts +21 -15
  696. package/src/core/decrypt/__tests__/__global__/server_certificate.test.ts +16 -13
  697. package/src/core/decrypt/__tests__/__global__/utils.ts +39 -24
  698. package/src/core/decrypt/attach_media_keys.ts +33 -8
  699. package/src/core/decrypt/clear_on_stop.ts +1 -1
  700. package/src/core/decrypt/content_decryptor.ts +213 -262
  701. package/src/core/decrypt/create_or_load_session.ts +1 -1
  702. package/src/core/decrypt/create_session.ts +1 -1
  703. package/src/core/decrypt/dispose_decryption_resources.ts +19 -4
  704. package/src/core/decrypt/find_key_system.ts +24 -19
  705. package/src/core/decrypt/get_media_keys.ts +2 -2
  706. package/src/core/decrypt/index.ts +1 -6
  707. package/src/core/decrypt/session_events_listener.ts +3 -4
  708. package/src/core/decrypt/set_server_certificate.ts +1 -1
  709. package/src/core/decrypt/types.ts +69 -0
  710. package/src/core/decrypt/utils/check_key_statuses.ts +1 -1
  711. package/src/core/decrypt/utils/is_session_usable.ts +1 -1
  712. package/src/core/decrypt/utils/key_id_comparison.ts +2 -27
  713. package/src/core/decrypt/utils/key_session_record.ts +3 -5
  714. package/src/core/decrypt/utils/loaded_sessions_store.ts +2 -2
  715. package/src/core/decrypt/utils/media_keys_infos_store.ts +4 -1
  716. package/src/core/decrypt/utils/persistent_sessions_store.ts +2 -5
  717. package/src/core/decrypt/utils/server_certificate_store.ts +1 -1
  718. package/src/core/fetchers/cdn_prioritizer.ts +1 -1
  719. package/src/core/fetchers/manifest/manifest_fetcher.ts +22 -18
  720. package/src/core/fetchers/segment/segment_fetcher.ts +3 -2
  721. package/src/core/fetchers/utils/schedule_request.ts +6 -5
  722. package/src/core/init/directfile_content_initializer.ts +85 -21
  723. package/src/core/init/index.ts +6 -7
  724. package/src/core/init/media_source_content_initializer.ts +56 -26
  725. package/src/core/init/types.ts +2 -16
  726. package/src/core/init/utils/__tests__/refresh_scheduled_events_list.test.ts +22 -8
  727. package/src/core/init/utils/create_media_source.ts +4 -1
  728. package/src/core/init/utils/create_stream_playback_observer.ts +24 -14
  729. package/src/core/init/utils/end_of_stream.ts +1 -0
  730. package/src/core/init/utils/get_initial_time.ts +3 -1
  731. package/src/core/init/utils/get_loaded_reference.ts +6 -3
  732. package/src/core/init/utils/initial_seek_and_play.ts +7 -7
  733. package/src/core/init/utils/initialize_content_decryption.ts +32 -39
  734. package/src/core/init/utils/media_source_duration_updater.ts +13 -9
  735. package/src/core/init/utils/rebuffering_controller.ts +13 -10
  736. package/src/core/init/utils/stream_events_emitter/refresh_scheduled_events_list.ts +7 -4
  737. package/src/core/init/utils/stream_events_emitter/stream_events_emitter.ts +113 -73
  738. package/src/core/segment_buffers/garbage_collector.ts +3 -3
  739. package/src/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.ts +10 -2
  740. package/src/core/segment_buffers/implementations/text/html/html_text_segment_buffer.ts +17 -17
  741. package/src/core/segment_buffers/implementations/text/html/text_track_cues_store.ts +1 -1
  742. package/src/core/segment_buffers/implementations/text/native/native_text_segment_buffer.ts +2 -2
  743. package/src/core/segment_buffers/implementations/utils/manual_time_ranges.ts +2 -2
  744. package/src/core/segment_buffers/inventory/buffered_history.ts +4 -3
  745. package/src/core/segment_buffers/inventory/segment_inventory.ts +1 -0
  746. package/src/core/stream/adaptation/adaptation_stream.ts +43 -28
  747. package/src/core/stream/adaptation/types.ts +15 -9
  748. package/src/core/stream/index.ts +2 -0
  749. package/src/core/stream/orchestrator/get_time_ranges_for_content.ts +1 -6
  750. package/src/core/stream/orchestrator/index.ts +2 -0
  751. package/src/core/stream/orchestrator/stream_orchestrator.ts +38 -42
  752. package/src/core/stream/period/period_stream.ts +62 -23
  753. package/src/core/stream/period/types.ts +5 -3
  754. package/src/core/stream/period/utils/get_adaptation_switch_strategy.ts +10 -0
  755. package/src/core/stream/representation/representation_stream.ts +6 -3
  756. package/src/core/stream/representation/types.ts +5 -5
  757. package/src/core/stream/representation/utils/append_segment_to_buffer.ts +2 -2
  758. package/src/core/stream/representation/utils/downloading_queue.ts +4 -5
  759. package/src/core/stream/representation/utils/force_garbage_collection.ts +3 -3
  760. package/src/core/stream/representation/utils/get_buffer_status.ts +2 -1
  761. package/src/core/stream/representation/utils/push_init_segment.ts +2 -3
  762. package/src/core/stream/representation/utils/push_media_segment.ts +2 -2
  763. package/src/errors/__tests__/encrypted_media_error.test.ts +2 -2
  764. package/src/errors/__tests__/error_message.test.ts +1 -1
  765. package/src/errors/__tests__/format_error.test.ts +2 -2
  766. package/src/errors/__tests__/media_error.test.ts +3 -3
  767. package/src/errors/__tests__/network_error.test.ts +10 -9
  768. package/src/errors/__tests__/other_error.test.ts +3 -3
  769. package/src/errors/__tests__/request_error.test.ts +4 -4
  770. package/src/errors/custom_loader_error.ts +0 -1
  771. package/src/errors/encrypted_media_error.ts +4 -2
  772. package/src/errors/error_message.ts +2 -7
  773. package/src/errors/media_error.ts +26 -20
  774. package/src/errors/network_error.ts +1 -1
  775. package/src/errors/other_error.ts +1 -1
  776. package/src/errors/request_error.ts +16 -1
  777. package/src/experimental/features/__tests__/dash_wasm.test.ts +4 -12
  778. package/src/experimental/features/__tests__/debug_element.test.ts +7 -21
  779. package/src/experimental/features/__tests__/local.test.ts +14 -23
  780. package/src/experimental/features/__tests__/metaplaylist.test.ts +14 -21
  781. package/src/experimental/features/dash_wasm.ts +3 -0
  782. package/src/experimental/features/index.ts +0 -1
  783. package/src/experimental/features/local.ts +3 -0
  784. package/src/experimental/features/metaplaylist.ts +3 -0
  785. package/src/experimental/tools/mediaCapabilitiesProber/__tests__/probers/DRMInfos.test.ts +10 -9
  786. package/src/experimental/tools/mediaCapabilitiesProber/__tests__/probers/HDCPPolicy.test.ts +26 -18
  787. package/src/experimental/tools/mediaCapabilitiesProber/__tests__/probers/mediaDisplayInfos.test.ts +24 -23
  788. package/src/experimental/tools/mediaCapabilitiesProber/api/index.ts +2 -4
  789. package/src/experimental/tools/mediaCapabilitiesProber/api/probeMediaConfiguration.ts +7 -4
  790. package/src/experimental/tools/mediaCapabilitiesProber/probers/DRMInfos.ts +5 -4
  791. package/src/experimental/tools/mediaCapabilitiesProber/probers/HDCPPolicy.ts +4 -3
  792. package/src/experimental/tools/mediaCapabilitiesProber/probers/mediaContentTypeWithFeatures/index.ts +4 -3
  793. package/src/experimental/tools/mediaCapabilitiesProber/probers/mediaDisplayInfos.ts +3 -2
  794. package/src/features/features_object.ts +2 -1
  795. package/src/features/list/__tests__/dash.test.ts +15 -15
  796. package/src/features/list/__tests__/directfile.test.ts +4 -13
  797. package/src/features/list/__tests__/eme.test.ts +4 -12
  798. package/src/features/list/__tests__/html_sami_parser.test.ts +9 -14
  799. package/src/features/list/__tests__/html_srt_parser.test.ts +5 -10
  800. package/src/features/list/__tests__/html_text_buffer.test.ts +10 -19
  801. package/src/features/list/__tests__/html_ttml_parser.test.ts +5 -10
  802. package/src/features/list/__tests__/html_vtt_parser.test.ts +5 -10
  803. package/src/features/list/__tests__/native_sami_parser.test.ts +9 -14
  804. package/src/features/list/__tests__/native_srt_parser.test.ts +5 -10
  805. package/src/features/list/__tests__/native_text_buffer.test.ts +5 -13
  806. package/src/features/list/__tests__/native_ttml_parser.test.ts +5 -10
  807. package/src/features/list/__tests__/native_vtt_parser.test.ts +5 -10
  808. package/src/features/list/__tests__/smooth.test.ts +10 -10
  809. package/src/features/list/dash.ts +3 -0
  810. package/src/features/list/eme.ts +1 -1
  811. package/src/features/list/html_sami_parser.ts +2 -0
  812. package/src/features/list/html_srt_parser.ts +2 -0
  813. package/src/features/list/html_text_buffer.ts +2 -2
  814. package/src/features/list/html_ttml_parser.ts +2 -0
  815. package/src/features/list/html_vtt_parser.ts +2 -0
  816. package/src/features/list/native_sami_parser.ts +3 -0
  817. package/src/features/list/native_srt_parser.ts +3 -0
  818. package/src/features/list/native_text_buffer.ts +3 -2
  819. package/src/features/list/native_ttml_parser.ts +3 -0
  820. package/src/features/list/native_vtt_parser.ts +3 -0
  821. package/src/features/list/smooth.ts +3 -0
  822. package/src/features/types.ts +89 -18
  823. package/src/index.ts +31 -5
  824. package/src/manifest/__tests__/manifest.test.ts +134 -75
  825. package/src/manifest/__tests__/period.test.ts +82 -55
  826. package/src/manifest/__tests__/update_periods.test.ts +4 -4
  827. package/src/manifest/manifest.ts +30 -20
  828. package/src/manifest/period.ts +3 -14
  829. package/src/manifest/representation.ts +21 -3
  830. package/src/minimal.ts +4 -18
  831. package/src/parsers/manifest/dash/common/__tests__/get_clock_offset.test.ts +2 -1
  832. package/src/parsers/manifest/dash/common/get_clock_offset.ts +5 -4
  833. package/src/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.ts +7 -4
  834. package/src/parsers/manifest/dash/common/manifest_bounds_calculator.ts +11 -5
  835. package/src/parsers/manifest/dash/common/parse_adaptation_sets.ts +1 -0
  836. package/src/parsers/manifest/dash/common/parse_mpd.ts +9 -5
  837. package/src/parsers/manifest/dash/common/parse_periods.ts +12 -6
  838. package/src/parsers/manifest/dash/common/parse_representation_index.ts +2 -2
  839. package/src/parsers/manifest/dash/common/parse_representations.ts +10 -0
  840. package/src/parsers/manifest/dash/js-parser/node_parsers/Representation.ts +7 -0
  841. package/src/parsers/manifest/dash/node_parser_types.ts +1 -0
  842. package/src/parsers/manifest/dash/parsers_types.ts +4 -4
  843. package/src/parsers/manifest/dash/wasm-parser/Cargo.lock +2 -2
  844. package/src/parsers/manifest/dash/wasm-parser/Cargo.toml +1 -1
  845. package/src/parsers/manifest/dash/wasm-parser/rs/errors.rs +3 -3
  846. package/src/parsers/manifest/dash/wasm-parser/rs/events.rs +37 -67
  847. package/src/parsers/manifest/dash/wasm-parser/rs/lib.rs +7 -7
  848. package/src/parsers/manifest/dash/wasm-parser/rs/processor/attributes.rs +94 -105
  849. package/src/parsers/manifest/dash/wasm-parser/rs/processor/mod.rs +119 -109
  850. package/src/parsers/manifest/dash/wasm-parser/rs/processor/s_element.rs +24 -26
  851. package/src/parsers/manifest/dash/wasm-parser/rs/reader.rs +2 -2
  852. package/src/parsers/manifest/dash/wasm-parser/rs/reportable.rs +42 -18
  853. package/src/parsers/manifest/dash/wasm-parser/rs/utils.rs +29 -29
  854. package/src/parsers/manifest/dash/wasm-parser/ts/dash-wasm-parser.ts +2 -1
  855. package/src/parsers/manifest/dash/wasm-parser/ts/generators/BaseURL.ts +1 -1
  856. package/src/parsers/manifest/dash/wasm-parser/ts/generators/Representation.ts +12 -0
  857. package/src/parsers/manifest/local/parse_local_manifest.ts +3 -1
  858. package/src/parsers/manifest/local/types.ts +2 -0
  859. package/src/parsers/manifest/metaplaylist/metaplaylist_parser.ts +3 -1
  860. package/src/parsers/manifest/smooth/create_parser.ts +4 -3
  861. package/src/parsers/manifest/smooth/representation_index.ts +6 -5
  862. package/src/parsers/manifest/smooth/shared_smooth_segment_timeline.ts +6 -5
  863. package/src/parsers/manifest/types.ts +6 -4
  864. package/src/parsers/manifest/utils/__tests__/update_segment_timeline.test.ts +1 -2
  865. package/src/parsers/texttracks/ttml/html/__tests__/__global__/html_ttml_parser.test.test.ts +2 -1
  866. package/src/parsers/texttracks/webvtt/html/__tests__/convert_payload_to_html.test.ts +9 -7
  867. package/src/public_types.ts +11 -9
  868. package/src/transports/dash/manifest_parser.ts +8 -5
  869. package/src/transports/local/pipelines.ts +4 -3
  870. package/src/transports/metaplaylist/pipelines.ts +5 -3
  871. package/src/transports/smooth/pipelines.ts +4 -2
  872. package/src/transports/smooth/segment_loader.ts +1 -1
  873. package/src/transports/types.ts +17 -7
  874. package/src/transports/utils/__tests__/check_isobmff_integrity.test.ts +8 -8
  875. package/src/transports/utils/call_custom_manifest_loader.ts +2 -1
  876. package/src/transports/utils/get_isobmff_timing_infos.ts +0 -3
  877. package/src/typings/globals.d.ts +0 -44
  878. package/src/utils/__tests__/base64.test.ts +4 -2
  879. package/src/utils/__tests__/id_generator.test.ts +7 -4
  880. package/src/utils/__tests__/ranges.test.ts +354 -47
  881. package/src/utils/are_arrays_of_numbers_equal.ts +5 -1
  882. package/src/utils/assert.ts +4 -1
  883. package/src/utils/deep_merge.ts +2 -2
  884. package/src/utils/monotonic_timestamp.ts +12 -0
  885. package/src/utils/ranges.ts +110 -14
  886. package/src/utils/reference.ts +235 -237
  887. package/src/utils/request/fetch.ts +11 -9
  888. package/src/utils/request/xhr.ts +6 -5
  889. package/src/utils/string_parsing.ts +5 -4
  890. package/src/utils/wrapInPromise.ts +24 -0
  891. package/tsconfig.json +1 -1
  892. package/tsconfig.modules.json +3 -3
  893. package/appveyor.yml +0 -24
  894. package/dist/_esm5.processed/compat/has_eme_apis.d.ts +0 -21
  895. package/dist/_esm5.processed/compat/has_eme_apis.js +0 -24
  896. package/dist/_esm5.processed/core/stream/adaptation/utils/create_representation_estimator.d.ts +0 -47
  897. package/dist/_esm5.processed/core/stream/adaptation/utils/create_representation_estimator.js +0 -70
  898. package/dist/_esm5.processed/core/stream/utils/create_reload_request.d.ts +0 -32
  899. package/dist/_esm5.processed/core/stream/utils/create_reload_request.js +0 -54
  900. package/dist/_esm5.processed/features/initialize_features.d.ts +0 -19
  901. package/dist/_esm5.processed/features/initialize_features.js +0 -100
  902. package/dist/rx-player.d.ts +0 -3
  903. package/dist/rx-player.min.d.ts +0 -3
  904. package/src/compat/__tests__/has_eme_apis.test.ts +0 -56
  905. package/src/compat/has_eme_apis.ts +0 -26
  906. package/src/core/stream/adaptation/utils/create_representation_estimator.ts +0 -114
  907. package/src/core/stream/utils/create_reload_request.ts +0 -69
  908. package/src/features/__tests__/initialize_features.test.ts +0 -477
  909. package/src/features/initialize_features.ts +0 -120
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see rx-player.min.js.LICENSE.txt */
2
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.RxPlayer=t():e.RxPlayer=t()}(self,(function(){return function(){var e={3774:function(e,t,n){"use strict";n.d(t,{J:function(){return a},c:function(){return o}});var r=n(1946),i=n(2203).Z?void 0:window,a=void 0===i?void 0:(0,r.Z)(i.MediaSource)?(0,r.Z)(i.MozMediaSource)?(0,r.Z)(i.WebKitMediaSource)?i.MSMediaSource:i.WebKitMediaSource:i.MozMediaSource:i.MediaSource,o={HAVE_NOTHING:0,HAVE_METADATA:1,HAVE_CURRENT_DATA:2,HAVE_FUTURE_DATA:3,HAVE_ENOUGH_DATA:4}},3666:function(e,t,n){"use strict";n.d(t,{$u:function(){return p},SB:function(){return c},YM:function(){return u},fq:function(){return s},kD:function(){return o},lV:function(){return m},l_:function(){return h},op:function(){return f},vS:function(){return d},vU:function(){return l},yS:function(){return v}});var r,i,a=n(2203),o=!1,s=!1,u=!1,l=!1,d=!1,c=!1,f=!1,v=!1,p=!1,h=!1,m=!1;a.Z||(void 0!==window.MSInputMethodContext&&void 0!==document.documentMode?(s=!0,u=!0):"Microsoft Internet Explorer"===navigator.appName||"Netscape"===navigator.appName&&/(Trident|Edge)\//.test(navigator.userAgent)?u=!0:-1!==navigator.userAgent.toLowerCase().indexOf("edg/")?o=!0:-1!==navigator.userAgent.toLowerCase().indexOf("firefox")?l=!0:"string"==typeof navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)?c=!0:(Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor")>=0||"[object SafariRemoteNotification]"===(null===(i=null===(r=window.safari)||void 0===r?void 0:r.pushNotification)||void 0===i?void 0:i.toString()))&&(d=!0),/SamsungBrowser/.test(navigator.userAgent)&&(f=!0),-1!==navigator.userAgent.indexOf("PlayStation 5")?m=!0:/Tizen/.test(navigator.userAgent)?v=!0:/[Ww]eb[O0]S/.test(navigator.userAgent)?(p=!0,/[Ww]eb[O0]S.TV-2022/.test(navigator.userAgent)||/[Cc]hr[o0]me\/87/.test(navigator.userAgent)||(/[Ww]eb[O0]S.TV-2021/.test(navigator.userAgent)||/[Cc]hr[o0]me\/79/.test(navigator.userAgent))):/[Pp]anasonic/.test(navigator.userAgent)&&(h=!0))},5767:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(3887),i=n(1946);function a(e){var t=e.textTracks;if(!(0,i.Z)(t)){for(var n=0;n<t.length;n++)t[n].mode="disabled";if(e.hasChildNodes())for(var a=e.childNodes,o=a.length-1;o>=0;o--)if("track"===a[o].nodeName)try{e.removeChild(a[o])}catch(e){r.Z.warn("Compat: Could not remove text track child from element.")}}e.src="",e.removeAttribute("src")}},6139:function(e,t,n){"use strict";n.d(t,{N:function(){return P},Y:function(){return M}});var r,i=n(3714),a=n(811),o=n(3666),s=n(2203),u=n(5059),l=n(1656),d=function(){function e(e,t,n){this._keyType=e,this._mediaKeys=t,this._configuration=n}var t=e.prototype;return t.createMediaKeys=function(){var e=this;return new Promise((function(t){return t(e._mediaKeys)}))},t.getConfiguration=function(){return this._configuration},(0,l.Z)(e,[{key:"keySystem",get:function(){return this._keyType}}]),e}();if(!s.Z){var c=window.MSMediaKeys;void 0!==c&&void 0!==c.prototype&&"function"==typeof c.isTypeSupported&&"function"==typeof c.prototype.createSession&&(r=c)}var f,v=n(4578),p=n(1959),h=n(288),m=n(3038),g=function(e){function t(t){var n;return(n=e.call(this)||this).expiration=NaN,n.keyStatuses=new Map,n._mk=t,n._sessionClosingCanceller=new h.ZP,n.closed=new Promise((function(e){n._sessionClosingCanceller.signal.register((function(){return e()}))})),n.update=function(e){return new Promise((function(t,r){if(void 0===n._ss)return r("MediaKeySession not set.");try{t(n._ss.update(e,""))}catch(e){r(e)}}))},n}(0,v.Z)(t,e);var n=t.prototype;return n.generateRequest=function(e,t){var n=this;return new Promise((function(e){var r=t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer);n._ss=n._mk.createSession("video/mp4",r),m.RV(n._ss,(function(e){var t;n.trigger(null!==(t=e.type)&&void 0!==t?t:"message",e)}),n._sessionClosingCanceller.signal),m.kk(n._ss,(function(e){var t;n.trigger(null!==(t=e.type)&&void 0!==t?t:"keyadded",e)}),n._sessionClosingCanceller.signal),m.Dl(n._ss,(function(e){var t;n.trigger(null!==(t=e.type)&&void 0!==t?t:"keyerror",e)}),n._sessionClosingCanceller.signal),e()}))},n.close=function(){var e=this;return new Promise((function(t){null!=e._ss&&(e._ss.close(),e._ss=void 0),e._sessionClosingCanceller.cancel(),t()}))},n.load=function(){return Promise.resolve(!1)},n.remove=function(){return Promise.resolve()},(0,l.Z)(t,[{key:"sessionId",get:function(){var e,t;return null!==(t=null===(e=this._ss)||void 0===e?void 0:e.sessionId)&&void 0!==t?t:""}}]),t}(p.Z),y=function(){function e(e){if(void 0===r)throw new Error("No MSMediaKeys API.");this._mediaKeys=new r(e)}var t=e.prototype;return t._setVideo=function(e){if(this._videoElement=e,void 0!==this._videoElement.msSetMediaKeys)return this._videoElement.msSetMediaKeys(this._mediaKeys)},t.createSession=function(){if(void 0===this._videoElement||void 0===this._mediaKeys)throw new Error("Video not attached to the MediaKeys");return new g(this._mediaKeys)},t.setServerCertificate=function(){throw new Error("Server certificate is not implemented in your browser")},e}();if(!s.Z){var _=window.MozMediaKeys;void 0!==_&&void 0!==_.prototype&&"function"==typeof _.isTypeSupported&&"function"==typeof _.prototype.createSession&&(f=_)}var b=n(9689),S=n(8894),E=n(3635);function T(e){return"function"==typeof e.webkitGenerateKeyRequest}var k=function(e){function t(t,n){var r;(r=e.call(this)||this)._vid=t,r._key=n,r.sessionId="",r._closeSession=S.Z,r.keyStatuses=new Map,r.expiration=NaN;var i=function(e){r.trigger(e.type,e)};return r.closed=new Promise((function(e){r._closeSession=function(){["keymessage","message","keyadded","ready","keyerror","error"].forEach((function(e){t.removeEventListener(e,i),t.removeEventListener("webkit"+e,i)})),e()}})),["keymessage","message","keyadded","ready","keyerror","error"].forEach((function(e){t.addEventListener(e,i),t.addEventListener("webkit"+e,i)})),r}(0,v.Z)(t,e);var n=t.prototype;return n.update=function(e){var t=this;return new Promise((function(n,r){try{if(t._key.indexOf("clearkey")>=0){var i=e instanceof ArrayBuffer?new Uint8Array(e):e,a=JSON.parse((0,E.uR)(i)),o=(0,b.K)(a.keys[0].k),s=(0,b.K)(a.keys[0].kid);n(t._vid.webkitAddKey(t._key,o,s,""))}else n(t._vid.webkitAddKey(t._key,e,null,""))}catch(e){r(e)}}))},n.generateRequest=function(e,t){var n=this;return new Promise((function(e){n._vid.webkitGenerateKeyRequest(n._key,t),e()}))},n.close=function(){var e=this;return new Promise((function(t){e._closeSession(),t()}))},n.load=function(){return Promise.resolve(!1)},n.remove=function(){return Promise.resolve()},t}(p.Z),w=function(){function e(e){this._keySystem=e}var t=e.prototype;return t._setVideo=function(e){if(!T(e))throw new Error("Video not attached to the MediaKeys");this._videoElement=e},t.createSession=function(){if(null==this._videoElement)throw new Error("Video not attached to the MediaKeys");return new k(this._videoElement,this._keySystem)},t.setServerCertificate=function(){throw new Error("Server certificate is not implemented in your browser")},e}();var A=n(6968);var I=n(158);function R(e,t){var n=e;if(void 0===n.webkitSetMediaKeys)throw new Error("No webKitMediaKeys API.");return n.webkitSetMediaKeys(t)}var Z=function(e){function t(t,n,r){var i;return(i=e.call(this)||this)._serverCertificate=r,i._videoElement=t,i._keyType=n,i._unbindSession=S.Z,i._closeSession=S.Z,i.closed=new Promise((function(e){i._closeSession=e})),i.keyStatuses=new Map,i.expiration=NaN,i}(0,v.Z)(t,e);var n=t.prototype;return n.update=function(e){var t=this;return new Promise((function(n,r){if(void 0===t._nativeSession||void 0===t._nativeSession.update||"function"!=typeof t._nativeSession.update)return r("Unavailable WebKit key session.");try{var i;i=e instanceof ArrayBuffer?new Uint8Array(e):e instanceof Uint8Array?e:new Uint8Array(e.buffer),n(t._nativeSession.update(i))}catch(e){r(e)}}))},n.generateRequest=function(e,t){var n=this;return new Promise((function(e){var r,i,a,o=n._videoElement;if(void 0===(null===(r=o.webkitKeys)||void 0===r?void 0:r.createSession))throw new Error("No WebKitMediaKeys API.");if("com.apple.fps.1_0"===(a=n._keyType)||"com.apple.fps.2_0"===a){if(void 0===n._serverCertificate)throw new Error("A server certificate is needed for creating fairplay session.");i=function(e,t){var n=e instanceof Uint8Array?e:new Uint8Array(e),r=t instanceof Uint8Array?t:new Uint8Array(t);if((0,A.dN)(n,0)+4!==n.length)throw new Error("Unsupported WebKit initData.");var i=(0,E.wV)(n),a=i.indexOf("skd://"),o=a>-1?i.substring(a+6):i,s=(0,E.TZ)(o),u=0,l=new Uint8Array(n.byteLength+4+s.byteLength+4+r.byteLength);return l.set(n),u+=n.length,l.set((0,A.O_)(s.byteLength),u),u+=4,l.set(s,u),u+=s.byteLength,l.set((0,A.O_)(r.byteLength),u),u+=4,l.set(r,u),l}(t,n._serverCertificate)}else i=t;var s=o.webkitKeys.createSession("video/mp4",i);if(null==s)throw new Error("Impossible to get the key sessions");n._listenEvent(s),n._nativeSession=s,e()}))},n.close=function(){var e=this;return new Promise((function(t,n){e._unbindSession(),e._closeSession(),void 0!==e._nativeSession?(e._nativeSession.close(),t()):n("No session to close.")}))},n.load=function(){return Promise.resolve(!1)},n.remove=function(){return Promise.resolve()},n._listenEvent=function(e){var t=this;this._unbindSession();var n=function(e){t.trigger(e.type,e)};["keymessage","message","keyadded","ready","keyerror","error"].forEach((function(t){e.addEventListener(t,n),e.addEventListener("webkit"+t,n)})),this._unbindSession=function(){["keymessage","message","keyadded","ready","keyerror","error"].forEach((function(t){e.removeEventListener(t,n),e.removeEventListener("webkit"+t,n)}))}},(0,l.Z)(t,[{key:"sessionId",get:function(){var e,t;return null!==(t=null===(e=this._nativeSession)||void 0===e?void 0:e.sessionId)&&void 0!==t?t:""}}]),t}(p.Z),x=function(){function e(e){if(void 0===I.t)throw new Error("No WebKitMediaKeys API.");this._keyType=e,this._mediaKeys=new I.t(e)}var t=e.prototype;return t._setVideo=function(e){if(this._videoElement=e,void 0===this._videoElement)throw new Error("Video not attached to the MediaKeys");return R(this._videoElement,this._mediaKeys)},t.createSession=function(){if(void 0===this._videoElement||void 0===this._mediaKeys)throw new Error("Video not attached to the MediaKeys");return new Z(this._videoElement,this._keyType,this._serverCertificate)},t.setServerCertificate=function(e){return this._serverCertificate=e,Promise.resolve()},e}();var P=null,M=function(e,t){var n=e;return"function"==typeof n.setMediaKeys?n.setMediaKeys(t):"function"==typeof n.webkitSetMediaKeys?n.webkitSetMediaKeys(t):"function"==typeof n.mozSetMediaKeys?n.mozSetMediaKeys(t):"function"==typeof n.msSetMediaKeys&&null!==t?n.msSetMediaKeys(t):void 0};if(s.Z||null!=navigator.requestMediaKeySystemAccess&&!(0,u.Z)())P=function(){var e;return(e=navigator).requestMediaKeySystemAccess.apply(e,arguments)};else{var C,D;if(T(HTMLVideoElement.prototype)){var N={isTypeSupported:function(e){var t=document.querySelector("video");return null==t&&(t=document.createElement("video")),null!=t&&"function"==typeof t.canPlayType&&!!t.canPlayType("video/mp4",e)},createCustomMediaKeys:function(e){return new w(e)},setMediaKeys:function(e,t){if(null!==t){if(!(t instanceof w))throw new Error("Custom setMediaKeys is supposed to be called with old webkit custom MediaKeys.");return t._setVideo(e)}}};C=N.isTypeSupported,D=N.createCustomMediaKeys,M=N.setMediaKeys}else if(void 0!==I.t){var O=function(){if(void 0===I.t)throw new Error("No WebKitMediaKeys API.");return{isTypeSupported:I.t.isTypeSupported,createCustomMediaKeys:function(e){return new x(e)},setMediaKeys:function(e,t){if(null===t)return R(e,t);if(!(t instanceof x))throw new Error("Custom setMediaKeys is supposed to be called with webkit custom MediaKeys.");return t._setVideo(e)}}}();C=O.isTypeSupported,D=O.createCustomMediaKeys,M=O.setMediaKeys}else if(o.fq&&void 0!==r){var L={isTypeSupported:function(e,t){if(void 0===r)throw new Error("No MSMediaKeys API.");return void 0!==t?r.isTypeSupported(e,t):r.isTypeSupported(e)},createCustomMediaKeys:function(e){return new y(e)},setMediaKeys:function(e,t){if(null!==t){if(!(t instanceof y))throw new Error("Custom setMediaKeys is supposed to be called with IE11 custom MediaKeys.");return t._setVideo(e)}}};C=L.isTypeSupported,D=L.createCustomMediaKeys,M=L.setMediaKeys}else if(void 0!==f){var U={isTypeSupported:function(e,t){if(void 0===f)throw new Error("No MozMediaKeys API.");return void 0!==t?f.isTypeSupported(e,t):f.isTypeSupported(e)},createCustomMediaKeys:function(e){if(void 0===f)throw new Error("No MozMediaKeys API.");return new f(e)},setMediaKeys:function(e,t){var n=e;if(void 0===n.mozSetMediaKeys||"function"!=typeof n.mozSetMediaKeys)throw new Error("Can't set video on MozMediaKeys.");return n.mozSetMediaKeys(t)}};C=U.isTypeSupported,D=U.createCustomMediaKeys,M=U.setMediaKeys}else{var B=window.MediaKeys,F=function(){if(void 0===B)throw new i.Z("MEDIA_KEYS_NOT_SUPPORTED","No `MediaKeys` implementation found in the current browser.");if(void 0===B.isTypeSupported){throw new Error("This browser seems to be unable to play encrypted contents currently. Note: Some browsers do not allow decryption in some situations, like when not using HTTPS.")}};C=function(e){return F(),(0,a.Z)("function"==typeof B.isTypeSupported),B.isTypeSupported(e)},D=function(e){return F(),new B(e)}}P=function(e,t){if(!C(e))return Promise.reject(new Error("Unsupported key type"));for(var n=0;n<t.length;n++){var r=t[n],i=r.videoCapabilities,a=r.audioCapabilities,o=r.initDataTypes,s=r.distinctiveIdentifier,u=!0;if(u=(u=u&&(null==o||o.some((function(e){return"cenc"===e}))))&&"required"!==s){var l={initDataTypes:["cenc"],distinctiveIdentifier:"not-allowed",persistentState:"required",sessionTypes:["temporary","persistent-license"]};void 0!==i&&(l.videoCapabilities=i),void 0!==a&&(l.audioCapabilities=a);var c=D(e);return Promise.resolve(new d(e,c,l))}}return Promise.reject(new Error("Unsupported configuration"))}}},158:function(e,t,n){"use strict";var r;if(n.d(t,{t:function(){return r}}),!n(2203).Z){var i=window.WebKitMediaKeys;void 0!==i&&"function"==typeof i.isTypeSupported&&"function"==typeof i.prototype.createSession&&"function"==typeof HTMLMediaElement.prototype.webkitSetMediaKeys&&(r=i)}},3038:function(e,t,n){"use strict";n.d(t,{Dl:function(){return k},M4:function(){return R},N8:function(){return y},Q$:function(){return A},RV:function(){return E},Zl:function(){return S},bD:function(){return h},bQ:function(){return I},c9:function(){return p},it:function(){return v},k6:function(){return g},kk:function(){return T},qo:function(){return w},u_:function(){return m},w0:function(){return f},x6:function(){return b},y4:function(){return _}});var r=n(6872),i=n(6923),a=n(1946),o=n(8894),s=n(5095),u=n(5059),l=["","webkit","moz","ms"];function d(e,t){return t.filter((function(t){return function(e,t){var n=document.createElement(e.tagName),r="on"+t;return r in n||(n.setAttribute(r,"return;"),"function"==typeof n[r])}(e,t)}))[0]}function c(e,t){var n,r=function(e,t){return e.reduce((function(e,n){return e.concat((void 0===t?l:t).map((function(e){return e+n})))}),[])}(e,t);return function(e,t,a){if(!a.isCancelled()){if(e instanceof HTMLElement){if(void 0===n&&(n=d(e,r)),!(0,i.Z)(n))return void 0;e.addEventListener(n,t),a.register((function(){void 0!==n&&e.removeEventListener(n,t)}))}r.forEach((function(n){var r=!1;"function"==typeof e.addEventListener?e.addEventListener(n,t):(r=!0,e["on"+n]=t),a.register((function(){"function"==typeof e.removeEventListener&&e.removeEventListener(n,t),r&&delete e["on"+n]}))}))}}}function f(e,t){var n=e;if(!0===n.webkitSupportsPresentationMode&&"function"==typeof n.webkitSetPresentationMode){var r="picture-in-picture"===n.webkitPresentationMode,i=(0,s.ZP)({isEnabled:r,pipWindow:null},t);return Z(n,"webkitpresentationmodechanged",(function(){var e="picture-in-picture"===n.webkitPresentationMode;i.setValue({isEnabled:e,pipWindow:null})}),t),i}var a=document.pictureInPictureElement===n,o=(0,s.ZP)({isEnabled:a,pipWindow:null},t);return Z(n,"enterpictureinpicture",(function(e){var t;o.setValue({isEnabled:!0,pipWindow:null!==(t=e.pictureInPictureWindow)&&void 0!==t?t:null})}),t),Z(n,"leavepictureinpicture",(function(){o.setValue({isEnabled:!1,pipWindow:null})}),t),o}function v(e,t){var n,a=function(e){var t,n=document;null!=n.hidden?t="":null!=n.mozHidden?t="moz":null!=n.msHidden?t="ms":null!=n.webkitHidden&&(t="webkit");var r=(0,i.Z)(t)?t+"Hidden":"hidden",a=(0,i.Z)(t)?t+"visibilitychange":"visibilitychange",o=document[r],u=(0,s.ZP)(!o,e);return Z(document,a,(function(){var e=!document[r];u.setValueIfChanged(e)}),e),u}(t),o=(0,s.ZP)(!0,t);return t.register((function(){clearTimeout(n),n=void 0})),a.onUpdate(u,{clearSignal:t}),e.onUpdate(u,{clearSignal:t}),u(),o;function u(){if(clearTimeout(n),n=void 0,e.getValue().isEnabled||a.getValue())o.setValueIfChanged(!0);else{var t=r.Z.getCurrent().INACTIVITY_DELAY;n=window.setTimeout((function(){o.setValueIfChanged(!1)}),t)}}}function p(e){var t=null==window.devicePixelRatio||0===window.devicePixelRatio?1:window.devicePixelRatio,n=(0,s.ZP)({width:window.screen.width,height:window.screen.height,pixelRatio:t},e),r=window.setInterval((function(){var e=n.getValue();e.width===screen.width&&e.height===screen.height&&e.pixelRatio===t||n.setValue({width:screen.width,height:screen.height,pixelRatio:t})}),2e4);return e.register((function(){clearInterval(r)})),n}function h(e,t,n){var r=null==window.devicePixelRatio||0===window.devicePixelRatio?1:window.devicePixelRatio,i=(0,s.ZP)({width:e.clientWidth,height:e.clientHeight,pixelRatio:r},n),u=o.Z;t.onUpdate(d,{clearSignal:n}),Z(window,"resize",d,n),Z(e,"enterpictureinpicture",d,n),Z(e,"leavepictureinpicture",d,n);var l=window.setInterval(d,2e4);return d(),n.register((function(){u(),clearInterval(l)})),i;function d(){u();var n=t.getValue(),s=n.pipWindow;if(n.isEnabled)if((0,a.Z)(s)){var l=i.getValue();void 0===l.width&&void 0===l.height&&l.pixelRatio===r||i.setValue({width:void 0,height:void 0,pixelRatio:r})}else{var d=function(){f()};s.addEventListener("resize",d),u=function(){s.removeEventListener("resize",d),u=o.Z},f()}else{var c=i.getValue();c.width===e.clientWidth&&c.height===e.clientHeight&&c.pixelRatio===r||i.setValue({width:e.clientWidth,height:e.clientHeight,pixelRatio:r})}function f(){var e=i.getValue();e.width===(null==s?void 0:s.width)&&e.height===(null==s?void 0:s.height)&&e.pixelRatio===r||i.setValue({width:null==s?void 0:s.width,height:null==s?void 0:s.height,pixelRatio:r})}}}c(["loadedmetadata"]),c(["timeupdate"]),c(["addtrack"]),c(["removetrack"]);var m=c(["sourceopen","webkitsourceopen"]),g=c(["sourceclose","webkitsourceclose"]),y=c(["sourceended","webkitsourceended"]),_=c(["update"]),b=c(["removesourcebuffer"]),S=c((0,u.Z)()?["needkey"]:["encrypted","needkey"]),E=c(["keymessage","message"]),T=c(["keyadded","ready"]),k=c(["keyerror","error"]),w=c(["keystatuseschange"]),A=c(["seeking"]),I=c(["seeked"]),R=c(["ended"]);function Z(e,t,n,r){e.addEventListener(t,n),r.register((function(){e.removeEventListener(t,n)}))}},2203:function(e,t){"use strict";var n="undefined"==typeof window;t.Z=n},1988:function(e,t,n){"use strict";function r(e){return"function"==typeof window.VTTCue&&e instanceof window.VTTCue}n.d(t,{Z:function(){return r}})},7253:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(3887),i=n(1946);function a(e,t,n){if(e>=t)return r.Z.warn("Compat: Invalid cue times: "+e+" - "+t),null;if((0,i.Z)(window.VTTCue)){if((0,i.Z)(window.TextTrackCue))throw new Error("VTT cues not supported in your target");return new TextTrackCue(e,t,n)}return new VTTCue(e,t,n)}},5059:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(3666),i=n(158);function a(){return(r.vS||r.SB)&&void 0!==i.t}},1669:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(3666);function i(){return r.op}},6872:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r={DEFAULT_UNMUTED_VOLUME:.1,DEFAULT_REQUEST_TIMEOUT:3e4,DEFAULT_TEXT_TRACK_MODE:"native",DEFAULT_ENABLE_FAST_SWITCHING:!0,DELTA_POSITION_AFTER_RELOAD:{bitrateSwitch:-.1,trackSwitch:{audio:-.7,video:-.1,other:0}},DEFAULT_CODEC_SWITCHING_BEHAVIOR:"continue",DEFAULT_AUTO_PLAY:!1,DEFAULT_WANTED_BUFFER_AHEAD:30,DEFAULT_MAX_BUFFER_AHEAD:1/0,DEFAULT_MAX_BUFFER_BEHIND:1/0,DEFAULT_MAX_VIDEO_BUFFER_SIZE:1/0,MAXIMUM_MAX_BUFFER_AHEAD:{text:18e3},MAXIMUM_MAX_BUFFER_BEHIND:{text:18e3},DEFAULT_BASE_BANDWIDTH:0,INACTIVITY_DELAY:6e4,DEFAULT_THROTTLE_VIDEO_BITRATE_WHEN_HIDDEN:!1,DEFAULT_VIDEO_RESOLUTION_LIMIT:"none",DEFAULT_LIVE_GAP:{DEFAULT:10,LOW_LATENCY:3.5},BUFFER_DISCONTINUITY_THRESHOLD:.2,FORCE_DISCONTINUITY_SEEK_DELAY:5e3,BITRATE_REBUFFERING_RATIO:1.5,BUFFER_GC_GAPS:{CALM:240,BEEFY:30},DEFAULT_MAX_MANIFEST_REQUEST_RETRY:4,DEFAULT_CDN_DOWNGRADE_TIME:60,DEFAULT_MAX_REQUESTS_RETRY_ON_ERROR:4,INITIAL_BACKOFF_DELAY_BASE:{REGULAR:200,LOW_LATENCY:50},MAX_BACKOFF_DELAY_BASE:{REGULAR:3e3,LOW_LATENCY:1e3},SAMPLING_INTERVAL_MEDIASOURCE:1e3,SAMPLING_INTERVAL_LOW_LATENCY:250,SAMPLING_INTERVAL_NO_MEDIASOURCE:500,ABR_ENTER_BUFFER_BASED_ALGO:10,ABR_EXIT_BUFFER_BASED_ALGO:5,ABR_MINIMUM_TOTAL_BYTES:15e4,ABR_MINIMUM_CHUNK_SIZE:16e3,ABR_STARVATION_FACTOR:{DEFAULT:.72,LOW_LATENCY:.72},ABR_REGULAR_FACTOR:{DEFAULT:.72,LOW_LATENCY:.72},ABR_STARVATION_GAP:{DEFAULT:5,LOW_LATENCY:5},OUT_OF_STARVATION_GAP:{DEFAULT:7,LOW_LATENCY:7},ABR_STARVATION_DURATION_DELTA:.1,ABR_FAST_EMA:2,ABR_SLOW_EMA:10,RESUME_GAP_AFTER_SEEKING:{DEFAULT:1.5,LOW_LATENCY:.5},RESUME_GAP_AFTER_NOT_ENOUGH_DATA:{DEFAULT:.5,LOW_LATENCY:.5},RESUME_GAP_AFTER_BUFFERING:{DEFAULT:5,LOW_LATENCY:.5},REBUFFERING_GAP:{DEFAULT:.5,LOW_LATENCY:.2},MINIMUM_BUFFER_AMOUNT_BEFORE_FREEZING:2,UNFREEZING_SEEK_DELAY:6e3,FREEZING_STALLED_DELAY:600,UNFREEZING_DELTA_POSITION:.001,MAX_TIME_MISSING_FROM_COMPLETE_SEGMENT:.15,MAX_MANIFEST_BUFFERED_START_END_DIFFERENCE:.4,MAX_MANIFEST_BUFFERED_DURATION_DIFFERENCE:.3,MINIMUM_SEGMENT_SIZE:.005,APPEND_WINDOW_SECURITIES:{START:.2,END:.1},MAXIMUM_HTML_TEXT_TRACK_UPDATE_INTERVAL:50,TEXT_TRACK_SIZE_CHECKS_INTERVAL:250,BUFFER_PADDING:{audio:1,video:3,other:1},SEGMENT_PRIORITIES_STEPS:[2,4,8,12,18,25],MAX_HIGH_PRIORITY_LEVEL:1,MIN_CANCELABLE_PRIORITY:3,EME_DEFAULT_VIDEO_CODECS:['video/mp4;codecs="avc1.4d401e"','video/mp4;codecs="avc1.42e01e"','video/webm;codecs="vp8"'],EME_DEFAULT_AUDIO_CODECS:['audio/mp4;codecs="mp4a.40.2"',"audio/webm;codecs=opus"],EME_DEFAULT_WIDEVINE_ROBUSTNESSES:["HW_SECURE_ALL","HW_SECURE_DECODE","HW_SECURE_CRYPTO","SW_SECURE_DECODE","SW_SECURE_CRYPTO"],EME_DEFAULT_PLAYREADY_RECOMMENDATION_ROBUSTNESSES:["3000","2000"],EME_KEY_SYSTEMS:{clearkey:["webkit-org.w3.clearkey","org.w3.clearkey"],widevine:["com.widevine.alpha"],playready:["com.microsoft.playready.recommendation","com.microsoft.playready","com.chromecast.playready","com.youtube.playready"],fairplay:["com.apple.fps.1_0"]},MAX_CONSECUTIVE_MANIFEST_PARSING_IN_UNSAFE_MODE:10,MIN_MANIFEST_PARSING_TIME_TO_ENTER_UNSAFE_MODE:200,MIN_DASH_S_ELEMENTS_TO_PARSE_UNSAFELY:300,OUT_OF_SYNC_MANIFEST_REFRESH_DELAY:3e3,FAILED_PARTIAL_UPDATE_MANIFEST_REFRESH_DELAY:3e3,DASH_FALLBACK_LIFETIME_WHEN_MINIMUM_UPDATE_PERIOD_EQUAL_0:3,EME_DEFAULT_MAX_SIMULTANEOUS_MEDIA_KEY_SESSIONS:15,EME_MAX_STORED_PERSISTENT_SESSION_INFORMATION:1e3,EME_WAITING_DELAY_LOADED_SESSION_EMPTY_KEYSTATUSES:100,FORCED_ENDED_THRESHOLD:8e-4,ADAP_REP_SWITCH_BUFFER_PADDINGS:{video:{before:5,after:5},audio:{before:2,after:2.5},text:{before:0,after:0}},SOURCE_BUFFER_FLUSHING_INTERVAL:500,CONTENT_REPLACEMENT_PADDING:1.2,CACHE_LOAD_DURATION_THRESHOLDS:{video:50,audio:10},STREAM_EVENT_EMITTER_POLL_INTERVAL:250,DEFAULT_MAXIMUM_TIME_ROUNDING_ERROR:.001,BUFFERED_HISTORY_RETENTION_TIME:6e4,BUFFERED_HISTORY_MAXIMUM_ENTRIES:200,MIN_BUFFER_AHEAD:5,UPTO_CURRENT_POSITION_CLEANUP:5,DEFAULT_VIDEO_REPRESENTATIONS_SWITCHING_MODE:"seamless",DEFAULT_AUDIO_REPRESENTATIONS_SWITCHING_MODE:"seamless",DEFAULT_VIDEO_TRACK_SWITCHING_MODE:"reload",DEFAULT_AUDIO_TRACK_SWITCHING_MODE:"seamless"},i=n(8026);function a(e){return null!=e&&!Array.isArray(e)&&"object"==typeof e}function o(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];if(0===n.length)return e;var s=n.shift();if(a(e)&&a(s))for(var u in s)if(a(s[u])){var l=e[u];void 0===l&&(l={},e[u]=l),o(l,s[u])}else{var d;(0,i.Z)(e,((d={})[u]=s[u],d))}return o.apply(void 0,[e].concat(n))}var s=function(){function e(){this._config=r}var t=e.prototype;return t.update=function(e){var t=o(this._config,e);this._config=t},t.getCurrent=function(){return this._config},e}(),u=new s},1932:function(e,t,n){"use strict";n.d(t,{Z:function(){return f}});var r=n(4578),i=n(3666);var a=n(1959),o=n(1946),s=n(5288);function u(e,t){var n;if(t.length!==e.length)return!0;for(var r=0;r<t.length;r++)if(t[r].nativeTrack!==(null===(n=e[r])||void 0===n?void 0:n.nativeTrack))return!0;return!1}function l(e){for(var t,n=[],r={},i=0;i<e.length;i++){var a=e[i],o=""===a.language?"nolang":a.language,u=null!==(t=r[o])&&void 0!==t?t:1,l="gen_audio_"+o+"_"+u.toString();r[o]=u+1;var d={language:a.language,id:l,normalized:(0,s.ZP)(a.language),audioDescription:"descriptions"===a.kind||"description"===a.kind,representations:[]};n.push({track:d,nativeTrack:a})}return n}function d(e){for(var t,n=[],r={},i=0;i<e.length;i++){var a=e[i],o=""===a.language?"nolang":a.language,u=null!==(t=r[o])&&void 0!==t?t:1,l="gen_text_"+o+"_"+u.toString();r[o]=u+1;var d="forced"===a.kind||void 0,c={language:a.language,forced:d,label:a.label,id:l,normalized:(0,s.ZP)(a.language),closedCaption:"captions"===a.kind};n.push({track:c,nativeTrack:a})}return n}function c(e){for(var t,n=[],r={},i=0;i<e.length;i++){var a=e[i],o=""===a.language?"nolang":a.language,s=null!==(t=r[o])&&void 0!==t?t:1,u="gen_video_"+o+"_"+s.toString();r[o]=s+1,n.push({track:{id:u,representations:[]},nativeTrack:a})}return n}var f=function(e){function t(t){var n,r,i,a;return(n=e.call(this)||this)._nativeAudioTracks=t.audioTracks,n._nativeVideoTracks=t.videoTracks,n._nativeTextTracks=t.textTracks,n._audioTracks=void 0!==n._nativeAudioTracks?l(n._nativeAudioTracks):[],n._videoTracks=void 0!==n._nativeVideoTracks?c(n._nativeVideoTracks):[],n._textTracks=void 0!==n._nativeTextTracks?d(n._nativeTextTracks):[],n._lastEmittedNativeAudioTrack=null===(r=n._getCurrentAudioTrack())||void 0===r?void 0:r.nativeTrack,n._lastEmittedNativeVideoTrack=null===(i=n._getCurrentVideoTrack())||void 0===i?void 0:i.nativeTrack,n._lastEmittedNativeTextTrack=null===(a=n._getCurrentTextTrack())||void 0===a?void 0:a.nativeTrack,n._handleNativeTracksCallbacks(),n}(0,r.Z)(t,e);var n=t.prototype;return n.setAudioTrackById=function(e){for(var t=0;t<this._audioTracks.length;t++){var n=this._audioTracks[t],r=n.track,i=n.nativeTrack;if(r.id===e)return this._enableAudioTrackFromIndex(t),void(this._audioTrackLockedOn=i)}throw new Error("Audio track not found.")},n.disableTextTrack=function(){v(this._textTracks),this._textTrackLockedOn=null},n.setTextTrackById=function(e){for(var t=!1,n=0;n<this._textTracks.length;n++){var r=this._textTracks[n],i=r.track,a=r.nativeTrack;i.id===e?(a.mode="showing",t=!0,this._textTrackLockedOn=a):"showing"!==a.mode&&"hidden"!==a.mode||(a.mode="disabled")}if(!t)throw new Error("Text track not found.")},n.disableVideoTrack=function(){h(this._videoTracks),this._videoTrackLockedOn=null},n.setVideoTrackById=function(e){for(var t=0;t<this._videoTracks.length;t++){var n=this._videoTracks[t],r=n.track,i=n.nativeTrack;if(r.id===e)return i.selected=!0,void(this._videoTrackLockedOn=i)}throw new Error("Video track not found.")},n.getChosenAudioTrack=function(){var e=this._getCurrentAudioTrack();return(0,o.Z)(e)?e:e.track},n.getChosenTextTrack=function(){var e=this._getCurrentTextTrack();return(0,o.Z)(e)?e:e.track},n.getChosenVideoTrack=function(){var e=this._getCurrentVideoTrack();return(0,o.Z)(e)?e:e.track},n.getAvailableAudioTracks=function(){return this._audioTracks.map((function(e){var t=e.track,n=e.nativeTrack;return{id:t.id,language:t.language,normalized:t.normalized,audioDescription:t.audioDescription,active:n.enabled,representations:t.representations}}))},n.getAvailableTextTracks=function(){return this._textTracks.map((function(e){var t=e.track,n=e.nativeTrack;return{id:t.id,label:t.label,forced:t.forced,language:t.language,normalized:t.normalized,closedCaption:t.closedCaption,active:"showing"===n.mode}}))},n.getAvailableVideoTracks=function(){return this._videoTracks.map((function(e){var t=e.track,n=e.nativeTrack;return{id:t.id,representations:t.representations,active:n.selected}}))},n.dispose=function(){void 0!==this._nativeVideoTracks&&(this._nativeVideoTracks.onchange=null,this._nativeVideoTracks.onaddtrack=null,this._nativeVideoTracks.onremovetrack=null),void 0!==this._nativeAudioTracks&&(this._nativeAudioTracks.onchange=null,this._nativeAudioTracks.onaddtrack=null,this._nativeAudioTracks.onremovetrack=null),void 0!==this._nativeTextTracks&&(this._nativeTextTracks.onchange=null,this._nativeTextTracks.onaddtrack=null,this._nativeTextTracks.onremovetrack=null),this.removeEventListener()},n._getCurrentAudioTrack=function(){if(void 0!==this._nativeAudioTracks){for(var e=0;e<this._audioTracks.length;e++){var t=this._audioTracks[e];if(t.nativeTrack.enabled)return t}return null}},n._getCurrentVideoTrack=function(){if(void 0!==this._nativeVideoTracks){for(var e=0;e<this._videoTracks.length;e++){var t=this._videoTracks[e];if(t.nativeTrack.selected)return t}return null}},n._getCurrentTextTrack=function(){if(void 0!==this._nativeTextTracks){for(var e=0;e<this._textTracks.length;e++){var t=this._textTracks[e];if("showing"===t.nativeTrack.mode)return t}return null}},n._setPreviouslyLockedAudioTrack=function(){if(void 0!==this._audioTrackLockedOn)if(null===this._audioTrackLockedOn)for(var e=0;e<this._audioTracks.length;e++){this._audioTracks[e].nativeTrack.enabled=!1}else for(var t=0;t<this._audioTracks.length;t++){if(this._audioTracks[t].nativeTrack===this._audioTrackLockedOn)return void this._enableAudioTrackFromIndex(t)}},n._setPreviouslyLockedTextTrack=function(){if(void 0!==this._textTrackLockedOn)if(null!==this._textTrackLockedOn)for(var e=0;e<this._textTracks.length;e++){var t=this._textTracks[e].nativeTrack;if(t===this._textTrackLockedOn)return p(this._textTracks,t),void("showing"!==t.mode&&(t.mode="showing"))}else v(this._textTracks)},n._setPreviouslyLockedVideoTrack=function(){if(void 0!==this._videoTrackLockedOn)if(null!==this._videoTrackLockedOn)for(var e=0;e<this._videoTracks.length;e++){var t=this._videoTracks[e].nativeTrack;if(t===this._videoTrackLockedOn)return void(t.selected=!0)}else h(this._videoTracks)},n._handleNativeTracksCallbacks=function(){var e=this;void 0!==this._nativeAudioTracks&&(this._nativeAudioTracks.onaddtrack=function(){var t,n;if(void 0!==e._nativeAudioTracks){var r=l(e._nativeAudioTracks);if(u(e._audioTracks,r)){e._audioTracks=r,e._setPreviouslyLockedAudioTrack(),e.trigger("availableAudioTracksChange",e.getAvailableAudioTracks());var i=e._getCurrentAudioTrack();(null==i?void 0:i.nativeTrack)!==e._lastEmittedNativeAudioTrack&&(e.trigger("audioTrackChange",null!==(t=null==i?void 0:i.track)&&void 0!==t?t:null),e._lastEmittedNativeAudioTrack=null!==(n=null==i?void 0:i.nativeTrack)&&void 0!==n?n:null)}}},this._nativeAudioTracks.onremovetrack=function(){var t,n;if(void 0!==e._nativeAudioTracks){var r=l(e._nativeAudioTracks);if(u(e._audioTracks,r)){e._audioTracks=r,e.trigger("availableAudioTracksChange",e.getAvailableAudioTracks());var i=e._getCurrentAudioTrack();(null==i?void 0:i.nativeTrack)!==e._lastEmittedNativeAudioTrack&&(e.trigger("audioTrackChange",null!==(t=null==i?void 0:i.track)&&void 0!==t?t:null),e._lastEmittedNativeAudioTrack=null!==(n=null==i?void 0:i.nativeTrack)&&void 0!==n?n:null)}}},this._nativeAudioTracks.onchange=function(){if(void 0!==e._audioTracks)for(var t=0;t<e._audioTracks.length;t++){var n=e._audioTracks[t],r=n.track,i=n.nativeTrack;if(i.enabled)return void(i!==e._lastEmittedNativeAudioTrack&&(e.trigger("audioTrackChange",r),e._lastEmittedNativeAudioTrack=i))}null!==e._lastEmittedNativeAudioTrack&&(e.trigger("audioTrackChange",null),e._lastEmittedNativeAudioTrack=null)}),void 0!==this._nativeTextTracks&&(this._nativeTextTracks.onaddtrack=function(){var t,n;if(void 0!==e._nativeTextTracks){var r=d(e._nativeTextTracks);if(u(e._textTracks,r)){e._textTracks=r,e._setPreviouslyLockedTextTrack(),e.trigger("availableTextTracksChange",e.getAvailableTextTracks());var i=e._getCurrentTextTrack();(null==i?void 0:i.nativeTrack)!==e._lastEmittedNativeTextTrack&&(e.trigger("textTrackChange",null!==(t=null==i?void 0:i.track)&&void 0!==t?t:null),e._lastEmittedNativeTextTrack=null!==(n=null==i?void 0:i.nativeTrack)&&void 0!==n?n:null)}}},this._nativeTextTracks.onremovetrack=function(){var t,n;if(void 0!==e._nativeTextTracks){var r=d(e._nativeTextTracks);if(u(e._textTracks,r)){e._textTracks=r,e._setPreviouslyLockedTextTrack(),e.trigger("availableTextTracksChange",e.getAvailableTextTracks());var i=e._getCurrentTextTrack();(null==i?void 0:i.nativeTrack)!==e._lastEmittedNativeTextTrack&&(e.trigger("textTrackChange",null!==(t=null==i?void 0:i.track)&&void 0!==t?t:null),e._lastEmittedNativeTextTrack=null!==(n=null==i?void 0:i.nativeTrack)&&void 0!==n?n:null)}}},this._nativeTextTracks.onchange=function(){if(void 0!==e._textTracks)for(var t=0;t<e._textTracks.length;t++){var n=e._textTracks[t],r=n.track,i=n.nativeTrack;if("showing"===i.mode)return void(i!==e._lastEmittedNativeTextTrack&&(e.trigger("textTrackChange",r),e._lastEmittedNativeTextTrack=i))}null!==e._lastEmittedNativeTextTrack&&(e.trigger("textTrackChange",null),e._lastEmittedNativeTextTrack=null)}),void 0!==this._nativeVideoTracks&&(this._nativeVideoTracks.onaddtrack=function(){var t,n;if(void 0!==e._nativeVideoTracks){var r=c(e._nativeVideoTracks);if(u(e._videoTracks,r)){e._videoTracks=r,e._setPreviouslyLockedVideoTrack(),e.trigger("availableVideoTracksChange",e.getAvailableVideoTracks());var i=e._getCurrentVideoTrack();(null==i?void 0:i.nativeTrack)!==e._lastEmittedNativeVideoTrack&&(e.trigger("videoTrackChange",null!==(t=null==i?void 0:i.track)&&void 0!==t?t:null),e._lastEmittedNativeVideoTrack=null!==(n=null==i?void 0:i.nativeTrack)&&void 0!==n?n:null)}}},this._nativeVideoTracks.onremovetrack=function(){var t,n;if(void 0!==e._nativeVideoTracks){var r=c(e._nativeVideoTracks);if(u(e._videoTracks,r)){e._videoTracks=r,e._setPreviouslyLockedVideoTrack(),e.trigger("availableVideoTracksChange",e.getAvailableVideoTracks());var i=e._getCurrentVideoTrack();(null==i?void 0:i.nativeTrack)!==e._lastEmittedNativeVideoTrack&&(e.trigger("videoTrackChange",null!==(t=null==i?void 0:i.track)&&void 0!==t?t:null),e._lastEmittedNativeVideoTrack=null!==(n=null==i?void 0:i.nativeTrack)&&void 0!==n?n:null)}}},this._nativeVideoTracks.onchange=function(){if(void 0!==e._videoTracks)for(var t=0;t<e._videoTracks.length;t++){var n=e._videoTracks[t],r=n.track,i=n.nativeTrack;if(i.selected)return void(i!==e._lastEmittedNativeVideoTrack&&(e.trigger("videoTrackChange",r),e._lastEmittedNativeVideoTrack=i))}null!==e._lastEmittedNativeVideoTrack&&(e.trigger("videoTrackChange",null),e._lastEmittedNativeVideoTrack=null)})},n._enableAudioTrackFromIndex=function(e){!function(e,t){for(var n=0;n<e.length;n++)i.yS&&n===t||(e[n].enabled=!1);t<0||t>=e.length||(e[t].enabled=!0)}(this._audioTracks.map((function(e){return e.nativeTrack})),e)},t}(a.Z);function v(e){for(var t=0;t<e.length;t++){e[t].nativeTrack.mode="disabled"}}function p(e,t){for(var n=0;n<e.length;n++){var r=e[n].nativeTrack;r===t||"showing"!==r.mode&&"hidden"!==r.mode||(r.mode="disabled")}}function h(e){for(var t=0;t<e.length;t++){e[t].nativeTrack.selected=!1}}},276:function(e,t,n){"use strict";n.d(t,{u:function(){return Qe},Z:function(){return Je}});var r=n(5861),i=n(4578),a=n(4687),o=n.n(a),s=n(3038),u=n(3887),l=n(6490),d=n(4791),c=n(6968),f=n(3635),v=(0,c.pX)((0,f.tG)("pssh"),0);function p(e,t){for(var n=0;n<e.length;n++){var r=e[n];if((void 0===t.systemId||void 0===r.systemId||t.systemId===r.systemId)&&(0,d.Z)(t.data,r.data))return!0}return!1}function h(e){var t=e.initData,n=e.initDataType;if(null==t)return u.Z.warn("Compat: No init data found on media encrypted event."),null;var r=function(e){for(var t=[],n=0;n<e.length;){if(e.length<n+8||(0,c.pX)(e,n+4)!==v)return u.Z.warn("Compat: Unrecognized initialization data. Use as is."),[{systemId:void 0,data:e}];var r=(0,c.pX)(new Uint8Array(e),n);if(n+r>e.length)return u.Z.warn("Compat: Unrecognized initialization data. Use as is."),[{systemId:void 0,data:e}];var i=e.subarray(n,n+r),a={systemId:(0,l.Y)(i,8),data:i};p(t,a)?u.Z.warn("Compat: Duplicated PSSH found in initialization data, removing it."):t.push(a),n+=r}return n!==e.length?(u.Z.warn("Compat: Unrecognized initialization data. Use as is."),[{systemId:void 0,data:e}]):t}(new Uint8Array(t));return{type:n,values:r}}var m=n(6872),g=n(5157),y=n(5389),_=n(3274),b=n(7714),S=n(1959),E=n(1946),T=n(288),k=n(6139),w=n(770);function A(e){w.Z.setState(e,null),(0,k.Y)(e,null)}function I(){return(I=(0,r.Z)(o().mark((function e(t,n,r){var i,a,s,l,d,c;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=n.keySystemOptions,a=n.loadedSessionsStore,s=n.mediaKeySystemAccess,l=n.mediaKeys,d=w.Z.getState(t),c=null!==d&&d.loadedSessionsStore!==a?d.loadedSessionsStore.closeAllSessions():Promise.resolve(),e.next=5,c;case 5:if(!r.isCancelled()){e.next=7;break}throw r.cancellationError;case 7:if(w.Z.setState(t,{keySystemOptions:i,mediaKeySystemAccess:s,mediaKeys:l,loadedSessionsStore:a}),t.mediaKeys!==l){e.next=10;break}return e.abrupt("return");case 10:u.Z.info("DRM: Attaching MediaKeys to the media element"),(0,k.Y)(t,l),u.Z.info("DRM: MediaKeys attached with success");case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function R(e){if(""===e.sessionId)return!1;var t=e.keyStatuses,n=[];return t.forEach((function(e){n.push(e)})),n.length<=0?(u.Z.debug("DRM: isSessionUsable: MediaKeySession given has an empty keyStatuses",e.sessionId),!1):(0,b.Z)(n,"expired")?(u.Z.debug("DRM: isSessionUsable: MediaKeySession given has an expired key",e.sessionId),!1):(0,b.Z)(n,"internal-error")?(u.Z.debug("DRM: isSessionUsable: MediaKeySession given has a key with an internal-error",e.sessionId),!1):(u.Z.debug("DRM: isSessionUsable: MediaKeySession is usable",e.sessionId),!0)}function Z(e,t,n,r){var i=e.loadedSessionsStore,a=e.persistentSessionsStore;return"temporary"===n?x(i,t):null===a?(u.Z.warn("DRM: Cannot create persistent MediaKeySession, PersistentSessionsStore not created."),x(i,t)):function(e,t,n,r){return P.apply(this,arguments)}(i,a,t,r)}function x(e,t){u.Z.info("DRM: Creating a new temporary session");var n=e.createSession(t,"temporary");return Promise.resolve({type:"created-session",value:n})}function P(){return P=(0,r.Z)(o().mark((function e(t,n,i,a){var s,l,d,c,f,v;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(v=function(){return v=(0,r.Z)(o().mark((function e(){var r,l;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===a.cancellationError){e.next=2;break}throw a.cancellationError;case 2:return u.Z.info("DRM: Removing previous persistent session."),null!==(r=n.get(i))&&n.delete(r.sessionId),e.prev=5,e.next=8,t.closeSession(s.mediaKeySession);case 8:e.next=15;break;case 10:if(e.prev=10,e.t0=e.catch(5),""===s.mediaKeySession.sessionId){e.next=14;break}throw e.t0;case 14:t.removeSessionWithoutClosingIt(s.mediaKeySession);case 15:if(null===a.cancellationError){e.next=17;break}throw a.cancellationError;case 17:return l=t.createSession(i,"persistent-license"),e.abrupt("return",{type:"created-session",value:l});case 19:case"end":return e.stop()}}),e,null,[[5,10]])}))),v.apply(this,arguments)},f=function(){return v.apply(this,arguments)},null===a.cancellationError){e.next=4;break}throw a.cancellationError;case 4:if(u.Z.info("DRM: Creating persistent MediaKeySession"),s=t.createSession(i,"persistent-license"),null!==(l=n.getAndReuse(i))){e.next=9;break}return e.abrupt("return",{type:"created-session",value:s});case 9:return e.prev=9,e.next=12,t.loadPersistentSession(s.mediaKeySession,l.sessionId);case 12:if(d=e.sent){e.next=19;break}return u.Z.warn("DRM: No data stored for the loaded session"),n.delete(l.sessionId),t.removeSessionWithoutClosingIt(s.mediaKeySession),c=t.createSession(i,"persistent-license"),e.abrupt("return",{type:"created-session",value:c});case 19:if(!d||!R(s.mediaKeySession)){e.next=23;break}return n.add(i,i.keyIds,s.mediaKeySession),u.Z.info("DRM: Succeeded to load persistent session."),e.abrupt("return",{type:"loaded-persistent-session",value:s});case 23:return u.Z.warn("DRM: Previous persistent session not usable anymore."),e.abrupt("return",f());case 27:return e.prev=27,e.t0=e.catch(9),u.Z.warn("DRM: Unable to load persistent session: "+(e.t0 instanceof Error?e.t0.toString():"Unknown Error")),e.abrupt("return",f());case 31:case"end":return e.stop()}}),e,null,[[9,27]])}))),P.apply(this,arguments)}function M(e,t){return C.apply(this,arguments)}function C(){return(C=(0,r.Z)(o().mark((function e(t,n){var r,i,a,s,l;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n<0||n>=t.getLength())){e.next=2;break}return e.abrupt("return");case 2:for(u.Z.info("DRM: LSS cache limit exceeded",n,t.getLength()),r=[],i=t.getAll().slice(),a=i.length-n,s=0;s<a;s++)l=i[s],r.push(t.closeSession(l.mediaKeySession));return e.next=9,Promise.all(r);case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function D(e,t,n,r,i){return N.apply(this,arguments)}function N(){return(N=(0,r.Z)(o().mark((function e(t,n,r,i,a){var s,l,d,c,f;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=null,l=n.loadedSessionsStore,d=n.persistentSessionsStore,null===(c=l.reuse(t))){e.next=11;break}if(!R(s=c.mediaKeySession)){e.next=10;break}return u.Z.info("DRM: Reuse loaded session",s.sessionId),e.abrupt("return",{type:"loaded-open-session",value:{mediaKeySession:s,sessionType:c.sessionType,keySessionRecord:c.keySessionRecord}});case 10:null!==d&&""!==c.mediaKeySession.sessionId&&d.delete(c.mediaKeySession.sessionId);case 11:if(null===s){e.next=16;break}return e.next=14,l.closeSession(s);case 14:if(null===a.cancellationError){e.next=16;break}throw a.cancellationError;case 16:return e.next=18,M(l,i);case 18:if(null===a.cancellationError){e.next=20;break}throw a.cancellationError;case 20:return e.next=22,Z(n,t,r,a);case 22:return f=e.sent,e.abrupt("return",{type:f.type,value:{mediaKeySession:f.value.mediaKeySession,sessionType:f.value.sessionType,keySessionRecord:f.value.keySessionRecord}});case 24:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var O=n(3666);var L=n(9592);function U(e,t,n){var r=t.getConfiguration();if(O.fq||null==r)return null;var i=e.filter((function(e){return e.type===n.type&&(!!((0,E.Z)(e.persistentLicenseConfig)&&"required"!==e.persistentState||"required"===r.persistentState)&&("required"!==e.distinctiveIdentifier||"required"===r.distinctiveIdentifier))}))[0];return null!=i?{keySystemOptions:i,keySystemAccess:t}:null}function B(e){var t=e.keyName,n=e.keyType,r=e.keySystemOptions,i=["temporary"],a="optional",o="optional";(0,E.Z)(r.persistentLicenseConfig)||(a="required",i.push("persistent-license")),(0,E.Z)(r.persistentState)||(a=r.persistentState),(0,E.Z)(r.distinctiveIdentifier)||(o=r.distinctiveIdentifier);var s,u,l=m.Z.getCurrent(),d=l.EME_DEFAULT_AUDIO_CODECS,c=l.EME_DEFAULT_VIDEO_CODECS,f=l.EME_DEFAULT_WIDEVINE_ROBUSTNESSES,v=l.EME_DEFAULT_PLAYREADY_RECOMMENDATION_ROBUSTNESSES,p=r.audioCapabilitiesConfig,h=r.videoCapabilitiesConfig;if("full"===(null==p?void 0:p.type))s=p.value;else{var g;0===(g="robustness"===(null==p?void 0:p.type)?p.value:"widevine"===t?f:"com.microsoft.playready.recommendation"===n?v:[]).length&&g.push(void 0);var y="contentType"===(null==p?void 0:p.type)?p.value:d;s=(0,L.Z)(g,(function(e){return y.map((function(t){return void 0!==e?{contentType:t,robustness:e}:{contentType:t}}))}))}if("full"===(null==h?void 0:h.type))u=h.value;else{var _;0===(_="robustness"===(null==h?void 0:h.type)?h.value:"widevine"===t?f:"com.microsoft.playready.recommendation"===n?v:[]).length&&_.push(void 0);var b="contentType"===(null==h?void 0:h.type)?h.value:c;u=(0,L.Z)(_,(function(e){return b.map((function(t){return void 0!==e?{contentType:t,robustness:e}:{contentType:t}}))}))}var S={initDataTypes:["cenc"],videoCapabilities:u,audioCapabilities:s,distinctiveIdentifier:o,persistentState:a,sessionTypes:i};return[S,Object.assign(Object.assign({},S),{audioCapabilities:void 0,videoCapabilities:void 0})]}function F(e,t,n){u.Z.info("DRM: Searching for compatible MediaKeySystemAccess");var i=w.Z.getState(e);if(null!=i){var a=U(t,i.mediaKeySystemAccess,i.keySystemOptions);if(null!==a)return u.Z.info("DRM: Found cached compatible keySystem"),Promise.resolve({type:"reuse-media-key-system-access",value:{mediaKeySystemAccess:a.keySystemAccess,options:a.keySystemOptions}})}var s=t.reduce((function(e,t){var n,r=m.Z.getCurrent().EME_KEY_SYSTEMS[t.type];if(null!=r)n=r.map((function(e){return{keyName:t.type,keyType:e,keySystemOptions:t}}));else{var i=function(e){for(var t=m.Z.getCurrent().EME_KEY_SYSTEMS,n=0,r=Object.keys(t);n<r.length;n++){var i=r[n];if((0,b.Z)(t[i],e))return i}}(t.type);n=[{keyName:i,keyType:t.type,keySystemOptions:t}]}return e.concat(n)}),[]);return l(0);function l(e){return d.apply(this,arguments)}function d(){return(d=(0,r.Z)(o().mark((function e(t){var r,i,a,d,c;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(t>=s.length)){e.next=2;break}throw new g.Z("INCOMPATIBLE_KEYSYSTEMS","No key system compatible with your wanted configuration has been found in the current browser.");case 2:if(null!=k.N){e.next=4;break}throw new Error("requestMediaKeySystemAccess is not implemented in your browser.");case 4:return r=s[t],i=r.keyType,a=r.keySystemOptions,d=B(r),u.Z.debug("DRM: Request keysystem access "+i+","+(t+1)+" of "+s.length),e.prev=8,e.next=11,(0,k.N)(i,d);case 11:return c=e.sent,u.Z.info("DRM: Found compatible keysystem",i,t+1),e.abrupt("return",{type:"create-media-key-system-access",value:{options:a,mediaKeySystemAccess:c}});case 16:if(e.prev=16,e.t0=e.catch(8),u.Z.debug("DRM: Rejected access to keysystem",i,t+1),null===n.cancellationError){e.next=21;break}throw n.cancellationError;case 21:return e.abrupt("return",l(t+1));case 22:case"end":return e.stop()}}),e,null,[[8,16]])})))).apply(this,arguments)}}var z=n(2297);function V(e,t,n){var r;u.Z.debug("Compat: Calling generateRequest on the MediaKeySession");try{r=function(e){u.Z.info("Compat: Trying to move CENC PSSH from init data at the end of it.");for(var t=!1,n=new Uint8Array,r=new Uint8Array,i=0;i<e.length;){if(e.length<i+8||(0,c.pX)(e,i+4)!==v)throw u.Z.warn("Compat: unrecognized initialization data. Cannot patch it."),new Error("Compat: unrecognized initialization data. Cannot patch it.");var a=(0,c.pX)(new Uint8Array(e),i);if(i+a>e.length)throw u.Z.warn("Compat: unrecognized initialization data. Cannot patch it."),new Error("Compat: unrecognized initialization data. Cannot patch it.");var o=e.subarray(i,i+a);if(16===e[i+12]&&119===e[i+13]&&239===e[i+14]&&236===e[i+15]&&192===e[i+16]&&178===e[i+17]&&77===e[i+18]&&2===e[i+19]&&172===e[i+20]&&227===e[i+21]&&60===e[i+22]&&30===e[i+23]&&82===e[i+24]&&226===e[i+25]&&251===e[i+26]&&75===e[i+27]){var s=(0,z.Xj)(o),l=null===s?void 0:o[s[1]];u.Z.info("Compat: CENC PSSH found with version",l),void 0===l?u.Z.warn("Compat: could not read version of CENC PSSH"):t===(1===l)?n=(0,c.zo)(n,o):1===l?(u.Z.warn("Compat: cenc version 1 encountered, removing every other cenc pssh box."),n=o,t=!0):u.Z.warn("Compat: filtering out cenc pssh box with wrong version",l)}else r=(0,c.zo)(r,o);i+=a}if(i!==e.length)throw u.Z.warn("Compat: unrecognized initialization data. Cannot patch it."),new Error("Compat: unrecognized initialization data. Cannot patch it.");return(0,c.zo)(r,n)}(n)}catch(e){r=n}var i=null!=t?t:"";return e.generateRequest(i,r).catch((function(t){if(""!==i||!(t instanceof TypeError))throw t;return u.Z.warn('Compat: error while calling `generateRequest` with an empty initialization data type. Retrying with a default "cenc" value.',t),e.generateRequest("cenc",r)}))}var K=100;function G(e,t){return j.apply(this,arguments)}function j(){return(j=(0,r.Z)(o().mark((function e(t,n){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u.Z.info("DRM: Load persisted session",n),e.next=3,t.load(n);case 3:if((r=e.sent)&&!(t.keyStatuses.size>0)){e.next=6;break}return e.abrupt("return",r);case 6:return e.abrupt("return",new Promise((function(e){t.addEventListener("keystatuseschange",i);var n=setTimeout(i,K);function i(){clearTimeout(n),t.removeEventListener("keystatuseschange",i),e(r)}})));case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var H=n(7864);function W(e){var t=new T.ZP;return Promise.race([e.close().then((function(){t.cancel()})),e.closed.then((function(){t.cancel()})),function(){return n.apply(this,arguments)}()]);function n(){return(n=(0,r.Z)(o().mark((function e(){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,(0,H.Z)(1e3,t.signal);case 3:return e.next=5,i();case 5:e.next=13;break;case 7:if(e.prev=7,e.t0=e.catch(0),!(e.t0 instanceof T.FU)){e.next=11;break}return e.abrupt("return");case 11:n=e.t0 instanceof Error?e.t0.message:"Unknown error made it impossible to close the session",u.Z.error("DRM: "+n);case 13:case"end":return e.stop()}}),e,null,[[0,7]])})))).apply(this,arguments)}function i(){return a.apply(this,arguments)}function a(){return(a=(0,r.Z)(o().mark((function n(){return o().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,n.next=3,e.update(new Uint8Array(1));case 3:n.next=13;break;case 5:if(n.prev=5,n.t0=n.catch(0),!t.isUsed()){n.next=9;break}return n.abrupt("return");case 9:if(!(n.t0 instanceof Error&&"The session is already closed."===n.t0.message)){n.next=11;break}return n.abrupt("return");case 11:return n.next=13,(0,H.Z)(1e3,t.signal);case 13:if(!t.isUsed()){n.next=15;break}return n.abrupt("return");case 15:throw new Error("Compat: Couldn't know if session is closed");case 16:case"end":return n.stop()}}),n,null,[[0,5]])})))).apply(this,arguments)}}var q=n(811);function Y(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return X(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return X(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function X(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Q(e,t){return e===t||(0,d.Z)(e,t)}function $(e,t){return t.some((function(t){return Q(t,e)}))}function J(e,t){for(var n,r=function(){var e=n.value;if(!t.some((function(t){return Q(t,e)})))return{v:!1}},i=Y(e);!(n=i()).done;){var a=r();if("object"==typeof a)return a.v}return!0}function ee(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return te(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return te(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function te(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var ne=function(){function e(e){this._initializationData=e,this._keyIds=null}var t=e.prototype;return t.associateKeyIds=function(e){null===this._keyIds&&(this._keyIds=[]);for(var t=0,n=Array.from(e);t<n.length;t++){var r=n[t];this.isAssociatedWithKeyId(r)||this._keyIds.push(r)}},t.isAssociatedWithKeyId=function(e){if(null===this._keyIds)return!1;for(var t,n=ee(this._keyIds);!(t=n()).done;){if(Q(t.value,e))return!0}return!1},t.getAssociatedKeyIds=function(){return null===this._keyIds?[]:this._keyIds},t.isCompatibleWith=function(e){var t=e.keyIds;if(void 0!==t&&t.length>0){if(null!==this._keyIds&&J(t,this._keyIds))return!0;if(void 0!==this._initializationData.keyIds)return J(t,this._initializationData.keyIds)}return this._checkInitializationDataCompatibility(e)},t._checkInitializationDataCompatibility=function(e){return void 0!==e.keyIds&&e.keyIds.length>0&&void 0!==this._initializationData.keyIds?J(e.keyIds,this._initializationData.keyIds):this._initializationData.type===e.type&&this._initializationData.values.isCompatibleWith(e.values)},e}();function re(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return ie(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ie(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ie(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var ae=function(){function e(e){this._mediaKeys=e,this._storage=[]}var t=e.prototype;return t.createSession=function(e,t){var n=this,r=new ne(e);u.Z.debug("DRM-LSS: calling `createSession`",t);var i=this._mediaKeys.createSession(t),a={mediaKeySession:i,sessionType:t,keySessionRecord:r,isGeneratingRequest:!1,isLoadingPersistentSession:!1,closingStatus:{type:"none"}};return(0,E.Z)(i.closed)||i.closed.then((function(){u.Z.info("DRM-LSS: session was closed, removing it.",i.sessionId);var e=n.getIndex(r);e>=0&&n._storage[e].mediaKeySession===i&&n._storage.splice(e,1)})).catch((function(e){u.Z.warn("DRM-LSS: MediaKeySession.closed rejected: "+e)})),this._storage.push(Object.assign({},a)),u.Z.debug("DRM-LSS: MediaKeySession added",a.sessionType,this._storage.length),a},t.reuse=function(e){for(var t=this._storage.length-1;t>=0;t--){var n=this._storage[t];if(n.keySessionRecord.isCompatibleWith(e))return this._storage.splice(t,1),this._storage.push(n),u.Z.debug("DRM-LSS: Reusing session:",n.mediaKeySession.sessionId,n.sessionType),Object.assign({},n)}return null},t.getEntryForSession=function(e){for(var t=this._storage.length-1;t>=0;t--){var n=this._storage[t];if(n.mediaKeySession===e)return Object.assign({},n)}return null},t.generateLicenseRequest=function(){var e=(0,r.Z)(o().mark((function e(t,n,r){var i,a,s,l;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:a=re(this._storage);case 1:if((s=a()).done){e.next=8;break}if((l=s.value).mediaKeySession!==t){e.next=6;break}return i=l,e.abrupt("break",8);case 6:e.next=1;break;case 8:if(void 0!==i){e.next=11;break}return u.Z.error("DRM-LSS: generateRequest error. No MediaKeySession found with the given initData and initDataType"),e.abrupt("return",V(t,n,r));case 11:if(i.isGeneratingRequest=!0,"none"===i.closingStatus.type){e.next=14;break}throw new Error("The `MediaKeySession` is being closed.");case 14:return e.prev=14,e.next=17,V(t,n,r);case 17:e.next=26;break;case 19:if(e.prev=19,e.t0=e.catch(14),void 0!==i){e.next=23;break}throw e.t0;case 23:throw i.isGeneratingRequest=!1,"awaiting"===i.closingStatus.type&&i.closingStatus.start(),e.t0;case 26:if(void 0!==i){e.next=28;break}return e.abrupt("return",void 0);case 28:i.isGeneratingRequest=!1,"awaiting"===i.closingStatus.type&&i.closingStatus.start();case 30:case"end":return e.stop()}}),e,this,[[14,19]])})));return function(t,n,r){return e.apply(this,arguments)}}(),t.loadPersistentSession=function(){var e=(0,r.Z)(o().mark((function e(t,n){var r,i,a,s,l;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=re(this._storage);case 1:if((a=i()).done){e.next=8;break}if((s=a.value).mediaKeySession!==t){e.next=6;break}return r=s,e.abrupt("break",8);case 6:e.next=1;break;case 8:if(void 0!==r){e.next=11;break}return u.Z.error("DRM-LSS: loadPersistentSession error. No MediaKeySession found with the given initData and initDataType"),e.abrupt("return",G(t,n));case 11:if(r.isLoadingPersistentSession=!0,"none"===r.closingStatus.type){e.next=14;break}throw new Error("The `MediaKeySession` is being closed.");case 14:return e.prev=14,e.next=17,G(t,n);case 17:l=e.sent,e.next=27;break;case 20:if(e.prev=20,e.t0=e.catch(14),void 0!==r){e.next=24;break}throw e.t0;case 24:throw r.isLoadingPersistentSession=!1,"awaiting"===r.closingStatus.type&&r.closingStatus.start(),e.t0;case 27:if(void 0!==r){e.next=29;break}return e.abrupt("return",l);case 29:return r.isLoadingPersistentSession=!1,"awaiting"===r.closingStatus.type&&r.closingStatus.start(),e.abrupt("return",l);case 32:case"end":return e.stop()}}),e,this,[[14,20]])})));return function(t,n){return e.apply(this,arguments)}}(),t.closeSession=function(){var e=(0,r.Z)(o().mark((function e(t){var n,r,i,a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=re(this._storage);case 1:if((i=r()).done){e.next=8;break}if((a=i.value).mediaKeySession!==t){e.next=6;break}return n=a,e.abrupt("break",8);case 6:e.next=1;break;case 8:if(void 0!==n){e.next=11;break}return u.Z.warn("DRM-LSS: No MediaKeySession found with the given initData and initDataType"),e.abrupt("return",Promise.resolve(!1));case 11:return e.abrupt("return",this._closeEntry(n));case 12:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.getLength=function(){return this._storage.length},t.getAll=function(){return this._storage},t.closeAllSessions=function(){var e=(0,r.Z)(o().mark((function e(){var t,n,r=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this._storage,u.Z.debug("DRM-LSS: Closing all current MediaKeySessions",t.length),this._storage=[],n=t.map((function(e){return r._closeEntry(e)})),e.next=6,Promise.all(n);case 6:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),t.removeSessionWithoutClosingIt=function(e){(0,q.Z)(""===e.sessionId,"Initialized `MediaKeySession`s should always be properly closed");for(var t=this._storage.length-1;t>=0;t--){if(this._storage[t].mediaKeySession===e)return u.Z.debug("DRM-LSS: Removing session without closing it",e.sessionId),this._storage.splice(t,1),!0}return!1},t.getIndex=function(e){for(var t=0;t<this._storage.length;t++){if(this._storage[t].keySessionRecord===e)return t}return-1},t._closeEntry=function(){var e=(0,r.Z)(o().mark((function e(t){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.mediaKeySession,e.abrupt("return",new Promise((function(e,r){function i(){void 0!==t&&(t.closingStatus={type:"pending"}),oe(n).then((function(){void 0!==t&&(t.closingStatus={type:"done"}),e(!0)})).catch((function(e){void 0!==t&&(t.closingStatus={type:"failed"}),r(e)}))}void 0!==t&&(t.isLoadingPersistentSession||t.isGeneratingRequest)?t.closingStatus={type:"awaiting",start:i}:i()})));case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),e}();function oe(e){return se.apply(this,arguments)}function se(){return(se=(0,r.Z)(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u.Z.debug("DRM: Trying to close a MediaKeySession",t.sessionId),e.prev=1,e.next=4,W(t);case 4:return u.Z.debug("DRM: Succeeded to close MediaKeySession"),e.abrupt("return");case 8:return e.prev=8,e.t0=e.catch(1),u.Z.error("DRM: Could not close MediaKeySession: "+(e.t0 instanceof Error?e.t0.toString():"Unknown error")),e.abrupt("return");case 12:case"end":return e.stop()}}),e,null,[[1,8]])})))).apply(this,arguments)}var ue=n(9689);function le(e){for(var t=0,n=0;n<e.length;n++)t=(t<<5)-t+e[n],t&=t;return t}var de=n(6923),ce=function(){function e(e){this.initData=e}return e.prototype.toJSON=function(){return(0,ue.J)(this.initData)},e.decode=function(e){return(0,ue.K)(e)},e}();function fe(e,t){var n,r;return null!==(r=null!==(n=ve(e,t))&&void 0!==n?n:ve(t,e))&&void 0!==r&&r}function ve(e,t){if(0===e.length)return!1;if(t.length<e.length)return null;for(var n=e[0],r=0,i=0;i<t.length;i++){var a=t[i];if(a.systemId===n.systemId){if(a.hash!==n.hash)return!1;var o=n.data instanceof Uint8Array?n.data:"string"==typeof n.data?ce.decode(n.data):n.data.initData,s=a.data instanceof Uint8Array?a.data:"string"==typeof a.data?ce.decode(a.data):a.data.initData;if(!(0,d.Z)(o,s))return!1;if(t.length-i<e.length)return null;for(r=1;r<e.length;r++){var u=e[r];for(i+=1;i<t.length;i++){var l=t[i];if(u.systemId===l.systemId){if(u.hash!==l.hash)return!1;var c=u.data instanceof Uint8Array?u.data:"string"==typeof u.data?ce.decode(u.data):u.data.initData,f=l.data instanceof Uint8Array?l.data:"string"==typeof l.data?ce.decode(l.data):l.data.initData;if(!(0,d.Z)(c,f))return!1;break}}if(r===t.length)return null}return!0}}return null}function pe(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return he(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return he(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function he(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var me=function(){function e(e){!function(e){(0,q.u)(e,{save:"function",load:"function"},"persistentLicenseConfig")}(e),this._entries=[],this._storage=e;try{var t=this._storage.load();Array.isArray(t)||(t=[]),this._entries=t}catch(e){u.Z.warn("DRM-PSS: Could not get entries from license storage",e instanceof Error?e:""),this.dispose()}}var t=e.prototype;return t.getLength=function(){return this._entries.length},t.getAll=function(){return this._entries},t.get=function(e){var t=this._getIndex(e);return-1===t?null:this._entries[t]},t.getAndReuse=function(e){var t=this._getIndex(e);if(-1===t)return null;var n=this._entries.splice(t,1)[0];return this._entries.push(n),n},t.add=function(e,t,n){var r;if(!(0,E.Z)(n)&&(0,de.Z)(n.sessionId)){var i=n.sessionId,a=this._getIndex(e);if(a>=0){var o=void 0===t?3:4,s=this._entries[a];if((null!==(r=s.version)&&void 0!==r?r:-1)>=o&&i===s.sessionId)return;u.Z.info("DRM-PSS: Updating session info.",i),this._entries.splice(a,1)}else u.Z.info("DRM-PSS: Add new session",i);var l=e.values.getFormattedValues().map((function(e){var t=e.systemId,n=e.data;return{systemId:t,hash:e.hash,data:new ce(n)}}));void 0===t?this._entries.push({version:3,sessionId:i,values:l,initDataType:e.type}):this._entries.push({version:4,sessionId:i,keyIds:t.map((function(e){return new ce(e)})),values:l,initDataType:e.type}),this._save()}else u.Z.warn("DRM-PSS: Invalid Persisten Session given.")},t.delete=function(e){for(var t=-1,n=0;n<this._entries.length;n++){if(this._entries[n].sessionId===e){t=n;break}}if(-1!==t){var r=this._entries[t];u.Z.warn("DRM-PSS: Delete session from store",r.sessionId),this._entries.splice(t,1),this._save()}else u.Z.warn("DRM-PSS: initData to delete not found.")},t.deleteOldSessions=function(e){u.Z.info("DRM-PSS: Deleting last "+e+" sessions."),e<=0||(e<=this._entries.length?this._entries.splice(0,e):(u.Z.warn("DRM-PSS: Asked to remove more information that it contains",e,this._entries.length),this._entries=[]),this._save())},t.dispose=function(){this._entries=[],this._save()},t._getIndex=function(e){var t=this,n=null;function r(){if(null===n){var t=e.values.constructRequestData();n={initData:t,initDataHash:le(t)}}return n}for(var i=function(){var n=t._entries[a];if(n.initDataType===e.type)switch(n.version){case 4:if(void 0!==e.keyIds){if(e.keyIds.every((function(e){for(var t,r=(0,ue.J)(e),i=pe(n.keyIds);!(t=i()).done;){var a=t.value;if("string"==typeof a){if(r===a)return!0}else if(Q(a.initData,e))return!0}return!1})))return{v:a}}else if(fe(e.values.getFormattedValues(),n.values))return{v:a};break;case 3:if(fe(e.values.getFormattedValues(),n.values))return{v:a};break;case 2:var i=r(),o=i.initData,s=i.initDataHash;if(n.initDataHash===s)try{var l="string"==typeof n.initData?ce.decode(n.initData):n.initData.initData;if((0,d.Z)(l,o))return{v:a}}catch(e){u.Z.warn("DRM-PSS: Could not decode initialization data.",e instanceof Error?e:"")}break;case 1:var c=r(),f=c.initData,v=c.initDataHash;if(n.initDataHash===v){if(void 0===n.initData.length)return{v:a};if((0,d.Z)(n.initData,f))return{v:a}}break;default:var p=r().initDataHash;if(n.initData===p)return{v:a}}},a=0;a<this._entries.length;a++){var o=i();if("object"==typeof o)return o.v}return-1},t._save=function(){try{this._storage.save(this._entries)}catch(t){var e=t instanceof Error?t:void 0;u.Z.warn("DRM-PSS: Could not save MediaKeySession information",e)}},e}();var ge=new WeakMap,ye={prepare:function(e){ge.set(e,null)},set:function(e,t){var n=t instanceof Uint8Array?t:new Uint8Array(t instanceof ArrayBuffer?t:t.buffer),r=le(n);ge.set(e,{hash:r,serverCertificate:n})},hasOne:function(e){var t=ge.get(e);return void 0!==t&&(null!==t||void 0)},has:function(e,t){var n=ge.get(e);if(null==n)return!1;var r=n.hash,i=n.serverCertificate,a=t instanceof Uint8Array?t:new Uint8Array(t instanceof ArrayBuffer?t:t.buffer);if(le(a)!==r||i.length!==a.length)return!1;for(var o=0;o<i.length;o++)if(i[o]!==a[o])return!1;return!0}};function _e(e){if((0,E.Z)(e.persistentLicenseConfig))return null;var t=e.persistentLicenseConfig;if(null==t)throw new g.Z("INVALID_KEY_SYSTEM","No `persistentLicenseConfig` found for persistent license.");return u.Z.debug("DRM: Set the given license storage"),new me(t)}function be(e,t,n){return Se.apply(this,arguments)}function Se(){return(Se=(0,r.Z)(o().mark((function e(t,n,r){var i,a,s,l,d,c,f,v,p,h;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,F(t,n,r);case 2:if(i=e.sent,null===r.cancellationError){e.next=5;break}throw r.cancellationError;case 5:if(a=i.value,s=a.options,l=a.mediaKeySystemAccess,d=w.Z.getState(t),c=_e(s),O.$u||O.l_||null===d||"reuse-media-key-system-access"!==i.type){e.next=12;break}if(f=d.mediaKeys,v=d.loadedSessionsStore,!1!==ye.hasOne(f)&&((0,E.Z)(s.serverCertificate)||!ye.has(f,s.serverCertificate))){e.next=12;break}return e.abrupt("return",{mediaKeys:f,mediaKeySystemAccess:l,stores:{loadedSessionsStore:v,persistentSessionsStore:c},options:s});case 12:return e.next=14,Ee(l);case 14:return p=e.sent,u.Z.info("DRM: MediaKeys created with success"),h=new ae(p),e.abrupt("return",{mediaKeys:p,mediaKeySystemAccess:l,stores:{loadedSessionsStore:h,persistentSessionsStore:c},options:s});case 18:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ee(e){return Te.apply(this,arguments)}function Te(){return(Te=(0,r.Z)(o().mark((function e(t){var n,r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u.Z.info("DRM: Calling createMediaKeys on the MediaKeySystemAccess"),e.prev=1,e.next=4,t.createMediaKeys();case 4:return n=e.sent,e.abrupt("return",n);case 8:throw e.prev=8,e.t0=e.catch(1),r=e.t0 instanceof Error?e.t0.message:"Unknown error when creating MediaKeys.",new g.Z("CREATE_MEDIA_KEYS_ERROR",r);case 12:case"end":return e.stop()}}),e,null,[[1,8]])})))).apply(this,arguments)}function ke(){return(ke=(0,r.Z)(o().mark((function e(t,n,r){var i,a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,be(t,n,r);case 2:return i=e.sent,a=i.mediaKeys,null!==t.mediaKeys&&void 0!==t.mediaKeys&&a!==t.mediaKeys&&(u.Z.debug("DRM: Disabling old MediaKeys"),A(t)),e.abrupt("return",i);case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var we=n(7326),Ae=n(2146),Ie=n(2572);function Re(e){return new Promise((function(t){setTimeout(t,e)}))}var Ze=n(7904),xe=function(e){function t(n){var r;return r=e.call(this)||this,Object.setPrototypeOf((0,we.Z)(r),t.prototype),r.reason=n,r}return(0,i.Z)(t,e),t}((0,Ae.Z)(Error)),Pe={EXPIRED:"expired",INTERNAL_ERROR:"internal-error",OUTPUT_RESTRICTED:"output-restricted"};function Me(e,t,n){var r,i=t.onKeyInternalError,a=t.onKeyOutputRestricted,o=t.onKeyExpiration,s=[],l=[],d=[];return e.keyStatuses.forEach((function(e,t){var r="string"==typeof e?[e,t]:[t,e],c=r[0],v=function(e,t){return-1!==e.indexOf("playready")&&(O.YM||O.kD)?(0,f.wO)(t):t}(n,new Uint8Array(r[1])),p={keyId:v.buffer,keyStatus:c};switch(u.Z.hasLevel("DEBUG")&&u.Z.debug("DRM: key status update ("+(0,f.ci)(v)+"): "+c),c){case Pe.EXPIRED:var h=new g.Z("KEY_STATUS_CHANGE_ERROR","A decryption key expired ("+(0,f.ci)(v)+")",{keyStatuses:[p].concat(d)});if("error"===o||void 0===o)throw h;switch(o){case"close-session":throw new xe(h);case"fallback":s.push(v);break;default:"continue"===o||void 0===o?l.push(v):(0,Ze.Z)(o)}d.push(p);break;case Pe.INTERNAL_ERROR:var m=new g.Z("KEY_STATUS_CHANGE_ERROR",'A "'+c+'" status has been encountered ('+(0,f.ci)(v)+")",{keyStatuses:[p].concat(d)});switch(i){case void 0:case"error":throw m;case"close-session":throw new xe(m);case"fallback":s.push(v);break;case"continue":l.push(v);break;default:if(void 0===i)throw m;(0,Ze.Z)(i)}d.push(p);break;case Pe.OUTPUT_RESTRICTED:var y=new g.Z("KEY_STATUS_CHANGE_ERROR",'A "'+c+'" status has been encountered ('+(0,f.ci)(v)+")",{keyStatuses:[p].concat(d)});switch(a){case void 0:case"error":throw y;case"fallback":s.push(v);break;case"continue":l.push(v);break;default:if(void 0===a)throw y;(0,Ze.Z)(a)}d.push(p);break;default:l.push(v)}})),d.length>0&&(r=new g.Z("KEY_STATUS_CHANGE_ERROR","One or several problematic key statuses have been encountered",{keyStatuses:d})),{warning:r,blacklistedKeyIds:s,whitelistedKeyIds:l}}var Ce=s.Dl,De=s.RV,Ne=s.qo;function Oe(e,t,n,i,a){u.Z.info("DRM: Binding session events",e.sessionId);var s=t.getLicenseConfig,l=void 0===s?{}:s,d=new T.ZP;return d.linkToSignal(a),(0,E.Z)(e.closed)||e.closed.then((function(){return d.cancel()})).catch((function(e){a.isCancelled()||(d.cancel(),i.onError(e))})),Ce(e,(function(e){d.cancel(),i.onError(new g.Z("KEY_ERROR",e.type))}),d.signal),Ne(e,(function(){try{c()}catch(e){if(a.isCancelled()||d.isUsed()&&e instanceof T.XG)return;d.cancel(),i.onError(e)}}),d.signal),De(e,(function(n){var a,s=n,c=new Uint8Array(s.message),f=(0,de.Z)(s.messageType)?s.messageType:"license-request";u.Z.info("DRM: Received message event, type "+f,e.sessionId),function(e,t,n){var i=t.baseDelay,a=t.maxDelay,s=t.totalRetry,u=t.shouldRetry,l=t.onRetry,d=0;return c();function c(){return f.apply(this,arguments)}function f(){return(f=(0,r.Z)(o().mark((function t(){var r,f,v,p;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null===n.cancellationError){t.next=2;break}throw n.cancellationError;case 2:return t.prev=2,t.next=5,e();case 5:return r=t.sent,t.abrupt("return",r);case 9:if(t.prev=9,t.t0=t.catch(2),null===n.cancellationError){t.next=13;break}throw n.cancellationError;case 13:if(!(!(0,E.Z)(u)&&!u(t.t0)||d++>=s)){t.next=15;break}throw t.t0;case 15:return"function"==typeof l&&l(t.t0,d),f=Math.min(i*Math.pow(2,d-1),a),v=(0,Ie.Z)(f),t.next=20,Re(v);case 20:return p=c(),t.abrupt("return",p);case 22:case"end":return t.stop()}}),t,null,[[2,9]])})))).apply(this,arguments)}}((function(){return function(e,n){var r;return new Promise((function(i,a){try{u.Z.debug("DRM: Calling `getLicense`",n);var o=t.getLicense(e,n),s=(0,E.Z)(l.timeout)?1e4:l.timeout;s>=0&&(r=setTimeout((function(){a(new Fe('"getLicense" timeout exceeded ('+s+" ms)"))}),s)),Promise.resolve(o).then(d,c)}catch(e){c(e)}function d(e){void 0!==r&&clearTimeout(r),i(e)}function c(e){void 0!==r&&clearTimeout(r),a(e)}}))}(c,f)}),{totalRetry:null!=(a=l.retry)?a:2,baseDelay:200,maxDelay:3e3,shouldRetry:function(e){return e instanceof Fe||(0,E.Z)(e)||!0!==e.noRetry},onRetry:function(e){return i.onWarning(Le(e))}},d.signal).then((function(t){if(d.isUsed())return Promise.resolve();if((0,E.Z)(t))u.Z.info("DRM: No license given, skipping session.update");else try{return function(e,t){return Ue.apply(this,arguments)}(e,t)}catch(e){d.cancel(),i.onError(e)}})).catch((function(e){if(!d.isUsed()){d.cancel();var t=Le(e);if(!(0,E.Z)(e))if(!0===e.fallbackOnLastTry)return u.Z.warn("DRM: Last `getLicense` attempt failed. Blacklisting the current session."),void i.onError(new Be(t));i.onError(t)}}))}),d.signal),void c();function c(){if(u.Z.info("DRM: keystatuseschange event received",e.sessionId),!d.isUsed()&&0!==e.keyStatuses.size){var r=Me(e,t,n),a=r.warning,o=r.blacklistedKeyIds,s=r.whitelistedKeyIds;void 0!==a&&(i.onWarning(a),d.isUsed())||i.onKeyUpdate({whitelistedKeyIds:s,blacklistedKeyIds:o})}}}function Le(e){if(e instanceof Fe)return new g.Z("KEY_LOAD_TIMEOUT","The license server took too much time to respond.");var t=new g.Z("KEY_LOAD_ERROR","An error occured when calling `getLicense`.");return!(0,E.Z)(e)&&(0,de.Z)(e.message)&&(t.message=e.message),t}function Ue(){return(Ue=(0,r.Z)(o().mark((function e(t,n){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u.Z.info("DRM: Updating MediaKeySession with message"),e.prev=1,e.next=4,t.update(n);case 4:e.next=10;break;case 6:throw e.prev=6,e.t0=e.catch(1),r=e.t0 instanceof Error?e.t0.toString():"`session.update` failed",new g.Z("KEY_UPDATE_ERROR",r);case 10:u.Z.info("DRM: MediaKeySession update succeeded.");case 11:case"end":return e.stop()}}),e,null,[[1,6]])})))).apply(this,arguments)}var Be=function(e){function t(n){var r;return r=e.call(this)||this,Object.setPrototypeOf((0,we.Z)(r),t.prototype),r.sessionError=n,r}return(0,i.Z)(t,e),t}((0,Ae.Z)(Error)),Fe=function(e){function t(t){var n;return n=e.call(this)||this,Object.setPrototypeOf((0,we.Z)(n),Be.prototype),n.message=t,n}return(0,i.Z)(t,e),t}((0,Ae.Z)(Error)),ze=n(9822);function Ve(e,t){return Ke.apply(this,arguments)}function Ke(){return(Ke=(0,r.Z)(o().mark((function e(t,n){var r,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t.setServerCertificate(n);case 3:return r=e.sent,e.abrupt("return",r);case 7:throw e.prev=7,e.t0=e.catch(0),u.Z.warn("DRM: mediaKeys.setServerCertificate returned an error",e.t0 instanceof Error?e.t0:""),i=e.t0 instanceof Error?e.t0.toString():"`setServerCertificate` error",new g.Z("LICENSE_SERVER_CERTIFICATE_ERROR",i);case 12:case"end":return e.stop()}}),e,null,[[0,7]])})))).apply(this,arguments)}function Ge(e,t){return je.apply(this,arguments)}function je(){return(je=(0,r.Z)(o().mark((function e(t,n){var r,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!0!==ye.hasOne(t)){e.next=3;break}return u.Z.info("DRM: The MediaKeys already has a server certificate, skipping..."),e.abrupt("return",{type:"already-has-one"});case 3:if("function"==typeof t.setServerCertificate){e.next=6;break}return u.Z.warn("DRM: Could not set the server certificate. mediaKeys.setServerCertificate is not a function"),e.abrupt("return",{type:"method-not-implemented"});case 6:return u.Z.info("DRM: Setting server certificate on the MediaKeys"),ye.prepare(t),e.prev=8,e.next=11,Ve(t,n);case 11:return r=e.sent,ye.set(t,n),e.abrupt("return",{type:"success",value:r});case 16:return e.prev=16,e.t0=e.catch(8),i=(0,ze.Z)(e.t0)?e.t0:new g.Z("LICENSE_SERVER_CERTIFICATE_ERROR","Unknown error when setting the server certificate."),e.abrupt("return",{type:"error",value:i});case 20:case"end":return e.stop()}}),e,null,[[8,16]])})))).apply(this,arguments)}function He(e,t){if(!(isNaN(t)||t<0||t>=e.getLength())){var n=e.getLength(),r=n-t;u.Z.info("DRM: Too many stored persistent sessions, removing some.",n,r),e.deleteOldSessions(r)}}var We=n(9252);var qe=function(){function e(e){this._innerValues=e,this._lazyFormattedValues=null}var t=e.prototype;return t.constructRequestData=function(){return c.zo.apply(void 0,this._innerValues.map((function(e){return e.data})))},t.isCompatibleWith=function(t){var n=t instanceof e?t.getFormattedValues():t;return fe(this.getFormattedValues(),n)},t.getFormattedValues=function(){return null===this._lazyFormattedValues&&(this._lazyFormattedValues=this._innerValues.slice().sort((function(e,t){return e.systemId===t.systemId?0:void 0===e.systemId?1:void 0===t.systemId||e.systemId<t.systemId?-1:1})).map((function(e){var t=e.systemId,n=e.data;return{systemId:t,data:n,hash:le(n)}}))),this._lazyFormattedValues},e}();function Ye(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Xe(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Xe(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Xe(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Qe,$e=s.Zl,Je=function(e){function t(t,n){var r;r=e.call(this)||this,u.Z.debug("DRM: Starting ContentDecryptor logic.");var i=new T.ZP;return r._currentSessions=[],r._canceller=i,r._wasAttachCalled=!1,r._initDataQueue=[],r._stateData={state:Qe.Initializing,isMediaKeysAttached:!1,isInitDataQueueLocked:!0,data:null},r.error=null,$e(t,(function(e){u.Z.debug("DRM: Encrypted event received from media element.");var t=h(e);null!==t&&r.onInitializationData(t)}),i.signal),function(e,t,n){return ke.apply(this,arguments)}(t,n,i.signal).then((function(e){var n,i,a=e.options,o=e.mediaKeySystemAccess;((0,E.Z)(a.persistentLicenseConfig)||!0===a.persistentLicenseConfig.disableRetroCompatibility)&&(i=o.keySystem,n=(0,We.Z)(i,"com.microsoft.playready")||"com.chromecast.playready"===i||"com.youtube.playready"===i?"9a04f07998404286ab92e65be0885f95":"com.widevine.alpha"===i?"edef8ba979d64acea3c827dcd51d21ed":(0,We.Z)(i,"com.apple.fps")?"94ce86fb07ff4f43adb893d2fa968ca2":(0,We.Z)(i,"com.nagra.")?"adb41c242dbf4a6d958b4457c0d27b95":void 0),r.systemId=n,r._stateData.state===Qe.Initializing&&(r._stateData={state:Qe.WaitingForAttachment,isInitDataQueueLocked:!0,isMediaKeysAttached:!1,data:{mediaKeysInfo:e,mediaElement:t}},r.trigger("stateChange",r._stateData.state))})).catch((function(e){r._onFatalError(e)})),r}(0,i.Z)(t,e);var n=t.prototype;return n.getState=function(){return this._stateData.state},n.attach=function(){var e=this;if(this._stateData.state!==Qe.WaitingForAttachment)throw new Error("`attach` should only be called when in the WaitingForAttachment state");if(this._wasAttachCalled)u.Z.warn("DRM: ContentDecryptor's `attach` method called more than once.");else{this._wasAttachCalled=!0;var t=this._stateData.data,n=t.mediaElement,i=t.mediaKeysInfo,a=i.options,s=i.mediaKeys,l=i.mediaKeySystemAccess,d={loadedSessionsStore:i.stores.loadedSessionsStore,mediaKeySystemAccess:l,mediaKeys:s,keySystemOptions:a};!0===a.disableMediaKeysAttachmentLock&&(this._stateData={state:Qe.ReadyForContent,isInitDataQueueLocked:!0,isMediaKeysAttached:!1,data:null},this.trigger("stateChange",this._stateData.state),this._isStopped())||(u.Z.debug("DRM: Attaching current MediaKeys"),function(e,t,n){return I.apply(this,arguments)}(n,d,this._canceller.signal).then((0,r.Z)(o().mark((function t(){var n,r,u;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=a.serverCertificate,(0,E.Z)(n)){t.next=6;break}return t.next=4,Ge(s,n);case 4:"error"===(r=t.sent).type&&e.trigger("warning",r.value);case 6:if(!e._isStopped()){t.next=8;break}return t.abrupt("return");case 8:u=e._stateData.state,e._stateData={state:Qe.ReadyForContent,isMediaKeysAttached:!0,isInitDataQueueLocked:!1,data:{mediaKeysData:i}},u!==Qe.ReadyForContent&&e.trigger("stateChange",Qe.ReadyForContent),e._isStopped()||e._processCurrentInitDataQueue();case 12:case"end":return t.stop()}}),t)})))).catch((function(t){e._onFatalError(t)})))}},n.dispose=function(){this.removeEventListener(),this._stateData={state:Qe.Disposed,isMediaKeysAttached:void 0,isInitDataQueueLocked:void 0,data:null},this._canceller.cancel(),this.trigger("stateChange",this._stateData.state)},n.onInitializationData=function(e){var t=this;if(!1===this._stateData.isInitDataQueueLocked){var n=this._stateData.data.mediaKeysData,r=Object.assign(Object.assign({},e),{values:new qe(e.values)});this._processInitializationData(r,n).catch((function(e){t._onFatalError(e)}))}else{if(this._isStopped())throw new Error("ContentDecryptor either disposed or stopped.");this._initDataQueue.push(e)}},n._processInitializationData=function(){var e=(0,r.Z)(o().mark((function e(t,n){var r,i,a,s,l,d,c,v,p,h,y,b,S,T,k,w,A,I,R,Z,x,P,M,C,N,O,L,U,B,F,z,V,K,G=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=n.mediaKeySystemAccess,i=n.stores,a=n.options,!this._tryToUseAlreadyCreatedSession(t,n)&&!this._isStopped()){e.next=3;break}return e.abrupt("return");case 3:if("content"!==a.singleLicensePer){e.next=15;break}if(void 0===(s=(0,_.Z)(this._currentSessions,(function(e){return"created-session"===e.source})))){e.next=13;break}if(void 0!==(l=t.keyIds)){e.next=10;break}return void 0===t.content?u.Z.warn("DRM: Unable to fallback from a non-decipherable quality."):nt(t.content.manifest,t),e.abrupt("return");case 10:return s.record.associateKeyIds(l),void 0!==t.content&&(u.Z.hasLevel("DEBUG")&&(d=l.reduce((function(e,t){return e+", "+(0,f.ci)(t)}),""),u.Z.debug("DRM: Blacklisting new key ids",d)),tt(t.content.manifest,[],l,[])),e.abrupt("return");case 13:e.next=37;break;case 15:if("periods"!==a.singleLicensePer||void 0===t.content){e.next=37;break}c=t.content.period,v=this._currentSessions.filter((function(e){return"created-session"===e.source})),at(p=new Set,c),h=Ye(v);case 21:if((y=h()).done){e.next=37;break}b=y.value,S=Array.from(p),T=0,k=S;case 25:if(!(T<k.length)){e.next=35;break}if(w=k[T],!b.record.isAssociatedWithKeyId(w)){e.next=32;break}for(b.record.associateKeyIds(p.values()),A=Ye(S);!(I=A()).done;)$(R=I.value,b.keyStatuses.whitelisted)||$(R,b.keyStatuses.blacklisted)||b.keyStatuses.blacklisted.push(R);return tt(t.content.manifest,b.keyStatuses.whitelisted,b.keyStatuses.blacklisted,[]),e.abrupt("return");case 32:T++,e.next=25;break;case 35:e.next=21;break;case 37:return this._lockInitDataQueue(),(0,E.Z)(a.persistentLicenseConfig)?Z="temporary":et(r)?Z="persistent-license":(u.Z.warn('DRM: Cannot create "persistent-license" session: not supported'),Z="temporary"),x=m.Z.getCurrent(),P=x.EME_DEFAULT_MAX_SIMULTANEOUS_MEDIA_KEY_SESSIONS,M=x.EME_MAX_STORED_PERSISTENT_SESSION_INFORMATION,C="number"==typeof a.maxSessionCacheSize?a.maxSessionCacheSize:P,e.next=43,D(t,i,Z,C,this._canceller.signal);case 43:if(N=e.sent,!this._isStopped()){e.next=46;break}return e.abrupt("return");case 46:if(O={record:N.value.keySessionRecord,source:N.type,keyStatuses:{whitelisted:[],blacklisted:[]},blacklistedSessionError:null},this._currentSessions.push(O),L=N.value,U=L.mediaKeySession,B=L.sessionType,F=!1,Oe(U,a,r.keySystem,{onKeyUpdate:function(e){var n=rt(t,O.record,a.singleLicensePer,"created-session"===O.source,e.whitelistedKeyIds,e.blacklistedKeyIds);if(O.record.associateKeyIds(n.whitelisted),O.record.associateKeyIds(n.blacklisted),O.keyStatuses={whitelisted:n.whitelisted,blacklisted:n.blacklisted},0!==O.record.getAssociatedKeyIds().length&&"persistent-license"===B&&null!==i.persistentSessionsStore&&!F){var r=i.persistentSessionsStore;He(r,M-1),r.add(t,O.record.getAssociatedKeyIds(),U),F=!0}void 0!==t.content&&tt(t.content.manifest,n.whitelisted,n.blacklisted,[]),G._unlockInitDataQueue()},onWarning:function(e){G.trigger("warning",e)},onError:function(e){var n;if(e instanceof xe){u.Z.warn("DRM: A session's closing condition has been triggered"),G._lockInitDataQueue();var r=G._currentSessions.indexOf(O);return r>=0&&G._currentSessions.splice(r),void 0!==t.content&&tt(t.content.manifest,[],[],O.record.getAssociatedKeyIds()),null===(n=i.persistentSessionsStore)||void 0===n||n.delete(U.sessionId),i.loadedSessionsStore.closeSession(U).catch((function(e){var t=e instanceof Error?e:"unknown error";u.Z.warn("DRM: failed to close expired session",t)})).then((function(){return G._unlockInitDataQueue()})).catch((function(e){return G._onFatalError(e)})),void(G._isStopped()||G.trigger("warning",e.reason))}if(e instanceof Be){if(O.blacklistedSessionError=e,void 0!==t.content){var a=t.content.manifest;u.Z.info("DRM: blacklisting Representations based on protection data."),nt(a,t)}G._unlockInitDataQueue()}else G._onFatalError(e)}},this._canceller.signal),void 0!==a.singleLicensePer&&"init-data"!==a.singleLicensePer||this._unlockInitDataQueue(),"created-session"!==N.type){e.next=67;break}return z=t.values.constructRequestData(),e.prev=54,e.next=57,i.loadedSessionsStore.generateLicenseRequest(U,t.type,z);case 57:e.next=67;break;case 59:if(e.prev=59,e.t0=e.catch(54),null!==(V=i.loadedSessionsStore.getEntryForSession(U))&&"none"===V.closingStatus.type){e.next=66;break}return(K=this._currentSessions.indexOf(O))>=0&&this._currentSessions.splice(K,1),e.abrupt("return",Promise.resolve());case 66:throw new g.Z("KEY_GENERATE_REQUEST_ERROR",e.t0 instanceof Error?e.t0.toString():"Unknown error");case 67:return e.abrupt("return",Promise.resolve());case 68:case"end":return e.stop()}}),e,this,[[54,59]])})));return function(t,n){return e.apply(this,arguments)}}(),n._tryToUseAlreadyCreatedSession=function(e,t){var n=t.stores,r=t.options,i=(0,_.Z)(this._currentSessions,(function(t){return t.record.isCompatibleWith(e)}));if(void 0===i)return!1;var a=i.blacklistedSessionError;if(!(0,E.Z)(a))return void 0===e.type||void 0===e.content?(u.Z.error("DRM: This initialization data has already been blacklisted but the current content is not known."),!0):(u.Z.info("DRM: This initialization data has already been blacklisted. Blacklisting the related content."),nt(e.content.manifest,e),!0);if(void 0!==e.keyIds){var o;if(void 0===r.singleLicensePer||"init-data"===r.singleLicensePer){var s=i.keyStatuses.blacklisted;o=function(e,t){for(var n,r=function(){var e=n.value;if(t.some((function(t){return Q(t,e)})))return{v:!0}},i=Y(e);!(n=i()).done;){var a=r();if("object"==typeof a)return a.v}return!1}(e.keyIds,s)}else{var l=i.keyStatuses.whitelisted;o=!J(e.keyIds,l)}if(o)return void 0===e.content?(u.Z.error("DRM: Cannot forbid key id, the content is unknown."),!0):(u.Z.info("DRM: Current initialization data is linked to blacklisted keys. Marking Representations as not decipherable"),tt(e.content.manifest,[],e.keyIds,[]),!0)}if(null!==n.loadedSessionsStore.reuse(e))return u.Z.debug("DRM: Init data already processed. Skipping it."),!0;var d=this._currentSessions.indexOf(i);return-1===d?u.Z.error("DRM: Unable to remove processed init data: not found."):(u.Z.debug("DRM: A session from a processed init data is not available anymore. Re-processing it."),this._currentSessions.splice(d,1)),!1},n._onFatalError=function(e){if(!this._canceller.isUsed()){var t=e instanceof Error?e:new y.Z("NONE","Unknown decryption error");this.error=t,this._initDataQueue.length=0,this._stateData={state:Qe.Error,isMediaKeysAttached:void 0,isInitDataQueueLocked:void 0,data:null},this._canceller.cancel(),this.trigger("error",t),this._stateData.state===Qe.Error&&this.trigger("stateChange",this._stateData.state)}},n._isStopped=function(){return this._stateData.state===Qe.Disposed||this._stateData.state===Qe.Error},n._processCurrentInitDataQueue=function(){for(;!1===this._stateData.isInitDataQueueLocked;){var e=this._initDataQueue.shift();if(void 0===e)return;this.onInitializationData(e)}},n._lockInitDataQueue=function(){!1===this._stateData.isInitDataQueueLocked&&(this._stateData.isInitDataQueueLocked=!0)},n._unlockInitDataQueue=function(){!0===this._stateData.isMediaKeysAttached?(this._stateData.isInitDataQueueLocked=!1,this._processCurrentInitDataQueue()):u.Z.error("DRM: Trying to unlock in the wrong state")},t}(S.Z);function et(e){var t=e.getConfiguration().sessionTypes;return void 0!==t&&(0,b.Z)(t,"persistent-license")}function tt(e,t,n,r){e.updateRepresentationsDeciperability((function(e){if(void 0===e.contentProtections)return e.decipherable;var i=e.contentProtections.keyIds;if(void 0!==i)for(var a,o=Ye(i);!(a=o()).done;){for(var s,u=a.value,l=Ye(n);!(s=l()).done;){if(Q(s.value,u.keyId))return!1}for(var d,c=Ye(t);!(d=c()).done;){if(Q(d.value,u.keyId))return!0}for(var f,v=Ye(r);!(f=v()).done;){if(Q(f.value,u.keyId))return}}return e.decipherable}))}function nt(e,t){e.updateRepresentationsDeciperability((function(e){var n,r;if(!1===e.decipherable)return!1;for(var i,a=function(){var e=i.value;if((void 0===t.type||e.type===t.type)&&t.values.getFormattedValues().every((function(t){return e.values.some((function(e){return(void 0===t.systemId||e.systemId===t.systemId)&&(0,d.Z)(e.data,t.data)}))})))return{v:!1}},o=Ye(null!==(r=null===(n=e.contentProtections)||void 0===n?void 0:n.initData)&&void 0!==r?r:[]);!(i=o()).done;){var s=a();if("object"==typeof s)return s.v}return e.decipherable}))}function rt(e,t,n,r,i,a){for(var o,s,l=[].concat(i,a),d=function(){var e=s.value;l.some((function(t){return Q(t,e)}))||(u.Z.hasLevel("DEBUG")&&u.Z.debug("DRM: KeySessionRecord's key missing in the license, blacklisting it",(0,f.ci)(e)),l.push(e))},c=Ye(t.getAssociatedKeyIds());!(s=c()).done;)d();if(void 0!==n&&"init-data"!==n){var v=e.keyIds,p=e.content;if(void 0!==v){var h=v.filter((function(e){return!l.some((function(t){return Q(t,e)}))}));h.length>0&&(u.Z.hasLevel("DEBUG")&&u.Z.debug("DRM: init data keys missing in the license, blacklisting them",h.map((function(e){return(0,f.ci)(e)})).join(", ")),l.push.apply(l,h))}if(r&&void 0!==p)if("content"===n){for(var m,g=new Set,y=Ye(p.manifest.periods);!(m=y()).done;){at(g,m.value)}it(g,l)}else if("periods"===n)for(var _,b=Ye(p.manifest.periods);!(_=b()).done;){var S=_.value,E=new Set;if(at(E,S),(null===(o=e.content)||void 0===o?void 0:o.period.id)===S.id)it(E,l);else for(var T=Array.from(E),k=function(){var e=A[w];if(l.some((function(t){return Q(t,e)})))return it(E,l),"break"},w=0,A=T;w<A.length;w++){if("break"===k())break}}}return{whitelisted:i,blacklisted:l.slice(i.length)}}function it(e,t){for(var n=Array.from(e.values()),r=function(){var e=a[i];t.some((function(t){return Q(t,e)}))||t.push(e)},i=0,a=n;i<a.length;i++)r()}function at(e,t){for(var n,r=Ye(t.getAdaptations());!(n=r()).done;)for(var i,a=Ye(n.value.representations);!(i=a()).done;){var o=i.value;if(void 0!==o.contentProtections&&void 0!==o.contentProtections.keyIds)for(var s,u=Ye(o.contentProtections.keyIds);!(s=u()).done;){var l=s.value;e.add(l.keyId)}}}!function(e){e[e.Initializing=0]="Initializing",e[e.WaitingForAttachment=1]="WaitingForAttachment",e[e.ReadyForContent=2]="ReadyForContent",e[e.Error=3]="Error",e[e.Disposed=4]="Disposed"}(Qe||(Qe={}))},1266:function(e,t,n){"use strict";var r=n(276);t.ZP=r.Z},770:function(e,t){"use strict";var n=new WeakMap;t.Z={setState:function(e,t){n.set(e,t)},getState:function(e){var t=n.get(e);return void 0===t?null:t},clearState:function(e){n.set(e,null)}}},9372:function(e,t,n){"use strict";n.d(t,{Z:function(){return p}});var r=n(4578),i=n(5767),a=n(3887),o=n(5095),s=n(288),u=n(379),l=n(1757),d=n(8833),c=n(8799),f=n(6199),v=n(4576),p=function(e){function t(t){var n;return(n=e.call(this)||this)._settings=t,n._initCanceller=new s.ZP,n}(0,r.Z)(t,e);var n=t.prototype;return n.prepare=function(){},n.start=function(e,t){var n=this,r=this._initCanceller.signal,s=this._settings,u=s.keySystems,l=s.speed,d=s.url;if((0,i.Z)(e),null==d)throw new Error("No URL for a DirectFile content");var p=(0,o.ZP)(null);p.finish();var h=(0,c.Z)(e,u,p,{onError:function(e){return n._onFatalError(e)},onWarning:function(e){return n.trigger("warning",e)}},r);(0,v.Z)(e,(function(e){return n._onFatalError(e)}),r);var m=new f.Z(t,null,null,l);m.addEventListener("stalled",(function(e){return n.trigger("stalled",e)})),m.addEventListener("unstalled",(function(){return n.trigger("unstalled",null)})),m.addEventListener("warning",(function(e){return n.trigger("warning",e)})),r.register((function(){m.destroy()})),m.start(),h.onUpdate((function(o,s){"uninitialized"!==o.initializationState.type&&(s(),a.Z.info("Setting URL to HTMLMediaElement",d),e.src=d,r.register((function(){(0,i.Z)(e)})),"awaiting-media-link"===o.initializationState.type?(o.initializationState.value.isMediaLinked.setValue(!0),h.onUpdate((function(r,i){if("initialized"===r.initializationState.type)return i(),void n._seekAndPlay(e,t)}),{emitCurrentValue:!0,clearSignal:r})):n._seekAndPlay(e,t))}),{emitCurrentValue:!0,clearSignal:r})},n.updateContentUrls=function(e,t){throw new Error("Cannot update content URL of directfile contents")},n.dispose=function(){this._initCanceller.cancel()},n._onFatalError=function(e){this._initCanceller.cancel(),this.trigger("error",e)},n._seekAndPlay=function(e,t){var n=this,r=this._initCanceller.signal,i=this._settings,o=i.autoPlay,s=i.startAt;(0,d.Z)(e,t,(function(){a.Z.debug("Init: Calculating initial time");var t=function(e,t){if(null==t)return 0;if(null!=t.position)return t.position;if(null!=t.wallClockTime)return t.wallClockTime;if(null!=t.fromFirstPosition)return t.fromFirstPosition;var n=e.duration;if(null==n||!isFinite(n))return a.Z.warn("startAt.fromLastPosition set but no known duration, beginning at 0."),0;if("number"==typeof t.fromLastPosition)return Math.max(0,n+t.fromLastPosition);if(null!=t.percentage){var r=t.percentage;return r>=100?n:r<=0?0:n*(+r/100)}return 0}(e,s);return a.Z.debug("Init: Initial time calculated:",t),t}),o,(function(e){return n.trigger("warning",e)}),r).autoPlayResult.then((function(){return(0,l.Z)(t,e,!0,r).onUpdate((function(e,t){e&&(t(),n.trigger("loaded",{segmentBuffersStore:null}))}),{emitCurrentValue:!0,clearSignal:r})})).catch((function(e){r.isCancelled()||n._onFatalError(e)}))},t}(u.K)},379:function(e,t,n){"use strict";n.d(t,{K:function(){return i}});var r=n(4578),i=function(e){function t(){return e.apply(this,arguments)||this}return(0,r.Z)(t,e),t}(n(1959).Z)},1757:function(e,t,n){"use strict";n.d(t,{Z:function(){return s}});var r=n(3666);var i=n(1669),a=n(5095),o=n(288);function s(e,t,n,s){var u=new o.ZP;u.linkToSignal(s);var l=(0,a.ZP)(!1,u.signal);return e.listen((function(e){if(null===e.rebuffering&&null===e.freezing&&0!==e.readyState)return!function(e,t){return!e||!r.SB||t}(n,t.hasAttribute("playsinline"))&&t.duration>0||e.readyState>=3&&null!==e.currentRange&&(!(0,i.Z)()||t.duration>0)?(l.setValue(!0),void u.cancel()):void 0}),{includeLastObservation:!0,clearSignal:u.signal}),l}},8833:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r=n(1669),i=n(3774),a=n(3714),o=n(3887),s=n(5095);function u(e,t,n,u,l,d){var c,f,v=new Promise((function(e,t){c=e,f=t})),p=(0,s.$l)(!1,d),h=(0,s.$l)(!1,d);e.addEventListener("loadedmetadata",g),e.readyState>=i.c.HAVE_METADATA&&g();var m=d.register((function(t){e.removeEventListener("loadedmetadata",g),f(t)}));return{autoPlayResult:v,initialPlayPerformed:h,initialSeekPerformed:p};function g(){e.removeEventListener("loadedmetadata",g);var i="function"==typeof n?n():n;if(o.Z.info("Init: Set initial time",i),t.setCurrentTime(i),p.setValue(!0),p.finish(),(0,r.Z)()&&0===e.duration){var s=new a.Z("MEDIA_ERR_NOT_LOADED_METADATA","Cannot load automatically: your browser falsely announced having loaded the content.");l(s)}d.isCancelled()||t.listen((function(t,n){!t.seeking&&null===t.rebuffering&&t.readyState>=1&&(n(),function(){var t,n;if(o.Z.info("Init: Can begin to play content"),!u)return e.autoplay&&o.Z.warn("Init: autoplay is enabled on HTML media element. Media will play as soon as possible."),h.setValue(!0),h.finish(),m(),c({type:"skipped"});try{n=null!==(t=e.play())&&void 0!==t?t:Promise.resolve()}catch(e){return m(),f(e)}n.then((function(){if(!d.isCancelled())return h.setValue(!0),h.finish(),m(),c({type:"autoplay"})})).catch((function(e){if(m(),!d.isCancelled()){if(e instanceof Error&&"NotAllowedError"===e.name){o.Z.warn("Init: Media element can't play. It may be due to browser auto-play policies.");var t=new a.Z("MEDIA_ERR_BLOCKED_AUTOPLAY","Cannot trigger auto-play automatically: your browser does not allow it.");if(l(t),d.isCancelled())return;return c({type:"autoplay-blocked"})}f(e)}}))}())}),{includeLastObservation:!0,clearSignal:d})}}},8799:function(e,t,n){"use strict";n.d(t,{Z:function(){return d}});var r=n(6139);var i=n(5157),a=n(3887),o=n(5095),s=n(288),u=n(1266),l=n(276);function d(e,t,n,d,c){if(0===t.length){n.onUpdate((function(e,t){if(null!==e){t(),a.Z.error("Init: Encrypted event but EME feature not activated");var n=new i.Z("MEDIA_IS_ENCRYPTED_ERROR","EME feature not activated.");d.onError(n)}}),{clearSignal:c});var f=(0,o.ZP)({initializationState:{type:"initialized",value:null},drmSystemId:void 0});return f.finish(),f}if("function"!=typeof r.N){n.onUpdate((function(e,t){if(null!==e){t(),a.Z.error("Init: Encrypted event but no EME API available");var n=new i.Z("MEDIA_IS_ENCRYPTED_ERROR","Encryption APIs not found.");d.onError(n)}}),{clearSignal:c});var v=(0,o.ZP)({initializationState:{type:"initialized",value:null},drmSystemId:void 0});return v.finish(),v}var p=new s.ZP;p.linkToSignal(c);var h=(0,o.ZP)({initializationState:{type:"uninitialized",value:null},drmSystemId:void 0},c);a.Z.debug("Init: Creating ContentDecryptor");var m=new u.ZP(e,t);return m.addEventListener("stateChange",(function(e){if(e===l.u.WaitingForAttachment){var t=(0,o.ZP)(!1);t.onUpdate((function(t,n){t&&(n(),e===l.u.WaitingForAttachment&&m.attach())}),{clearSignal:p.signal}),h.setValue({initializationState:{type:"awaiting-media-link",value:{isMediaLinked:t}},drmSystemId:m.systemId})}else e===l.u.ReadyForContent&&(h.setValue({initializationState:{type:"initialized",value:null},drmSystemId:m.systemId}),m.removeEventListener("stateChange"))})),m.addEventListener("error",(function(e){p.cancel(),d.onError(e)})),m.addEventListener("warning",(function(e){d.onWarning(e)})),n.onUpdate((function(e){null!==e&&m.onInitializationData(e)}),{clearSignal:p.signal}),p.signal.register((function(){m.dispose()})),h}},6199:function(e,t,n){"use strict";n.d(t,{Z:function(){return p}});var r=n(4578),i=n(3666).yS,a=n(6872),o=n(3714),s=n(3887),u=n(1959),l=n(2829),d=n(288);function c(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return f(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return f(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var v=1/60,p=function(e){function t(t,n,r,i){var a;return(a=e.call(this)||this)._playbackObserver=t,a._manifest=n,a._segmentBuffersStore=r,a._speed=i,a._discontinuitiesStore=[],a._isStarted=!1,a._canceller=new d.ZP,a._currentFreezeTimestamp=null,a}(0,r.Z)(t,e);var n=t.prototype;return n.start=function(){var e=this;if(!this._isStarted){var t;this._isStarted=!0;var n=null,r=new g(this._playbackObserver,this._speed);this._canceller.signal.register((function(){r.dispose()}));var o=null;this._playbackObserver.listen((function(u){var d,c=e._discontinuitiesStore,f=u.buffered,p=u.position,h=u.readyState,g=u.rebuffering,y=u.freezing,_=a.Z.getCurrent(),b=_.BUFFER_DISCONTINUITY_THRESHOLD,S=_.FORCE_DISCONTINUITY_SEEK_DELAY,E=_.FREEZING_STALLED_DELAY,T=_.UNFREEZING_SEEK_DELAY,k=_.UNFREEZING_DELTA_POSITION;if(!u.seeking&&i&&null===n&&null!==t&&u.position<t){s.Z.debug("Init: the device appeared to have seeked back by itself.");var w=performance.now();n=w}if(t=u.seeking?Math.max(null!==(d=u.pendingInternalSeek)&&void 0!==d?d:0,u.position):null,!e._checkDecipherabilityFreeze(u)){if(null!==y){var A=performance.now();if(A-(null===o?y.timestamp:o.attemptTimestamp)>T&&(s.Z.warn("Init: trying to seek to un-freeze player"),e._playbackObserver.setCurrentTime(e._playbackObserver.getCurrentTime()+k),o={attemptTimestamp:A}),A-y.timestamp>E)return null===g||null!==n?r.stopRebuffering():r.startRebuffering(),void e.trigger("stalled","freezing")}else o=null;var I;if(null===g)return r.stopRebuffering(),1===h?(I=u.seeking?null!==u.pendingInternalSeek?"internal-seek":"seeking":"not-ready",void e.trigger("stalled",I)):void e.trigger("unstalled",null);var R="seeking"===g.reason&&null!==u.pendingInternalSeek?"internal-seek":g.reason;if(null!==n){var Z=performance.now();if(Z-n<S)return r.stopRebuffering(),s.Z.debug("Init: letting the device get out of a stall by itself"),void e.trigger("stalled",R);s.Z.warn("Init: ignored stall for too long, considering it",Z-n)}if(n=null,r.startRebuffering(),null!==e._manifest){var x=g.position;if(null!=x&&e._speed.getValue()>0){var P=function(e,t,n){if(0===e.length)return null;for(var r=null,i=0;i<e.length;i++){var a=e[i].period;if(a.start>n)return r;var o=void 0;if(void 0===a.end||a.end>n){var u=e[i],l=u.discontinuity,d=u.position,c=l.start,f=l.end;if(n>=(null!=c?c:d)-v)if(null===f){var p=t.getPeriodAfter(a);null!==p?o=p.start+v:s.Z.warn("Init: discontinuity at Period's end but no next Period")}else n<f+v&&(o=f+v);void 0!==o&&(s.Z.info("Init: discontinuity found",n,o),r=null!==r&&r>o?r:o)}}return r}(c,e._manifest,x);if(null!==P){var M=P+.001;if(!(M<=e._playbackObserver.getCurrentTime()))return s.Z.warn("SA: skippable discontinuity found in the stream",p,M),e._playbackObserver.setCurrentTime(M),void e.trigger("warning",m(x,M));s.Z.info("Init: position to seek already reached, no seeking",e._playbackObserver.getCurrentTime(),M)}}var C=null!=x?x:p,D=(0,l.XS)(f,C);if(e._speed.getValue()>0&&D<b){var N=C+D+v;if(e._playbackObserver.getCurrentTime()<N)return s.Z.warn("Init: discontinuity encountered inferior to the threshold",C,N,b),e._playbackObserver.setCurrentTime(N),void e.trigger("warning",m(C,N))}for(var O=e._manifest.periods.length-2;O>=0;O--){var L=e._manifest.periods[O];if(void 0!==L.end&&L.end<=C){if(e._manifest.periods[O+1].start>C&&e._manifest.periods[O+1].start>e._playbackObserver.getCurrentTime()){var U=e._manifest.periods[O+1];return e._playbackObserver.setCurrentTime(U.start),void e.trigger("warning",m(C,U.start))}break}}e.trigger("stalled",R)}else e.trigger("stalled",R)}}),{includeLastObservation:!0,clearSignal:this._canceller.signal})}},n.updateDiscontinuityInfo=function(e){this._isStarted||this.start();var t=this._playbackObserver.getReference().getValue();!function(e,t,n){for(;e.length>0&&void 0!==e[0].period.end&&e[0].period.end+10<n.position;)e.shift();var r=t.period,i=t.bufferType;if("audio"!==i&&"video"!==i)return;for(var a=0;a<e.length;a++)if(e[a].period.id===r.id){if(e[a].bufferType===i)return void(h(t)?e[a]=t:e.splice(a,1))}else if(e[a].period.start>r.start)return void(h(t)&&e.splice(a,0,t));h(t)&&e.push(t)}(this._discontinuitiesStore,e,t)},n.onLockedStream=function(e,t){var n;this._isStarted||this.start();var r=this._playbackObserver.getReference().getValue();if(!(!r.rebuffering||r.paused||this._speed.getValue()<=0||"audio"!==e&&"video"!==e)){var i=r.position,a=null!==(n=r.rebuffering.position)&&void 0!==n?n:i,o=t.start;i<o&&Math.abs(a-o)<1&&(s.Z.warn("Init: rebuffering because of a future locked stream.\nTrying to unlock by seeking to the next Period"),this._playbackObserver.setCurrentTime(o+.001))}},n.destroy=function(){this._canceller.cancel()},n._checkDecipherabilityFreeze=function(e){var t=e.readyState,n=e.rebuffering,r=e.freezing,i=void 0!==e.bufferGap&&isFinite(e.bufferGap)?e.bufferGap:0;if(null===this._segmentBuffersStore||i<6||null===n&&null===r||t>1)return this._currentFreezeTimestamp=null,!1;var a=performance.now();null===this._currentFreezeTimestamp&&(this._currentFreezeTimestamp=a);var o=null!==n&&a-n.timestamp>4e3,u=null!==r&&a-r.timestamp>4e3;if((o||u)&&performance.now()-this._currentFreezeTimestamp>4e3){for(var l=!0,d=!0,f=0,v=[this._segmentBuffersStore.getStatus("audio"),this._segmentBuffersStore.getStatus("video")];f<v.length;f++){var p=v[f];if("initialized"===p.type)for(var h,m=c(p.value.getInventory());!(h=m()).done;){var g=h.value.infos.representation;if(!1===g.decipherable)return s.Z.warn("Init: we have undecipherable segments left in the buffer, reloading"),this._currentFreezeTimestamp=null,this.trigger("needsReload",null),!0;void 0!==g.contentProtections&&(d=!1,!0!==g.decipherable&&(l=!1))}}if(!d&&l)return s.Z.warn("Init: we are frozen despite only having decipherable segments left in the buffer, reloading"),this._currentFreezeTimestamp=null,this.trigger("needsReload",null),!0}return!1},t}(u.Z);function h(e){return null!==e.discontinuity}function m(e,t){return new o.Z("DISCONTINUITY_ENCOUNTERED","A discontinuity has been encountered at position "+String(e)+", seeked at position "+String(t))}var g=function(){function e(e,t){this._speedUpdateCanceller=new d.ZP,this._isRebuffering=!1,this._playbackObserver=e,this._isDisposed=!1,this._speed=t,this._updateSpeed()}var t=e.prototype;return t.startRebuffering=function(){this._isRebuffering||this._isDisposed||(this._isRebuffering=!0,this._speedUpdateCanceller.cancel(),s.Z.info("Init: Pause playback to build buffer"),this._playbackObserver.setPlaybackRate(0))},t.stopRebuffering=function(){this._isRebuffering&&!this._isDisposed&&(this._isRebuffering=!1,this._speedUpdateCanceller=new d.ZP,this._updateSpeed())},t.dispose=function(){this._speedUpdateCanceller.cancel(),this._isDisposed=!0},t._updateSpeed=function(){var e=this;this._speed.onUpdate((function(t){s.Z.info("Init: Resume playback speed",t),e._playbackObserver.setPlaybackRate(t)}),{clearSignal:this._speedUpdateCanceller.signal,emitCurrentValue:!0})},e}()},4576:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(3714),i=n(1946);function a(e,t,n){function a(){var n,a,o=e.error;switch((0,i.Z)(o)||(n=o.code,a=o.message),n){case 1:return a=null!=a?a:"The fetching of the associated resource was aborted by the user's request.",t(new r.Z("MEDIA_ERR_ABORTED",a));case 2:return a=null!=a?a:"A network error occurred which prevented the media from being successfully fetched",t(new r.Z("MEDIA_ERR_NETWORK",a));case 3:return a=null!=a?a:"An error occurred while trying to decode the media resource",t(new r.Z("MEDIA_ERR_DECODE",a));case 4:return a=null!=a?a:"The media resource has been found to be unsuitable.",t(new r.Z("MEDIA_ERR_SRC_NOT_SUPPORTED",a));default:return a=null!=a?a:"The HTMLMediaElement errored due to an unknown reason.",t(new r.Z("MEDIA_ERR_UNKNOWN",a))}}n.isCancelled()||(e.addEventListener("error",a),n.register((function(){e.removeEventListener("error",a)})))}},5192:function(e,t,n){"use strict";n.d(t,{Z:function(){return k}});var r=n(4578),i=n(3038),a=n(3887),o=n(5095),s=n(2203).Z?void 0:window.ResizeObserver;var u=n(6872),l=n(288),d=n(9612),c=n(4309),f=n(7874);function v(e,t){return Math.abs(e-t)<=.2}function p(e,t){for(var n=e.length-1;n>=0;n--){if(e[n].start<t)return e.slice(0,n+1)}return[]}function h(e,t){for(var n=0;n<e.length;n++){if(e[n].end>t)return e.slice(n,e.length)}return[]}function m(e,t,n){var r=Math.max(e.start,t),i=p(e.cues,t),a={start:e.start,end:r,cues:i},o=Math.min(n,e.end),s=h(e.cues,n);return[a,{start:o,end:e.end,cues:s}]}var g=function(){function e(){this._cuesBuffer=[]}var t=e.prototype;return t.get=function(e){for(var t=this._cuesBuffer,n=[],r=t.length-1;r>=0;r--){var i=t[r];if(e<i.end&&e>=i.start){for(var a=i.cues,o=0;o<a.length;o++)e>=a[o].start&&e<a[o].end&&n.push(a[o].element);return n}}return[]},t.remove=function(e,t){for(var n=Math.max(e,t),r=this._cuesBuffer,i=0;i<r.length;i++)if(r[i].end>e){var a=r[i];if(a.start>=n)return;if(a.end>=n){if(e<=a.start)a.cues=h(a.cues,n),a.start=n;else{var o=m(a,e,n),s=o[0],u=o[1];this._cuesBuffer[i]=s,r.splice(i+1,0,u)}return}a.start>=e?(r.splice(i,1),i--):(a.cues=p(a.cues,e),a.end=Math.max(e,a.start))}},t.insert=function(e,t,n){var r=this._cuesBuffer,i={start:t,end:n,cues:e};function a(e){var t=r[e];void 0===t||v(i.end,t.end)?r[e]=i:(t.start>=i.end||(t.cues=h(t.cues,i.end),t.start=i.end),r.splice(e,0,i))}for(var o=0;o<r.length;o++){var s=r[o];if(t<s.end){if(v(t,s.start)){if(v(n,s.end))return void(r[o]=i);if(n<s.end)return s.cues=h(s.cues,n),s.start=n,void r.splice(o,0,i);do{r.splice(o,1),s=r[o]}while(void 0!==s&&n>s.end);return void a(o)}if(t<s.start){if(n<s.start)return void r.splice(o,0,i);if(v(n,s.start))return s.start=n,void r.splice(o,0,i);if(v(n,s.end))return void r.splice(o,1,i);if(n<s.end)return s.cues=h(s.cues,n),s.start=n,void r.splice(o,0,i);do{r.splice(o,1),s=r[o]}while(void 0!==s&&n>s.end);return void a(o)}if(v(s.end,n))return s.cues=p(s.cues,t),s.end=t,void r.splice(o+1,0,i);if(s.end>n){var u=m(s,t,n),l=u[0],d=u[1];return this._cuesBuffer[o]=l,r.splice(o+1,0,i),void r.splice(o+2,0,d)}s.cues=p(s.cues,t),s.end=t;var c=o+1;for(s=r[c];void 0!==s&&n>s.end;)r.splice(c,1),s=r[c];return void a(c)}}r.push(i)},e}();function y(e,t,n,r){for(var i=[t/n.columns,e/n.rows],a=r.getElementsByClassName("proportional-style"),o=0;o<a.length;o++){var s=a[o];if(s instanceof HTMLElement){var u=s.getAttribute("data-proportional-font-size");null===u||isNaN(+u)||(s.style.fontSize=String(+u*i[1])+"px");var l=s.getAttribute("data-proportional-width");null===l||isNaN(+l)||(s.style.width=String(+l*i[0])+"px");var d=s.getAttribute("data-proportional-height");null===d||isNaN(+d)||(s.style.height=String(+d*i[1])+"px");var c=s.getAttribute("data-proportional-line-height");null===c||isNaN(+c)||(s.style.lineHeight=String(+c*i[1])+"px");var f=s.getAttribute("data-proportional-left");null===f||isNaN(+f)||(s.style.left=String(+f*i[0])+"px");var v=s.getAttribute("data-proportional-top");null===v||isNaN(+v)||(s.style.top=String(+v*i[1])+"px");var p=s.getAttribute("data-proportional-padding-top");null===p||isNaN(+p)||(s.style.paddingTop=String(+p*i[1])+"px");var h=s.getAttribute("data-proportional-padding-bottom");null===h||isNaN(+h)||(s.style.paddingBottom=String(+h*i[1])+"px");var m=s.getAttribute("data-proportional-padding-left");null===m||isNaN(+m)||(s.style.paddingLeft=String(+m*i[0])+"px");var g=s.getAttribute("data-proportional-padding-right");null===g||isNaN(+g)||(s.style.paddingRight=String(+g*i[0])+"px")}}return a.length>0}var _=i.M4,b=i.bQ,S=i.Q$;function E(e,t){try{e.removeChild(t)}catch(e){a.Z.warn("HTSB: Can't remove text track: not in the element.")}}function T(e){var t=e.getAttribute("data-resolution-rows"),n=e.getAttribute("data-resolution-columns");if(null===t||null===n)return null;var r=parseInt(t,10),i=parseInt(n,10);return null===r||null===i?null:{rows:r,columns:i}}var k=function(e){function t(t,n){var r;return a.Z.debug("HTSB: Creating HTMLTextSegmentBuffer"),(r=e.call(this)||this).bufferType="text",r._buffered=new c.Z,r._videoElement=t,r._textTrackElement=n,r._sizeUpdateCanceller=new l.ZP,r._canceller=new l.ZP,r._buffer=new g,r._currentCues=[],r.autoRefreshSubtitles(r._canceller.signal),r}(0,r.Z)(t,e);var n=t.prototype;return n.declareInitSegment=function(e){a.Z.warn("ISB: Declaring initialization segment for image SegmentBuffer",e)},n.freeInitSegment=function(e){a.Z.warn("ISB: Freeing initialization segment for image SegmentBuffer",e)},n.pushChunk=function(e){try{this.pushChunkSync(e)}catch(e){return Promise.reject(e)}return Promise.resolve()},n.removeBuffer=function(e,t){return this.removeBufferSync(e,t),Promise.resolve()},n.endOfSegment=function(e){return this._segmentInventory.completeSegment(e,this._buffered),Promise.resolve()},n.getBufferedRanges=function(){return this._buffered},n.dispose=function(){a.Z.debug("HTSB: Disposing HTMLTextSegmentBuffer"),this._disableCurrentCues(),this._buffer.remove(0,1/0),this._buffered.remove(0,1/0),this._canceller.cancel()},n.pushChunkSync=function(e){var t,n;a.Z.debug("HTSB: Appending new html text tracks");var r=e.data,i=r.timestampOffset,o=r.appendWindow,s=r.chunk;if(null!==s){var u,l,d=s.start,c=s.end,v=s.data,p=s.type,h=s.language,m=null!==(t=o[0])&&void 0!==t?t:0,g=null!==(n=o[1])&&void 0!==n?n:1/0,y=function(e,t,n,r){a.Z.debug("HTSB: Finding parser for html text tracks:",e);var i=f.Z.htmlTextTracksParsers[e];if("function"!=typeof i)throw new Error("no parser found for the given text track");a.Z.debug("HTSB: Parser found, parsing...");var o=i(t,n,r);return a.Z.debug("HTTB: Parsed successfully!",o.length),o}(p,v,i,h);if(0!==m&&g!==1/0){for(var _=0;_<y.length&&y[_].end<=m;)_++;for(y.splice(0,_),_=0;_<y.length&&y[_].start<m;)y[_].start=m,_++;for(_=y.length-1;_>=0&&y[_].start>=g;)_--;for(y.splice(_,y.length),_=y.length-1;_>=0&&y[_].end>g;)y[_].end=g,_--}if(void 0!==d)u=Math.max(m,d);else{if(y.length<=0)return void a.Z.warn("HTSB: Current text tracks have no cues nor start time. Aborting");a.Z.warn("HTSB: No start time given. Guessing from cues."),u=y[0].start}if(void 0!==c)l=Math.min(g,c);else{if(y.length<=0)return void a.Z.warn("HTSB: Current text tracks have no cues nor end time. Aborting");a.Z.warn("HTSB: No end time given. Guessing from cues."),l=y[y.length-1].end}l<=u?a.Z.warn("HTSB: Invalid text track appended: ","the start time is inferior or equal to the end time."):(null!==e.inventoryInfos&&this._segmentInventory.insertChunk(e.inventoryInfos),this._buffer.insert(y,u,l),this._buffered.insert(u,l))}},n.removeBufferSync=function(e,t){a.Z.debug("HTSB: Removing html text track data",e,t),this._buffer.remove(e,t),this._buffered.remove(e,t)},n._disableCurrentCues=function(){if(this._sizeUpdateCanceller.cancel(),this._currentCues.length>0){for(var e=0;e<this._currentCues.length;e++)E(this._textTrackElement,this._currentCues[e].element);this._currentCues=[]}},n._displayCues=function(e){if(!(this._currentCues.length===e.length&&this._currentCues.every((function(t,n){return t.element===e[n]})))){this._sizeUpdateCanceller.cancel();for(var t=0;t<this._currentCues.length;t++)E(this._textTrackElement,this._currentCues[t].element);this._currentCues=[];for(var n=0;n<e.length;n++){var r=e[n],i=T(r);this._currentCues.push({element:r,resolution:i}),this._textTrackElement.appendChild(r)}var d=this._currentCues.filter((function(e){return null!==e.resolution}));if(d.length>0){this._sizeUpdateCanceller=new l.ZP,this._sizeUpdateCanceller.linkToSignal(this._canceller.signal);var c=u.Z.getCurrent().TEXT_TRACK_SIZE_CHECKS_INTERVAL,f=function(e,t,n){var r=e.getBoundingClientRect(),i=r.height,u=r.width,l=(0,o.ZP)({height:i,width:u},n),d=i,c=u;if(void 0!==s){var f=new s((function(e){if(0!==e.length){var t=e[0].contentRect,n=t.height,r=t.width;n===d&&r===c||(d=n,c=r,l.setValue({height:n,width:r}))}else a.Z.error("Compat: Resized but no observed element.")}));f.observe(e),n.register((function(){f.disconnect()}))}else{var v=setInterval((function(){var t=e.getBoundingClientRect(),n=t.height,r=t.width;n===d&&r===c||(d=n,c=r,l.setValue({height:n,width:r}))}),t);n.register((function(){clearInterval(v)}))}return l}(this._textTrackElement,c,this._sizeUpdateCanceller.signal);f.onUpdate((function(e){for(var t=e.height,n=e.width,r=0;r<d.length;r++){var i=d[r];y(t,n,i.resolution,i.element)}}),{clearSignal:this._sizeUpdateCanceller.signal,emitCurrentValue:!0})}}},n.autoRefreshSubtitles=function(e){var t=this,n=null,r=u.Z.getCurrent().MAXIMUM_HTML_TEXT_TRACK_UPDATE_INTERVAL,i=function(){a(),(n=new l.ZP).linkToSignal(e);var i=setInterval((function(){return t.refreshSubtitles()}),r);n.signal.register((function(){clearInterval(i)})),t.refreshSubtitles()};function a(){null!==n&&(n.cancel(),n=null)}S(this._videoElement,(function(){a(),t._disableCurrentCues()}),e),b(this._videoElement,i,e),_(this._videoElement,i,e),i()},n.refreshSubtitles=function(){var e,t=u.Z.getCurrent().MAXIMUM_HTML_TEXT_TRACK_UPDATE_INTERVAL;e=this._videoElement.paused||this._videoElement.playbackRate<=0?this._videoElement.currentTime:Math.max(this._videoElement.currentTime+t/1e3/2,0);var n=this._buffer.get(e);0===n.length?this._disableCurrentCues():this._displayCues(n)},t}(d.C)},9059:function(e,t,n){"use strict";n.d(t,{Z:function(){return d}});var r=n(4578),i=n(3666);var a=n(3887);function o(e,t){if(i.vU&&function(e,t){var n=e.activeCues;if(null===n)return!1;for(var r=0;r<n.length;r++)if(n[r]===t)return!0;return!1}(e,t)){var n=e.mode;e.mode="hidden";try{e.removeCue(t)}catch(e){a.Z.warn("Compat: Could not remove cue from text track.")}e.mode=n}else try{e.removeCue(t)}catch(e){a.Z.warn("Compat: Could not remove cue from text track.")}}var s=n(9612),u=n(4309),l=n(7874);var d=function(e){function t(t){var n;a.Z.debug("NTSB: Creating NativeTextSegmentBuffer"),n=e.call(this)||this;var r=function(e){var t,n,r,a="subtitles";if(i.YM){var o=e.textTracks.length;(n=o>0?e.textTracks[o-1]:e.addTextTrack(a)).mode=null!==(t=n.SHOWING)&&void 0!==t?t:"showing"}else r=document.createElement("track"),e.appendChild(r),n=r.track,r.kind=a,n.mode="showing";return{track:n,trackElement:r}}(t),o=r.track,s=r.trackElement;return n.bufferType="text",n._buffered=new u.Z,n._videoElement=t,n._track=o,n._trackElement=s,n}(0,r.Z)(t,e);var n=t.prototype;return n.declareInitSegment=function(e){a.Z.warn("ISB: Declaring initialization segment for image SegmentBuffer",e)},n.freeInitSegment=function(e){a.Z.warn("ISB: Freeing initialization segment for image SegmentBuffer",e)},n.pushChunk=function(e){var t,n;if(a.Z.debug("NTSB: Appending new native text tracks"),null===e.data.chunk)return Promise.resolve();var r=e.data,i=r.timestampOffset,o=r.appendWindow,s=r.chunk,u=s.start,d=s.end,c=s.data,f=s.type,v=s.language,p=null!==(t=o[0])&&void 0!==t?t:0,h=null!==(n=o[1])&&void 0!==n?n:1/0;try{var m,g,y=function(e,t,n,r){a.Z.debug("NTSB: Finding parser for native text tracks:",e);var i=l.Z.nativeTextTracksParsers[e];if("function"!=typeof i)throw new Error("no parser found for the given text track");a.Z.debug("NTSB: Parser found, parsing...");var o=i(t,n,r);return a.Z.debug("NTSB: Parsed successfully!",o.length),o}(f,c,i,v);if(0!==p&&h!==1/0){for(var _=0;_<y.length&&y[_].endTime<=p;)_++;for(y.splice(0,_),_=0;_<y.length&&y[_].startTime<p;)y[_].startTime=p,_++;for(_=y.length-1;_>=0&&y[_].startTime>=h;)_--;for(y.splice(_,y.length),_=y.length-1;_>=0&&y[_].endTime>h;)y[_].endTime=h,_--}if(void 0!==u)m=Math.max(p,u);else{if(y.length<=0)return a.Z.warn("NTSB: Current text tracks have no cues nor start time. Aborting"),Promise.resolve();a.Z.warn("NTSB: No start time given. Guessing from cues."),m=y[0].startTime}if(void 0!==d)g=Math.min(h,d);else{if(y.length<=0)return a.Z.warn("NTSB: Current text tracks have no cues nor end time. Aborting"),Promise.resolve();a.Z.warn("NTSB: No end time given. Guessing from cues."),g=y[y.length-1].endTime}if(g<=m)return a.Z.warn("NTSB: Invalid text track appended: ","the start time is inferior or equal to the end time."),Promise.resolve();if(y.length>0){var b=y[0],S=this._track.cues;null!==S&&S.length>0&&b.startTime<S[S.length-1].startTime&&this._removeData(b.startTime,1/0);for(var E=0;E<y.length;E++)this._track.addCue(y[E])}this._buffered.insert(m,g),null!==e.inventoryInfos&&this._segmentInventory.insertChunk(e.inventoryInfos)}catch(e){return Promise.reject(e)}return Promise.resolve()},n.removeBuffer=function(e,t){return this._removeData(e,t),Promise.resolve()},n.endOfSegment=function(e){return this._segmentInventory.completeSegment(e,this._buffered),Promise.resolve()},n.getBufferedRanges=function(){return this._buffered},n.dispose=function(){a.Z.debug("NTSB: Aborting NativeTextSegmentBuffer"),this._removeData(0,1/0);var e=this._trackElement,t=this._videoElement;if(void 0!==e&&t.hasChildNodes())try{t.removeChild(e)}catch(e){a.Z.warn("NTSB: Can't remove track element from the video")}this._track.mode="disabled",void 0!==this._trackElement&&(this._trackElement.innerHTML="")},n._removeData=function(e,t){a.Z.debug("NTSB: Removing native text track data",e,t);var n=this._track,r=n.cues;if(null!==r)for(var i=r.length-1;i>=0;i--){var s=r[i],u=s.startTime,l=s.endTime;u>=e&&u<=t&&l<=t&&o(n,s)}this._buffered.remove(e,t)},t}(s.C)},9612:function(e,t,n){"use strict";n.d(t,{C:function(){return _},f:function(){return g}});var r=n(6872),i=n(3887),a=n(520),o=n(5278);function s(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return u(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var l=function(){function e(e,t){this._history=[],this._lifetime=e,this._maxHistoryLength=t}var t=e.prototype;return t.addBufferedSegment=function(e,t){var n=performance.now();this._history.push({date:n,buffered:t,context:e}),this._cleanHistory(n)},t.getHistoryFor=function(e){return this._history.filter((function(t){return(0,a.z)(t.context,e)}))},t._cleanHistory=function(e){for(var t,n=e-this._lifetime,r=0,i=s(this._history);!(t=i()).done;){if(!(t.value.date<n))break;r++}if(r>0&&(this._history=this._history.splice(r)),this._history.length>this._maxHistoryLength){var a=this._history.length-this._maxHistoryLength;this._history=this._history.splice(a)}},e}();function d(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return c(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return c(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var f=function(){function e(){var e=r.Z.getCurrent(),t=e.BUFFERED_HISTORY_RETENTION_TIME,n=e.BUFFERED_HISTORY_MAXIMUM_ENTRIES;this._inventory=[],this._bufferedHistory=new l(t,n)}var t=e.prototype;return t.reset=function(){this._inventory.length=0},t.synchronizeBuffered=function(e){for(var t=this._inventory,n=0,a=t[0],s=r.Z.getCurrent().MINIMUM_SEGMENT_SIZE,u=null==a?void 0:a.infos.adaptation.type,l=e.length,c=0;c<l;c++){if(void 0===a)return;var f=e.start(c),v=e.end(c);if(v-f<s)i.Z.warn("SI: skipped TimeRange when synchronizing because it was too small",u,f,v);else{for(var p=n;void 0!==a&&(0,o.Z)(a.bufferedEnd,a.end)-f<s;)a=t[++n];var g=null,y=n-p;if(y>0){var _=t[p+y-1];g={end:(0,o.Z)(_.bufferedEnd,_.end),precizeEnd:_.precizeEnd},i.Z.debug("SI: "+y+" segments GCed.",u);for(var b,S=d(t.splice(p,y));!(b=S()).done;){var E=b.value;void 0===E.bufferedStart&&void 0===E.bufferedEnd&&this._bufferedHistory.addBufferedSegment(E.infos,null)}n=p}if(void 0===a)return;if(v-(0,o.Z)(a.bufferedStart,a.start)>=s){if(h(a,f,g,u),n===t.length-1)return void m(a,v,u);a=t[++n];for(var T=(0,o.Z)(a.bufferedStart,a.start),k=(0,o.Z)(a.bufferedEnd,a.end),w=c<l-1?e.start(c+1):void 0;void 0!==a&&v-T>=s&&(void 0===w||v-T>=k-w);){var A=t[n-1];void 0===A.bufferedEnd&&(A.bufferedEnd=a.precizeStart?a.start:A.end,i.Z.debug("SI: calculating buffered end of contiguous segment",u,A.bufferedEnd,A.end)),a.bufferedStart=A.bufferedEnd,void 0!==(a=t[++n])&&(T=(0,o.Z)(a.bufferedStart,a.start),k=(0,o.Z)(a.bufferedEnd,a.end))}}var I=t[n-1];void 0!==I&&m(I,v,u)}}if(null!=a){i.Z.debug("SI: last segments have been GCed",u,n,t.length);for(var R,Z=d(t.splice(n,t.length-n));!(R=Z()).done;){var x=R.value;void 0===x.bufferedStart&&void 0===x.bufferedEnd&&this._bufferedHistory.addBufferedSegment(x.infos,null)}}void 0!==u&&i.Z.hasLevel("DEBUG")&&i.Z.debug("SI: current "+u+" inventory timeline:\n"+function(e){var t=1/60,n={},r=[],i=null,a=null;function o(e){var t=String.fromCharCode(r.length+65);return r.push({letter:t,periodId:e.period.id,representationId:e.representation.id,bitrate:e.representation.bitrate}),t}for(var s="",u=0;u<e.length;u++){var l=e[u];if(void 0!==l.bufferedStart&&void 0!==l.bufferedEnd){var d,c=l.infos.period.id,f=l.infos.representation.id,v=n[c],p=void 0;if(void 0===v)p=o(l.infos),n[c]=((d={})[f]=p,d);else void 0===v[f]?(p=o(l.infos),v[f]=p):p=v[f];null===i?s+=l.bufferedStart.toFixed(2)+"|"+p+"|":a===p?i.bufferedEnd+t<l.bufferedStart&&(s+=i.bufferedEnd.toFixed(2)+" ~ "+l.bufferedStart.toFixed(2)+"|"+p+"|"):s+=i.bufferedEnd.toFixed(2)+" ~ "+l.bufferedStart.toFixed(2)+"|"+p+"|",i=l,a=p}}null!==i&&(s+=String(i.end.toFixed(2)));return r.forEach((function(e){var t;s+="\n["+e.letter+"] P: "+e.periodId+" || R: "+e.representationId+"("+(null!==(t=e.bitrate)&&void 0!==t?t:"unknown bitrate")+")"})),s}(this._inventory))},t.insertChunk=function(e){var t=e.period,n=e.adaptation,r=e.representation,a=e.segment,o=e.chunkSize,s=e.start,u=e.end;if(!a.isInit){var l=n.type;if(s>=u)i.Z.warn("SI: Invalid chunked inserted: starts before it ends",l,s,u);else{for(var d=this._inventory,c={partiallyPushed:!0,chunkSize:o,splitted:!1,start:s,end:u,precizeStart:!1,precizeEnd:!1,bufferedStart:void 0,bufferedEnd:void 0,infos:{segment:a,period:t,adaptation:n,representation:r}},f=d.length-1;f>=0;f--){var v=d[f];if(v.start<=s){if(v.end<=s){for(i.Z.debug("SI: Pushing segment strictly after previous one.",l,s,v.end),this._inventory.splice(f+1,0,c),f+=2;f<d.length&&d[f].start<c.end;){if(d[f].end>c.end)return i.Z.debug("SI: Segment pushed updates the start of the next one",l,c.end,d[f].start),d[f].start=c.end,d[f].bufferedStart=void 0,void(d[f].precizeStart=d[f].precizeStart&&c.precizeEnd);i.Z.debug("SI: Segment pushed removes the next one",l,s,u,d[f].start,d[f].end),d.splice(f,1)}return}if(v.start===s){if(v.end<=u){for(i.Z.debug("SI: Segment pushed replace another one",l,s,u,v.end),this._inventory.splice(f,1,c),f+=1;f<d.length&&d[f].start<c.end;){if(d[f].end>c.end)return i.Z.debug("SI: Segment pushed updates the start of the next one",l,c.end,d[f].start),d[f].start=c.end,d[f].bufferedStart=void 0,void(d[f].precizeStart=d[f].precizeStart&&c.precizeEnd);i.Z.debug("SI: Segment pushed removes the next one",l,s,u,d[f].start,d[f].end),d.splice(f,1)}return}return i.Z.debug("SI: Segment pushed ends before another with the same start",l,s,u,v.end),d.splice(f,0,c),v.start=c.end,v.bufferedStart=void 0,void(v.precizeStart=v.precizeStart&&c.precizeEnd)}if(v.end<=c.end){for(i.Z.debug("SI: Segment pushed updates end of previous one",l,s,u,v.start,v.end),this._inventory.splice(f+1,0,c),v.end=c.start,v.bufferedEnd=void 0,v.precizeEnd=v.precizeEnd&&c.precizeStart,f+=2;f<d.length&&d[f].start<c.end;){if(d[f].end>c.end)return i.Z.debug("SI: Segment pushed updates the start of the next one",l,c.end,d[f].start),d[f].start=c.end,d[f].bufferedStart=void 0,void(d[f].precizeStart=d[f].precizeStart&&c.precizeEnd);i.Z.debug("SI: Segment pushed removes the next one",l,s,u,d[f].start,d[f].end),d.splice(f,1)}return}i.Z.warn("SI: Segment pushed is contained in a previous one",l,s,u,v.start,v.end);var p={partiallyPushed:v.partiallyPushed,chunkSize:v.chunkSize,splitted:!0,start:c.end,end:v.end,precizeStart:v.precizeStart&&v.precizeEnd&&c.precizeEnd,precizeEnd:v.precizeEnd,bufferedStart:void 0,bufferedEnd:v.end,infos:v.infos};return v.end=c.start,v.splitted=!0,v.bufferedEnd=void 0,v.precizeEnd=v.precizeEnd&&c.precizeStart,d.splice(f+1,0,c),void d.splice(f+2,0,p)}}var h=this._inventory[0];if(void 0===h)return i.Z.debug("SI: first segment pushed",l,s,u),void this._inventory.push(c);if(!(h.start>=u)){if(h.end<=u){for(i.Z.debug("SI: Segment pushed starts before and completely recovers the previous first one",l,s,u,h.start,h.end),this._inventory.splice(0,1,c);d.length>1&&d[1].start<c.end;){if(d[1].end>c.end)return i.Z.debug("SI: Segment pushed updates the start of the next one",l,c.end,d[1].start),d[1].start=c.end,d[1].bufferedStart=void 0,void(d[1].precizeStart=c.precizeEnd);i.Z.debug("SI: Segment pushed removes the next one",l,s,u,d[1].start,d[1].end),d.splice(1,1)}return}return i.Z.debug("SI: Segment pushed start of the next one",l,s,u,h.start,h.end),h.start=u,h.bufferedStart=void 0,h.precizeStart=c.precizeEnd,void this._inventory.splice(0,0,c)}i.Z.debug("SI: Segment pushed comes before all previous ones",l,s,u,h.start),this._inventory.splice(0,0,c)}}},t.completeSegment=function(e,t){if(!e.segment.isInit){for(var n=this._inventory,r=[],o=0;o<n.length;o++)if((0,a.z)(n[o].infos,e)){var s=!1;r.length>0&&(s=!0,1===r.length&&(i.Z.warn("SI: Completed Segment is splitted.",e.segment.id,e.segment.time,e.segment.end),r[0].splitted=!0));var u=o,l=n[o].chunkSize;for(o+=1;o<n.length&&(0,a.z)(n[o].infos,e);){var c=n[o].chunkSize;void 0!==l&&void 0!==c&&(l+=c),o++}var f=o-1,v=f-u,p=n[f].end,h=n[f].bufferedEnd;v>0&&(this._inventory.splice(u+1,v),o-=v),this._inventory[u].partiallyPushed=!1,this._inventory[u].chunkSize=l,this._inventory[u].end=p,this._inventory[u].bufferedEnd=h,this._inventory[u].splitted=s,r.push(this._inventory[u])}if(0===r.length)i.Z.warn("SI: Completed Segment not found",e.segment.id,e.segment.time);else{this.synchronizeBuffered(t);for(var m,g=d(r);!(m=g()).done;){var y=m.value;void 0!==y.bufferedStart&&void 0!==y.bufferedEnd?this._bufferedHistory.addBufferedSegment(y.infos,{start:y.bufferedStart,end:y.bufferedEnd}):i.Z.debug("SI: buffered range not known after sync. Skipping history.",y.start,y.end)}}}},t.getInventory=function(){return this._inventory},t.getHistoryFor=function(e){return this._bufferedHistory.getHistoryFor(e)},e}();function v(e){if(void 0===e.bufferedStart||e.partiallyPushed)return!1;var t=e.start,n=e.end-t,i=r.Z.getCurrent(),a=i.MAX_MANIFEST_BUFFERED_START_END_DIFFERENCE,o=i.MAX_MANIFEST_BUFFERED_DURATION_DIFFERENCE;return Math.abs(t-e.bufferedStart)<=a&&(void 0===e.bufferedEnd||e.bufferedEnd>e.bufferedStart&&Math.abs(e.bufferedEnd-e.bufferedStart-n)<=Math.min(o,n/3))}function p(e){if(void 0===e.bufferedEnd||e.partiallyPushed)return!1;var t=e.start,n=e.end,i=n-t,a=r.Z.getCurrent(),o=a.MAX_MANIFEST_BUFFERED_START_END_DIFFERENCE,s=a.MAX_MANIFEST_BUFFERED_DURATION_DIFFERENCE;return Math.abs(n-e.bufferedEnd)<=o&&null!=e.bufferedStart&&e.bufferedEnd>e.bufferedStart&&Math.abs(e.bufferedEnd-e.bufferedStart-i)<=Math.min(s,i/3)}function h(e,t,n,a){var o=r.Z.getCurrent().MAX_MANIFEST_BUFFERED_START_END_DIFFERENCE;void 0!==e.bufferedStart?(e.bufferedStart<t&&(i.Z.debug("SI: Segment partially GCed at the start",a,e.bufferedStart,t),e.bufferedStart=t),!e.precizeStart&&v(e)&&(e.start=e.bufferedStart,e.precizeStart=!0)):e.precizeStart?(i.Z.debug("SI: buffered start is precize start",a,e.start),e.bufferedStart=e.start):null!==n&&n.end>t&&(n.precizeEnd||e.start-n.end<=o)?(i.Z.debug("SI: buffered start is end of previous segment",a,t,e.start,n.end),e.bufferedStart=n.end,v(e)&&(e.start=n.end,e.precizeStart=!0)):e.start-t<=o?(i.Z.debug("SI: found true buffered start",a,t,e.start),e.bufferedStart=t,v(e)&&(e.start=t,e.precizeStart=!0)):t<e.start?i.Z.debug("SI: range start too far from expected start",a,t,e.start):(i.Z.debug("SI: Segment appears immediately garbage collected at the start",a,e.bufferedStart,t),e.bufferedStart=t)}function m(e,t,n){var a=r.Z.getCurrent().MAX_MANIFEST_BUFFERED_START_END_DIFFERENCE;void 0!==e.bufferedEnd?(e.bufferedEnd>t&&(i.Z.debug("SI: Segment partially GCed at the end",n,e.bufferedEnd,t),e.bufferedEnd=t),!e.precizeEnd&&t-e.end<=a&&p(e)&&(e.precizeEnd=!0,e.end=t)):e.precizeEnd?(i.Z.debug("SI: buffered end is precize end",n,e.end),e.bufferedEnd=e.end):t-e.end<=a?(i.Z.debug("SI: found true buffered end",n,t,e.end),e.bufferedEnd=t,p(e)&&(e.end=t,e.precizeEnd=!0)):t>e.end?(i.Z.debug("SI: range end too far from expected end",n,t,e.end),e.bufferedEnd=e.end):(i.Z.debug("SI: Segment appears immediately garbage collected at the end",n,e.bufferedEnd,t),e.bufferedEnd=t)}var g,y=f,_=function(){function e(){this._segmentInventory=new y}var t=e.prototype;return t.synchronizeInventory=function(){this._segmentInventory.synchronizeBuffered(this.getBufferedRanges())},t.getInventory=function(){return this._segmentInventory.getInventory()},t.getPendingOperations=function(){return[]},t.getSegmentHistory=function(e){return this._segmentInventory.getHistoryFor(e)},e}();!function(e){e[e.Push=0]="Push",e[e.Remove=1]="Remove",e[e.EndOfSegment=2]="EndOfSegment"}(g||(g={}))},4309:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(2829),i=function(){function e(){this._ranges=[],this.length=0}var t=e.prototype;return t.insert=function(e,t){(0,r.kR)(this._ranges,{start:e,end:t}),this.length=this._ranges.length},t.remove=function(e,t){var n=[];e>0&&n.push({start:0,end:e}),t<1/0&&n.push({start:t,end:1/0}),this._ranges=(0,r.tn)(this._ranges,n),this.length=this._ranges.length},t.start=function(e){if(e>=this._ranges.length)throw new Error("INDEX_SIZE_ERROR");return this._ranges[e].start},t.end=function(e){if(e>=this._ranges.length)throw new Error("INDEX_SIZE_ERROR");return this._ranges[e].end},e}()},7839:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(7326),i=n(4578),a=function(e){function t(n,i,a){var o;return o=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(o),t.prototype),o.name="CustomLoaderError",o.message=n,o.canRetry=i,o.xhr=a,o}return(0,i.Z)(t,e),t}((0,n(2146).Z)(Error))},5157:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r=n(7326),i=n(4578),a=n(2146),o=n(5992),s=n(7367),u=function(e){function t(n,i,a){var u;return u=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(u),t.prototype),u.name="EncryptedMediaError",u.type=o.ZB.ENCRYPTED_MEDIA_ERROR,u.code=n,u.message=(0,s.Z)(u.name,u.code,i),u.fatal=!1,"string"==typeof(null==a?void 0:a.keyStatuses)&&(u.keyStatuses=a.keyStatuses),u}return(0,i.Z)(t,e),t}((0,a.Z)(Error))},5992:function(e,t,n){"use strict";n.d(t,{SM:function(){return a},ZB:function(){return r},br:function(){return i}});var r={NETWORK_ERROR:"NETWORK_ERROR",MEDIA_ERROR:"MEDIA_ERROR",ENCRYPTED_MEDIA_ERROR:"ENCRYPTED_MEDIA_ERROR",OTHER_ERROR:"OTHER_ERROR"},i={TIMEOUT:"TIMEOUT",ERROR_EVENT:"ERROR_EVENT",ERROR_HTTP_CODE:"ERROR_HTTP_CODE",PARSE_ERROR:"PARSE_ERROR"},a={PIPELINE_LOAD_ERROR:"PIPELINE_LOAD_ERROR",PIPELINE_PARSE_ERROR:"PIPELINE_PARSE_ERROR",INTEGRITY_ERROR:"INTEGRITY_ERROR",MANIFEST_PARSE_ERROR:"MANIFEST_PARSE_ERROR",MANIFEST_INCOMPATIBLE_CODECS_ERROR:"MANIFEST_INCOMPATIBLE_CODECS_ERROR",MANIFEST_UPDATE_ERROR:"MANIFEST_UPDATE_ERROR",MANIFEST_UNSUPPORTED_ADAPTATION_TYPE:"MANIFEST_UNSUPPORTED_ADAPTATION_TYPE",MEDIA_STARTING_TIME_NOT_FOUND:"MEDIA_STARTING_TIME_NOT_FOUND",MEDIA_TIME_BEFORE_MANIFEST:"MEDIA_TIME_BEFORE_MANIFEST",MEDIA_TIME_AFTER_MANIFEST:"MEDIA_TIME_AFTER_MANIFEST",MEDIA_TIME_NOT_FOUND:"MEDIA_TIME_NOT_FOUND",NO_PLAYABLE_REPRESENTATION:"NO_PLAYABLE_REPRESENTATION",MEDIA_IS_ENCRYPTED_ERROR:"MEDIA_IS_ENCRYPTED_ERROR",CREATE_MEDIA_KEYS_ERROR:"CREATE_MEDIA_KEYS_ERROR",KEY_ERROR:"KEY_ERROR",KEY_STATUS_CHANGE_ERROR:"KEY_STATUS_CHANGE_ERROR",KEY_UPDATE_ERROR:"KEY_UPDATE_ERROR",KEY_LOAD_ERROR:"KEY_LOAD_ERROR",KEY_LOAD_TIMEOUT:"KEY_LOAD_TIMEOUT",KEY_GENERATE_REQUEST_ERROR:"KEY_GENERATE_REQUEST_ERROR",INCOMPATIBLE_KEYSYSTEMS:"INCOMPATIBLE_KEYSYSTEMS",INVALID_ENCRYPTED_EVENT:"INVALID_ENCRYPTED_EVENT",INVALID_KEY_SYSTEM:"INVALID_KEY_SYSTEM",LICENSE_SERVER_CERTIFICATE_ERROR:"LICENSE_SERVER_CERTIFICATE_ERROR",MULTIPLE_SESSIONS_SAME_INIT_DATA:"MULTIPLE_SESSIONS_SAME_INIT_DATA",BUFFER_APPEND_ERROR:"BUFFER_APPEND_ERROR",BUFFER_FULL_ERROR:"BUFFER_FULL_ERROR",BUFFER_TYPE_UNKNOWN:"BUFFER_TYPE_UNKNOWN",MEDIA_ERR_BLOCKED_AUTOPLAY:"MEDIA_ERR_BLOCKED_AUTOPLAY",MEDIA_ERR_PLAY_NOT_ALLOWED:"MEDIA_ERR_PLAY_NOT_ALLOWED",MEDIA_ERR_NOT_LOADED_METADATA:"MEDIA_ERR_NOT_LOADED_METADATA",MEDIA_ERR_ABORTED:"MEDIA_ERR_ABORTED",MEDIA_ERR_NETWORK:"MEDIA_ERR_NETWORK",MEDIA_ERR_DECODE:"MEDIA_ERR_DECODE",MEDIA_ERR_SRC_NOT_SUPPORTED:"MEDIA_ERR_SRC_NOT_SUPPORTED",MEDIA_ERR_UNKNOWN:"MEDIA_ERR_UNKNOWN",MEDIA_SOURCE_NOT_SUPPORTED:"MEDIA_SOURCE_NOT_SUPPORTED",MEDIA_KEYS_NOT_SUPPORTED:"MEDIA_KEYS_NOT_SUPPORTED",DISCONTINUITY_ENCOUNTERED:"DISCONTINUITY_ENCOUNTERED",NONE:"NONE"}},7367:function(e,t,n){"use strict";function r(e,t,n){return e+" ("+t+") "+n}n.d(t,{Z:function(){return r}})},8750:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(9822),i=n(5389);function a(e,t){var n=t.defaultCode,a=t.defaultReason;if((0,r.Z)(e))return e;var o=e instanceof Error?e.toString():a;return new i.Z(n,o)}},9822:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r=n(5157),i=n(5992),a=n(3714),o=n(9362),s=n(5389);function u(e){return(e instanceof r.Z||e instanceof a.Z||e instanceof s.Z||e instanceof o.Z)&&Object.keys(i.ZB).indexOf(e.type)>=0}},3714:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r=n(7326),i=n(4578),a=n(2146),o=n(5992),s=n(7367),u=function(e){function t(n,i,a){var u;u=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(u),t.prototype),u.name="MediaError",u.type=o.ZB.MEDIA_ERROR,u.code=n,u.message=(0,s.Z)(u.name,u.code,i),u.fatal=!1;var l=null==a?void 0:a.adaptation;if(void 0!==l)switch(l.type){case"audio":u.trackInfo={type:"audio",track:l.toAudioTrack(!1)};break;case"video":u.trackInfo={type:"video",track:l.toVideoTrack(!1)};break;case"text":u.trackInfo={type:"text",track:l.toTextTrack()}}return u}return(0,i.Z)(t,e),t}((0,a.Z)(Error))},9362:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r=n(7326),i=n(4578),a=n(2146),o=n(5992),s=n(7367),u=function(e){function t(n,i){var a;return a=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(a),t.prototype),a.name="NetworkError",a.type=o.ZB.NETWORK_ERROR,a.url=i.url,a.status=i.status,a.errorType=i.type,a.code=n,a.message=(0,s.Z)(a.name,a.code,i.message),a.fatal=!1,a}return(0,i.Z)(t,e),t.prototype.isHttpError=function(e){return this.errorType===o.br.ERROR_HTTP_CODE&&this.status===e},t}((0,a.Z)(Error))},5389:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r=n(7326),i=n(4578),a=n(2146),o=n(5992),s=n(7367),u=function(e){function t(n,i){var a;return a=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(a),t.prototype),a.name="OtherError",a.type=o.ZB.OTHER_ERROR,a.code=n,a.message=(0,s.Z)(a.name,a.code,i),a.fatal=!1,a}return(0,i.Z)(t,e),t}((0,a.Z)(Error))},9105:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(7326),i=n(4578),a=function(e){function t(n,i,a){var o;return o=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(o),t.prototype),o.name="RequestError",o.url=n,o.status=i,o.type=a,o.message=a,o}return(0,i.Z)(t,e),t}((0,n(2146).Z)(Error))},7273:function(e,t){"use strict";t.Z={dashParsers:{wasm:null,js:null},createDebugElement:null,directfile:null,ContentDecryptor:null,htmlTextTracksBuffer:null,htmlTextTracksParsers:{},nativeTextTracksBuffer:null,nativeTextTracksParsers:{},transports:{}}},7874:function(e,t,n){"use strict";var r=n(7273);t.Z=r.Z},3887:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(8894),i=new(function(){function e(){this.error=r.Z,this.warn=r.Z,this.info=r.Z,this.debug=r.Z,this._levels={NONE:0,ERROR:1,WARNING:2,INFO:3,DEBUG:4},this._currentLevel="NONE"}var t=e.prototype;return t.setLevel=function(e){var t,n=this._levels[e];"number"==typeof n?(t=n,this._currentLevel=e):(t=0,this._currentLevel="NONE"),this.error=t>=this._levels.ERROR?console.error.bind(console):r.Z,this.warn=t>=this._levels.WARNING?console.warn.bind(console):r.Z,this.info=t>=this._levels.INFO?console.info.bind(console):r.Z,this.debug=t>=this._levels.DEBUG?console.log.bind(console):r.Z},t.getLevel=function(){return this._currentLevel},t.hasLevel=function(e){return this._levels[e]>=this._levels[this._currentLevel]},e}())},9665:function(e,t,n){"use strict";n.d(t,{r:function(){return v},Z:function(){return p}});var r=n(3887),i=n(3274),a=n(1946),o=n(5288),s=n(3774);var u=n(4791);function l(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return d(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return d(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var c=(0,n(908).Z)(),f=function(){function e(e,t){if(this.id=e.id,this.uniqueId=c(),this.bitrate=e.bitrate,this.codec=e.codecs,void 0!==e.height&&(this.height=e.height),void 0!==e.width&&(this.width=e.width),void 0!==e.mimeType&&(this.mimeType=e.mimeType),void 0!==e.contentProtections&&(this.contentProtections=e.contentProtections),void 0!==e.frameRate&&(this.frameRate=e.frameRate),void 0!==e.hdrInfo&&(this.hdrInfo=e.hdrInfo),this.cdnMetadata=e.cdnMetadata,this.index=e.index,"audio"===t.type||"video"===t.type){var n=this.getMimeTypeString(),i=(a=n,null!=s.J&&("function"!=typeof s.J.isTypeSupported||s.J.isTypeSupported(a)));i||r.Z.info("Unsupported Representation",n,this.id,this.bitrate),this.isSupported=i}else this.isSupported=!0;var a}var t=e.prototype;return t.getMimeTypeString=function(){var e,t;return(null!==(e=this.mimeType)&&void 0!==e?e:"")+';codecs="'+(null!==(t=this.codec)&&void 0!==t?t:"")+'"'},t.getEncryptionData=function(e){for(var t,n,r=this.getAllEncryptionData(),i=[],a=0;a<r.length;a++)for(var o=!1,s=r[a],u=0;u<s.values.length;u++)if(s.values[u].systemId.toLowerCase()===e.toLowerCase())if(o)i[i.length-1].values.push(s.values[u]);else{var l=null===(n=null===(t=this.contentProtections)||void 0===t?void 0:t.keyIds)||void 0===n?void 0:n.map((function(e){return e.keyId}));i.push({type:s.type,keyIds:l,values:[s.values[u]]}),o=!0}return i},t.getAllEncryptionData=function(){var e,t;if(void 0===this.contentProtections||0===this.contentProtections.initData.length)return[];var n=null===(t=null===(e=this.contentProtections)||void 0===e?void 0:e.keyIds)||void 0===t?void 0:t.map((function(e){return e.keyId}));return this.contentProtections.initData.map((function(e){return{type:e.type,keyIds:n,values:e.values}}))},t.addProtectionData=function(e,t,n){var i=!1;if(void 0===this.contentProtections)return this.contentProtections={keyIds:void 0!==t?[{keyId:t}]:[],initData:[{type:e,values:n}]},!0;if(void 0!==t){var a=this.contentProtections.keyIds;if(void 0===a)this.contentProtections.keyIds=[{keyId:t}];else{for(var o,s=!1,d=l(a);!(o=d()).done;){var c=o.value;(0,u.Z)(c.keyId,t)&&(s=!0)}s||(r.Z.warn("Manifest: found unanounced key id."),a.push({keyId:t}))}}for(var f=this.contentProtections.initData,v=0;v<f.length;v++)if(f[v].type===e){for(var p=f[v].values,h=0;h<n.length;h++){var m=n[h],g=void 0;for(g=0;g<p.length;g++)if(m.systemId===p[g].systemId){if((0,u.Z)(m.data,p[g].data))break;r.Z.warn("Manifest: different init data for the same system ID")}g===p.length&&(p.push(m),i=!0)}return i}return this.contentProtections.initData.push({type:e,values:n}),!0},t.toAudioRepresentation=function(){return{id:this.id,bitrate:this.bitrate,codec:this.codec,isCodecSupported:this.isSupported,seemsDecipherable:this.decipherable}},t.toVideoRepresentation=function(){return{id:this.id,bitrate:this.bitrate,frameRate:this.frameRate,width:this.width,height:this.height,codec:this.codec,hdrInfo:this.hdrInfo,isCodecSupported:this.isSupported,seemsDecipherable:this.decipherable}},t.isPlayable=function(){return this.isSupported&&!1!==this.decipherable},e}(),v=["audio","video","text"],p=function(){function e(t,n){void 0===n&&(n={});var i=t.trickModeTracks,s=n,u=s.representationFilter,l=s.isManuallyAdded;this.id=t.id,this.type=t.type,void 0!==t.isTrickModeTrack&&(this.isTrickModeTrack=t.isTrickModeTrack),void 0!==t.language&&(this.language=t.language,this.normalizedLanguage=(0,o.ZP)(t.language)),void 0!==t.closedCaption&&(this.isClosedCaption=t.closedCaption),void 0!==t.audioDescription&&(this.isAudioDescription=t.audioDescription),void 0!==t.isDub&&(this.isDub=t.isDub),void 0!==t.forcedSubtitles&&(this.isForcedSubtitles=t.forcedSubtitles),void 0!==t.isSignInterpreted&&(this.isSignInterpreted=t.isSignInterpreted),void 0!==t.label&&(this.label=t.label),void 0!==i&&i.length>0&&(this.trickModeTracks=i.map((function(t){return new e(t)})));for(var d=t.representations,c=[],v=!1,p=0;p<d.length;p++){var h=new f(d[p],{type:this.type}),m=!0;if(!(0,a.Z)(u)){var g={id:h.id,bitrate:h.bitrate,codec:h.codec,height:h.height,width:h.width,frameRate:h.frameRate,hdrInfo:h.hdrInfo};if(void 0!==h.contentProtections&&(g.contentProtections={},void 0!==h.contentProtections.keyIds)){var y=h.contentProtections.keyIds.map((function(e){return e.keyId}));g.contentProtections.keyIds=y}m=u(g,{trackType:this.type,language:this.language,normalizedLanguage:this.normalizedLanguage,isClosedCaption:this.isClosedCaption,isDub:this.isDub,isAudioDescription:this.isAudioDescription,isSignInterpreted:this.isSignInterpreted})}m?(c.push(h),!v&&h.isSupported&&(v=!0)):r.Z.debug("Filtering Representation due to representationFilter",this.type,"Adaptation: "+this.id,"Representation: "+h.id,"("+h.bitrate+")")}c.sort((function(e,t){return e.bitrate-t.bitrate})),this.representations=c,this.isSupported=v,this.manuallyAdded=!0===l}var t=e.prototype;return t.getPlayableRepresentations=function(){return this.representations.filter((function(e){return e.isPlayable()}))},t.getRepresentation=function(e){return(0,i.Z)(this.representations,(function(t){var n=t.id;return e===n}))},t.toAudioTrack=function(e){var t,n,r={language:null!==(t=this.language)&&void 0!==t?t:"",normalized:null!==(n=this.normalizedLanguage)&&void 0!==n?n:"",audioDescription:!0===this.isAudioDescription,id:this.id,representations:(e?this.getPlayableRepresentations():this.representations).map((function(e){return e.toAudioRepresentation()})),label:this.label};return!0===this.isDub&&(r.dub=!0),r},t.toTextTrack=function(){var e,t;return{language:null!==(e=this.language)&&void 0!==e?e:"",normalized:null!==(t=this.normalizedLanguage)&&void 0!==t?t:"",closedCaption:!0===this.isClosedCaption,id:this.id,label:this.label,forced:this.isForcedSubtitles}},t.toVideoTrack=function(e){var t=void 0!==this.trickModeTracks?this.trickModeTracks.map((function(t){var n=(e?t.getPlayableRepresentations():t.representations).map((function(e){return e.toVideoRepresentation()})),r={id:t.id,representations:n,isTrickModeTrack:!0};return!0===t.isSignInterpreted&&(r.signInterpreted=!0),r})):void 0,n={id:this.id,representations:(e?this.getPlayableRepresentations():this.representations).map((function(e){return e.toVideoRepresentation()})),label:this.label};return!0===this.isSignInterpreted&&(n.signInterpreted=!0),!0===this.isTrickModeTrack&&(n.isTrickModeTrack=!0),void 0!==t&&(n.trickModeTracks=t),n},e}()},8619:function(e,t,n){"use strict";n.d(t,{ZP:function(){return E}});var r,i=n(4578),a=n(3887),o=n(3274),s=n(1959),u=n(908),l=n(8806),d=n(3714),c=n(1679),f=n(9665),v=function(){function e(e,t){var n=this;if(this.contentWarnings=[],this.id=e.id,this.adaptations=Object.keys(e.adaptations).reduce((function(r,i){var a=e.adaptations[i];if(null==a)return r;var o=a.map((function(e){var r=new f.Z(e,{representationFilter:t});if(r.representations.length>0&&!r.isSupported){var i=new d.Z("MANIFEST_INCOMPATIBLE_CODECS_ERROR","An Adaptation contains only incompatible codecs.",{adaptation:r});n.contentWarnings.push(i)}return r})).filter((function(e){return e.representations.length>0}));if(o.every((function(e){return!e.isSupported}))&&a.length>0&&("video"===i||"audio"===i))throw new d.Z("MANIFEST_INCOMPATIBLE_CODECS_ERROR","No supported "+i+" adaptations",{adaptation:void 0});return o.length>0&&(r[i]=o),r}),{}),!Array.isArray(this.adaptations.video)&&!Array.isArray(this.adaptations.audio))throw new d.Z("MANIFEST_PARSE_ERROR","No supported audio and video tracks.");this.duration=e.duration,this.start=e.start,null!=this.duration&&null!=this.start&&(this.end=this.start+this.duration),this.streamEvents=void 0===e.streamEvents?[]:e.streamEvents}var t=e.prototype;return t.getAdaptations=function(){var e=this.adaptations;return(0,c.Z)(e).reduce((function(e,t){return null!=t?e.concat(t):e}),[])},t.getAdaptationsForType=function(e){var t=this.adaptations[e];return null==t?[]:t},t.getAdaptation=function(e){return(0,o.Z)(this.getAdaptations(),(function(t){var n=t.id;return e===n}))},t.getSupportedAdaptations=function(e){if(void 0===e)return this.getAdaptations().filter((function(e){return e.isSupported}));var t=this.adaptations[e];return void 0===t?[]:t.filter((function(e){return e.isSupported}))},t.containsTime=function(e){return e>=this.start&&(void 0===this.end||e<this.end)},e}();!function(e){e[e.Full=0]="Full",e[e.Partial=1]="Partial"}(r||(r={}));var p=n(5138);function h(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return m(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return m(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function g(e,t,n){var i={updatedAdaptations:[],removedAdaptations:[],addedAdaptations:[]};e.start=t.start,e.end=t.end,e.duration=t.duration,e.streamEvents=t.streamEvents;for(var o=e.getAdaptations(),s=t.getAdaptations(),u=function(e){var t=o[e],u=(0,p.Z)(s,(function(e){return e.id===t.id}));if(-1===u){a.Z.warn('Manifest: Adaptation "'+o[e].id+'" not found when merging.');var d=o.splice(e,1)[0];e--,i.removedAdaptations.push(d)}else{var c=s.splice(u,1)[0],f=[],v=[],h=[];i.updatedAdaptations.push({adaptation:t,updatedRepresentations:f,addedRepresentations:v,removedRepresentations:h});for(var m,g=t.representations,y=c.representations.slice(),_=function(e){var t=g[e],i=(0,p.Z)(y,(function(e){return e.id===t.id}));if(-1===i){a.Z.warn('Manifest: Representation "'+g[e].id+'" not found when merging.');var o=g.splice(e,1)[0];e--,h.push(o)}else{var s=y.splice(i,1)[0];f.push(t),t.cdnMetadata=s.cdnMetadata,n===r.Full?t.index._replace(s.index):t.index._update(s.index)}b=e},b=0;b<g.length;b++)_(b);if(y.length>0)a.Z.warn("Manifest: "+y.length+" new Representations found when merging."),(m=t.representations).push.apply(m,y),v.push.apply(v,y)}l=e},l=0;l<o.length;l++)u(l);if(s.length>0){a.Z.warn("Manifest: "+s.length+" new Adaptations found when merging.");for(var d,c=h(s);!(d=c()).done;){var f=d.value,v=e.adaptations[f.type];void 0===v?e.adaptations[f.type]=[f]:v.push(f),i.addedAdaptations.push(f)}}return i}function y(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return _(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var b=(0,u.Z)(),S=function(e){function t(t,n){var r,i;r=e.call(this)||this;var a=n.representationFilter,o=n.manifestUpdateUrl;return r.contentWarnings=[],r.id=b(),r.expired=null!==(i=t.expired)&&void 0!==i?i:null,r.transport=t.transportType,r.clockOffset=t.clockOffset,r.periods=t.periods.map((function(e){var t,n=new v(e,a);return(t=r.contentWarnings).push.apply(t,n.contentWarnings),n})).sort((function(e,t){return e.start-t.start})),r.adaptations=void 0===r.periods[0]?{}:r.periods[0].adaptations,r._timeBounds=t.timeBounds,r.isDynamic=t.isDynamic,r.isLive=t.isLive,r.isLastPeriodKnown=t.isLastPeriodKnown,r.uris=void 0===t.uris?[]:t.uris,r.updateUrl=o,r.lifetime=t.lifetime,r.suggestedPresentationDelay=t.suggestedPresentationDelay,r.availabilityStartTime=t.availabilityStartTime,r.publishTime=t.publishTime,r}(0,i.Z)(t,e);var n=t.prototype;return n.getPeriod=function(e){return(0,o.Z)(this.periods,(function(t){return e===t.id}))},n.getPeriodForTime=function(e){return(0,o.Z)(this.periods,(function(t){return e>=t.start&&(void 0===t.end||t.end>e)}))},n.getNextPeriod=function(e){return(0,o.Z)(this.periods,(function(t){return t.start>e}))},n.getPeriodAfter=function(e){var t=e.end;if(void 0===t)return null;var n=(0,o.Z)(this.periods,(function(e){return void 0===e.end||t<e.end}));return void 0===n?null:n},n.getUrls=function(){return this.uris},n.replace=function(e){this._performUpdate(e,r.Full)},n.update=function(e){this._performUpdate(e,r.Partial)},n.getMinimumSafePosition=function(){var e,t,n=this._timeBounds;if(null===n.timeshiftDepth)return null!==(e=n.minimumSafePosition)&&void 0!==e?e:0;var r,i=n.maximumTimeData;if(n.maximumTimeData.isLinear){var a=performance.now()-i.time;r=i.maximumSafePosition+a/1e3}else r=i.maximumSafePosition;var o=r-n.timeshiftDepth;return Math.max(null!==(t=n.minimumSafePosition)&&void 0!==t?t:0,o)},n.getLivePosition=function(){var e=this._timeBounds.maximumTimeData;if(this.isLive&&void 0!==e.livePosition){if(!e.isLinear)return e.livePosition;var t=performance.now()-e.time;return e.livePosition+t/1e3}},n.getMaximumSafePosition=function(){var e=this._timeBounds.maximumTimeData;if(!e.isLinear)return e.maximumSafePosition;var t=performance.now()-e.time;return e.maximumSafePosition+t/1e3},n.updateRepresentationsDeciperability=function(e){var t=function(e,t){for(var n,r=[],i=y(e.periods);!(n=i()).done;)for(var o,s=n.value,u=y(s.getAdaptations());!(o=u()).done;)for(var l,d=o.value,c=y(d.representations);!(l=c()).done;){var f=l.value,v=t(f);v!==f.decipherable&&(r.push({manifest:e,period:s,adaptation:d,representation:f}),f.decipherable=v,a.Z.debug('Decipherability changed for "'+f.id+'"',"("+f.bitrate+")",String(f.decipherable)))}return r}(this,e);t.length>0&&this.trigger("decipherabilityUpdate",t)},n.getAdaptations=function(){(0,l.Z)("manifest.getAdaptations() is deprecated. Please use manifest.period[].getAdaptations() instead");var e=this.periods[0];if(void 0===e)return[];var t=e.adaptations,n=[];for(var r in t)if(t.hasOwnProperty(r)){var i=t[r];n.push.apply(n,i)}return n},n.getAdaptationsForType=function(e){(0,l.Z)("manifest.getAdaptationsForType(type) is deprecated. Please use manifest.period[].getAdaptationsForType(type) instead");var t=this.periods[0];if(void 0===t)return[];var n=t.adaptations[e];return void 0===n?[]:n},n.getAdaptation=function(e){return(0,l.Z)("manifest.getAdaptation(id) is deprecated. Please use manifest.period[].getAdaptation(id) instead"),(0,o.Z)(this.getAdaptations(),(function(t){var n=t.id;return e===n}))},n._performUpdate=function(e,t){var n;if(this.availabilityStartTime=e.availabilityStartTime,this.expired=e.expired,this.isDynamic=e.isDynamic,this.isLive=e.isLive,this.isLastPeriodKnown=e.isLastPeriodKnown,this.lifetime=e.lifetime,this.contentWarnings=e.contentWarnings,this.suggestedPresentationDelay=e.suggestedPresentationDelay,this.transport=e.transport,this.publishTime=e.publishTime,t===r.Full)this._timeBounds=e._timeBounds,this.uris=e.uris,n=function(e,t){for(var n={updatedPeriods:[],addedPeriods:[],removedPeriods:[]},i=0,o=0;o<t.length;o++){for(var s=t[o],u=i,l=e[u];null!=l&&l.id!==s.id;)l=e[++u];if(null!=l){var d,c,f=g(l,s,r.Full);n.updatedPeriods.push({period:l,result:f});var v=t.slice(i,o),p=u-i,h=e.splice.apply(e,[i,p].concat(v));(d=n.removedPeriods).push.apply(d,h),(c=n.addedPeriods).push.apply(c,v),i=o+1}}if(i>e.length)return a.Z.error("Manifest: error when updating Periods"),n;if(i<e.length){var m,y=e.splice(i,e.length-i);(m=n.removedPeriods).push.apply(m,y)}var _,b=t.slice(i,t.length);return b.length>0&&(e.push.apply(e,b),(_=n.addedPeriods).push.apply(_,b)),n}(this.periods,e.periods);else{this._timeBounds.maximumTimeData=e._timeBounds.maximumTimeData,this.updateUrl=e.uris[0],n=function(e,t){var n,i={updatedPeriods:[],addedPeriods:[],removedPeriods:[]};if(0===e.length)return e.splice.apply(e,[0,0].concat(t)),(n=i.addedPeriods).push.apply(n,t),i;if(0===t.length)return i;var o=e[e.length-1];if(o.start<t[0].start){var s;if(o.end!==t[0].start)throw new d.Z("MANIFEST_UPDATE_ERROR","Cannot perform partial update: not enough data");return e.push.apply(e,t),(s=i.addedPeriods).push.apply(s,t),i}var u=(0,p.Z)(e,(function(e){return e.id===t[0].id}));if(u<0)throw new d.Z("MANIFEST_UPDATE_ERROR","Cannot perform partial update: incoherent data");var l=g(e[u],t[0],r.Partial);i.updatedPeriods.push({period:e[u],result:l});for(var c=u+1,f=1;f<t.length;f++){for(var v=t[f],h=-1,m=c;m<e.length;m++)if(v.id===e[m].id){h=m;break}if(h<0){for(var y,_=-1,b=c;b<e.length;b++)if(v.start<e[b].start){_=b;break}var S=_-c,E=e.splice(c,S,v);i.addedPeriods.push(v),(y=i.removedPeriods).push.apply(y,E)}else{if(h>c){var T;a.Z.warn("Manifest: old Periods not found in new when updating, removing");var k=e.splice(c,h-c);(T=i.removedPeriods).push.apply(T,k),h=c}var w=g(e[h],v,r.Full);i.updatedPeriods.push({period:e[h],result:w})}c++}if(c<e.length){var A;a.Z.warn("Manifest: Ending Periods not found in new when updating, removing");var I=e.splice(c,e.length-c);(A=i.removedPeriods).push.apply(A,I)}return i}(this.periods,e.periods);for(var i=this.getMinimumSafePosition();this.periods.length>0;){var o=this.periods[0];if(void 0===o.end||o.end>i)break;this.periods.shift()}}this.adaptations=void 0===this.periods[0]?{}:this.periods[0].adaptations,this.trigger("manifestUpdate",n)},t}(s.Z);var E=S},520:function(e,t,n){"use strict";n.d(t,{K:function(){return a},z:function(){return i}});var r=n(1946);function i(e,t){return e.segment.id===t.segment.id&&e.representation.uniqueId===t.representation.uniqueId}function a(e){if((0,r.Z)(e))return"";var t=e.period,n=e.adaptation,i=e.representation,a=e.segment;return n.type+" P: "+t.id+" A: "+n.id+" R: "+i.id+" S: "+(a.isInit?"init":a.complete?a.time+"-"+a.duration:""+a.time)}},2689:function(e,t,n){"use strict";n.d(t,{s:function(){return r}});var r=Math.pow(2,32)-1},2297:function(e,t,n){"use strict";n.d(t,{Qy:function(){return f},Xj:function(){return p},iz:function(){return c},lp:function(){return d},nR:function(){return v},t_:function(){return l},vA:function(){return u}});var r=n(3887),i=n(811),a=n(6968);function o(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return s(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return s(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function u(e,t){for(var n,r=e,i=o(t);!(n=i()).done;){var a=l(r,n.value);if(null===a)return null;r=a}return r}function l(e,t){var n=f(e,t);return null!==n?e.subarray(n[1],n[2]):null}function d(e,t){for(var n=[],r=e;;){var a=f(r,t);if(null===a)return n;(0,i.Z)(0!==a[2]&&0!==r.length),n.push(r.subarray(a[1],a[2])),r=r.subarray(a[2])}}function c(e,t){var n=f(e,t);return null!==n?e.subarray(n[0],n[2]):null}function f(e,t){for(var n,r,i=e.length,o=0,s=0;o+8<=i;){if(r=o,s=(0,a.pX)(e,r),r+=4,n=(0,a.pX)(e,r),r+=4,0===s)s=i-o;else if(1===s){if(r+8>i)return null;s=(0,a.pV)(e,r),r+=8}if(s<0)throw new Error("ISOBMFF: Size out of range");if(n===t)return 1970628964===t&&(r+=16),[o,r,o+s];o+=s}return null}function v(e,t,n,r,i){for(var o,s=e.length,u=0;u<s;u+=o){var l=u;o=(0,a.pX)(e,l),l+=4;var d=(0,a.pX)(e,l);if(l+=4,0===o)o=s-u;else if(1===o){if(l+8>s)return;o=(0,a.pV)(e,l),l+=8}if(1970628964===d&&l+16<=s&&(0,a.pX)(e,l)===t&&(0,a.pX)(e,l+4)===n&&(0,a.pX)(e,l+8)===r&&(0,a.pX)(e,l+12)===i)return l+=16,e.subarray(l,u+o)}}function p(e){var t=e.length;if(t<8)return r.Z.warn("ISOBMFF: box inferior to 8 bytes, cannot find offsets"),null;var n=0,i=(0,a.pX)(e,n);n+=4;var o=(0,a.pX)(e,n);if(n+=4,0===i)i=t;else if(1===i){if(n+8>t)return r.Z.warn("ISOBMFF: box too short, cannot find offsets"),null;i=(0,a.pV)(e,n),n+=8}if(i<0)throw new Error("ISOBMFF: Size out of range");return 1970628964===o&&(n+=16),[0,n,i]}},6807:function(e,t,n){"use strict";n.d(t,{E3:function(){return u},Le:function(){return o},XA:function(){return i},fs:function(){return s},uq:function(){return a}});var r=n(2297);function i(e){var t=(0,r.t_)(e,1836019558);return null===t?null:(0,r.t_)(t,1953653094)}function a(e){return(0,r.lp)(e,1836019558).reduce((function(e,t){var n=(0,r.t_)(t,1953653094);return null!==n&&e.push(n),e}),[])}function o(e){return(0,r.t_)(e,1835295092)}function s(e){var t=(0,r.t_)(e,1836019574);if(null===t)return null;var n=(0,r.t_)(t,1953653099);return null===n?null:(0,r.t_)(n,1835297121)}function u(e,t){return void 0===t&&(t=0),(0,r.t_)(e.subarray(t),1701671783)}},6490:function(e,t,n){"use strict";n.d(t,{Z:function(){return s},Y:function(){return u}});var r=n(3887);var i="function"==typeof Uint8Array.prototype.slice?function(e,t,n){return e.slice(t,n)}:function(e,t,n){return new Uint8Array(Array.prototype.slice.call(e,t,n))},a=n(3635),o=n(2297);function s(e){var t=0,n=(0,o.t_)(e,1836019574);if(null===n)return[];for(var a=[];t<n.length;){var s=void 0;try{s=(0,o.Qy)(n,1886614376)}catch(e){var l=e instanceof Error?e:"";return r.Z.warn("Error while removing PSSH from ISOBMFF",l),a}if(null==s)return a;var d=i(n,s[0],s[2]),c=u(d,s[1]-s[0]);void 0!==c&&a.push({systemId:c,data:d}),n[s[0]+4]=102,n[s[0]+5]=114,n[s[0]+6]=101,n[s[0]+7]=101,t=s[2]}return a}function u(e,t){if(e[t]>1)r.Z.warn("ISOBMFF: un-handled PSSH version");else{var n=t+4;if(!(n+16>e.length)){var o=i(e,n,n+16);return(0,a.ci)(o)}}}},4644:function(e,t,n){"use strict";n.d(t,{J6:function(){return m},LD:function(){return h},MM:function(){return p},Qx:function(){return f},R0:function(){return y},Wf:function(){return c},s9:function(){return g}});var r=n(3887),i=n(6968),a=n(3635),o=n(2689),s=n(2297),u=n(6807);function l(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return d(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return d(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function c(e,t){var n=(0,s.Qy)(e,1936286840);if(null===n)return null;var r=t,a=n[2]-n[0],o=n[1],u=e[o];o+=8;var l,d=(0,i.pX)(e,o);if(o+=4,0===u)l=(0,i.pX)(e,o),o+=4,r+=(0,i.pX)(e,o)+a,o+=4;else{if(1!==u)return null;l=(0,i.pV)(e,o),o+=8,r+=(0,i.pV)(e,o)+a,o+=8}var c=[];o+=2;var f=(0,i.zK)(e,o);for(o+=2;--f>=0;){var v=(0,i.pX)(e,o);o+=4;var p=2147483647&v;if(1===(2147483648&v)>>>31)throw new Error("sidx with reference_type `1` not yet implemented");var h=(0,i.pX)(e,o);o+=4,o+=4,c.push({time:l,duration:h,timescale:d,range:[r,r+p-1]}),l+=h,r+=p}return c}function f(e){var t=(0,u.XA)(e);if(null!==t){var n=(0,s.t_)(t,1952867444);if(null!==n){var r=n[0];return 1===r?(0,i.pV)(n,4):0===r?(0,i.pX)(n,4):void 0}}}function v(e){var t=(0,s.t_)(e,1952868452);if(null!==t){var n=1,r=(0,i.QI)(t,n);if(n+=3,(8&r)>0)return n+=4,(1&r)>0&&(n+=8),(2&r)>0&&(n+=4),(0,i.pX)(t,n)}}function p(e){var t=(0,u.uq)(e);if(0!==t.length){for(var n,r=0,a=l(t);!(n=a()).done;){var o=n.value,d=(0,s.t_)(o,1953658222);if(null===d)return;var c=0,f=d[c];if(c+=1,f>1)return;var p=(0,i.QI)(d,c);c+=3;var h=(256&p)>0,m=0;if(!h&&void 0===(m=v(o)))return;var g=(1&p)>0,y=(4&p)>0,_=(512&p)>0,b=(1024&p)>0,S=(2048&p)>0,E=(0,i.pX)(d,c);c+=4,g&&(c+=4),y&&(c+=4);for(var T=E,k=0;T-- >0;)h?(k+=(0,i.pX)(d,c),c+=4):k+=m,_&&(c+=4),b&&(c+=4),S&&(c+=4);r+=k}return r}}function h(e){var t=(0,u.fs)(e);if(null!==t){var n=(0,s.t_)(t,1835296868);if(null!==n){var r=0,a=n[r];return r+=4,1===a?(0,i.pX)(n,r+16):0===a?(0,i.pX)(n,r+8):void 0}}}function m(e){var t=e.length;if(t<4)throw new Error("Cannot update box length: box too short");var n=(0,i.pX)(e,0);if(0===n){if(t>o.s){var r=new Uint8Array(t+8);return r.set((0,i.kh)(1),0),r.set(e.subarray(4,8),4),r.set((0,i.el)(t+8),8),r.set(e.subarray(8,t),16),r}return e.set((0,i.kh)(t),0),e}if(1===n){if(t<16)throw new Error("Cannot update box length: box too short");return e.set((0,i.el)(t),8),e}if(t<=o.s)return e.set((0,i.kh)(t),0),e;var a=new Uint8Array(t+8);return a.set((0,i.kh)(1),0),a.set(e.subarray(4,8),4),a.set((0,i.el)(t+8),8),a.set(e.subarray(8,t),16),a}function g(e){for(var t=[],n=0;n<e.length;){var o=(0,u.E3)(e,n);if(null===o)break;var s=o.length;n+=s;var l=o[0];if(0!==l)r.Z.warn("ISOBMFF: EMSG version "+l.toString()+" not supported.");else{var d=4,c=(0,a.DM)(o,d),f=c.end,v=c.string;d=f;var p=(0,a.DM)(o,d),h=p.end,m=p.string;d=h;var g=(0,i.pX)(o,d);d+=4;var y=(0,i.pX)(o,d);d+=4;var _=(0,i.pX)(o,d);d+=4;var b=(0,i.pX)(o,d);d+=4;var S={schemeIdUri:v,value:m,timescale:g,presentationTimeDelta:y,eventDuration:_,id:b,messageData:o.subarray(d,s)};t.push(S)}}if(0!==t.length)return t}function y(e){var t=(0,s.vA)(e,[1836019574,1953653099,1835297121,1835626086,1937007212,1937011556]);if(null===t)return null;var n=t.subarray(8),r=(0,s.t_)(n,1701733238),i=0;if(null===r?(i=28,r=(0,s.t_)(n,1701733217)):i=78,null===r)return null;var a=(0,s.vA)(r.subarray(i),[1936289382,1935894633,1952804451]);return null===a||a.byteLength<24?null:a.subarray(8,24)}},8337:function(e,t,n){"use strict";n.d(t,{Z:function(){return Qe}});var r=n(7904),i=n(1946),a=n(6872),o=n(3887),s=n(3274),u=n(9829);function l(e){var t=Date.parse(e)-performance.now();if(!isNaN(t))return t;o.Z.warn("DASH Parser: Invalid clock received: ",e)}function d(e){for(var t=e.representations,n=null,r=0;r<t.length;r++){var i=t[r].index.getLastAvailablePosition();if(void 0===i)return;null!==i&&(n=null==n?i:Math.min(n,i))}return null===n?null:n}function c(e){for(var t=e.representations,n=null,r=0;r<t.length;r++){var i=t[r].index.getFirstAvailablePosition();if(void 0===i)return;null!==i&&(n=null==n?i:Math.max(n,i))}return null===n?null:n}function f(e){if(0===e.length)throw new Error("DASH Parser: no period available for a dynamic content");var t=function(e){for(var t=0;t<=e.length-1;t++){var n=e[t].adaptations,r=void 0===n.audio?void 0:n.audio[0],i=void 0===n.video?void 0:n.video[0];if(void 0!==r||void 0!==i){var a=null,s=null;if(void 0!==r){var u=c(r);if(void 0===u)return;a=u}if(void 0!==i){var l=c(i);if(void 0===l)return;s=l}if(void 0!==r&&null===a||void 0!==i&&null===s)return void o.Z.info("Parser utils: found Period with no segment. ","Going to next one to calculate first position");if(null!==s)return null!==a?Math.max(a,s):s;if(null!==a)return a}}}(e),n=function(e){for(var t=e.length-1;t>=0;t--){var n=e[t].adaptations,r=void 0===n.audio?void 0:n.audio[0],i=void 0===n.video?void 0:n.video[0];if(void 0!==r||void 0!==i){var a=null,s=null;if(void 0!==r){var u=d(r);if(void 0===u)return{safe:void 0,unsafe:void 0};a=u}if(void 0!==i){var l=d(i);if(void 0===l)return{safe:void 0,unsafe:void 0};s=l}if(void 0!==r&&null===a||void 0!==i&&null===s)return o.Z.info("Parser utils: found Period with no segment. ","Going to previous one to calculate last position"),{safe:void 0,unsafe:void 0};if(null!==s)return null!==a?{safe:Math.min(a,s),unsafe:Math.max(a,s)}:{safe:s,unsafe:s};if(null!==a)return{safe:a,unsafe:a}}}return{safe:void 0,unsafe:void 0}}(e);return{minimumSafePosition:t,maximumSafePosition:n.safe,maximumUnsafePosition:n.unsafe}}var v=n(9592),p=n(908),h=n(1679),m=n(3635);var g=function(){function e(e){this._isDynamic=e.isDynamic,this._timeShiftBufferDepth=e.isDynamic&&void 0!==e.timeShiftBufferDepth?e.timeShiftBufferDepth:null}var t=e.prototype;return t.setLastPosition=function(e,t){this._lastPosition=e,this._positionTime=t},t.lastPositionIsKnown=function(){return this._isDynamic?null!=this._positionTime&&null!=this._lastPosition:null!=this._lastPosition},t.estimateMinimumBound=function(){if(!this._isDynamic||null===this._timeShiftBufferDepth)return 0;var e=this.estimateMaximumBound();return void 0!==e?e-this._timeShiftBufferDepth:void 0},t.estimateMaximumBound=function(){return this._isDynamic&&null!=this._positionTime&&null!=this._lastPosition?Math.max(this._lastPosition-this._positionTime+performance.now()/1e3,0):this._lastPosition},e}(),y=n(9665),_=n(5138),b=n(7714),S=n(6923);function E(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return T(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return T(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function T(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var k=function(e,t){for(var n,r=E(t);!(n=r()).done;)for(var i,a=n.value,o=a.adaptation,s=E(a.trickModeAttachedAdaptationIds);!(i=s()).done;)for(var u,l=i.value,d=E(y.r);!(u=d()).done;){var c=e[u.value];if(void 0!==c)for(var f,v=E(c);!(f=v()).done;){var p=f.value;p.id===l&&(void 0===p.trickModeTracks&&(p.trickModeTracks=[]),p.trickModeTracks.push(o))}}},w=["subtitle","caption"];function A(e,t,n,r){function i(e,t){var n=e.split("/")[0];return(0,b.Z)(y.r,n)?n:"application/ttml+xml"===e||"application/mp4"===e&&null!=t&&null!=(0,s.Z)(t,(function(e){return"urn:mpeg:dash:role:2011"===e.schemeIdUri&&(0,b.Z)(w,e.value)}))?"text":void 0}function a(e){switch(e.substring(0,3)){case"avc":case"hev":case"hvc":case"vp8":case"vp9":case"av1":return"video";case"vtt":return"text"}switch(e.substring(0,4)){case"mp4a":return"audio";case"wvtt":case"stpp":return"text"}}if(null!==t){var o=i(t,r);if(void 0!==o)return o}if(null!==n){var u=a(n);if(void 0!==u)return u}for(var l=0;l<e.length;l++){var d=e[l].attributes,c=d.mimeType,f=d.codecs;if(void 0!==c){var v=i(c,r);if(void 0!==v)return v}if(void 0!==f){var p=a(f);if(void 0!==p)return p}}}var I=n(8026);var R=n(3911);function Z(e,t){var n,r=e.initialization,i={};return void 0!==t&&(i.isEMSGWhitelisted=t),{id:"init",isInit:!0,time:0,end:0,duration:0,timescale:1,range:null!=r?r.range:void 0,indexRange:e.indexRange,url:null!==(n=null==r?void 0:r.url)&&void 0!==n?n:null,complete:!0,privateInfos:i,timestampOffset:-e.indexTimeOffset/e.timescale}}function x(e){return function(t,n,r){var i,a,o,s=(0,S.Z)(r)?parseInt(r,10):1;return i=String(e),a=s,(o=i.toString()).length>=a?o:(new Array(a+1).join("0")+o).slice(-a)}}function P(e,t,n){return function(e,t,n){return-1===e.indexOf("$")?e:e.replace(/\$\$/g,"$").replace(/\$RepresentationID\$/g,String(t)).replace(/\$Bandwidth(\%0(\d+)d)?\$/g,x(void 0===n?0:n))}(e,t,n)}function M(e,t){return function(n){return-1===n.indexOf("$")?n:n.replace(/\$\$/g,"$").replace(/\$Number(\%0(\d+)d)?\$/g,(function(e,n,r){if(void 0===t)throw new Error("Segment number not defined in a $Number$ scheme");return x(t)(e,n,r)})).replace(/\$Time(\%0(\d+)d)?\$/g,(function(t,n,r){if(void 0===e)throw new Error("Segment time not defined in a $Time$ scheme");return x(e)(t,n,r)}))}}function C(e,t,n,r,i){for(var a,o,s=(0,R.gT)(t,e),u=(0,R.gT)(t+n,e),l=e.timeline,d=e.timescale,c=e.segmentUrlTemplate,f=e.startNumber,v=e.endNumber,p=null!=f?f:1,h=[],m=l.length,g=0;g<m;g++){for(var y=l[g],_=y.duration,b=y.start,S=y.range,E=(0,R.KF)(y,l[g+1],i),T=!1!==e.availabilityTimeComplete||g!==m-1&&0!==E,k=(a=_,o=void 0,(o=s-b)>0?Math.floor(o/a):0),w=b+k*_;w<u&&k<=E;){var A=p+k;if(void 0!==v&&A>v)break;var I=null===c?null:M(w,A)(c),Z=w-e.indexTimeOffset,x=_;Z<0&&(x=_+Z,Z=0);var P={id:String(w),time:Z/d,end:(Z+x)/d,duration:x/d,isInit:!1,range:S,timescale:1,url:I,number:A,timestampOffset:-e.indexTimeOffset/d,complete:T,privateInfos:{isEMSGWhitelisted:r}};h.push(P),w=b+ ++k*_}if(w>=u)return h;if(p+=E+1,void 0!==v&&p>v)return h}return h}function D(e,t){if(t.timescale!==e.timescale){var n=e.timescale;e.timeline.push({start:t.time/t.timescale*n,duration:t.duration/t.timescale*n,repeatCount:void 0===t.count?0:t.count,range:t.range})}else e.timeline.push({start:t.time,duration:t.duration,repeatCount:void 0===t.count?0:t.count,range:t.range});return!0}var N=function(){function e(e,t){var n,r,i,a=t.periodStart,o=t.periodEnd,s=t.representationId,u=t.representationBitrate,l=t.isEMSGWhitelisted,d=null!==(n=e.timescale)&&void 0!==n?n:1,c=(null!=e.presentationTimeOffset?e.presentationTimeOffset:0)-a*d,f=void 0===(null===(r=e.initialization)||void 0===r?void 0:r.media)?null:P(e.initialization.media,s,u),v=void 0===e.media?null:P(e.media,s,u),p=void 0!==e.initialization?e.initialization.range:void 0!==e.indexRange?[0,e.indexRange[0]-1]:void 0;this._index={indexRange:e.indexRange,indexTimeOffset:c,initialization:{url:f,range:p},segmentUrlTemplate:v,startNumber:e.startNumber,endNumber:e.endNumber,timeline:null!==(i=e.timeline)&&void 0!==i?i:[],timescale:d},this._scaledPeriodStart=(0,R.gT)(a,this._index),this._scaledPeriodEnd=null==o?void 0:(0,R.gT)(o,this._index),this._isInitialized=this._index.timeline.length>0,this._isEMSGWhitelisted=l}var t=e.prototype;return t.getInitSegment=function(){return Z(this._index,this._isEMSGWhitelisted)},t.getSegments=function(e,t){return C(this._index,e,t,this._isEMSGWhitelisted,this._scaledPeriodEnd)},t.shouldRefresh=function(){return!1},t.getFirstAvailablePosition=function(){var e=this._index;return 0===e.timeline.length?null:(0,R.zG)(Math.max(this._scaledPeriodStart,e.timeline[0].start),e)},t.getLastAvailablePosition=function(){var e,t=this._index.timeline;if(0===t.length)return null;var n=t[t.length-1],r=Math.min((0,R.jH)(n,null,this._scaledPeriodEnd),null!==(e=this._scaledPeriodEnd)&&void 0!==e?e:1/0);return(0,R.zG)(r,this._index)},t.getEnd=function(){return this.getLastAvailablePosition()},t.awaitSegmentBetween=function(){return!1},t.isSegmentStillAvailable=function(){return!0},t.checkDiscontinuity=function(){return null},t.canBeOutOfSyncError=function(){return!1},t.isFinished=function(){return!0},t.isInitialized=function(){return this._isInitialized},t.initialize=function(e){if(!this._isInitialized){for(var t=0;t<e.length;t++)D(this._index,e[t]);this._isInitialized=!0}},t.addPredictedSegments=function(){o.Z.warn("Cannot add predicted segments to a `BaseRepresentationIndex`")},t._replace=function(e){this._index=e._index,this._isInitialized=e._isInitialized,this._scaledPeriodEnd=e._scaledPeriodEnd,this._isEMSGWhitelisted=e._isEMSGWhitelisted},t._update=function(){o.Z.error("Base RepresentationIndex: Cannot update a SegmentList")},e}(),O=function(){function e(e,t){var n,r;if(void 0===e.duration)throw new Error("Invalid SegmentList: no duration");var i=t.periodStart,a=t.periodEnd,o=t.representationId,s=t.representationBitrate,u=t.isEMSGWhitelisted;this._isEMSGWhitelisted=u,this._periodStart=i,this._periodEnd=a;var l=null!=e.presentationTimeOffset?e.presentationTimeOffset:0,d=null!==(n=e.timescale)&&void 0!==n?n:1,c=l-i*d,f=void 0===(null===(r=e.initialization)||void 0===r?void 0:r.media)?null:P(e.initialization.media,o,s),v=e.list.map((function(e){return{url:void 0===e.media?null:P(e.media,o,s),mediaRange:e.mediaRange}}));this._index={list:v,timescale:d,duration:e.duration,indexTimeOffset:c,indexRange:e.indexRange,initialization:null==e.initialization?void 0:{url:f,range:e.initialization.range}}}var t=e.prototype;return t.getInitSegment=function(){var e=Z(this._index);return void 0===e.privateInfos&&(e.privateInfos={}),e.privateInfos.isEMSGWhitelisted=this._isEMSGWhitelisted,e},t.getSegments=function(e,t){for(var n=this._index,r=n.duration,i=n.list,a=n.timescale,o=r/a,s=e-this._periodStart,u=(0,R.PZ)(s,t,a),l=u[0],d=u[1],c=Math.min(i.length-1,Math.floor(d/r)),f=[],v=Math.floor(l/r);v<=c;){var p=i[v].mediaRange,h=i[v].url,m=v*o+this._periodStart,g={id:String(v),time:m,isInit:!1,range:p,duration:o,timescale:1,end:m+o,url:h,timestampOffset:-n.indexTimeOffset/a,complete:!0,privateInfos:{isEMSGWhitelisted:this._isEMSGWhitelisted}};f.push(g),v++}return f},t.shouldRefresh=function(e,t){return!1},t.getFirstAvailablePosition=function(){return this._periodStart},t.getLastAvailablePosition=function(){var e,t=this._index,n=t.duration,r=t.list;return Math.min(r.length*n/t.timescale+this._periodStart,null!==(e=this._periodEnd)&&void 0!==e?e:1/0)},t.getEnd=function(){return this.getLastAvailablePosition()},t.awaitSegmentBetween=function(){return!1},t.isSegmentStillAvailable=function(){return!0},t.checkDiscontinuity=function(){return null},t.canBeOutOfSyncError=function(){return!1},t.isFinished=function(){return!0},t.isInitialized=function(){return!0},t.initialize=function(){o.Z.error("A `ListRepresentationIndex` does not need to be initialized")},t.addPredictedSegments=function(){o.Z.warn("Cannot add predicted segments to a `ListRepresentationIndex`")},t._replace=function(e){this._index=e._index},t._update=function(){o.Z.error("A `ListRepresentationIndex` cannot be updated")},e}(),L=n(9362),U=n(811),B=n(8232),F=n(1091),z=n(5505);function V(e){return a.Z.getCurrent().DEFAULT_MAXIMUM_TIME_ROUNDING_ERROR*e}function K(e,t,n){var r=e.start,a=e.duration,s=e.repeatCount;return void 0===r&&(null===t?r=0:(0,i.Z)(t.duration)||(r=t.start+t.duration*(t.repeatCount+1))),void 0!==a&&!isNaN(a)||null===n||void 0===n.start||isNaN(n.start)||void 0===r||isNaN(r)||(a=n.start-r),void 0===r||isNaN(r)||void 0===a||isNaN(a)||void 0!==s&&isNaN(s)?(o.Z.warn('DASH: A "S" Element could not have been parsed.'),null):{start:r,duration:a,repeatCount:void 0===s?0:s}}function G(e){for(var t={},n=0;n<e.attributes.length;n++){var r=e.attributes[n];switch(r.name){case"t":var i=parseInt(r.value,10);isNaN(i)?o.Z.warn('DASH: invalid t ("'+r.value+'")'):t.start=i;break;case"d":var a=parseInt(r.value,10);isNaN(a)?o.Z.warn('DASH: invalid d ("'+r.value+'")'):t.duration=a;break;case"r":var s=parseInt(r.value,10);isNaN(s)?o.Z.warn('DASH: invalid r ("'+r.value+'")'):t.repeatCount=s}}return t}function j(e){for(var t=[],n=0;n<e.length;n++)t.push(G(e[n]));for(var r=[],i=0;i<t.length;i++){var a=K(t[i],void 0===r[r.length-1]?null:r[r.length-1],void 0===t[i+1]?null:t[i+1]);null!==a&&r.push(a)}return r}function H(e,t){var n,r=function(e,t){if(0===e.length||0===t.length)return null;var n=e[0].start,r=t[0].getAttribute("t"),i=null===r?null:parseInt(r,10);if(null===i||Number.isNaN(i))return null;if(n===i)return{prevSegmentsIdx:0,newElementsIdx:0,repeatNumberInPrevSegments:0,repeatNumberInNewElements:0};if(n<i)for(var a=e[0],o=0;;){if(a.repeatCount>0){var s=i-a.start;if(s%a.duration==0&&s/a.duration<=a.repeatCount)return{repeatNumberInPrevSegments:s/a.duration,prevSegmentsIdx:o,newElementsIdx:0,repeatNumberInNewElements:0}}if(++o>=e.length)return null;if((a=e[o]).start===i)return{prevSegmentsIdx:o,newElementsIdx:0,repeatNumberInPrevSegments:0,repeatNumberInNewElements:0};if(a.start>i)return null}else for(var u=0,l=t[0],d=i;;){var c=l.getAttribute("d"),f=null===c?null:parseInt(c,10);if(null===f||Number.isNaN(f))return null;var v=l.getAttribute("r"),p=null===v?null:parseInt(v,10);if(null!==p){if(Number.isNaN(p)||p<0)return null;if(p>0){var h=n-d;if(h%f==0&&h/f<=p)return{repeatNumberInPrevSegments:0,repeatNumberInNewElements:h/f,prevSegmentsIdx:0,newElementsIdx:u}}d+=f*(p+1)}else d+=f;if(++u>=t.length)return null;var m=(l=t[u]).getAttribute("t"),g=null===m?null:parseInt(m,10);if(null!==g){if(Number.isNaN(g))return null;d=g}if(d===n)return{newElementsIdx:u,prevSegmentsIdx:0,repeatNumberInPrevSegments:0,repeatNumberInNewElements:0};if(d>i)return null}}(t,e);if(null===r)return o.Z.warn('DASH: Cannot perform "based" update. Common segment not found.'),j(e);var i=r.prevSegmentsIdx,a=r.newElementsIdx,s=r.repeatNumberInPrevSegments,u=r.repeatNumberInNewElements,l=t.length-i+a-1;if(l>=e.length)return o.Z.info('DASH: Cannot perform "based" update. New timeline too short'),j(e);var d=t.slice(i);if(s>0){var c=d[0];c.start+=c.duration*s,d[0].repeatCount-=s}if(u>0&&0!==a)return o.Z.info('DASH: Cannot perform "based" update. The new timeline has a different form.'),j(e);var f=d[d.length-1],v=G(e[l]),p=(null!==(n=v.repeatCount)&&void 0!==n?n:0)-u;if(v.duration!==f.duration||f.repeatCount>p)return o.Z.info('DASH: Cannot perform "based" update. The new timeline has a different form at the beginning.'),j(e);void 0!==v.repeatCount&&v.repeatCount>f.repeatCount&&(f.repeatCount=v.repeatCount);for(var h=[],m=[],g=l+1;g<e.length;g++)m.push(G(e[g]));for(var y=0;y<m.length;y++){var _=K(m[y],void 0===h[h.length-1]?f:h[h.length-1],void 0===m[y+1]?null:m[y+1]);null!==_&&h.push(_)}return d.concat(h)}var W=function(){function e(t,n){var r,i,a;if(!e.isTimelineIndexArgument(t))throw new Error("The given index is not compatible with a TimelineRepresentationIndex.");var o=n.availabilityTimeComplete,s=n.manifestBoundsCalculator,u=n.isDynamic,l=n.isLastPeriod,d=n.representationId,c=n.representationBitrate,f=n.periodStart,v=n.periodEnd,p=n.isEMSGWhitelisted,h=null!==(r=t.timescale)&&void 0!==r?r:1,m=(null!=t.presentationTimeOffset?t.presentationTimeOffset:0)-f*h;this._manifestBoundsCalculator=s,this._isEMSGWhitelisted=p,this._isLastPeriod=l,this._lastUpdate=null==n.receivedTime?performance.now():n.receivedTime,this._unsafelyBaseOnPreviousIndex=null,null!==n.unsafelyBaseOnPreviousRepresentation&&n.unsafelyBaseOnPreviousRepresentation.index instanceof e&&(n.unsafelyBaseOnPreviousRepresentation.index._unsafelyBaseOnPreviousIndex=null,this._unsafelyBaseOnPreviousIndex=n.unsafelyBaseOnPreviousRepresentation.index),this._isDynamic=u,this._parseTimeline=null!==(i=t.timelineParser)&&void 0!==i?i:null;var g=void 0===(null===(a=t.initialization)||void 0===a?void 0:a.media)?null:P(t.initialization.media,d,c),y=void 0===t.media?null:P(t.media,d,c);this._index={availabilityTimeComplete:o,indexRange:t.indexRange,indexTimeOffset:m,initialization:null==t.initialization?void 0:{url:g,range:t.initialization.range},segmentUrlTemplate:y,startNumber:t.startNumber,endNumber:t.endNumber,timeline:void 0===t.timeline?null:q(t.timeline,t.startNumber,t.endNumber),timescale:h},this._scaledPeriodStart=(0,R.gT)(f,this._index),this._scaledPeriodEnd=void 0===v?void 0:(0,R.gT)(v,this._index)}var t=e.prototype;return t.getInitSegment=function(){return Z(this._index,this._isEMSGWhitelisted)},t.getSegments=function(e,t){this._refreshTimeline(),null===this._index.timeline&&(this._index.timeline=this._getTimeline());var n=this._index;return C({segmentUrlTemplate:n.segmentUrlTemplate,startNumber:n.startNumber,endNumber:n.endNumber,timeline:n.timeline,timescale:n.timescale,indexTimeOffset:n.indexTimeOffset},e,t,this._isEMSGWhitelisted,this._scaledPeriodEnd)},t.shouldRefresh=function(){return!1},t.getFirstAvailablePosition=function(){this._refreshTimeline(),null===this._index.timeline&&(this._index.timeline=this._getTimeline());var e=this._index.timeline;return 0===e.length?null:(0,R.zG)(Math.max(this._scaledPeriodStart,e[0].start),this._index)},t.getLastAvailablePosition=function(){this._refreshTimeline(),null===this._index.timeline&&(this._index.timeline=this._getTimeline());var t=e.getIndexEnd(this._index.timeline,this._scaledPeriodEnd);return null===t?null:(0,R.zG)(t,this._index)},t.getEnd=function(){if(!this._isDynamic||!this._isLastPeriod)return this.getLastAvailablePosition()},t.awaitSegmentBetween=function(e,t){var n;if((0,U.Z)(e<=t),!this._isDynamic||!this._isLastPeriod)return!1;this._refreshTimeline(),null===this._index.timeline&&(this._index.timeline=this._getTimeline());var r=this._index,i=r.timeline,a=V(r.timescale),o=(0,R.gT)(t,this._index);if(i.length>0){var s=i[i.length-1];if((0,R.jH)(s,null,this._scaledPeriodEnd)+a>=Math.min(o,null!==(n=this._scaledPeriodEnd)&&void 0!==n?n:1/0))return!1}return void 0===this._scaledPeriodEnd?o+a>this._scaledPeriodStart&&void 0:(0,R.gT)(e,this._index)-a<this._scaledPeriodEnd&&o+a>this._scaledPeriodStart},t.isSegmentStillAvailable=function(e){if(e.isInit)return!0;this._refreshTimeline(),null===this._index.timeline&&(this._index.timeline=this._getTimeline());var t=this._index,n=t.timeline,r=t.timescale,i=t.indexTimeOffset;return(0,F.Z)(e,n,r,i)},t.checkDiscontinuity=function(e){this._refreshTimeline();var t=this._index.timeline;return null===t&&(t=this._getTimeline(),this._index.timeline=t),(0,R._j)({timeline:t,timescale:this._index.timescale,indexTimeOffset:this._index.indexTimeOffset},e,this._scaledPeriodEnd)},t.canBeOutOfSyncError=function(e){return!!this._isDynamic&&(e instanceof L.Z&&e.isHttpError(404))},t._replace=function(e){this._parseTimeline=e._parseTimeline,this._index=e._index,this._isDynamic=e._isDynamic,this._scaledPeriodStart=e._scaledPeriodStart,this._scaledPeriodEnd=e._scaledPeriodEnd,this._lastUpdate=e._lastUpdate,this._manifestBoundsCalculator=e._manifestBoundsCalculator,this._isLastPeriod=e._isLastPeriod},t._update=function(e){null===this._index.timeline&&(this._index.timeline=this._getTimeline()),null===e._index.timeline&&(e._index.timeline=e._getTimeline()),(0,z.Z)(this._index.timeline,e._index.timeline)&&(this._index.startNumber=e._index.startNumber),this._index.endNumber=e._index.endNumber,this._isDynamic=e._isDynamic,this._scaledPeriodStart=e._scaledPeriodStart,this._scaledPeriodEnd=e._scaledPeriodEnd,this._lastUpdate=e._lastUpdate,this._isLastPeriod=e._isLastPeriod},t.isFinished=function(){if(!this._isDynamic||!this._isLastPeriod)return!0;null===this._index.timeline&&(this._index.timeline=this._getTimeline());var e=this._index.timeline;if(void 0===this._scaledPeriodEnd||0===e.length)return!1;var t=e[e.length-1];return(0,R.jH)(t,null,this._scaledPeriodEnd)+V(this._index.timescale)>=this._scaledPeriodEnd},t.isInitialized=function(){return!0},t.initialize=function(){o.Z.error("A `TimelineRepresentationIndex` does not need to be initialized")},t.addPredictedSegments=function(){o.Z.warn("Cannot add predicted segments to a `TimelineRepresentationIndex`")},e.isTimelineIndexArgument=function(e){return"function"==typeof e.timelineParser||Array.isArray(e.timeline)},t._refreshTimeline=function(){if(null===this._index.timeline&&(this._index.timeline=this._getTimeline()),this._isDynamic){var e=this._manifestBoundsCalculator.estimateMinimumBound();if(null!=e){var t=(0,R.gT)(e,this._index),n=(0,B.Z)(this._index.timeline,t);void 0!==this._index.startNumber?this._index.startNumber+=n:void 0!==this._index.endNumber&&(this._index.startNumber=n+1)}}},e.getIndexEnd=function(e,t){return e.length<=0?null:Math.min((0,R.jH)(e[e.length-1],null,t),null!=t?t:1/0)},t._getTimeline=function(){if(null===this._parseTimeline)return null!==this._index.timeline?this._index.timeline:(o.Z.error("DASH: Timeline already lazily parsed."),[]);var e=this._parseTimeline();this._parseTimeline=null;var t,n=a.Z.getCurrent().MIN_DASH_S_ELEMENTS_TO_PARSE_UNSAFELY;return null===this._unsafelyBaseOnPreviousIndex||e.length<n?q(j(e),this._index.startNumber,this._index.endNumber):(null===this._unsafelyBaseOnPreviousIndex._index.timeline?(t=this._unsafelyBaseOnPreviousIndex._getTimeline(),this._unsafelyBaseOnPreviousIndex._index.timeline=t):t=this._unsafelyBaseOnPreviousIndex._index.timeline,this._unsafelyBaseOnPreviousIndex=null,q(H(e,t),this._index.startNumber,this._index.endNumber))},e}();function q(e,t,n){if(void 0===n)return e;for(var r=null!=t?t:1,i=0;i<e.length;i++){var a=e[i];if((r+=a.repeatCount+1)>n){if(r===n+1)return e.slice(0,i+1);var o=e.slice(0,i),s=Object.assign({},a),u=r-a.repeatCount-1;return s.repeatCount=Math.max(0,n-u),o.push(s),o}}return e}var Y=W,X=function(){function e(e,t){var n,r,i=t.availabilityTimeOffset,a=t.manifestBoundsCalculator,o=t.isDynamic,s=t.periodEnd,u=t.periodStart,l=t.representationId,d=t.representationBitrate,c=t.isEMSGWhitelisted,f=null!==(n=e.timescale)&&void 0!==n?n:1;this._availabilityTimeOffset=i,this._manifestBoundsCalculator=a;var v=null!=e.presentationTimeOffset?e.presentationTimeOffset:0,p=v-u*f;if(void 0===e.duration)throw new Error("Invalid SegmentTemplate: no duration");var h=void 0===(null===(r=e.initialization)||void 0===r?void 0:r.media)?null:P(e.initialization.media,l,d),m=void 0===e.media?null:P(e.media,l,d);this._index={duration:e.duration,timescale:f,indexRange:e.indexRange,indexTimeOffset:p,initialization:null==e.initialization?void 0:{url:h,range:e.initialization.range},url:m,presentationTimeOffset:v,startNumber:e.startNumber,endNumber:e.endNumber},this._isDynamic=o,this._periodStart=u,this._scaledRelativePeriodEnd=void 0===s?void 0:(s-u)*f,this._isEMSGWhitelisted=c}var t=e.prototype;return t.getInitSegment=function(){return Z(this._index,this._isEMSGWhitelisted)},t.getSegments=function(e,t){var n=this._index,r=n.duration,i=n.startNumber,a=n.endNumber,o=n.timescale,s=n.url,u=this._periodStart*o,l=this._scaledRelativePeriodEnd,d=e*o-u,c=(e+t)*o-u,f=this._getFirstSegmentStart(),v=this._getLastSegmentStart();if(null==f||null==v)return[];var p=Math.max(f,d),h=Math.min(v,c);if(h+r<=p)return[];for(var m=[],g=null!=i?i:1,y=Math.floor(p/r),_=y*r;_<=h;_+=r){var b=y+g;if(void 0!==a&&b>a)return m;var S=null!=l&&_+r>l?l-_:r,E=_+u,T=_+this._index.presentationTimeOffset,k=null===s?null:M(T,b)(s),w={id:String(b),number:b,time:E/o,end:(E+S)/o,duration:S/o,timescale:1,isInit:!1,scaledDuration:S/o,url:k,timestampOffset:-n.indexTimeOffset/o,complete:!0,privateInfos:{isEMSGWhitelisted:this._isEMSGWhitelisted}};m.push(w),y++}return m},t.getFirstAvailablePosition=function(){var e=this._getFirstSegmentStart();return null==e?e:e/this._index.timescale+this._periodStart},t.getLastAvailablePosition=function(){var e=this._getLastSegmentStart();if((0,i.Z)(e))return e;var t=this._estimateRelativeScaledEnd();return Math.min(e+this._index.duration,null!=t?t:1/0)/this._index.timescale+this._periodStart},t.getEnd=function(){if(!this._isDynamic)return this.getLastAvailablePosition();var e=this._estimateRelativeScaledEnd();if(void 0!==e){var t=this._index.timescale;return(e+this._periodStart*t)/t}},t.awaitSegmentBetween=function(e,t){if((0,U.Z)(e<=t),!this._isDynamic)return!1;var n=this._index.timescale,r=V(n),i=this._periodStart*n,a=t*n-i,o=this._estimateRelativeScaledEnd();return void 0===o?a+r>=0:e*n-i-r<o},t.shouldRefresh=function(){return!1},t.checkDiscontinuity=function(){return null},t.isSegmentStillAvailable=function(e){if(e.isInit)return!0;var t=this.getSegments(e.time,.1);return 0!==t.length&&(t[0].time===e.time&&t[0].end===e.end&&t[0].number===e.number)},t.canBeOutOfSyncError=function(){return!1},t.isFinished=function(){if(!this._isDynamic)return!0;var e=this._estimateRelativeScaledEnd();if(void 0===e)return!1;var t=this._index.timescale,n=this._getLastSegmentStart();return!(0,i.Z)(n)&&n+this._index.duration+V(t)>=e},t.isInitialized=function(){return!0},t.initialize=function(){o.Z.error("A `TemplateRepresentationIndex` does not need to be initialized")},t.addPredictedSegments=function(){o.Z.warn("Cannot add predicted segments to a `TemplateRepresentationIndex`")},t._replace=function(e){this._index=e._index,this._isDynamic=e._isDynamic,this._periodStart=e._periodStart,this._scaledRelativePeriodEnd=e._scaledRelativePeriodEnd,this._manifestBoundsCalculator=e._manifestBoundsCalculator},t._update=function(e){this._replace(e)},t._getFirstSegmentStart=function(){if(!this._isDynamic)return 0;if(0===this._scaledRelativePeriodEnd||void 0===this._scaledRelativePeriodEnd){var e=this._manifestBoundsCalculator.estimateMaximumBound();if(void 0!==e&&e<this._periodStart)return null}var t=this._index,n=t.duration,r=t.timescale,i=this._manifestBoundsCalculator.estimateMinimumBound();if(void 0!==i){var a=i>this._periodStart?(i-this._periodStart)*r:0;return Math.floor(a/n)*n}},t._getLastSegmentStart=function(){var e,t=this._index,n=t.duration,r=t.timescale,i=t.endNumber,o=t.startNumber,s=void 0===o?1:o;if(this._isDynamic){var u=this._manifestBoundsCalculator.estimateMaximumBound();if(void 0===u)return;if(void 0!==this._scaledRelativePeriodEnd&&this._scaledRelativePeriodEnd<(u-this._periodStart)*this._index.timescale){var l=Math.ceil(this._scaledRelativePeriodEnd/n);return void 0!==i&&i-s+1<l&&(l=i-s+1),(l-1)*n}var d=(u-this._periodStart)*r;if(d<0)return null;var c=(void 0!==this._availabilityTimeOffset?this._availabilityTimeOffset:0)*r,f=Math.floor((d+c)/n);return void 0!==i&&i-s+1<f&&(f=i-s+1),f<=0?null:(f-1)*n}var v=null!==(e=this._scaledRelativePeriodEnd)&&void 0!==e?e:0,p=Math.ceil(v/n);void 0!==i&&i-s+1<p&&(p=i-s+1);var h=(p-1)*n,m=a.Z.getCurrent().MINIMUM_SEGMENT_SIZE*r;return void 0!==i||v-h>m||p<2?h:(p-2)*n},t._estimateRelativeScaledEnd=function(){var e,t;if(void 0!==this._index.endNumber){var n=this._index.endNumber-(null!==(e=this._index.startNumber)&&void 0!==e?e:1)+1;return Math.max(Math.min(n*this._index.duration,null!==(t=this._scaledRelativePeriodEnd)&&void 0!==t?t:1/0),0)}if(void 0!==this._scaledRelativePeriodEnd)return Math.max(this._scaledRelativePeriodEnd,0)},e}();function Q(e,t){var n;if(0===t.length)return e;var r=t.map((function(e){return{url:e.value}}));if(0===e.length)return r;for(var i=[],a=0;a<e.length;a++)for(var o=e[a],s=0;s<r.length;s++){var l=r[s],d=(0,u.Z)(o.url,l.url);i.push({url:d,serviceLocation:null!==(n=l.serviceLocation)&&void 0!==n?n:o.serviceLocation})}return i}function $(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return J(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return J(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function J(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ee(e){var t=e.adaptationProfiles,n=e.essentialProperties,r=e.supplementalProperties,i=e.manifestProfiles,a=e.codecs;if(-1!==((null!=t?t:"")+(null!=i?i:"")).indexOf("http://dashif.org/guidelines/dash-if-uhd#hevc-hdr-pq10")&&("hvc1.2.4.L153.B0"===a||"hev1.2.4.L153.B0"===a))return{colorDepth:10,eotf:"pq",colorSpace:"rec2020"};var o=(0,s.Z)([].concat(null!=n?n:[],null!=r?r:[]),(function(e){return"urn:mpeg:mpegB:cicp:TransferCharacteristics"===e.schemeIdUri}));if(void 0!==o)switch(o.value){case"15":return;case"16":return{eotf:"pq"};case"18":return{eotf:"hlg"}}return void 0!==a&&/^vp(08|09|10)/.exec(a)?function(e){var t,n,r,i=e.split("."),a=i[0],o=(i[1],i[2],i[3]),s=(i[4],i[5]),u=i[6],l=i[7];if(("vp08"===a||"vp09"===a||"vp10"===a)&&((void 0!==o&&"10"===o||"12"===o)&&(t=parseInt(o,10)),void 0!==u&&("16"===u?n="pq":"18"===u&&(n="hlg")),void 0!==s&&void 0!==l&&"09"===s&&"09"===l&&(r="rec2020"),void 0!==t&&void 0!==n))return{colorDepth:t,eotf:n,colorSpace:r}}(a):void 0}function te(e,t,n){for(var r,i,a,u,l,d=[],c=function(){for(var e=l.value,c=null!=e.attributes.id?e.attributes.id:String(e.attributes.bitrate)+(null!=e.attributes.height?"-"+e.attributes.height:"")+(null!=e.attributes.width?"-"+e.attributes.width:"")+(null!=e.attributes.mimeType?"-"+e.attributes.mimeType:"")+(null!=e.attributes.codecs?"-"+e.attributes.codecs:"");d.some((function(e){return e.id===c}));)c+="-dup";var f,v=null!==(i=null===(r=n.unsafelyBaseOnPreviousAdaptation)||void 0===r?void 0:r.getRepresentation(c))&&void 0!==i?i:null,p=function(e,t){var n=[];if(void 0!==e.children.inbandEventStreams&&n.push.apply(n,e.children.inbandEventStreams),void 0!==t.children.inbandEventStreams&&n.push.apply(n,t.children.inbandEventStreams),0!==n.length)return n}(e,t),h=null!==(a=e.attributes.availabilityTimeComplete)&&void 0!==a?a:n.availabilityTimeComplete,m=(null!==(u=e.attributes.availabilityTimeOffset)&&void 0!==u?u:0)+n.availabilityTimeOffset,g=function(e,t){var n,r,i,a=t.availabilityTimeOffset,o=t.manifestBoundsCalculator,s=t.isDynamic,u=t.end,l=t.start,d=t.receivedTime,c=t.timeShiftBufferDepth,f=t.unsafelyBaseOnPreviousRepresentation,v=t.inbandEventStreams,p={availabilityTimeComplete:!0,availabilityTimeOffset:a,unsafelyBaseOnPreviousRepresentation:f,isEMSGWhitelisted:function(e){return void 0!==v&&v.some((function(t){return t.schemeIdUri===e.schemeIdUri}))},isLastPeriod:t.isLastPeriod,manifestBoundsCalculator:o,isDynamic:s,periodEnd:u,periodStart:l,receivedTime:d,representationBitrate:e.attributes.bitrate,representationId:e.attributes.id,timeShiftBufferDepth:c};if(void 0!==e.children.segmentBase){var h=e.children.segmentBase;i=new N(h,p)}else if(void 0!==e.children.segmentList){var m=e.children.segmentList;i=new O(m,p)}else if(void 0!==e.children.segmentTemplate||t.parentSegmentTemplates.length>0){var g=t.parentSegmentTemplates.slice(),y=e.children.segmentTemplate;void 0!==y&&g.push(y);var _=I.Z.apply(void 0,[{}].concat(g));p.availabilityTimeComplete=null!==(n=_.availabilityTimeComplete)&&void 0!==n?n:t.availabilityTimeComplete,p.availabilityTimeOffset=(null!==(r=_.availabilityTimeOffset)&&void 0!==r?r:0)+t.availabilityTimeOffset,i=Y.isTimelineIndexArgument(_)?new Y(_,p):new X(_,p)}else{var b=t.adaptation.children;if(void 0!==b.segmentBase){var S=b.segmentBase;i=new N(S,p)}else if(void 0!==b.segmentList){var E=b.segmentList;i=new O(E,p)}else i=new X({duration:Number.MAX_VALUE,timescale:1,startNumber:0,media:""},p)}return i}(e,(0,I.Z)({},n,{availabilityTimeOffset:m,availabilityTimeComplete:h,unsafelyBaseOnPreviousRepresentation:v,adaptation:t,inbandEventStreams:p}));null==e.attributes.bitrate?(o.Z.warn("DASH: No usable bitrate found in the Representation."),f=0):f=e.attributes.bitrate;var y,_=Q(n.baseURLs,e.children.baseURLs),b={bitrate:f,cdnMetadata:0===_.length?[{baseUrl:"",id:void 0}]:_.map((function(e){return{baseUrl:e.url,id:e.serviceLocation}})),index:g,id:c};null!=e.attributes.codecs?y=e.attributes.codecs:null!=t.attributes.codecs&&(y=t.attributes.codecs),null!=y&&(y="mp4a.40.02"===y?"mp4a.40.2":y,b.codecs=y),null!=e.attributes.frameRate?b.frameRate=e.attributes.frameRate:null!=t.attributes.frameRate&&(b.frameRate=t.attributes.frameRate),null!=e.attributes.height?b.height=e.attributes.height:null!=t.attributes.height&&(b.height=t.attributes.height),null!=e.attributes.mimeType?b.mimeType=e.attributes.mimeType:null!=t.attributes.mimeType&&(b.mimeType=t.attributes.mimeType),null!=e.attributes.width?b.width=e.attributes.width:null!=t.attributes.width&&(b.width=t.attributes.width);var S=void 0!==t.children.contentProtections?t.children.contentProtections:[];if(void 0!==e.children.contentProtections&&S.push.apply(S,e.children.contentProtections),S.length>0){var E=S.reduce((function(e,t){var n;if(void 0!==t.attributes.schemeIdUri&&"urn:uuid:"===t.attributes.schemeIdUri.substring(0,9)&&(n=t.attributes.schemeIdUri.substring(9).replace(/-/g,"").toLowerCase()),void 0!==t.attributes.keyId&&t.attributes.keyId.length>0){var r={keyId:t.attributes.keyId,systemId:n};void 0===e.keyIds?e.keyIds=[r]:e.keyIds.push(r)}if(void 0!==n){for(var i,a=[],o=$(t.children.cencPssh);!(i=o()).done;){var u=i.value;a.push({systemId:n,data:u})}if(a.length>0){var l,d=(0,s.Z)(e.initData,(function(e){return"cenc"===e.type}));if(void 0===d)e.initData.push({type:"cenc",values:a});else(l=d.values).push.apply(l,a)}}return e}),{keyIds:void 0,initData:[]});(Object.keys(E.initData).length>0||void 0!==E.keyIds&&E.keyIds.length>0)&&(b.contentProtections=E)}b.hdrInfo=ee({adaptationProfiles:t.attributes.profiles,supplementalProperties:t.children.supplementalProperties,essentialProperties:t.children.essentialProperties,manifestProfiles:n.manifestProfiles,codecs:y}),d.push(b)},f=$(e);!(l=f()).done;)c();return d}function ne(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return re(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return re(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function re(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ie(e){if(void 0===e)return!1;var t="urn:tva:metadata:cs:AudioPurposeCS:2007"===e.schemeIdUri&&"1"===e.value,n="urn:mpeg:dash:role:2011"===e.schemeIdUri&&"description"===e.value;return t||n}function ae(e,t){if(void 0!==e&&e.some((function(e){return"urn:tva:metadata:cs:AudioPurposeCS:2007"===e.schemeIdUri&&"2"===e.value})))return!0;if(void 0!==t&&t.some((function(e){return"urn:mpeg:dash:role:2011"===e.schemeIdUri&&"caption"===e.value})))return!0;return!1}function oe(e){return void 0!==e&&("urn:mpeg:dash:role:2011"===e.schemeIdUri&&"sign"===e.value)}function se(e,t){if((0,S.Z)(e.attributes.id))return e.attributes.id;var n=t.isClosedCaption,r=t.isForcedSubtitle,i=t.isAudioDescription,a=t.isSignInterpreted,o=t.isTrickModeTrack,s=t.type;return(0,S.Z)(e.attributes.language)&&(s+="-"+e.attributes.language),!0===n&&(s+="-cc"),!0===r&&(s+="-cc"),!0===i&&(s+="-ad"),!0===a&&(s+="-si"),o&&(s+="-trickMode"),(0,S.Z)(e.attributes.contentType)&&(s+="-"+e.attributes.contentType),(0,S.Z)(e.attributes.codecs)&&(s+="-"+e.attributes.codecs),(0,S.Z)(e.attributes.mimeType)&&(s+="-"+e.attributes.mimeType),void 0!==e.attributes.frameRate&&(s+="-"+String(e.attributes.frameRate)),s}function ue(e){if(null!=e.children.supplementalProperties)for(var t,n=ne(e.children.supplementalProperties);!(t=n()).done;){var r=t.value;if("urn:mpeg:dash:adaptation-set-switching:2016"===r.schemeIdUri&&null!=r.value)return r.value.split(",").map((function(e){return e.trim()})).filter((function(e){return e}))}return[]}function le(e,t){var n=t[1].priority-e[1].priority;return 0!==n?n:e[1].isMainAdaptation!==t[1].isMainAdaptation?e[1].isMainAdaptation?-1:1:e[1].indexInMpd-t[1].indexInMpd}function de(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return ce(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ce(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ce(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var fe=(0,p.Z)();function ve(e,t){var n,r,i,a,u,l,d=[],c=function(e,t){var n=[];return e.forEach((function(r,i){var a,o;if(null!=r.attributes.start)a=r.attributes.start;else if(0===i)a=t.isDynamic&&null!=t.availabilityStartTime?t.availabilityStartTime:0;else{var s=n[n.length-1];if(null==s||null==s.periodEnd)throw new Error("Missing start time when parsing periods.");a=s.periodEnd}var u=e[i+1];null!=r.attributes.duration?o=r.attributes.duration:i===e.length-1?o=t.duration:null!=u.attributes.start&&(o=u.attributes.start-a);var l=null!=o?a+o:void 0;n.push({periodStart:a,periodDuration:o,periodEnd:l})})),n}(e,t);if(c.length!==e.length)throw new Error("MPD parsing error: the time information are incoherent.");var f=t.isDynamic,p=t.timeShiftBufferDepth,E=new g({isDynamic:f,timeShiftBufferDepth:p});f||null==t.duration||E.setLastPosition(t.duration);for(var T=function(){var g,T=w===e.length-1,I=e[w],R=t.xlinkInfos.get(I),Z=Q(t.baseURLs,I.children.baseURLs),x=c[w],P=x.periodStart,M=x.periodDuration,C=x.periodEnd;for(null==I.attributes.id?(o.Z.warn("DASH: No usable id found in the Period. Generating one."),g="gen-dash-period-"+fe()):g=I.attributes.id;d.some((function(e){return e.id===g}));)g+="-dup";var D=void 0!==R?R.receivedTime:t.receivedTime,N=null!==(r=null===(n=t.unsafelyBaseOnPreviousManifest)||void 0===n?void 0:n.getPeriod(g))&&void 0!==r?r:null,O=null===(i=I.attributes.availabilityTimeComplete)||void 0===i||i,L=null!==(a=I.attributes.availabilityTimeOffset)&&void 0!==a?a:0,U=t.manifestProfiles,B=I.children.segmentTemplate,F={availabilityTimeComplete:O,availabilityTimeOffset:L,baseURLs:Z,manifestBoundsCalculator:E,end:C,isDynamic:f,isLastPeriod:T,manifestProfiles:U,receivedTime:D,segmentTemplate:B,start:P,timeShiftBufferDepth:p,unsafelyBaseOnPreviousPeriod:N},z=function(e,t){for(var n,r,i,a,u,l,d={video:[],audio:[],text:[]},c=[],f={},v=[],p=0;p<e.length;p++){var h=e[p],m=h.children,g=m.essentialProperties,E=m.roles,T=m.label,w=Array.isArray(E)&&E.some((function(e){return"main"===e.value}))&&E.some((function(e){return"urn:mpeg:dash:role:2011"===e.schemeIdUri})),I=h.children.representations,R=null!==(n=h.attributes.availabilityTimeComplete)&&void 0!==n?n:t.availabilityTimeComplete,Z=(null!==(r=h.attributes.availabilityTimeOffset)&&void 0!==r?r:0)+t.availabilityTimeOffset,x=h.attributes.mimeType,P=h.attributes.codecs,M=A(I,(0,S.Z)(x)?x:null,(0,S.Z)(P)?P:null,null!=m.roles?m.roles:null);if(void 0!==M){var C=null!==(i=h.attributes.selectionPriority)&&void 0!==i?i:1,D=h.attributes.id,N=ue(h),O=[];void 0!==t.segmentTemplate&&O.push(t.segmentTemplate),void 0!==h.children.segmentTemplate&&O.push(h.children.segmentTemplate);var L={availabilityTimeComplete:R,availabilityTimeOffset:Z,baseURLs:Q(t.baseURLs,m.baseURLs),manifestBoundsCalculator:t.manifestBoundsCalculator,end:t.end,isDynamic:t.isDynamic,isLastPeriod:t.isLastPeriod,manifestProfiles:t.manifestProfiles,parentSegmentTemplates:O,receivedTime:t.receivedTime,start:t.start,timeShiftBufferDepth:t.timeShiftBufferDepth,unsafelyBaseOnPreviousAdaptation:null},U=Array.isArray(g)?(0,s.Z)(g,(function(e){return"http://dashif.org/guidelines/trickmode"===e.schemeIdUri})):void 0,B=null===(a=null==U?void 0:U.value)||void 0===a?void 0:a.split(" "),F=void 0!==B,z=m.accessibilities,V=void 0;void 0!==E&&E.some((function(e){return"dub"===e.value}))&&(V=!0);var K=void 0;K="text"===M&&ae(z,E);var G=void 0;"text"===M&&void 0!==E&&E.some((function(e){return"forced-subtitle"===e.value||"forced_subtitle"===e.value}))&&(G=!0);var j=void 0;"audio"!==M?j=!1:void 0!==z&&(j=z.some(ie));var H=void 0;"video"!==M?H=!1:void 0!==z&&(H=z.some(oe));for(var W=se(h,{isAudioDescription:j,isForcedSubtitle:G,isClosedCaption:K,isSignInterpreted:H,isTrickModeTrack:F,type:M});(0,b.Z)(v,W);)W+="-dup";var q=W;v.push(W),L.unsafelyBaseOnPreviousAdaptation=null!==(l=null===(u=t.unsafelyBaseOnPreviousPeriod)||void 0===u?void 0:u.getAdaptation(W))&&void 0!==l?l:null;var Y={id:W,representations:te(I,h,L),type:M,isTrickModeTrack:F};if(null!=h.attributes.language&&(Y.language=h.attributes.language),null!=K&&(Y.closedCaption=K),null!=j&&(Y.audioDescription=j),!0===V&&(Y.isDub=!0),void 0!==G&&(Y.forcedSubtitles=G),!0===H&&(Y.isSignInterpreted=!0),void 0!==T&&(Y.label=T),void 0!==B)c.push({adaptation:Y,trickModeAttachedAdaptationIds:B});else{for(var X,$=-1,J=function(){var e=X.value,t=f[e];if(void 0!==t&&t.newID!==q&&(0,b.Z)(t.adaptationSetSwitchingIDs,D)){$=(0,_.Z)(d[M],(function(t){return t[0].id===e}));var n,r=d[M][$];void 0!==r&&r[0].audioDescription===Y.audioDescription&&r[0].closedCaption===Y.closedCaption&&r[0].language===Y.language&&(o.Z.info('DASH Parser: merging "switchable" AdaptationSets',D,e),(n=r[0].representations).push.apply(n,Y.representations),r[1]={priority:Math.max(C,r[1].priority),isMainAdaptation:w||r[1].isMainAdaptation,indexInMpd:Math.min(p,r[1].indexInMpd)})}},ee=ne(N);!(X=ee()).done;)J();$<0&&d[M].push([Y,{priority:C,isMainAdaptation:w,indexInMpd:p}])}null!=D&&null==f[D]&&(f[D]={newID:q,adaptationSetSwitchingIDs:N})}}var re=y.r.reduce((function(e,t){var n=d[t];return n.length>0&&(n.sort(le),e[t]=n.map((function(e){return e[0]}))),e}),{});return d.video.sort(le),k(re,c),re}(I.children.adaptations,F),V=(null!==(u=t.xmlNamespaces)&&void 0!==u?u:[]).concat(null!==(l=I.attributes.namespaces)&&void 0!==l?l:[]),K=function(e,t,n){for(var r,i,a,o=[],s=de(e);!(a=s()).done;)for(var u,l=a.value,d=l.attributes,c=d.schemeIdUri,f=void 0===c?"":c,v=d.timescale,p=void 0===v?1:v,h=n.concat(null!==(r=l.attributes.namespaces)&&void 0!==r?r:[]),g=de(l.children.events);!(u=g()).done;){var y=u.value;if(void 0!==y.eventStreamData){var _=(null!==(i=y.presentationTime)&&void 0!==i?i:0)/p+t,b=void 0===y.duration?void 0:_+y.duration/p,S=void 0;if(y.eventStreamData instanceof Element)S=y.eventStreamData;else{var E=h.reduce((function(e,t){return e+"xmlns:"+t.key+'="'+t.value+'" '}),"<toremove ");E+=">";var T=(0,m.uR)(new Uint8Array(y.eventStreamData));S=(new DOMParser).parseFromString(E+T+"</toremove>","application/xml").documentElement.childNodes[0]}o.push({start:_,end:b,id:y.id,data:{type:"dash-event-stream",value:{schemeIdUri:f,timescale:p,element:S}}})}}return o}(I.children.eventStreams,P,V),G={id:g,start:P,end:C,duration:M,adaptations:z,streamEvents:K};if(d.unshift(G),!E.lastPositionIsKnown()){var j=function(e){for(var t,n=null,r=!0,i=(0,h.Z)(e).filter((function(e){return null!=e})),a=de((0,v.Z)(i,(function(e){return e})));!(t=a()).done;)for(var o,s=de(t.value.representations);!(o=s()).done;){var u=o.value.index.getLastAvailablePosition();null!==u&&(r=!1,"number"==typeof u&&(n=null==n?u:Math.max(n,u)))}if(null!=n)return n;if(r)return null;return}(z);if(f)if("number"==typeof j){var H=performance.now()/1e3;E.setLastPosition(j,H)}else{var W=pe(t,P);if(void 0!==W){var q=W[0],Y=W[1];E.setLastPosition(q,Y)}}else"number"==typeof j&&E.setLastPosition(j)}},w=e.length-1;w>=0;w--)T();if(t.isDynamic&&!E.lastPositionIsKnown()){var I=pe(t,0);if(void 0!==I){var R=I[0],Z=I[1];E.setLastPosition(R,Z)}}return function(e){if(0===e.length)return[];for(var t=[e[0]],n=1;n<e.length;n++){for(var r=e[n],i=t[t.length-1];(void 0===i.duration||i.start+i.duration>r.start)&&(o.Z.warn("DASH: Updating overlapping Periods.",null==i?void 0:i.start,r.start),i.duration=r.start-i.start,i.end=r.start,!(i.duration>0));)t.pop(),i=t[t.length-1];t.push(r)}return t}(d)}function pe(e,t){if(null!=e.clockOffset){var n=e.clockOffset/1e3-e.availabilityStartTime,r=performance.now()/1e3,i=r+n;if(i>=t)return[i,r]}else{var a=Date.now()/1e3;if(a>=t)return o.Z.warn("DASH Parser: no clock synchronization mechanism found. Using the system clock instead."),[a-e.availabilityStartTime,performance.now()/1e3]}}function he(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return me(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return me(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function me(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var ge=function e(t,n,r,i,d){void 0===d&&(d=new WeakMap);var c=t.children,v=t.attributes;if(null==n.externalClockOffset){var p="dynamic"===v.type,h=(0,s.Z)(c.utcTimings,(function(e){return"urn:mpeg:dash:utc:direct:2014"===e.schemeIdUri&&null!=e.value})),m=null!=h&&null!=h.value?l(h.value):void 0,g=null==m||isNaN(m)?void 0:m;if(null!=g&&!0!==i)n.externalClockOffset=g;else if(p&&!0!==i){var y=function(e){var t=e.children.utcTimings.filter((function(e){return("urn:mpeg:dash:utc:http-iso:2014"===e.schemeIdUri||"urn:mpeg:dash:utc:http-xsdate:2014"===e.schemeIdUri)&&void 0!==e.value}));return t.length>0?t[0].value:void 0}(t);if(null!=y&&y.length>0)return{type:"needs-clock",value:{url:y,continue:function(i){return i.success?(n.externalClockOffset=l(i.data),e(t,n,r,!0)):(r.push(i.error),o.Z.warn("DASH Parser: Error on fetching the clock ressource",i.error),e(t,n,r,!0))}}}}}for(var _=[],b=0;b<c.periods.length;b++){var S=c.periods[b].attributes,E=S.xlinkHref,T=S.xlinkActuate;null!=E&&"onLoad"===T&&_.push({index:b,ressource:E})}return 0===_.length?function(e,t,n,r){var i,s,l,d,c,v,p=e.children,h=e.attributes,m="dynamic"===h.type,g=void 0!==t.url?[{url:t.url.substring(0,(0,u.$)(t.url))}]:[],y=Q(g,p.baseURLs),_=function(e,t){return"dynamic"!==e.type?0:null==e.availabilityStartTime?null==t?0:t:e.availabilityStartTime}(h,t.referenceDateTime),b=h.timeShiftBufferDepth,S=t.externalClockOffset,E=t.unsafelyBaseOnPreviousManifest,T={availabilityStartTime:_,baseURLs:y,clockOffset:S,duration:h.duration,isDynamic:m,manifestProfiles:e.attributes.profiles,receivedTime:t.manifestReceivedTime,timeShiftBufferDepth:b,unsafelyBaseOnPreviousManifest:E,xlinkInfos:r,xmlNamespaces:e.attributes.namespaces},k=ve(p.periods,T),w=h.duration,A=null;void 0!==h.minimumUpdatePeriod&&h.minimumUpdatePeriod>=0&&(d=0===h.minimumUpdatePeriod?a.Z.getCurrent().DASH_FALLBACK_LIFETIME_WHEN_MINIMUM_UPDATE_PERIOD_EQUAL_0:h.minimumUpdatePeriod);var I=f(k),R=I.minimumSafePosition,Z=I.maximumSafePosition,x=I.maximumUnsafePosition,P=performance.now();if(m){var M,C;if(c=R,A=null!=b?b:null,void 0!==x&&(C=x),void 0!==Z)M=Z;else{var D=null!=_?_:0,N=t.externalClockOffset;if(void 0===N)o.Z.warn("DASH Parser: use system clock to define maximum position"),M=Date.now()/1e3-D;else M=(performance.now()+N)/1e3-D}void 0===C&&(C=M),v={isLinear:!0,maximumSafePosition:M,livePosition:C,time:P},null!==A&&void 0!==c&&M-c>A&&(A=M-c)}else{c=void 0!==R?R:void 0!==(null===(i=k[0])||void 0===i?void 0:i.start)?k[0].start:0;var O=null!=w?w:1/0;if(void 0!==k[k.length-1]){var L=k[k.length-1],U=null!==(s=L.end)&&void 0!==s?s:void 0!==L.duration?L.start+L.duration:void 0;void 0!==U&&U<O&&(O=U)}void 0!==Z&&Z<O&&(O=Z),v={isLinear:!1,maximumSafePosition:O,livePosition:void 0,time:P}}var B=!m||void 0===e.attributes.minimumUpdatePeriod&&(void 0!==(null===(l=k[k.length-1])||void 0===l?void 0:l.end)||void 0!==e.attributes.duration),F={availabilityStartTime:_,clockOffset:t.externalClockOffset,isDynamic:m,isLive:m,isLastPeriodKnown:B,periods:k,publishTime:h.publishTime,suggestedPresentationDelay:h.suggestedPresentationDelay,transportType:"dash",timeBounds:{minimumSafePosition:c,timeshiftDepth:A,maximumTimeData:v},lifetime:d,uris:null==t.url?p.locations:[t.url].concat(p.locations)};return{type:"done",value:{parsed:F,warnings:n}}}(t,n,r,d):{type:"needs-xlinks",value:{xlinksUrls:_.map((function(e){return e.ressource})),continue:function(a){if(a.length!==_.length)throw new Error("DASH parser: wrong number of loaded ressources.");for(var o=a.length-1;o>=0;o--){var s,u=_[o].index,l=a[o],f=l.parsed,v=l.warnings,p=l.receivedTime,h=l.sendingTime,m=l.url;v.length>0&&r.push.apply(r,v);for(var g,y=he(f);!(g=y()).done;){var b=g.value;d.set(b,{receivedTime:p,sendingTime:h,url:m})}(s=c.periods).splice.apply(s,[u,1].concat(f))}return e(t,n,r,i,d)}}}};function ye(e){var t=e.textContent,n=[];return null===t||0===t.length?[void 0,n]:[{value:t},n]}function _e(e){for(var t={},n=0;n<e.attributes.length;n++){var r=e.attributes[n];switch(r.name){case"id":t.id=r.value;break;case"lang":t.language=r.value;break;case"contentType":t.contentType=r.value;break;case"par":t.par=r.value}}return t}var be=n(7326),Se=n(4578),Ee=n(2146),Te=n(9689),ke=/^P(([\d.]*)Y)?(([\d.]*)M)?(([\d.]*)D)?T?(([\d.]*)H)?(([\d.]*)M)?(([\d.]*)S)?/,we=/([0-9]+)-([0-9]+)/;function Ae(e,t){return"true"===e?[!0,null]:"false"===e?[!1,null]:[!1,new Le("`"+t+'` property is not a boolean value but "'+e+'"')]}function Ie(e,t){var n=parseInt(e,10);return isNaN(n)?[null,new Le("`"+t+'` property is not an integer value but "'+e+'"')]:[n,null]}function Re(e,t){if("INF"===e)return[1/0,null];var n=parseFloat(e);return isNaN(n)?[null,new Le("`"+t+'` property is invalid: "'+e+'"')]:[n,null]}function Ze(e,t){if("true"===e)return[!0,null];if("false"===e)return[!1,null];var n=parseInt(e,10);return isNaN(n)?[null,new Le("`"+t+'` property is not a boolean nor an integer but "'+e+'"')]:[n,null]}function xe(e,t){var n=Date.parse(e);return isNaN(n)?[null,new Le("`"+t+'` is in an invalid date format: "'+e+'"')]:[new Date(Date.parse(e)).getTime()/1e3,null]}function Pe(e,t){if(!(0,S.Z)(e))return[0,new Le("`"+t+"` property is empty")];var n=ke.exec(e);return null===n?[null,new Le("`"+t+'` property has an unrecognized format "'+e+'"')]:[365*parseFloat((0,S.Z)(n[2])?n[2]:"0")*24*60*60+30*parseFloat((0,S.Z)(n[4])?n[4]:"0")*24*60*60+24*parseFloat((0,S.Z)(n[6])?n[6]:"0")*60*60+60*parseFloat((0,S.Z)(n[8])?n[8]:"0")*60+60*parseFloat((0,S.Z)(n[10])?n[10]:"0")+parseFloat((0,S.Z)(n[12])?n[12]:"0"),null]}function Me(e,t){var n=we.exec(e);return null===n?[null,new Le("`"+t+'` property has an unrecognized format "'+e+'"')]:[[+n[1],+n[2]],null]}function Ce(e,t){try{return[(0,Te.K)(e),null]}catch(n){return[null,new Le("`"+t+'` is not a valid base64 string: "'+e+'"')]}}function De(e,t){var n=/^(\d+)\/(\d+)$/.exec(e);return null!==n?[+n[1]/+n[2],null]:Re(e,t)}function Ne(e){for(var t,n,r=0;r<e.attributes.length;r++){var i=e.attributes[r];switch(i.name){case"schemeIdUri":t=i.value;break;case"value":n=i.value}}return{schemeIdUri:t,value:n}}function Oe(e,t){return function(n,r){var i=r.asKey,a=(0,r.parser)(n,r.dashName),s=a[0],u=a[1];null!==u&&(o.Z.warn(u.message),t.push(u)),null!==s&&(e[i]=s)}}var Le=function(e){function t(n){var r;return r=e.call(this)||this,Object.setPrototypeOf((0,be.Z)(r),t.prototype),r.name="MPDError",r.message=n,r}return(0,Se.Z)(t,e),t}((0,Ee.Z)(Error));function Ue(e){var t=function(e){for(var t=[],n=[],r=0;r<e.length;r++)if(e[r].nodeType===Node.ELEMENT_NODE){var i=e[r];if("cenc:pssh"===i.nodeName){var a=i.textContent;if(null!==a&&a.length>0){var s=Ce(a,"cenc:pssh"),u=s[0],l=s[1];null!==l&&(o.Z.warn(l.message),t.push(l)),null!==u&&n.push(u)}}}return[{cencPssh:n},t]}(e.childNodes),n=t[0],r=t[1];return[{children:n,attributes:function(e){for(var t={},n=0;n<e.attributes.length;n++){var r=e.attributes[n];switch(r.name){case"schemeIdUri":t.schemeIdUri=r.value;break;case"value":t.value=r.value;break;case"cenc:default_KID":t.keyId=(0,m.nr)(r.value.replace(/-/g,""))}}return t}(e)},r]}function Be(e){for(var t={},n=[],r=Oe(t,n),i=0;i<e.attributes.length;i++){var a=e.attributes[i];switch(a.name){case"range":r(a.value,{asKey:"range",parser:Me,dashName:"range"});break;case"sourceURL":t.media=a.value}}return[t,n]}function Fe(e){for(var t={},n=[],r=Oe(t,n),i=e.childNodes,a=0;a<i.length;a++)if(i[a].nodeType===Node.ELEMENT_NODE){var o=i[a];if("Initialization"===o.nodeName){var s=Be(o),u=s[0],l=s[1];t.initialization=u,n=n.concat(l)}}for(var d=0;d<e.attributes.length;d++){var c=e.attributes[d];switch(c.name){case"timescale":r(c.value,{asKey:"timescale",parser:Ie,dashName:"timescale"});break;case"presentationTimeOffset":r(c.value,{asKey:"presentationTimeOffset",parser:Re,dashName:"presentationTimeOffset"});break;case"indexRange":r(c.value,{asKey:"indexRange",parser:Me,dashName:"indexRange"});break;case"indexRangeExact":r(c.value,{asKey:"indexRangeExact",parser:Ae,dashName:"indexRangeExact"});break;case"availabilityTimeOffset":r(c.value,{asKey:"availabilityTimeOffset",parser:Re,dashName:"availabilityTimeOffset"});break;case"availabilityTimeComplete":r(c.value,{asKey:"availabilityTimeComplete",parser:Ae,dashName:"availabilityTimeComplete"});break;case"duration":r(c.value,{asKey:"duration",parser:Ie,dashName:"duration"});break;case"startNumber":r(c.value,{asKey:"startNumber",parser:Ie,dashName:"startNumber"});break;case"endNumber":r(c.value,{asKey:"endNumber",parser:Ie,dashName:"endNumber"})}}return[t,n]}function ze(e){for(var t={},n=[],r=Oe(t,n),i=0;i<e.attributes.length;i++){var a=e.attributes[i];switch(a.name){case"media":t.media=a.value;break;case"indexRange":r(a.value,{asKey:"indexRange",parser:Me,dashName:"indexRange"});break;case"index":t.index=a.value;break;case"mediaRange":r(a.value,{asKey:"mediaRange",parser:Me,dashName:"mediaRange"})}}return[t,n]}function Ve(e){for(var t=Fe(e),n=t[0],r=t[1],i=[],a=e.childNodes,o=0;o<a.length;o++)if(a[o].nodeType===Node.ELEMENT_NODE){var s=a[o];if("SegmentURL"===s.nodeName){var u=ze(s),l=u[0],d=u[1];i.push(l),r=r.concat(d)}}return[(0,I.Z)(n,{list:i}),r]}function Ke(e){var t=null;return function(){if(null===t){var n=e.getElementsByTagName("S");return t=n,n}return t}}function Ge(e){for(var t,n=Fe(e),r=n[0],i=n[1],a=0;a<e.childNodes.length;a++)if(e.childNodes[a].nodeType===Node.ELEMENT_NODE){var o=e.childNodes[a];"SegmentTimeline"===o.nodeName&&(t=Ke(o))}for(var s=(0,I.Z)({},r,{duration:r.duration,timelineParser:t}),u=Oe(s,i),l=0;l<e.attributes.length;l++){var d=e.attributes[l];switch(d.nodeName){case"initialization":null==s.initialization&&(s.initialization={media:d.value});break;case"index":s.index=d.value;break;case"availabilityTimeOffset":u(d.value,{asKey:"availabilityTimeOffset",parser:Re,dashName:"availabilityTimeOffset"});break;case"availabilityTimeComplete":u(d.value,{asKey:"availabilityTimeComplete",parser:Ae,dashName:"availabilityTimeComplete"});break;case"media":s.media=d.value;break;case"bitstreamSwitching":u(d.value,{asKey:"bitstreamSwitching",parser:Ae,dashName:"bitstreamSwitching"})}}return[s,i]}function je(e){var t=function(e){for(var t={baseURLs:[]},n=[],r=[],i=0;i<e.length;i++)if(e[i].nodeType===Node.ELEMENT_NODE){var a=e[i];switch(a.nodeName){case"BaseURL":var o=ye(a),s=o[0],u=o[1];void 0!==s&&t.baseURLs.push(s),r=r.concat(u);break;case"InbandEventStream":void 0===t.inbandEventStreams&&(t.inbandEventStreams=[]),t.inbandEventStreams.push(Ne(a));break;case"SegmentBase":var l=Fe(a),d=l[0],c=l[1];t.segmentBase=d,c.length>0&&(r=r.concat(c));break;case"SegmentList":var f=Ve(a),v=f[0],p=f[1];r=r.concat(p),t.segmentList=v;break;case"SegmentTemplate":var h=Ge(a),m=h[0],g=h[1];r=r.concat(g),t.segmentTemplate=m;break;case"ContentProtection":var y=Ue(a),_=y[0],b=y[1];b.length>0&&(r=r.concat(b)),void 0!==_&&n.push(_)}}return n.length>0&&(t.contentProtections=n),[t,r]}(e.childNodes),n=t[0],r=t[1],i=function(e){for(var t={},n=[],r=Oe(t,n),i=0;i<e.attributes.length;i++){var a=e.attributes[i];switch(a.name){case"audioSamplingRate":t.audioSamplingRate=a.value;break;case"bandwidth":r(a.value,{asKey:"bitrate",parser:Ie,dashName:"bandwidth"});break;case"codecs":t.codecs=a.value;break;case"codingDependency":r(a.value,{asKey:"codingDependency",parser:Ae,dashName:"codingDependency"});break;case"frameRate":r(a.value,{asKey:"frameRate",parser:De,dashName:"frameRate"});break;case"height":r(a.value,{asKey:"height",parser:Ie,dashName:"height"});break;case"id":t.id=a.value;break;case"maxPlayoutRate":r(a.value,{asKey:"maxPlayoutRate",parser:Re,dashName:"maxPlayoutRate"});break;case"maximumSAPPeriod":r(a.value,{asKey:"maximumSAPPeriod",parser:Re,dashName:"maximumSAPPeriod"});break;case"mimeType":t.mimeType=a.value;break;case"profiles":t.profiles=a.value;break;case"qualityRanking":r(a.value,{asKey:"qualityRanking",parser:Ie,dashName:"qualityRanking"});break;case"segmentProfiles":t.segmentProfiles=a.value;break;case"width":r(a.value,{asKey:"width",parser:Ie,dashName:"width"});break;case"availabilityTimeOffset":r(a.value,{asKey:"availabilityTimeOffset",parser:Re,dashName:"availabilityTimeOffset"});break;case"availabilityTimeComplete":r(a.value,{asKey:"availabilityTimeComplete",parser:Ae,dashName:"availabilityTimeComplete"})}}return void 0===t.bitrate&&n.push(new Le("No bitrate found on a Representation")),[t,n]}(e),a=i[0],o=i[1];return[{children:n,attributes:a},r.concat(o)]}function He(e){var t=function(e){for(var t={baseURLs:[],representations:[]},n=[],r=[],i=0;i<e.length;i++)if(e[i].nodeType===Node.ELEMENT_NODE){var a=e[i];switch(a.nodeName){case"Accessibility":void 0===t.accessibilities?t.accessibilities=[Ne(a)]:t.accessibilities.push(Ne(a));break;case"BaseURL":var o=ye(a),s=o[0],u=o[1];void 0!==s&&t.baseURLs.push(s),u.length>0&&(r=r.concat(u));break;case"ContentComponent":t.contentComponent=_e(a);break;case"EssentialProperty":null==t.essentialProperties?t.essentialProperties=[Ne(a)]:t.essentialProperties.push(Ne(a));break;case"InbandEventStream":void 0===t.inbandEventStreams&&(t.inbandEventStreams=[]),t.inbandEventStreams.push(Ne(a));break;case"Label":var l=a.textContent;null!=l&&(t.label=l);break;case"Representation":var d=je(a),c=d[0],f=d[1];t.representations.push(c),f.length>0&&(r=r.concat(f));break;case"Role":null==t.roles?t.roles=[Ne(a)]:t.roles.push(Ne(a));break;case"SupplementalProperty":null==t.supplementalProperties?t.supplementalProperties=[Ne(a)]:t.supplementalProperties.push(Ne(a));break;case"SegmentBase":var v=Fe(a),p=v[0],h=v[1];t.segmentBase=p,h.length>0&&(r=r.concat(h));break;case"SegmentList":var m=Ve(a),g=m[0],y=m[1];t.segmentList=g,y.length>0&&(r=r.concat(y));break;case"SegmentTemplate":var _=Ge(a),b=_[0],S=_[1];t.segmentTemplate=b,S.length>0&&(r=r.concat(S));break;case"ContentProtection":var E=Ue(a),T=E[0],k=E[1];k.length>0&&(r=r.concat(k)),void 0!==T&&n.push(T)}}return n.length>0&&(t.contentProtections=n),[t,r]}(e.childNodes),n=t[0],r=t[1],i=function(e){for(var t={},n=[],r=Oe(t,n),i=0;i<e.attributes.length;i++){var a=e.attributes[i];switch(a.name){case"id":t.id=a.value;break;case"group":r(a.value,{asKey:"group",parser:Ie,dashName:"group"});break;case"lang":t.language=a.value;break;case"contentType":t.contentType=a.value;break;case"par":t.par=a.value;break;case"minBandwidth":r(a.value,{asKey:"minBitrate",parser:Ie,dashName:"minBandwidth"});break;case"maxBandwidth":r(a.value,{asKey:"maxBitrate",parser:Ie,dashName:"maxBandwidth"});break;case"minWidth":r(a.value,{asKey:"minWidth",parser:Ie,dashName:"minWidth"});break;case"maxWidth":r(a.value,{asKey:"maxWidth",parser:Ie,dashName:"maxWidth"});break;case"minHeight":r(a.value,{asKey:"minHeight",parser:Ie,dashName:"minHeight"});break;case"maxHeight":r(a.value,{asKey:"maxHeight",parser:Ie,dashName:"maxHeight"});break;case"minFrameRate":r(a.value,{asKey:"minFrameRate",parser:De,dashName:"minFrameRate"});break;case"maxFrameRate":r(a.value,{asKey:"maxFrameRate",parser:De,dashName:"maxFrameRate"});break;case"selectionPriority":r(a.value,{asKey:"selectionPriority",parser:Ie,dashName:"selectionPriority"});break;case"segmentAlignment":r(a.value,{asKey:"segmentAlignment",parser:Ze,dashName:"segmentAlignment"});break;case"subsegmentAlignment":r(a.value,{asKey:"subsegmentAlignment",parser:Ze,dashName:"subsegmentAlignment"});break;case"bitstreamSwitching":r(a.value,{asKey:"bitstreamSwitching",parser:Ae,dashName:"bitstreamSwitching"});break;case"audioSamplingRate":t.audioSamplingRate=a.value;break;case"codecs":t.codecs=a.value;break;case"codingDependency":r(a.value,{asKey:"codingDependency",parser:Ae,dashName:"codingDependency"});break;case"frameRate":r(a.value,{asKey:"frameRate",parser:De,dashName:"frameRate"});break;case"height":r(a.value,{asKey:"height",parser:Ie,dashName:"height"});break;case"maxPlayoutRate":r(a.value,{asKey:"maxPlayoutRate",parser:Re,dashName:"maxPlayoutRate"});break;case"maximumSAPPeriod":r(a.value,{asKey:"maximumSAPPeriod",parser:Re,dashName:"maximumSAPPeriod"});break;case"mimeType":t.mimeType=a.value;break;case"profiles":t.profiles=a.value;break;case"segmentProfiles":t.segmentProfiles=a.value;break;case"width":r(a.value,{asKey:"width",parser:Ie,dashName:"width"});break;case"availabilityTimeOffset":r(a.value,{asKey:"availabilityTimeOffset",parser:Re,dashName:"availabilityTimeOffset"});break;case"availabilityTimeComplete":r(a.value,{asKey:"availabilityTimeComplete",parser:Ae,dashName:"availabilityTimeComplete"})}}return[t,n]}(e),a=i[0],o=i[1];return[{children:n,attributes:a},r.concat(o)]}function We(e){for(var t={children:{events:[]},attributes:{}},n=[],r=Oe(t.attributes,n),i=0;i<e.attributes.length;i++){var a=e.attributes[i];switch(a.name){case"schemeIdUri":t.attributes.schemeIdUri=a.value;break;case"timescale":r(a.value,{asKey:"timescale",parser:Ie,dashName:"timescale"});break;case"value":t.attributes.value=a.value}}for(var o=0;o<e.childNodes.length;o++)if(e.childNodes[o].nodeType===Node.ELEMENT_NODE){var s=e.childNodes[o];if("Event"===s.nodeName){var u=qe(s),l=u[0],d=u[1];t.children.events.push(l),d.length>0&&(n=n.concat(d))}}return[t,n]}function qe(e){for(var t={eventStreamData:e},n=[],r=Oe(t,n),i=0;i<e.attributes.length;i++){var a=e.attributes[i];switch(a.name){case"presentationTime":r(a.value,{asKey:"presentationTime",parser:Ie,dashName:"presentationTime"});break;case"duration":r(a.value,{asKey:"duration",parser:Ie,dashName:"duration"});break;case"id":t.id=a.value}}return[t,n]}function Ye(e){var t=function(e){for(var t,n=[],r=[],i=[],a=[],o=0;o<e.length;o++)if(e[o].nodeType===Node.ELEMENT_NODE){var s=e[o];switch(s.nodeName){case"BaseURL":var u=ye(s),l=u[0],d=u[1];void 0!==l&&n.push(l),i=i.concat(d);break;case"AdaptationSet":var c=He(s),f=c[0],v=c[1];r.push(f),i=i.concat(v);break;case"EventStream":var p=We(s),h=p[0],m=p[1];a.push(h),i=i.concat(m);break;case"SegmentTemplate":var g=Ge(s),y=g[0],_=g[1];t=y,_.length>0&&(i=i.concat(_))}}return[{baseURLs:n,adaptations:r,eventStreams:a,segmentTemplate:t},i]}(e.childNodes),n=t[0],r=t[1],i=function(e){for(var t={},n=[],r=Oe(t,n),i=0;i<e.attributes.length;i++){var a=e.attributes[i];switch(a.name){case"id":t.id=a.value;break;case"start":r(a.value,{asKey:"start",parser:Pe,dashName:"start"});break;case"duration":r(a.value,{asKey:"duration",parser:Pe,dashName:"duration"});break;case"bitstreamSwitching":r(a.value,{asKey:"bitstreamSwitching",parser:Ae,dashName:"bitstreamSwitching"});break;case"xlink:href":t.xlinkHref=a.value;break;case"xlink:actuate":t.xlinkActuate=a.value}}return[t,n]}(e),a=i[0],o=i[1];return[{children:n,attributes:a},r.concat(o)]}function Xe(e){var t=function(e){for(var t=[],n=[],r=[],i=[],a=[],o=0;o<e.length;o++)if(e[o].nodeType===Node.ELEMENT_NODE){var s=e[o];switch(s.nodeName){case"BaseURL":var u=ye(s),l=u[0],d=u[1];void 0!==l&&t.push(l),a=a.concat(d);break;case"Location":n.push(null===s.textContent?"":s.textContent);break;case"Period":var c=Ye(s),f=c[0],v=c[1];r.push(f),a=a.concat(v);break;case"UTCTiming":var p=Ne(s);i.push(p)}}return[{baseURLs:t,locations:n,periods:r,utcTimings:i},a]}(e.childNodes),n=t[0],r=t[1],i=function(e){for(var t={},n=[],r=Oe(t,n),i=0;i<e.attributes.length;i++){var a=e.attributes[i];switch(a.name){case"id":t.id=a.value;break;case"profiles":t.profiles=a.value;break;case"type":t.type=a.value;break;case"availabilityStartTime":r(a.value,{asKey:"availabilityStartTime",parser:xe,dashName:"availabilityStartTime"});break;case"availabilityEndTime":r(a.value,{asKey:"availabilityEndTime",parser:xe,dashName:"availabilityEndTime"});break;case"publishTime":r(a.value,{asKey:"publishTime",parser:xe,dashName:"publishTime"});break;case"mediaPresentationDuration":r(a.value,{asKey:"duration",parser:Pe,dashName:"mediaPresentationDuration"});break;case"minimumUpdatePeriod":r(a.value,{asKey:"minimumUpdatePeriod",parser:Pe,dashName:"minimumUpdatePeriod"});break;case"minBufferTime":r(a.value,{asKey:"minBufferTime",parser:Pe,dashName:"minBufferTime"});break;case"timeShiftBufferDepth":r(a.value,{asKey:"timeShiftBufferDepth",parser:Pe,dashName:"timeShiftBufferDepth"});break;case"suggestedPresentationDelay":r(a.value,{asKey:"suggestedPresentationDelay",parser:Pe,dashName:"suggestedPresentationDelay"});break;case"maxSegmentDuration":r(a.value,{asKey:"maxSegmentDuration",parser:Pe,dashName:"maxSegmentDuration"});break;case"maxSubsegmentDuration":r(a.value,{asKey:"maxSubsegmentDuration",parser:Pe,dashName:"maxSubsegmentDuration"})}}return[t,n]}(e),a=i[0],o=i[1];return[{children:n,attributes:a},r.concat(o)]}var Qe=function(e,t){var n=e.documentElement;if((0,i.Z)(n)||"MPD"!==n.nodeName)throw new Error("DASH Parser: document root should be MPD");var a=Xe(n),o=a[0],s=a[1];return function e(t){if("done"===t.type)return t;if("needs-clock"===t.type)return{type:"needs-resources",value:{urls:[t.value.url],format:"string",continue:function(n){if(1!==n.length)throw new Error("DASH parser: wrong number of loaded ressources.");var r=t.value.continue(n[0].responseData);return e(r)}}};if("needs-xlinks"===t.type)return{type:"needs-resources",value:{urls:t.value.xlinksUrls,format:"string",continue:function(n){for(var r=[],i=0;i<n.length;i++){var a=n[i],o=a.responseData,s=a.receivedTime,u=a.sendingTime,l=a.url;if(!o.success)throw o.error;var d="<root>"+o.data+"</root>",c=(new DOMParser).parseFromString(d,"text/xml");if(null==c||0===c.children.length)throw new Error("DASH parser: Invalid external ressources");for(var f=c.children[0].children,v=[],p=[],h=0;h<f.length;h++)if(f[h].nodeType===Node.ELEMENT_NODE){var m=Ye(f[h]),g=m[0],y=m[1];p.push.apply(p,y),v.push(g)}r.push({url:l,receivedTime:s,sendingTime:u,parsed:v,warnings:p})}var _=t.value.continue(r);return e(_)}}};(0,r.Z)(t)}(ge(o,t,s))}},8232:function(e,t,n){"use strict";function r(e,t){for(var n=0;e.length>0;){var r=e[0];if(r.start>=t)return n;if(-1===r.repeatCount)return n;if(0===r.repeatCount)e.shift(),n+=1;else{var i=e[1];if(void 0!==i&&i.start<=t)e.shift(),n+=1;else{if(r.duration<=0)return n;for(var a=r.start+r.duration,o=1;a<t&&o<=r.repeatCount;)a+=r.duration,o++;if(!(o>r.repeatCount)){var s=r.repeatCount-o;return r.start=a,r.repeatCount=s,n+=o}e.shift(),n=r.repeatCount+1}}}return n}n.d(t,{Z:function(){return r}})},3911:function(e,t,n){"use strict";n.d(t,{KF:function(){return i},PZ:function(){return u},_j:function(){return l},gT:function(){return o},jH:function(){return a},zG:function(){return s}});var r=n(1946);function i(e,t,n){var i,a=e.repeatCount;return a>=0?a:(i=(0,r.Z)(t)?void 0!==n?n:Number.MAX_VALUE:t.start,Math.ceil((i-e.start)/e.duration)-1)}function a(e,t,n){var r=e.start,a=e.duration;return a<=0?r:r+(i(e,t,n)+1)*a}function o(e,t){var n;return e*t.timescale+(null!==(n=t.indexTimeOffset)&&void 0!==n?n:0)}function s(e,t){var n;return(e-(null!==(n=t.indexTimeOffset)&&void 0!==n?n:0))/t.timescale}function u(e,t,n){return[e*n,(e+t)*n]}function l(e,t,n){var r=e.timeline,i=o(t,e);if(i<0)return null;var u=function(e,t){for(var n=0,r=e.length;n<r;){var i=n+r>>>1;e[i].start<=t?n=i+1:r=i}return n-1}(r,i);if(u<0||u>=r.length-1)return null;var l=r[u];if(l.duration<=0)return null;var d=r[u+1];if(void 0===d)return null;var c=d.start;return i>=a(l,d,n)&&i<c?s(c,e):null}},1091:function(e,t,n){"use strict";function r(e,t,n,r){for(var i=0;i<t.length;i++){var a=t[i],o=(a.start-r)/n;if(o>e.time)return!1;if(o===e.time)return void 0===a.range?void 0===e.range:null!=e.range&&a.range[0]===e.range[0]&&a.range[1]===e.range[1];if(a.repeatCount>=0&&void 0!==a.duration){var s=(o-a.start)/a.duration-1;return s%1==0&&s<=a.repeatCount}}return!1}n.d(t,{Z:function(){return r}})},5505:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var r=n(3714),i=n(3887),a=n(3911);function o(e,t){if(0===e.length)return e.push.apply(e,t),!0;if(0===t.length)return!1;var n=e.length,o=t[0].start,s=e[n-1];if((0,a.jH)(s,t[0])<o)throw new r.Z("MANIFEST_UPDATE_ERROR","Cannot perform partial update: not enough data");for(var u=n-1;u>=0;u--){var l=e[u].start;if(l===o){var d=n-u;return e.splice.apply(e,[u,d].concat(t)),!1}if(l<o){var c=e[u];if(c.start+c.duration>o)return i.Z.warn("RepresentationIndex: Manifest update removed all previous segments"),e.splice.apply(e,[0,n].concat(t)),!0;if(void 0===c.repeatCount||c.repeatCount<=0)return c.repeatCount<0&&(c.repeatCount=Math.floor((o-c.start)/c.duration)-1),e.splice.apply(e,[u+1,n-(u+1)].concat(t)),!1;if(c.start+c.duration*(c.repeatCount+1)<=o)return e.splice.apply(e,[u+1,n-(u+1)].concat(t)),!1;var f=(o-c.start)/c.duration-1;if(f%1==0&&c.duration===t[0].duration){var v=t[0].repeatCount<0?-1:t[0].repeatCount+f+1;return e.splice.apply(e,[u,n-u].concat(t)),e[u].start=c.start,e[u].repeatCount=v,!1}return i.Z.warn("RepresentationIndex: Manifest update removed previous segments"),e[u].repeatCount=Math.floor(f),e.splice.apply(e,[u+1,n-(u+1)].concat(t)),!1}}var p=e[e.length-1],h=t[t.length-1];return void 0!==p.repeatCount&&p.repeatCount<0?p.start>h.start?(i.Z.warn("RepresentationIndex: The new index is older than the previous one"),!1):(i.Z.warn('RepresentationIndex: The new index is "bigger" than the previous one'),e.splice.apply(e,[0,n].concat(t)),!0):p.start+p.duration*(p.repeatCount+1)>=h.start+h.duration*(h.repeatCount+1)?(i.Z.warn("RepresentationIndex: The new index is older than the previous one"),!1):(i.Z.warn('RepresentationIndex: The new index is "bigger" than the previous one'),e.splice.apply(e,[0,n].concat(t)),!0)}},5734:function(e,t,n){"use strict";var r=n(6923),i=/&#([0-9]+);/g,a=/<br>/gi,o=/<style[^>]*>([\s\S]*?)<\/style[^>]*>/i,s=/\s*<p (?:class=([^>]+))?>(.*)/i,u=/<sync[^>]+?start="?([0-9]*)"?[^0-9]/i;function l(e,t){var n=new RegExp("\\s*"+t+":\\s*(\\S+);","i").exec(e);return Array.isArray(n)?n[1]:null}t.Z=function(e,t,n){var d,c,f=/<sync[ >]/gi,v=/<sync[ >]|<\/body>/gi,p=[],h=o.exec(e),m=Array.isArray(h)?h[1]:"";v.exec(e);var g,y=function(e){for(var t=/\.(\S+)\s*{([^}]*)}/gi,n={},r=t.exec(e);null!==r;){var i=r[1],a=l(r[2],"lang");null!=i&&null!=a&&(n[a]=i),r=t.exec(e)}return n}(m),_=function(e){var t=/p\s*{([^}]*)}/gi.exec(e);return null===t?"":t[1]}(m);if((0,r.Z)(n)&&void 0===(g=y[n]))throw new Error("sami: could not find lang "+n+" in CSS");for(;d=f.exec(e),c=v.exec(e),null!==d||null!==c;){if(null===d||null===c||d.index>=c.index)throw new Error("parse error");var b=e.slice(d.index,c.index),S=u.exec(b);if(!Array.isArray(S))throw new Error("parse error (sync time attribute)");var E=+S[1];if(isNaN(E))throw new Error("parse error (sync time attribute NaN)");T(b.split("\n"),E/1e3)}return p;function T(e,n){for(var o=e.length;--o>=0;){var u=s.exec(e[o]);if(Array.isArray(u)){var l=u[1],d=u[2];if(g===l)if("&nbsp;"===d)p[p.length-1].end=n;else{var c=document.createElement("DIV");c.className="rxp-texttrack-region";var f=document.createElement("DIV");f.className="rxp-texttrack-div",f.style.position="absolute",f.style.bottom="0",f.style.width="100%",f.style.color="#fff",f.style.textShadow="-1px -1px 0 #000,1px -1px 0 #000,-1px 1px 0 #000,1px 1px 0 #000";var v=document.createElement("div");v.className="rxp-texttrack-p",(0,r.Z)(_)&&(v.style.cssText=_);for(var h=d.split(a),m=0;m<h.length;m++){0!==m&&v.appendChild(document.createElement("BR"));var y=document.createElement("SPAN");y.className="rxp-texttrack-span",y.textContent=h[m].replace(i,(function(e,t){return String.fromCharCode(Number(t))})),v.appendChild(y)}f.appendChild(v),c.appendChild(f),p.push({element:c,start:n+t,end:-1})}}}}}},1812:function(e,t,n){"use strict";var r=n(7253),i=n(6923),a=/&#([0-9]+);/g,o=/<br>/gi,s=/<style[^>]*>([\s\S]*?)<\/style[^>]*>/i,u=/\s*<p (?:class=([^>]+))?>(.*)/i,l=/<sync[^>]+?start="?([0-9]*)"?[^0-9]/i;function d(e,t){var n=new RegExp("\\s*"+t+":\\s*(\\S+);","i").exec(e);return Array.isArray(n)?n[1]:null}t.Z=function(e,t,n){var c,f,v=/<sync[ >]/gi,p=/<sync[ >]|<\/body>/gi,h=[],m=s.exec(e),g=null!==m?m[1]:"";p.exec(e);var y,_=function(e){for(var t=/\.(\S+)\s*{([^}]*)}/gi,n={},r=t.exec(e);Array.isArray(r);){var i=r[1],a=d(r[2],"lang");null!=i&&null!=a&&(n[a]=i),r=t.exec(e)}return n}(g);if((0,i.Z)(n)&&void 0===(y=_[n]))throw new Error("sami: could not find lang "+n+" in CSS");for(;c=v.exec(e),f=p.exec(e),null!==c||null!==f;){if(null===c||null===f||c.index>=f.index)throw new Error("parse error");var b=e.slice(c.index,f.index),S=l.exec(b);if(null===S)throw new Error("parse error (sync time attribute)");var E=+S[1];if(isNaN(E))throw new Error("parse error (sync time attribute NaN)");T(b.split("\n"),E/1e3)}return function(e){for(var t=[],n=0;n<e.length;n++){var a=e[n],o=a.start,s=a.end,u=a.text;if((0,i.Z)(u)&&null!=s){var l=(0,r.Z)(o,s,u);null!=l&&t.push(l)}}return t}(h);function T(e,n){for(var r,i,s=e.length;--s>=0;)if(null!==(r=u.exec(e[s]))){var l=r,d=l[1],c=l[2];y===d&&("&nbsp;"===c?h[h.length-1].end=n:h.push({text:(i=c,i.replace(o,"\n").replace(a,(function(e,t){return String.fromCharCode(Number(t))}))),start:n+t}))}}}},2061:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(6923);function i(e,t){for(var n=t+1;(0,r.Z)(e[n]);)n++;return n}function a(e){for(var t=[],n=0;n<e.length;n++)if((0,r.Z)(e[n])){var a=i(e,n),o=e.slice(n,a);o.length>0&&(1===o.length?o[0].indexOf("--\x3e")>=0&&t.push(o):(o[1].indexOf("--\x3e")>=0||o[0].indexOf("--\x3e")>=0)&&t.push(o)),n=a}return t}},8675:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(2061),i=n(788);function a(e,t){for(var n=e.split(/\r\n|\n|\r/),a=(0,r.Z)(n),s=[],u=0;u<a.length;u++){var l=(0,i.Z)(a[u],t);if(null!=l){var d=o(l);null!=d&&s.push(d)}}return s}function o(e){var t=e.start,n=e.end,r=e.payload,i=document.createElement("div");i.className="rxp-texttrack-p",i.style.fontSize="28px",i.style.position="absolute",i.style.bottom="5%",i.style.width="100%",i.style.textAlign="center",i.style.color="#fff",i.style.textShadow="-1px -1px 2px #000,1px -1px 2px #000,-1px 1px 2px #000,1px 1px 2px #000";for(var a=0;a<r.length;a++){0!==a&&i.appendChild(document.createElement("br"));var o=s(r[a]);i.appendChild(o)}return{start:t,end:n,element:i}}function s(e){var t=document.createElement("div");t.innerHTML=e;return function e(t){var n=t.childNodes,r=document.createElement("span");r.className="rxp-texttrack-span";for(var i=0;i<n.length;i++){var a=n[i];if("#text"===a.nodeName){for(var o=a.wholeText.split("\n"),s=0;s<o.length;s++)if(0!==s&&r.appendChild(document.createElement("br")),o[s].length>0){var l=document.createTextNode(o[s]);r.appendChild(l)}}else if("B"===a.nodeName){var d=e(a);d.style.fontWeight="bold",r.appendChild(d)}else if("I"===a.nodeName){var c=e(a);c.style.fontStyle="italic",r.appendChild(c)}else if("U"===a.nodeName){var f=e(a);f.style.textDecoration="underline",r.appendChild(f)}else if(u(a)&&"string"==typeof a.color){var v=e(a);v.style.color=a.color,r.appendChild(v)}else{var p=e(a);r.appendChild(p)}}return r}(t)}function u(e){return"FONT"===e.nodeName&&"color"in e}},8057:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var r=n(7253),i=n(2061),a=n(788);function o(e,t){for(var n,o,s,u,l,d=e.split(/\r\n|\n|\r/),c=(0,i.Z)(d),f=[],v=0;v<c.length;v++){var p=(0,a.Z)(c[v],t);if(null!==p){var h=(o=void 0,s=void 0,u=void 0,l=void 0,o=(n=p).start,s=n.end,u=n.payload,l=u.join("\n"),(0,r.Z)(o,s,l));null!==h&&f.push(h)}}return f}},788:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(6923);function i(e){var t=e.split(":");if((0,r.Z)(t[2])){var n=parseInt(t[0],10),i=parseInt(t[1],10),a=parseFloat(t[2].replace(",","."));if(isNaN(n)||isNaN(i)||isNaN(a))return;return 60*n*60+60*i+a}}function a(e,t){if(0===e.length)return null;var n,a,o=[];if((0,r.Z)(e[1])&&-1!==e[1].indexOf("--\x3e")){var s=e[1].split("--\x3e").map((function(e){return e.trim()}));n=s[0],a=s[1],o=e.slice(2,e.length)}if(!(0,r.Z)(n)||!(0,r.Z)(a)){var u=e[0].split("--\x3e").map((function(e){return e.trim()}));n=u[0],a=u[1],o=e.slice(1,e.length)}if(!(0,r.Z)(n)||!(0,r.Z)(a))return null;var l=i(n),d=i(a);return void 0===l||void 0===d?null:{start:l+t,end:d+t,payload:o}}},3791:function(e,t,n){"use strict";n.d(t,{U:function(){return s},b:function(){return u}});var r=n(3274),i=n(7714),a=n(6923),o=n(9252);function s(e,t,n,o){for(var s={},u=e.slice(),l=function(){var e=t[d];if(void 0!==e){var l,c;if(e.nodeType===Node.ELEMENT_NODE)for(var f=e,v=0;v<=f.attributes.length-1;v++){var p=f.attributes[v],h=p.name;if("style"===h)l=p.value;else if("region"===h)c=p.value;else{var m=h.substring(4);if((0,i.Z)(u,m)&&(s[m]=p.value,u.splice(v,1),0===u.length))return{v:s}}}if((0,a.Z)(l)){var g=(0,r.Z)(n,(function(e){return e.id===l}));if(void 0!==g)for(var y=0;y<=u.length-1;y++){var _=u[y];if(!(0,a.Z)(s[_])&&(0,a.Z)(g.style[_])){if(s[_]=g.style[_],u.splice(y,1),0===u.length)return{v:s};y--}}}if((0,a.Z)(c)){var b=(0,r.Z)(o,(function(e){return e.id===c}));if(void 0!==b)for(var S=0;S<=u.length-1;S++){var E=u[S];if(!(0,a.Z)(s[E])&&(0,a.Z)(b.style[E])){if(s[E]=b.style[E],u.splice(S,1),0===u.length)return{v:s};S--}}}}},d=0;d<=t.length-1;d++){var c=l();if("object"==typeof c)return c.v}return s}function u(e){if(e.nodeType!==Node.ELEMENT_NODE)return{};for(var t=e,n={},r=0;r<=t.attributes.length-1;r++){var i=t.attributes[r];if((0,o.Z)(i.name,"tts"))n[i.name.substring(4)]=i.value}return n}},6177:function(e,t,n){"use strict";n.d(t,{Z:function(){return s}});var r=n(6923),i=n(5336);function a(e,t){var n=e.exec(t);if(null===n||""===n[0])return null;var r=Number(n[1]);isNaN(r)&&(r=0);var i=Number(n[2]);isNaN(i)&&(i=0);var a=Number(n[3]);isNaN(a)&&(a=0);var o=Number(n[4]);return isNaN(o)&&(o=0),o/1e3+a+60*i+3600*r}var o=function(e,t){return i.gu.test(e)?function(e,t){var n=i.gu.exec(t),r=Number(n[1]),a=Number(n[2]),o=Number(n[3]),s=Number(n[4]),u=Number(n[5]);isNaN(u)&&(u=0);return s+=u/e.subFrameRate,o+=s/e.frameRate,o+60*a+3600*r}(t,e):i.KO.test(e)?a(i.KO,e):i.wf.test(e)?a(i.wf,e):i.jb.test(e)?function(e,t){var n=i.jb.exec(t);return Number(n[1])/e.frameRate}(t,e):i.Du.test(e)?function(e,t){var n=i.Du.exec(t);return Number(n[1])/e.tickRate}(t,e):i.te.test(e)?a(i.te,e):void 0};function s(e,t){var n=e.getAttribute("begin"),i=e.getAttribute("dur"),a=e.getAttribute("end"),s=(0,r.Z)(n)?o(n,t):null,u=(0,r.Z)(i)?o(i,t):null,l=(0,r.Z)(a)?o(a,t):null;if(null==s||null==l&&null==u)throw new Error("Invalid text cue");return{start:s,end:null==l?s+u:l}}},7439:function(e,t,n){"use strict";n.d(t,{Z:function(){return k}});var r=n(959);function i(e){return void 0===e.extent&&void 0===e.origin&&void 0===e.displayAlign&&void 0===e.display&&void 0===e.textAlign&&void 0===e.fontSize}function a(e){e.extent="70% 20%",e.fontSize="1c",e.origin="15% 80%",e.displayAlign="before",e.textAlign="center"}var o,s=n(6177);function u(e,t){(void 0===o&&(o=void 0!==e.classList&&"function"==typeof e.classList.add),o)?e.classList.add(t):(" "+e.className+" ").indexOf(" "+t+" ")<0&&(e.className+=" "+t)}var l=n(6923),d=n(8026),c=n(3791),f=n(1594),v=n(3887),p=n(5336);function h(e,t){var n=t;return(0,l.Z)(t)&&t.trim().endsWith("%")&&(n=t.trim().slice(0,-1),n=(parseInt(n,10)/100).toString()+"em"),"-1px -1px "+n+" "+e+",1px -1px "+n+" "+e+",-1px 1px "+n+" "+e+",1px 1px "+n+" "+e}function m(e){var t;return null!=(t=p.Dq.exec(e))?"rgba("+String(parseInt(t[1],16))+","+String(parseInt(t[2],16))+","+String(parseInt(t[3],16))+","+String(parseInt(t[4],16)/255)+")":null!=(t=p.YU.exec(e))?"rgba("+String(parseInt(t[1]+t[1],16))+","+String(parseInt(t[2]+t[2],16))+","+String(parseInt(t[3]+t[3],16))+","+String(parseInt(t[4]+t[4],16)/255)+")":null!=(t=p.GK.exec(e))?"rgb("+String(+t[1])+","+String(+t[2])+","+String(+t[3])+")":null!=(t=p.ev.exec(e))?"rgba("+String(+t[1])+","+String(+t[2])+","+String(+t[3])+","+String(+t[4]/255)+")":e}var g=["color","direction","display","fontFamily","fontSize","fontStyle","fontWeight","textDecoration","textOutline","unicodeBidi","visibility","wrapOption"];function y(e,t,n){var r=t.color;(0,l.Z)(r)&&(e.style.color=m(r));var i=t.backgroundColor;(0,l.Z)(i)&&(e.style.backgroundColor=m(i));var a=t.textOutline;if((0,l.Z)(a)){var o=a.trim().replace(/\s+/g," ").split(" "),s=o.length;if(3===s){var d=m(o[0]),c=o[1];e.style.textShadow=h(d,c)}else if((0,l.Z)(r)&&1===s){var f=o[0];e.style.textShadow=h(r,f)}else if(2===s){var g=/^[#A-Z]/i.test(o[0]);if(g!==/^[0-9]/.test(o[0]))if(g){var y=m(o[0]),_=o[1];e.style.textShadow=h(y,_)}else if((0,l.Z)(r)){var b=o[0];e.style.textShadow=h(r,b)}}}var S=t.textDecoration;if((0,l.Z)(S))switch(S){case"noUnderline":case"noLineThrough":case"noOverline":e.style.textDecoration="none";break;case"lineThrough":e.style.textDecoration="line-through";break;default:e.style.textDecoration=S}var E=t.fontFamily;if((0,l.Z)(E))switch(E){case"proportionalSansSerif":e.style.fontFamily="Arial, Helvetica, Liberation Sans, sans-serif";break;case"monospaceSansSerif":case"sansSerif":e.style.fontFamily="sans-serif";break;case"monospaceSerif":case"default":e.style.fontFamily="Courier New, Liberation Mono, monospace";break;case"proportionalSerif":e.style.fontFamily="serif";break;default:e.style.fontFamily=E}var T=t.fontStyle;(0,l.Z)(T)&&(e.style.fontStyle=T);var k=t.fontWeight;(0,l.Z)(k)&&(e.style.fontWeight=k);var w=t.fontSize;(0,l.Z)(w)?function(e,t){var n=t.trim().split(" ");if(0!==n.length){var r=p.eT.exec(n[0]);if(null!==r)if("px"===r[2]||"em"===r[2])e.style.fontSize=r[1]+r[2];else if("c"===r[2])e.style.position="relative",u(e,"proportional-style"),e.setAttribute("data-proportional-font-size",r[1]);else if("%"===r[2]){var i=Number(r[1]);isNaN(i)?v.Z.warn('TTML Parser: could not parse fontSize value "'+r[1]+'" into a number'):(e.style.position="relative",u(e,"proportional-style"),e.setAttribute("data-proportional-font-size",String(i/100)))}else v.Z.warn("TTML Parser: unhandled fontSize unit:",r[2])}}(e,w):(u(e,"proportional-style"),e.setAttribute("data-proportional-font-size","1"));var A=t.direction;(0,l.Z)(A)&&(e.style.direction=A);var I=t.unicodeBidi;if((0,l.Z)(I))switch(I){case"bidiOverride":e.style.unicodeBidi="bidi-override";break;case"embed":e.style.unicodeBidi="embed";break;default:e.style.unicodeBidi="normal"}var R=t.visibility;(0,l.Z)(R)&&(e.style.visibility=R),"none"===t.display&&(e.style.display="none");var Z=t.wrapOption;e.style.whiteSpace="noWrap"===Z?n?"nowrap":"pre":n?"normal":"pre-wrap"}function _(e,t){e.style.color="white",e.style.position="absolute";var n=t.extent;(0,l.Z)(n)&&function(e,t){var n=t.trim();if("auto"!==n){var r=n.split(" ");if(2===r.length){var i=p.eT.exec(r[0]),a=p.eT.exec(r[1]);null!==i&&null!==a&&("px"===i[2]||"%"===i[2]||"em"===i[2]?e.style.width=i[1]+i[2]:"c"===i[2]?(u(e,"proportional-style"),e.setAttribute("data-proportional-width",i[1])):v.Z.warn("TTML Parser: unhandled extent unit:",i[2]),"px"===a[2]||"%"===a[2]||"em"===a[2]?e.style.height=a[1]+a[2]:"c"===a[2]?(u(e,"proportional-style"),e.setAttribute("data-proportional-height",a[1])):v.Z.warn("TTML Parser: unhandled extent unit:",a[2]))}}}(e,n);var r=t.writingMode;(0,l.Z)(r);var i=t.overflow;e.style.overflow=(0,l.Z)(i)?i:"hidden";var a=t.padding;(0,l.Z)(a)&&function(e,t){var n=t.trim().split(" ");if(!(n.length<1)){var r=p.eT.exec(n[0]);if(null!==r){if("px"===r[2]||"%"===r[2]||"em"===r[2]){var i=r[1]+r[2];1===n.length?e.style.padding=i:2===n.length?(e.style.paddingTop=i,e.style.paddingBottom=i):e.style.paddingTop=i}else"c"===r[2]?(u(e,"proportional-style"),1===n.length?(e.setAttribute("data-proportional-padding-top",r[1]),e.setAttribute("data-proportional-padding-bottom",r[1]),e.setAttribute("data-proportional-padding-left",r[1]),e.setAttribute("data-proportional-padding-right",r[1])):2===n.length?(e.setAttribute("data-proportional-padding-top",r[1]),e.setAttribute("data-proportional-padding-bottom",r[1])):e.setAttribute("data-proportional-padding-top",r[1])):v.Z.warn("TTML Parser: unhandled padding unit:",r[2]);if(1!==n.length){var a=p.eT.exec(n[1]);if(null!==a){if("px"===a[2]||"%"===a[2]||"em"===a[2]){var o=a[1]+a[2];n.length<4?(e.style.paddingLeft=o,e.style.paddingRight=o):e.style.paddingRight=o}else"c"===a[2]?(u(e,"proportional-style"),n.length<4?(e.setAttribute("data-proportional-padding-left",a[1]),e.setAttribute("data-proportional-padding-right",a[1])):e.setAttribute("data-proportional-padding-right",a[1])):v.Z.warn("TTML Parser: unhandled padding unit:",a[2]);if(2!==n.length){var s=p.eT.exec(n[2]);if(null!==s){if("px"===s[2]||"%"===s[2]||"em"===s[2]){var l=s[1]+s[2];e.style.paddingBottom=l}else"c"===s[2]?(u(e,"proportional-style"),e.setAttribute("data-proportional-padding-bottom",s[1])):v.Z.warn("TTML Parser: unhandled padding unit:",s[2]);if(3!==n.length){var d=p.eT.exec(n[3]);if(null!==d)if("px"===d[2]||"%"===d[2]||"em"===d[2]){var c=d[1]+d[2];e.style.paddingLeft=c}else"c"===d[2]?(u(e,"proportional-style"),e.setAttribute("data-proportional-padding-left",d[1])):v.Z.warn("TTML Parser: unhandled padding unit:",d[2])}}}}}}}}(e,a);var o=t.origin;(0,l.Z)(o)&&function(e,t){var n=t.trim();if("auto"!==n){var r=n.split(" ");if(2===r.length){var i=p.eT.exec(r[0]),a=p.eT.exec(r[1]);null!==i&&null!==a&&("px"===i[2]||"%"===i[2]||"em"===i[2]?e.style.left=i[1]+i[2]:"c"===i[2]?(u(e,"proportional-style"),e.setAttribute("data-proportional-left",i[1])):v.Z.warn("TTML Parser: unhandled origin unit:",i[2]),"px"===a[2]||"%"===a[2]||"em"===a[2]?e.style.top=a[1]+a[2]:"c"===a[2]?(u(e,"proportional-style"),e.setAttribute("data-proportional-top",a[1])):v.Z.warn("TTML Parser: unhandled origin unit:",a[2]))}}}(e,o);var s=t.displayAlign;if((0,l.Z)(s))switch(e.style.display="flex",e.style.flexDirection="column",s){case"before":e.style.justifyContent="flex-start";break;case"center":e.style.justifyContent="center";break;case"after":e.style.justifyContent="flex-end"}var d=t.opacity;(0,l.Z)(d)&&(e.style.opacity=d);var c=t.visibility;(0,l.Z)(c)&&(e.style.visibility=c),"none"===t.display&&(e.style.display="none")}function b(e,t){e.style.margin="0px",u(e,"proportional-style"),e.setAttribute("data-proportional-font-size","1");var n=t.backgroundColor;(0,l.Z)(n)&&(e.style.backgroundColor=m(n));var r=t.lineHeight;(0,l.Z)(r)&&function(e,t){var n=t.trim();if("auto"!==n){var r=p.eT.exec(n[0]);null!==r&&("px"===r[2]||"%"===r[2]||"em"===r[2]?e.style.lineHeight=r[1]+r[2]:"c"===r[2]?(u(e,"proportional-style"),e.setAttribute("data-proportional-line-height",r[1])):v.Z.warn("TTML Parser: unhandled lineHeight unit:",r[2]))}}(e,r);var i=t.textAlign;if((0,l.Z)(i))switch(i){case"center":e.style.textAlign="center";break;case"left":case"start":e.style.textAlign="left";break;case"right":case"end":e.style.textAlign="right"}}function S(e,t,n){var r=document.createElement("span"),i=null===e.textContent?"":e.textContent;if(n){var a=i.trim();i=a=a.replace(/\s+/g," ")}var o=document.createTextNode(i);return r.appendChild(o),r.className="rxp-texttrack-span",y(r,t,n),r}function E(e,t,n,r,i,a){var o=a.cellResolution,s=a.shouldTrimWhiteSpace,u=(0,f.jF)(e),v=document.createElement("DIV");if(v.className="rxp-texttrack-region",v.setAttribute("data-resolution-columns",String(o.columns)),v.setAttribute("data-resolution-rows",String(o.rows)),_(v,i),null!==t){var p=(0,c.U)(["backgroundColor"],[].concat(u,[t]),r,n).bodyBackgroundColor;(0,l.Z)(p)&&(v.style.backgroundColor=m(p))}var h=document.createElement("p");h.className="rxp-texttrack-p",b(h,i);for(var y=function(e,t,n,r,i){return function e(r,i,a,o){for(var s=r.childNodes,u=[],v=0;v<s.length;v++){var p=s[v];if("#text"===p.nodeName){var h=(0,c.U)(["backgroundColor"],a,n,t).backgroundColor;(0,l.Z)(h)?i.backgroundColor=h:delete i.backgroundColor;var m=S(p,i,o);u.push(m)}else if((0,f.OE)(p)){var y=document.createElement("BR");u.push(y)}else if((0,f.jg)(p)&&p.nodeType===Node.ELEMENT_NODE&&p.childNodes.length>0){var _=p.getAttribute("xml:space"),b=(0,l.Z)(_)?"default"===_:o,E=(0,d.Z)({},i,(0,c.U)(g,[p],n,t));u.push.apply(u,e(p,E,[p].concat(a),b))}}return u}(e,(0,d.Z)({},r),[],i)}(e,n,r,i,s),E=0;E<y.length;E++)h.appendChild(y[E]);return v.appendChild(h),v}function T(e){var t=e.paragraph,n=e.ttParams,r=e.body,i=e.regionStyles,a=e.idStyles,o=e.paragraphStyle,u=e.timeOffset,l=e.shouldTrimWhiteSpace;if(!t.hasAttribute("begin")&&!t.hasAttribute("end")&&/^\s*$/.test(null===t.textContent?"":t.textContent))return null;var d=n.cellResolution,c=(0,s.Z)(t,n);return{start:c.start+u,end:c.end+u,element:E(t,r,i,a,o,{cellResolution:d,shouldTrimWhiteSpace:l})}}var k=function(e,t){for(var n=(0,r.Z)(e,t),o=[],s=0;s<n.length;s++){var u=n[s].paragraphStyle;i(u)&&a(u);var l=T(n[s]);null!==l&&o.push(l)}return o}},1570:function(e,t,n){"use strict";n.d(t,{Z:function(){return v}});var r=n(959),i=n(7253),a=n(1988),o=n(6923),s=n(6177),u=n(5336),l=n(1594),d={left:"start",center:"center",right:"end",start:"start",end:"end"},c={left:"line-left",center:"center",right:"line-right"};function f(e){var t=e.paragraph,n=e.timeOffset,r=e.paragraphStyle,f=e.ttParams,v=e.shouldTrimWhiteSpace;if(!t.hasAttribute("begin")&&!t.hasAttribute("end")&&/^\s*$/.test(null===t.textContent?"":t.textContent))return null;var p=(0,s.Z)(t,f),h=p.start,m=p.end,g=function(e,t){function n(e,t){for(var r=e.childNodes,i="",a=0;a<r.length;a++){var s=r[a];if("#text"===s.nodeName){var u=s.textContent;if(null===u&&(u=""),t){var d=u.trim();u=d=d.replace(/\s+/g," ")}i+=u.replace(/&|\u0026/g,"&amp;").replace(/<|\u003C/g,"&lt;").replace(/>|\u2265/g,"&gt;").replace(/\u200E/g,"&lrm;").replace(/\u200F/g,"&rlm;").replace(/\u00A0/g,"&nbsp;")}else if((0,l.OE)(s))i+="\n";else if((0,l.jg)(s)&&s.nodeType===Node.ELEMENT_NODE&&s.childNodes.length>0){var c=s.getAttribute("xml:space");i+=n(s,(0,o.Z)(c)?"default"===c:t)}}return i}return n(e,t)}(t,v),y=(0,i.Z)(h+n,m+n,g);return null===y?null:((0,a.Z)(y)&&function(e,t){var n=t.extent;if((0,o.Z)(n)){var r=u._0.exec(n);null!=r&&(e.size=Number(r[1]))}switch(t.writingMode){case"tb":case"tblr":e.vertical="lr";break;case"tbrl":e.vertical="rl"}var i=t.origin;if((0,o.Z)(i))u._0.exec(i);var a=t.align;if((0,o.Z)(a)){e.align=a,"center"===a&&("center"!==e.align&&(e.align="middle"),e.position="auto");var s=c[a];e.positionAlign=void 0===s?"":s;var l=d[a];e.lineAlign=void 0===l?"":l}}(y,r),y)}var v=function(e,t){for(var n=(0,r.Z)(e,t),i=[],a=0;a<n.length;a++){var o=f(n[a]);null!==o&&i.push(o)}return i}},959:function(e,t,n){"use strict";n.d(t,{Z:function(){return v}});var r=n(3274),i=n(6923),a=n(8026),o=n(3887),s=/(\d+) (\d+)/;var u=n(3791),l=n(5138),d=n(7714);var c=n(1594),f=["align","backgroundColor","color","direction","display","displayAlign","extent","fontFamily","fontSize","fontStyle","fontWeight","lineHeight","opacity","origin","overflow","padding","textAlign","textDecoration","textOutline","unicodeBidi","visibility","wrapOption","writingMode"];function v(e,t){var n=[],v=(new DOMParser).parseFromString(e,"text/xml");if(null!=v){var p=v.getElementsByTagName("tt")[0];if(void 0===p)if(void 0===(p=v.getElementsByTagNameNS("*","tt")[0]))throw new Error("invalid XML");for(var h=(0,c.H)(p),m=(0,c.vU)(p),g=(0,c.DM)(p),y=(0,c.kd)(p),_=function(e){var t=e.getAttribute("ttp:frameRate"),n=e.getAttribute("ttp:subFramRate"),r=e.getAttribute("ttp:tickRate"),a=e.getAttribute("ttp:frameRateMultiplier"),u=e.getAttribute("xml:space"),l=e.getAttribute("ttp:cellResolution"),d={columns:32,rows:15};if(null!==l){var c=s.exec(l);if(null===c||c.length<3)o.Z.warn("TTML Parser: Invalid cellResolution");else{var f=parseInt(c[1],10),v=parseInt(c[2],10);isNaN(f)||isNaN(v)?o.Z.warn("TTML Parser: Invalid cellResolution"):d={columns:f,rows:v}}}if((0,i.Z)(u)&&"default"!==u&&"preserve"!==u)throw new Error("Invalid spacing style");var p=Number(t);(isNaN(p)||p<=0)&&(p=30);var h=Number(n);(isNaN(h)||h<=0)&&(h=1);var m=Number(r);(isNaN(m)||m<=0)&&(m=void 0);var g=p,y=null!=h?h:1,_=null!==u?u:"default",b=void 0!==m?m:p*h;if(null!==a){var S=/^(\d+) (\d+)$/g.exec(a);null!==S&&(g=p*(Number(S[1])/Number(S[2])))}return{cellResolution:d,tickRate:b,frameRate:g,subFrameRate:y,spaceStyle:_}}(p),b=[],S=0;S<=m.length-1;S++){var E=m[S];if(E instanceof Element){var T=E.getAttribute("xml:id");if(null!==T){var k=E.getAttribute("style"),w=null===k?[]:k.split(" ");b.push({id:T,style:(0,u.b)(E),extendsStyles:w})}}}!function(e){var t=[];function n(r,i){t.push(i);for(var s=function(){var i=r.extendsStyles[u],s=(0,l.Z)(e,(function(e){return e.id===i}));if(s<0)o.Z.warn("TTML Parser: unknown style inheritance: "+i);else{var c=e[s];(0,d.Z)(t,s)?o.Z.warn("TTML Parser: infinite style inheritance loop avoided"):n(c,s),r.style=(0,a.Z)({},c.style,r.style)}},u=0;u<r.extendsStyles.length;u++)s();r.extendsStyles.length=0}for(var r=0;r<e.length;r++)n(e[r],r),t.length=0}(b);for(var A=[],I=function(){var e=g[R];if(e instanceof Element){var t=e.getAttribute("xml:id");if(null!==t){var n=(0,u.b)(e),o=e.getAttribute("style");if((0,i.Z)(o)){var s=(0,r.Z)(b,(function(e){return e.id===o}));void 0!==s&&(n=(0,a.Z)({},s.style,n))}A.push({id:t,style:n,extendsStyles:[]})}}},R=0;R<=g.length-1;R++)I();for(var Z=(0,u.U)(f,null!==h?[h]:[],b,A),x="default"===(null!==h?h.getAttribute("xml:space"):void 0)||"default"===_.spaceStyle,P=0;P<y.length;P++){var M=y[P];if(M instanceof Element){var C=(0,c.jF)(M),D=(0,a.Z)({},Z,(0,u.U)(f,[M].concat(C),b,A)),N=M.getAttribute("xml:space"),O=(0,i.Z)(N)?"default"===N:x,L={paragraph:M,timeOffset:t,idStyles:b,regionStyles:A,body:h,paragraphStyle:D,ttParams:_,shouldTrimWhiteSpace:O};null!==L&&n.push(L)}}}return n}},5336:function(e,t,n){"use strict";n.d(t,{Dq:function(){return c},Du:function(){return s},GK:function(){return v},KO:function(){return i},YU:function(){return f},_0:function(){return l},eT:function(){return d},ev:function(){return p},gu:function(){return r},jb:function(){return o},te:function(){return u},wf:function(){return a}});var r=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,i=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,a=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,o=/^(\d*\.?\d*)f$/,s=/^(\d*\.?\d*)t$/,u=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/,l=/^(\d{1,2}|100)% (\d{1,2}|100)%$/,d=/^((?:\+|\-)?\d*(?:\.\d+)?)(px|em|c|%|rh|rw)$/,c=/^#([0-9A-f]{2})([0-9A-f]{2})([0-9A-f]{2})([0-9A-f]{2})$/,f=/^#([0-9A-f])([0-9A-f])([0-9A-f])([0-9A-f])$/,v=/^rgb\( *(\d+) *, *(\d+) *, *(\d+) *\)/,p=/^rgba\( *(\d+) *, *(\d+) *, *(\d+) *, *(\d+) *\)/},1594:function(e,t,n){"use strict";function r(e,t){if(!(e.parentNode instanceof Element))return[];return function e(n){var r=[];n.tagName.toLowerCase()===t.toLowerCase()&&r.push(n);var i=n.parentNode;return i instanceof Element&&r.push.apply(r,e(i)),r}(e.parentNode)}function i(e){var t=r(e,"div");if(0===t.length){var n=r(e,"tt:div");n.length>0&&(t=n)}return t}function a(e){var t=e.getElementsByTagName("body");if(t.length>0)return t[0];var n=e.getElementsByTagName("tt:body");return n.length>0?n[0]:null}function o(e){var t=e.getElementsByTagName("style");if(t.length>0)return t;var n=e.getElementsByTagName("tt:style");return n.length>0?n:t}function s(e){var t=e.getElementsByTagName("region");if(t.length>0)return t;var n=e.getElementsByTagName("tt:region");return n.length>0?n:t}function u(e){var t=e.getElementsByTagName("p");if(t.length>0)return t;var n=e.getElementsByTagName("tt:p");return n.length>0?n:t}function l(e){return"br"===e.nodeName||"tt:br"===e.nodeName}function d(e){return"span"===e.nodeName||"tt:span"===e.nodeName}n.d(t,{DM:function(){return s},H:function(){return a},OE:function(){return l},jF:function(){return i},jg:function(){return d},kd:function(){return u},vU:function(){return o}})},1138:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(6923),i=n(360);function a(e,t){for(var n=[],a=t;a<e.length;a++)if((0,i.tq)(e,a)){var o=(0,i.$4)(e,a);n.push(e.slice(a,o)),a=o}else if((0,r.Z)(e[a]))for(;(0,r.Z)(e[a]);)a++;return n}},4099:function(e,t,n){"use strict";n.d(t,{Z:function(){return I}});var r=n(1138),i=n(6923),a=n(360);var o=n(9525),s={white:"#ffffff",lime:"#00ff00",cyan:"#00ffff",red:"#ff0000",yellow:"#ffff00",magenta:"#ff00ff",blue:"#0000ff",black:"#000000"};function u(e){var t=Object.keys(s).reduce((function(e,t){return e[t]="color: "+s[t]+";",e["bg_"+t]="background-color: "+s[t]+";",e}),{}),n="";return e.forEach((function(e){if(e.length>=2)for(var r=function(r){var o=e[r];if(Array.isArray(/::cue {/.exec(o)))for(o=e[++r];(0,i.Z)(o)&&!Array.isArray(/}/.exec(o))&&0!==o.length;)n+=o,o=e[++r];else{for(var s=[],u=/::cue\(\.?(.*?)\)(?:,| {)/.exec(o);(0,i.Z)(o)&&Array.isArray(u);)s.push(u[1]),o=e[++r],u=/::cue\(\.?(.*?)\)(?:,| {)/.exec(o);for(var l="";(0,i.Z)(o)&&!Array.isArray(/}/.exec(o))&&0!==o.length;)l+=o,o=e[++r];s.forEach((function(e){void 0===t[e]?t[e]=l:t[e]+=l}))}a=r},a=1;a<e.length;a++)r(a)})),{classes:t,global:n}}var l=n(7714);function d(e,t){var n,r=["u","i","b"],a=e.nodeName.toLowerCase().split(".")[0];if((0,l.Z)(["u","i","b","c","#text"],a))if("#text"===a){var o=e.wholeText.split("\n");n=document.createElement("span");for(var s=0;s<o.length;s++)if(s>0&&n.appendChild(document.createElement("br")),o[s].length>0){var u=document.createTextNode(o[s]);n.appendChild(u)}}else{var c=e.nodeName.toLowerCase().split("."),f=[];if(c.forEach((function(e){(0,i.Z)(t[e])&&f.push(t[e])})),0!==f.length){var v=document.createAttribute("style");f.forEach((function(e){v.value+=e}));var p=(0,l.Z)(r,a)?a:"span";(n=document.createElement(p)).setAttributeNode(v)}else{var h=(0,l.Z)(r,a)?a:"span";n=document.createElement(h)}for(var m=0;m<e.childNodes.length;m++){var g=d(e.childNodes[m],t);n.appendChild(g)}}else{n=document.createElement("span");for(var y=0;y<e.childNodes.length;y++){var _=d(e.childNodes[y],t);n.appendChild(_)}}return n}var c=n(1679);var f,v,p,h=function(e){if(!(void 0!==e&&0!==(0,c.Z)(e).length))return"text-align:center";var t=m(e),n=_(e);return"position: absolute;margin: 0;transform: translate("+t.offset+"%,"+n.offset+"%);width: "+T(e.size)+"%;left: "+t.position+"%;top: "+(null!==n.position?n.position+"%":"auto")+";text-align: "+E(e.align)+";"};!function(e){e.LINE_LEFT="line-left",e.CENTER="center",e.LINE_RIGHT="line-right"}(f||(f={})),function(e){e.LEFT="left",e.CENTER="center",e.RIGHT="right"}(v||(v={})),function(e){e.START="start",e.CENTER="center",e.END="end"}(p||(p={}));var m=function(e){return{position:g(e),offset:y(e)}},g=function(e){var t,n=w(e.position);if(null!==n)return n;var r=E(e.align);return((t={})[v.LEFT]=0,t[v.CENTER]=50,t[v.RIGHT]=100,t)[r]},y=function(e){var t,n,r,i,a=((t={})[f.LINE_LEFT]=0,t[f.CENTER]=-50,t[f.LINE_RIGHT]=-100,t),o=void 0!==e.position?(r=e.position,i=/,(line-left|line-right|center)/.exec(r),!Array.isArray(i)||i.length<2?null:i[1]):null;return null!==o?a[o]:((n={})[v.LEFT]=0,n[v.CENTER]=-50,n[v.RIGHT]=-100,n)[void 0!==e.align?E(e.align):v.CENTER]},_=function(e){return{position:b(e.line),offset:S(e.line)}},b=function(e){return w(e)},S=function(e){var t,n=((t={})[p.START]=0,t[p.CENTER]=-50,t[p.END]=-100,t);if(void 0===e)return n[p.START];var r,i=(r=/,(start|center|end)/.exec(e),!Array.isArray(r)||r.length<2?null:r[1]);return null!==i?n[i]:n[p.START]},E=function(e){switch(e){case"left":case"start":return"left";case"right":case"end":return"right";default:return"center"}},T=function(e){return k(e,100)},k=function(e,t){var n=w(e);return null!==n?n:t},w=function(e){if(void 0===e)return null;var t=/^([\d.]+)%/.exec(e);return!Array.isArray(t)||t.length<2?null:parseInt(t[1],10)};function A(e,t){var n=e.start,r=e.end,a=e.settings,o=e.header,s=e.payload,u=document.createElement("div"),l=document.createAttribute("style");l.value="width:100%;height:100%;display:flex;flex-direction:column;justify-content:flex-end;align-items:center;",u.setAttributeNode(l);var c=document.createElement("p"),f=function(e){var t=document.createAttribute("style");return t.value=h(e),t}(a);c.setAttributeNode(f);var v=document.createElement("span"),p=document.createAttribute("style");p.value="background-color:rgba(0,0,0,0.8);color:white;",v.setAttributeNode(p);var m=t.global,g=t.classes,y=[m,(0,i.Z)(o)?g[o]:void 0].filter((function(e){return void 0!==e})).join("");return p.value+=y,v.setAttributeNode(p),function(e,t){for(var n=e.replace(/<[0-9]{2}:[0-9]{2}.[0-9]{3}>/,"").replace(/<([u,i,b,c])(\..*?)?(?: .*?)?>(.*?)<\/\1>/g,"<$1$2>$3</$1$2>"),r=(new DOMParser).parseFromString(n,"text/html").body.childNodes,i=[],a=0;a<r.length;a++)i.push(d(r[a],t));return i}(s.join("\n"),g).forEach((function(e){v.appendChild(e)})),u.appendChild(c),c.appendChild(v),{start:n,end:r,element:u}}var I=function(e,t){var n=e.split(/\r\n|\n|\r/g),s=[];if(null===/^WEBVTT( |\t|\n|\r|$)/.exec(n[0]))throw new Error("Can't parse WebVTT: Invalid File.");for(var l=(0,a.yE)(n),d=function(e,t){for(var n=[],r=t;r<e.length;r++)if((0,a.JF)(e,r)){var o=r;for(r++;(0,i.Z)(e[r]);)r++;var s=e.slice(o,r);n.push(s)}else if((0,i.Z)(e[r]))for(;(0,i.Z)(e[r]);)r++;return n}(n,l),c=(0,r.Z)(n,l),f=u(d),v=0;v<c.length;v++){var p=(0,o.Z)(c[v],t);if(null!=p){var h=A(p,f);s.push(h)}}return s}},9405:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var r=n(1988),i=n(1138),a=n(9525),o=n(360),s=n(7714),u=n(6923);function l(e,t){if(!(0,u.Z)(e.vertical)||"rl"!==e.vertical&&"lr"!==e.vertical||(t.vertical=e.vertical),(0,u.Z)(e.line)){var n=/^(\d+(\.\d+)?)%(,([a-z]+))?/.exec(e.line);if(Array.isArray(n))t.line=Number(n[1]),t.snapToLines=!1,(0,s.Z)(["start","center","end"],n[4])&&(t.lineAlign=n[4]);else{var r=/^(-?\d+)(,([a-z]+))?/.exec(e.line);Array.isArray(r)&&(t.line=Number(r[1]),t.snapToLines=!0,(0,s.Z)(["start","center","end"],r[3])&&(t.lineAlign=r[3]))}}if((0,u.Z)(e.position)){var i=/^([\d\.]+)%(?:,(line-left|line-right|center))?$/.exec(e.position);if(Array.isArray(i)&&i.length>=2){var a=parseInt(i[1],10);isNaN(a)||(t.position=a,void 0!==i[2]&&(t.positionAlign=i[2]))}}(0,u.Z)(e.size)&&(t.size=e.size),"string"==typeof e.align&&(0,s.Z)(["start","center","end","left"],e.align)&&(t.align=e.align)}var d=n(7253);var c=function(e,t){var n=e.split(/\r\n|\n|\r/);if(!/^WEBVTT($| |\t)/.test(n[0]))throw new Error("Can't parse WebVTT: Invalid file.");for(var s,u,c,f,v=(0,o.yE)(n),p=(0,i.Z)(n,v),h=[],m=0;m<p.length;m++){var g=(0,a.Z)(p[m],t);if(null!=g){var y=(u=void 0,c=void 0,f=void 0,u=(s=g).start,c=s.end,f=s.payload.join("\n"),(0,d.Z)(u,c,f));null!=y&&((0,r.Z)(y)&&l(g.settings,y),h.push(y))}}return h}},9525:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(6923);function i(e){var t=e.split(":").reverse();if((0,r.Z)(t[2])||(0,r.Z)(t[1])){var n=(0,r.Z)(t[2])?parseInt(t[2],10):0,i=parseInt(t[1],10),a=parseFloat(t[0].replace(",","."));if(isNaN(n)||isNaN(i)||isNaN(a))return;return 60*n*60+60*i+a}}function a(e,t){var n,r,a,o=/-->/;if(o.test(e[0]))n=e[0],r=e.slice(1,e.length);else{if(!o.test(e[1]))return null;a=e[0],n=e[1],r=e.slice(2,e.length)}var s=function(e){var t=/^([\d:.]+)[ |\t]+-->[ |\t]+([\d:.]+)[ |\t]*(.*)$/.exec(e);if(null===t)return null;var n=i(t[1]),r=i(t[2]);return null==n||null==r?null:{start:n,end:r,settings:t[3].split(/ |\t/).reduce((function(e,t){var n=t.split(":");return 2===n.length&&(e[n[0]]=n[1]),e}),{})}}(n);return null===s?null:{start:s.start+t,end:s.end+t,settings:s.settings,payload:r,header:a}}},360:function(e,t,n){"use strict";n.d(t,{$4:function(){return s},JF:function(){return a},tq:function(){return o},yE:function(){return i}});var r=n(6923);function i(e){for(var t=0;t<e.length;){if(""===e[t])return t+1;t++}return t}function a(e,t){return"string"==typeof e[t]&&/^STYLE( .*)?$/g.test(e[t])&&(void 0===e[t+1]||e[t+1].indexOf("--\x3e")<0)}function o(e,t){var n=e[t];if(void 0===n||""===n||a(e,t)||function(e,t){return"string"==typeof e[t]&&/^REGION( .*)?$/g.test(e[t])&&(void 0===e[t+1]||e[t+1].indexOf("--\x3e")<0)}(e,t)||function(e,t){return"string"==typeof e[t]&&/^NOTE( .*)?$/g.test(e[t])&&(void 0===e[t+1]||e[t+1].indexOf("--\x3e")<0)}(e,t))return!1;if(n.indexOf("--\x3e")>=0)return!0;var r=e[t+1];return void 0!==r&&r.indexOf("--\x3e")>=0}function s(e,t){for(var n=t+1;(0,r.Z)(e[n]);)n++;return n}},2047:function(e,t,n){"use strict";n.d(t,{Z:function(){return ue}});var r=n(7874),i=n(8791),a=n(6872),o=n(8750),s=n(3887),u=n(8619),l=n(8026),d=n(4597),c=n(3635);function f(e){var t=e.referenceDateTime,n=void 0!==e.serverSyncInfos?e.serverSyncInfos.serverTimestamp-e.serverSyncInfos.clientTime:void 0;return function(i,f,v,p,h){var m,g=i.responseData,y=f.externalClockOffset,_=null!==(m=i.url)&&void 0!==m?m:f.originalUrl,b=null!=n?n:y,S={unsafelyBaseOnPreviousManifest:f.unsafeMode?f.previousManifest:null,url:_,referenceDateTime:t,externalClockOffset:b},E=r.Z.dashParsers;if(null===E.wasm||"uninitialized"===E.wasm.status||"failure"===E.wasm.status)return s.Z.debug("DASH: WASM MPD Parser not initialized. Running JS one."),k();var T=function(e){if(e instanceof ArrayBuffer)return e;if("string"==typeof e)return(0,c.tG)(e).buffer;if(e instanceof Document)return(0,c.tG)(e.documentElement.innerHTML).buffer;throw new Error("DASH Manifest Parser: Unrecognized Manifest format")}(g);return function(e){var t=new DataView(e);if(61371===t.getUint16(0)&&191===t.getUint8(2))return!0;if(65279===t.getUint16(0)||65534===t.getUint16(0))return!1;return!0}(T)?"initialized"===E.wasm.status?(s.Z.debug("DASH: Running WASM MPD Parser."),w(E.wasm.runWasmParser(T,S))):(s.Z.debug("DASH: Awaiting WASM initialization before parsing the MPD."),E.wasm.waitForInitialization().catch((function(){})).then((function(){return null===E.wasm||"initialized"!==E.wasm.status?(s.Z.warn("DASH: WASM MPD parser initialization failed. Running JS parser instead"),k()):(s.Z.debug("DASH: Running WASM MPD Parser."),w(E.wasm.runWasmParser(T,S)))}))):(s.Z.info("DASH: MPD doesn't seem to be UTF-8-encoded. Running JS parser instead of the WASM one."),k());function k(){if(null===E.js)throw new Error("No MPD parser is imported");var e=function(e){if(e instanceof ArrayBuffer)return(new DOMParser).parseFromString((0,c.uR)(new Uint8Array(e)),"text/xml");if("string"==typeof e)return(new DOMParser).parseFromString(e,"text/xml");if(e instanceof Document)return e;throw new Error("DASH Manifest Parser: Unrecognized Manifest format")}(g);return w(E.js(e,S))}function w(t){if("done"===t.type)return t.value.warnings.length>0&&v(t.value.warnings),p.isCancelled()?Promise.reject(p.cancellationError):{manifest:new u.ZP(t.value.parsed,e),url:_};var n=t.value,r=n.urls.map((function(e){return h((function(){var t=a.Z.getCurrent().DEFAULT_REQUEST_TIMEOUT;return"string"===n.format?(0,d.ZP)({url:e,responseType:"text",timeout:t,cancelSignal:p}):(0,d.ZP)({url:e,responseType:"arraybuffer",timeout:t,cancelSignal:p})})).then((function(e){if("string"===n.format){if("string"!=typeof e.responseData)throw new Error("External DASH resources should have been a string");return(0,l.Z)(e,{responseData:{success:!0,data:e.responseData}})}if(!(e.responseData instanceof ArrayBuffer))throw new Error("External DASH resources should have been ArrayBuffers");return(0,l.Z)(e,{responseData:{success:!0,data:e.responseData}})}),(function(e){var t=(0,o.Z)(e,{defaultCode:"PIPELINE_PARSE_ERROR",defaultReason:"An unknown error occured when parsing ressources."});return(0,l.Z)({},{size:void 0,requestDuration:void 0,responseData:{success:!1,error:t}})}))}));return Promise.all(r).then((function(e){return n.format,w(n.continue(e))}))}}}var v=n(7839),p=n(5861),h=n(4687),m=n.n(h),g=n(9105),y=n(5992),_=n(1946),b="function"==typeof Headers?Headers:null,S="function"==typeof AbortController?AbortController:null;function E(){return"function"==typeof window.fetch&&!(0,_.Z)(S)&&!(0,_.Z)(b)}var T=n(8806),k=n(281);function w(e,t){return"audio"===e||"video"===e?"video/mp4"===t||"audio/mp4"===t?"mp4":"video/webm"===t||"audio/webm"===t?"webm":void 0:"text"===e&&"application/mp4"===t?"mp4":void 0}var A=n(288),I=n(4460);function R(e){return function(t,n,r,i,a){return new Promise((function(s,u){var l=new A.ZP,d=l.linkToSignal(i);function c(){l.signal.deregister(u),d()}l.signal.register(u),e(t,n,r,l.signal,Object.assign(Object.assign({},a),{onNewChunk:function(e){try{o(e),a.onNewChunk(e)}catch(e){c(),l.cancel(),u(e)}}})).then((function(e){if(c(),!l.isUsed()){if("segment-loaded"===e.resultType)try{o(e.resultData.responseData)}catch(e){return void u(e)}s(e)}}),(function(e){c(),u(e)}))}));function o(e){(e instanceof ArrayBuffer||e instanceof Uint8Array)&&"mp4"===w(n.type,n.mimeType)&&(0,I.Z)(new Uint8Array(e),n.segment.isInit)}}}var Z=n(9829);function x(e,t){return null===e?null:null===t.url?e.baseUrl:(0,Z.Z)(e.baseUrl,t.url)}var P=n(6968);function M(e,t,n,r,i){if(void 0===t.range)return(0,d.ZP)({url:e,responseType:"arraybuffer",timeout:n.timeout,cancelSignal:r,onProgress:i.onProgress}).then((function(e){return{resultType:"segment-loaded",resultData:e}}));if(void 0===t.indexRange)return(0,d.ZP)({url:e,headers:{Range:(0,k.Z)(t.range)},responseType:"arraybuffer",timeout:n.timeout,cancelSignal:r,onProgress:i.onProgress}).then((function(e){return{resultType:"segment-loaded",resultData:e}}));if(t.range[1]+1===t.indexRange[0])return(0,d.ZP)({url:e,headers:{Range:(0,k.Z)([t.range[0],t.indexRange[1]])},responseType:"arraybuffer",timeout:n.timeout,cancelSignal:r,onProgress:i.onProgress}).then((function(e){return{resultType:"segment-loaded",resultData:e}}));var a=(0,d.ZP)({url:e,headers:{Range:(0,k.Z)(t.range)},responseType:"arraybuffer",timeout:n.timeout,cancelSignal:r,onProgress:i.onProgress}),o=(0,d.ZP)({url:e,headers:{Range:(0,k.Z)(t.indexRange)},responseType:"arraybuffer",timeout:n.timeout,cancelSignal:r,onProgress:i.onProgress});return Promise.all([a,o]).then((function(t){var n=t[0],r=t[1],i=(0,P.zo)(new Uint8Array(n.responseData),new Uint8Array(r.responseData)),a=Math.min(n.sendingTime,r.sendingTime),o=Math.max(n.receivedTime,r.receivedTime);return{resultType:"segment-loaded",resultData:{url:e,responseData:i,size:n.size+r.size,requestDuration:o-a,sendingTime:a,receivedTime:o}}}))}var C=n(8766);function D(e,t,n,r,i){var a=t.segment,o=void 0!==a.range?{Range:(0,k.Z)(a.range)}:void 0,u=null;return function(e){var t;if(!(0,_.Z)(e.headers))if((0,_.Z)(b))t=e.headers;else{t=new b;for(var n=Object.keys(e.headers),r=0;r<n.length;r++){var i=n[r];t.append(i,e.headers[i])}}s.Z.debug("Fetch: Called with URL",e.url);var a,o=null,u=!1,l=performance.now(),d=(0,_.Z)(S)?null:new S;function c(){(0,_.Z)(d)?s.Z.warn("Fetch: AbortController API not available."):d.abort()}void 0!==e.timeout&&(a=window.setTimeout((function(){u=!0,c()}),e.timeout));var f=e.cancelSignal.register((function(e){o=e,c()})),v={method:"GET"};return void 0!==t&&(v.headers=t),v.signal=(0,_.Z)(d)?null:d.signal,fetch(e.url,v).then((function(t){if((0,_.Z)(a)||clearTimeout(a),t.status>=300)throw s.Z.warn("Fetch: Request HTTP Error",t.status,t.url),new g.Z(t.url,t.status,y.br.ERROR_HTTP_CODE);if((0,_.Z)(t.body))throw new g.Z(t.url,t.status,y.br.PARSE_ERROR);var n=t.headers.get("Content-Length"),r=(0,_.Z)(n)||isNaN(+n)?void 0:+n,i=t.body.getReader(),o=0;return u();function u(){return d.apply(this,arguments)}function d(){return(d=(0,p.Z)(m().mark((function n(){var a,s,d,c,v;return m().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,i.read();case 2:if((a=n.sent).done||(0,_.Z)(a.value)){n.next=11;break}return o+=a.value.byteLength,s=performance.now(),d={url:t.url,currentTime:s,duration:s-l,sendingTime:l,chunkSize:a.value.byteLength,chunk:a.value.buffer,size:o,totalSize:r},e.onData(d),n.abrupt("return",u());case 11:if(!a.done){n.next=16;break}return f(),c=performance.now(),v=c-l,n.abrupt("return",{requestDuration:v,receivedTime:c,sendingTime:l,size:o,status:t.status,url:t.url});case 16:return n.abrupt("return",u());case 17:case"end":return n.stop()}}),n)})))).apply(this,arguments)}})).catch((function(t){if(null!==o)throw o;if(f(),u)throw s.Z.warn("Fetch: Request timeouted."),new g.Z(e.url,0,y.br.TIMEOUT);if(t instanceof g.Z)throw t;throw s.Z.warn("Fetch: Request Error",t instanceof Error?t.toString():""),new g.Z(e.url,0,y.br.ERROR_EVENT)}))}({url:e,headers:o,onData:function(e){var t=new Uint8Array(e.chunk),n=function(e){for(var t=0,n=[];t<e.length;){var r=e.subarray(t,1/0),i=(0,C.Z)(r,1836019558);if(i<0)return[n,r];var a=t+i+(0,P.pX)(e,i+t);if(a>e.length)return[n,r];var o=(0,C.Z)(r,1835295092);if(o<0)return[n,r];var s=t+o+(0,P.pX)(e,o+t);if(s>e.length)return[n,r];var u=Math.max(a,s),l=e.subarray(t,u);n.push(l),t=u}return[n,null]}(null!==u?(0,P.zo)(u,t):t),a=n[0];u=n[1];for(var o=0;o<a.length;o++)if(r.onNewChunk(a[o]),i.isCancelled())return;r.onProgress({duration:e.duration,size:e.size,totalSize:e.totalSize}),i.isCancelled()},timeout:n.timeout,cancelSignal:i}).then((function(e){return{resultType:"chunk-complete",resultData:e}}))}function N(e,t,n,r,i,a){if(t.segment.isInit)return M(e,t.segment,r,a,i);var o=w(t.type,t.mimeType);if(n&&("mp4"===o||void 0===o)){if(E())return D(e,t,r,i,a);(0,T.Z)("DASH: Your browser does not have the fetch API. You will have a higher chance of rebuffering when playing close to the live edge")}var s=t.segment;return(0,d.ZP)({url:e,responseType:"arraybuffer",headers:void 0!==s.range?{Range:(0,k.Z)(s.range)}:void 0,timeout:r.timeout,cancelSignal:a,onProgress:i.onProgress}).then((function(e){return{resultType:"segment-loaded",resultData:e}}))}var O=n(6490),L=n(4644),U=408125543,B=357149030,F=2807729,z=17545,V=475249515,K=187,G=179,j=183,H=241;function W(e,t,n,r){for(var i=r[0],a=r[1],o=i;o<a;){var s=Q(n,o);if(null==s)return null;var u=s.value,l=o+s.length,d=$(n,l);if(null==d)return null;var c=l+d.length,f=c+d.value;if(u===e)return[c,f];if(t.length>0)for(var v=0;v<t.length;v++){if(u===t[v])return W(e,t.slice(v+1,t.length),n,[c,f])}o=f}return null}function q(e,t){var n=W(F,[U,B],e,[t,e.length]);if(null==n)return null;var r=n[1]-n[0];return 1e9/J(e,n[0],r)}function Y(e,t){var n=W(z,[U,B],e,[t,e.length]);if(null==n)return null;var r=n[1]-n[0];return 4===r?function(e,t){return new DataView(e.buffer).getFloat32(t)}(e,n[0]):8===r?function(e,t){return new DataView(e.buffer).getFloat64(t)}(e,n[0]):null}function X(e,t){for(var n=1;n<=8;n++)if(e[t]>=Math.pow(2,8-n))return n}function Q(e,t){var n=X(e,t);if(null==n)return s.Z.warn("webm: unrepresentable length"),null;if(t+n>e.length)return s.Z.warn("webm: impossible length"),null;for(var r=0,i=0;i<n;i++)r=e[t+i]*Math.pow(2,8*(n-i-1))+r;return{length:n,value:r}}function $(e,t){var n=X(e,t);if(null==n)return s.Z.warn("webm: unrepresentable length"),null;if(t+n>e.length)return s.Z.warn("webm: impossible length"),null;for(var r=(e[t]&(1<<8-n)-1)*Math.pow(2,8*(n-1)),i=1;i<n;i++)r=e[t+i]*Math.pow(2,8*(n-i-1))+r;return{length:n,value:r}}function J(e,t,n){for(var r=0,i=0;i<n;i++)r=e[t+i]*Math.pow(2,8*(n-i-1))+r;return r}var ee=n(5278);function te(e,t,n,r){var i=(0,L.Qx)(e);if(void 0===i||void 0===r)return null;var a,o=void 0!==n.timestampOffset?i+n.timestampOffset*r:i,u=(0,L.MM)(e);if(o<0&&(void 0!==u&&(u+=o),o=0),t||!n.complete)return void 0===u&&s.Z.warn("DASH: Chunked segments should indicate a duration through their trun boxes"),{time:o/r,duration:void 0!==u?u/r:void 0};var l=n.duration*r,d=Math.min(.9*r,l/4);return void 0!==u&&Math.abs(u-l)<=d&&(a=u),{time:o/r,duration:void 0!==a?a/r:a}}function ne(e,t){if(0!==e.length){var n=e.reduce((function(e,t){return"urn:mpeg:dash:event:2012"===t.schemeIdUri&&"1"===t.value?(void 0===e.manifestRefreshEventsFromEMSGs&&(e.manifestRefreshEventsFromEMSGs=[]),e.manifestRefreshEventsFromEMSGs.push(t)):(void 0===e.EMSGs&&(e.EMSGs=[]),e.EMSGs.push(t)),e}),{manifestRefreshEventsFromEMSGs:void 0,EMSGs:void 0}),r=n.manifestRefreshEventsFromEMSGs,i=n.EMSGs,a=null==i?void 0:i.map((function(e){return{type:"emsg",value:e}})),o=void 0!==t&&void 0!==r&&function(e,t){if(e.length<=0)return!1;for(var n=e.length,r=0;r<n;r++){var i=t,a=e[r].messageData,o=(0,c.uR)(a),s=Date.parse(o);if(void 0===i||void 0===s||isNaN(s)||s>=i)return!0}return!1}(r,t);return{inbandEvents:a,needsManifestRefresh:o}}}function re(e){var t=e.__priv_patchLastSegmentInSidx;return function(e,n,r){var i,a=n.segment,o=n.periodStart,s=n.periodEnd,u=e.data,l=e.isChunked,d=[o,s];if(null===u)return a.isInit?{segmentType:"init",initializationData:null,initializationDataSize:0,protectionData:[],initTimescale:void 0}:{segmentType:"media",chunkData:null,chunkSize:0,chunkInfos:null,chunkOffset:0,protectionData:[],appendWindow:d};var c=u instanceof Uint8Array?u:new Uint8Array(u),f=w(n.type,n.mimeType),v="mp4"===f||void 0===f,p=[];if(v){var h,m=(0,O.Z)(c);a.isInit&&(h=null!==(i=(0,L.R0)(c))&&void 0!==i?i:void 0),(m.length>0||void 0!==h)&&p.push({initDataType:"cenc",keyId:h,initData:m})}if(!a.isInit){var g=v?te(c,l,a,r):null,y=(0,ee.Z)(a.timestampOffset,0);if(v){var b=(0,L.s9)(c);if(void 0!==b){var S=ne(b.filter((function(e){return void 0!==a.privateInfos&&void 0!==a.privateInfos.isEMSGWhitelisted&&a.privateInfos.isEMSGWhitelisted(e)})),n.manifestPublishTime);if(void 0!==S){var E=S.needsManifestRefresh,T=S.inbandEvents;return{segmentType:"media",chunkData:c,chunkSize:c.length,chunkInfos:g,chunkOffset:y,appendWindow:d,inbandEvents:T,protectionData:p,needsManifestRefresh:E}}}}return{segmentType:"media",chunkData:c,chunkSize:c.length,chunkInfos:g,chunkOffset:y,protectionData:p,appendWindow:d}}var k,A=a.indexRange;if("webm"===f)k=function(e,t){var n=W(U,[],e,[t,e.length]);if(null==n)return null;var r=n[0],i=n[1],a=q(e,r);if(null==a)return null;var o=Y(e,r);if(null==o)return null;var s=W(V,[],e,[r,i]);if(null==s)return null;for(var u=[],l=s[0];l<s[1];){var d=W(K,[],e,[l,s[1]]);if(null==d)break;var c=W(G,[],e,[d[0],d[1]]);if(null==c)return null;var f=J(e,c[0],c[1]-c[0]),v=W(H,[j],e,[d[0],d[1]]);if(null==v)return null;var p=J(e,v[0],v[1]-v[0])+r;u.push({time:f,rangeStart:p}),l=d[1]}for(var h=[],m=0;m<u.length;m++){var g=u[m];m===u.length-1?h.push({time:g.time,timescale:a,duration:0===m?o:o-g.time,range:[g.rangeStart,1/0]}):h.push({time:g.time,timescale:a,duration:u[m+1].time-g.time,range:[g.rangeStart,u[m+1].rangeStart-1]})}return h}(c,0);else if(v&&(k=(0,L.Wf)(c,Array.isArray(A)?A[0]:0),!0===t&&null!==k&&k.length>0)){var I=k[k.length-1];Array.isArray(I.range)&&(I.range[1]=1/0)}var R=v?(0,L.LD)(c):"webm"===f?q(c,0):void 0,Z=(0,_.Z)(R)?void 0:R;return{segmentType:"init",initializationData:c,initializationDataSize:c.length,protectionData:p,initTimescale:Z,segmentList:null!=k?k:void 0}}}var ie=n(6807);function ae(e,t,n,r){var i,a,o=e.segment,u=e.language,l=e.codecs;if(o.isInit)return null;null===n?r?(i=o.time,a=o.end):s.Z.warn("Transport: Unavailable time data for current text track."):(i=n.time,void 0!==n.duration?a=i+n.duration:!r&&o.complete&&(a=i+o.duration));var d=function(e){if(void 0===e)throw new Error("Cannot parse subtitles: unknown format");switch(e.toLowerCase()){case"stpp":case"stpp.ttml.im1t":return"ttml";case"wvtt":return"vtt"}throw new Error('The codec used for the subtitles "'+e+'" is not managed yet.')}(l),f=function(e){var t=(0,ie.Le)(e);return null===t?"":(0,c.uR)(t)}(t);return{data:f,type:d,language:u,start:i,end:a}}function oe(e,t,n){var r,i,a=e.segment;return a.isInit?null:(n?s.Z.warn("Transport: Unavailable time data for current text track."):(r=a.time,a.complete&&(i=a.time+a.duration)),{data:t,type:function(e,t){switch(t){case"application/ttml+xml":return"ttml";case"application/x-sami":case"application/smil":return"sami";case"text/vtt":return"vtt"}if(void 0!==e&&"srt"===e.toLowerCase())return"srt";throw new Error("could not find a text-track parser for the type "+(null!=t?t:""))}(e.codecs,e.mimeType),language:e.language,start:r,end:i})}function se(e){var t=e.__priv_patchLastSegmentInSidx;return function(e,n,r){var i,a=n.periodStart,o=n.periodEnd,s=n.segment,u=e.data,l=e.isChunked;if(null===u)return s.isInit?{segmentType:"init",initializationData:null,initializationDataSize:0,protectionData:[],initTimescale:void 0}:{segmentType:"media",chunkData:null,chunkSize:0,chunkInfos:null,chunkOffset:null!==(i=s.timestampOffset)&&void 0!==i?i:0,protectionData:[],appendWindow:[a,o]};var d=w(n.type,n.mimeType);if("webm"===d)throw new Error("Text tracks with a WEBM container are not yet handled.");return"mp4"===d?function(e,t,n,r,i){var a=n.segment,o=a.isInit,s=a.indexRange,u="string"==typeof e?(0,c.tG)(e):e instanceof Uint8Array?e:new Uint8Array(e);if(o){var l=(0,L.Wf)(u,Array.isArray(s)?s[0]:0);if(!0===i&&null!==l&&l.length>0){var d=l[l.length-1];Array.isArray(d.range)&&(d.range[1]=1/0)}return{segmentType:"init",initializationData:null,initializationDataSize:0,protectionData:[],initTimescale:(0,L.LD)(u),segmentList:null!=l?l:void 0}}var f=te(u,t,a,r),v=ae(n,u,f,t),p=(0,ee.Z)(a.timestampOffset,0);return{segmentType:"media",chunkData:v,chunkSize:u.length,chunkInfos:f,chunkOffset:p,protectionData:[],appendWindow:[n.periodStart,n.periodEnd]}}(u,l,n,r,t):function(e,t,n){var r,i,a=n.periodStart,o=n.periodEnd,s=n.segment,u=s.timestampOffset,l=void 0===u?0:u;if(s.isInit)return{segmentType:"init",initializationData:null,initializationDataSize:0,protectionData:[],initTimescale:void 0};if("string"!=typeof e){var d=e instanceof Uint8Array?e:new Uint8Array(e);r=(0,c.uR)(d),i=d.length}else r=e;return{segmentType:"media",chunkData:oe(n,r,t),chunkSize:i,chunkInfos:null,chunkOffset:l,protectionData:[],appendWindow:[a,o]}}(u,l,n)}}var ue=function(e){var t=(0,i.Z)({customManifestLoader:e.manifestLoader},null===r.Z.dashParsers.wasm||"initialized"!==r.Z.dashParsers.wasm.status&&"initializing"!==r.Z.dashParsers.wasm.status?"arraybuffer":"text"),n=f(e),a=function(e){var t=e.lowLatencyMode,n=e.segmentLoader;return!0!==e.checkMediaSegmentIntegrity?r:R(r);function r(e,r,i,a,o){var s=x(e,r.segment);return null==s?Promise.resolve({resultType:"segment-created",resultData:null}):t||void 0===n?N(s,r,t,i,o,a):new Promise((function(e,u){var l,d=!1,c={reject:function(e){var t,n;if(!d&&!a.isCancelled()){d=!0,a.deregister(h);var r=e,i=null!==(t=null==r?void 0:r.message)&&void 0!==t?t:"Unknown error when fetching a DASH segment through a custom segmentLoader.",o=new v.Z(i,null!==(n=null==r?void 0:r.canRetry)&&void 0!==n&&n,null==r?void 0:r.xhr);u(o)}},resolve:function(t){d||a.isCancelled()||(d=!0,a.deregister(h),e({resultType:"segment-loaded",resultData:{responseData:t.data,size:t.size,requestDuration:t.duration}}))},progress:function(e){d||a.isCancelled()||o.onProgress({duration:e.duration,size:e.size,totalSize:e.totalSize})},fallback:function(){d||a.isCancelled()||(d=!0,a.deregister(h),N(s,r,t,i,o,a).then(e,u))}};void 0!==r.segment.range&&(l=[r.segment.range],void 0!==r.segment.indexRange&&l.push(r.segment.indexRange));var f={isInit:r.segment.isInit,timeout:i.timeout,byteRanges:l,trackType:r.type,url:s},p=n(f,c);function h(e){d||(d=!0,"function"==typeof p&&p(),u(e))}a.register(h)}))}}(e),o=re(e),s=function(e){var t=e.lowLatencyMode;return!0!==e.checkMediaSegmentIntegrity?n:R(n);function n(e,n,r,i,a){var o=n.segment,s=o.range,u=x(e,o);if(null===u)return Promise.resolve({resultType:"segment-created",resultData:null});if(o.isInit)return M(u,o,r,i,a);var l=w(n.type,n.mimeType),c="mp4"===l||void 0===l;if(t&&c){if(E())return D(u,n,r,a,i);(0,T.Z)("DASH: Your browser does not have the fetch API. You will have a higher chance of rebuffering when playing close to the live edge")}return c?(0,d.ZP)({url:u,responseType:"arraybuffer",headers:Array.isArray(s)?{Range:(0,k.Z)(s)}:null,timeout:r.timeout,onProgress:a.onProgress,cancelSignal:i}).then((function(e){return{resultType:"segment-loaded",resultData:e}})):(0,d.ZP)({url:u,responseType:"text",headers:Array.isArray(s)?{Range:(0,k.Z)(s)}:null,timeout:r.timeout,onProgress:a.onProgress,cancelSignal:i}).then((function(e){return{resultType:"segment-loaded",resultData:e}}))}}(e);return{manifest:{loadManifest:t,parseManifest:n},audio:{loadSegment:a,parseSegment:o},video:{loadSegment:a,parseSegment:o},text:{loadSegment:s,parseSegment:se(e)}}}},5418:function(e,t,n){"use strict";n.d(t,{Z:function(){return le}});var r=n(3887),i=n(8619),a=n(6807),o=n(9665),s=n(7714),u=n(811),l=n(6968),d=n(6923),c=n(8026),f=n(9829),v=n(3635),p=n(5278),h=n(2689),m={};function g(e){if(null!=m[e])return m[e];var t=(0,v.tG)(e);return m[e]=t,t}function y(e,t){var n=t.length+8;return n<=h.s?(0,l.zo)((0,l.kh)(n),g(e),t):(0,l.zo)((0,l.kh)(1),g(e),(0,l.el)(n+8),t)}function _(e,t){return y(e,l.zo.apply(void 0,t))}function b(e){var t=[];e.periods.forEach((function(n){var i=n.id;if((0,s.Z)(t,i)){r.Z.warn("Two periods with the same ID found. Updating.");var a=i+"-dup";n.id=a,b(e),t.push(a)}else t.push(i);var o=n.adaptations,u=[];Object.keys(o).forEach((function(t){var n=o[t];void 0!==n&&n.forEach((function(t){var n=t.id;if((0,s.Z)(u,n)){r.Z.warn("Two adaptations with the same ID found. Updating.",n);var i=n+"-dup";t.id=i,b(e),u.push(i)}else u.push(n);var a=[];t.representations.forEach((function(t){var n=t.id;if((0,s.Z)(a,n)){r.Z.warn("Two representations with the same ID found. Updating.",n);var i=n+"-dup";t.id=i,b(e),a.push(i)}else a.push(n)}))}))}))}))}var S=n(9689);function E(e){return[{systemId:"edef8ba9-79d6-4ace-a3c8-27dcd51d21ed",privateData:(0,l.zo)([8,1,18,16],e)}]}function T(e,t){if(void 0===t&&(t=E),null===e.firstElementChild||"ProtectionHeader"!==e.firstElementChild.nodeName)throw new Error("Protection should have ProtectionHeader child");var n=e.firstElementChild,r=(0,S.K)(null===n.textContent?"":n.textContent),i=function(e){var t=(0,l.qb)(e,8),n=(0,v.wV)(e.subarray(10,t+10)),r=(new DOMParser).parseFromString(n,"application/xml").querySelector("KID");if(null===r)throw new Error("Cannot parse PlayReady private data: invalid XML");var i=null===r.textContent?"":r.textContent,a=(0,v.wO)((0,S.K)(i));return(0,v.ci)(a).toLowerCase()}(r),a=(0,v.nr)(i),o=n.getAttribute("SystemID");return{keyId:a,keySystems:[{systemId:(null!==o?o:"").toLowerCase().replace(/\{|\}/g,""),privateData:r}].concat(t(a))}}var k=n(9362),w=n(3911),A=n(1091);function I(e,t){return e.replace(/\{start time\}/g,String(t))}function R(e,t,n){var r=t-e;return r>0?Math.floor(r/n):0}function Z(e,t){var n=e.repeatCount;if(void 0!==e.duration&&n<0){var r=void 0!==t?t.start:1/0;n=Math.ceil((r-e.start)/e.duration)-1}return n}var x=function(){function e(e){var t=e.isLive,n=e.segmentPrivateInfos,r=e.media,i=e.sharedSmoothTimeline;if(this._sharedSmoothTimeline=i,this._initSegmentInfos={bitsPerSample:n.bitsPerSample,channels:n.channels,codecPrivateData:n.codecPrivateData,packetSize:n.packetSize,samplingRate:n.samplingRate,timescale:i.timescale,height:n.height,width:n.width,protection:n.protection},this._isLive=t,this._media=r,0!==i.timeline.length&&t){var a=i.timeline,o=i.validityTime,s=a[a.length-1],u=(0,w.jH)(s,null),l=o/1e3*i.timescale;this._scaledLiveGap=l-u}}var t=e.prototype;return t.getInitSegment=function(){return{id:"init",isInit:!0,privateInfos:{smoothInitSegment:this._initSegmentInfos},url:null,time:0,end:0,duration:0,timescale:1,complete:!0}},t.getSegments=function(e,t){this._refreshTimeline();for(var n,r=this._sharedSmoothTimeline,i=r.timescale,a=r.timeline,o=function(e,t,n){var r=void 0===e||0===e?1:e;return{up:t*r,to:(t+n)*r}}(i,e,t),s=o.up,u=o.to,l=this._media,d=[],c=a.length,f=void 0===this._scaledLiveGap?void 0:performance.now()/1e3*i-this._scaledLiveGap,v=0;v<c;v++){for(var p=a[v],h=p.duration,m=p.start,g=Z(p,a[v+1]),y=R(m,s,h),_=m+y*h,b=h;_<u&&y<=g&&(void 0===f||_+b<=f);){var S=_,E=void 0!==n?n+y:void 0,T={id:String(_),isInit:!1,time:S/i,end:(S+h)/i,duration:h/i,timescale:1,number:E,url:I(l,S),complete:!0,privateInfos:{smoothMediaSegment:{time:S,duration:h}}};d.push(T),_=m+ ++y*h}if(_>=u)return d;void 0!==n&&(n+=g+1)}return d},t.shouldRefresh=function(e,t){if(this._refreshTimeline(),!this._isLive)return!1;var n=this._sharedSmoothTimeline,r=n.timeline,i=n.timescale,a=r[r.length-1];if(void 0===a)return!1;var o=a.repeatCount,s=a.start+(o+1)*a.duration;return!(t*i<s)&&(e*i>=s||e*i>a.start+o*a.duration)},t.getFirstAvailablePosition=function(){this._refreshTimeline();var e=this._sharedSmoothTimeline,t=e.timeline,n=e.timescale;return 0===t.length?null:t[0].start/n},t.getLastAvailablePosition=function(){this._refreshTimeline();var e=this._sharedSmoothTimeline,t=e.timeline,n=e.timescale;if(void 0===this._scaledLiveGap){var r=t[t.length-1];return(0,w.jH)(r,null)/n}for(var i=t.length-1;i>=0;i--)for(var a=t[i],o=performance.now()/1e3*n,s=a.start,u=a.duration,l=a.repeatCount;l>=0;l--){var d=s+u*(l+1);if(d<=o-this._scaledLiveGap)return d/n}},t.getEnd=function(){if(!this._isLive)return this.getLastAvailablePosition()},t.awaitSegmentBetween=function(e,t){var n;if((0,u.Z)(e<=t),this.isFinished())return!1;var r=this.getLastAvailablePosition();return!(void 0!==r&&t<r)&&(t>(null!==(n=this.getFirstAvailablePosition())&&void 0!==n?n:0)&&void 0)},t.checkDiscontinuity=function(e){return this._refreshTimeline(),(0,w._j)(this._sharedSmoothTimeline,e,void 0)},t.isSegmentStillAvailable=function(e){if(e.isInit)return!0;this._refreshTimeline();var t=this._sharedSmoothTimeline,n=t.timeline,r=t.timescale;return(0,A.Z)(e,n,r,0)},t.canBeOutOfSyncError=function(e){return!!this._isLive&&(e instanceof k.Z&&(e.isHttpError(404)||e.isHttpError(412)))},t._replace=function(e){this._initialScaledLastPosition=e._initialScaledLastPosition,this._scaledLiveGap=e._scaledLiveGap,this._sharedSmoothTimeline.replace(e._sharedSmoothTimeline)},t._update=function(e){this._scaledLiveGap=e._scaledLiveGap,this._sharedSmoothTimeline.update(e._sharedSmoothTimeline)},t.isFinished=function(){return!this._isLive},t.isInitialized=function(){return!0},t.initialize=function(){r.Z.error("A `SmoothRepresentationIndex` does not need to be initialized")},t.addPredictedSegments=function(e,t){this._sharedSmoothTimeline.addPredictedSegments(e,t)},t._refreshTimeline=function(){this._sharedSmoothTimeline.refresh()},e}(),P=n(8232),M=n(5505);function C(e,t,n,r){var i=e[e.length-1],a=n.timescale===t?{time:n.time,duration:n.duration}:{time:n.time/n.timescale*t,duration:n.duration/n.timescale*t};return!(r.time===a.time)&&(a.time>=(0,w.jH)(i,null)&&(i.duration===a.duration?i.repeatCount++:e.push({duration:a.duration,start:a.time,repeatCount:0}),!0))}var D=function(){function e(e){var t=e.timeline,n=e.timescale,r=e.timeShiftBufferDepth,i=e.manifestReceivedTime;this.timeline=t,this.timescale=n;var a=null!=i?i:performance.now();if(this.validityTime=a,this._timeShiftBufferDepth=r,0!==t.length){var o=t[t.length-1],s=(0,w.jH)(o,null);this._initialScaledLastPosition=s}}var t=e.prototype;return t.refresh=function(){if(void 0!==this._initialScaledLastPosition){var e=this._timeShiftBufferDepth,t=(performance.now()-this.validityTime)/1e3+this._initialScaledLastPosition/this.timescale;if(void 0!==e){var n=(t-e)*this.timescale;(0,P.Z)(this.timeline,n)}}},t.replace=function(e){var t=this.timeline,n=e.timeline,i=this.timescale,a=e.timescale;if(this._initialScaledLastPosition=e._initialScaledLastPosition,this.validityTime=e.validityTime,0!==t.length&&0!==n.length&&i===a){var o=t[t.length-1],s=n[n.length-1],u=(0,w.jH)(s,null);if(!((0,w.jH)(o,null)<=u))for(var l=0;l<t.length;l++){var d=t[l],c=(0,w.jH)(d,null);if(c===u)return void(this.timeline=this.timeline.concat(t.slice(l+1)));if(c>u){if(d.duration!==s.duration)return;var f=u-d.start;if(0===f)return r.Z.warn("Smooth Parser: a discontinuity detected in the previous manifest has been resolved."),void(this.timeline=this.timeline.concat(t.slice(l)));if(f<0||f%d.duration!=0)return;var v=f/d.duration-1,p=d.repeatCount-v;if(p<0)return;s.repeatCount+=p;var h=t.slice(l+1);return void(this.timeline=this.timeline.concat(h))}}}},t.update=function(e){(0,M.Z)(this.timeline,e.timeline),this._initialScaledLastPosition=e._initialScaledLastPosition,this.validityTime=e.validityTime},t.addPredictedSegments=function(e,t){var n;if(void 0!==(null===(n=t.privateInfos)||void 0===n?void 0:n.smoothMediaSegment)){this.refresh();for(var i=0;i<e.length;i++)C(this.timeline,this.timescale,e[i],t.privateInfos.smoothMediaSegment)}else r.Z.warn("Smooth Parser: should only encounter SmoothRepresentationIndex")},e}();function N(e,t,n){for(var r=e.firstElementChild,i=n;null!==r;)i=t(i,r.nodeName,r),r=r.nextElementSibling;return i}var O={audio:"audio/mp4",video:"video/mp4",text:"application/ttml+xml"},L={AACL:"audio/mp4",AVC1:"video/mp4",H264:"video/mp4",TTML:"application/ttml+xml+mp4",DFXP:"application/ttml+xml+mp4"};var U=function(e){void 0===e&&(e={});var t=void 0===e.referenceDateTime?Date.UTC(1970,0,1,0,0,0,0)/1e3:e.referenceDateTime,n=void 0===e.minRepresentationBitrate?0:e.minRepresentationBitrate,i=e.serverSyncInfos,a=void 0!==i?i.serverTimestamp-i.clientTime:void 0;function h(e,t){var n=N(e,(function(e,t,n){return"CustomAttributes"===t&&e.push.apply(e,N(n,(function(e,t,n){if("Attribute"===t){var r=n.getAttribute("Name"),i=n.getAttribute("Value");null!==r&&null!==i&&e.push(r+"="+i)}return e}),[])),e}),[]);function i(t){var n=e.getAttribute(t);return null==n?void 0:n}switch(t){case"audio":var a=i("AudioTag"),o=i("BitsPerSample"),s=i("Channels"),u=i("CodecPrivateData"),l=i("FourCC"),c=i("PacketSize"),f=i("SamplingRate"),v=i("Bitrate"),h=void 0===v||isNaN(parseInt(v,10))?0:parseInt(v,10);if(void 0!==l&&void 0===L[l]||void 0===u)return r.Z.warn("Smooth parser: Unsupported audio codec. Ignoring quality level."),null;var m=function(e,t){var n;return 0==(n="AACH"===t?5:(0,d.Z)(e)?(248&parseInt(e.substring(0,2),16))>>3:2)?"mp4a.40.2":"mp4a.40."+n}(u,l);return{audiotag:void 0!==a?parseInt(a,10):a,bitrate:h,bitsPerSample:void 0!==o?parseInt(o,10):o,channels:void 0!==s?parseInt(s,10):s,codecPrivateData:u,codecs:m,customAttributes:n,mimeType:void 0!==l?L[l]:l,packetSize:void 0!==c?parseInt(c,10):c,samplingRate:void 0!==f?parseInt(f,10):f};case"video":var g=i("CodecPrivateData"),y=i("FourCC"),_=i("MaxWidth"),b=i("MaxHeight"),S=i("Bitrate"),E=void 0===S||isNaN(parseInt(S,10))?0:parseInt(S,10);if(void 0!==y&&void 0===L[y]||void 0===g)return r.Z.warn("Smooth parser: Unsupported video codec. Ignoring quality level."),null;var T=function(e){var t=/00000001\d7([0-9a-fA-F]{6})/.exec(e);return null!==t&&(0,d.Z)(t[1])?"avc1."+t[1]:"avc1.4D401E"}(g);return{bitrate:E,customAttributes:n,mimeType:void 0!==y?L[y]:y,codecPrivateData:g,codecs:T,width:void 0!==_?parseInt(_,10):void 0,height:void 0!==b?parseInt(b,10):void 0};case"text":var k=i("CodecPrivateData"),w=i("FourCC"),A=i("Bitrate");return{bitrate:void 0===A||isNaN(parseInt(A,10))?0:parseInt(A,10),customAttributes:n,mimeType:void 0!==w?L[w]:w,codecPrivateData:(0,p.Z)(k,"")};default:return r.Z.error("Smooth Parser: Unrecognized StreamIndex type: "+t),null}}function m(e){var t=e.root,i=e.timescale,a=e.baseUrl,f=e.protections,p=e.timeShiftBufferDepth,m=e.manifestReceivedTime,g=e.isLive,_=t.getAttribute("Timescale"),b=null===_||isNaN(+_)?i:+_,S=t.getAttribute("Type");if(null===S)throw new Error("StreamIndex without type.");(0,s.Z)(o.r,S)||r.Z.warn("Smooth Parser: Unrecognized adaptation type:",S);var E=S,T=t.getAttribute("Subtype"),k=t.getAttribute("Language"),w=t.getAttribute("Url"),A=null===w?"":w;var I,R=N(t,(function(e,t,r){switch(t){case"QualityLevel":var i=h(r,E);if(null===i)return e;("video"!==E||i.bitrate>n)&&e.qualityLevels.push(i);break;case"c":e.cNodes.push(r)}return e}),{qualityLevels:[],cNodes:[]}),Z=R.qualityLevels,P=R.cNodes,M=new D({timeline:(I=P,I.reduce((function(e,t,n){var r=t.getAttribute("d"),i=t.getAttribute("t"),a=t.getAttribute("r"),o=null!==a?+a-1:0,s=null!==i?+i:void 0,u=null!==r?+r:void 0;if(0===n)s=void 0===s||isNaN(s)?0:s;else{var l=e[n-1];if(null==s||isNaN(s)){if(null==l.duration||isNaN(l.duration))throw new Error("Smooth: Invalid CNodes. Missing timestamp.");s=l.start+l.duration*(l.repeatCount+1)}}if(null==u||isNaN(u)){var c=I[n+1];if(void 0===c)return e;var f=c.getAttribute("t"),v=(0,d.Z)(f)?+f:null;if(null===v)throw new Error("Can't build index timeline from Smooth Manifest.");u=v-s}return e.push({duration:u,start:s,repeatCount:o}),e}),[])),timescale:b,timeShiftBufferDepth:p,manifestReceivedTime:m});(0,u.Z)(0!==Z.length,"Adaptation should have at least one playable representation.");var C=E+((0,d.Z)(k)?"_"+k:""),L=Z.map((function(e){var t,n,r,i,o=(t=A,n=e.bitrate,r=e.customAttributes,t.replace(/\{bitrate\}/g,String(n)).replace(/{CustomAttributes}/g,r.length>0?r[0]:"")),s=(0,d.Z)(e.mimeType)?e.mimeType:O[E],u=e.codecs,p=C+"_"+(null!=E?E+"-":"")+(null!=s?s+"-":"")+(null!=u?u+"-":"")+String(e.bitrate),h=[];f.length>0&&(i=f[0],f.forEach((function(e){var t=e.keyId;e.keySystems.forEach((function(e){h.push({keyId:t,systemId:e.systemId})}))})));var m={bitsPerSample:e.bitsPerSample,channels:e.channels,codecPrivateData:e.codecPrivateData,packetSize:e.packetSize,samplingRate:e.samplingRate,height:e.height,width:e.width,protection:null!=i?{keyId:i.keyId}:void 0},_=new x({isLive:g,sharedSmoothTimeline:M,media:o,segmentPrivateInfos:m}),b=(0,c.Z)({},e,{index:_,cdnMetadata:[{baseUrl:a}],mimeType:s,codecs:u,id:p});if(h.length>0||void 0!==i){var S=void 0===i?[]:i.keySystems.map((function(e){var t=e.systemId,n=e.privateData,r=t.replace(/-/g,""),i=function(e,t){if(32!==e.length)throw new Error("HSS: wrong system id length");var n=0;return y("pssh",(0,l.zo)([n,0,0,0],(0,v.nr)(e),(0,l.kh)(t.length),t))}(r,n);return{systemId:r,data:i}}));if(S.length>0){var T=[{type:"cenc",values:S}];b.contentProtections={keyIds:h,initData:T}}else b.contentProtections={keyIds:h,initData:[]}}return b}));if("ADVT"===T)return null;var U={id:C,type:E,representations:L,language:null==k?void 0:k};return"text"===E&&"DESC"===T&&(U.closedCaption=!0),U}return function(n,r,i){var o="";if(void 0!==r){var s=(0,f.$)(r);o=r.substring(0,s)}var u=n.documentElement;if(null==u||"SmoothStreamingMedia"!==u.nodeName)throw new Error("document root should be SmoothStreamingMedia");var l=u.getAttribute("MajorVersion"),c=u.getAttribute("MinorVersion");if(null===l||null===c||!/^[2]-[0-2]$/.test(l+"-"+c))throw new Error("Version should be 2.0, 2.1 or 2.2");var v,p,h=u.getAttribute("Timescale"),g=(0,d.Z)(h)?isNaN(+h)?1e7:+h:1e7,y=N(u,(function(t,n,r){switch(n){case"Protection":t.protections.push(T(r,e.keySystems));break;case"StreamIndex":t.adaptationNodes.push(r)}return t}),{adaptationNodes:[],protections:[]}),_=y.protections,S=y.adaptationNodes,E="boolean"==typeof(v=u.getAttribute("IsLive"))?v:"string"==typeof v&&"TRUE"===v.toUpperCase();if(E){var k=u.getAttribute("DVRWindowLength");null==k||isNaN(+k)||0==+k||(p=+k/g)}var w,A,I,R,Z,x,P,M=S.reduce((function(e,t){var n=m({root:t,baseUrl:o,timescale:g,protections:_,isLive:E,timeShiftBufferDepth:p,manifestReceivedTime:i});if(null===n)return e;var r=n.type,a=e[r];return void 0===a?e[r]=[n]:a.push(n),e}),{}),C=null,D=void 0!==M.video?M.video[0]:void 0,O=void 0!==M.audio?M.audio[0]:void 0;if(void 0!==D||void 0!==O){var L=[],U=[];if(void 0!==D){var B=D.representations[0];if(void 0!==B){var F=B.index.getFirstAvailablePosition(),z=B.index.getLastAvailablePosition();null!=F&&L.push(F),null!=z&&U.push(z)}}if(void 0!==O){var V=O.representations[0];if(void 0!==V){var K=V.index.getFirstAvailablePosition(),G=V.index.getLastAvailablePosition();null!=K&&L.push(K),null!=G&&U.push(G)}}L.length>0&&(Z=Math.max.apply(Math,L)),U.length>0&&(x=Math.min.apply(Math,U),P=Math.max.apply(Math,U))}var j=u.getAttribute("Duration"),H=null!==j&&0!=+j?+j/g:void 0;if(E){w=e.suggestedPresentationDelay,A=t,I=null!=Z?Z:A;var W=P;void 0===W&&(W=Date.now()/1e3-A);var q=x;void 0===q&&(q=W),R={isLinear:!0,maximumSafePosition:q,livePosition:W,time:performance.now()},C=null!=p?p:null}else{I=null!=Z?Z:0,R={isLinear:!1,maximumSafePosition:void 0!==x?x:void 0!==H?I+H:1/0,livePosition:void 0,time:performance.now()}}var Y=E?0:I,X=E?void 0:R.maximumSafePosition,Q={availabilityStartTime:void 0===A?0:A,clockOffset:a,isLive:E,isDynamic:E,isLastPeriodKnown:!0,timeBounds:{minimumSafePosition:I,timeshiftDepth:C,maximumTimeData:R},periods:[{adaptations:M,duration:void 0!==X?X-Y:H,end:X,id:"gen-smooth-period-0",start:Y}],suggestedPresentationDelay:w,transportType:"smooth",uris:null==r?[]:[r]};return b(Q),Q}},B=U,F=n(4597),z=n(4460),V=n(8791),K=n(4644),G=n(2297);function j(e,t,n,i,o){var s,u,d,c=[];if(o){var f=(0,a.XA)(e);null!==f?(d=function(e){var t=(0,G.nR)(e,3565190898,3392751253,2387879627,2655430559);if(void 0===t)return[];for(var n=[],r=t[0],i=t[4],a=0;a<i;a++){var o=void 0,s=void 0;1===r?(s=(0,l.pV)(t,16*a+5),o=(0,l.pV)(t,16*a+5+8)):(s=(0,l.pX)(t,8*a+5),o=(0,l.pX)(t,8*a+5+4)),n.push({time:s,duration:o})}return n}(f),u=function(e){var t=(0,G.nR)(e,1830656773,1121273062,2162299933,2952222642);if(void 0!==t)return{duration:(0,l.pV)(t,12),time:(0,l.pV)(t,4)}}(f)):r.Z.warn("smooth: could not find traf atom")}if(void 0!==d)for(var v=0;v<d.length;v++)c.push({time:d[v].time,duration:d[v].duration,timescale:n});if(void 0!==u)return{nextSegments:c,chunkInfos:{time:u.time/n,duration:u.duration/n},scaledSegmentTime:u.time};if(t||!i.complete)return{nextSegments:c,chunkInfos:null,scaledSegmentTime:void 0};var p=i.duration*n,h=Math.min(.9*n,p/4),m=(0,K.MM)(e),g=void 0!==(null===(s=i.privateInfos)||void 0===s?void 0:s.smoothMediaSegment)?i.privateInfos.smoothMediaSegment.time:Math.round(i.time*n);return{nextSegments:c,chunkInfos:void 0!==m&&Math.abs(m-p)<=h?{time:i.time,duration:m/n}:{time:i.time,duration:i.duration},scaledSegmentTime:g}}function H(e){return"string"==typeof e&&e.indexOf("mp4")>=0}var W=n(3666);function q(e,t){return y("schm",(0,l.zo)(4,(0,v.tG)(e),(0,l.kh)(t)))}function Y(e){return y("frma",(0,v.tG)(e))}function X(e){var t=[7,[e.length]];return y("stsd",l.zo.apply(void 0,t.concat(e)))}function Q(e,t,n){return y("tenc",(0,l.zo)(6,[e,t],n))}function $(e,t,n,r,i){var a=[e,t,n];return void 0!==i&&a.push(y("senc",i),function(e){if(0===e.length)return y("saiz",new Uint8Array(0));var t=(0,l.pX)(e,0),n=(0,l.pX)(e,4),r=new Uint8Array(n+9);r.set((0,l.kh)(n),5);for(var i,a,o=9,s=8;s<e.length;)s+=8,2==(2&t)?(a=2,s+=6*(i=(0,l.zK)(e,s))+2):(i=0,a=0),r[o]=6*i+8+a,o++;return y("saiz",r)}(i),function(e,t,n,r){return y("saio",(0,l.zo)(4,[0,0,0,1],(0,l.kh)(e.length+t.length+n.length+r.length+8+8+8+8)))}(r,e,t,n)),_("traf",a)}function J(e,t){var n=(0,G.Qy)(e,1836019558);if(null===n)throw new Error("Smooth: Invalid ISOBMFF given");var r=e.subarray(n[1],n[2]),i=(0,G.iz)(r,1835427940),a=(0,G.t_)(r,1953653094);if(null===a||null===i)throw new Error("Smooth: Invalid ISOBMFF given");var o=(0,G.Qy)(a,1952868452),s=(0,G.Qy)(a,1953658222);if(null===o||null===s)throw new Error("Smooth: Invalid ISOBMFF given");var u=a.subarray(o[0],o[2]),d=a.subarray(s[0],s[2]);u.set([0,0,0,1],o[1]-o[0]+4);var c=function(e){return y("tfdt",(0,l.zo)([1,0,0,0],(0,l.el)(e)))}(t),f=function(e,t){var n=(1&e[t+3])>0;if(n)return e;var r=new Uint8Array(e.length+4);return r.set(e.subarray(0,t+8),0),r[t+3]=1|r[t+3],r.set([0,0,0,0],t+8),r.set(e.subarray(t+8,e.length),t+12),(0,K.J6)(r)}(d,s[1]-s[0]),v=$(u,c,f,i,(0,G.nR)(a,2721664850,1520127764,2722393154,2086964724)),p=_("moof",[i,v]),h=(0,G.Qy)(p,1836019558),m=(0,G.Qy)(v,1953653094),g=(0,G.Qy)(f,1953658222);if(null===h||null===m||null===g)throw new Error("Smooth: Invalid moof, trun or traf generation");var b=h[1]-h[0]+i.length+(m[1]-m[0])+u.length+c.length+(g[1]-g[0])+8,S=n[2]-n[0],E=p.length-S,T=(0,G.Qy)(e,1835295092);if(null===T)throw new Error("Smooth: Invalid ISOBMFF given");if(!W.YM&&(0===E||E<=-8)){var k=T[1];return p.set((0,l.kh)(k),b),e.set(p,n[0]),E<=-8&&e.set(y("free",new Uint8Array(-E-8)),p.length),e}var w=T[1]+E;p.set((0,l.kh)(w),b);var A=new Uint8Array(e.length+E),I=e.subarray(0,n[0]),R=e.subarray(n[2],e.length);return A.set(I,0),A.set(p,I.length),A.set(R,I.length+p.length),A}var ee=n(7839),te=n(281);function ne(e,t,n,r,i,a){var o,s,u,d=_("stbl",[n,y("stts",new Uint8Array(8)),y("stsc",new Uint8Array(8)),y("stsz",new Uint8Array(12)),y("stco",new Uint8Array(8))]),c=function(e){return y("dref",(0,l.zo)(7,[1],e))}(y("url ",new Uint8Array([0,0,0,1]))),f=_("dinf",[c]),p=_("minf",[r,f,d]),h=function(e){var t,n;switch(e){case"video":t="vide",n="VideoHandler";break;case"audio":t="soun",n="SoundHandler";break;default:t="hint",n=""}return y("hdlr",(0,l.zo)(8,(0,v.tG)(t),12,(0,v.tG)(n),1))}(t),m=function(e){return y("mdhd",(0,l.zo)(12,(0,l.kh)(e),8))}(e),g=_("mdia",[m,h,p]),b=function(e,t,n){return y("tkhd",(0,l.zo)((0,l.kh)(7),8,(0,l.kh)(n),20,[1,0,0,0],[0,1,0,0],12,[0,1,0,0],12,[64,0,0,0],(0,l.XT)(e),2,(0,l.XT)(t),2))}(i,a,1),S=_("trak",[b,g]),E=_("mvex",[(o=1,y("trex",(0,l.zo)(4,(0,l.kh)(o),[0,0,0,1],12)))]),T=function(e,t){return y("mvhd",(0,l.zo)(12,(0,l.kh)(e),4,[0,1],2,[1,0],10,[0,1],14,[0,1],14,[64,0,0,0],26,(0,l.XT)(t+1)))}(e,1),k=function(e,t,n){return _("moov",[e,t,n])}(T,E,S),w=(s="isom",u=["isom","iso2","iso6","avc1","dash"],y("ftyp",l.zo.apply(void 0,[(0,v.tG)(s),[0,0,0,1]].concat(u.map(v.tG)))));return(0,l.zo)(w,k)}function re(e,t,n,r,i,a,o,s){var u=o.split("00000001"),d=u[1],c=u[2];if(void 0===d||void 0===c)throw new Error("Smooth: unsupported codec private data.");var f,p,h=function(e,t,n){var r=2===n?1:4===n?3:0,i=e[1],a=e[2],o=e[3];return y("avcC",(0,l.zo)([1,i,a,o,252|r,225],(0,l.XT)(e.length),e,[1],(0,l.XT)(t.length),t))}((0,v.nr)(d),(0,v.nr)(c),a);if(void 0===s){var m=function(e,t,n,r,i,a,o){return y("avc1",(0,l.zo)(6,(0,l.XT)(1),16,(0,l.XT)(e),(0,l.XT)(t),(0,l.XT)(n),2,(0,l.XT)(r),6,[0,1,i.length],(0,v.tG)(i),31-i.length,(0,l.XT)(a),[255,255],o))}(t,n,r,i,"AVC Coding",24,h);f=X([m])}else{var g=_("schi",[Q(1,8,s)]),b=q("cenc",65536),S=function(e,t,n,r,i,a,o,s){return y("encv",(0,l.zo)(6,(0,l.XT)(1),16,(0,l.XT)(e),(0,l.XT)(t),(0,l.XT)(n),2,(0,l.XT)(r),6,[0,1,i.length],(0,v.tG)(i),31-i.length,(0,l.XT)(a),[255,255],o,s))}(t,n,r,i,"AVC Coding",24,h,_("sinf",[Y("avc1"),b,g]));f=X([S])}return ne(e,"video",f,((p=new Uint8Array(12))[3]=1,y("vmhd",p)),t,n)}var ie=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];function ae(e,t,n,r,i,a,o){var s,u,d,c=function(e,t){return y("esds",(0,l.zo)(4,[3,25],(0,l.XT)(e),[0,4,17,64,21],11,[5,2],(0,v.nr)(t),[6,1,2]))}(1,0===a.length?(s=i,u=t,d=((d=((d=(63&2)<<4)|31&ie.indexOf(s))<<4)|31&u)<<3,(0,v.ci)((0,l.XT)(d))):a),f=function(){if(void 0===o){var e=function(e,t,n,r,i,a){return y("mp4a",(0,l.zo)(6,(0,l.XT)(e),8,(0,l.XT)(t),(0,l.XT)(n),2,(0,l.XT)(r),(0,l.XT)(i),2,a))}(1,t,n,r,i,c);return X([e])}var a=_("schi",[Q(1,8,o)]),s=q("cenc",65536),u=_("sinf",[Y("mp4a"),s,a]),d=function(e,t,n,r,i,a,o){return y("enca",(0,l.zo)(6,(0,l.XT)(e),8,(0,l.XT)(t),(0,l.XT)(n),2,(0,l.XT)(r),(0,l.XT)(i),2,a,o))}(1,t,n,r,i,c,u);return X([d])}();return ne(e,"audio",f,y("smhd",new Uint8Array(8)),0,0)}function oe(e,t,n,r,i,a){var o,s=t.segment.range;return Array.isArray(s)&&(o={Range:(0,te.Z)(s)}),(0,F.ZP)({url:e,responseType:"arraybuffer",headers:o,timeout:r.timeout,cancelSignal:i,onProgress:n.onProgress}).then((function(e){if(!H(t.mimeType)||!0!==a)return{resultType:"segment-loaded",resultData:e};var n=new Uint8Array(e.responseData);return(0,z.Z)(n,t.segment.isInit),{resultType:"segment-loaded",resultData:Object.assign(Object.assign({},e),{responseData:n})}}))}var se=function(e){var t=e.checkMediaSegmentIntegrity,n=e.customSegmentLoader;return function(e,r,i,a,o){var s=r.segment;if(s.isInit){if(void 0===s.privateInfos||void 0===s.privateInfos.smoothInitSegment)throw new Error("Smooth: Invalid segment format");var u,l=s.privateInfos.smoothInitSegment,d=l.codecPrivateData,c=l.timescale,f=l.height,v=l.width,p=l.protection,h=void 0===p?{keyId:void 0,keySystems:void 0}:p;if(void 0===d)throw new Error("Smooth: no codec private data.");switch(r.type){case"video":u=re(c,null!=v?v:0,null!=f?f:0,72,72,4,d,h.keyId);break;case"audio":var m=l.channels,g=void 0===m?0:m,y=l.bitsPerSample,_=void 0===y?0:y,b=l.packetSize,S=void 0===b?0:b,E=l.samplingRate;u=ae(c,g,_,S,void 0===E?0:E,d,h.keyId);break;default:0,u=new Uint8Array(0)}return Promise.resolve({resultType:"segment-created",resultData:u})}return null===e?Promise.resolve({resultType:"segment-created",resultData:null}):"function"!=typeof n?oe(e,r,o,i,a,t):new Promise((function(s,u){var l,d=!1,c={reject:function(e){var t,n;if(!d&&!a.isCancelled()){d=!0,a.deregister(p);var r=e,i=null!==(t=null==r?void 0:r.message)&&void 0!==t?t:"Unknown error when fetching a Smooth segment through a custom segmentLoader.",o=new ee.Z(i,null!==(n=null==r?void 0:r.canRetry)&&void 0!==n&&n,null==r?void 0:r.xhr);u(o)}},resolve:function(e){if(!d&&!a.isCancelled()){d=!0,a.deregister(p),H(r.mimeType)&&!0===t||s({resultType:"segment-loaded",resultData:{responseData:e.data,size:e.size,requestDuration:e.duration}});var n=e.data instanceof Uint8Array?e.data:new Uint8Array(e.data);(0,z.Z)(n,r.segment.isInit),s({resultType:"segment-loaded",resultData:{responseData:n,size:e.size,requestDuration:e.duration}})}},fallback:function(){d||a.isCancelled()||(d=!0,a.deregister(p),oe(e,r,o,i,a,t).then(s,u))},progress:function(e){d||a.isCancelled()||o.onProgress({duration:e.duration,size:e.size,totalSize:e.totalSize})}};void 0!==r.segment.range&&(l=[r.segment.range],void 0!==r.segment.indexRange&&l.push(r.segment.indexRange));var f={isInit:r.segment.isInit,timeout:i.timeout,byteRanges:l,trackType:r.type,url:e},v=n(f,c);function p(e){d||((d=!0)||"function"!=typeof v||v(),u(e))}a.register(p)}))}};function ue(e,t){return null===e?null:null===t.url?e.baseUrl:(0,f.Z)(e.baseUrl,t.url)}var le=function(e){var t=B(e),n=se(e),o={customManifestLoader:e.manifestLoader},s={loadSegment:function(e,t,r,i,a){var o=ue(e,t.segment);return n(o,t,r,i,a)},parseSegment:function(e,t,n){var r,i,a=t.segment,o=e.data,s=e.isChunked;if(null===o)return a.isInit?{segmentType:"init",initializationData:null,initializationDataSize:0,protectionData:[],initTimescale:void 0}:{segmentType:"media",chunkData:null,chunkInfos:null,chunkOffset:0,chunkSize:0,protectionData:[],appendWindow:[void 0,void 0]};var u=o instanceof Uint8Array?o:new Uint8Array(o);if(a.isInit){var l=null===(i=null===(r=a.privateInfos)||void 0===r?void 0:r.smoothInitSegment)||void 0===i?void 0:i.timescale;return{segmentType:"init",initializationData:o,initializationDataSize:o.byteLength,initTimescale:l,protectionData:[]}}var d=void 0!==n?j(u,s,n,a,t.isLive):null;if(null===d||null===d.chunkInfos||void 0===d.scaledSegmentTime)throw new Error("Smooth Segment without time information");var c=d.nextSegments,f=d.chunkInfos,v=J(u,d.scaledSegmentTime),p=c.length>0?c:void 0;return{segmentType:"media",chunkData:v,chunkInfos:f,chunkOffset:0,chunkSize:v.length,protectionData:[],predictedSegments:p,appendWindow:[void 0,void 0]}}};return{manifest:{loadManifest:(0,V.Z)(o,"text"),parseManifest:function(n,r){var a,o=null!==(a=n.url)&&void 0!==a?a:r.originalUrl,s=n.receivedTime,u=n.responseData,l="string"==typeof u?(new DOMParser).parseFromString(u,"text/xml"):u,d=t(l,o,s);return{manifest:new i.ZP(d,{representationFilter:e.representationFilter}),url:o}}},audio:s,video:s,text:{loadSegment:function(t,n,r,i,a){var o=n.segment,s=ue(t,o);return o.isInit||null===s?Promise.resolve({resultType:"segment-created",resultData:null}):H(n.mimeType)?(0,F.ZP)({url:s,responseType:"arraybuffer",timeout:r.timeout,cancelSignal:i,onProgress:a.onProgress}).then((function(t){if(!0!==e.checkMediaSegmentIntegrity)return{resultType:"segment-loaded",resultData:t};var r=new Uint8Array(t.responseData);return(0,z.Z)(r,n.segment.isInit),{resultType:"segment-loaded",resultData:Object.assign(Object.assign({},t),{responseData:r})}})):(0,F.ZP)({url:s,responseType:"text",timeout:r.timeout,cancelSignal:i,onProgress:a.onProgress}).then((function(e){return{resultType:"segment-loaded",resultData:e}}))},parseSegment:function(e,t,n){var i,o,s,u=t.segment,l=t.language,d=t.mimeType,c=void 0===d?"":d,f=t.codecs,p=void 0===f?"":f,h=H(t.mimeType),m=e.data,g=e.isChunked;if(u.isInit)return{segmentType:"init",initializationData:null,initializationDataSize:0,protectionData:[],initTimescale:void 0};if(null===m)return{segmentType:"media",chunkData:null,chunkInfos:null,chunkOffset:0,chunkSize:0,protectionData:[],appendWindow:[void 0,void 0]};var y,_,b,S,E=null;if(h){var T;o=(T="string"==typeof m?(0,v.tG)(m):m instanceof Uint8Array?m:new Uint8Array(m)).length;var k=void 0!==n?j(T,g,n,u,t.isLive):null;s=null==k?void 0:k.nextSegments,null===(E=null!==(i=null==k?void 0:k.chunkInfos)&&void 0!==i?i:null)?g?r.Z.warn("Smooth: Unavailable time data for current text track."):(y=u.time,_=u.end):(y=E.time,_=void 0!==E.duration?E.time+E.duration:u.end);var w=p.toLowerCase();if("application/ttml+xml+mp4"===c||"stpp"===w||"stpp.ttml.im1t"===w)S="ttml";else{if("wvtt"!==w)throw new Error("could not find a text-track parser for the type "+c);S="vtt"}var A=(0,a.Le)(T);b=null===A?"":(0,v.uR)(A)}else{var I;if(y=u.time,_=u.end,"string"!=typeof m){var R=m instanceof Uint8Array?m:new Uint8Array(m);o=R.length,I=(0,v.uR)(R)}else I=m;switch(c){case"application/x-sami":case"application/smil":S="sami";break;case"application/ttml+xml":S="ttml";break;case"text/vtt":S="vtt"}if(void 0===S){if("srt"!==p.toLowerCase())throw new Error("could not find a text-track parser for the type "+c);S="srt"}b=I}return{segmentType:"media",chunkData:{type:S,data:b,start:y,end:_,language:l},chunkSize:o,chunkInfos:E,chunkOffset:null!=y?y:0,protectionData:[],predictedSegments:Array.isArray(s)&&s.length>0?s:void 0,appendWindow:[void 0,void 0]}}}}}},281:function(e,t,n){"use strict";function r(e){var t=e[0],n=e[1];return n===1/0?"bytes="+t+"-":"bytes="+t+"-"+n}n.d(t,{Z:function(){return r}})},4460:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(5389),i=n(8766);function a(e,t){if(t){if((0,i.Z)(e,1718909296)<0)throw new r.Z("INTEGRITY_ERROR","Incomplete `ftyp` box");if((0,i.Z)(e,1836019574)<0)throw new r.Z("INTEGRITY_ERROR","Incomplete `moov` box")}else{if((0,i.Z)(e,1836019558)<0)throw new r.Z("INTEGRITY_ERROR","Incomplete `moof` box");if((0,i.Z)(e,1835295092)<0)throw new r.Z("INTEGRITY_ERROR","Incomplete `mdat` box")}}},8766:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(6968);function i(e,t){for(var n=e.length,i=0;i+8<=n;){var a=(0,r.pX)(e,i);if(0===a)a=n-i;else if(1===a){if(i+16>n)return-1;a=(0,r.pV)(e,i+8)}if(isNaN(a)||a<=0)return-1;if((0,r.pX)(e,i+4)===t)return i+a<=n?i:-1;i+=a}return-1}},8791:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var r=n(7904),i=n(4597),a=n(7839);function o(e,t){var n=e.customManifestLoader,o=function(e){return function(t,n,a){if(void 0===t)throw new Error("Cannot perform HTTP(s) request. URL not known");switch(e){case"arraybuffer":return(0,i.ZP)({url:t,responseType:"arraybuffer",timeout:n.timeout,cancelSignal:a});case"text":return(0,i.ZP)({url:t,responseType:"text",timeout:n.timeout,cancelSignal:a});case"document":return(0,i.ZP)({url:t,responseType:"document",timeout:n.timeout,cancelSignal:a});default:(0,r.Z)(e)}}}(t);return"function"!=typeof n?o:function(e,t){return function(n,r,i){return new Promise((function(o,s){var u=Date.now()-performance.now(),l=!1,d={reject:function(e){var t,n;if(!l&&!i.isCancelled()){l=!0,i.deregister(f);var r=e,o=null!==(t=null==r?void 0:r.message)&&void 0!==t?t:"Unknown error when fetching the Manifest through a custom manifestLoader.",u=new a.Z(o,null!==(n=null==r?void 0:r.canRetry)&&void 0!==n&&n,null==r?void 0:r.xhr);s(u)}},resolve:function(e){if(!l&&!i.isCancelled()){l=!0,i.deregister(f);var t=void 0!==e.receivingTime?e.receivingTime-u:void 0,n=void 0!==e.sendingTime?e.sendingTime-u:void 0;o({responseData:e.data,size:e.size,requestDuration:e.duration,url:e.url,receivedTime:t,sendingTime:n})}},fallback:function(){l||i.isCancelled()||(l=!0,i.deregister(f),t(n,r,i).then(o,s))}},c=e({url:n,timeout:r.timeout},d);function f(e){l||(l=!0,"function"==typeof c&&c(),s(e))}i.register(f)}))}}(n,o)}},4791:function(e,t,n){"use strict";function r(e,t){if(e.length!==t.length)return!1;for(var n=e.length-1;n>=0;n--)if(e[n]!==t[n])return!1;return!0}n.d(t,{Z:function(){return r}})},3274:function(e,t,n){"use strict";function r(e,t,n){if("function"==typeof Array.prototype.find)return e.find(t,n);for(var r=e.length>>>0,i=0;i<r;i++){var a=e[i];if(t.call(n,a,i,e))return a}}n.d(t,{Z:function(){return r}})},5138:function(e,t,n){"use strict";function r(e,t,n){if("function"==typeof Array.prototype.findIndex)return e.findIndex(t,n);for(var r=e.length>>>0,i=0;i<r;i++)if(t.call(n,e[i],i,e))return i;return-1}n.d(t,{Z:function(){return r}})},7714:function(e,t,n){"use strict";function r(e,t,n){if("function"==typeof Array.prototype.includes)return e.includes(t,n);var r=e.length>>>0;if(0===r)return!1;for(var i,a,o=0|n,s=o>=0?Math.min(o,r-1):Math.max(r+o,0);s<r;){if((i=e[s])===(a=t)||"number"==typeof i&&"number"==typeof a&&isNaN(i)&&isNaN(a))return!0;s++}return!1}n.d(t,{Z:function(){return r}})},811:function(e,t,n){"use strict";n.d(t,{Z:function(){return i},u:function(){return a}});var r=n(1946);function i(e,t){0}function a(e,t,n){for(var a in void 0===n&&(n="object"),i((0,r.Z)(e)),t)t.hasOwnProperty(a)&&i((e[a],t[a]),t[a])}},7904:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var r=n(7326),i=n(4578),a=function(e){function t(n){var i;return i=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(i),t.prototype),i.name="AssertionError",i.message=n,i}return(0,i.Z)(t,e),t}((0,n(2146).Z)(Error));function o(e){throw new a("Unreachable path taken")}},9689:function(e,t,n){"use strict";n.d(t,{J:function(){return s},K:function(){return u}});var r=n(3887),i=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9","+","/"],a=[255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,62,255,255,255,63,52,53,54,55,56,57,58,59,60,61,255,255,255,0,255,255,255,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,255,255,255,255,255,255,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51];function o(e){if(e>=a.length)throw new Error("Unable to parse base64 string.");var t=a[e];if(255===t)throw new Error("Unable to parse base64 string.");return t}function s(e){var t,n="",r=e.length;for(t=2;t<r;t+=3)n+=i[e[t-2]>>2],n+=i[(3&e[t-2])<<4|e[t-1]>>4],n+=i[(15&e[t-1])<<2|e[t]>>6],n+=i[63&e[t]];return t===r+1&&(n+=i[e[t-2]>>2],n+=i[(3&e[t-2])<<4],n+="=="),t===r&&(n+=i[e[t-2]>>2],n+=i[(3&e[t-2])<<4|e[t-1]>>4],n+=i[(15&e[t-1])<<2],n+="="),n}function u(e){var t=e.length%4,n=e;0!==t&&(r.Z.warn("base64ToBytes: base64 given miss padding"),n+=3===t?"=":2===t?"==":"===");var i=n.indexOf("=");if(-1!==i&&i<n.length-2)throw new Error("Unable to parse base64 string.");for(var a,s=n.endsWith("==")?2:n.endsWith("=")?1:0,u=n.length,l=new Uint8Array(u/4*3),d=0,c=0;d<u;d+=4,c+=3)a=o(n.charCodeAt(d))<<18|o(n.charCodeAt(d+1))<<12|o(n.charCodeAt(d+2))<<6|o(n.charCodeAt(d+3)),l[c]=a>>16,l[c+1]=a>>8&255,l[c+2]=255&a;return l.subarray(0,l.length-s)}},6968:function(e,t,n){"use strict";function r(){for(var e,t=arguments.length,n=-1,r=0;++n<t;)r+="number"==typeof(e=n<0||arguments.length<=n?void 0:arguments[n])?e:e.length;var i=new Uint8Array(r),a=0;for(n=-1;++n<t;)"number"==typeof(e=n<0||arguments.length<=n?void 0:arguments[n])?a+=e:e.length>0&&(i.set(e,a),a+=e.length);return i}function i(e,t){return(e[t+0]<<8)+(e[t+1]<<0)}function a(e,t){return 65536*e[t+0]+256*e[t+1]+e[t+2]}function o(e,t){return 16777216*e[t+0]+65536*e[t+1]+256*e[t+2]+e[t+3]}function s(e,t){return 4294967296*(16777216*e[t+0]+65536*e[t+1]+256*e[t+2]+e[t+3])+16777216*e[t+4]+65536*e[t+5]+256*e[t+6]+e[t+7]}function u(e){return new Uint8Array([e>>>8&255,255&e])}function l(e){return new Uint8Array([e>>>24&255,e>>>16&255,e>>>8&255,255&e])}function d(e){var t=e%4294967296,n=(e-t)/4294967296;return new Uint8Array([n>>>24&255,n>>>16&255,n>>>8&255,255&n,t>>>24&255,t>>>16&255,t>>>8&255,255&t])}function c(e,t){return(e[t+0]<<0)+(e[t+1]<<8)}function f(e,t){return e[t+0]+256*e[t+1]+65536*e[t+2]+16777216*e[t+3]}function v(e){return new Uint8Array([255&e,e>>>8&255,e>>>16&255,e>>>24&255])}n.d(t,{O_:function(){return v},QI:function(){return a},XT:function(){return u},dN:function(){return f},el:function(){return d},kh:function(){return l},pV:function(){return s},pX:function(){return o},qb:function(){return c},zK:function(){return i},zo:function(){return r}})},7864:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(7733);function i(e,t){return(0,r.Z)(t,(function(t){var n=setTimeout((function(){return t()}),e);return function(){return clearTimeout(n)}}))}},7733:function(e,t,n){"use strict";function r(e,t){var n;return new Promise((function(r,i){if(null!==e.cancellationError)return i(e.cancellationError);var a=!1;function o(e){void 0!==n&&n(),i(e)}n=t((function(t){e.deregister(o),a=!0,r(t)}),(function(t){e.deregister(o),a=!0,i(t)})),a||e.register(o)}))}n.d(t,{Z:function(){return r}})},1959:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(3887),i=n(1946),a=function(){function e(){this._listeners={}}var t=e.prototype;return t.addEventListener=function(e,t,n){var r=this,i=this._listeners[e];Array.isArray(i)?i.push(t):this._listeners[e]=[t],void 0!==n&&n.register((function(){r.removeEventListener(e,t)}))},t.removeEventListener=function(e,t){if((0,i.Z)(e))this._listeners={};else{var n=this._listeners[e];if(Array.isArray(n))if((0,i.Z)(t))delete this._listeners[e];else{var r=n.indexOf(t);-1!==r&&n.splice(r,1),0===n.length&&delete this._listeners[e]}}},t.trigger=function(e,t){var n=this._listeners[e];Array.isArray(n)&&n.slice().forEach((function(e){try{e(t)}catch(e){r.Z.error("EventEmitter: listener error",e instanceof Error?e:null)}}))},e}()},9592:function(e,t,n){"use strict";function r(e,t){return"function"==typeof Array.prototype.flatMap?e.flatMap(t):e.reduce((function(e,n){var r=t(n);return Array.isArray(r)?(e.push.apply(e,r),e):(e.push(r),e)}),[])}n.d(t,{Z:function(){return r}})},2572:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=.3;function i(e){return e*((2*Math.random()-1)*r+1)}},908:function(e,t,n){"use strict";function r(){var e="",t=-1;return function(){return++t>=Number.MAX_SAFE_INTEGER&&(e+="0",t=0),e+String(t)}}n.d(t,{Z:function(){return r}})},6923:function(e,t,n){"use strict";function r(e){return"string"==typeof e&&e.length>0}n.d(t,{Z:function(){return r}})},1946:function(e,t,n){"use strict";function r(e){return null==e}n.d(t,{Z:function(){return r}})},5288:function(e,t,n){"use strict";n.d(t,{ZP:function(){return u}});var r=n(6923),i=n(1946),a={aa:"aar",ab:"abk",ae:"ave",af:"afr",ak:"aka",am:"amh",an:"arg",ar:"ara",as:"asm",av:"ava",ay:"aym",az:"aze",ba:"bak",be:"bel",bg:"bul",bi:"bis",bm:"bam",bn:"ben",bo:"bod",br:"bre",bs:"bos",ca:"cat",ce:"che",ch:"cha",co:"cos",cr:"cre",cs:"ces",cu:"chu",cv:"chv",cy:"cym",da:"dan",de:"deu",dv:"div",dz:"dzo",ee:"ewe",el:"ell",en:"eng",eo:"epo",es:"spa",et:"est",eu:"eus",fa:"fas",ff:"ful",fi:"fin",fj:"fij",fo:"fao",fr:"fra",fy:"fry",ga:"gle",gd:"gla",gl:"glg",gn:"grn",gu:"guj",gv:"glv",ha:"hau",he:"heb",hi:"hin",ho:"hmo",hr:"hrv",ht:"hat",hu:"hun",hy:"hye",hz:"her",ia:"ina",id:"ind",ie:"ile",ig:"ibo",ii:"iii",ik:"ipk",io:"ido",is:"isl",it:"ita",iu:"iku",ja:"jpn",jv:"jav",ka:"kat",kg:"kon",ki:"kik",kj:"kua",kk:"kaz",kl:"kal",km:"khm",kn:"kan",ko:"kor",kr:"kau",ks:"kas",ku:"kur",kv:"kom",kw:"cor",ky:"kir",la:"lat",lb:"ltz",lg:"lug",li:"lim",ln:"lin",lo:"lao",lt:"lit",lu:"lub",lv:"lav",mg:"mlg",mh:"mah",mi:"mri",mk:"mkd",ml:"mal",mn:"mon",mr:"mar",ms:"msa",mt:"mlt",my:"mya",na:"nau",nb:"nob",nd:"nde",ne:"nep",ng:"ndo",nl:"nld",nn:"nno",no:"nor",nr:"nbl",nv:"nav",ny:"nya",oc:"oci",oj:"oji",om:"orm",or:"ori",os:"oss",pa:"pan",pi:"pli",pl:"pol",ps:"pus",pt:"por",qu:"que",rm:"roh",rn:"run",ro:"ron",ru:"rus",rw:"kin",sa:"san",sc:"srd",sd:"snd",se:"sme",sg:"sag",si:"sin",sk:"slk",sl:"slv",sm:"smo",sn:"sna",so:"som",sq:"sqi",sr:"srp",ss:"ssw",st:"sot",su:"sun",sv:"swe",sw:"swa",ta:"tam",te:"tel",tg:"tgk",th:"tha",ti:"tir",tk:"tuk",tl:"tgl",tn:"tsn",to:"ton",tr:"tur",ts:"tso",tt:"tat",tw:"twi",ty:"tah",ug:"uig",uk:"ukr",ur:"urd",uz:"uzb",ve:"ven",vi:"vie",vo:"vol",wa:"wln",wo:"wol",xh:"xho",yi:"yid",yo:"yor",za:"zha",zh:"zho",zu:"zul"},o={alb:"sqi",arm:"hye",baq:"eus",bur:"mya",chi:"zho",cze:"ces",dut:"nld",fre:"fra",geo:"kat",ger:"deu",gre:"ell",ice:"isl",mac:"mkd",mao:"mri",may:"msa",per:"fas",slo:"slk",rum:"ron",tib:"bod",wel:"cym"};function s(e){if((0,i.Z)(e)||""===e)return"";var t=function(e){var t;switch(e.length){case 2:t=a[e];break;case 3:t=o[e]}return t}((""+e).toLowerCase().split("-")[0]);return(0,r.Z)(t)?t:e}var u=s},8894:function(e,t,n){"use strict";function r(){}n.d(t,{Z:function(){return r}})},8026:function(e,t){"use strict";t.Z="function"==typeof Object.assign?Object.assign:function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=0;n<(arguments.length<=1?0:arguments.length-1);n++){var r=n+1<1||arguments.length<=n+1?void 0:arguments[n+1];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t}},1679:function(e,t,n){"use strict";t.Z="function"==typeof Object.values?Object.values:function(e){return Object.keys(e).map((function(t){return e[t]}))}},2829:function(e,t,n){"use strict";n.d(t,{A1:function(){return s},F_:function(){return p},JN:function(){return c},L7:function(){return h},Ti:function(){return u},XS:function(){return v},kR:function(){return m},rx:function(){return f},tn:function(){return y},uH:function(){return _}});var r=1/60;function i(e,t){return Math.abs(e-t)<r}function a(e,t){return{start:Math.min(e.start,t.start),end:Math.max(e.end,t.end)}}function o(e,t){return e.end<=t.start}function s(e,t){for(var n=0;n<e.length;n++)if(u(e[n],t))return!0;return!1}function u(e,t){var n=e.start,r=e.end;return n<=t&&t<r}function l(e,t){return u(e,t.start)||e.start<t.end&&t.end<e.end||u(t,e.start)}function d(e,t){return i(t.start,e.end)||i(t.end,e.start)}function c(e){for(var t=[],n=0;n<e.length;n++)t.push({start:e.start(n),end:e.end(n)});return t}function f(e,t){for(var n=e.length-1;n>=0;n--){var r=e.start(n);if(t>=r){var i=e.end(n);if(t<i)return{start:r,end:i}}}return null}function v(e,t){for(var n=e.length,r=0;r<n;r++){var i=e.start(r);if(t<i)return i-t}return 1/0}function p(e,t){for(var n=null,r=[],i=0;i<e.length;i++){var a=e.start(i),o=e.end(i);t<a||t>=o?r.push({start:a,end:o}):n={start:a,end:o}}return{outerRanges:r,innerRange:n}}function h(e,t){var n=f(e,t);return null!==n?n.end-t:1/0}function m(e,t){if(t.start===t.end)return e;for(var n=t,r=0;r<e.length;r++){var i=e[r],s=l(n,i),u=d(n,i);if(s||u)n=a(n,i),e.splice(r--,1);else if(0===r){if(o(n,e[0]))break}else if(o(e[r-1],n)&&o(n,i))break}return e.splice(r,0,n),function(e){for(var t=1;t<e.length;t++){var n=e[t-1],r=e[t];if(d(n,r)){var i=a(n,r);e.splice(--t,2,i)}}return e}(function(e){for(var t=0;t<e.length;t++){var n=e[t];n.start===n.end&&e.splice(t--,1)}return e}(e))}function g(e,t){for(var n=[],r=0;r<t.length;r++)l(e,t[r])&&n.push(t[r]);return n}function y(e,t){for(var n=[],r=0;r<e.length;r++){var i=e[r],a=g(i,t);if(a.length>0)for(var o=0;o<a.length;o++){var s=a[o];n.push({start:Math.max(i.start,s.start),end:Math.min(i.end,s.end)})}}return n}function _(e,t){for(var n=[],r=0;r<e.length;r++){var i=e[r],a=[],o=g(i,t);if(o.length>0)for(var s=0;s<o.length;s++){var u=o[s];a.push({start:Math.max(i.start,u.start),end:Math.min(i.end,u.end)})}if(0===a.length)n.push(i);else{for(var l=i.start,d=0;d<a.length;d++)a[d].start>l&&n.push({start:l,end:a[d].start}),l=a[d].end;l<i.end&&n.push({start:l,end:i.end})}}return n}},5095:function(e,t,n){"use strict";function r(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return i(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function a(e,t){var n=e,i=[],a=!1;return void 0!==t&&t.register(o),{getValue:function(){return n},setValue:function(e){if(!a&&(n=e,0!==i.length))for(var t,o=r(i.slice());!(t=o()).done;){var s=t.value;try{s.hasBeenCleared||s.trigger(e,s.complete)}catch(e){}}},setValueIfChanged:function(e){e!==n&&this.setValue(e)},onUpdate:function(e,t){var r={trigger:e,complete:o,hasBeenCleared:!1};function o(){if(void 0!==(null==t?void 0:t.clearSignal)&&t.clearSignal.deregister(o),!r.hasBeenCleared){r.hasBeenCleared=!0;var e=i.indexOf(r);e>=0&&i.splice(e,1)}}i.push(r),!0===(null==t?void 0:t.emitCurrentValue)&&e(n,o),a||r.hasBeenCleared?o():void 0!==(null==t?void 0:t.clearSignal)&&t.clearSignal.register(o)},waitUntilDefined:function(e,t){this.onUpdate((function(t,r){void 0!==t&&(r(),e(n))}),{clearSignal:null==t?void 0:t.clearSignal,emitCurrentValue:!0})},finish:o};function o(){void 0!==t&&t.deregister(o),a=!0;for(var e,n=r(i.slice());!(e=n()).done;){var s=e.value;try{s.hasBeenCleared||(s.complete(),s.hasBeenCleared=!0)}catch(e){}}i.length=0}}function o(e,t,n){var r=a(t(e.getValue()),n);return e.onUpdate((function(e){r.setValue(t(e))}),{clearSignal:n}),r}n.d(t,{$l:function(){return a},ZP:function(){return a},lR:function(){return o}})},4597:function(e,t,n){"use strict";n.d(t,{ZP:function(){return o}});var r=n(9105),i=n(6923),a=n(1946);var o=function(e){var t={url:e.url,headers:e.headers,responseType:(0,a.Z)(e.responseType)?"json":e.responseType,timeout:e.timeout};return new Promise((function(n,o){var s,u=e.onProgress,l=e.cancelSignal,d=t.url,c=t.headers,f=t.responseType,v=t.timeout,p=new XMLHttpRequest;if(p.open("GET",d,!0),void 0!==v&&(p.timeout=v,s=window.setTimeout((function(){_(),o(new r.Z(d,p.status,"TIMEOUT"))}),v+3e3)),p.responseType=f,"document"===p.responseType&&p.overrideMimeType("text/xml"),!(0,a.Z)(c)){var h=c;for(var m in h)h.hasOwnProperty(m)&&p.setRequestHeader(m,h[m])}var g=performance.now(),y=null;function _(){void 0!==s&&clearTimeout(s),null!==y&&y()}void 0!==l&&(y=l.register((function(e){_(),(0,a.Z)(p)||4===p.readyState||p.abort(),o(e)})),l.isCancelled())||(p.onerror=function(){_(),o(new r.Z(d,p.status,"ERROR_EVENT"))},p.ontimeout=function(){_(),o(new r.Z(d,p.status,"TIMEOUT"))},void 0!==u&&(p.onprogress=function(e){var t=performance.now();u({url:d,duration:t-g,sendingTime:g,currentTime:t,size:e.loaded,totalSize:e.total})}),p.onload=function(e){if(4===p.readyState)if(_(),p.status>=200&&p.status<300){var t,s=performance.now(),u=p.response instanceof ArrayBuffer?p.response.byteLength:e.total,l=p.status,c=p.responseType,f=(0,i.Z)(p.responseURL)?p.responseURL:d;if(t="json"===c?"object"==typeof p.response?p.response:function(e){try{return JSON.parse(e)}catch(e){return null}}(p.responseText):p.response,(0,a.Z)(t))return void o(new r.Z(d,p.status,"PARSE_ERROR"));n({status:l,url:f,responseType:c,sendingTime:g,receivedTime:s,requestDuration:s-g,size:u,responseData:t})}else o(new r.Z(d,p.status,"ERROR_HTTP_CODE"))},p.send())}))}},9829:function(e,t,n){"use strict";n.d(t,{$:function(){return o},Z:function(){return a}});var r=/^(?:[a-z]+:)?\/\//i,i=/\/\.{1,2}\//;function a(){var e=arguments.length;if(0===e)return"";for(var t="",n=0;n<e;n++){var a=n<0||arguments.length<=n?void 0:arguments[n];"string"==typeof a&&""!==a&&(r.test(a)?t=a:("/"===a[0]&&(a=a.substring(1)),"/"===t[t.length-1]&&(t=t.substring(0,t.length-1)),t=t+"/"+a))}return function(e){if(!i.test(e))return e;for(var t=[],n=e.split("/"),r=0,a=n.length;r<a;r++)if(".."===n[r])t.pop();else{if("."===n[r])continue;t.push(n[r])}return t.join("/")}(t)}function o(e){var t=e.lastIndexOf("/");if(t<0)return e.length;if(r.test(e)){var n=e.indexOf("/");if(n>=0&&t===n+1)return e.length}var i=e.indexOf("?");return i>=0&&i<t?o(e.substring(0,i)):t+1}},9252:function(e,t,n){"use strict";function r(e,t,n){if("function"==typeof String.prototype.startsWith)return e.startsWith(t,n);var r="number"==typeof n?Math.max(n,0):0;return e.substring(r,r+t.length)===t}n.d(t,{Z:function(){return r}})},3635:function(e,t,n){"use strict";n.d(t,{DM:function(){return h},TZ:function(){return s},ci:function(){return v},nr:function(){return f},tG:function(){return l},uR:function(){return c},wO:function(){return p},wV:function(){return u}});var r=n(3887),i=n(811),a="object"==typeof window&&"function"==typeof window.TextDecoder,o="object"==typeof window&&"function"==typeof window.TextEncoder;function s(e){for(var t=new ArrayBuffer(2*e.length),n=new Uint8Array(t),r=0;r<n.length;r+=2){var i=e.charCodeAt(r/2);n[r]=255&i,n[r+1]=i>>8&255}return n}function u(e){if(a)try{return new TextDecoder("utf-16le").decode(e)}catch(e){var t=e instanceof Error?e:"";r.Z.warn("Utils: could not use TextDecoder to parse UTF-16LE, fallbacking to another implementation",t)}for(var n="",i=0;i<e.length;i+=2)n+=String.fromCharCode((e[i+1]<<8)+e[i]);return n}function l(e){if(o)try{return(new TextEncoder).encode(e)}catch(e){var t=e instanceof Error?e:"";r.Z.warn("Utils: could not use TextEncoder to encode string into UTF-8, fallbacking to another implementation",t)}var n,i=encodeURIComponent(e);if("function"==typeof unescape)n=unescape(i);else{var a=/[0-9a-fA-F]/,s=i.length;n="";for(var u=0;u<i.length;u++){var l=!1;if("%"===i[u])if(u<=s-6&&"u"===i[u+1]&&a.test(i[u+2])&&a.test(i[u+3])&&a.test(i[u+4])&&a.test(i[u+5])){var d=parseInt(i.substring(u+1,u+6),16);n+=String.fromCharCode(d),l=!0,u+=5}else if(u<=s-3&&a.test(i[u+1])&&a.test(i[u+2])){var c=parseInt(i.substring(u+1,u+3),16);n+=String.fromCharCode(c),l=!0,u+=2}l||(n+=i[u])}}for(var f=new Uint8Array(n.length),v=0;v<n.length;v++)f[v]=255&n.charCodeAt(v);return f}function d(e,t){var n=e.toString(16);return n.length>=t?n:new Array(t-n.length+1).join("0")+n}function c(e){if(a)try{return(new TextDecoder).decode(e)}catch(e){var t=e instanceof Error?e:"";r.Z.warn("Utils: could not use TextDecoder to parse UTF-8, fallbacking to another implementation",t)}var n=e;239===n[0]&&187===n[1]&&191===n[2]&&(n=n.subarray(3));var i,o=function(e){for(var t="",n=0;n<e.length;n+=16e3){var r=e.subarray(n,n+16e3);t+=String.fromCharCode.apply(null,r)}return t}(n);if("function"==typeof escape)i=escape(o);else{var s=/[A-Za-z0-9*_\+-\.\/]/;i="";for(var u=0;u<o.length;u++)if(s.test(o[u]))i+=o[u];else{var l=o.charCodeAt(u);i+=l>=256?"%u"+d(l,4):"%"+d(l,2)}}return decodeURIComponent(i)}function f(e){for(var t=e.length,n=new Uint8Array(t/2),r=0,i=0;r<t;r+=2,i++)n[i]=255&parseInt(e.substring(r,r+2),16);return n}function v(e,t){void 0===t&&(t="");for(var n="",r=0;r<e.byteLength;r++)n+=(e[r]>>>4).toString(16),n+=(15&e[r]).toString(16),t.length>0&&r<e.byteLength-1&&(n+=t);return n}function p(e){(0,i.Z)(16===e.length,"GUID length should be 16");var t=e[0],n=e[1],r=e[2],a=e[3],o=e[4],s=e[5],u=e[6],l=e[7],d=new Uint8Array(16);return d[0]=a,d[1]=r,d[2]=n,d[3]=t,d[4]=s,d[5]=o,d[6]=l,d[7]=u,d.set(e.subarray(8,16),8),d}function h(e,t){for(var n=t;n<e.length;){if(0===e[n])break;n+=1}return{end:n+1,string:c(e.subarray(t,n))}}},5278:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(1946);function i(){for(var e=0,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];for(var a=n.length;e<a;){var o=n[e];if(!(0,r.Z)(o))return o;e++}}},288:function(e,t,n){"use strict";n.d(t,{FU:function(){return c},XG:function(){return d},ZP:function(){return l}});var r=n(7326),i=n(4578),a=n(2146),o=n(3887),s=n(811),u=n(8894),l=function(){function e(){var e,t=(e=u.Z,[function(t){e(t)},function(t){e=t}]),n=t[0],r=t[1];this._isUsed=!1,this._trigger=n,this.signal=new d(r)}var t=e.prototype;return t.isUsed=function(){return this._isUsed},t.linkToSignal=function(e){var t=this,n=e.register((function(){t.cancel()}));return this.signal.register(n),n},t.cancel=function(e){if(!this._isUsed){this._isUsed=!0;var t=null!=e?e:new c;this._trigger(t)}},e.isCancellationError=function(e){return e instanceof c},e}(),d=function(){function e(e){var t=this;this._isCancelled=!1,this.cancellationError=null,this._listeners=[],e((function(e){for(t.cancellationError=e,t._isCancelled=!0;t._listeners.length>0;)try{var n=t._listeners.pop();null==n||n(e)}catch(e){o.Z.error("Error while calling clean up listener",e instanceof Error?e.toString():"Unknown error")}}))}var t=e.prototype;return t.isCancelled=function(){return this._isCancelled},t.register=function(e){var t=this;return this._isCancelled?((0,s.Z)(null!==this.cancellationError),e(this.cancellationError),u.Z):(this._listeners.push(e),function(){return t.deregister(e)})},t.deregister=function(e){for(var t=this._listeners.length-1;t>=0;t--)this._listeners[t]===e&&this._listeners.splice(t,1)},e}(),c=function(e){function t(){var n;return n=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(n),t.prototype),n.name="CancellationError",n.message="This task was cancelled.",n}return(0,i.Z)(t,e),t}((0,a.Z)(Error))},8806:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(7714),i=[];function a(e){(0,r.Z)(i,e)||(console.warn(e),i.push(e))}},7473:function(e){"use strict";var t=function(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return e},n=function(e){var n,r,i=document.createTextNode(""),a=0;return new e((function(){var e;if(n)r&&(n=r.concat(n));else{if(!r)return;n=r}if(r=n,n=null,"function"==typeof r)return e=r,r=null,void e();for(i.data=a=++a%2;r;)e=r.shift(),r.length||(r=null),e()})).observe(i,{characterData:!0}),function(e){t(e),n?"function"==typeof n?n=[n,e]:n.push(e):(n=e,i.data=a=++a%2)}};e.exports=function(){if("object"==typeof process&&process&&"function"==typeof process.nextTick)return process.nextTick;if("function"==typeof queueMicrotask)return function(e){queueMicrotask(t(e))};if("object"==typeof document&&document){if("function"==typeof MutationObserver)return n(MutationObserver);if("function"==typeof WebKitMutationObserver)return n(WebKitMutationObserver)}return"function"==typeof setImmediate?function(e){setImmediate(t(e))}:"function"==typeof setTimeout||"object"==typeof setTimeout?function(e){setTimeout(t(e),0)}:null}()},7061:function(e,t,n){var r=n(8698).default;function i(){"use strict";e.exports=i=function(){return t},e.exports.__esModule=!0,e.exports.default=e.exports;var t={},n=Object.prototype,a=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},s="function"==typeof Symbol?Symbol:{},u=s.iterator||"@@iterator",l=s.asyncIterator||"@@asyncIterator",d=s.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function f(e,t,n,r){var i=t&&t.prototype instanceof h?t:h,a=Object.create(i.prototype),s=new R(r||[]);return o(a,"_invoke",{value:k(e,n,s)}),a}function v(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=f;var p={};function h(){}function m(){}function g(){}var y={};c(y,u,(function(){return this}));var _=Object.getPrototypeOf,b=_&&_(_(Z([])));b&&b!==n&&a.call(b,u)&&(y=b);var S=g.prototype=h.prototype=Object.create(y);function E(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function T(e,t){function n(i,o,s,u){var l=v(e[i],e,o);if("throw"!==l.type){var d=l.arg,c=d.value;return c&&"object"==r(c)&&a.call(c,"__await")?t.resolve(c.__await).then((function(e){n("next",e,s,u)}),(function(e){n("throw",e,s,u)})):t.resolve(c).then((function(e){d.value=e,s(d)}),(function(e){return n("throw",e,s,u)}))}u(l.arg)}var i;o(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,i){n(e,r,t,i)}))}return i=i?i.then(a,a):a()}})}function k(e,t,n){var r="suspendedStart";return function(i,a){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw a;return x()}for(n.method=i,n.arg=a;;){var o=n.delegate;if(o){var s=w(o,n);if(s){if(s===p)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=v(e,t,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===p)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}function w(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),p;var i=v(r,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,p;var a=i.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,p):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,p)}function A(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function R(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(A,this),this.reset(!0)}function Z(e){if(e){var t=e[u];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function t(){for(;++n<e.length;)if(a.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return r.next=r}}return{next:x}}function x(){return{value:void 0,done:!0}}return m.prototype=g,o(S,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:m,configurable:!0}),m.displayName=c(g,d,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===m||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,g):(e.__proto__=g,c(e,d,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},E(T.prototype),c(T.prototype,l,(function(){return this})),t.AsyncIterator=T,t.async=function(e,n,r,i,a){void 0===a&&(a=Promise);var o=new T(f(e,n,r,i),a);return t.isGeneratorFunction(n)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},E(S),c(S,d,"Generator"),c(S,u,(function(){return this})),c(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=Z,R.prototype={constructor:R,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(I),!e)for(var t in this)"t"===t.charAt(0)&&a.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(n,r){return o.type="throw",o.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r],o=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=a.call(i,"catchLoc"),u=a.call(i,"finallyLoc");if(s&&u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&a.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var o=i?i.completion:{};return o.type=e,o.arg=t,i?(this.method="next",this.next=i.finallyLoc,p):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),p},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),I(n),p}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;I(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:Z(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),p}},t}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports},8698:function(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},4687:function(e,t,n){var r=n(7061)();e.exports=r;try{regeneratorRuntime=r}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}},7326:function(e,t,n){"use strict";function r(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}n.d(t,{Z:function(){return r}})},5861:function(e,t,n){"use strict";function r(e,t,n,r,i,a,o){try{var s=e[a](o),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function i(e){return function(){var t=this,n=arguments;return new Promise((function(i,a){var o=e.apply(t,n);function s(e){r(o,i,a,s,u,"next",e)}function u(e){r(o,i,a,s,u,"throw",e)}s(void 0)}))}}n.d(t,{Z:function(){return i}})},1656:function(e,t,n){"use strict";function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function i(e){var t=function(e,t){if("object"!==r(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!==r(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===r(t)?t:String(t)}function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,i(r.key),r)}}function o(e,t,n){return t&&a(e.prototype,t),n&&a(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}n.d(t,{Z:function(){return o}})},4578:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(9611);function i(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,(0,r.Z)(e,t)}},9611:function(e,t,n){"use strict";function r(e,t){return r=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},r(e,t)}n.d(t,{Z:function(){return r}})},2146:function(e,t,n){"use strict";function r(e){return r=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},r(e)}n.d(t,{Z:function(){return o}});var i=n(9611);function a(e,t,n){return a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}()?Reflect.construct.bind():function(e,t,n){var r=[null];r.push.apply(r,t);var a=new(Function.bind.apply(e,r));return n&&(0,i.Z)(a,n.prototype),a},a.apply(null,arguments)}function o(e){var t="function"==typeof Map?new Map:void 0;return o=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,o)}function o(){return a(e,arguments,r(this).constructor)}return o.prototype=Object.create(e.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),(0,i.Z)(o,e)},o(e)}}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,n),a.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};var r={};return function(){"use strict";n.d(r,{default:function(){return Bn}});var e=n(1656),t=n(4578),i=n(3038);function a(e){var t=e;if("function"==typeof t.getStartDate){var n=t.getStartDate();if("object"==typeof n&&null!==n){var r=+n;if(!isNaN(r))return r/1e3}else if("number"==typeof n&&!isNaN(n))return n}}var o=n(3666),s=n(3887);function u(){if(!o.vU)return!0;var e=function(){if(!o.vU)return s.Z.warn("Compat: Can't access Firefox version on no firefox browser."),null;var e=navigator.userAgent,t=/Firefox\/([0-9]+)\./.exec(e);if(null===t)return-1;var n=parseInt(t[1],10);return isNaN(n)?-1:n}();if(null===e||e<67)return!0;var t=null===HTMLVideoElement||void 0===HTMLVideoElement?void 0:HTMLVideoElement.prototype;return void 0!==(null==t?void 0:t.requirePictureInPicture)}var l=n(6872),d=n(8750),c=n(3714),f=n(5992),v=n(7874),p=n(3274),h=n(7714),m=n(811),g=n(7904),y=n(1959),_=n(908),b=n(1946),S=n(8026),E=n(2829),T=n(5095),k=n(288),w=n(5861),A=n(4687),I=n.n(A),R=n(6139),Z=n(770);function x(e){return P.apply(this,arguments)}function P(){return(P=(0,w.Z)(I().mark((function e(t){var n,r;return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!==(n=Z.Z.getState(t))){e.next=3;break}return e.abrupt("return");case 3:return s.Z.info("DRM: Disposing of the current MediaKeys"),r=n.loadedSessionsStore,Z.Z.clearState(t),e.next=8,r.closeAllSessions();case 8:(0,R.Y)(t,null);case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function M(e){var t=Z.Z.getState(e);return null===t?null:[t.mediaKeySystemAccess.keySystem,t.mediaKeySystemAccess.getConfiguration()]}function C(e){if(s.Z.info("DRM: Clearing-up DRM session."),o.fq)return s.Z.info("DRM: disposing current MediaKeys."),x(e);var t=Z.Z.getState(e);return null!==t&&!0===t.keySystemOptions.closeSessionsOnStop?(s.Z.info("DRM: closing all current sessions."),t.loadedSessionsStore.closeAllSessions()):(s.Z.info("DRM: Nothing to clear. Returning right away. No state =",null===t),Promise.resolve())}var D=n(7733),N=n(8894),O=n(5278),L=n(5138);function U(e){var t=e.map((function(t){return Math.log(t/e[0])})),n=t.map((function(e){return e-t[0]+1})),r=(n[n.length-1]-1)/(2*e.length+10),i=1/r;return e.map((function(e,t){return a(t)}));function a(t){if(0===t)return 0;var o=Math.min(Math.max(1,t),e.length-1);return e[o]===e[o-1]?a(t-1):i*(r+(e[o]*n[o-1]-e[o-1]*n[o])/(e[o]-e[o-1]))+4}}var B=function(){function e(e){this._levelsMap=U(e).map((function(e){return e+4})),this._bitrates=e,this._lastUnsuitableQualityTimestamp=void 0,this._blockRaiseDelay=6e3,s.Z.debug("ABR: Steps for buffer based chooser.",this._levelsMap.map((function(t,n){return"bufferLevel: "+t+", bitrate: "+e[n]})).join(" ,"))}return e.prototype.getEstimate=function(e){var t=this._levelsMap,n=this._bitrates,r=e.bufferGap,i=e.currentBitrate,a=e.currentScore,o=e.speed;if(null==i)return n[0];for(var u,l=-1,d=0;d<n.length;d++){var c=n[d];if(c===i)l=d;else if(c>i)break}if(l<0||n.length!==t.length)return s.Z.error("ABR: Current Bitrate not found in the calculated levels"),n[0];void 0!==a&&(u=0===o?a.score:a.score/o);var f=isFinite(r)?r:0,v=performance.now();if(f<t[l]||void 0!==u&&u<1&&1===(null==a?void 0:a.confidenceLevel)){if((void 0===this._lastUnsuitableQualityTimestamp?-1:v-this._lastUnsuitableQualityTimestamp)<this._blockRaiseDelay+9e3){var p=this._blockRaiseDelay+3e3;this._blockRaiseDelay=Math.min(p,15e3),s.Z.debug("ABR: Incrementing blocking raise in BufferBasedChooser due to unstable quality",this._blockRaiseDelay)}else{var h=this._blockRaiseDelay-1e3;this._blockRaiseDelay=Math.max(6e3,h),s.Z.debug("ABR: Lowering quality in BufferBasedChooser",this._blockRaiseDelay)}this._lastUnsuitableQualityTimestamp=v;for(var m=(0,L.Z)(n,(function(e){return e===i}))-1;m>=0;m--)if(f>=t[m])return n[m];return n[0]}if(void 0!==this._lastUnsuitableQualityTimestamp&&v-this._lastUnsuitableQualityTimestamp<this._blockRaiseDelay||void 0===u||u<1.15||1!==(null==a?void 0:a.confidenceLevel))return i;var g=t[l],y=function(){for(var e=l+1;e<t.length;e++)if(t[e]>g)return e}();if(void 0!==y&&r>=t[y])return s.Z.debug("ABR: Raising quality in BufferBasedChooser",n[y]),n[y];return i},e}(),F=function(){function e(e){this._alpha=Math.exp(Math.log(.5)/e),this._lastEstimate=0,this._totalWeight=0}var t=e.prototype;return t.addSample=function(e,t){var n=Math.pow(this._alpha,e),r=t*(1-n)+n*this._lastEstimate;isNaN(r)||(this._lastEstimate=r,this._totalWeight+=e)},t.getEstimate=function(){var e=1-Math.pow(this._alpha,this._totalWeight);return this._lastEstimate/e},e}();function z(e){if(!(e.progress.length<5)){for(var t=new F(2),n=e.progress,r=1;r<n.length;r++){var i=n[r].size-n[r-1].size,a=n[r].timestamp-n[r-1].timestamp,o=8*i/(a/1e3);t.addSample(a/1e3,o)}return t.getEstimate()}}function V(e,t){var n=8*(e.totalSize-e.size);return Math.max(n/t,0)}var K=function(){function e(e,t){var n=l.Z.getCurrent(),r=n.ABR_STARVATION_GAP,i=n.OUT_OF_STARVATION_GAP,a=n.ABR_STARVATION_FACTOR,o=n.ABR_REGULAR_FACTOR;this._initialBitrate=e,this._inStarvationMode=!1,this._lowLatencyMode=t,this._config=t?{starvationGap:r.LOW_LATENCY,outOfStarvationGap:i.LOW_LATENCY,starvationBitrateFactor:a.LOW_LATENCY,regularBitrateFactor:o.LOW_LATENCY}:{starvationGap:r.DEFAULT,outOfStarvationGap:i.DEFAULT,starvationBitrateFactor:a.DEFAULT,regularBitrateFactor:o.DEFAULT}}var t=e.prototype;return t.getBandwidthEstimate=function(e,t,n,r,i){var a,o,u=this._config,d=e.bufferGap,c=e.position,f=e.duration,v=isFinite(d)?d:0,p=l.Z.getCurrent().ABR_STARVATION_DURATION_DELTA;return isNaN(f)||v+c.last<f-p?!this._inStarvationMode&&v<=u.starvationGap?(s.Z.info("ABR: enter starvation mode."),this._inStarvationMode=!0):this._inStarvationMode&&v>=u.outOfStarvationGap&&(s.Z.info("ABR: exit starvation mode."),this._inStarvationMode=!1):this._inStarvationMode&&(s.Z.info("ABR: exit starvation mode."),this._inStarvationMode=!1),this._inStarvationMode&&(o=function(e,t,n,r,i){if(!r){var a=t.bufferGap,o=t.speed,s=t.position,u=isFinite(a)?a:0,l=function(e,t){for(var n=-1,r=0;r<e.length;r++){var i=e[r].content.segment;if(!(i.duration<=0)){var a=i.time+i.duration;if(!i.complete&&r===e.length-1&&t-i.time>-1.2){n=r;break}if(a>t&&t-i.time>-1.2){n=r;break}}}if(n<0)return[];for(var o=e[n],s=o.content.segment.time,u=[o],l=n+1;l<e.length&&e[l].content.segment.time===s;l++)u.push(e[l]);return u}(e,s.last+u);if(1===l.length){var d=l[0],c=performance.now(),f=1.5*d.content.segment.duration;if(f=Math.min(f,3e3),f=Math.max(f,12e3),!(c-d.requestTimestamp<f)){var v=d.progress.length>0?d.progress[d.progress.length-1]:void 0,p=z(d);if(void 0!==v&&void 0!==p){var h=V(v,p);if((c-v.timestamp)/1e3<=h&&h-u/o>2500)return p}if(d.content.segment.complete){var m=d.content.segment.duration,g=(c-d.requestTimestamp)/1e3;if(null!=n&&!(g<=(1.5*m+2)/o)){var y=m/g,_=n.bitrate*Math.min(.7,y);return void 0===i||_<i?_:void 0}}}}}}(r,e,n,this._lowLatencyMode,i),null!=o&&(s.Z.info("ABR: starvation mode emergency estimate:",o),t.reset(),a=null==n?o:Math.min(o,n.bitrate))),null==a&&(a=null!=(o=t.getEstimate())?o*(this._inStarvationMode?u.starvationBitrateFactor:u.regularBitrateFactor):null!=i?i*(this._inStarvationMode?u.starvationBitrateFactor:u.regularBitrateFactor):this._initialBitrate),e.speed>1&&(a/=e.speed),{bandwidthEstimate:o,bitrateChosen:a}},t.isUrgent=function(e,t,n,r){return null===t||!(e>=t.bitrate)&&function(e,t,n){if(n)return!0;var r=isFinite(e.bufferGap)?e.bufferGap:0,i=e.position.last+r,a=(0,p.Z)(t,(function(e){var t=e.content;return t.segment.duration>0&&t.segment.time+t.segment.duration>i}));if(void 0===a)return!0;var o=performance.now(),s=a.progress.length>0?a.progress[a.progress.length-1]:void 0,u=z(a);if(void 0===s||void 0===u)return!0;var l=V(s,u);return(o-s.timestamp)/1e3>1.2*l||l-r/e.speed>-1.5}(r,n,this._lowLatencyMode)},e}();function G(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return j(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return j(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function j(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var H=function(){function e(e,t){this._scoreCalculator=e,this._lastAbrEstimate=t,this._consecutiveWrongGuesses=0,this._blockGuessesUntil=0,this._lastMaintanableBitrate=null}var t=e.prototype;return t.getGuess=function(e,t,n,r,i){var a=t.bufferGap,o=t.speed,u=this._lastAbrEstimate.representation;if(null===u)return null;if(r>u.bitrate)return 2===this._lastAbrEstimate.algorithmType&&(null!==this._lastAbrEstimate.representation&&(this._lastMaintanableBitrate=this._lastAbrEstimate.representation.bitrate),this._consecutiveWrongGuesses=0),null;var l=this._scoreCalculator.getEstimate(n);if(2!==this._lastAbrEstimate.algorithmType){if(void 0===l)return null;if(this._canGuessHigher(a,o,l)){var d=W(e,n);if(null!==d)return d}return null}if(this._isLastGuessValidated(u,r,l)&&(s.Z.debug("ABR: Guessed Representation validated",u.bitrate),this._lastMaintanableBitrate=u.bitrate,this._consecutiveWrongGuesses=0),n.id!==u.id)return u;if(this._shouldStopGuess(n,l,a,i))return this._consecutiveWrongGuesses++,this._blockGuessesUntil=performance.now()+Math.min(15e3*this._consecutiveWrongGuesses,12e4),function(e,t){var n=(0,L.Z)(e,(function(e){return e.id===t.id}));if(n<0)return s.Z.error("ABR: Current Representation not found."),null;for(;--n>=0;)if(e[n].bitrate<t.bitrate)return e[n];return null}(e,n);if(void 0===l)return n;if(this._canGuessHigher(a,o,l)){var c=W(e,n);if(null!==c)return c}return n},t._canGuessHigher=function(e,t,n){var r=n.score,i=n.confidenceLevel;return isFinite(e)&&e>=2.5&&performance.now()>this._blockGuessesUntil&&1===i&&r/t>1.01},t._shouldStopGuess=function(e,t,n,r){if(void 0!==t&&t.score<1.01)return!0;if((void 0===t||t.score<1.2)&&n<.6)return!0;for(var i,a=r.filter((function(t){return t.content.representation.id===e.id})),o=performance.now(),s=G(a);!(i=s()).done;){var u=i.value,l=o-u.requestTimestamp;if(u.content.segment.isInit){if(l>1e3)return!0}else{if(l>1e3*u.content.segment.duration+200)return!0;var d=z(u);if(void 0!==d&&d<.8*e.bitrate)return!0}}return!1},t._isLastGuessValidated=function(e,t,n){return void 0!==n&&1===n.confidenceLevel&&n.score>1.5||t>=e.bitrate&&(null===this._lastMaintanableBitrate||this._lastMaintanableBitrate<e.bitrate)},e}();function W(e,t){var n=e.length,r=(0,L.Z)(e,(function(e){return e.id===t.id}));if(r<0)return s.Z.error("ABR: Current Representation not found."),null;for(;++r<n;)if(e[r].bitrate>t.bitrate)return e[r];return null}var q=function(){function e(){var e=l.Z.getCurrent(),t=e.ABR_FAST_EMA,n=e.ABR_SLOW_EMA;this._fastEWMA=new F(t),this._slowEWMA=new F(n),this._bytesSampled=0}var t=e.prototype;return t.addSample=function(e,t){if(!(t<l.Z.getCurrent().ABR_MINIMUM_CHUNK_SIZE)){var n=8e3*t/e,r=e/1e3;this._bytesSampled+=t,this._fastEWMA.addSample(r,n),this._slowEWMA.addSample(r,n)}},t.getEstimate=function(){var e=l.Z.getCurrent().ABR_MINIMUM_TOTAL_BYTES;if(!(this._bytesSampled<e))return Math.min(this._fastEWMA.getEstimate(),this._slowEWMA.getEstimate())},t.reset=function(){var e=l.Z.getCurrent(),t=e.ABR_FAST_EMA,n=e.ABR_SLOW_EMA;this._fastEWMA=new F(t),this._slowEWMA=new F(n),this._bytesSampled=0},e}();var Y=function(){function e(){this.bandwidth=void 0,this.representation=null,this.algorithmType=3}return e.prototype.update=function(e,t,n){this.representation=e,this.bandwidth=t,this.algorithmType=n},e}(),X=n(1679),Q=function(){function e(){this._currentRequests={}}var t=e.prototype;return t.add=function(e){var t=e.id,n=e.requestTimestamp,r=e.content;this._currentRequests[t]={requestTimestamp:n,progress:[],content:r}},t.addProgress=function(e){var t=this._currentRequests[e.id];null!=t?t.progress.push(e):s.Z.warn("ABR: progress for a request not added")},t.remove=function(e){null==this._currentRequests[e]&&s.Z.warn("ABR: can't remove unknown request"),delete this._currentRequests[e]},t.getRequests=function(){return(0,X.Z)(this._currentRequests).filter((function(e){return null!=e})).sort((function(e,t){return e.content.segment.time-t.content.segment.time}))},e}(),$=function(){function e(){this._currentRepresentationData=null,this._lastRepresentationWithGoodScore=null}var t=e.prototype;return t.addSample=function(e,t,n){var r,i=n/t,a=this._currentRepresentationData;null!==a&&a.representation.id===e.id?(r=a.ewma,a.ewma.addSample(t,i),a.loadedDuration+=n,a.loadedSegments++):((r=new F(5)).addSample(t,i),this._currentRepresentationData={representation:e,ewma:r,loadedDuration:n,loadedSegments:0}),r.getEstimate()>1&&this._lastRepresentationWithGoodScore!==e&&(s.Z.debug("ABR: New last stable representation",e.bitrate),this._lastRepresentationWithGoodScore=e)},t.getEstimate=function(e){if(null!==this._currentRepresentationData&&this._currentRepresentationData.representation.id===e.id){var t=this._currentRepresentationData,n=t.ewma,r=t.loadedSegments,i=t.loadedDuration;return{score:n.getEstimate(),confidenceLevel:r>=5&&i>=10?1:0}}},t.getLastStableRepresentation=function(){return this._lastRepresentationWithGoodScore},e}();function J(e,t){var n=(0,L.Z)(e,(function(e){return e.bitrate>t}));return-1===n?e[e.length-1]:0===n?e[0]:e[n-1]}var ee=(0,T.ZP)(void 0);ee.finish();var te=(0,T.ZP)(1/0);te.finish();var ne=function(e){var t={},n=e.initialBitrates,r=e.throttlers,i=e.lowLatencyMode;return function(e,a,o,u,d){var c=e.adaptation.type,f=function(e){var n=t[e];if(null==n){s.Z.debug("ABR: Creating new BandwidthEstimator for ",e);var r=new q;return t[e]=r,r}return n}(c),v=(0,O.Z)(n[c],0);return function(e,t){var n=e.bandwidthEstimator,r=e.context,i=e.currentRepresentation,a=e.filters,o=e.initialBitrate,u=e.lowLatencyMode,d=e.playbackObserver,c=e.representations,f=new $,v=new K(null!=o?o:0,u),h=new Q,m=N.Z,g={metrics:w,requestBegin:A,requestProgress:I,requestEnd:R,addedSegment:function(e){m(e)}},y=new k.ZP;y.linkToSignal(t);var _=b(c.getValue(),y.signal);return c.onUpdate(S,{clearSignal:t}),{estimates:_,callbacks:g};function b(e,t){if(1===e.length)return(0,T.ZP)({bitrate:void 0,representation:e[0],urgent:!0,knownStableBitrate:void 0});var o,c=!1,g=e.map((function(e){return e.bitrate})),y=new B(g),_=new Y,b=new H(f,_),S=d.getReference().getValue(),k=(0,T.ZP)(A());return d.listen((function(e){S=e,w()}),{includeLastObservation:!1,clearSignal:t}),m=function(e){if(null!==S){var t=S,n=t.position,r=t.speed,i=e.buffered,a=(0,E.L7)(i,n.last),s=e.content.representation,u=f.getEstimate(s),l={bufferGap:a,currentBitrate:s.bitrate,currentScore:u,speed:r};o=y.getEstimate(l),w()}},t.register((function(){m=N.Z})),a.throttleBitrate.onUpdate(w,{clearSignal:t}),a.limitResolution.onUpdate(w,{clearSignal:t}),k;function w(){k.setValue(A())}function A(){var t=S,d=t.bufferGap,m=t.position,g=t.maximumPosition,y=a.limitResolution.getValue(),E=a.throttleBitrate.getValue(),T=i.getValue(),k=function(e,t,n){var r=e;void 0!==n&&n<1/0&&(r=function(e,t){if(0===e.length)return[];e.sort((function(e,t){return e.bitrate-t.bitrate}));var n=e[0].bitrate,r=Math.max(t,n),i=(0,L.Z)(e,(function(e){return e.bitrate>r}));return-1===i?e:e.slice(0,i)}(r,n));void 0!==t&&(r=function(e,t){if(void 0===t.width||void 0===t.height)return e;var n=t.width*t.pixelRatio,r=t.height*t.pixelRatio,i=e.slice().sort((function(e,t){return(0,O.Z)(e.width,0)-(0,O.Z)(t.width,0)})),a=(0,p.Z)(i,(function(e){return"number"==typeof e.width&&e.width>=n&&"number"==typeof e.height&&e.height>=r}));if(void 0===a)return e;var o="number"==typeof a.width?a.width:0;return e.filter((function(e){return"number"!=typeof e.width||e.width<=o}))}(r,t));return r}(e,y,E),w=h.getRequests(),A=v.getBandwidthEstimate(S,n,T,w,_.bandwidth),I=A.bandwidthEstimate,R=A.bitrateChosen,Z=f.getLastStableRepresentation(),x=null===Z?void 0:Z.bitrate/(S.speed>0?S.speed:1),P=l.Z.getCurrent(),M=P.ABR_ENTER_BUFFER_BASED_ALGO,C=P.ABR_EXIT_BUFFER_BASED_ALGO;c&&d<=C?c=!1:!c&&isFinite(d)&&d>=M&&(c=!0);var D=J(k,R),N=D.bitrate,U=null;c&&void 0!==o&&o>N&&(N=(U=J(k,o)).bitrate);var B=null;return u&&null!==T&&r.manifest.isDynamic&&g-m.last<40&&(B=b.getGuess(e,S,T,N,w)),null!==B&&B.bitrate>N?(s.Z.debug("ABR: Choosing representation with guess-based estimation.",B.bitrate,B.id),_.update(B,I,2),{bitrate:I,representation:B,urgent:null===T||B.bitrate<T.bitrate,knownStableBitrate:x}):null!==U?(s.Z.debug("ABR: Choosing representation with buffer-based estimation.",U.bitrate,U.id),_.update(U,I,0),{bitrate:I,representation:U,urgent:v.isUrgent(U.bitrate,T,w,S),knownStableBitrate:x}):(s.Z.debug("ABR: Choosing representation with bandwidth estimation.",D.bitrate,D.id),_.update(D,I,1),{bitrate:I,representation:D,urgent:v.isUrgent(D.bitrate,T,w,S),knownStableBitrate:x})}}function S(){var e=c.getValue();y.cancel(),(y=new k.ZP).linkToSignal(t),b(e,y.signal).onUpdate((function(e){_.setValue(e)}),{clearSignal:y.signal,emitCurrentValue:!0})}function w(e){var t=e.requestDuration,r=e.segmentDuration,i=e.size,a=e.content;if(n.addSample(t,i),!a.segment.isInit){var o=a.segment,s=a.representation;if(void 0===r&&!o.complete)return;var u=null!=r?r:o.duration;f.addSample(s,t/1e3,u)}}function A(e){h.add(e)}function I(e){h.addProgress(e)}function R(e){h.remove(e.id)}}({bandwidthEstimator:f,context:e,currentRepresentation:a,filters:{limitResolution:(0,O.Z)(r.limitResolution[c],ee),throttleBitrate:(0,O.Z)(r.throttleBitrate[c],te)},initialBitrate:v,playbackObserver:u,representations:o,lowLatencyMode:i},d)}},re=n(8619),ie=n(9105),ae=n(9362);function oe(e){return e instanceof ie.Z?new ae.Z("PIPELINE_LOAD_ERROR",e):(0,d.Z)(e,{defaultCode:"PIPELINE_LOAD_ERROR",defaultReason:"Unknown error when fetching the Manifest"})}var se=n(7839),ue=n(9822),le=n(7864),de=n(2572);function ce(e,t,n,r,i){return fe.apply(this,arguments)}function fe(){return fe=(0,w.Z)(I().mark((function e(t,n,r,i,a){var o,u,l,d,c,v,p,h,m,g,y,_,b;return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(b=function(e){var t;if(0===c.size)return e[0];var n=performance.now();return null===(t=e.filter((function(e){var t;return!0!==(null===(t=c.get(e))||void 0===t?void 0:t.isBlacklisted)})).reduce((function(e,t){var r,i=null===(r=c.get(t))||void 0===r?void 0:r.blockedUntil;return void 0!==i&&i<=n&&(i=void 0),void 0===e?[t,i]:void 0===i?void 0===e[1]?e:[t,void 0]:void 0===e[1]?e:i<e[1]?[t,i]:e}),void 0))||void 0===t?void 0:t[0]},_=function(e,t){var r=c.get(e);if(void 0===r||void 0===r.blockedUntil)return h(e);var i=performance.now(),o=r.blockedUntil-i;if(o<=0)return h(e);var s=new k.ZP,u=s.linkToSignal(a);return new Promise((function(r,i){function l(e){u(),r(e)}function d(e){u(),i(e)}null==n||n.addEventListener("priorityChange",(function(){var n=p();if(a.isCancelled())throw a.cancellationError;if(void 0===n)return d(t);n!==e&&(s.cancel(),_(n,t).then(l,d))}),s.signal),(0,le.Z)(o,s.signal).then((function(){return h(e).then(l,d)}),N.Z)}))},y=function(){return(y=(0,w.Z)(I().mark((function e(t){var n;return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=p(),!a.isCancelled()){e.next=3;break}throw a.cancellationError;case 3:if(void 0!==n){e.next=5;break}throw t;case 5:if(d(t),!a.isCancelled()){e.next=8;break}throw a.cancellationError;case 8:return e.abrupt("return",_(n,t));case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)},g=function(e){return y.apply(this,arguments)},m=function(){return(m=(0,w.Z)(I().mark((function e(t){var i,s,d,v,p;return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,r(t,a);case 3:return i=e.sent,e.abrupt("return",i);case 7:if(e.prev=7,e.t0=e.catch(0),!k.ZP.isCancellationError(e.t0)){e.next=11;break}throw e.t0;case 11:if(null!==t&&null!==n&&n.downgradeCdn(t),void 0===(s=c.get(t))?(s={errorCounter:1,blockedUntil:void 0,isBlacklisted:!1},c.set(t,s)):s.errorCounter++,(h=e.t0)instanceof ie.Z?h.type===f.br.ERROR_HTTP_CODE?h.status>=500||404===h.status||415===h.status||412===h.status:h.type===f.br.TIMEOUT||h.type===f.br.ERROR_EVENT:h instanceof se.Z?"boolean"==typeof h.canRetry?h.canRetry:void 0!==h.xhr&&(h.xhr.status>=500||404===h.xhr.status||415===h.xhr.status||412===h.xhr.status):(0,ue.Z)(h)&&"INTEGRITY_ERROR"===h.code){e.next=18;break}return s.blockedUntil=void 0,s.isBlacklisted=!0,e.abrupt("return",g(e.t0));case 18:return s.errorCounter>l?(s.blockedUntil=void 0,s.isBlacklisted=!0):(d=s.errorCounter,v=Math.min(o*Math.pow(2,d-1),u),p=(0,de.Z)(v),s.blockedUntil=performance.now()+p),e.abrupt("return",g(e.t0));case 20:case"end":return e.stop()}var h}),e,null,[[0,7]])})))).apply(this,arguments)},h=function(e){return m.apply(this,arguments)},p=function(){if(null===t){var e=c.get(null);if(void 0!==e&&e.isBlacklisted)return;return null}if(null===n)return b(t);var r=n.getCdnPreferenceForResource(t);return b(r)},null===a.cancellationError){e.next=9;break}return e.abrupt("return",Promise.reject(a.cancellationError));case 9:if(o=i.baseDelay,u=i.maxDelay,l=i.maxRetry,d=i.onRetry,null!==t&&0===t.length&&s.Z.warn("Fetchers: no CDN given to `scheduleRequestWithCdns`."),c=new Map,void 0!==(v=p())){e.next=15;break}throw new Error("No CDN to request");case 15:return e.abrupt("return",h(v));case 16:case"end":return e.stop()}}),e)}))),fe.apply(this,arguments)}function ve(e,t,n){return ce(null,null,e,t,n)}function pe(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return he(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return he(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function he(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var me=function(e){function n(t,n,r){var i;return(i=e.call(this)||this).scheduleManualRefresh=N.Z,i._manifestUrls=t,i._pipelines=n.manifest,i._settings=r,i._canceller=new k.ZP,i._isStarted=!1,i._isRefreshPending=!1,i._consecutiveUnsafeMode=0,i._prioritizedContentUrl=null,i}(0,t.Z)(n,e);var r=n.prototype;return r.dispose=function(){this._canceller.cancel(),this.removeEventListener()},r.start=function(){var e=this;if(!this._isStarted){this._isStarted=!0;var t=this._settings.initialManifest;(t instanceof re.ZP?Promise.resolve({manifest:t}):void 0!==t?this.parse(t,{previousManifest:null,unsafeMode:!1},void 0):this._fetchManifest(void 0).then((function(e){return e.parse({previousManifest:null,unsafeMode:!1})}))).then((function(t){e.trigger("manifestReady",t.manifest),e._canceller.isUsed()||e._recursivelyRefreshManifest(t.manifest,t)})).catch((function(t){return e._onFatalError(t)}))}},r.updateContentUrls=function(e,t){var n;this._prioritizedContentUrl=null!==(n=null==e?void 0:e[0])&&void 0!==n?n:void 0,t&&this.scheduleManualRefresh({enablePartialRefresh:!1,delay:0,canUseUnsafeMode:!1})},r._fetchManifest=function(){var e=(0,w.Z)(I().mark((function e(t){var n,r,i,a,o,s,u,d,c=this;return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return d=function(e){var t=a.loadManifest,n=(0,b.Z)(i.requestTimeout)?l.Z.getCurrent().DEFAULT_REQUEST_TIMEOUT:i.requestTimeout;n<0&&(n=void 0);return ve((function(){return t(e,{timeout:n},r)}),s,r)},r=this._canceller.signal,i=this._settings,a=this._pipelines,o=null!=t?t:null===(n=this._manifestUrls)||void 0===n?void 0:n[0],s=this._getBackoffSetting((function(e){c.trigger("warning",oe(e))})),e.prev=6,e.next=9,d(o);case 9:return u=e.sent,e.abrupt("return",{parse:function(e){return c._parseLoadedManifest(u,e,o)}});case 13:throw e.prev=13,e.t0=e.catch(6),oe(e.t0);case 16:case"end":return e.stop()}}),e,this,[[6,13]])})));return function(t){return e.apply(this,arguments)}}(),r.parse=function(e,t,n){return this._parseLoadedManifest({responseData:e,size:void 0,requestDuration:void 0},t,n)},r._parseLoadedManifest=function(){var e=(0,w.Z)(I().mark((function e(t,n,r){var i,a,o,u,l,c,f,v,p,h,m,g,y,_,b,S,E=this;return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(S=function(e){b(e.contentWarnings);var t=performance.now()-a;return s.Z.info("MF: Manifest parsed in "+t+"ms"),{manifest:e,sendingTime:l,receivedTime:c,parsingTime:t}},b=function(e){for(var t,n=pe(e);!(t=n()).done;){var r=t.value;if(o.isCancelled())return;var i=(0,d.Z)(r,{defaultCode:"PIPELINE_PARSE_ERROR",defaultReason:"Unknown error when parsing the Manifest"});u("warning",i)}},_=function(){return(_=(0,w.Z)(I().mark((function e(t){var n;return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,ve(t,f,o);case 3:return n=e.sent,e.abrupt("return",n);case 7:throw e.prev=7,e.t0=e.catch(0),oe(e.t0);case 10:case"end":return e.stop()}}),e,null,[[0,7]])})))).apply(this,arguments)},y=function(e){return _.apply(this,arguments)},a=performance.now(),o=this._canceller.signal,u=this.trigger.bind(this),l=t.sendingTime,c=t.receivedTime,f=this._getBackoffSetting((function(e){E.trigger("warning",oe(e))})),v=null!=r?r:null===(i=this._manifestUrls)||void 0===i?void 0:i[0],p={externalClockOffset:n.externalClockOffset,unsafeMode:n.unsafeMode,previousManifest:n.previousManifest,originalUrl:v},e.prev=11,h=this._pipelines.parseManifest(t,p,b,o,y),h instanceof Promise){e.next=17;break}return e.abrupt("return",S(h.manifest));case 17:return e.next=19,h;case 19:return m=e.sent,g=m.manifest,e.abrupt("return",S(g));case 22:e.next=28;break;case 24:throw e.prev=24,e.t0=e.catch(11),(0,d.Z)(e.t0,{defaultCode:"PIPELINE_PARSE_ERROR",defaultReason:"Unknown error when parsing the Manifest"});case 28:case"end":return e.stop()}}),e,this,[[11,24]])})));return function(t,n,r){return e.apply(this,arguments)}}(),r._getBackoffSetting=function(e){var t=l.Z.getCurrent(),n=t.DEFAULT_MAX_MANIFEST_REQUEST_RETRY,r=t.INITIAL_BACKOFF_DELAY_BASE,i=t.MAX_BACKOFF_DELAY_BASE,a=this._settings,o=a.lowLatencyMode,s=a.maxRetry;return{onRetry:e,baseDelay:o?r.LOW_LATENCY:r.REGULAR,maxDelay:o?i.LOW_LATENCY:i.REGULAR,maxRetry:null!=s?s:n}},r._recursivelyRefreshManifest=function(e,t){var n=this,r=t.sendingTime,i=t.parsingTime,a=t.updatingTime,o=l.Z.getCurrent(),u=o.MAX_CONSECUTIVE_MANIFEST_PARSING_IN_UNSAFE_MODE,d=o.MIN_MANIFEST_PARSING_TIME_TO_ENTER_UNSAFE_MODE,c=void 0!==i?i+(null!=a?a:0):void 0,f=this._consecutiveUnsafeMode>0?this._consecutiveUnsafeMode<u:void 0!==c&&c>=d,v=void 0===r?0:performance.now()-r,p=Math.max(this._settings.minimumManifestUpdateInterval-v,0),h=new k.ZP;if(h.linkToSignal(this._canceller.signal),this.scheduleManualRefresh=function(t){var i=t.enablePartialRefresh,a=t.delay,o=t.canUseUnsafeMode&&f,s=void 0===r?0:performance.now()-r,u=Math.max(n._settings.minimumManifestUpdateInterval-s,0),l=setTimeout((function(){h.cancel(),n._triggerNextManifestRefresh(e,{enablePartialRefresh:i,unsafeMode:o})}),Math.max((null!=a?a:0)-s,u));h.signal.register((function(){clearTimeout(l)}))},null!==e.expired){var m=setTimeout((function(){var t;null===(t=e.expired)||void 0===t||t.then((function(){h.cancel(),n._triggerNextManifestRefresh(e,{enablePartialRefresh:!1,unsafeMode:f})}),N.Z)}),p);h.signal.register((function(){clearTimeout(m)}))}if(void 0!==e.lifetime&&e.lifetime>=0){var g,y=1e3*e.lifetime-v;void 0===c?g=y:e.lifetime<3&&c>=100?(g=Math.min(Math.max(3e3-v,Math.max(y,0)+c),6*y),s.Z.info("MUS: Manifest update rythm is too frequent. Postponing next request.",y,g)):c>=1e3*e.lifetime/10?(g=Math.min(Math.max(y,0)+c,6*y),s.Z.info("MUS: Manifest took too long to parse. Postponing next request",g,g)):g=y;var _=setTimeout((function(){h.cancel(),n._triggerNextManifestRefresh(e,{enablePartialRefresh:!1,unsafeMode:f})}),Math.max(g,p));h.signal.register((function(){clearTimeout(_)}))}},r._triggerNextManifestRefresh=function(e,t){var n,r,i=this,a=t.enablePartialRefresh,o=t.unsafeMode,u=e.updateUrl;null!==this._prioritizedContentUrl?(n=!0,r=this._prioritizedContentUrl,this._prioritizedContentUrl=null):r=(n=!a||void 0===u)?e.getUrls()[0]:u;var d=e.clockOffset;o?(this._consecutiveUnsafeMode+=1,s.Z.info('Init: Refreshing the Manifest in "unsafeMode" for the '+String(this._consecutiveUnsafeMode)+" consecutive time.")):this._consecutiveUnsafeMode>0&&(s.Z.info('Init: Not parsing the Manifest in "unsafeMode" anymore after '+String(this._consecutiveUnsafeMode)+" consecutive times."),this._consecutiveUnsafeMode=0),this._isRefreshPending||(this._isRefreshPending=!0,this._fetchManifest(r).then((function(t){return t.parse({externalClockOffset:d,previousManifest:e,unsafeMode:o})})).then((function(t){i._isRefreshPending=!1;var r=t.manifest,a=t.sendingTime,o=t.parsingTime,u=performance.now();if(n)e.replace(r);else try{e.update(r)}catch(t){var d=t instanceof Error?t.message:"unknown error";s.Z.warn("MUS: Attempt to update Manifest failed: "+d,"Re-downloading the Manifest fully");var c=l.Z.getCurrent().FAILED_PARTIAL_UPDATE_MANIFEST_REFRESH_DELAY,f=void 0===a?0:performance.now()-a,v=Math.max(i._settings.minimumManifestUpdateInterval-f,0),p=N.Z,h=setTimeout((function(){p(),i._triggerNextManifestRefresh(e,{enablePartialRefresh:!1,unsafeMode:!1})}),Math.max(c-f,v));return void(p=i._canceller.signal.register((function(){clearTimeout(h)})))}var m=performance.now()-u;i._recursivelyRefreshManifest(e,{sendingTime:a,parsingTime:o,updatingTime:m})})).catch((function(e){i._isRefreshPending=!1,i._onFatalError(e)})))},r._onFatalError=function(e){this._canceller.isUsed()||(this.trigger("error",e),this.dispose())},n}(y.Z);var ge=me;function ye(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return _e(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _e(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var be=function(e){function n(t){var n;return(n=e.call(this)||this)._downgradedCdnList={metadata:[],timeouts:[]},t.register((function(){for(var e,t=ye(n._downgradedCdnList.timeouts);!(e=t()).done;){var r=e.value;clearTimeout(r)}n._downgradedCdnList={metadata:[],timeouts:[]}})),n}(0,t.Z)(n,e);var r=n.prototype;return r.getCdnPreferenceForResource=function(e){return e.length<=1?e:this._innerGetCdnPreferenceForResource(e)},r.downgradeCdn=function(e){var t=this,n=Se(this._downgradedCdnList.metadata,e);n>=0&&this._removeIndexFromDowngradeList(n);var r=l.Z.getCurrent().DEFAULT_CDN_DOWNGRADE_TIME;this._downgradedCdnList.metadata.push(e);var i=window.setTimeout((function(){var n=Se(t._downgradedCdnList.metadata,e);n>=0&&t._removeIndexFromDowngradeList(n),t.trigger("priorityChange",null)}),r);this._downgradedCdnList.timeouts.push(i),this.trigger("priorityChange",null)},r._innerGetCdnPreferenceForResource=function(e){var t=this,n=e.reduce((function(e,n){return t._downgradedCdnList.metadata.some((function(e){return e.id===n.id&&e.baseUrl===n.baseUrl}))?e[1].push(n):e[0].push(n),e}),[[],[]]),r=n[0],i=n[1];return r.concat(i)},r._removeIndexFromDowngradeList=function(e){this._downgradedCdnList.metadata.splice(e,1);var t=this._downgradedCdnList.timeouts.splice(e,1);clearTimeout(t[0])},n}(y.Z);function Se(e,t){return 0===e.length?-1:void 0!==t.id?(0,L.Z)(e,(function(e){return e.id===t.id})):(0,L.Z)(e,(function(e){return e.baseUrl===t.baseUrl}))}var Ee=n(520),Te=function(){function e(){this._cache=new WeakMap}var t=e.prototype;return t.add=function(e,t){var n=e.representation;e.segment.isInit&&this._cache.set(n,t)},t.get=function(e){var t=e.representation;if(e.segment.isInit){var n=this._cache.get(t);if(void 0!==n)return n}return null},e}(),ke=(0,_.Z)();var we=function(){function e(e){var t=e.prioritySteps;if(this._minPendingPriority=null,this._waitingQueue=[],this._pendingTasks=[],this._prioritySteps=t,this._prioritySteps.high>=this._prioritySteps.low)throw new Error("TP: the max high level priority should be given a lowerpriority number than the min low priority.")}var t=e.prototype;return t.create=function(e,t,n,r){var i,a=this;return(0,D.Z)(r,(function(o,s){return i={hasEnded:!1,priority:t,trigger:function(){if(!i.hasEnded){var e=function(){u(),a._endTask(i)},t=new k.ZP,u=t.linkToSignal(r);i.interrupter=t,t.signal.register((function(){i.interrupter=null,r.isCancelled()||n.beforeInterrupted()})),a._minPendingPriority=null===a._minPendingPriority?i.priority:Math.min(a._minPendingPriority,i.priority),a._pendingTasks.push(i),i.taskFn(t.signal).then((function(t){n.beforeEnded(),e(),o(t)})).catch((function(n){!r.isCancelled()&&t.isUsed()&&n instanceof k.FU||function(t){e(),s(t)}(n)}))}},taskFn:e,interrupter:null},a._canBeStartedNow(i)?(i.trigger(),a._isRunningHighPriorityTasks()&&a._interruptCancellableTasks()):a._waitingQueue.push(i),function(){return a._endTask(i)}}))},t._endTask=function(e){e.hasEnded=!0;var t=Ae(e.taskFn,this._waitingQueue);if(t>=0)this._waitingQueue.splice(t,1);else{var n=Ae(e.taskFn,this._pendingTasks);if(n<0)return;this._pendingTasks.splice(n,1),this._pendingTasks.length>0?this._minPendingPriority===e.priority&&(this._minPendingPriority=Math.min.apply(Math,this._pendingTasks.map((function(e){return e.priority})))):this._minPendingPriority=null,this._loopThroughWaitingQueue()}},t.updatePriority=function(e,t){var n=Ae(e,this._waitingQueue);if(n>=0){var r=this._waitingQueue[n];if(r.priority===t)return;if(r.priority=t,!this._canBeStartedNow(r))return;return this._findAndRunWaitingQueueTask(n),void(this._isRunningHighPriorityTasks()&&this._interruptCancellableTasks())}var i=Ae(e,this._pendingTasks);if(i<0)s.Z.warn("TP: request to update the priority of a non-existent task");else{var a=this._pendingTasks[i];if(a.priority!==t){var o=a.priority;a.priority=t,null===this._minPendingPriority||t<this._minPendingPriority?this._minPendingPriority=t:this._minPendingPriority===o&&(1===this._pendingTasks.length?this._minPendingPriority=t:this._minPendingPriority=Math.min.apply(Math,this._pendingTasks.map((function(e){return e.priority}))),this._loopThroughWaitingQueue()),this._isRunningHighPriorityTasks()&&this._interruptCancellableTasks()}}},t._loopThroughWaitingQueue=function(){var e=this._waitingQueue.reduce((function(e,t){return null===e||e>t.priority?t.priority:e}),null);if(!(null===e||null!==this._minPendingPriority&&this._minPendingPriority<e))for(var t=0;t<this._waitingQueue.length;t++){var n=null===this._minPendingPriority?e:Math.min(this._minPendingPriority,e);this._waitingQueue[t].priority<=n&&(this._findAndRunWaitingQueueTask(t),t--)}},t._interruptCancellableTasks=function(){for(var e=0;e<this._pendingTasks.length;e++){var t=this._pendingTasks[e];if(t.priority>=this._prioritySteps.low)return this._interruptPendingTask(t),this._interruptCancellableTasks()}},t._findAndRunWaitingQueueTask=function(e){return e>=this._waitingQueue.length||e<0?(s.Z.warn("TP : Tried to start a non existing task"),!1):(this._waitingQueue.splice(e,1)[0].trigger(),!0)},t._interruptPendingTask=function(e){var t,n=Ae(e.taskFn,this._pendingTasks);n<0?s.Z.warn("TP: Interrupting a non-existent pending task. Aborting..."):(this._pendingTasks.splice(n,1),this._waitingQueue.push(e),0===this._pendingTasks.length?this._minPendingPriority=null:this._minPendingPriority===e.priority&&(this._minPendingPriority=Math.min.apply(Math,this._pendingTasks.map((function(e){return e.priority})))),null===(t=e.interrupter)||void 0===t||t.cancel())},t._canBeStartedNow=function(e){return null===this._minPendingPriority||e.priority<=this._minPendingPriority},t._isRunningHighPriorityTasks=function(){return null!==this._minPendingPriority&&this._minPendingPriority<=this._prioritySteps.high},e}();function Ae(e,t){return(0,L.Z)(t,(function(t){return t.taskFn===e}))}var Ie=function(){function e(e,t,n){var r=new be(n),i=l.Z.getCurrent(),a=i.MIN_CANCELABLE_PRIORITY,o=i.MAX_HIGH_PRIORITY_LEVEL;this._transport=e,this._prioritizer=new we({prioritySteps:{high:o,low:a}}),this._cdnPrioritizer=r,this._backoffOptions=t}return e.prototype.createSegmentFetcher=function(e,t){var n,r,i,a,o,u,c,f,v,p,m,g,y=(n=this._backoffOptions,r=n.maxRetry,i=n.lowLatencyMode,a=n.requestTimeout,o=l.Z.getCurrent(),u=o.DEFAULT_MAX_REQUESTS_RETRY_ON_ERROR,c=o.DEFAULT_REQUEST_TIMEOUT,f=o.INITIAL_BACKOFF_DELAY_BASE,v=o.MAX_BACKOFF_DELAY_BASE,{maxRetry:null!=r?r:u,baseDelay:i?f.LOW_LATENCY:f.REGULAR,maxDelay:i?v.LOW_LATENCY:v.REGULAR,requestTimeout:(0,b.Z)(a)?c:a}),_=function(e,t,n,r,i){var a={timeout:i.requestTimeout<0?void 0:i.requestTimeout},o=(0,h.Z)(["audio","video"],e)?new Te:void 0,u=t.loadSegment,l=t.parseSegment;return function(){var e=(0,w.Z)(I().mark((function e(t,c,f){var v,p,h,m,g,y,_,E,T,w,A,R,Z,x,P,M,C,D,N,O,L,U,B,F;return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(F=function(){var e;x||!(0,b.Z)(A)&&void 0!==A.size&&void 0!==A.requestDuration&&R.length>0&&R.every((function(e){return e}))&&(x=!0,null===(e=r.onMetrics)||void 0===e||e.call(r,{size:A.size,requestDuration:A.requestDuration,content:t,segmentDuration:Z}))},B=function(e){c.onRetry(oe(e))},U=function(e,t){R.push(!1);var n=R.length-1;return function(r){var i={data:e,isChunked:t};try{var a=l(i,P,r);return R[n]||(Z=void 0!==Z&&"media"===a.segmentType&&null!==a.chunkInfos&&void 0!==a.chunkInfos.duration?Z+a.chunkInfos.duration:void 0,R[n]=!0,F()),a}catch(e){throw(0,d.Z)(e,{defaultCode:"PIPELINE_PARSE_ERROR",defaultReason:"Unknown parsing error"})}}},L=function(e){return u(e,P,a,f,M)},O=function(){var e;void 0===A&&(s.Z.debug("SF: Segment request cancelled",T),A=null,null===(e=r.onRequestEnd)||void 0===e||e.call(r,{id:w}))},m=t.segment,g=t.adaptation,y=t.representation,_=t.manifest,E=t.period,T=(0,Ee.K)(t),w=ke(),R=[],Z=0,x=!1,P={segment:m,type:g.type,language:g.language,isLive:_.isLive,periodStart:E.start,periodEnd:E.end,mimeType:y.mimeType,codecs:y.codec,manifestPublishTime:_.publishTime},M={onProgress:function(e){var t;void 0===A&&void 0!==e.totalSize&&e.size<e.totalSize&&(null===(t=r.onProgress)||void 0===t||t.call(r,{duration:e.duration,size:e.size,totalSize:e.totalSize,timestamp:performance.now(),id:w}))},onNewChunk:function(e){c.onChunk(U(e,!0))}},null===(C=void 0!==o?o.get(t):null)){e.next=18;break}return s.Z.debug("SF: Found wanted segment in cache",T),c.onChunk(U(C,!1)),e.abrupt("return",Promise.resolve());case 18:return s.Z.debug("SF: Beginning request",T),null===(v=r.onRequestBegin)||void 0===v||v.call(r,{requestTimestamp:performance.now(),id:w,content:t}),f.register(O),e.prev=21,e.next=24,ce(t.representation.cdnMetadata,n,L,(0,S.Z)({onRetry:B},i),f);case 24:"segment-loaded"===(D=e.sent).resultType?(N=D.resultData.responseData,void 0!==o&&o.add(t,D.resultData.responseData),c.onChunk(U(N,!1))):"segment-created"===D.resultType&&c.onChunk(U(D.resultData,!1)),s.Z.debug("SF: Segment request ended with success",T),c.onAllChunksReceived(),"segment-created"!==D.resultType?(A=D.resultData,F()):A=null,f.isCancelled()||null===(p=r.onRequestEnd)||void 0===p||p.call(r,{id:w}),f.deregister(O),e.next=43;break;case 33:if(e.prev=33,e.t0=e.catch(21),f.deregister(O),A=null,!(e.t0 instanceof k.FU)){e.next=40;break}throw s.Z.debug("SF: Segment request aborted",T),e.t0;case 40:throw s.Z.debug("SF: Segment request failed",T),null===(h=r.onRequestEnd)||void 0===h||h.call(r,{id:w}),oe(e.t0);case 43:case"end":return e.stop()}}),e,null,[[21,33]])})));return function(t,n,r){return e.apply(this,arguments)}}()}(e,this._transport[e],this._cdnPrioritizer,t,y);return p=this._prioritizer,m=_,g=new WeakMap,{createRequest:function(e,t,n,r){var i=function(t){return m(e,n,t)},a=p.create(i,t,n,r);return g.set(a,i),a},updatePriority:function(e,t){var n=g.get(e);void 0!==n?p.updatePriority(n,t):s.Z.warn("Fetchers: Cannot update the priority of a request: task not found.")}}},e}(),Re=Ie,Ze=n(7326);var xe=n(9612);function Pe(e){}var Me=function(e){function n(t,n,r){var i;i=e.call(this)||this;var a=r.addSourceBuffer(n);i._canceller=new k.ZP,i.bufferType=t,i._mediaSource=r,i._sourceBuffer=a,i._queue=[],i._pendingTask=null,i._lastInitSegmentUniqueId=null,i.codec=n,i._initSegmentsMap=new Map;var o=i._onPendingTaskError.bind((0,Ze.Z)(i)),s=i._flush.bind((0,Ze.Z)(i)),u=l.Z.getCurrent().SOURCE_BUFFER_FLUSHING_INTERVAL,d=setInterval(s,u);return i._sourceBuffer.addEventListener("error",o),i._sourceBuffer.addEventListener("updateend",s),i._canceller.signal.register((function(){clearInterval(d),i._sourceBuffer.removeEventListener("error",o),i._sourceBuffer.removeEventListener("updateend",s)})),i}(0,t.Z)(n,e);var r=n.prototype;return r.declareInitSegment=function(e,t){Pe(t),this._initSegmentsMap.set(e,t)},r.freeInitSegment=function(e){this._initSegmentsMap.delete(e)},r.pushChunk=function(e,t){return Pe(e.data.chunk),s.Z.debug("AVSB: receiving order to push data to the SourceBuffer",this.bufferType,(0,Ee.K)(e.inventoryInfos)),this._addToQueue({type:xe.f.Push,value:e},t)},r.removeBuffer=function(e,t,n){return s.Z.debug("AVSB: receiving order to remove data from the SourceBuffer",this.bufferType,e,t),this._addToQueue({type:xe.f.Remove,value:{start:e,end:t}},n)},r.endOfSegment=function(e,t){return s.Z.debug("AVSB: receiving order for validating end of segment",this.bufferType,(0,Ee.K)(e)),this._addToQueue({type:xe.f.EndOfSegment,value:e},t)},r.getBufferedRanges=function(){return this._sourceBuffer.buffered},r.getPendingOperations=function(){var e=function(e){switch(e.type){case xe.f.Push:case xe.f.Remove:case xe.f.EndOfSegment:return{type:e.type,value:e.value}}},t=this._queue.map(e);return null===this._pendingTask?t:[e(this._pendingTask)].concat(t)},r.dispose=function(){for(this._canceller.cancel(),null!==this._pendingTask&&(this._pendingTask.reject(new k.FU),this._pendingTask=null);this._queue.length>0;){var e=this._queue.shift();void 0!==e&&e.reject(new k.FU)}if("open"===this._mediaSource.readyState)try{this._sourceBuffer.abort()}catch(e){s.Z.warn("AVSB: Failed to abort a "+this.bufferType+" SourceBuffer:",e instanceof Error?e:"")}},r._onPendingTaskError=function(e){if(this._lastInitSegmentUniqueId=null,null!==this._pendingTask){var t=e instanceof Error?e:new Error("An unknown error occured when doing operations on the SourceBuffer");this._pendingTask.reject(t)}},r._addToQueue=function(e,t){var n=this;return(0,D.Z)(t,(function(t,r){var i=0===n._queue.length&&null===n._pendingTask,a=(0,S.Z)({resolve:t,reject:r},e);return n._queue.push(a),i&&n._flush(),function(){var e=n._queue.indexOf(a);e>=0&&n._queue.splice(e,1),a.resolve=N.Z,a.reject=N.Z}}))},r._flush=function(){if(!this._sourceBuffer.updating){if(null!==this._pendingTask){var e=this._pendingTask;if(e.type!==xe.f.Push||0===e.data.length){switch(e.type){case xe.f.Push:null!==e.inventoryData&&this._segmentInventory.insertChunk(e.inventoryData);break;case xe.f.EndOfSegment:this._segmentInventory.completeSegment(e.value,this.getBufferedRanges());break;case xe.f.Remove:this.synchronizeInventory();break;default:(0,g.Z)(e)}var t=e.resolve;return this._pendingTask=null,t(),void this._flush()}}else{var n=this._queue.shift();if(void 0===n)return;if(n.type!==xe.f.Push)this._pendingTask=n;else{var r,i=n.value;try{r=this._preparePushOperation(i.data)}catch(e){this._pendingTask=(0,S.Z)({data:[],inventoryData:i.inventoryInfos},n);var a=e instanceof Error?e:new Error("An unknown error occured when preparing a push operation");return this._lastInitSegmentUniqueId=null,void n.reject(a)}this._pendingTask=(0,S.Z)({data:r,inventoryData:i.inventoryInfos},n)}}try{switch(this._pendingTask.type){case xe.f.EndOfSegment:return s.Z.debug("AVSB: Acknowledging complete segment",(0,Ee.K)(this._pendingTask.value)),void this._flush();case xe.f.Push:var o=this._pendingTask.data.shift();if(void 0===o)return void this._flush();s.Z.debug("AVSB: pushing segment",this.bufferType,(0,Ee.K)(this._pendingTask.inventoryData)),this._sourceBuffer.appendBuffer(o);break;case xe.f.Remove:var u=this._pendingTask.value,l=u.start,d=u.end;s.Z.debug("AVSB: removing data from SourceBuffer",this.bufferType,l,d),this._sourceBuffer.remove(l,d);break;default:(0,g.Z)(this._pendingTask)}}catch(e){this._onPendingTaskError(e)}}},r._preparePushOperation=function(e){var t=[],n=e.codec,r=e.timestampOffset,i=e.appendWindow,a=!1;if(void 0!==n&&n!==this.codec&&(s.Z.debug("AVSB: updating codec",n),a=function(e,t){if("function"==typeof e.changeType){try{e.changeType(t)}catch(e){return s.Z.warn("Could not call 'changeType' on the given SourceBuffer:",e instanceof Error?e:""),!1}return!0}return!1}(this._sourceBuffer,n),a?this.codec=n:s.Z.debug("AVSB: could not update codec",n,this.codec)),this._sourceBuffer.timestampOffset!==r){var o=r;s.Z.debug("AVSB: updating timestampOffset",this.bufferType,this._sourceBuffer.timestampOffset,o),this._sourceBuffer.timestampOffset=o}if(void 0===i[0]?this._sourceBuffer.appendWindowStart>0&&(this._sourceBuffer.appendWindowStart=0):i[0]!==this._sourceBuffer.appendWindowStart&&(i[0]>=this._sourceBuffer.appendWindowEnd&&(this._sourceBuffer.appendWindowEnd=i[0]+1),this._sourceBuffer.appendWindowStart=i[0]),void 0===i[1]?this._sourceBuffer.appendWindowEnd!==1/0&&(this._sourceBuffer.appendWindowEnd=1/0):i[1]!==this._sourceBuffer.appendWindowEnd&&(this._sourceBuffer.appendWindowEnd=i[1]),null!==e.initSegmentUniqueId&&(a||!this._isLastInitSegment(e.initSegmentUniqueId))){var u=this._initSegmentsMap.get(e.initSegmentUniqueId);if(void 0===u)throw new Error("Invalid initialization segment uniqueId");t.push(u),this._lastInitSegmentUniqueId=e.initSegmentUniqueId}return null!==e.chunk&&t.push(e.chunk),t},r._isLastInitSegment=function(e){return null!==this._lastInitSegmentUniqueId&&this._lastInitSegmentUniqueId===e},n}(xe.C),Ce=["audio","video","text"];function De(e){return"audio"===e||"video"===e}var Ne=function(){function e(e,t){this._mediaElement=e,this._mediaSource=t,this._initializedSegmentBuffers={},this._onNativeBufferAddedOrDisabled=[]}e.isNative=function(e){return De(e)};var t=e.prototype;return t.getBufferTypes=function(){var e=this.getNativeBufferTypes();return null==v.Z.nativeTextTracksBuffer&&null==v.Z.htmlTextTracksBuffer||e.push("text"),e},t.getNativeBufferTypes=function(){return"AUDIO"===this._mediaElement.nodeName?["audio"]:["video","audio"]},t.getStatus=function(e){var t=this._initializedSegmentBuffers[e];return void 0===t?{type:"uninitialized"}:null===t?{type:"disabled"}:{type:"initialized",value:t}},t.waitForUsableBuffers=function(e){var t=this;return this._areNativeBuffersUsable()?Promise.resolve():(0,D.Z)(e,(function(e){var n,r=function(){var e=t._onNativeBufferAddedOrDisabled.indexOf(n);e>=0&&t._onNativeBufferAddedOrDisabled.splice(e,1)};return n=function(){t._areNativeBuffersUsable()&&(r(),e())},t._onNativeBufferAddedOrDisabled.push(n),r}))},t.disableSegmentBuffer=function(t){var n=this._initializedSegmentBuffers[t];if(null!==n){if(void 0!==n)throw new Error("Cannot disable an active SegmentBuffer.");this._initializedSegmentBuffers[t]=null,e.isNative(t)&&this._onNativeBufferAddedOrDisabled.forEach((function(e){return e()}))}else s.Z.warn("SBS: The "+t+" SegmentBuffer was already disabled.")},t.createSegmentBuffer=function(e,t,n){void 0===n&&(n={});var r,i=this._initializedSegmentBuffers[e];if(De(e)){if(null!=i)return i instanceof Me&&i.codec!==t?s.Z.warn("SB: Reusing native SegmentBuffer with codec",i.codec,"for codec",t):s.Z.info("SB: Reusing native SegmentBuffer with codec",t),i;s.Z.info("SB: Adding native SegmentBuffer with codec",t);var a=new Me(e,t,this._mediaSource);return this._initializedSegmentBuffers[e]=a,this._onNativeBufferAddedOrDisabled.forEach((function(e){return e()})),a}if(null!=i)return s.Z.info("SB: Reusing a previous custom SegmentBuffer for the type",e),i;if("text"===e){if(s.Z.info("SB: Creating a new text SegmentBuffer"),"html"===n.textTrackMode){if(null==v.Z.htmlTextTracksBuffer)throw new Error("HTML Text track feature not activated");r=new v.Z.htmlTextTracksBuffer(this._mediaElement,n.textTrackElement)}else{if(null==v.Z.nativeTextTracksBuffer)throw new Error("Native Text track feature not activated");r=new v.Z.nativeTextTracksBuffer(this._mediaElement)}return this._initializedSegmentBuffers.text=r,r}throw s.Z.error("SB: Unknown buffer type:",e),new c.Z("BUFFER_TYPE_UNKNOWN","The player wants to create a SegmentBuffer of an unknown type.")},t.disposeSegmentBuffer=function(e){var t=this._initializedSegmentBuffers[e];null!=t?(s.Z.info("SB: Aborting SegmentBuffer",e),t.dispose(),delete this._initializedSegmentBuffers[e]):s.Z.warn("SB: Trying to dispose a SegmentBuffer that does not exist")},t.disposeAll=function(){var e=this;Ce.forEach((function(t){"initialized"===e.getStatus(t).type&&e.disposeSegmentBuffer(t)}))},t._areNativeBuffersUsable=function(){var e=this,t=this.getNativeBufferTypes();return!t.some((function(t){return void 0===e._initializedSegmentBuffers[t]}))&&!t.every((function(t){return null===e._initializedSegmentBuffers[t]}))},e}(),Oe=n(7473),Le=n.n(Oe),Ue=function(){function e(e){this._array=[],this._sortingFn=e}var t=e.prototype;return t.add=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];t.sort(this._sortingFn);for(var r=0,i=0;i<t.length;i++){for(var a=t[i],o=!1;!o&&r<this._array.length;)this._sortingFn(a,this._array[r])<0?(this._array.splice(r,0,a),o=!0):r++;o||this._array.push(a)}},t.length=function(){return this._array.length},t.get=function(e){if(e<0||e>=this._array.length)throw new Error("Invalid index.");return this._array[e]},t.toArray=function(){return this._array.slice()},t.findFirst=function(e){return(0,p.Z)(this._array,e)},t.has=function(e){return(0,h.Z)(this._array,e)},t.removeElement=function(e){var t=this._array.indexOf(e);if(t>=0)return this._array.splice(t,1),t},t.head=function(){return this._array[0]},t.last=function(){return this._array[this._array.length-1]},t.shift=function(){return this._array.shift()},t.pop=function(){return this._array.pop()},e}(),Be=function(){function e(e){this._weakMap=new WeakMap,this._fn=e}var t=e.prototype;return t.get=function(e){var t=this._weakMap.get(e);if(void 0===t){var n=this._fn(e);return this._weakMap.set(e,n),n}return t},t.destroy=function(e){this._weakMap.delete(e)},e}();function Fe(e,t){var n,r=e.segmentBuffer,i=e.playbackObserver,a=e.maxBufferBehind,o=e.maxBufferAhead;function u(){(function(e,t,n,r,i){return ze.apply(this,arguments)})(r,n,a.getValue(),o.getValue(),t).catch((function(e){var t=e instanceof Error?e.message:"Unknown error";s.Z.error("Could not run BufferGarbageCollector:",t)}))}i.listen((function(e){var t;n=null!==(t=e.position.pending)&&void 0!==t?t:e.position.last,u()}),{includeLastObservation:!0,clearSignal:t}),a.onUpdate(u,{clearSignal:t}),o.onUpdate(u,{clearSignal:t}),u()}function ze(){return(ze=(0,w.Z)(I().mark((function e(t,n,r,i,a){var o,u,l,d,c,f,v,p;return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(isFinite(r)||isFinite(i)){e.next=2;break}return e.abrupt("return",Promise.resolve());case 2:o=[],u=(0,E.F_)(t.getBufferedRanges(),n),l=u.innerRange,d=u.outerRanges,c=function(){if(isFinite(i)){for(var e=0;e<d.length;e++){var t=d[e];n+i<=t.start?o.push(t):n<=t.start&&n+i<t.end&&n+i>t.start&&o.push({start:n+i,end:t.end})}null!=l&&n+i<l.end&&o.push({start:n+i,end:l.end})}},function(){if(isFinite(r)){for(var e=0;e<d.length;e++){var t=d[e];n-r>=t.end?o.push(t):n>=t.end&&n-r>t.start&&n-r<t.end&&o.push({start:t.start,end:n-r})}null!=l&&n-r>l.start&&o.push({start:l.start,end:n-r})}}(),c(),f=0,v=o;case 9:if(!(f<v.length)){e.next=20;break}if(!((p=v[f]).start<p.end)){e.next=17;break}if(s.Z.debug("GC: cleaning range from SegmentBuffer",p.start,p.end),null===a.cancellationError){e.next=15;break}throw a.cancellationError;case 15:return e.next=17,t.removeBuffer(p.start,p.end,a);case 17:f++,e.next=9;break;case 20:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Ve=function(e){function n(t,n,r,i){var a;return(a=e.call(this)||this)._content=t,a._currentCanceller=null,a._downloadQueue=n,a._initSegmentRequest=null,a._mediaSegmentRequest=null,a._segmentFetcher=r,a._initSegmentInfoRef=(0,T.ZP)(void 0),a._mediaSegmentAwaitingInitMetadata=null,i||a._initSegmentInfoRef.setValue(null),a}(0,t.Z)(n,e);var r=n.prototype;return r.getRequestedInitSegment=function(){return null===this._initSegmentRequest?null:this._initSegmentRequest.segment},r.getRequestedMediaSegment=function(){return null===this._mediaSegmentRequest?null:this._mediaSegmentRequest.segment},r.start=function(){var e=this;null===this._currentCanceller&&(this._currentCanceller=new k.ZP,this._downloadQueue.onUpdate((function(t){var n=t.segmentQueue;if(!(n.length>0&&n[0].segment.id===e._mediaSegmentAwaitingInitMetadata)){var r=e._mediaSegmentRequest;if(0===n.length){if(null===r)return;return s.Z.debug("Stream: no more media segment to request. Cancelling queue.",e._content.adaptation.type),void e._restartMediaSegmentDownloadingQueue()}if(null===r)return s.Z.debug("Stream: Media segments now need to be requested. Starting queue.",e._content.adaptation.type,n.length),void e._restartMediaSegmentDownloadingQueue();var i=n[0];return r.segment.id!==i.segment.id?(s.Z.debug("Stream: Next media segment changed, cancelling previous",e._content.adaptation.type),void e._restartMediaSegmentDownloadingQueue()):void(r.priority!==i.priority&&(s.Z.debug("Stream: Priority of next media segment changed, updating",e._content.adaptation.type,r.priority,i.priority),e._segmentFetcher.updatePriority(r.request,i.priority)))}}),{emitCurrentValue:!0,clearSignal:this._currentCanceller.signal}),this._downloadQueue.onUpdate((function(t){var n,r=e._initSegmentRequest;null===t.initSegment||null===r?(null===(n=t.initSegment)||void 0===n?void 0:n.segment.id)!==(null==r?void 0:r.segment.id)&&(null===t.initSegment&&s.Z.debug("Stream: no more init segment to request. Cancelling queue.",e._content.adaptation.type),e._restartInitSegmentDownloadingQueue(t.initSegment)):t.initSegment.priority!==r.priority&&e._segmentFetcher.updatePriority(r.request,t.initSegment.priority)}),{emitCurrentValue:!0,clearSignal:this._currentCanceller.signal}))},r.stop=function(){var e;null===(e=this._currentCanceller)||void 0===e||e.cancel(),this._currentCanceller=null},r._restartMediaSegmentDownloadingQueue=function(){var e=this;null!==this._mediaSegmentRequest&&this._mediaSegmentRequest.canceller.cancel();!function t(n){if(null!==e._currentCanceller&&e._currentCanceller.isUsed())e._mediaSegmentRequest=null;else{if(void 0===n)return e._mediaSegmentRequest=null,void e.trigger("emptyQueue",null);var r=new k.ZP,i=null===e._currentCanceller?N.Z:r.linkToSignal(e._currentCanceller.signal),a=n.segment,o=n.priority,u=(0,S.Z)({segment:a},e._content),l=!1,d=!1;r.signal.register((function(){e._mediaSegmentRequest=null,l||(e._mediaSegmentAwaitingInitMetadata===a.id&&(e._mediaSegmentAwaitingInitMetadata=null),l=!0,d=!1)}));var c=function(t){(0,m.Z)("media"===t.segmentType,"Should have loaded a media segment."),e.trigger("parsedMediaSegment",(0,S.Z)({},t,{segment:a}))},f=function(){var n=e._downloadQueue.getValue().segmentQueue;if(0===n.length)return l=!0,void e.trigger("emptyQueue",null);n[0].segment.id===a.id&&n.shift(),l=!0,t(n[0])},v=e._segmentFetcher.createRequest(u,o,{onRetry:function(t){e.trigger("requestRetry",{segment:a,error:t})},beforeInterrupted:function(){s.Z.info("Stream: segment request interrupted temporarly.",a.id,a.time)},onChunk:function(t){var n=e._initSegmentInfoRef.getValue();void 0!==n?c(t(null!=n?n:void 0)):(d=!0,e._initSegmentInfoRef.waitUntilDefined((function(e){c(t(null!=e?e:void 0))}),{clearSignal:r.signal}))},onAllChunksReceived:function(){d?(e._mediaSegmentAwaitingInitMetadata=a.id,e._initSegmentInfoRef.waitUntilDefined((function(){e._mediaSegmentAwaitingInitMetadata=null,d=!1,e.trigger("fullyLoadedSegment",a)}),{clearSignal:r.signal})):e.trigger("fullyLoadedSegment",a)},beforeEnded:function(){i(),e._mediaSegmentRequest=null,d?e._initSegmentInfoRef.waitUntilDefined(f,{clearSignal:r.signal}):f()}},r.signal);v.catch((function(t){i(),l||(l=!0,e.stop(),e.trigger("error",t))})),e._mediaSegmentRequest={segment:a,priority:o,request:v,canceller:r}}}(this._downloadQueue.getValue().segmentQueue[0])},r._restartInitSegmentDownloadingQueue=function(e){var t=this;if((null===this._currentCanceller||!this._currentCanceller.isUsed())&&(null!==this._initSegmentRequest&&this._initSegmentRequest.canceller.cancel(),null!==e)){var n=new k.ZP,r=null===this._currentCanceller?N.Z:n.linkToSignal(this._currentCanceller.signal),i=e.segment,a=e.priority,o=(0,S.Z)({segment:i},this._content),u=!1,l=this._segmentFetcher.createRequest(o,a,{onRetry:function(e){t.trigger("requestRetry",{segment:i,error:e})},beforeInterrupted:function(){s.Z.info("Stream: init segment request interrupted temporarly.",i.id)},beforeEnded:function(){r(),t._initSegmentRequest=null,u=!0},onChunk:function(e){var n,r=e(void 0);(0,m.Z)("init"===r.segmentType,"Should have loaded an init segment."),t.trigger("parsedInitSegment",(0,S.Z)({},r,{segment:i})),"init"===r.segmentType&&t._initSegmentInfoRef.setValue(null!==(n=r.initTimescale)&&void 0!==n?n:null)},onAllChunksReceived:function(){t.trigger("fullyLoadedSegment",i)}},n.signal);l.catch((function(e){r(),u||(u=!0,t.stop(),t.trigger("error",e))})),n.signal.register((function(){t._initSegmentRequest=null,u||(u=!0)})),this._initSegmentRequest={segment:i,priority:a,request:l,canceller:n}}},n}(y.Z);function Ke(e,t,n,r,i){var a=e.period,o=e.adaptation,u=e.representation,l=function(e,t){for(var n=0;n<e.length;n++){var r=e[n];if(void 0===r.bufferedStart||void 0===r.bufferedEnd||r.bufferedStart>=t.end)return null;if(r.bufferedEnd>t.start)return n}return null}(i,t);if(null===l){if(null===n){if(r&&void 0!==a.end&&t.end>=a.end)return{start:void 0,end:null};var d=u.index.checkDiscontinuity(t.start);if(null!==d)return{start:void 0,end:d}}return null}var c=i[l];if(void 0!==c.bufferedStart&&c.bufferedStart>t.start&&(null===n||c.infos.segment.end<=n)){var f=c.bufferedStart;return r||!1===u.index.awaitSegmentBetween(t.start,f)?(s.Z.debug("RS: current discontinuity encountered",o.type,c.bufferedStart),{start:void 0,end:f}):null}var v=function(e,t,n){if(n<=0)return s.Z.error("RS: Asked to check a discontinuity before the first chunk."),null;for(var r=n;r<e.length;r++){var i=e[r],a=e[r-1];if(void 0===i.bufferedStart||void 0===a.bufferedEnd||i.bufferedStart>=t.end)return null;if(i.bufferedStart-a.bufferedEnd>0)return r}return null}(i,t,l+1);if(null!==v){var p=i[v-1],h=i[v];if(null===n||h.infos.segment.end<=n){if(!r&&!1!==u.index.awaitSegmentBetween(p.infos.segment.end,h.infos.segment.time))return null;var m=p.bufferedEnd,g=h.bufferedStart;return s.Z.debug("RS: future discontinuity encountered",o.type,m,g),{start:m,end:g}}}if(null===n){if(r&&void 0!==a.end){if(t.end<a.end)return null;var y=function(e,t){for(var n=e.length-1;n>=0;n--){var r=e[n];if(void 0===r.bufferedStart)return null;if(r.bufferedStart<t)return n}return null}(i,a.end);if(null!==y){var _=i[y];if(void 0!==_.bufferedEnd&&_.bufferedEnd<a.end)return s.Z.debug("RS: discontinuity encountered at the end of the current period",o.type,_.bufferedEnd,a.end),{start:_.bufferedEnd,end:null}}}if(void 0!==a.end&&t.end>=a.end)return null;for(var b=i.length-1;b>=0;b--){var S=i[b];if(void 0===S.bufferedStart)break;if(S.bufferedStart<t.end){if(void 0!==S.bufferedEnd&&S.bufferedEnd<t.end){var E=u.index.checkDiscontinuity(t.end);if(null!==E)return{start:S.bufferedEnd,end:E}}return null}}}return null}function Ge(e){var t=e.bufferedSegments,n=e.content,r=e.currentPlaybackTime,i=e.fastSwitchThreshold,a=e.getBufferedHistory,o=e.neededRange,u=e.segmentsBeingPushed,d=e.maxBufferSize,c=n.adaptation,f=n.representation,v=function(e,t,n){var r=8e3*n;return r-=t.reduce((function(e,t){return e+t.representation.bitrate*t.segment.duration}),0),e.reduce((function(e,t){return void 0!==t.chunkSize?e-8*t.chunkSize:e}),r)}(t,u,d),p=f.index.getSegments(o.start,o.end-o.start),h=t.filter((function(e){return!He(e.infos,n,r,i)})).filter((function(e,t,n){var r=0===t?null:n[t-1],i=t>=n.length-1?null:n[t+1],u=null;if(function(e,t,n){var r=l.Z.getCurrent().MAX_TIME_MISSING_FROM_COMPLETE_SEGMENT;if(void 0===e.bufferedStart)return s.Z.warn("Stream: Start of a segment unknown. Assuming it is garbage collected by default.",e.start),!0;if(null!==t&&void 0!==t.bufferedEnd&&e.bufferedStart-t.bufferedEnd<.1)return!1;if(n<e.bufferedStart&&e.bufferedStart-e.start>r)return s.Z.info("Stream: The start of the wanted segment has been garbage collected",e.start,e.bufferedStart),!0;return!1}(e,r,o.start)){if(function(e,t){var n,r;if(e.length<2)return!0;var i=e[e.length-1],a=null===(n=i.buffered)||void 0===n?void 0:n.start;if(void 0!==t&&void 0!==a&&t-a>.05)return!0;var o=e[e.length-2],s=null===(r=o.buffered)||void 0===r?void 0:r.start;if(void 0===s||void 0===a)return!0;return Math.abs(s-a)>.01}(u=a(e.infos),e.bufferedStart))return!1;s.Z.debug("Stream: skipping segment gc-ed at the start",e.start,e.bufferedStart)}if(function(e,t,n){var r=l.Z.getCurrent().MAX_TIME_MISSING_FROM_COMPLETE_SEGMENT;if(void 0===e.bufferedEnd)return s.Z.warn("Stream: End of a segment unknown. Assuming it is garbage collected by default.",e.end),!0;if(null!==t&&void 0!==t.bufferedStart&&t.bufferedStart-e.bufferedEnd<.1)return!1;if(n>e.bufferedEnd&&e.end-e.bufferedEnd>r)return s.Z.info("Stream: The end of the wanted segment has been garbage collected",e.start,e.bufferedStart),!0;return!1}(e,i,o.end)){if(function(e,t){var n,r;if(e.length<2)return!0;var i=e[e.length-1],a=null===(n=i.buffered)||void 0===n?void 0:n.end;if(void 0!==t&&void 0!==a&&a-t>.05)return!0;var o=e[e.length-2],s=null===(r=o.buffered)||void 0===r?void 0:r.end;if(void 0===s||void 0===a)return!0;return Math.abs(s-a)>.01}(u=null!=u?u:a(e.infos),e.bufferedEnd))return!1;s.Z.debug("Stream: skipping segment gc-ed at the end",e.end,e.bufferedEnd)}return!0})),m=l.Z.getCurrent(),g=m.MINIMUM_SEGMENT_SIZE,y=m.MIN_BUFFER_AHEAD,_=!1,b=Math.min(1/60,g),E=!1,T=[],k=p.filter((function(e){var t=(0,S.Z)({segment:e},n);if(u.length>0&&u.some((function(e){return(0,Ee.z)(t,e)})))return!1;var l=e.duration,d=e.time,p=e.end;if(e.isInit)return!0;if(_)return T.push(e),!1;if(e.complete&&l<g)return!1;if(u.length>0&&u.some((function(e){if(e.period.id!==n.period.id||e.adaptation.id!==n.adaptation.id)return!1;var a=e.segment;return!(a.time-b>d)&&(!(a.end+b<p)&&!He(e,t,r,i))})))return!1;for(var m=0;m<h.length;m++){var k=h[m];if(k.infos.period.id===n.period.id){var w=k.infos.segment;if(d-w.time>-b&&w.end-p>-b)return!1}}var A=l*n.representation.bitrate;if(v-A<0&&(E=!0,d>o.start+y))return _=!0,T.push(e),!1;var I=a(t);if(I.length>1){var R=I[I.length-1],Z=I[I.length-2];if(null===R.buffered&&null===Z.buffered)return s.Z.warn("Stream: Segment GCed multiple times in a row, ignoring it.","If this happens a lot and lead to unpleasant experience, please check your device's available memory. If it's low when this message is emitted, you might want to update the RxPlayer's settings (`maxBufferAhead`, `maxVideoBufferSize` etc.) so less memory is used by regular media data buffering."+c.type,f.id,e.time),!1}for(var x=0;x<h.length;x++){var P=h[x];if(P.end+b>d){var M=P.start>d+b||je(h,x).end<p-b;return M&&(v-=A),M}}return v-=A,!0}));return{segmentsToLoad:k,segmentsOnHold:T,isBufferFull:E}}function je(e,t){for(var n=t+1,r=l.Z.getCurrent().MINIMUM_SEGMENT_SIZE,i=Math.min(1/60,r);n<e.length-1&&e[n-1].end+i>e[n].start;)n++;return e[--n]}function He(e,t,n,r){var i=l.Z.getCurrent().CONTENT_REPLACEMENT_PADDING;return e.period.id===t.period.id&&(!(e.segment.time<n+i)&&(e.adaptation.id!==t.adaptation.id||function(e,t,n){var r=e.bitrate,i=l.Z.getCurrent().BITRATE_REBUFFERING_RATIO;if(void 0===n){var a=r*i;return t.bitrate>a}return r<n&&t.bitrate>r}(e.representation,t.representation,r)))}function We(e,t){for(var n=e-t,r=l.Z.getCurrent().SEGMENT_PRIORITIES_STEPS,i=0;i<r.length;i++)if(n<r[i])return i;return r.length}function qe(e,t,n,r,i,a,o){o.synchronizeInventory();var s=e.representation,u=n.getIsPaused()||n.getPlaybackRate()<=0?t-.1:t,d=function(e,t,n){var r,i,a=e.manifest,o=e.period,s=e.representation,u=s.index.getLastAvailablePosition(),l=s.index;i=!(0,b.Z)(u)&&t>=u&&l.isInitialized()&&l.isFinished()&&function(e,t,n){var r;return t.containsTime(n)&&e.isLastPeriodKnown&&t.id===(null===(r=e.periods[e.periods.length-1])||void 0===r?void 0:r.id)}(a,o,t)?u-1:t-.1;var d,c=i+n;d=!(!s.index.isInitialized()||!s.index.isFinished()||void 0===o.end)&&(void 0===u?c>=o.end:null===u||c>=u);return{start:Math.max(i,o.start),end:Math.min(c,null!==(r=o.end)&&void 0!==r?r:1/0),hasReachedPeriodEnd:d}}(e,u,i),c=s.index.shouldRefresh(d.start,d.end),f=o.getPendingOperations().filter((function(e){return e.type===xe.f.EndOfSegment})).map((function(e){return e.value})),v=function(e,t){for(var n=l.Z.getCurrent().MINIMUM_SEGMENT_SIZE,r=Math.max(1/60,n),i=e.start+r,a=e.end-r,o=[],s=t.length-1;s>=0;s--){var u=t[s],d=u.infos.representation;if(!u.partiallyPushed&&!1!==d.decipherable&&d.isSupported){var c=u.infos.segment,f=c.time/c.timescale;((c.complete?f+c.duration/c.timescale:u.end)>i&&f<a||u.end>i&&u.start<a)&&o.unshift(u)}}return o}({start:Math.max(d.start-.5,0),end:d.end+.5},o.getInventory()),p=Ge({content:e,bufferedSegments:v,currentPlaybackTime:n.getCurrentTime(),fastSwitchThreshold:r,getBufferedHistory:o.getSegmentHistory.bind(o),neededRange:d,segmentsBeingPushed:f,maxBufferSize:a}),h=p.segmentsToLoad,m=p.segmentsOnHold,g=p.isBufferFull,y=h.map((function(e){return{priority:We(e.time,u),segment:e}})),_=s.index.isInitialized()&&s.index.isFinished()&&d.hasReachedPeriodEnd&&0===y.length&&0===m.length,S=null;return f.length>0&&(S=Math.min.apply(Math,f.map((function(e){return e.segment.time})))),m.length>0&&(S=null!==S?Math.min(S,m[0].time):m[0].time),y.length>0&&(S=null!==S?Math.min(S,y[0].segment.time):y[0].segment.time),{imminentDiscontinuity:Ke(e,d,S,_,v),hasFinishedLoading:_,neededSegments:y,isBufferFull:g,shouldRefreshManifest:c}}function Ye(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Xe(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Xe(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Xe(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Qe(e,t,n){return $e.apply(this,arguments)}function $e(){return($e=(0,w.Z)(I().mark((function e(t,n,r){var i,a,o,u,d,c,f,v,p;return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=l.Z.getCurrent().BUFFER_GC_GAPS.CALM,a=l.Z.getCurrent().BUFFER_GC_GAPS.BEEFY,s.Z.warn("Stream: Running garbage collector"),o=n.getBufferedRanges(),0===(u=Je(t,o,i)).length&&(u=Je(t,o,a)),s.Z.hasLevel("DEBUG")&&s.Z.debug("Stream: GC cleaning",u.map((function(e){return"start: "+e.start+" - end "+e.end})).join(", ")),d=Ye(u);case 8:if((c=d()).done){e.next=16;break}if(f=c.value,v=f.start,p=f.end,!(v<p)){e.next=14;break}return e.next=14,n.removeBuffer(v,p,r);case 14:e.next=8;break;case 16:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Je(e,t,n){for(var r=(0,E.F_)(t,e),i=r.innerRange,a=r.outerRanges,o=[],u=0;u<a.length;u++){var l=a[u];(e-n>l.end||e+n<l.start)&&o.push(l)}return null!==i&&(s.Z.hasLevel("DEBUG")&&s.Z.debug("Stream: GC removing part of inner range",o.map((function(e){return"start: "+e.start+" - end "+e.end})).join(", ")),e-n>i.start&&o.push({start:i.start,end:e-n}),e+n<i.end&&o.push({start:e+n,end:i.end})),o}function et(e,t,n,r){return tt.apply(this,arguments)}function tt(){return(tt=(0,w.Z)(I().mark((function e(t,n,r,i){var a,o,s,u,l,d;return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,n.pushChunk(r,i);case 3:case 21:e.next=27;break;case 5:if(e.prev=5,e.t0=e.catch(0),!(i.isCancelled()&&e.t0 instanceof k.FU)){e.next=11;break}throw e.t0;case 11:if(e.t0 instanceof Error&&"QuotaExceededError"===e.t0.name){e.next=14;break}throw o=e.t0 instanceof Error?e.t0.toString():"An unknown error happened when pushing content",new c.Z("BUFFER_APPEND_ERROR",o,{adaptation:r.inventoryInfos.adaptation});case 14:return s=t.getReference().getValue(),u=s.position,l=null!==(a=u.pending)&&void 0!==a?a:u.last,e.prev=16,e.next=19,Qe(l,n,i);case 19:return e.next=21,n.pushChunk(r,i);case 23:throw e.prev=23,e.t1=e.catch(16),d=e.t1 instanceof Error?e.t1.toString():"Could not clean the buffer",new c.Z("BUFFER_FULL_ERROR",d,{adaptation:r.inventoryInfos.adaptation});case 27:case"end":return e.stop()}}),e,null,[[0,5],[16,23]])})))).apply(this,arguments)}function nt(){return nt=(0,w.Z)(I().mark((function e(t,n){var r,i,a,o,s,u,l,d,c,f;return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.playbackObserver,i=t.content,a=t.initSegmentUniqueId,o=t.segment,s=t.segmentData,u=t.segmentBuffer,null===n.cancellationError){e.next=3;break}throw n.cancellationError;case 3:return l=i.representation.getMimeTypeString(),d={initSegmentUniqueId:a,chunk:null,timestampOffset:0,appendWindow:[void 0,void 0],codec:l},c=(0,S.Z)({segment:o,chunkSize:void 0,start:0,end:0},i),e.next=8,et(r,u,{data:d,inventoryInfos:c},n);case 8:return f=u.getBufferedRanges(),e.abrupt("return",{content:i,segment:o,buffered:f,segmentData:s});case 10:case"end":return e.stop()}}),e)}))),nt.apply(this,arguments)}function rt(){return rt=(0,w.Z)(I().mark((function e(t,n){var r,i,a,o,s,u,d,c,f,v,p,h,m,g,y,_,b,E,T,k,w,A,R;return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.playbackObserver,i=t.content,a=t.initSegmentUniqueId,o=t.parsedSegment,s=t.segment,u=t.segmentBuffer,null!==o.chunkData){e.next=3;break}return e.abrupt("return",null);case 3:if(null===n.cancellationError){e.next=5;break}throw n.cancellationError;case 5:return f=o.chunkData,v=o.chunkInfos,p=o.chunkOffset,h=o.chunkSize,m=o.appendWindow,g=i.representation.getMimeTypeString(),y=l.Z.getCurrent(),_=y.APPEND_WINDOW_SECURITIES,b=[void 0!==m[0]?Math.max(0,m[0]-_.START):void 0,void 0!==m[1]?m[1]+_.END:void 0],E={initSegmentUniqueId:a,chunk:f,timestampOffset:p,appendWindow:b,codec:g},T=null!==(d=null==v?void 0:v.time)&&void 0!==d?d:s.time,k=null!==(c=null==v?void 0:v.duration)&&void 0!==c?c:s.duration,w=T+k,void 0!==b[0]&&(T=Math.max(T,b[0])),void 0!==b[1]&&(w=Math.min(w,b[1])),A=(0,S.Z)({segment:s,chunkSize:h,start:T,end:w},i),e.next=18,et(r,u,{data:E,inventoryInfos:A},n);case 18:return R=u.getBufferedRanges(),e.abrupt("return",{content:i,segment:s,buffered:R,segmentData:f});case 20:case"end":return e.stop()}}),e)}))),rt.apply(this,arguments)}function it(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return at(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return at(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function at(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var ot=function(e,t,n){var r=e.content,i=e.options,a=e.playbackObserver,o=e.segmentBuffer,u=e.segmentFetcher,d=e.terminate,c=r.period,f=r.adaptation,v=r.representation,p=i.bufferGoal,h=i.maxBufferSize,m=i.drmSystemId,g=i.fastSwitchThreshold,y=f.type,_=new k.ZP;_.linkToSignal(n);var b=new k.ZP;b.linkToSignal(_.signal);var E={segment:v.index.getInitSegment(),uniqueId:null,isLoaded:!1};_.signal.register((function(){null!==E.uniqueId&&o.freeInitSegment(E.uniqueId)}));var w=(0,T.$l)({initSegment:null,segmentQueue:[]},b.signal),A=null!==E.segment;A||(E.isLoaded=!0);var I=!1;if(void 0!==m){var R=v.getEncryptionData(m);if(R.length>0&&R.every((function(e){return void 0!==e.keyIds}))&&(I=!0,t.encryptionDataEncountered(R.map((function(e){return(0,S.Z)({content:r},e)}))),_.isUsed()))return}var Z=new Ve(r,w,u,A);return Z.addEventListener("error",(function(e){b.signal.isCancelled()||(_.cancel(),t.error(e))})),Z.addEventListener("parsedInitSegment",P),Z.addEventListener("parsedMediaSegment",P),Z.addEventListener("emptyQueue",x),Z.addEventListener("requestRetry",(function(e){if(t.warning(e.error),!b.signal.isCancelled()){var n=e.segment,r=v.index;!1===r.isSegmentStillAvailable(n)?x():r.canBeOutOfSyncError(e.error,n)&&t.manifestMightBeOufOfSync()}})),Z.addEventListener("fullyLoadedSegment",(function(e){o.endOfSegment((0,S.Z)({segment:e},r),_.signal).catch(M)})),Z.start(),b.signal.register((function(){Z.removeEventListener(),Z.stop()})),a.listen(x,{includeLastObservation:!1,clearSignal:b.signal}),p.onUpdate(x,{emitCurrentValue:!1,clearSignal:b.signal}),h.onUpdate(x,{emitCurrentValue:!1,clearSignal:b.signal}),d.onUpdate(x,{emitCurrentValue:!1,clearSignal:b.signal}),void x();function x(){var e,n;if(!b.isUsed()){var i=a.getReference().getValue(),u=null!==(e=i.position.pending)&&void 0!==e?e:i.position.last,f=qe(r,u,a,g.getValue(),p.getValue(),h.getValue(),o),m=f.neededSegments,S=null;if(v.index.isInitialized()){if(m.length>0&&!E.isLoaded&&null!==E.segment){var T=m[0].priority;S={segment:E.segment,priority:T}}}else if(null===E.segment)s.Z.warn("Stream: Uninitialized index without an initialization segment");else if(E.isLoaded)s.Z.warn("Stream: Uninitialized index with an already loaded initialization segment");else{var k=null!==(n=i.position.pending)&&void 0!==n?n:i.position.last;S={segment:E.segment,priority:We(c.start,k)}}var A=d.getValue();if(null===A)w.setValue({initSegment:S,segmentQueue:m});else{if(A.urgent)return s.Z.debug("Stream: Urgent switch, terminate now.",y),w.setValue({initSegment:null,segmentQueue:[]}),w.finish(),b.cancel(),void t.terminating();var I=m[0],R=Z.getRequestedInitSegment(),x=Z.getRequestedMediaSegment(),P=null===x||void 0===I||x.id!==I.segment.id?[]:[I],C=null===R?null:S;if(w.setValue({initSegment:C,segmentQueue:P}),0===P.length&&null===C)return s.Z.debug("Stream: No request left, terminate",y),w.finish(),b.cancel(),void t.terminating()}if(t.streamStatusUpdate({period:c,position:i.position.last,bufferType:y,imminentDiscontinuity:f.imminentDiscontinuity,isEmptyStream:!1,hasFinishedLoading:f.hasFinishedLoading,neededSegments:f.neededSegments}),!b.signal.isCancelled()){var D=l.Z.getCurrent().UPTO_CURRENT_POSITION_CLEANUP;if(f.isBufferFull){var N=Math.max(0,u-D);N>0&&o.removeBuffer(0,N,_.signal).catch(M)}f.shouldRefreshManifest&&t.needsManifestRefresh()}}}function P(e){if(!_.isUsed()){for(var n,i=it(e.protectionData);!(n=i()).done;){var s=n.value;v.addProtectionData(s.initDataType,s.keyId,s.initData)}if(!I){var u=v.getAllEncryptionData();if(u.length>0&&(t.encryptionDataEncountered(u.map((function(e){return(0,S.Z)({content:r},e)}))),I=!0,_.isUsed()))return}if("init"!==e.segmentType){var l=e.inbandEvents,d=e.predictedSegments,c=e.needsManifestRefresh;if(!(void 0!==d&&v.index.addPredictedSegments(d,e.segment),!0===c&&(t.needsManifestRefresh(),_.isUsed())||void 0!==l&&l.length>0&&(t.inbandEvent(l),_.isUsed()))){var f=E.uniqueId;(function(e,t){return rt.apply(this,arguments)})({playbackObserver:a,content:r,initSegmentUniqueId:f,parsedSegment:e,segment:e.segment,segmentBuffer:o},_.signal).then((function(e){null!==e&&t.addedSegment(e)})).catch(M)}}else{if(v.index.isInitialized()||void 0===e.segmentList||v.index.initialize(e.segmentList),E.isLoaded=!0,null!==e.initializationData){var p=v.uniqueId;E.uniqueId=p,o.declareInitSegment(p,e.initializationData),function(e,t){return nt.apply(this,arguments)}({playbackObserver:a,content:r,initSegmentUniqueId:p,segment:e.segment,segmentData:e.initializationData,segmentBuffer:o},_.signal).then((function(e){null!==e&&t.addedSegment(e)})).catch(M)}x()}}}function M(e){_.isUsed()&&e instanceof k.FU||(_.cancel(),t.error(e))}};function st(e,t,n,r,i){i.isCancelled()||Le()((function(){e.listen((function(i){var a,o,s,u=e.getCurrentTime()+n;u=Math.min(Math.max(null!==(a=r.start)&&void 0!==a?a:0,u),null!==(o=r.end)&&void 0!==o?o:1/0);var l=!(null!==(s=i.paused.pending)&&void 0!==s?s:e.getIsPaused());t({position:u,autoPlay:l})}),{includeLastObservation:!0,clearSignal:i})}))}function ut(e,t){for(var n=0;n<e.length;n++)if(e[n].infos.period.start>=t.start)return n>0?e[n-1]:null;return e.length>0?e[e.length-1]:null}function lt(e,t){for(var n=0;n<e.length;n++)if(e[n].infos.period.start>t.start)return e[n];return null}function dt(e,t,n,r,i){if("lazy"===n.switchingMode)return{type:"continue",value:void 0};var a=r.getBufferedRanges();if(0===a.length)return{type:"continue",value:void 0};var o=(0,E.JN)(a),s=e.start,u=null==e.end?1/0:e.end,d=(0,E.tn)(o,[{start:s,end:u}]);if(0===d.length)return{type:"continue",value:void 0};r.synchronizeInventory();var c=r.getInventory(),f=function(e,t,n,r){return e.reduce((function(e,i){if(i.infos.period.id!==t.id||i.infos.adaptation.id!==n.id||!r.some((function(e){return e.id===i.infos.representation.id})))return e;var a=i.bufferedStart,o=i.bufferedEnd;return void 0===a||void 0===o||e.push({start:a,end:o}),e}),[])}(c,e,t,n.representations),v=(0,E.uH)(d,f);if(0===v.length)return{type:"continue",value:void 0};var p=i.getCurrentTime(),h=i.getReadyState();if("reload"===n.switchingMode&&(0,E.Ti)({start:s,end:u},p)&&h>1&&!(0,E.A1)(f,p))return{type:"needs-reload",value:void 0};var m="direct"===n.switchingMode,g=[],y=ut(c,e);if(null!==y&&(void 0===y.bufferedEnd||e.start-y.bufferedEnd<1)&&g.push({start:0,end:e.start+1}),!m){var _=l.Z.getCurrent().ADAP_REP_SWITCH_BUFFER_PADDINGS,b=t.type,S=_[b].before;null==S&&(S=0);var T=_[b].after;null==T&&(T=0),g.push({start:p-S,end:p+T})}if(void 0!==e.end){var k=lt(c,e);null!==k&&(void 0===k.bufferedStart||k.bufferedStart-e.end<1)&&g.push({start:e.end-1,end:Number.MAX_VALUE})}var w=(0,E.uH)(v,g);return 0===w.length?{type:"continue",value:void 0}:m?{type:"flush-buffer",value:w}:{type:"clean-buffer",value:w}}function ct(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return ft(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ft(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ft(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var vt=function(e,t,n){var r=e.playbackObserver,i=e.content,a=e.options,o=e.representationEstimator,u=e.segmentBuffer,c=e.segmentFetcherCreator,f=e.wantedBufferAhead,v=e.maxVideoBufferSize,p=i.manifest,h=i.period,m=i.adaptation,y=new k.ZP;y.linkToSignal(n);var _,b,E=new Map,A=(0,T.$l)(null,y.signal),R=(0,T.$l)(i.representations.getValue().representations,y.signal),Z=o({manifest:p,period:h,adaptation:m},A,R,r,y.signal),x=Z.estimates,P=Z.callbacks,M=c.createSegmentFetcher(m.type,{onRequestBegin:P.requestBegin,onRequestEnd:P.requestEnd,onProgress:P.requestProgress,onMetrics:P.metrics}),C=(0,T.$l)(0);return x.onUpdate((function(e){var n=e.bitrate,r=e.knownStableBitrate;a.enableFastSwitching&&C.setValueIfChanged(r),void 0!==n&&n!==_&&(_=n,s.Z.debug("Stream: new "+m.type+" bitrate estimate",n),t.bitrateEstimateChange({type:m.type,bitrate:n}))}),{emitCurrentValue:!0,clearSignal:y.signal}),void i.representations.onUpdate((function(e){void 0!==b&&b.cancel(),R.setValueIfChanged(e.representations),(b=new k.ZP).linkToSignal(y.signal),function(e,t){return D.apply(this,arguments)}(e,b.signal).catch((function(e){!0===(null==b?void 0:b.isUsed())&&k.ZP.isCancellationError(e)||(y.cancel(),t.error(e))}))}),{clearSignal:y.signal,emitCurrentValue:!0});function D(){return(D=(0,w.Z)(I().mark((function e(n,i){var a,o,s,d,c,f,v;return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:a=dt(h,m,n,u,r),e.t0=a.type,e.next="continue"===e.t0?4:"needs-reload"===e.t0?5:"flush-buffer"===e.t0||"clean-buffer"===e.t0?8:22;break;case 4:return e.abrupt("break",23);case 5:return o=l.Z.getCurrent(),s=o.DELTA_POSITION_AFTER_RELOAD,d=m.type,e.abrupt("return",st(r,(function(e){var n=e.position,r=e.autoPlay;t.waitingMediaSourceReload({bufferType:d,period:h,position:n,autoPlay:r})}),s.bitrateSwitch,h,i));case 8:c=ct(a.value);case 9:if((f=c()).done){e.next=17;break}return v=f.value,e.next=13,u.removeBuffer(v.start,v.end,i);case 13:if(!i.isCancelled()){e.next=15;break}return e.abrupt("return");case 15:e.next=9;break;case 17:if("flush-buffer"!==a.type){e.next=21;break}if(t.needsBufferFlush(),!i.isCancelled()){e.next=21;break}return e.abrupt("return");case 21:return e.abrupt("break",23);case 22:(0,g.Z)(a);case 23:O(i);case 24:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function O(e){var n=new k.ZP;n.linkToSignal(e);var r=x.getValue().representation;if(null!==r){var i=(0,T.$l)(null,n.signal);x.onUpdate((function(e){if(null!==e.representation&&e.representation.id!==r.id)return e.urgent?(s.Z.info("Stream: urgent Representation switch",m.type),i.setValue({urgent:!0})):(s.Z.info("Stream: slow Representation switch",m.type),i.setValue({urgent:!1}))}),{clearSignal:n.signal,emitCurrentValue:!0});var a={type:m.type,period:h,representation:r};if(A.setValue(r),!y.isUsed()&&(t.representationChange(a),!y.isUsed())){var o={streamStatusUpdate:t.streamStatusUpdate,encryptionDataEncountered:t.encryptionDataEncountered,manifestMightBeOufOfSync:t.manifestMightBeOufOfSync,needsManifestRefresh:t.needsManifestRefresh,inbandEvent:t.inbandEvent,warning:t.warning,error:function(e){y.cancel(),t.error(e)},addedSegment:function(e){P.addedSegment(e),y.isUsed()||t.addedSegment(e)},terminating:function(){if(!n.isUsed())return n.cancel(),O(e)}};L(r,i,o,e)}}}function L(e,n,i,o){var l=new k.ZP;l.linkToSignal(o);var c=(0,T.lR)(f,(function(t){return t*function(e){var t=E.get(e.id),n=void 0!==t?t:1;void 0===t&&E.set(e.id,n);return n}(e)}),l.signal),g="video"===m.type?v:(0,T.$l)(1/0);s.Z.info("Stream: changing representation",m.type,e.id,e.bitrate);var _=(0,S.Z)({},i,{error:function(t){var r,a=(0,d.Z)(t,{defaultCode:"NONE",defaultReason:"Unknown `RepresentationStream` error"});if("BUFFER_FULL_ERROR"!==a.code)i.error(t);else{var s=f.getValue(),u=.7*(null!==(r=E.get(e.id))&&void 0!==r?r:1);if(u<=.05||s*u<=2)throw a;E.set(e.id,u),(0,le.Z)(4e3,y.signal).then((function(){return L(e,n,i,o)})).catch(N.Z)}},terminating:function(){l.cancel(),i.terminating()}});ot({playbackObserver:r,content:{representation:e,adaptation:m,period:h,manifest:p},segmentBuffer:u,segmentFetcher:M,terminate:n,options:{bufferGoal:c,maxBufferSize:g,drmSystemId:a.drmSystemId,fastSwitchThreshold:C}},_,o),p.addEventListener("manifestUpdate",(function(e){for(var n,i=ct(e.updatedPeriods);!(n=i()).done;){var a=n.value;if(a.period.id===h.id)for(var s,u=function(){if(s.value.id===m.id){var e=m.type;return{v:st(r,(function(n){var r=n.position,i=n.autoPlay;t.waitingMediaSourceReload({bufferType:e,period:h,position:r,autoPlay:i})}),0,h,o)}}},l=ct(a.result.removedAdaptations);!(s=l()).done;){var d=u();if("object"==typeof d)return d.v}else if(a.period.start>h.start)break}}),o)}},pt=n(9252);var ht=function(e,t){var n=e.split(";"),r=n[0],i=n.slice(1),a=t.split(";"),o=a[0],s=a.slice(1);if(r!==o)return!1;var u=(0,p.Z)(i,(function(e){return(0,pt.Z)(e,"codecs=")})),l=(0,p.Z)(s,(function(e){return(0,pt.Z)(e,"codecs=")}));if(void 0===u||void 0===l)return!1;var d=u.substring(7),c=l.substring(7);return d.split(".")[0]===c.split(".")[0]};function mt(e,t,n,r,i,a){if(void 0!==e.codec&&"reload"===a.onCodecSwitch&&!function(e,t){return e.getPlayableRepresentations().some((function(e){return ht(e.getMimeTypeString(),t)}))}(n,e.codec))return{type:"needs-reload",value:void 0};var o=e.getBufferedRanges();if(0===o.length)return{type:"continue",value:void 0};var s=(0,E.JN)(o),u=t.start,d=null==t.end?1/0:t.end,c=(0,E.tn)(s,[{start:u,end:d}]);if(0===c.length)return{type:"continue",value:void 0};e.synchronizeInventory();var f=e.getInventory();if(!f.some((function(e){return e.infos.period.id===t.id&&e.infos.adaptation.id!==n.id})))return{type:"continue",value:void 0};var v=function(e,t,n){return e.reduce((function(e,r){if(r.infos.period.id!==t.id||r.infos.adaptation.id!==n.id)return e;var i=r.bufferedStart,a=r.bufferedEnd;return void 0===i||void 0===a||e.push({start:i,end:a}),e}),[])}(f,t,n),p=(0,E.uH)(c,v);if(0===p.length)return{type:"continue",value:void 0};var h=i.currentTime;if("reload"===r&&(0,E.Ti)({start:u,end:d},h)&&(i.readyState>1||!n.getPlayableRepresentations().some((function(t){var n;return ht(t.getMimeTypeString(),null!==(n=e.codec)&&void 0!==n?n:"")})))&&!(0,E.A1)(v,h))return{type:"needs-reload",value:void 0};var m="direct"===r,g=[],y=ut(f,t);null!==y&&(void 0===y.bufferedEnd||t.start-y.bufferedEnd<1)&&g.push({start:0,end:t.start+1});var _=n.type,b=l.Z.getCurrent().ADAP_REP_SWITCH_BUFFER_PADDINGS,S=b[_].before;null==S&&(S=0);var T=b[_].after;if(null==T&&(T=0),m||g.push({start:h-S,end:h+T}),void 0!==t.end){var k=lt(f,t);null!==k&&(void 0===k.bufferedStart||k.bufferedStart-t.end<1)&&g.push({start:t.end-1,end:Number.MAX_VALUE})}var w=(0,E.uH)(p,g);return 0===w.length?{type:"continue",value:void 0}:m&&"text"!==n.type?{type:"flush-buffer",value:w}:{type:"clean-buffer",value:w}}function gt(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return yt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return yt(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function yt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function _t(e,t,n,r){var i=e.getStatus(t);if("initialized"===i.type)return s.Z.info("Stream: Reusing a previous SegmentBuffer for the type",t),i.value;var a=function(e){var t=e.getPlayableRepresentations();if(0===t.length){throw new c.Z("NO_PLAYABLE_REPRESENTATION","No Representation in the chosen "+e.type+" Adaptation can be played",{adaptation:e})}return t[0].getMimeTypeString()}(n),o="text"===t?r.textTrackOptions:void 0;return e.createSegmentBuffer(t,a,o)}function bt(e,t,n,r,i,a){var o=r.period,u=!1;function l(){var r=e.getReference().getValue(),a=t.getValue(),l=r.position.last;void 0!==o.end&&l+a>=o.end&&(s.Z.debug('Stream: full "empty" AdaptationStream',n),u=!0),i.streamStatusUpdate({period:o,bufferType:n,position:l,imminentDiscontinuity:null,isEmptyStream:!0,hasFinishedLoading:u,neededSegments:[]})}t.onUpdate(l,{emitCurrentValue:!1,clearSignal:a}),e.listen(l,{includeLastObservation:!1,clearSignal:a}),l()}var St=function(e,t,n){var r=e.bufferType,i=e.content,a=e.garbageCollectors,o=e.playbackObserver,u=e.representationEstimator,c=e.segmentFetcherCreator,f=e.segmentBuffersStore,v=e.options,p=e.wantedBufferAhead,h=e.maxVideoBufferSize,m=i.manifest,g=i.period,y=(0,T.ZP)(void 0,n);if(t.periodStreamReady({type:r,manifest:m,period:g,adaptationRef:y}),!n.isCancelled()){var _,b=!0;y.onUpdate((function(e){(0,w.Z)(I().mark((function i(){var u,d,c,h,y,S,E,T,w,R,Z,x,P,M,C,D,N,O;return I().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(void 0!==e){i.next=2;break}return i.abrupt("return");case 2:if((d=new k.ZP).linkToSignal(n),null==_||_.cancel(),_=d,null!==e){i.next=34;break}if(s.Z.info("Stream: Set no "+r+" Adaptation. P:",g.start),"initialized"!==(c=f.getStatus(r)).type){i.next=26;break}if(s.Z.info("Stream: Clearing previous "+r+" SegmentBuffer"),!Ne.isNative(r)){i.next=15;break}return i.abrupt("return",st(o,(function(e){var n=e.position,i=e.autoPlay;t.waitingMediaSourceReload({bufferType:r,period:g,position:n,autoPlay:i})}),0,g,d.signal));case 15:if(h=null!==(u=g.end)&&void 0!==u?u:1/0,!(g.start>h)){i.next=20;break}s.Z.warn("Stream: Can't free buffer: period's start is after its end"),i.next=24;break;case 20:return i.next=22,c.value.removeBuffer(g.start,h,d.signal);case 22:if(!d.isUsed()){i.next=24;break}return i.abrupt("return");case 24:i.next=30;break;case 26:if("uninitialized"!==c.type){i.next=30;break}if(f.disableSegmentBuffer(r),!d.isUsed()){i.next=30;break}return i.abrupt("return");case 30:if(t.adaptationChange({type:r,adaptation:null,period:g}),!d.isUsed()){i.next=33;break}return i.abrupt("return");case 33:return i.abrupt("return",bt(o,p,r,{period:g},t,d.signal));case 34:if(y=l.Z.getCurrent(),S=y.DELTA_POSITION_AFTER_RELOAD,E=b?0:"audio"===r?S.trackSwitch.audio:"video"===r?S.trackSwitch.video:S.trackSwitch.other,b=!1,!Ne.isNative(r)||"disabled"!==f.getStatus(r).type){i.next=39;break}return i.abrupt("return",st(o,(function(e){var n=e.position,i=e.autoPlay;t.waitingMediaSourceReload({bufferType:r,period:g,position:n,autoPlay:i})}),E,g,d.signal));case 39:if(m.addEventListener("manifestUpdate",(function(e){for(var n,i=gt(e.updatedPeriods);!(n=i()).done;){var a=n.value;if(a.period.id===g.id)for(var s,u=gt(a.result.removedAdaptations);!(s=u()).done;){if(s.value.id===T.id)return st(o,(function(e){var n=e.position,i=e.autoPlay;t.waitingMediaSourceReload({bufferType:r,period:g,position:n,autoPlay:i})}),E,g,d.signal)}else if(a.period.start>g.start)break}}),_.signal),T=e.adaptation,w=e.representations,s.Z.info("Stream: Updating "+r+" adaptation","A: "+T.id,"P: "+g.start),t.adaptationChange({type:r,adaptation:T,period:g}),!d.isUsed()){i.next=45;break}return i.abrupt("return");case 45:if(R=o.getReadyState(),Z=_t(f,r,T,v),x={currentTime:o.getCurrentTime(),readyState:R},"needs-reload"!==(P=mt(Z,g,T,e.switchingMode,x,v)).type){i.next=51;break}return i.abrupt("return",st(o,(function(e){var n=e.position,i=e.autoPlay;t.waitingMediaSourceReload({bufferType:r,period:g,position:n,autoPlay:i})}),E,g,d.signal));case 51:return i.next=53,f.waitForUsableBuffers(d.signal);case 53:if(!d.isUsed()){i.next=55;break}return i.abrupt("return");case 55:if("flush-buffer"!==P.type&&"clean-buffer"!==P.type){i.next=69;break}M=gt(P.value);case 57:if((C=M()).done){i.next=65;break}return D=C.value,N=D.start,O=D.end,i.next=61,Z.removeBuffer(N,O,d.signal);case 61:if(!d.isUsed()){i.next=63;break}return i.abrupt("return");case 63:i.next=57;break;case 65:if("flush-buffer"!==P.type){i.next=69;break}if(t.needsBufferFlush(),!d.isUsed()){i.next=69;break}return i.abrupt("return");case 69:a.get(Z)(d.signal),A(T,w,Z,d.signal);case 71:case"end":return i.stop()}}),i)})))().catch((function(e){e instanceof k.FU||(null==_||_.cancel(),t.error(e))}))}),{clearSignal:n,emitCurrentValue:!0})}function A(e,n,i,a){var l=function(e,t){return e.deriveReadOnlyObserver((function(e,n){var r=(0,T.ZP)(i(),n);return e.onUpdate(a,{clearSignal:n,emitCurrentValue:!1}),r;function i(){var n=e.getValue(),r=t.getBufferedRanges(),i=(0,E.L7)(r,n.position.last);return(0,S.Z)({},n,{bufferGap:i})}function a(){r.setValue(i())}}))}(o,i);vt({content:{manifest:m,period:g,adaptation:e,representations:n},options:v,playbackObserver:l,representationEstimator:u,segmentBuffer:i,segmentFetcherCreator:c,wantedBufferAhead:p,maxVideoBufferSize:h},Object.assign(Object.assign({},t),{error:function(e){if(!Ne.isNative(r)){s.Z.error("Stream: "+r+" Stream crashed. Aborting it.",e instanceof Error?e:""),f.disposeSegmentBuffer(r);var n=(0,d.Z)(e,{defaultCode:"NONE",defaultReason:"Unknown `AdaptationStream` error"});if(t.warning(n),a.isCancelled())return;return bt(o,p,r,{period:g},t,a)}s.Z.error("Stream: "+r+" Stream crashed. Stopping playback.",e instanceof Error?e:""),t.error(e)}}),a)}};function Et(e,t){if(0===t.length)return[];e.synchronizeInventory();for(var n=[],r=e.getInventory(),i=function(){var i=r[a];if(t.some((function(e){return i.infos.period.id===e.period.id&&i.infos.adaptation.id===e.adaptation.id&&i.infos.representation.id===e.representation.id}))){var o=i.bufferedStart,u=i.bufferedEnd;if(void 0===o||void 0===u){s.Z.warn("SO: No buffered start or end found from a segment.");var l=e.getBufferedRanges(),d=l.length;return 0===d?{v:[]}:{v:[{start:l.start(0),end:l.end(d-1)}]}}var c=n[n.length-1];void 0!==c&&c.end===o?c.end=u:n.push({start:o,end:u})}},a=0;a<r.length;a++){var o=i();if("object"==typeof o)return o.v}return n}function Tt(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return kt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return kt(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function kt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function wt(e,t){if(0===t.length)return!1;var n=e.position.last;return e.speed>=0?t[t.length-1].end>=n-5:t[0].start<=n+5}var At=function(e,t,n,r,i,a,o,u){for(var d,f=e.manifest,v=e.initialPeriod,p=a.maxBufferAhead,h=a.maxBufferBehind,m=a.wantedBufferAhead,g=a.maxVideoBufferSize,y=l.Z.getCurrent(),_=y.MAXIMUM_MAX_BUFFER_AHEAD,b=y.MAXIMUM_MAX_BUFFER_BEHIND,S=new Be((function(e){var n=e.bufferType,r=null!=b[n]?b[n]:1/0,i=null!=_[n]?_[n]:1/0;return function(n){Fe({segmentBuffer:e,playbackObserver:t,maxBufferBehind:(0,T.lR)(h,(function(e){return Math.min(e,r)}),n),maxBufferAhead:(0,T.lR)(p,(function(e){return Math.min(e,i)}),n)},n)}})),E=Tt(r.getBufferTypes());!(d=E()).done;){A(d.value,v)}function A(e,n){var i=new Ue((function(e,t){return e.start-t.start})),a=!1,l=new k.ZP;return l.linkToSignal(u),t.listen((function(t){var n,r,c=t.position,v=null!==(n=c.pending)&&void 0!==n?n:c.last;if(a&&function(e){var t=i.head(),n=i.last();if(null==t||null==n)return!0;return t.start>e||(null==n.end?1/0:n.end)<e}(v)){for(s.Z.info("Stream: Destroying all PeriodStreams due to out of bounds situation",e,v),a=!1;i.length()>0;){var p=i.get(i.length()-1);i.removeElement(p),o.periodStreamCleared({type:e,manifest:f,period:p})}l.cancel(),(l=new k.ZP).linkToSignal(u);var h=null!==(r=f.getPeriodForTime(v))&&void 0!==r?r:f.getNextPeriod(v);void 0!==h?d(h):s.Z.warn("Stream: The wanted position is not found in the Manifest.")}}),{clearSignal:u,includeLastObservation:!0}),f.addEventListener("decipherabilityUpdate",(function(e){u.isCancelled()||function(e){return v.apply(this,arguments)}(e).catch((function(e){u.isCancelled()||(l.cancel(),o.error(e))}))}),u),d(n);function d(t){var n=Object.assign(Object.assign({},o),{waitingMediaSourceReload:function(e){var t=i.head();if(void 0===t||t.id!==e.period.id)o.lockedStream({bufferType:e.bufferType,period:e.period});else{var n=e.position,r=e.autoPlay;o.needsMediaSourceReload({position:n,autoPlay:r})}},periodStreamReady:function(e){a=!0,i.add(e.period),o.periodStreamReady(e)},periodStreamCleared:function(e){i.removeElement(e.period),o.periodStreamCleared(e)},error:function(e){l.cancel(),o.error(e)}});R(e,t,n,l.signal)}function v(){return v=(0,w.Z)(I().mark((function n(v){var p,h,m,g,y,_,b,S,E,T,w,A,R;return I().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(p=r.getStatus(e),0!==(h=v.filter((function(t){return t.adaptation.type===e}))).length&&"initialized"===p.type&&!h.every((function(e){return!0===e.representation.decipherable}))){n.next=4;break}return n.abrupt("return");case 4:for(m=p.value,g=h.filter((function(e){return void 0===e.representation.decipherable})),y=h.filter((function(e){return!1===e.representation.decipherable})),_=Et(m,y),b=Et(m,g),a=!1,s.Z.info("Stream: Destroying all PeriodStreams for decipherability matters",e);i.length()>0;)S=i.get(i.length()-1),i.removeElement(S),o.periodStreamCleared({type:e,manifest:f,period:S});l.cancel(),(l=new k.ZP).linkToSignal(u),E=0,T=[].concat(_,b);case 16:if(!(E<T.length)){n.next=24;break}if(w=T[E],A=w.start,R=w.end,!(A<R)){n.next=21;break}return n.next=21,m.removeBuffer(A,R,u);case 21:E++,n.next=16;break;case 24:Le()((function(){var e,n;if(!u.isCancelled()){var r=t.getReference().getValue();if(wt(r,_)){var i=!(null!==(e=r.paused.pending)&&void 0!==e?e:t.getIsPaused());if(o.needsDecipherabilityFlush({position:r.position.last,autoPlay:i,duration:r.duration}),u.isCancelled())return}else if(wt(r,b)&&(o.needsBufferFlush(),u.isCancelled()))return;var a=null!==(n=r.position.pending)&&void 0!==n?n:r.position.last,s=f.getPeriodForTime(a);null!=s?d(s):o.error(new c.Z("MEDIA_TIME_NOT_FOUND","The wanted position is not found in the Manifest."))}}));case 25:case"end":return n.stop()}}),n)}))),v.apply(this,arguments)}}function R(e,o,u,l){s.Z.info("Stream: Creating new Stream for",e,o.start);var d=null,c=new k.ZP;c.linkToSignal(l),t.listen((function(t,n){var r,i,a=t.position;void 0!==o.end&&(null!==(r=a.pending)&&void 0!==r?r:a.last)>=o.end&&(s.Z.info("Stream: Destroying PeriodStream as the current playhead moved above it",e,o.start,null!==(i=a.pending)&&void 0!==i?i:a.last,o.end),n(),u.periodStreamCleared({type:e,manifest:f,period:o}),c.cancel())}),{clearSignal:l,includeLastObservation:!0});var v,p={bufferType:e,content:{manifest:f,period:o},garbageCollectors:S,maxVideoBufferSize:g,segmentFetcherCreator:i,segmentBuffersStore:r,options:a,playbackObserver:t,representationEstimator:n,wantedBufferAhead:m},h=Object.assign(Object.assign({},u),{streamStatusUpdate:function(t){if(t.hasFinishedLoading){var n=f.getPeriodAfter(o);null!==n&&function(t){if(null!==d){if(d.period.id===t.id)return;s.Z.warn("Stream: Creating next `PeriodStream` while one was already created.",e,t.id,d.period.id),u.periodStreamCleared({type:e,manifest:f,period:d.period}),d.canceller.cancel()}var n=new k.ZP;n.linkToSignal(l),d={canceller:n,period:t},R(e,t,u,d.canceller.signal)}(n)}else null!==d&&(s.Z.info("Stream: Destroying next PeriodStream due to current one being active",e,d.period.start),u.periodStreamCleared({type:e,manifest:f,period:d.period}),d.canceller.cancel(),d=null);u.streamStatusUpdate(t)},error:function(e){null!==d&&(d.canceller.cancel(),d=null),c.cancel(),u.error(e)}});St(p,h,c.signal),v=c.signal,f.addEventListener("manifestUpdate",(function(n){for(var r,i=function(){var n=r.value;if(n.id===o.id)f.periods.length>0&&f.periods[0].start<=n.start&&st(t,(function(t){var r=t.position,i=t.autoPlay;u.waitingMediaSourceReload({bufferType:e,period:n,position:r,autoPlay:i})}),0,{start:void 0,end:void 0},v);else if(n.start>o.start)return"break"},a=Tt(n.removedPeriods);!(r=a()).done&&"break"!==i(););if(n.addedPeriods.length>0&&null!==d){var l=f.getPeriodAfter(o);null!==l&&d.period.id===l.id||(s.Z.warn("Stream: Destroying next PeriodStream due to new one being added",e,d.period.start),u.periodStreamCleared({type:e,manifest:f,period:d.period}),d.canceller.cancel(),d=null)}}),v)}},It=At,Rt=n(379);function Zt(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return xt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return xt(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function xt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Pt=function(e){function n(t,n,r){var i;(i=e.call(this)||this)._canceller=new k.ZP,i._manifest=t,i._activeStreams=new Map,i._allBufferTypes=r,i._lastCurrentPeriodId=null;var a=new Mt(t);i._maximumPositionCalculator=a;var o=i._canceller.signal;return n.listen((function(e){var n,r=e.position,o=null!==(n=r.pending)&&void 0!==n?n:r.last;if(o<t.getMinimumSafePosition()){var s=new c.Z("MEDIA_TIME_BEFORE_MANIFEST","The current position is behind the earliest time announced in the Manifest.");i.trigger("warning",s)}else if(o>a.getMaximumAvailablePosition()){var u=new c.Z("MEDIA_TIME_AFTER_MANIFEST","The current position is after the latest time announced in the Manifest.");i.trigger("warning",u)}}),{includeLastObservation:!0,clearSignal:o}),t.addEventListener("manifestUpdate",(function(){i.trigger("durationUpdate",i._getManifestDuration()),o.isCancelled()||i._checkEndOfStream()}),o),i}(0,t.Z)(n,e);var r=n.prototype;return r.getCurrentDuration=function(){return this._getManifestDuration()},r.onAdaptationChange=function(e,t,n){if(this._manifest.isLastPeriodKnown){var r=this._manifest.periods[this._manifest.periods.length-1];if(t.id===(null==r?void 0:r.id)&&("audio"===e||"video"===e)){"audio"===e?this._maximumPositionCalculator.updateLastAudioAdaptation(n):this._maximumPositionCalculator.updateLastVideoAdaptation(n);var i=this._maximumPositionCalculator.getEndingPosition(),a=void 0!==i?{isEnd:!0,duration:i}:{isEnd:!1,duration:this._maximumPositionCalculator.getMaximumAvailablePosition()};this.trigger("durationUpdate",a)}}this._canceller.isUsed()||null===n&&this._addActivelyLoadedPeriod(t,e)},r.onRepresentationChange=function(e,t){this._addActivelyLoadedPeriod(t,e)},r.onPeriodCleared=function(e,t){this._removeActivelyLoadedPeriod(t,e)},r.onLastSegmentFinishedLoading=function(e){var t=this._lazilyCreateActiveStreamInfo(e);t.hasFinishedLoadingLastPeriod||(t.hasFinishedLoadingLastPeriod=!0,this._checkEndOfStream())},r.onLastSegmentLoadingResume=function(e){var t=this._lazilyCreateActiveStreamInfo(e);t.hasFinishedLoadingLastPeriod&&(t.hasFinishedLoadingLastPeriod=!1,this._checkEndOfStream())},r.dispose=function(){this.removeEventListener(),this._canceller.cancel()},r._addActivelyLoadedPeriod=function(e,t){var n=this._lazilyCreateActiveStreamInfo(t);n.activePeriods.has(e)||(n.activePeriods.add(e),this._checkCurrentPeriod())},r._removeActivelyLoadedPeriod=function(e,t){var n=this._activeStreams.get(t);void 0!==n&&n.activePeriods.has(e)&&(n.activePeriods.removeElement(e),this._checkCurrentPeriod())},r._checkCurrentPeriod=function(){var e=this;if(0!==this._allBufferTypes.length){var t=this._activeStreams.get(this._allBufferTypes[0]);if(void 0!==t)for(var n,r=function(){for(var t=n.value,r=!0,i=1;i<e._allBufferTypes.length;i++){var a=e._activeStreams.get(e._allBufferTypes[i]);if(void 0===a)return{v:void 0};if(!a.activePeriods.toArray().some((function(e){return e.id===t.id}))){r=!1;break}}if(r)return e._lastCurrentPeriodId!==t.id&&(e._lastCurrentPeriodId=t.id,e.trigger("periodChange",t)),{v:void 0}},i=Zt(t.activePeriods.toArray());!(n=i()).done;){var a=r();if("object"==typeof a)return a.v}}},r._getManifestDuration=function(){var e=this._maximumPositionCalculator.getEndingPosition();return void 0!==e?{isEnd:!0,duration:e}:{isEnd:!1,duration:this._maximumPositionCalculator.getMaximumAvailablePosition()}},r._lazilyCreateActiveStreamInfo=function(e){var t=this._activeStreams.get(e);return void 0===t&&(t={activePeriods:new Ue((function(e,t){return e.start-t.start})),hasFinishedLoadingLastPeriod:!1},this._activeStreams.set(e,t)),t},r._checkEndOfStream=function(){var e=this;this._manifest.isLastPeriodKnown&&(this._allBufferTypes.every((function(t){var n=e._activeStreams.get(t);return void 0!==n&&n.hasFinishedLoadingLastPeriod}))?this.trigger("endOfStream",null):this.trigger("resumeStream",null))},n}(y.Z),Mt=function(){function e(e){this._manifest=e,this._lastAudioAdaptation=void 0,this._lastVideoAdaptation=void 0}var t=e.prototype;return t.updateLastAudioAdaptation=function(e){this._lastAudioAdaptation=e},t.updateLastVideoAdaptation=function(e){this._lastVideoAdaptation=e},t.getMaximumAvailablePosition=function(){var e;if(this._manifest.isDynamic)return null!==(e=this._manifest.getLivePosition())&&void 0!==e?e:this._manifest.getMaximumSafePosition();if(void 0===this._lastVideoAdaptation||void 0===this._lastAudioAdaptation)return this._manifest.getMaximumSafePosition();if(null===this._lastAudioAdaptation){if(null===this._lastVideoAdaptation)return this._manifest.getMaximumSafePosition();var t=Ct(this._lastVideoAdaptation);return"number"!=typeof t?this._manifest.getMaximumSafePosition():t}if(null===this._lastVideoAdaptation){var n=Ct(this._lastAudioAdaptation);return"number"!=typeof n?this._manifest.getMaximumSafePosition():n}var r=Ct(this._lastAudioAdaptation),i=Ct(this._lastVideoAdaptation);return"number"!=typeof r||"number"!=typeof i?this._manifest.getMaximumSafePosition():Math.min(r,i)},t.getEndingPosition=function(){var e,t;if(!this._manifest.isDynamic)return this.getMaximumAvailablePosition();if(void 0!==this._lastVideoAdaptation&&void 0!==this._lastAudioAdaptation){if(null===this._lastAudioAdaptation)return null===this._lastVideoAdaptation?void 0:null!==(e=Dt(this._lastVideoAdaptation))&&void 0!==e?e:void 0;if(null===this._lastVideoAdaptation)return null!==(t=Dt(this._lastAudioAdaptation))&&void 0!==t?t:void 0;var n=Dt(this._lastAudioAdaptation),r=Dt(this._lastVideoAdaptation);return"number"!=typeof n||"number"!=typeof r?void 0:Math.min(n,r)}},e}();function Ct(e){for(var t,n=e.representations,r=null,i=0;i<n.length;i++)if(n[i].index!==t){t=n[i].index;var a=n[i].index.getLastAvailablePosition();if(void 0===a)return;null!==a&&(r=(0,b.Z)(r)?a:Math.min(r,a))}return r}function Dt(e){for(var t,n=e.representations,r=null,i=0;i<n.length;i++)if(n[i].index!==t){t=n[i].index;var a=n[i].index.getEnd();if(void 0===a)return;null!==a&&(r=(0,b.Z)(r)?a:Math.min(r,a))}return r}var Nt=n(5767),Ot=n(3774),Lt=n(6923);function Ut(e,t,n){if(null!==t&&"closed"!==t.readyState){for(var r=t.readyState,i=t.sourceBuffers,a=i.length-1;a>=0;a--){var o=i[a];try{"open"===r&&(s.Z.info("Init: Removing SourceBuffer from mediaSource"),o.abort()),t.removeSourceBuffer(o)}catch(e){s.Z.warn("Init: Error while disposing SourceBuffer",e instanceof Error?e:"")}}i.length>0&&s.Z.warn("Init: Not all SourceBuffers could have been removed.")}if((0,Nt.Z)(e),null!==n)try{s.Z.debug("Init: Revoking previous URL"),URL.revokeObjectURL(n)}catch(e){s.Z.warn("Init: Error while revoking the media source URL",e instanceof Error?e:"")}}function Bt(e,t){return(0,D.Z)(t,(function(n){var r=function(e,t){if(null==Ot.J)throw new c.Z("MEDIA_SOURCE_NOT_SUPPORTED","No MediaSource Object was found in the current browser.");var n=(0,Lt.Z)(e.src)?e.src:null;Ut(e,null,n),s.Z.info("Init: Creating MediaSource");var r=new Ot.J,i=URL.createObjectURL(r);return s.Z.info("Init: Attaching MediaSource URL to the media element",i),e.src=i,t.register((function(){Ut(e,r,i)})),r}(e,t);i.u_(r,(function(){n(r)}),t)}))}function Ft(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return zt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return zt(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function zt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Vt=i.x6,Kt=i.u_,Gt=i.y4;function jt(e,t){if(s.Z.debug("Init: Trying to call endOfStream"),"open"===e.readyState){var n=e.sourceBuffers,r=function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n];r.updating&&t.push(r)}return t}(n);if(0===r.length)return s.Z.info("Init: Triggering end of stream"),void e.endOfStream();s.Z.debug("Init: Waiting SourceBuffers to be updated before calling endOfStream.");var i=new k.ZP;i.linkToSignal(t);for(var a,o=Ft(r);!(a=o()).done;){var u=a.value;Gt(u,(function(){i.cancel(),jt(e,t)}),i.signal)}Vt(n,(function(){i.cancel(),jt(e,t)}),i.signal)}else s.Z.debug("Init: MediaSource not open, cancel endOfStream")}function Ht(e,t,n){if(!(0,b.Z)(n)){var r,i=e.getMinimumSafePosition();if(e.isLive&&(r=e.getLivePosition()),void 0===r&&(r=e.getMaximumSafePosition()),!(0,b.Z)(n.position))return s.Z.debug("Init: using startAt.minimumPosition"),Math.max(Math.min(n.position,r),i);if(!(0,b.Z)(n.wallClockTime)){s.Z.debug("Init: using startAt.wallClockTime");var a=void 0===e.availabilityStartTime?0:e.availabilityStartTime,o=n.wallClockTime-a;return Math.max(Math.min(o,r),i)}if(!(0,b.Z)(n.fromFirstPosition)){s.Z.debug("Init: using startAt.fromFirstPosition");var u=n.fromFirstPosition;return u<=0?i:Math.min(r,i+u)}if(!(0,b.Z)(n.fromLastPosition)){s.Z.debug("Init: using startAt.fromLastPosition");var d=n.fromLastPosition;return d>=0?r:Math.max(i,r+d)}if(!(0,b.Z)(n.percentage)){s.Z.debug("Init: using startAt.percentage");var c=n.percentage;return c>100?r:c<0?i:i+(r-i)*(+c/100)}}var f=e.getMinimumSafePosition();if(e.isLive){var v,p=e.suggestedPresentationDelay,h=e.clockOffset,m=e.getMaximumSafePosition(),g=l.Z.getCurrent().DEFAULT_LIVE_GAP;if(void 0===h)s.Z.info("Init: no clock offset found for a live content, starting close to maximum available position"),v=m;else{s.Z.info("Init: clock offset found for a live content, checking if we can start close to it");var y=void 0===e.availabilityStartTime?0:e.availabilityStartTime,_=(performance.now()+h)/1e3-y;v=Math.min(m,_)}var S=void 0!==p?p:t?g.LOW_LATENCY:g.DEFAULT;return s.Z.debug("Init: "+v+" defined as the live time, applying a live gap of "+S),Math.max(v-S,f)}return s.Z.info("Init: starting at the minimum available position:",f),f}var Wt=n(1757),qt=n(8833),Yt=n(8799);var Xt=31536e3,Qt=function(){function e(e){this._mediaSource=e,this._currentMediaSourceDurationUpdateCanceller=null}var t=e.prototype;return t.updateDuration=function(e,t){null!==this._currentMediaSourceDurationUpdateCanceller&&this._currentMediaSourceDurationUpdateCanceller.cancel(),this._currentMediaSourceDurationUpdateCanceller=new k.ZP;var n=this._mediaSource,r=this._currentMediaSourceDurationUpdateCanceller.signal,a=function(e,t){var n=(0,T.ZP)("open"===e.readyState,t);return(0,i.u_)(e,(function(){n.setValueIfChanged(!0)}),t),(0,i.N8)(e,(function(){n.setValueIfChanged(!1)}),t),(0,i.k6)(e,(function(){n.setValueIfChanged(!1)}),t),n}(n,r),o=new k.ZP;o.linkToSignal(r),a.onUpdate((function(){if(o.cancel(),!a.getValue())return;(o=new k.ZP).linkToSignal(r);var i=function(e,t){if(0===e.length){var n=(0,T.ZP)(!1);return n.finish(),n}var r=(0,T.ZP)(!1,t);o();for(var i=function(){var n=e[a];n.addEventListener("updatestart",o),n.addEventListener("update",o),t.register((function(){n.removeEventListener("updatestart",o),n.removeEventListener("update",o)}))},a=0;a<e.length;a++)i();return r;function o(){for(var t=0;t<e.length;t++){if(e[t].updating)return void r.setValueIfChanged(!0)}r.setValueIfChanged(!1)}}(n.sourceBuffers,o.signal),s=new k.ZP;return s.linkToSignal(o.signal),i.onUpdate((function(r){s.cancel(),(s=new k.ZP).linkToSignal(o.signal),r||Jt(n,e,t,s.signal)}),{clearSignal:o.signal,emitCurrentValue:!0})}),{emitCurrentValue:!0,clearSignal:r})},t.stopUpdating=function(){null!==this._currentMediaSourceDurationUpdateCanceller&&(this._currentMediaSourceDurationUpdateCanceller.cancel(),this._currentMediaSourceDurationUpdateCanceller=null)},e}();function $t(e,t,n){var r=t;n||(r=o.lV?1/0:en(t));for(var i=0,a=0;a<e.sourceBuffers.length;a++){var u=e.sourceBuffers[a],l=u.buffered.length;l>0&&(i=Math.max(u.buffered.end(l-1)))}if(r===e.duration)return"success";if(i>r){if(i<e.duration)try{s.Z.info("Init: Updating duration to what is currently buffered",i),e.duration=i}catch(e){return s.Z.warn("Duration Updater: Can't update duration on the MediaSource.",e instanceof Error?e:""),"failed"}return"partial"}var d=e.duration;try{s.Z.info("Init: Updating duration",r),e.duration=r,"open"!==e.readyState||isFinite(r)||e.setLiveSeekableRange(0,en(t))}catch(e){return s.Z.warn("Duration Updater: Can't update duration on the MediaSource.",e instanceof Error?e:""),"failed"}var c=Math.abs(e.duration-r);return c>=.1?c<Math.abs(e.duration-d)?"partial":"failed":"success"}function Jt(e,t,n,r){if("success"!==$t(e,t,n))var i=setTimeout((function(){a(),Jt(e,t,n,r)}),2e3),a=r.register((function(){clearTimeout(i)}))}function en(e){return Math.max(Math.pow(2,32),e+Xt)}var tn=n(6199);var nn=function(e,t){return e.id===t.id&&e.start===t.start&&e.end===t.end};var rn=function(e,t){for(var n=[],r=t.periods,i=0;i<r.length;i++){r[i].streamEvents.forEach((function(t){for(var r=t.start,i=t.end,a=t.id,o=t.data,s=0;s<e.length;s++){var u=e[s];if(nn(u,{id:a,start:r,end:i}))return void n.push(u)}if(void 0===i){var l={start:r,id:a,data:o,publicEvent:{start:r,data:o}};n.push(l)}else{var d={start:r,end:i,id:a,data:o,publicEvent:{start:r,end:i,data:o}};n.push(d)}}))}return n};function an(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return on(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return on(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function on(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function sn(e){return void 0!==e.end}var un=function(e,t,n,r,i,a){var o=new WeakMap,s=(0,T.ZP)(rn([],e),a);e.addEventListener("manifestUpdate",(function(){var t=s.getValue();s.setValue(rn(t,e))}),a);var u=!1,d=new k.ZP;d.linkToSignal(a),s.onUpdate((function(e){if(0!==e.length){if(!u){u=!0;var c=h(),f=l.Z.getCurrent().STREAM_EVENT_EMITTER_POLL_INTERVAL,v=setInterval(p,f);n.listen(p,{includeLastObservation:!1,clearSignal:d.signal}),d.signal.register((function(){clearInterval(v)}))}}else u&&(d.cancel(),(d=new k.ZP).linkToSignal(a),u=!1);function p(){var e=h();!function(e,t,n,a){for(var s=t.currentTime,u=n.isSeeking,l=n.currentTime,d=[],c=[],f=0;f<e.length;f++){var v=e[f],p=v.start,h=sn(v)?v.end:void 0;o.has(v)?(p>l||void 0!==h&&l>=h)&&(sn(v)&&c.push(v.publicEvent),o.delete(v)):p<=l&&void 0!==h&&l<h?(d.push({type:"stream-event",value:v.publicEvent}),o.set(v,!0)):s<p&&l>=(null!=h?h:p)&&(u?d.push({type:"stream-event-skip",value:v.publicEvent}):(d.push({type:"stream-event",value:v.publicEvent}),sn(v)&&c.push(v.publicEvent)))}if(d.length>0)for(var m,g=an(d);!(m=g()).done;){var y=m.value;if("stream-event"===y.type?r(y.value):i(y.value),a.isCancelled())return}if(c.length>0)for(var _,b=an(c);!(_=b()).done;){var S=_.value;if("function"==typeof S.onExit&&S.onExit(),a.isCancelled())return}}(s.getValue(),c,e,d.signal),c=e}function h(){var e=n.getReference().getValue().seeking;return{currentTime:t.currentTime,isSeeking:e}}}),{emitCurrentValue:!0,clearSignal:a})},ln=n(4576);function dn(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return cn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return cn(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function cn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var fn=function(e){function n(t){var n;(n=e.call(this)||this)._settings=t,n._initCanceller=new k.ZP,n._initialManifestProm=null;var r=void 0===t.url?void 0:[t.url];return n._manifestFetcher=new ge(r,t.transport,t.manifestRequestSettings),n}(0,t.Z)(n,e);var r=n.prototype;return r.prepare=function(){var e=this;null===this._initialManifestProm&&(this._initialManifestProm=(0,D.Z)(this._initCanceller.signal,(function(t,n){e._manifestFetcher.addEventListener("warning",(function(t){return e.trigger("warning",t)})),e._manifestFetcher.addEventListener("error",(function(t){e.trigger("error",t),n(t)})),e._manifestFetcher.addEventListener("manifestReady",(function(e){t(e)}))})),this._manifestFetcher.start(),this._initCanceller.signal.register((function(){e._manifestFetcher.dispose()})))},r.start=function(e,t){var n=this;this.prepare(),(0,ln.Z)(e,(function(e){return n._onFatalError(e)}),this._initCanceller.signal);var r=(0,T.ZP)(null,this._initCanceller.signal);this._initializeMediaSourceAndDecryption(e,r).then((function(i){return n._onInitialMediaSourceReady(e,i.mediaSource,t,i.drmSystemId,r,i.unlinkMediaSource)})).catch((function(e){n._onFatalError(e)}))},r.updateContentUrls=function(e,t){this._manifestFetcher.updateContentUrls(e,t)},r.dispose=function(){this._initCanceller.cancel()},r._onFatalError=function(e){this._initCanceller.isUsed()||(this._initCanceller.cancel(),this.trigger("error",e))},r._initializeMediaSourceAndDecryption=function(e,t){var n=this,r=this._initCanceller;return(0,D.Z)(r.signal,(function(i){var a=n._settings.keySystems,o=(0,Yt.Z)(e,a,t,{onWarning:function(e){return n.trigger("warning",e)},onError:function(e){return n._onFatalError(e)}},r.signal);o.onUpdate((function(t,a){if("uninitialized"!==t.initializationState.type){a();var s=new k.ZP;s.linkToSignal(r.signal),Bt(e,s.signal).then((function(e){var n=o.getValue();if("awaiting-media-link"===n.initializationState.type)n.initializationState.value.isMediaLinked.setValue(!0),o.onUpdate((function(t,n){if("initialized"===t.initializationState.type)return n(),void i({mediaSource:e,drmSystemId:t.drmSystemId,unlinkMediaSource:s})}),{emitCurrentValue:!0,clearSignal:r.signal});else if("initialized"===t.initializationState.type)return void i({mediaSource:e,drmSystemId:t.drmSystemId,unlinkMediaSource:s})})).catch((function(e){s.isUsed()||n._onFatalError(e)}))}}),{emitCurrentValue:!0,clearSignal:r.signal})}))},r._onInitialMediaSourceReady=function(){var e=(0,w.Z)(I().mark((function e(t,n,r,i,a,o){var u,l,d,c,f,v,p,h,g,y,_,b,E,T,w,A,R,Z,x,P,M,C=this;return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return M=function(e,n,i,o){Z({mediaElement:t,playbackObserver:r,mediaSource:e,initialTime:n,autoPlay:i,manifest:E,representationEstimator:w,segmentFetcherCreator:R,speed:p,protectionRef:a,bufferOptions:A},(function(e){if(o.cancel(),_.isUsed())return;if(x("reloadingMediaSource",e),_.isUsed())return;var n=new k.ZP;n.linkToSignal(_.signal),Bt(t,n.signal).then((function(t){M(t,e.position,e.autoPlay,n)})).catch((function(e){n.isUsed()||P(e)}))}),o.signal)},u=this._settings,l=u.adaptiveOptions,d=u.autoPlay,c=u.bufferOptions,f=u.lowLatencyMode,v=u.segmentRequestOptions,p=u.speed,h=u.startAt,g=u.textTrackOptions,y=u.transport,_=this._initCanceller,(0,m.Z)(null!==this._initialManifestProm),b=this._initialManifestProm,e.prev=5,e.next=8,b;case 8:E=e.sent,e.next=14;break;case 11:return e.prev=11,e.t0=e.catch(5),e.abrupt("return");case 14:if(E.addEventListener("manifestUpdate",(function(){C.trigger("manifestUpdate",null)}),_.signal),s.Z.debug("Init: Calculating initial time"),T=Ht(E,f,h),s.Z.debug("Init: Initial time calculated:",T),w=ne(l),A=(0,S.Z)({textTrackOptions:g,drmSystemId:i},c),R=new Re(y,v,_.signal),this.trigger("manifestReady",E),!_.isUsed()){e.next=24;break}return e.abrupt("return");case 24:Z=this._startBufferingOnMediaSource.bind(this),x=this.trigger.bind(this),P=this._onFatalError.bind(this),M(n,T,d,o);case 28:case"end":return e.stop()}}),e,this,[[5,11]])})));return function(t,n,r,i,a,o){return e.apply(this,arguments)}}(),r._startBufferingOnMediaSource=function(e,t,n){var r,i=this,a=e.autoPlay,o=e.bufferOptions,s=e.initialTime,u=e.manifest,d=e.mediaElement,f=e.mediaSource,v=e.playbackObserver,p=e.protectionRef,h=e.representationEstimator,m=e.segmentFetcherCreator,g=e.speed,y=null!==(r=u.getPeriodForTime(s))&&void 0!==r?r:u.getNextPeriod(s);if(void 0===y){var _=new c.Z("MEDIA_STARTING_TIME_NOT_FOUND","Wanted starting time not found in the Manifest.");return this._onFatalError(_)}var b=new Ne(d,f);n.register((function(){b.disposeAll()}));var S=(0,qt.Z)(d,v,s,a,(function(e){return i.trigger("warning",e)}),n),E=S.autoPlayResult,k=S.initialPlayPerformed,w=S.initialSeekPerformed;if(!n.isCancelled()){k.onUpdate((function(e,t){e&&(t(),un(u,d,v,(function(e){return i.trigger("streamEvent",e)}),(function(e){return i.trigger("streamEventSkip",e)}),n))}),{clearSignal:n,emitCurrentValue:!0});var A=function(e,t,n){var r=n.autoPlay,i=n.initialPlayPerformed,a=n.initialSeekPerformed,o=n.speed,s=n.startTime;return t.deriveReadOnlyObserver((function(t,n){var u=(0,T.ZP)(l(),n);return o.onUpdate(d,{clearSignal:n,emitCurrentValue:!1}),t.onUpdate(d,{clearSignal:n,emitCurrentValue:!1}),u;function l(){var n,u=t.getValue(),l=o.getValue();if(a.getValue()){if(!e.isDynamic||e.isLastPeriodKnown){var d=e.periods[e.periods.length-1];void 0!==d&&void 0!==d.end&&u.position>d.end&&(n=d.end-1)}}else n=s;return{maximumPosition:e.getMaximumSafePosition(),position:{last:u.position,pending:n},duration:u.duration,paused:{last:u.paused,pending:i.getValue()||!r===u.paused?void 0:!r},readyState:u.readyState,speed:l}}function d(){u.setValue(l())}}))}(u,v,{autoPlay:a,initialPlayPerformed:k,initialSeekPerformed:w,speed:g,startTime:s}),I=this._createRebufferingController(v,u,b,g,n);I.addEventListener("needsReload",(function(){var e=w.getValue()?v.getCurrentTime():s,n=k.getValue()?!v.getIsPaused():a;t({position:e,autoPlay:n})}),n);var R=this._createContentTimeBoundariesObserver(u,f,A,b,n);E.then((function(){(0,Wt.Z)(v,d,!1,n).onUpdate((function(e,t){e&&(t(),i.trigger("loaded",{segmentBuffersStore:b}))}),{emitCurrentValue:!0,clearSignal:n})})).catch((function(e){n.isCancelled()||i._onFatalError(e)}));var Z=this;It({manifest:u,initialPeriod:y},A,h,b,m,o,{needsBufferFlush:function(){var e=d.currentTime+.001;v.setCurrentTime(e),v.listen((function(t,n){(null!==t.currentRange||t.position>e+.1)&&(n(),v.setCurrentTime(t.position+.001))}),{includeLastObservation:!1,clearSignal:n})},streamStatusUpdate:function(e){var t=e.period,r=e.bufferType,i=e.imminentDiscontinuity,a=e.position;I.updateDiscontinuityInfo({period:t,bufferType:r,discontinuity:i,position:a}),n.isCancelled()||u.isLastPeriodKnown&&e.period.id===u.periods[u.periods.length-1].id&&(e.hasFinishedLoading||e.isEmptyStream?R.onLastSegmentFinishedLoading(e.bufferType):R.onLastSegmentLoadingResume(e.bufferType))},needsManifestRefresh:function(){return Z._manifestFetcher.scheduleManualRefresh({enablePartialRefresh:!0,canUseUnsafeMode:!0})},manifestMightBeOufOfSync:function(){var e=l.Z.getCurrent().OUT_OF_SYNC_MANIFEST_REFRESH_DELAY;Z._manifestFetcher.scheduleManualRefresh({enablePartialRefresh:!1,canUseUnsafeMode:!1,delay:e})},lockedStream:function(e){return I.onLockedStream(e.bufferType,e.period)},adaptationChange:function(e){Z.trigger("adaptationChange",e),n.isCancelled()||R.onAdaptationChange(e.type,e.period,e.adaptation)},representationChange:function(e){Z.trigger("representationChange",e),n.isCancelled()||R.onRepresentationChange(e.type,e.period)},inbandEvent:function(e){return Z.trigger("inbandEvents",e)},warning:function(e){return Z.trigger("warning",e)},periodStreamReady:function(e){return Z.trigger("periodStreamReady",e)},periodStreamCleared:function(e){R.onPeriodCleared(e.type,e.period),n.isCancelled()||Z.trigger("periodStreamCleared",e)},bitrateEstimateChange:function(e){return Z.trigger("bitrateEstimateChange",e)},addedSegment:function(e){return Z.trigger("addedSegment",e)},needsMediaSourceReload:function(e){return t(e)},needsDecipherabilityFlush:function(e){var n,r=M(d);void 0===(n=null==r?void 0:r[0])||n.indexOf("widevine")<0?t(e):e.position+.001<e.duration?v.setCurrentTime(d.currentTime+.001):v.setCurrentTime(e.position)},encryptionDataEncountered:function(e){for(var t,r=dn(e);!(t=r()).done;){var i=t.value;if(p.setValue(i),n.isCancelled())return}},error:function(e){return Z._onFatalError(e)}},n)}},r._createContentTimeBoundariesObserver=function(e,t,n,r,i){var a=this,o=new Qt(t);i.register((function(){o.stopUpdating()}));var u=null,l=new Pt(e,n,r.getBufferTypes());i.register((function(){l.dispose()})),l.addEventListener("warning",(function(e){return a.trigger("warning",e)})),l.addEventListener("periodChange",(function(e){a.trigger("activePeriodChanged",{period:e})})),l.addEventListener("durationUpdate",(function(e){o.updateDuration(e.duration,e.isEnd)})),l.addEventListener("endOfStream",(function(){null===u&&((u=new k.ZP).linkToSignal(i),s.Z.debug("Init: end-of-stream order received."),function(e,t){var n=new k.ZP;n.linkToSignal(t),Kt(e,(function(){n.cancel(),(n=new k.ZP).linkToSignal(t),jt(e,n.signal)}),t),jt(e,n.signal)}(t,u.signal))})),l.addEventListener("resumeStream",(function(){null!==u&&(s.Z.debug("Init: resume-stream order received."),u.cancel(),u=null)}));var d=l.getCurrentDuration();return o.updateDuration(d.duration,d.isEnd),l},r._createRebufferingController=function(e,t,n,r,i){var a=this,o=new tn.Z(e,t,n,r);return o.addEventListener("stalled",(function(e){return a.trigger("stalled",e)})),o.addEventListener("unstalled",(function(){return a.trigger("unstalled",null)})),o.addEventListener("warning",(function(e){return a.trigger("warning",e)})),i.register((function(){return o.destroy()})),o.start(),o},n}(Rt.K);function vn(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return pn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return pn(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function pn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var hn=["canplay","ended","play","pause","seeking","seeked","loadedmetadata","ratechange"],mn=function(){function e(e,t){this._internalSeeksIncoming=[],this._mediaElement=e,this._withMediaSource=t.withMediaSource,this._lowLatencyMode=t.lowLatencyMode,this._canceller=new k.ZP,this._observationRef=this._createSharedReference()}var t=e.prototype;return t.stop=function(){this._canceller.cancel()},t.getCurrentTime=function(){return this._mediaElement.currentTime},t.getPlaybackRate=function(){return this._mediaElement.playbackRate},t.getIsPaused=function(){return this._mediaElement.paused},t.setCurrentTime=function(e){this._internalSeeksIncoming.push(e),s.Z.info("API: Seeking internally",e),this._mediaElement.currentTime=e},t.setPlaybackRate=function(e){this._mediaElement.playbackRate=e},t.getReadyState=function(){return this._mediaElement.readyState},t.getReference=function(){return this._observationRef},t.listen=function(e,t){var n;if(this._canceller.isUsed()||!0===(null===(n=null==t?void 0:t.clearSignal)||void 0===n?void 0:n.isCancelled()))return N.Z;this._observationRef.onUpdate(e,{clearSignal:null==t?void 0:t.clearSignal,emitCurrentValue:null==t?void 0:t.includeLastObservation})},t.deriveReadOnlyObserver=function(e){return _n(this,e,this._canceller.signal)},t._createSharedReference=function(){var e,t=this;if(void 0!==this._observationRef)return this._observationRef;var n=l.Z.getCurrent(),r=n.SAMPLING_INTERVAL_MEDIASOURCE,i=n.SAMPLING_INTERVAL_LOW_LATENCY,a=n.SAMPLING_INTERVAL_NO_MEDIASOURCE,o=function(n){var r,i=n;"seeking"===i&&t._internalSeeksIncoming.length>0&&(i="internal-seeking",r=t._internalSeeksIncoming.shift());var a=null!=e?e:t._generateInitialObservation(),o=yn(t._mediaElement,i,t._withMediaSource),u=null;o.seeking&&("number"==typeof r?u=r:null!==a.pendingInternalSeek&&"seeking"!==n&&(u=a.pendingInternalSeek));var d=function(e,t,n){var r,i,a=n.withMediaSource,o=n.lowLatencyMode,s=l.Z.getCurrent().REBUFFERING_GAP,u=t.event,d=t.position,c=t.bufferGap,f=t.currentRange,v=t.duration,p=t.paused,h=t.readyState,m=t.ended,g=e.rebuffering,y=e.event,_=e.position,b=function(e,t,n,r,i){var a=l.Z.getCurrent().REBUFFERING_GAP,o=i?"LOW_LATENCY":"DEFAULT";if(void 0===t)return n&&Math.abs(r-e)<=a[o];return null!==t&&r-t.end<=a[o]}(d,f,m,v,o),S=h>=1&&"loadedmetadata"!==u&&null===g&&!(b||m),E=null,T=o?s.LOW_LATENCY:s.DEFAULT;if(a){if(S)c===1/0?(r=!0,E=d):void 0===c?h<3&&(r=!0,E=void 0):c<=T&&(r=!0,E=d+c);else if(null!==g){var k=gn(g,o);!0!==r&&null!==g&&h>1&&(b||m||void 0!==c&&isFinite(c)&&c>k)||void 0===c&&h>=3?i=!0:void 0===c?E=void 0:c===1/0?E=d:c<=k&&(E=d+c)}}else S&&(!p&&"timeupdate"===u&&"timeupdate"===y&&d===_||"seeking"===u&&(c===1/0||void 0===c&&h<3))?r=!0:null!==g&&("seeking"!==u&&d!==_||"canplay"===u||void 0===c&&h>=3||void 0!==c&&c<1/0&&(c>gn(g,o)||b||m))&&(i=!0);if(!0===i)return null;var w;if(!0===r||null!==g)return w="seeking"===u||null!==g&&"seeking"===g.reason||t.seeking?"seeking":1===h?"not-ready":"buffering",null!==g&&g.reason===w?{reason:g.reason,timestamp:g.timestamp,position:E}:{reason:w,timestamp:performance.now(),position:E};return null}(a,o,{lowLatencyMode:t._lowLatencyMode,withMediaSource:t._withMediaSource}),c=function(e,t){var n=l.Z.getCurrent().MINIMUM_BUFFER_AMOUNT_BEFORE_FREEZING;if(e.freezing)return t.ended||t.paused||0===t.readyState||0===t.playbackRate||e.position!==t.position?null:e.freezing;return"timeupdate"===t.event&&void 0!==t.bufferGap&&t.bufferGap>n&&!t.ended&&!t.paused&&t.readyState>=1&&0!==t.playbackRate&&t.position===e.position?{timestamp:performance.now()}:null}(a,o),f=(0,S.Z)({},{rebuffering:d,freezing:c,pendingInternalSeek:u},o);return s.Z.hasLevel("DEBUG")&&s.Z.debug("API: current media element state tick","event",f.event,"position",f.position,"seeking",f.seeking,"internalSeek",f.pendingInternalSeek,"rebuffering",null!==f.rebuffering,"freezing",null!==f.freezing,"ended",f.ended,"paused",f.paused,"playbackRate",f.playbackRate,"readyState",f.readyState),f},u=(0,T.ZP)(o("init"),this._canceller.signal),d=function(t){var n=o(t);s.Z.hasLevel("DEBUG")&&s.Z.debug("API: current playback timeline:\n"+function(e,t){for(var n="",r="",i=0;i<e.length;i++){var a=e.start(i),o=e.end(i),s=a.toFixed(2),u=o.toFixed(2),l=s+"|=="+(o-a).toFixed(2)+"==|"+u;if(n+=l,0===r.length&&o>t){var d=n.length-Math.floor(l.length/2);r=" ".repeat(d)+"^"+t}if(i<e.length-1){var c=e.start(i+1),f=" ~"+(c-o).toFixed(2)+"~ ";if(n+=f,0===r.length&&t<c){var v=n.length-Math.floor(f.length/2);r=" ".repeat(v)+"^"+t}}}0===r.length&&(r=" ".repeat(n.length)+"^"+t);return n+"\n"+r}(n.buffered,n.position),"\n"+t),e=n,u.setValue(n)},c=this._lowLatencyMode?i:this._withMediaSource?r:a,f=setInterval(p,c),v=hn.map((function(e){function n(){clearInterval(f),f=setInterval(p,c),d(e)}return t._mediaElement.addEventListener(e,n),function(){t._mediaElement.removeEventListener(e,n)}}));return this._canceller.signal.register((function(){clearInterval(f),v.forEach((function(e){return e()})),u.finish()})),u;function p(){d("timeupdate")}},t._generateInitialObservation=function(){return(0,S.Z)(yn(this._mediaElement,"init",this._withMediaSource),{rebuffering:null,freezing:null,pendingInternalSeek:null})},e}();function gn(e,t){if(null===e)return 0;var n=t?"LOW_LATENCY":"DEFAULT",r=l.Z.getCurrent(),i=r.RESUME_GAP_AFTER_SEEKING,a=r.RESUME_GAP_AFTER_NOT_ENOUGH_DATA,o=r.RESUME_GAP_AFTER_BUFFERING;switch(e.reason){case"seeking":return i[n];case"not-ready":return a[n];case"buffering":return o[n]}}function yn(e,t,n){var r,i,a=e.buffered,o=e.currentTime,s=e.duration,u=e.ended,l=e.paused,d=e.playbackRate,c=e.readyState,f=e.seeking;return!n&&0===a.length&&c>=3?(r=void 0,i=void 0):i=null!==(r=(0,E.rx)(a,o))?r.end-o:1/0,{bufferGap:i,buffered:a,currentRange:r,position:o,duration:s,ended:u,paused:l,playbackRate:d,readyState:c,seeking:f,event:t}}function _n(e,t,n){var r=t(e.getReference(),n);return{getCurrentTime:function(){return e.getCurrentTime()},getReadyState:function(){return e.getReadyState()},getPlaybackRate:function(){return e.getPlaybackRate()},getIsPaused:function(){return e.getIsPaused()},getReference:function(){return r},listen:function(e,t){var i;n.isCancelled()||!0===(null===(i=null==t?void 0:t.clearSignal)||void 0===i?void 0:i.isCancelled())||r.onUpdate(e,{clearSignal:null==t?void 0:t.clearSignal,emitCurrentValue:null==t?void 0:t.includeLastObservation})},deriveReadOnlyObserver:function(e){return _n(this,e,n)}}}var bn=function(e){function n(t,n){var r;return(r=e.call(this)||this)._canceller=new k.ZP,r._manifest=t,r._adaptationRef=n,r._updateToken=!1,r}(0,t.Z)(n,e);var r=n.prototype;return r.start=function(e){if(this._updateToken=!0,null===e)return this._lastEmitted=null,this._updateToken=!1,void this._adaptationRef.setValue(null);var t=this._constructLockedRepresentationsReference(e);this._updateToken&&(this._lastEmitted={adaptation:e.adaptation,switchingMode:e.switchingMode,lockedRepresentations:null},this._updateToken=!1,this._adaptationRef.setValue({adaptation:e.adaptation,switchingMode:e.switchingMode,representations:t}))},r.updateTrack=function(e){if(this._updateToken=!0,null===e){if(null===this._lastEmitted)return;return this._updateToken=!1,this._canceller.cancel(),this._canceller=new k.ZP,this._lastEmitted=null,void this._adaptationRef.setValue(null)}var t=e.adaptation,n=e.switchingMode;this._canceller.cancel(),this._canceller=new k.ZP;var r=this._constructLockedRepresentationsReference(e);this._updateToken&&(this._lastEmitted={adaptation:t,switchingMode:n,lockedRepresentations:null},this._updateToken=!1,this._adaptationRef.setValue({adaptation:t,switchingMode:n,representations:r}))},r._constructLockedRepresentationsReference=function(e){var t=this._manifest,n=(0,T.ZP)({representations:[],switchingMode:"lazy"}),r=this;return t.addEventListener("decipherabilityUpdate",i),t.addEventListener("manifestUpdate",i),this._canceller.signal.register((function(){t.removeEventListener("decipherabilityUpdate",i),t.removeEventListener("manifestUpdate",i)})),e.lockedRepresentations.onUpdate(i,{clearSignal:this._canceller.signal,emitCurrentValue:!1}),i(),n;function i(){var t,i,a=e.lockedRepresentations.getValue();if(null===a)i=e.adaptation.getPlayableRepresentations(),t="lazy";else{var o=a.representations;if(t=a.switchingMode,0===(i=o.filter((function(e){return e.isPlayable()}))).length)return void r.trigger("noPlayableLockedRepresentation",null)}if(i.length<=0)return e.adaptation.isSupported=!1,void r.trigger("noPlayableRepresentation",null);var s=n.getValue(),u=i.slice().sort();if(u.length===s.representations.length){for(var l=0;l<u.length;l++)if(s.representations[l].id!==u[l].id)return void n.setValue({representations:u,switchingMode:t})}else n.setValue({representations:u,switchingMode:t})}},r.dispose=function(){this.removeEventListener(),this._canceller.cancel(),this._adaptationRef.finish()},n}(y.Z),Sn=function(e){function n(t){var n,r;return(n=e.call(this)||this)._storedPeriodInfo=[],n._isDisposed=!1,n._cachedPeriodInfo=new WeakMap,n._isTrickModeTrackEnabled=t.preferTrickModeTracks,n._defaultAudioTrackSwitchingMode=null!==(r=t.defaultAudioTrackSwitchingMode)&&void 0!==r?r:l.Z.getCurrent().DEFAULT_AUDIO_TRACK_SWITCHING_MODE,n}(0,t.Z)(n,e);var r=n.prototype;return r.getAvailablePeriods=function(){return this._storedPeriodInfo.map((function(e){return An(e.period)}))},r.updatePeriodList=function(e){for(var t,n,r,i=this,a=l.Z.getCurrent().DEFAULT_VIDEO_TRACK_SWITCHING_MODE,o=e.periods,u=[],d=0,c=function(e){var l=i._storedPeriodInfo[e].period,c=o[d];if(void 0===c)for(var v=i._storedPeriodInfo.length-1;v>=e;v--)i._storedPeriodInfo[v].inManifest=!1,Tn(i._storedPeriodInfo[v])&&i._removePeriodObject(v);else if(l===c){d++;var p=i._storedPeriodInfo[e].text.storedSettings;if(null!==p)if(!c.getSupportedAdaptations("text").some((function(e){return e.id===p.adaptation.id}))){s.Z.warn("TS: Chosen text Adaptation not available anymore");var h=i._storedPeriodInfo[e];if(h.text.storedSettings=null,i.trigger("trackUpdate",{period:An(c),trackType:"text",reason:"missing"}),i._isDisposed)return{v:void 0};var m=En(i._storedPeriodInfo,h.period.id);void 0!==m&&null===m.text.storedSettings&&(null===(t=m.text.dispatcher)||void 0===t||t.updateTrack(null))}var g=i._storedPeriodInfo[e].video.storedSettings;if(null!==g){var y=c.getSupportedAdaptations("video");if(!y.some((function(e){return e.id===g.adaptation.id}))){s.Z.warn("TS: Chosen video Adaptation not available anymore");var _,b=i._storedPeriodInfo[e];if(0===y.length)_=null;else{var S=y[0],E=kn(S,i._isTrickModeTrackEnabled),k=(0,T.ZP)(null);_={adaptationBase:S,adaptation:E,switchingMode:a,lockedRepresentations:k}}if(b.video.storedSettings=_,i.trigger("trackUpdate",{period:An(c),trackType:"video",reason:"missing"}),i._isDisposed)return{v:void 0};var w=En(i._storedPeriodInfo,b.period.id);void 0!==w&&w.video.storedSettings===_&&(null===(n=w.video.dispatcher)||void 0===n||n.updateTrack(_))}}var A=i._storedPeriodInfo[e].audio.storedSettings;if(null!==A){var I=c.getSupportedAdaptations("audio");if(!I.some((function(e){return e.id===A.adaptation.id}))){s.Z.warn("TS: Chosen audio Adaptation not available anymore");var R=i._storedPeriodInfo[e],Z=0===I.length?null:{adaptation:I[0],switchingMode:i._defaultAudioTrackSwitchingMode,lockedRepresentations:(0,T.ZP)(null)};if(R.audio.storedSettings=Z,i.trigger("trackUpdate",{period:An(c),trackType:"audio",reason:"missing"}),i._isDisposed)return{v:void 0};var x=En(i._storedPeriodInfo,R.period.id);void 0!==x&&x.audio.storedSettings===Z&&(null===(r=x.audio.dispatcher)||void 0===r||r.updateTrack(Z))}}}else if(l.start<=c.start)i._storedPeriodInfo[e].inManifest=!1,Tn(i._storedPeriodInfo[e])&&(i._removePeriodObject(e),e--);else{var P=wn(c,!0,i._isTrickModeTrackEnabled,i._defaultAudioTrackSwitchingMode);i._storedPeriodInfo.splice(e,0,P),u.push(P),d++}f=e},f=0;f<this._storedPeriodInfo.length;f++){var v=c(f);if("object"==typeof v)return v.v}if(d<o.length){var p,h=o.slice(d).map((function(e){return wn(e,!0,i._isTrickModeTrackEnabled,i._defaultAudioTrackSwitchingMode)}));(p=this._storedPeriodInfo).push.apply(p,h),u.push.apply(u,h)}var m=u.reduce((function(e,t){return t.isRemoved||e.push({id:t.period.id,start:t.period.start,end:t.period.end}),e}),[]);m.length>0&&this.trigger("newAvailablePeriods",m)},r.addTrackReference=function(e,t,n,r){var i=this,a=En(this._storedPeriodInfo,n.id);if(void 0===a&&(a=this._addPeriod(n),this.trigger("newAvailablePeriods",[{id:n.id,start:n.start,end:n.end}])),null===a[e].dispatcher){var o=a[e].storedSettings,u=new bn(t,r);a[e].dispatcher=u,u.addEventListener("noPlayableRepresentation",(function(){var t,r,a,o=(0,p.Z)(n.getAdaptationsForType(e),(function(e){return e.getPlayableRepresentations().length>0}));if(void 0===o){var s=new c.Z("NO_PLAYABLE_REPRESENTATION","No "+e+" Representation can be played",{adaptation:void 0});return i.trigger("error",s),void i.dispose()}var u=null===(t=En(i._storedPeriodInfo,n.id))||void 0===t?void 0:t[e];if(!(0,b.Z)(u)){var l={adaptation:o,switchingMode:"audio"===e?i._defaultAudioTrackSwitchingMode:"reload",lockedRepresentations:(0,T.ZP)(null)};u.storedSettings=l,i.trigger("trackUpdate",{period:An(n),trackType:e,reason:"no-playable-representation"}),i._isDisposed||(u=null===(r=En(i._storedPeriodInfo,n.id))||void 0===r?void 0:r[e],(0,b.Z)(u)||u.storedSettings!==l||null===(a=u.dispatcher)||void 0===a||a.updateTrack(l))}})),u.addEventListener("noPlayableLockedRepresentation",(function(){null==o||o.lockedRepresentations.setValue(null),i.trigger("brokenRepresentationsLock",{period:{id:n.id,start:n.start,end:n.end},trackType:e})})),u.start(o)}else s.Z.error("TS: Subject already added for "+e+" and Period "+n.start)},r.removeTrackReference=function(e,t){var n=function(e,t){for(var n=0;n<e.length;n++){if(e[n].period.id===t.id)return n}}(this._storedPeriodInfo,t);if(void 0!==n){var r=this._storedPeriodInfo[n],i=r[e];null!==(null==i?void 0:i.dispatcher)?(i.dispatcher.dispose(),i.dispatcher=null,Tn(r)&&this._removePeriodObject(n)):s.Z.warn("TS: TrackDispatcher already removed for "+e+" and Period "+t.start)}else s.Z.warn("TS: "+e+" not found for period",t.start)},r.getPeriodObjectFromPeriod=function(e){var t=En(this._storedPeriodInfo,e.id);return void 0===t&&void 0!==e?this._cachedPeriodInfo.get(e):t},r.getPeriodObjectFromId=function(e){return En(this._storedPeriodInfo,e)},r.disableVideoTrickModeTracks=function(){this._isTrickModeTrackEnabled&&(this._isTrickModeTrackEnabled=!1,this._resetVideoTrackChoices("trickmode-disabled"))},r.enableVideoTrickModeTracks=function(){this._isTrickModeTrackEnabled||(this._isTrickModeTrackEnabled=!0,this._resetVideoTrackChoices("trickmode-enabled"))},r.resetPeriodObjects=function(){for(var e,t,n,r=this._storedPeriodInfo.length-1;r>=0;r--){var i=this._storedPeriodInfo[r];null===(e=i.audio.dispatcher)||void 0===e||e.dispose(),i.audio.dispatcher=null,null===(t=i.video.dispatcher)||void 0===t||t.dispose(),i.video.dispatcher=null,null===(n=i.text.dispatcher)||void 0===n||n.dispose(),i.text.dispatcher=null,i.inManifest||this._removePeriodObject(r)}},r.isTrickModeEnabled=function(){return this._isTrickModeTrackEnabled},r.setAudioTrack=function(e,t,n,r){return this._setAudioOrTextTrack("audio",e,t,null!=n?n:this._defaultAudioTrackSwitchingMode,r)},r.setTextTrack=function(e,t){return this._setAudioOrTextTrack("text",e,t,"direct",null)},r._setAudioOrTextTrack=function(e,t,n,r,i){var a,o=t.period,s=(0,p.Z)(o.getSupportedAdaptations(e),(function(e){return e.id===n}));if(void 0===s)throw new Error("Wanted "+e+" track not found.");var u,l=t[e];if(null===i)u=(0,T.ZP)(null);else{var d=this._getRepresentationsToLock(s,i),c="audio"===e?this._defaultAudioTrackSwitchingMode:"direct";u=(0,T.ZP)({representations:d,switchingMode:c})}var f={adaptation:s,switchingMode:r,lockedRepresentations:u};if(l.storedSettings=f,this.trigger("trackUpdate",{period:An(o),trackType:e,reason:"manual"}),!this._isDisposed){var v=En(this._storedPeriodInfo,o.id);void 0!==v&&v[e].storedSettings===f&&(null===(a=v[e].dispatcher)||void 0===a||a.updateTrack(f))}},r.setVideoTrack=function(e,t,n,r){var i,a=e.period,o=(0,p.Z)(a.getSupportedAdaptations("video"),(function(e){return e.id===t}));if(void 0===o)throw new Error("Wanted video track not found.");var s,u=l.Z.getCurrent().DEFAULT_VIDEO_TRACK_SWITCHING_MODE,d=e.video,c=kn(o,this._isTrickModeTrackEnabled);if(null===r)s=(0,T.ZP)(null);else{var f=this._getRepresentationsToLock(o,r),v=u;s=(0,T.ZP)({representations:f,switchingMode:v})}var h={adaptationBase:o,switchingMode:null!=n?n:u,adaptation:c,lockedRepresentations:s};if(d.storedSettings=h,this.trigger("trackUpdate",{period:An(a),trackType:"video",reason:"manual"}),!this._isDisposed){var m=En(this._storedPeriodInfo,a.id);void 0!==m&&m.video.storedSettings===h&&(null===(i=m.video.dispatcher)||void 0===i||i.updateTrack(h))}},r.disableTrack=function(e,t){var n,r,i=e[t];if(null!==i.storedSettings&&("text"!==t&&(null===(n=e[t].storedSettings)||void 0===n||n.lockedRepresentations.finish()),i.storedSettings=null,this.trigger("trackUpdate",{period:An(e.period),trackType:t,reason:"manual"}),!this._isDisposed)){var a=En(this._storedPeriodInfo,e.period.id);void 0!==a&&null===a[t].storedSettings&&(null===(r=a[t].dispatcher)||void 0===r||r.updateTrack(null))}},r.getChosenAudioTrack=function(e){return null===e.audio.storedSettings?null:e.audio.storedSettings.adaptation.toAudioTrack(!0)},r.getChosenTextTrack=function(e){return null===e.text.storedSettings?null:e.text.storedSettings.adaptation.toTextTrack()},r.getChosenVideoTrack=function(e){return null===e.video.storedSettings?null:e.video.storedSettings.adaptation.toVideoTrack(!0)},r.getAvailableAudioTracks=function(e){var t=e.audio.storedSettings,n=null!==t?t.adaptation.id:null;return e.period.getSupportedAdaptations("audio").map((function(e){var t=null!==n&&n===e.id;return(0,S.Z)(e.toAudioTrack(!0),{active:t})}))},r.getAvailableTextTracks=function(e){var t=e.text.storedSettings,n=null!==t?t.adaptation.id:null;return e.period.getSupportedAdaptations("text").map((function(e){var t=null!==n&&n===e.id;return(0,S.Z)(e.toTextTrack(),{active:t})}))},r.getAvailableVideoTracks=function(e){var t=e.video.storedSettings,n=null===t?void 0:t.adaptation.id;return e.period.getSupportedAdaptations("video").map((function(e){var t=null!==n&&n===e.id,r=e.toVideoTrack(!0),i=void 0!==r.trickModeTracks?r.trickModeTracks.map((function(e){var t=null!==n&&n===e.id;return(0,S.Z)(e,{active:t})})):[],a=(0,S.Z)(r,{active:t});return void 0!==i&&(a.trickModeTracks=i),a}))},r.getLockedAudioRepresentations=function(e){var t=e.audio.storedSettings;if(null===t)return null;var n=t.lockedRepresentations.getValue();return null===n?null:n.representations.map((function(e){return e.id}))},r.getLockedVideoRepresentations=function(e){var t=e.video.storedSettings;if(null===t)return null;var n=t.lockedRepresentations.getValue();return null===n?null:n.representations.map((function(e){return e.id}))},r.lockAudioRepresentations=function(e,t){var n,r=e.audio.storedSettings;if(null!==r){var i=l.Z.getCurrent().DEFAULT_AUDIO_REPRESENTATIONS_SWITCHING_MODE,a=this._getRepresentationsToLock(r.adaptation,t.representations),o=null!==(n=t.switchingMode)&&void 0!==n?n:i;r.lockedRepresentations.setValue({representations:a,switchingMode:o})}},r.lockVideoRepresentations=function(e,t){var n,r=e.video.storedSettings;if(null!==r){var i=l.Z.getCurrent().DEFAULT_VIDEO_REPRESENTATIONS_SWITCHING_MODE,a=this._getRepresentationsToLock(r.adaptation,t.representations),o=null!==(n=t.switchingMode)&&void 0!==n?n:i;r.lockedRepresentations.setValue({representations:a,switchingMode:o})}},r.unlockAudioRepresentations=function(e){var t=e.audio.storedSettings;null!==t&&null!==t.lockedRepresentations.getValue()&&t.lockedRepresentations.setValue(null)},r.unlockVideoRepresentations=function(e){var t=e.video.storedSettings;null!==t&&null!==t.lockedRepresentations.getValue()&&t.lockedRepresentations.setValue(null)},r.dispose=function(){for(this._isDisposed=!0;;){var e=this._storedPeriodInfo.pop();if(void 0===e)return;e.isRemoved=!0}},r._addPeriod=function(e){for(var t=wn(e,!1,this._isTrickModeTrackEnabled,this._defaultAudioTrackSwitchingMode),n=0;n<this._storedPeriodInfo.length;n++)if(this._storedPeriodInfo[n].period.start>e.start)return this._storedPeriodInfo.splice(n,0,t),t;return this._storedPeriodInfo.push(t),t},r._resetVideoTrackChoices=function(e){for(var t,n=0;n<this._storedPeriodInfo.length;n++){var r=this._storedPeriodInfo[n];if(null!==r.video.storedSettings){var i=r.video.storedSettings.adaptationBase;if(null!==i){var a=kn(i,this._isTrickModeTrackEnabled);r.video.storedSettings.adaptationBase=i,r.video.storedSettings.adaptation=a}}}for(var o=this._storedPeriodInfo.slice(),s=0;s<o.length;s++){var u=o[s].period,l=o[s].video.storedSettings;if(this.trigger("trackUpdate",{period:An(u),trackType:"video",reason:e}),this._isDisposed)return;var d=En(this._storedPeriodInfo,u.id);void 0!==d&&d.video.storedSettings===l&&(null===(t=d.video.dispatcher)||void 0===t||t.updateTrack(l))}},r._removePeriodObject=function(e){var t=this._storedPeriodInfo[e];this._storedPeriodInfo[e].isRemoved=!0,this._storedPeriodInfo.splice(e,1),this._cachedPeriodInfo.set(t.period,t)},r._getRepresentationsToLock=function(e,t){var n=t.reduce((function(t,n){var r=(0,p.Z)(e.representations,(function(e){return e.id===n}));return void 0===r?s.Z.warn("API: Wanted locked Representation not found."):t.push(r),t}),[]);if(0===n.length)throw new Error("Cannot lock Representations: None of the given Representation id are found");return n},n}(y.Z);function En(e,t){for(var n=0;n<e.length;n++){var r=e[n];if(r.period.id===t)return r}}function Tn(e){var t,n,r;return!e.inManifest&&null===(null===(t=e.text)||void 0===t?void 0:t.dispatcher)&&null===(null===(n=e.audio)||void 0===n?void 0:n.dispatcher)&&null===(null===(r=e.video)||void 0===r?void 0:r.dispatcher)}function kn(e,t){var n;return t&&void 0!==(null===(n=e.trickModeTracks)||void 0===n?void 0:n[0])?e.trickModeTracks[0]:e}function wn(e,t,n,r){var i,a=e.getSupportedAdaptations("audio")[0],o=e.getSupportedAdaptations("video")[0],s=kn(o,n),u=l.Z.getCurrent().DEFAULT_VIDEO_TRACK_SWITCHING_MODE,d=void 0!==a?{adaptation:a,switchingMode:r,lockedRepresentations:(0,T.ZP)(null)}:null,c=void 0!==s?{adaptation:s,adaptationBase:o,switchingMode:u,lockedRepresentations:(0,T.ZP)(null)}:null,f=null,v=e.getAdaptationsForType("text").filter((function(e){return!0===e.isForcedSubtitles}));if(v.length>0){if(null!=a){var h=(0,p.Z)(v,(function(e){return e.normalizedLanguage===a.normalizedLanguage}));void 0!==h&&(f=h)}null===f&&(f=null!==(i=(0,p.Z)(v,(function(e){return void 0===e.normalizedLanguage})))&&void 0!==i?i:null)}var m=null;return null!==f&&(m={adaptation:f,switchingMode:"direct",lockedRepresentations:(0,T.ZP)(null)}),{period:e,inManifest:t,isRemoved:!1,audio:{storedSettings:d,dispatcher:null},video:{storedSettings:c,dispatcher:null},text:{storedSettings:m,dispatcher:null}}}function An(e){return{start:e.start,end:e.end,id:e.id}}function In(e,t){var n=l.Z.getCurrent().FORCED_ENDED_THRESHOLD;if(e.ended)return"ENDED";if(null!==t){var r=Math.abs(e.duration-e.currentTime);return null!=n&&r<n?"ENDED":"seeking"===t?"SEEKING":"freezing"===t?"FREEZING":"BUFFERING"}return e.paused?"PAUSED":"PLAYING"}function Rn(e){return"LOADING"!==e&&"RELOADING"!==e&&"STOPPED"!==e}function Zn(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return xn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return xn(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function xn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Pn=(0,_.Z)(),Mn=i.w0,Cn=i.it,Dn=i.bD,Nn=i.c9,On=function(n){function r(e){var t;void 0===e&&(e={}),t=n.call(this)||this;var r=function(e){var t,n,r,i,a,o,s=l.Z.getCurrent(),u=s.DEFAULT_BASE_BANDWIDTH,d=s.DEFAULT_VIDEO_RESOLUTION_LIMIT,c=s.DEFAULT_MAX_BUFFER_AHEAD,f=s.DEFAULT_MAX_BUFFER_BEHIND,v=s.DEFAULT_MAX_VIDEO_BUFFER_SIZE,p=s.DEFAULT_THROTTLE_VIDEO_BITRATE_WHEN_HIDDEN,h=s.DEFAULT_WANTED_BUFFER_AHEAD;if((0,b.Z)(e.maxBufferAhead))t=c;else if(t=Number(e.maxBufferAhead),isNaN(t))throw new Error("Invalid maxBufferAhead parameter. Should be a number.");if((0,b.Z)(e.maxBufferBehind))n=f;else if(n=Number(e.maxBufferBehind),isNaN(n))throw new Error("Invalid maxBufferBehind parameter. Should be a number.");if((0,b.Z)(e.wantedBufferAhead))r=h;else if(r=Number(e.wantedBufferAhead),isNaN(r))throw new Error("Invalid wantedBufferAhead parameter. Should be a number.");if((0,b.Z)(e.maxVideoBufferSize))i=v;else if(i=Number(e.maxVideoBufferSize),isNaN(i))throw new Error("Invalid maxVideoBufferSize parameter. Should be a number.");var m=(0,b.Z)(e.videoResolutionLimit)?d:e.videoResolutionLimit,g=(0,b.Z)(e.throttleVideoBitrateWhenHidden)?p:!!e.throttleVideoBitrateWhenHidden;if((0,b.Z)(e.videoElement))a=document.createElement("video");else{if(!(e.videoElement instanceof HTMLMediaElement))throw new Error("Invalid videoElement parameter. Should be a HTMLMediaElement.");a=e.videoElement}if((0,b.Z)(e.baseBandwidth))o=u;else if(o=Number(e.baseBandwidth),isNaN(o))throw new Error("Invalid baseBandwidth parameter. Should be a number.");return{maxBufferAhead:t,maxBufferBehind:n,videoResolutionLimit:m,videoElement:a,wantedBufferAhead:r,maxVideoBufferSize:i,throttleVideoBitrateWhenHidden:g,baseBandwidth:o}}(e),i=r.baseBandwidth,a=r.videoResolutionLimit,o=r.maxBufferAhead,u=r.maxBufferBehind,d=r.throttleVideoBitrateWhenHidden,c=r.videoElement,f=r.wantedBufferAhead,v=r.maxVideoBufferSize,p=l.Z.getCurrent().DEFAULT_UNMUTED_VOLUME;c.preload="auto",t.version="4.0.0-beta.2",t.log=s.Z,t.state="STOPPED",t.videoElement=c;var h=new k.ZP;return t._destroyCanceller=h,t._priv_pictureInPictureRef=Mn(c,h.signal),t._priv_speed=(0,T.ZP)(c.playbackRate,t._destroyCanceller.signal),t._priv_preferTrickModeTracks=!1,t._priv_contentLock=(0,T.ZP)(!1,t._destroyCanceller.signal),t._priv_bufferOptions={wantedBufferAhead:(0,T.ZP)(f,t._destroyCanceller.signal),maxBufferAhead:(0,T.ZP)(o,t._destroyCanceller.signal),maxBufferBehind:(0,T.ZP)(u,t._destroyCanceller.signal),maxVideoBufferSize:(0,T.ZP)(v,t._destroyCanceller.signal)},t._priv_bitrateInfos={lastBitrates:{audio:i,video:i}},t._priv_throttleVideoBitrateWhenHidden=d,t._priv_videoResolutionLimit=a,t._priv_mutedMemory=p,t._priv_currentError=null,t._priv_contentInfos=null,t._priv_contentEventsMemory={},t._priv_setPlayerState("STOPPED"),t._priv_reloadingMetadata={},t._priv_lastAutoPlay=!1,t}(0,t.Z)(r,n);var i=r.prototype;return i.addEventListener=function(e,t){return n.prototype.addEventListener.call(this,e,t)},i.stop=function(){null!==this._priv_contentInfos&&this._priv_contentInfos.currentContentCanceller.cancel(),this._priv_cleanUpCurrentContentState(),"STOPPED"!==this.state&&this._priv_setPlayerState("STOPPED")},i.dispose=function(){this.stop(),null!==this.videoElement&&x(this.videoElement).catch((function(e){var t=e instanceof Error?e.message:"Unknown error";s.Z.error("API: Could not dispose decryption resources: "+t)})),this._destroyCanceller.cancel(),this._priv_reloadingMetadata={},this.videoElement=null},i.loadVideo=function(e){var t=function(e){var t,n,r,i,a,o,u,d,c,f=l.Z.getCurrent(),v=f.DEFAULT_AUTO_PLAY,p=f.DEFAULT_CODEC_SWITCHING_BEHAVIOR,m=f.DEFAULT_ENABLE_FAST_SWITCHING,g=f.DEFAULT_TEXT_TRACK_MODE;if((0,b.Z)(e))throw new Error("No option set on loadVideo");if((0,b.Z)(e.url)){if((0,b.Z)(e.initialManifest)&&(0,b.Z)(e.manifestLoader))throw new Error("Unable to load a content: no url set on loadVideo.\nPlease provide at least either an `url` argument, a `initialManifest` option or a `manifestLoader` option so the RxPlayer can load the content.")}else i=String(e.url);if((0,b.Z)(e.transport))throw new Error("No transport set on loadVideo");a=String(e.transport);var y=(0,b.Z)(e.autoPlay)?v:!!e.autoPlay;if((0,b.Z)(e.keySystems))o=[];else for(var _,E=vn(o=Array.isArray(e.keySystems)?e.keySystems:[e.keySystems]);!(_=E()).done;){var T=_.value;if("string"!=typeof T.type||"function"!=typeof T.getLicense)throw new Error("Invalid key system given: Missing type string or getLicense callback")}var k=void 0!==e.lowLatencyMode&&!!e.lowLatencyMode,w=e.initialManifest,A=null!==(t=e.minimumManifestUpdateInterval)&&void 0!==t?t:0,I=null!==(n=e.defaultAudioTrackSwitchingMode)&&void 0!==n?n:void 0;void 0===I||(0,h.Z)(["seamless","direct","reload"],I)||(s.Z.warn("The `defaultAudioTrackSwitchingMode` loadVideo option must match one of the following strategy name:\n- `seamless`\n- `direct`\n- `reload`"),I=void 0);var R=(0,b.Z)(e.onCodecSwitch)?p:e.onCodecSwitch;if((0,h.Z)(["continue","reload"],R)||(s.Z.warn("The `onCodecSwitch` loadVideo option must match one of the following string:\n- `continue`\n- `reload`\nIf badly set, "+p+" will be used as default"),R=p),(0,b.Z)(e.textTrackMode))u=g;else{if("native"!==e.textTrackMode&&"html"!==e.textTrackMode)throw new Error("Invalid textTrackMode.");u=e.textTrackMode}var Z=(0,b.Z)(e.enableFastSwitching)?m:e.enableFastSwitching;if("html"===u){if((0,b.Z)(e.textTrackElement))throw new Error('You have to provide a textTrackElement in "html" textTrackMode.');if(!(e.textTrackElement instanceof HTMLElement))throw new Error("textTrackElement should be an HTMLElement.");d=e.textTrackElement}else(0,b.Z)(e.textTrackElement)||s.Z.warn('API: You have set a textTrackElement without being in an "html" textTrackMode. It will be ignored.');if(!(0,b.Z)(e.startAt))if(e.startAt.wallClockTime instanceof Date){var x=e.startAt.wallClockTime.getTime()/1e3;c=(0,S.Z)({},e.startAt,{wallClockTime:x})}else c=e.startAt;var P=null!==(r=e.requestConfig)&&void 0!==r?r:{};return{__priv_patchLastSegmentInSidx:e.__priv_patchLastSegmentInSidx,checkMediaSegmentIntegrity:e.checkMediaSegmentIntegrity,autoPlay:y,defaultAudioTrackSwitchingMode:I,enableFastSwitching:Z,initialManifest:w,keySystems:o,lowLatencyMode:k,manifestLoader:e.manifestLoader,manifestUpdateUrl:e.manifestUpdateUrl,minimumManifestUpdateInterval:A,requestConfig:P,onCodecSwitch:R,referenceDateTime:e.referenceDateTime,representationFilter:e.representationFilter,segmentLoader:e.segmentLoader,serverSyncInfos:e.serverSyncInfos,startAt:c,textTrackElement:d,textTrackMode:u,transport:a,url:i}}(e);s.Z.info("API: Calling loadvideo",t.url,t.transport),this._priv_reloadingMetadata={options:t},this._priv_initializeContentPlayback(t),this._priv_lastAutoPlay=t.autoPlay},i.reload=function(e){var t,n,r,i,a=this._priv_reloadingMetadata,o=a.options,s=a.manifest,u=a.reloadPosition,l=a.reloadInPause;if(void 0===o)throw new Error("API: Can't reload without having previously loaded a content.");if(function(e){var t,n,r,i;if(null===e||"object"!=typeof e&&void 0!==e)throw new Error("API: reload - Invalid options format.");if(null===(null==e?void 0:e.reloadAt)||"object"!=typeof(null==e?void 0:e.reloadAt)&&void 0!==(null==e?void 0:e.reloadAt))throw new Error("API: reload - Invalid 'reloadAt' option format.");if("number"!=typeof(null===(t=null==e?void 0:e.reloadAt)||void 0===t?void 0:t.position)&&void 0!==(null===(n=null==e?void 0:e.reloadAt)||void 0===n?void 0:n.position))throw new Error("API: reload - Invalid 'reloadAt.position' option format.");if("number"!=typeof(null===(r=null==e?void 0:e.reloadAt)||void 0===r?void 0:r.relative)&&void 0!==(null===(i=null==e?void 0:e.reloadAt)||void 0===i?void 0:i.relative))throw new Error("API: reload - Invalid 'reloadAt.relative' option format.")}(e),void 0!==(null===(t=null==e?void 0:e.reloadAt)||void 0===t?void 0:t.position))r={position:e.reloadAt.position};else if(void 0!==(null===(n=null==e?void 0:e.reloadAt)||void 0===n?void 0:n.relative)){if(void 0===u)throw new Error("Can't reload to a relative position when previous content was not loaded.");r={position:e.reloadAt.relative+u}}else void 0!==u&&(r={position:u});void 0!==(null==e?void 0:e.autoPlay)?i=e.autoPlay:void 0!==l&&(i=!l);var d=Object.assign(Object.assign({},o),{initialManifest:s});void 0!==r&&(d.startAt=r),void 0!==i&&(d.autoPlay=i),this._priv_initializeContentPlayback(d)},i.createDebugElement=function(e){if(null===v.Z.createDebugElement)throw new Error("Feature `DEBUG_ELEMENT` not added to the RxPlayer");var t=new k.ZP;return v.Z.createDebugElement(e,this,t.signal),{dispose:function(){t.cancel()}}},i._priv_initializeContentPlayback=function(e){var t,n,r,i,a=this,o=e.autoPlay,l=e.defaultAudioTrackSwitchingMode,c=e.enableFastSwitching,f=e.initialManifest,p=e.keySystems,m=e.lowLatencyMode,g=e.minimumManifestUpdateInterval,y=e.requestConfig,_=e.onCodecSwitch,b=e.startAt,E=e.transport,w=e.checkMediaSegmentIntegrity,A=e.manifestLoader,I=e.manifestUpdateUrl,R=e.referenceDateTime,Z=e.representationFilter,x=e.segmentLoader,P=e.serverSyncInfos,M=e.__priv_patchLastSegmentInSidx,C=e.url;if(null===this.videoElement)throw new Error("the attached video element is disposed");var D,N="directfile"===E,O=new k.ZP,L=this.videoElement,U=null;if(N){if(null===v.Z.directfile)throw this.stop(),this._priv_currentError=null,new Error("DirectFile feature not activated in your build.");if(U=this._priv_initializeMediaElementTracksStore(O.signal),O.isUsed())return;D=new v.Z.directfile.initDirectFile({autoPlay:o,keySystems:p,speed:this._priv_speed,startAt:b,url:C})}else{var B=v.Z.transports[E];if("function"!=typeof B)throw this.stop(),this._priv_currentError=null,new Error('transport "'+E+'" not supported');var F=B({lowLatencyMode:m,checkMediaSegmentIntegrity:w,manifestLoader:A,manifestUpdateUrl:I,referenceDateTime:R,representationFilter:Z,segmentLoader:x,serverSyncInfos:P,__priv_patchLastSegmentInSidx:M}),z={lowLatencyMode:m,maxRetry:null===(t=y.manifest)||void 0===t?void 0:t.maxRetry,requestTimeout:null===(n=y.manifest)||void 0===n?void 0:n.timeout,minimumManifestUpdateInterval:g,initialManifest:f},V=u(),K={throttleBitrate:{},limitResolution:{}};this._priv_throttleVideoBitrateWhenHidden&&(V?K.throttleBitrate={video:(0,T.lR)(Cn(this._priv_pictureInPictureRef,O.signal),(function(e){return e?1/0:0}),O.signal)}:s.Z.warn("API: Can't apply throttleVideoBitrateWhenHidden because browser can't be trusted for visibility.")),"videoElement"===this._priv_videoResolutionLimit?V?K.limitResolution={video:Dn(L,this._priv_pictureInPictureRef,O.signal)}:s.Z.warn("API: Can't apply videoResolutionLimit because browser can't be trusted for video size."):"screen"===this._priv_videoResolutionLimit&&(K.limitResolution={video:Nn(O.signal)});var G={initialBitrates:this._priv_bitrateInfos.lastBitrates,lowLatencyMode:m,throttlers:K},j="native"===e.textTrackMode?{textTrackMode:"native"}:{textTrackMode:"html",textTrackElement:e.textTrackElement},H=(0,S.Z)({enableFastSwitching:c,onCodecSwitch:_},this._priv_bufferOptions),W={lowLatencyMode:m,maxRetry:null===(r=y.segment)||void 0===r?void 0:r.maxRetry,requestTimeout:null===(i=y.segment)||void 0===i?void 0:i.timeout};D=new fn({adaptiveOptions:G,autoPlay:o,bufferOptions:H,keySystems:p,lowLatencyMode:m,manifestRequestSettings:z,transport:F,segmentRequestOptions:W,speed:this._priv_speed,startAt:b,textTrackOptions:j,url:C})}var q={contentId:Pn(),originalUrl:C,currentContentCanceller:O,defaultAudioTrackSwitchingMode:l,initializer:D,isDirectFile:N,segmentBuffersStore:null,manifest:null,currentPeriod:null,activeAdaptations:null,activeRepresentations:null,tracksStore:null,mediaElementTracksStore:U};D.addEventListener("error",(function(e){a._priv_onFatalError(e,q)})),D.addEventListener("warning",(function(e){var t=(0,d.Z)(e,{defaultCode:"NONE",defaultReason:"An unknown error happened."});s.Z.warn("API: Sending warning:",t),a.trigger("warning",t)})),D.addEventListener("reloadingMediaSource",(function(e){q.segmentBuffersStore=null,null!==q.tracksStore&&q.tracksStore.resetPeriodObjects(),a._priv_lastAutoPlay=e.autoPlay})),D.addEventListener("inbandEvents",(function(e){return a.trigger("inbandEvents",e)})),D.addEventListener("streamEvent",(function(e){return a.trigger("streamEvent",e)})),D.addEventListener("streamEventSkip",(function(e){return a.trigger("streamEventSkip",e)})),D.addEventListener("activePeriodChanged",(function(e){return a._priv_onActivePeriodChanged(q,e)})),D.addEventListener("periodStreamReady",(function(e){return a._priv_onPeriodStreamReady(q,e)})),D.addEventListener("periodStreamCleared",(function(e){return a._priv_onPeriodStreamCleared(q,e)})),D.addEventListener("representationChange",(function(e){return a._priv_onRepresentationChange(q,e)})),D.addEventListener("adaptationChange",(function(e){return a._priv_onAdaptationChange(q,e)})),D.addEventListener("bitrateEstimateChange",(function(e){return a._priv_onBitrateEstimateChange(e)})),D.addEventListener("manifestReady",(function(e){return a._priv_onManifestReady(q,e)})),D.addEventListener("loaded",(function(e){q.segmentBuffersStore=e.segmentBuffersStore})),D.prepare(),this.stop();var Y=new mn(L,{withMediaSource:!N,lowLatencyMode:m});O.signal.register((function(){Y.stop()}));var X=function(e,t,n,r){var i=(0,T.ZP)("LOADING",r);e.addEventListener("loaded",(function(){if("LOADING"===i.getValue()){if(i.setValue("LOADED"),!r.isCancelled()){var e=In(t,null);"PAUSED"!==e&&i.setValue(e)}}else"RELOADING"===i.getValue()?i.setValue(In(t,null)):o(null)}),r),e.addEventListener("reloadingMediaSource",(function(){Rn(i.getValue())&&i.setValueIfChanged("RELOADING")}),r);var a=null;return e.addEventListener("stalled",(function(e){e!==a&&(o(e),a=e)}),r),e.addEventListener("unstalled",(function(){null!==a&&(o(null),a=null)}),r),n.listen((function(e){(0,h.Z)(["seeking","ended","play","pause"],e.event)&&o(a)}),{clearSignal:r}),i;function o(e){if(Rn(i.getValue())){var n=In(t,e);"LOADED"===i.getValue()&&"PAUSED"===n||i.setValueIfChanged(n)}}}(D,L,Y,O.signal);O.signal.register((function(){D.dispose()}));var Q=function(e){switch(e){case"STOPPED":case"RELOADING":case"LOADING":break;case"ENDED":a._priv_reloadingMetadata.reloadInPause=!0,a._priv_reloadingMetadata.reloadPosition=Y.getReference().getValue().position;break;default:var t=Y.getReference().getValue();a._priv_reloadingMetadata.reloadInPause=t.paused,a._priv_reloadingMetadata.reloadPosition=t.position}},$=null,J=function(e){null!==$&&($.cancel(),$=null),X.onUpdate((function(t,n){var r,i,o,s;Rn(t)&&(n(),null!==$&&$.cancel(),($=new k.ZP).linkToSignal(O.signal),e!==!L.paused&&(L.paused?a.trigger("pause",null):a.trigger("play",null)),r=L,i=function(){return a.trigger("play",null)},o=function(){return a.trigger("pause",null)},(s=O.signal).isCancelled()||null===r||(r.addEventListener("play",i),r.addEventListener("pause",o),s.register((function(){r.removeEventListener("play",i),r.removeEventListener("pause",o)}))))}),{emitCurrentValue:!1,clearSignal:O.signal})};J(o),D.addEventListener("reloadingMediaSource",(function(e){J(e.autoPlay)}));var ee=null;X.onUpdate((function(e){Q(e),a._priv_setPlayerState(e),O.isUsed()||(null!==ee?Rn(a.state)||(ee.cancel(),ee=null):Rn(a.state)&&((ee=new k.ZP).linkToSignal(O.signal),function(e,t,n,r,i){if(!i.isCancelled()&&null!==e){var a=t.getReference().getValue().seeking;a&&(n(),i.isCancelled())||t.listen((function(e){"seeking"===e.event?(a=!0,n()):a&&"seeked"===e.event&&(a=!1,r())}),{includeLastObservation:!0,clearSignal:i})}}(L,Y,(function(){return a.trigger("seeking",null)}),(function(){return a.trigger("seeked",null)}),ee.signal)))}),{emitCurrentValue:!0,clearSignal:O.signal}),Y.listen((function(e){Q(a.state),a._priv_triggerPositionUpdate(q,e)}),{clearSignal:O.signal}),this._priv_currentError=null,this._priv_contentInfos=q,O.signal.register((function(){D.removeEventListener()})),this._priv_contentLock.onUpdate((function(e,t){e||(t(),D.start(L,Y))}),{emitCurrentValue:!0,clearSignal:O.signal})},i.getError=function(){return this._priv_currentError},i.getVideoElement=function(){return this.videoElement},i.getPlayerState=function(){return this.state},i.isContentLoaded=function(){return!(0,h.Z)(["LOADING","RELOADING","STOPPED"],this.state)},i.isBuffering=function(){return(0,h.Z)(["BUFFERING","SEEKING","LOADING","RELOADING"],this.state)},i.isPaused=function(){return!this.videoElement||((0,h.Z)(["LOADING","RELOADING"],this.state)?!this._priv_lastAutoPlay:this.videoElement.paused)},i.isLive=function(){if(null===this._priv_contentInfos)return!1;var e=this._priv_contentInfos,t=e.isDirectFile,n=e.manifest;return!t&&null!==n&&n.isLive},i.areTrickModeTracksEnabled=function(){return this._priv_preferTrickModeTracks},i.getContentUrls=function(){if(null!==this._priv_contentInfos){var e=this._priv_contentInfos,t=e.isDirectFile,n=e.manifest,r=e.originalUrl;return t?void 0===r?void 0:[r]:null!==n?n.getUrls():void 0}},i.updateContentUrls=function(e,t){if(null===this._priv_contentInfos)throw new Error("No content loaded");var n=!0===(null==t?void 0:t.refresh);this._priv_contentInfos.initializer.updateContentUrls(e,n)},i.getMediaDuration=function(){if(null===this.videoElement)throw new Error("Disposed player");return this.videoElement.duration},i.getCurrentBufferGap=function(){if(null===this.videoElement)throw new Error("Disposed player");var e=this.videoElement,t=(0,E.L7)(e.buffered,e.currentTime);return t===1/0?0:t},i.getWallClockTime=function(){if(null===this.videoElement)throw new Error("Disposed player");if(null===this._priv_contentInfos)return this.videoElement.currentTime;var e=this._priv_contentInfos,t=e.isDirectFile,n=e.manifest;if(t){var r=a(this.videoElement);return(null!=r?r:0)+this.videoElement.currentTime}return null!==n?this.videoElement.currentTime+(void 0!==n.availabilityStartTime?n.availabilityStartTime:0):0},i.getPosition=function(){if(null===this.videoElement)throw new Error("Disposed player");return this.videoElement.currentTime},i.getLastStoredContentPosition=function(){return this._priv_reloadingMetadata.reloadPosition},i.getPlaybackRate=function(){return this._priv_speed.getValue()},i.setPlaybackRate=function(e,t){var n;e!==this._priv_speed.getValue()&&this._priv_speed.setValue(e);var r=null==t?void 0:t.preferTrickModeTracks;if("boolean"==typeof r){this._priv_preferTrickModeTracks=r;var i=null===(n=this._priv_contentInfos)||void 0===n?void 0:n.tracksStore;(0,b.Z)(i)||(r&&!i.isTrickModeEnabled()?i.enableVideoTrickModeTracks():!r&&i.isTrickModeEnabled()&&i.disableVideoTrickModeTracks())}},i.getVideoRepresentation=function(){var e=this.__priv_getCurrentRepresentations();if(null!==e)return e.video},i.getAudioRepresentation=function(){var e=this.__priv_getCurrentRepresentations();if(null!==e)return e.audio},i.play=function(){var e=this;if(null===this.videoElement)throw new Error("Disposed player");var t=this.videoElement.play();return(0,b.Z)(t)||"function"!=typeof t.catch?Promise.resolve():t.catch((function(t){if("NotAllowedError"===t.name){var n=new c.Z("MEDIA_ERR_PLAY_NOT_ALLOWED",t.toString());e.trigger("warning",n)}throw t}))},i.pause=function(){if(null===this.videoElement)throw new Error("Disposed player");this.videoElement.pause()},i.seekTo=function(e){var t;if(null===this.videoElement)throw new Error("Disposed player");if(null===this._priv_contentInfos)throw new Error("player: no content loaded");var n,r=this._priv_contentInfos,i=r.isDirectFile,o=r.manifest;if(!i&&null===o)throw new Error("player: the content did not load yet");if("number"==typeof e)n=e;else if("object"==typeof e){var u=e,l=this.videoElement.currentTime;if((0,b.Z)(u.relative))if((0,b.Z)(u.position)){if((0,b.Z)(u.wallClockTime))throw new Error('invalid time object. You must set one of the following properties: "relative", "position" or "wallClockTime"');if(null!==o)n=u.wallClockTime-(null!==(t=o.availabilityStartTime)&&void 0!==t?t:0);else if(i&&null!==this.videoElement){var d=a(this.videoElement);void 0!==d&&(n=u.wallClockTime-d)}void 0===n&&(n=u.wallClockTime)}else n=u.position;else n=l+u.relative}if(void 0===n)throw new Error("invalid time given");return s.Z.info("API: API Seek to",n),this.videoElement.currentTime=n,n},i.getVolume=function(){if(null===this.videoElement)throw new Error("Disposed player");return this.videoElement.volume},i.setVolume=function(e){if(null===this.videoElement)throw new Error("Disposed player");var t=this.videoElement;e!==t.volume&&(t.volume=e,this.trigger("volumeChange",e))},i.isMute=function(){return 0===this.getVolume()},i.mute=function(){this._priv_mutedMemory=this.getVolume(),this.setVolume(0)},i.unMute=function(){var e=l.Z.getCurrent().DEFAULT_UNMUTED_VOLUME;0===this.getVolume()&&this.setVolume(0===this._priv_mutedMemory?e:this._priv_mutedMemory)},i.setMaxBufferBehind=function(e){this._priv_bufferOptions.maxBufferBehind.setValue(e)},i.setMaxBufferAhead=function(e){this._priv_bufferOptions.maxBufferAhead.setValue(e)},i.setWantedBufferAhead=function(e){this._priv_bufferOptions.wantedBufferAhead.setValue(e)},i.setMaxVideoBufferSize=function(e){this._priv_bufferOptions.maxVideoBufferSize.setValue(e)},i.getMaxBufferBehind=function(){return this._priv_bufferOptions.maxBufferBehind.getValue()},i.getMaxBufferAhead=function(){return this._priv_bufferOptions.maxBufferAhead.getValue()},i.getWantedBufferAhead=function(){return this._priv_bufferOptions.wantedBufferAhead.getValue()},i.getMaxVideoBufferSize=function(){return this._priv_bufferOptions.maxVideoBufferSize.getValue()},i.getCurrentPeriod=function(){var e,t=null===(e=this._priv_contentInfos)||void 0===e?void 0:e.currentPeriod;return(0,b.Z)(t)?null:{id:t.id,start:t.start,end:t.end}},i.getKeySystemConfiguration=function(){if(null===this.videoElement)throw new Error("Disposed player");var e=M(this.videoElement);return null===e?null:{keySystem:e[0],configuration:e[1]}},i.getAvailablePeriods=function(){if(null===this._priv_contentInfos)return[];var e=this._priv_contentInfos,t=e.isDirectFile,n=e.tracksStore;return t||null===n?[]:n.getAvailablePeriods().slice()},i.getAvailableAudioTracks=function(e){var t;if(null===this._priv_contentInfos)return[];var n=this._priv_contentInfos,r=n.isDirectFile,i=n.mediaElementTracksStore;return r?null!==(t=null==i?void 0:i.getAvailableAudioTracks())&&void 0!==t?t:[]:this._priv_callTracksStoreGetterSetter(e,[],(function(e,t){var n;return null!==(n=e.getAvailableAudioTracks(t))&&void 0!==n?n:[]}))},i.getAvailableTextTracks=function(e){var t;if(null===this._priv_contentInfos)return[];var n=this._priv_contentInfos,r=n.isDirectFile,i=n.mediaElementTracksStore;return r?null!==(t=null==i?void 0:i.getAvailableTextTracks())&&void 0!==t?t:[]:this._priv_callTracksStoreGetterSetter(e,[],(function(e,t){var n;return null!==(n=e.getAvailableTextTracks(t))&&void 0!==n?n:[]}))},i.getAvailableVideoTracks=function(e){var t;if(null===this._priv_contentInfos)return[];var n=this._priv_contentInfos,r=n.isDirectFile,i=n.mediaElementTracksStore;return r?null!==(t=null==i?void 0:i.getAvailableVideoTracks())&&void 0!==t?t:[]:this._priv_callTracksStoreGetterSetter(e,[],(function(e,t){var n;return null!==(n=e.getAvailableVideoTracks(t))&&void 0!==n?n:[]}))},i.getAudioTrack=function(e){if(null!==this._priv_contentInfos){var t=this._priv_contentInfos,n=t.isDirectFile,r=t.mediaElementTracksStore;if(n){if(null===r)return;return r.getChosenAudioTrack()}return this._priv_callTracksStoreGetterSetter(e,void 0,(function(e,t){return e.getChosenAudioTrack(t)}))}},i.getTextTrack=function(e){if(null!==this._priv_contentInfos){var t=this._priv_contentInfos,n=t.isDirectFile,r=t.mediaElementTracksStore;if(n){if(null===r)return;return r.getChosenTextTrack()}return this._priv_callTracksStoreGetterSetter(e,void 0,(function(e,t){return e.getChosenTextTrack(t)}))}},i.getVideoTrack=function(e){if(null!==this._priv_contentInfos){var t=this._priv_contentInfos,n=t.isDirectFile,r=t.mediaElementTracksStore;if(n){if(null===r)return;return r.getChosenVideoTrack()}return this._priv_callTracksStoreGetterSetter(e,void 0,(function(e,t){return e.getChosenVideoTrack(t)}))}},i.setAudioTrack=function(e){var t;if(null===this._priv_contentInfos)throw new Error("No content loaded");var n,r,i,a=this._priv_contentInfos,o=a.isDirectFile,s=a.mediaElementTracksStore;if(o)try{var u="string"==typeof e?e:e.trackId;return void(null==s||s.setAudioTrackById(u))}catch(e){throw new Error("player: unknown audio track")}var l=null;return"string"==typeof e?r=e:(r=e.trackId,n=e.periodId,i=e.switchingMode,l=null!==(t=e.lockedRepresentations)&&void 0!==t?t:null),this._priv_callTracksStoreGetterSetter(n,void 0,(function(e,t){return e.setAudioTrack(t,r,i,l)}))},i.setTextTrack=function(e){if(null===this._priv_contentInfos)throw new Error("No content loaded");var t,n,r=this._priv_contentInfos,i=r.isDirectFile,a=r.mediaElementTracksStore;if(i)try{var o="string"==typeof e?e:e.trackId;return void(null==a||a.setTextTrackById(o))}catch(e){throw new Error("player: unknown text track")}return"string"==typeof e?n=e:(n=e.trackId,t=e.periodId),this._priv_callTracksStoreGetterSetter(t,void 0,(function(e,t){return e.setTextTrack(t,n)}))},i.disableTextTrack=function(e){if(null!==this._priv_contentInfos){var t=this._priv_contentInfos,n=t.isDirectFile,r=t.mediaElementTracksStore;if(!n)return this._priv_callTracksStoreGetterSetter(e,void 0,(function(e,t){return e.disableTrack(t,"text")}));null==r||r.disableTextTrack()}},i.setVideoTrack=function(e){var t;if(null===this._priv_contentInfos)throw new Error("No content loaded");var n,r,i,a=this._priv_contentInfos,o=a.isDirectFile,s=a.mediaElementTracksStore;if(o)try{var u="string"==typeof e?e:e.trackId;return void(null==s||s.setVideoTrackById(u))}catch(e){throw new Error("player: unknown video track")}var l=null;return"string"==typeof e?r=e:(r=e.trackId,n=e.periodId,i=e.switchingMode,l=null!==(t=e.lockedRepresentations)&&void 0!==t?t:null),this._priv_callTracksStoreGetterSetter(n,void 0,(function(e,t){return e.setVideoTrack(t,r,i,l)}))},i.disableVideoTrack=function(e){if(null!==this._priv_contentInfos){var t=this._priv_contentInfos,n=t.isDirectFile,r=t.mediaElementTracksStore;return n&&null!==r?r.disableVideoTrack():this._priv_callTracksStoreGetterSetter(e,void 0,(function(e,t){return e.disableTrack(t,"video")}))}},i.lockVideoRepresentations=function(e){if(null===this._priv_contentInfos)throw new Error("No content loaded");var t,n,r;if(this._priv_contentInfos.isDirectFile)throw new Error("Cannot lock video Representations in directfile mode.");return Array.isArray(e)?(t=e,n=void 0):(t=e.representations,n=e.periodId,r=e.switchingMode),this._priv_callTracksStoreGetterSetter(n,void 0,(function(e,n){return e.lockVideoRepresentations(n,{representations:t,switchingMode:r})}))},i.lockAudioRepresentations=function(e){if(null===this._priv_contentInfos)throw new Error("No content loaded");var t,n,r;if(this._priv_contentInfos.isDirectFile)throw new Error("Cannot lock audio Representations in directfile mode.");return Array.isArray(e)?(t=e,n=void 0):(t=e.representations,n=e.periodId,r=e.switchingMode),this._priv_callTracksStoreGetterSetter(n,void 0,(function(e,n){return e.lockAudioRepresentations(n,{representations:t,switchingMode:r})}))},i.getLockedVideoRepresentations=function(e){return null===this._priv_contentInfos||this._priv_contentInfos.isDirectFile?null:this._priv_callTracksStoreGetterSetter(e,null,(function(e,t){return e.getLockedVideoRepresentations(t)}))},i.getLockedAudioRepresentations=function(e){return null===this._priv_contentInfos||this._priv_contentInfos.isDirectFile?null:this._priv_callTracksStoreGetterSetter(e,null,(function(e,t){return e.getLockedAudioRepresentations(t)}))},i.unlockVideoRepresentations=function(e){if(null!==this._priv_contentInfos&&!this._priv_contentInfos.isDirectFile)return this._priv_callTracksStoreGetterSetter(e,void 0,(function(e,t){return e.unlockVideoRepresentations(t)}))},i.unlockAudioRepresentations=function(e){if(null!==this._priv_contentInfos&&!this._priv_contentInfos.isDirectFile)return this._priv_callTracksStoreGetterSetter(e,void 0,(function(e,t){return e.unlockAudioRepresentations(t)}))},i.getMinimumPosition=function(){if(null===this._priv_contentInfos)return null;if(this._priv_contentInfos.isDirectFile)return 0;var e=this._priv_contentInfos.manifest;return null!==e?e.getMinimumSafePosition():null},i.getMaximumPosition=function(){if(null===this._priv_contentInfos)return null;var e=this._priv_contentInfos,t=e.isDirectFile,n=e.manifest;if(t){if(null===this.videoElement)throw new Error("Disposed player");return this.videoElement.duration}return null!==n?n.isDynamic||null===this.videoElement?n.getMaximumSafePosition():this.videoElement.duration:null},i.__priv_getSegmentBufferContent=function(e){if(null===this._priv_contentInfos||null===this._priv_contentInfos.segmentBuffersStore)return null;var t=this._priv_contentInfos.segmentBuffersStore.getStatus(e);return"initialized"===t.type?t.value.getInventory():null},i.__priv_getManifest=function(){return null===this._priv_contentInfos?null:this._priv_contentInfos.manifest},i.__priv_getCurrentAdaptation=function(){if(null===this._priv_contentInfos)return null;var e=this._priv_contentInfos,t=e.currentPeriod,n=e.activeAdaptations;return null===t||null===n||(0,b.Z)(n[t.id])?null:n[t.id]},i.__priv_getCurrentRepresentations=function(){if(null===this._priv_contentInfos)return null;var e=this._priv_contentInfos,t=e.currentPeriod,n=e.activeRepresentations;return null===t||null===n||(0,b.Z)(n[t.id])?null:n[t.id]},i._priv_cleanUpCurrentContentState=function(){var e,t,n,r,i=this;s.Z.debug("Locking `contentLock` to clean-up the current content."),this._priv_contentLock.setValue(!0),null===(t=null===(e=this._priv_contentInfos)||void 0===e?void 0:e.tracksStore)||void 0===t||t.dispose(),null===(r=null===(n=this._priv_contentInfos)||void 0===n?void 0:n.mediaElementTracksStore)||void 0===r||r.dispose(),this._priv_contentInfos=null,this._priv_contentEventsMemory={};var a=function(){null!==i.videoElement&&(s.Z.debug("Unlocking `contentLock`. Next content can begin."),i._priv_contentLock.setValue(!1))};(0,b.Z)(this.videoElement)?a():C(this.videoElement).then((function(){s.Z.debug("API: DRM session cleaned-up with success!"),a()}),(function(e){s.Z.error("API: An error arised when trying to clean-up the DRM session:"+(e instanceof Error?e.toString():"Unknown Error")),a()}))},i._priv_onManifestReady=function(e,t){var n,r=this;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){e.manifest=t,this._priv_reloadingMetadata.manifest=t;var i=new Sn({preferTrickModeTracks:this._priv_preferTrickModeTracks,defaultAudioTrackSwitchingMode:e.defaultAudioTrackSwitchingMode});e.tracksStore=i,i.addEventListener("newAvailablePeriods",(function(e){r.trigger("newAvailablePeriods",e)})),i.addEventListener("brokenRepresentationsLock",(function(e){r.trigger("brokenRepresentationsLock",e)})),i.addEventListener("trackUpdate",(function(e){var t,n;r.trigger("trackUpdate",e);var i=null!==(n=null===(t=r._priv_contentInfos)||void 0===t?void 0:t.currentPeriod)&&void 0!==n?n:void 0;"no-playable-representation"===e.reason&&e.period.id===(null==i?void 0:i.id)&&r._priv_onAvailableTracksMayHaveChanged(e.trackType)})),e.tracksStore.addEventListener("warning",(function(e){r.trigger("warning",e)})),e.tracksStore.addEventListener("error",(function(t){r._priv_onFatalError(t,e)})),e.tracksStore.updatePeriodList(t),t.addEventListener("manifestUpdate",(function(n){var i,a,o;(0,b.Z)(null==e?void 0:e.tracksStore)||e.tracksStore.updatePeriodList(t);var s=null!==(a=null===(i=r._priv_contentInfos)||void 0===i?void 0:i.currentPeriod)&&void 0!==a?a:void 0,u=null===(o=r._priv_contentInfos)||void 0===o?void 0:o.tracksStore;if(void 0!==s&&!(0,b.Z)(u))for(var l,d=Zn(n.updatedPeriods);!(l=d()).done;){var c=l.value;if(c.period.id===s.id&&(c.result.addedAdaptations.length>0||c.result.removedAdaptations.length>0)){if(void 0===u.getPeriodObjectFromPeriod(s))return;r._priv_onAvailableTracksMayHaveChanged("audio"),r._priv_onAvailableTracksMayHaveChanged("text"),r._priv_onAvailableTracksMayHaveChanged("video")}return}}),e.currentContentCanceller.signal),t.addEventListener("decipherabilityUpdate",(function(t){for(var n,i=t.reduce((function(t,n){var r,i,a;if(!(void 0===(0,p.Z)(t,(function(e){return e[0].id===n.period.id&&e[1]===n.adaptation.type})))){var o=e.tracksStore;if(null===o)return t;var s=!1,u=o.getPeriodObjectFromPeriod(n.period);if(void 0===u)return t;switch(n.adaptation.type){case"audio":s=(null===(r=o.getChosenAudioTrack(u))||void 0===r?void 0:r.id)===n.adaptation.id;break;case"video":s=(null===(i=o.getChosenVideoTrack(u))||void 0===i?void 0:i.id)===n.adaptation.id;break;case"text":s=(null===(a=o.getChosenTextTrack(u))||void 0===a?void 0:a.id)===n.adaptation.id}s&&t.push([n.period,n.adaptation.type])}return t}),[]),a=Zn(i);!(n=a()).done;){var o=n.value,s=o[0],u=o[1];r._priv_triggerEventIfNotStopped("representationListUpdate",{period:s,trackType:u,reason:"decipherability-update"},e.currentContentCanceller.signal)}}),e.currentContentCanceller.signal)}},i._priv_onActivePeriodChanged=function(e,t){var n,r,i,a,o,s,u=t.period;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){e.currentPeriod=u;var l=e.currentContentCanceller.signal;this._priv_contentEventsMemory.periodChange!==u&&(this._priv_contentEventsMemory.periodChange=u,this._priv_triggerEventIfNotStopped("periodChange",{start:u.start,end:u.end,id:u.id},l)),this._priv_triggerEventIfNotStopped("availableAudioTracksChange",this.getAvailableAudioTracks(),l),this._priv_triggerEventIfNotStopped("availableTextTracksChange",this.getAvailableTextTracks(),l),this._priv_triggerEventIfNotStopped("availableVideoTracksChange",this.getAvailableVideoTracks(),l);var d=null===(r=this._priv_contentInfos)||void 0===r?void 0:r.tracksStore;if((0,b.Z)(d))this._priv_triggerEventIfNotStopped("audioTrackChange",null,l),this._priv_triggerEventIfNotStopped("textTrackChange",null,l),this._priv_triggerEventIfNotStopped("videoTrackChange",null,l);else{var c=d.getPeriodObjectFromPeriod(u);if(c){var f=d.getChosenAudioTrack(c);this._priv_triggerEventIfNotStopped("audioTrackChange",f,l);var v=d.getChosenTextTrack(c);this._priv_triggerEventIfNotStopped("textTrackChange",v,l);var p=d.getChosenVideoTrack(c);this._priv_triggerEventIfNotStopped("videoTrackChange",p,l)}}var h=null!==(a=null===(i=this.__priv_getCurrentRepresentations())||void 0===i?void 0:i.audio)&&void 0!==a?a:null;this._priv_triggerEventIfNotStopped("audioRepresentationChange",h,l);var m=null!==(s=null===(o=this.__priv_getCurrentRepresentations())||void 0===o?void 0:o.video)&&void 0!==s?s:null;this._priv_triggerEventIfNotStopped("videoRepresentationChange",m,l)}},i._priv_onPeriodStreamReady=function(e,t){var n;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){var r=t.type,i=t.manifest,a=t.period,o=t.adaptationRef,u=e.tracksStore;switch(r){case"video":case"audio":case"text":(0,b.Z)(u)?(s.Z.error("API: TracksStore not instanciated for a new "+r+" period"),o.setValue(null)):u.addTrackReference(r,i,a,o);break;default:(0,g.Z)(r)}}},i._priv_onPeriodStreamCleared=function(e,t){var n;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){var r=t.type,i=t.period,a=e.tracksStore;switch(r){case"audio":case"text":case"video":(0,b.Z)(a)||a.removeTrackReference(r,i)}var o=e.activeAdaptations,s=e.activeRepresentations;if(!(0,b.Z)(o)&&!(0,b.Z)(o[i.id])){var u=o[i.id];delete u[r],0===Object.keys(u).length&&delete o[i.id]}if(!(0,b.Z)(s)&&!(0,b.Z)(s[i.id])){var l=s[i.id];delete l[r],0===Object.keys(l).length&&delete s[i.id]}}},i._priv_onAdaptationChange=function(e,t){var n,r=t.type,i=t.adaptation,a=t.period;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){null===e.activeAdaptations&&(e.activeAdaptations={});var o,s=e.activeAdaptations,u=e.currentPeriod,l=s[a.id];if((0,b.Z)(l))s[a.id]=((o={})[r]=i,o);else l[r]=i;var d=e.tracksStore,c=e.currentContentCanceller.signal;if(null!==d&&null!==u&&!(0,b.Z)(a)&&a.id===u.id){var f=d.getPeriodObjectFromPeriod(a);if(void 0===f)return;switch(r){case"audio":var v=d.getChosenAudioTrack(f);this._priv_triggerEventIfNotStopped("audioTrackChange",v,c);break;case"text":var p=d.getChosenTextTrack(f);this._priv_triggerEventIfNotStopped("textTrackChange",p,c);break;case"video":var h=d.getChosenVideoTrack(f);this._priv_triggerEventIfNotStopped("videoTrackChange",h,c)}}}},i._priv_onRepresentationChange=function(e,t){var n,r=t.type,i=t.period,a=t.representation;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){null===e.activeRepresentations&&(e.activeRepresentations={});var o,s=e.activeRepresentations,u=e.currentPeriod,l=s[i.id];if((0,b.Z)(l))s[i.id]=((o={})[r]=a,o);else l[r]=a;if(!(0,b.Z)(i)&&null!==u&&u.id===i.id){var d=this._priv_contentInfos.currentContentCanceller.signal;"video"===r?this._priv_triggerEventIfNotStopped("videoRepresentationChange",a,d):"audio"===r&&this._priv_triggerEventIfNotStopped("audioRepresentationChange",a,d)}}},i._priv_onBitrateEstimateChange=function(e){var t=e.type,n=e.bitrate;void 0!==n&&(this._priv_bitrateInfos.lastBitrates[t]=n),this.trigger("__priv_bitrateEstimateChange",{type:t,bitrate:n})},i._priv_setPlayerState=function(e){this.state!==e&&(this.state=e,s.Z.info("API: playerStateChange event",e),this.trigger("playerStateChange",e))},i._priv_triggerPositionUpdate=function(e,t){var n,r;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){var i=e.isDirectFile,o=e.manifest;if((i||null!==o)&&!(0,b.Z)(t)){var s=null!==o?o.getMaximumSafePosition():void 0,u={position:t.position,duration:t.duration,playbackRate:t.playbackRate,maximumPosition:s,bufferGap:void 0!==t.bufferGap&&isFinite(t.bufferGap)?t.bufferGap:0};if(null!==o&&o.isLive&&t.position>0){var l=null!==(r=o.availabilityStartTime)&&void 0!==r?r:0;u.wallClockTime=t.position+l;var d=o.getLivePosition();void 0!==d&&(u.liveGap=d-t.position)}else if(i&&null!==this.videoElement){var c=a(this.videoElement);void 0!==c&&(u.wallClockTime=c+t.position)}this.trigger("positionUpdate",u)}}},i._priv_triggerEventIfNotStopped=function(e,t,n){n.isCancelled()||this.trigger(e,t)},i._priv_initializeMediaElementTracksStore=function(e){var t,n,r,i=this;(0,m.Z)(null!==v.Z.directfile,"Initializing `MediaElementTracksStore` without Directfile feature"),(0,m.Z)(null!==this.videoElement,"Initializing `MediaElementTracksStore` on a disposed RxPlayer");var a=new v.Z.directfile.mediaElementTracksStore(this.videoElement);return this._priv_triggerEventIfNotStopped("availableAudioTracksChange",a.getAvailableAudioTracks(),e),this._priv_triggerEventIfNotStopped("availableVideoTracksChange",a.getAvailableVideoTracks(),e),this._priv_triggerEventIfNotStopped("availableTextTracksChange",a.getAvailableTextTracks(),e),this._priv_triggerEventIfNotStopped("audioTrackChange",null!==(t=a.getChosenAudioTrack())&&void 0!==t?t:null,e),this._priv_triggerEventIfNotStopped("textTrackChange",null!==(n=a.getChosenTextTrack())&&void 0!==n?n:null,e),this._priv_triggerEventIfNotStopped("videoTrackChange",null!==(r=a.getChosenVideoTrack())&&void 0!==r?r:null,e),a.addEventListener("availableVideoTracksChange",(function(e){return i.trigger("availableVideoTracksChange",e)})),a.addEventListener("availableAudioTracksChange",(function(e){return i.trigger("availableAudioTracksChange",e)})),a.addEventListener("availableTextTracksChange",(function(e){return i.trigger("availableTextTracksChange",e)})),a.addEventListener("audioTrackChange",(function(e){return i.trigger("audioTrackChange",e)})),a.addEventListener("videoTrackChange",(function(e){return i.trigger("videoTrackChange",e)})),a.addEventListener("textTrackChange",(function(e){return i.trigger("textTrackChange",e)})),a},i._priv_callTracksStoreGetterSetter=function(e,t,n){var r,i;if(null===this._priv_contentInfos||null===this._priv_contentInfos.tracksStore)return s.Z.warn("API: Trying to call track API too soon"),t;var a=this._priv_contentInfos.tracksStore,o=null!==(i=null===(r=this._priv_contentInfos)||void 0===r?void 0:r.currentPeriod)&&void 0!==i?i:void 0,u=null!=e?e:null==o?void 0:o.id;if(void 0===u)return t;var l=u===(null==o?void 0:o.id)?a.getPeriodObjectFromPeriod(o):a.getPeriodObjectFromId(u);return void 0===l?t:n(a,l)},i._priv_onAvailableTracksMayHaveChanged=function(e,t){var n=this._priv_contentInfos;if(null!==n){var r=n.currentPeriod,i=n.tracksStore,a=n.currentContentCanceller.signal;if(!(0,b.Z)(r)&&null!==i){var o=null!=t?t:i.getPeriodObjectFromPeriod(r);if(void 0!==o)switch(e){case"video":var s=i.getAvailableVideoTracks(o);this._priv_triggerEventIfNotStopped("availableVideoTracksChange",null!=s?s:[],a);break;case"audio":var u=i.getAvailableAudioTracks(o);this._priv_triggerEventIfNotStopped("availableAudioTracksChange",null!=u?u:[],a);break;case"text":var l=i.getAvailableTextTracks(o);this._priv_triggerEventIfNotStopped("availableTextTracksChange",null!=l?l:[],a);break;default:(0,g.Z)(e)}}}},i._priv_onFatalError=function(e,t){var n=(0,d.Z)(e,{defaultCode:"NONE",defaultReason:"An unknown error stopped content playback."});n.fatal=!0,t.currentContentCanceller.cancel(),this._priv_cleanUpCurrentContentState(),this._priv_currentError=n,s.Z.error("API: The player stopped because of an error",n),this._priv_setPlayerState("STOPPED"),this._priv_currentError===n&&this.trigger("error",n)},(0,e.Z)(r,null,[{key:"ErrorTypes",get:function(){return f.ZB}},{key:"ErrorCodes",get:function(){return f.SM}},{key:"LogLevel",get:function(){return s.Z.getLevel()},set:function(e){s.Z.setLevel(e)}}]),r}(y.Z);On.version="4.0.0-beta.2";var Ln=On,Un=n(7273);!function(){Un.Z.ContentDecryptor=n(1266).ZP,Un.Z.transports.smooth=n(5418).Z,Un.Z.transports.dash=n(2047).Z,Un.Z.dashParsers.js=n(8337).Z,Un.Z.nativeTextTracksBuffer=n(9059).Z,Un.Z.nativeTextTracksParsers.vtt=n(9405).Z,Un.Z.nativeTextTracksParsers.ttml=n(1570).Z,Un.Z.nativeTextTracksParsers.sami=n(1812).Z,Un.Z.nativeTextTracksParsers.srt=n(8057).Z,Un.Z.htmlTextTracksBuffer=n(5192).Z,Un.Z.htmlTextTracksParsers.sami=n(5734).Z,Un.Z.htmlTextTracksParsers.ttml=n(7439).Z,Un.Z.htmlTextTracksParsers.srt=n(8675).Z,Un.Z.htmlTextTracksParsers.vtt=n(4099).Z;var e=n(9372).Z,t=n(1932).Z;Un.Z.directfile={initDirectFile:e,mediaElementTracksStore:t}}(),"boolean"==typeof __RX_PLAYER_DEBUG_MODE__&&__RX_PLAYER_DEBUG_MODE__&&s.Z.setLevel("DEBUG");var Bn=Ln}(),r=r.default}()}));
2
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.RxPlayer=t():e.RxPlayer=t()}(self,(function(){return function(){var e={473:function(e){"use strict";var t=function(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return e},n=function(e){var n,r,i=document.createTextNode(""),a=0;return new e((function(){var e;if(n)r&&(n=r.concat(n));else{if(!r)return;n=r}if(r=n,n=null,"function"==typeof r)return e=r,r=null,void e();for(i.data=a=++a%2;r;)e=r.shift(),r.length||(r=null),e()})).observe(i,{characterData:!0}),function(e){t(e),n?"function"==typeof n?n=[n,e]:n.push(e):(n=e,i.data=a=++a%2)}};e.exports=function(){if("object"==typeof process&&process&&"function"==typeof process.nextTick)return process.nextTick;if("function"==typeof queueMicrotask)return function(e){queueMicrotask(t(e))};if("object"==typeof document&&document){if("function"==typeof MutationObserver)return n(MutationObserver);if("function"==typeof WebKitMutationObserver)return n(WebKitMutationObserver)}return"function"==typeof setImmediate?function(e){setImmediate(t(e))}:"function"==typeof setTimeout||"object"==typeof setTimeout?function(e){setTimeout(t(e),0)}:null}()},61:function(e,t,n){var r=n(698).default;function i(){"use strict";e.exports=i=function(){return n},e.exports.__esModule=!0,e.exports.default=e.exports;var t,n={},a=Object.prototype,o=a.hasOwnProperty,s=Object.defineProperty||function(e,t,n){e[t]=n.value},u="function"==typeof Symbol?Symbol:{},l=u.iterator||"@@iterator",d=u.asyncIterator||"@@asyncIterator",c=u.toStringTag||"@@toStringTag";function f(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{f({},"")}catch(t){f=function(e,t,n){return e[t]=n}}function v(e,t,n,r){var i=t&&t.prototype instanceof b?t:b,a=Object.create(i.prototype),o=new D(r||[]);return s(a,"_invoke",{value:x(e,n,o)}),a}function p(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}n.wrap=v;var h="suspendedStart",m="suspendedYield",g="executing",y="completed",_={};function b(){}function S(){}function E(){}var T={};f(T,l,(function(){return this}));var k=Object.getPrototypeOf,w=k&&k(k(N([])));w&&w!==a&&o.call(w,l)&&(T=w);var A=E.prototype=b.prototype=Object.create(T);function I(e){["next","throw","return"].forEach((function(t){f(e,t,(function(e){return this._invoke(t,e)}))}))}function R(e,t){function n(i,a,s,u){var l=p(e[i],e,a);if("throw"!==l.type){var d=l.arg,c=d.value;return c&&"object"==r(c)&&o.call(c,"__await")?t.resolve(c.__await).then((function(e){n("next",e,s,u)}),(function(e){n("throw",e,s,u)})):t.resolve(c).then((function(e){d.value=e,s(d)}),(function(e){return n("throw",e,s,u)}))}u(l.arg)}var i;s(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,i){n(e,r,t,i)}))}return i=i?i.then(a,a):a()}})}function x(e,n,r){var i=h;return function(a,o){if(i===g)throw new Error("Generator is already running");if(i===y){if("throw"===a)throw o;return{value:t,done:!0}}for(r.method=a,r.arg=o;;){var s=r.delegate;if(s){var u=M(s,r);if(u){if(u===_)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===h)throw i=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=g;var l=p(e,n,r);if("normal"===l.type){if(i=r.done?y:m,l.arg===_)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(i=y,r.method="throw",r.arg=l.arg)}}}function M(e,n){var r=n.method,i=e.iterator[r];if(i===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,M(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),_;var a=p(i,e.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,_;var o=a.arg;return o?o.done?(n[e.resultName]=o.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,_):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,_)}function C(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function D(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(C,this),this.reset(!0)}function N(e){if(e||""===e){var n=e[l];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,a=function n(){for(;++i<e.length;)if(o.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=t,n.done=!0,n};return a.next=a}}throw new TypeError(r(e)+" is not iterable")}return S.prototype=E,s(A,"constructor",{value:E,configurable:!0}),s(E,"constructor",{value:S,configurable:!0}),S.displayName=f(E,c,"GeneratorFunction"),n.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===S||"GeneratorFunction"===(t.displayName||t.name))},n.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,E):(e.__proto__=E,f(e,c,"GeneratorFunction")),e.prototype=Object.create(A),e},n.awrap=function(e){return{__await:e}},I(R.prototype),f(R.prototype,d,(function(){return this})),n.AsyncIterator=R,n.async=function(e,t,r,i,a){void 0===a&&(a=Promise);var o=new R(v(e,t,r,i),a);return n.isGeneratorFunction(t)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},I(A),f(A,c,"Generator"),f(A,l,(function(){return this})),f(A,"toString",(function(){return"[object Generator]"})),n.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},n.values=N,D.prototype={constructor:D,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(P),!e)for(var n in this)"t"===n.charAt(0)&&o.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function r(r,i){return s.type="throw",s.arg=e,n.next=r,i&&(n.method="next",n.arg=t),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var u=o.call(a,"catchLoc"),l=o.call(a,"finallyLoc");if(u&&l){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&o.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,_):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),_},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),_}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:N(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),_}},n}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports},698:function(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},687:function(e,t,n){var r=n(61)();e.exports=r;try{regeneratorRuntime=r}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,n),a.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};var r={};return function(){"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(t){var n=function(t,n){if("object"!==e(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,n||"default");if("object"!==e(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(t)}(t,"string");return"symbol"===e(n)?n:String(n)}function i(e,n){for(var r=0;r<n.length;r++){var i=n[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,t(i.key),i)}}function a(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function o(e,t){return o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},o(e,t)}function s(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,o(e,t)}n.d(r,{default:function(){return iv}});var u={DEFAULT_UNMUTED_VOLUME:.1,DEFAULT_REQUEST_TIMEOUT:3e4,DEFAULT_TEXT_TRACK_MODE:"native",DEFAULT_ENABLE_FAST_SWITCHING:!0,DELTA_POSITION_AFTER_RELOAD:{bitrateSwitch:-.1,trackSwitch:{audio:-.7,video:-.1,other:0}},DEFAULT_CODEC_SWITCHING_BEHAVIOR:"continue",DEFAULT_AUTO_PLAY:!1,DEFAULT_WANTED_BUFFER_AHEAD:30,DEFAULT_MAX_BUFFER_AHEAD:1/0,DEFAULT_MAX_BUFFER_BEHIND:1/0,DEFAULT_MAX_VIDEO_BUFFER_SIZE:1/0,MAXIMUM_MAX_BUFFER_AHEAD:{text:18e3},MAXIMUM_MAX_BUFFER_BEHIND:{text:18e3},DEFAULT_BASE_BANDWIDTH:0,INACTIVITY_DELAY:6e4,DEFAULT_THROTTLE_VIDEO_BITRATE_WHEN_HIDDEN:!1,DEFAULT_VIDEO_RESOLUTION_LIMIT:"none",DEFAULT_LIVE_GAP:{DEFAULT:10,LOW_LATENCY:3.5},BUFFER_DISCONTINUITY_THRESHOLD:.2,FORCE_DISCONTINUITY_SEEK_DELAY:5e3,BITRATE_REBUFFERING_RATIO:1.5,BUFFER_GC_GAPS:{CALM:240,BEEFY:30},DEFAULT_MAX_MANIFEST_REQUEST_RETRY:4,DEFAULT_CDN_DOWNGRADE_TIME:60,DEFAULT_MAX_REQUESTS_RETRY_ON_ERROR:4,INITIAL_BACKOFF_DELAY_BASE:{REGULAR:200,LOW_LATENCY:50},MAX_BACKOFF_DELAY_BASE:{REGULAR:3e3,LOW_LATENCY:1e3},SAMPLING_INTERVAL_MEDIASOURCE:1e3,SAMPLING_INTERVAL_LOW_LATENCY:250,SAMPLING_INTERVAL_NO_MEDIASOURCE:500,ABR_ENTER_BUFFER_BASED_ALGO:10,ABR_EXIT_BUFFER_BASED_ALGO:5,ABR_MINIMUM_TOTAL_BYTES:15e4,ABR_MINIMUM_CHUNK_SIZE:16e3,ABR_STARVATION_FACTOR:{DEFAULT:.72,LOW_LATENCY:.72},ABR_REGULAR_FACTOR:{DEFAULT:.72,LOW_LATENCY:.72},ABR_STARVATION_GAP:{DEFAULT:5,LOW_LATENCY:5},OUT_OF_STARVATION_GAP:{DEFAULT:7,LOW_LATENCY:7},ABR_STARVATION_DURATION_DELTA:.1,ABR_FAST_EMA:2,ABR_SLOW_EMA:10,RESUME_GAP_AFTER_SEEKING:{DEFAULT:1.5,LOW_LATENCY:.5},RESUME_GAP_AFTER_NOT_ENOUGH_DATA:{DEFAULT:.5,LOW_LATENCY:.5},RESUME_GAP_AFTER_BUFFERING:{DEFAULT:5,LOW_LATENCY:.5},REBUFFERING_GAP:{DEFAULT:.5,LOW_LATENCY:.2},MINIMUM_BUFFER_AMOUNT_BEFORE_FREEZING:2,UNFREEZING_SEEK_DELAY:6e3,FREEZING_STALLED_DELAY:600,UNFREEZING_DELTA_POSITION:.001,MAX_TIME_MISSING_FROM_COMPLETE_SEGMENT:.15,MAX_MANIFEST_BUFFERED_START_END_DIFFERENCE:.4,MAX_MANIFEST_BUFFERED_DURATION_DIFFERENCE:.3,MINIMUM_SEGMENT_SIZE:.005,APPEND_WINDOW_SECURITIES:{START:.2,END:.1},MAXIMUM_HTML_TEXT_TRACK_UPDATE_INTERVAL:50,TEXT_TRACK_SIZE_CHECKS_INTERVAL:250,BUFFER_PADDING:{audio:1,video:3,other:1},SEGMENT_PRIORITIES_STEPS:[2,4,8,12,18,25],MAX_HIGH_PRIORITY_LEVEL:1,MIN_CANCELABLE_PRIORITY:3,EME_DEFAULT_VIDEO_CODECS:['video/mp4;codecs="avc1.4d401e"','video/mp4;codecs="avc1.42e01e"','video/webm;codecs="vp8"'],EME_DEFAULT_AUDIO_CODECS:['audio/mp4;codecs="mp4a.40.2"',"audio/webm;codecs=opus"],EME_DEFAULT_WIDEVINE_ROBUSTNESSES:["HW_SECURE_ALL","HW_SECURE_DECODE","HW_SECURE_CRYPTO","SW_SECURE_DECODE","SW_SECURE_CRYPTO"],EME_DEFAULT_PLAYREADY_RECOMMENDATION_ROBUSTNESSES:["3000","2000"],EME_KEY_SYSTEMS:{clearkey:["webkit-org.w3.clearkey","org.w3.clearkey"],widevine:["com.widevine.alpha"],playready:["com.microsoft.playready.recommendation","com.microsoft.playready","com.chromecast.playready","com.youtube.playready"],fairplay:["com.apple.fps.1_0"]},MAX_CONSECUTIVE_MANIFEST_PARSING_IN_UNSAFE_MODE:10,MIN_MANIFEST_PARSING_TIME_TO_ENTER_UNSAFE_MODE:200,MIN_DASH_S_ELEMENTS_TO_PARSE_UNSAFELY:300,OUT_OF_SYNC_MANIFEST_REFRESH_DELAY:3e3,FAILED_PARTIAL_UPDATE_MANIFEST_REFRESH_DELAY:3e3,DASH_FALLBACK_LIFETIME_WHEN_MINIMUM_UPDATE_PERIOD_EQUAL_0:3,EME_DEFAULT_MAX_SIMULTANEOUS_MEDIA_KEY_SESSIONS:15,EME_MAX_STORED_PERSISTENT_SESSION_INFORMATION:1e3,EME_WAITING_DELAY_LOADED_SESSION_EMPTY_KEYSTATUSES:100,FORCED_ENDED_THRESHOLD:8e-4,ADAP_REP_SWITCH_BUFFER_PADDINGS:{video:{before:5,after:5},audio:{before:2,after:2.5},text:{before:0,after:0}},SOURCE_BUFFER_FLUSHING_INTERVAL:500,CONTENT_REPLACEMENT_PADDING:1.2,CACHE_LOAD_DURATION_THRESHOLDS:{video:50,audio:10},STREAM_EVENT_EMITTER_POLL_INTERVAL:250,DEFAULT_MAXIMUM_TIME_ROUNDING_ERROR:.001,BUFFERED_HISTORY_RETENTION_TIME:6e4,BUFFERED_HISTORY_MAXIMUM_ENTRIES:200,MIN_BUFFER_AHEAD:5,UPTO_CURRENT_POSITION_CLEANUP:5,DEFAULT_VIDEO_REPRESENTATIONS_SWITCHING_MODE:"seamless",DEFAULT_AUDIO_REPRESENTATIONS_SWITCHING_MODE:"seamless",DEFAULT_VIDEO_TRACK_SWITCHING_MODE:"reload",DEFAULT_AUDIO_TRACK_SWITCHING_MODE:"seamless"};var l="function"==typeof Object.assign?Object.assign:function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=0;n<(arguments.length<=1?0:arguments.length-1);n++){var r=n+1<1||arguments.length<=n+1?void 0:arguments[n+1];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t};function d(e){return null!=e&&!Array.isArray(e)&&"object"==typeof e}function c(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];if(0===n.length)return e;var i=n.shift();if(d(e)&&d(i))for(var a in i)if(d(i[a])){var o=e[a];void 0===o&&(o={},e[a]=o),c(o,i[a])}else{var s;l(e,((s={})[a]=i[a],s))}return c.apply(void 0,[e].concat(n))}var f=function(){function e(){this._config=u}var t=e.prototype;return t.update=function(e){var t=c(this._config,e);this._config=t},t.getCurrent=function(){return this._config},e}(),v=new f;function p(e){return"string"==typeof e&&e.length>0}function h(e){return null==e}function m(){}function g(e,t,n){if("function"==typeof Array.prototype.findIndex)return e.findIndex(t,n);for(var r=e.length>>>0,i=0;i<r;i++)if(t.call(n,e[i],i,e))return i;return-1}function y(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return _(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var b=function(){function e(e,t){var n=this;this._value=e,this._listeners=[],this._isFinished=!1,this._onFinishCbs=[],void 0!==t&&(this._deregisterCancellation=t.register((function(){return n.finish()})))}var t=e.prototype;return t.getValue=function(){return this._value},t.setValue=function(e){if(!this._isFinished&&(this._value=e,0!==this._listeners.length))for(var t,n=y(this._listeners.slice());!(t=n()).done;){var r=t.value;try{r.hasBeenCleared||r.trigger(e,r.complete)}catch(e){}}},t.setValueIfChanged=function(e){e!==this._value&&this.setValue(e)},t.onUpdate=function(e,t){var n=this,r=function e(){if(void 0!==(null==t?void 0:t.clearSignal)&&t.clearSignal.deregister(e),!i.hasBeenCleared){i.hasBeenCleared=!0;var r=n._listeners.indexOf(i);r>=0&&n._listeners.splice(r,1)}},i={trigger:e,complete:r,hasBeenCleared:!1};this._listeners.push(i),!0===(null==t?void 0:t.emitCurrentValue)&&e(this._value,r),this._isFinished||i.hasBeenCleared?r():void 0!==(null==t?void 0:t.clearSignal)&&t.clearSignal.register(r)},t.waitUntilDefined=function(e,t){var n=this;this.onUpdate((function(t,r){void 0!==t&&(r(),e(n._value))}),{clearSignal:null==t?void 0:t.clearSignal,emitCurrentValue:!0})},t._onFinished=function(e,t){var n=this;if(t.isCancelled())return m;var r=function(){var e=g(n._onFinishCbs,(function(e){return e.trigger===i}));e>=0&&(n._onFinishCbs[e].hasBeenCleared=!0,n._onFinishCbs.splice(e,1))},i=function(){r(),e()},a=t.register(r);return this._onFinishCbs.push({trigger:i,hasBeenCleared:!1}),a},t.finish=function(){void 0!==this._deregisterCancellation&&this._deregisterCancellation(),this._isFinished=!0;for(var e,t=y(this._listeners.slice());!(e=t()).done;){var n=e.value;try{n.hasBeenCleared||(n.complete(),n.hasBeenCleared=!0)}catch(e){}}if(this._listeners.length=0,this._onFinishCbs.length>0){for(var r,i=y(this._onFinishCbs.slice());!(r=i()).done;){var a=r.value;try{a.hasBeenCleared||(a.trigger(),a.hasBeenCleared=!0)}catch(e){}}this._onFinishCbs.length=0}},e}();function S(e,t,n){var r=new b(t(e.getValue()),n);return e.onUpdate((function(e){r.setValue(t(e))}),{clearSignal:n}),e._onFinished((function(){r.finish()}),n),r}var E=b,T="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope,k="undefined"==typeof window&&!T,w=T?self:k?n.g:window,A=["","webkit","moz","ms"];function I(e,t){return t.filter((function(t){return function(e,t){var n=document.createElement(e.tagName),r="on"+t;return r in n||(n.setAttribute(r,"return;"),"function"==typeof n[r])}(e,t)}))[0]}function R(e,t){var n,r=function(e,t){return e.reduce((function(e,n){return e.concat((void 0===t?A:t).map((function(e){return e+n})))}),[])}(e,t);return function(e,t,i){if(!i.isCancelled()){if("undefined"!=typeof HTMLElement&&e instanceof HTMLElement){if(void 0===n&&(n=I(e,r)),!p(n))return void 0;e.addEventListener(n,t),i.register((function(){void 0!==n&&e.removeEventListener(n,t)}))}r.forEach((function(n){var r=!1;"function"==typeof e.addEventListener?e.addEventListener(n,t):(r=!0,e["on"+n]=t),i.register((function(){"function"==typeof e.removeEventListener&&e.removeEventListener(n,t),r&&delete e["on"+n]}))}))}}}R(["loadedmetadata"]),R(["timeupdate"]),R(["addtrack"]),R(["removetrack"]);var x=R(["sourceopen","webkitsourceopen"]),M=R(["sourceclose","webkitsourceclose"]),C=R(["sourceended","webkitsourceended"]),P=R(["update"]),D=R(["removesourcebuffer"]),N=R(["keymessage","message"]),O=R(["keyadded","ready"]),L=R(["keyerror","error"]),U=R(["keystatuseschange"]),B=R(["seeking"]),F=R(["seeked"]),z=R(["ended"]);function V(e,t,n,r){e.addEventListener(t,n),r.register((function(){e.removeEventListener(t,n)}))}function K(e){var t=e;if("function"==typeof t.getStartDate){var n=t.getStartDate();if("object"==typeof n&&null!==n){var r=+n;if(!isNaN(r))return r/1e3}else if("number"==typeof n&&!isNaN(n))return n}}var G,W,j=!1,H=!1,q=!1,Y=!1,Q=!1,$=!1,X=!1,Z=!1,J=!1,ee=!1,te=!1;k||(void 0!==w.MSInputMethodContext&&void 0!==document.documentMode?(H=!0,q=!0):"Microsoft Internet Explorer"===navigator.appName||"Netscape"===navigator.appName&&/(Trident|Edge)\//.test(navigator.userAgent)?q=!0:-1!==navigator.userAgent.toLowerCase().indexOf("edg/")?j=!0:-1!==navigator.userAgent.toLowerCase().indexOf("firefox")?Y=!0:"string"==typeof navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)?$=!0:(Object.prototype.toString.call(w.HTMLElement).indexOf("Constructor")>=0||"[object SafariRemoteNotification]"===(null===(W=null===(G=w.safari)||void 0===G?void 0:G.pushNotification)||void 0===W?void 0:W.toString()))&&(Q=!0),/SamsungBrowser/.test(navigator.userAgent)&&(X=!0),-1!==navigator.userAgent.indexOf("PlayStation 5")?te=!0:/Tizen/.test(navigator.userAgent)?Z=!0:/[Ww]eb[O0]S/.test(navigator.userAgent)?(J=!0,/[Ww]eb[O0]S.TV-2022/.test(navigator.userAgent)||/[Cc]hr[o0]me\/87/.test(navigator.userAgent)||(/[Ww]eb[O0]S.TV-2021/.test(navigator.userAgent)||/[Cc]hr[o0]me\/79/.test(navigator.userAgent))):/[Pp]anasonic/.test(navigator.userAgent)&&(ee=!0));var ne=new(function(){function e(){this.error=m,this.warn=m,this.info=m,this.debug=m,this._levels={NONE:0,ERROR:1,WARNING:2,INFO:3,DEBUG:4},this._currentLevel="NONE"}var t=e.prototype;return t.setLevel=function(e){var t,n=this._levels[e];"number"==typeof n?(t=n,this._currentLevel=e):(t=0,this._currentLevel="NONE"),this.error=t>=this._levels.ERROR?console.error.bind(console):m,this.warn=t>=this._levels.WARNING?console.warn.bind(console):m,this.info=t>=this._levels.INFO?console.info.bind(console):m,this.debug=t>=this._levels.DEBUG?console.log.bind(console):m},t.getLevel=function(){return this._currentLevel},t.hasLevel=function(e){return this._levels[e]>=this._levels[this._currentLevel]},e}());function re(){if(!Y)return!0;var e=function(){if(!Y)return ne.warn("Compat: Can't access Firefox version on no firefox browser."),null;var e=navigator.userAgent,t=/Firefox\/([0-9]+)\./.exec(e);if(null===t)return-1;var n=parseInt(t[1],10);return isNaN(n)?-1:n}();if(null===e||e<67)return!0;var t=null===HTMLVideoElement||void 0===HTMLVideoElement?void 0:HTMLVideoElement.prototype;return void 0!==(null==t?void 0:t.requirePictureInPicture)}function ie(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ae(e){return ae=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ae(e)}function oe(e,t,n){return oe=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}()?Reflect.construct.bind():function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&o(i,n.prototype),i},oe.apply(null,arguments)}function se(e){var t="function"==typeof Map?new Map:void 0;return se=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return oe(e,arguments,ae(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),o(r,e)},se(e)}var ue={NETWORK_ERROR:"NETWORK_ERROR",MEDIA_ERROR:"MEDIA_ERROR",ENCRYPTED_MEDIA_ERROR:"ENCRYPTED_MEDIA_ERROR",OTHER_ERROR:"OTHER_ERROR"},le={TIMEOUT:"TIMEOUT",ERROR_EVENT:"ERROR_EVENT",ERROR_HTTP_CODE:"ERROR_HTTP_CODE",PARSE_ERROR:"PARSE_ERROR"},de={PIPELINE_LOAD_ERROR:"PIPELINE_LOAD_ERROR",PIPELINE_PARSE_ERROR:"PIPELINE_PARSE_ERROR",INTEGRITY_ERROR:"INTEGRITY_ERROR",MANIFEST_PARSE_ERROR:"MANIFEST_PARSE_ERROR",MANIFEST_INCOMPATIBLE_CODECS_ERROR:"MANIFEST_INCOMPATIBLE_CODECS_ERROR",MANIFEST_UPDATE_ERROR:"MANIFEST_UPDATE_ERROR",MANIFEST_UNSUPPORTED_ADAPTATION_TYPE:"MANIFEST_UNSUPPORTED_ADAPTATION_TYPE",MEDIA_STARTING_TIME_NOT_FOUND:"MEDIA_STARTING_TIME_NOT_FOUND",MEDIA_TIME_BEFORE_MANIFEST:"MEDIA_TIME_BEFORE_MANIFEST",MEDIA_TIME_AFTER_MANIFEST:"MEDIA_TIME_AFTER_MANIFEST",MEDIA_TIME_NOT_FOUND:"MEDIA_TIME_NOT_FOUND",NO_PLAYABLE_REPRESENTATION:"NO_PLAYABLE_REPRESENTATION",MEDIA_IS_ENCRYPTED_ERROR:"MEDIA_IS_ENCRYPTED_ERROR",CREATE_MEDIA_KEYS_ERROR:"CREATE_MEDIA_KEYS_ERROR",KEY_ERROR:"KEY_ERROR",KEY_STATUS_CHANGE_ERROR:"KEY_STATUS_CHANGE_ERROR",KEY_UPDATE_ERROR:"KEY_UPDATE_ERROR",KEY_LOAD_ERROR:"KEY_LOAD_ERROR",KEY_LOAD_TIMEOUT:"KEY_LOAD_TIMEOUT",KEY_GENERATE_REQUEST_ERROR:"KEY_GENERATE_REQUEST_ERROR",INCOMPATIBLE_KEYSYSTEMS:"INCOMPATIBLE_KEYSYSTEMS",INVALID_ENCRYPTED_EVENT:"INVALID_ENCRYPTED_EVENT",INVALID_KEY_SYSTEM:"INVALID_KEY_SYSTEM",LICENSE_SERVER_CERTIFICATE_ERROR:"LICENSE_SERVER_CERTIFICATE_ERROR",MULTIPLE_SESSIONS_SAME_INIT_DATA:"MULTIPLE_SESSIONS_SAME_INIT_DATA",BUFFER_APPEND_ERROR:"BUFFER_APPEND_ERROR",BUFFER_FULL_ERROR:"BUFFER_FULL_ERROR",BUFFER_TYPE_UNKNOWN:"BUFFER_TYPE_UNKNOWN",MEDIA_ERR_BLOCKED_AUTOPLAY:"MEDIA_ERR_BLOCKED_AUTOPLAY",MEDIA_ERR_PLAY_NOT_ALLOWED:"MEDIA_ERR_PLAY_NOT_ALLOWED",MEDIA_ERR_NOT_LOADED_METADATA:"MEDIA_ERR_NOT_LOADED_METADATA",MEDIA_ERR_ABORTED:"MEDIA_ERR_ABORTED",MEDIA_ERR_NETWORK:"MEDIA_ERR_NETWORK",MEDIA_ERR_DECODE:"MEDIA_ERR_DECODE",MEDIA_ERR_SRC_NOT_SUPPORTED:"MEDIA_ERR_SRC_NOT_SUPPORTED",MEDIA_ERR_UNKNOWN:"MEDIA_ERR_UNKNOWN",MEDIA_SOURCE_NOT_SUPPORTED:"MEDIA_SOURCE_NOT_SUPPORTED",MEDIA_KEYS_NOT_SUPPORTED:"MEDIA_KEYS_NOT_SUPPORTED",DISCONTINUITY_ENCOUNTERED:"DISCONTINUITY_ENCOUNTERED",NONE:"NONE"};function ce(e,t){return e+": "+t}var fe=function(e){function t(n,r,i){var a;return a=e.call(this)||this,Object.setPrototypeOf(ie(a),t.prototype),a.name="EncryptedMediaError",a.type=ue.ENCRYPTED_MEDIA_ERROR,a.code=n,a.message=ce(a.code,r),a.fatal=!1,"string"==typeof(null==i?void 0:i.keyStatuses)&&(a.keyStatuses=i.keyStatuses),a}return s(t,e),t}(se(Error)),ve=function(e){function t(n,r,i){var a;a=e.call(this)||this,Object.setPrototypeOf(ie(a),t.prototype),a.name="MediaError",a.type=ue.MEDIA_ERROR,a.code=n,a.message=ce(a.code,r),a.fatal=!1;var o=null==i?void 0:i.adaptations;return void 0!==o&&o.length>0&&(a.tracksInfo=o.reduce((function(e,t){switch(t.type){case"audio":e.push({type:"audio",track:t.toAudioTrack(!1)});break;case"video":e.push({type:"video",track:t.toVideoTrack(!1)});break;case"text":e.push({type:"text",track:t.toTextTrack()})}return e}),[])),a}return s(t,e),t}(se(Error)),pe=function(e){function t(n,r){var i;return i=e.call(this)||this,Object.setPrototypeOf(ie(i),t.prototype),i.name="NetworkError",i.type=ue.NETWORK_ERROR,i.url=r.url,i.status=r.status,i.errorType=r.type,i.code=n,i.message=ce(i.code,r.message),i.fatal=!1,i}return s(t,e),t.prototype.isHttpError=function(e){return this.errorType===le.ERROR_HTTP_CODE&&this.status===e},t}(se(Error)),he=function(e){function t(n,r){var i;return i=e.call(this)||this,Object.setPrototypeOf(ie(i),t.prototype),i.name="OtherError",i.type=ue.OTHER_ERROR,i.code=n,i.message=ce(i.code,r),i.fatal=!1,i}return s(t,e),t}(se(Error));function me(e){return(e instanceof fe||e instanceof ve||e instanceof he||e instanceof pe)&&Object.keys(ue).indexOf(e.type)>=0}function ge(e,t){var n=t.defaultCode,r=t.defaultReason;if(me(e))return e;var i=e instanceof Error?e.toString():r;return new he(n,i)}var ye={dashParsers:{wasm:null,js:null},createDebugElement:null,directfile:null,decrypt:null,htmlTextTracksBuffer:null,htmlTextTracksParsers:{},mediaSourceInit:null,nativeTextTracksBuffer:null,nativeTextTracksParsers:{},transports:{}};var _e=ye;function be(e,t,n){if("function"==typeof Array.prototype.find)return e.find(t,n);for(var r=e.length>>>0,i=0;i<r;i++){var a=e[i];if(t.call(n,a,i,e))return a}}function Se(e,t,n){if("function"==typeof Array.prototype.includes)return e.includes(t,n);var r=e.length>>>0;if(0===r)return!1;for(var i,a,o=0|n,s=o>=0?Math.min(o,r-1):Math.max(r+o,0);s<r;){if((i=e[s])===(a=t)||"number"==typeof i&&"number"==typeof a&&isNaN(i)&&isNaN(a))return!0;s++}return!1}function Ee(e,t){0}var Te=function(e){function t(n){var r;return r=e.call(this)||this,Object.setPrototypeOf(ie(r),t.prototype),r.name="AssertionError",r.message=n,r}return s(t,e),t}(se(Error));function ke(e){throw new Te("Unreachable path taken")}var we=function(){function e(){this._listeners={}}var t=e.prototype;return t.addEventListener=function(e,t,n){var r=this,i=this._listeners[e];Array.isArray(i)?i.push(t):this._listeners[e]=[t],void 0!==n&&n.register((function(){r.removeEventListener(e,t)}))},t.removeEventListener=function(e,t){if(h(e))this._listeners={};else{var n=this._listeners[e];if(Array.isArray(n))if(h(t))delete this._listeners[e];else{var r=n.indexOf(t);-1!==r&&n.splice(r,1),0===n.length&&delete this._listeners[e]}}},t.trigger=function(e,t){var n=this._listeners[e];Array.isArray(n)&&n.slice().forEach((function(e){try{e(t)}catch(e){ne.error("EventEmitter: listener error",e instanceof Error?e:null)}}))},e}();function Ae(){var e="",t=-1;return function(){return++t>=Number.MAX_SAFE_INTEGER&&(e+="0",t=0),e+String(t)}}var Ie=1/60;function Re(e,t){return Math.abs(e-t)<Ie}function xe(e,t){return{start:Math.min(e.start,t.start),end:Math.max(e.end,t.end)}}function Me(e,t){return e.end<=t.start}function Ce(e,t){for(var n=0;n<e.length;n++)if(Pe(e[n],t))return!0;return!1}function Pe(e,t){var n=e.start,r=e.end;return n<=t&&t<r}function De(e,t){return Pe(e,t.start)||e.start<t.end&&t.end<e.end||Pe(t,e.start)}function Ne(e,t){return Re(t.start,e.end)||Re(t.end,e.start)}function Oe(e){for(var t=[],n=0;n<e.length;n++)t.push({start:e.start(n),end:e.end(n)});return t}function Le(e,t){for(var n=e.length-1;n>=0;n--){var r=e.start(n);if(t>=r){var i=e.end(n);if(t<i)return{start:r,end:i}}}return null}function Ue(e,t){for(var n=null,r=[],i=0;i<e.length;i++){var a=e.start(i),o=e.end(i);t<a||t>=o?r.push({start:a,end:o}):n={start:a,end:o}}return{outerRanges:r,innerRange:n}}function Be(e,t){var n=Le(e,t);return null!==n?n.end-t:1/0}function Fe(e,t){if(t.start===t.end)return e;for(var n=t,r=0;r<e.length;r++){var i=e[r],a=De(n,i),o=Ne(n,i);if(a||o)n=xe(n,i),e.splice(r--,1);else if(0===r){if(Me(n,e[0]))break}else if(Me(e[r-1],n)&&Me(n,i))break}return e.splice(r,0,n),function(e){for(var t=1;t<e.length;t++){var n=e[t-1],r=e[t];if(Ne(n,r)){var i=xe(n,r);e.splice(--t,2,i)}}return e}(function(e){for(var t=0;t<e.length;t++){var n=e[t];n.start===n.end&&e.splice(t--,1)}return e}(e))}function ze(e,t){for(var n=[],r=0;r<t.length;r++)De(e,t[r])&&n.push(t[r]);return n}function Ve(e,t){for(var n=[],r=0;r<e.length;r++){var i=e[r],a=ze(i,t);if(a.length>0)for(var o=0;o<a.length;o++){var s=a[o];n.push({start:Math.max(i.start,s.start),end:Math.min(i.end,s.end)})}}return n}function Ke(e,t){for(var n=[],r=0;r<e.length;r++){var i=e[r],a=[],o=ze(i,t);if(o.length>0)for(var s=0;s<o.length;s++){var u=o[s];a.push({start:Math.max(i.start,u.start),end:Math.min(i.end,u.end)})}if(0===a.length)n.push(i);else{for(var l=i.start,d=0;d<a.length;d++)a[d].start>l&&n.push({start:l,end:a[d].start}),l=a[d].end;l<i.end&&n.push({start:l,end:i.end})}}return n}var Ge=function(){function e(){var e,t=(e=m,[function(t){e(t)},function(t){e=t}]),n=t[0],r=t[1];this._isUsed=!1,this._trigger=n,this.signal=new We(r)}var t=e.prototype;return t.isUsed=function(){return this._isUsed},t.linkToSignal=function(e){var t=this,n=e.register((function(){t.cancel()}));return this.signal.register(n),n},t.cancel=function(e){if(!this._isUsed){this._isUsed=!0;var t=null!=e?e:new je;this._trigger(t)}},e.isCancellationError=function(e){return e instanceof je},e}(),We=function(){function e(e){var t=this;this._isCancelled=!1,this.cancellationError=null,this._listeners=[],e((function(e){for(t.cancellationError=e,t._isCancelled=!0;t._listeners.length>0;)try{var n=t._listeners.pop();null==n||n(e)}catch(e){ne.error("Error while calling clean up listener",e instanceof Error?e.toString():"Unknown error")}}))}var t=e.prototype;return t.isCancelled=function(){return this._isCancelled},t.register=function(e){var t=this;return this._isCancelled?(Ee(this.cancellationError),e(this.cancellationError),m):(this._listeners.push(e),function(){return t.deregister(e)})},t.deregister=function(e){for(var t=this._listeners.length-1;t>=0;t--)this._listeners[t]===e&&this._listeners.splice(t,1)},e}(),je=function(e){function t(){var n;return n=e.call(this)||this,Object.setPrototypeOf(ie(n),t.prototype),n.name="CancellationError",n.message="This task was cancelled.",n}return s(t,e),t}(se(Error));function He(e,t,n,r,i,a,o){try{var s=e[a](o),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function qe(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){He(a,r,i,o,s,"next",e)}function s(e){He(a,r,i,o,s,"throw",e)}o(void 0)}))}}var Ye=n(687),Qe=n.n(Ye);function $e(e){return new Promise((function(t){setTimeout(t,e)}))}var Xe=new WeakMap,Ze={setState:function(e,t){Xe.set(e,t)},getState:function(e){var t=Xe.get(e);return void 0===t?null:t},clearState:function(e){Xe.set(e,null)}};function Je(e){return et.apply(this,arguments)}function et(){return(et=qe(Qe().mark((function e(t){var n,r;return Qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!==(n=Ze.getState(t))){e.next=3;break}return e.abrupt("return",void 0);case 3:return ne.info("DRM: Disposing of the current MediaKeys"),r=n.loadedSessionsStore,Ze.clearState(t),e.next=8,r.closeAllSessions();case 8:return e.abrupt("return",Promise.race([n.emeImplementation.setMediaKeys(t,null).catch((function(e){ne.error("DRM: Could not reset MediaKeys",e instanceof Error?e:"Unknown Error")})),$e(1e3)]));case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function tt(e){var t=Ze.getState(e);return null===t?null:[t.mediaKeySystemAccess.keySystem,t.mediaKeySystemAccess.getConfiguration()]}function nt(e){if(ne.info("DRM: Clearing-up DRM session."),H)return ne.info("DRM: disposing current MediaKeys."),Je(e);var t=Ze.getState(e);return null!==t&&!0===t.keySystemOptions.closeSessionsOnStop?(ne.info("DRM: closing all current sessions."),t.loadedSessionsStore.closeAllSessions()):(ne.info("DRM: Nothing to clear. Returning right away. No state =",null===t),Promise.resolve())}function rt(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return it(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return it(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function it(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function at(){return performance.now()}var ot=["canplay","ended","play","pause","seeking","seeked","loadedmetadata","ratechange"],st=function(){function e(e,t){this._internalSeeksIncoming=[],this._mediaElement=e,this._withMediaSource=t.withMediaSource,this._lowLatencyMode=t.lowLatencyMode,this._canceller=new Ge,this._observationRef=this._createSharedReference()}var t=e.prototype;return t.stop=function(){this._canceller.cancel()},t.getCurrentTime=function(){return this._mediaElement.currentTime},t.getPlaybackRate=function(){return this._mediaElement.playbackRate},t.getIsPaused=function(){return this._mediaElement.paused},t.setCurrentTime=function(e){this._internalSeeksIncoming.push(e),ne.info("API: Seeking internally",e),this._mediaElement.currentTime=e},t.setPlaybackRate=function(e){this._mediaElement.playbackRate=e},t.getReadyState=function(){return this._mediaElement.readyState},t.getReference=function(){return this._observationRef},t.listen=function(e,t){var n;if(this._canceller.isUsed()||!0===(null===(n=null==t?void 0:t.clearSignal)||void 0===n?void 0:n.isCancelled()))return m;this._observationRef.onUpdate(e,{clearSignal:null==t?void 0:t.clearSignal,emitCurrentValue:null==t?void 0:t.includeLastObservation})},t.deriveReadOnlyObserver=function(e){return dt(this,e,this._canceller.signal)},t._createSharedReference=function(){var e,t=this;if(void 0!==this._observationRef)return this._observationRef;var n=v.getCurrent(),r=n.SAMPLING_INTERVAL_MEDIASOURCE,i=n.SAMPLING_INTERVAL_LOW_LATENCY,a=n.SAMPLING_INTERVAL_NO_MEDIASOURCE,o=function(n){var r,i=n;"seeking"===i&&t._internalSeeksIncoming.length>0&&(i="internal-seeking",r=t._internalSeeksIncoming.shift());var a=null!=e?e:t._generateInitialObservation(),o=lt(t._mediaElement,i,t._withMediaSource),s=null;o.seeking&&("number"==typeof r?s=r:null!==a.pendingInternalSeek&&"seeking"!==n&&(s=a.pendingInternalSeek));var u=function(e,t,n){var r,i,a=n.withMediaSource,o=n.lowLatencyMode,s=v.getCurrent().REBUFFERING_GAP,u=t.event,l=t.position,d=t.bufferGap,c=t.currentRange,f=t.duration,p=t.paused,h=t.readyState,m=t.ended,g=e.rebuffering,y=e.event,_=e.position,b=function(e,t,n,r,i){var a=v.getCurrent().REBUFFERING_GAP,o=i?"LOW_LATENCY":"DEFAULT";if(void 0===t)return n&&Math.abs(r-e)<=a[o];return null!==t&&r-t.end<=a[o]}(l,c,m,f,o),S=h>=1&&"loadedmetadata"!==u&&null===g&&!(b||m),E=null,T=o?s.LOW_LATENCY:s.DEFAULT;if(a){if(S)d===1/0?(r=!0,E=l):void 0===d?h<3&&(r=!0,E=void 0):d<=T&&(r=!0,E=l+d);else if(null!==g){var k=ut(g,o);!0!==r&&null!==g&&h>1&&(b||m||void 0!==d&&isFinite(d)&&d>k)||void 0===d&&h>=3?i=!0:void 0===d?E=void 0:d===1/0?E=l:d<=k&&(E=l+d)}}else S&&(!p&&"timeupdate"===u&&"timeupdate"===y&&l===_||"seeking"===u&&(d===1/0||void 0===d&&h<3))?r=!0:null!==g&&("seeking"!==u&&l!==_||"canplay"===u||void 0===d&&h>=3||void 0!==d&&d<1/0&&(d>ut(g,o)||b||m))&&(i=!0);if(!0===i)return null;var w;if(!0===r||null!==g)return w="seeking"===u||null!==g&&"seeking"===g.reason||t.seeking?"seeking":1===h?"not-ready":"buffering",null!==g&&g.reason===w?{reason:g.reason,timestamp:g.timestamp,position:E}:{reason:w,timestamp:at(),position:E};return null}(a,o,{lowLatencyMode:t._lowLatencyMode,withMediaSource:t._withMediaSource}),d=function(e,t){var n=v.getCurrent().MINIMUM_BUFFER_AMOUNT_BEFORE_FREEZING;if(e.freezing)return t.ended||t.paused||0===t.readyState||0===t.playbackRate||e.position!==t.position?null:e.freezing;return"timeupdate"===t.event&&void 0!==t.bufferGap&&t.bufferGap>n&&!t.ended&&!t.paused&&t.readyState>=1&&0!==t.playbackRate&&t.position===e.position?{timestamp:at()}:null}(a,o),c=l({},{rebuffering:u,freezing:d,pendingInternalSeek:s},o);return ne.hasLevel("DEBUG")&&ne.debug("API: current media element state tick","event",c.event,"position",c.position,"seeking",c.seeking,"internalSeek",c.pendingInternalSeek,"rebuffering",null!==c.rebuffering,"freezing",null!==c.freezing,"ended",c.ended,"paused",c.paused,"playbackRate",c.playbackRate,"readyState",c.readyState),c},s=new E(o("init"),this._canceller.signal),u=function(t){var n=o(t);ne.hasLevel("DEBUG")&&ne.debug("API: current playback timeline:\n"+function(e,t){for(var n="",r="",i=0;i<e.length;i++){var a=e.start(i),o=e.end(i),s=a.toFixed(2),u=o.toFixed(2),l=s+"|=="+(o-a).toFixed(2)+"==|"+u;if(n+=l,0===r.length&&o>t){var d=n.length-Math.floor(l.length/2);r=" ".repeat(d)+"^"+t}if(i<e.length-1){var c=e.start(i+1),f=" ~"+(c-o).toFixed(2)+"~ ";if(n+=f,0===r.length&&t<c){var v=n.length-Math.floor(f.length/2);r=" ".repeat(v)+"^"+t}}}0===r.length&&(r=" ".repeat(n.length)+"^"+t);return n+"\n"+r}(n.buffered,n.position),"\n"+t),e=n,s.setValue(n)},d=this._lowLatencyMode?i:this._withMediaSource?r:a,c=setInterval(p,d),f=ot.map((function(e){function n(){clearInterval(c),c=setInterval(p,d),u(e)}return t._mediaElement.addEventListener(e,n),function(){t._mediaElement.removeEventListener(e,n)}}));return this._canceller.signal.register((function(){clearInterval(c),f.forEach((function(e){return e()})),s.finish()})),s;function p(){u("timeupdate")}},t._generateInitialObservation=function(){return l(lt(this._mediaElement,"init",this._withMediaSource),{rebuffering:null,freezing:null,pendingInternalSeek:null})},e}();function ut(e,t){if(null===e)return 0;var n=t?"LOW_LATENCY":"DEFAULT",r=v.getCurrent(),i=r.RESUME_GAP_AFTER_SEEKING,a=r.RESUME_GAP_AFTER_NOT_ENOUGH_DATA,o=r.RESUME_GAP_AFTER_BUFFERING;switch(e.reason){case"seeking":return i[n];case"not-ready":return a[n];case"buffering":return o[n]}}function lt(e,t,n){var r,i,a=e.buffered,o=e.currentTime,s=e.duration,u=e.ended,l=e.paused,d=e.playbackRate,c=e.readyState,f=e.seeking;return!n&&0===a.length&&c>=3?(r=void 0,i=void 0):i=null!==(r=Le(a,o))?r.end-o:1/0,{bufferGap:i,buffered:a,currentRange:r,position:o,duration:s,ended:u,paused:l,playbackRate:d,readyState:c,seeking:f,event:t}}function dt(e,t,n){var r=t(e.getReference(),n);return{getCurrentTime:function(){return e.getCurrentTime()},getReadyState:function(){return e.getReadyState()},getPlaybackRate:function(){return e.getPlaybackRate()},getIsPaused:function(){return e.getIsPaused()},getReference:function(){return r},listen:function(e,t){var i;n.isCancelled()||!0===(null===(i=null==t?void 0:t.clearSignal)||void 0===i?void 0:i.isCancelled())||r.onUpdate(e,{clearSignal:null==t?void 0:t.clearSignal,emitCurrentValue:null==t?void 0:t.includeLastObservation})},deriveReadOnlyObserver:function(e){return dt(this,e,n)}}}var ct=function(e){function t(t,n){var r;return(r=e.call(this)||this)._canceller=new Ge,r._manifest=t,r._adaptationRef=n,r._updateToken=!1,r}s(t,e);var n=t.prototype;return n.start=function(e){if(this._updateToken=!0,null===e)return this._lastEmitted=null,this._updateToken=!1,void this._adaptationRef.setValue(null);var t=this._constructLockedRepresentationsReference(e);this._updateToken&&(this._lastEmitted={adaptation:e.adaptation,switchingMode:e.switchingMode,lockedRepresentations:null},this._updateToken=!1,this._adaptationRef.setValue({adaptation:e.adaptation,switchingMode:e.switchingMode,representations:t}))},n.updateTrack=function(e){if(this._updateToken=!0,null===e){if(null===this._lastEmitted)return;return this._updateToken=!1,this._canceller.cancel(),this._canceller=new Ge,this._lastEmitted=null,void this._adaptationRef.setValue(null)}var t=e.adaptation,n=e.switchingMode;this._canceller.cancel(),this._canceller=new Ge;var r=this._constructLockedRepresentationsReference(e);this._updateToken&&(this._lastEmitted={adaptation:t,switchingMode:n,lockedRepresentations:null},this._updateToken=!1,this._adaptationRef.setValue({adaptation:t,switchingMode:n,representations:r}))},n._constructLockedRepresentationsReference=function(e){var t=this._manifest,n=new E({representations:[],switchingMode:"lazy"}),r=this;return t.addEventListener("decipherabilityUpdate",i),t.addEventListener("manifestUpdate",i),this._canceller.signal.register((function(){t.removeEventListener("decipherabilityUpdate",i),t.removeEventListener("manifestUpdate",i)})),e.lockedRepresentations.onUpdate(i,{clearSignal:this._canceller.signal,emitCurrentValue:!1}),i(),n;function i(){var t,i,a=e.lockedRepresentations.getValue();if(null===a)i=e.adaptation.getPlayableRepresentations(),t="lazy";else{var o=a.representations;if(t=a.switchingMode,0===(i=o.filter((function(e){return e.isPlayable()}))).length)return void r.trigger("noPlayableLockedRepresentation",null)}if(i.length<=0)return e.adaptation.isSupported=!1,void r.trigger("noPlayableRepresentation",null);var s=n.getValue(),u=i.slice().sort((function(e,t){return e.bitrate-t.bitrate}));if(u.length===s.representations.length){for(var l=0;l<u.length;l++)if(s.representations[l].id!==u[l].id)return void n.setValue({representations:u,switchingMode:t})}else n.setValue({representations:u,switchingMode:t})}},n.dispose=function(){this.removeEventListener(),this._canceller.cancel(),this._adaptationRef.finish()},t}(we),ft=function(e){function t(t){var n,r;return(n=e.call(this)||this)._storedPeriodInfo=[],n._isDisposed=!1,n._cachedPeriodInfo=new WeakMap,n._isTrickModeTrackEnabled=t.preferTrickModeTracks,n._defaultAudioTrackSwitchingMode=null!==(r=t.defaultAudioTrackSwitchingMode)&&void 0!==r?r:v.getCurrent().DEFAULT_AUDIO_TRACK_SWITCHING_MODE,n}s(t,e);var n=t.prototype;return n.getAvailablePeriods=function(){return this._storedPeriodInfo.reduce((function(e,t){return t.isPeriodAdvertised&&e.push(gt(t.period)),e}),[])},n.updatePeriodList=function(e){for(var t,n,r,i,a=this,o=v.getCurrent().DEFAULT_VIDEO_TRACK_SWITCHING_MODE,s=e.periods,u=[],l=0,d=function(e){var i=a._storedPeriodInfo[e].period,d=s[l];if(void 0===d)for(var f=a._storedPeriodInfo.length-1;f>=e;f--)a._storedPeriodInfo[f].inManifest=!1,pt(a._storedPeriodInfo[f])&&a._removePeriodObject(f);else if(i===d){l++;var v=a._storedPeriodInfo[e].text.storedSettings;if(null!==v)if(!d.getSupportedAdaptations("text").some((function(e){return e.id===v.adaptation.id}))){ne.warn("TS: Chosen text Adaptation not available anymore");var p=a._storedPeriodInfo[e];if(p.text.storedSettings=null,a.trigger("trackUpdate",{period:gt(d),trackType:"text",reason:"missing"}),a._isDisposed)return{v:void 0};var h=vt(a._storedPeriodInfo,p.period.id);void 0!==h&&null===h.text.storedSettings&&(null===(t=h.text.dispatcher)||void 0===t||t.updateTrack(null))}var m=a._storedPeriodInfo[e].video.storedSettings;if(null!==m){var g=d.getSupportedAdaptations("video");if(!g.some((function(e){return e.id===m.adaptation.id}))){ne.warn("TS: Chosen video Adaptation not available anymore");var y,_=a._storedPeriodInfo[e];if(0===g.length)y=null;else{var b=g[0],S=ht(b,a._isTrickModeTrackEnabled),T=new E(null);y={adaptationBase:b,adaptation:S,switchingMode:o,lockedRepresentations:T}}if(_.video.storedSettings=y,a.trigger("trackUpdate",{period:gt(d),trackType:"video",reason:"missing"}),a._isDisposed)return{v:void 0};var k=vt(a._storedPeriodInfo,_.period.id);void 0!==k&&k.video.storedSettings===y&&(null===(n=k.video.dispatcher)||void 0===n||n.updateTrack(y))}}var w=a._storedPeriodInfo[e].audio.storedSettings;if(null!==w){var A=d.getSupportedAdaptations("audio");if(!A.some((function(e){return e.id===w.adaptation.id}))){ne.warn("TS: Chosen audio Adaptation not available anymore");var I=a._storedPeriodInfo[e],R=0===A.length?null:{adaptation:A[0],switchingMode:a._defaultAudioTrackSwitchingMode,lockedRepresentations:new E(null)};if(I.audio.storedSettings=R,a.trigger("trackUpdate",{period:gt(d),trackType:"audio",reason:"missing"}),a._isDisposed)return{v:void 0};var x=vt(a._storedPeriodInfo,I.period.id);void 0!==x&&x.audio.storedSettings===R&&(null===(r=x.audio.dispatcher)||void 0===r||r.updateTrack(R))}}}else if(i.start<=d.start)a._storedPeriodInfo[e].inManifest=!1,pt(a._storedPeriodInfo[e])&&(a._removePeriodObject(e),e--);else{var M=mt(d,!0,a._isTrickModeTrackEnabled,a._defaultAudioTrackSwitchingMode);a._storedPeriodInfo.splice(e,0,M),u.push(M),l++}c=e},c=0;c<this._storedPeriodInfo.length;c++)if(i=d(c))return i.v;if(l<s.length){var f,p=s.slice(l).map((function(e){return mt(e,!0,a._isTrickModeTrackEnabled,a._defaultAudioTrackSwitchingMode)}));(f=this._storedPeriodInfo).push.apply(f,p),u.push.apply(u,p)}},n.addTrackReference=function(e,t,n,r){var i=this,a=vt(this._storedPeriodInfo,n.id);if(void 0===a){a=mt(n,!1,this._isTrickModeTrackEnabled,this._defaultAudioTrackSwitchingMode);for(var o=!1,s=0;s<this._storedPeriodInfo.length;s++)this._storedPeriodInfo[s].period.start>n.start&&(this._storedPeriodInfo.splice(s,0,a),o=!0);o||this._storedPeriodInfo.push(a)}if(a.isPeriodAdvertised||(a.isPeriodAdvertised=!0,this.trigger("newAvailablePeriods",[{id:n.id,start:n.start,end:n.end}]),!this._isDisposed))if(null===a[e].dispatcher){var u=a[e].storedSettings,l=new ct(t,r);a[e].dispatcher=l,l.addEventListener("noPlayableRepresentation",(function(){var t,r,a,o=be(n.getAdaptationsForType(e),(function(e){return e.getPlayableRepresentations().length>0}));if(void 0===o){var s=new ve("NO_PLAYABLE_REPRESENTATION","No "+e+" Representation can be played",{adaptations:void 0});return i.trigger("error",s),void i.dispose()}var u=null===(t=vt(i._storedPeriodInfo,n.id))||void 0===t?void 0:t[e];if(!h(u)){var l={adaptation:o,switchingMode:"audio"===e?i._defaultAudioTrackSwitchingMode:"reload",lockedRepresentations:new E(null)};u.storedSettings=l,i.trigger("trackUpdate",{period:gt(n),trackType:e,reason:"no-playable-representation"}),i._isDisposed||h(u=null===(r=vt(i._storedPeriodInfo,n.id))||void 0===r?void 0:r[e])||u.storedSettings!==l||null===(a=u.dispatcher)||void 0===a||a.updateTrack(l)}})),l.addEventListener("noPlayableLockedRepresentation",(function(){null==u||u.lockedRepresentations.setValue(null),i.trigger("brokenRepresentationsLock",{period:{id:n.id,start:n.start,end:n.end},trackType:e})})),l.start(u)}else ne.error("TS: Subject already added for "+e+" and Period "+n.start)},n.removeTrackReference=function(e,t){var n=function(e,t){for(var n=0;n<e.length;n++){if(e[n].period.id===t.id)return n}}(this._storedPeriodInfo,t);if(void 0!==n){var r=this._storedPeriodInfo[n],i=r[e];null!==(null==i?void 0:i.dispatcher)?(i.dispatcher.dispose(),i.dispatcher=null,pt(r)&&this._removePeriodObject(n)):ne.warn("TS: TrackDispatcher already removed for "+e+" and Period "+t.start)}else ne.warn("TS: "+e+" not found for period",t.start)},n.getPeriodObjectFromPeriod=function(e){var t=vt(this._storedPeriodInfo,e.id);return void 0===t&&void 0!==e?this._cachedPeriodInfo.get(e):t},n.getPeriodObjectFromId=function(e){return vt(this._storedPeriodInfo,e)},n.disableVideoTrickModeTracks=function(){this._isTrickModeTrackEnabled&&(this._isTrickModeTrackEnabled=!1,this._resetVideoTrackChoices("trickmode-disabled"))},n.enableVideoTrickModeTracks=function(){this._isTrickModeTrackEnabled||(this._isTrickModeTrackEnabled=!0,this._resetVideoTrackChoices("trickmode-enabled"))},n.resetPeriodObjects=function(){for(var e,t,n,r=this._storedPeriodInfo.length-1;r>=0;r--){var i=this._storedPeriodInfo[r];null===(e=i.audio.dispatcher)||void 0===e||e.dispose(),i.audio.dispatcher=null,null===(t=i.video.dispatcher)||void 0===t||t.dispose(),i.video.dispatcher=null,null===(n=i.text.dispatcher)||void 0===n||n.dispose(),i.text.dispatcher=null,i.inManifest||this._removePeriodObject(r)}},n.isTrickModeEnabled=function(){return this._isTrickModeTrackEnabled},n.setAudioTrack=function(e,t,n,r){return this._setAudioOrTextTrack("audio",e,t,null!=n?n:this._defaultAudioTrackSwitchingMode,r)},n.setTextTrack=function(e,t){return this._setAudioOrTextTrack("text",e,t,"direct",null)},n._setAudioOrTextTrack=function(e,t,n,r,i){var a,o=t.period,s=be(o.getSupportedAdaptations(e),(function(e){return e.id===n}));if(void 0===s)throw new Error("Wanted "+e+" track not found.");var u,l=t[e];if(null===i)u=new E(null);else{var d=this._getRepresentationsToLock(s,i),c="audio"===e?this._defaultAudioTrackSwitchingMode:"direct";u=new E({representations:d,switchingMode:c})}var f={adaptation:s,switchingMode:r,lockedRepresentations:u};if(l.storedSettings=f,this.trigger("trackUpdate",{period:gt(o),trackType:e,reason:"manual"}),!this._isDisposed){var v=vt(this._storedPeriodInfo,o.id);void 0!==v&&v[e].storedSettings===f&&(null===(a=v[e].dispatcher)||void 0===a||a.updateTrack(f))}},n.setVideoTrack=function(e,t,n,r){var i,a=e.period,o=be(a.getSupportedAdaptations("video"),(function(e){return e.id===t}));if(void 0===o)throw new Error("Wanted video track not found.");var s,u=v.getCurrent().DEFAULT_VIDEO_TRACK_SWITCHING_MODE,l=e.video,d=ht(o,this._isTrickModeTrackEnabled);if(null===r)s=new E(null);else{var c=this._getRepresentationsToLock(o,r);s=new E({representations:c,switchingMode:u})}var f={adaptationBase:o,switchingMode:null!=n?n:u,adaptation:d,lockedRepresentations:s};if(l.storedSettings=f,this.trigger("trackUpdate",{period:gt(a),trackType:"video",reason:"manual"}),!this._isDisposed){var p=vt(this._storedPeriodInfo,a.id);void 0!==p&&p.video.storedSettings===f&&(null===(i=p.video.dispatcher)||void 0===i||i.updateTrack(f))}},n.disableTrack=function(e,t){var n,r,i=e[t];if(null!==i.storedSettings&&("text"!==t&&(null===(n=e[t].storedSettings)||void 0===n||n.lockedRepresentations.finish()),i.storedSettings=null,this.trigger("trackUpdate",{period:gt(e.period),trackType:t,reason:"manual"}),!this._isDisposed)){var a=vt(this._storedPeriodInfo,e.period.id);void 0!==a&&null===a[t].storedSettings&&(null===(r=a[t].dispatcher)||void 0===r||r.updateTrack(null))}},n.getChosenAudioTrack=function(e){return null===e.audio.storedSettings?null:e.audio.storedSettings.adaptation.toAudioTrack(!0)},n.getChosenTextTrack=function(e){return null===e.text.storedSettings?null:e.text.storedSettings.adaptation.toTextTrack()},n.getChosenVideoTrack=function(e){return null===e.video.storedSettings?null:e.video.storedSettings.adaptation.toVideoTrack(!0)},n.getAvailableAudioTracks=function(e){var t=e.audio.storedSettings,n=null!==t?t.adaptation.id:null;return e.period.getSupportedAdaptations("audio").map((function(e){var t=null!==n&&n===e.id;return l(e.toAudioTrack(!0),{active:t})}))},n.getAvailableTextTracks=function(e){var t=e.text.storedSettings,n=null!==t?t.adaptation.id:null;return e.period.getSupportedAdaptations("text").map((function(e){var t=null!==n&&n===e.id;return l(e.toTextTrack(),{active:t})}))},n.getAvailableVideoTracks=function(e){var t=e.video.storedSettings,n=null===t?void 0:t.adaptation.id;return e.period.getSupportedAdaptations("video").map((function(e){var t=null!==n&&n===e.id,r=e.toVideoTrack(!0),i=void 0!==r.trickModeTracks?r.trickModeTracks.map((function(e){var t=null!==n&&n===e.id;return l(e,{active:t})})):[],a=l(r,{active:t});return void 0!==i&&(a.trickModeTracks=i),a}))},n.getLockedAudioRepresentations=function(e){var t=e.audio.storedSettings;if(null===t)return null;var n=t.lockedRepresentations.getValue();return null===n?null:n.representations.map((function(e){return e.id}))},n.getLockedVideoRepresentations=function(e){var t=e.video.storedSettings;if(null===t)return null;var n=t.lockedRepresentations.getValue();return null===n?null:n.representations.map((function(e){return e.id}))},n.lockAudioRepresentations=function(e,t){var n,r=e.audio.storedSettings;if(null!==r){var i=v.getCurrent().DEFAULT_AUDIO_REPRESENTATIONS_SWITCHING_MODE,a=this._getRepresentationsToLock(r.adaptation,t.representations),o=null!==(n=t.switchingMode)&&void 0!==n?n:i;r.lockedRepresentations.setValue({representations:a,switchingMode:o})}},n.lockVideoRepresentations=function(e,t){var n,r=e.video.storedSettings;if(null!==r){var i=v.getCurrent().DEFAULT_VIDEO_REPRESENTATIONS_SWITCHING_MODE,a=this._getRepresentationsToLock(r.adaptation,t.representations),o=null!==(n=t.switchingMode)&&void 0!==n?n:i;r.lockedRepresentations.setValue({representations:a,switchingMode:o})}},n.unlockAudioRepresentations=function(e){var t=e.audio.storedSettings;null!==t&&null!==t.lockedRepresentations.getValue()&&t.lockedRepresentations.setValue(null)},n.unlockVideoRepresentations=function(e){var t=e.video.storedSettings;null!==t&&null!==t.lockedRepresentations.getValue()&&t.lockedRepresentations.setValue(null)},n.dispose=function(){for(this._isDisposed=!0;;){var e=this._storedPeriodInfo.pop();if(void 0===e)return;e.isRemoved=!0}},n._resetVideoTrackChoices=function(e){for(var t,n=0;n<this._storedPeriodInfo.length;n++){var r=this._storedPeriodInfo[n];if(null!==r.video.storedSettings){var i=r.video.storedSettings.adaptationBase;if(null!==i){var a=ht(i,this._isTrickModeTrackEnabled);r.video.storedSettings.adaptationBase=i,r.video.storedSettings.adaptation=a}}}for(var o=this._storedPeriodInfo.slice(),s=0;s<o.length;s++){var u=o[s].period,l=o[s].video.storedSettings;if(this.trigger("trackUpdate",{period:gt(u),trackType:"video",reason:e}),this._isDisposed)return;var d=vt(this._storedPeriodInfo,u.id);void 0!==d&&d.video.storedSettings===l&&(null===(t=d.video.dispatcher)||void 0===t||t.updateTrack(l))}},n._removePeriodObject=function(e){var t=this._storedPeriodInfo[e];this._storedPeriodInfo[e].isRemoved=!0,this._storedPeriodInfo.splice(e,1),this._cachedPeriodInfo.set(t.period,t)},n._getRepresentationsToLock=function(e,t){var n=t.reduce((function(t,n){var r=be(e.representations,(function(e){return e.id===n}));return void 0===r?ne.warn("API: Wanted locked Representation not found."):t.push(r),t}),[]);if(0===n.length)throw new Error("Cannot lock Representations: None of the given Representation id are found");return n},t}(we);function vt(e,t){for(var n=0;n<e.length;n++){var r=e[n];if(r.period.id===t)return r}}function pt(e){var t,n,r;return!e.inManifest&&null===(null===(t=e.text)||void 0===t?void 0:t.dispatcher)&&null===(null===(n=e.audio)||void 0===n?void 0:n.dispatcher)&&null===(null===(r=e.video)||void 0===r?void 0:r.dispatcher)}function ht(e,t){var n;return t&&void 0!==(null===(n=e.trickModeTracks)||void 0===n?void 0:n[0])?e.trickModeTracks[0]:e}function mt(e,t,n,r){var i,a=e.getSupportedAdaptations("audio")[0],o=e.getSupportedAdaptations("video")[0],s=ht(o,n),u=v.getCurrent().DEFAULT_VIDEO_TRACK_SWITCHING_MODE,l=void 0!==a?{adaptation:a,switchingMode:r,lockedRepresentations:new E(null)}:null,d=void 0!==s?{adaptation:s,adaptationBase:o,switchingMode:u,lockedRepresentations:new E(null)}:null,c=null,f=e.getAdaptationsForType("text").filter((function(e){return!0===e.isForcedSubtitles}));if(f.length>0){if(null!=a){var p=be(f,(function(e){return e.normalizedLanguage===a.normalizedLanguage}));void 0!==p&&(c=p)}null===c&&(c=null!==(i=be(f,(function(e){return void 0===e.normalizedLanguage})))&&void 0!==i?i:null)}var h=null;return null!==c&&(h={adaptation:c,switchingMode:"direct",lockedRepresentations:new E(null)}),{period:e,inManifest:t,isPeriodAdvertised:!1,isRemoved:!1,audio:{storedSettings:l,dispatcher:null},video:{storedSettings:d,dispatcher:null},text:{storedSettings:h,dispatcher:null}}}function gt(e){return{start:e.start,end:e.end,id:e.id}}function yt(e,t){var n=v.getCurrent().FORCED_ENDED_THRESHOLD;if(e.ended)return"ENDED";if(null!==t){var r=Math.abs(e.duration-e.currentTime);return null!=n&&r<n?"ENDED":"seeking"===t?"SEEKING":"freezing"===t?"FREEZING":"BUFFERING"}return e.paused?"PAUSED":"PLAYING"}function _t(e){return"LOADING"!==e&&"RELOADING"!==e&&"STOPPED"!==e}function bt(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return St(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return St(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function St(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Et=Ae(),Tt=function(e,t){var n=e;if(!0===n.webkitSupportsPresentationMode&&"function"==typeof n.webkitSetPresentationMode){var r="picture-in-picture"===n.webkitPresentationMode,i=new E({isEnabled:r,pipWindow:null},t);return V(n,"webkitpresentationmodechanged",(function(){var e="picture-in-picture"===n.webkitPresentationMode;i.setValue({isEnabled:e,pipWindow:null})}),t),i}var a=document.pictureInPictureElement===n,o=new E({isEnabled:a,pipWindow:null},t);return V(n,"enterpictureinpicture",(function(e){var t;o.setValue({isEnabled:!0,pipWindow:null!==(t=e.pictureInPictureWindow)&&void 0!==t?t:null})}),t),V(n,"leavepictureinpicture",(function(){o.setValue({isEnabled:!1,pipWindow:null})}),t),o},kt=function(e,t){var n,r=function(e){var t,n=document;h(n.hidden)?h(n.mozHidden)?h(n.msHidden)?h(n.webkitHidden)||(t="webkit"):t="ms":t="moz":t="";var r=p(t)?t+"Hidden":"hidden",i=p(t)?t+"visibilitychange":"visibilitychange",a=document[r],o=new E(!a,e);return V(document,i,(function(){var e=!document[r];o.setValueIfChanged(e)}),e),o}(t),i=new E(!0,t);return t.register((function(){clearTimeout(n),n=void 0})),r.onUpdate(a,{clearSignal:t}),e.onUpdate(a,{clearSignal:t}),a(),i;function a(){if(clearTimeout(n),n=void 0,e.getValue().isEnabled||r.getValue())i.setValueIfChanged(!0);else{var t=v.getCurrent().INACTIVITY_DELAY;n=setTimeout((function(){i.setValueIfChanged(!1)}),t)}}},wt=function(e,t,n){var r=null==w.devicePixelRatio||0===w.devicePixelRatio?1:w.devicePixelRatio,i=new E({width:e.clientWidth,height:e.clientHeight,pixelRatio:r},n),a=m;t.onUpdate(s,{clearSignal:n}),V(w,"resize",s,n),V(e,"enterpictureinpicture",s,n),V(e,"leavepictureinpicture",s,n);var o=setInterval(s,2e4);return s(),n.register((function(){a(),clearInterval(o)})),i;function s(){a();var n=t.getValue(),o=n.pipWindow;if(n.isEnabled)if(h(o)){var s=i.getValue();void 0===s.width&&void 0===s.height&&s.pixelRatio===r||i.setValue({width:void 0,height:void 0,pixelRatio:r})}else{var u=function(){d()};o.addEventListener("resize",u),a=function(){o.removeEventListener("resize",u),a=m},d()}else{var l=i.getValue();l.width===e.clientWidth&&l.height===e.clientHeight&&l.pixelRatio===r||i.setValue({width:e.clientWidth,height:e.clientHeight,pixelRatio:r})}function d(){var e=i.getValue();e.width===(null==o?void 0:o.width)&&e.height===(null==o?void 0:o.height)&&e.pixelRatio===r||i.setValue({width:null==o?void 0:o.width,height:null==o?void 0:o.height,pixelRatio:r})}}},At=function(e){var t,n,r=null==w.devicePixelRatio||0===w.devicePixelRatio?1:w.devicePixelRatio,i=new E({width:null===(t=w.screen)||void 0===t?void 0:t.width,height:null===(n=w.screen)||void 0===n?void 0:n.height,pixelRatio:r},e),a=setInterval((function(){var e=i.getValue();e.width===screen.width&&e.height===screen.height&&e.pixelRatio===r||i.setValue({width:screen.width,height:screen.height,pixelRatio:r})}),2e4);return e.register((function(){clearInterval(a)})),i},It=function(e){function t(t){var n;void 0===t&&(t={}),n=e.call(this)||this;var r=function(e){var t,n,r,i,a,o,s=v.getCurrent(),u=s.DEFAULT_BASE_BANDWIDTH,l=s.DEFAULT_VIDEO_RESOLUTION_LIMIT,d=s.DEFAULT_MAX_BUFFER_AHEAD,c=s.DEFAULT_MAX_BUFFER_BEHIND,f=s.DEFAULT_MAX_VIDEO_BUFFER_SIZE,p=s.DEFAULT_THROTTLE_VIDEO_BITRATE_WHEN_HIDDEN,m=s.DEFAULT_WANTED_BUFFER_AHEAD;if(h(e.maxBufferAhead))t=d;else if(t=Number(e.maxBufferAhead),isNaN(t))throw new Error("Invalid maxBufferAhead parameter. Should be a number.");if(h(e.maxBufferBehind))n=c;else if(n=Number(e.maxBufferBehind),isNaN(n))throw new Error("Invalid maxBufferBehind parameter. Should be a number.");if(h(e.wantedBufferAhead))r=m;else if(r=Number(e.wantedBufferAhead),isNaN(r))throw new Error("Invalid wantedBufferAhead parameter. Should be a number.");if(h(e.maxVideoBufferSize))i=f;else if(i=Number(e.maxVideoBufferSize),isNaN(i))throw new Error("Invalid maxVideoBufferSize parameter. Should be a number.");var g=h(e.videoResolutionLimit)?l:e.videoResolutionLimit,y=h(e.throttleVideoBitrateWhenHidden)?p:!!e.throttleVideoBitrateWhenHidden;if(h(e.videoElement))a=document.createElement("video");else{if(!(e.videoElement instanceof HTMLMediaElement))throw new Error("Invalid videoElement parameter. Should be a HTMLMediaElement.");a=e.videoElement}if(h(e.baseBandwidth))o=u;else if(o=Number(e.baseBandwidth),isNaN(o))throw new Error("Invalid baseBandwidth parameter. Should be a number.");return{maxBufferAhead:t,maxBufferBehind:n,videoResolutionLimit:g,videoElement:a,wantedBufferAhead:r,maxVideoBufferSize:i,throttleVideoBitrateWhenHidden:y,baseBandwidth:o}}(t),i=r.baseBandwidth,a=r.videoResolutionLimit,o=r.maxBufferAhead,s=r.maxBufferBehind,u=r.throttleVideoBitrateWhenHidden,l=r.videoElement,d=r.wantedBufferAhead,c=r.maxVideoBufferSize,f=v.getCurrent().DEFAULT_UNMUTED_VOLUME;l.preload="auto",n.version="4.0.0-beta.3",n.log=ne,n.state="STOPPED",n.videoElement=l;var p=new Ge;return n._destroyCanceller=p,n._priv_pictureInPictureRef=Tt(l,p.signal),n._priv_speed=new E(l.playbackRate,n._destroyCanceller.signal),n._priv_preferTrickModeTracks=!1,n._priv_contentLock=new E(!1,n._destroyCanceller.signal),n._priv_bufferOptions={wantedBufferAhead:new E(d,n._destroyCanceller.signal),maxBufferAhead:new E(o,n._destroyCanceller.signal),maxBufferBehind:new E(s,n._destroyCanceller.signal),maxVideoBufferSize:new E(c,n._destroyCanceller.signal)},n._priv_bitrateInfos={lastBitrates:{audio:i,video:i}},n._priv_throttleVideoBitrateWhenHidden=u,n._priv_videoResolutionLimit=a,n._priv_mutedMemory=f,n._priv_currentError=null,n._priv_contentInfos=null,n._priv_contentEventsMemory={},n._priv_setPlayerState("STOPPED"),n._priv_reloadingMetadata={},n._priv_lastAutoPlay=!1,n}s(t,e),t.addFeatures=function(e){!function(e){for(var t=0;t<e.length;t++){var n=e[t];if("function"==typeof n)n(ye);else{if(h(n)||"function"!=typeof n._addFeature)throw new Error("Unrecognized feature");n._addFeature(ye)}}}(e)};var n=t.prototype;return n.addEventListener=function(t,n){return e.prototype.addEventListener.call(this,t,n)},n.stop=function(){null!==this._priv_contentInfos&&this._priv_contentInfos.currentContentCanceller.cancel(),this._priv_cleanUpCurrentContentState(),"STOPPED"!==this.state&&this._priv_setPlayerState("STOPPED")},n.dispose=function(){this.stop(),null!==this.videoElement&&Je(this.videoElement).catch((function(e){var t=e instanceof Error?e.message:"Unknown error";ne.error("API: Could not dispose decryption resources: "+t)})),this._destroyCanceller.cancel(),this._priv_reloadingMetadata={},this.videoElement=null},n.loadVideo=function(e){var t=function(e){var t,n,r,i,a,o,s,u,d,c=v.getCurrent(),f=c.DEFAULT_AUTO_PLAY,p=c.DEFAULT_CODEC_SWITCHING_BEHAVIOR,m=c.DEFAULT_ENABLE_FAST_SWITCHING,g=c.DEFAULT_TEXT_TRACK_MODE;if(h(e))throw new Error("No option set on loadVideo");if(h(e.url)){if(h(e.initialManifest)&&h(e.manifestLoader))throw new Error("Unable to load a content: no url set on loadVideo.\nPlease provide at least either an `url` argument, a `initialManifest` option or a `manifestLoader` option so the RxPlayer can load the content.")}else i=String(e.url);if(h(e.transport))throw new Error("No transport set on loadVideo");a=String(e.transport);var y=h(e.autoPlay)?f:!!e.autoPlay;if(h(e.keySystems))o=[];else for(var _,b=rt(o=Array.isArray(e.keySystems)?e.keySystems:[e.keySystems]);!(_=b()).done;){var S=_.value;if("string"!=typeof S.type||"function"!=typeof S.getLicense)throw new Error("Invalid key system given: Missing type string or getLicense callback")}var E=void 0!==e.lowLatencyMode&&!!e.lowLatencyMode,T=e.initialManifest,k=null!==(t=e.minimumManifestUpdateInterval)&&void 0!==t?t:0,w=null!==(n=e.defaultAudioTrackSwitchingMode)&&void 0!==n?n:void 0;void 0===w||Se(["seamless","direct","reload"],w)||(ne.warn("The `defaultAudioTrackSwitchingMode` loadVideo option must match one of the following strategy name:\n- `seamless`\n- `direct`\n- `reload`"),w=void 0);var A=h(e.onCodecSwitch)?p:e.onCodecSwitch;if(Se(["continue","reload"],A)||(ne.warn("The `onCodecSwitch` loadVideo option must match one of the following string:\n- `continue`\n- `reload`\nIf badly set, "+p+" will be used as default"),A=p),h(e.textTrackMode))s=g;else{if("native"!==e.textTrackMode&&"html"!==e.textTrackMode)throw new Error("Invalid textTrackMode.");s=e.textTrackMode}var I=h(e.enableFastSwitching)?m:e.enableFastSwitching;if("html"===s){if(h(e.textTrackElement))throw new Error('You have to provide a textTrackElement in "html" textTrackMode.');if(!(e.textTrackElement instanceof HTMLElement))throw new Error("textTrackElement should be an HTMLElement.");u=e.textTrackElement}else h(e.textTrackElement)||ne.warn('API: You have set a textTrackElement without being in an "html" textTrackMode. It will be ignored.');if(!h(e.startAt))if(e.startAt.wallClockTime instanceof Date){var R=e.startAt.wallClockTime.getTime()/1e3;d=l({},e.startAt,{wallClockTime:R})}else d=e.startAt;var x=null!==(r=e.requestConfig)&&void 0!==r?r:{};return{__priv_patchLastSegmentInSidx:e.__priv_patchLastSegmentInSidx,__priv_manifestUpdateUrl:e.__priv_manifestUpdateUrl,checkMediaSegmentIntegrity:e.checkMediaSegmentIntegrity,autoPlay:y,defaultAudioTrackSwitchingMode:w,enableFastSwitching:I,initialManifest:T,keySystems:o,lowLatencyMode:E,manifestLoader:e.manifestLoader,minimumManifestUpdateInterval:k,requestConfig:x,onCodecSwitch:A,referenceDateTime:e.referenceDateTime,representationFilter:e.representationFilter,segmentLoader:e.segmentLoader,serverSyncInfos:e.serverSyncInfos,startAt:d,textTrackElement:u,textTrackMode:s,transport:a,url:i}}(e);ne.info("API: Calling loadvideo",t.url,t.transport),this._priv_reloadingMetadata={options:t},this._priv_initializeContentPlayback(t),this._priv_lastAutoPlay=t.autoPlay},n.reload=function(e){var t,n,r,i,a=this._priv_reloadingMetadata,o=a.options,s=a.manifest,u=a.reloadPosition,l=a.reloadInPause;if(void 0===o)throw new Error("API: Can't reload without having previously loaded a content.");if(function(e){var t,n,r,i;if(null===e||"object"!=typeof e&&void 0!==e)throw new Error("API: reload - Invalid options format.");if(null===(null==e?void 0:e.reloadAt)||"object"!=typeof(null==e?void 0:e.reloadAt)&&void 0!==(null==e?void 0:e.reloadAt))throw new Error("API: reload - Invalid 'reloadAt' option format.");if("number"!=typeof(null===(t=null==e?void 0:e.reloadAt)||void 0===t?void 0:t.position)&&void 0!==(null===(n=null==e?void 0:e.reloadAt)||void 0===n?void 0:n.position))throw new Error("API: reload - Invalid 'reloadAt.position' option format.");if("number"!=typeof(null===(r=null==e?void 0:e.reloadAt)||void 0===r?void 0:r.relative)&&void 0!==(null===(i=null==e?void 0:e.reloadAt)||void 0===i?void 0:i.relative))throw new Error("API: reload - Invalid 'reloadAt.relative' option format.")}(e),void 0!==(null===(t=null==e?void 0:e.reloadAt)||void 0===t?void 0:t.position))r={position:e.reloadAt.position};else if(void 0!==(null===(n=null==e?void 0:e.reloadAt)||void 0===n?void 0:n.relative)){if(void 0===u)throw new Error("Can't reload to a relative position when previous content was not loaded.");r={position:e.reloadAt.relative+u}}else void 0!==u&&(r={position:u});void 0!==(null==e?void 0:e.autoPlay)?i=e.autoPlay:void 0!==l&&(i=!l);var d=Object.assign(Object.assign({},o),{initialManifest:s});void 0!==r&&(d.startAt=r),void 0!==i&&(d.autoPlay=i),this._priv_initializeContentPlayback(d)},n.createDebugElement=function(e){if(null===_e.createDebugElement)throw new Error("Feature `DEBUG_ELEMENT` not added to the RxPlayer");var t=new Ge;return _e.createDebugElement(e,this,t.signal),{dispose:function(){t.cancel()}}},n._priv_initializeContentPlayback=function(e){var t,n,r,i,a=this,o=e.autoPlay,s=e.defaultAudioTrackSwitchingMode,u=e.enableFastSwitching,d=e.initialManifest,c=e.keySystems,f=e.lowLatencyMode,v=e.minimumManifestUpdateInterval,p=e.requestConfig,m=e.onCodecSwitch,g=e.startAt,y=e.transport,_=e.checkMediaSegmentIntegrity,b=e.manifestLoader,T=e.referenceDateTime,k=e.representationFilter,w=e.segmentLoader,A=e.serverSyncInfos,I=e.__priv_manifestUpdateUrl,R=e.__priv_patchLastSegmentInSidx,x=e.url;if(null===this.videoElement)throw new Error("the attached video element is disposed");var M,C="directfile"===y,P=new Ge,D=this.videoElement,N=null;if(C){if(null===_e.directfile)throw this.stop(),this._priv_currentError=null,new Error("DirectFile feature not activated in your build.");if(h(x))throw new Error("No URL for a DirectFile content");if(N=this._priv_initializeMediaElementTracksStore(P.signal),P.isUsed())return;M=new _e.directfile.initDirectFile({autoPlay:o,keySystems:c,speed:this._priv_speed,startAt:g,url:x})}else{var O=_e.transports[y];if("function"!=typeof O)throw this.stop(),this._priv_currentError=null,new Error('transport "'+y+'" not supported');if(null===_e.mediaSourceInit)throw new Error("MediaSource streaming not supported");var L=O({lowLatencyMode:f,checkMediaSegmentIntegrity:_,manifestLoader:b,referenceDateTime:T,representationFilter:k,segmentLoader:w,serverSyncInfos:A,__priv_manifestUpdateUrl:I,__priv_patchLastSegmentInSidx:R}),U={lowLatencyMode:f,maxRetry:null===(t=p.manifest)||void 0===t?void 0:t.maxRetry,requestTimeout:null===(n=p.manifest)||void 0===n?void 0:n.timeout,minimumManifestUpdateInterval:v,initialManifest:d},B=re(),F={throttleBitrate:{},limitResolution:{}};this._priv_throttleVideoBitrateWhenHidden&&(B?F.throttleBitrate={video:S(kt(this._priv_pictureInPictureRef,P.signal),(function(e){return e?1/0:0}),P.signal)}:ne.warn("API: Can't apply throttleVideoBitrateWhenHidden because browser can't be trusted for visibility.")),"videoElement"===this._priv_videoResolutionLimit?B?F.limitResolution={video:wt(D,this._priv_pictureInPictureRef,P.signal)}:ne.warn("API: Can't apply videoResolutionLimit because browser can't be trusted for video size."):"screen"===this._priv_videoResolutionLimit&&(F.limitResolution={video:At(P.signal)});var z={initialBitrates:this._priv_bitrateInfos.lastBitrates,lowLatencyMode:f,throttlers:F},V="native"===e.textTrackMode?{textTrackMode:"native"}:{textTrackMode:"html",textTrackElement:e.textTrackElement},K=l({enableFastSwitching:u,onCodecSwitch:m},this._priv_bufferOptions),G={lowLatencyMode:f,maxRetry:null===(r=p.segment)||void 0===r?void 0:r.maxRetry,requestTimeout:null===(i=p.segment)||void 0===i?void 0:i.timeout};M=new _e.mediaSourceInit({adaptiveOptions:z,autoPlay:o,bufferOptions:K,keySystems:c,lowLatencyMode:f,manifestRequestSettings:U,transport:L,segmentRequestOptions:G,speed:this._priv_speed,startAt:g,textTrackOptions:V,url:x})}var W={contentId:Et(),originalUrl:x,currentContentCanceller:P,defaultAudioTrackSwitchingMode:s,initializer:M,isDirectFile:C,segmentBuffersStore:null,manifest:null,currentPeriod:null,activeAdaptations:null,activeRepresentations:null,tracksStore:null,mediaElementTracksStore:N};M.addEventListener("error",(function(e){a._priv_onFatalError(e,W)})),M.addEventListener("warning",(function(e){var t=ge(e,{defaultCode:"NONE",defaultReason:"An unknown error happened."});ne.warn("API: Sending warning:",t),a.trigger("warning",t)})),M.addEventListener("reloadingMediaSource",(function(e){W.segmentBuffersStore=null,null!==W.tracksStore&&W.tracksStore.resetPeriodObjects(),a._priv_lastAutoPlay=e.autoPlay})),M.addEventListener("inbandEvents",(function(e){return a.trigger("inbandEvents",e)})),M.addEventListener("streamEvent",(function(e){return a.trigger("streamEvent",e)})),M.addEventListener("streamEventSkip",(function(e){return a.trigger("streamEventSkip",e)})),M.addEventListener("activePeriodChanged",(function(e){return a._priv_onActivePeriodChanged(W,e)})),M.addEventListener("periodStreamReady",(function(e){return a._priv_onPeriodStreamReady(W,e)})),M.addEventListener("periodStreamCleared",(function(e){return a._priv_onPeriodStreamCleared(W,e)})),M.addEventListener("representationChange",(function(e){return a._priv_onRepresentationChange(W,e)})),M.addEventListener("adaptationChange",(function(e){return a._priv_onAdaptationChange(W,e)})),M.addEventListener("bitrateEstimateChange",(function(e){return a._priv_onBitrateEstimateChange(e)})),M.addEventListener("manifestReady",(function(e){return a._priv_onManifestReady(W,e)})),M.addEventListener("loaded",(function(e){W.segmentBuffersStore=e.segmentBuffersStore})),M.prepare(),this.stop();var j=new st(D,{withMediaSource:!C,lowLatencyMode:f});P.signal.register((function(){j.stop()}));var H=function(e,t,n,r){var i=new E("LOADING",r);e.addEventListener("loaded",(function(){if("LOADING"===i.getValue()){if(i.setValue("LOADED"),!r.isCancelled()){var e=yt(t,null);"PAUSED"!==e&&i.setValue(e)}}else"RELOADING"===i.getValue()?i.setValue(yt(t,null)):o(null)}),r),e.addEventListener("reloadingMediaSource",(function(){_t(i.getValue())&&i.setValueIfChanged("RELOADING")}),r);var a=null;return e.addEventListener("stalled",(function(e){e!==a&&(o(e),a=e)}),r),e.addEventListener("unstalled",(function(){null!==a&&(o(null),a=null)}),r),n.listen((function(e){Se(["seeking","ended","play","pause"],e.event)&&o(a)}),{clearSignal:r}),i;function o(e){if(_t(i.getValue())){var n=yt(t,e);"LOADED"===i.getValue()&&"PAUSED"===n||i.setValueIfChanged(n)}}}(M,D,j,P.signal);P.signal.register((function(){M.dispose()}));var q=function(e){switch(e){case"STOPPED":case"RELOADING":case"LOADING":break;case"ENDED":a._priv_reloadingMetadata.reloadInPause=!0,a._priv_reloadingMetadata.reloadPosition=j.getReference().getValue().position;break;default:var t=j.getReference().getValue();a._priv_reloadingMetadata.reloadInPause=t.paused,a._priv_reloadingMetadata.reloadPosition=t.position}},Y=null,Q=function(e){null!==Y&&(Y.cancel(),Y=null),H.onUpdate((function(t,n){var r,i,o,s;_t(t)&&(n(),null!==Y&&Y.cancel(),(Y=new Ge).linkToSignal(P.signal),e!==!D.paused&&(D.paused?a.trigger("pause",null):a.trigger("play",null)),r=D,i=function(){return a.trigger("play",null)},o=function(){return a.trigger("pause",null)},(s=P.signal).isCancelled()||null===r||(r.addEventListener("play",i),r.addEventListener("pause",o),s.register((function(){r.removeEventListener("play",i),r.removeEventListener("pause",o)}))))}),{emitCurrentValue:!1,clearSignal:P.signal})};Q(o),M.addEventListener("reloadingMediaSource",(function(e){Q(e.autoPlay)}));var $=null;H.onUpdate((function(e){q(e),a._priv_setPlayerState(e),P.isUsed()||(null!==$?_t(a.state)||($.cancel(),$=null):_t(a.state)&&(($=new Ge).linkToSignal(P.signal),function(e,t,n,r,i){if(!i.isCancelled()&&null!==e){var a=t.getReference().getValue().seeking;a&&(n(),i.isCancelled())||t.listen((function(e){"seeking"===e.event?(a=!0,n()):a&&"seeked"===e.event&&(a=!1,r())}),{includeLastObservation:!0,clearSignal:i})}}(D,j,(function(){return a.trigger("seeking",null)}),(function(){return a.trigger("seeked",null)}),$.signal)))}),{emitCurrentValue:!0,clearSignal:P.signal}),j.listen((function(e){q(a.state),a._priv_triggerPositionUpdate(W,e)}),{clearSignal:P.signal}),this._priv_currentError=null,this._priv_contentInfos=W,P.signal.register((function(){M.removeEventListener()})),this._priv_contentLock.onUpdate((function(e,t){e||(t(),M.start(D,j))}),{emitCurrentValue:!0,clearSignal:P.signal})},n.getError=function(){return this._priv_currentError},n.getVideoElement=function(){return this.videoElement},n.getPlayerState=function(){return this.state},n.isContentLoaded=function(){return!Se(["LOADING","RELOADING","STOPPED"],this.state)},n.isBuffering=function(){return Se(["BUFFERING","SEEKING","LOADING","RELOADING"],this.state)},n.isPaused=function(){return!this.videoElement||(Se(["LOADING","RELOADING"],this.state)?!this._priv_lastAutoPlay:this.videoElement.paused)},n.isLive=function(){if(null===this._priv_contentInfos)return!1;var e=this._priv_contentInfos,t=e.isDirectFile,n=e.manifest;return!t&&null!==n&&n.isLive},n.areTrickModeTracksEnabled=function(){return this._priv_preferTrickModeTracks},n.getContentUrls=function(){if(null!==this._priv_contentInfos){var e=this._priv_contentInfos,t=e.isDirectFile,n=e.manifest,r=e.originalUrl;return t?void 0===r?void 0:[r]:null!==n?n.getUrls():void 0}},n.updateContentUrls=function(e,t){if(null===this._priv_contentInfos)throw new Error("No content loaded");var n=!0===(null==t?void 0:t.refresh);this._priv_contentInfos.initializer.updateContentUrls(e,n)},n.getMediaDuration=function(){if(null===this.videoElement)throw new Error("Disposed player");return this.videoElement.duration},n.getCurrentBufferGap=function(){if(null===this.videoElement)throw new Error("Disposed player");var e=this.videoElement,t=Be(e.buffered,e.currentTime);return t===1/0?0:t},n.getWallClockTime=function(){if(null===this.videoElement)throw new Error("Disposed player");if(null===this._priv_contentInfos)return this.videoElement.currentTime;var e=this._priv_contentInfos,t=e.isDirectFile,n=e.manifest;if(t){var r=K(this.videoElement);return(null!=r?r:0)+this.videoElement.currentTime}return null!==n?this.videoElement.currentTime+(void 0!==n.availabilityStartTime?n.availabilityStartTime:0):0},n.getPosition=function(){if(null===this.videoElement)throw new Error("Disposed player");return this.videoElement.currentTime},n.getLastStoredContentPosition=function(){return this._priv_reloadingMetadata.reloadPosition},n.getPlaybackRate=function(){return this._priv_speed.getValue()},n.setPlaybackRate=function(e,t){var n;e!==this._priv_speed.getValue()&&this._priv_speed.setValue(e);var r=null==t?void 0:t.preferTrickModeTracks;if("boolean"==typeof r){this._priv_preferTrickModeTracks=r;var i=null===(n=this._priv_contentInfos)||void 0===n?void 0:n.tracksStore;h(i)||(r&&!i.isTrickModeEnabled()?i.enableVideoTrickModeTracks():!r&&i.isTrickModeEnabled()&&i.disableVideoTrickModeTracks())}},n.getVideoRepresentation=function(){var e=this.__priv_getCurrentRepresentations();if(null!==e)return e.video},n.getAudioRepresentation=function(){var e=this.__priv_getCurrentRepresentations();if(null!==e)return e.audio},n.play=function(){var e=this;if(null===this.videoElement)throw new Error("Disposed player");var t=this.videoElement.play();return h(t)||"function"!=typeof t.catch?Promise.resolve():t.catch((function(t){if("NotAllowedError"===t.name){var n=new ve("MEDIA_ERR_PLAY_NOT_ALLOWED",t.toString());e.trigger("warning",n)}throw t}))},n.pause=function(){if(null===this.videoElement)throw new Error("Disposed player");this.videoElement.pause()},n.seekTo=function(e){var t;if(null===this.videoElement)throw new Error("Disposed player");if(null===this._priv_contentInfos)throw new Error("player: no content loaded");var n,r=this._priv_contentInfos,i=r.isDirectFile,a=r.manifest;if(!i&&null===a)throw new Error("player: the content did not load yet");if("number"==typeof e)n=e;else if("object"==typeof e){var o=e,s=this.videoElement.currentTime;if(h(o.relative))if(h(o.position)){if(h(o.wallClockTime))throw new Error('invalid time object. You must set one of the following properties: "relative", "position" or "wallClockTime"');if(null!==a)n=o.wallClockTime-(null!==(t=a.availabilityStartTime)&&void 0!==t?t:0);else if(i&&null!==this.videoElement){var u=K(this.videoElement);void 0!==u&&(n=o.wallClockTime-u)}void 0===n&&(n=o.wallClockTime)}else n=o.position;else n=s+o.relative}if(void 0===n)throw new Error("invalid time given");return ne.info("API: API Seek to",n),this.videoElement.currentTime=n,n},n.getVolume=function(){if(null===this.videoElement)throw new Error("Disposed player");return this.videoElement.volume},n.setVolume=function(e){if(null===this.videoElement)throw new Error("Disposed player");var t=this.videoElement;e!==t.volume&&(t.volume=e,this.trigger("volumeChange",e))},n.isMute=function(){return 0===this.getVolume()},n.mute=function(){this._priv_mutedMemory=this.getVolume(),this.setVolume(0)},n.unMute=function(){var e=v.getCurrent().DEFAULT_UNMUTED_VOLUME;0===this.getVolume()&&this.setVolume(0===this._priv_mutedMemory?e:this._priv_mutedMemory)},n.setMaxBufferBehind=function(e){this._priv_bufferOptions.maxBufferBehind.setValue(e)},n.setMaxBufferAhead=function(e){this._priv_bufferOptions.maxBufferAhead.setValue(e)},n.setWantedBufferAhead=function(e){this._priv_bufferOptions.wantedBufferAhead.setValue(e)},n.setMaxVideoBufferSize=function(e){this._priv_bufferOptions.maxVideoBufferSize.setValue(e)},n.getMaxBufferBehind=function(){return this._priv_bufferOptions.maxBufferBehind.getValue()},n.getMaxBufferAhead=function(){return this._priv_bufferOptions.maxBufferAhead.getValue()},n.getWantedBufferAhead=function(){return this._priv_bufferOptions.wantedBufferAhead.getValue()},n.getMaxVideoBufferSize=function(){return this._priv_bufferOptions.maxVideoBufferSize.getValue()},n.getCurrentPeriod=function(){var e,t=null===(e=this._priv_contentInfos)||void 0===e?void 0:e.currentPeriod;return h(t)?null:{id:t.id,start:t.start,end:t.end}},n.getKeySystemConfiguration=function(){if(null===this.videoElement)throw new Error("Disposed player");var e=tt(this.videoElement);return null===e?null:{keySystem:e[0],configuration:e[1]}},n.getAvailablePeriods=function(){if(null===this._priv_contentInfos)return[];var e=this._priv_contentInfos,t=e.isDirectFile,n=e.tracksStore;return t||null===n?[]:n.getAvailablePeriods().slice()},n.getAvailableAudioTracks=function(e){var t;if(null===this._priv_contentInfos)return[];var n=this._priv_contentInfos,r=n.isDirectFile,i=n.mediaElementTracksStore;return r?null!==(t=null==i?void 0:i.getAvailableAudioTracks())&&void 0!==t?t:[]:this._priv_callTracksStoreGetterSetter(e,[],(function(e,t){var n;return null!==(n=e.getAvailableAudioTracks(t))&&void 0!==n?n:[]}))},n.getAvailableTextTracks=function(e){var t;if(null===this._priv_contentInfos)return[];var n=this._priv_contentInfos,r=n.isDirectFile,i=n.mediaElementTracksStore;return r?null!==(t=null==i?void 0:i.getAvailableTextTracks())&&void 0!==t?t:[]:this._priv_callTracksStoreGetterSetter(e,[],(function(e,t){var n;return null!==(n=e.getAvailableTextTracks(t))&&void 0!==n?n:[]}))},n.getAvailableVideoTracks=function(e){var t;if(null===this._priv_contentInfos)return[];var n=this._priv_contentInfos,r=n.isDirectFile,i=n.mediaElementTracksStore;return r?null!==(t=null==i?void 0:i.getAvailableVideoTracks())&&void 0!==t?t:[]:this._priv_callTracksStoreGetterSetter(e,[],(function(e,t){var n;return null!==(n=e.getAvailableVideoTracks(t))&&void 0!==n?n:[]}))},n.getAudioTrack=function(e){if(null!==this._priv_contentInfos){var t=this._priv_contentInfos,n=t.isDirectFile,r=t.mediaElementTracksStore;if(n){if(null===r)return;return r.getChosenAudioTrack()}return this._priv_callTracksStoreGetterSetter(e,void 0,(function(e,t){return e.getChosenAudioTrack(t)}))}},n.getTextTrack=function(e){if(null!==this._priv_contentInfos){var t=this._priv_contentInfos,n=t.isDirectFile,r=t.mediaElementTracksStore;if(n){if(null===r)return;return r.getChosenTextTrack()}return this._priv_callTracksStoreGetterSetter(e,void 0,(function(e,t){return e.getChosenTextTrack(t)}))}},n.getVideoTrack=function(e){if(null!==this._priv_contentInfos){var t=this._priv_contentInfos,n=t.isDirectFile,r=t.mediaElementTracksStore;if(n){if(null===r)return;return r.getChosenVideoTrack()}return this._priv_callTracksStoreGetterSetter(e,void 0,(function(e,t){return e.getChosenVideoTrack(t)}))}},n.setAudioTrack=function(e){var t;if(null===this._priv_contentInfos)throw new Error("No content loaded");var n,r,i,a=this._priv_contentInfos,o=a.isDirectFile,s=a.mediaElementTracksStore;if(o)try{var u="string"==typeof e?e:e.trackId;return void(null==s||s.setAudioTrackById(u))}catch(e){throw new Error("player: unknown audio track")}var l=null;return"string"==typeof e?r=e:(r=e.trackId,n=e.periodId,i=e.switchingMode,l=null!==(t=e.lockedRepresentations)&&void 0!==t?t:null),this._priv_callTracksStoreGetterSetter(n,void 0,(function(e,t){return e.setAudioTrack(t,r,i,l)}))},n.setTextTrack=function(e){if(null===this._priv_contentInfos)throw new Error("No content loaded");var t,n,r=this._priv_contentInfos,i=r.isDirectFile,a=r.mediaElementTracksStore;if(i)try{var o="string"==typeof e?e:e.trackId;return void(null==a||a.setTextTrackById(o))}catch(e){throw new Error("player: unknown text track")}return"string"==typeof e?n=e:(n=e.trackId,t=e.periodId),this._priv_callTracksStoreGetterSetter(t,void 0,(function(e,t){return e.setTextTrack(t,n)}))},n.disableTextTrack=function(e){if(null!==this._priv_contentInfos){var t=this._priv_contentInfos,n=t.isDirectFile,r=t.mediaElementTracksStore;if(!n)return this._priv_callTracksStoreGetterSetter(e,void 0,(function(e,t){return e.disableTrack(t,"text")}));null==r||r.disableTextTrack()}},n.setVideoTrack=function(e){var t;if(null===this._priv_contentInfos)throw new Error("No content loaded");var n,r,i,a=this._priv_contentInfos,o=a.isDirectFile,s=a.mediaElementTracksStore;if(o)try{var u="string"==typeof e?e:e.trackId;return void(null==s||s.setVideoTrackById(u))}catch(e){throw new Error("player: unknown video track")}var l=null;return"string"==typeof e?r=e:(r=e.trackId,n=e.periodId,i=e.switchingMode,l=null!==(t=e.lockedRepresentations)&&void 0!==t?t:null),this._priv_callTracksStoreGetterSetter(n,void 0,(function(e,t){return e.setVideoTrack(t,r,i,l)}))},n.disableVideoTrack=function(e){if(null!==this._priv_contentInfos){var t=this._priv_contentInfos,n=t.isDirectFile,r=t.mediaElementTracksStore;return n&&null!==r?r.disableVideoTrack():this._priv_callTracksStoreGetterSetter(e,void 0,(function(e,t){return e.disableTrack(t,"video")}))}},n.lockVideoRepresentations=function(e){if(null===this._priv_contentInfos)throw new Error("No content loaded");var t,n,r;if(this._priv_contentInfos.isDirectFile)throw new Error("Cannot lock video Representations in directfile mode.");return Array.isArray(e)?(t=e,n=void 0):(t=e.representations,n=e.periodId,r=e.switchingMode),this._priv_callTracksStoreGetterSetter(n,void 0,(function(e,n){return e.lockVideoRepresentations(n,{representations:t,switchingMode:r})}))},n.lockAudioRepresentations=function(e){if(null===this._priv_contentInfos)throw new Error("No content loaded");var t,n,r;if(this._priv_contentInfos.isDirectFile)throw new Error("Cannot lock audio Representations in directfile mode.");return Array.isArray(e)?(t=e,n=void 0):(t=e.representations,n=e.periodId,r=e.switchingMode),this._priv_callTracksStoreGetterSetter(n,void 0,(function(e,n){return e.lockAudioRepresentations(n,{representations:t,switchingMode:r})}))},n.getLockedVideoRepresentations=function(e){return null===this._priv_contentInfos||this._priv_contentInfos.isDirectFile?null:this._priv_callTracksStoreGetterSetter(e,null,(function(e,t){return e.getLockedVideoRepresentations(t)}))},n.getLockedAudioRepresentations=function(e){return null===this._priv_contentInfos||this._priv_contentInfos.isDirectFile?null:this._priv_callTracksStoreGetterSetter(e,null,(function(e,t){return e.getLockedAudioRepresentations(t)}))},n.unlockVideoRepresentations=function(e){if(null!==this._priv_contentInfos&&!this._priv_contentInfos.isDirectFile)return this._priv_callTracksStoreGetterSetter(e,void 0,(function(e,t){return e.unlockVideoRepresentations(t)}))},n.unlockAudioRepresentations=function(e){if(null!==this._priv_contentInfos&&!this._priv_contentInfos.isDirectFile)return this._priv_callTracksStoreGetterSetter(e,void 0,(function(e,t){return e.unlockAudioRepresentations(t)}))},n.getMinimumPosition=function(){if(null===this._priv_contentInfos)return null;if(this._priv_contentInfos.isDirectFile)return 0;var e=this._priv_contentInfos.manifest;return null!==e?e.getMinimumSafePosition():null},n.getMaximumPosition=function(){if(null===this._priv_contentInfos)return null;var e=this._priv_contentInfos,t=e.isDirectFile,n=e.manifest;if(t){if(null===this.videoElement)throw new Error("Disposed player");return this.videoElement.duration}return null!==n?n.isDynamic||null===this.videoElement?n.getMaximumSafePosition():this.videoElement.duration:null},n.__priv_getSegmentBufferContent=function(e){if(null===this._priv_contentInfos||null===this._priv_contentInfos.segmentBuffersStore)return null;var t=this._priv_contentInfos.segmentBuffersStore.getStatus(e);return"initialized"===t.type?t.value.getInventory():null},n.__priv_getManifest=function(){return null===this._priv_contentInfos?null:this._priv_contentInfos.manifest},n.__priv_getCurrentAdaptation=function(){if(null===this._priv_contentInfos)return null;var e=this._priv_contentInfos,t=e.currentPeriod,n=e.activeAdaptations;return null===t||null===n||h(n[t.id])?null:n[t.id]},n.__priv_getCurrentRepresentations=function(){if(null===this._priv_contentInfos)return null;var e=this._priv_contentInfos,t=e.currentPeriod,n=e.activeRepresentations;return null===t||null===n||h(n[t.id])?null:n[t.id]},n._priv_cleanUpCurrentContentState=function(){var e,t,n,r,i=this;ne.debug("Locking `contentLock` to clean-up the current content."),this._priv_contentLock.setValue(!0),null===(t=null===(e=this._priv_contentInfos)||void 0===e?void 0:e.tracksStore)||void 0===t||t.dispose(),null===(r=null===(n=this._priv_contentInfos)||void 0===n?void 0:n.mediaElementTracksStore)||void 0===r||r.dispose(),this._priv_contentInfos=null,this._priv_contentEventsMemory={};var a=function(){null!==i.videoElement&&(ne.debug("Unlocking `contentLock`. Next content can begin."),i._priv_contentLock.setValue(!1))};h(this.videoElement)?a():nt(this.videoElement).then((function(){ne.debug("API: DRM session cleaned-up with success!"),a()}),(function(e){ne.error("API: An error arised when trying to clean-up the DRM session:"+(e instanceof Error?e.toString():"Unknown Error")),a()}))},n._priv_onManifestReady=function(e,t){var n,r=this;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){e.manifest=t,this._priv_reloadingMetadata.manifest=t;var i=new ft({preferTrickModeTracks:this._priv_preferTrickModeTracks,defaultAudioTrackSwitchingMode:e.defaultAudioTrackSwitchingMode});e.tracksStore=i,i.addEventListener("newAvailablePeriods",(function(e){r.trigger("newAvailablePeriods",e)})),i.addEventListener("brokenRepresentationsLock",(function(e){r.trigger("brokenRepresentationsLock",e)})),i.addEventListener("trackUpdate",(function(e){var t,n;r.trigger("trackUpdate",e);var i=null!==(n=null===(t=r._priv_contentInfos)||void 0===t?void 0:t.currentPeriod)&&void 0!==n?n:void 0;"no-playable-representation"===e.reason&&e.period.id===(null==i?void 0:i.id)&&r._priv_onAvailableTracksMayHaveChanged(e.trackType)})),e.tracksStore.addEventListener("warning",(function(e){r.trigger("warning",e)})),e.tracksStore.addEventListener("error",(function(t){r._priv_onFatalError(t,e)})),e.tracksStore.updatePeriodList(t),t.addEventListener("manifestUpdate",(function(n){var i,a,o;h(null==e?void 0:e.tracksStore)||e.tracksStore.updatePeriodList(t);var s=null!==(a=null===(i=r._priv_contentInfos)||void 0===i?void 0:i.currentPeriod)&&void 0!==a?a:void 0,u=null===(o=r._priv_contentInfos)||void 0===o?void 0:o.tracksStore;if(void 0!==s&&!h(u))for(var l,d=bt(n.updatedPeriods);!(l=d()).done;){var c=l.value;if(c.period.id===s.id&&(c.result.addedAdaptations.length>0||c.result.removedAdaptations.length>0)){if(void 0===u.getPeriodObjectFromPeriod(s))return;r._priv_onAvailableTracksMayHaveChanged("audio"),r._priv_onAvailableTracksMayHaveChanged("text"),r._priv_onAvailableTracksMayHaveChanged("video")}return}}),e.currentContentCanceller.signal),t.addEventListener("decipherabilityUpdate",(function(t){for(var n,i=t.reduce((function(t,n){var r,i,a;if(!(void 0===be(t,(function(e){return e[0].id===n.period.id&&e[1]===n.adaptation.type})))){var o=e.tracksStore;if(null===o)return t;var s=!1,u=o.getPeriodObjectFromPeriod(n.period);if(void 0===u)return t;switch(n.adaptation.type){case"audio":s=(null===(r=o.getChosenAudioTrack(u))||void 0===r?void 0:r.id)===n.adaptation.id;break;case"video":s=(null===(i=o.getChosenVideoTrack(u))||void 0===i?void 0:i.id)===n.adaptation.id;break;case"text":s=(null===(a=o.getChosenTextTrack(u))||void 0===a?void 0:a.id)===n.adaptation.id}s&&t.push([n.period,n.adaptation.type])}return t}),[]),a=bt(i);!(n=a()).done;){var o=n.value,s=o[0],u=o[1];r._priv_triggerEventIfNotStopped("representationListUpdate",{period:s,trackType:u,reason:"decipherability-update"},e.currentContentCanceller.signal)}}),e.currentContentCanceller.signal)}},n._priv_onActivePeriodChanged=function(e,t){var n,r,i,a,o,s,u=t.period;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){e.currentPeriod=u;var l=e.currentContentCanceller.signal;this._priv_contentEventsMemory.periodChange!==u&&(this._priv_contentEventsMemory.periodChange=u,this._priv_triggerEventIfNotStopped("periodChange",{start:u.start,end:u.end,id:u.id},l)),this._priv_triggerEventIfNotStopped("availableAudioTracksChange",this.getAvailableAudioTracks(),l),this._priv_triggerEventIfNotStopped("availableTextTracksChange",this.getAvailableTextTracks(),l),this._priv_triggerEventIfNotStopped("availableVideoTracksChange",this.getAvailableVideoTracks(),l);var d=null===(r=this._priv_contentInfos)||void 0===r?void 0:r.tracksStore;if(h(d))this._priv_triggerEventIfNotStopped("audioTrackChange",null,l),this._priv_triggerEventIfNotStopped("textTrackChange",null,l),this._priv_triggerEventIfNotStopped("videoTrackChange",null,l);else{var c=d.getPeriodObjectFromPeriod(u);if(c){var f=d.getChosenAudioTrack(c);this._priv_triggerEventIfNotStopped("audioTrackChange",f,l);var v=d.getChosenTextTrack(c);this._priv_triggerEventIfNotStopped("textTrackChange",v,l);var p=d.getChosenVideoTrack(c);this._priv_triggerEventIfNotStopped("videoTrackChange",p,l)}}var m=null!==(a=null===(i=this.__priv_getCurrentRepresentations())||void 0===i?void 0:i.audio)&&void 0!==a?a:null;this._priv_triggerEventIfNotStopped("audioRepresentationChange",m,l);var g=null!==(s=null===(o=this.__priv_getCurrentRepresentations())||void 0===o?void 0:o.video)&&void 0!==s?s:null;this._priv_triggerEventIfNotStopped("videoRepresentationChange",g,l)}},n._priv_onPeriodStreamReady=function(e,t){var n;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){var r=t.type,i=t.manifest,a=t.period,o=t.adaptationRef,s=e.tracksStore;switch(r){case"video":case"audio":case"text":h(s)?(ne.error("API: TracksStore not instanciated for a new "+r+" period"),o.setValue(null)):s.addTrackReference(r,i,a,o);break;default:ke()}}},n._priv_onPeriodStreamCleared=function(e,t){var n;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){var r=t.type,i=t.period,a=e.tracksStore;switch(r){case"audio":case"text":case"video":h(a)||a.removeTrackReference(r,i)}var o=e.activeAdaptations,s=e.activeRepresentations;if(!h(o)&&!h(o[i.id])){var u=o[i.id];delete u[r],0===Object.keys(u).length&&delete o[i.id]}if(!h(s)&&!h(s[i.id])){var l=s[i.id];delete l[r],0===Object.keys(l).length&&delete s[i.id]}}},n._priv_onAdaptationChange=function(e,t){var n,r=t.type,i=t.adaptation,a=t.period;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){null===e.activeAdaptations&&(e.activeAdaptations={});var o,s=e.activeAdaptations,u=e.currentPeriod,l=s[a.id];if(h(l))s[a.id]=((o={})[r]=i,o);else l[r]=i;var d=e.tracksStore,c=e.currentContentCanceller.signal;if(null!==d&&null!==u&&!h(a)&&a.id===u.id){var f=d.getPeriodObjectFromPeriod(a);if(void 0===f)return;switch(r){case"audio":var v=d.getChosenAudioTrack(f);this._priv_triggerEventIfNotStopped("audioTrackChange",v,c);break;case"text":var p=d.getChosenTextTrack(f);this._priv_triggerEventIfNotStopped("textTrackChange",p,c);break;case"video":var m=d.getChosenVideoTrack(f);this._priv_triggerEventIfNotStopped("videoTrackChange",m,c)}}}},n._priv_onRepresentationChange=function(e,t){var n,r=t.type,i=t.period,a=t.representation;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){null===e.activeRepresentations&&(e.activeRepresentations={});var o,s=e.activeRepresentations,u=e.currentPeriod,l=s[i.id];if(h(l))s[i.id]=((o={})[r]=a,o);else l[r]=a;if(!h(i)&&null!==u&&u.id===i.id){var d=this._priv_contentInfos.currentContentCanceller.signal;"video"===r?this._priv_triggerEventIfNotStopped("videoRepresentationChange",a,d):"audio"===r&&this._priv_triggerEventIfNotStopped("audioRepresentationChange",a,d)}}},n._priv_onBitrateEstimateChange=function(e){var t=e.type,n=e.bitrate;void 0!==n&&(this._priv_bitrateInfos.lastBitrates[t]=n),this.trigger("__priv_bitrateEstimateChange",{type:t,bitrate:n})},n._priv_setPlayerState=function(e){this.state!==e&&(this.state=e,ne.info("API: playerStateChange event",e),this.trigger("playerStateChange",e))},n._priv_triggerPositionUpdate=function(e,t){var n,r;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){var i=e.isDirectFile,a=e.manifest;if((i||null!==a)&&!h(t)){var o=null!==a?a.getMaximumSafePosition():void 0,s={position:t.position,duration:t.duration,playbackRate:t.playbackRate,maximumPosition:o,bufferGap:void 0!==t.bufferGap&&isFinite(t.bufferGap)?t.bufferGap:0};if(null!==a&&a.isLive&&t.position>0){var u=null!==(r=a.availabilityStartTime)&&void 0!==r?r:0;s.wallClockTime=t.position+u;var l=a.getLivePosition();void 0!==l&&(s.liveGap=l-t.position)}else if(i&&null!==this.videoElement){var d=K(this.videoElement);void 0!==d&&(s.wallClockTime=d+t.position)}this.trigger("positionUpdate",s)}}},n._priv_triggerEventIfNotStopped=function(e,t,n){n.isCancelled()||this.trigger(e,t)},n._priv_initializeMediaElementTracksStore=function(e){var t,n,r,i=this;Ee(_e.directfile),Ee(this.videoElement);var a=new _e.directfile.mediaElementTracksStore(this.videoElement);return this._priv_triggerEventIfNotStopped("availableAudioTracksChange",a.getAvailableAudioTracks(),e),this._priv_triggerEventIfNotStopped("availableVideoTracksChange",a.getAvailableVideoTracks(),e),this._priv_triggerEventIfNotStopped("availableTextTracksChange",a.getAvailableTextTracks(),e),this._priv_triggerEventIfNotStopped("audioTrackChange",null!==(t=a.getChosenAudioTrack())&&void 0!==t?t:null,e),this._priv_triggerEventIfNotStopped("textTrackChange",null!==(n=a.getChosenTextTrack())&&void 0!==n?n:null,e),this._priv_triggerEventIfNotStopped("videoTrackChange",null!==(r=a.getChosenVideoTrack())&&void 0!==r?r:null,e),a.addEventListener("availableVideoTracksChange",(function(e){return i.trigger("availableVideoTracksChange",e)})),a.addEventListener("availableAudioTracksChange",(function(e){return i.trigger("availableAudioTracksChange",e)})),a.addEventListener("availableTextTracksChange",(function(e){return i.trigger("availableTextTracksChange",e)})),a.addEventListener("audioTrackChange",(function(e){return i.trigger("audioTrackChange",e)})),a.addEventListener("videoTrackChange",(function(e){return i.trigger("videoTrackChange",e)})),a.addEventListener("textTrackChange",(function(e){return i.trigger("textTrackChange",e)})),a},n._priv_callTracksStoreGetterSetter=function(e,t,n){var r,i;if(null===this._priv_contentInfos||null===this._priv_contentInfos.tracksStore)return ne.warn("API: Trying to call track API too soon"),t;var a=this._priv_contentInfos.tracksStore,o=null!==(i=null===(r=this._priv_contentInfos)||void 0===r?void 0:r.currentPeriod)&&void 0!==i?i:void 0,s=null!=e?e:null==o?void 0:o.id;if(void 0===s)return t;var u=s===(null==o?void 0:o.id)?a.getPeriodObjectFromPeriod(o):a.getPeriodObjectFromId(s);return void 0===u?t:n(a,u)},n._priv_onAvailableTracksMayHaveChanged=function(e,t){var n=this._priv_contentInfos;if(null!==n){var r=n.currentPeriod,i=n.tracksStore,a=n.currentContentCanceller.signal;if(!h(r)&&null!==i){var o=null!=t?t:i.getPeriodObjectFromPeriod(r);if(void 0!==o)switch(e){case"video":var s=i.getAvailableVideoTracks(o);this._priv_triggerEventIfNotStopped("availableVideoTracksChange",null!=s?s:[],a);break;case"audio":var u=i.getAvailableAudioTracks(o);this._priv_triggerEventIfNotStopped("availableAudioTracksChange",null!=u?u:[],a);break;case"text":var l=i.getAvailableTextTracks(o);this._priv_triggerEventIfNotStopped("availableTextTracksChange",null!=l?l:[],a);break;default:ke()}}}},n._priv_onFatalError=function(e,t){var n=ge(e,{defaultCode:"NONE",defaultReason:"An unknown error stopped content playback."});n.fatal=!0,t.currentContentCanceller.cancel(),this._priv_cleanUpCurrentContentState(),this._priv_currentError=n,ne.error("API: The player stopped because of an error",n),this._priv_setPlayerState("STOPPED"),this._priv_currentError===n&&this.trigger("error",n)},a(t,null,[{key:"ErrorTypes",get:function(){return ue}},{key:"ErrorCodes",get:function(){return de}},{key:"LogLevel",get:function(){return ne.getLevel()},set:function(e){ne.setLevel(e)}}]),t}(we);It.version="4.0.0-beta.3";var Rt=It;function xt(e,t){var n;return new Promise((function(r,i){if(null!==e.cancellationError)return i(e.cancellationError);var a=!1;function o(e){void 0!==n&&n(),i(e)}n=t((function(t){e.deregister(o),a=!0,r(t)}),(function(t){e.deregister(o),a=!0,i(t)})),a||e.register(o)}))}function Mt(e){var t=e.map((function(t){return Math.log(t/e[0])})),n=t.map((function(e){return e-t[0]+1})),r=(n[n.length-1]-1)/(2*e.length+10),i=1/r;return e.map((function(e,t){return a(t)}));function a(t){if(0===t)return 0;var o=Math.min(Math.max(1,t),e.length-1);return e[o]===e[o-1]?a(t-1):i*(r+(e[o]*n[o-1]-e[o-1]*n[o])/(e[o]-e[o-1]))+4}}var Ct=function(){function e(e){this._levelsMap=Mt(e).map((function(e){return e+4})),this._bitrates=e,this._lastUnsuitableQualityTimestamp=void 0,this._blockRaiseDelay=6e3,ne.debug("ABR: Steps for buffer based chooser.",this._levelsMap.map((function(t,n){return"bufferLevel: "+t+", bitrate: "+e[n]})).join(" ,"))}var t=e.prototype;return t.onAddedSegment=function(e){var t=this._levelsMap,n=this._bitrates,r=e.bufferGap,i=e.currentBitrate,a=e.currentScore,o=e.speed;if(null!=i){for(var s,u=-1,l=0;l<n.length;l++){var d=n[l];if(d===i)u=l;else if(d>i)break}if(u<0||n.length!==t.length)return ne.info("ABR: Current Bitrate not found in the calculated levels"),void(this._currentEstimate=n[0]);void 0!==a&&(s=0===o?a.score:a.score/o);var c=isFinite(r)?r:0,f=at();if(c<t[u]||void 0!==s&&s<1&&1===(null==a?void 0:a.confidenceLevel)){if((void 0===this._lastUnsuitableQualityTimestamp?-1:f-this._lastUnsuitableQualityTimestamp)<this._blockRaiseDelay+9e3){var v=this._blockRaiseDelay+3e3;this._blockRaiseDelay=Math.min(v,15e3),ne.debug("ABR: Incrementing blocking raise in BufferBasedChooser due to unstable quality",this._blockRaiseDelay)}else{var p=this._blockRaiseDelay-1e3;this._blockRaiseDelay=Math.max(6e3,p),ne.debug("ABR: Lowering quality in BufferBasedChooser",this._blockRaiseDelay)}this._lastUnsuitableQualityTimestamp=f;for(var h=g(n,(function(e){return e===i}))-1;h>=0;h--)if(c>=t[h])return void(this._currentEstimate=n[h]);this._currentEstimate=n[0]}else if(void 0!==this._lastUnsuitableQualityTimestamp&&f-this._lastUnsuitableQualityTimestamp<this._blockRaiseDelay||void 0===s||s<1.15||1!==(null==a?void 0:a.confidenceLevel))this._currentEstimate=i;else{var m=t[u],y=function(){for(var e=u+1;e<t.length;e++)if(t[e]>m)return e}();if(void 0!==y)if(r>=t[y])return ne.debug("ABR: Raising quality in BufferBasedChooser",n[y]),void(this._currentEstimate=n[y]);this._currentEstimate=i}}else this._currentEstimate=n[0]},t.getLastEstimate=function(){return this._currentEstimate},e}(),Pt=function(){function e(e){this._alpha=Math.exp(Math.log(.5)/e),this._lastEstimate=0,this._totalWeight=0}var t=e.prototype;return t.addSample=function(e,t){var n=Math.pow(this._alpha,e),r=t*(1-n)+n*this._lastEstimate;isNaN(r)||(this._lastEstimate=r,this._totalWeight+=e)},t.getEstimate=function(){var e=1-Math.pow(this._alpha,this._totalWeight);return this._lastEstimate/e},e}();function Dt(e){if(!(e.progress.length<5)){for(var t=new Pt(2),n=e.progress,r=1;r<n.length;r++){var i=n[r].size-n[r-1].size,a=n[r].timestamp-n[r-1].timestamp,o=8*i/(a/1e3);t.addSample(a/1e3,o)}return t.getEstimate()}}function Nt(e,t){var n=8*(e.totalSize-e.size);return Math.max(n/t,0)}var Ot=function(){function e(e,t){var n=v.getCurrent(),r=n.ABR_STARVATION_GAP,i=n.OUT_OF_STARVATION_GAP,a=n.ABR_STARVATION_FACTOR,o=n.ABR_REGULAR_FACTOR;this._initialBitrate=e,this._inStarvationMode=!1,this._lowLatencyMode=t,this._config=t?{starvationGap:r.LOW_LATENCY,outOfStarvationGap:i.LOW_LATENCY,starvationBitrateFactor:a.LOW_LATENCY,regularBitrateFactor:o.LOW_LATENCY}:{starvationGap:r.DEFAULT,outOfStarvationGap:i.DEFAULT,starvationBitrateFactor:a.DEFAULT,regularBitrateFactor:o.DEFAULT}}var t=e.prototype;return t.getBandwidthEstimate=function(e,t,n,r,i){var a,o,s=this._config,u=e.bufferGap,l=e.position,d=e.duration,c=isFinite(u)?u:0,f=v.getCurrent().ABR_STARVATION_DURATION_DELTA;return isNaN(d)||c+l.last<d-f?!this._inStarvationMode&&c<=s.starvationGap?(ne.info("ABR: enter starvation mode."),this._inStarvationMode=!0):this._inStarvationMode&&c>=s.outOfStarvationGap&&(ne.info("ABR: exit starvation mode."),this._inStarvationMode=!1):this._inStarvationMode&&(ne.info("ABR: exit starvation mode."),this._inStarvationMode=!1),this._inStarvationMode&&(o=function(e,t,n,r,i){if(!r){var a=t.bufferGap,o=t.speed,s=t.position,u=isFinite(a)?a:0,l=function(e,t){for(var n=-1,r=0;r<e.length;r++){var i=e[r].content.segment;if(!(i.duration<=0)){var a=i.time+i.duration;if(!i.complete&&r===e.length-1&&t-i.time>-1.2){n=r;break}if(a>t&&t-i.time>-1.2){n=r;break}}}if(n<0)return[];for(var o=e[n],s=o.content.segment.time,u=[o],l=n+1;l<e.length&&e[l].content.segment.time===s;l++)u.push(e[l]);return u}(e,s.last+u);if(1===l.length){var d=l[0],c=at(),f=1.5*d.content.segment.duration;if(f=Math.min(f,3e3),f=Math.max(f,12e3),!(c-d.requestTimestamp<f)){var v=d.progress.length>0?d.progress[d.progress.length-1]:void 0,p=Dt(d);if(void 0!==v&&void 0!==p){var h=Nt(v,p);if((c-v.timestamp)/1e3<=h&&h-u/o>2500)return p}if(d.content.segment.complete){var m=d.content.segment.duration,g=(c-d.requestTimestamp)/1e3;if(null!=n&&!(g<=(1.5*m+2)/o)){var y=m/g,_=n.bitrate*Math.min(.7,y);return void 0===i||_<i?_:void 0}}}}}}(r,e,n,this._lowLatencyMode,i),void 0!==o&&(ne.info("ABR: starvation mode emergency estimate:",o),t.reset(),a=h(n)?o:Math.min(o,n.bitrate))),null==a&&(a=void 0!==(o=t.getEstimate())?o*(this._inStarvationMode?s.starvationBitrateFactor:s.regularBitrateFactor):void 0!==i?i*(this._inStarvationMode?s.starvationBitrateFactor:s.regularBitrateFactor):this._initialBitrate),e.speed>1&&(a/=e.speed),{bandwidthEstimate:o,bitrateChosen:a}},t.isUrgent=function(e,t,n,r){return null===t||!(e>=t.bitrate)&&function(e,t,n){if(n)return!0;var r=isFinite(e.bufferGap)?e.bufferGap:0,i=e.position.last+r,a=be(t,(function(e){var t=e.content;return t.segment.duration>0&&t.segment.time+t.segment.duration>i}));if(void 0===a)return!0;var o=at(),s=a.progress.length>0?a.progress[a.progress.length-1]:void 0,u=Dt(a);if(void 0===s||void 0===u)return!0;var l=Nt(s,u);return(o-s.timestamp)/1e3>1.2*l||l-r/e.speed>-1.5}(r,n,this._lowLatencyMode)},e}();function Lt(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Ut(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ut(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Ut(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Bt=function(){function e(e,t){this._scoreCalculator=e,this._lastAbrEstimate=t,this._consecutiveWrongGuesses=0,this._blockGuessesUntil=0,this._lastMaintanableBitrate=null}var t=e.prototype;return t.getGuess=function(e,t,n,r,i){var a=t.bufferGap,o=t.speed,s=this._lastAbrEstimate.representation;if(null===s)return null;if(r>s.bitrate)return 2===this._lastAbrEstimate.algorithmType&&(null!==this._lastAbrEstimate.representation&&(this._lastMaintanableBitrate=this._lastAbrEstimate.representation.bitrate),this._consecutiveWrongGuesses=0),null;var u=this._scoreCalculator.getEstimate(n);if(2!==this._lastAbrEstimate.algorithmType){if(void 0===u)return null;if(this._canGuessHigher(a,o,u)){var l=Ft(e,n);if(null!==l)return l}return null}if(this._isLastGuessValidated(s,r,u)&&(ne.debug("ABR: Guessed Representation validated",s.bitrate),this._lastMaintanableBitrate=s.bitrate,this._consecutiveWrongGuesses=0),n.id!==s.id)return s;if(this._shouldStopGuess(n,u,a,i))return this._consecutiveWrongGuesses++,this._blockGuessesUntil=at()+Math.min(15e3*this._consecutiveWrongGuesses,12e4),function(e,t){var n=g(e,(function(e){return e.id===t.id}));if(n<0)return ne.error("ABR: Current Representation not found."),null;for(;--n>=0;)if(e[n].bitrate<t.bitrate)return e[n];return null}(e,n);if(void 0===u)return n;if(this._canGuessHigher(a,o,u)){var d=Ft(e,n);if(null!==d)return d}return n},t._canGuessHigher=function(e,t,n){var r=n.score,i=n.confidenceLevel;return isFinite(e)&&e>=2.5&&at()>this._blockGuessesUntil&&1===i&&r/t>1.01},t._shouldStopGuess=function(e,t,n,r){if(void 0!==t&&t.score<1.01)return!0;if((void 0===t||t.score<1.2)&&n<.6)return!0;for(var i,a=r.filter((function(t){return t.content.representation.id===e.id})),o=at(),s=Lt(a);!(i=s()).done;){var u=i.value,l=o-u.requestTimestamp;if(u.content.segment.isInit){if(l>1e3)return!0}else{if(l>1e3*u.content.segment.duration+200)return!0;var d=Dt(u);if(void 0!==d&&d<.8*e.bitrate)return!0}}return!1},t._isLastGuessValidated=function(e,t,n){return void 0!==n&&1===n.confidenceLevel&&n.score>1.5||t>=e.bitrate&&(null===this._lastMaintanableBitrate||this._lastMaintanableBitrate<e.bitrate)},e}();function Ft(e,t){var n=e.length,r=g(e,(function(e){return e.id===t.id}));if(r<0)return ne.error("ABR: Current Representation not found."),null;for(;++r<n;)if(e[r].bitrate>t.bitrate)return e[r];return null}var zt=function(){function e(){var e=v.getCurrent(),t=e.ABR_FAST_EMA,n=e.ABR_SLOW_EMA;this._fastEWMA=new Pt(t),this._slowEWMA=new Pt(n),this._bytesSampled=0}var t=e.prototype;return t.addSample=function(e,t){if(!(t<v.getCurrent().ABR_MINIMUM_CHUNK_SIZE)){var n=8e3*t/e,r=e/1e3;this._bytesSampled+=t,this._fastEWMA.addSample(r,n),this._slowEWMA.addSample(r,n)}},t.getEstimate=function(){var e=v.getCurrent().ABR_MINIMUM_TOTAL_BYTES;if(!(this._bytesSampled<e))return Math.min(this._fastEWMA.getEstimate(),this._slowEWMA.getEstimate())},t.reset=function(){var e=v.getCurrent(),t=e.ABR_FAST_EMA,n=e.ABR_SLOW_EMA;this._fastEWMA=new Pt(t),this._slowEWMA=new Pt(n),this._bytesSampled=0},e}();function Vt(){for(var e=0,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];for(var i=n.length;e<i;){var a=n[e];if(!h(a))return a;e++}}var Kt=function(){function e(){this.bandwidth=void 0,this.representation=null,this.algorithmType=3}return e.prototype.update=function(e,t,n){this.representation=e,this.bandwidth=t,this.algorithmType=n},e}();var Gt="function"==typeof Object.values?Object.values:function(e){return Object.keys(e).map((function(t){return e[t]}))},Wt=function(){function e(){this._currentRequests={}}var t=e.prototype;return t.add=function(e){var t=e.id,n=e.requestTimestamp,r=e.content;this._currentRequests[t]={requestTimestamp:n,progress:[],content:r}},t.addProgress=function(e){var t=this._currentRequests[e.id];null!=t?t.progress.push(e):ne.warn("ABR: progress for a request not added")},t.remove=function(e){null==this._currentRequests[e]&&ne.warn("ABR: can't remove unknown request"),delete this._currentRequests[e]},t.getRequests=function(){return Gt(this._currentRequests).filter((function(e){return null!=e})).sort((function(e,t){return e.content.segment.time-t.content.segment.time}))},e}(),jt=function(){function e(){this._currentRepresentationData=null,this._lastRepresentationWithGoodScore=null}var t=e.prototype;return t.addSample=function(e,t,n){var r,i=n/t,a=this._currentRepresentationData;null!==a&&a.representation.id===e.id?(r=a.ewma,a.ewma.addSample(t,i),a.loadedDuration+=n,a.loadedSegments++):((r=new Pt(5)).addSample(t,i),this._currentRepresentationData={representation:e,ewma:r,loadedDuration:n,loadedSegments:0}),r.getEstimate()>1&&this._lastRepresentationWithGoodScore!==e&&(ne.debug("ABR: New last stable representation",e.bitrate),this._lastRepresentationWithGoodScore=e)},t.getEstimate=function(e){if(null!==this._currentRepresentationData&&this._currentRepresentationData.representation.id===e.id){var t=this._currentRepresentationData,n=t.ewma,r=t.loadedSegments,i=t.loadedDuration;return{score:n.getEstimate(),confidenceLevel:r>=5&&i>=10?1:0}}},t.getLastStableRepresentation=function(){return this._lastRepresentationWithGoodScore},e}();function Ht(e,t){var n=g(e,(function(e){return e.bitrate>t}));return-1===n?e[e.length-1]:0===n?e[0]:e[n-1]}var qt=new E(void 0);qt.finish();var Yt=new E(1/0);Yt.finish();var Qt=function(e){var t={},n=e.initialBitrates,r=e.throttlers,i=e.lowLatencyMode;return function(e,a,o,s,u){var l,d,c,f=e.adaptation.type,p=function(e){var n=t[e];if(null==n){ne.debug("ABR: Creating new BandwidthEstimator for ",e);var r=new zt;return t[e]=r,r}return n}(f),h=null!==(l=n[f])&&void 0!==l?l:0;return function(e,t){var n=e.bandwidthEstimator,r=e.context,i=e.currentRepresentation,a=e.filters,o=e.initialBitrate,s=e.lowLatencyMode,u=e.playbackObserver,l=e.representations,d=new jt,c=new Ot(null!=o?o:0,s),f=new Wt,p=m,h={metrics:T,requestBegin:k,requestProgress:w,requestEnd:A,addedSegment:function(e){p(e)}},y=new Ge;y.linkToSignal(t);var _=b(l.getValue(),y.signal);return l.onUpdate(S,{clearSignal:t}),{estimates:_,callbacks:h};function b(e,t){if(e.length<=1)return new E({bitrate:void 0,representation:e[0],urgent:!0,knownStableBitrate:void 0});var o=!1,l=e.sort((function(e,t){return e.bitrate-t.bitrate})),h=new Ct(l.map((function(e){return e.bitrate}))),y=new Kt,_=new Bt(d,y),b=u.getReference().getValue(),S=new E(k());return u.listen((function(e){b=e,T()}),{includeLastObservation:!1,clearSignal:t}),p=function(e){if(null!==b){var t=b,n=t.position,r=t.speed,i=Be(e.buffered,n.last),a=e.content.representation,o=d.getEstimate(a),s={bufferGap:i,currentBitrate:a.bitrate,currentScore:o,speed:r};h.onAddedSegment(s),T()}},t.register((function(){p=m})),a.throttleBitrate.onUpdate(T,{clearSignal:t}),a.limitResolution.onUpdate(T,{clearSignal:t}),S;function T(){S.setValue(k())}function k(){var e=b,t=e.bufferGap,u=e.position,p=e.maximumPosition,m=a.limitResolution.getValue(),S=a.throttleBitrate.getValue(),E=i.getValue(),T=function(e,t,n){var r=e;void 0!==n&&n<1/0&&(r=function(e,t){if(0===e.length)return[];e.sort((function(e,t){return e.bitrate-t.bitrate}));var n=e[0].bitrate,r=Math.max(t,n),i=g(e,(function(e){return e.bitrate>r}));return-1===i?e:e.slice(0,i)}(r,n));void 0!==t&&(r=function(e,t){if(void 0===t.width||void 0===t.height)return e;var n=t.width*t.pixelRatio,r=t.height*t.pixelRatio,i=be(e.slice().sort((function(e,t){return Vt(e.width,0)-Vt(t.width,0)})),(function(e){return"number"==typeof e.width&&e.width>=n&&"number"==typeof e.height&&e.height>=r}));if(void 0===i)return e;var a="number"==typeof i.width?i.width:0;return e.filter((function(e){return"number"!=typeof e.width||e.width<=a}))}(r,t));return r}(l,m,S),k=f.getRequests(),w=c.getBandwidthEstimate(b,n,E,k,y.bandwidth),A=w.bandwidthEstimate,I=w.bitrateChosen,R=d.getLastStableRepresentation(),x=null===R?void 0:R.bitrate/(b.speed>0?b.speed:1),M=v.getCurrent(),C=M.ABR_ENTER_BUFFER_BASED_ALGO,P=M.ABR_EXIT_BUFFER_BASED_ALGO;o&&t<=P?o=!1:!o&&isFinite(t)&&t>=C&&(o=!0);var D=Ht(T,I),N=h.getLastEstimate(),O=D.bitrate,L=null;o&&void 0!==N&&N>O&&(O=(L=Ht(T,N)).bitrate);var U=null;return s&&null!==E&&r.manifest.isDynamic&&p-u.last<40&&(U=_.getGuess(l,b,E,O,k)),null!==U&&U.bitrate>O?(ne.debug("ABR: Choosing representation with guess-based estimation.",U.bitrate,U.id),y.update(U,A,2),{bitrate:A,representation:U,urgent:null===E||U.bitrate<E.bitrate,knownStableBitrate:x}):null!==L?(ne.debug("ABR: Choosing representation with buffer-based estimation.",L.bitrate,L.id),y.update(L,A,0),{bitrate:A,representation:L,urgent:c.isUrgent(L.bitrate,E,k,b),knownStableBitrate:x}):(ne.debug("ABR: Choosing representation with bandwidth estimation.",D.bitrate,D.id),y.update(D,A,1),{bitrate:A,representation:D,urgent:c.isUrgent(D.bitrate,E,k,b),knownStableBitrate:x})}}function S(){var e=l.getValue();y.cancel(),(y=new Ge).linkToSignal(t),b(e,y.signal).onUpdate((function(e){_.setValue(e)}),{clearSignal:y.signal,emitCurrentValue:!0})}function T(e){var t=e.requestDuration,r=e.segmentDuration,i=e.size,a=e.content;if(n.addSample(t,i),!a.segment.isInit){var o=a.segment,s=a.representation;if(void 0===r&&!o.complete)return;var u=null!=r?r:o.duration;d.addSample(s,t/1e3,u)}}function k(e){f.add(e)}function w(e){f.addProgress(e)}function A(e){f.remove(e.id)}}({bandwidthEstimator:p,context:e,currentRepresentation:a,filters:{limitResolution:null!==(d=r.limitResolution[f])&&void 0!==d?d:qt,throttleBitrate:null!==(c=r.throttleBitrate[f])&&void 0!==c?c:Yt},initialBitrate:h,playbackObserver:s,representations:o,lowLatencyMode:i},u)}},$t=[];function Xt(e){Se($t,e)||(console.warn(e),$t.push(e))}var Zt={aa:"aar",ab:"abk",ae:"ave",af:"afr",ak:"aka",am:"amh",an:"arg",ar:"ara",as:"asm",av:"ava",ay:"aym",az:"aze",ba:"bak",be:"bel",bg:"bul",bi:"bis",bm:"bam",bn:"ben",bo:"bod",br:"bre",bs:"bos",ca:"cat",ce:"che",ch:"cha",co:"cos",cr:"cre",cs:"ces",cu:"chu",cv:"chv",cy:"cym",da:"dan",de:"deu",dv:"div",dz:"dzo",ee:"ewe",el:"ell",en:"eng",eo:"epo",es:"spa",et:"est",eu:"eus",fa:"fas",ff:"ful",fi:"fin",fj:"fij",fo:"fao",fr:"fra",fy:"fry",ga:"gle",gd:"gla",gl:"glg",gn:"grn",gu:"guj",gv:"glv",ha:"hau",he:"heb",hi:"hin",ho:"hmo",hr:"hrv",ht:"hat",hu:"hun",hy:"hye",hz:"her",ia:"ina",id:"ind",ie:"ile",ig:"ibo",ii:"iii",ik:"ipk",io:"ido",is:"isl",it:"ita",iu:"iku",ja:"jpn",jv:"jav",ka:"kat",kg:"kon",ki:"kik",kj:"kua",kk:"kaz",kl:"kal",km:"khm",kn:"kan",ko:"kor",kr:"kau",ks:"kas",ku:"kur",kv:"kom",kw:"cor",ky:"kir",la:"lat",lb:"ltz",lg:"lug",li:"lim",ln:"lin",lo:"lao",lt:"lit",lu:"lub",lv:"lav",mg:"mlg",mh:"mah",mi:"mri",mk:"mkd",ml:"mal",mn:"mon",mr:"mar",ms:"msa",mt:"mlt",my:"mya",na:"nau",nb:"nob",nd:"nde",ne:"nep",ng:"ndo",nl:"nld",nn:"nno",no:"nor",nr:"nbl",nv:"nav",ny:"nya",oc:"oci",oj:"oji",om:"orm",or:"ori",os:"oss",pa:"pan",pi:"pli",pl:"pol",ps:"pus",pt:"por",qu:"que",rm:"roh",rn:"run",ro:"ron",ru:"rus",rw:"kin",sa:"san",sc:"srd",sd:"snd",se:"sme",sg:"sag",si:"sin",sk:"slk",sl:"slv",sm:"smo",sn:"sna",so:"som",sq:"sqi",sr:"srp",ss:"ssw",st:"sot",su:"sun",sv:"swe",sw:"swa",ta:"tam",te:"tel",tg:"tgk",th:"tha",ti:"tir",tk:"tuk",tl:"tgl",tn:"tsn",to:"ton",tr:"tur",ts:"tso",tt:"tat",tw:"twi",ty:"tah",ug:"uig",uk:"ukr",ur:"urd",uz:"uzb",ve:"ven",vi:"vie",vo:"vol",wa:"wln",wo:"wol",xh:"xho",yi:"yid",yo:"yor",za:"zha",zh:"zho",zu:"zul"},Jt={alb:"sqi",arm:"hye",baq:"eus",bur:"mya",chi:"zho",cze:"ces",dut:"nld",fre:"fra",geo:"kat",ger:"deu",gre:"ell",ice:"isl",mac:"mkd",mao:"mri",may:"msa",per:"fas",slo:"slk",rum:"ron",tib:"bod",wel:"cym"};function en(e){if(h(e)||""===e)return"";var t=function(e){var t;switch(e.length){case 2:t=Zt[e];break;case 3:t=Jt[e]}return t}((""+e).toLowerCase().split("-")[0]);return p(t)?t:e}var tn=en,nn=w,rn=void 0===nn?void 0:h(nn.MediaSource)?h(nn.MozMediaSource)?h(nn.WebKitMediaSource)?nn.MSMediaSource:nn.WebKitMediaSource:nn.MozMediaSource:nn.MediaSource,an=1;function on(e,t){if(e.length!==t.length)return!1;if(e===t)return!0;for(var n=e.length-1;n>=0;n--)if(e[n]!==t[n])return!1;return!0}function sn(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return un(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return un(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function un(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var ln,dn=Ae(),cn=function(){function e(e,t){if(this.id=e.id,this.uniqueId=dn(),this.bitrate=e.bitrate,this.codec=e.codecs,void 0!==e.isSpatialAudio&&(this.isSpatialAudio=e.isSpatialAudio),void 0!==e.height&&(this.height=e.height),void 0!==e.width&&(this.width=e.width),void 0!==e.mimeType&&(this.mimeType=e.mimeType),void 0!==e.contentProtections&&(this.contentProtections=e.contentProtections),void 0!==e.frameRate&&(this.frameRate=e.frameRate),void 0!==e.hdrInfo&&(this.hdrInfo=e.hdrInfo),this.cdnMetadata=e.cdnMetadata,this.index=e.index,"audio"===t.type||"video"===t.type){var n=this.getMimeTypeString(),r=(i=n,null!=rn&&("function"!=typeof rn.isTypeSupported||rn.isTypeSupported(i)));r||ne.info("Unsupported Representation",n,this.id,this.bitrate),this.isSupported=r}else this.isSupported=!0;var i}var t=e.prototype;return t.getMimeTypeString=function(){var e,t;return(null!==(e=this.mimeType)&&void 0!==e?e:"")+';codecs="'+(null!==(t=this.codec)&&void 0!==t?t:"")+'"'},t.getEncryptionData=function(e){for(var t,n,r=this.getAllEncryptionData(),i=[],a=0;a<r.length;a++)for(var o=!1,s=r[a],u=0;u<s.values.length;u++)if(s.values[u].systemId.toLowerCase()===e.toLowerCase())if(o)i[i.length-1].values.push(s.values[u]);else{var l=null===(n=null===(t=this.contentProtections)||void 0===t?void 0:t.keyIds)||void 0===n?void 0:n.map((function(e){return e.keyId}));i.push({type:s.type,keyIds:l,values:[s.values[u]]}),o=!0}return i},t.getAllEncryptionData=function(){var e,t;if(void 0===this.contentProtections||0===this.contentProtections.initData.length)return[];var n=null===(t=null===(e=this.contentProtections)||void 0===e?void 0:e.keyIds)||void 0===t?void 0:t.map((function(e){return e.keyId}));return this.contentProtections.initData.map((function(e){return{type:e.type,keyIds:n,values:e.values}}))},t.addProtectionData=function(e,t,n){var r=!1;if(void 0===this.contentProtections)return this.contentProtections={keyIds:void 0!==t?[{keyId:t}]:[],initData:[{type:e,values:n}]},!0;if(void 0!==t){var i=this.contentProtections.keyIds;if(void 0===i)this.contentProtections.keyIds=[{keyId:t}];else{for(var a,o=!1,s=sn(i);!(a=s()).done;){on(a.value.keyId,t)&&(o=!0)}o||(ne.warn("Manifest: found unanounced key id."),i.push({keyId:t}))}}for(var u=this.contentProtections.initData,l=0;l<u.length;l++)if(u[l].type===e){for(var d=u[l].values,c=0;c<n.length;c++){var f=n[c],v=void 0;for(v=0;v<d.length;v++)if(f.systemId===d[v].systemId){if(on(f.data,d[v].data))break;ne.warn("Manifest: different init data for the same system ID")}v===d.length&&(d.push(f),r=!0)}return r}return this.contentProtections.initData.push({type:e,values:n}),!0},t.toAudioRepresentation=function(){return{id:this.id,bitrate:this.bitrate,codec:this.codec,isSpatialAudio:this.isSpatialAudio,isCodecSupported:this.isSupported,decipherable:this.decipherable}},t.toVideoRepresentation=function(){return{id:this.id,bitrate:this.bitrate,frameRate:this.frameRate,width:this.width,height:this.height,codec:this.codec,hdrInfo:this.hdrInfo,isCodecSupported:this.isSupported,decipherable:this.decipherable}},t.isPlayable=function(){return this.isSupported&&!1!==this.decipherable},e}(),fn=cn,vn=["audio","video","text"],pn=function(){function e(t,n){void 0===n&&(n={});var r=t.trickModeTracks,i=n,a=i.representationFilter,o=i.isManuallyAdded;this.id=t.id,this.type=t.type,void 0!==t.isTrickModeTrack&&(this.isTrickModeTrack=t.isTrickModeTrack),void 0!==t.language&&(this.language=t.language,this.normalizedLanguage=tn(t.language)),void 0!==t.closedCaption&&(this.isClosedCaption=t.closedCaption),void 0!==t.audioDescription&&(this.isAudioDescription=t.audioDescription),void 0!==t.isDub&&(this.isDub=t.isDub),void 0!==t.forcedSubtitles&&(this.isForcedSubtitles=t.forcedSubtitles),void 0!==t.isSignInterpreted&&(this.isSignInterpreted=t.isSignInterpreted),void 0!==t.label&&(this.label=t.label),void 0!==r&&r.length>0&&(this.trickModeTracks=r.map((function(t){return new e(t)})));for(var s=t.representations,u=[],l=!1,d=0;d<s.length;d++){var c=new fn(s[d],{type:this.type}),f=!0;if(!h(a)){var v={id:c.id,bitrate:c.bitrate,codec:c.codec,height:c.height,width:c.width,frameRate:c.frameRate,hdrInfo:c.hdrInfo};if(void 0!==c.contentProtections&&(v.contentProtections={},void 0!==c.contentProtections.keyIds)){var p=c.contentProtections.keyIds.map((function(e){return e.keyId}));v.contentProtections.keyIds=p}f=a(v,{trackType:this.type,language:this.language,normalizedLanguage:this.normalizedLanguage,isClosedCaption:this.isClosedCaption,isDub:this.isDub,isAudioDescription:this.isAudioDescription,isSignInterpreted:this.isSignInterpreted})}f?(u.push(c),!l&&c.isSupported&&(l=!0)):ne.debug("Filtering Representation due to representationFilter",this.type,"Adaptation: "+this.id,"Representation: "+c.id,"("+c.bitrate+")")}u.sort((function(e,t){return e.bitrate-t.bitrate})),this.representations=u,this.isSupported=l,this.manuallyAdded=!0===o}var t=e.prototype;return t.getPlayableRepresentations=function(){return this.representations.filter((function(e){return e.isPlayable()}))},t.getRepresentation=function(e){return be(this.representations,(function(t){var n=t.id;return e===n}))},t.toAudioTrack=function(e){var t,n,r={language:null!==(t=this.language)&&void 0!==t?t:"",normalized:null!==(n=this.normalizedLanguage)&&void 0!==n?n:"",audioDescription:!0===this.isAudioDescription,id:this.id,representations:(e?this.getPlayableRepresentations():this.representations).map((function(e){return e.toAudioRepresentation()})),label:this.label};return!0===this.isDub&&(r.dub=!0),r},t.toTextTrack=function(){var e,t;return{language:null!==(e=this.language)&&void 0!==e?e:"",normalized:null!==(t=this.normalizedLanguage)&&void 0!==t?t:"",closedCaption:!0===this.isClosedCaption,id:this.id,label:this.label,forced:this.isForcedSubtitles}},t.toVideoTrack=function(e){var t=void 0!==this.trickModeTracks?this.trickModeTracks.map((function(t){var n=(e?t.getPlayableRepresentations():t.representations).map((function(e){return e.toVideoRepresentation()})),r={id:t.id,representations:n,isTrickModeTrack:!0};return!0===t.isSignInterpreted&&(r.signInterpreted=!0),r})):void 0,n={id:this.id,representations:(e?this.getPlayableRepresentations():this.representations).map((function(e){return e.toVideoRepresentation()})),label:this.label};return!0===this.isSignInterpreted&&(n.signInterpreted=!0),!0===this.isTrickModeTrack&&(n.isTrickModeTrack=!0),void 0!==t&&(n.trickModeTracks=t),n},e}(),hn=function(){function e(e,t,n){if(this.id=e.id,this.adaptations=Object.keys(e.adaptations).reduce((function(r,i){var a=e.adaptations[i];if(null==a)return r;var o=a.map((function(e){var r=new pn(e,{representationFilter:n});return r.representations.length>0&&!r.isSupported&&t.push(r),r})).filter((function(e){return e.representations.length>0}));if(o.every((function(e){return!e.isSupported}))&&a.length>0&&("video"===i||"audio"===i))throw new ve("MANIFEST_INCOMPATIBLE_CODECS_ERROR","No supported "+i+" adaptations",{adaptations:void 0});return o.length>0&&(r[i]=o),r}),{}),!Array.isArray(this.adaptations.video)&&!Array.isArray(this.adaptations.audio))throw new ve("MANIFEST_PARSE_ERROR","No supported audio and video tracks.");this.duration=e.duration,this.start=e.start,null!=this.duration&&null!=this.start&&(this.end=this.start+this.duration),this.streamEvents=void 0===e.streamEvents?[]:e.streamEvents}var t=e.prototype;return t.getAdaptations=function(){var e=this.adaptations;return Gt(e).reduce((function(e,t){return null!=t?e.concat(t):e}),[])},t.getAdaptationsForType=function(e){var t=this.adaptations[e];return null==t?[]:t},t.getAdaptation=function(e){return be(this.getAdaptations(),(function(t){var n=t.id;return e===n}))},t.getSupportedAdaptations=function(e){if(void 0===e)return this.getAdaptations().filter((function(e){return e.isSupported}));var t=this.adaptations[e];return void 0===t?[]:t.filter((function(e){return e.isSupported}))},t.containsTime=function(e){return e>=this.start&&(void 0===this.end||e<this.end)},e}();function mn(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return gn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return gn(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function gn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function yn(e,t,n){var r={updatedAdaptations:[],removedAdaptations:[],addedAdaptations:[]};e.start=t.start,e.end=t.end,e.duration=t.duration,e.streamEvents=t.streamEvents;for(var i=e.getAdaptations(),a=t.getAdaptations(),o=function(e){var t=i[e],o=g(a,(function(e){return e.id===t.id}));if(-1===o){ne.warn('Manifest: Adaptation "'+i[e].id+'" not found when merging.');var u=i.splice(e,1)[0];e--,r.removedAdaptations.push(u)}else{var l=a.splice(o,1)[0],d=[],c=[],f=[];r.updatedAdaptations.push({adaptation:t,updatedRepresentations:d,addedRepresentations:c,removedRepresentations:f});for(var v,p=t.representations,h=l.representations.slice(),m=function(e){var t=p[e],r=g(h,(function(e){return e.id===t.id}));if(-1===r){ne.warn('Manifest: Representation "'+p[e].id+'" not found when merging.');var i=p.splice(e,1)[0];e--,f.push(i)}else{var a=h.splice(r,1)[0];d.push(t),t.cdnMetadata=a.cdnMetadata,n===ln.Full?t.index._replace(a.index):t.index._update(a.index)}y=e},y=0;y<p.length;y++)m(y);if(h.length>0)ne.warn("Manifest: "+h.length+" new Representations found when merging."),(v=t.representations).push.apply(v,h),c.push.apply(c,h)}s=e},s=0;s<i.length;s++)o(s);if(a.length>0){ne.warn("Manifest: "+a.length+" new Adaptations found when merging.");for(var u,l=mn(a);!(u=l()).done;){var d=u.value,c=e.adaptations[d.type];void 0===c?e.adaptations[d.type]=[d]:c.push(d),r.addedAdaptations.push(d)}}return r}function _n(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return bn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return bn(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function bn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}!function(e){e[e.Full=0]="Full",e[e.Partial=1]="Partial"}(ln||(ln={}));var Sn=Ae(),En=function(e){function t(t,n,r){var i,a;i=e.call(this)||this;var o=n.representationFilter,s=n.manifestUpdateUrl;i.id=Sn(),i.expired=null!==(a=t.expired)&&void 0!==a?a:null,i.transport=t.transportType,i.clockOffset=t.clockOffset;var u=[];if(i.periods=t.periods.map((function(e){return new hn(e,u,o)})).sort((function(e,t){return e.start-t.start})),u.length>0){var l=new ve("MANIFEST_INCOMPATIBLE_CODECS_ERROR","An Adaptation contains only incompatible codecs.",{adaptations:u});r.push(l)}return i.adaptations=void 0===i.periods[0]?{}:i.periods[0].adaptations,i._timeBounds=t.timeBounds,i.isDynamic=t.isDynamic,i.isLive=t.isLive,i.isLastPeriodKnown=t.isLastPeriodKnown,i.uris=void 0===t.uris?[]:t.uris,i.updateUrl=s,i.lifetime=t.lifetime,i.suggestedPresentationDelay=t.suggestedPresentationDelay,i.availabilityStartTime=t.availabilityStartTime,i.publishTime=t.publishTime,i}s(t,e);var n=t.prototype;return n.getPeriod=function(e){return be(this.periods,(function(t){return e===t.id}))},n.getPeriodForTime=function(e){return be(this.periods,(function(t){return e>=t.start&&(void 0===t.end||t.end>e)}))},n.getNextPeriod=function(e){return be(this.periods,(function(t){return t.start>e}))},n.getPeriodAfter=function(e){var t=e.end;if(void 0===t)return null;var n=be(this.periods,(function(e){return void 0===e.end||t<e.end}));return void 0===n?null:n},n.getUrls=function(){return this.uris},n.replace=function(e){this._performUpdate(e,ln.Full)},n.update=function(e){this._performUpdate(e,ln.Partial)},n.getMinimumSafePosition=function(){var e,t,n=this._timeBounds;if(null===n.timeshiftDepth)return null!==(e=n.minimumSafePosition)&&void 0!==e?e:0;var r,i=n.maximumTimeData;if(n.maximumTimeData.isLinear){var a=at()-i.time;r=i.maximumSafePosition+a/1e3}else r=i.maximumSafePosition;var o=r-n.timeshiftDepth;return Math.max(null!==(t=n.minimumSafePosition)&&void 0!==t?t:0,o)},n.getLivePosition=function(){var e=this._timeBounds.maximumTimeData;if(this.isLive&&void 0!==e.livePosition){if(!e.isLinear)return e.livePosition;var t=at()-e.time;return e.livePosition+t/1e3}},n.getMaximumSafePosition=function(){var e=this._timeBounds.maximumTimeData;if(!e.isLinear)return e.maximumSafePosition;var t=at()-e.time;return e.maximumSafePosition+t/1e3},n.updateRepresentationsDeciperability=function(e){var t=function(e,t){for(var n,r=[],i=_n(e.periods);!(n=i()).done;)for(var a,o=n.value,s=_n(o.getAdaptations());!(a=s()).done;)for(var u,l=a.value,d=_n(l.representations);!(u=d()).done;){var c=u.value,f=t(c);f!==c.decipherable&&(r.push({manifest:e,period:o,adaptation:l,representation:c}),c.decipherable=f,ne.debug('Decipherability changed for "'+c.id+'"',"("+c.bitrate+")",String(c.decipherable)))}return r}(this,e);t.length>0&&this.trigger("decipherabilityUpdate",t)},n.getAdaptations=function(){Xt("manifest.getAdaptations() is deprecated. Please use manifest.period[].getAdaptations() instead");var e=this.periods[0];if(void 0===e)return[];var t=e.adaptations,n=[];for(var r in t)if(t.hasOwnProperty(r)){var i=t[r];n.push.apply(n,i)}return n},n.getAdaptationsForType=function(e){Xt("manifest.getAdaptationsForType(type) is deprecated. Please use manifest.period[].getAdaptationsForType(type) instead");var t=this.periods[0];if(void 0===t)return[];var n=t.adaptations[e];return void 0===n?[]:n},n.getAdaptation=function(e){return Xt("manifest.getAdaptation(id) is deprecated. Please use manifest.period[].getAdaptation(id) instead"),be(this.getAdaptations(),(function(t){var n=t.id;return e===n}))},n._performUpdate=function(e,t){var n;if(this.availabilityStartTime=e.availabilityStartTime,this.expired=e.expired,this.isDynamic=e.isDynamic,this.isLive=e.isLive,this.isLastPeriodKnown=e.isLastPeriodKnown,this.lifetime=e.lifetime,this.suggestedPresentationDelay=e.suggestedPresentationDelay,this.transport=e.transport,this.publishTime=e.publishTime,t===ln.Full)this._timeBounds=e._timeBounds,this.uris=e.uris,n=function(e,t){for(var n={updatedPeriods:[],addedPeriods:[],removedPeriods:[]},r=0,i=0;i<t.length;i++){for(var a=t[i],o=r,s=e[o];null!=s&&s.id!==a.id;)s=e[++o];if(null!=s){var u,l,d=yn(s,a,ln.Full);n.updatedPeriods.push({period:s,result:d});var c=t.slice(r,i),f=o-r,v=e.splice.apply(e,[r,f].concat(c));(u=n.removedPeriods).push.apply(u,v),(l=n.addedPeriods).push.apply(l,c),r=i+1}}if(r>e.length)return ne.error("Manifest: error when updating Periods"),n;if(r<e.length){var p,h=e.splice(r,e.length-r);(p=n.removedPeriods).push.apply(p,h)}var m,g=t.slice(r,t.length);return g.length>0&&(e.push.apply(e,g),(m=n.addedPeriods).push.apply(m,g)),n}(this.periods,e.periods);else{this._timeBounds.maximumTimeData=e._timeBounds.maximumTimeData,this.updateUrl=e.uris[0],n=function(e,t){var n,r={updatedPeriods:[],addedPeriods:[],removedPeriods:[]};if(0===e.length)return e.splice.apply(e,[0,0].concat(t)),(n=r.addedPeriods).push.apply(n,t),r;if(0===t.length)return r;var i=e[e.length-1];if(i.start<t[0].start){var a;if(i.end!==t[0].start)throw new ve("MANIFEST_UPDATE_ERROR","Cannot perform partial update: not enough data");return e.push.apply(e,t),(a=r.addedPeriods).push.apply(a,t),r}var o=g(e,(function(e){return e.id===t[0].id}));if(o<0)throw new ve("MANIFEST_UPDATE_ERROR","Cannot perform partial update: incoherent data");var s=yn(e[o],t[0],ln.Partial);r.updatedPeriods.push({period:e[o],result:s});for(var u=o+1,l=1;l<t.length;l++){for(var d=t[l],c=-1,f=u;f<e.length;f++)if(d.id===e[f].id){c=f;break}if(c<0){for(var v,p=-1,h=u;h<e.length;h++)if(d.start<e[h].start){p=h;break}var m=p-u,y=e.splice(u,m,d);r.addedPeriods.push(d),(v=r.removedPeriods).push.apply(v,y)}else{if(c>u){var _;ne.warn("Manifest: old Periods not found in new when updating, removing");var b=e.splice(u,c-u);(_=r.removedPeriods).push.apply(_,b),c=u}var S=yn(e[c],d,ln.Full);r.updatedPeriods.push({period:e[c],result:S})}u++}if(u<e.length){var E;ne.warn("Manifest: Ending Periods not found in new when updating, removing");var T=e.splice(u,e.length-u);(E=r.removedPeriods).push.apply(E,T)}return r}(this.periods,e.periods);for(var r=this.getMinimumSafePosition();this.periods.length>0;){var i=this.periods[0];if(void 0===i.end||i.end>r)break;this.periods.shift()}}this.adaptations=void 0===this.periods[0]?{}:this.periods[0].adaptations,this.trigger("manifestUpdate",n)},t}(we);var Tn=En,kn=function(e){function t(n,r,i){var a;switch(a=e.call(this)||this,Object.setPrototypeOf(ie(a),t.prototype),a.name="RequestError",a.url=n,a.status=r,a.type=i,i){case"TIMEOUT":a.message="The request timed out";break;case"ERROR_EVENT":a.message="An error prevented the request to be performed successfully";break;case"PARSE_ERROR":a.message="An error happened while formatting the response data";break;case"ERROR_HTTP_CODE":a.message="An HTTP status code indicating failure was received: "+String(a.status)}return a}return s(t,e),t}(se(Error));function wn(e){return e instanceof kn?new pe("PIPELINE_LOAD_ERROR",e):ge(e,{defaultCode:"PIPELINE_LOAD_ERROR",defaultReason:"Unknown error when fetching the Manifest"})}var An=function(e){function t(n,r,i){var a;return a=e.call(this)||this,Object.setPrototypeOf(ie(a),t.prototype),a.name="CustomLoaderError",a.message=n,a.canRetry=r,a.xhr=i,a}return s(t,e),t}(se(Error));function In(e,t){return xt(t,(function(t){var n=setTimeout((function(){return t()}),e);return function(){return clearTimeout(n)}}))}var Rn=.3;function xn(e){return e*((2*Math.random()-1)*Rn+1)}function Mn(e,t,n,r,i){return Cn.apply(this,arguments)}function Cn(){return Cn=qe(Qe().mark((function e(t,n,r,i,a){var o,s,u,l,d,c,f,v,p,h,g,y,_;return Qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(_=function(e){var t;if(0===d.size)return e[0];var n=at();return null===(t=e.filter((function(e){var t;return!0!==(null===(t=d.get(e))||void 0===t?void 0:t.isBlacklisted)})).reduce((function(e,t){var r,i=null===(r=d.get(t))||void 0===r?void 0:r.blockedUntil;return void 0!==i&&i<=n&&(i=void 0),void 0===e?[t,i]:void 0===i?void 0===e[1]?e:[t,void 0]:void 0===e[1]?e:i<e[1]?[t,i]:e}),void 0))||void 0===t?void 0:t[0]},y=function(e,t){var r=d.get(e);if(void 0===r||void 0===r.blockedUntil)return v(e);var i=at(),o=r.blockedUntil-i;if(o<=0)return v(e);var s=new Ge,u=s.linkToSignal(a);return new Promise((function(r,i){function l(e){u(),r(e)}function d(e){u(),i(e)}null==n||n.addEventListener("priorityChange",(function(){var n=f();if(a.isCancelled())throw a.cancellationError;if(void 0===n)return d(t);n!==e&&(s.cancel(),y(n,t).then(l,d))}),s.signal),In(o,s.signal).then((function(){return v(e).then(l,d)}),m)}))},g=function(){return(g=qe(Qe().mark((function e(t){var n;return Qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=f(),!a.isCancelled()){e.next=3;break}throw a.cancellationError;case 3:if(void 0!==n){e.next=5;break}throw t;case 5:if(l(t),!a.isCancelled()){e.next=8;break}throw a.cancellationError;case 8:return e.abrupt("return",y(n,t));case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)},h=function(e){return g.apply(this,arguments)},p=function(){return(p=qe(Qe().mark((function e(t){var i,l,c,f,v;return Qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,r(t,a);case 3:return i=e.sent,e.abrupt("return",i);case 7:if(e.prev=7,e.t0=e.catch(0),!Ge.isCancellationError(e.t0)){e.next=11;break}throw e.t0;case 11:if(null!==t&&null!==n&&n.downgradeCdn(t),void 0===(l=d.get(t))?(l={errorCounter:1,blockedUntil:void 0,isBlacklisted:!1},d.set(t,l)):l.errorCounter++,(p=e.t0)instanceof kn?p.type===le.ERROR_HTTP_CODE?p.status>=500||404===p.status||415===p.status||412===p.status:p.type===le.TIMEOUT||p.type===le.ERROR_EVENT:p instanceof An?"boolean"==typeof p.canRetry?p.canRetry:void 0!==p.xhr&&(p.xhr.status>=500||404===p.xhr.status||415===p.xhr.status||412===p.xhr.status):me(p)&&"INTEGRITY_ERROR"===p.code){e.next=18;break}return l.blockedUntil=void 0,l.isBlacklisted=!0,e.abrupt("return",h(e.t0));case 18:return l.errorCounter>u?(l.blockedUntil=void 0,l.isBlacklisted=!0):(c=l.errorCounter,f=Math.min(o*Math.pow(2,c-1),s),v=xn(f),l.blockedUntil=at()+v),e.abrupt("return",h(e.t0));case 20:case"end":return e.stop()}var p}),e,null,[[0,7]])})))).apply(this,arguments)},v=function(e){return p.apply(this,arguments)},f=function(){if(null===t){var e=d.get(null);if(void 0!==e&&e.isBlacklisted)return;return null}if(null===n)return _(t);var r=n.getCdnPreferenceForResource(t);return _(r)},null===a.cancellationError){e.next=9;break}return e.abrupt("return",Promise.reject(a.cancellationError));case 9:if(o=i.baseDelay,s=i.maxDelay,u=i.maxRetry,l=i.onRetry,null!==t&&0===t.length&&ne.warn("Fetchers: no CDN given to `scheduleRequestWithCdns`."),d=new Map,void 0!==(c=f())){e.next=15;break}throw new Error("No CDN to request");case 15:return e.abrupt("return",v(c));case 16:case"end":return e.stop()}}),e)}))),Cn.apply(this,arguments)}function Pn(e,t,n){return Mn(null,null,e,t,n)}function Dn(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Nn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Nn(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Nn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var On=function(e){function t(t,n,r){var i;return(i=e.call(this)||this).scheduleManualRefresh=m,i._manifestUrls=t,i._pipelines=n.manifest,i._settings=r,i._canceller=new Ge,i._isStarted=!1,i._isRefreshPending=!1,i._consecutiveUnsafeMode=0,i._prioritizedContentUrl=null,i}s(t,e);var n=t.prototype;return n.dispose=function(){this._canceller.cancel(),this.removeEventListener()},n.start=function(){var e=this;if(!this._isStarted){this._isStarted=!0;var t=this._settings.initialManifest;(t instanceof Tn?Promise.resolve({manifest:t}):void 0!==t?this.parse(t,{previousManifest:null,unsafeMode:!1},void 0):this._fetchManifest(void 0).then((function(e){return e.parse({previousManifest:null,unsafeMode:!1})}))).then((function(t){e.trigger("manifestReady",t.manifest),e._canceller.isUsed()||e._recursivelyRefreshManifest(t.manifest,t)})).catch((function(t){return e._onFatalError(t)}))}},n.updateContentUrls=function(e,t){var n;this._prioritizedContentUrl=null!==(n=null==e?void 0:e[0])&&void 0!==n?n:void 0,t&&this.scheduleManualRefresh({enablePartialRefresh:!1,delay:0,canUseUnsafeMode:!1})},n._fetchManifest=function(){var e=qe(Qe().mark((function e(t){var n,r,i,a,o,s,u,l,d=this;return Qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return l=function(e){var t=a.loadManifest,n=h(i.requestTimeout)?v.getCurrent().DEFAULT_REQUEST_TIMEOUT:i.requestTimeout;n<0&&(n=void 0);return Pn((function(){return t(e,{timeout:n},r)}),s,r)},r=this._canceller.signal,i=this._settings,a=this._pipelines,o=null!=t?t:null===(n=this._manifestUrls)||void 0===n?void 0:n[0],s=this._getBackoffSetting((function(e){d.trigger("warning",wn(e))})),e.prev=6,e.next=9,l(o);case 9:return u=e.sent,e.abrupt("return",{parse:function(e){return d._parseLoadedManifest(u,e,o)}});case 13:throw e.prev=13,e.t0=e.catch(6),wn(e.t0);case 16:case"end":return e.stop()}}),e,this,[[6,13]])})));return function(t){return e.apply(this,arguments)}}(),n.parse=function(e,t,n){return this._parseLoadedManifest({responseData:e,size:void 0,requestDuration:void 0},t,n)},n._parseLoadedManifest=function(){var e=qe(Qe().mark((function e(t,n,r){var i,a,o,s,u,l,d,c,f,v,p,h,m,g,y,_,b,S=this;return Qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(b=function(e,t){_(t);var n=at()-a;return ne.info("MF: Manifest parsed in "+n+"ms"),{manifest:e,sendingTime:u,receivedTime:l,parsingTime:n}},_=function(e){for(var t,n=Dn(e);!(t=n()).done;){var r=t.value;if(o.isCancelled())return;var i=ge(r,{defaultCode:"PIPELINE_PARSE_ERROR",defaultReason:"Unknown error when parsing the Manifest"});s("warning",i)}},y=function(){return(y=qe(Qe().mark((function e(t){var n;return Qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,Pn(t,d,o);case 3:return n=e.sent,e.abrupt("return",n);case 7:throw e.prev=7,e.t0=e.catch(0),wn(e.t0);case 10:case"end":return e.stop()}}),e,null,[[0,7]])})))).apply(this,arguments)},g=function(e){return y.apply(this,arguments)},a=at(),o=this._canceller.signal,s=this.trigger.bind(this),u=t.sendingTime,l=t.receivedTime,d=this._getBackoffSetting((function(e){S.trigger("warning",wn(e))})),c=null!=r?r:null===(i=this._manifestUrls)||void 0===i?void 0:i[0],f={externalClockOffset:n.externalClockOffset,unsafeMode:n.unsafeMode,previousManifest:n.previousManifest,originalUrl:c},e.prev=11,v=this._pipelines.parseManifest(t,f,_,o,g),v instanceof Promise){e.next=17;break}return e.abrupt("return",b(v.manifest,v.warnings));case 17:return e.next=19,v;case 19:return p=e.sent,h=p.manifest,m=p.warnings,e.abrupt("return",b(h,m));case 23:e.next=29;break;case 25:throw e.prev=25,e.t0=e.catch(11),ge(e.t0,{defaultCode:"PIPELINE_PARSE_ERROR",defaultReason:"Unknown error when parsing the Manifest"});case 29:case"end":return e.stop()}}),e,this,[[11,25]])})));return function(t,n,r){return e.apply(this,arguments)}}(),n._getBackoffSetting=function(e){var t=v.getCurrent(),n=t.DEFAULT_MAX_MANIFEST_REQUEST_RETRY,r=t.INITIAL_BACKOFF_DELAY_BASE,i=t.MAX_BACKOFF_DELAY_BASE,a=this._settings,o=a.lowLatencyMode,s=a.maxRetry;return{onRetry:e,baseDelay:o?r.LOW_LATENCY:r.REGULAR,maxDelay:o?i.LOW_LATENCY:i.REGULAR,maxRetry:null!=s?s:n}},n._recursivelyRefreshManifest=function(e,t){var n=this,r=t.sendingTime,i=t.parsingTime,a=t.updatingTime,o=v.getCurrent(),s=o.MAX_CONSECUTIVE_MANIFEST_PARSING_IN_UNSAFE_MODE,u=o.MIN_MANIFEST_PARSING_TIME_TO_ENTER_UNSAFE_MODE,l=void 0!==i?i+(null!=a?a:0):void 0,d=this._consecutiveUnsafeMode>0?this._consecutiveUnsafeMode<s:void 0!==l&&l>=u,c=void 0===r?0:at()-r,f=Math.max(this._settings.minimumManifestUpdateInterval-c,0),p=new Ge;if(p.linkToSignal(this._canceller.signal),this.scheduleManualRefresh=function(t){var i=t.enablePartialRefresh,a=t.delay,o=t.canUseUnsafeMode&&d,s=void 0===r?0:at()-r,u=Math.max(n._settings.minimumManifestUpdateInterval-s,0),l=setTimeout((function(){p.cancel(),n._triggerNextManifestRefresh(e,{enablePartialRefresh:i,unsafeMode:o})}),Math.max((null!=a?a:0)-s,u));p.signal.register((function(){clearTimeout(l)}))},null!==e.expired){var h=setTimeout((function(){var t;null===(t=e.expired)||void 0===t||t.then((function(){p.cancel(),n._triggerNextManifestRefresh(e,{enablePartialRefresh:!1,unsafeMode:d})}),m)}),f);p.signal.register((function(){clearTimeout(h)}))}if(void 0!==e.lifetime&&e.lifetime>=0){var g,y=1e3*e.lifetime-c;void 0===l?g=y:e.lifetime<3&&l>=100?(g=Math.min(Math.max(3e3-c,Math.max(y,0)+l),6*y),ne.info("MUS: Manifest update rythm is too frequent. Postponing next request.",y,g)):l>=1e3*e.lifetime/10?(g=Math.min(Math.max(y,0)+l,6*y),ne.info("MUS: Manifest took too long to parse. Postponing next request",g,g)):g=y;var _=setTimeout((function(){p.cancel(),n._triggerNextManifestRefresh(e,{enablePartialRefresh:!1,unsafeMode:d})}),Math.max(g,f));p.signal.register((function(){clearTimeout(_)}))}},n._triggerNextManifestRefresh=function(e,t){var n,r,i=this,a=t.enablePartialRefresh,o=t.unsafeMode,s=e.updateUrl;null!==this._prioritizedContentUrl?(n=!0,r=this._prioritizedContentUrl,this._prioritizedContentUrl=null):r=(n=!a||void 0===s)?e.getUrls()[0]:s;var u=e.clockOffset;o?(this._consecutiveUnsafeMode+=1,ne.info('Init: Refreshing the Manifest in "unsafeMode" for the '+String(this._consecutiveUnsafeMode)+" consecutive time.")):this._consecutiveUnsafeMode>0&&(ne.info('Init: Not parsing the Manifest in "unsafeMode" anymore after '+String(this._consecutiveUnsafeMode)+" consecutive times."),this._consecutiveUnsafeMode=0),this._isRefreshPending||(this._isRefreshPending=!0,this._fetchManifest(r).then((function(t){return t.parse({externalClockOffset:u,previousManifest:e,unsafeMode:o})})).then((function(t){i._isRefreshPending=!1;var r=t.manifest,a=t.sendingTime,o=t.parsingTime,s=at();if(n)e.replace(r);else try{e.update(r)}catch(t){var u=t instanceof Error?t.message:"unknown error";ne.warn("MUS: Attempt to update Manifest failed: "+u,"Re-downloading the Manifest fully");var l=v.getCurrent().FAILED_PARTIAL_UPDATE_MANIFEST_REFRESH_DELAY,d=void 0===a?0:at()-a,c=Math.max(i._settings.minimumManifestUpdateInterval-d,0),f=m,p=setTimeout((function(){f(),i._triggerNextManifestRefresh(e,{enablePartialRefresh:!1,unsafeMode:!1})}),Math.max(l-d,c));return void(f=i._canceller.signal.register((function(){clearTimeout(p)})))}var h=at()-s;i._recursivelyRefreshManifest(e,{sendingTime:a,parsingTime:o,updatingTime:h})})).catch((function(e){i._isRefreshPending=!1,i._onFatalError(e)})))},n._onFatalError=function(e){this._canceller.isUsed()||(this.trigger("error",e),this.dispose())},t}(we);var Ln=On;function Un(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Bn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Bn(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Bn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Fn=function(e){function t(t){var n;return(n=e.call(this)||this)._downgradedCdnList={metadata:[],timeouts:[]},t.register((function(){for(var e,t=Un(n._downgradedCdnList.timeouts);!(e=t()).done;){var r=e.value;clearTimeout(r)}n._downgradedCdnList={metadata:[],timeouts:[]}})),n}s(t,e);var n=t.prototype;return n.getCdnPreferenceForResource=function(e){return e.length<=1?e:this._innerGetCdnPreferenceForResource(e)},n.downgradeCdn=function(e){var t=this,n=zn(this._downgradedCdnList.metadata,e);n>=0&&this._removeIndexFromDowngradeList(n);var r=v.getCurrent().DEFAULT_CDN_DOWNGRADE_TIME;this._downgradedCdnList.metadata.push(e);var i=setTimeout((function(){var n=zn(t._downgradedCdnList.metadata,e);n>=0&&t._removeIndexFromDowngradeList(n),t.trigger("priorityChange",null)}),r);this._downgradedCdnList.timeouts.push(i),this.trigger("priorityChange",null)},n._innerGetCdnPreferenceForResource=function(e){var t=this,n=e.reduce((function(e,n){return t._downgradedCdnList.metadata.some((function(e){return e.id===n.id&&e.baseUrl===n.baseUrl}))?e[1].push(n):e[0].push(n),e}),[[],[]]),r=n[0],i=n[1];return r.concat(i)},n._removeIndexFromDowngradeList=function(e){this._downgradedCdnList.metadata.splice(e,1);var t=this._downgradedCdnList.timeouts.splice(e,1);clearTimeout(t[0])},t}(we);function zn(e,t){return 0===e.length?-1:void 0!==t.id?g(e,(function(e){return e.id===t.id})):g(e,(function(e){return e.baseUrl===t.baseUrl}))}function Vn(e,t){return e.segment.id===t.segment.id&&e.representation.uniqueId===t.representation.uniqueId}function Kn(e){if(h(e))return"";var t=e.period,n=e.adaptation,r=e.representation,i=e.segment;return n.type+" P: "+t.id+" A: "+n.id+" R: "+r.id+" S: "+(i.isInit?"init":i.complete?i.time+"-"+i.duration:""+i.time)}var Gn=function(){function e(){this._cache=new WeakMap}var t=e.prototype;return t.add=function(e,t){var n=e.representation;e.segment.isInit&&this._cache.set(n,t)},t.get=function(e){var t=e.representation;if(e.segment.isInit){var n=this._cache.get(t);if(void 0!==n)return n}return null},e}(),Wn=Ae();var jn=function(){function e(e){var t=e.prioritySteps;if(this._minPendingPriority=null,this._waitingQueue=[],this._pendingTasks=[],this._prioritySteps=t,this._prioritySteps.high>=this._prioritySteps.low)throw new Error("TP: the max high level priority should be given a lowerpriority number than the min low priority.")}var t=e.prototype;return t.create=function(e,t,n,r){var i,a=this;return xt(r,(function(o,s){return i={hasEnded:!1,priority:t,trigger:function(){if(!i.hasEnded){var e=function(){u(),a._endTask(i)},t=new Ge,u=t.linkToSignal(r);i.interrupter=t,t.signal.register((function(){i.interrupter=null,r.isCancelled()||n.beforeInterrupted()})),a._minPendingPriority=null===a._minPendingPriority?i.priority:Math.min(a._minPendingPriority,i.priority),a._pendingTasks.push(i),i.taskFn(t.signal).then((function(t){n.beforeEnded(),e(),o(t)})).catch((function(n){!r.isCancelled()&&t.isUsed()&&n instanceof je||function(t){e(),s(t)}(n)}))}},taskFn:e,interrupter:null},a._canBeStartedNow(i)?(i.trigger(),a._isRunningHighPriorityTasks()&&a._interruptCancellableTasks()):a._waitingQueue.push(i),function(){return a._endTask(i)}}))},t._endTask=function(e){e.hasEnded=!0;var t=Hn(e.taskFn,this._waitingQueue);if(t>=0)this._waitingQueue.splice(t,1);else{var n=Hn(e.taskFn,this._pendingTasks);if(n<0)return;this._pendingTasks.splice(n,1),this._pendingTasks.length>0?this._minPendingPriority===e.priority&&(this._minPendingPriority=Math.min.apply(Math,this._pendingTasks.map((function(e){return e.priority})))):this._minPendingPriority=null,this._loopThroughWaitingQueue()}},t.updatePriority=function(e,t){var n=Hn(e,this._waitingQueue);if(n>=0){var r=this._waitingQueue[n];if(r.priority===t)return;if(r.priority=t,!this._canBeStartedNow(r))return;return this._findAndRunWaitingQueueTask(n),void(this._isRunningHighPriorityTasks()&&this._interruptCancellableTasks())}var i=Hn(e,this._pendingTasks);if(i<0)ne.warn("TP: request to update the priority of a non-existent task");else{var a=this._pendingTasks[i];if(a.priority!==t){var o=a.priority;a.priority=t,null===this._minPendingPriority||t<this._minPendingPriority?this._minPendingPriority=t:this._minPendingPriority===o&&(1===this._pendingTasks.length?this._minPendingPriority=t:this._minPendingPriority=Math.min.apply(Math,this._pendingTasks.map((function(e){return e.priority}))),this._loopThroughWaitingQueue()),this._isRunningHighPriorityTasks()&&this._interruptCancellableTasks()}}},t._loopThroughWaitingQueue=function(){var e=this._waitingQueue.reduce((function(e,t){return null===e||e>t.priority?t.priority:e}),null);if(!(null===e||null!==this._minPendingPriority&&this._minPendingPriority<e))for(var t=0;t<this._waitingQueue.length;t++){var n=null===this._minPendingPriority?e:Math.min(this._minPendingPriority,e);this._waitingQueue[t].priority<=n&&(this._findAndRunWaitingQueueTask(t),t--)}},t._interruptCancellableTasks=function(){for(var e=0;e<this._pendingTasks.length;e++){var t=this._pendingTasks[e];if(t.priority>=this._prioritySteps.low)return this._interruptPendingTask(t),this._interruptCancellableTasks()}},t._findAndRunWaitingQueueTask=function(e){return e>=this._waitingQueue.length||e<0?(ne.warn("TP : Tried to start a non existing task"),!1):(this._waitingQueue.splice(e,1)[0].trigger(),!0)},t._interruptPendingTask=function(e){var t,n=Hn(e.taskFn,this._pendingTasks);n<0?ne.warn("TP: Interrupting a non-existent pending task. Aborting..."):(this._pendingTasks.splice(n,1),this._waitingQueue.push(e),0===this._pendingTasks.length?this._minPendingPriority=null:this._minPendingPriority===e.priority&&(this._minPendingPriority=Math.min.apply(Math,this._pendingTasks.map((function(e){return e.priority})))),null===(t=e.interrupter)||void 0===t||t.cancel())},t._canBeStartedNow=function(e){return null===this._minPendingPriority||e.priority<=this._minPendingPriority},t._isRunningHighPriorityTasks=function(){return null!==this._minPendingPriority&&this._minPendingPriority<=this._prioritySteps.high},e}();function Hn(e,t){return g(t,(function(t){return t.taskFn===e}))}var qn=function(){function e(e,t,n){var r=new Fn(n),i=v.getCurrent(),a=i.MIN_CANCELABLE_PRIORITY,o=i.MAX_HIGH_PRIORITY_LEVEL;this._transport=e,this._prioritizer=new jn({prioritySteps:{high:o,low:a}}),this._cdnPrioritizer=r,this._backoffOptions=t}return e.prototype.createSegmentFetcher=function(e,t){var n,r,i,a,o,s,u,d,c,f,p,m,g=(n=this._backoffOptions,r=n.maxRetry,i=n.lowLatencyMode,a=n.requestTimeout,o=v.getCurrent(),s=o.DEFAULT_MAX_REQUESTS_RETRY_ON_ERROR,u=o.DEFAULT_REQUEST_TIMEOUT,d=o.INITIAL_BACKOFF_DELAY_BASE,c=o.MAX_BACKOFF_DELAY_BASE,{maxRetry:null!=r?r:s,baseDelay:i?d.LOW_LATENCY:d.REGULAR,maxDelay:i?c.LOW_LATENCY:c.REGULAR,requestTimeout:h(a)?u:a}),y=function(e,t,n,r,i){var a={timeout:i.requestTimeout<0?void 0:i.requestTimeout},o=Se(["audio","video"],e)?new Gn:void 0,s=t.loadSegment,u=t.parseSegment;return function(){var e=qe(Qe().mark((function e(t,d,c){var f,v,p,m,g,y,_,b,S,E,T,k,w,A,I,R,x,M,C,P,D,N,O,L;return Qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(L=function(){var e;A||!h(T)&&void 0!==T.size&&void 0!==T.requestDuration&&k.length>0&&k.every((function(e){return e}))&&(A=!0,null===(e=r.onMetrics)||void 0===e||e.call(r,{size:T.size,requestDuration:T.requestDuration,content:t,segmentDuration:w}))},O=function(e){d.onRetry(wn(e))},N=function(e,t){k.push(!1);var n=k.length-1;return function(r){var i={data:e,isChunked:t};try{var a=u(i,I,r);return k[n]||(w=void 0!==w&&"media"===a.segmentType&&null!==a.chunkInfos&&void 0!==a.chunkInfos.duration?w+a.chunkInfos.duration:void 0,k[n]=!0,L()),a}catch(e){throw ge(e,{defaultCode:"PIPELINE_PARSE_ERROR",defaultReason:"Unknown parsing error"})}}},D=function(e){return s(e,I,a,c,R)},P=function(){var e;void 0===T&&(ne.debug("SF: Segment request cancelled",S),T=null,null===(e=r.onRequestEnd)||void 0===e||e.call(r,{id:E}))},m=t.segment,g=t.adaptation,y=t.representation,_=t.manifest,b=t.period,S=Kn(t),E=Wn(),k=[],w=0,A=!1,I={segment:m,type:g.type,language:g.language,isLive:_.isLive,periodStart:b.start,periodEnd:b.end,mimeType:y.mimeType,codecs:y.codec,manifestPublishTime:_.publishTime},R={onProgress:function(e){var t;void 0===T&&void 0!==e.totalSize&&e.size<e.totalSize&&(null===(t=r.onProgress)||void 0===t||t.call(r,{duration:e.duration,size:e.size,totalSize:e.totalSize,timestamp:at(),id:E}))},onNewChunk:function(e){d.onChunk(N(e,!0))}},null===(x=void 0!==o?o.get(t):null)){e.next=18;break}return ne.debug("SF: Found wanted segment in cache",S),d.onChunk(N(x,!1)),e.abrupt("return",Promise.resolve());case 18:return ne.debug("SF: Beginning request",S),null===(f=r.onRequestBegin)||void 0===f||f.call(r,{requestTimestamp:at(),id:E,content:t}),c.register(P),e.prev=21,e.next=24,Mn(t.representation.cdnMetadata,n,D,l({onRetry:O},i),c);case 24:"segment-loaded"===(M=e.sent).resultType?(C=M.resultData.responseData,void 0!==o&&o.add(t,M.resultData.responseData),d.onChunk(N(C,!1))):"segment-created"===M.resultType&&d.onChunk(N(M.resultData,!1)),ne.debug("SF: Segment request ended with success",S),d.onAllChunksReceived(),"segment-created"!==M.resultType?(T=M.resultData,L()):T=null,c.isCancelled()||null===(v=r.onRequestEnd)||void 0===v||v.call(r,{id:E}),c.deregister(P),e.next=43;break;case 33:if(e.prev=33,e.t0=e.catch(21),c.deregister(P),T=null,!(e.t0 instanceof je)){e.next=40;break}throw ne.debug("SF: Segment request aborted",S),e.t0;case 40:throw ne.debug("SF: Segment request failed",S),null===(p=r.onRequestEnd)||void 0===p||p.call(r,{id:E}),wn(e.t0);case 43:case"end":return e.stop()}}),e,null,[[21,33]])})));return function(t,n,r){return e.apply(this,arguments)}}()}(e,this._transport[e],this._cdnPrioritizer,t,g);return f=this._prioritizer,p=y,m=new WeakMap,{createRequest:function(e,t,n,r){var i=function(t){return p(e,n,t)},a=f.create(i,t,n,r);return m.set(a,i),a},updatePriority:function(e,t){var n=m.get(e);void 0!==n?f.updatePriority(n,t):ne.warn("Fetchers: Cannot update the priority of a request: task not found.")}}},e}(),Yn=qn;function Qn(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return $n(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return $n(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function $n(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Xn=function(){function e(e,t){this._history=[],this._lifetime=e,this._maxHistoryLength=t}var t=e.prototype;return t.addBufferedSegment=function(e,t){var n=at();this._history.push({date:n,buffered:t,context:e}),this._cleanHistory(n)},t.getHistoryFor=function(e){return this._history.filter((function(t){return Vn(t.context,e)}))},t._cleanHistory=function(e){for(var t,n=e-this._lifetime,r=0,i=Qn(this._history);!(t=i()).done;){if(!(t.value.date<n))break;r++}if(r>0&&(this._history=this._history.splice(r)),this._history.length>this._maxHistoryLength){var a=this._history.length-this._maxHistoryLength;this._history=this._history.splice(a)}},e}();function Zn(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Jn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Jn(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Jn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var er=function(){function e(){var e=v.getCurrent(),t=e.BUFFERED_HISTORY_RETENTION_TIME,n=e.BUFFERED_HISTORY_MAXIMUM_ENTRIES;this._inventory=[],this._bufferedHistory=new Xn(t,n)}var t=e.prototype;return t.reset=function(){this._inventory.length=0},t.synchronizeBuffered=function(e){for(var t=this._inventory,n=0,r=t[0],i=v.getCurrent().MINIMUM_SEGMENT_SIZE,a=null==r?void 0:r.infos.adaptation.type,o=e.length,s=0;s<o;s++){if(void 0===r)return;var u=e.start(s),l=e.end(s);if(l-u<i)ne.warn("SI: skipped TimeRange when synchronizing because it was too small",a,u,l);else{for(var d=n;void 0!==r&&Vt(r.bufferedEnd,r.end)-u<i;)r=t[++n];var c=null,f=n-d;if(f>0){var p=t[d+f-1];c={end:Vt(p.bufferedEnd,p.end),precizeEnd:p.precizeEnd},ne.debug("SI: "+f+" segments GCed.",a);for(var h,m=Zn(t.splice(d,f));!(h=m()).done;){var g=h.value;void 0===g.bufferedStart&&void 0===g.bufferedEnd&&this._bufferedHistory.addBufferedSegment(g.infos,null)}n=d}if(void 0===r)return;if(l-Vt(r.bufferedStart,r.start)>=i){if(rr(r,u,c,a),n===t.length-1)return void ir(r,l,a);for(var y=Vt((r=t[++n]).bufferedStart,r.start),_=Vt(r.bufferedEnd,r.end),b=s<o-1?e.start(s+1):void 0;void 0!==r&&l-y>=i&&(void 0===b||l-y>=_-b);){var S=t[n-1];void 0===S.bufferedEnd&&(S.bufferedEnd=r.precizeStart?r.start:S.end,ne.debug("SI: calculating buffered end of contiguous segment",a,S.bufferedEnd,S.end)),r.bufferedStart=S.bufferedEnd,void 0!==(r=t[++n])&&(y=Vt(r.bufferedStart,r.start),_=Vt(r.bufferedEnd,r.end))}}var E=t[n-1];void 0!==E&&ir(E,l,a)}}if(null!=r){ne.debug("SI: last segments have been GCed",a,n,t.length);for(var T,k=Zn(t.splice(n,t.length-n));!(T=k()).done;){var w=T.value;void 0===w.bufferedStart&&void 0===w.bufferedEnd&&this._bufferedHistory.addBufferedSegment(w.infos,null)}}void 0!==a&&ne.hasLevel("DEBUG")&&ne.debug("SI: current "+a+" inventory timeline:\n"+function(e){var t=1/60,n={},r=[],i=null,a=null;function o(e){var t=String.fromCharCode(r.length+65);return r.push({letter:t,periodId:e.period.id,representationId:e.representation.id,bitrate:e.representation.bitrate}),t}for(var s="",u=0;u<e.length;u++){var l=e[u];if(void 0!==l.bufferedStart&&void 0!==l.bufferedEnd){var d,c=l.infos.period.id,f=l.infos.representation.id,v=n[c],p=void 0;if(void 0===v)p=o(l.infos),n[c]=((d={})[f]=p,d);else void 0===v[f]?(p=o(l.infos),v[f]=p):p=v[f];null===i?s+=l.bufferedStart.toFixed(2)+"|"+p+"|":a===p?i.bufferedEnd+t<l.bufferedStart&&(s+=i.bufferedEnd.toFixed(2)+" ~ "+l.bufferedStart.toFixed(2)+"|"+p+"|"):s+=i.bufferedEnd.toFixed(2)+" ~ "+l.bufferedStart.toFixed(2)+"|"+p+"|",i=l,a=p}}null!==i&&(s+=String(i.end.toFixed(2)));return r.forEach((function(e){var t;s+="\n["+e.letter+"] P: "+e.periodId+" || R: "+e.representationId+"("+(null!==(t=e.bitrate)&&void 0!==t?t:"unknown bitrate")+")"})),s}(this._inventory))},t.insertChunk=function(e){var t=e.period,n=e.adaptation,r=e.representation,i=e.segment,a=e.chunkSize,o=e.start,s=e.end;if(!i.isInit){var u=n.type;if(o>=s)ne.warn("SI: Invalid chunked inserted: starts before it ends",u,o,s);else{for(var l=this._inventory,d={partiallyPushed:!0,chunkSize:a,splitted:!1,start:o,end:s,precizeStart:!1,precizeEnd:!1,bufferedStart:void 0,bufferedEnd:void 0,infos:{segment:i,period:t,adaptation:n,representation:r}},c=l.length-1;c>=0;c--){var f=l[c];if(f.start<=o){if(f.end<=o){for(ne.debug("SI: Pushing segment strictly after previous one.",u,o,f.end),this._inventory.splice(c+1,0,d),c+=2;c<l.length&&l[c].start<d.end;){if(l[c].end>d.end)return ne.debug("SI: Segment pushed updates the start of the next one",u,d.end,l[c].start),l[c].start=d.end,l[c].bufferedStart=void 0,void(l[c].precizeStart=l[c].precizeStart&&d.precizeEnd);ne.debug("SI: Segment pushed removes the next one",u,o,s,l[c].start,l[c].end),l.splice(c,1)}return}if(f.start===o){if(f.end<=s){for(ne.debug("SI: Segment pushed replace another one",u,o,s,f.end),this._inventory.splice(c,1,d),c+=1;c<l.length&&l[c].start<d.end;){if(l[c].end>d.end)return ne.debug("SI: Segment pushed updates the start of the next one",u,d.end,l[c].start),l[c].start=d.end,l[c].bufferedStart=void 0,void(l[c].precizeStart=l[c].precizeStart&&d.precizeEnd);ne.debug("SI: Segment pushed removes the next one",u,o,s,l[c].start,l[c].end),l.splice(c,1)}return}return ne.debug("SI: Segment pushed ends before another with the same start",u,o,s,f.end),l.splice(c,0,d),f.start=d.end,f.bufferedStart=void 0,void(f.precizeStart=f.precizeStart&&d.precizeEnd)}if(f.end<=d.end){for(ne.debug("SI: Segment pushed updates end of previous one",u,o,s,f.start,f.end),this._inventory.splice(c+1,0,d),f.end=d.start,f.bufferedEnd=void 0,f.precizeEnd=f.precizeEnd&&d.precizeStart,c+=2;c<l.length&&l[c].start<d.end;){if(l[c].end>d.end)return ne.debug("SI: Segment pushed updates the start of the next one",u,d.end,l[c].start),l[c].start=d.end,l[c].bufferedStart=void 0,void(l[c].precizeStart=l[c].precizeStart&&d.precizeEnd);ne.debug("SI: Segment pushed removes the next one",u,o,s,l[c].start,l[c].end),l.splice(c,1)}return}ne.warn("SI: Segment pushed is contained in a previous one",u,o,s,f.start,f.end);var v={partiallyPushed:f.partiallyPushed,chunkSize:f.chunkSize,splitted:!0,start:d.end,end:f.end,precizeStart:f.precizeStart&&f.precizeEnd&&d.precizeEnd,precizeEnd:f.precizeEnd,bufferedStart:void 0,bufferedEnd:f.end,infos:f.infos};return f.end=d.start,f.splitted=!0,f.bufferedEnd=void 0,f.precizeEnd=f.precizeEnd&&d.precizeStart,l.splice(c+1,0,d),void l.splice(c+2,0,v)}}var p=this._inventory[0];if(void 0===p)return ne.debug("SI: first segment pushed",u,o,s),void this._inventory.push(d);if(!(p.start>=s)){if(p.end<=s){for(ne.debug("SI: Segment pushed starts before and completely recovers the previous first one",u,o,s,p.start,p.end),this._inventory.splice(0,1,d);l.length>1&&l[1].start<d.end;){if(l[1].end>d.end)return ne.debug("SI: Segment pushed updates the start of the next one",u,d.end,l[1].start),l[1].start=d.end,l[1].bufferedStart=void 0,void(l[1].precizeStart=d.precizeEnd);ne.debug("SI: Segment pushed removes the next one",u,o,s,l[1].start,l[1].end),l.splice(1,1)}return}return ne.debug("SI: Segment pushed start of the next one",u,o,s,p.start,p.end),p.start=s,p.bufferedStart=void 0,p.precizeStart=d.precizeEnd,void this._inventory.splice(0,0,d)}ne.debug("SI: Segment pushed comes before all previous ones",u,o,s,p.start),this._inventory.splice(0,0,d)}}},t.completeSegment=function(e,t){if(!e.segment.isInit){for(var n=this._inventory,r=[],i=0;i<n.length;i++)if(Vn(n[i].infos,e)){var a=!1;r.length>0&&(a=!0,1===r.length&&(ne.warn("SI: Completed Segment is splitted.",e.segment.id,e.segment.time,e.segment.end),r[0].splitted=!0));var o=i,s=n[i].chunkSize;for(i+=1;i<n.length&&Vn(n[i].infos,e);){var u=n[i].chunkSize;void 0!==s&&void 0!==u&&(s+=u),i++}var l=i-1,d=l-o,c=n[l].end,f=n[l].bufferedEnd;d>0&&(this._inventory.splice(o+1,d),i-=d),this._inventory[o].partiallyPushed=!1,this._inventory[o].chunkSize=s,this._inventory[o].end=c,this._inventory[o].bufferedEnd=f,this._inventory[o].splitted=a,r.push(this._inventory[o])}if(0===r.length)ne.warn("SI: Completed Segment not found",e.segment.id,e.segment.time);else{this.synchronizeBuffered(t);for(var v,p=Zn(r);!(v=p()).done;){var h=v.value;void 0!==h.bufferedStart&&void 0!==h.bufferedEnd?this._bufferedHistory.addBufferedSegment(h.infos,{start:h.bufferedStart,end:h.bufferedEnd}):ne.debug("SI: buffered range not known after sync. Skipping history.",h.start,h.end)}}}},t.getInventory=function(){return this._inventory},t.getHistoryFor=function(e){return this._bufferedHistory.getHistoryFor(e)},e}();function tr(e){if(void 0===e.bufferedStart||e.partiallyPushed)return!1;var t=e.start,n=e.end-t,r=v.getCurrent(),i=r.MAX_MANIFEST_BUFFERED_START_END_DIFFERENCE,a=r.MAX_MANIFEST_BUFFERED_DURATION_DIFFERENCE;return Math.abs(t-e.bufferedStart)<=i&&(void 0===e.bufferedEnd||e.bufferedEnd>e.bufferedStart&&Math.abs(e.bufferedEnd-e.bufferedStart-n)<=Math.min(a,n/3))}function nr(e){if(void 0===e.bufferedEnd||e.partiallyPushed)return!1;var t=e.start,n=e.end,r=n-t,i=v.getCurrent(),a=i.MAX_MANIFEST_BUFFERED_START_END_DIFFERENCE,o=i.MAX_MANIFEST_BUFFERED_DURATION_DIFFERENCE;return Math.abs(n-e.bufferedEnd)<=a&&null!=e.bufferedStart&&e.bufferedEnd>e.bufferedStart&&Math.abs(e.bufferedEnd-e.bufferedStart-r)<=Math.min(o,r/3)}function rr(e,t,n,r){var i=v.getCurrent().MAX_MANIFEST_BUFFERED_START_END_DIFFERENCE;void 0!==e.bufferedStart?(e.bufferedStart<t&&(ne.debug("SI: Segment partially GCed at the start",r,e.bufferedStart,t),e.bufferedStart=t),!e.precizeStart&&tr(e)&&(e.start=e.bufferedStart,e.precizeStart=!0)):e.precizeStart?(ne.debug("SI: buffered start is precize start",r,e.start),e.bufferedStart=e.start):null!==n&&n.end>t&&(n.precizeEnd||e.start-n.end<=i)?(ne.debug("SI: buffered start is end of previous segment",r,t,e.start,n.end),e.bufferedStart=n.end,tr(e)&&(e.start=n.end,e.precizeStart=!0)):e.start-t<=i?(ne.debug("SI: found true buffered start",r,t,e.start),e.bufferedStart=t,tr(e)&&(e.start=t,e.precizeStart=!0)):t<e.start?(ne.debug("SI: range start too far from expected start",r,t,e.start),e.bufferedStart=e.start):(ne.debug("SI: Segment appears immediately garbage collected at the start",r,e.bufferedStart,t),e.bufferedStart=t)}function ir(e,t,n){var r=v.getCurrent().MAX_MANIFEST_BUFFERED_START_END_DIFFERENCE;void 0!==e.bufferedEnd?(e.bufferedEnd>t&&(ne.debug("SI: Segment partially GCed at the end",n,e.bufferedEnd,t),e.bufferedEnd=t),!e.precizeEnd&&t-e.end<=r&&nr(e)&&(e.precizeEnd=!0,e.end=t)):e.precizeEnd?(ne.debug("SI: buffered end is precize end",n,e.end),e.bufferedEnd=e.end):t-e.end<=r?(ne.debug("SI: found true buffered end",n,t,e.end),e.bufferedEnd=t,nr(e)&&(e.end=t,e.precizeEnd=!0)):t>e.end?(ne.debug("SI: range end too far from expected end",n,t,e.end),e.bufferedEnd=e.end):(ne.debug("SI: Segment appears immediately garbage collected at the end",n,e.bufferedEnd,t),e.bufferedEnd=t)}var ar,or=er,sr=function(){function e(){this._segmentInventory=new or}var t=e.prototype;return t.synchronizeInventory=function(){this._segmentInventory.synchronizeBuffered(this.getBufferedRanges())},t.getInventory=function(){return this._segmentInventory.getInventory()},t.getPendingOperations=function(){return[]},t.getSegmentHistory=function(e){return this._segmentInventory.getHistoryFor(e)},e}();function ur(e){}!function(e){e[e.Push=0]="Push",e[e.Remove=1]="Remove",e[e.EndOfSegment=2]="EndOfSegment"}(ar||(ar={}));var lr=function(e){function t(t,n,r){var i;i=e.call(this)||this,ne.info("AVSB: calling `mediaSource.addSourceBuffer`",n);var a=r.addSourceBuffer(n);i._canceller=new Ge,i.bufferType=t,i._mediaSource=r,i._sourceBuffer=a,i._queue=[],i._pendingTask=null,i._lastInitSegmentUniqueId=null,i.codec=n,i._initSegmentsMap=new Map;var o=i._onPendingTaskError.bind(ie(i)),s=i._flush.bind(ie(i)),u=v.getCurrent().SOURCE_BUFFER_FLUSHING_INTERVAL,l=setInterval(s,u);return i._sourceBuffer.addEventListener("error",o),i._sourceBuffer.addEventListener("updateend",s),i._canceller.signal.register((function(){clearInterval(l),i._sourceBuffer.removeEventListener("error",o),i._sourceBuffer.removeEventListener("updateend",s)})),i}s(t,e);var n=t.prototype;return n.declareInitSegment=function(e,t){ur(t),this._initSegmentsMap.set(e,t)},n.freeInitSegment=function(e){this._initSegmentsMap.delete(e)},n.pushChunk=function(e,t){return ur(e.data.chunk),ne.debug("AVSB: receiving order to push data to the SourceBuffer",this.bufferType,Kn(e.inventoryInfos)),this._addToQueue({type:ar.Push,value:e},t)},n.removeBuffer=function(e,t,n){return ne.debug("AVSB: receiving order to remove data from the SourceBuffer",this.bufferType,e,t),this._addToQueue({type:ar.Remove,value:{start:e,end:t}},n)},n.endOfSegment=function(e,t){return ne.debug("AVSB: receiving order for validating end of segment",this.bufferType,Kn(e)),this._addToQueue({type:ar.EndOfSegment,value:e},t)},n.getBufferedRanges=function(){return this._sourceBuffer.buffered},n.getPendingOperations=function(){var e=function(e){switch(e.type){case ar.Push:case ar.Remove:case ar.EndOfSegment:return{type:e.type,value:e.value}}},t=this._queue.map(e);return null===this._pendingTask?t:[e(this._pendingTask)].concat(t)},n.dispose=function(){for(this._canceller.cancel(),null!==this._pendingTask&&(this._pendingTask.reject(new je),this._pendingTask=null);this._queue.length>0;){var e=this._queue.shift();void 0!==e&&e.reject(new je)}if("open"===this._mediaSource.readyState)try{ne.debug("AVSB: Calling `abort` on the SourceBuffer"),this._sourceBuffer.abort()}catch(e){ne.warn("AVSB: Failed to abort a "+this.bufferType+" SourceBuffer:",e instanceof Error?e:"")}},n._onPendingTaskError=function(e){if(this._lastInitSegmentUniqueId=null,null!==this._pendingTask){var t=e instanceof Error?e:new Error("An unknown error occured when doing operations on the SourceBuffer");this._pendingTask.reject(t)}},n._addToQueue=function(e,t){var n=this;return xt(t,(function(t,r){var i=0===n._queue.length&&null===n._pendingTask,a=l({resolve:t,reject:r},e);return n._queue.push(a),i&&n._flush(),function(){var e=n._queue.indexOf(a);e>=0&&n._queue.splice(e,1),a.resolve=m,a.reject=m}}))},n._flush=function(){if(!this._sourceBuffer.updating){if(null!==this._pendingTask){var e=this._pendingTask;if(e.type!==ar.Push||0===e.data.length){switch(e.type){case ar.Push:null!==e.inventoryData&&this._segmentInventory.insertChunk(e.inventoryData);break;case ar.EndOfSegment:this._segmentInventory.completeSegment(e.value,this.getBufferedRanges());break;case ar.Remove:this.synchronizeInventory();break;default:ke()}var t=e.resolve;return this._pendingTask=null,t(),void this._flush()}}else{var n=this._queue.shift();if(void 0===n)return;if(n.type!==ar.Push)this._pendingTask=n;else{var r,i=n.value;try{r=this._preparePushOperation(i.data)}catch(e){this._pendingTask=l({data:[],inventoryData:i.inventoryInfos},n);var a=e instanceof Error?e:new Error("An unknown error occured when preparing a push operation");return this._lastInitSegmentUniqueId=null,void n.reject(a)}this._pendingTask=l({data:r,inventoryData:i.inventoryInfos},n)}}try{switch(this._pendingTask.type){case ar.EndOfSegment:return ne.debug("AVSB: Acknowledging complete segment",Kn(this._pendingTask.value)),void this._flush();case ar.Push:var o=this._pendingTask.data.shift();if(void 0===o)return void this._flush();ne.debug("AVSB: pushing segment",this.bufferType,Kn(this._pendingTask.inventoryData)),this._sourceBuffer.appendBuffer(o);break;case ar.Remove:var s=this._pendingTask.value,u=s.start,d=s.end;ne.debug("AVSB: removing data from SourceBuffer",this.bufferType,u,d),this._sourceBuffer.remove(u,d);break;default:ke(this._pendingTask)}}catch(e){this._onPendingTaskError(e)}}},n._preparePushOperation=function(e){var t=[],n=e.codec,r=e.timestampOffset,i=e.appendWindow,a=!1;if(void 0!==n&&n!==this.codec&&(ne.debug("AVSB: updating codec",n),a=function(e,t){if("function"==typeof e.changeType){try{e.changeType(t)}catch(e){return ne.warn("Could not call 'changeType' on the given SourceBuffer:",e instanceof Error?e:""),!1}return!0}return!1}(this._sourceBuffer,n),a?this.codec=n:ne.debug("AVSB: could not update codec",n,this.codec)),this._sourceBuffer.timestampOffset!==r){var o=r;ne.debug("AVSB: updating timestampOffset",this.bufferType,this._sourceBuffer.timestampOffset,o),this._sourceBuffer.timestampOffset=o}if(void 0===i[0])this._sourceBuffer.appendWindowStart>0&&(ne.debug("AVSB: re-setting `appendWindowStart` to `0`"),this._sourceBuffer.appendWindowStart=0);else if(i[0]!==this._sourceBuffer.appendWindowStart){if(i[0]>=this._sourceBuffer.appendWindowEnd){var s=i[0]+1;ne.debug("AVSB: pre-updating `appendWindowEnd`",s),this._sourceBuffer.appendWindowEnd=s}ne.debug("AVSB: setting `appendWindowStart`",i[0]),this._sourceBuffer.appendWindowStart=i[0]}if(void 0===i[1]?this._sourceBuffer.appendWindowEnd!==1/0&&(ne.debug("AVSB: re-setting `appendWindowEnd` to `Infinity`"),this._sourceBuffer.appendWindowEnd=1/0):i[1]!==this._sourceBuffer.appendWindowEnd&&(ne.debug("AVSB: setting `appendWindowEnd`",i[1]),this._sourceBuffer.appendWindowEnd=i[1]),null!==e.initSegmentUniqueId&&(a||!this._isLastInitSegment(e.initSegmentUniqueId))){var u=this._initSegmentsMap.get(e.initSegmentUniqueId);if(void 0===u)throw new Error("Invalid initialization segment uniqueId");t.push(u),this._lastInitSegmentUniqueId=e.initSegmentUniqueId}return null!==e.chunk&&t.push(e.chunk),t},n._isLastInitSegment=function(e){return null!==this._lastInitSegmentUniqueId&&this._lastInitSegmentUniqueId===e},t}(sr),dr=["audio","video","text"];function cr(e){return"audio"===e||"video"===e}var fr=function(){function e(e,t){this._mediaElement=e,this._mediaSource=t,this._initializedSegmentBuffers={},this._onNativeBufferAddedOrDisabled=[]}e.isNative=function(e){return cr(e)};var t=e.prototype;return t.getBufferTypes=function(){var e=this.getNativeBufferTypes();return null==_e.nativeTextTracksBuffer&&null==_e.htmlTextTracksBuffer||e.push("text"),e},t.getNativeBufferTypes=function(){return"AUDIO"===this._mediaElement.nodeName?["audio"]:["video","audio"]},t.getStatus=function(e){var t=this._initializedSegmentBuffers[e];return void 0===t?{type:"uninitialized"}:null===t?{type:"disabled"}:{type:"initialized",value:t}},t.waitForUsableBuffers=function(e){var t=this;return this._areNativeBuffersUsable()?Promise.resolve():xt(e,(function(e){var n,r=function(){var e=t._onNativeBufferAddedOrDisabled.indexOf(n);e>=0&&t._onNativeBufferAddedOrDisabled.splice(e,1)};return n=function(){t._areNativeBuffersUsable()&&(r(),e())},t._onNativeBufferAddedOrDisabled.push(n),r}))},t.disableSegmentBuffer=function(t){var n=this._initializedSegmentBuffers[t];if(null!==n){if(void 0!==n)throw new Error("Cannot disable an active SegmentBuffer.");this._initializedSegmentBuffers[t]=null,e.isNative(t)&&this._onNativeBufferAddedOrDisabled.forEach((function(e){return e()}))}else ne.warn("SBS: The "+t+" SegmentBuffer was already disabled.")},t.createSegmentBuffer=function(e,t,n){void 0===n&&(n={});var r,i=this._initializedSegmentBuffers[e];if(cr(e)){if(null!=i)return i instanceof lr&&i.codec!==t?ne.warn("SB: Reusing native SegmentBuffer with codec",i.codec,"for codec",t):ne.info("SB: Reusing native SegmentBuffer with codec",t),i;ne.info("SB: Adding native SegmentBuffer with codec",t);var a=new lr(e,t,this._mediaSource);return this._initializedSegmentBuffers[e]=a,this._onNativeBufferAddedOrDisabled.forEach((function(e){return e()})),a}if(null!=i)return ne.info("SB: Reusing a previous custom SegmentBuffer for the type",e),i;if("text"===e){if(ne.info("SB: Creating a new text SegmentBuffer"),"html"===n.textTrackMode){if(null==_e.htmlTextTracksBuffer)throw new Error("HTML Text track feature not activated");r=new _e.htmlTextTracksBuffer(this._mediaElement,n.textTrackElement)}else{if(null==_e.nativeTextTracksBuffer)throw new Error("Native Text track feature not activated");r=new _e.nativeTextTracksBuffer(this._mediaElement)}return this._initializedSegmentBuffers.text=r,r}throw ne.error("SB: Unknown buffer type:",e),new ve("BUFFER_TYPE_UNKNOWN","The player wants to create a SegmentBuffer of an unknown type.")},t.disposeSegmentBuffer=function(e){var t=this._initializedSegmentBuffers[e];null!=t?(ne.info("SB: Aborting SegmentBuffer",e),t.dispose(),delete this._initializedSegmentBuffers[e]):ne.warn("SB: Trying to dispose a SegmentBuffer that does not exist")},t.disposeAll=function(){var e=this;dr.forEach((function(t){"initialized"===e.getStatus(t).type&&e.disposeSegmentBuffer(t)}))},t._areNativeBuffersUsable=function(){var e=this,t=this.getNativeBufferTypes();return!t.some((function(t){return void 0===e._initializedSegmentBuffers[t]}))&&!t.every((function(t){return null===e._initializedSegmentBuffers[t]}))},e}(),vr=n(473),pr=n.n(vr),hr=function(){function e(e){this._array=[],this._sortingFn=e}var t=e.prototype;return t.add=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];t.sort(this._sortingFn);for(var r=0,i=0;i<t.length;i++){for(var a=t[i],o=!1;!o&&r<this._array.length;)this._sortingFn(a,this._array[r])<0?(this._array.splice(r,0,a),o=!0):r++;o||this._array.push(a)}},t.length=function(){return this._array.length},t.get=function(e){if(e<0||e>=this._array.length)throw new Error("Invalid index.");return this._array[e]},t.toArray=function(){return this._array.slice()},t.findFirst=function(e){return be(this._array,e)},t.has=function(e){return Se(this._array,e)},t.removeElement=function(e){var t=this._array.indexOf(e);if(t>=0)return this._array.splice(t,1),t},t.head=function(){return this._array[0]},t.last=function(){return this._array[this._array.length-1]},t.shift=function(){return this._array.shift()},t.pop=function(){return this._array.pop()},e}(),mr=function(){function e(e){this._weakMap=new WeakMap,this._fn=e}var t=e.prototype;return t.get=function(e){var t=this._weakMap.get(e);if(void 0===t){var n=this._fn(e);return this._weakMap.set(e,n),n}return t},t.destroy=function(e){this._weakMap.delete(e)},e}();function gr(e,t){var n,r=e.segmentBuffer,i=e.playbackObserver,a=e.maxBufferBehind,o=e.maxBufferAhead;function s(){(function(e,t,n,r,i){return yr.apply(this,arguments)})(r,n,a.getValue(),o.getValue(),t).catch((function(e){var t=e instanceof Error?e.message:"Unknown error";ne.error("Could not run BufferGarbageCollector:",t)}))}i.listen((function(e){var t;n=null!==(t=e.position.pending)&&void 0!==t?t:e.position.last,s()}),{includeLastObservation:!0,clearSignal:t}),a.onUpdate(s,{clearSignal:t}),o.onUpdate(s,{clearSignal:t}),s()}function yr(){return(yr=qe(Qe().mark((function e(t,n,r,i,a){var o,s,u,l,d,c,f,v;return Qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(isFinite(r)||isFinite(i)){e.next=2;break}return e.abrupt("return",Promise.resolve());case 2:o=[],s=Ue(t.getBufferedRanges(),n),u=s.innerRange,l=s.outerRanges,d=function(){if(isFinite(i)){for(var e=0;e<l.length;e++){var t=l[e];n+i<=t.start?o.push(t):n<=t.start&&n+i<t.end&&n+i>t.start&&o.push({start:n+i,end:t.end})}null!=u&&n+i<u.end&&o.push({start:n+i,end:u.end})}},function(){if(isFinite(r)){for(var e=0;e<l.length;e++){var t=l[e];n-r>=t.end?o.push(t):n>=t.end&&n-r>t.start&&n-r<t.end&&o.push({start:t.start,end:n-r})}null!=u&&n-r>u.start&&o.push({start:u.start,end:n-r})}}(),d(),c=0,f=o;case 9:if(!(c<f.length)){e.next=20;break}if(!((v=f[c]).start<v.end)){e.next=17;break}if(ne.debug("GC: cleaning range from SegmentBuffer",v.start,v.end),null===a.cancellationError){e.next=15;break}throw a.cancellationError;case 15:return e.next=17,t.removeBuffer(v.start,v.end,a);case 17:c++,e.next=9;break;case 20:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var _r=function(e){function t(t,n,r,i){var a;return(a=e.call(this)||this)._content=t,a._currentCanceller=null,a._downloadQueue=n,a._initSegmentRequest=null,a._mediaSegmentRequest=null,a._segmentFetcher=r,a._initSegmentInfoRef=new E(void 0),a._mediaSegmentAwaitingInitMetadata=null,i||a._initSegmentInfoRef.setValue(null),a}s(t,e);var n=t.prototype;return n.getRequestedInitSegment=function(){return null===this._initSegmentRequest?null:this._initSegmentRequest.segment},n.getRequestedMediaSegment=function(){return null===this._mediaSegmentRequest?null:this._mediaSegmentRequest.segment},n.start=function(){var e=this;null===this._currentCanceller&&(this._currentCanceller=new Ge,this._downloadQueue.onUpdate((function(t){var n=t.segmentQueue;if(!(n.length>0&&n[0].segment.id===e._mediaSegmentAwaitingInitMetadata)){var r=e._mediaSegmentRequest;if(0===n.length){if(null===r)return;return ne.debug("Stream: no more media segment to request. Cancelling queue.",e._content.adaptation.type),void e._restartMediaSegmentDownloadingQueue()}if(null===r)return ne.debug("Stream: Media segments now need to be requested. Starting queue.",e._content.adaptation.type,n.length),void e._restartMediaSegmentDownloadingQueue();var i=n[0];return r.segment.id!==i.segment.id?(ne.debug("Stream: Next media segment changed, cancelling previous",e._content.adaptation.type),void e._restartMediaSegmentDownloadingQueue()):void(r.priority!==i.priority&&(ne.debug("Stream: Priority of next media segment changed, updating",e._content.adaptation.type,r.priority,i.priority),e._segmentFetcher.updatePriority(r.request,i.priority)))}}),{emitCurrentValue:!0,clearSignal:this._currentCanceller.signal}),this._downloadQueue.onUpdate((function(t){var n,r=e._initSegmentRequest;null===t.initSegment||null===r?(null===(n=t.initSegment)||void 0===n?void 0:n.segment.id)!==(null==r?void 0:r.segment.id)&&(null===t.initSegment&&ne.debug("Stream: no more init segment to request. Cancelling queue.",e._content.adaptation.type),e._restartInitSegmentDownloadingQueue(t.initSegment)):t.initSegment.priority!==r.priority&&e._segmentFetcher.updatePriority(r.request,t.initSegment.priority)}),{emitCurrentValue:!0,clearSignal:this._currentCanceller.signal}))},n.stop=function(){var e;null===(e=this._currentCanceller)||void 0===e||e.cancel(),this._currentCanceller=null},n._restartMediaSegmentDownloadingQueue=function(){var e=this;null!==this._mediaSegmentRequest&&this._mediaSegmentRequest.canceller.cancel();!function t(n){if(null!==e._currentCanceller&&e._currentCanceller.isUsed())e._mediaSegmentRequest=null;else{if(void 0===n)return e._mediaSegmentRequest=null,void e.trigger("emptyQueue",null);var r=new Ge,i=null===e._currentCanceller?m:r.linkToSignal(e._currentCanceller.signal),a=n.segment,o=n.priority,s=l({segment:a},e._content),u=!1,d=!1;r.signal.register((function(){e._mediaSegmentRequest=null,u||(e._mediaSegmentAwaitingInitMetadata===a.id&&(e._mediaSegmentAwaitingInitMetadata=null),u=!0,d=!1)}));var c=function(t){Ee(t.segmentType),e.trigger("parsedMediaSegment",l({},t,{segment:a}))},f=function(){var n=e._downloadQueue.getValue().segmentQueue;if(0===n.length)return u=!0,void e.trigger("emptyQueue",null);n[0].segment.id===a.id&&n.shift(),u=!0,t(n[0])},v=e._segmentFetcher.createRequest(s,o,{onRetry:function(t){e.trigger("requestRetry",{segment:a,error:t})},beforeInterrupted:function(){ne.info("Stream: segment request interrupted temporarly.",a.id,a.time)},onChunk:function(t){var n=e._initSegmentInfoRef.getValue();void 0!==n?c(t(null!=n?n:void 0)):(d=!0,e._initSegmentInfoRef.waitUntilDefined((function(e){c(t(null!=e?e:void 0))}),{clearSignal:r.signal}))},onAllChunksReceived:function(){d?(e._mediaSegmentAwaitingInitMetadata=a.id,e._initSegmentInfoRef.waitUntilDefined((function(){e._mediaSegmentAwaitingInitMetadata=null,d=!1,e.trigger("fullyLoadedSegment",a)}),{clearSignal:r.signal})):e.trigger("fullyLoadedSegment",a)},beforeEnded:function(){i(),e._mediaSegmentRequest=null,d?e._initSegmentInfoRef.waitUntilDefined(f,{clearSignal:r.signal}):f()}},r.signal);v.catch((function(t){i(),u||(u=!0,e.stop(),e.trigger("error",t))})),e._mediaSegmentRequest={segment:a,priority:o,request:v,canceller:r}}}(this._downloadQueue.getValue().segmentQueue[0])},n._restartInitSegmentDownloadingQueue=function(e){var t=this;if((null===this._currentCanceller||!this._currentCanceller.isUsed())&&(null!==this._initSegmentRequest&&this._initSegmentRequest.canceller.cancel(),null!==e)){var n=new Ge,r=null===this._currentCanceller?m:n.linkToSignal(this._currentCanceller.signal),i=e.segment,a=e.priority,o=l({segment:i},this._content),s=!1,u=this._segmentFetcher.createRequest(o,a,{onRetry:function(e){t.trigger("requestRetry",{segment:i,error:e})},beforeInterrupted:function(){ne.info("Stream: init segment request interrupted temporarly.",i.id)},beforeEnded:function(){r(),t._initSegmentRequest=null,s=!0},onChunk:function(e){var n,r=e(void 0);Ee(r.segmentType),t.trigger("parsedInitSegment",l({},r,{segment:i})),"init"===r.segmentType&&t._initSegmentInfoRef.setValue(null!==(n=r.initTimescale)&&void 0!==n?n:null)},onAllChunksReceived:function(){t.trigger("fullyLoadedSegment",i)}},n.signal);u.catch((function(e){r(),s||(s=!0,t.stop(),t.trigger("error",e))})),n.signal.register((function(){t._initSegmentRequest=null,s||(s=!0)})),this._initSegmentRequest={segment:i,priority:a,request:u,canceller:n}}},t}(we);function br(e,t,n,r,i){var a=e.period,o=e.adaptation,s=e.representation,u=function(e,t){for(var n=0;n<e.length;n++){var r=e[n];if(void 0===r.bufferedStart||void 0===r.bufferedEnd||r.bufferedStart>=t.end)return null;if(r.bufferedEnd>t.start)return n}return null}(i,t);if(null===u){if(null===n){if(r&&void 0!==a.end&&t.end>=a.end)return{start:void 0,end:null};var l=s.index.checkDiscontinuity(t.start);if(null!==l)return{start:void 0,end:l}}return null}var d=i[u];if(void 0!==d.bufferedStart&&d.bufferedStart>t.start&&(null===n||d.infos.segment.end<=n)){var c=d.bufferedStart;return r||!1===s.index.awaitSegmentBetween(t.start,c)?(ne.debug("RS: current discontinuity encountered",o.type,d.bufferedStart),{start:void 0,end:c}):null}var f=function(e,t,n){if(n<=0)return ne.error("RS: Asked to check a discontinuity before the first chunk."),null;for(var r=n;r<e.length;r++){var i=e[r],a=e[r-1];if(void 0===i.bufferedStart||void 0===a.bufferedEnd||i.bufferedStart>=t.end)return null;if(i.bufferedStart-a.bufferedEnd>0)return r}return null}(i,t,u+1);if(null!==f){var v=i[f-1],p=i[f];if(null===n||p.infos.segment.end<=n){if(!r&&!1!==s.index.awaitSegmentBetween(v.infos.segment.end,p.infos.segment.time))return null;var h=v.bufferedEnd,m=p.bufferedStart;return ne.debug("RS: future discontinuity encountered",o.type,h,m),{start:h,end:m}}}if(null===n){if(r&&void 0!==a.end){if(t.end<a.end)return null;var g=function(e,t){for(var n=e.length-1;n>=0;n--){var r=e[n];if(void 0===r.bufferedStart)return null;if(r.bufferedStart<t)return n}return null}(i,a.end);if(null!==g){var y=i[g];if(void 0!==y.bufferedEnd&&y.bufferedEnd<a.end)return ne.debug("RS: discontinuity encountered at the end of the current period",o.type,y.bufferedEnd,a.end),{start:y.bufferedEnd,end:null}}}if(void 0!==a.end&&t.end>=a.end)return null;for(var _=i.length-1;_>=0;_--){var b=i[_];if(void 0===b.bufferedStart)break;if(b.bufferedStart<t.end){if(void 0!==b.bufferedEnd&&b.bufferedEnd<t.end){var S=s.index.checkDiscontinuity(t.end);if(null!==S)return{start:b.bufferedEnd,end:S}}return null}}}return null}function Sr(e){var t=e.bufferedSegments,n=e.content,r=e.currentPlaybackTime,i=e.fastSwitchThreshold,a=e.getBufferedHistory,o=e.neededRange,s=e.segmentsBeingPushed,u=e.maxBufferSize,d=n.adaptation,c=n.representation,f=function(e,t,n){var r=8e3*n;return r-=t.reduce((function(e,t){return e+t.representation.bitrate*t.segment.duration}),0),e.reduce((function(e,t){return void 0!==t.chunkSize?e-8*t.chunkSize:e}),r)}(t,s,u),p=c.index.getSegments(o.start,o.end-o.start),h=t.filter((function(e){return!Tr(e.infos,n,r,i)})).filter((function(e,t,n){var r=0===t?null:n[t-1],i=t>=n.length-1?null:n[t+1],s=null;if(function(e,t,n){var r=v.getCurrent().MAX_TIME_MISSING_FROM_COMPLETE_SEGMENT;if(void 0===e.bufferedStart)return ne.warn("Stream: Start of a segment unknown. Assuming it is garbage collected by default.",e.start),!0;if(null!==t&&void 0!==t.bufferedEnd&&e.bufferedStart-t.bufferedEnd<.1)return!1;if(n<e.bufferedStart&&e.bufferedStart-e.start>r)return ne.info("Stream: The start of the wanted segment has been garbage collected",e.start,e.bufferedStart),!0;return!1}(e,r,o.start)){if(function(e,t){var n,r;if(e.length<2)return!0;var i=e[e.length-1],a=null===(n=i.buffered)||void 0===n?void 0:n.start;if(void 0!==t&&void 0!==a&&t-a>.05)return!0;var o=e[e.length-2],s=null===(r=o.buffered)||void 0===r?void 0:r.start;if(void 0===s||void 0===a)return!0;return Math.abs(s-a)>.01}(s=a(e.infos),e.bufferedStart))return!1;ne.debug("Stream: skipping segment gc-ed at the start",e.start,e.bufferedStart)}if(function(e,t,n){var r=v.getCurrent().MAX_TIME_MISSING_FROM_COMPLETE_SEGMENT;if(void 0===e.bufferedEnd)return ne.warn("Stream: End of a segment unknown. Assuming it is garbage collected by default.",e.end),!0;if(null!==t&&void 0!==t.bufferedStart&&t.bufferedStart-e.bufferedEnd<.1)return!1;if(n>e.bufferedEnd&&e.end-e.bufferedEnd>r)return ne.info("Stream: The end of the wanted segment has been garbage collected",e.start,e.bufferedStart),!0;return!1}(e,i,o.end)){if(function(e,t){var n,r;if(e.length<2)return!0;var i=e[e.length-1],a=null===(n=i.buffered)||void 0===n?void 0:n.end;if(void 0!==t&&void 0!==a&&a-t>.05)return!0;var o=e[e.length-2],s=null===(r=o.buffered)||void 0===r?void 0:r.end;if(void 0===s||void 0===a)return!0;return Math.abs(s-a)>.01}(s=null!=s?s:a(e.infos),e.bufferedEnd))return!1;ne.debug("Stream: skipping segment gc-ed at the end",e.end,e.bufferedEnd)}return!0})),m=v.getCurrent(),g=m.MINIMUM_SEGMENT_SIZE,y=m.MIN_BUFFER_AHEAD,_=!1,b=Math.min(1/60,g),S=!1,E=[],T=p.filter((function(e){var t=l({segment:e},n);if(s.length>0&&s.some((function(e){return Vn(t,e)})))return!1;var u=e.duration,v=e.time,p=e.end;if(e.isInit)return!0;if(_)return E.push(e),!1;if(e.complete&&u<g)return!1;if(s.length>0&&s.some((function(e){if(e.period.id!==n.period.id||e.adaptation.id!==n.adaptation.id)return!1;var a=e.segment;return!(a.time-b>v)&&(!(a.end+b<p)&&!Tr(e,t,r,i))})))return!1;for(var m=0;m<h.length;m++){var T=h[m];if(T.infos.period.id===n.period.id){var k=T.infos.segment;if(v-k.time>-b&&k.end-p>-b)return!1}}var w=u*n.representation.bitrate;if(f-w<0&&(S=!0,v>o.start+y))return _=!0,E.push(e),!1;var A=a(t);if(A.length>1){var I=A[A.length-1],R=A[A.length-2];if(null===I.buffered&&null===R.buffered)return ne.warn("Stream: Segment GCed multiple times in a row, ignoring it.","If this happens a lot and lead to unpleasant experience, please check your device's available memory. If it's low when this message is emitted, you might want to update the RxPlayer's settings (`maxBufferAhead`, `maxVideoBufferSize` etc.) so less memory is used by regular media data buffering."+d.type,c.id,e.time),!1}for(var x=0;x<h.length;x++){var M=h[x];if(M.end+b>v){var C=M.start>v+b||Er(h,x).end<p-b;return C&&(f-=w),C}}return f-=w,!0}));return{segmentsToLoad:T,segmentsOnHold:E,isBufferFull:S}}function Er(e,t){for(var n=t+1,r=v.getCurrent().MINIMUM_SEGMENT_SIZE,i=Math.min(1/60,r);n<e.length-1&&e[n-1].end+i>e[n].start;)n++;return e[--n]}function Tr(e,t,n,r){var i=v.getCurrent().CONTENT_REPLACEMENT_PADDING;return e.period.id===t.period.id&&(!(e.segment.time<n+i)&&(e.adaptation.id!==t.adaptation.id||function(e,t,n){var r=e.bitrate,i=v.getCurrent().BITRATE_REBUFFERING_RATIO;if(void 0===n){var a=r*i;return t.bitrate>a}return r<n&&t.bitrate>r}(e.representation,t.representation,r)))}function kr(e,t){for(var n=e-t,r=v.getCurrent().SEGMENT_PRIORITIES_STEPS,i=0;i<r.length;i++)if(n<r[i])return i;return r.length}function wr(e,t,n,r,i,a,o){o.synchronizeInventory();var s=e.representation,u=n.getIsPaused()||n.getPlaybackRate()<=0?t-.1:t,l=function(e,t,n){var r,i,a=e.manifest,o=e.period,s=e.representation,u=s.index.getLastAvailablePosition(),l=s.index;i=!h(u)&&fr.isNative(e.adaptation.type)&&t>=u&&l.isInitialized()&&l.isFinished()&&function(e,t,n){var r;return t.containsTime(n)&&e.isLastPeriodKnown&&t.id===(null===(r=e.periods[e.periods.length-1])||void 0===r?void 0:r.id)}(a,o,t)?u-1:t-.1;var d,c=i+n;d=!(!s.index.isInitialized()||!s.index.isFinished()||void 0===o.end)&&(void 0===u?c>=o.end:null===u||c>=u);return{start:Math.max(i,o.start),end:Math.min(c,null!==(r=o.end)&&void 0!==r?r:1/0),hasReachedPeriodEnd:d}}(e,u,i),d=s.index.shouldRefresh(l.start,l.end),c=o.getPendingOperations().filter((function(e){return e.type===ar.EndOfSegment})).map((function(e){return e.value})),f=function(e,t){for(var n=v.getCurrent().MINIMUM_SEGMENT_SIZE,r=Math.max(1/60,n),i=e.start+r,a=e.end-r,o=[],s=t.length-1;s>=0;s--){var u=t[s],l=u.infos.representation;if(!u.partiallyPushed&&!1!==l.decipherable&&l.isSupported){var d=u.infos.segment,c=d.time/d.timescale;((d.complete?c+d.duration/d.timescale:u.end)>i&&c<a||u.end>i&&u.start<a)&&o.unshift(u)}}return o}({start:Math.max(l.start-.5,0),end:l.end+.5},o.getInventory()),p=Sr({content:e,bufferedSegments:f,currentPlaybackTime:n.getCurrentTime(),fastSwitchThreshold:r,getBufferedHistory:o.getSegmentHistory.bind(o),neededRange:l,segmentsBeingPushed:c,maxBufferSize:a}),m=p.segmentsToLoad,g=p.segmentsOnHold,y=p.isBufferFull,_=m.map((function(e){return{priority:kr(e.time,u),segment:e}})),b=s.index.isInitialized()&&s.index.isFinished()&&l.hasReachedPeriodEnd&&0===_.length&&0===g.length,S=null;return c.length>0&&(S=Math.min.apply(Math,c.map((function(e){return e.segment.time})))),g.length>0&&(S=null!==S?Math.min(S,g[0].time):g[0].time),_.length>0&&(S=null!==S?Math.min(S,_[0].segment.time):_[0].segment.time),{imminentDiscontinuity:br(e,l,S,b,f),hasFinishedLoading:b,neededSegments:_,isBufferFull:y,shouldRefreshManifest:d}}function Ar(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Ir(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ir(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Ir(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Rr(e,t,n){return xr.apply(this,arguments)}function xr(){return(xr=qe(Qe().mark((function e(t,n,r){var i,a,o,s,u,l,d,c,f;return Qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=v.getCurrent().BUFFER_GC_GAPS.CALM,a=v.getCurrent().BUFFER_GC_GAPS.BEEFY,ne.warn("Stream: Running garbage collector"),o=n.getBufferedRanges(),0===(s=Mr(t,o,i)).length&&(s=Mr(t,o,a)),ne.hasLevel("DEBUG")&&ne.debug("Stream: GC cleaning",s.map((function(e){return"start: "+e.start+" - end "+e.end})).join(", ")),u=Ar(s);case 8:if((l=u()).done){e.next=16;break}if(d=l.value,c=d.start,f=d.end,!(c<f)){e.next=14;break}return e.next=14,n.removeBuffer(c,f,r);case 14:e.next=8;break;case 16:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Mr(e,t,n){for(var r=Ue(t,e),i=r.innerRange,a=r.outerRanges,o=[],s=0;s<a.length;s++){var u=a[s];(e-n>u.end||e+n<u.start)&&o.push(u)}return null!==i&&(ne.hasLevel("DEBUG")&&ne.debug("Stream: GC removing part of inner range",o.map((function(e){return"start: "+e.start+" - end "+e.end})).join(", ")),e-n>i.start&&o.push({start:i.start,end:e-n}),e+n<i.end&&o.push({start:e+n,end:i.end})),o}function Cr(e,t,n,r){return Pr.apply(this,arguments)}function Pr(){return Pr=qe(Qe().mark((function e(t,n,r,i){var a,o,s,u,l,d;return Qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,n.pushChunk(r,i);case 3:case 21:e.next=27;break;case 5:if(e.prev=5,e.t0=e.catch(0),!(i.isCancelled()&&e.t0 instanceof je)){e.next=11;break}throw e.t0;case 11:if(e.t0 instanceof Error&&"QuotaExceededError"===e.t0.name){e.next=14;break}throw o=e.t0 instanceof Error?e.t0.toString():"An unknown error happened when pushing content",new ve("BUFFER_APPEND_ERROR",o,{adaptations:[r.inventoryInfos.adaptation]});case 14:return s=t.getReference().getValue(),u=s.position,l=null!==(a=u.pending)&&void 0!==a?a:u.last,e.prev=16,e.next=19,Rr(l,n,i);case 19:return e.next=21,n.pushChunk(r,i);case 23:throw e.prev=23,e.t1=e.catch(16),d=e.t1 instanceof Error?e.t1.toString():"Could not clean the buffer",new ve("BUFFER_FULL_ERROR",d,{adaptations:[r.inventoryInfos.adaptation]});case 27:case"end":return e.stop()}}),e,null,[[0,5],[16,23]])}))),Pr.apply(this,arguments)}function Dr(){return Dr=qe(Qe().mark((function e(t,n){var r,i,a,o,s,u,d,c,f;return Qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.playbackObserver,i=t.content,a=t.initSegmentUniqueId,o=t.segment,s=t.segmentBuffer,null===n.cancellationError){e.next=3;break}throw n.cancellationError;case 3:return u=i.representation.getMimeTypeString(),d={initSegmentUniqueId:a,chunk:null,timestampOffset:0,appendWindow:[void 0,void 0],codec:u},c=l({segment:o,chunkSize:void 0,start:0,end:0},i),e.next=8,Cr(r,s,{data:d,inventoryInfos:c},n);case 8:return f=s.getBufferedRanges(),e.abrupt("return",{content:i,segment:o,buffered:f});case 10:case"end":return e.stop()}}),e)}))),Dr.apply(this,arguments)}function Nr(){return Nr=qe(Qe().mark((function e(t,n){var r,i,a,o,s,u,d,c,f,p,h,m,g,y,_,b,S,E,T,k,w,A,I;return Qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.playbackObserver,i=t.content,a=t.initSegmentUniqueId,o=t.parsedSegment,s=t.segment,u=t.segmentBuffer,null!==o.chunkData){e.next=3;break}return e.abrupt("return",null);case 3:if(null===n.cancellationError){e.next=5;break}throw n.cancellationError;case 5:return f=o.chunkData,p=o.chunkInfos,h=o.chunkOffset,m=o.chunkSize,g=o.appendWindow,y=i.representation.getMimeTypeString(),_=v.getCurrent(),b=_.APPEND_WINDOW_SECURITIES,S=[void 0!==g[0]?Math.max(0,g[0]-b.START):void 0,void 0!==g[1]?g[1]+b.END:void 0],E={initSegmentUniqueId:a,chunk:f,timestampOffset:h,appendWindow:S,codec:y},T=null!==(d=null==p?void 0:p.time)&&void 0!==d?d:s.time,k=null!==(c=null==p?void 0:p.duration)&&void 0!==c?c:s.duration,w=T+k,void 0!==S[0]&&(T=Math.max(T,S[0])),void 0!==S[1]&&(w=Math.min(w,S[1])),A=l({segment:s,chunkSize:m,start:T,end:w},i),e.next=18,Cr(r,u,{data:E,inventoryInfos:A},n);case 18:return I=u.getBufferedRanges(),e.abrupt("return",{content:i,segment:s,buffered:I});case 20:case"end":return e.stop()}}),e)}))),Nr.apply(this,arguments)}function Or(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Lr(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Lr(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Lr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Ur=function(e,t,n){var r=e.content,i=e.options,a=e.playbackObserver,o=e.segmentBuffer,s=e.segmentFetcher,u=e.terminate,d=r.period,c=r.adaptation,f=r.representation,p=i.bufferGoal,h=i.maxBufferSize,m=i.drmSystemId,g=i.fastSwitchThreshold,y=c.type,_=new Ge;_.linkToSignal(n);var b=new Ge;b.linkToSignal(_.signal);var S={segment:f.index.getInitSegment(),uniqueId:null,isLoaded:!1};_.signal.register((function(){null!==S.uniqueId&&o.freeInitSegment(S.uniqueId)}));var T=new E({initSegment:null,segmentQueue:[]},b.signal),k=null!==S.segment;k||(S.isLoaded=!0);var w=!1;if(void 0!==m){var A=f.getEncryptionData(m);if(A.length>0&&A.every((function(e){return void 0!==e.keyIds}))&&(w=!0,t.encryptionDataEncountered(A.map((function(e){return l({content:r},e)}))),_.isUsed()))return}var I=new _r(r,T,s,k);return I.addEventListener("error",(function(e){b.signal.isCancelled()||(_.cancel(),t.error(e))})),I.addEventListener("parsedInitSegment",x),I.addEventListener("parsedMediaSegment",x),I.addEventListener("emptyQueue",R),I.addEventListener("requestRetry",(function(e){if(t.warning(e.error),!b.signal.isCancelled()){var n=e.segment,r=f.index;!1===r.isSegmentStillAvailable(n)?R():r.canBeOutOfSyncError(e.error,n)&&t.manifestMightBeOufOfSync()}})),I.addEventListener("fullyLoadedSegment",(function(e){o.endOfSegment(l({segment:e},r),_.signal).catch(M)})),I.start(),b.signal.register((function(){I.removeEventListener(),I.stop()})),a.listen(R,{includeLastObservation:!1,clearSignal:b.signal}),r.manifest.addEventListener("manifestUpdate",R,b.signal),p.onUpdate(R,{emitCurrentValue:!1,clearSignal:b.signal}),h.onUpdate(R,{emitCurrentValue:!1,clearSignal:b.signal}),u.onUpdate(R,{emitCurrentValue:!1,clearSignal:b.signal}),void R();function R(){var e,n;if(!b.isUsed()){var i=a.getReference().getValue(),s=null!==(e=i.position.pending)&&void 0!==e?e:i.position.last,l=wr(r,s,a,g.getValue(),p.getValue(),h.getValue(),o),c=l.neededSegments,m=null;if(f.index.isInitialized()){if(c.length>0&&!S.isLoaded&&null!==S.segment){var E=c[0].priority;m={segment:S.segment,priority:E}}}else if(null===S.segment)ne.warn("Stream: Uninitialized index without an initialization segment");else if(S.isLoaded)ne.warn("Stream: Uninitialized index with an already loaded initialization segment");else{var k=null!==(n=i.position.pending)&&void 0!==n?n:i.position.last;m={segment:S.segment,priority:kr(d.start,k)}}var w=u.getValue();if(null===w)T.setValue({initSegment:m,segmentQueue:c});else{if(w.urgent)return ne.debug("Stream: Urgent switch, terminate now.",y),T.setValue({initSegment:null,segmentQueue:[]}),T.finish(),b.cancel(),void t.terminating();var A=c[0],R=I.getRequestedInitSegment(),x=I.getRequestedMediaSegment(),C=null===x||void 0===A||x.id!==A.segment.id?[]:[A],P=null===R?null:m;if(T.setValue({initSegment:P,segmentQueue:C}),0===C.length&&null===P)return ne.debug("Stream: No request left, terminate",y),T.finish(),b.cancel(),void t.terminating()}if(t.streamStatusUpdate({period:d,position:i.position.last,bufferType:y,imminentDiscontinuity:l.imminentDiscontinuity,isEmptyStream:!1,hasFinishedLoading:l.hasFinishedLoading,neededSegments:l.neededSegments}),!b.signal.isCancelled()){var D=v.getCurrent().UPTO_CURRENT_POSITION_CLEANUP;if(l.isBufferFull){var N=Math.max(0,s-D);N>0&&o.removeBuffer(0,N,_.signal).catch(M)}l.shouldRefreshManifest&&t.needsManifestRefresh()}}}function x(e){if(!_.isUsed()){for(var n,i=Or(e.protectionData);!(n=i()).done;){var s=n.value;f.addProtectionData(s.initDataType,s.keyId,s.initData)}if(!w){var u=f.getAllEncryptionData();if(u.length>0&&(t.encryptionDataEncountered(u.map((function(e){return l({content:r},e)}))),w=!0,_.isUsed()))return}if("init"!==e.segmentType){var d=e.inbandEvents,c=e.predictedSegments,v=e.needsManifestRefresh;if(!(void 0!==c&&f.index.addPredictedSegments(c,e.segment),!0===v&&(t.needsManifestRefresh(),_.isUsed())||void 0!==d&&d.length>0&&(t.inbandEvent(d),_.isUsed()))){var p=S.uniqueId;(function(e,t){return Nr.apply(this,arguments)})({playbackObserver:a,content:r,initSegmentUniqueId:p,parsedSegment:e,segment:e.segment,segmentBuffer:o},_.signal).then((function(e){null!==e&&t.addedSegment(e)})).catch(M)}}else{if(f.index.isInitialized()||void 0===e.segmentList||f.index.initialize(e.segmentList),S.isLoaded=!0,null!==e.initializationData){var h=f.uniqueId;S.uniqueId=h,o.declareInitSegment(h,e.initializationData),function(e,t){return Dr.apply(this,arguments)}({playbackObserver:a,content:r,initSegmentUniqueId:h,segment:e.segment,segmentData:e.initializationData,segmentBuffer:o},_.signal).then((function(e){null!==e&&t.addedSegment(e)})).catch(M)}R()}}}function M(e){_.isUsed()&&e instanceof je||(_.cancel(),t.error(e))}};function Br(e,t){for(var n=0;n<e.length;n++)if(e[n].infos.period.start>=t.start)return n>0?e[n-1]:null;return e.length>0?e[e.length-1]:null}function Fr(e,t){for(var n=0;n<e.length;n++)if(e[n].infos.period.start>t.start)return e[n];return null}function zr(e,t,n,r,i){if("lazy"===n.switchingMode)return{type:"continue",value:void 0};var a=r.getBufferedRanges();if(0===a.length)return{type:"continue",value:void 0};var o=Oe(a),s=e.start,u=null==e.end?1/0:e.end,l=Ve(o,[{start:s,end:u}]);if(0===l.length)return{type:"continue",value:void 0};r.synchronizeInventory();var d=r.getInventory(),c=function(e,t,n,r){return e.reduce((function(e,i){if(i.infos.period.id!==t.id||i.infos.adaptation.id!==n.id||!r.some((function(e){return e.id===i.infos.representation.id})))return e;var a=i.bufferedStart,o=i.bufferedEnd;return void 0===a||void 0===o||e.push({start:a,end:o}),e}),[])}(d,e,t,n.representations),f=Ke(l,c);if(0===f.length)return{type:"continue",value:void 0};var p=i.getCurrentTime(),h=i.getReadyState();if("reload"===n.switchingMode&&Pe({start:s,end:u},p)&&h>1&&!Ce(c,p))return{type:"needs-reload",value:void 0};var m="direct"===n.switchingMode,g=[],y=Br(d,e);if(null!==y&&(void 0===y.bufferedEnd||e.start-y.bufferedEnd<1)&&g.push({start:0,end:e.start+1}),!m){var _=v.getCurrent().ADAP_REP_SWITCH_BUFFER_PADDINGS,b=t.type,S=_[b].before;null==S&&(S=0);var E=_[b].after;null==E&&(E=0),g.push({start:p-S,end:p+E})}if(void 0!==e.end){var T=Fr(d,e);null!==T&&(void 0===T.bufferedStart||T.bufferedStart-e.end<1)&&g.push({start:e.end-1,end:Number.MAX_VALUE})}var k=Ke(f,g);return 0===k.length?{type:"continue",value:void 0}:m?{type:"flush-buffer",value:k}:{type:"clean-buffer",value:k}}function Vr(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Kr(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Kr(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Kr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Gr=function(e,t,n){var r=e.playbackObserver,i=e.content,a=e.options,o=e.representationEstimator,s=e.segmentBuffer,u=e.segmentFetcherCreator,d=e.wantedBufferAhead,c=e.maxVideoBufferSize,f=i.manifest,p=i.period,h=i.adaptation,g=new Ge;g.linkToSignal(n);var y,_,b=new Map,T=new E(null,g.signal),k=new E(i.representations.getValue().representations,g.signal),w=o({manifest:f,period:p,adaptation:h},T,k,r,g.signal),A=w.estimates,I=w.callbacks,R=u.createSegmentFetcher(h.type,{onRequestBegin:I.requestBegin,onRequestEnd:I.requestEnd,onProgress:I.requestProgress,onMetrics:I.metrics}),x=new E(0);return A.onUpdate((function(e){var n=e.bitrate,r=e.knownStableBitrate;a.enableFastSwitching&&x.setValueIfChanged(r),void 0!==n&&n!==y&&(y=n,ne.debug("Stream: new "+h.type+" bitrate estimate",n),t.bitrateEstimateChange({type:h.type,bitrate:n}))}),{emitCurrentValue:!0,clearSignal:g.signal}),void i.representations.onUpdate((function(e){void 0!==_&&_.cancel(),k.setValueIfChanged(e.representations),(_=new Ge).linkToSignal(g.signal),function(e,t){return M.apply(this,arguments)}(e,_.signal).catch((function(e){!0===(null==_?void 0:_.isUsed())&&Ge.isCancellationError(e)||(g.cancel(),t.error(e))}))}),{clearSignal:g.signal,emitCurrentValue:!0});function M(){return(M=qe(Qe().mark((function e(n,i){var a,o,u,l;return Qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:a=zr(p,h,n,s,r),e.t0=a.type,e.next="continue"===e.t0?4:"needs-reload"===e.t0?5:"flush-buffer"===e.t0||"clean-buffer"===e.t0?6:20;break;case 4:return e.abrupt("break",21);case 5:return e.abrupt("return",pr()((function(){r.listen((function(){if(!i.isCancelled()){var e=v.getCurrent().DELTA_POSITION_AFTER_RELOAD.bitrateSwitch;return t.waitingMediaSourceReload({bufferType:h.type,period:p,timeOffset:e,stayInPeriod:!0})}}),{includeLastObservation:!0,clearSignal:i})})));case 6:o=Vr(a.value);case 7:if((u=o()).done){e.next=15;break}return l=u.value,e.next=11,s.removeBuffer(l.start,l.end,i);case 11:if(!i.isCancelled()){e.next=13;break}return e.abrupt("return");case 13:e.next=7;break;case 15:if("flush-buffer"!==a.type){e.next=19;break}if(t.needsBufferFlush(),!i.isCancelled()){e.next=19;break}return e.abrupt("return");case 19:return e.abrupt("break",21);case 20:ke();case 21:C(i);case 22:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function C(e){var n=new Ge;n.linkToSignal(e);var r=A.getValue().representation;if(null!==r){var i=new E(null,n.signal);A.onUpdate((function(e){if(null!==e.representation&&e.representation.id!==r.id)return e.urgent?(ne.info("Stream: urgent Representation switch",h.type),i.setValue({urgent:!0})):(ne.info("Stream: slow Representation switch",h.type),i.setValue({urgent:!1}))}),{clearSignal:n.signal,emitCurrentValue:!0});var a={type:h.type,period:p,representation:r};if(T.setValue(r),!g.isUsed()&&(t.representationChange(a),!g.isUsed())){var o={streamStatusUpdate:t.streamStatusUpdate,encryptionDataEncountered:t.encryptionDataEncountered,manifestMightBeOufOfSync:t.manifestMightBeOufOfSync,needsManifestRefresh:t.needsManifestRefresh,inbandEvent:t.inbandEvent,warning:t.warning,error:function(e){g.cancel(),t.error(e)},addedSegment:function(e){I.addedSegment(e)},terminating:function(){if(!n.isUsed())return n.cancel(),C(e)}};P(r,i,o,e)}}}function P(e,n,i,o){var u=new Ge;u.linkToSignal(o);var v=S(d,(function(t){return t*function(e){var t=b.get(e.id),n=void 0!==t?t:1;void 0===t&&b.set(e.id,n);return n}(e)}),u.signal),y="video"===h.type?c:new E(1/0);ne.info("Stream: changing representation",h.type,e.id,e.bitrate);var _=l({},i,{error:function(t){var r,a=ge(t,{defaultCode:"NONE",defaultReason:"Unknown `RepresentationStream` error"});if("BUFFER_FULL_ERROR"!==a.code)i.error(t);else{var s=d.getValue(),u=.7*(null!==(r=b.get(e.id))&&void 0!==r?r:1);if(u<=.05||s*u<=2)throw a;b.set(e.id,u),In(4e3,g.signal).then((function(){return P(e,n,i,o)})).catch(m)}},terminating:function(){u.cancel(),i.terminating()}});Ur({playbackObserver:r,content:{representation:e,adaptation:h,period:p,manifest:f},segmentBuffer:s,segmentFetcher:R,terminate:n,options:{bufferGoal:v,maxBufferSize:y,drmSystemId:a.drmSystemId,fastSwitchThreshold:x}},_,o),f.addEventListener("manifestUpdate",(function(n){for(var r,i=Vr(n.updatedPeriods);!(r=i()).done;){var a=r.value;if(a.period.id===p.id)for(var s,u=Vr(a.result.updatedAdaptations);!(s=u()).done;){var l=s.value;if(l.adaptation.id===h.id)for(var d,c=Vr(l.removedRepresentations);!(d=c()).done;){if(d.value.id===e.id){if(o.isCancelled())return;return t.waitingMediaSourceReload({bufferType:h.type,period:p,timeOffset:0,stayInPeriod:!0})}}}else if(a.period.start>p.start)break}}),o)}};function Wr(e,t,n){if("function"==typeof String.prototype.startsWith)return e.startsWith(t,n);var r="number"==typeof n?Math.max(n,0):0;return e.substring(r,r+t.length)===t}var jr=function(e,t){var n=e.split(";"),r=n[0],i=n.slice(1),a=t.split(";"),o=a[0],s=a.slice(1);if(r!==o)return!1;var u=be(i,(function(e){return Wr(e,"codecs=")})),l=be(s,(function(e){return Wr(e,"codecs=")}));if(void 0===u||void 0===l)return!1;var d=u.substring(7),c=l.substring(7);return d.split(".")[0]===c.split(".")[0]};function Hr(e,t,n,r,i,a){if(void 0!==e.codec&&"reload"===a.onCodecSwitch&&!function(e,t){return e.getPlayableRepresentations().some((function(e){return jr(e.getMimeTypeString(),t)}))}(n,e.codec))return{type:"needs-reload",value:void 0};var o=e.getBufferedRanges();if(0===o.length)return{type:"continue",value:void 0};var s=Oe(o),u=t.start,l=null==t.end?1/0:t.end,d=Ve(s,[{start:u,end:l}]);if(0===d.length)return{type:"continue",value:void 0};e.synchronizeInventory();var c=e.getInventory();if(!c.some((function(e){return e.infos.period.id===t.id&&e.infos.adaptation.id!==n.id})))return{type:"continue",value:void 0};var f=function(e,t,n){return e.reduce((function(e,r){if(r.infos.period.id!==t.id||r.infos.adaptation.id!==n.id)return e;var i=r.bufferedStart,a=r.bufferedEnd;return void 0===i||void 0===a||e.push({start:i,end:a}),e}),[])}(c,t,n),p=Ke(d,f);if(0===p.length)return{type:"continue",value:void 0};var h=i.currentTime;if("reload"===r&&Pe({start:u,end:l},h)&&(i.readyState>1||!n.getPlayableRepresentations().some((function(t){var n;return jr(t.getMimeTypeString(),null!==(n=e.codec)&&void 0!==n?n:"")})))&&!Ce(f,h))return{type:"needs-reload",value:void 0};var m="direct"===r,g=[],y=Br(c,t);null!==y&&(void 0===y.bufferedEnd||t.start-y.bufferedEnd<1)&&g.push({start:0,end:t.start+1});var _=n.type,b=v.getCurrent().ADAP_REP_SWITCH_BUFFER_PADDINGS,S=b[_].before;null==S&&(S=0);var E=b[_].after;if(null==E&&(E=0),m||g.push({start:h-S,end:h+E}),void 0!==t.end){var T=Fr(c,t);null!==T&&(void 0===T.bufferedStart||T.bufferedStart-t.end<1)&&g.push({start:t.end-1,end:Number.MAX_VALUE})}var k=Ke(p,g);return 0===k.length?{type:"continue",value:void 0}:m&&"text"!==n.type?{type:"flush-buffer",value:k}:{type:"clean-buffer",value:k}}function qr(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Yr(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Yr(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Yr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Qr(e,t,n,r){var i=e.getStatus(t);if("initialized"===i.type)return ne.info("Stream: Reusing a previous SegmentBuffer for the type",t),i.value;var a=function(e){var t=e.getPlayableRepresentations();if(0===t.length){throw new ve("NO_PLAYABLE_REPRESENTATION","No Representation in the chosen "+e.type+" Adaptation can be played",{adaptations:[e]})}return t[0].getMimeTypeString()}(n),o="text"===t?r.textTrackOptions:void 0;return e.createSegmentBuffer(t,a,o)}function $r(e,t,n,r,i,a){var o=r.period,s=!1;function u(){var r=e.getReference().getValue(),a=t.getValue(),u=r.position.last;void 0!==o.end&&u+a>=o.end&&(ne.debug('Stream: full "empty" AdaptationStream',n),s=!0),i.streamStatusUpdate({period:o,bufferType:n,position:u,imminentDiscontinuity:null,isEmptyStream:!0,hasFinishedLoading:s,neededSegments:[]})}t.onUpdate(u,{emitCurrentValue:!1,clearSignal:a}),e.listen(u,{includeLastObservation:!1,clearSignal:a}),u()}var Xr=function(e,t,n){var r=e.bufferType,i=e.content,a=e.garbageCollectors,o=e.playbackObserver,s=e.representationEstimator,u=e.segmentFetcherCreator,d=e.segmentBuffersStore,c=e.options,f=e.wantedBufferAhead,p=e.maxVideoBufferSize,h=i.manifest,m=i.period,g=new E(void 0,n);if(t.periodStreamReady({type:r,manifest:h,period:m,adaptationRef:g}),!n.isCancelled()){var y,_=!0;g.onUpdate((function(e){qe(Qe().mark((function i(){var s,u,l,p,g,E,T,k,w,A,I,R,x,M,C,P,D,N;return Qe().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(void 0!==e){i.next=2;break}return i.abrupt("return");case 2:if((u=new Ge).linkToSignal(n),null==y||y.cancel(),y=u,null!==e){i.next=34;break}if(ne.info("Stream: Set no "+r+" Adaptation. P:",m.start),"initialized"!==(l=d.getStatus(r)).type){i.next=26;break}if(ne.info("Stream: Clearing previous "+r+" SegmentBuffer"),!fr.isNative(r)){i.next=15;break}return i.abrupt("return",S(0,!0,u.signal));case 15:if(p=null!==(s=m.end)&&void 0!==s?s:1/0,!(m.start>p)){i.next=20;break}ne.warn("Stream: Can't free buffer: period's start is after its end"),i.next=24;break;case 20:return i.next=22,l.value.removeBuffer(m.start,p,u.signal);case 22:if(!u.isUsed()){i.next=24;break}return i.abrupt("return");case 24:i.next=30;break;case 26:if("uninitialized"!==l.type){i.next=30;break}if(d.disableSegmentBuffer(r),!u.isUsed()){i.next=30;break}return i.abrupt("return");case 30:if(t.adaptationChange({type:r,adaptation:null,period:m}),!u.isUsed()){i.next=33;break}return i.abrupt("return");case 33:return i.abrupt("return",$r(o,f,r,{period:m},t,u.signal));case 34:if(g=v.getCurrent(),E=g.DELTA_POSITION_AFTER_RELOAD,T=_?0:"audio"===r?E.trackSwitch.audio:"video"===r?E.trackSwitch.video:E.trackSwitch.other,_=!1,!fr.isNative(r)||"disabled"!==d.getStatus(r).type){i.next=39;break}return i.abrupt("return",S(T,!0,u.signal));case 39:if(h.addEventListener("manifestUpdate",(function(e){for(var t,n=qr(e.updatedPeriods);!(t=n()).done;){var r=t.value;if(r.period.id===m.id)for(var i,a=qr(r.result.removedAdaptations);!(i=a()).done;){if(i.value.id===k.id)return S(T,!0,u.signal)}else if(r.period.start>m.start)break}}),y.signal),k=e.adaptation,w=e.representations,ne.info("Stream: Updating "+r+" adaptation","A: "+k.id,"P: "+m.start),t.adaptationChange({type:r,adaptation:k,period:m}),!u.isUsed()){i.next=45;break}return i.abrupt("return");case 45:if(A=o.getReadyState(),I=Qr(d,r,k,c),R={currentTime:o.getCurrentTime(),readyState:A},"needs-reload"!==(x=Hr(I,m,k,e.switchingMode,R,c)).type){i.next=51;break}return i.abrupt("return",S(T,!0,u.signal));case 51:return i.next=53,d.waitForUsableBuffers(u.signal);case 53:if(!u.isUsed()){i.next=55;break}return i.abrupt("return");case 55:if("flush-buffer"!==x.type&&"clean-buffer"!==x.type){i.next=69;break}M=qr(x.value);case 57:if((C=M()).done){i.next=65;break}return P=C.value,D=P.start,N=P.end,i.next=61,I.removeBuffer(D,N,u.signal);case 61:if(!u.isUsed()){i.next=63;break}return i.abrupt("return");case 63:i.next=57;break;case 65:if("flush-buffer"!==x.type){i.next=69;break}if(t.needsBufferFlush(),!u.isUsed()){i.next=69;break}return i.abrupt("return");case 69:a.get(I)(u.signal),b(k,w,I,u.signal);case 71:case"end":return i.stop()}}),i)})))().catch((function(e){e instanceof je||(null==y||y.cancel(),t.error(e))}))}),{clearSignal:n,emitCurrentValue:!0})}function b(e,n,i,a){var v=function(e,t){return e.deriveReadOnlyObserver((function(e,n){var r=new E(i(),n);return e.onUpdate(a,{clearSignal:n,emitCurrentValue:!1}),r;function i(){var n=e.getValue(),r=Be(t.getBufferedRanges(),n.position.last);return l({},n,{bufferGap:r})}function a(){r.setValue(i())}}))}(o,i);Gr({content:{manifest:h,period:m,adaptation:e,representations:n},options:c,playbackObserver:v,representationEstimator:s,segmentBuffer:i,segmentFetcherCreator:u,wantedBufferAhead:f,maxVideoBufferSize:p},Object.assign(Object.assign({},t),{error:function(e){if(!fr.isNative(r)){ne.error("Stream: "+r+" Stream crashed. Aborting it.",e instanceof Error?e:""),d.disposeSegmentBuffer(r);var n=ge(e,{defaultCode:"NONE",defaultReason:"Unknown `AdaptationStream` error"});if(t.warning(n),a.isCancelled())return;return $r(o,f,r,{period:m},t,a)}ne.error("Stream: "+r+" Stream crashed. Stopping playback.",e instanceof Error?e:""),t.error(e)}}),a)}function S(e,n,i){pr()((function(){o.listen((function(){i.isCancelled()||t.waitingMediaSourceReload({bufferType:r,period:m,timeOffset:e,stayInPeriod:n})}),{includeLastObservation:!0,clearSignal:i})}))}};function Zr(e,t){if(0===t.length)return[];e.synchronizeInventory();for(var n,r=[],i=e.getInventory(),a=function(){var e=i[o];if(t.some((function(t){return e.infos.period.id===t.period.id&&e.infos.adaptation.id===t.adaptation.id&&e.infos.representation.id===t.representation.id}))){var n=e.bufferedStart,a=e.bufferedEnd;if(void 0===n||void 0===a)return ne.warn("SO: No buffered start or end found from a segment."),{v:[{start:0,end:Number.MAX_VALUE}]};var s=r[r.length-1];void 0!==s&&s.end===n?s.end=a:r.push({start:n,end:a})}},o=0;o<i.length;o++)if(n=a())return n.v;return r}function Jr(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return ei(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ei(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ei(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ti(e,t){if(0===t.length)return!1;var n=e.position.last;return e.speed>=0?t[t.length-1].end>=n-5:t[0].start<=n+5}var ni=function(e,t,n,r,i,a,o,s){for(var u,l=e.manifest,d=e.initialPeriod,c=a.maxBufferAhead,f=a.maxBufferBehind,p=a.wantedBufferAhead,h=a.maxVideoBufferSize,m=v.getCurrent(),g=m.MAXIMUM_MAX_BUFFER_AHEAD,y=m.MAXIMUM_MAX_BUFFER_BEHIND,_=new mr((function(e){var n=e.bufferType,r=null!=y[n]?y[n]:1/0,i=null!=g[n]?g[n]:1/0;return function(n){gr({segmentBuffer:e,playbackObserver:t,maxBufferBehind:S(f,(function(e){return Math.min(e,r)}),n),maxBufferAhead:S(c,(function(e){return Math.min(e,i)}),n)},n)}})),b=Jr(r.getBufferTypes());!(u=b()).done;){E(u.value,d)}function E(e,n){var i=new hr((function(e,t){return e.start-t.start})),a=!1,u=new Ge;return u.linkToSignal(s),t.listen((function(t){var n,r,c=t.position,f=null!==(n=c.pending)&&void 0!==n?n:c.last;if(a&&function(e){var t=i.head(),n=i.last();if(null==t||null==n)return!0;return t.start>e||(null==n.end?1/0:n.end)<e}(f)){for(ne.info("Stream: Destroying all PeriodStreams due to out of bounds situation",e,f),a=!1;i.length()>0;){var v=i.get(i.length()-1);i.removeElement(v),o.periodStreamCleared({type:e,manifest:l,period:v})}u.cancel(),(u=new Ge).linkToSignal(s);var p=null!==(r=l.getPeriodForTime(f))&&void 0!==r?r:l.getNextPeriod(f);void 0!==p?d(p):ne.warn("Stream: The wanted position is not found in the Manifest.")}}),{clearSignal:s,includeLastObservation:!0}),l.addEventListener("decipherabilityUpdate",(function(e){s.isCancelled()||function(e){return c.apply(this,arguments)}(e).catch((function(e){s.isCancelled()||(u.cancel(),o.error(e))}))}),s),d(n);function d(t){var n=Object.assign(Object.assign({},o),{waitingMediaSourceReload:function(e){var t=i.head();void 0===t||t.id!==e.period.id?o.lockedStream({bufferType:e.bufferType,period:e.period}):o.needsMediaSourceReload({timeOffset:e.timeOffset,minimumPosition:e.stayInPeriod?e.period.start:void 0,maximumPosition:e.stayInPeriod?e.period.end:void 0})},periodStreamReady:function(e){a=!0,i.add(e.period),o.periodStreamReady(e)},periodStreamCleared:function(e){i.removeElement(e.period),o.periodStreamCleared(e)},error:function(e){u.cancel(),o.error(e)}});T(e,t,n,u.signal)}function c(){return c=qe(Qe().mark((function n(c){var f,v,p,h,m,g,y,_,b,S,E,T,k;return Qe().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(f=r.getStatus(e),0!==(v=c.filter((function(t){return t.adaptation.type===e}))).length&&"initialized"===f.type&&!v.every((function(e){return!0===e.representation.decipherable}))){n.next=4;break}return n.abrupt("return");case 4:for(p=f.value,h=v.filter((function(e){return void 0===e.representation.decipherable})),m=v.filter((function(e){return!1===e.representation.decipherable})),g=Zr(p,m),y=Zr(p,h),a=!1,ne.info("Stream: Destroying all PeriodStreams for decipherability matters",e);i.length()>0;)_=i.get(i.length()-1),i.removeElement(_),o.periodStreamCleared({type:e,manifest:l,period:_});u.cancel(),(u=new Ge).linkToSignal(s),b=0,S=[].concat(g,y);case 16:if(!(b<S.length)){n.next=26;break}if(E=S[b],T=E.start,k=E.end,!(T<k)){n.next=23;break}if(!s.isCancelled()){n.next=21;break}return n.abrupt("return");case 21:return n.next=23,p.removeBuffer(T,k,s);case 23:b++,n.next=16;break;case 26:pr()((function(){var e;if(!s.isCancelled()){var n=t.getReference().getValue();if(ti(n,g)){if(o.needsDecipherabilityFlush(),s.isCancelled())return}else if(ti(n,y)&&(o.needsBufferFlush(),s.isCancelled()))return;var r=null!==(e=n.position.pending)&&void 0!==e?e:n.position.last,i=l.getPeriodForTime(r);null!=i?d(i):o.error(new ve("MEDIA_TIME_NOT_FOUND","The wanted position is not found in the Manifest."))}}));case 27:case"end":return n.stop()}}),n)}))),c.apply(this,arguments)}}function T(e,s,u,d){ne.info("Stream: Creating new Stream for",e,s.start);var c=null,f=new Ge;f.linkToSignal(d),t.listen((function(t,n){var r,i,a=t.position;void 0!==s.end&&(null!==(r=a.pending)&&void 0!==r?r:a.last)>=s.end&&(ne.info("Stream: Destroying PeriodStream as the current playhead moved above it",e,s.start,null!==(i=a.pending)&&void 0!==i?i:a.last,s.end),n(),u.periodStreamCleared({type:e,manifest:l,period:s}),f.cancel())}),{clearSignal:d,includeLastObservation:!0});var v,m={bufferType:e,content:{manifest:l,period:s},garbageCollectors:_,maxVideoBufferSize:h,segmentFetcherCreator:i,segmentBuffersStore:r,options:a,playbackObserver:t,representationEstimator:n,wantedBufferAhead:p},g=Object.assign(Object.assign({},u),{streamStatusUpdate:function(t){if(t.hasFinishedLoading){var n=l.getPeriodAfter(s);null!==n&&function(t){if(null!==c){if(c.period.id===t.id)return;ne.warn("Stream: Creating next `PeriodStream` while one was already created.",e,t.id,c.period.id),u.periodStreamCleared({type:e,manifest:l,period:c.period}),c.canceller.cancel()}var n=new Ge;n.linkToSignal(d),c={canceller:n,period:t},T(e,t,u,c.canceller.signal)}(n)}else null!==c&&(ne.info("Stream: Destroying next PeriodStream due to current one being active",e,c.period.start),u.periodStreamCleared({type:e,manifest:l,period:c.period}),c.canceller.cancel(),c=null);u.streamStatusUpdate(t)},error:function(e){null!==c&&(c.canceller.cancel(),c=null),f.cancel(),u.error(e)}});Xr(m,g,f.signal),v=f.signal,l.addEventListener("manifestUpdate",(function(t){for(var n,r=Jr(t.removedPeriods);!(n=r()).done;){var i=n.value;if(i.id===s.id){if(l.periods.length>0&&l.periods[0].start<=i.start)return pr()((function(){if(!v.isCancelled())return o.needsMediaSourceReload({timeOffset:0,minimumPosition:void 0,maximumPosition:void 0})}))}else if(i.start>s.start)break}if(t.addedPeriods.length>0&&null!==c){var a=l.getPeriodAfter(s);null!==a&&c.period.id===a.id||(ne.warn("Stream: Destroying next PeriodStream due to new one being added",e,c.period.start),u.periodStreamCleared({type:e,manifest:l,period:c.period}),c.canceller.cancel(),c=null)}}),v)}},ri=ni,ii=function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t}(we);function ai(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return oi(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return oi(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function oi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var si=function(e){function t(t,n,r){var i;(i=e.call(this)||this)._canceller=new Ge,i._manifest=t,i._activeStreams=new Map,i._allBufferTypes=r,i._lastCurrentPeriodId=null;var a=new ui(t);i._maximumPositionCalculator=a;var o=i._canceller.signal;return n.listen((function(e){var n,r=e.position,o=null!==(n=r.pending)&&void 0!==n?n:r.last;if(o<t.getMinimumSafePosition()){var s=new ve("MEDIA_TIME_BEFORE_MANIFEST","The current position is behind the earliest time announced in the Manifest.");i.trigger("warning",s)}else if(o>a.getMaximumAvailablePosition()){var u=new ve("MEDIA_TIME_AFTER_MANIFEST","The current position is after the latest time announced in the Manifest.");i.trigger("warning",u)}}),{includeLastObservation:!0,clearSignal:o}),t.addEventListener("manifestUpdate",(function(){i.trigger("durationUpdate",i._getManifestDuration()),o.isCancelled()||i._checkEndOfStream()}),o),i}s(t,e);var n=t.prototype;return n.getCurrentDuration=function(){return this._getManifestDuration()},n.onAdaptationChange=function(e,t,n){if(this._manifest.isLastPeriodKnown){var r=this._manifest.periods[this._manifest.periods.length-1];if(t.id===(null==r?void 0:r.id)&&("audio"===e||"video"===e)){"audio"===e?this._maximumPositionCalculator.updateLastAudioAdaptation(n):this._maximumPositionCalculator.updateLastVideoAdaptation(n);var i=this._maximumPositionCalculator.getEndingPosition(),a=void 0!==i?{isEnd:!0,duration:i}:{isEnd:!1,duration:this._maximumPositionCalculator.getMaximumAvailablePosition()};this.trigger("durationUpdate",a)}}this._canceller.isUsed()||null===n&&this._addActivelyLoadedPeriod(t,e)},n.onRepresentationChange=function(e,t){this._addActivelyLoadedPeriod(t,e)},n.onPeriodCleared=function(e,t){this._removeActivelyLoadedPeriod(t,e)},n.onLastSegmentFinishedLoading=function(e){var t=this._lazilyCreateActiveStreamInfo(e);t.hasFinishedLoadingLastPeriod||(t.hasFinishedLoadingLastPeriod=!0,this._checkEndOfStream())},n.onLastSegmentLoadingResume=function(e){var t=this._lazilyCreateActiveStreamInfo(e);t.hasFinishedLoadingLastPeriod&&(t.hasFinishedLoadingLastPeriod=!1,this._checkEndOfStream())},n.dispose=function(){this.removeEventListener(),this._canceller.cancel()},n._addActivelyLoadedPeriod=function(e,t){var n=this._lazilyCreateActiveStreamInfo(t);n.activePeriods.has(e)||(n.activePeriods.add(e),this._checkCurrentPeriod())},n._removeActivelyLoadedPeriod=function(e,t){var n=this._activeStreams.get(t);void 0!==n&&n.activePeriods.has(e)&&(n.activePeriods.removeElement(e),this._checkCurrentPeriod())},n._checkCurrentPeriod=function(){var e=this;if(0!==this._allBufferTypes.length){var t=this._activeStreams.get(this._allBufferTypes[0]);if(void 0!==t)for(var n,r,i=function(){for(var t=r.value,n=!0,i=1;i<e._allBufferTypes.length;i++){var a=e._activeStreams.get(e._allBufferTypes[i]);if(void 0===a)return{v:void 0};if(!a.activePeriods.toArray().some((function(e){return e.id===t.id}))){n=!1;break}}if(n)return e._lastCurrentPeriodId!==t.id&&(e._lastCurrentPeriodId=t.id,e.trigger("periodChange",t)),{v:void 0}},a=ai(t.activePeriods.toArray());!(r=a()).done;)if(n=i())return n.v}},n._getManifestDuration=function(){var e=this._maximumPositionCalculator.getEndingPosition();return void 0!==e?{isEnd:!0,duration:e}:{isEnd:!1,duration:this._maximumPositionCalculator.getMaximumAvailablePosition()}},n._lazilyCreateActiveStreamInfo=function(e){var t=this._activeStreams.get(e);return void 0===t&&(t={activePeriods:new hr((function(e,t){return e.start-t.start})),hasFinishedLoadingLastPeriod:!1},this._activeStreams.set(e,t)),t},n._checkEndOfStream=function(){var e=this;this._manifest.isLastPeriodKnown&&(this._allBufferTypes.every((function(t){var n=e._activeStreams.get(t);return void 0!==n&&n.hasFinishedLoadingLastPeriod}))?this.trigger("endOfStream",null):this.trigger("resumeStream",null))},t}(we),ui=function(){function e(e){this._manifest=e,this._lastAudioAdaptation=void 0,this._lastVideoAdaptation=void 0}var t=e.prototype;return t.updateLastAudioAdaptation=function(e){this._lastAudioAdaptation=e},t.updateLastVideoAdaptation=function(e){this._lastVideoAdaptation=e},t.getMaximumAvailablePosition=function(){var e;if(this._manifest.isDynamic)return null!==(e=this._manifest.getLivePosition())&&void 0!==e?e:this._manifest.getMaximumSafePosition();if(void 0===this._lastVideoAdaptation||void 0===this._lastAudioAdaptation)return this._manifest.getMaximumSafePosition();if(null===this._lastAudioAdaptation){if(null===this._lastVideoAdaptation)return this._manifest.getMaximumSafePosition();var t=li(this._lastVideoAdaptation);return"number"!=typeof t?this._manifest.getMaximumSafePosition():t}if(null===this._lastVideoAdaptation){var n=li(this._lastAudioAdaptation);return"number"!=typeof n?this._manifest.getMaximumSafePosition():n}var r=li(this._lastAudioAdaptation),i=li(this._lastVideoAdaptation);return"number"!=typeof r||"number"!=typeof i?this._manifest.getMaximumSafePosition():Math.min(r,i)},t.getEndingPosition=function(){var e,t;if(!this._manifest.isDynamic)return this.getMaximumAvailablePosition();if(void 0!==this._lastVideoAdaptation&&void 0!==this._lastAudioAdaptation){if(null===this._lastAudioAdaptation)return null===this._lastVideoAdaptation?void 0:null!==(e=di(this._lastVideoAdaptation))&&void 0!==e?e:void 0;if(null===this._lastVideoAdaptation)return null!==(t=di(this._lastAudioAdaptation))&&void 0!==t?t:void 0;var n=di(this._lastAudioAdaptation),r=di(this._lastVideoAdaptation);return"number"!=typeof n||"number"!=typeof r?void 0:Math.min(n,r)}},e}();function li(e){for(var t,n=e.representations,r=null,i=0;i<n.length;i++)if(n[i].index!==t){t=n[i].index;var a=n[i].index.getLastAvailablePosition();if(void 0===a)return;null!==a&&(r=h(r)?a:Math.min(r,a))}return r}function di(e){for(var t,n=e.representations,r=null,i=0;i<n.length;i++)if(n[i].index!==t){t=n[i].index;var a=n[i].index.getEnd();if(void 0===a)return;null!==a&&(r=h(r)?a:Math.min(r,a))}return r}function ci(e){var t=e.textTracks;if(!h(t)){for(var n=0;n<t.length;n++)t[n].mode="disabled";if(e.hasChildNodes())for(var r=e.childNodes,i=r.length-1;i>=0;i--)if("track"===r[i].nodeName)try{e.removeChild(r[i])}catch(e){ne.warn("Compat: Could not remove text track child from element.")}}e.src="",e.removeAttribute("src")}function fi(e,t,n){if(null!==t&&"closed"!==t.readyState){for(var r=t.readyState,i=t.sourceBuffers,a=i.length-1;a>=0;a--){var o=i[a];try{"open"===r&&(ne.info("Init: Aborting SourceBuffer before removing"),o.abort()),ne.info("Init: Removing SourceBuffer from mediaSource"),t.removeSourceBuffer(o)}catch(e){ne.warn("Init: Error while disposing SourceBuffer",e instanceof Error?e:"")}}i.length>0&&ne.warn("Init: Not all SourceBuffers could have been removed.")}if(ne.info("Init: Clearing HTMLMediaElement's src"),ci(e),null!==n)try{ne.debug("Init: Revoking previous URL"),URL.revokeObjectURL(n)}catch(e){ne.warn("Init: Error while revoking the media source URL",e instanceof Error?e:"")}}function vi(e,t){return xt(t,(function(n){var r=function(e,t){if(null==rn)throw new ve("MEDIA_SOURCE_NOT_SUPPORTED","No MediaSource Object was found in the current browser.");var n=p(e.src)?e.src:null;fi(e,null,n),ne.info("Init: Creating MediaSource");var r=new rn,i=URL.createObjectURL(r);return ne.info("Init: Attaching MediaSource URL to the media element",i),e.src=i,t.register((function(){fi(e,r,i)})),r}(e,t);x(r,(function(){ne.info("Init: MediaSource opened"),n(r)}),t)}))}function pi(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return hi(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return hi(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function hi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var mi,gi=D,yi=x,_i=P;function bi(e,t){if(ne.debug("Init: Trying to call endOfStream"),"open"===e.readyState){var n=e.sourceBuffers,r=function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n];r.updating&&t.push(r)}return t}(n);if(0===r.length)return ne.info("Init: Triggering end of stream"),void e.endOfStream();ne.debug("Init: Waiting SourceBuffers to be updated before calling endOfStream.");var i=new Ge;i.linkToSignal(t);for(var a,o=pi(r);!(a=o()).done;){var s=a.value;_i(s,(function(){i.cancel(),bi(e,t)}),i.signal)}gi(n,(function(){i.cancel(),bi(e,t)}),i.signal)}else ne.debug("Init: MediaSource not open, cancel endOfStream")}function Si(e,t,n){if(!h(n)){var r,i=e.getMinimumSafePosition();if(e.isLive&&(r=e.getLivePosition()),void 0===r&&(r=e.getMaximumSafePosition()),!h(n.position))return ne.debug("Init: using startAt.minimumPosition"),Math.max(Math.min(n.position,r),i);if(!h(n.wallClockTime)){ne.debug("Init: using startAt.wallClockTime");var a=void 0===e.availabilityStartTime?0:e.availabilityStartTime,o=n.wallClockTime-a;return Math.max(Math.min(o,r),i)}if(!h(n.fromFirstPosition)){ne.debug("Init: using startAt.fromFirstPosition");var s=n.fromFirstPosition;return s<=0?i:Math.min(r,i+s)}if(!h(n.fromLastPosition)){ne.debug("Init: using startAt.fromLastPosition");var u=n.fromLastPosition;return u>=0?r:Math.max(i,r+u)}if(!h(n.percentage)){ne.debug("Init: using startAt.percentage");var l=n.percentage;return l>100?r:l<0?i:i+(r-i)*(+l/100)}}var d=e.getMinimumSafePosition();if(e.isLive){var c,f=e.suggestedPresentationDelay,p=e.clockOffset,m=e.getMaximumSafePosition(),g=v.getCurrent().DEFAULT_LIVE_GAP;if(void 0===p)ne.info("Init: no clock offset found for a live content, starting close to maximum available position"),c=m;else{ne.info("Init: clock offset found for a live content, checking if we can start close to it");var y=void 0===e.availabilityStartTime?0:e.availabilityStartTime,_=(at()+p)/1e3-y;c=Math.min(m,_)}var b=void 0!==f?f:t?g.LOW_LATENCY:g.DEFAULT;return ne.debug("Init: "+c+" defined as the live time, applying a live gap of "+b),Math.max(c-b,d)}return ne.info("Init: starting at the minimum available position:",d),d}function Ei(){return X}function Ti(e,t,n,r){var i=new Ge;i.linkToSignal(r);var a=new E(!1,i.signal);return e.listen((function(e){if(null===e.rebuffering&&null===e.freezing&&0!==e.readyState){if(!function(e,t){return!e||!$||t}(n,t.hasAttribute("playsinline"))&&t.duration>0)return a.setValue(!0),void i.cancel();var r=te?4:3;return e.readyState>=r&&null!==e.currentRange&&(!Ei()||t.duration>0)?(a.setValue(!0),void i.cancel()):void 0}}),{includeLastObservation:!0,clearSignal:i.signal}),a}function ki(e,t,n,r,i,a){var o,s,u=new Promise((function(e,t){o=e,s=t})),l=new E(!1,a),d=new E(!1,a);e.addEventListener("loadedmetadata",f);var c=a.register((function(t){e.removeEventListener("loadedmetadata",f),s(t)}));return e.readyState>=an&&f(),{autoPlayResult:u,initialPlayPerformed:d,initialSeekPerformed:l};function f(){e.removeEventListener("loadedmetadata",f);var u="function"==typeof n?n():n;if(ne.info("Init: Set initial time",u),t.setCurrentTime(u),l.setValue(!0),l.finish(),Ei()&&0===e.duration){var v=new ve("MEDIA_ERR_NOT_LOADED_METADATA","Cannot load automatically: your browser falsely announced having loaded the content.");i(v)}a.isCancelled()||t.listen((function(t,n){!t.seeking&&null===t.rebuffering&&t.readyState>=1&&(n(),function(){var t,n;if(ne.info("Init: Can begin to play content"),!r)return e.autoplay&&ne.warn("Init: autoplay is enabled on HTML media element. Media will play as soon as possible."),d.setValue(!0),d.finish(),c(),o({type:"skipped"});try{n=null!==(t=e.play())&&void 0!==t?t:Promise.resolve()}catch(e){return c(),s(e)}n.then((function(){if(!a.isCancelled())return d.setValue(!0),d.finish(),c(),o({type:"autoplay"})})).catch((function(e){if(c(),!a.isCancelled()){if(e instanceof Error&&"NotAllowedError"===e.name){ne.warn("Init: Media element can't play. It may be due to browser auto-play policies.");var t=new ve("MEDIA_ERR_BLOCKED_AUTOPLAY","Cannot trigger auto-play automatically: your browser does not allow it.");if(i(t),a.isCancelled())return;return o({type:"autoplay-blocked"})}s(e)}}))}())}),{includeLastObservation:!0,clearSignal:a})}}function wi(e,t,n,r,i){if(0===t.length)return l("No `keySystems` option given.");if(null===_e.decrypt)return l("EME feature not activated.");var a=new Ge;a.linkToSignal(i);var o=new E({initializationState:{type:"uninitialized",value:null},drmSystemId:void 0},i),s=_e.decrypt;if(!s.hasEmeApis())return l("EME API not available on the current page.");ne.debug("Init: Creating ContentDecryptor");var u=new s(e,t);return u.addEventListener("stateChange",(function(e){if(e===mi.WaitingForAttachment){var t=new E(!1);t.onUpdate((function(t,n){t&&(n(),e===mi.WaitingForAttachment&&u.attach())}),{clearSignal:a.signal}),o.setValue({initializationState:{type:"awaiting-media-link",value:{isMediaLinked:t}},drmSystemId:u.systemId})}else e===mi.ReadyForContent&&(o.setValue({initializationState:{type:"initialized",value:null},drmSystemId:u.systemId}),u.removeEventListener("stateChange"))})),u.addEventListener("error",(function(e){a.cancel(),r.onError(e)})),u.addEventListener("warning",(function(e){r.onWarning(e)})),n.onUpdate((function(e){null!==e&&u.onInitializationData(e)}),{clearSignal:a.signal}),a.signal.register((function(){u.dispose()})),o;function l(e){n.onUpdate((function(t,n){if(null!==t){n();var i=new fe("MEDIA_IS_ENCRYPTED_ERROR",e);r.onError(i)}}),{clearSignal:i});var t=new E({initializationState:{type:"initialized",value:null},drmSystemId:void 0});return t.finish(),t}}!function(e){e[e.Initializing=0]="Initializing",e[e.WaitingForAttachment=1]="WaitingForAttachment",e[e.ReadyForContent=2]="ReadyForContent",e[e.Error=3]="Error",e[e.Disposed=4]="Disposed"}(mi||(mi={}));var Ai=31536e3,Ii=function(){function e(e){this._mediaSource=e,this._currentMediaSourceDurationUpdateCanceller=null}var t=e.prototype;return t.updateDuration=function(e,t){null!==this._currentMediaSourceDurationUpdateCanceller&&this._currentMediaSourceDurationUpdateCanceller.cancel(),this._currentMediaSourceDurationUpdateCanceller=new Ge;var n=this._mediaSource,r=this._currentMediaSourceDurationUpdateCanceller.signal,i=function(e,t){var n=new E("open"===e.readyState,t);return x(e,(function(){ne.debug("Init: Reacting to MediaSource open in duration updater"),n.setValueIfChanged(!0)}),t),C(e,(function(){ne.debug("Init: Reacting to MediaSource ended in duration updater"),n.setValueIfChanged(!1)}),t),M(e,(function(){ne.debug("Init: Reacting to MediaSource close in duration updater"),n.setValueIfChanged(!1)}),t),n}(n,r),a=new Ge;a.linkToSignal(r),i.onUpdate((function(){if(a.cancel(),!i.getValue())return;(a=new Ge).linkToSignal(r);var o=function(e,t){if(0===e.length){var n=new E(!1);return n.finish(),n}var r=new E(!1,t);o();for(var i=function(){var n=e[a];n.addEventListener("updatestart",o),n.addEventListener("update",o),t.register((function(){n.removeEventListener("updatestart",o),n.removeEventListener("update",o)}))},a=0;a<e.length;a++)i();return r;function o(){for(var t=0;t<e.length;t++){if(e[t].updating)return void r.setValueIfChanged(!0)}r.setValueIfChanged(!1)}}(n.sourceBuffers,a.signal),s=new Ge;return s.linkToSignal(a.signal),o.onUpdate((function(r){s.cancel(),(s=new Ge).linkToSignal(a.signal),r||xi(n,e,t,s.signal)}),{clearSignal:a.signal,emitCurrentValue:!0})}),{emitCurrentValue:!0,clearSignal:r})},t.stopUpdating=function(){null!==this._currentMediaSourceDurationUpdateCanceller&&(this._currentMediaSourceDurationUpdateCanceller.cancel(),this._currentMediaSourceDurationUpdateCanceller=null)},e}();function Ri(e,t,n){var r=t;n||(r=te?1/0:Mi(t));for(var i=0,a=0;a<e.sourceBuffers.length;a++){var o=e.sourceBuffers[a],s=o.buffered.length;s>0&&(i=Math.max(o.buffered.end(s-1)))}if(r===e.duration)return"success";if(i>r){if(i<e.duration)try{ne.info("Init: Updating duration to what is currently buffered",i),e.duration=i}catch(e){return ne.warn("Duration Updater: Can't update duration on the MediaSource.",e instanceof Error?e:""),"failed"}return"partial"}var u=e.duration;try{if(ne.info("Init: Updating duration",r),e.duration=r,"open"===e.readyState&&!isFinite(r)){var l=Mi(t);ne.info("Init: calling `mediaSource.setLiveSeekableRange`",l),e.setLiveSeekableRange(0,l)}}catch(e){return ne.warn("Duration Updater: Can't update duration on the MediaSource.",e instanceof Error?e:""),"failed"}var d=Math.abs(e.duration-r);return d>=.1?d<Math.abs(e.duration-u)?"partial":"failed":"success"}function xi(e,t,n,r){if("success"!==Ri(e,t,n))var i=setTimeout((function(){a(),xi(e,t,n,r)}),2e3),a=r.register((function(){clearTimeout(i)}))}function Mi(e){return Math.max(Math.pow(2,32),e+Ai)}var Ci=Z;function Pi(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Di(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Di(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Di(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Ni=1/60,Oi=function(e){function t(t,n,r,i){var a;return(a=e.call(this)||this)._playbackObserver=t,a._manifest=n,a._segmentBuffersStore=r,a._speed=i,a._discontinuitiesStore=[],a._isStarted=!1,a._canceller=new Ge,a._currentFreezeTimestamp=null,a}s(t,e);var n=t.prototype;return n.start=function(){var e=this;if(!this._isStarted){var t;this._isStarted=!0;var n=null,r=new Bi(this._playbackObserver,this._speed);this._canceller.signal.register((function(){r.dispose()}));var i=null;this._playbackObserver.listen((function(a){var o,s=e._discontinuitiesStore,u=a.buffered,l=a.position,d=a.readyState,c=a.rebuffering,f=a.freezing,p=v.getCurrent(),h=p.BUFFER_DISCONTINUITY_THRESHOLD,m=p.FORCE_DISCONTINUITY_SEEK_DELAY,g=p.FREEZING_STALLED_DELAY,y=p.UNFREEZING_SEEK_DELAY,_=p.UNFREEZING_DELTA_POSITION;if(!a.seeking&&Ci&&null===n&&null!==t&&a.position<t){ne.debug("Init: the device appeared to have seeked back by itself.");var b=at();n=b}if(t=a.seeking?Math.max(null!==(o=a.pendingInternalSeek)&&void 0!==o?o:0,a.position):null,!e._checkDecipherabilityFreeze(a)){if(null!==f){var S=at();if(S-(null===i?f.timestamp:i.attemptTimestamp)>y&&(ne.warn("Init: trying to seek to un-freeze player"),e._playbackObserver.setCurrentTime(e._playbackObserver.getCurrentTime()+_),i={attemptTimestamp:S}),S-f.timestamp>g)return null===c||null!==n?r.stopRebuffering():r.startRebuffering(),void e.trigger("stalled","freezing")}else i=null;var E;if(null===c)return r.stopRebuffering(),1===d?(E=a.seeking?null!==a.pendingInternalSeek?"internal-seek":"seeking":"not-ready",void e.trigger("stalled",E)):void e.trigger("unstalled",null);var T="seeking"===c.reason&&null!==a.pendingInternalSeek?"internal-seek":c.reason;if(null!==n){var k=at();if(k-n<m)return r.stopRebuffering(),ne.debug("Init: letting the device get out of a stall by itself"),void e.trigger("stalled",T);ne.warn("Init: ignored stall for too long, considering it",k-n)}if(n=null,r.startRebuffering(),null!==e._manifest){var w=c.position;if(null!=w&&e._speed.getValue()>0){var A=function(e,t,n){if(0===e.length)return null;for(var r=null,i=0;i<e.length;i++){var a=e[i].period;if(a.start>n)return r;var o=void 0;if(void 0===a.end||a.end>n){var s=e[i],u=s.discontinuity,l=s.position,d=u.start,c=u.end;if(n>=(null!=d?d:l)-Ni)if(null===c){var f=t.getPeriodAfter(a);null!==f?o=f.start+Ni:ne.warn("Init: discontinuity at Period's end but no next Period")}else n<c+Ni&&(o=c+Ni);void 0!==o&&(ne.info("Init: discontinuity found",n,o),r=null!==r&&r>o?r:o)}}return r}(s,e._manifest,w);if(null!==A){var I=A+.001;if(!(I<=e._playbackObserver.getCurrentTime()))return ne.warn("SA: skippable discontinuity found in the stream",l,I),e._playbackObserver.setCurrentTime(I),void e.trigger("warning",Ui(w,I));ne.info("Init: position to seek already reached, no seeking",e._playbackObserver.getCurrentTime(),I)}}var R=null!=w?w:l,x=function(e,t){for(var n=e.length,r=0;r<n;r++){var i=e.start(r);if(t<i)return i-t}return 1/0}(u,R);if(e._speed.getValue()>0&&x<h){var M=R+x+Ni;if(e._playbackObserver.getCurrentTime()<M)return ne.warn("Init: discontinuity encountered inferior to the threshold",R,M,h),e._playbackObserver.setCurrentTime(M),void e.trigger("warning",Ui(R,M))}for(var C=e._manifest.periods.length-2;C>=0;C--){var P=e._manifest.periods[C];if(void 0!==P.end&&P.end<=R){if(e._manifest.periods[C+1].start>R&&e._manifest.periods[C+1].start>e._playbackObserver.getCurrentTime()){var D=e._manifest.periods[C+1];return e._playbackObserver.setCurrentTime(D.start),void e.trigger("warning",Ui(R,D.start))}break}}e.trigger("stalled",T)}else e.trigger("stalled",T)}}),{includeLastObservation:!0,clearSignal:this._canceller.signal})}},n.updateDiscontinuityInfo=function(e){this._isStarted||this.start();var t=this._playbackObserver.getReference().getValue();!function(e,t,n){for(;e.length>0&&void 0!==e[0].period.end&&e[0].period.end+10<n.position;)e.shift();var r=t.period,i=t.bufferType;if("audio"!==i&&"video"!==i)return;for(var a=0;a<e.length;a++)if(e[a].period.id===r.id){if(e[a].bufferType===i)return void(Li(t)?e[a]=t:e.splice(a,1))}else if(e[a].period.start>r.start)return void(Li(t)&&e.splice(a,0,t));Li(t)&&e.push(t)}(this._discontinuitiesStore,e,t)},n.onLockedStream=function(e,t){var n;this._isStarted||this.start();var r=this._playbackObserver.getReference().getValue();if(!(!r.rebuffering||r.paused||this._speed.getValue()<=0||"audio"!==e&&"video"!==e)){var i=r.position,a=null!==(n=r.rebuffering.position)&&void 0!==n?n:i,o=t.start;i<o&&Math.abs(a-o)<1&&(ne.warn("Init: rebuffering because of a future locked stream.\nTrying to unlock by seeking to the next Period"),this._playbackObserver.setCurrentTime(o+.001))}},n.destroy=function(){this._canceller.cancel()},n._checkDecipherabilityFreeze=function(e){var t=e.readyState,n=e.rebuffering,r=e.freezing,i=void 0!==e.bufferGap&&isFinite(e.bufferGap)?e.bufferGap:0;if(null===this._segmentBuffersStore||i<6||null===n&&null===r||t>1)return this._currentFreezeTimestamp=null,!1;var a=at();null===this._currentFreezeTimestamp&&(this._currentFreezeTimestamp=a);var o=null!==n&&a-n.timestamp>4e3,s=null!==r&&a-r.timestamp>4e3;if((o||s)&&at()-this._currentFreezeTimestamp>4e3){for(var u=!0,l=!0,d=0,c=[this._segmentBuffersStore.getStatus("audio"),this._segmentBuffersStore.getStatus("video")];d<c.length;d++){var f=c[d];if("initialized"===f.type)for(var v,p=Pi(f.value.getInventory());!(v=p()).done;){var h=v.value.infos.representation;if(!1===h.decipherable)return ne.warn("Init: we have undecipherable segments left in the buffer, reloading"),this._currentFreezeTimestamp=null,this.trigger("needsReload",null),!0;void 0!==h.contentProtections&&(l=!1,!0!==h.decipherable&&(u=!1))}}if(!l&&u)return ne.warn("Init: we are frozen despite only having decipherable segments left in the buffer, reloading"),this._currentFreezeTimestamp=null,this.trigger("needsReload",null),!0}return!1},t}(we);function Li(e){return null!==e.discontinuity}function Ui(e,t){return new ve("DISCONTINUITY_ENCOUNTERED","A discontinuity has been encountered at position "+String(e)+", seeked at position "+String(t))}var Bi=function(){function e(e,t){this._speedUpdateCanceller=new Ge,this._isRebuffering=!1,this._playbackObserver=e,this._isDisposed=!1,this._speed=t,this._updateSpeed()}var t=e.prototype;return t.startRebuffering=function(){this._isRebuffering||this._isDisposed||(this._isRebuffering=!0,this._speedUpdateCanceller.cancel(),ne.info("Init: Pause playback to build buffer"),this._playbackObserver.setPlaybackRate(0))},t.stopRebuffering=function(){this._isRebuffering&&!this._isDisposed&&(this._isRebuffering=!1,this._speedUpdateCanceller=new Ge,this._updateSpeed())},t.dispose=function(){this._speedUpdateCanceller.cancel(),this._isDisposed=!0},t._updateSpeed=function(){var e=this;this._speed.onUpdate((function(t){ne.info("Init: Resume playback speed",t),e._playbackObserver.setPlaybackRate(t)}),{clearSignal:this._speedUpdateCanceller.signal,emitCurrentValue:!0})},e}();var Fi=function(e,t){return e.id===t.id&&e.start===t.start&&e.end===t.end};var zi=function(e,t){for(var n=[],r=t.periods,i=0;i<r.length;i++){r[i].streamEvents.forEach((function(t){for(var r=t.start,i=t.end,a=t.id,o=t.data,s=0;s<e.length;s++){var u=e[s];if(Fi(u,{id:a,start:r,end:i}))return void n.push(u)}var l=o.value.element,d={type:o.type,value:Object.assign(Object.assign({},o.value),{element:l})};if(void 0===i){var c={start:r,id:a,data:d,publicEvent:{start:r,data:d}};n.push(c)}else{var f={start:r,end:i,id:a,data:d,publicEvent:{start:r,end:i,data:d}};n.push(f)}}))}return n};function Vi(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Ki(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ki(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Ki(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Gi=function(e){function t(t,n,r){var i;return(i=e.call(this)||this)._manifest=t,i._mediaElement=n,i._playbackObserver=r,i._canceller=null,i._scheduledEventsRef=new E([]),i._eventsBeingPlayed=new WeakMap,i}s(t,e);var n=t.prototype;return n.start=function(){var e=this;if(null===this._canceller){this._canceller=new Ge;var t=this._canceller.signal,n=this._playbackObserver,r=this._mediaElement,i=!1,a=new Ge;a.linkToSignal(t),this._manifest.addEventListener("manifestUpdate",(function(){var t=e._scheduledEventsRef.getValue();e._scheduledEventsRef.setValue(zi(t,e._manifest))}),this._canceller.signal),this._scheduledEventsRef.setValue(zi([],this._manifest)),this._scheduledEventsRef.onUpdate((function(o){if(0!==o.length){if(!i){i=!0;var s=c(),u=function(){var t=c();e._emitStreamEvents(e._scheduledEventsRef.getValue(),s,t,a.signal),s=t},l=v.getCurrent().STREAM_EVENT_EMITTER_POLL_INTERVAL,d=setInterval(u,l);n.listen(u,{includeLastObservation:!1,clearSignal:a.signal}),a.signal.register((function(){clearInterval(d)}))}}else i&&(a.cancel(),(a=new Ge).linkToSignal(t),i=!1);function c(){var e=n.getReference().getValue().seeking;return{currentTime:r.currentTime,isSeeking:e}}}),{emitCurrentValue:!0,clearSignal:t})}},n.stop=function(){null!==this._canceller&&(this._canceller.cancel(),this._canceller=null)},n._emitStreamEvents=function(e,t,n,r){for(var i=t.currentTime,a=n.isSeeking,o=n.currentTime,s=[],u=[],l=0;l<e.length;l++){var d=e[l],c=d.start,f=Wi(d)?d.end:void 0;this._eventsBeingPlayed.has(d)?(c>o||void 0!==f&&o>=f)&&(Wi(d)&&u.push(d.publicEvent),this._eventsBeingPlayed.delete(d)):c<=o&&void 0!==f&&o<f?(s.push({type:"stream-event",value:d.publicEvent}),this._eventsBeingPlayed.set(d,!0)):i<c&&o>=(null!=f?f:c)&&(a?s.push({type:"stream-event-skip",value:d.publicEvent}):(s.push({type:"stream-event",value:d.publicEvent}),Wi(d)&&u.push(d.publicEvent)))}if(s.length>0)for(var v,p=Vi(s);!(v=p()).done;){var h=v.value;if("stream-event"===h.type?this.trigger("event",h.value):this.trigger("eventSkip",h.value),r.isCancelled())return}if(u.length>0)for(var m,g=Vi(u);!(m=g()).done;){var y=m.value;if("function"==typeof y.onExit&&y.onExit(),r.isCancelled())return}},t}(we);function Wi(e){return void 0!==e.end}var ji=Gi;function Hi(e,t,n){function r(){var n,r,i=e.error;switch(h(i)||(n=i.code,r=i.message),n){case 1:return t(new ve("MEDIA_ERR_ABORTED",r=null!=r?r:"The fetching of the associated resource was aborted by the user's request."));case 2:return t(new ve("MEDIA_ERR_NETWORK",r=null!=r?r:"A network error occurred which prevented the media from being successfully fetched"));case 3:return t(new ve("MEDIA_ERR_DECODE",r=null!=r?r:"An error occurred while trying to decode the media resource"));case 4:return t(new ve("MEDIA_ERR_SRC_NOT_SUPPORTED",r=null!=r?r:"The media resource has been found to be unsuitable."));default:return t(new ve("MEDIA_ERR_UNKNOWN",r=null!=r?r:"The HTMLMediaElement errored due to an unknown reason."))}}n.isCancelled()||(e.addEventListener("error",r),n.register((function(){e.removeEventListener("error",r)})))}function qi(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Yi(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Yi(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Yi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Qi=function(e){function t(t){var n;(n=e.call(this)||this)._settings=t,n._initCanceller=new Ge,n._initialManifestProm=null;var r=void 0===t.url?void 0:[t.url];return n._manifestFetcher=new Ln(r,t.transport,t.manifestRequestSettings),n}s(t,e);var n=t.prototype;return n.prepare=function(){var e=this;null===this._initialManifestProm&&(this._initialManifestProm=xt(this._initCanceller.signal,(function(t,n){e._manifestFetcher.addEventListener("warning",(function(t){return e.trigger("warning",t)})),e._manifestFetcher.addEventListener("error",(function(t){e.trigger("error",t),n(t)})),e._manifestFetcher.addEventListener("manifestReady",(function(e){t(e)}))})),this._manifestFetcher.start(),this._initCanceller.signal.register((function(){e._manifestFetcher.dispose()})))},n.start=function(e,t){var n=this;this.prepare(),Hi(e,(function(e){return n._onFatalError(e)}),this._initCanceller.signal);var r=new E(null,this._initCanceller.signal);this._initializeMediaSourceAndDecryption(e,r).then((function(i){return n._onInitialMediaSourceReady(e,i.mediaSource,t,i.drmSystemId,r,i.unlinkMediaSource)})).catch((function(e){n._onFatalError(e)}))},n.updateContentUrls=function(e,t){this._manifestFetcher.updateContentUrls(e,t)},n.dispose=function(){this._initCanceller.cancel()},n._onFatalError=function(e){this._initCanceller.isUsed()||(this._initCanceller.cancel(),this.trigger("error",e))},n._initializeMediaSourceAndDecryption=function(e,t){var n=this,r=this._initCanceller;return xt(r.signal,(function(i){var a=n._settings.keySystems,o=wi(e,a,t,{onWarning:function(e){return n.trigger("warning",e)},onError:function(e){return n._onFatalError(e)}},r.signal);o.onUpdate((function(t,a){if("uninitialized"!==t.initializationState.type){a();var s=new Ge;s.linkToSignal(r.signal),vi(e,s.signal).then((function(e){var n=o.getValue();if("awaiting-media-link"===n.initializationState.type)n.initializationState.value.isMediaLinked.setValue(!0),o.onUpdate((function(t,n){if("initialized"===t.initializationState.type)return n(),void i({mediaSource:e,drmSystemId:t.drmSystemId,unlinkMediaSource:s})}),{emitCurrentValue:!0,clearSignal:r.signal});else if("initialized"===t.initializationState.type)return void i({mediaSource:e,drmSystemId:t.drmSystemId,unlinkMediaSource:s})})).catch((function(e){s.isUsed()||n._onFatalError(e)}))}}),{emitCurrentValue:!0,clearSignal:r.signal})}))},n._onInitialMediaSourceReady=function(){var e=qe(Qe().mark((function e(t,n,r,i,a,o){var s,u,d,c,f,v,p,h,m,g,y,_,b,S,E,T,k,w,A,I,R,x=this;return Qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return R=function(e,n,i,o){w({mediaElement:t,playbackObserver:r,mediaSource:e,initialTime:n,autoPlay:i,manifest:b,representationEstimator:E,segmentFetcherCreator:k,speed:p,protectionRef:a,bufferOptions:T},(function(e){if(o.cancel(),y.isUsed())return;if(A("reloadingMediaSource",e),y.isUsed())return;var n=new Ge;n.linkToSignal(y.signal),vi(t,n.signal).then((function(t){R(t,e.position,e.autoPlay,n)})).catch((function(e){n.isUsed()||I(e)}))}),o.signal)},s=this._settings,u=s.adaptiveOptions,d=s.autoPlay,c=s.bufferOptions,f=s.lowLatencyMode,v=s.segmentRequestOptions,p=s.speed,h=s.startAt,m=s.textTrackOptions,g=s.transport,y=this._initCanceller,Ee(this._initialManifestProm),_=this._initialManifestProm,e.prev=5,e.next=8,_;case 8:b=e.sent,e.next=14;break;case 11:return e.prev=11,e.t0=e.catch(5),e.abrupt("return");case 14:if(b.addEventListener("manifestUpdate",(function(){x.trigger("manifestUpdate",null)}),y.signal),ne.debug("Init: Calculating initial time"),S=Si(b,f,h),ne.debug("Init: Initial time calculated:",S),E=Qt(u),T=l({textTrackOptions:m,drmSystemId:i},c),k=new Yn(g,v,y.signal),this.trigger("manifestReady",b),!y.isUsed()){e.next=24;break}return e.abrupt("return");case 24:w=this._startBufferingOnMediaSource.bind(this),A=this.trigger.bind(this),I=this._onFatalError.bind(this),R(n,S,d,o);case 28:case"end":return e.stop()}}),e,this,[[5,11]])})));return function(t,n,r,i,a,o){return e.apply(this,arguments)}}(),n._startBufferingOnMediaSource=function(e,t,n){var r,i=this,a=e.autoPlay,o=e.bufferOptions,s=e.initialTime,u=e.manifest,l=e.mediaElement,d=e.mediaSource,c=e.playbackObserver,f=e.protectionRef,p=e.representationEstimator,h=e.segmentFetcherCreator,m=e.speed,g=null!==(r=u.getPeriodForTime(s))&&void 0!==r?r:u.getNextPeriod(s);if(void 0===g){var y=new ve("MEDIA_STARTING_TIME_NOT_FOUND","Wanted starting time not found in the Manifest.");return this._onFatalError(y)}var _=new fr(l,d);n.register((function(){_.disposeAll()}));var b=ki(l,c,s,a,(function(e){return i.trigger("warning",e)}),n),S=b.autoPlayResult,T=b.initialPlayPerformed,k=b.initialSeekPerformed;if(!n.isCancelled()){T.onUpdate((function(e,t){if(e){t();var r=new ji(u,l,c);r.addEventListener("event",(function(e){i.trigger("streamEvent",e)}),n),r.addEventListener("eventSkip",(function(e){i.trigger("streamEventSkip",e)}),n),r.start(),n.register((function(){r.stop()}))}}),{clearSignal:n,emitCurrentValue:!0});var w=function(e,t,n){var r=t.autoPlay,i=t.initialPlayPerformed,a=t.initialSeekPerformed,o=t.manifest,s=t.speed,u=t.startTime;return e.deriveReadOnlyObserver((function(e,t){var l=new Ge;l.linkToSignal(t),l.linkToSignal(n);var d=new E(c(),l.signal);return s.onUpdate(f,{clearSignal:l.signal,emitCurrentValue:!1}),e.onUpdate(f,{clearSignal:l.signal,emitCurrentValue:!1}),d;function c(){var t,n=e.getValue(),l=s.getValue();if(a.getValue()){if(!o.isDynamic||o.isLastPeriodKnown){var d=o.periods[o.periods.length-1];void 0!==d&&void 0!==d.end&&n.position>d.end&&(t=d.end-1)}}else t=u;return{maximumPosition:o.getMaximumSafePosition(),position:{last:n.position,pending:t},duration:n.duration,paused:{last:n.paused,pending:i.getValue()||!r===n.paused?void 0:!r},readyState:n.readyState,speed:l}}function f(){d.setValue(c())}}))}(c,{autoPlay:a,manifest:u,initialPlayPerformed:T,initialSeekPerformed:k,speed:m,startTime:s},n),A=this._createRebufferingController(c,u,_,m,n);A.addEventListener("needsReload",(function(){var e=k.getValue()?c.getCurrentTime():s,n=T.getValue()?!c.getIsPaused():a;t({position:e,autoPlay:n})}),n);var I=this._createContentTimeBoundariesObserver(u,d,w,_,n);S.then((function(){Ti(c,l,!1,n).onUpdate((function(e,t){e&&(t(),i.trigger("loaded",{segmentBuffersStore:_}))}),{emitCurrentValue:!0,clearSignal:n})})).catch((function(e){n.isCancelled()||i._onFatalError(e)}));var R=this;ri({manifest:u,initialPeriod:g},w,p,_,h,o,{needsBufferFlush:function(){var e=l.currentTime+.001;c.setCurrentTime(e),c.listen((function(t,n){(null!==t.currentRange||t.position>e+.1)&&(n(),c.setCurrentTime(t.position+.001))}),{includeLastObservation:!1,clearSignal:n})},streamStatusUpdate:function(e){var t=e.period,r=e.bufferType,i=e.imminentDiscontinuity,a=e.position;A.updateDiscontinuityInfo({period:t,bufferType:r,discontinuity:i,position:a}),n.isCancelled()||u.isLastPeriodKnown&&e.period.id===u.periods[u.periods.length-1].id&&(e.hasFinishedLoading||e.isEmptyStream?I.onLastSegmentFinishedLoading(e.bufferType):I.onLastSegmentLoadingResume(e.bufferType))},needsManifestRefresh:function(){return R._manifestFetcher.scheduleManualRefresh({enablePartialRefresh:!0,canUseUnsafeMode:!0})},manifestMightBeOufOfSync:function(){var e=v.getCurrent().OUT_OF_SYNC_MANIFEST_REFRESH_DELAY;R._manifestFetcher.scheduleManualRefresh({enablePartialRefresh:!1,canUseUnsafeMode:!1,delay:e})},lockedStream:function(e){return A.onLockedStream(e.bufferType,e.period)},adaptationChange:function(e){R.trigger("adaptationChange",e),n.isCancelled()||I.onAdaptationChange(e.type,e.period,e.adaptation)},representationChange:function(e){R.trigger("representationChange",e),n.isCancelled()||I.onRepresentationChange(e.type,e.period)},inbandEvent:function(e){return R.trigger("inbandEvents",e)},warning:function(e){return R.trigger("warning",e)},periodStreamReady:function(e){return R.trigger("periodStreamReady",e)},periodStreamCleared:function(e){I.onPeriodCleared(e.type,e.period),n.isCancelled()||R.trigger("periodStreamCleared",e)},bitrateEstimateChange:function(e){return R.trigger("bitrateEstimateChange",e)},needsMediaSourceReload:function(e){var n,r,i=w.getReference().getValue(),a=null!==(n=i.position.pending)&&void 0!==n?n:w.getCurrentTime(),o=null!==(r=i.paused.pending)&&void 0!==r?r:w.getIsPaused(),s=a+e.timeOffset;void 0!==e.minimumPosition&&(s=Math.max(e.minimumPosition,s)),void 0!==e.maximumPosition&&(s=Math.min(e.maximumPosition,s)),t({position:s,autoPlay:!o})},needsDecipherabilityFlush:function(){var e,n,r,i,a=tt(l);if(void 0===(i=null==a?void 0:a[0])||i.indexOf("widevine")<0){var o=w.getReference().getValue(),s=null!==(e=o.position.pending)&&void 0!==e?e:w.getCurrentTime(),u=null!==(n=o.paused.pending)&&void 0!==n?n:w.getIsPaused();t({position:s,autoPlay:!u})}else{var d=w.getReference().getValue(),f=null!==(r=d.position.pending)&&void 0!==r?r:w.getCurrentTime();f+.001<d.duration?c.setCurrentTime(l.currentTime+.001):c.setCurrentTime(f)}},encryptionDataEncountered:function(e){for(var t,r=qi(e);!(t=r()).done;){var i=t.value;if(f.setValue(i),n.isCancelled())return}},error:function(e){return R._onFatalError(e)}},n)}},n._createContentTimeBoundariesObserver=function(e,t,n,r,i){var a=this,o=new Ii(t);i.register((function(){o.stopUpdating()}));var s=null,u=new si(e,n,r.getBufferTypes());i.register((function(){u.dispose()})),u.addEventListener("warning",(function(e){return a.trigger("warning",e)})),u.addEventListener("periodChange",(function(e){a.trigger("activePeriodChanged",{period:e})})),u.addEventListener("durationUpdate",(function(e){o.updateDuration(e.duration,e.isEnd)})),u.addEventListener("endOfStream",(function(){null===s&&((s=new Ge).linkToSignal(i),ne.debug("Init: end-of-stream order received."),function(e,t){var n=new Ge;n.linkToSignal(t),yi(e,(function(){ne.debug("Init: MediaSource re-opened while end-of-stream is active"),n.cancel(),(n=new Ge).linkToSignal(t),bi(e,n.signal)}),t),bi(e,n.signal)}(t,s.signal))})),u.addEventListener("resumeStream",(function(){null!==s&&(ne.debug("Init: resume-stream order received."),s.cancel(),s=null)}));var l=u.getCurrentDuration();return o.updateDuration(l.duration,l.isEnd),u},n._createRebufferingController=function(e,t,n,r,i){var a=this,o=new Oi(e,t,n,r);return o.addEventListener("stalled",(function(e){return a.trigger("stalled",e)})),o.addEventListener("unstalled",(function(){return a.trigger("unstalled",null)})),o.addEventListener("warning",(function(e){return a.trigger("warning",e)})),i.register((function(){return o.destroy()})),o.start(),o},t}(ii);function $i(){for(var e,t=arguments.length,n=-1,r=0;++n<t;)r+="number"==typeof(e=n<0||arguments.length<=n?void 0:arguments[n])?e:e.length;var i=new Uint8Array(r),a=0;for(n=-1;++n<t;)"number"==typeof(e=n<0||arguments.length<=n?void 0:arguments[n])?a+=e:e.length>0&&(i.set(e,a),a+=e.length);return i}function Xi(e,t){return(e[t+0]<<8)+(e[t+1]<<0)}function Zi(e,t){return 65536*e[t+0]+256*e[t+1]+e[t+2]}function Ji(e,t){return 16777216*e[t+0]+65536*e[t+1]+256*e[t+2]+e[t+3]}function ea(e,t){return 4294967296*(16777216*e[t+0]+65536*e[t+1]+256*e[t+2]+e[t+3])+16777216*e[t+4]+65536*e[t+5]+256*e[t+6]+e[t+7]}function ta(e){return new Uint8Array([e>>>8&255,255&e])}function na(e){return new Uint8Array([e>>>24&255,e>>>16&255,e>>>8&255,255&e])}function ra(e){var t=e%4294967296,n=(e-t)/4294967296;return new Uint8Array([n>>>24&255,n>>>16&255,n>>>8&255,255&n,t>>>24&255,t>>>16&255,t>>>8&255,255&t])}function ia(e){return new Uint8Array([255&e,e>>>8&255,e>>>16&255,e>>>24&255])}function aa(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return oa(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return oa(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function oa(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function sa(e,t){for(var n,r=e,i=aa(t);!(n=i()).done;){var a=ua(r,n.value);if(null===a)return null;r=a}return r}function ua(e,t){var n=la(e,t);return null!==n?e.subarray(n[1],n[2]):null}function la(e,t){for(var n,r,i=e.length,a=0,o=0;a+8<=i;){if(o=Ji(e,r=a),n=Ji(e,r+=4),r+=4,0===o)o=i-a;else if(1===o){if(r+8>i)return null;o=ea(e,r),r+=8}if(o<0)throw new Error("ISOBMFF: Size out of range");if(n===t)return 1970628964===t&&(r+=16),[a,r,a+o];a+=o}return null}function da(e,t,n,r,i){for(var a,o=e.length,s=0;s<o;s+=a){var u=s;a=Ji(e,u);var l=Ji(e,u+=4);if(u+=4,0===a)a=o-s;else if(1===a){if(u+8>o)return;a=ea(e,u),u+=8}if(1970628964===l&&u+16<=o&&Ji(e,u)===t&&Ji(e,u+4)===n&&Ji(e,u+8)===r&&Ji(e,u+12)===i)return u+=16,e.subarray(u,s+a)}}function ca(e){var t=e.length;if(t<8)return ne.warn("ISOBMFF: box inferior to 8 bytes, cannot find offsets"),null;var n=0,r=Ji(e,n),i=Ji(e,n+=4);if(n+=4,0===r)r=t;else if(1===r){if(n+8>t)return ne.warn("ISOBMFF: box too short, cannot find offsets"),null;r=ea(e,n),n+=8}if(r<0)throw new Error("ISOBMFF: Size out of range");return 1970628964===i&&(n+=16),[0,n,r]}function fa(e){var t=ua(e,1836019558);return null===t?null:ua(t,1953653094)}function va(e){var t=function(e,t){for(var n=[],r=e;;){var i=la(r,t);if(null===i)return n;Ee(0!==i[2]&&r.length),n.push(r.subarray(i[1],i[2])),r=r.subarray(i[2])}}(e,1836019558);return t.reduce((function(e,t){var n=ua(t,1953653094);return null!==n&&e.push(n),e}),[])}function pa(e){return ua(e,1835295092)}function ha(e,t){return void 0===t&&(t=0),ua(e.subarray(t),1701671783)}var ma=/^(?:[a-z]+:)?\/\//i,ga=/\/\.{1,2}\//;function ya(){var e=arguments.length;if(0===e)return"";for(var t="",n=0;n<e;n++){var r=n<0||arguments.length<=n?void 0:arguments[n];"string"==typeof r&&""!==r&&(ma.test(r)?t=r:("/"===r[0]&&(r=r.substring(1)),"/"===t[t.length-1]&&(t=t.substring(0,t.length-1)),t=t+"/"+r))}return function(e){if(!ga.test(e))return e;for(var t=[],n=e.split("/"),r=0,i=n.length;r<i;r++)if(".."===n[r])t.pop();else{if("."===n[r])continue;t.push(n[r])}return t.join("/")}(t)}function _a(e){var t=e.lastIndexOf("/");if(t<0)return e.length;if(ma.test(e)){var n=e.indexOf("/");if(n>=0&&t===n+1)return e.length}var r=e.indexOf("?");return r>=0&&r<t?_a(e.substring(0,r)):t+1}var ba="object"==typeof w&&"function"==typeof w.TextDecoder,Sa="object"==typeof w&&"function"==typeof w.TextEncoder;function Ea(e){if(ba)try{return new TextDecoder("utf-16le").decode(e)}catch(e){var t=e instanceof Error?e:"";ne.warn("Utils: could not use TextDecoder to parse UTF-16LE, fallbacking to another implementation",t)}for(var n="",r=0;r<e.length;r+=2)n+=String.fromCharCode((e[r+1]<<8)+e[r]);return n}function Ta(e){if(Sa)try{return(new TextEncoder).encode(e)}catch(e){var t=e instanceof Error?e:"";ne.warn("Utils: could not use TextEncoder to encode string into UTF-8, fallbacking to another implementation",t)}var n,r=encodeURIComponent(e);if("function"==typeof unescape)n=unescape(r);else{var i=/[0-9a-fA-F]/,a=r.length;n="";for(var o=0;o<r.length;o++){var s=!1;if("%"===r[o])if(o<=a-6&&"u"===r[o+1]&&i.test(r[o+2])&&i.test(r[o+3])&&i.test(r[o+4])&&i.test(r[o+5])){var u=parseInt(r.substring(o+1,o+6),16);n+=String.fromCharCode(u),s=!0,o+=5}else if(o<=a-3&&i.test(r[o+1])&&i.test(r[o+2])){var l=parseInt(r.substring(o+1,o+3),16);n+=String.fromCharCode(l),s=!0,o+=2}s||(n+=r[o])}}for(var d=new Uint8Array(n.length),c=0;c<n.length;c++)d[c]=255&n.charCodeAt(c);return d}function ka(e,t){var n=e.toString(16);return n.length>=t?n:new Array(t-n.length+1).join("0")+n}function wa(e){if(ba)try{return(new TextDecoder).decode(e)}catch(e){var t=e instanceof Error?e:"";ne.warn("Utils: could not use TextDecoder to parse UTF-8, fallbacking to another implementation",t)}var n=e;239===n[0]&&187===n[1]&&191===n[2]&&(n=n.subarray(3));var r,i=function(e){for(var t="",n=0;n<e.length;n+=16e3){var r=e.subarray(n,n+16e3);t+=String.fromCharCode.apply(null,r)}return t}(n);if("function"==typeof escape)r=escape(i);else{var a=/[A-Za-z0-9*_\+-\.\/]/;r="";for(var o=0;o<i.length;o++)if(a.test(i[o]))r+=i[o];else{var s=i.charCodeAt(o);r+=s>=256?"%u"+ka(s,4):"%"+ka(s,2)}}return decodeURIComponent(r)}function Aa(e){for(var t=e.length,n=new Uint8Array(t/2),r=0,i=0;r<t;r+=2,i++)n[i]=255&parseInt(e.substring(r,r+2),16);return n}function Ia(e,t){void 0===t&&(t="");for(var n="",r=0;r<e.byteLength;r++)n+=(e[r]>>>4).toString(16),n+=(15&e[r]).toString(16),t.length>0&&r<e.byteLength-1&&(n+=t);return n}function Ra(e){Ee(e.length);var t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],u=e[7],l=new Uint8Array(16);return l[0]=i,l[1]=r,l[2]=n,l[3]=t,l[4]=o,l[5]=a,l[6]=u,l[7]=s,l.set(e.subarray(8,16),8),l}function xa(e,t){for(var n=t;n<e.length;){if(0===e[n])break;n+=1}return{end:n+1,string:wa(e.subarray(t,n))}}var Ma=Math.pow(2,32)-1,Ca={};function Pa(e){if(null!=Ca[e])return Ca[e];var t=Ta(e);return Ca[e]=t,t}function Da(e,t){var n=t.length+8;return n<=Ma?$i(na(n),Pa(e),t):$i(na(1),Pa(e),ra(n+8),t)}function Na(e,t){return Da(e,$i.apply(void 0,t))}function Oa(e){var t=[];e.periods.forEach((function(n){var r=n.id;if(Se(t,r)){ne.warn("Two periods with the same ID found. Updating.");var i=r+"-dup";n.id=i,Oa(e),t.push(i)}else t.push(r);var a=n.adaptations,o=[];Object.keys(a).forEach((function(t){var n=a[t];void 0!==n&&n.forEach((function(t){var n=t.id;if(Se(o,n)){ne.warn("Two adaptations with the same ID found. Updating.",n);var r=n+"-dup";t.id=r,Oa(e),o.push(r)}else o.push(n);var i=[];t.representations.forEach((function(t){var n=t.id;if(Se(i,n)){ne.warn("Two representations with the same ID found. Updating.",n);var r=n+"-dup";t.id=r,Oa(e),i.push(r)}else i.push(n)}))}))}))}))}var La=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9","+","/"],Ua=[255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,62,255,255,255,63,52,53,54,55,56,57,58,59,60,61,255,255,255,0,255,255,255,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,255,255,255,255,255,255,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51];function Ba(e){if(e>=Ua.length)throw new Error("Unable to parse base64 string.");var t=Ua[e];if(255===t)throw new Error("Unable to parse base64 string.");return t}function Fa(e){var t,n="",r=e.length;for(t=2;t<r;t+=3)n+=La[e[t-2]>>2],n+=La[(3&e[t-2])<<4|e[t-1]>>4],n+=La[(15&e[t-1])<<2|e[t]>>6],n+=La[63&e[t]];return t===r+1&&(n+=La[e[t-2]>>2],n+=La[(3&e[t-2])<<4],n+="=="),t===r&&(n+=La[e[t-2]>>2],n+=La[(3&e[t-2])<<4|e[t-1]>>4],n+=La[(15&e[t-1])<<2],n+="="),n}function za(e){var t=e.length%4,n=e;0!==t&&(ne.warn("base64ToBytes: base64 given miss padding"),n+=3===t?"=":2===t?"==":"===");var r=n.indexOf("=");if(-1!==r&&r<n.length-2)throw new Error("Unable to parse base64 string.");for(var i,a=n.endsWith("==")?2:n.endsWith("=")?1:0,o=n.length,s=new Uint8Array(o/4*3),u=0,l=0;u<o;u+=4,l+=3)i=Ba(n.charCodeAt(u))<<18|Ba(n.charCodeAt(u+1))<<12|Ba(n.charCodeAt(u+2))<<6|Ba(n.charCodeAt(u+3)),s[l]=i>>16,s[l+1]=i>>8&255,s[l+2]=255&i;return s.subarray(0,s.length-a)}function Va(e){return[{systemId:"edef8ba9-79d6-4ace-a3c8-27dcd51d21ed",privateData:$i([8,1,18,16],e)}]}function Ka(e,t){if(void 0===t&&(t=Va),null===e.firstElementChild||"ProtectionHeader"!==e.firstElementChild.nodeName)throw new Error("Protection should have ProtectionHeader child");var n=e.firstElementChild,r=za(null===n.textContent?"":n.textContent),i=Aa(function(e){var t,n,r=((t=e)[0+(n=8)]<<0)+(t[n+1]<<8),i=Ea(e.subarray(10,r+10)),a=(new DOMParser).parseFromString(i,"application/xml").querySelector("KID");if(null===a)throw new Error("Cannot parse PlayReady private data: invalid XML");return Ia(Ra(za(null===a.textContent?"":a.textContent))).toLowerCase()}(r)),a=n.getAttribute("SystemID");return{keyId:i,keySystems:[{systemId:(null!==a?a:"").toLowerCase().replace(/\{|\}/g,""),privateData:r}].concat(t(i))}}function Ga(e,t,n){var r,i=e.repeatCount;return i>=0?i:(r=h(t)?void 0!==n?n:Number.MAX_VALUE:t.start,Math.ceil((r-e.start)/e.duration)-1)}function Wa(e,t,n){var r=e.start,i=e.duration;return i<=0?r:r+(Ga(e,t,n)+1)*i}function ja(e,t){var n;return e*t.timescale+(null!==(n=t.indexTimeOffset)&&void 0!==n?n:0)}function Ha(e,t){var n;return(e-(null!==(n=t.indexTimeOffset)&&void 0!==n?n:0))/t.timescale}function qa(e,t,n){var r=e.timeline,i=ja(t,e);if(i<0)return null;var a=function(e,t){for(var n=0,r=e.length;n<r;){var i=n+r>>>1;e[i].start<=t?n=i+1:r=i}return n-1}(r,i);if(a<0||a>=r.length-1)return null;var o=r[a];if(o.duration<=0)return null;var s=r[a+1];if(void 0===s)return null;var u=s.start;return i>=Wa(o,s,n)&&i<u?Ha(u,e):null}function Ya(e,t,n,r){for(var i=0;i<t.length;i++){var a=t[i],o=(a.start-r)/n;if(o>e.time)return!1;if(o===e.time)return void 0===a.range?void 0===e.range:null!=e.range&&a.range[0]===e.range[0]&&a.range[1]===e.range[1];if(a.repeatCount>=0&&void 0!==a.duration){var s=(o-a.start)/a.duration-1;return s%1==0&&s<=a.repeatCount}}return!1}function Qa(e,t){return e.replace(/\{start time\}/g,String(t))}function $a(e,t,n){var r=t-e;return r>0?Math.floor(r/n):0}function Xa(e,t){var n=e.repeatCount;if(void 0!==e.duration&&n<0){var r=void 0!==t?t.start:1/0;n=Math.ceil((r-e.start)/e.duration)-1}return n}var Za=function(){function e(e){var t=e.isLive,n=e.segmentPrivateInfos,r=e.media,i=e.sharedSmoothTimeline;if(this._sharedSmoothTimeline=i,this._initSegmentInfos={bitsPerSample:n.bitsPerSample,channels:n.channels,codecPrivateData:n.codecPrivateData,packetSize:n.packetSize,samplingRate:n.samplingRate,timescale:i.timescale,height:n.height,width:n.width,protection:n.protection},this._isLive=t,this._media=r,0!==i.timeline.length&&t){var a=i.timeline,o=i.validityTime,s=Wa(a[a.length-1],null),u=o/1e3*i.timescale;this._scaledLiveGap=u-s}}var t=e.prototype;return t.getInitSegment=function(){return{id:"init",isInit:!0,privateInfos:{smoothInitSegment:this._initSegmentInfos},url:null,time:0,end:0,duration:0,timescale:1,complete:!0}},t.getSegments=function(e,t){this._refreshTimeline();for(var n,r=this._sharedSmoothTimeline,i=r.timescale,a=r.timeline,o=function(e,t,n){var r=void 0===e||0===e?1:e;return{up:t*r,to:(t+n)*r}}(i,e,t),s=o.up,u=o.to,l=this._media,d=[],c=a.length,f=void 0===this._scaledLiveGap?void 0:at()/1e3*i-this._scaledLiveGap,v=0;v<c;v++){for(var p=a[v],h=p.duration,m=p.start,g=Xa(p,a[v+1]),y=$a(m,s,h),_=m+y*h,b=h;_<u&&y<=g&&(void 0===f||_+b<=f);){var S=_,E=void 0!==n?n+y:void 0,T={id:String(_),isInit:!1,time:S/i,end:(S+h)/i,duration:h/i,timescale:1,number:E,url:Qa(l,S),complete:!0,privateInfos:{smoothMediaSegment:{time:S,duration:h}}};d.push(T),_=m+ ++y*h}if(_>=u)return d;void 0!==n&&(n+=g+1)}return d},t.shouldRefresh=function(e,t){if(this._refreshTimeline(),!this._isLive)return!1;var n=this._sharedSmoothTimeline,r=n.timeline,i=n.timescale,a=r[r.length-1];if(void 0===a)return!1;var o=a.repeatCount,s=a.start+(o+1)*a.duration;return!(t*i<s)&&(e*i>=s||e*i>a.start+o*a.duration)},t.getFirstAvailablePosition=function(){this._refreshTimeline();var e=this._sharedSmoothTimeline,t=e.timeline,n=e.timescale;return 0===t.length?null:t[0].start/n},t.getLastAvailablePosition=function(){this._refreshTimeline();var e=this._sharedSmoothTimeline,t=e.timeline,n=e.timescale;if(void 0===this._scaledLiveGap)return Wa(t[t.length-1],null)/n;for(var r=t.length-1;r>=0;r--)for(var i=t[r],a=at()/1e3*n,o=i.start,s=i.duration,u=i.repeatCount;u>=0;u--){var l=o+s*(u+1);if(l<=a-this._scaledLiveGap)return l/n}},t.getEnd=function(){if(!this._isLive)return this.getLastAvailablePosition()},t.awaitSegmentBetween=function(e,t){var n;if(Ee(),this.isFinished())return!1;var r=this.getLastAvailablePosition();return!(void 0!==r&&t<r)&&(t>(null!==(n=this.getFirstAvailablePosition())&&void 0!==n?n:0)&&void 0)},t.checkDiscontinuity=function(e){return this._refreshTimeline(),qa(this._sharedSmoothTimeline,e,void 0)},t.isSegmentStillAvailable=function(e){if(e.isInit)return!0;this._refreshTimeline();var t=this._sharedSmoothTimeline;return Ya(e,t.timeline,t.timescale,0)},t.canBeOutOfSyncError=function(e){return!!this._isLive&&(e instanceof pe&&(e.isHttpError(404)||e.isHttpError(412)))},t._replace=function(e){this._initialScaledLastPosition=e._initialScaledLastPosition,this._scaledLiveGap=e._scaledLiveGap,this._sharedSmoothTimeline.replace(e._sharedSmoothTimeline)},t._update=function(e){this._scaledLiveGap=e._scaledLiveGap,this._sharedSmoothTimeline.update(e._sharedSmoothTimeline)},t.isFinished=function(){return!this._isLive},t.isInitialized=function(){return!0},t.initialize=function(){ne.error("A `SmoothRepresentationIndex` does not need to be initialized")},t.addPredictedSegments=function(e,t){this._sharedSmoothTimeline.addPredictedSegments(e,t)},t._refreshTimeline=function(){this._sharedSmoothTimeline.refresh()},e}();function Ja(e,t){for(var n=0;e.length>0;){var r=e[0];if(r.start>=t)return n;if(-1===r.repeatCount)return n;if(0===r.repeatCount)e.shift(),n+=1;else{var i=e[1];if(void 0!==i&&i.start<=t)e.shift(),n+=1;else{if(r.duration<=0)return n;for(var a=r.start+r.duration,o=1;a<t&&o<=r.repeatCount;)a+=r.duration,o++;if(!(o>r.repeatCount)){var s=r.repeatCount-o;return r.start=a,r.repeatCount=s,n+=o}e.shift(),n=r.repeatCount+1}}}return n}function eo(e,t){if(0===e.length)return e.push.apply(e,t),!0;if(0===t.length)return!1;var n=e.length,r=t[0].start;if(Wa(e[n-1],t[0])<r)throw new ve("MANIFEST_UPDATE_ERROR","Cannot perform partial update: not enough data");for(var i=n-1;i>=0;i--){var a=e[i].start;if(a===r){var o=n-i;return e.splice.apply(e,[i,o].concat(t)),!1}if(a<r){var s=e[i];if(s.start+s.duration>r)return ne.warn("RepresentationIndex: Manifest update removed all previous segments"),e.splice.apply(e,[0,n].concat(t)),!0;if(void 0===s.repeatCount||s.repeatCount<=0)return s.repeatCount<0&&(s.repeatCount=Math.floor((r-s.start)/s.duration)-1),e.splice.apply(e,[i+1,n-(i+1)].concat(t)),!1;if(s.start+s.duration*(s.repeatCount+1)<=r)return e.splice.apply(e,[i+1,n-(i+1)].concat(t)),!1;var u=(r-s.start)/s.duration-1;if(u%1==0&&s.duration===t[0].duration){var l=t[0].repeatCount<0?-1:t[0].repeatCount+u+1;return e.splice.apply(e,[i,n-i].concat(t)),e[i].start=s.start,e[i].repeatCount=l,!1}return ne.warn("RepresentationIndex: Manifest update removed previous segments"),e[i].repeatCount=Math.floor(u),e.splice.apply(e,[i+1,n-(i+1)].concat(t)),!1}}var d=e[e.length-1],c=t[t.length-1];return void 0!==d.repeatCount&&d.repeatCount<0?d.start>c.start?(ne.warn("RepresentationIndex: The new index is older than the previous one"),!1):(ne.warn('RepresentationIndex: The new index is "bigger" than the previous one'),e.splice.apply(e,[0,n].concat(t)),!0):d.start+d.duration*(d.repeatCount+1)>=c.start+c.duration*(c.repeatCount+1)?(ne.warn("RepresentationIndex: The new index is older than the previous one"),!1):(ne.warn('RepresentationIndex: The new index is "bigger" than the previous one'),e.splice.apply(e,[0,n].concat(t)),!0)}function to(e,t,n,r){var i=e[e.length-1],a=n.timescale===t?{time:n.time,duration:n.duration}:{time:n.time/n.timescale*t,duration:n.duration/n.timescale*t};return!(r.time===a.time)&&(a.time>=Wa(i,null)&&(i.duration===a.duration?i.repeatCount++:e.push({duration:a.duration,start:a.time,repeatCount:0}),!0))}var no=function(){function e(e){var t=e.timeline,n=e.timescale,r=e.timeShiftBufferDepth,i=e.manifestReceivedTime;this.timeline=t,this.timescale=n;var a=null!=i?i:at();if(this.validityTime=a,this._timeShiftBufferDepth=r,0!==t.length){var o=Wa(t[t.length-1],null);this._initialScaledLastPosition=o}}var t=e.prototype;return t.refresh=function(){if(void 0!==this._initialScaledLastPosition){var e=this._timeShiftBufferDepth,t=(at()-this.validityTime)/1e3+this._initialScaledLastPosition/this.timescale;if(void 0!==e){var n=(t-e)*this.timescale;Ja(this.timeline,n)}}},t.replace=function(e){var t=this.timeline,n=e.timeline,r=this.timescale,i=e.timescale;if(this._initialScaledLastPosition=e._initialScaledLastPosition,this.validityTime=e.validityTime,0!==t.length&&0!==n.length&&r===i){var a=t[t.length-1],o=n[n.length-1],s=Wa(o,null);if(!(Wa(a,null)<=s))for(var u=0;u<t.length;u++){var l=t[u],d=Wa(l,null);if(d===s)return void(this.timeline=this.timeline.concat(t.slice(u+1)));if(d>s){if(l.duration!==o.duration)return;var c=s-l.start;if(0===c)return ne.warn("Smooth Parser: a discontinuity detected in the previous manifest has been resolved."),void(this.timeline=this.timeline.concat(t.slice(u)));if(c<0||c%l.duration!=0)return;var f=c/l.duration-1,v=l.repeatCount-f;if(v<0)return;o.repeatCount+=v;var p=t.slice(u+1);return void(this.timeline=this.timeline.concat(p))}}}},t.update=function(e){eo(this.timeline,e.timeline),this._initialScaledLastPosition=e._initialScaledLastPosition,this.validityTime=e.validityTime},t.addPredictedSegments=function(e,t){var n;if(void 0!==(null===(n=t.privateInfos)||void 0===n?void 0:n.smoothMediaSegment)){this.refresh();for(var r=0;r<e.length;r++)to(this.timeline,this.timescale,e[r],t.privateInfos.smoothMediaSegment)}else ne.warn("Smooth Parser: should only encounter SmoothRepresentationIndex")},e}();function ro(e,t,n){for(var r=e.firstElementChild,i=n;null!==r;)i=t(i,r.nodeName,r),r=r.nextElementSibling;return i}var io={audio:"audio/mp4",video:"video/mp4",text:"application/ttml+xml"},ao={AACL:"audio/mp4",AVC1:"video/mp4",H264:"video/mp4",TTML:"application/ttml+xml+mp4",DFXP:"application/ttml+xml+mp4"};var oo=function(e){void 0===e&&(e={});var t=void 0===e.referenceDateTime?Date.UTC(1970,0,1,0,0,0,0)/1e3:e.referenceDateTime,n=void 0===e.minRepresentationBitrate?0:e.minRepresentationBitrate,r=e.serverSyncInfos,i=void 0!==r?r.serverTimestamp-r.clientTime:void 0;function a(e,t){var n=ro(e,(function(e,t,n){return"CustomAttributes"===t&&e.push.apply(e,ro(n,(function(e,t,n){if("Attribute"===t){var r=n.getAttribute("Name"),i=n.getAttribute("Value");null!==r&&null!==i&&e.push(r+"="+i)}return e}),[])),e}),[]);function r(t){var n=e.getAttribute(t);return null==n?void 0:n}switch(t){case"audio":var i=r("AudioTag"),a=r("BitsPerSample"),o=r("Channels"),s=r("CodecPrivateData"),u=r("FourCC"),l=r("PacketSize"),d=r("SamplingRate"),c=r("Bitrate"),f=void 0===c||isNaN(parseInt(c,10))?0:parseInt(c,10);if(void 0!==u&&void 0===ao[u]||void 0===s)return ne.warn("Smooth parser: Unsupported audio codec. Ignoring quality level."),null;var v=function(e,t){var n;return 0==(n="AACH"===t?5:p(e)?(248&parseInt(e.substring(0,2),16))>>3:2)?"mp4a.40.2":"mp4a.40."+n}(s,u);return{audiotag:void 0!==i?parseInt(i,10):i,bitrate:f,bitsPerSample:void 0!==a?parseInt(a,10):a,channels:void 0!==o?parseInt(o,10):o,codecPrivateData:s,codecs:v,customAttributes:n,mimeType:void 0!==u?ao[u]:u,packetSize:void 0!==l?parseInt(l,10):l,samplingRate:void 0!==d?parseInt(d,10):d};case"video":var h=r("CodecPrivateData"),m=r("FourCC"),g=r("MaxWidth"),y=r("MaxHeight"),_=r("Bitrate"),b=void 0===_||isNaN(parseInt(_,10))?0:parseInt(_,10);if(void 0!==m&&void 0===ao[m]||void 0===h)return ne.warn("Smooth parser: Unsupported video codec. Ignoring quality level."),null;var S=function(e){var t=/00000001\d7([0-9a-fA-F]{6})/.exec(e);return null!==t&&p(t[1])?"avc1."+t[1]:"avc1.4D401E"}(h);return{bitrate:b,customAttributes:n,mimeType:void 0!==m?ao[m]:m,codecPrivateData:h,codecs:S,width:void 0!==g?parseInt(g,10):void 0,height:void 0!==y?parseInt(y,10):void 0};case"text":var E=r("CodecPrivateData"),T=r("FourCC"),k=r("Bitrate");return{bitrate:void 0===k||isNaN(parseInt(k,10))?0:parseInt(k,10),customAttributes:n,mimeType:void 0!==T?ao[T]:T,codecPrivateData:Vt(E,"")};default:return ne.error("Smooth Parser: Unrecognized StreamIndex type: "+t),null}}function o(e){var t=e.root,r=e.timescale,i=e.baseUrl,o=e.protections,s=e.timeShiftBufferDepth,u=e.manifestReceivedTime,d=e.isLive,c=t.getAttribute("Timescale"),f=null===c||isNaN(+c)?r:+c,v=t.getAttribute("Type");if(null===v)throw new Error("StreamIndex without type.");Se(vn,v)||ne.warn("Smooth Parser: Unrecognized adaptation type:",v);var h=v,m=t.getAttribute("Subtype"),g=t.getAttribute("Language"),y=t.getAttribute("Url"),_=null===y?"":y;var b,S=ro(t,(function(e,t,r){switch(t){case"QualityLevel":var i=a(r,h);if(null===i)return e;("video"!==h||i.bitrate>n)&&e.qualityLevels.push(i);break;case"c":e.cNodes.push(r)}return e}),{qualityLevels:[],cNodes:[]}),E=S.qualityLevels,T=S.cNodes,k=new no({timeline:(b=T,b.reduce((function(e,t,n){var r=t.getAttribute("d"),i=t.getAttribute("t"),a=t.getAttribute("r"),o=null!==a?+a-1:0,s=null!==i?+i:void 0,u=null!==r?+r:void 0;if(0===n)s=void 0===s||isNaN(s)?0:s;else{var l=e[n-1];if(null==s||isNaN(s)){if(null==l.duration||isNaN(l.duration))throw new Error("Smooth: Invalid CNodes. Missing timestamp.");s=l.start+l.duration*(l.repeatCount+1)}}if(null==u||isNaN(u)){var d=b[n+1];if(void 0===d)return e;var c=d.getAttribute("t"),f=p(c)?+c:null;if(null===f)throw new Error("Can't build index timeline from Smooth Manifest.");u=f-s}return e.push({duration:u,start:s,repeatCount:o}),e}),[])),timescale:f,timeShiftBufferDepth:s,manifestReceivedTime:u});Ee(E.length);var w=h+(p(g)?"_"+g:""),A=E.map((function(e){var t,n,r,a,s=(t=_,n=e.bitrate,r=e.customAttributes,t.replace(/\{bitrate\}/g,String(n)).replace(/{CustomAttributes}/g,r.length>0?r[0]:"")),u=p(e.mimeType)?e.mimeType:io[h],c=e.codecs,f=w+"_"+(null!=h?h+"-":"")+(null!=u?u+"-":"")+(null!=c?c+"-":"")+String(e.bitrate),v=[];o.length>0&&(a=o[0],o.forEach((function(e){var t=e.keyId;e.keySystems.forEach((function(e){v.push({keyId:t,systemId:e.systemId})}))})));var m={bitsPerSample:e.bitsPerSample,channels:e.channels,codecPrivateData:e.codecPrivateData,packetSize:e.packetSize,samplingRate:e.samplingRate,height:e.height,width:e.width,protection:null!=a?{keyId:a.keyId}:void 0},g=new Za({isLive:d,sharedSmoothTimeline:k,media:s,segmentPrivateInfos:m}),y=l({},e,{index:g,cdnMetadata:[{baseUrl:i}],mimeType:u,codecs:c,id:f});if(v.length>0||void 0!==a){var b=void 0===a?[]:a.keySystems.map((function(e){var t=e.systemId,n=e.privateData,r=t.replace(/-/g,""),i=function(e,t){if(32!==e.length)throw new Error("HSS: wrong system id length");return Da("pssh",$i([0,0,0,0],Aa(e),na(t.length),t))}(r,n);return{systemId:r,data:i}}));if(b.length>0){var S=[{type:"cenc",values:b}];y.contentProtections={keyIds:v,initData:S}}else y.contentProtections={keyIds:v,initData:[]}}return y}));if("ADVT"===m)return null;var I={id:w,type:h,representations:A,language:null==g?void 0:g};return"text"===h&&"DESC"===m&&(I.closedCaption=!0),I}return function(n,r,a){var s="";if(void 0!==r){var u=_a(r);s=r.substring(0,u)}var l=n.documentElement;if(null==l||"SmoothStreamingMedia"!==l.nodeName)throw new Error("document root should be SmoothStreamingMedia");var d=l.getAttribute("MajorVersion"),c=l.getAttribute("MinorVersion");if(null===d||null===c||!/^[2]-[0-2]$/.test(d+"-"+c))throw new Error("Version should be 2.0, 2.1 or 2.2");var f,v,h=l.getAttribute("Timescale"),m=p(h)?isNaN(+h)?1e7:+h:1e7,g=ro(l,(function(t,n,r){switch(n){case"Protection":t.protections.push(Ka(r,e.keySystems));break;case"StreamIndex":t.adaptationNodes.push(r)}return t}),{adaptationNodes:[],protections:[]}),y=g.protections,_=g.adaptationNodes,b="boolean"==typeof(f=l.getAttribute("IsLive"))?f:"string"==typeof f&&"TRUE"===f.toUpperCase();if(b){var S=l.getAttribute("DVRWindowLength");null==S||isNaN(+S)||0==+S||(v=+S/m)}var E,T,k,w,A,I,R,x=_.reduce((function(e,t){var n=o({root:t,baseUrl:s,timescale:m,protections:y,isLive:b,timeShiftBufferDepth:v,manifestReceivedTime:a});if(null===n)return e;var r=n.type,i=e[r];return void 0===i?e[r]=[n]:i.push(n),e}),{}),M=null,C=void 0!==x.video?x.video[0]:void 0,P=void 0!==x.audio?x.audio[0]:void 0;if(void 0!==C||void 0!==P){var D=[],N=[];if(void 0!==C){var O=C.representations[0];if(void 0!==O){var L=O.index.getFirstAvailablePosition(),U=O.index.getLastAvailablePosition();null!=L&&D.push(L),null!=U&&N.push(U)}}if(void 0!==P){var B=P.representations[0];if(void 0!==B){var F=B.index.getFirstAvailablePosition(),z=B.index.getLastAvailablePosition();null!=F&&D.push(F),null!=z&&N.push(z)}}D.length>0&&(A=Math.max.apply(Math,D)),N.length>0&&(I=Math.min.apply(Math,N),R=Math.max.apply(Math,N))}var V=l.getAttribute("Duration"),K=null!==V&&0!=+V?+V/m:void 0;if(b){E=e.suggestedPresentationDelay,T=t,k=null!=A?A:T;var G=R;void 0===G&&(G=Date.now()/1e3-T);var W=I;void 0===W&&(W=G),w={isLinear:!0,maximumSafePosition:W,livePosition:G,time:at()},M=null!=v?v:null}else{k=null!=A?A:0,w={isLinear:!1,maximumSafePosition:void 0!==I?I:void 0!==K?k+K:1/0,livePosition:void 0,time:at()}}var j=b?0:k,H=b?void 0:w.maximumSafePosition,q={availabilityStartTime:void 0===T?0:T,clockOffset:i,isLive:b,isDynamic:b,isLastPeriodKnown:!0,timeBounds:{minimumSafePosition:k,timeshiftDepth:M,maximumTimeData:w},periods:[{adaptations:x,duration:void 0!==H?H-j:K,end:H,id:"gen-smooth-period-0",start:j}],suggestedPresentationDelay:E,transportType:"smooth",uris:null==r?[]:[r]};return Oa(q),q}},so=oo;var uo=function(e){var t={url:e.url,headers:e.headers,responseType:h(e.responseType)?"json":e.responseType,timeout:e.timeout};return new Promise((function(n,r){var i,a=e.onProgress,o=e.cancelSignal,s=t.url,u=t.headers,l=t.responseType,d=t.timeout,c=new XMLHttpRequest;if(c.open("GET",s,!0),void 0!==d&&(c.timeout=d,i=setTimeout((function(){y(),r(new kn(s,c.status,"TIMEOUT"))}),d+3e3)),c.responseType=l,"document"===c.responseType&&c.overrideMimeType("text/xml"),!h(u)){var f=u;for(var v in f)f.hasOwnProperty(v)&&c.setRequestHeader(v,f[v])}var m=at(),g=null;function y(){void 0!==i&&clearTimeout(i),null!==g&&g()}void 0!==o&&(g=o.register((function(e){y(),h(c)||4===c.readyState||c.abort(),r(e)})),o.isCancelled())||(c.onerror=function(){y(),r(new kn(s,c.status,"ERROR_EVENT"))},c.ontimeout=function(){y(),r(new kn(s,c.status,"TIMEOUT"))},void 0!==a&&(c.onprogress=function(e){var t=at();a({url:s,duration:t-m,sendingTime:m,currentTime:t,size:e.loaded,totalSize:e.total})}),c.onload=function(e){if(4===c.readyState)if(y(),c.status>=200&&c.status<300){var t,i=at(),a=c.response instanceof ArrayBuffer?c.response.byteLength:e.total,o=c.status,u=c.responseType,l=p(c.responseURL)?c.responseURL:s;if(h(t="json"===u?"object"==typeof c.response?c.response:function(e){try{return JSON.parse(e)}catch(e){return null}}(c.responseText):c.response))return void r(new kn(s,c.status,"PARSE_ERROR"));n({status:o,url:l,responseType:u,sendingTime:m,receivedTime:i,requestDuration:i-m,size:a,responseData:t})}else r(new kn(s,c.status,"ERROR_HTTP_CODE"))},c.send())}))};function lo(e,t){for(var n=e.length,r=0;r+8<=n;){var i=Ji(e,r);if(0===i)i=n-r;else if(1===i){if(r+16>n)return-1;i=ea(e,r+8)}if(isNaN(i)||i<=0)return-1;if(Ji(e,r+4)===t)return r+i<=n?r:-1;r+=i}return-1}function co(e,t){if(t){if(lo(e,1718909296)<0)throw new he("INTEGRITY_ERROR","Incomplete `ftyp` box");if(lo(e,1836019574)<0)throw new he("INTEGRITY_ERROR","Incomplete `moov` box")}else{if(lo(e,1836019558)<0)throw new he("INTEGRITY_ERROR","Incomplete `moof` box");if(lo(e,1835295092)<0)throw new he("INTEGRITY_ERROR","Incomplete `mdat` box")}}function fo(e,t){var n=e.customManifestLoader,r=function(e){return function(t,n,r){if(void 0===t)throw new Error("Cannot perform HTTP(s) request. URL not known");switch(e){case"arraybuffer":return uo({url:t,responseType:"arraybuffer",timeout:n.timeout,cancelSignal:r});case"text":return uo({url:t,responseType:"text",timeout:n.timeout,cancelSignal:r});case"document":return uo({url:t,responseType:"document",timeout:n.timeout,cancelSignal:r});default:ke()}}}(t);return"function"!=typeof n?r:function(e,t){return function(n,r,i){return new Promise((function(a,o){var s=Date.now()-at(),u=!1,l={reject:function(e){var t,n;if(!u&&!i.isCancelled()){u=!0,i.deregister(c);var r=e,a=null!==(t=null==r?void 0:r.message)&&void 0!==t?t:"Unknown error when fetching the Manifest through a custom manifestLoader.",s=new An(a,null!==(n=null==r?void 0:r.canRetry)&&void 0!==n&&n,null==r?void 0:r.xhr);o(s)}},resolve:function(e){if(!u&&!i.isCancelled()){u=!0,i.deregister(c);var t=void 0!==e.receivingTime?e.receivingTime-s:void 0,n=void 0!==e.sendingTime?e.sendingTime-s:void 0;a({responseData:e.data,size:e.size,requestDuration:e.duration,url:e.url,receivedTime:t,sendingTime:n})}},fallback:function(){u||i.isCancelled()||(u=!0,i.deregister(c),t(n,r,i).then(a,o))}},d=e({url:n,timeout:r.timeout},l);function c(e){u||(u=!0,"function"==typeof d&&d(),o(e))}i.register(c)}))}}(n,r)}function vo(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return po(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return po(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function po(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ho(e,t){var n=la(e,1936286840);if(null===n)return null;var r,i=t,a=n[2]-n[0],o=n[1],s=e[o],u=Ji(e,o+=8);if(o+=4,0===s)r=Ji(e,o),i+=Ji(e,o+=4)+a,o+=4;else{if(1!==s)return null;r=ea(e,o),i+=ea(e,o+=8)+a,o+=8}var l=[],d=Xi(e,o+=2);for(o+=2;--d>=0;){var c=Ji(e,o);o+=4;var f=2147483647&c;if(1===(2147483648&c)>>>31)throw new Error("sidx with reference_type `1` not yet implemented");var v=Ji(e,o);o+=4,o+=4,l.push({time:r,duration:v,timescale:u,range:[i,i+f-1]}),r+=v,i+=f}return l}function mo(e){var t=ua(e,1952868452);if(null!==t){var n=1,r=Zi(t,n);if(n+=3,(8&r)>0)return n+=4,(1&r)>0&&(n+=8),(2&r)>0&&(n+=4),Ji(t,n)}}function go(e){var t=va(e);if(0!==t.length){for(var n,r=0,i=vo(t);!(n=i()).done;){var a=n.value,o=ua(a,1953658222);if(null===o)return;var s=0;if(o[s]>1)return;var u=Zi(o,s+=1);s+=3;var l=(256&u)>0,d=0;if(!l&&void 0===(d=mo(a)))return;var c=(1&u)>0,f=(4&u)>0,v=(512&u)>0,p=(1024&u)>0,h=(2048&u)>0,m=Ji(o,s);s+=4,c&&(s+=4),f&&(s+=4);for(var g=m,y=0;g-- >0;)l?(y+=Ji(o,s),s+=4):y+=d,v&&(s+=4),p&&(s+=4),h&&(s+=4);r+=y}return r}}function yo(e){var t=function(e){var t=ua(e,1836019574);if(null===t)return null;var n=ua(t,1953653099);return null===n?null:ua(n,1835297121)}(e);if(null!==t){var n=ua(t,1835296868);if(null!==n){var r=0,i=n[r];return r+=4,1===i?Ji(n,r+16):0===i?Ji(n,r+8):void 0}}}function _o(e){var t=e.length;if(t<4)throw new Error("Cannot update box length: box too short");var n=Ji(e,0);if(0===n){if(t>Ma){var r=new Uint8Array(t+8);return r.set(na(1),0),r.set(e.subarray(4,8),4),r.set(ra(t+8),8),r.set(e.subarray(8,t),16),r}return e.set(na(t),0),e}if(1===n){if(t<16)throw new Error("Cannot update box length: box too short");return e.set(ra(t),8),e}if(t<=Ma)return e.set(na(t),0),e;var i=new Uint8Array(t+8);return i.set(na(1),0),i.set(e.subarray(4,8),4),i.set(ra(t+8),8),i.set(e.subarray(8,t),16),i}function bo(e,t,n,r,i){var a,o,s,u=[];if(i){var l=fa(e);null!==l?(s=function(e){var t=da(e,3565190898,3392751253,2387879627,2655430559);if(void 0===t)return[];for(var n=[],r=t[0],i=t[4],a=0;a<i;a++){var o=void 0,s=void 0;1===r?(s=ea(t,16*a+5),o=ea(t,16*a+5+8)):(s=Ji(t,8*a+5),o=Ji(t,8*a+5+4)),n.push({time:s,duration:o})}return n}(l),o=function(e){var t=da(e,1830656773,1121273062,2162299933,2952222642);if(void 0!==t)return{duration:ea(t,12),time:ea(t,4)}}(l)):ne.warn("smooth: could not find traf atom")}if(void 0!==s)for(var d=0;d<s.length;d++)u.push({time:s[d].time,duration:s[d].duration,timescale:n});if(void 0!==o)return{nextSegments:u,chunkInfos:{time:o.time/n,duration:o.duration/n},scaledSegmentTime:o.time};if(t||!r.complete)return{nextSegments:u,chunkInfos:null,scaledSegmentTime:void 0};var c=r.duration*n,f=Math.min(.9*n,c/4),v=go(e),p=void 0!==(null===(a=r.privateInfos)||void 0===a?void 0:a.smoothMediaSegment)?r.privateInfos.smoothMediaSegment.time:Math.round(r.time*n);return{nextSegments:u,chunkInfos:void 0!==v&&Math.abs(v-c)<=f?{time:r.time,duration:v/n}:{time:r.time,duration:r.duration},scaledSegmentTime:p}}function So(e){return"string"==typeof e&&e.indexOf("mp4")>=0}function Eo(e,t){return Da("schm",$i(4,Ta(e),na(t)))}function To(e){return Da("frma",Ta(e))}function ko(e){var t=[7,[e.length]];return Da("stsd",$i.apply(void 0,t.concat(e)))}function wo(e,t,n){return Da("tenc",$i(6,[e,t],n))}function Ao(e,t,n,r,i){var a=[e,t,n];return void 0!==i&&a.push(Da("senc",i),function(e){if(0===e.length)return Da("saiz",new Uint8Array(0));var t=Ji(e,0),n=Ji(e,4),r=new Uint8Array(n+9);r.set(na(n),5);for(var i,a,o=9,s=8;s<e.length;)s+=8,2==(2&t)?(a=2,s+=6*(i=Xi(e,s))+2):(i=0,a=0),r[o]=6*i+8+a,o++;return Da("saiz",r)}(i),function(e,t,n,r){return Da("saio",$i(4,[0,0,0,1],na(e.length+t.length+n.length+r.length+8+8+8+8)))}(r,e,t,n)),Na("traf",a)}function Io(e,t){var n=la(e,1836019558);if(null===n)throw new Error("Smooth: Invalid ISOBMFF given");var r=e.subarray(n[1],n[2]),i=function(e,t){var n=la(e,t);return null!==n?e.subarray(n[0],n[2]):null}(r,1835427940),a=ua(r,1953653094);if(null===a||null===i)throw new Error("Smooth: Invalid ISOBMFF given");var o=la(a,1952868452),s=la(a,1953658222);if(null===o||null===s)throw new Error("Smooth: Invalid ISOBMFF given");var u=a.subarray(o[0],o[2]),l=a.subarray(s[0],s[2]);u.set([0,0,0,1],o[1]-o[0]+4);var d=function(e){return Da("tfdt",$i([1,0,0,0],ra(e)))}(t),c=function(e,t){var n=(1&e[t+3])>0;if(n)return e;var r=new Uint8Array(e.length+4);return r.set(e.subarray(0,t+8),0),r[t+3]=1|r[t+3],r.set([0,0,0,0],t+8),r.set(e.subarray(t+8,e.length),t+12),_o(r)}(l,s[1]-s[0]),f=Ao(u,d,c,i,da(a,2721664850,1520127764,2722393154,2086964724)),v=Na("moof",[i,f]),p=la(v,1836019558),h=la(f,1953653094),m=la(c,1953658222);if(null===p||null===h||null===m)throw new Error("Smooth: Invalid moof, trun or traf generation");var g=p[1]-p[0]+i.length+(h[1]-h[0])+u.length+d.length+(m[1]-m[0])+8,y=n[2]-n[0],_=v.length-y,b=la(e,1835295092);if(null===b)throw new Error("Smooth: Invalid ISOBMFF given");if(!q&&(0===_||_<=-8)){var S=b[1];return v.set(na(S),g),e.set(v,n[0]),_<=-8&&e.set(Da("free",new Uint8Array(-_-8)),v.length),e}var E=b[1]+_;v.set(na(E),g);var T=new Uint8Array(e.length+_),k=e.subarray(0,n[0]),w=e.subarray(n[2],e.length);return T.set(k,0),T.set(v,k.length),T.set(w,k.length+v.length),T}function Ro(e){var t=e[0],n=e[1];return n===1/0?"bytes="+t+"-":"bytes="+t+"-"+n}function xo(e,t,n,r,i,a){var o,s,u=Na("stbl",[n,Da("stts",new Uint8Array(8)),Da("stsc",new Uint8Array(8)),Da("stsz",new Uint8Array(12)),Da("stco",new Uint8Array(8))]),l=function(e){return Da("dref",$i(7,[1],e))}(Da("url ",new Uint8Array([0,0,0,1]))),d=Na("dinf",[l]),c=Na("minf",[r,d,u]),f=function(e){var t,n;switch(e){case"video":t="vide",n="VideoHandler";break;case"audio":t="soun",n="SoundHandler";break;default:t="hint",n=""}return Da("hdlr",$i(8,Ta(t),12,Ta(n),1))}(t),v=function(e){return Da("mdhd",$i(12,na(e),8))}(e),p=Na("mdia",[v,f,c]),h=function(e,t,n){return Da("tkhd",$i(na(7),8,na(n),20,[1,0,0,0],[0,1,0,0],12,[0,1,0,0],12,[64,0,0,0],ta(e),2,ta(t),2))}(i,a,1),m=Na("trak",[h,p]),g=Na("mvex",[Da("trex",$i(4,na(1),[0,0,0,1],12))]),y=function(e,t){return Da("mvhd",$i(12,na(e),4,[0,1],2,[1,0],10,[0,1],14,[0,1],14,[64,0,0,0],26,ta(t+1)))}(e,1),_=function(e,t,n){return Na("moov",[e,t,n])}(y,g,m),b=(o="isom",s=["isom","iso2","iso6","avc1","dash"],Da("ftyp",$i.apply(void 0,[Ta(o),[0,0,0,1]].concat(s.map(Ta)))));return $i(b,_)}function Mo(e,t,n,r,i,a,o,s){var u=o.split("00000001"),l=u[1],d=u[2];if(void 0===l||void 0===d)throw new Error("Smooth: unsupported codec private data.");var c,f,v=function(e,t,n){var r=2===n?1:4===n?3:0;return Da("avcC",$i([1,e[1],e[2],e[3],252|r,225],ta(e.length),e,[1],ta(t.length),t))}(Aa(l),Aa(d),a);if(void 0===s){var p=function(e,t,n,r,i,a,o){return Da("avc1",$i(6,ta(1),16,ta(e),ta(t),ta(n),2,ta(r),6,[0,1,i.length],Ta(i),31-i.length,ta(a),[255,255],o))}(t,n,r,i,"AVC Coding",24,v);c=ko([p])}else{var h=Na("schi",[wo(1,8,s)]),m=Eo("cenc",65536),g=function(e,t,n,r,i,a,o,s){return Da("encv",$i(6,ta(1),16,ta(e),ta(t),ta(n),2,ta(r),6,[0,1,i.length],Ta(i),31-i.length,ta(a),[255,255],o,s))}(t,n,r,i,"AVC Coding",24,v,Na("sinf",[To("avc1"),m,h]));c=ko([g])}return xo(e,"video",c,((f=new Uint8Array(12))[3]=1,Da("vmhd",f)),t,n)}var Co=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];function Po(e,t,n,r,i,a,o){var s,u,l=function(e,t){return Da("esds",$i(4,[3,25],ta(e),[0,4,17,64,21],11,[5,2],Aa(t),[6,1,2]))}(1,0===a.length?(s=i,u=t,Ia(ta((((63&2)<<4|31&Co.indexOf(s))<<4|31&u)<<3))):a),d=function(){if(void 0===o){var e=function(e,t,n,r,i,a){return Da("mp4a",$i(6,ta(e),8,ta(t),ta(n),2,ta(r),ta(i),2,a))}(1,t,n,r,i,l);return ko([e])}var a=Na("schi",[wo(1,8,o)]),s=Eo("cenc",65536),u=Na("sinf",[To("mp4a"),s,a]),d=function(e,t,n,r,i,a,o){return Da("enca",$i(6,ta(e),8,ta(t),ta(n),2,ta(r),ta(i),2,a,o))}(1,t,n,r,i,l,u);return ko([d])}();return xo(e,"audio",d,Da("smhd",new Uint8Array(8)),0,0)}function Do(e,t,n,r,i,a){var o,s=t.segment.range;return Array.isArray(s)&&(o={Range:Ro(s)}),uo({url:e,responseType:"arraybuffer",headers:o,timeout:r.timeout,cancelSignal:i,onProgress:n.onProgress}).then((function(e){if(!So(t.mimeType)||!0!==a)return{resultType:"segment-loaded",resultData:e};var n=new Uint8Array(e.responseData);return co(n,t.segment.isInit),{resultType:"segment-loaded",resultData:Object.assign(Object.assign({},e),{responseData:n})}}))}var No=function(e){var t=e.checkMediaSegmentIntegrity,n=e.customSegmentLoader;return function(e,r,i,a,o){var s=r.segment;if(s.isInit){if(void 0===s.privateInfos||void 0===s.privateInfos.smoothInitSegment)throw new Error("Smooth: Invalid segment format");var u,l=s.privateInfos.smoothInitSegment,d=l.codecPrivateData,c=l.timescale,f=l.height,v=l.width,p=l.protection,h=void 0===p?{keyId:void 0,keySystems:void 0}:p;if(void 0===d)throw new Error("Smooth: no codec private data.");switch(r.type){case"video":u=Mo(c,null!=v?v:0,null!=f?f:0,72,72,4,d,h.keyId);break;case"audio":var m=l.channels,g=void 0===m?0:m,y=l.bitsPerSample,_=void 0===y?0:y,b=l.packetSize,S=void 0===b?0:b,E=l.samplingRate;u=Po(c,g,_,S,void 0===E?0:E,d,h.keyId);break;default:0,u=new Uint8Array(0)}return Promise.resolve({resultType:"segment-created",resultData:u})}return null===e?Promise.resolve({resultType:"segment-created",resultData:null}):"function"!=typeof n?Do(e,r,o,i,a,t):new Promise((function(s,u){var l,d=!1,c={reject:function(e){var t,n;if(!d&&!a.isCancelled()){d=!0,a.deregister(p);var r=e,i=null!==(t=null==r?void 0:r.message)&&void 0!==t?t:"Unknown error when fetching a Smooth segment through a custom segmentLoader.",o=new An(i,null!==(n=null==r?void 0:r.canRetry)&&void 0!==n&&n,null==r?void 0:r.xhr);u(o)}},resolve:function(e){if(!d&&!a.isCancelled()){d=!0,a.deregister(p),So(r.mimeType)&&!0===t||s({resultType:"segment-loaded",resultData:{responseData:e.data,size:e.size,requestDuration:e.duration}});var n=e.data instanceof Uint8Array?e.data:new Uint8Array(e.data);co(n,r.segment.isInit),s({resultType:"segment-loaded",resultData:{responseData:n,size:e.size,requestDuration:e.duration}})}},fallback:function(){d||a.isCancelled()||(d=!0,a.deregister(p),Do(e,r,o,i,a,t).then(s,u))},progress:function(e){d||a.isCancelled()||o.onProgress({duration:e.duration,size:e.size,totalSize:e.totalSize})}};void 0!==r.segment.range&&(l=[r.segment.range],void 0!==r.segment.indexRange&&l.push(r.segment.indexRange));var f={isInit:r.segment.isInit,timeout:i.timeout,byteRanges:l,trackType:r.type,url:e},v=n(f,c);function p(e){d||((d=!0)||"function"!=typeof v||v(),u(e))}a.register(p)}))}};function Oo(e,t){return null===e?null:null===t.url?e.baseUrl:ya(e.baseUrl,t.url)}var Lo=function(e){var t=so(e),n=No(e),r={loadManifest:fo({customManifestLoader:e.manifestLoader},"text"),parseManifest:function(n,r){var i,a=null!==(i=n.url)&&void 0!==i?i:r.originalUrl,o=n.receivedTime,s=n.responseData,u="string"==typeof s?(new DOMParser).parseFromString(s,"text/xml"):s,l=t(u,a,o),d=[];return{manifest:new Tn(l,{representationFilter:e.representationFilter},d),url:a,warnings:d}}},i={loadSegment:function(e,t,r,i,a){var o=Oo(e,t.segment);return n(o,t,r,i,a)},parseSegment:function(e,t,n){var r,i,a=t.segment,o=e.data,s=e.isChunked;if(null===o)return a.isInit?{segmentType:"init",initializationData:null,initializationDataSize:0,protectionData:[],initTimescale:void 0}:{segmentType:"media",chunkData:null,chunkInfos:null,chunkOffset:0,chunkSize:0,protectionData:[],appendWindow:[void 0,void 0]};var u=o instanceof Uint8Array?o:new Uint8Array(o);if(a.isInit){var l=null===(i=null===(r=a.privateInfos)||void 0===r?void 0:r.smoothInitSegment)||void 0===i?void 0:i.timescale;return{segmentType:"init",initializationData:o,initializationDataSize:o.byteLength,initTimescale:l,protectionData:[]}}var d=void 0!==n?bo(u,s,n,a,t.isLive):null;if(null===d||null===d.chunkInfos||void 0===d.scaledSegmentTime)throw new Error("Smooth Segment without time information");var c=d.nextSegments,f=d.chunkInfos,v=Io(u,d.scaledSegmentTime),p=c.length>0?c:void 0;return{segmentType:"media",chunkData:v,chunkInfos:f,chunkOffset:0,chunkSize:v.length,protectionData:[],predictedSegments:p,appendWindow:[void 0,void 0]}}},a={loadSegment:function(t,n,r,i,a){var o=n.segment,s=Oo(t,o);return o.isInit||null===s?Promise.resolve({resultType:"segment-created",resultData:null}):So(n.mimeType)?uo({url:s,responseType:"arraybuffer",timeout:r.timeout,cancelSignal:i,onProgress:a.onProgress}).then((function(t){if(!0!==e.checkMediaSegmentIntegrity)return{resultType:"segment-loaded",resultData:t};var r=new Uint8Array(t.responseData);return co(r,n.segment.isInit),{resultType:"segment-loaded",resultData:Object.assign(Object.assign({},t),{responseData:r})}})):uo({url:s,responseType:"text",timeout:r.timeout,cancelSignal:i,onProgress:a.onProgress}).then((function(e){return{resultType:"segment-loaded",resultData:e}}))},parseSegment:function(e,t,n){var r,i,a,o=t.segment,s=t.language,u=t.mimeType,l=void 0===u?"":u,d=t.codecs,c=void 0===d?"":d,f=So(t.mimeType),v=e.data,p=e.isChunked;if(o.isInit)return{segmentType:"init",initializationData:null,initializationDataSize:0,protectionData:[],initTimescale:void 0};if(null===v)return{segmentType:"media",chunkData:null,chunkInfos:null,chunkOffset:0,chunkSize:0,protectionData:[],appendWindow:[void 0,void 0]};var h,m,g,y,_=null;if(f){var b;i=(b="string"==typeof v?Ta(v):v instanceof Uint8Array?v:new Uint8Array(v)).length;var S=void 0!==n?bo(b,p,n,o,t.isLive):null;a=null==S?void 0:S.nextSegments,null===(_=null!==(r=null==S?void 0:S.chunkInfos)&&void 0!==r?r:null)?p?ne.warn("Smooth: Unavailable time data for current text track."):(h=o.time,m=o.end):(h=_.time,m=void 0!==_.duration?_.time+_.duration:o.end);var E=c.toLowerCase();if("application/ttml+xml+mp4"===l||"stpp"===E||"stpp.ttml.im1t"===E)y="ttml";else{if("wvtt"!==E)throw new Error("could not find a text-track parser for the type "+l);y="vtt"}var T=pa(b);g=null===T?"":wa(T)}else{var k;if(h=o.time,m=o.end,"string"!=typeof v){var w=v instanceof Uint8Array?v:new Uint8Array(v);i=w.length,k=wa(w)}else k=v;switch(l){case"application/x-sami":case"application/smil":y="sami";break;case"application/ttml+xml":y="ttml";break;case"text/vtt":y="vtt"}if(void 0===y){if("srt"!==c.toLowerCase())throw new Error("could not find a text-track parser for the type "+l);y="srt"}g=k}return{segmentType:"media",chunkData:{type:y,data:g,start:h,end:m,language:s},chunkSize:i,chunkInfos:_,chunkOffset:null!=h?h:0,protectionData:[],predictedSegments:Array.isArray(a)&&a.length>0?a:void 0,appendWindow:[void 0,void 0]}}};return{manifest:r,audio:i,video:i,text:a}};function Uo(e){e.transports.smooth=Lo,e.mediaSourceInit=Qi}function Bo(e){var t=Date.parse(e)-at();if(!isNaN(t))return t;ne.warn("DASH Parser: Invalid clock received: ",e)}function Fo(e){for(var t=e.representations,n=null,r=0;r<t.length;r++){var i=t[r].index.getLastAvailablePosition();if(void 0===i)return;null!==i&&(n=null==n?i:Math.min(n,i))}return null===n?null:n}function zo(e){for(var t=e.representations,n=null,r=0;r<t.length;r++){var i=t[r].index.getFirstAvailablePosition();if(void 0===i)return;null!==i&&(n=null==n?i:Math.max(n,i))}return null===n?null:n}function Vo(e){if(0===e.length)throw new Error("DASH Parser: no period available for a dynamic content");var t=function(e){for(var t=0;t<=e.length-1;t++){var n=e[t].adaptations,r=void 0===n.audio?void 0:n.audio[0],i=void 0===n.video?void 0:n.video[0];if(void 0!==r||void 0!==i){var a=null,o=null;if(void 0!==r){var s=zo(r);if(void 0===s)return;a=s}if(void 0!==i){var u=zo(i);if(void 0===u)return;o=u}if(void 0!==r&&null===a||void 0!==i&&null===o)return void ne.info("Parser utils: found Period with no segment. ","Going to next one to calculate first position");if(null!==o)return null!==a?Math.max(a,o):o;if(null!==a)return a}}}(e),n=function(e){for(var t=e.length-1;t>=0;t--){var n=e[t].adaptations,r=void 0===n.audio?void 0:n.audio[0],i=void 0===n.video?void 0:n.video[0];if(void 0!==r||void 0!==i){var a=null,o=null;if(void 0!==r){var s=Fo(r);if(void 0===s)return{safe:void 0,unsafe:void 0};a=s}if(void 0!==i){var u=Fo(i);if(void 0===u)return{safe:void 0,unsafe:void 0};o=u}if(void 0!==r&&null===a||void 0!==i&&null===o)return ne.info("Parser utils: found Period with no segment. ","Going to previous one to calculate last position"),{safe:void 0,unsafe:void 0};if(null!==o)return null!==a?{safe:Math.min(a,o),unsafe:Math.max(a,o)}:{safe:o,unsafe:o};if(null!==a)return{safe:a,unsafe:a}}}return{safe:void 0,unsafe:void 0}}(e);return{minimumSafePosition:t,maximumSafePosition:n.safe,maximumUnsafePosition:n.unsafe}}function Ko(e,t){return"function"==typeof Array.prototype.flatMap?e.flatMap(t):e.reduce((function(e,n){var r=t(n);return Array.isArray(r)?(e.push.apply(e,r),e):(e.push(r),e)}),[])}var Go=function(){function e(e){this._isDynamic=e.isDynamic,this._timeShiftBufferDepth=e.isDynamic&&void 0!==e.timeShiftBufferDepth?e.timeShiftBufferDepth:null}var t=e.prototype;return t.setLastPosition=function(e,t){this._lastPosition=e,this._positionTime=t},t.lastPositionIsKnown=function(){return this._isDynamic?null!=this._positionTime&&null!=this._lastPosition:null!=this._lastPosition},t.estimateMinimumBound=function(){if(!this._isDynamic||null===this._timeShiftBufferDepth)return 0;var e=this.estimateMaximumBound();return void 0!==e?e-this._timeShiftBufferDepth:void 0},t.estimateMaximumBound=function(){return this._isDynamic&&null!=this._positionTime&&null!=this._lastPosition?Math.max(this._lastPosition-this._positionTime+at()/1e3,0):this._lastPosition},e}();function Wo(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return jo(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return jo(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function jo(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Ho=function(e,t){for(var n,r=Wo(t);!(n=r()).done;)for(var i,a=n.value,o=a.adaptation,s=Wo(a.trickModeAttachedAdaptationIds);!(i=s()).done;)for(var u,l=i.value,d=Wo(vn);!(u=d()).done;){var c=e[u.value];if(void 0!==c)for(var f,v=Wo(c);!(f=v()).done;){var p=f.value;p.id===l&&(void 0===p.trickModeTracks&&(p.trickModeTracks=[]),p.trickModeTracks.push(o))}}},qo=["subtitle","caption"];function Yo(e,t,n,r){function i(e,t){var n=e.split("/")[0];return Se(vn,n)?n:"application/ttml+xml"===e||"application/mp4"===e&&null!=t&&null!=be(t,(function(e){return"urn:mpeg:dash:role:2011"===e.schemeIdUri&&Se(qo,e.value)}))?"text":void 0}function a(e){switch(e.substring(0,3)){case"avc":case"hev":case"hvc":case"vp8":case"vp9":case"av1":return"video";case"vtt":return"text"}switch(e.substring(0,4)){case"mp4a":return"audio";case"wvtt":case"stpp":return"text"}}if(null!==t){var o=i(t,r);if(void 0!==o)return o}if(null!==n){var s=a(n);if(void 0!==s)return s}for(var u=0;u<e.length;u++){var l=e[u].attributes,d=l.mimeType,c=l.codecs;if(void 0!==d){var f=i(d,r);if(void 0!==f)return f}if(void 0!==c){var v=a(c);if(void 0!==v)return v}}}function Qo(e,t){var n,r=e.initialization,i={};return void 0!==t&&(i.isEMSGWhitelisted=t),{id:"init",isInit:!0,time:0,end:0,duration:0,timescale:1,range:null!=r?r.range:void 0,indexRange:e.indexRange,url:null!==(n=null==r?void 0:r.url)&&void 0!==n?n:null,complete:!0,privateInfos:i,timestampOffset:-e.indexTimeOffset/e.timescale}}function $o(e){return function(t,n,r){var i,a,o,s=p(r)?parseInt(r,10):1;return i=String(e),a=s,(o=i.toString()).length>=a?o:(new Array(a+1).join("0")+o).slice(-a)}}function Xo(e,t,n){return function(e,t,n){return-1===e.indexOf("$")?e:e.replace(/\$\$/g,"$").replace(/\$RepresentationID\$/g,String(t)).replace(/\$Bandwidth(\%0(\d+)d)?\$/g,$o(void 0===n?0:n))}(e,t,n)}function Zo(e,t){return function(n){return-1===n.indexOf("$")?n:n.replace(/\$\$/g,"$").replace(/\$Number(\%0(\d+)d)?\$/g,(function(e,n,r){if(void 0===t)throw new Error("Segment number not defined in a $Number$ scheme");return $o(t)(e,n,r)})).replace(/\$Time(\%0(\d+)d)?\$/g,(function(t,n,r){if(void 0===e)throw new Error("Segment time not defined in a $Time$ scheme");return $o(e)(t,n,r)}))}}function Jo(e,t,n,r,i){for(var a,o,s=ja(t,e),u=ja(t+n,e),l=e.timeline,d=e.timescale,c=e.segmentUrlTemplate,f=e.startNumber,v=e.endNumber,p=null!=f?f:1,h=[],m=l.length,g=0;g<m;g++){for(var y=l[g],_=y.duration,b=y.start,S=y.range,E=Ga(y,l[g+1],i),T=!1!==e.availabilityTimeComplete||g!==m-1&&0!==E,k=(a=_,o=void 0,(o=s-b)>0?Math.floor(o/a):0),w=b+k*_;w<u&&k<=E;){var A=p+k;if(void 0!==v&&A>v)break;var I=null===c?null:Zo(w,A)(c),R=w-e.indexTimeOffset,x=_;R<0&&(x=_+R,R=0);var M={id:String(w),time:R/d,end:(R+x)/d,duration:x/d,isInit:!1,range:S,timescale:1,url:I,number:A,timestampOffset:-e.indexTimeOffset/d,complete:T,privateInfos:{isEMSGWhitelisted:r}};h.push(M),w=b+ ++k*_}if(w>=u)return h;if(p+=E+1,void 0!==v&&p>v)return h}return h}function es(e,t){if(t.timescale!==e.timescale){var n=e.timescale;e.timeline.push({start:t.time/t.timescale*n,duration:t.duration/t.timescale*n,repeatCount:void 0===t.count?0:t.count,range:t.range})}else e.timeline.push({start:t.time,duration:t.duration,repeatCount:void 0===t.count?0:t.count,range:t.range});return!0}var ts=function(){function e(e,t){var n,r,i,a=t.periodStart,o=t.periodEnd,s=t.representationId,u=t.representationBitrate,l=t.isEMSGWhitelisted,d=null!==(n=e.timescale)&&void 0!==n?n:1,c=(null!=e.presentationTimeOffset?e.presentationTimeOffset:0)-a*d,f=void 0===(null===(r=e.initialization)||void 0===r?void 0:r.media)?null:Xo(e.initialization.media,s,u),v=void 0===e.media?null:Xo(e.media,s,u),p=void 0!==e.initialization?e.initialization.range:void 0!==e.indexRange?[0,e.indexRange[0]-1]:void 0;this._index={indexRange:e.indexRange,indexTimeOffset:c,initialization:{url:f,range:p},segmentUrlTemplate:v,startNumber:e.startNumber,endNumber:e.endNumber,timeline:null!==(i=e.timeline)&&void 0!==i?i:[],timescale:d},this._scaledPeriodStart=ja(a,this._index),this._scaledPeriodEnd=null==o?void 0:ja(o,this._index),this._isInitialized=this._index.timeline.length>0,this._isEMSGWhitelisted=l}var t=e.prototype;return t.getInitSegment=function(){return Qo(this._index,this._isEMSGWhitelisted)},t.getSegments=function(e,t){return Jo(this._index,e,t,this._isEMSGWhitelisted,this._scaledPeriodEnd)},t.shouldRefresh=function(){return!1},t.getFirstAvailablePosition=function(){var e=this._index;return 0===e.timeline.length?null:Ha(Math.max(this._scaledPeriodStart,e.timeline[0].start),e)},t.getLastAvailablePosition=function(){var e,t=this._index.timeline;if(0===t.length)return null;var n=t[t.length-1];return Ha(Math.min(Wa(n,null,this._scaledPeriodEnd),null!==(e=this._scaledPeriodEnd)&&void 0!==e?e:1/0),this._index)},t.getEnd=function(){return this.getLastAvailablePosition()},t.awaitSegmentBetween=function(){return!1},t.isSegmentStillAvailable=function(){return!0},t.checkDiscontinuity=function(){return null},t.canBeOutOfSyncError=function(){return!1},t.isFinished=function(){return!0},t.isInitialized=function(){return this._isInitialized},t.initialize=function(e){if(!this._isInitialized){for(var t=0;t<e.length;t++)es(this._index,e[t]);this._isInitialized=!0}},t.addPredictedSegments=function(){ne.warn("Cannot add predicted segments to a `BaseRepresentationIndex`")},t._replace=function(e){this._index=e._index,this._isInitialized=e._isInitialized,this._scaledPeriodEnd=e._scaledPeriodEnd,this._isEMSGWhitelisted=e._isEMSGWhitelisted},t._update=function(){ne.error("Base RepresentationIndex: Cannot update a SegmentList")},e}(),ns=function(){function e(e,t){var n,r;if(void 0===e.duration)throw new Error("Invalid SegmentList: no duration");var i=t.periodStart,a=t.periodEnd,o=t.representationId,s=t.representationBitrate,u=t.isEMSGWhitelisted;this._isEMSGWhitelisted=u,this._periodStart=i,this._periodEnd=a;var l=null!=e.presentationTimeOffset?e.presentationTimeOffset:0,d=null!==(n=e.timescale)&&void 0!==n?n:1,c=l-i*d,f=void 0===(null===(r=e.initialization)||void 0===r?void 0:r.media)?null:Xo(e.initialization.media,o,s),v=e.list.map((function(e){return{url:void 0===e.media?null:Xo(e.media,o,s),mediaRange:e.mediaRange}}));this._index={list:v,timescale:d,duration:e.duration,indexTimeOffset:c,indexRange:e.indexRange,initialization:null==e.initialization?void 0:{url:f,range:e.initialization.range}}}var t=e.prototype;return t.getInitSegment=function(){var e=Qo(this._index);return void 0===e.privateInfos&&(e.privateInfos={}),e.privateInfos.isEMSGWhitelisted=this._isEMSGWhitelisted,e},t.getSegments=function(e,t){for(var n=this._index,r=n.duration,i=n.list,a=n.timescale,o=r/a,s=function(e,t,n){return[e*n,(e+t)*n]}(e-this._periodStart,t,a),u=s[0],l=s[1],d=Math.min(i.length-1,Math.floor(l/r)),c=[],f=Math.floor(u/r);f<=d;){var v=i[f].mediaRange,p=i[f].url,h=f*o+this._periodStart,m={id:String(f),time:h,isInit:!1,range:v,duration:o,timescale:1,end:h+o,url:p,timestampOffset:-n.indexTimeOffset/a,complete:!0,privateInfos:{isEMSGWhitelisted:this._isEMSGWhitelisted}};c.push(m),f++}return c},t.shouldRefresh=function(e,t){return!1},t.getFirstAvailablePosition=function(){return this._periodStart},t.getLastAvailablePosition=function(){var e,t=this._index,n=t.duration,r=t.list;return Math.min(r.length*n/t.timescale+this._periodStart,null!==(e=this._periodEnd)&&void 0!==e?e:1/0)},t.getEnd=function(){return this.getLastAvailablePosition()},t.awaitSegmentBetween=function(){return!1},t.isSegmentStillAvailable=function(){return!0},t.checkDiscontinuity=function(){return null},t.canBeOutOfSyncError=function(){return!1},t.isFinished=function(){return!0},t.isInitialized=function(){return!0},t.initialize=function(){ne.error("A `ListRepresentationIndex` does not need to be initialized")},t.addPredictedSegments=function(){ne.warn("Cannot add predicted segments to a `ListRepresentationIndex`")},t._replace=function(e){this._index=e._index},t._update=function(){ne.error("A `ListRepresentationIndex` cannot be updated")},e}();function rs(e){return v.getCurrent().DEFAULT_MAXIMUM_TIME_ROUNDING_ERROR*e}function is(e,t,n){var r=e.start,i=e.duration,a=e.repeatCount;return void 0===r&&(null===t?r=0:h(t.duration)||(r=t.start+t.duration*(t.repeatCount+1))),void 0!==i&&!isNaN(i)||null===n||void 0===n.start||isNaN(n.start)||void 0===r||isNaN(r)||(i=n.start-r),void 0===r||isNaN(r)||void 0===i||isNaN(i)||void 0!==a&&isNaN(a)?(ne.warn('DASH: A "S" Element could not have been parsed.'),null):{start:r,duration:i,repeatCount:void 0===a?0:a}}function as(e){for(var t={},n=0;n<e.attributes.length;n++){var r=e.attributes[n];switch(r.name){case"t":var i=parseInt(r.value,10);isNaN(i)?ne.warn('DASH: invalid t ("'+r.value+'")'):t.start=i;break;case"d":var a=parseInt(r.value,10);isNaN(a)?ne.warn('DASH: invalid d ("'+r.value+'")'):t.duration=a;break;case"r":var o=parseInt(r.value,10);isNaN(o)?ne.warn('DASH: invalid r ("'+r.value+'")'):t.repeatCount=o}}return t}function os(e){for(var t=[],n=0;n<e.length;n++)t.push(as(e[n]));for(var r=[],i=0;i<t.length;i++){var a=is(t[i],void 0===r[r.length-1]?null:r[r.length-1],void 0===t[i+1]?null:t[i+1]);null!==a&&r.push(a)}return r}function ss(e,t){var n,r=function(e,t){if(0===e.length||0===t.length)return null;var n=e[0].start,r=t[0].getAttribute("t"),i=null===r?null:parseInt(r,10);if(null===i||Number.isNaN(i))return null;if(n===i)return{prevSegmentsIdx:0,newElementsIdx:0,repeatNumberInPrevSegments:0,repeatNumberInNewElements:0};if(n<i)for(var a=e[0],o=0;;){if(a.repeatCount>0){var s=i-a.start;if(s%a.duration==0&&s/a.duration<=a.repeatCount)return{repeatNumberInPrevSegments:s/a.duration,prevSegmentsIdx:o,newElementsIdx:0,repeatNumberInNewElements:0}}if(++o>=e.length)return null;if((a=e[o]).start===i)return{prevSegmentsIdx:o,newElementsIdx:0,repeatNumberInPrevSegments:0,repeatNumberInNewElements:0};if(a.start>i)return null}else for(var u=0,l=t[0],d=i;;){var c=l.getAttribute("d"),f=null===c?null:parseInt(c,10);if(null===f||Number.isNaN(f))return null;var v=l.getAttribute("r"),p=null===v?null:parseInt(v,10);if(null!==p){if(Number.isNaN(p)||p<0)return null;if(p>0){var h=n-d;if(h%f==0&&h/f<=p)return{repeatNumberInPrevSegments:0,repeatNumberInNewElements:h/f,prevSegmentsIdx:0,newElementsIdx:u}}d+=f*(p+1)}else d+=f;if(++u>=t.length)return null;var m=(l=t[u]).getAttribute("t"),g=null===m?null:parseInt(m,10);if(null!==g){if(Number.isNaN(g))return null;d=g}if(d===n)return{newElementsIdx:u,prevSegmentsIdx:0,repeatNumberInPrevSegments:0,repeatNumberInNewElements:0};if(d>i)return null}}(t,e);if(null===r)return ne.warn('DASH: Cannot perform "based" update. Common segment not found.'),os(e);var i=r.prevSegmentsIdx,a=r.newElementsIdx,o=r.repeatNumberInPrevSegments,s=r.repeatNumberInNewElements,u=t.length-i+a-1;if(u>=e.length)return ne.info('DASH: Cannot perform "based" update. New timeline too short'),os(e);var l=t.slice(i);if(o>0){var d=l[0];d.start+=d.duration*o,l[0].repeatCount-=o}if(s>0&&0!==a)return ne.info('DASH: Cannot perform "based" update. The new timeline has a different form.'),os(e);var c=l[l.length-1],f=as(e[u]),v=(null!==(n=f.repeatCount)&&void 0!==n?n:0)-s;if(f.duration!==c.duration||c.repeatCount>v)return ne.info('DASH: Cannot perform "based" update. The new timeline has a different form at the beginning.'),os(e);void 0!==f.repeatCount&&f.repeatCount>c.repeatCount&&(c.repeatCount=f.repeatCount);for(var p=[],h=[],m=u+1;m<e.length;m++)h.push(as(e[m]));for(var g=0;g<h.length;g++){var y=is(h[g],void 0===p[p.length-1]?c:p[p.length-1],void 0===h[g+1]?null:h[g+1]);null!==y&&p.push(y)}return l.concat(p)}var us=function(){function e(t,n){var r,i,a;if(!e.isTimelineIndexArgument(t))throw new Error("The given index is not compatible with a TimelineRepresentationIndex.");var o=n.availabilityTimeComplete,s=n.manifestBoundsCalculator,u=n.isDynamic,l=n.isLastPeriod,d=n.representationId,c=n.representationBitrate,f=n.periodStart,v=n.periodEnd,p=n.isEMSGWhitelisted,h=null!==(r=t.timescale)&&void 0!==r?r:1,m=(null!=t.presentationTimeOffset?t.presentationTimeOffset:0)-f*h;this._manifestBoundsCalculator=s,this._isEMSGWhitelisted=p,this._isLastPeriod=l,this._lastUpdate=null==n.receivedTime?at():n.receivedTime,this._unsafelyBaseOnPreviousIndex=null,null!==n.unsafelyBaseOnPreviousRepresentation&&n.unsafelyBaseOnPreviousRepresentation.index instanceof e&&(n.unsafelyBaseOnPreviousRepresentation.index._unsafelyBaseOnPreviousIndex=null,this._unsafelyBaseOnPreviousIndex=n.unsafelyBaseOnPreviousRepresentation.index),this._isDynamic=u,this._parseTimeline=null!==(i=t.timelineParser)&&void 0!==i?i:null;var g=void 0===(null===(a=t.initialization)||void 0===a?void 0:a.media)?null:Xo(t.initialization.media,d,c),y=void 0===t.media?null:Xo(t.media,d,c);this._index={availabilityTimeComplete:o,indexRange:t.indexRange,indexTimeOffset:m,initialization:null==t.initialization?void 0:{url:g,range:t.initialization.range},segmentUrlTemplate:y,startNumber:t.startNumber,endNumber:t.endNumber,timeline:void 0===t.timeline?null:ls(t.timeline,t.startNumber,t.endNumber),timescale:h},this._scaledPeriodStart=ja(f,this._index),this._scaledPeriodEnd=void 0===v?void 0:ja(v,this._index)}var t=e.prototype;return t.getInitSegment=function(){return Qo(this._index,this._isEMSGWhitelisted)},t.getSegments=function(e,t){this._refreshTimeline(),null===this._index.timeline&&(this._index.timeline=this._getTimeline());var n=this._index;return Jo({segmentUrlTemplate:n.segmentUrlTemplate,startNumber:n.startNumber,endNumber:n.endNumber,timeline:n.timeline,timescale:n.timescale,indexTimeOffset:n.indexTimeOffset},e,t,this._isEMSGWhitelisted,this._scaledPeriodEnd)},t.shouldRefresh=function(){return!1},t.getFirstAvailablePosition=function(){this._refreshTimeline(),null===this._index.timeline&&(this._index.timeline=this._getTimeline());var e=this._index.timeline;return 0===e.length?null:Ha(Math.max(this._scaledPeriodStart,e[0].start),this._index)},t.getLastAvailablePosition=function(){this._refreshTimeline(),null===this._index.timeline&&(this._index.timeline=this._getTimeline());var t=e.getIndexEnd(this._index.timeline,this._scaledPeriodEnd);return null===t?null:Ha(t,this._index)},t.getEnd=function(){if(!this._isDynamic||!this._isLastPeriod)return this.getLastAvailablePosition()},t.awaitSegmentBetween=function(e,t){var n;if(Ee(),!this._isDynamic||!this._isLastPeriod)return!1;this._refreshTimeline(),null===this._index.timeline&&(this._index.timeline=this._getTimeline());var r=this._index,i=r.timeline,a=rs(r.timescale),o=ja(t,this._index);if(i.length>0&&Wa(i[i.length-1],null,this._scaledPeriodEnd)+a>=Math.min(o,null!==(n=this._scaledPeriodEnd)&&void 0!==n?n:1/0))return!1;return void 0===this._scaledPeriodEnd?o+a>this._scaledPeriodStart&&void 0:ja(e,this._index)-a<this._scaledPeriodEnd&&o+a>this._scaledPeriodStart},t.isSegmentStillAvailable=function(e){if(e.isInit)return!0;this._refreshTimeline(),null===this._index.timeline&&(this._index.timeline=this._getTimeline());var t=this._index;return Ya(e,t.timeline,t.timescale,t.indexTimeOffset)},t.checkDiscontinuity=function(e){this._refreshTimeline();var t=this._index.timeline;return null===t&&(t=this._getTimeline(),this._index.timeline=t),qa({timeline:t,timescale:this._index.timescale,indexTimeOffset:this._index.indexTimeOffset},e,this._scaledPeriodEnd)},t.canBeOutOfSyncError=function(e){return!!this._isDynamic&&(e instanceof pe&&e.isHttpError(404))},t._replace=function(e){this._parseTimeline=e._parseTimeline,this._index=e._index,this._isDynamic=e._isDynamic,this._scaledPeriodStart=e._scaledPeriodStart,this._scaledPeriodEnd=e._scaledPeriodEnd,this._lastUpdate=e._lastUpdate,this._manifestBoundsCalculator=e._manifestBoundsCalculator,this._isLastPeriod=e._isLastPeriod},t._update=function(e){null===this._index.timeline&&(this._index.timeline=this._getTimeline()),null===e._index.timeline&&(e._index.timeline=e._getTimeline()),eo(this._index.timeline,e._index.timeline)&&(this._index.startNumber=e._index.startNumber),this._index.endNumber=e._index.endNumber,this._isDynamic=e._isDynamic,this._scaledPeriodStart=e._scaledPeriodStart,this._scaledPeriodEnd=e._scaledPeriodEnd,this._lastUpdate=e._lastUpdate,this._isLastPeriod=e._isLastPeriod},t.isFinished=function(){if(!this._isDynamic||!this._isLastPeriod)return!0;null===this._index.timeline&&(this._index.timeline=this._getTimeline());var e=this._index.timeline;return void 0!==this._scaledPeriodEnd&&0!==e.length&&Wa(e[e.length-1],null,this._scaledPeriodEnd)+rs(this._index.timescale)>=this._scaledPeriodEnd},t.isInitialized=function(){return!0},t.initialize=function(){ne.error("A `TimelineRepresentationIndex` does not need to be initialized")},t.addPredictedSegments=function(){ne.warn("Cannot add predicted segments to a `TimelineRepresentationIndex`")},e.isTimelineIndexArgument=function(e){return"function"==typeof e.timelineParser||Array.isArray(e.timeline)},t._refreshTimeline=function(){if(null===this._index.timeline&&(this._index.timeline=this._getTimeline()),this._isDynamic){var e=this._manifestBoundsCalculator.estimateMinimumBound();if(null!=e){var t=ja(e,this._index),n=Ja(this._index.timeline,t);void 0!==this._index.startNumber?this._index.startNumber+=n:void 0!==this._index.endNumber&&(this._index.startNumber=n+1)}}},e.getIndexEnd=function(e,t){return e.length<=0?null:Math.min(Wa(e[e.length-1],null,t),null!=t?t:1/0)},t._getTimeline=function(){if(null===this._parseTimeline)return null!==this._index.timeline?this._index.timeline:(ne.error("DASH: Timeline already lazily parsed."),[]);var e=this._parseTimeline();this._parseTimeline=null;var t,n=v.getCurrent().MIN_DASH_S_ELEMENTS_TO_PARSE_UNSAFELY;return null===this._unsafelyBaseOnPreviousIndex||e.length<n?ls(os(e),this._index.startNumber,this._index.endNumber):(null===this._unsafelyBaseOnPreviousIndex._index.timeline?(t=this._unsafelyBaseOnPreviousIndex._getTimeline(),this._unsafelyBaseOnPreviousIndex._index.timeline=t):t=this._unsafelyBaseOnPreviousIndex._index.timeline,this._unsafelyBaseOnPreviousIndex=null,ls(ss(e,t),this._index.startNumber,this._index.endNumber))},e}();function ls(e,t,n){if(void 0===n)return e;for(var r=null!=t?t:1,i=0;i<e.length;i++){var a=e[i];if((r+=a.repeatCount+1)>n){if(r===n+1)return e.slice(0,i+1);var o=e.slice(0,i),s=Object.assign({},a),u=r-a.repeatCount-1;return s.repeatCount=Math.max(0,n-u),o.push(s),o}}return e}var ds=us,cs=function(){function e(e,t){var n,r,i=t.availabilityTimeOffset,a=t.manifestBoundsCalculator,o=t.isDynamic,s=t.periodEnd,u=t.periodStart,l=t.representationId,d=t.representationBitrate,c=t.isEMSGWhitelisted,f=null!==(n=e.timescale)&&void 0!==n?n:1;this._availabilityTimeOffset=i,this._manifestBoundsCalculator=a;var v=null!=e.presentationTimeOffset?e.presentationTimeOffset:0,p=v-u*f;if(void 0===e.duration)throw new Error("Invalid SegmentTemplate: no duration");var h=void 0===(null===(r=e.initialization)||void 0===r?void 0:r.media)?null:Xo(e.initialization.media,l,d),m=void 0===e.media?null:Xo(e.media,l,d);this._index={duration:e.duration,timescale:f,indexRange:e.indexRange,indexTimeOffset:p,initialization:null==e.initialization?void 0:{url:h,range:e.initialization.range},url:m,presentationTimeOffset:v,startNumber:e.startNumber,endNumber:e.endNumber},this._isDynamic=o,this._periodStart=u,this._scaledRelativePeriodEnd=void 0===s?void 0:(s-u)*f,this._isEMSGWhitelisted=c}var t=e.prototype;return t.getInitSegment=function(){return Qo(this._index,this._isEMSGWhitelisted)},t.getSegments=function(e,t){var n=this._index,r=n.duration,i=n.startNumber,a=n.endNumber,o=n.timescale,s=n.url,u=this._periodStart*o,l=this._scaledRelativePeriodEnd,d=e*o-u,c=(e+t)*o-u,f=this._getFirstSegmentStart(),v=this._getLastSegmentStart();if(null==f||null==v)return[];var p=Math.max(f,d),h=Math.min(v,c);if(h+r<=p)return[];for(var m=[],g=null!=i?i:1,y=Math.floor(p/r),_=y*r;_<=h;_+=r){var b=y+g;if(void 0!==a&&b>a)return m;var S=null!=l&&_+r>l?l-_:r,E=_+u,T=_+this._index.presentationTimeOffset,k=null===s?null:Zo(T,b)(s),w={id:String(b),number:b,time:E/o,end:(E+S)/o,duration:S/o,timescale:1,isInit:!1,scaledDuration:S/o,url:k,timestampOffset:-n.indexTimeOffset/o,complete:!0,privateInfos:{isEMSGWhitelisted:this._isEMSGWhitelisted}};m.push(w),y++}return m},t.getFirstAvailablePosition=function(){var e=this._getFirstSegmentStart();return null==e?e:e/this._index.timescale+this._periodStart},t.getLastAvailablePosition=function(){var e=this._getLastSegmentStart();if(h(e))return e;var t=this._estimateRelativeScaledEnd();return Math.min(e+this._index.duration,null!=t?t:1/0)/this._index.timescale+this._periodStart},t.getEnd=function(){if(!this._isDynamic)return this.getLastAvailablePosition();var e=this._estimateRelativeScaledEnd();if(void 0!==e){var t=this._index.timescale;return(e+this._periodStart*t)/t}},t.awaitSegmentBetween=function(e,t){if(Ee(),!this._isDynamic)return!1;var n=this._index.timescale,r=rs(n),i=this._periodStart*n,a=t*n-i,o=this._estimateRelativeScaledEnd();return void 0===o?a+r>=0:e*n-i-r<o},t.shouldRefresh=function(){return!1},t.checkDiscontinuity=function(){return null},t.isSegmentStillAvailable=function(e){if(e.isInit)return!0;var t=this.getSegments(e.time,.1);return 0!==t.length&&(t[0].time===e.time&&t[0].end===e.end&&t[0].number===e.number)},t.canBeOutOfSyncError=function(){return!1},t.isFinished=function(){if(!this._isDynamic)return!0;var e=this._estimateRelativeScaledEnd();if(void 0===e)return!1;var t=this._index.timescale,n=this._getLastSegmentStart();return!h(n)&&n+this._index.duration+rs(t)>=e},t.isInitialized=function(){return!0},t.initialize=function(){ne.error("A `TemplateRepresentationIndex` does not need to be initialized")},t.addPredictedSegments=function(){ne.warn("Cannot add predicted segments to a `TemplateRepresentationIndex`")},t._replace=function(e){this._index=e._index,this._isDynamic=e._isDynamic,this._periodStart=e._periodStart,this._scaledRelativePeriodEnd=e._scaledRelativePeriodEnd,this._manifestBoundsCalculator=e._manifestBoundsCalculator},t._update=function(e){this._replace(e)},t._getFirstSegmentStart=function(){if(!this._isDynamic)return 0;if(0===this._scaledRelativePeriodEnd||void 0===this._scaledRelativePeriodEnd){var e=this._manifestBoundsCalculator.estimateMaximumBound();if(void 0!==e&&e<this._periodStart)return null}var t=this._index,n=t.duration,r=t.timescale,i=this._manifestBoundsCalculator.estimateMinimumBound();if(void 0!==i){var a=i>this._periodStart?(i-this._periodStart)*r:0;return Math.floor(a/n)*n}},t._getLastSegmentStart=function(){var e,t=this._index,n=t.duration,r=t.timescale,i=t.endNumber,a=t.startNumber,o=void 0===a?1:a;if(this._isDynamic){var s=this._manifestBoundsCalculator.estimateMaximumBound();if(void 0===s)return;if(void 0!==this._scaledRelativePeriodEnd&&this._scaledRelativePeriodEnd<(s-this._periodStart)*this._index.timescale){var u=Math.ceil(this._scaledRelativePeriodEnd/n);return void 0!==i&&i-o+1<u&&(u=i-o+1),(u-1)*n}var l=(s-this._periodStart)*r;if(l<0)return null;var d=(void 0!==this._availabilityTimeOffset?this._availabilityTimeOffset:0)*r,c=Math.floor((l+d)/n);return void 0!==i&&i-o+1<c&&(c=i-o+1),c<=0?null:(c-1)*n}var f=null!==(e=this._scaledRelativePeriodEnd)&&void 0!==e?e:0,p=Math.ceil(f/n);void 0!==i&&i-o+1<p&&(p=i-o+1);var h=(p-1)*n,m=v.getCurrent().MINIMUM_SEGMENT_SIZE*r;return void 0!==i||f-h>m||p<2?h:(p-2)*n},t._estimateRelativeScaledEnd=function(){var e,t;if(void 0!==this._index.endNumber){var n=this._index.endNumber-(null!==(e=this._index.startNumber)&&void 0!==e?e:1)+1;return Math.max(Math.min(n*this._index.duration,null!==(t=this._scaledRelativePeriodEnd)&&void 0!==t?t:1/0),0)}if(void 0!==this._scaledRelativePeriodEnd)return Math.max(this._scaledRelativePeriodEnd,0)},e}();function fs(e,t){var n;if(0===t.length)return e;var r=t.map((function(e){return{url:e.value}}));if(0===e.length)return r;for(var i=[],a=0;a<e.length;a++)for(var o=e[a],s=0;s<r.length;s++){var u=r[s],l=ya(o.url,u.url);i.push({url:l,serviceLocation:null!==(n=u.serviceLocation)&&void 0!==n?n:o.serviceLocation})}return i}function vs(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return ps(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ps(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ps(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function hs(e){var t=e.adaptationProfiles,n=e.essentialProperties,r=e.supplementalProperties,i=e.manifestProfiles,a=e.codecs;if(-1!==((null!=t?t:"")+(null!=i?i:"")).indexOf("http://dashif.org/guidelines/dash-if-uhd#hevc-hdr-pq10")&&("hvc1.2.4.L153.B0"===a||"hev1.2.4.L153.B0"===a))return{colorDepth:10,eotf:"pq",colorSpace:"rec2020"};var o=be([].concat(null!=n?n:[],null!=r?r:[]),(function(e){return"urn:mpeg:mpegB:cicp:TransferCharacteristics"===e.schemeIdUri}));if(void 0!==o)switch(o.value){case"15":return;case"16":return{eotf:"pq"};case"18":return{eotf:"hlg"}}return void 0!==a&&/^vp(08|09|10)/.exec(a)?function(e){var t,n,r,i=e.split("."),a=i[0],o=(i[1],i[2],i[3]),s=(i[4],i[5]),u=i[6],l=i[7];if(("vp08"===a||"vp09"===a||"vp10"===a)&&((void 0!==o&&"10"===o||"12"===o)&&(t=parseInt(o,10)),void 0!==u&&("16"===u?n="pq":"18"===u&&(n="hlg")),void 0!==s&&void 0!==l&&"09"===s&&"09"===l&&(r="rec2020"),void 0!==t&&void 0!==n))return{colorDepth:t,eotf:n,colorSpace:r}}(a):void 0}function ms(e,t,n){for(var r,i,a,o,s,u=[],d=function(){for(var e=s.value,d=null!=e.attributes.id?e.attributes.id:String(e.attributes.bitrate)+(null!=e.attributes.height?"-"+e.attributes.height:"")+(null!=e.attributes.width?"-"+e.attributes.width:"")+(null!=e.attributes.mimeType?"-"+e.attributes.mimeType:"")+(null!=e.attributes.codecs?"-"+e.attributes.codecs:"");u.some((function(e){return e.id===d}));)d+="-dup";var c,f=null!==(i=null===(r=n.unsafelyBaseOnPreviousAdaptation)||void 0===r?void 0:r.getRepresentation(d))&&void 0!==i?i:null,v=function(e,t){var n=[];if(void 0!==e.children.inbandEventStreams&&n.push.apply(n,e.children.inbandEventStreams),void 0!==t.children.inbandEventStreams&&n.push.apply(n,t.children.inbandEventStreams),0!==n.length)return n}(e,t),p=null!==(a=e.attributes.availabilityTimeComplete)&&void 0!==a?a:n.availabilityTimeComplete,h=(null!==(o=e.attributes.availabilityTimeOffset)&&void 0!==o?o:0)+n.availabilityTimeOffset,m=function(e,t){var n,r,i,a=t.availabilityTimeOffset,o=t.manifestBoundsCalculator,s=t.isDynamic,u=t.end,d=t.start,c=t.receivedTime,f=t.timeShiftBufferDepth,v=t.unsafelyBaseOnPreviousRepresentation,p=t.inbandEventStreams,h={availabilityTimeComplete:!0,availabilityTimeOffset:a,unsafelyBaseOnPreviousRepresentation:v,isEMSGWhitelisted:function(e){return void 0!==p&&p.some((function(t){return t.schemeIdUri===e.schemeIdUri}))},isLastPeriod:t.isLastPeriod,manifestBoundsCalculator:o,isDynamic:s,periodEnd:u,periodStart:d,receivedTime:c,representationBitrate:e.attributes.bitrate,representationId:e.attributes.id,timeShiftBufferDepth:f};if(void 0!==e.children.segmentBase){var m=e.children.segmentBase;i=new ts(m,h)}else if(void 0!==e.children.segmentList){var g=e.children.segmentList;i=new ns(g,h)}else if(void 0!==e.children.segmentTemplate||t.parentSegmentTemplates.length>0){var y=t.parentSegmentTemplates.slice(),_=e.children.segmentTemplate;void 0!==_&&y.push(_);var b=l.apply(void 0,[{}].concat(y));h.availabilityTimeComplete=null!==(n=b.availabilityTimeComplete)&&void 0!==n?n:t.availabilityTimeComplete,h.availabilityTimeOffset=(null!==(r=b.availabilityTimeOffset)&&void 0!==r?r:0)+t.availabilityTimeOffset,i=ds.isTimelineIndexArgument(b)?new ds(b,h):new cs(b,h)}else{var S=t.adaptation.children;if(void 0!==S.segmentBase){var E=S.segmentBase;i=new ts(E,h)}else if(void 0!==S.segmentList){var T=S.segmentList;i=new ns(T,h)}else i=new cs({duration:Number.MAX_VALUE,timescale:1,startNumber:0,media:""},h)}return i}(e,l({},n,{availabilityTimeOffset:h,availabilityTimeComplete:p,unsafelyBaseOnPreviousRepresentation:f,adaptation:t,inbandEventStreams:v}));null==e.attributes.bitrate?(ne.warn("DASH: No usable bitrate found in the Representation."),c=0):c=e.attributes.bitrate;var g,y=fs(n.baseURLs,e.children.baseURLs),_={bitrate:c,cdnMetadata:0===y.length?[{baseUrl:"",id:void 0}]:y.map((function(e){return{baseUrl:e.url,id:e.serviceLocation}})),index:m,id:d};void 0!==e.children.supplementalProperties&&be(e.children.supplementalProperties,(function(e){return"tag:dolby.com,2018:dash:EC3_ExtensionType:2018"===e.schemeIdUri&&"JOC"===e.value}))&&(_.isSpatialAudio=!0),null!=e.attributes.codecs?g=e.attributes.codecs:null!=t.attributes.codecs&&(g=t.attributes.codecs),null!=g&&(g="mp4a.40.02"===g?"mp4a.40.2":g,_.codecs=g),null!=e.attributes.frameRate?_.frameRate=e.attributes.frameRate:null!=t.attributes.frameRate&&(_.frameRate=t.attributes.frameRate),null!=e.attributes.height?_.height=e.attributes.height:null!=t.attributes.height&&(_.height=t.attributes.height),null!=e.attributes.mimeType?_.mimeType=e.attributes.mimeType:null!=t.attributes.mimeType&&(_.mimeType=t.attributes.mimeType),null!=e.attributes.width?_.width=e.attributes.width:null!=t.attributes.width&&(_.width=t.attributes.width);var b=void 0!==t.children.contentProtections?t.children.contentProtections:[];if(void 0!==e.children.contentProtections&&b.push.apply(b,e.children.contentProtections),b.length>0){var S=b.reduce((function(e,t){var n;if(void 0!==t.attributes.schemeIdUri&&"urn:uuid:"===t.attributes.schemeIdUri.substring(0,9)&&(n=t.attributes.schemeIdUri.substring(9).replace(/-/g,"").toLowerCase()),void 0!==t.attributes.keyId&&t.attributes.keyId.length>0){var r={keyId:t.attributes.keyId,systemId:n};void 0===e.keyIds?e.keyIds=[r]:e.keyIds.push(r)}if(void 0!==n){for(var i,a=[],o=vs(t.children.cencPssh);!(i=o()).done;){var s=i.value;a.push({systemId:n,data:s})}if(a.length>0){var u,l=be(e.initData,(function(e){return"cenc"===e.type}));if(void 0===l)e.initData.push({type:"cenc",values:a});else(u=l.values).push.apply(u,a)}}return e}),{keyIds:void 0,initData:[]});(Object.keys(S.initData).length>0||void 0!==S.keyIds&&S.keyIds.length>0)&&(_.contentProtections=S)}_.hdrInfo=hs({adaptationProfiles:t.attributes.profiles,supplementalProperties:t.children.supplementalProperties,essentialProperties:t.children.essentialProperties,manifestProfiles:n.manifestProfiles,codecs:g}),u.push(_)},c=vs(e);!(s=c()).done;)d();return u}function gs(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return ys(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ys(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ys(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function _s(e){if(void 0===e)return!1;var t="urn:tva:metadata:cs:AudioPurposeCS:2007"===e.schemeIdUri&&"1"===e.value,n="urn:mpeg:dash:role:2011"===e.schemeIdUri&&"description"===e.value;return t||n}function bs(e,t){if(void 0!==e&&e.some((function(e){return"urn:tva:metadata:cs:AudioPurposeCS:2007"===e.schemeIdUri&&"2"===e.value})))return!0;if(void 0!==t&&t.some((function(e){return"urn:mpeg:dash:role:2011"===e.schemeIdUri&&"caption"===e.value})))return!0;return!1}function Ss(e){return void 0!==e&&("urn:mpeg:dash:role:2011"===e.schemeIdUri&&"sign"===e.value)}function Es(e,t){if(p(e.attributes.id))return e.attributes.id;var n=t.isClosedCaption,r=t.isForcedSubtitle,i=t.isAudioDescription,a=t.isSignInterpreted,o=t.isTrickModeTrack,s=t.type;return p(e.attributes.language)&&(s+="-"+e.attributes.language),!0===n&&(s+="-cc"),!0===r&&(s+="-cc"),!0===i&&(s+="-ad"),!0===a&&(s+="-si"),o&&(s+="-trickMode"),p(e.attributes.contentType)&&(s+="-"+e.attributes.contentType),p(e.attributes.codecs)&&(s+="-"+e.attributes.codecs),p(e.attributes.mimeType)&&(s+="-"+e.attributes.mimeType),void 0!==e.attributes.frameRate&&(s+="-"+String(e.attributes.frameRate)),s}function Ts(e){if(null!=e.children.supplementalProperties)for(var t,n=gs(e.children.supplementalProperties);!(t=n()).done;){var r=t.value;if("urn:mpeg:dash:adaptation-set-switching:2016"===r.schemeIdUri&&null!=r.value)return r.value.split(",").map((function(e){return e.trim()})).filter((function(e){return e}))}return[]}function ks(e,t){var n=t[1].priority-e[1].priority;return 0!==n?n:e[1].isMainAdaptation!==t[1].isMainAdaptation?e[1].isMainAdaptation?-1:1:e[1].indexInMpd-t[1].indexInMpd}function ws(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return As(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return As(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function As(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Is=Ae();function Rs(e,t){var n,r,i,a,o,s,u=[],l=function(e,t){var n=[];return e.forEach((function(r,i){var a,o;if(null!=r.attributes.start)a=r.attributes.start;else if(0===i)a=t.isDynamic&&null!=t.availabilityStartTime?t.availabilityStartTime:0;else{var s=n[n.length-1];if(null==s||null==s.periodEnd)throw new Error("Missing start time when parsing periods.");a=s.periodEnd}var u=e[i+1];null!=r.attributes.duration?o=r.attributes.duration:i===e.length-1?o=t.duration:null!=u.attributes.start&&(o=u.attributes.start-a);var l=null!=o?a+o:void 0;n.push({periodStart:a,periodDuration:o,periodEnd:l})})),n}(e,t);if(l.length!==e.length)throw new Error("MPD parsing error: the time information are incoherent.");var d=t.isDynamic,c=t.timeShiftBufferDepth,f=new Go({isDynamic:d,timeShiftBufferDepth:c});d||null==t.duration||f.setLastPosition(t.duration);for(var v=function(){var v,m=h===e.length-1,y=e[h],_=t.xlinkInfos.get(y),b=fs(t.baseURLs,y.children.baseURLs),S=l[h],E=S.periodStart,T=S.periodDuration,k=S.periodEnd;for(null==y.attributes.id?(ne.warn("DASH: No usable id found in the Period. Generating one."),v="gen-dash-period-"+Is()):v=y.attributes.id;u.some((function(e){return e.id===v}));)v+="-dup";var w=void 0!==_?_.receivedTime:t.receivedTime,A=null!==(r=null===(n=t.unsafelyBaseOnPreviousManifest)||void 0===n?void 0:n.getPeriod(v))&&void 0!==r?r:null,I=null===(i=y.attributes.availabilityTimeComplete)||void 0===i||i,R=null!==(a=y.attributes.availabilityTimeOffset)&&void 0!==a?a:0,x=t.manifestProfiles,M=y.children.segmentTemplate,C={availabilityTimeComplete:I,availabilityTimeOffset:R,baseURLs:b,manifestBoundsCalculator:f,end:k,isDynamic:d,isLastPeriod:m,manifestProfiles:x,receivedTime:w,segmentTemplate:M,start:E,timeShiftBufferDepth:c,unsafelyBaseOnPreviousPeriod:A},P=function(e,t){for(var n,r,i,a,o,s,u={video:[],audio:[],text:[]},l=[],d={},c=[],f=0;f<e.length;f++){var v=e[f],h=v.children,m=h.essentialProperties,y=h.roles,_=h.label,b=Array.isArray(y)&&y.some((function(e){return"main"===e.value}))&&y.some((function(e){return"urn:mpeg:dash:role:2011"===e.schemeIdUri})),S=v.children.representations,E=null!==(n=v.attributes.availabilityTimeComplete)&&void 0!==n?n:t.availabilityTimeComplete,T=(null!==(r=v.attributes.availabilityTimeOffset)&&void 0!==r?r:0)+t.availabilityTimeOffset,k=v.attributes.mimeType,w=v.attributes.codecs,A=Yo(S,p(k)?k:null,p(w)?w:null,null!=h.roles?h.roles:null);if(void 0!==A){var I=null!==(i=v.attributes.selectionPriority)&&void 0!==i?i:1,R=v.attributes.id,x=Ts(v),M=[];void 0!==t.segmentTemplate&&M.push(t.segmentTemplate),void 0!==v.children.segmentTemplate&&M.push(v.children.segmentTemplate);var C={availabilityTimeComplete:E,availabilityTimeOffset:T,baseURLs:fs(t.baseURLs,h.baseURLs),manifestBoundsCalculator:t.manifestBoundsCalculator,end:t.end,isDynamic:t.isDynamic,isLastPeriod:t.isLastPeriod,manifestProfiles:t.manifestProfiles,parentSegmentTemplates:M,receivedTime:t.receivedTime,start:t.start,timeShiftBufferDepth:t.timeShiftBufferDepth,unsafelyBaseOnPreviousAdaptation:null},P=Array.isArray(m)?be(m,(function(e){return"http://dashif.org/guidelines/trickmode"===e.schemeIdUri})):void 0,D=null===(a=null==P?void 0:P.value)||void 0===a?void 0:a.split(" "),N=void 0!==D,O=h.accessibilities,L=void 0;void 0!==y&&y.some((function(e){return"dub"===e.value}))&&(L=!0);var U=void 0;U="text"===A&&bs(O,y);var B=void 0;"text"===A&&void 0!==y&&y.some((function(e){return"forced-subtitle"===e.value||"forced_subtitle"===e.value}))&&(B=!0);var F=void 0;"audio"!==A?F=!1:void 0!==O&&(F=O.some(_s));var z=void 0;"video"!==A?z=!1:void 0!==O&&(z=O.some(Ss));for(var V=Es(v,{isAudioDescription:F,isForcedSubtitle:B,isClosedCaption:U,isSignInterpreted:z,isTrickModeTrack:N,type:A});Se(c,V);)V+="-dup";var K=V;c.push(V),C.unsafelyBaseOnPreviousAdaptation=null!==(s=null===(o=t.unsafelyBaseOnPreviousPeriod)||void 0===o?void 0:o.getAdaptation(V))&&void 0!==s?s:null;var G={id:V,representations:ms(S,v,C),type:A,isTrickModeTrack:N};if(null!=v.attributes.language&&(G.language=v.attributes.language),null!=U&&(G.closedCaption=U),null!=F&&(G.audioDescription=F),!0===L&&(G.isDub=!0),void 0!==B&&(G.forcedSubtitles=B),!0===z&&(G.isSignInterpreted=!0),void 0!==_&&(G.label=_),void 0!==D)l.push({adaptation:G,trickModeAttachedAdaptationIds:D});else{for(var W,j=-1,H=function(){var e=W.value,t=d[e];if(void 0!==t&&t.newID!==K&&Se(t.adaptationSetSwitchingIDs,R)){j=g(u[A],(function(t){return t[0].id===e}));var n,r=u[A][j];if(void 0!==r&&r[0].audioDescription===G.audioDescription&&r[0].closedCaption===G.closedCaption&&r[0].language===G.language)return ne.info('DASH Parser: merging "switchable" AdaptationSets',R,e),(n=r[0].representations).push.apply(n,G.representations),r[1]={priority:Math.max(I,r[1].priority),isMainAdaptation:b||r[1].isMainAdaptation,indexInMpd:Math.min(f,r[1].indexInMpd)},1}},q=gs(x);!(W=q()).done&&!H(););j<0&&u[A].push([G,{priority:I,isMainAdaptation:b,indexInMpd:f}])}null!=R&&null==d[R]&&(d[R]={newID:K,adaptationSetSwitchingIDs:x})}}var Y=vn.reduce((function(e,t){var n=u[t];return n.length>0&&(n.sort(ks),e[t]=n.map((function(e){return e[0]}))),e}),{});return u.video.sort(ks),Ho(Y,l),Y}(y.children.adaptations,C),D=(null!==(o=t.xmlNamespaces)&&void 0!==o?o:[]).concat(null!==(s=y.attributes.namespaces)&&void 0!==s?s:[]),N=function(e,t,n){for(var r,i,a,o=[],s=ws(e);!(a=s()).done;)for(var u,l=a.value,d=l.attributes,c=d.schemeIdUri,f=void 0===c?"":c,v=d.timescale,p=void 0===v?1:v,h=n.concat(null!==(r=l.attributes.namespaces)&&void 0!==r?r:[]),m=ws(l.children.events);!(u=m()).done;){var g=u.value;if(void 0!==g.eventStreamData){var y=(null!==(i=g.presentationTime)&&void 0!==i?i:0)/p+t,_=void 0===g.duration?void 0:y+g.duration/p,b=void 0;if(g.eventStreamData instanceof Element)b=g.eventStreamData;else{var S=h.reduce((function(e,t){return e+"xmlns:"+t.key+'="'+t.value+'" '}),"<toremove ");S+=">";var E=wa(new Uint8Array(g.eventStreamData));b=(new DOMParser).parseFromString(S+E+"</toremove>","application/xml").documentElement.childNodes[0]}o.push({start:y,end:_,id:g.id,data:{type:"dash-event-stream",value:{schemeIdUri:f,timescale:p,element:b}}})}}return o}(y.children.eventStreams,E,D),O={id:v,start:E,end:k,duration:T,adaptations:P,streamEvents:N};if(u.unshift(O),!f.lastPositionIsKnown()){var L=function(e){for(var t,n=null,r=!0,i=ws(Ko(Gt(e).filter((function(e){return null!=e})),(function(e){return e})));!(t=i()).done;)for(var a,o=ws(t.value.representations);!(a=o()).done;){var s=a.value.index.getLastAvailablePosition();null!==s&&(r=!1,"number"==typeof s&&(n=null==n?s:Math.max(n,s)))}if(null!=n)return n;if(r)return null;return}(P);if(d)if("number"==typeof L){var U=at()/1e3;f.setLastPosition(L,U)}else{var B=xs(t,E);if(void 0!==B){var F=B[0],z=B[1];f.setLastPosition(F,z)}}else"number"==typeof L&&f.setLastPosition(L)}},h=e.length-1;h>=0;h--)v();if(t.isDynamic&&!f.lastPositionIsKnown()){var m=xs(t,0);if(void 0!==m){var y=m[0],_=m[1];f.setLastPosition(y,_)}}return function(e){if(0===e.length)return[];for(var t=[e[0]],n=1;n<e.length;n++){for(var r=e[n],i=t[t.length-1];(void 0===i.duration||i.start+i.duration>r.start)&&(ne.warn("DASH: Updating overlapping Periods.",null==i?void 0:i.start,r.start),i.duration=r.start-i.start,i.end=r.start,!(i.duration>0));)t.pop(),i=t[t.length-1];t.push(r)}return t}(u)}function xs(e,t){if(null!=e.clockOffset){var n=e.clockOffset/1e3-e.availabilityStartTime,r=at()/1e3,i=r+n;if(i>=t)return[i,r]}else{var a=Date.now()/1e3;if(a>=t)return ne.warn("DASH Parser: no clock synchronization mechanism found. Using the system clock instead."),[a-e.availabilityStartTime,at()/1e3]}}function Ms(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Cs(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Cs(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Cs(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Ps=function e(t,n,r,i,a){void 0===a&&(a=new WeakMap);var o=t.children,s=t.attributes;if(null==n.externalClockOffset){var u="dynamic"===s.type,l=be(o.utcTimings,(function(e){return"urn:mpeg:dash:utc:direct:2014"===e.schemeIdUri&&null!=e.value})),d=null!=l&&null!=l.value?Bo(l.value):void 0,c=null==d||isNaN(d)?void 0:d;if(null!=c&&!0!==i)n.externalClockOffset=c;else if(u&&!0!==i){var f=function(e){var t=e.children.utcTimings.filter((function(e){return("urn:mpeg:dash:utc:http-iso:2014"===e.schemeIdUri||"urn:mpeg:dash:utc:http-xsdate:2014"===e.schemeIdUri)&&void 0!==e.value}));return t.length>0?t[0].value:void 0}(t);if(null!=f&&f.length>0)return{type:"needs-clock",value:{url:f,continue:function(i){return i.success?(n.externalClockOffset=Bo(i.data),e(t,n,r,!0)):(r.push(i.error),ne.warn("DASH Parser: Error on fetching the clock ressource",i.error),e(t,n,r,!0))}}}}}for(var p=[],h=0;h<o.periods.length;h++){var m=o.periods[h].attributes,g=m.xlinkHref,y=m.xlinkActuate;null!=g&&"onLoad"===y&&p.push({index:h,ressource:g})}return 0===p.length?function(e,t,n,r){var i,a,o,s,u,l,d=e.children,c=e.attributes,f="dynamic"===c.type,p=void 0!==t.url?[{url:t.url.substring(0,_a(t.url))}]:[],h=fs(p,d.baseURLs),m=function(e,t){return"dynamic"!==e.type?0:null==e.availabilityStartTime?null==t?0:t:e.availabilityStartTime}(c,t.referenceDateTime),g=c.timeShiftBufferDepth,y=t.externalClockOffset,_=t.unsafelyBaseOnPreviousManifest,b={availabilityStartTime:m,baseURLs:h,clockOffset:y,duration:c.duration,isDynamic:f,manifestProfiles:e.attributes.profiles,receivedTime:t.manifestReceivedTime,timeShiftBufferDepth:g,unsafelyBaseOnPreviousManifest:_,xlinkInfos:r,xmlNamespaces:e.attributes.namespaces},S=Rs(d.periods,b),E=c.duration,T=null;void 0!==c.minimumUpdatePeriod&&c.minimumUpdatePeriod>=0&&(s=0===c.minimumUpdatePeriod?v.getCurrent().DASH_FALLBACK_LIFETIME_WHEN_MINIMUM_UPDATE_PERIOD_EQUAL_0:c.minimumUpdatePeriod);var k=Vo(S),w=k.minimumSafePosition,A=k.maximumSafePosition,I=k.maximumUnsafePosition,R=at();if(f){var x,M;if(u=w,T=null!=g?g:null,void 0!==I&&(M=I),void 0!==A)x=A;else{var C=null!=m?m:0,P=t.externalClockOffset;if(void 0===P)ne.warn("DASH Parser: use system clock to define maximum position"),x=Date.now()/1e3-C;else x=(at()+P)/1e3-C}void 0===M&&(M=x),l={isLinear:!0,maximumSafePosition:x,livePosition:M,time:R},null!==T&&void 0!==u&&x-u>T&&(T=x-u)}else{u=void 0!==w?w:void 0!==(null===(i=S[0])||void 0===i?void 0:i.start)?S[0].start:0;var D=null!=E?E:1/0;if(void 0!==S[S.length-1]){var N=S[S.length-1],O=null!==(a=N.end)&&void 0!==a?a:void 0!==N.duration?N.start+N.duration:void 0;void 0!==O&&O<D&&(D=O)}void 0!==A&&A<D&&(D=A),l={isLinear:!1,maximumSafePosition:D,livePosition:void 0,time:R}}var L=!f||void 0===e.attributes.minimumUpdatePeriod&&(void 0!==(null===(o=S[S.length-1])||void 0===o?void 0:o.end)||void 0!==e.attributes.duration),U={availabilityStartTime:m,clockOffset:t.externalClockOffset,isDynamic:f,isLive:f,isLastPeriodKnown:L,periods:S,publishTime:c.publishTime,suggestedPresentationDelay:c.suggestedPresentationDelay,transportType:"dash",timeBounds:{minimumSafePosition:u,timeshiftDepth:T,maximumTimeData:l},lifetime:s,uris:null==t.url?d.locations:[t.url].concat(d.locations)};return{type:"done",value:{parsed:U,warnings:n}}}(t,n,r,a):{type:"needs-xlinks",value:{xlinksUrls:p.map((function(e){return e.ressource})),continue:function(s){if(s.length!==p.length)throw new Error("DASH parser: wrong number of loaded ressources.");for(var u=s.length-1;u>=0;u--){var l,d=p[u].index,c=s[u],f=c.parsed,v=c.warnings,h=c.receivedTime,m=c.sendingTime,g=c.url;v.length>0&&r.push.apply(r,v);for(var y,_=Ms(f);!(y=_()).done;){var b=y.value;a.set(b,{receivedTime:h,sendingTime:m,url:g})}(l=o.periods).splice.apply(l,[d,1].concat(f))}return e(t,n,r,i,a)}}}};function Ds(e){var t=e.textContent,n=[];return null===t||0===t.length?[void 0,n]:[{value:t},n]}function Ns(e){for(var t={},n=0;n<e.attributes.length;n++){var r=e.attributes[n];switch(r.name){case"id":t.id=r.value;break;case"lang":t.language=r.value;break;case"contentType":t.contentType=r.value;break;case"par":t.par=r.value}}return t}var Os=/^P(([\d.]*)Y)?(([\d.]*)M)?(([\d.]*)D)?T?(([\d.]*)H)?(([\d.]*)M)?(([\d.]*)S)?/,Ls=/([0-9]+)-([0-9]+)/;function Us(e,t){return"true"===e?[!0,null]:"false"===e?[!1,null]:[!1,new Ys("`"+t+'` property is not a boolean value but "'+e+'"')]}function Bs(e,t){var n=parseInt(e,10);return isNaN(n)?[null,new Ys("`"+t+'` property is not an integer value but "'+e+'"')]:[n,null]}function Fs(e,t){if("INF"===e)return[1/0,null];var n=parseFloat(e);return isNaN(n)?[null,new Ys("`"+t+'` property is invalid: "'+e+'"')]:[n,null]}function zs(e,t){if("true"===e)return[!0,null];if("false"===e)return[!1,null];var n=parseInt(e,10);return isNaN(n)?[null,new Ys("`"+t+'` property is not a boolean nor an integer but "'+e+'"')]:[n,null]}function Vs(e,t){var n=Date.parse(e);return isNaN(n)?[null,new Ys("`"+t+'` is in an invalid date format: "'+e+'"')]:[new Date(Date.parse(e)).getTime()/1e3,null]}function Ks(e,t){if(!p(e))return[0,new Ys("`"+t+"` property is empty")];var n=Os.exec(e);return null===n?[null,new Ys("`"+t+'` property has an unrecognized format "'+e+'"')]:[365*parseFloat(p(n[2])?n[2]:"0")*24*60*60+30*parseFloat(p(n[4])?n[4]:"0")*24*60*60+24*parseFloat(p(n[6])?n[6]:"0")*60*60+60*parseFloat(p(n[8])?n[8]:"0")*60+60*parseFloat(p(n[10])?n[10]:"0")+parseFloat(p(n[12])?n[12]:"0"),null]}function Gs(e,t){var n=Ls.exec(e);return null===n?[null,new Ys("`"+t+'` property has an unrecognized format "'+e+'"')]:[[+n[1],+n[2]],null]}function Ws(e,t){try{return[za(e),null]}catch(n){return[null,new Ys("`"+t+'` is not a valid base64 string: "'+e+'"')]}}function js(e,t){var n=/^(\d+)\/(\d+)$/.exec(e);return null!==n?[+n[1]/+n[2],null]:Fs(e,t)}function Hs(e){for(var t,n,r=0;r<e.attributes.length;r++){var i=e.attributes[r];switch(i.name){case"schemeIdUri":t=i.value;break;case"value":n=i.value}}return{schemeIdUri:t,value:n}}function qs(e,t){return function(n,r){var i=r.asKey,a=(0,r.parser)(n,r.dashName),o=a[0],s=a[1];null!==s&&(ne.warn(s.message),t.push(s)),null!==o&&(e[i]=o)}}var Ys=function(e){function t(n){var r;return r=e.call(this)||this,Object.setPrototypeOf(ie(r),t.prototype),r.name="MPDError",r.message=n,r}return s(t,e),t}(se(Error));function Qs(e){var t=function(e){for(var t=[],n=[],r=0;r<e.length;r++)if(e[r].nodeType===Node.ELEMENT_NODE){var i=e[r];if("cenc:pssh"===i.nodeName){var a=i.textContent;if(null!==a&&a.length>0){var o=Ws(a,"cenc:pssh"),s=o[0],u=o[1];null!==u&&(ne.warn(u.message),t.push(u)),null!==s&&n.push(s)}}}return[{cencPssh:n},t]}(e.childNodes),n=t[0],r=t[1];return[{children:n,attributes:function(e){for(var t={},n=0;n<e.attributes.length;n++){var r=e.attributes[n];switch(r.name){case"schemeIdUri":t.schemeIdUri=r.value;break;case"value":t.value=r.value;break;case"cenc:default_KID":t.keyId=Aa(r.value.replace(/-/g,""))}}return t}(e)},r]}function $s(e){for(var t={},n=[],r=qs(t,n),i=0;i<e.attributes.length;i++){var a=e.attributes[i];switch(a.name){case"range":r(a.value,{asKey:"range",parser:Gs,dashName:"range"});break;case"sourceURL":t.media=a.value}}return[t,n]}function Xs(e){for(var t={},n=[],r=qs(t,n),i=e.childNodes,a=0;a<i.length;a++)if(i[a].nodeType===Node.ELEMENT_NODE){var o=i[a];if("Initialization"===o.nodeName){var s=$s(o),u=s[0],l=s[1];t.initialization=u,n=n.concat(l)}}for(var d=0;d<e.attributes.length;d++){var c=e.attributes[d];switch(c.name){case"timescale":r(c.value,{asKey:"timescale",parser:Bs,dashName:"timescale"});break;case"presentationTimeOffset":r(c.value,{asKey:"presentationTimeOffset",parser:Fs,dashName:"presentationTimeOffset"});break;case"indexRange":r(c.value,{asKey:"indexRange",parser:Gs,dashName:"indexRange"});break;case"indexRangeExact":r(c.value,{asKey:"indexRangeExact",parser:Us,dashName:"indexRangeExact"});break;case"availabilityTimeOffset":r(c.value,{asKey:"availabilityTimeOffset",parser:Fs,dashName:"availabilityTimeOffset"});break;case"availabilityTimeComplete":r(c.value,{asKey:"availabilityTimeComplete",parser:Us,dashName:"availabilityTimeComplete"});break;case"duration":r(c.value,{asKey:"duration",parser:Bs,dashName:"duration"});break;case"startNumber":r(c.value,{asKey:"startNumber",parser:Bs,dashName:"startNumber"});break;case"endNumber":r(c.value,{asKey:"endNumber",parser:Bs,dashName:"endNumber"})}}return[t,n]}function Zs(e){for(var t={},n=[],r=qs(t,n),i=0;i<e.attributes.length;i++){var a=e.attributes[i];switch(a.name){case"media":t.media=a.value;break;case"indexRange":r(a.value,{asKey:"indexRange",parser:Gs,dashName:"indexRange"});break;case"index":t.index=a.value;break;case"mediaRange":r(a.value,{asKey:"mediaRange",parser:Gs,dashName:"mediaRange"})}}return[t,n]}function Js(e){for(var t=Xs(e),n=t[0],r=t[1],i=[],a=e.childNodes,o=0;o<a.length;o++)if(a[o].nodeType===Node.ELEMENT_NODE){var s=a[o];if("SegmentURL"===s.nodeName){var u=Zs(s),d=u[0],c=u[1];i.push(d),r=r.concat(c)}}return[l(n,{list:i}),r]}function eu(e){var t=null;return function(){if(null===t){var n=e.getElementsByTagName("S");return t=n,n}return t}}function tu(e){for(var t,n=Xs(e),r=n[0],i=n[1],a=0;a<e.childNodes.length;a++)if(e.childNodes[a].nodeType===Node.ELEMENT_NODE){var o=e.childNodes[a];"SegmentTimeline"===o.nodeName&&(t=eu(o))}for(var s=l({},r,{duration:r.duration,timelineParser:t}),u=qs(s,i),d=0;d<e.attributes.length;d++){var c=e.attributes[d];switch(c.nodeName){case"initialization":null==s.initialization&&(s.initialization={media:c.value});break;case"index":s.index=c.value;break;case"availabilityTimeOffset":u(c.value,{asKey:"availabilityTimeOffset",parser:Fs,dashName:"availabilityTimeOffset"});break;case"availabilityTimeComplete":u(c.value,{asKey:"availabilityTimeComplete",parser:Us,dashName:"availabilityTimeComplete"});break;case"media":s.media=c.value;break;case"bitstreamSwitching":u(c.value,{asKey:"bitstreamSwitching",parser:Us,dashName:"bitstreamSwitching"})}}return[s,i]}function nu(e){var t=function(e){for(var t={baseURLs:[]},n=[],r=[],i=0;i<e.length;i++)if(e[i].nodeType===Node.ELEMENT_NODE){var a=e[i];switch(a.nodeName){case"BaseURL":var o=Ds(a),s=o[0],u=o[1];void 0!==s&&t.baseURLs.push(s),r=r.concat(u);break;case"InbandEventStream":void 0===t.inbandEventStreams&&(t.inbandEventStreams=[]),t.inbandEventStreams.push(Hs(a));break;case"SegmentBase":var l=Xs(a),d=l[0],c=l[1];t.segmentBase=d,c.length>0&&(r=r.concat(c));break;case"SegmentList":var f=Js(a),v=f[0],p=f[1];r=r.concat(p),t.segmentList=v;break;case"SegmentTemplate":var h=tu(a),m=h[0],g=h[1];r=r.concat(g),t.segmentTemplate=m;break;case"ContentProtection":var y=Qs(a),_=y[0],b=y[1];b.length>0&&(r=r.concat(b)),void 0!==_&&n.push(_);break;case"SupplementalProperty":null==t.supplementalProperties?t.supplementalProperties=[Hs(a)]:t.supplementalProperties.push(Hs(a))}}return n.length>0&&(t.contentProtections=n),[t,r]}(e.childNodes),n=t[0],r=t[1],i=function(e){for(var t={},n=[],r=qs(t,n),i=0;i<e.attributes.length;i++){var a=e.attributes[i];switch(a.name){case"audioSamplingRate":t.audioSamplingRate=a.value;break;case"bandwidth":r(a.value,{asKey:"bitrate",parser:Bs,dashName:"bandwidth"});break;case"codecs":t.codecs=a.value;break;case"codingDependency":r(a.value,{asKey:"codingDependency",parser:Us,dashName:"codingDependency"});break;case"frameRate":r(a.value,{asKey:"frameRate",parser:js,dashName:"frameRate"});break;case"height":r(a.value,{asKey:"height",parser:Bs,dashName:"height"});break;case"id":t.id=a.value;break;case"maxPlayoutRate":r(a.value,{asKey:"maxPlayoutRate",parser:Fs,dashName:"maxPlayoutRate"});break;case"maximumSAPPeriod":r(a.value,{asKey:"maximumSAPPeriod",parser:Fs,dashName:"maximumSAPPeriod"});break;case"mimeType":t.mimeType=a.value;break;case"profiles":t.profiles=a.value;break;case"qualityRanking":r(a.value,{asKey:"qualityRanking",parser:Bs,dashName:"qualityRanking"});break;case"segmentProfiles":t.segmentProfiles=a.value;break;case"width":r(a.value,{asKey:"width",parser:Bs,dashName:"width"});break;case"availabilityTimeOffset":r(a.value,{asKey:"availabilityTimeOffset",parser:Fs,dashName:"availabilityTimeOffset"});break;case"availabilityTimeComplete":r(a.value,{asKey:"availabilityTimeComplete",parser:Us,dashName:"availabilityTimeComplete"})}}return void 0===t.bitrate&&n.push(new Ys("No bitrate found on a Representation")),[t,n]}(e),a=i[0],o=i[1];return[{children:n,attributes:a},r.concat(o)]}function ru(e){var t=function(e){for(var t={baseURLs:[],representations:[]},n=[],r=[],i=0;i<e.length;i++)if(e[i].nodeType===Node.ELEMENT_NODE){var a=e[i];switch(a.nodeName){case"Accessibility":void 0===t.accessibilities?t.accessibilities=[Hs(a)]:t.accessibilities.push(Hs(a));break;case"BaseURL":var o=Ds(a),s=o[0],u=o[1];void 0!==s&&t.baseURLs.push(s),u.length>0&&(r=r.concat(u));break;case"ContentComponent":t.contentComponent=Ns(a);break;case"EssentialProperty":null==t.essentialProperties?t.essentialProperties=[Hs(a)]:t.essentialProperties.push(Hs(a));break;case"InbandEventStream":void 0===t.inbandEventStreams&&(t.inbandEventStreams=[]),t.inbandEventStreams.push(Hs(a));break;case"Label":var l=a.textContent;null!=l&&(t.label=l);break;case"Representation":var d=nu(a),c=d[0],f=d[1];t.representations.push(c),f.length>0&&(r=r.concat(f));break;case"Role":null==t.roles?t.roles=[Hs(a)]:t.roles.push(Hs(a));break;case"SupplementalProperty":null==t.supplementalProperties?t.supplementalProperties=[Hs(a)]:t.supplementalProperties.push(Hs(a));break;case"SegmentBase":var v=Xs(a),p=v[0],h=v[1];t.segmentBase=p,h.length>0&&(r=r.concat(h));break;case"SegmentList":var m=Js(a),g=m[0],y=m[1];t.segmentList=g,y.length>0&&(r=r.concat(y));break;case"SegmentTemplate":var _=tu(a),b=_[0],S=_[1];t.segmentTemplate=b,S.length>0&&(r=r.concat(S));break;case"ContentProtection":var E=Qs(a),T=E[0],k=E[1];k.length>0&&(r=r.concat(k)),void 0!==T&&n.push(T)}}return n.length>0&&(t.contentProtections=n),[t,r]}(e.childNodes),n=t[0],r=t[1],i=function(e){for(var t={},n=[],r=qs(t,n),i=0;i<e.attributes.length;i++){var a=e.attributes[i];switch(a.name){case"id":t.id=a.value;break;case"group":r(a.value,{asKey:"group",parser:Bs,dashName:"group"});break;case"lang":t.language=a.value;break;case"contentType":t.contentType=a.value;break;case"par":t.par=a.value;break;case"minBandwidth":r(a.value,{asKey:"minBitrate",parser:Bs,dashName:"minBandwidth"});break;case"maxBandwidth":r(a.value,{asKey:"maxBitrate",parser:Bs,dashName:"maxBandwidth"});break;case"minWidth":r(a.value,{asKey:"minWidth",parser:Bs,dashName:"minWidth"});break;case"maxWidth":r(a.value,{asKey:"maxWidth",parser:Bs,dashName:"maxWidth"});break;case"minHeight":r(a.value,{asKey:"minHeight",parser:Bs,dashName:"minHeight"});break;case"maxHeight":r(a.value,{asKey:"maxHeight",parser:Bs,dashName:"maxHeight"});break;case"minFrameRate":r(a.value,{asKey:"minFrameRate",parser:js,dashName:"minFrameRate"});break;case"maxFrameRate":r(a.value,{asKey:"maxFrameRate",parser:js,dashName:"maxFrameRate"});break;case"selectionPriority":r(a.value,{asKey:"selectionPriority",parser:Bs,dashName:"selectionPriority"});break;case"segmentAlignment":r(a.value,{asKey:"segmentAlignment",parser:zs,dashName:"segmentAlignment"});break;case"subsegmentAlignment":r(a.value,{asKey:"subsegmentAlignment",parser:zs,dashName:"subsegmentAlignment"});break;case"bitstreamSwitching":r(a.value,{asKey:"bitstreamSwitching",parser:Us,dashName:"bitstreamSwitching"});break;case"audioSamplingRate":t.audioSamplingRate=a.value;break;case"codecs":t.codecs=a.value;break;case"codingDependency":r(a.value,{asKey:"codingDependency",parser:Us,dashName:"codingDependency"});break;case"frameRate":r(a.value,{asKey:"frameRate",parser:js,dashName:"frameRate"});break;case"height":r(a.value,{asKey:"height",parser:Bs,dashName:"height"});break;case"maxPlayoutRate":r(a.value,{asKey:"maxPlayoutRate",parser:Fs,dashName:"maxPlayoutRate"});break;case"maximumSAPPeriod":r(a.value,{asKey:"maximumSAPPeriod",parser:Fs,dashName:"maximumSAPPeriod"});break;case"mimeType":t.mimeType=a.value;break;case"profiles":t.profiles=a.value;break;case"segmentProfiles":t.segmentProfiles=a.value;break;case"width":r(a.value,{asKey:"width",parser:Bs,dashName:"width"});break;case"availabilityTimeOffset":r(a.value,{asKey:"availabilityTimeOffset",parser:Fs,dashName:"availabilityTimeOffset"});break;case"availabilityTimeComplete":r(a.value,{asKey:"availabilityTimeComplete",parser:Us,dashName:"availabilityTimeComplete"})}}return[t,n]}(e),a=i[0],o=i[1];return[{children:n,attributes:a},r.concat(o)]}function iu(e){for(var t={children:{events:[]},attributes:{}},n=[],r=qs(t.attributes,n),i=0;i<e.attributes.length;i++){var a=e.attributes[i];switch(a.name){case"schemeIdUri":t.attributes.schemeIdUri=a.value;break;case"timescale":r(a.value,{asKey:"timescale",parser:Bs,dashName:"timescale"});break;case"value":t.attributes.value=a.value}}for(var o=0;o<e.childNodes.length;o++)if(e.childNodes[o].nodeType===Node.ELEMENT_NODE){var s=e.childNodes[o];if("Event"===s.nodeName){var u=au(s),l=u[0],d=u[1];t.children.events.push(l),d.length>0&&(n=n.concat(d))}}return[t,n]}function au(e){for(var t={eventStreamData:e},n=[],r=qs(t,n),i=0;i<e.attributes.length;i++){var a=e.attributes[i];switch(a.name){case"presentationTime":r(a.value,{asKey:"presentationTime",parser:Bs,dashName:"presentationTime"});break;case"duration":r(a.value,{asKey:"duration",parser:Bs,dashName:"duration"});break;case"id":t.id=a.value}}return[t,n]}function ou(e){var t=function(e){for(var t,n=[],r=[],i=[],a=[],o=0;o<e.length;o++)if(e[o].nodeType===Node.ELEMENT_NODE){var s=e[o];switch(s.nodeName){case"BaseURL":var u=Ds(s),l=u[0],d=u[1];void 0!==l&&n.push(l),i=i.concat(d);break;case"AdaptationSet":var c=ru(s),f=c[0],v=c[1];r.push(f),i=i.concat(v);break;case"EventStream":var p=iu(s),h=p[0],m=p[1];a.push(h),i=i.concat(m);break;case"SegmentTemplate":var g=tu(s),y=g[0],_=g[1];t=y,_.length>0&&(i=i.concat(_))}}return[{baseURLs:n,adaptations:r,eventStreams:a,segmentTemplate:t},i]}(e.childNodes),n=t[0],r=t[1],i=function(e){for(var t={},n=[],r=qs(t,n),i=0;i<e.attributes.length;i++){var a=e.attributes[i];switch(a.name){case"id":t.id=a.value;break;case"start":r(a.value,{asKey:"start",parser:Ks,dashName:"start"});break;case"duration":r(a.value,{asKey:"duration",parser:Ks,dashName:"duration"});break;case"bitstreamSwitching":r(a.value,{asKey:"bitstreamSwitching",parser:Us,dashName:"bitstreamSwitching"});break;case"xlink:href":t.xlinkHref=a.value;break;case"xlink:actuate":t.xlinkActuate=a.value}}return[t,n]}(e),a=i[0],o=i[1];return[{children:n,attributes:a},r.concat(o)]}function su(e){var t=function(e){for(var t=[],n=[],r=[],i=[],a=[],o=0;o<e.length;o++)if(e[o].nodeType===Node.ELEMENT_NODE){var s=e[o];switch(s.nodeName){case"BaseURL":var u=Ds(s),l=u[0],d=u[1];void 0!==l&&t.push(l),a=a.concat(d);break;case"Location":n.push(null===s.textContent?"":s.textContent);break;case"Period":var c=ou(s),f=c[0],v=c[1];r.push(f),a=a.concat(v);break;case"UTCTiming":var p=Hs(s);i.push(p)}}return[{baseURLs:t,locations:n,periods:r,utcTimings:i},a]}(e.childNodes),n=t[0],r=t[1],i=function(e){for(var t={},n=[],r=qs(t,n),i=0;i<e.attributes.length;i++){var a=e.attributes[i];switch(a.name){case"id":t.id=a.value;break;case"profiles":t.profiles=a.value;break;case"type":t.type=a.value;break;case"availabilityStartTime":r(a.value,{asKey:"availabilityStartTime",parser:Vs,dashName:"availabilityStartTime"});break;case"availabilityEndTime":r(a.value,{asKey:"availabilityEndTime",parser:Vs,dashName:"availabilityEndTime"});break;case"publishTime":r(a.value,{asKey:"publishTime",parser:Vs,dashName:"publishTime"});break;case"mediaPresentationDuration":r(a.value,{asKey:"duration",parser:Ks,dashName:"mediaPresentationDuration"});break;case"minimumUpdatePeriod":r(a.value,{asKey:"minimumUpdatePeriod",parser:Ks,dashName:"minimumUpdatePeriod"});break;case"minBufferTime":r(a.value,{asKey:"minBufferTime",parser:Ks,dashName:"minBufferTime"});break;case"timeShiftBufferDepth":r(a.value,{asKey:"timeShiftBufferDepth",parser:Ks,dashName:"timeShiftBufferDepth"});break;case"suggestedPresentationDelay":r(a.value,{asKey:"suggestedPresentationDelay",parser:Ks,dashName:"suggestedPresentationDelay"});break;case"maxSegmentDuration":r(a.value,{asKey:"maxSegmentDuration",parser:Ks,dashName:"maxSegmentDuration"});break;case"maxSubsegmentDuration":r(a.value,{asKey:"maxSubsegmentDuration",parser:Ks,dashName:"maxSubsegmentDuration"})}}return[t,n]}(e),a=i[0],o=i[1];return[{children:n,attributes:a},r.concat(o)]}var uu=function(e,t){var n=e.documentElement;if(h(n)||"MPD"!==n.nodeName)throw new Error("DASH Parser: document root should be MPD");var r=su(n),i=r[0],a=r[1];return function e(t){if("done"===t.type)return t;if("needs-clock"===t.type)return{type:"needs-resources",value:{urls:[t.value.url],format:"string",continue:function(n){if(1!==n.length)throw new Error("DASH parser: wrong number of loaded ressources.");var r=t.value.continue(n[0].responseData);return e(r)}}};if("needs-xlinks"===t.type)return{type:"needs-resources",value:{urls:t.value.xlinksUrls,format:"string",continue:function(n){for(var r=[],i=0;i<n.length;i++){var a=n[i],o=a.responseData,s=a.receivedTime,u=a.sendingTime,l=a.url;if(!o.success)throw o.error;var d="<root>"+o.data+"</root>",c=(new DOMParser).parseFromString(d,"text/xml");if(null==c||0===c.children.length)throw new Error("DASH parser: Invalid external ressources");for(var f=c.children[0].children,v=[],p=[],h=0;h<f.length;h++)if(f[h].nodeType===Node.ELEMENT_NODE){var m=ou(f[h]),g=m[0],y=m[1];p.push.apply(p,y),v.push(g)}r.push({url:l,receivedTime:s,sendingTime:u,parsed:v,warnings:p})}var _=t.value.continue(r);return e(_)}}};ke()}(Ps(i,t,a))};function lu(e){var t=e.referenceDateTime,n=void 0!==e.serverSyncInfos?e.serverSyncInfos.serverTimestamp-e.serverSyncInfos.clientTime:void 0;return function(r,i,a,o,s){var u,d=r.responseData,c=i.externalClockOffset,f=null!==(u=r.url)&&void 0!==u?u:i.originalUrl,p=null!=n?n:c,h={unsafelyBaseOnPreviousManifest:i.unsafeMode?i.previousManifest:null,url:f,referenceDateTime:t,externalClockOffset:p},m=_e.dashParsers;if(null===m.wasm||"uninitialized"===m.wasm.status||"failure"===m.wasm.status)return ne.debug("DASH: WASM MPD Parser not initialized. Running JS one."),y();var g=function(e){if(e instanceof ArrayBuffer)return e;if("string"==typeof e)return Ta(e).buffer;if(e instanceof Document)return Ta(e.documentElement.innerHTML).buffer;throw new Error("DASH Manifest Parser: Unrecognized Manifest format")}(d);return function(e){var t=new DataView(e);if(61371===t.getUint16(0)&&191===t.getUint8(2))return!0;if(65279===t.getUint16(0)||65534===t.getUint16(0))return!1;return!0}(g)?"initialized"===m.wasm.status?(ne.debug("DASH: Running WASM MPD Parser."),_(m.wasm.runWasmParser(g,h))):(ne.debug("DASH: Awaiting WASM initialization before parsing the MPD."),m.wasm.waitForInitialization().catch((function(){})).then((function(){return null===m.wasm||"initialized"!==m.wasm.status?(ne.warn("DASH: WASM MPD parser initialization failed. Running JS parser instead"),y()):(ne.debug("DASH: Running WASM MPD Parser."),_(m.wasm.runWasmParser(g,h)))}))):(ne.info("DASH: MPD doesn't seem to be UTF-8-encoded. Running JS parser instead of the WASM one."),y());function y(){if(null===m.js)throw new Error("No MPD parser is imported");var e=function(e){if(e instanceof ArrayBuffer)return(new DOMParser).parseFromString(wa(new Uint8Array(e)),"text/xml");if("string"==typeof e)return(new DOMParser).parseFromString(e,"text/xml");if(e instanceof Document)return e;throw new Error("DASH Manifest Parser: Unrecognized Manifest format")}(d);return _(m.js(e,h))}function _(t){if("done"===t.type){if(t.value.warnings.length>0&&a(t.value.warnings),o.isCancelled())return Promise.reject(o.cancellationError);var n=[];return{manifest:new Tn(t.value.parsed,e,n),url:f,warnings:n}}var r=t.value,i=r.urls.map((function(e){return s((function(){var t=v.getCurrent().DEFAULT_REQUEST_TIMEOUT;return"string"===r.format?uo({url:e,responseType:"text",timeout:t,cancelSignal:o}):uo({url:e,responseType:"arraybuffer",timeout:t,cancelSignal:o})})).then((function(e){if("string"===r.format){if("string"!=typeof e.responseData)throw new Error("External DASH resources should have been a string");return l(e,{responseData:{success:!0,data:e.responseData}})}if(!(e.responseData instanceof ArrayBuffer))throw new Error("External DASH resources should have been ArrayBuffers");return l(e,{responseData:{success:!0,data:e.responseData}})}),(function(e){var t=ge(e,{defaultCode:"PIPELINE_PARSE_ERROR",defaultReason:"An unknown error occured when parsing ressources."});return l({},{size:void 0,requestDuration:void 0,responseData:{success:!1,error:t}})}))}));return Promise.all(i).then((function(e){return r.format,_(r.continue(e))}))}}}var du="function"==typeof Headers?Headers:null,cu="function"==typeof AbortController?AbortController:null;function fu(){return"function"==typeof w.fetch&&!h(cu)&&!h(du)}function vu(e,t){return"audio"===e||"video"===e?"video/mp4"===t||"audio/mp4"===t?"mp4":"video/webm"===t||"audio/webm"===t?"webm":void 0:"text"===e&&"application/mp4"===t?"mp4":void 0}function pu(e){return function(t,n,r,i,a){return new Promise((function(s,u){var l=new Ge,d=l.linkToSignal(i);function c(){l.signal.deregister(u),d()}l.signal.register(u),e(t,n,r,l.signal,Object.assign(Object.assign({},a),{onNewChunk:function(e){try{o(e),a.onNewChunk(e)}catch(e){c(),l.cancel(),u(e)}}})).then((function(e){if(c(),!l.isUsed()){if("segment-loaded"===e.resultType)try{o(e.resultData.responseData)}catch(e){return void u(e)}s(e)}}),(function(e){c(),u(e)}))}));function o(e){(e instanceof ArrayBuffer||e instanceof Uint8Array)&&"mp4"===vu(n.type,n.mimeType)&&co(new Uint8Array(e),n.segment.isInit)}}}function hu(e,t){return null===e?null:null===t.url?e.baseUrl:ya(e.baseUrl,t.url)}function mu(e,t,n,r,i){if(void 0===t.range)return uo({url:e,responseType:"arraybuffer",timeout:n.timeout,cancelSignal:r,onProgress:i.onProgress}).then((function(e){return{resultType:"segment-loaded",resultData:e}}));if(void 0===t.indexRange)return uo({url:e,headers:{Range:Ro(t.range)},responseType:"arraybuffer",timeout:n.timeout,cancelSignal:r,onProgress:i.onProgress}).then((function(e){return{resultType:"segment-loaded",resultData:e}}));if(t.range[1]+1===t.indexRange[0])return uo({url:e,headers:{Range:Ro([t.range[0],t.indexRange[1]])},responseType:"arraybuffer",timeout:n.timeout,cancelSignal:r,onProgress:i.onProgress}).then((function(e){return{resultType:"segment-loaded",resultData:e}}));var a=uo({url:e,headers:{Range:Ro(t.range)},responseType:"arraybuffer",timeout:n.timeout,cancelSignal:r,onProgress:i.onProgress}),o=uo({url:e,headers:{Range:Ro(t.indexRange)},responseType:"arraybuffer",timeout:n.timeout,cancelSignal:r,onProgress:i.onProgress});return Promise.all([a,o]).then((function(t){var n=t[0],r=t[1],i=$i(new Uint8Array(n.responseData),new Uint8Array(r.responseData)),a=Math.min(n.sendingTime,r.sendingTime),o=Math.max(n.receivedTime,r.receivedTime);return{resultType:"segment-loaded",resultData:{url:e,responseData:i,size:n.size+r.size,requestDuration:o-a,sendingTime:a,receivedTime:o}}}))}function gu(e,t,n,r,i){var a=t.segment,o=void 0!==a.range?{Range:Ro(a.range)}:void 0,s=null;return function(e){var t;if(!h(e.headers))if(h(du))t=e.headers;else{t=new du;for(var n=Object.keys(e.headers),r=0;r<n.length;r++){var i=n[r];t.append(i,e.headers[i])}}ne.debug("Fetch: Called with URL",e.url);var a,o=null,s=!1,u=at(),l=h(cu)?null:new cu;function d(){h(l)?ne.warn("Fetch: AbortController API not available."):l.abort()}void 0!==e.timeout&&(a=setTimeout((function(){s=!0,d()}),e.timeout));var c=e.cancelSignal.register((function(e){o=e,d()})),f={method:"GET"};return void 0!==t&&(f.headers=t),f.signal=h(l)?null:l.signal,fetch(e.url,f).then((function(t){if(h(a)||clearTimeout(a),t.status>=300)throw ne.warn("Fetch: Request HTTP Error",t.status,t.url),new kn(t.url,t.status,le.ERROR_HTTP_CODE);if(h(t.body))throw new kn(t.url,t.status,le.PARSE_ERROR);var n=t.headers.get("Content-Length"),r=h(n)||isNaN(+n)?void 0:+n,i=t.body.getReader(),o=0;return s();function s(){return l.apply(this,arguments)}function l(){return(l=qe(Qe().mark((function n(){var a,l,d,f,v;return Qe().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,i.read();case 2:if((a=n.sent).done||h(a.value)){n.next=11;break}return o+=a.value.byteLength,l=at(),d={url:t.url,currentTime:l,duration:l-u,sendingTime:u,chunkSize:a.value.byteLength,chunk:a.value.buffer,size:o,totalSize:r},e.onData(d),n.abrupt("return",s());case 11:if(!a.done){n.next=16;break}return c(),f=at(),v=f-u,n.abrupt("return",{requestDuration:v,receivedTime:f,sendingTime:u,size:o,status:t.status,url:t.url});case 16:return n.abrupt("return",s());case 17:case"end":return n.stop()}}),n)})))).apply(this,arguments)}})).catch((function(t){if(null!==o)throw o;if(c(),s)throw ne.warn("Fetch: Request timeouted."),new kn(e.url,0,le.TIMEOUT);if(t instanceof kn)throw t;throw ne.warn("Fetch: Request Error",t instanceof Error?t.toString():""),new kn(e.url,0,le.ERROR_EVENT)}))}({url:e,headers:o,onData:function(e){var t=new Uint8Array(e.chunk),n=function(e){for(var t=0,n=[];t<e.length;){var r=e.subarray(t,1/0),i=lo(r,1836019558);if(i<0)return[n,r];var a=t+i+Ji(e,i+t);if(a>e.length)return[n,r];var o=lo(r,1835295092);if(o<0)return[n,r];var s=t+o+Ji(e,o+t);if(s>e.length)return[n,r];var u=Math.max(a,s),l=e.subarray(t,u);n.push(l),t=u}return[n,null]}(null!==s?$i(s,t):t),a=n[0];s=n[1];for(var o=0;o<a.length;o++)if(r.onNewChunk(a[o]),i.isCancelled())return;r.onProgress({duration:e.duration,size:e.size,totalSize:e.totalSize}),i.isCancelled()},timeout:n.timeout,cancelSignal:i}).then((function(e){return{resultType:"chunk-complete",resultData:e}}))}function yu(e,t,n,r,i,a){if(t.segment.isInit)return mu(e,t.segment,r,a,i);var o=vu(t.type,t.mimeType);if(n&&("mp4"===o||void 0===o)){if(fu())return gu(e,t,r,i,a);Xt("DASH: Your browser does not have the fetch API. You will have a higher chance of rebuffering when playing close to the live edge")}var s=t.segment;return uo({url:e,responseType:"arraybuffer",headers:void 0!==s.range?{Range:Ro(s.range)}:void 0,timeout:r.timeout,cancelSignal:a,onProgress:i.onProgress}).then((function(e){return{resultType:"segment-loaded",resultData:e}}))}var _u="function"==typeof Uint8Array.prototype.slice?function(e,t,n){return e.slice(t,n)}:function(e,t,n){return new Uint8Array(Array.prototype.slice.call(e,t,n))};function bu(e,t){if(e[t]>1)ne.warn("ISOBMFF: un-handled PSSH version");else{var n=t+4;if(!(n+16>e.length))return Ia(_u(e,n,n+16))}}var Su=408125543,Eu=357149030,Tu=2807729,ku=17545,wu=475249515,Au=187,Iu=179,Ru=183,xu=241;function Mu(e,t,n,r){for(var i=r[0],a=r[1],o=i;o<a;){var s=Nu(n,o);if(null==s)return null;var u=s.value,l=o+s.length,d=Ou(n,l);if(null==d)return null;var c=l+d.length,f=c+d.value;if(u===e)return[c,f];if(t.length>0)for(var v=0;v<t.length;v++){if(u===t[v])return Mu(e,t.slice(v+1,t.length),n,[c,f])}o=f}return null}function Cu(e,t){var n=Mu(Tu,[Su,Eu],e,[t,e.length]);if(null==n)return null;var r=n[1]-n[0];return 1e9/Lu(e,n[0],r)}function Pu(e,t){var n=Mu(ku,[Su,Eu],e,[t,e.length]);if(null==n)return null;var r=n[1]-n[0];return 4===r?function(e,t){return new DataView(e.buffer).getFloat32(t)}(e,n[0]):8===r?function(e,t){return new DataView(e.buffer).getFloat64(t)}(e,n[0]):null}function Du(e,t){for(var n=1;n<=8;n++)if(e[t]>=Math.pow(2,8-n))return n}function Nu(e,t){var n=Du(e,t);if(null==n)return ne.warn("webm: unrepresentable length"),null;if(t+n>e.length)return ne.warn("webm: impossible length"),null;for(var r=0,i=0;i<n;i++)r=e[t+i]*Math.pow(2,8*(n-i-1))+r;return{length:n,value:r}}function Ou(e,t){var n=Du(e,t);if(null==n)return ne.warn("webm: unrepresentable length"),null;if(t+n>e.length)return ne.warn("webm: impossible length"),null;for(var r=(e[t]&(1<<8-n)-1)*Math.pow(2,8*(n-1)),i=1;i<n;i++)r=e[t+i]*Math.pow(2,8*(n-i-1))+r;return{length:n,value:r}}function Lu(e,t,n){for(var r=0,i=0;i<n;i++)r=e[t+i]*Math.pow(2,8*(n-i-1))+r;return r}function Uu(e,t,n,r){var i=function(e){var t=fa(e);if(null!==t){var n=ua(t,1952867444);if(null!==n){var r=n[0];return 1===r?ea(n,4):0===r?Ji(n,4):void 0}}}(e);if(void 0===i||void 0===r)return null;var a,o=void 0!==n.timestampOffset?i+n.timestampOffset*r:i,s=go(e);if(o<0&&(void 0!==s&&(s+=o),o=0),t||!n.complete)return void 0===s&&ne.warn("DASH: Chunked segments should indicate a duration through their trun boxes"),{time:o/r,duration:void 0!==s?s/r:void 0};var u=n.duration*r,l=Math.min(.9*r,u/4);return void 0!==s&&Math.abs(s-u)<=l&&(a=s),{time:o/r,duration:void 0!==a?a/r:a}}function Bu(e,t){if(0!==e.length){var n=e.reduce((function(e,t){return"urn:mpeg:dash:event:2012"===t.schemeIdUri&&"1"===t.value?(void 0===e.manifestRefreshEventsFromEMSGs&&(e.manifestRefreshEventsFromEMSGs=[]),e.manifestRefreshEventsFromEMSGs.push(t)):(void 0===e.EMSGs&&(e.EMSGs=[]),e.EMSGs.push(t)),e}),{manifestRefreshEventsFromEMSGs:void 0,EMSGs:void 0}),r=n.manifestRefreshEventsFromEMSGs,i=n.EMSGs,a=null==i?void 0:i.map((function(e){return{type:"emsg",value:e}})),o=void 0!==t&&void 0!==r&&function(e,t){if(e.length<=0)return!1;for(var n=e.length,r=0;r<n;r++){var i=t,a=wa(e[r].messageData),o=Date.parse(a);if(void 0===i||void 0===o||isNaN(o)||o>=i)return!0}return!1}(r,t);return{inbandEvents:a,needsManifestRefresh:o}}}function Fu(e){var t=e.__priv_patchLastSegmentInSidx;return function(e,n,r){var i,a=n.segment,o=n.periodStart,s=n.periodEnd,u=e.data,l=e.isChunked,d=[o,s];if(null===u)return a.isInit?{segmentType:"init",initializationData:null,initializationDataSize:0,protectionData:[],initTimescale:void 0}:{segmentType:"media",chunkData:null,chunkSize:0,chunkInfos:null,chunkOffset:0,protectionData:[],appendWindow:d};var c=u instanceof Uint8Array?u:new Uint8Array(u),f=vu(n.type,n.mimeType),v="mp4"===f||void 0===f,p=[];if(v){var m,g=function(e){var t=0,n=ua(e,1836019574);if(null===n)return[];for(var r=[];t<n.length;){var i=void 0;try{i=la(n,1886614376)}catch(e){var a=e instanceof Error?e:"";return ne.warn("Error while removing PSSH from ISOBMFF",a),r}if(null==i)return r;var o=_u(n,i[0],i[2]),s=bu(o,i[1]-i[0]);void 0!==s&&r.push({systemId:s,data:o}),n[i[0]+4]=102,n[i[0]+5]=114,n[i[0]+6]=101,n[i[0]+7]=101,t=i[2]}return r}(c);a.isInit&&(m=null!==(i=function(e){var t=sa(e,[1836019574,1953653099,1835297121,1835626086,1937007212,1937011556]);if(null===t)return null;var n=t.subarray(8),r=ua(n,1701733238),i=0;if(null===r?(i=28,r=ua(n,1701733217)):i=78,null===r)return null;var a=sa(r.subarray(i),[1936289382,1935894633,1952804451]);return null===a||a.byteLength<24?null:a.subarray(8,24)}(c))&&void 0!==i?i:void 0),(g.length>0||void 0!==m)&&p.push({initDataType:"cenc",keyId:m,initData:g})}if(!a.isInit){var y=v?Uu(c,l,a,r):null,_=Vt(a.timestampOffset,0);if(v){var b=function(e){for(var t=[],n=0;n<e.length;){var r=ha(e,n);if(null===r)break;var i=r.length;n+=i;var a=r[0];if(0!==a)ne.warn("ISOBMFF: EMSG version "+a.toString()+" not supported.");else{var o=4,s=xa(r,o),u=s.end,l=s.string,d=xa(r,o=u),c=d.end,f=d.string,v=Ji(r,o=c),p=Ji(r,o+=4),h=Ji(r,o+=4),m=Ji(r,o+=4);o+=4;var g={schemeIdUri:l,value:f,timescale:v,presentationTimeDelta:p,eventDuration:h,id:m,messageData:r.subarray(o,i)};t.push(g)}}if(0!==t.length)return t}(c);if(void 0!==b){var S=Bu(b.filter((function(e){return void 0!==a.privateInfos&&void 0!==a.privateInfos.isEMSGWhitelisted&&a.privateInfos.isEMSGWhitelisted(e)})),n.manifestPublishTime);if(void 0!==S){var E=S.needsManifestRefresh,T=S.inbandEvents;return{segmentType:"media",chunkData:c,chunkSize:c.length,chunkInfos:y,chunkOffset:_,appendWindow:d,inbandEvents:T,protectionData:p,needsManifestRefresh:E}}}}return{segmentType:"media",chunkData:c,chunkSize:c.length,chunkInfos:y,chunkOffset:_,protectionData:p,appendWindow:d}}var k,w=a.indexRange;if("webm"===f)k=function(e,t){var n=Mu(Su,[],e,[t,e.length]);if(null==n)return null;var r=n[0],i=n[1],a=Cu(e,r);if(null==a)return null;var o=Pu(e,r);if(null==o)return null;var s=Mu(wu,[],e,[r,i]);if(null==s)return null;for(var u=[],l=s[0];l<s[1];){var d=Mu(Au,[],e,[l,s[1]]);if(null==d)break;var c=Mu(Iu,[],e,[d[0],d[1]]);if(null==c)return null;var f=Lu(e,c[0],c[1]-c[0]),v=Mu(xu,[Ru],e,[d[0],d[1]]);if(null==v)return null;var p=Lu(e,v[0],v[1]-v[0])+r;u.push({time:f,rangeStart:p}),l=d[1]}for(var h=[],m=0;m<u.length;m++){var g=u[m];m===u.length-1?h.push({time:g.time,timescale:a,duration:0===m?o:o-g.time,range:[g.rangeStart,1/0]}):h.push({time:g.time,timescale:a,duration:u[m+1].time-g.time,range:[g.rangeStart,u[m+1].rangeStart-1]})}return h}(c,0);else if(v&&(k=ho(c,Array.isArray(w)?w[0]:0),!0===t&&null!==k&&k.length>0)){var A=k[k.length-1];Array.isArray(A.range)&&(A.range[1]=1/0)}var I=v?yo(c):"webm"===f?Cu(c,0):void 0,R=h(I)?void 0:I;return{segmentType:"init",initializationData:c,initializationDataSize:c.length,protectionData:p,initTimescale:R,segmentList:null!=k?k:void 0}}}function zu(e,t,n,r){var i,a,o=e.segment,s=e.language,u=e.codecs;if(o.isInit)return null;null===n?r?(i=o.time,a=o.end):ne.warn("Transport: Unavailable time data for current text track."):(i=n.time,void 0!==n.duration?a=i+n.duration:!r&&o.complete&&(a=i+o.duration));var l=function(e){if(void 0===e)throw new Error("Cannot parse subtitles: unknown format");switch(e.toLowerCase()){case"stpp":case"stpp.ttml.im1t":return"ttml";case"wvtt":return"vtt"}throw new Error('The codec used for the subtitles "'+e+'" is not managed yet.')}(u),d=function(e){var t=pa(e);return null===t?"":wa(t)}(t);return{data:d,type:l,language:s,start:i,end:a}}function Vu(e,t,n){var r,i,a=e.segment;return a.isInit?null:(n?ne.warn("Transport: Unavailable time data for current text track."):(r=a.time,a.complete&&(i=a.time+a.duration)),{data:t,type:function(e,t){switch(t){case"application/ttml+xml":return"ttml";case"application/x-sami":case"application/smil":return"sami";case"text/vtt":return"vtt"}if(void 0!==e&&"srt"===e.toLowerCase())return"srt";throw new Error("could not find a text-track parser for the type "+(null!=t?t:""))}(e.codecs,e.mimeType),language:e.language,start:r,end:i})}function Ku(e){var t=e.__priv_patchLastSegmentInSidx;return function(e,n,r){var i,a=n.periodStart,o=n.periodEnd,s=n.segment,u=e.data,l=e.isChunked;if(null===u)return s.isInit?{segmentType:"init",initializationData:null,initializationDataSize:0,protectionData:[],initTimescale:void 0}:{segmentType:"media",chunkData:null,chunkSize:0,chunkInfos:null,chunkOffset:null!==(i=s.timestampOffset)&&void 0!==i?i:0,protectionData:[],appendWindow:[a,o]};var d=vu(n.type,n.mimeType);if("webm"===d)throw new Error("Text tracks with a WEBM container are not yet handled.");return"mp4"===d?function(e,t,n,r,i){var a=n.segment,o=a.isInit,s=a.indexRange,u="string"==typeof e?Ta(e):e instanceof Uint8Array?e:new Uint8Array(e);if(o){var l=ho(u,Array.isArray(s)?s[0]:0);if(!0===i&&null!==l&&l.length>0){var d=l[l.length-1];Array.isArray(d.range)&&(d.range[1]=1/0)}return{segmentType:"init",initializationData:null,initializationDataSize:0,protectionData:[],initTimescale:yo(u),segmentList:null!=l?l:void 0}}var c=Uu(u,t,a,r),f=zu(n,u,c,t),v=Vt(a.timestampOffset,0);return{segmentType:"media",chunkData:f,chunkSize:u.length,chunkInfos:c,chunkOffset:v,protectionData:[],appendWindow:[n.periodStart,n.periodEnd]}}(u,l,n,r,t):function(e,t,n){var r,i,a=n.periodStart,o=n.periodEnd,s=n.segment,u=s.timestampOffset,l=void 0===u?0:u;if(s.isInit)return{segmentType:"init",initializationData:null,initializationDataSize:0,protectionData:[],initTimescale:void 0};if("string"!=typeof e){var d=e instanceof Uint8Array?e:new Uint8Array(e);r=wa(d),i=d.length}else r=e;return{segmentType:"media",chunkData:Vu(n,r,t),chunkSize:i,chunkInfos:null,chunkOffset:l,protectionData:[],appendWindow:[a,o]}}(u,l,n)}}var Gu=function(e){var t=fo({customManifestLoader:e.manifestLoader},null===_e.dashParsers.wasm||"initialized"!==_e.dashParsers.wasm.status&&"initializing"!==_e.dashParsers.wasm.status?"arraybuffer":"text"),n=lu(e),r=function(e){var t=e.lowLatencyMode,n=e.segmentLoader;return!0!==e.checkMediaSegmentIntegrity?r:pu(r);function r(e,r,i,a,o){var s=hu(e,r.segment);return null==s?Promise.resolve({resultType:"segment-created",resultData:null}):t||void 0===n?yu(s,r,t,i,o,a):new Promise((function(e,u){var l,d=!1,c={reject:function(e){var t,n;if(!d&&!a.isCancelled()){d=!0,a.deregister(p);var r=e,i=null!==(t=null==r?void 0:r.message)&&void 0!==t?t:"Unknown error when fetching a DASH segment through a custom segmentLoader.",o=new An(i,null!==(n=null==r?void 0:r.canRetry)&&void 0!==n&&n,null==r?void 0:r.xhr);u(o)}},resolve:function(t){d||a.isCancelled()||(d=!0,a.deregister(p),e({resultType:"segment-loaded",resultData:{responseData:t.data,size:t.size,requestDuration:t.duration}}))},progress:function(e){d||a.isCancelled()||o.onProgress({duration:e.duration,size:e.size,totalSize:e.totalSize})},fallback:function(){d||a.isCancelled()||(d=!0,a.deregister(p),yu(s,r,t,i,o,a).then(e,u))}};void 0!==r.segment.range&&(l=[r.segment.range],void 0!==r.segment.indexRange&&l.push(r.segment.indexRange));var f={isInit:r.segment.isInit,timeout:i.timeout,byteRanges:l,trackType:r.type,url:s},v=n(f,c);function p(e){d||(d=!0,"function"==typeof v&&v(),u(e))}a.register(p)}))}}(e),i=Fu(e),a=function(e){var t=e.lowLatencyMode;return!0!==e.checkMediaSegmentIntegrity?n:pu(n);function n(e,n,r,i,a){var o=n.segment,s=o.range,u=hu(e,o);if(null===u)return Promise.resolve({resultType:"segment-created",resultData:null});if(o.isInit)return mu(u,o,r,i,a);var l=vu(n.type,n.mimeType),d="mp4"===l||void 0===l;if(t&&d){if(fu())return gu(u,n,r,a,i);Xt("DASH: Your browser does not have the fetch API. You will have a higher chance of rebuffering when playing close to the live edge")}return d?uo({url:u,responseType:"arraybuffer",headers:Array.isArray(s)?{Range:Ro(s)}:null,timeout:r.timeout,onProgress:a.onProgress,cancelSignal:i}).then((function(e){return{resultType:"segment-loaded",resultData:e}})):uo({url:u,responseType:"text",headers:Array.isArray(s)?{Range:Ro(s)}:null,timeout:r.timeout,onProgress:a.onProgress,cancelSignal:i}).then((function(e){return{resultType:"segment-loaded",resultData:e}}))}}(e);return{manifest:{loadManifest:t,parseManifest:n},audio:{loadSegment:r,parseSegment:i},video:{loadSegment:r,parseSegment:i},text:{loadSegment:a,parseSegment:Ku(e)}}};function Wu(e){void 0===e.transports.dash&&(e.transports.dash=Gu),e.dashParsers.js=uu,e.mediaSourceInit=Qi}function ju(e,t){var n;if(t.length!==e.length)return!0;for(var r=0;r<t.length;r++)if(t[r].nativeTrack!==(null===(n=e[r])||void 0===n?void 0:n.nativeTrack))return!0;return!1}function Hu(e){for(var t,n=[],r={},i=0;i<e.length;i++){var a=e[i],o=""===a.language?"nolang":a.language,s=null!==(t=r[o])&&void 0!==t?t:1,u="gen_audio_"+o+"_"+s.toString();r[o]=s+1;var l={language:a.language,id:u,normalized:tn(a.language),audioDescription:"descriptions"===a.kind||"description"===a.kind,representations:[]};n.push({track:l,nativeTrack:a})}return n}function qu(e){for(var t,n=[],r={},i=0;i<e.length;i++){var a=e[i],o=""===a.language?"nolang":a.language,s=null!==(t=r[o])&&void 0!==t?t:1,u="gen_text_"+o+"_"+s.toString();r[o]=s+1;var l="forced"===a.kind||void 0,d={language:a.language,forced:l,label:a.label,id:u,normalized:tn(a.language),closedCaption:"captions"===a.kind};n.push({track:d,nativeTrack:a})}return n}function Yu(e){for(var t,n=[],r={},i=0;i<e.length;i++){var a=e[i],o=""===a.language?"nolang":a.language,s=null!==(t=r[o])&&void 0!==t?t:1,u="gen_video_"+o+"_"+s.toString();r[o]=s+1,n.push({track:{id:u,representations:[]},nativeTrack:a})}return n}var Qu=function(e){function t(t){var n,r,i,a;return(n=e.call(this)||this)._nativeAudioTracks=t.audioTracks,n._nativeVideoTracks=t.videoTracks,n._nativeTextTracks=t.textTracks,n._audioTracks=void 0!==n._nativeAudioTracks?Hu(n._nativeAudioTracks):[],n._videoTracks=void 0!==n._nativeVideoTracks?Yu(n._nativeVideoTracks):[],n._textTracks=void 0!==n._nativeTextTracks?qu(n._nativeTextTracks):[],n._lastEmittedNativeAudioTrack=null===(r=n._getCurrentAudioTrack())||void 0===r?void 0:r.nativeTrack,n._lastEmittedNativeVideoTrack=null===(i=n._getCurrentVideoTrack())||void 0===i?void 0:i.nativeTrack,n._lastEmittedNativeTextTrack=null===(a=n._getCurrentTextTrack())||void 0===a?void 0:a.nativeTrack,n._handleNativeTracksCallbacks(),n}s(t,e);var n=t.prototype;return n.setAudioTrackById=function(e){for(var t=0;t<this._audioTracks.length;t++){var n=this._audioTracks[t],r=n.track,i=n.nativeTrack;if(r.id===e)return this._enableAudioTrackFromIndex(t),void(this._audioTrackLockedOn=i)}throw new Error("Audio track not found.")},n.disableTextTrack=function(){$u(this._textTracks),this._textTrackLockedOn=null},n.setTextTrackById=function(e){for(var t=!1,n=0;n<this._textTracks.length;n++){var r=this._textTracks[n],i=r.track,a=r.nativeTrack;i.id===e?(a.mode="showing",t=!0,this._textTrackLockedOn=a):"showing"!==a.mode&&"hidden"!==a.mode||(a.mode="disabled")}if(!t)throw new Error("Text track not found.")},n.disableVideoTrack=function(){Zu(this._videoTracks),this._videoTrackLockedOn=null},n.setVideoTrackById=function(e){for(var t=0;t<this._videoTracks.length;t++){var n=this._videoTracks[t],r=n.track,i=n.nativeTrack;if(r.id===e)return i.selected=!0,void(this._videoTrackLockedOn=i)}throw new Error("Video track not found.")},n.getChosenAudioTrack=function(){var e=this._getCurrentAudioTrack();return h(e)?e:e.track},n.getChosenTextTrack=function(){var e=this._getCurrentTextTrack();return h(e)?e:e.track},n.getChosenVideoTrack=function(){var e=this._getCurrentVideoTrack();return h(e)?e:e.track},n.getAvailableAudioTracks=function(){return this._audioTracks.map((function(e){var t=e.track,n=e.nativeTrack;return{id:t.id,language:t.language,normalized:t.normalized,audioDescription:t.audioDescription,active:n.enabled,representations:t.representations}}))},n.getAvailableTextTracks=function(){return this._textTracks.map((function(e){var t=e.track,n=e.nativeTrack;return{id:t.id,label:t.label,forced:t.forced,language:t.language,normalized:t.normalized,closedCaption:t.closedCaption,active:"showing"===n.mode}}))},n.getAvailableVideoTracks=function(){return this._videoTracks.map((function(e){var t=e.track,n=e.nativeTrack;return{id:t.id,representations:t.representations,active:n.selected}}))},n.dispose=function(){void 0!==this._nativeVideoTracks&&(this._nativeVideoTracks.onchange=null,this._nativeVideoTracks.onaddtrack=null,this._nativeVideoTracks.onremovetrack=null),void 0!==this._nativeAudioTracks&&(this._nativeAudioTracks.onchange=null,this._nativeAudioTracks.onaddtrack=null,this._nativeAudioTracks.onremovetrack=null),void 0!==this._nativeTextTracks&&(this._nativeTextTracks.onchange=null,this._nativeTextTracks.onaddtrack=null,this._nativeTextTracks.onremovetrack=null),this.removeEventListener()},n._getCurrentAudioTrack=function(){if(void 0!==this._nativeAudioTracks){for(var e=0;e<this._audioTracks.length;e++){var t=this._audioTracks[e];if(t.nativeTrack.enabled)return t}return null}},n._getCurrentVideoTrack=function(){if(void 0!==this._nativeVideoTracks){for(var e=0;e<this._videoTracks.length;e++){var t=this._videoTracks[e];if(t.nativeTrack.selected)return t}return null}},n._getCurrentTextTrack=function(){if(void 0!==this._nativeTextTracks){for(var e=0;e<this._textTracks.length;e++){var t=this._textTracks[e];if("showing"===t.nativeTrack.mode)return t}return null}},n._setPreviouslyLockedAudioTrack=function(){if(void 0!==this._audioTrackLockedOn)if(null===this._audioTrackLockedOn)for(var e=0;e<this._audioTracks.length;e++){this._audioTracks[e].nativeTrack.enabled=!1}else for(var t=0;t<this._audioTracks.length;t++){if(this._audioTracks[t].nativeTrack===this._audioTrackLockedOn)return void this._enableAudioTrackFromIndex(t)}},n._setPreviouslyLockedTextTrack=function(){if(void 0!==this._textTrackLockedOn)if(null!==this._textTrackLockedOn)for(var e=0;e<this._textTracks.length;e++){var t=this._textTracks[e].nativeTrack;if(t===this._textTrackLockedOn)return Xu(this._textTracks,t),void("showing"!==t.mode&&(t.mode="showing"))}else $u(this._textTracks)},n._setPreviouslyLockedVideoTrack=function(){if(void 0!==this._videoTrackLockedOn)if(null!==this._videoTrackLockedOn)for(var e=0;e<this._videoTracks.length;e++){var t=this._videoTracks[e].nativeTrack;if(t===this._videoTrackLockedOn)return void(t.selected=!0)}else Zu(this._videoTracks)},n._handleNativeTracksCallbacks=function(){var e=this;void 0!==this._nativeAudioTracks&&(this._nativeAudioTracks.onaddtrack=function(){var t,n;if(void 0!==e._nativeAudioTracks){var r=Hu(e._nativeAudioTracks);if(ju(e._audioTracks,r)){e._audioTracks=r,e._setPreviouslyLockedAudioTrack(),e.trigger("availableAudioTracksChange",e.getAvailableAudioTracks());var i=e._getCurrentAudioTrack();(null==i?void 0:i.nativeTrack)!==e._lastEmittedNativeAudioTrack&&(e.trigger("audioTrackChange",null!==(t=null==i?void 0:i.track)&&void 0!==t?t:null),e._lastEmittedNativeAudioTrack=null!==(n=null==i?void 0:i.nativeTrack)&&void 0!==n?n:null)}}},this._nativeAudioTracks.onremovetrack=function(){var t,n;if(void 0!==e._nativeAudioTracks){var r=Hu(e._nativeAudioTracks);if(ju(e._audioTracks,r)){e._audioTracks=r,e.trigger("availableAudioTracksChange",e.getAvailableAudioTracks());var i=e._getCurrentAudioTrack();(null==i?void 0:i.nativeTrack)!==e._lastEmittedNativeAudioTrack&&(e.trigger("audioTrackChange",null!==(t=null==i?void 0:i.track)&&void 0!==t?t:null),e._lastEmittedNativeAudioTrack=null!==(n=null==i?void 0:i.nativeTrack)&&void 0!==n?n:null)}}},this._nativeAudioTracks.onchange=function(){if(void 0!==e._audioTracks)for(var t=0;t<e._audioTracks.length;t++){var n=e._audioTracks[t],r=n.track,i=n.nativeTrack;if(i.enabled)return void(i!==e._lastEmittedNativeAudioTrack&&(e.trigger("audioTrackChange",r),e._lastEmittedNativeAudioTrack=i))}null!==e._lastEmittedNativeAudioTrack&&(e.trigger("audioTrackChange",null),e._lastEmittedNativeAudioTrack=null)}),void 0!==this._nativeTextTracks&&(this._nativeTextTracks.onaddtrack=function(){var t,n;if(void 0!==e._nativeTextTracks){var r=qu(e._nativeTextTracks);if(ju(e._textTracks,r)){e._textTracks=r,e._setPreviouslyLockedTextTrack(),e.trigger("availableTextTracksChange",e.getAvailableTextTracks());var i=e._getCurrentTextTrack();(null==i?void 0:i.nativeTrack)!==e._lastEmittedNativeTextTrack&&(e.trigger("textTrackChange",null!==(t=null==i?void 0:i.track)&&void 0!==t?t:null),e._lastEmittedNativeTextTrack=null!==(n=null==i?void 0:i.nativeTrack)&&void 0!==n?n:null)}}},this._nativeTextTracks.onremovetrack=function(){var t,n;if(void 0!==e._nativeTextTracks){var r=qu(e._nativeTextTracks);if(ju(e._textTracks,r)){e._textTracks=r,e._setPreviouslyLockedTextTrack(),e.trigger("availableTextTracksChange",e.getAvailableTextTracks());var i=e._getCurrentTextTrack();(null==i?void 0:i.nativeTrack)!==e._lastEmittedNativeTextTrack&&(e.trigger("textTrackChange",null!==(t=null==i?void 0:i.track)&&void 0!==t?t:null),e._lastEmittedNativeTextTrack=null!==(n=null==i?void 0:i.nativeTrack)&&void 0!==n?n:null)}}},this._nativeTextTracks.onchange=function(){if(void 0!==e._textTracks)for(var t=0;t<e._textTracks.length;t++){var n=e._textTracks[t],r=n.track,i=n.nativeTrack;if("showing"===i.mode)return void(i!==e._lastEmittedNativeTextTrack&&(e.trigger("textTrackChange",r),e._lastEmittedNativeTextTrack=i))}null!==e._lastEmittedNativeTextTrack&&(e.trigger("textTrackChange",null),e._lastEmittedNativeTextTrack=null)}),void 0!==this._nativeVideoTracks&&(this._nativeVideoTracks.onaddtrack=function(){var t,n;if(void 0!==e._nativeVideoTracks){var r=Yu(e._nativeVideoTracks);if(ju(e._videoTracks,r)){e._videoTracks=r,e._setPreviouslyLockedVideoTrack(),e.trigger("availableVideoTracksChange",e.getAvailableVideoTracks());var i=e._getCurrentVideoTrack();(null==i?void 0:i.nativeTrack)!==e._lastEmittedNativeVideoTrack&&(e.trigger("videoTrackChange",null!==(t=null==i?void 0:i.track)&&void 0!==t?t:null),e._lastEmittedNativeVideoTrack=null!==(n=null==i?void 0:i.nativeTrack)&&void 0!==n?n:null)}}},this._nativeVideoTracks.onremovetrack=function(){var t,n;if(void 0!==e._nativeVideoTracks){var r=Yu(e._nativeVideoTracks);if(ju(e._videoTracks,r)){e._videoTracks=r,e._setPreviouslyLockedVideoTrack(),e.trigger("availableVideoTracksChange",e.getAvailableVideoTracks());var i=e._getCurrentVideoTrack();(null==i?void 0:i.nativeTrack)!==e._lastEmittedNativeVideoTrack&&(e.trigger("videoTrackChange",null!==(t=null==i?void 0:i.track)&&void 0!==t?t:null),e._lastEmittedNativeVideoTrack=null!==(n=null==i?void 0:i.nativeTrack)&&void 0!==n?n:null)}}},this._nativeVideoTracks.onchange=function(){if(void 0!==e._videoTracks)for(var t=0;t<e._videoTracks.length;t++){var n=e._videoTracks[t],r=n.track,i=n.nativeTrack;if(i.selected)return void(i!==e._lastEmittedNativeVideoTrack&&(e.trigger("videoTrackChange",r),e._lastEmittedNativeVideoTrack=i))}null!==e._lastEmittedNativeVideoTrack&&(e.trigger("videoTrackChange",null),e._lastEmittedNativeVideoTrack=null)})},n._enableAudioTrackFromIndex=function(e){!function(e,t){for(var n=0;n<e.length;n++)Z&&n===t||(e[n].enabled=!1);t<0||t>=e.length||(e[t].enabled=!0)}(this._audioTracks.map((function(e){return e.nativeTrack})),e)},t}(we);function $u(e){for(var t=0;t<e.length;t++){e[t].nativeTrack.mode="disabled"}}function Xu(e,t){for(var n=0;n<e.length;n++){var r=e[n].nativeTrack;r===t||"showing"!==r.mode&&"hidden"!==r.mode||(r.mode="disabled")}}function Zu(e){for(var t=0;t<e.length;t++){e[t].nativeTrack.selected=!1}}var Ju=function(e){function t(t){var n;return(n=e.call(this)||this)._settings=t,n._initCanceller=new Ge,n}s(t,e);var n=t.prototype;return n.prepare=function(){},n.start=function(e,t){var n=this,r=this._initCanceller.signal,i=this._settings,a=i.keySystems,o=i.speed,s=i.url;ci(e);var u=new E(null);u.finish();var l=wi(e,a,u,{onError:function(e){return n._onFatalError(e)},onWarning:function(e){return n.trigger("warning",e)}},r);Hi(e,(function(e){return n._onFatalError(e)}),r);var d=new Oi(t,null,null,o);d.addEventListener("stalled",(function(e){return n.trigger("stalled",e)})),d.addEventListener("unstalled",(function(){return n.trigger("unstalled",null)})),d.addEventListener("warning",(function(e){return n.trigger("warning",e)})),r.register((function(){d.destroy()})),d.start(),l.onUpdate((function(i,a){"uninitialized"!==i.initializationState.type&&(a(),ne.info("Setting URL to HTMLMediaElement",s),e.src=s,r.register((function(){ne.info("Init: Removing directfile src from media element",e.src),ci(e)})),"awaiting-media-link"===i.initializationState.type?(i.initializationState.value.isMediaLinked.setValue(!0),l.onUpdate((function(r,i){"initialized"===r.initializationState.type&&(i(),n._seekAndPlay(e,t))}),{emitCurrentValue:!0,clearSignal:r})):(Ee(i.initializationState.type),n._seekAndPlay(e,t)))}),{emitCurrentValue:!0,clearSignal:r})},n.updateContentUrls=function(e,t){throw new Error("Cannot update content URL of directfile contents")},n.dispose=function(){this._initCanceller.cancel()},n._onFatalError=function(e){this._initCanceller.cancel(),this.trigger("error",e)},n._seekAndPlay=function(e,t){var n=this,r=this._initCanceller.signal,i=this._settings,a=i.autoPlay,o=i.startAt;ki(e,t,(function(){ne.debug("Init: Calculating initial time");var t=function(e,t){if(null==t)return 0;if(null!=t.position)return t.position;if(null!=t.wallClockTime)return t.wallClockTime;if(null!=t.fromFirstPosition)return t.fromFirstPosition;var n=e.duration;if(null==n||!isFinite(n))return ne.warn("startAt.fromLastPosition set but no known duration, beginning at 0."),0;if("number"==typeof t.fromLastPosition)return Math.max(0,n+t.fromLastPosition);if(null!=t.percentage){var r=t.percentage;return r>=100?n:r<=0?0:n*(+r/100)}return 0}(e,o);return ne.debug("Init: Initial time calculated:",t),t}),a,(function(e){return n.trigger("warning",e)}),r).autoPlayResult.then((function(){return Ti(t,e,!0,r).onUpdate((function(e,t){e&&(t(),n.trigger("loaded",{segmentBuffersStore:null}))}),{emitCurrentValue:!0,clearSignal:r})})).catch((function(e){r.isCancelled()||n._onFatalError(e)}))},t}(ii);function el(e){e.directfile={initDirectFile:Ju,mediaElementTracksStore:Qu}}var tl,nl=w.WebKitMediaKeys;void 0!==nl&&"function"==typeof nl.isTypeSupported&&"function"==typeof nl.prototype.createSession&&"function"==typeof HTMLMediaElement.prototype.webkitSetMediaKeys&&(tl=nl);var rl,il=function(){function e(e,t,n){this._keyType=e,this._mediaKeys=t,this._configuration=n}var t=e.prototype;return t.createMediaKeys=function(){var e=this;return new Promise((function(t){return t(e._mediaKeys)}))},t.getConfiguration=function(){return this._configuration},a(e,[{key:"keySystem",get:function(){return this._keyType}}]),e}(),al=w.MSMediaKeys;function ol(e){try{var t=e();return"object"==typeof t&&null!==t&&"function"==typeof t.then?t:Promise.resolve(t)}catch(e){return Promise.reject(e)}}void 0!==al&&void 0!==al.prototype&&"function"==typeof al.isTypeSupported&&"function"==typeof al.prototype.createSession&&(rl=al);var sl,ul=function(e){function t(t){var n;return(n=e.call(this)||this).expiration=NaN,n.keyStatuses=new Map,n._mk=t,n._sessionClosingCanceller=new Ge,n.closed=new Promise((function(e){n._sessionClosingCanceller.signal.register((function(){return e()}))})),n.update=function(e){return new Promise((function(t,r){if(void 0===n._ss)return r("MediaKeySession not set.");try{t(n._ss.update(e,""))}catch(e){r(e)}}))},n}s(t,e);var n=t.prototype;return n.generateRequest=function(e,t){var n=this;return new Promise((function(e){var r=t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer);n._ss=n._mk.createSession("video/mp4",r),N(n._ss,(function(e){var t;n.trigger(null!==(t=e.type)&&void 0!==t?t:"message",e)}),n._sessionClosingCanceller.signal),O(n._ss,(function(e){var t;n.trigger(null!==(t=e.type)&&void 0!==t?t:"keyadded",e)}),n._sessionClosingCanceller.signal),L(n._ss,(function(e){var t;n.trigger(null!==(t=e.type)&&void 0!==t?t:"keyerror",e)}),n._sessionClosingCanceller.signal),e()}))},n.close=function(){var e=this;return new Promise((function(t){null!=e._ss&&(e._ss.close(),e._ss=void 0),e._sessionClosingCanceller.cancel(),t()}))},n.load=function(){return Promise.resolve(!1)},n.remove=function(){return Promise.resolve()},a(t,[{key:"sessionId",get:function(){var e,t;return null!==(t=null===(e=this._ss)||void 0===e?void 0:e.sessionId)&&void 0!==t?t:""}}]),t}(we),ll=function(){function e(e){if(void 0===rl)throw new Error("No MSMediaKeys API.");this._mediaKeys=new rl(e)}var t=e.prototype;return t._setVideo=function(e){var t=this;return ol((function(){t._videoElement=e,void 0!==t._videoElement.msSetMediaKeys&&t._videoElement.msSetMediaKeys(t._mediaKeys)}))},t.createSession=function(){if(void 0===this._videoElement||void 0===this._mediaKeys)throw new Error("Video not attached to the MediaKeys");return new ul(this._mediaKeys)},t.setServerCertificate=function(){throw new Error("Server certificate is not implemented in your browser")},e}();var dl=w.MozMediaKeys;function cl(e){return"function"==typeof e.webkitGenerateKeyRequest}void 0!==dl&&void 0!==dl.prototype&&"function"==typeof dl.isTypeSupported&&"function"==typeof dl.prototype.createSession&&(sl=dl);var fl=function(e){function t(t,n){var r;(r=e.call(this)||this)._vid=t,r._key=n,r.sessionId="",r._closeSession=m,r.keyStatuses=new Map,r.expiration=NaN;var i=function(e){r.trigger(e.type,e)};return r.closed=new Promise((function(e){r._closeSession=function(){["keymessage","message","keyadded","ready","keyerror","error"].forEach((function(e){t.removeEventListener(e,i),t.removeEventListener("webkit"+e,i)})),e()}})),["keymessage","message","keyadded","ready","keyerror","error"].forEach((function(e){t.addEventListener(e,i),t.addEventListener("webkit"+e,i)})),r}s(t,e);var n=t.prototype;return n.update=function(e){var t=this;return new Promise((function(n,r){try{if(t._key.indexOf("clearkey")>=0){var i=e instanceof ArrayBuffer?new Uint8Array(e):e,a=JSON.parse(wa(i)),o=za(a.keys[0].k),s=za(a.keys[0].kid);n(t._vid.webkitAddKey(t._key,o,s,""))}else n(t._vid.webkitAddKey(t._key,e,null,""))}catch(e){r(e)}}))},n.generateRequest=function(e,t){var n=this;return new Promise((function(e){n._vid.webkitGenerateKeyRequest(n._key,t),e()}))},n.close=function(){var e=this;return new Promise((function(t){e._closeSession(),t()}))},n.load=function(){return Promise.resolve(!1)},n.remove=function(){return Promise.resolve()},t}(we),vl=function(){function e(e){this._keySystem=e}var t=e.prototype;return t._setVideo=function(e){var t=this;return ol((function(){if(!cl(e))throw new Error("Video not attached to the MediaKeys");t._videoElement=e}))},t.createSession=function(){if(null==this._videoElement)throw new Error("Video not attached to the MediaKeys");return new fl(this._videoElement,this._keySystem)},t.setServerCertificate=function(){throw new Error("Server certificate is not implemented in your browser")},e}();function pl(e,t){var n=e instanceof Uint8Array?e:new Uint8Array(e),r=t instanceof Uint8Array?t:new Uint8Array(t),i=function(e,t){return e[t+0]+256*e[t+1]+65536*e[t+2]+16777216*e[t+3]}(n,0);if(i+4!==n.length)throw new Error("Unsupported WebKit initData.");var a=Ea(n),o=a.indexOf("skd://"),s=function(e){for(var t=new ArrayBuffer(2*e.length),n=new Uint8Array(t),r=0;r<n.length;r+=2){var i=e.charCodeAt(r/2);n[r]=255&i,n[r+1]=i>>8&255}return n}(o>-1?a.substring(o+6):a),u=0,l=new Uint8Array(n.byteLength+4+s.byteLength+4+r.byteLength);return l.set(n),u+=n.length,l.set(ia(s.byteLength),u),u+=4,l.set(s,u),u+=s.byteLength,l.set(ia(r.byteLength),u),u+=4,l.set(r,u),l}function hl(e,t){var n=e;return ol((function(){if(void 0===n.webkitSetMediaKeys)throw new Error("No webKitMediaKeys API.");n.webkitSetMediaKeys(t)}))}var ml=function(e){function t(t,n,r){var i;return(i=e.call(this)||this)._serverCertificate=r,i._videoElement=t,i._keyType=n,i._unbindSession=m,i._closeSession=m,i.closed=new Promise((function(e){i._closeSession=e})),i.keyStatuses=new Map,i.expiration=NaN,i}s(t,e);var n=t.prototype;return n.update=function(e){var t=this;return new Promise((function(n,r){if(void 0===t._nativeSession||void 0===t._nativeSession.update||"function"!=typeof t._nativeSession.update)return r("Unavailable WebKit key session.");try{var i;i=e instanceof ArrayBuffer?new Uint8Array(e):e instanceof Uint8Array?e:new Uint8Array(e.buffer),n(t._nativeSession.update(i))}catch(e){r(e)}}))},n.generateRequest=function(e,t){var n=this;return new Promise((function(e){var r,i,a=n._videoElement;if(void 0===(null===(r=a.webkitKeys)||void 0===r?void 0:r.createSession))throw new Error("No WebKitMediaKeys API.");if(Wr(n._keyType,"com.apple.fps")){if(void 0===n._serverCertificate)throw new Error("A server certificate is needed for creating fairplay session.");i=pl(t,n._serverCertificate)}else i=t;var o=a.webkitKeys.createSession("video/mp4",i);if(null==o)throw new Error("Impossible to get the key sessions");n._listenEvent(o),n._nativeSession=o,e()}))},n.close=function(){var e=this;return new Promise((function(t,n){e._unbindSession(),e._closeSession(),void 0!==e._nativeSession?(e._nativeSession.close(),t()):n("No session to close.")}))},n.load=function(){return Promise.resolve(!1)},n.remove=function(){return Promise.resolve()},n._listenEvent=function(e){var t=this;this._unbindSession();var n=function(e){t.trigger(e.type,e)};["keymessage","message","keyadded","ready","keyerror","error"].forEach((function(t){e.addEventListener(t,n),e.addEventListener("webkit"+t,n)})),this._unbindSession=function(){["keymessage","message","keyadded","ready","keyerror","error"].forEach((function(t){e.removeEventListener(t,n),e.removeEventListener("webkit"+t,n)}))}},a(t,[{key:"sessionId",get:function(){var e,t;return null!==(t=null===(e=this._nativeSession)||void 0===e?void 0:e.sessionId)&&void 0!==t?t:""}}]),t}(we),gl=function(){function e(e){if(void 0===tl)throw new Error("No WebKitMediaKeys API.");this._keyType=e,this._mediaKeys=new tl(e)}var t=e.prototype;return t._setVideo=function(e){if(this._videoElement=e,void 0===this._videoElement)throw new Error("Video not attached to the MediaKeys");return hl(this._videoElement,this._mediaKeys)},t.createSession=function(){if(void 0===this._videoElement||void 0===this._mediaKeys)throw new Error("Video not attached to the MediaKeys");return new ml(this._videoElement,this._keyType,this._serverCertificate)},t.setServerCertificate=function(e){return this._serverCertificate=e,Promise.resolve()},e}();function yl(){if(void 0===tl)throw new Error("No WebKitMediaKeys API.");return{isTypeSupported:tl.isTypeSupported,createCustomMediaKeys:function(e){return new gl(e)},setMediaKeys:function(e,t){if(null===t)return hl(e,t);if(!(t instanceof gl))throw new Error("Custom setMediaKeys is supposed to be called with webkit custom MediaKeys.");return t._setVideo(e)}}}var _l=function(e){var t,n,r,i=bl;if("standard"!==e&&("auto"!==e||(Q||$)&&void 0!==tl)||!k&&h(navigator.requestMediaKeySystemAccess)){var a,o;if("webkit"===e&&void 0!==tl){n=R(["needkey"]);var s=yl();a=s.isTypeSupported,o=s.createCustomMediaKeys,i=s.setMediaKeys,r="webkit"}else if(cl(HTMLVideoElement.prototype)){n=R(["needkey"]);var u={isTypeSupported:function(e){var t=document.querySelector("video");return null==t&&(t=document.createElement("video")),null!=t&&"function"==typeof t.canPlayType&&!!t.canPlayType("video/mp4",e)},createCustomMediaKeys:function(e){return new vl(e)},setMediaKeys:function(e,t){if(null===t)return Promise.resolve(void 0);if(!(t instanceof vl))throw new Error("Custom setMediaKeys is supposed to be called with old webkit custom MediaKeys.");return t._setVideo(e)}};a=u.isTypeSupported,o=u.createCustomMediaKeys,i=u.setMediaKeys,r="older-webkit"}else if(void 0!==tl){n=R(["needkey"]);var l=yl();a=l.isTypeSupported,o=l.createCustomMediaKeys,i=l.setMediaKeys,r="webkit"}else if(H&&void 0!==rl){n=R(["encrypted","needkey"]);var d={isTypeSupported:function(e,t){if(void 0===rl)throw new Error("No MSMediaKeys API.");return void 0!==t?rl.isTypeSupported(e,t):rl.isTypeSupported(e)},createCustomMediaKeys:function(e){return new ll(e)},setMediaKeys:function(e,t){if(null===t)return Promise.resolve(void 0);if(!(t instanceof ll))throw new Error("Custom setMediaKeys is supposed to be called with IE11 custom MediaKeys.");return t._setVideo(e)}};a=d.isTypeSupported,o=d.createCustomMediaKeys,i=d.setMediaKeys,r="ms"}else if(void 0!==sl){n=R(["encrypted","needkey"]);var c={isTypeSupported:function(e,t){if(void 0===sl)throw new Error("No MozMediaKeys API.");return void 0!==t?sl.isTypeSupported(e,t):sl.isTypeSupported(e)},createCustomMediaKeys:function(e){if(void 0===sl)throw new Error("No MozMediaKeys API.");return new sl(e)},setMediaKeys:function(e,t){return ol((function(){var n=e;if(void 0===n.mozSetMediaKeys||"function"!=typeof n.mozSetMediaKeys)throw new Error("Can't set video on MozMediaKeys.");return n.mozSetMediaKeys(t)}))}};a=c.isTypeSupported,o=c.createCustomMediaKeys,i=c.setMediaKeys,r="moz"}else{n=R(["encrypted","needkey"]);var f=w.MediaKeys,v=function(){if(void 0===f)throw new ve("MEDIA_KEYS_NOT_SUPPORTED","No `MediaKeys` implementation found in the current browser.");if(void 0===f.isTypeSupported){throw new Error("This browser seems to be unable to play encrypted contents currently.Note: Some browsers do not allow decryption in some situations, like when not using HTTPS.")}};a=function(e){return v(),Ee(f.isTypeSupported),f.isTypeSupported(e)},o=function(e){return v(),new f(e)},r="unknown"}t=function(e,t){if(!a(e))return Promise.reject(new Error("Unsupported key type"));for(var n=0;n<t.length;n++){var r=t[n],i=r.videoCapabilities,s=r.audioCapabilities,u=r.initDataTypes,l=r.distinctiveIdentifier,d=!0;if(d=(d=d&&(null==u||u.some((function(e){return"cenc"===e}))))&&"required"!==l){var c={initDataTypes:["cenc"],distinctiveIdentifier:"not-allowed",persistentState:"required",sessionTypes:["temporary","persistent-license"]};void 0!==i&&(c.videoCapabilities=i),void 0!==s&&(c.audioCapabilities=s);var f=o(e);return Promise.resolve(new il(e,f,c))}}return Promise.reject(new Error("Unsupported configuration"))}}else t=function(){var e;return(e=navigator).requestMediaKeySystemAccess.apply(e,arguments)},n=R(["encrypted"]),r="standard";return{requestMediaKeySystemAccess:t,onEncrypted:n,setMediaKeys:i,implementation:r}}("auto");function bl(e,t){try{var n,r=e;return"function"==typeof r.setMediaKeys?n=r.setMediaKeys(t):"function"==typeof r.webkitSetMediaKeys?n=r.webkitSetMediaKeys(t):"function"==typeof r.mozSetMediaKeys?n=r.mozSetMediaKeys(t):"function"==typeof r.msSetMediaKeys&&null!==t&&(n=r.msSetMediaKeys(t)),"object"==typeof n&&null!==n&&"function"==typeof n.then?n:Promise.resolve(n)}catch(e){return Promise.reject(e)}}var Sl=_l,El=Ji(Ta("pssh"),0);function Tl(e,t){for(var n=0;n<e.length;n++){var r=e[n];if((void 0===t.systemId||void 0===r.systemId||t.systemId===r.systemId)&&on(t.data,r.data))return!0}return!1}function kl(e){var t=e.initData,n=e.initDataType;if(null==t)return ne.warn("Compat: No init data found on media encrypted event."),null;var r=function(e){for(var t=[],n=0;n<e.length;){if(e.length<n+8||Ji(e,n+4)!==El)return ne.warn("Compat: Unrecognized initialization data. Use as is."),[{systemId:void 0,data:e}];var r=Ji(new Uint8Array(e),n);if(n+r>e.length)return ne.warn("Compat: Unrecognized initialization data. Use as is."),[{systemId:void 0,data:e}];var i=e.subarray(n,n+r),a={systemId:bu(i,8),data:i};Tl(t,a)?ne.warn("Compat: Duplicated PSSH found in initialization data, removing it."):t.push(a),n+=r}return n!==e.length?(ne.warn("Compat: Unrecognized initialization data. Use as is."),[{systemId:void 0,data:e}]):t}(new Uint8Array(t));return{type:n,values:r}}function wl(e){Ze.setState(e,null),Sl.setMediaKeys(e,null).then((function(){ne.info("DRM: MediaKeys disabled with success")})).catch((function(e){ne.error("DRM: Could not disable MediaKeys",e instanceof Error?e:"Unknown Error")}))}function Al(){return(Al=qe(Qe().mark((function e(t,n,r){var i,a,o,s,u,l,d;return Qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=n.emeImplementation,a=n.keySystemOptions,o=n.loadedSessionsStore,s=n.mediaKeySystemAccess,u=n.mediaKeys,l=Ze.getState(t),d=null!==l&&l.loadedSessionsStore!==o?l.loadedSessionsStore.closeAllSessions():Promise.resolve(),e.next=5,d;case 5:if(!r.isCancelled()){e.next=7;break}throw r.cancellationError;case 7:if(Ze.setState(t,{emeImplementation:i,keySystemOptions:a,mediaKeySystemAccess:s,mediaKeys:u,loadedSessionsStore:o}),t.mediaKeys!==u){e.next=10;break}return e.abrupt("return");case 10:ne.info("DRM: Attaching MediaKeys to the media element"),i.setMediaKeys(t,u).then((function(){ne.info("DRM: MediaKeys attached with success")})).catch((function(e){ne.error("DRM: Could not set MediaKeys",e instanceof Error?e:"Unknown Error")}));case 12:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Il(e){if(""===e.sessionId)return!1;var t=e.keyStatuses,n=[];return t.forEach((function(e){n.push(e)})),n.length<=0?(ne.debug("DRM: isSessionUsable: MediaKeySession given has an empty keyStatuses",e.sessionId),!1):Se(n,"expired")?(ne.debug("DRM: isSessionUsable: MediaKeySession given has an expired key",e.sessionId),!1):Se(n,"internal-error")?(ne.debug("DRM: isSessionUsable: MediaKeySession given has a key with an internal-error",e.sessionId),!1):(ne.debug("DRM: isSessionUsable: MediaKeySession is usable",e.sessionId),!0)}function Rl(e,t,n,r){var i=e.loadedSessionsStore,a=e.persistentSessionsStore;return"temporary"===n?xl(i,t):null===a?(ne.warn("DRM: Cannot create persistent MediaKeySession, PersistentSessionsStore not created."),xl(i,t)):function(e,t,n,r){return Ml.apply(this,arguments)}(i,a,t,r)}function xl(e,t){ne.info("DRM: Creating a new temporary session");var n=e.createSession(t,"temporary");return Promise.resolve({type:"created-session",value:n})}function Ml(){return Ml=qe(Qe().mark((function e(t,n,r,i){var a,o,s,u,l,d;return Qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(d=function(){return d=qe(Qe().mark((function e(){var o,s;return Qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===i.cancellationError){e.next=2;break}throw i.cancellationError;case 2:return ne.info("DRM: Removing previous persistent session."),null!==(o=n.get(r))&&n.delete(o.sessionId),e.prev=5,e.next=8,t.closeSession(a.mediaKeySession);case 8:e.next=15;break;case 10:if(e.prev=10,e.t0=e.catch(5),""===a.mediaKeySession.sessionId){e.next=14;break}throw e.t0;case 14:t.removeSessionWithoutClosingIt(a.mediaKeySession);case 15:if(null===i.cancellationError){e.next=17;break}throw i.cancellationError;case 17:return s=t.createSession(r,"persistent-license"),e.abrupt("return",{type:"created-session",value:s});case 19:case"end":return e.stop()}}),e,null,[[5,10]])}))),d.apply(this,arguments)},l=function(){return d.apply(this,arguments)},null===i.cancellationError){e.next=4;break}throw i.cancellationError;case 4:if(ne.info("DRM: Creating persistent MediaKeySession"),a=t.createSession(r,"persistent-license"),null!==(o=n.getAndReuse(r))){e.next=9;break}return e.abrupt("return",{type:"created-session",value:a});case 9:return e.prev=9,e.next=12,t.loadPersistentSession(a.mediaKeySession,o.sessionId);case 12:if(s=e.sent){e.next=19;break}return ne.warn("DRM: No data stored for the loaded session"),n.delete(o.sessionId),t.removeSessionWithoutClosingIt(a.mediaKeySession),u=t.createSession(r,"persistent-license"),e.abrupt("return",{type:"created-session",value:u});case 19:if(!s||!Il(a.mediaKeySession)){e.next=23;break}return n.add(r,r.keyIds,a.mediaKeySession),ne.info("DRM: Succeeded to load persistent session."),e.abrupt("return",{type:"loaded-persistent-session",value:a});case 23:return ne.warn("DRM: Previous persistent session not usable anymore."),e.abrupt("return",l());case 27:return e.prev=27,e.t0=e.catch(9),ne.warn("DRM: Unable to load persistent session: "+(e.t0 instanceof Error?e.t0.toString():"Unknown Error")),e.abrupt("return",l());case 31:case"end":return e.stop()}}),e,null,[[9,27]])}))),Ml.apply(this,arguments)}function Cl(e,t){return Pl.apply(this,arguments)}function Pl(){return(Pl=qe(Qe().mark((function e(t,n){var r,i,a,o,s;return Qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n<0||n>=t.getLength())){e.next=2;break}return e.abrupt("return");case 2:for(ne.info("DRM: LSS cache limit exceeded",n,t.getLength()),r=[],i=t.getAll().slice(),a=i.length-n,o=0;o<a;o++)s=i[o],r.push(t.closeSession(s.mediaKeySession));return e.next=9,Promise.all(r);case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Dl(e,t,n,r,i){return Nl.apply(this,arguments)}function Nl(){return(Nl=qe(Qe().mark((function e(t,n,r,i,a){var o,s,u,l,d;return Qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=null,s=n.loadedSessionsStore,u=n.persistentSessionsStore,null===(l=s.reuse(t))){e.next=11;break}if(!Il(o=l.mediaKeySession)){e.next=10;break}return ne.info("DRM: Reuse loaded session",o.sessionId),e.abrupt("return",{type:"loaded-open-session",value:{mediaKeySession:o,sessionType:l.sessionType,keySessionRecord:l.keySessionRecord}});case 10:null!==u&&""!==l.mediaKeySession.sessionId&&u.delete(l.mediaKeySession.sessionId);case 11:if(null===o){e.next=16;break}return e.next=14,s.closeSession(o);case 14:if(null===a.cancellationError){e.next=16;break}throw a.cancellationError;case 16:return e.next=18,Cl(s,i);case 18:if(null===a.cancellationError){e.next=20;break}throw a.cancellationError;case 20:return e.next=22,Rl(n,t,r,a);case 22:return d=e.sent,e.abrupt("return",{type:d.type,value:{mediaKeySession:d.value.mediaKeySession,sessionType:d.value.sessionType,keySessionRecord:d.value.keySessionRecord}});case 24:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ol(e,t,n){var r=t.getConfiguration();if(H||null==r)return null;var i=e.filter((function(e){return e.type===n.type&&(!!(h(e.persistentLicenseConfig)&&"required"!==e.persistentState||"required"===r.persistentState)&&("required"!==e.distinctiveIdentifier||"required"===r.distinctiveIdentifier))}))[0];return null!=i?{keySystemOptions:i,keySystemAccess:t}:null}function Ll(e){var t=e.keyName,n=e.keyType,r=e.keySystemOptions,i=["temporary"],a="optional",o="optional";h(r.persistentLicenseConfig)||(a="required",i.push("persistent-license")),h(r.persistentState)||(a=r.persistentState),h(r.distinctiveIdentifier)||(o=r.distinctiveIdentifier);var s,u,l=v.getCurrent(),d=l.EME_DEFAULT_AUDIO_CODECS,c=l.EME_DEFAULT_VIDEO_CODECS,f=l.EME_DEFAULT_WIDEVINE_ROBUSTNESSES,p=l.EME_DEFAULT_PLAYREADY_RECOMMENDATION_ROBUSTNESSES,m=r.audioCapabilitiesConfig,g=r.videoCapabilitiesConfig;if("full"===(null==m?void 0:m.type))s=m.value;else{var y;0===(y="robustness"===(null==m?void 0:m.type)?m.value:"widevine"===t?f:"com.microsoft.playready.recommendation"===n?p:[]).length&&y.push(void 0);var _="contentType"===(null==m?void 0:m.type)?m.value:d;s=Ko(y,(function(e){return _.map((function(t){return void 0!==e?{contentType:t,robustness:e}:{contentType:t}}))}))}if("full"===(null==g?void 0:g.type))u=g.value;else{var b;0===(b="robustness"===(null==g?void 0:g.type)?g.value:"widevine"===t?f:"com.microsoft.playready.recommendation"===n?p:[]).length&&b.push(void 0);var S="contentType"===(null==g?void 0:g.type)?g.value:c;u=Ko(b,(function(e){return S.map((function(t){return void 0!==e?{contentType:t,robustness:e}:{contentType:t}}))}))}var E={initDataTypes:["cenc"],videoCapabilities:u,audioCapabilities:s,distinctiveIdentifier:o,persistentState:a,sessionTypes:i};return[E,Object.assign(Object.assign({},E),{audioCapabilities:void 0,videoCapabilities:void 0})]}function Ul(e,t,n){ne.info("DRM: Searching for compatible MediaKeySystemAccess");var r=Ze.getState(e);if(null!==r&&Sl.implementation===r.emeImplementation.implementation){var i=Ol(t,r.mediaKeySystemAccess,r.keySystemOptions);if(null!==i)return ne.info("DRM: Found cached compatible keySystem"),Promise.resolve({type:"reuse-media-key-system-access",value:{mediaKeySystemAccess:i.keySystemAccess,options:i.keySystemOptions}})}var a=t.reduce((function(e,t){var n,r=v.getCurrent().EME_KEY_SYSTEMS[t.type];if(null!=r)n=r.map((function(e){return{keyName:t.type,keyType:e,keySystemOptions:t}}));else{var i=function(e){for(var t=v.getCurrent().EME_KEY_SYSTEMS,n=0,r=Object.keys(t);n<r.length;n++){var i=r[n];if(Se(t[i],e))return i}}(t.type);n=[{keyName:i,keyType:t.type,keySystemOptions:t}]}return e.concat(n)}),[]);return o(0);function o(e){return s.apply(this,arguments)}function s(){return(s=qe(Qe().mark((function e(t){var r,i,s,u,l;return Qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(t>=a.length)){e.next=2;break}throw new fe("INCOMPATIBLE_KEYSYSTEMS","No key system compatible with your wanted configuration has been found in the current browser.");case 2:if(null!=Sl.requestMediaKeySystemAccess){e.next=4;break}throw new Error("requestMediaKeySystemAccess is not implemented in your browser.");case 4:return r=a[t],i=r.keyType,s=r.keySystemOptions,u=Ll(r),ne.debug("DRM: Request keysystem access "+i+","+(t+1)+" of "+a.length),e.prev=8,e.next=11,Sl.requestMediaKeySystemAccess(i,u);case 11:return l=e.sent,ne.info("DRM: Found compatible keysystem",i,t+1),e.abrupt("return",{type:"create-media-key-system-access",value:{options:s,mediaKeySystemAccess:l}});case 16:if(e.prev=16,e.t0=e.catch(8),ne.debug("DRM: Rejected access to keysystem",i,t+1),null===n.cancellationError){e.next=21;break}throw n.cancellationError;case 21:return e.abrupt("return",o(t+1));case 22:case"end":return e.stop()}}),e,null,[[8,16]])})))).apply(this,arguments)}}function Bl(e,t,n){var r;ne.debug("Compat: Calling generateRequest on the MediaKeySession");try{r=function(e){ne.info("Compat: Trying to move CENC PSSH from init data at the end of it.");for(var t=!1,n=new Uint8Array,r=new Uint8Array,i=0;i<e.length;){if(e.length<i+8||Ji(e,i+4)!==El)throw ne.warn("Compat: unrecognized initialization data. Cannot patch it."),new Error("Compat: unrecognized initialization data. Cannot patch it.");var a=Ji(new Uint8Array(e),i);if(i+a>e.length)throw ne.warn("Compat: unrecognized initialization data. Cannot patch it."),new Error("Compat: unrecognized initialization data. Cannot patch it.");var o=e.subarray(i,i+a);if(16===e[i+12]&&119===e[i+13]&&239===e[i+14]&&236===e[i+15]&&192===e[i+16]&&178===e[i+17]&&77===e[i+18]&&2===e[i+19]&&172===e[i+20]&&227===e[i+21]&&60===e[i+22]&&30===e[i+23]&&82===e[i+24]&&226===e[i+25]&&251===e[i+26]&&75===e[i+27]){var s=ca(o),u=null===s?void 0:o[s[1]];ne.info("Compat: CENC PSSH found with version",u),void 0===u?ne.warn("Compat: could not read version of CENC PSSH"):t===(1===u)?n=$i(n,o):1===u?(ne.warn("Compat: cenc version 1 encountered, removing every other cenc pssh box."),n=o,t=!0):ne.warn("Compat: filtering out cenc pssh box with wrong version",u)}else r=$i(r,o);i+=a}if(i!==e.length)throw ne.warn("Compat: unrecognized initialization data. Cannot patch it."),new Error("Compat: unrecognized initialization data. Cannot patch it.");return $i(r,n)}(n)}catch(e){r=n}var i=null!=t?t:"";return e.generateRequest(i,r).catch((function(t){if(""!==i||!(t instanceof TypeError))throw t;return ne.warn('Compat: error while calling `generateRequest` with an empty initialization data type. Retrying with a default "cenc" value.',t),e.generateRequest("cenc",r)}))}var Fl=100;function zl(e,t){return Vl.apply(this,arguments)}function Vl(){return(Vl=qe(Qe().mark((function e(t,n){var r;return Qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return ne.info("DRM: Load persisted session",n),e.next=3,t.load(n);case 3:if((r=e.sent)&&!(t.keyStatuses.size>0)){e.next=6;break}return e.abrupt("return",r);case 6:return e.abrupt("return",new Promise((function(e){t.addEventListener("keystatuseschange",i);var n=setTimeout(i,Fl);function i(){clearTimeout(n),t.removeEventListener("keystatuseschange",i),e(r)}})));case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Kl(e){var t=new Ge;return Promise.race([e.close().then((function(){t.cancel()})),e.closed.then((function(){t.cancel()})),function(){return n.apply(this,arguments)}()]);function n(){return(n=qe(Qe().mark((function e(){var n;return Qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,In(1e3,t.signal);case 3:return e.next=5,r();case 5:e.next=13;break;case 7:if(e.prev=7,e.t0=e.catch(0),!(e.t0 instanceof je)){e.next=11;break}return e.abrupt("return");case 11:n=e.t0 instanceof Error?e.t0.message:"Unknown error made it impossible to close the session",ne.error("DRM: "+n);case 13:case"end":return e.stop()}}),e,null,[[0,7]])})))).apply(this,arguments)}function r(){return i.apply(this,arguments)}function i(){return(i=qe(Qe().mark((function n(){return Qe().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,n.next=3,e.update(new Uint8Array(1));case 3:n.next=13;break;case 5:if(n.prev=5,n.t0=n.catch(0),!t.isUsed()){n.next=9;break}return n.abrupt("return");case 9:if(!(n.t0 instanceof Error&&"The session is already closed."===n.t0.message)){n.next=11;break}return n.abrupt("return");case 11:return n.next=13,In(1e3,t.signal);case 13:if(!t.isUsed()){n.next=15;break}return n.abrupt("return");case 15:throw new Error("Compat: Couldn't know if session is closed");case 16:case"end":return n.stop()}}),n,null,[[0,5]])})))).apply(this,arguments)}}function Gl(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Wl(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Wl(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Wl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function jl(e,t){for(var n,r,i=function(){var e=r.value;if(!t.some((function(t){return on(t,e)})))return{v:!1}},a=Gl(e);!(r=a()).done;)if(n=i())return n.v;return!0}function Hl(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return ql(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ql(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ql(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Yl=function(){function e(e){this._initializationData=e,this._keyIds=null}var t=e.prototype;return t.associateKeyIds=function(e){null===this._keyIds&&(this._keyIds=[]);for(var t=0,n=Array.from(e);t<n.length;t++){var r=n[t];this.isAssociatedWithKeyId(r)||this._keyIds.push(r)}},t.isAssociatedWithKeyId=function(e){if(null===this._keyIds)return!1;for(var t,n=Hl(this._keyIds);!(t=n()).done;){if(on(t.value,e))return!0}return!1},t.getAssociatedKeyIds=function(){return null===this._keyIds?[]:this._keyIds},t.isCompatibleWith=function(e){var t=e.keyIds;if(void 0!==t&&t.length>0){if(null!==this._keyIds&&jl(t,this._keyIds))return!0;if(void 0!==this._initializationData.keyIds)return jl(t,this._initializationData.keyIds)}return this._checkInitializationDataCompatibility(e)},t._checkInitializationDataCompatibility=function(e){return void 0!==e.keyIds&&e.keyIds.length>0&&void 0!==this._initializationData.keyIds?jl(e.keyIds,this._initializationData.keyIds):this._initializationData.type===e.type&&this._initializationData.values.isCompatibleWith(e.values)},e}();function Ql(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return $l(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return $l(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function $l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Xl=function(){function e(e){this._mediaKeys=e,this._storage=[]}var t=e.prototype;return t.createSession=function(e,t){var n=this,r=new Yl(e);ne.debug("DRM-LSS: calling `createSession`",t);var i=this._mediaKeys.createSession(t),a={mediaKeySession:i,sessionType:t,keySessionRecord:r,isGeneratingRequest:!1,isLoadingPersistentSession:!1,closingStatus:{type:"none"}};return h(i.closed)||i.closed.then((function(){ne.info("DRM-LSS: session was closed, removing it.",i.sessionId);var e=n.getIndex(r);e>=0&&n._storage[e].mediaKeySession===i&&n._storage.splice(e,1)})).catch((function(e){ne.warn("DRM-LSS: MediaKeySession.closed rejected: "+e)})),this._storage.push(Object.assign({},a)),ne.debug("DRM-LSS: MediaKeySession added",a.sessionType,this._storage.length),a},t.reuse=function(e){for(var t=this._storage.length-1;t>=0;t--){var n=this._storage[t];if(n.keySessionRecord.isCompatibleWith(e))return this._storage.splice(t,1),this._storage.push(n),ne.debug("DRM-LSS: Reusing session:",n.mediaKeySession.sessionId,n.sessionType),Object.assign({},n)}return null},t.getEntryForSession=function(e){for(var t=this._storage.length-1;t>=0;t--){var n=this._storage[t];if(n.mediaKeySession===e)return Object.assign({},n)}return null},t.generateLicenseRequest=function(){var e=qe(Qe().mark((function e(t,n,r){var i,a,o,s;return Qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:a=Ql(this._storage);case 1:if((o=a()).done){e.next=8;break}if((s=o.value).mediaKeySession!==t){e.next=6;break}return i=s,e.abrupt("break",8);case 6:e.next=1;break;case 8:if(void 0!==i){e.next=11;break}return ne.error("DRM-LSS: generateRequest error. No MediaKeySession found with the given initData and initDataType"),e.abrupt("return",Bl(t,n,r));case 11:if(i.isGeneratingRequest=!0,"none"===i.closingStatus.type){e.next=14;break}throw new Error("The `MediaKeySession` is being closed.");case 14:return e.prev=14,e.next=17,Bl(t,n,r);case 17:e.next=26;break;case 19:if(e.prev=19,e.t0=e.catch(14),void 0!==i){e.next=23;break}throw e.t0;case 23:throw i.isGeneratingRequest=!1,"awaiting"===i.closingStatus.type&&i.closingStatus.start(),e.t0;case 26:if(void 0!==i){e.next=28;break}return e.abrupt("return",void 0);case 28:i.isGeneratingRequest=!1,"awaiting"===i.closingStatus.type&&i.closingStatus.start();case 30:case"end":return e.stop()}}),e,this,[[14,19]])})));return function(t,n,r){return e.apply(this,arguments)}}(),t.loadPersistentSession=function(){var e=qe(Qe().mark((function e(t,n){var r,i,a,o,s;return Qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=Ql(this._storage);case 1:if((a=i()).done){e.next=8;break}if((o=a.value).mediaKeySession!==t){e.next=6;break}return r=o,e.abrupt("break",8);case 6:e.next=1;break;case 8:if(void 0!==r){e.next=11;break}return ne.error("DRM-LSS: loadPersistentSession error. No MediaKeySession found with the given initData and initDataType"),e.abrupt("return",zl(t,n));case 11:if(r.isLoadingPersistentSession=!0,"none"===r.closingStatus.type){e.next=14;break}throw new Error("The `MediaKeySession` is being closed.");case 14:return e.prev=14,e.next=17,zl(t,n);case 17:s=e.sent,e.next=27;break;case 20:if(e.prev=20,e.t0=e.catch(14),void 0!==r){e.next=24;break}throw e.t0;case 24:throw r.isLoadingPersistentSession=!1,"awaiting"===r.closingStatus.type&&r.closingStatus.start(),e.t0;case 27:if(void 0!==r){e.next=29;break}return e.abrupt("return",s);case 29:return r.isLoadingPersistentSession=!1,"awaiting"===r.closingStatus.type&&r.closingStatus.start(),e.abrupt("return",s);case 32:case"end":return e.stop()}}),e,this,[[14,20]])})));return function(t,n){return e.apply(this,arguments)}}(),t.closeSession=function(){var e=qe(Qe().mark((function e(t){var n,r,i,a;return Qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=Ql(this._storage);case 1:if((i=r()).done){e.next=8;break}if((a=i.value).mediaKeySession!==t){e.next=6;break}return n=a,e.abrupt("break",8);case 6:e.next=1;break;case 8:if(void 0!==n){e.next=11;break}return ne.warn("DRM-LSS: No MediaKeySession found with the given initData and initDataType"),e.abrupt("return",Promise.resolve(!1));case 11:return e.abrupt("return",this._closeEntry(n));case 12:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.getLength=function(){return this._storage.length},t.getAll=function(){return this._storage},t.closeAllSessions=function(){var e=qe(Qe().mark((function e(){var t,n,r=this;return Qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this._storage,ne.debug("DRM-LSS: Closing all current MediaKeySessions",t.length),this._storage=[],n=t.map((function(e){return r._closeEntry(e)})),e.next=6,Promise.all(n);case 6:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),t.removeSessionWithoutClosingIt=function(e){Ee(e.sessionId);for(var t=this._storage.length-1;t>=0;t--){if(this._storage[t].mediaKeySession===e)return ne.debug("DRM-LSS: Removing session without closing it",e.sessionId),this._storage.splice(t,1),!0}return!1},t.getIndex=function(e){for(var t=0;t<this._storage.length;t++){if(this._storage[t].keySessionRecord===e)return t}return-1},t._closeEntry=function(){var e=qe(Qe().mark((function e(t){var n;return Qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.mediaKeySession,e.abrupt("return",new Promise((function(e,r){function i(){void 0!==t&&(t.closingStatus={type:"pending"}),Zl(n).then((function(){void 0!==t&&(t.closingStatus={type:"done"}),e(!0)})).catch((function(e){void 0!==t&&(t.closingStatus={type:"failed"}),r(e)}))}void 0!==t&&(t.isLoadingPersistentSession||t.isGeneratingRequest)?t.closingStatus={type:"awaiting",start:i}:i()})));case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),e}();function Zl(e){return Jl.apply(this,arguments)}function Jl(){return(Jl=qe(Qe().mark((function e(t){return Qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return ne.debug("DRM: Trying to close a MediaKeySession",t.sessionId),e.prev=1,e.next=4,Kl(t);case 4:return ne.debug("DRM: Succeeded to close MediaKeySession"),e.abrupt("return");case 8:return e.prev=8,e.t0=e.catch(1),ne.error("DRM: Could not close MediaKeySession: "+(e.t0 instanceof Error?e.t0.toString():"Unknown error")),e.abrupt("return");case 12:case"end":return e.stop()}}),e,null,[[1,8]])})))).apply(this,arguments)}function ed(e){for(var t=0,n=0;n<e.length;n++)t=(t<<5)-t+e[n],t&=t;return t}var td=function(){function e(e){this.initData=e}return e.prototype.toJSON=function(){return Fa(this.initData)},e.decode=function(e){return za(e)},e}();function nd(e,t){var n,r;return null!==(r=null!==(n=rd(e,t))&&void 0!==n?n:rd(t,e))&&void 0!==r&&r}function rd(e,t){if(0===e.length)return!1;if(t.length<e.length)return null;for(var n=e[0],r=0,i=0;i<t.length;i++){var a=t[i];if(a.systemId===n.systemId){if(a.hash!==n.hash)return!1;if(!on(n.data instanceof Uint8Array?n.data:"string"==typeof n.data?td.decode(n.data):n.data.initData,a.data instanceof Uint8Array?a.data:"string"==typeof a.data?td.decode(a.data):a.data.initData))return!1;if(t.length-i<e.length)return null;for(r=1;r<e.length;r++){var o=e[r];for(i+=1;i<t.length;i++){var s=t[i];if(o.systemId===s.systemId){if(o.hash!==s.hash)return!1;if(!on(o.data instanceof Uint8Array?o.data:"string"==typeof o.data?td.decode(o.data):o.data.initData,s.data instanceof Uint8Array?s.data:"string"==typeof s.data?td.decode(s.data):s.data.initData))return!1;break}}if(r===t.length)return null}return!0}}return null}function id(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return ad(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ad(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ad(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function od(e){!function(e,t,n){for(var r in void 0===n&&(n="object"),Ee(h(e)),t)t.hasOwnProperty(r)&&Ee((e[r],t[r]),t[r])}(e,{save:"function",load:"function"},"persistentLicenseConfig")}var sd=function(){function e(e){od(e),this._entries=[],this._storage=e;try{var t=this._storage.load();Array.isArray(t)||(t=[]),this._entries=t}catch(e){ne.warn("DRM-PSS: Could not get entries from license storage",e instanceof Error?e:""),this.dispose()}}var t=e.prototype;return t.getLength=function(){return this._entries.length},t.getAll=function(){return this._entries},t.get=function(e){var t=this._getIndex(e);return-1===t?null:this._entries[t]},t.getAndReuse=function(e){var t=this._getIndex(e);if(-1===t)return null;var n=this._entries.splice(t,1)[0];return this._entries.push(n),n},t.add=function(e,t,n){var r;if(!h(n)&&p(n.sessionId)){var i=n.sessionId,a=this._getIndex(e);if(a>=0){var o=void 0===t?3:4,s=this._entries[a];if((null!==(r=s.version)&&void 0!==r?r:-1)>=o&&i===s.sessionId)return;ne.info("DRM-PSS: Updating session info.",i),this._entries.splice(a,1)}else ne.info("DRM-PSS: Add new session",i);var u=e.values.getFormattedValues().map((function(e){var t=e.systemId,n=e.data;return{systemId:t,hash:e.hash,data:new td(n)}}));void 0===t?this._entries.push({version:3,sessionId:i,values:u,initDataType:e.type}):this._entries.push({version:4,sessionId:i,keyIds:t.map((function(e){return new td(e)})),values:u,initDataType:e.type}),this._save()}else ne.warn("DRM-PSS: Invalid Persisten Session given.")},t.delete=function(e){for(var t=-1,n=0;n<this._entries.length;n++){if(this._entries[n].sessionId===e){t=n;break}}if(-1!==t){var r=this._entries[t];ne.warn("DRM-PSS: Delete session from store",r.sessionId),this._entries.splice(t,1),this._save()}else ne.warn("DRM-PSS: initData to delete not found.")},t.deleteOldSessions=function(e){ne.info("DRM-PSS: Deleting last "+e+" sessions."),e<=0||(e<=this._entries.length?this._entries.splice(0,e):(ne.warn("DRM-PSS: Asked to remove more information that it contains",e,this._entries.length),this._entries=[]),this._save())},t.dispose=function(){this._entries=[],this._save()},t._getIndex=function(e){var t=this,n=null;function r(){if(null===n){var t=e.values.constructRequestData();n={initData:t,initDataHash:ed(t)}}return n}for(var i,a=function(){var n=t._entries[o];if(n.initDataType===e.type)switch(n.version){case 4:if(void 0!==e.keyIds){if(e.keyIds.every((function(e){for(var t,r=Fa(e),i=id(n.keyIds);!(t=i()).done;){var a=t.value;if("string"==typeof a){if(r===a)return!0}else if(on(a.initData,e))return!0}return!1})))return{v:o}}else if(nd(e.values.getFormattedValues(),n.values))return{v:o};break;case 3:if(nd(e.values.getFormattedValues(),n.values))return{v:o};break;case 2:var i=r(),a=i.initData,s=i.initDataHash;if(n.initDataHash===s)try{if(on("string"==typeof n.initData?td.decode(n.initData):n.initData.initData,a))return{v:o}}catch(e){ne.warn("DRM-PSS: Could not decode initialization data.",e instanceof Error?e:"")}break;case 1:var u=r(),l=u.initData,d=u.initDataHash;if(n.initDataHash===d){if(void 0===n.initData.length)return{v:o};if(on(n.initData,l))return{v:o}}break;default:var c=r().initDataHash;if(n.initData===c)return{v:o}}},o=0;o<this._entries.length;o++)if(i=a())return i.v;return-1},t._save=function(){try{this._storage.save(this._entries)}catch(t){var e=t instanceof Error?t:void 0;ne.warn("DRM-PSS: Could not save MediaKeySession information",e)}},e}();var ud=new WeakMap,ld={prepare:function(e){ud.set(e,null)},set:function(e,t){var n=t instanceof Uint8Array?t:new Uint8Array(t instanceof ArrayBuffer?t:t.buffer),r=ed(n);ud.set(e,{hash:r,serverCertificate:n})},hasOne:function(e){var t=ud.get(e);return void 0!==t&&(null!==t||void 0)},has:function(e,t){var n=ud.get(e);if(null==n)return!1;var r=n.hash,i=n.serverCertificate,a=t instanceof Uint8Array?t:new Uint8Array(t instanceof ArrayBuffer?t:t.buffer);if(ed(a)!==r||i.length!==a.length)return!1;for(var o=0;o<i.length;o++)if(i[o]!==a[o])return!1;return!0}};function dd(e){if(h(e.persistentLicenseConfig))return null;var t=e.persistentLicenseConfig;if(null==t)throw new fe("INVALID_KEY_SYSTEM","No `persistentLicenseConfig` found for persistent license.");return ne.debug("DRM: Set the given license storage"),new sd(t)}function cd(e,t,n){return fd.apply(this,arguments)}function fd(){return(fd=qe(Qe().mark((function e(t,n,r){var i,a,o,s,u,l,d,c,f,v;return Qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ul(t,n,r);case 2:if(i=e.sent,null===r.cancellationError){e.next=5;break}throw r.cancellationError;case 5:if(a=i.value,o=a.options,s=a.mediaKeySystemAccess,u=Ze.getState(t),l=dd(o),J||ee||null===u||"reuse-media-key-system-access"!==i.type){e.next=12;break}if(d=u.mediaKeys,c=u.loadedSessionsStore,!1!==ld.hasOne(d)&&(h(o.serverCertificate)||!ld.has(d,o.serverCertificate))){e.next=12;break}return e.abrupt("return",{mediaKeys:d,mediaKeySystemAccess:s,stores:{loadedSessionsStore:c,persistentSessionsStore:l},options:o});case 12:return e.next=14,vd(s);case 14:return f=e.sent,ne.info("DRM: MediaKeys created with success"),v=new Xl(f),e.abrupt("return",{mediaKeys:f,mediaKeySystemAccess:s,stores:{loadedSessionsStore:v,persistentSessionsStore:l},options:o});case 18:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function vd(e){return pd.apply(this,arguments)}function pd(){return(pd=qe(Qe().mark((function e(t){var n,r;return Qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return ne.info("DRM: Calling createMediaKeys on the MediaKeySystemAccess"),e.prev=1,e.next=4,t.createMediaKeys();case 4:return n=e.sent,e.abrupt("return",n);case 8:throw e.prev=8,e.t0=e.catch(1),r=e.t0 instanceof Error?e.t0.message:"Unknown error when creating MediaKeys.",new fe("CREATE_MEDIA_KEYS_ERROR",r);case 12:case"end":return e.stop()}}),e,null,[[1,8]])})))).apply(this,arguments)}function hd(){return(hd=qe(Qe().mark((function e(t,n,r){var i,a;return Qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,cd(t,n,r);case 2:return i=e.sent,a=i.mediaKeys,null!==t.mediaKeys&&void 0!==t.mediaKeys&&a!==t.mediaKeys&&(ne.debug("DRM: Disabling old MediaKeys"),wl(t)),e.abrupt("return",i);case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var md=function(e){function t(n){var r;return r=e.call(this)||this,Object.setPrototypeOf(ie(r),t.prototype),r.reason=n,r}return s(t,e),t}(se(Error)),gd={EXPIRED:"expired",INTERNAL_ERROR:"internal-error",OUTPUT_RESTRICTED:"output-restricted"};function yd(e,t,n){var r,i=t.onKeyInternalError,a=t.onKeyOutputRestricted,o=t.onKeyExpiration,s=[],u=[],l=[];return e.keyStatuses.forEach((function(e,t){var r="string"==typeof e?[e,t]:[t,e],d=r[0],c=function(e,t){return-1!==e.indexOf("playready")&&(q||j)?Ra(t):t}(n,new Uint8Array(r[1])),f={keyId:c.buffer,keyStatus:d};switch(ne.hasLevel("DEBUG")&&ne.debug("DRM: key status update ("+Ia(c)+"): "+d),d){case gd.EXPIRED:var v=new fe("KEY_STATUS_CHANGE_ERROR","A decryption key expired ("+Ia(c)+")",{keyStatuses:[f].concat(l)});if("error"===o||void 0===o)throw v;switch(o){case"close-session":throw new md(v);case"fallback":s.push(c);break;default:"continue"===o||void 0===o?u.push(c):ke()}l.push(f);break;case gd.INTERNAL_ERROR:var p=new fe("KEY_STATUS_CHANGE_ERROR",'A "'+d+'" status has been encountered ('+Ia(c)+")",{keyStatuses:[f].concat(l)});switch(i){case void 0:case"error":throw p;case"close-session":throw new md(p);case"fallback":s.push(c);break;case"continue":u.push(c);break;default:if(void 0===i)throw p;ke()}l.push(f);break;case gd.OUTPUT_RESTRICTED:var h=new fe("KEY_STATUS_CHANGE_ERROR",'A "'+d+'" status has been encountered ('+Ia(c)+")",{keyStatuses:[f].concat(l)});switch(a){case void 0:case"error":throw h;case"fallback":s.push(c);break;case"continue":u.push(c);break;default:if(void 0===a)throw h;ke()}l.push(f);break;default:u.push(c)}})),l.length>0&&(r=new fe("KEY_STATUS_CHANGE_ERROR","One or several problematic key statuses have been encountered",{keyStatuses:l})),{warning:r,blacklistedKeyIds:s,whitelistedKeyIds:u}}var _d=L,bd=N,Sd=U;function Ed(e,t,n,r,i){ne.info("DRM: Binding session events",e.sessionId);var a=t.getLicenseConfig,o=void 0===a?{}:a,s=new Ge;return s.linkToSignal(i),h(e.closed)||e.closed.then((function(){return s.cancel()})).catch((function(e){i.isCancelled()||(s.cancel(),r.onError(e))})),_d(e,(function(e){s.cancel(),r.onError(new fe("KEY_ERROR",e.type))}),s.signal),Sd(e,(function(){try{u()}catch(e){if(i.isCancelled()||s.isUsed()&&e instanceof We)return;s.cancel(),r.onError(e)}}),s.signal),bd(e,(function(n){var i,a=n,u=new Uint8Array(a.message),l=p(a.messageType)?a.messageType:"license-request";ne.info("DRM: Received message event, type "+l,e.sessionId),function(e,t,n){var r=t.baseDelay,i=t.maxDelay,a=t.totalRetry,o=t.shouldRetry,s=t.onRetry,u=0;return l();function l(){return d.apply(this,arguments)}function d(){return(d=qe(Qe().mark((function t(){var d,c,f,v;return Qe().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null===n.cancellationError){t.next=2;break}throw n.cancellationError;case 2:return t.prev=2,t.next=5,e();case 5:return d=t.sent,t.abrupt("return",d);case 9:if(t.prev=9,t.t0=t.catch(2),null===n.cancellationError){t.next=13;break}throw n.cancellationError;case 13:if(!(!h(o)&&!o(t.t0)||u++>=a)){t.next=15;break}throw t.t0;case 15:return"function"==typeof s&&s(t.t0,u),c=Math.min(r*Math.pow(2,u-1),i),f=xn(c),t.next=20,$e(f);case 20:return v=l(),t.abrupt("return",v);case 22:case"end":return t.stop()}}),t,null,[[2,9]])})))).apply(this,arguments)}}((function(){return function(e,n){var r;return new Promise((function(i,a){try{ne.debug("DRM: Calling `getLicense`",n);var s=t.getLicense(e,n),u=h(o.timeout)?1e4:o.timeout;u>=0&&(r=setTimeout((function(){a(new Ad('"getLicense" timeout exceeded ('+u+" ms)"))}),u)),Promise.resolve(s).then(l,d)}catch(e){d(e)}function l(e){void 0!==r&&clearTimeout(r),i(e)}function d(e){void 0!==r&&clearTimeout(r),a(e)}}))}(u,l)}),{totalRetry:null!=(i=o.retry)?i:2,baseDelay:200,maxDelay:3e3,shouldRetry:function(e){return e instanceof Ad||h(e)||!0!==e.noRetry},onRetry:function(e){return r.onWarning(Td(e))}},s.signal).then((function(t){if(s.isUsed())return Promise.resolve();if(h(t))ne.info("DRM: No license given, skipping session.update");else try{return function(e,t){return kd.apply(this,arguments)}(e,t)}catch(e){s.cancel(),r.onError(e)}})).catch((function(e){if(!s.isUsed()){s.cancel();var t=Td(e);if(!h(e))if(!0===e.fallbackOnLastTry)return ne.warn("DRM: Last `getLicense` attempt failed. Blacklisting the current session."),void r.onError(new wd(t));r.onError(t)}}))}),s.signal),void u();function u(){if(ne.info("DRM: keystatuseschange event received",e.sessionId),!s.isUsed()&&0!==e.keyStatuses.size){var i=yd(e,t,n),a=i.warning,o=i.blacklistedKeyIds,u=i.whitelistedKeyIds;void 0!==a&&(r.onWarning(a),s.isUsed())||r.onKeyUpdate({whitelistedKeyIds:u,blacklistedKeyIds:o})}}}function Td(e){if(e instanceof Ad)return new fe("KEY_LOAD_TIMEOUT","The license server took too much time to respond.");var t=new fe("KEY_LOAD_ERROR","An error occured when calling `getLicense`.");return!h(e)&&p(e.message)&&(t.message=e.message),t}function kd(){return(kd=qe(Qe().mark((function e(t,n){var r;return Qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return ne.info("DRM: Updating MediaKeySession with message"),e.prev=1,e.next=4,t.update(n);case 4:e.next=10;break;case 6:throw e.prev=6,e.t0=e.catch(1),r=e.t0 instanceof Error?e.t0.toString():"`session.update` failed",new fe("KEY_UPDATE_ERROR",r);case 10:ne.info("DRM: MediaKeySession update succeeded.");case 11:case"end":return e.stop()}}),e,null,[[1,6]])})))).apply(this,arguments)}var wd=function(e){function t(n){var r;return r=e.call(this)||this,Object.setPrototypeOf(ie(r),t.prototype),r.sessionError=n,r}return s(t,e),t}(se(Error)),Ad=function(e){function t(t){var n;return n=e.call(this)||this,Object.setPrototypeOf(ie(n),wd.prototype),n.message=t,n}return s(t,e),t}(se(Error));function Id(e,t){return Rd.apply(this,arguments)}function Rd(){return(Rd=qe(Qe().mark((function e(t,n){var r,i;return Qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t.setServerCertificate(n);case 3:return r=e.sent,e.abrupt("return",r);case 7:throw e.prev=7,e.t0=e.catch(0),ne.warn("DRM: mediaKeys.setServerCertificate returned an error",e.t0 instanceof Error?e.t0:""),i=e.t0 instanceof Error?e.t0.toString():"`setServerCertificate` error",new fe("LICENSE_SERVER_CERTIFICATE_ERROR",i);case 12:case"end":return e.stop()}}),e,null,[[0,7]])})))).apply(this,arguments)}function xd(e,t){return Md.apply(this,arguments)}function Md(){return(Md=qe(Qe().mark((function e(t,n){var r,i;return Qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!0!==ld.hasOne(t)){e.next=3;break}return ne.info("DRM: The MediaKeys already has a server certificate, skipping..."),e.abrupt("return",{type:"already-has-one"});case 3:if("function"==typeof t.setServerCertificate){e.next=6;break}return ne.warn("DRM: Could not set the server certificate. mediaKeys.setServerCertificate is not a function"),e.abrupt("return",{type:"method-not-implemented"});case 6:return ne.info("DRM: Setting server certificate on the MediaKeys"),ld.prepare(t),e.prev=8,e.next=11,Id(t,n);case 11:return r=e.sent,ld.set(t,n),e.abrupt("return",{type:"success",value:r});case 16:return e.prev=16,e.t0=e.catch(8),i=me(e.t0)?e.t0:new fe("LICENSE_SERVER_CERTIFICATE_ERROR","Unknown error when setting the server certificate."),e.abrupt("return",{type:"error",value:i});case 20:case"end":return e.stop()}}),e,null,[[8,16]])})))).apply(this,arguments)}function Cd(e,t){if(!(isNaN(t)||t<0||t>=e.getLength())){var n=e.getLength(),r=n-t;ne.info("DRM: Too many stored persistent sessions, removing some.",n,r),e.deleteOldSessions(r)}}var Pd=function(){function e(e){this._innerValues=e,this._lazyFormattedValues=null}var t=e.prototype;return t.constructRequestData=function(){return $i.apply(void 0,this._innerValues.map((function(e){return e.data})))},t.isCompatibleWith=function(t){var n=t instanceof e?t.getFormattedValues():t;return nd(this.getFormattedValues(),n)},t.getFormattedValues=function(){return null===this._lazyFormattedValues&&(this._lazyFormattedValues=this._innerValues.slice().sort((function(e,t){return e.systemId===t.systemId?0:void 0===e.systemId?1:void 0===t.systemId||e.systemId<t.systemId?-1:1})).map((function(e){var t=e.systemId,n=e.data;return{systemId:t,data:n,hash:ed(n)}}))),this._lazyFormattedValues},e}();function Dd(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Nd(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Nd(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Nd(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Od=function(e){function t(t,n){var r;r=e.call(this)||this,ne.debug("DRM: Starting ContentDecryptor logic.");var i=new Ge;return r._currentSessions=[],r._canceller=i,r._initDataQueue=[],r._stateData={state:mi.Initializing,isMediaKeysAttached:0,isInitDataQueueLocked:!0,data:null},r.error=null,Sl.onEncrypted(t,(function(e){ne.debug("DRM: Encrypted event received from media element.");var t=kl(e);null!==t&&r.onInitializationData(t)}),i.signal),function(e,t,n){return hd.apply(this,arguments)}(t,n,i.signal).then((function(e){var n,i,a=e.options,o=e.mediaKeySystemAccess;(h(a.persistentLicenseConfig)||!0===a.persistentLicenseConfig.disableRetroCompatibility)&&(n=Wr(i=o.keySystem,"com.microsoft.playready")||"com.chromecast.playready"===i||"com.youtube.playready"===i?"9a04f07998404286ab92e65be0885f95":"com.widevine.alpha"===i?"edef8ba979d64acea3c827dcd51d21ed":Wr(i,"com.apple.fps")?"94ce86fb07ff4f43adb893d2fa968ca2":Wr(i,"com.nagra.")?"adb41c242dbf4a6d958b4457c0d27b95":void 0),r.systemId=n,r._stateData.state===mi.Initializing&&(r._stateData={state:mi.WaitingForAttachment,isInitDataQueueLocked:!0,isMediaKeysAttached:0,data:{mediaKeysInfo:e,mediaElement:t}},r.trigger("stateChange",r._stateData.state))})).catch((function(e){r._onFatalError(e)})),r}s(t,e),t.hasEmeApis=function(){return!h(Sl.requestMediaKeySystemAccess)};var n=t.prototype;return n.getState=function(){return this._stateData.state},n.attach=function(){var e=this;if(this._stateData.state!==mi.WaitingForAttachment)throw new Error("`attach` should only be called when in the WaitingForAttachment state");if(0===this._stateData.isMediaKeysAttached){var t=this._stateData.data,n=t.mediaElement,r=t.mediaKeysInfo,i=r.options,a=r.mediaKeys,o=r.mediaKeySystemAccess,s=r.stores;if(!(!0===i.disableMediaKeysAttachmentLock)||(this._stateData={state:mi.ReadyForContent,isInitDataQueueLocked:!0,isMediaKeysAttached:1,data:{mediaKeysInfo:r,mediaElement:n}},this.trigger("stateChange",this._stateData.state),!this._isStopped())){this._stateData.isMediaKeysAttached=1;var u={emeImplementation:Sl,loadedSessionsStore:s.loadedSessionsStore,mediaKeySystemAccess:o,mediaKeys:a,keySystemOptions:i};ne.debug("DRM: Attaching current MediaKeys"),function(e,t,n){return Al.apply(this,arguments)}(n,u,this._canceller.signal).then(qe(Qe().mark((function t(){var n,o,s;return Qe().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e._stateData.isMediaKeysAttached=2,h(n=i.serverCertificate)){t.next=7;break}return t.next=5,xd(a,n);case 5:"error"===(o=t.sent).type&&e.trigger("warning",o.value);case 7:if(!e._isStopped()){t.next=9;break}return t.abrupt("return");case 9:s=e._stateData.state,e._stateData={state:mi.ReadyForContent,isMediaKeysAttached:2,isInitDataQueueLocked:!1,data:{mediaKeysData:r}},s!==mi.ReadyForContent&&e.trigger("stateChange",mi.ReadyForContent),e._isStopped()||e._processCurrentInitDataQueue();case 13:case"end":return t.stop()}}),t)})))).catch((function(t){e._onFatalError(t)}))}}else ne.warn("DRM: ContentDecryptor's `attach` method called more than once.")},n.dispose=function(){this.removeEventListener(),this._stateData={state:mi.Disposed,isMediaKeysAttached:void 0,isInitDataQueueLocked:void 0,data:null},this._canceller.cancel(),this.trigger("stateChange",this._stateData.state)},n.onInitializationData=function(e){var t=this;if(!1===this._stateData.isInitDataQueueLocked){var n=this._stateData.data.mediaKeysData,r=Object.assign(Object.assign({},e),{values:new Pd(e.values)});this._processInitializationData(r,n).catch((function(e){t._onFatalError(e)}))}else{if(this._isStopped())throw new Error("ContentDecryptor either disposed or stopped.");this._initDataQueue.push(e)}},n._processInitializationData=function(){var e=qe(Qe().mark((function e(t,n){var r,i,a,o,s,u,l,d,c,f,p,m,g,y,_,b,S,E,T,k,w,A,I,R,x,M,C,P,D,N,O,L,U,B=this;return Qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=n.mediaKeySystemAccess,i=n.stores,a=n.options,!this._tryToUseAlreadyCreatedSession(t,n)&&!this._isStopped()){e.next=3;break}return e.abrupt("return");case 3:if("content"!==a.singleLicensePer){e.next=15;break}if(void 0===(o=be(this._currentSessions,(function(e){return"created-session"===e.source})))){e.next=13;break}if(void 0!==(s=t.keyIds)){e.next=10;break}return void 0===t.content?ne.warn("DRM: Unable to fallback from a non-decipherable quality."):Bd(t.content.manifest,t),e.abrupt("return");case 10:return o.record.associateKeyIds(s),void 0!==t.content&&(ne.hasLevel("DEBUG")&&(u=s.reduce((function(e,t){return e+", "+Ia(t)}),""),ne.debug("DRM: Blacklisting new key ids",u)),Ud(t.content.manifest,[],s,[])),e.abrupt("return");case 13:e.next=42;break;case 15:if("periods"!==a.singleLicensePer||void 0===t.content){e.next=42;break}l=t.content.period,d=this._currentSessions.filter((function(e){return"created-session"===e.source})),Vd(c=new Set,l),f=Dd(d);case 21:if((p=f()).done){e.next=42;break}m=p.value,g=Array.from(c),y=0,_=g;case 25:if(!(y<_.length)){e.next=40;break}if(b=_[y],!m.record.isAssociatedWithKeyId(b)){e.next=37;break}m.record.associateKeyIds(c.values()),S=Qe().mark((function e(){var t;return Qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=T.value,m.keyStatuses.whitelisted.some((function(e){return on(e,t)}))||m.keyStatuses.blacklisted.some((function(e){return on(e,t)}))||m.keyStatuses.blacklisted.push(t);case 2:case"end":return e.stop()}}),e)})),E=Dd(g);case 31:if((T=E()).done){e.next=35;break}return e.delegateYield(S(),"t0",33);case 33:e.next=31;break;case 35:return Ud(t.content.manifest,m.keyStatuses.whitelisted,m.keyStatuses.blacklisted,[]),e.abrupt("return");case 37:y++,e.next=25;break;case 40:e.next=21;break;case 42:return this._lockInitDataQueue(),h(a.persistentLicenseConfig)?k="temporary":Ld(r)?k="persistent-license":(ne.warn('DRM: Cannot create "persistent-license" session: not supported'),k="temporary"),w=v.getCurrent(),A=w.EME_DEFAULT_MAX_SIMULTANEOUS_MEDIA_KEY_SESSIONS,I=w.EME_MAX_STORED_PERSISTENT_SESSION_INFORMATION,R="number"==typeof a.maxSessionCacheSize?a.maxSessionCacheSize:A,e.next=48,Dl(t,i,k,R,this._canceller.signal);case 48:if(x=e.sent,!this._isStopped()){e.next=51;break}return e.abrupt("return");case 51:if(M={record:x.value.keySessionRecord,source:x.type,keyStatuses:{whitelisted:[],blacklisted:[]},blacklistedSessionError:null},this._currentSessions.push(M),C=x.value,P=C.mediaKeySession,D=C.sessionType,N=!1,Ed(P,a,r.keySystem,{onKeyUpdate:function(e){var n=Fd(t,M.record,a.singleLicensePer,"created-session"===M.source,e.whitelistedKeyIds,e.blacklistedKeyIds);if(M.record.associateKeyIds(n.whitelisted),M.record.associateKeyIds(n.blacklisted),M.keyStatuses={whitelisted:n.whitelisted,blacklisted:n.blacklisted},0!==M.record.getAssociatedKeyIds().length&&"persistent-license"===D&&null!==i.persistentSessionsStore&&!N){var r=i.persistentSessionsStore;Cd(r,I-1),r.add(t,M.record.getAssociatedKeyIds(),P),N=!0}void 0!==t.content&&Ud(t.content.manifest,n.whitelisted,n.blacklisted,[]),B._unlockInitDataQueue()},onWarning:function(e){B.trigger("warning",e)},onError:function(e){var n;if(e instanceof md){ne.warn("DRM: A session's closing condition has been triggered"),B._lockInitDataQueue();var r=B._currentSessions.indexOf(M);return r>=0&&B._currentSessions.splice(r),void 0!==t.content&&Ud(t.content.manifest,[],[],M.record.getAssociatedKeyIds()),null===(n=i.persistentSessionsStore)||void 0===n||n.delete(P.sessionId),i.loadedSessionsStore.closeSession(P).catch((function(e){var t=e instanceof Error?e:"unknown error";ne.warn("DRM: failed to close expired session",t)})).then((function(){return B._unlockInitDataQueue()})).catch((function(e){return B._onFatalError(e)})),void(B._isStopped()||B.trigger("warning",e.reason))}if(e instanceof wd){if(M.blacklistedSessionError=e,void 0!==t.content){var a=t.content.manifest;ne.info("DRM: blacklisting Representations based on protection data."),Bd(a,t)}B._unlockInitDataQueue()}else B._onFatalError(e)}},this._canceller.signal),void 0!==a.singleLicensePer&&"init-data"!==a.singleLicensePer||this._unlockInitDataQueue(),"created-session"!==x.type){e.next=72;break}return O=t.values.constructRequestData(),e.prev=59,e.next=62,i.loadedSessionsStore.generateLicenseRequest(P,t.type,O);case 62:e.next=72;break;case 64:if(e.prev=64,e.t1=e.catch(59),null!==(L=i.loadedSessionsStore.getEntryForSession(P))&&"none"===L.closingStatus.type){e.next=71;break}return(U=this._currentSessions.indexOf(M))>=0&&this._currentSessions.splice(U,1),e.abrupt("return",Promise.resolve());case 71:throw new fe("KEY_GENERATE_REQUEST_ERROR",e.t1 instanceof Error?e.t1.toString():"Unknown error");case 72:return e.abrupt("return",Promise.resolve());case 73:case"end":return e.stop()}}),e,this,[[59,64]])})));return function(t,n){return e.apply(this,arguments)}}(),n._tryToUseAlreadyCreatedSession=function(e,t){var n=t.stores,r=t.options,i=be(this._currentSessions,(function(t){return t.record.isCompatibleWith(e)}));if(void 0===i)return!1;if(!h(i.blacklistedSessionError))return void 0===e.type||void 0===e.content?(ne.error("DRM: This initialization data has already been blacklisted but the current content is not known."),!0):(ne.info("DRM: This initialization data has already been blacklisted. Blacklisting the related content."),Bd(e.content.manifest,e),!0);if(void 0!==e.keyIds){var a;if(void 0===r.singleLicensePer||"init-data"===r.singleLicensePer){var o=i.keyStatuses.blacklisted;a=function(e,t){for(var n,r,i=function(){var e=r.value;if(t.some((function(t){return on(t,e)})))return{v:!0}},a=Gl(e);!(r=a()).done;)if(n=i())return n.v;return!1}(e.keyIds,o)}else{var s=i.keyStatuses.whitelisted;a=!jl(e.keyIds,s)}if(a)return void 0===e.content?(ne.error("DRM: Cannot forbid key id, the content is unknown."),!0):(ne.info("DRM: Current initialization data is linked to blacklisted keys. Marking Representations as not decipherable"),Ud(e.content.manifest,[],e.keyIds,[]),!0)}if(null!==n.loadedSessionsStore.reuse(e))return ne.debug("DRM: Init data already processed. Skipping it."),!0;var u=this._currentSessions.indexOf(i);return-1===u?ne.error("DRM: Unable to remove processed init data: not found."):(ne.debug("DRM: A session from a processed init data is not available anymore. Re-processing it."),this._currentSessions.splice(u,1)),!1},n._onFatalError=function(e){if(!this._canceller.isUsed()){var t=e instanceof Error?e:new he("NONE","Unknown decryption error");this.error=t,this._initDataQueue.length=0,this._stateData={state:mi.Error,isMediaKeysAttached:void 0,isInitDataQueueLocked:void 0,data:null},this._canceller.cancel(),this.trigger("error",t),this._stateData.state===mi.Error&&this.trigger("stateChange",this._stateData.state)}},n._isStopped=function(){return this._stateData.state===mi.Disposed||this._stateData.state===mi.Error},n._processCurrentInitDataQueue=function(){for(;!1===this._stateData.isInitDataQueueLocked;){var e=this._initDataQueue.shift();if(void 0===e)return;this.onInitializationData(e)}},n._lockInitDataQueue=function(){!1===this._stateData.isInitDataQueueLocked&&(this._stateData.isInitDataQueueLocked=!0)},n._unlockInitDataQueue=function(){2===this._stateData.isMediaKeysAttached?(this._stateData.isInitDataQueueLocked=!1,this._processCurrentInitDataQueue()):ne.error("DRM: Trying to unlock in the wrong state")},t}(we);function Ld(e){var t=e.getConfiguration().sessionTypes;return void 0!==t&&Se(t,"persistent-license")}function Ud(e,t,n,r){e.updateRepresentationsDeciperability((function(e){if(void 0===e.contentProtections)return e.decipherable;var i=e.contentProtections.keyIds;if(void 0!==i)for(var a,o=Dd(i);!(a=o()).done;){for(var s,u=a.value,l=Dd(n);!(s=l()).done;){if(on(s.value,u.keyId))return!1}for(var d,c=Dd(t);!(d=c()).done;){if(on(d.value,u.keyId))return!0}for(var f,v=Dd(r);!(f=v()).done;){if(on(f.value,u.keyId))return}}return e.decipherable}))}function Bd(e,t){e.updateRepresentationsDeciperability((function(e){var n,r;if(!1===e.decipherable)return!1;for(var i,a,o=function(){var e=a.value;if((void 0===t.type||e.type===t.type)&&t.values.getFormattedValues().every((function(t){return e.values.some((function(e){return(void 0===t.systemId||e.systemId===t.systemId)&&on(e.data,t.data)}))})))return{v:!1}},s=Dd(null!==(r=null===(n=e.contentProtections)||void 0===n?void 0:n.initData)&&void 0!==r?r:[]);!(a=s()).done;)if(i=o())return i.v;return e.decipherable}))}function Fd(e,t,n,r,i,a){for(var o,s,u=[].concat(i,a),l=function(){var e=s.value;u.some((function(t){return on(t,e)}))||(ne.hasLevel("DEBUG")&&ne.debug("DRM: KeySessionRecord's key missing in the license, blacklisting it",Ia(e)),u.push(e))},d=Dd(t.getAssociatedKeyIds());!(s=d()).done;)l();if(void 0!==n&&"init-data"!==n){var c=e.keyIds,f=e.content;if(void 0!==c){var v=c.filter((function(e){return!u.some((function(t){return on(t,e)}))}));v.length>0&&(ne.hasLevel("DEBUG")&&ne.debug("DRM: init data keys missing in the license, blacklisting them",v.map((function(e){return Ia(e)})).join(", ")),u.push.apply(u,v))}if(r&&void 0!==f)if("content"===n){for(var p,h=new Set,m=Dd(f.manifest.periods);!(p=m()).done;){Vd(h,p.value)}zd(h,u)}else if("periods"===n)for(var g,y=Dd(f.manifest.periods);!(g=y()).done;){var _=g.value,b=new Set;if(Vd(b,_),(null===(o=e.content)||void 0===o?void 0:o.period.id)===_.id)zd(b,u);else for(var S=Array.from(b),E=function(){var e=k[T];if(u.some((function(t){return on(t,e)})))return zd(b,u),1},T=0,k=S;T<k.length&&!E();T++);}}return{whitelisted:i,blacklisted:u.slice(i.length)}}function zd(e,t){for(var n=Array.from(e.values()),r=function(){var e=a[i];t.some((function(t){return on(t,e)}))||t.push(e)},i=0,a=n;i<a.length;i++)r()}function Vd(e,t){for(var n,r=Dd(t.getAdaptations());!(n=r()).done;)for(var i,a=Dd(n.value.representations);!(i=a()).done;){var o=i.value;if(void 0!==o.contentProtections&&void 0!==o.contentProtections.keyIds)for(var s,u=Dd(o.contentProtections.keyIds);!(s=u()).done;){var l=s.value;e.add(l.keyId)}}}var Kd=Od;function Gd(e){e.decrypt=Kd}function Wd(e,t){if(Y&&function(e,t){var n=e.activeCues;if(null===n)return!1;for(var r=0;r<n.length;r++)if(n[r]===t)return!0;return!1}(e,t)){var n=e.mode;e.mode="hidden";try{e.removeCue(t)}catch(e){ne.warn("Compat: Could not remove cue from text track.")}e.mode=n}else try{e.removeCue(t)}catch(e){ne.warn("Compat: Could not remove cue from text track.")}}var jd=function(){function e(){this._ranges=[],this.length=0}var t=e.prototype;return t.insert=function(e,t){Fe(this._ranges,{start:e,end:t}),this.length=this._ranges.length},t.remove=function(e,t){var n=[];e>0&&n.push({start:0,end:e}),t<1/0&&n.push({start:t,end:1/0}),this._ranges=Ve(this._ranges,n),this.length=this._ranges.length},t.start=function(e){if(e>=this._ranges.length)throw new Error("INDEX_SIZE_ERROR");return this._ranges[e].start},t.end=function(e){if(e>=this._ranges.length)throw new Error("INDEX_SIZE_ERROR");return this._ranges[e].end},e}();var Hd=function(e){function t(t){var n;ne.debug("NTSB: Creating NativeTextSegmentBuffer"),n=e.call(this)||this;var r=function(e){var t,n,r,i="subtitles";if(q){var a=e.textTracks.length;(n=a>0?e.textTracks[a-1]:e.addTextTrack(i)).mode=null!==(t=n.SHOWING)&&void 0!==t?t:"showing"}else r=document.createElement("track"),e.appendChild(r),n=r.track,r.kind=i,n.mode="showing";return{track:n,trackElement:r}}(t),i=r.track,a=r.trackElement;return n.bufferType="text",n._buffered=new jd,n._videoElement=t,n._track=i,n._trackElement=a,n}s(t,e);var n=t.prototype;return n.declareInitSegment=function(e){ne.warn("ISB: Declaring initialization segment for image SegmentBuffer",e)},n.freeInitSegment=function(e){ne.warn("ISB: Freeing initialization segment for image SegmentBuffer",e)},n.pushChunk=function(e){var t,n;if(ne.debug("NTSB: Appending new native text tracks"),null===e.data.chunk)return Promise.resolve();var r=e.data,i=r.timestampOffset,a=r.appendWindow,o=r.chunk,s=o.start,u=o.end,l=o.data,d=o.type,c=o.language,f=null!==(t=a[0])&&void 0!==t?t:0,v=null!==(n=a[1])&&void 0!==n?n:1/0;try{var p,h,m=function(e,t,n,r){ne.debug("NTSB: Finding parser for native text tracks:",e);var i=_e.nativeTextTracksParsers[e];if("function"!=typeof i)throw new Error("no parser found for the given text track");ne.debug("NTSB: Parser found, parsing...");var a=i(t,n,r);return ne.debug("NTSB: Parsed successfully!",a.length),a}(d,l,i,c);if(0!==f&&v!==1/0){for(var g=0;g<m.length&&m[g].endTime<=f;)g++;for(m.splice(0,g),g=0;g<m.length&&m[g].startTime<f;)m[g].startTime=f,g++;for(g=m.length-1;g>=0&&m[g].startTime>=v;)g--;for(m.splice(g,m.length),g=m.length-1;g>=0&&m[g].endTime>v;)m[g].endTime=v,g--}if(void 0!==s)p=Math.max(f,s);else{if(m.length<=0)return ne.warn("NTSB: Current text tracks have no cues nor start time. Aborting"),Promise.resolve();ne.warn("NTSB: No start time given. Guessing from cues."),p=m[0].startTime}if(void 0!==u)h=Math.min(v,u);else{if(m.length<=0)return ne.warn("NTSB: Current text tracks have no cues nor end time. Aborting"),Promise.resolve();ne.warn("NTSB: No end time given. Guessing from cues."),h=m[m.length-1].endTime}if(h<=p)return ne.warn("NTSB: Invalid text track appended: ","the start time is inferior or equal to the end time."),Promise.resolve();if(m.length>0){var y=m[0],_=this._track.cues;null!==_&&_.length>0&&y.startTime<_[_.length-1].startTime&&this._removeData(y.startTime,1/0);for(var b=0;b<m.length;b++)this._track.addCue(m[b])}this._buffered.insert(p,h),null!==e.inventoryInfos&&this._segmentInventory.insertChunk(e.inventoryInfos)}catch(e){return Promise.reject(e)}return Promise.resolve()},n.removeBuffer=function(e,t){return this._removeData(e,t),Promise.resolve()},n.endOfSegment=function(e){return this._segmentInventory.completeSegment(e,this._buffered),Promise.resolve()},n.getBufferedRanges=function(){return this._buffered},n.dispose=function(){ne.debug("NTSB: Aborting NativeTextSegmentBuffer"),this._removeData(0,1/0);var e=this._trackElement,t=this._videoElement;if(void 0!==e&&t.hasChildNodes())try{t.removeChild(e)}catch(e){ne.warn("NTSB: Can't remove track element from the video")}this._track.mode="disabled",void 0!==this._trackElement&&(this._trackElement.innerHTML="")},n._removeData=function(e,t){ne.debug("NTSB: Removing native text track data",e,t);var n=this._track,r=n.cues;if(null!==r)for(var i=r.length-1;i>=0;i--){var a=r[i],o=a.startTime,s=a.endTime;o>=e&&o<=t&&s<=t&&Wd(n,a)}this._buffered.remove(e,t)},t}(sr);var qd=Hd,Yd=/(\d+) (\d+)/;function Qd(e,t,n,r){for(var i,a={},o=e.slice(),s=function(){var e=t[u];if(void 0!==e){var i,s;if(e.nodeType===Node.ELEMENT_NODE)for(var l=e,d=0;d<=l.attributes.length-1;d++){var c=l.attributes[d],f=c.name;if("style"===f)i=c.value;else if("region"===f)s=c.value;else{var v=f.substring(4);if(Se(o,v)&&(a[v]=c.value,o.splice(d,1),0===o.length))return{v:a}}}if(p(i)){var h=be(n,(function(e){return e.id===i}));if(void 0!==h)for(var m=0;m<=o.length-1;m++){var g=o[m];if(!p(a[g])&&p(h.style[g])){if(a[g]=h.style[g],o.splice(m,1),0===o.length)return{v:a};m--}}}if(p(s)){var y=be(r,(function(e){return e.id===s}));if(void 0!==y)for(var _=0;_<=o.length-1;_++){var b=o[_];if(!p(a[b])&&p(y.style[b])){if(a[b]=y.style[b],o.splice(_,1),0===o.length)return{v:a};_--}}}}},u=0;u<=t.length-1;u++)if(i=s())return i.v;return a}function $d(e){if(e.nodeType!==Node.ELEMENT_NODE)return{};for(var t=e,n={},r=0;r<=t.attributes.length-1;r++){var i=t.attributes[r];if(Wr(i.name,"tts"))n[i.name.substring(4)]=i.value}return n}function Xd(e,t){if(!(e.parentNode instanceof Element))return[];return function e(n){var r=[];n.tagName.toLowerCase()===t.toLowerCase()&&r.push(n);var i=n.parentNode;return i instanceof Element&&r.push.apply(r,e(i)),r}(e.parentNode)}function Zd(e){var t=Xd(e,"div");if(0===t.length){var n=Xd(e,"tt:div");n.length>0&&(t=n)}return t}function Jd(e){return"br"===e.nodeName||"tt:br"===e.nodeName}function ec(e){return"span"===e.nodeName||"tt:span"===e.nodeName}var tc=["align","backgroundColor","color","direction","display","displayAlign","extent","fontFamily","fontSize","fontStyle","fontWeight","lineHeight","opacity","origin","overflow","padding","textAlign","textDecoration","textOutline","unicodeBidi","visibility","wrapOption","writingMode"];function nc(e,t){var n=[],r=(new DOMParser).parseFromString(e,"text/xml");if(null!=r){var i=r.getElementsByTagName("tt")[0];if(void 0===i)if(void 0===(i=r.getElementsByTagNameNS("*","tt")[0]))throw new Error("invalid XML");for(var a=function(e){var t=e.getElementsByTagName("body");if(t.length>0)return t[0];var n=e.getElementsByTagName("tt:body");return n.length>0?n[0]:null}(i),o=function(e){var t=e.getElementsByTagName("style");if(t.length>0)return t;var n=e.getElementsByTagName("tt:style");return n.length>0?n:t}(i),s=function(e){var t=e.getElementsByTagName("region");if(t.length>0)return t;var n=e.getElementsByTagName("tt:region");return n.length>0?n:t}(i),u=function(e){var t=e.getElementsByTagName("p");if(t.length>0)return t;var n=e.getElementsByTagName("tt:p");return n.length>0?n:t}(i),d=function(e){var t=e.getAttribute("ttp:frameRate"),n=e.getAttribute("ttp:subFramRate"),r=e.getAttribute("ttp:tickRate"),i=e.getAttribute("ttp:frameRateMultiplier"),a=e.getAttribute("xml:space"),o=e.getAttribute("ttp:cellResolution"),s={columns:32,rows:15};if(null!==o){var u=Yd.exec(o);if(null===u||u.length<3)ne.warn("TTML Parser: Invalid cellResolution");else{var l=parseInt(u[1],10),d=parseInt(u[2],10);isNaN(l)||isNaN(d)?ne.warn("TTML Parser: Invalid cellResolution"):s={columns:l,rows:d}}}if(p(a)&&"default"!==a&&"preserve"!==a)throw new Error("Invalid spacing style");var c=Number(t);(isNaN(c)||c<=0)&&(c=30);var f=Number(n);(isNaN(f)||f<=0)&&(f=1);var v=Number(r);(isNaN(v)||v<=0)&&(v=void 0);var h=c,m=null!=f?f:1,g=null!==a?a:"default",y=void 0!==v?v:c*f;if(null!==i){var _=/^(\d+) (\d+)$/g.exec(i);null!==_&&(h=c*(Number(_[1])/Number(_[2])))}return{cellResolution:s,tickRate:y,frameRate:h,subFrameRate:m,spaceStyle:g}}(i),c=[],f=0;f<=o.length-1;f++){var v=o[f];if(v instanceof Element){var h=v.getAttribute("xml:id");if(null!==h){var m=v.getAttribute("style"),y=null===m?[]:m.split(" ");c.push({id:h,style:$d(v),extendsStyles:y})}}}!function(e){var t=[];function n(r,i){t.push(i);for(var a=function(){var i=r.extendsStyles[o],a=g(e,(function(e){return e.id===i}));if(a<0)ne.warn("TTML Parser: unknown style inheritance: "+i);else{var s=e[a];Se(t,a)?ne.warn("TTML Parser: infinite style inheritance loop avoided"):n(s,a),r.style=l({},s.style,r.style)}},o=0;o<r.extendsStyles.length;o++)a();r.extendsStyles.length=0}for(var r=0;r<e.length;r++)n(e[r],r),t.length=0}(c);for(var _=[],b=function(){var e=s[S];if(e instanceof Element){var t=e.getAttribute("xml:id");if(null!==t){var n=$d(e),r=e.getAttribute("style");if(p(r)){var i=be(c,(function(e){return e.id===r}));void 0!==i&&(n=l({},i.style,n))}_.push({id:t,style:n,extendsStyles:[]})}}},S=0;S<=s.length-1;S++)b();for(var E=Qd(tc,null!==a?[a]:[],c,_),T="default"===(null!==a?a.getAttribute("xml:space"):void 0)||"default"===d.spaceStyle,k=0;k<u.length;k++){var w=u[k];if(w instanceof Element){var A=Zd(w),I=l({},E,Qd(tc,[w].concat(A),c,_)),R=w.getAttribute("xml:space"),x=p(R)?"default"===R:T,M={paragraph:w,timeOffset:t,idStyles:c,regionStyles:_,body:a,paragraphStyle:I,ttParams:d,shouldTrimWhiteSpace:x};null!==M&&n.push(M)}}}return n}function rc(e,t,n){if(e>=t)return ne.warn("Compat: Invalid cue times: "+e+" - "+t),null;if(h(w.VTTCue)){if(h(w.TextTrackCue))throw new Error("VTT cues not supported in your target");return new TextTrackCue(e,t,n)}return new VTTCue(e,t,n)}function ic(e){return"function"==typeof w.VTTCue&&e instanceof w.VTTCue}var ac=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,oc=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,sc=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,uc=/^(\d*\.?\d*)f$/,lc=/^(\d*\.?\d*)t$/,dc=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/,cc=/^(\d{1,2}|100)% (\d{1,2}|100)%$/,fc=/^((?:\+|\-)?\d*(?:\.\d+)?)(px|em|c|%|rh|rw)$/,vc=/^#([0-9A-f]{2})([0-9A-f]{2})([0-9A-f]{2})([0-9A-f]{2})$/,pc=/^#([0-9A-f])([0-9A-f])([0-9A-f])([0-9A-f])$/,hc=/^rgb\( *(\d+) *, *(\d+) *, *(\d+) *\)/,mc=/^rgba\( *(\d+) *, *(\d+) *, *(\d+) *, *(\d+) *\)/;function gc(e,t){var n=e.exec(t);if(null===n||""===n[0])return null;var r=Number(n[1]);isNaN(r)&&(r=0);var i=Number(n[2]);isNaN(i)&&(i=0);var a=Number(n[3]);isNaN(a)&&(a=0);var o=Number(n[4]);return isNaN(o)&&(o=0),o/1e3+a+60*i+3600*r}var yc=function(e,t){return ac.test(e)?function(e,t){var n=ac.exec(t),r=Number(n[1]),i=Number(n[2]),a=Number(n[3]),o=Number(n[4]),s=Number(n[5]);isNaN(s)&&(s=0);return o+=s/e.subFrameRate,a+=o/e.frameRate,a+60*i+3600*r}(t,e):oc.test(e)?gc(oc,e):sc.test(e)?gc(sc,e):uc.test(e)?function(e,t){var n=uc.exec(t);return Number(n[1])/e.frameRate}(t,e):lc.test(e)?function(e,t){var n=lc.exec(t);return Number(n[1])/e.tickRate}(t,e):dc.test(e)?gc(dc,e):void 0};function _c(e,t){var n=e.getAttribute("begin"),r=e.getAttribute("dur"),i=e.getAttribute("end"),a=p(n)?yc(n,t):null,o=p(r)?yc(r,t):null,s=p(i)?yc(i,t):null;if(null==a||null==s&&null==o)throw new Error("Invalid text cue");return{start:a,end:null==s?a+o:s}}var bc={left:"start",center:"center",right:"end",start:"start",end:"end"},Sc={left:"line-left",center:"center",right:"line-right"};function Ec(e){var t=e.paragraph,n=e.timeOffset,r=e.paragraphStyle,i=e.ttParams,a=e.shouldTrimWhiteSpace;if(!t.hasAttribute("begin")&&!t.hasAttribute("end")&&/^\s*$/.test(null===t.textContent?"":t.textContent))return null;var o=_c(t,i),s=o.start,u=o.end,l=function(e,t){function n(e,t){for(var r=e.childNodes,i="",a=0;a<r.length;a++){var o=r[a];if("#text"===o.nodeName){var s=o.textContent;if(null===s&&(s=""),t){var u=s.trim();s=u=u.replace(/\s+/g," ")}i+=s.replace(/&|\u0026/g,"&amp;").replace(/<|\u003C/g,"&lt;").replace(/>|\u2265/g,"&gt;").replace(/\u200E/g,"&lrm;").replace(/\u200F/g,"&rlm;").replace(/\u00A0/g,"&nbsp;")}else if(Jd(o))i+="\n";else if(ec(o)&&o.nodeType===Node.ELEMENT_NODE&&o.childNodes.length>0){var l=o.getAttribute("xml:space");i+=n(o,p(l)?"default"===l:t)}}return i}return n(e,t)}(t,a),d=rc(s+n,u+n,l);return null===d?null:(ic(d)&&function(e,t){var n=t.extent;if(p(n)){var r=cc.exec(n);null!=r&&(e.size=Number(r[1]))}switch(t.writingMode){case"tb":case"tblr":e.vertical="lr";break;case"tbrl":e.vertical="rl"}var i=t.origin;if(p(i))cc.exec(i);var a=t.align;if(p(a)){e.align=a,"center"===a&&("center"!==e.align&&(e.align="middle"),e.position="auto");var o=Sc[a];e.positionAlign=void 0===o?"":o;var s=bc[a];e.lineAlign=void 0===s?"":s}}(d,r),d)}var Tc=function(e,t){for(var n=nc(e,t),r=[],i=0;i<n.length;i++){var a=Ec(n[i]);null!==a&&r.push(a)}return r};function kc(e){e.nativeTextTracksParsers.ttml=Tc,e.nativeTextTracksBuffer=qd}var wc=/&#([0-9]+);/g,Ac=/<br>/gi,Ic=/<style[^>]*>([\s\S]*?)<\/style[^>]*>/i,Rc=/\s*<p (?:class=([^>]+))?>(.*)/i,xc=/<sync[^>]+?start="?([0-9]*)"?[^0-9]/i;function Mc(e,t){var n=new RegExp("\\s*"+t+":\\s*(\\S+);","i").exec(e);return Array.isArray(n)?n[1]:null}var Cc=function(e,t,n){var r,i,a=/<sync[ >]/gi,o=/<sync[ >]|<\/body>/gi,s=[],u=Ic.exec(e),l=null!==u?u[1]:"";o.exec(e);var d,c=function(e){for(var t=/\.(\S+)\s*{([^}]*)}/gi,n={},r=t.exec(e);Array.isArray(r);){var i=r[1],a=Mc(r[2],"lang");null!=i&&null!=a&&(n[a]=i),r=t.exec(e)}return n}(l);if(p(n)&&void 0===(d=c[n]))throw new Error("sami: could not find lang "+n+" in CSS");for(;r=a.exec(e),i=o.exec(e),null!==r||null!==i;){if(null===r||null===i||r.index>=i.index)throw new Error("parse error");var f=e.slice(r.index,i.index),v=xc.exec(f);if(null===v)throw new Error("parse error (sync time attribute)");var h=+v[1];if(isNaN(h))throw new Error("parse error (sync time attribute NaN)");m(f.split("\n"),h/1e3)}return function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n],i=r.start,a=r.end,o=r.text;if(p(o)&&null!=a){var s=rc(i,a,o);null!=s&&t.push(s)}}return t}(s);function m(e,n){for(var r,i,a=e.length;--a>=0;)if(null!==(r=Rc.exec(e[a]))){var o=r,u=o[1],l=o[2];d===u&&("&nbsp;"===l?s[s.length-1].end=n:s.push({text:(i=l,i.replace(Ac,"\n").replace(wc,(function(e,t){return String.fromCharCode(Number(t))}))),start:n+t}))}}};function Pc(e){e.nativeTextTracksParsers.sami=Cc,e.nativeTextTracksBuffer=qd}function Dc(e){for(var t=0;t<e.length;){if(""===e[t])return t+1;t++}return t}function Nc(e,t){return"string"==typeof e[t]&&/^STYLE( .*)?$/g.test(e[t])&&(void 0===e[t+1]||e[t+1].indexOf("--\x3e")<0)}function Oc(e,t){var n=e[t];if(void 0===n||""===n||Nc(e,t)||function(e,t){return"string"==typeof e[t]&&/^REGION( .*)?$/g.test(e[t])&&(void 0===e[t+1]||e[t+1].indexOf("--\x3e")<0)}(e,t)||function(e,t){return"string"==typeof e[t]&&/^NOTE( .*)?$/g.test(e[t])&&(void 0===e[t+1]||e[t+1].indexOf("--\x3e")<0)}(e,t))return!1;if(n.indexOf("--\x3e")>=0)return!0;var r=e[t+1];return void 0!==r&&r.indexOf("--\x3e")>=0}function Lc(e,t){for(var n=t+1;p(e[n]);)n++;return n}function Uc(e,t){for(var n=[],r=t;r<e.length;r++)if(Oc(e,r)){var i=Lc(e,r);n.push(e.slice(r,i)),r=i}else if(p(e[r]))for(;p(e[r]);)r++;return n}function Bc(e){var t=e.split(":").reverse();if(p(t[2])||p(t[1])){var n=p(t[2])?parseInt(t[2],10):0,r=parseInt(t[1],10),i=parseFloat(t[0].replace(",","."));if(isNaN(n)||isNaN(r)||isNaN(i))return;return 60*n*60+60*r+i}}function Fc(e,t){var n,r,i,a=/-->/;if(a.test(e[0]))n=e[0],r=e.slice(1,e.length);else{if(!a.test(e[1]))return null;i=e[0],n=e[1],r=e.slice(2,e.length)}var o=function(e){var t=/^([\d:.]+)[ |\t]+-->[ |\t]+([\d:.]+)[ |\t]*(.*)$/.exec(e);if(null===t)return null;var n=Bc(t[1]),r=Bc(t[2]);return null==n||null==r?null:{start:n,end:r,settings:t[3].split(/ |\t/).reduce((function(e,t){var n=t.split(":");return 2===n.length&&(e[n[0]]=n[1]),e}),{})}}(n);return null===o?null:{start:o.start+t,end:o.end+t,settings:o.settings,payload:r,header:i}}function zc(e,t){if(!p(e.vertical)||"rl"!==e.vertical&&"lr"!==e.vertical||(t.vertical=e.vertical),p(e.line)){var n=/^(\d+(\.\d+)?)%(,([a-z]+))?/.exec(e.line);if(Array.isArray(n))t.line=Number(n[1]),t.snapToLines=!1,Se(["start","center","end"],n[4])&&(t.lineAlign=n[4]);else{var r=/^(-?\d+)(,([a-z]+))?/.exec(e.line);Array.isArray(r)&&(t.line=Number(r[1]),t.snapToLines=!0,Se(["start","center","end"],r[3])&&(t.lineAlign=r[3]))}}if(p(e.position)){var i=/^([\d\.]+)%(?:,(line-left|line-right|center))?$/.exec(e.position);if(Array.isArray(i)&&i.length>=2){var a=parseInt(i[1],10);isNaN(a)||(t.position=a,void 0!==i[2]&&(t.positionAlign=i[2]))}}p(e.size)&&(t.size=e.size),"string"==typeof e.align&&Se(["start","center","end","left"],e.align)&&(t.align=e.align)}var Vc=function(e,t){var n=e.split(/\r\n|\n|\r/);if(!/^WEBVTT($| |\t)/.test(n[0]))throw new Error("Can't parse WebVTT: Invalid file.");for(var r,i=Uc(n,Dc(n)),a=[],o=0;o<i.length;o++){var s=Fc(i[o],t);if(null!=s){var u=rc((r=s).start,r.end,r.payload.join("\n"));null!=u&&(ic(u)&&zc(s.settings,u),a.push(u))}}return a};function Kc(e){e.nativeTextTracksParsers.vtt=Vc,e.nativeTextTracksBuffer=qd}function Gc(e,t){for(var n=t+1;p(e[n]);)n++;return n}function Wc(e){for(var t=[],n=0;n<e.length;n++)if(p(e[n])){var r=Gc(e,n),i=e.slice(n,r);i.length>0&&(1===i.length?i[0].indexOf("--\x3e")>=0&&t.push(i):(i[1].indexOf("--\x3e")>=0||i[0].indexOf("--\x3e")>=0)&&t.push(i)),n=r}return t}function jc(e){var t=e.split(":");if(p(t[2])){var n=parseInt(t[0],10),r=parseInt(t[1],10),i=parseFloat(t[2].replace(",","."));if(isNaN(n)||isNaN(r)||isNaN(i))return;return 60*n*60+60*r+i}}function Hc(e,t){if(0===e.length)return null;var n,r,i=[];if(p(e[1])&&-1!==e[1].indexOf("--\x3e")){var a=e[1].split("--\x3e").map((function(e){return e.trim()}));n=a[0],r=a[1],i=e.slice(2,e.length)}if(!p(n)||!p(r)){var o=e[0].split("--\x3e").map((function(e){return e.trim()}));n=o[0],r=o[1],i=e.slice(1,e.length)}if(!p(n)||!p(r))return null;var s=jc(n),u=jc(r);return void 0===s||void 0===u?null:{start:s+t,end:u+t,payload:i}}function qc(e,t){for(var n,r,i,a,o,s=Wc(e.split(/\r\n|\n|\r/)),u=[],l=0;l<s.length;l++){var d=Hc(s[l],t);if(null!==d){var c=(r=void 0,i=void 0,a=void 0,o=void 0,r=(n=d).start,i=n.end,a=n.payload,o=a.join("\n"),rc(r,i,o));null!==c&&u.push(c)}}return u}function Yc(e){e.nativeTextTracksParsers.srt=qc,e.nativeTextTracksBuffer=qd}var Qc=w.ResizeObserver;function $c(e,t){return Math.abs(e-t)<=.2}function Xc(e,t){for(var n=e.length-1;n>=0;n--){if(e[n].start<t)return e.slice(0,n+1)}return[]}function Zc(e,t){for(var n=0;n<e.length;n++){if(e[n].end>t)return e.slice(n,e.length)}return[]}function Jc(e,t,n){var r=Math.max(e.start,t),i=Xc(e.cues,t),a={start:e.start,end:r,cues:i},o=Math.min(n,e.end),s=Zc(e.cues,n);return[a,{start:o,end:e.end,cues:s}]}var ef=function(){function e(){this._cuesBuffer=[]}var t=e.prototype;return t.get=function(e){for(var t=this._cuesBuffer,n=[],r=t.length-1;r>=0;r--){var i=t[r];if(e<i.end&&e>=i.start){for(var a=i.cues,o=0;o<a.length;o++)e>=a[o].start&&e<a[o].end&&n.push(a[o].element);return n}}return[]},t.remove=function(e,t){for(var n=Math.max(e,t),r=this._cuesBuffer,i=0;i<r.length;i++)if(r[i].end>e){var a=r[i];if(a.start>=n)return;if(a.end>=n){if(e<=a.start)a.cues=Zc(a.cues,n),a.start=n;else{var o=Jc(a,e,n),s=o[0],u=o[1];this._cuesBuffer[i]=s,r.splice(i+1,0,u)}return}a.start>=e?(r.splice(i,1),i--):(a.cues=Xc(a.cues,e),a.end=Math.max(e,a.start))}},t.insert=function(e,t,n){var r=this._cuesBuffer,i={start:t,end:n,cues:e};function a(e){var t=r[e];void 0===t||$c(i.end,t.end)?r[e]=i:(t.start>=i.end||(t.cues=Zc(t.cues,i.end),t.start=i.end),r.splice(e,0,i))}for(var o=0;o<r.length;o++){var s=r[o];if(t<s.end){if($c(t,s.start)){if($c(n,s.end))return void(r[o]=i);if(n<s.end)return s.cues=Zc(s.cues,n),s.start=n,void r.splice(o,0,i);do{r.splice(o,1),s=r[o]}while(void 0!==s&&n>s.end);return void a(o)}if(t<s.start){if(n<s.start)return void r.splice(o,0,i);if($c(n,s.start))return s.start=n,void r.splice(o,0,i);if($c(n,s.end))return void r.splice(o,1,i);if(n<s.end)return s.cues=Zc(s.cues,n),s.start=n,void r.splice(o,0,i);do{r.splice(o,1),s=r[o]}while(void 0!==s&&n>s.end);return void a(o)}if($c(s.end,n))return s.cues=Xc(s.cues,t),s.end=t,void r.splice(o+1,0,i);if(s.end>n){var u=Jc(s,t,n),l=u[0],d=u[1];return this._cuesBuffer[o]=l,r.splice(o+1,0,i),void r.splice(o+2,0,d)}s.cues=Xc(s.cues,t),s.end=t;var c=o+1;for(s=r[c];void 0!==s&&n>s.end;)r.splice(c,1),s=r[c];return void a(c)}}r.push(i)},e}();function tf(e,t,n,r){for(var i=[t/n.columns,e/n.rows],a=r.getElementsByClassName("proportional-style"),o=0;o<a.length;o++){var s=a[o];if(s instanceof HTMLElement){var u=s.getAttribute("data-proportional-font-size");null===u||isNaN(+u)||(s.style.fontSize=String(+u*i[1])+"px");var l=s.getAttribute("data-proportional-width");null===l||isNaN(+l)||(s.style.width=String(+l*i[0])+"px");var d=s.getAttribute("data-proportional-height");null===d||isNaN(+d)||(s.style.height=String(+d*i[1])+"px");var c=s.getAttribute("data-proportional-line-height");null===c||isNaN(+c)||(s.style.lineHeight=String(+c*i[1])+"px");var f=s.getAttribute("data-proportional-left");null===f||isNaN(+f)||(s.style.left=String(+f*i[0])+"px");var v=s.getAttribute("data-proportional-top");null===v||isNaN(+v)||(s.style.top=String(+v*i[1])+"px");var p=s.getAttribute("data-proportional-padding-top");null===p||isNaN(+p)||(s.style.paddingTop=String(+p*i[1])+"px");var h=s.getAttribute("data-proportional-padding-bottom");null===h||isNaN(+h)||(s.style.paddingBottom=String(+h*i[1])+"px");var m=s.getAttribute("data-proportional-padding-left");null===m||isNaN(+m)||(s.style.paddingLeft=String(+m*i[0])+"px");var g=s.getAttribute("data-proportional-padding-right");null===g||isNaN(+g)||(s.style.paddingRight=String(+g*i[0])+"px")}}return a.length>0}var nf=z,rf=F,af=B;function of(e,t){try{e.removeChild(t)}catch(e){ne.warn("HTSB: Can't remove text track: not in the element.")}}function sf(e){var t=e.getAttribute("data-resolution-rows"),n=e.getAttribute("data-resolution-columns");if(null===t||null===n)return null;var r=parseInt(t,10),i=parseInt(n,10);return null===r||null===i?null:{rows:r,columns:i}}var uf=function(e){function t(t,n){var r;return ne.debug("HTSB: Creating HTMLTextSegmentBuffer"),(r=e.call(this)||this).bufferType="text",r._buffered=new jd,r._videoElement=t,r._textTrackElement=n,r._sizeUpdateCanceller=new Ge,r._canceller=new Ge,r._buffer=new ef,r._currentCues=[],r.autoRefreshSubtitles(r._canceller.signal),r}s(t,e);var n=t.prototype;return n.declareInitSegment=function(e){ne.warn("ISB: Declaring initialization segment for image SegmentBuffer",e)},n.freeInitSegment=function(e){ne.warn("ISB: Freeing initialization segment for image SegmentBuffer",e)},n.pushChunk=function(e){try{this.pushChunkSync(e)}catch(e){return Promise.reject(e)}return Promise.resolve()},n.removeBuffer=function(e,t){return this.removeBufferSync(e,t),Promise.resolve()},n.endOfSegment=function(e){return this._segmentInventory.completeSegment(e,this._buffered),Promise.resolve()},n.getBufferedRanges=function(){return this._buffered},n.dispose=function(){ne.debug("HTSB: Disposing HTMLTextSegmentBuffer"),this._disableCurrentCues(),this._buffer.remove(0,1/0),this._buffered.remove(0,1/0),this._canceller.cancel()},n.pushChunkSync=function(e){var t,n;ne.debug("HTSB: Appending new html text tracks");var r=e.data,i=r.timestampOffset,a=r.appendWindow,o=r.chunk;if(null!==o){var s,u,l=o.start,d=o.end,c=o.data,f=o.type,v=o.language,p=null!==(t=a[0])&&void 0!==t?t:0,h=null!==(n=a[1])&&void 0!==n?n:1/0,m=function(e,t,n,r){ne.debug("HTSB: Finding parser for html text tracks:",e);var i=_e.htmlTextTracksParsers[e];if("function"!=typeof i)throw new Error("no parser found for the given text track");ne.debug("HTSB: Parser found, parsing...");var a=i(t,n,r);return ne.debug("HTTB: Parsed successfully!",a.length),a}(f,c,i,v);if(0!==p&&h!==1/0){for(var g=0;g<m.length&&m[g].end<=p;)g++;for(m.splice(0,g),g=0;g<m.length&&m[g].start<p;)m[g].start=p,g++;for(g=m.length-1;g>=0&&m[g].start>=h;)g--;for(m.splice(g,m.length),g=m.length-1;g>=0&&m[g].end>h;)m[g].end=h,g--}if(void 0!==l)s=Math.max(p,l);else{if(m.length<=0)return void ne.warn("HTSB: Current text tracks have no cues nor start time. Aborting");ne.warn("HTSB: No start time given. Guessing from cues."),s=m[0].start}if(void 0!==d)u=Math.min(h,d);else{if(m.length<=0)return void ne.warn("HTSB: Current text tracks have no cues nor end time. Aborting");ne.warn("HTSB: No end time given. Guessing from cues."),u=m[m.length-1].end}u<=s?ne.warn("HTSB: Invalid text track appended: ","the start time is inferior or equal to the end time."):(null!==e.inventoryInfos&&this._segmentInventory.insertChunk(e.inventoryInfos),this._buffer.insert(m,s,u),this._buffered.insert(s,u))}},n.removeBufferSync=function(e,t){ne.debug("HTSB: Removing html text track data",e,t),this._buffer.remove(e,t),this._buffered.remove(e,t)},n._disableCurrentCues=function(){if(this._sizeUpdateCanceller.cancel(),this._currentCues.length>0){for(var e=0;e<this._currentCues.length;e++)of(this._textTrackElement,this._currentCues[e].element);this._currentCues=[]}},n._displayCues=function(e){if(!(this._currentCues.length===e.length&&this._currentCues.every((function(t,n){return t.element===e[n]})))){this._sizeUpdateCanceller.cancel();for(var t=0;t<this._currentCues.length;t++)of(this._textTrackElement,this._currentCues[t].element);this._currentCues=[];for(var n=0;n<e.length;n++){var r=e[n],i=sf(r);this._currentCues.push({element:r,resolution:i}),this._textTrackElement.appendChild(r)}var a=this._currentCues.filter((function(e){return null!==e.resolution}));if(a.length>0){this._sizeUpdateCanceller=new Ge,this._sizeUpdateCanceller.linkToSignal(this._canceller.signal);var o=v.getCurrent().TEXT_TRACK_SIZE_CHECKS_INTERVAL,s=function(e,t,n){var r=e.getBoundingClientRect(),i=r.height,a=r.width,o=new E({height:i,width:a},n),s=i,u=a;if(void 0!==Qc){var l=new Qc((function(e){if(0!==e.length){var t=e[0].contentRect,n=t.height,r=t.width;n===s&&r===u||(s=n,u=r,o.setValue({height:n,width:r}))}else ne.error("Compat: Resized but no observed element.")}));l.observe(e),n.register((function(){l.disconnect()}))}else{var d=setInterval((function(){var t=e.getBoundingClientRect(),n=t.height,r=t.width;n===s&&r===u||(s=n,u=r,o.setValue({height:n,width:r}))}),t);n.register((function(){clearInterval(d)}))}return o}(this._textTrackElement,o,this._sizeUpdateCanceller.signal);s.onUpdate((function(e){for(var t=e.height,n=e.width,r=0;r<a.length;r++){var i=a[r];tf(t,n,i.resolution,i.element)}}),{clearSignal:this._sizeUpdateCanceller.signal,emitCurrentValue:!0})}}},n.autoRefreshSubtitles=function(e){var t=this,n=null,r=v.getCurrent().MAXIMUM_HTML_TEXT_TRACK_UPDATE_INTERVAL,i=function(){a(),(n=new Ge).linkToSignal(e);var i=setInterval((function(){return t.refreshSubtitles()}),r);n.signal.register((function(){clearInterval(i)})),t.refreshSubtitles()};function a(){null!==n&&(n.cancel(),n=null)}af(this._videoElement,(function(){a(),t._disableCurrentCues()}),e),rf(this._videoElement,i,e),nf(this._videoElement,i,e),i()},n.refreshSubtitles=function(){var e,t=v.getCurrent().MAXIMUM_HTML_TEXT_TRACK_UPDATE_INTERVAL;e=this._videoElement.paused||this._videoElement.playbackRate<=0?this._videoElement.currentTime:Math.max(this._videoElement.currentTime+t/1e3/2,0);var n=this._buffer.get(e);0===n.length?this._disableCurrentCues():this._displayCues(n)},t}(sr);var lf,df=uf;function cf(e){return void 0===e.extent&&void 0===e.origin&&void 0===e.displayAlign&&void 0===e.display&&void 0===e.textAlign&&void 0===e.fontSize}function ff(e){e.extent="70% 20%",e.fontSize="1c",e.origin="15% 80%",e.displayAlign="before",e.textAlign="center"}function vf(e,t){(void 0===lf&&(lf=void 0!==e.classList&&"function"==typeof e.classList.add),lf)?e.classList.add(t):(" "+e.className+" ").indexOf(" "+t+" ")<0&&(e.className+=" "+t)}function pf(e,t){var n=t;return p(t)&&t.trim().endsWith("%")&&(n=t.trim().slice(0,-1),n=(parseInt(n,10)/100).toString()+"em"),"-1px -1px "+n+" "+e+",1px -1px "+n+" "+e+",-1px 1px "+n+" "+e+",1px 1px "+n+" "+e}function hf(e){var t;return null!=(t=vc.exec(e))?"rgba("+String(parseInt(t[1],16))+","+String(parseInt(t[2],16))+","+String(parseInt(t[3],16))+","+String(parseInt(t[4],16)/255)+")":null!=(t=pc.exec(e))?"rgba("+String(parseInt(t[1]+t[1],16))+","+String(parseInt(t[2]+t[2],16))+","+String(parseInt(t[3]+t[3],16))+","+String(parseInt(t[4]+t[4],16)/255)+")":null!=(t=hc.exec(e))?"rgb("+String(+t[1])+","+String(+t[2])+","+String(+t[3])+")":null!=(t=mc.exec(e))?"rgba("+String(+t[1])+","+String(+t[2])+","+String(+t[3])+","+String(+t[4]/255)+")":e}var mf=["color","direction","display","fontFamily","fontSize","fontStyle","fontWeight","textDecoration","textOutline","unicodeBidi","visibility","wrapOption"];function gf(e,t,n){var r=t.color;p(r)&&(e.style.color=hf(r));var i=t.backgroundColor;p(i)&&(e.style.backgroundColor=hf(i));var a=t.textOutline;if(p(a)){var o=a.trim().replace(/\s+/g," ").split(" "),s=o.length;if(3===s){var u=hf(o[0]),l=o[1];e.style.textShadow=pf(u,l)}else if(p(r)&&1===s){var d=o[0];e.style.textShadow=pf(r,d)}else if(2===s){var c=/^[#A-Z]/i.test(o[0]);if(c!==/^[0-9]/.test(o[0]))if(c){var f=hf(o[0]),v=o[1];e.style.textShadow=pf(f,v)}else if(p(r)){var h=o[0];e.style.textShadow=pf(r,h)}}}var m=t.textDecoration;if(p(m))switch(m){case"noUnderline":case"noLineThrough":case"noOverline":e.style.textDecoration="none";break;case"lineThrough":e.style.textDecoration="line-through";break;default:e.style.textDecoration=m}var g=t.fontFamily;if(p(g))switch(g){case"proportionalSansSerif":e.style.fontFamily="Arial, Helvetica, Liberation Sans, sans-serif";break;case"monospaceSansSerif":case"sansSerif":e.style.fontFamily="sans-serif";break;case"monospaceSerif":case"default":e.style.fontFamily="Courier New, Liberation Mono, monospace";break;case"proportionalSerif":e.style.fontFamily="serif";break;default:e.style.fontFamily=g}var y=t.fontStyle;p(y)&&(e.style.fontStyle=y);var _=t.fontWeight;p(_)&&(e.style.fontWeight=_);var b=t.fontSize;p(b)?function(e,t){var n=t.trim().split(" ");if(0!==n.length){var r=fc.exec(n[0]);if(null!==r)if("px"===r[2]||"em"===r[2])e.style.fontSize=r[1]+r[2];else if("c"===r[2])e.style.position="relative",vf(e,"proportional-style"),e.setAttribute("data-proportional-font-size",r[1]);else if("%"===r[2]){var i=Number(r[1]);isNaN(i)?ne.warn('TTML Parser: could not parse fontSize value "'+r[1]+'" into a number'):(e.style.position="relative",vf(e,"proportional-style"),e.setAttribute("data-proportional-font-size",String(i/100)))}else ne.warn("TTML Parser: unhandled fontSize unit:",r[2])}}(e,b):(vf(e,"proportional-style"),e.setAttribute("data-proportional-font-size","1"));var S=t.direction;p(S)&&(e.style.direction=S);var E=t.unicodeBidi;if(p(E))switch(E){case"bidiOverride":e.style.unicodeBidi="bidi-override";break;case"embed":e.style.unicodeBidi="embed";break;default:e.style.unicodeBidi="normal"}var T=t.visibility;p(T)&&(e.style.visibility=T),"none"===t.display&&(e.style.display="none");var k=t.wrapOption;e.style.whiteSpace="noWrap"===k?n?"nowrap":"pre":n?"normal":"pre-wrap"}function yf(e,t){e.style.color="white",e.style.position="absolute";var n=t.extent;p(n)&&function(e,t){var n=t.trim();if("auto"!==n){var r=n.split(" ");if(2===r.length){var i=fc.exec(r[0]),a=fc.exec(r[1]);null!==i&&null!==a&&("px"===i[2]||"%"===i[2]||"em"===i[2]?e.style.width=i[1]+i[2]:"c"===i[2]?(vf(e,"proportional-style"),e.setAttribute("data-proportional-width",i[1])):ne.warn("TTML Parser: unhandled extent unit:",i[2]),"px"===a[2]||"%"===a[2]||"em"===a[2]?e.style.height=a[1]+a[2]:"c"===a[2]?(vf(e,"proportional-style"),e.setAttribute("data-proportional-height",a[1])):ne.warn("TTML Parser: unhandled extent unit:",a[2]))}}}(e,n),p(t.writingMode);var r=t.overflow;e.style.overflow=p(r)?r:"hidden";var i=t.padding;p(i)&&function(e,t){var n=t.trim().split(" ");if(!(n.length<1)){var r=fc.exec(n[0]);if(null!==r){if("px"===r[2]||"%"===r[2]||"em"===r[2]){var i=r[1]+r[2];1===n.length?e.style.padding=i:2===n.length?(e.style.paddingTop=i,e.style.paddingBottom=i):e.style.paddingTop=i}else"c"===r[2]?(vf(e,"proportional-style"),1===n.length?(e.setAttribute("data-proportional-padding-top",r[1]),e.setAttribute("data-proportional-padding-bottom",r[1]),e.setAttribute("data-proportional-padding-left",r[1]),e.setAttribute("data-proportional-padding-right",r[1])):2===n.length?(e.setAttribute("data-proportional-padding-top",r[1]),e.setAttribute("data-proportional-padding-bottom",r[1])):e.setAttribute("data-proportional-padding-top",r[1])):ne.warn("TTML Parser: unhandled padding unit:",r[2]);if(1!==n.length){var a=fc.exec(n[1]);if(null!==a){if("px"===a[2]||"%"===a[2]||"em"===a[2]){var o=a[1]+a[2];n.length<4?(e.style.paddingLeft=o,e.style.paddingRight=o):e.style.paddingRight=o}else"c"===a[2]?(vf(e,"proportional-style"),n.length<4?(e.setAttribute("data-proportional-padding-left",a[1]),e.setAttribute("data-proportional-padding-right",a[1])):e.setAttribute("data-proportional-padding-right",a[1])):ne.warn("TTML Parser: unhandled padding unit:",a[2]);if(2!==n.length){var s=fc.exec(n[2]);if(null!==s){if("px"===s[2]||"%"===s[2]||"em"===s[2]){var u=s[1]+s[2];e.style.paddingBottom=u}else"c"===s[2]?(vf(e,"proportional-style"),e.setAttribute("data-proportional-padding-bottom",s[1])):ne.warn("TTML Parser: unhandled padding unit:",s[2]);if(3!==n.length){var l=fc.exec(n[3]);if(null!==l)if("px"===l[2]||"%"===l[2]||"em"===l[2]){var d=l[1]+l[2];e.style.paddingLeft=d}else"c"===l[2]?(vf(e,"proportional-style"),e.setAttribute("data-proportional-padding-left",l[1])):ne.warn("TTML Parser: unhandled padding unit:",l[2])}}}}}}}}(e,i);var a=t.origin;p(a)&&function(e,t){var n=t.trim();if("auto"!==n){var r=n.split(" ");if(2===r.length){var i=fc.exec(r[0]),a=fc.exec(r[1]);null!==i&&null!==a&&("px"===i[2]||"%"===i[2]||"em"===i[2]?e.style.left=i[1]+i[2]:"c"===i[2]?(vf(e,"proportional-style"),e.setAttribute("data-proportional-left",i[1])):ne.warn("TTML Parser: unhandled origin unit:",i[2]),"px"===a[2]||"%"===a[2]||"em"===a[2]?e.style.top=a[1]+a[2]:"c"===a[2]?(vf(e,"proportional-style"),e.setAttribute("data-proportional-top",a[1])):ne.warn("TTML Parser: unhandled origin unit:",a[2]))}}}(e,a);var o=t.displayAlign;if(p(o))switch(e.style.display="flex",e.style.flexDirection="column",o){case"before":e.style.justifyContent="flex-start";break;case"center":e.style.justifyContent="center";break;case"after":e.style.justifyContent="flex-end"}var s=t.opacity;p(s)&&(e.style.opacity=s);var u=t.visibility;p(u)&&(e.style.visibility=u),"none"===t.display&&(e.style.display="none")}function _f(e,t){e.style.margin="0px",vf(e,"proportional-style"),e.setAttribute("data-proportional-font-size","1");var n=t.backgroundColor;p(n)&&(e.style.backgroundColor=hf(n));var r=t.lineHeight;p(r)&&function(e,t){var n=t.trim();if("auto"!==n){var r=fc.exec(n[0]);null!==r&&("px"===r[2]||"%"===r[2]||"em"===r[2]?e.style.lineHeight=r[1]+r[2]:"c"===r[2]?(vf(e,"proportional-style"),e.setAttribute("data-proportional-line-height",r[1])):ne.warn("TTML Parser: unhandled lineHeight unit:",r[2]))}}(e,r);var i=t.textAlign;if(p(i))switch(i){case"center":e.style.textAlign="center";break;case"left":case"start":e.style.textAlign="left";break;case"right":case"end":e.style.textAlign="right"}}function bf(e,t,n){var r=document.createElement("span"),i=null===e.textContent?"":e.textContent;if(n){var a=i.trim();i=a=a.replace(/\s+/g," ")}var o=document.createTextNode(i);return r.appendChild(o),r.className="rxp-texttrack-span",gf(r,t,n),r}function Sf(e,t,n,r,i,a){var o=a.cellResolution,s=a.shouldTrimWhiteSpace,u=Zd(e),d=document.createElement("DIV");if(d.className="rxp-texttrack-region",d.setAttribute("data-resolution-columns",String(o.columns)),d.setAttribute("data-resolution-rows",String(o.rows)),yf(d,i),null!==t){var c=Qd(["backgroundColor"],[].concat(u,[t]),r,n).bodyBackgroundColor;p(c)&&(d.style.backgroundColor=hf(c))}var f=document.createElement("p");f.className="rxp-texttrack-p",_f(f,i);for(var v=function(e,t,n,r,i){return function e(r,i,a,o){for(var s=r.childNodes,u=[],d=0;d<s.length;d++){var c=s[d];if("#text"===c.nodeName){var f=Qd(["backgroundColor"],a,n,t).backgroundColor;p(f)?i.backgroundColor=f:delete i.backgroundColor;var v=bf(c,i,o);u.push(v)}else if(Jd(c)){var h=document.createElement("BR");u.push(h)}else if(ec(c)&&c.nodeType===Node.ELEMENT_NODE&&c.childNodes.length>0){var m=c.getAttribute("xml:space"),g=p(m)?"default"===m:o,y=l({},i,Qd(mf,[c],n,t));u.push.apply(u,e(c,y,[c].concat(a),g))}}return u}(e,l({},r),[],i)}(e,n,r,i,s),h=0;h<v.length;h++)f.appendChild(v[h]);return d.appendChild(f),d}function Ef(e){var t=e.paragraph,n=e.ttParams,r=e.body,i=e.regionStyles,a=e.idStyles,o=e.paragraphStyle,s=e.timeOffset,u=e.shouldTrimWhiteSpace;if(!t.hasAttribute("begin")&&!t.hasAttribute("end")&&/^\s*$/.test(null===t.textContent?"":t.textContent))return null;var l=n.cellResolution,d=_c(t,n);return{start:d.start+s,end:d.end+s,element:Sf(t,r,i,a,o,{cellResolution:l,shouldTrimWhiteSpace:u})}}var Tf=function(e,t){for(var n=nc(e,t),r=[],i=0;i<n.length;i++){var a=n[i].paragraphStyle;cf(a)&&ff(a);var o=Ef(n[i]);null!==o&&r.push(o)}return r};function kf(e){e.htmlTextTracksParsers.ttml=Tf,e.htmlTextTracksBuffer=df}var wf=/&#([0-9]+);/g,Af=/<br>/gi,If=/<style[^>]*>([\s\S]*?)<\/style[^>]*>/i,Rf=/\s*<p (?:class=([^>]+))?>(.*)/i,xf=/<sync[^>]+?start="?([0-9]*)"?[^0-9]/i;function Mf(e,t){var n=new RegExp("\\s*"+t+":\\s*(\\S+);","i").exec(e);return Array.isArray(n)?n[1]:null}var Cf=function(e,t,n){var r,i,a=/<sync[ >]/gi,o=/<sync[ >]|<\/body>/gi,s=[],u=If.exec(e),l=Array.isArray(u)?u[1]:"";o.exec(e);var d,c=function(e){for(var t=/\.(\S+)\s*{([^}]*)}/gi,n={},r=t.exec(e);null!==r;){var i=r[1],a=Mf(r[2],"lang");null!=i&&null!=a&&(n[a]=i),r=t.exec(e)}return n}(l),f=function(e){var t=/p\s*{([^}]*)}/gi.exec(e);return null===t?"":t[1]}(l);if(p(n)&&void 0===(d=c[n]))throw new Error("sami: could not find lang "+n+" in CSS");for(;r=a.exec(e),i=o.exec(e),null!==r||null!==i;){if(null===r||null===i||r.index>=i.index)throw new Error("parse error");var v=e.slice(r.index,i.index),h=xf.exec(v);if(!Array.isArray(h))throw new Error("parse error (sync time attribute)");var m=+h[1];if(isNaN(m))throw new Error("parse error (sync time attribute NaN)");g(v.split("\n"),m/1e3)}return s;function g(e,n){for(var r=e.length;--r>=0;){var i=Rf.exec(e[r]);if(Array.isArray(i)){var a=i[1],o=i[2];if(d===a)if("&nbsp;"===o)s[s.length-1].end=n;else{var u=document.createElement("DIV");u.className="rxp-texttrack-region";var l=document.createElement("DIV");l.className="rxp-texttrack-div",l.style.position="absolute",l.style.bottom="0",l.style.width="100%",l.style.color="#fff",l.style.textShadow="-1px -1px 0 #000,1px -1px 0 #000,-1px 1px 0 #000,1px 1px 0 #000";var c=document.createElement("div");c.className="rxp-texttrack-p",p(f)&&(c.style.cssText=f);for(var v=o.split(Af),h=0;h<v.length;h++){0!==h&&c.appendChild(document.createElement("BR"));var m=document.createElement("SPAN");m.className="rxp-texttrack-span",m.textContent=v[h].replace(wf,(function(e,t){return String.fromCharCode(Number(t))})),c.appendChild(m)}l.appendChild(c),u.appendChild(l),s.push({element:u,start:n+t,end:-1})}}}}};function Pf(e){e.htmlTextTracksParsers.sami=Cf,e.htmlTextTracksBuffer=df}var Df={white:"#ffffff",lime:"#00ff00",cyan:"#00ffff",red:"#ff0000",yellow:"#ffff00",magenta:"#ff00ff",blue:"#0000ff",black:"#000000"};function Nf(e){var t=Object.keys(Df).reduce((function(e,t){return e[t]="color: "+Df[t]+";",e["bg_"+t]="background-color: "+Df[t]+";",e}),{}),n="";return e.forEach((function(e){if(e.length>=2)for(var r=function(r){var a=e[r];if(Array.isArray(/::cue {/.exec(a)))for(a=e[++r];p(a)&&!Array.isArray(/}/.exec(a))&&0!==a.length;)n+=a,a=e[++r];else{for(var o=[],s=/::cue\(\.?(.*?)\)(?:,| {)/.exec(a);p(a)&&Array.isArray(s);)o.push(s[1]),a=e[++r],s=/::cue\(\.?(.*?)\)(?:,| {)/.exec(a);for(var u="";p(a)&&!Array.isArray(/}/.exec(a))&&0!==a.length;)u+=a,a=e[++r];o.forEach((function(e){void 0===t[e]?t[e]=u:t[e]+=u}))}i=r},i=1;i<e.length;i++)r(i)})),{classes:t,global:n}}function Of(e,t){var n,r=["u","i","b"],i=e.nodeName.toLowerCase().split(".")[0];if(Se(["u","i","b","c","#text"],i))if("#text"===i){var a=e.wholeText.split("\n");n=document.createElement("span");for(var o=0;o<a.length;o++)if(o>0&&n.appendChild(document.createElement("br")),a[o].length>0){var s=document.createTextNode(a[o]);n.appendChild(s)}}else{var u=e.nodeName.toLowerCase().split("."),l=[];if(u.forEach((function(e){p(t[e])&&l.push(t[e])})),0!==l.length){var d=document.createAttribute("style");l.forEach((function(e){d.value+=e}));var c=Se(r,i)?i:"span";(n=document.createElement(c)).setAttributeNode(d)}else{var f=Se(r,i)?i:"span";n=document.createElement(f)}for(var v=0;v<e.childNodes.length;v++){var h=Of(e.childNodes[v],t);n.appendChild(h)}}else{n=document.createElement("span");for(var m=0;m<e.childNodes.length;m++){var g=Of(e.childNodes[m],t);n.appendChild(g)}}return n}var Lf,Uf,Bf,Ff=function(e){if(!(void 0!==e&&0!==Gt(e).length))return"text-align:center";var t=zf(e),n=Gf(e);return"position: absolute;margin: 0;transform: translate("+t.offset+"%,"+n.offset+"%);width: "+qf(e.size)+"%;left: "+t.position+"%;top: "+(null!==n.position?n.position+"%":"auto")+";text-align: "+Hf(e.align)+";"};!function(e){e.LINE_LEFT="line-left",e.CENTER="center",e.LINE_RIGHT="line-right"}(Lf||(Lf={})),function(e){e.LEFT="left",e.CENTER="center",e.RIGHT="right"}(Uf||(Uf={})),function(e){e.START="start",e.CENTER="center",e.END="end"}(Bf||(Bf={}));var zf=function(e){return{position:Vf(e),offset:Kf(e)}},Vf=function(e){var t,n=Qf(e.position);if(null!==n)return n;var r=Hf(e.align);return((t={})[Uf.LEFT]=0,t[Uf.CENTER]=50,t[Uf.RIGHT]=100,t)[r]},Kf=function(e){var t,n,r,i,a=((t={})[Lf.LINE_LEFT]=0,t[Lf.CENTER]=-50,t[Lf.LINE_RIGHT]=-100,t),o=void 0!==e.position?(r=e.position,i=/,(line-left|line-right|center)/.exec(r),!Array.isArray(i)||i.length<2?null:i[1]):null;return null!==o?a[o]:((n={})[Uf.LEFT]=0,n[Uf.CENTER]=-50,n[Uf.RIGHT]=-100,n)[void 0!==e.align?Hf(e.align):Uf.CENTER]},Gf=function(e){return{position:Wf(e.line),offset:jf(e.line)}},Wf=function(e){return Qf(e)},jf=function(e){var t,n=((t={})[Bf.START]=0,t[Bf.CENTER]=-50,t[Bf.END]=-100,t);if(void 0===e)return n[Bf.START];var r,i=(r=/,(start|center|end)/.exec(e),!Array.isArray(r)||r.length<2?null:r[1]);return null!==i?n[i]:n[Bf.START]},Hf=function(e){switch(e){case"left":case"start":return"left";case"right":case"end":return"right";default:return"center"}},qf=function(e){return Yf(e,100)},Yf=function(e,t){var n=Qf(e);return null!==n?n:t},Qf=function(e){if(void 0===e)return null;var t=/^([\d.]+)%/.exec(e);return!Array.isArray(t)||t.length<2?null:parseInt(t[1],10)};function $f(e,t){var n=e.start,r=e.end,i=e.settings,a=e.header,o=e.payload,s=document.createElement("div"),u=document.createAttribute("style");u.value="width:100%;height:100%;display:flex;flex-direction:column;justify-content:flex-end;align-items:center;",s.setAttributeNode(u);var l=document.createElement("p"),d=function(e){var t=document.createAttribute("style");return t.value=Ff(e),t}(i);l.setAttributeNode(d);var c=document.createElement("span"),f=document.createAttribute("style");f.value="background-color:rgba(0,0,0,0.8);color:white;",c.setAttributeNode(f);var v=t.global,h=t.classes,m=[v,p(a)?h[a]:void 0].filter((function(e){return void 0!==e})).join("");return f.value+=m,c.setAttributeNode(f),function(e,t){for(var n=e.replace(/<[0-9]{2}:[0-9]{2}.[0-9]{3}>/,"").replace(/<([u,i,b,c])(\..*?)?(?: .*?)?>(.*?)<\/\1>/g,"<$1$2>$3</$1$2>"),r=(new DOMParser).parseFromString(n,"text/html").body.childNodes,i=[],a=0;a<r.length;a++)i.push(Of(r[a],t));return i}(o.join("\n"),h).forEach((function(e){c.appendChild(e)})),s.appendChild(l),l.appendChild(c),{start:n,end:r,element:s}}var Xf=function(e,t){var n=e.split(/\r\n|\n|\r/g),r=[];if(null===/^WEBVTT( |\t|\n|\r|$)/.exec(n[0]))throw new Error("Can't parse WebVTT: Invalid File.");for(var i=Dc(n),a=function(e,t){for(var n=[],r=t;r<e.length;r++)if(Nc(e,r)){var i=r;for(r++;p(e[r]);)r++;var a=e.slice(i,r);n.push(a)}else if(p(e[r]))for(;p(e[r]);)r++;return n}(n,i),o=Uc(n,i),s=Nf(a),u=0;u<o.length;u++){var l=Fc(o[u],t);if(null!=l){var d=$f(l,s);r.push(d)}}return r};function Zf(e){e.htmlTextTracksParsers.vtt=Xf,e.htmlTextTracksBuffer=df}function Jf(e,t){for(var n=Wc(e.split(/\r\n|\n|\r/)),r=[],i=0;i<n.length;i++){var a=Hc(n[i],t);if(null!=a){var o=ev(a);null!=o&&r.push(o)}}return r}function ev(e){var t=e.start,n=e.end,r=e.payload,i=document.createElement("div");i.className="rxp-texttrack-p",i.style.fontSize="28px",i.style.position="absolute",i.style.bottom="5%",i.style.width="100%",i.style.textAlign="center",i.style.color="#fff",i.style.textShadow="-1px -1px 2px #000,1px -1px 2px #000,-1px 1px 2px #000,1px 1px 2px #000";for(var a=0;a<r.length;a++){0!==a&&i.appendChild(document.createElement("br"));var o=tv(r[a]);i.appendChild(o)}return{start:t,end:n,element:i}}function tv(e){var t=document.createElement("div");t.innerHTML=e;return function e(t){var n=t.childNodes,r=document.createElement("span");r.className="rxp-texttrack-span";for(var i=0;i<n.length;i++){var a=n[i];if("#text"===a.nodeName){for(var o=a.wholeText.split("\n"),s=0;s<o.length;s++)if(0!==s&&r.appendChild(document.createElement("br")),o[s].length>0){var u=document.createTextNode(o[s]);r.appendChild(u)}}else if("B"===a.nodeName){var l=e(a);l.style.fontWeight="bold",r.appendChild(l)}else if("I"===a.nodeName){var d=e(a);d.style.fontStyle="italic",r.appendChild(d)}else if("U"===a.nodeName){var c=e(a);c.style.textDecoration="underline",r.appendChild(c)}else if(nv(a)&&"string"==typeof a.color){var f=e(a);f.style.color=a.color,r.appendChild(f)}else{var v=e(a);r.appendChild(v)}}return r}(t)}function nv(e){return"FONT"===e.nodeName&&"color"in e}function rv(e){e.htmlTextTracksParsers.srt=Jf,e.htmlTextTracksBuffer=df}Rt.addFeatures([Uo,Wu,el,Gd,kc,Pc,Kc,Yc,kf,Pf,Zf,rv]),"boolean"==typeof __RX_PLAYER_DEBUG_MODE__&&__RX_PLAYER_DEBUG_MODE__&&ne.setLevel("DEBUG");var iv=Rt}(),r=r.default}()}));