rx-player 4.0.0-dev.2023102700 → 4.0.0-dev.2023110700
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.
- package/.eslintrc.js +1 -1
- package/.github/workflows/checks.yml +2 -2
- package/.github/workflows/perfs.yml +1 -1
- package/CHANGELOG.md +8 -4
- package/FILES.md +1 -2
- package/VERSION +1 -1
- package/dist/_esm5.processed/compat/add_class_name.js +3 -6
- package/dist/_esm5.processed/compat/add_text_track.d.ts +3 -1
- package/dist/_esm5.processed/compat/add_text_track.js +14 -14
- package/dist/_esm5.processed/compat/browser_compatibility_types.d.ts +8 -0
- package/dist/_esm5.processed/compat/browser_compatibility_types.js +11 -16
- package/dist/_esm5.processed/compat/browser_detection.js +33 -49
- package/dist/_esm5.processed/compat/browser_version.js +8 -11
- package/dist/_esm5.processed/compat/can_patch_isobmff.js +3 -6
- package/dist/_esm5.processed/compat/can_rely_on_video_visibility_and_size.js +6 -9
- package/dist/_esm5.processed/compat/can_reuse_media_keys.js +3 -6
- package/dist/_esm5.processed/compat/change_source_buffer_type.js +3 -6
- package/dist/_esm5.processed/compat/clear_element_src.js +9 -12
- package/dist/_esm5.processed/compat/eme/close_session.js +106 -45
- package/dist/_esm5.processed/compat/eme/constants.js +3 -6
- package/dist/_esm5.processed/compat/eme/custom_key_system_access.js +22 -18
- package/dist/_esm5.processed/compat/eme/custom_media_keys/ie11_media_keys.js +102 -78
- package/dist/_esm5.processed/compat/eme/custom_media_keys/index.js +6 -16
- package/dist/_esm5.processed/compat/eme/custom_media_keys/moz_media_keys_constructor.js +24 -25
- package/dist/_esm5.processed/compat/eme/custom_media_keys/ms_media_keys_constructor.js +14 -14
- package/dist/_esm5.processed/compat/eme/custom_media_keys/old_webkit_media_keys.js +88 -70
- package/dist/_esm5.processed/compat/eme/custom_media_keys/types.js +1 -2
- package/dist/_esm5.processed/compat/eme/custom_media_keys/webkit_media_keys.js +117 -91
- package/dist/_esm5.processed/compat/eme/custom_media_keys/webkit_media_keys_constructor.js +16 -14
- package/dist/_esm5.processed/compat/eme/eme-api-implementation.js +82 -82
- package/dist/_esm5.processed/compat/eme/generate_key_request.js +31 -36
- package/dist/_esm5.processed/compat/eme/get_init_data.js +25 -28
- package/dist/_esm5.processed/compat/eme/get_uuid_kid_from_keystatus_kid.js +5 -8
- package/dist/_esm5.processed/compat/eme/get_webkit_fairplay_initdata.js +14 -17
- package/dist/_esm5.processed/compat/eme/index.js +7 -13
- package/dist/_esm5.processed/compat/eme/load_session.js +69 -26
- package/dist/_esm5.processed/compat/enable_audio_track.js +4 -7
- package/dist/_esm5.processed/compat/event_listeners.d.ts +16 -23
- package/dist/_esm5.processed/compat/event_listeners.js +149 -179
- package/dist/_esm5.processed/compat/fullscreen.d.ts +32 -0
- package/dist/_esm5.processed/compat/fullscreen.js +78 -0
- package/dist/_esm5.processed/compat/get_start_date.js +4 -7
- package/dist/_esm5.processed/compat/has_issues_with_high_media_source_duration.js +3 -6
- package/dist/_esm5.processed/compat/index.d.ts +3 -1
- package/dist/_esm5.processed/compat/index.js +26 -47
- package/dist/_esm5.processed/compat/is_codec_supported.js +5 -8
- package/dist/_esm5.processed/compat/is_debug_mode_enabled.js +1 -4
- package/dist/_esm5.processed/compat/is_node.d.ts +0 -1
- package/dist/_esm5.processed/compat/is_node.js +2 -6
- package/dist/_esm5.processed/compat/is_offline.d.ts +39 -0
- package/dist/_esm5.processed/compat/is_offline.js +43 -0
- package/dist/_esm5.processed/compat/is_seeking_approximate.js +3 -5
- package/dist/_esm5.processed/compat/is_vtt_cue.js +2 -6
- package/dist/_esm5.processed/compat/make_vtt_cue.js +6 -10
- package/dist/_esm5.processed/compat/on_height_width_change.js +27 -25
- package/dist/_esm5.processed/compat/patch_webkit_source_buffer.js +16 -19
- package/dist/_esm5.processed/compat/remove_cue.js +9 -12
- package/dist/_esm5.processed/compat/should_favour_custom_safari_EME.js +4 -7
- package/dist/_esm5.processed/compat/should_reload_media_source_on_decipherability_update.js +1 -4
- package/dist/_esm5.processed/compat/should_renew_media_key_system_access.js +3 -6
- package/dist/_esm5.processed/compat/should_unset_media_keys.js +3 -6
- package/dist/_esm5.processed/compat/should_validate_metadata.js +3 -6
- package/dist/_esm5.processed/compat/should_wait_for_data_before_loaded.js +3 -6
- package/dist/_esm5.processed/compat/should_wait_for_have_enough_data.js +3 -6
- package/dist/_esm5.processed/config.d.ts +22 -10
- package/dist/_esm5.processed/config.js +14 -15
- package/dist/_esm5.processed/core/adaptive/adaptive_representation_selector.d.ts +60 -3
- package/dist/_esm5.processed/core/adaptive/adaptive_representation_selector.js +140 -130
- package/dist/_esm5.processed/core/adaptive/buffer_based_chooser.d.ts +2 -2
- package/dist/_esm5.processed/core/adaptive/buffer_based_chooser.js +41 -43
- package/dist/_esm5.processed/core/adaptive/guess_based_chooser.js +43 -37
- package/dist/_esm5.processed/core/adaptive/index.js +2 -4
- package/dist/_esm5.processed/core/adaptive/network_analyzer.js +73 -75
- package/dist/_esm5.processed/core/adaptive/utils/bandwidth_estimator.js +23 -24
- package/dist/_esm5.processed/core/adaptive/utils/ewma.js +12 -13
- package/dist/_esm5.processed/core/adaptive/utils/filter_by_bitrate.js +6 -9
- package/dist/_esm5.processed/core/adaptive/utils/filter_by_width.d.ts +25 -0
- package/dist/_esm5.processed/core/adaptive/utils/filter_by_width.js +42 -0
- package/dist/_esm5.processed/core/adaptive/utils/get_buffer_levels.js +7 -10
- package/dist/_esm5.processed/core/adaptive/utils/last_estimate_storage.js +7 -8
- package/dist/_esm5.processed/core/adaptive/utils/pending_requests_store.d.ts +3 -13
- package/dist/_esm5.processed/core/adaptive/utils/pending_requests_store.js +23 -26
- package/dist/_esm5.processed/core/adaptive/utils/representation_score_calculator.js +23 -25
- package/dist/_esm5.processed/core/adaptive/utils/select_optimal_representation.d.ts +8 -2
- package/dist/_esm5.processed/core/adaptive/utils/select_optimal_representation.js +13 -7
- package/dist/_esm5.processed/core/api/debug/buffer_graph.js +40 -41
- package/dist/_esm5.processed/core/api/debug/buffer_size_graph.js +29 -31
- package/dist/_esm5.processed/core/api/debug/constants.js +1 -4
- package/dist/_esm5.processed/core/api/debug/index.js +2 -4
- package/dist/_esm5.processed/core/api/debug/modules/general_info.js +94 -67
- package/dist/_esm5.processed/core/api/debug/modules/segment_buffer_content.js +46 -49
- package/dist/_esm5.processed/core/api/debug/modules/segment_buffer_size.js +12 -15
- package/dist/_esm5.processed/core/api/debug/render.js +13 -16
- package/dist/_esm5.processed/core/api/debug/utils.js +13 -18
- package/dist/_esm5.processed/core/api/index.js +4 -7
- package/dist/_esm5.processed/core/api/option_utils.d.ts +36 -13
- package/dist/_esm5.processed/core/api/option_utils.js +283 -111
- package/dist/_esm5.processed/core/api/playback_observer.d.ts +2 -8
- package/dist/_esm5.processed/core/api/playback_observer.js +123 -135
- package/dist/_esm5.processed/core/api/public_api.d.ts +276 -115
- package/dist/_esm5.processed/core/api/public_api.js +1313 -973
- package/dist/_esm5.processed/core/api/tracks_management/media_element_track_choice_manager.d.ts +257 -0
- package/dist/_esm5.processed/core/api/tracks_management/media_element_track_choice_manager.js +805 -0
- package/dist/_esm5.processed/core/api/tracks_management/track_choice_manager.d.ts +258 -0
- package/dist/_esm5.processed/core/api/tracks_management/track_choice_manager.js +989 -0
- package/dist/_esm5.processed/core/api/utils.d.ts +0 -1
- package/dist/_esm5.processed/core/api/utils.js +32 -51
- package/dist/_esm5.processed/core/decrypt/__tests__/__global__/utils.js +185 -155
- package/dist/_esm5.processed/core/decrypt/attach_media_keys.js +81 -42
- package/dist/_esm5.processed/core/decrypt/clear_on_stop.js +12 -15
- package/dist/_esm5.processed/core/decrypt/content_decryptor.js +511 -393
- package/dist/_esm5.processed/core/decrypt/create_or_load_session.js +90 -44
- package/dist/_esm5.processed/core/decrypt/create_session.js +149 -90
- package/dist/_esm5.processed/core/decrypt/dispose_decryption_resources.js +67 -24
- package/dist/_esm5.processed/core/decrypt/find_key_system.js +193 -144
- package/dist/_esm5.processed/core/decrypt/get_key_system_configuration.d.ts +8 -0
- package/dist/_esm5.processed/core/decrypt/get_key_system_configuration.js +15 -6
- package/dist/_esm5.processed/core/decrypt/get_media_keys.js +110 -61
- package/dist/_esm5.processed/core/decrypt/index.d.ts +2 -2
- package/dist/_esm5.processed/core/decrypt/index.js +7 -26
- package/dist/_esm5.processed/core/decrypt/init_media_keys.js +59 -17
- package/dist/_esm5.processed/core/decrypt/session_events_listener.js +222 -89
- package/dist/_esm5.processed/core/decrypt/set_server_certificate.js +103 -50
- package/dist/_esm5.processed/core/decrypt/types.js +2 -5
- package/dist/_esm5.processed/core/decrypt/utils/are_init_values_compatible.js +19 -22
- package/dist/_esm5.processed/core/decrypt/utils/check_key_statuses.d.ts +1 -1
- package/dist/_esm5.processed/core/decrypt/utils/check_key_statuses.js +65 -79
- package/dist/_esm5.processed/core/decrypt/utils/clean_old_loaded_sessions.js +61 -17
- package/dist/_esm5.processed/core/decrypt/utils/clean_old_stored_persistent_info.js +5 -8
- package/dist/_esm5.processed/core/decrypt/utils/get_drm_system_id.js +5 -8
- package/dist/_esm5.processed/core/decrypt/utils/init_data_values_container.js +23 -23
- package/dist/_esm5.processed/core/decrypt/utils/is_session_usable.js +12 -15
- package/dist/_esm5.processed/core/decrypt/utils/key_id_comparison.js +21 -14
- package/dist/_esm5.processed/core/decrypt/utils/key_session_record.js +27 -26
- package/dist/_esm5.processed/core/decrypt/utils/loaded_sessions_store.js +310 -206
- package/dist/_esm5.processed/core/decrypt/utils/media_keys_infos_store.js +6 -8
- package/dist/_esm5.processed/core/decrypt/utils/persistent_sessions_store.d.ts +4 -4
- package/dist/_esm5.processed/core/decrypt/utils/persistent_sessions_store.js +103 -106
- package/dist/_esm5.processed/core/decrypt/utils/serializable_bytes.js +12 -13
- package/dist/_esm5.processed/core/decrypt/utils/server_certificate_store.js +16 -18
- package/dist/_esm5.processed/core/fetchers/cdn_prioritizer.js +56 -37
- package/dist/_esm5.processed/core/fetchers/index.js +3 -7
- package/dist/_esm5.processed/core/fetchers/manifest/index.js +2 -4
- package/dist/_esm5.processed/core/fetchers/manifest/manifest_fetcher.d.ts +3 -1
- package/dist/_esm5.processed/core/fetchers/manifest/manifest_fetcher.js +332 -234
- package/dist/_esm5.processed/core/fetchers/segment/index.js +2 -4
- package/dist/_esm5.processed/core/fetchers/segment/prioritized_segment_fetcher.js +9 -12
- package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.d.ts +9 -3
- package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.js +227 -219
- package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher_creator.d.ts +3 -1
- package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher_creator.js +19 -20
- package/dist/_esm5.processed/core/fetchers/segment/task_prioritizer.js +74 -73
- package/dist/_esm5.processed/core/fetchers/utils/error_selector.js +5 -8
- package/dist/_esm5.processed/core/fetchers/utils/schedule_request.d.ts +6 -1
- package/dist/_esm5.processed/core/fetchers/utils/schedule_request.js +297 -210
- package/dist/_esm5.processed/core/init/directfile_content_initializer.js +99 -73
- package/dist/_esm5.processed/core/init/index.js +1 -5
- package/dist/_esm5.processed/core/init/media_source_content_initializer.d.ts +8 -1
- package/dist/_esm5.processed/core/init/media_source_content_initializer.js +324 -256
- package/dist/_esm5.processed/core/init/types.d.ts +30 -6
- package/dist/_esm5.processed/core/init/types.js +24 -7
- package/dist/_esm5.processed/core/init/utils/content_time_boundaries_observer.js +135 -109
- package/dist/_esm5.processed/core/init/utils/create_media_source.js +30 -35
- package/dist/_esm5.processed/core/init/utils/create_stream_playback_observer.js +10 -12
- package/dist/_esm5.processed/core/init/utils/end_of_stream.js +26 -30
- package/dist/_esm5.processed/core/init/utils/get_initial_time.js +37 -41
- package/dist/_esm5.processed/core/init/utils/get_loaded_reference.js +10 -13
- package/dist/_esm5.processed/core/init/utils/initial_seek_and_play.js +26 -29
- package/dist/_esm5.processed/core/init/utils/initialize_content_decryption.js +27 -30
- package/dist/_esm5.processed/core/init/utils/media_source_duration_updater.js +60 -58
- package/dist/_esm5.processed/core/init/utils/rebuffering_controller.d.ts +3 -3
- package/dist/_esm5.processed/core/init/utils/rebuffering_controller.js +160 -141
- package/dist/_esm5.processed/core/init/utils/stream_events_emitter/are_same_stream_events.js +1 -3
- package/dist/_esm5.processed/core/init/utils/stream_events_emitter/index.js +2 -4
- package/dist/_esm5.processed/core/init/utils/stream_events_emitter/refresh_scheduled_events_list.js +30 -28
- package/dist/_esm5.processed/core/init/utils/stream_events_emitter/stream_events_emitter.js +90 -71
- package/dist/_esm5.processed/core/init/utils/stream_events_emitter/types.js +1 -2
- package/dist/_esm5.processed/core/init/utils/throw_on_media_error.js +13 -16
- package/dist/_esm5.processed/core/segment_buffers/garbage_collector.js +126 -75
- package/dist/_esm5.processed/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.js +147 -130
- package/dist/_esm5.processed/core/segment_buffers/implementations/audio_video/index.js +2 -4
- package/dist/_esm5.processed/core/segment_buffers/implementations/image/image_segment_buffer.d.ts +75 -0
- package/dist/_esm5.processed/core/segment_buffers/implementations/image/image_segment_buffer.js +133 -0
- package/dist/_esm5.processed/core/segment_buffers/implementations/image/index.d.ts +17 -0
- package/dist/_esm5.processed/core/segment_buffers/implementations/image/index.js +17 -0
- package/dist/_esm5.processed/core/segment_buffers/implementations/index.js +3 -20
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/html_text_segment_buffer.js +125 -106
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/index.js +2 -4
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/parsers.js +8 -11
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/text_track_cues_store.js +47 -48
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/types.js +1 -2
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/update_proportional_elements.js +15 -18
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/utils.js +15 -22
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/native/index.js +2 -4
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/native/native_text_segment_buffer.d.ts +2 -1
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/native/native_text_segment_buffer.js +83 -65
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/native/parsers.js +8 -11
- package/dist/_esm5.processed/core/segment_buffers/implementations/types.d.ts +2 -2
- package/dist/_esm5.processed/core/segment_buffers/implementations/types.js +17 -19
- package/dist/_esm5.processed/core/segment_buffers/implementations/utils/manual_time_ranges.js +22 -23
- package/dist/_esm5.processed/core/segment_buffers/index.d.ts +2 -2
- package/dist/_esm5.processed/core/segment_buffers/index.js +5 -13
- package/dist/_esm5.processed/core/segment_buffers/inventory/buffered_history.d.ts +2 -2
- package/dist/_esm5.processed/core/segment_buffers/inventory/buffered_history.js +22 -25
- package/dist/_esm5.processed/core/segment_buffers/inventory/index.d.ts +0 -1
- package/dist/_esm5.processed/core/segment_buffers/inventory/index.js +2 -8
- package/dist/_esm5.processed/core/segment_buffers/inventory/segment_inventory.js +150 -152
- package/dist/_esm5.processed/core/segment_buffers/inventory/types.js +1 -2
- package/dist/_esm5.processed/core/segment_buffers/segment_buffers_store.d.ts +1 -0
- package/dist/_esm5.processed/core/segment_buffers/segment_buffers_store.js +104 -83
- package/dist/_esm5.processed/core/stream/adaptation/adaptation_stream.d.ts +16 -1
- package/dist/_esm5.processed/core/stream/adaptation/adaptation_stream.js +144 -204
- package/dist/_esm5.processed/core/stream/adaptation/index.js +3 -19
- package/dist/_esm5.processed/core/stream/adaptation/types.d.ts +15 -37
- package/dist/_esm5.processed/core/stream/adaptation/types.js +1 -2
- package/dist/_esm5.processed/core/stream/adaptation/utils/create_representation_estimator.d.ts +47 -0
- package/dist/_esm5.processed/core/stream/adaptation/utils/create_representation_estimator.js +70 -0
- package/dist/_esm5.processed/core/stream/index.d.ts +3 -2
- package/dist/_esm5.processed/core/stream/index.js +2 -4
- package/dist/_esm5.processed/core/stream/orchestrator/get_time_ranges_for_content.js +16 -14
- package/dist/_esm5.processed/core/stream/orchestrator/index.js +2 -4
- package/dist/_esm5.processed/core/stream/orchestrator/stream_orchestrator.d.ts +0 -2
- package/dist/_esm5.processed/core/stream/orchestrator/stream_orchestrator.js +214 -223
- package/dist/_esm5.processed/core/stream/period/index.js +3 -19
- package/dist/_esm5.processed/core/stream/period/period_stream.js +201 -179
- package/dist/_esm5.processed/core/stream/period/types.d.ts +15 -6
- package/dist/_esm5.processed/core/stream/period/types.js +1 -2
- package/dist/_esm5.processed/core/stream/period/utils/get_adaptation_switch_strategy.d.ts +4 -2
- package/dist/_esm5.processed/core/stream/period/utils/get_adaptation_switch_strategy.js +73 -38
- package/dist/_esm5.processed/core/stream/representation/index.js +3 -19
- package/dist/_esm5.processed/core/stream/representation/representation_stream.d.ts +1 -1
- package/dist/_esm5.processed/core/stream/representation/representation_stream.js +86 -104
- package/dist/_esm5.processed/core/stream/representation/types.d.ts +5 -14
- package/dist/_esm5.processed/core/stream/representation/types.js +1 -2
- package/dist/_esm5.processed/core/stream/representation/utils/append_segment_to_buffer.js +84 -33
- package/dist/_esm5.processed/core/stream/representation/utils/check_for_discontinuity.js +29 -32
- package/dist/_esm5.processed/core/stream/representation/utils/downloading_queue.js +145 -126
- package/dist/_esm5.processed/core/stream/representation/utils/force_garbage_collection.js +88 -32
- package/dist/_esm5.processed/core/stream/representation/utils/get_buffer_status.js +48 -61
- package/dist/_esm5.processed/core/stream/representation/utils/get_needed_segments.js +69 -71
- package/dist/_esm5.processed/core/stream/representation/utils/get_segment_priority.js +5 -8
- package/dist/_esm5.processed/core/stream/representation/utils/push_init_segment.d.ts +2 -2
- package/dist/_esm5.processed/core/stream/representation/utils/push_init_segment.js +63 -22
- package/dist/_esm5.processed/core/stream/representation/utils/push_media_segment.d.ts +1 -1
- package/dist/_esm5.processed/core/stream/representation/utils/push_media_segment.js +86 -49
- package/dist/_esm5.processed/default_config.d.ts +103 -41
- package/dist/_esm5.processed/default_config.js +120 -46
- package/dist/_esm5.processed/errors/assertion_error.js +26 -10
- package/dist/_esm5.processed/errors/custom_loader_error.d.ts +3 -1
- package/dist/_esm5.processed/errors/custom_loader_error.js +30 -12
- package/dist/_esm5.processed/errors/encrypted_media_error.js +32 -16
- package/dist/_esm5.processed/errors/error_codes.js +4 -9
- package/dist/_esm5.processed/errors/error_message.d.ts +2 -1
- package/dist/_esm5.processed/errors/error_message.js +3 -5
- package/dist/_esm5.processed/errors/format_error.js +7 -9
- package/dist/_esm5.processed/errors/index.js +11 -25
- package/dist/_esm5.processed/errors/is_known_error.js +11 -14
- package/dist/_esm5.processed/errors/media_error.d.ts +2 -2
- package/dist/_esm5.processed/errors/media_error.js +47 -34
- package/dist/_esm5.processed/errors/network_error.d.ts +1 -0
- package/dist/_esm5.processed/errors/network_error.js +38 -21
- package/dist/_esm5.processed/errors/other_error.js +31 -15
- package/dist/_esm5.processed/errors/request_error.d.ts +3 -2
- package/dist/_esm5.processed/errors/request_error.js +37 -18
- package/dist/_esm5.processed/experimental/features/dash_wasm.js +11 -14
- package/dist/_esm5.processed/experimental/features/debug_element.js +4 -7
- package/dist/_esm5.processed/experimental/features/index.js +4 -11
- package/dist/_esm5.processed/experimental/features/local.js +6 -9
- package/dist/_esm5.processed/experimental/features/metaplaylist.js +6 -9
- package/dist/_esm5.processed/experimental/index.js +2 -5
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/features/dash.js +3 -6
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/features/metaplaylist.js +3 -6
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/index.js +3 -7
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/load_and_push_segment.js +16 -22
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/prepare_source_buffer.js +19 -22
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/remove_buffer_around_time.js +3 -6
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/types.js +1 -2
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.js +188 -127
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader_error.js +27 -11
- package/dist/_esm5.processed/experimental/tools/createMetaplaylist/get_duration_from_manifest.js +119 -76
- package/dist/_esm5.processed/experimental/tools/createMetaplaylist/index.js +15 -24
- package/dist/_esm5.processed/experimental/tools/index.js +5 -11
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/api/index.js +43 -38
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/api/probeMediaConfiguration.js +34 -31
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/capabilities.js +18 -21
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/index.js +2 -4
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/log.js +3 -5
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/DRMInfos.js +17 -20
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/HDCPPolicy.js +18 -21
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/decodingInfo.js +10 -13
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/defaultCodecsFinder.js +13 -16
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/index.js +14 -16
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/mediaContentType.js +11 -14
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/mediaContentTypeWithFeatures/format.js +11 -14
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/mediaContentTypeWithFeatures/index.js +15 -19
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/mediaDisplayInfos.js +7 -11
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/types.js +2 -5
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/utils.js +22 -25
- package/dist/_esm5.processed/experimental/tools/parseBIFThumbnails.js +4 -7
- package/dist/_esm5.processed/features/add_features.js +8 -11
- package/dist/_esm5.processed/features/features_object.js +4 -4
- package/dist/_esm5.processed/features/index.js +4 -7
- package/dist/_esm5.processed/features/list/bif_parser.d.ts +23 -0
- package/dist/_esm5.processed/features/list/bif_parser.js +27 -0
- package/dist/_esm5.processed/features/list/dash.js +8 -11
- package/dist/_esm5.processed/features/list/directfile.js +8 -9
- package/dist/_esm5.processed/features/list/eme.js +4 -7
- package/dist/_esm5.processed/features/list/html_sami_parser.js +6 -9
- package/dist/_esm5.processed/features/list/html_srt_parser.js +6 -9
- package/dist/_esm5.processed/features/list/html_text_buffer.js +4 -7
- package/dist/_esm5.processed/features/list/html_ttml_parser.js +6 -9
- package/dist/_esm5.processed/features/list/html_vtt_parser.js +6 -9
- package/dist/_esm5.processed/features/list/image_buffer.d.ts +23 -0
- package/dist/_esm5.processed/features/list/image_buffer.js +25 -0
- package/dist/_esm5.processed/features/list/index.d.ts +2 -0
- package/dist/_esm5.processed/features/list/index.js +16 -31
- package/dist/_esm5.processed/features/list/native_sami_parser.js +6 -9
- package/dist/_esm5.processed/features/list/native_srt_parser.js +6 -9
- package/dist/_esm5.processed/features/list/native_text_buffer.js +4 -7
- package/dist/_esm5.processed/features/list/native_ttml_parser.js +6 -9
- package/dist/_esm5.processed/features/list/native_vtt_parser.js +6 -9
- package/dist/_esm5.processed/features/list/smooth.js +6 -9
- package/dist/_esm5.processed/features/types.d.ts +27 -3
- package/dist/_esm5.processed/features/types.js +1 -2
- package/dist/_esm5.processed/log.js +3 -5
- package/dist/_esm5.processed/manifest/adaptation.d.ts +11 -9
- package/dist/_esm5.processed/manifest/adaptation.js +69 -77
- package/dist/_esm5.processed/manifest/index.d.ts +4 -3
- package/dist/_esm5.processed/manifest/index.js +13 -32
- package/dist/_esm5.processed/manifest/manifest.d.ts +60 -8
- package/dist/_esm5.processed/manifest/manifest.js +241 -119
- package/dist/_esm5.processed/manifest/period.d.ts +11 -5
- package/dist/_esm5.processed/manifest/period.js +46 -39
- package/dist/_esm5.processed/manifest/representation.d.ts +5 -10
- package/dist/_esm5.processed/manifest/representation.js +59 -84
- package/dist/_esm5.processed/manifest/representation_index/index.d.ts +2 -2
- package/dist/_esm5.processed/manifest/representation_index/index.js +2 -5
- package/dist/_esm5.processed/manifest/representation_index/static.d.ts +0 -2
- package/dist/_esm5.processed/manifest/representation_index/static.js +36 -43
- package/dist/_esm5.processed/manifest/representation_index/types.d.ts +21 -42
- package/dist/_esm5.processed/manifest/representation_index/types.js +1 -2
- package/dist/_esm5.processed/manifest/types.d.ts +2 -0
- package/dist/_esm5.processed/manifest/types.js +2 -5
- package/dist/_esm5.processed/manifest/update_period_in_place.js +48 -38
- package/dist/_esm5.processed/manifest/update_periods.js +69 -59
- package/dist/_esm5.processed/manifest/utils.js +9 -14
- package/dist/_esm5.processed/minimal.js +7 -9
- package/dist/_esm5.processed/parsers/containers/isobmff/constants.js +1 -4
- package/dist/_esm5.processed/parsers/containers/isobmff/create_box.js +10 -14
- package/dist/_esm5.processed/parsers/containers/isobmff/drm/index.js +1 -5
- package/dist/_esm5.processed/parsers/containers/isobmff/drm/playready.js +11 -15
- package/dist/_esm5.processed/parsers/containers/isobmff/get_box.js +40 -48
- package/dist/_esm5.processed/parsers/containers/isobmff/index.js +6 -27
- package/dist/_esm5.processed/parsers/containers/isobmff/read.js +14 -20
- package/dist/_esm5.processed/parsers/containers/isobmff/take_pssh_out.js +20 -25
- package/dist/_esm5.processed/parsers/containers/isobmff/utils.js +112 -130
- package/dist/_esm5.processed/parsers/containers/matroska/index.js +1 -6
- package/dist/_esm5.processed/parsers/containers/matroska/utils.js +63 -67
- package/dist/_esm5.processed/parsers/images/bif.js +29 -40
- package/dist/_esm5.processed/parsers/manifest/dash/common/attach_trickmode_track.js +12 -10
- package/dist/_esm5.processed/parsers/manifest/dash/common/flatten_overlapping_periods.js +7 -10
- package/dist/_esm5.processed/parsers/manifest/dash/common/get_clock_offset.d.ts +3 -3
- package/dist/_esm5.processed/parsers/manifest/dash/common/get_clock_offset.js +7 -11
- package/dist/_esm5.processed/parsers/manifest/dash/common/get_hdr_information.js +6 -10
- package/dist/_esm5.processed/parsers/manifest/dash/common/get_http_utc-timing_url.js +6 -7
- package/dist/_esm5.processed/parsers/manifest/dash/common/get_minimum_and_maximum_positions.js +6 -10
- package/dist/_esm5.processed/parsers/manifest/dash/common/get_periods_time_infos.js +9 -14
- package/dist/_esm5.processed/parsers/manifest/dash/common/index.js +4 -10
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/base.d.ts +31 -17
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/base.js +80 -93
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/get_init_segment.js +4 -9
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/get_segments_from_timeline.js +25 -32
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/index.js +5 -11
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/list.d.ts +0 -2
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/list.js +64 -81
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/template.d.ts +6 -2
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/template.js +122 -132
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_elements.js +12 -15
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_previous_timeline.js +32 -35
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/convert_element_to_index_segment.js +9 -14
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/find_first_common_start_time.js +22 -30
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/index.js +2 -4
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/parse_s_element.js +11 -14
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.d.ts +3 -7
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.js +122 -131
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/tokens.js +10 -16
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/utils.js +3 -7
- package/dist/_esm5.processed/parsers/manifest/dash/common/infer_adaptation_type.d.ts +2 -2
- package/dist/_esm5.processed/parsers/manifest/dash/common/infer_adaptation_type.js +24 -20
- package/dist/_esm5.processed/parsers/manifest/dash/common/manifest_bounds_calculator.d.ts +4 -8
- package/dist/_esm5.processed/parsers/manifest/dash/common/manifest_bounds_calculator.js +19 -22
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_adaptation_sets.js +115 -113
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_availability_start_time.js +1 -4
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_mpd.d.ts +5 -6
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_mpd.js +84 -86
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_periods.d.ts +0 -4
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_periods.js +84 -101
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representation_index.d.ts +4 -2
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representation_index.js +37 -39
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representations.js +69 -61
- package/dist/_esm5.processed/parsers/manifest/dash/common/resolve_base_urls.js +9 -12
- package/dist/_esm5.processed/parsers/manifest/dash/index.js +1 -8
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/index.js +2 -4
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/AdaptationSet.js +64 -72
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/BaseURL.js +4 -7
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/ContentComponent.js +4 -7
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/ContentProtection.js +19 -22
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/EventStream.js +19 -22
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/Initialization.js +8 -11
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/MPD.js +34 -38
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/Period.js +30 -34
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/Representation.js +40 -46
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/SegmentBase.js +21 -24
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/SegmentList.js +12 -15
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/SegmentTemplate.js +18 -21
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/SegmentTimeline.js +3 -6
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/SegmentURL.js +9 -12
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/utils.d.ts +1 -10
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/utils.js +63 -75
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/parse_from_document.js +27 -33
- package/dist/_esm5.processed/parsers/manifest/dash/node_parser_types.d.ts +4 -4
- package/dist/_esm5.processed/parsers/manifest/dash/node_parser_types.js +1 -2
- package/dist/_esm5.processed/parsers/manifest/dash/parsers_types.d.ts +4 -4
- package/dist/_esm5.processed/parsers/manifest/dash/parsers_types.js +1 -2
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/index.js +2 -4
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/dash-wasm-parser.js +237 -192
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/AdaptationSet.js +68 -70
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/BaseURL.js +4 -8
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/ContentComponent.js +7 -11
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/ContentProtection.js +13 -17
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/EventStream.js +24 -29
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/MPD.js +33 -38
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/Period.js +32 -37
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/Representation.js +40 -44
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/Scheme.js +5 -9
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/SegmentBase.js +12 -16
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/SegmentList.js +7 -11
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/SegmentTemplate.js +16 -20
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/SegmentUrl.js +7 -11
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/XLink.js +7 -11
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/index.js +1 -5
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/root.js +6 -10
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/parsers_stack.js +20 -22
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/types.js +1 -2
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/utils.js +2 -6
- package/dist/_esm5.processed/parsers/manifest/index.js +1 -17
- package/dist/_esm5.processed/parsers/manifest/local/index.js +2 -4
- package/dist/_esm5.processed/parsers/manifest/local/parse_local_manifest.js +26 -30
- package/dist/_esm5.processed/parsers/manifest/local/representation_index.d.ts +0 -2
- package/dist/_esm5.processed/parsers/manifest/local/representation_index.js +78 -71
- package/dist/_esm5.processed/parsers/manifest/local/types.js +1 -2
- package/dist/_esm5.processed/parsers/manifest/metaplaylist/index.js +2 -4
- package/dist/_esm5.processed/parsers/manifest/metaplaylist/metaplaylist_parser.js +75 -79
- package/dist/_esm5.processed/parsers/manifest/metaplaylist/representation_index.d.ts +3 -12
- package/dist/_esm5.processed/parsers/manifest/metaplaylist/representation_index.js +50 -59
- package/dist/_esm5.processed/parsers/manifest/smooth/create_parser.d.ts +1 -0
- package/dist/_esm5.processed/parsers/manifest/smooth/create_parser.js +184 -204
- package/dist/_esm5.processed/parsers/manifest/smooth/get_codecs.js +8 -13
- package/dist/_esm5.processed/parsers/manifest/smooth/index.js +4 -7
- package/dist/_esm5.processed/parsers/manifest/smooth/parse_C_nodes.js +14 -17
- package/dist/_esm5.processed/parsers/manifest/smooth/parse_protection_node.js +15 -17
- package/dist/_esm5.processed/parsers/manifest/smooth/representation_index.d.ts +86 -24
- package/dist/_esm5.processed/parsers/manifest/smooth/representation_index.js +195 -128
- package/dist/_esm5.processed/parsers/manifest/smooth/utils/add_segment_infos.d.ts +6 -3
- package/dist/_esm5.processed/parsers/manifest/smooth/utils/add_segment_infos.js +10 -13
- package/dist/_esm5.processed/parsers/manifest/smooth/utils/parseBoolean.js +1 -4
- package/dist/_esm5.processed/parsers/manifest/smooth/utils/reduceChildren.js +3 -6
- package/dist/_esm5.processed/parsers/manifest/smooth/utils/tokens.js +1 -5
- package/dist/_esm5.processed/parsers/manifest/types.d.ts +7 -7
- package/dist/_esm5.processed/parsers/manifest/types.js +1 -2
- package/dist/_esm5.processed/parsers/manifest/utils/check_manifest_ids.js +24 -27
- package/dist/_esm5.processed/parsers/manifest/utils/clear_timeline_from_position.js +7 -10
- package/dist/_esm5.processed/parsers/manifest/utils/get_first_time_from_adaptation.js +5 -8
- package/dist/_esm5.processed/parsers/manifest/utils/get_last_time_from_adaptation.js +5 -8
- package/dist/_esm5.processed/parsers/manifest/utils/get_maximum_positions.js +12 -15
- package/dist/_esm5.processed/parsers/manifest/utils/get_minimum_position.js +12 -15
- package/dist/_esm5.processed/parsers/manifest/utils/index_helpers.js +22 -31
- package/dist/_esm5.processed/parsers/manifest/utils/is_segment_still_available.js +6 -9
- package/dist/_esm5.processed/parsers/manifest/utils/update_segment_timeline.js +45 -38
- package/dist/_esm5.processed/parsers/texttracks/index.js +1 -2
- package/dist/_esm5.processed/parsers/texttracks/sami/html.js +43 -45
- package/dist/_esm5.processed/parsers/texttracks/sami/native.js +39 -41
- package/dist/_esm5.processed/parsers/texttracks/srt/find_end_of_cue_block.js +4 -7
- package/dist/_esm5.processed/parsers/texttracks/srt/get_cue_blocks.js +8 -11
- package/dist/_esm5.processed/parsers/texttracks/srt/html.js +29 -32
- package/dist/_esm5.processed/parsers/texttracks/srt/native.js +13 -16
- package/dist/_esm5.processed/parsers/texttracks/srt/parse_cue.js +18 -21
- package/dist/_esm5.processed/parsers/texttracks/srt/parse_timestamp.js +7 -10
- package/dist/_esm5.processed/parsers/texttracks/ttml/get_parameters.js +30 -37
- package/dist/_esm5.processed/parsers/texttracks/ttml/get_styling.js +48 -48
- package/dist/_esm5.processed/parsers/texttracks/ttml/get_time_delimiters.js +11 -14
- package/dist/_esm5.processed/parsers/texttracks/ttml/html/apply_default_ttml_paragraph_style.js +2 -7
- package/dist/_esm5.processed/parsers/texttracks/ttml/html/apply_extent.js +20 -16
- package/dist/_esm5.processed/parsers/texttracks/ttml/html/apply_font_size.js +12 -15
- package/dist/_esm5.processed/parsers/texttracks/ttml/html/apply_line_height.js +8 -11
- package/dist/_esm5.processed/parsers/texttracks/ttml/html/apply_origin.js +21 -16
- package/dist/_esm5.processed/parsers/texttracks/ttml/html/apply_padding.js +22 -25
- package/dist/_esm5.processed/parsers/texttracks/ttml/html/create_element.js +124 -117
- package/dist/_esm5.processed/parsers/texttracks/ttml/html/generate_css_test_outline.js +8 -11
- package/dist/_esm5.processed/parsers/texttracks/ttml/html/index.js +2 -4
- package/dist/_esm5.processed/parsers/texttracks/ttml/html/parse_cue.js +8 -12
- package/dist/_esm5.processed/parsers/texttracks/ttml/html/parse_ttml_to_div.js +11 -14
- package/dist/_esm5.processed/parsers/texttracks/ttml/html/ttml_color_to_css_color.js +7 -10
- package/dist/_esm5.processed/parsers/texttracks/ttml/native/index.js +2 -4
- package/dist/_esm5.processed/parsers/texttracks/ttml/native/parse_cue.js +35 -38
- package/dist/_esm5.processed/parsers/texttracks/ttml/native/parse_ttml_to_vtt.js +8 -11
- package/dist/_esm5.processed/parsers/texttracks/ttml/parse_ttml.js +58 -58
- package/dist/_esm5.processed/parsers/texttracks/ttml/regexps.js +13 -27
- package/dist/_esm5.processed/parsers/texttracks/ttml/resolve_styles_inheritance.js +18 -18
- package/dist/_esm5.processed/parsers/texttracks/ttml/time_parsing.js +26 -28
- package/dist/_esm5.processed/parsers/texttracks/ttml/xml_utils.js +25 -37
- package/dist/_esm5.processed/parsers/texttracks/types.js +1 -2
- package/dist/_esm5.processed/parsers/texttracks/webvtt/get_cue_blocks.js +9 -12
- package/dist/_esm5.processed/parsers/texttracks/webvtt/get_style_blocks.js +11 -14
- package/dist/_esm5.processed/parsers/texttracks/webvtt/html/convert_payload_to_html.js +8 -11
- package/dist/_esm5.processed/parsers/texttracks/webvtt/html/create_default_style_elements.js +5 -8
- package/dist/_esm5.processed/parsers/texttracks/webvtt/html/create_style_attribute.js +60 -60
- package/dist/_esm5.processed/parsers/texttracks/webvtt/html/create_styled_element.js +27 -30
- package/dist/_esm5.processed/parsers/texttracks/webvtt/html/index.js +2 -4
- package/dist/_esm5.processed/parsers/texttracks/webvtt/html/parse_style_block.js +26 -23
- package/dist/_esm5.processed/parsers/texttracks/webvtt/html/parse_webvtt_to_div.js +17 -20
- package/dist/_esm5.processed/parsers/texttracks/webvtt/html/to_html.js +18 -23
- package/dist/_esm5.processed/parsers/texttracks/webvtt/native/index.js +2 -4
- package/dist/_esm5.processed/parsers/texttracks/webvtt/native/parse_vtt_to_cues.js +16 -19
- package/dist/_esm5.processed/parsers/texttracks/webvtt/native/set_settings_on_cue.js +17 -20
- package/dist/_esm5.processed/parsers/texttracks/webvtt/native/to_native_cue.js +5 -8
- package/dist/_esm5.processed/parsers/texttracks/webvtt/parse_cue_block.js +18 -26
- package/dist/_esm5.processed/parsers/texttracks/webvtt/parse_timestamp.js +7 -10
- package/dist/_esm5.processed/parsers/texttracks/webvtt/utils.js +7 -15
- package/dist/_esm5.processed/public_types.d.ts +352 -442
- package/dist/_esm5.processed/public_types.js +1 -2
- package/dist/_esm5.processed/tools/TextTrackRenderer/index.js +6 -13
- package/dist/_esm5.processed/tools/TextTrackRenderer/text_track_renderer.d.ts +4 -5
- package/dist/_esm5.processed/tools/TextTrackRenderer/text_track_renderer.js +26 -29
- package/dist/_esm5.processed/tools/index.js +4 -6
- package/dist/_esm5.processed/tools/string_utils.js +1 -10
- package/dist/_esm5.processed/transports/dash/add_segment_integrity_checks_to_loader.js +24 -16
- package/dist/_esm5.processed/transports/dash/construct_segment_url.js +3 -6
- package/dist/_esm5.processed/transports/dash/extract_complete_chunks.js +14 -17
- package/dist/_esm5.processed/transports/dash/get_events_out_of_emsgs.js +16 -19
- package/dist/_esm5.processed/transports/dash/image_pipelines.d.ts +38 -0
- package/dist/_esm5.processed/transports/dash/image_pipelines.js +129 -0
- package/dist/_esm5.processed/transports/dash/index.js +2 -4
- package/dist/_esm5.processed/transports/dash/init_segment_loader.js +27 -47
- package/dist/_esm5.processed/transports/dash/low_latency_segment_loader.js +16 -23
- package/dist/_esm5.processed/transports/dash/manifest_parser.js +60 -68
- package/dist/_esm5.processed/transports/dash/pipelines.js +21 -21
- package/dist/_esm5.processed/transports/dash/segment_loader.d.ts +2 -2
- package/dist/_esm5.processed/transports/dash/segment_loader.js +49 -65
- package/dist/_esm5.processed/transports/dash/segment_parser.js +49 -64
- package/dist/_esm5.processed/transports/dash/text_loader.js +32 -38
- package/dist/_esm5.processed/transports/dash/text_parser.js +53 -58
- package/dist/_esm5.processed/transports/index.js +1 -17
- package/dist/_esm5.processed/transports/local/index.js +2 -4
- package/dist/_esm5.processed/transports/local/pipelines.js +32 -27
- package/dist/_esm5.processed/transports/local/segment_loader.js +24 -27
- package/dist/_esm5.processed/transports/local/segment_parser.d.ts +1 -1
- package/dist/_esm5.processed/transports/local/segment_parser.js +26 -38
- package/dist/_esm5.processed/transports/local/text_parser.d.ts +2 -2
- package/dist/_esm5.processed/transports/local/text_parser.js +41 -55
- package/dist/_esm5.processed/transports/metaplaylist/index.js +2 -4
- package/dist/_esm5.processed/transports/metaplaylist/manifest_loader.js +7 -11
- package/dist/_esm5.processed/transports/metaplaylist/pipelines.js +123 -101
- package/dist/_esm5.processed/transports/smooth/extract_timings_infos.js +20 -26
- package/dist/_esm5.processed/transports/smooth/index.js +2 -4
- package/dist/_esm5.processed/transports/smooth/isobmff/create_audio_init_segment.js +19 -22
- package/dist/_esm5.processed/transports/smooth/isobmff/create_boxes.js +67 -92
- package/dist/_esm5.processed/transports/smooth/isobmff/create_init_segment.js +26 -29
- package/dist/_esm5.processed/transports/smooth/isobmff/create_traf_box.js +6 -9
- package/dist/_esm5.processed/transports/smooth/isobmff/create_video_init_segment.js +20 -23
- package/dist/_esm5.processed/transports/smooth/isobmff/get_aaces_header.js +7 -10
- package/dist/_esm5.processed/transports/smooth/isobmff/index.js +6 -13
- package/dist/_esm5.processed/transports/smooth/isobmff/parse_tfrf.js +16 -19
- package/dist/_esm5.processed/transports/smooth/isobmff/parse_tfxd.js +6 -9
- package/dist/_esm5.processed/transports/smooth/isobmff/patch_segment.js +38 -41
- package/dist/_esm5.processed/transports/smooth/pipelines.js +262 -116
- package/dist/_esm5.processed/transports/smooth/segment_loader.d.ts +3 -3
- package/dist/_esm5.processed/transports/smooth/segment_loader.js +150 -152
- package/dist/_esm5.processed/transports/smooth/utils.d.ts +26 -1
- package/dist/_esm5.processed/transports/smooth/utils.js +57 -7
- package/dist/_esm5.processed/transports/types.d.ts +96 -110
- package/dist/_esm5.processed/transports/types.js +1 -2
- package/dist/_esm5.processed/transports/utils/byte_range.js +4 -6
- package/dist/_esm5.processed/transports/utils/call_custom_manifest_loader.js +18 -24
- package/dist/_esm5.processed/transports/utils/check_isobmff_integrity.js +11 -14
- package/dist/_esm5.processed/transports/utils/find_complete_box.js +8 -11
- package/dist/_esm5.processed/transports/utils/generate_manifest_loader.js +14 -22
- package/dist/_esm5.processed/transports/utils/get_isobmff_timing_infos.js +10 -13
- package/dist/_esm5.processed/transports/utils/infer_segment_container.d.ts +3 -3
- package/dist/_esm5.processed/transports/utils/infer_segment_container.js +7 -8
- package/dist/_esm5.processed/transports/utils/parse_text_track.d.ts +12 -8
- package/dist/_esm5.processed/transports/utils/parse_text_track.js +34 -46
- package/dist/_esm5.processed/utils/are_arrays_of_numbers_equal.js +2 -5
- package/dist/_esm5.processed/utils/are_codecs_compatible.js +9 -11
- package/dist/_esm5.processed/utils/array_find.js +4 -7
- package/dist/_esm5.processed/utils/array_find_index.js +3 -6
- package/dist/_esm5.processed/utils/array_includes.js +11 -12
- package/dist/_esm5.processed/utils/assert.js +9 -13
- package/dist/_esm5.processed/utils/assert_unreachable.js +3 -6
- package/dist/_esm5.processed/utils/base64.js +18 -23
- package/dist/_esm5.processed/utils/byte_parsing.js +17 -30
- package/dist/_esm5.processed/utils/cancellable_sleep.js +5 -8
- package/dist/_esm5.processed/utils/create_cancellable_promise.js +4 -7
- package/dist/_esm5.processed/utils/deep_merge.js +21 -10
- package/dist/_esm5.processed/utils/event_emitter.js +24 -24
- package/dist/_esm5.processed/utils/flat_map.js +4 -7
- package/dist/_esm5.processed/utils/get_fuzzed_delay.js +3 -6
- package/dist/_esm5.processed/utils/hash_buffer.js +4 -7
- package/dist/_esm5.processed/utils/id_generator.js +3 -6
- package/dist/_esm5.processed/utils/initialization_segment_cache.js +12 -11
- package/dist/_esm5.processed/utils/is_non_empty_string.js +1 -4
- package/dist/_esm5.processed/utils/is_null_or_undefined.js +1 -4
- package/dist/_esm5.processed/utils/languages/ISO_639-1_to_ISO_639-3.js +2 -4
- package/dist/_esm5.processed/utils/languages/ISO_639-2_to_ISO_639-3.js +2 -4
- package/dist/_esm5.processed/utils/languages/index.js +3 -7
- package/dist/_esm5.processed/utils/languages/normalize.js +20 -26
- package/dist/_esm5.processed/utils/list_to_map.d.ts +22 -0
- package/dist/_esm5.processed/utils/list_to_map.js +28 -0
- package/dist/_esm5.processed/utils/logger.js +23 -24
- package/dist/_esm5.processed/utils/noop.js +1 -4
- package/dist/_esm5.processed/utils/object_assign.js +10 -8
- package/dist/_esm5.processed/utils/object_values.js +3 -6
- package/dist/_esm5.processed/utils/ranges.d.ts +8 -50
- package/dist/_esm5.processed/utils/ranges.js +64 -163
- package/dist/_esm5.processed/utils/reference.js +52 -48
- package/dist/_esm5.processed/utils/request/fetch.d.ts +4 -4
- package/dist/_esm5.processed/utils/request/fetch.js +107 -79
- package/dist/_esm5.processed/utils/request/index.js +4 -9
- package/dist/_esm5.processed/utils/request/xhr.js +36 -49
- package/dist/_esm5.processed/utils/resolve_url.js +18 -18
- package/dist/_esm5.processed/utils/retry_promise_with_backoff.js +81 -34
- package/dist/_esm5.processed/utils/simple_set.d.ts +51 -0
- package/dist/_esm5.processed/utils/simple_set.js +57 -0
- package/dist/_esm5.processed/utils/sleep.js +2 -5
- package/dist/_esm5.processed/utils/slice_uint8array.js +1 -3
- package/dist/_esm5.processed/utils/sorted_list.js +40 -37
- package/dist/_esm5.processed/utils/starts_with.js +2 -5
- package/dist/_esm5.processed/utils/string_parsing.js +72 -84
- package/dist/_esm5.processed/utils/task_canceller.js +71 -51
- package/dist/_esm5.processed/utils/uniq.d.ts +36 -0
- package/dist/_esm5.processed/utils/uniq.js +43 -0
- package/dist/_esm5.processed/utils/warn_once.js +4 -7
- package/dist/_esm5.processed/utils/weak_map_memory.js +11 -12
- package/dist/_esm5.processed/utils/wrapInPromise.js +2 -5
- package/dist/commonjs/compat/add_class_name.d.ts +22 -0
- package/dist/commonjs/compat/add_class_name.js +42 -0
- package/dist/commonjs/compat/add_text_track.d.ts +31 -0
- package/dist/commonjs/compat/add_text_track.js +50 -0
- package/dist/commonjs/compat/browser_compatibility_types.d.ts +164 -0
- package/dist/commonjs/compat/browser_compatibility_types.js +37 -0
- package/dist/commonjs/compat/browser_detection.d.ts +42 -0
- package/dist/commonjs/compat/browser_detection.js +119 -0
- package/dist/commonjs/compat/browser_version.d.ts +24 -0
- package/dist/commonjs/compat/browser_version.js +44 -0
- package/dist/commonjs/compat/can_patch_isobmff.d.ts +25 -0
- package/dist/commonjs/compat/can_patch_isobmff.js +31 -0
- package/dist/commonjs/compat/can_rely_on_video_visibility_and_size.d.ts +37 -0
- package/dist/commonjs/compat/can_rely_on_video_visibility_and_size.js +52 -0
- package/dist/commonjs/compat/can_reuse_media_keys.d.ts +13 -0
- package/dist/commonjs/compat/can_reuse_media_keys.js +19 -0
- package/dist/commonjs/compat/change_source_buffer_type.d.ts +48 -0
- package/dist/commonjs/compat/change_source_buffer_type.js +40 -0
- package/dist/commonjs/compat/clear_element_src.d.ts +20 -0
- package/dist/commonjs/compat/clear_element_src.js +56 -0
- package/dist/commonjs/compat/eme/close_session.d.ts +30 -0
- package/dist/commonjs/compat/eme/close_session.js +165 -0
- package/dist/commonjs/compat/eme/constants.d.ts +16 -0
- package/dist/commonjs/compat/eme/constants.js +22 -0
- package/dist/commonjs/compat/eme/custom_key_system_access.d.ts +54 -0
- package/dist/commonjs/compat/eme/custom_key_system_access.js +49 -0
- package/dist/commonjs/compat/eme/custom_media_keys/ie11_media_keys.d.ts +31 -0
- package/dist/commonjs/compat/eme/custom_media_keys/ie11_media_keys.js +174 -0
- package/dist/commonjs/compat/eme/custom_media_keys/index.d.ts +7 -0
- package/dist/commonjs/compat/eme/custom_media_keys/index.js +16 -0
- package/dist/commonjs/compat/eme/custom_media_keys/moz_media_keys_constructor.d.ts +27 -0
- package/dist/commonjs/compat/eme/custom_media_keys/moz_media_keys_constructor.js +64 -0
- package/dist/commonjs/compat/eme/custom_media_keys/ms_media_keys_constructor.d.ts +43 -0
- package/dist/commonjs/compat/eme/custom_media_keys/ms_media_keys_constructor.js +30 -0
- package/dist/commonjs/compat/eme/custom_media_keys/old_webkit_media_keys.d.ts +41 -0
- package/dist/commonjs/compat/eme/custom_media_keys/old_webkit_media_keys.js +197 -0
- package/dist/commonjs/compat/eme/custom_media_keys/types.d.ts +43 -0
- package/dist/commonjs/compat/eme/custom_media_keys/types.js +17 -0
- package/dist/commonjs/compat/eme/custom_media_keys/webkit_media_keys.d.ts +37 -0
- package/dist/commonjs/compat/eme/custom_media_keys/webkit_media_keys.js +263 -0
- package/dist/commonjs/compat/eme/custom_media_keys/webkit_media_keys_constructor.d.ts +22 -0
- package/dist/commonjs/compat/eme/custom_media_keys/webkit_media_keys_constructor.js +30 -0
- package/dist/commonjs/compat/eme/eme-api-implementation.d.ts +78 -0
- package/dist/commonjs/compat/eme/eme-api-implementation.js +226 -0
- package/dist/commonjs/compat/eme/generate_key_request.d.ts +54 -0
- package/dist/commonjs/compat/eme/generate_key_request.js +152 -0
- package/dist/commonjs/compat/eme/get_init_data.d.ts +57 -0
- package/dist/commonjs/compat/eme/get_init_data.js +115 -0
- package/dist/commonjs/compat/eme/get_uuid_kid_from_keystatus_kid.d.ts +23 -0
- package/dist/commonjs/compat/eme/get_uuid_kid_from_keystatus_kid.js +34 -0
- package/dist/commonjs/compat/eme/get_webkit_fairplay_initdata.d.ts +25 -0
- package/dist/commonjs/compat/eme/get_webkit_fairplay_initdata.js +60 -0
- package/dist/commonjs/compat/eme/index.d.ts +24 -0
- package/dist/commonjs/compat/eme/index.js +28 -0
- package/dist/commonjs/compat/eme/load_session.d.ts +30 -0
- package/dist/commonjs/compat/eme/load_session.js +102 -0
- package/dist/commonjs/compat/enable_audio_track.d.ts +11 -0
- package/dist/commonjs/compat/enable_audio_track.js +29 -0
- package/dist/commonjs/compat/event_listeners.d.ts +173 -0
- package/dist/commonjs/compat/event_listeners.js +448 -0
- package/dist/commonjs/compat/get_start_date.d.ts +30 -0
- package/dist/commonjs/compat/get_start_date.js +47 -0
- package/dist/{_esm5.processed → commonjs}/compat/global_scope.js +3 -3
- package/dist/commonjs/compat/has_issues_with_high_media_source_duration.d.ts +21 -0
- package/dist/commonjs/compat/has_issues_with_high_media_source_duration.js +29 -0
- package/dist/commonjs/compat/index.d.ts +37 -0
- package/dist/commonjs/compat/index.js +66 -0
- package/dist/commonjs/compat/is_codec_supported.d.ts +25 -0
- package/dist/commonjs/compat/is_codec_supported.js +39 -0
- package/dist/commonjs/compat/is_debug_mode_enabled.d.ts +7 -0
- package/dist/commonjs/compat/is_debug_mode_enabled.js +12 -0
- package/dist/commonjs/compat/is_node.d.ts +18 -0
- package/dist/commonjs/compat/is_node.js +21 -0
- package/dist/commonjs/compat/is_seeking_approximate.d.ts +28 -0
- package/dist/commonjs/compat/is_seeking_approximate.js +31 -0
- package/dist/commonjs/compat/is_vtt_cue.d.ts +22 -0
- package/dist/commonjs/compat/is_vtt_cue.js +29 -0
- package/dist/commonjs/compat/make_vtt_cue.d.ts +26 -0
- package/dist/commonjs/compat/make_vtt_cue.js +47 -0
- package/dist/commonjs/compat/on_height_width_change.d.ts +33 -0
- package/dist/commonjs/compat/on_height_width_change.js +75 -0
- package/dist/commonjs/compat/patch_webkit_source_buffer.d.ts +16 -0
- package/dist/commonjs/compat/patch_webkit_source_buffer.js +78 -0
- package/dist/commonjs/compat/remove_cue.d.ts +21 -0
- package/dist/commonjs/compat/remove_cue.js +66 -0
- package/dist/commonjs/compat/should_favour_custom_safari_EME.d.ts +23 -0
- package/dist/commonjs/compat/should_favour_custom_safari_EME.js +30 -0
- package/dist/commonjs/compat/should_reload_media_source_on_decipherability_update.d.ts +26 -0
- package/dist/commonjs/compat/should_reload_media_source_on_decipherability_update.js +32 -0
- package/dist/commonjs/compat/should_renew_media_key_system_access.d.ts +21 -0
- package/dist/commonjs/compat/should_renew_media_key_system_access.js +27 -0
- package/dist/commonjs/compat/should_unset_media_keys.d.ts +22 -0
- package/dist/commonjs/compat/should_unset_media_keys.js +28 -0
- package/dist/commonjs/compat/should_validate_metadata.d.ts +22 -0
- package/dist/commonjs/compat/should_validate_metadata.js +28 -0
- package/dist/commonjs/compat/should_wait_for_data_before_loaded.d.ts +24 -0
- package/dist/commonjs/compat/should_wait_for_data_before_loaded.js +33 -0
- package/dist/commonjs/compat/should_wait_for_have_enough_data.d.ts +13 -0
- package/dist/commonjs/compat/should_wait_for_have_enough_data.js +19 -0
- package/dist/commonjs/config.d.ts +179 -0
- package/dist/commonjs/config.js +34 -0
- package/dist/commonjs/core/adaptive/adaptive_representation_selector.d.ts +306 -0
- package/dist/commonjs/core/adaptive/adaptive_representation_selector.js +380 -0
- package/dist/commonjs/core/adaptive/buffer_based_chooser.d.ts +89 -0
- package/dist/commonjs/core/adaptive/buffer_based_chooser.js +195 -0
- package/dist/commonjs/core/adaptive/guess_based_chooser.d.ts +95 -0
- package/dist/commonjs/core/adaptive/guess_based_chooser.js +266 -0
- package/dist/commonjs/core/adaptive/index.d.ts +18 -0
- package/dist/commonjs/core/adaptive/index.js +19 -0
- package/dist/commonjs/core/adaptive/network_analyzer.d.ts +73 -0
- package/dist/commonjs/core/adaptive/network_analyzer.js +342 -0
- package/dist/commonjs/core/adaptive/utils/bandwidth_estimator.d.ts +47 -0
- package/dist/commonjs/core/adaptive/utils/bandwidth_estimator.js +72 -0
- package/dist/commonjs/core/adaptive/utils/ewma.d.ts +39 -0
- package/dist/commonjs/core/adaptive/utils/ewma.js +54 -0
- package/dist/commonjs/core/adaptive/utils/filter_by_bitrate.d.ts +25 -0
- package/dist/commonjs/core/adaptive/utils/filter_by_bitrate.js +40 -0
- package/dist/commonjs/core/adaptive/utils/filter_by_resolution.js +53 -0
- package/dist/commonjs/core/adaptive/utils/get_buffer_levels.d.ts +24 -0
- package/dist/commonjs/core/adaptive/utils/get_buffer_levels.js +50 -0
- package/dist/commonjs/core/adaptive/utils/last_estimate_storage.d.ts +61 -0
- package/dist/commonjs/core/adaptive/utils/last_estimate_storage.js +39 -0
- package/dist/commonjs/core/adaptive/utils/pending_requests_store.d.ts +110 -0
- package/dist/commonjs/core/adaptive/utils/pending_requests_store.js +78 -0
- package/dist/commonjs/core/adaptive/utils/representation_score_calculator.d.ts +104 -0
- package/dist/commonjs/core/adaptive/utils/representation_score_calculator.js +116 -0
- package/dist/commonjs/core/adaptive/utils/select_optimal_representation.d.ts +27 -0
- package/dist/commonjs/core/adaptive/utils/select_optimal_representation.js +39 -0
- package/dist/commonjs/core/api/debug/buffer_graph.d.ts +28 -0
- package/dist/commonjs/core/api/debug/buffer_graph.js +177 -0
- package/dist/commonjs/core/api/debug/buffer_size_graph.d.ts +10 -0
- package/dist/commonjs/core/api/debug/buffer_size_graph.js +132 -0
- package/dist/commonjs/core/api/debug/constants.d.ts +2 -0
- package/dist/commonjs/core/api/debug/constants.js +5 -0
- package/dist/commonjs/core/api/debug/index.d.ts +2 -0
- package/dist/commonjs/core/api/debug/index.js +4 -0
- package/dist/commonjs/core/api/debug/modules/general_info.d.ts +3 -0
- package/dist/commonjs/core/api/debug/modules/general_info.js +213 -0
- package/dist/commonjs/core/api/debug/modules/segment_buffer_content.d.ts +4 -0
- package/dist/commonjs/core/api/debug/modules/segment_buffer_content.js +124 -0
- package/dist/commonjs/core/api/debug/modules/segment_buffer_size.d.ts +3 -0
- package/dist/commonjs/core/api/debug/modules/segment_buffer_size.js +38 -0
- package/dist/commonjs/core/api/debug/render.d.ts +3 -0
- package/dist/commonjs/core/api/debug/render.js +35 -0
- package/dist/commonjs/core/api/debug/utils.d.ts +39 -0
- package/dist/commonjs/core/api/debug/utils.js +86 -0
- package/dist/commonjs/core/api/index.d.ts +20 -0
- package/dist/commonjs/core/api/index.js +22 -0
- package/dist/commonjs/core/api/option_utils.d.ts +119 -0
- package/dist/commonjs/core/api/option_utils.js +303 -0
- package/dist/commonjs/core/api/playback_observer.d.ts +370 -0
- package/dist/commonjs/core/api/playback_observer.js +585 -0
- package/dist/commonjs/core/api/public_api.d.ts +718 -0
- package/dist/commonjs/core/api/public_api.js +2226 -0
- package/dist/{_esm5.processed → commonjs}/core/api/track_management/index.js +1 -1
- package/dist/commonjs/core/api/track_management/media_element_tracks_store.js +688 -0
- package/dist/commonjs/core/api/track_management/track_dispatcher.js +178 -0
- package/dist/commonjs/core/api/track_management/tracks_store.js +998 -0
- package/dist/commonjs/core/api/utils.d.ts +66 -0
- package/dist/commonjs/core/api/utils.js +175 -0
- package/dist/commonjs/core/decrypt/__tests__/__global__/utils.d.ts +178 -0
- package/dist/commonjs/core/decrypt/__tests__/__global__/utils.js +413 -0
- package/dist/commonjs/core/decrypt/attach_media_keys.d.ts +52 -0
- package/dist/commonjs/core/decrypt/attach_media_keys.js +120 -0
- package/dist/commonjs/core/decrypt/clear_on_stop.d.ts +22 -0
- package/dist/commonjs/core/decrypt/clear_on_stop.js +43 -0
- package/dist/commonjs/core/decrypt/content_decryptor.d.ts +184 -0
- package/dist/commonjs/core/decrypt/content_decryptor.js +1146 -0
- package/dist/commonjs/core/decrypt/create_or_load_session.d.ts +63 -0
- package/dist/commonjs/core/decrypt/create_or_load_session.js +127 -0
- package/dist/commonjs/core/decrypt/create_session.d.ts +53 -0
- package/dist/commonjs/core/decrypt/create_session.js +215 -0
- package/dist/commonjs/core/decrypt/dispose_decryption_resources.d.ts +21 -0
- package/dist/commonjs/core/decrypt/dispose_decryption_resources.js +91 -0
- package/dist/commonjs/core/decrypt/find_key_system.d.ts +48 -0
- package/dist/commonjs/core/decrypt/find_key_system.js +369 -0
- package/dist/commonjs/core/decrypt/get_key_system_configuration.d.ts +22 -0
- package/dist/commonjs/core/decrypt/get_key_system_configuration.js +35 -0
- package/dist/commonjs/core/decrypt/get_media_keys.d.ts +44 -0
- package/dist/commonjs/core/decrypt/get_media_keys.js +160 -0
- package/dist/commonjs/core/decrypt/index.d.ts +26 -0
- package/dist/commonjs/core/decrypt/index.js +45 -0
- package/dist/commonjs/core/decrypt/init_media_keys.d.ts +26 -0
- package/dist/commonjs/core/decrypt/init_media_keys.js +85 -0
- package/dist/commonjs/core/decrypt/session_events_listener.d.ts +75 -0
- package/dist/commonjs/core/decrypt/session_events_listener.js +330 -0
- package/dist/commonjs/core/decrypt/set_server_certificate.d.ts +51 -0
- package/dist/commonjs/core/decrypt/set_server_certificate.js +146 -0
- package/dist/commonjs/core/decrypt/types.d.ts +368 -0
- package/dist/commonjs/core/decrypt/types.js +58 -0
- package/dist/commonjs/core/decrypt/utils/are_init_values_compatible.d.ts +34 -0
- package/dist/commonjs/core/decrypt/utils/are_init_values_compatible.js +116 -0
- package/dist/commonjs/core/decrypt/utils/check_key_statuses.d.ts +52 -0
- package/dist/commonjs/core/decrypt/utils/check_key_statuses.js +211 -0
- package/dist/commonjs/core/decrypt/utils/clean_old_loaded_sessions.d.ts +26 -0
- package/dist/commonjs/core/decrypt/utils/clean_old_loaded_sessions.js +89 -0
- package/dist/commonjs/core/decrypt/utils/clean_old_stored_persistent_info.d.ts +32 -0
- package/dist/commonjs/core/decrypt/utils/clean_old_stored_persistent_info.js +43 -0
- package/dist/commonjs/core/decrypt/utils/get_drm_system_id.d.ts +20 -0
- package/dist/commonjs/core/decrypt/utils/get_drm_system_id.js +40 -0
- package/dist/commonjs/core/decrypt/utils/init_data_values_container.d.ts +69 -0
- package/dist/commonjs/core/decrypt/utils/init_data_values_container.js +126 -0
- package/dist/commonjs/core/decrypt/utils/is_session_usable.d.ts +24 -0
- package/dist/commonjs/core/decrypt/utils/is_session_usable.js +52 -0
- package/dist/commonjs/core/decrypt/utils/key_id_comparison.d.ts +31 -0
- package/dist/commonjs/core/decrypt/utils/key_id_comparison.js +96 -0
- package/dist/commonjs/core/decrypt/utils/key_session_record.d.ts +104 -0
- package/dist/commonjs/core/decrypt/utils/key_session_record.js +190 -0
- package/dist/commonjs/core/decrypt/utils/loaded_sessions_store.d.ts +215 -0
- package/dist/commonjs/core/decrypt/utils/loaded_sessions_store.js +515 -0
- package/dist/commonjs/core/decrypt/utils/media_keys_infos_store.d.ts +56 -0
- package/dist/commonjs/core/decrypt/utils/media_keys_infos_store.js +46 -0
- package/dist/commonjs/core/decrypt/utils/persistent_sessions_store.d.ts +94 -0
- package/dist/commonjs/core/decrypt/utils/persistent_sessions_store.js +346 -0
- package/dist/commonjs/core/decrypt/utils/serializable_bytes.d.ts +44 -0
- package/dist/commonjs/core/decrypt/utils/serializable_bytes.js +50 -0
- package/dist/commonjs/core/decrypt/utils/server_certificate_store.d.ts +64 -0
- package/dist/commonjs/core/decrypt/utils/server_certificate_store.js +114 -0
- package/dist/commonjs/core/fetchers/cdn_prioritizer.d.ts +107 -0
- package/dist/commonjs/core/fetchers/cdn_prioritizer.js +216 -0
- package/dist/commonjs/core/fetchers/index.d.ts +18 -0
- package/dist/commonjs/core/fetchers/index.js +22 -0
- package/dist/commonjs/core/fetchers/manifest/index.d.ts +18 -0
- package/dist/commonjs/core/fetchers/manifest/index.js +19 -0
- package/dist/commonjs/core/fetchers/manifest/manifest_fetcher.d.ts +221 -0
- package/dist/commonjs/core/fetchers/manifest/manifest_fetcher.js +629 -0
- package/dist/commonjs/core/fetchers/segment/index.d.ts +19 -0
- package/dist/commonjs/core/fetchers/segment/index.js +19 -0
- package/dist/commonjs/core/fetchers/segment/prioritized_segment_fetcher.d.ts +38 -0
- package/dist/commonjs/core/fetchers/segment/prioritized_segment_fetcher.js +70 -0
- package/dist/commonjs/core/fetchers/segment/segment_fetcher.d.ts +148 -0
- package/dist/commonjs/core/fetchers/segment/segment_fetcher.js +321 -0
- package/dist/commonjs/core/fetchers/segment/segment_fetcher_creator.d.ts +77 -0
- package/dist/commonjs/core/fetchers/segment/segment_fetcher_creator.js +60 -0
- package/dist/commonjs/core/fetchers/segment/task_prioritizer.d.ts +145 -0
- package/dist/commonjs/core/fetchers/segment/task_prioritizer.js +350 -0
- package/dist/commonjs/core/fetchers/utils/error_selector.d.ts +23 -0
- package/dist/commonjs/core/fetchers/utils/error_selector.js +34 -0
- package/dist/commonjs/core/fetchers/utils/schedule_request.d.ts +98 -0
- package/dist/commonjs/core/fetchers/utils/schedule_request.js +393 -0
- package/dist/commonjs/core/init/directfile_content_initializer.d.ts +97 -0
- package/dist/commonjs/core/init/directfile_content_initializer.js +241 -0
- package/dist/commonjs/core/init/index.d.ts +16 -0
- package/dist/commonjs/core/init/index.js +20 -0
- package/dist/commonjs/core/init/media_source_content_initializer.d.ts +174 -0
- package/dist/commonjs/core/init/media_source_content_initializer.js +655 -0
- package/dist/commonjs/core/init/types.d.ts +217 -0
- package/dist/commonjs/core/init/types.js +54 -0
- package/dist/commonjs/core/init/utils/content_time_boundaries_observer.d.ts +191 -0
- package/dist/commonjs/core/init/utils/content_time_boundaries_observer.js +520 -0
- package/dist/commonjs/core/init/utils/create_media_source.d.ts +37 -0
- package/dist/commonjs/core/init/utils/create_media_source.js +117 -0
- package/dist/commonjs/core/init/utils/create_stream_playback_observer.d.ts +45 -0
- package/dist/commonjs/core/init/utils/create_stream_playback_observer.js +89 -0
- package/dist/commonjs/core/init/utils/end_of_stream.d.ts +33 -0
- package/dist/commonjs/core/init/utils/end_of_stream.js +115 -0
- package/dist/commonjs/core/init/utils/get_initial_time.d.ts +62 -0
- package/dist/commonjs/core/init/utils/get_initial_time.js +113 -0
- package/dist/commonjs/core/init/utils/get_loaded_reference.d.ts +28 -0
- package/dist/commonjs/core/init/utils/get_loaded_reference.js +59 -0
- package/dist/commonjs/core/init/utils/initial_seek_and_play.d.ts +63 -0
- package/dist/commonjs/core/init/utils/initial_seek_and_play.js +131 -0
- package/dist/commonjs/core/init/utils/initialize_content_decryption.d.ts +80 -0
- package/dist/commonjs/core/init/utils/initialize_content_decryption.js +107 -0
- package/dist/commonjs/core/init/utils/media_source_duration_updater.d.ts +58 -0
- package/dist/commonjs/core/init/utils/media_source_duration_updater.js +270 -0
- package/dist/commonjs/core/init/utils/rebuffering_controller.d.ts +147 -0
- package/dist/commonjs/core/init/utils/rebuffering_controller.js +597 -0
- package/dist/commonjs/core/init/utils/stream_events_emitter/are_same_stream_events.d.ts +39 -0
- package/dist/commonjs/core/init/utils/stream_events_emitter/are_same_stream_events.js +37 -0
- package/dist/commonjs/core/init/utils/stream_events_emitter/index.d.ts +18 -0
- package/dist/commonjs/core/init/utils/stream_events_emitter/index.js +19 -0
- package/dist/commonjs/core/init/utils/stream_events_emitter/refresh_scheduled_events_list.d.ts +25 -0
- package/dist/commonjs/core/init/utils/stream_events_emitter/refresh_scheduled_events_list.js +68 -0
- package/dist/commonjs/core/init/utils/stream_events_emitter/stream_events_emitter.d.ts +52 -0
- package/dist/commonjs/core/init/utils/stream_events_emitter/stream_events_emitter.js +232 -0
- package/dist/commonjs/core/init/utils/stream_events_emitter/types.d.ts +41 -0
- package/dist/commonjs/core/init/utils/stream_events_emitter/types.js +17 -0
- package/dist/commonjs/core/init/utils/throw_on_media_error.d.ts +23 -0
- package/dist/commonjs/core/init/utils/throw_on_media_error.js +61 -0
- package/dist/commonjs/core/segment_buffers/garbage_collector.d.ts +41 -0
- package/dist/commonjs/core/segment_buffers/garbage_collector.js +212 -0
- package/dist/commonjs/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.d.ts +182 -0
- package/dist/commonjs/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.js +457 -0
- package/dist/commonjs/core/segment_buffers/implementations/audio_video/index.d.ts +17 -0
- package/dist/commonjs/core/segment_buffers/implementations/audio_video/index.js +19 -0
- package/dist/commonjs/core/segment_buffers/implementations/index.d.ts +18 -0
- package/dist/commonjs/core/segment_buffers/implementations/index.js +35 -0
- package/dist/commonjs/core/segment_buffers/implementations/text/html/html_text_segment_buffer.d.ts +141 -0
- package/dist/commonjs/core/segment_buffers/implementations/text/html/html_text_segment_buffer.js +407 -0
- package/dist/commonjs/core/segment_buffers/implementations/text/html/index.d.ts +21 -0
- package/dist/commonjs/core/segment_buffers/implementations/text/html/index.js +23 -0
- package/dist/commonjs/core/segment_buffers/implementations/text/html/parsers.d.ts +30 -0
- package/dist/commonjs/core/segment_buffers/implementations/text/html/parsers.js +40 -0
- package/dist/commonjs/core/segment_buffers/implementations/text/html/text_track_cues_store.d.ts +79 -0
- package/dist/commonjs/core/segment_buffers/implementations/text/html/text_track_cues_store.js +342 -0
- package/dist/commonjs/core/segment_buffers/implementations/text/html/types.d.ts +25 -0
- package/dist/commonjs/core/segment_buffers/implementations/text/html/types.js +17 -0
- package/dist/commonjs/core/segment_buffers/implementations/text/html/update_proportional_elements.d.ts +30 -0
- package/dist/commonjs/core/segment_buffers/implementations/text/html/update_proportional_elements.js +80 -0
- package/dist/commonjs/core/segment_buffers/implementations/text/html/utils.d.ts +44 -0
- package/dist/commonjs/core/segment_buffers/implementations/text/html/utils.js +114 -0
- package/dist/commonjs/core/segment_buffers/implementations/text/native/index.d.ts +17 -0
- package/dist/commonjs/core/segment_buffers/implementations/text/native/index.js +19 -0
- package/dist/commonjs/core/segment_buffers/implementations/text/native/native_text_segment_buffer.d.ts +83 -0
- package/dist/commonjs/core/segment_buffers/implementations/text/native/native_text_segment_buffer.js +273 -0
- package/dist/commonjs/core/segment_buffers/implementations/text/native/parsers.d.ts +26 -0
- package/dist/commonjs/core/segment_buffers/implementations/text/native/parsers.js +40 -0
- package/dist/commonjs/core/segment_buffers/implementations/types.d.ts +320 -0
- package/dist/commonjs/core/segment_buffers/implementations/types.js +124 -0
- package/dist/commonjs/core/segment_buffers/implementations/utils/manual_time_ranges.d.ts +29 -0
- package/dist/commonjs/core/segment_buffers/implementations/utils/manual_time_ranges.js +67 -0
- package/dist/commonjs/core/segment_buffers/index.d.ts +21 -0
- package/dist/commonjs/core/segment_buffers/index.js +28 -0
- package/dist/commonjs/core/segment_buffers/inventory/buffered_history.d.ts +89 -0
- package/dist/commonjs/core/segment_buffers/inventory/buffered_history.js +114 -0
- package/dist/commonjs/core/segment_buffers/inventory/index.d.ts +21 -0
- package/dist/commonjs/core/segment_buffers/inventory/index.js +23 -0
- package/dist/commonjs/core/segment_buffers/inventory/segment_inventory.d.ts +207 -0
- package/dist/commonjs/core/segment_buffers/inventory/segment_inventory.js +866 -0
- package/dist/commonjs/core/segment_buffers/inventory/types.d.ts +27 -0
- package/dist/commonjs/core/segment_buffers/inventory/types.js +17 -0
- package/dist/{_esm5.processed → commonjs}/core/segment_buffers/inventory/utils.js +2 -2
- package/dist/commonjs/core/segment_buffers/segment_buffers_store.d.ts +180 -0
- package/dist/commonjs/core/segment_buffers/segment_buffers_store.js +302 -0
- package/dist/commonjs/core/stream/adaptation/adaptation_stream.d.ts +33 -0
- package/dist/commonjs/core/stream/adaptation/adaptation_stream.js +455 -0
- package/dist/commonjs/core/stream/adaptation/get_representations_switch_strategy.js +136 -0
- package/dist/commonjs/core/stream/adaptation/index.d.ts +18 -0
- package/dist/commonjs/core/stream/adaptation/index.js +34 -0
- package/dist/commonjs/core/stream/adaptation/types.d.ts +200 -0
- package/dist/commonjs/core/stream/adaptation/types.js +2 -0
- package/dist/commonjs/core/stream/index.d.ts +20 -0
- package/dist/commonjs/core/stream/index.js +19 -0
- package/dist/commonjs/core/stream/orchestrator/get_time_ranges_for_content.d.ts +30 -0
- package/dist/commonjs/core/stream/orchestrator/get_time_ranges_for_content.js +63 -0
- package/dist/commonjs/core/stream/orchestrator/index.d.ts +18 -0
- package/dist/commonjs/core/stream/orchestrator/index.js +19 -0
- package/dist/commonjs/core/stream/orchestrator/stream_orchestrator.d.ts +174 -0
- package/dist/commonjs/core/stream/orchestrator/stream_orchestrator.js +602 -0
- package/dist/commonjs/core/stream/period/index.d.ts +18 -0
- package/dist/commonjs/core/stream/period/index.js +34 -0
- package/dist/commonjs/core/stream/period/period_stream.d.ts +49 -0
- package/dist/commonjs/core/stream/period/period_stream.js +454 -0
- package/dist/commonjs/core/stream/period/types.d.ts +101 -0
- package/dist/commonjs/core/stream/period/types.js +2 -0
- package/dist/commonjs/core/stream/period/utils/get_adaptation_switch_strategy.d.ts +68 -0
- package/dist/commonjs/core/stream/period/utils/get_adaptation_switch_strategy.js +165 -0
- package/dist/commonjs/core/stream/representation/index.d.ts +18 -0
- package/dist/commonjs/core/stream/representation/index.js +34 -0
- package/dist/commonjs/core/stream/representation/representation_stream.d.ts +53 -0
- package/dist/commonjs/core/stream/representation/representation_stream.js +399 -0
- package/dist/commonjs/core/stream/representation/types.d.ts +276 -0
- package/dist/commonjs/core/stream/representation/types.js +2 -0
- package/dist/commonjs/core/stream/representation/utils/append_segment_to_buffer.d.ts +32 -0
- package/dist/commonjs/core/stream/representation/utils/append_segment_to_buffer.js +117 -0
- package/dist/commonjs/core/stream/representation/utils/check_for_discontinuity.d.ts +53 -0
- package/dist/commonjs/core/stream/representation/utils/check_for_discontinuity.js +238 -0
- package/dist/commonjs/core/stream/representation/utils/downloading_queue.d.ts +231 -0
- package/dist/commonjs/core/stream/representation/utils/downloading_queue.js +390 -0
- package/dist/commonjs/core/stream/representation/utils/force_garbage_collection.d.ts +29 -0
- package/dist/commonjs/core/stream/representation/utils/force_garbage_collection.js +179 -0
- package/dist/commonjs/core/stream/representation/utils/get_buffer_status.d.ts +72 -0
- package/dist/commonjs/core/stream/representation/utils/get_buffer_status.js +231 -0
- package/dist/commonjs/core/stream/representation/utils/get_needed_segments.d.ts +92 -0
- package/dist/commonjs/core/stream/representation/utils/get_needed_segments.js +429 -0
- package/dist/commonjs/core/stream/representation/utils/get_segment_priority.d.ts +28 -0
- package/dist/commonjs/core/stream/representation/utils/get_segment_priority.js +41 -0
- package/dist/commonjs/core/stream/representation/utils/push_init_segment.d.ts +39 -0
- package/dist/commonjs/core/stream/representation/utils/push_init_segment.js +88 -0
- package/dist/commonjs/core/stream/representation/utils/push_media_segment.d.ts +40 -0
- package/dist/commonjs/core/stream/representation/utils/push_media_segment.js +111 -0
- package/dist/commonjs/default_config.d.ts +1081 -0
- package/dist/commonjs/default_config.js +1104 -0
- package/dist/commonjs/errors/assertion_error.d.ts +31 -0
- package/dist/commonjs/errors/assertion_error.js +56 -0
- package/dist/commonjs/errors/custom_loader_error.d.ts +36 -0
- package/dist/commonjs/errors/custom_loader_error.js +61 -0
- package/dist/commonjs/errors/encrypted_media_error.d.ts +39 -0
- package/dist/commonjs/errors/encrypted_media_error.js +59 -0
- package/dist/commonjs/errors/error_codes.d.ts +31 -0
- package/dist/commonjs/errors/error_codes.js +75 -0
- package/dist/commonjs/errors/error_message.d.ts +22 -0
- package/dist/commonjs/errors/error_message.js +27 -0
- package/dist/commonjs/errors/format_error.d.ts +20 -0
- package/dist/commonjs/errors/format_error.js +34 -0
- package/dist/commonjs/errors/index.d.ts +26 -0
- package/dist/commonjs/errors/index.js +40 -0
- package/dist/commonjs/errors/is_known_error.d.ts +22 -0
- package/dist/commonjs/errors/is_known_error.js +35 -0
- package/dist/commonjs/errors/media_error.d.ts +56 -0
- package/dist/commonjs/errors/media_error.js +76 -0
- package/dist/commonjs/errors/network_error.d.ts +44 -0
- package/dist/commonjs/errors/network_error.js +72 -0
- package/dist/commonjs/errors/other_error.d.ts +32 -0
- package/dist/commonjs/errors/other_error.js +58 -0
- package/dist/commonjs/errors/request_error.d.ts +38 -0
- package/dist/commonjs/errors/request_error.js +76 -0
- package/dist/commonjs/experimental/features/dash_wasm.d.ts +23 -0
- package/dist/commonjs/experimental/features/dash_wasm.js +37 -0
- package/dist/commonjs/experimental/features/debug_element.d.ts +8 -0
- package/dist/commonjs/experimental/features/debug_element.js +13 -0
- package/dist/commonjs/experimental/features/index.d.ts +19 -0
- package/dist/commonjs/experimental/features/index.js +26 -0
- package/dist/commonjs/experimental/features/local.d.ts +19 -0
- package/dist/commonjs/experimental/features/local.js +27 -0
- package/dist/commonjs/experimental/features/metaplaylist.d.ts +19 -0
- package/dist/commonjs/experimental/features/metaplaylist.js +27 -0
- package/dist/commonjs/experimental/index.d.ts +2 -0
- package/dist/commonjs/experimental/index.js +5 -0
- package/dist/commonjs/experimental/tools/VideoThumbnailLoader/features/dash.d.ts +17 -0
- package/dist/commonjs/experimental/tools/VideoThumbnailLoader/features/dash.js +23 -0
- package/dist/commonjs/experimental/tools/VideoThumbnailLoader/features/metaplaylist.d.ts +17 -0
- package/dist/commonjs/experimental/tools/VideoThumbnailLoader/features/metaplaylist.js +23 -0
- package/{scripts/build/templates → dist/commonjs}/experimental/tools/VideoThumbnailLoader/index.d.ts +2 -2
- package/dist/commonjs/experimental/tools/VideoThumbnailLoader/index.js +22 -0
- package/dist/commonjs/experimental/tools/VideoThumbnailLoader/load_and_push_segment.d.ts +26 -0
- package/dist/commonjs/experimental/tools/VideoThumbnailLoader/load_and_push_segment.js +64 -0
- package/dist/commonjs/experimental/tools/VideoThumbnailLoader/prepare_source_buffer.d.ts +25 -0
- package/dist/commonjs/experimental/tools/VideoThumbnailLoader/prepare_source_buffer.js +66 -0
- package/dist/commonjs/experimental/tools/VideoThumbnailLoader/remove_buffer_around_time.d.ts +30 -0
- package/dist/commonjs/experimental/tools/VideoThumbnailLoader/remove_buffer_around_time.js +44 -0
- package/dist/commonjs/experimental/tools/VideoThumbnailLoader/types.d.ts +25 -0
- package/dist/commonjs/experimental/tools/VideoThumbnailLoader/types.js +17 -0
- package/dist/commonjs/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.d.ts +54 -0
- package/dist/commonjs/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.js +379 -0
- package/dist/commonjs/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader_error.d.ts +25 -0
- package/dist/commonjs/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader_error.js +50 -0
- package/dist/commonjs/experimental/tools/createMetaplaylist/get_duration_from_manifest.d.ts +23 -0
- package/dist/commonjs/experimental/tools/createMetaplaylist/get_duration_from_manifest.js +171 -0
- package/dist/commonjs/experimental/tools/createMetaplaylist/index.d.ts +30 -0
- package/dist/commonjs/experimental/tools/createMetaplaylist/index.js +52 -0
- package/dist/commonjs/experimental/tools/index.d.ts +20 -0
- package/dist/commonjs/experimental/tools/index.js +26 -0
- package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/api/index.d.ts +60 -0
- package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/api/index.js +160 -0
- package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/api/probeMediaConfiguration.d.ts +45 -0
- package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/api/probeMediaConfiguration.js +141 -0
- package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/capabilities.d.ts +24 -0
- package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/capabilities.js +145 -0
- package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/index.d.ts +17 -0
- package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/index.js +19 -0
- package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/log.d.ts +18 -0
- package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/log.js +20 -0
- package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/probers/DRMInfos.d.ts +25 -0
- package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/probers/DRMInfos.js +53 -0
- package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/probers/HDCPPolicy.d.ts +22 -0
- package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/probers/HDCPPolicy.js +72 -0
- package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/probers/decodingInfo.d.ts +26 -0
- package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/probers/decodingInfo.js +82 -0
- package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/probers/defaultCodecsFinder.d.ts +29 -0
- package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/probers/defaultCodecsFinder.js +101 -0
- package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/probers/index.d.ts +21 -0
- package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/probers/index.js +32 -0
- package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/probers/mediaContentType.d.ts +21 -0
- package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/probers/mediaContentType.js +60 -0
- package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/probers/mediaContentTypeWithFeatures/format.d.ts +21 -0
- package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/probers/mediaContentTypeWithFeatures/format.js +92 -0
- package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/probers/mediaContentTypeWithFeatures/index.d.ts +26 -0
- package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/probers/mediaContentTypeWithFeatures/index.js +87 -0
- package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/probers/mediaDisplayInfos.d.ts +21 -0
- package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/probers/mediaDisplayInfos.js +49 -0
- package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/types.d.ts +69 -0
- package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/types.js +24 -0
- package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/utils.d.ts +31 -0
- package/dist/commonjs/experimental/tools/mediaCapabilitiesProber/utils.js +104 -0
- package/dist/commonjs/experimental/tools/parseBIFThumbnails/index.d.ts +29 -0
- package/dist/commonjs/experimental/tools/parseBIFThumbnails/index.js +32 -0
- package/dist/commonjs/features/add_features.d.ts +20 -0
- package/dist/commonjs/features/add_features.js +38 -0
- package/dist/commonjs/features/features_object.d.ts +22 -0
- package/dist/commonjs/features/features_object.js +33 -0
- package/dist/commonjs/features/index.d.ts +34 -0
- package/dist/commonjs/features/index.js +36 -0
- package/dist/commonjs/features/list/dash.d.ts +23 -0
- package/dist/commonjs/features/list/dash.js +35 -0
- package/dist/commonjs/features/list/directfile.d.ts +24 -0
- package/dist/commonjs/features/list/directfile.js +31 -0
- package/dist/commonjs/features/list/eme.d.ts +23 -0
- package/dist/commonjs/features/list/eme.js +28 -0
- package/dist/commonjs/features/list/html_sami_parser.d.ts +23 -0
- package/dist/commonjs/features/list/html_sami_parser.js +30 -0
- package/dist/commonjs/features/list/html_srt_parser.d.ts +23 -0
- package/dist/commonjs/features/list/html_srt_parser.js +30 -0
- package/dist/commonjs/features/list/html_text_buffer.d.ts +23 -0
- package/dist/commonjs/features/list/html_text_buffer.js +28 -0
- package/dist/commonjs/features/list/html_ttml_parser.d.ts +23 -0
- package/dist/commonjs/features/list/html_ttml_parser.js +30 -0
- package/dist/commonjs/features/list/html_vtt_parser.d.ts +23 -0
- package/dist/commonjs/features/list/html_vtt_parser.js +30 -0
- package/dist/commonjs/features/list/index.d.ts +29 -0
- package/dist/commonjs/features/list/index.js +46 -0
- package/dist/commonjs/features/list/native_sami_parser.d.ts +23 -0
- package/dist/commonjs/features/list/native_sami_parser.js +31 -0
- package/dist/commonjs/features/list/native_srt_parser.d.ts +23 -0
- package/dist/commonjs/features/list/native_srt_parser.js +31 -0
- package/dist/commonjs/features/list/native_text_buffer.d.ts +23 -0
- package/dist/commonjs/features/list/native_text_buffer.js +29 -0
- package/dist/commonjs/features/list/native_ttml_parser.d.ts +23 -0
- package/dist/commonjs/features/list/native_ttml_parser.js +31 -0
- package/dist/commonjs/features/list/native_vtt_parser.d.ts +23 -0
- package/dist/commonjs/features/list/native_vtt_parser.js +31 -0
- package/dist/commonjs/features/list/smooth.d.ts +23 -0
- package/dist/commonjs/features/list/smooth.js +31 -0
- package/dist/commonjs/features/types.d.ts +130 -0
- package/dist/commonjs/features/types.js +17 -0
- package/dist/{_esm5.processed → commonjs}/index.js +4 -4
- package/dist/commonjs/log.d.ts +18 -0
- package/dist/commonjs/log.js +21 -0
- package/dist/commonjs/manifest/adaptation.d.ts +113 -0
- package/dist/commonjs/manifest/adaptation.js +222 -0
- package/dist/commonjs/manifest/index.d.ts +24 -0
- package/dist/commonjs/manifest/index.js +47 -0
- package/dist/commonjs/manifest/manifest.d.ts +265 -0
- package/dist/commonjs/manifest/manifest.js +453 -0
- package/dist/commonjs/manifest/period.d.ts +68 -0
- package/dist/commonjs/manifest/period.js +140 -0
- package/dist/commonjs/manifest/representation.d.ts +251 -0
- package/dist/commonjs/manifest/representation.js +283 -0
- package/dist/commonjs/manifest/representation_index/index.d.ts +18 -0
- package/dist/commonjs/manifest/representation_index/index.js +20 -0
- package/dist/commonjs/manifest/representation_index/static.d.ts +101 -0
- package/dist/commonjs/manifest/representation_index/static.js +143 -0
- package/dist/commonjs/manifest/representation_index/types.d.ts +420 -0
- package/dist/commonjs/manifest/representation_index/types.js +17 -0
- package/dist/commonjs/manifest/types.d.ts +29 -0
- package/dist/commonjs/manifest/types.js +33 -0
- package/dist/commonjs/manifest/update_period_in_place.d.ts +49 -0
- package/dist/commonjs/manifest/update_period_in_place.js +168 -0
- package/dist/commonjs/manifest/update_periods.d.ts +47 -0
- package/dist/commonjs/manifest/update_periods.js +189 -0
- package/dist/commonjs/manifest/utils.d.ts +39 -0
- package/dist/commonjs/manifest/utils.js +47 -0
- package/dist/commonjs/minimal.d.ts +17 -0
- package/dist/commonjs/minimal.js +33 -0
- package/dist/commonjs/parsers/containers/isobmff/constants.d.ts +23 -0
- package/dist/commonjs/parsers/containers/isobmff/constants.js +26 -0
- package/dist/commonjs/parsers/containers/isobmff/create_box.d.ts +30 -0
- package/dist/commonjs/parsers/containers/isobmff/create_box.js +93 -0
- package/dist/commonjs/parsers/containers/isobmff/drm/index.d.ts +16 -0
- package/dist/commonjs/parsers/containers/isobmff/drm/index.js +20 -0
- package/dist/commonjs/parsers/containers/isobmff/drm/playready.d.ts +21 -0
- package/dist/commonjs/parsers/containers/isobmff/drm/playready.js +40 -0
- package/dist/commonjs/parsers/containers/isobmff/get_box.d.ts +107 -0
- package/dist/commonjs/parsers/containers/isobmff/get_box.js +258 -0
- package/dist/commonjs/parsers/containers/isobmff/index.d.ts +21 -0
- package/dist/commonjs/parsers/containers/isobmff/index.js +42 -0
- package/dist/commonjs/parsers/containers/isobmff/read.d.ts +57 -0
- package/dist/commonjs/parsers/containers/isobmff/read.js +95 -0
- package/dist/commonjs/parsers/containers/isobmff/take_pssh_out.d.ts +41 -0
- package/dist/commonjs/parsers/containers/isobmff/take_pssh_out.js +88 -0
- package/dist/commonjs/parsers/containers/isobmff/utils.d.ts +123 -0
- package/dist/commonjs/parsers/containers/isobmff/utils.js +491 -0
- package/dist/commonjs/parsers/containers/matroska/index.d.ts +16 -0
- package/dist/commonjs/parsers/containers/matroska/index.js +21 -0
- package/dist/commonjs/parsers/containers/matroska/utils.d.ts +34 -0
- package/dist/commonjs/parsers/containers/matroska/utils.js +257 -0
- package/dist/commonjs/parsers/images/bif.d.ts +39 -0
- package/dist/commonjs/parsers/images/bif.js +90 -0
- package/dist/commonjs/parsers/manifest/dash/common/attach_trickmode_track.d.ts +28 -0
- package/dist/commonjs/parsers/manifest/dash/common/attach_trickmode_track.js +98 -0
- package/dist/commonjs/parsers/manifest/dash/common/flatten_overlapping_periods.d.ts +43 -0
- package/dist/commonjs/parsers/manifest/dash/common/flatten_overlapping_periods.js +77 -0
- package/dist/commonjs/parsers/manifest/dash/common/get_clock_offset.d.ts +29 -0
- package/dist/commonjs/parsers/manifest/dash/common/get_clock_offset.js +41 -0
- package/dist/commonjs/parsers/manifest/dash/common/get_hdr_information.d.ts +50 -0
- package/dist/commonjs/parsers/manifest/dash/common/get_hdr_information.js +78 -0
- package/dist/commonjs/parsers/manifest/dash/common/get_http_utc-timing_url.d.ts +21 -0
- package/dist/commonjs/parsers/manifest/dash/common/get_http_utc-timing_url.js +31 -0
- package/dist/commonjs/parsers/manifest/dash/common/get_minimum_and_maximum_positions.d.ts +25 -0
- package/dist/commonjs/parsers/manifest/dash/common/get_minimum_and_maximum_positions.js +33 -0
- package/dist/commonjs/parsers/manifest/dash/common/get_periods_time_infos.d.ts +43 -0
- package/dist/commonjs/parsers/manifest/dash/common/get_periods_time_infos.js +67 -0
- package/dist/commonjs/parsers/manifest/dash/common/index.d.ts +20 -0
- package/dist/commonjs/parsers/manifest/dash/common/index.js +25 -0
- package/dist/commonjs/parsers/manifest/dash/common/indexes/base.d.ts +246 -0
- package/dist/commonjs/parsers/manifest/dash/common/indexes/base.js +256 -0
- package/dist/commonjs/parsers/manifest/dash/common/indexes/get_init_segment.d.ts +32 -0
- package/dist/commonjs/parsers/manifest/dash/common/indexes/get_init_segment.js +43 -0
- package/dist/commonjs/parsers/manifest/dash/common/indexes/get_segments_from_timeline.d.ts +36 -0
- package/dist/commonjs/parsers/manifest/dash/common/indexes/get_segments_from_timeline.js +97 -0
- package/dist/commonjs/parsers/manifest/dash/common/indexes/index.d.ts +20 -0
- package/dist/commonjs/parsers/manifest/dash/common/indexes/index.js +26 -0
- package/dist/commonjs/parsers/manifest/dash/common/indexes/list.d.ts +193 -0
- package/dist/commonjs/parsers/manifest/dash/common/indexes/list.js +216 -0
- package/dist/commonjs/parsers/manifest/dash/common/indexes/template.d.ts +254 -0
- package/dist/commonjs/parsers/manifest/dash/common/indexes/template.js +427 -0
- package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_elements.d.ts +26 -0
- package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_elements.js +50 -0
- package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_previous_timeline.d.ts +17 -0
- package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_previous_timeline.js +86 -0
- package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/convert_element_to_index_segment.d.ts +37 -0
- package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/convert_element_to_index_segment.js +59 -0
- package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/find_first_common_start_time.d.ts +41 -0
- package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/find_first_common_start_time.js +130 -0
- package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/index.d.ts +17 -0
- package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/index.js +19 -0
- package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/parse_s_element.d.ts +34 -0
- package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/parse_s_element.js +60 -0
- package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.d.ts +338 -0
- package/dist/commonjs/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.js +467 -0
- package/dist/commonjs/parsers/manifest/dash/common/indexes/tokens.d.ts +40 -0
- package/dist/commonjs/parsers/manifest/dash/common/indexes/tokens.js +115 -0
- package/dist/commonjs/parsers/manifest/dash/common/indexes/utils.d.ts +25 -0
- package/dist/commonjs/parsers/manifest/dash/common/indexes/utils.js +32 -0
- package/dist/commonjs/parsers/manifest/dash/common/infer_adaptation_type.d.ts +42 -0
- package/dist/commonjs/parsers/manifest/dash/common/infer_adaptation_type.js +112 -0
- package/dist/commonjs/parsers/manifest/dash/common/manifest_bounds_calculator.d.ts +92 -0
- package/dist/commonjs/parsers/manifest/dash/common/manifest_bounds_calculator.js +115 -0
- package/dist/commonjs/parsers/manifest/dash/common/parse_adaptation_sets.d.ts +49 -0
- package/dist/commonjs/parsers/manifest/dash/common/parse_adaptation_sets.js +430 -0
- package/dist/commonjs/parsers/manifest/dash/common/parse_availability_start_time.d.ts +22 -0
- package/dist/commonjs/parsers/manifest/dash/common/parse_availability_start_time.js +32 -0
- package/dist/commonjs/parsers/manifest/dash/common/parse_mpd.d.ts +98 -0
- package/dist/commonjs/parsers/manifest/dash/common/parse_mpd.js +287 -0
- package/dist/commonjs/parsers/manifest/dash/common/parse_periods.d.ts +67 -0
- package/dist/commonjs/parsers/manifest/dash/common/parse_periods.js +329 -0
- package/dist/commonjs/parsers/manifest/dash/common/parse_representation_index.d.ts +73 -0
- package/dist/commonjs/parsers/manifest/dash/common/parse_representation_index.js +115 -0
- package/dist/commonjs/parsers/manifest/dash/common/parse_representations.d.ts +46 -0
- package/dist/commonjs/parsers/manifest/dash/common/parse_representations.js +305 -0
- package/dist/commonjs/parsers/manifest/dash/common/resolve_base_urls.d.ts +26 -0
- package/dist/commonjs/parsers/manifest/dash/common/resolve_base_urls.js +47 -0
- package/dist/commonjs/parsers/manifest/dash/index.d.ts +16 -0
- package/dist/commonjs/parsers/manifest/dash/index.js +23 -0
- package/dist/commonjs/parsers/manifest/dash/js-parser/index.d.ts +17 -0
- package/dist/commonjs/parsers/manifest/dash/js-parser/index.js +19 -0
- package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/AdaptationSet.d.ts +23 -0
- package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/AdaptationSet.js +328 -0
- package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/BaseURL.d.ts +23 -0
- package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/BaseURL.js +33 -0
- package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/ContentComponent.d.ts +22 -0
- package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/ContentComponent.js +44 -0
- package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/ContentProtection.d.ts +21 -0
- package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/ContentProtection.js +94 -0
- package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/EventStream.d.ts +23 -0
- package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/EventStream.js +113 -0
- package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/Initialization.d.ts +21 -0
- package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/Initialization.js +42 -0
- package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/MPD.d.ts +21 -0
- package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/MPD.js +164 -0
- package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/Period.d.ts +21 -0
- package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/Period.js +132 -0
- package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/Representation.d.ts +21 -0
- package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/Representation.js +206 -0
- package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/SegmentBase.d.ts +22 -0
- package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/SegmentBase.js +108 -0
- package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/SegmentList.d.ts +21 -0
- package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/SegmentList.js +59 -0
- package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/SegmentTemplate.d.ts +23 -0
- package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/SegmentTemplate.js +92 -0
- package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/SegmentTimeline.d.ts +21 -0
- package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/SegmentTimeline.js +33 -0
- package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/SegmentURL.d.ts +23 -0
- package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/SegmentURL.js +52 -0
- package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/utils.d.ts +187 -0
- package/dist/commonjs/parsers/manifest/dash/js-parser/node_parsers/utils.js +354 -0
- package/dist/commonjs/parsers/manifest/dash/js-parser/parse_from_document.d.ts +24 -0
- package/dist/commonjs/parsers/manifest/dash/js-parser/parse_from_document.js +131 -0
- package/dist/commonjs/parsers/manifest/dash/node_parser_types.d.ts +393 -0
- package/dist/commonjs/parsers/manifest/dash/node_parser_types.js +17 -0
- package/dist/commonjs/parsers/manifest/dash/parsers_types.d.ts +83 -0
- package/dist/commonjs/parsers/manifest/dash/parsers_types.js +17 -0
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/index.d.ts +18 -0
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/index.js +19 -0
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/dash-wasm-parser.d.ts +111 -0
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/dash-wasm-parser.js +396 -0
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/AdaptationSet.d.ts +31 -0
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/AdaptationSet.js +275 -0
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/BaseURL.d.ts +24 -0
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/BaseURL.js +34 -0
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/ContentComponent.d.ts +24 -0
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/ContentComponent.js +45 -0
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/ContentProtection.d.ts +23 -0
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/ContentProtection.js +53 -0
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/EventStream.d.ts +32 -0
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/EventStream.js +117 -0
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/MPD.d.ts +27 -0
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/MPD.js +150 -0
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/Period.d.ts +32 -0
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/Period.js +135 -0
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/Representation.d.ts +31 -0
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/Representation.js +172 -0
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/Scheme.d.ts +24 -0
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/Scheme.js +39 -0
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/SegmentBase.d.ts +18 -0
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/SegmentBase.js +97 -0
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/SegmentList.d.ts +25 -0
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/SegmentList.js +49 -0
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/SegmentTemplate.d.ts +18 -0
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/SegmentTemplate.js +112 -0
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/SegmentUrl.d.ts +25 -0
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/SegmentUrl.js +58 -0
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/XLink.d.ts +28 -0
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/XLink.js +51 -0
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/index.d.ts +16 -0
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/index.js +20 -0
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/root.d.ts +27 -0
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/generators/root.js +49 -0
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/parsers_stack.d.ts +38 -0
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/parsers_stack.js +59 -0
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/types.d.ts +144 -0
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/types.js +17 -0
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/utils.d.ts +29 -0
- package/dist/commonjs/parsers/manifest/dash/wasm-parser/ts/utils.js +40 -0
- package/dist/commonjs/parsers/manifest/index.d.ts +16 -0
- package/dist/commonjs/parsers/manifest/index.js +32 -0
- package/dist/commonjs/parsers/manifest/local/index.d.ts +18 -0
- package/dist/commonjs/parsers/manifest/local/index.js +19 -0
- package/dist/commonjs/parsers/manifest/local/parse_local_manifest.d.ts +22 -0
- package/dist/commonjs/parsers/manifest/local/parse_local_manifest.js +129 -0
- package/dist/commonjs/parsers/manifest/local/representation_index.d.ts +83 -0
- package/dist/commonjs/parsers/manifest/local/representation_index.js +258 -0
- package/dist/commonjs/parsers/manifest/local/types.d.ts +285 -0
- package/dist/commonjs/parsers/manifest/local/types.js +17 -0
- package/dist/commonjs/parsers/manifest/metaplaylist/index.d.ts +18 -0
- package/dist/commonjs/parsers/manifest/metaplaylist/index.js +19 -0
- package/dist/commonjs/parsers/manifest/metaplaylist/metaplaylist_parser.d.ts +64 -0
- package/dist/commonjs/parsers/manifest/metaplaylist/metaplaylist_parser.js +283 -0
- package/dist/commonjs/parsers/manifest/metaplaylist/representation_index.d.ts +154 -0
- package/dist/commonjs/parsers/manifest/metaplaylist/representation_index.js +227 -0
- package/dist/commonjs/parsers/manifest/smooth/create_parser.d.ts +33 -0
- package/dist/commonjs/parsers/manifest/smooth/create_parser.js +521 -0
- package/dist/commonjs/parsers/manifest/smooth/get_codecs.d.ts +26 -0
- package/dist/commonjs/parsers/manifest/smooth/get_codecs.js +55 -0
- package/dist/commonjs/parsers/manifest/smooth/index.d.ts +19 -0
- package/dist/commonjs/parsers/manifest/smooth/index.js +22 -0
- package/dist/commonjs/parsers/manifest/smooth/parse_C_nodes.d.ts +26 -0
- package/dist/commonjs/parsers/manifest/smooth/parse_C_nodes.js +63 -0
- package/dist/commonjs/parsers/manifest/smooth/parse_protection_node.d.ts +29 -0
- package/dist/commonjs/parsers/manifest/smooth/parse_protection_node.js +61 -0
- package/dist/commonjs/parsers/manifest/smooth/representation_index.d.ts +226 -0
- package/dist/commonjs/parsers/manifest/smooth/representation_index.js +385 -0
- package/dist/commonjs/parsers/manifest/smooth/shared_smooth_segment_timeline.js +162 -0
- package/dist/commonjs/parsers/manifest/smooth/utils/add_segment_infos.d.ts +38 -0
- package/dist/commonjs/parsers/manifest/smooth/utils/add_segment_infos.js +63 -0
- package/dist/commonjs/parsers/manifest/smooth/utils/parseBoolean.d.ts +20 -0
- package/dist/{_esm5.processed/utils/take_first_set.js → commonjs/parsers/manifest/smooth/utils/parseBoolean.js} +14 -12
- package/dist/commonjs/parsers/manifest/smooth/utils/reduceChildren.d.ts +23 -0
- package/dist/{_esm5.processed/utils/take_first_set.d.ts → commonjs/parsers/manifest/smooth/utils/reduceChildren.js} +16 -7
- package/dist/commonjs/parsers/manifest/smooth/utils/tokens.d.ts +28 -0
- package/dist/commonjs/parsers/manifest/smooth/utils/tokens.js +39 -0
- package/dist/commonjs/parsers/manifest/types.d.ts +378 -0
- package/dist/commonjs/parsers/manifest/types.js +17 -0
- package/dist/commonjs/parsers/manifest/utils/check_manifest_ids.d.ts +25 -0
- package/dist/commonjs/parsers/manifest/utils/check_manifest_ids.js +79 -0
- package/dist/commonjs/parsers/manifest/utils/clear_timeline_from_position.d.ts +24 -0
- package/dist/commonjs/parsers/manifest/utils/clear_timeline_from_position.js +72 -0
- package/dist/commonjs/parsers/manifest/utils/get_first_time_from_adaptation.d.ts +27 -0
- package/dist/commonjs/parsers/manifest/utils/get_first_time_from_adaptation.js +46 -0
- package/dist/commonjs/parsers/manifest/utils/get_last_time_from_adaptation.d.ts +29 -0
- package/dist/commonjs/parsers/manifest/utils/get_last_time_from_adaptation.js +48 -0
- package/dist/commonjs/parsers/manifest/utils/get_maximum_positions.d.ts +24 -0
- package/dist/commonjs/parsers/manifest/utils/get_maximum_positions.js +75 -0
- package/dist/commonjs/parsers/manifest/utils/get_minimum_position.d.ts +21 -0
- package/dist/commonjs/parsers/manifest/utils/get_minimum_position.js +71 -0
- package/dist/commonjs/parsers/manifest/utils/index_helpers.d.ts +88 -0
- package/dist/commonjs/parsers/manifest/utils/index_helpers.js +156 -0
- package/dist/commonjs/parsers/manifest/utils/is_segment_still_available.d.ts +29 -0
- package/dist/commonjs/parsers/manifest/utils/is_segment_still_available.js +54 -0
- package/dist/commonjs/parsers/manifest/utils/update_segment_timeline.d.ts +33 -0
- package/dist/commonjs/parsers/manifest/utils/update_segment_timeline.js +157 -0
- package/dist/commonjs/parsers/texttracks/index.d.ts +16 -0
- package/dist/commonjs/parsers/texttracks/index.js +17 -0
- package/dist/commonjs/parsers/texttracks/sami/html.d.ts +29 -0
- package/dist/commonjs/parsers/texttracks/sami/html.js +207 -0
- package/dist/commonjs/parsers/texttracks/sami/native.d.ts +34 -0
- package/dist/commonjs/parsers/texttracks/sami/native.js +178 -0
- package/dist/commonjs/parsers/texttracks/srt/find_end_of_cue_block.d.ts +29 -0
- package/dist/commonjs/parsers/texttracks/srt/find_end_of_cue_block.js +42 -0
- package/dist/commonjs/parsers/texttracks/srt/get_cue_blocks.d.ts +22 -0
- package/dist/commonjs/parsers/texttracks/srt/get_cue_blocks.js +50 -0
- package/dist/commonjs/parsers/texttracks/srt/html.d.ts +26 -0
- package/dist/commonjs/parsers/texttracks/srt/html.js +156 -0
- package/dist/commonjs/parsers/texttracks/srt/native.d.ts +28 -0
- package/dist/commonjs/parsers/texttracks/srt/native.js +60 -0
- package/dist/commonjs/parsers/texttracks/srt/parse_cue.d.ts +30 -0
- package/dist/commonjs/parsers/texttracks/srt/parse_cue.js +79 -0
- package/dist/commonjs/parsers/texttracks/srt/parse_timestamp.d.ts +21 -0
- package/dist/commonjs/parsers/texttracks/srt/parse_timestamp.js +36 -0
- package/dist/commonjs/parsers/texttracks/ttml/get_parameters.d.ts +32 -0
- package/dist/commonjs/parsers/texttracks/ttml/get_parameters.js +87 -0
- package/dist/commonjs/parsers/texttracks/ttml/get_styling.d.ts +41 -0
- package/dist/commonjs/parsers/texttracks/ttml/get_styling.js +137 -0
- package/dist/commonjs/parsers/texttracks/ttml/get_time_delimiters.d.ts +26 -0
- package/dist/commonjs/parsers/texttracks/ttml/get_time_delimiters.js +44 -0
- package/dist/commonjs/parsers/texttracks/ttml/html/apply_default_ttml_paragraph_style.d.ts +48 -0
- package/dist/commonjs/parsers/texttracks/ttml/html/apply_default_ttml_paragraph_style.js +66 -0
- package/dist/commonjs/parsers/texttracks/ttml/html/apply_extent.d.ts +21 -0
- package/dist/commonjs/parsers/texttracks/ttml/html/apply_extent.js +64 -0
- package/dist/commonjs/parsers/texttracks/ttml/html/apply_font_size.d.ts +21 -0
- package/dist/commonjs/parsers/texttracks/ttml/html/apply_font_size.js +62 -0
- package/dist/commonjs/parsers/texttracks/ttml/html/apply_line_height.d.ts +20 -0
- package/dist/commonjs/parsers/texttracks/ttml/html/apply_line_height.js +47 -0
- package/dist/commonjs/parsers/texttracks/ttml/html/apply_origin.d.ts +20 -0
- package/dist/commonjs/parsers/texttracks/ttml/html/apply_origin.js +63 -0
- package/dist/commonjs/parsers/texttracks/ttml/html/apply_padding.d.ts +20 -0
- package/dist/commonjs/parsers/texttracks/ttml/html/apply_padding.js +142 -0
- package/dist/commonjs/parsers/texttracks/ttml/html/create_element.d.ts +32 -0
- package/dist/commonjs/parsers/texttracks/ttml/html/create_element.js +470 -0
- package/dist/commonjs/parsers/texttracks/ttml/html/generate_css_test_outline.d.ts +26 -0
- package/dist/commonjs/parsers/texttracks/ttml/html/generate_css_test_outline.js +44 -0
- package/dist/commonjs/parsers/texttracks/ttml/html/index.d.ts +21 -0
- package/dist/commonjs/parsers/texttracks/ttml/html/index.js +23 -0
- package/dist/commonjs/parsers/texttracks/ttml/html/parse_cue.d.ts +26 -0
- package/dist/commonjs/parsers/texttracks/ttml/html/parse_cue.js +41 -0
- package/dist/commonjs/parsers/texttracks/ttml/html/parse_ttml_to_div.d.ts +34 -0
- package/dist/commonjs/parsers/texttracks/ttml/html/parse_ttml_to_div.js +53 -0
- package/dist/commonjs/parsers/texttracks/ttml/html/ttml_color_to_css_color.d.ts +21 -0
- package/dist/commonjs/parsers/texttracks/ttml/html/ttml_color_to_css_color.js +60 -0
- package/dist/commonjs/parsers/texttracks/ttml/native/index.d.ts +21 -0
- package/dist/commonjs/parsers/texttracks/ttml/native/index.js +23 -0
- package/dist/commonjs/parsers/texttracks/ttml/native/parse_cue.d.ts +30 -0
- package/dist/commonjs/parsers/texttracks/ttml/native/parse_cue.js +205 -0
- package/dist/commonjs/parsers/texttracks/ttml/native/parse_ttml_to_vtt.d.ts +21 -0
- package/dist/commonjs/parsers/texttracks/ttml/native/parse_ttml_to_vtt.js +36 -0
- package/dist/commonjs/parsers/texttracks/ttml/parse_ttml.d.ts +43 -0
- package/dist/commonjs/parsers/texttracks/ttml/parse_ttml.js +175 -0
- package/dist/commonjs/parsers/texttracks/ttml/regexps.d.ts +28 -0
- package/dist/commonjs/parsers/texttracks/ttml/regexps.js +49 -0
- package/dist/commonjs/parsers/texttracks/ttml/resolve_styles_inheritance.d.ts +49 -0
- package/dist/commonjs/parsers/texttracks/ttml/resolve_styles_inheritance.js +86 -0
- package/dist/commonjs/parsers/texttracks/ttml/time_parsing.d.ts +30 -0
- package/dist/commonjs/parsers/texttracks/ttml/time_parsing.js +126 -0
- package/dist/commonjs/parsers/texttracks/ttml/xml_utils.d.ts +70 -0
- package/dist/commonjs/parsers/texttracks/ttml/xml_utils.js +186 -0
- package/dist/commonjs/parsers/texttracks/types.d.ts +23 -0
- package/dist/commonjs/parsers/texttracks/types.js +17 -0
- package/dist/commonjs/parsers/texttracks/webvtt/get_cue_blocks.d.ts +24 -0
- package/dist/commonjs/parsers/texttracks/webvtt/get_cue_blocks.js +47 -0
- package/dist/commonjs/parsers/texttracks/webvtt/get_style_blocks.d.ts +24 -0
- package/dist/commonjs/parsers/texttracks/webvtt/get_style_blocks.js +54 -0
- package/dist/commonjs/parsers/texttracks/webvtt/html/convert_payload_to_html.d.ts +22 -0
- package/dist/commonjs/parsers/texttracks/webvtt/html/convert_payload_to_html.js +38 -0
- package/dist/commonjs/parsers/texttracks/webvtt/html/create_default_style_elements.d.ts +2 -0
- package/dist/commonjs/parsers/texttracks/webvtt/html/create_default_style_elements.js +25 -0
- package/dist/commonjs/parsers/texttracks/webvtt/html/create_style_attribute.d.ts +21 -0
- package/dist/commonjs/parsers/texttracks/webvtt/html/create_style_attribute.js +178 -0
- package/dist/commonjs/parsers/texttracks/webvtt/html/create_styled_element.d.ts +25 -0
- package/dist/commonjs/parsers/texttracks/webvtt/html/create_styled_element.js +86 -0
- package/dist/commonjs/parsers/texttracks/webvtt/html/index.d.ts +22 -0
- package/dist/commonjs/parsers/texttracks/webvtt/html/index.js +23 -0
- package/dist/commonjs/parsers/texttracks/webvtt/html/parse_style_block.d.ts +27 -0
- package/dist/commonjs/parsers/texttracks/webvtt/html/parse_style_block.js +75 -0
- package/dist/commonjs/parsers/texttracks/webvtt/html/parse_webvtt_to_div.d.ts +31 -0
- package/dist/commonjs/parsers/texttracks/webvtt/html/parse_webvtt_to_div.js +58 -0
- package/dist/commonjs/parsers/texttracks/webvtt/html/to_html.d.ts +43 -0
- package/dist/commonjs/parsers/texttracks/webvtt/html/to_html.js +73 -0
- package/dist/commonjs/parsers/texttracks/webvtt/native/index.d.ts +21 -0
- package/dist/commonjs/parsers/texttracks/webvtt/native/index.js +23 -0
- package/dist/commonjs/parsers/texttracks/webvtt/native/parse_vtt_to_cues.d.ts +28 -0
- package/dist/commonjs/parsers/texttracks/webvtt/native/parse_vtt_to_cues.js +61 -0
- package/dist/commonjs/parsers/texttracks/webvtt/native/set_settings_on_cue.d.ts +23 -0
- package/dist/commonjs/parsers/texttracks/webvtt/native/set_settings_on_cue.js +83 -0
- package/dist/commonjs/parsers/texttracks/webvtt/native/to_native_cue.d.ts +25 -0
- package/dist/commonjs/parsers/texttracks/webvtt/native/to_native_cue.js +28 -0
- package/dist/commonjs/parsers/texttracks/webvtt/parse_cue_block.d.ts +33 -0
- package/dist/commonjs/parsers/texttracks/webvtt/parse_cue_block.js +99 -0
- package/dist/commonjs/parsers/texttracks/webvtt/parse_timestamp.d.ts +21 -0
- package/dist/commonjs/parsers/texttracks/webvtt/parse_timestamp.js +37 -0
- package/dist/commonjs/parsers/texttracks/webvtt/utils.d.ts +56 -0
- package/dist/commonjs/parsers/texttracks/webvtt/utils.js +121 -0
- package/dist/commonjs/public_types.d.ts +825 -0
- package/dist/commonjs/public_types.js +17 -0
- package/dist/commonjs/tools/TextTrackRenderer/index.d.ts +22 -0
- package/dist/commonjs/tools/TextTrackRenderer/index.js +29 -0
- package/dist/commonjs/tools/TextTrackRenderer/text_track_renderer.d.ts +70 -0
- package/dist/commonjs/tools/TextTrackRenderer/text_track_renderer.js +81 -0
- package/dist/commonjs/tools/index.d.ts +18 -0
- package/dist/commonjs/tools/index.js +21 -0
- package/dist/commonjs/tools/string_utils/index.d.ts +16 -0
- package/dist/commonjs/tools/string_utils/index.js +25 -0
- package/dist/commonjs/transports/dash/add_segment_integrity_checks_to_loader.d.ts +24 -0
- package/dist/commonjs/transports/dash/add_segment_integrity_checks_to_loader.js +96 -0
- package/dist/commonjs/transports/dash/construct_segment_url.d.ts +18 -0
- package/{src/typings/globals.d.ts → dist/commonjs/transports/dash/construct_segment_url.js} +8 -20
- package/dist/commonjs/transports/dash/extract_complete_chunks.d.ts +24 -0
- package/dist/commonjs/transports/dash/extract_complete_chunks.js +62 -0
- package/dist/commonjs/transports/dash/get_events_out_of_emsgs.d.ts +28 -0
- package/dist/commonjs/transports/dash/get_events_out_of_emsgs.js +95 -0
- package/dist/commonjs/transports/dash/index.d.ts +21 -0
- package/dist/commonjs/transports/dash/index.js +23 -0
- package/dist/commonjs/transports/dash/init_segment_loader.d.ts +28 -0
- package/dist/commonjs/transports/dash/init_segment_loader.js +87 -0
- package/dist/commonjs/transports/dash/low_latency_segment_loader.d.ts +30 -0
- package/dist/commonjs/transports/dash/low_latency_segment_loader.js +67 -0
- package/dist/commonjs/transports/dash/manifest_parser.d.ts +18 -0
- package/dist/commonjs/transports/dash/manifest_parser.js +280 -0
- package/dist/commonjs/transports/dash/pipelines.d.ts +23 -0
- package/dist/commonjs/transports/dash/pipelines.js +58 -0
- package/dist/commonjs/transports/dash/segment_loader.d.ts +38 -0
- package/dist/commonjs/transports/dash/segment_loader.js +173 -0
- package/dist/commonjs/transports/dash/segment_parser.d.ts +23 -0
- package/dist/commonjs/transports/dash/segment_parser.js +127 -0
- package/dist/commonjs/transports/dash/text_loader.d.ts +25 -0
- package/dist/commonjs/transports/dash/text_loader.js +85 -0
- package/dist/commonjs/transports/dash/text_parser.d.ts +25 -0
- package/dist/commonjs/transports/dash/text_parser.js +167 -0
- package/dist/commonjs/transports/index.d.ts +16 -0
- package/dist/commonjs/transports/index.js +32 -0
- package/dist/commonjs/transports/local/index.d.ts +17 -0
- package/dist/commonjs/transports/local/index.js +19 -0
- package/dist/commonjs/transports/local/pipelines.d.ts +22 -0
- package/dist/commonjs/transports/local/pipelines.js +68 -0
- package/dist/commonjs/transports/local/segment_loader.d.ts +28 -0
- package/dist/commonjs/transports/local/segment_loader.js +147 -0
- package/dist/commonjs/transports/local/segment_parser.d.ts +20 -0
- package/dist/commonjs/transports/local/segment_parser.js +72 -0
- package/dist/commonjs/transports/local/text_parser.d.ts +27 -0
- package/dist/commonjs/transports/local/text_parser.js +134 -0
- package/dist/commonjs/transports/metaplaylist/index.d.ts +21 -0
- package/dist/commonjs/transports/metaplaylist/index.js +23 -0
- package/dist/commonjs/transports/metaplaylist/manifest_loader.d.ts +26 -0
- package/dist/commonjs/transports/metaplaylist/manifest_loader.js +44 -0
- package/dist/commonjs/transports/metaplaylist/pipelines.d.ts +17 -0
- package/dist/commonjs/transports/metaplaylist/pipelines.js +240 -0
- package/dist/commonjs/transports/smooth/extract_timings_infos.d.ts +62 -0
- package/dist/commonjs/transports/smooth/extract_timings_infos.js +81 -0
- package/dist/commonjs/transports/smooth/index.d.ts +21 -0
- package/dist/commonjs/transports/smooth/index.js +23 -0
- package/dist/commonjs/transports/smooth/isobmff/create_audio_init_segment.d.ts +29 -0
- package/dist/commonjs/transports/smooth/isobmff/create_audio_init_segment.js +55 -0
- package/dist/commonjs/transports/smooth/isobmff/create_boxes.d.ts +171 -0
- package/dist/commonjs/transports/smooth/isobmff/create_boxes.js +378 -0
- package/dist/commonjs/transports/smooth/isobmff/create_init_segment.d.ts +33 -0
- package/dist/commonjs/transports/smooth/isobmff/create_init_segment.js +68 -0
- package/dist/commonjs/transports/smooth/isobmff/create_traf_box.d.ts +16 -0
- package/dist/commonjs/transports/smooth/isobmff/create_traf_box.js +27 -0
- package/dist/commonjs/transports/smooth/isobmff/create_video_init_segment.d.ts +29 -0
- package/dist/commonjs/transports/smooth/isobmff/create_video_init_segment.js +76 -0
- package/dist/commonjs/transports/smooth/isobmff/get_aaces_header.d.ts +27 -0
- package/dist/commonjs/transports/smooth/isobmff/get_aaces_header.js +58 -0
- package/dist/commonjs/transports/smooth/isobmff/index.d.ts +21 -0
- package/dist/commonjs/transports/smooth/isobmff/index.js +28 -0
- package/dist/commonjs/transports/smooth/isobmff/parse_tfrf.d.ts +24 -0
- package/dist/commonjs/transports/smooth/isobmff/parse_tfrf.js +50 -0
- package/dist/commonjs/transports/smooth/isobmff/parse_tfxd.d.ts +24 -0
- package/dist/commonjs/transports/smooth/isobmff/parse_tfxd.js +34 -0
- package/dist/commonjs/transports/smooth/isobmff/patch_segment.d.ts +23 -0
- package/dist/commonjs/transports/smooth/isobmff/patch_segment.js +130 -0
- package/dist/commonjs/transports/smooth/pipelines.d.ts +17 -0
- package/dist/commonjs/transports/smooth/pipelines.js +287 -0
- package/dist/commonjs/transports/smooth/segment_loader.d.ts +27 -0
- package/dist/commonjs/transports/smooth/segment_loader.js +206 -0
- package/dist/commonjs/transports/smooth/utils.d.ts +26 -0
- package/dist/commonjs/transports/smooth/utils.js +36 -0
- package/dist/commonjs/transports/types.d.ts +701 -0
- package/dist/commonjs/transports/types.js +17 -0
- package/dist/commonjs/transports/utils/byte_range.d.ts +21 -0
- package/dist/commonjs/transports/utils/byte_range.js +44 -0
- package/dist/commonjs/transports/utils/call_custom_manifest_loader.d.ts +19 -0
- package/dist/commonjs/transports/utils/call_custom_manifest_loader.js +95 -0
- package/dist/commonjs/transports/utils/check_isobmff_integrity.d.ts +23 -0
- package/dist/commonjs/transports/utils/check_isobmff_integrity.js +49 -0
- package/dist/commonjs/transports/utils/find_complete_box.d.ts +25 -0
- package/dist/commonjs/transports/utils/find_complete_box.js +56 -0
- package/dist/commonjs/transports/utils/generate_manifest_loader.d.ts +26 -0
- package/dist/commonjs/transports/utils/generate_manifest_loader.js +62 -0
- package/dist/commonjs/transports/utils/get_isobmff_timing_infos.d.ts +29 -0
- package/dist/commonjs/transports/utils/get_isobmff_timing_infos.js +69 -0
- package/dist/commonjs/transports/utils/infer_segment_container.d.ts +29 -0
- package/dist/commonjs/transports/utils/infer_segment_container.js +47 -0
- package/dist/commonjs/transports/utils/parse_text_track.d.ts +56 -0
- package/dist/commonjs/transports/utils/parse_text_track.js +142 -0
- package/dist/commonjs/utils/are_arrays_of_numbers_equal.d.ts +22 -0
- package/dist/commonjs/utils/are_arrays_of_numbers_equal.js +38 -0
- package/dist/commonjs/utils/are_codecs_compatible.d.ts +25 -0
- package/dist/commonjs/utils/are_codecs_compatible.js +62 -0
- package/dist/commonjs/utils/array_find.d.ts +23 -0
- package/dist/commonjs/utils/array_find.js +38 -0
- package/dist/commonjs/utils/array_find_index.d.ts +23 -0
- package/dist/commonjs/utils/array_find_index.js +37 -0
- package/dist/commonjs/utils/array_includes.d.ts +53 -0
- package/dist/commonjs/utils/array_includes.js +86 -0
- package/dist/commonjs/utils/assert.d.ts +34 -0
- package/dist/commonjs/utils/assert.js +57 -0
- package/dist/commonjs/utils/assert_unreachable.d.ts +40 -0
- package/dist/commonjs/utils/assert_unreachable.js +46 -0
- package/dist/commonjs/utils/base64.d.ts +14 -0
- package/dist/commonjs/utils/base64.js +152 -0
- package/dist/commonjs/utils/byte_parsing.d.ts +123 -0
- package/dist/commonjs/utils/byte_parsing.js +248 -0
- package/dist/commonjs/utils/cancellable_sleep.d.ts +30 -0
- package/dist/commonjs/utils/cancellable_sleep.js +38 -0
- package/dist/commonjs/utils/create_cancellable_promise.d.ts +26 -0
- package/dist/commonjs/utils/create_cancellable_promise.js +55 -0
- package/dist/commonjs/utils/deep_merge.d.ts +9 -0
- package/dist/commonjs/utils/deep_merge.js +73 -0
- package/dist/commonjs/utils/event_emitter.d.ts +62 -0
- package/dist/commonjs/utils/event_emitter.js +105 -0
- package/dist/commonjs/utils/flat_map.d.ts +22 -0
- package/dist/commonjs/utils/flat_map.js +65 -0
- package/dist/commonjs/utils/get_fuzzed_delay.d.ts +21 -0
- package/dist/commonjs/utils/get_fuzzed_delay.js +28 -0
- package/dist/commonjs/utils/hash_buffer.d.ts +32 -0
- package/dist/commonjs/utils/hash_buffer.js +44 -0
- package/dist/commonjs/utils/id_generator.d.ts +21 -0
- package/dist/commonjs/utils/id_generator.js +36 -0
- package/dist/commonjs/utils/initialization_segment_cache.d.ts +42 -0
- package/dist/commonjs/utils/initialization_segment_cache.js +53 -0
- package/dist/commonjs/utils/is_non_empty_string.d.ts +20 -0
- package/dist/commonjs/utils/is_non_empty_string.js +25 -0
- package/dist/commonjs/utils/is_null_or_undefined.d.ts +24 -0
- package/dist/commonjs/utils/is_null_or_undefined.js +29 -0
- package/dist/commonjs/utils/languages/ISO_639-1_to_ISO_639-3.d.ts +22 -0
- package/dist/commonjs/utils/languages/ISO_639-1_to_ISO_639-3.js +207 -0
- package/dist/commonjs/utils/languages/ISO_639-2_to_ISO_639-3.d.ts +22 -0
- package/dist/commonjs/utils/languages/ISO_639-2_to_ISO_639-3.js +43 -0
- package/dist/commonjs/utils/languages/index.d.ts +18 -0
- package/dist/commonjs/utils/languages/index.js +22 -0
- package/dist/commonjs/utils/languages/normalize.d.ts +68 -0
- package/dist/commonjs/utils/languages/normalize.js +121 -0
- package/dist/commonjs/utils/logger.d.ts +46 -0
- package/dist/commonjs/utils/logger.js +81 -0
- package/dist/commonjs/utils/noop.d.ts +23 -0
- package/dist/commonjs/utils/noop.js +28 -0
- package/dist/commonjs/utils/object_assign.d.ts +22 -0
- package/dist/commonjs/utils/object_assign.js +46 -0
- package/dist/commonjs/utils/object_values.d.ts +30 -0
- package/dist/commonjs/utils/object_values.js +29 -0
- package/dist/commonjs/utils/ranges.d.ts +212 -0
- package/dist/commonjs/utils/ranges.js +527 -0
- package/dist/commonjs/utils/reference.d.ts +214 -0
- package/dist/commonjs/utils/reference.js +339 -0
- package/dist/commonjs/utils/request/fetch.d.ts +76 -0
- package/dist/commonjs/utils/request/fetch.js +188 -0
- package/dist/commonjs/utils/request/index.d.ts +19 -0
- package/dist/commonjs/utils/request/index.js +24 -0
- package/dist/commonjs/utils/request/xhr.d.ts +95 -0
- package/dist/commonjs/utils/request/xhr.js +156 -0
- package/dist/commonjs/utils/resolve_url.d.ts +35 -0
- package/dist/commonjs/utils/resolve_url.js +121 -0
- package/dist/commonjs/utils/retry_promise_with_backoff.d.ts +46 -0
- package/dist/commonjs/utils/retry_promise_with_backoff.js +122 -0
- package/dist/commonjs/utils/sleep.d.ts +10 -0
- package/dist/commonjs/utils/sleep.js +17 -0
- package/dist/commonjs/utils/slice_uint8array.d.ts +27 -0
- package/dist/commonjs/utils/slice_uint8array.js +44 -0
- package/dist/commonjs/utils/sorted_list.d.ts +127 -0
- package/dist/commonjs/utils/sorted_list.js +185 -0
- package/dist/commonjs/utils/starts_with.d.ts +26 -0
- package/dist/commonjs/utils/starts_with.js +39 -0
- package/dist/commonjs/utils/string_parsing.d.ts +88 -0
- package/dist/commonjs/utils/string_parsing.js +385 -0
- package/dist/commonjs/utils/task_canceller.d.ts +263 -0
- package/dist/commonjs/utils/task_canceller.js +344 -0
- package/dist/commonjs/utils/warn_once.d.ts +23 -0
- package/dist/commonjs/utils/warn_once.js +34 -0
- package/dist/commonjs/utils/weak_map_memory.d.ts +70 -0
- package/dist/commonjs/utils/weak_map_memory.js +88 -0
- package/dist/commonjs/utils/wrapInPromise.d.ts +7 -0
- package/dist/commonjs/utils/wrapInPromise.js +25 -0
- package/dist/es2017/compat/add_class_name.d.ts +22 -0
- package/dist/es2017/compat/add_class_name.js +39 -0
- package/dist/es2017/compat/add_text_track.d.ts +31 -0
- package/dist/es2017/compat/add_text_track.js +47 -0
- package/dist/es2017/compat/browser_compatibility_types.d.ts +164 -0
- package/dist/es2017/compat/browser_compatibility_types.js +33 -0
- package/dist/es2017/compat/browser_detection.d.ts +42 -0
- package/dist/es2017/compat/browser_detection.js +104 -0
- package/dist/es2017/compat/browser_version.d.ts +24 -0
- package/dist/es2017/compat/browser_version.js +41 -0
- package/dist/es2017/compat/can_patch_isobmff.d.ts +25 -0
- package/dist/es2017/compat/can_patch_isobmff.js +28 -0
- package/dist/es2017/compat/can_rely_on_video_visibility_and_size.d.ts +37 -0
- package/dist/es2017/compat/can_rely_on_video_visibility_and_size.js +49 -0
- package/dist/es2017/compat/can_reuse_media_keys.d.ts +13 -0
- package/dist/es2017/compat/can_reuse_media_keys.js +16 -0
- package/dist/es2017/compat/change_source_buffer_type.d.ts +48 -0
- package/dist/es2017/compat/change_source_buffer_type.js +37 -0
- package/dist/es2017/compat/clear_element_src.d.ts +20 -0
- package/dist/es2017/compat/clear_element_src.js +53 -0
- package/dist/es2017/compat/eme/close_session.d.ts +30 -0
- package/dist/es2017/compat/eme/close_session.js +98 -0
- package/dist/es2017/compat/eme/constants.d.ts +16 -0
- package/dist/es2017/compat/eme/constants.js +19 -0
- package/dist/es2017/compat/eme/custom_key_system_access.d.ts +54 -0
- package/dist/es2017/compat/eme/custom_key_system_access.js +40 -0
- package/dist/es2017/compat/eme/custom_media_keys/ie11_media_keys.d.ts +31 -0
- package/dist/es2017/compat/eme/custom_media_keys/ie11_media_keys.js +142 -0
- package/dist/es2017/compat/eme/custom_media_keys/index.d.ts +7 -0
- package/dist/es2017/compat/eme/custom_media_keys/index.js +6 -0
- package/dist/es2017/compat/eme/custom_media_keys/moz_media_keys_constructor.d.ts +27 -0
- package/dist/es2017/compat/eme/custom_media_keys/moz_media_keys_constructor.js +61 -0
- package/dist/es2017/compat/eme/custom_media_keys/ms_media_keys_constructor.d.ts +43 -0
- package/dist/es2017/compat/eme/custom_media_keys/ms_media_keys_constructor.js +28 -0
- package/dist/es2017/compat/eme/custom_media_keys/old_webkit_media_keys.d.ts +41 -0
- package/dist/es2017/compat/eme/custom_media_keys/old_webkit_media_keys.js +169 -0
- package/dist/es2017/compat/eme/custom_media_keys/types.d.ts +43 -0
- package/dist/es2017/compat/eme/custom_media_keys/types.js +16 -0
- package/dist/es2017/compat/eme/custom_media_keys/webkit_media_keys.d.ts +37 -0
- package/dist/es2017/compat/eme/custom_media_keys/webkit_media_keys.js +231 -0
- package/dist/es2017/compat/eme/custom_media_keys/webkit_media_keys_constructor.d.ts +22 -0
- package/dist/es2017/compat/eme/custom_media_keys/webkit_media_keys_constructor.js +30 -0
- package/dist/es2017/compat/eme/eme-api-implementation.d.ts +78 -0
- package/dist/es2017/compat/eme/eme-api-implementation.js +196 -0
- package/dist/es2017/compat/eme/generate_key_request.d.ts +54 -0
- package/dist/es2017/compat/eme/generate_key_request.js +147 -0
- package/dist/es2017/compat/eme/get_init_data.d.ts +57 -0
- package/dist/es2017/compat/eme/get_init_data.js +112 -0
- package/dist/es2017/compat/eme/get_uuid_kid_from_keystatus_kid.d.ts +23 -0
- package/dist/es2017/compat/eme/get_uuid_kid_from_keystatus_kid.js +31 -0
- package/dist/es2017/compat/eme/get_webkit_fairplay_initdata.d.ts +25 -0
- package/dist/es2017/compat/eme/get_webkit_fairplay_initdata.js +57 -0
- package/dist/es2017/compat/eme/index.d.ts +24 -0
- package/dist/es2017/compat/eme/index.js +22 -0
- package/dist/es2017/compat/eme/load_session.d.ts +30 -0
- package/dist/es2017/compat/eme/load_session.js +53 -0
- package/dist/es2017/compat/enable_audio_track.d.ts +11 -0
- package/dist/es2017/compat/enable_audio_track.js +26 -0
- package/dist/es2017/compat/event_listeners.d.ts +173 -0
- package/dist/es2017/compat/event_listeners.js +428 -0
- package/dist/es2017/compat/get_start_date.d.ts +30 -0
- package/dist/es2017/compat/get_start_date.js +44 -0
- package/dist/es2017/compat/global_scope.d.ts +9 -0
- package/dist/es2017/compat/global_scope.js +13 -0
- package/dist/es2017/compat/has_issues_with_high_media_source_duration.d.ts +21 -0
- package/dist/es2017/compat/has_issues_with_high_media_source_duration.js +26 -0
- package/dist/es2017/compat/index.d.ts +37 -0
- package/dist/es2017/compat/index.js +43 -0
- package/dist/es2017/compat/is_codec_supported.d.ts +25 -0
- package/dist/es2017/compat/is_codec_supported.js +36 -0
- package/dist/es2017/compat/is_debug_mode_enabled.d.ts +7 -0
- package/dist/es2017/compat/is_debug_mode_enabled.js +9 -0
- package/dist/es2017/compat/is_node.d.ts +18 -0
- package/dist/es2017/compat/is_node.js +19 -0
- package/dist/es2017/compat/is_seeking_approximate.d.ts +28 -0
- package/dist/es2017/compat/is_seeking_approximate.js +29 -0
- package/dist/es2017/compat/is_vtt_cue.d.ts +22 -0
- package/dist/es2017/compat/is_vtt_cue.js +26 -0
- package/dist/es2017/compat/is_worker.d.ts +5 -0
- package/dist/es2017/compat/is_worker.js +5 -0
- package/dist/es2017/compat/make_vtt_cue.d.ts +26 -0
- package/dist/es2017/compat/make_vtt_cue.js +44 -0
- package/dist/es2017/compat/on_height_width_change.d.ts +33 -0
- package/dist/es2017/compat/on_height_width_change.js +72 -0
- package/dist/es2017/compat/patch_webkit_source_buffer.d.ts +16 -0
- package/dist/es2017/compat/patch_webkit_source_buffer.js +74 -0
- package/dist/es2017/compat/remove_cue.d.ts +21 -0
- package/dist/es2017/compat/remove_cue.js +63 -0
- package/dist/es2017/compat/should_favour_custom_safari_EME.d.ts +23 -0
- package/dist/es2017/compat/should_favour_custom_safari_EME.js +27 -0
- package/dist/es2017/compat/should_reload_media_source_on_decipherability_update.d.ts +26 -0
- package/dist/es2017/compat/should_reload_media_source_on_decipherability_update.js +29 -0
- package/dist/es2017/compat/should_renew_media_key_system_access.d.ts +21 -0
- package/dist/es2017/compat/should_renew_media_key_system_access.js +24 -0
- package/dist/es2017/compat/should_unset_media_keys.d.ts +22 -0
- package/dist/es2017/compat/should_unset_media_keys.js +25 -0
- package/dist/es2017/compat/should_validate_metadata.d.ts +22 -0
- package/{scripts/build/constants.d.ts → dist/es2017/compat/should_validate_metadata.js} +9 -15
- package/dist/es2017/compat/should_wait_for_data_before_loaded.d.ts +24 -0
- package/dist/es2017/compat/should_wait_for_data_before_loaded.js +30 -0
- package/dist/es2017/compat/should_wait_for_have_enough_data.d.ts +13 -0
- package/dist/es2017/compat/should_wait_for_have_enough_data.js +16 -0
- package/dist/es2017/config.d.ts +179 -0
- package/dist/es2017/config.js +31 -0
- package/dist/es2017/core/adaptive/adaptive_representation_selector.d.ts +306 -0
- package/dist/es2017/core/adaptive/adaptive_representation_selector.js +386 -0
- package/dist/es2017/core/adaptive/buffer_based_chooser.d.ts +89 -0
- package/dist/es2017/core/adaptive/buffer_based_chooser.js +191 -0
- package/dist/es2017/core/adaptive/guess_based_chooser.d.ts +95 -0
- package/dist/es2017/core/adaptive/guess_based_chooser.js +233 -0
- package/dist/es2017/core/adaptive/index.d.ts +18 -0
- package/dist/es2017/core/adaptive/index.js +17 -0
- package/dist/es2017/core/adaptive/network_analyzer.d.ts +73 -0
- package/dist/es2017/core/adaptive/network_analyzer.js +333 -0
- package/dist/es2017/core/adaptive/utils/bandwidth_estimator.d.ts +47 -0
- package/dist/es2017/core/adaptive/utils/bandwidth_estimator.js +68 -0
- package/dist/es2017/core/adaptive/utils/ewma.d.ts +39 -0
- package/dist/es2017/core/adaptive/utils/ewma.js +50 -0
- package/dist/es2017/core/adaptive/utils/filter_by_bitrate.d.ts +25 -0
- package/dist/es2017/core/adaptive/utils/filter_by_bitrate.js +37 -0
- package/dist/es2017/core/adaptive/utils/filter_by_resolution.d.ts +31 -0
- package/dist/{_esm5.processed → es2017}/core/adaptive/utils/filter_by_resolution.js +4 -9
- package/dist/es2017/core/adaptive/utils/get_buffer_levels.d.ts +24 -0
- package/dist/es2017/core/adaptive/utils/get_buffer_levels.js +47 -0
- package/dist/es2017/core/adaptive/utils/last_estimate_storage.d.ts +61 -0
- package/dist/es2017/core/adaptive/utils/last_estimate_storage.js +35 -0
- package/dist/es2017/core/adaptive/utils/pending_requests_store.d.ts +110 -0
- package/dist/es2017/core/adaptive/utils/pending_requests_store.js +76 -0
- package/dist/es2017/core/adaptive/utils/representation_score_calculator.d.ts +104 -0
- package/dist/es2017/core/adaptive/utils/representation_score_calculator.js +113 -0
- package/dist/es2017/core/adaptive/utils/select_optimal_representation.d.ts +27 -0
- package/dist/es2017/core/adaptive/utils/select_optimal_representation.js +36 -0
- package/dist/es2017/core/api/debug/buffer_graph.d.ts +28 -0
- package/dist/es2017/core/api/debug/buffer_graph.js +173 -0
- package/dist/es2017/core/api/debug/buffer_size_graph.d.ts +10 -0
- package/dist/es2017/core/api/debug/buffer_size_graph.js +103 -0
- package/dist/es2017/core/api/debug/constants.d.ts +2 -0
- package/dist/es2017/core/api/debug/constants.js +2 -0
- package/dist/es2017/core/api/debug/index.d.ts +2 -0
- package/dist/es2017/core/api/debug/index.js +2 -0
- package/dist/es2017/core/api/debug/modules/general_info.d.ts +3 -0
- package/dist/es2017/core/api/debug/modules/general_info.js +169 -0
- package/dist/es2017/core/api/debug/modules/segment_buffer_content.d.ts +4 -0
- package/dist/es2017/core/api/debug/modules/segment_buffer_content.js +121 -0
- package/dist/es2017/core/api/debug/modules/segment_buffer_size.d.ts +3 -0
- package/dist/es2017/core/api/debug/modules/segment_buffer_size.js +35 -0
- package/dist/es2017/core/api/debug/render.d.ts +3 -0
- package/dist/es2017/core/api/debug/render.js +32 -0
- package/dist/es2017/core/api/debug/utils.d.ts +39 -0
- package/dist/es2017/core/api/debug/utils.js +54 -0
- package/dist/es2017/core/api/index.d.ts +20 -0
- package/dist/es2017/core/api/index.js +19 -0
- package/dist/es2017/core/api/option_utils.d.ts +119 -0
- package/dist/es2017/core/api/option_utils.js +299 -0
- package/dist/es2017/core/api/playback_observer.d.ts +370 -0
- package/dist/es2017/core/api/playback_observer.js +591 -0
- package/dist/es2017/core/api/public_api.d.ts +718 -0
- package/dist/es2017/core/api/public_api.js +2101 -0
- package/dist/es2017/core/api/track_management/index.d.ts +18 -0
- package/dist/es2017/core/api/track_management/index.js +18 -0
- package/dist/es2017/core/api/track_management/media_element_tracks_store.d.ts +197 -0
- package/dist/{_esm5.processed → es2017}/core/api/track_management/media_element_tracks_store.js +11 -14
- package/dist/es2017/core/api/track_management/track_dispatcher.d.ts +96 -0
- package/dist/{_esm5.processed → es2017}/core/api/track_management/track_dispatcher.js +8 -11
- package/dist/es2017/core/api/track_management/tracks_store.d.ts +429 -0
- package/dist/{_esm5.processed → es2017}/core/api/track_management/tracks_store.js +50 -53
- package/dist/es2017/core/api/utils.d.ts +66 -0
- package/dist/es2017/core/api/utils.js +167 -0
- package/dist/es2017/core/decrypt/__tests__/__global__/utils.d.ts +178 -0
- package/dist/es2017/core/decrypt/__tests__/__global__/utils.js +363 -0
- package/dist/es2017/core/decrypt/attach_media_keys.d.ts +52 -0
- package/dist/es2017/core/decrypt/attach_media_keys.js +71 -0
- package/dist/es2017/core/decrypt/clear_on_stop.d.ts +22 -0
- package/dist/es2017/core/decrypt/clear_on_stop.js +40 -0
- package/dist/es2017/core/decrypt/content_decryptor.d.ts +184 -0
- package/dist/es2017/core/decrypt/content_decryptor.js +846 -0
- package/dist/es2017/core/decrypt/create_or_load_session.d.ts +63 -0
- package/dist/es2017/core/decrypt/create_or_load_session.js +75 -0
- package/dist/es2017/core/decrypt/create_session.d.ts +53 -0
- package/dist/es2017/core/decrypt/create_session.js +150 -0
- package/dist/es2017/core/decrypt/dispose_decryption_resources.d.ts +21 -0
- package/dist/es2017/core/decrypt/dispose_decryption_resources.js +42 -0
- package/dist/es2017/core/decrypt/find_key_system.d.ts +48 -0
- package/dist/es2017/core/decrypt/find_key_system.js +281 -0
- package/dist/es2017/core/decrypt/get_key_system_configuration.d.ts +22 -0
- package/dist/es2017/core/decrypt/get_key_system_configuration.js +32 -0
- package/dist/es2017/core/decrypt/get_media_keys.d.ts +44 -0
- package/dist/es2017/core/decrypt/get_media_keys.js +104 -0
- package/dist/es2017/core/decrypt/index.d.ts +26 -0
- package/dist/es2017/core/decrypt/index.js +26 -0
- package/dist/es2017/core/decrypt/init_media_keys.d.ts +26 -0
- package/dist/es2017/core/decrypt/init_media_keys.js +37 -0
- package/dist/es2017/core/decrypt/session_events_listener.d.ts +75 -0
- package/dist/es2017/core/decrypt/session_events_listener.js +249 -0
- package/dist/es2017/core/decrypt/set_server_certificate.d.ts +51 -0
- package/dist/es2017/core/decrypt/set_server_certificate.js +83 -0
- package/dist/es2017/core/decrypt/types.d.ts +368 -0
- package/dist/es2017/core/decrypt/types.js +55 -0
- package/dist/es2017/core/decrypt/utils/are_init_values_compatible.d.ts +34 -0
- package/dist/es2017/core/decrypt/utils/are_init_values_compatible.js +113 -0
- package/dist/es2017/core/decrypt/utils/check_key_statuses.d.ts +52 -0
- package/dist/es2017/core/decrypt/utils/check_key_statuses.js +165 -0
- package/dist/es2017/core/decrypt/utils/clean_old_loaded_sessions.d.ts +26 -0
- package/dist/es2017/core/decrypt/utils/clean_old_loaded_sessions.js +39 -0
- package/dist/es2017/core/decrypt/utils/clean_old_stored_persistent_info.d.ts +32 -0
- package/dist/es2017/core/decrypt/utils/clean_old_stored_persistent_info.js +40 -0
- package/dist/es2017/core/decrypt/utils/get_drm_system_id.d.ts +20 -0
- package/dist/es2017/core/decrypt/utils/get_drm_system_id.js +37 -0
- package/dist/es2017/core/decrypt/utils/init_data_values_container.d.ts +69 -0
- package/dist/es2017/core/decrypt/utils/init_data_values_container.js +96 -0
- package/dist/es2017/core/decrypt/utils/is_session_usable.d.ts +24 -0
- package/dist/es2017/core/decrypt/utils/is_session_usable.js +49 -0
- package/dist/es2017/core/decrypt/utils/key_id_comparison.d.ts +31 -0
- package/dist/es2017/core/decrypt/utils/key_id_comparison.js +48 -0
- package/dist/es2017/core/decrypt/utils/key_session_record.d.ts +104 -0
- package/dist/es2017/core/decrypt/utils/key_session_record.js +153 -0
- package/dist/es2017/core/decrypt/utils/loaded_sessions_store.d.ts +215 -0
- package/dist/es2017/core/decrypt/utils/loaded_sessions_store.js +365 -0
- package/dist/es2017/core/decrypt/utils/media_keys_infos_store.d.ts +56 -0
- package/dist/es2017/core/decrypt/utils/media_keys_infos_store.js +44 -0
- package/dist/es2017/core/decrypt/utils/persistent_sessions_store.d.ts +94 -0
- package/dist/es2017/core/decrypt/utils/persistent_sessions_store.js +321 -0
- package/dist/es2017/core/decrypt/utils/serializable_bytes.d.ts +44 -0
- package/dist/es2017/core/decrypt/utils/serializable_bytes.js +46 -0
- package/dist/es2017/core/decrypt/utils/server_certificate_store.d.ts +64 -0
- package/dist/es2017/core/decrypt/utils/server_certificate_store.js +112 -0
- package/dist/es2017/core/fetchers/cdn_prioritizer.d.ts +107 -0
- package/dist/es2017/core/fetchers/cdn_prioritizer.js +155 -0
- package/dist/es2017/core/fetchers/index.d.ts +18 -0
- package/dist/es2017/core/fetchers/index.js +18 -0
- package/dist/es2017/core/fetchers/manifest/index.d.ts +18 -0
- package/dist/es2017/core/fetchers/manifest/index.js +17 -0
- package/dist/es2017/core/fetchers/manifest/manifest_fetcher.d.ts +221 -0
- package/dist/es2017/core/fetchers/manifest/manifest_fetcher.js +523 -0
- package/dist/es2017/core/fetchers/segment/index.d.ts +19 -0
- package/dist/es2017/core/fetchers/segment/index.js +17 -0
- package/dist/es2017/core/fetchers/segment/prioritized_segment_fetcher.d.ts +38 -0
- package/dist/es2017/core/fetchers/segment/prioritized_segment_fetcher.js +67 -0
- package/dist/es2017/core/fetchers/segment/segment_fetcher.d.ts +148 -0
- package/dist/es2017/core/fetchers/segment/segment_fetcher.js +295 -0
- package/dist/es2017/core/fetchers/segment/segment_fetcher_creator.d.ts +77 -0
- package/dist/es2017/core/fetchers/segment/segment_fetcher_creator.js +56 -0
- package/dist/es2017/core/fetchers/segment/task_prioritizer.d.ts +145 -0
- package/dist/es2017/core/fetchers/segment/task_prioritizer.js +319 -0
- package/dist/es2017/core/fetchers/utils/error_selector.d.ts +23 -0
- package/dist/es2017/core/fetchers/utils/error_selector.js +31 -0
- package/dist/es2017/core/fetchers/utils/schedule_request.d.ts +98 -0
- package/dist/es2017/core/fetchers/utils/schedule_request.js +332 -0
- package/dist/es2017/core/init/directfile_content_initializer.d.ts +97 -0
- package/dist/es2017/core/init/directfile_content_initializer.js +210 -0
- package/dist/es2017/core/init/index.d.ts +16 -0
- package/dist/es2017/core/init/index.js +16 -0
- package/dist/es2017/core/init/media_source_content_initializer.d.ts +174 -0
- package/dist/es2017/core/init/media_source_content_initializer.js +565 -0
- package/dist/es2017/core/init/types.d.ts +217 -0
- package/dist/es2017/core/init/types.js +30 -0
- package/dist/es2017/core/init/utils/content_time_boundaries_observer.d.ts +191 -0
- package/dist/es2017/core/init/utils/content_time_boundaries_observer.js +468 -0
- package/dist/es2017/core/init/utils/create_media_source.d.ts +37 -0
- package/dist/es2017/core/init/utils/create_media_source.js +112 -0
- package/dist/es2017/core/init/utils/create_stream_playback_observer.d.ts +45 -0
- package/dist/es2017/core/init/utils/create_stream_playback_observer.js +85 -0
- package/dist/es2017/core/init/utils/end_of_stream.d.ts +33 -0
- package/dist/es2017/core/init/utils/end_of_stream.js +88 -0
- package/dist/es2017/core/init/utils/get_initial_time.d.ts +62 -0
- package/dist/es2017/core/init/utils/get_initial_time.js +110 -0
- package/dist/es2017/core/init/utils/get_loaded_reference.d.ts +28 -0
- package/dist/es2017/core/init/utils/get_loaded_reference.js +56 -0
- package/dist/es2017/core/init/utils/initial_seek_and_play.d.ts +63 -0
- package/dist/es2017/core/init/utils/initial_seek_and_play.js +128 -0
- package/dist/es2017/core/init/utils/initialize_content_decryption.d.ts +80 -0
- package/dist/es2017/core/init/utils/initialize_content_decryption.js +104 -0
- package/dist/es2017/core/init/utils/media_source_duration_updater.d.ts +58 -0
- package/dist/es2017/core/init/utils/media_source_duration_updater.js +263 -0
- package/dist/es2017/core/init/utils/rebuffering_controller.d.ts +147 -0
- package/dist/es2017/core/init/utils/rebuffering_controller.js +541 -0
- package/dist/es2017/core/init/utils/stream_events_emitter/are_same_stream_events.d.ts +39 -0
- package/dist/es2017/core/init/utils/stream_events_emitter/are_same_stream_events.js +35 -0
- package/dist/es2017/core/init/utils/stream_events_emitter/index.d.ts +18 -0
- package/dist/es2017/core/init/utils/stream_events_emitter/index.js +17 -0
- package/dist/es2017/core/init/utils/stream_events_emitter/refresh_scheduled_events_list.d.ts +25 -0
- package/dist/es2017/core/init/utils/stream_events_emitter/refresh_scheduled_events_list.js +62 -0
- package/dist/es2017/core/init/utils/stream_events_emitter/stream_events_emitter.d.ts +52 -0
- package/dist/es2017/core/init/utils/stream_events_emitter/stream_events_emitter.js +178 -0
- package/dist/es2017/core/init/utils/stream_events_emitter/types.d.ts +41 -0
- package/dist/es2017/core/init/utils/stream_events_emitter/types.js +16 -0
- package/dist/es2017/core/init/utils/throw_on_media_error.d.ts +23 -0
- package/dist/es2017/core/init/utils/throw_on_media_error.js +58 -0
- package/dist/es2017/core/segment_buffers/garbage_collector.d.ts +41 -0
- package/dist/es2017/core/segment_buffers/garbage_collector.js +129 -0
- package/dist/es2017/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.d.ts +182 -0
- package/dist/es2017/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.js +435 -0
- package/dist/es2017/core/segment_buffers/implementations/audio_video/index.d.ts +17 -0
- package/dist/es2017/core/segment_buffers/implementations/audio_video/index.js +17 -0
- package/dist/es2017/core/segment_buffers/implementations/index.d.ts +18 -0
- package/dist/es2017/core/segment_buffers/implementations/index.js +18 -0
- package/dist/es2017/core/segment_buffers/implementations/text/html/html_text_segment_buffer.d.ts +141 -0
- package/dist/es2017/core/segment_buffers/implementations/text/html/html_text_segment_buffer.js +383 -0
- package/dist/es2017/core/segment_buffers/implementations/text/html/index.d.ts +21 -0
- package/dist/es2017/core/segment_buffers/implementations/text/html/index.js +21 -0
- package/dist/es2017/core/segment_buffers/implementations/text/html/parsers.d.ts +30 -0
- package/dist/es2017/core/segment_buffers/implementations/text/html/parsers.js +37 -0
- package/dist/es2017/core/segment_buffers/implementations/text/html/text_track_cues_store.d.ts +79 -0
- package/dist/es2017/core/segment_buffers/implementations/text/html/text_track_cues_store.js +322 -0
- package/dist/es2017/core/segment_buffers/implementations/text/html/types.d.ts +25 -0
- package/dist/es2017/core/segment_buffers/implementations/text/html/types.js +16 -0
- package/dist/es2017/core/segment_buffers/implementations/text/html/update_proportional_elements.d.ts +30 -0
- package/dist/es2017/core/segment_buffers/implementations/text/html/update_proportional_elements.js +77 -0
- package/dist/es2017/core/segment_buffers/implementations/text/html/utils.d.ts +44 -0
- package/dist/es2017/core/segment_buffers/implementations/text/html/utils.js +107 -0
- package/dist/es2017/core/segment_buffers/implementations/text/native/index.d.ts +17 -0
- package/dist/es2017/core/segment_buffers/implementations/text/native/index.js +17 -0
- package/dist/es2017/core/segment_buffers/implementations/text/native/native_text_segment_buffer.d.ts +83 -0
- package/dist/es2017/core/segment_buffers/implementations/text/native/native_text_segment_buffer.js +251 -0
- package/dist/es2017/core/segment_buffers/implementations/text/native/parsers.d.ts +26 -0
- package/dist/es2017/core/segment_buffers/implementations/text/native/parsers.js +37 -0
- package/dist/es2017/core/segment_buffers/implementations/types.d.ts +320 -0
- package/dist/es2017/core/segment_buffers/implementations/types.js +119 -0
- package/dist/es2017/core/segment_buffers/implementations/utils/manual_time_ranges.d.ts +29 -0
- package/dist/es2017/core/segment_buffers/implementations/utils/manual_time_ranges.js +63 -0
- package/dist/es2017/core/segment_buffers/index.d.ts +21 -0
- package/dist/es2017/core/segment_buffers/index.js +21 -0
- package/dist/es2017/core/segment_buffers/inventory/buffered_history.d.ts +89 -0
- package/dist/es2017/core/segment_buffers/inventory/buffered_history.js +90 -0
- package/dist/es2017/core/segment_buffers/inventory/index.d.ts +21 -0
- package/dist/es2017/core/segment_buffers/inventory/index.js +18 -0
- package/dist/es2017/core/segment_buffers/inventory/segment_inventory.d.ts +207 -0
- package/dist/es2017/core/segment_buffers/inventory/segment_inventory.js +822 -0
- package/dist/es2017/core/segment_buffers/inventory/types.d.ts +27 -0
- package/dist/es2017/core/segment_buffers/inventory/types.js +16 -0
- package/dist/es2017/core/segment_buffers/inventory/utils.d.ts +33 -0
- package/dist/es2017/core/segment_buffers/inventory/utils.js +49 -0
- package/dist/es2017/core/segment_buffers/segment_buffers_store.d.ts +180 -0
- package/dist/es2017/core/segment_buffers/segment_buffers_store.js +290 -0
- package/dist/es2017/core/stream/adaptation/adaptation_stream.d.ts +33 -0
- package/dist/es2017/core/stream/adaptation/adaptation_stream.js +349 -0
- package/dist/es2017/core/stream/adaptation/get_representations_switch_strategy.d.ts +39 -0
- package/dist/{_esm5.processed → es2017}/core/stream/adaptation/get_representations_switch_strategy.js +13 -16
- package/dist/es2017/core/stream/adaptation/index.d.ts +18 -0
- package/dist/es2017/core/stream/adaptation/index.js +18 -0
- package/dist/es2017/core/stream/adaptation/types.d.ts +200 -0
- package/dist/es2017/core/stream/adaptation/types.js +1 -0
- package/dist/es2017/core/stream/index.d.ts +20 -0
- package/dist/es2017/core/stream/index.js +17 -0
- package/dist/es2017/core/stream/orchestrator/get_time_ranges_for_content.d.ts +30 -0
- package/dist/es2017/core/stream/orchestrator/get_time_ranges_for_content.js +55 -0
- package/dist/es2017/core/stream/orchestrator/index.d.ts +18 -0
- package/dist/es2017/core/stream/orchestrator/index.js +17 -0
- package/dist/es2017/core/stream/orchestrator/stream_orchestrator.d.ts +174 -0
- package/dist/es2017/core/stream/orchestrator/stream_orchestrator.js +487 -0
- package/dist/es2017/core/stream/period/index.d.ts +18 -0
- package/dist/es2017/core/stream/period/index.js +18 -0
- package/dist/es2017/core/stream/period/period_stream.d.ts +49 -0
- package/dist/es2017/core/stream/period/period_stream.js +359 -0
- package/dist/es2017/core/stream/period/types.d.ts +101 -0
- package/dist/es2017/core/stream/period/types.js +1 -0
- package/dist/es2017/core/stream/period/utils/get_adaptation_switch_strategy.d.ts +68 -0
- package/dist/es2017/core/stream/period/utils/get_adaptation_switch_strategy.js +160 -0
- package/dist/es2017/core/stream/representation/index.d.ts +18 -0
- package/dist/es2017/core/stream/representation/index.js +18 -0
- package/dist/es2017/core/stream/representation/representation_stream.d.ts +53 -0
- package/dist/es2017/core/stream/representation/representation_stream.js +384 -0
- package/dist/es2017/core/stream/representation/types.d.ts +276 -0
- package/dist/es2017/core/stream/representation/types.js +1 -0
- package/dist/es2017/core/stream/representation/utils/append_segment_to_buffer.d.ts +32 -0
- package/dist/es2017/core/stream/representation/utils/append_segment_to_buffer.js +60 -0
- package/dist/es2017/core/stream/representation/utils/check_for_discontinuity.d.ts +53 -0
- package/dist/es2017/core/stream/representation/utils/check_for_discontinuity.js +235 -0
- package/dist/es2017/core/stream/representation/utils/downloading_queue.d.ts +231 -0
- package/dist/es2017/core/stream/representation/utils/downloading_queue.js +366 -0
- package/dist/es2017/core/stream/representation/utils/force_garbage_collection.d.ts +29 -0
- package/dist/es2017/core/stream/representation/utils/force_garbage_collection.js +91 -0
- package/dist/es2017/core/stream/representation/utils/get_buffer_status.d.ts +72 -0
- package/dist/es2017/core/stream/representation/utils/get_buffer_status.js +213 -0
- package/dist/es2017/core/stream/representation/utils/get_needed_segments.d.ts +92 -0
- package/dist/es2017/core/stream/representation/utils/get_needed_segments.js +425 -0
- package/dist/es2017/core/stream/representation/utils/get_segment_priority.d.ts +28 -0
- package/dist/es2017/core/stream/representation/utils/get_segment_priority.js +38 -0
- package/dist/es2017/core/stream/representation/utils/push_init_segment.d.ts +39 -0
- package/dist/es2017/core/stream/representation/utils/push_init_segment.js +41 -0
- package/dist/es2017/core/stream/representation/utils/push_media_segment.d.ts +40 -0
- package/dist/es2017/core/stream/representation/utils/push_media_segment.js +68 -0
- package/dist/es2017/default_config.d.ts +1081 -0
- package/dist/es2017/default_config.js +1102 -0
- package/dist/es2017/errors/assertion_error.d.ts +31 -0
- package/dist/es2017/errors/assertion_error.js +35 -0
- package/dist/es2017/errors/custom_loader_error.d.ts +36 -0
- package/dist/es2017/errors/custom_loader_error.js +40 -0
- package/dist/es2017/errors/encrypted_media_error.d.ts +39 -0
- package/dist/es2017/errors/encrypted_media_error.js +38 -0
- package/dist/es2017/errors/error_codes.d.ts +31 -0
- package/dist/es2017/errors/error_codes.js +70 -0
- package/dist/es2017/errors/error_message.d.ts +22 -0
- package/dist/es2017/errors/error_message.js +24 -0
- package/dist/es2017/errors/format_error.d.ts +20 -0
- package/dist/es2017/errors/format_error.js +30 -0
- package/dist/es2017/errors/index.d.ts +26 -0
- package/dist/es2017/errors/index.js +26 -0
- package/dist/es2017/errors/is_known_error.d.ts +22 -0
- package/dist/es2017/errors/is_known_error.js +32 -0
- package/dist/es2017/errors/media_error.d.ts +56 -0
- package/dist/es2017/errors/media_error.js +55 -0
- package/dist/es2017/errors/network_error.d.ts +44 -0
- package/dist/es2017/errors/network_error.js +51 -0
- package/dist/es2017/errors/other_error.d.ts +32 -0
- package/dist/es2017/errors/other_error.js +37 -0
- package/dist/es2017/errors/request_error.d.ts +38 -0
- package/dist/es2017/errors/request_error.js +55 -0
- package/dist/es2017/experimental/features/dash_wasm.d.ts +23 -0
- package/dist/es2017/experimental/features/dash_wasm.js +34 -0
- package/dist/es2017/experimental/features/debug_element.d.ts +8 -0
- package/dist/es2017/experimental/features/debug_element.js +10 -0
- package/dist/es2017/experimental/features/index.d.ts +19 -0
- package/dist/es2017/experimental/features/index.js +19 -0
- package/dist/es2017/experimental/features/local.d.ts +19 -0
- package/dist/es2017/experimental/features/local.js +24 -0
- package/dist/es2017/experimental/features/metaplaylist.d.ts +19 -0
- package/dist/es2017/experimental/features/metaplaylist.js +24 -0
- package/dist/es2017/experimental/index.d.ts +2 -0
- package/dist/es2017/experimental/index.js +2 -0
- package/dist/es2017/experimental/tools/VideoThumbnailLoader/features/dash.d.ts +17 -0
- package/dist/es2017/experimental/tools/VideoThumbnailLoader/features/dash.js +20 -0
- package/dist/es2017/experimental/tools/VideoThumbnailLoader/features/metaplaylist.d.ts +17 -0
- package/dist/es2017/experimental/tools/VideoThumbnailLoader/features/metaplaylist.js +20 -0
- package/dist/es2017/experimental/tools/VideoThumbnailLoader/index.d.ts +18 -0
- package/dist/es2017/experimental/tools/VideoThumbnailLoader/index.js +18 -0
- package/dist/es2017/experimental/tools/VideoThumbnailLoader/load_and_push_segment.d.ts +26 -0
- package/dist/es2017/experimental/tools/VideoThumbnailLoader/load_and_push_segment.js +64 -0
- package/dist/es2017/experimental/tools/VideoThumbnailLoader/prepare_source_buffer.d.ts +25 -0
- package/dist/es2017/experimental/tools/VideoThumbnailLoader/prepare_source_buffer.js +63 -0
- package/dist/es2017/experimental/tools/VideoThumbnailLoader/remove_buffer_around_time.d.ts +30 -0
- package/dist/es2017/experimental/tools/VideoThumbnailLoader/remove_buffer_around_time.js +41 -0
- package/dist/es2017/experimental/tools/VideoThumbnailLoader/types.d.ts +25 -0
- package/dist/es2017/experimental/tools/VideoThumbnailLoader/types.js +16 -0
- package/dist/es2017/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.d.ts +54 -0
- package/dist/es2017/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.js +276 -0
- package/dist/es2017/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader_error.d.ts +25 -0
- package/dist/es2017/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader_error.js +29 -0
- package/dist/es2017/experimental/tools/createMetaplaylist/get_duration_from_manifest.d.ts +23 -0
- package/dist/es2017/experimental/tools/createMetaplaylist/get_duration_from_manifest.js +124 -0
- package/dist/es2017/experimental/tools/createMetaplaylist/index.d.ts +30 -0
- package/dist/es2017/experimental/tools/createMetaplaylist/index.js +57 -0
- package/dist/es2017/experimental/tools/index.d.ts +20 -0
- package/dist/es2017/experimental/tools/index.js +20 -0
- package/dist/es2017/experimental/tools/mediaCapabilitiesProber/api/index.d.ts +60 -0
- package/dist/es2017/experimental/tools/mediaCapabilitiesProber/api/index.js +151 -0
- package/dist/es2017/experimental/tools/mediaCapabilitiesProber/api/probeMediaConfiguration.d.ts +45 -0
- package/dist/es2017/experimental/tools/mediaCapabilitiesProber/api/probeMediaConfiguration.js +97 -0
- package/dist/es2017/experimental/tools/mediaCapabilitiesProber/capabilities.d.ts +24 -0
- package/dist/es2017/experimental/tools/mediaCapabilitiesProber/capabilities.js +142 -0
- package/dist/es2017/experimental/tools/mediaCapabilitiesProber/index.d.ts +17 -0
- package/dist/es2017/experimental/tools/mediaCapabilitiesProber/index.js +17 -0
- package/dist/es2017/experimental/tools/mediaCapabilitiesProber/log.d.ts +18 -0
- package/dist/es2017/experimental/tools/mediaCapabilitiesProber/log.js +18 -0
- package/dist/es2017/experimental/tools/mediaCapabilitiesProber/probers/DRMInfos.d.ts +25 -0
- package/dist/es2017/experimental/tools/mediaCapabilitiesProber/probers/DRMInfos.js +50 -0
- package/dist/es2017/experimental/tools/mediaCapabilitiesProber/probers/HDCPPolicy.d.ts +22 -0
- package/dist/es2017/experimental/tools/mediaCapabilitiesProber/probers/HDCPPolicy.js +69 -0
- package/dist/es2017/experimental/tools/mediaCapabilitiesProber/probers/decodingInfo.d.ts +26 -0
- package/dist/es2017/experimental/tools/mediaCapabilitiesProber/probers/decodingInfo.js +79 -0
- package/dist/es2017/experimental/tools/mediaCapabilitiesProber/probers/defaultCodecsFinder.d.ts +29 -0
- package/dist/es2017/experimental/tools/mediaCapabilitiesProber/probers/defaultCodecsFinder.js +63 -0
- package/dist/es2017/experimental/tools/mediaCapabilitiesProber/probers/index.d.ts +21 -0
- package/dist/es2017/experimental/tools/mediaCapabilitiesProber/probers/index.js +30 -0
- package/dist/es2017/experimental/tools/mediaCapabilitiesProber/probers/mediaContentType.d.ts +21 -0
- package/dist/es2017/experimental/tools/mediaCapabilitiesProber/probers/mediaContentType.js +57 -0
- package/dist/es2017/experimental/tools/mediaCapabilitiesProber/probers/mediaContentTypeWithFeatures/format.d.ts +21 -0
- package/dist/es2017/experimental/tools/mediaCapabilitiesProber/probers/mediaContentTypeWithFeatures/format.js +89 -0
- package/dist/es2017/experimental/tools/mediaCapabilitiesProber/probers/mediaContentTypeWithFeatures/index.d.ts +26 -0
- package/dist/es2017/experimental/tools/mediaCapabilitiesProber/probers/mediaContentTypeWithFeatures/index.js +84 -0
- package/dist/es2017/experimental/tools/mediaCapabilitiesProber/probers/mediaDisplayInfos.d.ts +21 -0
- package/dist/es2017/experimental/tools/mediaCapabilitiesProber/probers/mediaDisplayInfos.js +46 -0
- package/dist/es2017/experimental/tools/mediaCapabilitiesProber/types.d.ts +69 -0
- package/dist/es2017/experimental/tools/mediaCapabilitiesProber/types.js +21 -0
- package/dist/es2017/experimental/tools/mediaCapabilitiesProber/utils.d.ts +31 -0
- package/dist/es2017/experimental/tools/mediaCapabilitiesProber/utils.js +81 -0
- package/dist/es2017/experimental/tools/parseBIFThumbnails/index.d.ts +29 -0
- package/dist/es2017/experimental/tools/parseBIFThumbnails/index.js +29 -0
- package/dist/es2017/features/add_features.d.ts +20 -0
- package/dist/es2017/features/add_features.js +35 -0
- package/dist/es2017/features/features_object.d.ts +22 -0
- package/dist/es2017/features/features_object.js +31 -0
- package/dist/es2017/features/index.d.ts +34 -0
- package/dist/es2017/features/index.js +33 -0
- package/dist/es2017/features/list/dash.d.ts +23 -0
- package/dist/es2017/features/list/dash.js +32 -0
- package/dist/es2017/features/list/directfile.d.ts +24 -0
- package/dist/es2017/features/list/directfile.js +29 -0
- package/dist/es2017/features/list/eme.d.ts +23 -0
- package/dist/es2017/features/list/eme.js +25 -0
- package/dist/es2017/features/list/html_sami_parser.d.ts +23 -0
- package/dist/es2017/features/list/html_sami_parser.js +27 -0
- package/dist/es2017/features/list/html_srt_parser.d.ts +23 -0
- package/dist/es2017/features/list/html_srt_parser.js +27 -0
- package/dist/es2017/features/list/html_text_buffer.d.ts +23 -0
- package/dist/es2017/features/list/html_text_buffer.js +25 -0
- package/dist/es2017/features/list/html_ttml_parser.d.ts +23 -0
- package/dist/es2017/features/list/html_ttml_parser.js +27 -0
- package/dist/es2017/features/list/html_vtt_parser.d.ts +23 -0
- package/dist/es2017/features/list/html_vtt_parser.js +27 -0
- package/dist/es2017/features/list/index.d.ts +29 -0
- package/dist/es2017/features/list/index.js +29 -0
- package/dist/es2017/features/list/native_sami_parser.d.ts +23 -0
- package/dist/es2017/features/list/native_sami_parser.js +28 -0
- package/dist/es2017/features/list/native_srt_parser.d.ts +23 -0
- package/dist/es2017/features/list/native_srt_parser.js +28 -0
- package/dist/es2017/features/list/native_text_buffer.d.ts +23 -0
- package/dist/es2017/features/list/native_text_buffer.js +26 -0
- package/dist/es2017/features/list/native_ttml_parser.d.ts +23 -0
- package/dist/es2017/features/list/native_ttml_parser.js +28 -0
- package/dist/es2017/features/list/native_vtt_parser.d.ts +23 -0
- package/dist/es2017/features/list/native_vtt_parser.js +28 -0
- package/dist/es2017/features/list/smooth.d.ts +23 -0
- package/dist/es2017/features/list/smooth.js +28 -0
- package/dist/es2017/features/types.d.ts +130 -0
- package/dist/es2017/features/types.js +16 -0
- package/dist/es2017/index.d.ts +17 -0
- package/dist/es2017/index.js +44 -0
- package/dist/es2017/log.d.ts +18 -0
- package/dist/es2017/log.js +19 -0
- package/dist/es2017/manifest/adaptation.d.ts +113 -0
- package/dist/es2017/manifest/adaptation.js +212 -0
- package/dist/es2017/manifest/index.d.ts +24 -0
- package/dist/es2017/manifest/index.js +28 -0
- package/dist/es2017/manifest/manifest.d.ts +265 -0
- package/dist/es2017/manifest/manifest.js +362 -0
- package/dist/es2017/manifest/period.d.ts +68 -0
- package/dist/es2017/manifest/period.js +131 -0
- package/dist/es2017/manifest/representation.d.ts +251 -0
- package/dist/es2017/manifest/representation.js +275 -0
- package/dist/es2017/manifest/representation_index/index.d.ts +18 -0
- package/dist/es2017/manifest/representation_index/index.js +17 -0
- package/dist/es2017/manifest/representation_index/static.d.ts +101 -0
- package/dist/es2017/manifest/representation_index/static.js +139 -0
- package/dist/es2017/manifest/representation_index/types.d.ts +420 -0
- package/dist/es2017/manifest/representation_index/types.js +16 -0
- package/dist/es2017/manifest/types.d.ts +29 -0
- package/dist/es2017/manifest/types.js +30 -0
- package/dist/es2017/manifest/update_period_in_place.d.ts +49 -0
- package/dist/es2017/manifest/update_period_in_place.js +106 -0
- package/dist/es2017/manifest/update_periods.d.ts +47 -0
- package/dist/es2017/manifest/update_periods.js +153 -0
- package/dist/es2017/manifest/utils.d.ts +39 -0
- package/dist/es2017/manifest/utils.js +42 -0
- package/dist/es2017/minimal.d.ts +17 -0
- package/dist/es2017/minimal.js +31 -0
- package/dist/es2017/parsers/containers/isobmff/constants.d.ts +23 -0
- package/dist/es2017/parsers/containers/isobmff/constants.js +23 -0
- package/dist/es2017/parsers/containers/isobmff/create_box.d.ts +30 -0
- package/dist/es2017/parsers/containers/isobmff/create_box.js +64 -0
- package/dist/es2017/parsers/containers/isobmff/drm/index.d.ts +16 -0
- package/dist/es2017/parsers/containers/isobmff/drm/index.js +16 -0
- package/dist/es2017/parsers/containers/isobmff/drm/playready.d.ts +21 -0
- package/dist/es2017/parsers/containers/isobmff/drm/playready.js +36 -0
- package/dist/es2017/parsers/containers/isobmff/get_box.d.ts +107 -0
- package/dist/es2017/parsers/containers/isobmff/get_box.js +227 -0
- package/dist/es2017/parsers/containers/isobmff/index.d.ts +21 -0
- package/dist/es2017/parsers/containers/isobmff/index.js +21 -0
- package/dist/es2017/parsers/containers/isobmff/read.d.ts +57 -0
- package/dist/es2017/parsers/containers/isobmff/read.js +87 -0
- package/dist/es2017/parsers/containers/isobmff/take_pssh_out.d.ts +41 -0
- package/dist/es2017/parsers/containers/isobmff/take_pssh_out.js +83 -0
- package/dist/es2017/parsers/containers/isobmff/utils.d.ts +123 -0
- package/dist/es2017/parsers/containers/isobmff/utils.js +441 -0
- package/dist/es2017/parsers/containers/matroska/index.d.ts +16 -0
- package/dist/es2017/parsers/containers/matroska/index.js +16 -0
- package/dist/es2017/parsers/containers/matroska/utils.d.ts +34 -0
- package/dist/es2017/parsers/containers/matroska/utils.js +235 -0
- package/dist/es2017/parsers/images/bif.d.ts +39 -0
- package/dist/es2017/parsers/images/bif.js +97 -0
- package/dist/es2017/parsers/manifest/dash/common/attach_trickmode_track.d.ts +28 -0
- package/dist/es2017/parsers/manifest/dash/common/attach_trickmode_track.js +44 -0
- package/dist/es2017/parsers/manifest/dash/common/flatten_overlapping_periods.d.ts +43 -0
- package/dist/es2017/parsers/manifest/dash/common/flatten_overlapping_periods.js +74 -0
- package/dist/es2017/parsers/manifest/dash/common/get_clock_offset.d.ts +29 -0
- package/dist/es2017/parsers/manifest/dash/common/get_clock_offset.js +38 -0
- package/dist/es2017/parsers/manifest/dash/common/get_hdr_information.d.ts +50 -0
- package/dist/es2017/parsers/manifest/dash/common/get_hdr_information.js +58 -0
- package/dist/es2017/parsers/manifest/dash/common/get_http_utc-timing_url.d.ts +21 -0
- package/dist/es2017/parsers/manifest/dash/common/get_http_utc-timing_url.js +26 -0
- package/dist/es2017/parsers/manifest/dash/common/get_minimum_and_maximum_positions.d.ts +25 -0
- package/dist/es2017/parsers/manifest/dash/common/get_minimum_and_maximum_positions.js +31 -0
- package/dist/es2017/parsers/manifest/dash/common/get_periods_time_infos.d.ts +43 -0
- package/dist/es2017/parsers/manifest/dash/common/get_periods_time_infos.js +66 -0
- package/dist/es2017/parsers/manifest/dash/common/index.d.ts +20 -0
- package/dist/es2017/parsers/manifest/dash/common/index.js +19 -0
- package/dist/es2017/parsers/manifest/dash/common/indexes/base.d.ts +246 -0
- package/dist/es2017/parsers/manifest/dash/common/indexes/base.js +257 -0
- package/dist/es2017/parsers/manifest/dash/common/indexes/get_init_segment.d.ts +32 -0
- package/dist/es2017/parsers/manifest/dash/common/indexes/get_init_segment.js +42 -0
- package/dist/es2017/parsers/manifest/dash/common/indexes/get_segments_from_timeline.d.ts +36 -0
- package/dist/es2017/parsers/manifest/dash/common/indexes/get_segments_from_timeline.js +98 -0
- package/dist/es2017/parsers/manifest/dash/common/indexes/index.d.ts +20 -0
- package/dist/es2017/parsers/manifest/dash/common/indexes/index.js +20 -0
- package/dist/es2017/parsers/manifest/dash/common/indexes/list.d.ts +193 -0
- package/dist/es2017/parsers/manifest/dash/common/indexes/list.js +206 -0
- package/dist/es2017/parsers/manifest/dash/common/indexes/template.d.ts +254 -0
- package/dist/es2017/parsers/manifest/dash/common/indexes/template.js +429 -0
- package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_elements.d.ts +26 -0
- package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_elements.js +47 -0
- package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_previous_timeline.d.ts +17 -0
- package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/construct_timeline_from_previous_timeline.js +83 -0
- package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/convert_element_to_index_segment.d.ts +37 -0
- package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/convert_element_to_index_segment.js +58 -0
- package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/find_first_common_start_time.d.ts +41 -0
- package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/find_first_common_start_time.js +132 -0
- package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/index.d.ts +17 -0
- package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/index.js +17 -0
- package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/parse_s_element.d.ts +34 -0
- package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/parse_s_element.js +57 -0
- package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.d.ts +338 -0
- package/dist/es2017/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.js +464 -0
- package/dist/es2017/parsers/manifest/dash/common/indexes/tokens.d.ts +40 -0
- package/dist/es2017/parsers/manifest/dash/common/indexes/tokens.js +109 -0
- package/dist/es2017/parsers/manifest/dash/common/indexes/utils.d.ts +25 -0
- package/dist/es2017/parsers/manifest/dash/common/indexes/utils.js +28 -0
- package/dist/es2017/parsers/manifest/dash/common/infer_adaptation_type.d.ts +42 -0
- package/dist/es2017/parsers/manifest/dash/common/infer_adaptation_type.js +107 -0
- package/dist/es2017/parsers/manifest/dash/common/manifest_bounds_calculator.d.ts +92 -0
- package/dist/es2017/parsers/manifest/dash/common/manifest_bounds_calculator.js +111 -0
- package/dist/es2017/parsers/manifest/dash/common/parse_adaptation_sets.d.ts +49 -0
- package/dist/es2017/parsers/manifest/dash/common/parse_adaptation_sets.js +368 -0
- package/dist/es2017/parsers/manifest/dash/common/parse_availability_start_time.d.ts +22 -0
- package/dist/es2017/parsers/manifest/dash/common/parse_availability_start_time.js +29 -0
- package/dist/es2017/parsers/manifest/dash/common/parse_mpd.d.ts +98 -0
- package/dist/es2017/parsers/manifest/dash/common/parse_mpd.js +246 -0
- package/dist/es2017/parsers/manifest/dash/common/parse_periods.d.ts +67 -0
- package/dist/es2017/parsers/manifest/dash/common/parse_periods.js +273 -0
- package/dist/es2017/parsers/manifest/dash/common/parse_representation_index.d.ts +73 -0
- package/dist/es2017/parsers/manifest/dash/common/parse_representation_index.js +95 -0
- package/dist/es2017/parsers/manifest/dash/common/parse_representations.d.ts +46 -0
- package/dist/es2017/parsers/manifest/dash/common/parse_representations.js +245 -0
- package/dist/es2017/parsers/manifest/dash/common/resolve_base_urls.d.ts +26 -0
- package/dist/es2017/parsers/manifest/dash/common/resolve_base_urls.js +44 -0
- package/dist/es2017/parsers/manifest/dash/index.d.ts +16 -0
- package/dist/es2017/parsers/manifest/dash/index.js +16 -0
- package/dist/es2017/parsers/manifest/dash/js-parser/index.d.ts +17 -0
- package/dist/es2017/parsers/manifest/dash/js-parser/index.js +17 -0
- package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/AdaptationSet.d.ts +23 -0
- package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/AdaptationSet.js +308 -0
- package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/BaseURL.d.ts +23 -0
- package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/BaseURL.js +30 -0
- package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/ContentComponent.d.ts +22 -0
- package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/ContentComponent.js +41 -0
- package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/ContentProtection.d.ts +21 -0
- package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/ContentProtection.js +75 -0
- package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/EventStream.d.ts +23 -0
- package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/EventStream.js +94 -0
- package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/Initialization.d.ts +21 -0
- package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/Initialization.js +39 -0
- package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/MPD.d.ts +21 -0
- package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/MPD.js +144 -0
- package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/Period.d.ts +21 -0
- package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/Period.js +112 -0
- package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/Representation.d.ts +21 -0
- package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/Representation.js +186 -0
- package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/SegmentBase.d.ts +22 -0
- package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/SegmentBase.js +89 -0
- package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/SegmentList.d.ts +21 -0
- package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/SegmentList.js +40 -0
- package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/SegmentTemplate.d.ts +23 -0
- package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/SegmentTemplate.js +73 -0
- package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/SegmentTimeline.d.ts +21 -0
- package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/SegmentTimeline.js +30 -0
- package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/SegmentURL.d.ts +23 -0
- package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/SegmentURL.js +49 -0
- package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/utils.d.ts +187 -0
- package/dist/es2017/parsers/manifest/dash/js-parser/node_parsers/utils.js +306 -0
- package/dist/es2017/parsers/manifest/dash/js-parser/parse_from_document.d.ts +24 -0
- package/dist/es2017/parsers/manifest/dash/js-parser/parse_from_document.js +106 -0
- package/dist/es2017/parsers/manifest/dash/node_parser_types.d.ts +393 -0
- package/dist/es2017/parsers/manifest/dash/node_parser_types.js +16 -0
- package/dist/es2017/parsers/manifest/dash/parsers_types.d.ts +83 -0
- package/dist/es2017/parsers/manifest/dash/parsers_types.js +16 -0
- package/dist/es2017/parsers/manifest/dash/wasm-parser/index.d.ts +18 -0
- package/dist/es2017/parsers/manifest/dash/wasm-parser/index.js +17 -0
- package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/dash-wasm-parser.d.ts +111 -0
- package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/dash-wasm-parser.js +329 -0
- package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/AdaptationSet.d.ts +31 -0
- package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/AdaptationSet.js +270 -0
- package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/BaseURL.d.ts +24 -0
- package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/BaseURL.js +30 -0
- package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/ContentComponent.d.ts +24 -0
- package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/ContentComponent.js +41 -0
- package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/ContentProtection.d.ts +23 -0
- package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/ContentProtection.js +49 -0
- package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/EventStream.d.ts +32 -0
- package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/EventStream.js +112 -0
- package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/MPD.d.ts +27 -0
- package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/MPD.js +145 -0
- package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/Period.d.ts +32 -0
- package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/Period.js +130 -0
- package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/Representation.d.ts +31 -0
- package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/Representation.js +167 -0
- package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/Scheme.d.ts +24 -0
- package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/Scheme.js +35 -0
- package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/SegmentBase.d.ts +18 -0
- package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/SegmentBase.js +93 -0
- package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/SegmentList.d.ts +25 -0
- package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/SegmentList.js +45 -0
- package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/SegmentTemplate.d.ts +18 -0
- package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/SegmentTemplate.js +108 -0
- package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/SegmentUrl.d.ts +25 -0
- package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/SegmentUrl.js +54 -0
- package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/XLink.d.ts +28 -0
- package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/XLink.js +47 -0
- package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/index.d.ts +16 -0
- package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/index.js +16 -0
- package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/root.d.ts +27 -0
- package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/generators/root.js +45 -0
- package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/parsers_stack.d.ts +38 -0
- package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/parsers_stack.js +56 -0
- package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/types.d.ts +144 -0
- package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/types.js +16 -0
- package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/utils.d.ts +29 -0
- package/dist/es2017/parsers/manifest/dash/wasm-parser/ts/utils.js +36 -0
- package/dist/es2017/parsers/manifest/index.d.ts +16 -0
- package/dist/es2017/parsers/manifest/index.js +16 -0
- package/dist/es2017/parsers/manifest/local/index.d.ts +18 -0
- package/dist/es2017/parsers/manifest/local/index.js +17 -0
- package/dist/es2017/parsers/manifest/local/parse_local_manifest.d.ts +22 -0
- package/dist/es2017/parsers/manifest/local/parse_local_manifest.js +126 -0
- package/dist/es2017/parsers/manifest/local/representation_index.d.ts +83 -0
- package/dist/es2017/parsers/manifest/local/representation_index.js +224 -0
- package/dist/es2017/parsers/manifest/local/types.d.ts +285 -0
- package/dist/es2017/parsers/manifest/local/types.js +16 -0
- package/dist/es2017/parsers/manifest/metaplaylist/index.d.ts +18 -0
- package/dist/es2017/parsers/manifest/metaplaylist/index.js +17 -0
- package/dist/es2017/parsers/manifest/metaplaylist/metaplaylist_parser.d.ts +64 -0
- package/dist/es2017/parsers/manifest/metaplaylist/metaplaylist_parser.js +255 -0
- package/dist/es2017/parsers/manifest/metaplaylist/representation_index.d.ts +154 -0
- package/dist/es2017/parsers/manifest/metaplaylist/representation_index.js +222 -0
- package/dist/es2017/parsers/manifest/smooth/create_parser.d.ts +33 -0
- package/dist/es2017/parsers/manifest/smooth/create_parser.js +516 -0
- package/dist/es2017/parsers/manifest/smooth/get_codecs.d.ts +26 -0
- package/dist/es2017/parsers/manifest/smooth/get_codecs.js +50 -0
- package/dist/es2017/parsers/manifest/smooth/index.d.ts +19 -0
- package/dist/es2017/parsers/manifest/smooth/index.js +19 -0
- package/dist/es2017/parsers/manifest/smooth/parse_C_nodes.d.ts +26 -0
- package/dist/es2017/parsers/manifest/smooth/parse_C_nodes.js +60 -0
- package/dist/es2017/parsers/manifest/smooth/parse_protection_node.d.ts +29 -0
- package/dist/es2017/parsers/manifest/smooth/parse_protection_node.js +57 -0
- package/dist/es2017/parsers/manifest/smooth/representation_index.d.ts +226 -0
- package/dist/es2017/parsers/manifest/smooth/representation_index.js +384 -0
- package/dist/es2017/parsers/manifest/smooth/shared_smooth_segment_timeline.d.ts +119 -0
- package/dist/{_esm5.processed → es2017}/parsers/manifest/smooth/shared_smooth_segment_timeline.js +18 -21
- package/dist/es2017/parsers/manifest/smooth/utils/add_segment_infos.d.ts +38 -0
- package/dist/es2017/parsers/manifest/smooth/utils/add_segment_infos.js +60 -0
- package/dist/es2017/parsers/manifest/smooth/utils/parseBoolean.d.ts +20 -0
- package/dist/es2017/parsers/manifest/smooth/utils/parseBoolean.js +30 -0
- package/dist/es2017/parsers/manifest/smooth/utils/reduceChildren.d.ts +23 -0
- package/dist/es2017/parsers/manifest/smooth/utils/reduceChildren.js +31 -0
- package/dist/es2017/parsers/manifest/smooth/utils/tokens.d.ts +28 -0
- package/dist/es2017/parsers/manifest/smooth/utils/tokens.js +35 -0
- package/dist/es2017/parsers/manifest/types.d.ts +378 -0
- package/dist/es2017/parsers/manifest/types.js +16 -0
- package/dist/es2017/parsers/manifest/utils/check_manifest_ids.d.ts +25 -0
- package/dist/es2017/parsers/manifest/utils/check_manifest_ids.js +76 -0
- package/dist/es2017/parsers/manifest/utils/clear_timeline_from_position.d.ts +24 -0
- package/dist/es2017/parsers/manifest/utils/clear_timeline_from_position.js +69 -0
- package/dist/es2017/parsers/manifest/utils/get_first_time_from_adaptation.d.ts +27 -0
- package/dist/es2017/parsers/manifest/utils/get_first_time_from_adaptation.js +43 -0
- package/dist/es2017/parsers/manifest/utils/get_last_time_from_adaptation.d.ts +29 -0
- package/dist/es2017/parsers/manifest/utils/get_last_time_from_adaptation.js +45 -0
- package/dist/es2017/parsers/manifest/utils/get_maximum_positions.d.ts +24 -0
- package/dist/es2017/parsers/manifest/utils/get_maximum_positions.js +72 -0
- package/dist/es2017/parsers/manifest/utils/get_minimum_position.d.ts +21 -0
- package/dist/es2017/parsers/manifest/utils/get_minimum_position.js +68 -0
- package/dist/es2017/parsers/manifest/utils/index_helpers.d.ts +88 -0
- package/dist/es2017/parsers/manifest/utils/index_helpers.js +147 -0
- package/dist/es2017/parsers/manifest/utils/is_segment_still_available.d.ts +29 -0
- package/dist/es2017/parsers/manifest/utils/is_segment_still_available.js +51 -0
- package/dist/es2017/parsers/manifest/utils/update_segment_timeline.d.ts +33 -0
- package/dist/es2017/parsers/manifest/utils/update_segment_timeline.js +128 -0
- package/dist/es2017/parsers/texttracks/index.d.ts +16 -0
- package/dist/es2017/parsers/texttracks/index.js +16 -0
- package/dist/es2017/parsers/texttracks/sami/html.d.ts +29 -0
- package/dist/es2017/parsers/texttracks/sami/html.js +189 -0
- package/dist/es2017/parsers/texttracks/sami/native.d.ts +34 -0
- package/dist/es2017/parsers/texttracks/sami/native.js +160 -0
- package/dist/es2017/parsers/texttracks/srt/find_end_of_cue_block.d.ts +29 -0
- package/dist/es2017/parsers/texttracks/srt/find_end_of_cue_block.js +39 -0
- package/dist/es2017/parsers/texttracks/srt/get_cue_blocks.d.ts +22 -0
- package/dist/es2017/parsers/texttracks/srt/get_cue_blocks.js +47 -0
- package/dist/es2017/parsers/texttracks/srt/html.d.ts +26 -0
- package/dist/es2017/parsers/texttracks/srt/html.js +153 -0
- package/dist/es2017/parsers/texttracks/srt/native.d.ts +28 -0
- package/dist/es2017/parsers/texttracks/srt/native.js +57 -0
- package/dist/es2017/parsers/texttracks/srt/parse_cue.d.ts +30 -0
- package/dist/es2017/parsers/texttracks/srt/parse_cue.js +60 -0
- package/dist/es2017/parsers/texttracks/srt/parse_timestamp.d.ts +21 -0
- package/dist/es2017/parsers/texttracks/srt/parse_timestamp.js +33 -0
- package/dist/es2017/parsers/texttracks/ttml/get_parameters.d.ts +32 -0
- package/dist/es2017/parsers/texttracks/ttml/get_parameters.js +88 -0
- package/dist/es2017/parsers/texttracks/ttml/get_styling.d.ts +41 -0
- package/dist/es2017/parsers/texttracks/ttml/get_styling.js +127 -0
- package/dist/es2017/parsers/texttracks/ttml/get_time_delimiters.d.ts +26 -0
- package/dist/es2017/parsers/texttracks/ttml/get_time_delimiters.js +41 -0
- package/dist/es2017/parsers/texttracks/ttml/html/apply_default_ttml_paragraph_style.d.ts +48 -0
- package/dist/es2017/parsers/texttracks/ttml/html/apply_default_ttml_paragraph_style.js +61 -0
- package/dist/es2017/parsers/texttracks/ttml/html/apply_extent.d.ts +21 -0
- package/dist/es2017/parsers/texttracks/ttml/html/apply_extent.js +61 -0
- package/dist/es2017/parsers/texttracks/ttml/html/apply_font_size.d.ts +21 -0
- package/dist/es2017/parsers/texttracks/ttml/html/apply_font_size.js +59 -0
- package/dist/es2017/parsers/texttracks/ttml/html/apply_line_height.d.ts +20 -0
- package/dist/es2017/parsers/texttracks/ttml/html/apply_line_height.js +44 -0
- package/dist/es2017/parsers/texttracks/ttml/html/apply_origin.d.ts +20 -0
- package/dist/es2017/parsers/texttracks/ttml/html/apply_origin.js +60 -0
- package/dist/es2017/parsers/texttracks/ttml/html/apply_padding.d.ts +20 -0
- package/dist/es2017/parsers/texttracks/ttml/html/apply_padding.js +139 -0
- package/dist/es2017/parsers/texttracks/ttml/html/create_element.d.ts +32 -0
- package/dist/es2017/parsers/texttracks/ttml/html/create_element.js +441 -0
- package/dist/es2017/parsers/texttracks/ttml/html/generate_css_test_outline.d.ts +26 -0
- package/dist/es2017/parsers/texttracks/ttml/html/generate_css_test_outline.js +41 -0
- package/dist/es2017/parsers/texttracks/ttml/html/index.d.ts +21 -0
- package/dist/es2017/parsers/texttracks/ttml/html/index.js +21 -0
- package/dist/es2017/parsers/texttracks/ttml/html/parse_cue.d.ts +26 -0
- package/dist/es2017/parsers/texttracks/ttml/html/parse_cue.js +39 -0
- package/dist/es2017/parsers/texttracks/ttml/html/parse_ttml_to_div.d.ts +34 -0
- package/dist/es2017/parsers/texttracks/ttml/html/parse_ttml_to_div.js +50 -0
- package/dist/es2017/parsers/texttracks/ttml/html/ttml_color_to_css_color.d.ts +21 -0
- package/dist/es2017/parsers/texttracks/ttml/html/ttml_color_to_css_color.js +57 -0
- package/dist/es2017/parsers/texttracks/ttml/native/index.d.ts +21 -0
- package/dist/es2017/parsers/texttracks/ttml/native/index.js +21 -0
- package/dist/es2017/parsers/texttracks/ttml/native/parse_cue.d.ts +30 -0
- package/dist/es2017/parsers/texttracks/ttml/native/parse_cue.js +202 -0
- package/dist/es2017/parsers/texttracks/ttml/native/parse_ttml_to_vtt.d.ts +21 -0
- package/dist/es2017/parsers/texttracks/ttml/native/parse_ttml_to_vtt.js +33 -0
- package/dist/es2017/parsers/texttracks/ttml/parse_ttml.d.ts +43 -0
- package/dist/es2017/parsers/texttracks/ttml/parse_ttml.js +153 -0
- package/dist/es2017/parsers/texttracks/ttml/regexps.d.ts +28 -0
- package/dist/es2017/parsers/texttracks/ttml/regexps.js +35 -0
- package/dist/es2017/parsers/texttracks/ttml/resolve_styles_inheritance.d.ts +49 -0
- package/dist/es2017/parsers/texttracks/ttml/resolve_styles_inheritance.js +80 -0
- package/dist/es2017/parsers/texttracks/ttml/time_parsing.d.ts +30 -0
- package/dist/es2017/parsers/texttracks/ttml/time_parsing.js +124 -0
- package/dist/es2017/parsers/texttracks/ttml/xml_utils.d.ts +70 -0
- package/dist/es2017/parsers/texttracks/ttml/xml_utils.js +149 -0
- package/dist/es2017/parsers/texttracks/types.d.ts +23 -0
- package/dist/es2017/parsers/texttracks/types.js +16 -0
- package/dist/es2017/parsers/texttracks/webvtt/get_cue_blocks.d.ts +24 -0
- package/dist/es2017/parsers/texttracks/webvtt/get_cue_blocks.js +44 -0
- package/dist/es2017/parsers/texttracks/webvtt/get_style_blocks.d.ts +24 -0
- package/dist/es2017/parsers/texttracks/webvtt/get_style_blocks.js +51 -0
- package/dist/es2017/parsers/texttracks/webvtt/html/convert_payload_to_html.d.ts +22 -0
- package/dist/es2017/parsers/texttracks/webvtt/html/convert_payload_to_html.js +35 -0
- package/dist/es2017/parsers/texttracks/webvtt/html/create_default_style_elements.d.ts +2 -0
- package/dist/es2017/parsers/texttracks/webvtt/html/create_default_style_elements.js +22 -0
- package/dist/es2017/parsers/texttracks/webvtt/html/create_style_attribute.d.ts +21 -0
- package/dist/es2017/parsers/texttracks/webvtt/html/create_style_attribute.js +172 -0
- package/dist/es2017/parsers/texttracks/webvtt/html/create_styled_element.d.ts +25 -0
- package/dist/es2017/parsers/texttracks/webvtt/html/create_styled_element.js +83 -0
- package/dist/es2017/parsers/texttracks/webvtt/html/index.d.ts +22 -0
- package/dist/es2017/parsers/texttracks/webvtt/html/index.js +21 -0
- package/dist/es2017/parsers/texttracks/webvtt/html/parse_style_block.d.ts +27 -0
- package/dist/es2017/parsers/texttracks/webvtt/html/parse_style_block.js +66 -0
- package/dist/es2017/parsers/texttracks/webvtt/html/parse_webvtt_to_div.d.ts +31 -0
- package/dist/es2017/parsers/texttracks/webvtt/html/parse_webvtt_to_div.js +55 -0
- package/dist/es2017/parsers/texttracks/webvtt/html/to_html.d.ts +43 -0
- package/dist/es2017/parsers/texttracks/webvtt/html/to_html.js +72 -0
- package/dist/es2017/parsers/texttracks/webvtt/native/index.d.ts +21 -0
- package/dist/es2017/parsers/texttracks/webvtt/native/index.js +21 -0
- package/dist/es2017/parsers/texttracks/webvtt/native/parse_vtt_to_cues.d.ts +28 -0
- package/dist/es2017/parsers/texttracks/webvtt/native/parse_vtt_to_cues.js +58 -0
- package/dist/es2017/parsers/texttracks/webvtt/native/set_settings_on_cue.d.ts +23 -0
- package/dist/es2017/parsers/texttracks/webvtt/native/set_settings_on_cue.js +80 -0
- package/dist/es2017/parsers/texttracks/webvtt/native/to_native_cue.d.ts +25 -0
- package/dist/es2017/parsers/texttracks/webvtt/native/to_native_cue.js +25 -0
- package/dist/es2017/parsers/texttracks/webvtt/parse_cue_block.d.ts +33 -0
- package/dist/es2017/parsers/texttracks/webvtt/parse_cue_block.js +101 -0
- package/dist/es2017/parsers/texttracks/webvtt/parse_timestamp.d.ts +21 -0
- package/dist/es2017/parsers/texttracks/webvtt/parse_timestamp.js +34 -0
- package/dist/es2017/parsers/texttracks/webvtt/utils.d.ts +56 -0
- package/dist/es2017/parsers/texttracks/webvtt/utils.js +113 -0
- package/dist/es2017/public_types.d.ts +825 -0
- package/dist/es2017/public_types.js +16 -0
- package/dist/es2017/tools/TextTrackRenderer/index.d.ts +22 -0
- package/dist/es2017/tools/TextTrackRenderer/index.js +22 -0
- package/dist/es2017/tools/TextTrackRenderer/text_track_renderer.d.ts +70 -0
- package/dist/es2017/tools/TextTrackRenderer/text_track_renderer.js +78 -0
- package/dist/es2017/tools/index.d.ts +18 -0
- package/dist/es2017/tools/index.js +18 -0
- package/dist/es2017/tools/string_utils/index.d.ts +16 -0
- package/dist/es2017/tools/string_utils/index.js +16 -0
- package/dist/es2017/transports/dash/add_segment_integrity_checks_to_loader.d.ts +24 -0
- package/dist/es2017/transports/dash/add_segment_integrity_checks_to_loader.js +82 -0
- package/dist/es2017/transports/dash/construct_segment_url.d.ts +18 -0
- package/dist/es2017/transports/dash/construct_segment_url.js +21 -0
- package/dist/es2017/transports/dash/extract_complete_chunks.d.ts +24 -0
- package/dist/es2017/transports/dash/extract_complete_chunks.js +59 -0
- package/dist/es2017/transports/dash/get_events_out_of_emsgs.d.ts +28 -0
- package/dist/es2017/transports/dash/get_events_out_of_emsgs.js +92 -0
- package/dist/es2017/transports/dash/index.d.ts +21 -0
- package/dist/es2017/transports/dash/index.js +21 -0
- package/dist/es2017/transports/dash/init_segment_loader.d.ts +28 -0
- package/dist/es2017/transports/dash/init_segment_loader.js +85 -0
- package/dist/es2017/transports/dash/low_latency_segment_loader.d.ts +30 -0
- package/dist/es2017/transports/dash/low_latency_segment_loader.js +68 -0
- package/dist/es2017/transports/dash/manifest_parser.d.ts +18 -0
- package/dist/es2017/transports/dash/manifest_parser.js +282 -0
- package/dist/es2017/transports/dash/pipelines.d.ts +23 -0
- package/dist/es2017/transports/dash/pipelines.js +55 -0
- package/dist/es2017/transports/dash/segment_loader.d.ts +38 -0
- package/dist/es2017/transports/dash/segment_loader.js +173 -0
- package/dist/es2017/transports/dash/segment_parser.d.ts +23 -0
- package/dist/es2017/transports/dash/segment_parser.js +140 -0
- package/dist/es2017/transports/dash/text_loader.d.ts +25 -0
- package/dist/es2017/transports/dash/text_loader.js +85 -0
- package/dist/es2017/transports/dash/text_parser.d.ts +25 -0
- package/dist/es2017/transports/dash/text_parser.js +171 -0
- package/dist/es2017/transports/index.d.ts +16 -0
- package/dist/es2017/transports/index.js +16 -0
- package/dist/es2017/transports/local/index.d.ts +17 -0
- package/dist/es2017/transports/local/index.js +17 -0
- package/dist/es2017/transports/local/pipelines.d.ts +22 -0
- package/dist/es2017/transports/local/pipelines.js +65 -0
- package/dist/es2017/transports/local/segment_loader.d.ts +28 -0
- package/dist/es2017/transports/local/segment_loader.js +144 -0
- package/dist/es2017/transports/local/segment_parser.d.ts +20 -0
- package/dist/es2017/transports/local/segment_parser.js +77 -0
- package/dist/es2017/transports/local/text_parser.d.ts +27 -0
- package/dist/es2017/transports/local/text_parser.js +143 -0
- package/dist/es2017/transports/metaplaylist/index.d.ts +21 -0
- package/dist/es2017/transports/metaplaylist/index.js +21 -0
- package/dist/es2017/transports/metaplaylist/manifest_loader.d.ts +26 -0
- package/dist/es2017/transports/metaplaylist/manifest_loader.js +42 -0
- package/dist/es2017/transports/metaplaylist/pipelines.d.ts +17 -0
- package/dist/es2017/transports/metaplaylist/pipelines.js +229 -0
- package/dist/es2017/transports/smooth/extract_timings_infos.d.ts +62 -0
- package/dist/es2017/transports/smooth/extract_timings_infos.js +81 -0
- package/dist/es2017/transports/smooth/index.d.ts +21 -0
- package/dist/es2017/transports/smooth/index.js +21 -0
- package/dist/es2017/transports/smooth/is_mp4_embedded_track.d.ts +22 -0
- package/dist/es2017/transports/smooth/is_mp4_embedded_track.js +24 -0
- package/dist/es2017/transports/smooth/isobmff/create_audio_init_segment.d.ts +29 -0
- package/dist/es2017/transports/smooth/isobmff/create_audio_init_segment.js +52 -0
- package/dist/es2017/transports/smooth/isobmff/create_boxes.d.ts +171 -0
- package/dist/es2017/transports/smooth/isobmff/create_boxes.js +328 -0
- package/dist/es2017/transports/smooth/isobmff/create_init_segment.d.ts +33 -0
- package/dist/es2017/transports/smooth/isobmff/create_init_segment.js +65 -0
- package/dist/es2017/transports/smooth/isobmff/create_traf_box.d.ts +16 -0
- package/dist/es2017/transports/smooth/isobmff/create_traf_box.js +24 -0
- package/dist/es2017/transports/smooth/isobmff/create_video_init_segment.d.ts +29 -0
- package/dist/es2017/transports/smooth/isobmff/create_video_init_segment.js +57 -0
- package/dist/es2017/transports/smooth/isobmff/get_aaces_header.d.ts +27 -0
- package/dist/es2017/transports/smooth/isobmff/get_aaces_header.js +55 -0
- package/dist/es2017/transports/smooth/isobmff/index.d.ts +21 -0
- package/dist/es2017/transports/smooth/isobmff/index.js +21 -0
- package/dist/es2017/transports/smooth/isobmff/parse_tfrf.d.ts +24 -0
- package/dist/es2017/transports/smooth/isobmff/parse_tfrf.js +47 -0
- package/dist/es2017/transports/smooth/isobmff/parse_tfxd.d.ts +24 -0
- package/dist/es2017/transports/smooth/isobmff/parse_tfxd.js +31 -0
- package/dist/es2017/transports/smooth/isobmff/patch_segment.d.ts +23 -0
- package/dist/es2017/transports/smooth/isobmff/patch_segment.js +127 -0
- package/dist/es2017/transports/smooth/pipelines.d.ts +17 -0
- package/dist/es2017/transports/smooth/pipelines.js +291 -0
- package/dist/es2017/transports/smooth/segment_loader.d.ts +27 -0
- package/dist/es2017/transports/smooth/segment_loader.js +198 -0
- package/dist/es2017/transports/smooth/utils.d.ts +26 -0
- package/dist/es2017/transports/smooth/utils.js +32 -0
- package/dist/es2017/transports/types.d.ts +701 -0
- package/dist/es2017/transports/types.js +16 -0
- package/dist/es2017/transports/utils/byte_range.d.ts +21 -0
- package/dist/es2017/transports/utils/byte_range.js +24 -0
- package/dist/es2017/transports/utils/call_custom_manifest_loader.d.ts +19 -0
- package/dist/es2017/transports/utils/call_custom_manifest_loader.js +94 -0
- package/dist/es2017/transports/utils/check_isobmff_integrity.d.ts +23 -0
- package/dist/es2017/transports/utils/check_isobmff_integrity.js +46 -0
- package/dist/es2017/transports/utils/find_complete_box.d.ts +25 -0
- package/dist/es2017/transports/utils/find_complete_box.js +53 -0
- package/dist/es2017/transports/utils/generate_manifest_loader.d.ts +26 -0
- package/dist/es2017/transports/utils/generate_manifest_loader.js +64 -0
- package/dist/es2017/transports/utils/get_isobmff_timing_infos.d.ts +29 -0
- package/dist/es2017/transports/utils/get_isobmff_timing_infos.js +66 -0
- package/dist/es2017/transports/utils/infer_segment_container.d.ts +29 -0
- package/dist/es2017/transports/utils/infer_segment_container.js +44 -0
- package/dist/es2017/transports/utils/parse_text_track.d.ts +56 -0
- package/dist/es2017/transports/utils/parse_text_track.js +140 -0
- package/dist/es2017/utils/are_arrays_of_numbers_equal.d.ts +22 -0
- package/dist/es2017/utils/are_arrays_of_numbers_equal.js +35 -0
- package/dist/es2017/utils/are_codecs_compatible.d.ts +25 -0
- package/dist/es2017/utils/are_codecs_compatible.js +44 -0
- package/dist/es2017/utils/array_find.d.ts +23 -0
- package/dist/es2017/utils/array_find.js +35 -0
- package/dist/es2017/utils/array_find_index.d.ts +23 -0
- package/dist/es2017/utils/array_find_index.js +34 -0
- package/dist/es2017/utils/array_includes.d.ts +53 -0
- package/dist/es2017/utils/array_includes.js +81 -0
- package/dist/es2017/utils/assert.d.ts +34 -0
- package/dist/es2017/utils/assert.js +51 -0
- package/dist/es2017/utils/assert_unreachable.d.ts +40 -0
- package/dist/es2017/utils/assert_unreachable.js +43 -0
- package/dist/es2017/utils/base64.d.ts +14 -0
- package/dist/es2017/utils/base64.js +147 -0
- package/dist/es2017/utils/byte_parsing.d.ts +123 -0
- package/dist/es2017/utils/byte_parsing.js +227 -0
- package/dist/es2017/utils/cancellable_sleep.d.ts +30 -0
- package/dist/es2017/utils/cancellable_sleep.js +35 -0
- package/dist/es2017/utils/create_cancellable_promise.d.ts +26 -0
- package/dist/es2017/utils/create_cancellable_promise.js +52 -0
- package/dist/es2017/utils/deep_merge.d.ts +9 -0
- package/dist/es2017/utils/deep_merge.js +40 -0
- package/dist/es2017/utils/event_emitter.d.ts +62 -0
- package/dist/es2017/utils/event_emitter.js +100 -0
- package/dist/es2017/utils/flat_map.d.ts +22 -0
- package/dist/es2017/utils/flat_map.js +37 -0
- package/dist/es2017/utils/get_fuzzed_delay.d.ts +21 -0
- package/dist/es2017/utils/get_fuzzed_delay.js +25 -0
- package/dist/es2017/utils/hash_buffer.d.ts +32 -0
- package/dist/es2017/utils/hash_buffer.js +41 -0
- package/dist/es2017/utils/id_generator.d.ts +21 -0
- package/dist/es2017/utils/id_generator.js +33 -0
- package/dist/es2017/utils/initialization_segment_cache.d.ts +42 -0
- package/dist/es2017/utils/initialization_segment_cache.js +48 -0
- package/dist/es2017/utils/is_non_empty_string.d.ts +20 -0
- package/dist/es2017/utils/is_non_empty_string.js +22 -0
- package/dist/es2017/utils/is_null_or_undefined.d.ts +24 -0
- package/dist/es2017/utils/is_null_or_undefined.js +26 -0
- package/dist/es2017/utils/languages/ISO_639-1_to_ISO_639-3.d.ts +22 -0
- package/dist/es2017/utils/languages/ISO_639-1_to_ISO_639-3.js +205 -0
- package/dist/es2017/utils/languages/ISO_639-2_to_ISO_639-3.d.ts +22 -0
- package/dist/es2017/utils/languages/ISO_639-2_to_ISO_639-3.js +41 -0
- package/dist/es2017/utils/languages/index.d.ts +18 -0
- package/dist/es2017/utils/languages/index.js +18 -0
- package/dist/es2017/utils/languages/normalize.d.ts +68 -0
- package/dist/es2017/utils/languages/normalize.js +119 -0
- package/dist/es2017/utils/logger.d.ts +46 -0
- package/dist/es2017/utils/logger.js +77 -0
- package/dist/es2017/utils/monotonic_timestamp.d.ts +9 -0
- package/dist/es2017/utils/monotonic_timestamp.js +12 -0
- package/dist/es2017/utils/noop.d.ts +23 -0
- package/dist/es2017/utils/noop.js +25 -0
- package/dist/es2017/utils/object_assign.d.ts +22 -0
- package/dist/es2017/utils/object_assign.js +40 -0
- package/dist/es2017/utils/object_values.d.ts +30 -0
- package/dist/es2017/utils/object_values.js +26 -0
- package/dist/es2017/utils/ranges.d.ts +212 -0
- package/dist/es2017/utils/ranges.js +502 -0
- package/dist/es2017/utils/reference.d.ts +214 -0
- package/dist/es2017/utils/reference.js +287 -0
- package/dist/es2017/utils/request/fetch.d.ts +76 -0
- package/dist/es2017/utils/request/fetch.js +148 -0
- package/dist/es2017/utils/request/index.d.ts +19 -0
- package/dist/es2017/utils/request/index.js +19 -0
- package/dist/es2017/utils/request/xhr.d.ts +95 -0
- package/dist/es2017/utils/request/xhr.js +162 -0
- package/dist/es2017/utils/resolve_url.d.ts +35 -0
- package/dist/es2017/utils/resolve_url.js +113 -0
- package/dist/es2017/utils/retry_promise_with_backoff.d.ts +46 -0
- package/dist/es2017/utils/retry_promise_with_backoff.js +69 -0
- package/dist/es2017/utils/sleep.d.ts +10 -0
- package/dist/es2017/utils/sleep.js +14 -0
- package/dist/es2017/utils/slice_uint8array.d.ts +27 -0
- package/dist/es2017/utils/slice_uint8array.js +42 -0
- package/dist/es2017/utils/sorted_list.d.ts +127 -0
- package/dist/es2017/utils/sorted_list.js +177 -0
- package/dist/es2017/utils/starts_with.d.ts +26 -0
- package/dist/es2017/utils/starts_with.js +36 -0
- package/dist/es2017/utils/string_parsing.d.ts +88 -0
- package/dist/es2017/utils/string_parsing.js +372 -0
- package/dist/es2017/utils/task_canceller.d.ts +263 -0
- package/dist/es2017/utils/task_canceller.js +299 -0
- package/dist/es2017/utils/warn_once.d.ts +23 -0
- package/dist/es2017/utils/warn_once.js +31 -0
- package/dist/es2017/utils/weak_map_memory.d.ts +70 -0
- package/dist/es2017/utils/weak_map_memory.js +84 -0
- package/dist/es2017/utils/wrapInPromise.d.ts +7 -0
- package/dist/es2017/utils/wrapInPromise.js +22 -0
- package/dist/rx-player.d.ts +1 -1
- package/dist/rx-player.js +40 -73
- package/dist/rx-player.min.d.ts +1 -1
- package/dist/rx-player.min.js +1 -1
- package/experimental/features/index.d.ts +1 -1
- package/experimental/features/index.js +1 -1
- package/experimental/index.d.ts +1 -1
- package/experimental/index.js +1 -1
- package/{scripts/build/templates/experimental/tools/VideoThumbnailLoader/index.js → experimental/tools/VideoThumbnailLoader.d.ts} +2 -2
- package/experimental/tools/{VideoThumbnailLoader/index.d.ts → VideoThumbnailLoader.js} +2 -2
- package/experimental/tools/createMetaplaylist.d.ts +18 -0
- package/experimental/tools/createMetaplaylist.js +18 -0
- package/experimental/tools/index.d.ts +1 -1
- package/experimental/tools/index.js +1 -1
- package/experimental/tools/mediaCapabilitiesProber.d.ts +18 -0
- package/experimental/tools/mediaCapabilitiesProber.js +18 -0
- package/experimental/tools/parseBIFThumbnails.d.ts +18 -0
- package/experimental/tools/parseBIFThumbnails.js +18 -0
- package/features/index.d.ts +1 -1
- package/features/index.js +1 -1
- package/jest.config.js +2 -21
- package/logger/index.d.ts +1 -1
- package/logger/index.js +1 -1
- package/minimal/index.d.ts +1 -1
- package/minimal/index.js +1 -1
- package/package.json +120 -34
- package/scripts/build/{generate_build.js → generate_build.mjs} +30 -26
- package/{experimental/tools/VideoThumbnailLoader/index.js → scripts/build/templates/experimental/tools/VideoThumbnailLoader.d.ts} +2 -2
- package/scripts/build/templates/experimental/tools/VideoThumbnailLoader.js +18 -0
- package/scripts/build/templates/experimental/tools/createMetaplaylist.d.ts +18 -0
- package/scripts/build/templates/experimental/tools/createMetaplaylist.js +18 -0
- package/scripts/build/templates/experimental/tools/mediaCapabilitiesProber.d.ts +18 -0
- package/scripts/build/templates/experimental/tools/mediaCapabilitiesProber.js +18 -0
- package/scripts/build/templates/experimental/tools/parseBIFThumbnails.d.ts +18 -0
- package/scripts/build/templates/experimental/tools/parseBIFThumbnails.js +18 -0
- package/scripts/build/templates/tools/string-utils.d.ts +2 -2
- package/scripts/build/templates/tools/string-utils.js +2 -2
- package/scripts/{fast_demo_build.js → build_demo.mjs} +18 -17
- package/scripts/{generate_demo_list.js → generate_demo_list.mjs} +15 -10
- package/scripts/{generate_documentation_list.js → generate_documentation_list.mjs} +16 -11
- package/scripts/generate_standalone_demo.mjs +109 -0
- package/scripts/{launch_static_server.js → launch_static_server.mjs} +8 -8
- package/scripts/{list-npm-scripts.js → list-npm-scripts.mjs} +7 -7
- package/scripts/{run_standalone_demo.js → run_standalone_demo.mjs} +12 -7
- package/scripts/start_demo_web_server.mjs +59 -0
- package/scripts/update-version +1 -1
- package/scripts/update_gh-pages_demo +4 -4
- package/scripts/update_gh-pages_doc +4 -4
- package/scripts/utils/{display_webpack_errors.js → display_webpack_errors.mjs} +1 -1
- package/scripts/utils/{get_human_readable_hours.js → get_human_readable_hours.mjs} +1 -3
- package/scripts/utils/project_root_directory.mjs +4 -0
- package/scripts/{wasm-strip.js → wasm-strip.mjs} +11 -6
- package/sonar-project.properties +1 -1
- package/src/compat/README.md +18 -12
- package/src/core/adaptive/adaptive_representation_selector.ts +5 -3
- package/src/core/adaptive/utils/filter_by_resolution.ts +1 -3
- package/src/core/api/public_api.ts +2 -2
- package/src/core/segment_buffers/inventory/segment_inventory.ts +7 -14
- package/src/experimental/README.md +4 -0
- package/src/experimental/tools/{parseBIFThumbnails.ts → parseBIFThumbnails/index.ts} +1 -1
- package/src/globals.dev.d.ts +15 -0
- package/src/globals.prod.d.ts +15 -0
- package/src/parsers/manifest/smooth/create_parser.ts +1 -2
- package/src/tools/README.md +4 -0
- package/src/tools/{string_utils.ts → string_utils/index.ts} +1 -1
- package/src/transports/dash/segment_parser.ts +1 -2
- package/src/transports/dash/text_parser.ts +1 -2
- package/src/transports/local/segment_parser.ts +1 -2
- package/src/transports/local/text_parser.ts +2 -3
- package/tools/TextTrackRenderer.d.ts +2 -2
- package/tools/TextTrackRenderer.js +2 -2
- package/tools/index.d.ts +1 -1
- package/tools/index.js +1 -1
- package/tools/string-utils.d.ts +2 -2
- package/tools/string-utils.js +2 -2
- package/tsconfig.commonjs.json +9 -0
- package/tsconfig.eslint.json +7 -0
- package/tsconfig.jest.json +15 -0
- package/tsconfig.json +10 -6
- package/types/index.d.ts +1 -1
- package/webpack.config.mjs +97 -0
- package/scripts/generate_full_demo.js +0 -201
- package/scripts/generate_standalone_demo.js +0 -82
- package/scripts/start_demo_web_server.js +0 -44
- package/src/utils/__tests__/take_first_set.test.ts +0 -38
- package/src/utils/take_first_set.ts +0 -53
- package/tsconfig.modules.json +0 -34
- /package/dist/{_esm5.processed → commonjs}/compat/global_scope.d.ts +0 -0
- /package/dist/{_esm5.processed → commonjs}/compat/is_worker.d.ts +0 -0
- /package/dist/{_esm5.processed → commonjs}/compat/is_worker.js +0 -0
- /package/dist/{_esm5.processed → commonjs}/core/adaptive/utils/filter_by_resolution.d.ts +0 -0
- /package/dist/{_esm5.processed → commonjs}/core/api/track_management/index.d.ts +0 -0
- /package/dist/{_esm5.processed → commonjs}/core/api/track_management/media_element_tracks_store.d.ts +0 -0
- /package/dist/{_esm5.processed → commonjs}/core/api/track_management/track_dispatcher.d.ts +0 -0
- /package/dist/{_esm5.processed → commonjs}/core/api/track_management/tracks_store.d.ts +0 -0
- /package/dist/{_esm5.processed → commonjs}/core/segment_buffers/inventory/utils.d.ts +0 -0
- /package/dist/{_esm5.processed → commonjs}/core/stream/adaptation/get_representations_switch_strategy.d.ts +0 -0
- /package/dist/{_esm5.processed → commonjs}/index.d.ts +0 -0
- /package/dist/{_esm5.processed → commonjs}/parsers/manifest/smooth/shared_smooth_segment_timeline.d.ts +0 -0
- /package/dist/{_esm5.processed → commonjs}/transports/smooth/is_mp4_embedded_track.d.ts +0 -0
- /package/dist/{_esm5.processed → commonjs}/transports/smooth/is_mp4_embedded_track.js +0 -0
- /package/dist/{_esm5.processed → commonjs}/utils/monotonic_timestamp.d.ts +0 -0
- /package/dist/{_esm5.processed → commonjs}/utils/monotonic_timestamp.js +0 -0
package/dist/rx-player.min.js
CHANGED
|
@@ -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={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-dev.2023102700",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-dev.2023102700";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.segmentLoader;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,"&").replace(/<|\u003C/g,"<").replace(/>|\u2265/g,">").replace(/\u200E/g,"‎").replace(/\u200F/g,"‏").replace(/\u00A0/g," ")}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&&(" "===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(" "===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}()}));
|
|
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 rv}});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-dev.2023110700",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-dev.2023110700";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}();var Vt=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 Kt="function"==typeof Object.values?Object.values:function(e){return Object.keys(e).map((function(t){return e[t]}))},Gt=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 Kt(this._currentRequests).filter((function(e){return null!=e})).sort((function(e,t){return e.content.segment.time-t.content.segment.time}))},e}(),Wt=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 jt(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 Ht=new E(void 0);Ht.finish();var qt=new E(1/0);qt.finish();var Yt=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 Wt,c=new Ot(null!=o?o:0,s),f=new Gt,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 Vt,_=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=e.slice().sort((function(e,t){var n,r;return(null!==(n=e.width)&&void 0!==n?n:0)-(null!==(r=t.width)&&void 0!==r?r:0)})),a=be(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}(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=jt(T,I),N=h.getLastEstimate(),O=D.bitrate,L=null;o&&void 0!==N&&N>O&&(O=(L=jt(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:Ht,throttleBitrate:null!==(c=r.throttleBitrate[f])&&void 0!==c?c:qt},initialBitrate:h,playbackObserver:s,representations:o,lowLatencyMode:i},u)}},Qt=[];function $t(e){Se(Qt,e)||(console.warn(e),Qt.push(e))}var Xt={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"},Zt={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 Jt(e){if(h(e)||""===e)return"";var t=function(e){var t;switch(e.length){case 2:t=Xt[e];break;case 3:t=Zt[e]}return t}((""+e).toLowerCase().split("-")[0]);return p(t)?t:e}var en=Jt,tn=w,nn=void 0===tn?void 0:h(tn.MediaSource)?h(tn.MozMediaSource)?h(tn.WebKitMediaSource)?tn.MSMediaSource:tn.WebKitMediaSource:tn.MozMediaSource:tn.MediaSource,rn=1;function an(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 on(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 sn(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 sn(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 sn(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 un,ln=Ae(),dn=function(){function e(e,t){if(this.id=e.id,this.uniqueId=ln(),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!=nn&&("function"!=typeof nn.isTypeSupported||nn.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=on(i);!(a=s()).done;){an(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(an(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}(),cn=dn,fn=["audio","video","text"],vn=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=en(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 cn(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}(),pn=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 vn(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 Kt(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 hn(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 mn(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 mn(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 mn(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 gn(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===un.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=hn(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 yn(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}!function(e){e[e.Full=0]="Full",e[e.Partial=1]="Partial"}(un||(un={}));var bn=Ae(),Sn=function(e){function t(t,n,r){var i,a;i=e.call(this)||this;var o=n.representationFilter,s=n.manifestUpdateUrl;i.id=bn(),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 pn(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,un.Full)},n.update=function(e){this._performUpdate(e,un.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=yn(e.periods);!(n=i()).done;)for(var a,o=n.value,s=yn(o.getAdaptations());!(a=s()).done;)for(var u,l=a.value,d=yn(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(){$t("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){$t("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 $t("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===un.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=gn(s,a,un.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=gn(e[o],t[0],un.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=gn(e[c],d,un.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 En=Sn,Tn=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 kn(e){return e instanceof Tn?new pe("PIPELINE_LOAD_ERROR",e):ge(e,{defaultCode:"PIPELINE_LOAD_ERROR",defaultReason:"Unknown error when fetching the Manifest"})}var wn=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 An(e,t){return xt(t,(function(t){var n=setTimeout((function(){return t()}),e);return function(){return clearTimeout(n)}}))}var In=.3;function Rn(e){return e*((2*Math.random()-1)*In+1)}function xn(e,t,n,r,i){return Mn.apply(this,arguments)}function Mn(){return Mn=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),An(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 Tn?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 wn?"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=Rn(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)}))),Mn.apply(this,arguments)}function Cn(e,t,n){return xn(null,null,e,t,n)}function Pn(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 Dn(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 Dn(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 Dn(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 Nn=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 En?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 Cn((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",kn(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),kn(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=Pn(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,Cn(t,d,o);case 3:return n=e.sent,e.abrupt("return",n);case 7:throw e.prev=7,e.t0=e.catch(0),kn(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",kn(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 On=Nn;function Ln(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 Bn=function(e){function t(t){var n;return(n=e.call(this)||this)._downgradedCdnList={metadata:[],timeouts:[]},t.register((function(){for(var e,t=Ln(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=Fn(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=Fn(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 Fn(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 zn(e,t){return e.segment.id===t.segment.id&&e.representation.uniqueId===t.representation.uniqueId}function Vn(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 Kn=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}(),Gn=Ae();var Wn=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=jn(e.taskFn,this._waitingQueue);if(t>=0)this._waitingQueue.splice(t,1);else{var n=jn(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=jn(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=jn(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=jn(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 jn(e,t){return g(t,(function(t){return t.taskFn===e}))}var Hn=function(){function e(e,t,n){var r=new Bn(n),i=v.getCurrent(),a=i.MIN_CANCELABLE_PRIORITY,o=i.MAX_HIGH_PRIORITY_LEVEL;this._transport=e,this._prioritizer=new Wn({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 Kn: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(kn(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=Vn(t),E=Gn(),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,xn(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}),kn(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}(),qn=Hn;function Yn(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 Qn(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 Qn(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 Qn(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 $n=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 zn(t.context,e)}))},t._cleanHistory=function(e){for(var t,n=e-this._lifetime,r=0,i=Yn(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 Xn(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 Zn(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 Zn(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 Zn(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 Jn=function(){function e(){var e=v.getCurrent(),t=e.BUFFERED_HISTORY_RETENTION_TIME,n=e.BUFFERED_HISTORY_MAXIMUM_ENTRIES;this._inventory=[],this._bufferedHistory=new $n(t,n)}var t=e.prototype;return t.reset=function(){this._inventory.length=0},t.synchronizeBuffered=function(e){for(var t,n,r,i,a,o,s,u=this._inventory,l=0,d=u[0],c=v.getCurrent().MINIMUM_SEGMENT_SIZE,f=null==d?void 0:d.infos.adaptation.type,p=e.length,h=0;h<p;h++){if(void 0===d)return;var m=e.start(h),g=e.end(h);if(g-m<c)ne.warn("SI: skipped TimeRange when synchronizing because it was too small",f,m,g);else{for(var y=l;void 0!==d&&(null!==(t=d.bufferedEnd)&&void 0!==t?t:d.end)-m<c;)d=u[++l];var _=null,b=l-y;if(b>0){var S=u[y+b-1];_={end:null!==(n=S.bufferedEnd)&&void 0!==n?n:S.end,precizeEnd:S.precizeEnd},ne.debug("SI: "+b+" segments GCed.",f);for(var E,T=Xn(u.splice(y,b));!(E=T()).done;){var k=E.value;void 0===k.bufferedStart&&void 0===k.bufferedEnd&&this._bufferedHistory.addBufferedSegment(k.infos,null)}l=y}if(void 0===d)return;if(g-(null!==(r=d.bufferedStart)&&void 0!==r?r:d.start)>=c){if(nr(d,m,_,f),l===u.length-1)return void rr(d,g,f);for(var w=null!==(i=(d=u[++l]).bufferedStart)&&void 0!==i?i:d.start,A=null!==(a=d.bufferedEnd)&&void 0!==a?a:d.end,I=h<p-1?e.start(h+1):void 0;void 0!==d&&g-w>=c&&(void 0===I||g-w>=A-I);){var R=u[l-1];void 0===R.bufferedEnd&&(R.bufferedEnd=d.precizeStart?d.start:R.end,ne.debug("SI: calculating buffered end of contiguous segment",f,R.bufferedEnd,R.end)),d.bufferedStart=R.bufferedEnd,void 0!==(d=u[++l])&&(w=null!==(o=d.bufferedStart)&&void 0!==o?o:d.start,A=null!==(s=d.bufferedEnd)&&void 0!==s?s:d.end)}}var x=u[l-1];void 0!==x&&rr(x,g,f)}}if(null!=d){ne.debug("SI: last segments have been GCed",f,l,u.length);for(var M,C=Xn(u.splice(l,u.length-l));!(M=C()).done;){var P=M.value;void 0===P.bufferedStart&&void 0===P.bufferedEnd&&this._bufferedHistory.addBufferedSegment(P.infos,null)}}void 0!==f&&ne.hasLevel("DEBUG")&&ne.debug("SI: current "+f+" 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(zn(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&&zn(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=Xn(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 er(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 tr(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 nr(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&&er(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,er(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,er(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 rr(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&&tr(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,tr(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 ir,ar=Jn,or=function(){function e(){this._segmentInventory=new ar}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 sr(e){}!function(e){e[e.Push=0]="Push",e[e.Remove=1]="Remove",e[e.EndOfSegment=2]="EndOfSegment"}(ir||(ir={}));var ur=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){sr(t),this._initSegmentsMap.set(e,t)},n.freeInitSegment=function(e){this._initSegmentsMap.delete(e)},n.pushChunk=function(e,t){return sr(e.data.chunk),ne.debug("AVSB: receiving order to push data to the SourceBuffer",this.bufferType,Vn(e.inventoryInfos)),this._addToQueue({type:ir.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:ir.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,Vn(e)),this._addToQueue({type:ir.EndOfSegment,value:e},t)},n.getBufferedRanges=function(){return this._sourceBuffer.buffered},n.getPendingOperations=function(){var e=function(e){switch(e.type){case ir.Push:case ir.Remove:case ir.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!==ir.Push||0===e.data.length){switch(e.type){case ir.Push:null!==e.inventoryData&&this._segmentInventory.insertChunk(e.inventoryData);break;case ir.EndOfSegment:this._segmentInventory.completeSegment(e.value,this.getBufferedRanges());break;case ir.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!==ir.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 ir.EndOfSegment:return ne.debug("AVSB: Acknowledging complete segment",Vn(this._pendingTask.value)),void this._flush();case ir.Push:var o=this._pendingTask.data.shift();if(void 0===o)return void this._flush();ne.debug("AVSB: pushing segment",this.bufferType,Vn(this._pendingTask.inventoryData)),this._sourceBuffer.appendBuffer(o);break;case ir.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}(or),lr=["audio","video","text"];function dr(e){return"audio"===e||"video"===e}var cr=function(){function e(e,t){this._mediaElement=e,this._mediaSource=t,this._initializedSegmentBuffers={},this._onNativeBufferAddedOrDisabled=[]}e.isNative=function(e){return dr(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(dr(e)){if(null!=i)return i instanceof ur&&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 ur(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;lr.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}(),fr=n(473),vr=n.n(fr),pr=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}(),hr=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 mr(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 gr.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 gr(){return(gr=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 yr=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 _r(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 br(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!Er(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 zn(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)&&!Er(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||Sr(h,x).end<p-b;return C&&(f-=w),C}}return f-=w,!0}));return{segmentsToLoad:T,segmentsOnHold:E,isBufferFull:S}}function Sr(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 Er(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 Tr(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 kr(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)&&cr.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===ir.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=br({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:Tr(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:_r(e,l,S,b,f),hasFinishedLoading:b,neededSegments:_,isBufferFull:y,shouldRefreshManifest:d}}function wr(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 Ar(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 Ar(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 Ar(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 Ir(e,t,n){return Rr.apply(this,arguments)}function Rr(){return(Rr=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=xr(t,o,i)).length&&(s=xr(t,o,a)),ne.hasLevel("DEBUG")&&ne.debug("Stream: GC cleaning",s.map((function(e){return"start: "+e.start+" - end "+e.end})).join(", ")),u=wr(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 xr(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 Mr(e,t,n,r){return Cr.apply(this,arguments)}function Cr(){return Cr=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,Ir(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]])}))),Cr.apply(this,arguments)}function Pr(){return Pr=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,Mr(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)}))),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,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,Mr(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)}))),Dr.apply(this,arguments)}function Nr(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 Or(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 Or(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 Or(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 Lr=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 yr(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=kr(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:Tr(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=Nr(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 Dr.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 Pr.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 Ur(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 Br(e,t){for(var n=0;n<e.length;n++)if(e[n].infos.period.start>t.start)return e[n];return null}function Fr(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=Ur(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=Br(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 zr(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 Vr(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 Vr(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 Vr(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 Kr=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=Fr(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",vr()((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=zr(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),An(4e3,g.signal).then((function(){return P(e,n,i,o)})).catch(m)}},terminating:function(){u.cancel(),i.terminating()}});Lr({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=zr(n.updatedPeriods);!(r=i()).done;){var a=r.value;if(a.period.id===p.id)for(var s,u=zr(a.result.updatedAdaptations);!(s=u()).done;){var l=s.value;if(l.adaptation.id===h.id)for(var d,c=zr(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 Gr(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 Wr=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 Gr(e,"codecs=")})),l=be(s,(function(e){return Gr(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 jr(e,t,n,r,i,a){if(void 0!==e.codec&&"reload"===a.onCodecSwitch&&!function(e,t){return e.getPlayableRepresentations().some((function(e){return Wr(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 Wr(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=Ur(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=Br(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 Hr(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 qr(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 qr(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 qr(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 Yr(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 Qr(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 $r=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"),!cr.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",Qr(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,!cr.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=Hr(e.updatedPeriods);!(t=n()).done;){var r=t.value;if(r.period.id===m.id)for(var i,a=Hr(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=Yr(d,r,k,c),R={currentTime:o.getCurrentTime(),readyState:A},"needs-reload"!==(x=jr(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=Hr(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);Kr({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(!cr.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 Qr(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){vr()((function(){o.listen((function(){i.isCancelled()||t.waitingMediaSourceReload({bufferType:r,period:m,timeOffset:e,stayInPeriod:n})}),{includeLastObservation:!0,clearSignal:i})}))}};function Xr(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 Zr(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 Jr(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 Jr(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 Jr(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 ei(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 ti=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 hr((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){mr({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=Zr(r.getBufferTypes());!(u=b()).done;){E(u.value,d)}function E(e,n){var i=new pr((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=Xr(p,m),y=Xr(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:vr()((function(){var e;if(!s.isCancelled()){var n=t.getReference().getValue();if(ei(n,g)){if(o.needsDecipherabilityFlush(),s.isCancelled())return}else if(ei(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)}});$r(m,g,f.signal),v=f.signal,l.addEventListener("manifestUpdate",(function(t){for(var n,r=Zr(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 vr()((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)}},ni=ti,ri=function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t}(we);function ii(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 ai(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 ai(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 ai(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 oi=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 si(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=ii(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 pr((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),si=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=ui(this._lastVideoAdaptation);return"number"!=typeof t?this._manifest.getMaximumSafePosition():t}if(null===this._lastVideoAdaptation){var n=ui(this._lastAudioAdaptation);return"number"!=typeof n?this._manifest.getMaximumSafePosition():n}var r=ui(this._lastAudioAdaptation),i=ui(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=li(this._lastVideoAdaptation))&&void 0!==e?e:void 0;if(null===this._lastVideoAdaptation)return null!==(t=li(this._lastAudioAdaptation))&&void 0!==t?t:void 0;var n=li(this._lastAudioAdaptation),r=li(this._lastVideoAdaptation);return"number"!=typeof n||"number"!=typeof r?void 0:Math.min(n,r)}},e}();function ui(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 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.getEnd();if(void 0===a)return;null!==a&&(r=h(r)?a:Math.min(r,a))}return r}function di(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 ci(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"),di(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 fi(e,t){return xt(t,(function(n){var r=function(e,t){if(null==nn)throw new ve("MEDIA_SOURCE_NOT_SUPPORTED","No MediaSource Object was found in the current browser.");var n=p(e.src)?e.src:null;ci(e,null,n),ne.info("Init: Creating MediaSource");var r=new nn,i=URL.createObjectURL(r);return ne.info("Init: Attaching MediaSource URL to the media element",i),e.src=i,t.register((function(){ci(e,r,i)})),r}(e,t);x(r,(function(){ne.info("Init: MediaSource opened"),n(r)}),t)}))}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 pi(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 pi(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 pi(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 hi,mi=D,gi=x,yi=P;function _i(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=vi(r);!(a=o()).done;){var s=a.value;yi(s,(function(){i.cancel(),_i(e,t)}),i.signal)}mi(n,(function(){i.cancel(),_i(e,t)}),i.signal)}else ne.debug("Init: MediaSource not open, cancel endOfStream")}function bi(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 Si(){return X}function Ei(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&&(!Si()||t.duration>0)?(a.setValue(!0),void i.cancel()):void 0}}),{includeLastObservation:!0,clearSignal:i.signal}),a}function Ti(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>=rn&&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(),Si()&&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 ki(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===hi.WaitingForAttachment){var t=new E(!1);t.onUpdate((function(t,n){t&&(n(),e===hi.WaitingForAttachment&&u.attach())}),{clearSignal:a.signal}),o.setValue({initializationState:{type:"awaiting-media-link",value:{isMediaLinked:t}},drmSystemId:u.systemId})}else e===hi.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"}(hi||(hi={}));var wi=31536e3,Ai=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||Ri(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 Ii(e,t,n){var r=t;n||(r=te?1/0:xi(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=xi(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 Ri(e,t,n,r){if("success"!==Ii(e,t,n))var i=setTimeout((function(){a(),Ri(e,t,n,r)}),2e3),a=r.register((function(){clearTimeout(i)}))}function xi(e){return Math.max(Math.pow(2,32),e+wi)}var Mi=Z;function Ci(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 Pi(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 Pi(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 Pi(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 Di=1/60,Ni=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 Ui(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&&Mi&&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)-Di)if(null===c){var f=t.getPeriodAfter(a);null!==f?o=f.start+Di:ne.warn("Init: discontinuity at Period's end but no next Period")}else n<c+Di&&(o=c+Di);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",Li(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+Di;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",Li(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",Li(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(Oi(t)?e[a]=t:e.splice(a,1))}else if(e[a].period.start>r.start)return void(Oi(t)&&e.splice(a,0,t));Oi(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=Ci(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 Oi(e){return null!==e.discontinuity}function Li(e,t){return new ve("DISCONTINUITY_ENCOUNTERED","A discontinuity has been encountered at position "+String(e)+", seeked at position "+String(t))}var Ui=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 Bi=function(e,t){return e.id===t.id&&e.start===t.start&&e.end===t.end};var Fi=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(Bi(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 zi(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 Vi(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 Vi(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 Vi(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 Ki=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(Fi(t,e._manifest))}),this._canceller.signal),this._scheduledEventsRef.setValue(Fi([],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=Gi(d)?d.end:void 0;this._eventsBeingPlayed.has(d)?(c>o||void 0!==f&&o>=f)&&(Gi(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}),Gi(d)&&u.push(d.publicEvent)))}if(s.length>0)for(var v,p=zi(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=zi(u);!(m=g()).done;){var y=m.value;if("function"==typeof y.onExit&&y.onExit(),r.isCancelled())return}},t}(we);function Gi(e){return void 0!==e.end}var Wi=Ki;function ji(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 Hi(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 qi(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 qi(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 qi(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 Yi=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 On(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(),ji(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=ki(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),fi(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),fi(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=bi(b,f,h),ne.debug("Init: Initial time calculated:",S),E=Yt(u),T=l({textTrackOptions:m,drmSystemId:i},c),k=new qn(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 cr(l,d);n.register((function(){_.disposeAll()}));var b=Ti(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 Wi(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(){Ei(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;ni({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=Hi(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 Ai(t);i.register((function(){o.stopUpdating()}));var s=null,u=new oi(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),gi(e,(function(){ne.debug("Init: MediaSource re-opened while end-of-stream is active"),n.cancel(),(n=new Ge).linkToSignal(t),_i(e,n.signal)}),t),_i(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 Ni(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}(ri);function Qi(){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 Xi(e,t){return 65536*e[t+0]+256*e[t+1]+e[t+2]}function Zi(e,t){return 16777216*e[t+0]+65536*e[t+1]+256*e[t+2]+e[t+3]}function Ji(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 ea(e){return new Uint8Array([e>>>8&255,255&e])}function ta(e){return new Uint8Array([e>>>24&255,e>>>16&255,e>>>8&255,255&e])}function na(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 ra(e){return new Uint8Array([255&e,e>>>8&255,e>>>16&255,e>>>24&255])}function ia(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 aa(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 aa(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 aa(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 oa(e,t){for(var n,r=e,i=ia(t);!(n=i()).done;){var a=sa(r,n.value);if(null===a)return null;r=a}return r}function sa(e,t){var n=ua(e,t);return null!==n?e.subarray(n[1],n[2]):null}function ua(e,t){for(var n,r,i=e.length,a=0,o=0;a+8<=i;){if(o=Zi(e,r=a),n=Zi(e,r+=4),r+=4,0===o)o=i-a;else if(1===o){if(r+8>i)return null;o=Ji(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 la(e,t,n,r,i){for(var a,o=e.length,s=0;s<o;s+=a){var u=s;a=Zi(e,u);var l=Zi(e,u+=4);if(u+=4,0===a)a=o-s;else if(1===a){if(u+8>o)return;a=Ji(e,u),u+=8}if(1970628964===l&&u+16<=o&&Zi(e,u)===t&&Zi(e,u+4)===n&&Zi(e,u+8)===r&&Zi(e,u+12)===i)return u+=16,e.subarray(u,s+a)}}function da(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=Zi(e,n),i=Zi(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=Ji(e,n),n+=8}if(r<0)throw new Error("ISOBMFF: Size out of range");return 1970628964===i&&(n+=16),[0,n,r]}function ca(e){var t=sa(e,1836019558);return null===t?null:sa(t,1953653094)}function fa(e){var t=function(e,t){for(var n=[],r=e;;){var i=ua(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=sa(t,1953653094);return null!==n&&e.push(n),e}),[])}function va(e){return sa(e,1835295092)}function pa(e,t){return void 0===t&&(t=0),sa(e.subarray(t),1701671783)}var ha=/^(?:[a-z]+:)?\/\//i,ma=/\/\.{1,2}\//;function ga(){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&&(ha.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(!ma.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 ya(e){var t=e.lastIndexOf("/");if(t<0)return e.length;if(ha.test(e)){var n=e.indexOf("/");if(n>=0&&t===n+1)return e.length}var r=e.indexOf("?");return r>=0&&r<t?ya(e.substring(0,r)):t+1}var _a="object"==typeof w&&"function"==typeof w.TextDecoder,ba="object"==typeof w&&"function"==typeof w.TextEncoder;function Sa(e){if(_a)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 Ea(e){if(ba)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 Ta(e,t){var n=e.toString(16);return n.length>=t?n:new Array(t-n.length+1).join("0")+n}function ka(e){if(_a)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"+Ta(s,4):"%"+Ta(s,2)}}return decodeURIComponent(r)}function wa(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 Aa(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 Ia(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 Ra(e,t){for(var n=t;n<e.length;){if(0===e[n])break;n+=1}return{end:n+1,string:ka(e.subarray(t,n))}}var xa=Math.pow(2,32)-1,Ma={};function Ca(e){if(null!=Ma[e])return Ma[e];var t=Ea(e);return Ma[e]=t,t}function Pa(e,t){var n=t.length+8;return n<=xa?Qi(ta(n),Ca(e),t):Qi(ta(1),Ca(e),na(n+8),t)}function Da(e,t){return Pa(e,Qi.apply(void 0,t))}function Na(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,Na(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,Na(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,Na(e),i.push(r)}else i.push(n)}))}))}))}))}var Oa=["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","+","/"],La=[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 Ua(e){if(e>=La.length)throw new Error("Unable to parse base64 string.");var t=La[e];if(255===t)throw new Error("Unable to parse base64 string.");return t}function Ba(e){var t,n="",r=e.length;for(t=2;t<r;t+=3)n+=Oa[e[t-2]>>2],n+=Oa[(3&e[t-2])<<4|e[t-1]>>4],n+=Oa[(15&e[t-1])<<2|e[t]>>6],n+=Oa[63&e[t]];return t===r+1&&(n+=Oa[e[t-2]>>2],n+=Oa[(3&e[t-2])<<4],n+="=="),t===r&&(n+=Oa[e[t-2]>>2],n+=Oa[(3&e[t-2])<<4|e[t-1]>>4],n+=Oa[(15&e[t-1])<<2],n+="="),n}function Fa(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=Ua(n.charCodeAt(u))<<18|Ua(n.charCodeAt(u+1))<<12|Ua(n.charCodeAt(u+2))<<6|Ua(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 za(e){return[{systemId:"edef8ba9-79d6-4ace-a3c8-27dcd51d21ed",privateData:Qi([8,1,18,16],e)}]}function Va(e,t){if(void 0===t&&(t=za),null===e.firstElementChild||"ProtectionHeader"!==e.firstElementChild.nodeName)throw new Error("Protection should have ProtectionHeader child");var n=e.firstElementChild,r=Fa(null===n.textContent?"":n.textContent),i=wa(function(e){var t,n,r=((t=e)[0+(n=8)]<<0)+(t[n+1]<<8),i=Sa(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 Aa(Ia(Fa(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 Ka(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 Ga(e,t,n){var r=e.start,i=e.duration;return i<=0?r:r+(Ka(e,t,n)+1)*i}function Wa(e,t){var n;return e*t.timescale+(null!==(n=t.indexTimeOffset)&&void 0!==n?n:0)}function ja(e,t){var n;return(e-(null!==(n=t.indexTimeOffset)&&void 0!==n?n:0))/t.timescale}function Ha(e,t,n){var r=e.timeline,i=Wa(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>=Ga(o,s,n)&&i<u?ja(u,e):null}function qa(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 Ya(e,t){return e.replace(/\{start time\}/g,String(t))}function Qa(e,t,n){var r=t-e;return r>0?Math.floor(r/n):0}function $a(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 Xa=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=Ga(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=$a(p,a[v+1]),y=Qa(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:Ya(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 Ga(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(),Ha(this._sharedSmoothTimeline,e,void 0)},t.isSegmentStillAvailable=function(e){if(e.isInit)return!0;this._refreshTimeline();var t=this._sharedSmoothTimeline;return qa(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 Za(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 Ja(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(Ga(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 eo(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>=Ga(i,null)&&(i.duration===a.duration?i.repeatCount++:e.push({duration:a.duration,start:a.time,repeatCount:0}),!0))}var to=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=Ga(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;Za(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=Ga(o,null);if(!(Ga(a,null)<=s))for(var u=0;u<t.length;u++){var l=t[u],d=Ga(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){Ja(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++)eo(this.timeline,this.timescale,e[r],t.privateInfos.smoothMediaSegment)}else ne.warn("Smooth Parser: should only encounter SmoothRepresentationIndex")},e}();function no(e,t,n){for(var r=e.firstElementChild,i=n;null!==r;)i=t(i,r.nodeName,r),r=r.nextElementSibling;return i}var ro={audio:"audio/mp4",video:"video/mp4",text:"application/ttml+xml"},io={AACL:"audio/mp4",AVC1:"video/mp4",H264:"video/mp4",TTML:"application/ttml+xml+mp4",DFXP:"application/ttml+xml+mp4"};var ao=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=no(e,(function(e,t,n){return"CustomAttributes"===t&&e.push.apply(e,no(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===io[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?io[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===io[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?io[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?io[T]:T,codecPrivateData:null!=E?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(fn,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=no(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 to({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:ro[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 Xa({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 Pa("pssh",Qi([0,0,0,0],wa(e),ta(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=ya(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=no(l,(function(t,n,r){switch(n){case"Protection":t.protections.push(Va(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 Na(q),q}},oo=ao;var so=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 Tn(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 Tn(s,c.status,"ERROR_EVENT"))},c.ontimeout=function(){y(),r(new Tn(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 Tn(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 Tn(s,c.status,"ERROR_HTTP_CODE"))},c.send())}))};function uo(e,t){for(var n=e.length,r=0;r+8<=n;){var i=Zi(e,r);if(0===i)i=n-r;else if(1===i){if(r+16>n)return-1;i=Ji(e,r+8)}if(isNaN(i)||i<=0)return-1;if(Zi(e,r+4)===t)return r+i<=n?r:-1;r+=i}return-1}function lo(e,t){if(t){if(uo(e,1718909296)<0)throw new he("INTEGRITY_ERROR","Incomplete `ftyp` box");if(uo(e,1836019574)<0)throw new he("INTEGRITY_ERROR","Incomplete `moov` box")}else{if(uo(e,1836019558)<0)throw new he("INTEGRITY_ERROR","Incomplete `moof` box");if(uo(e,1835295092)<0)throw new he("INTEGRITY_ERROR","Incomplete `mdat` box")}}function co(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 so({url:t,responseType:"arraybuffer",timeout:n.timeout,cancelSignal:r});case"text":return so({url:t,responseType:"text",timeout:n.timeout,cancelSignal:r});case"document":return so({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 wn(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 fo(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 vo(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 vo(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 vo(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 po(e,t){var n=ua(e,1936286840);if(null===n)return null;var r,i=t,a=n[2]-n[0],o=n[1],s=e[o],u=Zi(e,o+=8);if(o+=4,0===s)r=Zi(e,o),i+=Zi(e,o+=4)+a,o+=4;else{if(1!==s)return null;r=Ji(e,o),i+=Ji(e,o+=8)+a,o+=8}var l=[],d=$i(e,o+=2);for(o+=2;--d>=0;){var c=Zi(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=Zi(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 ho(e){var t=sa(e,1952868452);if(null!==t){var n=1,r=Xi(t,n);if(n+=3,(8&r)>0)return n+=4,(1&r)>0&&(n+=8),(2&r)>0&&(n+=4),Zi(t,n)}}function mo(e){var t=fa(e);if(0!==t.length){for(var n,r=0,i=fo(t);!(n=i()).done;){var a=n.value,o=sa(a,1953658222);if(null===o)return;var s=0;if(o[s]>1)return;var u=Xi(o,s+=1);s+=3;var l=(256&u)>0,d=0;if(!l&&void 0===(d=ho(a)))return;var c=(1&u)>0,f=(4&u)>0,v=(512&u)>0,p=(1024&u)>0,h=(2048&u)>0,m=Zi(o,s);s+=4,c&&(s+=4),f&&(s+=4);for(var g=m,y=0;g-- >0;)l?(y+=Zi(o,s),s+=4):y+=d,v&&(s+=4),p&&(s+=4),h&&(s+=4);r+=y}return r}}function go(e){var t=function(e){var t=sa(e,1836019574);if(null===t)return null;var n=sa(t,1953653099);return null===n?null:sa(n,1835297121)}(e);if(null!==t){var n=sa(t,1835296868);if(null!==n){var r=0,i=n[r];return r+=4,1===i?Zi(n,r+16):0===i?Zi(n,r+8):void 0}}}function yo(e){var t=e.length;if(t<4)throw new Error("Cannot update box length: box too short");var n=Zi(e,0);if(0===n){if(t>xa){var r=new Uint8Array(t+8);return r.set(ta(1),0),r.set(e.subarray(4,8),4),r.set(na(t+8),8),r.set(e.subarray(8,t),16),r}return e.set(ta(t),0),e}if(1===n){if(t<16)throw new Error("Cannot update box length: box too short");return e.set(na(t),8),e}if(t<=xa)return e.set(ta(t),0),e;var i=new Uint8Array(t+8);return i.set(ta(1),0),i.set(e.subarray(4,8),4),i.set(na(t+8),8),i.set(e.subarray(8,t),16),i}function _o(e,t,n,r,i){var a,o,s,u=[];if(i){var l=ca(e);null!==l?(s=function(e){var t=la(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=Ji(t,16*a+5),o=Ji(t,16*a+5+8)):(s=Zi(t,8*a+5),o=Zi(t,8*a+5+4)),n.push({time:s,duration:o})}return n}(l),o=function(e){var t=la(e,1830656773,1121273062,2162299933,2952222642);if(void 0!==t)return{duration:Ji(t,12),time:Ji(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=mo(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 bo(e){return"string"==typeof e&&e.indexOf("mp4")>=0}function So(e,t){return Pa("schm",Qi(4,Ea(e),ta(t)))}function Eo(e){return Pa("frma",Ea(e))}function To(e){var t=[7,[e.length]];return Pa("stsd",Qi.apply(void 0,t.concat(e)))}function ko(e,t,n){return Pa("tenc",Qi(6,[e,t],n))}function wo(e,t,n,r,i){var a=[e,t,n];return void 0!==i&&a.push(Pa("senc",i),function(e){if(0===e.length)return Pa("saiz",new Uint8Array(0));var t=Zi(e,0),n=Zi(e,4),r=new Uint8Array(n+9);r.set(ta(n),5);for(var i,a,o=9,s=8;s<e.length;)s+=8,2==(2&t)?(a=2,s+=6*(i=$i(e,s))+2):(i=0,a=0),r[o]=6*i+8+a,o++;return Pa("saiz",r)}(i),function(e,t,n,r){return Pa("saio",Qi(4,[0,0,0,1],ta(e.length+t.length+n.length+r.length+8+8+8+8)))}(r,e,t,n)),Da("traf",a)}function Ao(e,t){var n=ua(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=ua(e,t);return null!==n?e.subarray(n[0],n[2]):null}(r,1835427940),a=sa(r,1953653094);if(null===a||null===i)throw new Error("Smooth: Invalid ISOBMFF given");var o=ua(a,1952868452),s=ua(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 Pa("tfdt",Qi([1,0,0,0],na(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),yo(r)}(l,s[1]-s[0]),f=wo(u,d,c,i,la(a,2721664850,1520127764,2722393154,2086964724)),v=Da("moof",[i,f]),p=ua(v,1836019558),h=ua(f,1953653094),m=ua(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=ua(e,1835295092);if(null===b)throw new Error("Smooth: Invalid ISOBMFF given");if(!q&&(0===_||_<=-8)){var S=b[1];return v.set(ta(S),g),e.set(v,n[0]),_<=-8&&e.set(Pa("free",new Uint8Array(-_-8)),v.length),e}var E=b[1]+_;v.set(ta(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 Io(e){var t=e[0],n=e[1];return n===1/0?"bytes="+t+"-":"bytes="+t+"-"+n}function Ro(e,t,n,r,i,a){var o,s,u=Da("stbl",[n,Pa("stts",new Uint8Array(8)),Pa("stsc",new Uint8Array(8)),Pa("stsz",new Uint8Array(12)),Pa("stco",new Uint8Array(8))]),l=function(e){return Pa("dref",Qi(7,[1],e))}(Pa("url ",new Uint8Array([0,0,0,1]))),d=Da("dinf",[l]),c=Da("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 Pa("hdlr",Qi(8,Ea(t),12,Ea(n),1))}(t),v=function(e){return Pa("mdhd",Qi(12,ta(e),8))}(e),p=Da("mdia",[v,f,c]),h=function(e,t,n){return Pa("tkhd",Qi(ta(7),8,ta(n),20,[1,0,0,0],[0,1,0,0],12,[0,1,0,0],12,[64,0,0,0],ea(e),2,ea(t),2))}(i,a,1),m=Da("trak",[h,p]),g=Da("mvex",[Pa("trex",Qi(4,ta(1),[0,0,0,1],12))]),y=function(e,t){return Pa("mvhd",Qi(12,ta(e),4,[0,1],2,[1,0],10,[0,1],14,[0,1],14,[64,0,0,0],26,ea(t+1)))}(e,1),_=function(e,t,n){return Da("moov",[e,t,n])}(y,g,m),b=(o="isom",s=["isom","iso2","iso6","avc1","dash"],Pa("ftyp",Qi.apply(void 0,[Ea(o),[0,0,0,1]].concat(s.map(Ea)))));return Qi(b,_)}function xo(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 Pa("avcC",Qi([1,e[1],e[2],e[3],252|r,225],ea(e.length),e,[1],ea(t.length),t))}(wa(l),wa(d),a);if(void 0===s){var p=function(e,t,n,r,i,a,o){return Pa("avc1",Qi(6,ea(1),16,ea(e),ea(t),ea(n),2,ea(r),6,[0,1,i.length],Ea(i),31-i.length,ea(a),[255,255],o))}(t,n,r,i,"AVC Coding",24,v);c=To([p])}else{var h=Da("schi",[ko(1,8,s)]),m=So("cenc",65536),g=function(e,t,n,r,i,a,o,s){return Pa("encv",Qi(6,ea(1),16,ea(e),ea(t),ea(n),2,ea(r),6,[0,1,i.length],Ea(i),31-i.length,ea(a),[255,255],o,s))}(t,n,r,i,"AVC Coding",24,v,Da("sinf",[Eo("avc1"),m,h]));c=To([g])}return Ro(e,"video",c,((f=new Uint8Array(12))[3]=1,Pa("vmhd",f)),t,n)}var Mo=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];function Co(e,t,n,r,i,a,o){var s,u,l=function(e,t){return Pa("esds",Qi(4,[3,25],ea(e),[0,4,17,64,21],11,[5,2],wa(t),[6,1,2]))}(1,0===a.length?(s=i,u=t,Aa(ea((((63&2)<<4|31&Mo.indexOf(s))<<4|31&u)<<3))):a),d=function(){if(void 0===o){var e=function(e,t,n,r,i,a){return Pa("mp4a",Qi(6,ea(e),8,ea(t),ea(n),2,ea(r),ea(i),2,a))}(1,t,n,r,i,l);return To([e])}var a=Da("schi",[ko(1,8,o)]),s=So("cenc",65536),u=Da("sinf",[Eo("mp4a"),s,a]),d=function(e,t,n,r,i,a,o){return Pa("enca",Qi(6,ea(e),8,ea(t),ea(n),2,ea(r),ea(i),2,a,o))}(1,t,n,r,i,l,u);return To([d])}();return Ro(e,"audio",d,Pa("smhd",new Uint8Array(8)),0,0)}function Po(e,t,n,r,i,a){var o,s=t.segment.range;return Array.isArray(s)&&(o={Range:Io(s)}),so({url:e,responseType:"arraybuffer",headers:o,timeout:r.timeout,cancelSignal:i,onProgress:n.onProgress}).then((function(e){if(!bo(t.mimeType)||!0!==a)return{resultType:"segment-loaded",resultData:e};var n=new Uint8Array(e.responseData);return lo(n,t.segment.isInit),{resultType:"segment-loaded",resultData:Object.assign(Object.assign({},e),{responseData:n})}}))}var Do=function(e){var t=e.checkMediaSegmentIntegrity,n=e.segmentLoader;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=xo(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=Co(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?Po(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 wn(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),bo(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);lo(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),Po(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 No(e,t){return null===e?null:null===t.url?e.baseUrl:ga(e.baseUrl,t.url)}var Oo=function(e){var t=oo(e),n=Do(e),r={loadManifest:co({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 En(l,{representationFilter:e.representationFilter},d),url:a,warnings:d}}},i={loadSegment:function(e,t,r,i,a){var o=No(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?_o(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=Ao(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=No(t,o);return o.isInit||null===s?Promise.resolve({resultType:"segment-created",resultData:null}):bo(n.mimeType)?so({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 lo(r,n.segment.isInit),{resultType:"segment-loaded",resultData:Object.assign(Object.assign({},t),{responseData:r})}})):so({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=bo(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?Ea(v):v instanceof Uint8Array?v:new Uint8Array(v)).length;var S=void 0!==n?_o(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=va(b);g=null===T?"":ka(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=ka(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 Lo(e){e.transports.smooth=Oo,e.mediaSourceInit=Yi}function Uo(e){var t=Date.parse(e)-at();if(!isNaN(t))return t;ne.warn("DASH Parser: Invalid clock received: ",e)}function Bo(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 Fo(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 zo(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=Fo(r);if(void 0===s)return;a=s}if(void 0!==i){var u=Fo(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=Bo(r);if(void 0===s)return{safe:void 0,unsafe:void 0};a=s}if(void 0!==i){var u=Bo(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 Vo(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 Ko=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 Go(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 Wo(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 Wo(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 Wo(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 jo=function(e,t){for(var n,r=Go(t);!(n=r()).done;)for(var i,a=n.value,o=a.adaptation,s=Go(a.trickModeAttachedAdaptationIds);!(i=s()).done;)for(var u,l=i.value,d=Go(fn);!(u=d()).done;){var c=e[u.value];if(void 0!==c)for(var f,v=Go(c);!(f=v()).done;){var p=f.value;p.id===l&&(void 0===p.trickModeTracks&&(p.trickModeTracks=[]),p.trickModeTracks.push(o))}}},Ho=["subtitle","caption"];function qo(e,t,n,r){function i(e,t){var n=e.split("/")[0];return Se(fn,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(Ho,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 Yo(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 Qo(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 $o(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,Qo(void 0===n?0:n))}(e,t,n)}function Xo(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 Qo(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 Qo(e)(t,n,r)}))}}function Zo(e,t,n,r,i){for(var a,o,s=Wa(t,e),u=Wa(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=Ka(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:Xo(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 Jo(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 es=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:$o(e.initialization.media,s,u),v=void 0===e.media?null:$o(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=Wa(a,this._index),this._scaledPeriodEnd=null==o?void 0:Wa(o,this._index),this._isInitialized=this._index.timeline.length>0,this._isEMSGWhitelisted=l}var t=e.prototype;return t.getInitSegment=function(){return Yo(this._index,this._isEMSGWhitelisted)},t.getSegments=function(e,t){return Zo(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:ja(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 ja(Math.min(Ga(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++)Jo(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}(),ts=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:$o(e.initialization.media,o,s),v=e.list.map((function(e){return{url:void 0===e.media?null:$o(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=Yo(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 ns(e){return v.getCurrent().DEFAULT_MAXIMUM_TIME_ROUNDING_ERROR*e}function rs(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 is(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 as(e){for(var t=[],n=0;n<e.length;n++)t.push(is(e[n]));for(var r=[],i=0;i<t.length;i++){var a=rs(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 os(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.'),as(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'),as(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.'),as(e);var c=l[l.length-1],f=is(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.'),as(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(is(e[m]));for(var g=0;g<h.length;g++){var y=rs(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 ss=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:$o(t.initialization.media,d,c),y=void 0===t.media?null:$o(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:us(t.timeline,t.startNumber,t.endNumber),timescale:h},this._scaledPeriodStart=Wa(f,this._index),this._scaledPeriodEnd=void 0===v?void 0:Wa(v,this._index)}var t=e.prototype;return t.getInitSegment=function(){return Yo(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 Zo({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:ja(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:ja(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=ns(r.timescale),o=Wa(t,this._index);if(i.length>0&&Ga(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:Wa(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 qa(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),Ha({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()),Ja(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&&Ga(e[e.length-1],null,this._scaledPeriodEnd)+ns(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=Wa(e,this._index),n=Za(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(Ga(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?us(as(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,us(os(e,t),this._index.startNumber,this._index.endNumber))},e}();function us(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 ls=ss,ds=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:$o(e.initialization.media,l,d),m=void 0===e.media?null:$o(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 Yo(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:Xo(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=ns(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+ns(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 cs(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=ga(o.url,u.url);i.push({url:l,serviceLocation:null!==(n=u.serviceLocation)&&void 0!==n?n:o.serviceLocation})}return i}function fs(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 vs(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 vs(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 vs(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 ps(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 hs(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 es(m,h)}else if(void 0!==e.children.segmentList){var g=e.children.segmentList;i=new ts(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=ls.isTimelineIndexArgument(b)?new ls(b,h):new ds(b,h)}else{var S=t.adaptation.children;if(void 0!==S.segmentBase){var E=S.segmentBase;i=new es(E,h)}else if(void 0!==S.segmentList){var T=S.segmentList;i=new ts(T,h)}else i=new ds({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=cs(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=fs(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=ps({adaptationProfiles:t.attributes.profiles,supplementalProperties:t.children.supplementalProperties,essentialProperties:t.children.essentialProperties,manifestProfiles:n.manifestProfiles,codecs:g}),u.push(_)},c=fs(e);!(s=c()).done;)d();return u}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 gs(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 gs(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 gs(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 ys(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 _s(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 bs(e){return void 0!==e&&("urn:mpeg:dash:role:2011"===e.schemeIdUri&&"sign"===e.value)}function Ss(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 Es(e){if(null!=e.children.supplementalProperties)for(var t,n=ms(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 Ts(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 ks(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 ws(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 ws(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 ws(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 As=Ae();function Is(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 Ko({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=cs(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-"+As()):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=qo(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=Es(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:cs(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&&_s(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(ys));var z=void 0;"video"!==A?z=!1:void 0!==O&&(z=O.some(bs));for(var V=Ss(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:hs(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=ms(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=fn.reduce((function(e,t){var n=u[t];return n.length>0&&(n.sort(Ts),e[t]=n.map((function(e){return e[0]}))),e}),{});return u.video.sort(Ts),jo(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=ks(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=ks(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=ka(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=ks(Vo(Kt(e).filter((function(e){return null!=e})),(function(e){return e})));!(t=i()).done;)for(var a,o=ks(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=Rs(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=Rs(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 Rs(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 xs(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 Ms(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 Ms(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 Ms(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 Cs=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?Uo(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=Uo(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,ya(t.url))}]:[],h=cs(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=Is(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=zo(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,_=xs(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 Ps(e){var t=e.textContent,n=[];return null===t||0===t.length?[void 0,n]:[{value:t},n]}function Ds(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 Ns=/^P(([\d.]*)Y)?(([\d.]*)M)?(([\d.]*)D)?T?(([\d.]*)H)?(([\d.]*)M)?(([\d.]*)S)?/,Os=/([0-9]+)-([0-9]+)/;function Ls(e,t){return"true"===e?[!0,null]:"false"===e?[!1,null]:[!1,new qs("`"+t+'` property is not a boolean value but "'+e+'"')]}function Us(e,t){var n=parseInt(e,10);return isNaN(n)?[null,new qs("`"+t+'` property is not an integer value but "'+e+'"')]:[n,null]}function Bs(e,t){if("INF"===e)return[1/0,null];var n=parseFloat(e);return isNaN(n)?[null,new qs("`"+t+'` property is invalid: "'+e+'"')]:[n,null]}function Fs(e,t){if("true"===e)return[!0,null];if("false"===e)return[!1,null];var n=parseInt(e,10);return isNaN(n)?[null,new qs("`"+t+'` property is not a boolean nor an integer but "'+e+'"')]:[n,null]}function zs(e,t){var n=Date.parse(e);return isNaN(n)?[null,new qs("`"+t+'` is in an invalid date format: "'+e+'"')]:[new Date(Date.parse(e)).getTime()/1e3,null]}function Vs(e,t){if(!p(e))return[0,new qs("`"+t+"` property is empty")];var n=Ns.exec(e);return null===n?[null,new qs("`"+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 Ks(e,t){var n=Os.exec(e);return null===n?[null,new qs("`"+t+'` property has an unrecognized format "'+e+'"')]:[[+n[1],+n[2]],null]}function Gs(e,t){try{return[Fa(e),null]}catch(n){return[null,new qs("`"+t+'` is not a valid base64 string: "'+e+'"')]}}function Ws(e,t){var n=/^(\d+)\/(\d+)$/.exec(e);return null!==n?[+n[1]/+n[2],null]:Bs(e,t)}function js(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 Hs(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 qs=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 Ys(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=Gs(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=wa(r.value.replace(/-/g,""))}}return t}(e)},r]}function Qs(e){for(var t={},n=[],r=Hs(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:Ks,dashName:"range"});break;case"sourceURL":t.media=a.value}}return[t,n]}function $s(e){for(var t={},n=[],r=Hs(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=Qs(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:Us,dashName:"timescale"});break;case"presentationTimeOffset":r(c.value,{asKey:"presentationTimeOffset",parser:Bs,dashName:"presentationTimeOffset"});break;case"indexRange":r(c.value,{asKey:"indexRange",parser:Ks,dashName:"indexRange"});break;case"indexRangeExact":r(c.value,{asKey:"indexRangeExact",parser:Ls,dashName:"indexRangeExact"});break;case"availabilityTimeOffset":r(c.value,{asKey:"availabilityTimeOffset",parser:Bs,dashName:"availabilityTimeOffset"});break;case"availabilityTimeComplete":r(c.value,{asKey:"availabilityTimeComplete",parser:Ls,dashName:"availabilityTimeComplete"});break;case"duration":r(c.value,{asKey:"duration",parser:Us,dashName:"duration"});break;case"startNumber":r(c.value,{asKey:"startNumber",parser:Us,dashName:"startNumber"});break;case"endNumber":r(c.value,{asKey:"endNumber",parser:Us,dashName:"endNumber"})}}return[t,n]}function Xs(e){for(var t={},n=[],r=Hs(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:Ks,dashName:"indexRange"});break;case"index":t.index=a.value;break;case"mediaRange":r(a.value,{asKey:"mediaRange",parser:Ks,dashName:"mediaRange"})}}return[t,n]}function Zs(e){for(var t=$s(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=Xs(s),d=u[0],c=u[1];i.push(d),r=r.concat(c)}}return[l(n,{list:i}),r]}function Js(e){var t=null;return function(){if(null===t){var n=e.getElementsByTagName("S");return t=n,n}return t}}function eu(e){for(var t,n=$s(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=Js(o))}for(var s=l({},r,{duration:r.duration,timelineParser:t}),u=Hs(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:Bs,dashName:"availabilityTimeOffset"});break;case"availabilityTimeComplete":u(c.value,{asKey:"availabilityTimeComplete",parser:Ls,dashName:"availabilityTimeComplete"});break;case"media":s.media=c.value;break;case"bitstreamSwitching":u(c.value,{asKey:"bitstreamSwitching",parser:Ls,dashName:"bitstreamSwitching"})}}return[s,i]}function tu(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=Ps(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(js(a));break;case"SegmentBase":var l=$s(a),d=l[0],c=l[1];t.segmentBase=d,c.length>0&&(r=r.concat(c));break;case"SegmentList":var f=Zs(a),v=f[0],p=f[1];r=r.concat(p),t.segmentList=v;break;case"SegmentTemplate":var h=eu(a),m=h[0],g=h[1];r=r.concat(g),t.segmentTemplate=m;break;case"ContentProtection":var y=Ys(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=[js(a)]:t.supplementalProperties.push(js(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=Hs(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:Us,dashName:"bandwidth"});break;case"codecs":t.codecs=a.value;break;case"codingDependency":r(a.value,{asKey:"codingDependency",parser:Ls,dashName:"codingDependency"});break;case"frameRate":r(a.value,{asKey:"frameRate",parser:Ws,dashName:"frameRate"});break;case"height":r(a.value,{asKey:"height",parser:Us,dashName:"height"});break;case"id":t.id=a.value;break;case"maxPlayoutRate":r(a.value,{asKey:"maxPlayoutRate",parser:Bs,dashName:"maxPlayoutRate"});break;case"maximumSAPPeriod":r(a.value,{asKey:"maximumSAPPeriod",parser:Bs,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:Us,dashName:"qualityRanking"});break;case"segmentProfiles":t.segmentProfiles=a.value;break;case"width":r(a.value,{asKey:"width",parser:Us,dashName:"width"});break;case"availabilityTimeOffset":r(a.value,{asKey:"availabilityTimeOffset",parser:Bs,dashName:"availabilityTimeOffset"});break;case"availabilityTimeComplete":r(a.value,{asKey:"availabilityTimeComplete",parser:Ls,dashName:"availabilityTimeComplete"})}}return void 0===t.bitrate&&n.push(new qs("No bitrate found on a Representation")),[t,n]}(e),a=i[0],o=i[1];return[{children:n,attributes:a},r.concat(o)]}function nu(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=[js(a)]:t.accessibilities.push(js(a));break;case"BaseURL":var o=Ps(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=Ds(a);break;case"EssentialProperty":null==t.essentialProperties?t.essentialProperties=[js(a)]:t.essentialProperties.push(js(a));break;case"InbandEventStream":void 0===t.inbandEventStreams&&(t.inbandEventStreams=[]),t.inbandEventStreams.push(js(a));break;case"Label":var l=a.textContent;null!=l&&(t.label=l);break;case"Representation":var d=tu(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=[js(a)]:t.roles.push(js(a));break;case"SupplementalProperty":null==t.supplementalProperties?t.supplementalProperties=[js(a)]:t.supplementalProperties.push(js(a));break;case"SegmentBase":var v=$s(a),p=v[0],h=v[1];t.segmentBase=p,h.length>0&&(r=r.concat(h));break;case"SegmentList":var m=Zs(a),g=m[0],y=m[1];t.segmentList=g,y.length>0&&(r=r.concat(y));break;case"SegmentTemplate":var _=eu(a),b=_[0],S=_[1];t.segmentTemplate=b,S.length>0&&(r=r.concat(S));break;case"ContentProtection":var E=Ys(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=Hs(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:Us,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:Us,dashName:"minBandwidth"});break;case"maxBandwidth":r(a.value,{asKey:"maxBitrate",parser:Us,dashName:"maxBandwidth"});break;case"minWidth":r(a.value,{asKey:"minWidth",parser:Us,dashName:"minWidth"});break;case"maxWidth":r(a.value,{asKey:"maxWidth",parser:Us,dashName:"maxWidth"});break;case"minHeight":r(a.value,{asKey:"minHeight",parser:Us,dashName:"minHeight"});break;case"maxHeight":r(a.value,{asKey:"maxHeight",parser:Us,dashName:"maxHeight"});break;case"minFrameRate":r(a.value,{asKey:"minFrameRate",parser:Ws,dashName:"minFrameRate"});break;case"maxFrameRate":r(a.value,{asKey:"maxFrameRate",parser:Ws,dashName:"maxFrameRate"});break;case"selectionPriority":r(a.value,{asKey:"selectionPriority",parser:Us,dashName:"selectionPriority"});break;case"segmentAlignment":r(a.value,{asKey:"segmentAlignment",parser:Fs,dashName:"segmentAlignment"});break;case"subsegmentAlignment":r(a.value,{asKey:"subsegmentAlignment",parser:Fs,dashName:"subsegmentAlignment"});break;case"bitstreamSwitching":r(a.value,{asKey:"bitstreamSwitching",parser:Ls,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:Ls,dashName:"codingDependency"});break;case"frameRate":r(a.value,{asKey:"frameRate",parser:Ws,dashName:"frameRate"});break;case"height":r(a.value,{asKey:"height",parser:Us,dashName:"height"});break;case"maxPlayoutRate":r(a.value,{asKey:"maxPlayoutRate",parser:Bs,dashName:"maxPlayoutRate"});break;case"maximumSAPPeriod":r(a.value,{asKey:"maximumSAPPeriod",parser:Bs,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:Us,dashName:"width"});break;case"availabilityTimeOffset":r(a.value,{asKey:"availabilityTimeOffset",parser:Bs,dashName:"availabilityTimeOffset"});break;case"availabilityTimeComplete":r(a.value,{asKey:"availabilityTimeComplete",parser:Ls,dashName:"availabilityTimeComplete"})}}return[t,n]}(e),a=i[0],o=i[1];return[{children:n,attributes:a},r.concat(o)]}function ru(e){for(var t={children:{events:[]},attributes:{}},n=[],r=Hs(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:Us,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=iu(s),l=u[0],d=u[1];t.children.events.push(l),d.length>0&&(n=n.concat(d))}}return[t,n]}function iu(e){for(var t={eventStreamData:e},n=[],r=Hs(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:Us,dashName:"presentationTime"});break;case"duration":r(a.value,{asKey:"duration",parser:Us,dashName:"duration"});break;case"id":t.id=a.value}}return[t,n]}function au(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=Ps(s),l=u[0],d=u[1];void 0!==l&&n.push(l),i=i.concat(d);break;case"AdaptationSet":var c=nu(s),f=c[0],v=c[1];r.push(f),i=i.concat(v);break;case"EventStream":var p=ru(s),h=p[0],m=p[1];a.push(h),i=i.concat(m);break;case"SegmentTemplate":var g=eu(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=Hs(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:Vs,dashName:"start"});break;case"duration":r(a.value,{asKey:"duration",parser:Vs,dashName:"duration"});break;case"bitstreamSwitching":r(a.value,{asKey:"bitstreamSwitching",parser:Ls,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 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=Ps(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=au(s),f=c[0],v=c[1];r.push(f),a=a.concat(v);break;case"UTCTiming":var p=js(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=Hs(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:zs,dashName:"availabilityStartTime"});break;case"availabilityEndTime":r(a.value,{asKey:"availabilityEndTime",parser:zs,dashName:"availabilityEndTime"});break;case"publishTime":r(a.value,{asKey:"publishTime",parser:zs,dashName:"publishTime"});break;case"mediaPresentationDuration":r(a.value,{asKey:"duration",parser:Vs,dashName:"mediaPresentationDuration"});break;case"minimumUpdatePeriod":r(a.value,{asKey:"minimumUpdatePeriod",parser:Vs,dashName:"minimumUpdatePeriod"});break;case"minBufferTime":r(a.value,{asKey:"minBufferTime",parser:Vs,dashName:"minBufferTime"});break;case"timeShiftBufferDepth":r(a.value,{asKey:"timeShiftBufferDepth",parser:Vs,dashName:"timeShiftBufferDepth"});break;case"suggestedPresentationDelay":r(a.value,{asKey:"suggestedPresentationDelay",parser:Vs,dashName:"suggestedPresentationDelay"});break;case"maxSegmentDuration":r(a.value,{asKey:"maxSegmentDuration",parser:Vs,dashName:"maxSegmentDuration"});break;case"maxSubsegmentDuration":r(a.value,{asKey:"maxSubsegmentDuration",parser:Vs,dashName:"maxSubsegmentDuration"})}}return[t,n]}(e),a=i[0],o=i[1];return[{children:n,attributes:a},r.concat(o)]}var su=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=ou(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=au(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()}(Cs(i,t,a))};function uu(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 Ea(e).buffer;if(e instanceof Document)return Ea(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(ka(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 En(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?so({url:e,responseType:"text",timeout:t,cancelSignal:o}):so({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 lu="function"==typeof Headers?Headers:null,du="function"==typeof AbortController?AbortController:null;function cu(){return"function"==typeof w.fetch&&!h(du)&&!h(lu)}function fu(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 vu(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"===fu(n.type,n.mimeType)&&lo(new Uint8Array(e),n.segment.isInit)}}}function pu(e,t){return null===e?null:null===t.url?e.baseUrl:ga(e.baseUrl,t.url)}function hu(e,t,n,r,i){if(void 0===t.range)return so({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 so({url:e,headers:{Range:Io(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 so({url:e,headers:{Range:Io([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=so({url:e,headers:{Range:Io(t.range)},responseType:"arraybuffer",timeout:n.timeout,cancelSignal:r,onProgress:i.onProgress}),o=so({url:e,headers:{Range:Io(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=Qi(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 mu(e,t,n,r,i){var a=t.segment,o=void 0!==a.range?{Range:Io(a.range)}:void 0,s=null;return function(e){var t;if(!h(e.headers))if(h(lu))t=e.headers;else{t=new lu;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(du)?null:new du;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 Tn(t.url,t.status,le.ERROR_HTTP_CODE);if(h(t.body))throw new Tn(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 Tn(e.url,0,le.TIMEOUT);if(t instanceof Tn)throw t;throw ne.warn("Fetch: Request Error",t instanceof Error?t.toString():""),new Tn(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=uo(r,1836019558);if(i<0)return[n,r];var a=t+i+Zi(e,i+t);if(a>e.length)return[n,r];var o=uo(r,1835295092);if(o<0)return[n,r];var s=t+o+Zi(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?Qi(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 gu(e,t,n,r,i,a){if(t.segment.isInit)return hu(e,t.segment,r,a,i);var o=fu(t.type,t.mimeType);if(n&&("mp4"===o||void 0===o)){if(cu())return mu(e,t,r,i,a);$t("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 so({url:e,responseType:"arraybuffer",headers:void 0!==s.range?{Range:Io(s.range)}:void 0,timeout:r.timeout,cancelSignal:a,onProgress:i.onProgress}).then((function(e){return{resultType:"segment-loaded",resultData:e}}))}var yu="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 _u(e,t){if(e[t]>1)ne.warn("ISOBMFF: un-handled PSSH version");else{var n=t+4;if(!(n+16>e.length))return Aa(yu(e,n,n+16))}}var bu=408125543,Su=357149030,Eu=2807729,Tu=17545,ku=475249515,wu=187,Au=179,Iu=183,Ru=241;function xu(e,t,n,r){for(var i=r[0],a=r[1],o=i;o<a;){var s=Du(n,o);if(null==s)return null;var u=s.value,l=o+s.length,d=Nu(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 xu(e,t.slice(v+1,t.length),n,[c,f])}o=f}return null}function Mu(e,t){var n=xu(Eu,[bu,Su],e,[t,e.length]);if(null==n)return null;var r=n[1]-n[0];return 1e9/Ou(e,n[0],r)}function Cu(e,t){var n=xu(Tu,[bu,Su],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 Pu(e,t){for(var n=1;n<=8;n++)if(e[t]>=Math.pow(2,8-n))return n}function Du(e,t){var n=Pu(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 Nu(e,t){var n=Pu(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 Ou(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 Lu(e,t,n,r){var i=function(e){var t=ca(e);if(null!==t){var n=sa(t,1952867444);if(null!==n){var r=n[0];return 1===r?Ji(n,4):0===r?Zi(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=mo(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 Uu(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=ka(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 Bu(e){var t=e.__priv_patchLastSegmentInSidx;return function(e,n,r){var i,a,o=n.segment,s=n.periodStart,u=n.periodEnd,l=e.data,d=e.isChunked,c=[s,u];if(null===l)return o.isInit?{segmentType:"init",initializationData:null,initializationDataSize:0,protectionData:[],initTimescale:void 0}:{segmentType:"media",chunkData:null,chunkSize:0,chunkInfos:null,chunkOffset:0,protectionData:[],appendWindow:c};var f=l instanceof Uint8Array?l:new Uint8Array(l),v=fu(n.type,n.mimeType),p="mp4"===v||void 0===v,m=[];if(p){var g,y=function(e){var t=0,n=sa(e,1836019574);if(null===n)return[];for(var r=[];t<n.length;){var i=void 0;try{i=ua(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=yu(n,i[0],i[2]),s=_u(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}(f);o.isInit&&(g=null!==(i=function(e){var t=oa(e,[1836019574,1953653099,1835297121,1835626086,1937007212,1937011556]);if(null===t)return null;var n=t.subarray(8),r=sa(n,1701733238),i=0;if(null===r?(i=28,r=sa(n,1701733217)):i=78,null===r)return null;var a=oa(r.subarray(i),[1936289382,1935894633,1952804451]);return null===a||a.byteLength<24?null:a.subarray(8,24)}(f))&&void 0!==i?i:void 0),(y.length>0||void 0!==g)&&m.push({initDataType:"cenc",keyId:g,initData:y})}if(!o.isInit){var _=p?Lu(f,d,o,r):null,b=null!==(a=o.timestampOffset)&&void 0!==a?a:0;if(p){var S=function(e){for(var t=[],n=0;n<e.length;){var r=pa(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=Ra(r,o),u=s.end,l=s.string,d=Ra(r,o=u),c=d.end,f=d.string,v=Zi(r,o=c),p=Zi(r,o+=4),h=Zi(r,o+=4),m=Zi(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}(f);if(void 0!==S){var E=Uu(S.filter((function(e){return void 0!==o.privateInfos&&void 0!==o.privateInfos.isEMSGWhitelisted&&o.privateInfos.isEMSGWhitelisted(e)})),n.manifestPublishTime);if(void 0!==E){var T=E.needsManifestRefresh,k=E.inbandEvents;return{segmentType:"media",chunkData:f,chunkSize:f.length,chunkInfos:_,chunkOffset:b,appendWindow:c,inbandEvents:k,protectionData:m,needsManifestRefresh:T}}}}return{segmentType:"media",chunkData:f,chunkSize:f.length,chunkInfos:_,chunkOffset:b,protectionData:m,appendWindow:c}}var w,A=o.indexRange;if("webm"===v)w=function(e,t){var n=xu(bu,[],e,[t,e.length]);if(null==n)return null;var r=n[0],i=n[1],a=Mu(e,r);if(null==a)return null;var o=Cu(e,r);if(null==o)return null;var s=xu(ku,[],e,[r,i]);if(null==s)return null;for(var u=[],l=s[0];l<s[1];){var d=xu(wu,[],e,[l,s[1]]);if(null==d)break;var c=xu(Au,[],e,[d[0],d[1]]);if(null==c)return null;var f=Ou(e,c[0],c[1]-c[0]),v=xu(Ru,[Iu],e,[d[0],d[1]]);if(null==v)return null;var p=Ou(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}(f,0);else if(p&&(w=po(f,Array.isArray(A)?A[0]:0),!0===t&&null!==w&&w.length>0)){var I=w[w.length-1];Array.isArray(I.range)&&(I.range[1]=1/0)}var R=p?go(f):"webm"===v?Mu(f,0):void 0,x=h(R)?void 0:R;return{segmentType:"init",initializationData:f,initializationDataSize:f.length,protectionData:m,initTimescale:x,segmentList:null!=w?w:void 0}}}function Fu(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=va(e);return null===t?"":ka(t)}(t);return{data:d,type:l,language:s,start:i,end:a}}function zu(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 Vu(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=fu(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,o=n.segment,s=o.isInit,u=o.indexRange,l="string"==typeof e?Ea(e):e instanceof Uint8Array?e:new Uint8Array(e);if(s){var d=po(l,Array.isArray(u)?u[0]:0);if(!0===i&&null!==d&&d.length>0){var c=d[d.length-1];Array.isArray(c.range)&&(c.range[1]=1/0)}return{segmentType:"init",initializationData:null,initializationDataSize:0,protectionData:[],initTimescale:go(l),segmentList:null!=d?d:void 0}}var f=Lu(l,t,o,r),v=Fu(n,l,f,t),p=null!==(a=o.timestampOffset)&&void 0!==a?a:0;return{segmentType:"media",chunkData:v,chunkSize:l.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=ka(d),i=d.length}else r=e;return{segmentType:"media",chunkData:zu(n,r,t),chunkSize:i,chunkInfos:null,chunkOffset:l,protectionData:[],appendWindow:[a,o]}}(u,l,n)}}var Ku=function(e){var t=co({customManifestLoader:e.manifestLoader},null===_e.dashParsers.wasm||"initialized"!==_e.dashParsers.wasm.status&&"initializing"!==_e.dashParsers.wasm.status?"arraybuffer":"text"),n=uu(e),r=function(e){var t=e.lowLatencyMode,n=e.segmentLoader;return!0!==e.checkMediaSegmentIntegrity?r:vu(r);function r(e,r,i,a,o){var s=pu(e,r.segment);return null==s?Promise.resolve({resultType:"segment-created",resultData:null}):t||void 0===n?gu(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 wn(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),gu(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=Bu(e),a=function(e){var t=e.lowLatencyMode;return!0!==e.checkMediaSegmentIntegrity?n:vu(n);function n(e,n,r,i,a){var o=n.segment,s=o.range,u=pu(e,o);if(null===u)return Promise.resolve({resultType:"segment-created",resultData:null});if(o.isInit)return hu(u,o,r,i,a);var l=fu(n.type,n.mimeType),d="mp4"===l||void 0===l;if(t&&d){if(cu())return mu(u,n,r,a,i);$t("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?so({url:u,responseType:"arraybuffer",headers:Array.isArray(s)?{Range:Io(s)}:null,timeout:r.timeout,onProgress:a.onProgress,cancelSignal:i}).then((function(e){return{resultType:"segment-loaded",resultData:e}})):so({url:u,responseType:"text",headers:Array.isArray(s)?{Range:Io(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:Vu(e)}}};function Gu(e){void 0===e.transports.dash&&(e.transports.dash=Ku),e.dashParsers.js=su,e.mediaSourceInit=Yi}function Wu(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 ju(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:en(a.language),audioDescription:"descriptions"===a.kind||"description"===a.kind,representations:[]};n.push({track:l,nativeTrack:a})}return n}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_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:en(a.language),closedCaption:"captions"===a.kind};n.push({track:d,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_video_"+o+"_"+s.toString();r[o]=s+1,n.push({track:{id:u,representations:[]},nativeTrack:a})}return n}var Yu=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?ju(n._nativeAudioTracks):[],n._videoTracks=void 0!==n._nativeVideoTracks?qu(n._nativeVideoTracks):[],n._textTracks=void 0!==n._nativeTextTracks?Hu(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(){Qu(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(){Xu(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 $u(this._textTracks,t),void("showing"!==t.mode&&(t.mode="showing"))}else Qu(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 Xu(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=ju(e._nativeAudioTracks);if(Wu(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=ju(e._nativeAudioTracks);if(Wu(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=Hu(e._nativeTextTracks);if(Wu(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=Hu(e._nativeTextTracks);if(Wu(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=qu(e._nativeVideoTracks);if(Wu(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=qu(e._nativeVideoTracks);if(Wu(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 Qu(e){for(var t=0;t<e.length;t++){e[t].nativeTrack.mode="disabled"}}function $u(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 Xu(e){for(var t=0;t<e.length;t++){e[t].nativeTrack.selected=!1}}var Zu=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;di(e);var u=new E(null);u.finish();var l=ki(e,a,u,{onError:function(e){return n._onFatalError(e)},onWarning:function(e){return n.trigger("warning",e)}},r);ji(e,(function(e){return n._onFatalError(e)}),r);var d=new Ni(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),di(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;Ti(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 Ei(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}(ri);function Ju(e){e.directfile={initDirectFile:Zu,mediaElementTracksStore:Yu}}var el,tl=w.WebKitMediaKeys;void 0!==tl&&"function"==typeof tl.isTypeSupported&&"function"==typeof tl.prototype.createSession&&"function"==typeof HTMLMediaElement.prototype.webkitSetMediaKeys&&(el=tl);var nl,rl=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}(),il=w.MSMediaKeys;function al(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!==il&&void 0!==il.prototype&&"function"==typeof il.isTypeSupported&&"function"==typeof il.prototype.createSession&&(nl=il);var ol,sl=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),ul=function(){function e(e){if(void 0===nl)throw new Error("No MSMediaKeys API.");this._mediaKeys=new nl(e)}var t=e.prototype;return t._setVideo=function(e){var t=this;return al((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 sl(this._mediaKeys)},t.setServerCertificate=function(){throw new Error("Server certificate is not implemented in your browser")},e}();var ll=w.MozMediaKeys;function dl(e){return"function"==typeof e.webkitGenerateKeyRequest}void 0!==ll&&void 0!==ll.prototype&&"function"==typeof ll.isTypeSupported&&"function"==typeof ll.prototype.createSession&&(ol=ll);var cl=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(ka(i)),o=Fa(a.keys[0].k),s=Fa(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),fl=function(){function e(e){this._keySystem=e}var t=e.prototype;return t._setVideo=function(e){var t=this;return al((function(){if(!dl(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 cl(this._videoElement,this._keySystem)},t.setServerCertificate=function(){throw new Error("Server certificate is not implemented in your browser")},e}();function vl(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=Sa(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(ra(s.byteLength),u),u+=4,l.set(s,u),u+=s.byteLength,l.set(ra(r.byteLength),u),u+=4,l.set(r,u),l}function pl(e,t){var n=e;return al((function(){if(void 0===n.webkitSetMediaKeys)throw new Error("No webKitMediaKeys API.");n.webkitSetMediaKeys(t)}))}var hl=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(Gr(n._keyType,"com.apple.fps")){if(void 0===n._serverCertificate)throw new Error("A server certificate is needed for creating fairplay session.");i=vl(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),ml=function(){function e(e){if(void 0===el)throw new Error("No WebKitMediaKeys API.");this._keyType=e,this._mediaKeys=new el(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 pl(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 hl(this._videoElement,this._keyType,this._serverCertificate)},t.setServerCertificate=function(e){return this._serverCertificate=e,Promise.resolve()},e}();function gl(){if(void 0===el)throw new Error("No WebKitMediaKeys API.");return{isTypeSupported:el.isTypeSupported,createCustomMediaKeys:function(e){return new ml(e)},setMediaKeys:function(e,t){if(null===t)return pl(e,t);if(!(t instanceof ml))throw new Error("Custom setMediaKeys is supposed to be called with webkit custom MediaKeys.");return t._setVideo(e)}}}var yl=function(e){var t,n,r,i=_l;if("standard"!==e&&("auto"!==e||(Q||$)&&void 0!==el)||!k&&h(navigator.requestMediaKeySystemAccess)){var a,o;if("webkit"===e&&void 0!==el){n=R(["needkey"]);var s=gl();a=s.isTypeSupported,o=s.createCustomMediaKeys,i=s.setMediaKeys,r="webkit"}else if(dl(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 fl(e)},setMediaKeys:function(e,t){if(null===t)return Promise.resolve(void 0);if(!(t instanceof fl))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!==el){n=R(["needkey"]);var l=gl();a=l.isTypeSupported,o=l.createCustomMediaKeys,i=l.setMediaKeys,r="webkit"}else if(H&&void 0!==nl){n=R(["encrypted","needkey"]);var d={isTypeSupported:function(e,t){if(void 0===nl)throw new Error("No MSMediaKeys API.");return void 0!==t?nl.isTypeSupported(e,t):nl.isTypeSupported(e)},createCustomMediaKeys:function(e){return new ul(e)},setMediaKeys:function(e,t){if(null===t)return Promise.resolve(void 0);if(!(t instanceof ul))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!==ol){n=R(["encrypted","needkey"]);var c={isTypeSupported:function(e,t){if(void 0===ol)throw new Error("No MozMediaKeys API.");return void 0!==t?ol.isTypeSupported(e,t):ol.isTypeSupported(e)},createCustomMediaKeys:function(e){if(void 0===ol)throw new Error("No MozMediaKeys API.");return new ol(e)},setMediaKeys:function(e,t){return al((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 rl(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 _l(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 bl=yl,Sl=Zi(Ea("pssh"),0);function El(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)&&an(t.data,r.data))return!0}return!1}function Tl(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||Zi(e,n+4)!==Sl)return ne.warn("Compat: Unrecognized initialization data. Use as is."),[{systemId:void 0,data:e}];var r=Zi(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:_u(i,8),data:i};El(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 kl(e){Ze.setState(e,null),bl.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 wl(){return(wl=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 Al(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 Il(e,t,n,r){var i=e.loadedSessionsStore,a=e.persistentSessionsStore;return"temporary"===n?Rl(i,t):null===a?(ne.warn("DRM: Cannot create persistent MediaKeySession, PersistentSessionsStore not created."),Rl(i,t)):function(e,t,n,r){return xl.apply(this,arguments)}(i,a,t,r)}function Rl(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 xl(){return xl=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||!Al(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]])}))),xl.apply(this,arguments)}function Ml(e,t){return Cl.apply(this,arguments)}function Cl(){return(Cl=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 Pl(e,t,n,r,i){return Dl.apply(this,arguments)}function Dl(){return(Dl=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(!Al(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,Ml(s,i);case 18:if(null===a.cancellationError){e.next=20;break}throw a.cancellationError;case 20:return e.next=22,Il(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 Nl(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 Ol(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=Vo(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=Vo(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 Ll(e,t,n){ne.info("DRM: Searching for compatible MediaKeySystemAccess");var r=Ze.getState(e);if(null!==r&&bl.implementation===r.emeImplementation.implementation){var i=Nl(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!=bl.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=Ol(r),ne.debug("DRM: Request keysystem access "+i+","+(t+1)+" of "+a.length),e.prev=8,e.next=11,bl.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 Ul(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||Zi(e,i+4)!==Sl)throw ne.warn("Compat: unrecognized initialization data. Cannot patch it."),new Error("Compat: unrecognized initialization data. Cannot patch it.");var a=Zi(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=da(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=Qi(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=Qi(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 Qi(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 Bl=100;function Fl(e,t){return zl.apply(this,arguments)}function zl(){return(zl=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,Bl);function i(){clearTimeout(n),t.removeEventListener("keystatuseschange",i),e(r)}})));case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Vl(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,An(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,An(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 Kl(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 Gl(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 Gl(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 Gl(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 Wl(e,t){for(var n,r,i=function(){var e=r.value;if(!t.some((function(t){return an(t,e)})))return{v:!1}},a=Kl(e);!(r=a()).done;)if(n=i())return n.v;return!0}function jl(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 Hl(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 Hl(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 Hl(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 ql=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=jl(this._keyIds);!(t=n()).done;){if(an(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&&Wl(t,this._keyIds))return!0;if(void 0!==this._initializationData.keyIds)return Wl(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?Wl(e.keyIds,this._initializationData.keyIds):this._initializationData.type===e.type&&this._initializationData.values.isCompatibleWith(e.values)},e}();function Yl(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 $l=function(){function e(e){this._mediaKeys=e,this._storage=[]}var t=e.prototype;return t.createSession=function(e,t){var n=this,r=new ql(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=Yl(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",Ul(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,Ul(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=Yl(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",Fl(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,Fl(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=Yl(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"}),Xl(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 Xl(e){return Zl.apply(this,arguments)}function Zl(){return(Zl=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,Vl(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 Jl(e){for(var t=0,n=0;n<e.length;n++)t=(t<<5)-t+e[n],t&=t;return t}var ed=function(){function e(e){this.initData=e}return e.prototype.toJSON=function(){return Ba(this.initData)},e.decode=function(e){return Fa(e)},e}();function td(e,t){var n,r;return null!==(r=null!==(n=nd(e,t))&&void 0!==n?n:nd(t,e))&&void 0!==r&&r}function nd(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(!an(n.data instanceof Uint8Array?n.data:"string"==typeof n.data?ed.decode(n.data):n.data.initData,a.data instanceof Uint8Array?a.data:"string"==typeof a.data?ed.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(!an(o.data instanceof Uint8Array?o.data:"string"==typeof o.data?ed.decode(o.data):o.data.initData,s.data instanceof Uint8Array?s.data:"string"==typeof s.data?ed.decode(s.data):s.data.initData))return!1;break}}if(r===t.length)return null}return!0}}return null}function rd(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 id(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 id(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 id(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 ad(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 od=function(){function e(e){ad(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 ed(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 ed(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:Jl(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=Ba(e),i=rd(n.keyIds);!(t=i()).done;){var a=t.value;if("string"==typeof a){if(r===a)return!0}else if(an(a.initData,e))return!0}return!1})))return{v:o}}else if(td(e.values.getFormattedValues(),n.values))return{v:o};break;case 3:if(td(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(an("string"==typeof n.initData?ed.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(an(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 sd=new WeakMap,ud={prepare:function(e){sd.set(e,null)},set:function(e,t){var n=t instanceof Uint8Array?t:new Uint8Array(t instanceof ArrayBuffer?t:t.buffer),r=Jl(n);sd.set(e,{hash:r,serverCertificate:n})},hasOne:function(e){var t=sd.get(e);return void 0!==t&&(null!==t||void 0)},has:function(e,t){var n=sd.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(Jl(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 ld(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 od(t)}function dd(e,t,n){return cd.apply(this,arguments)}function cd(){return(cd=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,Ll(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=ld(o),J||ee||null===u||"reuse-media-key-system-access"!==i.type){e.next=12;break}if(d=u.mediaKeys,c=u.loadedSessionsStore,!1!==ud.hasOne(d)&&(h(o.serverCertificate)||!ud.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,fd(s);case 14:return f=e.sent,ne.info("DRM: MediaKeys created with success"),v=new $l(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 fd(e){return vd.apply(this,arguments)}function vd(){return(vd=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 pd(){return(pd=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,dd(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"),kl(t)),e.abrupt("return",i);case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var hd=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)),md={EXPIRED:"expired",INTERNAL_ERROR:"internal-error",OUTPUT_RESTRICTED:"output-restricted"};function gd(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)?Ia(t):t}(n,new Uint8Array(r[1])),f={keyId:c.buffer,keyStatus:d};switch(ne.hasLevel("DEBUG")&&ne.debug("DRM: key status update ("+Aa(c)+"): "+d),d){case md.EXPIRED:var v=new fe("KEY_STATUS_CHANGE_ERROR","A decryption key expired ("+Aa(c)+")",{keyStatuses:[f].concat(l)});if("error"===o||void 0===o)throw v;switch(o){case"close-session":throw new hd(v);case"fallback":s.push(c);break;default:"continue"===o||void 0===o?u.push(c):ke()}l.push(f);break;case md.INTERNAL_ERROR:var p=new fe("KEY_STATUS_CHANGE_ERROR",'A "'+d+'" status has been encountered ('+Aa(c)+")",{keyStatuses:[f].concat(l)});switch(i){case void 0:case"error":throw p;case"close-session":throw new hd(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 md.OUTPUT_RESTRICTED:var h=new fe("KEY_STATUS_CHANGE_ERROR",'A "'+d+'" status has been encountered ('+Aa(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 yd=L,_d=N,bd=U;function Sd(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))})),yd(e,(function(e){s.cancel(),r.onError(new fe("KEY_ERROR",e.type))}),s.signal),bd(e,(function(){try{u()}catch(e){if(i.isCancelled()||s.isUsed()&&e instanceof We)return;s.cancel(),r.onError(e)}}),s.signal),_d(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=Rn(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 wd('"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 wd||h(e)||!0!==e.noRetry},onRetry:function(e){return r.onWarning(Ed(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 Td.apply(this,arguments)}(e,t)}catch(e){s.cancel(),r.onError(e)}})).catch((function(e){if(!s.isUsed()){s.cancel();var t=Ed(e);if(!h(e))if(!0===e.fallbackOnLastTry)return ne.warn("DRM: Last `getLicense` attempt failed. Blacklisting the current session."),void r.onError(new kd(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=gd(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 Ed(e){if(e instanceof wd)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 Td(){return(Td=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 kd=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)),wd=function(e){function t(t){var n;return n=e.call(this)||this,Object.setPrototypeOf(ie(n),kd.prototype),n.message=t,n}return s(t,e),t}(se(Error));function Ad(e,t){return Id.apply(this,arguments)}function Id(){return(Id=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 Rd(e,t){return xd.apply(this,arguments)}function xd(){return(xd=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!==ud.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"),ud.prepare(t),e.prev=8,e.next=11,Ad(t,n);case 11:return r=e.sent,ud.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 Md(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 Cd=function(){function e(e){this._innerValues=e,this._lazyFormattedValues=null}var t=e.prototype;return t.constructRequestData=function(){return Qi.apply(void 0,this._innerValues.map((function(e){return e.data})))},t.isCompatibleWith=function(t){var n=t instanceof e?t.getFormattedValues():t;return td(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:Jl(n)}}))),this._lazyFormattedValues},e}();function Pd(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 Dd(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 Dd(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 Dd(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 Nd=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:hi.Initializing,isMediaKeysAttached:0,isInitDataQueueLocked:!0,data:null},r.error=null,bl.onEncrypted(t,(function(e){ne.debug("DRM: Encrypted event received from media element.");var t=Tl(e);null!==t&&r.onInitializationData(t)}),i.signal),function(e,t,n){return pd.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=Gr(i=o.keySystem,"com.microsoft.playready")||"com.chromecast.playready"===i||"com.youtube.playready"===i?"9a04f07998404286ab92e65be0885f95":"com.widevine.alpha"===i?"edef8ba979d64acea3c827dcd51d21ed":Gr(i,"com.apple.fps")?"94ce86fb07ff4f43adb893d2fa968ca2":Gr(i,"com.nagra.")?"adb41c242dbf4a6d958b4457c0d27b95":void 0),r.systemId=n,r._stateData.state===hi.Initializing&&(r._stateData={state:hi.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(bl.requestMediaKeySystemAccess)};var n=t.prototype;return n.getState=function(){return this._stateData.state},n.attach=function(){var e=this;if(this._stateData.state!==hi.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:hi.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:bl,loadedSessionsStore:s.loadedSessionsStore,mediaKeySystemAccess:o,mediaKeys:a,keySystemOptions:i};ne.debug("DRM: Attaching current MediaKeys"),function(e,t,n){return wl.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,Rd(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:hi.ReadyForContent,isMediaKeysAttached:2,isInitDataQueueLocked:!1,data:{mediaKeysData:r}},s!==hi.ReadyForContent&&e.trigger("stateChange",hi.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:hi.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 Cd(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."):Ud(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+", "+Aa(t)}),""),ne.debug("DRM: Blacklisting new key ids",u)),Ld(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})),zd(c=new Set,l),f=Pd(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 an(e,t)}))||m.keyStatuses.blacklisted.some((function(e){return an(e,t)}))||m.keyStatuses.blacklisted.push(t);case 2:case"end":return e.stop()}}),e)})),E=Pd(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 Ld(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":Od(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,Pl(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,Sd(P,a,r.keySystem,{onKeyUpdate:function(e){var n=Bd(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;Md(r,I-1),r.add(t,M.record.getAssociatedKeyIds(),P),N=!0}void 0!==t.content&&Ld(t.content.manifest,n.whitelisted,n.blacklisted,[]),B._unlockInitDataQueue()},onWarning:function(e){B.trigger("warning",e)},onError:function(e){var n;if(e instanceof hd){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&&Ld(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 kd){if(M.blacklistedSessionError=e,void 0!==t.content){var a=t.content.manifest;ne.info("DRM: blacklisting Representations based on protection data."),Ud(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."),Ud(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 an(t,e)})))return{v:!0}},a=Kl(e);!(r=a()).done;)if(n=i())return n.v;return!1}(e.keyIds,o)}else{var s=i.keyStatuses.whitelisted;a=!Wl(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"),Ld(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:hi.Error,isMediaKeysAttached:void 0,isInitDataQueueLocked:void 0,data:null},this._canceller.cancel(),this.trigger("error",t),this._stateData.state===hi.Error&&this.trigger("stateChange",this._stateData.state)}},n._isStopped=function(){return this._stateData.state===hi.Disposed||this._stateData.state===hi.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 Od(e){var t=e.getConfiguration().sessionTypes;return void 0!==t&&Se(t,"persistent-license")}function Ld(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=Pd(i);!(a=o()).done;){for(var s,u=a.value,l=Pd(n);!(s=l()).done;){if(an(s.value,u.keyId))return!1}for(var d,c=Pd(t);!(d=c()).done;){if(an(d.value,u.keyId))return!0}for(var f,v=Pd(r);!(f=v()).done;){if(an(f.value,u.keyId))return}}return e.decipherable}))}function Ud(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)&&an(e.data,t.data)}))})))return{v:!1}},s=Pd(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 Bd(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 an(t,e)}))||(ne.hasLevel("DEBUG")&&ne.debug("DRM: KeySessionRecord's key missing in the license, blacklisting it",Aa(e)),u.push(e))},d=Pd(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 an(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 Aa(e)})).join(", ")),u.push.apply(u,v))}if(r&&void 0!==f)if("content"===n){for(var p,h=new Set,m=Pd(f.manifest.periods);!(p=m()).done;){zd(h,p.value)}Fd(h,u)}else if("periods"===n)for(var g,y=Pd(f.manifest.periods);!(g=y()).done;){var _=g.value,b=new Set;if(zd(b,_),(null===(o=e.content)||void 0===o?void 0:o.period.id)===_.id)Fd(b,u);else for(var S=Array.from(b),E=function(){var e=k[T];if(u.some((function(t){return an(t,e)})))return Fd(b,u),1},T=0,k=S;T<k.length&&!E();T++);}}return{whitelisted:i,blacklisted:u.slice(i.length)}}function Fd(e,t){for(var n=Array.from(e.values()),r=function(){var e=a[i];t.some((function(t){return an(t,e)}))||t.push(e)},i=0,a=n;i<a.length;i++)r()}function zd(e,t){for(var n,r=Pd(t.getAdaptations());!(n=r()).done;)for(var i,a=Pd(n.value.representations);!(i=a()).done;){var o=i.value;if(void 0!==o.contentProtections&&void 0!==o.contentProtections.keyIds)for(var s,u=Pd(o.contentProtections.keyIds);!(s=u()).done;){var l=s.value;e.add(l.keyId)}}}var Vd=Nd;function Kd(e){e.decrypt=Vd}function Gd(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 Wd=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 jd=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 Wd,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&&Gd(n,a)}this._buffered.remove(e,t)},t}(or);var Hd=jd,qd=/(\d+) (\d+)/;function Yd(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 Qd(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(Gr(i.name,"tts"))n[i.name.substring(4)]=i.value}return n}function $d(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 Xd(e){var t=$d(e,"div");if(0===t.length){var n=$d(e,"tt:div");n.length>0&&(t=n)}return t}function Zd(e){return"br"===e.nodeName||"tt:br"===e.nodeName}function Jd(e){return"span"===e.nodeName||"tt:span"===e.nodeName}var ec=["align","backgroundColor","color","direction","display","displayAlign","extent","fontFamily","fontSize","fontStyle","fontWeight","lineHeight","opacity","origin","overflow","padding","textAlign","textDecoration","textOutline","unicodeBidi","visibility","wrapOption","writingMode"];function tc(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=qd.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:Qd(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=Qd(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=Yd(ec,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=Xd(w),I=l({},E,Yd(ec,[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 nc(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 rc(e){return"function"==typeof w.VTTCue&&e instanceof w.VTTCue}var ic=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,ac=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,oc=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,sc=/^(\d*\.?\d*)f$/,uc=/^(\d*\.?\d*)t$/,lc=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/,dc=/^(\d{1,2}|100)% (\d{1,2}|100)%$/,cc=/^((?:\+|\-)?\d*(?:\.\d+)?)(px|em|c|%|rh|rw)$/,fc=/^#([0-9A-f]{2})([0-9A-f]{2})([0-9A-f]{2})([0-9A-f]{2})$/,vc=/^#([0-9A-f])([0-9A-f])([0-9A-f])([0-9A-f])$/,pc=/^rgb\( *(\d+) *, *(\d+) *, *(\d+) *\)/,hc=/^rgba\( *(\d+) *, *(\d+) *, *(\d+) *, *(\d+) *\)/;function mc(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 gc=function(e,t){return ic.test(e)?function(e,t){var n=ic.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):ac.test(e)?mc(ac,e):oc.test(e)?mc(oc,e):sc.test(e)?function(e,t){var n=sc.exec(t);return Number(n[1])/e.frameRate}(t,e):uc.test(e)?function(e,t){var n=uc.exec(t);return Number(n[1])/e.tickRate}(t,e):lc.test(e)?mc(lc,e):void 0};function yc(e,t){var n=e.getAttribute("begin"),r=e.getAttribute("dur"),i=e.getAttribute("end"),a=p(n)?gc(n,t):null,o=p(r)?gc(r,t):null,s=p(i)?gc(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 _c={left:"start",center:"center",right:"end",start:"start",end:"end"},bc={left:"line-left",center:"center",right:"line-right"};function Sc(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=yc(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,"&").replace(/<|\u003C/g,"<").replace(/>|\u2265/g,">").replace(/\u200E/g,"‎").replace(/\u200F/g,"‏").replace(/\u00A0/g," ")}else if(Zd(o))i+="\n";else if(Jd(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=nc(s+n,u+n,l);return null===d?null:(rc(d)&&function(e,t){var n=t.extent;if(p(n)){var r=dc.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))dc.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=bc[a];e.positionAlign=void 0===o?"":o;var s=_c[a];e.lineAlign=void 0===s?"":s}}(d,r),d)}var Ec=function(e,t){for(var n=tc(e,t),r=[],i=0;i<n.length;i++){var a=Sc(n[i]);null!==a&&r.push(a)}return r};function Tc(e){e.nativeTextTracksParsers.ttml=Ec,e.nativeTextTracksBuffer=Hd}var kc=/&#([0-9]+);/g,wc=/<br>/gi,Ac=/<style[^>]*>([\s\S]*?)<\/style[^>]*>/i,Ic=/\s*<p (?:class=([^>]+))?>(.*)/i,Rc=/<sync[^>]+?start="?([0-9]*)"?[^0-9]/i;function xc(e,t){var n=new RegExp("\\s*"+t+":\\s*(\\S+);","i").exec(e);return Array.isArray(n)?n[1]:null}var Mc=function(e,t,n){var r,i,a=/<sync[ >]/gi,o=/<sync[ >]|<\/body>/gi,s=[],u=Ac.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=xc(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=Rc.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=nc(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=Ic.exec(e[a]))){var o=r,u=o[1],l=o[2];d===u&&(" "===l?s[s.length-1].end=n:s.push({text:(i=l,i.replace(wc,"\n").replace(kc,(function(e,t){return String.fromCharCode(Number(t))}))),start:n+t}))}}};function Cc(e){e.nativeTextTracksParsers.sami=Mc,e.nativeTextTracksBuffer=Hd}function Pc(e){for(var t=0;t<e.length;){if(""===e[t])return t+1;t++}return t}function Dc(e,t){return"string"==typeof e[t]&&/^STYLE( .*)?$/g.test(e[t])&&(void 0===e[t+1]||e[t+1].indexOf("--\x3e")<0)}function Nc(e,t){var n=e[t];if(void 0===n||""===n||Dc(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 Oc(e,t){for(var n=t+1;p(e[n]);)n++;return n}function Lc(e,t){for(var n=[],r=t;r<e.length;r++)if(Nc(e,r)){var i=Oc(e,r);n.push(e.slice(r,i)),r=i}else if(p(e[r]))for(;p(e[r]);)r++;return n}function Uc(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 Bc(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=Uc(t[1]),r=Uc(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 Fc(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 zc=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=Lc(n,Pc(n)),a=[],o=0;o<i.length;o++){var s=Bc(i[o],t);if(null!=s){var u=nc((r=s).start,r.end,r.payload.join("\n"));null!=u&&(rc(u)&&Fc(s.settings,u),a.push(u))}}return a};function Vc(e){e.nativeTextTracksParsers.vtt=zc,e.nativeTextTracksBuffer=Hd}function Kc(e,t){for(var n=t+1;p(e[n]);)n++;return n}function Gc(e){for(var t=[],n=0;n<e.length;n++)if(p(e[n])){var r=Kc(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 Wc(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 jc(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=Wc(n),u=Wc(r);return void 0===s||void 0===u?null:{start:s+t,end:u+t,payload:i}}function Hc(e,t){for(var n,r,i,a,o,s=Gc(e.split(/\r\n|\n|\r/)),u=[],l=0;l<s.length;l++){var d=jc(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"),nc(r,i,o));null!==c&&u.push(c)}}return u}function qc(e){e.nativeTextTracksParsers.srt=Hc,e.nativeTextTracksBuffer=Hd}var Yc=w.ResizeObserver;function Qc(e,t){return Math.abs(e-t)<=.2}function $c(e,t){for(var n=e.length-1;n>=0;n--){if(e[n].start<t)return e.slice(0,n+1)}return[]}function Xc(e,t){for(var n=0;n<e.length;n++){if(e[n].end>t)return e.slice(n,e.length)}return[]}function Zc(e,t,n){var r=Math.max(e.start,t),i=$c(e.cues,t),a={start:e.start,end:r,cues:i},o=Math.min(n,e.end),s=Xc(e.cues,n);return[a,{start:o,end:e.end,cues:s}]}var Jc=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=Xc(a.cues,n),a.start=n;else{var o=Zc(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=$c(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||Qc(i.end,t.end)?r[e]=i:(t.start>=i.end||(t.cues=Xc(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(Qc(t,s.start)){if(Qc(n,s.end))return void(r[o]=i);if(n<s.end)return s.cues=Xc(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(Qc(n,s.start))return s.start=n,void r.splice(o,0,i);if(Qc(n,s.end))return void r.splice(o,1,i);if(n<s.end)return s.cues=Xc(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(Qc(s.end,n))return s.cues=$c(s.cues,t),s.end=t,void r.splice(o+1,0,i);if(s.end>n){var u=Zc(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=$c(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 ef(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 tf=z,nf=F,rf=B;function af(e,t){try{e.removeChild(t)}catch(e){ne.warn("HTSB: Can't remove text track: not in the element.")}}function of(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 sf=function(e){function t(t,n){var r;return ne.debug("HTSB: Creating HTMLTextSegmentBuffer"),(r=e.call(this)||this).bufferType="text",r._buffered=new Wd,r._videoElement=t,r._textTrackElement=n,r._sizeUpdateCanceller=new Ge,r._canceller=new Ge,r._buffer=new Jc,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++)af(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++)af(this._textTrackElement,this._currentCues[t].element);this._currentCues=[];for(var n=0;n<e.length;n++){var r=e[n],i=of(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!==Yc){var l=new Yc((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];ef(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)}rf(this._videoElement,(function(){a(),t._disableCurrentCues()}),e),nf(this._videoElement,i,e),tf(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}(or);var uf,lf=sf;function df(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 cf(e){e.extent="70% 20%",e.fontSize="1c",e.origin="15% 80%",e.displayAlign="before",e.textAlign="center"}function ff(e,t){(void 0===uf&&(uf=void 0!==e.classList&&"function"==typeof e.classList.add),uf)?e.classList.add(t):(" "+e.className+" ").indexOf(" "+t+" ")<0&&(e.className+=" "+t)}function vf(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 pf(e){var t;return null!=(t=fc.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=vc.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=pc.exec(e))?"rgb("+String(+t[1])+","+String(+t[2])+","+String(+t[3])+")":null!=(t=hc.exec(e))?"rgba("+String(+t[1])+","+String(+t[2])+","+String(+t[3])+","+String(+t[4]/255)+")":e}var hf=["color","direction","display","fontFamily","fontSize","fontStyle","fontWeight","textDecoration","textOutline","unicodeBidi","visibility","wrapOption"];function mf(e,t,n){var r=t.color;p(r)&&(e.style.color=pf(r));var i=t.backgroundColor;p(i)&&(e.style.backgroundColor=pf(i));var a=t.textOutline;if(p(a)){var o=a.trim().replace(/\s+/g," ").split(" "),s=o.length;if(3===s){var u=pf(o[0]),l=o[1];e.style.textShadow=vf(u,l)}else if(p(r)&&1===s){var d=o[0];e.style.textShadow=vf(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=pf(o[0]),v=o[1];e.style.textShadow=vf(f,v)}else if(p(r)){var h=o[0];e.style.textShadow=vf(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=cc.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",ff(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",ff(e,"proportional-style"),e.setAttribute("data-proportional-font-size",String(i/100)))}else ne.warn("TTML Parser: unhandled fontSize unit:",r[2])}}(e,b):(ff(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 gf(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=cc.exec(r[0]),a=cc.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]?(ff(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]?(ff(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=cc.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]?(ff(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=cc.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]?(ff(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=cc.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]?(ff(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=cc.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]?(ff(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=cc.exec(r[0]),a=cc.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]?(ff(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]?(ff(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 yf(e,t){e.style.margin="0px",ff(e,"proportional-style"),e.setAttribute("data-proportional-font-size","1");var n=t.backgroundColor;p(n)&&(e.style.backgroundColor=pf(n));var r=t.lineHeight;p(r)&&function(e,t){var n=t.trim();if("auto"!==n){var r=cc.exec(n[0]);null!==r&&("px"===r[2]||"%"===r[2]||"em"===r[2]?e.style.lineHeight=r[1]+r[2]:"c"===r[2]?(ff(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 _f(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",mf(r,t,n),r}function bf(e,t,n,r,i,a){var o=a.cellResolution,s=a.shouldTrimWhiteSpace,u=Xd(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)),gf(d,i),null!==t){var c=Yd(["backgroundColor"],[].concat(u,[t]),r,n).bodyBackgroundColor;p(c)&&(d.style.backgroundColor=pf(c))}var f=document.createElement("p");f.className="rxp-texttrack-p",yf(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=Yd(["backgroundColor"],a,n,t).backgroundColor;p(f)?i.backgroundColor=f:delete i.backgroundColor;var v=_f(c,i,o);u.push(v)}else if(Zd(c)){var h=document.createElement("BR");u.push(h)}else if(Jd(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,Yd(hf,[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 Sf(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=yc(t,n);return{start:d.start+s,end:d.end+s,element:bf(t,r,i,a,o,{cellResolution:l,shouldTrimWhiteSpace:u})}}var Ef=function(e,t){for(var n=tc(e,t),r=[],i=0;i<n.length;i++){var a=n[i].paragraphStyle;df(a)&&cf(a);var o=Sf(n[i]);null!==o&&r.push(o)}return r};function Tf(e){e.htmlTextTracksParsers.ttml=Ef,e.htmlTextTracksBuffer=lf}var kf=/&#([0-9]+);/g,wf=/<br>/gi,Af=/<style[^>]*>([\s\S]*?)<\/style[^>]*>/i,If=/\s*<p (?:class=([^>]+))?>(.*)/i,Rf=/<sync[^>]+?start="?([0-9]*)"?[^0-9]/i;function xf(e,t){var n=new RegExp("\\s*"+t+":\\s*(\\S+);","i").exec(e);return Array.isArray(n)?n[1]:null}var Mf=function(e,t,n){var r,i,a=/<sync[ >]/gi,o=/<sync[ >]|<\/body>/gi,s=[],u=Af.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=xf(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=Rf.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=If.exec(e[r]);if(Array.isArray(i)){var a=i[1],o=i[2];if(d===a)if(" "===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(wf),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(kf,(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 Cf(e){e.htmlTextTracksParsers.sami=Mf,e.htmlTextTracksBuffer=lf}var Pf={white:"#ffffff",lime:"#00ff00",cyan:"#00ffff",red:"#ff0000",yellow:"#ffff00",magenta:"#ff00ff",blue:"#0000ff",black:"#000000"};function Df(e){var t=Object.keys(Pf).reduce((function(e,t){return e[t]="color: "+Pf[t]+";",e["bg_"+t]="background-color: "+Pf[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 Nf(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=Nf(e.childNodes[v],t);n.appendChild(h)}}else{n=document.createElement("span");for(var m=0;m<e.childNodes.length;m++){var g=Nf(e.childNodes[m],t);n.appendChild(g)}}return n}var Of,Lf,Uf,Bf=function(e){if(!(void 0!==e&&0!==Kt(e).length))return"text-align:center";var t=Ff(e),n=Kf(e);return"position: absolute;margin: 0;transform: translate("+t.offset+"%,"+n.offset+"%);width: "+Hf(e.size)+"%;left: "+t.position+"%;top: "+(null!==n.position?n.position+"%":"auto")+";text-align: "+jf(e.align)+";"};!function(e){e.LINE_LEFT="line-left",e.CENTER="center",e.LINE_RIGHT="line-right"}(Of||(Of={})),function(e){e.LEFT="left",e.CENTER="center",e.RIGHT="right"}(Lf||(Lf={})),function(e){e.START="start",e.CENTER="center",e.END="end"}(Uf||(Uf={}));var Ff=function(e){return{position:zf(e),offset:Vf(e)}},zf=function(e){var t,n=Yf(e.position);if(null!==n)return n;var r=jf(e.align);return((t={})[Lf.LEFT]=0,t[Lf.CENTER]=50,t[Lf.RIGHT]=100,t)[r]},Vf=function(e){var t,n,r,i,a=((t={})[Of.LINE_LEFT]=0,t[Of.CENTER]=-50,t[Of.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={})[Lf.LEFT]=0,n[Lf.CENTER]=-50,n[Lf.RIGHT]=-100,n)[void 0!==e.align?jf(e.align):Lf.CENTER]},Kf=function(e){return{position:Gf(e.line),offset:Wf(e.line)}},Gf=function(e){return Yf(e)},Wf=function(e){var t,n=((t={})[Uf.START]=0,t[Uf.CENTER]=-50,t[Uf.END]=-100,t);if(void 0===e)return n[Uf.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[Uf.START]},jf=function(e){switch(e){case"left":case"start":return"left";case"right":case"end":return"right";default:return"center"}},Hf=function(e){return qf(e,100)},qf=function(e,t){var n=Yf(e);return null!==n?n:t},Yf=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 Qf(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=Bf(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(Nf(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 $f=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=Pc(n),a=function(e,t){for(var n=[],r=t;r<e.length;r++)if(Dc(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=Lc(n,i),s=Df(a),u=0;u<o.length;u++){var l=Bc(o[u],t);if(null!=l){var d=Qf(l,s);r.push(d)}}return r};function Xf(e){e.htmlTextTracksParsers.vtt=$f,e.htmlTextTracksBuffer=lf}function Zf(e,t){for(var n=Gc(e.split(/\r\n|\n|\r/)),r=[],i=0;i<n.length;i++){var a=jc(n[i],t);if(null!=a){var o=Jf(a);null!=o&&r.push(o)}}return r}function Jf(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=ev(r[a]);i.appendChild(o)}return{start:t,end:n,element:i}}function ev(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(tv(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 tv(e){return"FONT"===e.nodeName&&"color"in e}function nv(e){e.htmlTextTracksParsers.srt=Zf,e.htmlTextTracksBuffer=lf}Rt.addFeatures([Lo,Gu,Ju,Kd,Tc,Cc,Vc,qc,Tf,Cf,Xf,nv]),"boolean"==typeof __RX_PLAYER_DEBUG_MODE__&&__RX_PLAYER_DEBUG_MODE__&&ne.setLevel("DEBUG");var rv=Rt}(),r=r.default}()}));
|