@tarojs/components 4.0.0-beta.1 → 4.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +14 -0
- package/dist/cjs/{index-5a8221ec.js → index-dbbe9dde.js} +3 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/taro-ad-core.cjs.entry.js +1 -1
- package/dist/cjs/taro-ad-custom-core.cjs.entry.js +1 -1
- package/dist/cjs/taro-animation-video-core.cjs.entry.js +1 -1
- package/dist/cjs/taro-animation-view-core.cjs.entry.js +1 -1
- package/dist/cjs/taro-ar-camera-core.cjs.entry.js +1 -1
- package/dist/cjs/taro-audio-core.cjs.entry.js +2 -2
- package/dist/cjs/taro-aweme-data-core.cjs.entry.js +1 -1
- package/dist/cjs/taro-block-core.cjs.entry.js +1 -1
- package/dist/cjs/taro-button-core.cjs.entry.js +3 -3
- package/dist/cjs/taro-camera-core.cjs.entry.js +1 -1
- package/dist/cjs/taro-canvas-core.cjs.entry.js +2 -2
- package/dist/cjs/taro-channel-live-core.cjs.entry.js +1 -1
- package/dist/cjs/taro-channel-video-core.cjs.entry.js +1 -1
- package/dist/cjs/taro-checkbox-core_2.cjs.entry.js +2 -2
- package/dist/cjs/taro-comment-detail-core.cjs.entry.js +1 -1
- package/dist/cjs/taro-comment-list-core.cjs.entry.js +1 -1
- package/dist/cjs/taro-components.cjs.js +2 -2
- package/dist/cjs/taro-contact-button-core.cjs.entry.js +1 -1
- package/dist/cjs/taro-cover-image-core.cjs.entry.js +2 -2
- package/dist/cjs/taro-cover-view-core.cjs.entry.js +2 -2
- package/dist/cjs/taro-custom-wrapper-core.cjs.entry.js +1 -1
- package/dist/cjs/taro-editor-core.cjs.entry.js +1 -1
- package/dist/cjs/taro-follow-swan-core.cjs.entry.js +1 -1
- package/dist/cjs/taro-form-core.cjs.entry.js +1 -1
- package/dist/cjs/taro-functional-page-navigator-core.cjs.entry.js +1 -1
- package/dist/cjs/taro-grid-view-core.cjs.entry.js +1 -1
- package/dist/cjs/taro-icon-core.cjs.entry.js +5 -2
- package/dist/cjs/taro-image-core.cjs.entry.js +7 -6
- package/dist/cjs/taro-inline-payment-panel-core.cjs.entry.js +1 -1
- package/dist/cjs/taro-input-core.cjs.entry.js +2 -2
- package/dist/cjs/taro-keyboard-accessory-core.cjs.entry.js +1 -1
- package/dist/cjs/taro-label-core.cjs.entry.js +1 -1
- package/dist/cjs/taro-lifestyle-core.cjs.entry.js +1 -1
- package/dist/cjs/taro-like-core.cjs.entry.js +1 -1
- package/dist/cjs/taro-list-view-core.cjs.entry.js +1 -1
- package/dist/cjs/taro-live-player-core.cjs.entry.js +1 -1
- package/dist/cjs/taro-live-pusher-core.cjs.entry.js +1 -1
- package/dist/cjs/taro-login-core.cjs.entry.js +1 -1
- package/dist/cjs/taro-lottie-core.cjs.entry.js +1 -1
- package/dist/cjs/taro-map-core.cjs.entry.js +1 -1
- package/dist/cjs/taro-match-media-core.cjs.entry.js +1 -1
- package/dist/cjs/taro-movable-area-core_2.cjs.entry.js +4 -4
- package/dist/cjs/taro-native-slot-core.cjs.entry.js +1 -1
- package/dist/cjs/taro-navigation-bar-core.cjs.entry.js +1 -1
- package/dist/cjs/taro-navigator-core.cjs.entry.js +2 -2
- package/dist/cjs/taro-official-account-core.cjs.entry.js +1 -1
- package/dist/cjs/taro-open-data-core.cjs.entry.js +1 -1
- package/dist/cjs/taro-page-container-core.cjs.entry.js +1 -1
- package/dist/cjs/taro-page-meta-core.cjs.entry.js +1 -1
- package/dist/cjs/taro-picker-core_2.cjs.entry.js +3 -3
- package/dist/cjs/taro-picker-view-column-core_2.cjs.entry.js +4 -4
- package/dist/cjs/taro-progress-core.cjs.entry.js +4 -1
- package/dist/cjs/taro-pull-to-refresh-core.cjs.entry.js +3 -3
- package/dist/cjs/taro-radio-core_2.cjs.entry.js +1 -1
- package/dist/cjs/taro-rich-text-core.cjs.entry.js +2 -2
- package/dist/cjs/taro-root-portal-core.cjs.entry.js +1 -1
- package/dist/cjs/taro-rtc-room-core.cjs.entry.js +1 -1
- package/dist/cjs/taro-rtc-room-item-core.cjs.entry.js +1 -1
- package/dist/cjs/taro-scroll-view-core.cjs.entry.js +3 -3
- package/dist/cjs/taro-share-element-core.cjs.entry.js +1 -1
- package/dist/cjs/taro-slider-core.cjs.entry.js +4 -1
- package/dist/cjs/taro-slot-core.cjs.entry.js +1 -1
- package/dist/cjs/taro-snapshot-core.cjs.entry.js +1 -1
- package/dist/cjs/taro-sticky-header-core.cjs.entry.js +1 -1
- package/dist/cjs/taro-sticky-section-core.cjs.entry.js +1 -1
- package/dist/cjs/taro-swiper-core_2.cjs.entry.js +19 -9863
- package/dist/cjs/taro-switch-core.cjs.entry.js +13 -12
- package/dist/cjs/taro-tab-item-core.cjs.entry.js +1 -1
- package/dist/cjs/taro-tabbar.cjs.entry.js +14 -86
- package/dist/cjs/taro-tabs-core.cjs.entry.js +1 -1
- package/dist/cjs/taro-text-core.cjs.entry.js +2 -2
- package/dist/cjs/taro-textarea-core.cjs.entry.js +12 -3
- package/dist/cjs/taro-video-control_3.cjs.entry.js +25 -5
- package/dist/cjs/taro-view-core.cjs.entry.js +3 -3
- package/dist/cjs/taro-voip-room-core.cjs.entry.js +1 -1
- package/dist/cjs/taro-web-view-core.cjs.entry.js +2 -2
- package/dist/collection/components/audio/style/index.css +1 -4
- package/dist/collection/components/button/style/index.css +1 -160
- package/dist/collection/components/canvas/style/index.css +1 -6
- package/dist/collection/components/checkbox/style/index.css +1 -39
- package/dist/collection/components/cover-image/style/index.css +1 -5
- package/dist/collection/components/cover-view/style/cover-view.css +1 -3
- package/dist/collection/components/icon/icon.js +10 -0
- package/dist/collection/components/icon/style/index.css +1 -0
- package/dist/collection/components/image/image.js +4 -3
- package/dist/collection/components/image/style/index.css +1 -73
- package/dist/collection/components/input/input.js +2 -2
- package/dist/collection/components/input/style/index.css +1 -0
- package/dist/collection/components/movable-area/area.css +1 -6
- package/dist/collection/components/movable-area/view.css +1 -8
- package/dist/collection/components/navigator/style/index.css +1 -3
- package/dist/collection/components/picker/style/index.css +1 -4
- package/dist/collection/components/picker-view/style/column.css +1 -12
- package/dist/collection/components/picker-view/style/index.css +1 -28
- package/dist/collection/components/progress/progress.js +10 -0
- package/dist/collection/components/progress/style/index.css +1 -0
- package/dist/collection/components/pull-to-refresh/style/index.css +1 -52
- package/dist/collection/components/rich-text/style/index.css +1 -16
- package/dist/collection/components/scroll-view/style/index.css +1 -17
- package/dist/collection/components/slider/slider.js +10 -0
- package/dist/collection/components/slider/style/index.css +1 -0
- package/dist/collection/components/swiper/style/index.css +2 -19
- package/dist/collection/components/switch/style/index.css +1 -10
- package/dist/collection/components/switch/switch.js +12 -12
- package/dist/collection/components/tabbar/style/index.css +1 -53
- package/dist/collection/components/tabbar/tabbar.js +1 -1
- package/dist/collection/components/text/style/index.css +1 -26
- package/dist/collection/components/textarea/style/index.css +1 -22
- package/dist/collection/components/textarea/textarea.js +11 -0
- package/dist/collection/components/video/style/index.css +1 -327
- package/dist/collection/components/view/style/index.css +1 -9
- package/dist/collection/components/web-view/style/index.css +1 -12
- package/dist/components/taro-audio-core.js +1 -1
- package/dist/components/taro-button-core.js +1 -1
- package/dist/components/taro-canvas-core.js +1 -1
- package/dist/components/taro-checkbox-core.js +1 -1
- package/dist/components/taro-cover-image-core.js +1 -1
- package/dist/components/taro-icon-core.js +3 -0
- package/dist/components/taro-image-core.js +5 -4
- package/dist/components/taro-input-core.js +1 -1
- package/dist/components/taro-movable-area-core.js +1 -1
- package/dist/components/taro-movable-view-core.js +1 -1
- package/dist/components/taro-picker-core.js +1 -1
- package/dist/components/taro-picker-view-column-core.js +1 -1
- package/dist/components/taro-picker-view-core.js +1 -1
- package/dist/components/taro-progress-core.js +3 -0
- package/dist/components/taro-pull-to-refresh-core.js +1 -1
- package/dist/components/taro-rich-text-core.js +1 -1
- package/dist/components/taro-scroll-view-core.js +1 -1
- package/dist/components/taro-slider-core.js +3 -0
- package/dist/components/taro-swiper-core.js +5 -9853
- package/dist/components/taro-switch-core.js +13 -13
- package/dist/components/taro-tabbar.js +3 -76
- package/dist/components/taro-text-core.js +1 -1
- package/dist/components/taro-textarea-core.js +11 -2
- package/dist/components/taro-video-core.js +2 -2
- package/dist/components/taro-view-core.js +1 -1
- package/dist/components/taro-web-view-core.js +1 -1
- package/dist/esm/{index-6bb77c5f.js → index-486e187e.js} +3 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/taro-ad-core.entry.js +1 -1
- package/dist/esm/taro-ad-custom-core.entry.js +1 -1
- package/dist/esm/taro-animation-video-core.entry.js +1 -1
- package/dist/esm/taro-animation-view-core.entry.js +1 -1
- package/dist/esm/taro-ar-camera-core.entry.js +1 -1
- package/dist/esm/taro-audio-core.entry.js +2 -2
- package/dist/esm/taro-aweme-data-core.entry.js +1 -1
- package/dist/esm/taro-block-core.entry.js +1 -1
- package/dist/esm/taro-button-core.entry.js +3 -3
- package/dist/esm/taro-camera-core.entry.js +1 -1
- package/dist/esm/taro-canvas-core.entry.js +2 -2
- package/dist/esm/taro-channel-live-core.entry.js +1 -1
- package/dist/esm/taro-channel-video-core.entry.js +1 -1
- package/dist/esm/taro-checkbox-core_2.entry.js +2 -2
- package/dist/esm/taro-comment-detail-core.entry.js +1 -1
- package/dist/esm/taro-comment-list-core.entry.js +1 -1
- package/dist/esm/taro-components.js +3 -3
- package/dist/esm/taro-contact-button-core.entry.js +1 -1
- package/dist/esm/taro-cover-image-core.entry.js +2 -2
- package/dist/esm/taro-cover-view-core.entry.js +2 -2
- package/dist/esm/taro-custom-wrapper-core.entry.js +1 -1
- package/dist/esm/taro-editor-core.entry.js +1 -1
- package/dist/esm/taro-follow-swan-core.entry.js +1 -1
- package/dist/esm/taro-form-core.entry.js +1 -1
- package/dist/esm/taro-functional-page-navigator-core.entry.js +1 -1
- package/dist/esm/taro-grid-view-core.entry.js +1 -1
- package/dist/esm/taro-icon-core.entry.js +5 -2
- package/dist/esm/taro-image-core.entry.js +7 -6
- package/dist/esm/taro-inline-payment-panel-core.entry.js +1 -1
- package/dist/esm/taro-input-core.entry.js +2 -2
- package/dist/esm/taro-keyboard-accessory-core.entry.js +1 -1
- package/dist/esm/taro-label-core.entry.js +1 -1
- package/dist/esm/taro-lifestyle-core.entry.js +1 -1
- package/dist/esm/taro-like-core.entry.js +1 -1
- package/dist/esm/taro-list-view-core.entry.js +1 -1
- package/dist/esm/taro-live-player-core.entry.js +1 -1
- package/dist/esm/taro-live-pusher-core.entry.js +1 -1
- package/dist/esm/taro-login-core.entry.js +1 -1
- package/dist/esm/taro-lottie-core.entry.js +1 -1
- package/dist/esm/taro-map-core.entry.js +1 -1
- package/dist/esm/taro-match-media-core.entry.js +1 -1
- package/dist/esm/taro-movable-area-core_2.entry.js +4 -4
- package/dist/esm/taro-native-slot-core.entry.js +1 -1
- package/dist/esm/taro-navigation-bar-core.entry.js +1 -1
- package/dist/esm/taro-navigator-core.entry.js +2 -2
- package/dist/esm/taro-official-account-core.entry.js +1 -1
- package/dist/esm/taro-open-data-core.entry.js +1 -1
- package/dist/esm/taro-page-container-core.entry.js +1 -1
- package/dist/esm/taro-page-meta-core.entry.js +1 -1
- package/dist/esm/taro-picker-core_2.entry.js +3 -3
- package/dist/esm/taro-picker-view-column-core_2.entry.js +4 -4
- package/dist/esm/taro-progress-core.entry.js +4 -1
- package/dist/esm/taro-pull-to-refresh-core.entry.js +3 -3
- package/dist/esm/taro-radio-core_2.entry.js +1 -1
- package/dist/esm/taro-rich-text-core.entry.js +2 -2
- package/dist/esm/taro-root-portal-core.entry.js +1 -1
- package/dist/esm/taro-rtc-room-core.entry.js +1 -1
- package/dist/esm/taro-rtc-room-item-core.entry.js +1 -1
- package/dist/esm/taro-scroll-view-core.entry.js +3 -3
- package/dist/esm/taro-share-element-core.entry.js +1 -1
- package/dist/esm/taro-slider-core.entry.js +4 -1
- package/dist/esm/taro-slot-core.entry.js +1 -1
- package/dist/esm/taro-snapshot-core.entry.js +1 -1
- package/dist/esm/taro-sticky-header-core.entry.js +1 -1
- package/dist/esm/taro-sticky-section-core.entry.js +1 -1
- package/dist/esm/taro-swiper-core_2.entry.js +5 -9853
- package/dist/esm/taro-switch-core.entry.js +13 -12
- package/dist/esm/taro-tab-item-core.entry.js +1 -1
- package/dist/esm/taro-tabbar.entry.js +5 -78
- package/dist/esm/taro-tabs-core.entry.js +1 -1
- package/dist/esm/taro-text-core.entry.js +2 -2
- package/dist/esm/taro-textarea-core.entry.js +12 -3
- package/dist/esm/taro-video-control_3.entry.js +4 -4
- package/dist/esm/taro-view-core.entry.js +3 -3
- package/dist/esm/taro-voip-room-core.entry.js +1 -1
- package/dist/esm/taro-web-view-core.entry.js +2 -2
- package/dist/esm-es5/index-486e187e.js +2 -0
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/taro-ad-core.entry.js +1 -1
- package/dist/esm-es5/taro-ad-custom-core.entry.js +1 -1
- package/dist/esm-es5/taro-animation-video-core.entry.js +1 -1
- package/dist/esm-es5/taro-animation-view-core.entry.js +1 -1
- package/dist/esm-es5/taro-ar-camera-core.entry.js +1 -1
- package/dist/esm-es5/taro-audio-core.entry.js +1 -1
- package/dist/esm-es5/taro-aweme-data-core.entry.js +1 -1
- package/dist/esm-es5/taro-block-core.entry.js +1 -1
- package/dist/esm-es5/taro-button-core.entry.js +1 -1
- package/dist/esm-es5/taro-camera-core.entry.js +1 -1
- package/dist/esm-es5/taro-canvas-core.entry.js +1 -1
- package/dist/esm-es5/taro-channel-live-core.entry.js +1 -1
- package/dist/esm-es5/taro-channel-video-core.entry.js +1 -1
- package/dist/esm-es5/taro-checkbox-core_2.entry.js +1 -1
- package/dist/esm-es5/taro-comment-detail-core.entry.js +1 -1
- package/dist/esm-es5/taro-comment-list-core.entry.js +1 -1
- package/dist/esm-es5/taro-components.js +1 -1
- package/dist/esm-es5/taro-contact-button-core.entry.js +1 -1
- package/dist/esm-es5/taro-cover-image-core.entry.js +1 -1
- package/dist/esm-es5/taro-cover-view-core.entry.js +1 -1
- package/dist/esm-es5/taro-custom-wrapper-core.entry.js +1 -1
- package/dist/esm-es5/taro-editor-core.entry.js +1 -1
- package/dist/esm-es5/taro-follow-swan-core.entry.js +1 -1
- package/dist/esm-es5/taro-form-core.entry.js +1 -1
- package/dist/esm-es5/taro-functional-page-navigator-core.entry.js +1 -1
- package/dist/esm-es5/taro-grid-view-core.entry.js +1 -1
- package/dist/esm-es5/taro-icon-core.entry.js +1 -1
- package/dist/esm-es5/taro-image-core.entry.js +1 -1
- package/dist/esm-es5/taro-inline-payment-panel-core.entry.js +1 -1
- package/dist/esm-es5/taro-input-core.entry.js +1 -1
- package/dist/esm-es5/taro-keyboard-accessory-core.entry.js +1 -1
- package/dist/esm-es5/taro-label-core.entry.js +1 -1
- package/dist/esm-es5/taro-lifestyle-core.entry.js +1 -1
- package/dist/esm-es5/taro-like-core.entry.js +1 -1
- package/dist/esm-es5/taro-list-view-core.entry.js +1 -1
- package/dist/esm-es5/taro-live-player-core.entry.js +1 -1
- package/dist/esm-es5/taro-live-pusher-core.entry.js +1 -1
- package/dist/esm-es5/taro-login-core.entry.js +1 -1
- package/dist/esm-es5/taro-lottie-core.entry.js +1 -1
- package/dist/esm-es5/taro-map-core.entry.js +1 -1
- package/dist/esm-es5/taro-match-media-core.entry.js +1 -1
- package/dist/esm-es5/taro-movable-area-core_2.entry.js +1 -1
- package/dist/esm-es5/taro-native-slot-core.entry.js +1 -1
- package/dist/esm-es5/taro-navigation-bar-core.entry.js +1 -1
- package/dist/esm-es5/taro-navigator-core.entry.js +1 -1
- package/dist/esm-es5/taro-official-account-core.entry.js +1 -1
- package/dist/esm-es5/taro-open-data-core.entry.js +1 -1
- package/dist/esm-es5/taro-page-container-core.entry.js +1 -1
- package/dist/esm-es5/taro-page-meta-core.entry.js +1 -1
- package/dist/esm-es5/taro-picker-core_2.entry.js +1 -1
- package/dist/esm-es5/taro-picker-view-column-core_2.entry.js +1 -1
- package/dist/esm-es5/taro-progress-core.entry.js +1 -1
- package/dist/esm-es5/taro-pull-to-refresh-core.entry.js +1 -1
- package/dist/esm-es5/taro-radio-core_2.entry.js +1 -1
- package/dist/esm-es5/taro-rich-text-core.entry.js +1 -1
- package/dist/esm-es5/taro-root-portal-core.entry.js +1 -1
- package/dist/esm-es5/taro-rtc-room-core.entry.js +1 -1
- package/dist/esm-es5/taro-rtc-room-item-core.entry.js +1 -1
- package/dist/esm-es5/taro-scroll-view-core.entry.js +1 -1
- package/dist/esm-es5/taro-share-element-core.entry.js +1 -1
- package/dist/esm-es5/taro-slider-core.entry.js +1 -1
- package/dist/esm-es5/taro-slot-core.entry.js +1 -1
- package/dist/esm-es5/taro-snapshot-core.entry.js +1 -1
- package/dist/esm-es5/taro-sticky-header-core.entry.js +1 -1
- package/dist/esm-es5/taro-sticky-section-core.entry.js +1 -1
- package/dist/esm-es5/taro-swiper-core_2.entry.js +1 -1
- package/dist/esm-es5/taro-switch-core.entry.js +1 -1
- package/dist/esm-es5/taro-tab-item-core.entry.js +1 -1
- package/dist/esm-es5/taro-tabbar.entry.js +1 -1
- package/dist/esm-es5/taro-tabs-core.entry.js +1 -1
- package/dist/esm-es5/taro-text-core.entry.js +1 -1
- package/dist/esm-es5/taro-textarea-core.entry.js +1 -1
- package/dist/esm-es5/taro-video-control_3.entry.js +1 -1
- package/dist/esm-es5/taro-view-core.entry.js +1 -1
- package/dist/esm-es5/taro-voip-room-core.entry.js +1 -1
- package/dist/esm-es5/taro-web-view-core.entry.js +1 -1
- package/dist/taro-components/{p-23f15c7b.entry.js → p-00d05751.entry.js} +1 -1
- package/dist/taro-components/{p-635fe530.system.entry.js → p-014534ca.system.entry.js} +1 -1
- package/dist/taro-components/{p-03538d40.system.entry.js → p-015b3025.system.entry.js} +1 -1
- package/dist/taro-components/{p-c3c69a95.system.entry.js → p-02dd30fa.system.entry.js} +1 -1
- package/dist/taro-components/{p-8d797863.system.entry.js → p-040f15f2.system.entry.js} +1 -1
- package/dist/taro-components/p-06cf6b18.system.entry.js +1 -0
- package/dist/taro-components/{p-dea67974.system.entry.js → p-07e94301.system.entry.js} +1 -1
- package/dist/taro-components/{p-680ba5a1.system.entry.js → p-0cf04b3d.system.entry.js} +1 -1
- package/dist/taro-components/p-0e3d8ada.entry.js +1 -0
- package/dist/taro-components/p-101f49dd.entry.js +1 -0
- package/dist/taro-components/{p-3aaf0fb7.system.entry.js → p-10d3c795.system.entry.js} +1 -1
- package/dist/taro-components/{p-4ff6ad99.system.entry.js → p-114f89d6.system.entry.js} +1 -1
- package/dist/taro-components/p-1182efdd.system.entry.js +1 -0
- package/dist/taro-components/{p-2713fc1a.entry.js → p-128f9eb0.entry.js} +1 -1
- package/dist/taro-components/p-16954dd6.entry.js +1 -0
- package/dist/taro-components/p-170ce205.system.entry.js +1 -0
- package/dist/taro-components/{p-aa1ea71b.system.entry.js → p-1b42ba7e.system.entry.js} +1 -1
- package/dist/taro-components/p-1ced140d.entry.js +1 -0
- package/dist/taro-components/p-1d25f4e3.entry.js +1 -0
- package/dist/taro-components/{p-b4e3f72e.system.entry.js → p-1e3d7899.system.entry.js} +1 -1
- package/dist/taro-components/{p-25fffbbe.system.entry.js → p-1ee83d63.system.entry.js} +1 -1
- package/dist/taro-components/{p-3d7626a9.system.entry.js → p-2059cbc0.system.entry.js} +1 -1
- package/dist/taro-components/{p-32b41faa.system.entry.js → p-205a0692.system.entry.js} +1 -1
- package/dist/taro-components/{p-d86ce035.system.entry.js → p-25bbf4aa.system.entry.js} +1 -1
- package/dist/taro-components/{p-c968ea43.system.entry.js → p-26545e4e.system.entry.js} +1 -1
- package/dist/taro-components/{p-d8f78d99.system.entry.js → p-28bf8423.system.entry.js} +1 -1
- package/dist/taro-components/{p-72d7fae0.system.entry.js → p-290fd78b.system.entry.js} +1 -1
- package/dist/taro-components/p-2bbdbe9c.system.entry.js +1 -0
- package/dist/taro-components/{p-1c1d9be8.entry.js → p-2d6d4850.entry.js} +1 -1
- package/dist/taro-components/{p-0780df27.entry.js → p-2dea35fd.entry.js} +1 -1
- package/dist/taro-components/p-2f403f7f.entry.js +1 -0
- package/dist/taro-components/p-2f683899.entry.js +1 -0
- package/dist/taro-components/{p-139d64f1.entry.js → p-30623371.entry.js} +1 -1
- package/dist/taro-components/{p-fdccd9b3.system.entry.js → p-34933f34.system.entry.js} +1 -1
- package/dist/taro-components/{p-346162b4.system.entry.js → p-352b6b6b.system.entry.js} +1 -1
- package/dist/taro-components/{p-e7232d54.system.entry.js → p-35e96af8.system.entry.js} +1 -1
- package/dist/taro-components/{p-7de7d96c.entry.js → p-37593ce7.entry.js} +1 -1
- package/dist/taro-components/{p-175edd50.entry.js → p-387f300a.entry.js} +1 -1
- package/dist/taro-components/p-3afbae36.entry.js +1 -0
- package/dist/taro-components/p-3bd04d38.entry.js +1 -0
- package/dist/taro-components/{p-6e1f0e6d.system.entry.js → p-3ca9aa19.system.entry.js} +1 -1
- package/dist/taro-components/{p-810b9a86.system.entry.js → p-3d76b46e.system.entry.js} +1 -1
- package/dist/taro-components/p-3dadbe4c.system.entry.js +1 -0
- package/dist/taro-components/{p-1ac9622e.entry.js → p-3e9bf572.entry.js} +1 -1
- package/dist/taro-components/p-4408d796.entry.js +1 -0
- package/dist/taro-components/{p-222573ad.entry.js → p-445810cb.entry.js} +1 -1
- package/dist/taro-components/p-449f60fa.entry.js +1 -0
- package/dist/taro-components/p-46661961.entry.js +1 -0
- package/dist/taro-components/{p-c7679d57.entry.js → p-48e5ddaa.entry.js} +1 -1
- package/dist/taro-components/{p-20e38f24.entry.js → p-4928ee37.entry.js} +1 -1
- package/dist/taro-components/p-4cbd26dd.entry.js +1 -0
- package/dist/taro-components/p-4e4ac1fe.system.entry.js +1 -0
- package/dist/taro-components/{p-8c93f3e0.entry.js → p-4e4cc6ab.entry.js} +1 -1
- package/dist/taro-components/{p-6d1e33e1.system.entry.js → p-50e1ba06.system.entry.js} +1 -1
- package/dist/taro-components/{p-a7ecb97a.entry.js → p-510a69b3.entry.js} +1 -1
- package/dist/taro-components/p-5307637c.system.entry.js +1 -0
- package/dist/taro-components/{p-1d3ed211.system.entry.js → p-54941baf.system.entry.js} +1 -1
- package/dist/taro-components/{p-fbc2b53e.entry.js → p-55be4215.entry.js} +1 -1
- package/dist/taro-components/{p-3708575b.system.entry.js → p-578f19ea.system.entry.js} +1 -1
- package/dist/taro-components/{p-abd51173.system.entry.js → p-581e844d.system.entry.js} +1 -1
- package/dist/taro-components/{p-7ad33036.system.entry.js → p-5a1bb2d3.system.entry.js} +1 -1
- package/dist/taro-components/p-5bb60b5e.entry.js +1 -0
- package/dist/taro-components/p-600d9210.entry.js +1 -0
- package/dist/taro-components/p-6066e633.entry.js +1 -0
- package/dist/taro-components/p-61cb688a.entry.js +1 -0
- package/dist/taro-components/{p-747bdbaa.system.entry.js → p-6229bb7d.system.entry.js} +1 -1
- package/dist/taro-components/p-64f5abce.entry.js +1 -0
- package/dist/taro-components/p-67ff5a50.system.entry.js +1 -0
- package/dist/taro-components/{p-b2ad9709.entry.js → p-69e747dc.entry.js} +1 -1
- package/dist/taro-components/{p-cdd48677.system.js → p-6bbb639a.system.js} +2 -2
- package/dist/taro-components/{p-e769cea4.system.entry.js → p-6cf765b7.system.entry.js} +1 -1
- package/dist/taro-components/{p-eab8a6b0.entry.js → p-6e9d509a.entry.js} +1 -1
- package/dist/taro-components/p-6f027b85.entry.js +1 -0
- package/dist/taro-components/{p-d81577b8.system.entry.js → p-72b954ce.system.entry.js} +1 -1
- package/dist/taro-components/p-74129eac.entry.js +1 -0
- package/dist/taro-components/{p-c2259653.system.entry.js → p-74b1be20.system.entry.js} +1 -1
- package/dist/taro-components/{p-46a9adcf.system.entry.js → p-758e3319.system.entry.js} +1 -1
- package/dist/taro-components/{p-9c566d7d.system.entry.js → p-75b927b4.system.entry.js} +1 -1
- package/dist/taro-components/{p-79b675c8.entry.js → p-764cd497.entry.js} +1 -1
- package/dist/taro-components/{p-028ad016.system.entry.js → p-7b6f6526.system.entry.js} +1 -1
- package/dist/taro-components/p-7bd1345f.entry.js +1 -0
- package/dist/taro-components/{p-1411cd2e.system.entry.js → p-7cecf08e.system.entry.js} +1 -1
- package/dist/taro-components/{p-58d410c6.system.entry.js → p-7f084a29.system.entry.js} +1 -1
- package/dist/taro-components/{p-1eb875d0.system.entry.js → p-80106cc2.system.entry.js} +1 -1
- package/dist/taro-components/p-80278124.entry.js +1 -0
- package/dist/taro-components/p-83699a53.entry.js +1 -0
- package/dist/taro-components/{p-b94dcfbe.entry.js → p-846aa5ec.entry.js} +1 -1
- package/dist/taro-components/p-861834ce.entry.js +1 -0
- package/dist/taro-components/{p-f232cf02.entry.js → p-870e0d9d.entry.js} +1 -1
- package/dist/taro-components/{p-70c81b7e.entry.js → p-87422c88.entry.js} +1 -1
- package/dist/taro-components/{p-bbbe728b.system.entry.js → p-88c5f0eb.system.entry.js} +1 -1
- package/dist/taro-components/{p-f43ba9ed.entry.js → p-8b70fd1d.entry.js} +1 -1
- package/dist/taro-components/p-8d437a7f.entry.js +1 -0
- package/dist/taro-components/{p-475f9ed3.system.entry.js → p-8df92f90.system.entry.js} +1 -1
- package/dist/taro-components/p-8e45a207.system.entry.js +1 -0
- package/dist/taro-components/p-92daad3f.system.entry.js +1 -0
- package/dist/taro-components/{p-443fe754.system.entry.js → p-940d41e9.system.entry.js} +1 -1
- package/dist/taro-components/p-95058ee1.entry.js +1 -0
- package/dist/taro-components/p-95e88e0f.entry.js +1 -0
- package/dist/taro-components/{p-9f5ebe09.system.entry.js → p-9623f19c.system.entry.js} +1 -1
- package/dist/taro-components/{p-6f45f110.entry.js → p-970623a1.entry.js} +1 -1
- package/dist/taro-components/p-9890bb7b.entry.js +1 -0
- package/dist/taro-components/{p-7e90dfef.js → p-98b1fc13.js} +2 -2
- package/dist/taro-components/{p-67dcb636.system.entry.js → p-9937cf08.system.entry.js} +1 -1
- package/dist/taro-components/{p-3967311b.system.entry.js → p-9a5bfa2a.system.entry.js} +1 -1
- package/dist/taro-components/{p-fff30a48.entry.js → p-9b4e5578.entry.js} +1 -1
- package/dist/taro-components/p-9e138188.entry.js +1 -0
- package/dist/taro-components/p-a17b1a7e.entry.js +1 -0
- package/dist/taro-components/p-a197cbae.system.entry.js +1 -0
- package/dist/taro-components/p-a2a70581.system.entry.js +1 -0
- package/dist/taro-components/{p-35160fd2.entry.js → p-a61e195b.entry.js} +1 -1
- package/dist/taro-components/p-a972aa1d.system.js +1 -0
- package/dist/taro-components/{p-deff0bb8.entry.js → p-ae128150.entry.js} +1 -1
- package/dist/taro-components/{p-039e15a4.system.entry.js → p-b04cdd9a.system.entry.js} +1 -1
- package/dist/taro-components/p-b317674b.entry.js +1 -0
- package/dist/taro-components/p-b6694eb3.system.entry.js +1 -0
- package/dist/taro-components/{p-edb9e04e.system.entry.js → p-b8858af9.system.entry.js} +1 -1
- package/dist/taro-components/p-b8e2465a.entry.js +1 -0
- package/dist/taro-components/{p-2339a4d3.entry.js → p-b9f19e77.entry.js} +1 -1
- package/dist/taro-components/{p-4cc2e06e.entry.js → p-ba195b39.entry.js} +1 -1
- package/dist/taro-components/{p-0b6e9013.system.entry.js → p-ba50342b.system.entry.js} +1 -1
- package/dist/taro-components/{p-f8970571.entry.js → p-bb712e32.entry.js} +1 -1
- package/dist/taro-components/p-bb87373d.entry.js +1 -0
- package/dist/taro-components/{p-8b604d50.entry.js → p-bba220a9.entry.js} +1 -1
- package/dist/taro-components/{p-6d7165eb.system.entry.js → p-bcf5d78a.system.entry.js} +1 -1
- package/dist/taro-components/p-bdd7b5a9.entry.js +1 -0
- package/dist/taro-components/p-bdee068b.system.entry.js +1 -0
- package/dist/taro-components/p-bf0d2c21.system.entry.js +1 -0
- package/dist/taro-components/{p-6c48d884.entry.js → p-c0f710ae.entry.js} +1 -1
- package/dist/taro-components/p-c11fcb25.system.entry.js +1 -0
- package/dist/taro-components/p-caba17c6.system.entry.js +1 -0
- package/dist/taro-components/{p-1f88349b.entry.js → p-cbc19d63.entry.js} +1 -1
- package/dist/taro-components/{p-7dee8f07.system.entry.js → p-d03136d7.system.entry.js} +1 -1
- package/dist/taro-components/p-d36f8c4f.entry.js +1 -0
- package/dist/taro-components/p-d60b66c2.entry.js +1 -0
- package/dist/taro-components/{p-178cb282.system.entry.js → p-d78ab2de.system.entry.js} +1 -1
- package/dist/taro-components/{p-cd34c92e.system.entry.js → p-dbb47d14.system.entry.js} +1 -1
- package/dist/taro-components/p-dc6db06e.system.entry.js +1 -0
- package/dist/taro-components/p-dc98486d.entry.js +1 -0
- package/dist/taro-components/p-dca5e9ee.entry.js +1 -0
- package/dist/taro-components/{p-e487b8b4.system.entry.js → p-de3e1cee.system.entry.js} +1 -1
- package/dist/taro-components/p-e09e8b51.system.entry.js +1 -0
- package/dist/taro-components/{p-1c95795d.entry.js → p-e1c2e636.entry.js} +1 -1
- package/dist/taro-components/{p-48c52124.entry.js → p-e25c2a22.entry.js} +1 -1
- package/dist/taro-components/{p-345cb56f.entry.js → p-e26c787b.entry.js} +1 -1
- package/dist/taro-components/p-e457a83a.system.entry.js +1 -0
- package/dist/taro-components/{p-aae38fe8.entry.js → p-e7d82e00.entry.js} +1 -1
- package/dist/taro-components/{p-f094089c.system.entry.js → p-ebf38559.system.entry.js} +1 -1
- package/dist/taro-components/p-eeb6aeb5.system.entry.js +1 -0
- package/dist/taro-components/p-ef0aff29.entry.js +1 -0
- package/dist/taro-components/{p-feddde29.system.entry.js → p-f554428f.system.entry.js} +1 -1
- package/dist/taro-components/p-fd1d75db.entry.js +1 -0
- package/dist/taro-components/{p-18ea7e10.system.entry.js → p-ff7dfc5c.system.entry.js} +1 -1
- package/dist/taro-components/taro-components.css +1 -5
- package/dist/taro-components/taro-components.esm.js +1 -1
- package/dist/taro-components/taro-components.js +1 -1
- package/dist/types/components/switch/switch.d.ts +3 -3
- package/dist/types/components/textarea/textarea.d.ts +1 -0
- package/lib/react/react-component-lib/createComponent.js +3 -2
- package/lib/react/react-component-lib/createComponent.js.map +1 -1
- package/lib/react/react-component-lib/createOverlayComponent.js +1 -1
- package/lib/react/react-component-lib/utils/attachProps.d.ts +16 -7
- package/lib/react/react-component-lib/utils/attachProps.js +85 -9
- package/lib/react/react-component-lib/utils/attachProps.js.map +1 -1
- package/lib/react/react-component-lib/utils/index.js +1 -1
- package/lib/vue2/components-loader.js +1 -1
- package/package.json +12 -10
- package/types/Audio.d.ts +11 -11
- package/types/Button.d.ts +9 -9
- package/types/Canvas.d.ts +11 -11
- package/types/Checkbox.d.ts +8 -8
- package/types/CheckboxGroup.d.ts +3 -3
- package/types/CoverImage.d.ts +4 -4
- package/types/CoverView.d.ts +1 -1
- package/types/CustomWrapper.d.ts +1 -1
- package/types/Form.d.ts +4 -4
- package/types/Icon.d.ts +4 -4
- package/types/Image.d.ts +8 -8
- package/types/Input.d.ts +21 -17
- package/types/Label.d.ts +2 -2
- package/types/MovableArea.d.ts +2 -2
- package/types/MovableView.d.ts +18 -18
- package/types/NativeSlot.d.ts +1 -1
- package/types/Navigator.d.ts +8 -8
- package/types/Picker.d.ts +44 -28
- package/types/PickerView.d.ts +5 -1
- package/types/PickerViewColumn.d.ts +1 -1
- package/types/Progress.d.ts +13 -13
- package/types/Radio.d.ts +7 -7
- package/types/RadioGroup.d.ts +2 -2
- package/types/RichText.d.ts +5 -5
- package/types/ScrollView.d.ts +13 -13
- package/types/Slider.d.ts +18 -14
- package/types/Slot.d.ts +1 -1
- package/types/Swiper.d.ts +17 -17
- package/types/SwiperItem.d.ts +2 -2
- package/types/Switch.d.ts +11 -7
- package/types/Text.d.ts +4 -4
- package/types/Textarea.d.ts +17 -13
- package/types/Video.d.ts +30 -30
- package/types/View.d.ts +4 -4
- package/types/WebView.d.ts +4 -4
- package/types/common.d.ts +6 -1
- package/dist/cjs/hls-dfcad743.js +0 -25797
- package/dist/cjs/intersection-observer-dc4cfcef.js +0 -728
- package/dist/collection/components/input/index.css +0 -12
- package/dist/components/hls.js +0 -25795
- package/dist/components/intersection-observer.js +0 -726
- package/dist/esm/hls-268fc25b.js +0 -25795
- package/dist/esm/intersection-observer-8e4c7135.js +0 -726
- package/dist/esm-es5/hls-268fc25b.js +0 -1
- package/dist/esm-es5/index-6bb77c5f.js +0 -2
- package/dist/esm-es5/intersection-observer-8e4c7135.js +0 -1
- package/dist/taro-components/p-00113225.system.entry.js +0 -1
- package/dist/taro-components/p-0030841b.system.js +0 -1
- package/dist/taro-components/p-0910d414.entry.js +0 -1
- package/dist/taro-components/p-0e37fb54.entry.js +0 -1
- package/dist/taro-components/p-11c962b9.entry.js +0 -1
- package/dist/taro-components/p-1f36cd5f.entry.js +0 -1
- package/dist/taro-components/p-2145dccb.entry.js +0 -1
- package/dist/taro-components/p-215881b4.entry.js +0 -1
- package/dist/taro-components/p-277892fe.system.entry.js +0 -1
- package/dist/taro-components/p-27c756c5.system.entry.js +0 -1
- package/dist/taro-components/p-2aff4cdb.entry.js +0 -1
- package/dist/taro-components/p-2e2487bf.system.entry.js +0 -1
- package/dist/taro-components/p-332dc867.entry.js +0 -1
- package/dist/taro-components/p-333305e3.entry.js +0 -1
- package/dist/taro-components/p-37edf3f6.entry.js +0 -1
- package/dist/taro-components/p-3ad92100.system.entry.js +0 -1
- package/dist/taro-components/p-3b1d2d37.system.js +0 -1
- package/dist/taro-components/p-3cd71da3.system.entry.js +0 -1
- package/dist/taro-components/p-401743f9.system.entry.js +0 -1
- package/dist/taro-components/p-4aeb3859.system.entry.js +0 -1
- package/dist/taro-components/p-4d609ebb.system.entry.js +0 -1
- package/dist/taro-components/p-4d89b685.entry.js +0 -1
- package/dist/taro-components/p-527c55ca.entry.js +0 -1
- package/dist/taro-components/p-550c350a.entry.js +0 -1
- package/dist/taro-components/p-5b028f1b.js +0 -1
- package/dist/taro-components/p-619b9fe5.system.entry.js +0 -1
- package/dist/taro-components/p-6df6fd58.entry.js +0 -1
- package/dist/taro-components/p-6f5e162d.entry.js +0 -1
- package/dist/taro-components/p-70bd0541.entry.js +0 -1
- package/dist/taro-components/p-728b6f8f.system.entry.js +0 -1
- package/dist/taro-components/p-72f327e1.js +0 -1
- package/dist/taro-components/p-7b39971e.system.entry.js +0 -1
- package/dist/taro-components/p-7ba17143.entry.js +0 -1
- package/dist/taro-components/p-7be1f603.entry.js +0 -1
- package/dist/taro-components/p-817b319c.system.entry.js +0 -1
- package/dist/taro-components/p-907d2fe0.entry.js +0 -1
- package/dist/taro-components/p-93a3d6ee.entry.js +0 -1
- package/dist/taro-components/p-9c91aee3.system.entry.js +0 -1
- package/dist/taro-components/p-9e788d33.entry.js +0 -1
- package/dist/taro-components/p-9feeee0f.system.entry.js +0 -1
- package/dist/taro-components/p-a3dad439.entry.js +0 -1
- package/dist/taro-components/p-a4ea7a51.system.entry.js +0 -1
- package/dist/taro-components/p-a54735cb.entry.js +0 -1
- package/dist/taro-components/p-a5adbf15.system.entry.js +0 -1
- package/dist/taro-components/p-a744e7aa.entry.js +0 -1
- package/dist/taro-components/p-b1977132.entry.js +0 -1
- package/dist/taro-components/p-b3780eab.system.entry.js +0 -1
- package/dist/taro-components/p-b69bcd43.entry.js +0 -1
- package/dist/taro-components/p-b9c2a210.system.entry.js +0 -1
- package/dist/taro-components/p-bb454378.entry.js +0 -1
- package/dist/taro-components/p-bd6574cf.entry.js +0 -1
- package/dist/taro-components/p-bfea77f9.entry.js +0 -1
- package/dist/taro-components/p-c0a59843.entry.js +0 -1
- package/dist/taro-components/p-cb21f4f1.entry.js +0 -1
- package/dist/taro-components/p-cd0f3444.entry.js +0 -1
- package/dist/taro-components/p-d42968e9.system.entry.js +0 -1
- package/dist/taro-components/p-d55f870d.entry.js +0 -1
- package/dist/taro-components/p-daabfc6e.entry.js +0 -1
- package/dist/taro-components/p-dda03c84.entry.js +0 -1
- package/dist/taro-components/p-e6e3c1d7.entry.js +0 -1
- package/dist/taro-components/p-e82e16a1.entry.js +0 -1
- package/dist/taro-components/p-ee4da4db.system.js +0 -1
- package/dist/taro-components/p-f003caad.entry.js +0 -1
- package/dist/taro-components/p-f111303f.entry.js +0 -1
- package/dist/taro-components/p-f75d094e.system.entry.js +0 -1
- package/dist/taro-components/p-fbec1f96.entry.js +0 -1
- package/lib/react/node_modules/.pnpm/tslib@2.6.2/node_modules/tslib/tslib.es6.js +0 -373
- package/lib/react/node_modules/.pnpm/tslib@2.6.2/node_modules/tslib/tslib.es6.js.map +0 -1
- /package/dist/cjs/{index-b8c435ee.js → index-f6805218.js} +0 -0
- /package/dist/esm/{index-a74b6944.js → index-c3e4004b.js} +0 -0
- /package/dist/esm-es5/{index-a74b6944.js → index-c3e4004b.js} +0 -0
- /package/dist/taro-components/{p-34de4101.system.js → p-2ec68968.system.js} +0 -0
- /package/dist/taro-components/{p-19f218e6.js → p-de951a46.js} +0 -0
- /package/lib/vue2/node_modules/.pnpm/{vue-fragment@1.6.0_vue@2.7.15 → registry.npmjs.org_vue-fragment@1.6.0_vue@2.7.14}/node_modules/vue-fragment/dist/vue-fragment.esm.js +0 -0
- /package/lib/vue2/node_modules/.pnpm/{vue-fragment@1.6.0_vue@2.7.15 → registry.npmjs.org_vue-fragment@1.6.0_vue@2.7.14}/node_modules/vue-fragment/dist/vue-fragment.esm.js.map +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var __extends=this&&this.__extends||function(){var t=function(e,r){t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r))t[r]=e[r]};return t(e,r)};return function(e,r){if(typeof r!=="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function i(){this.constructor=e}e.prototype=r===null?Object.create(r):(i.prototype=r.prototype,new i)}}();var __spreadArray=this&&this.__spreadArray||function(t,e,r){if(r||arguments.length===2)for(var i=0,a=e.length,n;i<a;i++){if(n||!(i in e)){if(!n)n=Array.prototype.slice.call(e,0,i);n[i]=e[i]}}return t.concat(n||Array.prototype.slice.call(e))};System.register([],(function(t){"use strict";return{execute:function(){function e(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t["default"]:t}var r={exports:{}};(function(t,e){(function(e){var r=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/;var i=/^(?=([^\/?#]*))\1([^]*)$/;var a=/(?:\/|^)\.(?=\/)/g;var n=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g;var s={buildAbsoluteURL:function(t,e,r){r=r||{};t=t.trim();e=e.trim();if(!e){if(!r.alwaysNormalize){return t}var a=s.parseURL(t);if(!a){throw new Error("Error trying to parse base URL.")}a.path=s.normalizePath(a.path);return s.buildURLFromParts(a)}var n=s.parseURL(e);if(!n){throw new Error("Error trying to parse relative URL.")}if(n.scheme){if(!r.alwaysNormalize){return e}n.path=s.normalizePath(n.path);return s.buildURLFromParts(n)}var o=s.parseURL(t);if(!o){throw new Error("Error trying to parse base URL.")}if(!o.netLoc&&o.path&&o.path[0]!=="/"){var l=i.exec(o.path);o.netLoc=l[1];o.path=l[2]}if(o.netLoc&&!o.path){o.path="/"}var u={scheme:o.scheme,netLoc:n.netLoc,path:null,params:n.params,query:n.query,fragment:n.fragment};if(!n.netLoc){u.netLoc=o.netLoc;if(n.path[0]!=="/"){if(!n.path){u.path=o.path;if(!n.params){u.params=o.params;if(!n.query){u.query=o.query}}}else{var f=o.path;var c=f.substring(0,f.lastIndexOf("/")+1)+n.path;u.path=s.normalizePath(c)}}}if(u.path===null){u.path=r.alwaysNormalize?s.normalizePath(n.path):n.path}return s.buildURLFromParts(u)},parseURL:function(t){var e=r.exec(t);if(!e){return null}return{scheme:e[1]||"",netLoc:e[2]||"",path:e[3]||"",params:e[4]||"",query:e[5]||"",fragment:e[6]||""}},normalizePath:function(t){t=t.split("").reverse().join("").replace(a,"");while(t.length!==(t=t.replace(n,"")).length){}return t.split("").reverse().join("")},buildURLFromParts:function(t){return t.scheme+t.netLoc+t.path+t.params+t.query+t.fragment}};t.exports=s})()})(r);var i=r.exports;function a(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,i)}return r}function n(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?a(Object(r),!0).forEach((function(e){s(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function s(t,e,r){e=u(e);if(e in t){Object.defineProperty(t,e,{value:r,enumerable:true,configurable:true,writable:true})}else{t[e]=r}return t}function o(){o=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var i in r){if(Object.prototype.hasOwnProperty.call(r,i)){t[i]=r[i]}}}return t};return o.apply(this,arguments)}function l(t,e){if(typeof t!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==undefined){var i=r.call(t,e||"default");if(typeof i!=="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function u(t){var e=l(t,"string");return typeof e==="symbol"?e:String(e)}var f=Number.isFinite||function(t){return typeof t==="number"&&isFinite(t)};var c=Number.isSafeInteger||function(t){return typeof t==="number"&&Math.abs(t)<=d};var d=Number.MAX_SAFE_INTEGER||9007199254740991;var h=function(t){t["MEDIA_ATTACHING"]="hlsMediaAttaching";t["MEDIA_ATTACHED"]="hlsMediaAttached";t["MEDIA_DETACHING"]="hlsMediaDetaching";t["MEDIA_DETACHED"]="hlsMediaDetached";t["BUFFER_RESET"]="hlsBufferReset";t["BUFFER_CODECS"]="hlsBufferCodecs";t["BUFFER_CREATED"]="hlsBufferCreated";t["BUFFER_APPENDING"]="hlsBufferAppending";t["BUFFER_APPENDED"]="hlsBufferAppended";t["BUFFER_EOS"]="hlsBufferEos";t["BUFFER_FLUSHING"]="hlsBufferFlushing";t["BUFFER_FLUSHED"]="hlsBufferFlushed";t["MANIFEST_LOADING"]="hlsManifestLoading";t["MANIFEST_LOADED"]="hlsManifestLoaded";t["MANIFEST_PARSED"]="hlsManifestParsed";t["LEVEL_SWITCHING"]="hlsLevelSwitching";t["LEVEL_SWITCHED"]="hlsLevelSwitched";t["LEVEL_LOADING"]="hlsLevelLoading";t["LEVEL_LOADED"]="hlsLevelLoaded";t["LEVEL_UPDATED"]="hlsLevelUpdated";t["LEVEL_PTS_UPDATED"]="hlsLevelPtsUpdated";t["LEVELS_UPDATED"]="hlsLevelsUpdated";t["AUDIO_TRACKS_UPDATED"]="hlsAudioTracksUpdated";t["AUDIO_TRACK_SWITCHING"]="hlsAudioTrackSwitching";t["AUDIO_TRACK_SWITCHED"]="hlsAudioTrackSwitched";t["AUDIO_TRACK_LOADING"]="hlsAudioTrackLoading";t["AUDIO_TRACK_LOADED"]="hlsAudioTrackLoaded";t["SUBTITLE_TRACKS_UPDATED"]="hlsSubtitleTracksUpdated";t["SUBTITLE_TRACKS_CLEARED"]="hlsSubtitleTracksCleared";t["SUBTITLE_TRACK_SWITCH"]="hlsSubtitleTrackSwitch";t["SUBTITLE_TRACK_LOADING"]="hlsSubtitleTrackLoading";t["SUBTITLE_TRACK_LOADED"]="hlsSubtitleTrackLoaded";t["SUBTITLE_FRAG_PROCESSED"]="hlsSubtitleFragProcessed";t["CUES_PARSED"]="hlsCuesParsed";t["NON_NATIVE_TEXT_TRACKS_FOUND"]="hlsNonNativeTextTracksFound";t["INIT_PTS_FOUND"]="hlsInitPtsFound";t["FRAG_LOADING"]="hlsFragLoading";t["FRAG_LOAD_EMERGENCY_ABORTED"]="hlsFragLoadEmergencyAborted";t["FRAG_LOADED"]="hlsFragLoaded";t["FRAG_DECRYPTED"]="hlsFragDecrypted";t["FRAG_PARSING_INIT_SEGMENT"]="hlsFragParsingInitSegment";t["FRAG_PARSING_USERDATA"]="hlsFragParsingUserdata";t["FRAG_PARSING_METADATA"]="hlsFragParsingMetadata";t["FRAG_PARSED"]="hlsFragParsed";t["FRAG_BUFFERED"]="hlsFragBuffered";t["FRAG_CHANGED"]="hlsFragChanged";t["FPS_DROP"]="hlsFpsDrop";t["FPS_DROP_LEVEL_CAPPING"]="hlsFpsDropLevelCapping";t["ERROR"]="hlsError";t["DESTROYING"]="hlsDestroying";t["KEY_LOADING"]="hlsKeyLoading";t["KEY_LOADED"]="hlsKeyLoaded";t["LIVE_BACK_BUFFER_REACHED"]="hlsLiveBackBufferReached";t["BACK_BUFFER_REACHED"]="hlsBackBufferReached";return t}({});var v=function(t){t["NETWORK_ERROR"]="networkError";t["MEDIA_ERROR"]="mediaError";t["KEY_SYSTEM_ERROR"]="keySystemError";t["MUX_ERROR"]="muxError";t["OTHER_ERROR"]="otherError";return t}({});var p=function(t){t["KEY_SYSTEM_NO_KEYS"]="keySystemNoKeys";t["KEY_SYSTEM_NO_ACCESS"]="keySystemNoAccess";t["KEY_SYSTEM_NO_SESSION"]="keySystemNoSession";t["KEY_SYSTEM_NO_CONFIGURED_LICENSE"]="keySystemNoConfiguredLicense";t["KEY_SYSTEM_LICENSE_REQUEST_FAILED"]="keySystemLicenseRequestFailed";t["KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED"]="keySystemServerCertificateRequestFailed";t["KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED"]="keySystemServerCertificateUpdateFailed";t["KEY_SYSTEM_SESSION_UPDATE_FAILED"]="keySystemSessionUpdateFailed";t["KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED"]="keySystemStatusOutputRestricted";t["KEY_SYSTEM_STATUS_INTERNAL_ERROR"]="keySystemStatusInternalError";t["MANIFEST_LOAD_ERROR"]="manifestLoadError";t["MANIFEST_LOAD_TIMEOUT"]="manifestLoadTimeOut";t["MANIFEST_PARSING_ERROR"]="manifestParsingError";t["MANIFEST_INCOMPATIBLE_CODECS_ERROR"]="manifestIncompatibleCodecsError";t["LEVEL_EMPTY_ERROR"]="levelEmptyError";t["LEVEL_LOAD_ERROR"]="levelLoadError";t["LEVEL_LOAD_TIMEOUT"]="levelLoadTimeOut";t["LEVEL_PARSING_ERROR"]="levelParsingError";t["LEVEL_SWITCH_ERROR"]="levelSwitchError";t["AUDIO_TRACK_LOAD_ERROR"]="audioTrackLoadError";t["AUDIO_TRACK_LOAD_TIMEOUT"]="audioTrackLoadTimeOut";t["SUBTITLE_LOAD_ERROR"]="subtitleTrackLoadError";t["SUBTITLE_TRACK_LOAD_TIMEOUT"]="subtitleTrackLoadTimeOut";t["FRAG_LOAD_ERROR"]="fragLoadError";t["FRAG_LOAD_TIMEOUT"]="fragLoadTimeOut";t["FRAG_DECRYPT_ERROR"]="fragDecryptError";t["FRAG_PARSING_ERROR"]="fragParsingError";t["FRAG_GAP"]="fragGap";t["REMUX_ALLOC_ERROR"]="remuxAllocError";t["KEY_LOAD_ERROR"]="keyLoadError";t["KEY_LOAD_TIMEOUT"]="keyLoadTimeOut";t["BUFFER_ADD_CODEC_ERROR"]="bufferAddCodecError";t["BUFFER_INCOMPATIBLE_CODECS_ERROR"]="bufferIncompatibleCodecsError";t["BUFFER_APPEND_ERROR"]="bufferAppendError";t["BUFFER_APPENDING_ERROR"]="bufferAppendingError";t["BUFFER_STALLED_ERROR"]="bufferStalledError";t["BUFFER_FULL_ERROR"]="bufferFullError";t["BUFFER_SEEK_OVER_HOLE"]="bufferSeekOverHole";t["BUFFER_NUDGE_ON_STALL"]="bufferNudgeOnStall";t["INTERNAL_EXCEPTION"]="internalException";t["INTERNAL_ABORTED"]="aborted";t["UNKNOWN"]="unknown";return t}({});var g=function t(){};var m={trace:g,debug:g,log:g,warn:g,info:g,error:g};var y=m;function T(t){var e=self.console[t];if(e){return e.bind(self.console,"[".concat(t,"] >"))}return g}function E(t){var e=[];for(var r=1;r<arguments.length;r++){e[r-1]=arguments[r]}e.forEach((function(e){y[e]=t[e]?t[e].bind(t):T(e)}))}function S(t,e){if(self.console&&t===true||typeof t==="object"){E(t,"debug","log","info","warn","error");try{y.log('Debug logs enabled for "'.concat(e,'" in hls.js version ').concat("1.4.13"))}catch(t){y=m}}else{y=m}}var A=y;var L=/^(\d+)x(\d+)$/;var b=/(.+?)=(".*?"|.*?)(?:,|$)/g;var R=function(){function t(e){if(typeof e==="string"){e=t.parseAttrList(e)}for(var r in e){if(e.hasOwnProperty(r)){if(r.substring(0,2)==="X-"){this.clientAttrs=this.clientAttrs||[];this.clientAttrs.push(r)}this[r]=e[r]}}}t.prototype.decimalInteger=function(t){var e=parseInt(this[t],10);if(e>Number.MAX_SAFE_INTEGER){return Infinity}return e};t.prototype.hexadecimalInteger=function(t){if(this[t]){var e=(this[t]||"0x").slice(2);e=(e.length&1?"0":"")+e;var r=new Uint8Array(e.length/2);for(var i=0;i<e.length/2;i++){r[i]=parseInt(e.slice(i*2,i*2+2),16)}return r}else{return null}};t.prototype.hexadecimalIntegerAsNumber=function(t){var e=parseInt(this[t],16);if(e>Number.MAX_SAFE_INTEGER){return Infinity}return e};t.prototype.decimalFloatingPoint=function(t){return parseFloat(this[t])};t.prototype.optionalFloat=function(t,e){var r=this[t];return r?parseFloat(r):e};t.prototype.enumeratedString=function(t){return this[t]};t.prototype.bool=function(t){return this[t]==="YES"};t.prototype.decimalResolution=function(t){var e=L.exec(this[t]);if(e===null){return undefined}return{width:parseInt(e[1],10),height:parseInt(e[2],10)}};t.parseAttrList=function(t){var e;var r={};var i='"';b.lastIndex=0;while((e=b.exec(t))!==null){var a=e[2];if(a.indexOf(i)===0&&a.lastIndexOf(i)===a.length-1){a=a.slice(1,-1)}var n=e[1].trim();r[n]=a}return r};return t}();function I(t){return t!=="ID"&&t!=="CLASS"&&t!=="START-DATE"&&t!=="DURATION"&&t!=="END-DATE"&&t!=="END-ON-NEXT"}function D(t){return t==="SCTE35-OUT"||t==="SCTE35-IN"}var k=function(){function t(t,e){this.attr=void 0;this._startDate=void 0;this._endDate=void 0;this._badValueForSameId=void 0;if(e){var r=e.attr;for(var i in r){if(Object.prototype.hasOwnProperty.call(t,i)&&t[i]!==r[i]){A.warn('DATERANGE tag attribute: "'.concat(i,'" does not match for tags with ID: "').concat(t.ID,'"'));this._badValueForSameId=i;break}}t=o(new R({}),r,t)}this.attr=t;this._startDate=new Date(t["START-DATE"]);if("END-DATE"in this.attr){var a=new Date(this.attr["END-DATE"]);if(f(a.getTime())){this._endDate=a}}}Object.defineProperty(t.prototype,"id",{get:function(){return this.attr.ID},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"class",{get:function(){return this.attr.CLASS},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"startDate",{get:function(){return this._startDate},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"endDate",{get:function(){if(this._endDate){return this._endDate}var t=this.duration;if(t!==null){return new Date(this._startDate.getTime()+t*1e3)}return null},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"duration",{get:function(){if("DURATION"in this.attr){var t=this.attr.decimalFloatingPoint("DURATION");if(f(t)){return t}}else if(this._endDate){return(this._endDate.getTime()-this._startDate.getTime())/1e3}return null},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"plannedDuration",{get:function(){if("PLANNED-DURATION"in this.attr){return this.attr.decimalFloatingPoint("PLANNED-DURATION")}return null},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"endOnNext",{get:function(){return this.attr.bool("END-ON-NEXT")},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"isValid",{get:function(){return!!this.id&&!this._badValueForSameId&&f(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)},enumerable:false,configurable:true});return t}();var _=function(){function t(){this.aborted=false;this.loaded=0;this.retry=0;this.total=0;this.chunkCount=0;this.bwEstimate=0;this.loading={start:0,first:0,end:0};this.parsing={start:0,end:0};this.buffering={start:0,first:0,end:0}}return t}();var w={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};var C=function(){function t(t){var e;this._byteRange=null;this._url=null;this.baseurl=void 0;this.relurl=void 0;this.elementaryStreams=(e={},e[w.AUDIO]=null,e[w.VIDEO]=null,e[w.AUDIOVIDEO]=null,e);this.baseurl=t}t.prototype.setByteRange=function(t,e){var r=t.split("@",2);var i=[];if(r.length===1){i[0]=e?e.byteRangeEndOffset:0}else{i[0]=parseInt(r[1])}i[1]=parseInt(r[0])+i[0];this._byteRange=i};Object.defineProperty(t.prototype,"byteRange",{get:function(){if(!this._byteRange){return[]}return this._byteRange},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"byteRangeStartOffset",{get:function(){return this.byteRange[0]},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"byteRangeEndOffset",{get:function(){return this.byteRange[1]},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"url",{get:function(){if(!this._url&&this.baseurl&&this.relurl){this._url=i.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:true})}return this._url||""},set:function(t){this._url=t},enumerable:false,configurable:true});return t}();var P=function(t){__extends(e,t);function e(e,r){var i=t.call(this,r)||this;i._decryptdata=null;i.rawProgramDateTime=null;i.programDateTime=null;i.tagList=[];i.duration=0;i.sn=0;i.levelkeys=void 0;i.type=void 0;i.loader=null;i.keyLoader=null;i.level=-1;i.cc=0;i.startPTS=void 0;i.endPTS=void 0;i.startDTS=void 0;i.endDTS=void 0;i.start=0;i.deltaPTS=void 0;i.maxStartPTS=void 0;i.minEndPTS=void 0;i.stats=new _;i.urlId=0;i.data=void 0;i.bitrateTest=false;i.title=null;i.initSegment=null;i.endList=void 0;i.gap=void 0;i.type=e;return i}Object.defineProperty(e.prototype,"decryptdata",{get:function(){var t=this.levelkeys;if(!t&&!this._decryptdata){return null}if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){var e=this.levelkeys.identity;if(e){this._decryptdata=e.getDecryptData(this.sn)}else{var r=Object.keys(this.levelkeys);if(r.length===1){return this._decryptdata=this.levelkeys[r[0]].getDecryptData(this.sn)}}}return this._decryptdata},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"end",{get:function(){return this.start+this.duration},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"endProgramDateTime",{get:function(){if(this.programDateTime===null){return null}if(!f(this.programDateTime)){return null}var t=!f(this.duration)?0:this.duration;return this.programDateTime+t*1e3},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"encrypted",{get:function(){var t;if((t=this._decryptdata)!=null&&t.encrypted){return true}else if(this.levelkeys){var e=Object.keys(this.levelkeys);var r=e.length;if(r>1||r===1&&this.levelkeys[e[0]].encrypted){return true}}return false},enumerable:false,configurable:true});e.prototype.setKeyFormat=function(t){if(this.levelkeys){var e=this.levelkeys[t];if(e&&!this._decryptdata){this._decryptdata=e.getDecryptData(this.sn)}}};e.prototype.abortRequests=function(){var t,e;(t=this.loader)==null?void 0:t.abort();(e=this.keyLoader)==null?void 0:e.abort()};e.prototype.setElementaryStreamInfo=function(t,e,r,i,a,n){if(n===void 0){n=false}var s=this.elementaryStreams;var o=s[t];if(!o){s[t]={startPTS:e,endPTS:r,startDTS:i,endDTS:a,partial:n};return}o.startPTS=Math.min(o.startPTS,e);o.endPTS=Math.max(o.endPTS,r);o.startDTS=Math.min(o.startDTS,i);o.endDTS=Math.max(o.endDTS,a)};e.prototype.clearElementaryStreamInfo=function(){var t=this.elementaryStreams;t[w.AUDIO]=null;t[w.VIDEO]=null;t[w.AUDIOVIDEO]=null};return e}(C);var O=function(t){__extends(e,t);function e(e,r,i,a,n){var s=t.call(this,i)||this;s.fragOffset=0;s.duration=0;s.gap=false;s.independent=false;s.relurl=void 0;s.fragment=void 0;s.index=void 0;s.stats=new _;s.duration=e.decimalFloatingPoint("DURATION");s.gap=e.bool("GAP");s.independent=e.bool("INDEPENDENT");s.relurl=e.enumeratedString("URI");s.fragment=r;s.index=a;var o=e.enumeratedString("BYTERANGE");if(o){s.setByteRange(o,n)}if(n){s.fragOffset=n.fragOffset+n.duration}return s}Object.defineProperty(e.prototype,"start",{get:function(){return this.fragment.start+this.fragOffset},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"end",{get:function(){return this.start+this.duration},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"loaded",{get:function(){var t=this.elementaryStreams;return!!(t.audio||t.video||t.audiovideo)},enumerable:false,configurable:true});return e}(C);var x=10;var F=function(){function t(t){this.PTSKnown=false;this.alignedSliding=false;this.averagetargetduration=void 0;this.endCC=0;this.endSN=0;this.fragments=void 0;this.fragmentHint=void 0;this.partList=null;this.dateRanges=void 0;this.live=true;this.ageHeader=0;this.advancedDateTime=void 0;this.updated=true;this.advanced=true;this.availabilityDelay=void 0;this.misses=0;this.startCC=0;this.startSN=0;this.startTimeOffset=null;this.targetduration=0;this.totalduration=0;this.type=null;this.url=void 0;this.m3u8="";this.version=null;this.canBlockReload=false;this.canSkipUntil=0;this.canSkipDateRanges=false;this.skippedSegments=0;this.recentlyRemovedDateranges=void 0;this.partHoldBack=0;this.holdBack=0;this.partTarget=0;this.preloadHint=void 0;this.renditionReports=void 0;this.tuneInGoal=0;this.deltaUpdateFailed=void 0;this.driftStartTime=0;this.driftEndTime=0;this.driftStart=0;this.driftEnd=0;this.encryptedFragments=void 0;this.playlistParsingError=null;this.variableList=null;this.hasVariableRefs=false;this.fragments=[];this.encryptedFragments=[];this.dateRanges={};this.url=t}t.prototype.reloaded=function(t){if(!t){this.advanced=true;this.updated=true;return}var e=this.lastPartSn-t.lastPartSn;var r=this.lastPartIndex-t.lastPartIndex;this.updated=this.endSN!==t.endSN||!!r||!!e||!this.live;this.advanced=this.endSN>t.endSN||e>0||e===0&&r>0;if(this.updated||this.advanced){this.misses=Math.floor(t.misses*.6)}else{this.misses=t.misses+1}this.availabilityDelay=t.availabilityDelay};Object.defineProperty(t.prototype,"hasProgramDateTime",{get:function(){if(this.fragments.length){return f(this.fragments[this.fragments.length-1].programDateTime)}return false},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"levelTargetDuration",{get:function(){return this.averagetargetduration||this.targetduration||x},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"drift",{get:function(){var t=this.driftEndTime-this.driftStartTime;if(t>0){var e=this.driftEnd-this.driftStart;return e*1e3/t}return 1},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"edge",{get:function(){return this.partEnd||this.fragmentEnd},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"partEnd",{get:function(){var t;if((t=this.partList)!=null&&t.length){return this.partList[this.partList.length-1].end}return this.fragmentEnd},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"fragmentEnd",{get:function(){var t;if((t=this.fragments)!=null&&t.length){return this.fragments[this.fragments.length-1].end}return 0},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"age",{get:function(){if(this.advancedDateTime){return Math.max(Date.now()-this.advancedDateTime,0)/1e3}return 0},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"lastPartIndex",{get:function(){var t;if((t=this.partList)!=null&&t.length){return this.partList[this.partList.length-1].index}return-1},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"lastPartSn",{get:function(){var t;if((t=this.partList)!=null&&t.length){return this.partList[this.partList.length-1].fragment.sn}return this.endSN},enumerable:false,configurable:true});return t}();function M(t){return Uint8Array.from(atob(t),(function(t){return t.charCodeAt(0)}))}function N(t){var e=G(t).subarray(0,16);var r=new Uint8Array(16);r.set(e,16-e.length);return r}function U(t){var e=function t(e,r,i){var a=e[r];e[r]=e[i];e[i]=a};e(t,0,3);e(t,1,2);e(t,4,5);e(t,6,7)}function B(t){var e=t.split(":");var r=null;if(e[0]==="data"&&e.length===2){var i=e[1].split(";");var a=i[i.length-1].split(",");if(a.length===2){var n=a[0]==="base64";var s=a[1];if(n){i.splice(-1,1);r=M(s)}else{r=N(s)}}}return r}function G(t){return Uint8Array.from(unescape(encodeURIComponent(t)),(function(t){return t.charCodeAt(0)}))}var K={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"};var H={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function V(t){switch(t){case H.FAIRPLAY:return K.FAIRPLAY;case H.PLAYREADY:return K.PLAYREADY;case H.WIDEVINE:return K.WIDEVINE;case H.CLEARKEY:return K.CLEARKEY}}var j={WIDEVINE:"edef8ba979d64acea3c827dcd51d21ed"};function Y(t){if(t===j.WIDEVINE){return K.WIDEVINE}}function W(t){switch(t){case K.FAIRPLAY:return H.FAIRPLAY;case K.PLAYREADY:return H.PLAYREADY;case K.WIDEVINE:return H.WIDEVINE;case K.CLEARKEY:return H.CLEARKEY}}function q(t){var e=t.drmSystems,r=t.widevineLicenseUrl;var i=e?[K.FAIRPLAY,K.WIDEVINE,K.PLAYREADY,K.CLEARKEY].filter((function(t){return!!e[t]})):[];if(!i[K.WIDEVINE]&&r){i.push(K.WIDEVINE)}return i}var X=function(){if(typeof self!=="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess){return self.navigator.requestMediaKeySystemAccess.bind(self.navigator)}else{return null}}();function z(t,e,r,i){var a;switch(t){case K.FAIRPLAY:a=["cenc","sinf"];break;case K.WIDEVINE:case K.PLAYREADY:a=["cenc"];break;case K.CLEARKEY:a=["cenc","keyids"];break;default:throw new Error("Unknown key-system: ".concat(t))}return Q(a,e,r,i)}function Q(t,e,r,i){var a={initDataTypes:t,persistentState:i.persistentState||"not-allowed",distinctiveIdentifier:i.distinctiveIdentifier||"not-allowed",sessionTypes:i.sessionTypes||[i.sessionType||"temporary"],audioCapabilities:e.map((function(t){return{contentType:'audio/mp4; codecs="'.concat(t,'"'),robustness:i.audioRobustness||"",encryptionScheme:i.audioEncryptionScheme||null}})),videoCapabilities:r.map((function(t){return{contentType:'video/mp4; codecs="'.concat(t,'"'),robustness:i.videoRobustness||"",encryptionScheme:i.videoEncryptionScheme||null}}))};return[a]}function $(t,e,r){return Uint8Array.prototype.slice?t.slice(e,r):new Uint8Array(Array.prototype.slice.call(t,e,r))}var J=function(t,e){if(e+10<=t.length){if(t[e]===73&&t[e+1]===68&&t[e+2]===51){if(t[e+3]<255&&t[e+4]<255){if(t[e+6]<128&&t[e+7]<128&&t[e+8]<128&&t[e+9]<128){return true}}}}return false};var Z=function(t,e){if(e+10<=t.length){if(t[e]===51&&t[e+1]===68&&t[e+2]===73){if(t[e+3]<255&&t[e+4]<255){if(t[e+6]<128&&t[e+7]<128&&t[e+8]<128&&t[e+9]<128){return true}}}}return false};var tt=function(t,e){var r=e;var i=0;while(J(t,e)){i+=10;var a=et(t,e+6);i+=a;if(Z(t,e+10)){i+=10}e+=i}if(i>0){return t.subarray(r,r+i)}return undefined};var et=function(t,e){var r=0;r=(t[e]&127)<<21;r|=(t[e+1]&127)<<14;r|=(t[e+2]&127)<<7;r|=t[e+3]&127;return r};var rt=function(t,e){return J(t,e)&&et(t,e+6)+10<=t.length-e};var it=function(t){var e=st(t);for(var r=0;r<e.length;r++){var i=e[r];if(at(i)){return ct(i)}}return undefined};var at=function(t){return t&&t.key==="PRIV"&&t.info==="com.apple.streaming.transportStreamTimestamp"};var nt=function(t){var e=String.fromCharCode(t[0],t[1],t[2],t[3]);var r=et(t,4);var i=10;return{type:e,size:r,data:t.subarray(i,i+r)}};var st=function(t){var e=0;var r=[];while(J(t,e)){var i=et(t,e+6);e+=10;var a=e+i;while(e+8<a){var n=nt(t.subarray(e));var s=ot(n);if(s){r.push(s)}e+=n.size+10}if(Z(t,e)){e+=10}}return r};var ot=function(t){if(t.type==="PRIV"){return lt(t)}else if(t.type[0]==="W"){return ft(t)}return ut(t)};var lt=function(t){if(t.size<2){return undefined}var e=dt(t.data,true);var r=new Uint8Array(t.data.subarray(e.length+1));return{key:t.type,info:e,data:r.buffer}};var ut=function(t){if(t.size<2){return undefined}if(t.type==="TXXX"){var e=1;var r=dt(t.data.subarray(e),true);e+=r.length+1;var i=dt(t.data.subarray(e));return{key:t.type,info:r,data:i}}var a=dt(t.data.subarray(1));return{key:t.type,data:a}};var ft=function(t){if(t.type==="WXXX"){if(t.size<2){return undefined}var e=1;var r=dt(t.data.subarray(e),true);e+=r.length+1;var i=dt(t.data.subarray(e));return{key:t.type,info:r,data:i}}var a=dt(t.data);return{key:t.type,data:a}};var ct=function(t){if(t.data.byteLength===8){var e=new Uint8Array(t.data);var r=e[3]&1;var i=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];i/=45;if(r){i+=47721858.84}return Math.round(i)}return undefined};var dt=function(t,e){if(e===void 0){e=false}var r=vt();if(r){var i=r.decode(t);if(e){var a=i.indexOf("\0");return a!==-1?i.substring(0,a):i}return i.replace(/\0/g,"")}var n=t.length;var s;var o;var l;var u="";var f=0;while(f<n){s=t[f++];if(s===0&&e){return u}else if(s===0||s===3){continue}switch(s>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:u+=String.fromCharCode(s);break;case 12:case 13:o=t[f++];u+=String.fromCharCode((s&31)<<6|o&63);break;case 14:o=t[f++];l=t[f++];u+=String.fromCharCode((s&15)<<12|(o&63)<<6|(l&63)<<0);break}}return u};var ht;function vt(){if(!ht&&typeof self.TextDecoder!=="undefined"){ht=new self.TextDecoder("utf-8")}return ht}var pt={hexDump:function(t){var e="";for(var r=0;r<t.length;r++){var i=t[r].toString(16);if(i.length<2){i="0"+i}e+=i}return e}};var gt=Math.pow(2,32)-1;var mt=[].push;var yt={video:1,audio:2,id3:3,text:4};function Tt(t){return String.fromCharCode.apply(null,t)}function Et(t,e){var r=t[e]<<8|t[e+1];return r<0?65536+r:r}function St(t,e){var r=At(t,e);return r<0?4294967296+r:r}function At(t,e){return t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}function Lt(t,e,r){t[e]=r>>24;t[e+1]=r>>16&255;t[e+2]=r>>8&255;t[e+3]=r&255}function bt(t,e){var r=[];if(!e.length){return r}var i=t.byteLength;for(var a=0;a<i;){var n=St(t,a);var s=Tt(t.subarray(a+4,a+8));var o=n>1?a+n:i;if(s===e[0]){if(e.length===1){r.push(t.subarray(a+8,o))}else{var l=bt(t.subarray(a+8,o),e.slice(1));if(l.length){mt.apply(r,l)}}}a=o}return r}function Rt(t){var e=[];var r=t[0];var i=8;var a=St(t,i);i+=4;var n=0;var s=0;if(r===0){i+=8}else{i+=16}i+=2;var o=t.length+s;var l=Et(t,i);i+=2;for(var u=0;u<l;u++){var f=i;var c=St(t,f);f+=4;var d=c&2147483647;var h=(c&2147483648)>>>31;if(h===1){A.warn("SIDX has hierarchical references (not supported)");return null}var v=St(t,f);f+=4;e.push({referenceSize:d,subsegmentDuration:v,info:{duration:v/a,start:o,end:o+d-1}});o+=d;f+=4;i=f}return{earliestPresentationTime:n,timescale:a,version:r,referencesCount:l,references:e}}function It(t){var e=[];var r=bt(t,["moov","trak"]);for(var i=0;i<r.length;i++){var a=r[i];var n=bt(a,["tkhd"])[0];if(n){var s=n[0];var o=s===0?12:20;var l=St(n,o);var u=bt(a,["mdia","mdhd"])[0];if(u){s=u[0];o=s===0?12:20;var f=St(u,o);var c=bt(a,["mdia","hdlr"])[0];if(c){var d=Tt(c.subarray(8,12));var h={soun:w.AUDIO,vide:w.VIDEO}[d];if(h){var v=bt(a,["mdia","minf","stbl","stsd"])[0];var p=void 0;if(v){p=Tt(v.subarray(12,16))}e[l]={timescale:f,type:h};e[h]={timescale:f,id:l,codec:p}}}}}}var g=bt(t,["moov","mvex","trex"]);g.forEach((function(t){var r=St(t,4);var i=e[r];if(i){i.default={duration:St(t,12),flags:St(t,20)}}}));return e}function Dt(t,e){if(!t||!e){return t}var r=e.keyId;if(r&&e.isCommonEncryption){var i=bt(t,["moov","trak"]);i.forEach((function(t){var e=bt(t,["mdia","minf","stbl","stsd"])[0];var i=e.subarray(8);var a=bt(i,["enca"]);var n=a.length>0;if(!n){a=bt(i,["encv"])}a.forEach((function(t){var e=n?t.subarray(28):t.subarray(78);var i=bt(e,["sinf"]);i.forEach((function(t){var e=kt(t);if(e){var i=e.subarray(8,24);if(!i.some((function(t){return t!==0}))){A.log("[eme] Patching keyId in 'enc".concat(n?"a":"v",">sinf>>tenc' box: ").concat(pt.hexDump(i)," -> ").concat(pt.hexDump(r)));e.set(r,8)}}}))}))}))}return t}function kt(t){var e=bt(t,["schm"])[0];if(e){var r=Tt(e.subarray(4,8));if(r==="cbcs"||r==="cenc"){return bt(t,["schi","tenc"])[0]}}A.error("[eme] missing 'schm' box");return null}function _t(t,e){return bt(e,["moof","traf"]).reduce((function(e,r){var i=bt(r,["tfdt"])[0];var a=i[0];var n=bt(r,["tfhd"]).reduce((function(e,r){var n=St(r,4);var s=t[n];if(s){var o=St(i,4);if(a===1){if(o===gt){A.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time");return e}o*=gt+1;o+=St(i,8)}var l=s.timescale||9e4;var u=o/l;if(f(u)&&(e===null||u<e)){return u}}return e}),null);if(n!==null&&f(n)&&(e===null||n<e)){return n}return e}),null)}function wt(t,e){var r=0;var i=0;var a=0;var n=bt(t,["moof","traf"]);for(var s=0;s<n.length;s++){var o=n[s];var l=bt(o,["tfhd"])[0];var u=St(l,4);var f=e[u];if(!f){continue}var c=f.default;var d=St(l,0)|(c==null?void 0:c.flags);var h=c==null?void 0:c.duration;if(d&8){if(d&2){h=St(l,12)}else{h=St(l,8)}}var v=f.timescale||9e4;var p=bt(o,["trun"]);for(var g=0;g<p.length;g++){r=Ct(p[g]);if(!r&&h){var m=St(p[g],4);r=h*m}if(f.type===w.VIDEO){i+=r/v}else if(f.type===w.AUDIO){a+=r/v}}}if(i===0&&a===0){var y=0;var T=bt(t,["sidx"]);for(var s=0;s<T.length;s++){var E=Rt(T[s]);if(E!=null&&E.references){y+=E.references.reduce((function(t,e){return t+e.info.duration||0}),0)}}return y}if(i){return i}return a}function Ct(t){var e=St(t,0);var r=8;if(e&1){r+=4}if(e&4){r+=4}var i=0;var a=St(t,4);for(var n=0;n<a;n++){if(e&256){var s=St(t,r);i+=s;r+=4}if(e&512){r+=4}if(e&1024){r+=4}if(e&2048){r+=4}}return i}function Pt(t,e,r){bt(e,["moof","traf"]).forEach((function(e){bt(e,["tfhd"]).forEach((function(i){var a=St(i,4);var n=t[a];if(!n){return}var s=n.timescale||9e4;bt(e,["tfdt"]).forEach((function(t){var e=t[0];var i=St(t,4);if(e===0){i-=r*s;i=Math.max(i,0);Lt(t,4,i)}else{i*=Math.pow(2,32);i+=St(t,8);i-=r*s;i=Math.max(i,0);var a=Math.floor(i/(gt+1));var n=Math.floor(i%(gt+1));Lt(t,4,a);Lt(t,8,n)}}))}))}))}function Ot(t){var e={valid:null,remainder:null};var r=bt(t,["moof"]);if(!r){return e}else if(r.length<2){e.remainder=t;return e}var i=r[r.length-1];e.valid=$(t,0,i.byteOffset-8);e.remainder=$(t,i.byteOffset-8);return e}function xt(t,e){var r=new Uint8Array(t.length+e.length);r.set(t);r.set(e,t.length);return r}function Ft(t,e){var r=[];var i=e.samples;var a=e.timescale;var n=e.id;var s=false;var o=bt(i,["moof"]);o.map((function(o){var l=o.byteOffset-8;var u=bt(o,["traf"]);u.map((function(o){var u=bt(o,["tfdt"]).map((function(t){var e=t[0];var r=St(t,4);if(e===1){r*=Math.pow(2,32);r+=St(t,8)}return r/a}))[0];if(u!==undefined){t=u}return bt(o,["tfhd"]).map((function(u){var f=St(u,4);var c=St(u,0)&16777215;var d=(c&1)!==0;var h=(c&2)!==0;var v=(c&8)!==0;var p=0;var g=(c&16)!==0;var m=0;var y=(c&32)!==0;var T=8;if(f===n){if(d){T+=8}if(h){T+=4}if(v){p=St(u,T);T+=4}if(g){m=St(u,T);T+=4}if(y){T+=4}if(e.type==="video"){s=Mt(e.codec)}bt(o,["trun"]).map((function(n){var o=n[0];var u=St(n,0)&16777215;var f=(u&1)!==0;var c=0;var d=(u&4)!==0;var h=(u&256)!==0;var v=0;var g=(u&512)!==0;var y=0;var T=(u&1024)!==0;var E=(u&2048)!==0;var S=0;var A=St(n,4);var L=8;if(f){c=St(n,L);L+=4}if(d){L+=4}var b=c+l;for(var R=0;R<A;R++){if(h){v=St(n,L);L+=4}else{v=p}if(g){y=St(n,L);L+=4}else{y=m}if(T){L+=4}if(E){if(o===0){S=St(n,L)}else{S=At(n,L)}L+=4}if(e.type===w.VIDEO){var I=0;while(I<y){var D=St(i,b);b+=4;if(Nt(s,i[b])){var k=i.subarray(b,b+D);Ut(k,s?2:1,t+S/a,r)}b+=D;I+=D+4}}t+=v/a}}))}}))}))}));return r}function Mt(t){if(!t){return false}var e=t.indexOf(".");var r=e<0?t:t.substring(0,e);return r==="hvc1"||r==="hev1"||r==="dvh1"||r==="dvhe"}function Nt(t,e){if(t){var r=e>>1&63;return r===39||r===40}else{var r=e&31;return r===6}}function Ut(t,e,r,i){var a=Bt(t);var n=0;n+=e;var s=0;var o=0;var l=false;var u=0;while(n<a.length){s=0;do{if(n>=a.length){break}u=a[n++];s+=u}while(u===255);o=0;do{if(n>=a.length){break}u=a[n++];o+=u}while(u===255);var f=a.length-n;if(!l&&s===4&&n<a.length){l=true;var c=a[n++];if(c===181){var d=Et(a,n);n+=2;if(d===49){var h=St(a,n);n+=4;if(h===1195456820){var v=a[n++];if(v===3){var p=a[n++];var g=31&p;var m=64&p;var y=m?2+g*3:0;var T=new Uint8Array(y);if(m){T[0]=p;for(var E=1;E<y;E++){T[E]=a[n++]}}i.push({type:v,payloadType:s,pts:r,bytes:T})}}}}}else if(s===5&&o<f){l=true;if(o>16){var S=[];for(var E=0;E<16;E++){var A=a[n++].toString(16);S.push(A.length==1?"0"+A:A);if(E===3||E===5||E===7||E===9){S.push("-")}}var L=o-16;var b=new Uint8Array(L);for(var E=0;E<L;E++){b[E]=a[n++]}i.push({payloadType:s,pts:r,uuid:S.join(""),userData:dt(b),userDataBytes:b})}}else if(o<f){n+=o}else if(o>f){break}}}function Bt(t){var e=t.byteLength;var r=[];var i=1;while(i<e-2){if(t[i]===0&&t[i+1]===0&&t[i+2]===3){r.push(i+2);i+=2}else{i++}}if(r.length===0){return t}var a=e-r.length;var n=new Uint8Array(a);var s=0;for(i=0;i<a;s++,i++){if(s===r[0]){s++;r.shift()}n[i]=t[s]}return n}function Gt(t){var e=t[0];var r="";var i="";var a=0;var n=0;var s=0;var o=0;var l=0;var u=0;if(e===0){while(Tt(t.subarray(u,u+1))!=="\0"){r+=Tt(t.subarray(u,u+1));u+=1}r+=Tt(t.subarray(u,u+1));u+=1;while(Tt(t.subarray(u,u+1))!=="\0"){i+=Tt(t.subarray(u,u+1));u+=1}i+=Tt(t.subarray(u,u+1));u+=1;a=St(t,12);n=St(t,16);o=St(t,20);l=St(t,24);u=28}else if(e===1){u+=4;a=St(t,u);u+=4;var f=St(t,u);u+=4;var d=St(t,u);u+=4;s=Math.pow(2,32)*f+d;if(!c(s)){s=Number.MAX_SAFE_INTEGER;A.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")}o=St(t,u);u+=4;l=St(t,u);u+=4;while(Tt(t.subarray(u,u+1))!=="\0"){r+=Tt(t.subarray(u,u+1));u+=1}r+=Tt(t.subarray(u,u+1));u+=1;while(Tt(t.subarray(u,u+1))!=="\0"){i+=Tt(t.subarray(u,u+1));u+=1}i+=Tt(t.subarray(u,u+1));u+=1}var h=t.subarray(u,t.byteLength);return{schemeIdUri:r,value:i,timeScale:a,presentationTime:s,presentationTimeDelta:n,eventDuration:o,id:l,payload:h}}function Kt(t){var e=[];for(var r=1;r<arguments.length;r++){e[r-1]=arguments[r]}var i=e.length;var a=8;var n=i;while(n--){a+=e[n].byteLength}var s=new Uint8Array(a);s[0]=a>>24&255;s[1]=a>>16&255;s[2]=a>>8&255;s[3]=a&255;s.set(t,4);for(n=0,a=8;n<i;n++){s.set(e[n],a);a+=e[n].byteLength}return s}function Ht(t,e,r){if(t.byteLength!==16){throw new RangeError("Invalid system id")}var i;var a;if(e){i=1;a=new Uint8Array(e.length*16);for(var n=0;n<e.length;n++){var s=e[n];if(s.byteLength!==16){throw new RangeError("Invalid key")}a.set(s,n*16)}}else{i=0;a=new Uint8Array}var o;if(i>0){o=new Uint8Array(4);if(e.length>0){new DataView(o.buffer).setUint32(0,e.length,false)}}else{o=new Uint8Array}var l=new Uint8Array(4);if(r&&r.byteLength>0){new DataView(l.buffer).setUint32(0,r.byteLength,false)}return Kt([112,115,115,104],new Uint8Array([i,0,0,0]),t,o,a,l,r||new Uint8Array)}function Vt(t){if(!(t instanceof ArrayBuffer)||t.byteLength<32){return null}var e={version:0,systemId:"",kids:null,data:null};var r=new DataView(t);var i=r.getUint32(0);if(t.byteLength!==i&&i>44){return null}var a=r.getUint32(4);if(a!==1886614376){return null}e.version=r.getUint32(8)>>>24;if(e.version>1){return null}e.systemId=pt.hexDump(new Uint8Array(t,12,16));var n=r.getUint32(28);if(e.version===0){if(i-32<n){return null}e.data=new Uint8Array(t,32,n)}else if(e.version===1){e.kids=[];for(var s=0;s<n;s++){e.kids.push(new Uint8Array(t,32+s*16,16))}}return e}var jt={};var Yt=function(){function t(t,e,r,i,a){if(i===void 0){i=[1]}if(a===void 0){a=null}this.uri=void 0;this.method=void 0;this.keyFormat=void 0;this.keyFormatVersions=void 0;this.encrypted=void 0;this.isCommonEncryption=void 0;this.iv=null;this.key=null;this.keyId=null;this.pssh=null;this.method=t;this.uri=e;this.keyFormat=r;this.keyFormatVersions=i;this.iv=a;this.encrypted=t?t!=="NONE":false;this.isCommonEncryption=this.encrypted&&t!=="AES-128"}t.clearKeyUriToKeyIdMap=function(){jt={}};t.prototype.isSupported=function(){if(this.method){if(this.method==="AES-128"||this.method==="NONE"){return true}if(this.keyFormat==="identity"){return this.method==="SAMPLE-AES"}else{switch(this.keyFormat){case H.FAIRPLAY:case H.WIDEVINE:case H.PLAYREADY:case H.CLEARKEY:return["ISO-23001-7","SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}}return false};t.prototype.getDecryptData=function(e){if(!this.encrypted||!this.uri){return null}if(this.method==="AES-128"&&this.uri&&!this.iv){if(typeof e!=="number"){if(this.method==="AES-128"&&!this.iv){A.warn('missing IV for initialization segment with method="'.concat(this.method,'" - compliance issue'))}e=0}var r=Wt(e);var i=new t(this.method,this.uri,"identity",this.keyFormatVersions,r);return i}var a=B(this.uri);if(a){switch(this.keyFormat){case H.WIDEVINE:this.pssh=a;if(a.length>=22){this.keyId=a.subarray(a.length-22,a.length-6)}break;case H.PLAYREADY:{var n=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=Ht(n,null,a);var s=new Uint16Array(a.buffer,a.byteOffset,a.byteLength/2);var o=String.fromCharCode.apply(null,Array.from(s));var l=o.substring(o.indexOf("<"),o.length);var u=new DOMParser;var f=u.parseFromString(l,"text/xml");var c=f.getElementsByTagName("KID")[0];if(c){var d=c.childNodes[0]?c.childNodes[0].nodeValue:c.getAttribute("VALUE");if(d){var h=M(d).subarray(0,16);U(h);this.keyId=h}}break}default:{var v=a.subarray(0,16);if(v.length!==16){var p=new Uint8Array(16);p.set(v,16-v.length);v=p}this.keyId=v;break}}}if(!this.keyId||this.keyId.byteLength!==16){var d=jt[this.uri];if(!d){var g=Object.keys(jt).length%Number.MAX_SAFE_INTEGER;d=new Uint8Array(16);var m=new DataView(d.buffer,12,4);m.setUint32(0,g);jt[this.uri]=d}this.keyId=d}return this};return t}();function Wt(t){var e=new Uint8Array(16);for(var r=12;r<16;r++){e[r]=t>>8*(15-r)&255}return e}var qt=/\{\$([a-zA-Z0-9-_]+)\}/g;function Xt(t){return qt.test(t)}function zt(t,e,r){if(t.variableList!==null||t.hasVariableRefs){for(var i=r.length;i--;){var a=r[i];var n=e[a];if(n){e[a]=Qt(t,n)}}}}function Qt(t,e){if(t.variableList!==null||t.hasVariableRefs){var r=t.variableList;return e.replace(qt,(function(e){var i=e.substring(2,e.length-1);var a=r==null?void 0:r[i];if(a===undefined){t.playlistParsingError||(t.playlistParsingError=new Error('Missing preceding EXT-X-DEFINE tag for Variable Reference: "'.concat(i,'"')));return e}return a}))}return e}function $t(t,e,r){var i=t.variableList;if(!i){t.variableList=i={}}var a;var n;if("QUERYPARAM"in e){a=e.QUERYPARAM;try{var s=new self.URL(r).searchParams;if(s.has(a)){n=s.get(a)}else{throw new Error('"'.concat(a,'" does not match any query parameter in URI: "').concat(r,'"'))}}catch(e){t.playlistParsingError||(t.playlistParsingError=new Error("EXT-X-DEFINE QUERYPARAM: ".concat(e.message)))}}else{a=e.NAME;n=e.VALUE}if(a in i){t.playlistParsingError||(t.playlistParsingError=new Error('EXT-X-DEFINE duplicate Variable Name declarations: "'.concat(a,'"')))}else{i[a]=n||""}}function Jt(t,e,r){var i=e.IMPORT;if(r&&i in r){var a=t.variableList;if(!a){t.variableList=a={}}a[i]=r[i]}else{t.playlistParsingError||(t.playlistParsingError=new Error('EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "'.concat(i,'"')))}}function Zt(){if(typeof self==="undefined")return undefined;return self.MediaSource||self.WebKitMediaSource}var te={audio:{a3ds:true,"ac-3":true,"ac-4":true,alac:true,alaw:true,dra1:true,"dts+":true,"dts-":true,dtsc:true,dtse:true,dtsh:true,"ec-3":true,enca:true,g719:true,g726:true,m4ae:true,mha1:true,mha2:true,mhm1:true,mhm2:true,mlpa:true,mp4a:true,"raw ":true,Opus:true,opus:true,samr:true,sawb:true,sawp:true,sevc:true,sqcp:true,ssmv:true,twos:true,ulaw:true},video:{avc1:true,avc2:true,avc3:true,avc4:true,avcp:true,av01:true,drac:true,dva1:true,dvav:true,dvh1:true,dvhe:true,encv:true,hev1:true,hvc1:true,mjp2:true,mp4v:true,mvc1:true,mvc2:true,mvc3:true,mvc4:true,resv:true,rv60:true,s263:true,svc1:true,svc2:true,"vc-1":true,vp08:true,vp09:true},text:{stpp:true,wvtt:true}};var ee=Zt();function re(t,e){var r=te[e];return!!r&&r[t.slice(0,4)]===true}function ie(t,e){var r;return(r=ee==null?void 0:ee.isTypeSupported("".concat(e||"video",'/mp4;codecs="').concat(t,'"')))!=null?r:false}var ae=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-(SESSION-DATA|SESSION-KEY|DEFINE|CONTENT-STEERING|START):([^\r\n]*)[\r\n]+/g;var ne=/#EXT-X-MEDIA:(.*)/g;var se=/^#EXT(?:INF|-X-TARGETDURATION):/m;var oe=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g");var le=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(DATERANGE|DEFINE|KEY|MAP|PART|PART-INF|PLAYLIST-TYPE|PRELOAD-HINT|RENDITION-REPORT|SERVER-CONTROL|SKIP|START):(.+)/.source,/#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\d+)/.source,/#EXT-X-(DISCONTINUITY|ENDLIST|GAP)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|"));var ue=function(){function t(){}t.findGroup=function(t,e){for(var r=0;r<t.length;r++){var i=t[r];if(i.id===e){return i}}};t.convertAVC1ToAVCOTI=function(t){var e=t.split(".");if(e.length>2){var r=e.shift()+".";r+=parseInt(e.shift()).toString(16);r+=("000"+parseInt(e.shift()).toString(16)).slice(-4);return r}return t};t.resolve=function(t,e){return i.buildAbsoluteURL(e,t,{alwaysNormalize:true})};t.isMediaPlaylist=function(t){return se.test(t)};t.parseMasterPlaylist=function(e,r){var i=Xt(e);var a={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:i};var n=[];ae.lastIndex=0;var s;while((s=ae.exec(e))!=null){if(s[1]){var o;var l=new R(s[1]);{zt(a,l,["CODECS","SUPPLEMENTAL-CODECS","ALLOWED-CPC","PATHWAY-ID","STABLE-VARIANT-ID","AUDIO","VIDEO","SUBTITLES","CLOSED-CAPTIONS","NAME"])}var u=Qt(a,s[2]);var f={attrs:l,bitrate:l.decimalInteger("AVERAGE-BANDWIDTH")||l.decimalInteger("BANDWIDTH"),name:l.NAME,url:t.resolve(u,r)};var c=l.decimalResolution("RESOLUTION");if(c){f.width=c.width;f.height=c.height}de((l.CODECS||"").split(/[ ,]+/).filter((function(t){return t})),f);if(f.videoCodec&&f.videoCodec.indexOf("avc1")!==-1){f.videoCodec=t.convertAVC1ToAVCOTI(f.videoCodec)}if(!((o=f.unknownCodecs)!=null&&o.length)){n.push(f)}a.levels.push(f)}else if(s[3]){var d=s[3];var h=s[4];switch(d){case"SESSION-DATA":{var v=new R(h);{zt(a,v,["DATA-ID","LANGUAGE","VALUE","URI"])}var p=v["DATA-ID"];if(p){if(a.sessionData===null){a.sessionData={}}a.sessionData[p]=v}break}case"SESSION-KEY":{var g=fe(h,r,a);if(g.encrypted&&g.isSupported()){if(a.sessionKeys===null){a.sessionKeys=[]}a.sessionKeys.push(g)}else{A.warn('[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "'.concat(h,'"'))}break}case"DEFINE":{{var m=new R(h);zt(a,m,["NAME","VALUE","QUERYPARAM"]);$t(a,m,r)}break}case"CONTENT-STEERING":{var y=new R(h);{zt(a,y,["SERVER-URI","PATHWAY-ID"])}a.contentSteering={uri:t.resolve(y["SERVER-URI"],r),pathwayId:y["PATHWAY-ID"]||"."};break}case"START":{a.startTimeOffset=ce(h);break}}}}var T=n.length>0&&n.length<a.levels.length;a.levels=T?n:a.levels;if(a.levels.length===0){a.playlistParsingError=new Error("no levels found in manifest")}return a};t.parseMasterPlaylistMedia=function(e,r,i){var a;var n={};var s=i.levels;var o={AUDIO:s.map((function(t){return{id:t.attrs.AUDIO,audioCodec:t.audioCodec}})),SUBTITLES:s.map((function(t){return{id:t.attrs.SUBTITLES,textCodec:t.textCodec}})),"CLOSED-CAPTIONS":[]};var l=0;ne.lastIndex=0;while((a=ne.exec(e))!==null){var u=new R(a[1]);var f=u.TYPE;if(f){var c=o[f];var d=n[f]||[];n[f]=d;{zt(i,u,["URI","GROUP-ID","LANGUAGE","ASSOC-LANGUAGE","STABLE-RENDITION-ID","NAME","INSTREAM-ID","CHARACTERISTICS","CHANNELS"])}var h={attrs:u,bitrate:0,id:l++,groupId:u["GROUP-ID"]||"",instreamId:u["INSTREAM-ID"],name:u.NAME||u.LANGUAGE||"",type:f,default:u.bool("DEFAULT"),autoselect:u.bool("AUTOSELECT"),forced:u.bool("FORCED"),lang:u.LANGUAGE,url:u.URI?t.resolve(u.URI,r):""};if(c!=null&&c.length){var v=t.findGroup(c,h.groupId)||c[0];he(h,v,"audioCodec");he(h,v,"textCodec")}d.push(h)}}return n};t.parseLevelPlaylist=function(t,e,r,i,a,n){var s=new F(e);var l=s.fragments;var u=null;var c=0;var d=0;var h=0;var v=0;var p=null;var g=new P(i,e);var m;var y;var T;var E=-1;var S=false;oe.lastIndex=0;s.m3u8=t;s.hasVariableRefs=Xt(t);while((m=oe.exec(t))!==null){if(S){S=false;g=new P(i,e);g.start=h;g.sn=c;g.cc=v;g.level=r;if(u){g.initSegment=u;g.rawProgramDateTime=u.rawProgramDateTime;u.rawProgramDateTime=null}}var L=m[1];if(L){g.duration=parseFloat(L);var b=(" "+m[2]).slice(1);g.title=b||null;g.tagList.push(b?["INF",L,b]:["INF",L])}else if(m[3]){if(f(g.duration)){g.start=h;if(T){me(g,T,s)}g.sn=c;g.level=r;g.cc=v;g.urlId=a;l.push(g);var I=(" "+m[3]).slice(1);g.relurl=Qt(s,I);pe(g,p);p=g;h+=g.duration;c++;d=0;S=true}}else if(m[4]){var D=(" "+m[4]).slice(1);if(p){g.setByteRange(D,p)}else{g.setByteRange(D)}}else if(m[5]){g.rawProgramDateTime=(" "+m[5]).slice(1);g.tagList.push(["PROGRAM-DATE-TIME",g.rawProgramDateTime]);if(E===-1){E=l.length}}else{m=m[0].match(le);if(!m){A.warn("No matches on slow regex match for level playlist!");continue}for(y=1;y<m.length;y++){if(typeof m[y]!=="undefined"){break}}var _=(" "+m[y]).slice(1);var w=(" "+m[y+1]).slice(1);var C=m[y+2]?(" "+m[y+2]).slice(1):"";switch(_){case"PLAYLIST-TYPE":s.type=w.toUpperCase();break;case"MEDIA-SEQUENCE":c=s.startSN=parseInt(w);break;case"SKIP":{var x=new R(w);{zt(s,x,["RECENTLY-REMOVED-DATERANGES"])}var M=x.decimalInteger("SKIPPED-SEGMENTS");if(f(M)){s.skippedSegments=M;for(var N=M;N--;){l.unshift(null)}c+=M}var U=x.enumeratedString("RECENTLY-REMOVED-DATERANGES");if(U){s.recentlyRemovedDateranges=U.split("\t")}break}case"TARGETDURATION":s.targetduration=Math.max(parseInt(w),1);break;case"VERSION":s.version=parseInt(w);break;case"EXTM3U":break;case"ENDLIST":s.live=false;break;case"#":if(w||C){g.tagList.push(C?[w,C]:[w])}break;case"DISCONTINUITY":v++;g.tagList.push(["DIS"]);break;case"GAP":g.gap=true;g.tagList.push([_]);break;case"BITRATE":g.tagList.push([_,w]);break;case"DATERANGE":{var B=new R(w);{zt(s,B,["ID","CLASS","START-DATE","END-DATE","SCTE35-CMD","SCTE35-OUT","SCTE35-IN"]);zt(s,B,B.clientAttrs)}var G=new k(B,s.dateRanges[B.ID]);if(G.isValid||s.skippedSegments){s.dateRanges[G.id]=G}else{A.warn('Ignoring invalid DATERANGE tag: "'.concat(w,'"'))}g.tagList.push(["EXT-X-DATERANGE",w]);break}case"DEFINE":{{var K=new R(w);zt(s,K,["NAME","VALUE","IMPORT","QUERYPARAM"]);if("IMPORT"in K){Jt(s,K,n)}else{$t(s,K,e)}}break}case"DISCONTINUITY-SEQUENCE":v=parseInt(w);break;case"KEY":{var H=fe(w,e,s);if(H.isSupported()){if(H.method==="NONE"){T=undefined;break}if(!T){T={}}if(T[H.keyFormat]){T=o({},T)}T[H.keyFormat]=H}else{A.warn('[Keys] Ignoring invalid EXT-X-KEY tag: "'.concat(w,'"'))}break}case"START":s.startTimeOffset=ce(w);break;case"MAP":{var V=new R(w);{zt(s,V,["BYTERANGE","URI"])}if(g.duration){var j=new P(i,e);ge(j,V,r,T);u=j;g.initSegment=u;if(u.rawProgramDateTime&&!g.rawProgramDateTime){g.rawProgramDateTime=u.rawProgramDateTime}}else{ge(g,V,r,T);u=g;S=true}break}case"SERVER-CONTROL":{var Y=new R(w);s.canBlockReload=Y.bool("CAN-BLOCK-RELOAD");s.canSkipUntil=Y.optionalFloat("CAN-SKIP-UNTIL",0);s.canSkipDateRanges=s.canSkipUntil>0&&Y.bool("CAN-SKIP-DATERANGES");s.partHoldBack=Y.optionalFloat("PART-HOLD-BACK",0);s.holdBack=Y.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var W=new R(w);s.partTarget=W.decimalFloatingPoint("PART-TARGET");break}case"PART":{var q=s.partList;if(!q){q=s.partList=[]}var X=d>0?q[q.length-1]:undefined;var z=d++;var Q=new R(w);{zt(s,Q,["BYTERANGE","URI"])}var $=new O(Q,g,e,z,X);q.push($);g.duration+=$.duration;break}case"PRELOAD-HINT":{var J=new R(w);{zt(s,J,["URI"])}s.preloadHint=J;break}case"RENDITION-REPORT":{var Z=new R(w);{zt(s,Z,["URI"])}s.renditionReports=s.renditionReports||[];s.renditionReports.push(Z);break}default:A.warn("line parsed but not handled: ".concat(m));break}}}if(p&&!p.relurl){l.pop();h-=p.duration;if(s.partList){s.fragmentHint=p}}else if(s.partList){pe(g,p);g.cc=v;s.fragmentHint=g;if(T){me(g,T,s)}}var tt=l.length;var et=l[0];var rt=l[tt-1];h+=s.skippedSegments*s.targetduration;if(h>0&&tt&&rt){s.averagetargetduration=h/tt;var it=rt.sn;s.endSN=it!=="initSegment"?it:0;if(!s.live){rt.endList=true}if(et){s.startCC=et.cc}}else{s.endSN=0;s.startCC=0}if(s.fragmentHint){h+=s.fragmentHint.duration}s.totalduration=h;s.endCC=v;if(E>0){ve(l,E)}return s};return t}();function fe(t,e,r){var i,a;var n=new R(t);{zt(r,n,["KEYFORMAT","KEYFORMATVERSIONS","URI","IV","URI"])}var s=(i=n.METHOD)!=null?i:"";var o=n.URI;var l=n.hexadecimalInteger("IV");var u=n.KEYFORMATVERSIONS;var f=(a=n.KEYFORMAT)!=null?a:"identity";if(o&&n.IV&&!l){A.error("Invalid IV: ".concat(n.IV))}var c=o?ue.resolve(o,e):"";var d=(u?u:"1").split("/").map(Number).filter(Number.isFinite);return new Yt(s,c,f,d,l)}function ce(t){var e=new R(t);var r=e.decimalFloatingPoint("TIME-OFFSET");if(f(r)){return r}return null}function de(t,e){["video","audio","text"].forEach((function(r){var i=t.filter((function(t){return re(t,r)}));if(i.length){var a=i.filter((function(t){return t.lastIndexOf("avc1",0)===0||t.lastIndexOf("mp4a",0)===0}));e["".concat(r,"Codec")]=a.length>0?a[0]:i[0];t=t.filter((function(t){return i.indexOf(t)===-1}))}}));e.unknownCodecs=t}function he(t,e,r){var i=e[r];if(i){t[r]=i}}function ve(t,e){var r=t[e];for(var i=e;i--;){var a=t[i];if(!a){return}a.programDateTime=r.programDateTime-a.duration*1e3;r=a}}function pe(t,e){if(t.rawProgramDateTime){t.programDateTime=Date.parse(t.rawProgramDateTime)}else if(e!=null&&e.programDateTime){t.programDateTime=e.endProgramDateTime}if(!f(t.programDateTime)){t.programDateTime=null;t.rawProgramDateTime=null}}function ge(t,e,r,i){t.relurl=e.URI;if(e.BYTERANGE){t.setByteRange(e.BYTERANGE)}t.level=r;t.sn="initSegment";if(i){t.levelkeys=i}t.initSegment=null}function me(t,e,r){t.levelkeys=e;var i=r.encryptedFragments;if((!i.length||i[i.length-1].levelkeys!==e)&&Object.keys(e).some((function(t){return e[t].isCommonEncryption}))){i.push(t)}}var ye={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"};var Te={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};function Ee(t){var e=t.type;switch(e){case ye.AUDIO_TRACK:return Te.AUDIO;case ye.SUBTITLE_TRACK:return Te.SUBTITLE;default:return Te.MAIN}}function Se(t,e){var r=t.url;if(r===undefined||r.indexOf("data:")===0){r=e.url}return r}var Ae=function(){function t(t){this.hls=void 0;this.loaders=Object.create(null);this.variableList=null;this.hls=t;this.registerListeners()}t.prototype.startLoad=function(t){};t.prototype.stopLoad=function(){this.destroyInternalLoaders()};t.prototype.registerListeners=function(){var t=this.hls;t.on(h.MANIFEST_LOADING,this.onManifestLoading,this);t.on(h.LEVEL_LOADING,this.onLevelLoading,this);t.on(h.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this);t.on(h.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)};t.prototype.unregisterListeners=function(){var t=this.hls;t.off(h.MANIFEST_LOADING,this.onManifestLoading,this);t.off(h.LEVEL_LOADING,this.onLevelLoading,this);t.off(h.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this);t.off(h.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)};t.prototype.createInternalLoader=function(t){var e=this.hls.config;var r=e.pLoader;var i=e.loader;var a=r||i;var n=new a(e);this.loaders[t.type]=n;return n};t.prototype.getInternalLoader=function(t){return this.loaders[t.type]};t.prototype.resetInternalLoader=function(t){if(this.loaders[t]){delete this.loaders[t]}};t.prototype.destroyInternalLoaders=function(){for(var t in this.loaders){var e=this.loaders[t];if(e){e.destroy()}this.resetInternalLoader(t)}};t.prototype.destroy=function(){this.variableList=null;this.unregisterListeners();this.destroyInternalLoaders()};t.prototype.onManifestLoading=function(t,e){var r=e.url;this.variableList=null;this.load({id:null,level:0,responseType:"text",type:ye.MANIFEST,url:r,deliveryDirectives:null})};t.prototype.onLevelLoading=function(t,e){var r=e.id,i=e.level,a=e.url,n=e.deliveryDirectives;this.load({id:r,level:i,responseType:"text",type:ye.LEVEL,url:a,deliveryDirectives:n})};t.prototype.onAudioTrackLoading=function(t,e){var r=e.id,i=e.groupId,a=e.url,n=e.deliveryDirectives;this.load({id:r,groupId:i,level:null,responseType:"text",type:ye.AUDIO_TRACK,url:a,deliveryDirectives:n})};t.prototype.onSubtitleTrackLoading=function(t,e){var r=e.id,i=e.groupId,a=e.url,n=e.deliveryDirectives;this.load({id:r,groupId:i,level:null,responseType:"text",type:ye.SUBTITLE_TRACK,url:a,deliveryDirectives:n})};t.prototype.load=function(t){var e=this;var r;var i=this.hls.config;var a=this.getInternalLoader(t);if(a){var n=a.context;if(n&&n.url===t.url){A.trace("[playlist-loader]: playlist request ongoing");return}A.log("[playlist-loader]: aborting previous loader for type: ".concat(t.type));a.abort()}var s;if(t.type===ye.MANIFEST){s=i.manifestLoadPolicy.default}else{s=o({},i.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null})}a=this.createInternalLoader(t);if((r=t.deliveryDirectives)!=null&&r.part){var l=void 0;if(t.type===ye.LEVEL&&t.level!==null){l=this.hls.levels[t.level].details}else if(t.type===ye.AUDIO_TRACK&&t.id!==null){l=this.hls.audioTracks[t.id].details}else if(t.type===ye.SUBTITLE_TRACK&&t.id!==null){l=this.hls.subtitleTracks[t.id].details}if(l){var u=l.partTarget;var f=l.targetduration;if(u&&f){var c=Math.max(u*3,f*.8)*1e3;s=o({},s,{maxTimeToFirstByteMs:Math.min(c,s.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(c,s.maxTimeToFirstByteMs)})}}}var d=s.errorRetry||s.timeoutRetry||{};var h={loadPolicy:s,timeout:s.maxLoadTimeMs,maxRetry:d.maxNumRetry||0,retryDelay:d.retryDelayMs||0,maxRetryDelay:d.maxRetryDelayMs||0};var v={onSuccess:function(t,r,i,a){var n=e.getInternalLoader(i);e.resetInternalLoader(i.type);var s=t.data;if(s.indexOf("#EXTM3U")!==0){e.handleManifestParsingError(t,i,new Error("no EXTM3U delimiter"),a||null,r);return}r.parsing.start=performance.now();if(ue.isMediaPlaylist(s)){e.handleTrackOrLevelPlaylist(t,r,i,a||null,n)}else{e.handleMasterPlaylist(t,r,i,a)}},onError:function(t,r,i,a){e.handleNetworkError(r,i,false,t,a)},onTimeout:function(t,r,i){e.handleNetworkError(r,i,true,undefined,t)}};a.load(t,h,v)};t.prototype.handleMasterPlaylist=function(t,e,r,i){var a=this.hls;var n=t.data;var s=Se(t,r);var o=ue.parseMasterPlaylist(n,s);if(o.playlistParsingError){this.handleManifestParsingError(t,r,o.playlistParsingError,i,e);return}var l=o.contentSteering,u=o.levels,f=o.sessionData,c=o.sessionKeys,d=o.startTimeOffset,v=o.variableList;this.variableList=v;var p=ue.parseMasterPlaylistMedia(n,s,o),g=p.AUDIO,m=g===void 0?[]:g,y=p.SUBTITLES,T=p["CLOSED-CAPTIONS"];if(m.length){var E=m.some((function(t){return!t.url}));if(!E&&u[0].audioCodec&&!u[0].attrs.AUDIO){A.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one");m.unshift({type:"main",name:"main",groupId:"main",default:false,autoselect:false,forced:false,id:-1,attrs:new R({}),bitrate:0,url:""})}}a.trigger(h.MANIFEST_LOADED,{levels:u,audioTracks:m,subtitles:y,captions:T,contentSteering:l,url:s,stats:e,networkDetails:i,sessionData:f,sessionKeys:c,startTimeOffset:d,variableList:v})};t.prototype.handleTrackOrLevelPlaylist=function(t,e,r,i,a){var n=this.hls;var s=r.id,o=r.level,l=r.type;var u=Se(t,r);var c=f(s)?s:0;var d=f(o)?o:c;var v=Ee(r);var p=ue.parseLevelPlaylist(t.data,u,d,v,c,this.variableList);if(l===ye.MANIFEST){var g={attrs:new R({}),bitrate:0,details:p,name:"",url:u};n.trigger(h.MANIFEST_LOADED,{levels:[g],audioTracks:[],url:u,stats:e,networkDetails:i,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}e.parsing.end=performance.now();r.levelDetails=p;this.handlePlaylistLoaded(p,t,e,r,i,a)};t.prototype.handleManifestParsingError=function(t,e,r,i,a){this.hls.trigger(h.ERROR,{type:v.NETWORK_ERROR,details:p.MANIFEST_PARSING_ERROR,fatal:e.type===ye.MANIFEST,url:t.url,err:r,error:r,reason:r.message,response:t,context:e,networkDetails:i,stats:a})};t.prototype.handleNetworkError=function(t,e,r,i,a){if(r===void 0){r=false}var s="A network ".concat(r?"timeout":"error"+(i?" (status "+i.code+")":"")," occurred while loading ").concat(t.type);if(t.type===ye.LEVEL){s+=": ".concat(t.level," id: ").concat(t.id)}else if(t.type===ye.AUDIO_TRACK||t.type===ye.SUBTITLE_TRACK){s+=" id: ".concat(t.id,' group-id: "').concat(t.groupId,'"')}var o=new Error(s);A.warn("[playlist-loader]: ".concat(s));var l=p.UNKNOWN;var u=false;var f=this.getInternalLoader(t);switch(t.type){case ye.MANIFEST:l=r?p.MANIFEST_LOAD_TIMEOUT:p.MANIFEST_LOAD_ERROR;u=true;break;case ye.LEVEL:l=r?p.LEVEL_LOAD_TIMEOUT:p.LEVEL_LOAD_ERROR;u=false;break;case ye.AUDIO_TRACK:l=r?p.AUDIO_TRACK_LOAD_TIMEOUT:p.AUDIO_TRACK_LOAD_ERROR;u=false;break;case ye.SUBTITLE_TRACK:l=r?p.SUBTITLE_TRACK_LOAD_TIMEOUT:p.SUBTITLE_LOAD_ERROR;u=false;break}if(f){this.resetInternalLoader(t.type)}var c={type:v.NETWORK_ERROR,details:l,fatal:u,url:t.url,loader:f,context:t,error:o,networkDetails:e,stats:a};if(i){var d=(e==null?void 0:e.url)||t.url;c.response=n({url:d,data:undefined},i)}this.hls.trigger(h.ERROR,c)};t.prototype.handlePlaylistLoaded=function(t,e,r,i,a,n){var s=this.hls;var o=i.type,l=i.level,u=i.id,f=i.groupId,c=i.deliveryDirectives;var d=Se(e,i);var g=Ee(i);var m=typeof i.level==="number"&&g===Te.MAIN?l:undefined;if(!t.fragments.length){var y=new Error("No Segments found in Playlist");s.trigger(h.ERROR,{type:v.NETWORK_ERROR,details:p.LEVEL_EMPTY_ERROR,fatal:false,url:d,error:y,reason:y.message,response:e,context:i,level:m,parent:g,networkDetails:a,stats:r});return}if(!t.targetduration){t.playlistParsingError=new Error("Missing Target Duration")}var T=t.playlistParsingError;if(T){s.trigger(h.ERROR,{type:v.NETWORK_ERROR,details:p.LEVEL_PARSING_ERROR,fatal:false,url:d,error:T,reason:T.message,response:e,context:i,level:m,parent:g,networkDetails:a,stats:r});return}if(t.live&&n){if(n.getCacheAge){t.ageHeader=n.getCacheAge()||0}if(!n.getCacheAge||isNaN(t.ageHeader)){t.ageHeader=0}}switch(o){case ye.MANIFEST:case ye.LEVEL:s.trigger(h.LEVEL_LOADED,{details:t,level:m||0,id:u||0,stats:r,networkDetails:a,deliveryDirectives:c});break;case ye.AUDIO_TRACK:s.trigger(h.AUDIO_TRACK_LOADED,{details:t,id:u||0,groupId:f||"",stats:r,networkDetails:a,deliveryDirectives:c});break;case ye.SUBTITLE_TRACK:s.trigger(h.SUBTITLE_TRACK_LOADED,{details:t,id:u||0,groupId:f||"",stats:r,networkDetails:a,deliveryDirectives:c});break}};return t}();function Le(t,e){var r;try{r=new Event("addtrack")}catch(t){r=document.createEvent("Event");r.initEvent("addtrack",false,false)}r.track=t;e.dispatchEvent(r)}function be(t,e){var r=t.mode;if(r==="disabled"){t.mode="hidden"}if(t.cues&&!t.cues.getCueById(e.id)){try{t.addCue(e);if(!t.cues.getCueById(e.id)){throw new Error("addCue is failed for: ".concat(e))}}catch(r){A.debug("[texttrack-utils]: ".concat(r));try{var i=new self.TextTrackCue(e.startTime,e.endTime,e.text);i.id=e.id;t.addCue(i)}catch(t){A.debug("[texttrack-utils]: Legacy TextTrackCue fallback failed: ".concat(t))}}}if(r==="disabled"){t.mode=r}}function Re(t){var e=t.mode;if(e==="disabled"){t.mode="hidden"}if(t.cues){for(var r=t.cues.length;r--;){t.removeCue(t.cues[r])}}if(e==="disabled"){t.mode=e}}function Ie(t,e,r,i){var a=t.mode;if(a==="disabled"){t.mode="hidden"}if(t.cues&&t.cues.length>0){var n=ke(t.cues,e,r);for(var s=0;s<n.length;s++){if(!i||i(n[s])){t.removeCue(n[s])}}}if(a==="disabled"){t.mode=a}}function De(t,e){if(e<t[0].startTime){return 0}var r=t.length-1;if(e>t[r].endTime){return-1}var i=0;var a=r;while(i<=a){var n=Math.floor((a+i)/2);if(e<t[n].startTime){a=n-1}else if(e>t[n].startTime&&i<r){i=n+1}else{return n}}return t[i].startTime-e<e-t[a].startTime?i:a}function ke(t,e,r){var i=[];var a=De(t,e);if(a>-1){for(var n=a,s=t.length;n<s;n++){var o=t[n];if(o.startTime>=e&&o.endTime<=r){i.push(o)}else if(o.startTime>r){return i}}}return i}var _e={audioId3:"org.id3",dateRange:"com.apple.quicktime.HLS",emsg:"https://aomedia.org/emsg/ID3"};var we=.25;function Ce(){if(typeof self==="undefined")return undefined;return self.VTTCue||self.TextTrackCue}function Pe(t,e,r,i,a){var s=new t(e,r,"");try{s.value=i;if(a){s.type=a}}catch(o){s=new t(e,r,JSON.stringify(a?n({type:a},i):i))}return s}var Oe=function(){var t=Ce();try{t&&new t(0,Number.POSITIVE_INFINITY,"")}catch(t){return Number.MAX_VALUE}return Number.POSITIVE_INFINITY}();function xe(t,e){return t.getTime()/1e3-e}function Fe(t){return Uint8Array.from(t.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}var Me=function(){function t(t){this.hls=void 0;this.id3Track=null;this.media=null;this.dateRangeCuesAppended={};this.hls=t;this._registerListeners()}t.prototype.destroy=function(){this._unregisterListeners();this.id3Track=null;this.media=null;this.dateRangeCuesAppended={};this.hls=null};t.prototype._registerListeners=function(){var t=this.hls;t.on(h.MEDIA_ATTACHED,this.onMediaAttached,this);t.on(h.MEDIA_DETACHING,this.onMediaDetaching,this);t.on(h.MANIFEST_LOADING,this.onManifestLoading,this);t.on(h.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this);t.on(h.BUFFER_FLUSHING,this.onBufferFlushing,this);t.on(h.LEVEL_UPDATED,this.onLevelUpdated,this)};t.prototype._unregisterListeners=function(){var t=this.hls;t.off(h.MEDIA_ATTACHED,this.onMediaAttached,this);t.off(h.MEDIA_DETACHING,this.onMediaDetaching,this);t.off(h.MANIFEST_LOADING,this.onManifestLoading,this);t.off(h.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this);t.off(h.BUFFER_FLUSHING,this.onBufferFlushing,this);t.off(h.LEVEL_UPDATED,this.onLevelUpdated,this)};t.prototype.onMediaAttached=function(t,e){this.media=e.media};t.prototype.onMediaDetaching=function(){if(!this.id3Track){return}Re(this.id3Track);this.id3Track=null;this.media=null;this.dateRangeCuesAppended={}};t.prototype.onManifestLoading=function(){this.dateRangeCuesAppended={}};t.prototype.createTrack=function(t){var e=this.getID3Track(t.textTracks);e.mode="hidden";return e};t.prototype.getID3Track=function(t){if(!this.media){return}for(var e=0;e<t.length;e++){var r=t[e];if(r.kind==="metadata"&&r.label==="id3"){Le(r,this.media);return r}}return this.media.addTextTrack("metadata","id3")};t.prototype.onFragParsingMetadata=function(t,e){if(!this.media){return}var r=this.hls.config,i=r.enableEmsgMetadataCues,a=r.enableID3MetadataCues;if(!i&&!a){return}var n=e.samples;if(!this.id3Track){this.id3Track=this.createTrack(this.media)}var s=Ce();if(!s){return}for(var o=0;o<n.length;o++){var l=n[o].type;if(l===_e.emsg&&!i||!a){continue}var u=st(n[o].data);if(u){var f=n[o].pts;var c=f+n[o].duration;if(c>Oe){c=Oe}var d=c-f;if(d<=0){c=f+we}for(var h=0;h<u.length;h++){var v=u[h];if(!at(v)){this.updateId3CueEnds(f,l);var p=Pe(s,f,c,v,l);if(p){this.id3Track.addCue(p)}}}}}};t.prototype.updateId3CueEnds=function(t,e){var r;var i=(r=this.id3Track)==null?void 0:r.cues;if(i){for(var a=i.length;a--;){var n=i[a];if(n.type===e&&n.startTime<t&&n.endTime===Oe){n.endTime=t}}}};t.prototype.onBufferFlushing=function(t,e){var r=e.startOffset,i=e.endOffset,a=e.type;var n=this,s=n.id3Track,o=n.hls;if(!o){return}var l=o.config,u=l.enableEmsgMetadataCues,f=l.enableID3MetadataCues;if(s&&(u||f)){var c=void 0;if(a==="audio"){c=function(t){return t.type===_e.audioId3&&f}}else if(a==="video"){c=function(t){return t.type===_e.emsg&&u}}else{c=function(t){return t.type===_e.audioId3&&f||t.type===_e.emsg&&u}}Ie(s,r,i,c)}};t.prototype.onLevelUpdated=function(t,e){var r=e.details;if(!this.media||!r.hasProgramDateTime||!this.hls.config.enableDateRangeMetadataCues){return}var i=this,a=i.dateRangeCuesAppended,n=i.id3Track;var s=r.dateRanges;var o=Object.keys(s);if(n){var l=Object.keys(a).filter((function(t){return!o.includes(t)}));var u=function(t){var e=l[t];Object.keys(a[e].cues).forEach((function(t){n.removeCue(a[e].cues[t])}));delete a[e]};for(var c=l.length;c--;){u(c)}}var d=r.fragments[r.fragments.length-1];if(o.length===0||!f(d==null?void 0:d.programDateTime)){return}if(!this.id3Track){this.id3Track=this.createTrack(this.media)}var h=d.programDateTime/1e3-d.start;var v=Ce();var p=function(t){var e=o[t];var r=s[e];var i=a[e];var n=(i==null?void 0:i.cues)||{};var l=(i==null?void 0:i.durationKnown)||false;var u=xe(r.startDate,h);var f=Oe;var c=r.endDate;if(c){f=xe(c,h);l=true}else if(r.endOnNext&&!l){var d=o.reduce((function(t,e){var i=s[e];if(i.class===r.class&&i.id!==e&&i.startDate>r.startDate){t.push(i)}return t}),[]).sort((function(t,e){return t.startDate.getTime()-e.startDate.getTime()}))[0];if(d){f=xe(d.startDate,h);l=true}}var p=Object.keys(r.attr);for(var m=0;m<p.length;m++){var y=p[m];if(!I(y)){continue}var T=n[y];if(T){if(l&&!i.durationKnown){T.endTime=f}}else if(v){var E=r.attr[y];if(D(y)){E=Fe(E)}var S=Pe(v,u,f,{key:y,data:E},_e.dateRange);if(S){S.id=e;g.id3Track.addCue(S);n[y]=S}}}a[e]={cues:n,dateRange:r,durationKnown:l}};var g=this;for(var c=0;c<o.length;c++){p(c)}};return t}();var Ne=function(){function t(t){var e=this;this.hls=void 0;this.config=void 0;this.media=null;this.levelDetails=null;this.currentTime=0;this.stallCount=0;this._latency=null;this.timeupdateHandler=function(){return e.timeupdate()};this.hls=t;this.config=t.config;this.registerListeners()}Object.defineProperty(t.prototype,"latency",{get:function(){return this._latency||0},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"maxLatency",{get:function(){var t=this,e=t.config,r=t.levelDetails;if(e.liveMaxLatencyDuration!==undefined){return e.liveMaxLatencyDuration}return r?e.liveMaxLatencyDurationCount*r.targetduration:0},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"targetLatency",{get:function(){var t=this.levelDetails;if(t===null){return null}var e=t.holdBack,r=t.partHoldBack,i=t.targetduration;var a=this.config,n=a.liveSyncDuration,s=a.liveSyncDurationCount,o=a.lowLatencyMode;var l=this.hls.userConfig;var u=o?r||e:e;if(l.liveSyncDuration||l.liveSyncDurationCount||u===0){u=n!==undefined?n:s*i}var f=i;var c=1;return u+Math.min(this.stallCount*c,f)},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"liveSyncPosition",{get:function(){var t=this.estimateLiveEdge();var e=this.targetLatency;var r=this.levelDetails;if(t===null||e===null||r===null){return null}var i=r.edge;var a=t-e-this.edgeStalled;var n=i-r.totalduration;var s=i-(this.config.lowLatencyMode&&r.partTarget||r.targetduration);return Math.min(Math.max(n,a),s)},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"drift",{get:function(){var t=this.levelDetails;if(t===null){return 1}return t.drift},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"edgeStalled",{get:function(){var t=this.levelDetails;if(t===null){return 0}var e=(this.config.lowLatencyMode&&t.partTarget||t.targetduration)*3;return Math.max(t.age-e,0)},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"forwardBufferLength",{get:function(){var t=this,e=t.media,r=t.levelDetails;if(!e||!r){return 0}var i=e.buffered.length;return(i?e.buffered.end(i-1):r.edge)-this.currentTime},enumerable:false,configurable:true});t.prototype.destroy=function(){this.unregisterListeners();this.onMediaDetaching();this.levelDetails=null;this.hls=this.timeupdateHandler=null};t.prototype.registerListeners=function(){this.hls.on(h.MEDIA_ATTACHED,this.onMediaAttached,this);this.hls.on(h.MEDIA_DETACHING,this.onMediaDetaching,this);this.hls.on(h.MANIFEST_LOADING,this.onManifestLoading,this);this.hls.on(h.LEVEL_UPDATED,this.onLevelUpdated,this);this.hls.on(h.ERROR,this.onError,this)};t.prototype.unregisterListeners=function(){this.hls.off(h.MEDIA_ATTACHED,this.onMediaAttached,this);this.hls.off(h.MEDIA_DETACHING,this.onMediaDetaching,this);this.hls.off(h.MANIFEST_LOADING,this.onManifestLoading,this);this.hls.off(h.LEVEL_UPDATED,this.onLevelUpdated,this);this.hls.off(h.ERROR,this.onError,this)};t.prototype.onMediaAttached=function(t,e){this.media=e.media;this.media.addEventListener("timeupdate",this.timeupdateHandler)};t.prototype.onMediaDetaching=function(){if(this.media){this.media.removeEventListener("timeupdate",this.timeupdateHandler);this.media=null}};t.prototype.onManifestLoading=function(){this.levelDetails=null;this._latency=null;this.stallCount=0};t.prototype.onLevelUpdated=function(t,e){var r=e.details;this.levelDetails=r;if(r.advanced){this.timeupdate()}if(!r.live&&this.media){this.media.removeEventListener("timeupdate",this.timeupdateHandler)}};t.prototype.onError=function(t,e){var r;if(e.details!==p.BUFFER_STALLED_ERROR){return}this.stallCount++;if((r=this.levelDetails)!=null&&r.live){A.warn("[playback-rate-controller]: Stall detected, adjusting target latency")}};t.prototype.timeupdate=function(){var t=this,e=t.media,r=t.levelDetails;if(!e||!r){return}this.currentTime=e.currentTime;var i=this.computeLatency();if(i===null){return}this._latency=i;var a=this.config,n=a.lowLatencyMode,s=a.maxLiveSyncPlaybackRate;if(!n||s===1){return}var o=this.targetLatency;if(o===null){return}var l=i-o;var u=Math.min(this.maxLatency,o+r.targetduration);var f=l<u;if(r.live&&f&&l>.05&&this.forwardBufferLength>1){var c=Math.min(2,Math.max(1,s));var d=Math.round(2/(1+Math.exp(-.75*l-this.edgeStalled))*20)/20;e.playbackRate=Math.min(c,Math.max(1,d))}else if(e.playbackRate!==1&&e.playbackRate!==0){e.playbackRate=1}};t.prototype.estimateLiveEdge=function(){var t=this.levelDetails;if(t===null){return null}return t.edge+t.age};t.prototype.computeLatency=function(){var t=this.estimateLiveEdge();if(t===null){return null}return t-this.currentTime};return t}();var Ue=["NONE","TYPE-0","TYPE-1",null];var Be={No:"",Yes:"YES",v2:"v2"};function Ge(t,e){var r=t.canSkipUntil,i=t.canSkipDateRanges,a=t.endSN;var n=e!==undefined?e-a:0;if(r&&n<r){if(i){return Be.v2}return Be.Yes}return Be.No}var Ke=function(){function t(t,e,r){this.msn=void 0;this.part=void 0;this.skip=void 0;this.msn=t;this.part=e;this.skip=r}t.prototype.addDirectives=function(t){var e=new self.URL(t);if(this.msn!==undefined){e.searchParams.set("_HLS_msn",this.msn.toString())}if(this.part!==undefined){e.searchParams.set("_HLS_part",this.part.toString())}if(this.skip){e.searchParams.set("_HLS_skip",this.skip)}return e.href};return t}();var He=function(){function t(t){this._attrs=void 0;this.audioCodec=void 0;this.bitrate=void 0;this.codecSet=void 0;this.height=void 0;this.id=void 0;this.name=void 0;this.videoCodec=void 0;this.width=void 0;this.unknownCodecs=void 0;this.audioGroupIds=void 0;this.details=void 0;this.fragmentError=0;this.loadError=0;this.loaded=void 0;this.realBitrate=0;this.textGroupIds=void 0;this.url=void 0;this._urlId=0;this.url=[t.url];this._attrs=[t.attrs];this.bitrate=t.bitrate;if(t.details){this.details=t.details}this.id=t.id||0;this.name=t.name;this.width=t.width||0;this.height=t.height||0;this.audioCodec=t.audioCodec;this.videoCodec=t.videoCodec;this.unknownCodecs=t.unknownCodecs;this.codecSet=[t.videoCodec,t.audioCodec].filter((function(t){return t})).join(",").replace(/\.[^.,]+/g,"")}Object.defineProperty(t.prototype,"maxBitrate",{get:function(){return Math.max(this.realBitrate,this.bitrate)},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"attrs",{get:function(){return this._attrs[this._urlId]},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"pathwayId",{get:function(){return this.attrs["PATHWAY-ID"]||"."},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"uri",{get:function(){return this.url[this._urlId]||""},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"urlId",{get:function(){return this._urlId},set:function(t){var e=t%this.url.length;if(this._urlId!==e){this.fragmentError=0;this.loadError=0;this.details=undefined;this._urlId=e}},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"audioGroupId",{get:function(){var t;return(t=this.audioGroupIds)==null?void 0:t[this.urlId]},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"textGroupId",{get:function(){var t;return(t=this.textGroupIds)==null?void 0:t[this.urlId]},enumerable:false,configurable:true});t.prototype.addFallback=function(t){this.url.push(t.url);this._attrs.push(t.attrs)};return t}();function Ve(t,e){var r=e.startPTS;if(f(r)){var i=0;var a=void 0;if(e.sn>t.sn){i=r-t.start;a=t}else{i=t.start-r;a=e}if(a.duration!==i){a.duration=i}}else if(e.sn>t.sn){var n=t.cc===e.cc;if(n&&t.minEndPTS){e.start=t.start+(t.minEndPTS-t.start)}else{e.start=t.start+t.duration}}else{e.start=Math.max(t.start-e.duration,0)}}function je(t,e,r,i,a,n){var s=i-r;if(s<=0){A.warn("Fragment should have a positive duration",e);i=r+e.duration;n=a+e.duration}var o=r;var l=i;var u=e.startPTS;var c=e.endPTS;if(f(u)){var d=Math.abs(u-r);if(!f(e.deltaPTS)){e.deltaPTS=d}else{e.deltaPTS=Math.max(d,e.deltaPTS)}o=Math.max(r,u);r=Math.min(r,u);a=Math.min(a,e.startDTS);l=Math.min(i,c);i=Math.max(i,c);n=Math.max(n,e.endDTS)}var h=r-e.start;if(e.start!==0){e.start=r}e.duration=i-e.start;e.startPTS=r;e.maxStartPTS=o;e.startDTS=a;e.endPTS=i;e.minEndPTS=l;e.endDTS=n;var v=e.sn;if(!t||v<t.startSN||v>t.endSN){return 0}var p;var g=v-t.startSN;var m=t.fragments;m[g]=e;for(p=g;p>0;p--){Ve(m[p],m[p-1])}for(p=g;p<m.length-1;p++){Ve(m[p],m[p+1])}if(t.fragmentHint){Ve(m[m.length-1],t.fragmentHint)}t.PTSKnown=t.alignedSliding=true;return h}function Ye(t,e){var r=null;var i=t.fragments;for(var a=i.length-1;a>=0;a--){var n=i[a].initSegment;if(n){r=n;break}}if(t.fragmentHint){delete t.fragmentHint.endPTS}var s=0;var o;Xe(t,e,(function(t,i){if(t.relurl){s=t.cc-i.cc}if(f(t.startPTS)&&f(t.endPTS)){i.start=i.startPTS=t.startPTS;i.startDTS=t.startDTS;i.maxStartPTS=t.maxStartPTS;i.endPTS=t.endPTS;i.endDTS=t.endDTS;i.minEndPTS=t.minEndPTS;i.duration=t.endPTS-t.startPTS;if(i.duration){o=i}e.PTSKnown=e.alignedSliding=true}i.elementaryStreams=t.elementaryStreams;i.loader=t.loader;i.stats=t.stats;i.urlId=t.urlId;if(t.initSegment){i.initSegment=t.initSegment;r=t.initSegment}}));if(r){var l=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments;l.forEach((function(t){var e;if(!t.initSegment||t.initSegment.relurl===((e=r)==null?void 0:e.relurl)){t.initSegment=r}}))}if(e.skippedSegments){e.deltaUpdateFailed=e.fragments.some((function(t){return!t}));if(e.deltaUpdateFailed){A.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var a=e.skippedSegments;a--;){e.fragments.shift()}e.startSN=e.fragments[0].sn;e.startCC=e.fragments[0].cc}else if(e.canSkipDateRanges){e.dateRanges=We(t.dateRanges,e.dateRanges,e.recentlyRemovedDateranges)}}var u=e.fragments;if(s){A.warn("discontinuity sliding from playlist, take drift into account");for(var a=0;a<u.length;a++){u[a].cc+=s}}if(e.skippedSegments){e.startCC=e.fragments[0].cc}qe(t.partList,e.partList,(function(t,e){e.elementaryStreams=t.elementaryStreams;e.stats=t.stats}));if(o){je(e,o,o.startPTS,o.endPTS,o.startDTS,o.endDTS)}else{ze(t,e)}if(u.length){e.totalduration=e.edge-u[0].start}e.driftStartTime=t.driftStartTime;e.driftStart=t.driftStart;var c=e.advancedDateTime;if(e.advanced&&c){var d=e.edge;if(!e.driftStart){e.driftStartTime=c;e.driftStart=d}e.driftEndTime=c;e.driftEnd=d}else{e.driftEndTime=t.driftEndTime;e.driftEnd=t.driftEnd;e.advancedDateTime=t.advancedDateTime}}function We(t,e,r){var i=o({},t);if(r){r.forEach((function(t){delete i[t]}))}Object.keys(e).forEach((function(t){var r=new k(e[t].attr,i[t]);if(r.isValid){i[t]=r}else{A.warn('Ignoring invalid Playlist Delta Update DATERANGE tag: "'.concat(JSON.stringify(e[t].attr),'"'))}}));return i}function qe(t,e,r){if(t&&e){var i=0;for(var a=0,n=t.length;a<=n;a++){var s=t[a];var o=e[a+i];if(s&&o&&s.index===o.index&&s.fragment.sn===o.fragment.sn){r(s,o)}else{i--}}}}function Xe(t,e,r){var i=e.skippedSegments;var a=Math.max(t.startSN,e.startSN)-e.startSN;var n=(t.fragmentHint?1:0)+(i?e.endSN:Math.min(t.endSN,e.endSN))-e.startSN;var s=e.startSN-t.startSN;var o=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments;var l=t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments;for(var u=a;u<=n;u++){var f=l[s+u];var c=o[u];if(i&&!c&&u<i){c=e.fragments[u]=f}if(f&&c){r(f,c)}}}function ze(t,e){var r=e.startSN+e.skippedSegments-t.startSN;var i=t.fragments;if(r<0||r>=i.length){return}Qe(e,i[r].start)}function Qe(t,e){if(e){var r=t.fragments;for(var i=t.skippedSegments;i<r.length;i++){r[i].start+=e}if(t.fragmentHint){t.fragmentHint.start+=e}}}function $e(t,e){if(e===void 0){e=Infinity}var r=1e3*t.targetduration;if(t.updated){var i=t.fragments;var a=4;if(i.length&&r*a>e){var n=i[i.length-1].duration*1e3;if(n<r){r=n}}}else{r/=2}return Math.round(r)}function Je(t,e,r){if(!(t!=null&&t.details)){return null}var i=t.details;var a=i.fragments[e-i.startSN];if(a){return a}a=i.fragmentHint;if(a&&a.sn===e){return a}if(e<i.startSN&&r&&r.sn===e){return r}return null}function Ze(t,e,r){var i;if(!(t!=null&&t.details)){return null}return tr((i=t.details)==null?void 0:i.partList,e,r)}function tr(t,e,r){if(t){for(var i=t.length;i--;){var a=t[i];if(a.index===r&&a.fragment.sn===e){return a}}}return null}function er(t){switch(t.details){case p.FRAG_LOAD_TIMEOUT:case p.KEY_LOAD_TIMEOUT:case p.LEVEL_LOAD_TIMEOUT:case p.MANIFEST_LOAD_TIMEOUT:return true}return false}function rr(t,e){var r=er(e);return t.default["".concat(r?"timeout":"error","Retry")]}function ir(t,e){var r=t.backoff==="linear"?1:Math.pow(2,e);return Math.min(r*t.retryDelayMs,t.maxRetryDelayMs)}function ar(t){return n(n({},t),{errorRetry:null,timeoutRetry:null})}function nr(t,e,r,i){return!!t&&e<t.maxNumRetry&&(sr(i)||!!r)}function sr(t){return t===0&&navigator.onLine===false||!!t&&(t<400||t>499)}var or={search:function(t,e){var r=0;var i=t.length-1;var a=null;var n=null;while(r<=i){a=(r+i)/2|0;n=t[a];var s=e(n);if(s>0){r=a+1}else if(s<0){i=a-1}else{return n}}return null}};function lr(t,e,r){if(e===null||!Array.isArray(t)||!t.length||!f(e)){return null}var i=t[0].programDateTime;if(e<(i||0)){return null}var a=t[t.length-1].endProgramDateTime;if(e>=(a||0)){return null}r=r||0;for(var n=0;n<t.length;++n){var s=t[n];if(cr(e,r,s)){return s}}return null}function ur(t,e,r,i){if(r===void 0){r=0}if(i===void 0){i=0}var a=null;if(t){a=e[t.sn-e[0].sn+1]||null}else if(r===0&&e[0].start===0){a=e[0]}if(a&&fr(r,i,a)===0){return a}var n=or.search(e,fr.bind(null,r,i));if(n&&(n!==t||!a)){return n}return a}function fr(t,e,r){if(t===void 0){t=0}if(e===void 0){e=0}if(r.start<=t&&r.start+r.duration>t){return 0}var i=Math.min(e,r.duration+(r.deltaPTS?r.deltaPTS:0));if(r.start+r.duration-i<=t){return 1}else if(r.start-i>t&&r.start){return-1}return 0}function cr(t,e,r){var i=Math.min(e,r.duration+(r.deltaPTS?r.deltaPTS:0))*1e3;var a=r.endProgramDateTime||0;return a-i>t}function dr(t,e){return or.search(t,(function(t){if(t.cc<e){return 1}else if(t.cc>e){return-1}else{return 0}}))}var hr=3e5;var vr={DoNothing:0,SendEndCallback:1,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,InsertDiscontinuity:4,RetryRequest:5};var pr={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,SwitchToSDR:4};var gr=function(){function t(t){this.hls=void 0;this.playlistError=0;this.penalizedRenditions={};this.log=void 0;this.warn=void 0;this.error=void 0;this.hls=t;this.log=A.log.bind(A,"[info]:");this.warn=A.warn.bind(A,"[warning]:");this.error=A.error.bind(A,"[error]:");this.registerListeners()}t.prototype.registerListeners=function(){var t=this.hls;t.on(h.ERROR,this.onError,this);t.on(h.MANIFEST_LOADING,this.onManifestLoading,this);t.on(h.LEVEL_UPDATED,this.onLevelUpdated,this)};t.prototype.unregisterListeners=function(){var t=this.hls;if(!t){return}t.off(h.ERROR,this.onError,this);t.off(h.ERROR,this.onErrorOut,this);t.off(h.MANIFEST_LOADING,this.onManifestLoading,this);t.off(h.LEVEL_UPDATED,this.onLevelUpdated,this)};t.prototype.destroy=function(){this.unregisterListeners();this.hls=null;this.penalizedRenditions={}};t.prototype.startLoad=function(t){this.playlistError=0};t.prototype.stopLoad=function(){};t.prototype.getVariantLevelIndex=function(t){return(t==null?void 0:t.type)===Te.MAIN?t.level:this.hls.loadLevel};t.prototype.onManifestLoading=function(){this.playlistError=0;this.penalizedRenditions={}};t.prototype.onLevelUpdated=function(){this.playlistError=0};t.prototype.onError=function(t,e){var r,i;if(e.fatal){return}var a=this.hls;var n=e.context;switch(e.details){case p.FRAG_LOAD_ERROR:case p.FRAG_LOAD_TIMEOUT:case p.KEY_LOAD_ERROR:case p.KEY_LOAD_TIMEOUT:e.errorAction=this.getFragRetryOrSwitchAction(e);return;case p.FRAG_PARSING_ERROR:if((r=e.frag)!=null&&r.gap){e.errorAction={action:vr.DoNothing,flags:pr.None};return}case p.FRAG_GAP:case p.FRAG_DECRYPT_ERROR:{e.errorAction=this.getFragRetryOrSwitchAction(e);e.errorAction.action=vr.SendAlternateToPenaltyBox;return}case p.LEVEL_EMPTY_ERROR:case p.LEVEL_PARSING_ERROR:{var s,o;var l=e.parent===Te.MAIN?e.level:a.loadLevel;if(e.details===p.LEVEL_EMPTY_ERROR&&!!((s=e.context)!=null&&(o=s.levelDetails)!=null&&o.live)){e.errorAction=this.getPlaylistRetryOrSwitchAction(e,l)}else{e.levelRetry=false;e.errorAction=this.getLevelSwitchAction(e,l)}}return;case p.LEVEL_LOAD_ERROR:case p.LEVEL_LOAD_TIMEOUT:if(typeof(n==null?void 0:n.level)==="number"){e.errorAction=this.getPlaylistRetryOrSwitchAction(e,n.level)}return;case p.AUDIO_TRACK_LOAD_ERROR:case p.AUDIO_TRACK_LOAD_TIMEOUT:case p.SUBTITLE_LOAD_ERROR:case p.SUBTITLE_TRACK_LOAD_TIMEOUT:if(n){var u=a.levels[a.loadLevel];if(u&&(n.type===ye.AUDIO_TRACK&&n.groupId===u.audioGroupId||n.type===ye.SUBTITLE_TRACK&&n.groupId===u.textGroupId)){e.errorAction=this.getPlaylistRetryOrSwitchAction(e,a.loadLevel);e.errorAction.action=vr.SendAlternateToPenaltyBox;e.errorAction.flags=pr.MoveAllAlternatesMatchingHost;return}}return;case p.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:{var u=a.levels[a.loadLevel];var f=u==null?void 0:u.attrs["HDCP-LEVEL"];if(f){e.errorAction={action:vr.SendAlternateToPenaltyBox,flags:pr.MoveAllAlternatesMatchingHDCP,hdcpLevel:f}}}return;case p.BUFFER_ADD_CODEC_ERROR:case p.REMUX_ALLOC_ERROR:e.errorAction=this.getLevelSwitchAction(e,(i=e.level)!=null?i:a.loadLevel);return;case p.INTERNAL_EXCEPTION:case p.BUFFER_APPENDING_ERROR:case p.BUFFER_APPEND_ERROR:case p.BUFFER_FULL_ERROR:case p.LEVEL_SWITCH_ERROR:case p.BUFFER_STALLED_ERROR:case p.BUFFER_SEEK_OVER_HOLE:case p.BUFFER_NUDGE_ON_STALL:e.errorAction={action:vr.DoNothing,flags:pr.None};return}if(e.type===v.KEY_SYSTEM_ERROR){var l=this.getVariantLevelIndex(e.frag);e.levelRetry=false;e.errorAction=this.getLevelSwitchAction(e,l);return}};t.prototype.getPlaylistRetryOrSwitchAction=function(t,e){var r;var i=this.hls;var a=rr(i.config.playlistLoadPolicy,t);var n=this.playlistError++;var s=(r=t.response)==null?void 0:r.code;var o=nr(a,n,er(t),s);if(o){return{action:vr.RetryRequest,flags:pr.None,retryConfig:a,retryCount:n}}var l=this.getLevelSwitchAction(t,e);if(a){l.retryConfig=a;l.retryCount=n}return l};t.prototype.getFragRetryOrSwitchAction=function(t){var e=this.hls;var r=this.getVariantLevelIndex(t.frag);var i=e.levels[r];var a=e.config,n=a.fragLoadPolicy,s=a.keyLoadPolicy;var o=rr(t.details.startsWith("key")?s:n,t);var l=e.levels.reduce((function(t,e){return t+e.fragmentError}),0);if(i){var u;if(t.details!==p.FRAG_GAP){i.fragmentError++}var f=(u=t.response)==null?void 0:u.code;var c=nr(o,l,er(t),f);if(c){return{action:vr.RetryRequest,flags:pr.None,retryConfig:o,retryCount:l}}}var d=this.getLevelSwitchAction(t,r);if(o){d.retryConfig=o;d.retryCount=l}return d};t.prototype.getLevelSwitchAction=function(t,e){var r=this.hls;if(e===null||e===undefined){e=r.loadLevel}var i=this.hls.levels[e];if(i){i.loadError++;if(r.autoLevelEnabled){var a,n;var s=-1;var o=r.levels,l=r.loadLevel,u=r.minAutoLevel,f=r.maxAutoLevel;var c=(a=t.frag)==null?void 0:a.type;var d=(n=t.context)!=null?n:{},h=d.type,v=d.groupId;for(var g=o.length;g--;){var m=(g+l)%o.length;if(m!==l&&m>=u&&m<=f&&o[m].loadError===0){var y=o[m];if(t.details===p.FRAG_GAP&&t.frag){var T=o[m].details;if(T){var E=ur(t.frag,T.fragments,t.frag.start);if(E!=null&&E.gap){continue}}}else if(h===ye.AUDIO_TRACK&&v===y.audioGroupId||h===ye.SUBTITLE_TRACK&&v===y.textGroupId){continue}else if(c===Te.AUDIO&&i.audioGroupId===y.audioGroupId||c===Te.SUBTITLE&&i.textGroupId===y.textGroupId){continue}s=m;break}}if(s>-1&&r.loadLevel!==s){t.levelRetry=true;this.playlistError=0;return{action:vr.SendAlternateToPenaltyBox,flags:pr.None,nextAutoLevel:s}}}}return{action:vr.SendAlternateToPenaltyBox,flags:pr.MoveAllAlternatesMatchingHost}};t.prototype.onErrorOut=function(t,e){var r;switch((r=e.errorAction)==null?void 0:r.action){case vr.DoNothing:break;case vr.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(e);if(!e.errorAction.resolved&&e.details!==p.FRAG_GAP){e.fatal=true}break}if(e.fatal){this.hls.stopLoad();return}};t.prototype.sendAlternateToPenaltyBox=function(t){var e=this.hls;var r=t.errorAction;if(!r){return}var i=r.flags,a=r.hdcpLevel,n=r.nextAutoLevel;switch(i){case pr.None:this.switchLevel(t,n);break;case pr.MoveAllAlternatesMatchingHost:{if(!r.resolved){r.resolved=this.redundantFailover(t)}}break;case pr.MoveAllAlternatesMatchingHDCP:if(a){e.maxHdcpLevel=Ue[Ue.indexOf(a)-1];r.resolved=true}this.warn('Restricting playback to HDCP-LEVEL of "'.concat(e.maxHdcpLevel,'" or lower'));break}if(!r.resolved){this.switchLevel(t,n)}};t.prototype.switchLevel=function(t,e){if(e!==undefined&&t.errorAction){this.warn("switching to level ".concat(e," after ").concat(t.details));this.hls.nextAutoLevel=e;t.errorAction.resolved=true;this.hls.nextLoadLevel=this.hls.nextAutoLevel}};t.prototype.redundantFailover=function(t){var e=this,r=e.hls,i=e.penalizedRenditions;var a=t.parent===Te.MAIN?t.level:r.loadLevel;var n=r.levels[a];var s=n.url.length;var o=t.frag?t.frag.urlId:n.urlId;if(n.urlId===o&&(!t.frag||n.details)){this.penalizeRendition(n,t)}var l=function(e){var l=(o+e)%s;var f=i[l];if(!f||mr(f,t,i[o])){u.warn("Switching to Redundant Stream ".concat(l+1,"/").concat(s,': "').concat(n.url[l],'" after ').concat(t.details));u.playlistError=0;r.levels.forEach((function(t){t.urlId=l}));r.nextLoadLevel=a;return{value:true}}};var u=this;for(var f=1;f<s;f++){var c=l(f);if(typeof c==="object")return c.value}return false};t.prototype.penalizeRendition=function(t,e){var r=this.penalizedRenditions;var i=r[t.urlId]||{lastErrorPerfMs:0,errors:[],details:undefined};i.lastErrorPerfMs=performance.now();i.errors.push(e);i.details=t.details;r[t.urlId]=i};return t}();function mr(t,e,r){if(performance.now()-t.lastErrorPerfMs>hr){return true}var i=t.details;if(e.details===p.FRAG_GAP&&i&&e.frag){var a=e.frag.start;var n=ur(null,i.fragments,a);if(n&&!n.gap){return true}}if(r&&t.errors.length<r.errors.length){var s=t.errors[t.errors.length-1];if(i&&s.frag&&e.frag&&Math.abs(s.frag.start-e.frag.start)>i.targetduration*3){return true}}return false}var yr=function(){function t(t,e){this.hls=void 0;this.timer=-1;this.requestScheduled=-1;this.canLoad=false;this.log=void 0;this.warn=void 0;this.log=A.log.bind(A,"".concat(e,":"));this.warn=A.warn.bind(A,"".concat(e,":"));this.hls=t}t.prototype.destroy=function(){this.clearTimer();this.hls=this.log=this.warn=null};t.prototype.clearTimer=function(){clearTimeout(this.timer);this.timer=-1};t.prototype.startLoad=function(){this.canLoad=true;this.requestScheduled=-1;this.loadPlaylist()};t.prototype.stopLoad=function(){this.canLoad=false;this.clearTimer()};t.prototype.switchParams=function(t,e){var r=e==null?void 0:e.renditionReports;if(r){var i=-1;for(var a=0;a<r.length;a++){var n=r[a];var s=void 0;try{s=new self.URL(n.URI,e.url).href}catch(t){A.warn("Could not construct new URL for Rendition Report: ".concat(t));s=n.URI||""}if(s===t){i=a;break}else if(s===t.substring(0,s.length)){i=a}}if(i!==-1){var n=r[i];var o=parseInt(n["LAST-MSN"])||(e==null?void 0:e.lastPartSn);var l=parseInt(n["LAST-PART"])||(e==null?void 0:e.lastPartIndex);if(this.hls.config.lowLatencyMode){var u=Math.min(e.age-e.partTarget,e.targetduration);if(l>=0&&u>e.partTarget){l+=1}}return new Ke(o,l>=0?l:undefined,Be.No)}}};t.prototype.loadPlaylist=function(t){if(this.requestScheduled===-1){this.requestScheduled=self.performance.now()}};t.prototype.shouldLoadPlaylist=function(t){return this.canLoad&&!!t&&!!t.url&&(!t.details||t.details.live)};t.prototype.shouldReloadPlaylist=function(t){return this.timer===-1&&this.requestScheduled===-1&&this.shouldLoadPlaylist(t)};t.prototype.playlistLoaded=function(t,e,r){var i=this;var a=e.details,n=e.stats;var s=self.performance.now();var o=n.loading.first?Math.max(0,s-n.loading.first):0;a.advancedDateTime=Date.now()-o;if(a.live||r!=null&&r.live){a.reloaded(r);if(r){this.log("live playlist ".concat(t," ").concat(a.advanced?"REFRESHED "+a.lastPartSn+"-"+a.lastPartIndex:a.updated?"UPDATED":"MISSED"))}if(r&&a.fragments.length>0){Ye(r,a)}if(!this.canLoad||!a.live){return}var l;var u=undefined;var f=undefined;if(a.canBlockReload&&a.endSN&&a.advanced){var c=this.hls.config.lowLatencyMode;var d=a.lastPartSn;var h=a.endSN;var v=a.lastPartIndex;var p=v!==-1;var g=d===h;var m=c?0:v;if(p){u=g?h+1:d;f=g?m:v+1}else{u=h+1}var y=a.age;var T=y+a.ageHeader;var E=Math.min(T-a.partTarget,a.targetduration*1.5);if(E>0){if(r&&E>r.tuneInGoal){this.warn("CDN Tune-in goal increased from: ".concat(r.tuneInGoal," to: ").concat(E," with playlist age: ").concat(a.age));E=0}else{var S=Math.floor(E/a.targetduration);u+=S;if(f!==undefined){var A=Math.round(E%a.targetduration/a.partTarget);f+=A}this.log("CDN Tune-in age: ".concat(a.ageHeader,"s last advanced ").concat(y.toFixed(2),"s goal: ").concat(E," skip sn ").concat(S," to part ").concat(f))}a.tuneInGoal=E}l=this.getDeliveryDirectives(a,e.deliveryDirectives,u,f);if(c||!g){this.loadPlaylist(l);return}}else if(a.canBlockReload||a.canSkipUntil){l=this.getDeliveryDirectives(a,e.deliveryDirectives,u,f)}var L=this.hls.mainForwardBufferInfo;var b=L?L.end-L.len:0;var R=(a.edge-b)*1e3;var I=$e(a,R);if(a.updated&&s>this.requestScheduled+I){this.requestScheduled=n.loading.start}if(u!==undefined&&a.canBlockReload){this.requestScheduled=n.loading.first+I-(a.partTarget*1e3||1e3)}else if(this.requestScheduled===-1||this.requestScheduled+I<s){this.requestScheduled=s}else if(this.requestScheduled-s<=0){this.requestScheduled+=I}var D=this.requestScheduled-s;D=Math.max(0,D);this.log("reload live playlist ".concat(t," in ").concat(Math.round(D)," ms"));this.timer=self.setTimeout((function(){return i.loadPlaylist(l)}),D)}else{this.clearTimer()}};t.prototype.getDeliveryDirectives=function(t,e,r,i){var a=Ge(t,r);if(e!=null&&e.skip&&t.deltaUpdateFailed){r=e.msn;i=e.part;a=Be.No}return new Ke(r,i,a)};t.prototype.checkRetry=function(t){var e=this;var r=t.details;var i=er(t);var a=t.errorAction;var n=a||{},s=n.action,o=n.retryCount,l=o===void 0?0:o,u=n.retryConfig;var f=!!a&&!!u&&(s===vr.RetryRequest||!a.resolved&&s===vr.SendAlternateToPenaltyBox);if(f){var c;this.requestScheduled=-1;if(l>=u.maxNumRetry){return false}if(i&&(c=t.context)!=null&&c.deliveryDirectives){this.warn("Retrying playlist loading ".concat(l+1,"/").concat(u.maxNumRetry,' after "').concat(r,'" without delivery-directives'));this.loadPlaylist()}else{var d=ir(u,l);this.timer=self.setTimeout((function(){return e.loadPlaylist()}),d);this.warn("Retrying playlist loading ".concat(l+1,"/").concat(u.maxNumRetry,' after "').concat(r,'" in ').concat(d,"ms"))}t.levelRetry=true;a.resolved=true}return f};return t}();var Tr;var Er=function(t){__extends(e,t);function e(e,r){var i=t.call(this,e,"[level-controller]")||this;i._levels=[];i._firstLevel=-1;i._startLevel=void 0;i.currentLevel=null;i.currentLevelIndex=-1;i.manualLevelIndex=-1;i.steering=void 0;i.onParsedComplete=void 0;i.steering=r;i._registerListeners();return i}e.prototype._registerListeners=function(){var t=this.hls;t.on(h.MANIFEST_LOADING,this.onManifestLoading,this);t.on(h.MANIFEST_LOADED,this.onManifestLoaded,this);t.on(h.LEVEL_LOADED,this.onLevelLoaded,this);t.on(h.LEVELS_UPDATED,this.onLevelsUpdated,this);t.on(h.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this);t.on(h.FRAG_LOADED,this.onFragLoaded,this);t.on(h.ERROR,this.onError,this)};e.prototype._unregisterListeners=function(){var t=this.hls;t.off(h.MANIFEST_LOADING,this.onManifestLoading,this);t.off(h.MANIFEST_LOADED,this.onManifestLoaded,this);t.off(h.LEVEL_LOADED,this.onLevelLoaded,this);t.off(h.LEVELS_UPDATED,this.onLevelsUpdated,this);t.off(h.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this);t.off(h.FRAG_LOADED,this.onFragLoaded,this);t.off(h.ERROR,this.onError,this)};e.prototype.destroy=function(){this._unregisterListeners();this.steering=null;this.resetLevels();t.prototype.destroy.call(this)};e.prototype.startLoad=function(){var e=this._levels;e.forEach((function(t){t.loadError=0;t.fragmentError=0}));t.prototype.startLoad.call(this)};e.prototype.resetLevels=function(){this._startLevel=undefined;this.manualLevelIndex=-1;this.currentLevelIndex=-1;this.currentLevel=null;this._levels=[]};e.prototype.onManifestLoading=function(t,e){this.resetLevels()};e.prototype.onManifestLoaded=function(t,e){var r=[];var i={};var a;e.levels.forEach((function(t){var e;var n=t.attrs;if(((e=t.audioCodec)==null?void 0:e.indexOf("mp4a.40.34"))!==-1){Tr||(Tr=/chrome|firefox/i.test(navigator.userAgent));if(Tr){t.audioCodec=undefined}}var s=n.AUDIO,o=n.CODECS,l=n["FRAME-RATE"],u=n["PATHWAY-ID"],f=n.RESOLUTION,c=n.SUBTITLES;var d="".concat(u||".","-");var h="".concat(d).concat(t.bitrate,"-").concat(f,"-").concat(l,"-").concat(o);a=i[h];if(!a){a=new He(t);i[h]=a;r.push(a)}else{a.addFallback(t)}Sr(a,"audio",s);Sr(a,"text",c)}));this.filterAndSortMediaOptions(r,e)};e.prototype.filterAndSortMediaOptions=function(t,e){var r=this;var i=[];var a=[];var n=false;var s=false;var o=false;var l=t.filter((function(t){var e=t.audioCodec,r=t.videoCodec,i=t.width,a=t.height,l=t.unknownCodecs;n||(n=!!(i&&a));s||(s=!!r);o||(o=!!e);return!(l!=null&&l.length)&&(!e||ie(e,"audio"))&&(!r||ie(r,"video"))}));if((n||s)&&o){l=l.filter((function(t){var e=t.videoCodec,r=t.width,i=t.height;return!!e||!!(r&&i)}))}if(l.length===0){Promise.resolve().then((function(){if(r.hls){var t=new Error("no level with compatible codecs found in manifest");r.hls.trigger(h.ERROR,{type:v.MEDIA_ERROR,details:p.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:true,url:e.url,error:t,reason:t.message})}}));return}if(e.audioTracks){i=e.audioTracks.filter((function(t){return!t.audioCodec||ie(t.audioCodec,"audio")}));Ar(i)}if(e.subtitles){a=e.subtitles;Ar(a)}var u=l.slice(0);l.sort((function(t,e){if(t.attrs["HDCP-LEVEL"]!==e.attrs["HDCP-LEVEL"]){return(t.attrs["HDCP-LEVEL"]||"")>(e.attrs["HDCP-LEVEL"]||"")?1:-1}if(t.bitrate!==e.bitrate){return t.bitrate-e.bitrate}if(t.attrs["FRAME-RATE"]!==e.attrs["FRAME-RATE"]){return t.attrs.decimalFloatingPoint("FRAME-RATE")-e.attrs.decimalFloatingPoint("FRAME-RATE")}if(t.attrs.SCORE!==e.attrs.SCORE){return t.attrs.decimalFloatingPoint("SCORE")-e.attrs.decimalFloatingPoint("SCORE")}if(n&&t.height!==e.height){return t.height-e.height}return 0}));var f=u[0];if(this.steering){l=this.steering.filterParsedLevels(l);if(l.length!==u.length){for(var c=0;c<u.length;c++){if(u[c].pathwayId===l[0].pathwayId){f=u[c];break}}}}this._levels=l;for(var c=0;c<l.length;c++){if(l[c]===f){this._firstLevel=c;this.log("manifest loaded, ".concat(l.length," level(s) found, first bitrate: ").concat(f.bitrate));break}}var d=o&&!s;var g={levels:l,audioTracks:i,subtitleTracks:a,sessionData:e.sessionData,sessionKeys:e.sessionKeys,firstLevel:this._firstLevel,stats:e.stats,audio:o,video:s,altAudio:!d&&i.some((function(t){return!!t.url}))};this.hls.trigger(h.MANIFEST_PARSED,g);if(this.hls.config.autoStartLoad||this.hls.forceStartLoad){this.hls.startLoad(this.hls.config.startPosition)}};Object.defineProperty(e.prototype,"levels",{get:function(){if(this._levels.length===0){return null}return this._levels},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"level",{get:function(){return this.currentLevelIndex},set:function(t){var e=this._levels;if(e.length===0){return}if(t<0||t>=e.length){var r=new Error("invalid level idx");var i=t<0;this.hls.trigger(h.ERROR,{type:v.OTHER_ERROR,details:p.LEVEL_SWITCH_ERROR,level:t,fatal:i,error:r,reason:r.message});if(i){return}t=Math.min(t,e.length-1)}var a=this.currentLevelIndex;var n=this.currentLevel;var s=n?n.attrs["PATHWAY-ID"]:undefined;var l=e[t];var u=l.attrs["PATHWAY-ID"];this.currentLevelIndex=t;this.currentLevel=l;if(a===t&&l.details&&n&&s===u){return}this.log("Switching to level ".concat(t).concat(u?" with Pathway "+u:""," from level ").concat(a).concat(s?" with Pathway "+s:""));var f=o({},l,{level:t,maxBitrate:l.maxBitrate,attrs:l.attrs,uri:l.uri,urlId:l.urlId});delete f._attrs;delete f._urlId;this.hls.trigger(h.LEVEL_SWITCHING,f);var c=l.details;if(!c||c.live){var d=this.switchParams(l.uri,n==null?void 0:n.details);this.loadPlaylist(d)}},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"manualLevel",{get:function(){return this.manualLevelIndex},set:function(t){this.manualLevelIndex=t;if(this._startLevel===undefined){this._startLevel=t}if(t!==-1){this.level=t}},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"firstLevel",{get:function(){return this._firstLevel},set:function(t){this._firstLevel=t},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"startLevel",{get:function(){if(this._startLevel===undefined){var t=this.hls.config.startLevel;if(t!==undefined){return t}else{return this._firstLevel}}else{return this._startLevel}},set:function(t){this._startLevel=t},enumerable:false,configurable:true});e.prototype.onError=function(t,e){if(e.fatal||!e.context){return}if(e.context.type===ye.LEVEL&&e.context.level===this.level){this.checkRetry(e)}};e.prototype.onFragLoaded=function(t,e){var r=e.frag;if(r!==undefined&&r.type===Te.MAIN){var i=this._levels[r.level];if(i!==undefined){i.loadError=0}}};e.prototype.onLevelLoaded=function(t,e){var r;var i=e.level,a=e.details;var n=this._levels[i];if(!n){var s;this.warn("Invalid level index ".concat(i));if((s=e.deliveryDirectives)!=null&&s.skip){a.deltaUpdateFailed=true}return}if(i===this.currentLevelIndex){if(n.fragmentError===0){n.loadError=0}this.playlistLoaded(i,e,n.details)}else if((r=e.deliveryDirectives)!=null&&r.skip){a.deltaUpdateFailed=true}};e.prototype.onAudioTrackSwitched=function(t,e){var r=this.currentLevel;if(!r){return}var i=this.hls.audioTracks[e.id].groupId;if(r.audioGroupIds&&r.audioGroupId!==i){var a=-1;for(var n=0;n<r.audioGroupIds.length;n++){if(r.audioGroupIds[n]===i){a=n;break}}if(a!==-1&&a!==r.urlId){r.urlId=a;if(this.canLoad){this.startLoad()}}}};e.prototype.loadPlaylist=function(e){t.prototype.loadPlaylist.call(this);var r=this.currentLevelIndex;var i=this.currentLevel;if(i&&this.shouldLoadPlaylist(i)){var a=i.urlId;var n=i.uri;if(e){try{n=e.addDirectives(n)}catch(t){this.warn("Could not construct new URL with HLS Delivery Directives: ".concat(t))}}var s=i.attrs["PATHWAY-ID"];this.log("Loading level index ".concat(r).concat((e==null?void 0:e.msn)!==undefined?" at sn "+e.msn+" part "+e.part:""," with").concat(s?" Pathway "+s:""," URI ").concat(a+1,"/").concat(i.url.length," ").concat(n));this.clearTimer();this.hls.trigger(h.LEVEL_LOADING,{url:n,level:r,id:a,deliveryDirectives:e||null})}};Object.defineProperty(e.prototype,"nextLoadLevel",{get:function(){if(this.manualLevelIndex!==-1){return this.manualLevelIndex}else{return this.hls.nextAutoLevel}},set:function(t){this.level=t;if(this.manualLevelIndex===-1){this.hls.nextAutoLevel=t}},enumerable:false,configurable:true});e.prototype.removeLevel=function(t,e){var r=this;var i=function(t,r){return r!==e};var a=this._levels.filter((function(a,n){if(n!==t){return true}if(a.url.length>1&&e!==undefined){a.url=a.url.filter(i);if(a.audioGroupIds){a.audioGroupIds=a.audioGroupIds.filter(i)}if(a.textGroupIds){a.textGroupIds=a.textGroupIds.filter(i)}a.urlId=0;return true}if(r.steering){r.steering.removeLevel(a)}return false}));this.hls.trigger(h.LEVELS_UPDATED,{levels:a})};e.prototype.onLevelsUpdated=function(t,e){var r=e.levels;r.forEach((function(t,e){var r=t.details;if(r!=null&&r.fragments){r.fragments.forEach((function(t){t.level=e}))}}));this._levels=r};return e}(yr);function Sr(t,e,r){if(!r){return}if(e==="audio"){if(!t.audioGroupIds){t.audioGroupIds=[]}t.audioGroupIds[t.url.length-1]=r}else if(e==="text"){if(!t.textGroupIds){t.textGroupIds=[]}t.textGroupIds[t.url.length-1]=r}}function Ar(t){var e={};t.forEach((function(t){var r=t.groupId||"";t.id=e[r]=e[r]||0;e[r]++}))}var Lr={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};var br=function(){function t(t){this.activePartLists=Object.create(null);this.endListFragments=Object.create(null);this.fragments=Object.create(null);this.timeRanges=Object.create(null);this.bufferPadding=.2;this.hls=void 0;this.hasGaps=false;this.hls=t;this._registerListeners()}t.prototype._registerListeners=function(){var t=this.hls;t.on(h.BUFFER_APPENDED,this.onBufferAppended,this);t.on(h.FRAG_BUFFERED,this.onFragBuffered,this);t.on(h.FRAG_LOADED,this.onFragLoaded,this)};t.prototype._unregisterListeners=function(){var t=this.hls;t.off(h.BUFFER_APPENDED,this.onBufferAppended,this);t.off(h.FRAG_BUFFERED,this.onFragBuffered,this);t.off(h.FRAG_LOADED,this.onFragLoaded,this)};t.prototype.destroy=function(){this._unregisterListeners();this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null};t.prototype.getAppendedFrag=function(t,e){var r=this.activePartLists[e];if(r){for(var i=r.length;i--;){var a=r[i];if(!a){break}var n=a.end;if(a.start<=t&&n!==null&&t<=n){return a}}}return this.getBufferedFrag(t,e)};t.prototype.getBufferedFrag=function(t,e){var r=this.fragments;var i=Object.keys(r);for(var a=i.length;a--;){var n=r[i[a]];if((n==null?void 0:n.body.type)===e&&n.buffered){var s=n.body;if(s.start<=t&&t<=s.end){return s}}}return null};t.prototype.detectEvictedFragments=function(t,e,r,i){var a=this;if(this.timeRanges){this.timeRanges[t]=e}var n=(i==null?void 0:i.fragment.sn)||-1;Object.keys(this.fragments).forEach((function(i){var s=a.fragments[i];if(!s){return}if(n>=s.body.sn){return}if(!s.buffered&&!s.loaded){if(s.body.type===r){a.removeFragment(s.body)}return}var o=s.range[t];if(!o){return}o.time.some((function(t){var r=!a.isTimeBuffered(t.startPTS,t.endPTS,e);if(r){a.removeFragment(s.body)}return r}))}))};t.prototype.detectPartialFragments=function(t){var e=this;var r=this.timeRanges;var i=t.frag,a=t.part;if(!r||i.sn==="initSegment"){return}var n=Ir(i);var s=this.fragments[n];if(!s||s.buffered&&i.gap){return}var o=!i.relurl;Object.keys(r).forEach((function(t){var n=i.elementaryStreams[t];if(!n){return}var l=r[t];var u=o||n.partial===true;s.range[t]=e.getBufferedTimes(i,a,u,l)}));s.loaded=null;if(Object.keys(s.range).length){s.buffered=true;var l=s.body.endList=i.endList||s.body.endList;if(l){this.endListFragments[s.body.type]=s}if(!Rr(s)){this.removeParts(i.sn-1,i.type)}}else{this.removeFragment(s.body)}};t.prototype.removeParts=function(t,e){var r=this.activePartLists[e];if(!r){return}this.activePartLists[e]=r.filter((function(e){return e.fragment.sn>=t}))};t.prototype.fragBuffered=function(t,e){var r=Ir(t);var i=this.fragments[r];if(!i&&e){i=this.fragments[r]={body:t,appendedPTS:null,loaded:null,buffered:false,range:Object.create(null)};if(t.gap){this.hasGaps=true}}if(i){i.loaded=null;i.buffered=true}};t.prototype.getBufferedTimes=function(t,e,r,i){var a={time:[],partial:r};var n=t.start;var s=t.end;var o=t.minEndPTS||s;var l=t.maxStartPTS||n;for(var u=0;u<i.length;u++){var f=i.start(u)-this.bufferPadding;var c=i.end(u)+this.bufferPadding;if(l>=f&&o<=c){a.time.push({startPTS:Math.max(n,i.start(u)),endPTS:Math.min(s,i.end(u))});break}else if(n<c&&s>f){a.partial=true;a.time.push({startPTS:Math.max(n,i.start(u)),endPTS:Math.min(s,i.end(u))})}else if(s<=f){break}}return a};t.prototype.getPartialFragment=function(t){var e=null;var r;var i;var a;var n=0;var s=this,o=s.bufferPadding,l=s.fragments;Object.keys(l).forEach((function(s){var u=l[s];if(!u){return}if(Rr(u)){i=u.body.start-o;a=u.body.end+o;if(t>=i&&t<=a){r=Math.min(t-i,a-t);if(n<=r){e=u.body;n=r}}}}));return e};t.prototype.isEndListAppended=function(t){var e=this.endListFragments[t];return e!==undefined&&(e.buffered||Rr(e))};t.prototype.getState=function(t){var e=Ir(t);var r=this.fragments[e];if(r){if(!r.buffered){return Lr.APPENDING}else if(Rr(r)){return Lr.PARTIAL}else{return Lr.OK}}return Lr.NOT_LOADED};t.prototype.isTimeBuffered=function(t,e,r){var i;var a;for(var n=0;n<r.length;n++){i=r.start(n)-this.bufferPadding;a=r.end(n)+this.bufferPadding;if(t>=i&&e<=a){return true}if(e<=i){return false}}return false};t.prototype.onFragLoaded=function(t,e){var r=e.frag,i=e.part;if(r.sn==="initSegment"||r.bitrateTest){return}var a=i?null:e;var n=Ir(r);this.fragments[n]={body:r,appendedPTS:null,loaded:a,buffered:false,range:Object.create(null)}};t.prototype.onBufferAppended=function(t,e){var r=this;var i=e.frag,a=e.part,n=e.timeRanges;if(i.sn==="initSegment"){return}var s=i.type;if(a){var o=this.activePartLists[s];if(!o){this.activePartLists[s]=o=[]}o.push(a)}this.timeRanges=n;Object.keys(n).forEach((function(t){var e=n[t];r.detectEvictedFragments(t,e,s,a)}))};t.prototype.onFragBuffered=function(t,e){this.detectPartialFragments(e)};t.prototype.hasFragment=function(t){var e=Ir(t);return!!this.fragments[e]};t.prototype.hasParts=function(t){var e;return!!((e=this.activePartLists[t])!=null&&e.length)};t.prototype.removeFragmentsInRange=function(t,e,r,i,a){var n=this;if(i&&!this.hasGaps){return}Object.keys(this.fragments).forEach((function(s){var o=n.fragments[s];if(!o){return}var l=o.body;if(l.type!==r||i&&!l.gap){return}if(l.start<e&&l.end>t&&(o.buffered||a)){n.removeFragment(l)}}))};t.prototype.removeFragment=function(t){var e=Ir(t);t.stats.loaded=0;t.clearElementaryStreamInfo();var r=this.activePartLists[t.type];if(r){var i=t.sn;this.activePartLists[t.type]=r.filter((function(t){return t.fragment.sn!==i}))}delete this.fragments[e];if(t.endList){delete this.endListFragments[t.type]}};t.prototype.removeAllFragments=function(){this.fragments=Object.create(null);this.endListFragments=Object.create(null);this.activePartLists=Object.create(null);this.hasGaps=false};return t}();function Rr(t){var e,r,i;return t.buffered&&(t.body.gap||((e=t.range.video)==null?void 0:e.partial)||((r=t.range.audio)==null?void 0:r.partial)||((i=t.range.audiovideo)==null?void 0:i.partial))}function Ir(t){return"".concat(t.type,"_").concat(t.level,"_").concat(t.urlId,"_").concat(t.sn)}var Dr=Math.pow(2,17);var kr=function(){function t(t){this.config=void 0;this.loader=null;this.partLoadTimeout=-1;this.config=t}t.prototype.destroy=function(){if(this.loader){this.loader.destroy();this.loader=null}};t.prototype.abort=function(){if(this.loader){this.loader.abort()}};t.prototype.load=function(t,e){var r=this;var i=t.url;if(!i){return Promise.reject(new Cr({type:v.NETWORK_ERROR,details:p.FRAG_LOAD_ERROR,fatal:false,frag:t,error:new Error("Fragment does not have a ".concat(i?"part list":"url")),networkDetails:null}))}this.abort();var a=this.config;var s=a.fLoader;var o=a.loader;return new Promise((function(l,u){if(r.loader){r.loader.destroy()}if(t.gap){if(t.tagList.some((function(t){return t[0]==="GAP"}))){u(wr(t));return}else{t.gap=false}}var f=r.loader=t.loader=s?new s(a):new o(a);var c=_r(t);var d=ar(a.fragLoadPolicy.default);var h={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:t.sn==="initSegment"?Infinity:Dr};t.stats=f.stats;f.load(c,h,{onSuccess:function(e,i,a,n){r.resetLoader(t,f);var s=e.data;if(a.resetIV&&t.decryptdata){t.decryptdata.iv=new Uint8Array(s.slice(0,16));s=s.slice(16)}l({frag:t,part:null,payload:s,networkDetails:n})},onError:function(e,a,s,o){r.resetLoader(t,f);u(new Cr({type:v.NETWORK_ERROR,details:p.FRAG_LOAD_ERROR,fatal:false,frag:t,response:n({url:i,data:undefined},e),error:new Error("HTTP Error ".concat(e.code," ").concat(e.text)),networkDetails:s,stats:o}))},onAbort:function(e,i,a){r.resetLoader(t,f);u(new Cr({type:v.NETWORK_ERROR,details:p.INTERNAL_ABORTED,fatal:false,frag:t,error:new Error("Aborted"),networkDetails:a,stats:e}))},onTimeout:function(e,i,a){r.resetLoader(t,f);u(new Cr({type:v.NETWORK_ERROR,details:p.FRAG_LOAD_TIMEOUT,fatal:false,frag:t,error:new Error("Timeout after ".concat(h.timeout,"ms")),networkDetails:a,stats:e}))},onProgress:function(r,i,a,n){if(e){e({frag:t,part:null,payload:a,networkDetails:n})}}})}))};t.prototype.loadPart=function(t,e,r){var i=this;this.abort();var a=this.config;var s=a.fLoader;var o=a.loader;return new Promise((function(l,u){if(i.loader){i.loader.destroy()}if(t.gap||e.gap){u(wr(t,e));return}var f=i.loader=t.loader=s?new s(a):new o(a);var c=_r(t,e);var d=ar(a.fragLoadPolicy.default);var h={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:Dr};e.stats=f.stats;f.load(c,h,{onSuccess:function(a,n,s,o){i.resetLoader(t,f);i.updateStatsFromPart(t,e);var u={frag:t,part:e,payload:a.data,networkDetails:o};r(u);l(u)},onError:function(r,a,s,o){i.resetLoader(t,f);u(new Cr({type:v.NETWORK_ERROR,details:p.FRAG_LOAD_ERROR,fatal:false,frag:t,part:e,response:n({url:c.url,data:undefined},r),error:new Error("HTTP Error ".concat(r.code," ").concat(r.text)),networkDetails:s,stats:o}))},onAbort:function(r,a,n){t.stats.aborted=e.stats.aborted;i.resetLoader(t,f);u(new Cr({type:v.NETWORK_ERROR,details:p.INTERNAL_ABORTED,fatal:false,frag:t,part:e,error:new Error("Aborted"),networkDetails:n,stats:r}))},onTimeout:function(r,a,n){i.resetLoader(t,f);u(new Cr({type:v.NETWORK_ERROR,details:p.FRAG_LOAD_TIMEOUT,fatal:false,frag:t,part:e,error:new Error("Timeout after ".concat(h.timeout,"ms")),networkDetails:n,stats:r}))}})}))};t.prototype.updateStatsFromPart=function(t,e){var r=t.stats;var i=e.stats;var a=i.total;r.loaded+=i.loaded;if(a){var n=Math.round(t.duration/e.duration);var s=Math.min(Math.round(r.loaded/a),n);var o=n-s;var l=o*Math.round(r.loaded/s);r.total=r.loaded+l}else{r.total=Math.max(r.loaded,r.total)}var u=r.loading;var f=i.loading;if(u.start){u.first+=f.first-f.start}else{u.start=f.start;u.first=f.first}u.end=f.end};t.prototype.resetLoader=function(t,e){t.loader=null;if(this.loader===e){self.clearTimeout(this.partLoadTimeout);this.loader=null}e.destroy()};return t}();function _r(t,e){if(e===void 0){e=null}var r=e||t;var i={frag:t,part:e,responseType:"arraybuffer",url:r.url,headers:{},rangeStart:0,rangeEnd:0};var a=r.byteRangeStartOffset;var n=r.byteRangeEndOffset;if(f(a)&&f(n)){var s;var o=a;var l=n;if(t.sn==="initSegment"&&((s=t.decryptdata)==null?void 0:s.method)==="AES-128"){var u=n-a;if(u%16){l=n+(16-u%16)}if(a!==0){i.resetIV=true;o=a-16}}i.rangeStart=o;i.rangeEnd=l}return i}function wr(t,e){var r=new Error("GAP ".concat(t.gap?"tag":"attribute"," found"));var i={type:v.MEDIA_ERROR,details:p.FRAG_GAP,fatal:false,frag:t,error:r,networkDetails:null};if(e){i.part=e}(e?e:t).stats.aborted=true;return new Cr(i)}var Cr=function(t){__extends(e,t);function e(e){var r=t.call(this,e.error.message)||this;r.data=void 0;r.data=e;return r}return e}(Error);var Pr=function(){function t(t){this.config=void 0;this.keyUriToKeyInfo={};this.emeController=null;this.config=t}t.prototype.abort=function(t){for(var e in this.keyUriToKeyInfo){var r=this.keyUriToKeyInfo[e].loader;if(r){if(t&&t!==r.context.frag.type){return}r.abort()}}};t.prototype.detach=function(){for(var t in this.keyUriToKeyInfo){var e=this.keyUriToKeyInfo[t];if(e.mediaKeySessionContext||e.decryptdata.isCommonEncryption){delete this.keyUriToKeyInfo[t]}}};t.prototype.destroy=function(){this.detach();for(var t in this.keyUriToKeyInfo){var e=this.keyUriToKeyInfo[t].loader;if(e){e.destroy()}}this.keyUriToKeyInfo={}};t.prototype.createKeyLoadError=function(t,e,r,i,a){if(e===void 0){e=p.KEY_LOAD_ERROR}return new Cr({type:v.NETWORK_ERROR,details:e,fatal:false,frag:t,response:a,error:r,networkDetails:i})};t.prototype.loadClear=function(t,e){if(this.emeController&&this.config.emeEnabled){var r=t.sn,i=t.cc;var a=function(t){var a=e[t];if(i<=a.cc&&(r==="initSegment"||a.sn==="initSegment"||r<a.sn)){n.emeController.selectKeySystemFormat(a).then((function(t){a.setKeyFormat(t)}));return"break"}};var n=this;for(var s=0;s<e.length;s++){var o=a(s);if(o==="break")break}}};t.prototype.load=function(t){var e=this;if(!t.decryptdata&&t.encrypted&&this.emeController){return this.emeController.selectKeySystemFormat(t).then((function(r){return e.loadInternal(t,r)}))}return this.loadInternal(t)};t.prototype.loadInternal=function(t,e){var r,i;if(e){t.setKeyFormat(e)}var a=t.decryptdata;if(!a){var n=new Error(e?"Expected frag.decryptdata to be defined after setting format ".concat(e):"Missing decryption data on fragment in onKeyLoading");return Promise.reject(this.createKeyLoadError(t,p.KEY_LOAD_ERROR,n))}var s=a.uri;if(!s){return Promise.reject(this.createKeyLoadError(t,p.KEY_LOAD_ERROR,new Error('Invalid key URI: "'.concat(s,'"'))))}var o=this.keyUriToKeyInfo[s];if((r=o)!=null&&r.decryptdata.key){a.key=o.decryptdata.key;return Promise.resolve({frag:t,keyInfo:o})}if((i=o)!=null&&i.keyLoadPromise){var l;switch((l=o.mediaKeySessionContext)==null?void 0:l.keyStatus){case undefined:case"status-pending":case"usable":case"usable-in-future":return o.keyLoadPromise.then((function(e){a.key=e.keyInfo.decryptdata.key;return{frag:t,keyInfo:o}}))}}o=this.keyUriToKeyInfo[s]={decryptdata:a,keyLoadPromise:null,loader:null,mediaKeySessionContext:null};switch(a.method){case"ISO-23001-7":case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":if(a.keyFormat==="identity"){return this.loadKeyHTTP(o,t)}return this.loadKeyEME(o,t);case"AES-128":return this.loadKeyHTTP(o,t);default:return Promise.reject(this.createKeyLoadError(t,p.KEY_LOAD_ERROR,new Error('Key supplied with unsupported METHOD: "'.concat(a.method,'"'))))}};t.prototype.loadKeyEME=function(t,e){var r={frag:e,keyInfo:t};if(this.emeController&&this.config.emeEnabled){var i=this.emeController.loadKey(r);if(i){return(t.keyLoadPromise=i.then((function(e){t.mediaKeySessionContext=e;return r}))).catch((function(e){t.keyLoadPromise=null;throw e}))}}return Promise.resolve(r)};t.prototype.loadKeyHTTP=function(t,e){var r=this;var i=this.config;var a=i.loader;var s=new a(i);e.keyLoader=t.loader=s;return t.keyLoadPromise=new Promise((function(a,o){var l={keyInfo:t,frag:e,responseType:"arraybuffer",url:t.decryptdata.uri};var u=i.keyLoadPolicy.default;var f={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0};var c={onSuccess:function(t,e,i,n){var s=i.frag,l=i.keyInfo,u=i.url;if(!s.decryptdata||l!==r.keyUriToKeyInfo[u]){return o(r.createKeyLoadError(s,p.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),n))}l.decryptdata.key=s.decryptdata.key=new Uint8Array(t.data);s.keyLoader=null;l.loader=null;a({frag:s,keyInfo:l})},onError:function(t,i,a,s){r.resetLoader(i);o(r.createKeyLoadError(e,p.KEY_LOAD_ERROR,new Error("HTTP Error ".concat(t.code," loading key ").concat(t.text)),a,n({url:l.url,data:undefined},t)))},onTimeout:function(t,i,a){r.resetLoader(i);o(r.createKeyLoadError(e,p.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),a))},onAbort:function(t,i,a){r.resetLoader(i);o(r.createKeyLoadError(e,p.INTERNAL_ABORTED,new Error("key loading aborted"),a))}};s.load(l,f,c)}))};t.prototype.resetLoader=function(t){var e=t.frag,r=t.keyInfo,i=t.url;var a=r.loader;if(e.keyLoader===a){e.keyLoader=null;r.loader=null}delete this.keyUriToKeyInfo[i];if(a){a.destroy()}};return t}();var Or=function(){function t(){this._boundTick=void 0;this._tickTimer=null;this._tickInterval=null;this._tickCallCount=0;this._boundTick=this.tick.bind(this)}t.prototype.destroy=function(){this.onHandlerDestroying();this.onHandlerDestroyed()};t.prototype.onHandlerDestroying=function(){this.clearNextTick();this.clearInterval()};t.prototype.onHandlerDestroyed=function(){};t.prototype.hasInterval=function(){return!!this._tickInterval};t.prototype.hasNextTick=function(){return!!this._tickTimer};t.prototype.setInterval=function(t){if(!this._tickInterval){this._tickCallCount=0;this._tickInterval=self.setInterval(this._boundTick,t);return true}return false};t.prototype.clearInterval=function(){if(this._tickInterval){self.clearInterval(this._tickInterval);this._tickInterval=null;return true}return false};t.prototype.clearNextTick=function(){if(this._tickTimer){self.clearTimeout(this._tickTimer);this._tickTimer=null;return true}return false};t.prototype.tick=function(){this._tickCallCount++;if(this._tickCallCount===1){this.doTick();if(this._tickCallCount>1){this.tickImmediate()}this._tickCallCount=0}};t.prototype.tickImmediate=function(){this.clearNextTick();this._tickTimer=self.setTimeout(this._boundTick,0)};t.prototype.doTick=function(){};return t}();var xr={length:0,start:function(){return 0},end:function(){return 0}};var Fr=function(){function t(){}t.isBuffered=function(e,r){try{if(e){var i=t.getBuffered(e);for(var a=0;a<i.length;a++){if(r>=i.start(a)&&r<=i.end(a)){return true}}}}catch(t){}return false};t.bufferInfo=function(e,r,i){try{if(e){var a=t.getBuffered(e);var n=[];var s=void 0;for(s=0;s<a.length;s++){n.push({start:a.start(s),end:a.end(s)})}return this.bufferedInfo(n,r,i)}}catch(t){}return{len:0,start:r,end:r,nextStart:undefined}};t.bufferedInfo=function(t,e,r){e=Math.max(0,e);t.sort((function(t,e){var r=t.start-e.start;if(r){return r}else{return e.end-t.end}}));var i=[];if(r){for(var a=0;a<t.length;a++){var n=i.length;if(n){var s=i[n-1].end;if(t[a].start-s<r){if(t[a].end>s){i[n-1].end=t[a].end}}else{i.push(t[a])}}else{i.push(t[a])}}}else{i=t}var o=0;var l;var u=e;var f=e;for(var a=0;a<i.length;a++){var c=i[a].start;var d=i[a].end;if(e+r>=c&&e<d){u=c;f=d;o=f-e}else if(e+r<c){l=c;break}}return{len:o,start:u||0,end:f||0,nextStart:l}};t.getBuffered=function(t){try{return t.buffered}catch(t){A.log("failed to get media.buffered",t);return xr}};return t}();var Mr=function(){function t(t,e,r,i,a,n){if(i===void 0){i=0}if(a===void 0){a=-1}if(n===void 0){n=false}this.level=void 0;this.sn=void 0;this.part=void 0;this.id=void 0;this.size=void 0;this.partial=void 0;this.transmuxing=Nr();this.buffering={audio:Nr(),video:Nr(),audiovideo:Nr()};this.level=t;this.sn=e;this.id=r;this.size=i;this.part=a;this.partial=n}return t}();function Nr(){return{start:0,executeStart:0,executeEnd:0,end:0}}function Ur(t,e){var r=null;for(var i=0,a=t.length;i<a;i++){var n=t[i];if(n&&n.cc===e){r=n;break}}return r}function Br(t,e,r){if(e.details){if(r.endCC>r.startCC||t&&t.cc<r.startCC){return true}}return false}function Gr(t,e,r){if(r===void 0){r=0}var i=t.fragments;var a=e.fragments;if(!a.length||!i.length){A.log("No fragments to align");return}var n=Ur(i,a[0].cc);if(!n||n&&!n.startPTS){A.log("No frag in previous level to align on");return}return n}function Kr(t,e){if(t){var r=t.start+e;t.start=t.startPTS=r;t.endPTS=r+t.duration}}function Hr(t,e){var r=e.fragments;for(var i=0,a=r.length;i<a;i++){Kr(r[i],t)}if(e.fragmentHint){Kr(e.fragmentHint,t)}e.alignedSliding=true}function Vr(t,e,r){if(!e){return}jr(t,r,e);if(!r.alignedSliding&&e.details){Yr(r,e.details)}if(!r.alignedSliding&&e.details&&!r.skippedSegments){ze(e.details,r)}}function jr(t,e,r){if(Br(t,r,e)){var i=Gr(r.details,e);if(i&&f(i.start)){A.log("Adjusting PTS using last level due to CC increase within current level ".concat(e.url));Hr(i.start,e)}}}function Yr(t,e){if(!e.fragments.length||!t.hasProgramDateTime||!e.hasProgramDateTime){return}var r=e.fragments[0].programDateTime;var i=t.fragments[0].programDateTime;var a=(i-r)/1e3+e.fragments[0].start;if(a&&f(a)){A.log("Adjusting PTS using programDateTime delta ".concat(i-r,"ms, sliding:").concat(a.toFixed(3)," ").concat(t.url," "));Hr(a,t)}}function Wr(t,e){if(!t.hasProgramDateTime||!e.hasProgramDateTime){return}var r=t.fragments;var i=e.fragments;if(!r.length||!i.length){return}var a=Math.round(i.length/2)-1;var n=i[a];var s=Ur(r,n.cc)||r[Math.round(r.length/2)-1];var o=n.programDateTime;var l=s.programDateTime;if(o===null||l===null){return}var u=(l-o)/1e3-(s.start-n.start);Hr(u,t)}var qr=function(){function t(t,e){this.subtle=void 0;this.aesIV=void 0;this.subtle=t;this.aesIV=e}t.prototype.decrypt=function(t,e){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},e,t)};return t}();var Xr=function(){function t(t,e){this.subtle=void 0;this.key=void 0;this.subtle=t;this.key=e}t.prototype.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},false,["encrypt","decrypt"])};return t}();function zr(t){var e=t.byteLength;var r=e&&new DataView(t.buffer).getUint8(e-1);if(r){return $(t,0,e-r)}return t}var Qr=function(){function t(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54];this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)];this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)];this.sBox=new Uint32Array(256);this.invSBox=new Uint32Array(256);this.key=new Uint32Array(0);this.ksRows=0;this.keySize=0;this.keySchedule=void 0;this.invKeySchedule=void 0;this.initTable()}t.prototype.uint8ArrayToUint32Array_=function(t){var e=new DataView(t);var r=new Uint32Array(4);for(var i=0;i<4;i++){r[i]=e.getUint32(i*4)}return r};t.prototype.initTable=function(){var t=this.sBox;var e=this.invSBox;var r=this.subMix;var i=r[0];var a=r[1];var n=r[2];var s=r[3];var o=this.invSubMix;var l=o[0];var u=o[1];var f=o[2];var c=o[3];var d=new Uint32Array(256);var h=0;var v=0;var p=0;for(p=0;p<256;p++){if(p<128){d[p]=p<<1}else{d[p]=p<<1^283}}for(p=0;p<256;p++){var g=v^v<<1^v<<2^v<<3^v<<4;g=g>>>8^g&255^99;t[h]=g;e[g]=h;var m=d[h];var y=d[m];var T=d[y];var E=d[g]*257^g*16843008;i[h]=E<<24|E>>>8;a[h]=E<<16|E>>>16;n[h]=E<<8|E>>>24;s[h]=E;E=T*16843009^y*65537^m*257^h*16843008;l[g]=E<<24|E>>>8;u[g]=E<<16|E>>>16;f[g]=E<<8|E>>>24;c[g]=E;if(!h){h=v=1}else{h=m^d[d[d[T^m]]];v^=d[d[v]]}}};t.prototype.expandKey=function(t){var e=this.uint8ArrayToUint32Array_(t);var r=true;var i=0;while(i<e.length&&r){r=e[i]===this.key[i];i++}if(r){return}this.key=e;var a=this.keySize=e.length;if(a!==4&&a!==6&&a!==8){throw new Error("Invalid aes key size="+a)}var n=this.ksRows=(a+6+1)*4;var s;var o;var l=this.keySchedule=new Uint32Array(n);var u=this.invKeySchedule=new Uint32Array(n);var f=this.sBox;var c=this.rcon;var d=this.invSubMix;var h=d[0];var v=d[1];var p=d[2];var g=d[3];var m;var y;for(s=0;s<n;s++){if(s<a){m=l[s]=e[s];continue}y=m;if(s%a===0){y=y<<8|y>>>24;y=f[y>>>24]<<24|f[y>>>16&255]<<16|f[y>>>8&255]<<8|f[y&255];y^=c[s/a|0]<<24}else if(a>6&&s%a===4){y=f[y>>>24]<<24|f[y>>>16&255]<<16|f[y>>>8&255]<<8|f[y&255]}l[s]=m=(l[s-a]^y)>>>0}for(o=0;o<n;o++){s=n-o;if(o&3){y=l[s]}else{y=l[s-4]}if(o<4||s<=4){u[o]=y}else{u[o]=h[f[y>>>24]]^v[f[y>>>16&255]]^p[f[y>>>8&255]]^g[f[y&255]]}u[o]=u[o]>>>0}};t.prototype.networkToHostOrderSwap=function(t){return t<<24|(t&65280)<<8|(t&16711680)>>8|t>>>24};t.prototype.decrypt=function(t,e,r){var i=this.keySize+6;var a=this.invKeySchedule;var n=this.invSBox;var s=this.invSubMix;var o=s[0];var l=s[1];var u=s[2];var f=s[3];var c=this.uint8ArrayToUint32Array_(r);var d=c[0];var h=c[1];var v=c[2];var p=c[3];var g=new Int32Array(t);var m=new Int32Array(g.length);var y,T,E,S;var A,L,b,R;var I,D,k,_;var w,C;var P=this.networkToHostOrderSwap;while(e<g.length){I=P(g[e]);D=P(g[e+1]);k=P(g[e+2]);_=P(g[e+3]);A=I^a[0];L=_^a[1];b=k^a[2];R=D^a[3];w=4;for(C=1;C<i;C++){y=o[A>>>24]^l[L>>16&255]^u[b>>8&255]^f[R&255]^a[w];T=o[L>>>24]^l[b>>16&255]^u[R>>8&255]^f[A&255]^a[w+1];E=o[b>>>24]^l[R>>16&255]^u[A>>8&255]^f[L&255]^a[w+2];S=o[R>>>24]^l[A>>16&255]^u[L>>8&255]^f[b&255]^a[w+3];A=y;L=T;b=E;R=S;w=w+4}y=n[A>>>24]<<24^n[L>>16&255]<<16^n[b>>8&255]<<8^n[R&255]^a[w];T=n[L>>>24]<<24^n[b>>16&255]<<16^n[R>>8&255]<<8^n[A&255]^a[w+1];E=n[b>>>24]<<24^n[R>>16&255]<<16^n[A>>8&255]<<8^n[L&255]^a[w+2];S=n[R>>>24]<<24^n[A>>16&255]<<16^n[L>>8&255]<<8^n[b&255]^a[w+3];m[e]=P(y^d);m[e+1]=P(S^h);m[e+2]=P(E^v);m[e+3]=P(T^p);d=I;h=D;v=k;p=_;e=e+4}return m.buffer};return t}();var $r=16;var Jr=function(){function t(t,e){var r=e===void 0?{}:e,i=r.removePKCS7Padding,a=i===void 0?true:i;this.logEnabled=true;this.removePKCS7Padding=void 0;this.subtle=null;this.softwareDecrypter=null;this.key=null;this.fastAesKey=null;this.remainderData=null;this.currentIV=null;this.currentResult=null;this.useSoftware=void 0;this.useSoftware=t.enableSoftwareAES;this.removePKCS7Padding=a;if(a){try{var n=self.crypto;if(n){this.subtle=n.subtle||n.webkitSubtle}}catch(t){}}if(this.subtle===null){this.useSoftware=true}}t.prototype.destroy=function(){this.subtle=null;this.softwareDecrypter=null;this.key=null;this.fastAesKey=null;this.remainderData=null;this.currentIV=null;this.currentResult=null};t.prototype.isSync=function(){return this.useSoftware};t.prototype.flush=function(){var t=this,e=t.currentResult,r=t.remainderData;if(!e||r){this.reset();return null}var i=new Uint8Array(e);this.reset();if(this.removePKCS7Padding){return zr(i)}return i};t.prototype.reset=function(){this.currentResult=null;this.currentIV=null;this.remainderData=null;if(this.softwareDecrypter){this.softwareDecrypter=null}};t.prototype.decrypt=function(t,e,r){var i=this;if(this.useSoftware){return new Promise((function(a,n){i.softwareDecrypt(new Uint8Array(t),e,r);var s=i.flush();if(s){a(s.buffer)}else{n(new Error("[softwareDecrypt] Failed to decrypt data"))}}))}return this.webCryptoDecrypt(new Uint8Array(t),e,r)};t.prototype.softwareDecrypt=function(t,e,r){var i=this,a=i.currentIV,n=i.currentResult,s=i.remainderData;this.logOnce("JS AES decrypt");if(s){t=xt(s,t);this.remainderData=null}var o=this.getValidChunk(t);if(!o.length){return null}if(a){r=a}var l=this.softwareDecrypter;if(!l){l=this.softwareDecrypter=new Qr}l.expandKey(e);var u=n;this.currentResult=l.decrypt(o.buffer,0,r);this.currentIV=$(o,-16).buffer;if(!u){return null}return u};t.prototype.webCryptoDecrypt=function(t,e,r){var i=this;var a=this.subtle;if(this.key!==e||!this.fastAesKey){this.key=e;this.fastAesKey=new Xr(a,e)}return this.fastAesKey.expandKey().then((function(e){if(!a){return Promise.reject(new Error("web crypto not initialized"))}i.logOnce("WebCrypto AES decrypt");var n=new qr(a,new Uint8Array(r));return n.decrypt(t.buffer,e)})).catch((function(a){A.warn("[decrypter]: WebCrypto Error, disable WebCrypto API, ".concat(a.name,": ").concat(a.message));return i.onWebCryptoError(t,e,r)}))};t.prototype.onWebCryptoError=function(t,e,r){this.useSoftware=true;this.logEnabled=true;this.softwareDecrypt(t,e,r);var i=this.flush();if(i){return i.buffer}throw new Error("WebCrypto and softwareDecrypt: failed to decrypt data")};t.prototype.getValidChunk=function(t){var e=t;var r=t.length-t.length%$r;if(r!==t.length){e=$(t,0,r);this.remainderData=$(t,r)}return e};t.prototype.logOnce=function(t){if(!this.logEnabled){return}A.log("[decrypter]: ".concat(t));this.logEnabled=false};return t}();var Zr={toString:function(t){var e="";var r=t.length;for(var i=0;i<r;i++){e+="[".concat(t.start(i).toFixed(3),"-").concat(t.end(i).toFixed(3),"]")}return e}};var ti={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"};var ei=function(t){__extends(e,t);function e(e,r,i,a,n){var s=t.call(this)||this;s.hls=void 0;s.fragPrevious=null;s.fragCurrent=null;s.fragmentTracker=void 0;s.transmuxer=null;s._state=ti.STOPPED;s.playlistType=void 0;s.media=null;s.mediaBuffer=null;s.config=void 0;s.bitrateTest=false;s.lastCurrentTime=0;s.nextLoadPosition=0;s.startPosition=0;s.startTimeOffset=null;s.loadedmetadata=false;s.retryDate=0;s.levels=null;s.fragmentLoader=void 0;s.keyLoader=void 0;s.levelLastLoaded=null;s.startFragRequested=false;s.decrypter=void 0;s.initPTS=[];s.onvseeking=null;s.onvended=null;s.logPrefix="";s.log=void 0;s.warn=void 0;s.playlistType=n;s.logPrefix=a;s.log=A.log.bind(A,"".concat(a,":"));s.warn=A.warn.bind(A,"".concat(a,":"));s.hls=e;s.fragmentLoader=new kr(e.config);s.keyLoader=i;s.fragmentTracker=r;s.config=e.config;s.decrypter=new Jr(e.config);e.on(h.MANIFEST_LOADED,s.onManifestLoaded,s);return s}e.prototype.doTick=function(){this.onTickEnd()};e.prototype.onTickEnd=function(){};e.prototype.startLoad=function(t){};e.prototype.stopLoad=function(){this.fragmentLoader.abort();this.keyLoader.abort(this.playlistType);var t=this.fragCurrent;if(t!=null&&t.loader){t.abortRequests();this.fragmentTracker.removeFragment(t)}this.resetTransmuxer();this.fragCurrent=null;this.fragPrevious=null;this.clearInterval();this.clearNextTick();this.state=ti.STOPPED};e.prototype._streamEnded=function(t,e){if(e.live||t.nextStart||!t.end||!this.media){return false}var r=e.partList;if(r!=null&&r.length){var i=r[r.length-1];var a=Fr.isBuffered(this.media,i.start+i.duration/2);return a}var n=e.fragments[e.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(n)};e.prototype.getLevelDetails=function(){if(this.levels&&this.levelLastLoaded!==null){var t;return(t=this.levels[this.levelLastLoaded])==null?void 0:t.details}};e.prototype.onMediaAttached=function(t,e){var r=this.media=this.mediaBuffer=e.media;this.onvseeking=this.onMediaSeeking.bind(this);this.onvended=this.onMediaEnded.bind(this);r.addEventListener("seeking",this.onvseeking);r.addEventListener("ended",this.onvended);var i=this.config;if(this.levels&&i.autoStartLoad&&this.state===ti.STOPPED){this.startLoad(i.startPosition)}};e.prototype.onMediaDetaching=function(){var t=this.media;if(t!=null&&t.ended){this.log("MSE detaching and video ended, reset startPosition");this.startPosition=this.lastCurrentTime=0}if(t&&this.onvseeking&&this.onvended){t.removeEventListener("seeking",this.onvseeking);t.removeEventListener("ended",this.onvended);this.onvseeking=this.onvended=null}if(this.keyLoader){this.keyLoader.detach()}this.media=this.mediaBuffer=null;this.loadedmetadata=false;this.fragmentTracker.removeAllFragments();this.stopLoad()};e.prototype.onMediaSeeking=function(){var t=this,e=t.config,r=t.fragCurrent,i=t.media,a=t.mediaBuffer,n=t.state;var s=i?i.currentTime:0;var o=Fr.bufferInfo(a?a:i,s,e.maxBufferHole);this.log("media seeking to ".concat(f(s)?s.toFixed(3):s,", state: ").concat(n));if(this.state===ti.ENDED){this.resetLoadingState()}else if(r){var l=e.maxFragLookUpTolerance;var u=r.start-l;var c=r.start+r.duration+l;if(!o.len||c<o.start||u>o.end){var d=s>c;if(s<u||d){if(d&&r.loader){this.log("seeking outside of buffer while fragment load in progress, cancel fragment load");r.abortRequests();this.resetLoadingState()}this.fragPrevious=null}}}if(i){this.fragmentTracker.removeFragmentsInRange(s,Infinity,this.playlistType,true);this.lastCurrentTime=s}if(!this.loadedmetadata&&!o.len){this.nextLoadPosition=this.startPosition=s}this.tickImmediate()};e.prototype.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0};e.prototype.onManifestLoaded=function(t,e){this.startTimeOffset=e.startTimeOffset;this.initPTS=[]};e.prototype.onHandlerDestroying=function(){this.stopLoad();t.prototype.onHandlerDestroying.call(this)};e.prototype.onHandlerDestroyed=function(){this.state=ti.STOPPED;if(this.fragmentLoader){this.fragmentLoader.destroy()}if(this.keyLoader){this.keyLoader.destroy()}if(this.decrypter){this.decrypter.destroy()}this.hls=this.log=this.warn=this.decrypter=this.keyLoader=this.fragmentLoader=this.fragmentTracker=null;t.prototype.onHandlerDestroyed.call(this)};e.prototype.loadFragment=function(t,e,r){this._loadFragForPlayback(t,e,r)};e.prototype._loadFragForPlayback=function(t,e,r){var i=this;var a=function(e){if(i.fragContextChanged(t)){i.warn("Fragment ".concat(t.sn).concat(e.part?" p: "+e.part.index:""," of level ").concat(t.level," was dropped during download."));i.fragmentTracker.removeFragment(t);return}t.stats.chunkCount++;i._handleFragmentLoadProgress(e)};this._doFragLoad(t,e,r,a).then((function(e){if(!e){return}var r=i.state;if(i.fragContextChanged(t)){if(r===ti.FRAG_LOADING||!i.fragCurrent&&r===ti.PARSING){i.fragmentTracker.removeFragment(t);i.state=ti.IDLE}return}if("payload"in e){i.log("Loaded fragment ".concat(t.sn," of level ").concat(t.level));i.hls.trigger(h.FRAG_LOADED,e)}i._handleFragmentLoadComplete(e)})).catch((function(e){if(i.state===ti.STOPPED||i.state===ti.ERROR){return}i.warn(e);i.resetFragmentLoading(t)}))};e.prototype.clearTrackerIfNeeded=function(t){var e;var r=this.fragmentTracker;var i=r.getState(t);if(i===Lr.APPENDING){var a=t.type;var n=this.getFwdBufferInfo(this.mediaBuffer,a);var s=Math.max(t.duration,n?n.len:this.config.maxBufferLength);if(this.reduceMaxBufferLength(s)){r.removeFragment(t)}}else if(((e=this.mediaBuffer)==null?void 0:e.buffered.length)===0){r.removeAllFragments()}else if(r.hasParts(t.type)){r.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type});if(r.getState(t)===Lr.PARTIAL){r.removeFragment(t)}}};e.prototype.checkLiveUpdate=function(t){if(t.updated&&!t.live){var e=t.fragments[t.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type})}if(!t.fragments[0]){t.deltaUpdateFailed=true}};e.prototype.flushMainBuffer=function(t,e,r){if(r===void 0){r=null}if(!(t-e)){return}var i={startOffset:t,endOffset:e,type:r};this.hls.trigger(h.BUFFER_FLUSHING,i)};e.prototype._loadInitSegment=function(t,e){var r=this;this._doFragLoad(t,e).then((function(e){if(!e||r.fragContextChanged(t)||!r.levels){throw new Error("init load aborted")}return e})).then((function(e){var i=r.hls;var a=e.payload;var n=t.decryptdata;if(a&&a.byteLength>0&&n&&n.key&&n.iv&&n.method==="AES-128"){var s=self.performance.now();return r.decrypter.decrypt(new Uint8Array(a),n.key.buffer,n.iv.buffer).catch((function(e){i.trigger(h.ERROR,{type:v.MEDIA_ERROR,details:p.FRAG_DECRYPT_ERROR,fatal:false,error:e,reason:e.message,frag:t});throw e})).then((function(r){var a=self.performance.now();i.trigger(h.FRAG_DECRYPTED,{frag:t,payload:r,stats:{tstart:s,tdecrypt:a}});e.payload=r;return e}))}return e})).then((function(i){var a=r,n=a.fragCurrent,s=a.hls,o=a.levels;if(!o){throw new Error("init load aborted, missing levels")}var l=t.stats;r.state=ti.IDLE;e.fragmentError=0;t.data=new Uint8Array(i.payload);l.parsing.start=l.buffering.start=self.performance.now();l.parsing.end=l.buffering.end=self.performance.now();if(i.frag===n){s.trigger(h.FRAG_BUFFERED,{stats:l,frag:n,part:null,id:t.type})}r.tick()})).catch((function(e){if(r.state===ti.STOPPED||r.state===ti.ERROR){return}r.warn(e);r.resetFragmentLoading(t)}))};e.prototype.fragContextChanged=function(t){var e=this.fragCurrent;return!t||!e||t.level!==e.level||t.sn!==e.sn||t.urlId!==e.urlId};e.prototype.fragBufferedComplete=function(t,e){var r,i,a,n;var s=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered ".concat(t.type," sn: ").concat(t.sn).concat(e?" part: "+e.index:""," of ").concat(this.playlistType===Te.MAIN?"level":"track"," ").concat(t.level," (frag:[").concat(((r=t.startPTS)!=null?r:NaN).toFixed(3),"-").concat(((i=t.endPTS)!=null?i:NaN).toFixed(3),"] > buffer:").concat(s?Zr.toString(Fr.getBuffered(s)):"(detached)",")"));this.state=ti.IDLE;if(!s){return}if(!this.loadedmetadata&&t.type==Te.MAIN&&s.buffered.length&&((a=this.fragCurrent)==null?void 0:a.sn)===((n=this.fragPrevious)==null?void 0:n.sn)){this.loadedmetadata=true;this.seekToStartPos()}this.tick()};e.prototype.seekToStartPos=function(){};e.prototype._handleFragmentLoadComplete=function(t){var e=this.transmuxer;if(!e){return}var r=t.frag,i=t.part,a=t.partsLoaded;var n=!a||a.length===0||a.some((function(t){return!t}));var s=new Mr(r.level,r.sn,r.stats.chunkCount+1,0,i?i.index:-1,!n);e.flush(s)};e.prototype._handleFragmentLoadProgress=function(t){};e.prototype._doFragLoad=function(t,e,r,i){var a=this;if(r===void 0){r=null}var n;var s=e==null?void 0:e.details;if(!this.levels||!s){throw new Error("frag load aborted, missing level".concat(s?"":" detail","s"))}var o=null;if(t.encrypted&&!((n=t.decryptdata)!=null&&n.key)){this.log("Loading key for ".concat(t.sn," of [").concat(s.startSN,"-").concat(s.endSN,"], ").concat(this.logPrefix==="[stream-controller]"?"level":"track"," ").concat(t.level));this.state=ti.KEY_LOADING;this.fragCurrent=t;o=this.keyLoader.load(t).then((function(t){if(!a.fragContextChanged(t.frag)){a.hls.trigger(h.KEY_LOADED,t);if(a.state===ti.KEY_LOADING){a.state=ti.IDLE}return t}}));this.hls.trigger(h.KEY_LOADING,{frag:t});if(this.fragCurrent===null){o=Promise.reject(new Error("frag load aborted, context changed in KEY_LOADING"))}}else if(!t.encrypted&&s.encryptedFragments.length){this.keyLoader.loadClear(t,s.encryptedFragments)}r=Math.max(t.start,r||0);if(this.config.lowLatencyMode&&t.sn!=="initSegment"){var l=s.partList;if(l&&i){if(r>t.end&&s.fragmentHint){t=s.fragmentHint}var u=this.getNextPart(l,t,r);if(u>-1){var c=l[u];this.log("Loading part sn: ".concat(t.sn," p: ").concat(c.index," cc: ").concat(t.cc," of playlist [").concat(s.startSN,"-").concat(s.endSN,"] parts [0-").concat(u,"-").concat(l.length-1,"] ").concat(this.logPrefix==="[stream-controller]"?"level":"track",": ").concat(t.level,", target: ").concat(parseFloat(r.toFixed(3))));this.nextLoadPosition=c.start+c.duration;this.state=ti.FRAG_LOADING;var d=void 0;if(o){d=o.then((function(r){if(!r||a.fragContextChanged(r.frag)){return null}return a.doFragPartsLoad(t,c,e,i)})).catch((function(t){return a.handleFragLoadError(t)}))}else{d=this.doFragPartsLoad(t,c,e,i).catch((function(t){return a.handleFragLoadError(t)}))}this.hls.trigger(h.FRAG_LOADING,{frag:t,part:c,targetBufferTime:r});if(this.fragCurrent===null){return Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts"))}return d}else if(!t.url||this.loadedEndOfParts(l,r)){return Promise.resolve(null)}}}this.log("Loading fragment ".concat(t.sn," cc: ").concat(t.cc," ").concat(s?"of ["+s.startSN+"-"+s.endSN+"] ":"").concat(this.logPrefix==="[stream-controller]"?"level":"track",": ").concat(t.level,", target: ").concat(parseFloat(r.toFixed(3))));if(f(t.sn)&&!this.bitrateTest){this.nextLoadPosition=t.start+t.duration}this.state=ti.FRAG_LOADING;var v=this.config.progressive;var p;if(v&&o){p=o.then((function(e){if(!e||a.fragContextChanged(e==null?void 0:e.frag)){return null}return a.fragmentLoader.load(t,i)})).catch((function(t){return a.handleFragLoadError(t)}))}else{p=Promise.all([this.fragmentLoader.load(t,v?i:undefined),o]).then((function(t){var e=t[0];if(!v&&e&&i){i(e)}return e})).catch((function(t){return a.handleFragLoadError(t)}))}this.hls.trigger(h.FRAG_LOADING,{frag:t,targetBufferTime:r});if(this.fragCurrent===null){return Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING"))}return p};e.prototype.doFragPartsLoad=function(t,e,r,i){var a=this;return new Promise((function(n,s){var o;var l=[];var u=(o=r.details)==null?void 0:o.partList;var f=function(e){a.fragmentLoader.loadPart(t,e,i).then((function(i){l[e.index]=i;var s=i.part;a.hls.trigger(h.FRAG_LOADED,i);var o=Ze(r,t.sn,e.index+1)||tr(u,t.sn,e.index+1);if(o){f(o)}else{return n({frag:t,part:s,partsLoaded:l})}})).catch(s)};f(e)}))};e.prototype.handleFragLoadError=function(t){if("data"in t){var e=t.data;if(t.data&&e.details===p.INTERNAL_ABORTED){this.handleFragLoadAborted(e.frag,e.part)}else{this.hls.trigger(h.ERROR,e)}}else{this.hls.trigger(h.ERROR,{type:v.OTHER_ERROR,details:p.INTERNAL_EXCEPTION,err:t,error:t,fatal:true})}return null};e.prototype._handleTransmuxerFlush=function(t){var e=this.getCurrentContext(t);if(!e||this.state!==ti.PARSING){if(!this.fragCurrent&&this.state!==ti.STOPPED&&this.state!==ti.ERROR){this.state=ti.IDLE}return}var r=e.frag,i=e.part,a=e.level;var n=self.performance.now();r.stats.parsing.end=n;if(i){i.stats.parsing.end=n}this.updateLevelTiming(r,i,a,t.partial)};e.prototype.getCurrentContext=function(t){var e=this,r=e.levels,i=e.fragCurrent;var a=t.level,n=t.sn,s=t.part;if(!(r!=null&&r[a])){this.warn("Levels object was unset while buffering fragment ".concat(n," of level ").concat(a,". The current chunk will not be buffered."));return null}var o=r[a];var l=s>-1?Ze(o,n,s):null;var u=l?l.fragment:Je(o,n,i);if(!u){return null}if(i&&i!==u){u.stats=i.stats}return{frag:u,part:l,level:o}};e.prototype.bufferFragmentData=function(t,e,r,i,a){var n;if(!t||this.state!==ti.PARSING){return}var s=t.data1,o=t.data2;var l=s;if(s&&o){l=xt(s,o)}if(!((n=l)!=null&&n.length)){return}var u={type:t.type,frag:e,part:r,chunkMeta:i,parent:e.type,data:l};this.hls.trigger(h.BUFFER_APPENDING,u);if(t.dropped&&t.independent&&!r){if(a){return}this.flushBufferGap(e)}};e.prototype.flushBufferGap=function(t){var e=this.media;if(!e){return}if(!Fr.isBuffered(e,e.currentTime)){this.flushMainBuffer(0,t.start);return}var r=e.currentTime;var i=Fr.bufferInfo(e,r,0);var a=t.duration;var n=Math.min(this.config.maxFragLookUpTolerance*2,a*.25);var s=Math.max(Math.min(t.start-n,i.end-n),r+n);if(t.start-s>n){this.flushMainBuffer(s,t.start)}};e.prototype.getFwdBufferInfo=function(t,e){var r=this.getLoadPosition();if(!f(r)){return null}return this.getFwdBufferInfoAtPos(t,r,e)};e.prototype.getFwdBufferInfoAtPos=function(t,e,r){var i=this.config.maxBufferHole;var a=Fr.bufferInfo(t,e,i);if(a.len===0&&a.nextStart!==undefined){var n=this.fragmentTracker.getBufferedFrag(e,r);if(n&&a.nextStart<n.end){return Fr.bufferInfo(t,e,Math.max(a.nextStart,i))}}return a};e.prototype.getMaxBufferLength=function(t){var e=this.config;var r;if(t){r=Math.max(8*e.maxBufferSize/t,e.maxBufferLength)}else{r=e.maxBufferLength}return Math.min(r,e.maxMaxBufferLength)};e.prototype.reduceMaxBufferLength=function(t){var e=this.config;var r=t||e.maxBufferLength;if(e.maxMaxBufferLength>=r){e.maxMaxBufferLength/=2;this.warn("Reduce max buffer length to ".concat(e.maxMaxBufferLength,"s"));return true}return false};e.prototype.getAppendedFrag=function(t,e){if(e===void 0){e=Te.MAIN}var r=this.fragmentTracker.getAppendedFrag(t,Te.MAIN);if(r&&"fragment"in r){return r.fragment}return r};e.prototype.getNextFragment=function(t,e){var r=e.fragments;var i=r.length;if(!i){return null}var a=this.config;var n=r[0].start;var s;if(e.live){var o=a.initialLiveManifestSize;if(i<o){this.warn("Not enough fragments to start playback (have: ".concat(i,", need: ").concat(o,")"));return null}if(!e.PTSKnown&&!this.startFragRequested&&this.startPosition===-1){s=this.getInitialLiveFragment(e,r);this.startPosition=s?this.hls.liveSyncPosition||s.start:t}}else if(t<=n){s=r[0]}if(!s){var l=a.lowLatencyMode?e.partEnd:e.fragmentEnd;s=this.getFragmentAtPosition(t,l,e)}return this.mapToInitFragWhenRequired(s)};e.prototype.isLoopLoading=function(t,e){var r=this.fragmentTracker.getState(t);return(r===Lr.OK||r===Lr.PARTIAL&&!!t.gap)&&this.nextLoadPosition>e};e.prototype.getNextFragmentLoopLoading=function(t,e,r,i,a){var n=t.gap;var s=this.getNextFragment(this.nextLoadPosition,e);if(s===null){return s}t=s;if(n&&t&&!t.gap&&r.nextStart){var o=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,r.nextStart,i);if(o!==null&&r.len+o.len>=a){this.log('buffer full after gaps in "'.concat(i,'" playlist starting at sn: ').concat(t.sn));return null}}return t};e.prototype.mapToInitFragWhenRequired=function(t){if(t!=null&&t.initSegment&&!(t!=null&&t.initSegment.data)&&!this.bitrateTest){return t.initSegment}return t};e.prototype.getNextPart=function(t,e,r){var i=-1;var a=false;var n=true;for(var s=0,o=t.length;s<o;s++){var l=t[s];n=n&&!l.independent;if(i>-1&&r<l.start){break}var u=l.loaded;if(u){i=-1}else if((a||l.independent||n)&&l.fragment===e){i=s}a=u}return i};e.prototype.loadedEndOfParts=function(t,e){var r=t[t.length-1];return r&&e>r.start&&r.loaded};e.prototype.getInitialLiveFragment=function(t,e){var r=this.fragPrevious;var i=null;if(r){if(t.hasProgramDateTime){this.log("Live playlist, switching playlist, load frag with same PDT: ".concat(r.programDateTime));i=lr(e,r.endProgramDateTime,this.config.maxFragLookUpTolerance)}if(!i){var a=r.sn+1;if(a>=t.startSN&&a<=t.endSN){var n=e[a-t.startSN];if(r.cc===n.cc){i=n;this.log("Live playlist, switching playlist, load frag with next SN: ".concat(i.sn))}}if(!i){i=dr(e,r.cc);if(i){this.log("Live playlist, switching playlist, load frag with same CC: ".concat(i.sn))}}}}else{var s=this.hls.liveSyncPosition;if(s!==null){i=this.getFragmentAtPosition(s,this.bitrateTest?t.fragmentEnd:t.edge,t)}}return i};e.prototype.getFragmentAtPosition=function(t,e,r){var i=this.config;var a=this.fragPrevious;var n=r.fragments,s=r.endSN;var o=r.fragmentHint;var l=i.maxFragLookUpTolerance;var u=r.partList;var f=!!(i.lowLatencyMode&&u!=null&&u.length&&o);if(f&&o&&!this.bitrateTest){n=n.concat(o);s=o.sn}var c;if(t<e){var d=t>e-l?0:l;c=ur(a,n,t,d)}else{c=n[n.length-1]}if(c){var h=c.sn-r.startSN;var v=this.fragmentTracker.getState(c);if(v===Lr.OK||v===Lr.PARTIAL&&c.gap){a=c}if(a&&c.sn===a.sn&&(!f||u[0].fragment.sn>c.sn)){var p=a&&c.level===a.level;if(p){var g=n[h+1];if(c.sn<s&&this.fragmentTracker.getState(g)!==Lr.OK){c=g}else{c=null}}}}return c};e.prototype.synchronizeToLiveEdge=function(t){var e=this,r=e.config,i=e.media;if(!i){return}var a=this.hls.liveSyncPosition;var n=i.currentTime;var s=t.fragments[0].start;var o=t.edge;var l=n>=s-r.maxFragLookUpTolerance&&n<=o;if(a!==null&&i.duration>a&&(n<a||!l)){var u=r.liveMaxLatencyDuration!==undefined?r.liveMaxLatencyDuration:r.liveMaxLatencyDurationCount*t.targetduration;if(!l&&i.readyState<4||n<o-u){if(!this.loadedmetadata){this.nextLoadPosition=a}if(i.readyState){this.warn("Playback: ".concat(n.toFixed(3)," is located too far from the end of live sliding playlist: ").concat(o,", reset currentTime to : ").concat(a.toFixed(3)));i.currentTime=a}}}};e.prototype.alignPlaylists=function(t,e){var r=this,i=r.levels,a=r.levelLastLoaded,n=r.fragPrevious;var s=a!==null?i[a]:null;var o=t.fragments.length;if(!o){this.warn("No fragments in live playlist");return 0}var l=t.fragments[0].start;var u=!e;var c=t.alignedSliding&&f(l);if(u||!c&&!l){Vr(n,s,t);var d=t.fragments[0].start;this.log("Live playlist sliding: ".concat(d.toFixed(2)," start-sn: ").concat(e?e.startSN:"na","->").concat(t.startSN," prev-sn: ").concat(n?n.sn:"na"," fragments: ").concat(o));return d}return l};e.prototype.waitForCdnTuneIn=function(t){var e=3;return t.live&&t.canBlockReload&&t.partTarget&&t.tuneInGoal>Math.max(t.partHoldBack,t.partTarget*e)};e.prototype.setStartPosition=function(t,e){var r=this.startPosition;if(r<e){r=-1}if(r===-1||this.lastCurrentTime===-1){var i=this.startTimeOffset!==null;var a=i?this.startTimeOffset:t.startTimeOffset;if(a!==null&&f(a)){r=e+a;if(a<0){r+=t.totalduration}r=Math.min(Math.max(e,r),e+t.totalduration);this.log("Start time offset ".concat(a," found in ").concat(i?"multivariant":"media"," playlist, adjust startPosition to ").concat(r));this.startPosition=r}else if(t.live){r=this.hls.liveSyncPosition||e}else{this.startPosition=r=0}this.lastCurrentTime=r}this.nextLoadPosition=r};e.prototype.getLoadPosition=function(){var t=this.media;var e=0;if(this.loadedmetadata&&t){e=t.currentTime}else if(this.nextLoadPosition){e=this.nextLoadPosition}return e};e.prototype.handleFragLoadAborted=function(t,e){if(this.transmuxer&&t.sn!=="initSegment"&&t.stats.aborted){this.warn("Fragment ".concat(t.sn).concat(e?" part "+e.index:""," of level ").concat(t.level," was aborted"));this.resetFragmentLoading(t)}};e.prototype.resetFragmentLoading=function(t){if(!this.fragCurrent||!this.fragContextChanged(t)&&this.state!==ti.FRAG_LOADING_WAITING_RETRY){this.state=ti.IDLE}};e.prototype.onFragmentOrKeyLoadError=function(t,e){if(e.chunkMeta&&!e.frag){var r=this.getCurrentContext(e.chunkMeta);if(r){e.frag=r.frag}}var i=e.frag;if(!i||i.type!==t||!this.levels){return}if(this.fragContextChanged(i)){var a;this.warn("Frag load error must match current frag to retry ".concat(i.url," > ").concat((a=this.fragCurrent)==null?void 0:a.url));return}var n=e.details===p.FRAG_GAP;if(n){this.fragmentTracker.fragBuffered(i,true)}var s=e.errorAction;var o=s||{},l=o.action,u=o.retryCount,f=u===void 0?0:u,c=o.retryConfig;if(s&&l===vr.RetryRequest&&c){var d;this.resetStartWhenNotLoaded((d=this.levelLastLoaded)!=null?d:i.level);var h=ir(c,f);this.warn("Fragment ".concat(i.sn," of ").concat(t," ").concat(i.level," errored with ").concat(e.details,", retrying loading ").concat(f+1,"/").concat(c.maxNumRetry," in ").concat(h,"ms"));s.resolved=true;this.retryDate=self.performance.now()+h;this.state=ti.FRAG_LOADING_WAITING_RETRY}else if(c&&s){this.resetFragmentErrors(t);if(f<c.maxNumRetry){if(!n){s.resolved=true}}else{A.warn("".concat(e.details," reached or exceeded max retry (").concat(f,")"))}}else if((s==null?void 0:s.action)===vr.SendAlternateToPenaltyBox){this.state=ti.WAITING_LEVEL}else{this.state=ti.ERROR}this.tickImmediate()};e.prototype.reduceLengthAndFlushBuffer=function(t){if(this.state===ti.PARSING||this.state===ti.PARSED){var e=t.parent;var r=this.getFwdBufferInfo(this.mediaBuffer,e);var i=r&&r.len>.5;if(i){this.reduceMaxBufferLength(r.len)}var a=!i;if(a){this.warn("Buffer full error while media.currentTime is not buffered, flush ".concat(e," buffer"))}if(t.frag){this.fragmentTracker.removeFragment(t.frag);this.nextLoadPosition=t.frag.start}this.resetLoadingState();return a}return false};e.prototype.resetFragmentErrors=function(t){if(t===Te.AUDIO){this.fragCurrent=null}if(!this.loadedmetadata){this.startFragRequested=false}if(this.state!==ti.STOPPED){this.state=ti.IDLE}};e.prototype.afterBufferFlushed=function(t,e,r){if(!t){return}var i=Fr.getBuffered(t);this.fragmentTracker.detectEvictedFragments(e,i,r);if(this.state===ti.ENDED){this.resetLoadingState()}};e.prototype.resetLoadingState=function(){this.log("Reset loading state");this.fragCurrent=null;this.fragPrevious=null;this.state=ti.IDLE};e.prototype.resetStartWhenNotLoaded=function(t){if(!this.loadedmetadata){this.startFragRequested=false;var e=this.levels?this.levels[t].details:null;if(e!=null&&e.live){this.startPosition=-1;this.setStartPosition(e,0);this.resetLoadingState()}else{this.nextLoadPosition=this.startPosition}}};e.prototype.resetWhenMissingContext=function(t){var e;this.warn("The loading context changed while buffering fragment ".concat(t.sn," of level ").concat(t.level,". This chunk will not be buffered."));this.removeUnbufferedFrags();this.resetStartWhenNotLoaded((e=this.levelLastLoaded)!=null?e:t.level);this.resetLoadingState()};e.prototype.removeUnbufferedFrags=function(t){if(t===void 0){t=0}this.fragmentTracker.removeFragmentsInRange(t,Infinity,this.playlistType,false,true)};e.prototype.updateLevelTiming=function(t,e,r,i){var a=this;var n;var s=r.details;if(!s){this.warn("level.details undefined");return}var o=Object.keys(t.elementaryStreams).reduce((function(e,n){var o=t.elementaryStreams[n];if(o){var l=o.endPTS-o.startPTS;if(l<=0){a.warn("Could not parse fragment ".concat(t.sn," ").concat(n," duration reliably (").concat(l,")"));return e||false}var u=i?0:je(s,t,o.startPTS,o.endPTS,o.startDTS,o.endDTS);a.hls.trigger(h.LEVEL_PTS_UPDATED,{details:s,level:r,drift:u,type:n,frag:t,start:o.startPTS,end:o.endPTS});return true}return e}),false);if(o){r.fragmentError=0}else if(((n=this.transmuxer)==null?void 0:n.error)===null){var l=new Error("Found no media in fragment ".concat(t.sn," of level ").concat(t.level," resetting transmuxer to fallback to playlist timing"));if(r.fragmentError===0){r.fragmentError++;t.gap=true;this.fragmentTracker.removeFragment(t);this.fragmentTracker.fragBuffered(t,true)}this.warn(l.message);this.hls.trigger(h.ERROR,{type:v.MEDIA_ERROR,details:p.FRAG_PARSING_ERROR,fatal:false,error:l,frag:t,reason:"Found no media in msn ".concat(t.sn,' of level "').concat(r.url,'"')});if(!this.hls){return}this.resetTransmuxer()}this.state=ti.PARSED;this.hls.trigger(h.FRAG_PARSED,{frag:t,part:e})};e.prototype.resetTransmuxer=function(){if(this.transmuxer){this.transmuxer.destroy();this.transmuxer=null}};e.prototype.recoverWorkerError=function(t){if(t.event==="demuxerWorker"){var e,r,i;this.fragmentTracker.removeAllFragments();this.resetTransmuxer();this.resetStartWhenNotLoaded((e=(r=this.levelLastLoaded)!=null?r:(i=this.fragCurrent)==null?void 0:i.level)!=null?e:0);this.resetLoadingState()}};Object.defineProperty(e.prototype,"state",{get:function(){return this._state},set:function(t){var e=this._state;if(e!==t){this._state=t;this.log("".concat(e,"->").concat(t))}},enumerable:false,configurable:true});return e}(Or);function ri(){return self.SourceBuffer||self.WebKitSourceBuffer}function ii(){var t=Zt();if(!t){return false}var e=ri();var r=t&&typeof t.isTypeSupported==="function"&&t.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"');var i=!e||e.prototype&&typeof e.prototype.appendBuffer==="function"&&typeof e.prototype.remove==="function";return!!r&&!!i}function ai(){var t;var e=ri();return typeof(e==null?void 0:(t=e.prototype)==null?void 0:t.changeType)==="function"}function ni(){return typeof __HLS_WORKER_BUNDLE__==="function"}function si(){var t=new self.Blob(["var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(".concat(__HLS_WORKER_BUNDLE__.toString(),")(true);")],{type:"text/javascript"});var e=self.URL.createObjectURL(t);var r=new self.Worker(e);return{worker:r,objectURL:e}}function oi(t){var e=new self.URL(t,self.location.href).href;var r=new self.Worker(e);return{worker:r,scriptURL:e}}function li(t,e){if(t===void 0){t=""}if(e===void 0){e=9e4}return{type:t,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}var ui=function(){function t(){this._audioTrack=void 0;this._id3Track=void 0;this.frameIndex=0;this.cachedData=null;this.basePTS=null;this.initPTS=null;this.lastPTS=null}t.prototype.resetInitSegment=function(t,e,r,i){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}};t.prototype.resetTimeStamp=function(t){this.initPTS=t;this.resetContiguity()};t.prototype.resetContiguity=function(){this.basePTS=null;this.lastPTS=null;this.frameIndex=0};t.prototype.canParse=function(t,e){return false};t.prototype.appendFrame=function(t,e,r){};t.prototype.demux=function(t,e){if(this.cachedData){t=xt(this.cachedData,t);this.cachedData=null}var r=tt(t,0);var i=r?r.length:0;var a;var n=this._audioTrack;var s=this._id3Track;var o=r?it(r):undefined;var l=t.length;if(this.basePTS===null||this.frameIndex===0&&f(o)){this.basePTS=fi(o,e,this.initPTS);this.lastPTS=this.basePTS}if(this.lastPTS===null){this.lastPTS=this.basePTS}if(r&&r.length>0){s.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:r,type:_e.audioId3,duration:Number.POSITIVE_INFINITY})}while(i<l){if(this.canParse(t,i)){var u=this.appendFrame(n,t,i);if(u){this.frameIndex++;this.lastPTS=u.sample.pts;i+=u.length;a=i}else{i=l}}else if(rt(t,i)){r=tt(t,i);s.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:r,type:_e.audioId3,duration:Number.POSITIVE_INFINITY});i+=r.length;a=i}else{i++}if(i===l&&a!==l){var c=$(t,a);if(this.cachedData){this.cachedData=xt(this.cachedData,c)}else{this.cachedData=c}}}return{audioTrack:n,videoTrack:li(),id3Track:s,textTrack:li()}};t.prototype.demuxSampleAes=function(t,e,r){return Promise.reject(new Error("[".concat(this,"] This demuxer does not support Sample-AES decryption")))};t.prototype.flush=function(t){var e=this.cachedData;if(e){this.cachedData=null;this.demux(e,0)}return{audioTrack:this._audioTrack,videoTrack:li(),id3Track:this._id3Track,textTrack:li()}};t.prototype.destroy=function(){};return t}();var fi=function(t,e,r){if(f(t)){return t*90}var i=r?r.baseTime*9e4/r.timescale:0;return e*9e4+i};function ci(t,e,r,i){var a;var n;var s;var o;var l=navigator.userAgent.toLowerCase();var u=i;var f=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];a=((e[r+2]&192)>>>6)+1;var c=(e[r+2]&60)>>>2;if(c>f.length-1){t.trigger(h.ERROR,{type:v.MEDIA_ERROR,details:p.FRAG_PARSING_ERROR,fatal:true,reason:"invalid ADTS sampling index:".concat(c)});return}s=(e[r+2]&1)<<2;s|=(e[r+3]&192)>>>6;A.log("manifest codec:".concat(i,", ADTS type:").concat(a,", samplingIndex:").concat(c));if(/firefox/i.test(l)){if(c>=6){a=5;o=new Array(4);n=c-3}else{a=2;o=new Array(2);n=c}}else if(l.indexOf("android")!==-1){a=2;o=new Array(2);n=c}else{a=5;o=new Array(4);if(i&&(i.indexOf("mp4a.40.29")!==-1||i.indexOf("mp4a.40.5")!==-1)||!i&&c>=6){n=c-3}else{if(i&&i.indexOf("mp4a.40.2")!==-1&&(c>=6&&s===1||/vivaldi/i.test(l))||!i&&s===1){a=2;o=new Array(2)}n=c}}o[0]=a<<3;o[0]|=(c&14)>>1;o[1]|=(c&1)<<7;o[1]|=s<<3;if(a===5){o[1]|=(n&14)>>1;o[2]=(n&1)<<7;o[2]|=2<<2;o[3]=0}return{config:o,samplerate:f[c],channelCount:s,codec:"mp4a.40."+a,manifestCodec:u}}function di(t,e){return t[e]===255&&(t[e+1]&246)===240}function hi(t,e){return t[e+1]&1?7:9}function vi(t,e){return(t[e+3]&3)<<11|t[e+4]<<3|(t[e+5]&224)>>>5}function pi(t,e){return e+5<t.length}function gi(t,e){return e+1<t.length&&di(t,e)}function mi(t,e){return pi(t,e)&&di(t,e)&&vi(t,e)<=t.length-e}function yi(t,e){if(gi(t,e)){var r=hi(t,e);if(e+r>=t.length){return false}var i=vi(t,e);if(i<=r){return false}var a=e+i;return a===t.length||gi(t,a)}return false}function Ti(t,e,r,i,a){if(!t.samplerate){var n=ci(e,r,i,a);if(!n){return}t.config=n.config;t.samplerate=n.samplerate;t.channelCount=n.channelCount;t.codec=n.codec;t.manifestCodec=n.manifestCodec;A.log("parsed codec:".concat(t.codec,", rate:").concat(n.samplerate,", channels:").concat(n.channelCount))}}function Ei(t){return 1024*9e4/t}function Si(t,e){var r=hi(t,e);if(e+r<=t.length){var i=vi(t,e)-r;if(i>0){return{headerLength:r,frameLength:i}}}}function Ai(t,e,r,i,a){var n=Ei(t.samplerate);var s=i+a*n;var o=Si(e,r);var l;if(o){var u=o.frameLength,f=o.headerLength;var c=f+u;var d=Math.max(0,r+c-e.length);if(d){l=new Uint8Array(c-f);l.set(e.subarray(r+f,e.length),0)}else{l=e.subarray(r+f,r+c)}var h={unit:l,pts:s};if(!d){t.samples.push(h)}return{sample:h,length:c,missing:d}}var v=e.length-r;l=new Uint8Array(v);l.set(e.subarray(r,e.length),0);var p={unit:l,pts:s};return{sample:p,length:v,missing:-1}}var Li=function(t){__extends(e,t);function e(e,r){var i=t.call(this)||this;i.observer=void 0;i.config=void 0;i.observer=e;i.config=r;return i}e.prototype.resetInitSegment=function(e,r,i,a){t.prototype.resetInitSegment.call(this,e,r,i,a);this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:r,duration:a,inputTimeScale:9e4,dropped:0}};e.probe=function(t){if(!t){return false}var e=tt(t,0)||[];var r=e.length;for(var i=t.length;r<i;r++){if(yi(t,r)){A.log("ADTS sync word found !");return true}}return false};e.prototype.canParse=function(t,e){return mi(t,e)};e.prototype.appendFrame=function(t,e,r){Ti(t,this.observer,e,r,t.manifestCodec);var i=Ai(t,e,r,this.basePTS,this.frameIndex);if(i&&i.missing===0){return i}};return e}(ui);var bi=/\/emsg[-/]ID3/i;var Ri=function(){function t(t,e){this.remainderData=null;this.timeOffset=0;this.config=void 0;this.videoTrack=void 0;this.audioTrack=void 0;this.id3Track=void 0;this.txtTrack=void 0;this.config=e}t.prototype.resetTimeStamp=function(){};t.prototype.resetInitSegment=function(t,e,r,i){var a=this.videoTrack=li("video",1);var n=this.audioTrack=li("audio",1);var s=this.txtTrack=li("text",1);this.id3Track=li("id3",1);this.timeOffset=0;if(!(t!=null&&t.byteLength)){return}var o=It(t);if(o.video){var l=o.video,u=l.id,f=l.timescale,c=l.codec;a.id=u;a.timescale=s.timescale=f;a.codec=c}if(o.audio){var d=o.audio,u=d.id,f=d.timescale,c=d.codec;n.id=u;n.timescale=f;n.codec=c}s.id=yt.text;a.sampleDuration=0;a.duration=n.duration=i};t.prototype.resetContiguity=function(){this.remainderData=null};t.probe=function(t){t=t.length>16384?t.subarray(0,16384):t;return bt(t,["moof"]).length>0};t.prototype.demux=function(t,e){this.timeOffset=e;var r=t;var i=this.videoTrack;var a=this.txtTrack;if(this.config.progressive){if(this.remainderData){r=xt(this.remainderData,t)}var n=Ot(r);this.remainderData=n.remainder;i.samples=n.valid||new Uint8Array}else{i.samples=r}var s=this.extractID3Track(i,e);a.samples=Ft(e,i);return{videoTrack:i,audioTrack:this.audioTrack,id3Track:s,textTrack:this.txtTrack}};t.prototype.flush=function(){var t=this.timeOffset;var e=this.videoTrack;var r=this.txtTrack;e.samples=this.remainderData||new Uint8Array;this.remainderData=null;var i=this.extractID3Track(e,this.timeOffset);r.samples=Ft(t,e);return{videoTrack:e,audioTrack:li(),id3Track:i,textTrack:li()}};t.prototype.extractID3Track=function(t,e){var r=this.id3Track;if(t.samples.length){var i=bt(t.samples,["emsg"]);if(i){i.forEach((function(t){var i=Gt(t);if(bi.test(i.schemeIdUri)){var a=f(i.presentationTime)?i.presentationTime/i.timeScale:e+i.presentationTimeDelta/i.timeScale;var n=i.eventDuration===4294967295?Number.POSITIVE_INFINITY:i.eventDuration/i.timeScale;if(n<=.001){n=Number.POSITIVE_INFINITY}var s=i.payload;r.samples.push({data:s,len:s.byteLength,dts:a,pts:a,type:_e.emsg,duration:n})}}))}}return r};t.prototype.demuxSampleAes=function(t,e,r){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))};t.prototype.destroy=function(){};return t}();var Ii=null;var Di=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160];var ki=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3];var _i=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]];var wi=[0,1,1,4];function Ci(t,e,r,i,a){if(r+24>e.length){return}var n=Pi(e,r);if(n&&r+n.frameLength<=e.length){var s=n.samplesPerFrame*9e4/n.sampleRate;var o=i+a*s;var l={unit:e.subarray(r,r+n.frameLength),pts:o,dts:o};t.config=[];t.channelCount=n.channelCount;t.samplerate=n.sampleRate;t.samples.push(l);return{sample:l,length:n.frameLength,missing:0}}}function Pi(t,e){var r=t[e+1]>>3&3;var i=t[e+1]>>1&3;var a=t[e+2]>>4&15;var n=t[e+2]>>2&3;if(r!==1&&a!==0&&a!==15&&n!==3){var s=t[e+2]>>1&1;var o=t[e+3]>>6;var l=r===3?3-i:i===3?3:4;var u=Di[l*14+a-1]*1e3;var f=r===3?0:r===2?1:2;var c=ki[f*3+n];var d=o===3?1:2;var h=_i[r][i];var v=wi[i];var p=h*8*v;var g=Math.floor(h*u/c+s)*v;if(Ii===null){var m=navigator.userAgent||"";var y=m.match(/Chrome\/(\d+)/i);Ii=y?parseInt(y[1]):0}var T=!!Ii&&Ii<=87;if(T&&i===2&&u>=224e3&&o===0){t[e+3]=t[e+3]|128}return{sampleRate:c,channelCount:d,frameLength:g,samplesPerFrame:p}}}function Oi(t,e){return t[e]===255&&(t[e+1]&224)===224&&(t[e+1]&6)!==0}function xi(t,e){return e+1<t.length&&Oi(t,e)}function Fi(t,e){var r=4;return Oi(t,e)&&r<=t.length-e}function Mi(t,e){if(e+1<t.length&&Oi(t,e)){var r=4;var i=Pi(t,e);var a=r;if(i!=null&&i.frameLength){a=i.frameLength}var n=e+a;return n===t.length||xi(t,n)}return false}var Ni=function(){function t(t){this.data=void 0;this.bytesAvailable=void 0;this.word=void 0;this.bitsAvailable=void 0;this.data=t;this.bytesAvailable=t.byteLength;this.word=0;this.bitsAvailable=0}t.prototype.loadWord=function(){var t=this.data;var e=this.bytesAvailable;var r=t.byteLength-e;var i=new Uint8Array(4);var a=Math.min(4,e);if(a===0){throw new Error("no bytes available")}i.set(t.subarray(r,r+a));this.word=new DataView(i.buffer).getUint32(0);this.bitsAvailable=a*8;this.bytesAvailable-=a};t.prototype.skipBits=function(t){var e;t=Math.min(t,this.bytesAvailable*8+this.bitsAvailable);if(this.bitsAvailable>t){this.word<<=t;this.bitsAvailable-=t}else{t-=this.bitsAvailable;e=t>>3;t-=e<<3;this.bytesAvailable-=e;this.loadWord();this.word<<=t;this.bitsAvailable-=t}};t.prototype.readBits=function(t){var e=Math.min(this.bitsAvailable,t);var r=this.word>>>32-e;if(t>32){A.error("Cannot read more than 32 bits at a time")}this.bitsAvailable-=e;if(this.bitsAvailable>0){this.word<<=e}else if(this.bytesAvailable>0){this.loadWord()}else{throw new Error("no bits available")}e=t-e;if(e>0&&this.bitsAvailable){return r<<e|this.readBits(e)}else{return r}};t.prototype.skipLZ=function(){var t;for(t=0;t<this.bitsAvailable;++t){if((this.word&2147483648>>>t)!==0){this.word<<=t;this.bitsAvailable-=t;return t}}this.loadWord();return t+this.skipLZ()};t.prototype.skipUEG=function(){this.skipBits(1+this.skipLZ())};t.prototype.skipEG=function(){this.skipBits(1+this.skipLZ())};t.prototype.readUEG=function(){var t=this.skipLZ();return this.readBits(t+1)-1};t.prototype.readEG=function(){var t=this.readUEG();if(1&t){return 1+t>>>1}else{return-1*(t>>>1)}};t.prototype.readBoolean=function(){return this.readBits(1)===1};t.prototype.readUByte=function(){return this.readBits(8)};t.prototype.readUShort=function(){return this.readBits(16)};t.prototype.readUInt=function(){return this.readBits(32)};t.prototype.skipScalingList=function(t){var e=8;var r=8;var i;for(var a=0;a<t;a++){if(r!==0){i=this.readEG();r=(e+i+256)%256}e=r===0?e:r}};t.prototype.readSPS=function(){var t=0;var e=0;var r=0;var i=0;var a;var n;var s;var o=this.readUByte.bind(this);var l=this.readBits.bind(this);var u=this.readUEG.bind(this);var f=this.readBoolean.bind(this);var c=this.skipBits.bind(this);var d=this.skipEG.bind(this);var h=this.skipUEG.bind(this);var v=this.skipScalingList.bind(this);o();var p=o();l(5);c(3);o();h();if(p===100||p===110||p===122||p===244||p===44||p===83||p===86||p===118||p===128){var g=u();if(g===3){c(1)}h();h();c(1);if(f()){n=g!==3?8:12;for(s=0;s<n;s++){if(f()){if(s<6){v(16)}else{v(64)}}}}}h();var m=u();if(m===0){u()}else if(m===1){c(1);d();d();a=u();for(s=0;s<a;s++){d()}}h();c(1);var y=u();var T=u();var E=l(1);if(E===0){c(1)}c(1);if(f()){t=u();e=u();r=u();i=u()}var S=[1,1];if(f()){if(f()){var A=o();switch(A){case 1:S=[1,1];break;case 2:S=[12,11];break;case 3:S=[10,11];break;case 4:S=[16,11];break;case 5:S=[40,33];break;case 6:S=[24,11];break;case 7:S=[20,11];break;case 8:S=[32,11];break;case 9:S=[80,33];break;case 10:S=[18,11];break;case 11:S=[15,11];break;case 12:S=[64,33];break;case 13:S=[160,99];break;case 14:S=[4,3];break;case 15:S=[3,2];break;case 16:S=[2,1];break;case 255:{S=[o()<<8|o(),o()<<8|o()];break}}}}return{width:Math.ceil((y+1)*16-t*2-e*2),height:(2-E)*(T+1)*16-(E?2:4)*(r+i),pixelRatio:S}};t.prototype.readSliceType=function(){this.readUByte();this.readUEG();return this.readUEG()};return t}();var Ui=function(){function t(t,e,r){this.keyData=void 0;this.decrypter=void 0;this.keyData=r;this.decrypter=new Jr(e,{removePKCS7Padding:false})}t.prototype.decryptBuffer=function(t){return this.decrypter.decrypt(t,this.keyData.key.buffer,this.keyData.iv.buffer)};t.prototype.decryptAacSample=function(t,e,r){var i=this;var a=t[e].unit;if(a.length<=16){return}var n=a.subarray(16,a.length-a.length%16);var s=n.buffer.slice(n.byteOffset,n.byteOffset+n.length);this.decryptBuffer(s).then((function(n){var s=new Uint8Array(n);a.set(s,16);if(!i.decrypter.isSync()){i.decryptAacSamples(t,e+1,r)}}))};t.prototype.decryptAacSamples=function(t,e,r){for(;;e++){if(e>=t.length){r();return}if(t[e].unit.length<32){continue}this.decryptAacSample(t,e,r);if(!this.decrypter.isSync()){return}}};t.prototype.getAvcEncryptedData=function(t){var e=Math.floor((t.length-48)/160)*16+16;var r=new Int8Array(e);var i=0;for(var a=32;a<t.length-16;a+=160,i+=16){r.set(t.subarray(a,a+16),i)}return r};t.prototype.getAvcDecryptedUnit=function(t,e){var r=new Uint8Array(e);var i=0;for(var a=32;a<t.length-16;a+=160,i+=16){t.set(r.subarray(i,i+16),a)}return t};t.prototype.decryptAvcSample=function(t,e,r,i,a){var n=this;var s=Bt(a.data);var o=this.getAvcEncryptedData(s);this.decryptBuffer(o.buffer).then((function(o){a.data=n.getAvcDecryptedUnit(s,o);if(!n.decrypter.isSync()){n.decryptAvcSamples(t,e,r+1,i)}}))};t.prototype.decryptAvcSamples=function(t,e,r,i){if(t instanceof Uint8Array){throw new Error("Cannot decrypt samples of type Uint8Array")}for(;;e++,r=0){if(e>=t.length){i();return}var a=t[e].units;for(;;r++){if(r>=a.length){break}var n=a[r];if(n.data.length<=48||n.type!==1&&n.type!==5){continue}this.decryptAvcSample(t,e,r,i,n);if(!this.decrypter.isSync()){return}}}};return t}();var Bi=188;var Gi=function(){function t(t,e,r){this.observer=void 0;this.config=void 0;this.typeSupported=void 0;this.sampleAes=null;this.pmtParsed=false;this.audioCodec=void 0;this.videoCodec=void 0;this._duration=0;this._pmtId=-1;this._avcTrack=void 0;this._audioTrack=void 0;this._id3Track=void 0;this._txtTrack=void 0;this.aacOverFlow=null;this.avcSample=null;this.remainderData=null;this.observer=t;this.config=e;this.typeSupported=r}t.probe=function(e){var r=t.syncOffset(e);if(r>0){A.warn("MPEG2-TS detected but first sync word found @ offset ".concat(r))}return r!==-1};t.syncOffset=function(t){var e=t.length;var r=Math.min(Bi*5,t.length-Bi)+1;var i=0;while(i<r){var a=false;var n=-1;var s=0;for(var o=i;o<e;o+=Bi){if(t[o]===71){s++;if(n===-1){n=o;if(n!==0){r=Math.min(n+Bi*99,t.length-Bi)+1}}if(!a){a=Hi(t,o)===0}if(a&&s>1&&(n===0&&s>2||o+Bi>r)){return n}}else if(s){return-1}else{break}}i++}return-1};t.createTrack=function(t,e){return{container:t==="video"||t==="audio"?"video/mp2t":undefined,type:t,id:yt[t],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:t==="audio"?e:undefined}};t.prototype.resetInitSegment=function(e,r,i,a){this.pmtParsed=false;this._pmtId=-1;this._avcTrack=t.createTrack("video");this._audioTrack=t.createTrack("audio",a);this._id3Track=t.createTrack("id3");this._txtTrack=t.createTrack("text");this._audioTrack.segmentCodec="aac";this.aacOverFlow=null;this.avcSample=null;this.remainderData=null;this.audioCodec=r;this.videoCodec=i;this._duration=a};t.prototype.resetTimeStamp=function(){};t.prototype.resetContiguity=function(){var t=this,e=t._audioTrack,r=t._avcTrack,i=t._id3Track;if(e){e.pesData=null}if(r){r.pesData=null}if(i){i.pesData=null}this.aacOverFlow=null;this.avcSample=null;this.remainderData=null};t.prototype.demux=function(e,r,i,a){if(i===void 0){i=false}if(a===void 0){a=false}if(!i){this.sampleAes=null}var n;var s=this._avcTrack;var o=this._audioTrack;var l=this._id3Track;var u=this._txtTrack;var f=s.pid;var c=s.pesData;var d=o.pid;var g=l.pid;var m=o.pesData;var y=l.pesData;var T=null;var E=this.pmtParsed;var S=this._pmtId;var L=e.length;if(this.remainderData){e=xt(this.remainderData,e);L=e.length;this.remainderData=null}if(L<Bi&&!a){this.remainderData=e;return{audioTrack:o,videoTrack:s,id3Track:l,textTrack:u}}var b=Math.max(0,t.syncOffset(e));L-=(L-b)%Bi;if(L<e.byteLength&&!a){this.remainderData=new Uint8Array(e.buffer,L,e.buffer.byteLength-L)}var R=0;for(var I=b;I<L;I+=Bi){if(e[I]===71){var D=!!(e[I+1]&64);var k=Hi(e,I);var _=(e[I+3]&48)>>4;var w=void 0;if(_>1){w=I+5+e[I+4];if(w===I+Bi){continue}}else{w=I+4}switch(k){case f:if(D){if(c&&(n=Yi(c))){this.parseAVCPES(s,u,n,false)}c={data:[],size:0}}if(c){c.data.push(e.subarray(w,I+Bi));c.size+=I+Bi-w}break;case d:if(D){if(m&&(n=Yi(m))){switch(o.segmentCodec){case"aac":this.parseAACPES(o,n);break;case"mp3":this.parseMPEGPES(o,n);break}}m={data:[],size:0}}if(m){m.data.push(e.subarray(w,I+Bi));m.size+=I+Bi-w}break;case g:if(D){if(y&&(n=Yi(y))){this.parseID3PES(l,n)}y={data:[],size:0}}if(y){y.data.push(e.subarray(w,I+Bi));y.size+=I+Bi-w}break;case 0:if(D){w+=e[w]+1}S=this._pmtId=Vi(e,w);break;case S:{if(D){w+=e[w]+1}var C=ji(e,w,this.typeSupported,i);f=C.avc;if(f>0){s.pid=f}d=C.audio;if(d>0){o.pid=d;o.segmentCodec=C.segmentCodec}g=C.id3;if(g>0){l.pid=g}if(T!==null&&!E){A.warn("MPEG-TS PMT found at ".concat(I," after unknown PID '").concat(T,"'. Backtracking to sync byte @").concat(b," to parse all TS packets."));T=null;I=b-188}E=this.pmtParsed=true;break}case 17:case 8191:break;default:T=k;break}}else{R++}}if(R>0){var P=new Error("Found ".concat(R," TS packet/s that do not start with 0x47"));this.observer.emit(h.ERROR,h.ERROR,{type:v.MEDIA_ERROR,details:p.FRAG_PARSING_ERROR,fatal:false,error:P,reason:P.message})}s.pesData=c;o.pesData=m;l.pesData=y;var O={audioTrack:o,videoTrack:s,id3Track:l,textTrack:u};if(a){this.extractRemainingSamples(O)}return O};t.prototype.flush=function(){var t=this.remainderData;this.remainderData=null;var e;if(t){e=this.demux(t,-1,false,true)}else{e={videoTrack:this._avcTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack}}this.extractRemainingSamples(e);if(this.sampleAes){return this.decrypt(e,this.sampleAes)}return e};t.prototype.extractRemainingSamples=function(t){var e=t.audioTrack,r=t.videoTrack,i=t.id3Track,a=t.textTrack;var n=r.pesData;var s=e.pesData;var o=i.pesData;var l;if(n&&(l=Yi(n))){this.parseAVCPES(r,a,l,true);r.pesData=null}else{r.pesData=n}if(s&&(l=Yi(s))){switch(e.segmentCodec){case"aac":this.parseAACPES(e,l);break;case"mp3":this.parseMPEGPES(e,l);break}e.pesData=null}else{if(s!=null&&s.size){A.log("last AAC PES packet truncated,might overlap between fragments")}e.pesData=s}if(o&&(l=Yi(o))){this.parseID3PES(i,l);i.pesData=null}else{i.pesData=o}};t.prototype.demuxSampleAes=function(t,e,r){var i=this.demux(t,r,true,!this.config.progressive);var a=this.sampleAes=new Ui(this.observer,this.config,e);return this.decrypt(i,a)};t.prototype.decrypt=function(t,e){return new Promise((function(r){var i=t.audioTrack,a=t.videoTrack;if(i.samples&&i.segmentCodec==="aac"){e.decryptAacSamples(i.samples,0,(function(){if(a.samples){e.decryptAvcSamples(a.samples,0,0,(function(){r(t)}))}else{r(t)}}))}else if(a.samples){e.decryptAvcSamples(a.samples,0,0,(function(){r(t)}))}}))};t.prototype.destroy=function(){this._duration=0};t.prototype.parseAVCPES=function(t,e,r,i){var a=this;var n=this.parseAVCNALu(t,r.data);var s=this.avcSample;var o;var l=false;r.data=null;if(s&&n.length&&!t.audFound){Wi(s,t);s=this.avcSample=Ki(false,r.pts,r.dts,"")}n.forEach((function(i){var n;switch(i.type){case 1:{var u=false;o=true;var f=i.data;if(l&&f.length>4){var c=new Ni(f).readSliceType();if(c===2||c===4||c===7||c===9){u=true}}if(u){var d;if((d=s)!=null&&d.frame&&!s.key){Wi(s,t);s=a.avcSample=null}}if(!s){s=a.avcSample=Ki(true,r.pts,r.dts,"")}s.frame=true;s.key=u;break}case 5:o=true;if((n=s)!=null&&n.frame&&!s.key){Wi(s,t);s=a.avcSample=null}if(!s){s=a.avcSample=Ki(true,r.pts,r.dts,"")}s.key=true;s.frame=true;break;case 6:{o=true;Ut(i.data,1,r.pts,e.samples);break}case 7:o=true;l=true;if(!t.sps){var h=i.data;var v=new Ni(h);var p=v.readSPS();t.width=p.width;t.height=p.height;t.pixelRatio=p.pixelRatio;t.sps=[h];t.duration=a._duration;var g=h.subarray(1,4);var m="avc1.";for(var y=0;y<3;y++){var T=g[y].toString(16);if(T.length<2){T="0"+T}m+=T}t.codec=m}break;case 8:o=true;if(!t.pps){t.pps=[i.data]}break;case 9:o=false;t.audFound=true;if(s){Wi(s,t)}s=a.avcSample=Ki(false,r.pts,r.dts,"");break;case 12:o=true;break;default:o=false;if(s){s.debug+="unknown NAL "+i.type+" "}break}if(s&&o){var E=s.units;E.push(i)}}));if(i&&s){Wi(s,t);this.avcSample=null}};t.prototype.getLastNalUnit=function(t){var e;var r=this.avcSample;var i;if(!r||r.units.length===0){r=t[t.length-1]}if((e=r)!=null&&e.units){var a=r.units;i=a[a.length-1]}return i};t.prototype.parseAVCNALu=function(t,e){var r=e.byteLength;var i=t.naluState||0;var a=i;var n=[];var s=0;var o;var l;var u;var f=-1;var c=0;if(i===-1){f=0;c=e[0]&31;i=0;s=1}while(s<r){o=e[s++];if(!i){i=o?0:1;continue}if(i===1){i=o?0:2;continue}if(!o){i=3}else if(o===1){if(f>=0){var d={data:e.subarray(f,s-i-1),type:c};n.push(d)}else{var h=this.getLastNalUnit(t.samples);if(h){if(a&&s<=4-a){if(h.state){h.data=h.data.subarray(0,h.data.byteLength-a)}}l=s-i-1;if(l>0){var v=new Uint8Array(h.data.byteLength+l);v.set(h.data,0);v.set(e.subarray(0,l),h.data.byteLength);h.data=v;h.state=0}}}if(s<r){u=e[s]&31;f=s;c=u;i=0}else{i=-1}}else{i=0}}if(f>=0&&i>=0){var d={data:e.subarray(f,r),type:c,state:i};n.push(d)}if(n.length===0){var h=this.getLastNalUnit(t.samples);if(h){var v=new Uint8Array(h.data.byteLength+e.byteLength);v.set(h.data,0);v.set(e,h.data.byteLength);h.data=v}}t.naluState=i;return n};t.prototype.parseAACPES=function(t,e){var r=0;var i=this.aacOverFlow;var a=e.data;if(i){this.aacOverFlow=null;var n=i.missing;var s=i.sample.unit.byteLength;if(n===-1){var o=new Uint8Array(s+a.byteLength);o.set(i.sample.unit,0);o.set(a,s);a=o}else{var l=s-n;i.sample.unit.set(a.subarray(0,n),l);t.samples.push(i.sample);r=i.missing}}var u;var f;for(u=r,f=a.length;u<f-1;u++){if(gi(a,u)){break}}if(u!==r){var c=void 0;var d=u<f-1;if(d){c="AAC PES did not start with ADTS header,offset:".concat(u)}else{c="No ADTS header found in AAC PES"}var g=new Error(c);A.warn("parsing error: ".concat(c));this.observer.emit(h.ERROR,h.ERROR,{type:v.MEDIA_ERROR,details:p.FRAG_PARSING_ERROR,fatal:false,levelRetry:d,error:g,reason:c});if(!d){return}}Ti(t,this.observer,a,u,this.audioCodec);var m;if(e.pts!==undefined){m=e.pts}else if(i){var y=Ei(t.samplerate);m=i.sample.pts+y}else{A.warn("[tsdemuxer]: AAC PES unknown PTS");return}var T=0;var E;while(u<f){E=Ai(t,a,u,m,T);u+=E.length;if(!E.missing){T++;for(;u<f-1;u++){if(gi(a,u)){break}}}else{this.aacOverFlow=E;break}}};t.prototype.parseMPEGPES=function(t,e){var r=e.data;var i=r.length;var a=0;var n=0;var s=e.pts;if(s===undefined){A.warn("[tsdemuxer]: MPEG PES unknown PTS");return}while(n<i){if(xi(r,n)){var o=Ci(t,r,n,s,a);if(o){n+=o.length;a++}else{break}}else{n++}}};t.prototype.parseID3PES=function(t,e){if(e.pts===undefined){A.warn("[tsdemuxer]: ID3 PES unknown PTS");return}var r=o({},e,{type:this._avcTrack?_e.emsg:_e.audioId3,duration:Number.POSITIVE_INFINITY});t.samples.push(r)};return t}();function Ki(t,e,r,i){return{key:t,frame:false,pts:e,dts:r,units:[],debug:i,length:0}}function Hi(t,e){return((t[e+1]&31)<<8)+t[e+2]}function Vi(t,e){return(t[e+10]&31)<<8|t[e+11]}function ji(t,e,r,i){var a={audio:-1,avc:-1,id3:-1,segmentCodec:"aac"};var n=(t[e+1]&15)<<8|t[e+2];var s=e+3+n-4;var o=(t[e+10]&15)<<8|t[e+11];e+=12+o;while(e<s){var l=Hi(t,e);switch(t[e]){case 207:if(!i){A.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:if(a.audio===-1){a.audio=l}break;case 21:if(a.id3===-1){a.id3=l}break;case 219:if(!i){A.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:if(a.avc===-1){a.avc=l}break;case 3:case 4:if(r.mpeg!==true&&r.mp3!==true){A.log("MPEG audio found, not supported in this browser")}else if(a.audio===-1){a.audio=l;a.segmentCodec="mp3"}break;case 36:A.warn("Unsupported HEVC stream type found");break}e+=((t[e+3]&15)<<8|t[e+4])+5}return a}function Yi(t){var e=0;var r;var i;var a;var n;var s;var o=t.data;if(!t||t.size===0){return null}while(o[0].length<19&&o.length>1){var l=new Uint8Array(o[0].length+o[1].length);l.set(o[0]);l.set(o[1],o[0].length);o[0]=l;o.splice(1,1)}r=o[0];var u=(r[0]<<16)+(r[1]<<8)+r[2];if(u===1){i=(r[4]<<8)+r[5];if(i&&i>t.size-6){return null}var f=r[7];if(f&192){n=(r[9]&14)*536870912+(r[10]&255)*4194304+(r[11]&254)*16384+(r[12]&255)*128+(r[13]&254)/2;if(f&64){s=(r[14]&14)*536870912+(r[15]&255)*4194304+(r[16]&254)*16384+(r[17]&255)*128+(r[18]&254)/2;if(n-s>60*9e4){A.warn("".concat(Math.round((n-s)/9e4),"s delta between PTS and DTS, align them"));n=s}}else{s=n}}a=r[8];var c=a+9;if(t.size<=c){return null}t.size-=c;var d=new Uint8Array(t.size);for(var h=0,v=o.length;h<v;h++){r=o[h];var p=r.byteLength;if(c){if(c>p){c-=p;continue}else{r=r.subarray(c);p-=c;c=0}}d.set(r,e);e+=p}if(i){i-=a+3}return{data:d,pts:n,dts:s,len:i}}return null}function Wi(t,e){if(t.units.length&&t.frame){if(t.pts===undefined){var r=e.samples;var i=r.length;if(i){var a=r[i-1];t.pts=a.pts;t.dts=a.dts}else{e.dropped++;return}}e.samples.push(t)}if(t.debug.length){A.log(t.pts+"/"+t.dts+":"+t.debug)}}var qi=function(t){__extends(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}e.prototype.resetInitSegment=function(e,r,i,a){t.prototype.resetInitSegment.call(this,e,r,i,a);this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:r,duration:a,inputTimeScale:9e4,dropped:0}};e.probe=function(t){if(!t){return false}var e=tt(t,0)||[];var r=e.length;for(var i=t.length;r<i;r++){if(Mi(t,r)){A.log("MPEG Audio sync word found !");return true}}return false};e.prototype.canParse=function(t,e){return Fi(t,e)};e.prototype.appendFrame=function(t,e,r){if(this.basePTS===null){return}return Ci(t,e,r,this.basePTS,this.frameIndex)};return e}(ui);var Xi=function(){function t(){}t.getSilentFrame=function(t,e){switch(t){case"mp4a.40.2":if(e===1){return new Uint8Array([0,200,0,128,35,128])}else if(e===2){return new Uint8Array([33,0,73,144,2,25,0,35,128])}else if(e===3){return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142])}else if(e===4){return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56])}else if(e===5){return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56])}else if(e===6){return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224])}break;default:if(e===1){return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}else if(e===2){return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}else if(e===3){return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}break}return undefined};return t}();var zi=Math.pow(2,32)-1;var Qi=function(){function t(){}t.init=function(){t.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var e;for(e in t.types){if(t.types.hasOwnProperty(e)){t.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]}}var r=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]);var i=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);t.HDLR_TYPES={video:r,audio:i};var a=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]);var n=new Uint8Array([0,0,0,0,0,0,0,0]);t.STTS=t.STSC=t.STCO=n;t.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]);t.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]);t.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]);t.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var s=new Uint8Array([105,115,111,109]);var o=new Uint8Array([97,118,99,49]);var l=new Uint8Array([0,0,0,1]);t.FTYP=t.box(t.types.ftyp,s,l,s,o);t.DINF=t.box(t.types.dinf,t.box(t.types.dref,a))};t.box=function(t){var e=[];for(var r=1;r<arguments.length;r++){e[r-1]=arguments[r]}var i=8;var a=e.length;var n=a;while(a--){i+=e[a].byteLength}var s=new Uint8Array(i);s[0]=i>>24&255;s[1]=i>>16&255;s[2]=i>>8&255;s[3]=i&255;s.set(t,4);for(a=0,i=8;a<n;a++){s.set(e[a],i);i+=e[a].byteLength}return s};t.hdlr=function(e){return t.box(t.types.hdlr,t.HDLR_TYPES[e])};t.mdat=function(e){return t.box(t.types.mdat,e)};t.mdhd=function(e,r){r*=e;var i=Math.floor(r/(zi+1));var a=Math.floor(r%(zi+1));return t.box(t.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,i>>24,i>>16&255,i>>8&255,i&255,a>>24,a>>16&255,a>>8&255,a&255,85,196,0,0]))};t.mdia=function(e){return t.box(t.types.mdia,t.mdhd(e.timescale,e.duration),t.hdlr(e.type),t.minf(e))};t.mfhd=function(e){return t.box(t.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,e&255]))};t.minf=function(e){if(e.type==="audio"){return t.box(t.types.minf,t.box(t.types.smhd,t.SMHD),t.DINF,t.stbl(e))}else{return t.box(t.types.minf,t.box(t.types.vmhd,t.VMHD),t.DINF,t.stbl(e))}};t.moof=function(e,r,i){return t.box(t.types.moof,t.mfhd(e),t.traf(i,r))};t.moov=function(e){var r=e.length;var i=[];while(r--){i[r]=t.trak(e[r])}return t.box.apply(null,[t.types.moov,t.mvhd(e[0].timescale,e[0].duration)].concat(i).concat(t.mvex(e)))};t.mvex=function(e){var r=e.length;var i=[];while(r--){i[r]=t.trex(e[r])}return t.box.apply(null,__spreadArray([t.types.mvex],i,true))};t.mvhd=function(e,r){r*=e;var i=Math.floor(r/(zi+1));var a=Math.floor(r%(zi+1));var n=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,i>>24,i>>16&255,i>>8&255,i&255,a>>24,a>>16&255,a>>8&255,a&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return t.box(t.types.mvhd,n)};t.sdtp=function(e){var r=e.samples||[];var i=new Uint8Array(4+r.length);var a;var n;for(a=0;a<r.length;a++){n=r[a].flags;i[a+4]=n.dependsOn<<4|n.isDependedOn<<2|n.hasRedundancy}return t.box(t.types.sdtp,i)};t.stbl=function(e){return t.box(t.types.stbl,t.stsd(e),t.box(t.types.stts,t.STTS),t.box(t.types.stsc,t.STSC),t.box(t.types.stsz,t.STSZ),t.box(t.types.stco,t.STCO))};t.avc1=function(e){var r=[];var i=[];var a;var n;var s;for(a=0;a<e.sps.length;a++){n=e.sps[a];s=n.byteLength;r.push(s>>>8&255);r.push(s&255);r=r.concat(Array.prototype.slice.call(n))}for(a=0;a<e.pps.length;a++){n=e.pps[a];s=n.byteLength;i.push(s>>>8&255);i.push(s&255);i=i.concat(Array.prototype.slice.call(n))}var o=t.box(t.types.avcC,new Uint8Array([1,r[3],r[4],r[5],252|3,224|e.sps.length].concat(r).concat([e.pps.length]).concat(i)));var l=e.width;var u=e.height;var f=e.pixelRatio[0];var c=e.pixelRatio[1];return t.box(t.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,l>>8&255,l&255,u>>8&255,u&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),o,t.box(t.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),t.box(t.types.pasp,new Uint8Array([f>>24,f>>16&255,f>>8&255,f&255,c>>24,c>>16&255,c>>8&255,c&255])))};t.esds=function(t){var e=t.config.length;return new Uint8Array([0,0,0,0,3,23+e,0,1,0,4,15+e,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([e]).concat(t.config).concat([6,1,2]))};t.mp4a=function(e){var r=e.samplerate;return t.box(t.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,r>>8&255,r&255,0,0]),t.box(t.types.esds,t.esds(e)))};t.mp3=function(e){var r=e.samplerate;return t.box(t.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,r>>8&255,r&255,0,0]))};t.stsd=function(e){if(e.type==="audio"){if(e.segmentCodec==="mp3"&&e.codec==="mp3"){return t.box(t.types.stsd,t.STSD,t.mp3(e))}return t.box(t.types.stsd,t.STSD,t.mp4a(e))}else{return t.box(t.types.stsd,t.STSD,t.avc1(e))}};t.tkhd=function(e){var r=e.id;var i=e.duration*e.timescale;var a=e.width;var n=e.height;var s=Math.floor(i/(zi+1));var o=Math.floor(i%(zi+1));return t.box(t.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,r>>24&255,r>>16&255,r>>8&255,r&255,0,0,0,0,s>>24,s>>16&255,s>>8&255,s&255,o>>24,o>>16&255,o>>8&255,o&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,a>>8&255,a&255,0,0,n>>8&255,n&255,0,0]))};t.traf=function(e,r){var i=t.sdtp(e);var a=e.id;var n=Math.floor(r/(zi+1));var s=Math.floor(r%(zi+1));return t.box(t.types.traf,t.box(t.types.tfhd,new Uint8Array([0,0,0,0,a>>24,a>>16&255,a>>8&255,a&255])),t.box(t.types.tfdt,new Uint8Array([1,0,0,0,n>>24,n>>16&255,n>>8&255,n&255,s>>24,s>>16&255,s>>8&255,s&255])),t.trun(e,i.length+16+20+8+16+8+8),i)};t.trak=function(e){e.duration=e.duration||4294967295;return t.box(t.types.trak,t.tkhd(e),t.mdia(e))};t.trex=function(e){var r=e.id;return t.box(t.types.trex,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,r&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))};t.trun=function(e,r){var i=e.samples||[];var a=i.length;var n=12+16*a;var s=new Uint8Array(n);var o;var l;var u;var f;var c;var d;r+=8+n;s.set([e.type==="video"?1:0,0,15,1,a>>>24&255,a>>>16&255,a>>>8&255,a&255,r>>>24&255,r>>>16&255,r>>>8&255,r&255],0);for(o=0;o<a;o++){l=i[o];u=l.duration;f=l.size;c=l.flags;d=l.cts;s.set([u>>>24&255,u>>>16&255,u>>>8&255,u&255,f>>>24&255,f>>>16&255,f>>>8&255,f&255,c.isLeading<<2|c.dependsOn,c.isDependedOn<<6|c.hasRedundancy<<4|c.paddingValue<<1|c.isNonSync,c.degradPrio&240<<8,c.degradPrio&15,d>>>24&255,d>>>16&255,d>>>8&255,d&255],12+16*o)}return t.box(t.types.trun,s)};t.initSegment=function(e){if(!t.types){t.init()}var r=t.moov(e);var i=new Uint8Array(t.FTYP.byteLength+r.byteLength);i.set(t.FTYP);i.set(r,t.FTYP.byteLength);return i};return t}();Qi.types=void 0;Qi.HDLR_TYPES=void 0;Qi.STTS=void 0;Qi.STSC=void 0;Qi.STCO=void 0;Qi.STSZ=void 0;Qi.VMHD=void 0;Qi.SMHD=void 0;Qi.STSD=void 0;Qi.FTYP=void 0;Qi.DINF=void 0;var $i=9e4;function Ji(t,e,r,i){if(r===void 0){r=1}if(i===void 0){i=false}var a=t*e*r;return i?Math.round(a):a}function Zi(t,e,r,i){if(r===void 0){r=1}if(i===void 0){i=false}return Ji(t,e,1/r,i)}function ta(t,e){if(e===void 0){e=false}return Ji(t,1e3,1/$i,e)}function ea(t,e){if(e===void 0){e=1}return Ji(t,$i,1/e)}var ra=10*1e3;var ia=1024;var aa=1152;var na=null;var sa=null;var oa=function(){function t(t,e,r,i){if(i===void 0){i=""}this.observer=void 0;this.config=void 0;this.typeSupported=void 0;this.ISGenerated=false;this._initPTS=null;this._initDTS=null;this.nextAvcDts=null;this.nextAudioPts=null;this.videoSampleDuration=null;this.isAudioContiguous=false;this.isVideoContiguous=false;this.observer=t;this.config=e;this.typeSupported=r;this.ISGenerated=false;if(na===null){var a=navigator.userAgent||"";var n=a.match(/Chrome\/(\d+)/i);na=n?parseInt(n[1]):0}if(sa===null){var n=navigator.userAgent.match(/Safari\/(\d+)/i);sa=n?parseInt(n[1]):0}}t.prototype.destroy=function(){};t.prototype.resetTimeStamp=function(t){A.log("[mp4-remuxer]: initPTS & initDTS reset");this._initPTS=this._initDTS=t};t.prototype.resetNextTimestamp=function(){A.log("[mp4-remuxer]: reset next timestamp");this.isVideoContiguous=false;this.isAudioContiguous=false};t.prototype.resetInitSegment=function(){A.log("[mp4-remuxer]: ISGenerated flag reset");this.ISGenerated=false};t.prototype.getVideoStartPts=function(t){var e=false;var r=t.reduce((function(t,r){var i=r.pts-t;if(i<-4294967296){e=true;return la(t,r.pts)}else if(i>0){return t}else{return r.pts}}),t[0].pts);if(e){A.debug("PTS rollover detected")}return r};t.prototype.remux=function(t,e,r,i,a,n,s,o){var l;var u;var f;var c;var d;var h;var v=a;var p=a;var g=t.pid>-1;var m=e.pid>-1;var y=e.samples.length;var T=t.samples.length>0;var E=s&&y>0||y>1;var S=(!g||T)&&(!m||E)||this.ISGenerated||s;if(S){if(!this.ISGenerated){f=this.generateIS(t,e,a,n)}var L=this.isVideoContiguous;var b=-1;var R=void 0;if(E){b=ua(e.samples);if(!L&&this.config.forceKeyFrameOnDiscontinuity){h=true;if(b>0){A.warn("[mp4-remuxer]: Dropped ".concat(b," out of ").concat(y," video samples due to a missing keyframe"));var I=this.getVideoStartPts(e.samples);e.samples=e.samples.slice(b);e.dropped+=b;p+=(e.samples[0].pts-I)/e.inputTimeScale;R=p}else if(b===-1){A.warn("[mp4-remuxer]: No keyframe found out of ".concat(y," video samples"));h=false}}}if(this.ISGenerated){if(T&&E){var I=this.getVideoStartPts(e.samples);var D=la(t.samples[0].pts,I)-I;var k=D/e.inputTimeScale;v+=Math.max(0,k);p+=Math.max(0,-k)}if(T){if(!t.samplerate){A.warn("[mp4-remuxer]: regenerate InitSegment as audio detected");f=this.generateIS(t,e,a,n)}u=this.remuxAudio(t,v,this.isAudioContiguous,n,m||E||o===Te.AUDIO?p:undefined);if(E){var _=u?u.endPTS-u.startPTS:0;if(!e.inputTimeScale){A.warn("[mp4-remuxer]: regenerate InitSegment as video detected");f=this.generateIS(t,e,a,n)}l=this.remuxVideo(e,p,L,_)}}else if(E){l=this.remuxVideo(e,p,L,0)}if(l){l.firstKeyFrame=b;l.independent=b!==-1;l.firstKeyFramePTS=R}}}if(this.ISGenerated&&this._initPTS&&this._initDTS){if(r.samples.length){d=fa(r,a,this._initPTS,this._initDTS)}if(i.samples.length){c=ca(i,a,this._initPTS)}}return{audio:u,video:l,initSegment:f,independent:h,text:c,id3:d}};t.prototype.generateIS=function(t,e,r,i){var a=t.samples;var n=e.samples;var s=this.typeSupported;var o={};var l=this._initPTS;var u=!l||i;var f="audio/mp4";var c;var d;var h;if(u){c=d=Infinity}if(t.config&&a.length){t.timescale=t.samplerate;switch(t.segmentCodec){case"mp3":if(s.mpeg){f="audio/mpeg";t.codec=""}else if(s.mp3){t.codec="mp3"}break}o.audio={id:"audio",container:f,codec:t.codec,initSegment:t.segmentCodec==="mp3"&&s.mpeg?new Uint8Array(0):Qi.initSegment([t]),metadata:{channelCount:t.channelCount}};if(u){h=t.inputTimeScale;if(!l||h!==l.timescale){c=d=a[0].pts-Math.round(h*r)}else{u=false}}}if(e.sps&&e.pps&&n.length){e.timescale=e.inputTimeScale;o.video={id:"main",container:"video/mp4",codec:e.codec,initSegment:Qi.initSegment([e]),metadata:{width:e.width,height:e.height}};if(u){h=e.inputTimeScale;if(!l||h!==l.timescale){var v=this.getVideoStartPts(n);var p=Math.round(h*r);d=Math.min(d,la(n[0].dts,v)-p);c=Math.min(c,v-p)}else{u=false}}}if(Object.keys(o).length){this.ISGenerated=true;if(u){this._initPTS={baseTime:c,timescale:h};this._initDTS={baseTime:d,timescale:h}}else{c=h=undefined}return{tracks:o,initPTS:c,timescale:h}}};t.prototype.remuxVideo=function(t,e,r,i){var a=t.inputTimeScale;var n=t.samples;var s=[];var l=n.length;var u=this._initPTS;var f=this.nextAvcDts;var c=8;var d=this.videoSampleDuration;var g;var m;var y=Number.POSITIVE_INFINITY;var T=Number.NEGATIVE_INFINITY;var E=false;if(!r||f===null){var S=e*a;var L=n[0].pts-la(n[0].dts,n[0].pts);f=S-L}var b=u.baseTime*a/u.timescale;for(var R=0;R<l;R++){var I=n[R];I.pts=la(I.pts-b,f);I.dts=la(I.dts-b,f);if(I.dts<n[R>0?R-1:R].dts){E=true}}if(E){n.sort((function(t,e){var r=t.dts-e.dts;var i=t.pts-e.pts;return r||i}))}g=n[0].dts;m=n[n.length-1].dts;var D=m-g;var k=D?Math.round(D/(l-1)):d||t.inputTimeScale/30;if(r){var _=g-f;var w=_>k;var C=_<-1;if(w||C){if(w){A.warn("AVC: ".concat(ta(_,true)," ms (").concat(_,"dts) hole between fragments detected, filling it"))}else{A.warn("AVC: ".concat(ta(-_,true)," ms (").concat(_,"dts) overlapping between fragments detected"))}if(!C||f>=n[0].pts){g=f;var P=n[0].pts-_;n[0].dts=g;n[0].pts=P;A.log("Video: First PTS/DTS adjusted: ".concat(ta(P,true),"/").concat(ta(g,true),", delta: ").concat(ta(_,true)," ms"))}}}g=Math.max(0,g);var O=0;var x=0;for(var R=0;R<l;R++){var I=n[R];var F=I.units;var M=F.length;var N=0;for(var U=0;U<M;U++){N+=F[U].data.length}x+=N;O+=M;I.length=N;I.dts=Math.max(I.dts,g);y=Math.min(I.pts,y);T=Math.max(I.pts,T)}m=n[l-1].dts;var B=x+4*O+8;var G;try{G=new Uint8Array(B)}catch(t){this.observer.emit(h.ERROR,h.ERROR,{type:v.MUX_ERROR,details:p.REMUX_ALLOC_ERROR,fatal:false,error:t,bytes:B,reason:"fail allocating video mdat ".concat(B)});return}var K=new DataView(G.buffer);K.setUint32(0,B);G.set(Qi.types.mdat,4);var H=false;var V=Number.POSITIVE_INFINITY;var j=Number.POSITIVE_INFINITY;var Y=Number.NEGATIVE_INFINITY;var W=Number.NEGATIVE_INFINITY;for(var R=0;R<l;R++){var q=n[R];var X=q.units;var z=0;for(var U=0,M=X.length;U<M;U++){var Q=X[U];var $=Q.data;var J=Q.data.byteLength;K.setUint32(c,J);c+=4;G.set($,c);c+=J;z+=4+J}var Z=void 0;if(R<l-1){d=n[R+1].dts-q.dts;Z=n[R+1].pts-q.pts}else{var tt=this.config;var et=R>0?q.dts-n[R-1].dts:k;Z=R>0?q.pts-n[R-1].pts:k;if(tt.stretchShortVideoTrack&&this.nextAudioPts!==null){var rt=Math.floor(tt.maxBufferHole*a);var it=(i?y+i*a:this.nextAudioPts)-q.pts;if(it>rt){d=it-et;if(d<0){d=et}else{H=true}A.log("[mp4-remuxer]: It is approximately ".concat(it/90," ms to the next segment; using duration ").concat(d/90," ms for the last video frame."))}else{d=et}}else{d=et}}var at=Math.round(q.pts-q.dts);V=Math.min(V,d);Y=Math.max(Y,d);j=Math.min(j,Z);W=Math.max(W,Z);s.push(new da(q.key,d,z,at))}if(s.length){if(na){if(na<70){var nt=s[0].flags;nt.dependsOn=2;nt.isNonSync=0}}else if(sa){if(W-j<Y-V&&k/Y<.025&&s[0].cts===0){A.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");var st=g;for(var R=0,ot=s.length;R<ot;R++){var lt=st+s[R].duration;var S=st+s[R].cts;if(R<ot-1){var ut=lt+s[R+1].cts;s[R].duration=ut-S}else{s[R].duration=R?s[R-1].duration:k}s[R].cts=0;st=lt}}}}d=H||!d?k:d;this.nextAvcDts=f=m+d;this.videoSampleDuration=d;this.isVideoContiguous=true;var ft=Qi.moof(t.sequenceNumber++,g,o({},t,{samples:s}));var ct="video";var dt={data1:ft,data2:G,startPTS:y/a,endPTS:(T+d)/a,startDTS:g/a,endDTS:f/a,type:ct,hasAudio:false,hasVideo:true,nb:s.length,dropped:t.dropped};t.samples=[];t.dropped=0;return dt};t.prototype.remuxAudio=function(t,e,r,i,a){var n=t.inputTimeScale;var s=t.samplerate?t.samplerate:n;var l=n/s;var u=t.segmentCodec==="aac"?ia:aa;var f=u*l;var c=this._initPTS;var d=t.segmentCodec==="mp3"&&this.typeSupported.mpeg;var g=[];var m=a!==undefined;var y=t.samples;var T=d?0:8;var E=this.nextAudioPts||-1;var S=e*n;var L=c.baseTime*n/c.timescale;this.isAudioContiguous=r=r||y.length&&E>0&&(i&&Math.abs(S-E)<9e3||Math.abs(la(y[0].pts-L,S)-E)<20*f);y.forEach((function(t){t.pts=la(t.pts-L,S)}));if(!r||E<0){y=y.filter((function(t){return t.pts>=0}));if(!y.length){return}if(a===0){E=0}else if(i&&!m){E=Math.max(0,S)}else{E=y[0].pts}}if(t.segmentCodec==="aac"){var b=this.config.maxAudioFramesDrift;for(var R=0,I=E;R<y.length;R++){var D=y[R];var k=D.pts;var _=k-I;var w=Math.abs(1e3*_/n);if(_<=-b*f&&m){if(R===0){A.warn("Audio frame @ ".concat((k/n).toFixed(3),"s overlaps nextAudioPts by ").concat(Math.round(1e3*_/n)," ms."));this.nextAudioPts=E=I=k}}else if(_>=b*f&&w<ra&&m){var C=Math.round(_/f);I=k-C*f;if(I<0){C--;I+=f}if(R===0){this.nextAudioPts=E=I}A.warn("[mp4-remuxer]: Injecting ".concat(C," audio frame @ ").concat((I/n).toFixed(3),"s due to ").concat(Math.round(1e3*_/n)," ms gap."));for(var P=0;P<C;P++){var O=Math.max(I,0);var x=Xi.getSilentFrame(t.manifestCodec||t.codec,t.channelCount);if(!x){A.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead.");x=D.unit.subarray()}y.splice(R,0,{unit:x,pts:O});I+=f;R++}}D.pts=I;I+=f}}var F=null;var M=null;var N;var U=0;var B=y.length;while(B--){U+=y[B].unit.byteLength}for(var P=0,G=y.length;P<G;P++){var K=y[P];var H=K.unit;var k=K.pts;if(M!==null){var V=g[P-1];V.duration=Math.round((k-M)/l)}else{if(r&&t.segmentCodec==="aac"){k=E}F=k;if(U>0){U+=T;try{N=new Uint8Array(U)}catch(t){this.observer.emit(h.ERROR,h.ERROR,{type:v.MUX_ERROR,details:p.REMUX_ALLOC_ERROR,fatal:false,error:t,bytes:U,reason:"fail allocating audio mdat ".concat(U)});return}if(!d){var j=new DataView(N.buffer);j.setUint32(0,U);N.set(Qi.types.mdat,4)}}else{return}}N.set(H,T);var Y=H.byteLength;T+=Y;g.push(new da(true,u,Y,0));M=k}var W=g.length;if(!W){return}var q=g[g.length-1];this.nextAudioPts=E=M+l*q.duration;var X=d?new Uint8Array(0):Qi.moof(t.sequenceNumber++,F/l,o({},t,{samples:g}));t.samples=[];var z=F/n;var Q=E/n;var $="audio";var J={data1:X,data2:N,startPTS:z,endPTS:Q,startDTS:z,endDTS:Q,type:$,hasAudio:true,hasVideo:false,nb:W};this.isAudioContiguous=true;return J};t.prototype.remuxEmptyAudio=function(t,e,r,i){var a=t.inputTimeScale;var n=t.samplerate?t.samplerate:a;var s=a/n;var o=this.nextAudioPts;var l=this._initDTS;var u=l.baseTime*9e4/l.timescale;var f=(o!==null?o:i.startDTS*a)+u;var c=i.endDTS*a+u;var d=s*ia;var h=Math.ceil((c-f)/d);var v=Xi.getSilentFrame(t.manifestCodec||t.codec,t.channelCount);A.warn("[mp4-remuxer]: remux empty Audio");if(!v){A.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}var p=[];for(var g=0;g<h;g++){var m=f+g*d;p.push({unit:v,pts:m,dts:m})}t.samples=p;return this.remuxAudio(t,e,r,false)};return t}();function la(t,e){var r;if(e===null){return t}if(e<t){r=-8589934592}else{r=8589934592}while(Math.abs(t-e)>4294967296){t+=r}return t}function ua(t){for(var e=0;e<t.length;e++){if(t[e].key){return e}}return-1}function fa(t,e,r,i){var a=t.samples.length;if(!a){return}var n=t.inputTimeScale;for(var s=0;s<a;s++){var o=t.samples[s];o.pts=la(o.pts-r.baseTime*n/r.timescale,e*n)/n;o.dts=la(o.dts-i.baseTime*n/i.timescale,e*n)/n}var l=t.samples;t.samples=[];return{samples:l}}function ca(t,e,r){var i=t.samples.length;if(!i){return}var a=t.inputTimeScale;for(var n=0;n<i;n++){var s=t.samples[n];s.pts=la(s.pts-r.baseTime*a/r.timescale,e*a)/a}t.samples.sort((function(t,e){return t.pts-e.pts}));var o=t.samples;t.samples=[];return{samples:o}}var da=function(){function t(t,e,r,i){this.size=void 0;this.duration=void 0;this.cts=void 0;this.flags=void 0;this.duration=e;this.size=r;this.cts=i;this.flags=new ha(t)}return t}();var ha=function(){function t(t){this.isLeading=0;this.isDependedOn=0;this.hasRedundancy=0;this.degradPrio=0;this.dependsOn=1;this.isNonSync=1;this.dependsOn=t?2:1;this.isNonSync=t?0:1}return t}();var va=function(){function t(){this.emitInitSegment=false;this.audioCodec=void 0;this.videoCodec=void 0;this.initData=void 0;this.initPTS=null;this.initTracks=void 0;this.lastEndTime=null}t.prototype.destroy=function(){};t.prototype.resetTimeStamp=function(t){this.initPTS=t;this.lastEndTime=null};t.prototype.resetNextTimestamp=function(){this.lastEndTime=null};t.prototype.resetInitSegment=function(t,e,r,i){this.audioCodec=e;this.videoCodec=r;this.generateInitSegment(Dt(t,i));this.emitInitSegment=true};t.prototype.generateInitSegment=function(t){var e=this,r=e.audioCodec,i=e.videoCodec;if(!(t!=null&&t.byteLength)){this.initTracks=undefined;this.initData=undefined;return}var a=this.initData=It(t);if(!r){r=ga(a.audio,w.AUDIO)}if(!i){i=ga(a.video,w.VIDEO)}var n={};if(a.audio&&a.video){n.audiovideo={container:"video/mp4",codec:r+","+i,initSegment:t,id:"main"}}else if(a.audio){n.audio={container:"audio/mp4",codec:r,initSegment:t,id:"audio"}}else if(a.video){n.video={container:"video/mp4",codec:i,initSegment:t,id:"main"}}else{A.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes.")}this.initTracks=n};t.prototype.remux=function(t,e,r,i,a,n){var s,o;var l=this,u=l.initPTS,c=l.lastEndTime;var d={audio:undefined,video:undefined,text:i,id3:r,initSegment:undefined};if(!f(c)){c=this.lastEndTime=a||0}var h=e.samples;if(!(h!=null&&h.length)){return d}var v={initPTS:undefined,timescale:1};var p=this.initData;if(!((s=p)!=null&&s.length)){this.generateInitSegment(h);p=this.initData}if(!((o=p)!=null&&o.length)){A.warn("[passthrough-remuxer.ts]: Failed to generate initSegment.");return d}if(this.emitInitSegment){v.tracks=this.initTracks;this.emitInitSegment=false}var g=wt(h,p);var m=_t(p,h);var y=m===null?a:m;if(pa(u,y,a,g)||v.timescale!==u.timescale&&n){v.initPTS=y-a;if(u&&u.timescale===1){A.warn("Adjusting initPTS by ".concat(v.initPTS-u.baseTime))}this.initPTS=u={baseTime:v.initPTS,timescale:1}}var T=t?y-u.baseTime/u.timescale:c;var E=T+g;Pt(p,h,u.baseTime/u.timescale);if(g>0){this.lastEndTime=E}else{A.warn("Duration parsed from mp4 should be greater than zero");this.resetNextTimestamp()}var S=!!p.audio;var L=!!p.video;var b="";if(S){b+="audio"}if(L){b+="video"}var R={data1:h,startPTS:T,startDTS:T,endPTS:E,endDTS:E,type:b,hasAudio:S,hasVideo:L,nb:1,dropped:0};d.audio=R.type==="audio"?R:undefined;d.video=R.type!=="audio"?R:undefined;d.initSegment=v;d.id3=fa(r,a,u,u);if(i.samples.length){d.text=ca(i,a,u)}return d};return t}();function pa(t,e,r,i){if(t===null){return true}var a=Math.max(i,1);var n=e-t.baseTime/t.timescale;return Math.abs(n-r)>a}function ga(t,e){var r=t==null?void 0:t.codec;if(r&&r.length>4){return r}if(r==="hvc1"||r==="hev1"){return"hvc1.1.6.L120.90"}if(r==="av01"){return"av01.0.04M.08"}if(r==="avc1"||e===w.VIDEO){return"avc1.42e01e"}return"mp4a.40.5"}var ma;try{ma=self.performance.now.bind(self.performance)}catch(t){A.debug("Unable to use Performance API on this environment");ma=typeof self!=="undefined"&&self.Date.now}var ya=[{demux:Ri,remux:va},{demux:Gi,remux:oa},{demux:Li,remux:oa},{demux:qi,remux:oa}];var Ta=function(){function t(t,e,r,i,a){this.async=false;this.observer=void 0;this.typeSupported=void 0;this.config=void 0;this.vendor=void 0;this.id=void 0;this.demuxer=void 0;this.remuxer=void 0;this.decrypter=void 0;this.probe=void 0;this.decryptionPromise=null;this.transmuxConfig=void 0;this.currentTransmuxState=void 0;this.observer=t;this.typeSupported=e;this.config=r;this.vendor=i;this.id=a}t.prototype.configure=function(t){this.transmuxConfig=t;if(this.decrypter){this.decrypter.reset()}};t.prototype.push=function(t,e,r,i){var a=this;var n=r.transmuxing;n.executeStart=ma();var s=new Uint8Array(t);var o=this,l=o.currentTransmuxState,u=o.transmuxConfig;if(i){this.currentTransmuxState=i}var f=i||l,c=f.contiguous,d=f.discontinuity,g=f.trackSwitch,m=f.accurateTimeOffset,y=f.timeOffset,T=f.initSegmentChange;var E=u.audioCodec,S=u.videoCodec,L=u.defaultInitPts,b=u.duration,R=u.initSegmentData;var I=Ea(s,e);if(I&&I.method==="AES-128"){var D=this.getDecrypter();if(D.isSync()){var k=D.softwareDecrypt(s,I.key.buffer,I.iv.buffer);var _=r.part>-1;if(_){k=D.flush()}if(!k){n.executeEnd=ma();return Sa(r)}s=new Uint8Array(k)}else{this.decryptionPromise=D.webCryptoDecrypt(s,I.key.buffer,I.iv.buffer).then((function(t){var e=a.push(t,null,r);a.decryptionPromise=null;return e}));return this.decryptionPromise}}var w=this.needsProbing(d,g);if(w){var C=this.configureTransmuxer(s);if(C){A.warn("[transmuxer] ".concat(C.message));this.observer.emit(h.ERROR,h.ERROR,{type:v.MEDIA_ERROR,details:p.FRAG_PARSING_ERROR,fatal:false,error:C,reason:C.message});n.executeEnd=ma();return Sa(r)}}if(d||g||T||w){this.resetInitSegment(R,E,S,b,e)}if(d||T||w){this.resetInitialTimestamp(L)}if(!c){this.resetContiguity()}var P=this.transmux(s,I,y,m,r);var O=this.currentTransmuxState;O.contiguous=true;O.discontinuity=false;O.trackSwitch=false;n.executeEnd=ma();return P};t.prototype.flush=function(t){var e=this;var r=t.transmuxing;r.executeStart=ma();var i=this,a=i.decrypter,n=i.currentTransmuxState,s=i.decryptionPromise;if(s){return s.then((function(){return e.flush(t)}))}var o=[];var l=n.timeOffset;if(a){var u=a.flush();if(u){o.push(this.push(u,null,t))}}var f=this,c=f.demuxer,d=f.remuxer;if(!c||!d){r.executeEnd=ma();return[Sa(t)]}var h=c.flush(l);if(Aa(h)){return h.then((function(r){e.flushRemux(o,r,t);return o}))}this.flushRemux(o,h,t);return o};t.prototype.flushRemux=function(t,e,r){var i=e.audioTrack,a=e.videoTrack,n=e.id3Track,s=e.textTrack;var o=this.currentTransmuxState,l=o.accurateTimeOffset,u=o.timeOffset;A.log("[transmuxer.ts]: Flushed fragment ".concat(r.sn).concat(r.part>-1?" p: "+r.part:""," of level ").concat(r.level));var f=this.remuxer.remux(i,a,n,s,u,l,true,this.id);t.push({remuxResult:f,chunkMeta:r});r.transmuxing.executeEnd=ma()};t.prototype.resetInitialTimestamp=function(t){var e=this,r=e.demuxer,i=e.remuxer;if(!r||!i){return}r.resetTimeStamp(t);i.resetTimeStamp(t)};t.prototype.resetContiguity=function(){var t=this,e=t.demuxer,r=t.remuxer;if(!e||!r){return}e.resetContiguity();r.resetNextTimestamp()};t.prototype.resetInitSegment=function(t,e,r,i,a){var n=this,s=n.demuxer,o=n.remuxer;if(!s||!o){return}s.resetInitSegment(t,e,r,i);o.resetInitSegment(t,e,r,a)};t.prototype.destroy=function(){if(this.demuxer){this.demuxer.destroy();this.demuxer=undefined}if(this.remuxer){this.remuxer.destroy();this.remuxer=undefined}};t.prototype.transmux=function(t,e,r,i,a){var n;if(e&&e.method==="SAMPLE-AES"){n=this.transmuxSampleAes(t,e,r,i,a)}else{n=this.transmuxUnencrypted(t,r,i,a)}return n};t.prototype.transmuxUnencrypted=function(t,e,r,i){var a=this.demuxer.demux(t,e,false,!this.config.progressive),n=a.audioTrack,s=a.videoTrack,o=a.id3Track,l=a.textTrack;var u=this.remuxer.remux(n,s,o,l,e,r,false,this.id);return{remuxResult:u,chunkMeta:i}};t.prototype.transmuxSampleAes=function(t,e,r,i,a){var n=this;return this.demuxer.demuxSampleAes(t,e,r).then((function(t){var e=n.remuxer.remux(t.audioTrack,t.videoTrack,t.id3Track,t.textTrack,r,i,false,n.id);return{remuxResult:e,chunkMeta:a}}))};t.prototype.configureTransmuxer=function(t){var e=this,r=e.config,i=e.observer,a=e.typeSupported,n=e.vendor;var s;for(var o=0,l=ya.length;o<l;o++){if(ya[o].demux.probe(t)){s=ya[o];break}}if(!s){return new Error("Failed to find demuxer by probing fragment data")}var u=this.demuxer;var f=this.remuxer;var c=s.remux;var d=s.demux;if(!f||!(f instanceof c)){this.remuxer=new c(i,r,a,n)}if(!u||!(u instanceof d)){this.demuxer=new d(i,r,a);this.probe=d.probe}};t.prototype.needsProbing=function(t,e){return!this.demuxer||!this.remuxer||t||e};t.prototype.getDecrypter=function(){var t=this.decrypter;if(!t){t=this.decrypter=new Jr(this.config)}return t};return t}();function Ea(t,e){var r=null;if(t.byteLength>0&&e!=null&&e.key!=null&&e.iv!==null&&e.method!=null){r=e}return r}var Sa=function(t){return{remuxResult:{},chunkMeta:t}};function Aa(t){return"then"in t&&t.then instanceof Function}var La=function(){function t(t,e,r,i,a){this.audioCodec=void 0;this.videoCodec=void 0;this.initSegmentData=void 0;this.duration=void 0;this.defaultInitPts=void 0;this.audioCodec=t;this.videoCodec=e;this.initSegmentData=r;this.duration=i;this.defaultInitPts=a||null}return t}();var ba=function(){function t(t,e,r,i,a,n){this.discontinuity=void 0;this.contiguous=void 0;this.accurateTimeOffset=void 0;this.trackSwitch=void 0;this.timeOffset=void 0;this.initSegmentChange=void 0;this.discontinuity=t;this.contiguous=e;this.accurateTimeOffset=r;this.trackSwitch=i;this.timeOffset=a;this.initSegmentChange=n}return t}();var Ra={exports:{}};(function(t){var e=Object.prototype.hasOwnProperty,r="~";function i(){}if(Object.create){i.prototype=Object.create(null);if(!(new i).__proto__)r=false}function a(t,e,r){this.fn=t;this.context=e;this.once=r||false}function n(t,e,i,n,s){if(typeof i!=="function"){throw new TypeError("The listener must be a function")}var o=new a(i,n||t,s),l=r?r+e:e;if(!t._events[l])t._events[l]=o,t._eventsCount++;else if(!t._events[l].fn)t._events[l].push(o);else t._events[l]=[t._events[l],o];return t}function s(t,e){if(--t._eventsCount===0)t._events=new i;else delete t._events[e]}function o(){this._events=new i;this._eventsCount=0}o.prototype.eventNames=function t(){var i=[],a,n;if(this._eventsCount===0)return i;for(n in a=this._events){if(e.call(a,n))i.push(r?n.slice(1):n)}if(Object.getOwnPropertySymbols){return i.concat(Object.getOwnPropertySymbols(a))}return i};o.prototype.listeners=function t(e){var i=r?r+e:e,a=this._events[i];if(!a)return[];if(a.fn)return[a.fn];for(var n=0,s=a.length,o=new Array(s);n<s;n++){o[n]=a[n].fn}return o};o.prototype.listenerCount=function t(e){var i=r?r+e:e,a=this._events[i];if(!a)return 0;if(a.fn)return 1;return a.length};o.prototype.emit=function t(e,i,a,n,s,o){var l=r?r+e:e;if(!this._events[l])return false;var u=this._events[l],f=arguments.length,c,d;if(u.fn){if(u.once)this.removeListener(e,u.fn,undefined,true);switch(f){case 1:return u.fn.call(u.context),true;case 2:return u.fn.call(u.context,i),true;case 3:return u.fn.call(u.context,i,a),true;case 4:return u.fn.call(u.context,i,a,n),true;case 5:return u.fn.call(u.context,i,a,n,s),true;case 6:return u.fn.call(u.context,i,a,n,s,o),true}for(d=1,c=new Array(f-1);d<f;d++){c[d-1]=arguments[d]}u.fn.apply(u.context,c)}else{var h=u.length,v;for(d=0;d<h;d++){if(u[d].once)this.removeListener(e,u[d].fn,undefined,true);switch(f){case 1:u[d].fn.call(u[d].context);break;case 2:u[d].fn.call(u[d].context,i);break;case 3:u[d].fn.call(u[d].context,i,a);break;case 4:u[d].fn.call(u[d].context,i,a,n);break;default:if(!c)for(v=1,c=new Array(f-1);v<f;v++){c[v-1]=arguments[v]}u[d].fn.apply(u[d].context,c)}}}return true};o.prototype.on=function t(e,r,i){return n(this,e,r,i,false)};o.prototype.once=function t(e,r,i){return n(this,e,r,i,true)};o.prototype.removeListener=function t(e,i,a,n){var o=r?r+e:e;if(!this._events[o])return this;if(!i){s(this,o);return this}var l=this._events[o];if(l.fn){if(l.fn===i&&(!n||l.once)&&(!a||l.context===a)){s(this,o)}}else{for(var u=0,f=[],c=l.length;u<c;u++){if(l[u].fn!==i||n&&!l[u].once||a&&l[u].context!==a){f.push(l[u])}}if(f.length)this._events[o]=f.length===1?f[0]:f;else s(this,o)}return this};o.prototype.removeAllListeners=function t(e){var a;if(e){a=r?r+e:e;if(this._events[a])s(this,a)}else{this._events=new i;this._eventsCount=0}return this};o.prototype.off=o.prototype.removeListener;o.prototype.addListener=o.prototype.on;o.prefixed=r;o.EventEmitter=o;{t.exports=o}})(Ra);var Ia=Ra.exports;var Da=e(Ia);var ka=Zt()||{isTypeSupported:function(){return false}};var _a=function(){function t(t,e,r,i){var a=this;this.error=null;this.hls=void 0;this.id=void 0;this.observer=void 0;this.frag=null;this.part=null;this.useWorker=void 0;this.workerContext=null;this.onwmsg=void 0;this.transmuxer=null;this.onTransmuxComplete=void 0;this.onFlush=void 0;var n=t.config;this.hls=t;this.id=e;this.useWorker=!!n.enableWorker;this.onTransmuxComplete=r;this.onFlush=i;var s=function(t,e){e=e||{};e.frag=a.frag;e.id=a.id;if(t===h.ERROR){a.error=e.error}a.hls.trigger(t,e)};this.observer=new Da;this.observer.on(h.FRAG_DECRYPTED,s);this.observer.on(h.ERROR,s);var o={mp4:ka.isTypeSupported("video/mp4"),mpeg:ka.isTypeSupported("audio/mpeg"),mp3:ka.isTypeSupported('audio/mp4; codecs="mp3"')};var l=navigator.vendor;if(this.useWorker&&typeof Worker!=="undefined"){var u=n.workerPath||ni();if(u){try{if(n.workerPath){A.log("loading Web Worker ".concat(n.workerPath,' for "').concat(e,'"'));this.workerContext=oi(n.workerPath)}else{A.log('injecting Web Worker for "'.concat(e,'"'));this.workerContext=si()}this.onwmsg=function(t){return a.onWorkerMessage(t)};var f=this.workerContext.worker;f.addEventListener("message",this.onwmsg);f.onerror=function(t){var r=new Error("".concat(t.message," (").concat(t.filename,":").concat(t.lineno,")"));n.enableWorker=false;A.warn('Error in "'.concat(e,'" Web Worker, fallback to inline'));a.hls.trigger(h.ERROR,{type:v.OTHER_ERROR,details:p.INTERNAL_EXCEPTION,fatal:false,event:"demuxerWorker",error:r})};f.postMessage({cmd:"init",typeSupported:o,vendor:l,id:e,config:JSON.stringify(n)})}catch(t){A.warn('Error setting up "'.concat(e,'" Web Worker, fallback to inline'),t);this.resetWorker();this.error=null;this.transmuxer=new Ta(this.observer,o,n,l,e)}return}}this.transmuxer=new Ta(this.observer,o,n,l,e)}t.prototype.resetWorker=function(){if(this.workerContext){var t=this.workerContext,e=t.worker,r=t.objectURL;if(r){self.URL.revokeObjectURL(r)}e.removeEventListener("message",this.onwmsg);e.onerror=null;e.terminate();this.workerContext=null}};t.prototype.destroy=function(){if(this.workerContext){this.resetWorker();this.onwmsg=undefined}else{var t=this.transmuxer;if(t){t.destroy();this.transmuxer=null}}var e=this.observer;if(e){e.removeAllListeners()}this.frag=null;this.observer=null;this.hls=null};t.prototype.push=function(t,e,r,i,a,n,s,o,l,u){var f=this;var c,d;l.transmuxing.start=self.performance.now();var h=this.transmuxer;var v=n?n.start:a.start;var p=a.decryptdata;var g=this.frag;var m=!(g&&a.cc===g.cc);var y=!(g&&l.level===g.level);var T=g?l.sn-g.sn:-1;var E=this.part?l.part-this.part.index:-1;var S=T===0&&l.id>1&&l.id===(g==null?void 0:g.stats.chunkCount);var L=!y&&(T===1||T===0&&(E===1||S&&E<=0));var b=self.performance.now();if(y||T||a.stats.parsing.start===0){a.stats.parsing.start=b}if(n&&(E||!L)){n.stats.parsing.start=b}var R=!(g&&((c=a.initSegment)==null?void 0:c.url)===((d=g.initSegment)==null?void 0:d.url));var I=new ba(m,L,o,y,v,R);if(!L||m||R){A.log("[transmuxer-interface, ".concat(a.type,"]: Starting new transmux session for sn: ").concat(l.sn," p: ").concat(l.part," level: ").concat(l.level," id: ").concat(l.id,"\n discontinuity: ").concat(m,"\n trackSwitch: ").concat(y,"\n contiguous: ").concat(L,"\n accurateTimeOffset: ").concat(o,"\n timeOffset: ").concat(v,"\n initSegmentChange: ").concat(R));var D=new La(r,i,e,s,u);this.configureTransmuxer(D)}this.frag=a;this.part=n;if(this.workerContext){this.workerContext.worker.postMessage({cmd:"demux",data:t,decryptdata:p,chunkMeta:l,state:I},t instanceof ArrayBuffer?[t]:[])}else if(h){var k=h.push(t,p,l,I);if(Aa(k)){h.async=true;k.then((function(t){f.handleTransmuxComplete(t)})).catch((function(t){f.transmuxerError(t,l,"transmuxer-interface push error")}))}else{h.async=false;this.handleTransmuxComplete(k)}}};t.prototype.flush=function(t){var e=this;t.transmuxing.start=self.performance.now();var r=this.transmuxer;if(this.workerContext){this.workerContext.worker.postMessage({cmd:"flush",chunkMeta:t})}else if(r){var i=r.flush(t);var a=Aa(i);if(a||r.async){if(!Aa(i)){i=Promise.resolve(i)}i.then((function(r){e.handleFlushResult(r,t)})).catch((function(r){e.transmuxerError(r,t,"transmuxer-interface flush error")}))}else{this.handleFlushResult(i,t)}}};t.prototype.transmuxerError=function(t,e,r){if(!this.hls){return}this.error=t;this.hls.trigger(h.ERROR,{type:v.MEDIA_ERROR,details:p.FRAG_PARSING_ERROR,chunkMeta:e,fatal:false,error:t,err:t,reason:r})};t.prototype.handleFlushResult=function(t,e){var r=this;t.forEach((function(t){r.handleTransmuxComplete(t)}));this.onFlush(e)};t.prototype.onWorkerMessage=function(t){var e=t.data;var r=this.hls;switch(e.event){case"init":{var i;var a=(i=this.workerContext)==null?void 0:i.objectURL;if(a){self.URL.revokeObjectURL(a)}break}case"transmuxComplete":{this.handleTransmuxComplete(e.data);break}case"flush":{this.onFlush(e.data);break}case"workerLog":if(A[e.data.logType]){A[e.data.logType](e.data.message)}break;default:{e.data=e.data||{};e.data.frag=this.frag;e.data.id=this.id;r.trigger(e.event,e.data);break}}};t.prototype.configureTransmuxer=function(t){var e=this.transmuxer;if(this.workerContext){this.workerContext.worker.postMessage({cmd:"configure",config:t})}else if(e){e.configure(t)}};t.prototype.handleTransmuxComplete=function(t){t.chunkMeta.transmuxing.end=self.performance.now();this.onTransmuxComplete(t)};return t}();var wa=250;var Ca=2;var Pa=.1;var Oa=.05;var xa=function(){function t(t,e,r,i){this.config=void 0;this.media=null;this.fragmentTracker=void 0;this.hls=void 0;this.nudgeRetry=0;this.stallReported=false;this.stalled=null;this.moved=false;this.seeking=false;this.config=t;this.media=e;this.fragmentTracker=r;this.hls=i}t.prototype.destroy=function(){this.media=null;this.hls=this.fragmentTracker=null};t.prototype.poll=function(t,e){var r=this,i=r.config,a=r.media,n=r.stalled;if(a===null){return}var s=a.currentTime,o=a.seeking;var l=this.seeking&&!o;var u=!this.seeking&&o;this.seeking=o;if(s!==t){this.moved=true;if(n!==null){if(this.stallReported){var f=self.performance.now()-n;A.warn("playback not stuck anymore @".concat(s,", after ").concat(Math.round(f),"ms"));this.stallReported=false}this.stalled=null;this.nudgeRetry=0}return}if(u||l){this.stalled=null;return}if(a.paused&&!o||a.ended||a.playbackRate===0||!Fr.getBuffered(a).length){return}var c=Fr.bufferInfo(a,s,0);var d=c.len>0;var h=c.nextStart||0;if(!d&&!h){return}if(o){var v=c.len>Ca;var p=!h||e&&e.start<=s||h-s>Ca&&!this.fragmentTracker.getPartialFragment(s);if(v||p){return}this.moved=false}if(!this.moved&&this.stalled!==null){var g;var m=Math.max(h,c.start||0)-s;var y=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null;var T=y==null?void 0:(g=y.details)==null?void 0:g.live;var E=T?y.details.targetduration*2:Ca;var S=this.fragmentTracker.getPartialFragment(s);if(m>0&&(m<=E||S)){this._trySkipBufferHole(S);return}}var L=self.performance.now();if(n===null){this.stalled=L;return}var b=L-n;if(!o&&b>=wa){this._reportStall(c);if(!this.media){return}}var R=Fr.bufferInfo(a,s,i.maxBufferHole);this._tryFixBufferStall(R,b)};t.prototype._tryFixBufferStall=function(t,e){var r=this,i=r.config,a=r.fragmentTracker,n=r.media;if(n===null){return}var s=n.currentTime;var o=a.getPartialFragment(s);if(o){var l=this._trySkipBufferHole(o);if(l||!this.media){return}}if((t.len>i.maxBufferHole||t.nextStart&&t.nextStart-s<i.maxBufferHole)&&e>i.highBufferWatchdogPeriod*1e3){A.warn("Trying to nudge playhead over buffer-hole");this.stalled=null;this._tryNudgeBuffer()}};t.prototype._reportStall=function(t){var e=this,r=e.hls,i=e.media,a=e.stallReported;if(!a&&i){this.stallReported=true;var n=new Error("Playback stalling at @".concat(i.currentTime," due to low buffer (").concat(JSON.stringify(t),")"));A.warn(n.message);r.trigger(h.ERROR,{type:v.MEDIA_ERROR,details:p.BUFFER_STALLED_ERROR,fatal:false,error:n,buffer:t.len})}};t.prototype._trySkipBufferHole=function(t){var e=this,r=e.config,i=e.hls,a=e.media;if(a===null){return 0}var n=a.currentTime;var s=Fr.bufferInfo(a,n,0);var o=n<s.start?s.start:s.nextStart;if(o){var l=s.len<=r.maxBufferHole;var u=s.len>0&&s.len<1&&a.readyState<3;var f=o-n;if(f>0&&(l||u)){if(f>r.maxBufferHole){var c=this.fragmentTracker;var d=false;if(n===0){var g=c.getAppendedFrag(0,Te.MAIN);if(g&&o<g.end){d=true}}if(!d){var m=t||c.getAppendedFrag(n,Te.MAIN);if(m){var y=false;var T=m.end;while(T<o){var E=c.getPartialFragment(T);if(E){T+=E.duration}else{y=true;break}}if(y){return 0}}}}var S=Math.max(o+Oa,n+Pa);A.warn("skipping hole, adjusting currentTime from ".concat(n," to ").concat(S));this.moved=true;this.stalled=null;a.currentTime=S;if(t&&!t.gap){var L=new Error("fragment loaded with buffer holes, seeking from ".concat(n," to ").concat(S));i.trigger(h.ERROR,{type:v.MEDIA_ERROR,details:p.BUFFER_SEEK_OVER_HOLE,fatal:false,error:L,reason:L.message,frag:t})}return S}}return 0};t.prototype._tryNudgeBuffer=function(){var t=this,e=t.config,r=t.hls,i=t.media,a=t.nudgeRetry;if(i===null){return}var n=i.currentTime;this.nudgeRetry++;if(a<e.nudgeMaxRetry){var s=n+(a+1)*e.nudgeOffset;var o=new Error("Nudging 'currentTime' from ".concat(n," to ").concat(s));A.warn(o.message);i.currentTime=s;r.trigger(h.ERROR,{type:v.MEDIA_ERROR,details:p.BUFFER_NUDGE_ON_STALL,error:o,fatal:false})}else{var o=new Error("Playhead still not moving while enough data buffered @".concat(n," after ").concat(e.nudgeMaxRetry," nudges"));A.error(o.message);r.trigger(h.ERROR,{type:v.MEDIA_ERROR,details:p.BUFFER_STALLED_ERROR,error:o,fatal:true})}};return t}();var Fa=100;var Ma=function(t){__extends(e,t);function e(e,r,i){var a=t.call(this,e,r,i,"[stream-controller]",Te.MAIN)||this;a.audioCodecSwap=false;a.gapController=null;a.level=-1;a._forceStartLoad=false;a.altAudio=false;a.audioOnly=false;a.fragPlaying=null;a.onvplaying=null;a.onvseeked=null;a.fragLastKbps=0;a.couldBacktrack=false;a.backtrackFragment=null;a.audioCodecSwitch=false;a.videoBuffer=null;a._registerListeners();return a}e.prototype._registerListeners=function(){var t=this.hls;t.on(h.MEDIA_ATTACHED,this.onMediaAttached,this);t.on(h.MEDIA_DETACHING,this.onMediaDetaching,this);t.on(h.MANIFEST_LOADING,this.onManifestLoading,this);t.on(h.MANIFEST_PARSED,this.onManifestParsed,this);t.on(h.LEVEL_LOADING,this.onLevelLoading,this);t.on(h.LEVEL_LOADED,this.onLevelLoaded,this);t.on(h.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this);t.on(h.ERROR,this.onError,this);t.on(h.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this);t.on(h.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this);t.on(h.BUFFER_CREATED,this.onBufferCreated,this);t.on(h.BUFFER_FLUSHED,this.onBufferFlushed,this);t.on(h.LEVELS_UPDATED,this.onLevelsUpdated,this);t.on(h.FRAG_BUFFERED,this.onFragBuffered,this)};e.prototype._unregisterListeners=function(){var t=this.hls;t.off(h.MEDIA_ATTACHED,this.onMediaAttached,this);t.off(h.MEDIA_DETACHING,this.onMediaDetaching,this);t.off(h.MANIFEST_LOADING,this.onManifestLoading,this);t.off(h.MANIFEST_PARSED,this.onManifestParsed,this);t.off(h.LEVEL_LOADED,this.onLevelLoaded,this);t.off(h.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this);t.off(h.ERROR,this.onError,this);t.off(h.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this);t.off(h.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this);t.off(h.BUFFER_CREATED,this.onBufferCreated,this);t.off(h.BUFFER_FLUSHED,this.onBufferFlushed,this);t.off(h.LEVELS_UPDATED,this.onLevelsUpdated,this);t.off(h.FRAG_BUFFERED,this.onFragBuffered,this)};e.prototype.onHandlerDestroying=function(){this._unregisterListeners();this.onMediaDetaching()};e.prototype.startLoad=function(t){if(this.levels){var e=this,r=e.lastCurrentTime,i=e.hls;this.stopLoad();this.setInterval(Fa);this.level=-1;if(!this.startFragRequested){var a=i.startLevel;if(a===-1){if(i.config.testBandwidth&&this.levels.length>1){a=0;this.bitrateTest=true}else{a=i.nextAutoLevel}}this.level=i.nextLoadLevel=a;this.loadedmetadata=false}if(r>0&&t===-1){this.log("Override startPosition with lastCurrentTime @".concat(r.toFixed(3)));t=r}this.state=ti.IDLE;this.nextLoadPosition=this.startPosition=this.lastCurrentTime=t;this.tick()}else{this._forceStartLoad=true;this.state=ti.STOPPED}};e.prototype.stopLoad=function(){this._forceStartLoad=false;t.prototype.stopLoad.call(this)};e.prototype.doTick=function(){switch(this.state){case ti.WAITING_LEVEL:{var t;var e=this,r=e.levels,i=e.level;var a=r==null?void 0:(t=r[i])==null?void 0:t.details;if(a&&(!a.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(a)){break}this.state=ti.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=ti.IDLE;break}break}case ti.FRAG_LOADING_WAITING_RETRY:{var n;var s=self.performance.now();var o=this.retryDate;if(!o||s>=o||(n=this.media)!=null&&n.seeking){this.resetStartWhenNotLoaded(this.level);this.state=ti.IDLE}}break}if(this.state===ti.IDLE){this.doTickIdle()}this.onTickEnd()};e.prototype.onTickEnd=function(){t.prototype.onTickEnd.call(this);this.checkBuffer();this.checkFragmentChanged()};e.prototype.doTickIdle=function(){var t=this,e=t.hls,r=t.levelLastLoaded,i=t.levels,a=t.media;var n=e.config,s=e.nextLoadLevel;if(r===null||!a&&(this.startFragRequested||!n.startFragPrefetch)){return}if(this.altAudio&&this.audioOnly){return}if(!(i!=null&&i[s])){return}var o=i[s];var l=this.getMainFwdBufferInfo();if(l===null){return}var u=this.getLevelDetails();if(u&&this._streamEnded(l,u)){var f={};if(this.altAudio){f.type="video"}this.hls.trigger(h.BUFFER_EOS,f);this.state=ti.ENDED;return}if(e.loadLevel!==s&&e.manualLevel===-1){this.log("Adapting to level ".concat(s," from level ").concat(this.level))}this.level=e.nextLoadLevel=s;var c=o.details;if(!c||this.state===ti.WAITING_LEVEL||c.live&&this.levelLastLoaded!==s){this.level=s;this.state=ti.WAITING_LEVEL;return}var d=l.len;var v=this.getMaxBufferLength(o.maxBitrate);if(d>=v){return}if(this.backtrackFragment&&this.backtrackFragment.start>l.end){this.backtrackFragment=null}var p=this.backtrackFragment?this.backtrackFragment.start:l.end;var g=this.getNextFragment(p,c);if(this.couldBacktrack&&!this.fragPrevious&&g&&g.sn!=="initSegment"&&this.fragmentTracker.getState(g)!==Lr.OK){var m;var y=((m=this.backtrackFragment)!=null?m:g).sn;var T=y-c.startSN;var E=c.fragments[T-1];if(E&&g.cc===E.cc){g=E;this.fragmentTracker.removeFragment(E)}}else if(this.backtrackFragment&&l.len){this.backtrackFragment=null}if(g&&this.isLoopLoading(g,p)){var S=g.gap;if(!S){var A=this.audioOnly&&!this.altAudio?w.AUDIO:w.VIDEO;var L=(A===w.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;if(L){this.afterBufferFlushed(L,A,Te.MAIN)}}g=this.getNextFragmentLoopLoading(g,c,l,Te.MAIN,v)}if(!g){return}if(g.initSegment&&!g.initSegment.data&&!this.bitrateTest){g=g.initSegment}this.loadFragment(g,o,p)};e.prototype.loadFragment=function(e,r,i){var a=this.fragmentTracker.getState(e);this.fragCurrent=e;if(a===Lr.NOT_LOADED||a===Lr.PARTIAL){if(e.sn==="initSegment"){this._loadInitSegment(e,r)}else if(this.bitrateTest){this.log("Fragment ".concat(e.sn," of level ").concat(e.level," is being downloaded to test bitrate and will not be buffered"));this._loadBitrateTestFrag(e,r)}else{this.startFragRequested=true;t.prototype.loadFragment.call(this,e,r,i)}}else{this.clearTrackerIfNeeded(e)}};e.prototype.getBufferedFrag=function(t){return this.fragmentTracker.getBufferedFrag(t,Te.MAIN)};e.prototype.followingBufferedFrag=function(t){if(t){return this.getBufferedFrag(t.end+.5)}return null};e.prototype.immediateLevelSwitch=function(){this.abortCurrentFrag();this.flushMainBuffer(0,Number.POSITIVE_INFINITY)};e.prototype.nextLevelSwitch=function(){var t=this,e=t.levels,r=t.media;if(r!=null&&r.readyState){var i=void 0;var a=this.getAppendedFrag(r.currentTime);if(a&&a.start>1){this.flushMainBuffer(0,a.start-1)}var n=this.getLevelDetails();if(n!=null&&n.live){var s=this.getMainFwdBufferInfo();if(!s||s.len<n.targetduration*2){return}}if(!r.paused&&e){var o=this.hls.nextLoadLevel;var l=e[o];var u=this.fragLastKbps;if(u&&this.fragCurrent){i=this.fragCurrent.duration*l.maxBitrate/(1e3*u)+1}else{i=0}}else{i=0}var f=this.getBufferedFrag(r.currentTime+i);if(f){var c=this.followingBufferedFrag(f);if(c){this.abortCurrentFrag();var d=c.maxStartPTS?c.maxStartPTS:c.start;var h=c.duration;var v=Math.max(f.end,d+Math.min(Math.max(h-this.config.maxFragLookUpTolerance,h*.5),h*.75));this.flushMainBuffer(v,Number.POSITIVE_INFINITY)}}}};e.prototype.abortCurrentFrag=function(){var t=this.fragCurrent;this.fragCurrent=null;this.backtrackFragment=null;if(t){t.abortRequests();this.fragmentTracker.removeFragment(t)}switch(this.state){case ti.KEY_LOADING:case ti.FRAG_LOADING:case ti.FRAG_LOADING_WAITING_RETRY:case ti.PARSING:case ti.PARSED:this.state=ti.IDLE;break}this.nextLoadPosition=this.getLoadPosition()};e.prototype.flushMainBuffer=function(e,r){t.prototype.flushMainBuffer.call(this,e,r,this.altAudio?"video":null)};e.prototype.onMediaAttached=function(e,r){t.prototype.onMediaAttached.call(this,e,r);var i=r.media;this.onvplaying=this.onMediaPlaying.bind(this);this.onvseeked=this.onMediaSeeked.bind(this);i.addEventListener("playing",this.onvplaying);i.addEventListener("seeked",this.onvseeked);this.gapController=new xa(this.config,i,this.fragmentTracker,this.hls)};e.prototype.onMediaDetaching=function(){var e=this.media;if(e&&this.onvplaying&&this.onvseeked){e.removeEventListener("playing",this.onvplaying);e.removeEventListener("seeked",this.onvseeked);this.onvplaying=this.onvseeked=null;this.videoBuffer=null}this.fragPlaying=null;if(this.gapController){this.gapController.destroy();this.gapController=null}t.prototype.onMediaDetaching.call(this)};e.prototype.onMediaPlaying=function(){this.tick()};e.prototype.onMediaSeeked=function(){var t=this.media;var e=t?t.currentTime:null;if(f(e)){this.log("Media seeked to ".concat(e.toFixed(3)))}var r=this.getMainFwdBufferInfo();if(r===null||r.len===0){this.warn('Main forward buffer length on "seeked" event '.concat(r?r.len:"empty",")"));return}this.tick()};e.prototype.onManifestLoading=function(){this.log("Trigger BUFFER_RESET");this.hls.trigger(h.BUFFER_RESET,undefined);this.fragmentTracker.removeAllFragments();this.couldBacktrack=false;this.startPosition=this.lastCurrentTime=0;this.levels=this.fragPlaying=this.backtrackFragment=null;this.altAudio=this.audioOnly=false};e.prototype.onManifestParsed=function(t,e){var r=false;var i=false;var a;e.levels.forEach((function(t){a=t.audioCodec;if(a){if(a.indexOf("mp4a.40.2")!==-1){r=true}if(a.indexOf("mp4a.40.5")!==-1){i=true}}}));this.audioCodecSwitch=r&&i&&!ai();if(this.audioCodecSwitch){this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC")}this.levels=e.levels;this.startFragRequested=false};e.prototype.onLevelLoading=function(t,e){var r=this.levels;if(!r||this.state!==ti.IDLE){return}var i=r[e.level];if(!i.details||i.details.live&&this.levelLastLoaded!==e.level||this.waitForCdnTuneIn(i.details)){this.state=ti.WAITING_LEVEL}};e.prototype.onLevelLoaded=function(t,e){var r;var i=this.levels;var a=e.level;var n=e.details;var s=n.totalduration;if(!i){this.warn("Levels were reset while loading level ".concat(a));return}this.log("Level ".concat(a," loaded [").concat(n.startSN,",").concat(n.endSN,"]").concat(n.lastPartSn?"[part-".concat(n.lastPartSn,"-").concat(n.lastPartIndex,"]"):"",", cc [").concat(n.startCC,", ").concat(n.endCC,"] duration:").concat(s));var o=i[a];var l=this.fragCurrent;if(l&&(this.state===ti.FRAG_LOADING||this.state===ti.FRAG_LOADING_WAITING_RETRY)){if((l.level!==e.level||l.urlId!==o.urlId)&&l.loader){this.abortCurrentFrag()}}var u=0;if(n.live||(r=o.details)!=null&&r.live){this.checkLiveUpdate(n);if(n.deltaUpdateFailed){return}u=this.alignPlaylists(n,o.details)}o.details=n;this.levelLastLoaded=a;this.hls.trigger(h.LEVEL_UPDATED,{details:n,level:a});if(this.state===ti.WAITING_LEVEL){if(this.waitForCdnTuneIn(n)){return}this.state=ti.IDLE}if(!this.startFragRequested){this.setStartPosition(n,u)}else if(n.live){this.synchronizeToLiveEdge(n)}this.tick()};e.prototype._handleFragmentLoadProgress=function(t){var e;var r=t.frag,i=t.part,a=t.payload;var n=this.levels;if(!n){this.warn("Levels were reset while fragment load was in progress. Fragment ".concat(r.sn," of level ").concat(r.level," will not be buffered"));return}var s=n[r.level];var o=s.details;if(!o){this.warn("Dropping fragment ".concat(r.sn," of level ").concat(r.level," after level details were reset"));this.fragmentTracker.removeFragment(r);return}var l=s.videoCodec;var u=o.PTSKnown||!o.live;var f=(e=r.initSegment)==null?void 0:e.data;var c=this._getAudioCodec(s);var d=this.transmuxer=this.transmuxer||new _a(this.hls,Te.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this));var h=i?i.index:-1;var v=h!==-1;var p=new Mr(r.level,r.sn,r.stats.chunkCount,a.byteLength,h,v);var g=this.initPTS[r.cc];d.push(a,f,c,l,r,i,o.totalduration,u,p,g)};e.prototype.onAudioTrackSwitching=function(t,e){var r=this.altAudio;var i=!!e.url;if(!i){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading");this.mediaBuffer=this.media;var a=this.fragCurrent;if(a){this.log("Switching to main audio track, cancel main fragment load");a.abortRequests();this.fragmentTracker.removeFragment(a)}this.resetTransmuxer();this.resetLoadingState()}else if(this.audioOnly){this.resetTransmuxer()}var n=this.hls;if(r){n.trigger(h.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null});this.fragmentTracker.removeAllFragments()}n.trigger(h.AUDIO_TRACK_SWITCHED,e)}};e.prototype.onAudioTrackSwitched=function(t,e){var r=e.id;var i=!!this.hls.audioTracks[r].url;if(i){var a=this.videoBuffer;if(a&&this.mediaBuffer!==a){this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading");this.mediaBuffer=a}}this.altAudio=i;this.tick()};e.prototype.onBufferCreated=function(t,e){var r=e.tracks;var i;var a;var n=false;for(var s in r){var o=r[s];if(o.id==="main"){a=s;i=o;if(s==="video"){var l=r[s];if(l){this.videoBuffer=l.buffer}}}else{n=true}}if(n&&i){this.log("Alternate track found, use ".concat(a,".buffered to schedule main fragment loading"));this.mediaBuffer=i.buffer}else{this.mediaBuffer=this.media}};e.prototype.onFragBuffered=function(t,e){var r=e.frag,i=e.part;if(r&&r.type!==Te.MAIN){return}if(this.fragContextChanged(r)){this.warn("Fragment ".concat(r.sn).concat(i?" p: "+i.index:""," of level ").concat(r.level," finished buffering, but was aborted. state: ").concat(this.state));if(this.state===ti.PARSED){this.state=ti.IDLE}return}var a=i?i.stats:r.stats;this.fragLastKbps=Math.round(8*a.total/(a.buffering.end-a.loading.first));if(r.sn!=="initSegment"){this.fragPrevious=r}this.fragBufferedComplete(r,i)};e.prototype.onError=function(t,e){var r;if(e.fatal){this.state=ti.ERROR;return}switch(e.details){case p.FRAG_GAP:case p.FRAG_PARSING_ERROR:case p.FRAG_DECRYPT_ERROR:case p.FRAG_LOAD_ERROR:case p.FRAG_LOAD_TIMEOUT:case p.KEY_LOAD_ERROR:case p.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Te.MAIN,e);break;case p.LEVEL_LOAD_ERROR:case p.LEVEL_LOAD_TIMEOUT:case p.LEVEL_PARSING_ERROR:if(!e.levelRetry&&this.state===ti.WAITING_LEVEL&&((r=e.context)==null?void 0:r.type)===ye.LEVEL){this.state=ti.IDLE}break;case p.BUFFER_FULL_ERROR:if(!e.parent||e.parent!=="main"){return}if(this.reduceLengthAndFlushBuffer(e)){this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}break;case p.INTERNAL_EXCEPTION:this.recoverWorkerError(e);break}};e.prototype.checkBuffer=function(){var t=this,e=t.media,r=t.gapController;if(!e||!r||!e.readyState){return}if(this.loadedmetadata||!Fr.getBuffered(e).length){var i=this.state!==ti.IDLE?this.fragCurrent:null;r.poll(this.lastCurrentTime,i)}this.lastCurrentTime=e.currentTime};e.prototype.onFragLoadEmergencyAborted=function(){this.state=ti.IDLE;if(!this.loadedmetadata){this.startFragRequested=false;this.nextLoadPosition=this.startPosition}this.tickImmediate()};e.prototype.onBufferFlushed=function(t,e){var r=e.type;if(r!==w.AUDIO||this.audioOnly&&!this.altAudio){var i=(r===w.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(i,r,Te.MAIN)}};e.prototype.onLevelsUpdated=function(t,e){this.levels=e.levels};e.prototype.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap};e.prototype.seekToStartPos=function(){var t=this.media;if(!t){return}var e=t.currentTime;var r=this.startPosition;if(r>=0&&e<r){if(t.seeking){this.log("could not seek to ".concat(r,", already seeking at ").concat(e));return}var i=Fr.getBuffered(t);var a=i.length?i.start(0):0;var n=a-r;if(n>0&&(n<this.config.maxBufferHole||n<this.config.maxFragLookUpTolerance)){this.log("adjusting start position by ".concat(n," to match buffer start"));r+=n;this.startPosition=r}this.log("seek to target start position ".concat(r," from current time ").concat(e));t.currentTime=r}};e.prototype._getAudioCodec=function(t){var e=this.config.defaultAudioCodec||t.audioCodec;if(this.audioCodecSwap&&e){this.log("Swapping audio codec");if(e.indexOf("mp4a.40.5")!==-1){e="mp4a.40.2"}else{e="mp4a.40.5"}}return e};e.prototype._loadBitrateTestFrag=function(t,e){var r=this;t.bitrateTest=true;this._doFragLoad(t,e).then((function(i){var a=r.hls;if(!i||r.fragContextChanged(t)){return}e.fragmentError=0;r.state=ti.IDLE;r.startFragRequested=false;r.bitrateTest=false;var n=t.stats;n.parsing.start=n.parsing.end=n.buffering.start=n.buffering.end=self.performance.now();a.trigger(h.FRAG_LOADED,i);t.bitrateTest=false}))};e.prototype._handleTransmuxComplete=function(t){var e;var r="main";var i=this.hls;var a=t.remuxResult,n=t.chunkMeta;var s=this.getCurrentContext(n);if(!s){this.resetWhenMissingContext(n);return}var o=s.frag,l=s.part,u=s.level;var c=a.video,d=a.text,v=a.id3,p=a.initSegment;var g=u.details;var m=this.altAudio?undefined:a.audio;if(this.fragContextChanged(o)){this.fragmentTracker.removeFragment(o);return}this.state=ti.PARSING;if(p){if(p!=null&&p.tracks){var y=o.initSegment||o;this._bufferInitSegment(u,p.tracks,y,n);i.trigger(h.FRAG_PARSING_INIT_SEGMENT,{frag:y,id:r,tracks:p.tracks})}var T=p.initPTS;var E=p.timescale;if(f(T)){this.initPTS[o.cc]={baseTime:T,timescale:E};i.trigger(h.INIT_PTS_FOUND,{frag:o,id:r,initPTS:T,timescale:E})}}if(c&&g&&o.sn!=="initSegment"){var S=g.fragments[o.sn-1-g.startSN];var A=o.sn===g.startSN;var L=!S||o.cc>S.cc;if(a.independent!==false){var b=c.startPTS,R=c.endPTS,I=c.startDTS,D=c.endDTS;if(l){l.elementaryStreams[c.type]={startPTS:b,endPTS:R,startDTS:I,endDTS:D}}else{if(c.firstKeyFrame&&c.independent&&n.id===1&&!L){this.couldBacktrack=true}if(c.dropped&&c.independent){var k=this.getMainFwdBufferInfo();var _=(k?k.end:this.getLoadPosition())+this.config.maxBufferHole;var C=c.firstKeyFramePTS?c.firstKeyFramePTS:b;if(!A&&_<C-this.config.maxBufferHole&&!L){this.backtrack(o);return}else if(L){o.gap=true}o.setElementaryStreamInfo(c.type,o.start,R,o.start,D,true)}}o.setElementaryStreamInfo(c.type,b,R,I,D);if(this.backtrackFragment){this.backtrackFragment=o}this.bufferFragmentData(c,o,l,n,A||L)}else if(A||L){o.gap=true}else{this.backtrack(o);return}}if(m){var b=m.startPTS,R=m.endPTS,I=m.startDTS,D=m.endDTS;if(l){l.elementaryStreams[w.AUDIO]={startPTS:b,endPTS:R,startDTS:I,endDTS:D}}o.setElementaryStreamInfo(w.AUDIO,b,R,I,D);this.bufferFragmentData(m,o,l,n)}if(g&&v!=null&&(e=v.samples)!=null&&e.length){var P={id:r,frag:o,details:g,samples:v.samples};i.trigger(h.FRAG_PARSING_METADATA,P)}if(g&&d){var O={id:r,frag:o,details:g,samples:d.samples};i.trigger(h.FRAG_PARSING_USERDATA,O)}};e.prototype._bufferInitSegment=function(t,e,r,i){var a=this;if(this.state!==ti.PARSING){return}this.audioOnly=!!e.audio&&!e.video;if(this.altAudio&&!this.audioOnly){delete e.audio}var n=e.audio,s=e.video,o=e.audiovideo;if(n){var l=t.audioCodec;var u=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){if(l){if(l.indexOf("mp4a.40.5")!==-1){l="mp4a.40.2"}else{l="mp4a.40.5"}}if(n.metadata.channelCount!==1&&u.indexOf("firefox")===-1){l="mp4a.40.5"}}if(u.indexOf("android")!==-1&&n.container!=="audio/mpeg"){l="mp4a.40.2";this.log("Android: force audio codec to ".concat(l))}if(t.audioCodec&&t.audioCodec!==l){this.log('Swapping manifest audio codec "'.concat(t.audioCodec,'" for "').concat(l,'"'))}n.levelCodec=l;n.id="main";this.log("Init audio buffer, container:".concat(n.container,", codecs[selected/level/parsed]=[").concat(l||"","/").concat(t.audioCodec||"","/").concat(n.codec,"]"))}if(s){s.levelCodec=t.videoCodec;s.id="main";this.log("Init video buffer, container:".concat(s.container,", codecs[level/parsed]=[").concat(t.videoCodec||"","/").concat(s.codec,"]"))}if(o){this.log("Init audiovideo buffer, container:".concat(o.container,", codecs[level/parsed]=[").concat(t.attrs.CODECS||"","/").concat(o.codec,"]"))}this.hls.trigger(h.BUFFER_CODECS,e);Object.keys(e).forEach((function(t){var n=e[t];var s=n.initSegment;if(s!=null&&s.byteLength){a.hls.trigger(h.BUFFER_APPENDING,{type:t,data:s,frag:r,part:null,chunkMeta:i,parent:r.type})}}));this.tick()};e.prototype.getMainFwdBufferInfo=function(){return this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,Te.MAIN)};e.prototype.backtrack=function(t){this.couldBacktrack=true;this.backtrackFragment=t;this.resetTransmuxer();this.flushBufferGap(t);this.fragmentTracker.removeFragment(t);this.fragPrevious=null;this.nextLoadPosition=t.start;this.state=ti.IDLE};e.prototype.checkFragmentChanged=function(){var t=this.media;var e=null;if(t&&t.readyState>1&&t.seeking===false){var r=t.currentTime;if(Fr.isBuffered(t,r)){e=this.getAppendedFrag(r)}else if(Fr.isBuffered(t,r+.1)){e=this.getAppendedFrag(r+.1)}if(e){this.backtrackFragment=null;var i=this.fragPlaying;var a=e.level;if(!i||e.sn!==i.sn||i.level!==a||e.urlId!==i.urlId){this.fragPlaying=e;this.hls.trigger(h.FRAG_CHANGED,{frag:e});if(!i||i.level!==a){this.hls.trigger(h.LEVEL_SWITCHED,{level:a})}}}}};Object.defineProperty(e.prototype,"nextLevel",{get:function(){var t=this.nextBufferedFrag;if(t){return t.level}return-1},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"currentFrag",{get:function(){var t=this.media;if(t){return this.fragPlaying||this.getAppendedFrag(t.currentTime)}return null},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"currentProgramDateTime",{get:function(){var t=this.media;if(t){var e=t.currentTime;var r=this.currentFrag;if(r&&f(e)&&f(r.programDateTime)){var i=r.programDateTime+(e-r.start)*1e3;return new Date(i)}}return null},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"currentLevel",{get:function(){var t=this.currentFrag;if(t){return t.level}return-1},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"nextBufferedFrag",{get:function(){var t=this.currentFrag;if(t){return this.followingBufferedFrag(t)}return null},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"forceStartLoad",{get:function(){return this._forceStartLoad},enumerable:false,configurable:true});return e}(ei);var Na=function(){function t(t,e,r){if(e===void 0){e=0}if(r===void 0){r=0}this.halfLife=void 0;this.alpha_=void 0;this.estimate_=void 0;this.totalWeight_=void 0;this.halfLife=t;this.alpha_=t?Math.exp(Math.log(.5)/t):0;this.estimate_=e;this.totalWeight_=r}t.prototype.sample=function(t,e){var r=Math.pow(this.alpha_,t);this.estimate_=e*(1-r)+r*this.estimate_;this.totalWeight_+=t};t.prototype.getTotalWeight=function(){return this.totalWeight_};t.prototype.getEstimate=function(){if(this.alpha_){var t=1-Math.pow(this.alpha_,this.totalWeight_);if(t){return this.estimate_/t}}return this.estimate_};return t}();var Ua=function(){function t(t,e,r,i){if(i===void 0){i=100}this.defaultEstimate_=void 0;this.minWeight_=void 0;this.minDelayMs_=void 0;this.slow_=void 0;this.fast_=void 0;this.defaultTTFB_=void 0;this.ttfb_=void 0;this.defaultEstimate_=r;this.minWeight_=.001;this.minDelayMs_=50;this.slow_=new Na(t);this.fast_=new Na(e);this.defaultTTFB_=i;this.ttfb_=new Na(t)}t.prototype.update=function(t,e){var r=this,i=r.slow_,a=r.fast_,n=r.ttfb_;if(i.halfLife!==t){this.slow_=new Na(t,i.getEstimate(),i.getTotalWeight())}if(a.halfLife!==e){this.fast_=new Na(e,a.getEstimate(),a.getTotalWeight())}if(n.halfLife!==t){this.ttfb_=new Na(t,n.getEstimate(),n.getTotalWeight())}};t.prototype.sample=function(t,e){t=Math.max(t,this.minDelayMs_);var r=8*e;var i=t/1e3;var a=r/i;this.fast_.sample(i,a);this.slow_.sample(i,a)};t.prototype.sampleTTFB=function(t){var e=t/1e3;var r=Math.sqrt(2)*Math.exp(-Math.pow(e,2)/2);this.ttfb_.sample(r,Math.max(t,5))};t.prototype.canEstimate=function(){return this.fast_.getTotalWeight()>=this.minWeight_};t.prototype.getEstimate=function(){if(this.canEstimate()){return Math.min(this.fast_.getEstimate(),this.slow_.getEstimate())}else{return this.defaultEstimate_}};t.prototype.getEstimateTTFB=function(){if(this.ttfb_.getTotalWeight()>=this.minWeight_){return this.ttfb_.getEstimate()}else{return this.defaultTTFB_}};t.prototype.destroy=function(){};return t}();var Ba=function(){function t(t){this.hls=void 0;this.lastLevelLoadSec=0;this.lastLoadedFragLevel=0;this._nextAutoLevel=-1;this.timer=-1;this.onCheck=this._abandonRulesCheck.bind(this);this.fragCurrent=null;this.partCurrent=null;this.bitrateTestDelay=0;this.bwEstimator=void 0;this.hls=t;var e=t.config;this.bwEstimator=new Ua(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate);this.registerListeners()}t.prototype.registerListeners=function(){var t=this.hls;t.on(h.FRAG_LOADING,this.onFragLoading,this);t.on(h.FRAG_LOADED,this.onFragLoaded,this);t.on(h.FRAG_BUFFERED,this.onFragBuffered,this);t.on(h.LEVEL_SWITCHING,this.onLevelSwitching,this);t.on(h.LEVEL_LOADED,this.onLevelLoaded,this)};t.prototype.unregisterListeners=function(){var t=this.hls;t.off(h.FRAG_LOADING,this.onFragLoading,this);t.off(h.FRAG_LOADED,this.onFragLoaded,this);t.off(h.FRAG_BUFFERED,this.onFragBuffered,this);t.off(h.LEVEL_SWITCHING,this.onLevelSwitching,this);t.off(h.LEVEL_LOADED,this.onLevelLoaded,this)};t.prototype.destroy=function(){this.unregisterListeners();this.clearTimer();this.hls=this.onCheck=null;this.fragCurrent=this.partCurrent=null};t.prototype.onFragLoading=function(t,e){var r;var i=e.frag;if(this.ignoreFragment(i)){return}this.fragCurrent=i;this.partCurrent=(r=e.part)!=null?r:null;this.clearTimer();this.timer=self.setInterval(this.onCheck,100)};t.prototype.onLevelSwitching=function(t,e){this.clearTimer()};t.prototype.getTimeToLoadFrag=function(t,e,r,i){var a=t+r/e;var n=i?this.lastLevelLoadSec:0;return a+n};t.prototype.onLevelLoaded=function(t,e){var r=this.hls.config;var i=e.stats,a=i.total,n=i.bwEstimate;if(f(a)&&f(n)){this.lastLevelLoadSec=8*a/n}if(e.details.live){this.bwEstimator.update(r.abrEwmaSlowLive,r.abrEwmaFastLive)}else{this.bwEstimator.update(r.abrEwmaSlowVoD,r.abrEwmaFastVoD)}};t.prototype._abandonRulesCheck=function(){var t=this,e=t.fragCurrent,r=t.partCurrent,i=t.hls;var a=i.autoLevelEnabled,n=i.media;if(!e||!n){return}var s=performance.now();var o=r?r.stats:e.stats;var l=r?r.duration:e.duration;var u=s-o.loading.start;if(o.aborted||o.loaded&&o.loaded===o.total||e.level===0){this.clearTimer();this._nextAutoLevel=-1;return}if(!a||n.paused||!n.playbackRate||!n.readyState){return}var c=i.mainForwardBufferInfo;if(c===null){return}var d=this.bwEstimator.getEstimateTTFB();var v=Math.abs(n.playbackRate);if(u<=Math.max(d,1e3*(l/(v*2)))){return}var p=c.len/v;if(p>=2*l/v){return}var g=o.loading.first?o.loading.first-o.loading.start:-1;var m=o.loaded&&g>-1;var y=this.bwEstimator.getEstimate();var T=i.levels,E=i.minAutoLevel;var S=T[e.level];var L=o.total||Math.max(o.loaded,Math.round(l*S.maxBitrate/8));var b=u-g;if(b<1&&m){b=Math.min(u,o.loaded*8/y)}var R=m?o.loaded*1e3/b:0;var I=R?(L-o.loaded)/R:L*8/y+d/1e3;if(I<=p){return}var D=R?R*8:y;var k=Number.POSITIVE_INFINITY;var _;for(_=e.level-1;_>E;_--){var w=T[_].maxBitrate;k=this.getTimeToLoadFrag(d/1e3,D,l*w,!T[_].details);if(k<p){break}}if(k>=I){return}if(k>l*10){return}i.nextLoadLevel=_;if(m){this.bwEstimator.sample(u-Math.min(d,g),o.loaded)}else{this.bwEstimator.sampleTTFB(u)}this.clearTimer();A.warn("[abr] Fragment ".concat(e.sn).concat(r?" part "+r.index:""," of level ").concat(e.level," is loading too slowly;\n Time to underbuffer: ").concat(p.toFixed(3)," s\n Estimated load time for current fragment: ").concat(I.toFixed(3)," s\n Estimated load time for down switch fragment: ").concat(k.toFixed(3)," s\n TTFB estimate: ").concat(g,"\n Current BW estimate: ").concat(f(y)?(y/1024).toFixed(3):"Unknown"," Kb/s\n New BW estimate: ").concat((this.bwEstimator.getEstimate()/1024).toFixed(3)," Kb/s\n Aborting and switching to level ").concat(_));if(e.loader){this.fragCurrent=this.partCurrent=null;e.abortRequests()}i.trigger(h.FRAG_LOAD_EMERGENCY_ABORTED,{frag:e,part:r,stats:o})};t.prototype.onFragLoaded=function(t,e){var r=e.frag,i=e.part;var a=i?i.stats:r.stats;if(r.type===Te.MAIN){this.bwEstimator.sampleTTFB(a.loading.first-a.loading.start)}if(this.ignoreFragment(r)){return}this.clearTimer();this.lastLoadedFragLevel=r.level;this._nextAutoLevel=-1;if(this.hls.config.abrMaxWithRealBitrate){var n=i?i.duration:r.duration;var s=this.hls.levels[r.level];var o=(s.loaded?s.loaded.bytes:0)+a.loaded;var l=(s.loaded?s.loaded.duration:0)+n;s.loaded={bytes:o,duration:l};s.realBitrate=Math.round(8*o/l)}if(r.bitrateTest){var u={stats:a,frag:r,part:i,id:r.type};this.onFragBuffered(h.FRAG_BUFFERED,u);r.bitrateTest=false}};t.prototype.onFragBuffered=function(t,e){var r=e.frag,i=e.part;var a=i!=null&&i.stats.loaded?i.stats:r.stats;if(a.aborted){return}if(this.ignoreFragment(r)){return}var n=a.parsing.end-a.loading.start-Math.min(a.loading.first-a.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(n,a.loaded);a.bwEstimate=this.bwEstimator.getEstimate();if(r.bitrateTest){this.bitrateTestDelay=n/1e3}else{this.bitrateTestDelay=0}};t.prototype.ignoreFragment=function(t){return t.type!==Te.MAIN||t.sn==="initSegment"};t.prototype.clearTimer=function(){self.clearInterval(this.timer)};Object.defineProperty(t.prototype,"nextAutoLevel",{get:function(){var t=this._nextAutoLevel;var e=this.bwEstimator;if(t!==-1&&!e.canEstimate()){return t}var r=this.getNextABRAutoLevel();if(t!==-1){var i=this.hls.levels;if(i.length>Math.max(t,r)&&i[t].loadError<=i[r].loadError){return t}}if(t!==-1){r=Math.min(t,r)}return r},set:function(t){this._nextAutoLevel=t},enumerable:false,configurable:true});t.prototype.getNextABRAutoLevel=function(){var t=this,e=t.fragCurrent,r=t.partCurrent,i=t.hls;var a=i.maxAutoLevel,n=i.config,s=i.minAutoLevel,o=i.media;var l=r?r.duration:e?e.duration:0;var u=o&&o.playbackRate!==0?Math.abs(o.playbackRate):1;var f=this.bwEstimator?this.bwEstimator.getEstimate():n.abrEwmaDefaultEstimate;var c=i.mainForwardBufferInfo;var d=(c?c.len:0)/u;var h=this.findBestLevel(f,s,a,d,n.abrBandWidthFactor,n.abrBandWidthUpFactor);if(h>=0){return h}A.trace("[abr] ".concat(d?"rebuffering expected":"buffer is empty",", finding optimal quality level"));var v=l?Math.min(l,n.maxStarvationDelay):n.maxStarvationDelay;var p=n.abrBandWidthFactor;var g=n.abrBandWidthUpFactor;if(!d){var m=this.bitrateTestDelay;if(m){var y=l?Math.min(l,n.maxLoadingDelay):n.maxLoadingDelay;v=y-m;A.trace("[abr] bitrate test took ".concat(Math.round(1e3*m),"ms, set first fragment max fetchDuration to ").concat(Math.round(1e3*v)," ms"));p=g=1}}h=this.findBestLevel(f,s,a,d+v,p,g);return Math.max(h,0)};t.prototype.findBestLevel=function(t,e,r,i,a,n){var s;var o=this,l=o.fragCurrent,u=o.partCurrent,c=o.lastLoadedFragLevel;var d=this.hls.levels;var h=d[c];var v=!!(h!=null&&(s=h.details)!=null&&s.live);var p=h==null?void 0:h.codecSet;var g=u?u.duration:l?l.duration:0;var m=this.bwEstimator.getEstimateTTFB()/1e3;var y=e;var T=-1;for(var E=r;E>=e;E--){var S=d[E];if(!S||p&&S.codecSet!==p){if(S){y=Math.min(E,y);T=Math.max(E,T)}continue}if(T!==-1){A.trace("[abr] Skipped level(s) ".concat(y,"-").concat(T,' with CODECS:"').concat(d[T].attrs.CODECS,'"; not compatible with "').concat(h.attrs.CODECS,'"'))}var L=S.details;var b=(u?L==null?void 0:L.partTarget:L==null?void 0:L.averagetargetduration)||g;var R=void 0;if(E<=c){R=a*t}else{R=n*t}var I=d[E].maxBitrate;var D=this.getTimeToLoadFrag(m,R,I*b,L===undefined);A.trace("[abr] level:".concat(E," adjustedbw-bitrate:").concat(Math.round(R-I)," avgDuration:").concat(b.toFixed(1)," maxFetchDuration:").concat(i.toFixed(1)," fetchDuration:").concat(D.toFixed(1)));if(R>I&&(D===0||!f(D)||v&&!this.bitrateTestDelay||D<i)){return E}}return-1};return t}();var Ga=function(){function t(){this.chunks=[];this.dataLength=0}t.prototype.push=function(t){this.chunks.push(t);this.dataLength+=t.length};t.prototype.flush=function(){var t=this,e=t.chunks,r=t.dataLength;var i;if(!e.length){return new Uint8Array(0)}else if(e.length===1){i=e[0]}else{i=Ka(e,r)}this.reset();return i};t.prototype.reset=function(){this.chunks.length=0;this.dataLength=0};return t}();function Ka(t,e){var r=new Uint8Array(e);var i=0;for(var a=0;a<t.length;a++){var n=t[a];r.set(n,i);i+=n.length}return r}var Ha=100;var Va=function(t){__extends(e,t);function e(e,r,i){var a=t.call(this,e,r,i,"[audio-stream-controller]",Te.AUDIO)||this;a.videoBuffer=null;a.videoTrackCC=-1;a.waitingVideoCC=-1;a.bufferedTrack=null;a.switchingTrack=null;a.trackId=-1;a.waitingData=null;a.mainDetails=null;a.bufferFlushed=false;a.cachedTrackLoadedData=null;a._registerListeners();return a}e.prototype.onHandlerDestroying=function(){this._unregisterListeners();this.mainDetails=null;this.bufferedTrack=null;this.switchingTrack=null};e.prototype._registerListeners=function(){var t=this.hls;t.on(h.MEDIA_ATTACHED,this.onMediaAttached,this);t.on(h.MEDIA_DETACHING,this.onMediaDetaching,this);t.on(h.MANIFEST_LOADING,this.onManifestLoading,this);t.on(h.LEVEL_LOADED,this.onLevelLoaded,this);t.on(h.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this);t.on(h.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this);t.on(h.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this);t.on(h.ERROR,this.onError,this);t.on(h.BUFFER_RESET,this.onBufferReset,this);t.on(h.BUFFER_CREATED,this.onBufferCreated,this);t.on(h.BUFFER_FLUSHED,this.onBufferFlushed,this);t.on(h.INIT_PTS_FOUND,this.onInitPtsFound,this);t.on(h.FRAG_BUFFERED,this.onFragBuffered,this)};e.prototype._unregisterListeners=function(){var t=this.hls;t.off(h.MEDIA_ATTACHED,this.onMediaAttached,this);t.off(h.MEDIA_DETACHING,this.onMediaDetaching,this);t.off(h.MANIFEST_LOADING,this.onManifestLoading,this);t.off(h.LEVEL_LOADED,this.onLevelLoaded,this);t.off(h.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this);t.off(h.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this);t.off(h.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this);t.off(h.ERROR,this.onError,this);t.off(h.BUFFER_RESET,this.onBufferReset,this);t.off(h.BUFFER_CREATED,this.onBufferCreated,this);t.off(h.BUFFER_FLUSHED,this.onBufferFlushed,this);t.off(h.INIT_PTS_FOUND,this.onInitPtsFound,this);t.off(h.FRAG_BUFFERED,this.onFragBuffered,this)};e.prototype.onInitPtsFound=function(t,e){var r=e.frag,i=e.id,a=e.initPTS,n=e.timescale;if(i==="main"){var s=r.cc;this.initPTS[r.cc]={baseTime:a,timescale:n};this.log("InitPTS for cc: ".concat(s," found from main: ").concat(a));this.videoTrackCC=s;if(this.state===ti.WAITING_INIT_PTS){this.tick()}}};e.prototype.startLoad=function(t){if(!this.levels){this.startPosition=t;this.state=ti.STOPPED;return}var e=this.lastCurrentTime;this.stopLoad();this.setInterval(Ha);if(e>0&&t===-1){this.log("Override startPosition with lastCurrentTime @".concat(e.toFixed(3)));t=e;this.state=ti.IDLE}else{this.loadedmetadata=false;this.state=ti.WAITING_TRACK}this.nextLoadPosition=this.startPosition=this.lastCurrentTime=t;this.tick()};e.prototype.doTick=function(){switch(this.state){case ti.IDLE:this.doTickIdle();break;case ti.WAITING_TRACK:{var e;var r=this,i=r.levels,a=r.trackId;var n=i==null?void 0:(e=i[a])==null?void 0:e.details;if(n){if(this.waitForCdnTuneIn(n)){break}this.state=ti.WAITING_INIT_PTS}break}case ti.FRAG_LOADING_WAITING_RETRY:{var s;var o=performance.now();var l=this.retryDate;if(!l||o>=l||(s=this.media)!=null&&s.seeking){this.log("RetryDate reached, switch back to IDLE state");this.resetStartWhenNotLoaded(this.trackId);this.state=ti.IDLE}break}case ti.WAITING_INIT_PTS:{var u=this.waitingData;if(u){var f=u.frag,c=u.part,d=u.cache,h=u.complete;if(this.initPTS[f.cc]!==undefined){this.waitingData=null;this.waitingVideoCC=-1;this.state=ti.FRAG_LOADING;var v=d.flush();var p={frag:f,part:c,payload:v,networkDetails:null};this._handleFragmentLoadProgress(p);if(h){t.prototype._handleFragmentLoadComplete.call(this,p)}}else if(this.videoTrackCC!==this.waitingVideoCC){this.log("Waiting fragment cc (".concat(f.cc,") cancelled because video is at cc ").concat(this.videoTrackCC));this.clearWaitingFragment()}else{var g=this.getLoadPosition();var m=Fr.bufferInfo(this.mediaBuffer,g,this.config.maxBufferHole);var y=fr(m.end,this.config.maxFragLookUpTolerance,f);if(y<0){this.log("Waiting fragment cc (".concat(f.cc,") @ ").concat(f.start," cancelled because another fragment at ").concat(m.end," is needed"));this.clearWaitingFragment()}}}else{this.state=ti.IDLE}}}this.onTickEnd()};e.prototype.clearWaitingFragment=function(){var t=this.waitingData;if(t){this.fragmentTracker.removeFragment(t.frag);this.waitingData=null;this.waitingVideoCC=-1;this.state=ti.IDLE}};e.prototype.resetLoadingState=function(){this.clearWaitingFragment();t.prototype.resetLoadingState.call(this)};e.prototype.onTickEnd=function(){var t=this.media;if(!(t!=null&&t.readyState)){return}this.lastCurrentTime=t.currentTime};e.prototype.doTickIdle=function(){var t=this,e=t.hls,r=t.levels,i=t.media,a=t.trackId;var n=e.config;if(!(r!=null&&r[a])){return}if(!i&&(this.startFragRequested||!n.startFragPrefetch)){return}var s=r[a];var o=s.details;if(!o||o.live&&this.levelLastLoaded!==a||this.waitForCdnTuneIn(o)){this.state=ti.WAITING_TRACK;return}var l=this.mediaBuffer?this.mediaBuffer:this.media;if(this.bufferFlushed&&l){this.bufferFlushed=false;this.afterBufferFlushed(l,w.AUDIO,Te.AUDIO)}var u=this.getFwdBufferInfo(l,Te.AUDIO);if(u===null){return}var f=this,c=f.bufferedTrack,d=f.switchingTrack;if(!d&&this._streamEnded(u,o)){e.trigger(h.BUFFER_EOS,{type:"audio"});this.state=ti.ENDED;return}var v=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,Te.MAIN);var p=u.len;var g=this.getMaxBufferLength(v==null?void 0:v.len);if(p>=g&&!d){return}var m=o.fragments;var y=m[0].start;var T=u.end;if(d&&i){var E=this.getLoadPosition();if(c&&d.attrs!==c.attrs){T=E}if(o.PTSKnown&&E<y){if(u.end>y||u.nextStart){this.log("Alt audio track ahead of main track, seek to start of alt audio track");i.currentTime=y+.05}}}var S=this.getNextFragment(T,o);var A=false;if(S&&this.isLoopLoading(S,T)){A=!!S.gap;S=this.getNextFragmentLoopLoading(S,o,u,Te.MAIN,g)}if(!S){this.bufferFlushed=true;return}var L=v&&S.start>v.end+o.targetduration;if(L||!(v!=null&&v.len)&&u.len){var b=this.getAppendedFrag(S.start,Te.MAIN);if(b===null){return}A||(A=!!b.gap||!!L&&v.len===0);if(L&&!A||A&&u.nextStart&&u.nextStart<b.end){return}}this.loadFragment(S,s,T)};e.prototype.getMaxBufferLength=function(e){var r=t.prototype.getMaxBufferLength.call(this);if(!e){return r}return Math.min(Math.max(r,e),this.config.maxMaxBufferLength)};e.prototype.onMediaDetaching=function(){this.videoBuffer=null;t.prototype.onMediaDetaching.call(this)};e.prototype.onAudioTracksUpdated=function(t,e){var r=e.audioTracks;this.resetTransmuxer();this.levels=r.map((function(t){return new He(t)}))};e.prototype.onAudioTrackSwitching=function(t,e){var r=!!e.url;this.trackId=e.id;var i=this.fragCurrent;if(i){i.abortRequests();this.removeUnbufferedFrags(i.start)}this.resetLoadingState();if(!r){this.resetTransmuxer()}else{this.setInterval(Ha)}if(r){this.switchingTrack=e;this.state=ti.IDLE}else{this.switchingTrack=null;this.bufferedTrack=e;this.state=ti.STOPPED}this.tick()};e.prototype.onManifestLoading=function(){this.fragmentTracker.removeAllFragments();this.startPosition=this.lastCurrentTime=0;this.bufferFlushed=false;this.levels=this.mainDetails=this.waitingData=this.bufferedTrack=this.cachedTrackLoadedData=this.switchingTrack=null;this.startFragRequested=false;this.trackId=this.videoTrackCC=this.waitingVideoCC=-1};e.prototype.onLevelLoaded=function(t,e){this.mainDetails=e.details;if(this.cachedTrackLoadedData!==null){this.hls.trigger(h.AUDIO_TRACK_LOADED,this.cachedTrackLoadedData);this.cachedTrackLoadedData=null}};e.prototype.onAudioTrackLoaded=function(t,e){var r;if(this.mainDetails==null){this.cachedTrackLoadedData=e;return}var i=this.levels;var a=e.details,n=e.id;if(!i){this.warn("Audio tracks were reset while loading level ".concat(n));return}this.log("Track ".concat(n," loaded [").concat(a.startSN,",").concat(a.endSN,"]").concat(a.lastPartSn?"[part-".concat(a.lastPartSn,"-").concat(a.lastPartIndex,"]"):"",",duration:").concat(a.totalduration));var s=i[n];var o=0;if(a.live||(r=s.details)!=null&&r.live){this.checkLiveUpdate(a);var l=this.mainDetails;if(a.deltaUpdateFailed||!l){return}if(!s.details&&a.hasProgramDateTime&&l.hasProgramDateTime){Wr(a,l);o=a.fragments[0].start}else{o=this.alignPlaylists(a,s.details)}}s.details=a;this.levelLastLoaded=n;if(!this.startFragRequested&&(this.mainDetails||!a.live)){this.setStartPosition(s.details,o)}if(this.state===ti.WAITING_TRACK&&!this.waitForCdnTuneIn(a)){this.state=ti.IDLE}this.tick()};e.prototype._handleFragmentLoadProgress=function(t){var e;var r=t.frag,i=t.part,a=t.payload;var n=this,s=n.config,o=n.trackId,l=n.levels;if(!l){this.warn("Audio tracks were reset while fragment load was in progress. Fragment ".concat(r.sn," of level ").concat(r.level," will not be buffered"));return}var u=l[o];if(!u){this.warn("Audio track is undefined on fragment load progress");return}var f=u.details;if(!f){this.warn("Audio track details undefined on fragment load progress");this.removeUnbufferedFrags(r.start);return}var c=s.defaultAudioCodec||u.audioCodec||"mp4a.40.2";var d=this.transmuxer;if(!d){d=this.transmuxer=new _a(this.hls,Te.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this))}var h=this.initPTS[r.cc];var v=(e=r.initSegment)==null?void 0:e.data;if(h!==undefined){var p=false;var g=i?i.index:-1;var m=g!==-1;var y=new Mr(r.level,r.sn,r.stats.chunkCount,a.byteLength,g,m);d.push(a,v,c,"",r,i,f.totalduration,p,y,h)}else{this.log("Unknown video PTS for cc ".concat(r.cc,", waiting for video PTS before demuxing audio frag ").concat(r.sn," of [").concat(f.startSN," ,").concat(f.endSN,"],track ").concat(o));var T=(this.waitingData=this.waitingData||{frag:r,part:i,cache:new Ga,complete:false}).cache;T.push(new Uint8Array(a));this.waitingVideoCC=this.videoTrackCC;this.state=ti.WAITING_INIT_PTS}};e.prototype._handleFragmentLoadComplete=function(e){if(this.waitingData){this.waitingData.complete=true;return}t.prototype._handleFragmentLoadComplete.call(this,e)};e.prototype.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null;this.loadedmetadata=false};e.prototype.onBufferCreated=function(t,e){var r=e.tracks.audio;if(r){this.mediaBuffer=r.buffer||null}if(e.tracks.video){this.videoBuffer=e.tracks.video.buffer||null}};e.prototype.onFragBuffered=function(t,e){var r=e.frag,i=e.part;if(r.type!==Te.AUDIO){if(!this.loadedmetadata&&r.type===Te.MAIN){var a=this.videoBuffer||this.media;if(a){var s=Fr.getBuffered(a);if(s.length){this.loadedmetadata=true}}}return}if(this.fragContextChanged(r)){this.warn("Fragment ".concat(r.sn).concat(i?" p: "+i.index:""," of level ").concat(r.level," finished buffering, but was aborted. state: ").concat(this.state,", audioSwitch: ").concat(this.switchingTrack?this.switchingTrack.name:"false"));return}if(r.sn!=="initSegment"){this.fragPrevious=r;var o=this.switchingTrack;if(o){this.bufferedTrack=o;this.switchingTrack=null;this.hls.trigger(h.AUDIO_TRACK_SWITCHED,n({},o))}}this.fragBufferedComplete(r,i)};e.prototype.onError=function(e,r){var i;if(r.fatal){this.state=ti.ERROR;return}switch(r.details){case p.FRAG_GAP:case p.FRAG_PARSING_ERROR:case p.FRAG_DECRYPT_ERROR:case p.FRAG_LOAD_ERROR:case p.FRAG_LOAD_TIMEOUT:case p.KEY_LOAD_ERROR:case p.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Te.AUDIO,r);break;case p.AUDIO_TRACK_LOAD_ERROR:case p.AUDIO_TRACK_LOAD_TIMEOUT:case p.LEVEL_PARSING_ERROR:if(!r.levelRetry&&this.state===ti.WAITING_TRACK&&((i=r.context)==null?void 0:i.type)===ye.AUDIO_TRACK){this.state=ti.IDLE}break;case p.BUFFER_FULL_ERROR:if(!r.parent||r.parent!=="audio"){return}if(this.reduceLengthAndFlushBuffer(r)){this.bufferedTrack=null;t.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")}break;case p.INTERNAL_EXCEPTION:this.recoverWorkerError(r);break}};e.prototype.onBufferFlushed=function(t,e){var r=e.type;if(r===w.AUDIO){this.bufferFlushed=true;if(this.state===ti.ENDED){this.state=ti.IDLE}}};e.prototype._handleTransmuxComplete=function(t){var e;var r="audio";var i=this.hls;var a=t.remuxResult,n=t.chunkMeta;var s=this.getCurrentContext(n);if(!s){this.resetWhenMissingContext(n);return}var l=s.frag,u=s.part,f=s.level;var c=f.details;var d=a.audio,v=a.text,p=a.id3,g=a.initSegment;if(this.fragContextChanged(l)||!c){this.fragmentTracker.removeFragment(l);return}this.state=ti.PARSING;if(this.switchingTrack&&d){this.completeAudioSwitch(this.switchingTrack)}if(g!=null&&g.tracks){var m=l.initSegment||l;this._bufferInitSegment(g.tracks,m,n);i.trigger(h.FRAG_PARSING_INIT_SEGMENT,{frag:m,id:r,tracks:g.tracks})}if(d){var y=d.startPTS,T=d.endPTS,E=d.startDTS,S=d.endDTS;if(u){u.elementaryStreams[w.AUDIO]={startPTS:y,endPTS:T,startDTS:E,endDTS:S}}l.setElementaryStreamInfo(w.AUDIO,y,T,E,S);this.bufferFragmentData(d,l,u,n)}if(p!=null&&(e=p.samples)!=null&&e.length){var A=o({id:r,frag:l,details:c},p);i.trigger(h.FRAG_PARSING_METADATA,A)}if(v){var L=o({id:r,frag:l,details:c},v);i.trigger(h.FRAG_PARSING_USERDATA,L)}};e.prototype._bufferInitSegment=function(t,e,r){if(this.state!==ti.PARSING){return}if(t.video){delete t.video}var i=t.audio;if(!i){return}i.levelCodec=i.codec;i.id="audio";this.log("Init audio buffer, container:".concat(i.container,", codecs[parsed]=[").concat(i.codec,"]"));this.hls.trigger(h.BUFFER_CODECS,t);var a=i.initSegment;if(a!=null&&a.byteLength){var n={type:"audio",frag:e,part:null,chunkMeta:r,parent:e.type,data:a};this.hls.trigger(h.BUFFER_APPENDING,n)}this.tick()};e.prototype.loadFragment=function(e,r,i){var a=this.fragmentTracker.getState(e);this.fragCurrent=e;if(this.switchingTrack||a===Lr.NOT_LOADED||a===Lr.PARTIAL){var n;if(e.sn==="initSegment"){this._loadInitSegment(e,r)}else if((n=r.details)!=null&&n.live&&!this.initPTS[e.cc]){this.log("Waiting for video PTS in continuity counter ".concat(e.cc," of live stream before loading audio fragment ").concat(e.sn," of level ").concat(this.trackId));this.state=ti.WAITING_INIT_PTS}else{this.startFragRequested=true;t.prototype.loadFragment.call(this,e,r,i)}}else{this.clearTrackerIfNeeded(e)}};e.prototype.completeAudioSwitch=function(e){var r=this,i=r.hls,a=r.media,s=r.bufferedTrack;var o=s==null?void 0:s.attrs;var l=e.attrs;if(a&&o&&(o.CHANNELS!==l.CHANNELS||o.NAME!==l.NAME||o.LANGUAGE!==l.LANGUAGE)){this.log("Switching audio track : flushing all audio");t.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")}this.bufferedTrack=e;this.switchingTrack=null;i.trigger(h.AUDIO_TRACK_SWITCHED,n({},e))};return e}(ei);var ja=function(t){__extends(e,t);function e(e){var r=t.call(this,e,"[audio-track-controller]")||this;r.tracks=[];r.groupId=null;r.tracksInGroup=[];r.trackId=-1;r.currentTrack=null;r.selectDefaultTrack=true;r.registerListeners();return r}e.prototype.registerListeners=function(){var t=this.hls;t.on(h.MANIFEST_LOADING,this.onManifestLoading,this);t.on(h.MANIFEST_PARSED,this.onManifestParsed,this);t.on(h.LEVEL_LOADING,this.onLevelLoading,this);t.on(h.LEVEL_SWITCHING,this.onLevelSwitching,this);t.on(h.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this);t.on(h.ERROR,this.onError,this)};e.prototype.unregisterListeners=function(){var t=this.hls;t.off(h.MANIFEST_LOADING,this.onManifestLoading,this);t.off(h.MANIFEST_PARSED,this.onManifestParsed,this);t.off(h.LEVEL_LOADING,this.onLevelLoading,this);t.off(h.LEVEL_SWITCHING,this.onLevelSwitching,this);t.off(h.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this);t.off(h.ERROR,this.onError,this)};e.prototype.destroy=function(){this.unregisterListeners();this.tracks.length=0;this.tracksInGroup.length=0;this.currentTrack=null;t.prototype.destroy.call(this)};e.prototype.onManifestLoading=function(){this.tracks=[];this.groupId=null;this.tracksInGroup=[];this.trackId=-1;this.currentTrack=null;this.selectDefaultTrack=true};e.prototype.onManifestParsed=function(t,e){this.tracks=e.audioTracks||[]};e.prototype.onAudioTrackLoaded=function(t,e){var r=e.id,i=e.groupId,a=e.details;var n=this.tracksInGroup[r];if(!n||n.groupId!==i){this.warn("Track with id:".concat(r," and group:").concat(i," not found in active group ").concat(n.groupId));return}var s=n.details;n.details=e.details;this.log("audio-track ".concat(r,' "').concat(n.name,'" lang:').concat(n.lang," group:").concat(i," loaded [").concat(a.startSN,"-").concat(a.endSN,"]"));if(r===this.trackId){this.playlistLoaded(r,e,s)}};e.prototype.onLevelLoading=function(t,e){this.switchLevel(e.level)};e.prototype.onLevelSwitching=function(t,e){this.switchLevel(e.level)};e.prototype.switchLevel=function(t){var e=this.hls.levels[t];if(!(e!=null&&e.audioGroupIds)){return}var r=e.audioGroupIds[e.urlId];if(this.groupId!==r){this.groupId=r||null;var i=this.tracks.filter((function(t){return!r||t.groupId===r}));if(this.selectDefaultTrack&&!i.some((function(t){return t.default}))){this.selectDefaultTrack=false}this.tracksInGroup=i;var a={audioTracks:i};this.log("Updating audio tracks, ".concat(i.length," track(s) found in group:").concat(r));this.hls.trigger(h.AUDIO_TRACKS_UPDATED,a);this.selectInitialTrack()}else if(this.shouldReloadPlaylist(this.currentTrack)){this.setAudioTrack(this.trackId)}};e.prototype.onError=function(t,e){if(e.fatal||!e.context){return}if(e.context.type===ye.AUDIO_TRACK&&e.context.id===this.trackId&&e.context.groupId===this.groupId){this.requestScheduled=-1;this.checkRetry(e)}};Object.defineProperty(e.prototype,"audioTracks",{get:function(){return this.tracksInGroup},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"audioTrack",{get:function(){return this.trackId},set:function(t){this.selectDefaultTrack=false;this.setAudioTrack(t)},enumerable:false,configurable:true});e.prototype.setAudioTrack=function(t){var e=this.tracksInGroup;if(t<0||t>=e.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var r=this.currentTrack;var i=e[t];var a=i.groupId,s=i.name;this.log("Switching to audio-track ".concat(t,' "').concat(s,'" lang:').concat(i.lang," group:").concat(a));this.trackId=t;this.currentTrack=i;this.selectDefaultTrack=false;this.hls.trigger(h.AUDIO_TRACK_SWITCHING,n({},i));if(i.details&&!i.details.live){return}var o=this.switchParams(i.url,r==null?void 0:r.details);this.loadPlaylist(o)};e.prototype.selectInitialTrack=function(){var t=this.tracksInGroup;var e=this.findTrackId(this.currentTrack)|this.findTrackId(null);if(e!==-1){this.setAudioTrack(e)}else{var r=new Error("No track found for running audio group-ID: ".concat(this.groupId," track count: ").concat(t.length));this.warn(r.message);this.hls.trigger(h.ERROR,{type:v.MEDIA_ERROR,details:p.AUDIO_TRACK_LOAD_ERROR,fatal:true,error:r})}};e.prototype.findTrackId=function(t){var e=this.tracksInGroup;for(var r=0;r<e.length;r++){var i=e[r];if(!this.selectDefaultTrack||i.default){if(!t||t.attrs["STABLE-RENDITION-ID"]!==undefined&&t.attrs["STABLE-RENDITION-ID"]===i.attrs["STABLE-RENDITION-ID"]){return i.id}if(t.name===i.name&&t.lang===i.lang){return i.id}}}return-1};e.prototype.loadPlaylist=function(e){t.prototype.loadPlaylist.call(this);var r=this.tracksInGroup[this.trackId];if(this.shouldLoadPlaylist(r)){var i=r.id;var a=r.groupId;var n=r.url;if(e){try{n=e.addDirectives(n)}catch(t){this.warn("Could not construct new URL with HLS Delivery Directives: ".concat(t))}}this.log("loading audio-track playlist ".concat(i,' "').concat(r.name,'" lang:').concat(r.lang," group:").concat(a));this.clearTimer();this.hls.trigger(h.AUDIO_TRACK_LOADING,{url:n,id:i,groupId:a,deliveryDirectives:e||null})}};return e}(yr);function Ya(t,e){if(t.length!==e.length){return false}for(var r=0;r<t.length;r++){if(!Wa(t[r].attrs,e[r].attrs)){return false}}return true}function Wa(t,e){var r=t["STABLE-RENDITION-ID"];if(r){return r===e["STABLE-RENDITION-ID"]}return!["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED"].some((function(r){return t[r]!==e[r]}))}var qa=500;var Xa=function(t){__extends(e,t);function e(e,r,i){var a=t.call(this,e,r,i,"[subtitle-stream-controller]",Te.SUBTITLE)||this;a.levels=[];a.currentTrackId=-1;a.tracksBuffered=[];a.mainDetails=null;a._registerListeners();return a}e.prototype.onHandlerDestroying=function(){this._unregisterListeners();this.mainDetails=null};e.prototype._registerListeners=function(){var t=this.hls;t.on(h.MEDIA_ATTACHED,this.onMediaAttached,this);t.on(h.MEDIA_DETACHING,this.onMediaDetaching,this);t.on(h.MANIFEST_LOADING,this.onManifestLoading,this);t.on(h.LEVEL_LOADED,this.onLevelLoaded,this);t.on(h.ERROR,this.onError,this);t.on(h.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this);t.on(h.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this);t.on(h.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this);t.on(h.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this);t.on(h.BUFFER_FLUSHING,this.onBufferFlushing,this);t.on(h.FRAG_BUFFERED,this.onFragBuffered,this)};e.prototype._unregisterListeners=function(){var t=this.hls;t.off(h.MEDIA_ATTACHED,this.onMediaAttached,this);t.off(h.MEDIA_DETACHING,this.onMediaDetaching,this);t.off(h.MANIFEST_LOADING,this.onManifestLoading,this);t.off(h.LEVEL_LOADED,this.onLevelLoaded,this);t.off(h.ERROR,this.onError,this);t.off(h.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this);t.off(h.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this);t.off(h.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this);t.off(h.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this);t.off(h.BUFFER_FLUSHING,this.onBufferFlushing,this);t.off(h.FRAG_BUFFERED,this.onFragBuffered,this)};e.prototype.startLoad=function(t){this.stopLoad();this.state=ti.IDLE;this.setInterval(qa);this.nextLoadPosition=this.startPosition=this.lastCurrentTime=t;this.tick()};e.prototype.onManifestLoading=function(){this.mainDetails=null;this.fragmentTracker.removeAllFragments()};e.prototype.onMediaDetaching=function(){this.tracksBuffered=[];t.prototype.onMediaDetaching.call(this)};e.prototype.onLevelLoaded=function(t,e){this.mainDetails=e.details};e.prototype.onSubtitleFragProcessed=function(t,e){var r=e.frag,i=e.success;this.fragPrevious=r;this.state=ti.IDLE;if(!i){return}var a=this.tracksBuffered[this.currentTrackId];if(!a){return}var n;var s=r.start;for(var o=0;o<a.length;o++){if(s>=a[o].start&&s<=a[o].end){n=a[o];break}}var l=r.start+r.duration;if(n){n.end=l}else{n={start:s,end:l};a.push(n)}this.fragmentTracker.fragBuffered(r)};e.prototype.onBufferFlushing=function(t,e){var r=e.startOffset,i=e.endOffset;if(r===0&&i!==Number.POSITIVE_INFINITY){var a=i-1;if(a<=0){return}e.endOffsetSubtitles=Math.max(0,a);this.tracksBuffered.forEach((function(t){for(var e=0;e<t.length;){if(t[e].end<=a){t.shift();continue}else if(t[e].start<a){t[e].start=a}else{break}e++}}));this.fragmentTracker.removeFragmentsInRange(r,a,Te.SUBTITLE)}};e.prototype.onFragBuffered=function(t,e){if(!this.loadedmetadata&&e.frag.type===Te.MAIN){var r;if((r=this.media)!=null&&r.buffered.length){this.loadedmetadata=true}}};e.prototype.onError=function(t,e){var r=e.frag;if((r==null?void 0:r.type)===Te.SUBTITLE){if(this.fragCurrent){this.fragCurrent.abortRequests()}if(this.state!==ti.STOPPED){this.state=ti.IDLE}}};e.prototype.onSubtitleTracksUpdated=function(t,e){var r=this;var i=e.subtitleTracks;if(Ya(this.levels,i)){this.levels=i.map((function(t){return new He(t)}));return}this.tracksBuffered=[];this.levels=i.map((function(t){var e=new He(t);r.tracksBuffered[e.id]=[];return e}));this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,Te.SUBTITLE);this.fragPrevious=null;this.mediaBuffer=null};e.prototype.onSubtitleTrackSwitch=function(t,e){this.currentTrackId=e.id;if(!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var r=this.levels[this.currentTrackId];if(r!=null&&r.details){this.mediaBuffer=this.mediaBufferTimeRanges}else{this.mediaBuffer=null}if(r){this.setInterval(qa)}};e.prototype.onSubtitleTrackLoaded=function(t,e){var r;var i=e.details,a=e.id;var n=this,s=n.currentTrackId,o=n.levels;if(!o.length){return}var l=o[s];if(a>=o.length||a!==s||!l){return}this.mediaBuffer=this.mediaBufferTimeRanges;var u=0;if(i.live||(r=l.details)!=null&&r.live){var f=this.mainDetails;if(i.deltaUpdateFailed||!f){return}var c=f.fragments[0];if(!l.details){if(i.hasProgramDateTime&&f.hasProgramDateTime){Wr(i,f);u=i.fragments[0].start}else if(c){u=c.start;Qe(i,u)}}else{u=this.alignPlaylists(i,l.details);if(u===0&&c){u=c.start;Qe(i,u)}}}l.details=i;this.levelLastLoaded=a;if(!this.startFragRequested&&(this.mainDetails||!i.live)){this.setStartPosition(l.details,u)}this.tick();if(i.live&&!this.fragCurrent&&this.media&&this.state===ti.IDLE){var d=ur(null,i.fragments,this.media.currentTime,0);if(!d){this.warn("Subtitle playlist not aligned with playback");l.details=undefined}}};e.prototype._handleFragmentLoadComplete=function(t){var e=this;var r=t.frag,i=t.payload;var a=r.decryptdata;var n=this.hls;if(this.fragContextChanged(r)){return}if(i&&i.byteLength>0&&a&&a.key&&a.iv&&a.method==="AES-128"){var s=performance.now();this.decrypter.decrypt(new Uint8Array(i),a.key.buffer,a.iv.buffer).catch((function(t){n.trigger(h.ERROR,{type:v.MEDIA_ERROR,details:p.FRAG_DECRYPT_ERROR,fatal:false,error:t,reason:t.message,frag:r});throw t})).then((function(t){var e=performance.now();n.trigger(h.FRAG_DECRYPTED,{frag:r,payload:t,stats:{tstart:s,tdecrypt:e}})})).catch((function(t){e.warn("".concat(t.name,": ").concat(t.message));e.state=ti.IDLE}))}};e.prototype.doTick=function(){if(!this.media){this.state=ti.IDLE;return}if(this.state===ti.IDLE){var t=this,e=t.currentTrackId,r=t.levels;var i=r[e];if(!r.length||!i||!i.details){return}var a=this.config;var n=this.getLoadPosition();var s=Fr.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],n,a.maxBufferHole);var o=s.end,l=s.len;var u=this.getFwdBufferInfo(this.media,Te.MAIN);var f=i.details;var c=this.getMaxBufferLength(u==null?void 0:u.len)+f.levelTargetDuration;if(l>c){return}var d=f.fragments;var h=d.length;var v=f.edge;var p=null;var g=this.fragPrevious;if(o<v){var m=a.maxFragLookUpTolerance;var y=o>v-m?0:m;p=ur(g,d,Math.max(d[0].start,o),y);if(!p&&g&&g.start<d[0].start){p=d[0]}}else{p=d[h-1]}if(!p){return}p=this.mapToInitFragWhenRequired(p);if(p.sn!=="initSegment"){var T=p.sn-f.startSN;var E=d[T-1];if(E&&E.cc===p.cc&&this.fragmentTracker.getState(E)===Lr.NOT_LOADED){p=E}}if(this.fragmentTracker.getState(p)===Lr.NOT_LOADED){this.loadFragment(p,i,o)}}};e.prototype.getMaxBufferLength=function(e){var r=t.prototype.getMaxBufferLength.call(this);if(!e){return r}return Math.max(r,e)};e.prototype.loadFragment=function(e,r,i){this.fragCurrent=e;if(e.sn==="initSegment"){this._loadInitSegment(e,r)}else{this.startFragRequested=true;t.prototype.loadFragment.call(this,e,r,i)}};Object.defineProperty(e.prototype,"mediaBufferTimeRanges",{get:function(){return new za(this.tracksBuffered[this.currentTrackId]||[])},enumerable:false,configurable:true});return e}(ei);var za=function(){function t(t){this.buffered=void 0;var e=function(e,r,i){r=r>>>0;if(r>i-1){throw new DOMException("Failed to execute '".concat(e,"' on 'TimeRanges': The index provided (").concat(r,") is greater than the maximum bound (").concat(i,")"))}return t[r][e]};this.buffered={get length(){return t.length},end:function(r){return e("end",r,t.length)},start:function(r){return e("start",r,t.length)}}}return t}();var Qa=function(t){__extends(e,t);function e(e){var r=t.call(this,e,"[subtitle-track-controller]")||this;r.media=null;r.tracks=[];r.groupId=null;r.tracksInGroup=[];r.trackId=-1;r.selectDefaultTrack=true;r.queuedDefaultTrack=-1;r.trackChangeListener=function(){return r.onTextTracksChanged()};r.asyncPollTrackChange=function(){return r.pollTrackChange(0)};r.useTextTrackPolling=false;r.subtitlePollingInterval=-1;r._subtitleDisplay=true;r.registerListeners();return r}e.prototype.destroy=function(){this.unregisterListeners();this.tracks.length=0;this.tracksInGroup.length=0;this.trackChangeListener=this.asyncPollTrackChange=null;t.prototype.destroy.call(this)};Object.defineProperty(e.prototype,"subtitleDisplay",{get:function(){return this._subtitleDisplay},set:function(t){this._subtitleDisplay=t;if(this.trackId>-1){this.toggleTrackModes(this.trackId)}},enumerable:false,configurable:true});e.prototype.registerListeners=function(){var t=this.hls;t.on(h.MEDIA_ATTACHED,this.onMediaAttached,this);t.on(h.MEDIA_DETACHING,this.onMediaDetaching,this);t.on(h.MANIFEST_LOADING,this.onManifestLoading,this);t.on(h.MANIFEST_PARSED,this.onManifestParsed,this);t.on(h.LEVEL_LOADING,this.onLevelLoading,this);t.on(h.LEVEL_SWITCHING,this.onLevelSwitching,this);t.on(h.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this);t.on(h.ERROR,this.onError,this)};e.prototype.unregisterListeners=function(){var t=this.hls;t.off(h.MEDIA_ATTACHED,this.onMediaAttached,this);t.off(h.MEDIA_DETACHING,this.onMediaDetaching,this);t.off(h.MANIFEST_LOADING,this.onManifestLoading,this);t.off(h.MANIFEST_PARSED,this.onManifestParsed,this);t.off(h.LEVEL_LOADING,this.onLevelLoading,this);t.off(h.LEVEL_SWITCHING,this.onLevelSwitching,this);t.off(h.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this);t.off(h.ERROR,this.onError,this)};e.prototype.onMediaAttached=function(t,e){this.media=e.media;if(!this.media){return}if(this.queuedDefaultTrack>-1){this.subtitleTrack=this.queuedDefaultTrack;this.queuedDefaultTrack=-1}this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks);if(this.useTextTrackPolling){this.pollTrackChange(500)}else{this.media.textTracks.addEventListener("change",this.asyncPollTrackChange)}};e.prototype.pollTrackChange=function(t){self.clearInterval(this.subtitlePollingInterval);this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,t)};e.prototype.onMediaDetaching=function(){if(!this.media){return}self.clearInterval(this.subtitlePollingInterval);if(!this.useTextTrackPolling){this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange)}if(this.trackId>-1){this.queuedDefaultTrack=this.trackId}var t=$a(this.media.textTracks);t.forEach((function(t){Re(t)}));this.subtitleTrack=-1;this.media=null};e.prototype.onManifestLoading=function(){this.tracks=[];this.groupId=null;this.tracksInGroup=[];this.trackId=-1;this.selectDefaultTrack=true};e.prototype.onManifestParsed=function(t,e){this.tracks=e.subtitleTracks};e.prototype.onSubtitleTrackLoaded=function(t,e){var r=e.id,i=e.details;var a=this.trackId;var n=this.tracksInGroup[a];if(!n){this.warn("Invalid subtitle track id ".concat(r));return}var s=n.details;n.details=e.details;this.log("subtitle track ".concat(r," loaded [").concat(i.startSN,"-").concat(i.endSN,"]"));if(r===this.trackId){this.playlistLoaded(r,e,s)}};e.prototype.onLevelLoading=function(t,e){this.switchLevel(e.level)};e.prototype.onLevelSwitching=function(t,e){this.switchLevel(e.level)};e.prototype.switchLevel=function(t){var e=this.hls.levels[t];if(!(e!=null&&e.textGroupIds)){return}var r=e.textGroupIds[e.urlId];var i=this.tracksInGroup?this.tracksInGroup[this.trackId]:undefined;if(this.groupId!==r){var a=this.tracks.filter((function(t){return!r||t.groupId===r}));this.tracksInGroup=a;var n=this.findTrackId(i==null?void 0:i.name)||this.findTrackId();this.groupId=r||null;var s={subtitleTracks:a};this.log("Updating subtitle tracks, ".concat(a.length,' track(s) found in "').concat(r,'" group-id'));this.hls.trigger(h.SUBTITLE_TRACKS_UPDATED,s);if(n!==-1){this.setSubtitleTrack(n,i)}}else if(this.shouldReloadPlaylist(i)){this.setSubtitleTrack(this.trackId,i)}};e.prototype.findTrackId=function(t){var e=this.tracksInGroup;for(var r=0;r<e.length;r++){var i=e[r];if(!this.selectDefaultTrack||i.default){if(!t||t===i.name){return i.id}}}return-1};e.prototype.onError=function(t,e){if(e.fatal||!e.context){return}if(e.context.type===ye.SUBTITLE_TRACK&&e.context.id===this.trackId&&e.context.groupId===this.groupId){this.checkRetry(e)}};Object.defineProperty(e.prototype,"subtitleTracks",{get:function(){return this.tracksInGroup},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"subtitleTrack",{get:function(){return this.trackId},set:function(t){this.selectDefaultTrack=false;var e=this.tracksInGroup?this.tracksInGroup[this.trackId]:undefined;this.setSubtitleTrack(t,e)},enumerable:false,configurable:true});e.prototype.loadPlaylist=function(e){t.prototype.loadPlaylist.call(this);var r=this.tracksInGroup[this.trackId];if(this.shouldLoadPlaylist(r)){var i=r.id;var a=r.groupId;var n=r.url;if(e){try{n=e.addDirectives(n)}catch(t){this.warn("Could not construct new URL with HLS Delivery Directives: ".concat(t))}}this.log("Loading subtitle playlist for id ".concat(i));this.hls.trigger(h.SUBTITLE_TRACK_LOADING,{url:n,id:i,groupId:a,deliveryDirectives:e||null})}};e.prototype.toggleTrackModes=function(t){var e=this;var r=this,i=r.media,a=r.trackId;if(!i){return}var n=$a(i.textTracks);var s=n.filter((function(t){return t.groupId===e.groupId}));if(t===-1){[].slice.call(n).forEach((function(t){t.mode="disabled"}))}else{var o=s[a];if(o){o.mode="disabled"}}var l=s[t];if(l){l.mode=this.subtitleDisplay?"showing":"hidden"}};e.prototype.setSubtitleTrack=function(t,e){var r;var i=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=t;return}if(this.trackId!==t){this.toggleTrackModes(t)}if(this.trackId===t&&(t===-1||(r=i[t])!=null&&r.details)||t<-1||t>=i.length){return}this.clearTimer();var a=i[t];this.log("Switching to subtitle-track ".concat(t)+(a?' "'.concat(a.name,'" lang:').concat(a.lang," group:").concat(a.groupId):""));this.trackId=t;if(a){var n=a.id,s=a.groupId,o=s===void 0?"":s,l=a.name,u=a.type,f=a.url;this.hls.trigger(h.SUBTITLE_TRACK_SWITCH,{id:n,groupId:o,name:l,type:u,url:f});var c=this.switchParams(a.url,e==null?void 0:e.details);this.loadPlaylist(c)}else{this.hls.trigger(h.SUBTITLE_TRACK_SWITCH,{id:t})}};e.prototype.onTextTracksChanged=function(){if(!this.useTextTrackPolling){self.clearInterval(this.subtitlePollingInterval)}if(!this.media||!this.hls.config.renderTextTracksNatively){return}var t=-1;var e=$a(this.media.textTracks);for(var r=0;r<e.length;r++){if(e[r].mode==="hidden"){t=r}else if(e[r].mode==="showing"){t=r;break}}if(this.subtitleTrack!==t){this.subtitleTrack=t}};return e}(yr);function $a(t){var e=[];for(var r=0;r<t.length;r++){var i=t[r];if((i.kind==="subtitles"||i.kind==="captions")&&i.label){e.push(t[r])}}return e}var Ja=function(){function t(t){this.buffers=void 0;this.queues={video:[],audio:[],audiovideo:[]};this.buffers=t}t.prototype.append=function(t,e){var r=this.queues[e];r.push(t);if(r.length===1&&this.buffers[e]){this.executeNext(e)}};t.prototype.insertAbort=function(t,e){var r=this.queues[e];r.unshift(t);this.executeNext(e)};t.prototype.appendBlocker=function(t){var e;var r=new Promise((function(t){e=t}));var i={execute:e,onStart:function(){},onComplete:function(){},onError:function(){}};this.append(i,t);return r};t.prototype.executeNext=function(t){var e=this,r=e.buffers,i=e.queues;var a=r[t];var n=i[t];if(n.length){var s=n[0];try{s.execute()}catch(e){A.warn("[buffer-operation-queue]: Unhandled exception executing the current operation");s.onError(e);if(!(a!=null&&a.updating)){n.shift();this.executeNext(t)}}}};t.prototype.shiftAndExecuteNext=function(t){this.queues[t].shift();this.executeNext(t)};t.prototype.current=function(t){return this.queues[t][0]};return t}();var Za=Zt();var tn=/([ha]vc.)(?:\.[^.,]+)+/;var en=function(){function t(t){var e=this;this.details=null;this._objectUrl=null;this.operationQueue=void 0;this.listeners=void 0;this.hls=void 0;this.bufferCodecEventsExpected=0;this._bufferCodecEventsTotal=0;this.media=null;this.mediaSource=null;this.lastMpegAudioChunk=null;this.appendError=0;this.tracks={};this.pendingTracks={};this.sourceBuffer=void 0;this._onMediaSourceOpen=function(){var t=e,r=t.media,i=t.mediaSource;A.log("[buffer-controller]: Media source opened");if(r){r.removeEventListener("emptied",e._onMediaEmptied);e.updateMediaElementDuration();e.hls.trigger(h.MEDIA_ATTACHED,{media:r})}if(i){i.removeEventListener("sourceopen",e._onMediaSourceOpen)}e.checkPendingTracks()};this._onMediaSourceClose=function(){A.log("[buffer-controller]: Media source closed")};this._onMediaSourceEnded=function(){A.log("[buffer-controller]: Media source ended")};this._onMediaEmptied=function(){var t=e,r=t.media,i=t._objectUrl;if(r&&r.src!==i){A.error("Media element src was set while attaching MediaSource (".concat(i," > ").concat(r.src,")"))}};this.hls=t;this._initSourceBuffer();this.registerListeners()}t.prototype.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0};t.prototype.destroy=function(){this.unregisterListeners();this.details=null;this.lastMpegAudioChunk=null};t.prototype.registerListeners=function(){var t=this.hls;t.on(h.MEDIA_ATTACHING,this.onMediaAttaching,this);t.on(h.MEDIA_DETACHING,this.onMediaDetaching,this);t.on(h.MANIFEST_LOADING,this.onManifestLoading,this);t.on(h.MANIFEST_PARSED,this.onManifestParsed,this);t.on(h.BUFFER_RESET,this.onBufferReset,this);t.on(h.BUFFER_APPENDING,this.onBufferAppending,this);t.on(h.BUFFER_CODECS,this.onBufferCodecs,this);t.on(h.BUFFER_EOS,this.onBufferEos,this);t.on(h.BUFFER_FLUSHING,this.onBufferFlushing,this);t.on(h.LEVEL_UPDATED,this.onLevelUpdated,this);t.on(h.FRAG_PARSED,this.onFragParsed,this);t.on(h.FRAG_CHANGED,this.onFragChanged,this)};t.prototype.unregisterListeners=function(){var t=this.hls;t.off(h.MEDIA_ATTACHING,this.onMediaAttaching,this);t.off(h.MEDIA_DETACHING,this.onMediaDetaching,this);t.off(h.MANIFEST_LOADING,this.onManifestLoading,this);t.off(h.MANIFEST_PARSED,this.onManifestParsed,this);t.off(h.BUFFER_RESET,this.onBufferReset,this);t.off(h.BUFFER_APPENDING,this.onBufferAppending,this);t.off(h.BUFFER_CODECS,this.onBufferCodecs,this);t.off(h.BUFFER_EOS,this.onBufferEos,this);t.off(h.BUFFER_FLUSHING,this.onBufferFlushing,this);t.off(h.LEVEL_UPDATED,this.onLevelUpdated,this);t.off(h.FRAG_PARSED,this.onFragParsed,this);t.off(h.FRAG_CHANGED,this.onFragChanged,this)};t.prototype._initSourceBuffer=function(){this.sourceBuffer={};this.operationQueue=new Ja(this.sourceBuffer);this.listeners={audio:[],video:[],audiovideo:[]};this.lastMpegAudioChunk=null};t.prototype.onManifestLoading=function(){this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=0;this.details=null};t.prototype.onManifestParsed=function(t,e){var r=2;if(e.audio&&!e.video||!e.altAudio||!true){r=1}this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=r;A.log("".concat(this.bufferCodecEventsExpected," bufferCodec event(s) expected"))};t.prototype.onMediaAttaching=function(t,e){var r=this.media=e.media;if(r&&Za){var i=this.mediaSource=new Za;i.addEventListener("sourceopen",this._onMediaSourceOpen);i.addEventListener("sourceended",this._onMediaSourceEnded);i.addEventListener("sourceclose",this._onMediaSourceClose);r.src=self.URL.createObjectURL(i);this._objectUrl=r.src;r.addEventListener("emptied",this._onMediaEmptied)}};t.prototype.onMediaDetaching=function(){var t=this,e=t.media,r=t.mediaSource,i=t._objectUrl;if(r){A.log("[buffer-controller]: media source detaching");if(r.readyState==="open"){try{r.endOfStream()}catch(t){A.warn("[buffer-controller]: onMediaDetaching: ".concat(t.message," while calling endOfStream"))}}this.onBufferReset();r.removeEventListener("sourceopen",this._onMediaSourceOpen);r.removeEventListener("sourceended",this._onMediaSourceEnded);r.removeEventListener("sourceclose",this._onMediaSourceClose);if(e){e.removeEventListener("emptied",this._onMediaEmptied);if(i){self.URL.revokeObjectURL(i)}if(e.src===i){e.removeAttribute("src");e.load()}else{A.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")}}this.mediaSource=null;this.media=null;this._objectUrl=null;this.bufferCodecEventsExpected=this._bufferCodecEventsTotal;this.pendingTracks={};this.tracks={}}this.hls.trigger(h.MEDIA_DETACHED,undefined)};t.prototype.onBufferReset=function(){var t=this;this.getSourceBufferTypes().forEach((function(e){var r=t.sourceBuffer[e];try{if(r){t.removeBufferListeners(e);if(t.mediaSource){t.mediaSource.removeSourceBuffer(r)}t.sourceBuffer[e]=undefined}}catch(t){A.warn("[buffer-controller]: Failed to reset the ".concat(e," buffer"),t)}}));this._initSourceBuffer()};t.prototype.onBufferCodecs=function(t,e){var r=this;var i=this.getSourceBufferTypes().length;Object.keys(e).forEach((function(t){if(i){var a=r.tracks[t];if(a&&typeof a.buffer.changeType==="function"){var n=e[t],s=n.id,o=n.codec,l=n.levelCodec,u=n.container,f=n.metadata;var c=(a.levelCodec||a.codec).replace(tn,"$1");var d=(l||o).replace(tn,"$1");if(c!==d){var h="".concat(u,";codecs=").concat(l||o);r.appendChangeType(t,h);A.log("[buffer-controller]: switching codec ".concat(c," to ").concat(d));r.tracks[t]={buffer:a.buffer,codec:o,container:u,levelCodec:l,metadata:f,id:s}}}}else{r.pendingTracks[t]=e[t]}}));if(i){return}this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0);if(this.mediaSource&&this.mediaSource.readyState==="open"){this.checkPendingTracks()}};t.prototype.appendChangeType=function(t,e){var r=this;var i=this.operationQueue;var a={execute:function(){var a=r.sourceBuffer[t];if(a){A.log("[buffer-controller]: changing ".concat(t," sourceBuffer type to ").concat(e));a.changeType(e)}i.shiftAndExecuteNext(t)},onStart:function(){},onComplete:function(){},onError:function(e){A.warn("[buffer-controller]: Failed to change ".concat(t," SourceBuffer type"),e)}};i.append(a,t)};t.prototype.onBufferAppending=function(t,e){var r=this;var i=this,a=i.hls,n=i.operationQueue,s=i.tracks;var o=e.data,l=e.type,u=e.frag,f=e.part,c=e.chunkMeta;var d=c.buffering[l];var g=self.performance.now();d.start=g;var m=u.stats.buffering;var y=f?f.stats.buffering:null;if(m.start===0){m.start=g}if(y&&y.start===0){y.start=g}var T=s.audio;var E=false;if(l==="audio"&&(T==null?void 0:T.container)==="audio/mpeg"){E=!this.lastMpegAudioChunk||c.id===1||this.lastMpegAudioChunk.sn!==c.sn;this.lastMpegAudioChunk=c}var S=u.start;var L={execute:function(){d.executeStart=self.performance.now();if(E){var t=r.sourceBuffer[l];if(t){var e=S-t.timestampOffset;if(Math.abs(e)>=.1){A.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to ".concat(S," (delta: ").concat(e,") sn: ").concat(u.sn,")"));t.timestampOffset=S}}}r.appendExecutor(o,l)},onStart:function(){},onComplete:function(){var t=self.performance.now();d.executeEnd=d.end=t;if(m.first===0){m.first=t}if(y&&y.first===0){y.first=t}var e=r.sourceBuffer;var i={};for(var a in e){i[a]=Fr.getBuffered(e[a])}r.appendError=0;r.hls.trigger(h.BUFFER_APPENDED,{type:l,frag:u,part:f,chunkMeta:c,parent:u.type,timeRanges:i})},onError:function(t){A.error("[buffer-controller]: Error encountered while trying to append to the ".concat(l," SourceBuffer"),t);var e={type:v.MEDIA_ERROR,parent:u.type,details:p.BUFFER_APPEND_ERROR,frag:u,part:f,chunkMeta:c,error:t,err:t,fatal:false};if(t.code===DOMException.QUOTA_EXCEEDED_ERR){e.details=p.BUFFER_FULL_ERROR}else{r.appendError++;e.details=p.BUFFER_APPEND_ERROR;if(r.appendError>a.config.appendErrorMaxRetry){A.error("[buffer-controller]: Failed ".concat(a.config.appendErrorMaxRetry," times to append segment in sourceBuffer"));e.fatal=true}}a.trigger(h.ERROR,e)}};n.append(L,l)};t.prototype.onBufferFlushing=function(t,e){var r=this;var i=this.operationQueue;var a=function(t){return{execute:r.removeExecutor.bind(r,t,e.startOffset,e.endOffset),onStart:function(){},onComplete:function(){r.hls.trigger(h.BUFFER_FLUSHED,{type:t})},onError:function(e){A.warn("[buffer-controller]: Failed to remove from ".concat(t," SourceBuffer"),e)}}};if(e.type){i.append(a(e.type),e.type)}else{this.getSourceBufferTypes().forEach((function(t){i.append(a(t),t)}))}};t.prototype.onFragParsed=function(t,e){var r=this;var i=e.frag,a=e.part;var n=[];var s=a?a.elementaryStreams:i.elementaryStreams;if(s[w.AUDIOVIDEO]){n.push("audiovideo")}else{if(s[w.AUDIO]){n.push("audio")}if(s[w.VIDEO]){n.push("video")}}var o=function(){var t=self.performance.now();i.stats.buffering.end=t;if(a){a.stats.buffering.end=t}var e=a?a.stats:i.stats;r.hls.trigger(h.FRAG_BUFFERED,{frag:i,part:a,stats:e,id:i.type})};if(n.length===0){A.warn("Fragments must have at least one ElementaryStreamType set. type: ".concat(i.type," level: ").concat(i.level," sn: ").concat(i.sn))}this.blockBuffers(o,n)};t.prototype.onFragChanged=function(t,e){this.flushBackBuffer()};t.prototype.onBufferEos=function(t,e){var r=this;var i=this.getSourceBufferTypes().reduce((function(t,i){var a=r.sourceBuffer[i];if(a&&(!e.type||e.type===i)){a.ending=true;if(!a.ended){a.ended=true;A.log("[buffer-controller]: ".concat(i," sourceBuffer now EOS"))}}return t&&!!(!a||a.ended)}),true);if(i){A.log("[buffer-controller]: Queueing mediaSource.endOfStream()");this.blockBuffers((function(){r.getSourceBufferTypes().forEach((function(t){var e=r.sourceBuffer[t];if(e){e.ending=false}}));var t=r.mediaSource;if(!t||t.readyState!=="open"){if(t){A.info("[buffer-controller]: Could not call mediaSource.endOfStream(). mediaSource.readyState: ".concat(t.readyState))}return}A.log("[buffer-controller]: Calling mediaSource.endOfStream()");t.endOfStream()}))}};t.prototype.onLevelUpdated=function(t,e){var r=e.details;if(!r.fragments.length){return}this.details=r;if(this.getSourceBufferTypes().length){this.blockBuffers(this.updateMediaElementDuration.bind(this))}else{this.updateMediaElementDuration()}};t.prototype.flushBackBuffer=function(){var t=this,e=t.hls,r=t.details,i=t.media,a=t.sourceBuffer;if(!i||r===null){return}var n=this.getSourceBufferTypes();if(!n.length){return}var s=r.live&&e.config.liveBackBufferLength!==null?e.config.liveBackBufferLength:e.config.backBufferLength;if(!f(s)||s<0){return}var o=i.currentTime;var l=r.levelTargetDuration;var u=Math.max(s,l);var c=Math.floor(o/l)*l-u;n.forEach((function(t){var i=a[t];if(i){var n=Fr.getBuffered(i);if(n.length>0&&c>n.start(0)){e.trigger(h.BACK_BUFFER_REACHED,{bufferEnd:c});if(r.live){e.trigger(h.LIVE_BACK_BUFFER_REACHED,{bufferEnd:c})}else if(i.ended&&n.end(n.length-1)-o<l*2){A.info("[buffer-controller]: Cannot flush ".concat(t," back buffer while SourceBuffer is in ended state"));return}e.trigger(h.BUFFER_FLUSHING,{startOffset:0,endOffset:c,type:t})}}}))};t.prototype.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open"){return}var t=this,e=t.details,r=t.hls,i=t.media,a=t.mediaSource;var n=e.fragments[0].start+e.totalduration;var s=i.duration;var o=f(a.duration)?a.duration:0;if(e.live&&r.config.liveDurationInfinity){A.log("[buffer-controller]: Media Source duration is set to Infinity");a.duration=Infinity;this.updateSeekableRange(e)}else if(n>o&&n>s||!f(s)){A.log("[buffer-controller]: Updating Media Source duration to ".concat(n.toFixed(3)));a.duration=n}};t.prototype.updateSeekableRange=function(t){var e=this.mediaSource;var r=t.fragments;var i=r.length;if(i&&t.live&&e!=null&&e.setLiveSeekableRange){var a=Math.max(0,r[0].start);var n=Math.max(a,a+t.totalduration);e.setLiveSeekableRange(a,n)}};t.prototype.checkPendingTracks=function(){var t=this,e=t.bufferCodecEventsExpected,r=t.operationQueue,i=t.pendingTracks;var a=Object.keys(i).length;if(a&&!e||a===2){this.createSourceBuffers(i);this.pendingTracks={};var n=this.getSourceBufferTypes();if(n.length){this.hls.trigger(h.BUFFER_CREATED,{tracks:this.tracks});n.forEach((function(t){r.executeNext(t)}))}else{var s=new Error("could not create source buffer for media codec(s)");this.hls.trigger(h.ERROR,{type:v.MEDIA_ERROR,details:p.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:true,error:s,reason:s.message})}}};t.prototype.createSourceBuffers=function(t){var e=this,r=e.sourceBuffer,i=e.mediaSource;if(!i){throw Error("createSourceBuffers called when mediaSource was null")}for(var a in t){if(!r[a]){var n=t[a];if(!n){throw Error("source buffer exists for track ".concat(a,", however track does not"))}var s=n.levelCodec||n.codec;var o="".concat(n.container,";codecs=").concat(s);A.log("[buffer-controller]: creating sourceBuffer(".concat(o,")"));try{var l=r[a]=i.addSourceBuffer(o);var u=a;this.addBufferListener(u,"updatestart",this._onSBUpdateStart);this.addBufferListener(u,"updateend",this._onSBUpdateEnd);this.addBufferListener(u,"error",this._onSBUpdateError);this.tracks[a]={buffer:l,codec:s,container:n.container,levelCodec:n.levelCodec,metadata:n.metadata,id:n.id}}catch(t){A.error("[buffer-controller]: error while trying to add sourceBuffer: ".concat(t.message));this.hls.trigger(h.ERROR,{type:v.MEDIA_ERROR,details:p.BUFFER_ADD_CODEC_ERROR,fatal:false,error:t,mimeType:o})}}}};t.prototype._onSBUpdateStart=function(t){var e=this.operationQueue;var r=e.current(t);r.onStart()};t.prototype._onSBUpdateEnd=function(t){var e=this.operationQueue;var r=e.current(t);r.onComplete();e.shiftAndExecuteNext(t)};t.prototype._onSBUpdateError=function(t,e){var r=new Error("".concat(t," SourceBuffer error"));A.error("[buffer-controller]: ".concat(r),e);this.hls.trigger(h.ERROR,{type:v.MEDIA_ERROR,details:p.BUFFER_APPENDING_ERROR,error:r,fatal:false});var i=this.operationQueue.current(t);if(i){i.onError(e)}};t.prototype.removeExecutor=function(t,e,r){var i=this,a=i.media,n=i.mediaSource,s=i.operationQueue,o=i.sourceBuffer;var l=o[t];if(!a||!n||!l){A.warn("[buffer-controller]: Attempting to remove from the ".concat(t," SourceBuffer, but it does not exist"));s.shiftAndExecuteNext(t);return}var u=f(a.duration)?a.duration:Infinity;var c=f(n.duration)?n.duration:Infinity;var d=Math.max(0,e);var h=Math.min(r,u,c);if(h>d&&!l.ending){l.ended=false;A.log("[buffer-controller]: Removing [".concat(d,",").concat(h,"] from the ").concat(t," SourceBuffer"));l.remove(d,h)}else{s.shiftAndExecuteNext(t)}};t.prototype.appendExecutor=function(t,e){var r=this,i=r.operationQueue,a=r.sourceBuffer;var n=a[e];if(!n){A.warn("[buffer-controller]: Attempting to append to the ".concat(e," SourceBuffer, but it does not exist"));i.shiftAndExecuteNext(e);return}n.ended=false;n.appendBuffer(t)};t.prototype.blockBuffers=function(t,e){var r=this;if(e===void 0){e=this.getSourceBufferTypes()}if(!e.length){A.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist");Promise.resolve().then(t);return}var i=this.operationQueue;var a=e.map((function(t){return i.appendBlocker(t)}));Promise.all(a).then((function(){t();e.forEach((function(t){var e=r.sourceBuffer[t];if(!(e!=null&&e.updating)){i.shiftAndExecuteNext(t)}}))}))};t.prototype.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)};t.prototype.addBufferListener=function(t,e,r){var i=this.sourceBuffer[t];if(!i){return}var a=r.bind(this,t);this.listeners[t].push({event:e,listener:a});i.addEventListener(e,a)};t.prototype.removeBufferListeners=function(t){var e=this.sourceBuffer[t];if(!e){return}this.listeners[t].forEach((function(t){e.removeEventListener(t.event,t.listener)}))};return t}();var rn={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499};var an=function t(e){var r=e;if(rn.hasOwnProperty(e)){r=rn[e]}return String.fromCharCode(r)};var nn=15;var sn=100;var on={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14};var ln={17:2,18:4,21:6,22:8,23:10,19:13,20:15};var un={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14};var fn={25:2,26:4,29:6,30:8,31:10,27:13,28:15};var cn=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];var dn=function(){function t(){this.time=null;this.verboseLevel=0}t.prototype.log=function(t,e){if(this.verboseLevel>=t){var r=typeof e==="function"?e():e;A.log("".concat(this.time," [").concat(t,"] ").concat(r))}};return t}();var hn=function t(e){var r=[];for(var i=0;i<e.length;i++){r.push(e[i].toString(16))}return r};var vn=function(){function t(t,e,r,i,a){this.foreground=void 0;this.underline=void 0;this.italics=void 0;this.background=void 0;this.flash=void 0;this.foreground=t||"white";this.underline=e||false;this.italics=r||false;this.background=i||"black";this.flash=a||false}t.prototype.reset=function(){this.foreground="white";this.underline=false;this.italics=false;this.background="black";this.flash=false};t.prototype.setStyles=function(t){var e=["foreground","underline","italics","background","flash"];for(var r=0;r<e.length;r++){var i=e[r];if(t.hasOwnProperty(i)){this[i]=t[i]}}};t.prototype.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash};t.prototype.equals=function(t){return this.foreground===t.foreground&&this.underline===t.underline&&this.italics===t.italics&&this.background===t.background&&this.flash===t.flash};t.prototype.copy=function(t){this.foreground=t.foreground;this.underline=t.underline;this.italics=t.italics;this.background=t.background;this.flash=t.flash};t.prototype.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash};return t}();var pn=function(){function t(t,e,r,i,a,n){this.uchar=void 0;this.penState=void 0;this.uchar=t||" ";this.penState=new vn(e,r,i,a,n)}t.prototype.reset=function(){this.uchar=" ";this.penState.reset()};t.prototype.setChar=function(t,e){this.uchar=t;this.penState.copy(e)};t.prototype.setPenState=function(t){this.penState.copy(t)};t.prototype.equals=function(t){return this.uchar===t.uchar&&this.penState.equals(t.penState)};t.prototype.copy=function(t){this.uchar=t.uchar;this.penState.copy(t.penState)};t.prototype.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()};return t}();var gn=function(){function t(t){this.chars=void 0;this.pos=void 0;this.currPenState=void 0;this.cueStartTime=void 0;this.logger=void 0;this.chars=[];for(var e=0;e<sn;e++){this.chars.push(new pn)}this.logger=t;this.pos=0;this.currPenState=new vn}t.prototype.equals=function(t){var e=true;for(var r=0;r<sn;r++){if(!this.chars[r].equals(t.chars[r])){e=false;break}}return e};t.prototype.copy=function(t){for(var e=0;e<sn;e++){this.chars[e].copy(t.chars[e])}};t.prototype.isEmpty=function(){var t=true;for(var e=0;e<sn;e++){if(!this.chars[e].isEmpty()){t=false;break}}return t};t.prototype.setCursor=function(t){if(this.pos!==t){this.pos=t}if(this.pos<0){this.logger.log(3,"Negative cursor position "+this.pos);this.pos=0}else if(this.pos>sn){this.logger.log(3,"Too large cursor position "+this.pos);this.pos=sn}};t.prototype.moveCursor=function(t){var e=this.pos+t;if(t>1){for(var r=this.pos+1;r<e+1;r++){this.chars[r].setPenState(this.currPenState)}}this.setCursor(e)};t.prototype.backSpace=function(){this.moveCursor(-1);this.chars[this.pos].setChar(" ",this.currPenState)};t.prototype.insertChar=function(t){var e=this;if(t>=144){this.backSpace()}var r=an(t);if(this.pos>=sn){this.logger.log(0,(function(){return"Cannot insert "+t.toString(16)+" ("+r+") at position "+e.pos+". Skipping it!"}));return}this.chars[this.pos].setChar(r,this.currPenState);this.moveCursor(1)};t.prototype.clearFromPos=function(t){var e;for(e=t;e<sn;e++){this.chars[e].reset()}};t.prototype.clear=function(){this.clearFromPos(0);this.pos=0;this.currPenState.reset()};t.prototype.clearToEndOfRow=function(){this.clearFromPos(this.pos)};t.prototype.getTextString=function(){var t=[];var e=true;for(var r=0;r<sn;r++){var i=this.chars[r].uchar;if(i!==" "){e=false}t.push(i)}if(e){return""}else{return t.join("")}};t.prototype.setPenStyles=function(t){this.currPenState.setStyles(t);var e=this.chars[this.pos];e.setPenState(this.currPenState)};return t}();var mn=function(){function t(t){this.rows=void 0;this.currRow=void 0;this.nrRollUpRows=void 0;this.lastOutputScreen=void 0;this.logger=void 0;this.rows=[];for(var e=0;e<nn;e++){this.rows.push(new gn(t))}this.logger=t;this.currRow=nn-1;this.nrRollUpRows=null;this.lastOutputScreen=null;this.reset()}t.prototype.reset=function(){for(var t=0;t<nn;t++){this.rows[t].clear()}this.currRow=nn-1};t.prototype.equals=function(t){var e=true;for(var r=0;r<nn;r++){if(!this.rows[r].equals(t.rows[r])){e=false;break}}return e};t.prototype.copy=function(t){for(var e=0;e<nn;e++){this.rows[e].copy(t.rows[e])}};t.prototype.isEmpty=function(){var t=true;for(var e=0;e<nn;e++){if(!this.rows[e].isEmpty()){t=false;break}}return t};t.prototype.backSpace=function(){var t=this.rows[this.currRow];t.backSpace()};t.prototype.clearToEndOfRow=function(){var t=this.rows[this.currRow];t.clearToEndOfRow()};t.prototype.insertChar=function(t){var e=this.rows[this.currRow];e.insertChar(t)};t.prototype.setPen=function(t){var e=this.rows[this.currRow];e.setPenStyles(t)};t.prototype.moveCursor=function(t){var e=this.rows[this.currRow];e.moveCursor(t)};t.prototype.setCursor=function(t){this.logger.log(2,"setCursor: "+t);var e=this.rows[this.currRow];e.setCursor(t)};t.prototype.setPAC=function(t){this.logger.log(2,(function(){return"pacData = "+JSON.stringify(t)}));var e=t.row-1;if(this.nrRollUpRows&&e<this.nrRollUpRows-1){e=this.nrRollUpRows-1}if(this.nrRollUpRows&&this.currRow!==e){for(var r=0;r<nn;r++){this.rows[r].clear()}var i=this.currRow+1-this.nrRollUpRows;var a=this.lastOutputScreen;if(a){var n=a.rows[i].cueStartTime;var s=this.logger.time;if(n&&s!==null&&n<s){for(var r=0;r<this.nrRollUpRows;r++){this.rows[e-this.nrRollUpRows+r+1].copy(a.rows[i+r])}}}}this.currRow=e;var o=this.rows[this.currRow];if(t.indent!==null){var l=t.indent;var u=Math.max(l-1,0);o.setCursor(t.indent);t.color=o.chars[u].penState.foreground}var f={foreground:t.color,underline:t.underline,italics:t.italics,background:"black",flash:false};this.setPen(f)};t.prototype.setBkgData=function(t){this.logger.log(2,(function(){return"bkgData = "+JSON.stringify(t)}));this.backSpace();this.setPen(t);this.insertChar(32)};t.prototype.setRollUpRows=function(t){this.nrRollUpRows=t};t.prototype.rollUp=function(){var t=this;if(this.nrRollUpRows===null){this.logger.log(3,"roll_up but nrRollUpRows not set yet");return}this.logger.log(1,(function(){return t.getDisplayText()}));var e=this.currRow+1-this.nrRollUpRows;var r=this.rows.splice(e,1)[0];r.clear();this.rows.splice(this.currRow,0,r);this.logger.log(2,"Rolling up")};t.prototype.getDisplayText=function(t){t=t||false;var e=[];var r="";var i=-1;for(var a=0;a<nn;a++){var n=this.rows[a].getTextString();if(n){i=a+1;if(t){e.push("Row "+i+": '"+n+"'")}else{e.push(n.trim())}}}if(e.length>0){if(t){r="["+e.join(" | ")+"]"}else{r=e.join("\n")}}return r};t.prototype.getTextAndFormat=function(){return this.rows};return t}();var yn=function(){function t(t,e,r){this.chNr=void 0;this.outputFilter=void 0;this.mode=void 0;this.verbose=void 0;this.displayedMemory=void 0;this.nonDisplayedMemory=void 0;this.lastOutputScreen=void 0;this.currRollUpRow=void 0;this.writeScreen=void 0;this.cueStartTime=void 0;this.logger=void 0;this.chNr=t;this.outputFilter=e;this.mode=null;this.verbose=0;this.displayedMemory=new mn(r);this.nonDisplayedMemory=new mn(r);this.lastOutputScreen=new mn(r);this.currRollUpRow=this.displayedMemory.rows[nn-1];this.writeScreen=this.displayedMemory;this.mode=null;this.cueStartTime=null;this.logger=r}t.prototype.reset=function(){this.mode=null;this.displayedMemory.reset();this.nonDisplayedMemory.reset();this.lastOutputScreen.reset();this.outputFilter.reset();this.currRollUpRow=this.displayedMemory.rows[nn-1];this.writeScreen=this.displayedMemory;this.mode=null;this.cueStartTime=null};t.prototype.getHandler=function(){return this.outputFilter};t.prototype.setHandler=function(t){this.outputFilter=t};t.prototype.setPAC=function(t){this.writeScreen.setPAC(t)};t.prototype.setBkgData=function(t){this.writeScreen.setBkgData(t)};t.prototype.setMode=function(t){if(t===this.mode){return}this.mode=t;this.logger.log(2,(function(){return"MODE="+t}));if(this.mode==="MODE_POP-ON"){this.writeScreen=this.nonDisplayedMemory}else{this.writeScreen=this.displayedMemory;this.writeScreen.reset()}if(this.mode!=="MODE_ROLL-UP"){this.displayedMemory.nrRollUpRows=null;this.nonDisplayedMemory.nrRollUpRows=null}this.mode=t};t.prototype.insertChars=function(t){var e=this;for(var r=0;r<t.length;r++){this.writeScreen.insertChar(t[r])}var i=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(2,(function(){return i+": "+e.writeScreen.getDisplayText(true)}));if(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP"){this.logger.log(1,(function(){return"DISPLAYED: "+e.displayedMemory.getDisplayText(true)}));this.outputDataUpdate()}};t.prototype.ccRCL=function(){this.logger.log(2,"RCL - Resume Caption Loading");this.setMode("MODE_POP-ON")};t.prototype.ccBS=function(){this.logger.log(2,"BS - BackSpace");if(this.mode==="MODE_TEXT"){return}this.writeScreen.backSpace();if(this.writeScreen===this.displayedMemory){this.outputDataUpdate()}};t.prototype.ccAOF=function(){};t.prototype.ccAON=function(){};t.prototype.ccDER=function(){this.logger.log(2,"DER- Delete to End of Row");this.writeScreen.clearToEndOfRow();this.outputDataUpdate()};t.prototype.ccRU=function(t){this.logger.log(2,"RU("+t+") - Roll Up");this.writeScreen=this.displayedMemory;this.setMode("MODE_ROLL-UP");this.writeScreen.setRollUpRows(t)};t.prototype.ccFON=function(){this.logger.log(2,"FON - Flash On");this.writeScreen.setPen({flash:true})};t.prototype.ccRDC=function(){this.logger.log(2,"RDC - Resume Direct Captioning");this.setMode("MODE_PAINT-ON")};t.prototype.ccTR=function(){this.logger.log(2,"TR");this.setMode("MODE_TEXT")};t.prototype.ccRTD=function(){this.logger.log(2,"RTD");this.setMode("MODE_TEXT")};t.prototype.ccEDM=function(){this.logger.log(2,"EDM - Erase Displayed Memory");this.displayedMemory.reset();this.outputDataUpdate(true)};t.prototype.ccCR=function(){this.logger.log(2,"CR - Carriage Return");this.writeScreen.rollUp();this.outputDataUpdate(true)};t.prototype.ccENM=function(){this.logger.log(2,"ENM - Erase Non-displayed Memory");this.nonDisplayedMemory.reset()};t.prototype.ccEOC=function(){var t=this;this.logger.log(2,"EOC - End Of Caption");if(this.mode==="MODE_POP-ON"){var e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory;this.nonDisplayedMemory=e;this.writeScreen=this.nonDisplayedMemory;this.logger.log(1,(function(){return"DISP: "+t.displayedMemory.getDisplayText()}))}this.outputDataUpdate(true)};t.prototype.ccTO=function(t){this.logger.log(2,"TO("+t+") - Tab Offset");this.writeScreen.moveCursor(t)};t.prototype.ccMIDROW=function(t){var e={flash:false};e.underline=t%2===1;e.italics=t>=46;if(!e.italics){var r=Math.floor(t/2)-16;var i=["white","green","blue","cyan","red","yellow","magenta"];e.foreground=i[r]}else{e.foreground="white"}this.logger.log(2,"MIDROW: "+JSON.stringify(e));this.writeScreen.setPen(e)};t.prototype.outputDataUpdate=function(t){if(t===void 0){t=false}var e=this.logger.time;if(e===null){return}if(this.outputFilter){if(this.cueStartTime===null&&!this.displayedMemory.isEmpty()){this.cueStartTime=e}else{if(!this.displayedMemory.equals(this.lastOutputScreen)){this.outputFilter.newCue(this.cueStartTime,e,this.lastOutputScreen);if(t&&this.outputFilter.dispatchCue){this.outputFilter.dispatchCue()}this.cueStartTime=this.displayedMemory.isEmpty()?null:e}}this.lastOutputScreen.copy(this.displayedMemory)}};t.prototype.cueSplitAtTime=function(t){if(this.outputFilter){if(!this.displayedMemory.isEmpty()){if(this.outputFilter.newCue){this.outputFilter.newCue(this.cueStartTime,t,this.displayedMemory)}this.cueStartTime=t}}};return t}();var Tn=function(){function t(t,e,r){this.channels=void 0;this.currentChannel=0;this.cmdHistory=void 0;this.logger=void 0;var i=new dn;this.channels=[null,new yn(t,e,i),new yn(t+1,r,i)];this.cmdHistory=An();this.logger=i}t.prototype.getHandler=function(t){return this.channels[t].getHandler()};t.prototype.setHandler=function(t,e){this.channels[t].setHandler(e)};t.prototype.addData=function(t,e){var r;var i;var a;var n=false;this.logger.time=t;for(var s=0;s<e.length;s+=2){i=e[s]&127;a=e[s+1]&127;if(i===0&&a===0){continue}else{this.logger.log(3,"["+hn([e[s],e[s+1]])+"] -> ("+hn([i,a])+")")}r=this.parseCmd(i,a);if(!r){r=this.parseMidrow(i,a)}if(!r){r=this.parsePAC(i,a)}if(!r){r=this.parseBackgroundAttributes(i,a)}if(!r){n=this.parseChars(i,a);if(n){var o=this.currentChannel;if(o&&o>0){var l=this.channels[o];l.insertChars(n)}else{this.logger.log(2,"No channel found yet. TEXT-MODE?")}}}if(!r&&!n){this.logger.log(2,"Couldn't parse cleaned data "+hn([i,a])+" orig: "+hn([e[s],e[s+1]]))}}};t.prototype.parseCmd=function(t,e){var r=this.cmdHistory;var i=(t===20||t===28||t===21||t===29)&&e>=32&&e<=47;var a=(t===23||t===31)&&e>=33&&e<=35;if(!(i||a)){return false}if(Sn(t,e,r)){En(null,null,r);this.logger.log(3,"Repeated command ("+hn([t,e])+") is dropped");return true}var n=t===20||t===21||t===23?1:2;var s=this.channels[n];if(t===20||t===21||t===28||t===29){if(e===32){s.ccRCL()}else if(e===33){s.ccBS()}else if(e===34){s.ccAOF()}else if(e===35){s.ccAON()}else if(e===36){s.ccDER()}else if(e===37){s.ccRU(2)}else if(e===38){s.ccRU(3)}else if(e===39){s.ccRU(4)}else if(e===40){s.ccFON()}else if(e===41){s.ccRDC()}else if(e===42){s.ccTR()}else if(e===43){s.ccRTD()}else if(e===44){s.ccEDM()}else if(e===45){s.ccCR()}else if(e===46){s.ccENM()}else if(e===47){s.ccEOC()}}else{s.ccTO(e-32)}En(t,e,r);this.currentChannel=n;return true};t.prototype.parseMidrow=function(t,e){var r=0;if((t===17||t===25)&&e>=32&&e<=47){if(t===17){r=1}else{r=2}if(r!==this.currentChannel){this.logger.log(0,"Mismatch channel in midrow parsing");return false}var i=this.channels[r];if(!i){return false}i.ccMIDROW(e);this.logger.log(3,"MIDROW ("+hn([t,e])+")");return true}return false};t.prototype.parsePAC=function(t,e){var r;var i=this.cmdHistory;var a=(t>=17&&t<=23||t>=25&&t<=31)&&e>=64&&e<=127;var n=(t===16||t===24)&&e>=64&&e<=95;if(!(a||n)){return false}if(Sn(t,e,i)){En(null,null,i);return true}var s=t<=23?1:2;if(e>=64&&e<=95){r=s===1?on[t]:un[t]}else{r=s===1?ln[t]:fn[t]}var o=this.channels[s];if(!o){return false}o.setPAC(this.interpretPAC(r,e));En(t,e,i);this.currentChannel=s;return true};t.prototype.interpretPAC=function(t,e){var r;var i={color:null,italics:false,indent:null,underline:false,row:t};if(e>95){r=e-96}else{r=e-64}i.underline=(r&1)===1;if(r<=13){i.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(r/2)]}else if(r<=15){i.italics=true;i.color="white"}else{i.indent=Math.floor((r-16)/2)*4}return i};t.prototype.parseChars=function(t,e){var r;var i=null;var a=null;if(t>=25){r=2;a=t-8}else{r=1;a=t}if(a>=17&&a<=19){var n=void 0;if(a===17){n=e+80}else if(a===18){n=e+112}else{n=e+144}this.logger.log(2,"Special char '"+an(n)+"' in channel "+r);i=[n]}else if(t>=32&&t<=127){i=e===0?[t]:[t,e]}if(i){var s=hn(i);this.logger.log(3,"Char codes = "+s.join(","));En(t,e,this.cmdHistory)}return i};t.prototype.parseBackgroundAttributes=function(t,e){var r=(t===16||t===24)&&e>=32&&e<=47;var i=(t===23||t===31)&&e>=45&&e<=47;if(!(r||i)){return false}var a;var n={};if(t===16||t===24){a=Math.floor((e-32)/2);n.background=cn[a];if(e%2===1){n.background=n.background+"_semi"}}else if(e===45){n.background="transparent"}else{n.foreground="black";if(e===47){n.underline=true}}var s=t<=23?1:2;var o=this.channels[s];o.setBkgData(n);En(t,e,this.cmdHistory);return true};t.prototype.reset=function(){for(var t=0;t<Object.keys(this.channels).length;t++){var e=this.channels[t];if(e){e.reset()}}this.cmdHistory=An()};t.prototype.cueSplitAtTime=function(t){for(var e=0;e<this.channels.length;e++){var r=this.channels[e];if(r){r.cueSplitAtTime(t)}}};return t}();function En(t,e,r){r.a=t;r.b=e}function Sn(t,e,r){return r.a===t&&r.b===e}function An(){return{a:null,b:null}}var Ln=function(){function t(t,e){this.timelineController=void 0;this.cueRanges=[];this.trackName=void 0;this.startTime=null;this.endTime=null;this.screen=null;this.timelineController=t;this.trackName=e}t.prototype.dispatchCue=function(){if(this.startTime===null){return}this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges);this.startTime=null};t.prototype.newCue=function(t,e,r){if(this.startTime===null||this.startTime>t){this.startTime=t}this.endTime=e;this.screen=r;this.timelineController.createCaptionsTrack(this.trackName)};t.prototype.reset=function(){this.cueRanges=[];this.startTime=null};return t}();var bn=function(){if(typeof self!=="undefined"&&self.VTTCue){return self.VTTCue}var t=["","lr","rl"];var e=["start","middle","end","left","right"];function r(t,e){if(typeof e!=="string"){return false}if(!Array.isArray(t)){return false}var r=e.toLowerCase();if(~t.indexOf(r)){return r}return false}function i(e){return r(t,e)}function a(t){return r(e,t)}function n(t){var e=[];for(var r=1;r<arguments.length;r++){e[r-1]=arguments[r]}var i=1;for(;i<arguments.length;i++){var a=arguments[i];for(var n in a){t[n]=a[n]}}return t}function s(t,e,r){var s=this;var o={enumerable:true};s.hasBeenReset=false;var l="";var u=false;var f=t;var c=e;var d=r;var h=null;var v="";var p=true;var g="auto";var m="start";var y=50;var T="middle";var E=50;var S="middle";Object.defineProperty(s,"id",n({},o,{get:function(){return l},set:function(t){l=""+t}}));Object.defineProperty(s,"pauseOnExit",n({},o,{get:function(){return u},set:function(t){u=!!t}}));Object.defineProperty(s,"startTime",n({},o,{get:function(){return f},set:function(t){if(typeof t!=="number"){throw new TypeError("Start time must be set to a number.")}f=t;this.hasBeenReset=true}}));Object.defineProperty(s,"endTime",n({},o,{get:function(){return c},set:function(t){if(typeof t!=="number"){throw new TypeError("End time must be set to a number.")}c=t;this.hasBeenReset=true}}));Object.defineProperty(s,"text",n({},o,{get:function(){return d},set:function(t){d=""+t;this.hasBeenReset=true}}));Object.defineProperty(s,"region",n({},o,{get:function(){return h},set:function(t){h=t;this.hasBeenReset=true}}));Object.defineProperty(s,"vertical",n({},o,{get:function(){return v},set:function(t){var e=i(t);if(e===false){throw new SyntaxError("An invalid or illegal string was specified.")}v=e;this.hasBeenReset=true}}));Object.defineProperty(s,"snapToLines",n({},o,{get:function(){return p},set:function(t){p=!!t;this.hasBeenReset=true}}));Object.defineProperty(s,"line",n({},o,{get:function(){return g},set:function(t){if(typeof t!=="number"&&t!=="auto"){throw new SyntaxError("An invalid number or illegal string was specified.")}g=t;this.hasBeenReset=true}}));Object.defineProperty(s,"lineAlign",n({},o,{get:function(){return m},set:function(t){var e=a(t);if(!e){throw new SyntaxError("An invalid or illegal string was specified.")}m=e;this.hasBeenReset=true}}));Object.defineProperty(s,"position",n({},o,{get:function(){return y},set:function(t){if(t<0||t>100){throw new Error("Position must be between 0 and 100.")}y=t;this.hasBeenReset=true}}));Object.defineProperty(s,"positionAlign",n({},o,{get:function(){return T},set:function(t){var e=a(t);if(!e){throw new SyntaxError("An invalid or illegal string was specified.")}T=e;this.hasBeenReset=true}}));Object.defineProperty(s,"size",n({},o,{get:function(){return E},set:function(t){if(t<0||t>100){throw new Error("Size must be between 0 and 100.")}E=t;this.hasBeenReset=true}}));Object.defineProperty(s,"align",n({},o,{get:function(){return S},set:function(t){var e=a(t);if(!e){throw new SyntaxError("An invalid or illegal string was specified.")}S=e;this.hasBeenReset=true}}));s.displayState=undefined}s.prototype.getCueAsHTML=function(){var t=self.WebVTT;return t.convertCueToDOMTree(self,this.text)};return s}();var Rn=function(){function t(){}t.prototype.decode=function(t,e){if(!t){return""}if(typeof t!=="string"){throw new Error("Error - expected string data.")}return decodeURIComponent(encodeURIComponent(t))};return t}();function In(t){function e(t,e,r,i){return(t|0)*3600+(e|0)*60+(r|0)+parseFloat(i||0)}var r=t.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);if(!r){return null}if(parseFloat(r[2])>59){return e(r[2],r[3],0,r[4])}return e(r[1],r[2],r[3],r[4])}var Dn=function(){function t(){this.values=Object.create(null)}t.prototype.set=function(t,e){if(!this.get(t)&&e!==""){this.values[t]=e}};t.prototype.get=function(t,e,r){if(r){return this.has(t)?this.values[t]:e[r]}return this.has(t)?this.values[t]:e};t.prototype.has=function(t){return t in this.values};t.prototype.alt=function(t,e,r){for(var i=0;i<r.length;++i){if(e===r[i]){this.set(t,e);break}}};t.prototype.integer=function(t,e){if(/^-?\d+$/.test(e)){this.set(t,parseInt(e,10))}};t.prototype.percent=function(t,e){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(e)){var r=parseFloat(e);if(r>=0&&r<=100){this.set(t,r);return true}}return false};return t}();function kn(t,e,r,i){var a=i?t.split(i):[t];for(var n in a){if(typeof a[n]!=="string"){continue}var s=a[n].split(r);if(s.length!==2){continue}var o=s[0];var l=s[1];e(o,l)}}var _n=new bn(0,0,"");var wn=_n.align==="middle"?"middle":"center";function Cn(t,e,r){var i=t;function a(){var e=In(t);if(e===null){throw new Error("Malformed timestamp: "+i)}t=t.replace(/^[^\sa-zA-Z-]+/,"");return e}function n(t,e){var i=new Dn;kn(t,(function(t,e){var a;switch(t){case"region":for(var n=r.length-1;n>=0;n--){if(r[n].id===e){i.set(t,r[n].region);break}}break;case"vertical":i.alt(t,e,["rl","lr"]);break;case"line":a=e.split(",");i.integer(t,a[0]);if(i.percent(t,a[0])){i.set("snapToLines",false)}i.alt(t,a[0],["auto"]);if(a.length===2){i.alt("lineAlign",a[1],["start",wn,"end"])}break;case"position":a=e.split(",");i.percent(t,a[0]);if(a.length===2){i.alt("positionAlign",a[1],["start",wn,"end","line-left","line-right","auto"])}break;case"size":i.percent(t,e);break;case"align":i.alt(t,e,["start",wn,"end","left","right"]);break}}),/:/,/\s/);e.region=i.get("region",null);e.vertical=i.get("vertical","");var a=i.get("line","auto");if(a==="auto"&&_n.line===-1){a=-1}e.line=a;e.lineAlign=i.get("lineAlign","start");e.snapToLines=i.get("snapToLines",true);e.size=i.get("size",100);e.align=i.get("align",wn);var n=i.get("position","auto");if(n==="auto"&&_n.position===50){n=e.align==="start"||e.align==="left"?0:e.align==="end"||e.align==="right"?100:50}e.position=n}function s(){t=t.replace(/^\s+/,"")}s();e.startTime=a();s();if(t.slice(0,3)!=="--\x3e"){throw new Error("Malformed time stamp (time stamps must be separated by '--\x3e'): "+i)}t=t.slice(3);s();e.endTime=a();s();n(t,e)}function Pn(t){return t.replace(/<br(?: \/)?>/gi,"\n")}var On=function(){function t(){this.state="INITIAL";this.buffer="";this.decoder=new Rn;this.regionList=[];this.cue=null;this.oncue=void 0;this.onparsingerror=void 0;this.onflush=void 0}t.prototype.parse=function(t){var e=this;if(t){e.buffer+=e.decoder.decode(t,{stream:true})}function r(){var t=e.buffer;var r=0;t=Pn(t);while(r<t.length&&t[r]!=="\r"&&t[r]!=="\n"){++r}var i=t.slice(0,r);if(t[r]==="\r"){++r}if(t[r]==="\n"){++r}e.buffer=t.slice(r);return i}function i(t){kn(t,(function(t,e){}),/:/)}try{var a="";if(e.state==="INITIAL"){if(!/\r\n|\n/.test(e.buffer)){return this}a=r();var n=a.match(/^()?WEBVTT([ \t].*)?$/);if(!(n!=null&&n[0])){throw new Error("Malformed WebVTT signature.")}e.state="HEADER"}var s=false;while(e.buffer){if(!/\r\n|\n/.test(e.buffer)){return this}if(!s){a=r()}else{s=false}switch(e.state){case"HEADER":if(/:/.test(a)){i(a)}else if(!a){e.state="ID"}continue;case"NOTE":if(!a){e.state="ID"}continue;case"ID":if(/^NOTE($|[ \t])/.test(a)){e.state="NOTE";break}if(!a){continue}e.cue=new bn(0,0,"");e.state="CUE";if(a.indexOf("--\x3e")===-1){e.cue.id=a;continue}case"CUE":if(!e.cue){e.state="BADCUE";continue}try{Cn(a,e.cue,e.regionList)}catch(t){e.cue=null;e.state="BADCUE";continue}e.state="CUETEXT";continue;case"CUETEXT":{var o=a.indexOf("--\x3e")!==-1;if(!a||o&&(s=true)){if(e.oncue&&e.cue){e.oncue(e.cue)}e.cue=null;e.state="ID";continue}if(e.cue===null){continue}if(e.cue.text){e.cue.text+="\n"}e.cue.text+=a}continue;case"BADCUE":if(!a){e.state="ID"}}}}catch(t){if(e.state==="CUETEXT"&&e.cue&&e.oncue){e.oncue(e.cue)}e.cue=null;e.state=e.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this};t.prototype.flush=function(){var t=this;try{if(t.cue||t.state==="HEADER"){t.buffer+="\n\n";t.parse()}if(t.state==="INITIAL"||t.state==="BADWEBVTT"){throw new Error("Malformed WebVTT signature.")}}catch(e){if(t.onparsingerror){t.onparsingerror(e)}}if(t.onflush){t.onflush()}return this};return t}();var xn=/\r\n|\n\r|\n|\r/g;var Fn=function t(e,r,i){if(i===void 0){i=0}return e.slice(i,i+r.length)===r};var Mn=function t(e){var r=parseInt(e.slice(-3));var i=parseInt(e.slice(-6,-4));var a=parseInt(e.slice(-9,-7));var n=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!f(r)||!f(i)||!f(a)||!f(n)){throw Error("Malformed X-TIMESTAMP-MAP: Local:".concat(e))}r+=1e3*i;r+=60*1e3*a;r+=60*60*1e3*n;return r};var Nn=function t(e){var r=5381;var i=e.length;while(i){r=r*33^e.charCodeAt(--i)}return(r>>>0).toString()};function Un(t,e,r){return Nn(t.toString())+Nn(e.toString())+Nn(r)}var Bn=function t(e,r,i){var a=e[r];var n=e[a.prevCC];if(!n||!n.new&&a.new){e.ccOffset=e.presentationOffset=a.start;a.new=false;return}while((s=n)!=null&&s.new){var s;e.ccOffset+=a.start-n.start;a.new=false;a=n;n=e[a.prevCC]}e.presentationOffset=i};function Gn(t,e,r,i,a,n,s){var o=new On;var l=dt(new Uint8Array(t)).trim().replace(xn,"\n").split("\n");var u=[];var f=e?ea(e.baseTime,e.timescale):0;var c="00:00.000";var d=0;var h=0;var v;var p=true;o.oncue=function(t){var n=r[i];var s=r.ccOffset;var o=(d-f)/9e4;if(n!=null&&n.new){if(h!==undefined){s=r.ccOffset=n.start}else{Bn(r,i,o)}}if(o){if(!e){v=new Error("Missing initPTS for VTT MPEGTS");return}s=o-r.presentationOffset}var l=t.endTime-t.startTime;var c=la((t.startTime+s-h)*9e4,a*9e4)/9e4;t.startTime=Math.max(c,0);t.endTime=Math.max(c+l,0);var p=t.text.trim();t.text=decodeURIComponent(encodeURIComponent(p));if(!t.id){t.id=Un(t.startTime,t.endTime,p)}if(t.endTime>0){u.push(t)}};o.onparsingerror=function(t){v=t};o.onflush=function(){if(v){s(v);return}n(u)};l.forEach((function(t){if(p){if(Fn(t,"X-TIMESTAMP-MAP=")){p=false;t.slice(16).split(",").forEach((function(t){if(Fn(t,"LOCAL:")){c=t.slice(6)}else if(Fn(t,"MPEGTS:")){d=parseInt(t.slice(7))}}));try{h=Mn(c)/1e3}catch(t){v=t}return}else if(t===""){p=false}}o.parse(t+"\n")}));o.flush()}var Kn="stpp.ttml.im1t";var Hn=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/;var Vn=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/;var jn={left:"start",center:"center",right:"end",start:"start",end:"end"};function Yn(t,e,r,i){var a=bt(new Uint8Array(t),["mdat"]);if(a.length===0){i(new Error("Could not parse IMSC1 mdat"));return}var n=a.map((function(t){return dt(t)}));var s=Zi(e.baseTime,1,e.timescale);try{n.forEach((function(t){return r(Wn(t,s))}))}catch(t){i(t)}}function Wn(t,e){var r=new DOMParser;var i=r.parseFromString(t,"text/xml");var a=i.getElementsByTagName("tt")[0];if(!a){throw new Error("Invalid ttml")}var n={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0};var s=Object.keys(n).reduce((function(t,e){t[e]=a.getAttribute("ttp:".concat(e))||n[e];return t}),{});var l=a.getAttribute("xml:space")!=="preserve";var u=Xn(qn(a,"styling","style"));var f=Xn(qn(a,"layout","region"));var c=qn(a,"body","[begin]");return[].map.call(c,(function(t){var r=zn(t,l);if(!r||!t.hasAttribute("begin")){return null}var i=Zn(t.getAttribute("begin"),s);var a=Zn(t.getAttribute("dur"),s);var n=Zn(t.getAttribute("end"),s);if(i===null){throw Jn(t)}if(n===null){if(a===null){throw Jn(t)}n=i+a}var c=new bn(i-e,n-e,r);c.id=Un(c.startTime,c.endTime,c.text);var d=f[t.getAttribute("region")];var h=u[t.getAttribute("style")];var v=Qn(d,h,u);var p=v.textAlign;if(p){var g=jn[p];if(g){c.lineAlign=g}c.align=p}o(c,v);return c})).filter((function(t){return t!==null}))}function qn(t,e,r){var i=t.getElementsByTagName(e)[0];if(i){return[].slice.call(i.querySelectorAll(r))}return[]}function Xn(t){return t.reduce((function(t,e){var r=e.getAttribute("xml:id");if(r){t[r]=e}return t}),{})}function zn(t,e){return[].slice.call(t.childNodes).reduce((function(t,r,i){var a;if(r.nodeName==="br"&&i){return t+"\n"}if((a=r.childNodes)!=null&&a.length){return zn(r,e)}else if(e){return t+r.textContent.trim().replace(/\s+/g," ")}return t+r.textContent}),"")}function Qn(t,e,r){var i="http://www.w3.org/ns/ttml#styling";var a=null;var n=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];var s=t!=null&&t.hasAttribute("style")?t.getAttribute("style"):null;if(s&&r.hasOwnProperty(s)){a=r[s]}return n.reduce((function(r,n){var s=$n(e,i,n)||$n(t,i,n)||$n(a,i,n);if(s){r[n]=s}return r}),{})}function $n(t,e,r){if(!t){return null}return t.hasAttributeNS(e,r)?t.getAttributeNS(e,r):null}function Jn(t){return new Error("Could not parse ttml timestamp ".concat(t))}function Zn(t,e){if(!t){return null}var r=In(t);if(r===null){if(Hn.test(t)){r=ts(t,e)}else if(Vn.test(t)){r=es(t,e)}}return r}function ts(t,e){var r=Hn.exec(t);var i=(r[4]|0)+(r[5]|0)/e.subFrameRate;return(r[1]|0)*3600+(r[2]|0)*60+(r[3]|0)+i/e.frameRate}function es(t,e){var r=Vn.exec(t);var i=Number(r[1]);var a=r[2];switch(a){case"h":return i*3600;case"m":return i*60;case"ms":return i*1e3;case"f":return i/e.frameRate;case"t":return i/e.tickRate}return i}var rs=function(){function t(t){this.hls=void 0;this.media=null;this.config=void 0;this.enabled=true;this.Cues=void 0;this.textTracks=[];this.tracks=[];this.initPTS=[];this.unparsedVttFrags=[];this.captionsTracks={};this.nonNativeCaptionsTracks={};this.cea608Parser1=void 0;this.cea608Parser2=void 0;this.lastSn=-1;this.lastPartIndex=-1;this.prevCC=-1;this.vttCCs=ns();this.captionsProperties=void 0;this.hls=t;this.config=t.config;this.Cues=t.config.cueHandler;this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}};if(this.config.enableCEA708Captions){var e=new Ln(this,"textTrack1");var r=new Ln(this,"textTrack2");var i=new Ln(this,"textTrack3");var a=new Ln(this,"textTrack4");this.cea608Parser1=new Tn(1,e,r);this.cea608Parser2=new Tn(3,i,a)}t.on(h.MEDIA_ATTACHING,this.onMediaAttaching,this);t.on(h.MEDIA_DETACHING,this.onMediaDetaching,this);t.on(h.MANIFEST_LOADING,this.onManifestLoading,this);t.on(h.MANIFEST_LOADED,this.onManifestLoaded,this);t.on(h.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this);t.on(h.FRAG_LOADING,this.onFragLoading,this);t.on(h.FRAG_LOADED,this.onFragLoaded,this);t.on(h.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this);t.on(h.FRAG_DECRYPTED,this.onFragDecrypted,this);t.on(h.INIT_PTS_FOUND,this.onInitPtsFound,this);t.on(h.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this);t.on(h.BUFFER_FLUSHING,this.onBufferFlushing,this)}t.prototype.destroy=function(){var t=this.hls;t.off(h.MEDIA_ATTACHING,this.onMediaAttaching,this);t.off(h.MEDIA_DETACHING,this.onMediaDetaching,this);t.off(h.MANIFEST_LOADING,this.onManifestLoading,this);t.off(h.MANIFEST_LOADED,this.onManifestLoaded,this);t.off(h.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this);t.off(h.FRAG_LOADING,this.onFragLoading,this);t.off(h.FRAG_LOADED,this.onFragLoaded,this);t.off(h.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this);t.off(h.FRAG_DECRYPTED,this.onFragDecrypted,this);t.off(h.INIT_PTS_FOUND,this.onInitPtsFound,this);t.off(h.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this);t.off(h.BUFFER_FLUSHING,this.onBufferFlushing,this);this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null};t.prototype.addCues=function(t,e,r,i,a){var n=false;for(var s=a.length;s--;){var o=a[s];var l=as(o[0],o[1],e,r);if(l>=0){o[0]=Math.min(o[0],e);o[1]=Math.max(o[1],r);n=true;if(l/(r-e)>.5){return}}}if(!n){a.push([e,r])}if(this.config.renderTextTracksNatively){var u=this.captionsTracks[t];this.Cues.newCue(u,e,r,i)}else{var f=this.Cues.newCue(null,e,r,i);this.hls.trigger(h.CUES_PARSED,{type:"captions",cues:f,track:t})}};t.prototype.onInitPtsFound=function(t,e){var r=this;var i=e.frag,a=e.id,n=e.initPTS,s=e.timescale;var o=this.unparsedVttFrags;if(a==="main"){this.initPTS[i.cc]={baseTime:n,timescale:s}}if(o.length){this.unparsedVttFrags=[];o.forEach((function(t){r.onFragLoaded(h.FRAG_LOADED,t)}))}};t.prototype.getExistingTrack=function(t){var e=this.media;if(e){for(var r=0;r<e.textTracks.length;r++){var i=e.textTracks[r];if(i[t]){return i}}}return null};t.prototype.createCaptionsTrack=function(t){if(this.config.renderTextTracksNatively){this.createNativeTrack(t)}else{this.createNonNativeTrack(t)}};t.prototype.createNativeTrack=function(t){if(this.captionsTracks[t]){return}var e=this,r=e.captionsProperties,i=e.captionsTracks,a=e.media;var n=r[t],s=n.label,o=n.languageCode;var l=this.getExistingTrack(t);if(!l){var u=this.createTextTrack("captions",s,o);if(u){u[t]=true;i[t]=u}}else{i[t]=l;Re(i[t]);Le(i[t],a)}};t.prototype.createNonNativeTrack=function(t){if(this.nonNativeCaptionsTracks[t]){return}var e=this.captionsProperties[t];if(!e){return}var r=e.label;var i={_id:t,label:r,kind:"captions",default:e.media?!!e.media.default:false,closedCaptions:e.media};this.nonNativeCaptionsTracks[t]=i;this.hls.trigger(h.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[i]})};t.prototype.createTextTrack=function(t,e,r){var i=this.media;if(!i){return}return i.addTextTrack(t,e,r)};t.prototype.onMediaAttaching=function(t,e){this.media=e.media;this._cleanTracks()};t.prototype.onMediaDetaching=function(){var t=this.captionsTracks;Object.keys(t).forEach((function(e){Re(t[e]);delete t[e]}));this.nonNativeCaptionsTracks={}};t.prototype.onManifestLoading=function(){this.lastSn=-1;this.lastPartIndex=-1;this.prevCC=-1;this.vttCCs=ns();this._cleanTracks();this.tracks=[];this.captionsTracks={};this.nonNativeCaptionsTracks={};this.textTracks=[];this.unparsedVttFrags=[];this.initPTS=[];if(this.cea608Parser1&&this.cea608Parser2){this.cea608Parser1.reset();this.cea608Parser2.reset()}};t.prototype._cleanTracks=function(){var t=this.media;if(!t){return}var e=t.textTracks;if(e){for(var r=0;r<e.length;r++){Re(e[r])}}};t.prototype.onSubtitleTracksUpdated=function(t,e){var r=this;var i=e.subtitleTracks||[];var a=i.some((function(t){return t.textCodec===Kn}));if(this.config.enableWebVTT||a&&this.config.enableIMSC1){var n=Ya(this.tracks,i);if(n){this.tracks=i;return}this.textTracks=[];this.tracks=i;if(this.config.renderTextTracksNatively){var s=this.media?this.media.textTracks:null;this.tracks.forEach((function(t,e){var i;if(s&&e<s.length){var a=null;for(var n=0;n<s.length;n++){if(is(s[n],t)){a=s[n];break}}if(a){i=a}}if(i){Re(i)}else{var o=r._captionsOrSubtitlesFromCharacteristics(t);i=r.createTextTrack(o,t.name,t.lang);if(i){i.mode="disabled"}}if(i){i.groupId=t.groupId;r.textTracks.push(i)}}))}else if(this.tracks.length){var o=this.tracks.map((function(t){return{label:t.name,kind:t.type.toLowerCase(),default:t.default,subtitleTrack:t}}));this.hls.trigger(h.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:o})}}};t.prototype._captionsOrSubtitlesFromCharacteristics=function(t){if(t.attrs.CHARACTERISTICS){var e=/transcribes-spoken-dialog/gi.test(t.attrs.CHARACTERISTICS);var r=/describes-music-and-sound/gi.test(t.attrs.CHARACTERISTICS);if(e&&r){return"captions"}}return"subtitles"};t.prototype.onManifestLoaded=function(t,e){var r=this;if(this.config.enableCEA708Captions&&e.captions){e.captions.forEach((function(t){var e=/(?:CC|SERVICE)([1-4])/.exec(t.instreamId);if(!e){return}var i="textTrack".concat(e[1]);var a=r.captionsProperties[i];if(!a){return}a.label=t.name;if(t.lang){a.languageCode=t.lang}a.media=t}))}};t.prototype.closedCaptionsForLevel=function(t){var e=this.hls.levels[t.level];return e==null?void 0:e.attrs["CLOSED-CAPTIONS"]};t.prototype.onFragLoading=function(t,e){var r=this,i=r.cea608Parser1,a=r.cea608Parser2,n=r.lastSn,s=r.lastPartIndex;if(!this.enabled||!(i&&a)){return}if(e.frag.type===Te.MAIN){var o,l;var u=e.frag.sn;var f=(o=e==null?void 0:(l=e.part)==null?void 0:l.index)!=null?o:-1;if(!(u===n+1||u===n&&f===s+1)){i.reset();a.reset()}this.lastSn=u;this.lastPartIndex=f}};t.prototype.onFragLoaded=function(t,e){var r=e.frag,i=e.payload;if(r.type===Te.SUBTITLE){if(i.byteLength){var a=r.decryptdata;var n="stats"in e;if(a==null||!a.encrypted||n){var s=this.tracks[r.level];var o=this.vttCCs;if(!o[r.cc]){o[r.cc]={start:r.start,prevCC:this.prevCC,new:true};this.prevCC=r.cc}if(s&&s.textCodec===Kn){this._parseIMSC1(r,i)}else{this._parseVTTs(e)}}}else{this.hls.trigger(h.SUBTITLE_FRAG_PROCESSED,{success:false,frag:r,error:new Error("Empty subtitle payload")})}}};t.prototype._parseIMSC1=function(t,e){var r=this;var i=this.hls;Yn(e,this.initPTS[t.cc],(function(e){r._appendCues(e,t.level);i.trigger(h.SUBTITLE_FRAG_PROCESSED,{success:true,frag:t})}),(function(e){A.log("Failed to parse IMSC1: ".concat(e));i.trigger(h.SUBTITLE_FRAG_PROCESSED,{success:false,frag:t,error:e})}))};t.prototype._parseVTTs=function(t){var e=this;var r;var i=t.frag,a=t.payload;var n=this,s=n.initPTS,o=n.unparsedVttFrags;var l=s.length-1;if(!s[i.cc]&&l===-1){o.push(t);return}var u=this.hls;var f=(r=i.initSegment)!=null&&r.data?xt(i.initSegment.data,new Uint8Array(a)):a;Gn(f,this.initPTS[i.cc],this.vttCCs,i.cc,i.start,(function(t){e._appendCues(t,i.level);u.trigger(h.SUBTITLE_FRAG_PROCESSED,{success:true,frag:i})}),(function(r){var n=r.message==="Missing initPTS for VTT MPEGTS";if(n){o.push(t)}else{e._fallbackToIMSC1(i,a)}A.log("Failed to parse VTT cue: ".concat(r));if(n&&l>i.cc){return}u.trigger(h.SUBTITLE_FRAG_PROCESSED,{success:false,frag:i,error:r})}))};t.prototype._fallbackToIMSC1=function(t,e){var r=this;var i=this.tracks[t.level];if(!i.textCodec){Yn(e,this.initPTS[t.cc],(function(){i.textCodec=Kn;r._parseIMSC1(t,e)}),(function(){i.textCodec="wvtt"}))}};t.prototype._appendCues=function(t,e){var r=this.hls;if(this.config.renderTextTracksNatively){var i=this.textTracks[e];if(!i||i.mode==="disabled"){return}t.forEach((function(t){return be(i,t)}))}else{var a=this.tracks[e];if(!a){return}var n=a.default?"default":"subtitles"+e;r.trigger(h.CUES_PARSED,{type:"subtitles",cues:t,track:n})}};t.prototype.onFragDecrypted=function(t,e){var r=e.frag;if(r.type===Te.SUBTITLE){this.onFragLoaded(h.FRAG_LOADED,e)}};t.prototype.onSubtitleTracksCleared=function(){this.tracks=[];this.captionsTracks={}};t.prototype.onFragParsingUserdata=function(t,e){var r=this,i=r.cea608Parser1,a=r.cea608Parser2;if(!this.enabled||!(i&&a)){return}var n=e.frag,s=e.samples;if(n.type===Te.MAIN&&this.closedCaptionsForLevel(n)==="NONE"){return}for(var o=0;o<s.length;o++){var l=s[o].bytes;if(l){var u=this.extractCea608Data(l);i.addData(s[o].pts,u[0]);a.addData(s[o].pts,u[1])}}};t.prototype.onBufferFlushing=function(t,e){var r=e.startOffset,i=e.endOffset,a=e.endOffsetSubtitles,n=e.type;var s=this.media;if(!s||s.currentTime<i){return}if(!n||n==="video"){var o=this.captionsTracks;Object.keys(o).forEach((function(t){return Ie(o[t],r,i)}))}if(this.config.renderTextTracksNatively){if(r===0&&a!==undefined){var l=this.textTracks;Object.keys(l).forEach((function(t){return Ie(l[t],r,a)}))}}};t.prototype.extractCea608Data=function(t){var e=[[],[]];var r=t[0]&31;var i=2;for(var a=0;a<r;a++){var n=t[i++];var s=127&t[i++];var o=127&t[i++];if(s===0&&o===0){continue}var l=(4&n)!==0;if(l){var u=3&n;if(0===u||1===u){e[u].push(s);e[u].push(o)}}}return e};return t}();function is(t,e){return!!t&&t.label===e.name&&!(t.textTrack1||t.textTrack2)}function as(t,e,r,i){return Math.min(e,i)-Math.max(t,r)}function ns(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:true}}}var ss=function(){function t(t){this.hls=void 0;this.autoLevelCapping=void 0;this.firstLevel=void 0;this.media=void 0;this.restrictedLevels=void 0;this.timer=void 0;this.clientRect=void 0;this.streamController=void 0;this.hls=t;this.autoLevelCapping=Number.POSITIVE_INFINITY;this.firstLevel=-1;this.media=null;this.restrictedLevels=[];this.timer=undefined;this.clientRect=null;this.registerListeners()}t.prototype.setStreamController=function(t){this.streamController=t};t.prototype.destroy=function(){this.unregisterListener();if(this.hls.config.capLevelToPlayerSize){this.stopCapping()}this.media=null;this.clientRect=null;this.hls=this.streamController=null};t.prototype.registerListeners=function(){var t=this.hls;t.on(h.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this);t.on(h.MEDIA_ATTACHING,this.onMediaAttaching,this);t.on(h.MANIFEST_PARSED,this.onManifestParsed,this);t.on(h.BUFFER_CODECS,this.onBufferCodecs,this);t.on(h.MEDIA_DETACHING,this.onMediaDetaching,this)};t.prototype.unregisterListener=function(){var t=this.hls;t.off(h.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this);t.off(h.MEDIA_ATTACHING,this.onMediaAttaching,this);t.off(h.MANIFEST_PARSED,this.onManifestParsed,this);t.off(h.BUFFER_CODECS,this.onBufferCodecs,this);t.off(h.MEDIA_DETACHING,this.onMediaDetaching,this)};t.prototype.onFpsDropLevelCapping=function(t,e){var r=this.hls.levels[e.droppedLevel];if(this.isLevelAllowed(r)){this.restrictedLevels.push({bitrate:r.bitrate,height:r.height,width:r.width})}};t.prototype.onMediaAttaching=function(t,e){this.media=e.media instanceof HTMLVideoElement?e.media:null;this.clientRect=null};t.prototype.onManifestParsed=function(t,e){var r=this.hls;this.restrictedLevels=[];this.firstLevel=e.firstLevel;if(r.config.capLevelToPlayerSize&&e.video){this.startCapping()}};t.prototype.onBufferCodecs=function(t,e){var r=this.hls;if(r.config.capLevelToPlayerSize&&e.video){this.startCapping()}};t.prototype.onMediaDetaching=function(){this.stopCapping()};t.prototype.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var t=this.hls.levels;if(t.length){var e=this.hls;e.autoLevelCapping=this.getMaxLevel(t.length-1);if(e.autoLevelCapping>this.autoLevelCapping&&this.streamController){this.streamController.nextLevelSwitch()}this.autoLevelCapping=e.autoLevelCapping}}};t.prototype.getMaxLevel=function(e){var r=this;var i=this.hls.levels;if(!i.length){return-1}var a=i.filter((function(t,i){return r.isLevelAllowed(t)&&i<=e}));this.clientRect=null;return t.getMaxLevelByMediaSize(a,this.mediaWidth,this.mediaHeight)};t.prototype.startCapping=function(){if(this.timer){return}this.autoLevelCapping=Number.POSITIVE_INFINITY;this.hls.firstLevel=this.getMaxLevel(this.firstLevel);self.clearInterval(this.timer);this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3);this.detectPlayerSize()};t.prototype.stopCapping=function(){this.restrictedLevels=[];this.firstLevel=-1;this.autoLevelCapping=Number.POSITIVE_INFINITY;if(this.timer){self.clearInterval(this.timer);this.timer=undefined}};t.prototype.getDimensions=function(){if(this.clientRect){return this.clientRect}var t=this.media;var e={width:0,height:0};if(t){var r=t.getBoundingClientRect();e.width=r.width;e.height=r.height;if(!e.width&&!e.height){e.width=r.right-r.left||t.width||0;e.height=r.bottom-r.top||t.height||0}}this.clientRect=e;return e};Object.defineProperty(t.prototype,"mediaWidth",{get:function(){return this.getDimensions().width*this.contentScaleFactor},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"mediaHeight",{get:function(){return this.getDimensions().height*this.contentScaleFactor},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"contentScaleFactor",{get:function(){var t=1;if(!this.hls.config.ignoreDevicePixelRatio){try{t=self.devicePixelRatio}catch(t){}}return t},enumerable:false,configurable:true});t.prototype.isLevelAllowed=function(t){var e=this.restrictedLevels;return!e.some((function(e){return t.bitrate===e.bitrate&&t.width===e.width&&t.height===e.height}))};t.getMaxLevelByMediaSize=function(t,e,r){if(!(t!=null&&t.length)){return-1}var i=function(t,e){if(!e){return true}return t.width!==e.width||t.height!==e.height};var a=t.length-1;for(var n=0;n<t.length;n+=1){var s=t[n];if((s.width>=e||s.height>=r)&&i(s,t[n+1])){a=n;break}}return a};return t}();var os=function(){function t(t){this.hls=void 0;this.isVideoPlaybackQualityAvailable=false;this.timer=void 0;this.media=null;this.lastTime=void 0;this.lastDroppedFrames=0;this.lastDecodedFrames=0;this.streamController=void 0;this.hls=t;this.registerListeners()}t.prototype.setStreamController=function(t){this.streamController=t};t.prototype.registerListeners=function(){this.hls.on(h.MEDIA_ATTACHING,this.onMediaAttaching,this)};t.prototype.unregisterListeners=function(){this.hls.off(h.MEDIA_ATTACHING,this.onMediaAttaching,this)};t.prototype.destroy=function(){if(this.timer){clearInterval(this.timer)}this.unregisterListeners();this.isVideoPlaybackQualityAvailable=false;this.media=null};t.prototype.onMediaAttaching=function(t,e){var r=this.hls.config;if(r.capLevelOnFPSDrop){var i=e.media instanceof self.HTMLVideoElement?e.media:null;this.media=i;if(i&&typeof i.getVideoPlaybackQuality==="function"){this.isVideoPlaybackQualityAvailable=true}self.clearInterval(this.timer);this.timer=self.setInterval(this.checkFPSInterval.bind(this),r.fpsDroppedMonitoringPeriod)}};t.prototype.checkFPS=function(t,e,r){var i=performance.now();if(e){if(this.lastTime){var a=i-this.lastTime;var n=r-this.lastDroppedFrames;var s=e-this.lastDecodedFrames;var o=1e3*n/a;var l=this.hls;l.trigger(h.FPS_DROP,{currentDropped:n,currentDecoded:s,totalDroppedFrames:r});if(o>0){if(n>l.config.fpsDroppedMonitoringThreshold*s){var u=l.currentLevel;A.warn("drop FPS ratio greater than max allowed value for currentLevel: "+u);if(u>0&&(l.autoLevelCapping===-1||l.autoLevelCapping>=u)){u=u-1;l.trigger(h.FPS_DROP_LEVEL_CAPPING,{level:u,droppedLevel:l.currentLevel});l.autoLevelCapping=u;this.streamController.nextLevelSwitch()}}}}this.lastTime=i;this.lastDroppedFrames=r;this.lastDecodedFrames=e}};t.prototype.checkFPSInterval=function(){var t=this.media;if(t){if(this.isVideoPlaybackQualityAvailable){var e=t.getVideoPlaybackQuality();this.checkFPS(t,e.totalVideoFrames,e.droppedVideoFrames)}else{this.checkFPS(t,t.webkitDecodedFrameCount,t.webkitDroppedFrameCount)}}};return t}();var ls="[eme]";var us=function(){function t(e){this.hls=void 0;this.config=void 0;this.media=null;this.keyFormatPromise=null;this.keySystemAccessPromises={};this._requestLicenseFailureCount=0;this.mediaKeySessions=[];this.keyIdToKeySessionPromise={};this.setMediaKeysQueue=t.CDMCleanupPromise?[t.CDMCleanupPromise]:[];this.onMediaEncrypted=this._onMediaEncrypted.bind(this);this.onWaitingForKey=this._onWaitingForKey.bind(this);this.debug=A.debug.bind(A,ls);this.log=A.log.bind(A,ls);this.warn=A.warn.bind(A,ls);this.error=A.error.bind(A,ls);this.hls=e;this.config=e.config;this.registerListeners()}t.prototype.destroy=function(){this.unregisterListeners();this.onMediaDetached();var t=this.config;t.requestMediaKeySystemAccessFunc=null;t.licenseXhrSetup=t.licenseResponseCallback=undefined;t.drmSystems=t.drmSystemOptions={};this.hls=this.onMediaEncrypted=this.onWaitingForKey=this.keyIdToKeySessionPromise=null;this.config=null};t.prototype.registerListeners=function(){this.hls.on(h.MEDIA_ATTACHED,this.onMediaAttached,this);this.hls.on(h.MEDIA_DETACHED,this.onMediaDetached,this);this.hls.on(h.MANIFEST_LOADING,this.onManifestLoading,this);this.hls.on(h.MANIFEST_LOADED,this.onManifestLoaded,this)};t.prototype.unregisterListeners=function(){this.hls.off(h.MEDIA_ATTACHED,this.onMediaAttached,this);this.hls.off(h.MEDIA_DETACHED,this.onMediaDetached,this);this.hls.off(h.MANIFEST_LOADING,this.onManifestLoading,this);this.hls.off(h.MANIFEST_LOADED,this.onManifestLoaded,this)};t.prototype.getLicenseServerUrl=function(t){var e=this.config,r=e.drmSystems,i=e.widevineLicenseUrl;var a=r[t];if(a){return a.licenseUrl}if(t===K.WIDEVINE&&i){return i}throw new Error('no license server URL configured for key-system "'.concat(t,'"'))};t.prototype.getServerCertificateUrl=function(t){var e=this.config.drmSystems;var r=e[t];if(r){return r.serverCertificateUrl}else{this.log('No Server Certificate in config.drmSystems["'.concat(t,'"]'))}};t.prototype.attemptKeySystemAccess=function(t){var e=this;var r=this.hls.levels;var i=function(t,e,r){return!!t&&r.indexOf(t)===e};var a=r.map((function(t){return t.audioCodec})).filter(i);var n=r.map((function(t){return t.videoCodec})).filter(i);if(a.length+n.length===0){n.push("avc1.42e01e")}return new Promise((function(r,i){var s=function(t){var o=t.shift();e.getMediaKeysPromise(o,a,n).then((function(t){return r({keySystem:o,mediaKeys:t})})).catch((function(e){if(t.length){s(t)}else if(e instanceof fs){i(e)}else{i(new fs({type:v.KEY_SYSTEM_ERROR,details:p.KEY_SYSTEM_NO_ACCESS,error:e,fatal:true},e.message))}}))};s(t)}))};t.prototype.requestMediaKeySystemAccess=function(t,e){var r=this.config.requestMediaKeySystemAccessFunc;if(!(typeof r==="function")){var i="Configured requestMediaKeySystemAccess is not a function ".concat(r);if(X===null&&self.location.protocol==="http:"){i="navigator.requestMediaKeySystemAccess is not available over insecure protocol ".concat(location.protocol)}return Promise.reject(new Error(i))}return r(t,e)};t.prototype.getMediaKeysPromise=function(t,e,r){var i=this;var a=z(t,e,r,this.config.drmSystemOptions);var n=this.keySystemAccessPromises[t];var s=n==null?void 0:n.keySystemAccess;if(!s){this.log('Requesting encrypted media "'.concat(t,'" key-system access with config: ').concat(JSON.stringify(a)));s=this.requestMediaKeySystemAccess(t,a);var o=this.keySystemAccessPromises[t]={keySystemAccess:s};s.catch((function(e){i.log('Failed to obtain access to key-system "'.concat(t,'": ').concat(e))}));return s.then((function(e){i.log('Access for key-system "'.concat(e.keySystem,'" obtained'));var r=i.fetchServerCertificate(t);i.log('Create media-keys for "'.concat(t,'"'));o.mediaKeys=e.createMediaKeys().then((function(e){i.log('Media-keys created for "'.concat(t,'"'));return r.then((function(r){if(r){return i.setMediaKeysServerCertificate(e,t,r)}return e}))}));o.mediaKeys.catch((function(e){i.error('Failed to create media-keys for "'.concat(t,'"}: ').concat(e))}));return o.mediaKeys}))}return s.then((function(){return n.mediaKeys}))};t.prototype.createMediaKeySessionContext=function(t){var e=t.decryptdata,r=t.keySystem,i=t.mediaKeys;this.log('Creating key-system session "'.concat(r,'" keyId: ').concat(pt.hexDump(e.keyId||[])));var a=i.createSession();var n={decryptdata:e,keySystem:r,mediaKeys:i,mediaKeysSession:a,keyStatus:"status-pending"};this.mediaKeySessions.push(n);return n};t.prototype.renewKeySession=function(t){var e=t.decryptdata;if(e.pssh){var r=this.createMediaKeySessionContext(t);var i=this.getKeyIdString(e);var a="cenc";this.keyIdToKeySessionPromise[i]=this.generateRequestWithPreferredKeySession(r,a,e.pssh,"expired")}else{this.warn("Could not renew expired session. Missing pssh initData.")}this.removeSession(t)};t.prototype.getKeyIdString=function(t){if(!t){throw new Error("Could not read keyId of undefined decryptdata")}if(t.keyId===null){throw new Error("keyId is null")}return pt.hexDump(t.keyId)};t.prototype.updateKeySession=function(t,e){var r;var i=t.mediaKeysSession;this.log('Updating key-session "'.concat(i.sessionId,'" for keyID ').concat(pt.hexDump(((r=t.decryptdata)==null?void 0:r.keyId)||[]),"\n } (data length: ").concat(e?e.byteLength:e,")"));return i.update(e)};t.prototype.selectKeySystemFormat=function(t){var e=Object.keys(t.levelkeys||{});if(!this.keyFormatPromise){this.log("Selecting key-system from fragment (sn: ".concat(t.sn," ").concat(t.type,": ").concat(t.level,") key formats ").concat(e.join(", ")));this.keyFormatPromise=this.getKeyFormatPromise(e)}return this.keyFormatPromise};t.prototype.getKeyFormatPromise=function(t){var e=this;return new Promise((function(r,i){var a=q(e.config);var n=t.map(V).filter((function(t){return!!t&&a.indexOf(t)!==-1}));return e.getKeySystemSelectionPromise(n).then((function(t){var e=t.keySystem;var a=W(e);if(a){r(a)}else{i(new Error('Unable to find format for key-system "'.concat(e,'"')))}})).catch(i)}))};t.prototype.loadKey=function(t){var e=this;var r=t.keyInfo.decryptdata;var i=this.getKeyIdString(r);var a="(keyId: ".concat(i,' format: "').concat(r.keyFormat,'" method: ').concat(r.method," uri: ").concat(r.uri,")");this.log("Starting session for key ".concat(a));var n=this.keyIdToKeySessionPromise[i];if(!n){n=this.keyIdToKeySessionPromise[i]=this.getKeySystemForKeyPromise(r).then((function(i){var n=i.keySystem,s=i.mediaKeys;e.throwIfDestroyed();e.log("Handle encrypted media sn: ".concat(t.frag.sn," ").concat(t.frag.type,": ").concat(t.frag.level," using key ").concat(a));return e.attemptSetMediaKeys(n,s).then((function(){e.throwIfDestroyed();var t=e.createMediaKeySessionContext({keySystem:n,mediaKeys:s,decryptdata:r});var i="cenc";return e.generateRequestWithPreferredKeySession(t,i,r.pssh,"playlist-key")}))}));n.catch((function(t){return e.handleError(t)}))}return n};t.prototype.throwIfDestroyed=function(t){if(t===void 0){t="Invalid state"}if(!this.hls){throw new Error("invalid state")}};t.prototype.handleError=function(t){if(!this.hls){return}this.error(t.message);if(t instanceof fs){this.hls.trigger(h.ERROR,t.data)}else{this.hls.trigger(h.ERROR,{type:v.KEY_SYSTEM_ERROR,details:p.KEY_SYSTEM_NO_KEYS,error:t,fatal:true})}};t.prototype.getKeySystemForKeyPromise=function(t){var e=this.getKeyIdString(t);var r=this.keyIdToKeySessionPromise[e];if(!r){var i=V(t.keyFormat);var a=i?[i]:q(this.config);return this.attemptKeySystemAccess(a)}return r};t.prototype.getKeySystemSelectionPromise=function(t){if(!t.length){t=q(this.config)}if(t.length===0){throw new fs({type:v.KEY_SYSTEM_ERROR,details:p.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:true},"Missing key-system license configuration options ".concat(JSON.stringify({drmSystems:this.config.drmSystems})))}return this.attemptKeySystemAccess(t)};t.prototype._onMediaEncrypted=function(t){var e=this;var r=t.initDataType,i=t.initData;this.debug('"'.concat(t.type,'" event: init data type: "').concat(r,'"'));if(i===null){return}var a;var n;if(r==="sinf"&&this.config.drmSystems[K.FAIRPLAY]){var s=Tt(new Uint8Array(i));try{var o=M(JSON.parse(s).sinf);var l=kt(new Uint8Array(o));if(!l){return}a=l.subarray(8,24);n=K.FAIRPLAY}catch(t){this.warn('Failed to parse sinf "encrypted" event message initData');return}}else{var u=Vt(i);if(u===null){return}if(u.version===0&&u.systemId===j.WIDEVINE&&u.data){a=u.data.subarray(8,24)}n=Y(u.systemId)}if(!n||!a){return}var f=pt.hexDump(a);var c=this,d=c.keyIdToKeySessionPromise,h=c.mediaKeySessions;var v=d[f];var p=function(t){var n=h[t];var s=n.decryptdata;if(s.pssh||!s.keyId){return"continue"}var o=pt.hexDump(s.keyId);if(f===o||s.uri.replace(/-/g,"").indexOf(f)!==-1){v=d[o];delete d[o];s.pssh=new Uint8Array(i);s.keyId=a;v=d[f]=v.then((function(){return e.generateRequestWithPreferredKeySession(n,r,i,"encrypted-event-key-match")}));return"break"}};for(var g=0;g<h.length;g++){var m=p(g);if(m==="break")break}if(!v){v=d[f]=this.getKeySystemSelectionPromise([n]).then((function(t){var n=t.keySystem,s=t.mediaKeys;var o;e.throwIfDestroyed();var l=new Yt("ISO-23001-7",f,(o=W(n))!=null?o:"");l.pssh=new Uint8Array(i);l.keyId=a;return e.attemptSetMediaKeys(n,s).then((function(){e.throwIfDestroyed();var t=e.createMediaKeySessionContext({decryptdata:l,keySystem:n,mediaKeys:s});return e.generateRequestWithPreferredKeySession(t,r,i,"encrypted-event-no-match")}))}))}v.catch((function(t){return e.handleError(t)}))};t.prototype._onWaitingForKey=function(t){this.log('"'.concat(t.type,'" event'))};t.prototype.attemptSetMediaKeys=function(t,e){var r=this;var i=this.setMediaKeysQueue.slice();this.log('Setting media-keys for "'.concat(t,'"'));var a=Promise.all(i).then((function(){if(!r.media){throw new Error("Attempted to set mediaKeys without media element attached")}return r.media.setMediaKeys(e)}));this.setMediaKeysQueue.push(a);return a.then((function(){r.log('Media-keys set for "'.concat(t,'"'));i.push(a);r.setMediaKeysQueue=r.setMediaKeysQueue.filter((function(t){return i.indexOf(t)===-1}))}))};t.prototype.generateRequestWithPreferredKeySession=function(t,e,r,i){var a=this;var n,s;var o=(n=this.config.drmSystems)==null?void 0:(s=n[t.keySystem])==null?void 0:s.generateRequest;if(o){try{var l=o.call(this.hls,e,r,t);if(!l){throw new Error("Invalid response from configured generateRequest filter")}e=l.initDataType;r=t.decryptdata.pssh=l.initData?new Uint8Array(l.initData):null}catch(t){var u;this.warn(t.message);if((u=this.hls)!=null&&u.config.debug){throw t}}}if(r===null){this.log('Skipping key-session request for "'.concat(i,'" (no initData)'));return Promise.resolve(t)}var f=this.getKeyIdString(t.decryptdata);this.log('Generating key-session request for "'.concat(i,'": ').concat(f," (init data type: ").concat(e," length: ").concat(r?r.byteLength:null,")"));var c=new Da;t.mediaKeysSession.onmessage=function(e){var r=t.mediaKeysSession;if(!r){c.emit("error",new Error("invalid state"));return}var i=e.messageType,n=e.message;a.log('"'.concat(i,'" message event for session "').concat(r.sessionId,'" message size: ').concat(n.byteLength));if(i==="license-request"||i==="license-renewal"){a.renewLicense(t,n).catch((function(t){a.handleError(t);c.emit("error",t)}))}else if(i==="license-release"){if(t.keySystem===K.FAIRPLAY){a.updateKeySession(t,G("acknowledged"));a.removeSession(t)}}else{a.warn('unhandled media key message type "'.concat(i,'"'))}};t.mediaKeysSession.onkeystatuseschange=function(e){var r=t.mediaKeysSession;if(!r){c.emit("error",new Error("invalid state"));return}a.onKeyStatusChange(t);var i=t.keyStatus;c.emit("keyStatus",i);if(i==="expired"){a.warn("".concat(t.keySystem," expired for key ").concat(f));a.renewKeySession(t)}};var d=new Promise((function(t,e){c.on("error",e);c.on("keyStatus",(function(r){if(r.startsWith("usable")){t()}else if(r==="output-restricted"){e(new fs({type:v.KEY_SYSTEM_ERROR,details:p.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:false},"HDCP level output restricted"))}else if(r==="internal-error"){e(new fs({type:v.KEY_SYSTEM_ERROR,details:p.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:true},'key status changed to "'.concat(r,'"')))}else if(r==="expired"){e(new Error("key expired while generating request"))}else{a.warn('unhandled key status change "'.concat(r,'"'))}}))}));return t.mediaKeysSession.generateRequest(e,r).then((function(){var e;a.log('Request generated for key-session "'.concat((e=t.mediaKeysSession)==null?void 0:e.sessionId,'" keyId: ').concat(f))})).catch((function(t){throw new fs({type:v.KEY_SYSTEM_ERROR,details:p.KEY_SYSTEM_NO_SESSION,error:t,fatal:false},"Error generating key-session request: ".concat(t))})).then((function(){return d})).catch((function(e){c.removeAllListeners();a.removeSession(t);throw e})).then((function(){c.removeAllListeners();return t}))};t.prototype.onKeyStatusChange=function(t){var e=this;t.mediaKeysSession.keyStatuses.forEach((function(r,i){e.log('key status change "'.concat(r,'" for keyStatuses keyId: ').concat(pt.hexDump("buffer"in i?new Uint8Array(i.buffer,i.byteOffset,i.byteLength):new Uint8Array(i))," session keyId: ").concat(pt.hexDump(new Uint8Array(t.decryptdata.keyId||[]))," uri: ").concat(t.decryptdata.uri));t.keyStatus=r}))};t.prototype.fetchServerCertificate=function(t){var e=this.config;var r=e.loader;var i=new r(e);var a=this.getServerCertificateUrl(t);if(!a){return Promise.resolve()}this.log('Fetching serverCertificate for "'.concat(t,'"'));return new Promise((function(r,s){var o={responseType:"arraybuffer",url:a};var l=e.certLoadPolicy.default;var u={loadPolicy:l,timeout:l.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0};var f={onSuccess:function(t,e,i,a){r(t.data)},onError:function(e,r,i,l){s(new fs({type:v.KEY_SYSTEM_ERROR,details:p.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:true,networkDetails:i,response:n({url:o.url,data:undefined},e)},'"'.concat(t,'" certificate request failed (').concat(a,"). Status: ").concat(e.code," (").concat(e.text,")")))},onTimeout:function(e,r,i){s(new fs({type:v.KEY_SYSTEM_ERROR,details:p.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:true,networkDetails:i,response:{url:o.url,data:undefined}},'"'.concat(t,'" certificate request timed out (').concat(a,")")))},onAbort:function(t,e,r){s(new Error("aborted"))}};i.load(o,u,f)}))};t.prototype.setMediaKeysServerCertificate=function(t,e,r){var i=this;return new Promise((function(a,n){t.setServerCertificate(r).then((function(n){i.log("setServerCertificate ".concat(n?"success":"not supported by CDM"," (").concat(r==null?void 0:r.byteLength,') on "').concat(e,'"'));a(t)})).catch((function(t){n(new fs({type:v.KEY_SYSTEM_ERROR,details:p.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:t,fatal:true},t.message))}))}))};t.prototype.renewLicense=function(t,e){var r=this;return this.requestLicense(t,new Uint8Array(e)).then((function(e){return r.updateKeySession(t,new Uint8Array(e)).catch((function(t){throw new fs({type:v.KEY_SYSTEM_ERROR,details:p.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:t,fatal:true},t.message)}))}))};t.prototype.setupLicenseXHR=function(t,e,r,i){var a=this;var n=this.config.licenseXhrSetup;if(!n){t.open("POST",e,true);return Promise.resolve({xhr:t,licenseChallenge:i})}return Promise.resolve().then((function(){if(!r.decryptdata){throw new Error("Key removed")}return n.call(a.hls,t,e,r,i)})).catch((function(s){if(!r.decryptdata){throw s}t.open("POST",e,true);return n.call(a.hls,t,e,r,i)})).then((function(r){if(!t.readyState){t.open("POST",e,true)}var a=r?r:i;return{xhr:t,licenseChallenge:a}}))};t.prototype.requestLicense=function(t,e){var r=this;var i=this.config.keyLoadPolicy.default;return new Promise((function(a,n){var s=r.getLicenseServerUrl(t.keySystem);r.log("Sending license request to URL: ".concat(s));var o=new XMLHttpRequest;o.responseType="arraybuffer";o.onreadystatechange=function(){if(!r.hls||!t.mediaKeysSession){return n(new Error("invalid state"))}if(o.readyState===4){if(o.status===200){r._requestLicenseFailureCount=0;var l=o.response;r.log("License received ".concat(l instanceof ArrayBuffer?l.byteLength:l));var u=r.config.licenseResponseCallback;if(u){try{l=u.call(r.hls,o,s,t)}catch(t){r.error(t)}}a(l)}else{var f=i.errorRetry;var c=f?f.maxNumRetry:0;r._requestLicenseFailureCount++;if(r._requestLicenseFailureCount>c||o.status>=400&&o.status<500){n(new fs({type:v.KEY_SYSTEM_ERROR,details:p.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:true,networkDetails:o,response:{url:s,data:undefined,code:o.status,text:o.statusText}},"License Request XHR failed (".concat(s,"). Status: ").concat(o.status," (").concat(o.statusText,")")))}else{var d=c-r._requestLicenseFailureCount+1;r.warn("Retrying license request, ".concat(d," attempts left"));r.requestLicense(t,e).then(a,n)}}}};if(t.licenseXhr&&t.licenseXhr.readyState!==XMLHttpRequest.DONE){t.licenseXhr.abort()}t.licenseXhr=o;r.setupLicenseXHR(o,s,t,e).then((function(t){var e=t.xhr,r=t.licenseChallenge;e.send(r)}))}))};t.prototype.onMediaAttached=function(t,e){if(!this.config.emeEnabled){return}var r=e.media;this.media=r;r.addEventListener("encrypted",this.onMediaEncrypted);r.addEventListener("waitingforkey",this.onWaitingForKey)};t.prototype.onMediaDetached=function(){var e=this;var r=this.media;var i=this.mediaKeySessions;if(r){r.removeEventListener("encrypted",this.onMediaEncrypted);r.removeEventListener("waitingforkey",this.onWaitingForKey);this.media=null}this._requestLicenseFailureCount=0;this.setMediaKeysQueue=[];this.mediaKeySessions=[];this.keyIdToKeySessionPromise={};Yt.clearKeyUriToKeyIdMap();var a=i.length;t.CDMCleanupPromise=Promise.all(i.map((function(t){return e.removeSession(t)})).concat(r==null?void 0:r.setMediaKeys(null).catch((function(t){e.log("Could not clear media keys: ".concat(t,". media.src: ").concat(r==null?void 0:r.src))})))).then((function(){if(a){e.log("finished closing key sessions and clearing media keys");i.length=0}})).catch((function(t){e.log("Could not close sessions and clear media keys: ".concat(t,". media.src: ").concat(r==null?void 0:r.src))}))};t.prototype.onManifestLoading=function(){this.keyFormatPromise=null};t.prototype.onManifestLoaded=function(t,e){var r=e.sessionKeys;if(!r||!this.config.emeEnabled){return}if(!this.keyFormatPromise){var i=r.reduce((function(t,e){if(t.indexOf(e.keyFormat)===-1){t.push(e.keyFormat)}return t}),[]);this.log("Selecting key-system from session-keys ".concat(i.join(", ")));this.keyFormatPromise=this.getKeyFormatPromise(i)}};t.prototype.removeSession=function(t){var e=this;var r=t.mediaKeysSession,i=t.licenseXhr;if(r){this.log("Remove licenses and keys and close session ".concat(r.sessionId));r.onmessage=null;r.onkeystatuseschange=null;if(i&&i.readyState!==XMLHttpRequest.DONE){i.abort()}t.mediaKeysSession=t.decryptdata=t.licenseXhr=undefined;var a=this.mediaKeySessions.indexOf(t);if(a>-1){this.mediaKeySessions.splice(a,1)}return r.remove().catch((function(t){e.log("Could not remove session: ".concat(t))})).then((function(){return r.close()})).catch((function(t){e.log("Could not close session: ".concat(t))}))}};return t}();us.CDMCleanupPromise=void 0;var fs=function(t){__extends(e,t);function e(e,r){var i=t.call(this,r)||this;i.data=void 0;e.error||(e.error=new Error(r));i.data=e;e.err=e.error;return i}return e}(Error);var cs=1;var ds={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",KEY:"k",OTHER:"o"};var hs="h";var vs=function(){function t(e){var r=this;this.hls=void 0;this.config=void 0;this.media=void 0;this.sid=void 0;this.cid=void 0;this.useHeaders=false;this.initialized=false;this.starved=false;this.buffering=true;this.audioBuffer=void 0;this.videoBuffer=void 0;this.onWaiting=function(){if(r.initialized){r.starved=true}r.buffering=true};this.onPlaying=function(){if(!r.initialized){r.initialized=true}r.buffering=false};this.applyPlaylistData=function(t){try{r.apply(t,{ot:ds.MANIFEST,su:!r.initialized})}catch(t){A.warn("Could not generate manifest CMCD data.",t)}};this.applyFragmentData=function(t){try{var e=t.frag;var i=r.hls.levels[e.level];var a=r.getObjectType(e);var n={d:e.duration*1e3,ot:a};if(a===ds.VIDEO||a===ds.AUDIO||a==ds.MUXED){n.br=i.bitrate/1e3;n.tb=r.getTopBandwidth(a)/1e3;n.bl=r.getBufferLength(a)}r.apply(t,n)}catch(t){A.warn("Could not generate segment CMCD data.",t)}};this.hls=e;var i=this.config=e.config;var a=i.cmcd;if(a!=null){i.pLoader=this.createPlaylistLoader();i.fLoader=this.createFragmentLoader();this.sid=a.sessionId||t.uuid();this.cid=a.contentId;this.useHeaders=a.useHeaders===true;this.registerListeners()}}t.prototype.registerListeners=function(){var t=this.hls;t.on(h.MEDIA_ATTACHED,this.onMediaAttached,this);t.on(h.MEDIA_DETACHED,this.onMediaDetached,this);t.on(h.BUFFER_CREATED,this.onBufferCreated,this)};t.prototype.unregisterListeners=function(){var t=this.hls;t.off(h.MEDIA_ATTACHED,this.onMediaAttached,this);t.off(h.MEDIA_DETACHED,this.onMediaDetached,this);t.off(h.BUFFER_CREATED,this.onBufferCreated,this)};t.prototype.destroy=function(){this.unregisterListeners();this.onMediaDetached();this.hls=this.config=this.audioBuffer=this.videoBuffer=null};t.prototype.onMediaAttached=function(t,e){this.media=e.media;this.media.addEventListener("waiting",this.onWaiting);this.media.addEventListener("playing",this.onPlaying)};t.prototype.onMediaDetached=function(){if(!this.media){return}this.media.removeEventListener("waiting",this.onWaiting);this.media.removeEventListener("playing",this.onPlaying);this.media=null};t.prototype.onBufferCreated=function(t,e){var r,i;this.audioBuffer=(r=e.tracks.audio)==null?void 0:r.buffer;this.videoBuffer=(i=e.tracks.video)==null?void 0:i.buffer};t.prototype.createData=function(){var t;return{v:cs,sf:hs,sid:this.sid,cid:this.cid,pr:(t=this.media)==null?void 0:t.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}};t.prototype.apply=function(e,r){if(r===void 0){r={}}o(r,this.createData());var i=r.ot===ds.INIT||r.ot===ds.VIDEO||r.ot===ds.MUXED;if(this.starved&&i){r.bs=true;r.su=true;this.starved=false}if(r.su==null){r.su=this.buffering}if(this.useHeaders){var a=t.toHeaders(r);if(!Object.keys(a).length){return}if(!e.headers){e.headers={}}o(e.headers,a)}else{var n=t.toQuery(r);if(!n){return}e.url=t.appendQueryToUri(e.url,n)}};t.prototype.getObjectType=function(t){var e=t.type;if(e==="subtitle"){return ds.TIMED_TEXT}if(t.sn==="initSegment"){return ds.INIT}if(e==="audio"){return ds.AUDIO}if(e==="main"){if(!this.hls.audioTracks.length){return ds.MUXED}return ds.VIDEO}return undefined};t.prototype.getTopBandwidth=function(t){var e=0;var r;var i=this.hls;if(t===ds.AUDIO){r=i.audioTracks}else{var a=i.maxAutoLevel;var n=a>-1?a+1:i.levels.length;r=i.levels.slice(0,n)}for(var s=0,o=r;s<o.length;s++){var l=o[s];if(l.bitrate>e){e=l.bitrate}}return e>0?e:NaN};t.prototype.getBufferLength=function(t){var e=this.hls.media;var r=t===ds.AUDIO?this.audioBuffer:this.videoBuffer;if(!r||!e){return NaN}var i=Fr.bufferInfo(r,e.currentTime,this.config.maxBufferHole);return i.len*1e3};t.prototype.createPlaylistLoader=function(){var t=this.config.pLoader;var e=this.applyPlaylistData;var r=t||this.config.loader;return function(){function t(t){this.loader=void 0;this.loader=new r(t)}Object.defineProperty(t.prototype,"stats",{get:function(){return this.loader.stats},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"context",{get:function(){return this.loader.context},enumerable:false,configurable:true});t.prototype.destroy=function(){this.loader.destroy()};t.prototype.abort=function(){this.loader.abort()};t.prototype.load=function(t,r,i){e(t);this.loader.load(t,r,i)};return t}()};t.prototype.createFragmentLoader=function(){var t=this.config.fLoader;var e=this.applyFragmentData;var r=t||this.config.loader;return function(){function t(t){this.loader=void 0;this.loader=new r(t)}Object.defineProperty(t.prototype,"stats",{get:function(){return this.loader.stats},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"context",{get:function(){return this.loader.context},enumerable:false,configurable:true});t.prototype.destroy=function(){this.loader.destroy()};t.prototype.abort=function(){this.loader.abort()};t.prototype.load=function(t,r,i){e(t);this.loader.load(t,r,i)};return t}()};t.uuid=function(){var t=URL.createObjectURL(new Blob);var e=t.toString();URL.revokeObjectURL(t);return e.slice(e.lastIndexOf("/")+1)};t.serialize=function(t){var e=[];var r=function(t){return!Number.isNaN(t)&&t!=null&&t!==""&&t!==false};var i=function(t){return Math.round(t)};var a=function(t){return i(t/100)*100};var n=function(t){return encodeURIComponent(t)};var s={br:i,d:i,bl:a,dl:a,mtp:a,nor:n,rtp:a,tb:i};var o=Object.keys(t||{}).sort();for(var l=0,u=o;l<u.length;l++){var f=u[l];var c=t[f];if(!r(c)){continue}if(f==="v"&&c===1){continue}if(f=="pr"&&c===1){continue}var d=s[f];if(d){c=d(c)}var h=typeof c;var v=void 0;if(f==="ot"||f==="sf"||f==="st"){v="".concat(f,"=").concat(c)}else if(h==="boolean"){v=f}else if(h==="number"){v="".concat(f,"=").concat(c)}else{v="".concat(f,"=").concat(JSON.stringify(c))}e.push(v)}return e.join(",")};t.toHeaders=function(e){var r=Object.keys(e);var i={};var a=["Object","Request","Session","Status"];var n=[{},{},{},{}];var s={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3};for(var o=0,l=r;o<l.length;o++){var u=l[o];var f=s[u]!=null?s[u]:1;n[f][u]=e[u]}for(var c=0;c<n.length;c++){var d=t.serialize(n[c]);if(d){i["CMCD-".concat(a[c])]=d}}return i};t.toQuery=function(e){return"CMCD=".concat(encodeURIComponent(t.serialize(e)))};t.appendQueryToUri=function(t,e){if(!e){return t}var r=t.includes("?")?"&":"?";return"".concat(t).concat(r).concat(e)};return t}();var ps=3e5;var gs=function(){function t(t){this.hls=void 0;this.log=void 0;this.loader=null;this.uri=null;this.pathwayId=".";this.pathwayPriority=null;this.timeToLoad=300;this.reloadTimer=-1;this.updated=0;this.started=false;this.enabled=true;this.levels=null;this.audioTracks=null;this.subtitleTracks=null;this.penalizedPathways={};this.hls=t;this.log=A.log.bind(A,"[content-steering]:");this.registerListeners()}t.prototype.registerListeners=function(){var t=this.hls;t.on(h.MANIFEST_LOADING,this.onManifestLoading,this);t.on(h.MANIFEST_LOADED,this.onManifestLoaded,this);t.on(h.MANIFEST_PARSED,this.onManifestParsed,this);t.on(h.ERROR,this.onError,this)};t.prototype.unregisterListeners=function(){var t=this.hls;if(!t){return}t.off(h.MANIFEST_LOADING,this.onManifestLoading,this);t.off(h.MANIFEST_LOADED,this.onManifestLoaded,this);t.off(h.MANIFEST_PARSED,this.onManifestParsed,this);t.off(h.ERROR,this.onError,this)};t.prototype.startLoad=function(){this.started=true;self.clearTimeout(this.reloadTimer);if(this.enabled&&this.uri){if(this.updated){var t=Math.max(this.timeToLoad*1e3-(performance.now()-this.updated),0);this.scheduleRefresh(this.uri,t)}else{this.loadSteeringManifest(this.uri)}}};t.prototype.stopLoad=function(){this.started=false;if(this.loader){this.loader.destroy();this.loader=null}self.clearTimeout(this.reloadTimer)};t.prototype.destroy=function(){this.unregisterListeners();this.stopLoad();this.hls=null;this.levels=this.audioTracks=this.subtitleTracks=null};t.prototype.removeLevel=function(t){var e=this.levels;if(e){this.levels=e.filter((function(e){return e!==t}))}};t.prototype.onManifestLoading=function(){this.stopLoad();this.enabled=true;this.timeToLoad=300;this.updated=0;this.uri=null;this.pathwayId=".";this.levels=this.audioTracks=this.subtitleTracks=null};t.prototype.onManifestLoaded=function(t,e){var r=e.contentSteering;if(r===null){return}this.pathwayId=r.pathwayId;this.uri=r.uri;if(this.started){this.startLoad()}};t.prototype.onManifestParsed=function(t,e){this.audioTracks=e.audioTracks;this.subtitleTracks=e.subtitleTracks};t.prototype.onError=function(t,e){var r=e.errorAction;if((r==null?void 0:r.action)===vr.SendAlternateToPenaltyBox&&r.flags===pr.MoveAllAlternatesMatchingHost){var i=this.pathwayPriority;var a=this.pathwayId;if(!this.penalizedPathways[a]){this.penalizedPathways[a]=performance.now()}if(!i&&this.levels){i=this.levels.reduce((function(t,e){if(t.indexOf(e.pathwayId)===-1){t.push(e.pathwayId)}return t}),[])}if(i&&i.length>1){this.updatePathwayPriority(i);r.resolved=this.pathwayId!==a}}};t.prototype.filterParsedLevels=function(t){this.levels=t;var e=this.getLevelsForPathway(this.pathwayId);if(e.length===0){var r=t[0].pathwayId;this.log("No levels found in Pathway ".concat(this.pathwayId,'. Setting initial Pathway to "').concat(r,'"'));e=this.getLevelsForPathway(r);this.pathwayId=r}if(e.length!==t.length){this.log("Found ".concat(e.length,"/").concat(t.length,' levels in Pathway "').concat(this.pathwayId,'"'));return e}return t};t.prototype.getLevelsForPathway=function(t){if(this.levels===null){return[]}return this.levels.filter((function(e){return t===e.pathwayId}))};t.prototype.updatePathwayPriority=function(t){this.pathwayPriority=t;var e;var r=this.penalizedPathways;var i=performance.now();Object.keys(r).forEach((function(t){if(i-r[t]>ps){delete r[t]}}));for(var a=0;a<t.length;a++){var n=t[a];if(r[n]){continue}if(n===this.pathwayId){return}var s=this.hls.nextLoadLevel;var o=this.hls.levels[s];e=this.getLevelsForPathway(n);if(e.length>0){this.log('Setting Pathway to "'.concat(n,'"'));this.pathwayId=n;this.hls.trigger(h.LEVELS_UPDATED,{levels:e});var l=this.hls.levels[s];if(o&&l&&this.levels){if(l.attrs["STABLE-VARIANT-ID"]!==o.attrs["STABLE-VARIANT-ID"]&&l.bitrate!==o.bitrate){this.log("Unstable Pathways change from bitrate ".concat(o.bitrate," to ").concat(l.bitrate))}this.hls.nextLoadLevel=s}break}}};t.prototype.clonePathways=function(t){var e=this;var r=this.levels;if(!r){return}var i={};var a={};t.forEach((function(t){var n=t.ID,s=t["BASE-ID"],l=t["URI-REPLACEMENT"];if(r.some((function(t){return t.pathwayId===n}))){return}var u=e.getLevelsForPathway(s).map((function(t){var e=o({},t);e.details=undefined;e.url=ys(t.uri,t.attrs["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",l);var r=new R(t.attrs);r["PATHWAY-ID"]=n;var s=r.AUDIO&&"".concat(r.AUDIO,"_clone_").concat(n);var u=r.SUBTITLES&&"".concat(r.SUBTITLES,"_clone_").concat(n);if(s){i[r.AUDIO]=s;r.AUDIO=s}if(u){a[r.SUBTITLES]=u;r.SUBTITLES=u}e.attrs=r;var f=new He(e);Sr(f,"audio",s);Sr(f,"text",u);return f}));r.push.apply(r,u);ms(e.audioTracks,i,l,n);ms(e.subtitleTracks,a,l,n)}))};t.prototype.loadSteeringManifest=function(t){var e=this;var r=this.hls.config;var i=r.loader;if(this.loader){this.loader.destroy()}this.loader=new i(r);var a;try{a=new self.URL(t)}catch(e){this.enabled=false;this.log("Failed to parse Steering Manifest URI: ".concat(t));return}if(a.protocol!=="data:"){var n=(this.hls.bandwidthEstimate||r.abrEwmaDefaultEstimate)|0;a.searchParams.set("_HLS_pathway",this.pathwayId);a.searchParams.set("_HLS_throughput",""+n)}var s={responseType:"json",url:a.href};var o=r.steeringManifestLoadPolicy.default;var l=o.errorRetry||o.timeoutRetry||{};var u={loadPolicy:o,timeout:o.maxLoadTimeMs,maxRetry:l.maxNumRetry||0,retryDelay:l.retryDelayMs||0,maxRetryDelay:l.maxRetryDelayMs||0};var f={onSuccess:function(t,r,i,n){e.log('Loaded steering manifest: "'.concat(a,'"'));var s=t.data;if(s.VERSION!==1){e.log("Steering VERSION ".concat(s.VERSION," not supported!"));return}e.updated=performance.now();e.timeToLoad=s.TTL;var o=s["RELOAD-URI"],l=s["PATHWAY-CLONES"],u=s["PATHWAY-PRIORITY"];if(o){try{e.uri=new self.URL(o,a).href}catch(t){e.enabled=false;e.log("Failed to parse Steering Manifest RELOAD-URI: ".concat(o));return}}e.scheduleRefresh(e.uri||i.url);if(l){e.clonePathways(l)}if(u){e.updatePathwayPriority(u)}},onError:function(t,r,i,a){e.log("Error loading steering manifest: ".concat(t.code," ").concat(t.text," (").concat(r.url,")"));e.stopLoad();if(t.code===410){e.enabled=false;e.log("Steering manifest ".concat(r.url," no longer available"));return}var n=e.timeToLoad*1e3;if(t.code===429){var s=e.loader;if(typeof(s==null?void 0:s.getResponseHeader)==="function"){var o=s.getResponseHeader("Retry-After");if(o){n=parseFloat(o)*1e3}}e.log("Steering manifest ".concat(r.url," rate limited"));return}e.scheduleRefresh(e.uri||r.url,n)},onTimeout:function(t,r,i){e.log("Timeout loading steering manifest (".concat(r.url,")"));e.scheduleRefresh(e.uri||r.url)}};this.log("Requesting steering manifest: ".concat(a));this.loader.load(s,u,f)};t.prototype.scheduleRefresh=function(t,e){var r=this;if(e===void 0){e=this.timeToLoad*1e3}self.clearTimeout(this.reloadTimer);this.reloadTimer=self.setTimeout((function(){r.loadSteeringManifest(t)}),e)};return t}();function ms(t,e,r,i){if(!t){return}Object.keys(e).forEach((function(a){var n=t.filter((function(t){return t.groupId===a})).map((function(t){var n=o({},t);n.details=undefined;n.attrs=new R(n.attrs);n.url=n.attrs.URI=ys(t.url,t.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",r);n.groupId=n.attrs["GROUP-ID"]=e[a];n.attrs["PATHWAY-ID"]=i;return n}));t.push.apply(t,n)}))}function ys(t,e,r,i){var a=i,n=a.HOST,s=a.PARAMS,o=r,l=a[o];var u;if(e){u=l==null?void 0:l[e];if(u){t=u}}var f=new self.URL(t);if(n&&!u){f.host=n}if(s){Object.keys(s).sort().forEach((function(t){if(t){f.searchParams.set(t,s[t])}}))}return f.href}var Ts=/^age:\s*[\d.]+\s*$/im;var Es=function(){function t(t){this.xhrSetup=void 0;this.requestTimeout=void 0;this.retryTimeout=void 0;this.retryDelay=void 0;this.config=null;this.callbacks=null;this.context=void 0;this.loader=null;this.stats=void 0;this.xhrSetup=t?t.xhrSetup||null:null;this.stats=new _;this.retryDelay=0}t.prototype.destroy=function(){this.callbacks=null;this.abortInternal();this.loader=null;this.config=null};t.prototype.abortInternal=function(){var t=this.loader;self.clearTimeout(this.requestTimeout);self.clearTimeout(this.retryTimeout);if(t){t.onreadystatechange=null;t.onprogress=null;if(t.readyState!==4){this.stats.aborted=true;t.abort()}}};t.prototype.abort=function(){var t;this.abortInternal();if((t=this.callbacks)!=null&&t.onAbort){this.callbacks.onAbort(this.stats,this.context,this.loader)}};t.prototype.load=function(t,e,r){if(this.stats.loading.start){throw new Error("Loader can only be used once.")}this.stats.loading.start=self.performance.now();this.context=t;this.config=e;this.callbacks=r;this.loadInternal()};t.prototype.loadInternal=function(){var t=this;var e=this,r=e.config,i=e.context;if(!r){return}var a=this.loader=new self.XMLHttpRequest;var n=this.stats;n.loading.first=0;n.loaded=0;n.aborted=false;var s=this.xhrSetup;if(s){Promise.resolve().then((function(){if(t.stats.aborted)return;return s(a,i.url)})).catch((function(t){a.open("GET",i.url,true);return s(a,i.url)})).then((function(){if(t.stats.aborted)return;t.openAndSendXhr(a,i,r)})).catch((function(e){t.callbacks.onError({code:a.status,text:e.message},i,a,n);return}))}else{this.openAndSendXhr(a,i,r)}};t.prototype.openAndSendXhr=function(t,e,r){if(!t.readyState){t.open("GET",e.url,true)}var i=this.context.headers;var a=r.loadPolicy,n=a.maxTimeToFirstByteMs,s=a.maxLoadTimeMs;if(i){for(var o in i){t.setRequestHeader(o,i[o])}}if(e.rangeEnd){t.setRequestHeader("Range","bytes="+e.rangeStart+"-"+(e.rangeEnd-1))}t.onreadystatechange=this.readystatechange.bind(this);t.onprogress=this.loadprogress.bind(this);t.responseType=e.responseType;self.clearTimeout(this.requestTimeout);r.timeout=n&&f(n)?n:s;this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),r.timeout);t.send()};t.prototype.readystatechange=function(){var t=this,e=t.context,r=t.loader,i=t.stats;if(!e||!r){return}var a=r.readyState;var n=this.config;if(i.aborted){return}if(a>=2){if(i.loading.first===0){i.loading.first=Math.max(self.performance.now(),i.loading.start);if(n.timeout!==n.loadPolicy.maxLoadTimeMs){self.clearTimeout(this.requestTimeout);n.timeout=n.loadPolicy.maxLoadTimeMs;this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),n.loadPolicy.maxLoadTimeMs-(i.loading.first-i.loading.start))}}if(a===4){self.clearTimeout(this.requestTimeout);r.onreadystatechange=null;r.onprogress=null;var s=r.status;var o=r.responseType!=="text";if(s>=200&&s<300&&(o&&r.response||r.responseText!==null)){i.loading.end=Math.max(self.performance.now(),i.loading.first);var l=o?r.response:r.responseText;var u=r.responseType==="arraybuffer"?l.byteLength:l.length;i.loaded=i.total=u;i.bwEstimate=i.total*8e3/(i.loading.end-i.loading.first);if(!this.callbacks){return}var f=this.callbacks.onProgress;if(f){f(i,e,l,r)}if(!this.callbacks){return}var c={url:r.responseURL,data:l,code:s};this.callbacks.onSuccess(c,i,e,r)}else{var d=n.loadPolicy.errorRetry;var h=i.retry;if(nr(d,h,false,s)){this.retry(d)}else{A.error("".concat(s," while loading ").concat(e.url));this.callbacks.onError({code:s,text:r.statusText},e,r,i)}}}}};t.prototype.loadtimeout=function(){var t;var e=(t=this.config)==null?void 0:t.loadPolicy.timeoutRetry;var r=this.stats.retry;if(nr(e,r,true)){this.retry(e)}else{A.warn("timeout while loading ".concat(this.context.url));var i=this.callbacks;if(i){this.abortInternal();i.onTimeout(this.stats,this.context,this.loader)}}};t.prototype.retry=function(t){var e=this,r=e.context,i=e.stats;this.retryDelay=ir(t,i.retry);i.retry++;A.warn("".concat(status?"HTTP Status "+status:"Timeout"," while loading ").concat(r.url,", retrying ").concat(i.retry,"/").concat(t.maxNumRetry," in ").concat(this.retryDelay,"ms"));this.abortInternal();this.loader=null;self.clearTimeout(this.retryTimeout);this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)};t.prototype.loadprogress=function(t){var e=this.stats;e.loaded=t.loaded;if(t.lengthComputable){e.total=t.total}};t.prototype.getCacheAge=function(){var t=null;if(this.loader&&Ts.test(this.loader.getAllResponseHeaders())){var e=this.loader.getResponseHeader("age");t=e?parseFloat(e):null}return t};t.prototype.getResponseHeader=function(t){if(this.loader&&new RegExp("^".concat(t,":\\s*[\\d.]+\\s*$"),"im").test(this.loader.getAllResponseHeaders())){return this.loader.getResponseHeader(t)}return null};return t}();function Ss(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request){try{new self.ReadableStream({});return true}catch(t){}}return false}var As=/(\d+)-(\d+)\/(\d+)/;var Ls=function(){function t(t){this.fetchSetup=void 0;this.requestTimeout=void 0;this.request=void 0;this.response=void 0;this.controller=void 0;this.context=void 0;this.config=null;this.callbacks=null;this.stats=void 0;this.loader=null;this.fetchSetup=t.fetchSetup||Ds;this.controller=new self.AbortController;this.stats=new _}t.prototype.destroy=function(){this.loader=this.callbacks=null;this.abortInternal()};t.prototype.abortInternal=function(){var t=this.response;if(!(t!=null&&t.ok)){this.stats.aborted=true;this.controller.abort()}};t.prototype.abort=function(){var t;this.abortInternal();if((t=this.callbacks)!=null&&t.onAbort){this.callbacks.onAbort(this.stats,this.context,this.response)}};t.prototype.load=function(t,e,r){var i=this;var a=this.stats;if(a.loading.start){throw new Error("Loader can only be used once.")}a.loading.start=self.performance.now();var n=bs(t,this.controller.signal);var s=r.onProgress;var o=t.responseType==="arraybuffer";var l=o?"byteLength":"length";var u=e.loadPolicy,c=u.maxTimeToFirstByteMs,d=u.maxLoadTimeMs;this.context=t;this.config=e;this.callbacks=r;this.request=this.fetchSetup(t,n);self.clearTimeout(this.requestTimeout);e.timeout=c&&f(c)?c:d;this.requestTimeout=self.setTimeout((function(){i.abortInternal();r.onTimeout(a,t,i.response)}),e.timeout);self.fetch(this.request).then((function(n){i.response=i.loader=n;var l=Math.max(self.performance.now(),a.loading.start);self.clearTimeout(i.requestTimeout);e.timeout=d;i.requestTimeout=self.setTimeout((function(){i.abortInternal();r.onTimeout(a,t,i.response)}),d-(l-a.loading.start));if(!n.ok){var u=n.status,c=n.statusText;throw new ks(c||"fetch, bad network response",u,n)}a.loading.first=l;a.total=Is(n.headers)||a.total;if(s&&f(e.highWaterMark)){return i.loadProgressively(n,a,t,e.highWaterMark,s)}if(o){return n.arrayBuffer()}if(t.responseType==="json"){return n.json()}return n.text()})).then((function(n){var o=i.response;self.clearTimeout(i.requestTimeout);a.loading.end=Math.max(self.performance.now(),a.loading.first);var u=n[l];if(u){a.loaded=a.total=u}var c={url:o.url,data:n,code:o.status};if(s&&!f(e.highWaterMark)){s(a,t,n,o)}r.onSuccess(c,a,t,o)})).catch((function(e){self.clearTimeout(i.requestTimeout);if(a.aborted){return}var n=!e?0:e.code||0;var s=!e?null:e.message;r.onError({code:n,text:s},t,e?e.details:null,a)}))};t.prototype.getCacheAge=function(){var t=null;if(this.response){var e=this.response.headers.get("age");t=e?parseFloat(e):null}return t};t.prototype.getResponseHeader=function(t){return this.response?this.response.headers.get(t):null};t.prototype.loadProgressively=function(t,e,r,i,a){if(i===void 0){i=0}var n=new Ga;var s=t.body.getReader();var o=function(){return s.read().then((function(s){if(s.done){if(n.dataLength){a(e,r,n.flush(),t)}return Promise.resolve(new ArrayBuffer(0))}var l=s.value;var u=l.length;e.loaded+=u;if(u<i||n.dataLength){n.push(l);if(n.dataLength>=i){a(e,r,n.flush(),t)}}else{a(e,r,l,t)}return o()})).catch((function(){return Promise.reject()}))};return o()};return t}();function bs(t,e){var r={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(o({},t.headers))};if(t.rangeEnd){r.headers.set("Range","bytes="+t.rangeStart+"-"+String(t.rangeEnd-1))}return r}function Rs(t){var e=As.exec(t);if(e){return parseInt(e[2])-parseInt(e[1])+1}}function Is(t){var e=t.get("Content-Range");if(e){var r=Rs(e);if(f(r)){return r}}var i=t.get("Content-Length");if(i){return parseInt(i)}}function Ds(t,e){return new self.Request(t.url,e)}var ks=function(t){__extends(e,t);function e(e,r,i){var a=t.call(this,e)||this;a.code=void 0;a.details=void 0;a.code=r;a.details=i;return a}return e}(Error);var _s=/\s/;var ws={newCue:function(t,e,r,i){var a=[];var n;var s;var o;var l;var u;var f=self.VTTCue||self.TextTrackCue;for(var c=0;c<i.rows.length;c++){n=i.rows[c];o=true;l=0;u="";if(!n.isEmpty()){var d;for(var h=0;h<n.chars.length;h++){if(_s.test(n.chars[h].uchar)&&o){l++}else{u+=n.chars[h].uchar;o=false}}n.cueStartTime=e;if(e===r){r+=1e-4}if(l>=16){l--}else{l++}var v=Pn(u.trim());var p=Un(e,r,v);if(!(t!=null&&(d=t.cues)!=null&&d.getCueById(p))){s=new f(e,r,v);s.id=p;s.line=c+1;s.align="left";s.position=10+Math.min(80,Math.floor(l*8/32)*10);a.push(s)}}}if(t&&a.length){a.sort((function(t,e){if(t.line==="auto"||e.line==="auto"){return 0}if(t.line>8&&e.line>8){return e.line-t.line}return t.line-e.line}));a.forEach((function(e){return be(t,e)}))}return a}};var Cs={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null};var Ps=n(n({autoStartLoad:true,startPosition:-1,defaultAudioCodec:undefined,debug:false,capLevelOnFPSDrop:false,capLevelToPlayerSize:false,ignoreDevicePixelRatio:false,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:Infinity,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:Infinity,liveSyncDuration:undefined,liveMaxLatencyDuration:undefined,maxLiveSyncPlaybackRate:1,liveDurationInfinity:false,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:true,workerPath:null,enableSoftwareAES:true,startLevel:undefined,startFragPrefetch:false,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:Es,fLoader:undefined,pLoader:undefined,xhrSetup:undefined,licenseXhrSetup:undefined,licenseResponseCallback:undefined,abrController:Ba,bufferController:en,capLevelController:ss,errorController:gr,fpsController:os,stretchShortVideoTrack:false,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:true,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:false,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:false,widevineLicenseUrl:undefined,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:X,testBandwidth:true,progressive:false,lowLatencyMode:true,cmcd:undefined,enableDateRangeMetadataCues:true,enableEmsgMetadataCues:true,enableID3MetadataCues:true,certLoadPolicy:{default:Cs},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:Infinity,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},Os()),{},{subtitleStreamController:Xa,subtitleTrackController:Qa,timelineController:rs,audioStreamController:Va,audioTrackController:ja,emeController:us,cmcdController:vs,contentSteeringController:gs});function Os(){return{cueHandler:ws,enableWebVTT:true,enableIMSC1:true,enableCEA708Captions:true,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:true}}function xs(t,e){if((e.liveSyncDurationCount||e.liveMaxLatencyDurationCount)&&(e.liveSyncDuration||e.liveMaxLatencyDuration)){throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration")}if(e.liveMaxLatencyDurationCount!==undefined&&(e.liveSyncDurationCount===undefined||e.liveMaxLatencyDurationCount<=e.liveSyncDurationCount)){throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"')}if(e.liveMaxLatencyDuration!==undefined&&(e.liveSyncDuration===undefined||e.liveMaxLatencyDuration<=e.liveSyncDuration)){throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"')}var r=Fs(t);var i=["manifest","level","frag"];var a=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];i.forEach((function(t){var i="".concat(t==="level"?"playlist":t,"LoadPolicy");var n=e[i]===undefined;var s=[];a.forEach((function(a){var o="".concat(t,"Loading").concat(a);var l=e[o];if(l!==undefined&&n){s.push(o);var u=r[i].default;e[i]={default:u};switch(a){case"TimeOut":u.maxLoadTimeMs=l;u.maxTimeToFirstByteMs=l;break;case"MaxRetry":u.errorRetry.maxNumRetry=l;u.timeoutRetry.maxNumRetry=l;break;case"RetryDelay":u.errorRetry.retryDelayMs=l;u.timeoutRetry.retryDelayMs=l;break;case"MaxRetryTimeout":u.errorRetry.maxRetryDelayMs=l;u.timeoutRetry.maxRetryDelayMs=l;break}}}));if(s.length){A.warn('hls.js config: "'.concat(s.join('", "'),'" setting(s) are deprecated, use "').concat(i,'": ').concat(JSON.stringify(e[i])))}}));return n(n({},r),e)}function Fs(t){if(t&&typeof t==="object"){if(Array.isArray(t)){return t.map(Fs)}return Object.keys(t).reduce((function(e,r){e[r]=Fs(t[r]);return e}),{})}return t}function Ms(t){var e=t.loader;if(e!==Ls&&e!==Es){A.log("[config]: Custom loader detected, cannot enable progressive streaming");t.progressive=false}else{var r=Ss();if(r){t.loader=Ls;t.progressive=true;t.enableSoftwareAES=true;A.log("[config]: Progressive streaming enabled, using FetchLoader")}}}var Ns=function(){function t(e){if(e===void 0){e={}}this.config=void 0;this.userConfig=void 0;this.coreComponents=void 0;this.networkControllers=void 0;this._emitter=new Da;this._autoLevelCapping=void 0;this._maxHdcpLevel=null;this.abrController=void 0;this.bufferController=void 0;this.capLevelController=void 0;this.latencyController=void 0;this.levelController=void 0;this.streamController=void 0;this.audioTrackController=void 0;this.subtitleTrackController=void 0;this.emeController=void 0;this.cmcdController=void 0;this._media=null;this.url=null;S(e.debug||false,"Hls instance");var r=this.config=xs(t.DefaultConfig,e);this.userConfig=e;this._autoLevelCapping=-1;if(r.progressive){Ms(r)}var i=r.abrController,a=r.bufferController,n=r.capLevelController,s=r.errorController,o=r.fpsController;var l=new s(this);var u=this.abrController=new i(this);var f=this.bufferController=new a(this);var c=this.capLevelController=new n(this);var d=new o(this);var v=new Ae(this);var p=new Me(this);var g=r.contentSteeringController;var m=g?new g(this):null;var y=this.levelController=new Er(this,m);var T=new br(this);var E=new Pr(this.config);var A=this.streamController=new Ma(this,T,E);c.setStreamController(A);d.setStreamController(A);var L=[v,y,A];if(m){L.splice(1,0,m)}this.networkControllers=L;var b=[u,f,c,d,p,T];this.audioTrackController=this.createController(r.audioTrackController,L);var R=r.audioStreamController;if(R){L.push(new R(this,T,E))}this.subtitleTrackController=this.createController(r.subtitleTrackController,L);var I=r.subtitleStreamController;if(I){L.push(new I(this,T,E))}this.createController(r.timelineController,b);E.emeController=this.emeController=this.createController(r.emeController,b);this.cmcdController=this.createController(r.cmcdController,b);this.latencyController=this.createController(Ne,b);this.coreComponents=b;L.push(l);var D=l.onErrorOut;if(typeof D==="function"){this.on(h.ERROR,D,l)}}Object.defineProperty(t,"version",{get:function(){return"1.4.13"},enumerable:false,configurable:true});t.isSupported=function(){return ii()};Object.defineProperty(t,"Events",{get:function(){return h},enumerable:false,configurable:true});Object.defineProperty(t,"ErrorTypes",{get:function(){return v},enumerable:false,configurable:true});Object.defineProperty(t,"ErrorDetails",{get:function(){return p},enumerable:false,configurable:true});Object.defineProperty(t,"DefaultConfig",{get:function(){if(!t.defaultConfig){return Ps}return t.defaultConfig},set:function(e){t.defaultConfig=e},enumerable:false,configurable:true});t.prototype.createController=function(t,e){if(t){var r=new t(this);if(e){e.push(r)}return r}return null};t.prototype.on=function(t,e,r){if(r===void 0){r=this}this._emitter.on(t,e,r)};t.prototype.once=function(t,e,r){if(r===void 0){r=this}this._emitter.once(t,e,r)};t.prototype.removeAllListeners=function(t){this._emitter.removeAllListeners(t)};t.prototype.off=function(t,e,r,i){if(r===void 0){r=this}this._emitter.off(t,e,r,i)};t.prototype.listeners=function(t){return this._emitter.listeners(t)};t.prototype.emit=function(t,e,r){return this._emitter.emit(t,e,r)};t.prototype.trigger=function(t,e){if(this.config.debug){return this.emit(t,t,e)}else{try{return this.emit(t,t,e)}catch(e){A.error("An internal error happened while handling event "+t+'. Error message: "'+e.message+'". Here is a stacktrace:',e);this.trigger(h.ERROR,{type:v.OTHER_ERROR,details:p.INTERNAL_EXCEPTION,fatal:false,event:t,error:e})}}return false};t.prototype.listenerCount=function(t){return this._emitter.listenerCount(t)};t.prototype.destroy=function(){A.log("destroy");this.trigger(h.DESTROYING,undefined);this.detachMedia();this.removeAllListeners();this._autoLevelCapping=-1;this.url=null;this.networkControllers.forEach((function(t){return t.destroy()}));this.networkControllers.length=0;this.coreComponents.forEach((function(t){return t.destroy()}));this.coreComponents.length=0;var t=this.config;t.xhrSetup=t.fetchSetup=undefined;this.userConfig=null};t.prototype.attachMedia=function(t){A.log("attachMedia");this._media=t;this.trigger(h.MEDIA_ATTACHING,{media:t})};t.prototype.detachMedia=function(){A.log("detachMedia");this.trigger(h.MEDIA_DETACHING,undefined);this._media=null};t.prototype.loadSource=function(t){this.stopLoad();var e=this.media;var r=this.url;var a=this.url=i.buildAbsoluteURL(self.location.href,t,{alwaysNormalize:true});A.log("loadSource:".concat(a));if(e&&r&&(r!==a||this.bufferController.hasSourceTypes())){this.detachMedia();this.attachMedia(e)}this.trigger(h.MANIFEST_LOADING,{url:t})};t.prototype.startLoad=function(t){if(t===void 0){t=-1}A.log("startLoad(".concat(t,")"));this.networkControllers.forEach((function(e){e.startLoad(t)}))};t.prototype.stopLoad=function(){A.log("stopLoad");this.networkControllers.forEach((function(t){t.stopLoad()}))};t.prototype.swapAudioCodec=function(){A.log("swapAudioCodec");this.streamController.swapAudioCodec()};t.prototype.recoverMediaError=function(){A.log("recoverMediaError");var t=this._media;this.detachMedia();if(t){this.attachMedia(t)}};t.prototype.removeLevel=function(t,e){if(e===void 0){e=0}this.levelController.removeLevel(t,e)};Object.defineProperty(t.prototype,"levels",{get:function(){var t=this.levelController.levels;return t?t:[]},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"currentLevel",{get:function(){return this.streamController.currentLevel},set:function(t){A.log("set currentLevel:".concat(t));this.loadLevel=t;this.abrController.clearTimer();this.streamController.immediateLevelSwitch()},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"nextLevel",{get:function(){return this.streamController.nextLevel},set:function(t){A.log("set nextLevel:".concat(t));this.levelController.manualLevel=t;this.streamController.nextLevelSwitch()},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"loadLevel",{get:function(){return this.levelController.level},set:function(t){A.log("set loadLevel:".concat(t));this.levelController.manualLevel=t},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"nextLoadLevel",{get:function(){return this.levelController.nextLoadLevel},set:function(t){this.levelController.nextLoadLevel=t},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"firstLevel",{get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(t){A.log("set firstLevel:".concat(t));this.levelController.firstLevel=t},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"startLevel",{get:function(){return this.levelController.startLevel},set:function(t){A.log("set startLevel:".concat(t));if(t!==-1){t=Math.max(t,this.minAutoLevel)}this.levelController.startLevel=t},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"capLevelToPlayerSize",{get:function(){return this.config.capLevelToPlayerSize},set:function(t){var e=!!t;if(e!==this.config.capLevelToPlayerSize){if(e){this.capLevelController.startCapping()}else{this.capLevelController.stopCapping();this.autoLevelCapping=-1;this.streamController.nextLevelSwitch()}this.config.capLevelToPlayerSize=e}},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"autoLevelCapping",{get:function(){return this._autoLevelCapping},set:function(t){if(this._autoLevelCapping!==t){A.log("set autoLevelCapping:".concat(t));this._autoLevelCapping=t}},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"bandwidthEstimate",{get:function(){var t=this.abrController.bwEstimator;if(!t){return NaN}return t.getEstimate()},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"ttfbEstimate",{get:function(){var t=this.abrController.bwEstimator;if(!t){return NaN}return t.getEstimateTTFB()},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"maxHdcpLevel",{get:function(){return this._maxHdcpLevel},set:function(t){if(Ue.indexOf(t)>-1){this._maxHdcpLevel=t}},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"autoLevelEnabled",{get:function(){return this.levelController.manualLevel===-1},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"manualLevel",{get:function(){return this.levelController.manualLevel},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"minAutoLevel",{get:function(){var t=this,e=t.levels,r=t.config.minAutoBitrate;if(!e)return 0;var i=e.length;for(var a=0;a<i;a++){if(e[a].maxBitrate>=r){return a}}return 0},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"maxAutoLevel",{get:function(){var t=this,e=t.levels,r=t.autoLevelCapping,i=t.maxHdcpLevel;var a;if(r===-1&&e&&e.length){a=e.length-1}else{a=r}if(i){for(var n=a;n--;){var s=e[n].attrs["HDCP-LEVEL"];if(s&&s<=i){return n}}}return a},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"nextAutoLevel",{get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(t){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,t)},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"playingDate",{get:function(){return this.streamController.currentProgramDateTime},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"mainForwardBufferInfo",{get:function(){return this.streamController.getMainFwdBufferInfo()},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"audioTracks",{get:function(){var t=this.audioTrackController;return t?t.audioTracks:[]},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"audioTrack",{get:function(){var t=this.audioTrackController;return t?t.audioTrack:-1},set:function(t){var e=this.audioTrackController;if(e){e.audioTrack=t}},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"subtitleTracks",{get:function(){var t=this.subtitleTrackController;return t?t.subtitleTracks:[]},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"subtitleTrack",{get:function(){var t=this.subtitleTrackController;return t?t.subtitleTrack:-1},set:function(t){var e=this.subtitleTrackController;if(e){e.subtitleTrack=t}},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"media",{get:function(){return this._media},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"subtitleDisplay",{get:function(){var t=this.subtitleTrackController;return t?t.subtitleDisplay:false},set:function(t){var e=this.subtitleTrackController;if(e){e.subtitleDisplay=t}},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"lowLatencyMode",{get:function(){return this.config.lowLatencyMode},set:function(t){this.config.lowLatencyMode=t},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"liveSyncPosition",{get:function(){return this.latencyController.liveSyncPosition},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"latency",{get:function(){return this.latencyController.latency},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"maxLatency",{get:function(){return this.latencyController.maxLatency},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"targetLatency",{get:function(){return this.latencyController.targetLatency},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"drift",{get:function(){return this.latencyController.drift},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"forceStartLoad",{get:function(){return this.streamController.forceStartLoad},enumerable:false,configurable:true});return t}();t("default",Ns);Ns.defaultConfig=void 0}}}));
|