@ilo-org/twig 1.1.6 → 1.2.1
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 +183 -183
- package/dist/components/accordion/accordion.behavior.js +10 -1
- package/dist/components/breadcrumb/breadcrumb.behavior.js +10 -1
- package/dist/components/breadcrumb/breadcrumb.twig +2 -3
- package/dist/components/button/button.behavior.js +6 -0
- package/dist/components/button/button.twig +11 -6
- package/dist/components/callout/callout.behavior.js +10 -1
- package/{src/patterns/components/callout/callout.wingsuit.yml → dist/components/callout/callout.component.yml} +6 -7
- package/dist/components/callout/callout.wingsuit.yml +6 -7
- package/{src/patterns/components/checkbox/checkbox.wingsuit.yml → dist/components/checkbox/checkbox.component.yml} +6 -6
- package/dist/components/checkbox/checkbox.wingsuit.yml +6 -6
- package/{src/patterns/components/datepicker/datepicker.wingsuit.yml → dist/components/datepicker/datepicker.component.yml} +5 -5
- package/dist/components/datepicker/datepicker.wingsuit.yml +5 -5
- package/{src/patterns/components/dropdown/dropdown.wingsuit.yml → dist/components/dropdown/dropdown.component.yml} +7 -7
- package/dist/components/dropdown/dropdown.wingsuit.yml +7 -7
- package/dist/components/fileupload/fileupload.behavior.js +10 -1
- package/{src/patterns/components/fileupload/fileupload.wingsuit.yml → dist/components/fileupload/fileupload.component.yml} +7 -7
- package/dist/components/fileupload/fileupload.wingsuit.yml +7 -7
- package/{src/patterns/components/footer/footer.wingsuit.yml → dist/components/footer/footer.component.yml} +1 -1
- package/dist/components/footer/footer.wingsuit.yml +1 -1
- package/dist/components/icon/icon.behavior.js +687 -1
- package/dist/components/icon/icon.twig +1 -4
- package/dist/components/linklist/linklist.behavior.js +8 -1
- package/{src/patterns/components/list/list-item.wingsuit.yml → dist/components/list/list-item.component.yml} +2 -4
- package/dist/components/{list-item → list}/list-item.wingsuit.yml +2 -4
- package/{src/patterns/components/list/list.wingsuit.yml → dist/components/list/list.component.yml} +1 -1
- package/dist/components/list/list.wingsuit.yml +1 -1
- package/dist/components/loading/loading.behavior.js +10 -1
- package/{src/patterns/components/loading/loading.wingsuit.yml → dist/components/loading/loading.component.yml} +1 -1
- package/dist/components/loading/loading.wingsuit.yml +1 -1
- package/{src/patterns/components/localnav/localnav.wingsuit.yml → dist/components/localnav/localnav.component.yml} +1 -1
- package/dist/components/localnav/localnav.wingsuit.yml +1 -1
- package/dist/components/modal/modal.behavior.js +10 -1
- package/{src/patterns/components/modal/modal.wingsuit.yml → dist/components/modal/modal.component.yml} +1 -1
- package/dist/components/modal/modal.wingsuit.yml +1 -1
- package/dist/components/navigation/navigation.behavior.js +10 -1
- package/{src/patterns/components/navigation/navigation.wingsuit.yml → dist/components/navigation/navigation.component.yml} +2 -2
- package/dist/components/navigation/navigation.wingsuit.yml +2 -2
- package/dist/components/notification/notification.behavior.js +10 -1
- package/{src/patterns/components/numberpicker/numberpicker.wingsuit.yml → dist/components/numberpicker/numberpicker.component.yml} +6 -6
- package/dist/components/numberpicker/numberpicker.wingsuit.yml +6 -6
- package/{src/patterns/components/pagination/pagination.wingsuit.yml → dist/components/pagination/pagination.component.yml} +6 -6
- package/dist/components/pagination/pagination.wingsuit.yml +6 -6
- package/{src/patterns/components/radio/radio.wingsuit.yml → dist/components/radio/radio.component.yml} +6 -6
- package/dist/components/radio/radio.wingsuit.yml +6 -6
- package/dist/components/readmore/readmore.behavior.js +10 -1
- package/{src/patterns/components/readmore/readmore.wingsuit.yml → dist/components/readmore/readmore.component.yml} +1 -1
- package/dist/components/readmore/readmore.wingsuit.yml +1 -1
- package/dist/components/search/search.behavior.js +10 -1
- package/{src/patterns/components/search/search.wingsuit.yml → dist/components/search/search.component.yml} +8 -8
- package/dist/components/search/search.wingsuit.yml +8 -8
- package/dist/components/table/table.behavior.js +10 -1
- package/dist/components/tableofcontents/tableofcontents.behavior.js +10 -1
- package/dist/components/tabs/tabs.behavior.js +120 -1
- package/dist/components/tags/tag.behavior.js +10 -0
- package/{src/patterns/components/tags/tag.wingsuit.yml → dist/components/tags/tag.component.yml} +3 -6
- package/dist/components/{tag → tags}/tag.wingsuit.yml +3 -6
- package/{src/patterns/components/textarea/textarea.wingsuit.yml → dist/components/textarea/textarea.component.yml} +9 -9
- package/dist/components/textarea/textarea.wingsuit.yml +9 -9
- package/{src/patterns/components/textinput/textinput.wingsuit.yml → dist/components/textinput/textinput.component.yml} +7 -7
- package/dist/components/textinput/textinput.wingsuit.yml +7 -7
- package/{src/patterns/components/toggle/toggle.wingsuit.yml → dist/components/toggle/toggle.component.yml} +5 -5
- package/dist/components/toggle/toggle.wingsuit.yml +5 -5
- package/dist/components/tooltip/tooltip.behavior.js +116 -1
- package/dist/components/video/video.behavior.js +192 -16
- package/dist/styles/global.css +2 -0
- package/dist/styles/global.css.map +1 -0
- package/dist/styles/index.css.map +1 -0
- package/dist/styles/monorepo.css +9 -0
- package/dist/styles/monorepo.css.map +1 -0
- package/package.json +46 -78
- package/README.md +0 -218
- package/dist/components/polyfill/polyfill.twig +0 -10
- package/dist/components/tag/tag.behavior.js +0 -1
- package/src/namespaces.js +0 -14
- package/src/patterns/components/accordion/accordion-item.twig +0 -22
- package/src/patterns/components/accordion/accordion.behavior.js +0 -16
- package/src/patterns/components/accordion/accordion.js +0 -200
- package/src/patterns/components/accordion/accordion.stories.jsx +0 -9
- package/src/patterns/components/accordion/accordion.twig +0 -16
- package/src/patterns/components/accordion/index.js +0 -7
- package/src/patterns/components/breadcrumb/breadcrumb.behavior.js +0 -16
- package/src/patterns/components/breadcrumb/breadcrumb.js +0 -280
- package/src/patterns/components/breadcrumb/breadcrumb.stories.jsx +0 -9
- package/src/patterns/components/breadcrumb/breadcrumb.twig +0 -55
- package/src/patterns/components/breadcrumb/index.js +0 -7
- package/src/patterns/components/button/button.stories.jsx +0 -9
- package/src/patterns/components/button/button.twig +0 -23
- package/src/patterns/components/button/index.js +0 -6
- package/src/patterns/components/callout/callout.behavior.js +0 -16
- package/src/patterns/components/callout/callout.js +0 -149
- package/src/patterns/components/callout/callout.stories.jsx +0 -9
- package/src/patterns/components/callout/callout.twig +0 -41
- package/src/patterns/components/callout/index.js +0 -7
- package/src/patterns/components/card/card.stories.jsx +0 -9
- package/src/patterns/components/card/card.twig +0 -24
- package/src/patterns/components/card/index.js +0 -6
- package/src/patterns/components/card_data/card_data.stories.jsx +0 -9
- package/src/patterns/components/card_data/card_data.twig +0 -101
- package/src/patterns/components/card_data/index.js +0 -9
- package/src/patterns/components/card_detail/card_detail.stories.jsx +0 -9
- package/src/patterns/components/card_detail/card_detail.twig +0 -37
- package/src/patterns/components/card_detail/index.js +0 -9
- package/src/patterns/components/card_factlist/card_factlist.stories.jsx +0 -9
- package/src/patterns/components/card_factlist/card_factlist.twig +0 -21
- package/src/patterns/components/card_factlist/index.js +0 -9
- package/src/patterns/components/card_feature/card_feature.stories.jsx +0 -9
- package/src/patterns/components/card_feature/card_feature.twig +0 -39
- package/src/patterns/components/card_feature/index.js +0 -9
- package/src/patterns/components/card_multilink/card_multilink.stories.jsx +0 -9
- package/src/patterns/components/card_multilink/card_multilink.twig +0 -45
- package/src/patterns/components/card_multilink/index.js +0 -9
- package/src/patterns/components/card_promo/card_promo.stories.jsx +0 -9
- package/src/patterns/components/card_promo/card_promo.twig +0 -35
- package/src/patterns/components/card_promo/index.js +0 -9
- package/src/patterns/components/card_stat/card_stat.stories.jsx +0 -9
- package/src/patterns/components/card_stat/card_stat.twig +0 -24
- package/src/patterns/components/card_stat/index.js +0 -9
- package/src/patterns/components/card_text/card_text.stories.jsx +0 -9
- package/src/patterns/components/card_text/card_text.twig +0 -35
- package/src/patterns/components/card_text/index.js +0 -9
- package/src/patterns/components/cardgroup/cardgroup.stories.jsx +0 -9
- package/src/patterns/components/cardgroup/cardgroup.twig +0 -44
- package/src/patterns/components/cardgroup/index.js +0 -6
- package/src/patterns/components/checkbox/checkbox.stories.jsx +0 -10
- package/src/patterns/components/checkbox/checkbox.twig +0 -17
- package/src/patterns/components/checkbox/index.js +0 -7
- package/src/patterns/components/contextmenu/contextmenu.stories.jsx +0 -9
- package/src/patterns/components/contextmenu/contextmenu.twig +0 -12
- package/src/patterns/components/contextmenu/index.js +0 -6
- package/src/patterns/components/datepicker/datepicker.stories.jsx +0 -9
- package/src/patterns/components/datepicker/datepicker.twig +0 -20
- package/src/patterns/components/datepicker/index.js +0 -7
- package/src/patterns/components/dropdown/dropdown.stories.jsx +0 -9
- package/src/patterns/components/dropdown/dropdown.twig +0 -22
- package/src/patterns/components/dropdown/index.js +0 -6
- package/src/patterns/components/fileupload/fileupload.behavior.js +0 -12
- package/src/patterns/components/fileupload/fileupload.js +0 -147
- package/src/patterns/components/fileupload/fileupload.stories.jsx +0 -9
- package/src/patterns/components/fileupload/fileupload.twig +0 -20
- package/src/patterns/components/fileupload/index.js +0 -8
- package/src/patterns/components/footer/footer.stories.jsx +0 -9
- package/src/patterns/components/footer/footer.twig +0 -63
- package/src/patterns/components/footer/index.js +0 -6
- package/src/patterns/components/form/fieldset.twig +0 -70
- package/src/patterns/components/form/form.stories.jsx +0 -9
- package/src/patterns/components/form/form.twig +0 -19
- package/src/patterns/components/form/formcontrol.twig +0 -89
- package/src/patterns/components/form/index.js +0 -6
- package/src/patterns/components/form/input.twig +0 -10
- package/src/patterns/components/hero/hero.stories.jsx +0 -9
- package/src/patterns/components/hero/hero.twig +0 -65
- package/src/patterns/components/hero/index.js +0 -7
- package/src/patterns/components/herocard/herocard.stories.jsx +0 -9
- package/src/patterns/components/herocard/herocard.twig +0 -30
- package/src/patterns/components/herocard/index.js +0 -6
- package/src/patterns/components/icon/icon.behavior.js +0 -16
- package/src/patterns/components/icon/icon.js +0 -128
- package/src/patterns/components/icon/icon.stories.jsx +0 -10
- package/src/patterns/components/icon/icon.twig +0 -4
- package/src/patterns/components/icon/index.js +0 -6
- package/src/patterns/components/image/image.stories.jsx +0 -9
- package/src/patterns/components/image/image.twig +0 -29
- package/src/patterns/components/image/index.js +0 -6
- package/src/patterns/components/link/index.js +0 -6
- package/src/patterns/components/link/link.stories.jsx +0 -9
- package/src/patterns/components/link/link.twig +0 -8
- package/src/patterns/components/linklist/index.js +0 -7
- package/src/patterns/components/linklist/linklist.behavior.js +0 -15
- package/src/patterns/components/linklist/linklist.js +0 -55
- package/src/patterns/components/linklist/linklist.stories.jsx +0 -14
- package/src/patterns/components/linklist/linklist.twig +0 -26
- package/src/patterns/components/list/index.js +0 -6
- package/src/patterns/components/list/list-item.twig +0 -6
- package/src/patterns/components/list/list.stories.jsx +0 -9
- package/src/patterns/components/list/list.twig +0 -35
- package/src/patterns/components/loading/index.js +0 -7
- package/src/patterns/components/loading/loading.behavior.js +0 -16
- package/src/patterns/components/loading/loading.js +0 -102
- package/src/patterns/components/loading/loading.stories.jsx +0 -9
- package/src/patterns/components/loading/loading.twig +0 -8
- package/src/patterns/components/localnav/index.js +0 -7
- package/src/patterns/components/localnav/localnav.stories.jsx +0 -9
- package/src/patterns/components/localnav/localnav.twig +0 -86
- package/src/patterns/components/logogrid/index.js +0 -6
- package/src/patterns/components/logogrid/logogrid.stories.jsx +0 -9
- package/src/patterns/components/logogrid/logogrid.twig +0 -17
- package/src/patterns/components/modal/index.js +0 -7
- package/src/patterns/components/modal/modal.behavior.js +0 -16
- package/src/patterns/components/modal/modal.js +0 -134
- package/src/patterns/components/modal/modal.stories.jsx +0 -10
- package/src/patterns/components/modal/modal.twig +0 -20
- package/src/patterns/components/navigation/index.js +0 -7
- package/src/patterns/components/navigation/navigation.behavior.js +0 -16
- package/src/patterns/components/navigation/navigation.js +0 -552
- package/src/patterns/components/navigation/navigation.stories.jsx +0 -10
- package/src/patterns/components/navigation/navigation.twig +0 -171
- package/src/patterns/components/notification/index.js +0 -7
- package/src/patterns/components/notification/notification.behavior.js +0 -16
- package/src/patterns/components/notification/notification.js +0 -97
- package/src/patterns/components/notification/notification.stories.jsx +0 -10
- package/src/patterns/components/notification/notification.twig +0 -18
- package/src/patterns/components/numberpicker/index.js +0 -7
- package/src/patterns/components/numberpicker/numberpicker.stories.jsx +0 -9
- package/src/patterns/components/numberpicker/numberpicker.twig +0 -16
- package/src/patterns/components/pagination/Pagination.stories.jsx +0 -9
- package/src/patterns/components/pagination/index.js +0 -6
- package/src/patterns/components/pagination/pagination.twig +0 -49
- package/src/patterns/components/picture/index.js +0 -6
- package/src/patterns/components/picture/picture.twig +0 -21
- package/src/patterns/components/polyfill/index.js +0 -6
- package/src/patterns/components/polyfill/polyfill.twig +0 -10
- package/src/patterns/components/profile/index.js +0 -6
- package/src/patterns/components/profile/profile.stories.jsx +0 -10
- package/src/patterns/components/profile/profile.twig +0 -26
- package/src/patterns/components/radio/index.js +0 -7
- package/src/patterns/components/radio/radio.stories.jsx +0 -10
- package/src/patterns/components/radio/radio.twig +0 -23
- package/src/patterns/components/readmore/index.js +0 -7
- package/src/patterns/components/readmore/readmore.behavior.js +0 -16
- package/src/patterns/components/readmore/readmore.js +0 -121
- package/src/patterns/components/readmore/readmore.stories.jsx +0 -10
- package/src/patterns/components/readmore/readmore.twig +0 -16
- package/src/patterns/components/richtext/index.js +0 -6
- package/src/patterns/components/richtext/richtext.stories.jsx +0 -10
- package/src/patterns/components/richtext/richtext.twig +0 -6
- package/src/patterns/components/search/index.js +0 -7
- package/src/patterns/components/search/search.behavior.js +0 -15
- package/src/patterns/components/search/search.js +0 -103
- package/src/patterns/components/search/search.stories.jsx +0 -10
- package/src/patterns/components/search/search.twig +0 -31
- package/src/patterns/components/socialmedia/index.js +0 -6
- package/src/patterns/components/socialmedia/socialmedia.mdx +0 -48
- package/src/patterns/components/socialmedia/socialmedia.stories.jsx +0 -15
- package/src/patterns/components/socialmedia/socialmedia.twig +0 -17
- package/src/patterns/components/table/index.js +0 -7
- package/src/patterns/components/table/table.behavior.js +0 -16
- package/src/patterns/components/table/table.js +0 -305
- package/src/patterns/components/table/table.stories.jsx +0 -10
- package/src/patterns/components/table/table.twig +0 -39
- package/src/patterns/components/tableofcontents/index.js +0 -7
- package/src/patterns/components/tableofcontents/tableofcontents.behavior.js +0 -16
- package/src/patterns/components/tableofcontents/tableofcontents.js +0 -172
- package/src/patterns/components/tableofcontents/tableofcontents.stories.jsx +0 -10
- package/src/patterns/components/tableofcontents/tableofcontents.twig +0 -47
- package/src/patterns/components/tabs/index.js +0 -7
- package/src/patterns/components/tabs/tabs.behavior.js +0 -27
- package/src/patterns/components/tabs/tabs.js +0 -212
- package/src/patterns/components/tabs/tabs.stories.jsx +0 -10
- package/src/patterns/components/tabs/tabs.twig +0 -29
- package/src/patterns/components/tags/index.js +0 -7
- package/src/patterns/components/tags/tag.behavior.js +0 -16
- package/src/patterns/components/tags/tag.js +0 -159
- package/src/patterns/components/tags/tag.stories.jsx +0 -10
- package/src/patterns/components/tags/tag.twig +0 -30
- package/src/patterns/components/tags/tags.twig +0 -15
- package/src/patterns/components/textarea/index.js +0 -7
- package/src/patterns/components/textarea/textarea.stories.jsx +0 -9
- package/src/patterns/components/textarea/textarea.twig +0 -14
- package/src/patterns/components/textinput/index.js +0 -7
- package/src/patterns/components/textinput/textinput.stories.jsx +0 -10
- package/src/patterns/components/textinput/textinput.twig +0 -14
- package/src/patterns/components/toggle/index.js +0 -7
- package/src/patterns/components/toggle/toggle.stories.jsx +0 -10
- package/src/patterns/components/toggle/toggle.twig +0 -36
- package/src/patterns/components/tooltip/index.js +0 -7
- package/src/patterns/components/tooltip/tooltip.behavior.js +0 -16
- package/src/patterns/components/tooltip/tooltip.js +0 -156
- package/src/patterns/components/tooltip/tooltip.stories.jsx +0 -10
- package/src/patterns/components/tooltip/tooltip.twig +0 -14
- package/src/patterns/components/video/index.js +0 -7
- package/src/patterns/components/video/video.behavior.js +0 -16
- package/src/patterns/components/video/video.js +0 -120
- package/src/patterns/components/video/video.stories.jsx +0 -10
- package/src/patterns/components/video/video.twig +0 -18
- package/src/patterns/components/video/videoplayer.twig +0 -8
- package/src/tokens/exports/_colors.scss +0 -7
- package/src/tokens/exports/_font-sizes-heading.scss +0 -10
- package/src/tokens/index.scss +0 -7
- package/src/vendorjs/lib.vendor.js +0 -1
- /package/{src/patterns/components/accordion/accordion.wingsuit.yml → dist/components/accordion/accordion.component.yml} +0 -0
- /package/{src/patterns/components/breadcrumb/breadcrumb.wingsuit.yml → dist/components/breadcrumb/breadcrumb.component.yml} +0 -0
- /package/{src/patterns/components/button/button.wingsuit.yml → dist/components/button/button.component.yml} +0 -0
- /package/{src/patterns/components/card/card.wingsuit.yml → dist/components/card/card.component.yml} +0 -0
- /package/{src/patterns/components/card_data/card_data.wingsuit.yml → dist/components/card_data/card_data.component.yml} +0 -0
- /package/{src/patterns/components/card_detail/card_detail.wingsuit.yml → dist/components/card_detail/card_detail.component.yml} +0 -0
- /package/{src/patterns/components/card_factlist/card_factlist.wingsuit.yml → dist/components/card_factlist/card_factlist.component.yml} +0 -0
- /package/{src/patterns/components/card_feature/card_feature.wingsuit.yml → dist/components/card_feature/card_feature.component.yml} +0 -0
- /package/{src/patterns/components/card_multilink/card_multilink.wingsuit.yml → dist/components/card_multilink/card_multilink.component.yml} +0 -0
- /package/{src/patterns/components/card_promo/card_promo.wingsuit.yml → dist/components/card_promo/card_promo.component.yml} +0 -0
- /package/{src/patterns/components/card_stat/card_stat.wingsuit.yml → dist/components/card_stat/card_stat.component.yml} +0 -0
- /package/{src/patterns/components/card_text/card_text.wingsuit.yml → dist/components/card_text/card_text.component.yml} +0 -0
- /package/{src/patterns/components/cardgroup/cardgroup.wingsuit.yml → dist/components/cardgroup/cardgroup.component.yml} +0 -0
- /package/{src/patterns/components/contextmenu/contextmenu.wingsuit.yml → dist/components/contextmenu/contextmenu.component.yml} +0 -0
- /package/{src/patterns/components/form/form.wingsuit.yml → dist/components/form/form.component.yml} +0 -0
- /package/{src/patterns/components/hero/hero.wingsuit.yml → dist/components/hero/hero.component.yml} +0 -0
- /package/{src/patterns/components/herocard/herocard.wingsuit.yml → dist/components/herocard/herocard.component.yml} +0 -0
- /package/{src/patterns/components/icon/icon.wingsuit.yml → dist/components/icon/icon.component.yml} +0 -0
- /package/{src/patterns/components/image/image.wingsuit.yml → dist/components/image/image.component.yml} +0 -0
- /package/{src/patterns/components/link/link.wingsuit.yml → dist/components/link/link.component.yml} +0 -0
- /package/{src/patterns/components/linklist/linklist.wingsuit.yml → dist/components/linklist/linklist.component.yml} +0 -0
- /package/{src/patterns/components/logogrid/logogrid.wingsuit.yml → dist/components/logogrid/logogrid.component.yml} +0 -0
- /package/{src/patterns/components/notification/notification.wingsuit.yml → dist/components/notification/notification.component.yml} +0 -0
- /package/{src/patterns/components/profile/profile.wingsuit.yml → dist/components/profile/profile.component.yml} +0 -0
- /package/{src/patterns/components/richtext/richtext.wingsuit.yml → dist/components/richtext/richtext.component.yml} +0 -0
- /package/{src/patterns/components/socialmedia/socialmedia.wingsuit.yml → dist/components/socialmedia/socialmedia.component.yml} +0 -0
- /package/{src/patterns/components/table/table.wingsuit.yml → dist/components/table/table.component.yml} +0 -0
- /package/{src/patterns/components/tableofcontents/tableofcontents.wingsuit.yml → dist/components/tableofcontents/tableofcontents.component.yml} +0 -0
- /package/{src/patterns/components/tabs/tabs.wingsuit.yml → dist/components/tabs/tabs.component.yml} +0 -0
- /package/{src/patterns/components/tags/tags.wingsuit.yml → dist/components/tags/tags.component.yml} +0 -0
- /package/{src/patterns/components/tooltip/tooltip.wingsuit.yml → dist/components/tooltip/tooltip.component.yml} +0 -0
- /package/{src/patterns/components/video/video.wingsuit.yml → dist/components/video/video.component.yml} +0 -0
- /package/dist/{components/accordion → styles/components}/accordion.css +0 -0
- /package/dist/{components/breadcrumb → styles/components}/breadcrumb.css +0 -0
- /package/dist/{components/button → styles/components}/button.css +0 -0
- /package/dist/{components/callout → styles/components}/callout.css +0 -0
- /package/dist/{components/card → styles/components}/card.css +0 -0
- /package/dist/{components/cardgroup → styles/components}/cardgroup.css +0 -0
- /package/dist/{components/checkbox → styles/components}/checkbox.css +0 -0
- /package/dist/{components/container → styles/components}/container.css +0 -0
- /package/dist/{components/contextmenu → styles/components}/contextmenu.css +0 -0
- /package/dist/{components/credit → styles/components}/credit.css +0 -0
- /package/dist/{components/datacard → styles/components}/datacard.css +0 -0
- /package/dist/{components/datepicker → styles/components}/datepicker.css +0 -0
- /package/dist/{components/detailcard → styles/components}/detailcard.css +0 -0
- /package/dist/{components/dropdown → styles/components}/dropdown.css +0 -0
- /package/dist/{components/empty → styles/components}/empty.css +0 -0
- /package/dist/{components/factlistcard → styles/components}/factlistcard.css +0 -0
- /package/dist/{components/featurecard → styles/components}/featurecard.css +0 -0
- /package/dist/{components/fieldset → styles/components}/fieldset.css +0 -0
- /package/dist/{components/file-upload → styles/components}/file-upload.css +0 -0
- /package/dist/{components/footer → styles/components}/footer.css +0 -0
- /package/dist/{components/form → styles/components}/form.css +0 -0
- /package/dist/{components/formcontrol → styles/components}/formcontrol.css +0 -0
- /package/dist/{components/heading → styles/components}/heading.css +0 -0
- /package/dist/{components/hero → styles/components}/hero.css +0 -0
- /package/dist/{components/herocard → styles/components}/herocard.css +0 -0
- /package/dist/{components/image → styles/components}/image.css +0 -0
- /package/dist/{components/input → styles/components}/input.css +0 -0
- /package/dist/{components/link → styles/components}/link.css +0 -0
- /package/dist/{components/linklist → styles/components}/linklist.css +0 -0
- /package/dist/{components/list → styles/components}/list.css +0 -0
- /package/dist/{components/loading → styles/components}/loading.css +0 -0
- /package/dist/{components/logo → styles/components}/logo.css +0 -0
- /package/dist/{components/logogrid → styles/components}/logogrid.css +0 -0
- /package/dist/{components/modal → styles/components}/modal.css +0 -0
- /package/dist/{components/multilinkcard → styles/components}/multilinkcard.css +0 -0
- /package/dist/{components/navigation → styles/components}/navigation.css +0 -0
- /package/dist/{components/notification → styles/components}/notification.css +0 -0
- /package/dist/{components/pagination → styles/components}/pagination.css +0 -0
- /package/dist/{components/profile → styles/components}/profile.css +0 -0
- /package/dist/{components/promocard → styles/components}/promocard.css +0 -0
- /package/dist/{components/radio → styles/components}/radio.css +0 -0
- /package/dist/{components/readmore → styles/components}/readmore.css +0 -0
- /package/dist/{components/richtext → styles/components}/richtext.css +0 -0
- /package/dist/{components/searchfield → styles/components}/searchfield.css +0 -0
- /package/dist/{components/socialmedia → styles/components}/socialmedia.css +0 -0
- /package/dist/{components/statcard → styles/components}/statcard.css +0 -0
- /package/dist/{components/table → styles/components}/table.css +0 -0
- /package/dist/{components/tableofcontents → styles/components}/tableofcontents.css +0 -0
- /package/dist/{components/tabs → styles/components}/tabs.css +0 -0
- /package/dist/{components/tag → styles/components}/tag.css +0 -0
- /package/dist/{components/textarea → styles/components}/textarea.css +0 -0
- /package/dist/{components/textcard → styles/components}/textcard.css +0 -0
- /package/dist/{components/textinput → styles/components}/textinput.css +0 -0
- /package/dist/{components/toggle → styles/components}/toggle.css +0 -0
- /package/dist/{components/tooltip → styles/components}/tooltip.css +0 -0
- /package/dist/{components/video → styles/components}/video.css +0 -0
- /package/dist/{global/styles.css → styles/index.css} +0 -0
|
@@ -1,16 +1,192 @@
|
|
|
1
|
-
!function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";function e(e,t,i){return t=r(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,i||[],r(e).constructor):t.apply(e,i))}function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,o(n.key),n)}}function n(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function r(e){return r=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},r(e)}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(a=function(){return!!e})()}function s(e,t){return s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},s(e,t)}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var n=i.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function u(e){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u(e)}var l="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function c(e){var t=e.default;if("function"==typeof t){var i=function(){return t.apply(this,arguments)};i.prototype=t.prototype}else i={};return Object.defineProperty(i,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(i,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})})),i}var d="undefined"!=typeof window?window:void 0!==l?l:"undefined"!=typeof self?self:{},h=Array.prototype.slice,p=function(e,t){"length"in e||(e=[e]);e=h.call(e);for(;e.length;){var i=e.shift(),n=t(i);if(n)return n;i.childNodes&&i.childNodes.length&&(e=h.call(i.childNodes).concat(e))}};var f=m;function m(e,t){if(!(this instanceof m))return new m(e,t);this.data=e,this.nodeValue=e,this.length=e.length,this.ownerDocument=t||null}m.prototype.nodeType=8,m.prototype.nodeName="#comment",m.prototype.toString=function(){return"[object Comment]"};var g=v;function v(e,t){if(!(this instanceof v))return new v(e);this.data=e||"",this.length=this.data.length,this.ownerDocument=t||null}v.prototype.type="DOMTextNode",v.prototype.nodeType=3,v.prototype.nodeName="#text",v.prototype.toString=function(){return this.data},v.prototype.replaceData=function(e,t,i){var n=this.data,r=n.substring(0,e),a=n.substring(e+t,n.length);this.data=r+i+a,this.length=this.data.length};var y=function(e){var t=this,i=e.type;e.target||(e.target=t);t.listeners||(t.listeners={});var n=t.listeners[i];if(n)return n.forEach((function(i){e.currentTarget=t,"function"==typeof i?i(e):i.handleEvent(e)}));t.parentNode&&t.parentNode.dispatchEvent(e)};var _=function(e,t){var i=this;i.listeners||(i.listeners={});i.listeners[e]||(i.listeners[e]=[]);-1===i.listeners[e].indexOf(t)&&i.listeners[e].push(t)};var b=function(e,t){var i=this;if(!i.listeners)return;if(!i.listeners[e])return;var n=i.listeners[e],r=n.indexOf(t);-1!==r&&n.splice(r,1)};var T=["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"];function S(e){switch(e.nodeType){case 3:return k(e.data);case 8:return"\x3c!--"+e.data+"--\x3e";default:return function(e){var t=[],i=e.tagName;"http://www.w3.org/1999/xhtml"===e.namespaceURI&&(i=i.toLowerCase());t.push("<"+i+function(e){var t=[];for(var i in e)E(e,i)&&t.push({name:i,value:e[i]});for(var n in e._attributes)for(var r in e._attributes[n]){var a=e._attributes[n][r],s=(a.prefix?a.prefix+":":"")+r;t.push({name:s,value:a.value})}e.className&&t.push({name:"class",value:e.className});return t.length?w(t):""}(e)+function(e){var t=e.dataset,i=[];for(var n in t)i.push({name:"data-"+n,value:t[n]});return i.length?w(i):""}(e)),T.indexOf(i)>-1?t.push(" />"):(t.push(">"),e.childNodes.length?t.push.apply(t,e.childNodes.map(S)):e.textContent||e.innerText?t.push(k(e.textContent||e.innerText)):e.innerHTML&&t.push(e.innerHTML),t.push("</"+i+">"));return t.join("")}(e)}}function E(e,t){var i=u(e[t]);return"style"===t&&Object.keys(e.style).length>0||e.hasOwnProperty(t)&&("string"===i||"boolean"===i||"number"===i)&&"nodeName"!==t&&"className"!==t&&"tagName"!==t&&"textContent"!==t&&"innerText"!==t&&"namespaceURI"!==t&&"innerHTML"!==t}function w(e){var t=[];return e.forEach((function(e){var i=e.name,n=e.value;"style"===i&&(n=function(e){if("string"==typeof e)return e;var t="";return Object.keys(e).forEach((function(i){var n=e[i];i=i.replace(/[A-Z]/g,(function(e){return"-"+e.toLowerCase()})),t+=i+":"+n+";"})),t}(n)),t.push(i+'="'+(k(n).replace(/"/g,""")+'"'))})),t.length?" "+t.join(" "):""}function k(e){var t="";return"string"==typeof e?t=e:e&&(t=e.toString()),t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}var C=p,x=y,I=_,A=b,P=S,L="http://www.w3.org/1999/xhtml",D=O;function O(e,t,i){if(!(this instanceof O))return new O(e);var n=void 0===i?L:i||null;this.tagName=n===L?String(e).toUpperCase():e,this.nodeName=this.tagName,this.className="",this.dataset={},this.childNodes=[],this.parentNode=null,this.style={},this.ownerDocument=t||null,this.namespaceURI=n,this._attributes={},"INPUT"===this.tagName&&(this.type="text")}O.prototype.type="DOMElement",O.prototype.nodeType=1,O.prototype.appendChild=function(e){return e.parentNode&&e.parentNode.removeChild(e),this.childNodes.push(e),e.parentNode=this,e},O.prototype.replaceChild=function(e,t){e.parentNode&&e.parentNode.removeChild(e);var i=this.childNodes.indexOf(t);return t.parentNode=null,this.childNodes[i]=e,e.parentNode=this,t},O.prototype.removeChild=function(e){var t=this.childNodes.indexOf(e);return this.childNodes.splice(t,1),e.parentNode=null,e},O.prototype.insertBefore=function(e,t){e.parentNode&&e.parentNode.removeChild(e);var i=null==t?-1:this.childNodes.indexOf(t);return i>-1?this.childNodes.splice(i,0,e):this.childNodes.push(e),e.parentNode=this,e},O.prototype.setAttributeNS=function(e,t,i){var n=null,r=t,a=t.indexOf(":");(a>-1&&(n=t.substr(0,a),r=t.substr(a+1)),"INPUT"===this.tagName&&"type"===t)?this.type=i:(this._attributes[e]||(this._attributes[e]={}))[r]={value:i,prefix:n}},O.prototype.getAttributeNS=function(e,t){var i=this._attributes[e],n=i&&i[t]&&i[t].value;return"INPUT"===this.tagName&&"type"===t?this.type:"string"!=typeof n?null:n},O.prototype.removeAttributeNS=function(e,t){var i=this._attributes[e];i&&delete i[t]},O.prototype.hasAttributeNS=function(e,t){var i=this._attributes[e];return!!i&&t in i},O.prototype.setAttribute=function(e,t){return this.setAttributeNS(null,e,t)},O.prototype.getAttribute=function(e){return this.getAttributeNS(null,e)},O.prototype.removeAttribute=function(e){return this.removeAttributeNS(null,e)},O.prototype.hasAttribute=function(e){return this.hasAttributeNS(null,e)},O.prototype.removeEventListener=A,O.prototype.addEventListener=I,O.prototype.dispatchEvent=x,O.prototype.focus=function(){},O.prototype.toString=function(){return P(this)},O.prototype.getElementsByClassName=function(e){var t=e.split(" "),i=[];return C(this,(function(e){if(1===e.nodeType){var n=(e.className||"").split(" ");t.every((function(e){return-1!==n.indexOf(e)}))&&i.push(e)}})),i},O.prototype.getElementsByTagName=function(e){e=e.toLowerCase();var t=[];return C(this.childNodes,(function(i){1!==i.nodeType||"*"!==e&&i.tagName.toLowerCase()!==e||t.push(i)})),t},O.prototype.contains=function(e){return C(this,(function(t){return e===t}))||!1};var N=D,R=M;function M(e){if(!(this instanceof M))return new M;this.childNodes=[],this.parentNode=null,this.ownerDocument=e||null}M.prototype.type="DocumentFragment",M.prototype.nodeType=11,M.prototype.nodeName="#document-fragment",M.prototype.appendChild=N.prototype.appendChild,M.prototype.replaceChild=N.prototype.replaceChild,M.prototype.removeChild=N.prototype.removeChild,M.prototype.toString=function(){return this.childNodes.map((function(e){return String(e)})).join("")};var U=B;function B(e){}B.prototype.initEvent=function(e,t,i){this.type=e,this.bubbles=t,this.cancelable=i},B.prototype.preventDefault=function(){};var F=p,j=f,q=g,V=D,H=R,W=U,G=y,z=_,X=b,K=Y;function Y(){if(!(this instanceof Y))return new Y;this.head=this.createElement("head"),this.body=this.createElement("body"),this.documentElement=this.createElement("html"),this.documentElement.appendChild(this.head),this.documentElement.appendChild(this.body),this.childNodes=[this.documentElement],this.nodeType=9}var Q=Y.prototype;Q.createTextNode=function(e){return new q(e,this)},Q.createElementNS=function(e,t){var i=null===e?null:String(e);return new V(t,this,i)},Q.createElement=function(e){return new V(e,this)},Q.createDocumentFragment=function(){return new H(this)},Q.createEvent=function(e){return new W},Q.createComment=function(e){return new j(e,this)},Q.getElementById=function(e){return e=String(e),F(this.childNodes,(function(t){if(String(t.id)===e)return t}))||null},Q.getElementsByClassName=V.prototype.getElementsByClassName,Q.getElementsByTagName=V.prototype.getElementsByTagName,Q.contains=V.prototype.contains,Q.removeEventListener=X,Q.addEventListener=z,Q.dispatchEvent=G;var $,J=new K,Z=void 0!==l?l:"undefined"!=typeof window?window:{},ee=J;"undefined"!=typeof document?$=document:($=Z["__GLOBAL_DOCUMENT_CACHE@4"])||($=Z["__GLOBAL_DOCUMENT_CACHE@4"]=ee);var te=$;function ie(){return ie=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)({}).hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e},ie.apply(null,arguments)}var ne={exports:{}};!function(e,t){function i(e){if(e&&"object"===u(e)){var t=e.which||e.keyCode||e.charCode;t&&(e=t)}if("number"==typeof e)return s[e];var i,a=String(e);return(i=n[a.toLowerCase()])?i:(i=r[a.toLowerCase()])||(1===a.length?a.charCodeAt(0):void 0)}i.isEventKey=function(e,t){if(e&&"object"===u(e)){var i=e.which||e.keyCode||e.charCode;if(null==i)return!1;if("string"==typeof t){var a;if(a=n[t.toLowerCase()])return a===i;if(a=r[t.toLowerCase()])return a===i}else if("number"==typeof t)return t===i;return!1}};var n=(t=e.exports=i).code=t.codes={backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,"pause/break":19,"caps lock":20,esc:27,space:32,"page up":33,"page down":34,end:35,home:36,left:37,up:38,right:39,down:40,insert:45,delete:46,command:91,"left command":91,"right command":93,"numpad *":106,"numpad +":107,"numpad -":109,"numpad .":110,"numpad /":111,"num lock":144,"scroll lock":145,"my computer":182,"my calculator":183,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},r=t.aliases={windows:91,"⇧":16,"⌥":18,"⌃":17,"⌘":91,ctl:17,control:17,option:18,pause:19,break:19,caps:20,return:13,escape:27,spc:32,spacebar:32,pgup:33,pgdn:34,ins:45,del:46,cmd:91};
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
var ye=function(e){var t={};return e?(e.trim().split("\n").forEach((function(e){var i=e.indexOf(":"),n=e.slice(0,i).trim().toLowerCase(),r=e.slice(i+1).trim();void 0===t[n]?t[n]=r:Array.isArray(t[n])?t[n].push(r):t[n]=[t[n],r]})),t):t};function _e(e,t,i){var n=e;return ve(t)?(i=t,"string"==typeof e&&(n={uri:e})):n=ge({},t,{uri:e}),n.callback=i,n}function be(e,t,i){return Te(t=_e(e,t,i))}function Te(e){if(void 0===e.callback)throw new Error("callback argument missing");var t=!1,i=function(i,n,r){t||(t=!0,e.callback(i,n,r))};function n(){var e=void 0;if(e=u.response?u.response:u.responseText||function(e){try{if("document"===e.responseType)return e.responseXML;var t=e.responseXML&&"parsererror"===e.responseXML.documentElement.nodeName;if(""===e.responseType&&!t)return e.responseXML}catch(e){}return null}(u),m)try{e=JSON.parse(e)}catch(e){}return e}function r(e){return clearTimeout(l),e instanceof Error||(e=new Error(""+(e||"Unknown XMLHttpRequest Error"))),e.statusCode=0,i(e,g)}function a(){if(!o){var t;clearTimeout(l),t=e.useXDR&&void 0===u.status?200:1223===u.status?204:u.status;var r=g,a=null;return 0!==t?(r={body:n(),statusCode:t,method:d,headers:{},url:c,rawRequest:u},u.getAllResponseHeaders&&(r.headers=ye(u.getAllResponseHeaders()))):a=new Error("Internal XMLHttpRequest Error"),i(a,r,r.body)}}var s,o,u=e.xhr||null;u||(u=e.cors||e.useXDR?new be.XDomainRequest:new be.XMLHttpRequest);var l,c=u.url=e.uri||e.url,d=u.method=e.method||"GET",h=e.body||e.data,p=u.headers=e.headers||{},f=!!e.sync,m=!1,g={body:void 0,headers:{},statusCode:0,method:d,url:c,rawRequest:u};if("json"in e&&!1!==e.json&&(m=!0,p.accept||p.Accept||(p.Accept="application/json"),"GET"!==d&&"HEAD"!==d&&(p["content-type"]||p["Content-Type"]||(p["Content-Type"]="application/json"),h=JSON.stringify(!0===e.json?h:e.json))),u.onreadystatechange=function(){4===u.readyState&&setTimeout(a,0)},u.onload=a,u.onerror=r,u.onprogress=function(){},u.onabort=function(){o=!0},u.ontimeout=r,u.open(d,c,!f,e.username,e.password),f||(u.withCredentials=!!e.withCredentials),!f&&e.timeout>0&&(l=setTimeout((function(){if(!o){o=!0,u.abort("timeout");var e=new Error("XMLHttpRequest timeout");e.code="ETIMEDOUT",r(e)}}),e.timeout)),u.setRequestHeader)for(s in p)p.hasOwnProperty(s)&&u.setRequestHeader(s,p[s]);else if(e.headers&&!function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}(e.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in e&&(u.responseType=e.responseType),"beforeSend"in e&&"function"==typeof e.beforeSend&&e.beforeSend(u),u.send(h||null),u}le.exports=be,le.exports.default=be,be.XMLHttpRequest=me.XMLHttpRequest||function(){},be.XDomainRequest="withCredentials"in new be.XMLHttpRequest?be.XMLHttpRequest:me.XDomainRequest,function(e,t){for(var i=0;i<e.length;i++)t(e[i])}(["get","put","post","patch","head","delete"],(function(e){be["delete"===e?"del":e]=function(t,i,n){return(i=_e(t,i,n)).method=e.toUpperCase(),Te(i)}}));var Se={exports:{}},Ee=te,we=Object.create||function(){function e(){}return function(t){if(1!==arguments.length)throw new Error("Object.create shim only accepts one parameter.");return e.prototype=t,new e}}();function ke(e,t){this.name="ParsingError",this.code=e.code,this.message=t||e.message}function Ce(e){function t(e,t,i,n){return 3600*(0|e)+60*(0|t)+(0|i)+(0|n)/1e3}var i=e.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);return i?i[3]?t(i[1],i[2],i[3].replace(":",""),i[4]):i[1]>59?t(i[1],i[2],0,i[4]):t(0,i[1],i[2],i[4]):null}function xe(){this.values=we(null)}function Ie(e,t,i,n){var r=n?e.split(n):[e];for(var a in r)if("string"==typeof r[a]){var s=r[a].split(i);if(2===s.length)t(s[0].trim(),s[1].trim())}}function Ae(e,t,i){var n=e;function r(){var t=Ce(e);if(null===t)throw new ke(ke.Errors.BadTimeStamp,"Malformed timestamp: "+n);return e=e.replace(/^[^\sa-zA-Z-]+/,""),t}function a(){e=e.replace(/^\s+/,"")}if(a(),t.startTime=r(),a(),"--\x3e"!==e.substr(0,3))throw new ke(ke.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '--\x3e'): "+n);e=e.substr(3),a(),t.endTime=r(),a(),function(e,t){var n=new xe;Ie(e,(function(e,t){switch(e){case"region":for(var r=i.length-1;r>=0;r--)if(i[r].id===t){n.set(e,i[r].region);break}break;case"vertical":n.alt(e,t,["rl","lr"]);break;case"line":var a=t.split(","),s=a[0];n.integer(e,s),n.percent(e,s)&&n.set("snapToLines",!1),n.alt(e,s,["auto"]),2===a.length&&n.alt("lineAlign",a[1],["start","center","end"]);break;case"position":a=t.split(","),n.percent(e,a[0]),2===a.length&&n.alt("positionAlign",a[1],["start","center","end"]);break;case"size":n.percent(e,t);break;case"align":n.alt(e,t,["start","center","end","left","right"])}}),/:/,/\s/),t.region=n.get("region",null),t.vertical=n.get("vertical","");try{t.line=n.get("line","auto")}catch(e){}t.lineAlign=n.get("lineAlign","start"),t.snapToLines=n.get("snapToLines",!0),t.size=n.get("size",100);try{t.align=n.get("align","center")}catch(e){t.align=n.get("align","middle")}try{t.position=n.get("position","auto")}catch(e){t.position=n.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},t.align)}t.positionAlign=n.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},t.align)}(e,t)}ke.prototype=we(Error.prototype),ke.prototype.constructor=ke,ke.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}},xe.prototype={set:function(e,t){this.get(e)||""===t||(this.values[e]=t)},get:function(e,t,i){return i?this.has(e)?this.values[e]:t[i]:this.has(e)?this.values[e]:t},has:function(e){return e in this.values},alt:function(e,t,i){for(var n=0;n<i.length;++n)if(t===i[n]){this.set(e,t);break}},integer:function(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))},percent:function(e,t){return!!(t.match(/^([\d]{1,3})(\.[\d]*)?%$/)&&(t=parseFloat(t))>=0&&t<=100)&&(this.set(e,t),!0)}};var Pe=Ee.createElement&&Ee.createElement("textarea"),Le={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},De={white:"rgba(255,255,255,1)",lime:"rgba(0,255,0,1)",cyan:"rgba(0,255,255,1)",red:"rgba(255,0,0,1)",yellow:"rgba(255,255,0,1)",magenta:"rgba(255,0,255,1)",blue:"rgba(0,0,255,1)",black:"rgba(0,0,0,1)"},Oe={v:"title",lang:"lang"},Ne={rt:"ruby"};function Re(e,t){function i(){if(!t)return null;var e,i=t.match(/^([^<]*)(<[^>]*>?)?/);return e=i[1]?i[1]:i[2],t=t.substr(e.length),e}function n(e,t){return!Ne[t.localName]||Ne[t.localName]===e.localName}function r(t,i){var n=Le[t];if(!n)return null;var r=e.document.createElement(n),a=Oe[t];return a&&i&&(r[a]=i.trim()),r}for(var a,s,o=e.document.createElement("div"),u=o,l=[];null!==(a=i());)if("<"!==a[0])u.appendChild(e.document.createTextNode((s=a,Pe.innerHTML=s,s=Pe.textContent,Pe.textContent="",s)));else{if("/"===a[1]){l.length&&l[l.length-1]===a.substr(2).replace(">","")&&(l.pop(),u=u.parentNode);continue}var c,d=Ce(a.substr(1,a.length-2));if(d){c=e.document.createProcessingInstruction("timestamp",d),u.appendChild(c);continue}var h=a.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!h)continue;if(!(c=r(h[1],h[3])))continue;if(!n(u,c))continue;if(h[2]){var p=h[2].split(".");p.forEach((function(e){var t=/^bg_/.test(e),i=t?e.slice(3):e;if(De.hasOwnProperty(i)){var n=t?"background-color":"color",r=De[i];c.style[n]=r}})),c.className=p.join(" ")}l.push(h[1]),u.appendChild(c),u=c}return o}var Me=[[1470,1470],[1472,1472],[1475,1475],[1478,1478],[1488,1514],[1520,1524],[1544,1544],[1547,1547],[1549,1549],[1563,1563],[1566,1610],[1645,1647],[1649,1749],[1765,1766],[1774,1775],[1786,1805],[1807,1808],[1810,1839],[1869,1957],[1969,1969],[1984,2026],[2036,2037],[2042,2042],[2048,2069],[2074,2074],[2084,2084],[2088,2088],[2096,2110],[2112,2136],[2142,2142],[2208,2208],[2210,2220],[8207,8207],[64285,64285],[64287,64296],[64298,64310],[64312,64316],[64318,64318],[64320,64321],[64323,64324],[64326,64449],[64467,64829],[64848,64911],[64914,64967],[65008,65020],[65136,65140],[65142,65276],[67584,67589],[67592,67592],[67594,67637],[67639,67640],[67644,67644],[67647,67669],[67671,67679],[67840,67867],[67872,67897],[67903,67903],[67968,68023],[68030,68031],[68096,68096],[68112,68115],[68117,68119],[68121,68147],[68160,68167],[68176,68184],[68192,68223],[68352,68405],[68416,68437],[68440,68466],[68472,68479],[68608,68680],[126464,126467],[126469,126495],[126497,126498],[126500,126500],[126503,126503],[126505,126514],[126516,126519],[126521,126521],[126523,126523],[126530,126530],[126535,126535],[126537,126537],[126539,126539],[126541,126543],[126545,126546],[126548,126548],[126551,126551],[126553,126553],[126555,126555],[126557,126557],[126559,126559],[126561,126562],[126564,126564],[126567,126570],[126572,126578],[126580,126583],[126585,126588],[126590,126590],[126592,126601],[126603,126619],[126625,126627],[126629,126633],[126635,126651],[1114109,1114109]];function Ue(e){for(var t=0;t<Me.length;t++){var i=Me[t];if(e>=i[0]&&e<=i[1])return!0}return!1}function Be(e){var t=[],i="";if(!e||!e.childNodes)return"ltr";function n(e,t){for(var i=t.childNodes.length-1;i>=0;i--)e.push(t.childNodes[i])}function r(e){if(!e||!e.length)return null;var t=e.pop(),i=t.textContent||t.innerText;if(i){var a=i.match(/^.*(\n|\r)/);return a?(e.length=0,a[0]):i}return"ruby"===t.tagName?r(e):t.childNodes?(n(e,t),r(e)):void 0}for(n(t,e);i=r(t);)for(var a=0;a<i.length;a++)if(Ue(i.charCodeAt(a)))return"rtl";return"ltr"}function Fe(){}function je(e,t,i){Fe.call(this),this.cue=t,this.cueDiv=Re(e,t.text);var n={color:"rgba(255, 255, 255, 1)",backgroundColor:"rgba(0, 0, 0, 0.8)",position:"relative",left:0,right:0,top:0,bottom:0,display:"inline",writingMode:""===t.vertical?"horizontal-tb":"lr"===t.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext"};this.applyStyles(n,this.cueDiv),this.div=e.document.createElement("div"),n={direction:Be(this.cueDiv),writingMode:""===t.vertical?"horizontal-tb":"lr"===t.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext",textAlign:"middle"===t.align?"center":t.align,font:i.font,whiteSpace:"pre-line",position:"absolute"},this.applyStyles(n),this.div.appendChild(this.cueDiv);var r=0;switch(t.positionAlign){case"start":case"line-left":r=t.position;break;case"center":r=t.position-t.size/2;break;case"end":case"line-right":r=t.position-t.size}""===t.vertical?this.applyStyles({left:this.formatStyle(r,"%"),width:this.formatStyle(t.size,"%")}):this.applyStyles({top:this.formatStyle(r,"%"),height:this.formatStyle(t.size,"%")}),this.move=function(e){this.applyStyles({top:this.formatStyle(e.top,"px"),bottom:this.formatStyle(e.bottom,"px"),left:this.formatStyle(e.left,"px"),right:this.formatStyle(e.right,"px"),height:this.formatStyle(e.height,"px"),width:this.formatStyle(e.width,"px")})}}function qe(e){var t,i,n,r;if(e.div){i=e.div.offsetHeight,n=e.div.offsetWidth,r=e.div.offsetTop;var a=(a=e.div.childNodes)&&(a=a[0])&&a.getClientRects&&a.getClientRects();e=e.div.getBoundingClientRect(),t=a?Math.max(a[0]&&a[0].height||0,e.height/a.length):0}this.left=e.left,this.right=e.right,this.top=e.top||r,this.height=e.height||i,this.bottom=e.bottom||r+(e.height||i),this.width=e.width||n,this.lineHeight=void 0!==t?t:e.lineHeight}function Ve(e,t,i,n){var r=new qe(t),a=t.cue,s=function(e){if("number"==typeof e.line&&(e.snapToLines||e.line>=0&&e.line<=100))return e.line;if(!e.track||!e.track.textTrackList||!e.track.textTrackList.mediaElement)return-1;for(var t=e.track,i=t.textTrackList,n=0,r=0;r<i.length&&i[r]!==t;r++)"showing"===i[r].mode&&n++;return-1*++n}(a),o=[];if(a.snapToLines){var u;switch(a.vertical){case"":o=["+y","-y"],u="height";break;case"rl":o=["+x","-x"],u="width";break;case"lr":o=["-x","+x"],u="width"}var l=r.lineHeight,c=l*Math.round(s),d=i[u]+l,h=o[0];Math.abs(c)>d&&(c=c<0?-1:1,c*=Math.ceil(d/l)*l),s<0&&(c+=""===a.vertical?i.height:i.width,o=o.reverse()),r.move(h,c)}else{var p=r.lineHeight/i.height*100;switch(a.lineAlign){case"center":s-=p/2;break;case"end":s-=p}switch(a.vertical){case"":t.applyStyles({top:t.formatStyle(s,"%")});break;case"rl":t.applyStyles({left:t.formatStyle(s,"%")});break;case"lr":t.applyStyles({right:t.formatStyle(s,"%")})}o=["+y","-x","+x","-y"],r=new qe(t)}var f=function(e,t){for(var r,a=new qe(e),s=1,o=0;o<t.length;o++){for(;e.overlapsOppositeAxis(i,t[o])||e.within(i)&&e.overlapsAny(n);)e.move(t[o]);if(e.within(i))return e;var u=e.intersectPercentage(i);s>u&&(r=new qe(e),s=u),e=new qe(a)}return r||a}(r,o);t.move(f.toCSSCompatValues(i))}function He(){}Fe.prototype.applyStyles=function(e,t){for(var i in t=t||this.div,e)e.hasOwnProperty(i)&&(t.style[i]=e[i])},Fe.prototype.formatStyle=function(e,t){return 0===e?0:e+t},je.prototype=we(Fe.prototype),je.prototype.constructor=je,qe.prototype.move=function(e,t){switch(t=void 0!==t?t:this.lineHeight,e){case"+x":this.left+=t,this.right+=t;break;case"-x":this.left-=t,this.right-=t;break;case"+y":this.top+=t,this.bottom+=t;break;case"-y":this.top-=t,this.bottom-=t}},qe.prototype.overlaps=function(e){return this.left<e.right&&this.right>e.left&&this.top<e.bottom&&this.bottom>e.top},qe.prototype.overlapsAny=function(e){for(var t=0;t<e.length;t++)if(this.overlaps(e[t]))return!0;return!1},qe.prototype.within=function(e){return this.top>=e.top&&this.bottom<=e.bottom&&this.left>=e.left&&this.right<=e.right},qe.prototype.overlapsOppositeAxis=function(e,t){switch(t){case"+x":return this.left<e.left;case"-x":return this.right>e.right;case"+y":return this.top<e.top;case"-y":return this.bottom>e.bottom}},qe.prototype.intersectPercentage=function(e){return Math.max(0,Math.min(this.right,e.right)-Math.max(this.left,e.left))*Math.max(0,Math.min(this.bottom,e.bottom)-Math.max(this.top,e.top))/(this.height*this.width)},qe.prototype.toCSSCompatValues=function(e){return{top:this.top-e.top,bottom:e.bottom-this.bottom,left:this.left-e.left,right:e.right-this.right,height:this.height,width:this.width}},qe.getSimpleBoxPosition=function(e){var t=e.div?e.div.offsetHeight:e.tagName?e.offsetHeight:0,i=e.div?e.div.offsetWidth:e.tagName?e.offsetWidth:0,n=e.div?e.div.offsetTop:e.tagName?e.offsetTop:0;return{left:(e=e.div?e.div.getBoundingClientRect():e.tagName?e.getBoundingClientRect():e).left,right:e.right,top:e.top||n,height:e.height||t,bottom:e.bottom||n+(e.height||t),width:e.width||i}},He.StringDecoder=function(){return{decode:function(e){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}},He.convertCueToDOMTree=function(e,t){return e&&t?Re(e,t):null};He.processCues=function(e,t,i){if(!e||!t||!i)return null;for(;i.firstChild;)i.removeChild(i.firstChild);var n=e.document.createElement("div");if(n.style.position="absolute",n.style.left="0",n.style.right="0",n.style.top="0",n.style.bottom="0",n.style.margin="1.5%",i.appendChild(n),function(e){for(var t=0;t<e.length;t++)if(e[t].hasBeenReset||!e[t].displayState)return!0;return!1}(t)){var r=[],a=qe.getSimpleBoxPosition(n),s={font:Math.round(.05*a.height*100)/100+"px sans-serif"};!function(){for(var i,o,u=0;u<t.length;u++)o=t[u],i=new je(e,o,s),n.appendChild(i.div),Ve(0,i,a,r),o.displayState=i.div,r.push(qe.getSimpleBoxPosition(i))}()}else for(var o=0;o<t.length;o++)n.appendChild(t[o].displayState)},He.Parser=function(e,t,i){i||(i=t,t={}),t||(t={}),this.window=e,this.vttjs=t,this.state="INITIAL",this.buffer="",this.decoder=i||new TextDecoder("utf8"),this.regionList=[]},He.Parser.prototype={reportOrThrowError:function(e){if(!(e instanceof ke))throw e;this.onparsingerror&&this.onparsingerror(e)},parse:function(e){var t=this;function i(){for(var e=t.buffer,i=0;i<e.length&&"\r"!==e[i]&&"\n"!==e[i];)++i;var n=e.substr(0,i);return"\r"===e[i]&&++i,"\n"===e[i]&&++i,t.buffer=e.substr(i),n}function n(e){e.match(/X-TIMESTAMP-MAP/)?Ie(e,(function(e,i){if("X-TIMESTAMP-MAP"===e)!function(e){var i=new xe;Ie(e,(function(e,t){switch(e){case"MPEGT":i.integer(e+"S",t);break;case"LOCA":i.set(e+"L",Ce(t))}}),/[^\d]:/,/,/),t.ontimestampmap&&t.ontimestampmap({MPEGTS:i.get("MPEGTS"),LOCAL:i.get("LOCAL")})}(i)}),/=/):Ie(e,(function(e,i){if("Region"===e)!function(e){var i=new xe;if(Ie(e,(function(e,t){switch(e){case"id":i.set(e,t);break;case"width":i.percent(e,t);break;case"lines":i.integer(e,t);break;case"regionanchor":case"viewportanchor":var n=t.split(",");if(2!==n.length)break;var r=new xe;if(r.percent("x",n[0]),r.percent("y",n[1]),!r.has("x")||!r.has("y"))break;i.set(e+"X",r.get("x")),i.set(e+"Y",r.get("y"));break;case"scroll":i.alt(e,t,["up"])}}),/=/,/\s/),i.has("id")){var n=new(t.vttjs.VTTRegion||t.window.VTTRegion);n.width=i.get("width",100),n.lines=i.get("lines",3),n.regionAnchorX=i.get("regionanchorX",0),n.regionAnchorY=i.get("regionanchorY",100),n.viewportAnchorX=i.get("viewportanchorX",0),n.viewportAnchorY=i.get("viewportanchorY",100),n.scroll=i.get("scroll",""),t.onregion&&t.onregion(n),t.regionList.push({id:i.get("id"),region:n})}}(i)}),/:/)}e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));try{var r;if("INITIAL"===t.state){if(!/\r\n|\n/.test(t.buffer))return this;var a=(r=i()).match(/^WEBVTT([ \t].*)?$/);if(!a||!a[0])throw new ke(ke.Errors.BadSignature);t.state="HEADER"}for(var s=!1;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(s?s=!1:r=i(),t.state){case"HEADER":/:/.test(r)?n(r):r||(t.state="ID");continue;case"NOTE":r||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(r)){t.state="NOTE";break}if(!r)continue;t.cue=new(t.vttjs.VTTCue||t.window.VTTCue)(0,0,"");try{t.cue.align="center"}catch(e){t.cue.align="middle"}if(t.state="CUE",-1===r.indexOf("--\x3e")){t.cue.id=r;continue}case"CUE":try{Ae(r,t.cue,t.regionList)}catch(e){t.reportOrThrowError(e),t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":var o=-1!==r.indexOf("--\x3e");if(!r||o&&(s=!0)){t.oncue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}t.cue.text&&(t.cue.text+="\n"),t.cue.text+=r.replace(/\u2028/g,"\n").replace(/u2029/g,"\n");continue;case"BADCUE":r||(t.state="ID");continue}}}catch(e){t.reportOrThrowError(e),"CUETEXT"===t.state&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state="INITIAL"===t.state?"BADWEBVTT":"BADCUE"}return this},flush:function(){var e=this;try{if(e.buffer+=e.decoder.decode(),(e.cue||"HEADER"===e.state)&&(e.buffer+="\n\n",e.parse()),"INITIAL"===e.state)throw new ke(ke.Errors.BadSignature)}catch(t){e.reportOrThrowError(t)}return e.onflush&&e.onflush(),this}};var We=He,Ge={"":1,lr:1,rl:1},ze={start:1,center:1,end:1,left:1,right:1,auto:1,"line-left":1,"line-right":1};function Xe(e){return"string"==typeof e&&(!!ze[e.toLowerCase()]&&e.toLowerCase())}function Ke(e,t,i){this.hasBeenReset=!1;var n="",r=!1,a=e,s=t,o=i,u=null,l="",c=!0,d="auto",h="start",p="auto",f="auto",m=100,g="center";Object.defineProperties(this,{id:{enumerable:!0,get:function(){return n},set:function(e){n=""+e}},pauseOnExit:{enumerable:!0,get:function(){return r},set:function(e){r=!!e}},startTime:{enumerable:!0,get:function(){return a},set:function(e){if("number"!=typeof e)throw new TypeError("Start time must be set to a number.");a=e,this.hasBeenReset=!0}},endTime:{enumerable:!0,get:function(){return s},set:function(e){if("number"!=typeof e)throw new TypeError("End time must be set to a number.");s=e,this.hasBeenReset=!0}},text:{enumerable:!0,get:function(){return o},set:function(e){o=""+e,this.hasBeenReset=!0}},region:{enumerable:!0,get:function(){return u},set:function(e){u=e,this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return l},set:function(e){var t=function(e){return"string"==typeof e&&!!Ge[e.toLowerCase()]&&e.toLowerCase()}(e);if(!1===t)throw new SyntaxError("Vertical: an invalid or illegal direction string was specified.");l=t,this.hasBeenReset=!0}},snapToLines:{enumerable:!0,get:function(){return c},set:function(e){c=!!e,this.hasBeenReset=!0}},line:{enumerable:!0,get:function(){return d},set:function(e){if("number"!=typeof e&&"auto"!==e)throw new SyntaxError("Line: an invalid number or illegal string was specified.");d=e,this.hasBeenReset=!0}},lineAlign:{enumerable:!0,get:function(){return h},set:function(e){var t=Xe(e);t?(h=t,this.hasBeenReset=!0):console.warn("lineAlign: an invalid or illegal string was specified.")}},position:{enumerable:!0,get:function(){return p},set:function(e){if(e<0||e>100)throw new Error("Position must be between 0 and 100.");p=e,this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return f},set:function(e){var t=Xe(e);t?(f=t,this.hasBeenReset=!0):console.warn("positionAlign: an invalid or illegal string was specified.")}},size:{enumerable:!0,get:function(){return m},set:function(e){if(e<0||e>100)throw new Error("Size must be between 0 and 100.");m=e,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return g},set:function(e){var t=Xe(e);if(!t)throw new SyntaxError("align: an invalid or illegal alignment string was specified.");g=t,this.hasBeenReset=!0}}}),this.displayState=void 0}Ke.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)};var Ye=Ke,Qe={"":!0,up:!0};function $e(e){return"number"==typeof e&&e>=0&&e<=100}var Je=function(){var e=100,t=3,i=0,n=100,r=0,a=100,s="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return e},set:function(t){if(!$e(t))throw new Error("Width must be between 0 and 100.");e=t}},lines:{enumerable:!0,get:function(){return t},set:function(e){if("number"!=typeof e)throw new TypeError("Lines must be set to a number.");t=e}},regionAnchorY:{enumerable:!0,get:function(){return n},set:function(e){if(!$e(e))throw new Error("RegionAnchorX must be between 0 and 100.");n=e}},regionAnchorX:{enumerable:!0,get:function(){return i},set:function(e){if(!$e(e))throw new Error("RegionAnchorY must be between 0 and 100.");i=e}},viewportAnchorY:{enumerable:!0,get:function(){return a},set:function(e){if(!$e(e))throw new Error("ViewportAnchorY must be between 0 and 100.");a=e}},viewportAnchorX:{enumerable:!0,get:function(){return r},set:function(e){if(!$e(e))throw new Error("ViewportAnchorX must be between 0 and 100.");r=e}},scroll:{enumerable:!0,get:function(){return s},set:function(e){var t=function(e){return"string"==typeof e&&!!Qe[e.toLowerCase()]&&e.toLowerCase()}(e);!1===t?console.warn("Scroll: an invalid or illegal string was specified."):s=t}}})},Ze=d,et=Se.exports={WebVTT:We,VTTCue:Ye,VTTRegion:Je};Ze.vttjs=et,Ze.WebVTT=et.WebVTT;var tt=et.VTTCue,it=et.VTTRegion,nt=Ze.VTTCue,rt=Ze.VTTRegion;function at(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(at=function(){return!!e})()}function st(e,t,i){if(at())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,t);var r=new(e.bind.apply(e,n));return i&&se(r,i.prototype),r}et.shim=function(){Ze.VTTCue=tt,Ze.VTTRegion=it},et.restore=function(){Ze.VTTCue=nt,Ze.VTTRegion=rt},Ze.VTTCue||et.shim();var ot,ut={exports:{}};ot=ut,function(e){var t=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,i=/^(?=([^\/?#]*))\1([^]*)$/,n=/(?:\/|^)\.(?=\/)/g,r=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,a={buildAbsoluteURL:function(e,t,n){if(n=n||{},e=e.trim(),!(t=t.trim())){if(!n.alwaysNormalize)return e;var r=a.parseURL(e);if(!r)throw new Error("Error trying to parse base URL.");return r.path=a.normalizePath(r.path),a.buildURLFromParts(r)}var s=a.parseURL(t);if(!s)throw new Error("Error trying to parse relative URL.");if(s.scheme)return n.alwaysNormalize?(s.path=a.normalizePath(s.path),a.buildURLFromParts(s)):t;var o=a.parseURL(e);if(!o)throw new Error("Error trying to parse base URL.");if(!o.netLoc&&o.path&&"/"!==o.path[0]){var u=i.exec(o.path);o.netLoc=u[1],o.path=u[2]}o.netLoc&&!o.path&&(o.path="/");var l={scheme:o.scheme,netLoc:s.netLoc,path:null,params:s.params,query:s.query,fragment:s.fragment};if(!s.netLoc&&(l.netLoc=o.netLoc,"/"!==s.path[0]))if(s.path){var c=o.path,d=c.substring(0,c.lastIndexOf("/")+1)+s.path;l.path=a.normalizePath(d)}else l.path=o.path,s.params||(l.params=o.params,s.query||(l.query=o.query));return null===l.path&&(l.path=n.alwaysNormalize?a.normalizePath(s.path):s.path),a.buildURLFromParts(l)},parseURL:function(e){var i=t.exec(e);return i?{scheme:i[1]||"",netLoc:i[2]||"",path:i[3]||"",params:i[4]||"",query:i[5]||"",fragment:i[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(n,"");e.length!==(e=e.replace(r,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}};ot.exports=a}();var lt=ut.exports,ct="http://example.com",dt=function(e,t){if(/^[a-z]+:/i.test(t))return t;/^data:/.test(e)&&(e=d.location&&d.location.href||"");var i="function"==typeof d.URL,n=/^\/\//.test(e),r=!d.location&&!/\/\//i.test(e);if(i?e=new d.URL(e,d.location||ct):/\/\//i.test(e)||(e=lt.buildAbsoluteURL(d.location&&d.location.href||"",e)),i){var a=new URL(t,e);return r?a.href.slice(18):n?a.href.slice(a.protocol.length):a.href}return lt.buildAbsoluteURL(e,t)},ht=function(){function e(){this.listeners={}}var t=e.prototype;return t.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},t.off=function(e,t){if(!this.listeners[e])return!1;var i=this.listeners[e].indexOf(t);return this.listeners[e]=this.listeners[e].slice(0),this.listeners[e].splice(i,1),i>-1},t.trigger=function(e){var t=this.listeners[e];if(t)if(2===arguments.length)for(var i=t.length,n=0;n<i;++n)t[n].call(this,arguments[1]);else for(var r=Array.prototype.slice.call(arguments,1),a=t.length,s=0;s<a;++s)t[s].apply(this,r)},t.dispose=function(){this.listeners={}},t.pipe=function(e){this.on("data",(function(t){e.push(t)}))},e}();function pt(e){for(var t,i=(t=e,d.atob?d.atob(t):Buffer.from(t,"base64").toString("binary")),n=new Uint8Array(i.length),r=0;r<i.length;r++)n[r]=i.charCodeAt(r);return n}/*! @name m3u8-parser @version 4.8.0 @license Apache-2.0 */var ft,mt,gt=function(e){function t(){var t;return(t=e.call(this)||this).buffer="",t}return oe(t,e),t.prototype.push=function(e){var t;for(this.buffer+=e,t=this.buffer.indexOf("\n");t>-1;t=this.buffer.indexOf("\n"))this.trigger("data",this.buffer.substring(0,t)),this.buffer=this.buffer.substring(t+1)},t}(ht),vt=String.fromCharCode(9),yt=function(e){var t=/([0-9.]*)?@?([0-9.]*)?/.exec(e||""),i={};return t[1]&&(i.length=parseInt(t[1],10)),t[2]&&(i.offset=parseInt(t[2],10)),i},_t=function(e){for(var t,i=e.split(new RegExp('(?:^|,)((?:[^=]*)=(?:"[^"]*"|[^,]*))')),n={},r=i.length;r--;)""!==i[r]&&((t=/([^=]*)=(.*)/.exec(i[r]).slice(1))[0]=t[0].replace(/^\s+|\s+$/g,""),t[1]=t[1].replace(/^\s+|\s+$/g,""),t[1]=t[1].replace(/^['"](.*)['"]$/g,"$1"),n[t[0]]=t[1]);return n},bt=function(e){function t(){var t;return(t=e.call(this)||this).customParsers=[],t.tagMappers=[],t}oe(t,e);var i=t.prototype;return i.push=function(e){var t,i,n=this;0!==(e=e.trim()).length&&("#"===e[0]?this.tagMappers.reduce((function(t,i){var n=i(e);return n===e?t:t.concat([n])}),[e]).forEach((function(e){for(var r=0;r<n.customParsers.length;r++)if(n.customParsers[r].call(n,e))return;if(0===e.indexOf("#EXT"))if(e=e.replace("\r",""),t=/^#EXTM3U/.exec(e))n.trigger("data",{type:"tag",tagType:"m3u"});else{if(t=/^#EXTINF:?([0-9\.]*)?,?(.*)?$/.exec(e))return i={type:"tag",tagType:"inf"},t[1]&&(i.duration=parseFloat(t[1])),t[2]&&(i.title=t[2]),void n.trigger("data",i);if(t=/^#EXT-X-TARGETDURATION:?([0-9.]*)?/.exec(e))return i={type:"tag",tagType:"targetduration"},t[1]&&(i.duration=parseInt(t[1],10)),void n.trigger("data",i);if(t=/^#EXT-X-VERSION:?([0-9.]*)?/.exec(e))return i={type:"tag",tagType:"version"},t[1]&&(i.version=parseInt(t[1],10)),void n.trigger("data",i);if(t=/^#EXT-X-MEDIA-SEQUENCE:?(\-?[0-9.]*)?/.exec(e))return i={type:"tag",tagType:"media-sequence"},t[1]&&(i.number=parseInt(t[1],10)),void n.trigger("data",i);if(t=/^#EXT-X-DISCONTINUITY-SEQUENCE:?(\-?[0-9.]*)?/.exec(e))return i={type:"tag",tagType:"discontinuity-sequence"},t[1]&&(i.number=parseInt(t[1],10)),void n.trigger("data",i);if(t=/^#EXT-X-PLAYLIST-TYPE:?(.*)?$/.exec(e))return i={type:"tag",tagType:"playlist-type"},t[1]&&(i.playlistType=t[1]),void n.trigger("data",i);if(t=/^#EXT-X-BYTERANGE:?(.*)?$/.exec(e))return i=ie(yt(t[1]),{type:"tag",tagType:"byterange"}),void n.trigger("data",i);if(t=/^#EXT-X-ALLOW-CACHE:?(YES|NO)?/.exec(e))return i={type:"tag",tagType:"allow-cache"},t[1]&&(i.allowed=!/NO/.test(t[1])),void n.trigger("data",i);if(t=/^#EXT-X-MAP:?(.*)$/.exec(e)){if(i={type:"tag",tagType:"map"},t[1]){var a=_t(t[1]);a.URI&&(i.uri=a.URI),a.BYTERANGE&&(i.byterange=yt(a.BYTERANGE))}n.trigger("data",i)}else if(t=/^#EXT-X-STREAM-INF:?(.*)$/.exec(e)){if(i={type:"tag",tagType:"stream-inf"},t[1]){if(i.attributes=_t(t[1]),i.attributes.RESOLUTION){var s=i.attributes.RESOLUTION.split("x"),o={};s[0]&&(o.width=parseInt(s[0],10)),s[1]&&(o.height=parseInt(s[1],10)),i.attributes.RESOLUTION=o}i.attributes.BANDWIDTH&&(i.attributes.BANDWIDTH=parseInt(i.attributes.BANDWIDTH,10)),i.attributes["FRAME-RATE"]&&(i.attributes["FRAME-RATE"]=parseFloat(i.attributes["FRAME-RATE"])),i.attributes["PROGRAM-ID"]&&(i.attributes["PROGRAM-ID"]=parseInt(i.attributes["PROGRAM-ID"],10))}n.trigger("data",i)}else{if(t=/^#EXT-X-MEDIA:?(.*)$/.exec(e))return i={type:"tag",tagType:"media"},t[1]&&(i.attributes=_t(t[1])),void n.trigger("data",i);if(t=/^#EXT-X-ENDLIST/.exec(e))n.trigger("data",{type:"tag",tagType:"endlist"});else if(t=/^#EXT-X-DISCONTINUITY/.exec(e))n.trigger("data",{type:"tag",tagType:"discontinuity"});else{if(t=/^#EXT-X-PROGRAM-DATE-TIME:?(.*)$/.exec(e))return i={type:"tag",tagType:"program-date-time"},t[1]&&(i.dateTimeString=t[1],i.dateTimeObject=new Date(t[1])),void n.trigger("data",i);if(t=/^#EXT-X-KEY:?(.*)$/.exec(e))return i={type:"tag",tagType:"key"},t[1]&&(i.attributes=_t(t[1]),i.attributes.IV&&("0x"===i.attributes.IV.substring(0,2).toLowerCase()&&(i.attributes.IV=i.attributes.IV.substring(2)),i.attributes.IV=i.attributes.IV.match(/.{8}/g),i.attributes.IV[0]=parseInt(i.attributes.IV[0],16),i.attributes.IV[1]=parseInt(i.attributes.IV[1],16),i.attributes.IV[2]=parseInt(i.attributes.IV[2],16),i.attributes.IV[3]=parseInt(i.attributes.IV[3],16),i.attributes.IV=new Uint32Array(i.attributes.IV))),void n.trigger("data",i);if(t=/^#EXT-X-START:?(.*)$/.exec(e))return i={type:"tag",tagType:"start"},t[1]&&(i.attributes=_t(t[1]),i.attributes["TIME-OFFSET"]=parseFloat(i.attributes["TIME-OFFSET"]),i.attributes.PRECISE=/YES/.test(i.attributes.PRECISE)),void n.trigger("data",i);if(t=/^#EXT-X-CUE-OUT-CONT:?(.*)?$/.exec(e))return i={type:"tag",tagType:"cue-out-cont"},t[1]?i.data=t[1]:i.data="",void n.trigger("data",i);if(t=/^#EXT-X-CUE-OUT:?(.*)?$/.exec(e))return i={type:"tag",tagType:"cue-out"},t[1]?i.data=t[1]:i.data="",void n.trigger("data",i);if(t=/^#EXT-X-CUE-IN:?(.*)?$/.exec(e))return i={type:"tag",tagType:"cue-in"},t[1]?i.data=t[1]:i.data="",void n.trigger("data",i);if((t=/^#EXT-X-SKIP:(.*)$/.exec(e))&&t[1])return(i={type:"tag",tagType:"skip"}).attributes=_t(t[1]),i.attributes.hasOwnProperty("SKIPPED-SEGMENTS")&&(i.attributes["SKIPPED-SEGMENTS"]=parseInt(i.attributes["SKIPPED-SEGMENTS"],10)),i.attributes.hasOwnProperty("RECENTLY-REMOVED-DATERANGES")&&(i.attributes["RECENTLY-REMOVED-DATERANGES"]=i.attributes["RECENTLY-REMOVED-DATERANGES"].split(vt)),void n.trigger("data",i);if((t=/^#EXT-X-PART:(.*)$/.exec(e))&&t[1])return(i={type:"tag",tagType:"part"}).attributes=_t(t[1]),["DURATION"].forEach((function(e){i.attributes.hasOwnProperty(e)&&(i.attributes[e]=parseFloat(i.attributes[e]))})),["INDEPENDENT","GAP"].forEach((function(e){i.attributes.hasOwnProperty(e)&&(i.attributes[e]=/YES/.test(i.attributes[e]))})),i.attributes.hasOwnProperty("BYTERANGE")&&(i.attributes.byterange=yt(i.attributes.BYTERANGE)),void n.trigger("data",i);if((t=/^#EXT-X-SERVER-CONTROL:(.*)$/.exec(e))&&t[1])return(i={type:"tag",tagType:"server-control"}).attributes=_t(t[1]),["CAN-SKIP-UNTIL","PART-HOLD-BACK","HOLD-BACK"].forEach((function(e){i.attributes.hasOwnProperty(e)&&(i.attributes[e]=parseFloat(i.attributes[e]))})),["CAN-SKIP-DATERANGES","CAN-BLOCK-RELOAD"].forEach((function(e){i.attributes.hasOwnProperty(e)&&(i.attributes[e]=/YES/.test(i.attributes[e]))})),void n.trigger("data",i);if((t=/^#EXT-X-PART-INF:(.*)$/.exec(e))&&t[1])return(i={type:"tag",tagType:"part-inf"}).attributes=_t(t[1]),["PART-TARGET"].forEach((function(e){i.attributes.hasOwnProperty(e)&&(i.attributes[e]=parseFloat(i.attributes[e]))})),void n.trigger("data",i);if((t=/^#EXT-X-PRELOAD-HINT:(.*)$/.exec(e))&&t[1])return(i={type:"tag",tagType:"preload-hint"}).attributes=_t(t[1]),["BYTERANGE-START","BYTERANGE-LENGTH"].forEach((function(e){if(i.attributes.hasOwnProperty(e)){i.attributes[e]=parseInt(i.attributes[e],10);var t="BYTERANGE-LENGTH"===e?"length":"offset";i.attributes.byterange=i.attributes.byterange||{},i.attributes.byterange[t]=i.attributes[e],delete i.attributes[e]}})),void n.trigger("data",i);if((t=/^#EXT-X-RENDITION-REPORT:(.*)$/.exec(e))&&t[1])return(i={type:"tag",tagType:"rendition-report"}).attributes=_t(t[1]),["LAST-MSN","LAST-PART"].forEach((function(e){i.attributes.hasOwnProperty(e)&&(i.attributes[e]=parseInt(i.attributes[e],10))})),void n.trigger("data",i);n.trigger("data",{type:"tag",data:e.slice(4)})}}}else n.trigger("data",{type:"comment",text:e.slice(1)})})):this.trigger("data",{type:"uri",uri:e}))},i.addParser=function(e){var t=this,i=e.expression,n=e.customType,r=e.dataParser,a=e.segment;"function"!=typeof r&&(r=function(e){return e}),this.customParsers.push((function(e){if(i.exec(e))return t.trigger("data",{type:"custom",data:r(e),customType:n,segment:a}),!0}))},i.addTagMapper=function(e){var t=e.expression,i=e.map;this.tagMappers.push((function(e){return t.test(e)?i(e):e}))},t}(ht),Tt=function(e){var t={};return Object.keys(e).forEach((function(i){var n;t[(n=i,n.toLowerCase().replace(/-(\w)/g,(function(e){return e[1].toUpperCase()})))]=e[i]})),t},St=function(e){var t=e.serverControl,i=e.targetDuration,n=e.partTargetDuration;if(t){var r="#EXT-X-SERVER-CONTROL",a="holdBack",s="partHoldBack",o=i&&3*i,u=n&&2*n;i&&!t.hasOwnProperty(a)&&(t[a]=o,this.trigger("info",{message:r+" defaulting HOLD-BACK to targetDuration * 3 ("+o+")."})),o&&t[a]<o&&(this.trigger("warn",{message:r+" clamping HOLD-BACK ("+t[a]+") to targetDuration * 3 ("+o+")"}),t[a]=o),n&&!t.hasOwnProperty(s)&&(t[s]=3*n,this.trigger("info",{message:r+" defaulting PART-HOLD-BACK to partTargetDuration * 3 ("+t[s]+")."})),n&&t[s]<u&&(this.trigger("warn",{message:r+" clamping PART-HOLD-BACK ("+t[s]+") to partTargetDuration * 2 ("+u+")."}),t[s]=u)}},Et=function(e){function t(){var t;(t=e.call(this)||this).lineStream=new gt,t.parseStream=new bt,t.lineStream.pipe(t.parseStream);var i,n,r=ae(t),a=[],s={},o=!1,u=function(){},l={AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},c=0;t.manifest={allowCache:!0,discontinuityStarts:[],segments:[]};var d=0,h=0;return t.on("end",(function(){s.uri||!s.parts&&!s.preloadHints||(!s.map&&i&&(s.map=i),!s.key&&n&&(s.key=n),s.timeline||"number"!=typeof c||(s.timeline=c),t.manifest.preloadSegment=s)})),t.parseStream.on("data",(function(e){var t,p;({tag:function(){({version:function(){e.version&&(this.manifest.version=e.version)},"allow-cache":function(){this.manifest.allowCache=e.allowed,"allowed"in e||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange:function(){var t={};"length"in e&&(s.byterange=t,t.length=e.length,"offset"in e||(e.offset=d)),"offset"in e&&(s.byterange=t,t.offset=e.offset),d=t.offset+t.length},endlist:function(){this.manifest.endList=!0},inf:function(){"mediaSequence"in this.manifest||(this.manifest.mediaSequence=0,this.trigger("info",{message:"defaulting media sequence to zero"})),"discontinuitySequence"in this.manifest||(this.manifest.discontinuitySequence=0,this.trigger("info",{message:"defaulting discontinuity sequence to zero"})),e.duration>0&&(s.duration=e.duration),0===e.duration&&(s.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=a},key:function(){if(e.attributes)if("NONE"!==e.attributes.METHOD)if(e.attributes.URI){if("com.apple.streamingkeydelivery"===e.attributes.KEYFORMAT)return this.manifest.contentProtection=this.manifest.contentProtection||{},void(this.manifest.contentProtection["com.apple.fps.1_0"]={attributes:e.attributes});if("com.microsoft.playready"===e.attributes.KEYFORMAT)return this.manifest.contentProtection=this.manifest.contentProtection||{},void(this.manifest.contentProtection["com.microsoft.playready"]={uri:e.attributes.URI});if("urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"===e.attributes.KEYFORMAT){return-1===["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(e.attributes.METHOD)?void this.trigger("warn",{message:"invalid key method provided for Widevine"}):("SAMPLE-AES-CENC"===e.attributes.METHOD&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),"data:text/plain;base64,"!==e.attributes.URI.substring(0,23)?void this.trigger("warn",{message:"invalid key URI provided for Widevine"}):e.attributes.KEYID&&"0x"===e.attributes.KEYID.substring(0,2)?(this.manifest.contentProtection=this.manifest.contentProtection||{},void(this.manifest.contentProtection["com.widevine.alpha"]={attributes:{schemeIdUri:e.attributes.KEYFORMAT,keyId:e.attributes.KEYID.substring(2)},pssh:pt(e.attributes.URI.split(",")[1])})):void this.trigger("warn",{message:"invalid key ID provided for Widevine"}))}e.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),n={method:e.attributes.METHOD||"AES-128",uri:e.attributes.URI},void 0!==e.attributes.IV&&(n.iv=e.attributes.IV)}else this.trigger("warn",{message:"ignoring key declaration without URI"});else n=null;else this.trigger("warn",{message:"ignoring key declaration without attribute list"})},"media-sequence":function(){isFinite(e.number)?this.manifest.mediaSequence=e.number:this.trigger("warn",{message:"ignoring invalid media sequence: "+e.number})},"discontinuity-sequence":function(){isFinite(e.number)?(this.manifest.discontinuitySequence=e.number,c=e.number):this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+e.number})},"playlist-type":function(){/VOD|EVENT/.test(e.playlistType)?this.manifest.playlistType=e.playlistType:this.trigger("warn",{message:"ignoring unknown playlist type: "+e.playlist})},map:function(){i={},e.uri&&(i.uri=e.uri),e.byterange&&(i.byterange=e.byterange),n&&(i.key=n)},"stream-inf":function(){this.manifest.playlists=a,this.manifest.mediaGroups=this.manifest.mediaGroups||l,e.attributes?(s.attributes||(s.attributes={}),ie(s.attributes,e.attributes)):this.trigger("warn",{message:"ignoring empty stream-inf attributes"})},media:function(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||l,e.attributes&&e.attributes.TYPE&&e.attributes["GROUP-ID"]&&e.attributes.NAME){var i=this.manifest.mediaGroups[e.attributes.TYPE];i[e.attributes["GROUP-ID"]]=i[e.attributes["GROUP-ID"]]||{},t=i[e.attributes["GROUP-ID"]],(p={default:/yes/i.test(e.attributes.DEFAULT)}).default?p.autoselect=!0:p.autoselect=/yes/i.test(e.attributes.AUTOSELECT),e.attributes.LANGUAGE&&(p.language=e.attributes.LANGUAGE),e.attributes.URI&&(p.uri=e.attributes.URI),e.attributes["INSTREAM-ID"]&&(p.instreamId=e.attributes["INSTREAM-ID"]),e.attributes.CHARACTERISTICS&&(p.characteristics=e.attributes.CHARACTERISTICS),e.attributes.FORCED&&(p.forced=/yes/i.test(e.attributes.FORCED)),t[e.attributes.NAME]=p}else this.trigger("warn",{message:"ignoring incomplete or missing media group"})},discontinuity:function(){c+=1,s.discontinuity=!0,this.manifest.discontinuityStarts.push(a.length)},"program-date-time":function(){void 0===this.manifest.dateTimeString&&(this.manifest.dateTimeString=e.dateTimeString,this.manifest.dateTimeObject=e.dateTimeObject),s.dateTimeString=e.dateTimeString,s.dateTimeObject=e.dateTimeObject},targetduration:function(){!isFinite(e.duration)||e.duration<0?this.trigger("warn",{message:"ignoring invalid target duration: "+e.duration}):(this.manifest.targetDuration=e.duration,St.call(this,this.manifest))},start:function(){e.attributes&&!isNaN(e.attributes["TIME-OFFSET"])?this.manifest.start={timeOffset:e.attributes["TIME-OFFSET"],precise:e.attributes.PRECISE}:this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"})},"cue-out":function(){s.cueOut=e.data},"cue-out-cont":function(){s.cueOutCont=e.data},"cue-in":function(){s.cueIn=e.data},skip:function(){this.manifest.skip=Tt(e.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",e.attributes,["SKIPPED-SEGMENTS"])},part:function(){var t=this;o=!0;var i=this.manifest.segments.length,n=Tt(e.attributes);s.parts=s.parts||[],s.parts.push(n),n.byterange&&(n.byterange.hasOwnProperty("offset")||(n.byterange.offset=h),h=n.byterange.offset+n.byterange.length);var r=s.parts.length-1;this.warnOnMissingAttributes_("#EXT-X-PART #"+r+" for segment #"+i,e.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach((function(e,i){e.hasOwnProperty("lastPart")||t.trigger("warn",{message:"#EXT-X-RENDITION-REPORT #"+i+" lacks required attribute(s): LAST-PART"})}))},"server-control":function(){var t=this.manifest.serverControl=Tt(e.attributes);t.hasOwnProperty("canBlockReload")||(t.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),St.call(this,this.manifest),t.canSkipDateranges&&!t.hasOwnProperty("canSkipUntil")&&this.trigger("warn",{message:"#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set"})},"preload-hint":function(){var t=this.manifest.segments.length,i=Tt(e.attributes),n=i.type&&"PART"===i.type;s.preloadHints=s.preloadHints||[],s.preloadHints.push(i),i.byterange&&(i.byterange.hasOwnProperty("offset")||(i.byterange.offset=n?h:0,n&&(h=i.byterange.offset+i.byterange.length)));var r=s.preloadHints.length-1;if(this.warnOnMissingAttributes_("#EXT-X-PRELOAD-HINT #"+r+" for segment #"+t,e.attributes,["TYPE","URI"]),i.type)for(var a=0;a<s.preloadHints.length-1;a++){var o=s.preloadHints[a];o.type&&(o.type===i.type&&this.trigger("warn",{message:"#EXT-X-PRELOAD-HINT #"+r+" for segment #"+t+" has the same TYPE "+i.type+" as preload hint #"+a}))}},"rendition-report":function(){var t=Tt(e.attributes);this.manifest.renditionReports=this.manifest.renditionReports||[],this.manifest.renditionReports.push(t);var i=this.manifest.renditionReports.length-1,n=["LAST-MSN","URI"];o&&n.push("LAST-PART"),this.warnOnMissingAttributes_("#EXT-X-RENDITION-REPORT #"+i,e.attributes,n)},"part-inf":function(){this.manifest.partInf=Tt(e.attributes),this.warnOnMissingAttributes_("#EXT-X-PART-INF",e.attributes,["PART-TARGET"]),this.manifest.partInf.partTarget&&(this.manifest.partTargetDuration=this.manifest.partInf.partTarget),St.call(this,this.manifest)}}[e.tagType]||u).call(r)},uri:function(){s.uri=e.uri,a.push(s),this.manifest.targetDuration&&!("duration"in s)&&(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),s.duration=this.manifest.targetDuration),n&&(s.key=n),s.timeline=c,i&&(s.map=i),h=0,s={}},comment:function(){},custom:function(){e.segment?(s.custom=s.custom||{},s.custom[e.customType]=e.data):(this.manifest.custom=this.manifest.custom||{},this.manifest.custom[e.customType]=e.data)}})[e.type].call(r)})),t}oe(t,e);var i=t.prototype;return i.warnOnMissingAttributes_=function(e,t,i){var n=[];i.forEach((function(e){t.hasOwnProperty(e)||n.push(e)})),n.length&&this.trigger("warn",{message:e+" lacks required attribute(s): "+n.join(", ")})},i.push=function(e){this.lineStream.push(e)},i.end=function(){this.lineStream.push("\n"),this.trigger("end")},i.addParser=function(e){this.parseStream.addParser(e)},i.addTagMapper=function(e){this.parseStream.addTagMapper(e)},t}(ht),wt={mp4:/^(av0?1|avc0?[1234]|vp0?9|flac|opus|mp3|mp4a|mp4v|stpp.ttml.im1t)/,webm:/^(vp0?[89]|av0?1|opus|vorbis)/,ogg:/^(vp0?[89]|theora|flac|opus|vorbis)/,video:/^(av0?1|avc0?[1234]|vp0?[89]|hvc1|hev1|theora|mp4v)/,audio:/^(mp4a|flac|vorbis|opus|ac-[34]|ec-3|alac|mp3|speex|aac)/,text:/^(stpp.ttml.im1t)/,muxerVideo:/^(avc0?1)/,muxerAudio:/^(mp4a)/,muxerText:/a^/},kt=["video","audio","text"],Ct=["Video","Audio","Text"],xt=function(e){return e?e.replace(/avc1\.(\d+)\.(\d+)/i,(function(e,t,i){return"avc1."+("00"+Number(t).toString(16)).slice(-2)+"00"+("00"+Number(i).toString(16)).slice(-2)})):e},It=function(e){void 0===e&&(e="");var t=e.split(","),i=[];return t.forEach((function(e){var t;e=e.trim(),kt.forEach((function(n){var r=wt[n].exec(e.toLowerCase());if(r&&!(r.length<=1)){t=n;var a=e.substring(0,r[1].length),s=e.replace(a,"");i.push({type:a,details:s,mediaType:n})}})),t||i.push({type:e,details:"",mediaType:"unknown"})})),i},At=function(e){return void 0===e&&(e=""),wt.audio.test(e.trim().toLowerCase())},Pt=function(e){if(e&&"string"==typeof e){var t,i=e.toLowerCase().split(",").map((function(e){return xt(e.trim())})),n="video";1===i.length&&At(i[0])?n="audio":1===i.length&&(void 0===(t=i[0])&&(t=""),wt.text.test(t.trim().toLowerCase()))&&(n="application");var r="mp4";return i.every((function(e){return wt.mp4.test(e)}))?r="mp4":i.every((function(e){return wt.webm.test(e)}))?r="webm":i.every((function(e){return wt.ogg.test(e)}))&&(r="ogg"),n+"/"+r+';codecs="'+e+'"'}},Lt=function(e){return void 0===e&&(e=""),d.MediaSource&&d.MediaSource.isTypeSupported&&d.MediaSource.isTypeSupported(Pt(e))||!1},Dt=function(e){return void 0===e&&(e=""),e.toLowerCase().split(",").every((function(e){e=e.trim();for(var t=0;t<Ct.length;t++){if(wt["muxer"+Ct[t]].test(e))return!0}return!1}))},Ot="mp4a.40.2",Nt=/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i,Rt=/^application\/dash\+xml/i,Mt=function(e){return Nt.test(e)?"hls":Rt.test(e)?"dash":"application/vnd.videojs.vhs+json"===e?"vhs-json":null},Ut=function(e){return"function"===ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer},Bt=function(e){return e instanceof Uint8Array?e:(Array.isArray(e)||Ut(e)||e instanceof ArrayBuffer||(e="number"!=typeof e||"number"==typeof e&&e!=e?0:[e]),new Uint8Array(e&&e.buffer||e,e&&e.byteOffset||0,e&&e.byteLength||0))},Ft=d.BigInt||Number,jt=[Ft("0x1"),Ft("0x100"),Ft("0x10000"),Ft("0x1000000"),Ft("0x100000000"),Ft("0x10000000000"),Ft("0x1000000000000"),Ft("0x100000000000000"),Ft("0x10000000000000000")];ft=new Uint16Array([65484]),255===(mt=new Uint8Array(ft.buffer,ft.byteOffset,ft.byteLength))[0]||mt[0];var qt=function(e,t){var i=void 0===t?{}:t,n=i.signed,r=void 0!==n&&n,a=i.le,s=void 0!==a&&a;e=Bt(e);var o=s?"reduce":"reduceRight",u=(e[o]?e[o]:Array.prototype[o]).call(e,(function(t,i,n){var r=s?n:Math.abs(n+1-e.length);return t+Ft(i)*jt[r]}),Ft(0));if(r){var l=jt[e.length]/Ft(2)-Ft(1);(u=Ft(u))>l&&(u-=l,u-=l,u-=Ft(2))}return Number(u)},Vt=function(e,t){var i=(void 0===t?{}:t).le,n=void 0!==i&&i;("bigint"!=typeof e&&"number"!=typeof e||"number"==typeof e&&e!=e)&&(e=0),e=Ft(e);for(var r,a=(r=e,Math.ceil(function(e){return e.toString(2).length}(r)/8)),s=new Uint8Array(new ArrayBuffer(a)),o=0;o<a;o++){var u=n?o:Math.abs(o+1-s.length);s[u]=Number(e/jt[o]&Ft(255)),e<0&&(s[u]=Math.abs(~s[u]),s[u]-=0===o?1:2)}return s},Ht=function(e,t){if("string"!=typeof e&&e&&"function"==typeof e.toString&&(e=e.toString()),"string"!=typeof e)return new Uint8Array;t||(e=unescape(encodeURIComponent(e)));for(var i=new Uint8Array(e.length),n=0;n<e.length;n++)i[n]=e.charCodeAt(n);return i},Wt=function(e,t,i){var n=void 0===i?{}:i,r=n.offset,a=void 0===r?0:r,s=n.mask,o=void 0===s?[]:s;e=Bt(e);var u=(t=Bt(t)).every?t.every:Array.prototype.every;return t.length&&e.length-a>=t.length&&u.call(t,(function(t,i){return t===(o[i]?o[i]&e[a+i]:e[a+i])}))},Gt={},zt={};function Xt(e,t){return void 0===t&&(t=Object),t&&"function"==typeof t.freeze?t.freeze(e):e}var Kt=Xt({HTML:"text/html",isHTML:function(e){return e===Kt.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),Yt=Xt({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(e){return e===Yt.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});zt.assign=function(e,t){if(null===e||"object"!==u(e))throw new TypeError("target is not an object");for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},zt.find=function(e,t,i){if(void 0===i&&(i=Array.prototype),e&&"function"==typeof i.find)return i.find.call(e,t);for(var n=0;n<e.length;n++)if(Object.prototype.hasOwnProperty.call(e,n)){var r=e[n];if(t.call(void 0,r,n,e))return r}},zt.freeze=Xt,zt.MIME_TYPE=Kt,zt.NAMESPACE=Yt;var Qt=zt,$t=Qt.find,Jt=Qt.NAMESPACE;function Zt(e){return""!==e}function ei(e,t){return e.hasOwnProperty(t)||(e[t]=!0),e}function ti(e){if(!e)return[];var t=function(e){return e?e.split(/[\t\n\f\r ]+/).filter(Zt):[]}(e);return Object.keys(t.reduce(ei,{}))}function ii(e,t){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}function ni(e,t){var i=e.prototype;if(!(i instanceof t)){function n(){}n.prototype=t.prototype,ii(i,n=new n),e.prototype=i=n}i.constructor!=e&&("function"!=typeof e&&console.error("unknown Class:"+e),i.constructor=e)}var ri={},ai=ri.ELEMENT_NODE=1,si=ri.ATTRIBUTE_NODE=2,oi=ri.TEXT_NODE=3,ui=ri.CDATA_SECTION_NODE=4,li=ri.ENTITY_REFERENCE_NODE=5,ci=ri.ENTITY_NODE=6,di=ri.PROCESSING_INSTRUCTION_NODE=7,hi=ri.COMMENT_NODE=8,pi=ri.DOCUMENT_NODE=9,fi=ri.DOCUMENT_TYPE_NODE=10,mi=ri.DOCUMENT_FRAGMENT_NODE=11,gi=ri.NOTATION_NODE=12,vi={},yi={};vi.INDEX_SIZE_ERR=(yi[1]="Index size error",1),vi.DOMSTRING_SIZE_ERR=(yi[2]="DOMString size error",2);var _i=vi.HIERARCHY_REQUEST_ERR=(yi[3]="Hierarchy request error",3);vi.WRONG_DOCUMENT_ERR=(yi[4]="Wrong document",4),vi.INVALID_CHARACTER_ERR=(yi[5]="Invalid character",5),vi.NO_DATA_ALLOWED_ERR=(yi[6]="No data allowed",6),vi.NO_MODIFICATION_ALLOWED_ERR=(yi[7]="No modification allowed",7);var bi=vi.NOT_FOUND_ERR=(yi[8]="Not found",8);vi.NOT_SUPPORTED_ERR=(yi[9]="Not supported",9);var Ti=vi.INUSE_ATTRIBUTE_ERR=(yi[10]="Attribute in use",10);function Si(e,t){if(t instanceof Error)var i=t;else i=this,Error.call(this,yi[e]),this.message=yi[e],Error.captureStackTrace&&Error.captureStackTrace(this,Si);return i.code=e,t&&(this.message=this.message+": "+t),i}function Ei(){}function wi(e,t){this._node=e,this._refresh=t,ki(this)}function ki(e){var t=e._node._inc||e._node.ownerDocument._inc;if(e._inc!==t){var i=e._refresh(e._node);if(pn(e,"length",i.length),!e.$$length||i.length<e.$$length)for(var n=i.length;n in e;n++)Object.prototype.hasOwnProperty.call(e,n)&&delete e[n];ii(i,e),e._inc=t}}function Ci(){}function xi(e,t){for(var i=e.length;i--;)if(e[i]===t)return i}function Ii(e,t,i,n){if(n?t[xi(t,n)]=i:t[t.length++]=i,e){i.ownerElement=e;var r=e.ownerDocument;r&&(n&&Ri(r,e,n),function(e,t,i){e&&e._inc++;var n=i.namespaceURI;n===Jt.XMLNS&&(t._nsMap[i.prefix?i.localName:""]=i.value)}(r,e,i))}}function Ai(e,t,i){var n=xi(t,i);if(!(n>=0))throw new Si(bi,new Error(e.tagName+"@"+i));for(var r=t.length-1;n<r;)t[n]=t[++n];if(t.length=r,e){var a=e.ownerDocument;a&&(Ri(a,e,i),i.ownerElement=null)}}function Pi(){}function Li(){}function Di(e){return("<"==e?"<":">"==e&&">")||"&"==e&&"&"||'"'==e&&"""||"&#"+e.charCodeAt()+";"}function Oi(e,t){if(t(e))return!0;if(e=e.firstChild)do{if(Oi(e,t))return!0}while(e=e.nextSibling)}function Ni(){this.ownerDocument=this}function Ri(e,t,i,n){e&&e._inc++,i.namespaceURI===Jt.XMLNS&&delete t._nsMap[i.prefix?i.localName:""]}function Mi(e,t,i){if(e&&e._inc){e._inc++;var n=t.childNodes;if(i)n[n.length++]=i;else{for(var r=t.firstChild,a=0;r;)n[a++]=r,r=r.nextSibling;n.length=a,delete n[n.length]}}}function Ui(e,t){var i=t.previousSibling,n=t.nextSibling;return i?i.nextSibling=n:e.firstChild=n,n?n.previousSibling=i:e.lastChild=i,t.parentNode=null,t.previousSibling=null,t.nextSibling=null,Mi(e.ownerDocument,e),t}function Bi(e){return e&&e.nodeType===Li.DOCUMENT_TYPE_NODE}function Fi(e){return e&&e.nodeType===Li.ELEMENT_NODE}function ji(e){return e&&e.nodeType===Li.TEXT_NODE}function qi(e,t){var i=e.childNodes||[];if($t(i,Fi)||Bi(t))return!1;var n=$t(i,Bi);return!(t&&n&&i.indexOf(n)>i.indexOf(t))}function Vi(e,t){var i=e.childNodes||[];if($t(i,(function(e){return Fi(e)&&e!==t})))return!1;var n=$t(i,Bi);return!(t&&n&&i.indexOf(n)>i.indexOf(t))}function Hi(e,t,i){if(!function(e){return e&&(e.nodeType===Li.DOCUMENT_NODE||e.nodeType===Li.DOCUMENT_FRAGMENT_NODE||e.nodeType===Li.ELEMENT_NODE)}(e))throw new Si(_i,"Unexpected parent node type "+e.nodeType);if(i&&i.parentNode!==e)throw new Si(bi,"child not in parent");if(!function(e){return e&&(Fi(e)||ji(e)||Bi(e)||e.nodeType===Li.DOCUMENT_FRAGMENT_NODE||e.nodeType===Li.COMMENT_NODE||e.nodeType===Li.PROCESSING_INSTRUCTION_NODE)}(t)||Bi(t)&&e.nodeType!==Li.DOCUMENT_NODE)throw new Si(_i,"Unexpected node type "+t.nodeType+" for parent node type "+e.nodeType)}function Wi(e,t,i){var n=e.childNodes||[],r=t.childNodes||[];if(t.nodeType===Li.DOCUMENT_FRAGMENT_NODE){var a=r.filter(Fi);if(a.length>1||$t(r,ji))throw new Si(_i,"More than one element or text in fragment");if(1===a.length&&!qi(e,i))throw new Si(_i,"Element in fragment can not be inserted before doctype")}if(Fi(t)&&!qi(e,i))throw new Si(_i,"Only one element can be added and only after doctype");if(Bi(t)){if($t(n,Bi))throw new Si(_i,"Only one doctype is allowed");var s=$t(n,Fi);if(i&&n.indexOf(s)<n.indexOf(i))throw new Si(_i,"Doctype can only be inserted before an element");if(!i&&s)throw new Si(_i,"Doctype can not be appended since element is present")}}function Gi(e,t,i){var n=e.childNodes||[],r=t.childNodes||[];if(t.nodeType===Li.DOCUMENT_FRAGMENT_NODE){var a=r.filter(Fi);if(a.length>1||$t(r,ji))throw new Si(_i,"More than one element or text in fragment");if(1===a.length&&!Vi(e,i))throw new Si(_i,"Element in fragment can not be inserted before doctype")}if(Fi(t)&&!Vi(e,i))throw new Si(_i,"Only one element can be added and only after doctype");if(Bi(t)){function o(e){return Bi(e)&&e!==i}if($t(n,o))throw new Si(_i,"Only one doctype is allowed");var s=$t(n,Fi);if(i&&n.indexOf(s)<n.indexOf(i))throw new Si(_i,"Doctype can only be inserted before an element")}}function zi(e,t,i,n){Hi(e,t,i),e.nodeType===Li.DOCUMENT_NODE&&(n||Wi)(e,t,i);var r=t.parentNode;if(r&&r.removeChild(t),t.nodeType===mi){var a=t.firstChild;if(null==a)return t;var s=t.lastChild}else a=s=t;var o=i?i.previousSibling:e.lastChild;a.previousSibling=o,s.nextSibling=i,o?o.nextSibling=a:e.firstChild=a,null==i?e.lastChild=s:i.previousSibling=s;do{a.parentNode=e}while(a!==s&&(a=a.nextSibling));return Mi(e.ownerDocument||e,e),t.nodeType==mi&&(t.firstChild=t.lastChild=null),t}function Xi(){this._nsMap={}}function Ki(){}function Yi(){}function Qi(){}function $i(){}function Ji(){}function Zi(){}function en(){}function tn(){}function nn(){}function rn(){}function an(){}function sn(){}function on(e,t){var i=[],n=9==this.nodeType&&this.documentElement||this,r=n.prefix,a=n.namespaceURI;if(a&&null==r&&null==(r=n.lookupPrefix(a)))var s=[{namespace:a,prefix:null}];return cn(this,i,e,t,s),i.join("")}function un(e,t,i){var n=e.prefix||"",r=e.namespaceURI;if(!r)return!1;if("xml"===n&&r===Jt.XML||r===Jt.XMLNS)return!1;for(var a=i.length;a--;){var s=i[a];if(s.prefix===n)return s.namespace!==r}return!0}function ln(e,t,i){e.push(" ",t,'="',i.replace(/[<>&"\t\n\r]/g,Di),'"')}function cn(e,t,i,n,r){if(r||(r=[]),n){if(!(e=n(e)))return;if("string"==typeof e)return void t.push(e)}switch(e.nodeType){case ai:var a=e.attributes,s=a.length,o=e.firstChild,u=e.tagName,l=u;if(!(i=Jt.isHTML(e.namespaceURI)||i)&&!e.prefix&&e.namespaceURI){for(var c,d=0;d<a.length;d++)if("xmlns"===a.item(d).name){c=a.item(d).value;break}if(!c)for(var h=r.length-1;h>=0;h--){if(""===(p=r[h]).prefix&&p.namespace===e.namespaceURI){c=p.namespace;break}}if(c!==e.namespaceURI)for(h=r.length-1;h>=0;h--){var p;if((p=r[h]).namespace===e.namespaceURI){p.prefix&&(l=p.prefix+":"+u);break}}}t.push("<",l);for(var f=0;f<s;f++){"xmlns"==(m=a.item(f)).prefix?r.push({prefix:m.localName,namespace:m.value}):"xmlns"==m.nodeName&&r.push({prefix:"",namespace:m.value})}for(f=0;f<s;f++){var m,g,v;if(un(m=a.item(f),0,r))ln(t,(g=m.prefix||"")?"xmlns:"+g:"xmlns",v=m.namespaceURI),r.push({prefix:g,namespace:v});cn(m,t,i,n,r)}if(u===l&&un(e,0,r))ln(t,(g=e.prefix||"")?"xmlns:"+g:"xmlns",v=e.namespaceURI),r.push({prefix:g,namespace:v});if(o||i&&!/^(?:meta|link|img|br|hr|input)$/i.test(u)){if(t.push(">"),i&&/^script$/i.test(u))for(;o;)o.data?t.push(o.data):cn(o,t,i,n,r.slice()),o=o.nextSibling;else for(;o;)cn(o,t,i,n,r.slice()),o=o.nextSibling;t.push("</",l,">")}else t.push("/>");return;case pi:case mi:for(o=e.firstChild;o;)cn(o,t,i,n,r.slice()),o=o.nextSibling;return;case si:return ln(t,e.name,e.value);case oi:return t.push(e.data.replace(/[<&>]/g,Di));case ui:return t.push("<![CDATA[",e.data,"]]>");case hi:return t.push("\x3c!--",e.data,"--\x3e");case fi:var y=e.publicId,_=e.systemId;if(t.push("<!DOCTYPE ",e.name),y)t.push(" PUBLIC ",y),_&&"."!=_&&t.push(" ",_),t.push(">");else if(_&&"."!=_)t.push(" SYSTEM ",_,">");else{var b=e.internalSubset;b&&t.push(" [",b,"]"),t.push(">")}return;case di:return t.push("<?",e.target," ",e.data,"?>");case li:return t.push("&",e.nodeName,";");default:t.push("??",e.nodeName)}}function dn(e,t,i){var n;switch(t.nodeType){case ai:(n=t.cloneNode(!1)).ownerDocument=e;case mi:break;case si:i=!0}if(n||(n=t.cloneNode(!1)),n.ownerDocument=e,n.parentNode=null,i)for(var r=t.firstChild;r;)n.appendChild(dn(e,r,i)),r=r.nextSibling;return n}function hn(e,t,i){var n=new t.constructor;for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){var a=t[r];"object"!=u(a)&&a!=n[r]&&(n[r]=a)}switch(t.childNodes&&(n.childNodes=new Ei),n.ownerDocument=e,n.nodeType){case ai:var s=t.attributes,o=n.attributes=new Ci,l=s.length;o._ownerElement=n;for(var c=0;c<l;c++)n.setAttributeNode(hn(e,s.item(c),!0));break;case si:i=!0}if(i)for(var d=t.firstChild;d;)n.appendChild(hn(e,d,i)),d=d.nextSibling;return n}function pn(e,t,i){e[t]=i}vi.INVALID_STATE_ERR=(yi[11]="Invalid state",11),vi.SYNTAX_ERR=(yi[12]="Syntax error",12),vi.INVALID_MODIFICATION_ERR=(yi[13]="Invalid modification",13),vi.NAMESPACE_ERR=(yi[14]="Invalid namespace",14),vi.INVALID_ACCESS_ERR=(yi[15]="Invalid access",15),Si.prototype=Error.prototype,ii(vi,Si),Ei.prototype={length:0,item:function(e){return e>=0&&e<this.length?this[e]:null},toString:function(e,t){for(var i=[],n=0;n<this.length;n++)cn(this[n],i,e,t);return i.join("")},filter:function(e){return Array.prototype.filter.call(this,e)},indexOf:function(e){return Array.prototype.indexOf.call(this,e)}},wi.prototype.item=function(e){return ki(this),this[e]||null},ni(wi,Ei),Ci.prototype={length:0,item:Ei.prototype.item,getNamedItem:function(e){for(var t=this.length;t--;){var i=this[t];if(i.nodeName==e)return i}},setNamedItem:function(e){var t=e.ownerElement;if(t&&t!=this._ownerElement)throw new Si(Ti);var i=this.getNamedItem(e.nodeName);return Ii(this._ownerElement,this,e,i),i},setNamedItemNS:function(e){var t,i=e.ownerElement;if(i&&i!=this._ownerElement)throw new Si(Ti);return t=this.getNamedItemNS(e.namespaceURI,e.localName),Ii(this._ownerElement,this,e,t),t},removeNamedItem:function(e){var t=this.getNamedItem(e);return Ai(this._ownerElement,this,t),t},removeNamedItemNS:function(e,t){var i=this.getNamedItemNS(e,t);return Ai(this._ownerElement,this,i),i},getNamedItemNS:function(e,t){for(var i=this.length;i--;){var n=this[i];if(n.localName==t&&n.namespaceURI==e)return n}return null}},Pi.prototype={hasFeature:function(e,t){return!0},createDocument:function(e,t,i){var n=new Ni;if(n.implementation=this,n.childNodes=new Ei,n.doctype=i||null,i&&n.appendChild(i),t){var r=n.createElementNS(e,t);n.appendChild(r)}return n},createDocumentType:function(e,t,i){var n=new Zi;return n.name=e,n.nodeName=e,n.publicId=t||"",n.systemId=i||"",n}},Li.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(e,t){return zi(this,e,t)},replaceChild:function(e,t){zi(this,e,t,Gi),t&&this.removeChild(t)},removeChild:function(e){return Ui(this,e)},appendChild:function(e){return this.insertBefore(e,null)},hasChildNodes:function(){return null!=this.firstChild},cloneNode:function(e){return hn(this.ownerDocument||this,this,e)},normalize:function(){for(var e=this.firstChild;e;){var t=e.nextSibling;t&&t.nodeType==oi&&e.nodeType==oi?(this.removeChild(t),e.appendData(t.data)):(e.normalize(),e=t)}},isSupported:function(e,t){return this.ownerDocument.implementation.hasFeature(e,t)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(e){for(var t=this;t;){var i=t._nsMap;if(i)for(var n in i)if(Object.prototype.hasOwnProperty.call(i,n)&&i[n]===e)return n;t=t.nodeType==si?t.ownerDocument:t.parentNode}return null},lookupNamespaceURI:function(e){for(var t=this;t;){var i=t._nsMap;if(i&&Object.prototype.hasOwnProperty.call(i,e))return i[e];t=t.nodeType==si?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(e){return null==this.lookupPrefix(e)}},ii(ri,Li),ii(ri,Li.prototype),Ni.prototype={nodeName:"#document",nodeType:pi,doctype:null,documentElement:null,_inc:1,insertBefore:function(e,t){if(e.nodeType==mi){for(var i=e.firstChild;i;){var n=i.nextSibling;this.insertBefore(i,t),i=n}return e}return zi(this,e,t),e.ownerDocument=this,null===this.documentElement&&e.nodeType===ai&&(this.documentElement=e),e},removeChild:function(e){return this.documentElement==e&&(this.documentElement=null),Ui(this,e)},replaceChild:function(e,t){zi(this,e,t,Gi),e.ownerDocument=this,t&&this.removeChild(t),Fi(e)&&(this.documentElement=e)},importNode:function(e,t){return dn(this,e,t)},getElementById:function(e){var t=null;return Oi(this.documentElement,(function(i){if(i.nodeType==ai&&i.getAttribute("id")==e)return t=i,!0})),t},getElementsByClassName:function(e){var t=ti(e);return new wi(this,(function(i){var n=[];return t.length>0&&Oi(i.documentElement,(function(r){if(r!==i&&r.nodeType===ai){var a=r.getAttribute("class");if(a){var s=e===a;if(!s){var o=ti(a);s=t.every((u=o,function(e){return u&&-1!==u.indexOf(e)}))}s&&n.push(r)}}var u})),n}))},createElement:function(e){var t=new Xi;return t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.localName=e,t.childNodes=new Ei,(t.attributes=new Ci)._ownerElement=t,t},createDocumentFragment:function(){var e=new rn;return e.ownerDocument=this,e.childNodes=new Ei,e},createTextNode:function(e){var t=new Qi;return t.ownerDocument=this,t.appendData(e),t},createComment:function(e){var t=new $i;return t.ownerDocument=this,t.appendData(e),t},createCDATASection:function(e){var t=new Ji;return t.ownerDocument=this,t.appendData(e),t},createProcessingInstruction:function(e,t){var i=new an;return i.ownerDocument=this,i.tagName=i.nodeName=i.target=e,i.nodeValue=i.data=t,i},createAttribute:function(e){var t=new Ki;return t.ownerDocument=this,t.name=e,t.nodeName=e,t.localName=e,t.specified=!0,t},createEntityReference:function(e){var t=new nn;return t.ownerDocument=this,t.nodeName=e,t},createElementNS:function(e,t){var i=new Xi,n=t.split(":"),r=i.attributes=new Ci;return i.childNodes=new Ei,i.ownerDocument=this,i.nodeName=t,i.tagName=t,i.namespaceURI=e,2==n.length?(i.prefix=n[0],i.localName=n[1]):i.localName=t,r._ownerElement=i,i},createAttributeNS:function(e,t){var i=new Ki,n=t.split(":");return i.ownerDocument=this,i.nodeName=t,i.name=t,i.namespaceURI=e,i.specified=!0,2==n.length?(i.prefix=n[0],i.localName=n[1]):i.localName=t,i}},ni(Ni,Li),Xi.prototype={nodeType:ai,hasAttribute:function(e){return null!=this.getAttributeNode(e)},getAttribute:function(e){var t=this.getAttributeNode(e);return t&&t.value||""},getAttributeNode:function(e){return this.attributes.getNamedItem(e)},setAttribute:function(e,t){var i=this.ownerDocument.createAttribute(e);i.value=i.nodeValue=""+t,this.setAttributeNode(i)},removeAttribute:function(e){var t=this.getAttributeNode(e);t&&this.removeAttributeNode(t)},appendChild:function(e){return e.nodeType===mi?this.insertBefore(e,null):function(e,t){return t.parentNode&&t.parentNode.removeChild(t),t.parentNode=e,t.previousSibling=e.lastChild,t.nextSibling=null,t.previousSibling?t.previousSibling.nextSibling=t:e.firstChild=t,e.lastChild=t,Mi(e.ownerDocument,e,t),t}(this,e)},setAttributeNode:function(e){return this.attributes.setNamedItem(e)},setAttributeNodeNS:function(e){return this.attributes.setNamedItemNS(e)},removeAttributeNode:function(e){return this.attributes.removeNamedItem(e.nodeName)},removeAttributeNS:function(e,t){var i=this.getAttributeNodeNS(e,t);i&&this.removeAttributeNode(i)},hasAttributeNS:function(e,t){return null!=this.getAttributeNodeNS(e,t)},getAttributeNS:function(e,t){var i=this.getAttributeNodeNS(e,t);return i&&i.value||""},setAttributeNS:function(e,t,i){var n=this.ownerDocument.createAttributeNS(e,t);n.value=n.nodeValue=""+i,this.setAttributeNode(n)},getAttributeNodeNS:function(e,t){return this.attributes.getNamedItemNS(e,t)},getElementsByTagName:function(e){return new wi(this,(function(t){var i=[];return Oi(t,(function(n){n===t||n.nodeType!=ai||"*"!==e&&n.tagName!=e||i.push(n)})),i}))},getElementsByTagNameNS:function(e,t){return new wi(this,(function(i){var n=[];return Oi(i,(function(r){r===i||r.nodeType!==ai||"*"!==e&&r.namespaceURI!==e||"*"!==t&&r.localName!=t||n.push(r)})),n}))}},Ni.prototype.getElementsByTagName=Xi.prototype.getElementsByTagName,Ni.prototype.getElementsByTagNameNS=Xi.prototype.getElementsByTagNameNS,ni(Xi,Li),Ki.prototype.nodeType=si,ni(Ki,Li),Yi.prototype={data:"",substringData:function(e,t){return this.data.substring(e,e+t)},appendData:function(e){e=this.data+e,this.nodeValue=this.data=e,this.length=e.length},insertData:function(e,t){this.replaceData(e,0,t)},appendChild:function(e){throw new Error(yi[_i])},deleteData:function(e,t){this.replaceData(e,t,"")},replaceData:function(e,t,i){i=this.data.substring(0,e)+i+this.data.substring(e+t),this.nodeValue=this.data=i,this.length=i.length}},ni(Yi,Li),Qi.prototype={nodeName:"#text",nodeType:oi,splitText:function(e){var t=this.data,i=t.substring(e);t=t.substring(0,e),this.data=this.nodeValue=t,this.length=t.length;var n=this.ownerDocument.createTextNode(i);return this.parentNode&&this.parentNode.insertBefore(n,this.nextSibling),n}},ni(Qi,Yi),$i.prototype={nodeName:"#comment",nodeType:hi},ni($i,Yi),Ji.prototype={nodeName:"#cdata-section",nodeType:ui},ni(Ji,Yi),Zi.prototype.nodeType=fi,ni(Zi,Li),en.prototype.nodeType=gi,ni(en,Li),tn.prototype.nodeType=ci,ni(tn,Li),nn.prototype.nodeType=li,ni(nn,Li),rn.prototype.nodeName="#document-fragment",rn.prototype.nodeType=mi,ni(rn,Li),an.prototype.nodeType=di,ni(an,Li),sn.prototype.serializeToString=function(e,t,i){return on.call(e,t,i)},Li.prototype.toString=on;try{if(Object.defineProperty){function vf(e){switch(e.nodeType){case ai:case mi:var t=[];for(e=e.firstChild;e;)7!==e.nodeType&&8!==e.nodeType&&t.push(vf(e)),e=e.nextSibling;return t.join("");default:return e.nodeValue}}Object.defineProperty(wi.prototype,"length",{get:function(){return ki(this),this.$$length}}),Object.defineProperty(Li.prototype,"textContent",{get:function(){return vf(this)},set:function(e){switch(this.nodeType){case ai:case mi:for(;this.firstChild;)this.removeChild(this.firstChild);(e||String(e))&&this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e}}}),pn=function(e,t,i){e["$$"+t]=i}}}catch(yf){}Gt.DocumentType=Zi,Gt.DOMException=Si,Gt.DOMImplementation=Pi,Gt.Element=Xi,Gt.Node=Li,Gt.NodeList=Ei,Gt.XMLSerializer=sn;var fn={},mn={};!function(e){var t=zt.freeze;e.XML_ENTITIES=t({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),e.HTML_ENTITIES=t({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"",InvisibleTimes:"",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"",NegativeThickSpace:"",NegativeThinSpace:"",NegativeVeryThinSpace:"",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:"\n",nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:"\t",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:" ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"",zwnj:""}),e.entityMap=e.HTML_ENTITIES}(mn);var gn={},vn=zt.NAMESPACE,yn=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,_n=new RegExp("[\\-\\.0-9"+yn.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),bn=new RegExp("^"+yn.source+_n.source+"*(?::"+yn.source+_n.source+"*)?$"),Tn=0,Sn=1,En=2,wn=3,kn=4,Cn=5,xn=6,In=7;function An(e,t){this.message=e,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,An)}function Pn(){}function Ln(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}function Dn(e,t,i,n,r,a){function s(e,t,n){i.attributeNames.hasOwnProperty(e)&&a.fatalError("Attribute "+e+" redefined"),i.addValue(e,t.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,r),n)}for(var o,u=++t,l=Tn;;){var c=e.charAt(u);switch(c){case"=":if(l===Sn)o=e.slice(t,u),l=wn;else{if(l!==En)throw new Error("attribute equal must after attrName");l=wn}break;case"'":case'"':if(l===wn||l===Sn){if(l===Sn&&(a.warning('attribute value must after "="'),o=e.slice(t,u)),t=u+1,!((u=e.indexOf(c,t))>0))throw new Error("attribute value no end '"+c+"' match");s(o,d=e.slice(t,u),t-1),l=Cn}else{if(l!=kn)throw new Error('attribute value must after "="');s(o,d=e.slice(t,u),t),a.warning('attribute "'+o+'" missed start quot('+c+")!!"),t=u+1,l=Cn}break;case"/":switch(l){case Tn:i.setTagName(e.slice(t,u));case Cn:case xn:case In:l=In,i.closed=!0;case kn:case Sn:break;case En:i.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return a.error("unexpected end of input"),l==Tn&&i.setTagName(e.slice(t,u)),u;case">":switch(l){case Tn:i.setTagName(e.slice(t,u));case Cn:case xn:case In:break;case kn:case Sn:"/"===(d=e.slice(t,u)).slice(-1)&&(i.closed=!0,d=d.slice(0,-1));case En:l===En&&(d=o),l==kn?(a.warning('attribute "'+d+'" missed quot(")!'),s(o,d,t)):(vn.isHTML(n[""])&&d.match(/^(?:disabled|checked|selected)$/i)||a.warning('attribute "'+d+'" missed value!! "'+d+'" instead!!'),s(d,d,t));break;case wn:throw new Error("attribute value missed!!")}return u;case"":c=" ";default:if(c<=" ")switch(l){case Tn:i.setTagName(e.slice(t,u)),l=xn;break;case Sn:o=e.slice(t,u),l=En;break;case kn:var d=e.slice(t,u);a.warning('attribute "'+d+'" missed quot(")!!'),s(o,d,t);case Cn:l=xn}else switch(l){case En:i.tagName,vn.isHTML(n[""])&&o.match(/^(?:disabled|checked|selected)$/i)||a.warning('attribute "'+o+'" missed value!! "'+o+'" instead2!!'),s(o,o,t),t=u,l=Sn;break;case Cn:a.warning('attribute space is required"'+o+'"!!');case xn:l=Sn,t=u;break;case wn:l=kn,t=u;break;case In:throw new Error("elements closed character '/' and '>' must be connected to")}}u++}}function On(e,t,i){for(var n=e.tagName,r=null,a=e.length;a--;){var s=e[a],o=s.qName,u=s.value;if((h=o.indexOf(":"))>0)var l=s.prefix=o.slice(0,h),c=o.slice(h+1),d="xmlns"===l&&c;else c=o,l=null,d="xmlns"===o&&"";s.localName=c,!1!==d&&(null==r&&(r={},Mn(i,i={})),i[d]=r[d]=u,s.uri=vn.XMLNS,t.startPrefixMapping(d,u))}for(a=e.length;a--;){(l=(s=e[a]).prefix)&&("xml"===l&&(s.uri=vn.XML),"xmlns"!==l&&(s.uri=i[l||""]))}var h;(h=n.indexOf(":"))>0?(l=e.prefix=n.slice(0,h),c=e.localName=n.slice(h+1)):(l=null,c=e.localName=n);var p=e.uri=i[l||""];if(t.startElement(p,c,n,e),!e.closed)return e.currentNSMap=i,e.localNSMap=r,!0;if(t.endElement(p,c,n),r)for(l in r)Object.prototype.hasOwnProperty.call(r,l)&&t.endPrefixMapping(l)}function Nn(e,t,i,n,r){if(/^(?:script|textarea)$/i.test(i)){var a=e.indexOf("</"+i+">",t),s=e.substring(t+1,a);if(/[&<]/.test(s))return/^script$/i.test(i)?(r.characters(s,0,s.length),a):(s=s.replace(/&#?\w+;/g,n),r.characters(s,0,s.length),a)}return t+1}function Rn(e,t,i,n){var r=n[i];return null==r&&((r=e.lastIndexOf("</"+i+">"))<t&&(r=e.lastIndexOf("</"+i)),n[i]=r),r<t}function Mn(e,t){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}function Un(e,t,i,n){if("-"===e.charAt(t+2))return"-"===e.charAt(t+3)?(r=e.indexOf("--\x3e",t+4))>t?(i.comment(e,t+4,r-t-4),r+3):(n.error("Unclosed comment"),-1):-1;if("CDATA["==e.substr(t+3,6)){var r=e.indexOf("]]>",t+9);return i.startCDATA(),i.characters(e,t+9,r-t-9),i.endCDATA(),r+3}var a=function(e,t){var i,n=[],r=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;r.lastIndex=t,r.exec(e);for(;i=r.exec(e);)if(n.push(i),i[1])return n}(e,t),s=a.length;if(s>1&&/!doctype/i.test(a[0][0])){var o=a[1][0],u=!1,l=!1;s>3&&(/^public$/i.test(a[2][0])?(u=a[3][0],l=s>4&&a[4][0]):/^system$/i.test(a[2][0])&&(l=a[3][0]));var c=a[s-1];return i.startDTD(o,u,l),i.endDTD(),c.index+c[0].length}return-1}function Bn(e,t,i){var n=e.indexOf("?>",t);if(n){var r=e.substring(t,n).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return r?(r[0].length,i.processingInstruction(r[1],r[2]),n+2):-1}return-1}function Fn(){this.attributeNames={}}An.prototype=new Error,An.prototype.name=An.name,Pn.prototype={parse:function(e,t,i){var n=this.domBuilder;n.startDocument(),Mn(t,t={}),function(e,t,i,n,r){function a(e){if(e>65535){var t=55296+((e-=65536)>>10),i=56320+(1023&e);return String.fromCharCode(t,i)}return String.fromCharCode(e)}function s(e){var t=e.slice(1,-1);return Object.hasOwnProperty.call(i,t)?i[t]:"#"===t.charAt(0)?a(parseInt(t.substr(1).replace("x","0x"))):(r.error("entity not found:"+e),e)}function o(t){if(t>m){var i=e.substring(m,t).replace(/&#?\w+;/g,s);h&&u(m),n.characters(i,0,t-m),m=t}}function u(t,i){for(;t>=c&&(i=d.exec(e));)l=i.index,c=l+i[0].length,h.lineNumber++;h.columnNumber=t-l+1}var l=0,c=0,d=/.*(?:\r\n?|\n)|.*$/g,h=n.locator,p=[{currentNSMap:t}],f={},m=0;for(;;){try{var g=e.indexOf("<",m);if(g<0){if(!e.substr(m).match(/^\s*$/)){var v=n.doc,y=v.createTextNode(e.substr(m));v.appendChild(y),n.currentElement=y}return}switch(g>m&&o(g),e.charAt(g+1)){case"/":var _=e.indexOf(">",g+3),b=e.substring(g+2,_).replace(/[ \t\n\r]+$/g,""),T=p.pop();_<0?(b=e.substring(g+2).replace(/[\s<].*/,""),r.error("end tag name: "+b+" is not complete:"+T.tagName),_=g+1+b.length):b.match(/\s</)&&(b=b.replace(/[\s<].*/,""),r.error("end tag name: "+b+" maybe not complete"),_=g+1+b.length);var S=T.localNSMap,E=T.tagName==b;if(E||T.tagName&&T.tagName.toLowerCase()==b.toLowerCase()){if(n.endElement(T.uri,T.localName,b),S)for(var w in S)Object.prototype.hasOwnProperty.call(S,w)&&n.endPrefixMapping(w);E||r.fatalError("end tag name: "+b+" is not match the current start tagName:"+T.tagName)}else p.push(T);_++;break;case"?":h&&u(g),_=Bn(e,g,n);break;case"!":h&&u(g),_=Un(e,g,n,r);break;default:h&&u(g);var k=new Fn,C=p[p.length-1].currentNSMap,x=(_=Dn(e,g,k,C,s,r),k.length);if(!k.closed&&Rn(e,_,k.tagName,f)&&(k.closed=!0,i.nbsp||r.warning("unclosed xml attribute")),h&&x){for(var I=Ln(h,{}),A=0;A<x;A++){var P=k[A];u(P.offset),P.locator=Ln(h,{})}n.locator=I,On(k,n,C)&&p.push(k),n.locator=h}else On(k,n,C)&&p.push(k);vn.isHTML(k.uri)&&!k.closed?_=Nn(e,_,k.tagName,s,n):_++}}catch(e){if(e instanceof An)throw e;r.error("element parse error: "+e),_=-1}_>m?m=_:o(Math.max(g,m)+1)}}(e,t,i,n,this.errorHandler),n.endDocument()}},Fn.prototype={setTagName:function(e){if(!bn.test(e))throw new Error("invalid tagName:"+e);this.tagName=e},addValue:function(e,t,i){if(!bn.test(e))throw new Error("invalid attribute:"+e);this.attributeNames[e]=this.length,this[this.length++]={qName:e,value:t,offset:i}},length:0,getLocalName:function(e){return this[e].localName},getLocator:function(e){return this[e].locator},getQName:function(e){return this[e].qName},getURI:function(e){return this[e].uri},getValue:function(e){return this[e].value}},gn.XMLReader=Pn,gn.ParseError=An;var jn=zt,qn=mn,Vn=gn,Hn=Gt.DOMImplementation,Wn=jn.NAMESPACE,Gn=Vn.ParseError,zn=Vn.XMLReader;function Xn(e){return e.replace(/\r[\n\u0085]/g,"\n").replace(/[\r\u0085\u2028]/g,"\n")}function Kn(e){this.options=e||{locator:{}}}function Yn(){this.cdata=!1}function Qn(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber}function $n(e){if(e)return"\n@"+(e.systemId||"")+"#[line:"+e.lineNumber+",col:"+e.columnNumber+"]"}function Jn(e,t,i){return"string"==typeof e?e.substr(t,i):e.length>=t+i||t?new java.lang.String(e,t,i)+"":e}function Zn(e,t){e.currentElement?e.currentElement.appendChild(t):e.doc.appendChild(t)}Kn.prototype.parseFromString=function(e,t){var i=this.options,n=new zn,r=i.domBuilder||new Yn,a=i.errorHandler,s=i.locator,o=i.xmlns||{},u=/\/x?html?$/.test(t),l=u?qn.HTML_ENTITIES:qn.XML_ENTITIES;s&&r.setDocumentLocator(s),n.errorHandler=function(e,t,i){if(!e){if(t instanceof Yn)return t;e=t}var n={},r=e instanceof Function;function a(t){var a=e[t];!a&&r&&(a=2==e.length?function(i){e(t,i)}:e),n[t]=a&&function(e){a("[xmldom "+t+"]\t"+e+$n(i))}||function(){}}return i=i||{},a("warning"),a("error"),a("fatalError"),n}(a,r,s),n.domBuilder=i.domBuilder||r,u&&(o[""]=Wn.HTML),o.xml=o.xml||Wn.XML;var c=i.normalizeLineEndings||Xn;return e&&"string"==typeof e?n.parse(c(e),o,l):n.errorHandler.error("invalid doc source"),r.doc},Yn.prototype={startDocument:function(){this.doc=(new Hn).createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(e,t,i,n){var r=this.doc,a=r.createElementNS(e,i||t),s=n.length;Zn(this,a),this.currentElement=a,this.locator&&Qn(this.locator,a);for(var o=0;o<s;o++){e=n.getURI(o);var u=n.getValue(o),l=(i=n.getQName(o),r.createAttributeNS(e,i));this.locator&&Qn(n.getLocator(o),l),l.value=l.nodeValue=u,a.setAttributeNode(l)}},endElement:function(e,t,i){var n=this.currentElement;n.tagName,this.currentElement=n.parentNode},startPrefixMapping:function(e,t){},endPrefixMapping:function(e){},processingInstruction:function(e,t){var i=this.doc.createProcessingInstruction(e,t);this.locator&&Qn(this.locator,i),Zn(this,i)},ignorableWhitespace:function(e,t,i){},characters:function(e,t,i){if(e=Jn.apply(this,arguments)){if(this.cdata)var n=this.doc.createCDATASection(e);else n=this.doc.createTextNode(e);this.currentElement?this.currentElement.appendChild(n):/^\s*$/.test(e)&&this.doc.appendChild(n),this.locator&&Qn(this.locator,n)}},skippedEntity:function(e){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(e){(this.locator=e)&&(e.lineNumber=0)},comment:function(e,t,i){e=Jn.apply(this,arguments);var n=this.doc.createComment(e);this.locator&&Qn(this.locator,n),Zn(this,n)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(e,t,i){var n=this.doc.implementation;if(n&&n.createDocumentType){var r=n.createDocumentType(e,t,i);this.locator&&Qn(this.locator,r),Zn(this,r),this.doc.doctype=r}},warning:function(e){console.warn("[xmldom warning]\t"+e,$n(this.locator))},error:function(e){console.error("[xmldom error]\t"+e,$n(this.locator))},fatalError:function(e){throw new Gn(e,this.locator)}},"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,(function(e){Yn.prototype[e]=function(){return null}})),fn.__DOMHandler=Yn,fn.normalizeLineEndings=Xn,fn.DOMParser=Kn;var er=fn.DOMParser,tr=function(e){return!!e&&"object"===u(e)},ir=function e(){for(var t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];return i.reduce((function(t,i){return"object"!==u(i)||Object.keys(i).forEach((function(n){Array.isArray(t[n])&&Array.isArray(i[n])?t[n]=t[n].concat(i[n]):tr(t[n])&&tr(i[n])?t[n]=e(t[n],i[n]):t[n]=i[n]})),t}),{})},nr=function(e){return Object.keys(e).map((function(t){return e[t]}))},rr=function(e){return e.reduce((function(e,t){return e.concat(t)}),[])},ar=function(e){if(!e.length)return[];for(var t=[],i=0;i<e.length;i++)t.push(e[i]);return t},sr=function(e,t){for(var i=0;i<e.length;i++)if(t(e[i]))return i;return-1},or="INVALID_NUMBER_OF_PERIOD",ur="DASH_EMPTY_MANIFEST",lr="DASH_INVALID_XML",cr="NO_BASE_URL",dr="SEGMENT_TIME_UNSPECIFIED",hr="UNSUPPORTED_UTC_TIMING_SCHEME",pr=function(e){var t=e.baseUrl,i=void 0===t?"":t,n=e.source,r=void 0===n?"":n,a=e.range,s=void 0===a?"":a,o=e.indexRange,u=void 0===o?"":o,l={uri:r,resolvedUri:dt(i||"",r)};if(s||u){var c,h=(s||u).split("-"),p=d.BigInt?d.BigInt(h[0]):parseInt(h[0],10),f=d.BigInt?d.BigInt(h[1]):parseInt(h[1],10);p<Number.MAX_SAFE_INTEGER&&"bigint"==typeof p&&(p=Number(p)),f<Number.MAX_SAFE_INTEGER&&"bigint"==typeof f&&(f=Number(f)),"bigint"==typeof(c="bigint"==typeof f||"bigint"==typeof p?d.BigInt(f)-d.BigInt(p)+d.BigInt(1):f-p+1)&&c<Number.MAX_SAFE_INTEGER&&(c=Number(c)),l.byterange={length:c,offset:p}}return l},fr=function(e){return e&&"number"!=typeof e&&(e=parseInt(e,10)),isNaN(e)?null:e},mr={static:function(e){var t=e.duration,i=e.timescale,n=void 0===i?1:i,r=e.sourceDuration,a=e.periodDuration,s=fr(e.endNumber),o=t/n;return"number"==typeof s?{start:0,end:s}:"number"==typeof a?{start:0,end:a/o}:{start:0,end:r/o}},dynamic:function(e){var t=e.NOW,i=e.clientOffset,n=e.availabilityStartTime,r=e.timescale,a=void 0===r?1:r,s=e.duration,o=e.periodStart,u=void 0===o?0:o,l=e.minimumUpdatePeriod,c=void 0===l?0:l,d=e.timeShiftBufferDepth,h=void 0===d?1/0:d,p=fr(e.endNumber),f=(t+i)/1e3,m=n+u,g=f+c-m,v=Math.ceil(g*a/s),y=Math.floor((f-m-h)*a/s),_=Math.floor((f-m)*a/s);return{start:Math.max(0,y),end:"number"==typeof p?p:Math.min(v,_)}}},gr=function(e){var t=e.type,i=e.duration,n=e.timescale,r=void 0===n?1:n,a=e.periodDuration,s=e.sourceDuration,o=mr[t](e),u=function(e,t){for(var i=[],n=e;n<t;n++)i.push(n);return i}(o.start,o.end).map(function(e){return function(t){var i=e.duration,n=e.timescale,r=void 0===n?1:n,a=e.periodStart,s=e.startNumber;return{number:(void 0===s?1:s)+t,duration:i/r,timeline:a,time:t*i}}}(e));if("static"===t){var l=u.length-1,c="number"==typeof a?a:s;u[l].duration=c-i/r*l}return u},vr=function(e){var t=e.baseUrl,i=e.initialization,n=void 0===i?{}:i,r=e.sourceDuration,a=e.indexRange,s=void 0===a?"":a,o=e.periodStart,u=e.presentationTime,l=e.number,c=void 0===l?0:l,d=e.duration;if(!t)throw new Error(cr);var h=pr({baseUrl:t,source:n.sourceURL,range:n.range}),p=pr({baseUrl:t,source:t,indexRange:s});if(p.map=h,d){var f=gr(e);f.length&&(p.duration=f[0].duration,p.timeline=f[0].timeline)}else r&&(p.duration=r,p.timeline=o);return p.presentationTime=u||o,p.number=c,[p]},yr=function(e,t,i){var n,r=e.sidx.map?e.sidx.map:null,a=e.sidx.duration,s=e.timeline||0,o=e.sidx.byterange,u=o.offset+o.length,l=t.timescale,c=t.references.filter((function(e){return 1!==e.referenceType})),h=[],p=e.endList?"static":"dynamic",f=e.sidx.timeline,m=f,g=e.mediaSequence||0;n="bigint"==typeof t.firstOffset?d.BigInt(u)+t.firstOffset:u+t.firstOffset;for(var v=0;v<c.length;v++){var y=t.references[v],_=y.referencedSize,b=y.subsegmentDuration,T=void 0;T="bigint"==typeof n?n+d.BigInt(_)-d.BigInt(1):n+_-1;var S=vr({baseUrl:i,timescale:l,timeline:s,periodStart:f,presentationTime:m,number:g,duration:b,sourceDuration:a,indexRange:n+"-"+T,type:p})[0];r&&(S.map=r),h.push(S),n+="bigint"==typeof n?d.BigInt(_):_,m+=b/l,g++}return e.segments=h,e},_r=["AUDIO","SUBTITLES"],br=1/60,Tr=function(e){return(t=e,i=function(e){return e.timeline},nr(t.reduce((function(e,t){return t.forEach((function(t){e[i(t)]=t})),e}),{}))).sort((function(e,t){return e.timeline>t.timeline?1:-1}));var t,i},Sr=function(e){var t,i,n=[];return t=e,i=function(e,t,i,r){n=n.concat(e.playlists||[])},_r.forEach((function(e){for(var n in t.mediaGroups[e])for(var r in t.mediaGroups[e][n]){var a=t.mediaGroups[e][n][r];i(a,e,n,r)}})),n},Er=function(e){var t=e.playlist,i=e.mediaSequence;t.mediaSequence=i,t.segments.forEach((function(e,i){e.number=t.mediaSequence+i}))},wr=function(e){var t=e.oldManifest,i=e.newManifest,n=t.playlists.concat(Sr(t)),r=i.playlists.concat(Sr(i));return i.timelineStarts=Tr([t.timelineStarts,i.timelineStarts]),function(e){var t=e.oldPlaylists,i=e.newPlaylists,n=e.timelineStarts;i.forEach((function(e){e.discontinuitySequence=sr(n,(function(t){return t.timeline===e.timeline}));var i=function(e,t){for(var i=0;i<e.length;i++)if(e[i].attributes.NAME===t)return e[i];return null}(t,e.attributes.NAME);if(i&&!e.sidx){var r=e.segments[0],a=sr(i.segments,(function(e){return Math.abs(e.presentationTime-r.presentationTime)<br}));if(-1===a)return Er({playlist:e,mediaSequence:i.mediaSequence+i.segments.length}),e.segments[0].discontinuity=!0,e.discontinuityStarts.unshift(0),void((!i.segments.length&&e.timeline>i.timeline||i.segments.length&&e.timeline>i.segments[i.segments.length-1].timeline)&&e.discontinuitySequence--);i.segments[a].discontinuity&&!r.discontinuity&&(r.discontinuity=!0,e.discontinuityStarts.unshift(0),e.discontinuitySequence--),Er({playlist:e,mediaSequence:i.segments[a].number})}}))}({oldPlaylists:n,newPlaylists:r,timelineStarts:i.timelineStarts}),i},kr=function(e){return e&&e.uri+"-"+(t=e.byterange,i="bigint"==typeof t.offset||"bigint"==typeof t.length?d.BigInt(t.offset)+d.BigInt(t.length)-d.BigInt(1):t.offset+t.length-1,t.offset+"-"+i);var t,i},Cr=function(e){return nr(e.reduce((function(e,t){var i=t.attributes.id+(t.attributes.lang||"");if(e[i]){var n;if(t.segments)t.segments[0]&&(t.segments[0].discontinuity=!0),(n=e[i].segments).push.apply(n,t.segments);t.attributes.contentProtection&&(e[i].attributes.contentProtection=t.attributes.contentProtection)}else e[i]=t,e[i].attributes.timelineStarts=[];return e[i].attributes.timelineStarts.push({start:t.attributes.periodStart,timeline:t.attributes.periodStart}),e}),{})).map((function(e){var t,i;return e.discontinuityStarts=(t=e.segments||[],i="discontinuity",t.reduce((function(e,t,n){return t[i]&&e.push(n),e}),[])),e}))},xr=function(e,t){var i=kr(e.sidx),n=i&&t[i]&&t[i].sidx;return n&&yr(e,n,e.sidx.resolvedUri),e},Ir=function(e,t){if(void 0===t&&(t={}),!Object.keys(t).length)return e;for(var i in e)e[i]=xr(e[i],t);return e},Ar=function(e){var t,i=e.attributes,n=e.segments,r=e.sidx,a=e.discontinuityStarts,s={attributes:(t={NAME:i.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:i.width,height:i.height},CODECS:i.codecs,BANDWIDTH:i.bandwidth},t["PROGRAM-ID"]=1,t),uri:"",endList:"static"===i.type,timeline:i.periodStart,resolvedUri:"",targetDuration:i.duration,discontinuityStarts:a,timelineStarts:i.timelineStarts,segments:n};return i.frameRate&&(s.attributes["FRAME-RATE"]=i.frameRate),i.contentProtection&&(s.contentProtection=i.contentProtection),r&&(s.sidx=r),s},Pr=function(e){var t=e.attributes;return"video/mp4"===t.mimeType||"video/webm"===t.mimeType||"video"===t.contentType},Lr=function(e){var t=e.attributes;return"audio/mp4"===t.mimeType||"audio/webm"===t.mimeType||"audio"===t.contentType},Dr=function(e){var t=e.attributes;return"text/vtt"===t.mimeType||"text"===t.contentType},Or=function(e){return e?Object.keys(e).reduce((function(t,i){var n=e[i];return t.concat(n.playlists)}),[]):[]},Nr=function(e){var t,i=e.dashPlaylists,n=e.locations,r=e.sidxMapping,a=void 0===r?{}:r,s=e.previousManifest;if(!i.length)return{};var o=i[0].attributes,u=o.sourceDuration,l=o.type,c=o.suggestedPresentationDelay,d=o.minimumUpdatePeriod,h=Cr(i.filter(Pr)).map(Ar),p=Cr(i.filter(Lr)),f=Cr(i.filter(Dr)),m=i.map((function(e){return e.attributes.captionServices})).filter(Boolean),g={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:(t={AUDIO:{},VIDEO:{}},t["CLOSED-CAPTIONS"]={},t.SUBTITLES={},t),uri:"",duration:u,playlists:Ir(h,a)};d>=0&&(g.minimumUpdatePeriod=1e3*d),n&&(g.locations=n),"dynamic"===l&&(g.suggestedPresentationDelay=c);var v,y,_=0===g.playlists.length,b=p.length?function(e,t,i){var n;void 0===t&&(t={}),void 0===i&&(i=!1);var r=e.reduce((function(e,r){var a=r.attributes.role&&r.attributes.role.value||"",s=r.attributes.lang||"",o=r.attributes.label||"main";if(s&&!r.attributes.label){var u=a?" ("+a+")":"";o=""+r.attributes.lang+u}e[o]||(e[o]={language:s,autoselect:!0,default:"main"===a,playlists:[],uri:""});var l=xr(function(e,t){var i,n=e.attributes,r=e.segments,a=e.sidx,s=e.mediaSequence,o=e.discontinuitySequence,u=e.discontinuityStarts,l={attributes:(i={NAME:n.id,BANDWIDTH:n.bandwidth,CODECS:n.codecs},i["PROGRAM-ID"]=1,i),uri:"",endList:"static"===n.type,timeline:n.periodStart,resolvedUri:"",targetDuration:n.duration,discontinuitySequence:o,discontinuityStarts:u,timelineStarts:n.timelineStarts,mediaSequence:s,segments:r};return n.contentProtection&&(l.contentProtection=n.contentProtection),a&&(l.sidx=a),t&&(l.attributes.AUDIO="audio",l.attributes.SUBTITLES="subs"),l}(r,i),t);return e[o].playlists.push(l),void 0===n&&"main"===a&&((n=r).default=!0),e}),{});return n||(r[Object.keys(r)[0]].default=!0),r}(p,a,_):null,T=f.length?function(e,t){return void 0===t&&(t={}),e.reduce((function(e,i){var n=i.attributes.lang||"text";return e[n]||(e[n]={language:n,default:!1,autoselect:!1,playlists:[],uri:""}),e[n].playlists.push(xr(function(e){var t,i=e.attributes,n=e.segments,r=e.mediaSequence,a=e.discontinuityStarts,s=e.discontinuitySequence;void 0===n&&(n=[{uri:i.baseUrl,timeline:i.periodStart,resolvedUri:i.baseUrl||"",duration:i.sourceDuration,number:0}],i.duration=i.sourceDuration);var o=((t={NAME:i.id,BANDWIDTH:i.bandwidth})["PROGRAM-ID"]=1,t);return i.codecs&&(o.CODECS=i.codecs),{attributes:o,uri:"",endList:"static"===i.type,timeline:i.periodStart,resolvedUri:i.baseUrl||"",targetDuration:i.duration,timelineStarts:i.timelineStarts,discontinuityStarts:a,discontinuitySequence:s,mediaSequence:r,segments:n}}(i),t)),e}),{})}(f,a):null,S=h.concat(Or(b),Or(T)),E=S.map((function(e){return e.timelineStarts}));return g.timelineStarts=Tr(E),v=S,y=g.timelineStarts,v.forEach((function(e){e.mediaSequence=0,e.discontinuitySequence=sr(y,(function(t){return t.timeline===e.timeline})),e.segments&&e.segments.forEach((function(e,t){e.number=t}))})),b&&(g.mediaGroups.AUDIO.audio=b),T&&(g.mediaGroups.SUBTITLES.subs=T),m.length&&(g.mediaGroups["CLOSED-CAPTIONS"].cc=m.reduce((function(e,t){return t?(t.forEach((function(t){var i=t.channel,n=t.language;e[n]={autoselect:!1,default:!1,instreamId:i,language:n},t.hasOwnProperty("aspectRatio")&&(e[n].aspectRatio=t.aspectRatio),t.hasOwnProperty("easyReader")&&(e[n].easyReader=t.easyReader),t.hasOwnProperty("3D")&&(e[n]["3D"]=t["3D"])})),e):e}),{})),s?wr({oldManifest:s,newManifest:g}):g},Rr=function(e,t,i){var n=e.NOW,r=e.clientOffset,a=e.availabilityStartTime,s=e.timescale,o=void 0===s?1:s,u=e.periodStart,l=void 0===u?0:u,c=e.minimumUpdatePeriod,d=(n+r)/1e3+(void 0===c?0:c)-(a+l);return Math.ceil((d*o-t)/i)},Mr=function(e,t){for(var i=e.type,n=e.minimumUpdatePeriod,r=void 0===n?0:n,a=e.media,s=void 0===a?"":a,o=e.sourceDuration,u=e.timescale,l=void 0===u?1:u,c=e.startNumber,d=void 0===c?1:c,h=e.periodStart,p=[],f=-1,m=0;m<t.length;m++){var g=t[m],v=g.d,y=g.r||0,_=g.t||0;f<0&&(f=_),_&&_>f&&(f=_);var b=void 0;if(y<0){var T=m+1;b=T===t.length?"dynamic"===i&&r>0&&s.indexOf("$Number$")>0?Rr(e,f,v):(o*l-f)/v:(t[T].t-f)/v}else b=y+1;for(var S=d+p.length+b,E=d+p.length;E<S;)p.push({number:E,duration:v/l,time:f,timeline:h}),f+=v,E++}return p},Ur=/\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g,Br=function(e,t){return e.replace(Ur,function(e){return function(t,i,n,r){if("$$"===t)return"$";if(void 0===e[i])return t;var a=""+e[i];return"RepresentationID"===i?a:(r=n?parseInt(r,10):1,a.length>=r?a:""+new Array(r-a.length+1).join("0")+a)}}(t))},Fr=function(e,t){var i={RepresentationID:e.id,Bandwidth:e.bandwidth||0},n=e.initialization,r=void 0===n?{sourceURL:"",range:""}:n,a=pr({baseUrl:e.baseUrl,source:Br(r.sourceURL,i),range:r.range}),s=function(e,t){return e.duration||t?e.duration?gr(e):Mr(e,t):[{number:e.startNumber||1,duration:e.sourceDuration,time:0,timeline:e.periodStart}]}(e,t);return s.map((function(t){i.Number=t.number,i.Time=t.time;var n=Br(e.media||"",i),r=e.timescale||1,s=e.presentationTimeOffset||0,o=e.periodStart+(t.time-s)/r;return{uri:n,timeline:t.timeline,duration:t.duration,resolvedUri:dt(e.baseUrl||"",n),map:a,number:t.number,presentationTime:o}}))},jr=function(e,t){var i=e.duration,n=e.segmentUrls,r=void 0===n?[]:n,a=e.periodStart;if(!i&&!t||i&&t)throw new Error(dr);var s,o=r.map((function(t){return function(e,t){var i=e.baseUrl,n=e.initialization,r=void 0===n?{}:n,a=pr({baseUrl:i,source:r.sourceURL,range:r.range}),s=pr({baseUrl:i,source:t.media,range:t.mediaRange});return s.map=a,s}(e,t)}));return i&&(s=gr(e)),t&&(s=Mr(e,t)),s.map((function(t,i){if(o[i]){var n=o[i],r=e.timescale||1,s=e.presentationTimeOffset||0;return n.timeline=t.timeline,n.duration=t.duration,n.number=t.number,n.presentationTime=a+(t.time-s)/r,n}})).filter((function(e){return e}))},qr=function(e){var t,i,n=e.attributes,r=e.segmentInfo;r.template?(i=Fr,t=ir(n,r.template)):r.base?(i=vr,t=ir(n,r.base)):r.list&&(i=jr,t=ir(n,r.list));var a={attributes:n};if(!i)return a;var s=i(t,r.segmentTimeline);if(t.duration){var o=t,u=o.duration,l=o.timescale,c=void 0===l?1:l;t.duration=u/c}else s.length?t.duration=s.reduce((function(e,t){return Math.max(e,Math.ceil(t.duration))}),0):t.duration=0;return a.attributes=t,a.segments=s,r.base&&t.indexRange&&(a.sidx=s[0],a.segments=[]),a},Vr=function(e,t){return ar(e.childNodes).filter((function(e){return e.tagName===t}))},Hr=function(e){return e.textContent.trim()},Wr=function(e){var t=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(e);if(!t)return 0;var i=t.slice(1),n=i[0],r=i[1],a=i[2],s=i[3],o=i[4],u=i[5];return 31536e3*parseFloat(n||0)+2592e3*parseFloat(r||0)+86400*parseFloat(a||0)+3600*parseFloat(s||0)+60*parseFloat(o||0)+parseFloat(u||0)},Gr={mediaPresentationDuration:function(e){return Wr(e)},availabilityStartTime:function(e){return/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(t=e)&&(t+="Z"),Date.parse(t)/1e3;var t},minimumUpdatePeriod:function(e){return Wr(e)},suggestedPresentationDelay:function(e){return Wr(e)},type:function(e){return e},timeShiftBufferDepth:function(e){return Wr(e)},start:function(e){return Wr(e)},width:function(e){return parseInt(e,10)},height:function(e){return parseInt(e,10)},bandwidth:function(e){return parseInt(e,10)},frameRate:function(e){return function(e){return parseFloat(e.split("/").reduce((function(e,t){return e/t})))}(e)},startNumber:function(e){return parseInt(e,10)},timescale:function(e){return parseInt(e,10)},presentationTimeOffset:function(e){return parseInt(e,10)},duration:function(e){var t=parseInt(e,10);return isNaN(t)?Wr(e):t},d:function(e){return parseInt(e,10)},t:function(e){return parseInt(e,10)},r:function(e){return parseInt(e,10)},DEFAULT:function(e){return e}},zr=function(e){return e&&e.attributes?ar(e.attributes).reduce((function(e,t){var i=Gr[t.name]||Gr.DEFAULT;return e[t.name]=i(t.value),e}),{}):{}},Xr={"urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b":"org.w3.clearkey","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":"com.widevine.alpha","urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":"com.microsoft.playready","urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb":"com.adobe.primetime"},Kr=function(e,t){return t.length?rr(e.map((function(e){return t.map((function(t){return dt(e,Hr(t))}))}))):e},Yr=function(e){var t=Vr(e,"SegmentTemplate")[0],i=Vr(e,"SegmentList")[0],n=i&&Vr(i,"SegmentURL").map((function(e){return ir({tag:"SegmentURL"},zr(e))})),r=Vr(e,"SegmentBase")[0],a=i||t,s=a&&Vr(a,"SegmentTimeline")[0],o=i||r||t,u=o&&Vr(o,"Initialization")[0],l=t&&zr(t);l&&u?l.initialization=u&&zr(u):l&&l.initialization&&(l.initialization={sourceURL:l.initialization});var c={template:l,segmentTimeline:s&&Vr(s,"S").map((function(e){return zr(e)})),list:i&&ir(zr(i),{segmentUrls:n,initialization:zr(u)}),base:r&&ir(zr(r),{initialization:zr(u)})};return Object.keys(c).forEach((function(e){c[e]||delete c[e]})),c},Qr=function(e,t,i){return function(n){var r,a=zr(n),s=Kr(t,Vr(n,"BaseURL")),o=Vr(n,"Role")[0],u={role:zr(o)},l=ir(e,a,u),c=Vr(n,"Accessibility")[0],d="urn:scte:dash:cc:cea-608:2015"===(r=zr(c)).schemeIdUri?("string"!=typeof r.value?[]:r.value.split(";")).map((function(e){var t,i;if(i=e,/^CC\d=/.test(e)){var n=e.split("=");t=n[0],i=n[1]}else/^CC\d$/.test(e)&&(t=e);return{channel:t,language:i}})):"urn:scte:dash:cc:cea-708:2015"===r.schemeIdUri?("string"!=typeof r.value?[]:r.value.split(";")).map((function(e){var t={channel:void 0,language:void 0,aspectRatio:1,easyReader:0,"3D":0};if(/=/.test(e)){var i=e.split("="),n=i[0],r=i[1],a=void 0===r?"":r;t.channel=n,t.language=e,a.split(",").forEach((function(e){var i=e.split(":"),n=i[0],r=i[1];"lang"===n?t.language=r:"er"===n?t.easyReader=Number(r):"war"===n?t.aspectRatio=Number(r):"3D"===n&&(t["3D"]=Number(r))}))}else t.language=e;return t.channel&&(t.channel="SERVICE"+t.channel),t})):void 0;d&&(l=ir(l,{captionServices:d}));var h=Vr(n,"Label")[0];if(h&&h.childNodes.length){var p=h.childNodes[0].nodeValue.trim();l=ir(l,{label:p})}var f=Vr(n,"ContentProtection").reduce((function(e,t){var i=zr(t);i.schemeIdUri&&(i.schemeIdUri=i.schemeIdUri.toLowerCase());var n=Xr[i.schemeIdUri];if(n){e[n]={attributes:i};var r=Vr(t,"cenc:pssh")[0];if(r){var a=Hr(r);e[n].pssh=a&&pt(a)}}return e}),{});Object.keys(f).length&&(l=ir(l,{contentProtection:f}));var m=Yr(n),g=Vr(n,"Representation"),v=ir(i,m);return rr(g.map(function(e,t,i){return function(n){var r=Vr(n,"BaseURL"),a=Kr(t,r),s=ir(e,zr(n)),o=Yr(n);return a.map((function(e){return{segmentInfo:ir(i,o),attributes:ir(s,{baseUrl:e})}}))}}(l,s,v)))}},$r=function(e,t){return function(i,n){var r=Kr(t,Vr(i.node,"BaseURL")),a=ir(e,{periodStart:i.attributes.start});"number"==typeof i.attributes.duration&&(a.periodDuration=i.attributes.duration);var s=Vr(i.node,"AdaptationSet"),o=Yr(i.node);return rr(s.map(Qr(a,r,o)))}},Jr=function(e){if(""===e)throw new Error(ur);var t,i,n=new er;try{i=(t=n.parseFromString(e,"application/xml"))&&"MPD"===t.documentElement.tagName?t.documentElement:null}catch(e){}if(!i||i&&i.getElementsByTagName("parsererror").length>0)throw new Error(lr);return i},Zr=function(e,t){void 0===t&&(t={});var i=function(e,t){void 0===t&&(t={});var i=t,n=i.manifestUri,r=void 0===n?"":n,a=i.NOW,s=void 0===a?Date.now():a,o=i.clientOffset,u=void 0===o?0:o,l=Vr(e,"Period");if(!l.length)throw new Error(or);var c=Vr(e,"Location"),d=zr(e),h=Kr([r],Vr(e,"BaseURL"));d.type=d.type||"static",d.sourceDuration=d.mediaPresentationDuration||0,d.NOW=s,d.clientOffset=u,c.length&&(d.locations=c.map(Hr));var p=[];return l.forEach((function(e,t){var i=zr(e),n=p[t-1];i.start=function(e){var t=e.attributes,i=e.priorPeriodAttributes,n=e.mpdType;return"number"==typeof t.start?t.start:i&&"number"==typeof i.start&&"number"==typeof i.duration?i.start+i.duration:i||"static"!==n?null:0}({attributes:i,priorPeriodAttributes:n?n.attributes:null,mpdType:d.type}),p.push({node:e,attributes:i})})),{locations:d.locations,representationInfo:rr(p.map($r(d,h)))}}(Jr(e),t),n=i.representationInfo.map(qr);return Nr({dashPlaylists:n,locations:i.locations,sidxMapping:t.sidxMapping,previousManifest:t.previousManifest})},ea=function(e){return function(e){var t=Vr(e,"UTCTiming")[0];if(!t)return null;var i=zr(t);switch(i.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":i.method="HEAD";break;case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":i.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":i.method="DIRECT",i.value=Date.parse(i.value);break;default:throw new Error(hr)}return i}(Jr(e))},ta=Math.pow(2,32),ia=function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.getBigUint64?(t=i.getBigUint64(0))<Number.MAX_SAFE_INTEGER?Number(t):t:i.getUint32(0)*ta+i.getUint32(4)},na=function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),references:[],referenceId:t.getUint32(4),timescale:t.getUint32(8)},n=12;0===i.version?(i.earliestPresentationTime=t.getUint32(n),i.firstOffset=t.getUint32(n+4),n+=8):(i.earliestPresentationTime=ia(e.subarray(n)),i.firstOffset=ia(e.subarray(n+8)),n+=16),n+=2;var r=t.getUint16(n);for(n+=2;r>0;n+=12,r--)i.references.push({referenceType:(128&e[n])>>>7,referencedSize:2147483647&t.getUint32(n),subsegmentDuration:t.getUint32(n+4),startsWithSap:!!(128&e[n+8]),sapType:(112&e[n+8])>>>4,sapDeltaTime:268435455&t.getUint32(n+8)});return i},ra=Bt([73,68,51]),aa=function e(t,i){return void 0===i&&(i=0),(t=Bt(t)).length-i<10||!Wt(t,ra,{offset:i})?i:(i+=function(e,t){void 0===t&&(t=0);var i=(e=Bt(e))[t+5],n=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9];return(16&i)>>4?n+20:n+10}(t,i),e(t,i))},sa=function(e){return"string"==typeof e?Ht(e):e},oa=function e(t,i,n){void 0===n&&(n=!1),i=function(e){return Array.isArray(e)?e.map((function(e){return sa(e)})):[sa(e)]}(i),t=Bt(t);var r=[];if(!i.length)return r;for(var a=0;a<t.length;){var s=(t[a]<<24|t[a+1]<<16|t[a+2]<<8|t[a+3])>>>0,o=t.subarray(a+4,a+8);if(0===s)break;var u=a+s;if(u>t.length){if(n)break;u=t.length}var l=t.subarray(a+8,u);Wt(o,i[0])&&(1===i.length?r.push(l):r.push.apply(r,e(l,i.slice(1),n))),a=u}return r},ua={EBML:Bt([26,69,223,163]),DocType:Bt([66,130]),Segment:Bt([24,83,128,103]),SegmentInfo:Bt([21,73,169,102]),Tracks:Bt([22,84,174,107]),Track:Bt([174]),TrackNumber:Bt([215]),DefaultDuration:Bt([35,227,131]),TrackEntry:Bt([174]),TrackType:Bt([131]),FlagDefault:Bt([136]),CodecID:Bt([134]),CodecPrivate:Bt([99,162]),VideoTrack:Bt([224]),AudioTrack:Bt([225]),Cluster:Bt([31,67,182,117]),Timestamp:Bt([231]),TimestampScale:Bt([42,215,177]),BlockGroup:Bt([160]),BlockDuration:Bt([155]),Block:Bt([161]),SimpleBlock:Bt([163])},la=[128,64,32,16,8,4,2,1],ca=function(e,t,i,n){void 0===i&&(i=!0),void 0===n&&(n=!1);var r=function(e){for(var t=1,i=0;i<la.length&&!(e&la[i]);i++)t++;return t}(e[t]),a=e.subarray(t,t+r);return i&&((a=Array.prototype.slice.call(e,t,t+r))[0]^=la[r-1]),{length:r,value:qt(a,{signed:n}),bytes:a}},da=function e(t){return"string"==typeof t?t.match(/.{1,2}/g).map((function(t){return e(t)})):"number"==typeof t?Vt(t):t},ha=function e(t,i,n){if(n>=i.length)return i.length;var r=ca(i,n,!1);if(Wt(t.bytes,r.bytes))return n;var a=ca(i,n+r.length);return e(t,i,n+a.length+a.value+r.length)},pa=function e(t,i){i=function(e){return Array.isArray(e)?e.map((function(e){return da(e)})):[da(e)]}(i),t=Bt(t);var n=[];if(!i.length)return n;for(var r=0;r<t.length;){var a=ca(t,r,!1),s=ca(t,r+a.length),o=r+a.length+s.length;127===s.value&&(s.value=ha(a,t,o),s.value!==t.length&&(s.value-=o));var u=o+s.value>t.length?t.length:o+s.value,l=t.subarray(o,u);Wt(i[0],a.bytes)&&(1===i.length?n.push(l):n=n.concat(e(l,i.slice(1)))),r+=a.length+s.length+l.length}return n},fa=Bt([0,0,0,1]),ma=Bt([0,0,1]),ga=Bt([0,0,3]),va=function(e){for(var t=[],i=1;i<e.length-2;)Wt(e.subarray(i,i+3),ga)&&(t.push(i+2),i++),i++;if(0===t.length)return e;var n=e.length-t.length,r=new Uint8Array(n),a=0;for(i=0;i<n;a++,i++)a===t[0]&&(a++,t.shift()),r[i]=e[a];return r},ya=function(e,t,i,n){void 0===n&&(n=1/0),e=Bt(e),i=[].concat(i);for(var r,a=0,s=0;a<e.length&&(s<n||r);){var o=void 0;if(Wt(e.subarray(a),fa)?o=4:Wt(e.subarray(a),ma)&&(o=3),o){if(s++,r)return va(e.subarray(r,a));var u=void 0;"h264"===t?u=31&e[a+o]:"h265"===t&&(u=e[a+o]>>1&63),-1!==i.indexOf(u)&&(r=a+o),a+=o+("h264"===t?1:2)}else a++}return e.subarray(0,0)},_a={webm:Bt([119,101,98,109]),matroska:Bt([109,97,116,114,111,115,107,97]),flac:Bt([102,76,97,67]),ogg:Bt([79,103,103,83]),ac3:Bt([11,119]),riff:Bt([82,73,70,70]),avi:Bt([65,86,73]),wav:Bt([87,65,86,69]),"3gp":Bt([102,116,121,112,51,103]),mp4:Bt([102,116,121,112]),fmp4:Bt([115,116,121,112]),mov:Bt([102,116,121,112,113,116]),moov:Bt([109,111,111,118]),moof:Bt([109,111,111,102])},ba={aac:function(e){var t=aa(e);return Wt(e,[255,16],{offset:t,mask:[255,22]})},mp3:function(e){var t=aa(e);return Wt(e,[255,2],{offset:t,mask:[255,6]})},webm:function(e){var t=pa(e,[ua.EBML,ua.DocType])[0];return Wt(t,_a.webm)},mkv:function(e){var t=pa(e,[ua.EBML,ua.DocType])[0];return Wt(t,_a.matroska)},mp4:function(e){return!ba["3gp"](e)&&!ba.mov(e)&&(!(!Wt(e,_a.mp4,{offset:4})&&!Wt(e,_a.fmp4,{offset:4}))||(!(!Wt(e,_a.moof,{offset:4})&&!Wt(e,_a.moov,{offset:4}))||void 0))},mov:function(e){return Wt(e,_a.mov,{offset:4})},"3gp":function(e){return Wt(e,_a["3gp"],{offset:4})},ac3:function(e){var t=aa(e);return Wt(e,_a.ac3,{offset:t})},ts:function(e){if(e.length<189&&e.length>=1)return 71===e[0];for(var t=0;t+188<e.length&&t<188;){if(71===e[t]&&71===e[t+188])return!0;t+=1}return!1},flac:function(e){var t=aa(e);return Wt(e,_a.flac,{offset:t})},ogg:function(e){return Wt(e,_a.ogg)},avi:function(e){return Wt(e,_a.riff)&&Wt(e,_a.avi,{offset:8})},wav:function(e){return Wt(e,_a.riff)&&Wt(e,_a.wav,{offset:8})},h264:function(e){return function(e,t,i){return ya(e,"h264",t,i)}(e,7,3).length},h265:function(e){return function(e,t,i){return ya(e,"h265",t,i)}(e,[32,33],3).length}},Ta=Object.keys(ba).filter((function(e){return"ts"!==e&&"h264"!==e&&"h265"!==e})).concat(["ts","h264","h265"]);Ta.forEach((function(e){var t=ba[e];ba[e]=function(e){return t(Bt(e))}}));var Sa,Ea,wa,ka,Ca=ba,xa=function(e){e=Bt(e);for(var t=0;t<Ta.length;t++){var i=Ta[t];if(Ca[i](e))return i}return""},Ia=9e4;var Aa=Ia;Sa=function(e){return e*Ia},Ea=function(e,t){return e*t},wa=function(e){return e/Ia},ka=function(e,t){return e/t};function Pa(e){return Pa=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Pa(e)}function La(e){var t="function"==typeof Map?new Map:void 0;return La=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,i)}function i(){return st(e,arguments,Pa(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),se(i,e)},La(e)}for(var Da,Oa="7.21.2",Na={},Ra=function(e,t){return Na[e]=Na[e]||[],t&&(Na[e]=Na[e].concat(t)),Na[e]},Ma=function(e,t){var i=Ra(e).indexOf(t);return!(i<=-1)&&(Na[e]=Na[e].slice(),Na[e].splice(i,1),!0)},Ua={prefixed:!0},Ba=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror","-moz-full-screen"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError","-ms-fullscreen"]],Fa=Ba[0],ja=0;ja<Ba.length;ja++)if(Ba[ja][1]in te){Da=Ba[ja];break}if(Da){for(var qa=0;qa<Da.length;qa++)Ua[Fa[qa]]=Da[qa];Ua.prefixed=Da[0]!==Fa[0]}var Va=[];var Ha=function e(t){var i,n="info",r=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];i("log",n,t)};return i=function(e,t){return function(i,n,r){var a=t.levels[n],s=new RegExp("^("+a+")$");if("log"!==i&&r.unshift(i.toUpperCase()+":"),r.unshift(e+":"),Va){Va.push([].concat(r));var o=Va.length-1e3;Va.splice(0,o>0?o:0)}if(d.console){var u=d.console[i];u||"debug"!==i||(u=d.console.info||d.console.log),u&&a&&s.test(i)&&u[Array.isArray(r)?"apply":"call"](d.console,r)}}}(t,r),r.createLogger=function(i){return e(t+": "+i)},r.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:n},r.level=function(e){if("string"==typeof e){if(!r.levels.hasOwnProperty(e))throw new Error('"'+e+'" in not a valid log level');n=e}return n},(r.history=function(){return Va?[].concat(Va):[]}).filter=function(e){return(Va||[]).filter((function(t){return new RegExp(".*"+e+".*").test(t[0])}))},r.history.clear=function(){Va&&(Va.length=0)},r.history.disable=function(){null!==Va&&(Va.length=0,Va=null)},r.history.enable=function(){null===Va&&(Va=[])},r.error=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return i("error",n,t)},r.warn=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return i("warn",n,t)},r.debug=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return i("debug",n,t)},r}("VIDEOJS"),Wa=Ha.createLogger,Ga=Object.prototype.toString,za=function(e){return Ya(e)?Object.keys(e):[]};function Xa(e,t){za(e).forEach((function(i){return t(e[i],i)}))}function Ka(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];return Object.assign?ie.apply(void 0,[e].concat(i)):(i.forEach((function(t){t&&Xa(t,(function(t,i){e[i]=t}))})),e)}function Ya(e){return!!e&&"object"===u(e)}function Qa(e){return Ya(e)&&"[object Object]"===Ga.call(e)&&e.constructor===Object}function $a(e,t){if(!e||!t)return"";if("function"==typeof d.getComputedStyle){var i;try{i=d.getComputedStyle(e)}catch(e){return""}return i?i.getPropertyValue(t)||i[t]:""}return""}var Ja,Za=d.navigator&&d.navigator.userAgent||"",es=/AppleWebKit\/([\d.]+)/i.exec(Za),ts=es?parseFloat(es.pop()):null,is=/iPod/i.test(Za),ns=(Ja=Za.match(/OS (\d+)_/i))&&Ja[1]?Ja[1]:null,rs=/Android/i.test(Za),as=function(){var e=Za.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;var t=e[1]&&parseFloat(e[1]),i=e[2]&&parseFloat(e[2]);return t&&i?parseFloat(e[1]+"."+e[2]):t||null}(),ss=rs&&as<5&&ts<537,os=/Firefox/i.test(Za),us=/Edg/i.test(Za),ls=!us&&(/Chrome/i.test(Za)||/CriOS/i.test(Za)),cs=function(){var e=Za.match(/(Chrome|CriOS)\/(\d+)/);return e&&e[2]?parseFloat(e[2]):null}(),ds=function(){var e=/MSIE\s(\d+)\.\d/.exec(Za),t=e&&parseFloat(e[1]);return!t&&/Trident\/7.0/i.test(Za)&&/rv:11.0/.test(Za)&&(t=11),t}(),hs=/Safari/i.test(Za)&&!ls&&!rs&&!us,ps=/Windows/i.test(Za),fs=Boolean(Ss()&&("ontouchstart"in d||d.navigator.maxTouchPoints||d.DocumentTouch&&d.document instanceof d.DocumentTouch)),ms=/iPad/i.test(Za)||hs&&fs&&!/iPhone/i.test(Za),gs=/iPhone/i.test(Za)&&!ms,vs=gs||ms||is,ys=(hs||vs)&&!ls,_s=Object.freeze({__proto__:null,IS_IPOD:is,IOS_VERSION:ns,IS_ANDROID:rs,ANDROID_VERSION:as,IS_NATIVE_ANDROID:ss,IS_FIREFOX:os,IS_EDGE:us,IS_CHROME:ls,CHROME_VERSION:cs,IE_VERSION:ds,IS_SAFARI:hs,IS_WINDOWS:ps,TOUCH_ENABLED:fs,IS_IPAD:ms,IS_IPHONE:gs,IS_IOS:vs,IS_ANY_SAFARI:ys});function bs(e){return"string"==typeof e&&Boolean(e.trim())}function Ts(e){if(e.indexOf(" ")>=0)throw new Error("class has illegal whitespace characters")}function Ss(){return te===d.document}function Es(e){return Ya(e)&&1===e.nodeType}function ws(){try{return d.parent!==d.self}catch(e){return!0}}function ks(e){return function(t,i){if(!bs(t))return te[e](null);bs(i)&&(i=te.querySelector(i));var n=Es(i)?i:te;return n[e]&&n[e](t)}}function Cs(e,t,i,n){void 0===e&&(e="div"),void 0===t&&(t={}),void 0===i&&(i={});var r=te.createElement(e);return Object.getOwnPropertyNames(t).forEach((function(e){var i=t[e];-1!==e.indexOf("aria-")||"role"===e||"type"===e?(Ha.warn("Setting attributes in the second argument of createEl()\nhas been deprecated. Use the third argument instead.\ncreateEl(type, properties, attributes). Attempting to set "+e+" to "+i+"."),r.setAttribute(e,i)):"textContent"===e?xs(r,i):r[e]===i&&"tabIndex"!==e||(r[e]=i)})),Object.getOwnPropertyNames(i).forEach((function(e){r.setAttribute(e,i[e])})),n&&zs(r,n),r}function xs(e,t){return void 0===e.textContent?e.innerText=t:e.textContent=t,e}function Is(e,t){t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)}function As(e,t){return Ts(t),e.classList?e.classList.contains(t):(i=t,new RegExp("(^|\\s)"+i+"($|\\s)")).test(e.className);var i}function Ps(e,t){return e.classList?e.classList.add(t):As(e,t)||(e.className=(e.className+" "+t).trim()),e}function Ls(e,t){return e?(e.classList?e.classList.remove(t):(Ts(t),e.className=e.className.split(/\s+/).filter((function(e){return e!==t})).join(" ")),e):(Ha.warn("removeClass was called with an element that doesn't exist"),null)}function Ds(e,t,i){var n=As(e,t);if("function"==typeof i&&(i=i(e,t)),"boolean"!=typeof i&&(i=!n),i!==n)return i?Ps(e,t):Ls(e,t),e}function Os(e,t){Object.getOwnPropertyNames(t).forEach((function(i){var n=t[i];null==n||!1===n?e.removeAttribute(i):e.setAttribute(i,!0===n?"":n)}))}function Ns(e){var t={},i=",autoplay,controls,playsinline,loop,muted,default,defaultMuted,";if(e&&e.attributes&&e.attributes.length>0)for(var n=e.attributes,r=n.length-1;r>=0;r--){var a=n[r].name,s=n[r].value;"boolean"!=typeof e[a]&&-1===i.indexOf(","+a+",")||(s=null!==s),t[a]=s}return t}function Rs(e,t){return e.getAttribute(t)}function Ms(e,t,i){e.setAttribute(t,i)}function Us(e,t){e.removeAttribute(t)}function Bs(){te.body.focus(),te.onselectstart=function(){return!1}}function Fs(){te.onselectstart=function(){return!0}}function js(e){if(e&&e.getBoundingClientRect&&e.parentNode){var t=e.getBoundingClientRect(),i={};return["bottom","height","left","right","top","width"].forEach((function(e){void 0!==t[e]&&(i[e]=t[e])})),i.height||(i.height=parseFloat($a(e,"height"))),i.width||(i.width=parseFloat($a(e,"width"))),i}}function qs(e){if(!e||e&&!e.offsetParent)return{left:0,top:0,width:0,height:0};for(var t=e.offsetWidth,i=e.offsetHeight,n=0,r=0;e.offsetParent&&e!==te[Ua.fullscreenElement];)n+=e.offsetLeft,r+=e.offsetTop,e=e.offsetParent;return{left:n,top:r,width:t,height:i}}function Vs(e,t){var i={x:0,y:0};if(vs)for(var n=e;n&&"html"!==n.nodeName.toLowerCase();){var r=$a(n,"transform");if(/^matrix/.test(r)){var a=r.slice(7,-1).split(/,\s/).map(Number);i.x+=a[4],i.y+=a[5]}else if(/^matrix3d/.test(r)){var s=r.slice(9,-1).split(/,\s/).map(Number);i.x+=s[12],i.y+=s[13]}n=n.parentNode}var o={},u=qs(t.target),l=qs(e),c=l.width,d=l.height,h=t.offsetY-(l.top-u.top),p=t.offsetX-(l.left-u.left);return t.changedTouches&&(p=t.changedTouches[0].pageX-l.left,h=t.changedTouches[0].pageY+l.top,vs&&(p-=i.x,h-=i.y)),o.y=1-Math.max(0,Math.min(1,h/d)),o.x=Math.max(0,Math.min(1,p/c)),o}function Hs(e){return Ya(e)&&3===e.nodeType}function Ws(e){for(;e.firstChild;)e.removeChild(e.firstChild);return e}function Gs(e){return"function"==typeof e&&(e=e()),(Array.isArray(e)?e:[e]).map((function(e){return"function"==typeof e&&(e=e()),Es(e)||Hs(e)?e:"string"==typeof e&&/\S/.test(e)?te.createTextNode(e):void 0})).filter((function(e){return e}))}function zs(e,t){return Gs(t).forEach((function(t){return e.appendChild(t)})),e}function Xs(e,t){return zs(Ws(e),t)}function Ks(e){return void 0===e.button&&void 0===e.buttons||(0===e.button&&void 0===e.buttons||("mouseup"===e.type&&0===e.button&&0===e.buttons||0===e.button&&1===e.buttons))}var Ys,Qs=ks("querySelector"),$s=ks("querySelectorAll"),Js=Object.freeze({__proto__:null,isReal:Ss,isEl:Es,isInFrame:ws,createEl:Cs,textContent:xs,prependTo:Is,hasClass:As,addClass:Ps,removeClass:Ls,toggleClass:Ds,setAttributes:Os,getAttributes:Ns,getAttribute:Rs,setAttribute:Ms,removeAttribute:Us,blockTextSelection:Bs,unblockTextSelection:Fs,getBoundingClientRect:js,findPosition:qs,getPointerPosition:Vs,isTextNode:Hs,emptyEl:Ws,normalizeContent:Gs,appendContent:zs,insertContent:Xs,isSingleLeftClick:Ks,$:Qs,$$:$s}),Zs=!1,eo=function(){if(!1!==Ys.options.autoSetup){var e=Array.prototype.slice.call(te.getElementsByTagName("video")),t=Array.prototype.slice.call(te.getElementsByTagName("audio")),i=Array.prototype.slice.call(te.getElementsByTagName("video-js")),n=e.concat(t,i);if(n&&n.length>0)for(var r=0,a=n.length;r<a;r++){var s=n[r];if(!s||!s.getAttribute){to(1);break}void 0===s.player&&null!==s.getAttribute("data-setup")&&Ys(s)}else Zs||to(1)}};function to(e,t){Ss()&&(t&&(Ys=t),d.setTimeout(eo,e))}function io(){Zs=!0,d.removeEventListener("load",io)}Ss()&&("complete"===te.readyState?io():d.addEventListener("load",io));var no,ro=function(e){var t=te.createElement("style");return t.className=e,t},ao=function(e,t){e.styleSheet?e.styleSheet.cssText=t:e.textContent=t},so=3;function oo(){return so++}d.WeakMap||(no=function(){function e(){this.vdata="vdata"+Math.floor(d.performance&&d.performance.now()||Date.now()),this.data={}}var t=e.prototype;return t.set=function(e,t){var i=e[this.vdata]||oo();return e[this.vdata]||(e[this.vdata]=i),this.data[i]=t,this},t.get=function(e){var t=e[this.vdata];if(t)return this.data[t];Ha("We have no data for this element",e)},t.has=function(e){return e[this.vdata]in this.data},t.delete=function(e){var t=e[this.vdata];t&&(delete this.data[t],delete e[this.vdata])},e}());var uo,lo=d.WeakMap?new WeakMap:new no;function co(e,t){if(lo.has(e)){var i=lo.get(e);0===i.handlers[t].length&&(delete i.handlers[t],e.removeEventListener?e.removeEventListener(t,i.dispatcher,!1):e.detachEvent&&e.detachEvent("on"+t,i.dispatcher)),Object.getOwnPropertyNames(i.handlers).length<=0&&(delete i.handlers,delete i.dispatcher,delete i.disabled),0===Object.getOwnPropertyNames(i).length&&lo.delete(e)}}function ho(e,t,i,n){i.forEach((function(i){e(t,i,n)}))}function po(e){if(e.fixed_)return e;function t(){return!0}function i(){return!1}if(!e||!e.isPropagationStopped||!e.isImmediatePropagationStopped){var n=e||d.event;for(var r in e={},n)"layerX"!==r&&"layerY"!==r&&"keyLocation"!==r&&"webkitMovementX"!==r&&"webkitMovementY"!==r&&"path"!==r&&("returnValue"===r&&n.preventDefault||(e[r]=n[r]));if(e.target||(e.target=e.srcElement||te),e.relatedTarget||(e.relatedTarget=e.fromElement===e.target?e.toElement:e.fromElement),e.preventDefault=function(){n.preventDefault&&n.preventDefault(),e.returnValue=!1,n.returnValue=!1,e.defaultPrevented=!0},e.defaultPrevented=!1,e.stopPropagation=function(){n.stopPropagation&&n.stopPropagation(),e.cancelBubble=!0,n.cancelBubble=!0,e.isPropagationStopped=t},e.isPropagationStopped=i,e.stopImmediatePropagation=function(){n.stopImmediatePropagation&&n.stopImmediatePropagation(),e.isImmediatePropagationStopped=t,e.stopPropagation()},e.isImmediatePropagationStopped=i,null!==e.clientX&&void 0!==e.clientX){var a=te.documentElement,s=te.body;e.pageX=e.clientX+(a&&a.scrollLeft||s&&s.scrollLeft||0)-(a&&a.clientLeft||s&&s.clientLeft||0),e.pageY=e.clientY+(a&&a.scrollTop||s&&s.scrollTop||0)-(a&&a.clientTop||s&&s.clientTop||0)}e.which=e.charCode||e.keyCode,null!==e.button&&void 0!==e.button&&(e.button=1&e.button?0:4&e.button?1:2&e.button?2:0)}return e.fixed_=!0,e}var fo=function(){if("boolean"!=typeof uo){uo=!1;try{var e=Object.defineProperty({},"passive",{get:function(){uo=!0}});d.addEventListener("test",null,e),d.removeEventListener("test",null,e)}catch(e){}}return uo},mo=["touchstart","touchmove"];function go(e,t,i){if(Array.isArray(t))return ho(go,e,t,i);lo.has(e)||lo.set(e,{});var n=lo.get(e);if(n.handlers||(n.handlers={}),n.handlers[t]||(n.handlers[t]=[]),i.guid||(i.guid=oo()),n.handlers[t].push(i),n.dispatcher||(n.disabled=!1,n.dispatcher=function(t,i){if(!n.disabled){t=po(t);var r=n.handlers[t.type];if(r)for(var a=r.slice(0),s=0,o=a.length;s<o&&!t.isImmediatePropagationStopped();s++)try{a[s].call(e,t,i)}catch(e){Ha.error(e)}}}),1===n.handlers[t].length)if(e.addEventListener){var r=!1;fo()&&mo.indexOf(t)>-1&&(r={passive:!0}),e.addEventListener(t,n.dispatcher,r)}else e.attachEvent&&e.attachEvent("on"+t,n.dispatcher)}function vo(e,t,i){if(lo.has(e)){var n=lo.get(e);if(n.handlers){if(Array.isArray(t))return ho(vo,e,t,i);var r=function(e,t){n.handlers[t]=[],co(e,t)};if(void 0!==t){var a=n.handlers[t];if(a)if(i){if(i.guid)for(var s=0;s<a.length;s++)a[s].guid===i.guid&&a.splice(s--,1);co(e,t)}else r(e,t)}else for(var o in n.handlers)Object.prototype.hasOwnProperty.call(n.handlers||{},o)&&r(e,o)}}}function yo(e,t,i){var n=lo.has(e)?lo.get(e):{},r=e.parentNode||e.ownerDocument;if("string"==typeof t?t={type:t,target:e}:t.target||(t.target=e),t=po(t),n.dispatcher&&n.dispatcher.call(e,t,i),r&&!t.isPropagationStopped()&&!0===t.bubbles)yo.call(null,r,t,i);else if(!r&&!t.defaultPrevented&&t.target&&t.target[t.type]){lo.has(t.target)||lo.set(t.target,{});var a=lo.get(t.target);t.target[t.type]&&(a.disabled=!0,"function"==typeof t.target[t.type]&&t.target[t.type](),a.disabled=!1)}return!t.defaultPrevented}function _o(e,t,i){if(Array.isArray(t))return ho(_o,e,t,i);var n=function n(){vo(e,t,n),i.apply(this,arguments)};n.guid=i.guid=i.guid||oo(),go(e,t,n)}function bo(e,t,i){var n=function n(){vo(e,t,n),i.apply(this,arguments)};n.guid=i.guid=i.guid||oo(),go(e,t,n)}var To,So=Object.freeze({__proto__:null,fixEvent:po,on:go,off:vo,trigger:yo,one:_o,any:bo}),Eo=30,wo=function(e,t,i){t.guid||(t.guid=oo());var n=t.bind(e);return n.guid=i?i+"_"+t.guid:t.guid,n},ko=function(e,t){var i=d.performance.now();return function(){var n=d.performance.now();n-i>=t&&(e.apply(void 0,arguments),i=n)}},Co=function(){};Co.prototype.allowedEvents_={},Co.prototype.on=function(e,t){var i=this.addEventListener;this.addEventListener=function(){},go(this,e,t),this.addEventListener=i},Co.prototype.addEventListener=Co.prototype.on,Co.prototype.off=function(e,t){vo(this,e,t)},Co.prototype.removeEventListener=Co.prototype.off,Co.prototype.one=function(e,t){var i=this.addEventListener;this.addEventListener=function(){},_o(this,e,t),this.addEventListener=i},Co.prototype.any=function(e,t){var i=this.addEventListener;this.addEventListener=function(){},bo(this,e,t),this.addEventListener=i},Co.prototype.trigger=function(e){var t=e.type||e;"string"==typeof e&&(e={type:t}),e=po(e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),yo(this,e)},Co.prototype.dispatchEvent=Co.prototype.trigger,Co.prototype.queueTrigger=function(e){var t=this;To||(To=new Map);var i=e.type||e,n=To.get(this);n||(n=new Map,To.set(this,n));var r=n.get(i);n.delete(i),d.clearTimeout(r);var a=d.setTimeout((function(){n.delete(i),0===n.size&&(n=null,To.delete(t)),t.trigger(e)}),0);n.set(i,a)};var xo=function(e){return"function"==typeof e.name?e.name():"string"==typeof e.name?e.name:e.name_?e.name_:e.constructor&&e.constructor.name?e.constructor.name:u(e)},Io=function(e){return e instanceof Co||!!e.eventBusEl_&&["on","one","off","trigger"].every((function(t){return"function"==typeof e[t]}))},Ao=function(e){return"string"==typeof e&&/\S/.test(e)||Array.isArray(e)&&!!e.length},Po=function(e,t,i){if(!e||!e.nodeName&&!Io(e))throw new Error("Invalid target for "+xo(t)+"#"+i+"; must be a DOM node or evented object.")},Lo=function(e,t,i){if(!Ao(e))throw new Error("Invalid event type for "+xo(t)+"#"+i+"; must be a non-empty string or array.")},Do=function(e,t,i){if("function"!=typeof e)throw new Error("Invalid listener for "+xo(t)+"#"+i+"; must be a function.")},Oo=function(e,t,i){var n,r,a,s=t.length<3||t[0]===e||t[0]===e.eventBusEl_;return s?(n=e.eventBusEl_,t.length>=3&&t.shift(),r=t[0],a=t[1]):(n=t[0],r=t[1],a=t[2]),Po(n,e,i),Lo(r,e,i),Do(a,e,i),{isTargetingSelf:s,target:n,type:r,listener:a=wo(e,a)}},No=function(e,t,i,n){Po(e,e,t),e.nodeName?So[t](e,i,n):e[t](i,n)},Ro={on:function(){for(var e=this,t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];var r=Oo(this,i,"on"),a=r.isTargetingSelf,s=r.target,o=r.type,u=r.listener;if(No(s,"on",o,u),!a){var l=function(){return e.off(s,o,u)};l.guid=u.guid;var c=function(){return e.off("dispose",l)};c.guid=u.guid,No(this,"on","dispose",l),No(s,"on","dispose",c)}},one:function(){for(var e=this,t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];var r=Oo(this,i,"one"),a=r.isTargetingSelf,s=r.target,o=r.type,u=r.listener;if(a)No(s,"one",o,u);else{var l=function t(){e.off(s,o,t);for(var i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];u.apply(null,n)};l.guid=u.guid,No(s,"one",o,l)}},any:function(){for(var e=this,t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];var r=Oo(this,i,"any"),a=r.isTargetingSelf,s=r.target,o=r.type,u=r.listener;if(a)No(s,"any",o,u);else{var l=function t(){e.off(s,o,t);for(var i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];u.apply(null,n)};l.guid=u.guid,No(s,"any",o,l)}},off:function(e,t,i){if(!e||Ao(e))vo(this.eventBusEl_,e,t);else{var n=e,r=t;Po(n,this,"off"),Lo(r,this,"off"),Do(i,this,"off"),i=wo(this,i),this.off("dispose",i),n.nodeName?(vo(n,r,i),vo(n,"dispose",i)):Io(n)&&(n.off(r,i),n.off("dispose",i))}},trigger:function(e,t){Po(this.eventBusEl_,this,"trigger");var i=e&&"string"!=typeof e?e.type:e;if(!Ao(i)){var n="Invalid event type for "+xo(this)+"#trigger; must be a non-empty string or object with a type key that has a non-empty value.";if(!e)throw new Error(n);(this.log||Ha).error(n)}return yo(this.eventBusEl_,e,t)}};function Mo(e,t){void 0===t&&(t={});var i=t.eventBusKey;if(i){if(!e[i].nodeName)throw new Error('The eventBusKey "'+i+'" does not refer to an element.');e.eventBusEl_=e[i]}else e.eventBusEl_=Cs("span",{className:"vjs-event-bus"});return Ka(e,Ro),e.eventedCallbacks&&e.eventedCallbacks.forEach((function(e){e()})),e.on("dispose",(function(){e.off(),[e,e.el_,e.eventBusEl_].forEach((function(e){e&&lo.has(e)&&lo.delete(e)})),d.setTimeout((function(){e.eventBusEl_=null}),0)})),e}var Uo={state:{},setState:function(e){var t,i=this;return"function"==typeof e&&(e=e()),Xa(e,(function(e,n){i.state[n]!==e&&((t=t||{})[n]={from:i.state[n],to:e}),i.state[n]=e})),t&&Io(this)&&this.trigger({changes:t,type:"statechanged"}),t}};function Bo(e,t){return Ka(e,Uo),e.state=Ka({},e.state,t),"function"==typeof e.handleStateChanged&&Io(e)&&e.on("statechanged",e.handleStateChanged),e}var Fo=function(e){return"string"!=typeof e?e:e.replace(/./,(function(e){return e.toLowerCase()}))},jo=function(e){return"string"!=typeof e?e:e.replace(/./,(function(e){return e.toUpperCase()}))};function qo(){for(var e={},t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];return i.forEach((function(t){t&&Xa(t,(function(t,i){Qa(t)?(Qa(e[i])||(e[i]={}),e[i]=qo(e[i],t)):e[i]=t}))})),e}var Vo=function(){function e(){this.map_={}}var t=e.prototype;return t.has=function(e){return e in this.map_},t.delete=function(e){var t=this.has(e);return delete this.map_[e],t},t.set=function(e,t){return this.map_[e]=t,this},t.forEach=function(e,t){for(var i in this.map_)e.call(t,this.map_[i],i,this)},e}(),Ho=d.Map?d.Map:Vo,Wo=function(){function e(){this.set_={}}var t=e.prototype;return t.has=function(e){return e in this.set_},t.delete=function(e){var t=this.has(e);return delete this.set_[e],t},t.add=function(e){return this.set_[e]=1,this},t.forEach=function(e,t){for(var i in this.set_)e.call(t,i,i,this)},e}(),Go=d.Set?d.Set:Wo,zo=function(){function e(e,t,i){var n=this;if(!e&&this.play?this.player_=e=this:this.player_=e,this.isDisposed_=!1,this.parentComponent_=null,this.options_=qo({},this.options_),t=this.options_=qo(this.options_,t),this.id_=t.id||t.el&&t.el.id,!this.id_){var r=e&&e.id&&e.id()||"no_player";this.id_=r+"_component_"+oo()}this.name_=t.name||null,t.el?this.el_=t.el:!1!==t.createEl&&(this.el_=this.createEl()),t.className&&this.el_&&t.className.split(" ").forEach((function(e){return n.addClass(e)})),!1!==t.evented&&(Mo(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange)),Bo(this,this.constructor.defaultState),this.children_=[],this.childIndex_={},this.childNameIndex_={},this.setTimeoutIds_=new Go,this.setIntervalIds_=new Go,this.rafIds_=new Go,this.namedRafs_=new Ho,this.clearingTimersOnDispose_=!1,!1!==t.initChildren&&this.initChildren(),this.ready(i),!1!==t.reportTouchActivity&&this.enableTouchActivity()}var t=e.prototype;return t.dispose=function(e){if(void 0===e&&(e={}),!this.isDisposed_){if(this.readyQueue_&&(this.readyQueue_.length=0),this.trigger({type:"dispose",bubbles:!1}),this.isDisposed_=!0,this.children_)for(var t=this.children_.length-1;t>=0;t--)this.children_[t].dispose&&this.children_[t].dispose();this.children_=null,this.childIndex_=null,this.childNameIndex_=null,this.parentComponent_=null,this.el_&&(this.el_.parentNode&&(e.restoreEl?this.el_.parentNode.replaceChild(e.restoreEl,this.el_):this.el_.parentNode.removeChild(this.el_)),this.el_=null),this.player_=null}},t.isDisposed=function(){return Boolean(this.isDisposed_)},t.player=function(){return this.player_},t.options=function(e){return e?(this.options_=qo(this.options_,e),this.options_):this.options_},t.el=function(){return this.el_},t.createEl=function(e,t,i){return Cs(e,t,i)},t.localize=function(e,t,i){void 0===i&&(i=e);var n=this.player_.language&&this.player_.language(),r=this.player_.languages&&this.player_.languages(),a=r&&r[n],s=n&&n.split("-")[0],o=r&&r[s],u=i;return a&&a[e]?u=a[e]:o&&o[e]&&(u=o[e]),t&&(u=u.replace(/\{(\d+)\}/g,(function(e,i){var n=t[i-1],r=n;return void 0===n&&(r=e),r}))),u},t.handleLanguagechange=function(){},t.contentEl=function(){return this.contentEl_||this.el_},t.id=function(){return this.id_},t.name=function(){return this.name_},t.children=function(){return this.children_},t.getChildById=function(e){return this.childIndex_[e]},t.getChild=function(e){if(e)return this.childNameIndex_[e]},t.getDescendant=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];t=t.reduce((function(e,t){return e.concat(t)}),[]);for(var n=this,r=0;r<t.length;r++)if(!(n=n.getChild(t[r]))||!n.getChild)return;return n},t.addChild=function(t,i,n){var r,a;if(void 0===i&&(i={}),void 0===n&&(n=this.children_.length),"string"==typeof t){a=jo(t);var s=i.componentClass||a;i.name=a;var o=e.getComponent(s);if(!o)throw new Error("Component "+s+" does not exist");if("function"!=typeof o)return null;r=new o(this.player_||this,i)}else r=t;if(r.parentComponent_&&r.parentComponent_.removeChild(r),this.children_.splice(n,0,r),r.parentComponent_=this,"function"==typeof r.id&&(this.childIndex_[r.id()]=r),(a=a||r.name&&jo(r.name()))&&(this.childNameIndex_[a]=r,this.childNameIndex_[Fo(a)]=r),"function"==typeof r.el&&r.el()){var u=null;this.children_[n+1]&&(this.children_[n+1].el_?u=this.children_[n+1].el_:Es(this.children_[n+1])&&(u=this.children_[n+1])),this.contentEl().insertBefore(r.el(),u)}return r},t.removeChild=function(e){if("string"==typeof e&&(e=this.getChild(e)),e&&this.children_){for(var t=!1,i=this.children_.length-1;i>=0;i--)if(this.children_[i]===e){t=!0,this.children_.splice(i,1);break}if(t){e.parentComponent_=null,this.childIndex_[e.id()]=null,this.childNameIndex_[jo(e.name())]=null,this.childNameIndex_[Fo(e.name())]=null;var n=e.el();n&&n.parentNode===this.contentEl()&&this.contentEl().removeChild(e.el())}}},t.initChildren=function(){var t=this,i=this.options_.children;if(i){var n,r=this.options_,a=e.getComponent("Tech");(n=Array.isArray(i)?i:Object.keys(i)).concat(Object.keys(this.options_).filter((function(e){return!n.some((function(t){return"string"==typeof t?e===t:e===t.name}))}))).map((function(e){var n,r;return"string"==typeof e?r=i[n=e]||t.options_[n]||{}:(n=e.name,r=e),{name:n,opts:r}})).filter((function(t){var i=e.getComponent(t.opts.componentClass||jo(t.name));return i&&!a.isTech(i)})).forEach((function(e){var i=e.name,n=e.opts;if(void 0!==r[i]&&(n=r[i]),!1!==n){!0===n&&(n={}),n.playerOptions=t.options_.playerOptions;var a=t.addChild(i,n);a&&(t[i]=a)}}))}},t.buildCSSClass=function(){return""},t.ready=function(e,t){if(void 0===t&&(t=!1),e)return this.isReady_?void(t?e.call(this):this.setTimeout(e,1)):(this.readyQueue_=this.readyQueue_||[],void this.readyQueue_.push(e))},t.triggerReady=function(){this.isReady_=!0,this.setTimeout((function(){var e=this.readyQueue_;this.readyQueue_=[],e&&e.length>0&&e.forEach((function(e){e.call(this)}),this),this.trigger("ready")}),1)},t.$=function(e,t){return Qs(e,t||this.contentEl())},t.$$=function(e,t){return $s(e,t||this.contentEl())},t.hasClass=function(e){return As(this.el_,e)},t.addClass=function(e){Ps(this.el_,e)},t.removeClass=function(e){Ls(this.el_,e)},t.toggleClass=function(e,t){Ds(this.el_,e,t)},t.show=function(){this.removeClass("vjs-hidden")},t.hide=function(){this.addClass("vjs-hidden")},t.lockShowing=function(){this.addClass("vjs-lock-showing")},t.unlockShowing=function(){this.removeClass("vjs-lock-showing")},t.getAttribute=function(e){return Rs(this.el_,e)},t.setAttribute=function(e,t){Ms(this.el_,e,t)},t.removeAttribute=function(e){Us(this.el_,e)},t.width=function(e,t){return this.dimension("width",e,t)},t.height=function(e,t){return this.dimension("height",e,t)},t.dimensions=function(e,t){this.width(e,!0),this.height(t)},t.dimension=function(e,t,i){if(void 0!==t)return null!==t&&t==t||(t=0),-1!==(""+t).indexOf("%")||-1!==(""+t).indexOf("px")?this.el_.style[e]=t:this.el_.style[e]="auto"===t?"":t+"px",void(i||this.trigger("componentresize"));if(!this.el_)return 0;var n=this.el_.style[e],r=n.indexOf("px");return-1!==r?parseInt(n.slice(0,r),10):parseInt(this.el_["offset"+jo(e)],10)},t.currentDimension=function(e){var t=0;if("width"!==e&&"height"!==e)throw new Error("currentDimension only accepts width or height value");if(t=$a(this.el_,e),0===(t=parseFloat(t))||isNaN(t)){var i="offset"+jo(e);t=this.el_[i]}return t},t.currentDimensions=function(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}},t.currentWidth=function(){return this.currentDimension("width")},t.currentHeight=function(){return this.currentDimension("height")},t.focus=function(){this.el_.focus()},t.blur=function(){this.el_.blur()},t.handleKeyDown=function(e){this.player_&&(re.isEventKey(e,"Tab")||e.stopPropagation(),this.player_.handleKeyDown(e))},t.handleKeyPress=function(e){this.handleKeyDown(e)},t.emitTapEvents=function(){var e,t=0,i=null;this.on("touchstart",(function(n){1===n.touches.length&&(i={pageX:n.touches[0].pageX,pageY:n.touches[0].pageY},t=d.performance.now(),e=!0)})),this.on("touchmove",(function(t){if(t.touches.length>1)e=!1;else if(i){var n=t.touches[0].pageX-i.pageX,r=t.touches[0].pageY-i.pageY;Math.sqrt(n*n+r*r)>10&&(e=!1)}}));var n=function(){e=!1};this.on("touchleave",n),this.on("touchcancel",n),this.on("touchend",(function(n){(i=null,!0===e)&&(d.performance.now()-t<200&&(n.preventDefault(),this.trigger("tap")))}))},t.enableTouchActivity=function(){if(this.player()&&this.player().reportUserActivity){var e,t=wo(this.player(),this.player().reportUserActivity);this.on("touchstart",(function(){t(),this.clearInterval(e),e=this.setInterval(t,250)}));var i=function(i){t(),this.clearInterval(e)};this.on("touchmove",t),this.on("touchend",i),this.on("touchcancel",i)}},t.setTimeout=function(e,t){var i,n=this;return e=wo(this,e),this.clearTimersOnDispose_(),i=d.setTimeout((function(){n.setTimeoutIds_.has(i)&&n.setTimeoutIds_.delete(i),e()}),t),this.setTimeoutIds_.add(i),i},t.clearTimeout=function(e){return this.setTimeoutIds_.has(e)&&(this.setTimeoutIds_.delete(e),d.clearTimeout(e)),e},t.setInterval=function(e,t){e=wo(this,e),this.clearTimersOnDispose_();var i=d.setInterval(e,t);return this.setIntervalIds_.add(i),i},t.clearInterval=function(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),d.clearInterval(e)),e},t.requestAnimationFrame=function(e){var t,i=this;return this.supportsRaf_?(this.clearTimersOnDispose_(),e=wo(this,e),t=d.requestAnimationFrame((function(){i.rafIds_.has(t)&&i.rafIds_.delete(t),e()})),this.rafIds_.add(t),t):this.setTimeout(e,1e3/60)},t.requestNamedAnimationFrame=function(e,t){var i=this;if(!this.namedRafs_.has(e)){this.clearTimersOnDispose_(),t=wo(this,t);var n=this.requestAnimationFrame((function(){t(),i.namedRafs_.has(e)&&i.namedRafs_.delete(e)}));return this.namedRafs_.set(e,n),e}},t.cancelNamedAnimationFrame=function(e){this.namedRafs_.has(e)&&(this.cancelAnimationFrame(this.namedRafs_.get(e)),this.namedRafs_.delete(e))},t.cancelAnimationFrame=function(e){return this.supportsRaf_?(this.rafIds_.has(e)&&(this.rafIds_.delete(e),d.cancelAnimationFrame(e)),e):this.clearTimeout(e)},t.clearTimersOnDispose_=function(){var e=this;this.clearingTimersOnDispose_||(this.clearingTimersOnDispose_=!0,this.one("dispose",(function(){[["namedRafs_","cancelNamedAnimationFrame"],["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach((function(t){var i=t[0],n=t[1];e[i].forEach((function(t,i){return e[n](i)}))})),e.clearingTimersOnDispose_=!1})))},e.registerComponent=function(t,i){if("string"!=typeof t||!t)throw new Error('Illegal component name, "'+t+'"; must be a non-empty string.');var n,r=e.getComponent("Tech"),a=r&&r.isTech(i),s=e===i||e.prototype.isPrototypeOf(i.prototype);if(a||!s)throw n=a?"techs must be registered using Tech.registerTech()":"must be a Component subclass",new Error('Illegal component, "'+t+'"; '+n+".");t=jo(t),e.components_||(e.components_={});var o=e.getComponent("Player");if("Player"===t&&o&&o.players){var u=o.players,l=Object.keys(u);if(u&&l.length>0&&l.map((function(e){return u[e]})).every(Boolean))throw new Error("Can not register Player component after player has been created.")}return e.components_[t]=i,e.components_[Fo(t)]=i,i},e.getComponent=function(t){if(t&&e.components_)return e.components_[t]},e}();function Xo(e,t,i,n){return function(e,t,i){if("number"!=typeof t||t<0||t>i)throw new Error("Failed to execute '"+e+"' on 'TimeRanges': The index provided ("+t+") is non-numeric or out of bounds (0-"+i+").")}(e,n,i.length-1),i[n][t]}function Ko(e){var t;return t=void 0===e||0===e.length?{length:0,start:function(){throw new Error("This TimeRanges object is empty")},end:function(){throw new Error("This TimeRanges object is empty")}}:{length:e.length,start:Xo.bind(null,"start",0,e),end:Xo.bind(null,"end",1,e)},d.Symbol&&d.Symbol.iterator&&(t[d.Symbol.iterator]=function(){return(e||[]).values()}),t}function Yo(e,t){return Array.isArray(e)?Ko(e):void 0===e||void 0===t?Ko():Ko([[e,t]])}function Qo(e,t){var i,n,r=0;if(!t)return 0;e&&e.length||(e=Yo(0,0));for(var a=0;a<e.length;a++)i=e.start(a),(n=e.end(a))>t&&(n=t),r+=n-i;return r/t}function $o(e){if(e instanceof $o)return e;"number"==typeof e?this.code=e:"string"==typeof e?this.message=e:Ya(e)&&("number"==typeof e.code&&(this.code=e.code),Ka(this,e)),this.message||(this.message=$o.defaultMessages[this.code]||"")}zo.prototype.supportsRaf_="function"==typeof d.requestAnimationFrame&&"function"==typeof d.cancelAnimationFrame,zo.registerComponent("Component",zo),$o.prototype.code=0,$o.prototype.message="",$o.prototype.status=null,$o.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"],$o.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail part-way.",3:"The media playback was aborted due to a corruption problem or because the media used features your browser did not support.",4:"The media could not be loaded, either because the server or network failed or because the format is not supported.",5:"The media is encrypted and we do not have the keys to decrypt it."};for(var Jo=0;Jo<$o.errorTypes.length;Jo++)$o[$o.errorTypes[Jo]]=Jo,$o.prototype[$o.errorTypes[Jo]]=Jo;function Zo(e){return null!=e&&"function"==typeof e.then}function eu(e){Zo(e)&&e.then(null,(function(e){}))}var tu=function(e){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce((function(t,i,n){return e[i]&&(t[i]=e[i]),t}),{cues:e.cues&&Array.prototype.map.call(e.cues,(function(e){return{startTime:e.startTime,endTime:e.endTime,text:e.text,id:e.id}}))})},iu=function(e){var t=e.$$("track"),i=Array.prototype.map.call(t,(function(e){return e.track}));return Array.prototype.map.call(t,(function(e){var t=tu(e.track);return e.src&&(t.src=e.src),t})).concat(Array.prototype.filter.call(e.textTracks(),(function(e){return-1===i.indexOf(e)})).map(tu))},nu=function(e,t){return e.forEach((function(e){var i=t.addRemoteTextTrack(e).track;!e.src&&e.cues&&e.cues.forEach((function(e){return i.addCue(e)}))})),t.textTracks()},ru="vjs-modal-dialog",au=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).handleKeyDown_=function(e){return n.handleKeyDown(e)},n.close_=function(e){return n.close(e)},n.opened_=n.hasBeenOpened_=n.hasBeenFilled_=!1,n.closeable(!n.options_.uncloseable),n.content(n.options_.content),n.contentEl_=Cs("div",{className:ru+"-content"},{role:"document"}),n.descEl_=Cs("p",{className:ru+"-description vjs-control-text",id:n.el().getAttribute("aria-describedby")}),xs(n.descEl_,n.description()),n.el_.appendChild(n.descEl_),n.el_.appendChild(n.contentEl_),n}oe(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:this.buildCSSClass(),tabIndex:-1},{"aria-describedby":this.id()+"_description","aria-hidden":"true","aria-label":this.label(),role:"dialog"})},i.dispose=function(){this.contentEl_=null,this.descEl_=null,this.previouslyActiveEl_=null,e.prototype.dispose.call(this)},i.buildCSSClass=function(){return ru+" vjs-hidden "+e.prototype.buildCSSClass.call(this)},i.label=function(){return this.localize(this.options_.label||"Modal Window")},i.description=function(){var e=this.options_.description||this.localize("This is a modal window.");return this.closeable()&&(e+=" "+this.localize("This modal can be closed by pressing the Escape key or activating the close button.")),e},i.open=function(){if(!this.opened_){var e=this.player();this.trigger("beforemodalopen"),this.opened_=!0,(this.options_.fillAlways||!this.hasBeenOpened_&&!this.hasBeenFilled_)&&this.fill(),this.wasPlaying_=!e.paused(),this.options_.pauseOnOpen&&this.wasPlaying_&&e.pause(),this.on("keydown",this.handleKeyDown_),this.hadControls_=e.controls(),e.controls(!1),this.show(),this.conditionalFocus_(),this.el().setAttribute("aria-hidden","false"),this.trigger("modalopen"),this.hasBeenOpened_=!0}},i.opened=function(e){return"boolean"==typeof e&&this[e?"open":"close"](),this.opened_},i.close=function(){if(this.opened_){var e=this.player();this.trigger("beforemodalclose"),this.opened_=!1,this.wasPlaying_&&this.options_.pauseOnOpen&&e.play(),this.off("keydown",this.handleKeyDown_),this.hadControls_&&e.controls(!0),this.hide(),this.el().setAttribute("aria-hidden","true"),this.trigger("modalclose"),this.conditionalBlur_(),this.options_.temporary&&this.dispose()}},i.closeable=function(e){if("boolean"==typeof e){var t=this.closeable_=!!e,i=this.getChild("closeButton");if(t&&!i){var n=this.contentEl_;this.contentEl_=this.el_,i=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=n,this.on(i,"close",this.close_)}!t&&i&&(this.off(i,"close",this.close_),this.removeChild(i),i.dispose())}return this.closeable_},i.fill=function(){this.fillWith(this.content())},i.fillWith=function(e){var t=this.contentEl(),i=t.parentNode,n=t.nextSibling;this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,i.removeChild(t),this.empty(),Xs(t,e),this.trigger("modalfill"),n?i.insertBefore(t,n):i.appendChild(t);var r=this.getChild("closeButton");r&&i.appendChild(r.el_)},i.empty=function(){this.trigger("beforemodalempty"),Ws(this.contentEl()),this.trigger("modalempty")},i.content=function(e){return void 0!==e&&(this.content_=e),this.content_},i.conditionalFocus_=function(){var e=te.activeElement,t=this.player_.el_;this.previouslyActiveEl_=null,(t.contains(e)||t===e)&&(this.previouslyActiveEl_=e,this.focus())},i.conditionalBlur_=function(){this.previouslyActiveEl_&&(this.previouslyActiveEl_.focus(),this.previouslyActiveEl_=null)},i.handleKeyDown=function(e){if(e.stopPropagation(),re.isEventKey(e,"Escape")&&this.closeable())return e.preventDefault(),void this.close();if(re.isEventKey(e,"Tab")){for(var t,i=this.focusableEls_(),n=this.el_.querySelector(":focus"),r=0;r<i.length;r++)if(n===i[r]){t=r;break}te.activeElement===this.el_&&(t=0),e.shiftKey&&0===t?(i[i.length-1].focus(),e.preventDefault()):e.shiftKey||t!==i.length-1||(i[0].focus(),e.preventDefault())}},i.focusableEls_=function(){var e=this.el_.querySelectorAll("*");return Array.prototype.filter.call(e,(function(e){return(e instanceof d.HTMLAnchorElement||e instanceof d.HTMLAreaElement)&&e.hasAttribute("href")||(e instanceof d.HTMLInputElement||e instanceof d.HTMLSelectElement||e instanceof d.HTMLTextAreaElement||e instanceof d.HTMLButtonElement)&&!e.hasAttribute("disabled")||e instanceof d.HTMLIFrameElement||e instanceof d.HTMLObjectElement||e instanceof d.HTMLEmbedElement||e.hasAttribute("tabindex")&&-1!==e.getAttribute("tabindex")||e.hasAttribute("contenteditable")}))},t}(zo);au.prototype.options_={pauseOnOpen:!0,temporary:!0},zo.registerComponent("ModalDialog",au);var su=function(e){function t(t){var i;void 0===t&&(t=[]),(i=e.call(this)||this).tracks_=[],Object.defineProperty(ae(i),"length",{get:function(){return this.tracks_.length}});for(var n=0;n<t.length;n++)i.addTrack(t[n]);return i}oe(t,e);var i=t.prototype;return i.addTrack=function(e){var t=this,i=this.tracks_.length;""+i in this||Object.defineProperty(this,i,{get:function(){return this.tracks_[i]}}),-1===this.tracks_.indexOf(e)&&(this.tracks_.push(e),this.trigger({track:e,type:"addtrack",target:this})),e.labelchange_=function(){t.trigger({track:e,type:"labelchange",target:t})},Io(e)&&e.addEventListener("labelchange",e.labelchange_)},i.removeTrack=function(e){for(var t,i=0,n=this.length;i<n;i++)if(this[i]===e){(t=this[i]).off&&t.off(),this.tracks_.splice(i,1);break}t&&this.trigger({track:t,type:"removetrack",target:this})},i.getTrackById=function(e){for(var t=null,i=0,n=this.length;i<n;i++){var r=this[i];if(r.id===e){t=r;break}}return t},t}(Co);for(var ou in su.prototype.allowedEvents_={change:"change",addtrack:"addtrack",removetrack:"removetrack",labelchange:"labelchange"},su.prototype.allowedEvents_)su.prototype["on"+ou]=null;var uu=function(e,t){for(var i=0;i<e.length;i++)Object.keys(e[i]).length&&t.id!==e[i].id&&(e[i].enabled=!1)},lu=function(e){function t(t){var i;void 0===t&&(t=[]);for(var n=t.length-1;n>=0;n--)if(t[n].enabled){uu(t,t[n]);break}return(i=e.call(this,t)||this).changing_=!1,i}oe(t,e);var i=t.prototype;return i.addTrack=function(t){var i=this;t.enabled&&uu(this,t),e.prototype.addTrack.call(this,t),t.addEventListener&&(t.enabledChange_=function(){i.changing_||(i.changing_=!0,uu(i,t),i.changing_=!1,i.trigger("change"))},t.addEventListener("enabledchange",t.enabledChange_))},i.removeTrack=function(t){e.prototype.removeTrack.call(this,t),t.removeEventListener&&t.enabledChange_&&(t.removeEventListener("enabledchange",t.enabledChange_),t.enabledChange_=null)},t}(su),cu=function(e,t){for(var i=0;i<e.length;i++)Object.keys(e[i]).length&&t.id!==e[i].id&&(e[i].selected=!1)},du=function(e){function t(t){var i;void 0===t&&(t=[]);for(var n=t.length-1;n>=0;n--)if(t[n].selected){cu(t,t[n]);break}return(i=e.call(this,t)||this).changing_=!1,Object.defineProperty(ae(i),"selectedIndex",{get:function(){for(var e=0;e<this.length;e++)if(this[e].selected)return e;return-1},set:function(){}}),i}oe(t,e);var i=t.prototype;return i.addTrack=function(t){var i=this;t.selected&&cu(this,t),e.prototype.addTrack.call(this,t),t.addEventListener&&(t.selectedChange_=function(){i.changing_||(i.changing_=!0,cu(i,t),i.changing_=!1,i.trigger("change"))},t.addEventListener("selectedchange",t.selectedChange_))},i.removeTrack=function(t){e.prototype.removeTrack.call(this,t),t.removeEventListener&&t.selectedChange_&&(t.removeEventListener("selectedchange",t.selectedChange_),t.selectedChange_=null)},t}(su),hu=function(e){function t(){return e.apply(this,arguments)||this}oe(t,e);var i=t.prototype;return i.addTrack=function(t){var i=this;e.prototype.addTrack.call(this,t),this.queueChange_||(this.queueChange_=function(){return i.queueTrigger("change")}),this.triggerSelectedlanguagechange||(this.triggerSelectedlanguagechange_=function(){return i.trigger("selectedlanguagechange")}),t.addEventListener("modechange",this.queueChange_);-1===["metadata","chapters"].indexOf(t.kind)&&t.addEventListener("modechange",this.triggerSelectedlanguagechange_)},i.removeTrack=function(t){e.prototype.removeTrack.call(this,t),t.removeEventListener&&(this.queueChange_&&t.removeEventListener("modechange",this.queueChange_),this.selectedlanguagechange_&&t.removeEventListener("modechange",this.triggerSelectedlanguagechange_))},t}(su),pu=function(){function e(e){void 0===e&&(e=[]),this.trackElements_=[],Object.defineProperty(this,"length",{get:function(){return this.trackElements_.length}});for(var t=0,i=e.length;t<i;t++)this.addTrackElement_(e[t])}var t=e.prototype;return t.addTrackElement_=function(e){var t=this.trackElements_.length;""+t in this||Object.defineProperty(this,t,{get:function(){return this.trackElements_[t]}}),-1===this.trackElements_.indexOf(e)&&this.trackElements_.push(e)},t.getTrackElementByTrack_=function(e){for(var t,i=0,n=this.trackElements_.length;i<n;i++)if(e===this.trackElements_[i].track){t=this.trackElements_[i];break}return t},t.removeTrackElement_=function(e){for(var t=0,i=this.trackElements_.length;t<i;t++)if(e===this.trackElements_[t]){this.trackElements_[t].track&&"function"==typeof this.trackElements_[t].track.off&&this.trackElements_[t].track.off(),"function"==typeof this.trackElements_[t].off&&this.trackElements_[t].off(),this.trackElements_.splice(t,1);break}},e}(),fu=function(){function e(t){e.prototype.setCues_.call(this,t),Object.defineProperty(this,"length",{get:function(){return this.length_}})}var t=e.prototype;return t.setCues_=function(e){var t=this.length||0,i=0,n=e.length;this.cues_=e,this.length_=e.length;var r=function(e){""+e in this||Object.defineProperty(this,""+e,{get:function(){return this.cues_[e]}})};if(t<n)for(i=t;i<n;i++)r.call(this,i)},t.getCueById=function(e){for(var t=null,i=0,n=this.length;i<n;i++){var r=this[i];if(r.id===e){t=r;break}}return t},e}(),mu={alternative:"alternative",captions:"captions",main:"main",sign:"sign",subtitles:"subtitles",commentary:"commentary"},gu={alternative:"alternative",descriptions:"descriptions",main:"main","main-desc":"main-desc",translation:"translation",commentary:"commentary"},vu={subtitles:"subtitles",captions:"captions",descriptions:"descriptions",chapters:"chapters",metadata:"metadata"},yu={disabled:"disabled",hidden:"hidden",showing:"showing"},_u=function(e){function t(t){var i;void 0===t&&(t={}),i=e.call(this)||this;var n={id:t.id||"vjs_track_"+oo(),kind:t.kind||"",language:t.language||""},r=t.label||"",a=function(e){Object.defineProperty(ae(i),e,{get:function(){return n[e]},set:function(){}})};for(var s in n)a(s);return Object.defineProperty(ae(i),"label",{get:function(){return r},set:function(e){e!==r&&(r=e,this.trigger("labelchange"))}}),i}return oe(t,e),t}(Co),bu=function(e){var t=["protocol","hostname","port","pathname","search","hash","host"],i=te.createElement("a");i.href=e;for(var n={},r=0;r<t.length;r++)n[t[r]]=i[t[r]];return"http:"===n.protocol&&(n.host=n.host.replace(/:80$/,"")),"https:"===n.protocol&&(n.host=n.host.replace(/:443$/,"")),n.protocol||(n.protocol=d.location.protocol),n.host||(n.host=d.location.host),n},Tu=function(e){if(!e.match(/^https?:\/\//)){var t=te.createElement("a");t.href=e,e=t.href}return e},Su=function(e){if("string"==typeof e){var t=/^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/.exec(e);if(t)return t.pop().toLowerCase()}return""},Eu=function(e,t){void 0===t&&(t=d.location);var i=bu(e);return(":"===i.protocol?t.protocol:i.protocol)+i.host!==t.protocol+t.host},wu=Object.freeze({__proto__:null,parseUrl:bu,getAbsoluteURL:Tu,getFileExtension:Su,isCrossOrigin:Eu}),ku=function(e,t){var i=new d.WebVTT.Parser(d,d.vttjs,d.WebVTT.StringDecoder()),n=[];i.oncue=function(e){t.addCue(e)},i.onparsingerror=function(e){n.push(e)},i.onflush=function(){t.trigger({type:"loadeddata",target:t})},i.parse(e),n.length>0&&(d.console&&d.console.groupCollapsed&&d.console.groupCollapsed("Text Track parsing errors for "+t.src),n.forEach((function(e){return Ha.error(e)})),d.console&&d.console.groupEnd&&d.console.groupEnd()),i.flush()},Cu=function(e,t){var i={uri:e},n=Eu(e);n&&(i.cors=n);var r="use-credentials"===t.tech_.crossOrigin();r&&(i.withCredentials=r),le.exports(i,wo(this,(function(e,i,n){if(e)return Ha.error(e,i);t.loaded_=!0,"function"!=typeof d.WebVTT?t.tech_&&t.tech_.any(["vttjsloaded","vttjserror"],(function(e){if("vttjserror"!==e.type)return ku(n,t);Ha.error("vttjs failed to load, stopping trying to process "+t.src)})):ku(n,t)})))},xu=function(e){function t(t){var i;if(void 0===t&&(t={}),!t.tech)throw new Error("A tech was not provided.");var n=qo(t,{kind:vu[t.kind]||"subtitles",language:t.language||t.srclang||""}),r=yu[n.mode]||"disabled",a=n.default;"metadata"!==n.kind&&"chapters"!==n.kind||(r="hidden"),(i=e.call(this,n)||this).tech_=n.tech,i.cues_=[],i.activeCues_=[],i.preload_=!1!==i.tech_.preloadTextTracks;var s=new fu(i.cues_),o=new fu(i.activeCues_),u=!1;i.timeupdateHandler=wo(ae(i),(function(e){void 0===e&&(e={}),this.tech_.isDisposed()||(this.tech_.isReady_?(this.activeCues=this.activeCues,u&&(this.trigger("cuechange"),u=!1),"timeupdate"!==e.type&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler))):"timeupdate"!==e.type&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler)))}));return i.tech_.one("dispose",(function(){i.stopTracking()})),"disabled"!==r&&i.startTracking(),Object.defineProperties(ae(i),{default:{get:function(){return a},set:function(){}},mode:{get:function(){return r},set:function(e){yu[e]&&r!==e&&(r=e,this.preload_||"disabled"===r||0!==this.cues.length||Cu(this.src,this),this.stopTracking(),"disabled"!==r&&this.startTracking(),this.trigger("modechange"))}},cues:{get:function(){return this.loaded_?s:null},set:function(){}},activeCues:{get:function(){if(!this.loaded_)return null;if(0===this.cues.length)return o;for(var e=this.tech_.currentTime(),t=[],i=0,n=this.cues.length;i<n;i++){var r=this.cues[i];(r.startTime<=e&&r.endTime>=e||r.startTime===r.endTime&&r.startTime<=e&&r.startTime+.5>=e)&&t.push(r)}if(u=!1,t.length!==this.activeCues_.length)u=!0;else for(var a=0;a<t.length;a++)-1===this.activeCues_.indexOf(t[a])&&(u=!0);return this.activeCues_=t,o.setCues_(this.activeCues_),o},set:function(){}}}),n.src?(i.src=n.src,i.preload_||(i.loaded_=!0),(i.preload_||"subtitles"!==n.kind&&"captions"!==n.kind)&&Cu(i.src,ae(i))):i.loaded_=!0,i}oe(t,e);var i=t.prototype;return i.startTracking=function(){this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler),this.tech_.on("timeupdate",this.timeupdateHandler)},i.stopTracking=function(){this.rvf_&&(this.tech_.cancelVideoFrameCallback(this.rvf_),this.rvf_=void 0),this.tech_.off("timeupdate",this.timeupdateHandler)},i.addCue=function(e){var t=e;if(d.vttjs&&!(e instanceof d.vttjs.VTTCue)){for(var i in t=new d.vttjs.VTTCue(e.startTime,e.endTime,e.text),e)i in t||(t[i]=e[i]);t.id=e.id,t.originalCue_=e}for(var n=this.tech_.textTracks(),r=0;r<n.length;r++)n[r]!==this&&n[r].removeCue(t);this.cues_.push(t),this.cues.setCues_(this.cues_)},i.removeCue=function(e){for(var t=this.cues_.length;t--;){var i=this.cues_[t];if(i===e||i.originalCue_&&i.originalCue_===e){this.cues_.splice(t,1),this.cues.setCues_(this.cues_);break}}},t}(_u);xu.prototype.allowedEvents_={cuechange:"cuechange"};var Iu=function(e){function t(t){var i;void 0===t&&(t={});var n=qo(t,{kind:gu[t.kind]||""});i=e.call(this,n)||this;var r=!1;return Object.defineProperty(ae(i),"enabled",{get:function(){return r},set:function(e){"boolean"==typeof e&&e!==r&&(r=e,this.trigger("enabledchange"))}}),n.enabled&&(i.enabled=n.enabled),i.loaded_=!0,i}return oe(t,e),t}(_u),Au=function(e){function t(t){var i;void 0===t&&(t={});var n=qo(t,{kind:mu[t.kind]||""});i=e.call(this,n)||this;var r=!1;return Object.defineProperty(ae(i),"selected",{get:function(){return r},set:function(e){"boolean"==typeof e&&e!==r&&(r=e,this.trigger("selectedchange"))}}),n.selected&&(i.selected=n.selected),i}return oe(t,e),t}(_u),Pu=function(e){function t(t){var i,n;void 0===t&&(t={}),i=e.call(this)||this;var r=new xu(t);return i.kind=r.kind,i.src=r.src,i.srclang=r.language,i.label=r.label,i.default=r.default,Object.defineProperties(ae(i),{readyState:{get:function(){return n}},track:{get:function(){return r}}}),n=0,r.addEventListener("loadeddata",(function(){n=2,i.trigger({type:"load",target:ae(i)})})),i}return oe(t,e),t}(Co);Pu.prototype.allowedEvents_={load:"load"},Pu.NONE=0,Pu.LOADING=1,Pu.LOADED=2,Pu.ERROR=3;var Lu={audio:{ListClass:lu,TrackClass:Iu,capitalName:"Audio"},video:{ListClass:du,TrackClass:Au,capitalName:"Video"},text:{ListClass:hu,TrackClass:xu,capitalName:"Text"}};Object.keys(Lu).forEach((function(e){Lu[e].getterName=e+"Tracks",Lu[e].privateName=e+"Tracks_"}));var Du={remoteText:{ListClass:hu,TrackClass:xu,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:pu,TrackClass:Pu,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}},Ou=ie({},Lu,Du);Du.names=Object.keys(Du),Lu.names=Object.keys(Lu),Ou.names=[].concat(Du.names).concat(Lu.names);var Nu=function(e){function t(t,i){var n;return void 0===t&&(t={}),void 0===i&&(i=function(){}),t.reportTouchActivity=!1,(n=e.call(this,null,t,i)||this).onDurationChange_=function(e){return n.onDurationChange(e)},n.trackProgress_=function(e){return n.trackProgress(e)},n.trackCurrentTime_=function(e){return n.trackCurrentTime(e)},n.stopTrackingCurrentTime_=function(e){return n.stopTrackingCurrentTime(e)},n.disposeSourceHandler_=function(e){return n.disposeSourceHandler(e)},n.queuedHanders_=new Set,n.hasStarted_=!1,n.on("playing",(function(){this.hasStarted_=!0})),n.on("loadstart",(function(){this.hasStarted_=!1})),Ou.names.forEach((function(e){var i=Ou[e];t&&t[i.getterName]&&(n[i.privateName]=t[i.getterName])})),n.featuresProgressEvents||n.manualProgressOn(),n.featuresTimeupdateEvents||n.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach((function(e){!1===t["native"+e+"Tracks"]&&(n["featuresNative"+e+"Tracks"]=!1)})),!1===t.nativeCaptions||!1===t.nativeTextTracks?n.featuresNativeTextTracks=!1:!0!==t.nativeCaptions&&!0!==t.nativeTextTracks||(n.featuresNativeTextTracks=!0),n.featuresNativeTextTracks||n.emulateTextTracks(),n.preloadTextTracks=!1!==t.preloadTextTracks,n.autoRemoteTextTracks_=new Ou.text.ListClass,n.initTrackListeners(),t.nativeControlsForTouch||n.emitTapEvents(),n.constructor&&(n.name_=n.constructor.name||"Unknown Tech"),n}oe(t,e);var i=t.prototype;return i.triggerSourceset=function(e){var t=this;this.isReady_||this.one("ready",(function(){return t.setTimeout((function(){return t.triggerSourceset(e)}),1)})),this.trigger({src:e,type:"sourceset"})},i.manualProgressOn=function(){this.on("durationchange",this.onDurationChange_),this.manualProgress=!0,this.one("ready",this.trackProgress_)},i.manualProgressOff=function(){this.manualProgress=!1,this.stopTrackingProgress(),this.off("durationchange",this.onDurationChange_)},i.trackProgress=function(e){this.stopTrackingProgress(),this.progressInterval=this.setInterval(wo(this,(function(){var e=this.bufferedPercent();this.bufferedPercent_!==e&&this.trigger("progress"),this.bufferedPercent_=e,1===e&&this.stopTrackingProgress()})),500)},i.onDurationChange=function(e){this.duration_=this.duration()},i.buffered=function(){return Yo(0,0)},i.bufferedPercent=function(){return Qo(this.buffered(),this.duration_)},i.stopTrackingProgress=function(){this.clearInterval(this.progressInterval)},i.manualTimeUpdatesOn=function(){this.manualTimeUpdates=!0,this.on("play",this.trackCurrentTime_),this.on("pause",this.stopTrackingCurrentTime_)},i.manualTimeUpdatesOff=function(){this.manualTimeUpdates=!1,this.stopTrackingCurrentTime(),this.off("play",this.trackCurrentTime_),this.off("pause",this.stopTrackingCurrentTime_)},i.trackCurrentTime=function(){this.currentTimeInterval&&this.stopTrackingCurrentTime(),this.currentTimeInterval=this.setInterval((function(){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}),250)},i.stopTrackingCurrentTime=function(){this.clearInterval(this.currentTimeInterval),this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},i.dispose=function(){this.clearTracks(Lu.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),e.prototype.dispose.call(this)},i.clearTracks=function(e){var t=this;(e=[].concat(e)).forEach((function(e){for(var i=t[e+"Tracks"]()||[],n=i.length;n--;){var r=i[n];"text"===e&&t.removeRemoteTextTrack(r),i.removeTrack(r)}}))},i.cleanupAutoTextTracks=function(){for(var e=this.autoRemoteTextTracks_||[],t=e.length;t--;){var i=e[t];this.removeRemoteTextTrack(i)}},i.reset=function(){},i.crossOrigin=function(){},i.setCrossOrigin=function(){},i.error=function(e){return void 0!==e&&(this.error_=new $o(e),this.trigger("error")),this.error_},i.played=function(){return this.hasStarted_?Yo(0,0):Yo()},i.play=function(){},i.setScrubbing=function(){},i.scrubbing=function(){},i.setCurrentTime=function(){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},i.initTrackListeners=function(){var e=this;Lu.names.forEach((function(t){var i=Lu[t],n=function(){e.trigger(t+"trackchange")},r=e[i.getterName]();r.addEventListener("removetrack",n),r.addEventListener("addtrack",n),e.on("dispose",(function(){r.removeEventListener("removetrack",n),r.removeEventListener("addtrack",n)}))}))},i.addWebVttScript_=function(){var e=this;if(!d.WebVTT)if(te.body.contains(this.el())){if(!this.options_["vtt.js"]&&Qa(Se.exports)&&Object.keys(Se.exports).length>0)return void this.trigger("vttjsloaded");var t=te.createElement("script");t.src=this.options_["vtt.js"]||"https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js",t.onload=function(){e.trigger("vttjsloaded")},t.onerror=function(){e.trigger("vttjserror")},this.on("dispose",(function(){t.onload=null,t.onerror=null})),d.WebVTT=!0,this.el().parentNode.appendChild(t)}else this.ready(this.addWebVttScript_)},i.emulateTextTracks=function(){var e=this,t=this.textTracks(),i=this.remoteTextTracks(),n=function(e){return t.addTrack(e.track)},r=function(e){return t.removeTrack(e.track)};i.on("addtrack",n),i.on("removetrack",r),this.addWebVttScript_();var a=function(){return e.trigger("texttrackchange")},s=function(){a();for(var e=0;e<t.length;e++){var i=t[e];i.removeEventListener("cuechange",a),"showing"===i.mode&&i.addEventListener("cuechange",a)}};s(),t.addEventListener("change",s),t.addEventListener("addtrack",s),t.addEventListener("removetrack",s),this.on("dispose",(function(){i.off("addtrack",n),i.off("removetrack",r),t.removeEventListener("change",s),t.removeEventListener("addtrack",s),t.removeEventListener("removetrack",s);for(var e=0;e<t.length;e++){t[e].removeEventListener("cuechange",a)}}))},i.addTextTrack=function(e,t,i){if(!e)throw new Error("TextTrack kind is required but was not provided");return function(e,t,i,n,r){void 0===r&&(r={});var a=e.textTracks();r.kind=t,i&&(r.label=i),n&&(r.language=n),r.tech=e;var s=new Ou.text.TrackClass(r);return a.addTrack(s),s}(this,e,t,i)},i.createRemoteTextTrack=function(e){var t=qo(e,{tech:this});return new Du.remoteTextEl.TrackClass(t)},i.addRemoteTextTrack=function(e,t){var i=this;void 0===e&&(e={});var n=this.createRemoteTextTrack(e);return!0!==t&&!1!==t&&(Ha.warn('Calling addRemoteTextTrack without explicitly setting the "manualCleanup" parameter to `true` is deprecated and default to `false` in future version of video.js'),t=!0),this.remoteTextTrackEls().addTrackElement_(n),this.remoteTextTracks().addTrack(n.track),!0!==t&&this.ready((function(){return i.autoRemoteTextTracks_.addTrack(n.track)})),n},i.removeRemoteTextTrack=function(e){var t=this.remoteTextTrackEls().getTrackElementByTrack_(e);this.remoteTextTrackEls().removeTrackElement_(t),this.remoteTextTracks().removeTrack(e),this.autoRemoteTextTracks_.removeTrack(e)},i.getVideoPlaybackQuality=function(){return{}},i.requestPictureInPicture=function(){var e=this.options_.Promise||d.Promise;if(e)return e.reject()},i.disablePictureInPicture=function(){return!0},i.setDisablePictureInPicture=function(){},i.requestVideoFrameCallback=function(e){var t=this,i=oo();return!this.isReady_||this.paused()?(this.queuedHanders_.add(i),this.one("playing",(function(){t.queuedHanders_.has(i)&&(t.queuedHanders_.delete(i),e())}))):this.requestNamedAnimationFrame(i,e),i},i.cancelVideoFrameCallback=function(e){this.queuedHanders_.has(e)?this.queuedHanders_.delete(e):this.cancelNamedAnimationFrame(e)},i.setPoster=function(){},i.playsinline=function(){},i.setPlaysinline=function(){},i.overrideNativeAudioTracks=function(){},i.overrideNativeVideoTracks=function(){},i.canPlayType=function(){return""},t.canPlayType=function(){return""},t.canPlaySource=function(e,i){return t.canPlayType(e.type)},t.isTech=function(e){return e.prototype instanceof t||e instanceof t||e===t},t.registerTech=function(e,i){if(t.techs_||(t.techs_={}),!t.isTech(i))throw new Error("Tech "+e+" must be a Tech");if(!t.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(!t.canPlaySource)throw new Error("Techs must have a static canPlaySource method on them");return e=jo(e),t.techs_[e]=i,t.techs_[Fo(e)]=i,"Tech"!==e&&t.defaultTechOrder_.push(e),i},t.getTech=function(e){if(e)return t.techs_&&t.techs_[e]?t.techs_[e]:(e=jo(e),d&&d.videojs&&d.videojs[e]?(Ha.warn("The "+e+" tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)"),d.videojs[e]):void 0)},t}(zo);Ou.names.forEach((function(e){var t=Ou[e];Nu.prototype[t.getterName]=function(){return this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName]}})),Nu.prototype.featuresVolumeControl=!0,Nu.prototype.featuresMuteControl=!0,Nu.prototype.featuresFullscreenResize=!1,Nu.prototype.featuresPlaybackRate=!1,Nu.prototype.featuresProgressEvents=!1,Nu.prototype.featuresSourceset=!1,Nu.prototype.featuresTimeupdateEvents=!1,Nu.prototype.featuresNativeTextTracks=!1,Nu.prototype.featuresVideoFrameCallback=!1,Nu.withSourceHandlers=function(e){e.registerSourceHandler=function(t,i){var n=e.sourceHandlers;n||(n=e.sourceHandlers=[]),void 0===i&&(i=n.length),n.splice(i,0,t)},e.canPlayType=function(t){for(var i,n=e.sourceHandlers||[],r=0;r<n.length;r++)if(i=n[r].canPlayType(t))return i;return""},e.selectSourceHandler=function(t,i){for(var n=e.sourceHandlers||[],r=0;r<n.length;r++)if(n[r].canHandleSource(t,i))return n[r];return null},e.canPlaySource=function(t,i){var n=e.selectSourceHandler(t,i);return n?n.canHandleSource(t,i):""};["seekable","seeking","duration"].forEach((function(e){var t=this[e];"function"==typeof t&&(this[e]=function(){return this.sourceHandler_&&this.sourceHandler_[e]?this.sourceHandler_[e].apply(this.sourceHandler_,arguments):t.apply(this,arguments)})}),e.prototype),e.prototype.setSource=function(t){var i=e.selectSourceHandler(t,this.options_);i||(e.nativeSourceHandler?i=e.nativeSourceHandler:Ha.error("No source handler found for the current source.")),this.disposeSourceHandler(),this.off("dispose",this.disposeSourceHandler_),i!==e.nativeSourceHandler&&(this.currentSource_=t),this.sourceHandler_=i.handleSource(t,this,this.options_),this.one("dispose",this.disposeSourceHandler_)},e.prototype.disposeSourceHandler=function(){this.currentSource_&&(this.clearTracks(["audio","video"]),this.currentSource_=null),this.cleanupAutoTextTracks(),this.sourceHandler_&&(this.sourceHandler_.dispose&&this.sourceHandler_.dispose(),this.sourceHandler_=null)}},zo.registerComponent("Tech",Nu),Nu.registerTech("Tech",Nu),Nu.defaultTechOrder_=[];var Ru={},Mu={},Uu={};function Bu(e,t,i){e.setTimeout((function(){return Wu(t,Ru[t.type],i,e)}),1)}function Fu(e,t,i,n){void 0===n&&(n=null);var r="call"+jo(i),a=e.reduce(Hu(r),n),s=a===Uu,o=s?null:t[i](a);return function(e,t,i,n){for(var r=e.length-1;r>=0;r--){var a=e[r];a[t]&&a[t](n,i)}}(e,i,o,s),o}var ju={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},qu={setCurrentTime:1,setMuted:1,setVolume:1},Vu={play:1,pause:1};function Hu(e){return function(t,i){return t===Uu?Uu:i[e]?i[e](t):t}}function Wu(e,t,i,n,r,a){void 0===e&&(e={}),void 0===t&&(t=[]),void 0===r&&(r=[]),void 0===a&&(a=!1);var s=t,o=s[0],u=s.slice(1);if("string"==typeof o)Wu(e,Ru[o],i,n,r,a);else if(o){var l=function(e,t){var i=Mu[e.id()],n=null;if(null==i)return n=t(e),Mu[e.id()]=[[t,n]],n;for(var r=0;r<i.length;r++){var a=i[r],s=a[0],o=a[1];s===t&&(n=o)}return null===n&&(n=t(e),i.push([t,n])),n}(n,o);if(!l.setSource)return r.push(l),Wu(e,u,i,n,r,a);l.setSource(Ka({},e),(function(t,s){if(t)return Wu(e,u,i,n,r,a);r.push(l),Wu(s,e.type===s.type?u:Ru[s.type],i,n,r,a)}))}else u.length?Wu(e,u,i,n,r,a):a?i(e,r):Wu(e,Ru["*"],i,n,r,!0)}var Gu={opus:"video/ogg",ogv:"video/ogg",mp4:"video/mp4",mov:"video/mp4",m4v:"video/mp4",mkv:"video/x-matroska",m4a:"audio/mp4",mp3:"audio/mpeg",aac:"audio/aac",caf:"audio/x-caf",flac:"audio/flac",oga:"audio/ogg",wav:"audio/wav",m3u8:"application/x-mpegURL",mpd:"application/dash+xml",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",png:"image/png",svg:"image/svg+xml",webp:"image/webp"},zu=function(e){void 0===e&&(e="");var t=Su(e);return Gu[t.toLowerCase()]||""},Xu=function e(t){if(Array.isArray(t)){var i=[];t.forEach((function(t){t=e(t),Array.isArray(t)?i=i.concat(t):Ya(t)&&i.push(t)})),t=i}else t="string"==typeof t&&t.trim()?[Ku({src:t})]:Ya(t)&&"string"==typeof t.src&&t.src&&t.src.trim()?[Ku(t)]:[];return t};function Ku(e){if(!e.type){var t=zu(e.src);t&&(e.type=t)}return e}var Yu=function(e){function t(t,i,n){var r,a=qo({createEl:!1},i);if(r=e.call(this,t,a,n)||this,i.playerOptions.sources&&0!==i.playerOptions.sources.length)t.src(i.playerOptions.sources);else for(var s=0,o=i.playerOptions.techOrder;s<o.length;s++){var u=jo(o[s]),l=Nu.getTech(u);if(u||(l=zo.getComponent(u)),l&&l.isSupported()){t.loadTech_(u);break}}return r}return oe(t,e),t}(zo);zo.registerComponent("MediaLoader",Yu);var Qu=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).options_.controlText&&n.controlText(n.options_.controlText),n.handleMouseOver_=function(e){return n.handleMouseOver(e)},n.handleMouseOut_=function(e){return n.handleMouseOut(e)},n.handleClick_=function(e){return n.handleClick(e)},n.handleKeyDown_=function(e){return n.handleKeyDown(e)},n.emitTapEvents(),n.enable(),n}oe(t,e);var i=t.prototype;return i.createEl=function(e,t,i){void 0===e&&(e="div"),void 0===t&&(t={}),void 0===i&&(i={}),t=Ka({className:this.buildCSSClass(),tabIndex:0},t),"button"===e&&Ha.error("Creating a ClickableComponent with an HTML element of "+e+" is not supported; use a Button instead."),i=Ka({role:"button"},i),this.tabIndex_=t.tabIndex;var n=Cs(e,t,i);return n.appendChild(Cs("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(n),n},i.dispose=function(){this.controlTextEl_=null,e.prototype.dispose.call(this)},i.createControlTextEl=function(e){return this.controlTextEl_=Cs("span",{className:"vjs-control-text"},{"aria-live":"polite"}),e&&e.appendChild(this.controlTextEl_),this.controlText(this.controlText_,e),this.controlTextEl_},i.controlText=function(e,t){if(void 0===t&&(t=this.el()),void 0===e)return this.controlText_||"Need Text";var i=this.localize(e);this.controlText_=e,xs(this.controlTextEl_,i),this.nonIconControl||this.player_.options_.noUITitleAttributes||t.setAttribute("title",i)},i.buildCSSClass=function(){return"vjs-control vjs-button "+e.prototype.buildCSSClass.call(this)},i.enable=function(){this.enabled_||(this.enabled_=!0,this.removeClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","false"),void 0!==this.tabIndex_&&this.el_.setAttribute("tabIndex",this.tabIndex_),this.on(["tap","click"],this.handleClick_),this.on("keydown",this.handleKeyDown_))},i.disable=function(){this.enabled_=!1,this.addClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","true"),void 0!==this.tabIndex_&&this.el_.removeAttribute("tabIndex"),this.off("mouseover",this.handleMouseOver_),this.off("mouseout",this.handleMouseOut_),this.off(["tap","click"],this.handleClick_),this.off("keydown",this.handleKeyDown_)},i.handleLanguagechange=function(){this.controlText(this.controlText_)},i.handleClick=function(e){this.options_.clickHandler&&this.options_.clickHandler.call(this,arguments)},i.handleKeyDown=function(t){re.isEventKey(t,"Space")||re.isEventKey(t,"Enter")?(t.preventDefault(),t.stopPropagation(),this.trigger("click")):e.prototype.handleKeyDown.call(this,t)},t}(zo);zo.registerComponent("ClickableComponent",Qu);var $u=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).update(),n.update_=function(e){return n.update(e)},t.on("posterchange",n.update_),n}oe(t,e);var i=t.prototype;return i.dispose=function(){this.player().off("posterchange",this.update_),e.prototype.dispose.call(this)},i.createEl=function(){return Cs("div",{className:"vjs-poster",tabIndex:-1})},i.update=function(e){var t=this.player().poster();this.setSrc(t),t?this.show():this.hide()},i.setSrc=function(e){var t="";e&&(t='url("'+e+'")'),this.el_.style.backgroundImage=t},i.handleClick=function(e){if(this.player_.controls()){var t=this.player_.usingPlugin("eme")&&this.player_.eme.sessions&&this.player_.eme.sessions.length>0;!this.player_.tech(!0)||(ds||us)&&t||this.player_.tech(!0).focus(),this.player_.paused()?eu(this.player_.play()):this.player_.pause()}},t}(Qu);zo.registerComponent("PosterImage",$u);var Ju="#222",Zu={monospace:"monospace",sansSerif:"sans-serif",serif:"serif",monospaceSansSerif:'"Andale Mono", "Lucida Console", monospace',monospaceSerif:'"Courier New", monospace',proportionalSansSerif:"sans-serif",proportionalSerif:"serif",casual:'"Comic Sans MS", Impact, fantasy',script:'"Monotype Corsiva", cursive',smallcaps:'"Andale Mono", "Lucida Console", monospace, sans-serif'};function el(e,t){var i;if(4===e.length)i=e[1]+e[1]+e[2]+e[2]+e[3]+e[3];else{if(7!==e.length)throw new Error("Invalid color code provided, "+e+"; must be formatted as e.g. #f0e or #f604e2.");i=e.slice(1)}return"rgba("+parseInt(i.slice(0,2),16)+","+parseInt(i.slice(2,4),16)+","+parseInt(i.slice(4,6),16)+","+t+")"}function tl(e,t,i){try{e.style[t]=i}catch(e){return}}var il=function(e){function t(t,i,n){var r;r=e.call(this,t,i,n)||this;var a=function(e){return r.updateDisplay(e)};return t.on("loadstart",(function(e){return r.toggleDisplay(e)})),t.on("texttrackchange",a),t.on("loadedmetadata",(function(e){return r.preselectTrack(e)})),t.ready(wo(ae(r),(function(){if(t.tech_&&t.tech_.featuresNativeTextTracks)this.hide();else{t.on("fullscreenchange",a),t.on("playerresize",a),d.addEventListener("orientationchange",a),t.on("dispose",(function(){return d.removeEventListener("orientationchange",a)}));for(var e=this.options_.playerOptions.tracks||[],i=0;i<e.length;i++)this.player_.addRemoteTextTrack(e[i],!0);this.preselectTrack()}}))),r}oe(t,e);var i=t.prototype;return i.preselectTrack=function(){for(var e,t,i,n={captions:1,subtitles:1},r=this.player_.textTracks(),a=this.player_.cache_.selectedLanguage,s=0;s<r.length;s++){var o=r[s];a&&a.enabled&&a.language&&a.language===o.language&&o.kind in n?o.kind===a.kind?i=o:i||(i=o):a&&!a.enabled?(i=null,e=null,t=null):o.default&&("descriptions"!==o.kind||e?o.kind in n&&!t&&(t=o):e=o)}i?i.mode="showing":t?t.mode="showing":e&&(e.mode="showing")},i.toggleDisplay=function(){this.player_.tech_&&this.player_.tech_.featuresNativeTextTracks?this.hide():this.show()},i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-text-track-display"},{translate:"yes","aria-live":"off","aria-atomic":"true"})},i.clearDisplay=function(){"function"==typeof d.WebVTT&&d.WebVTT.processCues(d,[],this.el_)},i.updateDisplay=function(){var e=this.player_.textTracks(),t=this.options_.allowMultipleShowingTracks;if(this.clearDisplay(),t){for(var i=[],n=0;n<e.length;++n){var r=e[n];"showing"===r.mode&&i.push(r)}this.updateForTrack(i)}else{for(var a=null,s=null,o=e.length;o--;){var u=e[o];"showing"===u.mode&&("descriptions"===u.kind?a=u:s=u)}s?("off"!==this.getAttribute("aria-live")&&this.setAttribute("aria-live","off"),this.updateForTrack(s)):a&&("assertive"!==this.getAttribute("aria-live")&&this.setAttribute("aria-live","assertive"),this.updateForTrack(a))}},i.updateDisplayState=function(e){for(var t=this.player_.textTrackSettings.getValues(),i=e.activeCues,n=i.length;n--;){var r=i[n];if(r){var a=r.displayState;if(t.color&&(a.firstChild.style.color=t.color),t.textOpacity&&tl(a.firstChild,"color",el(t.color||"#fff",t.textOpacity)),t.backgroundColor&&(a.firstChild.style.backgroundColor=t.backgroundColor),t.backgroundOpacity&&tl(a.firstChild,"backgroundColor",el(t.backgroundColor||"#000",t.backgroundOpacity)),t.windowColor&&(t.windowOpacity?tl(a,"backgroundColor",el(t.windowColor,t.windowOpacity)):a.style.backgroundColor=t.windowColor),t.edgeStyle&&("dropshadow"===t.edgeStyle?a.firstChild.style.textShadow="2px 2px 3px #222, 2px 2px 4px #222, 2px 2px 5px "+Ju:"raised"===t.edgeStyle?a.firstChild.style.textShadow="1px 1px #222, 2px 2px #222, 3px 3px "+Ju:"depressed"===t.edgeStyle?a.firstChild.style.textShadow="1px 1px #ccc, 0 1px #ccc, -1px -1px #222, 0 -1px "+Ju:"uniform"===t.edgeStyle&&(a.firstChild.style.textShadow="0 0 4px #222, 0 0 4px #222, 0 0 4px #222, 0 0 4px "+Ju)),t.fontPercent&&1!==t.fontPercent){var s=d.parseFloat(a.style.fontSize);a.style.fontSize=s*t.fontPercent+"px",a.style.height="auto",a.style.top="auto"}t.fontFamily&&"default"!==t.fontFamily&&("small-caps"===t.fontFamily?a.firstChild.style.fontVariant="small-caps":a.firstChild.style.fontFamily=Zu[t.fontFamily])}}},i.updateForTrack=function(e){if(Array.isArray(e)||(e=[e]),"function"==typeof d.WebVTT&&!e.every((function(e){return!e.activeCues}))){for(var t=[],i=0;i<e.length;++i)for(var n=e[i],r=0;r<n.activeCues.length;++r)t.push(n.activeCues[r]);d.WebVTT.processCues(d,t,this.el_);for(var a=0;a<e.length;++a){for(var s=e[a],o=0;o<s.activeCues.length;++o){var u=s.activeCues[o].displayState;Ps(u,"vjs-text-track-cue"),Ps(u,"vjs-text-track-cue-"+(s.language?s.language:a)),s.language&&Ms(u,"lang",s.language)}this.player_.textTrackSettings&&this.updateDisplayState(s)}}},t}(zo);zo.registerComponent("TextTrackDisplay",il);var nl=function(e){function t(){return e.apply(this,arguments)||this}return oe(t,e),t.prototype.createEl=function(){var t=this.player_.isAudio(),i=this.localize(t?"Audio Player":"Video Player"),n=Cs("span",{className:"vjs-control-text",textContent:this.localize("{1} is loading.",[i])}),r=e.prototype.createEl.call(this,"div",{className:"vjs-loading-spinner",dir:"ltr"});return r.appendChild(n),r},t}(zo);zo.registerComponent("LoadingSpinner",nl);var rl=function(e){function t(){return e.apply(this,arguments)||this}oe(t,e);var i=t.prototype;return i.createEl=function(e,t,i){void 0===t&&(t={}),void 0===i&&(i={});var n=Cs("button",t=Ka({className:this.buildCSSClass()},t),i=Ka({type:"button"},i));return n.appendChild(Cs("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(n),n},i.addChild=function(e,t){void 0===t&&(t={});var i=this.constructor.name;return Ha.warn("Adding an actionable (user controllable) child to a Button ("+i+") is not supported; use a ClickableComponent instead."),zo.prototype.addChild.call(this,e,t)},i.enable=function(){e.prototype.enable.call(this),this.el_.removeAttribute("disabled")},i.disable=function(){e.prototype.disable.call(this),this.el_.setAttribute("disabled","disabled")},i.handleKeyDown=function(t){re.isEventKey(t,"Space")||re.isEventKey(t,"Enter")?t.stopPropagation():e.prototype.handleKeyDown.call(this,t)},t}(Qu);zo.registerComponent("Button",rl);var al=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).mouseused_=!1,n.on("mousedown",(function(e){return n.handleMouseDown(e)})),n}oe(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-big-play-button"},i.handleClick=function(e){var t=this.player_.play();if(this.mouseused_&&e.clientX&&e.clientY){var i=this.player_.usingPlugin("eme")&&this.player_.eme.sessions&&this.player_.eme.sessions.length>0;return eu(t),void(!this.player_.tech(!0)||(ds||us)&&i||this.player_.tech(!0).focus())}var n=this.player_.getChild("controlBar"),r=n&&n.getChild("playToggle");if(r){var a=function(){return r.focus()};Zo(t)?t.then(a,(function(){})):this.setTimeout(a,1)}else this.player_.tech(!0).focus()},i.handleKeyDown=function(t){this.mouseused_=!1,e.prototype.handleKeyDown.call(this,t)},i.handleMouseDown=function(e){this.mouseused_=!0},t}(rl);al.prototype.controlText_="Play Video",zo.registerComponent("BigPlayButton",al);var sl=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).controlText(i&&i.controlText||n.localize("Close")),n}oe(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-close-button "+e.prototype.buildCSSClass.call(this)},i.handleClick=function(e){this.trigger({type:"close",bubbles:!1})},i.handleKeyDown=function(t){re.isEventKey(t,"Esc")?(t.preventDefault(),t.stopPropagation(),this.trigger("click")):e.prototype.handleKeyDown.call(this,t)},t}(rl);zo.registerComponent("CloseButton",sl);var ol=function(e){function t(t,i){var n;return void 0===i&&(i={}),n=e.call(this,t,i)||this,i.replay=void 0===i.replay||i.replay,n.on(t,"play",(function(e){return n.handlePlay(e)})),n.on(t,"pause",(function(e){return n.handlePause(e)})),i.replay&&n.on(t,"ended",(function(e){return n.handleEnded(e)})),n}oe(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-play-control "+e.prototype.buildCSSClass.call(this)},i.handleClick=function(e){this.player_.paused()?eu(this.player_.play()):this.player_.pause()},i.handleSeeked=function(e){this.removeClass("vjs-ended"),this.player_.paused()?this.handlePause(e):this.handlePlay(e)},i.handlePlay=function(e){this.removeClass("vjs-ended"),this.removeClass("vjs-paused"),this.addClass("vjs-playing"),this.controlText("Pause")},i.handlePause=function(e){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.controlText("Play")},i.handleEnded=function(e){var t=this;this.removeClass("vjs-playing"),this.addClass("vjs-ended"),this.controlText("Replay"),this.one(this.player_,"seeked",(function(e){return t.handleSeeked(e)}))},t}(rl);ol.prototype.controlText_="Play",zo.registerComponent("PlayToggle",ol);var ul=function(e,t){e=e<0?0:e;var i=Math.floor(e%60),n=Math.floor(e/60%60),r=Math.floor(e/3600),a=Math.floor(t/60%60),s=Math.floor(t/3600);return(isNaN(e)||e===1/0)&&(r=n=i="-"),(r=r>0||s>0?r+":":"")+(n=((r||a>=10)&&n<10?"0"+n:n)+":")+(i=i<10?"0"+i:i)},ll=ul;function cl(e,t){return void 0===t&&(t=e),ll(e,t)}var dl=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on(t,["timeupdate","ended"],(function(e){return n.updateContent(e)})),n.updateTextNode_(),n}oe(t,e);var i=t.prototype;return i.createEl=function(){var t=this.buildCSSClass(),i=e.prototype.createEl.call(this,"div",{className:t+" vjs-time-control vjs-control"}),n=Cs("span",{className:"vjs-control-text",textContent:this.localize(this.labelText_)+" "},{role:"presentation"});return i.appendChild(n),this.contentEl_=Cs("span",{className:t+"-display"},{"aria-live":"off",role:"presentation"}),i.appendChild(this.contentEl_),i},i.dispose=function(){this.contentEl_=null,this.textNode_=null,e.prototype.dispose.call(this)},i.updateTextNode_=function(e){var t=this;void 0===e&&(e=0),e=cl(e),this.formattedTime_!==e&&(this.formattedTime_=e,this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_",(function(){if(t.contentEl_){var e=t.textNode_;e&&t.contentEl_.firstChild!==e&&(e=null,Ha.warn("TimeDisplay#updateTextnode_: Prevented replacement of text node element since it was no longer a child of this node. Appending a new node instead.")),t.textNode_=te.createTextNode(t.formattedTime_),t.textNode_&&(e?t.contentEl_.replaceChild(t.textNode_,e):t.contentEl_.appendChild(t.textNode_))}})))},i.updateContent=function(e){},t}(zo);dl.prototype.labelText_="Time",dl.prototype.controlText_="Time",zo.registerComponent("TimeDisplay",dl);var hl=function(e){function t(){return e.apply(this,arguments)||this}oe(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-current-time"},i.updateContent=function(e){var t;t=this.player_.ended()?this.player_.duration():this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),this.updateTextNode_(t)},t}(dl);hl.prototype.labelText_="Current Time",hl.prototype.controlText_="Current Time",zo.registerComponent("CurrentTimeDisplay",hl);var pl=function(e){function t(t,i){var n,r=function(e){return n.updateContent(e)};return(n=e.call(this,t,i)||this).on(t,"durationchange",r),n.on(t,"loadstart",r),n.on(t,"loadedmetadata",r),n}oe(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-duration"},i.updateContent=function(e){var t=this.player_.duration();this.updateTextNode_(t)},t}(dl);pl.prototype.labelText_="Duration",pl.prototype.controlText_="Duration",zo.registerComponent("DurationDisplay",pl);var fl=function(e){function t(){return e.apply(this,arguments)||this}return oe(t,e),t.prototype.createEl=function(){var t=e.prototype.createEl.call(this,"div",{className:"vjs-time-control vjs-time-divider"},{"aria-hidden":!0}),i=e.prototype.createEl.call(this,"div"),n=e.prototype.createEl.call(this,"span",{textContent:"/"});return i.appendChild(n),t.appendChild(i),t},t}(zo);zo.registerComponent("TimeDivider",fl);var ml=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on(t,"durationchange",(function(e){return n.updateContent(e)})),n}oe(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-remaining-time"},i.createEl=function(){var t=e.prototype.createEl.call(this);return!1!==this.options_.displayNegative&&t.insertBefore(Cs("span",{},{"aria-hidden":!0},"-"),this.contentEl_),t},i.updateContent=function(e){var t;"number"==typeof this.player_.duration()&&(t=this.player_.ended()?0:this.player_.remainingTimeDisplay?this.player_.remainingTimeDisplay():this.player_.remainingTime(),this.updateTextNode_(t))},t}(dl);ml.prototype.labelText_="Remaining Time",ml.prototype.controlText_="Remaining Time",zo.registerComponent("RemainingTimeDisplay",ml);var gl=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).updateShowing(),n.on(n.player(),"durationchange",(function(e){return n.updateShowing(e)})),n}oe(t,e);var i=t.prototype;return i.createEl=function(){var t=e.prototype.createEl.call(this,"div",{className:"vjs-live-control vjs-control"});return this.contentEl_=Cs("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(Cs("span",{className:"vjs-control-text",textContent:this.localize("Stream Type")+" "})),this.contentEl_.appendChild(te.createTextNode(this.localize("LIVE"))),t.appendChild(this.contentEl_),t},i.dispose=function(){this.contentEl_=null,e.prototype.dispose.call(this)},i.updateShowing=function(e){this.player().duration()===1/0?this.show():this.hide()},t}(zo);zo.registerComponent("LiveDisplay",gl);var vl=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).updateLiveEdgeStatus(),n.player_.liveTracker&&(n.updateLiveEdgeStatusHandler_=function(e){return n.updateLiveEdgeStatus(e)},n.on(n.player_.liveTracker,"liveedgechange",n.updateLiveEdgeStatusHandler_)),n}oe(t,e);var i=t.prototype;return i.createEl=function(){var t=e.prototype.createEl.call(this,"button",{className:"vjs-seek-to-live-control vjs-control"});return this.textEl_=Cs("span",{className:"vjs-seek-to-live-text",textContent:this.localize("LIVE")},{"aria-hidden":"true"}),t.appendChild(this.textEl_),t},i.updateLiveEdgeStatus=function(){!this.player_.liveTracker||this.player_.liveTracker.atLiveEdge()?(this.setAttribute("aria-disabled",!0),this.addClass("vjs-at-live-edge"),this.controlText("Seek to live, currently playing live")):(this.setAttribute("aria-disabled",!1),this.removeClass("vjs-at-live-edge"),this.controlText("Seek to live, currently behind live"))},i.handleClick=function(){this.player_.liveTracker.seekToLiveEdge()},i.dispose=function(){this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_),this.textEl_=null,e.prototype.dispose.call(this)},t}(rl);vl.prototype.controlText_="Seek to live, currently playing live",zo.registerComponent("SeekToLive",vl);var yl=function(e,t,i){return e=Number(e),Math.min(i,Math.max(t,isNaN(e)?t:e))},_l=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).handleMouseDown_=function(e){return n.handleMouseDown(e)},n.handleMouseUp_=function(e){return n.handleMouseUp(e)},n.handleKeyDown_=function(e){return n.handleKeyDown(e)},n.handleClick_=function(e){return n.handleClick(e)},n.handleMouseMove_=function(e){return n.handleMouseMove(e)},n.update_=function(e){return n.update(e)},n.bar=n.getChild(n.options_.barName),n.vertical(!!n.options_.vertical),n.enable(),n}oe(t,e);var i=t.prototype;return i.enabled=function(){return this.enabled_},i.enable=function(){this.enabled()||(this.on("mousedown",this.handleMouseDown_),this.on("touchstart",this.handleMouseDown_),this.on("keydown",this.handleKeyDown_),this.on("click",this.handleClick_),this.on(this.player_,"controlsvisible",this.update),this.playerEvent&&this.on(this.player_,this.playerEvent,this.update),this.removeClass("disabled"),this.setAttribute("tabindex",0),this.enabled_=!0)},i.disable=function(){if(this.enabled()){var e=this.bar.el_.ownerDocument;this.off("mousedown",this.handleMouseDown_),this.off("touchstart",this.handleMouseDown_),this.off("keydown",this.handleKeyDown_),this.off("click",this.handleClick_),this.off(this.player_,"controlsvisible",this.update_),this.off(e,"mousemove",this.handleMouseMove_),this.off(e,"mouseup",this.handleMouseUp_),this.off(e,"touchmove",this.handleMouseMove_),this.off(e,"touchend",this.handleMouseUp_),this.removeAttribute("tabindex"),this.addClass("disabled"),this.playerEvent&&this.off(this.player_,this.playerEvent,this.update),this.enabled_=!1}},i.createEl=function(t,i,n){return void 0===i&&(i={}),void 0===n&&(n={}),i.className=i.className+" vjs-slider",i=Ka({tabIndex:0},i),n=Ka({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100,tabIndex:0},n),e.prototype.createEl.call(this,t,i,n)},i.handleMouseDown=function(e){var t=this.bar.el_.ownerDocument;"mousedown"===e.type&&e.preventDefault(),"touchstart"!==e.type||ls||e.preventDefault(),Bs(),this.addClass("vjs-sliding"),this.trigger("slideractive"),this.on(t,"mousemove",this.handleMouseMove_),this.on(t,"mouseup",this.handleMouseUp_),this.on(t,"touchmove",this.handleMouseMove_),this.on(t,"touchend",this.handleMouseUp_),this.handleMouseMove(e,!0)},i.handleMouseMove=function(e){},i.handleMouseUp=function(){var e=this.bar.el_.ownerDocument;Fs(),this.removeClass("vjs-sliding"),this.trigger("sliderinactive"),this.off(e,"mousemove",this.handleMouseMove_),this.off(e,"mouseup",this.handleMouseUp_),this.off(e,"touchmove",this.handleMouseMove_),this.off(e,"touchend",this.handleMouseUp_),this.update()},i.update=function(){var e=this;if(this.el_&&this.bar){var t=this.getProgress();return t===this.progress_||(this.progress_=t,this.requestNamedAnimationFrame("Slider#update",(function(){var i=e.vertical()?"height":"width";e.bar.el().style[i]=(100*t).toFixed(2)+"%"}))),t}},i.getProgress=function(){return Number(yl(this.getPercent(),0,1).toFixed(4))},i.calculateDistance=function(e){var t=Vs(this.el_,e);return this.vertical()?t.y:t.x},i.handleKeyDown=function(t){re.isEventKey(t,"Left")||re.isEventKey(t,"Down")?(t.preventDefault(),t.stopPropagation(),this.stepBack()):re.isEventKey(t,"Right")||re.isEventKey(t,"Up")?(t.preventDefault(),t.stopPropagation(),this.stepForward()):e.prototype.handleKeyDown.call(this,t)},i.handleClick=function(e){e.stopPropagation(),e.preventDefault()},i.vertical=function(e){if(void 0===e)return this.vertical_||!1;this.vertical_=!!e,this.vertical_?this.addClass("vjs-slider-vertical"):this.addClass("vjs-slider-horizontal")},t}(zo);zo.registerComponent("Slider",_l);var bl=function(e,t){return yl(e/t*100,0,100).toFixed(2)+"%"},Tl=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).partEls_=[],n.on(t,"progress",(function(e){return n.update(e)})),n}oe(t,e);var i=t.prototype;return i.createEl=function(){var t=e.prototype.createEl.call(this,"div",{className:"vjs-load-progress"}),i=Cs("span",{className:"vjs-control-text"}),n=Cs("span",{textContent:this.localize("Loaded")}),r=te.createTextNode(": ");return this.percentageEl_=Cs("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),t.appendChild(i),i.appendChild(n),i.appendChild(r),i.appendChild(this.percentageEl_),t},i.dispose=function(){this.partEls_=null,this.percentageEl_=null,e.prototype.dispose.call(this)},i.update=function(e){var t=this;this.requestNamedAnimationFrame("LoadProgressBar#update",(function(){var e=t.player_.liveTracker,i=t.player_.buffered(),n=e&&e.isLive()?e.seekableEnd():t.player_.duration(),r=t.player_.bufferedEnd(),a=t.partEls_,s=bl(r,n);t.percent_!==s&&(t.el_.style.width=s,xs(t.percentageEl_,s),t.percent_=s);for(var o=0;o<i.length;o++){var u=i.start(o),l=i.end(o),c=a[o];c||(c=t.el_.appendChild(Cs()),a[o]=c),c.dataset.start===u&&c.dataset.end===l||(c.dataset.start=u,c.dataset.end=l,c.style.left=bl(u,r),c.style.width=bl(l-u,r))}for(var d=a.length;d>i.length;d--)t.el_.removeChild(a[d-1]);a.length=i.length}))},t}(zo);zo.registerComponent("LoadProgressBar",Tl);var Sl=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).update=ko(wo(ae(n),n.update),Eo),n}oe(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})},i.update=function(e,t,i){var n=qs(this.el_),r=js(this.player_.el()),a=e.width*t;if(r&&n){var s=e.left-r.left+a,o=e.width-a+(r.right-e.right),u=n.width/2;s<u?u+=u-s:o<u&&(u=o),u<0?u=0:u>n.width&&(u=n.width),u=Math.round(u),this.el_.style.right="-"+u+"px",this.write(i)}},i.write=function(e){xs(this.el_,e)},i.updateTime=function(e,t,i,n){var r=this;this.requestNamedAnimationFrame("TimeTooltip#updateTime",(function(){var a,s=r.player_.duration();if(r.player_.liveTracker&&r.player_.liveTracker.isLive()){var o=r.player_.liveTracker.liveWindow(),u=o-t*o;a=(u<1?"":"-")+cl(u,o)}else a=cl(i,s);r.update(e,t,a),n&&n()}))},t}(zo);zo.registerComponent("TimeTooltip",Sl);var El=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).update=ko(wo(ae(n),n.update),Eo),n}oe(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})},i.update=function(e,t){var i=this.getChild("timeTooltip");if(i){var n=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();i.updateTime(e,t,n)}},t}(zo);El.prototype.options_={children:[]},vs||rs||El.prototype.options_.children.push("timeTooltip"),zo.registerComponent("PlayProgressBar",El);var wl=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).update=ko(wo(ae(n),n.update),Eo),n}oe(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-mouse-display"})},i.update=function(e,t){var i=this,n=t*this.player_.duration();this.getChild("timeTooltip").updateTime(e,t,n,(function(){i.el_.style.left=e.width*t+"px"}))},t}(zo);wl.prototype.options_={children:["timeTooltip"]},zo.registerComponent("MouseTimeDisplay",wl);var kl=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).setEventHandlers_(),n}oe(t,e);var i=t.prototype;return i.setEventHandlers_=function(){var e=this;this.update_=wo(this,this.update),this.update=ko(this.update_,Eo),this.on(this.player_,["ended","durationchange","timeupdate"],this.update),this.player_.liveTracker&&this.on(this.player_.liveTracker,"liveedgechange",this.update),this.updateInterval=null,this.enableIntervalHandler_=function(t){return e.enableInterval_(t)},this.disableIntervalHandler_=function(t){return e.disableInterval_(t)},this.on(this.player_,["playing"],this.enableIntervalHandler_),this.on(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in te&&"visibilityState"in te&&this.on(te,"visibilitychange",this.toggleVisibility_)},i.toggleVisibility_=function(e){"hidden"===te.visibilityState?(this.cancelNamedAnimationFrame("SeekBar#update"),this.cancelNamedAnimationFrame("Slider#update"),this.disableInterval_(e)):(this.player_.ended()||this.player_.paused()||this.enableInterval_(),this.update())},i.enableInterval_=function(){this.updateInterval||(this.updateInterval=this.setInterval(this.update,Eo))},i.disableInterval_=function(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&e&&"ended"!==e.type||this.updateInterval&&(this.clearInterval(this.updateInterval),this.updateInterval=null)},i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})},i.update=function(t){var i=this;if("hidden"!==te.visibilityState){var n=e.prototype.update.call(this);return this.requestNamedAnimationFrame("SeekBar#update",(function(){var e=i.player_.ended()?i.player_.duration():i.getCurrentTime_(),t=i.player_.liveTracker,r=i.player_.duration();t&&t.isLive()&&(r=i.player_.liveTracker.liveCurrentTime()),i.percent_!==n&&(i.el_.setAttribute("aria-valuenow",(100*n).toFixed(2)),i.percent_=n),i.currentTime_===e&&i.duration_===r||(i.el_.setAttribute("aria-valuetext",i.localize("progress bar timing: currentTime={1} duration={2}",[cl(e,r),cl(r,r)],"{1} of {2}")),i.currentTime_=e,i.duration_=r),i.bar&&i.bar.update(js(i.el()),i.getProgress())})),n}},i.userSeek_=function(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)},i.getCurrentTime_=function(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()},i.getPercent=function(){var e,t=this.getCurrentTime_(),i=this.player_.liveTracker;return i&&i.isLive()?(e=(t-i.seekableStart())/i.liveWindow(),i.atLiveEdge()&&(e=1)):e=t/this.player_.duration(),e},i.handleMouseDown=function(t){Ks(t)&&(t.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),this.player_.pause(),e.prototype.handleMouseDown.call(this,t))},i.handleMouseMove=function(e,t){if(void 0===t&&(t=!1),Ks(e)){var i;t||this.player_.scrubbing()||this.player_.scrubbing(!0);var n=this.calculateDistance(e),r=this.player_.liveTracker;if(r&&r.isLive()){if(n>=.99)return void r.seekToLiveEdge();var a=r.seekableStart(),s=r.liveCurrentTime();if((i=a+n*r.liveWindow())>=s&&(i=s),i<=a&&(i=a+.1),i===1/0)return}else(i=n*this.player_.duration())===this.player_.duration()&&(i-=.1);this.userSeek_(i)}},i.enable=function(){e.prototype.enable.call(this);var t=this.getChild("mouseTimeDisplay");t&&t.show()},i.disable=function(){e.prototype.disable.call(this);var t=this.getChild("mouseTimeDisplay");t&&t.hide()},i.handleMouseUp=function(t){e.prototype.handleMouseUp.call(this,t),t&&t.stopPropagation(),this.player_.scrubbing(!1),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0}),this.videoWasPlaying?eu(this.player_.play()):this.update_()},i.stepForward=function(){this.userSeek_(this.player_.currentTime()+5)},i.stepBack=function(){this.userSeek_(this.player_.currentTime()-5)},i.handleAction=function(e){this.player_.paused()?this.player_.play():this.player_.pause()},i.handleKeyDown=function(t){var i=this.player_.liveTracker;if(re.isEventKey(t,"Space")||re.isEventKey(t,"Enter"))t.preventDefault(),t.stopPropagation(),this.handleAction(t);else if(re.isEventKey(t,"Home"))t.preventDefault(),t.stopPropagation(),this.userSeek_(0);else if(re.isEventKey(t,"End"))t.preventDefault(),t.stopPropagation(),i&&i.isLive()?this.userSeek_(i.liveCurrentTime()):this.userSeek_(this.player_.duration());else if(/^[0-9]$/.test(re(t))){t.preventDefault(),t.stopPropagation();var n=10*(re.codes[re(t)]-re.codes[0])/100;i&&i.isLive()?this.userSeek_(i.seekableStart()+i.liveWindow()*n):this.userSeek_(this.player_.duration()*n)}else re.isEventKey(t,"PgDn")?(t.preventDefault(),t.stopPropagation(),this.userSeek_(this.player_.currentTime()-60)):re.isEventKey(t,"PgUp")?(t.preventDefault(),t.stopPropagation(),this.userSeek_(this.player_.currentTime()+60)):e.prototype.handleKeyDown.call(this,t)},i.dispose=function(){this.disableInterval_(),this.off(this.player_,["ended","durationchange","timeupdate"],this.update),this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.update),this.off(this.player_,["playing"],this.enableIntervalHandler_),this.off(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in te&&"visibilityState"in te&&this.off(te,"visibilitychange",this.toggleVisibility_),e.prototype.dispose.call(this)},t}(_l);kl.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"},vs||rs||kl.prototype.options_.children.splice(1,0,"mouseTimeDisplay"),zo.registerComponent("SeekBar",kl);var Cl=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).handleMouseMove=ko(wo(ae(n),n.handleMouseMove),Eo),n.throttledHandleMouseSeek=ko(wo(ae(n),n.handleMouseSeek),Eo),n.handleMouseUpHandler_=function(e){return n.handleMouseUp(e)},n.handleMouseDownHandler_=function(e){return n.handleMouseDown(e)},n.enable(),n}oe(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-progress-control vjs-control"})},i.handleMouseMove=function(e){var t=this.getChild("seekBar");if(t){var i=t.getChild("playProgressBar"),n=t.getChild("mouseTimeDisplay");if(i||n){var r=t.el(),a=qs(r),s=Vs(r,e).x;s=yl(s,0,1),n&&n.update(a,s),i&&i.update(a,t.getProgress())}}},i.handleMouseSeek=function(e){var t=this.getChild("seekBar");t&&t.handleMouseMove(e)},i.enabled=function(){return this.enabled_},i.disable=function(){if(this.children().forEach((function(e){return e.disable&&e.disable()})),this.enabled()&&(this.off(["mousedown","touchstart"],this.handleMouseDownHandler_),this.off(this.el_,"mousemove",this.handleMouseMove),this.removeListenersAddedOnMousedownAndTouchstart(),this.addClass("disabled"),this.enabled_=!1,this.player_.scrubbing())){var e=this.getChild("seekBar");this.player_.scrubbing(!1),e.videoWasPlaying&&eu(this.player_.play())}},i.enable=function(){this.children().forEach((function(e){return e.enable&&e.enable()})),this.enabled()||(this.on(["mousedown","touchstart"],this.handleMouseDownHandler_),this.on(this.el_,"mousemove",this.handleMouseMove),this.removeClass("disabled"),this.enabled_=!0)},i.removeListenersAddedOnMousedownAndTouchstart=function(){var e=this.el_.ownerDocument;this.off(e,"mousemove",this.throttledHandleMouseSeek),this.off(e,"touchmove",this.throttledHandleMouseSeek),this.off(e,"mouseup",this.handleMouseUpHandler_),this.off(e,"touchend",this.handleMouseUpHandler_)},i.handleMouseDown=function(e){var t=this.el_.ownerDocument,i=this.getChild("seekBar");i&&i.handleMouseDown(e),this.on(t,"mousemove",this.throttledHandleMouseSeek),this.on(t,"touchmove",this.throttledHandleMouseSeek),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)},i.handleMouseUp=function(e){var t=this.getChild("seekBar");t&&t.handleMouseUp(e),this.removeListenersAddedOnMousedownAndTouchstart()},t}(zo);Cl.prototype.options_={children:["seekBar"]},zo.registerComponent("ProgressControl",Cl);var xl=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on(t,["enterpictureinpicture","leavepictureinpicture"],(function(e){return n.handlePictureInPictureChange(e)})),n.on(t,["disablepictureinpicturechanged","loadedmetadata"],(function(e){return n.handlePictureInPictureEnabledChange(e)})),n.on(t,["loadedmetadata","audioonlymodechange","audiopostermodechange"],(function(){"audio"===t.currentType().substring(0,5)||t.audioPosterMode()||t.audioOnlyMode()?(t.isInPictureInPicture()&&t.exitPictureInPicture(),n.hide()):n.show()})),n.disable(),n}oe(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-picture-in-picture-control "+e.prototype.buildCSSClass.call(this)},i.handlePictureInPictureEnabledChange=function(){te.pictureInPictureEnabled&&!1===this.player_.disablePictureInPicture()?this.enable():this.disable()},i.handlePictureInPictureChange=function(e){this.player_.isInPictureInPicture()?this.controlText("Exit Picture-in-Picture"):this.controlText("Picture-in-Picture"),this.handlePictureInPictureEnabledChange()},i.handleClick=function(e){this.player_.isInPictureInPicture()?this.player_.exitPictureInPicture():this.player_.requestPictureInPicture()},t}(rl);xl.prototype.controlText_="Picture-in-Picture",zo.registerComponent("PictureInPictureToggle",xl);var Il=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on(t,"fullscreenchange",(function(e){return n.handleFullscreenChange(e)})),!1===te[t.fsApi_.fullscreenEnabled]&&n.disable(),n}oe(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-fullscreen-control "+e.prototype.buildCSSClass.call(this)},i.handleFullscreenChange=function(e){this.player_.isFullscreen()?this.controlText("Non-Fullscreen"):this.controlText("Fullscreen")},i.handleClick=function(e){this.player_.isFullscreen()?this.player_.exitFullscreen():this.player_.requestFullscreen()},t}(rl);Il.prototype.controlText_="Fullscreen",zo.registerComponent("FullscreenToggle",Il);var Al=function(e){function t(){return e.apply(this,arguments)||this}return oe(t,e),t.prototype.createEl=function(){var t=e.prototype.createEl.call(this,"div",{className:"vjs-volume-level"});return t.appendChild(e.prototype.createEl.call(this,"span",{className:"vjs-control-text"})),t},t}(zo);zo.registerComponent("VolumeLevel",Al);var Pl=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).update=ko(wo(ae(n),n.update),Eo),n}oe(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})},i.update=function(e,t,i,n){if(!i){var r=js(this.el_),a=js(this.player_.el()),s=e.width*t;if(!a||!r)return;var o=e.left-a.left+s,u=e.width-s+(a.right-e.right),l=r.width/2;o<l?l+=l-o:u<l&&(l=u),l<0?l=0:l>r.width&&(l=r.width),this.el_.style.right="-"+l+"px"}this.write(n+"%")},i.write=function(e){xs(this.el_,e)},i.updateVolume=function(e,t,i,n,r){var a=this;this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",(function(){a.update(e,t,i,n.toFixed(0)),r&&r()}))},t}(zo);zo.registerComponent("VolumeLevelTooltip",Pl);var Ll=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).update=ko(wo(ae(n),n.update),Eo),n}oe(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-mouse-display"})},i.update=function(e,t,i){var n=this,r=100*t;this.getChild("volumeLevelTooltip").updateVolume(e,t,i,r,(function(){i?n.el_.style.bottom=e.height*t+"px":n.el_.style.left=e.width*t+"px"}))},t}(zo);Ll.prototype.options_={children:["volumeLevelTooltip"]},zo.registerComponent("MouseVolumeLevelDisplay",Ll);var Dl=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on("slideractive",(function(e){return n.updateLastVolume_(e)})),n.on(t,"volumechange",(function(e){return n.updateARIAAttributes(e)})),t.ready((function(){return n.updateARIAAttributes()})),n}oe(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-volume-bar vjs-slider-bar"},{"aria-label":this.localize("Volume Level"),"aria-live":"polite"})},i.handleMouseDown=function(t){Ks(t)&&e.prototype.handleMouseDown.call(this,t)},i.handleMouseMove=function(e){var t=this.getChild("mouseVolumeLevelDisplay");if(t){var i=this.el(),n=js(i),r=this.vertical(),a=Vs(i,e);a=r?a.y:a.x,a=yl(a,0,1),t.update(n,a,r)}Ks(e)&&(this.checkMuted(),this.player_.volume(this.calculateDistance(e)))},i.checkMuted=function(){this.player_.muted()&&this.player_.muted(!1)},i.getPercent=function(){return this.player_.muted()?0:this.player_.volume()},i.stepForward=function(){this.checkMuted(),this.player_.volume(this.player_.volume()+.1)},i.stepBack=function(){this.checkMuted(),this.player_.volume(this.player_.volume()-.1)},i.updateARIAAttributes=function(e){var t=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",t),this.el_.setAttribute("aria-valuetext",t+"%")},i.volumeAsPercentage_=function(){return Math.round(100*this.player_.volume())},i.updateLastVolume_=function(){var e=this,t=this.player_.volume();this.one("sliderinactive",(function(){0===e.player_.volume()&&e.player_.lastVolume_(t)}))},t}(_l);Dl.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"},vs||rs||Dl.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay"),Dl.prototype.playerEvent="volumechange",zo.registerComponent("VolumeBar",Dl);var Ol=function(e){function t(t,i){var n;return void 0===i&&(i={}),i.vertical=i.vertical||!1,(void 0===i.volumeBar||Qa(i.volumeBar))&&(i.volumeBar=i.volumeBar||{},i.volumeBar.vertical=i.vertical),function(e,t){t.tech_&&!t.tech_.featuresVolumeControl&&e.addClass("vjs-hidden"),e.on(t,"loadstart",(function(){t.tech_.featuresVolumeControl?e.removeClass("vjs-hidden"):e.addClass("vjs-hidden")}))}(ae(n=e.call(this,t,i)||this),t),n.throttledHandleMouseMove=ko(wo(ae(n),n.handleMouseMove),Eo),n.handleMouseUpHandler_=function(e){return n.handleMouseUp(e)},n.on("mousedown",(function(e){return n.handleMouseDown(e)})),n.on("touchstart",(function(e){return n.handleMouseDown(e)})),n.on("mousemove",(function(e){return n.handleMouseMove(e)})),n.on(n.volumeBar,["focus","slideractive"],(function(){n.volumeBar.addClass("vjs-slider-active"),n.addClass("vjs-slider-active"),n.trigger("slideractive")})),n.on(n.volumeBar,["blur","sliderinactive"],(function(){n.volumeBar.removeClass("vjs-slider-active"),n.removeClass("vjs-slider-active"),n.trigger("sliderinactive")})),n}oe(t,e);var i=t.prototype;return i.createEl=function(){var t="vjs-volume-horizontal";return this.options_.vertical&&(t="vjs-volume-vertical"),e.prototype.createEl.call(this,"div",{className:"vjs-volume-control vjs-control "+t})},i.handleMouseDown=function(e){var t=this.el_.ownerDocument;this.on(t,"mousemove",this.throttledHandleMouseMove),this.on(t,"touchmove",this.throttledHandleMouseMove),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)},i.handleMouseUp=function(e){var t=this.el_.ownerDocument;this.off(t,"mousemove",this.throttledHandleMouseMove),this.off(t,"touchmove",this.throttledHandleMouseMove),this.off(t,"mouseup",this.handleMouseUpHandler_),this.off(t,"touchend",this.handleMouseUpHandler_)},i.handleMouseMove=function(e){this.volumeBar.handleMouseMove(e)},t}(zo);Ol.prototype.options_={children:["volumeBar"]},zo.registerComponent("VolumeControl",Ol);var Nl=function(e){function t(t,i){var n;return function(e,t){t.tech_&&!t.tech_.featuresMuteControl&&e.addClass("vjs-hidden"),e.on(t,"loadstart",(function(){t.tech_.featuresMuteControl?e.removeClass("vjs-hidden"):e.addClass("vjs-hidden")}))}(ae(n=e.call(this,t,i)||this),t),n.on(t,["loadstart","volumechange"],(function(e){return n.update(e)})),n}oe(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-mute-control "+e.prototype.buildCSSClass.call(this)},i.handleClick=function(e){var t=this.player_.volume(),i=this.player_.lastVolume_();if(0===t){var n=i<.1?.1:i;this.player_.volume(n),this.player_.muted(!1)}else this.player_.muted(!this.player_.muted())},i.update=function(e){this.updateIcon_(),this.updateControlText_()},i.updateIcon_=function(){var e=this.player_.volume(),t=3;vs&&this.player_.tech_&&this.player_.tech_.el_&&this.player_.muted(this.player_.tech_.el_.muted),0===e||this.player_.muted()?t=0:e<.33?t=1:e<.67&&(t=2);for(var i=0;i<4;i++)Ls(this.el_,"vjs-vol-"+i);Ps(this.el_,"vjs-vol-"+t)},i.updateControlText_=function(){var e=this.player_.muted()||0===this.player_.volume()?"Unmute":"Mute";this.controlText()!==e&&this.controlText(e)},t}(rl);Nl.prototype.controlText_="Mute",zo.registerComponent("MuteToggle",Nl);var Rl=function(e){function t(t,i){var n;return void 0===i&&(i={}),void 0!==i.inline?i.inline=i.inline:i.inline=!0,(void 0===i.volumeControl||Qa(i.volumeControl))&&(i.volumeControl=i.volumeControl||{},i.volumeControl.vertical=!i.inline),(n=e.call(this,t,i)||this).handleKeyPressHandler_=function(e){return n.handleKeyPress(e)},n.on(t,["loadstart"],(function(e){return n.volumePanelState_(e)})),n.on(n.muteToggle,"keyup",(function(e){return n.handleKeyPress(e)})),n.on(n.volumeControl,"keyup",(function(e){return n.handleVolumeControlKeyUp(e)})),n.on("keydown",(function(e){return n.handleKeyPress(e)})),n.on("mouseover",(function(e){return n.handleMouseOver(e)})),n.on("mouseout",(function(e){return n.handleMouseOut(e)})),n.on(n.volumeControl,["slideractive"],n.sliderActive_),n.on(n.volumeControl,["sliderinactive"],n.sliderInactive_),n}oe(t,e);var i=t.prototype;return i.sliderActive_=function(){this.addClass("vjs-slider-active")},i.sliderInactive_=function(){this.removeClass("vjs-slider-active")},i.volumePanelState_=function(){this.volumeControl.hasClass("vjs-hidden")&&this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-hidden"),this.volumeControl.hasClass("vjs-hidden")&&!this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-mute-toggle-only")},i.createEl=function(){var t="vjs-volume-panel-horizontal";return this.options_.inline||(t="vjs-volume-panel-vertical"),e.prototype.createEl.call(this,"div",{className:"vjs-volume-panel vjs-control "+t})},i.dispose=function(){this.handleMouseOut(),e.prototype.dispose.call(this)},i.handleVolumeControlKeyUp=function(e){re.isEventKey(e,"Esc")&&this.muteToggle.focus()},i.handleMouseOver=function(e){this.addClass("vjs-hover"),go(te,"keyup",this.handleKeyPressHandler_)},i.handleMouseOut=function(e){this.removeClass("vjs-hover"),vo(te,"keyup",this.handleKeyPressHandler_)},i.handleKeyPress=function(e){re.isEventKey(e,"Esc")&&this.handleMouseOut()},t}(zo);Rl.prototype.options_={children:["muteToggle","volumeControl"]},zo.registerComponent("VolumePanel",Rl);var Ml=function(e){function t(t,i){var n;return n=e.call(this,t,i)||this,i&&(n.menuButton_=i.menuButton),n.focusedChild_=-1,n.on("keydown",(function(e){return n.handleKeyDown(e)})),n.boundHandleBlur_=function(e){return n.handleBlur(e)},n.boundHandleTapClick_=function(e){return n.handleTapClick(e)},n}oe(t,e);var i=t.prototype;return i.addEventListenerForItem=function(e){e instanceof zo&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))},i.removeEventListenerForItem=function(e){e instanceof zo&&(this.off(e,"blur",this.boundHandleBlur_),this.off(e,["tap","click"],this.boundHandleTapClick_))},i.removeChild=function(t){"string"==typeof t&&(t=this.getChild(t)),this.removeEventListenerForItem(t),e.prototype.removeChild.call(this,t)},i.addItem=function(e){var t=this.addChild(e);t&&this.addEventListenerForItem(t)},i.createEl=function(){var t=this.options_.contentElType||"ul";this.contentEl_=Cs(t,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu");var i=e.prototype.createEl.call(this,"div",{append:this.contentEl_,className:"vjs-menu"});return i.appendChild(this.contentEl_),go(i,"click",(function(e){e.preventDefault(),e.stopImmediatePropagation()})),i},i.dispose=function(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,e.prototype.dispose.call(this)},i.handleBlur=function(e){var t=e.relatedTarget||te.activeElement;if(!this.children().some((function(e){return e.el()===t}))){var i=this.menuButton_;i&&i.buttonPressed_&&t!==i.el().firstChild&&i.unpressButton()}},i.handleTapClick=function(e){if(this.menuButton_){this.menuButton_.unpressButton();var t=this.children();if(!Array.isArray(t))return;var i=t.filter((function(t){return t.el()===e.target}))[0];if(!i)return;"CaptionSettingsMenuItem"!==i.name()&&this.menuButton_.focus()}},i.handleKeyDown=function(e){re.isEventKey(e,"Left")||re.isEventKey(e,"Down")?(e.preventDefault(),e.stopPropagation(),this.stepForward()):(re.isEventKey(e,"Right")||re.isEventKey(e,"Up"))&&(e.preventDefault(),e.stopPropagation(),this.stepBack())},i.stepForward=function(){var e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_+1),this.focus(e)},i.stepBack=function(){var e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_-1),this.focus(e)},i.focus=function(e){void 0===e&&(e=0);var t=this.children().slice();t.length&&t[0].hasClass("vjs-menu-title")&&t.shift(),t.length>0&&(e<0?e=0:e>=t.length&&(e=t.length-1),this.focusedChild_=e,t[e].el_.focus())},t}(zo);zo.registerComponent("Menu",Ml);var Ul=function(e){function t(t,i){var n;void 0===i&&(i={}),(n=e.call(this,t,i)||this).menuButton_=new rl(t,i),n.menuButton_.controlText(n.controlText_),n.menuButton_.el_.setAttribute("aria-haspopup","true");var r=rl.prototype.buildCSSClass();n.menuButton_.el_.className=n.buildCSSClass()+" "+r,n.menuButton_.removeClass("vjs-control"),n.addChild(n.menuButton_),n.update(),n.enabled_=!0;var a=function(e){return n.handleClick(e)};return n.handleMenuKeyUp_=function(e){return n.handleMenuKeyUp(e)},n.on(n.menuButton_,"tap",a),n.on(n.menuButton_,"click",a),n.on(n.menuButton_,"keydown",(function(e){return n.handleKeyDown(e)})),n.on(n.menuButton_,"mouseenter",(function(){n.addClass("vjs-hover"),n.menu.show(),go(te,"keyup",n.handleMenuKeyUp_)})),n.on("mouseleave",(function(e){return n.handleMouseLeave(e)})),n.on("keydown",(function(e){return n.handleSubmenuKeyDown(e)})),n}oe(t,e);var i=t.prototype;return i.update=function(){var e=this.createMenu();this.menu&&(this.menu.dispose(),this.removeChild(this.menu)),this.menu=e,this.addChild(e),this.buttonPressed_=!1,this.menuButton_.el_.setAttribute("aria-expanded","false"),this.items&&this.items.length<=this.hideThreshold_?(this.hide(),this.menu.contentEl_.removeAttribute("role")):(this.show(),this.menu.contentEl_.setAttribute("role","menu"))},i.createMenu=function(){var e=new Ml(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){var t=Cs("li",{className:"vjs-menu-title",textContent:jo(this.options_.title),tabIndex:-1}),i=new zo(this.player_,{el:t});e.addItem(i)}if(this.items=this.createItems(),this.items)for(var n=0;n<this.items.length;n++)e.addItem(this.items[n]);return e},i.createItems=function(){},i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:this.buildWrapperCSSClass()},{})},i.buildWrapperCSSClass=function(){var t="vjs-menu-button";return!0===this.options_.inline?t+="-inline":t+="-popup","vjs-menu-button "+t+" "+rl.prototype.buildCSSClass()+" "+e.prototype.buildCSSClass.call(this)},i.buildCSSClass=function(){var t="vjs-menu-button";return!0===this.options_.inline?t+="-inline":t+="-popup","vjs-menu-button "+t+" "+e.prototype.buildCSSClass.call(this)},i.controlText=function(e,t){return void 0===t&&(t=this.menuButton_.el()),this.menuButton_.controlText(e,t)},i.dispose=function(){this.handleMouseLeave(),e.prototype.dispose.call(this)},i.handleClick=function(e){this.buttonPressed_?this.unpressButton():this.pressButton()},i.handleMouseLeave=function(e){this.removeClass("vjs-hover"),vo(te,"keyup",this.handleMenuKeyUp_)},i.focus=function(){this.menuButton_.focus()},i.blur=function(){this.menuButton_.blur()},i.handleKeyDown=function(e){re.isEventKey(e,"Esc")||re.isEventKey(e,"Tab")?(this.buttonPressed_&&this.unpressButton(),re.isEventKey(e,"Tab")||(e.preventDefault(),this.menuButton_.focus())):(re.isEventKey(e,"Up")||re.isEventKey(e,"Down"))&&(this.buttonPressed_||(e.preventDefault(),this.pressButton()))},i.handleMenuKeyUp=function(e){(re.isEventKey(e,"Esc")||re.isEventKey(e,"Tab"))&&this.removeClass("vjs-hover")},i.handleSubmenuKeyPress=function(e){this.handleSubmenuKeyDown(e)},i.handleSubmenuKeyDown=function(e){(re.isEventKey(e,"Esc")||re.isEventKey(e,"Tab"))&&(this.buttonPressed_&&this.unpressButton(),re.isEventKey(e,"Tab")||(e.preventDefault(),this.menuButton_.focus()))},i.pressButton=function(){if(this.enabled_){if(this.buttonPressed_=!0,this.menu.show(),this.menu.lockShowing(),this.menuButton_.el_.setAttribute("aria-expanded","true"),vs&&ws())return;this.menu.focus()}},i.unpressButton=function(){this.enabled_&&(this.buttonPressed_=!1,this.menu.unlockShowing(),this.menu.hide(),this.menuButton_.el_.setAttribute("aria-expanded","false"))},i.disable=function(){this.unpressButton(),this.enabled_=!1,this.addClass("vjs-disabled"),this.menuButton_.disable()},i.enable=function(){this.enabled_=!0,this.removeClass("vjs-disabled"),this.menuButton_.enable()},t}(zo);zo.registerComponent("MenuButton",Ul);var Bl=function(e){function t(t,i){var n,r=i.tracks;if((n=e.call(this,t,i)||this).items.length<=1&&n.hide(),!r)return ae(n);var a=wo(ae(n),n.update);return r.addEventListener("removetrack",a),r.addEventListener("addtrack",a),r.addEventListener("labelchange",a),n.player_.on("ready",a),n.player_.on("dispose",(function(){r.removeEventListener("removetrack",a),r.removeEventListener("addtrack",a),r.removeEventListener("labelchange",a)})),n}return oe(t,e),t}(Ul);zo.registerComponent("TrackButton",Bl);var Fl=["Tab","Esc","Up","Down","Right","Left"],jl=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).selectable=i.selectable,n.isSelected_=i.selected||!1,n.multiSelectable=i.multiSelectable,n.selected(n.isSelected_),n.selectable?n.multiSelectable?n.el_.setAttribute("role","menuitemcheckbox"):n.el_.setAttribute("role","menuitemradio"):n.el_.setAttribute("role","menuitem"),n}oe(t,e);var i=t.prototype;return i.createEl=function(t,i,n){this.nonIconControl=!0;var r=e.prototype.createEl.call(this,"li",Ka({className:"vjs-menu-item",tabIndex:-1},i),n);return r.replaceChild(Cs("span",{className:"vjs-menu-item-text",textContent:this.localize(this.options_.label)}),r.querySelector(".vjs-icon-placeholder")),r},i.handleKeyDown=function(t){Fl.some((function(e){return re.isEventKey(t,e)}))||e.prototype.handleKeyDown.call(this,t)},i.handleClick=function(e){this.selected(!0)},i.selected=function(e){this.selectable&&(e?(this.addClass("vjs-selected"),this.el_.setAttribute("aria-checked","true"),this.controlText(", selected"),this.isSelected_=!0):(this.removeClass("vjs-selected"),this.el_.setAttribute("aria-checked","false"),this.controlText(""),this.isSelected_=!1))},t}(Qu);zo.registerComponent("MenuItem",jl);var ql=function(e){function t(t,i){var n,r=i.track,a=t.textTracks();i.label=r.label||r.language||"Unknown",i.selected="showing"===r.mode,(n=e.call(this,t,i)||this).track=r,n.kinds=(i.kinds||[i.kind||n.track.kind]).filter(Boolean);var s,o=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];n.handleTracksChange.apply(ae(n),t)},l=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];n.handleSelectedLanguageChange.apply(ae(n),t)};(t.on(["loadstart","texttrackchange"],o),a.addEventListener("change",o),a.addEventListener("selectedlanguagechange",l),n.on("dispose",(function(){t.off(["loadstart","texttrackchange"],o),a.removeEventListener("change",o),a.removeEventListener("selectedlanguagechange",l)})),void 0===a.onchange)&&n.on(["tap","click"],(function(){if("object"!==u(d.Event))try{s=new d.Event("change")}catch(e){}s||(s=te.createEvent("Event")).initEvent("change",!0,!0),a.dispatchEvent(s)}));return n.handleTracksChange(),n}oe(t,e);var i=t.prototype;return i.handleClick=function(t){var i=this.track,n=this.player_.textTracks();if(e.prototype.handleClick.call(this,t),n)for(var r=0;r<n.length;r++){var a=n[r];-1!==this.kinds.indexOf(a.kind)&&(a===i?"showing"!==a.mode&&(a.mode="showing"):"disabled"!==a.mode&&(a.mode="disabled"))}},i.handleTracksChange=function(e){var t="showing"===this.track.mode;t!==this.isSelected_&&this.selected(t)},i.handleSelectedLanguageChange=function(e){if("showing"===this.track.mode){var t=this.player_.cache_.selectedLanguage;if(t&&t.enabled&&t.language===this.track.language&&t.kind!==this.track.kind)return;this.player_.cache_.selectedLanguage={enabled:!0,language:this.track.language,kind:this.track.kind}}},i.dispose=function(){this.track=null,e.prototype.dispose.call(this)},t}(jl);zo.registerComponent("TextTrackMenuItem",ql);var Vl=function(e){function t(t,i){return i.track={player:t,kind:i.kind,kinds:i.kinds,default:!1,mode:"disabled"},i.kinds||(i.kinds=[i.kind]),i.label?i.track.label=i.label:i.track.label=i.kinds.join(" and ")+" off",i.selectable=!0,i.multiSelectable=!1,e.call(this,t,i)||this}oe(t,e);var i=t.prototype;return i.handleTracksChange=function(e){for(var t=this.player().textTracks(),i=!0,n=0,r=t.length;n<r;n++){var a=t[n];if(this.options_.kinds.indexOf(a.kind)>-1&&"showing"===a.mode){i=!1;break}}i!==this.isSelected_&&this.selected(i)},i.handleSelectedLanguageChange=function(e){for(var t=this.player().textTracks(),i=!0,n=0,r=t.length;n<r;n++){var a=t[n];if(["captions","descriptions","subtitles"].indexOf(a.kind)>-1&&"showing"===a.mode){i=!1;break}}i&&(this.player_.cache_.selectedLanguage={enabled:!1})},t}(ql);zo.registerComponent("OffTextTrackMenuItem",Vl);var Hl=function(e){function t(t,i){return void 0===i&&(i={}),i.tracks=t.textTracks(),e.call(this,t,i)||this}return oe(t,e),t.prototype.createItems=function(e,t){var i;void 0===e&&(e=[]),void 0===t&&(t=ql),this.label_&&(i=this.label_+" off"),e.push(new Vl(this.player_,{kinds:this.kinds_,kind:this.kind_,label:i})),this.hideThreshold_+=1;var n=this.player_.textTracks();Array.isArray(this.kinds_)||(this.kinds_=[this.kind_]);for(var r=0;r<n.length;r++){var a=n[r];if(this.kinds_.indexOf(a.kind)>-1){var s=new t(this.player_,{track:a,kinds:this.kinds_,kind:this.kind_,selectable:!0,multiSelectable:!1});s.addClass("vjs-"+a.kind+"-menu-item"),e.push(s)}}return e},t}(Bl);zo.registerComponent("TextTrackButton",Hl);var Wl=function(e){function t(t,i){var n,r=i.track,a=i.cue,s=t.currentTime();return i.selectable=!0,i.multiSelectable=!1,i.label=a.text,i.selected=a.startTime<=s&&s<a.endTime,(n=e.call(this,t,i)||this).track=r,n.cue=a,n}return oe(t,e),t.prototype.handleClick=function(t){e.prototype.handleClick.call(this),this.player_.currentTime(this.cue.startTime)},t}(jl);zo.registerComponent("ChaptersTrackMenuItem",Wl);var Gl=function(e){function t(t,i,n){var r;return(r=e.call(this,t,i,n)||this).selectCurrentItem_=function(){r.items.forEach((function(e){e.selected(r.track_.activeCues[0]===e.cue)}))},r}oe(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-chapters-button "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-chapters-button "+e.prototype.buildWrapperCSSClass.call(this)},i.update=function(t){if(!t||!t.track||"chapters"===t.track.kind){var i=this.findChaptersTrack();i!==this.track_?(this.setTrack(i),e.prototype.update.call(this)):(!this.items||i&&i.cues&&i.cues.length!==this.items.length)&&e.prototype.update.call(this)}},i.setTrack=function(e){if(this.track_!==e){if(this.updateHandler_||(this.updateHandler_=this.update.bind(this)),this.track_){var t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);t&&t.removeEventListener("load",this.updateHandler_),this.track_.removeEventListener("cuechange",this.selectCurrentItem_),this.track_=null}if(this.track_=e,this.track_){this.track_.mode="hidden";var i=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);i&&i.addEventListener("load",this.updateHandler_),this.track_.addEventListener("cuechange",this.selectCurrentItem_)}}},i.findChaptersTrack=function(){for(var e=this.player_.textTracks()||[],t=e.length-1;t>=0;t--){var i=e[t];if(i.kind===this.kind_)return i}},i.getMenuCaption=function(){return this.track_&&this.track_.label?this.track_.label:this.localize(jo(this.kind_))},i.createMenu=function(){return this.options_.title=this.getMenuCaption(),e.prototype.createMenu.call(this)},i.createItems=function(){var e=[];if(!this.track_)return e;var t=this.track_.cues;if(!t)return e;for(var i=0,n=t.length;i<n;i++){var r=t[i],a=new Wl(this.player_,{track:this.track_,cue:r});e.push(a)}return e},t}(Hl);Gl.prototype.kind_="chapters",Gl.prototype.controlText_="Chapters",zo.registerComponent("ChaptersButton",Gl);var zl=function(e){function t(t,i,n){var r;r=e.call(this,t,i,n)||this;var a=t.textTracks(),s=wo(ae(r),r.handleTracksChange);return a.addEventListener("change",s),r.on("dispose",(function(){a.removeEventListener("change",s)})),r}oe(t,e);var i=t.prototype;return i.handleTracksChange=function(e){for(var t=this.player().textTracks(),i=!1,n=0,r=t.length;n<r;n++){var a=t[n];if(a.kind!==this.kind_&&"showing"===a.mode){i=!0;break}}i?this.disable():this.enable()},i.buildCSSClass=function(){return"vjs-descriptions-button "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-descriptions-button "+e.prototype.buildWrapperCSSClass.call(this)},t}(Hl);zl.prototype.kind_="descriptions",zl.prototype.controlText_="Descriptions",zo.registerComponent("DescriptionsButton",zl);var Xl=function(e){function t(t,i,n){return e.call(this,t,i,n)||this}oe(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-subtitles-button "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-subtitles-button "+e.prototype.buildWrapperCSSClass.call(this)},t}(Hl);Xl.prototype.kind_="subtitles",Xl.prototype.controlText_="Subtitles",zo.registerComponent("SubtitlesButton",Xl);var Kl=function(e){function t(t,i){var n;return i.track={player:t,kind:i.kind,label:i.kind+" settings",selectable:!1,default:!1,mode:"disabled"},i.selectable=!1,i.name="CaptionSettingsMenuItem",(n=e.call(this,t,i)||this).addClass("vjs-texttrack-settings"),n.controlText(", opens "+i.kind+" settings dialog"),n}return oe(t,e),t.prototype.handleClick=function(e){this.player().getChild("textTrackSettings").open()},t}(ql);zo.registerComponent("CaptionSettingsMenuItem",Kl);var Yl=function(e){function t(t,i,n){return e.call(this,t,i,n)||this}oe(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-captions-button "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-captions-button "+e.prototype.buildWrapperCSSClass.call(this)},i.createItems=function(){var t=[];return this.player().tech_&&this.player().tech_.featuresNativeTextTracks||!this.player().getChild("textTrackSettings")||(t.push(new Kl(this.player_,{kind:this.kind_})),this.hideThreshold_+=1),e.prototype.createItems.call(this,t)},t}(Hl);Yl.prototype.kind_="captions",Yl.prototype.controlText_="Captions",zo.registerComponent("CaptionsButton",Yl);var Ql=function(e){function t(){return e.apply(this,arguments)||this}return oe(t,e),t.prototype.createEl=function(t,i,n){var r=e.prototype.createEl.call(this,t,i,n),a=r.querySelector(".vjs-menu-item-text");return"captions"===this.options_.track.kind&&(a.appendChild(Cs("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),a.appendChild(Cs("span",{className:"vjs-control-text",textContent:" "+this.localize("Captions")}))),r},t}(ql);zo.registerComponent("SubsCapsMenuItem",Ql);var $l=function(e){function t(t,i){var n;return void 0===i&&(i={}),(n=e.call(this,t,i)||this).label_="subtitles",["en","en-us","en-ca","fr-ca"].indexOf(n.player_.language_)>-1&&(n.label_="captions"),n.menuButton_.controlText(jo(n.label_)),n}oe(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-subs-caps-button "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-subs-caps-button "+e.prototype.buildWrapperCSSClass.call(this)},i.createItems=function(){var t=[];return this.player().tech_&&this.player().tech_.featuresNativeTextTracks||!this.player().getChild("textTrackSettings")||(t.push(new Kl(this.player_,{kind:this.label_})),this.hideThreshold_+=1),t=e.prototype.createItems.call(this,t,Ql)},t}(Hl);$l.prototype.kinds_=["captions","subtitles"],$l.prototype.controlText_="Subtitles",zo.registerComponent("SubsCapsButton",$l);var Jl=function(e){function t(t,i){var n,r=i.track,a=t.audioTracks();i.label=r.label||r.language||"Unknown",i.selected=r.enabled,(n=e.call(this,t,i)||this).track=r,n.addClass("vjs-"+r.kind+"-menu-item");var s=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];n.handleTracksChange.apply(ae(n),t)};return a.addEventListener("change",s),n.on("dispose",(function(){a.removeEventListener("change",s)})),n}oe(t,e);var i=t.prototype;return i.createEl=function(t,i,n){var r=e.prototype.createEl.call(this,t,i,n),a=r.querySelector(".vjs-menu-item-text");return"main-desc"===this.options_.track.kind&&(a.appendChild(Cs("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),a.appendChild(Cs("span",{className:"vjs-control-text",textContent:" "+this.localize("Descriptions")}))),r},i.handleClick=function(t){if(e.prototype.handleClick.call(this,t),this.track.enabled=!0,this.player_.tech_.featuresNativeAudioTracks)for(var i=this.player_.audioTracks(),n=0;n<i.length;n++){var r=i[n];r!==this.track&&(r.enabled=r===this.track)}},i.handleTracksChange=function(e){this.selected(this.track.enabled)},t}(jl);zo.registerComponent("AudioTrackMenuItem",Jl);var Zl=function(e){function t(t,i){return void 0===i&&(i={}),i.tracks=t.audioTracks(),e.call(this,t,i)||this}oe(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-audio-button "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-audio-button "+e.prototype.buildWrapperCSSClass.call(this)},i.createItems=function(e){void 0===e&&(e=[]),this.hideThreshold_=1;for(var t=this.player_.audioTracks(),i=0;i<t.length;i++){var n=t[i];e.push(new Jl(this.player_,{track:n,selectable:!0,multiSelectable:!1}))}return e},t}(Bl);Zl.prototype.controlText_="Audio Track",zo.registerComponent("AudioTrackButton",Zl);var ec=function(e){function t(t,i){var n,r=i.rate,a=parseFloat(r,10);return i.label=r,i.selected=a===t.playbackRate(),i.selectable=!0,i.multiSelectable=!1,(n=e.call(this,t,i)||this).label=r,n.rate=a,n.on(t,"ratechange",(function(e){return n.update(e)})),n}oe(t,e);var i=t.prototype;return i.handleClick=function(t){e.prototype.handleClick.call(this),this.player().playbackRate(this.rate)},i.update=function(e){this.selected(this.player().playbackRate()===this.rate)},t}(jl);ec.prototype.contentElType="button",zo.registerComponent("PlaybackRateMenuItem",ec);var tc=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).menuButton_.el_.setAttribute("aria-describedby",n.labelElId_),n.updateVisibility(),n.updateLabel(),n.on(t,"loadstart",(function(e){return n.updateVisibility(e)})),n.on(t,"ratechange",(function(e){return n.updateLabel(e)})),n.on(t,"playbackrateschange",(function(e){return n.handlePlaybackRateschange(e)})),n}oe(t,e);var i=t.prototype;return i.createEl=function(){var t=e.prototype.createEl.call(this);return this.labelElId_="vjs-playback-rate-value-label-"+this.id_,this.labelEl_=Cs("div",{className:"vjs-playback-rate-value",id:this.labelElId_,textContent:"1x"}),t.appendChild(this.labelEl_),t},i.dispose=function(){this.labelEl_=null,e.prototype.dispose.call(this)},i.buildCSSClass=function(){return"vjs-playback-rate "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-playback-rate "+e.prototype.buildWrapperCSSClass.call(this)},i.createItems=function(){for(var e=this.playbackRates(),t=[],i=e.length-1;i>=0;i--)t.push(new ec(this.player(),{rate:e[i]+"x"}));return t},i.updateARIAAttributes=function(){this.el().setAttribute("aria-valuenow",this.player().playbackRate())},i.handleClick=function(e){var t=this.player().playbackRate(),i=this.playbackRates(),n=(i.indexOf(t)+1)%i.length;this.player().playbackRate(i[n])},i.handlePlaybackRateschange=function(e){this.update()},i.playbackRates=function(){var e=this.player();return e.playbackRates&&e.playbackRates()||[]},i.playbackRateSupported=function(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&this.playbackRates().length>0},i.updateVisibility=function(e){this.playbackRateSupported()?this.removeClass("vjs-hidden"):this.addClass("vjs-hidden")},i.updateLabel=function(e){this.playbackRateSupported()&&(this.labelEl_.textContent=this.player().playbackRate()+"x")},t}(Ul);tc.prototype.controlText_="Playback Rate",zo.registerComponent("PlaybackRateMenuButton",tc);var ic=function(e){function t(){return e.apply(this,arguments)||this}oe(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-spacer "+e.prototype.buildCSSClass.call(this)},i.createEl=function(t,i,n){return void 0===t&&(t="div"),void 0===i&&(i={}),void 0===n&&(n={}),i.className||(i.className=this.buildCSSClass()),e.prototype.createEl.call(this,t,i,n)},t}(zo);zo.registerComponent("Spacer",ic);var nc=function(e){function t(){return e.apply(this,arguments)||this}oe(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-custom-control-spacer "+e.prototype.buildCSSClass.call(this)},i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:this.buildCSSClass(),textContent:" "})},t}(ic);zo.registerComponent("CustomControlSpacer",nc);var rc=function(e){function t(){return e.apply(this,arguments)||this}return oe(t,e),t.prototype.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-control-bar",dir:"ltr"})},t}(zo);rc.prototype.options_={children:["playToggle","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","fullscreenToggle"]},"exitPictureInPicture"in te&&rc.prototype.options_.children.splice(rc.prototype.options_.children.length-1,0,"pictureInPictureToggle"),zo.registerComponent("ControlBar",rc);var ac=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on(t,"error",(function(e){return n.open(e)})),n}oe(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-error-display "+e.prototype.buildCSSClass.call(this)},i.content=function(){var e=this.player().error();return e?this.localize(e.message):""},t}(au);ac.prototype.options_=ie({},au.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0}),zo.registerComponent("ErrorDisplay",ac);var sc="vjs-text-track-settings",oc=["#000","Black"],uc=["#00F","Blue"],lc=["#0FF","Cyan"],cc=["#0F0","Green"],dc=["#F0F","Magenta"],hc=["#F00","Red"],pc=["#FFF","White"],fc=["#FF0","Yellow"],mc=["1","Opaque"],gc=["0.5","Semi-Transparent"],vc=["0","Transparent"],yc={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[oc,pc,hc,cc,uc,fc,dc,lc]},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Transparency",options:[mc,gc,vc]},color:{selector:".vjs-fg-color > select",id:"captions-foreground-color-%s",label:"Color",options:[pc,oc,hc,cc,uc,fc,dc,lc]},edgeStyle:{selector:".vjs-edge-style > select",id:"%s",label:"Text Edge Style",options:[["none","None"],["raised","Raised"],["depressed","Depressed"],["uniform","Uniform"],["dropshadow","Dropshadow"]]},fontFamily:{selector:".vjs-font-family > select",id:"captions-font-family-%s",label:"Font Family",options:[["proportionalSansSerif","Proportional Sans-Serif"],["monospaceSansSerif","Monospace Sans-Serif"],["proportionalSerif","Proportional Serif"],["monospaceSerif","Monospace Serif"],["casual","Casual"],["script","Script"],["small-caps","Small Caps"]]},fontPercent:{selector:".vjs-font-percent > select",id:"captions-font-size-%s",label:"Font Size",options:[["0.50","50%"],["0.75","75%"],["1.00","100%"],["1.25","125%"],["1.50","150%"],["1.75","175%"],["2.00","200%"],["3.00","300%"],["4.00","400%"]],default:2,parser:function(e){return"1.00"===e?null:Number(e)}},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Transparency",options:[mc,gc]},windowColor:{selector:".vjs-window-color > select",id:"captions-window-color-%s",label:"Color"},windowOpacity:{selector:".vjs-window-opacity > select",id:"captions-window-opacity-%s",label:"Transparency",options:[vc,gc,mc]}};function _c(e,t){if(t&&(e=t(e)),e&&"none"!==e)return e}yc.windowColor.options=yc.backgroundColor.options;var bc=function(e){function t(t,i){var n;return i.temporary=!1,(n=e.call(this,t,i)||this).updateDisplay=n.updateDisplay.bind(ae(n)),n.fill(),n.hasBeenOpened_=n.hasBeenFilled_=!0,n.endDialog=Cs("p",{className:"vjs-control-text",textContent:n.localize("End of dialog window.")}),n.el().appendChild(n.endDialog),n.setDefaults(),void 0===i.persistTextTrackSettings&&(n.options_.persistTextTrackSettings=n.options_.playerOptions.persistTextTrackSettings),n.on(n.$(".vjs-done-button"),"click",(function(){n.saveSettings(),n.close()})),n.on(n.$(".vjs-default-button"),"click",(function(){n.setDefaults(),n.updateDisplay()})),Xa(yc,(function(e){n.on(n.$(e.selector),"change",n.updateDisplay)})),n.options_.persistTextTrackSettings&&n.restoreSettings(),n}oe(t,e);var i=t.prototype;return i.dispose=function(){this.endDialog=null,e.prototype.dispose.call(this)},i.createElSelect_=function(e,t,i){var n=this;void 0===t&&(t=""),void 0===i&&(i="label");var r=yc[e],a=r.id.replace("%s",this.id_),s=[t,a].join(" ").trim();return["<"+i+' id="'+a+'" class="'+("label"===i?"vjs-label":"")+'">',this.localize(r.label),"</"+i+">",'<select aria-labelledby="'+s+'">'].concat(r.options.map((function(e){var t=a+"-"+e[1].replace(/\W+/g,"");return['<option id="'+t+'" value="'+e[0]+'" ','aria-labelledby="'+s+" "+t+'">',n.localize(e[1]),"</option>"].join("")}))).concat("</select>").join("")},i.createElFgColor_=function(){var e="captions-text-legend-"+this.id_;return['<fieldset class="vjs-fg-color vjs-track-setting">','<legend id="'+e+'">',this.localize("Text"),"</legend>",this.createElSelect_("color",e),'<span class="vjs-text-opacity vjs-opacity">',this.createElSelect_("textOpacity",e),"</span>","</fieldset>"].join("")},i.createElBgColor_=function(){var e="captions-background-"+this.id_;return['<fieldset class="vjs-bg-color vjs-track-setting">','<legend id="'+e+'">',this.localize("Background"),"</legend>",this.createElSelect_("backgroundColor",e),'<span class="vjs-bg-opacity vjs-opacity">',this.createElSelect_("backgroundOpacity",e),"</span>","</fieldset>"].join("")},i.createElWinColor_=function(){var e="captions-window-"+this.id_;return['<fieldset class="vjs-window-color vjs-track-setting">','<legend id="'+e+'">',this.localize("Window"),"</legend>",this.createElSelect_("windowColor",e),'<span class="vjs-window-opacity vjs-opacity">',this.createElSelect_("windowOpacity",e),"</span>","</fieldset>"].join("")},i.createElColors_=function(){return Cs("div",{className:"vjs-track-settings-colors",innerHTML:[this.createElFgColor_(),this.createElBgColor_(),this.createElWinColor_()].join("")})},i.createElFont_=function(){return Cs("div",{className:"vjs-track-settings-font",innerHTML:['<fieldset class="vjs-font-percent vjs-track-setting">',this.createElSelect_("fontPercent","","legend"),"</fieldset>",'<fieldset class="vjs-edge-style vjs-track-setting">',this.createElSelect_("edgeStyle","","legend"),"</fieldset>",'<fieldset class="vjs-font-family vjs-track-setting">',this.createElSelect_("fontFamily","","legend"),"</fieldset>"].join("")})},i.createElControls_=function(){var e=this.localize("restore all settings to the default values");return Cs("div",{className:"vjs-track-settings-controls",innerHTML:['<button type="button" class="vjs-default-button" title="'+e+'">',this.localize("Reset"),'<span class="vjs-control-text"> '+e+"</span>","</button>",'<button type="button" class="vjs-done-button">'+this.localize("Done")+"</button>"].join("")})},i.content=function(){return[this.createElColors_(),this.createElFont_(),this.createElControls_()]},i.label=function(){return this.localize("Caption Settings Dialog")},i.description=function(){return this.localize("Beginning of dialog window. Escape will cancel and close the window.")},i.buildCSSClass=function(){return e.prototype.buildCSSClass.call(this)+" vjs-text-track-settings"},i.getValues=function(){var e,t,i,n=this;return t=function(e,t,i){var r,a,s=(r=n.$(t.selector),a=t.parser,_c(r.options[r.options.selectedIndex].value,a));return void 0!==s&&(e[i]=s),e},void 0===(i={})&&(i=0),za(e=yc).reduce((function(i,n){return t(i,e[n],n)}),i)},i.setValues=function(e){var t=this;Xa(yc,(function(i,n){!function(e,t,i){if(t)for(var n=0;n<e.options.length;n++)if(_c(e.options[n].value,i)===t){e.selectedIndex=n;break}}(t.$(i.selector),e[n],i.parser)}))},i.setDefaults=function(){var e=this;Xa(yc,(function(t){var i=t.hasOwnProperty("default")?t.default:0;e.$(t.selector).selectedIndex=i}))},i.restoreSettings=function(){var e;try{e=JSON.parse(d.localStorage.getItem(sc))}catch(e){Ha.warn(e)}e&&this.setValues(e)},i.saveSettings=function(){if(this.options_.persistTextTrackSettings){var e=this.getValues();try{Object.keys(e).length?d.localStorage.setItem(sc,JSON.stringify(e)):d.localStorage.removeItem(sc)}catch(e){Ha.warn(e)}}},i.updateDisplay=function(){var e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()},i.conditionalBlur_=function(){this.previouslyActiveEl_=null;var e=this.player_.controlBar,t=e&&e.subsCapsButton,i=e&&e.captionsButton;t?t.focus():i&&i.focus()},t}(au);zo.registerComponent("TextTrackSettings",bc);var Tc=function(e){function t(t,i){var n,r=i.ResizeObserver||d.ResizeObserver;null===i.ResizeObserver&&(r=!1);var a=qo({createEl:!r,reportTouchActivity:!1},i);return(n=e.call(this,t,a)||this).ResizeObserver=i.ResizeObserver||d.ResizeObserver,n.loadListener_=null,n.resizeObserver_=null,n.debouncedHandler_=function(e,t,i,n){var r;void 0===n&&(n=d);var a=function(){var a=this,s=arguments,o=function(){r=null,o=null,i||e.apply(a,s)};!r&&i&&e.apply(a,s),n.clearTimeout(r),r=n.setTimeout(o,t)};return a.cancel=function(){n.clearTimeout(r),r=null},a}((function(){n.resizeHandler()}),100,!1,ae(n)),r?(n.resizeObserver_=new n.ResizeObserver(n.debouncedHandler_),n.resizeObserver_.observe(t.el())):(n.loadListener_=function(){if(n.el_&&n.el_.contentWindow){var e=n.debouncedHandler_,t=n.unloadListener_=function(){vo(this,"resize",e),vo(this,"unload",t),t=null};go(n.el_.contentWindow,"unload",t),go(n.el_.contentWindow,"resize",e)}},n.one("load",n.loadListener_)),n}oe(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"iframe",{className:"vjs-resize-manager",tabIndex:-1,title:this.localize("No content")},{"aria-hidden":"true"})},i.resizeHandler=function(){this.player_&&this.player_.trigger&&this.player_.trigger("playerresize")},i.dispose=function(){this.debouncedHandler_&&this.debouncedHandler_.cancel(),this.resizeObserver_&&(this.player_.el()&&this.resizeObserver_.unobserve(this.player_.el()),this.resizeObserver_.disconnect()),this.loadListener_&&this.off("load",this.loadListener_),this.el_&&this.el_.contentWindow&&this.unloadListener_&&this.unloadListener_.call(this.el_.contentWindow),this.ResizeObserver=null,this.resizeObserver=null,this.debouncedHandler_=null,this.loadListener_=null,e.prototype.dispose.call(this)},t}(zo);zo.registerComponent("ResizeManager",Tc);var Sc={trackingThreshold:20,liveTolerance:15},Ec=function(e){function t(t,i){var n,r=qo(Sc,i,{createEl:!1});return(n=e.call(this,t,r)||this).handleVisibilityChange_=function(e){return n.handleVisibilityChange(e)},n.trackLiveHandler_=function(){return n.trackLive_()},n.handlePlay_=function(e){return n.handlePlay(e)},n.handleFirstTimeupdate_=function(e){return n.handleFirstTimeupdate(e)},n.handleSeeked_=function(e){return n.handleSeeked(e)},n.seekToLiveEdge_=function(e){return n.seekToLiveEdge(e)},n.reset_(),n.on(n.player_,"durationchange",(function(e){return n.handleDurationchange(e)})),n.on(n.player_,"canplay",(function(){return n.toggleTracking()})),ds&&"hidden"in te&&"visibilityState"in te&&n.on(te,"visibilitychange",n.handleVisibilityChange_),n}oe(t,e);var i=t.prototype;return i.handleVisibilityChange=function(){this.player_.duration()===1/0&&(te.hidden?this.stopTracking():this.startTracking())},i.trackLive_=function(){var e=this.player_.seekable();if(e&&e.length){var t=Number(d.performance.now().toFixed(4)),i=-1===this.lastTime_?0:(t-this.lastTime_)/1e3;this.lastTime_=t,this.pastSeekEnd_=this.pastSeekEnd()+i;var n=this.liveCurrentTime(),r=this.player_.currentTime(),a=this.player_.paused()||this.seekedBehindLive_||Math.abs(n-r)>this.options_.liveTolerance;this.timeupdateSeen_&&n!==1/0||(a=!1),a!==this.behindLiveEdge_&&(this.behindLiveEdge_=a,this.trigger("liveedgechange"))}},i.handleDurationchange=function(){this.toggleTracking()},i.toggleTracking=function(){this.player_.duration()===1/0&&this.liveWindow()>=this.options_.trackingThreshold?(this.player_.options_.liveui&&this.player_.addClass("vjs-liveui"),this.startTracking()):(this.player_.removeClass("vjs-liveui"),this.stopTracking())},i.startTracking=function(){this.isTracking()||(this.timeupdateSeen_||(this.timeupdateSeen_=this.player_.hasStarted()),this.trackingInterval_=this.setInterval(this.trackLiveHandler_,Eo),this.trackLive_(),this.on(this.player_,["play","pause"],this.trackLiveHandler_),this.timeupdateSeen_?this.on(this.player_,"seeked",this.handleSeeked_):(this.one(this.player_,"play",this.handlePlay_),this.one(this.player_,"timeupdate",this.handleFirstTimeupdate_)))},i.handleFirstTimeupdate=function(){this.timeupdateSeen_=!0,this.on(this.player_,"seeked",this.handleSeeked_)},i.handleSeeked=function(){var e=Math.abs(this.liveCurrentTime()-this.player_.currentTime());this.seekedBehindLive_=this.nextSeekedFromUser_&&e>2,this.nextSeekedFromUser_=!1,this.trackLive_()},i.handlePlay=function(){this.one(this.player_,"timeupdate",this.seekToLiveEdge_)},i.reset_=function(){this.lastTime_=-1,this.pastSeekEnd_=0,this.lastSeekEnd_=-1,this.behindLiveEdge_=!0,this.timeupdateSeen_=!1,this.seekedBehindLive_=!1,this.nextSeekedFromUser_=!1,this.clearInterval(this.trackingInterval_),this.trackingInterval_=null,this.off(this.player_,["play","pause"],this.trackLiveHandler_),this.off(this.player_,"seeked",this.handleSeeked_),this.off(this.player_,"play",this.handlePlay_),this.off(this.player_,"timeupdate",this.handleFirstTimeupdate_),this.off(this.player_,"timeupdate",this.seekToLiveEdge_)},i.nextSeekedFromUser=function(){this.nextSeekedFromUser_=!0},i.stopTracking=function(){this.isTracking()&&(this.reset_(),this.trigger("liveedgechange"))},i.seekableEnd=function(){for(var e=this.player_.seekable(),t=[],i=e?e.length:0;i--;)t.push(e.end(i));return t.length?t.sort()[t.length-1]:1/0},i.seekableStart=function(){for(var e=this.player_.seekable(),t=[],i=e?e.length:0;i--;)t.push(e.start(i));return t.length?t.sort()[0]:0},i.liveWindow=function(){var e=this.liveCurrentTime();return e===1/0?0:e-this.seekableStart()},i.isLive=function(){return this.isTracking()},i.atLiveEdge=function(){return!this.behindLiveEdge()},i.liveCurrentTime=function(){return this.pastSeekEnd()+this.seekableEnd()},i.pastSeekEnd=function(){var e=this.seekableEnd();return-1!==this.lastSeekEnd_&&e!==this.lastSeekEnd_&&(this.pastSeekEnd_=0),this.lastSeekEnd_=e,this.pastSeekEnd_},i.behindLiveEdge=function(){return this.behindLiveEdge_},i.isTracking=function(){return"number"==typeof this.trackingInterval_},i.seekToLiveEdge=function(){this.seekedBehindLive_=!1,this.atLiveEdge()||(this.nextSeekedFromUser_=!1,this.player_.currentTime(this.liveCurrentTime()))},i.dispose=function(){this.off(te,"visibilitychange",this.handleVisibilityChange_),this.stopTracking(),e.prototype.dispose.call(this)},t}(zo);zo.registerComponent("LiveTracker",Ec);var wc,kc=function(e){var t=e.el();if(t.hasAttribute("src"))return e.triggerSourceset(t.src),!0;var i=e.$$("source"),n=[],r="";if(!i.length)return!1;for(var a=0;a<i.length;a++){var s=i[a].src;s&&-1===n.indexOf(s)&&n.push(s)}return!!n.length&&(1===n.length&&(r=n[0]),e.triggerSourceset(r),!0)},Cc=Object.defineProperty({},"innerHTML",{get:function(){return this.cloneNode(!0).innerHTML},set:function(e){var t=te.createElement(this.nodeName.toLowerCase());t.innerHTML=e;for(var i=te.createDocumentFragment();t.childNodes.length;)i.appendChild(t.childNodes[0]);return this.innerText="",d.Element.prototype.appendChild.call(this,i),this.innerHTML}}),xc=function(e,t){for(var i={},n=0;n<e.length&&!((i=Object.getOwnPropertyDescriptor(e[n],t))&&i.set&&i.get);n++);return i.enumerable=!0,i.configurable=!0,i},Ic=function(e){var t=e.el();if(!t.resetSourceWatch_){var i={},n=function(e){return xc([e.el(),d.HTMLMediaElement.prototype,d.Element.prototype,Cc],"innerHTML")}(e),r=function(i){return function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];var s=i.apply(t,r);return kc(e),s}};["append","appendChild","insertAdjacentHTML"].forEach((function(e){t[e]&&(i[e]=t[e],t[e]=r(i[e]))})),Object.defineProperty(t,"innerHTML",qo(n,{set:r(n.set)})),t.resetSourceWatch_=function(){t.resetSourceWatch_=null,Object.keys(i).forEach((function(e){t[e]=i[e]})),Object.defineProperty(t,"innerHTML",n)},e.one("sourceset",t.resetSourceWatch_)}},Ac=Object.defineProperty({},"src",{get:function(){return this.hasAttribute("src")?Tu(d.Element.prototype.getAttribute.call(this,"src")):""},set:function(e){return d.Element.prototype.setAttribute.call(this,"src",e),e}}),Pc=function(e){if(e.featuresSourceset){var t=e.el();if(!t.resetSourceset_){var i=function(e){return xc([e.el(),d.HTMLMediaElement.prototype,Ac],"src")}(e),n=t.setAttribute,r=t.load;Object.defineProperty(t,"src",qo(i,{set:function(n){var r=i.set.call(t,n);return e.triggerSourceset(t.src),r}})),t.setAttribute=function(i,r){var a=n.call(t,i,r);return/src/i.test(i)&&e.triggerSourceset(t.src),a},t.load=function(){var i=r.call(t);return kc(e)||(e.triggerSourceset(""),Ic(e)),i},t.currentSrc?e.triggerSourceset(t.currentSrc):kc(e)||Ic(e),t.resetSourceset_=function(){t.resetSourceset_=null,t.load=r,t.setAttribute=n,Object.defineProperty(t,"src",i),t.resetSourceWatch_&&t.resetSourceWatch_()}}}},Lc=function(e,t,i,n){void 0===n&&(n=!0);var r=function(i){return Object.defineProperty(e,t,{value:i,enumerable:!0,writable:!0})},a={configurable:!0,enumerable:!0,get:function(){var e=i();return r(e),e}};return n&&(a.set=r),Object.defineProperty(e,t,a)},Dc=function(e){function t(t,i){var n;n=e.call(this,t,i)||this;var r=t.source,a=!1;if(n.featuresVideoFrameCallback=n.featuresVideoFrameCallback&&"VIDEO"===n.el_.tagName,r&&(n.el_.currentSrc!==r.src||t.tag&&3===t.tag.initNetworkState_)?n.setSource(r):n.handleLateInit_(n.el_),t.enableSourceset&&n.setupSourcesetHandling_(),n.isScrubbing_=!1,n.el_.hasChildNodes()){for(var s=n.el_.childNodes,o=s.length,u=[];o--;){var l=s[o];"track"===l.nodeName.toLowerCase()&&(n.featuresNativeTextTracks?(n.remoteTextTrackEls().addTrackElement_(l),n.remoteTextTracks().addTrack(l.track),n.textTracks().addTrack(l.track),a||n.el_.hasAttribute("crossorigin")||!Eu(l.src)||(a=!0)):u.push(l))}for(var c=0;c<u.length;c++)n.el_.removeChild(u[c])}return n.proxyNativeTracks_(),n.featuresNativeTextTracks&&a&&Ha.warn("Text Tracks are being loaded from another origin but the crossorigin attribute isn't used.\nThis may prevent text tracks from loading."),n.restoreMetadataTracksInIOSNativePlayer_(),(fs||gs||ss)&&!0===t.nativeControlsForTouch&&n.setControls(!0),n.proxyWebkitFullscreen_(),n.triggerReady(),n}oe(t,e);var i=t.prototype;return i.dispose=function(){this.el_&&this.el_.resetSourceset_&&this.el_.resetSourceset_(),t.disposeMediaElement(this.el_),this.options_=null,e.prototype.dispose.call(this)},i.setupSourcesetHandling_=function(){Pc(this)},i.restoreMetadataTracksInIOSNativePlayer_=function(){var e,t=this.textTracks(),i=function(){e=[];for(var i=0;i<t.length;i++){var n=t[i];"metadata"===n.kind&&e.push({track:n,storedMode:n.mode})}};i(),t.addEventListener("change",i),this.on("dispose",(function(){return t.removeEventListener("change",i)}));var n=function i(){for(var n=0;n<e.length;n++){var r=e[n];"disabled"===r.track.mode&&r.track.mode!==r.storedMode&&(r.track.mode=r.storedMode)}t.removeEventListener("change",i)};this.on("webkitbeginfullscreen",(function(){t.removeEventListener("change",i),t.removeEventListener("change",n),t.addEventListener("change",n)})),this.on("webkitendfullscreen",(function(){t.removeEventListener("change",i),t.addEventListener("change",i),t.removeEventListener("change",n)}))},i.overrideNative_=function(e,t){var i=this;if(t===this["featuresNative"+e+"Tracks"]){var n=e.toLowerCase();this[n+"TracksListeners_"]&&Object.keys(this[n+"TracksListeners_"]).forEach((function(e){i.el()[n+"Tracks"].removeEventListener(e,i[n+"TracksListeners_"][e])})),this["featuresNative"+e+"Tracks"]=!t,this[n+"TracksListeners_"]=null,this.proxyNativeTracksForType_(n)}},i.overrideNativeAudioTracks=function(e){this.overrideNative_("Audio",e)},i.overrideNativeVideoTracks=function(e){this.overrideNative_("Video",e)},i.proxyNativeTracksForType_=function(e){var t=this,i=Lu[e],n=this.el()[i.getterName],r=this[i.getterName]();if(this["featuresNative"+i.capitalName+"Tracks"]&&n&&n.addEventListener){var a={change:function(i){var n={type:"change",target:r,currentTarget:r,srcElement:r};r.trigger(n),"text"===e&&t[Du.remoteText.getterName]().trigger(n)},addtrack:function(e){r.addTrack(e.track)},removetrack:function(e){r.removeTrack(e.track)}},s=function(){for(var e=[],t=0;t<r.length;t++){for(var i=!1,a=0;a<n.length;a++)if(n[a]===r[t]){i=!0;break}i||e.push(r[t])}for(;e.length;)r.removeTrack(e.shift())};this[i.getterName+"Listeners_"]=a,Object.keys(a).forEach((function(e){var i=a[e];n.addEventListener(e,i),t.on("dispose",(function(t){return n.removeEventListener(e,i)}))})),this.on("loadstart",s),this.on("dispose",(function(e){return t.off("loadstart",s)}))}},i.proxyNativeTracks_=function(){var e=this;Lu.names.forEach((function(t){e.proxyNativeTracksForType_(t)}))},i.createEl=function(){var e=this.options_.tag;if(!e||!this.options_.playerElIngest&&!this.movingMediaElementInDOM){if(e){var i=e.cloneNode(!0);e.parentNode&&e.parentNode.insertBefore(i,e),t.disposeMediaElement(e),e=i}else{e=te.createElement("video");var n=qo({},this.options_.tag&&Ns(this.options_.tag));fs&&!0===this.options_.nativeControlsForTouch||delete n.controls,Os(e,Ka(n,{id:this.options_.techId,class:"vjs-tech"}))}e.playerId=this.options_.playerId}void 0!==this.options_.preload&&Ms(e,"preload",this.options_.preload),void 0!==this.options_.disablePictureInPicture&&(e.disablePictureInPicture=this.options_.disablePictureInPicture);for(var r=["loop","muted","playsinline","autoplay"],a=0;a<r.length;a++){var s=r[a],o=this.options_[s];void 0!==o&&(o?Ms(e,s,s):Us(e,s),e[s]=o)}return e},i.handleLateInit_=function(e){if(0!==e.networkState&&3!==e.networkState){if(0===e.readyState){var t=!1,i=function(){t=!0};this.on("loadstart",i);var n=function(){t||this.trigger("loadstart")};return this.on("loadedmetadata",n),void this.ready((function(){this.off("loadstart",i),this.off("loadedmetadata",n),t||this.trigger("loadstart")}))}var r=["loadstart"];r.push("loadedmetadata"),e.readyState>=2&&r.push("loadeddata"),e.readyState>=3&&r.push("canplay"),e.readyState>=4&&r.push("canplaythrough"),this.ready((function(){r.forEach((function(e){this.trigger(e)}),this)}))}},i.setScrubbing=function(e){this.isScrubbing_=e},i.scrubbing=function(){return this.isScrubbing_},i.setCurrentTime=function(e){try{this.isScrubbing_&&this.el_.fastSeek&&ys?this.el_.fastSeek(e):this.el_.currentTime=e}catch(e){Ha(e,"Video is not ready. (Video.js)")}},i.duration=function(){var e=this;if(this.el_.duration===1/0&&rs&&ls&&0===this.el_.currentTime){return this.on("timeupdate",(function t(){e.el_.currentTime>0&&(e.el_.duration===1/0&&e.trigger("durationchange"),e.off("timeupdate",t))})),NaN}return this.el_.duration||NaN},i.width=function(){return this.el_.offsetWidth},i.height=function(){return this.el_.offsetHeight},i.proxyWebkitFullscreen_=function(){var e=this;if("webkitDisplayingFullscreen"in this.el_){var t=function(){this.trigger("fullscreenchange",{isFullscreen:!1}),this.el_.controls&&!this.options_.nativeControlsForTouch&&this.controls()&&(this.el_.controls=!1)},i=function(){"webkitPresentationMode"in this.el_&&"picture-in-picture"!==this.el_.webkitPresentationMode&&(this.one("webkitendfullscreen",t),this.trigger("fullscreenchange",{isFullscreen:!0,nativeIOSFullscreen:!0}))};this.on("webkitbeginfullscreen",i),this.on("dispose",(function(){e.off("webkitbeginfullscreen",i),e.off("webkitendfullscreen",t)}))}},i.supportsFullScreen=function(){if("function"==typeof this.el_.webkitEnterFullScreen){var e=d.navigator&&d.navigator.userAgent||"";if(/Android/.test(e)||!/Chrome|Mac OS X 10.5/.test(e))return!0}return!1},i.enterFullScreen=function(){var e=this.el_;if(e.paused&&e.networkState<=e.HAVE_METADATA)eu(this.el_.play()),this.setTimeout((function(){e.pause();try{e.webkitEnterFullScreen()}catch(e){this.trigger("fullscreenerror",e)}}),0);else try{e.webkitEnterFullScreen()}catch(e){this.trigger("fullscreenerror",e)}},i.exitFullScreen=function(){this.el_.webkitDisplayingFullscreen?this.el_.webkitExitFullScreen():this.trigger("fullscreenerror",new Error("The video is not fullscreen"))},i.requestPictureInPicture=function(){return this.el_.requestPictureInPicture()},i.requestVideoFrameCallback=function(t){return this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.requestVideoFrameCallback(t):e.prototype.requestVideoFrameCallback.call(this,t)},i.cancelVideoFrameCallback=function(t){this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.cancelVideoFrameCallback(t):e.prototype.cancelVideoFrameCallback.call(this,t)},i.src=function(e){if(void 0===e)return this.el_.src;this.setSrc(e)},i.reset=function(){t.resetMediaElement(this.el_)},i.currentSrc=function(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc},i.setControls=function(e){this.el_.controls=!!e},i.addTextTrack=function(t,i,n){return this.featuresNativeTextTracks?this.el_.addTextTrack(t,i,n):e.prototype.addTextTrack.call(this,t,i,n)},i.createRemoteTextTrack=function(t){if(!this.featuresNativeTextTracks)return e.prototype.createRemoteTextTrack.call(this,t);var i=te.createElement("track");return t.kind&&(i.kind=t.kind),t.label&&(i.label=t.label),(t.language||t.srclang)&&(i.srclang=t.language||t.srclang),t.default&&(i.default=t.default),t.id&&(i.id=t.id),t.src&&(i.src=t.src),i},i.addRemoteTextTrack=function(t,i){var n=e.prototype.addRemoteTextTrack.call(this,t,i);return this.featuresNativeTextTracks&&this.el().appendChild(n),n},i.removeRemoteTextTrack=function(t){if(e.prototype.removeRemoteTextTrack.call(this,t),this.featuresNativeTextTracks)for(var i=this.$$("track"),n=i.length;n--;)t!==i[n]&&t!==i[n].track||this.el().removeChild(i[n])},i.getVideoPlaybackQuality=function(){if("function"==typeof this.el().getVideoPlaybackQuality)return this.el().getVideoPlaybackQuality();var e={};return void 0!==this.el().webkitDroppedFrameCount&&void 0!==this.el().webkitDecodedFrameCount&&(e.droppedVideoFrames=this.el().webkitDroppedFrameCount,e.totalVideoFrames=this.el().webkitDecodedFrameCount),d.performance&&"function"==typeof d.performance.now?e.creationTime=d.performance.now():d.performance&&d.performance.timing&&"number"==typeof d.performance.timing.navigationStart&&(e.creationTime=d.Date.now()-d.performance.timing.navigationStart),e},t}(Nu);Lc(Dc,"TEST_VID",(function(){if(Ss()){var e=te.createElement("video"),t=te.createElement("track");return t.kind="captions",t.srclang="en",t.label="English",e.appendChild(t),e}})),Dc.isSupported=function(){try{Dc.TEST_VID.volume=.5}catch(e){return!1}return!(!Dc.TEST_VID||!Dc.TEST_VID.canPlayType)},Dc.canPlayType=function(e){return Dc.TEST_VID.canPlayType(e)},Dc.canPlaySource=function(e,t){return Dc.canPlayType(e.type)},Dc.canControlVolume=function(){try{var e=Dc.TEST_VID.volume;Dc.TEST_VID.volume=e/2+.1;var t=e!==Dc.TEST_VID.volume;return t&&vs?(d.setTimeout((function(){Dc&&Dc.prototype&&(Dc.prototype.featuresVolumeControl=e!==Dc.TEST_VID.volume)})),!1):t}catch(e){return!1}},Dc.canMuteVolume=function(){try{var e=Dc.TEST_VID.muted;return Dc.TEST_VID.muted=!e,Dc.TEST_VID.muted?Ms(Dc.TEST_VID,"muted","muted"):Us(Dc.TEST_VID,"muted"),e!==Dc.TEST_VID.muted}catch(e){return!1}},Dc.canControlPlaybackRate=function(){if(rs&&ls&&cs<58)return!1;try{var e=Dc.TEST_VID.playbackRate;return Dc.TEST_VID.playbackRate=e/2+.1,e!==Dc.TEST_VID.playbackRate}catch(e){return!1}},Dc.canOverrideAttributes=function(){try{var e=function(){};Object.defineProperty(te.createElement("video"),"src",{get:e,set:e}),Object.defineProperty(te.createElement("audio"),"src",{get:e,set:e}),Object.defineProperty(te.createElement("video"),"innerHTML",{get:e,set:e}),Object.defineProperty(te.createElement("audio"),"innerHTML",{get:e,set:e})}catch(e){return!1}return!0},Dc.supportsNativeTextTracks=function(){return ys||vs&&ls},Dc.supportsNativeVideoTracks=function(){return!(!Dc.TEST_VID||!Dc.TEST_VID.videoTracks)},Dc.supportsNativeAudioTracks=function(){return!(!Dc.TEST_VID||!Dc.TEST_VID.audioTracks)},Dc.Events=["loadstart","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","progress","play","pause","ratechange","resize","volumechange"],[["featuresMuteControl","canMuteVolume"],["featuresPlaybackRate","canControlPlaybackRate"],["featuresSourceset","canOverrideAttributes"],["featuresNativeTextTracks","supportsNativeTextTracks"],["featuresNativeVideoTracks","supportsNativeVideoTracks"],["featuresNativeAudioTracks","supportsNativeAudioTracks"]].forEach((function(e){var t=e[0],i=e[1];Lc(Dc.prototype,t,(function(){return Dc[i]()}),!0)})),Dc.prototype.featuresVolumeControl=Dc.canControlVolume(),Dc.prototype.movingMediaElementInDOM=!vs,Dc.prototype.featuresFullscreenResize=!0,Dc.prototype.featuresProgressEvents=!0,Dc.prototype.featuresTimeupdateEvents=!0,Dc.prototype.featuresVideoFrameCallback=!(!Dc.TEST_VID||!Dc.TEST_VID.requestVideoFrameCallback),Dc.patchCanPlayType=function(){as>=4&&!os&&!ls&&(wc=Dc.TEST_VID&&Dc.TEST_VID.constructor.prototype.canPlayType,Dc.TEST_VID.constructor.prototype.canPlayType=function(e){return e&&/^application\/(?:x-|vnd\.apple\.)mpegurl/i.test(e)?"maybe":wc.call(this,e)})},Dc.unpatchCanPlayType=function(){var e=Dc.TEST_VID.constructor.prototype.canPlayType;return wc&&(Dc.TEST_VID.constructor.prototype.canPlayType=wc),e},Dc.patchCanPlayType(),Dc.disposeMediaElement=function(e){if(e){for(e.parentNode&&e.parentNode.removeChild(e);e.hasChildNodes();)e.removeChild(e.firstChild);e.removeAttribute("src"),"function"==typeof e.load&&function(){try{e.load()}catch(e){}}()}},Dc.resetMediaElement=function(e){if(e){for(var t=e.querySelectorAll("source"),i=t.length;i--;)e.removeChild(t[i]);e.removeAttribute("src"),"function"==typeof e.load&&function(){try{e.load()}catch(e){}}()}},["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach((function(e){Dc.prototype[e]=function(){return this.el_[e]||this.el_.hasAttribute(e)}})),["muted","defaultMuted","autoplay","loop","playsinline"].forEach((function(e){Dc.prototype["set"+jo(e)]=function(t){this.el_[e]=t,t?this.el_.setAttribute(e,e):this.el_.removeAttribute(e)}})),["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","disablePictureInPicture","played","networkState","readyState","videoWidth","videoHeight","crossOrigin"].forEach((function(e){Dc.prototype[e]=function(){return this.el_[e]}})),["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach((function(e){Dc.prototype["set"+jo(e)]=function(t){this.el_[e]=t}})),["pause","load","play"].forEach((function(e){Dc.prototype[e]=function(){return this.el_[e]()}})),Nu.withSourceHandlers(Dc),Dc.nativeSourceHandler={},Dc.nativeSourceHandler.canPlayType=function(e){try{return Dc.TEST_VID.canPlayType(e)}catch(e){return""}},Dc.nativeSourceHandler.canHandleSource=function(e,t){if(e.type)return Dc.nativeSourceHandler.canPlayType(e.type);if(e.src){var i=Su(e.src);return Dc.nativeSourceHandler.canPlayType("video/"+i)}return""},Dc.nativeSourceHandler.handleSource=function(e,t,i){t.setSrc(e.src)},Dc.nativeSourceHandler.dispose=function(){},Dc.registerSourceHandler(Dc.nativeSourceHandler),Nu.registerTech("Html5",Dc);var Oc=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],Nc={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},Rc=["tiny","xsmall","small","medium","large","xlarge","huge"],Mc={};Rc.forEach((function(e){var t="x"===e.charAt(0)?"x-"+e.substring(1):e;Mc[e]="vjs-layout-"+t}));var Uc={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0},Bc=function(e){function t(i,n,r){var a;if(i.id=i.id||n.id||"vjs_video_"+oo(),(n=Ka(t.getTagSettings(i),n)).initChildren=!1,n.createEl=!1,n.evented=!1,n.reportTouchActivity=!1,!n.language)if("function"==typeof i.closest){var s=i.closest("[lang]");s&&s.getAttribute&&(n.language=s.getAttribute("lang"))}else for(var o=i;o&&1===o.nodeType;){if(Ns(o).hasOwnProperty("lang")){n.language=o.getAttribute("lang");break}o=o.parentNode}if((a=e.call(this,null,n,r)||this).boundDocumentFullscreenChange_=function(e){return a.documentFullscreenChange_(e)},a.boundFullWindowOnEscKey_=function(e){return a.fullWindowOnEscKey(e)},a.boundUpdateStyleEl_=function(e){return a.updateStyleEl_(e)},a.boundApplyInitTime_=function(e){return a.applyInitTime_(e)},a.boundUpdateCurrentBreakpoint_=function(e){return a.updateCurrentBreakpoint_(e)},a.boundHandleTechClick_=function(e){return a.handleTechClick_(e)},a.boundHandleTechDoubleClick_=function(e){return a.handleTechDoubleClick_(e)},a.boundHandleTechTouchStart_=function(e){return a.handleTechTouchStart_(e)},a.boundHandleTechTouchMove_=function(e){return a.handleTechTouchMove_(e)},a.boundHandleTechTouchEnd_=function(e){return a.handleTechTouchEnd_(e)},a.boundHandleTechTap_=function(e){return a.handleTechTap_(e)},a.isFullscreen_=!1,a.log=Wa(a.id_),a.fsApi_=Ua,a.isPosterFromTech_=!1,a.queuedCallbacks_=[],a.isReady_=!1,a.hasStarted_=!1,a.userActive_=!1,a.debugEnabled_=!1,a.audioOnlyMode_=!1,a.audioPosterMode_=!1,a.audioOnlyCache_={playerHeight:null,hiddenChildren:[]},!a.options_||!a.options_.techOrder||!a.options_.techOrder.length)throw new Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?");if(a.tag=i,a.tagAttributes=i&&Ns(i),a.language(a.options_.language),n.languages){var u={};Object.getOwnPropertyNames(n.languages).forEach((function(e){u[e.toLowerCase()]=n.languages[e]})),a.languages_=u}else a.languages_=t.prototype.options_.languages;a.resetCache_(),a.poster_=n.poster||"",a.controls_=!!n.controls,i.controls=!1,i.removeAttribute("controls"),a.changingSrc_=!1,a.playCallbacks_=[],a.playTerminatedQueue_=[],i.hasAttribute("autoplay")?a.autoplay(!0):a.autoplay(a.options_.autoplay),n.plugins&&Object.keys(n.plugins).forEach((function(e){if("function"!=typeof a[e])throw new Error('plugin "'+e+'" does not exist')})),a.scrubbing_=!1,a.el_=a.createEl(),Mo(ae(a),{eventBusKey:"el_"}),a.fsApi_.requestFullscreen&&(go(te,a.fsApi_.fullscreenchange,a.boundDocumentFullscreenChange_),a.on(a.fsApi_.fullscreenchange,a.boundDocumentFullscreenChange_)),a.fluid_&&a.on(["playerreset","resize"],a.boundUpdateStyleEl_);var l=qo(a.options_);n.plugins&&Object.keys(n.plugins).forEach((function(e){a[e](n.plugins[e])})),n.debug&&a.debug(!0),a.options_.playerOptions=l,a.middleware_=[],a.playbackRates(n.playbackRates),a.initChildren(),a.isAudio("audio"===i.nodeName.toLowerCase()),a.controls()?a.addClass("vjs-controls-enabled"):a.addClass("vjs-controls-disabled"),a.el_.setAttribute("role","region"),a.isAudio()?a.el_.setAttribute("aria-label",a.localize("Audio Player")):a.el_.setAttribute("aria-label",a.localize("Video Player")),a.isAudio()&&a.addClass("vjs-audio"),a.flexNotSupported_()&&a.addClass("vjs-no-flex"),fs&&a.addClass("vjs-touch-enabled"),vs||a.addClass("vjs-workinghover"),t.players[a.id_]=ae(a);var c=Oa.split(".")[0];return a.addClass("vjs-v"+c),a.userActive(!0),a.reportUserActivity(),a.one("play",(function(e){return a.listenForUserActivity_(e)})),a.on("stageclick",(function(e){return a.handleStageClick_(e)})),a.on("keydown",(function(e){return a.handleKeyDown(e)})),a.on("languagechange",(function(e){return a.handleLanguagechange(e)})),a.breakpoints(a.options_.breakpoints),a.responsive(a.options_.responsive),a.on("ready",(function(){a.audioPosterMode(a.options_.audioPosterMode),a.audioOnlyMode(a.options_.audioOnlyMode)})),a}oe(t,e);var i=t.prototype;return i.dispose=function(){var i=this;this.trigger("dispose"),this.off("dispose"),vo(te,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),vo(te,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),t.players[this.id_]=null,this.tag&&this.tag.player&&(this.tag.player=null),this.el_&&this.el_.player&&(this.el_.player=null),this.tech_&&(this.tech_.dispose(),this.isPosterFromTech_=!1,this.poster_=""),this.playerElIngest_&&(this.playerElIngest_=null),this.tag&&(this.tag=null),Mu[this.id()]=null,Ou.names.forEach((function(e){var t=Ou[e],n=i[t.getterName]();n&&n.off&&n.off()})),e.prototype.dispose.call(this,{restoreEl:this.options_.restoreEl})},i.createEl=function(){var t,i=this.tag,n=this.playerElIngest_=i.parentNode&&i.parentNode.hasAttribute&&i.parentNode.hasAttribute("data-vjs-player"),r="video-js"===this.tag.tagName.toLowerCase();n?t=this.el_=i.parentNode:r||(t=this.el_=e.prototype.createEl.call(this,"div"));var a=Ns(i);if(r){for(t=this.el_=i,i=this.tag=te.createElement("video");t.children.length;)i.appendChild(t.firstChild);As(t,"video-js")||Ps(t,"video-js"),t.appendChild(i),n=this.playerElIngest_=t,Object.keys(t).forEach((function(e){try{i[e]=t[e]}catch(e){}}))}if(i.setAttribute("tabindex","-1"),a.tabindex="-1",(ds||ls&&ps)&&(i.setAttribute("role","application"),a.role="application"),i.removeAttribute("width"),i.removeAttribute("height"),"width"in a&&delete a.width,"height"in a&&delete a.height,Object.getOwnPropertyNames(a).forEach((function(e){r&&"class"===e||t.setAttribute(e,a[e]),r&&i.setAttribute(e,a[e])})),i.playerId=i.id,i.id+="_html5_api",i.className="vjs-tech",i.player=t.player=this,this.addClass("vjs-paused"),!0!==d.VIDEOJS_NO_DYNAMIC_STYLE){this.styleEl_=ro("vjs-styles-dimensions");var s=Qs(".vjs-styles-defaults"),o=Qs("head");o.insertBefore(this.styleEl_,s?s.nextSibling:o.firstChild)}this.fill_=!1,this.fluid_=!1,this.width(this.options_.width),this.height(this.options_.height),this.fill(this.options_.fill),this.fluid(this.options_.fluid),this.aspectRatio(this.options_.aspectRatio),this.crossOrigin(this.options_.crossOrigin||this.options_.crossorigin);for(var u=i.getElementsByTagName("a"),l=0;l<u.length;l++){var c=u.item(l);Ps(c,"vjs-hidden"),c.setAttribute("hidden","hidden")}return i.initNetworkState_=i.networkState,i.parentNode&&!n&&i.parentNode.insertBefore(t,i),Is(i,t),this.children_.unshift(i),this.el_.setAttribute("lang",this.language_),this.el_.setAttribute("translate","no"),this.el_=t,t},i.crossOrigin=function(e){if(!e)return this.techGet_("crossOrigin");"anonymous"===e||"use-credentials"===e?this.techCall_("setCrossOrigin",e):Ha.warn('crossOrigin must be "anonymous" or "use-credentials", given "'+e+'"')},i.width=function(e){return this.dimension("width",e)},i.height=function(e){return this.dimension("height",e)},i.dimension=function(e,t){var i=e+"_";if(void 0===t)return this[i]||0;if(""===t||"auto"===t)return this[i]=void 0,void this.updateStyleEl_();var n=parseFloat(t);isNaN(n)?Ha.error('Improper value "'+t+'" supplied for for '+e):(this[i]=n,this.updateStyleEl_())},i.fluid=function(e){var t,i,n=this;if(void 0===e)return!!this.fluid_;this.fluid_=!!e,Io(this)&&this.off(["playerreset","resize"],this.boundUpdateStyleEl_),e?(this.addClass("vjs-fluid"),this.fill(!1),i=function(){n.on(["playerreset","resize"],n.boundUpdateStyleEl_)},Io(t=this)?i():(t.eventedCallbacks||(t.eventedCallbacks=[]),t.eventedCallbacks.push(i))):this.removeClass("vjs-fluid"),this.updateStyleEl_()},i.fill=function(e){if(void 0===e)return!!this.fill_;this.fill_=!!e,e?(this.addClass("vjs-fill"),this.fluid(!1)):this.removeClass("vjs-fill")},i.aspectRatio=function(e){if(void 0===e)return this.aspectRatio_;if(!/^\d+\:\d+$/.test(e))throw new Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.");this.aspectRatio_=e,this.fluid(!0),this.updateStyleEl_()},i.updateStyleEl_=function(){if(!0!==d.VIDEOJS_NO_DYNAMIC_STYLE){var e,t,i,n=(void 0!==this.aspectRatio_&&"auto"!==this.aspectRatio_?this.aspectRatio_:this.videoWidth()>0?this.videoWidth()+":"+this.videoHeight():"16:9").split(":"),r=n[1]/n[0];e=void 0!==this.width_?this.width_:void 0!==this.height_?this.height_/r:this.videoWidth()||300,t=void 0!==this.height_?this.height_:e*r,i=/^[^a-zA-Z]/.test(this.id())?"dimensions-"+this.id():this.id()+"-dimensions",this.addClass(i),ao(this.styleEl_,"\n ."+i+" {\n width: "+e+"px;\n height: "+t+"px;\n }\n\n ."+i+".vjs-fluid:not(.vjs-audio-only-mode) {\n padding-top: "+100*r+"%;\n }\n ")}else{var a="number"==typeof this.width_?this.width_:this.options_.width,s="number"==typeof this.height_?this.height_:this.options_.height,o=this.tech_&&this.tech_.el();o&&(a>=0&&(o.width=a),s>=0&&(o.height=s))}},i.loadTech_=function(e,t){var i=this;this.tech_&&this.unloadTech_();var n=jo(e),r=e.charAt(0).toLowerCase()+e.slice(1);"Html5"!==n&&this.tag&&(Nu.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=n,this.isReady_=!1;var a=this.autoplay();("string"==typeof this.autoplay()||!0===this.autoplay()&&this.options_.normalizeAutoplay)&&(a=!1);var s={source:t,autoplay:a,nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:this.id()+"_"+r+"_api",playsinline:this.options_.playsinline,preload:this.options_.preload,loop:this.options_.loop,disablePictureInPicture:this.options_.disablePictureInPicture,muted:this.options_.muted,poster:this.poster(),language:this.language(),playerElIngest:this.playerElIngest_||!1,"vtt.js":this.options_["vtt.js"],canOverridePoster:!!this.options_.techCanOverridePoster,enableSourceset:this.options_.enableSourceset,Promise:this.options_.Promise};Ou.names.forEach((function(e){var t=Ou[e];s[t.getterName]=i[t.privateName]})),Ka(s,this.options_[n]),Ka(s,this.options_[r]),Ka(s,this.options_[e.toLowerCase()]),this.tag&&(s.tag=this.tag),t&&t.src===this.cache_.src&&this.cache_.currentTime>0&&(s.startTime=this.cache_.currentTime);var o=Nu.getTech(e);if(!o)throw new Error("No Tech named '"+n+"' exists! '"+n+"' should be registered using videojs.registerTech()'");this.tech_=new o(s),this.tech_.ready(wo(this,this.handleTechReady_),!0),nu(this.textTracksJson_||[],this.tech_),Oc.forEach((function(e){i.on(i.tech_,e,(function(t){return i["handleTech"+jo(e)+"_"](t)}))})),Object.keys(Nc).forEach((function(e){i.on(i.tech_,e,(function(t){0===i.tech_.playbackRate()&&i.tech_.seeking()?i.queuedCallbacks_.push({callback:i["handleTech"+Nc[e]+"_"].bind(i),event:t}):i["handleTech"+Nc[e]+"_"](t)}))})),this.on(this.tech_,"loadstart",(function(e){return i.handleTechLoadStart_(e)})),this.on(this.tech_,"sourceset",(function(e){return i.handleTechSourceset_(e)})),this.on(this.tech_,"waiting",(function(e){return i.handleTechWaiting_(e)})),this.on(this.tech_,"ended",(function(e){return i.handleTechEnded_(e)})),this.on(this.tech_,"seeking",(function(e){return i.handleTechSeeking_(e)})),this.on(this.tech_,"play",(function(e){return i.handleTechPlay_(e)})),this.on(this.tech_,"firstplay",(function(e){return i.handleTechFirstPlay_(e)})),this.on(this.tech_,"pause",(function(e){return i.handleTechPause_(e)})),this.on(this.tech_,"durationchange",(function(e){return i.handleTechDurationChange_(e)})),this.on(this.tech_,"fullscreenchange",(function(e,t){return i.handleTechFullscreenChange_(e,t)})),this.on(this.tech_,"fullscreenerror",(function(e,t){return i.handleTechFullscreenError_(e,t)})),this.on(this.tech_,"enterpictureinpicture",(function(e){return i.handleTechEnterPictureInPicture_(e)})),this.on(this.tech_,"leavepictureinpicture",(function(e){return i.handleTechLeavePictureInPicture_(e)})),this.on(this.tech_,"error",(function(e){return i.handleTechError_(e)})),this.on(this.tech_,"posterchange",(function(e){return i.handleTechPosterChange_(e)})),this.on(this.tech_,"textdata",(function(e){return i.handleTechTextData_(e)})),this.on(this.tech_,"ratechange",(function(e){return i.handleTechRateChange_(e)})),this.on(this.tech_,"loadedmetadata",this.boundUpdateStyleEl_),this.usingNativeControls(this.techGet_("controls")),this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_(),this.tech_.el().parentNode===this.el()||"Html5"===n&&this.tag||Is(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)},i.unloadTech_=function(){var e=this;Ou.names.forEach((function(t){var i=Ou[t];e[i.privateName]=e[i.getterName]()})),this.textTracksJson_=iu(this.tech_),this.isReady_=!1,this.tech_.dispose(),this.tech_=!1,this.isPosterFromTech_&&(this.poster_="",this.trigger("posterchange")),this.isPosterFromTech_=!1},i.tech=function(e){return void 0===e&&Ha.warn("Using the tech directly can be dangerous. I hope you know what you're doing.\nSee https://github.com/videojs/video.js/issues/2617 for more info.\n"),this.tech_},i.addTechControlsListeners_=function(){this.removeTechControlsListeners_(),this.on(this.tech_,"click",this.boundHandleTechClick_),this.on(this.tech_,"dblclick",this.boundHandleTechDoubleClick_),this.on(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.on(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.on(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.on(this.tech_,"tap",this.boundHandleTechTap_)},i.removeTechControlsListeners_=function(){this.off(this.tech_,"tap",this.boundHandleTechTap_),this.off(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.off(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.off(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.off(this.tech_,"click",this.boundHandleTechClick_),this.off(this.tech_,"dblclick",this.boundHandleTechDoubleClick_)},i.handleTechReady_=function(){this.triggerReady(),this.cache_.volume&&this.techCall_("setVolume",this.cache_.volume),this.handleTechPosterChange_(),this.handleTechDurationChange_()},i.handleTechLoadStart_=function(){this.removeClass("vjs-ended"),this.removeClass("vjs-seeking"),this.error(null),this.handleTechDurationChange_(),this.paused()?(this.hasStarted(!1),this.trigger("loadstart")):(this.trigger("loadstart"),this.trigger("firstplay")),this.manualAutoplay_(!0===this.autoplay()&&this.options_.normalizeAutoplay?"play":this.autoplay())},i.manualAutoplay_=function(e){var t=this;if(this.tech_&&"string"==typeof e){var i,n=function(){var e=t.muted();t.muted(!0);var i=function(){t.muted(e)};t.playTerminatedQueue_.push(i);var n=t.play();if(Zo(n))return n.catch((function(e){throw i(),new Error("Rejection at manualAutoplay. Restoring muted value. "+(e||""))}))};if("any"!==e||this.muted()?i="muted"!==e||this.muted()?this.play():n():Zo(i=this.play())&&(i=i.catch(n)),Zo(i))return i.then((function(){t.trigger({type:"autoplay-success",autoplay:e})})).catch((function(){t.trigger({type:"autoplay-failure",autoplay:e})}))}},i.updateSourceCaches_=function(e){void 0===e&&(e="");var t=e,i="";"string"!=typeof t&&(t=e.src,i=e.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],t&&!i&&(i=function(e,t){if(!t)return"";if(e.cache_.source.src===t&&e.cache_.source.type)return e.cache_.source.type;var i=e.cache_.sources.filter((function(e){return e.src===t}));if(i.length)return i[0].type;for(var n=e.$$("source"),r=0;r<n.length;r++){var a=n[r];if(a.type&&a.src&&a.src===t)return a.type}return zu(t)}(this,t)),this.cache_.source=qo({},e,{src:t,type:i});for(var n=this.cache_.sources.filter((function(e){return e.src&&e.src===t})),r=[],a=this.$$("source"),s=[],o=0;o<a.length;o++){var u=Ns(a[o]);r.push(u),u.src&&u.src===t&&s.push(u.src)}s.length&&!n.length?this.cache_.sources=r:n.length||(this.cache_.sources=[this.cache_.source]),this.cache_.src=t},i.handleTechSourceset_=function(e){var t=this;if(!this.changingSrc_){var i=function(e){return t.updateSourceCaches_(e)},n=this.currentSource().src,r=e.src;n&&!/^blob:/.test(n)&&/^blob:/.test(r)&&(!this.lastSource_||this.lastSource_.tech!==r&&this.lastSource_.player!==n)&&(i=function(){}),i(r),e.src||this.tech_.any(["sourceset","loadstart"],(function(e){if("sourceset"!==e.type){var i=t.techGet("currentSrc");t.lastSource_.tech=i,t.updateSourceCaches_(i)}}))}this.lastSource_={player:this.currentSource().src,tech:e.src},this.trigger({src:e.src,type:"sourceset"})},i.hasStarted=function(e){if(void 0===e)return this.hasStarted_;e!==this.hasStarted_&&(this.hasStarted_=e,this.hasStarted_?(this.addClass("vjs-has-started"),this.trigger("firstplay")):this.removeClass("vjs-has-started"))},i.handleTechPlay_=function(){this.removeClass("vjs-ended"),this.removeClass("vjs-paused"),this.addClass("vjs-playing"),this.hasStarted(!0),this.trigger("play")},i.handleTechRateChange_=function(){this.tech_.playbackRate()>0&&0===this.cache_.lastPlaybackRate&&(this.queuedCallbacks_.forEach((function(e){return e.callback(e.event)})),this.queuedCallbacks_=[]),this.cache_.lastPlaybackRate=this.tech_.playbackRate(),this.trigger("ratechange")},i.handleTechWaiting_=function(){var e=this;this.addClass("vjs-waiting"),this.trigger("waiting");var t=this.currentTime();this.on("timeupdate",(function i(){t!==e.currentTime()&&(e.removeClass("vjs-waiting"),e.off("timeupdate",i))}))},i.handleTechCanPlay_=function(){this.removeClass("vjs-waiting"),this.trigger("canplay")},i.handleTechCanPlayThrough_=function(){this.removeClass("vjs-waiting"),this.trigger("canplaythrough")},i.handleTechPlaying_=function(){this.removeClass("vjs-waiting"),this.trigger("playing")},i.handleTechSeeking_=function(){this.addClass("vjs-seeking"),this.trigger("seeking")},i.handleTechSeeked_=function(){this.removeClass("vjs-seeking"),this.removeClass("vjs-ended"),this.trigger("seeked")},i.handleTechFirstPlay_=function(){this.options_.starttime&&(Ha.warn("Passing the `starttime` option to the player will be deprecated in 6.0"),this.currentTime(this.options_.starttime)),this.addClass("vjs-has-started"),this.trigger("firstplay")},i.handleTechPause_=function(){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.trigger("pause")},i.handleTechEnded_=function(){this.addClass("vjs-ended"),this.removeClass("vjs-waiting"),this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause(),this.trigger("ended")},i.handleTechDurationChange_=function(){this.duration(this.techGet_("duration"))},i.handleTechClick_=function(e){this.controls_&&(void 0!==this.options_&&void 0!==this.options_.userActions&&void 0!==this.options_.userActions.click&&!1===this.options_.userActions.click||(void 0!==this.options_&&void 0!==this.options_.userActions&&"function"==typeof this.options_.userActions.click?this.options_.userActions.click.call(this,e):this.paused()?eu(this.play()):this.pause()))},i.handleTechDoubleClick_=function(e){this.controls_&&(Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),(function(t){return t.contains(e.target)}))||void 0!==this.options_&&void 0!==this.options_.userActions&&void 0!==this.options_.userActions.doubleClick&&!1===this.options_.userActions.doubleClick||(void 0!==this.options_&&void 0!==this.options_.userActions&&"function"==typeof this.options_.userActions.doubleClick?this.options_.userActions.doubleClick.call(this,e):this.isFullscreen()?this.exitFullscreen():this.requestFullscreen()))},i.handleTechTap_=function(){this.userActive(!this.userActive())},i.handleTechTouchStart_=function(){this.userWasActive=this.userActive()},i.handleTechTouchMove_=function(){this.userWasActive&&this.reportUserActivity()},i.handleTechTouchEnd_=function(e){e.cancelable&&e.preventDefault()},i.handleStageClick_=function(){this.reportUserActivity()},i.toggleFullscreenClass_=function(){this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen")},i.documentFullscreenChange_=function(e){var t=e.target.player;if(!t||t===this){var i=this.el(),n=te[this.fsApi_.fullscreenElement]===i;!n&&i.matches?n=i.matches(":"+this.fsApi_.fullscreen):!n&&i.msMatchesSelector&&(n=i.msMatchesSelector(":"+this.fsApi_.fullscreen)),this.isFullscreen(n)}},i.handleTechFullscreenChange_=function(e,t){var i=this;t&&(t.nativeIOSFullscreen&&(this.addClass("vjs-ios-native-fs"),this.tech_.one("webkitendfullscreen",(function(){i.removeClass("vjs-ios-native-fs")}))),this.isFullscreen(t.isFullscreen))},i.handleTechFullscreenError_=function(e,t){this.trigger("fullscreenerror",t)},i.togglePictureInPictureClass_=function(){this.isInPictureInPicture()?this.addClass("vjs-picture-in-picture"):this.removeClass("vjs-picture-in-picture")},i.handleTechEnterPictureInPicture_=function(e){this.isInPictureInPicture(!0)},i.handleTechLeavePictureInPicture_=function(e){this.isInPictureInPicture(!1)},i.handleTechError_=function(){var e=this.tech_.error();this.error(e)},i.handleTechTextData_=function(){var e=null;arguments.length>1&&(e=arguments[1]),this.trigger("textdata",e)},i.getCache=function(){return this.cache_},i.resetCache_=function(){this.cache_={currentTime:0,initTime:0,inactivityTimeout:this.options_.inactivityTimeout,duration:NaN,lastVolume:1,lastPlaybackRate:this.defaultPlaybackRate(),media:null,src:"",source:{},sources:[],playbackRates:[],volume:1}},i.techCall_=function(e,t){this.ready((function(){if(e in qu)return function(e,t,i,n){return t[i](e.reduce(Hu(i),n))}(this.middleware_,this.tech_,e,t);if(e in Vu)return Fu(this.middleware_,this.tech_,e,t);try{this.tech_&&this.tech_[e](t)}catch(e){throw Ha(e),e}}),!0)},i.techGet_=function(e){if(this.tech_&&this.tech_.isReady_){if(e in ju)return function(e,t,i){return e.reduceRight(Hu(i),t[i]())}(this.middleware_,this.tech_,e);if(e in Vu)return Fu(this.middleware_,this.tech_,e);try{return this.tech_[e]()}catch(t){if(void 0===this.tech_[e])throw Ha("Video.js: "+e+" method not defined for "+this.techName_+" playback technology.",t),t;if("TypeError"===t.name)throw Ha("Video.js: "+e+" unavailable on "+this.techName_+" playback technology element.",t),this.tech_.isReady_=!1,t;throw Ha(t),t}}},i.play=function(){var e=this,t=this.options_.Promise||d.Promise;return t?new t((function(t){e.play_(t)})):this.play_()},i.play_=function(e){var t=this;void 0===e&&(e=eu),this.playCallbacks_.push(e);var i=Boolean(!this.changingSrc_&&(this.src()||this.currentSrc()));if(this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),!this.isReady_||!i)return this.waitToPlay_=function(e){t.play_()},this.one(["ready","loadstart"],this.waitToPlay_),void(i||!ys&&!vs||this.load());var n=this.techGet_("play");null===n?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(n)},i.runPlayTerminatedQueue_=function(){var e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],e.forEach((function(e){e()}))},i.runPlayCallbacks_=function(e){var t=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],t.forEach((function(t){t(e)}))},i.pause=function(){this.techCall_("pause")},i.paused=function(){return!1!==this.techGet_("paused")},i.played=function(){return this.techGet_("played")||Yo(0,0)},i.scrubbing=function(e){if(void 0===e)return this.scrubbing_;this.scrubbing_=!!e,this.techCall_("setScrubbing",this.scrubbing_),e?this.addClass("vjs-scrubbing"):this.removeClass("vjs-scrubbing")},i.currentTime=function(e){return void 0!==e?(e<0&&(e=0),this.isReady_&&!this.changingSrc_&&this.tech_&&this.tech_.isReady_?(this.techCall_("setCurrentTime",e),void(this.cache_.initTime=0)):(this.cache_.initTime=e,this.off("canplay",this.boundApplyInitTime_),void this.one("canplay",this.boundApplyInitTime_))):(this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime)},i.applyInitTime_=function(){this.currentTime(this.cache_.initTime)},i.duration=function(e){if(void 0===e)return void 0!==this.cache_.duration?this.cache_.duration:NaN;(e=parseFloat(e))<0&&(e=1/0),e!==this.cache_.duration&&(this.cache_.duration=e,e===1/0?this.addClass("vjs-live"):this.removeClass("vjs-live"),isNaN(e)||this.trigger("durationchange"))},i.remainingTime=function(){return this.duration()-this.currentTime()},i.remainingTimeDisplay=function(){return Math.floor(this.duration())-Math.floor(this.currentTime())},i.buffered=function(){var e=this.techGet_("buffered");return e&&e.length||(e=Yo(0,0)),e},i.bufferedPercent=function(){return Qo(this.buffered(),this.duration())},i.bufferedEnd=function(){var e=this.buffered(),t=this.duration(),i=e.end(e.length-1);return i>t&&(i=t),i},i.volume=function(e){var t;return void 0!==e?(t=Math.max(0,Math.min(1,parseFloat(e))),this.cache_.volume=t,this.techCall_("setVolume",t),void(t>0&&this.lastVolume_(t))):(t=parseFloat(this.techGet_("volume")),isNaN(t)?1:t)},i.muted=function(e){if(void 0===e)return this.techGet_("muted")||!1;this.techCall_("setMuted",e)},i.defaultMuted=function(e){return void 0!==e?this.techCall_("setDefaultMuted",e):this.techGet_("defaultMuted")||!1},i.lastVolume_=function(e){if(void 0===e||0===e)return this.cache_.lastVolume;this.cache_.lastVolume=e},i.supportsFullScreen=function(){return this.techGet_("supportsFullScreen")||!1},i.isFullscreen=function(e){if(void 0!==e){var t=this.isFullscreen_;return this.isFullscreen_=Boolean(e),this.isFullscreen_!==t&&this.fsApi_.prefixed&&this.trigger("fullscreenchange"),void this.toggleFullscreenClass_()}return this.isFullscreen_},i.requestFullscreen=function(e){var t=this.options_.Promise||d.Promise;if(t){var i=this;return new t((function(t,n){function r(){i.off("fullscreenerror",s),i.off("fullscreenchange",a)}function a(){r(),t()}function s(e,t){r(),n(t)}i.one("fullscreenchange",a),i.one("fullscreenerror",s);var o=i.requestFullscreenHelper_(e);o&&(o.then(r,r),o.then(t,n))}))}return this.requestFullscreenHelper_()},i.requestFullscreenHelper_=function(e){var t,i=this;if(this.fsApi_.prefixed||(t=this.options_.fullscreen&&this.options_.fullscreen.options||{},void 0!==e&&(t=e)),this.fsApi_.requestFullscreen){var n=this.el_[this.fsApi_.requestFullscreen](t);return n&&n.then((function(){return i.isFullscreen(!0)}),(function(){return i.isFullscreen(!1)})),n}this.tech_.supportsFullScreen()&&!0==!this.options_.preferFullWindow?this.techCall_("enterFullScreen"):this.enterFullWindow()},i.exitFullscreen=function(){var e=this.options_.Promise||d.Promise;if(e){var t=this;return new e((function(e,i){function n(){t.off("fullscreenerror",a),t.off("fullscreenchange",r)}function r(){n(),e()}function a(e,t){n(),i(t)}t.one("fullscreenchange",r),t.one("fullscreenerror",a);var s=t.exitFullscreenHelper_();s&&(s.then(n,n),s.then(e,i))}))}return this.exitFullscreenHelper_()},i.exitFullscreenHelper_=function(){var e=this;if(this.fsApi_.requestFullscreen){var t=te[this.fsApi_.exitFullscreen]();return t&&eu(t.then((function(){return e.isFullscreen(!1)}))),t}this.tech_.supportsFullScreen()&&!0==!this.options_.preferFullWindow?this.techCall_("exitFullScreen"):this.exitFullWindow()},i.enterFullWindow=function(){this.isFullscreen(!0),this.isFullWindow=!0,this.docOrigOverflow=te.documentElement.style.overflow,go(te,"keydown",this.boundFullWindowOnEscKey_),te.documentElement.style.overflow="hidden",Ps(te.body,"vjs-full-window"),this.trigger("enterFullWindow")},i.fullWindowOnEscKey=function(e){re.isEventKey(e,"Esc")&&!0===this.isFullscreen()&&(this.isFullWindow?this.exitFullWindow():this.exitFullscreen())},i.exitFullWindow=function(){this.isFullscreen(!1),this.isFullWindow=!1,vo(te,"keydown",this.boundFullWindowOnEscKey_),te.documentElement.style.overflow=this.docOrigOverflow,Ls(te.body,"vjs-full-window"),this.trigger("exitFullWindow")},i.disablePictureInPicture=function(e){if(void 0===e)return this.techGet_("disablePictureInPicture");this.techCall_("setDisablePictureInPicture",e),this.options_.disablePictureInPicture=e,this.trigger("disablepictureinpicturechanged")},i.isInPictureInPicture=function(e){return void 0!==e?(this.isInPictureInPicture_=!!e,void this.togglePictureInPictureClass_()):!!this.isInPictureInPicture_},i.requestPictureInPicture=function(){if("pictureInPictureEnabled"in te&&!1===this.disablePictureInPicture())return this.techGet_("requestPictureInPicture")},i.exitPictureInPicture=function(){if("pictureInPictureEnabled"in te)return te.exitPictureInPicture()},i.handleKeyDown=function(e){var t=this.options_.userActions;if(t&&t.hotkeys){(function(e){var t=e.tagName.toLowerCase();if(e.isContentEditable)return!0;if("input"===t)return-1===["button","checkbox","hidden","radio","reset","submit"].indexOf(e.type);return-1!==["textarea"].indexOf(t)})(this.el_.ownerDocument.activeElement)||("function"==typeof t.hotkeys?t.hotkeys.call(this,e):this.handleHotkeys(e))}},i.handleHotkeys=function(e){var t=this.options_.userActions?this.options_.userActions.hotkeys:{},i=t.fullscreenKey,n=void 0===i?function(e){return re.isEventKey(e,"f")}:i,r=t.muteKey,a=void 0===r?function(e){return re.isEventKey(e,"m")}:r,s=t.playPauseKey,o=void 0===s?function(e){return re.isEventKey(e,"k")||re.isEventKey(e,"Space")}:s;if(n.call(this,e)){e.preventDefault(),e.stopPropagation();var u=zo.getComponent("FullscreenToggle");!1!==te[this.fsApi_.fullscreenEnabled]&&u.prototype.handleClick.call(this,e)}else if(a.call(this,e)){e.preventDefault(),e.stopPropagation(),zo.getComponent("MuteToggle").prototype.handleClick.call(this,e)}else if(o.call(this,e)){e.preventDefault(),e.stopPropagation(),zo.getComponent("PlayToggle").prototype.handleClick.call(this,e)}},i.canPlayType=function(e){for(var t,i=0,n=this.options_.techOrder;i<n.length;i++){var r=n[i],a=Nu.getTech(r);if(a||(a=zo.getComponent(r)),a){if(a.isSupported()&&(t=a.canPlayType(e)))return t}else Ha.error('The "'+r+'" tech is undefined. Skipped browser support check for that tech.')}return""},i.selectSource=function(e){var t,i,n=this,r=this.options_.techOrder.map((function(e){return[e,Nu.getTech(e)]})).filter((function(e){var t=e[0],i=e[1];return i?i.isSupported():(Ha.error('The "'+t+'" tech is undefined. Skipped browser support check for that tech.'),!1)})),a=function(e,t,i){var n;return e.some((function(e){return t.some((function(t){if(n=i(e,t))return!0}))})),n},s=function(e,t){var i=e[0];if(e[1].canPlaySource(t,n.options_[i.toLowerCase()]))return{source:t,tech:i}};return t=this.options_.sourceOrder?a(e,r,(i=s,function(e,t){return i(t,e)})):a(r,e,s),t||!1},i.handleSrc_=function(e,t){var i=this;if(void 0===e)return this.cache_.src||"";this.resetRetryOnError_&&this.resetRetryOnError_();var n=Xu(e);if(n.length){if(this.changingSrc_=!0,t||(this.cache_.sources=n),this.updateSourceCaches_(n[0]),Bu(this,n[0],(function(e,r){var a,s;if(i.middleware_=r,t||(i.cache_.sources=n),i.updateSourceCaches_(e),i.src_(e))return n.length>1?i.handleSrc_(n.slice(1)):(i.changingSrc_=!1,i.setTimeout((function(){this.error({code:4,message:this.options_.notSupportedMessage})}),0),void i.triggerReady());a=r,s=i.tech_,a.forEach((function(e){return e.setTech&&e.setTech(s)}))})),this.options_.retryOnError&&n.length>1){var r=function(){i.error(null),i.handleSrc_(n.slice(1),!0)},a=function(){i.off("error",r)};this.one("error",r),this.one("playing",a),this.resetRetryOnError_=function(){i.off("error",r),i.off("playing",a)}}}else this.setTimeout((function(){this.error({code:4,message:this.options_.notSupportedMessage})}),0)},i.src=function(e){return this.handleSrc_(e,!1)},i.src_=function(e){var t,i,n=this,r=this.selectSource([e]);return!r||(t=r.tech,i=this.techName_,jo(t)!==jo(i)?(this.changingSrc_=!0,this.loadTech_(r.tech,r.source),this.tech_.ready((function(){n.changingSrc_=!1})),!1):(this.ready((function(){this.tech_.constructor.prototype.hasOwnProperty("setSource")?this.techCall_("setSource",e):this.techCall_("src",e.src),this.changingSrc_=!1}),!0),!1))},i.load=function(){this.techCall_("load")},i.reset=function(){var e=this,t=this.options_.Promise||d.Promise;this.paused()||!t?this.doReset_():eu(this.play().then((function(){return e.doReset_()})))},i.doReset_=function(){this.tech_&&this.tech_.clearTracks("text"),this.resetCache_(),this.poster(""),this.loadTech_(this.options_.techOrder[0],null),this.techCall_("reset"),this.resetControlBarUI_(),Io(this)&&this.trigger("playerreset")},i.resetControlBarUI_=function(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()},i.resetProgressBar_=function(){this.currentTime(0);var e=this.controlBar||{},t=e.durationDisplay,i=e.remainingTimeDisplay;t&&t.updateContent(),i&&i.updateContent()},i.resetPlaybackRate_=function(){this.playbackRate(this.defaultPlaybackRate()),this.handleTechRateChange_()},i.resetVolumeBar_=function(){this.volume(1),this.trigger("volumechange")},i.currentSources=function(){var e=this.currentSource(),t=[];return 0!==Object.keys(e).length&&t.push(e),this.cache_.sources||t},i.currentSource=function(){return this.cache_.source||{}},i.currentSrc=function(){return this.currentSource()&&this.currentSource().src||""},i.currentType=function(){return this.currentSource()&&this.currentSource().type||""},i.preload=function(e){return void 0!==e?(this.techCall_("setPreload",e),void(this.options_.preload=e)):this.techGet_("preload")},i.autoplay=function(e){if(void 0===e)return this.options_.autoplay||!1;var t;"string"==typeof e&&/(any|play|muted)/.test(e)||!0===e&&this.options_.normalizeAutoplay?(this.options_.autoplay=e,this.manualAutoplay_("string"==typeof e?e:"play"),t=!1):this.options_.autoplay=!!e,t=void 0===t?this.options_.autoplay:t,this.tech_&&this.techCall_("setAutoplay",t)},i.playsinline=function(e){return void 0!==e?(this.techCall_("setPlaysinline",e),this.options_.playsinline=e,this):this.techGet_("playsinline")},i.loop=function(e){return void 0!==e?(this.techCall_("setLoop",e),void(this.options_.loop=e)):this.techGet_("loop")},i.poster=function(e){if(void 0===e)return this.poster_;e||(e=""),e!==this.poster_&&(this.poster_=e,this.techCall_("setPoster",e),this.isPosterFromTech_=!1,this.trigger("posterchange"))},i.handleTechPosterChange_=function(){if((!this.poster_||this.options_.techCanOverridePoster)&&this.tech_&&this.tech_.poster){var e=this.tech_.poster()||"";e!==this.poster_&&(this.poster_=e,this.isPosterFromTech_=!0,this.trigger("posterchange"))}},i.controls=function(e){if(void 0===e)return!!this.controls_;e=!!e,this.controls_!==e&&(this.controls_=e,this.usingNativeControls()&&this.techCall_("setControls",e),this.controls_?(this.removeClass("vjs-controls-disabled"),this.addClass("vjs-controls-enabled"),this.trigger("controlsenabled"),this.usingNativeControls()||this.addTechControlsListeners_()):(this.removeClass("vjs-controls-enabled"),this.addClass("vjs-controls-disabled"),this.trigger("controlsdisabled"),this.usingNativeControls()||this.removeTechControlsListeners_()))},i.usingNativeControls=function(e){if(void 0===e)return!!this.usingNativeControls_;e=!!e,this.usingNativeControls_!==e&&(this.usingNativeControls_=e,this.usingNativeControls_?(this.addClass("vjs-using-native-controls"),this.trigger("usingnativecontrols")):(this.removeClass("vjs-using-native-controls"),this.trigger("usingcustomcontrols")))},i.error=function(e){var t=this;if(void 0===e)return this.error_||null;if(Ra("beforeerror").forEach((function(i){var n=i(t,e);Ya(n)&&!Array.isArray(n)||"string"==typeof n||"number"==typeof n||null===n?e=n:t.log.error("please return a value that MediaError expects in beforeerror hooks")})),this.options_.suppressNotSupportedError&&e&&4===e.code){var i=function(){this.error(e)};return this.options_.suppressNotSupportedError=!1,this.any(["click","touchstart"],i),void this.one("loadstart",(function(){this.off(["click","touchstart"],i)}))}if(null===e)return this.error_=e,this.removeClass("vjs-error"),void(this.errorDisplay&&this.errorDisplay.close());this.error_=new $o(e),this.addClass("vjs-error"),Ha.error("(CODE:"+this.error_.code+" "+$o.errorTypes[this.error_.code]+")",this.error_.message,this.error_),this.trigger("error"),Ra("error").forEach((function(e){return e(t,t.error_)}))},i.reportUserActivity=function(e){this.userActivity_=!0},i.userActive=function(e){if(void 0===e)return this.userActive_;if((e=!!e)!==this.userActive_){if(this.userActive_=e,this.userActive_)return this.userActivity_=!0,this.removeClass("vjs-user-inactive"),this.addClass("vjs-user-active"),void this.trigger("useractive");this.tech_&&this.tech_.one("mousemove",(function(e){e.stopPropagation(),e.preventDefault()})),this.userActivity_=!1,this.removeClass("vjs-user-active"),this.addClass("vjs-user-inactive"),this.trigger("userinactive")}},i.listenForUserActivity_=function(){var e,t,i,n=wo(this,this.reportUserActivity),r=function(t){n(),this.clearInterval(e)};this.on("mousedown",(function(){n(),this.clearInterval(e),e=this.setInterval(n,250)})),this.on("mousemove",(function(e){e.screenX===t&&e.screenY===i||(t=e.screenX,i=e.screenY,n())})),this.on("mouseup",r),this.on("mouseleave",r);var a,s=this.getChild("controlBar");!s||vs||rs||(s.on("mouseenter",(function(e){0!==this.player().options_.inactivityTimeout&&(this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout),this.player().options_.inactivityTimeout=0})),s.on("mouseleave",(function(e){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout}))),this.on("keydown",n),this.on("keyup",n),this.setInterval((function(){if(this.userActivity_){this.userActivity_=!1,this.userActive(!0),this.clearTimeout(a);var e=this.options_.inactivityTimeout;e<=0||(a=this.setTimeout((function(){this.userActivity_||this.userActive(!1)}),e))}}),250)},i.playbackRate=function(e){if(void 0===e)return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1;this.techCall_("setPlaybackRate",e)},i.defaultPlaybackRate=function(e){return void 0!==e?this.techCall_("setDefaultPlaybackRate",e):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1},i.isAudio=function(e){if(void 0===e)return!!this.isAudio_;this.isAudio_=!!e},i.enableAudioOnlyUI_=function(){var e=this;this.addClass("vjs-audio-only-mode");var t=this.children(),i=this.getChild("ControlBar"),n=i&&i.currentHeight();t.forEach((function(t){t!==i&&t.el_&&!t.hasClass("vjs-hidden")&&(t.hide(),e.audioOnlyCache_.hiddenChildren.push(t))})),this.audioOnlyCache_.playerHeight=this.currentHeight(),this.height(n),this.trigger("audioonlymodechange")},i.disableAudioOnlyUI_=function(){this.removeClass("vjs-audio-only-mode"),this.audioOnlyCache_.hiddenChildren.forEach((function(e){return e.show()})),this.height(this.audioOnlyCache_.playerHeight),this.trigger("audioonlymodechange")},i.audioOnlyMode=function(e){var t=this;if("boolean"!=typeof e||e===this.audioOnlyMode_)return this.audioOnlyMode_;this.audioOnlyMode_=e;var i=this.options_.Promise||d.Promise;if(i){if(e){var n=[];return this.isInPictureInPicture()&&n.push(this.exitPictureInPicture()),this.isFullscreen()&&n.push(this.exitFullscreen()),this.audioPosterMode()&&n.push(this.audioPosterMode(!1)),i.all(n).then((function(){return t.enableAudioOnlyUI_()}))}return i.resolve().then((function(){return t.disableAudioOnlyUI_()}))}e?(this.isInPictureInPicture()&&this.exitPictureInPicture(),this.isFullscreen()&&this.exitFullscreen(),this.enableAudioOnlyUI_()):this.disableAudioOnlyUI_()},i.enablePosterModeUI_=function(){(this.tech_&&this.tech_).hide(),this.addClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")},i.disablePosterModeUI_=function(){(this.tech_&&this.tech_).show(),this.removeClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")},i.audioPosterMode=function(e){var t=this;if("boolean"!=typeof e||e===this.audioPosterMode_)return this.audioPosterMode_;this.audioPosterMode_=e;var i=this.options_.Promise||d.Promise;return i?e?this.audioOnlyMode()?this.audioOnlyMode(!1).then((function(){t.enablePosterModeUI_()})):i.resolve().then((function(){t.enablePosterModeUI_()})):i.resolve().then((function(){t.disablePosterModeUI_()})):e?(this.audioOnlyMode()&&this.audioOnlyMode(!1),void this.enablePosterModeUI_()):void this.disablePosterModeUI_()},i.addTextTrack=function(e,t,i){if(this.tech_)return this.tech_.addTextTrack(e,t,i)},i.addRemoteTextTrack=function(e,t){if(this.tech_)return this.tech_.addRemoteTextTrack(e,t)},i.removeRemoteTextTrack=function(e){void 0===e&&(e={});var t=e.track;if(t||(t=e),this.tech_)return this.tech_.removeRemoteTextTrack(t)},i.getVideoPlaybackQuality=function(){return this.techGet_("getVideoPlaybackQuality")},i.videoWidth=function(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0},i.videoHeight=function(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0},i.language=function(e){if(void 0===e)return this.language_;this.language_!==String(e).toLowerCase()&&(this.language_=String(e).toLowerCase(),Io(this)&&this.trigger("languagechange"))},i.languages=function(){return qo(t.prototype.options_.languages,this.languages_)},i.toJSON=function(){var e=qo(this.options_),t=e.tracks;e.tracks=[];for(var i=0;i<t.length;i++){var n=t[i];(n=qo(n)).player=void 0,e.tracks[i]=n}return e},i.createModal=function(e,t){var i=this;(t=t||{}).content=e||"";var n=new au(this,t);return this.addChild(n),n.on("dispose",(function(){i.removeChild(n)})),n.open(),n},i.updateCurrentBreakpoint_=function(){if(this.responsive())for(var e=this.currentBreakpoint(),t=this.currentWidth(),i=0;i<Rc.length;i++){var n=Rc[i];if(t<=this.breakpoints_[n]){if(e===n)return;e&&this.removeClass(Mc[e]),this.addClass(Mc[n]),this.breakpoint_=n;break}}},i.removeCurrentBreakpoint_=function(){var e=this.currentBreakpointClass();this.breakpoint_="",e&&this.removeClass(e)},i.breakpoints=function(e){return void 0===e||(this.breakpoint_="",this.breakpoints_=Ka({},Uc,e),this.updateCurrentBreakpoint_()),Ka(this.breakpoints_)},i.responsive=function(e){return void 0===e?this.responsive_:(e=Boolean(e))!==this.responsive_?(this.responsive_=e,e?(this.on("playerresize",this.boundUpdateCurrentBreakpoint_),this.updateCurrentBreakpoint_()):(this.off("playerresize",this.boundUpdateCurrentBreakpoint_),this.removeCurrentBreakpoint_()),e):void 0},i.currentBreakpoint=function(){return this.breakpoint_},i.currentBreakpointClass=function(){return Mc[this.breakpoint_]||""},i.loadMedia=function(e,t){var i=this;if(e&&"object"===u(e)){this.reset(),this.cache_.media=qo(e);var n=this.cache_.media,r=n.artwork,a=n.poster,s=n.src,o=n.textTracks;!r&&a&&(this.cache_.media.artwork=[{src:a,type:zu(a)}]),s&&this.src(s),a&&this.poster(a),Array.isArray(o)&&o.forEach((function(e){return i.addRemoteTextTrack(e,!1)})),this.ready(t)}},i.getMedia=function(){if(!this.cache_.media){var e=this.poster(),t={src:this.currentSources(),textTracks:Array.prototype.map.call(this.remoteTextTracks(),(function(e){return{kind:e.kind,label:e.label,language:e.language,src:e.src}}))};return e&&(t.poster=e,t.artwork=[{src:t.poster,type:zu(t.poster)}]),t}return qo(this.cache_.media)},t.getTagSettings=function(e){var t={sources:[],tracks:[]},i=Ns(e),n=i["data-setup"];if(As(e,"vjs-fill")&&(i.fill=!0),As(e,"vjs-fluid")&&(i.fluid=!0),null!==n){var r=ue(n||"{}"),a=r[0],s=r[1];a&&Ha.error(a),Ka(i,s)}if(Ka(t,i),e.hasChildNodes())for(var o=e.childNodes,u=0,l=o.length;u<l;u++){var c=o[u],d=c.nodeName.toLowerCase();"source"===d?t.sources.push(Ns(c)):"track"===d&&t.tracks.push(Ns(c))}return t},i.flexNotSupported_=function(){var e=te.createElement("i");return!("flexBasis"in e.style||"webkitFlexBasis"in e.style||"mozFlexBasis"in e.style||"msFlexBasis"in e.style||"msFlexOrder"in e.style)},i.debug=function(e){if(void 0===e)return this.debugEnabled_;e?(this.trigger("debugon"),this.previousLogLevel_=this.log.level,this.log.level("debug"),this.debugEnabled_=!0):(this.trigger("debugoff"),this.log.level(this.previousLogLevel_),this.previousLogLevel_=void 0,this.debugEnabled_=!1)},i.playbackRates=function(e){if(void 0===e)return this.cache_.playbackRates;Array.isArray(e)&&e.every((function(e){return"number"==typeof e}))&&(this.cache_.playbackRates=e,this.trigger("playbackrateschange"))},t}(zo);Ou.names.forEach((function(e){var t=Ou[e];Bc.prototype[t.getterName]=function(){return this.tech_?this.tech_[t.getterName]():(this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName])}})),Bc.prototype.crossorigin=Bc.prototype.crossOrigin,Bc.players={};var Fc=d.navigator;Bc.prototype.options_={techOrder:Nu.defaultTechOrder_,html5:{},inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:Fc&&(Fc.languages&&Fc.languages[0]||Fc.userLanguage||Fc.language)||"en",languages:{},notSupportedMessage:"No compatible source was found for this media.",normalizeAutoplay:!1,fullscreen:{options:{navigationUI:"hide"}},breakpoints:{},responsive:!1,audioOnlyMode:!1,audioPosterMode:!1},["ended","seeking","seekable","networkState","readyState"].forEach((function(e){Bc.prototype[e]=function(){return this.techGet_(e)}})),Oc.forEach((function(e){Bc.prototype["handleTech"+jo(e)+"_"]=function(){return this.trigger(e)}})),zo.registerComponent("Player",Bc);var jc="plugin",qc="activePlugins_",Vc={},Hc=function(e){return Vc.hasOwnProperty(e)},Wc=function(e){return Hc(e)?Vc[e]:void 0},Gc=function(e,t){e[qc]=e[qc]||{},e[qc][t]=!0},zc=function(e,t,i){var n=(i?"before":"")+"pluginsetup";e.trigger(n,t),e.trigger(n+":"+t.name,t)},Xc=function(e,t){return t.prototype.name=e,function(){zc(this,{name:e,plugin:t,instance:null},!0);for(var i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];var a=st(t,[this].concat(n));return this[e]=function(){return a},zc(this,a.getEventHash()),a}},Kc=function(){function e(t){if(this.constructor===e)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=t,this.log||(this.log=this.player.log.createLogger(this.name)),Mo(this),delete this.trigger,Bo(this,this.constructor.defaultState),Gc(t,this.name),this.dispose=this.dispose.bind(this),t.on("dispose",this.dispose)}var t=e.prototype;return t.version=function(){return this.constructor.VERSION},t.getEventHash=function(e){return void 0===e&&(e={}),e.name=this.name,e.plugin=this.constructor,e.instance=this,e},t.trigger=function(e,t){return void 0===t&&(t={}),yo(this.eventBusEl_,e,this.getEventHash(t))},t.handleStateChanged=function(e){},t.dispose=function(){var e=this.name,t=this.player;this.trigger("dispose"),this.off(),t.off("dispose",this.dispose),t[qc][e]=!1,this.player=this.state=null,t[e]=Xc(e,Vc[e])},e.isBasic=function(t){var i="string"==typeof t?Wc(t):t;return"function"==typeof i&&!e.prototype.isPrototypeOf(i.prototype)},e.registerPlugin=function(t,i){if("string"!=typeof t)throw new Error('Illegal plugin name, "'+t+'", must be a string, was '+u(t)+".");if(Hc(t))Ha.warn('A plugin named "'+t+'" already exists. You may want to avoid re-registering plugins!');else if(Bc.prototype.hasOwnProperty(t))throw new Error('Illegal plugin name, "'+t+'", cannot share a name with an existing player method!');if("function"!=typeof i)throw new Error('Illegal plugin for "'+t+'", must be a function, was '+u(i)+".");return Vc[t]=i,t!==jc&&(e.isBasic(i)?Bc.prototype[t]=function(e,t){var i=function(){zc(this,{name:e,plugin:t,instance:null},!0);var i=t.apply(this,arguments);return Gc(this,e),zc(this,{name:e,plugin:t,instance:i}),i};return Object.keys(t).forEach((function(e){i[e]=t[e]})),i}(t,i):Bc.prototype[t]=Xc(t,i)),i},e.deregisterPlugin=function(e){if(e===jc)throw new Error("Cannot de-register base plugin.");Hc(e)&&(delete Vc[e],delete Bc.prototype[e])},e.getPlugins=function(e){var t;return void 0===e&&(e=Object.keys(Vc)),e.forEach((function(e){var i=Wc(e);i&&((t=t||{})[e]=i)})),t},e.getPluginVersion=function(e){var t=Wc(e);return t&&t.VERSION||""},e}();Kc.getPlugin=Wc,Kc.BASE_PLUGIN_NAME=jc,Kc.registerPlugin(jc,Kc),Bc.prototype.usingPlugin=function(e){return!!this[qc]&&!0===this[qc][e]},Bc.prototype.hasPlugin=function(e){return!!Hc(e)};var Yc=!1,Qc=function(e){return 0===e.indexOf("#")?e.slice(1):e};function $c(e,t,i){var n=$c.getPlayer(e);if(n)return t&&Ha.warn('Player "'+e+'" is already initialised. Options will not be applied.'),i&&n.ready(i),n;var r="string"==typeof e?Qs("#"+Qc(e)):e;if(!Es(r))throw new TypeError("The element or ID supplied is not valid. (videojs)");r.ownerDocument.defaultView&&r.ownerDocument.body.contains(r)||Ha.warn("The element supplied is not included in the DOM"),!0===(t=t||{}).restoreEl&&(t.restoreEl=(r.parentNode&&r.parentNode.hasAttribute("data-vjs-player")?r.parentNode:r).cloneNode(!0)),Ra("beforesetup").forEach((function(e){var i=e(r,qo(t));Ya(i)&&!Array.isArray(i)?t=qo(t,i):Ha.error("please return an object in beforesetup hooks")}));var a=zo.getComponent("Player");return n=new a(r,t,i),Ra("setup").forEach((function(e){return e(n)})),n}if($c.hooks_=Na,$c.hooks=Ra,$c.hook=function(e,t){Ra(e,t)},$c.hookOnce=function(e,t){Ra(e,[].concat(t).map((function(t){return function i(){return Ma(e,i),t.apply(void 0,arguments)}})))},$c.removeHook=Ma,!0!==d.VIDEOJS_NO_DYNAMIC_STYLE&&Ss()){var Jc=Qs(".vjs-styles-defaults");if(!Jc){Jc=ro("vjs-styles-defaults");var Zc=Qs("head");Zc&&Zc.insertBefore(Jc,Zc.firstChild),ao(Jc,"\n .video-js {\n width: 300px;\n height: 150px;\n }\n\n .vjs-fluid:not(.vjs-audio-only-mode) {\n padding-top: 56.25%\n }\n ")}}to(1,$c),$c.VERSION=Oa,$c.options=Bc.prototype.options_,$c.getPlayers=function(){return Bc.players},$c.getPlayer=function(e){var t,i=Bc.players;if("string"==typeof e){var n=Qc(e),r=i[n];if(r)return r;t=Qs("#"+n)}else t=e;if(Es(t)){var a=t,s=a.player,o=a.playerId;if(s||i[o])return s||i[o]}},$c.getAllPlayers=function(){return Object.keys(Bc.players).map((function(e){return Bc.players[e]})).filter(Boolean)},$c.players=Bc.players,$c.getComponent=zo.getComponent,$c.registerComponent=function(e,t){Nu.isTech(t)&&Ha.warn("The "+e+" tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)"),zo.registerComponent.call(zo,e,t)},$c.getTech=Nu.getTech,$c.registerTech=Nu.registerTech,$c.use=function(e,t){Ru[e]=Ru[e]||[],Ru[e].push(t)},Object.defineProperty($c,"middleware",{value:{},writeable:!1,enumerable:!0}),Object.defineProperty($c.middleware,"TERMINATOR",{value:Uu,writeable:!1,enumerable:!0}),$c.browser=_s,$c.TOUCH_ENABLED=fs,$c.extend=function(e,t){void 0===t&&(t={}),Yc||(Ha.warn("videojs.extend is deprecated as of Video.js 7.22.0 and will be removed in Video.js 8.0.0"),Yc=!0);var i=function(){e.apply(this,arguments)},n={};for(var r in"object"===u(t)?(t.constructor!==Object.prototype.constructor&&(i=t.constructor),n=t):"function"==typeof t&&(i=t),function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&se(e,t)}(i,e),e&&(i.super_=e),n)n.hasOwnProperty(r)&&(i.prototype[r]=n[r]);return i},$c.mergeOptions=qo,$c.bind=wo,$c.registerPlugin=Kc.registerPlugin,$c.deregisterPlugin=Kc.deregisterPlugin,$c.plugin=function(e,t){return Ha.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),Kc.registerPlugin(e,t)},$c.getPlugins=Kc.getPlugins,$c.getPlugin=Kc.getPlugin,$c.getPluginVersion=Kc.getPluginVersion,$c.addLanguage=function(e,t){var i;return e=(""+e).toLowerCase(),$c.options.languages=qo($c.options.languages,((i={})[e]=t,i)),$c.options.languages[e]},$c.log=Ha,$c.createLogger=Wa,$c.createTimeRange=$c.createTimeRanges=Yo,$c.formatTime=cl,$c.setFormatTime=function(e){ll=e},$c.resetFormatTime=function(){ll=ul},$c.parseUrl=bu,$c.isCrossOrigin=Eu,$c.EventTarget=Co,$c.on=go,$c.one=_o,$c.off=vo,$c.trigger=yo,$c.xhr=le.exports,$c.TextTrack=xu,$c.AudioTrack=Iu,$c.VideoTrack=Au,["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach((function(e){$c[e]=function(){return Ha.warn("videojs."+e+"() is deprecated; use videojs.dom."+e+"() instead"),Js[e].apply(null,arguments)}})),$c.computedStyle=$a,$c.dom=Js,$c.url=wu,$c.defineLazyProperty=Lc,$c.addLanguage("en",{"Non-Fullscreen":"Exit Fullscreen"});/*! @name @videojs/http-streaming @version 2.16.0 @license Apache-2.0 */
|
|
14
|
-
var ed=dt,td=function(e,t,i){return e&&i&&i.responseURL&&t!==i.responseURL?i.responseURL:t},id=function(e){return $c.log.debug?$c.log.debug.bind($c,"VHS:",e+" >"):function(){}},nd=1/30,rd=.1,ad=function(e,t){var i,n=[];if(e&&e.length)for(i=0;i<e.length;i++)t(e.start(i),e.end(i))&&n.push([e.start(i),e.end(i)]);return $c.createTimeRanges(n)},sd=function(e,t){return ad(e,(function(e,i){return e-rd<=t&&i+rd>=t}))},od=function(e,t){return ad(e,(function(e){return e-nd>=t}))},ud=function(e){var t=[];if(!e||!e.length)return"";for(var i=0;i<e.length;i++)t.push(e.start(i)+" => "+e.end(i));return t.join(", ")},ld=function(e){for(var t=[],i=0;i<e.length;i++)t.push({start:e.start(i),end:e.end(i)});return t},cd=function(e){if(e&&e.length&&e.end)return e.end(e.length-1)},dd=function(e,t){var i=0;if(!e||!e.length)return i;for(var n=0;n<e.length;n++){var r=e.start(n),a=e.end(n);t>a||(i+=t>r&&t<=a?a-t:a-r)}return i},hd=$c.createTimeRange,pd=function(e,t){if(!t.preload)return t.duration;var i=0;return(t.parts||[]).forEach((function(e){i+=e.duration})),(t.preloadHints||[]).forEach((function(t){"PART"===t.type&&(i+=e.partTargetDuration)})),i},fd=function(e){return(e.segments||[]).reduce((function(e,t,i){return t.parts?t.parts.forEach((function(n,r){e.push({duration:n.duration,segmentIndex:i,partIndex:r,part:n,segment:t})})):e.push({duration:t.duration,segmentIndex:i,partIndex:null,segment:t,part:null}),e}),[])},md=function(e){var t=e.segments&&e.segments.length&&e.segments[e.segments.length-1];return t&&t.parts||[]},gd=function(e){var t=e.preloadSegment;if(t){var i=t.parts,n=(t.preloadHints||[]).reduce((function(e,t){return e+("PART"===t.type?1:0)}),0);return n+=i&&i.length?i.length:0}},vd=function(e,t){if(t.endList)return 0;if(e&&e.suggestedPresentationDelay)return e.suggestedPresentationDelay;var i=md(t).length>0;return i&&t.serverControl&&t.serverControl.partHoldBack?t.serverControl.partHoldBack:i&&t.partTargetDuration?3*t.partTargetDuration:t.serverControl&&t.serverControl.holdBack?t.serverControl.holdBack:t.targetDuration?3*t.targetDuration:0},yd=function(e,t,i){if(void 0===t&&(t=e.mediaSequence+e.segments.length),t<e.mediaSequence)return 0;var n=function(e,t){var i=0,n=t-e.mediaSequence,r=e.segments[n];if(r){if(void 0!==r.start)return{result:r.start,precise:!0};if(void 0!==r.end)return{result:r.end-r.duration,precise:!0}}for(;n--;){if(void 0!==(r=e.segments[n]).end)return{result:i+r.end,precise:!0};if(i+=pd(e,r),void 0!==r.start)return{result:i+r.start,precise:!0}}return{result:i,precise:!1}}(e,t);if(n.precise)return n.result;var r=function(e,t){for(var i,n=0,r=t-e.mediaSequence;r<e.segments.length;r++){if(void 0!==(i=e.segments[r]).start)return{result:i.start-n,precise:!0};if(n+=pd(e,i),void 0!==i.end)return{result:i.end-n,precise:!0}}return{result:-1,precise:!1}}(e,t);return r.precise?r.result:n.result+i},_d=function(e,t,i){if(!e)return 0;if("number"!=typeof i&&(i=0),void 0===t){if(e.totalDuration)return e.totalDuration;if(!e.endList)return d.Infinity}return yd(e,t,i)},bd=function(e){var t=e.defaultDuration,i=e.durationList,n=e.startIndex,r=e.endIndex,a=0;if(n>r){var s=[r,n];n=s[0],r=s[1]}if(n<0){for(var o=n;o<Math.min(0,r);o++)a+=t;n=0}for(var u=n;u<r;u++)a+=i[u].duration;return a},Td=function(e,t,i,n){if(!e||!e.segments)return null;if(e.endList)return _d(e);if(null===t)return null;t=t||0;var r=yd(e,e.mediaSequence+e.segments.length,t);return i&&(r-=n="number"==typeof n?n:vd(null,e)),Math.max(0,r)},Sd=function(e){return e.excludeUntil&&e.excludeUntil>Date.now()},Ed=function(e){return e.excludeUntil&&e.excludeUntil===1/0},wd=function(e){var t=Sd(e);return!e.disabled&&!t},kd=function(e,t){return t.attributes&&t.attributes[e]},Cd=function(e,t){if(1===e.playlists.length)return!0;var i=t.attributes.BANDWIDTH||Number.MAX_VALUE;return 0===e.playlists.filter((function(e){return!!wd(e)&&(e.attributes.BANDWIDTH||0)<i})).length},xd=function(e,t){return!(!e&&!t||!e&&t||e&&!t)&&(e===t||(!(!e.id||!t.id||e.id!==t.id)||(!(!e.resolvedUri||!t.resolvedUri||e.resolvedUri!==t.resolvedUri)||!(!e.uri||!t.uri||e.uri!==t.uri))))},Id=function(e,t){var i=e&&e.mediaGroups&&e.mediaGroups.AUDIO||{},n=!1;for(var r in i){for(var a in i[r])if(n=t(i[r][a]))break;if(n)break}return!!n},Ad=function(e){if(!e||!e.playlists||!e.playlists.length)return Id(e,(function(e){return e.playlists&&e.playlists.length||e.uri}));for(var t=function(t){var i=e.playlists[t],n=i.attributes&&i.attributes.CODECS;return n&&n.split(",").every((function(e){return At(e)}))||Id(e,(function(e){return xd(i,e)}))?"continue":{v:!1}},i=0;i<e.playlists.length;i++){var n=t(i);if("continue"!==n&&"object"===u(n))return n.v}return!0},Pd={liveEdgeDelay:vd,duration:_d,seekable:function(e,t,i){var n=t||0,r=Td(e,t,!0,i);return null===r?hd():hd(n,r)},getMediaInfoForTime:function(e){for(var t=e.playlist,i=e.currentTime,n=e.startingSegmentIndex,r=e.startingPartIndex,a=e.startTime,s=e.experimentalExactManifestTimings,o=i-a,u=fd(t),l=0,c=0;c<u.length;c++){var d=u[c];if(n===d.segmentIndex&&("number"!=typeof r||"number"!=typeof d.partIndex||r===d.partIndex)){l=c;break}}if(o<0){if(l>0)for(var h=l-1;h>=0;h--){var p=u[h];if(o+=p.duration,s){if(o<0)continue}else if(o+nd<=0)continue;return{partIndex:p.partIndex,segmentIndex:p.segmentIndex,startTime:a-bd({defaultDuration:t.targetDuration,durationList:u,startIndex:l,endIndex:h})}}return{partIndex:u[0]&&u[0].partIndex||null,segmentIndex:u[0]&&u[0].segmentIndex||0,startTime:i}}if(l<0){for(var f=l;f<0;f++)if((o-=t.targetDuration)<0)return{partIndex:u[0]&&u[0].partIndex||null,segmentIndex:u[0]&&u[0].segmentIndex||0,startTime:i};l=0}for(var m=l;m<u.length;m++){var g=u[m];if(o-=g.duration,s){if(o>0)continue}else if(o-nd>=0)continue;return{partIndex:g.partIndex,segmentIndex:g.segmentIndex,startTime:a+bd({defaultDuration:t.targetDuration,durationList:u,startIndex:l,endIndex:m})}}return{segmentIndex:u[u.length-1].segmentIndex,partIndex:u[u.length-1].partIndex,startTime:i}},isEnabled:wd,isDisabled:function(e){return e.disabled},isBlacklisted:Sd,isIncompatible:Ed,playlistEnd:Td,isAes:function(e){for(var t=0;t<e.segments.length;t++)if(e.segments[t].key)return!0;return!1},hasAttribute:kd,estimateSegmentRequestTime:function(e,t,i,n){return void 0===n&&(n=0),kd("BANDWIDTH",i)?(e*i.attributes.BANDWIDTH-8*n)/t:NaN},isLowestEnabledRendition:Cd,isAudioOnly:Ad,playlistMatch:xd,segmentDurationWithParts:pd},Ld=$c.log,Dd=function(e,t){return e+"-"+t},Od=function(e,t){e.mediaGroups&&["AUDIO","SUBTITLES"].forEach((function(i){if(e.mediaGroups[i])for(var n in e.mediaGroups[i])for(var r in e.mediaGroups[i][n]){var a=e.mediaGroups[i][n][r];t(a,i,n,r)}}))},Nd=function(e){var t=e.playlist,i=e.uri,n=e.id;t.id=n,t.playlistErrors_=0,i&&(t.uri=i),t.attributes=t.attributes||{}},Rd=function(e,t){e.uri=t;for(var i=0;i<e.playlists.length;i++)if(!e.playlists[i].uri){var n="placeholder-uri-"+i;e.playlists[i].uri=n}var r=Ad(e);Od(e,(function(t,i,n,a){var s="placeholder-uri-"+i+"-"+n+"-"+a;if(!t.playlists||!t.playlists.length){if(r&&"AUDIO"===i&&!t.uri)for(var o=0;o<e.playlists.length;o++){var u=e.playlists[o];if(u.attributes&&u.attributes.AUDIO&&u.attributes.AUDIO===n)return}t.playlists=[ie({},t)]}t.playlists.forEach((function(t,i){var n=Dd(i,s);t.uri?t.resolvedUri=t.resolvedUri||ed(e.uri,t.uri):(t.uri=0===i?s:n,t.resolvedUri=t.uri),t.id=t.id||n,t.attributes=t.attributes||{},e.playlists[t.id]=t,e.playlists[t.uri]=t}))})),function(e){for(var t=e.playlists.length;t--;){var i=e.playlists[t];Nd({playlist:i,id:Dd(t,i.uri)}),i.resolvedUri=ed(e.uri,i.uri),e.playlists[i.id]=i,e.playlists[i.uri]=i,i.attributes.BANDWIDTH||Ld.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}}(e),function(e){Od(e,(function(t){t.uri&&(t.resolvedUri=ed(e.uri,t.uri))}))}(e)},Md=$c.mergeOptions,Ud=$c.EventTarget,Bd=function(e,t){if(!e)return t;var i=Md(e,t);if(e.preloadHints&&!t.preloadHints&&delete i.preloadHints,e.parts&&!t.parts)delete i.parts;else if(e.parts&&t.parts)for(var n=0;n<t.parts.length;n++)e.parts&&e.parts[n]&&(i.parts[n]=Md(e.parts[n],t.parts[n]));return!e.skipped&&t.skipped&&(i.skipped=!1),e.preload&&!t.preload&&(i.preload=!1),i},Fd=function(e,t){!e.resolvedUri&&e.uri&&(e.resolvedUri=ed(t,e.uri)),e.key&&!e.key.resolvedUri&&(e.key.resolvedUri=ed(t,e.key.uri)),e.map&&!e.map.resolvedUri&&(e.map.resolvedUri=ed(t,e.map.uri)),e.map&&e.map.key&&!e.map.key.resolvedUri&&(e.map.key.resolvedUri=ed(t,e.map.key.uri)),e.parts&&e.parts.length&&e.parts.forEach((function(e){e.resolvedUri||(e.resolvedUri=ed(t,e.uri))})),e.preloadHints&&e.preloadHints.length&&e.preloadHints.forEach((function(e){e.resolvedUri||(e.resolvedUri=ed(t,e.uri))}))},jd=function(e){var t=e.segments||[],i=e.preloadSegment;if(i&&i.parts&&i.parts.length){if(i.preloadHints)for(var n=0;n<i.preloadHints.length;n++)if("MAP"===i.preloadHints[n].type)return t;i.duration=e.targetDuration,i.preload=!0,t.push(i)}return t},qd=function(e,t){return e===t||e.segments&&t.segments&&e.segments.length===t.segments.length&&e.endList===t.endList&&e.mediaSequence===t.mediaSequence&&e.preloadSegment===t.preloadSegment},Vd=function(e,t,i){void 0===i&&(i=qd);var n=Md(e,{}),r=n.playlists[t.id];if(!r)return null;if(i(r,t))return null;t.segments=jd(t);var a=Md(r,t);if(a.preloadSegment&&!t.preloadSegment&&delete a.preloadSegment,r.segments){if(t.skip){t.segments=t.segments||[];for(var s=0;s<t.skip.skippedSegments;s++)t.segments.unshift({skipped:!0})}a.segments=function(e,t,i){var n=e.slice(),r=t.slice();i=i||0;for(var a,s=[],o=0;o<r.length;o++){var u=n[o+i],l=r[o];u?(a=u.map||a,s.push(Bd(u,l))):(a&&!l.map&&(l.map=a),s.push(l))}return s}(r.segments,t.segments,t.mediaSequence-r.mediaSequence)}a.segments.forEach((function(e){Fd(e,a.resolvedUri)}));for(var o=0;o<n.playlists.length;o++)n.playlists[o].id===t.id&&(n.playlists[o]=a);return n.playlists[t.id]=a,n.playlists[t.uri]=a,Od(e,(function(e,i,n,r){if(e.playlists)for(var s=0;s<e.playlists.length;s++)t.id===e.playlists[s].id&&(e.playlists[s]=a)})),n},Hd=function(e,t){var i=e.segments||[],n=i[i.length-1],r=n&&n.parts&&n.parts[n.parts.length-1],a=r&&r.duration||n&&n.duration;return t&&a?1e3*a:500*(e.partTargetDuration||e.targetDuration||10)},Wd=function(e){function t(t,i,n){var r;if(void 0===n&&(n={}),r=e.call(this)||this,!t)throw new Error("A non-empty playlist URL or object is required");r.logger_=id("PlaylistLoader");var a=n,s=a.withCredentials,o=void 0!==s&&s,u=a.handleManifestRedirects,l=void 0!==u&&u;r.src=t,r.vhs_=i,r.withCredentials=o,r.handleManifestRedirects=l;var c=i.options_;return r.customTagParsers=c&&c.customTagParsers||[],r.customTagMappers=c&&c.customTagMappers||[],r.experimentalLLHLS=c&&c.experimentalLLHLS||!1,$c.browser.IE_VERSION&&(r.experimentalLLHLS=!1),r.state="HAVE_NOTHING",r.handleMediaupdatetimeout_=r.handleMediaupdatetimeout_.bind(ae(r)),r.on("mediaupdatetimeout",r.handleMediaupdatetimeout_),r}oe(t,e);var i=t.prototype;return i.handleMediaupdatetimeout_=function(){var e=this;if("HAVE_METADATA"===this.state){var t=this.media(),i=ed(this.master.uri,t.uri);this.experimentalLLHLS&&(i=function(e,t){if(t.endList||!t.serverControl)return e;var i={};if(t.serverControl.canBlockReload){var n=t.preloadSegment,r=t.mediaSequence+t.segments.length;if(n){var a=n.parts||[],s=gd(t)-1;s>-1&&s!==a.length-1&&(i._HLS_part=s),(s>-1||a.length)&&r--}i._HLS_msn=r}if(t.serverControl&&t.serverControl.canSkipUntil&&(i._HLS_skip=t.serverControl.canSkipDateranges?"v2":"YES"),Object.keys(i).length){var o=new d.URL(e);["_HLS_skip","_HLS_msn","_HLS_part"].forEach((function(e){i.hasOwnProperty(e)&&o.searchParams.set(e,i[e])})),e=o.toString()}return e}(i,t)),this.state="HAVE_CURRENT_METADATA",this.request=this.vhs_.xhr({uri:i,withCredentials:this.withCredentials},(function(t,i){if(e.request)return t?e.playlistRequestError(e.request,e.media(),"HAVE_METADATA"):void e.haveMetadata({playlistString:e.request.responseText,url:e.media().uri,id:e.media().id})}))}},i.playlistRequestError=function(e,t,i){var n=t.uri,r=t.id;this.request=null,i&&(this.state=i),this.error={playlist:this.master.playlists[r],status:e.status,message:"HLS playlist request error at URL: "+n+".",responseText:e.responseText,code:e.status>=500?4:2},this.trigger("error")},i.parseManifest_=function(e){var t=this,i=e.url;return function(e){var t=e.onwarn,i=e.oninfo,n=e.manifestString,r=e.customTagParsers,a=void 0===r?[]:r,s=e.customTagMappers,o=void 0===s?[]:s,u=e.experimentalLLHLS,l=new Et;t&&l.on("warn",t),i&&l.on("info",i),a.forEach((function(e){return l.addParser(e)})),o.forEach((function(e){return l.addTagMapper(e)})),l.push(n),l.end();var c=l.manifest;if(u||(["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach((function(e){c.hasOwnProperty(e)&&delete c[e]})),c.segments&&c.segments.forEach((function(e){["parts","preloadHints"].forEach((function(t){e.hasOwnProperty(t)&&delete e[t]}))}))),!c.targetDuration){var d=10;c.segments&&c.segments.length&&(d=c.segments.reduce((function(e,t){return Math.max(e,t.duration)}),0)),t&&t("manifest has no targetDuration defaulting to "+d),c.targetDuration=d}var h=md(c);if(h.length&&!c.partTargetDuration){var p=h.reduce((function(e,t){return Math.max(e,t.duration)}),0);t&&(t("manifest has no partTargetDuration defaulting to "+p),Ld.error("LL-HLS manifest has parts but lacks required #EXT-X-PART-INF:PART-TARGET value. See https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-09#section-4.4.3.7. Playback is not guaranteed.")),c.partTargetDuration=p}return c}({onwarn:function(e){var n=e.message;return t.logger_("m3u8-parser warn for "+i+": "+n)},oninfo:function(e){var n=e.message;return t.logger_("m3u8-parser info for "+i+": "+n)},manifestString:e.manifestString,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers,experimentalLLHLS:this.experimentalLLHLS})},i.haveMetadata=function(e){var t=e.playlistString,i=e.playlistObject,n=e.url,r=e.id;this.request=null,this.state="HAVE_METADATA";var a=i||this.parseManifest_({url:n,manifestString:t});a.lastRequest=Date.now(),Nd({playlist:a,uri:n,id:r});var s=Vd(this.master,a);this.targetDuration=a.partTargetDuration||a.targetDuration,this.pendingMedia_=null,s?(this.master=s,this.media_=this.master.playlists[r]):this.trigger("playlistunchanged"),this.updateMediaUpdateTimeout_(Hd(this.media(),!!s)),this.trigger("loadedplaylist")},i.dispose=function(){this.trigger("dispose"),this.stopRequest(),d.clearTimeout(this.mediaUpdateTimeout),d.clearTimeout(this.finalRenditionTimeout),this.off()},i.stopRequest=function(){if(this.request){var e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}},i.media=function(e,t){var i=this;if(!e)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);if("string"==typeof e){if(!this.master.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.master.playlists[e]}if(d.clearTimeout(this.finalRenditionTimeout),t){var n=(e.partTargetDuration||e.targetDuration)/2*1e3||5e3;this.finalRenditionTimeout=d.setTimeout(this.media.bind(this,e,!1),n)}else{var r=this.state,a=!this.media_||e.id!==this.media_.id,s=this.master.playlists[e.id];if(s&&s.endList||e.endList&&e.segments.length)return this.request&&(this.request.onreadystatechange=null,this.request.abort(),this.request=null),this.state="HAVE_METADATA",this.media_=e,void(a&&(this.trigger("mediachanging"),"HAVE_MASTER"===r?this.trigger("loadedmetadata"):this.trigger("mediachange")));if(this.updateMediaUpdateTimeout_(Hd(e,!0)),a){if(this.state="SWITCHING_MEDIA",this.request){if(e.resolvedUri===this.request.url)return;this.request.onreadystatechange=null,this.request.abort(),this.request=null}this.media_&&this.trigger("mediachanging"),this.pendingMedia_=e,this.request=this.vhs_.xhr({uri:e.resolvedUri,withCredentials:this.withCredentials},(function(t,n){if(i.request){if(e.lastRequest=Date.now(),e.resolvedUri=td(i.handleManifestRedirects,e.resolvedUri,n),t)return i.playlistRequestError(i.request,e,r);i.haveMetadata({playlistString:n.responseText,url:e.uri,id:e.id}),"HAVE_MASTER"===r?i.trigger("loadedmetadata"):i.trigger("mediachange")}}))}}},i.pause=function(){this.mediaUpdateTimeout&&(d.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.stopRequest(),"HAVE_NOTHING"===this.state&&(this.started=!1),"SWITCHING_MEDIA"===this.state?this.media_?this.state="HAVE_METADATA":this.state="HAVE_MASTER":"HAVE_CURRENT_METADATA"===this.state&&(this.state="HAVE_METADATA")},i.load=function(e){var t=this;this.mediaUpdateTimeout&&(d.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);var i=this.media();if(e){var n=i?(i.partTargetDuration||i.targetDuration)/2*1e3:5e3;this.mediaUpdateTimeout=d.setTimeout((function(){t.mediaUpdateTimeout=null,t.load()}),n)}else this.started?i&&!i.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist"):this.start()},i.updateMediaUpdateTimeout_=function(e){var t=this;this.mediaUpdateTimeout&&(d.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.media()&&!this.media().endList&&(this.mediaUpdateTimeout=d.setTimeout((function(){t.mediaUpdateTimeout=null,t.trigger("mediaupdatetimeout"),t.updateMediaUpdateTimeout_(e)}),e))},i.start=function(){var e=this;if(this.started=!0,"object"===u(this.src))return this.src.uri||(this.src.uri=d.location.href),this.src.resolvedUri=this.src.uri,void setTimeout((function(){e.setupInitialPlaylist(e.src)}),0);this.request=this.vhs_.xhr({uri:this.src,withCredentials:this.withCredentials},(function(t,i){if(e.request){if(e.request=null,t)return e.error={status:i.status,message:"HLS playlist request error at URL: "+e.src+".",responseText:i.responseText,code:2},"HAVE_NOTHING"===e.state&&(e.started=!1),e.trigger("error");e.src=td(e.handleManifestRedirects,e.src,i);var n=e.parseManifest_({manifestString:i.responseText,url:e.src});e.setupInitialPlaylist(n)}}))},i.srcUri=function(){return"string"==typeof this.src?this.src:this.src.uri},i.setupInitialPlaylist=function(e){if(this.state="HAVE_MASTER",e.playlists)return this.master=e,Rd(this.master,this.srcUri()),e.playlists.forEach((function(e){e.segments=jd(e),e.segments.forEach((function(t){Fd(t,e.resolvedUri)}))})),this.trigger("loadedplaylist"),void(this.request||this.media(this.master.playlists[0]));var t=this.srcUri()||d.location.href;this.master=function(e,t){var i=Dd(0,t),n={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:d.location.href,resolvedUri:d.location.href,playlists:[{uri:t,id:i,resolvedUri:t,attributes:{}}]};return n.playlists[i]=n.playlists[0],n.playlists[t]=n.playlists[0],n}(0,t),this.haveMetadata({playlistObject:e,url:t,id:this.master.playlists[0].id}),this.trigger("loadedmetadata")},t}(Ud),Gd=$c.xhr,zd=$c.mergeOptions,Xd=function(e,t,i,n){var r="arraybuffer"===e.responseType?e.response:e.responseText;!t&&r&&(e.responseTime=Date.now(),e.roundTripTime=e.responseTime-e.requestTime,e.bytesReceived=r.byteLength||r.length,e.bandwidth||(e.bandwidth=Math.floor(e.bytesReceived/e.roundTripTime*8*1e3))),i.headers&&(e.responseHeaders=i.headers),t&&"ETIMEDOUT"===t.code&&(e.timedout=!0),t||e.aborted||200===i.statusCode||206===i.statusCode||0===i.statusCode||(t=new Error("XHR Failed with a response of: "+(e&&(r||e.responseText)))),n(t,e)},Kd=function(){var e=function e(t,i){t=zd({timeout:45e3},t);var n=e.beforeRequest||$c.Vhs.xhr.beforeRequest;if(n&&"function"==typeof n){var r=n(t);r&&(t=r)}var a=(!0===$c.Vhs.xhr.original?Gd:$c.Vhs.xhr)(t,(function(e,t){return Xd(a,e,t,i)})),s=a.abort;return a.abort=function(){return a.aborted=!0,s.apply(a,arguments)},a.uri=t.uri,a.requestTime=Date.now(),a};return e.original=!0,e},Yd=function(e){var t,i={};return e.byterange&&(i.Range="bytes="+(t=e.byterange).offset+"-"+("bigint"==typeof t.offset||"bigint"==typeof t.length?d.BigInt(t.offset)+d.BigInt(t.length)-d.BigInt(1):t.offset+t.length-1)),i},Qd=function(e,t){return e.start(t)+"-"+e.end(t)},$d=function(e,t){var i=e.toString(16);return"00".substring(0,2-i.length)+i+(t%2?" ":"")},Jd=function(e){return e>=32&&e<126?String.fromCharCode(e):"."},Zd=function(e){var t={};return Object.keys(e).forEach((function(i){var n=e[i];Ut(n)?t[i]={bytes:n.buffer,byteOffset:n.byteOffset,byteLength:n.byteLength}:t[i]=n})),t},eh=function(e){var t=e.byterange||{length:1/0,offset:0};return[t.length,t.offset,e.resolvedUri].join(",")},th=function(e){return e.resolvedUri},ih=function(e){for(var t=Array.prototype.slice.call(e),i=16,n="",r=0;r<t.length/i;r++)n+=t.slice(r*i,r*i+i).map($d).join("")+" "+t.slice(r*i,r*i+i).map(Jd).join("")+"\n";return n},nh=Object.freeze({__proto__:null,createTransferableMessage:Zd,initSegmentId:eh,segmentKeyId:th,hexDump:ih,tagDump:function(e){var t=e.bytes;return ih(t)},textRanges:function(e){var t,i="";for(t=0;t<e.length;t++)i+=Qd(e,t)+" ";return i}}),rh=function(e){var t=e.playlist,i=e.time,n=void 0===i?void 0:i,r=e.callback;if(!r)throw new Error("getProgramTime: callback must be provided");if(!t||void 0===n)return r({message:"getProgramTime: playlist and time must be provided"});var a=function(e,t){if(!t||!t.segments||0===t.segments.length)return null;for(var i,n=0,r=0;r<t.segments.length&&!(e<=(n=(i=t.segments[r]).videoTimingInfo?i.videoTimingInfo.transmuxedPresentationEnd:n+i.duration));r++);var a=t.segments[t.segments.length-1];if(a.videoTimingInfo&&a.videoTimingInfo.transmuxedPresentationEnd<e)return null;if(e>n){if(e>n+.25*a.duration)return null;i=a}return{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:n-i.duration,type:i.videoTimingInfo?"accurate":"estimate"}}(n,t);if(!a)return r({message:"valid programTime was not found"});if("estimate"===a.type)return r({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:a.estimatedStart});var s={mediaSeconds:n},o=function(e,t){if(!t.dateTimeObject)return null;var i=t.videoTimingInfo.transmuxerPrependedSeconds,n=e-(t.videoTimingInfo.transmuxedPresentationStart+i);return new Date(t.dateTimeObject.getTime()+1e3*n)}(n,a.segment);return o&&(s.programDateTime=o.toISOString()),r(null,s)},ah=function e(t){var i=t.programTime,n=t.playlist,r=t.retryCount,a=void 0===r?2:r,s=t.seekTo,o=t.pauseAfterSeek,u=void 0===o||o,l=t.tech,c=t.callback;if(!c)throw new Error("seekToProgramTime: callback must be provided");if(void 0===i||!n||!s)return c({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"});if(!n.endList&&!l.hasStarted_)return c({message:"player must be playing a live stream to start buffering"});if(!function(e){if(!e.segments||0===e.segments.length)return!1;for(var t=0;t<e.segments.length;t++)if(!e.segments[t].dateTimeObject)return!1;return!0}(n))return c({message:"programDateTime tags must be provided in the manifest "+n.resolvedUri});var d=function(e,t){var i;try{i=new Date(e)}catch(e){return null}if(!t||!t.segments||0===t.segments.length)return null;var n=t.segments[0];if(i<n.dateTimeObject)return null;for(var r=0;r<t.segments.length-1&&(n=t.segments[r],!(i<t.segments[r+1].dateTimeObject));r++);var a,s=t.segments[t.segments.length-1],o=s.dateTimeObject,u=s.videoTimingInfo?(a=s.videoTimingInfo).transmuxedPresentationEnd-a.transmuxedPresentationStart-a.transmuxerPrependedSeconds:s.duration+.25*s.duration;return i>new Date(o.getTime()+1e3*u)?null:(i>o&&(n=s),{segment:n,estimatedStart:n.videoTimingInfo?n.videoTimingInfo.transmuxedPresentationStart:Pd.duration(t,t.mediaSequence+t.segments.indexOf(n)),type:n.videoTimingInfo?"accurate":"estimate"})}(i,n);if(!d)return c({message:i+" was not found in the stream"});var h=d.segment,p=function(e,t){var i,n;try{i=new Date(e),n=new Date(t)}catch(e){}var r=i.getTime();return(n.getTime()-r)/1e3}(h.dateTimeObject,i);if("estimate"===d.type)return 0===a?c({message:i+" is not buffered yet. Try again"}):(s(d.estimatedStart+p),void l.one("seeked",(function(){e({programTime:i,playlist:n,retryCount:a-1,seekTo:s,pauseAfterSeek:u,tech:l,callback:c})})));var f=h.start+p;l.one("seeked",(function(){return c(null,l.currentTime())})),u&&l.pause(),s(f)},sh=function(e,t){if(4===e.readyState)return t()},oh=function(e,t,i){var n,r=[],a=!1,s=function(e,t,n,r){return t.abort(),a=!0,i(e,t,n,r)},o=function(e,t){if(!a){if(e)return s(e,t,"",r);var i=t.responseText.substring(r&&r.byteLength||0,t.responseText.length);if(r=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];if(t=t.filter((function(e){return e&&(e.byteLength||e.length)&&"string"!=typeof e})),t.length<=1)return Bt(t[0]);var n=t.reduce((function(e,t,i){return e+(t.byteLength||t.length)}),0),r=new Uint8Array(n),a=0;return t.forEach((function(e){e=Bt(e),r.set(e,a),a+=e.byteLength})),r}(r,Ht(i,!0)),n=n||aa(r),r.length<10||n&&r.length<n+2)return sh(t,(function(){return s(e,t,"",r)}));var o=xa(r);return"ts"===o&&r.length<188||!o&&r.length<376?sh(t,(function(){return s(e,t,"",r)})):s(null,t,o,r)}},u={uri:e,beforeSend:function(e){e.overrideMimeType("text/plain; charset=x-user-defined"),e.addEventListener("progress",(function(t){return t.total,t.loaded,Xd(e,null,{statusCode:e.status},o)}))}},l=t(u,(function(e,t){return Xd(l,e,t,o)}));return l},uh=$c.EventTarget,lh=$c.mergeOptions,ch=function(e,t){if(!qd(e,t))return!1;if(e.sidx&&t.sidx&&(e.sidx.offset!==t.sidx.offset||e.sidx.length!==t.sidx.length))return!1;if(!e.sidx&&t.sidx||e.sidx&&!t.sidx)return!1;if(e.segments&&!t.segments||!e.segments&&t.segments)return!1;if(!e.segments&&!t.segments)return!0;for(var i=0;i<e.segments.length;i++){var n=e.segments[i],r=t.segments[i];if(n.uri!==r.uri)return!1;if(n.byterange||r.byterange){var a=n.byterange,s=r.byterange;if(a&&!s||!a&&s)return!1;if(a.offset!==s.offset||a.length!==s.length)return!1}}return!0},dh=function(e,t){return(Boolean(!e.map&&!t.map)||Boolean(e.map&&t.map&&e.map.byterange.offset===t.map.byterange.offset&&e.map.byterange.length===t.map.byterange.length))&&e.uri===t.uri&&e.byterange.offset===t.byterange.offset&&e.byterange.length===t.byterange.length},hh=function(e,t){var i={};for(var n in e){var r=e[n].sidx;if(r){var a=kr(r);if(!t[a])break;var s=t[a].sidxInfo;dh(s,r)&&(i[a]=t[a])}}return i},ph=function(e){function t(t,i,n,r){var a;void 0===n&&(n={}),(a=e.call(this)||this).masterPlaylistLoader_=r||ae(a),r||(a.isMaster_=!0);var s=n,o=s.withCredentials,u=void 0!==o&&o,l=s.handleManifestRedirects,c=void 0!==l&&l;if(a.vhs_=i,a.withCredentials=u,a.handleManifestRedirects=c,!t)throw new Error("A non-empty playlist URL or object is required");return a.on("minimumUpdatePeriod",(function(){a.refreshXml_()})),a.on("mediaupdatetimeout",(function(){a.refreshMedia_(a.media().id)})),a.state="HAVE_NOTHING",a.loadedPlaylists_={},a.logger_=id("DashPlaylistLoader"),a.isMaster_?(a.masterPlaylistLoader_.srcUrl=t,a.masterPlaylistLoader_.sidxMapping_={}):a.childPlaylist_=t,a}oe(t,e);var i=t.prototype;return i.requestErrored_=function(e,t,i){return!this.request||(this.request=null,e?(this.error="object"!==u(e)||e instanceof Error?{status:t.status,message:"DASH request error at URL: "+t.uri,response:t.response,code:2}:e,i&&(this.state=i),this.trigger("error"),!0):void 0)},i.addSidxSegments_=function(e,t,i){var n=this,r=e.sidx&&kr(e.sidx);if(e.sidx&&r&&!this.masterPlaylistLoader_.sidxMapping_[r]){var a=td(this.handleManifestRedirects,e.sidx.resolvedUri),s=function(a,s){if(!n.requestErrored_(a,s,t)){var o,u=n.masterPlaylistLoader_.sidxMapping_;try{o=na(Bt(s.response).subarray(8))}catch(e){return void n.requestErrored_(e,s,t)}return u[r]={sidxInfo:e.sidx,sidx:o},yr(e,o,e.sidx.resolvedUri),i(!0)}};this.request=oh(a,this.vhs_.xhr,(function(t,i,r,o){if(t)return s(t,i);if(!r||"mp4"!==r)return s({status:i.status,message:"Unsupported "+(r||"unknown")+" container type for sidx segment at URL: "+a,response:"",playlist:e,internal:!0,blacklistDuration:1/0,code:2},i);var u=e.sidx.byterange,l=u.offset,c=u.length;if(o.length>=c+l)return s(t,{response:o.subarray(l,l+c),status:i.status,uri:i.uri});n.request=n.vhs_.xhr({uri:a,responseType:"arraybuffer",headers:Yd({byterange:e.sidx.byterange})},s)}))}else this.mediaRequest_=d.setTimeout((function(){return i(!1)}),0)},i.dispose=function(){this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},d.clearTimeout(this.minimumUpdatePeriodTimeout_),d.clearTimeout(this.mediaRequest_),d.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.mediaRequest_=null,this.minimumUpdatePeriodTimeout_=null,this.masterPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.masterPlaylistLoader_.createMupOnMedia_),this.masterPlaylistLoader_.createMupOnMedia_=null),this.off()},i.hasPendingRequest=function(){return this.request||this.mediaRequest_},i.stopRequest=function(){if(this.request){var e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}},i.media=function(e){var t=this;if(!e)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);var i=this.state;if("string"==typeof e){if(!this.masterPlaylistLoader_.master.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.masterPlaylistLoader_.master.playlists[e]}var n=!this.media_||e.id!==this.media_.id;if(n&&this.loadedPlaylists_[e.id]&&this.loadedPlaylists_[e.id].endList)return this.state="HAVE_METADATA",this.media_=e,void(n&&(this.trigger("mediachanging"),this.trigger("mediachange")));n&&(this.media_&&this.trigger("mediachanging"),this.addSidxSegments_(e,i,(function(n){t.haveMetadata({startingState:i,playlist:e})})))},i.haveMetadata=function(e){var t=e.startingState,i=e.playlist;this.state="HAVE_METADATA",this.loadedPlaylists_[i.id]=i,this.mediaRequest_=null,this.refreshMedia_(i.id),"HAVE_MASTER"===t?this.trigger("loadedmetadata"):this.trigger("mediachange")},i.pause=function(){this.masterPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.masterPlaylistLoader_.createMupOnMedia_),this.masterPlaylistLoader_.createMupOnMedia_=null),this.stopRequest(),d.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMaster_&&(d.clearTimeout(this.masterPlaylistLoader_.minimumUpdatePeriodTimeout_),this.masterPlaylistLoader_.minimumUpdatePeriodTimeout_=null),"HAVE_NOTHING"===this.state&&(this.started=!1)},i.load=function(e){var t=this;d.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;var i=this.media();if(e){var n=i?i.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=d.setTimeout((function(){return t.load()}),n)}else this.started?i&&!i.endList?(this.isMaster_&&!this.minimumUpdatePeriodTimeout_&&(this.trigger("minimumUpdatePeriod"),this.updateMinimumUpdatePeriodTimeout_()),this.trigger("mediaupdatetimeout")):this.trigger("loadedplaylist"):this.start()},i.start=function(){var e=this;this.started=!0,this.isMaster_?this.requestMaster_((function(t,i){e.haveMaster_(),e.hasPendingRequest()||e.media_||e.media(e.masterPlaylistLoader_.master.playlists[0])})):this.mediaRequest_=d.setTimeout((function(){return e.haveMaster_()}),0)},i.requestMaster_=function(e){var t=this;this.request=this.vhs_.xhr({uri:this.masterPlaylistLoader_.srcUrl,withCredentials:this.withCredentials},(function(i,n){if(!t.requestErrored_(i,n)){var r=n.responseText!==t.masterPlaylistLoader_.masterXml_;return t.masterPlaylistLoader_.masterXml_=n.responseText,n.responseHeaders&&n.responseHeaders.date?t.masterLoaded_=Date.parse(n.responseHeaders.date):t.masterLoaded_=Date.now(),t.masterPlaylistLoader_.srcUrl=td(t.handleManifestRedirects,t.masterPlaylistLoader_.srcUrl,n),r?(t.handleMaster_(),void t.syncClientServerClock_((function(){return e(n,r)}))):e(n,r)}"HAVE_NOTHING"===t.state&&(t.started=!1)}))},i.syncClientServerClock_=function(e){var t=this,i=ea(this.masterPlaylistLoader_.masterXml_);return null===i?(this.masterPlaylistLoader_.clientOffset_=this.masterLoaded_-Date.now(),e()):"DIRECT"===i.method?(this.masterPlaylistLoader_.clientOffset_=i.value-Date.now(),e()):void(this.request=this.vhs_.xhr({uri:ed(this.masterPlaylistLoader_.srcUrl,i.value),method:i.method,withCredentials:this.withCredentials},(function(n,r){if(t.request){if(n)return t.masterPlaylistLoader_.clientOffset_=t.masterLoaded_-Date.now(),e();var a;a="HEAD"===i.method?r.responseHeaders&&r.responseHeaders.date?Date.parse(r.responseHeaders.date):t.masterLoaded_:Date.parse(r.responseText),t.masterPlaylistLoader_.clientOffset_=a-Date.now(),e()}})))},i.haveMaster_=function(){this.state="HAVE_MASTER",this.isMaster_?this.trigger("loadedplaylist"):this.media_||this.media(this.childPlaylist_)},i.handleMaster_=function(){this.mediaRequest_=null;var e,t,i,n,r,a,s,o=this.masterPlaylistLoader_.master,u=(e={masterXml:this.masterPlaylistLoader_.masterXml_,srcUrl:this.masterPlaylistLoader_.srcUrl,clientOffset:this.masterPlaylistLoader_.clientOffset_,sidxMapping:this.masterPlaylistLoader_.sidxMapping_,previousManifest:o},t=e.masterXml,i=e.srcUrl,n=e.clientOffset,r=e.sidxMapping,a=e.previousManifest,s=Zr(t,{manifestUri:i,clientOffset:n,sidxMapping:r,previousManifest:a}),Rd(s,i),s);o&&(u=function(e,t,i){for(var n=!0,r=lh(e,{duration:t.duration,minimumUpdatePeriod:t.minimumUpdatePeriod,timelineStarts:t.timelineStarts}),a=0;a<t.playlists.length;a++){var s=t.playlists[a];if(s.sidx){var o=kr(s.sidx);i&&i[o]&&i[o].sidx&&yr(s,i[o].sidx,s.sidx.resolvedUri)}var u=Vd(r,s,ch);u&&(r=u,n=!1)}return Od(t,(function(e,t,i,a){if(e.playlists&&e.playlists.length){var s=e.playlists[0].id,o=Vd(r,e.playlists[0],ch);o&&((r=o).mediaGroups[t][i][a].playlists[0]=r.playlists[s],n=!1)}})),t.minimumUpdatePeriod!==e.minimumUpdatePeriod&&(n=!1),n?null:r}(o,u,this.masterPlaylistLoader_.sidxMapping_)),this.masterPlaylistLoader_.master=u||o;var l=this.masterPlaylistLoader_.master.locations&&this.masterPlaylistLoader_.master.locations[0];return l&&l!==this.masterPlaylistLoader_.srcUrl&&(this.masterPlaylistLoader_.srcUrl=l),(!o||u&&u.minimumUpdatePeriod!==o.minimumUpdatePeriod)&&this.updateMinimumUpdatePeriodTimeout_(),Boolean(u)},i.updateMinimumUpdatePeriodTimeout_=function(){var e=this.masterPlaylistLoader_;e.createMupOnMedia_&&(e.off("loadedmetadata",e.createMupOnMedia_),e.createMupOnMedia_=null),e.minimumUpdatePeriodTimeout_&&(d.clearTimeout(e.minimumUpdatePeriodTimeout_),e.minimumUpdatePeriodTimeout_=null);var t=e.master&&e.master.minimumUpdatePeriod;0===t&&(e.media()?t=1e3*e.media().targetDuration:(e.createMupOnMedia_=e.updateMinimumUpdatePeriodTimeout_,e.one("loadedmetadata",e.createMupOnMedia_))),"number"!=typeof t||t<=0?t<0&&this.logger_("found invalid minimumUpdatePeriod of "+t+", not setting a timeout"):this.createMUPTimeout_(t)},i.createMUPTimeout_=function(e){var t=this.masterPlaylistLoader_;t.minimumUpdatePeriodTimeout_=d.setTimeout((function(){t.minimumUpdatePeriodTimeout_=null,t.trigger("minimumUpdatePeriod"),t.createMUPTimeout_(e)}),e)},i.refreshXml_=function(){var e=this;this.requestMaster_((function(t,i){var n,r,a;i&&(e.media_&&(e.media_=e.masterPlaylistLoader_.master.playlists[e.media_.id]),e.masterPlaylistLoader_.sidxMapping_=(n=e.masterPlaylistLoader_.master,r=e.masterPlaylistLoader_.sidxMapping_,a=hh(n.playlists,r),Od(n,(function(e,t,i,n){if(e.playlists&&e.playlists.length){var s=e.playlists;a=lh(a,hh(s,r))}})),a),e.addSidxSegments_(e.media(),e.state,(function(t){e.refreshMedia_(e.media().id)})))}))},i.refreshMedia_=function(e){var t=this;if(!e)throw new Error("refreshMedia_ must take a media id");this.media_&&this.isMaster_&&this.handleMaster_();var i=this.masterPlaylistLoader_.master.playlists,n=!this.media_||this.media_!==i[e];if(n?this.media_=i[e]:this.trigger("playlistunchanged"),!this.mediaUpdateTimeout){!function e(){t.media().endList||(t.mediaUpdateTimeout=d.setTimeout((function(){t.trigger("mediaupdatetimeout"),e()}),Hd(t.media(),Boolean(n))))}()}this.trigger("loadedplaylist")},t}(uh),fh={GOAL_BUFFER_LENGTH:30,MAX_GOAL_BUFFER_LENGTH:60,BACK_BUFFER_LENGTH:30,GOAL_BUFFER_LENGTH_RATE:1,INITIAL_BANDWIDTH:4194304,BANDWIDTH_VARIANCE:1.2,BUFFER_LOW_WATER_LINE:0,MAX_BUFFER_LOW_WATER_LINE:30,EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:16,BUFFER_LOW_WATER_LINE_RATE:1,BUFFER_HIGH_WATER_LINE:30},mh=function(e){return e.on=e.addEventListener,e.off=e.removeEventListener,e},gh=function(e){return function(){var t=function(e){try{return URL.createObjectURL(new Blob([e],{type:"application/javascript"}))}catch(i){var t=new BlobBuilder;return t.append(e),URL.createObjectURL(t.getBlob())}}(e),i=mh(new Worker(t));i.objURL=t;var n=i.terminate;return i.on=i.addEventListener,i.off=i.removeEventListener,i.terminate=function(){return URL.revokeObjectURL(t),n.call(this)},i}},vh=function(e){return"var browserWorkerPolyFill = "+mh.toString()+";\nbrowserWorkerPolyFill(self);\n"+e},yh=function(e){return e.toString().replace(/^function.+?{/,"").slice(0,-1)},_h=vh(yh((function(){var e=function(){this.init=function(){var e={};this.on=function(t,i){e[t]||(e[t]=[]),e[t]=e[t].concat(i)},this.off=function(t,i){var n;return!!e[t]&&(n=e[t].indexOf(i),e[t]=e[t].slice(),e[t].splice(n,1),n>-1)},this.trigger=function(t){var i,n,r,a;if(i=e[t])if(2===arguments.length)for(r=i.length,n=0;n<r;++n)i[n].call(this,arguments[1]);else{for(a=[],n=arguments.length,n=1;n<arguments.length;++n)a.push(arguments[n]);for(r=i.length,n=0;n<r;++n)i[n].apply(this,a)}},this.dispose=function(){e={}}}};e.prototype.pipe=function(e){return this.on("data",(function(t){e.push(t)})),this.on("done",(function(t){e.flush(t)})),this.on("partialdone",(function(t){e.partialFlush(t)})),this.on("endedtimeline",(function(t){e.endTimeline(t)})),this.on("reset",(function(t){e.reset(t)})),e},e.prototype.push=function(e){this.trigger("data",e)},e.prototype.flush=function(e){this.trigger("done",e)},e.prototype.partialFlush=function(e){this.trigger("partialdone",e)},e.prototype.endTimeline=function(e){this.trigger("endedtimeline",e)},e.prototype.reset=function(e){this.trigger("reset",e)};var t,i,n,r,a,s,o,l,c,d,h,p,f,m,g,v,y,_,b,T,S,E,w,k,C,x,I,A,P,L,D,O,N,R,M,U,B,F,j,q,V=e,H=Math.pow(2,32),W={getUint64:function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.getBigUint64?(t=i.getBigUint64(0))<Number.MAX_SAFE_INTEGER?Number(t):t:i.getUint32(0)*H+i.getUint32(4)},MAX_UINT32:H},G=W.MAX_UINT32;!function(){var e;if(E={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],pasp:[],sdtp:[],smhd:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],styp:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[]},"undefined"!=typeof Uint8Array){for(e in E)E.hasOwnProperty(e)&&(E[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);w=new Uint8Array(["i".charCodeAt(0),"s".charCodeAt(0),"o".charCodeAt(0),"m".charCodeAt(0)]),C=new Uint8Array(["a".charCodeAt(0),"v".charCodeAt(0),"c".charCodeAt(0),"1".charCodeAt(0)]),k=new Uint8Array([0,0,0,1]),x=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]),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]),A={video:x,audio:I},D=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),L=new Uint8Array([0,0,0,0,0,0,0,0]),O=new Uint8Array([0,0,0,0,0,0,0,0]),N=O,R=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),M=O,P=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}}(),t=function(e){var t,i,n=[],r=0;for(t=1;t<arguments.length;t++)n.push(arguments[t]);for(t=n.length;t--;)r+=n[t].byteLength;for(i=new Uint8Array(r+8),new DataView(i.buffer,i.byteOffset,i.byteLength).setUint32(0,i.byteLength),i.set(e,4),t=0,r=8;t<n.length;t++)i.set(n[t],r),r+=n[t].byteLength;return i},i=function(){return t(E.dinf,t(E.dref,D))},n=function(e){return t(E.esds,new Uint8Array([0,0,0,0,3,25,0,0,0,4,17,64,21,0,6,0,0,0,218,192,0,0,218,192,5,2,e.audioobjecttype<<3|e.samplingfrequencyindex>>>1,e.samplingfrequencyindex<<7|e.channelcount<<3,6,1,2]))},g=function(e){return t(E.hdlr,A[e])},m=function(e){var i=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,e.duration>>>24&255,e.duration>>>16&255,e.duration>>>8&255,255&e.duration,85,196,0,0]);return e.samplerate&&(i[12]=e.samplerate>>>24&255,i[13]=e.samplerate>>>16&255,i[14]=e.samplerate>>>8&255,i[15]=255&e.samplerate),t(E.mdhd,i)},f=function(e){return t(E.mdia,m(e),g(e.type),s(e))},a=function(e){return t(E.mfhd,new Uint8Array([0,0,0,0,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e]))},s=function(e){return t(E.minf,"video"===e.type?t(E.vmhd,P):t(E.smhd,L),i(),y(e))},o=function(e,i){for(var n=[],r=i.length;r--;)n[r]=b(i[r]);return t.apply(null,[E.moof,a(e)].concat(n))},l=function(e){for(var i=e.length,n=[];i--;)n[i]=h(e[i]);return t.apply(null,[E.moov,d(4294967295)].concat(n).concat(c(e)))},c=function(e){for(var i=e.length,n=[];i--;)n[i]=T(e[i]);return t.apply(null,[E.mvex].concat(n))},d=function(e){var i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e,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(E.mvhd,i)},v=function(e){var i,n,r=e.samples||[],a=new Uint8Array(4+r.length);for(n=0;n<r.length;n++)i=r[n].flags,a[n+4]=i.dependsOn<<4|i.isDependedOn<<2|i.hasRedundancy;return t(E.sdtp,a)},y=function(e){return t(E.stbl,_(e),t(E.stts,M),t(E.stsc,N),t(E.stsz,R),t(E.stco,O))},_=function(e){return t(E.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),"video"===e.type?U(e):B(e))},U=function(e){var i,n,r=e.sps||[],a=e.pps||[],s=[],o=[];for(i=0;i<r.length;i++)s.push((65280&r[i].byteLength)>>>8),s.push(255&r[i].byteLength),s=s.concat(Array.prototype.slice.call(r[i]));for(i=0;i<a.length;i++)o.push((65280&a[i].byteLength)>>>8),o.push(255&a[i].byteLength),o=o.concat(Array.prototype.slice.call(a[i]));if(n=[E.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,(65280&e.width)>>8,255&e.width,(65280&e.height)>>8,255&e.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),t(E.avcC,new Uint8Array([1,e.profileIdc,e.profileCompatibility,e.levelIdc,255].concat([r.length],s,[a.length],o))),t(E.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],e.sarRatio){var u=e.sarRatio[0],l=e.sarRatio[1];n.push(t(E.pasp,new Uint8Array([(4278190080&u)>>24,(16711680&u)>>16,(65280&u)>>8,255&u,(4278190080&l)>>24,(16711680&l)>>16,(65280&l)>>8,255&l])))}return t.apply(null,n)},B=function(e){return t(E.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(65280&e.channelcount)>>8,255&e.channelcount,(65280&e.samplesize)>>8,255&e.samplesize,0,0,0,0,(65280&e.samplerate)>>8,255&e.samplerate,0,0]),n(e))},p=function(e){var i=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,0,(4278190080&e.duration)>>24,(16711680&e.duration)>>16,(65280&e.duration)>>8,255&e.duration,0,0,0,0,0,0,0,0,0,0,0,0,1,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,(65280&e.width)>>8,255&e.width,0,0,(65280&e.height)>>8,255&e.height,0,0]);return t(E.tkhd,i)},b=function(e){var i,n,r,a,s,o;return i=t(E.tfhd,new Uint8Array([0,0,0,58,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),s=Math.floor(e.baseMediaDecodeTime/G),o=Math.floor(e.baseMediaDecodeTime%G),n=t(E.tfdt,new Uint8Array([1,0,0,0,s>>>24&255,s>>>16&255,s>>>8&255,255&s,o>>>24&255,o>>>16&255,o>>>8&255,255&o])),"audio"===e.type?(r=S(e,92),t(E.traf,i,n,r)):(a=v(e),r=S(e,a.length+92),t(E.traf,i,n,r,a))},h=function(e){return e.duration=e.duration||4294967295,t(E.trak,p(e),f(e))},T=function(e){var i=new Uint8Array([0,0,0,0,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return"video"!==e.type&&(i[i.length-1]=0),t(E.trex,i)},q=function(e,t){var i=0,n=0,r=0,a=0;return e.length&&(void 0!==e[0].duration&&(i=1),void 0!==e[0].size&&(n=2),void 0!==e[0].flags&&(r=4),void 0!==e[0].compositionTimeOffset&&(a=8)),[0,0,i|n|r|a,1,(4278190080&e.length)>>>24,(16711680&e.length)>>>16,(65280&e.length)>>>8,255&e.length,(4278190080&t)>>>24,(16711680&t)>>>16,(65280&t)>>>8,255&t]},j=function(e,i){var n,r,a,s,o,u;for(i+=20+16*(s=e.samples||[]).length,a=q(s,i),(r=new Uint8Array(a.length+16*s.length)).set(a),n=a.length,u=0;u<s.length;u++)o=s[u],r[n++]=(4278190080&o.duration)>>>24,r[n++]=(16711680&o.duration)>>>16,r[n++]=(65280&o.duration)>>>8,r[n++]=255&o.duration,r[n++]=(4278190080&o.size)>>>24,r[n++]=(16711680&o.size)>>>16,r[n++]=(65280&o.size)>>>8,r[n++]=255&o.size,r[n++]=o.flags.isLeading<<2|o.flags.dependsOn,r[n++]=o.flags.isDependedOn<<6|o.flags.hasRedundancy<<4|o.flags.paddingValue<<1|o.flags.isNonSyncSample,r[n++]=61440&o.flags.degradationPriority,r[n++]=15&o.flags.degradationPriority,r[n++]=(4278190080&o.compositionTimeOffset)>>>24,r[n++]=(16711680&o.compositionTimeOffset)>>>16,r[n++]=(65280&o.compositionTimeOffset)>>>8,r[n++]=255&o.compositionTimeOffset;return t(E.trun,r)},F=function(e,i){var n,r,a,s,o,u;for(i+=20+8*(s=e.samples||[]).length,a=q(s,i),(n=new Uint8Array(a.length+8*s.length)).set(a),r=a.length,u=0;u<s.length;u++)o=s[u],n[r++]=(4278190080&o.duration)>>>24,n[r++]=(16711680&o.duration)>>>16,n[r++]=(65280&o.duration)>>>8,n[r++]=255&o.duration,n[r++]=(4278190080&o.size)>>>24,n[r++]=(16711680&o.size)>>>16,n[r++]=(65280&o.size)>>>8,n[r++]=255&o.size;return t(E.trun,n)},S=function(e,t){return"audio"===e.type?F(e,t):j(e,t)};r=function(){return t(E.ftyp,w,k,w,C)};var z,X,K,Y,Q,$,J,Z,ee=function(e){return t(E.mdat,e)},te=o,ie=function(e){var t,i=r(),n=l(e);return(t=new Uint8Array(i.byteLength+n.byteLength)).set(i),t.set(n,i.byteLength),t},ne=function(e,t){var i={size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}};return i.dataOffset=t,i.compositionTimeOffset=e.pts-e.dts,i.duration=e.duration,i.size=4*e.length,i.size+=e.byteLength,e.keyFrame&&(i.flags.dependsOn=2,i.flags.isNonSyncSample=0),i},re=function(e){var t,i,n=[],r=[];for(r.byteLength=0,r.nalCount=0,r.duration=0,n.byteLength=0,t=0;t<e.length;t++)"access_unit_delimiter_rbsp"===(i=e[t]).nalUnitType?(n.length&&(n.duration=i.dts-n.dts,r.byteLength+=n.byteLength,r.nalCount+=n.length,r.duration+=n.duration,r.push(n)),(n=[i]).byteLength=i.data.byteLength,n.pts=i.pts,n.dts=i.dts):("slice_layer_without_partitioning_rbsp_idr"===i.nalUnitType&&(n.keyFrame=!0),n.duration=i.dts-n.dts,n.byteLength+=i.data.byteLength,n.push(i));return r.length&&(!n.duration||n.duration<=0)&&(n.duration=r[r.length-1].duration),r.byteLength+=n.byteLength,r.nalCount+=n.length,r.duration+=n.duration,r.push(n),r},ae=function(e){var t,i,n=[],r=[];for(n.byteLength=0,n.nalCount=0,n.duration=0,n.pts=e[0].pts,n.dts=e[0].dts,r.byteLength=0,r.nalCount=0,r.duration=0,r.pts=e[0].pts,r.dts=e[0].dts,t=0;t<e.length;t++)(i=e[t]).keyFrame?(n.length&&(r.push(n),r.byteLength+=n.byteLength,r.nalCount+=n.nalCount,r.duration+=n.duration),(n=[i]).nalCount=i.length,n.byteLength=i.byteLength,n.pts=i.pts,n.dts=i.dts,n.duration=i.duration):(n.duration+=i.duration,n.nalCount+=i.length,n.byteLength+=i.byteLength,n.push(i));return r.length&&n.duration<=0&&(n.duration=r[r.length-1].duration),r.byteLength+=n.byteLength,r.nalCount+=n.nalCount,r.duration+=n.duration,r.push(n),r},se=function(e){var t;return!e[0][0].keyFrame&&e.length>1&&(t=e.shift(),e.byteLength-=t.byteLength,e.nalCount-=t.nalCount,e[0][0].dts=t.dts,e[0][0].pts=t.pts,e[0][0].duration+=t.duration),e},oe=function(e,t){var i,n,r,a,s,o=t||0,u=[];for(i=0;i<e.length;i++)for(a=e[i],n=0;n<a.length;n++)s=a[n],o+=(r=ne(s,o)).size,u.push(r);return u},ue=function(e){var t,i,n,r,a,s,o=0,u=e.byteLength,l=e.nalCount,c=new Uint8Array(u+4*l),d=new DataView(c.buffer);for(t=0;t<e.length;t++)for(r=e[t],i=0;i<r.length;i++)for(a=r[i],n=0;n<a.length;n++)s=a[n],d.setUint32(o,s.data.byteLength),o+=4,c.set(s.data,o),o+=s.data.byteLength;return c},le=[33,16,5,32,164,27],ce=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],de=function(e){for(var t=[];e--;)t.push(0);return t},he=function(){if(!z){var e={96e3:[le,[227,64],de(154),[56]],88200:[le,[231],de(170),[56]],64e3:[le,[248,192],de(240),[56]],48e3:[le,[255,192],de(268),[55,148,128],de(54),[112]],44100:[le,[255,192],de(268),[55,163,128],de(84),[112]],32e3:[le,[255,192],de(268),[55,234],de(226),[112]],24e3:[le,[255,192],de(268),[55,255,128],de(268),[111,112],de(126),[224]],16e3:[le,[255,192],de(268),[55,255,128],de(268),[111,255],de(269),[223,108],de(195),[1,192]],12e3:[ce,de(268),[3,127,248],de(268),[6,255,240],de(268),[13,255,224],de(268),[27,253,128],de(259),[56]],11025:[ce,de(268),[3,127,248],de(268),[6,255,240],de(268),[13,255,224],de(268),[27,255,192],de(268),[55,175,128],de(108),[112]],8e3:[ce,de(268),[3,121,16],de(47),[7]]};t=e,z=Object.keys(t).reduce((function(e,i){return e[i]=new Uint8Array(t[i].reduce((function(e,t){return e.concat(t)}),[])),e}),{})}var t;return z},pe=9e4;$=function(e,t){return X(Q(e,t))},J=function(e,t){return K(Y(e),t)},Z=function(e,t,i){return Y(i?e:e-t)};var fe=pe,me=X=function(e){return e*pe},ge=(K=function(e,t){return e*t},Y=function(e){return e/pe}),ve=(Q=function(e,t){return e/t},$),ye=J,_e=Z,be=function(e,t,i,n){var r,a,s,o,u,l=0,c=0,d=0;if(t.length&&(r=ve(e.baseMediaDecodeTime,e.samplerate),a=Math.ceil(fe/(e.samplerate/1024)),i&&n&&(l=r-Math.max(i,n),d=(c=Math.floor(l/a))*a),!(c<1||d>fe/2))){for((s=he()[e.samplerate])||(s=t[0].data),o=0;o<c;o++)u=t[0],t.splice(0,0,{data:s,dts:u.dts-a,pts:u.pts-a});return e.baseMediaDecodeTime-=Math.floor(ye(d,e.samplerate)),d}},Te=function(e,t,i){return t.minSegmentDts>=i?e:(t.minSegmentDts=1/0,e.filter((function(e){return e.dts>=i&&(t.minSegmentDts=Math.min(t.minSegmentDts,e.dts),t.minSegmentPts=t.minSegmentDts,!0)})))},Se=function(e){var t,i,n=[];for(t=0;t<e.length;t++)i=e[t],n.push({size:i.data.byteLength,duration:1024});return n},Ee=function(e){var t,i,n=0,r=new Uint8Array(function(e){var t,i=0;for(t=0;t<e.length;t++)i+=e[t].data.byteLength;return i}(e));for(t=0;t<e.length;t++)i=e[t],r.set(i.data,n),n+=i.data.byteLength;return r},we=fe,ke=function(e){delete e.minSegmentDts,delete e.maxSegmentDts,delete e.minSegmentPts,delete e.maxSegmentPts},Ce=function(e,t){var i,n=e.minSegmentDts;return t||(n-=e.timelineStartInfo.dts),i=e.timelineStartInfo.baseMediaDecodeTime,i+=n,i=Math.max(0,i),"audio"===e.type&&(i*=e.samplerate/we,i=Math.floor(i)),i},xe=function(e,t){"number"==typeof t.pts&&(void 0===e.timelineStartInfo.pts&&(e.timelineStartInfo.pts=t.pts),void 0===e.minSegmentPts?e.minSegmentPts=t.pts:e.minSegmentPts=Math.min(e.minSegmentPts,t.pts),void 0===e.maxSegmentPts?e.maxSegmentPts=t.pts:e.maxSegmentPts=Math.max(e.maxSegmentPts,t.pts)),"number"==typeof t.dts&&(void 0===e.timelineStartInfo.dts&&(e.timelineStartInfo.dts=t.dts),void 0===e.minSegmentDts?e.minSegmentDts=t.dts:e.minSegmentDts=Math.min(e.minSegmentDts,t.dts),void 0===e.maxSegmentDts?e.maxSegmentDts=t.dts:e.maxSegmentDts=Math.max(e.maxSegmentDts,t.dts))},Ie=function(e){for(var t=0,i={payloadType:-1,payloadSize:0},n=0,r=0;t<e.byteLength&&128!==e[t];){for(;255===e[t];)n+=255,t++;for(n+=e[t++];255===e[t];)r+=255,t++;if(r+=e[t++],!i.payload&&4===n){if("GA94"===String.fromCharCode(e[t+3],e[t+4],e[t+5],e[t+6])){i.payloadType=n,i.payloadSize=r,i.payload=e.subarray(t,t+r);break}i.payload=void 0}t+=r,n=0,r=0}return i},Ae=function(e){return 181!==e.payload[0]||49!=(e.payload[1]<<8|e.payload[2])||"GA94"!==String.fromCharCode(e.payload[3],e.payload[4],e.payload[5],e.payload[6])||3!==e.payload[7]?null:e.payload.subarray(8,e.payload.length-1)},Pe=function(e,t){var i,n,r,a,s=[];if(!(64&t[0]))return s;for(n=31&t[0],i=0;i<n;i++)a={type:3&t[(r=3*i)+2],pts:e},4&t[r+2]&&(a.ccData=t[r+3]<<8|t[r+4],s.push(a));return s},Le=function(e){for(var t,i,n=e.byteLength,r=[],a=1;a<n-2;)0===e[a]&&0===e[a+1]&&3===e[a+2]?(r.push(a+2),a+=2):a++;if(0===r.length)return e;t=n-r.length,i=new Uint8Array(t);var s=0;for(a=0;a<t;s++,a++)s===r[0]&&(s++,r.shift()),i[a]=e[s];return i},De=4,Oe=function e(t){t=t||{},e.prototype.init.call(this),this.parse708captions_="boolean"!=typeof t.parse708captions||t.parse708captions,this.captionPackets_=[],this.ccStreams_=[new He(0,0),new He(0,1),new He(1,0),new He(1,1)],this.parse708captions_&&(this.cc708Stream_=new Be({captionServices:t.captionServices})),this.reset(),this.ccStreams_.forEach((function(e){e.on("data",this.trigger.bind(this,"data")),e.on("partialdone",this.trigger.bind(this,"partialdone")),e.on("done",this.trigger.bind(this,"done"))}),this),this.parse708captions_&&(this.cc708Stream_.on("data",this.trigger.bind(this,"data")),this.cc708Stream_.on("partialdone",this.trigger.bind(this,"partialdone")),this.cc708Stream_.on("done",this.trigger.bind(this,"done")))};(Oe.prototype=new V).push=function(e){var t,i,n;if("sei_rbsp"===e.nalUnitType&&(t=Ie(e.escapedRBSP)).payload&&t.payloadType===De&&(i=Ae(t)))if(e.dts<this.latestDts_)this.ignoreNextEqualDts_=!0;else{if(e.dts===this.latestDts_&&this.ignoreNextEqualDts_)return this.numSameDts_--,void(this.numSameDts_||(this.ignoreNextEqualDts_=!1));n=Pe(e.pts,i),this.captionPackets_=this.captionPackets_.concat(n),this.latestDts_!==e.dts&&(this.numSameDts_=0),this.numSameDts_++,this.latestDts_=e.dts}},Oe.prototype.flushCCStreams=function(e){this.ccStreams_.forEach((function(t){return"flush"===e?t.flush():t.partialFlush()}),this)},Oe.prototype.flushStream=function(e){this.captionPackets_.length?(this.captionPackets_.forEach((function(e,t){e.presortIndex=t})),this.captionPackets_.sort((function(e,t){return e.pts===t.pts?e.presortIndex-t.presortIndex:e.pts-t.pts})),this.captionPackets_.forEach((function(e){e.type<2?this.dispatchCea608Packet(e):this.dispatchCea708Packet(e)}),this),this.captionPackets_.length=0,this.flushCCStreams(e)):this.flushCCStreams(e)},Oe.prototype.flush=function(){return this.flushStream("flush")},Oe.prototype.partialFlush=function(){return this.flushStream("partialFlush")},Oe.prototype.reset=function(){this.latestDts_=null,this.ignoreNextEqualDts_=!1,this.numSameDts_=0,this.activeCea608Channel_=[null,null],this.ccStreams_.forEach((function(e){e.reset()}))},Oe.prototype.dispatchCea608Packet=function(e){this.setsTextOrXDSActive(e)?this.activeCea608Channel_[e.type]=null:this.setsChannel1Active(e)?this.activeCea608Channel_[e.type]=0:this.setsChannel2Active(e)&&(this.activeCea608Channel_[e.type]=1),null!==this.activeCea608Channel_[e.type]&&this.ccStreams_[(e.type<<1)+this.activeCea608Channel_[e.type]].push(e)},Oe.prototype.setsChannel1Active=function(e){return 4096==(30720&e.ccData)},Oe.prototype.setsChannel2Active=function(e){return 6144==(30720&e.ccData)},Oe.prototype.setsTextOrXDSActive=function(e){return 256==(28928&e.ccData)||4138==(30974&e.ccData)||6186==(30974&e.ccData)},Oe.prototype.dispatchCea708Packet=function(e){this.parse708captions_&&this.cc708Stream_.push(e)};var Ne={127:9834,4128:32,4129:160,4133:8230,4138:352,4140:338,4144:9608,4145:8216,4146:8217,4147:8220,4148:8221,4149:8226,4153:8482,4154:353,4156:339,4157:8480,4159:376,4214:8539,4215:8540,4216:8541,4217:8542,4218:9168,4219:9124,4220:9123,4221:9135,4222:9126,4223:9121,4256:12600},Re=function(e){return 32<=e&&e<=127||160<=e&&e<=255},Me=function(e){this.windowNum=e,this.reset()};Me.prototype.reset=function(){this.clearText(),this.pendingNewLine=!1,this.winAttr={},this.penAttr={},this.penLoc={},this.penColor={},this.visible=0,this.rowLock=0,this.columnLock=0,this.priority=0,this.relativePositioning=0,this.anchorVertical=0,this.anchorHorizontal=0,this.anchorPoint=0,this.rowCount=1,this.virtualRowCount=this.rowCount+1,this.columnCount=41,this.windowStyle=0,this.penStyle=0},Me.prototype.getText=function(){return this.rows.join("\n")},Me.prototype.clearText=function(){this.rows=[""],this.rowIdx=0},Me.prototype.newLine=function(e){for(this.rows.length>=this.virtualRowCount&&"function"==typeof this.beforeRowOverflow&&this.beforeRowOverflow(e),this.rows.length>0&&(this.rows.push(""),this.rowIdx++);this.rows.length>this.virtualRowCount;)this.rows.shift(),this.rowIdx--},Me.prototype.isEmpty=function(){return 0===this.rows.length||1===this.rows.length&&""===this.rows[0]},Me.prototype.addText=function(e){this.rows[this.rowIdx]+=e},Me.prototype.backspace=function(){if(!this.isEmpty()){var e=this.rows[this.rowIdx];this.rows[this.rowIdx]=e.substr(0,e.length-1)}};var Ue=function(e,t,i){this.serviceNum=e,this.text="",this.currentWindow=new Me(-1),this.windows=[],this.stream=i,"string"==typeof t&&this.createTextDecoder(t)};Ue.prototype.init=function(e,t){this.startPts=e;for(var i=0;i<8;i++)this.windows[i]=new Me(i),"function"==typeof t&&(this.windows[i].beforeRowOverflow=t)},Ue.prototype.setCurrentWindow=function(e){this.currentWindow=this.windows[e]},Ue.prototype.createTextDecoder=function(e){if("undefined"==typeof TextDecoder)this.stream.trigger("log",{level:"warn",message:"The `encoding` option is unsupported without TextDecoder support"});else try{this.textDecoder_=new TextDecoder(e)}catch(t){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+e+" encoding. "+t})}};var Be=function e(t){t=t||{},e.prototype.init.call(this);var i,n=this,r=t.captionServices||{},a={};Object.keys(r).forEach((function(e){i=r[e],/^SERVICE/.test(e)&&(a[e]=i.encoding)})),this.serviceEncodings=a,this.current708Packet=null,this.services={},this.push=function(e){3===e.type?(n.new708Packet(),n.add708Bytes(e)):(null===n.current708Packet&&n.new708Packet(),n.add708Bytes(e))}};Be.prototype=new V,Be.prototype.new708Packet=function(){null!==this.current708Packet&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},Be.prototype.add708Bytes=function(e){var t=e.ccData,i=t>>>8,n=255&t;this.current708Packet.ptsVals.push(e.pts),this.current708Packet.data.push(i),this.current708Packet.data.push(n)},Be.prototype.push708Packet=function(){var e=this.current708Packet,t=e.data,i=null,n=null,r=0,a=t[r++];for(e.seq=a>>6,e.sizeCode=63&a;r<t.length;r++)n=31&(a=t[r++]),7===(i=a>>5)&&n>0&&(i=a=t[r++]),this.pushServiceBlock(i,r,n),n>0&&(r+=n-1)},Be.prototype.pushServiceBlock=function(e,t,i){var n,r=t,a=this.current708Packet.data,s=this.services[e];for(s||(s=this.initService(e,r));r<t+i&&r<a.length;r++)n=a[r],Re(n)?r=this.handleText(r,s):24===n?r=this.multiByteCharacter(r,s):16===n?r=this.extendedCommands(r,s):128<=n&&n<=135?r=this.setCurrentWindow(r,s):152<=n&&n<=159?r=this.defineWindow(r,s):136===n?r=this.clearWindows(r,s):140===n?r=this.deleteWindows(r,s):137===n?r=this.displayWindows(r,s):138===n?r=this.hideWindows(r,s):139===n?r=this.toggleWindows(r,s):151===n?r=this.setWindowAttributes(r,s):144===n?r=this.setPenAttributes(r,s):145===n?r=this.setPenColor(r,s):146===n?r=this.setPenLocation(r,s):143===n?s=this.reset(r,s):8===n?s.currentWindow.backspace():12===n?s.currentWindow.clearText():13===n?s.currentWindow.pendingNewLine=!0:14===n?s.currentWindow.clearText():141===n&&r++},Be.prototype.extendedCommands=function(e,t){var i=this.current708Packet.data[++e];return Re(i)&&(e=this.handleText(e,t,{isExtended:!0})),e},Be.prototype.getPts=function(e){return this.current708Packet.ptsVals[Math.floor(e/2)]},Be.prototype.initService=function(e,t){var i,n,r=this;return(i="SERVICE"+e)in this.serviceEncodings&&(n=this.serviceEncodings[i]),this.services[e]=new Ue(e,n,r),this.services[e].init(this.getPts(t),(function(t){r.flushDisplayed(t,r.services[e])})),this.services[e]},Be.prototype.handleText=function(e,t,i){var n,r,a,s,o=i&&i.isExtended,u=i&&i.isMultiByte,l=this.current708Packet.data,c=o?4096:0,d=l[e],h=l[e+1],p=t.currentWindow;return t.textDecoder_&&!o?(u?(r=[d,h],e++):r=[d],n=t.textDecoder_.decode(new Uint8Array(r))):(s=Ne[a=c|d]||a,n=4096&a&&a===s?"":String.fromCharCode(s)),p.pendingNewLine&&!p.isEmpty()&&p.newLine(this.getPts(e)),p.pendingNewLine=!1,p.addText(n),e},Be.prototype.multiByteCharacter=function(e,t){var i=this.current708Packet.data,n=i[e+1],r=i[e+2];return Re(n)&&Re(r)&&(e=this.handleText(++e,t,{isMultiByte:!0})),e},Be.prototype.setCurrentWindow=function(e,t){var i=7&this.current708Packet.data[e];return t.setCurrentWindow(i),e},Be.prototype.defineWindow=function(e,t){var i=this.current708Packet.data,n=i[e],r=7&n;t.setCurrentWindow(r);var a=t.currentWindow;return n=i[++e],a.visible=(32&n)>>5,a.rowLock=(16&n)>>4,a.columnLock=(8&n)>>3,a.priority=7&n,n=i[++e],a.relativePositioning=(128&n)>>7,a.anchorVertical=127&n,n=i[++e],a.anchorHorizontal=n,n=i[++e],a.anchorPoint=(240&n)>>4,a.rowCount=15&n,n=i[++e],a.columnCount=63&n,n=i[++e],a.windowStyle=(56&n)>>3,a.penStyle=7&n,a.virtualRowCount=a.rowCount+1,e},Be.prototype.setWindowAttributes=function(e,t){var i=this.current708Packet.data,n=i[e],r=t.currentWindow.winAttr;return n=i[++e],r.fillOpacity=(192&n)>>6,r.fillRed=(48&n)>>4,r.fillGreen=(12&n)>>2,r.fillBlue=3&n,n=i[++e],r.borderType=(192&n)>>6,r.borderRed=(48&n)>>4,r.borderGreen=(12&n)>>2,r.borderBlue=3&n,n=i[++e],r.borderType+=(128&n)>>5,r.wordWrap=(64&n)>>6,r.printDirection=(48&n)>>4,r.scrollDirection=(12&n)>>2,r.justify=3&n,n=i[++e],r.effectSpeed=(240&n)>>4,r.effectDirection=(12&n)>>2,r.displayEffect=3&n,e},Be.prototype.flushDisplayed=function(e,t){for(var i=[],n=0;n<8;n++)t.windows[n].visible&&!t.windows[n].isEmpty()&&i.push(t.windows[n].getText());t.endPts=e,t.text=i.join("\n\n"),this.pushCaption(t),t.startPts=e},Be.prototype.pushCaption=function(e){""!==e.text&&(this.trigger("data",{startPts:e.startPts,endPts:e.endPts,text:e.text,stream:"cc708_"+e.serviceNum}),e.text="",e.startPts=e.endPts)},Be.prototype.displayWindows=function(e,t){var i=this.current708Packet.data[++e],n=this.getPts(e);this.flushDisplayed(n,t);for(var r=0;r<8;r++)i&1<<r&&(t.windows[r].visible=1);return e},Be.prototype.hideWindows=function(e,t){var i=this.current708Packet.data[++e],n=this.getPts(e);this.flushDisplayed(n,t);for(var r=0;r<8;r++)i&1<<r&&(t.windows[r].visible=0);return e},Be.prototype.toggleWindows=function(e,t){var i=this.current708Packet.data[++e],n=this.getPts(e);this.flushDisplayed(n,t);for(var r=0;r<8;r++)i&1<<r&&(t.windows[r].visible^=1);return e},Be.prototype.clearWindows=function(e,t){var i=this.current708Packet.data[++e],n=this.getPts(e);this.flushDisplayed(n,t);for(var r=0;r<8;r++)i&1<<r&&t.windows[r].clearText();return e},Be.prototype.deleteWindows=function(e,t){var i=this.current708Packet.data[++e],n=this.getPts(e);this.flushDisplayed(n,t);for(var r=0;r<8;r++)i&1<<r&&t.windows[r].reset();return e},Be.prototype.setPenAttributes=function(e,t){var i=this.current708Packet.data,n=i[e],r=t.currentWindow.penAttr;return n=i[++e],r.textTag=(240&n)>>4,r.offset=(12&n)>>2,r.penSize=3&n,n=i[++e],r.italics=(128&n)>>7,r.underline=(64&n)>>6,r.edgeType=(56&n)>>3,r.fontStyle=7&n,e},Be.prototype.setPenColor=function(e,t){var i=this.current708Packet.data,n=i[e],r=t.currentWindow.penColor;return n=i[++e],r.fgOpacity=(192&n)>>6,r.fgRed=(48&n)>>4,r.fgGreen=(12&n)>>2,r.fgBlue=3&n,n=i[++e],r.bgOpacity=(192&n)>>6,r.bgRed=(48&n)>>4,r.bgGreen=(12&n)>>2,r.bgBlue=3&n,n=i[++e],r.edgeRed=(48&n)>>4,r.edgeGreen=(12&n)>>2,r.edgeBlue=3&n,e},Be.prototype.setPenLocation=function(e,t){var i=this.current708Packet.data,n=i[e],r=t.currentWindow.penLoc;return t.currentWindow.pendingNewLine=!0,n=i[++e],r.row=15&n,n=i[++e],r.column=63&n,e},Be.prototype.reset=function(e,t){var i=this.getPts(e);return this.flushDisplayed(i,t),this.initService(t.serviceNum,e)};var Fe={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,304:174,305:176,306:189,307:191,308:8482,309:162,310:163,311:9834,312:224,313:160,314:232,315:226,316:234,317:238,318:244,319:251,544:193,545:201,546:211,547:218,548:220,549:252,550:8216,551:161,552:42,553:39,554:8212,555:169,556:8480,557:8226,558:8220,559:8221,560:192,561:194,562:199,563:200,564:202,565:203,566:235,567:206,568:207,569:239,570:212,571:217,572:249,573:219,574:171,575:187,800:195,801:227,802:205,803:204,804:236,805:210,806:242,807:213,808:245,809:123,810:125,811:92,812:94,813:95,814:124,815:126,816:196,817:228,818:214,819:246,820:223,821:165,822:164,823:9474,824:197,825:229,826:216,827:248,828:9484,829:9488,830:9492,831:9496},je=function(e){return null===e?"":(e=Fe[e]||e,String.fromCharCode(e))},qe=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],Ve=function(){for(var e=[],t=15;t--;)e.push("");return e},He=function e(t,i){e.prototype.init.call(this),this.field_=t||0,this.dataChannel_=i||0,this.name_="CC"+(1+(this.field_<<1|this.dataChannel_)),this.setConstants(),this.reset(),this.push=function(e){var t,i,n,r,a;if((t=32639&e.ccData)!==this.lastControlCode_){if(4096==(61440&t)?this.lastControlCode_=t:t!==this.PADDING_&&(this.lastControlCode_=null),n=t>>>8,r=255&t,t!==this.PADDING_)if(t===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(t===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(e.pts),this.flushDisplayed(e.pts),i=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=i,this.startPts_=e.pts;else if(t===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(e.pts);else if(t===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(e.pts);else if(t===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(e.pts);else if(t===this.CARRIAGE_RETURN_)this.clearFormatting(e.pts),this.flushDisplayed(e.pts),this.shiftRowsUp_(),this.startPts_=e.pts;else if(t===this.BACKSPACE_)"popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1);else if(t===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(e.pts),this.displayed_=Ve();else if(t===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=Ve();else if(t===this.RESUME_DIRECT_CAPTIONING_)"paintOn"!==this.mode_&&(this.flushDisplayed(e.pts),this.displayed_=Ve()),this.mode_="paintOn",this.startPts_=e.pts;else if(this.isSpecialCharacter(n,r))a=je((n=(3&n)<<8)|r),this[this.mode_](e.pts,a),this.column_++;else if(this.isExtCharacter(n,r))"popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1),a=je((n=(3&n)<<8)|r),this[this.mode_](e.pts,a),this.column_++;else if(this.isMidRowCode(n,r))this.clearFormatting(e.pts),this[this.mode_](e.pts," "),this.column_++,14&~r||this.addFormatting(e.pts,["i"]),1&~r||this.addFormatting(e.pts,["u"]);else if(this.isOffsetControlCode(n,r))this.column_+=3&r;else if(this.isPAC(n,r)){var s=qe.indexOf(7968&t);"rollUp"===this.mode_&&(s-this.rollUpRows_+1<0&&(s=this.rollUpRows_-1),this.setRollUp(e.pts,s)),s!==this.row_&&(this.clearFormatting(e.pts),this.row_=s),1&r&&-1===this.formatting_.indexOf("u")&&this.addFormatting(e.pts,["u"]),16&~t||(this.column_=4*((14&t)>>1)),this.isColorPAC(r)&&(14&~r||this.addFormatting(e.pts,["i"]))}else this.isNormalChar(n)&&(0===r&&(r=null),a=je(n),a+=je(r),this[this.mode_](e.pts,a),this.column_+=a.length)}else this.lastControlCode_=null}};He.prototype=new V,He.prototype.flushDisplayed=function(e){var t=this.displayed_.map((function(e,t){try{return e.trim()}catch(e){return this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+t+"."}),""}}),this).join("\n").replace(/^\n+|\n+$/g,"");t.length&&this.trigger("data",{startPts:this.startPts_,endPts:e,text:t,stream:this.name_})},He.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=Ve(),this.nonDisplayed_=Ve(),this.lastControlCode_=null,this.column_=0,this.row_=14,this.rollUpRows_=2,this.formatting_=[]},He.prototype.setConstants=function(){0===this.dataChannel_?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):1===this.dataChannel_&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=32|this.CONTROL_,this.END_OF_CAPTION_=47|this.CONTROL_,this.ROLL_UP_2_ROWS_=37|this.CONTROL_,this.ROLL_UP_3_ROWS_=38|this.CONTROL_,this.ROLL_UP_4_ROWS_=39|this.CONTROL_,this.CARRIAGE_RETURN_=45|this.CONTROL_,this.RESUME_DIRECT_CAPTIONING_=41|this.CONTROL_,this.BACKSPACE_=33|this.CONTROL_,this.ERASE_DISPLAYED_MEMORY_=44|this.CONTROL_,this.ERASE_NON_DISPLAYED_MEMORY_=46|this.CONTROL_},He.prototype.isSpecialCharacter=function(e,t){return e===this.EXT_&&t>=48&&t<=63},He.prototype.isExtCharacter=function(e,t){return(e===this.EXT_+1||e===this.EXT_+2)&&t>=32&&t<=63},He.prototype.isMidRowCode=function(e,t){return e===this.EXT_&&t>=32&&t<=47},He.prototype.isOffsetControlCode=function(e,t){return e===this.OFFSET_&&t>=33&&t<=35},He.prototype.isPAC=function(e,t){return e>=this.BASE_&&e<this.BASE_+8&&t>=64&&t<=127},He.prototype.isColorPAC=function(e){return e>=64&&e<=79||e>=96&&e<=127},He.prototype.isNormalChar=function(e){return e>=32&&e<=127},He.prototype.setRollUp=function(e,t){if("rollUp"!==this.mode_&&(this.row_=14,this.mode_="rollUp",this.flushDisplayed(e),this.nonDisplayed_=Ve(),this.displayed_=Ve()),void 0!==t&&t!==this.row_)for(var i=0;i<this.rollUpRows_;i++)this.displayed_[t-i]=this.displayed_[this.row_-i],this.displayed_[this.row_-i]="";void 0===t&&(t=this.row_),this.topRow_=t-this.rollUpRows_+1},He.prototype.addFormatting=function(e,t){this.formatting_=this.formatting_.concat(t);var i=t.reduce((function(e,t){return e+"<"+t+">"}),"");this[this.mode_](e,i)},He.prototype.clearFormatting=function(e){if(this.formatting_.length){var t=this.formatting_.reverse().reduce((function(e,t){return e+"</"+t+">"}),"");this.formatting_=[],this[this.mode_](e,t)}},He.prototype.popOn=function(e,t){var i=this.nonDisplayed_[this.row_];i+=t,this.nonDisplayed_[this.row_]=i},He.prototype.rollUp=function(e,t){var i=this.displayed_[this.row_];i+=t,this.displayed_[this.row_]=i},He.prototype.shiftRowsUp_=function(){var e;for(e=0;e<this.topRow_;e++)this.displayed_[e]="";for(e=this.row_+1;e<15;e++)this.displayed_[e]="";for(e=this.topRow_;e<this.row_;e++)this.displayed_[e]=this.displayed_[e+1];this.displayed_[this.row_]=""},He.prototype.paintOn=function(e,t){var i=this.displayed_[this.row_];i+=t,this.displayed_[this.row_]=i};var We={CaptionStream:Oe,Cea608Stream:He,Cea708Stream:Be},Ge={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21},ze="shared",Xe=function(e,t){var i=1;for(e>t&&(i=-1);Math.abs(t-e)>4294967296;)e+=8589934592*i;return e},Ke=function e(t){var i,n;e.prototype.init.call(this),this.type_=t||ze,this.push=function(e){this.type_!==ze&&e.type!==this.type_||(void 0===n&&(n=e.dts),e.dts=Xe(e.dts,n),e.pts=Xe(e.pts,n),i=e.dts,this.trigger("data",e))},this.flush=function(){n=i,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){n=void 0,i=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};Ke.prototype=new V;var Ye,Qe=Ke,$e=Xe,Je=function(e,t,i){var n,r="";for(n=t;n<i;n++)r+="%"+("00"+e[n].toString(16)).slice(-2);return r},Ze=function(e,t,i){return decodeURIComponent(Je(e,t,i))},et=function(e){return e[0]<<21|e[1]<<14|e[2]<<7|e[3]},tt={TXXX:function(e){var t;if(3===e.data[0]){for(t=1;t<e.data.length;t++)if(0===e.data[t]){e.description=Ze(e.data,1,t),e.value=Ze(e.data,t+1,e.data.length).replace(/\0*$/,"");break}e.data=e.value}},WXXX:function(e){var t;if(3===e.data[0])for(t=1;t<e.data.length;t++)if(0===e.data[t]){e.description=Ze(e.data,1,t),e.url=Ze(e.data,t+1,e.data.length);break}},PRIV:function(e){var t,i;for(t=0;t<e.data.length;t++)if(0===e.data[t]){e.owner=(i=e.data,unescape(Je(i,0,t)));break}e.privateData=e.data.subarray(t+1),e.data=e.privateData}};Ye=function(e){var t,i={descriptor:e&&e.descriptor},n=0,r=[],a=0;if(Ye.prototype.init.call(this),this.dispatchType=Ge.METADATA_STREAM_TYPE.toString(16),i.descriptor)for(t=0;t<i.descriptor.length;t++)this.dispatchType+=("00"+i.descriptor[t].toString(16)).slice(-2);this.push=function(e){var t,i,s,o,u;if("timed-metadata"===e.type)if(e.dataAlignmentIndicator&&(a=0,r.length=0),0===r.length&&(e.data.length<10||e.data[0]!=="I".charCodeAt(0)||e.data[1]!=="D".charCodeAt(0)||e.data[2]!=="3".charCodeAt(0)))this.trigger("log",{level:"warn",message:"Skipping unrecognized metadata packet"});else if(r.push(e),a+=e.data.byteLength,1===r.length&&(n=et(e.data.subarray(6,10)),n+=10),!(a<n)){for(t={data:new Uint8Array(n),frames:[],pts:r[0].pts,dts:r[0].dts},u=0;u<n;)t.data.set(r[0].data.subarray(0,n-u),u),u+=r[0].data.byteLength,a-=r[0].data.byteLength,r.shift();i=10,64&t.data[5]&&(i+=4,i+=et(t.data.subarray(10,14)),n-=et(t.data.subarray(16,20)));do{if((s=et(t.data.subarray(i+4,i+8)))<1)return void this.trigger("log",{level:"warn",message:"Malformed ID3 frame encountered. Skipping metadata parsing."});if((o={id:String.fromCharCode(t.data[i],t.data[i+1],t.data[i+2],t.data[i+3]),data:t.data.subarray(i+10,i+s+10)}).key=o.id,tt[o.id]&&(tt[o.id](o),"com.apple.streaming.transportStreamTimestamp"===o.owner)){var l=o.data,c=(1&l[3])<<30|l[4]<<22|l[5]<<14|l[6]<<6|l[7]>>>2;c*=4,c+=3&l[7],o.timeStamp=c,void 0===t.pts&&void 0===t.dts&&(t.pts=o.timeStamp,t.dts=o.timeStamp),this.trigger("timestamp",o)}t.frames.push(o),i+=10,i+=s}while(i<n);this.trigger("data",t)}}},Ye.prototype=new V;var it,nt,rt,at=Ye,st=Qe,ot=188;(it=function(){var e=new Uint8Array(ot),t=0;it.prototype.init.call(this),this.push=function(i){var n,r=0,a=ot;for(t?((n=new Uint8Array(i.byteLength+t)).set(e.subarray(0,t)),n.set(i,t),t=0):n=i;a<n.byteLength;)71!==n[r]||71!==n[a]?(r++,a++):(this.trigger("data",n.subarray(r,a)),r+=ot,a+=ot);r<n.byteLength&&(e.set(n.subarray(r),0),t=n.byteLength-r)},this.flush=function(){t===ot&&71===e[0]&&(this.trigger("data",e),t=0),this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.reset=function(){t=0,this.trigger("reset")}}).prototype=new V,nt=function(){var e,t,i,n;nt.prototype.init.call(this),n=this,this.packetsWaitingForPmt=[],this.programMapTable=void 0,e=function(e,n){var r=0;n.payloadUnitStartIndicator&&(r+=e[r]+1),"pat"===n.type?t(e.subarray(r),n):i(e.subarray(r),n)},t=function(e,t){t.section_number=e[7],t.last_section_number=e[8],n.pmtPid=(31&e[10])<<8|e[11],t.pmtPid=n.pmtPid},i=function(e,t){var i,r;if(1&e[5]){for(n.programMapTable={video:null,audio:null,"timed-metadata":{}},i=3+((15&e[1])<<8|e[2])-4,r=12+((15&e[10])<<8|e[11]);r<i;){var a=e[r],s=(31&e[r+1])<<8|e[r+2];a===Ge.H264_STREAM_TYPE&&null===n.programMapTable.video?n.programMapTable.video=s:a===Ge.ADTS_STREAM_TYPE&&null===n.programMapTable.audio?n.programMapTable.audio=s:a===Ge.METADATA_STREAM_TYPE&&(n.programMapTable["timed-metadata"][s]=a),r+=5+((15&e[r+3])<<8|e[r+4])}t.programMapTable=n.programMapTable}},this.push=function(t){var i={},n=4;if(i.payloadUnitStartIndicator=!!(64&t[1]),i.pid=31&t[1],i.pid<<=8,i.pid|=t[2],(48&t[3])>>>4>1&&(n+=t[n]+1),0===i.pid)i.type="pat",e(t.subarray(n),i),this.trigger("data",i);else if(i.pid===this.pmtPid)for(i.type="pmt",e(t.subarray(n),i),this.trigger("data",i);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else void 0===this.programMapTable?this.packetsWaitingForPmt.push([t,n,i]):this.processPes_(t,n,i)},this.processPes_=function(e,t,i){i.pid===this.programMapTable.video?i.streamType=Ge.H264_STREAM_TYPE:i.pid===this.programMapTable.audio?i.streamType=Ge.ADTS_STREAM_TYPE:i.streamType=this.programMapTable["timed-metadata"][i.pid],i.type="pes",i.data=e.subarray(t),this.trigger("data",i)}},nt.prototype=new V,nt.STREAM_TYPES={h264:27,adts:15},rt=function(){var e,t=this,i=!1,n={data:[],size:0},r={data:[],size:0},a={data:[],size:0},s=function(e,i,n){var r,a,s=new Uint8Array(e.size),o={type:i},u=0,l=0;if(e.data.length&&!(e.size<9)){for(o.trackId=e.data[0].pid,u=0;u<e.data.length;u++)a=e.data[u],s.set(a.data,l),l+=a.data.byteLength;var c,d,h,p;d=o,p=(c=s)[0]<<16|c[1]<<8|c[2],d.data=new Uint8Array,1===p&&(d.packetLength=6+(c[4]<<8|c[5]),d.dataAlignmentIndicator=!!(4&c[6]),192&(h=c[7])&&(d.pts=(14&c[9])<<27|(255&c[10])<<20|(254&c[11])<<12|(255&c[12])<<5|(254&c[13])>>>3,d.pts*=4,d.pts+=(6&c[13])>>>1,d.dts=d.pts,64&h&&(d.dts=(14&c[14])<<27|(255&c[15])<<20|(254&c[16])<<12|(255&c[17])<<5|(254&c[18])>>>3,d.dts*=4,d.dts+=(6&c[18])>>>1)),d.data=c.subarray(9+c[8])),r="video"===i||o.packetLength<=e.size,(n||r)&&(e.size=0,e.data.length=0),r&&t.trigger("data",o)}};rt.prototype.init.call(this),this.push=function(o){({pat:function(){},pes:function(){var e,t;switch(o.streamType){case Ge.H264_STREAM_TYPE:e=n,t="video";break;case Ge.ADTS_STREAM_TYPE:e=r,t="audio";break;case Ge.METADATA_STREAM_TYPE:e=a,t="timed-metadata";break;default:return}o.payloadUnitStartIndicator&&s(e,t,!0),e.data.push(o),e.size+=o.data.byteLength},pmt:function(){var n={type:"metadata",tracks:[]};null!==(e=o.programMapTable).video&&n.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.video,codec:"avc",type:"video"}),null!==e.audio&&n.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.audio,codec:"adts",type:"audio"}),i=!0,t.trigger("data",n)}})[o.type]()},this.reset=function(){n.size=0,n.data.length=0,r.size=0,r.data.length=0,this.trigger("reset")},this.flushStreams_=function(){s(n,"video"),s(r,"audio"),s(a,"timed-metadata")},this.flush=function(){if(!i&&e){var n={type:"metadata",tracks:[]};null!==e.video&&n.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.video,codec:"avc",type:"video"}),null!==e.audio&&n.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.audio,codec:"adts",type:"audio"}),t.trigger("data",n)}i=!1,this.flushStreams_(),this.trigger("done")}},rt.prototype=new V;var ut={PAT_PID:0,MP2T_PACKET_LENGTH:ot,TransportPacketStream:it,TransportParseStream:nt,ElementaryStream:rt,TimestampRolloverStream:st,CaptionStream:We.CaptionStream,Cea608Stream:We.Cea608Stream,Cea708Stream:We.Cea708Stream,MetadataStream:at};for(var lt in Ge)Ge.hasOwnProperty(lt)&&(ut[lt]=Ge[lt]);var ct,dt=ut,ht=fe,pt=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];ct=function(e){var t,i=0;ct.prototype.init.call(this),this.skipWarn_=function(e,t){this.trigger("log",{level:"warn",message:"adts skiping bytes "+e+" to "+t+" in frame "+i+" outside syncword"})},this.push=function(n){var r,a,s,o,u,l=0;if(e||(i=0),"audio"===n.type){var c;for(t&&t.length?(s=t,(t=new Uint8Array(s.byteLength+n.data.byteLength)).set(s),t.set(n.data,s.byteLength)):t=n.data;l+7<t.length;)if(255===t[l]&&240==(246&t[l+1])){if("number"==typeof c&&(this.skipWarn_(c,l),c=null),a=2*(1&~t[l+1]),r=(3&t[l+3])<<11|t[l+4]<<3|(224&t[l+5])>>5,u=(o=1024*(1+(3&t[l+6])))*ht/pt[(60&t[l+2])>>>2],t.byteLength-l<r)break;this.trigger("data",{pts:n.pts+i*u,dts:n.dts+i*u,sampleCount:o,audioobjecttype:1+(t[l+2]>>>6&3),channelcount:(1&t[l+2])<<2|(192&t[l+3])>>>6,samplerate:pt[(60&t[l+2])>>>2],samplingfrequencyindex:(60&t[l+2])>>>2,samplesize:16,data:t.subarray(l+7+a,l+r)}),i++,l+=r}else"number"!=typeof c&&(c=l),l++;"number"==typeof c&&(this.skipWarn_(c,l),c=null),t=t.subarray(l)}},this.flush=function(){i=0,this.trigger("done")},this.reset=function(){t=void 0,this.trigger("reset")},this.endTimeline=function(){t=void 0,this.trigger("endedtimeline")}},ct.prototype=new V;var ft,mt=ct;ft=function(e){var t=e.byteLength,i=0,n=0;this.length=function(){return 8*t},this.bitsAvailable=function(){return 8*t+n},this.loadWord=function(){var r=e.byteLength-t,a=new Uint8Array(4),s=Math.min(4,t);if(0===s)throw new Error("no bytes available");a.set(e.subarray(r,r+s)),i=new DataView(a.buffer).getUint32(0),n=8*s,t-=s},this.skipBits=function(e){var r;n>e?(i<<=e,n-=e):(e-=n,e-=8*(r=Math.floor(e/8)),t-=r,this.loadWord(),i<<=e,n-=e)},this.readBits=function(e){var r=Math.min(n,e),a=i>>>32-r;return(n-=r)>0?i<<=r:t>0&&this.loadWord(),(r=e-r)>0?a<<r|this.readBits(r):a},this.skipLeadingZeros=function(){var e;for(e=0;e<n;++e)if(i&2147483648>>>e)return i<<=e,n-=e,e;return this.loadWord(),e+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var e=this.skipLeadingZeros();return this.readBits(e+1)-1},this.readExpGolomb=function(){var e=this.readUnsignedExpGolomb();return 1&e?1+e>>>1:-1*(e>>>1)},this.readBoolean=function(){return 1===this.readBits(1)},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};var gt,vt,yt,_t=ft;vt=function(){var e,t,i=0;vt.prototype.init.call(this),this.push=function(n){var r;t?((r=new Uint8Array(t.byteLength+n.data.byteLength)).set(t),r.set(n.data,t.byteLength),t=r):t=n.data;for(var a=t.byteLength;i<a-3;i++)if(1===t[i+2]){e=i+5;break}for(;e<a;)switch(t[e]){case 0:if(0!==t[e-1]){e+=2;break}if(0!==t[e-2]){e++;break}i+3!==e-2&&this.trigger("data",t.subarray(i+3,e-2));do{e++}while(1!==t[e]&&e<a);i=e-2,e+=3;break;case 1:if(0!==t[e-1]||0!==t[e-2]){e+=3;break}this.trigger("data",t.subarray(i+3,e-2)),i=e-2,e+=3;break;default:e+=3}t=t.subarray(i),e-=i,i=0},this.reset=function(){t=null,i=0,this.trigger("reset")},this.flush=function(){t&&t.byteLength>3&&this.trigger("data",t.subarray(i+3)),t=null,i=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}},vt.prototype=new V,yt={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},gt=function(){var e,t,i,n,r,a,s,o=new vt;gt.prototype.init.call(this),e=this,this.push=function(e){"video"===e.type&&(t=e.trackId,i=e.pts,n=e.dts,o.push(e))},o.on("data",(function(s){var o={trackId:t,pts:i,dts:n,data:s,nalUnitTypeCode:31&s[0]};switch(o.nalUnitTypeCode){case 5:o.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:o.nalUnitType="sei_rbsp",o.escapedRBSP=r(s.subarray(1));break;case 7:o.nalUnitType="seq_parameter_set_rbsp",o.escapedRBSP=r(s.subarray(1)),o.config=a(o.escapedRBSP);break;case 8:o.nalUnitType="pic_parameter_set_rbsp";break;case 9:o.nalUnitType="access_unit_delimiter_rbsp"}e.trigger("data",o)})),o.on("done",(function(){e.trigger("done")})),o.on("partialdone",(function(){e.trigger("partialdone")})),o.on("reset",(function(){e.trigger("reset")})),o.on("endedtimeline",(function(){e.trigger("endedtimeline")})),this.flush=function(){o.flush()},this.partialFlush=function(){o.partialFlush()},this.reset=function(){o.reset()},this.endTimeline=function(){o.endTimeline()},s=function(e,t){var i,n=8,r=8;for(i=0;i<e;i++)0!==r&&(r=(n+t.readExpGolomb()+256)%256),n=0===r?n:r},r=function(e){for(var t,i,n=e.byteLength,r=[],a=1;a<n-2;)0===e[a]&&0===e[a+1]&&3===e[a+2]?(r.push(a+2),a+=2):a++;if(0===r.length)return e;t=n-r.length,i=new Uint8Array(t);var s=0;for(a=0;a<t;s++,a++)s===r[0]&&(s++,r.shift()),i[a]=e[s];return i},a=function(e){var t,i,n,r,a,o,u,l,c,d,h,p,f=0,m=0,g=0,v=0,y=[1,1];if(i=(t=new _t(e)).readUnsignedByte(),r=t.readUnsignedByte(),n=t.readUnsignedByte(),t.skipUnsignedExpGolomb(),yt[i]&&(3===(a=t.readUnsignedExpGolomb())&&t.skipBits(1),t.skipUnsignedExpGolomb(),t.skipUnsignedExpGolomb(),t.skipBits(1),t.readBoolean()))for(h=3!==a?8:12,p=0;p<h;p++)t.readBoolean()&&s(p<6?16:64,t);if(t.skipUnsignedExpGolomb(),0===(o=t.readUnsignedExpGolomb()))t.readUnsignedExpGolomb();else if(1===o)for(t.skipBits(1),t.skipExpGolomb(),t.skipExpGolomb(),u=t.readUnsignedExpGolomb(),p=0;p<u;p++)t.skipExpGolomb();if(t.skipUnsignedExpGolomb(),t.skipBits(1),l=t.readUnsignedExpGolomb(),c=t.readUnsignedExpGolomb(),0===(d=t.readBits(1))&&t.skipBits(1),t.skipBits(1),t.readBoolean()&&(f=t.readUnsignedExpGolomb(),m=t.readUnsignedExpGolomb(),g=t.readUnsignedExpGolomb(),v=t.readUnsignedExpGolomb()),t.readBoolean()&&t.readBoolean()){switch(t.readUnsignedByte()){case 1:y=[1,1];break;case 2:y=[12,11];break;case 3:y=[10,11];break;case 4:y=[16,11];break;case 5:y=[40,33];break;case 6:y=[24,11];break;case 7:y=[20,11];break;case 8:y=[32,11];break;case 9:y=[80,33];break;case 10:y=[18,11];break;case 11:y=[15,11];break;case 12:y=[64,33];break;case 13:y=[160,99];break;case 14:y=[4,3];break;case 15:y=[3,2];break;case 16:y=[2,1];break;case 255:y=[t.readUnsignedByte()<<8|t.readUnsignedByte(),t.readUnsignedByte()<<8|t.readUnsignedByte()]}y&&(y[0],y[1])}return{profileIdc:i,levelIdc:n,profileCompatibility:r,width:16*(l+1)-2*f-2*m,height:(2-d)*(c+1)*16-2*g-2*v,sarRatio:y}}},gt.prototype=new V;var bt,Tt={H264Stream:gt,NalByteStream:vt},St=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],Et=function(e,t){var i=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9];return i=i>=0?i:0,(16&e[t+5])>>4?i+20:i+10},wt=function e(t,i){return t.length-i<10||t[i]!=="I".charCodeAt(0)||t[i+1]!=="D".charCodeAt(0)||t[i+2]!=="3".charCodeAt(0)?i:e(t,i+=Et(t,i))},kt=function(e){return e[0]<<21|e[1]<<14|e[2]<<7|e[3]},Ct={isLikelyAacData:function(e){var t=wt(e,0);return e.length>=t+2&&!(255&~e[t])&&!(240&~e[t+1])&&16==(22&e[t+1])},parseId3TagSize:Et,parseAdtsSize:function(e,t){var i=(224&e[t+5])>>5,n=e[t+4]<<3;return 6144&e[t+3]|n|i},parseType:function(e,t){return e[t]==="I".charCodeAt(0)&&e[t+1]==="D".charCodeAt(0)&&e[t+2]==="3".charCodeAt(0)?"timed-metadata":!0&e[t]&&!(240&~e[t+1])?"audio":null},parseSampleRate:function(e){for(var t=0;t+5<e.length;){if(255===e[t]&&240==(246&e[t+1]))return St[(60&e[t+2])>>>2];t++}return null},parseAacTimestamp:function(e){var t,i,n;t=10,64&e[5]&&(t+=4,t+=kt(e.subarray(10,14)));do{if((i=kt(e.subarray(t+4,t+8)))<1)return null;if("PRIV"===String.fromCharCode(e[t],e[t+1],e[t+2],e[t+3])){n=e.subarray(t+10,t+i+10);for(var r=0;r<n.byteLength;r++)if(0===n[r]){var a=unescape(function(e,t,i){var n,r="";for(n=t;n<i;n++)r+="%"+("00"+e[n].toString(16)).slice(-2);return r}(n,0,r));if("com.apple.streaming.transportStreamTimestamp"===a){var s=n.subarray(r+1),o=(1&s[3])<<30|s[4]<<22|s[5]<<14|s[6]<<6|s[7]>>>2;return o*=4,o+=3&s[7]}break}}t+=10,t+=i}while(t<e.byteLength);return null}};(bt=function(){var e=new Uint8Array,t=0;bt.prototype.init.call(this),this.setTimestamp=function(e){t=e},this.push=function(i){var n,r,a,s,o=0,u=0;for(e.length?(s=e.length,(e=new Uint8Array(i.byteLength+s)).set(e.subarray(0,s)),e.set(i,s)):e=i;e.length-u>=3;)if(e[u]!=="I".charCodeAt(0)||e[u+1]!=="D".charCodeAt(0)||e[u+2]!=="3".charCodeAt(0))if(255&~e[u]||240&~e[u+1])u++;else{if(e.length-u<7)break;if(u+(o=Ct.parseAdtsSize(e,u))>e.length)break;a={type:"audio",data:e.subarray(u,u+o),pts:t,dts:t},this.trigger("data",a),u+=o}else{if(e.length-u<10)break;if(u+(o=Ct.parseId3TagSize(e,u))>e.length)break;r={type:"timed-metadata",data:e.subarray(u,u+o)},this.trigger("data",r),u+=o}n=e.length-u,e=n>0?e.subarray(u):new Uint8Array},this.reset=function(){e=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){e=new Uint8Array,this.trigger("endedtimeline")}}).prototype=new V;var xt,It,At,Pt,Lt=bt,Dt=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],Ot=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],Nt=Tt.H264Stream,Rt=Ct.isLikelyAacData,Mt=fe,Ut=function(e,t){t.stream=e,this.trigger("log",t)},Bt=function(e,t){for(var i=Object.keys(t),n=0;n<i.length;n++){var r=i[n];"headOfPipeline"!==r&&t[r].on&&t[r].on("log",Ut.bind(e,r))}},Ft=function(e,t){var i;if(e.length!==t.length)return!1;for(i=0;i<e.length;i++)if(e[i]!==t[i])return!1;return!0},jt=function(e,t,i,n,r,a){return{start:{dts:e,pts:e+(i-t)},end:{dts:e+(n-t),pts:e+(r-i)},prependedContentDuration:a,baseMediaDecodeTime:e}};It=function(e,t){var i,n=[],r=0,a=0,s=1/0;i=(t=t||{}).firstSequenceNumber||0,It.prototype.init.call(this),this.push=function(t){xe(e,t),e&&Dt.forEach((function(i){e[i]=t[i]})),n.push(t)},this.setEarliestDts=function(e){r=e},this.setVideoBaseMediaDecodeTime=function(e){s=e},this.setAudioAppendStart=function(e){a=e},this.flush=function(){var o,u,l,c,d,h,p;0!==n.length?(o=Te(n,e,r),e.baseMediaDecodeTime=Ce(e,t.keepOriginalTimestamps),p=be(e,o,a,s),e.samples=Se(o),l=ee(Ee(o)),n=[],u=te(i,[e]),c=new Uint8Array(u.byteLength+l.byteLength),i++,c.set(u),c.set(l,u.byteLength),ke(e),d=Math.ceil(1024*Mt/e.samplerate),o.length&&(h=o.length*d,this.trigger("segmentTimingInfo",jt(ve(e.baseMediaDecodeTime,e.samplerate),o[0].dts,o[0].pts,o[0].dts+h,o[0].pts+h,p||0)),this.trigger("timingInfo",{start:o[0].pts,end:o[0].pts+h})),this.trigger("data",{track:e,boxes:c}),this.trigger("done","AudioSegmentStream")):this.trigger("done","AudioSegmentStream")},this.reset=function(){ke(e),n=[],this.trigger("reset")}},It.prototype=new V,xt=function(e,t){var i,n,r,a=[],s=[];i=(t=t||{}).firstSequenceNumber||0,xt.prototype.init.call(this),delete e.minPTS,this.gopCache_=[],this.push=function(t){xe(e,t),"seq_parameter_set_rbsp"!==t.nalUnitType||n||(n=t.config,e.sps=[t.data],Ot.forEach((function(t){e[t]=n[t]}),this)),"pic_parameter_set_rbsp"!==t.nalUnitType||r||(r=t.data,e.pps=[t.data]),a.push(t)},this.flush=function(){for(var n,r,o,u,l,c,d,h,p=0;a.length&&"access_unit_delimiter_rbsp"!==a[0].nalUnitType;)a.shift();if(0===a.length)return this.resetStream_(),void this.trigger("done","VideoSegmentStream");if(n=re(a),(o=ae(n))[0][0].keyFrame||((r=this.getGopForFusion_(a[0],e))?(p=r.duration,o.unshift(r),o.byteLength+=r.byteLength,o.nalCount+=r.nalCount,o.pts=r.pts,o.dts=r.dts,o.duration+=r.duration):o=se(o)),s.length){var f;if(!(f=t.alignGopsAtEnd?this.alignGopsAtEnd_(o):this.alignGopsAtStart_(o)))return this.gopCache_.unshift({gop:o.pop(),pps:e.pps,sps:e.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),a=[],this.resetStream_(),void this.trigger("done","VideoSegmentStream");ke(e),o=f}xe(e,o),e.samples=oe(o),l=ee(ue(o)),e.baseMediaDecodeTime=Ce(e,t.keepOriginalTimestamps),this.trigger("processedGopsInfo",o.map((function(e){return{pts:e.pts,dts:e.dts,byteLength:e.byteLength}}))),d=o[0],h=o[o.length-1],this.trigger("segmentTimingInfo",jt(e.baseMediaDecodeTime,d.dts,d.pts,h.dts+h.duration,h.pts+h.duration,p)),this.trigger("timingInfo",{start:o[0].pts,end:o[o.length-1].pts+o[o.length-1].duration}),this.gopCache_.unshift({gop:o.pop(),pps:e.pps,sps:e.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),a=[],this.trigger("baseMediaDecodeTime",e.baseMediaDecodeTime),this.trigger("timelineStartInfo",e.timelineStartInfo),u=te(i,[e]),c=new Uint8Array(u.byteLength+l.byteLength),i++,c.set(u),c.set(l,u.byteLength),this.trigger("data",{track:e,boxes:c}),this.resetStream_(),this.trigger("done","VideoSegmentStream")},this.reset=function(){this.resetStream_(),a=[],this.gopCache_.length=0,s.length=0,this.trigger("reset")},this.resetStream_=function(){ke(e),n=void 0,r=void 0},this.getGopForFusion_=function(t){var i,n,r,a,s,o=1/0;for(s=0;s<this.gopCache_.length;s++)r=(a=this.gopCache_[s]).gop,e.pps&&Ft(e.pps[0],a.pps[0])&&e.sps&&Ft(e.sps[0],a.sps[0])&&(r.dts<e.timelineStartInfo.dts||(i=t.dts-r.dts-r.duration)>=-1e4&&i<=45e3&&(!n||o>i)&&(n=a,o=i));return n?n.gop:null},this.alignGopsAtStart_=function(e){var t,i,n,r,a,o,u,l;for(a=e.byteLength,o=e.nalCount,u=e.duration,t=i=0;t<s.length&&i<e.length&&(n=s[t],r=e[i],n.pts!==r.pts);)r.pts>n.pts?t++:(i++,a-=r.byteLength,o-=r.nalCount,u-=r.duration);return 0===i?e:i===e.length?null:((l=e.slice(i)).byteLength=a,l.duration=u,l.nalCount=o,l.pts=l[0].pts,l.dts=l[0].dts,l)},this.alignGopsAtEnd_=function(e){var t,i,n,r,a,o,u;for(t=s.length-1,i=e.length-1,a=null,o=!1;t>=0&&i>=0;){if(n=s[t],r=e[i],n.pts===r.pts){o=!0;break}n.pts>r.pts?t--:(t===s.length-1&&(a=i),i--)}if(!o&&null===a)return null;if(0===(u=o?i:a))return e;var l=e.slice(u),c=l.reduce((function(e,t){return e.byteLength+=t.byteLength,e.duration+=t.duration,e.nalCount+=t.nalCount,e}),{byteLength:0,duration:0,nalCount:0});return l.byteLength=c.byteLength,l.duration=c.duration,l.nalCount=c.nalCount,l.pts=l[0].pts,l.dts=l[0].dts,l},this.alignGopsWith=function(e){s=e}},xt.prototype=new V,Pt=function(e,t){this.numberOfTracks=0,this.metadataStream=t,void 0!==(e=e||{}).remux?this.remuxTracks=!!e.remux:this.remuxTracks=!0,"boolean"==typeof e.keepOriginalTimestamps?this.keepOriginalTimestamps=e.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,Pt.prototype.init.call(this),this.push=function(e){return e.text?this.pendingCaptions.push(e):e.frames?this.pendingMetadata.push(e):(this.pendingTracks.push(e.track),this.pendingBytes+=e.boxes.byteLength,"video"===e.track.type&&(this.videoTrack=e.track,this.pendingBoxes.push(e.boxes)),void("audio"===e.track.type&&(this.audioTrack=e.track,this.pendingBoxes.unshift(e.boxes))))}},Pt.prototype=new V,Pt.prototype.flush=function(e){var t,i,n,r,a=0,s={captions:[],captionStreams:{},metadata:[],info:{}},o=0;if(this.pendingTracks.length<this.numberOfTracks){if("VideoSegmentStream"!==e&&"AudioSegmentStream"!==e)return;if(this.remuxTracks)return;if(0===this.pendingTracks.length)return this.emittedTracks++,void(this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0))}if(this.videoTrack?(o=this.videoTrack.timelineStartInfo.pts,Ot.forEach((function(e){s.info[e]=this.videoTrack[e]}),this)):this.audioTrack&&(o=this.audioTrack.timelineStartInfo.pts,Dt.forEach((function(e){s.info[e]=this.audioTrack[e]}),this)),this.videoTrack||this.audioTrack){for(1===this.pendingTracks.length?s.type=this.pendingTracks[0].type:s.type="combined",this.emittedTracks+=this.pendingTracks.length,n=ie(this.pendingTracks),s.initSegment=new Uint8Array(n.byteLength),s.initSegment.set(n),s.data=new Uint8Array(this.pendingBytes),r=0;r<this.pendingBoxes.length;r++)s.data.set(this.pendingBoxes[r],a),a+=this.pendingBoxes[r].byteLength;for(r=0;r<this.pendingCaptions.length;r++)(t=this.pendingCaptions[r]).startTime=_e(t.startPts,o,this.keepOriginalTimestamps),t.endTime=_e(t.endPts,o,this.keepOriginalTimestamps),s.captionStreams[t.stream]=!0,s.captions.push(t);for(r=0;r<this.pendingMetadata.length;r++)(i=this.pendingMetadata[r]).cueTime=_e(i.pts,o,this.keepOriginalTimestamps),s.metadata.push(i);for(s.metadata.dispatchType=this.metadataStream.dispatchType,this.pendingTracks.length=0,this.videoTrack=null,this.pendingBoxes.length=0,this.pendingCaptions.length=0,this.pendingBytes=0,this.pendingMetadata.length=0,this.trigger("data",s),r=0;r<s.captions.length;r++)t=s.captions[r],this.trigger("caption",t);for(r=0;r<s.metadata.length;r++)i=s.metadata[r],this.trigger("id3Frame",i)}this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},Pt.prototype.setRemux=function(e){this.remuxTracks=e},At=function(e){var t,i,n=this,r=!0;At.prototype.init.call(this),e=e||{},this.baseMediaDecodeTime=e.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var r={};this.transmuxPipeline_=r,r.type="aac",r.metadataStream=new dt.MetadataStream,r.aacStream=new Lt,r.audioTimestampRolloverStream=new dt.TimestampRolloverStream("audio"),r.timedMetadataTimestampRolloverStream=new dt.TimestampRolloverStream("timed-metadata"),r.adtsStream=new mt,r.coalesceStream=new Pt(e,r.metadataStream),r.headOfPipeline=r.aacStream,r.aacStream.pipe(r.audioTimestampRolloverStream).pipe(r.adtsStream),r.aacStream.pipe(r.timedMetadataTimestampRolloverStream).pipe(r.metadataStream).pipe(r.coalesceStream),r.metadataStream.on("timestamp",(function(e){r.aacStream.setTimestamp(e.timeStamp)})),r.aacStream.on("data",(function(a){"timed-metadata"!==a.type&&"audio"!==a.type||r.audioSegmentStream||(i=i||{timelineStartInfo:{baseMediaDecodeTime:n.baseMediaDecodeTime},codec:"adts",type:"audio"},r.coalesceStream.numberOfTracks++,r.audioSegmentStream=new It(i,e),r.audioSegmentStream.on("log",n.getLogTrigger_("audioSegmentStream")),r.audioSegmentStream.on("timingInfo",n.trigger.bind(n,"audioTimingInfo")),r.adtsStream.pipe(r.audioSegmentStream).pipe(r.coalesceStream),n.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!t}))})),r.coalesceStream.on("data",this.trigger.bind(this,"data")),r.coalesceStream.on("done",this.trigger.bind(this,"done")),Bt(this,r)},this.setupTsPipeline=function(){var r={};this.transmuxPipeline_=r,r.type="ts",r.metadataStream=new dt.MetadataStream,r.packetStream=new dt.TransportPacketStream,r.parseStream=new dt.TransportParseStream,r.elementaryStream=new dt.ElementaryStream,r.timestampRolloverStream=new dt.TimestampRolloverStream,r.adtsStream=new mt,r.h264Stream=new Nt,r.captionStream=new dt.CaptionStream(e),r.coalesceStream=new Pt(e,r.metadataStream),r.headOfPipeline=r.packetStream,r.packetStream.pipe(r.parseStream).pipe(r.elementaryStream).pipe(r.timestampRolloverStream),r.timestampRolloverStream.pipe(r.h264Stream),r.timestampRolloverStream.pipe(r.adtsStream),r.timestampRolloverStream.pipe(r.metadataStream).pipe(r.coalesceStream),r.h264Stream.pipe(r.captionStream).pipe(r.coalesceStream),r.elementaryStream.on("data",(function(a){var s;if("metadata"===a.type){for(s=a.tracks.length;s--;)t||"video"!==a.tracks[s].type?i||"audio"!==a.tracks[s].type||((i=a.tracks[s]).timelineStartInfo.baseMediaDecodeTime=n.baseMediaDecodeTime):(t=a.tracks[s]).timelineStartInfo.baseMediaDecodeTime=n.baseMediaDecodeTime;t&&!r.videoSegmentStream&&(r.coalesceStream.numberOfTracks++,r.videoSegmentStream=new xt(t,e),r.videoSegmentStream.on("log",n.getLogTrigger_("videoSegmentStream")),r.videoSegmentStream.on("timelineStartInfo",(function(t){i&&!e.keepOriginalTimestamps&&(i.timelineStartInfo=t,r.audioSegmentStream.setEarliestDts(t.dts-n.baseMediaDecodeTime))})),r.videoSegmentStream.on("processedGopsInfo",n.trigger.bind(n,"gopInfo")),r.videoSegmentStream.on("segmentTimingInfo",n.trigger.bind(n,"videoSegmentTimingInfo")),r.videoSegmentStream.on("baseMediaDecodeTime",(function(e){i&&r.audioSegmentStream.setVideoBaseMediaDecodeTime(e)})),r.videoSegmentStream.on("timingInfo",n.trigger.bind(n,"videoTimingInfo")),r.h264Stream.pipe(r.videoSegmentStream).pipe(r.coalesceStream)),i&&!r.audioSegmentStream&&(r.coalesceStream.numberOfTracks++,r.audioSegmentStream=new It(i,e),r.audioSegmentStream.on("log",n.getLogTrigger_("audioSegmentStream")),r.audioSegmentStream.on("timingInfo",n.trigger.bind(n,"audioTimingInfo")),r.audioSegmentStream.on("segmentTimingInfo",n.trigger.bind(n,"audioSegmentTimingInfo")),r.adtsStream.pipe(r.audioSegmentStream).pipe(r.coalesceStream)),n.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!t})}})),r.coalesceStream.on("data",this.trigger.bind(this,"data")),r.coalesceStream.on("id3Frame",(function(e){e.dispatchType=r.metadataStream.dispatchType,n.trigger("id3Frame",e)})),r.coalesceStream.on("caption",this.trigger.bind(this,"caption")),r.coalesceStream.on("done",this.trigger.bind(this,"done")),Bt(this,r)},this.setBaseMediaDecodeTime=function(n){var r=this.transmuxPipeline_;e.keepOriginalTimestamps||(this.baseMediaDecodeTime=n),i&&(i.timelineStartInfo.dts=void 0,i.timelineStartInfo.pts=void 0,ke(i),r.audioTimestampRolloverStream&&r.audioTimestampRolloverStream.discontinuity()),t&&(r.videoSegmentStream&&(r.videoSegmentStream.gopCache_=[]),t.timelineStartInfo.dts=void 0,t.timelineStartInfo.pts=void 0,ke(t),r.captionStream.reset()),r.timestampRolloverStream&&r.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(e){i&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(e)},this.setRemux=function(t){var i=this.transmuxPipeline_;e.remux=t,i&&i.coalesceStream&&i.coalesceStream.setRemux(t)},this.alignGopsWith=function(e){t&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(e)},this.getLogTrigger_=function(e){var t=this;return function(i){i.stream=e,t.trigger("log",i)}},this.push=function(e){if(r){var t=Rt(e);t&&"aac"!==this.transmuxPipeline_.type?this.setupAacPipeline():t||"ts"===this.transmuxPipeline_.type||this.setupTsPipeline(),r=!1}this.transmuxPipeline_.headOfPipeline.push(e)},this.flush=function(){r=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.endTimeline=function(){this.transmuxPipeline_.headOfPipeline.endTimeline()},this.reset=function(){this.transmuxPipeline_.headOfPipeline&&this.transmuxPipeline_.headOfPipeline.reset()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}},At.prototype=new V;var qt,Vt,Ht,Wt={Transmuxer:At,VideoSegmentStream:xt,AudioSegmentStream:It,AUDIO_PROPERTIES:Dt,VIDEO_PROPERTIES:Ot,generateSegmentTimingInfo:jt},Gt=function(e){return e>>>0},zt=function(e){var t="";return t+=String.fromCharCode(e[0]),t+=String.fromCharCode(e[1]),t+=String.fromCharCode(e[2]),t+=String.fromCharCode(e[3])},Xt=Gt,Kt=function e(t,i){var n,r,a,s,o,u=[];if(!i.length)return null;for(n=0;n<t.byteLength;)r=Xt(t[n]<<24|t[n+1]<<16|t[n+2]<<8|t[n+3]),a=zt(t.subarray(n+4,n+8)),s=r>1?n+r:t.byteLength,a===i[0]&&(1===i.length?u.push(t.subarray(n+8,s)):(o=e(t.subarray(n+8,s),i.slice(1))).length&&(u=u.concat(o))),n=s;return u},Yt=Gt,Qt=W.getUint64,$t=function(e){var t={version:e[0],flags:new Uint8Array(e.subarray(1,4))};return 1===t.version?t.baseMediaDecodeTime=Qt(e.subarray(4)):t.baseMediaDecodeTime=Yt(e[4]<<24|e[5]<<16|e[6]<<8|e[7]),t},Jt=function(e){return{isLeading:(12&e[0])>>>2,dependsOn:3&e[0],isDependedOn:(192&e[1])>>>6,hasRedundancy:(48&e[1])>>>4,paddingValue:(14&e[1])>>>1,isNonSyncSample:1&e[1],degradationPriority:e[2]<<8|e[3]}},Zt=function(e){var t,i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),samples:[]},n=new DataView(e.buffer,e.byteOffset,e.byteLength),r=1&i.flags[2],a=4&i.flags[2],s=1&i.flags[1],o=2&i.flags[1],u=4&i.flags[1],l=8&i.flags[1],c=n.getUint32(4),d=8;for(r&&(i.dataOffset=n.getInt32(d),d+=4),a&&c&&(t={flags:Jt(e.subarray(d,d+4))},d+=4,s&&(t.duration=n.getUint32(d),d+=4),o&&(t.size=n.getUint32(d),d+=4),l&&(1===i.version?t.compositionTimeOffset=n.getInt32(d):t.compositionTimeOffset=n.getUint32(d),d+=4),i.samples.push(t),c--);c--;)t={},s&&(t.duration=n.getUint32(d),d+=4),o&&(t.size=n.getUint32(d),d+=4),u&&(t.flags=Jt(e.subarray(d,d+4)),d+=4),l&&(1===i.version?t.compositionTimeOffset=n.getInt32(d):t.compositionTimeOffset=n.getUint32(d),d+=4),i.samples.push(t);return i},ei=function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),n={version:e[0],flags:new Uint8Array(e.subarray(1,4)),trackId:i.getUint32(4)},r=1&n.flags[2],a=2&n.flags[2],s=8&n.flags[2],o=16&n.flags[2],u=32&n.flags[2],l=65536&n.flags[0],c=131072&n.flags[0];return t=8,r&&(t+=4,n.baseDataOffset=i.getUint32(12),t+=4),a&&(n.sampleDescriptionIndex=i.getUint32(t),t+=4),s&&(n.defaultSampleDuration=i.getUint32(t),t+=4),o&&(n.defaultSampleSize=i.getUint32(t),t+=4),u&&(n.defaultSampleFlags=i.getUint32(t)),l&&(n.durationIsEmpty=!0),!r&&c&&(n.baseDataOffsetIsMoof=!0),n},ti="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},ii="undefined"!=typeof window?window:void 0!==ti?ti:"undefined"!=typeof self?self:{},ni=Le,ri=We.CaptionStream,ai=function(e,t){for(var i=e,n=0;n<t.length;n++){var r=t[n];if(i<r.size)return r;i-=r.size}return null},si=function(e,t){var i=Kt(e,["moof","traf"]),n=Kt(e,["mdat"]),r={},a=[];return n.forEach((function(e,t){var n=i[t];a.push({mdat:e,traf:n})})),a.forEach((function(e){var i,n,a=e.mdat,s=e.traf,o=Kt(s,["tfhd"]),u=ei(o[0]),l=u.trackId,c=Kt(s,["tfdt"]),d=c.length>0?$t(c[0]).baseMediaDecodeTime:0,h=Kt(s,["trun"]);t===l&&h.length>0&&(i=function(e,t,i){var n=t,r=i.defaultSampleDuration||0,a=i.defaultSampleSize||0,s=i.trackId,o=[];return e.forEach((function(e){var t=Zt(e).samples;t.forEach((function(e){void 0===e.duration&&(e.duration=r),void 0===e.size&&(e.size=a),e.trackId=s,e.dts=n,void 0===e.compositionTimeOffset&&(e.compositionTimeOffset=0),"bigint"==typeof n?(e.pts=n+ii.BigInt(e.compositionTimeOffset),n+=ii.BigInt(e.duration)):(e.pts=n+e.compositionTimeOffset,n+=e.duration)})),o=o.concat(t)})),o}(h,d,u),n=function(e,t,i){var n,r,a,s,o=new DataView(e.buffer,e.byteOffset,e.byteLength),u={logs:[],seiNals:[]};for(r=0;r+4<e.length;r+=a)if(a=o.getUint32(r),r+=4,!(a<=0))switch(31&e[r]){case 6:var l=e.subarray(r+1,r+1+a),c=ai(r,t);if(n={nalUnitType:"sei_rbsp",size:a,data:l,escapedRBSP:ni(l),trackId:i},c)n.pts=c.pts,n.dts=c.dts,s=c;else{if(!s){u.logs.push({level:"warn",message:"We've encountered a nal unit without data at "+r+" for trackId "+i+". See mux.js#223."});break}n.pts=s.pts,n.dts=s.dts}u.seiNals.push(n)}return u}(a,i,l),r[l]||(r[l]={seiNals:[],logs:[]}),r[l].seiNals=r[l].seiNals.concat(n.seiNals),r[l].logs=r[l].logs.concat(n.logs))})),r},oi=function(){var e,t,i,n,r,a,s=!1;this.isInitialized=function(){return s},this.init=function(t){e=new ri,s=!0,a=!!t&&t.isPartial,e.on("data",(function(e){e.startTime=e.startPts/n,e.endTime=e.endPts/n,r.captions.push(e),r.captionStreams[e.stream]=!0})),e.on("log",(function(e){r.logs.push(e)}))},this.isNewInit=function(e,t){return!(e&&0===e.length||t&&"object"===u(t)&&0===Object.keys(t).length)&&(i!==e[0]||n!==t[i])},this.parse=function(e,a,s){var o;if(!this.isInitialized())return null;if(!a||!s)return null;if(this.isNewInit(a,s))i=a[0],n=s[i];else if(null===i||!n)return t.push(e),null;for(;t.length>0;){var u=t.shift();this.parse(u,a,s)}return o=function(e,t,i){if(null===t)return null;var n=si(e,t)[t]||{};return{seiNals:n.seiNals,logs:n.logs,timescale:i}}(e,i,n),o&&o.logs&&(r.logs=r.logs.concat(o.logs)),null!==o&&o.seiNals?(this.pushNals(o.seiNals),this.flushStream(),r):r.logs.length?{logs:r.logs,captions:[],captionStreams:[]}:null},this.pushNals=function(t){if(!this.isInitialized()||!t||0===t.length)return null;t.forEach((function(t){e.push(t)}))},this.flushStream=function(){if(!this.isInitialized())return null;a?e.partialFlush():e.flush()},this.clearParsedCaptions=function(){r.captions=[],r.captionStreams={},r.logs=[]},this.resetCaptionStream=function(){if(!this.isInitialized())return null;e.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){t=[],i=null,n=null,r?this.clearParsedCaptions():r={captions:[],captionStreams:{},logs:[]},this.resetCaptionStream()},this.reset()},ui=Gt,li=function(e){return("00"+e.toString(16)).slice(-2)},ci=W.getUint64;qt=function(e,t){var i=Kt(t,["moof","traf"]).reduce((function(t,i){var n,r,a=Kt(i,["tfhd"])[0],s=ui(a[4]<<24|a[5]<<16|a[6]<<8|a[7]),o=e[s]||9e4,u=Kt(i,["tfdt"])[0],l=new DataView(u.buffer,u.byteOffset,u.byteLength);return"bigint"==typeof(n=1===u[0]?ci(u.subarray(4,12)):l.getUint32(4))?r=n/ii.BigInt(o):"number"!=typeof n||isNaN(n)||(r=n/o),r<Number.MAX_SAFE_INTEGER&&(r=Number(r)),r<t&&(t=r),t}),1/0);return"bigint"==typeof i||isFinite(i)?i:0},Ht=function(e){var t=0===e[0]?12:20;return ui(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])},Vt=function(e){var t=Kt(e,["moov","trak"]),i=[];return t.forEach((function(e){var t,n,r={},a=Kt(e,["tkhd"])[0];a&&(n=(t=new DataView(a.buffer,a.byteOffset,a.byteLength)).getUint8(0),r.id=0===n?t.getUint32(12):t.getUint32(20));var s=Kt(e,["mdia","hdlr"])[0];if(s){var o=zt(s.subarray(8,12));r.type="vide"===o?"video":"soun"===o?"audio":o}var u=Kt(e,["mdia","minf","stbl","stsd"])[0];if(u){var l=u.subarray(8);r.codec=zt(l.subarray(4,8));var c,d=Kt(l,[r.codec])[0];d&&(/^[asm]vc[1-9]$/i.test(r.codec)?(c=d.subarray(78),"avcC"===zt(c.subarray(4,8))&&c.length>11?(r.codec+=".",r.codec+=li(c[9]),r.codec+=li(c[10]),r.codec+=li(c[11])):r.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(r.codec)?(c=d.subarray(28),"esds"===zt(c.subarray(4,8))&&c.length>20&&0!==c[19]?(r.codec+="."+li(c[19]),r.codec+="."+li(c[20]>>>2&63).replace(/^0/,"")):r.codec="mp4a.40.2"):r.codec=r.codec.toLowerCase())}var h=Kt(e,["mdia","mdhd"])[0];h&&(r.timescale=Ht(h)),i.push(r)})),i};var di=qt,hi=Vt,pi=function(e){var t=31&e[1];return t<<=8,t|=e[2]},fi=function(e){return!!(64&e[1])},mi=function(e){var t=0;return(48&e[3])>>>4>1&&(t+=e[4]+1),t},gi=function(e){switch(e){case 5:return"slice_layer_without_partitioning_rbsp_idr";case 6:return"sei_rbsp";case 7:return"seq_parameter_set_rbsp";case 8:return"pic_parameter_set_rbsp";case 9:return"access_unit_delimiter_rbsp";default:return null}},vi={parseType:function(e,t){var i=pi(e);return 0===i?"pat":i===t?"pmt":t?"pes":null},parsePat:function(e){var t=fi(e),i=4+mi(e);return t&&(i+=e[i]+1),(31&e[i+10])<<8|e[i+11]},parsePmt:function(e){var t={},i=fi(e),n=4+mi(e);if(i&&(n+=e[n]+1),1&e[n+5]){var r;r=3+((15&e[n+1])<<8|e[n+2])-4;for(var a=12+((15&e[n+10])<<8|e[n+11]);a<r;){var s=n+a;t[(31&e[s+1])<<8|e[s+2]]=e[s],a+=5+((15&e[s+3])<<8|e[s+4])}return t}},parsePayloadUnitStartIndicator:fi,parsePesType:function(e,t){switch(t[pi(e)]){case Ge.H264_STREAM_TYPE:return"video";case Ge.ADTS_STREAM_TYPE:return"audio";case Ge.METADATA_STREAM_TYPE:return"timed-metadata";default:return null}},parsePesTime:function(e){if(!fi(e))return null;var t=4+mi(e);if(t>=e.byteLength)return null;var i,n=null;return 192&(i=e[t+7])&&((n={}).pts=(14&e[t+9])<<27|(255&e[t+10])<<20|(254&e[t+11])<<12|(255&e[t+12])<<5|(254&e[t+13])>>>3,n.pts*=4,n.pts+=(6&e[t+13])>>>1,n.dts=n.pts,64&i&&(n.dts=(14&e[t+14])<<27|(255&e[t+15])<<20|(254&e[t+16])<<12|(255&e[t+17])<<5|(254&e[t+18])>>>3,n.dts*=4,n.dts+=(6&e[t+18])>>>1)),n},videoPacketContainsKeyFrame:function(e){for(var t=4+mi(e),i=e.subarray(t),n=0,r=0,a=!1;r<i.byteLength-3;r++)if(1===i[r+2]){n=r+5;break}for(;n<i.byteLength;)switch(i[n]){case 0:if(0!==i[n-1]){n+=2;break}if(0!==i[n-2]){n++;break}r+3!==n-2&&"slice_layer_without_partitioning_rbsp_idr"===gi(31&i[r+3])&&(a=!0);do{n++}while(1!==i[n]&&n<i.length);r=n-2,n+=3;break;case 1:if(0!==i[n-1]||0!==i[n-2]){n+=3;break}"slice_layer_without_partitioning_rbsp_idr"===gi(31&i[r+3])&&(a=!0),r=n-2,n+=3;break;default:n+=3}return i=i.subarray(r),n-=r,r=0,i&&i.byteLength>3&&"slice_layer_without_partitioning_rbsp_idr"===gi(31&i[r+3])&&(a=!0),a}},yi=$e,_i={};_i.ts=vi,_i.aac=Ct;var bi=fe,Ti=188,Si=71,Ei=function(e,t,i){for(var n,r,a,s,o=0,u=Ti,l=!1;u<=e.byteLength;)if(e[o]!==Si||e[u]!==Si&&u!==e.byteLength)o++,u++;else{if(n=e.subarray(o,u),"pes"===_i.ts.parseType(n,t.pid))r=_i.ts.parsePesType(n,t.table),a=_i.ts.parsePayloadUnitStartIndicator(n),"audio"===r&&a&&(s=_i.ts.parsePesTime(n))&&(s.type="audio",i.audio.push(s),l=!0);if(l)break;o+=Ti,u+=Ti}for(o=(u=e.byteLength)-Ti,l=!1;o>=0;)if(e[o]!==Si||e[u]!==Si&&u!==e.byteLength)o--,u--;else{if(n=e.subarray(o,u),"pes"===_i.ts.parseType(n,t.pid))r=_i.ts.parsePesType(n,t.table),a=_i.ts.parsePayloadUnitStartIndicator(n),"audio"===r&&a&&(s=_i.ts.parsePesTime(n))&&(s.type="audio",i.audio.push(s),l=!0);if(l)break;o-=Ti,u-=Ti}},wi=function(e,t,i){for(var n,r,a,s,o,u,l,c=0,d=Ti,h=!1,p={data:[],size:0};d<e.byteLength;)if(e[c]!==Si||e[d]!==Si)c++,d++;else{if(n=e.subarray(c,d),"pes"===_i.ts.parseType(n,t.pid))if(r=_i.ts.parsePesType(n,t.table),a=_i.ts.parsePayloadUnitStartIndicator(n),"video"===r&&(a&&!h&&(s=_i.ts.parsePesTime(n))&&(s.type="video",i.video.push(s),h=!0),!i.firstKeyFrame)){if(a&&0!==p.size){for(o=new Uint8Array(p.size),u=0;p.data.length;)l=p.data.shift(),o.set(l,u),u+=l.byteLength;if(_i.ts.videoPacketContainsKeyFrame(o)){var f=_i.ts.parsePesTime(o);f?(i.firstKeyFrame=f,i.firstKeyFrame.type="video"):console.warn("Failed to extract PTS/DTS from PES at first keyframe. This could be an unusual TS segment, or else mux.js did not parse your TS segment correctly. If you know your TS segments do contain PTS/DTS on keyframes please file a bug report! You can try ffprobe to double check for yourself.")}p.size=0}p.data.push(n),p.size+=n.byteLength}if(h&&i.firstKeyFrame)break;c+=Ti,d+=Ti}for(c=(d=e.byteLength)-Ti,h=!1;c>=0;)if(e[c]!==Si||e[d]!==Si)c--,d--;else{if(n=e.subarray(c,d),"pes"===_i.ts.parseType(n,t.pid))r=_i.ts.parsePesType(n,t.table),a=_i.ts.parsePayloadUnitStartIndicator(n),"video"===r&&a&&(s=_i.ts.parsePesTime(n))&&(s.type="video",i.video.push(s),h=!0);if(h)break;c-=Ti,d-=Ti}},ki=function(e){var t={pid:null,table:null},i={};for(var n in function(e,t){for(var i,n=0,r=Ti;r<e.byteLength;)if(e[n]!==Si||e[r]!==Si)n++,r++;else{switch(i=e.subarray(n,r),_i.ts.parseType(i,t.pid)){case"pat":t.pid=_i.ts.parsePat(i);break;case"pmt":var a=_i.ts.parsePmt(i);t.table=t.table||{},Object.keys(a).forEach((function(e){t.table[e]=a[e]}))}n+=Ti,r+=Ti}}(e,t),t.table){if(t.table.hasOwnProperty(n))switch(t.table[n]){case Ge.H264_STREAM_TYPE:i.video=[],wi(e,t,i),0===i.video.length&&delete i.video;break;case Ge.ADTS_STREAM_TYPE:i.audio=[],Ei(e,t,i),0===i.audio.length&&delete i.audio}}return i},Ci=function(e,t){var i;return i=_i.aac.isLikelyAacData(e)?function(e){for(var t,i=!1,n=0,r=null,a=null,s=0,o=0;e.length-o>=3;){switch(_i.aac.parseType(e,o)){case"timed-metadata":if(e.length-o<10){i=!0;break}if((s=_i.aac.parseId3TagSize(e,o))>e.length){i=!0;break}null===a&&(t=e.subarray(o,o+s),a=_i.aac.parseAacTimestamp(t)),o+=s;break;case"audio":if(e.length-o<7){i=!0;break}if((s=_i.aac.parseAdtsSize(e,o))>e.length){i=!0;break}null===r&&(t=e.subarray(o,o+s),r=_i.aac.parseSampleRate(t)),n++,o+=s;break;default:o++}if(i)return null}if(null===r||null===a)return null;var u=bi/r;return{audio:[{type:"audio",dts:a,pts:a},{type:"audio",dts:a+1024*n*u,pts:a+1024*n*u}]}}(e):ki(e),i&&(i.audio||i.video)?(function(e,t){if(e.audio&&e.audio.length){var i=t;(void 0===i||isNaN(i))&&(i=e.audio[0].dts),e.audio.forEach((function(e){e.dts=yi(e.dts,i),e.pts=yi(e.pts,i),e.dtsTime=e.dts/bi,e.ptsTime=e.pts/bi}))}if(e.video&&e.video.length){var n=t;if((void 0===n||isNaN(n))&&(n=e.video[0].dts),e.video.forEach((function(e){e.dts=yi(e.dts,n),e.pts=yi(e.pts,n),e.dtsTime=e.dts/bi,e.ptsTime=e.pts/bi})),e.firstKeyFrame){var r=e.firstKeyFrame;r.dts=yi(r.dts,n),r.pts=yi(r.pts,n),r.dtsTime=r.dts/bi,r.ptsTime=r.pts/bi}}}(i,t),i):null},xi=function(){function e(e,t){this.options=t||{},this.self=e,this.init()}var t=e.prototype;return t.init=function(){this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new Wt.Transmuxer(this.options),function(e,t){t.on("data",(function(t){var i=t.initSegment;t.initSegment={data:i.buffer,byteOffset:i.byteOffset,byteLength:i.byteLength};var n=t.data;t.data=n.buffer,e.postMessage({action:"data",segment:t,byteOffset:n.byteOffset,byteLength:n.byteLength},[t.data])})),t.on("done",(function(t){e.postMessage({action:"done"})})),t.on("gopInfo",(function(t){e.postMessage({action:"gopInfo",gopInfo:t})})),t.on("videoSegmentTimingInfo",(function(t){var i={start:{decode:ge(t.start.dts),presentation:ge(t.start.pts)},end:{decode:ge(t.end.dts),presentation:ge(t.end.pts)},baseMediaDecodeTime:ge(t.baseMediaDecodeTime)};t.prependedContentDuration&&(i.prependedContentDuration=ge(t.prependedContentDuration)),e.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:i})})),t.on("audioSegmentTimingInfo",(function(t){var i={start:{decode:ge(t.start.dts),presentation:ge(t.start.pts)},end:{decode:ge(t.end.dts),presentation:ge(t.end.pts)},baseMediaDecodeTime:ge(t.baseMediaDecodeTime)};t.prependedContentDuration&&(i.prependedContentDuration=ge(t.prependedContentDuration)),e.postMessage({action:"audioSegmentTimingInfo",audioSegmentTimingInfo:i})})),t.on("id3Frame",(function(t){e.postMessage({action:"id3Frame",id3Frame:t})})),t.on("caption",(function(t){e.postMessage({action:"caption",caption:t})})),t.on("trackinfo",(function(t){e.postMessage({action:"trackinfo",trackInfo:t})})),t.on("audioTimingInfo",(function(t){e.postMessage({action:"audioTimingInfo",audioTimingInfo:{start:ge(t.start),end:ge(t.end)}})})),t.on("videoTimingInfo",(function(t){e.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:ge(t.start),end:ge(t.end)}})})),t.on("log",(function(t){e.postMessage({action:"log",log:t})}))}(this.self,this.transmuxer)},t.pushMp4Captions=function(e){this.captionParser||(this.captionParser=new oi,this.captionParser.init());var t=new Uint8Array(e.data,e.byteOffset,e.byteLength),i=this.captionParser.parse(t,e.trackIds,e.timescales);this.self.postMessage({action:"mp4Captions",captions:i&&i.captions||[],logs:i&&i.logs||[],data:t.buffer},[t.buffer])},t.probeMp4StartTime=function(e){var t=e.timescales,i=e.data,n=di(t,i);this.self.postMessage({action:"probeMp4StartTime",startTime:n,data:i},[i.buffer])},t.probeMp4Tracks=function(e){var t=e.data,i=hi(t);this.self.postMessage({action:"probeMp4Tracks",tracks:i,data:t},[t.buffer])},t.probeTs=function(e){var t=e.data,i=e.baseStartTime,n="number"!=typeof i||isNaN(i)?void 0:i*fe,r=Ci(t,n),a=null;r&&((a={hasVideo:r.video&&2===r.video.length||!1,hasAudio:r.audio&&2===r.audio.length||!1}).hasVideo&&(a.videoStart=r.video[0].ptsTime),a.hasAudio&&(a.audioStart=r.audio[0].ptsTime)),this.self.postMessage({action:"probeTs",result:a,data:t},[t.buffer])},t.clearAllMp4Captions=function(){this.captionParser&&this.captionParser.clearAllCaptions()},t.clearParsedMp4Captions=function(){this.captionParser&&this.captionParser.clearParsedCaptions()},t.push=function(e){var t=new Uint8Array(e.data,e.byteOffset,e.byteLength);this.transmuxer.push(t)},t.reset=function(){this.transmuxer.reset()},t.setTimestampOffset=function(e){var t=e.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(me(t)))},t.setAudioAppendStart=function(e){this.transmuxer.setAudioAppendStart(Math.ceil(me(e.appendStart)))},t.setRemux=function(e){this.transmuxer.setRemux(e.remux)},t.flush=function(e){this.transmuxer.flush(),self.postMessage({action:"done",type:"transmuxed"})},t.endTimeline=function(){this.transmuxer.endTimeline(),self.postMessage({action:"endedtimeline",type:"transmuxed"})},t.alignGopsWith=function(e){this.transmuxer.alignGopsWith(e.gopsToAlignWith.slice())},e}();self.onmessage=function(e){"init"===e.data.action&&e.data.options?this.messageHandlers=new xi(self,e.data.options):(this.messageHandlers||(this.messageHandlers=new xi(self)),e.data&&e.data.action&&"init"!==e.data.action&&this.messageHandlers[e.data.action]&&this.messageHandlers[e.data.action](e.data))}}))),bh=gh(_h),Th=function(e){var t=e.transmuxer,i=e.bytes,n=e.audioAppendStart,r=e.gopsToAlignWith,a=e.remux,s=e.onData,o=e.onTrackInfo,u=e.onAudioTimingInfo,l=e.onVideoTimingInfo,c=e.onVideoSegmentTimingInfo,d=e.onAudioSegmentTimingInfo,h=e.onId3,p=e.onCaptions,f=e.onDone,m=e.onEndedTimeline,g=e.onTransmuxerLog,v=e.isEndOfTimeline,y={buffer:[]},_=v;if(t.onmessage=function(i){t.currentTransmux===e&&("data"===i.data.action&&function(e,t,i){var n=e.data.segment,r=n.type,a=n.initSegment,s=n.captions,o=n.captionStreams,u=n.metadata,l=n.videoFrameDtsTime,c=n.videoFramePtsTime;t.buffer.push({captions:s,captionStreams:o,metadata:u});var d=e.data.segment.boxes||{data:e.data.segment.data},h={type:r,data:new Uint8Array(d.data,d.data.byteOffset,d.data.byteLength),initSegment:new Uint8Array(a.data,a.byteOffset,a.byteLength)};void 0!==l&&(h.videoFrameDtsTime=l),void 0!==c&&(h.videoFramePtsTime=c),i(h)}(i,y,s),"trackinfo"===i.data.action&&o(i.data.trackInfo),"gopInfo"===i.data.action&&function(e,t){t.gopInfo=e.data.gopInfo}(i,y),"audioTimingInfo"===i.data.action&&u(i.data.audioTimingInfo),"videoTimingInfo"===i.data.action&&l(i.data.videoTimingInfo),"videoSegmentTimingInfo"===i.data.action&&c(i.data.videoSegmentTimingInfo),"audioSegmentTimingInfo"===i.data.action&&d(i.data.audioSegmentTimingInfo),"id3Frame"===i.data.action&&h([i.data.id3Frame],i.data.id3Frame.dispatchType),"caption"===i.data.action&&p(i.data.caption),"endedtimeline"===i.data.action&&(_=!1,m()),"log"===i.data.action&&g(i.data.log),"transmuxed"===i.data.type&&(_||(t.onmessage=null,function(e){var t=e.transmuxedData,i=e.callback;t.buffer=[],i(t)}({transmuxedData:y,callback:f}),Sh(t))))},n&&t.postMessage({action:"setAudioAppendStart",appendStart:n}),Array.isArray(r)&&t.postMessage({action:"alignGopsWith",gopsToAlignWith:r}),void 0!==a&&t.postMessage({action:"setRemux",remux:a}),i.byteLength){var b=i instanceof ArrayBuffer?i:i.buffer,T=i instanceof ArrayBuffer?0:i.byteOffset;t.postMessage({action:"push",data:b,byteOffset:T,byteLength:i.byteLength},[b])}v&&t.postMessage({action:"endTimeline"}),t.postMessage({action:"flush"})},Sh=function(e){e.currentTransmux=null,e.transmuxQueue.length&&(e.currentTransmux=e.transmuxQueue.shift(),"function"==typeof e.currentTransmux?e.currentTransmux():Th(e.currentTransmux))},Eh=function(e,t){e.postMessage({action:t}),Sh(e)},wh=function(e,t){if(!t.currentTransmux)return t.currentTransmux=e,void Eh(t,e);t.transmuxQueue.push(Eh.bind(null,t,e))},kh=function(e){if(!e.transmuxer.currentTransmux)return e.transmuxer.currentTransmux=e,void Th(e);e.transmuxer.transmuxQueue.push(e)},Ch=function(e){wh("reset",e)},xh=function(e){var t=new bh;t.currentTransmux=null,t.transmuxQueue=[];var i=t.terminate;return t.terminate=function(){return t.currentTransmux=null,t.transmuxQueue.length=0,i.call(t)},t.postMessage({action:"init",options:e}),t},Ih=function(e){var t=e.transmuxer,i=e.endAction||e.action,n=e.callback,r=ie({},e,{endAction:null,transmuxer:null,callback:null});if(t.addEventListener("message",(function r(a){a.data.action===i&&(t.removeEventListener("message",r),a.data.data&&(a.data.data=new Uint8Array(a.data.data,e.byteOffset||0,e.byteLength||a.data.data.byteLength),e.data&&(e.data=a.data.data)),n(a.data))})),e.data){var a=e.data instanceof ArrayBuffer;r.byteOffset=a?0:e.data.byteOffset,r.byteLength=e.data.byteLength;var s=[a?e.data:e.data.buffer];t.postMessage(r,s)}else t.postMessage(r)},Ah=2,Ph=-101,Lh=-102,Dh=function(e){e.forEach((function(e){e.abort()}))},Oh=function(e,t){return t.timedout?{status:t.status,message:"HLS request timed-out at URL: "+t.uri,code:Ph,xhr:t}:t.aborted?{status:t.status,message:"HLS request aborted at URL: "+t.uri,code:Lh,xhr:t}:e?{status:t.status,message:"HLS request errored at URL: "+t.uri,code:Ah,xhr:t}:"arraybuffer"===t.responseType&&0===t.response.byteLength?{status:t.status,message:"Empty HLS response at URL: "+t.uri,code:Ah,xhr:t}:null},Nh=function(e,t,i){return function(n,r){var a=r.response,s=Oh(n,r);if(s)return i(s,e);if(16!==a.byteLength)return i({status:r.status,message:"Invalid HLS key at URL: "+r.uri,code:Ah,xhr:r},e);for(var o=new DataView(a),u=new Uint32Array([o.getUint32(0),o.getUint32(4),o.getUint32(8),o.getUint32(12)]),l=0;l<t.length;l++)t[l].bytes=u;return i(null,e)}},Rh=function(e,t){var i=xa(e.map.bytes);if("mp4"!==i){var n=e.map.resolvedUri||e.map.uri;return t({internal:!0,message:"Found unsupported "+(i||"unknown")+" container for initialization segment at URL: "+n,code:Ah})}Ih({action:"probeMp4Tracks",data:e.map.bytes,transmuxer:e.transmuxer,callback:function(i){var n=i.tracks,r=i.data;return e.map.bytes=r,n.forEach((function(t){e.map.tracks=e.map.tracks||{},e.map.tracks[t.type]||(e.map.tracks[t.type]=t,"number"==typeof t.id&&t.timescale&&(e.map.timescales=e.map.timescales||{},e.map.timescales[t.id]=t.timescale))})),t(null)}})},Mh=function(e){var t=e.segment,i=e.finishProcessingFn,n=e.responseType;return function(e,r){var a=Oh(e,r);if(a)return i(a,t);var s="arraybuffer"!==n&&r.responseText?function(e){for(var t=new Uint8Array(new ArrayBuffer(e.length)),i=0;i<e.length;i++)t[i]=e.charCodeAt(i);return t.buffer}(r.responseText.substring(t.lastReachedChar||0)):r.response;return t.stats=function(e){return{bandwidth:e.bandwidth,bytesReceived:e.bytesReceived||0,roundTripTime:e.roundTripTime||0}}(r),t.key?t.encryptedBytes=new Uint8Array(s):t.bytes=new Uint8Array(s),i(null,t)}},Uh=function(e){var t=e.segment,i=e.bytes,n=e.trackInfoFn,r=e.timingInfoFn,a=e.videoSegmentTimingInfoFn,s=e.audioSegmentTimingInfoFn,o=e.id3Fn,u=e.captionsFn,l=e.isEndOfTimeline,c=e.endedTimelineFn,d=e.dataFn,h=e.doneFn,p=e.onTransmuxerLog,f=t.map&&t.map.tracks||{},m=Boolean(f.audio&&f.video),g=r.bind(null,t,"audio","start"),v=r.bind(null,t,"audio","end"),y=r.bind(null,t,"video","start"),_=r.bind(null,t,"video","end");Ih({action:"probeTs",transmuxer:t.transmuxer,data:i,baseStartTime:t.baseStartTime,callback:function(e){t.bytes=i=e.data;var r=e.result;r&&(n(t,{hasAudio:r.hasAudio,hasVideo:r.hasVideo,isMuxed:m}),n=null,r.hasAudio&&!m&&g(r.audioStart),r.hasVideo&&y(r.videoStart),g=null,y=null),kh({bytes:i,transmuxer:t.transmuxer,audioAppendStart:t.audioAppendStart,gopsToAlignWith:t.gopsToAlignWith,remux:m,onData:function(e){e.type="combined"===e.type?"video":e.type,d(t,e)},onTrackInfo:function(e){n&&(m&&(e.isMuxed=!0),n(t,e))},onAudioTimingInfo:function(e){g&&void 0!==e.start&&(g(e.start),g=null),v&&void 0!==e.end&&v(e.end)},onVideoTimingInfo:function(e){y&&void 0!==e.start&&(y(e.start),y=null),_&&void 0!==e.end&&_(e.end)},onVideoSegmentTimingInfo:function(e){a(e)},onAudioSegmentTimingInfo:function(e){s(e)},onId3:function(e,i){o(t,e,i)},onCaptions:function(e){u(t,[e])},isEndOfTimeline:l,onEndedTimeline:function(){c()},onTransmuxerLog:p,onDone:function(e){h&&(e.type="combined"===e.type?"video":e.type,h(null,t,e))}})}})},Bh=function(e){var t=e.segment,i=e.bytes,n=e.trackInfoFn,r=e.timingInfoFn,a=e.videoSegmentTimingInfoFn,s=e.audioSegmentTimingInfoFn,o=e.id3Fn,u=e.captionsFn,l=e.isEndOfTimeline,c=e.endedTimelineFn,d=e.dataFn,h=e.doneFn,p=e.onTransmuxerLog,f=new Uint8Array(i);if(function(e){return oa(e,["moof"]).length>0}(f)){t.isFmp4=!0;var m=t.map.tracks,g={isFmp4:!0,hasVideo:!!m.video,hasAudio:!!m.audio};m.audio&&m.audio.codec&&"enca"!==m.audio.codec&&(g.audioCodec=m.audio.codec),m.video&&m.video.codec&&"encv"!==m.video.codec&&(g.videoCodec=m.video.codec),m.video&&m.audio&&(g.isMuxed=!0),n(t,g);var v=function(e){d(t,{data:f,type:g.hasAudio&&!g.isMuxed?"audio":"video"}),e&&e.length&&u(t,e),h(null,t,{})};Ih({action:"probeMp4StartTime",timescales:t.map.timescales,data:f,transmuxer:t.transmuxer,callback:function(e){var n=e.data,a=e.startTime;i=n.buffer,t.bytes=f=n,g.hasAudio&&!g.isMuxed&&r(t,"audio","start",a),g.hasVideo&&r(t,"video","start",a),m.video&&n.byteLength&&t.transmuxer?Ih({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:t.transmuxer,data:f,timescales:t.map.timescales,trackIds:[m.video.id],callback:function(e){i=e.data.buffer,t.bytes=f=e.data,e.logs.forEach((function(e){p($c.mergeOptions(e,{stream:"mp4CaptionParser"}))})),v(e.captions)}}):v()}})}else if(t.transmuxer){if(void 0===t.container&&(t.container=xa(f)),"ts"!==t.container&&"aac"!==t.container)return n(t,{hasAudio:!1,hasVideo:!1}),void h(null,t,{});Uh({segment:t,bytes:i,trackInfoFn:n,timingInfoFn:r,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:s,id3Fn:o,captionsFn:u,isEndOfTimeline:l,endedTimelineFn:c,dataFn:d,doneFn:h,onTransmuxerLog:p})}else h(null,t,{})},Fh=function(e,t){var i,n=e.id,r=e.key,a=e.encryptedBytes,s=e.decryptionWorker;s.addEventListener("message",(function e(i){if(i.data.source===n){s.removeEventListener("message",e);var r=i.data.decrypted;t(new Uint8Array(r.bytes,r.byteOffset,r.byteLength))}})),i=r.bytes.slice?r.bytes.slice():new Uint32Array(Array.prototype.slice.call(r.bytes)),s.postMessage(Zd({source:n,encrypted:a,key:i,iv:r.iv}),[a.buffer,i.buffer])},jh=function(e){var t=e.activeXhrs,i=e.decryptionWorker,n=e.trackInfoFn,r=e.timingInfoFn,a=e.videoSegmentTimingInfoFn,s=e.audioSegmentTimingInfoFn,o=e.id3Fn,u=e.captionsFn,l=e.isEndOfTimeline,c=e.endedTimelineFn,d=e.dataFn,h=e.doneFn,p=e.onTransmuxerLog,f=0,m=!1;return function(e,g){if(!m){if(e)return m=!0,Dh(t),h(e,g);if((f+=1)===t.length){var v=function(){if(g.encryptedBytes)return function(e){var t=e.decryptionWorker,i=e.segment,n=e.trackInfoFn,r=e.timingInfoFn,a=e.videoSegmentTimingInfoFn,s=e.audioSegmentTimingInfoFn,o=e.id3Fn,u=e.captionsFn,l=e.isEndOfTimeline,c=e.endedTimelineFn,d=e.dataFn,h=e.doneFn,p=e.onTransmuxerLog;Fh({id:i.requestId,key:i.key,encryptedBytes:i.encryptedBytes,decryptionWorker:t},(function(e){i.bytes=e,Bh({segment:i,bytes:i.bytes,trackInfoFn:n,timingInfoFn:r,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:s,id3Fn:o,captionsFn:u,isEndOfTimeline:l,endedTimelineFn:c,dataFn:d,doneFn:h,onTransmuxerLog:p})}))}({decryptionWorker:i,segment:g,trackInfoFn:n,timingInfoFn:r,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:s,id3Fn:o,captionsFn:u,isEndOfTimeline:l,endedTimelineFn:c,dataFn:d,doneFn:h,onTransmuxerLog:p});Bh({segment:g,bytes:g.bytes,trackInfoFn:n,timingInfoFn:r,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:s,id3Fn:o,captionsFn:u,isEndOfTimeline:l,endedTimelineFn:c,dataFn:d,doneFn:h,onTransmuxerLog:p})};if(g.endOfAllRequests=Date.now(),g.map&&g.map.encryptedBytes&&!g.map.bytes)return Fh({decryptionWorker:i,id:g.requestId+"-init",encryptedBytes:g.map.encryptedBytes,key:g.map.key},(function(e){g.map.bytes=e,Rh(g,(function(e){if(e)return Dh(t),h(e,g);v()}))}));v()}}}},qh=function(e){var t=e.segment,i=e.progressFn;return e.trackInfoFn,e.timingInfoFn,e.videoSegmentTimingInfoFn,e.audioSegmentTimingInfoFn,e.id3Fn,e.captionsFn,e.isEndOfTimeline,e.endedTimelineFn,e.dataFn,function(e){if(!e.target.aborted)return t.stats=$c.mergeOptions(t.stats,function(e){var t=e.target,i={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-t.requestTime||0};return i.bytesReceived=e.loaded,i.bandwidth=Math.floor(i.bytesReceived/i.roundTripTime*8*1e3),i}(e)),!t.stats.firstBytesReceivedAt&&t.stats.bytesReceived&&(t.stats.firstBytesReceivedAt=Date.now()),i(e,t)}},Vh=function(e){var t=e.xhr,i=e.xhrOptions,n=e.decryptionWorker,r=e.segment,a=e.abortFn,s=e.progressFn,o=e.trackInfoFn,u=e.timingInfoFn,l=e.videoSegmentTimingInfoFn,c=e.audioSegmentTimingInfoFn,d=e.id3Fn,h=e.captionsFn,p=e.isEndOfTimeline,f=e.endedTimelineFn,m=e.dataFn,g=e.doneFn,v=e.onTransmuxerLog,y=[],_=jh({activeXhrs:y,decryptionWorker:n,trackInfoFn:o,timingInfoFn:u,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:c,id3Fn:d,captionsFn:h,isEndOfTimeline:p,endedTimelineFn:f,dataFn:m,doneFn:g,onTransmuxerLog:v});if(r.key&&!r.key.bytes){var b=[r.key];r.map&&!r.map.bytes&&r.map.key&&r.map.key.resolvedUri===r.key.resolvedUri&&b.push(r.map.key);var T=t($c.mergeOptions(i,{uri:r.key.resolvedUri,responseType:"arraybuffer"}),Nh(r,b,_));y.push(T)}if(r.map&&!r.map.bytes){if(r.map.key&&(!r.key||r.key.resolvedUri!==r.map.key.resolvedUri)){var S=t($c.mergeOptions(i,{uri:r.map.key.resolvedUri,responseType:"arraybuffer"}),Nh(r,[r.map.key],_));y.push(S)}var E=$c.mergeOptions(i,{uri:r.map.resolvedUri,responseType:"arraybuffer",headers:Yd(r.map)}),w=function(e){var t=e.segment,i=e.finishProcessingFn;return function(e,n){var r=Oh(e,n);if(r)return i(r,t);var a=new Uint8Array(n.response);if(t.map.key)return t.map.encryptedBytes=a,i(null,t);t.map.bytes=a,Rh(t,(function(e){if(e)return e.xhr=n,e.status=n.status,i(e,t);i(null,t)}))}}({segment:r,finishProcessingFn:_}),k=t(E,w);y.push(k)}var C=$c.mergeOptions(i,{uri:r.part&&r.part.resolvedUri||r.resolvedUri,responseType:"arraybuffer",headers:Yd(r)}),x=t(C,Mh({segment:r,finishProcessingFn:_,responseType:C.responseType}));x.addEventListener("progress",qh({segment:r,progressFn:s,trackInfoFn:o,timingInfoFn:u,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:c,id3Fn:d,captionsFn:h,isEndOfTimeline:p,endedTimelineFn:f,dataFn:m})),y.push(x);var I={};return y.forEach((function(e){e.addEventListener("loadend",function(e){var t=e.loadendState,i=e.abortFn;return function(e){e.target.aborted&&i&&!t.calledAbortFn&&(i(),t.calledAbortFn=!0)}}({loadendState:I,abortFn:a}))})),function(){return Dh(y)}},Hh=id("CodecUtils"),Wh=function(e,t){var i=t.attributes||{};return e&&e.mediaGroups&&e.mediaGroups.AUDIO&&i.AUDIO&&e.mediaGroups.AUDIO[i.AUDIO]},Gh=function(e){var t={};return e.forEach((function(e){var i=e.mediaType,n=e.type,r=e.details;t[i]=t[i]||[],t[i].push(xt(""+n+r))})),Object.keys(t).forEach((function(e){if(t[e].length>1)return Hh("multiple "+e+" codecs found as attributes: "+t[e].join(", ")+". Setting playlist codecs to null so that we wait for mux.js to probe segments for real codecs."),void(t[e]=null);t[e]=t[e][0]})),t},zh=function(e){var t=0;return e.audio&&t++,e.video&&t++,t},Xh=function(e,t){var i=t.attributes||{},n=Gh(function(e){var t=e.attributes||{};if(t.CODECS)return It(t.CODECS)}(t)||[]);if(Wh(e,t)&&!n.audio&&!function(e,t){if(!Wh(e,t))return!0;var i=t.attributes||{},n=e.mediaGroups.AUDIO[i.AUDIO];for(var r in n)if(!n[r].uri&&!n[r].playlists)return!0;return!1}(e,t)){var r=Gh(function(e,t){if(!e.mediaGroups.AUDIO||!t)return null;var i=e.mediaGroups.AUDIO[t];if(!i)return null;for(var n in i){var r=i[n];if(r.default&&r.playlists)return It(r.playlists[0].attributes.CODECS)}return null}(e,i.AUDIO)||[]);r.audio&&(n.audio=r.audio)}return n},Kh=id("PlaylistSelector"),Yh=function(e){if(e&&e.playlist){var t=e.playlist;return JSON.stringify({id:t.id,bandwidth:e.bandwidth,width:e.width,height:e.height,codecs:t.attributes&&t.attributes.CODECS||""})}},Qh=function(e,t){if(!e)return"";var i=d.getComputedStyle(e);return i?i[t]:""},$h=function(e,t){var i=e.slice();e.sort((function(e,n){var r=t(e,n);return 0===r?i.indexOf(e)-i.indexOf(n):r}))},Jh=function(e,t){var i,n;return e.attributes.BANDWIDTH&&(i=e.attributes.BANDWIDTH),i=i||d.Number.MAX_VALUE,t.attributes.BANDWIDTH&&(n=t.attributes.BANDWIDTH),i-(n=n||d.Number.MAX_VALUE)},Zh=function(e,t,i,n,r,a){if(e){var s={bandwidth:t,width:i,height:n,limitRenditionByPlayerDimensions:r},o=e.playlists;Pd.isAudioOnly(e)&&(o=a.getAudioTrackPlaylists_(),s.audioOnly=!0);var u=o.map((function(e){var t=e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width,i=e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.height;return{bandwidth:e.attributes&&e.attributes.BANDWIDTH||d.Number.MAX_VALUE,width:t,height:i,playlist:e}}));$h(u,(function(e,t){return e.bandwidth-t.bandwidth}));var l=(u=u.filter((function(e){return!Pd.isIncompatible(e.playlist)}))).filter((function(e){return Pd.isEnabled(e.playlist)}));l.length||(l=u.filter((function(e){return!Pd.isDisabled(e.playlist)})));var c=l.filter((function(e){return e.bandwidth*fh.BANDWIDTH_VARIANCE<t})),h=c[c.length-1],p=c.filter((function(e){return e.bandwidth===h.bandwidth}))[0];if(!1===r){var f=p||l[0]||u[0];if(f&&f.playlist){var m="sortedPlaylistReps";return p&&(m="bandwidthBestRep"),l[0]&&(m="enabledPlaylistReps"),Kh("choosing "+Yh(f)+" using "+m+" with options",s),f.playlist}return Kh("could not choose a playlist with options",s),null}var g=c.filter((function(e){return e.width&&e.height}));$h(g,(function(e,t){return e.width-t.width}));var v=g.filter((function(e){return e.width===i&&e.height===n}));h=v[v.length-1];var y,_,b,T,S=v.filter((function(e){return e.bandwidth===h.bandwidth}))[0];if(S||(_=(y=g.filter((function(e){return e.width>i||e.height>n}))).filter((function(e){return e.width===y[0].width&&e.height===y[0].height})),h=_[_.length-1],b=_.filter((function(e){return e.bandwidth===h.bandwidth}))[0]),a.experimentalLeastPixelDiffSelector){var E=g.map((function(e){return e.pixelDiff=Math.abs(e.width-i)+Math.abs(e.height-n),e}));$h(E,(function(e,t){return e.pixelDiff===t.pixelDiff?t.bandwidth-e.bandwidth:e.pixelDiff-t.pixelDiff})),T=E[0]}var w=T||b||S||p||l[0]||u[0];if(w&&w.playlist){var k="sortedPlaylistReps";return T?k="leastPixelDiffRep":b?k="resolutionPlusOneRep":S?k="resolutionBestRep":p?k="bandwidthBestRep":l[0]&&(k="enabledPlaylistReps"),Kh("choosing "+Yh(w)+" using "+k+" with options",s),w.playlist}return Kh("could not choose a playlist with options",s),null}},ep=function(){var e=this.useDevicePixelRatio&&d.devicePixelRatio||1;return Zh(this.playlists.master,this.systemBandwidth,parseInt(Qh(this.tech_.el(),"width"),10)*e,parseInt(Qh(this.tech_.el(),"height"),10)*e,this.limitRenditionByPlayerDimensions,this.masterPlaylistController_)},tp=function(e){var t=e.inbandTextTracks,i=e.metadataArray,n=e.timestampOffset,r=e.videoDuration;if(i){var a=d.WebKitDataCue||d.VTTCue,s=t.metadataTrack_;if(s&&(i.forEach((function(e){var t=e.cueTime+n;!("number"!=typeof t||d.isNaN(t)||t<0)&&t<1/0&&e.frames.forEach((function(e){var i=new a(t,t,e.value||e.url||e.data||"");i.frame=e,i.value=e,function(e){Object.defineProperties(e.frame,{id:{get:function(){return $c.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),e.value.key}},value:{get:function(){return $c.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),e.value.data}},privateData:{get:function(){return $c.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),e.value.data}}})}(i),s.addCue(i)}))})),s.cues&&s.cues.length)){for(var o=s.cues,u=[],l=0;l<o.length;l++)o[l]&&u.push(o[l]);var c=u.reduce((function(e,t){var i=e[t.startTime]||[];return i.push(t),e[t.startTime]=i,e}),{}),h=Object.keys(c).sort((function(e,t){return Number(e)-Number(t)}));h.forEach((function(e,t){var i=c[e],n=Number(h[t+1])||r;i.forEach((function(e){e.endTime=n}))}))}}},ip=function(e,t,i){var n,r;if(i&&i.cues)for(n=i.cues.length;n--;)(r=i.cues[n]).startTime>=e&&r.endTime<=t&&i.removeCue(r)},np=function(e){return"number"==typeof e&&isFinite(e)},rp=1/60,ap=function(e){var t=e.startOfSegment,i=e.duration,n=e.segment,r=e.part,a=e.playlist,s=a.mediaSequence,o=a.id,u=a.segments,l=void 0===u?[]:u,c=e.mediaIndex,d=e.partIndex,h=e.timeline,p=l.length-1,f="mediaIndex/partIndex increment";e.getMediaInfoForTime?f="getMediaInfoForTime ("+e.getMediaInfoForTime+")":e.isSyncRequest&&(f="getSyncSegmentCandidate (isSyncRequest)"),e.independent&&(f+=" with independent "+e.independent);var m="number"==typeof d,g=e.segment.uri?"segment":"pre-segment",v=m?gd({preloadSegment:n})-1:0;return g+" ["+(s+c)+"/"+(s+p)+"]"+(m?" part ["+d+"/"+v+"]":"")+" segment start/end ["+n.start+" => "+n.end+"]"+(m?" part start/end ["+r.start+" => "+r.end+"]":"")+" startOfSegment ["+t+"] duration ["+i+"] timeline ["+h+"] selected by ["+f+"] playlist ["+o+"]"},sp=function(e){return e+"TimingInfo"},op=function(e){var t=e.timelineChangeController,i=e.currentTimeline,n=e.segmentTimeline,r=e.loaderType,a=e.audioDisabled;if(i===n)return!1;if("audio"===r){var s=t.lastTimelineChange({type:"main"});return!s||s.to!==n}if("main"===r&&a){var o=t.pendingTimelineChange({type:"audio"});return!o||o.to!==n}return!1},up=function(e){var t=e.segmentDuration,i=e.maxDuration;return!!t&&Math.round(t)>i+nd},lp=function(e,t){if("hls"!==t)return null;var i,n,r=(i={audioTimingInfo:e.audioTimingInfo,videoTimingInfo:e.videoTimingInfo},n=0,["video","audio"].forEach((function(e){var t=i[e+"TimingInfo"];if(t){var r,a=t.start,s=t.end;"bigint"==typeof a||"bigint"==typeof s?r=d.BigInt(s)-d.BigInt(a):"number"==typeof a&&"number"==typeof s&&(r=s-a),void 0!==r&&r>n&&(n=r)}})),"bigint"==typeof n&&n<Number.MAX_SAFE_INTEGER&&(n=Number(n)),n);if(!r)return null;var a=e.playlist.targetDuration,s=up({segmentDuration:r,maxDuration:2*a}),o=up({segmentDuration:r,maxDuration:a}),u="Segment with index "+e.mediaIndex+" from playlist "+e.playlist.id+" has a duration of "+r+" when the reported duration is "+e.duration+" and the target duration is "+a+". For HLS content, a duration in excess of the target duration may result in playback issues. See the HLS specification section on EXT-X-TARGETDURATION for more details: https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.3.1";return s||o?{severity:s?"warn":"info",message:u}:null},cp=function(e){function t(t,i){var n;if(n=e.call(this)||this,!t)throw new TypeError("Initialization settings are required");if("function"!=typeof t.currentTime)throw new TypeError("No currentTime getter specified");if(!t.mediaSource)throw new TypeError("No MediaSource specified");return n.bandwidth=t.bandwidth,n.throughput={rate:0,count:0},n.roundTrip=NaN,n.resetStats_(),n.mediaIndex=null,n.partIndex=null,n.hasPlayed_=t.hasPlayed,n.currentTime_=t.currentTime,n.seekable_=t.seekable,n.seeking_=t.seeking,n.duration_=t.duration,n.mediaSource_=t.mediaSource,n.vhs_=t.vhs,n.loaderType_=t.loaderType,n.currentMediaInfo_=void 0,n.startingMediaInfo_=void 0,n.segmentMetadataTrack_=t.segmentMetadataTrack,n.goalBufferLength_=t.goalBufferLength,n.sourceType_=t.sourceType,n.sourceUpdater_=t.sourceUpdater,n.inbandTextTracks_=t.inbandTextTracks,n.state_="INIT",n.timelineChangeController_=t.timelineChangeController,n.shouldSaveSegmentTimingInfo_=!0,n.parse708captions_=t.parse708captions,n.useDtsForTimestampOffset_=t.useDtsForTimestampOffset,n.captionServices_=t.captionServices,n.experimentalExactManifestTimings=t.experimentalExactManifestTimings,n.checkBufferTimeout_=null,n.error_=void 0,n.currentTimeline_=-1,n.pendingSegment_=null,n.xhrOptions_=null,n.pendingSegments_=[],n.audioDisabled_=!1,n.isPendingTimestampOffset_=!1,n.gopBuffer_=[],n.timeMapping_=0,n.safeAppend_=$c.browser.IE_VERSION>=11,n.appendInitSegment_={audio:!0,video:!0},n.playlistOfLastInitSegment_={audio:null,video:null},n.callQueue_=[],n.loadQueue_=[],n.metadataQueue_={id3:[],caption:[]},n.waitingOnRemove_=!1,n.quotaExceededErrorRetryTimeout_=null,n.activeInitSegmentId_=null,n.initSegments_={},n.cacheEncryptionKeys_=t.cacheEncryptionKeys,n.keyCache_={},n.decrypter_=t.decrypter,n.syncController_=t.syncController,n.syncPoint_={segmentIndex:0,time:0},n.transmuxer_=n.createTransmuxer_(),n.triggerSyncInfoUpdate_=function(){return n.trigger("syncinfoupdate")},n.syncController_.on("syncinfoupdate",n.triggerSyncInfoUpdate_),n.mediaSource_.addEventListener("sourceopen",(function(){n.isEndOfStream_()||(n.ended_=!1)})),n.fetchAtBuffer_=!1,n.logger_=id("SegmentLoader["+n.loaderType_+"]"),Object.defineProperty(ae(n),"state",{get:function(){return this.state_},set:function(e){e!==this.state_&&(this.logger_(this.state_+" -> "+e),this.state_=e,this.trigger("statechange"))}}),n.sourceUpdater_.on("ready",(function(){n.hasEnoughInfoToAppend_()&&n.processCallQueue_()})),"main"===n.loaderType_&&n.timelineChangeController_.on("pendingtimelinechange",(function(){n.hasEnoughInfoToAppend_()&&n.processCallQueue_()})),"audio"===n.loaderType_&&n.timelineChangeController_.on("timelinechange",(function(){n.hasEnoughInfoToLoad_()&&n.processLoadQueue_(),n.hasEnoughInfoToAppend_()&&n.processCallQueue_()})),n}oe(t,e);var i=t.prototype;return i.createTransmuxer_=function(){return xh({remux:!1,alignGopsAtEnd:this.safeAppend_,keepOriginalTimestamps:!0,parse708captions:this.parse708captions_,captionServices:this.captionServices_})},i.resetStats_=function(){this.mediaBytesTransferred=0,this.mediaRequests=0,this.mediaRequestsAborted=0,this.mediaRequestsTimedout=0,this.mediaRequestsErrored=0,this.mediaTransferDuration=0,this.mediaSecondsLoaded=0,this.mediaAppends=0},i.dispose=function(){this.trigger("dispose"),this.state="DISPOSED",this.pause(),this.abort_(),this.transmuxer_&&this.transmuxer_.terminate(),this.resetStats_(),this.checkBufferTimeout_&&d.clearTimeout(this.checkBufferTimeout_),this.syncController_&&this.triggerSyncInfoUpdate_&&this.syncController_.off("syncinfoupdate",this.triggerSyncInfoUpdate_),this.off()},i.setAudio=function(e){this.audioDisabled_=!e,e?this.appendInitSegment_.audio=!0:this.sourceUpdater_.removeAudio(0,this.duration_())},i.abort=function(){"WAITING"===this.state?(this.abort_(),this.state="READY",this.paused()||this.monitorBuffer_()):this.pendingSegment_&&(this.pendingSegment_=null)},i.abort_=function(){this.pendingSegment_&&this.pendingSegment_.abortRequests&&this.pendingSegment_.abortRequests(),this.pendingSegment_=null,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_),this.waitingOnRemove_=!1,d.clearTimeout(this.quotaExceededErrorRetryTimeout_),this.quotaExceededErrorRetryTimeout_=null},i.checkForAbort_=function(e){return"APPENDING"!==this.state||this.pendingSegment_?!this.pendingSegment_||this.pendingSegment_.requestId!==e:(this.state="READY",!0)},i.error=function(e){return void 0!==e&&(this.logger_("error occurred:",e),this.error_=e),this.pendingSegment_=null,this.error_},i.endOfStream=function(){this.ended_=!0,this.transmuxer_&&Ch(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")},i.buffered_=function(){var e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return $c.createTimeRanges();if("main"===this.loaderType_){var t=e.hasAudio,i=e.hasVideo,n=e.isMuxed;if(i&&t&&!this.audioDisabled_&&!n)return this.sourceUpdater_.buffered();if(i)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()},i.initSegmentForMap=function(e,t){if(void 0===t&&(t=!1),!e)return null;var i=eh(e),n=this.initSegments_[i];return t&&!n&&e.bytes&&(this.initSegments_[i]=n={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes,tracks:e.tracks,timescales:e.timescales}),n||e},i.segmentKey=function(e,t){if(void 0===t&&(t=!1),!e)return null;var i=th(e),n=this.keyCache_[i];this.cacheEncryptionKeys_&&t&&!n&&e.bytes&&(this.keyCache_[i]=n={resolvedUri:e.resolvedUri,bytes:e.bytes});var r={resolvedUri:(n||e).resolvedUri};return n&&(r.bytes=n.bytes),r},i.couldBeginLoading_=function(){return this.playlist_&&!this.paused()},i.load=function(){if(this.monitorBuffer_(),this.playlist_)return"INIT"===this.state&&this.couldBeginLoading_()?this.init_():void(!this.couldBeginLoading_()||"READY"!==this.state&&"INIT"!==this.state||(this.state="READY"))},i.init_=function(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()},i.playlist=function(e,t){if(void 0===t&&(t={}),e){var i=this.playlist_,n=this.pendingSegment_;this.playlist_=e,this.xhrOptions_=t,"INIT"===this.state&&(e.syncInfo={mediaSequence:e.mediaSequence,time:0},"main"===this.loaderType_&&this.syncController_.setDateTimeMappingForStart(e));var r=null;if(i&&(i.id?r=i.id:i.uri&&(r=i.uri)),this.logger_("playlist update ["+r+" => "+(e.id||e.uri)+"]"),this.trigger("syncinfoupdate"),"INIT"===this.state&&this.couldBeginLoading_())return this.init_();if(!i||i.uri!==e.uri)return null!==this.mediaIndex&&(e.endList?this.resyncLoader():this.resetLoader()),this.currentMediaInfo_=void 0,void this.trigger("playlistupdate");var a=e.mediaSequence-i.mediaSequence;if(this.logger_("live window shift ["+a+"]"),null!==this.mediaIndex)if(this.mediaIndex-=a,this.mediaIndex<0)this.mediaIndex=null,this.partIndex=null;else{var s=this.playlist_.segments[this.mediaIndex];if(this.partIndex&&(!s.parts||!s.parts.length||!s.parts[this.partIndex])){var o=this.mediaIndex;this.logger_("currently processing part (index "+this.partIndex+") no longer exists."),this.resetLoader(),this.mediaIndex=o}}n&&(n.mediaIndex-=a,n.mediaIndex<0?(n.mediaIndex=null,n.partIndex=null):(n.mediaIndex>=0&&(n.segment=e.segments[n.mediaIndex]),n.partIndex>=0&&n.segment.parts&&(n.part=n.segment.parts[n.partIndex]))),this.syncController_.saveExpiredSegmentInfo(i,e)}},i.pause=function(){this.checkBufferTimeout_&&(d.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)},i.paused=function(){return null===this.checkBufferTimeout_},i.resetEverything=function(e){this.ended_=!1,this.appendInitSegment_={audio:!0,video:!0},this.resetLoader(),this.remove(0,1/0,e),this.transmuxer_&&(this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.transmuxer_.postMessage({action:"reset"}))},i.resetLoader=function(){this.fetchAtBuffer_=!1,this.resyncLoader()},i.resyncLoader=function(){this.transmuxer_&&Ch(this.transmuxer_),this.mediaIndex=null,this.partIndex=null,this.syncPoint_=null,this.isPendingTimestampOffset_=!1,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.abort(),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})},i.remove=function(e,t,i,n){if(void 0===i&&(i=function(){}),void 0===n&&(n=!1),t===1/0&&(t=this.duration_()),t<=e)this.logger_("skipping remove because end ${end} is <= start ${start}");else if(this.sourceUpdater_&&this.getMediaInfo_()){var r=1,a=function(){0===--r&&i()};for(var s in!n&&this.audioDisabled_||(r++,this.sourceUpdater_.removeAudio(e,t,a)),(n||"main"===this.loaderType_)&&(this.gopBuffer_=function(e,t,i,n){for(var r=Math.ceil((t-n)*Aa),a=Math.ceil((i-n)*Aa),s=e.slice(),o=e.length;o--&&!(e[o].pts<=a););if(-1===o)return s;for(var u=o+1;u--&&!(e[u].pts<=r););return u=Math.max(u,0),s.splice(u,o-u+1),s}(this.gopBuffer_,e,t,this.timeMapping_),r++,this.sourceUpdater_.removeVideo(e,t,a)),this.inbandTextTracks_)ip(e,t,this.inbandTextTracks_[s]);ip(e,t,this.segmentMetadataTrack_),a()}else this.logger_("skipping remove because no source updater or starting media info")},i.monitorBuffer_=function(){this.checkBufferTimeout_&&d.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=d.setTimeout(this.monitorBufferTick_.bind(this),1)},i.monitorBufferTick_=function(){"READY"===this.state&&this.fillBuffer_(),this.checkBufferTimeout_&&d.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=d.setTimeout(this.monitorBufferTick_.bind(this),500)},i.fillBuffer_=function(){if(!this.sourceUpdater_.updating()){var e=this.chooseNextRequest_();e&&("number"==typeof e.timestampOffset&&(this.isPendingTimestampOffset_=!1,this.timelineChangeController_.pendingTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline})),this.loadSegment_(e))}},i.isEndOfStream_=function(e,t,i){if(void 0===e&&(e=this.mediaIndex),void 0===t&&(t=this.playlist_),void 0===i&&(i=this.partIndex),!t||!this.mediaSource_)return!1;var n="number"==typeof e&&t.segments[e],r=e+1===t.segments.length,a=!n||!n.parts||i+1===n.parts.length;return t.endList&&"open"===this.mediaSource_.readyState&&r&&a},i.chooseNextRequest_=function(){var e=this.buffered_(),t=cd(e)||0,i=dd(e,this.currentTime_()),n=!this.hasPlayed_()&&i>=1,r=i>=this.goalBufferLength_(),a=this.playlist_.segments;if(!a.length||n||r)return null;this.syncPoint_=this.syncPoint_||this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_());var s={partIndex:null,mediaIndex:null,startOfSegment:null,playlist:this.playlist_,isSyncRequest:Boolean(!this.syncPoint_)};if(s.isSyncRequest)s.mediaIndex=function(e,t,i){t=t||[];for(var n=[],r=0,a=0;a<t.length;a++){var s=t[a];if(e===s.timeline&&(n.push(a),(r+=s.duration)>i))return a}return 0===n.length?0:n[n.length-1]}(this.currentTimeline_,a,t);else if(null!==this.mediaIndex){var o=a[this.mediaIndex],u="number"==typeof this.partIndex?this.partIndex:-1;s.startOfSegment=o.end?o.end:t,o.parts&&o.parts[u+1]?(s.mediaIndex=this.mediaIndex,s.partIndex=u+1):s.mediaIndex=this.mediaIndex+1}else{var l=Pd.getMediaInfoForTime({experimentalExactManifestTimings:this.experimentalExactManifestTimings,playlist:this.playlist_,currentTime:this.fetchAtBuffer_?t:this.currentTime_(),startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time}),c=l.segmentIndex,d=l.startTime,h=l.partIndex;s.getMediaInfoForTime=this.fetchAtBuffer_?"bufferedEnd "+t:"currentTime "+this.currentTime_(),s.mediaIndex=c,s.startOfSegment=d,s.partIndex=h}var p=a[s.mediaIndex],f=p&&"number"==typeof s.partIndex&&p.parts&&p.parts[s.partIndex];if(!p||"number"==typeof s.partIndex&&!f)return null;if("number"!=typeof s.partIndex&&p.parts&&(s.partIndex=0,f=p.parts[0]),!i&&f&&!f.independent)if(0===s.partIndex){var m=a[s.mediaIndex-1],g=m.parts&&m.parts.length&&m.parts[m.parts.length-1];g&&g.independent&&(s.mediaIndex-=1,s.partIndex=m.parts.length-1,s.independent="previous segment")}else p.parts[s.partIndex-1].independent&&(s.partIndex-=1,s.independent="previous part");var v=this.mediaSource_&&"ended"===this.mediaSource_.readyState;return s.mediaIndex>=a.length-1&&v&&!this.seeking_()?null:this.generateSegmentInfo_(s)},i.generateSegmentInfo_=function(e){var t=e.independent,i=e.playlist,n=e.mediaIndex,r=e.startOfSegment,a=e.isSyncRequest,s=e.partIndex,o=e.forceTimestampOffset,u=e.getMediaInfoForTime,l=i.segments[n],c="number"==typeof s&&l.parts[s],d={requestId:"segment-loader-"+Math.random(),uri:c&&c.resolvedUri||l.resolvedUri,mediaIndex:n,partIndex:c?s:null,isSyncRequest:a,startOfSegment:r,playlist:i,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:l.timeline,duration:c&&c.duration||l.duration,segment:l,part:c,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:u,independent:t},h=void 0!==o?o:this.isPendingTimestampOffset_;d.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:l.timeline,currentTimeline:this.currentTimeline_,startOfSegment:r,buffered:this.buffered_(),overrideCheck:h});var p=cd(this.sourceUpdater_.audioBuffered());return"number"==typeof p&&(d.audioAppendStart=p-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(d.gopsToAlignWith=function(e,t,i){if(null==t||!e.length)return[];var n,r=Math.ceil((t-i+3)*Aa);for(n=0;n<e.length&&!(e[n].pts>r);n++);return e.slice(n)}(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),d},i.timestampOffsetForSegment_=function(e){return i=(t=e).segmentTimeline,n=t.currentTimeline,r=t.startOfSegment,a=t.buffered,t.overrideCheck||i!==n?i<n?r:a.length?a.end(a.length-1):r:null;var t,i,n,r,a},i.earlyAbortWhenNeeded_=function(e){if(!this.vhs_.tech_.paused()&&this.xhrOptions_.timeout&&this.playlist_.attributes.BANDWIDTH&&!(Date.now()-(e.firstBytesReceivedAt||Date.now())<1e3)){var t=this.currentTime_(),i=e.bandwidth,n=this.pendingSegment_.duration,r=Pd.estimateSegmentRequestTime(n,i,this.playlist_,e.bytesReceived),a=function(e,t,i){return void 0===i&&(i=1),((e.length?e.end(e.length-1):0)-t)/i}(this.buffered_(),t,this.vhs_.tech_.playbackRate())-1;if(!(r<=a)){var s=function(e){var t=e.master,i=e.currentTime,n=e.bandwidth,r=e.duration,a=e.segmentDuration,s=e.timeUntilRebuffer,o=e.currentTimeline,u=e.syncController,l=t.playlists.filter((function(e){return!Pd.isIncompatible(e)})),c=l.filter(Pd.isEnabled);c.length||(c=l.filter((function(e){return!Pd.isDisabled(e)})));var d=c.filter(Pd.hasAttribute.bind(null,"BANDWIDTH")).map((function(e){var t=u.getSyncPoint(e,r,o,i)?1:2;return{playlist:e,rebufferingImpact:Pd.estimateSegmentRequestTime(a,n,e)*t-s}})),h=d.filter((function(e){return e.rebufferingImpact<=0}));return $h(h,(function(e,t){return Jh(t.playlist,e.playlist)})),h.length?h[0]:($h(d,(function(e,t){return e.rebufferingImpact-t.rebufferingImpact})),d[0]||null)}({master:this.vhs_.playlists.master,currentTime:t,bandwidth:i,duration:this.duration_(),segmentDuration:n,timeUntilRebuffer:a,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(s){var o=r-a-s.rebufferingImpact,u=.5;a<=nd&&(u=1),!s.playlist||s.playlist.uri===this.playlist_.uri||o<u||(this.bandwidth=s.playlist.attributes.BANDWIDTH*fh.BANDWIDTH_VARIANCE+1,this.trigger("earlyabort"))}}}},i.handleAbort_=function(e){this.logger_("Aborting "+ap(e)),this.mediaRequestsAborted+=1},i.handleProgress_=function(e,t){this.earlyAbortWhenNeeded_(t.stats),this.checkForAbort_(t.requestId)||this.trigger("progress")},i.handleTrackInfo_=function(e,t){this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId)||this.checkForIllegalMediaSwitch(t)||(t=t||{},function(e,t){if(!e&&!t||!e&&t||e&&!t)return!1;if(e===t)return!0;var i=Object.keys(e).sort(),n=Object.keys(t).sort();if(i.length!==n.length)return!1;for(var r=0;r<i.length;r++){var a=i[r];if(a!==n[r])return!1;if(e[a]!==t[a])return!1}return!0}(this.currentMediaInfo_,t)||(this.appendInitSegment_={audio:!0,video:!0},this.startingMediaInfo_=t,this.currentMediaInfo_=t,this.logger_("trackinfo update",t),this.trigger("trackinfo")),this.checkForAbort_(e.requestId)||(this.pendingSegment_.trackInfo=t,this.hasEnoughInfoToAppend_()&&this.processCallQueue_()))},i.handleTimingInfo_=function(e,t,i,n){if(this.earlyAbortWhenNeeded_(e.stats),!this.checkForAbort_(e.requestId)){var r=this.pendingSegment_,a=sp(t);r[a]=r[a]||{},r[a][i]=n,this.logger_("timinginfo: "+t+" - "+i+" - "+n),this.hasEnoughInfoToAppend_()&&this.processCallQueue_()}},i.handleCaptions_=function(e,t){var i=this;if(this.earlyAbortWhenNeeded_(e.stats),!this.checkForAbort_(e.requestId))if(0!==t.length)if(this.pendingSegment_.hasAppendedData_){var n=null===this.sourceUpdater_.videoTimestampOffset()?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset(),r={};t.forEach((function(e){r[e.stream]=r[e.stream]||{startTime:1/0,captions:[],endTime:0};var t=r[e.stream];t.startTime=Math.min(t.startTime,e.startTime+n),t.endTime=Math.max(t.endTime,e.endTime+n),t.captions.push(e)})),Object.keys(r).forEach((function(e){var t=r[e],a=t.startTime,s=t.endTime,o=t.captions,u=i.inbandTextTracks_;i.logger_("adding cues from "+a+" -> "+s+" for "+e),function(e,t,i){if(!e[i]){t.trigger({type:"usage",name:"vhs-608"}),t.trigger({type:"usage",name:"hls-608"});var n=i;/^cc708_/.test(i)&&(n="SERVICE"+i.split("_")[1]);var r=t.textTracks().getTrackById(n);if(r)e[i]=r;else{var a=i,s=i,o=!1,u=(t.options_.vhs&&t.options_.vhs.captionServices||{})[n];u&&(a=u.label,s=u.language,o=u.default),e[i]=t.addRemoteTextTrack({kind:"captions",id:n,default:o,label:a,language:s},!1).track}}}(u,i.vhs_.tech_,e),ip(a,s,u[e]),function(e){var t=e.inbandTextTracks,i=e.captionArray,n=e.timestampOffset;if(i){var r=d.WebKitDataCue||d.VTTCue;i.forEach((function(e){var i=e.stream;t[i].addCue(new r(e.startTime+n,e.endTime+n,e.text))}))}}({captionArray:o,inbandTextTracks:u,timestampOffset:n})})),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}else this.metadataQueue_.caption.push(this.handleCaptions_.bind(this,e,t));else this.logger_("SegmentLoader received no captions from a caption event")},i.handleId3_=function(e,t,i){if(this.earlyAbortWhenNeeded_(e.stats),!this.checkForAbort_(e.requestId))if(this.pendingSegment_.hasAppendedData_){var n=null===this.sourceUpdater_.videoTimestampOffset()?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset();!function(e,t,i){e.metadataTrack_||(e.metadataTrack_=i.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,e.metadataTrack_.inBandMetadataTrackDispatchType=t)}(this.inbandTextTracks_,i,this.vhs_.tech_),tp({inbandTextTracks:this.inbandTextTracks_,metadataArray:t,timestampOffset:n,videoDuration:this.duration_()})}else this.metadataQueue_.id3.push(this.handleId3_.bind(this,e,t,i))},i.processMetadataQueue_=function(){this.metadataQueue_.id3.forEach((function(e){return e()})),this.metadataQueue_.caption.forEach((function(e){return e()})),this.metadataQueue_.id3=[],this.metadataQueue_.caption=[]},i.processCallQueue_=function(){var e=this.callQueue_;this.callQueue_=[],e.forEach((function(e){return e()}))},i.processLoadQueue_=function(){var e=this.loadQueue_;this.loadQueue_=[],e.forEach((function(e){return e()}))},i.hasEnoughInfoToLoad_=function(){if("audio"!==this.loaderType_)return!0;var e=this.pendingSegment_;return!!e&&(!this.getCurrentMediaInfo_()||!op({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))},i.getCurrentMediaInfo_=function(e){return void 0===e&&(e=this.pendingSegment_),e&&e.trackInfo||this.currentMediaInfo_},i.getMediaInfo_=function(e){return void 0===e&&(e=this.pendingSegment_),this.getCurrentMediaInfo_(e)||this.startingMediaInfo_},i.hasEnoughInfoToAppend_=function(){if(!this.sourceUpdater_.ready())return!1;if(this.waitingOnRemove_||this.quotaExceededErrorRetryTimeout_)return!1;var e=this.pendingSegment_,t=this.getCurrentMediaInfo_();if(!e||!t)return!1;var i=t.hasAudio,n=t.hasVideo,r=t.isMuxed;return!(n&&!e.videoTimingInfo)&&(!(i&&!this.audioDisabled_&&!r&&!e.audioTimingInfo)&&!op({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))},i.handleData_=function(e,t){if(this.earlyAbortWhenNeeded_(e.stats),!this.checkForAbort_(e.requestId))if(!this.callQueue_.length&&this.hasEnoughInfoToAppend_()){var i=this.pendingSegment_;if(this.setTimeMapping_(i.timeline),this.updateMediaSecondsLoaded_(i.part||i.segment),"closed"!==this.mediaSource_.readyState){if(e.map&&(e.map=this.initSegmentForMap(e.map,!0),i.segment.map=e.map),e.key&&this.segmentKey(e.key,!0),i.isFmp4=e.isFmp4,i.timingInfo=i.timingInfo||{},i.isFmp4)this.trigger("fmp4"),i.timingInfo.start=i[sp(t.type)].start;else{var n,r=this.getCurrentMediaInfo_(),a="main"===this.loaderType_&&r&&r.hasVideo;a&&(n=i.videoTimingInfo.start),i.timingInfo.start=this.trueSegmentStart_({currentStart:i.timingInfo.start,playlist:i.playlist,mediaIndex:i.mediaIndex,currentVideoTimestampOffset:this.sourceUpdater_.videoTimestampOffset(),useVideoTimingInfo:a,firstVideoFrameTimeForData:n,videoTimingInfo:i.videoTimingInfo,audioTimingInfo:i.audioTimingInfo})}if(this.updateAppendInitSegmentStatus(i,t.type),this.updateSourceBufferTimestampOffset_(i),i.isSyncRequest){this.updateTimingInfoEnd_(i),this.syncController_.saveSegmentTimingInfo({segmentInfo:i,shouldSaveTimelineMapping:"main"===this.loaderType_});var s=this.chooseNextRequest_();if(s.mediaIndex!==i.mediaIndex||s.partIndex!==i.partIndex)return void this.logger_("sync segment was incorrect, not appending");this.logger_("sync segment was correct, appending")}i.hasAppendedData_=!0,this.processMetadataQueue_(),this.appendData_(i,t)}}else this.callQueue_.push(this.handleData_.bind(this,e,t))},i.updateAppendInitSegmentStatus=function(e,t){"main"!==this.loaderType_||"number"!=typeof e.timestampOffset||e.changedTimestampOffset||(this.appendInitSegment_={audio:!0,video:!0}),this.playlistOfLastInitSegment_[t]!==e.playlist&&(this.appendInitSegment_[t]=!0)},i.getInitSegmentAndUpdateState_=function(e){var t=e.type,i=e.initSegment,n=e.map,r=e.playlist;if(n){var a=eh(n);if(this.activeInitSegmentId_===a)return null;i=this.initSegmentForMap(n,!0).bytes,this.activeInitSegmentId_=a}return i&&this.appendInitSegment_[t]?(this.playlistOfLastInitSegment_[t]=r,this.appendInitSegment_[t]=!1,this.activeInitSegmentId_=null,i):null},i.handleQuotaExceededError_=function(e,t){var i=this,n=e.segmentInfo,r=e.type,a=e.bytes,s=this.sourceUpdater_.audioBuffered(),o=this.sourceUpdater_.videoBuffered();s.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: "+ld(s).join(", ")),o.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: "+ld(o).join(", "));var u=s.length?s.start(0):0,l=s.length?s.end(s.length-1):0,c=o.length?o.start(0):0,h=o.length?o.end(o.length-1):0;if(l-u<=1&&h-c<=1)return this.logger_("On QUOTA_EXCEEDED_ERR, single segment too large to append to buffer, triggering an error. Appended byte length: "+a.byteLength+", audio buffer: "+ld(s).join(", ")+", video buffer: "+ld(o).join(", ")+", "),this.error({message:"Quota exceeded error with append of a single segment of content",excludeUntil:1/0}),void this.trigger("error");this.waitingOnRemove_=!0,this.callQueue_.push(this.appendToSourceBuffer_.bind(this,{segmentInfo:n,type:r,bytes:a}));var p=this.currentTime_()-1;this.logger_("On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to "+p),this.remove(0,p,(function(){i.logger_("On QUOTA_EXCEEDED_ERR, retrying append in 1s"),i.waitingOnRemove_=!1,i.quotaExceededErrorRetryTimeout_=d.setTimeout((function(){i.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),i.quotaExceededErrorRetryTimeout_=null,i.processCallQueue_()}),1e3)}),!0)},i.handleAppendError_=function(e,t){var i=e.segmentInfo,n=e.type,r=e.bytes;t&&(22!==t.code?(this.logger_("Received non QUOTA_EXCEEDED_ERR on append",t),this.error(n+" append of "+r.length+"b failed for segment #"+i.mediaIndex+" in playlist "+i.playlist.id),this.trigger("appenderror")):this.handleQuotaExceededError_({segmentInfo:i,type:n,bytes:r}))},i.appendToSourceBuffer_=function(e){var t,i,n,r=e.segmentInfo,a=e.type,s=e.initSegment,o=e.data,u=e.bytes;if(!u){var l=[o],c=o.byteLength;s&&(l.unshift(s),c+=s.byteLength),n=0,(t={bytes:c,segments:l}).bytes&&(i=new Uint8Array(t.bytes),t.segments.forEach((function(e){i.set(e,n),n+=e.byteLength}))),u=i}this.sourceUpdater_.appendBuffer({segmentInfo:r,type:a,bytes:u},this.handleAppendError_.bind(this,{segmentInfo:r,type:a,bytes:u}))},i.handleSegmentTimingInfo_=function(e,t,i){if(this.pendingSegment_&&t===this.pendingSegment_.requestId){var n=this.pendingSegment_.segment,r=e+"TimingInfo";n[r]||(n[r]={}),n[r].transmuxerPrependedSeconds=i.prependedContentDuration||0,n[r].transmuxedPresentationStart=i.start.presentation,n[r].transmuxedDecodeStart=i.start.decode,n[r].transmuxedPresentationEnd=i.end.presentation,n[r].transmuxedDecodeEnd=i.end.decode,n[r].baseMediaDecodeTime=i.baseMediaDecodeTime}},i.appendData_=function(e,t){var i=t.type,n=t.data;if(n&&n.byteLength&&("audio"!==i||!this.audioDisabled_)){var r=this.getInitSegmentAndUpdateState_({type:i,initSegment:t.initSegment,playlist:e.playlist,map:e.isFmp4?e.segment.map:null});this.appendToSourceBuffer_({segmentInfo:e,type:i,initSegment:r,data:n})}},i.loadSegment_=function(e){var t=this;this.state="WAITING",this.pendingSegment_=e,this.trimBackBuffer_(e),"number"==typeof e.timestampOffset&&this.transmuxer_&&this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.hasEnoughInfoToLoad_()?this.updateTransmuxerAndRequestSegment_(e):this.loadQueue_.push((function(){var i=ie({},e,{forceTimestampOffset:!0});ie(e,t.generateSegmentInfo_(i)),t.isPendingTimestampOffset_=!1,t.updateTransmuxerAndRequestSegment_(e)}))},i.updateTransmuxerAndRequestSegment_=function(e){var t=this;this.shouldUpdateTransmuxerTimestampOffset_(e.timestampOffset)&&(this.gopBuffer_.length=0,e.gopsToAlignWith=[],this.timeMapping_=0,this.transmuxer_.postMessage({action:"reset"}),this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:e.timestampOffset}));var i=this.createSimplifiedSegmentObj_(e),n=this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex),r=null!==this.mediaIndex,a=e.timeline!==this.currentTimeline_&&e.timeline>0,s=n||r&&a;this.logger_("Requesting "+ap(e)),i.map&&!i.map.bytes&&(this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0}),e.abortRequests=Vh({xhr:this.vhs_.xhr,xhrOptions:this.xhrOptions_,decryptionWorker:this.decrypter_,segment:i,abortFn:this.handleAbort_.bind(this,e),progressFn:this.handleProgress_.bind(this),trackInfoFn:this.handleTrackInfo_.bind(this),timingInfoFn:this.handleTimingInfo_.bind(this),videoSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"video",e.requestId),audioSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"audio",e.requestId),captionsFn:this.handleCaptions_.bind(this),isEndOfTimeline:s,endedTimelineFn:function(){t.logger_("received endedtimeline callback")},id3Fn:this.handleId3_.bind(this),dataFn:this.handleData_.bind(this),doneFn:this.segmentRequestFinished_.bind(this),onTransmuxerLog:function(i){var n=i.message,r=i.level,a=i.stream;t.logger_(ap(e)+" logged from transmuxer stream "+a+" as a "+r+": "+n)}})},i.trimBackBuffer_=function(e){var t=function(e,t,i){var n=t-fh.BACK_BUFFER_LENGTH;e.length&&(n=Math.max(n,e.start(0)));var r=t-i;return Math.min(r,n)}(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);t>0&&this.remove(0,t)},i.createSimplifiedSegmentObj_=function(e){var t=e.segment,i=e.part,n={resolvedUri:i?i.resolvedUri:t.resolvedUri,byterange:i?i.byterange:t.byterange,requestId:e.requestId,transmuxer:e.transmuxer,audioAppendStart:e.audioAppendStart,gopsToAlignWith:e.gopsToAlignWith,part:e.part},r=e.playlist.segments[e.mediaIndex-1];if(r&&r.timeline===t.timeline&&(r.videoTimingInfo?n.baseStartTime=r.videoTimingInfo.transmuxedDecodeEnd:r.audioTimingInfo&&(n.baseStartTime=r.audioTimingInfo.transmuxedDecodeEnd)),t.key){var a=t.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]);n.key=this.segmentKey(t.key),n.key.iv=a}return t.map&&(n.map=this.initSegmentForMap(t.map)),n},i.saveTransferStats_=function(e){this.mediaRequests+=1,e&&(this.mediaBytesTransferred+=e.bytesReceived,this.mediaTransferDuration+=e.roundTripTime)},i.saveBandwidthRelatedStats_=function(e,t){this.pendingSegment_.byteLength=t.bytesReceived,e<rp?this.logger_("Ignoring segment's bandwidth because its duration of "+e+" is less than the min to record "+rp):(this.bandwidth=t.bandwidth,this.roundTrip=t.roundTripTime)},i.handleTimeout_=function(){this.mediaRequestsTimedout+=1,this.bandwidth=1,this.roundTrip=NaN,this.trigger("bandwidthupdate"),this.trigger("timeout")},i.segmentRequestFinished_=function(e,t,i){if(this.callQueue_.length)this.callQueue_.push(this.segmentRequestFinished_.bind(this,e,t,i));else if(this.saveTransferStats_(t.stats),this.pendingSegment_&&t.requestId===this.pendingSegment_.requestId){if(e){if(this.pendingSegment_=null,this.state="READY",e.code===Lh)return;return this.pause(),e.code===Ph?void this.handleTimeout_():(this.mediaRequestsErrored+=1,this.error(e),void this.trigger("error"))}var n=this.pendingSegment_;this.saveBandwidthRelatedStats_(n.duration,t.stats),n.endOfAllRequests=t.endOfAllRequests,i.gopInfo&&(this.gopBuffer_=function(e,t,i){if(!t.length)return e;if(i)return t.slice();for(var n=t[0].pts,r=0;r<e.length&&!(e[r].pts>=n);r++);return e.slice(0,r).concat(t)}(this.gopBuffer_,i.gopInfo,this.safeAppend_)),this.state="APPENDING",this.trigger("appending"),this.waitForAppendsToComplete_(n)}},i.setTimeMapping_=function(e){var t=this.syncController_.mappingForTimeline(e);null!==t&&(this.timeMapping_=t)},i.updateMediaSecondsLoaded_=function(e){"number"==typeof e.start&&"number"==typeof e.end?this.mediaSecondsLoaded+=e.end-e.start:this.mediaSecondsLoaded+=e.duration},i.shouldUpdateTransmuxerTimestampOffset_=function(e){return null!==e&&("main"===this.loaderType_&&e!==this.sourceUpdater_.videoTimestampOffset()||!this.audioDisabled_&&e!==this.sourceUpdater_.audioTimestampOffset())},i.trueSegmentStart_=function(e){var t=e.currentStart,i=e.playlist,n=e.mediaIndex,r=e.firstVideoFrameTimeForData,a=e.currentVideoTimestampOffset,s=e.useVideoTimingInfo,o=e.videoTimingInfo,u=e.audioTimingInfo;if(void 0!==t)return t;if(!s)return u.start;var l=i.segments[n-1];return 0!==n&&l&&void 0!==l.start&&l.end===r+a?o.start:r},i.waitForAppendsToComplete_=function(e){var t=this.getCurrentMediaInfo_(e);if(!t)return this.error({message:"No starting media returned, likely due to an unsupported media format.",blacklistDuration:1/0}),void this.trigger("error");var i=t.hasAudio,n=t.hasVideo,r=t.isMuxed,a="main"===this.loaderType_&&n,s=!this.audioDisabled_&&i&&!r;if(e.waitingOnAppends=0,!e.hasAppendedData_)return e.timingInfo||"number"!=typeof e.timestampOffset||(this.isPendingTimestampOffset_=!0),e.timingInfo={start:0},e.waitingOnAppends++,this.isPendingTimestampOffset_||(this.updateSourceBufferTimestampOffset_(e),this.processMetadataQueue_()),void this.checkAppendsDone_(e);a&&e.waitingOnAppends++,s&&e.waitingOnAppends++,a&&this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this,e)),s&&this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this,e))},i.checkAppendsDone_=function(e){this.checkForAbort_(e.requestId)||(e.waitingOnAppends--,0===e.waitingOnAppends&&this.handleAppendsDone_())},i.checkForIllegalMediaSwitch=function(e){var t=function(e,t,i){return"main"===e&&t&&i?i.hasAudio||i.hasVideo?t.hasVideo&&!i.hasVideo?"Only audio found in segment when we expected video. We can't switch to audio only from a stream that had video. To get rid of this message, please add codec information to the manifest.":!t.hasVideo&&i.hasVideo?"Video found in segment when we expected only audio. We can't switch to a stream with video from an audio only stream. To get rid of this message, please add codec information to the manifest.":null:"Neither audio nor video found in segment.":null}(this.loaderType_,this.getCurrentMediaInfo_(),e);return!!t&&(this.error({message:t,blacklistDuration:1/0}),this.trigger("error"),!0)},i.updateSourceBufferTimestampOffset_=function(e){if(null!==e.timestampOffset&&"number"==typeof e.timingInfo.start&&!e.changedTimestampOffset&&"main"===this.loaderType_){var t=!1;e.timestampOffset-=this.getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e.segment.videoTimingInfo,audioTimingInfo:e.segment.audioTimingInfo,timingInfo:e.timingInfo}),e.changedTimestampOffset=!0,e.timestampOffset!==this.sourceUpdater_.videoTimestampOffset()&&(this.sourceUpdater_.videoTimestampOffset(e.timestampOffset),t=!0),e.timestampOffset!==this.sourceUpdater_.audioTimestampOffset()&&(this.sourceUpdater_.audioTimestampOffset(e.timestampOffset),t=!0),t&&this.trigger("timestampoffset")}},i.getSegmentStartTimeForTimestampOffsetCalculation_=function(e){var t=e.videoTimingInfo,i=e.audioTimingInfo,n=e.timingInfo;return this.useDtsForTimestampOffset_?t&&"number"==typeof t.transmuxedDecodeStart?t.transmuxedDecodeStart:i&&"number"==typeof i.transmuxedDecodeStart?i.transmuxedDecodeStart:n.start:n.start},i.updateTimingInfoEnd_=function(e){e.timingInfo=e.timingInfo||{};var t=this.getMediaInfo_(),i="main"===this.loaderType_&&t&&t.hasVideo&&e.videoTimingInfo?e.videoTimingInfo:e.audioTimingInfo;i&&(e.timingInfo.end="number"==typeof i.end?i.end:i.start+e.duration)},i.handleAppendsDone_=function(){if(this.pendingSegment_&&this.trigger("appendsdone"),!this.pendingSegment_)return this.state="READY",void(this.paused()||this.monitorBuffer_());var e=this.pendingSegment_;this.updateTimingInfoEnd_(e),this.shouldSaveSegmentTimingInfo_&&this.syncController_.saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:"main"===this.loaderType_});var t=lp(e,this.sourceType_);if(t&&("warn"===t.severity?$c.log.warn(t.message):this.logger_(t.message)),this.recordThroughput_(e),this.pendingSegment_=null,this.state="READY",!e.isSyncRequest||(this.trigger("syncinfoupdate"),e.hasAppendedData_)){this.logger_("Appended "+ap(e)),this.addSegmentMetadataCue_(e),this.fetchAtBuffer_=!0,this.currentTimeline_!==e.timeline&&(this.timelineChangeController_.lastTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline}),"main"!==this.loaderType_||this.audioDisabled_||this.timelineChangeController_.lastTimelineChange({type:"audio",from:this.currentTimeline_,to:e.timeline})),this.currentTimeline_=e.timeline,this.trigger("syncinfoupdate");var i=e.segment,n=e.part,r=i.end&&this.currentTime_()-i.end>3*e.playlist.targetDuration,a=n&&n.end&&this.currentTime_()-n.end>3*e.playlist.partTargetDuration;if(r||a)return this.logger_("bad "+(r?"segment":"part")+" "+ap(e)),void this.resetEverything();null!==this.mediaIndex&&this.trigger("bandwidthupdate"),this.trigger("progress"),this.mediaIndex=e.mediaIndex,this.partIndex=e.partIndex,this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex)&&this.endOfStream(),this.trigger("appended"),e.hasAppendedData_&&this.mediaAppends++,this.paused()||this.monitorBuffer_()}else this.logger_("Throwing away un-appended sync request "+ap(e))},i.recordThroughput_=function(e){if(e.duration<rp)this.logger_("Ignoring segment's throughput because its duration of "+e.duration+" is less than the min to record "+rp);else{var t=this.throughput.rate,i=Date.now()-e.endOfAllRequests+1,n=Math.floor(e.byteLength/i*8*1e3);this.throughput.rate+=(n-t)/++this.throughput.count}},i.addSegmentMetadataCue_=function(e){if(this.segmentMetadataTrack_){var t=e.segment,i=t.start,n=t.end;if(np(i)&&np(n)){ip(i,n,this.segmentMetadataTrack_);var r=d.WebKitDataCue||d.VTTCue,a={custom:t.custom,dateTimeObject:t.dateTimeObject,dateTimeString:t.dateTimeString,bandwidth:e.playlist.attributes.BANDWIDTH,resolution:e.playlist.attributes.RESOLUTION,codecs:e.playlist.attributes.CODECS,byteLength:e.byteLength,uri:e.uri,timeline:e.timeline,playlist:e.playlist.id,start:i,end:n},s=new r(i,n,JSON.stringify(a));s.value=a,this.segmentMetadataTrack_.addCue(s)}}},t}($c.EventTarget);function dp(){}var hp,pp=function(e){return"string"!=typeof e?e:e.replace(/./,(function(e){return e.toUpperCase()}))},fp=["video","audio"],mp=function(e,t){var i=t[e+"Buffer"];return i&&i.updating||t.queuePending[e]},gp=function e(t,i){if(0!==i.queue.length){var n=0,r=i.queue[n];if("mediaSource"!==r.type){if("mediaSource"!==t&&i.ready()&&"closed"!==i.mediaSource.readyState&&!mp(t,i)){if(r.type!==t){if(n=function(e,t){for(var i=0;i<t.length;i++){var n=t[i];if("mediaSource"===n.type)return null;if(n.type===e)return i}return null}(t,i.queue),null===n)return;r=i.queue[n]}return i.queue.splice(n,1),i.queuePending[t]=r,r.action(t,i),r.doneFn?void 0:(i.queuePending[t]=null,void e(t,i))}}else i.updating()||"closed"===i.mediaSource.readyState||(i.queue.shift(),r.action(i),r.doneFn&&r.doneFn(),e("audio",i),e("video",i))}},vp=function(e,t){var i=t[e+"Buffer"],n=pp(e);i&&(i.removeEventListener("updateend",t["on"+n+"UpdateEnd_"]),i.removeEventListener("error",t["on"+n+"Error_"]),t.codecs[e]=null,t[e+"Buffer"]=null)},yp=function(e,t){return e&&t&&-1!==Array.prototype.indexOf.call(e.sourceBuffers,t)},_p=function(e,t,i){return function(n,r){var a=r[n+"Buffer"];if(yp(r.mediaSource,a)){r.logger_("Appending segment "+t.mediaIndex+"'s "+e.length+" bytes to "+n+"Buffer");try{a.appendBuffer(e)}catch(e){r.logger_("Error with code "+e.code+" "+(22===e.code?"(QUOTA_EXCEEDED_ERR) ":"")+"when appending segment "+t.mediaIndex+" to "+n+"Buffer"),r.queuePending[n]=null,i(e)}}}},bp=function(e,t){return function(i,n){var r=n[i+"Buffer"];if(yp(n.mediaSource,r)){n.logger_("Removing "+e+" to "+t+" from "+i+"Buffer");try{r.remove(e,t)}catch(r){n.logger_("Remove "+e+" to "+t+" from "+i+"Buffer failed")}}}},Tp=function(e){return function(t,i){var n=i[t+"Buffer"];yp(i.mediaSource,n)&&(i.logger_("Setting "+t+"timestampOffset to "+e),n.timestampOffset=e)}},Sp=function(e){return function(t,i){e()}},Ep=function(e){return function(t){if("open"===t.mediaSource.readyState){t.logger_("Calling mediaSource endOfStream("+(e||"")+")");try{t.mediaSource.endOfStream(e)}catch(e){$c.log.warn("Failed to call media source endOfStream",e)}}}},wp=function(e){return function(t){t.logger_("Setting mediaSource duration to "+e);try{t.mediaSource.duration=e}catch(e){$c.log.warn("Failed to set media source duration",e)}}},kp=function(){return function(e,t){if("open"===t.mediaSource.readyState){var i=t[e+"Buffer"];if(yp(t.mediaSource,i)){t.logger_("calling abort on "+e+"Buffer");try{i.abort()}catch(t){$c.log.warn("Failed to abort on "+e+"Buffer",t)}}}}},Cp=function(e,t){return function(i){var n=pp(e),r=Pt(t);i.logger_("Adding "+e+"Buffer with codec "+t+" to mediaSource");var a=i.mediaSource.addSourceBuffer(r);a.addEventListener("updateend",i["on"+n+"UpdateEnd_"]),a.addEventListener("error",i["on"+n+"Error_"]),i.codecs[e]=t,i[e+"Buffer"]=a}},xp=function(e){return function(t){var i=t[e+"Buffer"];if(vp(e,t),yp(t.mediaSource,i)){t.logger_("Removing "+e+"Buffer with codec "+t.codecs[e]+" from mediaSource");try{t.mediaSource.removeSourceBuffer(i)}catch(t){$c.log.warn("Failed to removeSourceBuffer "+e+"Buffer",t)}}}},Ip=function(e){return function(t,i){var n=i[t+"Buffer"],r=Pt(e);yp(i.mediaSource,n)&&i.codecs[t]!==e&&(i.logger_("changing "+t+"Buffer codec from "+i.codecs[t]+" to "+e),n.changeType(r),i.codecs[t]=e)}},Ap=function(e){var t=e.type,i=e.sourceUpdater,n=e.action,r=e.doneFn,a=e.name;i.queue.push({type:t,action:n,doneFn:r,name:a}),gp(t,i)},Pp=function(e,t){return function(i){if(t.queuePending[e]){var n=t.queuePending[e].doneFn;t.queuePending[e]=null,n&&n(t[e+"Error_"])}gp(e,t)}},Lp=function(e){function t(t){var i;return(i=e.call(this)||this).mediaSource=t,i.sourceopenListener_=function(){return gp("mediaSource",ae(i))},i.mediaSource.addEventListener("sourceopen",i.sourceopenListener_),i.logger_=id("SourceUpdater"),i.audioTimestampOffset_=0,i.videoTimestampOffset_=0,i.queue=[],i.queuePending={audio:null,video:null},i.delayedAudioAppendQueue_=[],i.videoAppendQueued_=!1,i.codecs={},i.onVideoUpdateEnd_=Pp("video",ae(i)),i.onAudioUpdateEnd_=Pp("audio",ae(i)),i.onVideoError_=function(e){i.videoError_=e},i.onAudioError_=function(e){i.audioError_=e},i.createdSourceBuffers_=!1,i.initializedEme_=!1,i.triggeredReady_=!1,i}oe(t,e);var i=t.prototype;return i.initializedEme=function(){this.initializedEme_=!0,this.triggerReady()},i.hasCreatedSourceBuffers=function(){return this.createdSourceBuffers_},i.hasInitializedAnyEme=function(){return this.initializedEme_},i.ready=function(){return this.hasCreatedSourceBuffers()&&this.hasInitializedAnyEme()},i.createSourceBuffers=function(e){this.hasCreatedSourceBuffers()||(this.addOrChangeSourceBuffers(e),this.createdSourceBuffers_=!0,this.trigger("createdsourcebuffers"),this.triggerReady())},i.triggerReady=function(){this.ready()&&!this.triggeredReady_&&(this.triggeredReady_=!0,this.trigger("ready"))},i.addSourceBuffer=function(e,t){Ap({type:"mediaSource",sourceUpdater:this,action:Cp(e,t),name:"addSourceBuffer"})},i.abort=function(e){Ap({type:e,sourceUpdater:this,action:kp(e),name:"abort"})},i.removeSourceBuffer=function(e){this.canRemoveSourceBuffer()?Ap({type:"mediaSource",sourceUpdater:this,action:xp(e),name:"removeSourceBuffer"}):$c.log.error("removeSourceBuffer is not supported!")},i.canRemoveSourceBuffer=function(){return!$c.browser.IE_VERSION&&!$c.browser.IS_FIREFOX&&d.MediaSource&&d.MediaSource.prototype&&"function"==typeof d.MediaSource.prototype.removeSourceBuffer},t.canChangeType=function(){return d.SourceBuffer&&d.SourceBuffer.prototype&&"function"==typeof d.SourceBuffer.prototype.changeType},i.canChangeType=function(){return this.constructor.canChangeType()},i.changeType=function(e,t){this.canChangeType()?Ap({type:e,sourceUpdater:this,action:Ip(t),name:"changeType"}):$c.log.error("changeType is not supported!")},i.addOrChangeSourceBuffers=function(e){var t=this;if(!e||"object"!==u(e)||0===Object.keys(e).length)throw new Error("Cannot addOrChangeSourceBuffers to undefined codecs");Object.keys(e).forEach((function(i){var n=e[i];if(!t.hasCreatedSourceBuffers())return t.addSourceBuffer(i,n);t.canChangeType()&&t.changeType(i,n)}))},i.appendBuffer=function(e,t){var i=this,n=e.segmentInfo,r=e.type,a=e.bytes;if(this.processedAppend_=!0,"audio"===r&&this.videoBuffer&&!this.videoAppendQueued_)return this.delayedAudioAppendQueue_.push([e,t]),void this.logger_("delayed audio append of "+a.length+" until video append");if(Ap({type:r,sourceUpdater:this,action:_p(a,n||{mediaIndex:-1},t),doneFn:t,name:"appendBuffer"}),"video"===r){if(this.videoAppendQueued_=!0,!this.delayedAudioAppendQueue_.length)return;var s=this.delayedAudioAppendQueue_.slice();this.logger_("queuing delayed audio "+s.length+" appendBuffers"),this.delayedAudioAppendQueue_.length=0,s.forEach((function(e){i.appendBuffer.apply(i,e)}))}},i.audioBuffered=function(){return yp(this.mediaSource,this.audioBuffer)&&this.audioBuffer.buffered?this.audioBuffer.buffered:$c.createTimeRange()},i.videoBuffered=function(){return yp(this.mediaSource,this.videoBuffer)&&this.videoBuffer.buffered?this.videoBuffer.buffered:$c.createTimeRange()},i.buffered=function(){var e=yp(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,t=yp(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;return t&&!e?this.audioBuffered():e&&!t?this.videoBuffered():function(e,t){var i=null,n=null,r=0,a=[],s=[];if(!(e&&e.length&&t&&t.length))return $c.createTimeRange();for(var o=e.length;o--;)a.push({time:e.start(o),type:"start"}),a.push({time:e.end(o),type:"end"});for(o=t.length;o--;)a.push({time:t.start(o),type:"start"}),a.push({time:t.end(o),type:"end"});for(a.sort((function(e,t){return e.time-t.time})),o=0;o<a.length;o++)"start"===a[o].type?2==++r&&(i=a[o].time):"end"===a[o].type&&1==--r&&(n=a[o].time),null!==i&&null!==n&&(s.push([i,n]),i=null,n=null);return $c.createTimeRanges(s)}(this.audioBuffered(),this.videoBuffered())},i.setDuration=function(e,t){void 0===t&&(t=dp),Ap({type:"mediaSource",sourceUpdater:this,action:wp(e),name:"duration",doneFn:t})},i.endOfStream=function(e,t){void 0===e&&(e=null),void 0===t&&(t=dp),"string"!=typeof e&&(e=void 0),Ap({type:"mediaSource",sourceUpdater:this,action:Ep(e),name:"endOfStream",doneFn:t})},i.removeAudio=function(e,t,i){void 0===i&&(i=dp),this.audioBuffered().length&&0!==this.audioBuffered().end(0)?Ap({type:"audio",sourceUpdater:this,action:bp(e,t),doneFn:i,name:"remove"}):i()},i.removeVideo=function(e,t,i){void 0===i&&(i=dp),this.videoBuffered().length&&0!==this.videoBuffered().end(0)?Ap({type:"video",sourceUpdater:this,action:bp(e,t),doneFn:i,name:"remove"}):i()},i.updating=function(){return!(!mp("audio",this)&&!mp("video",this))},i.audioTimestampOffset=function(e){return void 0!==e&&this.audioBuffer&&this.audioTimestampOffset_!==e&&(Ap({type:"audio",sourceUpdater:this,action:Tp(e),name:"timestampOffset"}),this.audioTimestampOffset_=e),this.audioTimestampOffset_},i.videoTimestampOffset=function(e){return void 0!==e&&this.videoBuffer&&this.videoTimestampOffset!==e&&(Ap({type:"video",sourceUpdater:this,action:Tp(e),name:"timestampOffset"}),this.videoTimestampOffset_=e),this.videoTimestampOffset_},i.audioQueueCallback=function(e){this.audioBuffer&&Ap({type:"audio",sourceUpdater:this,action:Sp(e),name:"callback"})},i.videoQueueCallback=function(e){this.videoBuffer&&Ap({type:"video",sourceUpdater:this,action:Sp(e),name:"callback"})},i.dispose=function(){var e=this;this.trigger("dispose"),fp.forEach((function(t){e.abort(t),e.canRemoveSourceBuffer()?e.removeSourceBuffer(t):e[t+"QueueCallback"]((function(){return vp(t,e)}))})),this.videoAppendQueued_=!1,this.delayedAudioAppendQueue_.length=0,this.sourceopenListener_&&this.mediaSource.removeEventListener("sourceopen",this.sourceopenListener_),this.off()},t}($c.EventTarget),Dp=function(e){return decodeURIComponent(escape(String.fromCharCode.apply(null,e)))},Op=new Uint8Array("\n\n".split("").map((function(e){return e.charCodeAt(0)}))),Np=function(e){function t(){return e.call(this,"Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.")||this}return oe(t,e),t}(La(Error)),Rp=function(e){function t(t,i){var n;return void 0===i&&(i={}),(n=e.call(this,t,i)||this).mediaSource_=null,n.subtitlesTrack_=null,n.loaderType_="subtitle",n.featuresNativeTextTracks_=t.featuresNativeTextTracks,n.loadVttJs=t.loadVttJs,n.shouldSaveSegmentTimingInfo_=!1,n}oe(t,e);var i=t.prototype;return i.createTransmuxer_=function(){return null},i.buffered_=function(){if(!this.subtitlesTrack_||!this.subtitlesTrack_.cues||!this.subtitlesTrack_.cues.length)return $c.createTimeRanges();var e=this.subtitlesTrack_.cues,t=e[0].startTime,i=e[e.length-1].startTime;return $c.createTimeRanges([[t,i]])},i.initSegmentForMap=function(e,t){if(void 0===t&&(t=!1),!e)return null;var i=eh(e),n=this.initSegments_[i];if(t&&!n&&e.bytes){var r=Op.byteLength+e.bytes.byteLength,a=new Uint8Array(r);a.set(e.bytes),a.set(Op,e.bytes.byteLength),this.initSegments_[i]=n={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:a}}return n||e},i.couldBeginLoading_=function(){return this.playlist_&&this.subtitlesTrack_&&!this.paused()},i.init_=function(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()},i.track=function(e){return void 0===e||(this.subtitlesTrack_=e,"INIT"===this.state&&this.couldBeginLoading_()&&this.init_()),this.subtitlesTrack_},i.remove=function(e,t){ip(e,t,this.subtitlesTrack_)},i.fillBuffer_=function(){var e=this,t=this.chooseNextRequest_();if(t){if(null===this.syncController_.timestampOffsetForTimeline(t.timeline)){return this.syncController_.one("timestampoffset",(function(){e.state="READY",e.paused()||e.monitorBuffer_()})),void(this.state="WAITING_ON_TIMELINE")}this.loadSegment_(t)}},i.timestampOffsetForSegment_=function(){return null},i.chooseNextRequest_=function(){return this.skipEmptySegments_(e.prototype.chooseNextRequest_.call(this))},i.skipEmptySegments_=function(e){for(;e&&e.segment.empty;){if(e.mediaIndex+1>=e.playlist.segments.length){e=null;break}e=this.generateSegmentInfo_({playlist:e.playlist,mediaIndex:e.mediaIndex+1,startOfSegment:e.startOfSegment+e.duration,isSyncRequest:e.isSyncRequest})}return e},i.stopForError=function(e){this.error(e),this.state="READY",this.pause(),this.trigger("error")},i.segmentRequestFinished_=function(e,t,i){var n=this;if(this.subtitlesTrack_){if(this.saveTransferStats_(t.stats),!this.pendingSegment_)return this.state="READY",void(this.mediaRequestsAborted+=1);if(e)return e.code===Ph&&this.handleTimeout_(),e.code===Lh?this.mediaRequestsAborted+=1:this.mediaRequestsErrored+=1,void this.stopForError(e);var r=this.pendingSegment_;this.saveBandwidthRelatedStats_(r.duration,t.stats),t.key&&this.segmentKey(t.key,!0),this.state="APPENDING",this.trigger("appending");var a=r.segment;if(a.map&&(a.map.bytes=t.map.bytes),r.bytes=t.bytes,"function"!=typeof d.WebVTT&&"function"==typeof this.loadVttJs)return this.state="WAITING_ON_VTTJS",void this.loadVttJs().then((function(){return n.segmentRequestFinished_(e,t,i)}),(function(){return n.stopForError({message:"Error loading vtt.js"})}));a.requested=!0;try{this.parseVTTCues_(r)}catch(e){return void this.stopForError({message:e.message})}if(this.updateTimeMapping_(r,this.syncController_.timelines[r.timeline],this.playlist_),r.cues.length?r.timingInfo={start:r.cues[0].startTime,end:r.cues[r.cues.length-1].endTime}:r.timingInfo={start:r.startOfSegment,end:r.startOfSegment+r.duration},r.isSyncRequest)return this.trigger("syncinfoupdate"),this.pendingSegment_=null,void(this.state="READY");r.byteLength=r.bytes.byteLength,this.mediaSecondsLoaded+=a.duration,r.cues.forEach((function(e){n.subtitlesTrack_.addCue(n.featuresNativeTextTracks_?new d.VTTCue(e.startTime,e.endTime,e.text):e)})),function(e){var t=e.cues;if(t)for(var i=0;i<t.length;i++){for(var n=[],r=0,a=0;a<t.length;a++)t[i].startTime===t[a].startTime&&t[i].endTime===t[a].endTime&&t[i].text===t[a].text&&++r>1&&n.push(t[a]);n.length&&n.forEach((function(t){return e.removeCue(t)}))}}(this.subtitlesTrack_),this.handleAppendsDone_()}else this.state="READY"},i.handleData_=function(){},i.updateTimingInfoEnd_=function(){},i.parseVTTCues_=function(e){var t,i=!1;if("function"!=typeof d.WebVTT)throw new Np;"function"==typeof d.TextDecoder?t=new d.TextDecoder("utf8"):(t=d.WebVTT.StringDecoder(),i=!0);var n=new d.WebVTT.Parser(d,d.vttjs,t);if(e.cues=[],e.timestampmap={MPEGTS:0,LOCAL:0},n.oncue=e.cues.push.bind(e.cues),n.ontimestampmap=function(t){e.timestampmap=t},n.onparsingerror=function(e){$c.log.warn("Error encountered when parsing cues: "+e.message)},e.segment.map){var r=e.segment.map.bytes;i&&(r=Dp(r)),n.parse(r)}var a=e.bytes;i&&(a=Dp(a)),n.parse(a),n.flush()},i.updateTimeMapping_=function(e,t,i){var n=e.segment;if(t)if(e.cues.length){var r=e.timestampmap,a=r.MPEGTS/Aa-r.LOCAL+t.mapping;if(e.cues.forEach((function(e){e.startTime+=a,e.endTime+=a})),!i.syncInfo){var s=e.cues[0].startTime,o=e.cues[e.cues.length-1].startTime;i.syncInfo={mediaSequence:i.mediaSequence+e.mediaIndex,time:Math.min(s,o-n.duration)}}}else n.empty=!0},t}(cp),Mp=function(e,t){for(var i=e.cues,n=0;n<i.length;n++){var r=i[n];if(t>=r.adStartTime&&t<=r.adEndTime)return r}return null},Up=[{name:"VOD",run:function(e,t,i,n,r){if(i!==1/0){return{time:0,segmentIndex:0,partIndex:null}}return null}},{name:"ProgramDateTime",run:function(e,t,i,n,r){if(!Object.keys(e.timelineToDatetimeMappings).length)return null;var a=null,s=null,o=fd(t);r=r||0;for(var u=0;u<o.length;u++){var l=o[t.endList||0===r?u:o.length-(u+1)],c=l.segment,d=e.timelineToDatetimeMappings[c.timeline];if(d&&c.dateTimeObject){var h=c.dateTimeObject.getTime()/1e3+d;if(c.parts&&"number"==typeof l.partIndex)for(var p=0;p<l.partIndex;p++)h+=c.parts[p].duration;var f=Math.abs(r-h);if(null!==s&&(0===f||s<f))break;s=f,a={time:h,segmentIndex:l.segmentIndex,partIndex:l.partIndex}}}return a}},{name:"Segment",run:function(e,t,i,n,r){var a=null,s=null;r=r||0;for(var o=fd(t),u=0;u<o.length;u++){var l=o[t.endList||0===r?u:o.length-(u+1)],c=l.segment,d=l.part&&l.part.start||c&&c.start;if(c.timeline===n&&void 0!==d){var h=Math.abs(r-d);if(null!==s&&s<h)break;(!a||null===s||s>=h)&&(s=h,a={time:d,segmentIndex:l.segmentIndex,partIndex:l.partIndex})}}return a}},{name:"Discontinuity",run:function(e,t,i,n,r){var a=null;if(r=r||0,t.discontinuityStarts&&t.discontinuityStarts.length)for(var s=null,o=0;o<t.discontinuityStarts.length;o++){var u=t.discontinuityStarts[o],l=t.discontinuitySequence+o+1,c=e.discontinuities[l];if(c){var d=Math.abs(r-c.time);if(null!==s&&s<d)break;(!a||null===s||s>=d)&&(s=d,a={time:c.time,segmentIndex:u,partIndex:null})}}return a}},{name:"Playlist",run:function(e,t,i,n,r){return t.syncInfo?{time:t.syncInfo.time,segmentIndex:t.syncInfo.mediaSequence-t.mediaSequence,partIndex:null}:null}}],Bp=function(e){function t(t){var i;return(i=e.call(this)||this).timelines=[],i.discontinuities=[],i.timelineToDatetimeMappings={},i.logger_=id("SyncController"),i}oe(t,e);var i=t.prototype;return i.getSyncPoint=function(e,t,i,n){var r=this.runStrategies_(e,t,i,n);return r.length?this.selectSyncPoint_(r,{key:"time",value:n}):null},i.getExpiredTime=function(e,t){if(!e||!e.segments)return null;var i=this.runStrategies_(e,t,e.discontinuitySequence,0);if(!i.length)return null;var n=this.selectSyncPoint_(i,{key:"segmentIndex",value:0});return n.segmentIndex>0&&(n.time*=-1),Math.abs(n.time+bd({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:n.segmentIndex,endIndex:0}))},i.runStrategies_=function(e,t,i,n){for(var r=[],a=0;a<Up.length;a++){var s=Up[a],o=s.run(this,e,t,i,n);o&&(o.strategy=s.name,r.push({strategy:s.name,syncPoint:o}))}return r},i.selectSyncPoint_=function(e,t){for(var i=e[0].syncPoint,n=Math.abs(e[0].syncPoint[t.key]-t.value),r=e[0].strategy,a=1;a<e.length;a++){var s=Math.abs(e[a].syncPoint[t.key]-t.value);s<n&&(n=s,i=e[a].syncPoint,r=e[a].strategy)}return this.logger_("syncPoint for ["+t.key+": "+t.value+"] chosen with strategy ["+r+"]: [time:"+i.time+", segmentIndex:"+i.segmentIndex+("number"==typeof i.partIndex?",partIndex:"+i.partIndex:"")+"]"),i},i.saveExpiredSegmentInfo=function(e,t){var i=t.mediaSequence-e.mediaSequence;if(i>86400)$c.log.warn("Not saving expired segment info. Media sequence gap "+i+" is too large.");else for(var n=i-1;n>=0;n--){var r=e.segments[n];if(r&&void 0!==r.start){t.syncInfo={mediaSequence:e.mediaSequence+n,time:r.start},this.logger_("playlist refresh sync: [time:"+t.syncInfo.time+", mediaSequence: "+t.syncInfo.mediaSequence+"]"),this.trigger("syncinfoupdate");break}}},i.setDateTimeMappingForStart=function(e){if(this.timelineToDatetimeMappings={},e.segments&&e.segments.length&&e.segments[0].dateTimeObject){var t=e.segments[0],i=t.dateTimeObject.getTime()/1e3;this.timelineToDatetimeMappings[t.timeline]=-i}},i.saveSegmentTimingInfo=function(e){var t=e.segmentInfo,i=e.shouldSaveTimelineMapping,n=this.calculateSegmentTimeMapping_(t,t.timingInfo,i),r=t.segment;n&&(this.saveDiscontinuitySyncInfo_(t),t.playlist.syncInfo||(t.playlist.syncInfo={mediaSequence:t.playlist.mediaSequence+t.mediaIndex,time:r.start}));var a=r.dateTimeObject;r.discontinuity&&i&&a&&(this.timelineToDatetimeMappings[r.timeline]=-a.getTime()/1e3)},i.timestampOffsetForTimeline=function(e){return void 0===this.timelines[e]?null:this.timelines[e].time},i.mappingForTimeline=function(e){return void 0===this.timelines[e]?null:this.timelines[e].mapping},i.calculateSegmentTimeMapping_=function(e,t,i){var n,r,a=e.segment,s=e.part,o=this.timelines[e.timeline];if("number"==typeof e.timestampOffset)o={time:e.startOfSegment,mapping:e.startOfSegment-t.start},i&&(this.timelines[e.timeline]=o,this.trigger("timestampoffset"),this.logger_("time mapping for timeline "+e.timeline+": [time: "+o.time+"] [mapping: "+o.mapping+"]")),n=e.startOfSegment,r=t.end+o.mapping;else{if(!o)return!1;n=t.start+o.mapping,r=t.end+o.mapping}return s&&(s.start=n,s.end=r),(!a.start||n<a.start)&&(a.start=n),a.end=r,!0},i.saveDiscontinuitySyncInfo_=function(e){var t=e.playlist,i=e.segment;if(i.discontinuity)this.discontinuities[i.timeline]={time:i.start,accuracy:0};else if(t.discontinuityStarts&&t.discontinuityStarts.length)for(var n=0;n<t.discontinuityStarts.length;n++){var r=t.discontinuityStarts[n],a=t.discontinuitySequence+n+1,s=r-e.mediaIndex,o=Math.abs(s);if(!this.discontinuities[a]||this.discontinuities[a].accuracy>o){var u=void 0;u=s<0?i.start-bd({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex,endIndex:r}):i.end+bd({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex+1,endIndex:r}),this.discontinuities[a]={time:u,accuracy:o}}}},i.dispose=function(){this.trigger("dispose"),this.off()},t}($c.EventTarget),Fp=function(e){function t(){var t;return(t=e.call(this)||this).pendingTimelineChanges_={},t.lastTimelineChanges_={},t}oe(t,e);var i=t.prototype;return i.clearPendingTimelineChange=function(e){this.pendingTimelineChanges_[e]=null,this.trigger("pendingtimelinechange")},i.pendingTimelineChange=function(e){var t=e.type,i=e.from,n=e.to;return"number"==typeof i&&"number"==typeof n&&(this.pendingTimelineChanges_[t]={type:t,from:i,to:n},this.trigger("pendingtimelinechange")),this.pendingTimelineChanges_[t]},i.lastTimelineChange=function(e){var t=e.type,i=e.from,n=e.to;return"number"==typeof i&&"number"==typeof n&&(this.lastTimelineChanges_[t]={type:t,from:i,to:n},delete this.pendingTimelineChanges_[t],this.trigger("timelinechange")),this.lastTimelineChanges_[t]},i.dispose=function(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()},t}($c.EventTarget),jp=vh(yh((function(){var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function t(e,t,i){return e(i={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&i.path)}},i.exports),i.exports}var i=t((function(e){function t(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}e.exports=function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e},e.exports.default=e.exports,e.exports.__esModule=!0})),n=t((function(e){function t(i,n){return e.exports=t=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},e.exports.default=e.exports,e.exports.__esModule=!0,t(i,n)}e.exports=t,e.exports.default=e.exports,e.exports.__esModule=!0})),r=t((function(e){e.exports=function(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,n(e,t)},e.exports.default=e.exports,e.exports.__esModule=!0})),a=function(){function e(){this.listeners={}}var t=e.prototype;return t.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},t.off=function(e,t){if(!this.listeners[e])return!1;var i=this.listeners[e].indexOf(t);return this.listeners[e]=this.listeners[e].slice(0),this.listeners[e].splice(i,1),i>-1},t.trigger=function(e){var t=this.listeners[e];if(t)if(2===arguments.length)for(var i=t.length,n=0;n<i;++n)t[n].call(this,arguments[1]);else for(var r=Array.prototype.slice.call(arguments,1),a=t.length,s=0;s<a;++s)t[s].apply(this,r)},t.dispose=function(){this.listeners={}},t.pipe=function(e){this.on("data",(function(t){e.push(t)}))},e}();/*! @name aes-decrypter @version 3.1.3 @license Apache-2.0 */
|
|
15
|
-
|
|
16
|
-
var e;r(null,(e=o).subarray(0,e.byteLength-e[e.byteLength-1]))}))}return e.prototype.decryptChunk_=function(e,t,i,n){return function(){var r=function(e,t,i){var n,r,a,s,o,l,d,h,p,f=new Int32Array(e.buffer,e.byteOffset,e.byteLength>>2),m=new u(Array.prototype.slice.call(t)),g=new Uint8Array(e.byteLength),v=new Int32Array(g.buffer);for(n=i[0],r=i[1],a=i[2],s=i[3],p=0;p<f.length;p+=4)o=c(f[p]),l=c(f[p+1]),d=c(f[p+2]),h=c(f[p+3]),m.decrypt(o,l,d,h,v,p),v[p]=c(v[p]^n),v[p+1]=c(v[p+1]^r),v[p+2]=c(v[p+2]^a),v[p+3]=c(v[p+3]^s),n=o,r=l,a=d,s=h;return g}(e,t,i);n.set(r,e.byteOffset)}},i(e,null,[{key:"STEP",get:function(){return 32e3}}]),e}();s="undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:{};var h=s.BigInt||Number;h("0x1"),h("0x100"),h("0x10000"),h("0x1000000"),h("0x100000000"),h("0x10000000000"),h("0x1000000000000"),h("0x100000000000000"),h("0x10000000000000000");var p=function(e){var t={};return Object.keys(e).forEach((function(i){var n,r=e[i];n=r,("function"===ArrayBuffer.isView?ArrayBuffer.isView(n):n&&n.buffer instanceof ArrayBuffer)?t[i]={bytes:r.buffer,byteOffset:r.byteOffset,byteLength:r.byteLength}:t[i]=r})),t};self.onmessage=function(e){var t=e.data,i=new Uint8Array(t.encrypted.bytes,t.encrypted.byteOffset,t.encrypted.byteLength),n=new Uint32Array(t.key.bytes,t.key.byteOffset,t.key.byteLength/4),r=new Uint32Array(t.iv.bytes,t.iv.byteOffset,t.iv.byteLength/4);new d(i,n,r,(function(e,i){self.postMessage(p({source:t.source,decrypted:i}),[i.buffer])}))}}))),qp=gh(jp),Vp=function(e){var t=e.default?"main":"alternative";return e.characteristics&&e.characteristics.indexOf("public.accessibility.describes-video")>=0&&(t="main-desc"),t},Hp=function(e,t){e.abort(),e.pause(),t&&t.activePlaylistLoader&&(t.activePlaylistLoader.pause(),t.activePlaylistLoader=null)},Wp=function(e,t){t.activePlaylistLoader=e,e.load()},Gp={AUDIO:function(e,t){return function(){var i=t.segmentLoaders[e],n=t.mediaTypes[e],r=t.blacklistCurrentPlaylist;Hp(i,n);var a=n.activeTrack(),s=n.activeGroup(),o=(s.filter((function(e){return e.default}))[0]||s[0]).id,u=n.tracks[o];if(a!==u){for(var l in $c.log.warn("Problem encountered loading the alternate audio track.Switching back to default."),n.tracks)n.tracks[l].enabled=n.tracks[l]===u;n.onTrackChanged()}else r({message:"Problem encountered loading the default audio track."})}},SUBTITLES:function(e,t){return function(){var i=t.segmentLoaders[e],n=t.mediaTypes[e];$c.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track."),Hp(i,n);var r=n.activeTrack();r&&(r.mode="disabled"),n.onTrackChanged()}}},zp={AUDIO:function(e,t,i){if(t){var n=i.tech,r=i.requestOptions,a=i.segmentLoaders[e];t.on("loadedmetadata",(function(){var e=t.media();a.playlist(e,r),(!n.paused()||e.endList&&"none"!==n.preload())&&a.load()})),t.on("loadedplaylist",(function(){a.playlist(t.media(),r),n.paused()||a.load()})),t.on("error",Gp[e](e,i))}},SUBTITLES:function(e,t,i){var n=i.tech,r=i.requestOptions,a=i.segmentLoaders[e],s=i.mediaTypes[e];t.on("loadedmetadata",(function(){var e=t.media();a.playlist(e,r),a.track(s.activeTrack()),(!n.paused()||e.endList&&"none"!==n.preload())&&a.load()})),t.on("loadedplaylist",(function(){a.playlist(t.media(),r),n.paused()||a.load()})),t.on("error",Gp[e](e,i))}},Xp={AUDIO:function(e,t){var i=t.vhs,n=t.sourceType,r=t.segmentLoaders[e],a=t.requestOptions,s=t.master.mediaGroups,o=t.mediaTypes[e],u=o.groups,l=o.tracks,c=o.logger_,d=t.masterPlaylistLoader,h=Ad(d.master);for(var p in s[e]&&0!==Object.keys(s[e]).length||(s[e]={main:{default:{default:!0}}},h&&(s[e].main.default.playlists=d.master.playlists)),s[e])for(var f in u[p]||(u[p]=[]),s[e][p]){var m=s[e][p][f],g=void 0;if(h?(c("AUDIO group '"+p+"' label '"+f+"' is a master playlist"),m.isMasterPlaylist=!0,g=null):g="vhs-json"===n&&m.playlists?new Wd(m.playlists[0],i,a):m.resolvedUri?new Wd(m.resolvedUri,i,a):m.playlists&&"dash"===n?new ph(m.playlists[0],i,a,d):null,m=$c.mergeOptions({id:f,playlistLoader:g},m),zp[e](e,m.playlistLoader,t),u[p].push(m),void 0===l[f]){var v=new $c.AudioTrack({id:f,kind:Vp(m),enabled:!1,language:m.language,default:m.default,label:f});l[f]=v}}r.on("error",Gp[e](e,t))},SUBTITLES:function(e,t){var i=t.tech,n=t.vhs,r=t.sourceType,a=t.segmentLoaders[e],s=t.requestOptions,o=t.master.mediaGroups,u=t.mediaTypes[e],l=u.groups,c=u.tracks,d=t.masterPlaylistLoader;for(var h in o[e])for(var p in l[h]||(l[h]=[]),o[e][h])if(!o[e][h][p].forced){var f=o[e][h][p],m=void 0;if("hls"===r)m=new Wd(f.resolvedUri,n,s);else if("dash"===r){if(!f.playlists.filter((function(e){return e.excludeUntil!==1/0})).length)return;m=new ph(f.playlists[0],n,s,d)}else"vhs-json"===r&&(m=new Wd(f.playlists?f.playlists[0]:f.resolvedUri,n,s));if(f=$c.mergeOptions({id:p,playlistLoader:m},f),zp[e](e,f.playlistLoader,t),l[h].push(f),void 0===c[p]){var g=i.addRemoteTextTrack({id:p,kind:"subtitles",default:f.default&&f.autoselect,language:f.language,label:p},!1).track;c[p]=g}}a.on("error",Gp[e](e,t))},"CLOSED-CAPTIONS":function(e,t){var i=t.tech,n=t.master.mediaGroups,r=t.mediaTypes[e],a=r.groups,s=r.tracks;for(var o in n[e])for(var u in a[o]||(a[o]=[]),n[e][o]){var l=n[e][o][u];if(/^(?:CC|SERVICE)/.test(l.instreamId)){var c=i.options_.vhs&&i.options_.vhs.captionServices||{},d={label:u,language:l.language,instreamId:l.instreamId,default:l.default&&l.autoselect};if(c[d.instreamId]&&(d=$c.mergeOptions(d,c[d.instreamId])),void 0===d.default&&delete d.default,a[o].push($c.mergeOptions({id:u},l)),void 0===s[u]){var h=i.addRemoteTextTrack({id:d.instreamId,kind:"captions",default:d.default,language:d.language,label:d.label},!1).track;s[u]=h}}}}},Kp=function e(t,i){for(var n=0;n<t.length;n++){if(xd(i,t[n]))return!0;if(t[n].playlists&&e(t[n].playlists,i))return!0}return!1},Yp={AUDIO:function(e,t){return function(){var i=t.mediaTypes[e].tracks;for(var n in i)if(i[n].enabled)return i[n];return null}},SUBTITLES:function(e,t){return function(){var i=t.mediaTypes[e].tracks;for(var n in i)if("showing"===i[n].mode||"hidden"===i[n].mode)return i[n];return null}}},Qp=function(e){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((function(t){Xp[t](t,e)}));var t=e.mediaTypes,i=e.masterPlaylistLoader,n=e.tech,r=e.vhs,a=e.segmentLoaders,s=a.AUDIO,o=a.main;["AUDIO","SUBTITLES"].forEach((function(i){t[i].activeGroup=function(e,t){return function(i){var n=t.masterPlaylistLoader,r=t.mediaTypes[e].groups,a=n.media();if(!a)return null;var s=null;a.attributes[e]&&(s=r[a.attributes[e]]);var o=Object.keys(r);if(!s)if("AUDIO"===e&&o.length>1&&Ad(t.master))for(var u=0;u<o.length;u++){var l=r[o[u]];if(Kp(l,a)){s=l;break}}else r.main?s=r.main:1===o.length&&(s=r[o[0]]);return void 0===i?s:null!==i&&s&&s.filter((function(e){return e.id===i.id}))[0]||null}}(i,e),t[i].activeTrack=Yp[i](i,e),t[i].onGroupChanged=function(e,t){return function(){var i=t.segmentLoaders,n=i[e],r=i.main,a=t.mediaTypes[e],s=a.activeTrack(),o=a.getActiveGroup(),u=a.activePlaylistLoader,l=a.lastGroup_;o&&l&&o.id===l.id||(a.lastGroup_=o,a.lastTrack_=s,Hp(n,a),o&&!o.isMasterPlaylist&&(o.playlistLoader?(n.resyncLoader(),Wp(o.playlistLoader,a)):u&&r.resetEverything()))}}(i,e),t[i].onGroupChanging=function(e,t){return function(){var i=t.segmentLoaders[e];t.mediaTypes[e].lastGroup_=null,i.abort(),i.pause()}}(i,e),t[i].onTrackChanged=function(e,t){return function(){var i=t.masterPlaylistLoader,n=t.segmentLoaders,r=n[e],a=n.main,s=t.mediaTypes[e],o=s.activeTrack(),u=s.getActiveGroup(),l=s.activePlaylistLoader,c=s.lastTrack_;if((!c||!o||c.id!==o.id)&&(s.lastGroup_=u,s.lastTrack_=o,Hp(r,s),u)){if(u.isMasterPlaylist){if(!o||!c||o.id===c.id)return;var d=t.vhs.masterPlaylistController_,h=d.selectPlaylist();if(d.media()===h)return;return s.logger_("track change. Switching master audio from "+c.id+" to "+o.id),i.pause(),a.resetEverything(),void d.fastQualityChange_(h)}if("AUDIO"===e){if(!u.playlistLoader)return a.setAudio(!0),void a.resetEverything();r.setAudio(!0),a.setAudio(!1)}l!==u.playlistLoader?(r.track&&r.track(o),r.resetEverything(),Wp(u.playlistLoader,s)):Wp(u.playlistLoader,s)}}}(i,e),t[i].getActiveGroup=function(e,t){var i=t.mediaTypes;return function(){var t=i[e].activeTrack();return t?i[e].activeGroup(t):null}}(i,e)}));var u=t.AUDIO.activeGroup();if(u){var l=(u.filter((function(e){return e.default}))[0]||u[0]).id;t.AUDIO.tracks[l].enabled=!0,t.AUDIO.onGroupChanged(),t.AUDIO.onTrackChanged(),t.AUDIO.getActiveGroup().playlistLoader?(o.setAudio(!1),s.setAudio(!0)):o.setAudio(!0)}i.on("mediachange",(function(){["AUDIO","SUBTITLES"].forEach((function(e){return t[e].onGroupChanged()}))})),i.on("mediachanging",(function(){["AUDIO","SUBTITLES"].forEach((function(e){return t[e].onGroupChanging()}))}));var c=function(){t.AUDIO.onTrackChanged(),n.trigger({type:"usage",name:"vhs-audio-change"}),n.trigger({type:"usage",name:"hls-audio-change"})};for(var d in n.audioTracks().addEventListener("change",c),n.remoteTextTracks().addEventListener("change",t.SUBTITLES.onTrackChanged),r.on("dispose",(function(){n.audioTracks().removeEventListener("change",c),n.remoteTextTracks().removeEventListener("change",t.SUBTITLES.onTrackChanged)})),n.clearTracks("audio"),t.AUDIO.tracks)n.audioTracks().addTrack(t.AUDIO.tracks[d])},$p=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],Jp=function(e){return this.audioSegmentLoader_[e]+this.mainSegmentLoader_[e]},Zp=function(e){function t(t){var i;i=e.call(this)||this;var n=t.src,r=t.handleManifestRedirects,a=t.withCredentials,s=t.tech,o=t.bandwidth,u=t.externVhs,l=t.useCueTags,c=t.blacklistDuration,h=t.enableLowInitialPlaylist,p=t.sourceType,f=t.cacheEncryptionKeys,m=t.experimentalBufferBasedABR,g=t.experimentalLeastPixelDiffSelector,v=t.captionServices;if(!n)throw new Error("A non-empty playlist URL or JSON manifest string is required");var y=t.maxPlaylistRetries;null==y&&(y=1/0),hp=u,i.experimentalBufferBasedABR=Boolean(m),i.experimentalLeastPixelDiffSelector=Boolean(g),i.withCredentials=a,i.tech_=s,i.vhs_=s.vhs,i.sourceType_=p,i.useCueTags_=l,i.blacklistDuration=c,i.maxPlaylistRetries=y,i.enableLowInitialPlaylist=h,i.useCueTags_&&(i.cueTagsTrack_=i.tech_.addTextTrack("metadata","ad-cues"),i.cueTagsTrack_.inBandMetadataTrackDispatchType=""),i.requestOptions_={withCredentials:a,handleManifestRedirects:r,maxPlaylistRetries:y,timeout:null},i.on("error",i.pauseLoading),i.mediaTypes_=function(){var e={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((function(t){e[t]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:dp,activeTrack:dp,getActiveGroup:dp,onGroupChanged:dp,onTrackChanged:dp,lastTrack_:null,logger_:id("MediaGroups["+t+"]")}})),e}(),i.mediaSource=new d.MediaSource,i.handleDurationChange_=i.handleDurationChange_.bind(ae(i)),i.handleSourceOpen_=i.handleSourceOpen_.bind(ae(i)),i.handleSourceEnded_=i.handleSourceEnded_.bind(ae(i)),i.mediaSource.addEventListener("durationchange",i.handleDurationChange_),i.mediaSource.addEventListener("sourceopen",i.handleSourceOpen_),i.mediaSource.addEventListener("sourceended",i.handleSourceEnded_),i.seekable_=$c.createTimeRanges(),i.hasPlayed_=!1,i.syncController_=new Bp(t),i.segmentMetadataTrack_=s.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,i.decrypter_=new qp,i.sourceUpdater_=new Lp(i.mediaSource),i.inbandTextTracks_={},i.timelineChangeController_=new Fp;var _={vhs:i.vhs_,parse708captions:t.parse708captions,useDtsForTimestampOffset:t.useDtsForTimestampOffset,captionServices:v,mediaSource:i.mediaSource,currentTime:i.tech_.currentTime.bind(i.tech_),seekable:function(){return i.seekable()},seeking:function(){return i.tech_.seeking()},duration:function(){return i.duration()},hasPlayed:function(){return i.hasPlayed_},goalBufferLength:function(){return i.goalBufferLength()},bandwidth:o,syncController:i.syncController_,decrypter:i.decrypter_,sourceType:i.sourceType_,inbandTextTracks:i.inbandTextTracks_,cacheEncryptionKeys:f,sourceUpdater:i.sourceUpdater_,timelineChangeController:i.timelineChangeController_,experimentalExactManifestTimings:t.experimentalExactManifestTimings};i.masterPlaylistLoader_="dash"===i.sourceType_?new ph(n,i.vhs_,i.requestOptions_):new Wd(n,i.vhs_,i.requestOptions_),i.setupMasterPlaylistLoaderListeners_(),i.mainSegmentLoader_=new cp($c.mergeOptions(_,{segmentMetadataTrack:i.segmentMetadataTrack_,loaderType:"main"}),t),i.audioSegmentLoader_=new cp($c.mergeOptions(_,{loaderType:"audio"}),t),i.subtitleSegmentLoader_=new Rp($c.mergeOptions(_,{loaderType:"vtt",featuresNativeTextTracks:i.tech_.featuresNativeTextTracks,loadVttJs:function(){return new Promise((function(e,t){function i(){s.off("vttjserror",n),e()}function n(){s.off("vttjsloaded",i),t()}s.one("vttjsloaded",i),s.one("vttjserror",n),s.addWebVttScript_()}))}}),t),i.setupSegmentLoaderListeners_(),i.experimentalBufferBasedABR&&(i.masterPlaylistLoader_.one("loadedplaylist",(function(){return i.startABRTimer_()})),i.tech_.on("pause",(function(){return i.stopABRTimer_()})),i.tech_.on("play",(function(){return i.startABRTimer_()}))),$p.forEach((function(e){i[e+"_"]=Jp.bind(ae(i),e)})),i.logger_=id("MPC"),i.triggeredFmp4Usage=!1,"none"===i.tech_.preload()?(i.loadOnPlay_=function(){i.loadOnPlay_=null,i.masterPlaylistLoader_.load()},i.tech_.one("play",i.loadOnPlay_)):i.masterPlaylistLoader_.load(),i.timeToLoadedData__=-1,i.mainAppendsToLoadedData__=-1,i.audioAppendsToLoadedData__=-1;var b="none"===i.tech_.preload()?"play":"loadstart";return i.tech_.one(b,(function(){var e=Date.now();i.tech_.one("loadeddata",(function(){i.timeToLoadedData__=Date.now()-e,i.mainAppendsToLoadedData__=i.mainSegmentLoader_.mediaAppends,i.audioAppendsToLoadedData__=i.audioSegmentLoader_.mediaAppends}))})),i}oe(t,e);var i=t.prototype;return i.mainAppendsToLoadedData_=function(){return this.mainAppendsToLoadedData__},i.audioAppendsToLoadedData_=function(){return this.audioAppendsToLoadedData__},i.appendsToLoadedData_=function(){var e=this.mainAppendsToLoadedData_(),t=this.audioAppendsToLoadedData_();return-1===e||-1===t?-1:e+t},i.timeToLoadedData_=function(){return this.timeToLoadedData__},i.checkABR_=function(e){void 0===e&&(e="abr");var t=this.selectPlaylist();t&&this.shouldSwitchToMedia_(t)&&this.switchMedia_(t,e)},i.switchMedia_=function(e,t,i){var n=this.media(),r=n&&(n.id||n.uri),a=e.id||e.uri;r&&r!==a&&(this.logger_("switch media "+r+" -> "+a+" from "+t),this.tech_.trigger({type:"usage",name:"vhs-rendition-change-"+t})),this.masterPlaylistLoader_.media(e,i)},i.startABRTimer_=function(){var e=this;this.stopABRTimer_(),this.abrTimer_=d.setInterval((function(){return e.checkABR_()}),250)},i.stopABRTimer_=function(){this.tech_.scrubbing&&this.tech_.scrubbing()||(d.clearInterval(this.abrTimer_),this.abrTimer_=null)},i.getAudioTrackPlaylists_=function(){var e=this.master(),t=e&&e.playlists||[];if(!e||!e.mediaGroups||!e.mediaGroups.AUDIO)return t;var i,n=e.mediaGroups.AUDIO,r=Object.keys(n);if(Object.keys(this.mediaTypes_.AUDIO.groups).length)i=this.mediaTypes_.AUDIO.activeTrack();else{var a=n.main||r.length&&n[r[0]];for(var s in a)if(a[s].default){i={label:s};break}}if(!i)return t;var o=[];for(var u in n)if(n[u][i.label]){var l=n[u][i.label];if(l.playlists&&l.playlists.length)o.push.apply(o,l.playlists);else if(l.uri)o.push(l);else if(e.playlists.length)for(var c=0;c<e.playlists.length;c++){var d=e.playlists[c];d.attributes&&d.attributes.AUDIO&&d.attributes.AUDIO===u&&o.push(d)}}return o.length?o:t},i.setupMasterPlaylistLoaderListeners_=function(){var e=this;this.masterPlaylistLoader_.on("loadedmetadata",(function(){var t=e.masterPlaylistLoader_.media(),i=1.5*t.targetDuration*1e3;Cd(e.masterPlaylistLoader_.master,e.masterPlaylistLoader_.media())?e.requestOptions_.timeout=0:e.requestOptions_.timeout=i,t.endList&&"none"!==e.tech_.preload()&&(e.mainSegmentLoader_.playlist(t,e.requestOptions_),e.mainSegmentLoader_.load()),Qp({sourceType:e.sourceType_,segmentLoaders:{AUDIO:e.audioSegmentLoader_,SUBTITLES:e.subtitleSegmentLoader_,main:e.mainSegmentLoader_},tech:e.tech_,requestOptions:e.requestOptions_,masterPlaylistLoader:e.masterPlaylistLoader_,vhs:e.vhs_,master:e.master(),mediaTypes:e.mediaTypes_,blacklistCurrentPlaylist:e.blacklistCurrentPlaylist.bind(e)}),e.triggerPresenceUsage_(e.master(),t),e.setupFirstPlay(),!e.mediaTypes_.AUDIO.activePlaylistLoader||e.mediaTypes_.AUDIO.activePlaylistLoader.media()?e.trigger("selectedinitialmedia"):e.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata",(function(){e.trigger("selectedinitialmedia")}))})),this.masterPlaylistLoader_.on("loadedplaylist",(function(){e.loadOnPlay_&&e.tech_.off("play",e.loadOnPlay_);var t=e.masterPlaylistLoader_.media();if(!t){var i;if(e.excludeUnsupportedVariants_(),e.enableLowInitialPlaylist&&(i=e.selectInitialPlaylist()),i||(i=e.selectPlaylist()),!i||!e.shouldSwitchToMedia_(i))return;if(e.initialMedia_=i,e.switchMedia_(e.initialMedia_,"initial"),!("vhs-json"===e.sourceType_&&e.initialMedia_.segments))return;t=e.initialMedia_}e.handleUpdatedMediaPlaylist(t)})),this.masterPlaylistLoader_.on("error",(function(){e.blacklistCurrentPlaylist(e.masterPlaylistLoader_.error)})),this.masterPlaylistLoader_.on("mediachanging",(function(){e.mainSegmentLoader_.abort(),e.mainSegmentLoader_.pause()})),this.masterPlaylistLoader_.on("mediachange",(function(){var t=e.masterPlaylistLoader_.media(),i=1.5*t.targetDuration*1e3;Cd(e.masterPlaylistLoader_.master,e.masterPlaylistLoader_.media())?e.requestOptions_.timeout=0:e.requestOptions_.timeout=i,e.masterPlaylistLoader_.load(),e.mainSegmentLoader_.playlist(t,e.requestOptions_),e.mainSegmentLoader_.load(),e.tech_.trigger({type:"mediachange",bubbles:!0})})),this.masterPlaylistLoader_.on("playlistunchanged",(function(){var t=e.masterPlaylistLoader_.media();"playlist-unchanged"!==t.lastExcludeReason_&&(e.stuckAtPlaylistEnd_(t)&&(e.blacklistCurrentPlaylist({message:"Playlist no longer updating.",reason:"playlist-unchanged"}),e.tech_.trigger("playliststuck")))})),this.masterPlaylistLoader_.on("renditiondisabled",(function(){e.tech_.trigger({type:"usage",name:"vhs-rendition-disabled"}),e.tech_.trigger({type:"usage",name:"hls-rendition-disabled"})})),this.masterPlaylistLoader_.on("renditionenabled",(function(){e.tech_.trigger({type:"usage",name:"vhs-rendition-enabled"}),e.tech_.trigger({type:"usage",name:"hls-rendition-enabled"})}))},i.handleUpdatedMediaPlaylist=function(e){this.useCueTags_&&this.updateAdCues_(e),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.updateDuration(!e.endList),this.tech_.paused()||(this.mainSegmentLoader_.load(),this.audioSegmentLoader_&&this.audioSegmentLoader_.load())},i.triggerPresenceUsage_=function(e,t){var i=e.mediaGroups||{},n=!0,r=Object.keys(i.AUDIO);for(var a in i.AUDIO)for(var s in i.AUDIO[a]){i.AUDIO[a][s].uri||(n=!1)}n&&(this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),this.tech_.trigger({type:"usage",name:"hls-demuxed"})),Object.keys(i.SUBTITLES).length&&(this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),this.tech_.trigger({type:"usage",name:"hls-webvtt"})),hp.Playlist.isAes(t)&&(this.tech_.trigger({type:"usage",name:"vhs-aes"}),this.tech_.trigger({type:"usage",name:"hls-aes"})),r.length&&Object.keys(i.AUDIO[r[0]]).length>1&&(this.tech_.trigger({type:"usage",name:"vhs-alternate-audio"}),this.tech_.trigger({type:"usage",name:"hls-alternate-audio"})),this.useCueTags_&&(this.tech_.trigger({type:"usage",name:"vhs-playlist-cue-tags"}),this.tech_.trigger({type:"usage",name:"hls-playlist-cue-tags"}))},i.shouldSwitchToMedia_=function(e){var t=this.masterPlaylistLoader_.media()||this.masterPlaylistLoader_.pendingMedia_,i=this.tech_.currentTime(),n=this.bufferLowWaterLine(),r=this.bufferHighWaterLine();return function(e){var t=e.currentPlaylist,i=e.buffered,n=e.currentTime,r=e.nextPlaylist,a=e.bufferLowWaterLine,s=e.bufferHighWaterLine,o=e.duration,u=e.experimentalBufferBasedABR,l=e.log;if(!r)return $c.log.warn("We received no playlist to switch to. Please check your stream."),!1;var c="allowing switch "+(t&&t.id||"null")+" -> "+r.id;if(!t)return l(c+" as current playlist is not set"),!0;if(r.id===t.id)return!1;var d=Boolean(sd(i,n).length);if(!t.endList)return d||"number"!=typeof t.partTargetDuration?(l(c+" as current playlist is live"),!0):(l("not "+c+" as current playlist is live llhls, but currentTime isn't in buffered."),!1);var h=dd(i,n),p=u?fh.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:fh.MAX_BUFFER_LOW_WATER_LINE;if(o<p)return l(c+" as duration < max low water line ("+o+" < "+p+")"),!0;var f=r.attributes.BANDWIDTH,m=t.attributes.BANDWIDTH;if(f<m&&(!u||h<s)){var g=c+" as next bandwidth < current bandwidth ("+f+" < "+m+")";return u&&(g+=" and forwardBuffer < bufferHighWaterLine ("+h+" < "+s+")"),l(g),!0}if((!u||f>m)&&h>=a){var v=c+" as forwardBuffer >= bufferLowWaterLine ("+h+" >= "+a+")";return u&&(v+=" and next bandwidth > current bandwidth ("+f+" > "+m+")"),l(v),!0}return l("not "+c+" as no switching criteria met"),!1}({buffered:this.tech_.buffered(),currentTime:i,currentPlaylist:t,nextPlaylist:e,bufferLowWaterLine:n,bufferHighWaterLine:r,duration:this.duration(),experimentalBufferBasedABR:this.experimentalBufferBasedABR,log:this.logger_})},i.setupSegmentLoaderListeners_=function(){var e=this;this.mainSegmentLoader_.on("bandwidthupdate",(function(){e.checkABR_("bandwidthupdate"),e.tech_.trigger("bandwidthupdate")})),this.mainSegmentLoader_.on("timeout",(function(){e.experimentalBufferBasedABR&&e.mainSegmentLoader_.load()})),this.experimentalBufferBasedABR||this.mainSegmentLoader_.on("progress",(function(){e.trigger("progress")})),this.mainSegmentLoader_.on("error",(function(){e.blacklistCurrentPlaylist(e.mainSegmentLoader_.error())})),this.mainSegmentLoader_.on("appenderror",(function(){e.error=e.mainSegmentLoader_.error_,e.trigger("error")})),this.mainSegmentLoader_.on("syncinfoupdate",(function(){e.onSyncInfoUpdate_()})),this.mainSegmentLoader_.on("timestampoffset",(function(){e.tech_.trigger({type:"usage",name:"vhs-timestamp-offset"}),e.tech_.trigger({type:"usage",name:"hls-timestamp-offset"})})),this.audioSegmentLoader_.on("syncinfoupdate",(function(){e.onSyncInfoUpdate_()})),this.audioSegmentLoader_.on("appenderror",(function(){e.error=e.audioSegmentLoader_.error_,e.trigger("error")})),this.mainSegmentLoader_.on("ended",(function(){e.logger_("main segment loader ended"),e.onEndOfStream()})),this.mainSegmentLoader_.on("earlyabort",(function(t){e.experimentalBufferBasedABR||(e.delegateLoaders_("all",["abort"]),e.blacklistCurrentPlaylist({message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},120))}));var t=function(){if(!e.sourceUpdater_.hasCreatedSourceBuffers())return e.tryToCreateSourceBuffers_();var t=e.getCodecsOrExclude_();t&&e.sourceUpdater_.addOrChangeSourceBuffers(t)};this.mainSegmentLoader_.on("trackinfo",t),this.audioSegmentLoader_.on("trackinfo",t),this.mainSegmentLoader_.on("fmp4",(function(){e.triggeredFmp4Usage||(e.tech_.trigger({type:"usage",name:"vhs-fmp4"}),e.tech_.trigger({type:"usage",name:"hls-fmp4"}),e.triggeredFmp4Usage=!0)})),this.audioSegmentLoader_.on("fmp4",(function(){e.triggeredFmp4Usage||(e.tech_.trigger({type:"usage",name:"vhs-fmp4"}),e.tech_.trigger({type:"usage",name:"hls-fmp4"}),e.triggeredFmp4Usage=!0)})),this.audioSegmentLoader_.on("ended",(function(){e.logger_("audioSegmentLoader ended"),e.onEndOfStream()}))},i.mediaSecondsLoaded_=function(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)},i.load=function(){this.mainSegmentLoader_.load(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.load(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.load()},i.smoothQualityChange_=function(e){void 0===e&&(e=this.selectPlaylist()),this.fastQualityChange_(e)},i.fastQualityChange_=function(e){var t=this;void 0===e&&(e=this.selectPlaylist()),e!==this.masterPlaylistLoader_.media()?(this.switchMedia_(e,"fast-quality"),this.mainSegmentLoader_.resetEverything((function(){$c.browser.IE_VERSION||$c.browser.IS_EDGE?t.tech_.setCurrentTime(t.tech_.currentTime()+.04):t.tech_.setCurrentTime(t.tech_.currentTime())}))):this.logger_("skipping fastQualityChange because new media is same as old")},i.play=function(){if(!this.setupFirstPlay()){this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_&&this.load();var e=this.tech_.seekable();return this.tech_.duration()===1/0&&this.tech_.currentTime()<e.start(0)?this.tech_.setCurrentTime(e.end(e.length-1)):void 0}},i.setupFirstPlay=function(){var e=this,t=this.masterPlaylistLoader_.media();if(!t||this.tech_.paused()||this.hasPlayed_)return!1;if(!t.endList){var i=this.seekable();if(!i.length)return!1;if($c.browser.IE_VERSION&&0===this.tech_.readyState())return this.tech_.one("loadedmetadata",(function(){e.trigger("firstplay"),e.tech_.setCurrentTime(i.end(0)),e.hasPlayed_=!0})),!1;this.trigger("firstplay"),this.tech_.setCurrentTime(i.end(0))}return this.hasPlayed_=!0,this.load(),!0},i.handleSourceOpen_=function(){if(this.tryToCreateSourceBuffers_(),this.tech_.autoplay()){var e=this.tech_.play();void 0!==e&&"function"==typeof e.then&&e.then(null,(function(e){}))}this.trigger("sourceopen")},i.handleSourceEnded_=function(){if(this.inbandTextTracks_.metadataTrack_){var e=this.inbandTextTracks_.metadataTrack_.cues;if(e&&e.length){var t=this.duration();e[e.length-1].endTime=isNaN(t)||Math.abs(t)===1/0?Number.MAX_VALUE:t}}},i.handleDurationChange_=function(){this.tech_.trigger("durationchange")},i.onEndOfStream=function(){var e=this.mainSegmentLoader_.ended_;if(this.mediaTypes_.AUDIO.activePlaylistLoader){var t=this.mainSegmentLoader_.getCurrentMediaInfo_();e=!t||t.hasVideo?e&&this.audioSegmentLoader_.ended_:this.audioSegmentLoader_.ended_}e&&(this.stopABRTimer_(),this.sourceUpdater_.endOfStream())},i.stuckAtPlaylistEnd_=function(e){if(!this.seekable().length)return!1;var t=this.syncController_.getExpiredTime(e,this.duration());if(null===t)return!1;var i=hp.Playlist.playlistEnd(e,t),n=this.tech_.currentTime(),r=this.tech_.buffered();if(!r.length)return i-n<=rd;var a=r.end(r.length-1);return a-n<=rd&&i-a<=rd},i.blacklistCurrentPlaylist=function(e,t){void 0===e&&(e={});var i=e.playlist||this.masterPlaylistLoader_.media();if(t=t||e.blacklistDuration||this.blacklistDuration,!i)return this.error=e,void("open"!==this.mediaSource.readyState?this.trigger("error"):this.sourceUpdater_.endOfStream("network"));i.playlistErrors_++;var n,r=this.masterPlaylistLoader_.master.playlists,a=r.filter(wd),s=1===a.length&&a[0]===i;if(1===r.length&&t!==1/0)return $c.log.warn("Problem encountered with playlist "+i.id+". Trying again since it is the only playlist."),this.tech_.trigger("retryplaylist"),this.masterPlaylistLoader_.load(s);if(s){var o=!1;r.forEach((function(e){if(e!==i){var t=e.excludeUntil;void 0!==t&&t!==1/0&&(o=!0,delete e.excludeUntil)}})),o&&($c.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}n=i.playlistErrors_>this.maxPlaylistRetries?1/0:Date.now()+1e3*t,i.excludeUntil=n,e.reason&&(i.lastExcludeReason_=e.reason),this.tech_.trigger("blacklistplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-blacklisted"}),this.tech_.trigger({type:"usage",name:"hls-rendition-blacklisted"});var u=this.selectPlaylist();if(!u)return this.error="Playback cannot continue. No available working or supported playlists.",void this.trigger("error");var l=e.internal?this.logger_:$c.log.warn,c=e.message?" "+e.message:"";l((e.internal?"Internal problem":"Problem")+" encountered with playlist "+i.id+"."+c+" Switching to playlist "+u.id+"."),u.attributes.AUDIO!==i.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),u.attributes.SUBTITLES!==i.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]);var d=u.targetDuration/2*1e3||5e3,h="number"==typeof u.lastRequest&&Date.now()-u.lastRequest<=d;return this.switchMedia_(u,"exclude",s||h)},i.pauseLoading=function(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()},i.delegateLoaders_=function(e,t){var i=this,n=[],r="all"===e;(r||"main"===e)&&n.push(this.masterPlaylistLoader_);var a=[];(r||"audio"===e)&&a.push("AUDIO"),(r||"subtitle"===e)&&(a.push("CLOSED-CAPTIONS"),a.push("SUBTITLES")),a.forEach((function(e){var t=i.mediaTypes_[e]&&i.mediaTypes_[e].activePlaylistLoader;t&&n.push(t)})),["main","audio","subtitle"].forEach((function(t){var r=i[t+"SegmentLoader_"];!r||e!==t&&"all"!==e||n.push(r)})),n.forEach((function(e){return t.forEach((function(t){"function"==typeof e[t]&&e[t]()}))}))},i.setCurrentTime=function(e){var t=sd(this.tech_.buffered(),e);return this.masterPlaylistLoader_&&this.masterPlaylistLoader_.media()&&this.masterPlaylistLoader_.media().segments?t&&t.length?e:(this.mainSegmentLoader_.resetEverything(),this.mainSegmentLoader_.abort(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.resetEverything(),this.audioSegmentLoader_.abort()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.resetEverything(),this.subtitleSegmentLoader_.abort()),void this.load()):0},i.duration=function(){if(!this.masterPlaylistLoader_)return 0;var e=this.masterPlaylistLoader_.media();return e?e.endList?this.mediaSource?this.mediaSource.duration:hp.Playlist.duration(e):1/0:0},i.seekable=function(){return this.seekable_},i.onSyncInfoUpdate_=function(){var e;if(this.masterPlaylistLoader_){var t=this.masterPlaylistLoader_.media();if(t){var i=this.syncController_.getExpiredTime(t,this.duration());if(null!==i){var n=this.masterPlaylistLoader_.master,r=hp.Playlist.seekable(t,i,hp.Playlist.liveEdgeDelay(n,t));if(0!==r.length){if(this.mediaTypes_.AUDIO.activePlaylistLoader){if(t=this.mediaTypes_.AUDIO.activePlaylistLoader.media(),null===(i=this.syncController_.getExpiredTime(t,this.duration())))return;if(0===(e=hp.Playlist.seekable(t,i,hp.Playlist.liveEdgeDelay(n,t))).length)return}var a,s;this.seekable_&&this.seekable_.length&&(a=this.seekable_.end(0),s=this.seekable_.start(0)),e?e.start(0)>r.end(0)||r.start(0)>e.end(0)?this.seekable_=r:this.seekable_=$c.createTimeRanges([[e.start(0)>r.start(0)?e.start(0):r.start(0),e.end(0)<r.end(0)?e.end(0):r.end(0)]]):this.seekable_=r,this.seekable_&&this.seekable_.length&&this.seekable_.end(0)===a&&this.seekable_.start(0)===s||(this.logger_("seekable updated ["+ud(this.seekable_)+"]"),this.tech_.trigger("seekablechanged"))}}}}},i.updateDuration=function(e){if(this.updateDuration_&&(this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.updateDuration_=null),"open"!==this.mediaSource.readyState)return this.updateDuration_=this.updateDuration.bind(this,e),void this.mediaSource.addEventListener("sourceopen",this.updateDuration_);if(e){var t=this.seekable();if(!t.length)return;(isNaN(this.mediaSource.duration)||this.mediaSource.duration<t.end(t.length-1))&&this.sourceUpdater_.setDuration(t.end(t.length-1))}else{var i=this.tech_.buffered(),n=hp.Playlist.duration(this.masterPlaylistLoader_.media());i.length>0&&(n=Math.max(n,i.end(i.length-1))),this.mediaSource.duration!==n&&this.sourceUpdater_.setDuration(n)}},i.dispose=function(){var e=this;this.trigger("dispose"),this.decrypter_.terminate(),this.masterPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_),["AUDIO","SUBTITLES"].forEach((function(t){var i=e.mediaTypes_[t].groups;for(var n in i)i[n].forEach((function(e){e.playlistLoader&&e.playlistLoader.dispose()}))})),this.audioSegmentLoader_.dispose(),this.subtitleSegmentLoader_.dispose(),this.sourceUpdater_.dispose(),this.timelineChangeController_.dispose(),this.stopABRTimer_(),this.updateDuration_&&this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.mediaSource.removeEventListener("durationchange",this.handleDurationChange_),this.mediaSource.removeEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.removeEventListener("sourceended",this.handleSourceEnded_),this.off()},i.master=function(){return this.masterPlaylistLoader_.master},i.media=function(){return this.masterPlaylistLoader_.media()||this.initialMedia_},i.areMediaTypesKnown_=function(){var e=!!this.mediaTypes_.AUDIO.activePlaylistLoader,t=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),i=!e||!!this.audioSegmentLoader_.getCurrentMediaInfo_();return!(!t||!i)},i.getCodecsOrExclude_=function(){var e=this,t={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}};t.video=t.main;var i=Xh(this.master(),this.media()),n={},r=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(t.main.hasVideo&&(n.video=i.video||t.main.videoCodec||"avc1.4d400d"),t.main.isMuxed&&(n.video+=","+(i.audio||t.main.audioCodec||Ot)),(t.main.hasAudio&&!t.main.isMuxed||t.audio.hasAudio||r)&&(n.audio=i.audio||t.main.audioCodec||t.audio.audioCodec||Ot,t.audio.isFmp4=t.main.hasAudio&&!t.main.isMuxed?t.main.isFmp4:t.audio.isFmp4),n.audio||n.video){var a,s={};if(["video","audio"].forEach((function(e){if(n.hasOwnProperty(e)&&(r=t[e].isFmp4,o=n[e],!(r?Lt(o):Dt(o)))){var i=t[e].isFmp4?"browser":"muxer";s[i]=s[i]||[],s[i].push(n[e]),"audio"===e&&(a=i)}var r,o})),r&&a&&this.media().attributes.AUDIO){var o=this.media().attributes.AUDIO;this.master().playlists.forEach((function(t){(t.attributes&&t.attributes.AUDIO)===o&&t!==e.media()&&(t.excludeUntil=1/0)})),this.logger_("excluding audio group "+o+" as "+a+' does not support codec(s): "'+n.audio+'"')}if(!Object.keys(s).length){if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){var u=[];if(["video","audio"].forEach((function(t){var i=(It(e.sourceUpdater_.codecs[t]||"")[0]||{}).type,r=(It(n[t]||"")[0]||{}).type;i&&r&&i.toLowerCase()!==r.toLowerCase()&&u.push('"'+e.sourceUpdater_.codecs[t]+'" -> "'+n[t]+'"')})),u.length)return void this.blacklistCurrentPlaylist({playlist:this.media(),message:"Codec switching not supported: "+u.join(", ")+".",blacklistDuration:1/0,internal:!0})}return n}var l=Object.keys(s).reduce((function(e,t){return e&&(e+=", "),e+=t+' does not support codec(s): "'+s[t].join(",")+'"'}),"")+".";this.blacklistCurrentPlaylist({playlist:this.media(),internal:!0,message:l,blacklistDuration:1/0})}else this.blacklistCurrentPlaylist({playlist:this.media(),message:"Could not determine codecs for playlist.",blacklistDuration:1/0})},i.tryToCreateSourceBuffers_=function(){if("open"===this.mediaSource.readyState&&!this.sourceUpdater_.hasCreatedSourceBuffers()&&this.areMediaTypesKnown_()){var e=this.getCodecsOrExclude_();if(e){this.sourceUpdater_.createSourceBuffers(e);var t=[e.video,e.audio].filter(Boolean).join(",");this.excludeIncompatibleVariants_(t)}}},i.excludeUnsupportedVariants_=function(){var e=this,t=this.master().playlists,i=[];Object.keys(t).forEach((function(n){var r=t[n];if(-1===i.indexOf(r.id)){i.push(r.id);var a=Xh(e.master,r),s=[];!a.audio||Dt(a.audio)||Lt(a.audio)||s.push("audio codec "+a.audio),!a.video||Dt(a.video)||Lt(a.video)||s.push("video codec "+a.video),a.text&&"stpp.ttml.im1t"===a.text&&s.push("text codec "+a.text),s.length&&(r.excludeUntil=1/0,e.logger_("excluding "+r.id+" for unsupported: "+s.join(", ")))}}))},i.excludeIncompatibleVariants_=function(e){var t=this,i=[],n=this.master().playlists,r=Gh(It(e)),a=zh(r),s=r.video&&It(r.video)[0]||null,o=r.audio&&It(r.audio)[0]||null;Object.keys(n).forEach((function(e){var r=n[e];if(-1===i.indexOf(r.id)&&r.excludeUntil!==1/0){i.push(r.id);var u=[],l=Xh(t.masterPlaylistLoader_.master,r),c=zh(l);if(l.audio||l.video){if(c!==a&&u.push('codec count "'+c+'" !== "'+a+'"'),!t.sourceUpdater_.canChangeType()){var d=l.video&&It(l.video)[0]||null,h=l.audio&&It(l.audio)[0]||null;d&&s&&d.type.toLowerCase()!==s.type.toLowerCase()&&u.push('video codec "'+d.type+'" !== "'+s.type+'"'),h&&o&&h.type.toLowerCase()!==o.type.toLowerCase()&&u.push('audio codec "'+h.type+'" !== "'+o.type+'"')}u.length&&(r.excludeUntil=1/0,t.logger_("blacklisting "+r.id+": "+u.join(" && ")))}}}))},i.updateAdCues_=function(e){var t=0,i=this.seekable();i.length&&(t=i.start(0)),function(e,t,i){if(void 0===i&&(i=0),e.segments)for(var n,r=i,a=0;a<e.segments.length;a++){var s=e.segments[a];if(n||(n=Mp(t,r+s.duration/2)),n){if("cueIn"in s){n.endTime=r,n.adEndTime=r,r+=s.duration,n=null;continue}if(r<n.endTime){r+=s.duration;continue}n.endTime+=s.duration}else if("cueOut"in s&&((n=new d.VTTCue(r,r+s.duration,s.cueOut)).adStartTime=r,n.adEndTime=r+parseFloat(s.cueOut),t.addCue(n)),"cueOutCont"in s){var o=s.cueOutCont.split("/").map(parseFloat),u=o[0],l=o[1];(n=new d.VTTCue(r,r+s.duration,"")).adStartTime=r-u,n.adEndTime=n.adStartTime+l,t.addCue(n)}r+=s.duration}}(e,this.cueTagsTrack_,t)},i.goalBufferLength=function(){var e=this.tech_.currentTime(),t=fh.GOAL_BUFFER_LENGTH,i=fh.GOAL_BUFFER_LENGTH_RATE,n=Math.max(t,fh.MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*i,n)},i.bufferLowWaterLine=function(){var e=this.tech_.currentTime(),t=fh.BUFFER_LOW_WATER_LINE,i=fh.BUFFER_LOW_WATER_LINE_RATE,n=Math.max(t,fh.MAX_BUFFER_LOW_WATER_LINE),r=Math.max(t,fh.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*i,this.experimentalBufferBasedABR?r:n)},i.bufferHighWaterLine=function(){return fh.BUFFER_HIGH_WATER_LINE},t}($c.EventTarget),ef=function(e,t,i){var n,r,a,s=e.masterPlaylistController_,o=s[(e.options_.smoothQualityChange?"smooth":"fast")+"QualityChange_"].bind(s);if(t.attributes){var u=t.attributes.RESOLUTION;this.width=u&&u.width,this.height=u&&u.height,this.bandwidth=t.attributes.BANDWIDTH,this.frameRate=t.attributes["FRAME-RATE"]}this.codecs=Xh(s.master(),t),this.playlist=t,this.id=i,this.enabled=(n=e.playlists,r=t.id,a=o,function(e){var t=n.master.playlists[r],i=Ed(t),s=wd(t);return void 0===e?s:(e?delete t.disabled:t.disabled=!0,e===s||i||(a(),e?n.trigger("renditionenabled"):n.trigger("renditiondisabled")),e)})},tf=["seeking","seeked","pause","playing","error"],nf=function(){function e(e){var t=this;this.masterPlaylistController_=e.masterPlaylistController,this.tech_=e.tech,this.seekable=e.seekable,this.allowSeeksWithinUnsafeLiveWindow=e.allowSeeksWithinUnsafeLiveWindow,this.liveRangeSafeTimeDelta=e.liveRangeSafeTimeDelta,this.media=e.media,this.consecutiveUpdates=0,this.lastRecordedTime=null,this.timer_=null,this.checkCurrentTimeTimeout_=null,this.logger_=id("PlaybackWatcher"),this.logger_("initialize");var i=function(){return t.monitorCurrentTime_()},n=function(){return t.monitorCurrentTime_()},r=function(){return t.techWaiting_()},a=function(){return t.cancelTimer_()},s=this.masterPlaylistController_,o=["main","subtitle","audio"],u={};o.forEach((function(e){u[e]={reset:function(){return t.resetSegmentDownloads_(e)},updateend:function(){return t.checkSegmentDownloads_(e)}},s[e+"SegmentLoader_"].on("appendsdone",u[e].updateend),s[e+"SegmentLoader_"].on("playlistupdate",u[e].reset),t.tech_.on(["seeked","seeking"],u[e].reset)}));var l=function(e){["main","audio"].forEach((function(i){s[i+"SegmentLoader_"][e]("appended",t.seekingAppendCheck_)}))};this.seekingAppendCheck_=function(){t.fixesBadSeeks_()&&(t.consecutiveUpdates=0,t.lastRecordedTime=t.tech_.currentTime(),l("off"))},this.clearSeekingAppendCheck_=function(){return l("off")},this.watchForBadSeeking_=function(){t.clearSeekingAppendCheck_(),l("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",r),this.tech_.on(tf,a),this.tech_.on("canplay",n),this.tech_.one("play",i),this.dispose=function(){t.clearSeekingAppendCheck_(),t.logger_("dispose"),t.tech_.off("waiting",r),t.tech_.off(tf,a),t.tech_.off("canplay",n),t.tech_.off("play",i),t.tech_.off("seeking",t.watchForBadSeeking_),t.tech_.off("seeked",t.clearSeekingAppendCheck_),o.forEach((function(e){s[e+"SegmentLoader_"].off("appendsdone",u[e].updateend),s[e+"SegmentLoader_"].off("playlistupdate",u[e].reset),t.tech_.off(["seeked","seeking"],u[e].reset)})),t.checkCurrentTimeTimeout_&&d.clearTimeout(t.checkCurrentTimeTimeout_),t.cancelTimer_()}}var t=e.prototype;return t.monitorCurrentTime_=function(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&d.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=d.setTimeout(this.monitorCurrentTime_.bind(this),250)},t.resetSegmentDownloads_=function(e){var t=this.masterPlaylistController_[e+"SegmentLoader_"];this[e+"StalledDownloads_"]>0&&this.logger_("resetting possible stalled download count for "+e+" loader"),this[e+"StalledDownloads_"]=0,this[e+"Buffered_"]=t.buffered_()},t.checkSegmentDownloads_=function(e){var t=this.masterPlaylistController_,i=t[e+"SegmentLoader_"],n=i.buffered_(),r=function(e,t){if(e===t)return!1;if(!e&&t||!t&&e)return!0;if(e.length!==t.length)return!0;for(var i=0;i<e.length;i++)if(e.start(i)!==t.start(i)||e.end(i)!==t.end(i))return!0;return!1}(this[e+"Buffered_"],n);this[e+"Buffered_"]=n,r?this.resetSegmentDownloads_(e):(this[e+"StalledDownloads_"]++,this.logger_("found #"+this[e+"StalledDownloads_"]+" "+e+" appends that did not increase buffer (possible stalled download)",{playlistId:i.playlist_&&i.playlist_.id,buffered:ld(n)}),this[e+"StalledDownloads_"]<10||(this.logger_(e+" loader stalled download exclusion"),this.resetSegmentDownloads_(e),this.tech_.trigger({type:"usage",name:"vhs-"+e+"-download-exclusion"}),"subtitle"!==e&&t.blacklistCurrentPlaylist({message:"Excessive "+e+" segment downloading detected."},1/0)))},t.checkCurrentTime_=function(){if(!this.tech_.paused()&&!this.tech_.seeking()){var e=this.tech_.currentTime(),t=this.tech_.buffered();if(this.lastRecordedTime===e&&(!t.length||e+rd>=t.end(t.length-1)))return this.techWaiting_();this.consecutiveUpdates>=5&&e===this.lastRecordedTime?(this.consecutiveUpdates++,this.waiting_()):e===this.lastRecordedTime?this.consecutiveUpdates++:(this.consecutiveUpdates=0,this.lastRecordedTime=e)}},t.cancelTimer_=function(){this.consecutiveUpdates=0,this.timer_&&(this.logger_("cancelTimer_"),clearTimeout(this.timer_)),this.timer_=null},t.fixesBadSeeks_=function(){if(!this.tech_.seeking())return!1;var e,t=this.seekable(),i=this.tech_.currentTime();this.afterSeekableWindow_(t,i,this.media(),this.allowSeeksWithinUnsafeLiveWindow)&&(e=t.end(t.length-1));if(this.beforeSeekableWindow_(t,i)){var n=t.start(0);e=n+(n===t.end(0)?0:rd)}if(void 0!==e)return this.logger_("Trying to seek outside of seekable at time "+i+" with seekable range "+ud(t)+". Seeking to "+e+"."),this.tech_.setCurrentTime(e),!0;for(var r=this.masterPlaylistController_.sourceUpdater_,a=this.tech_.buffered(),s=r.audioBuffer?r.audioBuffered():null,o=r.videoBuffer?r.videoBuffered():null,u=this.media(),l=u.partTargetDuration?u.partTargetDuration:2*(u.targetDuration-nd),c=[s,o],d=0;d<c.length;d++){if(c[d])if(dd(c[d],i)<l)return!1}var h=od(a,i);return 0!==h.length&&(e=h.start(0)+rd,this.logger_("Buffered region starts ("+h.start(0)+") just beyond seek point ("+i+"). Seeking to "+e+"."),this.tech_.setCurrentTime(e),!0)},t.waiting_=function(){if(!this.techWaiting_()){var e=this.tech_.currentTime(),t=this.tech_.buffered(),i=sd(t,e);return i.length&&e+3<=i.end(0)?(this.cancelTimer_(),this.tech_.setCurrentTime(e),this.logger_("Stopped at "+e+" while inside a buffered region ["+i.start(0)+" -> "+i.end(0)+"]. Attempting to resume playback by seeking to the current time."),this.tech_.trigger({type:"usage",name:"vhs-unknown-waiting"}),void this.tech_.trigger({type:"usage",name:"hls-unknown-waiting"})):void 0}},t.techWaiting_=function(){var e=this.seekable(),t=this.tech_.currentTime();if(this.tech_.seeking()||null!==this.timer_)return!0;if(this.beforeSeekableWindow_(e,t)){var i=e.end(e.length-1);return this.logger_("Fell out of live window at time "+t+". Seeking to live point (seekable end) "+i),this.cancelTimer_(),this.tech_.setCurrentTime(i),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),this.tech_.trigger({type:"usage",name:"hls-live-resync"}),!0}var n=this.tech_.vhs.masterPlaylistController_.sourceUpdater_,r=this.tech_.buffered();if(this.videoUnderflow_({audioBuffered:n.audioBuffered(),videoBuffered:n.videoBuffered(),currentTime:t}))return this.cancelTimer_(),this.tech_.setCurrentTime(t),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),this.tech_.trigger({type:"usage",name:"hls-video-underflow"}),!0;var a=od(r,t);if(a.length>0){var s=a.start(0)-t;return this.logger_("Stopped at "+t+", setting timer for "+s+", seeking to "+a.start(0)),this.cancelTimer_(),this.timer_=setTimeout(this.skipTheGap_.bind(this),1e3*s,t),!0}return!1},t.afterSeekableWindow_=function(e,t,i,n){if(void 0===n&&(n=!1),!e.length)return!1;var r=e.end(e.length-1)+rd;return!i.endList&&n&&(r=e.end(e.length-1)+3*i.targetDuration),t>r},t.beforeSeekableWindow_=function(e,t){return!!(e.length&&e.start(0)>0&&t<e.start(0)-this.liveRangeSafeTimeDelta)},t.videoUnderflow_=function(e){var t=e.videoBuffered,i=e.audioBuffered,n=e.currentTime;if(t){var r;if(t.length&&i.length){var a=sd(t,n-3),s=sd(t,n),o=sd(i,n);o.length&&!s.length&&a.length&&(r={start:a.end(0),end:o.end(0)})}else{od(t,n).length||(r=this.gapFromVideoUnderflow_(t,n))}return!!r&&(this.logger_("Encountered a gap in video from "+r.start+" to "+r.end+". Seeking to current time "+n),!0)}},t.skipTheGap_=function(e){var t=this.tech_.buffered(),i=this.tech_.currentTime(),n=od(t,i);this.cancelTimer_(),0!==n.length&&i===e&&(this.logger_("skipTheGap_:","currentTime:",i,"scheduled currentTime:",e,"nextRange start:",n.start(0)),this.tech_.setCurrentTime(n.start(0)+nd),this.tech_.trigger({type:"usage",name:"vhs-gap-skip"}),this.tech_.trigger({type:"usage",name:"hls-gap-skip"}))},t.gapFromVideoUnderflow_=function(e,t){for(var i=function(e){if(e.length<2)return $c.createTimeRanges();for(var t=[],i=1;i<e.length;i++){var n=e.end(i-1),r=e.start(i);t.push([n,r])}return $c.createTimeRanges(t)}(e),n=0;n<i.length;n++){var r=i.start(n),a=i.end(n);if(t-r<4&&t-r>2)return{start:r,end:a}}return null},e}(),rf={errorInterval:30,getSource:function(e){return e(this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource())}},af=function e(t,i){var n=0,r=0,a=$c.mergeOptions(rf,i);t.ready((function(){t.trigger({type:"usage",name:"vhs-error-reload-initialized"}),t.trigger({type:"usage",name:"hls-error-reload-initialized"})}));var s=function(){r&&t.currentTime(r)},o=function(e){null!=e&&(r=t.duration()!==1/0&&t.currentTime()||0,t.one("loadedmetadata",s),t.src(e),t.trigger({type:"usage",name:"vhs-error-reload"}),t.trigger({type:"usage",name:"hls-error-reload"}),t.play())},u=function(){return Date.now()-n<1e3*a.errorInterval?(t.trigger({type:"usage",name:"vhs-error-reload-canceled"}),void t.trigger({type:"usage",name:"hls-error-reload-canceled"})):a.getSource&&"function"==typeof a.getSource?(n=Date.now(),a.getSource.call(t,o)):void $c.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!")},l=function e(){t.off("loadedmetadata",s),t.off("error",u),t.off("dispose",e)};t.on("error",u),t.on("dispose",l),t.reloadSourceOnError=function(i){l(),e(t,i)}},sf="2.16.0",of={PlaylistLoader:Wd,Playlist:Pd,utils:nh,STANDARD_PLAYLIST_SELECTOR:ep,INITIAL_PLAYLIST_SELECTOR:function(){var e=this,t=this.playlists.master.playlists.filter(Pd.isEnabled);return $h(t,(function(e,t){return Jh(e,t)})),t.filter((function(t){return!!Xh(e.playlists.master,t).video}))[0]||null},lastBandwidthSelector:ep,movingAverageBandwidthSelector:function(e){var t=-1,i=-1;if(e<0||e>1)throw new Error("Moving average bandwidth decay must be between 0 and 1.");return function(){var n=this.useDevicePixelRatio&&d.devicePixelRatio||1;return t<0&&(t=this.systemBandwidth,i=this.systemBandwidth),this.systemBandwidth>0&&this.systemBandwidth!==i&&(t=e*this.systemBandwidth+(1-e)*t,i=this.systemBandwidth),Zh(this.playlists.master,t,parseInt(Qh(this.tech_.el(),"width"),10)*n,parseInt(Qh(this.tech_.el(),"height"),10)*n,this.limitRenditionByPlayerDimensions,this.masterPlaylistController_)}},comparePlaylistBandwidth:Jh,comparePlaylistResolution:function(e,t){var i,n;return e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width&&(i=e.attributes.RESOLUTION.width),i=i||d.Number.MAX_VALUE,t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width&&(n=t.attributes.RESOLUTION.width),i===(n=n||d.Number.MAX_VALUE)&&e.attributes.BANDWIDTH&&t.attributes.BANDWIDTH?e.attributes.BANDWIDTH-t.attributes.BANDWIDTH:i-n},xhr:Kd()};Object.keys(fh).forEach((function(e){Object.defineProperty(of,e,{get:function(){return $c.log.warn("using Vhs."+e+" is UNSAFE be sure you know what you are doing"),fh[e]},set:function(t){$c.log.warn("using Vhs."+e+" is UNSAFE be sure you know what you are doing"),"number"!=typeof t||t<0?$c.log.warn("value of Vhs."+e+" must be greater than or equal to 0"):fh[e]=t}})}));var uf="videojs-vhs",lf=function(e,t){for(var i=t.media(),n=-1,r=0;r<e.length;r++)if(e[r].id===i.id){n=r;break}e.selectedIndex_=n,e.trigger({selectedIndex:n,type:"change"})};of.canPlaySource=function(){return $c.log.warn("HLS is no longer a tech. Please remove it from your player's techOrder.")};var cf=function(e){var t=e.player,i=e.sourceKeySystems,n=e.audioMedia,r=e.mainPlaylists;if(!t.eme.initializeMediaKeys)return Promise.resolve();var a=function(e,t){return e.reduce((function(e,i){if(!i.contentProtection)return e;var n=t.reduce((function(e,t){var n=i.contentProtection[t];return n&&n.pssh&&(e[t]={pssh:n.pssh}),e}),{});return Object.keys(n).length&&e.push(n),e}),[])}(n?r.concat([n]):r,Object.keys(i)),s=[],o=[];return a.forEach((function(e){o.push(new Promise((function(e,i){t.tech_.one("keysessioncreated",e)}))),s.push(new Promise((function(i,n){t.eme.initializeMediaKeys({keySystems:e},(function(e){e?n(e):i()}))})))})),Promise.race([Promise.all(s),Promise.race(o)])},df=function(e){var t=e.player,i=function(e,t,i){if(!e)return e;var n={};t&&t.attributes&&t.attributes.CODECS&&(n=Gh(It(t.attributes.CODECS))),i&&i.attributes&&i.attributes.CODECS&&(n.audio=i.attributes.CODECS);var r=Pt(n.video),a=Pt(n.audio),s={};for(var o in e)s[o]={},a&&(s[o].audioContentType=a),r&&(s[o].videoContentType=r),t.contentProtection&&t.contentProtection[o]&&t.contentProtection[o].pssh&&(s[o].pssh=t.contentProtection[o].pssh),"string"==typeof e[o]&&(s[o].url=e[o]);return $c.mergeOptions(e,s)}(e.sourceKeySystems,e.media,e.audioMedia);return!!i&&(t.currentSource().keySystems=i,!(i&&!t.eme)||($c.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),!1))},hf=function(){if(!d.localStorage)return null;var e=d.localStorage.getItem(uf);if(!e)return null;try{return JSON.parse(e)}catch(e){return null}};of.supportsNativeHls=function(){if(!te||!te.createElement)return!1;var e=te.createElement("video");if(!$c.getTech("Html5").isSupported())return!1;return["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some((function(t){return/maybe|probably/i.test(e.canPlayType(t))}))}(),of.supportsNativeDash=!!(te&&te.createElement&&$c.getTech("Html5").isSupported())&&/maybe|probably/i.test(te.createElement("video").canPlayType("application/dash+xml")),of.supportsTypeNatively=function(e){return"hls"===e?of.supportsNativeHls:"dash"===e&&of.supportsNativeDash},of.isSupported=function(){return $c.log.warn("HLS is no longer a tech. Please remove it from your player's techOrder.")};var pf=function(e){function t(t,i,n){var r;if(r=e.call(this,i,$c.mergeOptions(n.hls,n.vhs))||this,n.hls&&Object.keys(n.hls).length&&$c.log.warn("Using hls options is deprecated. Please rename `hls` to `vhs` in your options object."),"number"==typeof n.initialBandwidth&&(r.options_.bandwidth=n.initialBandwidth),r.logger_=id("VhsHandler"),i.options_&&i.options_.playerId){var a=$c(i.options_.playerId);a.hasOwnProperty("hls")||Object.defineProperty(a,"hls",{get:function(){return $c.log.warn("player.hls is deprecated. Use player.tech().vhs instead."),i.trigger({type:"usage",name:"hls-player-access"}),ae(r)},configurable:!0}),a.hasOwnProperty("vhs")||Object.defineProperty(a,"vhs",{get:function(){return $c.log.warn("player.vhs is deprecated. Use player.tech().vhs instead."),i.trigger({type:"usage",name:"vhs-player-access"}),ae(r)},configurable:!0}),a.hasOwnProperty("dash")||Object.defineProperty(a,"dash",{get:function(){return $c.log.warn("player.dash is deprecated. Use player.tech().vhs instead."),ae(r)},configurable:!0}),r.player_=a}if(r.tech_=i,r.source_=t,r.stats={},r.ignoreNextSeekingEvent_=!1,r.setOptions_(),r.options_.overrideNative&&i.overrideNativeAudioTracks&&i.overrideNativeVideoTracks)i.overrideNativeAudioTracks(!0),i.overrideNativeVideoTracks(!0);else if(r.options_.overrideNative&&(i.featuresNativeVideoTracks||i.featuresNativeAudioTracks))throw new Error("Overriding native HLS requires emulated tracks. See https://git.io/vMpjB");return r.on(te,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],(function(e){var t=te.fullscreenElement||te.webkitFullscreenElement||te.mozFullScreenElement||te.msFullscreenElement;t&&t.contains(r.tech_.el())?r.masterPlaylistController_.fastQualityChange_():r.masterPlaylistController_.checkABR_()})),r.on(r.tech_,"seeking",(function(){this.ignoreNextSeekingEvent_?this.ignoreNextSeekingEvent_=!1:this.setCurrentTime(this.tech_.currentTime())})),r.on(r.tech_,"error",(function(){this.tech_.error()&&this.masterPlaylistController_&&this.masterPlaylistController_.pauseLoading()})),r.on(r.tech_,"play",r.play),r}oe(t,e);var i=t.prototype;return i.setOptions_=function(){var e=this;if(this.options_.withCredentials=this.options_.withCredentials||!1,this.options_.handleManifestRedirects=!1!==this.options_.handleManifestRedirects,this.options_.limitRenditionByPlayerDimensions=!1!==this.options_.limitRenditionByPlayerDimensions,this.options_.useDevicePixelRatio=this.options_.useDevicePixelRatio||!1,this.options_.smoothQualityChange=this.options_.smoothQualityChange||!1,this.options_.useBandwidthFromLocalStorage=void 0!==this.source_.useBandwidthFromLocalStorage?this.source_.useBandwidthFromLocalStorage:this.options_.useBandwidthFromLocalStorage||!1,this.options_.useNetworkInformationApi=this.options_.useNetworkInformationApi||!1,this.options_.useDtsForTimestampOffset=this.options_.useDtsForTimestampOffset||!1,this.options_.customTagParsers=this.options_.customTagParsers||[],this.options_.customTagMappers=this.options_.customTagMappers||[],this.options_.cacheEncryptionKeys=this.options_.cacheEncryptionKeys||!1,"number"!=typeof this.options_.blacklistDuration&&(this.options_.blacklistDuration=300),"number"!=typeof this.options_.bandwidth&&this.options_.useBandwidthFromLocalStorage){var t=hf();t&&t.bandwidth&&(this.options_.bandwidth=t.bandwidth,this.tech_.trigger({type:"usage",name:"vhs-bandwidth-from-local-storage"}),this.tech_.trigger({type:"usage",name:"hls-bandwidth-from-local-storage"})),t&&t.throughput&&(this.options_.throughput=t.throughput,this.tech_.trigger({type:"usage",name:"vhs-throughput-from-local-storage"}),this.tech_.trigger({type:"usage",name:"hls-throughput-from-local-storage"}))}"number"!=typeof this.options_.bandwidth&&(this.options_.bandwidth=fh.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===fh.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","limitRenditionByPlayerDimensions","bandwidth","smoothQualityChange","customTagParsers","customTagMappers","handleManifestRedirects","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","experimentalBufferBasedABR","liveRangeSafeTimeDelta","experimentalLLHLS","useNetworkInformationApi","useDtsForTimestampOffset","experimentalExactManifestTimings","experimentalLeastPixelDiffSelector"].forEach((function(t){void 0!==e.source_[t]&&(e.options_[t]=e.source_[t])})),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions,this.useDevicePixelRatio=this.options_.useDevicePixelRatio},i.src=function(e,t){var i=this;if(e){var n;this.setOptions_(),this.options_.src=0===(n=this.source_.src).toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")?JSON.parse(n.substring(n.indexOf(",")+1)):n,this.options_.tech=this.tech_,this.options_.externVhs=of,this.options_.sourceType=Mt(t),this.options_.seekTo=function(e){i.tech_.setCurrentTime(e)},this.options_.smoothQualityChange&&$c.log.warn("smoothQualityChange is deprecated and will be removed in the next major version"),this.masterPlaylistController_=new Zp(this.options_);var r=$c.mergeOptions({liveRangeSafeTimeDelta:rd},this.options_,{seekable:function(){return i.seekable()},media:function(){return i.masterPlaylistController_.media()},masterPlaylistController:this.masterPlaylistController_});this.playbackWatcher_=new nf(r),this.masterPlaylistController_.on("error",(function(){var e=$c.players[i.tech_.options_.playerId],t=i.masterPlaylistController_.error;"object"!==u(t)||t.code?"string"==typeof t&&(t={message:t,code:3}):t.code=3,e.error(t)}));var a=this.options_.experimentalBufferBasedABR?of.movingAverageBandwidthSelector(.55):of.STANDARD_PLAYLIST_SELECTOR;this.masterPlaylistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):a.bind(this),this.masterPlaylistController_.selectInitialPlaylist=of.INITIAL_PLAYLIST_SELECTOR.bind(this),this.playlists=this.masterPlaylistController_.masterPlaylistLoader_,this.mediaSource=this.masterPlaylistController_.mediaSource,Object.defineProperties(this,{selectPlaylist:{get:function(){return this.masterPlaylistController_.selectPlaylist},set:function(e){this.masterPlaylistController_.selectPlaylist=e.bind(this)}},throughput:{get:function(){return this.masterPlaylistController_.mainSegmentLoader_.throughput.rate},set:function(e){this.masterPlaylistController_.mainSegmentLoader_.throughput.rate=e,this.masterPlaylistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get:function(){var e=this.masterPlaylistController_.mainSegmentLoader_.bandwidth,t=d.navigator.connection||d.navigator.mozConnection||d.navigator.webkitConnection,i=1e7;if(this.options_.useNetworkInformationApi&&t){var n=1e3*t.downlink*1e3;e=n>=i&&e>=i?Math.max(e,n):n}return e},set:function(e){this.masterPlaylistController_.mainSegmentLoader_.bandwidth=e,this.masterPlaylistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get:function(){var e,t=1/(this.bandwidth||1);return e=this.throughput>0?1/this.throughput:0,Math.floor(1/(t+e))},set:function(){$c.log.error('The "systemBandwidth" property is read-only')}}}),this.options_.bandwidth&&(this.bandwidth=this.options_.bandwidth),this.options_.throughput&&(this.throughput=this.options_.throughput),Object.defineProperties(this.stats,{bandwidth:{get:function(){return i.bandwidth||0},enumerable:!0},mediaRequests:{get:function(){return i.masterPlaylistController_.mediaRequests_()||0},enumerable:!0},mediaRequestsAborted:{get:function(){return i.masterPlaylistController_.mediaRequestsAborted_()||0},enumerable:!0},mediaRequestsTimedout:{get:function(){return i.masterPlaylistController_.mediaRequestsTimedout_()||0},enumerable:!0},mediaRequestsErrored:{get:function(){return i.masterPlaylistController_.mediaRequestsErrored_()||0},enumerable:!0},mediaTransferDuration:{get:function(){return i.masterPlaylistController_.mediaTransferDuration_()||0},enumerable:!0},mediaBytesTransferred:{get:function(){return i.masterPlaylistController_.mediaBytesTransferred_()||0},enumerable:!0},mediaSecondsLoaded:{get:function(){return i.masterPlaylistController_.mediaSecondsLoaded_()||0},enumerable:!0},mediaAppends:{get:function(){return i.masterPlaylistController_.mediaAppends_()||0},enumerable:!0},mainAppendsToLoadedData:{get:function(){return i.masterPlaylistController_.mainAppendsToLoadedData_()||0},enumerable:!0},audioAppendsToLoadedData:{get:function(){return i.masterPlaylistController_.audioAppendsToLoadedData_()||0},enumerable:!0},appendsToLoadedData:{get:function(){return i.masterPlaylistController_.appendsToLoadedData_()||0},enumerable:!0},timeToLoadedData:{get:function(){return i.masterPlaylistController_.timeToLoadedData_()||0},enumerable:!0},buffered:{get:function(){return ld(i.tech_.buffered())},enumerable:!0},currentTime:{get:function(){return i.tech_.currentTime()},enumerable:!0},currentSource:{get:function(){return i.tech_.currentSource_},enumerable:!0},currentTech:{get:function(){return i.tech_.name_},enumerable:!0},duration:{get:function(){return i.tech_.duration()},enumerable:!0},master:{get:function(){return i.playlists.master},enumerable:!0},playerDimensions:{get:function(){return i.tech_.currentDimensions()},enumerable:!0},seekable:{get:function(){return ld(i.tech_.seekable())},enumerable:!0},timestamp:{get:function(){return Date.now()},enumerable:!0},videoPlaybackQuality:{get:function(){return i.tech_.getVideoPlaybackQuality()},enumerable:!0}}),this.tech_.one("canplay",this.masterPlaylistController_.setupFirstPlay.bind(this.masterPlaylistController_)),this.tech_.on("bandwidthupdate",(function(){i.options_.useBandwidthFromLocalStorage&&function(e){if(!d.localStorage)return!1;var t=hf();t=t?$c.mergeOptions(t,e):e;try{d.localStorage.setItem(uf,JSON.stringify(t))}catch(e){return!1}}({bandwidth:i.bandwidth,throughput:Math.round(i.throughput)})})),this.masterPlaylistController_.on("selectedinitialmedia",(function(){var e;(e=i).representations=function(){var t=e.masterPlaylistController_.master(),i=Ad(t)?e.masterPlaylistController_.getAudioTrackPlaylists_():t.playlists;return i?i.filter((function(e){return!Ed(e)})).map((function(t,i){return new ef(e,t,t.id)})):[]}})),this.masterPlaylistController_.sourceUpdater_.on("createdsourcebuffers",(function(){i.setupEme_()})),this.on(this.masterPlaylistController_,"progress",(function(){this.tech_.trigger("progress")})),this.on(this.masterPlaylistController_,"firstplay",(function(){this.ignoreNextSeekingEvent_=!0})),this.setupQualityLevels_(),this.tech_.el()&&(this.mediaSourceUrl_=d.URL.createObjectURL(this.masterPlaylistController_.mediaSource),this.tech_.src(this.mediaSourceUrl_))}},i.createKeySessions_=function(){var e=this,t=this.masterPlaylistController_.mediaTypes_.AUDIO.activePlaylistLoader;this.logger_("waiting for EME key session creation"),cf({player:this.player_,sourceKeySystems:this.source_.keySystems,audioMedia:t&&t.media(),mainPlaylists:this.playlists.master.playlists}).then((function(){e.logger_("created EME key session"),e.masterPlaylistController_.sourceUpdater_.initializedEme()})).catch((function(t){e.logger_("error while creating EME key session",t),e.player_.error({message:"Failed to initialize media keys for EME",code:3})}))},i.handleWaitingForKey_=function(){this.logger_("waitingforkey fired, attempting to create any new key sessions"),this.createKeySessions_()},i.setupEme_=function(){var e=this,t=this.masterPlaylistController_.mediaTypes_.AUDIO.activePlaylistLoader,i=df({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:t&&t.media()});this.player_.tech_.on("keystatuschange",(function(t){if("output-restricted"===t.status){var i=e.masterPlaylistController_.master();if(i&&i.playlists){var n,r=[];if(i.playlists.forEach((function(e){e&&e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.height>=720&&(!e.excludeUntil||e.excludeUntil<1/0)&&(e.excludeUntil=1/0,r.push(e))})),r.length)(n=$c.log).warn.apply(n,['DRM keystatus changed to "output-restricted." Removing the following HD playlists that will most likely fail to play and clearing the buffer. This may be due to HDCP restrictions on the stream and the capabilities of the current device.'].concat(r)),e.masterPlaylistController_.fastQualityChange_()}}})),this.handleWaitingForKey_=this.handleWaitingForKey_.bind(this),this.player_.tech_.on("waitingforkey",this.handleWaitingForKey_),11!==$c.browser.IE_VERSION&&i?this.createKeySessions_():this.masterPlaylistController_.sourceUpdater_.initializedEme()},i.setupQualityLevels_=function(){var e=this,t=$c.players[this.tech_.options_.playerId];t&&t.qualityLevels&&!this.qualityLevels_&&(this.qualityLevels_=t.qualityLevels(),this.masterPlaylistController_.on("selectedinitialmedia",(function(){var t,i;t=e.qualityLevels_,(i=e).representations().forEach((function(e){t.addQualityLevel(e)})),lf(t,i.playlists)})),this.playlists.on("mediachange",(function(){lf(e.qualityLevels_,e.playlists)})))},t.version=function(){return{"@videojs/http-streaming":sf,"mux.js":"6.0.1","mpd-parser":"0.22.1","m3u8-parser":"4.8.0","aes-decrypter":"3.1.3"}},i.version=function(){return this.constructor.version()},i.canChangeType=function(){return Lp.canChangeType()},i.play=function(){this.masterPlaylistController_.play()},i.setCurrentTime=function(e){this.masterPlaylistController_.setCurrentTime(e)},i.duration=function(){return this.masterPlaylistController_.duration()},i.seekable=function(){return this.masterPlaylistController_.seekable()},i.dispose=function(){this.playbackWatcher_&&this.playbackWatcher_.dispose(),this.masterPlaylistController_&&this.masterPlaylistController_.dispose(),this.qualityLevels_&&this.qualityLevels_.dispose(),this.player_&&(delete this.player_.vhs,delete this.player_.dash,delete this.player_.hls),this.tech_&&this.tech_.vhs&&delete this.tech_.vhs,this.tech_&&delete this.tech_.hls,this.mediaSourceUrl_&&d.URL.revokeObjectURL&&(d.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),e.prototype.dispose.call(this)},i.convertToProgramTime=function(e,t){return rh({playlist:this.masterPlaylistController_.media(),time:e,callback:t})},i.seekToProgramTime=function(e,t,i,n){return void 0===i&&(i=!0),void 0===n&&(n=2),ah({programTime:e,playlist:this.masterPlaylistController_.media(),retryCount:n,pauseAfterSeek:i,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})},t}($c.getComponent("Component")),ff={name:"videojs-http-streaming",VERSION:sf,canHandleSource:function(e,t){void 0===t&&(t={});var i=$c.mergeOptions($c.options,t);return ff.canPlayType(e.type,i)},handleSource:function(e,t,i){void 0===i&&(i={});var n=$c.mergeOptions($c.options,i);return t.vhs=new pf(e,t,n),$c.hasOwnProperty("hls")||Object.defineProperty(t,"hls",{get:function(){return $c.log.warn("player.tech().hls is deprecated. Use player.tech().vhs instead."),t.vhs},configurable:!0}),t.vhs.xhr=Kd(),t.vhs.src(e.src,e.type),t.vhs},canPlayType:function(e,t){var i=Mt(e);if(!i)return"";var n=ff.getOverrideNative(t);return!of.supportsTypeNatively(i)||n?"maybe":""},getOverrideNative:function(e){void 0===e&&(e={});var t=e,i=t.vhs,n=void 0===i?{}:i,r=t.hls,a=void 0===r?{}:r,s=!($c.browser.IS_ANY_SAFARI||$c.browser.IS_IOS),o=n.overrideNative,u=void 0===o?s:o,l=a.overrideNative;return void 0!==l&&l||u}};(Lt("avc1.4d400d,mp4a.40.2")&&$c.getTech("Html5").registerSourceHandler(ff,0),$c.VhsHandler=pf,Object.defineProperty($c,"HlsHandler",{get:function(){return $c.log.warn("videojs.HlsHandler is deprecated. Use videojs.VhsHandler instead."),pf},configurable:!0}),$c.VhsSourceHandler=ff,Object.defineProperty($c,"HlsSourceHandler",{get:function(){return $c.log.warn("videojs.HlsSourceHandler is deprecated. Use videojs.VhsSourceHandler instead."),ff},configurable:!0}),$c.Vhs=of,Object.defineProperty($c,"Hls",{get:function(){return $c.log.warn("videojs.Hls is deprecated. Use videojs.Vhs instead."),of},configurable:!0}),$c.use||($c.registerComponent("Hls",of),$c.registerComponent("Vhs",of)),$c.options.vhs=$c.options.vhs||{},$c.options.hls=$c.options.hls||{},$c.getPlugin&&$c.getPlugin("reloadSourceOnError"))||($c.registerPlugin||$c.plugin)("reloadSourceOnError",(function(e){af(this,e)}));var mf=c(Object.freeze({__proto__:null,default:$c}));!function(i,r){!function(r,a){var o=mf;i.exports=function(i){var r=i.browser.IS_IOS||i.browser.IS_NATIVE_ANDROID,a=i.getTech("Tech"),o=function(o){function u(i,n){var a;return t(this,u),(a=e(this,u,[i,n])).setPoster(i.poster),a.setSrc(a.options_.source,!0),a.setTimeout(function(){this.el_&&(this.el_.parentNode.className+=" vjs-youtube",r&&(this.el_.parentNode.className+=" vjs-youtube-mobile"),u.isApiReady?this.initYTPlayer():u.apiReadyQueue.push(this))}.bind(a)),a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t)}(u,o),n(u,[{key:"dispose",value:function(){if(this.ytPlayer)this.ytPlayer.stopVideo&&this.ytPlayer.stopVideo(),this.ytPlayer.destroy&&this.ytPlayer.destroy();else{var e=u.apiReadyQueue.indexOf(this);-1!==e&&u.apiReadyQueue.splice(e,1)}this.ytPlayer=null,this.el_.parentNode.className=this.el_.parentNode.className.replace(" vjs-youtube","").replace(" vjs-youtube-mobile",""),this.el_.parentNode.removeChild(this.el_),a.prototype.dispose.call(this)}},{key:"createEl",value:function(){var e=document.createElement("div");e.setAttribute("id",this.options_.techId),e.setAttribute("style","width:100%;height:100%;top:0;left:0;position:absolute"),e.setAttribute("class","vjs-tech");var t=document.createElement("div");if(t.appendChild(e),!r&&!this.options_.ytControls){var i=document.createElement("div");i.setAttribute("class","vjs-iframe-blocker"),i.setAttribute("style","position:absolute;top:0;left:0;width:100%;height:100%"),i.onclick=function(){this.pause()}.bind(this),t.appendChild(i)}return t}},{key:"initYTPlayer",value:function(){var e={controls:0,modestbranding:1,rel:0,showinfo:0,loop:this.options_.loop?1:0};if(void 0!==this.options_.autohide&&(e.autohide=this.options_.autohide),void 0!==this.options_.cc_load_policy&&(e.cc_load_policy=this.options_.cc_load_policy),void 0!==this.options_.ytControls&&(e.controls=this.options_.ytControls),void 0!==this.options_.disablekb&&(e.disablekb=this.options_.disablekb),void 0!==this.options_.color&&(e.color=this.options_.color),e.controls?void 0!==this.options_.fs&&(e.fs=this.options_.fs):e.fs=0,-1!==this.options_.source.src.indexOf("end=")){var t=this.options_.source.src.match(/end=([0-9]*)/);this.options_.end=parseInt(t[1])}if(void 0!==this.options_.end&&(e.end=this.options_.end),void 0!==this.options_.hl?e.hl=this.options_.hl:void 0!==this.options_.language&&(e.hl=this.options_.language.substr(0,2)),void 0!==this.options_.iv_load_policy&&(e.iv_load_policy=this.options_.iv_load_policy),void 0!==this.options_.list?e.list=this.options_.list:this.url&&void 0!==this.url.listId&&(e.list=this.url.listId),void 0!==this.options_.listType&&(e.listType=this.options_.listType),void 0!==this.options_.modestbranding&&(e.modestbranding=this.options_.modestbranding),void 0!==this.options_.playlist&&(e.playlist=this.options_.playlist),void 0!==this.options_.playsinline&&(e.playsinline=this.options_.playsinline),void 0!==this.options_.rel&&(e.rel=this.options_.rel),void 0!==this.options_.showinfo&&(e.showinfo=this.options_.showinfo),-1!==this.options_.source.src.indexOf("start=")){var i=this.options_.source.src.match(/start=([0-9]*)/);this.options_.start=parseInt(i[1])}if(void 0!==this.options_.start&&(e.start=this.options_.start),void 0!==this.options_.theme&&(e.theme=this.options_.theme),void 0!==this.options_.customVars){var n=this.options_.customVars;Object.keys(n).forEach((function(t){e[t]=n[t]}))}this.activeVideoId=this.url?this.url.videoId:null,this.activeList=e.list;var r={videoId:this.activeVideoId,playerVars:e,events:{onReady:this.onPlayerReady.bind(this),onPlaybackQualityChange:this.onPlayerPlaybackQualityChange.bind(this),onPlaybackRateChange:this.onPlayerPlaybackRateChange.bind(this),onStateChange:this.onPlayerStateChange.bind(this),onVolumeChange:this.onPlayerVolumeChange.bind(this),onError:this.onPlayerError.bind(this)}};void 0!==this.options_.enablePrivacyEnhancedMode&&this.options_.enablePrivacyEnhancedMode&&(r.host="https://www.youtube-nocookie.com"),this.ytPlayer=new YT.Player(this.options_.techId,r)}},{key:"onPlayerReady",value:function(){this.options_.muted&&this.ytPlayer.mute(),this.ytPlayer.getAvailablePlaybackRates().length>1&&(this.featuresPlaybackRate=!0),this.playerReady_=!0,this.triggerReady(),this.playOnReady?this.play():this.cueOnReady&&(this.cueVideoById_(this.url.videoId),this.activeVideoId=this.url.videoId)}},{key:"onPlayerPlaybackQualityChange",value:function(){}},{key:"onPlayerPlaybackRateChange",value:function(){this.trigger("ratechange")}},{key:"onPlayerStateChange",value:function(e){var t=e.data;if(t!==this.lastState&&!this.errorNumber)switch(this.lastState=t,t){case-1:this.trigger("loadstart"),this.trigger("loadedmetadata"),this.trigger("durationchange"),this.trigger("ratechange");break;case YT.PlayerState.ENDED:this.trigger("ended");break;case YT.PlayerState.PLAYING:this.trigger("timeupdate"),this.trigger("durationchange"),this.trigger("playing"),this.trigger("play"),this.isSeeking&&this.onSeeked();break;case YT.PlayerState.PAUSED:this.trigger("canplay"),this.isSeeking?this.onSeeked():this.trigger("pause");break;case YT.PlayerState.BUFFERING:this.player_.trigger("timeupdate"),this.player_.trigger("waiting")}}},{key:"onPlayerVolumeChange",value:function(){this.trigger("volumechange")}},{key:"onPlayerError",value:function(e){this.errorNumber=e.data,this.trigger("pause"),this.trigger("error")}},{key:"error",value:function(){var e=1e3+this.errorNumber;switch(this.errorNumber){case 5:return{code:e,message:"Error while trying to play the video"};case 2:case 100:return{code:e,message:"Unable to find the video"};case 101:case 150:return{code:e,message:"Playback on other Websites has been disabled by the video owner."}}return{code:e,message:"YouTube unknown error ("+this.errorNumber+")"}}},{key:"loadVideoById_",value:function(e){var t={videoId:e};this.options_.start&&(t.startSeconds=this.options_.start),this.options_.end&&(t.endSeconds=this.options_.end),this.ytPlayer.loadVideoById(t)}},{key:"cueVideoById_",value:function(e){var t={videoId:e};this.options_.start&&(t.startSeconds=this.options_.start),this.options_.end&&(t.endSeconds=this.options_.end),this.ytPlayer.cueVideoById(t)}},{key:"src",value:function(e){return e&&this.setSrc({src:e}),this.source}},{key:"poster",value:function(){return r?null:this.poster_}},{key:"setPoster",value:function(e){this.poster_=e}},{key:"setSrc",value:function(e){e&&e.src&&(delete this.errorNumber,this.source=e,this.url=u.parseUrl(e.src),this.options_.poster||this.url.videoId&&(this.poster_="https://img.youtube.com/vi/"+this.url.videoId+"/0.jpg",this.trigger("posterchange"),this.checkHighResPoster()),this.options_.autoplay&&!r?this.isReady_?this.play():this.playOnReady=!0:this.activeVideoId!==this.url.videoId&&(this.isReady_?(this.cueVideoById_(this.url.videoId),this.activeVideoId=this.url.videoId):this.cueOnReady=!0))}},{key:"autoplay",value:function(){return this.options_.autoplay}},{key:"setAutoplay",value:function(e){this.options_.autoplay=e}},{key:"loop",value:function(){return this.options_.loop}},{key:"setLoop",value:function(e){this.options_.loop=e}},{key:"play",value:function(){this.url&&this.url.videoId&&(this.wasPausedBeforeSeek=!1,this.isReady_?(this.url.listId&&(this.activeList===this.url.listId?this.ytPlayer.playVideo():(this.ytPlayer.loadPlaylist(this.url.listId),this.activeList=this.url.listId)),this.activeVideoId===this.url.videoId?this.ytPlayer.playVideo():(this.loadVideoById_(this.url.videoId),this.activeVideoId=this.url.videoId)):(this.trigger("waiting"),this.playOnReady=!0))}},{key:"pause",value:function(){this.ytPlayer&&this.ytPlayer.pauseVideo()}},{key:"paused",value:function(){return!this.ytPlayer||this.lastState!==YT.PlayerState.PLAYING&&this.lastState!==YT.PlayerState.BUFFERING}},{key:"currentTime",value:function(){return this.ytPlayer?this.ytPlayer.getCurrentTime():0}},{key:"setCurrentTime",value:function(e){this.lastState===YT.PlayerState.PAUSED&&(this.timeBeforeSeek=this.currentTime()),this.isSeeking||(this.wasPausedBeforeSeek=this.paused()),this.ytPlayer.seekTo(e,!0),this.trigger("timeupdate"),this.trigger("seeking"),this.isSeeking=!0,this.lastState===YT.PlayerState.PAUSED&&this.timeBeforeSeek!==e&&(clearInterval(this.checkSeekedInPauseInterval),this.checkSeekedInPauseInterval=setInterval(function(){this.lastState===YT.PlayerState.PAUSED&&this.isSeeking?this.currentTime()!==this.timeBeforeSeek&&(this.trigger("timeupdate"),this.onSeeked()):clearInterval(this.checkSeekedInPauseInterval)}.bind(this),250))}},{key:"seeking",value:function(){return this.isSeeking}},{key:"seekable",value:function(){return this.ytPlayer?i.createTimeRange(0,this.ytPlayer.getDuration()):i.createTimeRange()}},{key:"onSeeked",value:function(){clearInterval(this.checkSeekedInPauseInterval),this.isSeeking=!1,this.wasPausedBeforeSeek&&this.pause(),this.trigger("seeked")}},{key:"playbackRate",value:function(){return this.ytPlayer?this.ytPlayer.getPlaybackRate():1}},{key:"setPlaybackRate",value:function(e){this.ytPlayer&&this.ytPlayer.setPlaybackRate(e)}},{key:"duration",value:function(){return this.ytPlayer?this.ytPlayer.getDuration():0}},{key:"currentSrc",value:function(){return this.source&&this.source.src}},{key:"ended",value:function(){return!!this.ytPlayer&&this.lastState===YT.PlayerState.ENDED}},{key:"volume",value:function(){return this.ytPlayer?this.ytPlayer.getVolume()/100:1}},{key:"setVolume",value:function(e){this.ytPlayer&&this.ytPlayer.setVolume(100*e)}},{key:"muted",value:function(){return!!this.ytPlayer&&this.ytPlayer.isMuted()}},{key:"setMuted",value:function(e){this.ytPlayer&&(this.muted(!0),e?this.ytPlayer.mute():this.ytPlayer.unMute(),this.setTimeout((function(){this.trigger("volumechange")}),50))}},{key:"buffered",value:function(){if(!this.ytPlayer||!this.ytPlayer.getVideoLoadedFraction)return i.createTimeRange();var e=this.ytPlayer.getVideoLoadedFraction()*this.ytPlayer.getDuration();return i.createTimeRange(0,e)}},{key:"preload",value:function(){}},{key:"load",value:function(){}},{key:"reset",value:function(){}},{key:"networkState",value:function(){if(!this.ytPlayer)return 0;switch(this.ytPlayer.getPlayerState()){case-1:return 0;case 3:return 2;default:return 1}}},{key:"readyState",value:function(){if(!this.ytPlayer)return 0;switch(this.ytPlayer.getPlayerState()){case-1:return 0;case 5:return 1;case 3:return 2;default:return 4}}},{key:"supportsFullScreen",value:function(){return document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled}},{key:"checkHighResPoster",value:function(){var e="https://img.youtube.com/vi/"+this.url.videoId+"/maxresdefault.jpg";try{var t=new Image;t.onload=function(){if("naturalHeight"in t){if(t.naturalHeight<=90||t.naturalWidth<=120)return}else if(t.height<=90||t.width<=120)return;this.poster_=e,this.trigger("posterchange")}.bind(this),t.onerror=function(){},t.src=e}catch(e){}}}])}(a);function u(){YT.ready((function(){o.isApiReady=!0;for(var e=0;e<o.apiReadyQueue.length;++e)o.apiReadyQueue[e].initYTPlayer()}))}function l(e,t){var i=!1,n=document.createElement("script"),r=document.getElementsByTagName("script")[0];r&&(r.parentNode.insertBefore(n,r),n.onload=function(){i||(i=!0,t())},n.onreadystatechange=function(){i||"complete"!==this.readyState&&"loaded"!==this.readyState||(i=!0,t())},n.src=e)}function c(){var e=".vjs-youtube .vjs-iframe-blocker { display: none; }.vjs-youtube.vjs-user-inactive .vjs-iframe-blocker { display: block; }.vjs-youtube .vjs-poster { background-size: cover; }.vjs-youtube-mobile .vjs-big-play-button { display: none; }",t=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css",i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e)),t.appendChild(i)}o.isSupported=function(){return!0},o.canPlaySource=function(e){return o.canPlayType(e.type)},o.canPlayType=function(e){return"video/youtube"===e},o.parseUrl=function(e){var t={videoId:null},i=/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/,n=e.match(i);n&&11===n[2].length&&(t.videoId=n[2]);var r=/[?&]list=([^#\&\?]+)/;return(n=e.match(r))&&n[1]&&(t.listId=n[1]),t},o.apiReadyQueue=[],"undefined"!=typeof document&&(l("https://www.youtube.com/iframe_api",u),c());void 0!==i.registerTech?i.registerTech("Youtube",o):i.registerComponent("Youtube",o)}(o.default||o)}()}({exports:{}});var gf=function(){return n((function e(i){t(this,e),this.element=i,this.prefix=this.element.dataset.prefix,this.controlsprefix="".concat(this.prefix,"--video--controls"),this.init()}),[{key:"init",value:function(){return this.cacheDomReferences().start().setupHandlers().enable(),this}},{key:"cacheDomReferences",value:function(){return this.VideoElement=this.element.querySelector(".".concat(this.prefix,"--video--element")),this}},{key:"setupHandlers",value:function(){return this}},{key:"enable",value:function(){return this}},{key:"start",value:function(){return this.player=$c(this.VideoElement,{autoplay:!1,controls:!0,preload:"auto",bigPlayButton:!1,controlBar:{descriptionsButton:!1,playbackRateMenuButton:!1,chaptersButton:!1,audioTrackButton:!1,pictureInPictureToggle:!1,subsCapsButton:!1,seekToLive:!1,liveDisplay:!1},textTrackDisplay:!1,liveTracker:!1,errorDisplay:!1,textTrackSettings:!1,resizeManager:!1,sources:[{type:this.element.dataset.vjsType,src:this.element.dataset.src}],dataSetup:{techOrder:["youtube"]}}),this}}])}();Drupal.behaviors.media={attach:function(){Array.prototype.forEach.call(document.querySelectorAll('[data-loadcomponent="Video"]'),(function(e){e.dataset.jsProcessed||(new gf(e),e.dataset.jsProcessed=!0)}))}}}));
|
|
1
|
+
(function () {
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
5
|
+
|
|
6
|
+
function getDefaultExportFromCjs (x) {
|
|
7
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function getAugmentedNamespace(n) {
|
|
11
|
+
var f = n.default;
|
|
12
|
+
if (typeof f == "function") {
|
|
13
|
+
var a = function () {
|
|
14
|
+
return f.apply(this, arguments);
|
|
15
|
+
};
|
|
16
|
+
a.prototype = f.prototype;
|
|
17
|
+
} else a = {};
|
|
18
|
+
Object.defineProperty(a, '__esModule', {value: true});
|
|
19
|
+
Object.keys(n).forEach(function (k) {
|
|
20
|
+
var d = Object.getOwnPropertyDescriptor(n, k);
|
|
21
|
+
Object.defineProperty(a, k, d.get ? d : {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return n[k];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
return a;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
var Youtube = {exports: {}};
|
|
32
|
+
|
|
33
|
+
var win;if(typeof window!=="undefined"){win=window;}else if(typeof commonjsGlobal!=="undefined"){win=commonjsGlobal;}else if(typeof self!=="undefined"){win=self;}else {win={};}var window_1=win;
|
|
34
|
+
|
|
35
|
+
var slice=Array.prototype.slice;var domWalk$2=iterativelyWalk;function iterativelyWalk(nodes,cb){if(!("length"in nodes)){nodes=[nodes];}nodes=slice.call(nodes);while(nodes.length){var node=nodes.shift(),ret=cb(node);if(ret){return ret}if(node.childNodes&&node.childNodes.length){nodes=slice.call(node.childNodes).concat(nodes);}}}
|
|
36
|
+
|
|
37
|
+
var domComment=Comment$2;function Comment$2(data,owner){if(!(this instanceof Comment$2)){return new Comment$2(data,owner)}this.data=data;this.nodeValue=data;this.length=data.length;this.ownerDocument=owner||null;}Comment$2.prototype.nodeType=8;Comment$2.prototype.nodeName="#comment";Comment$2.prototype.toString=function _Comment_toString(){return "[object Comment]"};
|
|
38
|
+
|
|
39
|
+
var domText=DOMText$1;function DOMText$1(value,owner){if(!(this instanceof DOMText$1)){return new DOMText$1(value)}this.data=value||"";this.length=this.data.length;this.ownerDocument=owner||null;}DOMText$1.prototype.type="DOMTextNode";DOMText$1.prototype.nodeType=3;DOMText$1.prototype.nodeName="#text";DOMText$1.prototype.toString=function _Text_toString(){return this.data};DOMText$1.prototype.replaceData=function replaceData(index,length,value){var current=this.data;var left=current.substring(0,index);var right=current.substring(index+length,current.length);this.data=left+value+right;this.length=this.data.length;};
|
|
40
|
+
|
|
41
|
+
var dispatchEvent_1=dispatchEvent$2;function dispatchEvent$2(ev){var elem=this;var type=ev.type;if(!ev.target){ev.target=elem;}if(!elem.listeners){elem.listeners={};}var listeners=elem.listeners[type];if(listeners){return listeners.forEach(function(listener){ev.currentTarget=elem;if(typeof listener==="function"){listener(ev);}else {listener.handleEvent(ev);}})}if(elem.parentNode){elem.parentNode.dispatchEvent(ev);}}
|
|
42
|
+
|
|
43
|
+
var addEventListener_1=addEventListener$2;function addEventListener$2(type,listener){var elem=this;if(!elem.listeners){elem.listeners={};}if(!elem.listeners[type]){elem.listeners[type]=[];}if(elem.listeners[type].indexOf(listener)===-1){elem.listeners[type].push(listener);}}
|
|
44
|
+
|
|
45
|
+
var removeEventListener_1=removeEventListener$2;function removeEventListener$2(type,listener){var elem=this;if(!elem.listeners){return}if(!elem.listeners[type]){return}var list=elem.listeners[type];var index=list.indexOf(listener);if(index!==-1){list.splice(index,1);}}
|
|
46
|
+
|
|
47
|
+
var serialize=serializeNode$1;var voidElements=["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"];function serializeNode$1(node){switch(node.nodeType){case 3:return escapeText(node.data);case 8:return "<!--"+node.data+"-->";default:return serializeElement(node)}}function serializeElement(elem){var strings=[];var tagname=elem.tagName;if(elem.namespaceURI==="http://www.w3.org/1999/xhtml"){tagname=tagname.toLowerCase();}strings.push("<"+tagname+properties(elem)+datasetify(elem));if(voidElements.indexOf(tagname)>-1){strings.push(" />");}else {strings.push(">");if(elem.childNodes.length){strings.push.apply(strings,elem.childNodes.map(serializeNode$1));}else if(elem.textContent||elem.innerText){strings.push(escapeText(elem.textContent||elem.innerText));}else if(elem.innerHTML){strings.push(elem.innerHTML);}strings.push("</"+tagname+">");}return strings.join("")}function isProperty(elem,key){var type=typeof elem[key];if(key==="style"&&Object.keys(elem.style).length>0){return true}return elem.hasOwnProperty(key)&&(type==="string"||type==="boolean"||type==="number")&&key!=="nodeName"&&key!=="className"&&key!=="tagName"&&key!=="textContent"&&key!=="innerText"&&key!=="namespaceURI"&&key!=="innerHTML"}function stylify(styles){if(typeof styles==="string")return styles;var attr="";Object.keys(styles).forEach(function(key){var value=styles[key];key=key.replace(/[A-Z]/g,function(c){return "-"+c.toLowerCase()});attr+=key+":"+value+";";});return attr}function datasetify(elem){var ds=elem.dataset;var props=[];for(var key in ds){props.push({name:"data-"+key,value:ds[key]});}return props.length?stringify(props):""}function stringify(list){var attributes=[];list.forEach(function(tuple){var name=tuple.name;var value=tuple.value;if(name==="style"){value=stylify(value);}attributes.push(name+"="+'"'+escapeAttributeValue(value)+'"');});return attributes.length?" "+attributes.join(" "):""}function properties(elem){var props=[];for(var key in elem){if(isProperty(elem,key)){props.push({name:key,value:elem[key]});}}for(var ns in elem._attributes){for(var attribute in elem._attributes[ns]){var prop=elem._attributes[ns][attribute];var name=(prop.prefix?prop.prefix+":":"")+attribute;props.push({name:name,value:prop.value});}}if(elem.className){props.push({name:"class",value:elem.className});}return props.length?stringify(props):""}function escapeText(s){var str="";if(typeof s==="string"){str=s;}else if(s){str=s.toString();}return str.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function escapeAttributeValue(str){return escapeText(str).replace(/"/g,""")}
|
|
48
|
+
|
|
49
|
+
var domWalk$1=domWalk$2;var dispatchEvent$1=dispatchEvent_1;var addEventListener$1=addEventListener_1;var removeEventListener$1=removeEventListener_1;var serializeNode=serialize;var htmlns="http://www.w3.org/1999/xhtml";var domElement=DOMElement$2;function DOMElement$2(tagName,owner,namespace){if(!(this instanceof DOMElement$2)){return new DOMElement$2(tagName)}var ns=namespace===undefined?htmlns:namespace||null;this.tagName=ns===htmlns?String(tagName).toUpperCase():tagName;this.nodeName=this.tagName;this.className="";this.dataset={};this.childNodes=[];this.parentNode=null;this.style={};this.ownerDocument=owner||null;this.namespaceURI=ns;this._attributes={};if(this.tagName==="INPUT"){this.type="text";}}DOMElement$2.prototype.type="DOMElement";DOMElement$2.prototype.nodeType=1;DOMElement$2.prototype.appendChild=function _Element_appendChild(child){if(child.parentNode){child.parentNode.removeChild(child);}this.childNodes.push(child);child.parentNode=this;return child};DOMElement$2.prototype.replaceChild=function _Element_replaceChild(elem,needle){if(elem.parentNode){elem.parentNode.removeChild(elem);}var index=this.childNodes.indexOf(needle);needle.parentNode=null;this.childNodes[index]=elem;elem.parentNode=this;return needle};DOMElement$2.prototype.removeChild=function _Element_removeChild(elem){var index=this.childNodes.indexOf(elem);this.childNodes.splice(index,1);elem.parentNode=null;return elem};DOMElement$2.prototype.insertBefore=function _Element_insertBefore(elem,needle){if(elem.parentNode){elem.parentNode.removeChild(elem);}var index=needle===null||needle===undefined?-1:this.childNodes.indexOf(needle);if(index>-1){this.childNodes.splice(index,0,elem);}else {this.childNodes.push(elem);}elem.parentNode=this;return elem};DOMElement$2.prototype.setAttributeNS=function _Element_setAttributeNS(namespace,name,value){var prefix=null;var localName=name;var colonPosition=name.indexOf(":");if(colonPosition>-1){prefix=name.substr(0,colonPosition);localName=name.substr(colonPosition+1);}if(this.tagName==="INPUT"&&name==="type"){this.type=value;}else {var attributes=this._attributes[namespace]||(this._attributes[namespace]={});attributes[localName]={value:value,prefix:prefix};}};DOMElement$2.prototype.getAttributeNS=function _Element_getAttributeNS(namespace,name){var attributes=this._attributes[namespace];var value=attributes&&attributes[name]&&attributes[name].value;if(this.tagName==="INPUT"&&name==="type"){return this.type}if(typeof value!=="string"){return null}return value};DOMElement$2.prototype.removeAttributeNS=function _Element_removeAttributeNS(namespace,name){var attributes=this._attributes[namespace];if(attributes){delete attributes[name];}};DOMElement$2.prototype.hasAttributeNS=function _Element_hasAttributeNS(namespace,name){var attributes=this._attributes[namespace];return !!attributes&&name in attributes};DOMElement$2.prototype.setAttribute=function _Element_setAttribute(name,value){return this.setAttributeNS(null,name,value)};DOMElement$2.prototype.getAttribute=function _Element_getAttribute(name){return this.getAttributeNS(null,name)};DOMElement$2.prototype.removeAttribute=function _Element_removeAttribute(name){return this.removeAttributeNS(null,name)};DOMElement$2.prototype.hasAttribute=function _Element_hasAttribute(name){return this.hasAttributeNS(null,name)};DOMElement$2.prototype.removeEventListener=removeEventListener$1;DOMElement$2.prototype.addEventListener=addEventListener$1;DOMElement$2.prototype.dispatchEvent=dispatchEvent$1;DOMElement$2.prototype.focus=function _Element_focus(){return void 0};DOMElement$2.prototype.toString=function _Element_toString(){return serializeNode(this)};DOMElement$2.prototype.getElementsByClassName=function _Element_getElementsByClassName(classNames){var classes=classNames.split(" ");var elems=[];domWalk$1(this,function(node){if(node.nodeType===1){var nodeClassName=node.className||"";var nodeClasses=nodeClassName.split(" ");if(classes.every(function(item){return nodeClasses.indexOf(item)!==-1})){elems.push(node);}}});return elems};DOMElement$2.prototype.getElementsByTagName=function _Element_getElementsByTagName(tagName){tagName=tagName.toLowerCase();var elems=[];domWalk$1(this.childNodes,function(node){if(node.nodeType===1&&(tagName==="*"||node.tagName.toLowerCase()===tagName)){elems.push(node);}});return elems};DOMElement$2.prototype.contains=function _Element_contains(element){return domWalk$1(this,function(node){return element===node})||false};
|
|
50
|
+
|
|
51
|
+
var DOMElement$1=domElement;var domFragment=DocumentFragment$2;function DocumentFragment$2(owner){if(!(this instanceof DocumentFragment$2)){return new DocumentFragment$2}this.childNodes=[];this.parentNode=null;this.ownerDocument=owner||null;}DocumentFragment$2.prototype.type="DocumentFragment";DocumentFragment$2.prototype.nodeType=11;DocumentFragment$2.prototype.nodeName="#document-fragment";DocumentFragment$2.prototype.appendChild=DOMElement$1.prototype.appendChild;DocumentFragment$2.prototype.replaceChild=DOMElement$1.prototype.replaceChild;DocumentFragment$2.prototype.removeChild=DOMElement$1.prototype.removeChild;DocumentFragment$2.prototype.toString=function _DocumentFragment_toString(){return this.childNodes.map(function(node){return String(node)}).join("")};
|
|
52
|
+
|
|
53
|
+
var event$1=Event$1;function Event$1(family){}Event$1.prototype.initEvent=function _Event_initEvent(type,bubbles,cancelable){this.type=type;this.bubbles=bubbles;this.cancelable=cancelable;};Event$1.prototype.preventDefault=function _Event_preventDefault(){};
|
|
54
|
+
|
|
55
|
+
var domWalk=domWalk$2;var Comment$1=domComment;var DOMText=domText;var DOMElement=domElement;var DocumentFragment$1=domFragment;var Event=event$1;var dispatchEvent=dispatchEvent_1;var addEventListener=addEventListener_1;var removeEventListener=removeEventListener_1;var document$2=Document$2;function Document$2(){if(!(this instanceof Document$2)){return new Document$2}this.head=this.createElement("head");this.body=this.createElement("body");this.documentElement=this.createElement("html");this.documentElement.appendChild(this.head);this.documentElement.appendChild(this.body);this.childNodes=[this.documentElement];this.nodeType=9;}var proto=Document$2.prototype;proto.createTextNode=function createTextNode(value){return new DOMText(value,this)};proto.createElementNS=function createElementNS(namespace,tagName){var ns=namespace===null?null:String(namespace);return new DOMElement(tagName,this,ns)};proto.createElement=function createElement(tagName){return new DOMElement(tagName,this)};proto.createDocumentFragment=function createDocumentFragment(){return new DocumentFragment$1(this)};proto.createEvent=function createEvent(family){return new Event()};proto.createComment=function createComment(data){return new Comment$1(data,this)};proto.getElementById=function getElementById(id){id=String(id);var result=domWalk(this.childNodes,function(node){if(String(node.id)===id){return node}});return result||null};proto.getElementsByClassName=DOMElement.prototype.getElementsByClassName;proto.getElementsByTagName=DOMElement.prototype.getElementsByTagName;proto.contains=DOMElement.prototype.contains;proto.removeEventListener=removeEventListener;proto.addEventListener=addEventListener;proto.dispatchEvent=dispatchEvent;
|
|
56
|
+
|
|
57
|
+
var Document$1=document$2;var minDocument=new Document$1;
|
|
58
|
+
|
|
59
|
+
var topLevel=typeof commonjsGlobal!=="undefined"?commonjsGlobal:typeof window!=="undefined"?window:{};var minDoc=minDocument;var doccy;if(typeof document!=="undefined"){doccy=document;}else {doccy=topLevel["__GLOBAL_DOCUMENT_CACHE@4"];if(!doccy){doccy=topLevel["__GLOBAL_DOCUMENT_CACHE@4"]=minDoc;}}var document_1=doccy;
|
|
60
|
+
|
|
61
|
+
function _extends$3(){return _extends$3=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)({}).hasOwnProperty.call(t,r)&&(n[r]=t[r]);}return n},_extends$3.apply(null,arguments)}
|
|
62
|
+
|
|
63
|
+
var keycode$1 = {exports: {}};
|
|
64
|
+
|
|
65
|
+
(function(module,exports){function keyCode(searchInput){if(searchInput&&"object"===typeof searchInput){var hasKeyCode=searchInput.which||searchInput.keyCode||searchInput.charCode;if(hasKeyCode)searchInput=hasKeyCode;}if("number"===typeof searchInput)return names[searchInput];var search=String(searchInput);var foundNamedKey=codes[search.toLowerCase()];if(foundNamedKey)return foundNamedKey;var foundNamedKey=aliases[search.toLowerCase()];if(foundNamedKey)return foundNamedKey;if(search.length===1)return search.charCodeAt(0);return undefined}keyCode.isEventKey=function isEventKey(event,nameOrCode){if(event&&"object"===typeof event){var keyCode=event.which||event.keyCode||event.charCode;if(keyCode===null||keyCode===undefined){return false}if(typeof nameOrCode==="string"){var foundNamedKey=codes[nameOrCode.toLowerCase()];if(foundNamedKey){return foundNamedKey===keyCode}var foundNamedKey=aliases[nameOrCode.toLowerCase()];if(foundNamedKey){return foundNamedKey===keyCode}}else if(typeof nameOrCode==="number"){return nameOrCode===keyCode}return false}};exports=module.exports=keyCode;var codes=exports.code=exports.codes={"backspace":8,"tab":9,"enter":13,"shift":16,"ctrl":17,"alt":18,"pause/break":19,"caps lock":20,"esc":27,"space":32,"page up":33,"page down":34,"end":35,"home":36,"left":37,"up":38,"right":39,"down":40,"insert":45,"delete":46,"command":91,"left command":91,"right command":93,"numpad *":106,"numpad +":107,"numpad -":109,"numpad .":110,"numpad /":111,"num lock":144,"scroll lock":145,"my computer":182,"my calculator":183,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222};var aliases=exports.aliases={"windows":91,"⇧":16,"⌥":18,"⌃":17,"⌘":91,"ctl":17,"control":17,"option":18,"pause":19,"break":19,"caps":20,"return":13,"escape":27,"spc":32,"spacebar":32,"pgup":33,"pgdn":34,"ins":45,"del":46,"cmd":91};/*!
|
|
66
|
+
* Programatically add the following
|
|
67
|
+
*/for(i=97;i<123;i++)codes[String.fromCharCode(i)]=i-32;for(var i=48;i<58;i++)codes[i-48]=i;for(i=1;i<13;i++)codes["f"+i]=i+111;for(i=0;i<10;i++)codes["numpad "+i]=i+96;var names=exports.names=exports.title={};for(i in codes)names[codes[i]]=i;for(var alias in aliases){codes[alias]=aliases[alias];}})(keycode$1,keycode$1.exports);var keycode = keycode$1.exports;
|
|
68
|
+
|
|
69
|
+
function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}
|
|
70
|
+
|
|
71
|
+
function _setPrototypeOf(t,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},_setPrototypeOf(t,e)}
|
|
72
|
+
|
|
73
|
+
function _inheritsLoose(t,o){t.prototype=Object.create(o.prototype),t.prototype.constructor=t,_setPrototypeOf(t,o);}
|
|
74
|
+
|
|
75
|
+
var tuple=SafeParseTuple;function SafeParseTuple(obj,reviver){var json;var error=null;try{json=JSON.parse(obj,reviver);}catch(err){error=err;}return [error,json]}
|
|
76
|
+
|
|
77
|
+
var lib = {exports: {}};
|
|
78
|
+
|
|
79
|
+
var _extends$2 = {exports: {}};
|
|
80
|
+
|
|
81
|
+
(function(module){function _extends(){return module.exports=_extends=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)({}).hasOwnProperty.call(t,r)&&(n[r]=t[r]);}return n},module.exports.__esModule=true,module.exports["default"]=module.exports,_extends.apply(null,arguments)}module.exports=_extends,module.exports.__esModule=true,module.exports["default"]=module.exports;})(_extends$2);getDefaultExportFromCjs(_extends$2.exports);
|
|
82
|
+
|
|
83
|
+
var isFunction_1=isFunction$1;var toString$1=Object.prototype.toString;function isFunction$1(fn){if(!fn){return false}var string=toString$1.call(fn);return string==="[object Function]"||typeof fn==="function"&&string!=="[object RegExp]"||typeof window!=="undefined"&&(fn===window.setTimeout||fn===window.alert||fn===window.confirm||fn===window.prompt)}
|
|
84
|
+
|
|
85
|
+
var window$3=window_1;var httpResponseHandler=function httpResponseHandler(callback,decodeResponseBody){if(decodeResponseBody===void 0){decodeResponseBody=false;}return function(err,response,responseBody){if(err){callback(err);return}if(response.statusCode>=400&&response.statusCode<=599){var cause=responseBody;if(decodeResponseBody){if(window$3.TextDecoder){var charset=getCharset(response.headers&&response.headers["content-type"]);try{cause=new TextDecoder(charset).decode(responseBody);}catch(e){}}else {cause=String.fromCharCode.apply(null,new Uint8Array(responseBody));}}callback({cause:cause});return}callback(null,responseBody);}};function getCharset(contentTypeHeader){if(contentTypeHeader===void 0){contentTypeHeader="";}return contentTypeHeader.toLowerCase().split(";").reduce(function(charset,contentType){var _contentType$split=contentType.split("="),type=_contentType$split[0],value=_contentType$split[1];if(type.trim()==="charset"){return value.trim()}return charset},"utf-8")}var httpHandler=httpResponseHandler;
|
|
86
|
+
|
|
87
|
+
var window$2=window_1;var _extends$1=_extends$2.exports;var isFunction=isFunction_1;createXHR.httpHandler=httpHandler;/**
|
|
88
|
+
* @license
|
|
89
|
+
* slighly modified parse-headers 2.0.2 <https://github.com/kesla/parse-headers/>
|
|
90
|
+
* Copyright (c) 2014 David Björklund
|
|
91
|
+
* Available under the MIT license
|
|
92
|
+
* <https://github.com/kesla/parse-headers/blob/master/LICENCE>
|
|
93
|
+
*/var parseHeaders=function parseHeaders(headers){var result={};if(!headers){return result}headers.trim().split("\n").forEach(function(row){var index=row.indexOf(":");var key=row.slice(0,index).trim().toLowerCase();var value=row.slice(index+1).trim();if(typeof result[key]==="undefined"){result[key]=value;}else if(Array.isArray(result[key])){result[key].push(value);}else {result[key]=[result[key],value];}});return result};lib.exports=createXHR;lib.exports.default=createXHR;createXHR.XMLHttpRequest=window$2.XMLHttpRequest||noop$1;createXHR.XDomainRequest="withCredentials"in new createXHR.XMLHttpRequest?createXHR.XMLHttpRequest:window$2.XDomainRequest;forEachArray(["get","put","post","patch","head","delete"],function(method){createXHR[method==="delete"?"del":method]=function(uri,options,callback){options=initParams(uri,options,callback);options.method=method.toUpperCase();return _createXHR(options)};});function forEachArray(array,iterator){for(var i=0;i<array.length;i++){iterator(array[i]);}}function isEmpty(obj){for(var i in obj){if(obj.hasOwnProperty(i))return false}return true}function initParams(uri,options,callback){var params=uri;if(isFunction(options)){callback=options;if(typeof uri==="string"){params={uri:uri};}}else {params=_extends$1({},options,{uri:uri});}params.callback=callback;return params}function createXHR(uri,options,callback){options=initParams(uri,options,callback);return _createXHR(options)}function _createXHR(options){if(typeof options.callback==="undefined"){throw new Error("callback argument missing")}var called=false;var callback=function cbOnce(err,response,body){if(!called){called=true;options.callback(err,response,body);}};function readystatechange(){if(xhr.readyState===4){setTimeout(loadFunc,0);}}function getBody(){var body=undefined;if(xhr.response){body=xhr.response;}else {body=xhr.responseText||getXml(xhr);}if(isJson){try{body=JSON.parse(body);}catch(e){}}return body}function errorFunc(evt){clearTimeout(timeoutTimer);if(!(evt instanceof Error)){evt=new Error(""+(evt||"Unknown XMLHttpRequest Error"));}evt.statusCode=0;return callback(evt,failureResponse)}function loadFunc(){if(aborted)return;var status;clearTimeout(timeoutTimer);if(options.useXDR&&xhr.status===undefined){status=200;}else {status=xhr.status===1223?204:xhr.status;}var response=failureResponse;var err=null;if(status!==0){response={body:getBody(),statusCode:status,method:method,headers:{},url:uri,rawRequest:xhr};if(xhr.getAllResponseHeaders){response.headers=parseHeaders(xhr.getAllResponseHeaders());}}else {err=new Error("Internal XMLHttpRequest Error");}return callback(err,response,response.body)}var xhr=options.xhr||null;if(!xhr){if(options.cors||options.useXDR){xhr=new createXHR.XDomainRequest;}else {xhr=new createXHR.XMLHttpRequest;}}var key;var aborted;var uri=xhr.url=options.uri||options.url;var method=xhr.method=options.method||"GET";var body=options.body||options.data;var headers=xhr.headers=options.headers||{};var sync=!!options.sync;var isJson=false;var timeoutTimer;var failureResponse={body:undefined,headers:{},statusCode:0,method:method,url:uri,rawRequest:xhr};if("json"in options&&options.json!==false){isJson=true;headers["accept"]||headers["Accept"]||(headers["Accept"]="application/json");if(method!=="GET"&&method!=="HEAD"){headers["content-type"]||headers["Content-Type"]||(headers["Content-Type"]="application/json");body=JSON.stringify(options.json===true?body:options.json);}}xhr.onreadystatechange=readystatechange;xhr.onload=loadFunc;xhr.onerror=errorFunc;xhr.onprogress=function(){};xhr.onabort=function(){aborted=true;};xhr.ontimeout=errorFunc;xhr.open(method,uri,!sync,options.username,options.password);if(!sync){xhr.withCredentials=!!options.withCredentials;}if(!sync&&options.timeout>0){timeoutTimer=setTimeout(function(){if(aborted)return;aborted=true;xhr.abort("timeout");var e=new Error("XMLHttpRequest timeout");e.code="ETIMEDOUT";errorFunc(e);},options.timeout);}if(xhr.setRequestHeader){for(key in headers){if(headers.hasOwnProperty(key)){xhr.setRequestHeader(key,headers[key]);}}}else if(options.headers&&!isEmpty(options.headers)){throw new Error("Headers cannot be set on an XDomainRequest object")}if("responseType"in options){xhr.responseType=options.responseType;}if("beforeSend"in options&&typeof options.beforeSend==="function"){options.beforeSend(xhr);}xhr.send(body||null);return xhr}function getXml(xhr){try{if(xhr.responseType==="document"){return xhr.responseXML}var firefoxBugTakenEffect=xhr.responseXML&&xhr.responseXML.documentElement.nodeName==="parsererror";if(xhr.responseType===""&&!firefoxBugTakenEffect){return xhr.responseXML}}catch(e){}return null}function noop$1(){}
|
|
94
|
+
|
|
95
|
+
var browserIndex = {exports: {}};
|
|
96
|
+
|
|
97
|
+
var document$1=document_1;var _objCreate=Object.create||function(){function F(){}return function(o){if(arguments.length!==1){throw new Error("Object.create shim only accepts one parameter.")}F.prototype=o;return new F}}();function ParsingError(errorData,message){this.name="ParsingError";this.code=errorData.code;this.message=message||errorData.message;}ParsingError.prototype=_objCreate(Error.prototype);ParsingError.prototype.constructor=ParsingError;ParsingError.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}};function parseTimeStamp(input){function computeSeconds(h,m,s,f){return (h|0)*3600+(m|0)*60+(s|0)+(f|0)/1e3}var m=input.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);if(!m){return null}if(m[3]){return computeSeconds(m[1],m[2],m[3].replace(":",""),m[4])}else if(m[1]>59){return computeSeconds(m[1],m[2],0,m[4])}else {return computeSeconds(0,m[1],m[2],m[4])}}function Settings(){this.values=_objCreate(null);}Settings.prototype={set:function(k,v){if(!this.get(k)&&v!==""){this.values[k]=v;}},get:function(k,dflt,defaultKey){if(defaultKey){return this.has(k)?this.values[k]:dflt[defaultKey]}return this.has(k)?this.values[k]:dflt},has:function(k){return k in this.values},alt:function(k,v,a){for(var n=0;n<a.length;++n){if(v===a[n]){this.set(k,v);break}}},integer:function(k,v){if(/^-?\d+$/.test(v)){this.set(k,parseInt(v,10));}},percent:function(k,v){if(v.match(/^([\d]{1,3})(\.[\d]*)?%$/)){v=parseFloat(v);if(v>=0&&v<=100){this.set(k,v);return true}}return false}};function parseOptions(input,callback,keyValueDelim,groupDelim){var groups=groupDelim?input.split(groupDelim):[input];for(var i in groups){if(typeof groups[i]!=="string"){continue}var kv=groups[i].split(keyValueDelim);if(kv.length!==2){continue}var k=kv[0].trim();var v=kv[1].trim();callback(k,v);}}function parseCue(input,cue,regionList){var oInput=input;function consumeTimeStamp(){var ts=parseTimeStamp(input);if(ts===null){throw new ParsingError(ParsingError.Errors.BadTimeStamp,"Malformed timestamp: "+oInput)}input=input.replace(/^[^\sa-zA-Z-]+/,"");return ts}function consumeCueSettings(input,cue){var settings=new Settings;parseOptions(input,function(k,v){switch(k){case"region":for(var i=regionList.length-1;i>=0;i--){if(regionList[i].id===v){settings.set(k,regionList[i].region);break}}break;case"vertical":settings.alt(k,v,["rl","lr"]);break;case"line":var vals=v.split(","),vals0=vals[0];settings.integer(k,vals0);settings.percent(k,vals0)?settings.set("snapToLines",false):null;settings.alt(k,vals0,["auto"]);if(vals.length===2){settings.alt("lineAlign",vals[1],["start","center","end"]);}break;case"position":vals=v.split(",");settings.percent(k,vals[0]);if(vals.length===2){settings.alt("positionAlign",vals[1],["start","center","end"]);}break;case"size":settings.percent(k,v);break;case"align":settings.alt(k,v,["start","center","end","left","right"]);break}},/:/,/\s/);cue.region=settings.get("region",null);cue.vertical=settings.get("vertical","");try{cue.line=settings.get("line","auto");}catch(e){}cue.lineAlign=settings.get("lineAlign","start");cue.snapToLines=settings.get("snapToLines",true);cue.size=settings.get("size",100);try{cue.align=settings.get("align","center");}catch(e){cue.align=settings.get("align","middle");}try{cue.position=settings.get("position","auto");}catch(e){cue.position=settings.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},cue.align);}cue.positionAlign=settings.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},cue.align);}function skipWhitespace(){input=input.replace(/^\s+/,"");}skipWhitespace();cue.startTime=consumeTimeStamp();skipWhitespace();if(input.substr(0,3)!=="-->"){throw new ParsingError(ParsingError.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '-->'): "+oInput)}input=input.substr(3);skipWhitespace();cue.endTime=consumeTimeStamp();skipWhitespace();consumeCueSettings(input,cue);}var TEXTAREA_ELEMENT=document$1.createElement&&document$1.createElement("textarea");var TAG_NAME={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"};var DEFAULT_COLOR_CLASS={white:"rgba(255,255,255,1)",lime:"rgba(0,255,0,1)",cyan:"rgba(0,255,255,1)",red:"rgba(255,0,0,1)",yellow:"rgba(255,255,0,1)",magenta:"rgba(255,0,255,1)",blue:"rgba(0,0,255,1)",black:"rgba(0,0,0,1)"};var TAG_ANNOTATION={v:"title",lang:"lang"};var NEEDS_PARENT={rt:"ruby"};function parseContent(window,input){function nextToken(){if(!input){return null}function consume(result){input=input.substr(result.length);return result}var m=input.match(/^([^<]*)(<[^>]*>?)?/);return consume(m[1]?m[1]:m[2])}function unescape(s){TEXTAREA_ELEMENT.innerHTML=s;s=TEXTAREA_ELEMENT.textContent;TEXTAREA_ELEMENT.textContent="";return s}function shouldAdd(current,element){return !NEEDS_PARENT[element.localName]||NEEDS_PARENT[element.localName]===current.localName}function createElement(type,annotation){var tagName=TAG_NAME[type];if(!tagName){return null}var element=window.document.createElement(tagName);var name=TAG_ANNOTATION[type];if(name&&annotation){element[name]=annotation.trim();}return element}var rootDiv=window.document.createElement("div"),current=rootDiv,t,tagStack=[];while((t=nextToken())!==null){if(t[0]==="<"){if(t[1]==="/"){if(tagStack.length&&tagStack[tagStack.length-1]===t.substr(2).replace(">","")){tagStack.pop();current=current.parentNode;}continue}var ts=parseTimeStamp(t.substr(1,t.length-2));var node;if(ts){node=window.document.createProcessingInstruction("timestamp",ts);current.appendChild(node);continue}var m=t.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!m){continue}node=createElement(m[1],m[3]);if(!node){continue}if(!shouldAdd(current,node)){continue}if(m[2]){var classes=m[2].split(".");classes.forEach(function(cl){var bgColor=/^bg_/.test(cl);var colorName=bgColor?cl.slice(3):cl;if(DEFAULT_COLOR_CLASS.hasOwnProperty(colorName)){var propName=bgColor?"background-color":"color";var propValue=DEFAULT_COLOR_CLASS[colorName];node.style[propName]=propValue;}});node.className=classes.join(" ");}tagStack.push(m[1]);current.appendChild(node);current=node;continue}current.appendChild(window.document.createTextNode(unescape(t)));}return rootDiv}var strongRTLRanges=[[1470,1470],[1472,1472],[1475,1475],[1478,1478],[1488,1514],[1520,1524],[1544,1544],[1547,1547],[1549,1549],[1563,1563],[1566,1610],[1645,1647],[1649,1749],[1765,1766],[1774,1775],[1786,1805],[1807,1808],[1810,1839],[1869,1957],[1969,1969],[1984,2026],[2036,2037],[2042,2042],[2048,2069],[2074,2074],[2084,2084],[2088,2088],[2096,2110],[2112,2136],[2142,2142],[2208,2208],[2210,2220],[8207,8207],[64285,64285],[64287,64296],[64298,64310],[64312,64316],[64318,64318],[64320,64321],[64323,64324],[64326,64449],[64467,64829],[64848,64911],[64914,64967],[65008,65020],[65136,65140],[65142,65276],[67584,67589],[67592,67592],[67594,67637],[67639,67640],[67644,67644],[67647,67669],[67671,67679],[67840,67867],[67872,67897],[67903,67903],[67968,68023],[68030,68031],[68096,68096],[68112,68115],[68117,68119],[68121,68147],[68160,68167],[68176,68184],[68192,68223],[68352,68405],[68416,68437],[68440,68466],[68472,68479],[68608,68680],[126464,126467],[126469,126495],[126497,126498],[126500,126500],[126503,126503],[126505,126514],[126516,126519],[126521,126521],[126523,126523],[126530,126530],[126535,126535],[126537,126537],[126539,126539],[126541,126543],[126545,126546],[126548,126548],[126551,126551],[126553,126553],[126555,126555],[126557,126557],[126559,126559],[126561,126562],[126564,126564],[126567,126570],[126572,126578],[126580,126583],[126585,126588],[126590,126590],[126592,126601],[126603,126619],[126625,126627],[126629,126633],[126635,126651],[1114109,1114109]];function isStrongRTLChar(charCode){for(var i=0;i<strongRTLRanges.length;i++){var currentRange=strongRTLRanges[i];if(charCode>=currentRange[0]&&charCode<=currentRange[1]){return true}}return false}function determineBidi(cueDiv){var nodeStack=[],text="",charCode;if(!cueDiv||!cueDiv.childNodes){return "ltr"}function pushNodes(nodeStack,node){for(var i=node.childNodes.length-1;i>=0;i--){nodeStack.push(node.childNodes[i]);}}function nextTextNode(nodeStack){if(!nodeStack||!nodeStack.length){return null}var node=nodeStack.pop(),text=node.textContent||node.innerText;if(text){var m=text.match(/^.*(\n|\r)/);if(m){nodeStack.length=0;return m[0]}return text}if(node.tagName==="ruby"){return nextTextNode(nodeStack)}if(node.childNodes){pushNodes(nodeStack,node);return nextTextNode(nodeStack)}}pushNodes(nodeStack,cueDiv);while(text=nextTextNode(nodeStack)){for(var i=0;i<text.length;i++){charCode=text.charCodeAt(i);if(isStrongRTLChar(charCode)){return "rtl"}}}return "ltr"}function computeLinePos(cue){if(typeof cue.line==="number"&&(cue.snapToLines||cue.line>=0&&cue.line<=100)){return cue.line}if(!cue.track||!cue.track.textTrackList||!cue.track.textTrackList.mediaElement){return -1}var track=cue.track,trackList=track.textTrackList,count=0;for(var i=0;i<trackList.length&&trackList[i]!==track;i++){if(trackList[i].mode==="showing"){count++;}}return ++count*-1}function StyleBox(){}StyleBox.prototype.applyStyles=function(styles,div){div=div||this.div;for(var prop in styles){if(styles.hasOwnProperty(prop)){div.style[prop]=styles[prop];}}};StyleBox.prototype.formatStyle=function(val,unit){return val===0?0:val+unit};function CueStyleBox(window,cue,styleOptions){StyleBox.call(this);this.cue=cue;this.cueDiv=parseContent(window,cue.text);var styles={color:"rgba(255, 255, 255, 1)",backgroundColor:"rgba(0, 0, 0, 0.8)",position:"relative",left:0,right:0,top:0,bottom:0,display:"inline",writingMode:cue.vertical===""?"horizontal-tb":cue.vertical==="lr"?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext"};this.applyStyles(styles,this.cueDiv);this.div=window.document.createElement("div");styles={direction:determineBidi(this.cueDiv),writingMode:cue.vertical===""?"horizontal-tb":cue.vertical==="lr"?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext",textAlign:cue.align==="middle"?"center":cue.align,font:styleOptions.font,whiteSpace:"pre-line",position:"absolute"};this.applyStyles(styles);this.div.appendChild(this.cueDiv);var textPos=0;switch(cue.positionAlign){case"start":case"line-left":textPos=cue.position;break;case"center":textPos=cue.position-cue.size/2;break;case"end":case"line-right":textPos=cue.position-cue.size;break}if(cue.vertical===""){this.applyStyles({left:this.formatStyle(textPos,"%"),width:this.formatStyle(cue.size,"%")});}else {this.applyStyles({top:this.formatStyle(textPos,"%"),height:this.formatStyle(cue.size,"%")});}this.move=function(box){this.applyStyles({top:this.formatStyle(box.top,"px"),bottom:this.formatStyle(box.bottom,"px"),left:this.formatStyle(box.left,"px"),right:this.formatStyle(box.right,"px"),height:this.formatStyle(box.height,"px"),width:this.formatStyle(box.width,"px")});};}CueStyleBox.prototype=_objCreate(StyleBox.prototype);CueStyleBox.prototype.constructor=CueStyleBox;function BoxPosition(obj){var lh,height,width,top;if(obj.div){height=obj.div.offsetHeight;width=obj.div.offsetWidth;top=obj.div.offsetTop;var rects=(rects=obj.div.childNodes)&&(rects=rects[0])&&rects.getClientRects&&rects.getClientRects();obj=obj.div.getBoundingClientRect();lh=rects?Math.max(rects[0]&&rects[0].height||0,obj.height/rects.length):0;}this.left=obj.left;this.right=obj.right;this.top=obj.top||top;this.height=obj.height||height;this.bottom=obj.bottom||top+(obj.height||height);this.width=obj.width||width;this.lineHeight=lh!==undefined?lh:obj.lineHeight;}BoxPosition.prototype.move=function(axis,toMove){toMove=toMove!==undefined?toMove:this.lineHeight;switch(axis){case"+x":this.left+=toMove;this.right+=toMove;break;case"-x":this.left-=toMove;this.right-=toMove;break;case"+y":this.top+=toMove;this.bottom+=toMove;break;case"-y":this.top-=toMove;this.bottom-=toMove;break}};BoxPosition.prototype.overlaps=function(b2){return this.left<b2.right&&this.right>b2.left&&this.top<b2.bottom&&this.bottom>b2.top};BoxPosition.prototype.overlapsAny=function(boxes){for(var i=0;i<boxes.length;i++){if(this.overlaps(boxes[i])){return true}}return false};BoxPosition.prototype.within=function(container){return this.top>=container.top&&this.bottom<=container.bottom&&this.left>=container.left&&this.right<=container.right};BoxPosition.prototype.overlapsOppositeAxis=function(container,axis){switch(axis){case"+x":return this.left<container.left;case"-x":return this.right>container.right;case"+y":return this.top<container.top;case"-y":return this.bottom>container.bottom}};BoxPosition.prototype.intersectPercentage=function(b2){var x=Math.max(0,Math.min(this.right,b2.right)-Math.max(this.left,b2.left)),y=Math.max(0,Math.min(this.bottom,b2.bottom)-Math.max(this.top,b2.top)),intersectArea=x*y;return intersectArea/(this.height*this.width)};BoxPosition.prototype.toCSSCompatValues=function(reference){return {top:this.top-reference.top,bottom:reference.bottom-this.bottom,left:this.left-reference.left,right:reference.right-this.right,height:this.height,width:this.width}};BoxPosition.getSimpleBoxPosition=function(obj){var height=obj.div?obj.div.offsetHeight:obj.tagName?obj.offsetHeight:0;var width=obj.div?obj.div.offsetWidth:obj.tagName?obj.offsetWidth:0;var top=obj.div?obj.div.offsetTop:obj.tagName?obj.offsetTop:0;obj=obj.div?obj.div.getBoundingClientRect():obj.tagName?obj.getBoundingClientRect():obj;var ret={left:obj.left,right:obj.right,top:obj.top||top,height:obj.height||height,bottom:obj.bottom||top+(obj.height||height),width:obj.width||width};return ret};function moveBoxToLinePosition(window,styleBox,containerBox,boxPositions){function findBestPosition(b,axis){var bestPosition,specifiedPosition=new BoxPosition(b),percentage=1;for(var i=0;i<axis.length;i++){while(b.overlapsOppositeAxis(containerBox,axis[i])||b.within(containerBox)&&b.overlapsAny(boxPositions)){b.move(axis[i]);}if(b.within(containerBox)){return b}var p=b.intersectPercentage(containerBox);if(percentage>p){bestPosition=new BoxPosition(b);percentage=p;}b=new BoxPosition(specifiedPosition);}return bestPosition||specifiedPosition}var boxPosition=new BoxPosition(styleBox),cue=styleBox.cue,linePos=computeLinePos(cue),axis=[];if(cue.snapToLines){var size;switch(cue.vertical){case"":axis=["+y","-y"];size="height";break;case"rl":axis=["+x","-x"];size="width";break;case"lr":axis=["-x","+x"];size="width";break}var step=boxPosition.lineHeight,position=step*Math.round(linePos),maxPosition=containerBox[size]+step,initialAxis=axis[0];if(Math.abs(position)>maxPosition){position=position<0?-1:1;position*=Math.ceil(maxPosition/step)*step;}if(linePos<0){position+=cue.vertical===""?containerBox.height:containerBox.width;axis=axis.reverse();}boxPosition.move(initialAxis,position);}else {var calculatedPercentage=boxPosition.lineHeight/containerBox.height*100;switch(cue.lineAlign){case"center":linePos-=calculatedPercentage/2;break;case"end":linePos-=calculatedPercentage;break}switch(cue.vertical){case"":styleBox.applyStyles({top:styleBox.formatStyle(linePos,"%")});break;case"rl":styleBox.applyStyles({left:styleBox.formatStyle(linePos,"%")});break;case"lr":styleBox.applyStyles({right:styleBox.formatStyle(linePos,"%")});break}axis=["+y","-x","+x","-y"];boxPosition=new BoxPosition(styleBox);}var bestPosition=findBestPosition(boxPosition,axis);styleBox.move(bestPosition.toCSSCompatValues(containerBox));}function WebVTT$1(){}WebVTT$1.StringDecoder=function(){return {decode:function(data){if(!data){return ""}if(typeof data!=="string"){throw new Error("Error - expected string data.")}return decodeURIComponent(encodeURIComponent(data))}}};WebVTT$1.convertCueToDOMTree=function(window,cuetext){if(!window||!cuetext){return null}return parseContent(window,cuetext)};var FONT_SIZE_PERCENT=.05;var FONT_STYLE="sans-serif";var CUE_BACKGROUND_PADDING="1.5%";WebVTT$1.processCues=function(window,cues,overlay){if(!window||!cues||!overlay){return null}while(overlay.firstChild){overlay.removeChild(overlay.firstChild);}var paddedOverlay=window.document.createElement("div");paddedOverlay.style.position="absolute";paddedOverlay.style.left="0";paddedOverlay.style.right="0";paddedOverlay.style.top="0";paddedOverlay.style.bottom="0";paddedOverlay.style.margin=CUE_BACKGROUND_PADDING;overlay.appendChild(paddedOverlay);function shouldCompute(cues){for(var i=0;i<cues.length;i++){if(cues[i].hasBeenReset||!cues[i].displayState){return true}}return false}if(!shouldCompute(cues)){for(var i=0;i<cues.length;i++){paddedOverlay.appendChild(cues[i].displayState);}return}var boxPositions=[],containerBox=BoxPosition.getSimpleBoxPosition(paddedOverlay),fontSize=Math.round(containerBox.height*FONT_SIZE_PERCENT*100)/100;var styleOptions={font:fontSize+"px "+FONT_STYLE};(function(){var styleBox,cue;for(var i=0;i<cues.length;i++){cue=cues[i];styleBox=new CueStyleBox(window,cue,styleOptions);paddedOverlay.appendChild(styleBox.div);moveBoxToLinePosition(window,styleBox,containerBox,boxPositions);cue.displayState=styleBox.div;boxPositions.push(BoxPosition.getSimpleBoxPosition(styleBox));}})();};WebVTT$1.Parser=function(window,vttjs,decoder){if(!decoder){decoder=vttjs;vttjs={};}if(!vttjs){vttjs={};}this.window=window;this.vttjs=vttjs;this.state="INITIAL";this.buffer="";this.decoder=decoder||new TextDecoder("utf8");this.regionList=[];};WebVTT$1.Parser.prototype={reportOrThrowError:function(e){if(e instanceof ParsingError){this.onparsingerror&&this.onparsingerror(e);}else {throw e}},parse:function(data){var self=this;if(data){self.buffer+=self.decoder.decode(data,{stream:true});}function collectNextLine(){var buffer=self.buffer;var pos=0;while(pos<buffer.length&&buffer[pos]!=="\r"&&buffer[pos]!=="\n"){++pos;}var line=buffer.substr(0,pos);if(buffer[pos]==="\r"){++pos;}if(buffer[pos]==="\n"){++pos;}self.buffer=buffer.substr(pos);return line}function parseRegion(input){var settings=new Settings;parseOptions(input,function(k,v){switch(k){case"id":settings.set(k,v);break;case"width":settings.percent(k,v);break;case"lines":settings.integer(k,v);break;case"regionanchor":case"viewportanchor":var xy=v.split(",");if(xy.length!==2){break}var anchor=new Settings;anchor.percent("x",xy[0]);anchor.percent("y",xy[1]);if(!anchor.has("x")||!anchor.has("y")){break}settings.set(k+"X",anchor.get("x"));settings.set(k+"Y",anchor.get("y"));break;case"scroll":settings.alt(k,v,["up"]);break}},/=/,/\s/);if(settings.has("id")){var region=new(self.vttjs.VTTRegion||self.window.VTTRegion);region.width=settings.get("width",100);region.lines=settings.get("lines",3);region.regionAnchorX=settings.get("regionanchorX",0);region.regionAnchorY=settings.get("regionanchorY",100);region.viewportAnchorX=settings.get("viewportanchorX",0);region.viewportAnchorY=settings.get("viewportanchorY",100);region.scroll=settings.get("scroll","");self.onregion&&self.onregion(region);self.regionList.push({id:settings.get("id"),region:region});}}function parseTimestampMap(input){var settings=new Settings;parseOptions(input,function(k,v){switch(k){case"MPEGT":settings.integer(k+"S",v);break;case"LOCA":settings.set(k+"L",parseTimeStamp(v));break}},/[^\d]:/,/,/);self.ontimestampmap&&self.ontimestampmap({"MPEGTS":settings.get("MPEGTS"),"LOCAL":settings.get("LOCAL")});}function parseHeader(input){if(input.match(/X-TIMESTAMP-MAP/)){parseOptions(input,function(k,v){switch(k){case"X-TIMESTAMP-MAP":parseTimestampMap(v);break}},/=/);}else {parseOptions(input,function(k,v){switch(k){case"Region":parseRegion(v);break}},/:/);}}try{var line;if(self.state==="INITIAL"){if(!/\r\n|\n/.test(self.buffer)){return this}line=collectNextLine();var m=line.match(/^WEBVTT([ \t].*)?$/);if(!m||!m[0]){throw new ParsingError(ParsingError.Errors.BadSignature)}self.state="HEADER";}var alreadyCollectedLine=false;while(self.buffer){if(!/\r\n|\n/.test(self.buffer)){return this}if(!alreadyCollectedLine){line=collectNextLine();}else {alreadyCollectedLine=false;}switch(self.state){case"HEADER":if(/:/.test(line)){parseHeader(line);}else if(!line){self.state="ID";}continue;case"NOTE":if(!line){self.state="ID";}continue;case"ID":if(/^NOTE($|[ \t])/.test(line)){self.state="NOTE";break}if(!line){continue}self.cue=new(self.vttjs.VTTCue||self.window.VTTCue)(0,0,"");try{self.cue.align="center";}catch(e){self.cue.align="middle";}self.state="CUE";if(line.indexOf("-->")===-1){self.cue.id=line;continue}case"CUE":try{parseCue(line,self.cue,self.regionList);}catch(e){self.reportOrThrowError(e);self.cue=null;self.state="BADCUE";continue}self.state="CUETEXT";continue;case"CUETEXT":var hasSubstring=line.indexOf("-->")!==-1;if(!line||hasSubstring&&(alreadyCollectedLine=true)){self.oncue&&self.oncue(self.cue);self.cue=null;self.state="ID";continue}if(self.cue.text){self.cue.text+="\n";}self.cue.text+=line.replace(/\u2028/g,"\n").replace(/u2029/g,"\n");continue;case"BADCUE":if(!line){self.state="ID";}continue}}}catch(e){self.reportOrThrowError(e);if(self.state==="CUETEXT"&&self.cue&&self.oncue){self.oncue(self.cue);}self.cue=null;self.state=self.state==="INITIAL"?"BADWEBVTT":"BADCUE";}return this},flush:function(){var self=this;try{self.buffer+=self.decoder.decode();if(self.cue||self.state==="HEADER"){self.buffer+="\n\n";self.parse();}if(self.state==="INITIAL"){throw new ParsingError(ParsingError.Errors.BadSignature)}}catch(e){self.reportOrThrowError(e);}self.onflush&&self.onflush();return this}};var vtt=WebVTT$1;
|
|
98
|
+
|
|
99
|
+
var autoKeyword="auto";var directionSetting={"":1,"lr":1,"rl":1};var alignSetting={"start":1,"center":1,"end":1,"left":1,"right":1,"auto":1,"line-left":1,"line-right":1};function findDirectionSetting(value){if(typeof value!=="string"){return false}var dir=directionSetting[value.toLowerCase()];return dir?value.toLowerCase():false}function findAlignSetting(value){if(typeof value!=="string"){return false}var align=alignSetting[value.toLowerCase()];return align?value.toLowerCase():false}function VTTCue(startTime,endTime,text){this.hasBeenReset=false;var _id="";var _pauseOnExit=false;var _startTime=startTime;var _endTime=endTime;var _text=text;var _region=null;var _vertical="";var _snapToLines=true;var _line="auto";var _lineAlign="start";var _position="auto";var _positionAlign="auto";var _size=100;var _align="center";Object.defineProperties(this,{"id":{enumerable:true,get:function(){return _id},set:function(value){_id=""+value;}},"pauseOnExit":{enumerable:true,get:function(){return _pauseOnExit},set:function(value){_pauseOnExit=!!value;}},"startTime":{enumerable:true,get:function(){return _startTime},set:function(value){if(typeof value!=="number"){throw new TypeError("Start time must be set to a number.")}_startTime=value;this.hasBeenReset=true;}},"endTime":{enumerable:true,get:function(){return _endTime},set:function(value){if(typeof value!=="number"){throw new TypeError("End time must be set to a number.")}_endTime=value;this.hasBeenReset=true;}},"text":{enumerable:true,get:function(){return _text},set:function(value){_text=""+value;this.hasBeenReset=true;}},"region":{enumerable:true,get:function(){return _region},set:function(value){_region=value;this.hasBeenReset=true;}},"vertical":{enumerable:true,get:function(){return _vertical},set:function(value){var setting=findDirectionSetting(value);if(setting===false){throw new SyntaxError("Vertical: an invalid or illegal direction string was specified.")}_vertical=setting;this.hasBeenReset=true;}},"snapToLines":{enumerable:true,get:function(){return _snapToLines},set:function(value){_snapToLines=!!value;this.hasBeenReset=true;}},"line":{enumerable:true,get:function(){return _line},set:function(value){if(typeof value!=="number"&&value!==autoKeyword){throw new SyntaxError("Line: an invalid number or illegal string was specified.")}_line=value;this.hasBeenReset=true;}},"lineAlign":{enumerable:true,get:function(){return _lineAlign},set:function(value){var setting=findAlignSetting(value);if(!setting){console.warn("lineAlign: an invalid or illegal string was specified.");}else {_lineAlign=setting;this.hasBeenReset=true;}}},"position":{enumerable:true,get:function(){return _position},set:function(value){if(value<0||value>100){throw new Error("Position must be between 0 and 100.")}_position=value;this.hasBeenReset=true;}},"positionAlign":{enumerable:true,get:function(){return _positionAlign},set:function(value){var setting=findAlignSetting(value);if(!setting){console.warn("positionAlign: an invalid or illegal string was specified.");}else {_positionAlign=setting;this.hasBeenReset=true;}}},"size":{enumerable:true,get:function(){return _size},set:function(value){if(value<0||value>100){throw new Error("Size must be between 0 and 100.")}_size=value;this.hasBeenReset=true;}},"align":{enumerable:true,get:function(){return _align},set:function(value){var setting=findAlignSetting(value);if(!setting){throw new SyntaxError("align: an invalid or illegal alignment string was specified.")}_align=setting;this.hasBeenReset=true;}}});this.displayState=undefined;}VTTCue.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)};var vttcue=VTTCue;
|
|
100
|
+
|
|
101
|
+
var scrollSetting={"":true,"up":true};function findScrollSetting(value){if(typeof value!=="string"){return false}var scroll=scrollSetting[value.toLowerCase()];return scroll?value.toLowerCase():false}function isValidPercentValue(value){return typeof value==="number"&&value>=0&&value<=100}function VTTRegion(){var _width=100;var _lines=3;var _regionAnchorX=0;var _regionAnchorY=100;var _viewportAnchorX=0;var _viewportAnchorY=100;var _scroll="";Object.defineProperties(this,{"width":{enumerable:true,get:function(){return _width},set:function(value){if(!isValidPercentValue(value)){throw new Error("Width must be between 0 and 100.")}_width=value;}},"lines":{enumerable:true,get:function(){return _lines},set:function(value){if(typeof value!=="number"){throw new TypeError("Lines must be set to a number.")}_lines=value;}},"regionAnchorY":{enumerable:true,get:function(){return _regionAnchorY},set:function(value){if(!isValidPercentValue(value)){throw new Error("RegionAnchorX must be between 0 and 100.")}_regionAnchorY=value;}},"regionAnchorX":{enumerable:true,get:function(){return _regionAnchorX},set:function(value){if(!isValidPercentValue(value)){throw new Error("RegionAnchorY must be between 0 and 100.")}_regionAnchorX=value;}},"viewportAnchorY":{enumerable:true,get:function(){return _viewportAnchorY},set:function(value){if(!isValidPercentValue(value)){throw new Error("ViewportAnchorY must be between 0 and 100.")}_viewportAnchorY=value;}},"viewportAnchorX":{enumerable:true,get:function(){return _viewportAnchorX},set:function(value){if(!isValidPercentValue(value)){throw new Error("ViewportAnchorX must be between 0 and 100.")}_viewportAnchorX=value;}},"scroll":{enumerable:true,get:function(){return _scroll},set:function(value){var setting=findScrollSetting(value);if(setting===false){console.warn("Scroll: an invalid or illegal string was specified.");}else {_scroll=setting;}}}});}var vttregion=VTTRegion;
|
|
102
|
+
|
|
103
|
+
var window$1=window_1;var vttjs=browserIndex.exports={WebVTT:vtt,VTTCue:vttcue,VTTRegion:vttregion};window$1.vttjs=vttjs;window$1.WebVTT=vttjs.WebVTT;var cueShim=vttjs.VTTCue;var regionShim=vttjs.VTTRegion;var nativeVTTCue=window$1.VTTCue;var nativeVTTRegion=window$1.VTTRegion;vttjs.shim=function(){window$1.VTTCue=cueShim;window$1.VTTRegion=regionShim;};vttjs.restore=function(){window$1.VTTCue=nativeVTTCue;window$1.VTTRegion=nativeVTTRegion;};if(!window$1.VTTCue){vttjs.shim();}
|
|
104
|
+
|
|
105
|
+
function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return (_isNativeReflectConstruct=function _isNativeReflectConstruct(){return !!t})()}
|
|
106
|
+
|
|
107
|
+
function _construct(t,e,r){if(_isNativeReflectConstruct())return Reflect.construct.apply(null,arguments);var o=[null];o.push.apply(o,e);var p=new(t.bind.apply(t,o));return r&&_setPrototypeOf(p,r.prototype),p}
|
|
108
|
+
|
|
109
|
+
function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf(t,e);}
|
|
110
|
+
|
|
111
|
+
var urlToolkit = {exports: {}};
|
|
112
|
+
|
|
113
|
+
(function(module,exports){(function(root){var URL_REGEX=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/;var FIRST_SEGMENT_REGEX=/^(?=([^\/?#]*))\1([^]*)$/;var SLASH_DOT_REGEX=/(?:\/|^)\.(?=\/)/g;var SLASH_DOT_DOT_REGEX=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g;var URLToolkit={buildAbsoluteURL:function(baseURL,relativeURL,opts){opts=opts||{};baseURL=baseURL.trim();relativeURL=relativeURL.trim();if(!relativeURL){if(!opts.alwaysNormalize){return baseURL}var basePartsForNormalise=URLToolkit.parseURL(baseURL);if(!basePartsForNormalise){throw new Error("Error trying to parse base URL.")}basePartsForNormalise.path=URLToolkit.normalizePath(basePartsForNormalise.path);return URLToolkit.buildURLFromParts(basePartsForNormalise)}var relativeParts=URLToolkit.parseURL(relativeURL);if(!relativeParts){throw new Error("Error trying to parse relative URL.")}if(relativeParts.scheme){if(!opts.alwaysNormalize){return relativeURL}relativeParts.path=URLToolkit.normalizePath(relativeParts.path);return URLToolkit.buildURLFromParts(relativeParts)}var baseParts=URLToolkit.parseURL(baseURL);if(!baseParts){throw new Error("Error trying to parse base URL.")}if(!baseParts.netLoc&&baseParts.path&&baseParts.path[0]!=="/"){var pathParts=FIRST_SEGMENT_REGEX.exec(baseParts.path);baseParts.netLoc=pathParts[1];baseParts.path=pathParts[2];}if(baseParts.netLoc&&!baseParts.path){baseParts.path="/";}var builtParts={scheme:baseParts.scheme,netLoc:relativeParts.netLoc,path:null,params:relativeParts.params,query:relativeParts.query,fragment:relativeParts.fragment};if(!relativeParts.netLoc){builtParts.netLoc=baseParts.netLoc;if(relativeParts.path[0]!=="/"){if(!relativeParts.path){builtParts.path=baseParts.path;if(!relativeParts.params){builtParts.params=baseParts.params;if(!relativeParts.query){builtParts.query=baseParts.query;}}}else {var baseURLPath=baseParts.path;var newPath=baseURLPath.substring(0,baseURLPath.lastIndexOf("/")+1)+relativeParts.path;builtParts.path=URLToolkit.normalizePath(newPath);}}}if(builtParts.path===null){builtParts.path=opts.alwaysNormalize?URLToolkit.normalizePath(relativeParts.path):relativeParts.path;}return URLToolkit.buildURLFromParts(builtParts)},parseURL:function(url){var parts=URL_REGEX.exec(url);if(!parts){return null}return {scheme:parts[1]||"",netLoc:parts[2]||"",path:parts[3]||"",params:parts[4]||"",query:parts[5]||"",fragment:parts[6]||""}},normalizePath:function(path){path=path.split("").reverse().join("").replace(SLASH_DOT_REGEX,"");while(path.length!==(path=path.replace(SLASH_DOT_DOT_REGEX,"")).length){}return path.split("").reverse().join("")},buildURLFromParts:function(parts){return parts.scheme+parts.netLoc+parts.path+parts.params+parts.query+parts.fragment}};module.exports=URLToolkit;})();})(urlToolkit);var URLToolkit = urlToolkit.exports;
|
|
114
|
+
|
|
115
|
+
var DEFAULT_LOCATION="http://example.com";var resolveUrl$1=function resolveUrl(baseUrl,relativeUrl){if(/^[a-z]+:/i.test(relativeUrl)){return relativeUrl}if(/^data:/.test(baseUrl)){baseUrl=window_1.location&&window_1.location.href||"";}var nativeURL=typeof window_1.URL==="function";var protocolLess=/^\/\//.test(baseUrl);var removeLocation=!window_1.location&&!/\/\//i.test(baseUrl);if(nativeURL){baseUrl=new window_1.URL(baseUrl,window_1.location||DEFAULT_LOCATION);}else if(!/\/\//i.test(baseUrl)){baseUrl=URLToolkit.buildAbsoluteURL(window_1.location&&window_1.location.href||"",baseUrl);}if(nativeURL){var newUrl=new URL(relativeUrl,baseUrl);if(removeLocation){return newUrl.href.slice(DEFAULT_LOCATION.length)}else if(protocolLess){return newUrl.href.slice(newUrl.protocol.length)}return newUrl.href}return URLToolkit.buildAbsoluteURL(baseUrl,relativeUrl)};
|
|
116
|
+
|
|
117
|
+
var Stream=function(){function Stream(){this.listeners={};}var _proto=Stream.prototype;_proto.on=function on(type,listener){if(!this.listeners[type]){this.listeners[type]=[];}this.listeners[type].push(listener);};_proto.off=function off(type,listener){if(!this.listeners[type]){return false}var index=this.listeners[type].indexOf(listener);this.listeners[type]=this.listeners[type].slice(0);this.listeners[type].splice(index,1);return index>-1};_proto.trigger=function trigger(type){var callbacks=this.listeners[type];if(!callbacks){return}if(arguments.length===2){var length=callbacks.length;for(var i=0;i<length;++i){callbacks[i].call(this,arguments[1]);}}else {var args=Array.prototype.slice.call(arguments,1);var _length=callbacks.length;for(var _i=0;_i<_length;++_i){callbacks[_i].apply(this,args);}}};_proto.dispose=function dispose(){this.listeners={};};_proto.pipe=function pipe(destination){this.on("data",function(data){destination.push(data);});};return Stream}();
|
|
118
|
+
|
|
119
|
+
var atob=function atob(s){return window_1.atob?window_1.atob(s):Buffer.from(s,"base64").toString("binary")};function decodeB64ToUint8Array(b64Text){var decodedString=atob(b64Text);var array=new Uint8Array(decodedString.length);for(var i=0;i<decodedString.length;i++){array[i]=decodedString.charCodeAt(i);}return array}
|
|
120
|
+
|
|
121
|
+
var LineStream=function(_Stream){_inheritsLoose(LineStream,_Stream);function LineStream(){var _this;_this=_Stream.call(this)||this;_this.buffer="";return _this}var _proto=LineStream.prototype;_proto.push=function push(data){var nextNewline;this.buffer+=data;nextNewline=this.buffer.indexOf("\n");for(;nextNewline>-1;nextNewline=this.buffer.indexOf("\n")){this.trigger("data",this.buffer.substring(0,nextNewline));this.buffer=this.buffer.substring(nextNewline+1);}};return LineStream}(Stream);var TAB=String.fromCharCode(9);var parseByterange=function parseByterange(byterangeString){var match=/([0-9.]*)?@?([0-9.]*)?/.exec(byterangeString||"");var result={};if(match[1]){result.length=parseInt(match[1],10);}if(match[2]){result.offset=parseInt(match[2],10);}return result};var attributeSeparator=function attributeSeparator(){var key="[^=]*";var value='"[^"]*"|[^,]*';var keyvalue="(?:"+key+")=(?:"+value+")";return new RegExp("(?:^|,)("+keyvalue+")")};var parseAttributes$1=function parseAttributes(attributes){var attrs=attributes.split(attributeSeparator());var result={};var i=attrs.length;var attr;while(i--){if(attrs[i]===""){continue}attr=/([^=]*)=(.*)/.exec(attrs[i]).slice(1);attr[0]=attr[0].replace(/^\s+|\s+$/g,"");attr[1]=attr[1].replace(/^\s+|\s+$/g,"");attr[1]=attr[1].replace(/^['"](.*)['"]$/g,"$1");result[attr[0]]=attr[1];}return result};var ParseStream=function(_Stream){_inheritsLoose(ParseStream,_Stream);function ParseStream(){var _this;_this=_Stream.call(this)||this;_this.customParsers=[];_this.tagMappers=[];return _this}var _proto=ParseStream.prototype;_proto.push=function push(line){var _this2=this;var match;var event;line=line.trim();if(line.length===0){return}if(line[0]!=="#"){this.trigger("data",{type:"uri",uri:line});return}var newLines=this.tagMappers.reduce(function(acc,mapper){var mappedLine=mapper(line);if(mappedLine===line){return acc}return acc.concat([mappedLine])},[line]);newLines.forEach(function(newLine){for(var i=0;i<_this2.customParsers.length;i++){if(_this2.customParsers[i].call(_this2,newLine)){return}}if(newLine.indexOf("#EXT")!==0){_this2.trigger("data",{type:"comment",text:newLine.slice(1)});return}newLine=newLine.replace("\r","");match=/^#EXTM3U/.exec(newLine);if(match){_this2.trigger("data",{type:"tag",tagType:"m3u"});return}match=/^#EXTINF:?([0-9\.]*)?,?(.*)?$/.exec(newLine);if(match){event={type:"tag",tagType:"inf"};if(match[1]){event.duration=parseFloat(match[1]);}if(match[2]){event.title=match[2];}_this2.trigger("data",event);return}match=/^#EXT-X-TARGETDURATION:?([0-9.]*)?/.exec(newLine);if(match){event={type:"tag",tagType:"targetduration"};if(match[1]){event.duration=parseInt(match[1],10);}_this2.trigger("data",event);return}match=/^#EXT-X-VERSION:?([0-9.]*)?/.exec(newLine);if(match){event={type:"tag",tagType:"version"};if(match[1]){event.version=parseInt(match[1],10);}_this2.trigger("data",event);return}match=/^#EXT-X-MEDIA-SEQUENCE:?(\-?[0-9.]*)?/.exec(newLine);if(match){event={type:"tag",tagType:"media-sequence"};if(match[1]){event.number=parseInt(match[1],10);}_this2.trigger("data",event);return}match=/^#EXT-X-DISCONTINUITY-SEQUENCE:?(\-?[0-9.]*)?/.exec(newLine);if(match){event={type:"tag",tagType:"discontinuity-sequence"};if(match[1]){event.number=parseInt(match[1],10);}_this2.trigger("data",event);return}match=/^#EXT-X-PLAYLIST-TYPE:?(.*)?$/.exec(newLine);if(match){event={type:"tag",tagType:"playlist-type"};if(match[1]){event.playlistType=match[1];}_this2.trigger("data",event);return}match=/^#EXT-X-BYTERANGE:?(.*)?$/.exec(newLine);if(match){event=_extends$3(parseByterange(match[1]),{type:"tag",tagType:"byterange"});_this2.trigger("data",event);return}match=/^#EXT-X-ALLOW-CACHE:?(YES|NO)?/.exec(newLine);if(match){event={type:"tag",tagType:"allow-cache"};if(match[1]){event.allowed=!/NO/.test(match[1]);}_this2.trigger("data",event);return}match=/^#EXT-X-MAP:?(.*)$/.exec(newLine);if(match){event={type:"tag",tagType:"map"};if(match[1]){var attributes=parseAttributes$1(match[1]);if(attributes.URI){event.uri=attributes.URI;}if(attributes.BYTERANGE){event.byterange=parseByterange(attributes.BYTERANGE);}}_this2.trigger("data",event);return}match=/^#EXT-X-STREAM-INF:?(.*)$/.exec(newLine);if(match){event={type:"tag",tagType:"stream-inf"};if(match[1]){event.attributes=parseAttributes$1(match[1]);if(event.attributes.RESOLUTION){var split=event.attributes.RESOLUTION.split("x");var resolution={};if(split[0]){resolution.width=parseInt(split[0],10);}if(split[1]){resolution.height=parseInt(split[1],10);}event.attributes.RESOLUTION=resolution;}if(event.attributes.BANDWIDTH){event.attributes.BANDWIDTH=parseInt(event.attributes.BANDWIDTH,10);}if(event.attributes["FRAME-RATE"]){event.attributes["FRAME-RATE"]=parseFloat(event.attributes["FRAME-RATE"]);}if(event.attributes["PROGRAM-ID"]){event.attributes["PROGRAM-ID"]=parseInt(event.attributes["PROGRAM-ID"],10);}}_this2.trigger("data",event);return}match=/^#EXT-X-MEDIA:?(.*)$/.exec(newLine);if(match){event={type:"tag",tagType:"media"};if(match[1]){event.attributes=parseAttributes$1(match[1]);}_this2.trigger("data",event);return}match=/^#EXT-X-ENDLIST/.exec(newLine);if(match){_this2.trigger("data",{type:"tag",tagType:"endlist"});return}match=/^#EXT-X-DISCONTINUITY/.exec(newLine);if(match){_this2.trigger("data",{type:"tag",tagType:"discontinuity"});return}match=/^#EXT-X-PROGRAM-DATE-TIME:?(.*)$/.exec(newLine);if(match){event={type:"tag",tagType:"program-date-time"};if(match[1]){event.dateTimeString=match[1];event.dateTimeObject=new Date(match[1]);}_this2.trigger("data",event);return}match=/^#EXT-X-KEY:?(.*)$/.exec(newLine);if(match){event={type:"tag",tagType:"key"};if(match[1]){event.attributes=parseAttributes$1(match[1]);if(event.attributes.IV){if(event.attributes.IV.substring(0,2).toLowerCase()==="0x"){event.attributes.IV=event.attributes.IV.substring(2);}event.attributes.IV=event.attributes.IV.match(/.{8}/g);event.attributes.IV[0]=parseInt(event.attributes.IV[0],16);event.attributes.IV[1]=parseInt(event.attributes.IV[1],16);event.attributes.IV[2]=parseInt(event.attributes.IV[2],16);event.attributes.IV[3]=parseInt(event.attributes.IV[3],16);event.attributes.IV=new Uint32Array(event.attributes.IV);}}_this2.trigger("data",event);return}match=/^#EXT-X-START:?(.*)$/.exec(newLine);if(match){event={type:"tag",tagType:"start"};if(match[1]){event.attributes=parseAttributes$1(match[1]);event.attributes["TIME-OFFSET"]=parseFloat(event.attributes["TIME-OFFSET"]);event.attributes.PRECISE=/YES/.test(event.attributes.PRECISE);}_this2.trigger("data",event);return}match=/^#EXT-X-CUE-OUT-CONT:?(.*)?$/.exec(newLine);if(match){event={type:"tag",tagType:"cue-out-cont"};if(match[1]){event.data=match[1];}else {event.data="";}_this2.trigger("data",event);return}match=/^#EXT-X-CUE-OUT:?(.*)?$/.exec(newLine);if(match){event={type:"tag",tagType:"cue-out"};if(match[1]){event.data=match[1];}else {event.data="";}_this2.trigger("data",event);return}match=/^#EXT-X-CUE-IN:?(.*)?$/.exec(newLine);if(match){event={type:"tag",tagType:"cue-in"};if(match[1]){event.data=match[1];}else {event.data="";}_this2.trigger("data",event);return}match=/^#EXT-X-SKIP:(.*)$/.exec(newLine);if(match&&match[1]){event={type:"tag",tagType:"skip"};event.attributes=parseAttributes$1(match[1]);if(event.attributes.hasOwnProperty("SKIPPED-SEGMENTS")){event.attributes["SKIPPED-SEGMENTS"]=parseInt(event.attributes["SKIPPED-SEGMENTS"],10);}if(event.attributes.hasOwnProperty("RECENTLY-REMOVED-DATERANGES")){event.attributes["RECENTLY-REMOVED-DATERANGES"]=event.attributes["RECENTLY-REMOVED-DATERANGES"].split(TAB);}_this2.trigger("data",event);return}match=/^#EXT-X-PART:(.*)$/.exec(newLine);if(match&&match[1]){event={type:"tag",tagType:"part"};event.attributes=parseAttributes$1(match[1]);["DURATION"].forEach(function(key){if(event.attributes.hasOwnProperty(key)){event.attributes[key]=parseFloat(event.attributes[key]);}});["INDEPENDENT","GAP"].forEach(function(key){if(event.attributes.hasOwnProperty(key)){event.attributes[key]=/YES/.test(event.attributes[key]);}});if(event.attributes.hasOwnProperty("BYTERANGE")){event.attributes.byterange=parseByterange(event.attributes.BYTERANGE);}_this2.trigger("data",event);return}match=/^#EXT-X-SERVER-CONTROL:(.*)$/.exec(newLine);if(match&&match[1]){event={type:"tag",tagType:"server-control"};event.attributes=parseAttributes$1(match[1]);["CAN-SKIP-UNTIL","PART-HOLD-BACK","HOLD-BACK"].forEach(function(key){if(event.attributes.hasOwnProperty(key)){event.attributes[key]=parseFloat(event.attributes[key]);}});["CAN-SKIP-DATERANGES","CAN-BLOCK-RELOAD"].forEach(function(key){if(event.attributes.hasOwnProperty(key)){event.attributes[key]=/YES/.test(event.attributes[key]);}});_this2.trigger("data",event);return}match=/^#EXT-X-PART-INF:(.*)$/.exec(newLine);if(match&&match[1]){event={type:"tag",tagType:"part-inf"};event.attributes=parseAttributes$1(match[1]);["PART-TARGET"].forEach(function(key){if(event.attributes.hasOwnProperty(key)){event.attributes[key]=parseFloat(event.attributes[key]);}});_this2.trigger("data",event);return}match=/^#EXT-X-PRELOAD-HINT:(.*)$/.exec(newLine);if(match&&match[1]){event={type:"tag",tagType:"preload-hint"};event.attributes=parseAttributes$1(match[1]);["BYTERANGE-START","BYTERANGE-LENGTH"].forEach(function(key){if(event.attributes.hasOwnProperty(key)){event.attributes[key]=parseInt(event.attributes[key],10);var subkey=key==="BYTERANGE-LENGTH"?"length":"offset";event.attributes.byterange=event.attributes.byterange||{};event.attributes.byterange[subkey]=event.attributes[key];delete event.attributes[key];}});_this2.trigger("data",event);return}match=/^#EXT-X-RENDITION-REPORT:(.*)$/.exec(newLine);if(match&&match[1]){event={type:"tag",tagType:"rendition-report"};event.attributes=parseAttributes$1(match[1]);["LAST-MSN","LAST-PART"].forEach(function(key){if(event.attributes.hasOwnProperty(key)){event.attributes[key]=parseInt(event.attributes[key],10);}});_this2.trigger("data",event);return}_this2.trigger("data",{type:"tag",data:newLine.slice(4)});});};_proto.addParser=function addParser(_ref){var _this3=this;var expression=_ref.expression,customType=_ref.customType,dataParser=_ref.dataParser,segment=_ref.segment;if(typeof dataParser!=="function"){dataParser=function dataParser(line){return line};}this.customParsers.push(function(line){var match=expression.exec(line);if(match){_this3.trigger("data",{type:"custom",data:dataParser(line),customType:customType,segment:segment});return true}});};_proto.addTagMapper=function addTagMapper(_ref2){var expression=_ref2.expression,map=_ref2.map;var mapFn=function mapFn(line){if(expression.test(line)){return map(line)}return line};this.tagMappers.push(mapFn);};return ParseStream}(Stream);var camelCase=function camelCase(str){return str.toLowerCase().replace(/-(\w)/g,function(a){return a[1].toUpperCase()})};var camelCaseKeys=function camelCaseKeys(attributes){var result={};Object.keys(attributes).forEach(function(key){result[camelCase(key)]=attributes[key];});return result};var setHoldBack=function setHoldBack(manifest){var serverControl=manifest.serverControl,targetDuration=manifest.targetDuration,partTargetDuration=manifest.partTargetDuration;if(!serverControl){return}var tag="#EXT-X-SERVER-CONTROL";var hb="holdBack";var phb="partHoldBack";var minTargetDuration=targetDuration&&targetDuration*3;var minPartDuration=partTargetDuration&&partTargetDuration*2;if(targetDuration&&!serverControl.hasOwnProperty(hb)){serverControl[hb]=minTargetDuration;this.trigger("info",{message:tag+" defaulting HOLD-BACK to targetDuration * 3 ("+minTargetDuration+")."});}if(minTargetDuration&&serverControl[hb]<minTargetDuration){this.trigger("warn",{message:tag+" clamping HOLD-BACK ("+serverControl[hb]+") to targetDuration * 3 ("+minTargetDuration+")"});serverControl[hb]=minTargetDuration;}if(partTargetDuration&&!serverControl.hasOwnProperty(phb)){serverControl[phb]=partTargetDuration*3;this.trigger("info",{message:tag+" defaulting PART-HOLD-BACK to partTargetDuration * 3 ("+serverControl[phb]+")."});}if(partTargetDuration&&serverControl[phb]<minPartDuration){this.trigger("warn",{message:tag+" clamping PART-HOLD-BACK ("+serverControl[phb]+") to partTargetDuration * 2 ("+minPartDuration+")."});serverControl[phb]=minPartDuration;}};var Parser=function(_Stream){_inheritsLoose(Parser,_Stream);function Parser(){var _this;_this=_Stream.call(this)||this;_this.lineStream=new LineStream;_this.parseStream=new ParseStream;_this.lineStream.pipe(_this.parseStream);var self=_assertThisInitialized(_this);var uris=[];var currentUri={};var currentMap;var _key;var hasParts=false;var noop=function noop(){};var defaultMediaGroups={"AUDIO":{},"VIDEO":{},"CLOSED-CAPTIONS":{},"SUBTITLES":{}};var widevineUuid="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";var currentTimeline=0;_this.manifest={allowCache:true,discontinuityStarts:[],segments:[]};var lastByterangeEnd=0;var lastPartByterangeEnd=0;_this.on("end",function(){if(currentUri.uri||!currentUri.parts&&!currentUri.preloadHints){return}if(!currentUri.map&¤tMap){currentUri.map=currentMap;}if(!currentUri.key&&_key){currentUri.key=_key;}if(!currentUri.timeline&&typeof currentTimeline==="number"){currentUri.timeline=currentTimeline;}_this.manifest.preloadSegment=currentUri;});_this.parseStream.on("data",function(entry){var mediaGroup;var rendition;({tag:function tag(){(({version:function version(){if(entry.version){this.manifest.version=entry.version;}},"allow-cache":function allowCache(){this.manifest.allowCache=entry.allowed;if(!("allowed"in entry)){this.trigger("info",{message:"defaulting allowCache to YES"});this.manifest.allowCache=true;}},byterange:function byterange(){var byterange={};if("length"in entry){currentUri.byterange=byterange;byterange.length=entry.length;if(!("offset"in entry)){entry.offset=lastByterangeEnd;}}if("offset"in entry){currentUri.byterange=byterange;byterange.offset=entry.offset;}lastByterangeEnd=byterange.offset+byterange.length;},endlist:function endlist(){this.manifest.endList=true;},inf:function inf(){if(!("mediaSequence"in this.manifest)){this.manifest.mediaSequence=0;this.trigger("info",{message:"defaulting media sequence to zero"});}if(!("discontinuitySequence"in this.manifest)){this.manifest.discontinuitySequence=0;this.trigger("info",{message:"defaulting discontinuity sequence to zero"});}if(entry.duration>0){currentUri.duration=entry.duration;}if(entry.duration===0){currentUri.duration=.01;this.trigger("info",{message:"updating zero segment duration to a small value"});}this.manifest.segments=uris;},key:function key(){if(!entry.attributes){this.trigger("warn",{message:"ignoring key declaration without attribute list"});return}if(entry.attributes.METHOD==="NONE"){_key=null;return}if(!entry.attributes.URI){this.trigger("warn",{message:"ignoring key declaration without URI"});return}if(entry.attributes.KEYFORMAT==="com.apple.streamingkeydelivery"){this.manifest.contentProtection=this.manifest.contentProtection||{};this.manifest.contentProtection["com.apple.fps.1_0"]={attributes:entry.attributes};return}if(entry.attributes.KEYFORMAT==="com.microsoft.playready"){this.manifest.contentProtection=this.manifest.contentProtection||{};this.manifest.contentProtection["com.microsoft.playready"]={uri:entry.attributes.URI};return}if(entry.attributes.KEYFORMAT===widevineUuid){var VALID_METHODS=["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"];if(VALID_METHODS.indexOf(entry.attributes.METHOD)===-1){this.trigger("warn",{message:"invalid key method provided for Widevine"});return}if(entry.attributes.METHOD==="SAMPLE-AES-CENC"){this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"});}if(entry.attributes.URI.substring(0,23)!=="data:text/plain;base64,"){this.trigger("warn",{message:"invalid key URI provided for Widevine"});return}if(!(entry.attributes.KEYID&&entry.attributes.KEYID.substring(0,2)==="0x")){this.trigger("warn",{message:"invalid key ID provided for Widevine"});return}this.manifest.contentProtection=this.manifest.contentProtection||{};this.manifest.contentProtection["com.widevine.alpha"]={attributes:{schemeIdUri:entry.attributes.KEYFORMAT,keyId:entry.attributes.KEYID.substring(2)},pssh:decodeB64ToUint8Array(entry.attributes.URI.split(",")[1])};return}if(!entry.attributes.METHOD){this.trigger("warn",{message:"defaulting key method to AES-128"});}_key={method:entry.attributes.METHOD||"AES-128",uri:entry.attributes.URI};if(typeof entry.attributes.IV!=="undefined"){_key.iv=entry.attributes.IV;}},"media-sequence":function mediaSequence(){if(!isFinite(entry.number)){this.trigger("warn",{message:"ignoring invalid media sequence: "+entry.number});return}this.manifest.mediaSequence=entry.number;},"discontinuity-sequence":function discontinuitySequence(){if(!isFinite(entry.number)){this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+entry.number});return}this.manifest.discontinuitySequence=entry.number;currentTimeline=entry.number;},"playlist-type":function playlistType(){if(!/VOD|EVENT/.test(entry.playlistType)){this.trigger("warn",{message:"ignoring unknown playlist type: "+entry.playlist});return}this.manifest.playlistType=entry.playlistType;},map:function map(){currentMap={};if(entry.uri){currentMap.uri=entry.uri;}if(entry.byterange){currentMap.byterange=entry.byterange;}if(_key){currentMap.key=_key;}},"stream-inf":function streamInf(){this.manifest.playlists=uris;this.manifest.mediaGroups=this.manifest.mediaGroups||defaultMediaGroups;if(!entry.attributes){this.trigger("warn",{message:"ignoring empty stream-inf attributes"});return}if(!currentUri.attributes){currentUri.attributes={};}_extends$3(currentUri.attributes,entry.attributes);},media:function media(){this.manifest.mediaGroups=this.manifest.mediaGroups||defaultMediaGroups;if(!(entry.attributes&&entry.attributes.TYPE&&entry.attributes["GROUP-ID"]&&entry.attributes.NAME)){this.trigger("warn",{message:"ignoring incomplete or missing media group"});return}var mediaGroupType=this.manifest.mediaGroups[entry.attributes.TYPE];mediaGroupType[entry.attributes["GROUP-ID"]]=mediaGroupType[entry.attributes["GROUP-ID"]]||{};mediaGroup=mediaGroupType[entry.attributes["GROUP-ID"]];rendition={default:/yes/i.test(entry.attributes.DEFAULT)};if(rendition.default){rendition.autoselect=true;}else {rendition.autoselect=/yes/i.test(entry.attributes.AUTOSELECT);}if(entry.attributes.LANGUAGE){rendition.language=entry.attributes.LANGUAGE;}if(entry.attributes.URI){rendition.uri=entry.attributes.URI;}if(entry.attributes["INSTREAM-ID"]){rendition.instreamId=entry.attributes["INSTREAM-ID"];}if(entry.attributes.CHARACTERISTICS){rendition.characteristics=entry.attributes.CHARACTERISTICS;}if(entry.attributes.FORCED){rendition.forced=/yes/i.test(entry.attributes.FORCED);}mediaGroup[entry.attributes.NAME]=rendition;},discontinuity:function discontinuity(){currentTimeline+=1;currentUri.discontinuity=true;this.manifest.discontinuityStarts.push(uris.length);},"program-date-time":function programDateTime(){if(typeof this.manifest.dateTimeString==="undefined"){this.manifest.dateTimeString=entry.dateTimeString;this.manifest.dateTimeObject=entry.dateTimeObject;}currentUri.dateTimeString=entry.dateTimeString;currentUri.dateTimeObject=entry.dateTimeObject;},targetduration:function targetduration(){if(!isFinite(entry.duration)||entry.duration<0){this.trigger("warn",{message:"ignoring invalid target duration: "+entry.duration});return}this.manifest.targetDuration=entry.duration;setHoldBack.call(this,this.manifest);},start:function start(){if(!entry.attributes||isNaN(entry.attributes["TIME-OFFSET"])){this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"});return}this.manifest.start={timeOffset:entry.attributes["TIME-OFFSET"],precise:entry.attributes.PRECISE};},"cue-out":function cueOut(){currentUri.cueOut=entry.data;},"cue-out-cont":function cueOutCont(){currentUri.cueOutCont=entry.data;},"cue-in":function cueIn(){currentUri.cueIn=entry.data;},"skip":function skip(){this.manifest.skip=camelCaseKeys(entry.attributes);this.warnOnMissingAttributes_("#EXT-X-SKIP",entry.attributes,["SKIPPED-SEGMENTS"]);},"part":function part(){var _this2=this;hasParts=true;var segmentIndex=this.manifest.segments.length;var part=camelCaseKeys(entry.attributes);currentUri.parts=currentUri.parts||[];currentUri.parts.push(part);if(part.byterange){if(!part.byterange.hasOwnProperty("offset")){part.byterange.offset=lastPartByterangeEnd;}lastPartByterangeEnd=part.byterange.offset+part.byterange.length;}var partIndex=currentUri.parts.length-1;this.warnOnMissingAttributes_("#EXT-X-PART #"+partIndex+" for segment #"+segmentIndex,entry.attributes,["URI","DURATION"]);if(this.manifest.renditionReports){this.manifest.renditionReports.forEach(function(r,i){if(!r.hasOwnProperty("lastPart")){_this2.trigger("warn",{message:"#EXT-X-RENDITION-REPORT #"+i+" lacks required attribute(s): LAST-PART"});}});}},"server-control":function serverControl(){var attrs=this.manifest.serverControl=camelCaseKeys(entry.attributes);if(!attrs.hasOwnProperty("canBlockReload")){attrs.canBlockReload=false;this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"});}setHoldBack.call(this,this.manifest);if(attrs.canSkipDateranges&&!attrs.hasOwnProperty("canSkipUntil")){this.trigger("warn",{message:"#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set"});}},"preload-hint":function preloadHint(){var segmentIndex=this.manifest.segments.length;var hint=camelCaseKeys(entry.attributes);var isPart=hint.type&&hint.type==="PART";currentUri.preloadHints=currentUri.preloadHints||[];currentUri.preloadHints.push(hint);if(hint.byterange){if(!hint.byterange.hasOwnProperty("offset")){hint.byterange.offset=isPart?lastPartByterangeEnd:0;if(isPart){lastPartByterangeEnd=hint.byterange.offset+hint.byterange.length;}}}var index=currentUri.preloadHints.length-1;this.warnOnMissingAttributes_("#EXT-X-PRELOAD-HINT #"+index+" for segment #"+segmentIndex,entry.attributes,["TYPE","URI"]);if(!hint.type){return}for(var i=0;i<currentUri.preloadHints.length-1;i++){var otherHint=currentUri.preloadHints[i];if(!otherHint.type){continue}if(otherHint.type===hint.type){this.trigger("warn",{message:"#EXT-X-PRELOAD-HINT #"+index+" for segment #"+segmentIndex+" has the same TYPE "+hint.type+" as preload hint #"+i});}}},"rendition-report":function renditionReport(){var report=camelCaseKeys(entry.attributes);this.manifest.renditionReports=this.manifest.renditionReports||[];this.manifest.renditionReports.push(report);var index=this.manifest.renditionReports.length-1;var required=["LAST-MSN","URI"];if(hasParts){required.push("LAST-PART");}this.warnOnMissingAttributes_("#EXT-X-RENDITION-REPORT #"+index,entry.attributes,required);},"part-inf":function partInf(){this.manifest.partInf=camelCaseKeys(entry.attributes);this.warnOnMissingAttributes_("#EXT-X-PART-INF",entry.attributes,["PART-TARGET"]);if(this.manifest.partInf.partTarget){this.manifest.partTargetDuration=this.manifest.partInf.partTarget;}setHoldBack.call(this,this.manifest);}})[entry.tagType]||noop).call(self);},uri:function uri(){currentUri.uri=entry.uri;uris.push(currentUri);if(this.manifest.targetDuration&&!("duration"in currentUri)){this.trigger("warn",{message:"defaulting segment duration to the target duration"});currentUri.duration=this.manifest.targetDuration;}if(_key){currentUri.key=_key;}currentUri.timeline=currentTimeline;if(currentMap){currentUri.map=currentMap;}lastPartByterangeEnd=0;currentUri={};},comment:function comment(){},custom:function custom(){if(entry.segment){currentUri.custom=currentUri.custom||{};currentUri.custom[entry.customType]=entry.data;}else {this.manifest.custom=this.manifest.custom||{};this.manifest.custom[entry.customType]=entry.data;}}})[entry.type].call(self);});return _this}var _proto=Parser.prototype;_proto.warnOnMissingAttributes_=function warnOnMissingAttributes_(identifier,attributes,required){var missing=[];required.forEach(function(key){if(!attributes.hasOwnProperty(key)){missing.push(key);}});if(missing.length){this.trigger("warn",{message:identifier+" lacks required attribute(s): "+missing.join(", ")});}};_proto.push=function push(chunk){this.lineStream.push(chunk);};_proto.end=function end(){this.lineStream.push("\n");this.trigger("end");};_proto.addParser=function addParser(options){this.parseStream.addParser(options);};_proto.addTagMapper=function addTagMapper(options){this.parseStream.addTagMapper(options);};return Parser}(Stream);
|
|
122
|
+
|
|
123
|
+
var regexs={mp4:/^(av0?1|avc0?[1234]|vp0?9|flac|opus|mp3|mp4a|mp4v|stpp.ttml.im1t)/,webm:/^(vp0?[89]|av0?1|opus|vorbis)/,ogg:/^(vp0?[89]|theora|flac|opus|vorbis)/,video:/^(av0?1|avc0?[1234]|vp0?[89]|hvc1|hev1|theora|mp4v)/,audio:/^(mp4a|flac|vorbis|opus|ac-[34]|ec-3|alac|mp3|speex|aac)/,text:/^(stpp.ttml.im1t)/,muxerVideo:/^(avc0?1)/,muxerAudio:/^(mp4a)/,muxerText:/a^/};var mediaTypes=["video","audio","text"];var upperMediaTypes=["Video","Audio","Text"];var translateLegacyCodec=function translateLegacyCodec(codec){if(!codec){return codec}return codec.replace(/avc1\.(\d+)\.(\d+)/i,function(orig,profile,avcLevel){var profileHex=("00"+Number(profile).toString(16)).slice(-2);var avcLevelHex=("00"+Number(avcLevel).toString(16)).slice(-2);return "avc1."+profileHex+"00"+avcLevelHex})};var parseCodecs=function parseCodecs(codecString){if(codecString===void 0){codecString="";}var codecs=codecString.split(",");var result=[];codecs.forEach(function(codec){codec=codec.trim();var codecType;mediaTypes.forEach(function(name){var match=regexs[name].exec(codec.toLowerCase());if(!match||match.length<=1){return}codecType=name;var type=codec.substring(0,match[1].length);var details=codec.replace(type,"");result.push({type:type,details:details,mediaType:name});});if(!codecType){result.push({type:codec,details:"",mediaType:"unknown"});}});return result};var codecsFromDefault=function codecsFromDefault(master,audioGroupId){if(!master.mediaGroups.AUDIO||!audioGroupId){return null}var audioGroup=master.mediaGroups.AUDIO[audioGroupId];if(!audioGroup){return null}for(var name in audioGroup){var audioType=audioGroup[name];if(audioType.default&&audioType.playlists){return parseCodecs(audioType.playlists[0].attributes.CODECS)}}return null};var isAudioCodec=function isAudioCodec(codec){if(codec===void 0){codec="";}return regexs.audio.test(codec.trim().toLowerCase())};var isTextCodec=function isTextCodec(codec){if(codec===void 0){codec="";}return regexs.text.test(codec.trim().toLowerCase())};var getMimeForCodec=function getMimeForCodec(codecString){if(!codecString||typeof codecString!=="string"){return}var codecs=codecString.toLowerCase().split(",").map(function(c){return translateLegacyCodec(c.trim())});var type="video";if(codecs.length===1&&isAudioCodec(codecs[0])){type="audio";}else if(codecs.length===1&&isTextCodec(codecs[0])){type="application";}var container="mp4";if(codecs.every(function(c){return regexs.mp4.test(c)})){container="mp4";}else if(codecs.every(function(c){return regexs.webm.test(c)})){container="webm";}else if(codecs.every(function(c){return regexs.ogg.test(c)})){container="ogg";}return type+"/"+container+';codecs="'+codecString+'"'};var browserSupportsCodec=function browserSupportsCodec(codecString){if(codecString===void 0){codecString="";}return window_1.MediaSource&&window_1.MediaSource.isTypeSupported&&window_1.MediaSource.isTypeSupported(getMimeForCodec(codecString))||false};var muxerSupportsCodec=function muxerSupportsCodec(codecString){if(codecString===void 0){codecString="";}return codecString.toLowerCase().split(",").every(function(codec){codec=codec.trim();for(var i=0;i<upperMediaTypes.length;i++){var type=upperMediaTypes[i];if(regexs["muxer"+type].test(codec)){return true}}return false})};var DEFAULT_AUDIO_CODEC="mp4a.40.2";var DEFAULT_VIDEO_CODEC="avc1.4d400d";
|
|
124
|
+
|
|
125
|
+
var MPEGURL_REGEX=/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i;var DASH_REGEX=/^application\/dash\+xml/i;var simpleTypeFromSourceType=function simpleTypeFromSourceType(type){if(MPEGURL_REGEX.test(type)){return "hls"}if(DASH_REGEX.test(type)){return "dash"}if(type==="application/vnd.videojs.vhs+json"){return "vhs-json"}return null};
|
|
126
|
+
|
|
127
|
+
var countBits=function countBits(x){return x.toString(2).length};var countBytes=function countBytes(x){return Math.ceil(countBits(x)/8)};var isArrayBufferView=function isArrayBufferView(obj){if(ArrayBuffer.isView==="function"){return ArrayBuffer.isView(obj)}return obj&&obj.buffer instanceof ArrayBuffer};var isTypedArray=function isTypedArray(obj){return isArrayBufferView(obj)};var toUint8=function toUint8(bytes){if(bytes instanceof Uint8Array){return bytes}if(!Array.isArray(bytes)&&!isTypedArray(bytes)&&!(bytes instanceof ArrayBuffer)){if(typeof bytes!=="number"||typeof bytes==="number"&&bytes!==bytes){bytes=0;}else {bytes=[bytes];}}return new Uint8Array(bytes&&bytes.buffer||bytes,bytes&&bytes.byteOffset||0,bytes&&bytes.byteLength||0)};var BigInt=window_1.BigInt||Number;var BYTE_TABLE=[BigInt("0x1"),BigInt("0x100"),BigInt("0x10000"),BigInt("0x1000000"),BigInt("0x100000000"),BigInt("0x10000000000"),BigInt("0x1000000000000"),BigInt("0x100000000000000"),BigInt("0x10000000000000000")];(function(){var a=new Uint16Array([65484]);var b=new Uint8Array(a.buffer,a.byteOffset,a.byteLength);if(b[0]===255){return "big"}if(b[0]===204){return "little"}return "unknown"})();var bytesToNumber=function bytesToNumber(bytes,_temp){var _ref=_temp===void 0?{}:_temp,_ref$signed=_ref.signed,signed=_ref$signed===void 0?false:_ref$signed,_ref$le=_ref.le,le=_ref$le===void 0?false:_ref$le;bytes=toUint8(bytes);var fn=le?"reduce":"reduceRight";var obj=bytes[fn]?bytes[fn]:Array.prototype[fn];var number=obj.call(bytes,function(total,byte,i){var exponent=le?i:Math.abs(i+1-bytes.length);return total+BigInt(byte)*BYTE_TABLE[exponent]},BigInt(0));if(signed){var max=BYTE_TABLE[bytes.length]/BigInt(2)-BigInt(1);number=BigInt(number);if(number>max){number-=max;number-=max;number-=BigInt(2);}}return Number(number)};var numberToBytes=function numberToBytes(number,_temp2){var _ref2=_temp2===void 0?{}:_temp2,_ref2$le=_ref2.le,le=_ref2$le===void 0?false:_ref2$le;if(typeof number!=="bigint"&&typeof number!=="number"||typeof number==="number"&&number!==number){number=0;}number=BigInt(number);var byteCount=countBytes(number);var bytes=new Uint8Array(new ArrayBuffer(byteCount));for(var i=0;i<byteCount;i++){var byteIndex=le?i:Math.abs(i+1-bytes.length);bytes[byteIndex]=Number(number/BYTE_TABLE[i]&BigInt(255));if(number<0){bytes[byteIndex]=Math.abs(~bytes[byteIndex]);bytes[byteIndex]-=i===0?1:2;}}return bytes};var stringToBytes=function stringToBytes(string,stringIsBytes){if(typeof string!=="string"&&string&&typeof string.toString==="function"){string=string.toString();}if(typeof string!=="string"){return new Uint8Array}if(!stringIsBytes){string=unescape(encodeURIComponent(string));}var view=new Uint8Array(string.length);for(var i=0;i<string.length;i++){view[i]=string.charCodeAt(i);}return view};var concatTypedArrays=function concatTypedArrays(){for(var _len=arguments.length,buffers=new Array(_len),_key=0;_key<_len;_key++){buffers[_key]=arguments[_key];}buffers=buffers.filter(function(b){return b&&(b.byteLength||b.length)&&typeof b!=="string"});if(buffers.length<=1){return toUint8(buffers[0])}var totalLen=buffers.reduce(function(total,buf,i){return total+(buf.byteLength||buf.length)},0);var tempBuffer=new Uint8Array(totalLen);var offset=0;buffers.forEach(function(buf){buf=toUint8(buf);tempBuffer.set(buf,offset);offset+=buf.byteLength;});return tempBuffer};var bytesMatch=function bytesMatch(a,b,_temp3){var _ref3=_temp3===void 0?{}:_temp3,_ref3$offset=_ref3.offset,offset=_ref3$offset===void 0?0:_ref3$offset,_ref3$mask=_ref3.mask,mask=_ref3$mask===void 0?[]:_ref3$mask;a=toUint8(a);b=toUint8(b);var fn=b.every?b.every:Array.prototype.every;return b.length&&a.length-offset>=b.length&&fn.call(b,function(bByte,i){var aByte=mask[i]?mask[i]&a[offset+i]:a[offset+i];return bByte===aByte})};
|
|
128
|
+
|
|
129
|
+
var forEachMediaGroup$1=function forEachMediaGroup(master,groups,callback){groups.forEach(function(mediaType){for(var groupKey in master.mediaGroups[mediaType]){for(var labelKey in master.mediaGroups[mediaType][groupKey]){var mediaProperties=master.mediaGroups[mediaType][groupKey][labelKey];callback(mediaProperties,mediaType,groupKey,labelKey);}}});};
|
|
130
|
+
|
|
131
|
+
var dom$1 = {};
|
|
132
|
+
|
|
133
|
+
var conventions$2 = {};
|
|
134
|
+
|
|
135
|
+
function find$1(list,predicate,ac){if(ac===undefined){ac=Array.prototype;}if(list&&typeof ac.find==="function"){return ac.find.call(list,predicate)}for(var i=0;i<list.length;i++){if(Object.prototype.hasOwnProperty.call(list,i)){var item=list[i];if(predicate.call(undefined,item,i,list)){return item}}}}function freeze(object,oc){if(oc===undefined){oc=Object;}return oc&&typeof oc.freeze==="function"?oc.freeze(object):object}function assign$1(target,source){if(target===null||typeof target!=="object"){throw new TypeError("target is not an object")}for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}return target}var MIME_TYPE=freeze({HTML:"text/html",isHTML:function(value){return value===MIME_TYPE.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"});var NAMESPACE$3=freeze({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(uri){return uri===NAMESPACE$3.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});conventions$2.assign=assign$1;conventions$2.find=find$1;conventions$2.freeze=freeze;conventions$2.MIME_TYPE=MIME_TYPE;conventions$2.NAMESPACE=NAMESPACE$3;
|
|
136
|
+
|
|
137
|
+
var conventions$1=conventions$2;var find=conventions$1.find;var NAMESPACE$2=conventions$1.NAMESPACE;function notEmptyString(input){return input!==""}function splitOnASCIIWhitespace(input){return input?input.split(/[\t\n\f\r ]+/).filter(notEmptyString):[]}function orderedSetReducer(current,element){if(!current.hasOwnProperty(element)){current[element]=true;}return current}function toOrderedSet(input){if(!input)return [];var list=splitOnASCIIWhitespace(input);return Object.keys(list.reduce(orderedSetReducer,{}))}function arrayIncludes(list){return function(element){return list&&list.indexOf(element)!==-1}}function copy(src,dest){for(var p in src){if(Object.prototype.hasOwnProperty.call(src,p)){dest[p]=src[p];}}}function _extends(Class,Super){var pt=Class.prototype;if(!(pt instanceof Super)){function t(){}t.prototype=Super.prototype;t=new t;copy(pt,t);Class.prototype=pt=t;}if(pt.constructor!=Class){if(typeof Class!="function"){console.error("unknown Class:"+Class);}pt.constructor=Class;}}var NodeType={};var ELEMENT_NODE=NodeType.ELEMENT_NODE=1;var ATTRIBUTE_NODE=NodeType.ATTRIBUTE_NODE=2;var TEXT_NODE=NodeType.TEXT_NODE=3;var CDATA_SECTION_NODE=NodeType.CDATA_SECTION_NODE=4;var ENTITY_REFERENCE_NODE=NodeType.ENTITY_REFERENCE_NODE=5;var ENTITY_NODE=NodeType.ENTITY_NODE=6;var PROCESSING_INSTRUCTION_NODE=NodeType.PROCESSING_INSTRUCTION_NODE=7;var COMMENT_NODE=NodeType.COMMENT_NODE=8;var DOCUMENT_NODE=NodeType.DOCUMENT_NODE=9;var DOCUMENT_TYPE_NODE=NodeType.DOCUMENT_TYPE_NODE=10;var DOCUMENT_FRAGMENT_NODE=NodeType.DOCUMENT_FRAGMENT_NODE=11;var NOTATION_NODE=NodeType.NOTATION_NODE=12;var ExceptionCode={};var ExceptionMessage={};ExceptionCode.INDEX_SIZE_ERR=(ExceptionMessage[1]="Index size error",1);ExceptionCode.DOMSTRING_SIZE_ERR=(ExceptionMessage[2]="DOMString size error",2);var HIERARCHY_REQUEST_ERR=ExceptionCode.HIERARCHY_REQUEST_ERR=(ExceptionMessage[3]="Hierarchy request error",3);ExceptionCode.WRONG_DOCUMENT_ERR=(ExceptionMessage[4]="Wrong document",4);ExceptionCode.INVALID_CHARACTER_ERR=(ExceptionMessage[5]="Invalid character",5);ExceptionCode.NO_DATA_ALLOWED_ERR=(ExceptionMessage[6]="No data allowed",6);ExceptionCode.NO_MODIFICATION_ALLOWED_ERR=(ExceptionMessage[7]="No modification allowed",7);var NOT_FOUND_ERR=ExceptionCode.NOT_FOUND_ERR=(ExceptionMessage[8]="Not found",8);ExceptionCode.NOT_SUPPORTED_ERR=(ExceptionMessage[9]="Not supported",9);var INUSE_ATTRIBUTE_ERR=ExceptionCode.INUSE_ATTRIBUTE_ERR=(ExceptionMessage[10]="Attribute in use",10);ExceptionCode.INVALID_STATE_ERR=(ExceptionMessage[11]="Invalid state",11);ExceptionCode.SYNTAX_ERR=(ExceptionMessage[12]="Syntax error",12);ExceptionCode.INVALID_MODIFICATION_ERR=(ExceptionMessage[13]="Invalid modification",13);ExceptionCode.NAMESPACE_ERR=(ExceptionMessage[14]="Invalid namespace",14);ExceptionCode.INVALID_ACCESS_ERR=(ExceptionMessage[15]="Invalid access",15);function DOMException(code,message){if(message instanceof Error){var error=message;}else {error=this;Error.call(this,ExceptionMessage[code]);this.message=ExceptionMessage[code];if(Error.captureStackTrace)Error.captureStackTrace(this,DOMException);}error.code=code;if(message)this.message=this.message+": "+message;return error}DOMException.prototype=Error.prototype;copy(ExceptionCode,DOMException);function NodeList(){}NodeList.prototype={length:0,item:function(index){return index>=0&&index<this.length?this[index]:null},toString:function(isHTML,nodeFilter){for(var buf=[],i=0;i<this.length;i++){serializeToString(this[i],buf,isHTML,nodeFilter);}return buf.join("")},filter:function(predicate){return Array.prototype.filter.call(this,predicate)},indexOf:function(item){return Array.prototype.indexOf.call(this,item)}};function LiveNodeList(node,refresh){this._node=node;this._refresh=refresh;_updateLiveList(this);}function _updateLiveList(list){var inc=list._node._inc||list._node.ownerDocument._inc;if(list._inc!==inc){var ls=list._refresh(list._node);__set__(list,"length",ls.length);if(!list.$$length||ls.length<list.$$length){for(var i=ls.length;i in list;i++){if(Object.prototype.hasOwnProperty.call(list,i)){delete list[i];}}}copy(ls,list);list._inc=inc;}}LiveNodeList.prototype.item=function(i){_updateLiveList(this);return this[i]||null};_extends(LiveNodeList,NodeList);function NamedNodeMap(){}function _findNodeIndex(list,node){var i=list.length;while(i--){if(list[i]===node){return i}}}function _addNamedNode(el,list,newAttr,oldAttr){if(oldAttr){list[_findNodeIndex(list,oldAttr)]=newAttr;}else {list[list.length++]=newAttr;}if(el){newAttr.ownerElement=el;var doc=el.ownerDocument;if(doc){oldAttr&&_onRemoveAttribute(doc,el,oldAttr);_onAddAttribute(doc,el,newAttr);}}}function _removeNamedNode(el,list,attr){var i=_findNodeIndex(list,attr);if(i>=0){var lastIndex=list.length-1;while(i<lastIndex){list[i]=list[++i];}list.length=lastIndex;if(el){var doc=el.ownerDocument;if(doc){_onRemoveAttribute(doc,el,attr);attr.ownerElement=null;}}}else {throw new DOMException(NOT_FOUND_ERR,new Error(el.tagName+"@"+attr))}}NamedNodeMap.prototype={length:0,item:NodeList.prototype.item,getNamedItem:function(key){var i=this.length;while(i--){var attr=this[i];if(attr.nodeName==key){return attr}}},setNamedItem:function(attr){var el=attr.ownerElement;if(el&&el!=this._ownerElement){throw new DOMException(INUSE_ATTRIBUTE_ERR)}var oldAttr=this.getNamedItem(attr.nodeName);_addNamedNode(this._ownerElement,this,attr,oldAttr);return oldAttr},setNamedItemNS:function(attr){var el=attr.ownerElement,oldAttr;if(el&&el!=this._ownerElement){throw new DOMException(INUSE_ATTRIBUTE_ERR)}oldAttr=this.getNamedItemNS(attr.namespaceURI,attr.localName);_addNamedNode(this._ownerElement,this,attr,oldAttr);return oldAttr},removeNamedItem:function(key){var attr=this.getNamedItem(key);_removeNamedNode(this._ownerElement,this,attr);return attr},removeNamedItemNS:function(namespaceURI,localName){var attr=this.getNamedItemNS(namespaceURI,localName);_removeNamedNode(this._ownerElement,this,attr);return attr},getNamedItemNS:function(namespaceURI,localName){var i=this.length;while(i--){var node=this[i];if(node.localName==localName&&node.namespaceURI==namespaceURI){return node}}return null}};function DOMImplementation$1(){}DOMImplementation$1.prototype={hasFeature:function(feature,version){return true},createDocument:function(namespaceURI,qualifiedName,doctype){var doc=new Document;doc.implementation=this;doc.childNodes=new NodeList;doc.doctype=doctype||null;if(doctype){doc.appendChild(doctype);}if(qualifiedName){var root=doc.createElementNS(namespaceURI,qualifiedName);doc.appendChild(root);}return doc},createDocumentType:function(qualifiedName,publicId,systemId){var node=new DocumentType;node.name=qualifiedName;node.nodeName=qualifiedName;node.publicId=publicId||"";node.systemId=systemId||"";return node}};function Node(){}Node.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(newChild,refChild){return _insertBefore(this,newChild,refChild)},replaceChild:function(newChild,oldChild){_insertBefore(this,newChild,oldChild,assertPreReplacementValidityInDocument);if(oldChild){this.removeChild(oldChild);}},removeChild:function(oldChild){return _removeChild(this,oldChild)},appendChild:function(newChild){return this.insertBefore(newChild,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(deep){return cloneNode(this.ownerDocument||this,this,deep)},normalize:function(){var child=this.firstChild;while(child){var next=child.nextSibling;if(next&&next.nodeType==TEXT_NODE&&child.nodeType==TEXT_NODE){this.removeChild(next);child.appendData(next.data);}else {child.normalize();child=next;}}},isSupported:function(feature,version){return this.ownerDocument.implementation.hasFeature(feature,version)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(namespaceURI){var el=this;while(el){var map=el._nsMap;if(map){for(var n in map){if(Object.prototype.hasOwnProperty.call(map,n)&&map[n]===namespaceURI){return n}}}el=el.nodeType==ATTRIBUTE_NODE?el.ownerDocument:el.parentNode;}return null},lookupNamespaceURI:function(prefix){var el=this;while(el){var map=el._nsMap;if(map){if(Object.prototype.hasOwnProperty.call(map,prefix)){return map[prefix]}}el=el.nodeType==ATTRIBUTE_NODE?el.ownerDocument:el.parentNode;}return null},isDefaultNamespace:function(namespaceURI){var prefix=this.lookupPrefix(namespaceURI);return prefix==null}};function _xmlEncoder(c){return c=="<"&&"<"||c==">"&&">"||c=="&"&&"&"||c=='"'&&"""||"&#"+c.charCodeAt()+";"}copy(NodeType,Node);copy(NodeType,Node.prototype);function _visitNode(node,callback){if(callback(node)){return true}if(node=node.firstChild){do{if(_visitNode(node,callback)){return true}}while(node=node.nextSibling)}}function Document(){this.ownerDocument=this;}function _onAddAttribute(doc,el,newAttr){doc&&doc._inc++;var ns=newAttr.namespaceURI;if(ns===NAMESPACE$2.XMLNS){el._nsMap[newAttr.prefix?newAttr.localName:""]=newAttr.value;}}function _onRemoveAttribute(doc,el,newAttr,remove){doc&&doc._inc++;var ns=newAttr.namespaceURI;if(ns===NAMESPACE$2.XMLNS){delete el._nsMap[newAttr.prefix?newAttr.localName:""];}}function _onUpdateChild(doc,el,newChild){if(doc&&doc._inc){doc._inc++;var cs=el.childNodes;if(newChild){cs[cs.length++]=newChild;}else {var child=el.firstChild;var i=0;while(child){cs[i++]=child;child=child.nextSibling;}cs.length=i;delete cs[cs.length];}}}function _removeChild(parentNode,child){var previous=child.previousSibling;var next=child.nextSibling;if(previous){previous.nextSibling=next;}else {parentNode.firstChild=next;}if(next){next.previousSibling=previous;}else {parentNode.lastChild=previous;}child.parentNode=null;child.previousSibling=null;child.nextSibling=null;_onUpdateChild(parentNode.ownerDocument,parentNode);return child}function hasValidParentNodeType(node){return node&&(node.nodeType===Node.DOCUMENT_NODE||node.nodeType===Node.DOCUMENT_FRAGMENT_NODE||node.nodeType===Node.ELEMENT_NODE)}function hasInsertableNodeType(node){return node&&(isElementNode(node)||isTextNode$1(node)||isDocTypeNode(node)||node.nodeType===Node.DOCUMENT_FRAGMENT_NODE||node.nodeType===Node.COMMENT_NODE||node.nodeType===Node.PROCESSING_INSTRUCTION_NODE)}function isDocTypeNode(node){return node&&node.nodeType===Node.DOCUMENT_TYPE_NODE}function isElementNode(node){return node&&node.nodeType===Node.ELEMENT_NODE}function isTextNode$1(node){return node&&node.nodeType===Node.TEXT_NODE}function isElementInsertionPossible(doc,child){var parentChildNodes=doc.childNodes||[];if(find(parentChildNodes,isElementNode)||isDocTypeNode(child)){return false}var docTypeNode=find(parentChildNodes,isDocTypeNode);return !(child&&docTypeNode&&parentChildNodes.indexOf(docTypeNode)>parentChildNodes.indexOf(child))}function isElementReplacementPossible(doc,child){var parentChildNodes=doc.childNodes||[];function hasElementChildThatIsNotChild(node){return isElementNode(node)&&node!==child}if(find(parentChildNodes,hasElementChildThatIsNotChild)){return false}var docTypeNode=find(parentChildNodes,isDocTypeNode);return !(child&&docTypeNode&&parentChildNodes.indexOf(docTypeNode)>parentChildNodes.indexOf(child))}function assertPreInsertionValidity1to5(parent,node,child){if(!hasValidParentNodeType(parent)){throw new DOMException(HIERARCHY_REQUEST_ERR,"Unexpected parent node type "+parent.nodeType)}if(child&&child.parentNode!==parent){throw new DOMException(NOT_FOUND_ERR,"child not in parent")}if(!hasInsertableNodeType(node)||isDocTypeNode(node)&&parent.nodeType!==Node.DOCUMENT_NODE){throw new DOMException(HIERARCHY_REQUEST_ERR,"Unexpected node type "+node.nodeType+" for parent node type "+parent.nodeType)}}function assertPreInsertionValidityInDocument(parent,node,child){var parentChildNodes=parent.childNodes||[];var nodeChildNodes=node.childNodes||[];if(node.nodeType===Node.DOCUMENT_FRAGMENT_NODE){var nodeChildElements=nodeChildNodes.filter(isElementNode);if(nodeChildElements.length>1||find(nodeChildNodes,isTextNode$1)){throw new DOMException(HIERARCHY_REQUEST_ERR,"More than one element or text in fragment")}if(nodeChildElements.length===1&&!isElementInsertionPossible(parent,child)){throw new DOMException(HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}}if(isElementNode(node)){if(!isElementInsertionPossible(parent,child)){throw new DOMException(HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype")}}if(isDocTypeNode(node)){if(find(parentChildNodes,isDocTypeNode)){throw new DOMException(HIERARCHY_REQUEST_ERR,"Only one doctype is allowed")}var parentElementChild=find(parentChildNodes,isElementNode);if(child&&parentChildNodes.indexOf(parentElementChild)<parentChildNodes.indexOf(child)){throw new DOMException(HIERARCHY_REQUEST_ERR,"Doctype can only be inserted before an element")}if(!child&&parentElementChild){throw new DOMException(HIERARCHY_REQUEST_ERR,"Doctype can not be appended since element is present")}}}function assertPreReplacementValidityInDocument(parent,node,child){var parentChildNodes=parent.childNodes||[];var nodeChildNodes=node.childNodes||[];if(node.nodeType===Node.DOCUMENT_FRAGMENT_NODE){var nodeChildElements=nodeChildNodes.filter(isElementNode);if(nodeChildElements.length>1||find(nodeChildNodes,isTextNode$1)){throw new DOMException(HIERARCHY_REQUEST_ERR,"More than one element or text in fragment")}if(nodeChildElements.length===1&&!isElementReplacementPossible(parent,child)){throw new DOMException(HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}}if(isElementNode(node)){if(!isElementReplacementPossible(parent,child)){throw new DOMException(HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype")}}if(isDocTypeNode(node)){function hasDoctypeChildThatIsNotChild(node){return isDocTypeNode(node)&&node!==child}if(find(parentChildNodes,hasDoctypeChildThatIsNotChild)){throw new DOMException(HIERARCHY_REQUEST_ERR,"Only one doctype is allowed")}var parentElementChild=find(parentChildNodes,isElementNode);if(child&&parentChildNodes.indexOf(parentElementChild)<parentChildNodes.indexOf(child)){throw new DOMException(HIERARCHY_REQUEST_ERR,"Doctype can only be inserted before an element")}}}function _insertBefore(parent,node,child,_inDocumentAssertion){assertPreInsertionValidity1to5(parent,node,child);if(parent.nodeType===Node.DOCUMENT_NODE){(_inDocumentAssertion||assertPreInsertionValidityInDocument)(parent,node,child);}var cp=node.parentNode;if(cp){cp.removeChild(node);}if(node.nodeType===DOCUMENT_FRAGMENT_NODE){var newFirst=node.firstChild;if(newFirst==null){return node}var newLast=node.lastChild;}else {newFirst=newLast=node;}var pre=child?child.previousSibling:parent.lastChild;newFirst.previousSibling=pre;newLast.nextSibling=child;if(pre){pre.nextSibling=newFirst;}else {parent.firstChild=newFirst;}if(child==null){parent.lastChild=newLast;}else {child.previousSibling=newLast;}do{newFirst.parentNode=parent;}while(newFirst!==newLast&&(newFirst=newFirst.nextSibling));_onUpdateChild(parent.ownerDocument||parent,parent);if(node.nodeType==DOCUMENT_FRAGMENT_NODE){node.firstChild=node.lastChild=null;}return node}function _appendSingleChild(parentNode,newChild){if(newChild.parentNode){newChild.parentNode.removeChild(newChild);}newChild.parentNode=parentNode;newChild.previousSibling=parentNode.lastChild;newChild.nextSibling=null;if(newChild.previousSibling){newChild.previousSibling.nextSibling=newChild;}else {parentNode.firstChild=newChild;}parentNode.lastChild=newChild;_onUpdateChild(parentNode.ownerDocument,parentNode,newChild);return newChild}Document.prototype={nodeName:"#document",nodeType:DOCUMENT_NODE,doctype:null,documentElement:null,_inc:1,insertBefore:function(newChild,refChild){if(newChild.nodeType==DOCUMENT_FRAGMENT_NODE){var child=newChild.firstChild;while(child){var next=child.nextSibling;this.insertBefore(child,refChild);child=next;}return newChild}_insertBefore(this,newChild,refChild);newChild.ownerDocument=this;if(this.documentElement===null&&newChild.nodeType===ELEMENT_NODE){this.documentElement=newChild;}return newChild},removeChild:function(oldChild){if(this.documentElement==oldChild){this.documentElement=null;}return _removeChild(this,oldChild)},replaceChild:function(newChild,oldChild){_insertBefore(this,newChild,oldChild,assertPreReplacementValidityInDocument);newChild.ownerDocument=this;if(oldChild){this.removeChild(oldChild);}if(isElementNode(newChild)){this.documentElement=newChild;}},importNode:function(importedNode,deep){return importNode(this,importedNode,deep)},getElementById:function(id){var rtv=null;_visitNode(this.documentElement,function(node){if(node.nodeType==ELEMENT_NODE){if(node.getAttribute("id")==id){rtv=node;return true}}});return rtv},getElementsByClassName:function(classNames){var classNamesSet=toOrderedSet(classNames);return new LiveNodeList(this,function(base){var ls=[];if(classNamesSet.length>0){_visitNode(base.documentElement,function(node){if(node!==base&&node.nodeType===ELEMENT_NODE){var nodeClassNames=node.getAttribute("class");if(nodeClassNames){var matches=classNames===nodeClassNames;if(!matches){var nodeClassNamesSet=toOrderedSet(nodeClassNames);matches=classNamesSet.every(arrayIncludes(nodeClassNamesSet));}if(matches){ls.push(node);}}}});}return ls})},createElement:function(tagName){var node=new Element;node.ownerDocument=this;node.nodeName=tagName;node.tagName=tagName;node.localName=tagName;node.childNodes=new NodeList;var attrs=node.attributes=new NamedNodeMap;attrs._ownerElement=node;return node},createDocumentFragment:function(){var node=new DocumentFragment;node.ownerDocument=this;node.childNodes=new NodeList;return node},createTextNode:function(data){var node=new Text;node.ownerDocument=this;node.appendData(data);return node},createComment:function(data){var node=new Comment;node.ownerDocument=this;node.appendData(data);return node},createCDATASection:function(data){var node=new CDATASection;node.ownerDocument=this;node.appendData(data);return node},createProcessingInstruction:function(target,data){var node=new ProcessingInstruction;node.ownerDocument=this;node.tagName=node.nodeName=node.target=target;node.nodeValue=node.data=data;return node},createAttribute:function(name){var node=new Attr;node.ownerDocument=this;node.name=name;node.nodeName=name;node.localName=name;node.specified=true;return node},createEntityReference:function(name){var node=new EntityReference;node.ownerDocument=this;node.nodeName=name;return node},createElementNS:function(namespaceURI,qualifiedName){var node=new Element;var pl=qualifiedName.split(":");var attrs=node.attributes=new NamedNodeMap;node.childNodes=new NodeList;node.ownerDocument=this;node.nodeName=qualifiedName;node.tagName=qualifiedName;node.namespaceURI=namespaceURI;if(pl.length==2){node.prefix=pl[0];node.localName=pl[1];}else {node.localName=qualifiedName;}attrs._ownerElement=node;return node},createAttributeNS:function(namespaceURI,qualifiedName){var node=new Attr;var pl=qualifiedName.split(":");node.ownerDocument=this;node.nodeName=qualifiedName;node.name=qualifiedName;node.namespaceURI=namespaceURI;node.specified=true;if(pl.length==2){node.prefix=pl[0];node.localName=pl[1];}else {node.localName=qualifiedName;}return node}};_extends(Document,Node);function Element(){this._nsMap={};}Element.prototype={nodeType:ELEMENT_NODE,hasAttribute:function(name){return this.getAttributeNode(name)!=null},getAttribute:function(name){var attr=this.getAttributeNode(name);return attr&&attr.value||""},getAttributeNode:function(name){return this.attributes.getNamedItem(name)},setAttribute:function(name,value){var attr=this.ownerDocument.createAttribute(name);attr.value=attr.nodeValue=""+value;this.setAttributeNode(attr);},removeAttribute:function(name){var attr=this.getAttributeNode(name);attr&&this.removeAttributeNode(attr);},appendChild:function(newChild){if(newChild.nodeType===DOCUMENT_FRAGMENT_NODE){return this.insertBefore(newChild,null)}else {return _appendSingleChild(this,newChild)}},setAttributeNode:function(newAttr){return this.attributes.setNamedItem(newAttr)},setAttributeNodeNS:function(newAttr){return this.attributes.setNamedItemNS(newAttr)},removeAttributeNode:function(oldAttr){return this.attributes.removeNamedItem(oldAttr.nodeName)},removeAttributeNS:function(namespaceURI,localName){var old=this.getAttributeNodeNS(namespaceURI,localName);old&&this.removeAttributeNode(old);},hasAttributeNS:function(namespaceURI,localName){return this.getAttributeNodeNS(namespaceURI,localName)!=null},getAttributeNS:function(namespaceURI,localName){var attr=this.getAttributeNodeNS(namespaceURI,localName);return attr&&attr.value||""},setAttributeNS:function(namespaceURI,qualifiedName,value){var attr=this.ownerDocument.createAttributeNS(namespaceURI,qualifiedName);attr.value=attr.nodeValue=""+value;this.setAttributeNode(attr);},getAttributeNodeNS:function(namespaceURI,localName){return this.attributes.getNamedItemNS(namespaceURI,localName)},getElementsByTagName:function(tagName){return new LiveNodeList(this,function(base){var ls=[];_visitNode(base,function(node){if(node!==base&&node.nodeType==ELEMENT_NODE&&(tagName==="*"||node.tagName==tagName)){ls.push(node);}});return ls})},getElementsByTagNameNS:function(namespaceURI,localName){return new LiveNodeList(this,function(base){var ls=[];_visitNode(base,function(node){if(node!==base&&node.nodeType===ELEMENT_NODE&&(namespaceURI==="*"||node.namespaceURI===namespaceURI)&&(localName==="*"||node.localName==localName)){ls.push(node);}});return ls})}};Document.prototype.getElementsByTagName=Element.prototype.getElementsByTagName;Document.prototype.getElementsByTagNameNS=Element.prototype.getElementsByTagNameNS;_extends(Element,Node);function Attr(){}Attr.prototype.nodeType=ATTRIBUTE_NODE;_extends(Attr,Node);function CharacterData(){}CharacterData.prototype={data:"",substringData:function(offset,count){return this.data.substring(offset,offset+count)},appendData:function(text){text=this.data+text;this.nodeValue=this.data=text;this.length=text.length;},insertData:function(offset,text){this.replaceData(offset,0,text);},appendChild:function(newChild){throw new Error(ExceptionMessage[HIERARCHY_REQUEST_ERR])},deleteData:function(offset,count){this.replaceData(offset,count,"");},replaceData:function(offset,count,text){var start=this.data.substring(0,offset);var end=this.data.substring(offset+count);text=start+text+end;this.nodeValue=this.data=text;this.length=text.length;}};_extends(CharacterData,Node);function Text(){}Text.prototype={nodeName:"#text",nodeType:TEXT_NODE,splitText:function(offset){var text=this.data;var newText=text.substring(offset);text=text.substring(0,offset);this.data=this.nodeValue=text;this.length=text.length;var newNode=this.ownerDocument.createTextNode(newText);if(this.parentNode){this.parentNode.insertBefore(newNode,this.nextSibling);}return newNode}};_extends(Text,CharacterData);function Comment(){}Comment.prototype={nodeName:"#comment",nodeType:COMMENT_NODE};_extends(Comment,CharacterData);function CDATASection(){}CDATASection.prototype={nodeName:"#cdata-section",nodeType:CDATA_SECTION_NODE};_extends(CDATASection,CharacterData);function DocumentType(){}DocumentType.prototype.nodeType=DOCUMENT_TYPE_NODE;_extends(DocumentType,Node);function Notation(){}Notation.prototype.nodeType=NOTATION_NODE;_extends(Notation,Node);function Entity(){}Entity.prototype.nodeType=ENTITY_NODE;_extends(Entity,Node);function EntityReference(){}EntityReference.prototype.nodeType=ENTITY_REFERENCE_NODE;_extends(EntityReference,Node);function DocumentFragment(){}DocumentFragment.prototype.nodeName="#document-fragment";DocumentFragment.prototype.nodeType=DOCUMENT_FRAGMENT_NODE;_extends(DocumentFragment,Node);function ProcessingInstruction(){}ProcessingInstruction.prototype.nodeType=PROCESSING_INSTRUCTION_NODE;_extends(ProcessingInstruction,Node);function XMLSerializer(){}XMLSerializer.prototype.serializeToString=function(node,isHtml,nodeFilter){return nodeSerializeToString.call(node,isHtml,nodeFilter)};Node.prototype.toString=nodeSerializeToString;function nodeSerializeToString(isHtml,nodeFilter){var buf=[];var refNode=this.nodeType==9&&this.documentElement||this;var prefix=refNode.prefix;var uri=refNode.namespaceURI;if(uri&&prefix==null){var prefix=refNode.lookupPrefix(uri);if(prefix==null){var visibleNamespaces=[{namespace:uri,prefix:null}];}}serializeToString(this,buf,isHtml,nodeFilter,visibleNamespaces);return buf.join("")}function needNamespaceDefine(node,isHTML,visibleNamespaces){var prefix=node.prefix||"";var uri=node.namespaceURI;if(!uri){return false}if(prefix==="xml"&&uri===NAMESPACE$2.XML||uri===NAMESPACE$2.XMLNS){return false}var i=visibleNamespaces.length;while(i--){var ns=visibleNamespaces[i];if(ns.prefix===prefix){return ns.namespace!==uri}}return true}function addSerializedAttribute(buf,qualifiedName,value){buf.push(" ",qualifiedName,'="',value.replace(/[<>&"\t\n\r]/g,_xmlEncoder),'"');}function serializeToString(node,buf,isHTML,nodeFilter,visibleNamespaces){if(!visibleNamespaces){visibleNamespaces=[];}if(nodeFilter){node=nodeFilter(node);if(node){if(typeof node=="string"){buf.push(node);return}}else {return}}switch(node.nodeType){case ELEMENT_NODE:var attrs=node.attributes;var len=attrs.length;var child=node.firstChild;var nodeName=node.tagName;isHTML=NAMESPACE$2.isHTML(node.namespaceURI)||isHTML;var prefixedNodeName=nodeName;if(!isHTML&&!node.prefix&&node.namespaceURI){var defaultNS;for(var ai=0;ai<attrs.length;ai++){if(attrs.item(ai).name==="xmlns"){defaultNS=attrs.item(ai).value;break}}if(!defaultNS){for(var nsi=visibleNamespaces.length-1;nsi>=0;nsi--){var namespace=visibleNamespaces[nsi];if(namespace.prefix===""&&namespace.namespace===node.namespaceURI){defaultNS=namespace.namespace;break}}}if(defaultNS!==node.namespaceURI){for(var nsi=visibleNamespaces.length-1;nsi>=0;nsi--){var namespace=visibleNamespaces[nsi];if(namespace.namespace===node.namespaceURI){if(namespace.prefix){prefixedNodeName=namespace.prefix+":"+nodeName;}break}}}}buf.push("<",prefixedNodeName);for(var i=0;i<len;i++){var attr=attrs.item(i);if(attr.prefix=="xmlns"){visibleNamespaces.push({prefix:attr.localName,namespace:attr.value});}else if(attr.nodeName=="xmlns"){visibleNamespaces.push({prefix:"",namespace:attr.value});}}for(var i=0;i<len;i++){var attr=attrs.item(i);if(needNamespaceDefine(attr,isHTML,visibleNamespaces)){var prefix=attr.prefix||"";var uri=attr.namespaceURI;addSerializedAttribute(buf,prefix?"xmlns:"+prefix:"xmlns",uri);visibleNamespaces.push({prefix:prefix,namespace:uri});}serializeToString(attr,buf,isHTML,nodeFilter,visibleNamespaces);}if(nodeName===prefixedNodeName&&needNamespaceDefine(node,isHTML,visibleNamespaces)){var prefix=node.prefix||"";var uri=node.namespaceURI;addSerializedAttribute(buf,prefix?"xmlns:"+prefix:"xmlns",uri);visibleNamespaces.push({prefix:prefix,namespace:uri});}if(child||isHTML&&!/^(?:meta|link|img|br|hr|input)$/i.test(nodeName)){buf.push(">");if(isHTML&&/^script$/i.test(nodeName)){while(child){if(child.data){buf.push(child.data);}else {serializeToString(child,buf,isHTML,nodeFilter,visibleNamespaces.slice());}child=child.nextSibling;}}else {while(child){serializeToString(child,buf,isHTML,nodeFilter,visibleNamespaces.slice());child=child.nextSibling;}}buf.push("</",prefixedNodeName,">");}else {buf.push("/>");}return;case DOCUMENT_NODE:case DOCUMENT_FRAGMENT_NODE:var child=node.firstChild;while(child){serializeToString(child,buf,isHTML,nodeFilter,visibleNamespaces.slice());child=child.nextSibling;}return;case ATTRIBUTE_NODE:return addSerializedAttribute(buf,node.name,node.value);case TEXT_NODE:return buf.push(node.data.replace(/[<&>]/g,_xmlEncoder));case CDATA_SECTION_NODE:return buf.push("<![CDATA[",node.data,"]]>");case COMMENT_NODE:return buf.push("<!--",node.data,"-->");case DOCUMENT_TYPE_NODE:var pubid=node.publicId;var sysid=node.systemId;buf.push("<!DOCTYPE ",node.name);if(pubid){buf.push(" PUBLIC ",pubid);if(sysid&&sysid!="."){buf.push(" ",sysid);}buf.push(">");}else if(sysid&&sysid!="."){buf.push(" SYSTEM ",sysid,">");}else {var sub=node.internalSubset;if(sub){buf.push(" [",sub,"]");}buf.push(">");}return;case PROCESSING_INSTRUCTION_NODE:return buf.push("<?",node.target," ",node.data,"?>");case ENTITY_REFERENCE_NODE:return buf.push("&",node.nodeName,";");default:buf.push("??",node.nodeName);}}function importNode(doc,node,deep){var node2;switch(node.nodeType){case ELEMENT_NODE:node2=node.cloneNode(false);node2.ownerDocument=doc;case DOCUMENT_FRAGMENT_NODE:break;case ATTRIBUTE_NODE:deep=true;break}if(!node2){node2=node.cloneNode(false);}node2.ownerDocument=doc;node2.parentNode=null;if(deep){var child=node.firstChild;while(child){node2.appendChild(importNode(doc,child,deep));child=child.nextSibling;}}return node2}function cloneNode(doc,node,deep){var node2=new node.constructor;for(var n in node){if(Object.prototype.hasOwnProperty.call(node,n)){var v=node[n];if(typeof v!="object"){if(v!=node2[n]){node2[n]=v;}}}}if(node.childNodes){node2.childNodes=new NodeList;}node2.ownerDocument=doc;switch(node2.nodeType){case ELEMENT_NODE:var attrs=node.attributes;var attrs2=node2.attributes=new NamedNodeMap;var len=attrs.length;attrs2._ownerElement=node2;for(var i=0;i<len;i++){node2.setAttributeNode(cloneNode(doc,attrs.item(i),true));}break;case ATTRIBUTE_NODE:deep=true;}if(deep){var child=node.firstChild;while(child){node2.appendChild(cloneNode(doc,child,deep));child=child.nextSibling;}}return node2}function __set__(object,key,value){object[key]=value;}try{if(Object.defineProperty){Object.defineProperty(LiveNodeList.prototype,"length",{get:function(){_updateLiveList(this);return this.$$length}});Object.defineProperty(Node.prototype,"textContent",{get:function(){return getTextContent(this)},set:function(data){switch(this.nodeType){case ELEMENT_NODE:case DOCUMENT_FRAGMENT_NODE:while(this.firstChild){this.removeChild(this.firstChild);}if(data||String(data)){this.appendChild(this.ownerDocument.createTextNode(data));}break;default:this.data=data;this.value=data;this.nodeValue=data;}}});function getTextContent(node){switch(node.nodeType){case ELEMENT_NODE:case DOCUMENT_FRAGMENT_NODE:var buf=[];node=node.firstChild;while(node){if(node.nodeType!==7&&node.nodeType!==8){buf.push(getTextContent(node));}node=node.nextSibling;}return buf.join("");default:return node.nodeValue}}__set__=function(object,key,value){object["$$"+key]=value;};}}catch(e){}dom$1.DocumentType=DocumentType;dom$1.DOMException=DOMException;dom$1.DOMImplementation=DOMImplementation$1;dom$1.Element=Element;dom$1.Node=Node;dom$1.NodeList=NodeList;dom$1.XMLSerializer=XMLSerializer;
|
|
138
|
+
|
|
139
|
+
var domParser = {};
|
|
140
|
+
|
|
141
|
+
var entities$1 = {};
|
|
142
|
+
|
|
143
|
+
(function(exports){var freeze=conventions$2.freeze;exports.XML_ENTITIES=freeze({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'});exports.HTML_ENTITIES=freeze({Aacute:"\xc1",aacute:"\xe1",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"\xc2",acirc:"\xe2",acute:"\xb4",Acy:"А",acy:"а",AElig:"\xc6",aelig:"\xe6",af:"",Afr:"\uD835\uDD04",afr:"\uD835\uDD1E",Agrave:"\xc0",agrave:"\xe0",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"\xc5",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"\uD835\uDD38",aopf:"\uD835\uDD52",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"",approx:"≈",approxeq:"≊",Aring:"\xc5",aring:"\xe5",Ascr:"\uD835\uDC9C",ascr:"\uD835\uDCB6",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"\xc3",atilde:"\xe3",Auml:"\xc4",auml:"\xe4",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"\uD835\uDD05",bfr:"\uD835\uDD1F",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"\uD835\uDD39",bopf:"\uD835\uDD53",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"\xa6",Bscr:"ℬ",bscr:"\uD835\uDCB7",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"\xc7",ccedil:"\xe7",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"\xb8",Cedilla:"\xb8",cemptyv:"⦲",cent:"\xa2",CenterDot:"\xb7",centerdot:"\xb7",Cfr:"ℭ",cfr:"\uD835\uDD20",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"\xae",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"\uD835\uDD54",coprod:"∐",Coproduct:"∐",COPY:"\xa9",copy:"\xa9",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"\uD835\uDC9E",cscr:"\uD835\uDCB8",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"\xa4",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"\xb0",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"\uD835\uDD07",dfr:"\uD835\uDD21",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"\xb4",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"\xa8",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"\xf7",divide:"\xf7",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"\uD835\uDD3B",dopf:"\uD835\uDD55",Dot:"\xa8",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"\xa8",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"\uD835\uDC9F",dscr:"\uD835\uDCB9",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"\xc9",eacute:"\xe9",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"\xca",ecirc:"\xea",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"\uD835\uDD08",efr:"\uD835\uDD22",eg:"⪚",Egrave:"\xc8",egrave:"\xe8",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"\uD835\uDD3C",eopf:"\uD835\uDD56",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"\xd0",eth:"\xf0",Euml:"\xcb",euml:"\xeb",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"\uD835\uDD09",ffr:"\uD835\uDD23",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"\uD835\uDD3D",fopf:"\uD835\uDD57",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"\xbd",frac13:"⅓",frac14:"\xbc",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"\xbe",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"\uD835\uDCBB",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"\uD835\uDD0A",gfr:"\uD835\uDD24",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"\uD835\uDD3E",gopf:"\uD835\uDD58",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"\uD835\uDCA2",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"\xbd",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"\uD835\uDD25",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"\uD835\uDD59",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"\uD835\uDCBD",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"\xcd",iacute:"\xed",ic:"",Icirc:"\xce",icirc:"\xee",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"\xa1",iff:"⇔",Ifr:"ℑ",ifr:"\uD835\uDD26",Igrave:"\xcc",igrave:"\xec",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"",InvisibleTimes:"",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"\uD835\uDD40",iopf:"\uD835\uDD5A",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"\xbf",Iscr:"ℐ",iscr:"\uD835\uDCBE",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"\xcf",iuml:"\xef",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"\uD835\uDD0D",jfr:"\uD835\uDD27",jmath:"ȷ",Jopf:"\uD835\uDD41",jopf:"\uD835\uDD5B",Jscr:"\uD835\uDCA5",jscr:"\uD835\uDCBF",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"\uD835\uDD0E",kfr:"\uD835\uDD28",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"\uD835\uDD42",kopf:"\uD835\uDD5C",Kscr:"\uD835\uDCA6",kscr:"\uD835\uDCC0",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"\xab",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"\uD835\uDD0F",lfr:"\uD835\uDD29",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"\uD835\uDD43",lopf:"\uD835\uDD5D",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"\uD835\uDCC1",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"\xaf",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"\uD835\uDD10",mfr:"\uD835\uDD2A",mho:"℧",micro:"\xb5",mid:"∣",midast:"*",midcir:"⫰",middot:"\xb7",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"\uD835\uDD44",mopf:"\uD835\uDD5E",mp:"∓",Mscr:"ℳ",mscr:"\uD835\uDCC2",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:"\xa0",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"",NegativeThickSpace:"",NegativeThinSpace:"",NegativeVeryThinSpace:"",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:"\n",nexist:"∄",nexists:"∄",Nfr:"\uD835\uDD11",nfr:"\uD835\uDD2B",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"",NonBreakingSpace:"\xa0",Nopf:"ℕ",nopf:"\uD835\uDD5F",Not:"⫬",not:"\xac",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"\uD835\uDCA9",nscr:"\uD835\uDCC3",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"\xd1",ntilde:"\xf1",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"\xd3",oacute:"\xf3",oast:"⊛",ocir:"⊚",Ocirc:"\xd4",ocirc:"\xf4",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"\uD835\uDD12",ofr:"\uD835\uDD2C",ogon:"˛",Ograve:"\xd2",ograve:"\xf2",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"\uD835\uDD46",oopf:"\uD835\uDD60",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"\xaa",ordm:"\xba",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"\uD835\uDCAA",oscr:"ℴ",Oslash:"\xd8",oslash:"\xf8",osol:"⊘",Otilde:"\xd5",otilde:"\xf5",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"\xd6",ouml:"\xf6",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"\xb6",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"\uD835\uDD13",pfr:"\uD835\uDD2D",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"\xb1",plusmn:"\xb1",plussim:"⨦",plustwo:"⨧",pm:"\xb1",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"\uD835\uDD61",pound:"\xa3",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"\uD835\uDCAB",pscr:"\uD835\uDCC5",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"\uD835\uDD14",qfr:"\uD835\uDD2E",qint:"⨌",Qopf:"ℚ",qopf:"\uD835\uDD62",qprime:"⁗",Qscr:"\uD835\uDCAC",qscr:"\uD835\uDCC6",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"\xbb",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"\xae",reg:"\xae",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"\uD835\uDD2F",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"\uD835\uDD63",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"\uD835\uDCC7",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"\xa7",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"\uD835\uDD16",sfr:"\uD835\uDD30",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"\xad",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"\uD835\uDD4A",sopf:"\uD835\uDD64",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"\uD835\uDCAE",sscr:"\uD835\uDCC8",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"\xaf",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"\xb9",sup2:"\xb2",sup3:"\xb3",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"\xdf",Tab:" ",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"\uD835\uDD17",tfr:"\uD835\uDD31",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:" ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"\xde",thorn:"\xfe",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"\xd7",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"\uD835\uDD4B",topf:"\uD835\uDD65",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"\uD835\uDCAF",tscr:"\uD835\uDCC9",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"\xda",uacute:"\xfa",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"\xdb",ucirc:"\xfb",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"\uD835\uDD18",ufr:"\uD835\uDD32",Ugrave:"\xd9",ugrave:"\xf9",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"\xa8",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"\uD835\uDD4C",uopf:"\uD835\uDD66",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"\uD835\uDCB0",uscr:"\uD835\uDCCA",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"\xdc",uuml:"\xfc",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"\uD835\uDD19",vfr:"\uD835\uDD33",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"\uD835\uDD4D",vopf:"\uD835\uDD67",vprop:"∝",vrtri:"⊳",Vscr:"\uD835\uDCB1",vscr:"\uD835\uDCCB",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"\uD835\uDD1A",wfr:"\uD835\uDD34",Wopf:"\uD835\uDD4E",wopf:"\uD835\uDD68",wp:"℘",wr:"≀",wreath:"≀",Wscr:"\uD835\uDCB2",wscr:"\uD835\uDCCC",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"\uD835\uDD1B",xfr:"\uD835\uDD35",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"\uD835\uDD4F",xopf:"\uD835\uDD69",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"\uD835\uDCB3",xscr:"\uD835\uDCCD",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"\xdd",yacute:"\xfd",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"\xa5",Yfr:"\uD835\uDD1C",yfr:"\uD835\uDD36",YIcy:"Ї",yicy:"ї",Yopf:"\uD835\uDD50",yopf:"\uD835\uDD6A",Yscr:"\uD835\uDCB4",yscr:"\uD835\uDCCE",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"\xff",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"\uD835\uDD37",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"\uD835\uDD6B",Zscr:"\uD835\uDCB5",zscr:"\uD835\uDCCF",zwj:"",zwnj:""});exports.entityMap=exports.HTML_ENTITIES;})(entities$1);
|
|
144
|
+
|
|
145
|
+
var sax$1 = {};
|
|
146
|
+
|
|
147
|
+
var NAMESPACE$1=conventions$2.NAMESPACE;var nameStartChar=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;var nameChar=new RegExp("[\\-\\.0-9"+nameStartChar.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]");var tagNamePattern=new RegExp("^"+nameStartChar.source+nameChar.source+"*(?::"+nameStartChar.source+nameChar.source+"*)?$");var S_TAG=0;var S_ATTR=1;var S_ATTR_SPACE=2;var S_EQ=3;var S_ATTR_NOQUOT_VALUE=4;var S_ATTR_END=5;var S_TAG_SPACE=6;var S_TAG_CLOSE=7;function ParseError$1(message,locator){this.message=message;this.locator=locator;if(Error.captureStackTrace)Error.captureStackTrace(this,ParseError$1);}ParseError$1.prototype=new Error;ParseError$1.prototype.name=ParseError$1.name;function XMLReader$1(){}XMLReader$1.prototype={parse:function(source,defaultNSMap,entityMap){var domBuilder=this.domBuilder;domBuilder.startDocument();_copy(defaultNSMap,defaultNSMap={});parse$1(source,defaultNSMap,entityMap,domBuilder,this.errorHandler);domBuilder.endDocument();}};function parse$1(source,defaultNSMapCopy,entityMap,domBuilder,errorHandler){function fixedFromCharCode(code){if(code>65535){code-=65536;var surrogate1=55296+(code>>10),surrogate2=56320+(code&1023);return String.fromCharCode(surrogate1,surrogate2)}else {return String.fromCharCode(code)}}function entityReplacer(a){var k=a.slice(1,-1);if(Object.hasOwnProperty.call(entityMap,k)){return entityMap[k]}else if(k.charAt(0)==="#"){return fixedFromCharCode(parseInt(k.substr(1).replace("x","0x")))}else {errorHandler.error("entity not found:"+a);return a}}function appendText(end){if(end>start){var xt=source.substring(start,end).replace(/&#?\w+;/g,entityReplacer);locator&&position(start);domBuilder.characters(xt,0,end-start);start=end;}}function position(p,m){while(p>=lineEnd&&(m=linePattern.exec(source))){lineStart=m.index;lineEnd=lineStart+m[0].length;locator.lineNumber++;}locator.columnNumber=p-lineStart+1;}var lineStart=0;var lineEnd=0;var linePattern=/.*(?:\r\n?|\n)|.*$/g;var locator=domBuilder.locator;var parseStack=[{currentNSMap:defaultNSMapCopy}];var closeMap={};var start=0;while(true){try{var tagStart=source.indexOf("<",start);if(tagStart<0){if(!source.substr(start).match(/^\s*$/)){var doc=domBuilder.doc;var text=doc.createTextNode(source.substr(start));doc.appendChild(text);domBuilder.currentElement=text;}return}if(tagStart>start){appendText(tagStart);}switch(source.charAt(tagStart+1)){case"/":var end=source.indexOf(">",tagStart+3);var tagName=source.substring(tagStart+2,end).replace(/[ \t\n\r]+$/g,"");var config=parseStack.pop();if(end<0){tagName=source.substring(tagStart+2).replace(/[\s<].*/,"");errorHandler.error("end tag name: "+tagName+" is not complete:"+config.tagName);end=tagStart+1+tagName.length;}else if(tagName.match(/\s</)){tagName=tagName.replace(/[\s<].*/,"");errorHandler.error("end tag name: "+tagName+" maybe not complete");end=tagStart+1+tagName.length;}var localNSMap=config.localNSMap;var endMatch=config.tagName==tagName;var endIgnoreCaseMach=endMatch||config.tagName&&config.tagName.toLowerCase()==tagName.toLowerCase();if(endIgnoreCaseMach){domBuilder.endElement(config.uri,config.localName,tagName);if(localNSMap){for(var prefix in localNSMap){if(Object.prototype.hasOwnProperty.call(localNSMap,prefix)){domBuilder.endPrefixMapping(prefix);}}}if(!endMatch){errorHandler.fatalError("end tag name: "+tagName+" is not match the current start tagName:"+config.tagName);}}else {parseStack.push(config);}end++;break;case"?":locator&&position(tagStart);end=parseInstruction(source,tagStart,domBuilder);break;case"!":locator&&position(tagStart);end=parseDCC(source,tagStart,domBuilder,errorHandler);break;default:locator&&position(tagStart);var el=new ElementAttributes;var currentNSMap=parseStack[parseStack.length-1].currentNSMap;var end=parseElementStartPart(source,tagStart,el,currentNSMap,entityReplacer,errorHandler);var len=el.length;if(!el.closed&&fixSelfClosed(source,end,el.tagName,closeMap)){el.closed=true;if(!entityMap.nbsp){errorHandler.warning("unclosed xml attribute");}}if(locator&&len){var locator2=copyLocator(locator,{});for(var i=0;i<len;i++){var a=el[i];position(a.offset);a.locator=copyLocator(locator,{});}domBuilder.locator=locator2;if(appendElement$1(el,domBuilder,currentNSMap)){parseStack.push(el);}domBuilder.locator=locator;}else {if(appendElement$1(el,domBuilder,currentNSMap)){parseStack.push(el);}}if(NAMESPACE$1.isHTML(el.uri)&&!el.closed){end=parseHtmlSpecialContent(source,end,el.tagName,entityReplacer,domBuilder);}else {end++;}}}catch(e){if(e instanceof ParseError$1){throw e}errorHandler.error("element parse error: "+e);end=-1;}if(end>start){start=end;}else {appendText(Math.max(tagStart,start)+1);}}}function copyLocator(f,t){t.lineNumber=f.lineNumber;t.columnNumber=f.columnNumber;return t}function parseElementStartPart(source,start,el,currentNSMap,entityReplacer,errorHandler){function addAttribute(qname,value,startIndex){if(el.attributeNames.hasOwnProperty(qname)){errorHandler.fatalError("Attribute "+qname+" redefined");}el.addValue(qname,value.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,entityReplacer),startIndex);}var attrName;var value;var p=++start;var s=S_TAG;while(true){var c=source.charAt(p);switch(c){case"=":if(s===S_ATTR){attrName=source.slice(start,p);s=S_EQ;}else if(s===S_ATTR_SPACE){s=S_EQ;}else {throw new Error("attribute equal must after attrName")}break;case"'":case'"':if(s===S_EQ||s===S_ATTR){if(s===S_ATTR){errorHandler.warning('attribute value must after "="');attrName=source.slice(start,p);}start=p+1;p=source.indexOf(c,start);if(p>0){value=source.slice(start,p);addAttribute(attrName,value,start-1);s=S_ATTR_END;}else {throw new Error("attribute value no end '"+c+"' match")}}else if(s==S_ATTR_NOQUOT_VALUE){value=source.slice(start,p);addAttribute(attrName,value,start);errorHandler.warning('attribute "'+attrName+'" missed start quot('+c+")!!");start=p+1;s=S_ATTR_END;}else {throw new Error('attribute value must after "="')}break;case"/":switch(s){case S_TAG:el.setTagName(source.slice(start,p));case S_ATTR_END:case S_TAG_SPACE:case S_TAG_CLOSE:s=S_TAG_CLOSE;el.closed=true;case S_ATTR_NOQUOT_VALUE:case S_ATTR:break;case S_ATTR_SPACE:el.closed=true;break;default:throw new Error("attribute invalid close char('/')")}break;case"":errorHandler.error("unexpected end of input");if(s==S_TAG){el.setTagName(source.slice(start,p));}return p;case">":switch(s){case S_TAG:el.setTagName(source.slice(start,p));case S_ATTR_END:case S_TAG_SPACE:case S_TAG_CLOSE:break;case S_ATTR_NOQUOT_VALUE:case S_ATTR:value=source.slice(start,p);if(value.slice(-1)==="/"){el.closed=true;value=value.slice(0,-1);}case S_ATTR_SPACE:if(s===S_ATTR_SPACE){value=attrName;}if(s==S_ATTR_NOQUOT_VALUE){errorHandler.warning('attribute "'+value+'" missed quot(")!');addAttribute(attrName,value,start);}else {if(!NAMESPACE$1.isHTML(currentNSMap[""])||!value.match(/^(?:disabled|checked|selected)$/i)){errorHandler.warning('attribute "'+value+'" missed value!! "'+value+'" instead!!');}addAttribute(value,value,start);}break;case S_EQ:throw new Error("attribute value missed!!")}return p;case"\x80":c=" ";default:if(c<=" "){switch(s){case S_TAG:el.setTagName(source.slice(start,p));s=S_TAG_SPACE;break;case S_ATTR:attrName=source.slice(start,p);s=S_ATTR_SPACE;break;case S_ATTR_NOQUOT_VALUE:var value=source.slice(start,p);errorHandler.warning('attribute "'+value+'" missed quot(")!!');addAttribute(attrName,value,start);case S_ATTR_END:s=S_TAG_SPACE;break}}else {switch(s){case S_ATTR_SPACE:el.tagName;if(!NAMESPACE$1.isHTML(currentNSMap[""])||!attrName.match(/^(?:disabled|checked|selected)$/i)){errorHandler.warning('attribute "'+attrName+'" missed value!! "'+attrName+'" instead2!!');}addAttribute(attrName,attrName,start);start=p;s=S_ATTR;break;case S_ATTR_END:errorHandler.warning('attribute space is required"'+attrName+'"!!');case S_TAG_SPACE:s=S_ATTR;start=p;break;case S_EQ:s=S_ATTR_NOQUOT_VALUE;start=p;break;case S_TAG_CLOSE:throw new Error("elements closed character '/' and '>' must be connected to")}}}p++;}}function appendElement$1(el,domBuilder,currentNSMap){var tagName=el.tagName;var localNSMap=null;var i=el.length;while(i--){var a=el[i];var qName=a.qName;var value=a.value;var nsp=qName.indexOf(":");if(nsp>0){var prefix=a.prefix=qName.slice(0,nsp);var localName=qName.slice(nsp+1);var nsPrefix=prefix==="xmlns"&&localName;}else {localName=qName;prefix=null;nsPrefix=qName==="xmlns"&&"";}a.localName=localName;if(nsPrefix!==false){if(localNSMap==null){localNSMap={};_copy(currentNSMap,currentNSMap={});}currentNSMap[nsPrefix]=localNSMap[nsPrefix]=value;a.uri=NAMESPACE$1.XMLNS;domBuilder.startPrefixMapping(nsPrefix,value);}}var i=el.length;while(i--){a=el[i];var prefix=a.prefix;if(prefix){if(prefix==="xml"){a.uri=NAMESPACE$1.XML;}if(prefix!=="xmlns"){a.uri=currentNSMap[prefix||""];}}}var nsp=tagName.indexOf(":");if(nsp>0){prefix=el.prefix=tagName.slice(0,nsp);localName=el.localName=tagName.slice(nsp+1);}else {prefix=null;localName=el.localName=tagName;}var ns=el.uri=currentNSMap[prefix||""];domBuilder.startElement(ns,localName,tagName,el);if(el.closed){domBuilder.endElement(ns,localName,tagName);if(localNSMap){for(prefix in localNSMap){if(Object.prototype.hasOwnProperty.call(localNSMap,prefix)){domBuilder.endPrefixMapping(prefix);}}}}else {el.currentNSMap=currentNSMap;el.localNSMap=localNSMap;return true}}function parseHtmlSpecialContent(source,elStartEnd,tagName,entityReplacer,domBuilder){if(/^(?:script|textarea)$/i.test(tagName)){var elEndStart=source.indexOf("</"+tagName+">",elStartEnd);var text=source.substring(elStartEnd+1,elEndStart);if(/[&<]/.test(text)){if(/^script$/i.test(tagName)){domBuilder.characters(text,0,text.length);return elEndStart}text=text.replace(/&#?\w+;/g,entityReplacer);domBuilder.characters(text,0,text.length);return elEndStart}}return elStartEnd+1}function fixSelfClosed(source,elStartEnd,tagName,closeMap){var pos=closeMap[tagName];if(pos==null){pos=source.lastIndexOf("</"+tagName+">");if(pos<elStartEnd){pos=source.lastIndexOf("</"+tagName);}closeMap[tagName]=pos;}return pos<elStartEnd}function _copy(source,target){for(var n in source){if(Object.prototype.hasOwnProperty.call(source,n)){target[n]=source[n];}}}function parseDCC(source,start,domBuilder,errorHandler){var next=source.charAt(start+2);switch(next){case"-":if(source.charAt(start+3)==="-"){var end=source.indexOf("-->",start+4);if(end>start){domBuilder.comment(source,start+4,end-start-4);return end+3}else {errorHandler.error("Unclosed comment");return -1}}else {return -1}default:if(source.substr(start+3,6)=="CDATA["){var end=source.indexOf("]]>",start+9);domBuilder.startCDATA();domBuilder.characters(source,start+9,end-start-9);domBuilder.endCDATA();return end+3}var matchs=split(source,start);var len=matchs.length;if(len>1&&/!doctype/i.test(matchs[0][0])){var name=matchs[1][0];var pubid=false;var sysid=false;if(len>3){if(/^public$/i.test(matchs[2][0])){pubid=matchs[3][0];sysid=len>4&&matchs[4][0];}else if(/^system$/i.test(matchs[2][0])){sysid=matchs[3][0];}}var lastMatch=matchs[len-1];domBuilder.startDTD(name,pubid,sysid);domBuilder.endDTD();return lastMatch.index+lastMatch[0].length}}return -1}function parseInstruction(source,start,domBuilder){var end=source.indexOf("?>",start);if(end){var match=source.substring(start,end).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);if(match){match[0].length;domBuilder.processingInstruction(match[1],match[2]);return end+2}else {return -1}}return -1}function ElementAttributes(){this.attributeNames={};}ElementAttributes.prototype={setTagName:function(tagName){if(!tagNamePattern.test(tagName)){throw new Error("invalid tagName:"+tagName)}this.tagName=tagName;},addValue:function(qName,value,offset){if(!tagNamePattern.test(qName)){throw new Error("invalid attribute:"+qName)}this.attributeNames[qName]=this.length;this[this.length++]={qName:qName,value:value,offset:offset};},length:0,getLocalName:function(i){return this[i].localName},getLocator:function(i){return this[i].locator},getQName:function(i){return this[i].qName},getURI:function(i){return this[i].uri},getValue:function(i){return this[i].value}};function split(source,start){var match;var buf=[];var reg=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;reg.lastIndex=start;reg.exec(source);while(match=reg.exec(source)){buf.push(match);if(match[1])return buf}}sax$1.XMLReader=XMLReader$1;sax$1.ParseError=ParseError$1;
|
|
148
|
+
|
|
149
|
+
var conventions=conventions$2;var dom=dom$1;var entities=entities$1;var sax=sax$1;var DOMImplementation=dom.DOMImplementation;var NAMESPACE=conventions.NAMESPACE;var ParseError=sax.ParseError;var XMLReader=sax.XMLReader;function normalizeLineEndings(input){return input.replace(/\r[\n\u0085]/g,"\n").replace(/[\r\u0085\u2028]/g,"\n")}function DOMParser$1(options){this.options=options||{locator:{}};}DOMParser$1.prototype.parseFromString=function(source,mimeType){var options=this.options;var sax=new XMLReader;var domBuilder=options.domBuilder||new DOMHandler;var errorHandler=options.errorHandler;var locator=options.locator;var defaultNSMap=options.xmlns||{};var isHTML=/\/x?html?$/.test(mimeType);var entityMap=isHTML?entities.HTML_ENTITIES:entities.XML_ENTITIES;if(locator){domBuilder.setDocumentLocator(locator);}sax.errorHandler=buildErrorHandler(errorHandler,domBuilder,locator);sax.domBuilder=options.domBuilder||domBuilder;if(isHTML){defaultNSMap[""]=NAMESPACE.HTML;}defaultNSMap.xml=defaultNSMap.xml||NAMESPACE.XML;var normalize=options.normalizeLineEndings||normalizeLineEndings;if(source&&typeof source==="string"){sax.parse(normalize(source),defaultNSMap,entityMap);}else {sax.errorHandler.error("invalid doc source");}return domBuilder.doc};function buildErrorHandler(errorImpl,domBuilder,locator){if(!errorImpl){if(domBuilder instanceof DOMHandler){return domBuilder}errorImpl=domBuilder;}var errorHandler={};var isCallback=errorImpl instanceof Function;locator=locator||{};function build(key){var fn=errorImpl[key];if(!fn&&isCallback){fn=errorImpl.length==2?function(msg){errorImpl(key,msg);}:errorImpl;}errorHandler[key]=fn&&function(msg){fn("[xmldom "+key+"] "+msg+_locator(locator));}||function(){};}build("warning");build("error");build("fatalError");return errorHandler}function DOMHandler(){this.cdata=false;}function position(locator,node){node.lineNumber=locator.lineNumber;node.columnNumber=locator.columnNumber;}DOMHandler.prototype={startDocument:function(){this.doc=new DOMImplementation().createDocument(null,null,null);if(this.locator){this.doc.documentURI=this.locator.systemId;}},startElement:function(namespaceURI,localName,qName,attrs){var doc=this.doc;var el=doc.createElementNS(namespaceURI,qName||localName);var len=attrs.length;appendElement(this,el);this.currentElement=el;this.locator&&position(this.locator,el);for(var i=0;i<len;i++){var namespaceURI=attrs.getURI(i);var value=attrs.getValue(i);var qName=attrs.getQName(i);var attr=doc.createAttributeNS(namespaceURI,qName);this.locator&&position(attrs.getLocator(i),attr);attr.value=attr.nodeValue=value;el.setAttributeNode(attr);}},endElement:function(namespaceURI,localName,qName){var current=this.currentElement;current.tagName;this.currentElement=current.parentNode;},startPrefixMapping:function(prefix,uri){},endPrefixMapping:function(prefix){},processingInstruction:function(target,data){var ins=this.doc.createProcessingInstruction(target,data);this.locator&&position(this.locator,ins);appendElement(this,ins);},ignorableWhitespace:function(ch,start,length){},characters:function(chars,start,length){chars=_toString.apply(this,arguments);if(chars){if(this.cdata){var charNode=this.doc.createCDATASection(chars);}else {var charNode=this.doc.createTextNode(chars);}if(this.currentElement){this.currentElement.appendChild(charNode);}else if(/^\s*$/.test(chars)){this.doc.appendChild(charNode);}this.locator&&position(this.locator,charNode);}},skippedEntity:function(name){},endDocument:function(){this.doc.normalize();},setDocumentLocator:function(locator){if(this.locator=locator){locator.lineNumber=0;}},comment:function(chars,start,length){chars=_toString.apply(this,arguments);var comm=this.doc.createComment(chars);this.locator&&position(this.locator,comm);appendElement(this,comm);},startCDATA:function(){this.cdata=true;},endCDATA:function(){this.cdata=false;},startDTD:function(name,publicId,systemId){var impl=this.doc.implementation;if(impl&&impl.createDocumentType){var dt=impl.createDocumentType(name,publicId,systemId);this.locator&&position(this.locator,dt);appendElement(this,dt);this.doc.doctype=dt;}},warning:function(error){console.warn("[xmldom warning] "+error,_locator(this.locator));},error:function(error){console.error("[xmldom error] "+error,_locator(this.locator));},fatalError:function(error){throw new ParseError(error,this.locator)}};function _locator(l){if(l){return "\n@"+(l.systemId||"")+"#[line:"+l.lineNumber+",col:"+l.columnNumber+"]"}}function _toString(chars,start,length){if(typeof chars=="string"){return chars.substr(start,length)}else {if(chars.length>=start+length||start){return new java.lang.String(chars,start,length)+""}return chars}}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(key){DOMHandler.prototype[key]=function(){return null};});function appendElement(hander,node){if(!hander.currentElement){hander.doc.appendChild(node);}else {hander.currentElement.appendChild(node);}}domParser.__DOMHandler=DOMHandler;domParser.normalizeLineEndings=normalizeLineEndings;domParser.DOMParser=DOMParser$1;
|
|
150
|
+
|
|
151
|
+
var DOMParser=domParser.DOMParser;
|
|
152
|
+
|
|
153
|
+
var isObject$1=function isObject(obj){return !!obj&&typeof obj==="object"};var merge=function merge(){for(var _len=arguments.length,objects=new Array(_len),_key=0;_key<_len;_key++){objects[_key]=arguments[_key];}return objects.reduce(function(result,source){if(typeof source!=="object"){return result}Object.keys(source).forEach(function(key){if(Array.isArray(result[key])&&Array.isArray(source[key])){result[key]=result[key].concat(source[key]);}else if(isObject$1(result[key])&&isObject$1(source[key])){result[key]=merge(result[key],source[key]);}else {result[key]=source[key];}});return result},{})};var values=function values(o){return Object.keys(o).map(function(k){return o[k]})};var range=function range(start,end){var result=[];for(var i=start;i<end;i++){result.push(i);}return result};var flatten=function flatten(lists){return lists.reduce(function(x,y){return x.concat(y)},[])};var from=function from(list){if(!list.length){return []}var result=[];for(var i=0;i<list.length;i++){result.push(list[i]);}return result};var findIndexes=function findIndexes(l,key){return l.reduce(function(a,e,i){if(e[key]){a.push(i);}return a},[])};var findIndex=function findIndex(list,matchingFunction){for(var i=0;i<list.length;i++){if(matchingFunction(list[i])){return i}}return -1};var union=function union(lists,keyFunction){return values(lists.reduce(function(acc,list){list.forEach(function(el){acc[keyFunction(el)]=el;});return acc},{}))};var errors={INVALID_NUMBER_OF_PERIOD:"INVALID_NUMBER_OF_PERIOD",DASH_EMPTY_MANIFEST:"DASH_EMPTY_MANIFEST",DASH_INVALID_XML:"DASH_INVALID_XML",NO_BASE_URL:"NO_BASE_URL",MISSING_SEGMENT_INFORMATION:"MISSING_SEGMENT_INFORMATION",SEGMENT_TIME_UNSPECIFIED:"SEGMENT_TIME_UNSPECIFIED",UNSUPPORTED_UTC_TIMING_SCHEME:"UNSUPPORTED_UTC_TIMING_SCHEME"};var urlTypeToSegment=function urlTypeToSegment(_ref){var _ref$baseUrl=_ref.baseUrl,baseUrl=_ref$baseUrl===void 0?"":_ref$baseUrl,_ref$source=_ref.source,source=_ref$source===void 0?"":_ref$source,_ref$range=_ref.range,range=_ref$range===void 0?"":_ref$range,_ref$indexRange=_ref.indexRange,indexRange=_ref$indexRange===void 0?"":_ref$indexRange;var segment={uri:source,resolvedUri:resolveUrl$1(baseUrl||"",source)};if(range||indexRange){var rangeStr=range?range:indexRange;var ranges=rangeStr.split("-");var startRange=window_1.BigInt?window_1.BigInt(ranges[0]):parseInt(ranges[0],10);var endRange=window_1.BigInt?window_1.BigInt(ranges[1]):parseInt(ranges[1],10);if(startRange<Number.MAX_SAFE_INTEGER&&typeof startRange==="bigint"){startRange=Number(startRange);}if(endRange<Number.MAX_SAFE_INTEGER&&typeof endRange==="bigint"){endRange=Number(endRange);}var length;if(typeof endRange==="bigint"||typeof startRange==="bigint"){length=window_1.BigInt(endRange)-window_1.BigInt(startRange)+window_1.BigInt(1);}else {length=endRange-startRange+1;}if(typeof length==="bigint"&&length<Number.MAX_SAFE_INTEGER){length=Number(length);}segment.byterange={length:length,offset:startRange};}return segment};var byteRangeToString=function byteRangeToString(byterange){var endRange;if(typeof byterange.offset==="bigint"||typeof byterange.length==="bigint"){endRange=window_1.BigInt(byterange.offset)+window_1.BigInt(byterange.length)-window_1.BigInt(1);}else {endRange=byterange.offset+byterange.length-1;}return byterange.offset+"-"+endRange};var parseEndNumber=function parseEndNumber(endNumber){if(endNumber&&typeof endNumber!=="number"){endNumber=parseInt(endNumber,10);}if(isNaN(endNumber)){return null}return endNumber};var segmentRange={static:function _static(attributes){var duration=attributes.duration,_attributes$timescale=attributes.timescale,timescale=_attributes$timescale===void 0?1:_attributes$timescale,sourceDuration=attributes.sourceDuration,periodDuration=attributes.periodDuration;var endNumber=parseEndNumber(attributes.endNumber);var segmentDuration=duration/timescale;if(typeof endNumber==="number"){return {start:0,end:endNumber}}if(typeof periodDuration==="number"){return {start:0,end:periodDuration/segmentDuration}}return {start:0,end:sourceDuration/segmentDuration}},dynamic:function dynamic(attributes){var NOW=attributes.NOW,clientOffset=attributes.clientOffset,availabilityStartTime=attributes.availabilityStartTime,_attributes$timescale2=attributes.timescale,timescale=_attributes$timescale2===void 0?1:_attributes$timescale2,duration=attributes.duration,_attributes$periodSta=attributes.periodStart,periodStart=_attributes$periodSta===void 0?0:_attributes$periodSta,_attributes$minimumUp=attributes.minimumUpdatePeriod,minimumUpdatePeriod=_attributes$minimumUp===void 0?0:_attributes$minimumUp,_attributes$timeShift=attributes.timeShiftBufferDepth,timeShiftBufferDepth=_attributes$timeShift===void 0?Infinity:_attributes$timeShift;var endNumber=parseEndNumber(attributes.endNumber);var now=(NOW+clientOffset)/1e3;var periodStartWC=availabilityStartTime+periodStart;var periodEndWC=now+minimumUpdatePeriod;var periodDuration=periodEndWC-periodStartWC;var segmentCount=Math.ceil(periodDuration*timescale/duration);var availableStart=Math.floor((now-periodStartWC-timeShiftBufferDepth)*timescale/duration);var availableEnd=Math.floor((now-periodStartWC)*timescale/duration);return {start:Math.max(0,availableStart),end:typeof endNumber==="number"?endNumber:Math.min(segmentCount,availableEnd)}}};var toSegments=function toSegments(attributes){return function(number){var duration=attributes.duration,_attributes$timescale3=attributes.timescale,timescale=_attributes$timescale3===void 0?1:_attributes$timescale3,periodStart=attributes.periodStart,_attributes$startNumb=attributes.startNumber,startNumber=_attributes$startNumb===void 0?1:_attributes$startNumb;return {number:startNumber+number,duration:duration/timescale,timeline:periodStart,time:number*duration}}};var parseByDuration=function parseByDuration(attributes){var type=attributes.type,duration=attributes.duration,_attributes$timescale4=attributes.timescale,timescale=_attributes$timescale4===void 0?1:_attributes$timescale4,periodDuration=attributes.periodDuration,sourceDuration=attributes.sourceDuration;var _segmentRange$type=segmentRange[type](attributes),start=_segmentRange$type.start,end=_segmentRange$type.end;var segments=range(start,end).map(toSegments(attributes));if(type==="static"){var index=segments.length-1;var sectionDuration=typeof periodDuration==="number"?periodDuration:sourceDuration;segments[index].duration=sectionDuration-duration/timescale*index;}return segments};var segmentsFromBase=function segmentsFromBase(attributes){var baseUrl=attributes.baseUrl,_attributes$initializ=attributes.initialization,initialization=_attributes$initializ===void 0?{}:_attributes$initializ,sourceDuration=attributes.sourceDuration,_attributes$indexRang=attributes.indexRange,indexRange=_attributes$indexRang===void 0?"":_attributes$indexRang,periodStart=attributes.periodStart,presentationTime=attributes.presentationTime,_attributes$number=attributes.number,number=_attributes$number===void 0?0:_attributes$number,duration=attributes.duration;if(!baseUrl){throw new Error(errors.NO_BASE_URL)}var initSegment=urlTypeToSegment({baseUrl:baseUrl,source:initialization.sourceURL,range:initialization.range});var segment=urlTypeToSegment({baseUrl:baseUrl,source:baseUrl,indexRange:indexRange});segment.map=initSegment;if(duration){var segmentTimeInfo=parseByDuration(attributes);if(segmentTimeInfo.length){segment.duration=segmentTimeInfo[0].duration;segment.timeline=segmentTimeInfo[0].timeline;}}else if(sourceDuration){segment.duration=sourceDuration;segment.timeline=periodStart;}segment.presentationTime=presentationTime||periodStart;segment.number=number;return [segment]};var addSidxSegmentsToPlaylist$1=function addSidxSegmentsToPlaylist(playlist,sidx,baseUrl){var initSegment=playlist.sidx.map?playlist.sidx.map:null;var sourceDuration=playlist.sidx.duration;var timeline=playlist.timeline||0;var sidxByteRange=playlist.sidx.byterange;var sidxEnd=sidxByteRange.offset+sidxByteRange.length;var timescale=sidx.timescale;var mediaReferences=sidx.references.filter(function(r){return r.referenceType!==1});var segments=[];var type=playlist.endList?"static":"dynamic";var periodStart=playlist.sidx.timeline;var presentationTime=periodStart;var number=playlist.mediaSequence||0;var startIndex;if(typeof sidx.firstOffset==="bigint"){startIndex=window_1.BigInt(sidxEnd)+sidx.firstOffset;}else {startIndex=sidxEnd+sidx.firstOffset;}for(var i=0;i<mediaReferences.length;i++){var reference=sidx.references[i];var size=reference.referencedSize;var duration=reference.subsegmentDuration;var endIndex=void 0;if(typeof startIndex==="bigint"){endIndex=startIndex+window_1.BigInt(size)-window_1.BigInt(1);}else {endIndex=startIndex+size-1;}var indexRange=startIndex+"-"+endIndex;var attributes={baseUrl:baseUrl,timescale:timescale,timeline:timeline,periodStart:periodStart,presentationTime:presentationTime,number:number,duration:duration,sourceDuration:sourceDuration,indexRange:indexRange,type:type};var segment=segmentsFromBase(attributes)[0];if(initSegment){segment.map=initSegment;}segments.push(segment);if(typeof startIndex==="bigint"){startIndex+=window_1.BigInt(size);}else {startIndex+=size;}presentationTime+=duration/timescale;number++;}playlist.segments=segments;return playlist};var SUPPORTED_MEDIA_TYPES=["AUDIO","SUBTITLES"];var TIME_FUDGE=1/60;var getUniqueTimelineStarts=function getUniqueTimelineStarts(timelineStarts){return union(timelineStarts,function(_ref){var timeline=_ref.timeline;return timeline}).sort(function(a,b){return a.timeline>b.timeline?1:-1})};var findPlaylistWithName=function findPlaylistWithName(playlists,name){for(var i=0;i<playlists.length;i++){if(playlists[i].attributes.NAME===name){return playlists[i]}}return null};var getMediaGroupPlaylists=function getMediaGroupPlaylists(manifest){var mediaGroupPlaylists=[];forEachMediaGroup$1(manifest,SUPPORTED_MEDIA_TYPES,function(properties,type,group,label){mediaGroupPlaylists=mediaGroupPlaylists.concat(properties.playlists||[]);});return mediaGroupPlaylists};var updateMediaSequenceForPlaylist=function updateMediaSequenceForPlaylist(_ref2){var playlist=_ref2.playlist,mediaSequence=_ref2.mediaSequence;playlist.mediaSequence=mediaSequence;playlist.segments.forEach(function(segment,index){segment.number=playlist.mediaSequence+index;});};var updateSequenceNumbers=function updateSequenceNumbers(_ref3){var oldPlaylists=_ref3.oldPlaylists,newPlaylists=_ref3.newPlaylists,timelineStarts=_ref3.timelineStarts;newPlaylists.forEach(function(playlist){playlist.discontinuitySequence=findIndex(timelineStarts,function(_ref4){var timeline=_ref4.timeline;return timeline===playlist.timeline});var oldPlaylist=findPlaylistWithName(oldPlaylists,playlist.attributes.NAME);if(!oldPlaylist){return}if(playlist.sidx){return}var firstNewSegment=playlist.segments[0];var oldMatchingSegmentIndex=findIndex(oldPlaylist.segments,function(oldSegment){return Math.abs(oldSegment.presentationTime-firstNewSegment.presentationTime)<TIME_FUDGE});if(oldMatchingSegmentIndex===-1){updateMediaSequenceForPlaylist({playlist:playlist,mediaSequence:oldPlaylist.mediaSequence+oldPlaylist.segments.length});playlist.segments[0].discontinuity=true;playlist.discontinuityStarts.unshift(0);if(!oldPlaylist.segments.length&&playlist.timeline>oldPlaylist.timeline||oldPlaylist.segments.length&&playlist.timeline>oldPlaylist.segments[oldPlaylist.segments.length-1].timeline){playlist.discontinuitySequence--;}return}var oldMatchingSegment=oldPlaylist.segments[oldMatchingSegmentIndex];if(oldMatchingSegment.discontinuity&&!firstNewSegment.discontinuity){firstNewSegment.discontinuity=true;playlist.discontinuityStarts.unshift(0);playlist.discontinuitySequence--;}updateMediaSequenceForPlaylist({playlist:playlist,mediaSequence:oldPlaylist.segments[oldMatchingSegmentIndex].number});});};var positionManifestOnTimeline=function positionManifestOnTimeline(_ref5){var oldManifest=_ref5.oldManifest,newManifest=_ref5.newManifest;var oldPlaylists=oldManifest.playlists.concat(getMediaGroupPlaylists(oldManifest));var newPlaylists=newManifest.playlists.concat(getMediaGroupPlaylists(newManifest));newManifest.timelineStarts=getUniqueTimelineStarts([oldManifest.timelineStarts,newManifest.timelineStarts]);updateSequenceNumbers({oldPlaylists:oldPlaylists,newPlaylists:newPlaylists,timelineStarts:newManifest.timelineStarts});return newManifest};var generateSidxKey=function generateSidxKey(sidx){return sidx&&sidx.uri+"-"+byteRangeToString(sidx.byterange)};var mergeDiscontiguousPlaylists=function mergeDiscontiguousPlaylists(playlists){var mergedPlaylists=values(playlists.reduce(function(acc,playlist){var name=playlist.attributes.id+(playlist.attributes.lang||"");if(!acc[name]){acc[name]=playlist;acc[name].attributes.timelineStarts=[];}else {if(playlist.segments){var _acc$name$segments;if(playlist.segments[0]){playlist.segments[0].discontinuity=true;}(_acc$name$segments=acc[name].segments).push.apply(_acc$name$segments,playlist.segments);}if(playlist.attributes.contentProtection){acc[name].attributes.contentProtection=playlist.attributes.contentProtection;}}acc[name].attributes.timelineStarts.push({start:playlist.attributes.periodStart,timeline:playlist.attributes.periodStart});return acc},{}));return mergedPlaylists.map(function(playlist){playlist.discontinuityStarts=findIndexes(playlist.segments||[],"discontinuity");return playlist})};var addSidxSegmentsToPlaylist=function addSidxSegmentsToPlaylist(playlist,sidxMapping){var sidxKey=generateSidxKey(playlist.sidx);var sidxMatch=sidxKey&&sidxMapping[sidxKey]&&sidxMapping[sidxKey].sidx;if(sidxMatch){addSidxSegmentsToPlaylist$1(playlist,sidxMatch,playlist.sidx.resolvedUri);}return playlist};var addSidxSegmentsToPlaylists=function addSidxSegmentsToPlaylists(playlists,sidxMapping){if(sidxMapping===void 0){sidxMapping={};}if(!Object.keys(sidxMapping).length){return playlists}for(var i in playlists){playlists[i]=addSidxSegmentsToPlaylist(playlists[i],sidxMapping);}return playlists};var formatAudioPlaylist=function formatAudioPlaylist(_ref,isAudioOnly){var _attributes;var attributes=_ref.attributes,segments=_ref.segments,sidx=_ref.sidx,mediaSequence=_ref.mediaSequence,discontinuitySequence=_ref.discontinuitySequence,discontinuityStarts=_ref.discontinuityStarts;var playlist={attributes:(_attributes={NAME:attributes.id,BANDWIDTH:attributes.bandwidth,CODECS:attributes.codecs},_attributes["PROGRAM-ID"]=1,_attributes),uri:"",endList:attributes.type==="static",timeline:attributes.periodStart,resolvedUri:"",targetDuration:attributes.duration,discontinuitySequence:discontinuitySequence,discontinuityStarts:discontinuityStarts,timelineStarts:attributes.timelineStarts,mediaSequence:mediaSequence,segments:segments};if(attributes.contentProtection){playlist.contentProtection=attributes.contentProtection;}if(sidx){playlist.sidx=sidx;}if(isAudioOnly){playlist.attributes.AUDIO="audio";playlist.attributes.SUBTITLES="subs";}return playlist};var formatVttPlaylist=function formatVttPlaylist(_ref2){var _m3u8Attributes;var attributes=_ref2.attributes,segments=_ref2.segments,mediaSequence=_ref2.mediaSequence,discontinuityStarts=_ref2.discontinuityStarts,discontinuitySequence=_ref2.discontinuitySequence;if(typeof segments==="undefined"){segments=[{uri:attributes.baseUrl,timeline:attributes.periodStart,resolvedUri:attributes.baseUrl||"",duration:attributes.sourceDuration,number:0}];attributes.duration=attributes.sourceDuration;}var m3u8Attributes=(_m3u8Attributes={NAME:attributes.id,BANDWIDTH:attributes.bandwidth},_m3u8Attributes["PROGRAM-ID"]=1,_m3u8Attributes);if(attributes.codecs){m3u8Attributes.CODECS=attributes.codecs;}return {attributes:m3u8Attributes,uri:"",endList:attributes.type==="static",timeline:attributes.periodStart,resolvedUri:attributes.baseUrl||"",targetDuration:attributes.duration,timelineStarts:attributes.timelineStarts,discontinuityStarts:discontinuityStarts,discontinuitySequence:discontinuitySequence,mediaSequence:mediaSequence,segments:segments}};var organizeAudioPlaylists=function organizeAudioPlaylists(playlists,sidxMapping,isAudioOnly){if(sidxMapping===void 0){sidxMapping={};}if(isAudioOnly===void 0){isAudioOnly=false;}var mainPlaylist;var formattedPlaylists=playlists.reduce(function(a,playlist){var role=playlist.attributes.role&&playlist.attributes.role.value||"";var language=playlist.attributes.lang||"";var label=playlist.attributes.label||"main";if(language&&!playlist.attributes.label){var roleLabel=role?" ("+role+")":"";label=""+playlist.attributes.lang+roleLabel;}if(!a[label]){a[label]={language:language,autoselect:true,default:role==="main",playlists:[],uri:""};}var formatted=addSidxSegmentsToPlaylist(formatAudioPlaylist(playlist,isAudioOnly),sidxMapping);a[label].playlists.push(formatted);if(typeof mainPlaylist==="undefined"&&role==="main"){mainPlaylist=playlist;mainPlaylist.default=true;}return a},{});if(!mainPlaylist){var firstLabel=Object.keys(formattedPlaylists)[0];formattedPlaylists[firstLabel].default=true;}return formattedPlaylists};var organizeVttPlaylists=function organizeVttPlaylists(playlists,sidxMapping){if(sidxMapping===void 0){sidxMapping={};}return playlists.reduce(function(a,playlist){var label=playlist.attributes.lang||"text";if(!a[label]){a[label]={language:label,default:false,autoselect:false,playlists:[],uri:""};}a[label].playlists.push(addSidxSegmentsToPlaylist(formatVttPlaylist(playlist),sidxMapping));return a},{})};var organizeCaptionServices=function organizeCaptionServices(captionServices){return captionServices.reduce(function(svcObj,svc){if(!svc){return svcObj}svc.forEach(function(service){var channel=service.channel,language=service.language;svcObj[language]={autoselect:false,default:false,instreamId:channel,language:language};if(service.hasOwnProperty("aspectRatio")){svcObj[language].aspectRatio=service.aspectRatio;}if(service.hasOwnProperty("easyReader")){svcObj[language].easyReader=service.easyReader;}if(service.hasOwnProperty("3D")){svcObj[language]["3D"]=service["3D"];}});return svcObj},{})};var formatVideoPlaylist=function formatVideoPlaylist(_ref3){var _attributes2;var attributes=_ref3.attributes,segments=_ref3.segments,sidx=_ref3.sidx,discontinuityStarts=_ref3.discontinuityStarts;var playlist={attributes:(_attributes2={NAME:attributes.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:attributes.width,height:attributes.height},CODECS:attributes.codecs,BANDWIDTH:attributes.bandwidth},_attributes2["PROGRAM-ID"]=1,_attributes2),uri:"",endList:attributes.type==="static",timeline:attributes.periodStart,resolvedUri:"",targetDuration:attributes.duration,discontinuityStarts:discontinuityStarts,timelineStarts:attributes.timelineStarts,segments:segments};if(attributes.frameRate){playlist.attributes["FRAME-RATE"]=attributes.frameRate;}if(attributes.contentProtection){playlist.contentProtection=attributes.contentProtection;}if(sidx){playlist.sidx=sidx;}return playlist};var videoOnly=function videoOnly(_ref4){var attributes=_ref4.attributes;return attributes.mimeType==="video/mp4"||attributes.mimeType==="video/webm"||attributes.contentType==="video"};var audioOnly=function audioOnly(_ref5){var attributes=_ref5.attributes;return attributes.mimeType==="audio/mp4"||attributes.mimeType==="audio/webm"||attributes.contentType==="audio"};var vttOnly=function vttOnly(_ref6){var attributes=_ref6.attributes;return attributes.mimeType==="text/vtt"||attributes.contentType==="text"};var addMediaSequenceValues=function addMediaSequenceValues(playlists,timelineStarts){playlists.forEach(function(playlist){playlist.mediaSequence=0;playlist.discontinuitySequence=findIndex(timelineStarts,function(_ref7){var timeline=_ref7.timeline;return timeline===playlist.timeline});if(!playlist.segments){return}playlist.segments.forEach(function(segment,index){segment.number=index;});});};var flattenMediaGroupPlaylists=function flattenMediaGroupPlaylists(mediaGroupObject){if(!mediaGroupObject){return []}return Object.keys(mediaGroupObject).reduce(function(acc,label){var labelContents=mediaGroupObject[label];return acc.concat(labelContents.playlists)},[])};var toM3u8=function toM3u8(_ref8){var _mediaGroups;var dashPlaylists=_ref8.dashPlaylists,locations=_ref8.locations,_ref8$sidxMapping=_ref8.sidxMapping,sidxMapping=_ref8$sidxMapping===void 0?{}:_ref8$sidxMapping,previousManifest=_ref8.previousManifest;if(!dashPlaylists.length){return {}}var _dashPlaylists$0$attr=dashPlaylists[0].attributes,duration=_dashPlaylists$0$attr.sourceDuration,type=_dashPlaylists$0$attr.type,suggestedPresentationDelay=_dashPlaylists$0$attr.suggestedPresentationDelay,minimumUpdatePeriod=_dashPlaylists$0$attr.minimumUpdatePeriod;var videoPlaylists=mergeDiscontiguousPlaylists(dashPlaylists.filter(videoOnly)).map(formatVideoPlaylist);var audioPlaylists=mergeDiscontiguousPlaylists(dashPlaylists.filter(audioOnly));var vttPlaylists=mergeDiscontiguousPlaylists(dashPlaylists.filter(vttOnly));var captions=dashPlaylists.map(function(playlist){return playlist.attributes.captionServices}).filter(Boolean);var manifest={allowCache:true,discontinuityStarts:[],segments:[],endList:true,mediaGroups:(_mediaGroups={AUDIO:{},VIDEO:{}},_mediaGroups["CLOSED-CAPTIONS"]={},_mediaGroups.SUBTITLES={},_mediaGroups),uri:"",duration:duration,playlists:addSidxSegmentsToPlaylists(videoPlaylists,sidxMapping)};if(minimumUpdatePeriod>=0){manifest.minimumUpdatePeriod=minimumUpdatePeriod*1e3;}if(locations){manifest.locations=locations;}if(type==="dynamic"){manifest.suggestedPresentationDelay=suggestedPresentationDelay;}var isAudioOnly=manifest.playlists.length===0;var organizedAudioGroup=audioPlaylists.length?organizeAudioPlaylists(audioPlaylists,sidxMapping,isAudioOnly):null;var organizedVttGroup=vttPlaylists.length?organizeVttPlaylists(vttPlaylists,sidxMapping):null;var formattedPlaylists=videoPlaylists.concat(flattenMediaGroupPlaylists(organizedAudioGroup),flattenMediaGroupPlaylists(organizedVttGroup));var playlistTimelineStarts=formattedPlaylists.map(function(_ref9){var timelineStarts=_ref9.timelineStarts;return timelineStarts});manifest.timelineStarts=getUniqueTimelineStarts(playlistTimelineStarts);addMediaSequenceValues(formattedPlaylists,manifest.timelineStarts);if(organizedAudioGroup){manifest.mediaGroups.AUDIO.audio=organizedAudioGroup;}if(organizedVttGroup){manifest.mediaGroups.SUBTITLES.subs=organizedVttGroup;}if(captions.length){manifest.mediaGroups["CLOSED-CAPTIONS"].cc=organizeCaptionServices(captions);}if(previousManifest){return positionManifestOnTimeline({oldManifest:previousManifest,newManifest:manifest})}return manifest};var getLiveRValue=function getLiveRValue(attributes,time,duration){var NOW=attributes.NOW,clientOffset=attributes.clientOffset,availabilityStartTime=attributes.availabilityStartTime,_attributes$timescale=attributes.timescale,timescale=_attributes$timescale===void 0?1:_attributes$timescale,_attributes$periodSta=attributes.periodStart,periodStart=_attributes$periodSta===void 0?0:_attributes$periodSta,_attributes$minimumUp=attributes.minimumUpdatePeriod,minimumUpdatePeriod=_attributes$minimumUp===void 0?0:_attributes$minimumUp;var now=(NOW+clientOffset)/1e3;var periodStartWC=availabilityStartTime+periodStart;var periodEndWC=now+minimumUpdatePeriod;var periodDuration=periodEndWC-periodStartWC;return Math.ceil((periodDuration*timescale-time)/duration)};var parseByTimeline=function parseByTimeline(attributes,segmentTimeline){var type=attributes.type,_attributes$minimumUp2=attributes.minimumUpdatePeriod,minimumUpdatePeriod=_attributes$minimumUp2===void 0?0:_attributes$minimumUp2,_attributes$media=attributes.media,media=_attributes$media===void 0?"":_attributes$media,sourceDuration=attributes.sourceDuration,_attributes$timescale2=attributes.timescale,timescale=_attributes$timescale2===void 0?1:_attributes$timescale2,_attributes$startNumb=attributes.startNumber,startNumber=_attributes$startNumb===void 0?1:_attributes$startNumb,timeline=attributes.periodStart;var segments=[];var time=-1;for(var sIndex=0;sIndex<segmentTimeline.length;sIndex++){var S=segmentTimeline[sIndex];var duration=S.d;var repeat=S.r||0;var segmentTime=S.t||0;if(time<0){time=segmentTime;}if(segmentTime&&segmentTime>time){time=segmentTime;}var count=void 0;if(repeat<0){var nextS=sIndex+1;if(nextS===segmentTimeline.length){if(type==="dynamic"&&minimumUpdatePeriod>0&&media.indexOf("$Number$")>0){count=getLiveRValue(attributes,time,duration);}else {count=(sourceDuration*timescale-time)/duration;}}else {count=(segmentTimeline[nextS].t-time)/duration;}}else {count=repeat+1;}var end=startNumber+segments.length+count;var number=startNumber+segments.length;while(number<end){segments.push({number:number,duration:duration/timescale,time:time,timeline:timeline});time+=duration;number++;}}return segments};var identifierPattern=/\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g;var identifierReplacement=function identifierReplacement(values){return function(match,identifier,format,width){if(match==="$$"){return "$"}if(typeof values[identifier]==="undefined"){return match}var value=""+values[identifier];if(identifier==="RepresentationID"){return value}if(!format){width=1;}else {width=parseInt(width,10);}if(value.length>=width){return value}return ""+new Array(width-value.length+1).join("0")+value}};var constructTemplateUrl=function constructTemplateUrl(url,values){return url.replace(identifierPattern,identifierReplacement(values))};var parseTemplateInfo=function parseTemplateInfo(attributes,segmentTimeline){if(!attributes.duration&&!segmentTimeline){return [{number:attributes.startNumber||1,duration:attributes.sourceDuration,time:0,timeline:attributes.periodStart}]}if(attributes.duration){return parseByDuration(attributes)}return parseByTimeline(attributes,segmentTimeline)};var segmentsFromTemplate=function segmentsFromTemplate(attributes,segmentTimeline){var templateValues={RepresentationID:attributes.id,Bandwidth:attributes.bandwidth||0};var _attributes$initializ=attributes.initialization,initialization=_attributes$initializ===void 0?{sourceURL:"",range:""}:_attributes$initializ;var mapSegment=urlTypeToSegment({baseUrl:attributes.baseUrl,source:constructTemplateUrl(initialization.sourceURL,templateValues),range:initialization.range});var segments=parseTemplateInfo(attributes,segmentTimeline);return segments.map(function(segment){templateValues.Number=segment.number;templateValues.Time=segment.time;var uri=constructTemplateUrl(attributes.media||"",templateValues);var timescale=attributes.timescale||1;var presentationTimeOffset=attributes.presentationTimeOffset||0;var presentationTime=attributes.periodStart+(segment.time-presentationTimeOffset)/timescale;var map={uri:uri,timeline:segment.timeline,duration:segment.duration,resolvedUri:resolveUrl$1(attributes.baseUrl||"",uri),map:mapSegment,number:segment.number,presentationTime:presentationTime};return map})};var SegmentURLToSegmentObject=function SegmentURLToSegmentObject(attributes,segmentUrl){var baseUrl=attributes.baseUrl,_attributes$initializ=attributes.initialization,initialization=_attributes$initializ===void 0?{}:_attributes$initializ;var initSegment=urlTypeToSegment({baseUrl:baseUrl,source:initialization.sourceURL,range:initialization.range});var segment=urlTypeToSegment({baseUrl:baseUrl,source:segmentUrl.media,range:segmentUrl.mediaRange});segment.map=initSegment;return segment};var segmentsFromList=function segmentsFromList(attributes,segmentTimeline){var duration=attributes.duration,_attributes$segmentUr=attributes.segmentUrls,segmentUrls=_attributes$segmentUr===void 0?[]:_attributes$segmentUr,periodStart=attributes.periodStart;if(!duration&&!segmentTimeline||duration&&segmentTimeline){throw new Error(errors.SEGMENT_TIME_UNSPECIFIED)}var segmentUrlMap=segmentUrls.map(function(segmentUrlObject){return SegmentURLToSegmentObject(attributes,segmentUrlObject)});var segmentTimeInfo;if(duration){segmentTimeInfo=parseByDuration(attributes);}if(segmentTimeline){segmentTimeInfo=parseByTimeline(attributes,segmentTimeline);}var segments=segmentTimeInfo.map(function(segmentTime,index){if(segmentUrlMap[index]){var segment=segmentUrlMap[index];var timescale=attributes.timescale||1;var presentationTimeOffset=attributes.presentationTimeOffset||0;segment.timeline=segmentTime.timeline;segment.duration=segmentTime.duration;segment.number=segmentTime.number;segment.presentationTime=periodStart+(segmentTime.time-presentationTimeOffset)/timescale;return segment}}).filter(function(segment){return segment});return segments};var generateSegments=function generateSegments(_ref){var attributes=_ref.attributes,segmentInfo=_ref.segmentInfo;var segmentAttributes;var segmentsFn;if(segmentInfo.template){segmentsFn=segmentsFromTemplate;segmentAttributes=merge(attributes,segmentInfo.template);}else if(segmentInfo.base){segmentsFn=segmentsFromBase;segmentAttributes=merge(attributes,segmentInfo.base);}else if(segmentInfo.list){segmentsFn=segmentsFromList;segmentAttributes=merge(attributes,segmentInfo.list);}var segmentsInfo={attributes:attributes};if(!segmentsFn){return segmentsInfo}var segments=segmentsFn(segmentAttributes,segmentInfo.segmentTimeline);if(segmentAttributes.duration){var _segmentAttributes=segmentAttributes,duration=_segmentAttributes.duration,_segmentAttributes$ti=_segmentAttributes.timescale,timescale=_segmentAttributes$ti===void 0?1:_segmentAttributes$ti;segmentAttributes.duration=duration/timescale;}else if(segments.length){segmentAttributes.duration=segments.reduce(function(max,segment){return Math.max(max,Math.ceil(segment.duration))},0);}else {segmentAttributes.duration=0;}segmentsInfo.attributes=segmentAttributes;segmentsInfo.segments=segments;if(segmentInfo.base&&segmentAttributes.indexRange){segmentsInfo.sidx=segments[0];segmentsInfo.segments=[];}return segmentsInfo};var toPlaylists=function toPlaylists(representations){return representations.map(generateSegments)};var findChildren=function findChildren(element,name){return from(element.childNodes).filter(function(_ref){var tagName=_ref.tagName;return tagName===name})};var getContent=function getContent(element){return element.textContent.trim()};var parseDivisionValue=function parseDivisionValue(value){return parseFloat(value.split("/").reduce(function(prev,current){return prev/current}))};var parseDuration=function parseDuration(str){var SECONDS_IN_YEAR=365*24*60*60;var SECONDS_IN_MONTH=30*24*60*60;var SECONDS_IN_DAY=24*60*60;var SECONDS_IN_HOUR=60*60;var SECONDS_IN_MIN=60;var durationRegex=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/;var match=durationRegex.exec(str);if(!match){return 0}var _match$slice=match.slice(1),year=_match$slice[0],month=_match$slice[1],day=_match$slice[2],hour=_match$slice[3],minute=_match$slice[4],second=_match$slice[5];return parseFloat(year||0)*SECONDS_IN_YEAR+parseFloat(month||0)*SECONDS_IN_MONTH+parseFloat(day||0)*SECONDS_IN_DAY+parseFloat(hour||0)*SECONDS_IN_HOUR+parseFloat(minute||0)*SECONDS_IN_MIN+parseFloat(second||0)};var parseDate=function parseDate(str){var dateRegex=/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/;if(dateRegex.test(str)){str+="Z";}return Date.parse(str)};var parsers={mediaPresentationDuration:function mediaPresentationDuration(value){return parseDuration(value)},availabilityStartTime:function availabilityStartTime(value){return parseDate(value)/1e3},minimumUpdatePeriod:function minimumUpdatePeriod(value){return parseDuration(value)},suggestedPresentationDelay:function suggestedPresentationDelay(value){return parseDuration(value)},type:function type(value){return value},timeShiftBufferDepth:function timeShiftBufferDepth(value){return parseDuration(value)},start:function start(value){return parseDuration(value)},width:function width(value){return parseInt(value,10)},height:function height(value){return parseInt(value,10)},bandwidth:function bandwidth(value){return parseInt(value,10)},frameRate:function frameRate(value){return parseDivisionValue(value)},startNumber:function startNumber(value){return parseInt(value,10)},timescale:function timescale(value){return parseInt(value,10)},presentationTimeOffset:function presentationTimeOffset(value){return parseInt(value,10)},duration:function duration(value){var parsedValue=parseInt(value,10);if(isNaN(parsedValue)){return parseDuration(value)}return parsedValue},d:function d(value){return parseInt(value,10)},t:function t(value){return parseInt(value,10)},r:function r(value){return parseInt(value,10)},DEFAULT:function DEFAULT(value){return value}};var parseAttributes=function parseAttributes(el){if(!(el&&el.attributes)){return {}}return from(el.attributes).reduce(function(a,e){var parseFn=parsers[e.name]||parsers.DEFAULT;a[e.name]=parseFn(e.value);return a},{})};var keySystemsMap={"urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b":"org.w3.clearkey","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":"com.widevine.alpha","urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":"com.microsoft.playready","urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb":"com.adobe.primetime"};var buildBaseUrls=function buildBaseUrls(referenceUrls,baseUrlElements){if(!baseUrlElements.length){return referenceUrls}return flatten(referenceUrls.map(function(reference){return baseUrlElements.map(function(baseUrlElement){return resolveUrl$1(reference,getContent(baseUrlElement))})}))};var getSegmentInformation=function getSegmentInformation(adaptationSet){var segmentTemplate=findChildren(adaptationSet,"SegmentTemplate")[0];var segmentList=findChildren(adaptationSet,"SegmentList")[0];var segmentUrls=segmentList&&findChildren(segmentList,"SegmentURL").map(function(s){return merge({tag:"SegmentURL"},parseAttributes(s))});var segmentBase=findChildren(adaptationSet,"SegmentBase")[0];var segmentTimelineParentNode=segmentList||segmentTemplate;var segmentTimeline=segmentTimelineParentNode&&findChildren(segmentTimelineParentNode,"SegmentTimeline")[0];var segmentInitializationParentNode=segmentList||segmentBase||segmentTemplate;var segmentInitialization=segmentInitializationParentNode&&findChildren(segmentInitializationParentNode,"Initialization")[0];var template=segmentTemplate&&parseAttributes(segmentTemplate);if(template&&segmentInitialization){template.initialization=segmentInitialization&&parseAttributes(segmentInitialization);}else if(template&&template.initialization){template.initialization={sourceURL:template.initialization};}var segmentInfo={template:template,segmentTimeline:segmentTimeline&&findChildren(segmentTimeline,"S").map(function(s){return parseAttributes(s)}),list:segmentList&&merge(parseAttributes(segmentList),{segmentUrls:segmentUrls,initialization:parseAttributes(segmentInitialization)}),base:segmentBase&&merge(parseAttributes(segmentBase),{initialization:parseAttributes(segmentInitialization)})};Object.keys(segmentInfo).forEach(function(key){if(!segmentInfo[key]){delete segmentInfo[key];}});return segmentInfo};var inheritBaseUrls=function inheritBaseUrls(adaptationSetAttributes,adaptationSetBaseUrls,adaptationSetSegmentInfo){return function(representation){var repBaseUrlElements=findChildren(representation,"BaseURL");var repBaseUrls=buildBaseUrls(adaptationSetBaseUrls,repBaseUrlElements);var attributes=merge(adaptationSetAttributes,parseAttributes(representation));var representationSegmentInfo=getSegmentInformation(representation);return repBaseUrls.map(function(baseUrl){return {segmentInfo:merge(adaptationSetSegmentInfo,representationSegmentInfo),attributes:merge(attributes,{baseUrl:baseUrl})}})}};var generateKeySystemInformation=function generateKeySystemInformation(contentProtectionNodes){return contentProtectionNodes.reduce(function(acc,node){var attributes=parseAttributes(node);if(attributes.schemeIdUri){attributes.schemeIdUri=attributes.schemeIdUri.toLowerCase();}var keySystem=keySystemsMap[attributes.schemeIdUri];if(keySystem){acc[keySystem]={attributes:attributes};var psshNode=findChildren(node,"cenc:pssh")[0];if(psshNode){var pssh=getContent(psshNode);acc[keySystem].pssh=pssh&&decodeB64ToUint8Array(pssh);}}return acc},{})};var parseCaptionServiceMetadata=function parseCaptionServiceMetadata(service){if(service.schemeIdUri==="urn:scte:dash:cc:cea-608:2015"){var values=typeof service.value!=="string"?[]:service.value.split(";");return values.map(function(value){var channel;var language;language=value;if(/^CC\d=/.test(value)){var _value$split=value.split("=");channel=_value$split[0];language=_value$split[1];}else if(/^CC\d$/.test(value)){channel=value;}return {channel:channel,language:language}})}else if(service.schemeIdUri==="urn:scte:dash:cc:cea-708:2015"){var _values=typeof service.value!=="string"?[]:service.value.split(";");return _values.map(function(value){var flags={"channel":undefined,"language":undefined,"aspectRatio":1,"easyReader":0,"3D":0};if(/=/.test(value)){var _value$split2=value.split("="),channel=_value$split2[0],_value$split2$=_value$split2[1],opts=_value$split2$===void 0?"":_value$split2$;flags.channel=channel;flags.language=value;opts.split(",").forEach(function(opt){var _opt$split=opt.split(":"),name=_opt$split[0],val=_opt$split[1];if(name==="lang"){flags.language=val;}else if(name==="er"){flags.easyReader=Number(val);}else if(name==="war"){flags.aspectRatio=Number(val);}else if(name==="3D"){flags["3D"]=Number(val);}});}else {flags.language=value;}if(flags.channel){flags.channel="SERVICE"+flags.channel;}return flags})}};var toRepresentations=function toRepresentations(periodAttributes,periodBaseUrls,periodSegmentInfo){return function(adaptationSet){var adaptationSetAttributes=parseAttributes(adaptationSet);var adaptationSetBaseUrls=buildBaseUrls(periodBaseUrls,findChildren(adaptationSet,"BaseURL"));var role=findChildren(adaptationSet,"Role")[0];var roleAttributes={role:parseAttributes(role)};var attrs=merge(periodAttributes,adaptationSetAttributes,roleAttributes);var accessibility=findChildren(adaptationSet,"Accessibility")[0];var captionServices=parseCaptionServiceMetadata(parseAttributes(accessibility));if(captionServices){attrs=merge(attrs,{captionServices:captionServices});}var label=findChildren(adaptationSet,"Label")[0];if(label&&label.childNodes.length){var labelVal=label.childNodes[0].nodeValue.trim();attrs=merge(attrs,{label:labelVal});}var contentProtection=generateKeySystemInformation(findChildren(adaptationSet,"ContentProtection"));if(Object.keys(contentProtection).length){attrs=merge(attrs,{contentProtection:contentProtection});}var segmentInfo=getSegmentInformation(adaptationSet);var representations=findChildren(adaptationSet,"Representation");var adaptationSetSegmentInfo=merge(periodSegmentInfo,segmentInfo);return flatten(representations.map(inheritBaseUrls(attrs,adaptationSetBaseUrls,adaptationSetSegmentInfo)))}};var toAdaptationSets=function toAdaptationSets(mpdAttributes,mpdBaseUrls){return function(period,index){var periodBaseUrls=buildBaseUrls(mpdBaseUrls,findChildren(period.node,"BaseURL"));var periodAttributes=merge(mpdAttributes,{periodStart:period.attributes.start});if(typeof period.attributes.duration==="number"){periodAttributes.periodDuration=period.attributes.duration;}var adaptationSets=findChildren(period.node,"AdaptationSet");var periodSegmentInfo=getSegmentInformation(period.node);return flatten(adaptationSets.map(toRepresentations(periodAttributes,periodBaseUrls,periodSegmentInfo)))}};var getPeriodStart=function getPeriodStart(_ref){var attributes=_ref.attributes,priorPeriodAttributes=_ref.priorPeriodAttributes,mpdType=_ref.mpdType;if(typeof attributes.start==="number"){return attributes.start}if(priorPeriodAttributes&&typeof priorPeriodAttributes.start==="number"&&typeof priorPeriodAttributes.duration==="number"){return priorPeriodAttributes.start+priorPeriodAttributes.duration}if(!priorPeriodAttributes&&mpdType==="static"){return 0}return null};var inheritAttributes=function inheritAttributes(mpd,options){if(options===void 0){options={};}var _options=options,_options$manifestUri=_options.manifestUri,manifestUri=_options$manifestUri===void 0?"":_options$manifestUri,_options$NOW=_options.NOW,NOW=_options$NOW===void 0?Date.now():_options$NOW,_options$clientOffset=_options.clientOffset,clientOffset=_options$clientOffset===void 0?0:_options$clientOffset;var periodNodes=findChildren(mpd,"Period");if(!periodNodes.length){throw new Error(errors.INVALID_NUMBER_OF_PERIOD)}var locations=findChildren(mpd,"Location");var mpdAttributes=parseAttributes(mpd);var mpdBaseUrls=buildBaseUrls([manifestUri],findChildren(mpd,"BaseURL"));mpdAttributes.type=mpdAttributes.type||"static";mpdAttributes.sourceDuration=mpdAttributes.mediaPresentationDuration||0;mpdAttributes.NOW=NOW;mpdAttributes.clientOffset=clientOffset;if(locations.length){mpdAttributes.locations=locations.map(getContent);}var periods=[];periodNodes.forEach(function(node,index){var attributes=parseAttributes(node);var priorPeriod=periods[index-1];attributes.start=getPeriodStart({attributes:attributes,priorPeriodAttributes:priorPeriod?priorPeriod.attributes:null,mpdType:mpdAttributes.type});periods.push({node:node,attributes:attributes});});return {locations:mpdAttributes.locations,representationInfo:flatten(periods.map(toAdaptationSets(mpdAttributes,mpdBaseUrls)))}};var stringToMpdXml=function stringToMpdXml(manifestString){if(manifestString===""){throw new Error(errors.DASH_EMPTY_MANIFEST)}var parser=new DOMParser;var xml;var mpd;try{xml=parser.parseFromString(manifestString,"application/xml");mpd=xml&&xml.documentElement.tagName==="MPD"?xml.documentElement:null;}catch(e){}if(!mpd||mpd&&mpd.getElementsByTagName("parsererror").length>0){throw new Error(errors.DASH_INVALID_XML)}return mpd};var parseUTCTimingScheme=function parseUTCTimingScheme(mpd){var UTCTimingNode=findChildren(mpd,"UTCTiming")[0];if(!UTCTimingNode){return null}var attributes=parseAttributes(UTCTimingNode);switch(attributes.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":attributes.method="HEAD";break;case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":attributes.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":attributes.method="DIRECT";attributes.value=Date.parse(attributes.value);break;case"urn:mpeg:dash:utc:http-ntp:2014":case"urn:mpeg:dash:utc:ntp:2014":case"urn:mpeg:dash:utc:sntp:2014":default:throw new Error(errors.UNSUPPORTED_UTC_TIMING_SCHEME)}return attributes};var parse=function parse(manifestString,options){if(options===void 0){options={};}var parsedManifestInfo=inheritAttributes(stringToMpdXml(manifestString),options);var playlists=toPlaylists(parsedManifestInfo.representationInfo);return toM3u8({dashPlaylists:playlists,locations:parsedManifestInfo.locations,sidxMapping:options.sidxMapping,previousManifest:options.previousManifest})};var parseUTCTiming=function parseUTCTiming(manifestString){return parseUTCTimingScheme(stringToMpdXml(manifestString))};
|
|
154
|
+
|
|
155
|
+
var MAX_UINT32=Math.pow(2,32);var getUint64$1=function(uint8){var dv=new DataView(uint8.buffer,uint8.byteOffset,uint8.byteLength);var value;if(dv.getBigUint64){value=dv.getBigUint64(0);if(value<Number.MAX_SAFE_INTEGER){return Number(value)}return value}return dv.getUint32(0)*MAX_UINT32+dv.getUint32(4)};var numbers={getUint64:getUint64$1,MAX_UINT32:MAX_UINT32};
|
|
156
|
+
|
|
157
|
+
var getUint64=numbers.getUint64;var parseSidx=function(data){var view=new DataView(data.buffer,data.byteOffset,data.byteLength),result={version:data[0],flags:new Uint8Array(data.subarray(1,4)),references:[],referenceId:view.getUint32(4),timescale:view.getUint32(8)},i=12;if(result.version===0){result.earliestPresentationTime=view.getUint32(i);result.firstOffset=view.getUint32(i+4);i+=8;}else {result.earliestPresentationTime=getUint64(data.subarray(i));result.firstOffset=getUint64(data.subarray(i+8));i+=16;}i+=2;var referenceCount=view.getUint16(i);i+=2;for(;referenceCount>0;i+=12,referenceCount--){result.references.push({referenceType:(data[i]&128)>>>7,referencedSize:view.getUint32(i)&2147483647,subsegmentDuration:view.getUint32(i+4),startsWithSap:!!(data[i+8]&128),sapType:(data[i+8]&112)>>>4,sapDeltaTime:view.getUint32(i+8)&268435455});}return result};var parseSidx_1=parseSidx;
|
|
158
|
+
|
|
159
|
+
var ID3=toUint8([73,68,51]);var getId3Size=function getId3Size(bytes,offset){if(offset===void 0){offset=0;}bytes=toUint8(bytes);var flags=bytes[offset+5];var returnSize=bytes[offset+6]<<21|bytes[offset+7]<<14|bytes[offset+8]<<7|bytes[offset+9];var footerPresent=(flags&16)>>4;if(footerPresent){return returnSize+20}return returnSize+10};var getId3Offset=function getId3Offset(bytes,offset){if(offset===void 0){offset=0;}bytes=toUint8(bytes);if(bytes.length-offset<10||!bytesMatch(bytes,ID3,{offset:offset})){return offset}offset+=getId3Size(bytes,offset);return getId3Offset(bytes,offset)};
|
|
160
|
+
|
|
161
|
+
var normalizePath$1=function normalizePath(path){if(typeof path==="string"){return stringToBytes(path)}if(typeof path==="number"){return path}return path};var normalizePaths$1=function normalizePaths(paths){if(!Array.isArray(paths)){return [normalizePath$1(paths)]}return paths.map(function(p){return normalizePath$1(p)})};var findBox=function findBox(bytes,paths,complete){if(complete===void 0){complete=false;}paths=normalizePaths$1(paths);bytes=toUint8(bytes);var results=[];if(!paths.length){return results}var i=0;while(i<bytes.length){var size=(bytes[i]<<24|bytes[i+1]<<16|bytes[i+2]<<8|bytes[i+3])>>>0;var type=bytes.subarray(i+4,i+8);if(size===0){break}var end=i+size;if(end>bytes.length){if(complete){break}end=bytes.length;}var data=bytes.subarray(i+8,end);if(bytesMatch(type,paths[0])){if(paths.length===1){results.push(data);}else {results.push.apply(results,findBox(data,paths.slice(1),complete));}}i=end;}return results};
|
|
162
|
+
|
|
163
|
+
var EBML_TAGS={EBML:toUint8([26,69,223,163]),DocType:toUint8([66,130]),Segment:toUint8([24,83,128,103]),SegmentInfo:toUint8([21,73,169,102]),Tracks:toUint8([22,84,174,107]),Track:toUint8([174]),TrackNumber:toUint8([215]),DefaultDuration:toUint8([35,227,131]),TrackEntry:toUint8([174]),TrackType:toUint8([131]),FlagDefault:toUint8([136]),CodecID:toUint8([134]),CodecPrivate:toUint8([99,162]),VideoTrack:toUint8([224]),AudioTrack:toUint8([225]),Cluster:toUint8([31,67,182,117]),Timestamp:toUint8([231]),TimestampScale:toUint8([42,215,177]),BlockGroup:toUint8([160]),BlockDuration:toUint8([155]),Block:toUint8([161]),SimpleBlock:toUint8([163])};var LENGTH_TABLE=[128,64,32,16,8,4,2,1];var getLength=function getLength(byte){var len=1;for(var i=0;i<LENGTH_TABLE.length;i++){if(byte&LENGTH_TABLE[i]){break}len++;}return len};var getvint=function getvint(bytes,offset,removeLength,signed){if(removeLength===void 0){removeLength=true;}if(signed===void 0){signed=false;}var length=getLength(bytes[offset]);var valueBytes=bytes.subarray(offset,offset+length);if(removeLength){valueBytes=Array.prototype.slice.call(bytes,offset,offset+length);valueBytes[0]^=LENGTH_TABLE[length-1];}return {length:length,value:bytesToNumber(valueBytes,{signed:signed}),bytes:valueBytes}};var normalizePath=function normalizePath(path){if(typeof path==="string"){return path.match(/.{1,2}/g).map(function(p){return normalizePath(p)})}if(typeof path==="number"){return numberToBytes(path)}return path};var normalizePaths=function normalizePaths(paths){if(!Array.isArray(paths)){return [normalizePath(paths)]}return paths.map(function(p){return normalizePath(p)})};var getInfinityDataSize=function getInfinityDataSize(id,bytes,offset){if(offset>=bytes.length){return bytes.length}var innerid=getvint(bytes,offset,false);if(bytesMatch(id.bytes,innerid.bytes)){return offset}var dataHeader=getvint(bytes,offset+innerid.length);return getInfinityDataSize(id,bytes,offset+dataHeader.length+dataHeader.value+innerid.length)};var findEbml=function findEbml(bytes,paths){paths=normalizePaths(paths);bytes=toUint8(bytes);var results=[];if(!paths.length){return results}var i=0;while(i<bytes.length){var id=getvint(bytes,i,false);var dataHeader=getvint(bytes,i+id.length);var dataStart=i+id.length+dataHeader.length;if(dataHeader.value===127){dataHeader.value=getInfinityDataSize(id,bytes,dataStart);if(dataHeader.value!==bytes.length){dataHeader.value-=dataStart;}}var dataEnd=dataStart+dataHeader.value>bytes.length?bytes.length:dataStart+dataHeader.value;var data=bytes.subarray(dataStart,dataEnd);if(bytesMatch(paths[0],id.bytes)){if(paths.length===1){results.push(data);}else {results=results.concat(findEbml(data,paths.slice(1)));}}var totalLength=id.length+dataHeader.length+data.length;i+=totalLength;}return results};
|
|
164
|
+
|
|
165
|
+
var NAL_TYPE_ONE=toUint8([0,0,0,1]);var NAL_TYPE_TWO=toUint8([0,0,1]);var EMULATION_PREVENTION=toUint8([0,0,3]);var discardEmulationPreventionBytes=function discardEmulationPreventionBytes(bytes){var positions=[];var i=1;while(i<bytes.length-2){if(bytesMatch(bytes.subarray(i,i+3),EMULATION_PREVENTION)){positions.push(i+2);i++;}i++;}if(positions.length===0){return bytes}var newLength=bytes.length-positions.length;var newData=new Uint8Array(newLength);var sourceIndex=0;for(i=0;i<newLength;sourceIndex++,i++){if(sourceIndex===positions[0]){sourceIndex++;positions.shift();}newData[i]=bytes[sourceIndex];}return newData};var findNal=function findNal(bytes,dataType,types,nalLimit){if(nalLimit===void 0){nalLimit=Infinity;}bytes=toUint8(bytes);types=[].concat(types);var i=0;var nalStart;var nalsFound=0;while(i<bytes.length&&(nalsFound<nalLimit||nalStart)){var nalOffset=void 0;if(bytesMatch(bytes.subarray(i),NAL_TYPE_ONE)){nalOffset=4;}else if(bytesMatch(bytes.subarray(i),NAL_TYPE_TWO)){nalOffset=3;}if(!nalOffset){i++;continue}nalsFound++;if(nalStart){return discardEmulationPreventionBytes(bytes.subarray(nalStart,i))}var nalType=void 0;if(dataType==="h264"){nalType=bytes[i+nalOffset]&31;}else if(dataType==="h265"){nalType=bytes[i+nalOffset]>>1&63;}if(types.indexOf(nalType)!==-1){nalStart=i+nalOffset;}i+=nalOffset+(dataType==="h264"?1:2);}return bytes.subarray(0,0)};var findH264Nal=function findH264Nal(bytes,type,nalLimit){return findNal(bytes,"h264",type,nalLimit)};var findH265Nal=function findH265Nal(bytes,type,nalLimit){return findNal(bytes,"h265",type,nalLimit)};
|
|
166
|
+
|
|
167
|
+
var CONSTANTS={"webm":toUint8([119,101,98,109]),"matroska":toUint8([109,97,116,114,111,115,107,97]),"flac":toUint8([102,76,97,67]),"ogg":toUint8([79,103,103,83]),"ac3":toUint8([11,119]),"riff":toUint8([82,73,70,70]),"avi":toUint8([65,86,73]),"wav":toUint8([87,65,86,69]),"3gp":toUint8([102,116,121,112,51,103]),"mp4":toUint8([102,116,121,112]),"fmp4":toUint8([115,116,121,112]),"mov":toUint8([102,116,121,112,113,116]),"moov":toUint8([109,111,111,118]),"moof":toUint8([109,111,111,102])};var _isLikely={aac:function aac(bytes){var offset=getId3Offset(bytes);return bytesMatch(bytes,[255,16],{offset:offset,mask:[255,22]})},mp3:function mp3(bytes){var offset=getId3Offset(bytes);return bytesMatch(bytes,[255,2],{offset:offset,mask:[255,6]})},webm:function webm(bytes){var docType=findEbml(bytes,[EBML_TAGS.EBML,EBML_TAGS.DocType])[0];return bytesMatch(docType,CONSTANTS.webm)},mkv:function mkv(bytes){var docType=findEbml(bytes,[EBML_TAGS.EBML,EBML_TAGS.DocType])[0];return bytesMatch(docType,CONSTANTS.matroska)},mp4:function mp4(bytes){if(_isLikely["3gp"](bytes)||_isLikely.mov(bytes)){return false}if(bytesMatch(bytes,CONSTANTS.mp4,{offset:4})||bytesMatch(bytes,CONSTANTS.fmp4,{offset:4})){return true}if(bytesMatch(bytes,CONSTANTS.moof,{offset:4})||bytesMatch(bytes,CONSTANTS.moov,{offset:4})){return true}},mov:function mov(bytes){return bytesMatch(bytes,CONSTANTS.mov,{offset:4})},"3gp":function gp(bytes){return bytesMatch(bytes,CONSTANTS["3gp"],{offset:4})},ac3:function ac3(bytes){var offset=getId3Offset(bytes);return bytesMatch(bytes,CONSTANTS.ac3,{offset:offset})},ts:function ts(bytes){if(bytes.length<189&&bytes.length>=1){return bytes[0]===71}var i=0;while(i+188<bytes.length&&i<188){if(bytes[i]===71&&bytes[i+188]===71){return true}i+=1;}return false},flac:function flac(bytes){var offset=getId3Offset(bytes);return bytesMatch(bytes,CONSTANTS.flac,{offset:offset})},ogg:function ogg(bytes){return bytesMatch(bytes,CONSTANTS.ogg)},avi:function avi(bytes){return bytesMatch(bytes,CONSTANTS.riff)&&bytesMatch(bytes,CONSTANTS.avi,{offset:8})},wav:function wav(bytes){return bytesMatch(bytes,CONSTANTS.riff)&&bytesMatch(bytes,CONSTANTS.wav,{offset:8})},"h264":function h264(bytes){return findH264Nal(bytes,7,3).length},"h265":function h265(bytes){return findH265Nal(bytes,[32,33],3).length}};var isLikelyTypes=Object.keys(_isLikely).filter(function(t){return t!=="ts"&&t!=="h264"&&t!=="h265"}).concat(["ts","h264","h265"]);isLikelyTypes.forEach(function(type){var isLikelyFn=_isLikely[type];_isLikely[type]=function(bytes){return isLikelyFn(toUint8(bytes))};});var isLikely=_isLikely;var detectContainerForBytes=function detectContainerForBytes(bytes){bytes=toUint8(bytes);for(var i=0;i<isLikelyTypes.length;i++){var type=isLikelyTypes[i];if(isLikely[type](bytes)){return type}}return ""};var isLikelyFmp4MediaSegment=function isLikelyFmp4MediaSegment(bytes){return findBox(bytes,["moof"]).length>0};
|
|
168
|
+
|
|
169
|
+
var ONE_SECOND_IN_TS=9e4,secondsToVideoTs,secondsToAudioTs,videoTsToSeconds,audioTsToSeconds,audioTsToVideoTs,videoTsToAudioTs,metadataTsToSeconds;secondsToVideoTs=function(seconds){return seconds*ONE_SECOND_IN_TS};secondsToAudioTs=function(seconds,sampleRate){return seconds*sampleRate};videoTsToSeconds=function(timestamp){return timestamp/ONE_SECOND_IN_TS};audioTsToSeconds=function(timestamp,sampleRate){return timestamp/sampleRate};audioTsToVideoTs=function(timestamp,sampleRate){return secondsToVideoTs(audioTsToSeconds(timestamp,sampleRate))};videoTsToAudioTs=function(timestamp,sampleRate){return secondsToAudioTs(videoTsToSeconds(timestamp),sampleRate)};metadataTsToSeconds=function(timestamp,timelineStartPts,keepOriginalTimestamps){return videoTsToSeconds(keepOriginalTimestamps?timestamp:timestamp-timelineStartPts)};var clock={ONE_SECOND_IN_TS:ONE_SECOND_IN_TS,secondsToVideoTs:secondsToVideoTs,secondsToAudioTs:secondsToAudioTs,videoTsToSeconds:videoTsToSeconds,audioTsToSeconds:audioTsToSeconds,audioTsToVideoTs:audioTsToVideoTs,videoTsToAudioTs:videoTsToAudioTs,metadataTsToSeconds:metadataTsToSeconds};
|
|
170
|
+
|
|
171
|
+
function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_getPrototypeOf(t)}
|
|
172
|
+
|
|
173
|
+
function _isNativeFunction(t){try{return -1!==Function.toString.call(t).indexOf("[native code]")}catch(n){return "function"==typeof t}}
|
|
174
|
+
|
|
175
|
+
function _wrapNativeSuper(t){var r="function"==typeof Map?new Map:void 0;return _wrapNativeSuper=function _wrapNativeSuper(t){if(null===t||!_isNativeFunction(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(t))return r.get(t);r.set(t,Wrapper);}function Wrapper(){return _construct(t,arguments,_getPrototypeOf(this).constructor)}return Wrapper.prototype=Object.create(t.prototype,{constructor:{value:Wrapper,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf(Wrapper,t)},_wrapNativeSuper(t)}
|
|
176
|
+
|
|
177
|
+
var version$5="7.21.2";var hooks_={};var hooks=function hooks(type,fn){hooks_[type]=hooks_[type]||[];if(fn){hooks_[type]=hooks_[type].concat(fn);}return hooks_[type]};var hook=function hook(type,fn){hooks(type,fn);};var removeHook=function removeHook(type,fn){var index=hooks(type).indexOf(fn);if(index<=-1){return false}hooks_[type]=hooks_[type].slice();hooks_[type].splice(index,1);return true};var hookOnce=function hookOnce(type,fn){hooks(type,[].concat(fn).map(function(original){var wrapper=function wrapper(){removeHook(type,wrapper);return original.apply(void 0,arguments)};return wrapper}));};var FullscreenApi={prefixed:true};var apiMap=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror","-moz-full-screen"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError","-ms-fullscreen"]];var specApi=apiMap[0];var browserApi;for(var i=0;i<apiMap.length;i++){if(apiMap[i][1]in document_1){browserApi=apiMap[i];break}}if(browserApi){for(var _i=0;_i<browserApi.length;_i++){FullscreenApi[specApi[_i]]=browserApi[_i];}FullscreenApi.prefixed=browserApi[0]!==specApi[0];}var history=[];var LogByTypeFactory=function LogByTypeFactory(name,log){return function(type,level,args){var lvl=log.levels[level];var lvlRegExp=new RegExp("^("+lvl+")$");if(type!=="log"){args.unshift(type.toUpperCase()+":");}args.unshift(name+":");if(history){history.push([].concat(args));var splice=history.length-1e3;history.splice(0,splice>0?splice:0);}if(!window_1.console){return}var fn=window_1.console[type];if(!fn&&type==="debug"){fn=window_1.console.info||window_1.console.log;}if(!fn||!lvl||!lvlRegExp.test(type)){return}fn[Array.isArray(args)?"apply":"call"](window_1.console,args);}};function createLogger$1(name){var level="info";var logByType;var log=function log(){for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}logByType("log",level,args);};logByType=LogByTypeFactory(name,log);log.createLogger=function(subname){return createLogger$1(name+": "+subname)};log.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:level};log.level=function(lvl){if(typeof lvl==="string"){if(!log.levels.hasOwnProperty(lvl)){throw new Error('"'+lvl+'" in not a valid log level')}level=lvl;}return level};log.history=function(){return history?[].concat(history):[]};log.history.filter=function(fname){return (history||[]).filter(function(historyItem){return new RegExp(".*"+fname+".*").test(historyItem[0])})};log.history.clear=function(){if(history){history.length=0;}};log.history.disable=function(){if(history!==null){history.length=0;history=null;}};log.history.enable=function(){if(history===null){history=[];}};log.error=function(){for(var _len2=arguments.length,args=new Array(_len2),_key2=0;_key2<_len2;_key2++){args[_key2]=arguments[_key2];}return logByType("error",level,args)};log.warn=function(){for(var _len3=arguments.length,args=new Array(_len3),_key3=0;_key3<_len3;_key3++){args[_key3]=arguments[_key3];}return logByType("warn",level,args)};log.debug=function(){for(var _len4=arguments.length,args=new Array(_len4),_key4=0;_key4<_len4;_key4++){args[_key4]=arguments[_key4];}return logByType("debug",level,args)};return log}var log$1=createLogger$1("VIDEOJS");var createLogger=log$1.createLogger;var toString=Object.prototype.toString;var keys=function keys(object){return isObject(object)?Object.keys(object):[]};function each(object,fn){keys(object).forEach(function(key){return fn(object[key],key)});}function reduce(object,fn,initial){if(initial===void 0){initial=0;}return keys(object).reduce(function(accum,key){return fn(accum,object[key],key)},initial)}function assign(target){for(var _len=arguments.length,sources=new Array(_len>1?_len-1:0),_key=1;_key<_len;_key++){sources[_key-1]=arguments[_key];}if(Object.assign){return _extends$3.apply(void 0,[target].concat(sources))}sources.forEach(function(source){if(!source){return}each(source,function(value,key){target[key]=value;});});return target}function isObject(value){return !!value&&typeof value==="object"}function isPlain(value){return isObject(value)&&toString.call(value)==="[object Object]"&&value.constructor===Object}function computedStyle(el,prop){if(!el||!prop){return ""}if(typeof window_1.getComputedStyle==="function"){var computedStyleValue;try{computedStyleValue=window_1.getComputedStyle(el);}catch(e){return ""}return computedStyleValue?computedStyleValue.getPropertyValue(prop)||computedStyleValue[prop]:""}return ""}var USER_AGENT=window_1.navigator&&window_1.navigator.userAgent||"";var webkitVersionMap=/AppleWebKit\/([\d.]+)/i.exec(USER_AGENT);var appleWebkitVersion=webkitVersionMap?parseFloat(webkitVersionMap.pop()):null;var IS_IPOD=/iPod/i.test(USER_AGENT);var IOS_VERSION=function(){var match=USER_AGENT.match(/OS (\d+)_/i);if(match&&match[1]){return match[1]}return null}();var IS_ANDROID=/Android/i.test(USER_AGENT);var ANDROID_VERSION=function(){var match=USER_AGENT.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!match){return null}var major=match[1]&&parseFloat(match[1]);var minor=match[2]&&parseFloat(match[2]);if(major&&minor){return parseFloat(match[1]+"."+match[2])}else if(major){return major}return null}();var IS_NATIVE_ANDROID=IS_ANDROID&&ANDROID_VERSION<5&&appleWebkitVersion<537;var IS_FIREFOX=/Firefox/i.test(USER_AGENT);var IS_EDGE=/Edg/i.test(USER_AGENT);var IS_CHROME=!IS_EDGE&&(/Chrome/i.test(USER_AGENT)||/CriOS/i.test(USER_AGENT));var CHROME_VERSION=function(){var match=USER_AGENT.match(/(Chrome|CriOS)\/(\d+)/);if(match&&match[2]){return parseFloat(match[2])}return null}();var IE_VERSION=function(){var result=/MSIE\s(\d+)\.\d/.exec(USER_AGENT);var version=result&&parseFloat(result[1]);if(!version&&/Trident\/7.0/i.test(USER_AGENT)&&/rv:11.0/.test(USER_AGENT)){version=11;}return version}();var IS_SAFARI=/Safari/i.test(USER_AGENT)&&!IS_CHROME&&!IS_ANDROID&&!IS_EDGE;var IS_WINDOWS=/Windows/i.test(USER_AGENT);var TOUCH_ENABLED=Boolean(isReal()&&("ontouchstart"in window_1||window_1.navigator.maxTouchPoints||window_1.DocumentTouch&&window_1.document instanceof window_1.DocumentTouch));var IS_IPAD=/iPad/i.test(USER_AGENT)||IS_SAFARI&&TOUCH_ENABLED&&!/iPhone/i.test(USER_AGENT);var IS_IPHONE=/iPhone/i.test(USER_AGENT)&&!IS_IPAD;var IS_IOS=IS_IPHONE||IS_IPAD||IS_IPOD;var IS_ANY_SAFARI=(IS_SAFARI||IS_IOS)&&!IS_CHROME;var browser=Object.freeze({__proto__:null,IS_IPOD:IS_IPOD,IOS_VERSION:IOS_VERSION,IS_ANDROID:IS_ANDROID,ANDROID_VERSION:ANDROID_VERSION,IS_NATIVE_ANDROID:IS_NATIVE_ANDROID,IS_FIREFOX:IS_FIREFOX,IS_EDGE:IS_EDGE,IS_CHROME:IS_CHROME,CHROME_VERSION:CHROME_VERSION,IE_VERSION:IE_VERSION,IS_SAFARI:IS_SAFARI,IS_WINDOWS:IS_WINDOWS,TOUCH_ENABLED:TOUCH_ENABLED,IS_IPAD:IS_IPAD,IS_IPHONE:IS_IPHONE,IS_IOS:IS_IOS,IS_ANY_SAFARI:IS_ANY_SAFARI});function isNonBlankString(str){return typeof str==="string"&&Boolean(str.trim())}function throwIfWhitespace(str){if(str.indexOf(" ")>=0){throw new Error("class has illegal whitespace characters")}}function classRegExp(className){return new RegExp("(^|\\s)"+className+"($|\\s)")}function isReal(){return document_1===window_1.document}function isEl(value){return isObject(value)&&value.nodeType===1}function isInFrame(){try{return window_1.parent!==window_1.self}catch(x){return true}}function createQuerier(method){return function(selector,context){if(!isNonBlankString(selector)){return document_1[method](null)}if(isNonBlankString(context)){context=document_1.querySelector(context);}var ctx=isEl(context)?context:document_1;return ctx[method]&&ctx[method](selector)}}function createEl(tagName,properties,attributes,content){if(tagName===void 0){tagName="div";}if(properties===void 0){properties={};}if(attributes===void 0){attributes={};}var el=document_1.createElement(tagName);Object.getOwnPropertyNames(properties).forEach(function(propName){var val=properties[propName];if(propName.indexOf("aria-")!==-1||propName==="role"||propName==="type"){log$1.warn("Setting attributes in the second argument of createEl()\n"+"has been deprecated. Use the third argument instead.\n"+("createEl(type, properties, attributes). Attempting to set "+propName+" to "+val+"."));el.setAttribute(propName,val);}else if(propName==="textContent"){textContent(el,val);}else if(el[propName]!==val||propName==="tabIndex"){el[propName]=val;}});Object.getOwnPropertyNames(attributes).forEach(function(attrName){el.setAttribute(attrName,attributes[attrName]);});if(content){appendContent(el,content);}return el}function textContent(el,text){if(typeof el.textContent==="undefined"){el.innerText=text;}else {el.textContent=text;}return el}function prependTo(child,parent){if(parent.firstChild){parent.insertBefore(child,parent.firstChild);}else {parent.appendChild(child);}}function hasClass(element,classToCheck){throwIfWhitespace(classToCheck);if(element.classList){return element.classList.contains(classToCheck)}return classRegExp(classToCheck).test(element.className)}function addClass(element,classToAdd){if(element.classList){element.classList.add(classToAdd);}else if(!hasClass(element,classToAdd)){element.className=(element.className+" "+classToAdd).trim();}return element}function removeClass(element,classToRemove){if(!element){log$1.warn("removeClass was called with an element that doesn't exist");return null}if(element.classList){element.classList.remove(classToRemove);}else {throwIfWhitespace(classToRemove);element.className=element.className.split(/\s+/).filter(function(c){return c!==classToRemove}).join(" ");}return element}function toggleClass(element,classToToggle,predicate){var has=hasClass(element,classToToggle);if(typeof predicate==="function"){predicate=predicate(element,classToToggle);}if(typeof predicate!=="boolean"){predicate=!has;}if(predicate===has){return}if(predicate){addClass(element,classToToggle);}else {removeClass(element,classToToggle);}return element}function setAttributes(el,attributes){Object.getOwnPropertyNames(attributes).forEach(function(attrName){var attrValue=attributes[attrName];if(attrValue===null||typeof attrValue==="undefined"||attrValue===false){el.removeAttribute(attrName);}else {el.setAttribute(attrName,attrValue===true?"":attrValue);}});}function getAttributes(tag){var obj={};var knownBooleans=","+"autoplay,controls,playsinline,loop,muted,default,defaultMuted"+",";if(tag&&tag.attributes&&tag.attributes.length>0){var attrs=tag.attributes;for(var i=attrs.length-1;i>=0;i--){var attrName=attrs[i].name;var attrVal=attrs[i].value;if(typeof tag[attrName]==="boolean"||knownBooleans.indexOf(","+attrName+",")!==-1){attrVal=attrVal!==null?true:false;}obj[attrName]=attrVal;}}return obj}function getAttribute(el,attribute){return el.getAttribute(attribute)}function setAttribute(el,attribute,value){el.setAttribute(attribute,value);}function removeAttribute(el,attribute){el.removeAttribute(attribute);}function blockTextSelection(){document_1.body.focus();document_1.onselectstart=function(){return false};}function unblockTextSelection(){document_1.onselectstart=function(){return true};}function getBoundingClientRect(el){if(el&&el.getBoundingClientRect&&el.parentNode){var rect=el.getBoundingClientRect();var result={};["bottom","height","left","right","top","width"].forEach(function(k){if(rect[k]!==undefined){result[k]=rect[k];}});if(!result.height){result.height=parseFloat(computedStyle(el,"height"));}if(!result.width){result.width=parseFloat(computedStyle(el,"width"));}return result}}function findPosition(el){if(!el||el&&!el.offsetParent){return {left:0,top:0,width:0,height:0}}var width=el.offsetWidth;var height=el.offsetHeight;var left=0;var top=0;while(el.offsetParent&&el!==document_1[FullscreenApi.fullscreenElement]){left+=el.offsetLeft;top+=el.offsetTop;el=el.offsetParent;}return {left:left,top:top,width:width,height:height}}function getPointerPosition(el,event){var translated={x:0,y:0};if(IS_IOS){var item=el;while(item&&item.nodeName.toLowerCase()!=="html"){var transform=computedStyle(item,"transform");if(/^matrix/.test(transform)){var values=transform.slice(7,-1).split(/,\s/).map(Number);translated.x+=values[4];translated.y+=values[5];}else if(/^matrix3d/.test(transform)){var _values=transform.slice(9,-1).split(/,\s/).map(Number);translated.x+=_values[12];translated.y+=_values[13];}item=item.parentNode;}}var position={};var boxTarget=findPosition(event.target);var box=findPosition(el);var boxW=box.width;var boxH=box.height;var offsetY=event.offsetY-(box.top-boxTarget.top);var offsetX=event.offsetX-(box.left-boxTarget.left);if(event.changedTouches){offsetX=event.changedTouches[0].pageX-box.left;offsetY=event.changedTouches[0].pageY+box.top;if(IS_IOS){offsetX-=translated.x;offsetY-=translated.y;}}position.y=1-Math.max(0,Math.min(1,offsetY/boxH));position.x=Math.max(0,Math.min(1,offsetX/boxW));return position}function isTextNode(value){return isObject(value)&&value.nodeType===3}function emptyEl(el){while(el.firstChild){el.removeChild(el.firstChild);}return el}function normalizeContent(content){if(typeof content==="function"){content=content();}return (Array.isArray(content)?content:[content]).map(function(value){if(typeof value==="function"){value=value();}if(isEl(value)||isTextNode(value)){return value}if(typeof value==="string"&&/\S/.test(value)){return document_1.createTextNode(value)}}).filter(function(value){return value})}function appendContent(el,content){normalizeContent(content).forEach(function(node){return el.appendChild(node)});return el}function insertContent(el,content){return appendContent(emptyEl(el),content)}function isSingleLeftClick(event){if(event.button===undefined&&event.buttons===undefined){return true}if(event.button===0&&event.buttons===undefined){return true}if(event.type==="mouseup"&&event.button===0&&event.buttons===0){return true}if(event.button!==0||event.buttons!==1){return false}return true}var $=createQuerier("querySelector");var $$=createQuerier("querySelectorAll");var Dom=Object.freeze({__proto__:null,isReal:isReal,isEl:isEl,isInFrame:isInFrame,createEl:createEl,textContent:textContent,prependTo:prependTo,hasClass:hasClass,addClass:addClass,removeClass:removeClass,toggleClass:toggleClass,setAttributes:setAttributes,getAttributes:getAttributes,getAttribute:getAttribute,setAttribute:setAttribute,removeAttribute:removeAttribute,blockTextSelection:blockTextSelection,unblockTextSelection:unblockTextSelection,getBoundingClientRect:getBoundingClientRect,findPosition:findPosition,getPointerPosition:getPointerPosition,isTextNode:isTextNode,emptyEl:emptyEl,normalizeContent:normalizeContent,appendContent:appendContent,insertContent:insertContent,isSingleLeftClick:isSingleLeftClick,$:$,$$:$$});var _windowLoaded=false;var videojs$1;var autoSetup=function autoSetup(){if(videojs$1.options.autoSetup===false){return}var vids=Array.prototype.slice.call(document_1.getElementsByTagName("video"));var audios=Array.prototype.slice.call(document_1.getElementsByTagName("audio"));var divs=Array.prototype.slice.call(document_1.getElementsByTagName("video-js"));var mediaEls=vids.concat(audios,divs);if(mediaEls&&mediaEls.length>0){for(var i=0,e=mediaEls.length;i<e;i++){var mediaEl=mediaEls[i];if(mediaEl&&mediaEl.getAttribute){if(mediaEl.player===undefined){var options=mediaEl.getAttribute("data-setup");if(options!==null){videojs$1(mediaEl);}}}else {autoSetupTimeout(1);break}}}else if(!_windowLoaded){autoSetupTimeout(1);}};function autoSetupTimeout(wait,vjs){if(!isReal()){return}if(vjs){videojs$1=vjs;}window_1.setTimeout(autoSetup,wait);}function setWindowLoaded(){_windowLoaded=true;window_1.removeEventListener("load",setWindowLoaded);}if(isReal()){if(document_1.readyState==="complete"){setWindowLoaded();}else {window_1.addEventListener("load",setWindowLoaded);}}var createStyleElement=function createStyleElement(className){var style=document_1.createElement("style");style.className=className;return style};var setTextContent=function setTextContent(el,content){if(el.styleSheet){el.styleSheet.cssText=content;}else {el.textContent=content;}};var _initialGuid=3;var _guid=_initialGuid;function newGUID(){return _guid++}var FakeWeakMap;if(!window_1.WeakMap){FakeWeakMap=function(){function FakeWeakMap(){this.vdata="vdata"+Math.floor(window_1.performance&&window_1.performance.now()||Date.now());this.data={};}var _proto=FakeWeakMap.prototype;_proto.set=function set(key,value){var access=key[this.vdata]||newGUID();if(!key[this.vdata]){key[this.vdata]=access;}this.data[access]=value;return this};_proto.get=function get(key){var access=key[this.vdata];if(access){return this.data[access]}log$1("We have no data for this element",key);return undefined};_proto.has=function has(key){var access=key[this.vdata];return access in this.data};_proto["delete"]=function _delete(key){var access=key[this.vdata];if(access){delete this.data[access];delete key[this.vdata];}};return FakeWeakMap}();}var DomData=window_1.WeakMap?new WeakMap:new FakeWeakMap;function _cleanUpEvents(elem,type){if(!DomData.has(elem)){return}var data=DomData.get(elem);if(data.handlers[type].length===0){delete data.handlers[type];if(elem.removeEventListener){elem.removeEventListener(type,data.dispatcher,false);}else if(elem.detachEvent){elem.detachEvent("on"+type,data.dispatcher);}}if(Object.getOwnPropertyNames(data.handlers).length<=0){delete data.handlers;delete data.dispatcher;delete data.disabled;}if(Object.getOwnPropertyNames(data).length===0){DomData["delete"](elem);}}function _handleMultipleEvents(fn,elem,types,callback){types.forEach(function(type){fn(elem,type,callback);});}function fixEvent(event){if(event.fixed_){return event}function returnTrue(){return true}function returnFalse(){return false}if(!event||!event.isPropagationStopped||!event.isImmediatePropagationStopped){var old=event||window_1.event;event={};for(var key in old){if(key!=="layerX"&&key!=="layerY"&&key!=="keyLocation"&&key!=="webkitMovementX"&&key!=="webkitMovementY"&&key!=="path"){if(!(key==="returnValue"&&old.preventDefault)){event[key]=old[key];}}}if(!event.target){event.target=event.srcElement||document_1;}if(!event.relatedTarget){event.relatedTarget=event.fromElement===event.target?event.toElement:event.fromElement;}event.preventDefault=function(){if(old.preventDefault){old.preventDefault();}event.returnValue=false;old.returnValue=false;event.defaultPrevented=true;};event.defaultPrevented=false;event.stopPropagation=function(){if(old.stopPropagation){old.stopPropagation();}event.cancelBubble=true;old.cancelBubble=true;event.isPropagationStopped=returnTrue;};event.isPropagationStopped=returnFalse;event.stopImmediatePropagation=function(){if(old.stopImmediatePropagation){old.stopImmediatePropagation();}event.isImmediatePropagationStopped=returnTrue;event.stopPropagation();};event.isImmediatePropagationStopped=returnFalse;if(event.clientX!==null&&event.clientX!==undefined){var doc=document_1.documentElement;var body=document_1.body;event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc&&doc.clientLeft||body&&body.clientLeft||0);event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc&&doc.clientTop||body&&body.clientTop||0);}event.which=event.charCode||event.keyCode;if(event.button!==null&&event.button!==undefined){event.button=event.button&1?0:event.button&4?1:event.button&2?2:0;}}event.fixed_=true;return event}var _supportsPassive;var supportsPassive=function supportsPassive(){if(typeof _supportsPassive!=="boolean"){_supportsPassive=false;try{var opts=Object.defineProperty({},"passive",{get:function get(){_supportsPassive=true;}});window_1.addEventListener("test",null,opts);window_1.removeEventListener("test",null,opts);}catch(e){}}return _supportsPassive};var passiveEvents=["touchstart","touchmove"];function on(elem,type,fn){if(Array.isArray(type)){return _handleMultipleEvents(on,elem,type,fn)}if(!DomData.has(elem)){DomData.set(elem,{});}var data=DomData.get(elem);if(!data.handlers){data.handlers={};}if(!data.handlers[type]){data.handlers[type]=[];}if(!fn.guid){fn.guid=newGUID();}data.handlers[type].push(fn);if(!data.dispatcher){data.disabled=false;data.dispatcher=function(event,hash){if(data.disabled){return}event=fixEvent(event);var handlers=data.handlers[event.type];if(handlers){var handlersCopy=handlers.slice(0);for(var m=0,n=handlersCopy.length;m<n;m++){if(event.isImmediatePropagationStopped()){break}else {try{handlersCopy[m].call(elem,event,hash);}catch(e){log$1.error(e);}}}}};}if(data.handlers[type].length===1){if(elem.addEventListener){var options=false;if(supportsPassive()&&passiveEvents.indexOf(type)>-1){options={passive:true};}elem.addEventListener(type,data.dispatcher,options);}else if(elem.attachEvent){elem.attachEvent("on"+type,data.dispatcher);}}}function off(elem,type,fn){if(!DomData.has(elem)){return}var data=DomData.get(elem);if(!data.handlers){return}if(Array.isArray(type)){return _handleMultipleEvents(off,elem,type,fn)}var removeType=function removeType(el,t){data.handlers[t]=[];_cleanUpEvents(el,t);};if(type===undefined){for(var t in data.handlers){if(Object.prototype.hasOwnProperty.call(data.handlers||{},t)){removeType(elem,t);}}return}var handlers=data.handlers[type];if(!handlers){return}if(!fn){removeType(elem,type);return}if(fn.guid){for(var n=0;n<handlers.length;n++){if(handlers[n].guid===fn.guid){handlers.splice(n--,1);}}}_cleanUpEvents(elem,type);}function trigger(elem,event,hash){var elemData=DomData.has(elem)?DomData.get(elem):{};var parent=elem.parentNode||elem.ownerDocument;if(typeof event==="string"){event={type:event,target:elem};}else if(!event.target){event.target=elem;}event=fixEvent(event);if(elemData.dispatcher){elemData.dispatcher.call(elem,event,hash);}if(parent&&!event.isPropagationStopped()&&event.bubbles===true){trigger.call(null,parent,event,hash);}else if(!parent&&!event.defaultPrevented&&event.target&&event.target[event.type]){if(!DomData.has(event.target)){DomData.set(event.target,{});}var targetData=DomData.get(event.target);if(event.target[event.type]){targetData.disabled=true;if(typeof event.target[event.type]==="function"){event.target[event.type]();}targetData.disabled=false;}}return !event.defaultPrevented}function one(elem,type,fn){if(Array.isArray(type)){return _handleMultipleEvents(one,elem,type,fn)}var func=function func(){off(elem,type,func);fn.apply(this,arguments);};func.guid=fn.guid=fn.guid||newGUID();on(elem,type,func);}function any(elem,type,fn){var func=function func(){off(elem,type,func);fn.apply(this,arguments);};func.guid=fn.guid=fn.guid||newGUID();on(elem,type,func);}var Events=Object.freeze({__proto__:null,fixEvent:fixEvent,on:on,off:off,trigger:trigger,one:one,any:any});var UPDATE_REFRESH_INTERVAL=30;var bind=function bind(context,fn,uid){if(!fn.guid){fn.guid=newGUID();}var bound=fn.bind(context);bound.guid=uid?uid+"_"+fn.guid:fn.guid;return bound};var throttle=function throttle(fn,wait){var last=window_1.performance.now();var throttled=function throttled(){var now=window_1.performance.now();if(now-last>=wait){fn.apply(void 0,arguments);last=now;}};return throttled};var debounce=function debounce(func,wait,immediate,context){if(context===void 0){context=window_1;}var timeout;var cancel=function cancel(){context.clearTimeout(timeout);timeout=null;};var debounced=function debounced(){var self1=this;var args=arguments;var _later=function later(){timeout=null;_later=null;if(!immediate){func.apply(self1,args);}};if(!timeout&&immediate){func.apply(self1,args);}context.clearTimeout(timeout);timeout=context.setTimeout(_later,wait);};debounced.cancel=cancel;return debounced};var EventTarget$2=function EventTarget(){};EventTarget$2.prototype.allowedEvents_={};EventTarget$2.prototype.on=function(type,fn){var ael=this.addEventListener;this.addEventListener=function(){};on(this,type,fn);this.addEventListener=ael;};EventTarget$2.prototype.addEventListener=EventTarget$2.prototype.on;EventTarget$2.prototype.off=function(type,fn){off(this,type,fn);};EventTarget$2.prototype.removeEventListener=EventTarget$2.prototype.off;EventTarget$2.prototype.one=function(type,fn){var ael=this.addEventListener;this.addEventListener=function(){};one(this,type,fn);this.addEventListener=ael;};EventTarget$2.prototype.any=function(type,fn){var ael=this.addEventListener;this.addEventListener=function(){};any(this,type,fn);this.addEventListener=ael;};EventTarget$2.prototype.trigger=function(event){var type=event.type||event;if(typeof event==="string"){event={type:type};}event=fixEvent(event);if(this.allowedEvents_[type]&&this["on"+type]){this["on"+type](event);}trigger(this,event);};EventTarget$2.prototype.dispatchEvent=EventTarget$2.prototype.trigger;var EVENT_MAP;EventTarget$2.prototype.queueTrigger=function(event){var _this=this;if(!EVENT_MAP){EVENT_MAP=new Map;}var type=event.type||event;var map=EVENT_MAP.get(this);if(!map){map=new Map;EVENT_MAP.set(this,map);}var oldTimeout=map.get(type);map["delete"](type);window_1.clearTimeout(oldTimeout);var timeout=window_1.setTimeout(function(){map["delete"](type);if(map.size===0){map=null;EVENT_MAP["delete"](_this);}_this.trigger(event);},0);map.set(type,timeout);};var objName=function objName(obj){if(typeof obj.name==="function"){return obj.name()}if(typeof obj.name==="string"){return obj.name}if(obj.name_){return obj.name_}if(obj.constructor&&obj.constructor.name){return obj.constructor.name}return typeof obj};var isEvented=function isEvented(object){return object instanceof EventTarget$2||!!object.eventBusEl_&&["on","one","off","trigger"].every(function(k){return typeof object[k]==="function"})};var addEventedCallback=function addEventedCallback(target,callback){if(isEvented(target)){callback();}else {if(!target.eventedCallbacks){target.eventedCallbacks=[];}target.eventedCallbacks.push(callback);}};var isValidEventType=function isValidEventType(type){return typeof type==="string"&&/\S/.test(type)||Array.isArray(type)&&!!type.length};var validateTarget=function validateTarget(target,obj,fnName){if(!target||!target.nodeName&&!isEvented(target)){throw new Error("Invalid target for "+objName(obj)+"#"+fnName+"; must be a DOM node or evented object.")}};var validateEventType=function validateEventType(type,obj,fnName){if(!isValidEventType(type)){throw new Error("Invalid event type for "+objName(obj)+"#"+fnName+"; must be a non-empty string or array.")}};var validateListener=function validateListener(listener,obj,fnName){if(typeof listener!=="function"){throw new Error("Invalid listener for "+objName(obj)+"#"+fnName+"; must be a function.")}};var normalizeListenArgs=function normalizeListenArgs(self1,args,fnName){var isTargetingSelf=args.length<3||args[0]===self1||args[0]===self1.eventBusEl_;var target;var type;var listener;if(isTargetingSelf){target=self1.eventBusEl_;if(args.length>=3){args.shift();}type=args[0];listener=args[1];}else {target=args[0];type=args[1];listener=args[2];}validateTarget(target,self1,fnName);validateEventType(type,self1,fnName);validateListener(listener,self1,fnName);listener=bind(self1,listener);return {isTargetingSelf:isTargetingSelf,target:target,type:type,listener:listener}};var listen=function listen(target,method,type,listener){validateTarget(target,target,method);if(target.nodeName){Events[method](target,type,listener);}else {target[method](type,listener);}};var EventedMixin={on:function on(){var _this=this;for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}var _normalizeListenArgs=normalizeListenArgs(this,args,"on"),isTargetingSelf=_normalizeListenArgs.isTargetingSelf,target=_normalizeListenArgs.target,type=_normalizeListenArgs.type,listener=_normalizeListenArgs.listener;listen(target,"on",type,listener);if(!isTargetingSelf){var removeListenerOnDispose=function removeListenerOnDispose(){return _this.off(target,type,listener)};removeListenerOnDispose.guid=listener.guid;var removeRemoverOnTargetDispose=function removeRemoverOnTargetDispose(){return _this.off("dispose",removeListenerOnDispose)};removeRemoverOnTargetDispose.guid=listener.guid;listen(this,"on","dispose",removeListenerOnDispose);listen(target,"on","dispose",removeRemoverOnTargetDispose);}},one:function one(){var _this2=this;for(var _len2=arguments.length,args=new Array(_len2),_key2=0;_key2<_len2;_key2++){args[_key2]=arguments[_key2];}var _normalizeListenArgs2=normalizeListenArgs(this,args,"one"),isTargetingSelf=_normalizeListenArgs2.isTargetingSelf,target=_normalizeListenArgs2.target,type=_normalizeListenArgs2.type,listener=_normalizeListenArgs2.listener;if(isTargetingSelf){listen(target,"one",type,listener);}else {var wrapper=function wrapper(){_this2.off(target,type,wrapper);for(var _len3=arguments.length,largs=new Array(_len3),_key3=0;_key3<_len3;_key3++){largs[_key3]=arguments[_key3];}listener.apply(null,largs);};wrapper.guid=listener.guid;listen(target,"one",type,wrapper);}},any:function any(){var _this3=this;for(var _len4=arguments.length,args=new Array(_len4),_key4=0;_key4<_len4;_key4++){args[_key4]=arguments[_key4];}var _normalizeListenArgs3=normalizeListenArgs(this,args,"any"),isTargetingSelf=_normalizeListenArgs3.isTargetingSelf,target=_normalizeListenArgs3.target,type=_normalizeListenArgs3.type,listener=_normalizeListenArgs3.listener;if(isTargetingSelf){listen(target,"any",type,listener);}else {var wrapper=function wrapper(){_this3.off(target,type,wrapper);for(var _len5=arguments.length,largs=new Array(_len5),_key5=0;_key5<_len5;_key5++){largs[_key5]=arguments[_key5];}listener.apply(null,largs);};wrapper.guid=listener.guid;listen(target,"any",type,wrapper);}},off:function off$1(targetOrType,typeOrListener,listener){if(!targetOrType||isValidEventType(targetOrType)){off(this.eventBusEl_,targetOrType,typeOrListener);}else {var target=targetOrType;var type=typeOrListener;validateTarget(target,this,"off");validateEventType(type,this,"off");validateListener(listener,this,"off");listener=bind(this,listener);this.off("dispose",listener);if(target.nodeName){off(target,type,listener);off(target,"dispose",listener);}else if(isEvented(target)){target.off(type,listener);target.off("dispose",listener);}}},trigger:function trigger$1(event,hash){validateTarget(this.eventBusEl_,this,"trigger");var type=event&&typeof event!=="string"?event.type:event;if(!isValidEventType(type)){var error="Invalid event type for "+objName(this)+"#trigger; "+"must be a non-empty string or object with a type key that has a non-empty value.";if(event){(this.log||log$1).error(error);}else {throw new Error(error)}}return trigger(this.eventBusEl_,event,hash)}};function evented(target,options){if(options===void 0){options={};}var _options=options,eventBusKey=_options.eventBusKey;if(eventBusKey){if(!target[eventBusKey].nodeName){throw new Error('The eventBusKey "'+eventBusKey+'" does not refer to an element.')}target.eventBusEl_=target[eventBusKey];}else {target.eventBusEl_=createEl("span",{className:"vjs-event-bus"});}assign(target,EventedMixin);if(target.eventedCallbacks){target.eventedCallbacks.forEach(function(callback){callback();});}target.on("dispose",function(){target.off();[target,target.el_,target.eventBusEl_].forEach(function(val){if(val&&DomData.has(val)){DomData["delete"](val);}});window_1.setTimeout(function(){target.eventBusEl_=null;},0);});return target}var StatefulMixin={state:{},setState:function setState(stateUpdates){var _this=this;if(typeof stateUpdates==="function"){stateUpdates=stateUpdates();}var changes;each(stateUpdates,function(value,key){if(_this.state[key]!==value){changes=changes||{};changes[key]={from:_this.state[key],to:value};}_this.state[key]=value;});if(changes&&isEvented(this)){this.trigger({changes:changes,type:"statechanged"});}return changes}};function stateful(target,defaultState){assign(target,StatefulMixin);target.state=assign({},target.state,defaultState);if(typeof target.handleStateChanged==="function"&&isEvented(target)){target.on("statechanged",target.handleStateChanged);}return target}var toLowerCase=function toLowerCase(string){if(typeof string!=="string"){return string}return string.replace(/./,function(w){return w.toLowerCase()})};var toTitleCase$1=function toTitleCase(string){if(typeof string!=="string"){return string}return string.replace(/./,function(w){return w.toUpperCase()})};var titleCaseEquals=function titleCaseEquals(str1,str2){return toTitleCase$1(str1)===toTitleCase$1(str2)};function mergeOptions$3(){var result={};for(var _len=arguments.length,sources=new Array(_len),_key=0;_key<_len;_key++){sources[_key]=arguments[_key];}sources.forEach(function(source){if(!source){return}each(source,function(value,key){if(!isPlain(value)){result[key]=value;return}if(!isPlain(result[key])){result[key]={};}result[key]=mergeOptions$3(result[key],value);});});return result}var MapSham=function(){function MapSham(){this.map_={};}var _proto=MapSham.prototype;_proto.has=function has(key){return key in this.map_};_proto["delete"]=function _delete(key){var has=this.has(key);delete this.map_[key];return has};_proto.set=function set(key,value){this.map_[key]=value;return this};_proto.forEach=function forEach(callback,thisArg){for(var key in this.map_){callback.call(thisArg,this.map_[key],key,this);}};return MapSham}();var Map$1=window_1.Map?window_1.Map:MapSham;var SetSham=function(){function SetSham(){this.set_={};}var _proto=SetSham.prototype;_proto.has=function has(key){return key in this.set_};_proto["delete"]=function _delete(key){var has=this.has(key);delete this.set_[key];return has};_proto.add=function add(key){this.set_[key]=1;return this};_proto.forEach=function forEach(callback,thisArg){for(var key in this.set_){callback.call(thisArg,key,key,this);}};return SetSham}();var Set$1=window_1.Set?window_1.Set:SetSham;var Component$1=function(){function Component(player,options,ready){var _this=this;if(!player&&this.play){this.player_=player=this;}else {this.player_=player;}this.isDisposed_=false;this.parentComponent_=null;this.options_=mergeOptions$3({},this.options_);options=this.options_=mergeOptions$3(this.options_,options);this.id_=options.id||options.el&&options.el.id;if(!this.id_){var id=player&&player.id&&player.id()||"no_player";this.id_=id+"_component_"+newGUID();}this.name_=options.name||null;if(options.el){this.el_=options.el;}else if(options.createEl!==false){this.el_=this.createEl();}if(options.className&&this.el_){options.className.split(" ").forEach(function(c){return _this.addClass(c)});}if(options.evented!==false){evented(this,{eventBusKey:this.el_?"el_":null});this.handleLanguagechange=this.handleLanguagechange.bind(this);this.on(this.player_,"languagechange",this.handleLanguagechange);}stateful(this,this.constructor.defaultState);this.children_=[];this.childIndex_={};this.childNameIndex_={};this.setTimeoutIds_=new Set$1;this.setIntervalIds_=new Set$1;this.rafIds_=new Set$1;this.namedRafs_=new Map$1;this.clearingTimersOnDispose_=false;if(options.initChildren!==false){this.initChildren();}this.ready(ready);if(options.reportTouchActivity!==false){this.enableTouchActivity();}}var _proto=Component.prototype;_proto.dispose=function dispose(options){if(options===void 0){options={};}if(this.isDisposed_){return}if(this.readyQueue_){this.readyQueue_.length=0;}this.trigger({type:"dispose",bubbles:false});this.isDisposed_=true;if(this.children_){for(var i=this.children_.length-1;i>=0;i--){if(this.children_[i].dispose){this.children_[i].dispose();}}}this.children_=null;this.childIndex_=null;this.childNameIndex_=null;this.parentComponent_=null;if(this.el_){if(this.el_.parentNode){if(options.restoreEl){this.el_.parentNode.replaceChild(options.restoreEl,this.el_);}else {this.el_.parentNode.removeChild(this.el_);}}this.el_=null;}this.player_=null;};_proto.isDisposed=function isDisposed(){return Boolean(this.isDisposed_)};_proto.player=function player(){return this.player_};_proto.options=function options(obj){if(!obj){return this.options_}this.options_=mergeOptions$3(this.options_,obj);return this.options_};_proto.el=function el(){return this.el_};_proto.createEl=function createEl$1(tagName,properties,attributes){return createEl(tagName,properties,attributes)};_proto.localize=function localize(string,tokens,defaultValue){if(defaultValue===void 0){defaultValue=string;}var code=this.player_.language&&this.player_.language();var languages=this.player_.languages&&this.player_.languages();var language=languages&&languages[code];var primaryCode=code&&code.split("-")[0];var primaryLang=languages&&languages[primaryCode];var localizedString=defaultValue;if(language&&language[string]){localizedString=language[string];}else if(primaryLang&&primaryLang[string]){localizedString=primaryLang[string];}if(tokens){localizedString=localizedString.replace(/\{(\d+)\}/g,function(match,index){var value=tokens[index-1];var ret=value;if(typeof value==="undefined"){ret=match;}return ret});}return localizedString};_proto.handleLanguagechange=function handleLanguagechange(){};_proto.contentEl=function contentEl(){return this.contentEl_||this.el_};_proto.id=function id(){return this.id_};_proto.name=function name(){return this.name_};_proto.children=function children(){return this.children_};_proto.getChildById=function getChildById(id){return this.childIndex_[id]};_proto.getChild=function getChild(name){if(!name){return}return this.childNameIndex_[name]};_proto.getDescendant=function getDescendant(){for(var _len=arguments.length,names=new Array(_len),_key=0;_key<_len;_key++){names[_key]=arguments[_key];}names=names.reduce(function(acc,n){return acc.concat(n)},[]);var currentChild=this;for(var i=0;i<names.length;i++){currentChild=currentChild.getChild(names[i]);if(!currentChild||!currentChild.getChild){return}}return currentChild};_proto.addChild=function addChild(child,options,index){if(options===void 0){options={};}if(index===void 0){index=this.children_.length;}var component;var componentName;if(typeof child==="string"){componentName=toTitleCase$1(child);var componentClassName=options.componentClass||componentName;options.name=componentName;var ComponentClass=Component.getComponent(componentClassName);if(!ComponentClass){throw new Error("Component "+componentClassName+" does not exist")}if(typeof ComponentClass!=="function"){return null}component=new ComponentClass(this.player_||this,options);}else {component=child;}if(component.parentComponent_){component.parentComponent_.removeChild(component);}this.children_.splice(index,0,component);component.parentComponent_=this;if(typeof component.id==="function"){this.childIndex_[component.id()]=component;}componentName=componentName||component.name&&toTitleCase$1(component.name());if(componentName){this.childNameIndex_[componentName]=component;this.childNameIndex_[toLowerCase(componentName)]=component;}if(typeof component.el==="function"&&component.el()){var refNode=null;if(this.children_[index+1]){if(this.children_[index+1].el_){refNode=this.children_[index+1].el_;}else if(isEl(this.children_[index+1])){refNode=this.children_[index+1];}}this.contentEl().insertBefore(component.el(),refNode);}return component};_proto.removeChild=function removeChild(component){if(typeof component==="string"){component=this.getChild(component);}if(!component||!this.children_){return}var childFound=false;for(var i=this.children_.length-1;i>=0;i--){if(this.children_[i]===component){childFound=true;this.children_.splice(i,1);break}}if(!childFound){return}component.parentComponent_=null;this.childIndex_[component.id()]=null;this.childNameIndex_[toTitleCase$1(component.name())]=null;this.childNameIndex_[toLowerCase(component.name())]=null;var compEl=component.el();if(compEl&&compEl.parentNode===this.contentEl()){this.contentEl().removeChild(component.el());}};_proto.initChildren=function initChildren(){var _this2=this;var children=this.options_.children;if(children){var parentOptions=this.options_;var handleAdd=function handleAdd(child){var name=child.name;var opts=child.opts;if(parentOptions[name]!==undefined){opts=parentOptions[name];}if(opts===false){return}if(opts===true){opts={};}opts.playerOptions=_this2.options_.playerOptions;var newChild=_this2.addChild(name,opts);if(newChild){_this2[name]=newChild;}};var workingChildren;var Tech=Component.getComponent("Tech");if(Array.isArray(children)){workingChildren=children;}else {workingChildren=Object.keys(children);}workingChildren.concat(Object.keys(this.options_).filter(function(child){return !workingChildren.some(function(wchild){if(typeof wchild==="string"){return child===wchild}return child===wchild.name})})).map(function(child){var name;var opts;if(typeof child==="string"){name=child;opts=children[name]||_this2.options_[name]||{};}else {name=child.name;opts=child;}return {name:name,opts:opts}}).filter(function(child){var c=Component.getComponent(child.opts.componentClass||toTitleCase$1(child.name));return c&&!Tech.isTech(c)}).forEach(handleAdd);}};_proto.buildCSSClass=function buildCSSClass(){return ""};_proto.ready=function ready(fn,sync){if(sync===void 0){sync=false;}if(!fn){return}if(!this.isReady_){this.readyQueue_=this.readyQueue_||[];this.readyQueue_.push(fn);return}if(sync){fn.call(this);}else {this.setTimeout(fn,1);}};_proto.triggerReady=function triggerReady(){this.isReady_=true;this.setTimeout(function(){var readyQueue=this.readyQueue_;this.readyQueue_=[];if(readyQueue&&readyQueue.length>0){readyQueue.forEach(function(fn){fn.call(this);},this);}this.trigger("ready");},1);};_proto.$=function $$1(selector,context){return $(selector,context||this.contentEl())};_proto.$$=function $$$1(selector,context){return $$(selector,context||this.contentEl())};_proto.hasClass=function hasClass$1(classToCheck){return hasClass(this.el_,classToCheck)};_proto.addClass=function addClass$1(classToAdd){addClass(this.el_,classToAdd);};_proto.removeClass=function removeClass$1(classToRemove){removeClass(this.el_,classToRemove);};_proto.toggleClass=function toggleClass$1(classToToggle,predicate){toggleClass(this.el_,classToToggle,predicate);};_proto.show=function show(){this.removeClass("vjs-hidden");};_proto.hide=function hide(){this.addClass("vjs-hidden");};_proto.lockShowing=function lockShowing(){this.addClass("vjs-lock-showing");};_proto.unlockShowing=function unlockShowing(){this.removeClass("vjs-lock-showing");};_proto.getAttribute=function getAttribute$1(attribute){return getAttribute(this.el_,attribute)};_proto.setAttribute=function setAttribute$1(attribute,value){setAttribute(this.el_,attribute,value);};_proto.removeAttribute=function removeAttribute$1(attribute){removeAttribute(this.el_,attribute);};_proto.width=function width(num,skipListeners){return this.dimension("width",num,skipListeners)};_proto.height=function height(num,skipListeners){return this.dimension("height",num,skipListeners)};_proto.dimensions=function dimensions(width,height){this.width(width,true);this.height(height);};_proto.dimension=function dimension(widthOrHeight,num,skipListeners){if(num!==undefined){if(num===null||num!==num){num=0;}if((""+num).indexOf("%")!==-1||(""+num).indexOf("px")!==-1){this.el_.style[widthOrHeight]=num;}else if(num==="auto"){this.el_.style[widthOrHeight]="";}else {this.el_.style[widthOrHeight]=num+"px";}if(!skipListeners){this.trigger("componentresize");}return}if(!this.el_){return 0}var val=this.el_.style[widthOrHeight];var pxIndex=val.indexOf("px");if(pxIndex!==-1){return parseInt(val.slice(0,pxIndex),10)}return parseInt(this.el_["offset"+toTitleCase$1(widthOrHeight)],10)};_proto.currentDimension=function currentDimension(widthOrHeight){var computedWidthOrHeight=0;if(widthOrHeight!=="width"&&widthOrHeight!=="height"){throw new Error("currentDimension only accepts width or height value")}computedWidthOrHeight=computedStyle(this.el_,widthOrHeight);computedWidthOrHeight=parseFloat(computedWidthOrHeight);if(computedWidthOrHeight===0||isNaN(computedWidthOrHeight)){var rule="offset"+toTitleCase$1(widthOrHeight);computedWidthOrHeight=this.el_[rule];}return computedWidthOrHeight};_proto.currentDimensions=function currentDimensions(){return {width:this.currentDimension("width"),height:this.currentDimension("height")}};_proto.currentWidth=function currentWidth(){return this.currentDimension("width")};_proto.currentHeight=function currentHeight(){return this.currentDimension("height")};_proto.focus=function focus(){this.el_.focus();};_proto.blur=function blur(){this.el_.blur();};_proto.handleKeyDown=function handleKeyDown(event){if(this.player_){if(!keycode.isEventKey(event,"Tab")){event.stopPropagation();}this.player_.handleKeyDown(event);}};_proto.handleKeyPress=function handleKeyPress(event){this.handleKeyDown(event);};_proto.emitTapEvents=function emitTapEvents(){var touchStart=0;var firstTouch=null;var tapMovementThreshold=10;var touchTimeThreshold=200;var couldBeTap;this.on("touchstart",function(event){if(event.touches.length===1){firstTouch={pageX:event.touches[0].pageX,pageY:event.touches[0].pageY};touchStart=window_1.performance.now();couldBeTap=true;}});this.on("touchmove",function(event){if(event.touches.length>1){couldBeTap=false;}else if(firstTouch){var xdiff=event.touches[0].pageX-firstTouch.pageX;var ydiff=event.touches[0].pageY-firstTouch.pageY;var touchDistance=Math.sqrt(xdiff*xdiff+ydiff*ydiff);if(touchDistance>tapMovementThreshold){couldBeTap=false;}}});var noTap=function noTap(){couldBeTap=false;};this.on("touchleave",noTap);this.on("touchcancel",noTap);this.on("touchend",function(event){firstTouch=null;if(couldBeTap===true){var touchTime=window_1.performance.now()-touchStart;if(touchTime<touchTimeThreshold){event.preventDefault();this.trigger("tap");}}});};_proto.enableTouchActivity=function enableTouchActivity(){if(!this.player()||!this.player().reportUserActivity){return}var report=bind(this.player(),this.player().reportUserActivity);var touchHolding;this.on("touchstart",function(){report();this.clearInterval(touchHolding);touchHolding=this.setInterval(report,250);});var touchEnd=function touchEnd(event){report();this.clearInterval(touchHolding);};this.on("touchmove",report);this.on("touchend",touchEnd);this.on("touchcancel",touchEnd);};_proto.setTimeout=function setTimeout1(fn,timeout){var _this3=this;var timeoutId;fn=bind(this,fn);this.clearTimersOnDispose_();timeoutId=window_1.setTimeout(function(){if(_this3.setTimeoutIds_.has(timeoutId)){_this3.setTimeoutIds_["delete"](timeoutId);}fn();},timeout);this.setTimeoutIds_.add(timeoutId);return timeoutId};_proto.clearTimeout=function clearTimeout1(timeoutId){if(this.setTimeoutIds_.has(timeoutId)){this.setTimeoutIds_["delete"](timeoutId);window_1.clearTimeout(timeoutId);}return timeoutId};_proto.setInterval=function setInterval(fn,interval){fn=bind(this,fn);this.clearTimersOnDispose_();var intervalId=window_1.setInterval(fn,interval);this.setIntervalIds_.add(intervalId);return intervalId};_proto.clearInterval=function clearInterval(intervalId){if(this.setIntervalIds_.has(intervalId)){this.setIntervalIds_["delete"](intervalId);window_1.clearInterval(intervalId);}return intervalId};_proto.requestAnimationFrame=function requestAnimationFrame(fn){var _this4=this;if(!this.supportsRaf_){return this.setTimeout(fn,1e3/60)}this.clearTimersOnDispose_();var id;fn=bind(this,fn);id=window_1.requestAnimationFrame(function(){if(_this4.rafIds_.has(id)){_this4.rafIds_["delete"](id);}fn();});this.rafIds_.add(id);return id};_proto.requestNamedAnimationFrame=function requestNamedAnimationFrame(name,fn){var _this5=this;if(this.namedRafs_.has(name)){return}this.clearTimersOnDispose_();fn=bind(this,fn);var id=this.requestAnimationFrame(function(){fn();if(_this5.namedRafs_.has(name)){_this5.namedRafs_["delete"](name);}});this.namedRafs_.set(name,id);return name};_proto.cancelNamedAnimationFrame=function cancelNamedAnimationFrame(name){if(!this.namedRafs_.has(name)){return}this.cancelAnimationFrame(this.namedRafs_.get(name));this.namedRafs_["delete"](name);};_proto.cancelAnimationFrame=function cancelAnimationFrame(id){if(!this.supportsRaf_){return this.clearTimeout(id)}if(this.rafIds_.has(id)){this.rafIds_["delete"](id);window_1.cancelAnimationFrame(id);}return id};_proto.clearTimersOnDispose_=function clearTimersOnDispose_(){var _this6=this;if(this.clearingTimersOnDispose_){return}this.clearingTimersOnDispose_=true;this.one("dispose",function(){[["namedRafs_","cancelNamedAnimationFrame"],["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach(function(_ref){var idName=_ref[0],cancelName=_ref[1];_this6[idName].forEach(function(val,key){return _this6[cancelName](key)});});_this6.clearingTimersOnDispose_=false;});};Component.registerComponent=function registerComponent(name,ComponentToRegister){if(typeof name!=="string"||!name){throw new Error('Illegal component name, "'+name+'"; must be a non-empty string.')}var Tech=Component.getComponent("Tech");var isTech=Tech&&Tech.isTech(ComponentToRegister);var isComp=Component===ComponentToRegister||Component.prototype.isPrototypeOf(ComponentToRegister.prototype);if(isTech||!isComp){var reason;if(isTech){reason="techs must be registered using Tech.registerTech()";}else {reason="must be a Component subclass";}throw new Error('Illegal component, "'+name+'"; '+reason+".")}name=toTitleCase$1(name);if(!Component.components_){Component.components_={};}var Player=Component.getComponent("Player");if(name==="Player"&&Player&&Player.players){var players=Player.players;var playerNames=Object.keys(players);if(players&&playerNames.length>0&&playerNames.map(function(pname){return players[pname]}).every(Boolean)){throw new Error("Can not register Player component after player has been created.")}}Component.components_[name]=ComponentToRegister;Component.components_[toLowerCase(name)]=ComponentToRegister;return ComponentToRegister};Component.getComponent=function getComponent(name){if(!name||!Component.components_){return}return Component.components_[name]};return Component}();Component$1.prototype.supportsRaf_=typeof window_1.requestAnimationFrame==="function"&&typeof window_1.cancelAnimationFrame==="function";Component$1.registerComponent("Component",Component$1);function rangeCheck(fnName,index,maxIndex){if(typeof index!=="number"||index<0||index>maxIndex){throw new Error("Failed to execute '"+fnName+"' on 'TimeRanges': The index provided ("+index+") is non-numeric or out of bounds (0-"+maxIndex+").")}}function getRange(fnName,valueIndex,ranges,rangeIndex){rangeCheck(fnName,rangeIndex,ranges.length-1);return ranges[rangeIndex][valueIndex]}function createTimeRangesObj(ranges){var timeRangesObj;if(ranges===undefined||ranges.length===0){timeRangesObj={length:0,start:function start(){throw new Error("This TimeRanges object is empty")},end:function end(){throw new Error("This TimeRanges object is empty")}};}else {timeRangesObj={length:ranges.length,start:getRange.bind(null,"start",0,ranges),end:getRange.bind(null,"end",1,ranges)};}if(window_1.Symbol&&window_1.Symbol.iterator){timeRangesObj[window_1.Symbol.iterator]=function(){return (ranges||[]).values()};}return timeRangesObj}function createTimeRanges(start,end){if(Array.isArray(start)){return createTimeRangesObj(start)}else if(start===undefined||end===undefined){return createTimeRangesObj()}return createTimeRangesObj([[start,end]])}function bufferedPercent(buffered,duration){var bufferedDuration=0;var start;var end;if(!duration){return 0}if(!buffered||!buffered.length){buffered=createTimeRanges(0,0);}for(var i=0;i<buffered.length;i++){start=buffered.start(i);end=buffered.end(i);if(end>duration){end=duration;}bufferedDuration+=end-start;}return bufferedDuration/duration}function MediaError(value){if(value instanceof MediaError){return value}if(typeof value==="number"){this.code=value;}else if(typeof value==="string"){this.message=value;}else if(isObject(value)){if(typeof value.code==="number"){this.code=value.code;}assign(this,value);}if(!this.message){this.message=MediaError.defaultMessages[this.code]||"";}}MediaError.prototype.code=0;MediaError.prototype.message="";MediaError.prototype.status=null;MediaError.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"];MediaError.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail part-way.",3:"The media playback was aborted due to a corruption problem or because the media used features your browser did not support.",4:"The media could not be loaded, either because the server or network failed or because the format is not supported.",5:"The media is encrypted and we do not have the keys to decrypt it."};for(var errNum=0;errNum<MediaError.errorTypes.length;errNum++){MediaError[MediaError.errorTypes[errNum]]=errNum;MediaError.prototype[MediaError.errorTypes[errNum]]=errNum;}function isPromise(value){return value!==undefined&&value!==null&&typeof value.then==="function"}function silencePromise(value){if(isPromise(value)){value.then(null,function(e){});}}var trackToJson_=function trackToJson_(track){var ret=["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce(function(acc,prop,i){if(track[prop]){acc[prop]=track[prop];}return acc},{cues:track.cues&&Array.prototype.map.call(track.cues,function(cue){return {startTime:cue.startTime,endTime:cue.endTime,text:cue.text,id:cue.id}})});return ret};var textTracksToJson=function textTracksToJson(tech){var trackEls=tech.$$("track");var trackObjs=Array.prototype.map.call(trackEls,function(t){return t.track});var tracks=Array.prototype.map.call(trackEls,function(trackEl){var json=trackToJson_(trackEl.track);if(trackEl.src){json.src=trackEl.src;}return json});return tracks.concat(Array.prototype.filter.call(tech.textTracks(),function(track){return trackObjs.indexOf(track)===-1}).map(trackToJson_))};var jsonToTextTracks=function jsonToTextTracks(json,tech){json.forEach(function(track){var addedTrack=tech.addRemoteTextTrack(track).track;if(!track.src&&track.cues){track.cues.forEach(function(cue){return addedTrack.addCue(cue)});}});return tech.textTracks()};var textTrackConverter={textTracksToJson:textTracksToJson,jsonToTextTracks:jsonToTextTracks,trackToJson_:trackToJson_};var MODAL_CLASS_NAME="vjs-modal-dialog";var ModalDialog=function(_Component){_inheritsLoose(ModalDialog,_Component);function ModalDialog(player,options){var _this;_this=_Component.call(this,player,options)||this;_this.handleKeyDown_=function(e){return _this.handleKeyDown(e)};_this.close_=function(e){return _this.close(e)};_this.opened_=_this.hasBeenOpened_=_this.hasBeenFilled_=false;_this.closeable(!_this.options_.uncloseable);_this.content(_this.options_.content);_this.contentEl_=createEl("div",{className:MODAL_CLASS_NAME+"-content"},{role:"document"});_this.descEl_=createEl("p",{className:MODAL_CLASS_NAME+"-description vjs-control-text",id:_this.el().getAttribute("aria-describedby")});textContent(_this.descEl_,_this.description());_this.el_.appendChild(_this.descEl_);_this.el_.appendChild(_this.contentEl_);return _this}var _proto=ModalDialog.prototype;_proto.createEl=function createEl(){return _Component.prototype.createEl.call(this,"div",{className:this.buildCSSClass(),tabIndex:-1},{"aria-describedby":this.id()+"_description","aria-hidden":"true","aria-label":this.label(),"role":"dialog"})};_proto.dispose=function dispose(){this.contentEl_=null;this.descEl_=null;this.previouslyActiveEl_=null;_Component.prototype.dispose.call(this);};_proto.buildCSSClass=function buildCSSClass(){return MODAL_CLASS_NAME+" vjs-hidden "+_Component.prototype.buildCSSClass.call(this)};_proto.label=function label(){return this.localize(this.options_.label||"Modal Window")};_proto.description=function description(){var desc=this.options_.description||this.localize("This is a modal window.");if(this.closeable()){desc+=" "+this.localize("This modal can be closed by pressing the Escape key or activating the close button.");}return desc};_proto.open=function open(){if(!this.opened_){var player=this.player();this.trigger("beforemodalopen");this.opened_=true;if(this.options_.fillAlways||!this.hasBeenOpened_&&!this.hasBeenFilled_){this.fill();}this.wasPlaying_=!player.paused();if(this.options_.pauseOnOpen&&this.wasPlaying_){player.pause();}this.on("keydown",this.handleKeyDown_);this.hadControls_=player.controls();player.controls(false);this.show();this.conditionalFocus_();this.el().setAttribute("aria-hidden","false");this.trigger("modalopen");this.hasBeenOpened_=true;}};_proto.opened=function opened(value){if(typeof value==="boolean"){this[value?"open":"close"]();}return this.opened_};_proto.close=function close(){if(!this.opened_){return}var player=this.player();this.trigger("beforemodalclose");this.opened_=false;if(this.wasPlaying_&&this.options_.pauseOnOpen){player.play();}this.off("keydown",this.handleKeyDown_);if(this.hadControls_){player.controls(true);}this.hide();this.el().setAttribute("aria-hidden","true");this.trigger("modalclose");this.conditionalBlur_();if(this.options_.temporary){this.dispose();}};_proto.closeable=function closeable(value){if(typeof value==="boolean"){var closeable=this.closeable_=!!value;var close=this.getChild("closeButton");if(closeable&&!close){var temp=this.contentEl_;this.contentEl_=this.el_;close=this.addChild("closeButton",{controlText:"Close Modal Dialog"});this.contentEl_=temp;this.on(close,"close",this.close_);}if(!closeable&&close){this.off(close,"close",this.close_);this.removeChild(close);close.dispose();}}return this.closeable_};_proto.fill=function fill(){this.fillWith(this.content());};_proto.fillWith=function fillWith(content){var contentEl=this.contentEl();var parentEl=contentEl.parentNode;var nextSiblingEl=contentEl.nextSibling;this.trigger("beforemodalfill");this.hasBeenFilled_=true;parentEl.removeChild(contentEl);this.empty();insertContent(contentEl,content);this.trigger("modalfill");if(nextSiblingEl){parentEl.insertBefore(contentEl,nextSiblingEl);}else {parentEl.appendChild(contentEl);}var closeButton=this.getChild("closeButton");if(closeButton){parentEl.appendChild(closeButton.el_);}};_proto.empty=function empty(){this.trigger("beforemodalempty");emptyEl(this.contentEl());this.trigger("modalempty");};_proto.content=function content(value){if(typeof value!=="undefined"){this.content_=value;}return this.content_};_proto.conditionalFocus_=function conditionalFocus_(){var activeEl=document_1.activeElement;var playerEl=this.player_.el_;this.previouslyActiveEl_=null;if(playerEl.contains(activeEl)||playerEl===activeEl){this.previouslyActiveEl_=activeEl;this.focus();}};_proto.conditionalBlur_=function conditionalBlur_(){if(this.previouslyActiveEl_){this.previouslyActiveEl_.focus();this.previouslyActiveEl_=null;}};_proto.handleKeyDown=function handleKeyDown(event){event.stopPropagation();if(keycode.isEventKey(event,"Escape")&&this.closeable()){event.preventDefault();this.close();return}if(!keycode.isEventKey(event,"Tab")){return}var focusableEls=this.focusableEls_();var activeEl=this.el_.querySelector(":focus");var focusIndex;for(var i=0;i<focusableEls.length;i++){if(activeEl===focusableEls[i]){focusIndex=i;break}}if(document_1.activeElement===this.el_){focusIndex=0;}if(event.shiftKey&&focusIndex===0){focusableEls[focusableEls.length-1].focus();event.preventDefault();}else if(!event.shiftKey&&focusIndex===focusableEls.length-1){focusableEls[0].focus();event.preventDefault();}};_proto.focusableEls_=function focusableEls_(){var allChildren=this.el_.querySelectorAll("*");return Array.prototype.filter.call(allChildren,function(child){return (child instanceof window_1.HTMLAnchorElement||child instanceof window_1.HTMLAreaElement)&&child.hasAttribute("href")||(child instanceof window_1.HTMLInputElement||child instanceof window_1.HTMLSelectElement||child instanceof window_1.HTMLTextAreaElement||child instanceof window_1.HTMLButtonElement)&&!child.hasAttribute("disabled")||child instanceof window_1.HTMLIFrameElement||child instanceof window_1.HTMLObjectElement||child instanceof window_1.HTMLEmbedElement||child.hasAttribute("tabindex")&&child.getAttribute("tabindex")!==-1||child.hasAttribute("contenteditable")})};return ModalDialog}(Component$1);ModalDialog.prototype.options_={pauseOnOpen:true,temporary:true};Component$1.registerComponent("ModalDialog",ModalDialog);var TrackList=function(_EventTarget){_inheritsLoose(TrackList,_EventTarget);function TrackList(tracks){var _this;if(tracks===void 0){tracks=[];}_this=_EventTarget.call(this)||this;_this.tracks_=[];Object.defineProperty(_assertThisInitialized(_this),"length",{get:function get(){return this.tracks_.length}});for(var i=0;i<tracks.length;i++){_this.addTrack(tracks[i]);}return _this}var _proto=TrackList.prototype;_proto.addTrack=function addTrack(track){var _this2=this;var index=this.tracks_.length;if(!(""+index in this)){Object.defineProperty(this,index,{get:function get(){return this.tracks_[index]}});}if(this.tracks_.indexOf(track)===-1){this.tracks_.push(track);this.trigger({track:track,type:"addtrack",target:this});}track.labelchange_=function(){_this2.trigger({track:track,type:"labelchange",target:_this2});};if(isEvented(track)){track.addEventListener("labelchange",track.labelchange_);}};_proto.removeTrack=function removeTrack(rtrack){var track;for(var i=0,l=this.length;i<l;i++){if(this[i]===rtrack){track=this[i];if(track.off){track.off();}this.tracks_.splice(i,1);break}}if(!track){return}this.trigger({track:track,type:"removetrack",target:this});};_proto.getTrackById=function getTrackById(id){var result=null;for(var i=0,l=this.length;i<l;i++){var track=this[i];if(track.id===id){result=track;break}}return result};return TrackList}(EventTarget$2);TrackList.prototype.allowedEvents_={change:"change",addtrack:"addtrack",removetrack:"removetrack",labelchange:"labelchange"};for(var event in TrackList.prototype.allowedEvents_){TrackList.prototype["on"+event]=null;}var disableOthers$1=function disableOthers(list,track){for(var i=0;i<list.length;i++){if(!Object.keys(list[i]).length||track.id===list[i].id){continue}list[i].enabled=false;}};var AudioTrackList=function(_TrackList){_inheritsLoose(AudioTrackList,_TrackList);function AudioTrackList(tracks){var _this;if(tracks===void 0){tracks=[];}for(var i=tracks.length-1;i>=0;i--){if(tracks[i].enabled){disableOthers$1(tracks,tracks[i]);break}}_this=_TrackList.call(this,tracks)||this;_this.changing_=false;return _this}var _proto=AudioTrackList.prototype;_proto.addTrack=function addTrack(track){var _this2=this;if(track.enabled){disableOthers$1(this,track);}_TrackList.prototype.addTrack.call(this,track);if(!track.addEventListener){return}track.enabledChange_=function(){if(_this2.changing_){return}_this2.changing_=true;disableOthers$1(_this2,track);_this2.changing_=false;_this2.trigger("change");};track.addEventListener("enabledchange",track.enabledChange_);};_proto.removeTrack=function removeTrack(rtrack){_TrackList.prototype.removeTrack.call(this,rtrack);if(rtrack.removeEventListener&&rtrack.enabledChange_){rtrack.removeEventListener("enabledchange",rtrack.enabledChange_);rtrack.enabledChange_=null;}};return AudioTrackList}(TrackList);var disableOthers=function disableOthers(list,track){for(var i=0;i<list.length;i++){if(!Object.keys(list[i]).length||track.id===list[i].id){continue}list[i].selected=false;}};var VideoTrackList=function(_TrackList){_inheritsLoose(VideoTrackList,_TrackList);function VideoTrackList(tracks){var _this;if(tracks===void 0){tracks=[];}for(var i=tracks.length-1;i>=0;i--){if(tracks[i].selected){disableOthers(tracks,tracks[i]);break}}_this=_TrackList.call(this,tracks)||this;_this.changing_=false;Object.defineProperty(_assertThisInitialized(_this),"selectedIndex",{get:function get(){for(var _i=0;_i<this.length;_i++){if(this[_i].selected){return _i}}return -1},set:function set(){}});return _this}var _proto=VideoTrackList.prototype;_proto.addTrack=function addTrack(track){var _this2=this;if(track.selected){disableOthers(this,track);}_TrackList.prototype.addTrack.call(this,track);if(!track.addEventListener){return}track.selectedChange_=function(){if(_this2.changing_){return}_this2.changing_=true;disableOthers(_this2,track);_this2.changing_=false;_this2.trigger("change");};track.addEventListener("selectedchange",track.selectedChange_);};_proto.removeTrack=function removeTrack(rtrack){_TrackList.prototype.removeTrack.call(this,rtrack);if(rtrack.removeEventListener&&rtrack.selectedChange_){rtrack.removeEventListener("selectedchange",rtrack.selectedChange_);rtrack.selectedChange_=null;}};return VideoTrackList}(TrackList);var TextTrackList=function(_TrackList){_inheritsLoose(TextTrackList,_TrackList);function TextTrackList(){return _TrackList.apply(this,arguments)||this}var _proto=TextTrackList.prototype;_proto.addTrack=function addTrack(track){var _this=this;_TrackList.prototype.addTrack.call(this,track);if(!this.queueChange_){this.queueChange_=function(){return _this.queueTrigger("change")};}if(!this.triggerSelectedlanguagechange){this.triggerSelectedlanguagechange_=function(){return _this.trigger("selectedlanguagechange")};}track.addEventListener("modechange",this.queueChange_);var nonLanguageTextTrackKind=["metadata","chapters"];if(nonLanguageTextTrackKind.indexOf(track.kind)===-1){track.addEventListener("modechange",this.triggerSelectedlanguagechange_);}};_proto.removeTrack=function removeTrack(rtrack){_TrackList.prototype.removeTrack.call(this,rtrack);if(rtrack.removeEventListener){if(this.queueChange_){rtrack.removeEventListener("modechange",this.queueChange_);}if(this.selectedlanguagechange_){rtrack.removeEventListener("modechange",this.triggerSelectedlanguagechange_);}}};return TextTrackList}(TrackList);var HtmlTrackElementList=function(){function HtmlTrackElementList(trackElements){if(trackElements===void 0){trackElements=[];}this.trackElements_=[];Object.defineProperty(this,"length",{get:function get(){return this.trackElements_.length}});for(var i=0,length=trackElements.length;i<length;i++){this.addTrackElement_(trackElements[i]);}}var _proto=HtmlTrackElementList.prototype;_proto.addTrackElement_=function addTrackElement_(trackElement){var index=this.trackElements_.length;if(!(""+index in this)){Object.defineProperty(this,index,{get:function get(){return this.trackElements_[index]}});}if(this.trackElements_.indexOf(trackElement)===-1){this.trackElements_.push(trackElement);}};_proto.getTrackElementByTrack_=function getTrackElementByTrack_(track){var trackElement_;for(var i=0,length=this.trackElements_.length;i<length;i++){if(track===this.trackElements_[i].track){trackElement_=this.trackElements_[i];break}}return trackElement_};_proto.removeTrackElement_=function removeTrackElement_(trackElement){for(var i=0,length=this.trackElements_.length;i<length;i++){if(trackElement===this.trackElements_[i]){if(this.trackElements_[i].track&&typeof this.trackElements_[i].track.off==="function"){this.trackElements_[i].track.off();}if(typeof this.trackElements_[i].off==="function"){this.trackElements_[i].off();}this.trackElements_.splice(i,1);break}}};return HtmlTrackElementList}();var TextTrackCueList=function(){function TextTrackCueList(cues){TextTrackCueList.prototype.setCues_.call(this,cues);Object.defineProperty(this,"length",{get:function get(){return this.length_}});}var _proto=TextTrackCueList.prototype;_proto.setCues_=function setCues_(cues){var oldLength=this.length||0;var i=0;var l=cues.length;this.cues_=cues;this.length_=cues.length;var defineProp=function defineProp(index){if(!(""+index in this)){Object.defineProperty(this,""+index,{get:function get(){return this.cues_[index]}});}};if(oldLength<l){i=oldLength;for(;i<l;i++){defineProp.call(this,i);}}};_proto.getCueById=function getCueById(id){var result=null;for(var i=0,l=this.length;i<l;i++){var cue=this[i];if(cue.id===id){result=cue;break}}return result};return TextTrackCueList}();var VideoTrackKind={alternative:"alternative",captions:"captions",main:"main",sign:"sign",subtitles:"subtitles",commentary:"commentary"};var AudioTrackKind={"alternative":"alternative","descriptions":"descriptions","main":"main","main-desc":"main-desc","translation":"translation","commentary":"commentary"};var TextTrackKind={subtitles:"subtitles",captions:"captions",descriptions:"descriptions",chapters:"chapters",metadata:"metadata"};var TextTrackMode={disabled:"disabled",hidden:"hidden",showing:"showing"};var Track=function(_EventTarget){_inheritsLoose(Track,_EventTarget);function Track(options){var _this;if(options===void 0){options={};}_this=_EventTarget.call(this)||this;var trackProps={id:options.id||"vjs_track_"+newGUID(),kind:options.kind||"",language:options.language||""};var label=options.label||"";var _loop=function _loop(key){Object.defineProperty(_assertThisInitialized(_this),key,{get:function get(){return trackProps[key]},set:function set(){}});};for(var key in trackProps){_loop(key);}Object.defineProperty(_assertThisInitialized(_this),"label",{get:function get(){return label},set:function set(newLabel){if(newLabel!==label){label=newLabel;this.trigger("labelchange");}}});return _this}return Track}(EventTarget$2);var parseUrl=function parseUrl(url){var props=["protocol","hostname","port","pathname","search","hash","host"];var a=document_1.createElement("a");a.href=url;var details={};for(var i=0;i<props.length;i++){details[props[i]]=a[props[i]];}if(details.protocol==="http:"){details.host=details.host.replace(/:80$/,"");}if(details.protocol==="https:"){details.host=details.host.replace(/:443$/,"");}if(!details.protocol){details.protocol=window_1.location.protocol;}if(!details.host){details.host=window_1.location.host;}return details};var getAbsoluteURL=function getAbsoluteURL(url){if(!url.match(/^https?:\/\//)){var a=document_1.createElement("a");a.href=url;url=a.href;}return url};var getFileExtension=function getFileExtension(path){if(typeof path==="string"){var splitPathRe=/^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/;var pathParts=splitPathRe.exec(path);if(pathParts){return pathParts.pop().toLowerCase()}}return ""};var isCrossOrigin=function isCrossOrigin(url,winLoc){if(winLoc===void 0){winLoc=window_1.location;}var urlInfo=parseUrl(url);var srcProtocol=urlInfo.protocol===":"?winLoc.protocol:urlInfo.protocol;var crossOrigin=srcProtocol+urlInfo.host!==winLoc.protocol+winLoc.host;return crossOrigin};var Url=Object.freeze({__proto__:null,parseUrl:parseUrl,getAbsoluteURL:getAbsoluteURL,getFileExtension:getFileExtension,isCrossOrigin:isCrossOrigin});var parseCues=function parseCues(srcContent,track){var parser=new window_1.WebVTT.Parser(window_1,window_1.vttjs,window_1.WebVTT.StringDecoder());var errors=[];parser.oncue=function(cue){track.addCue(cue);};parser.onparsingerror=function(error){errors.push(error);};parser.onflush=function(){track.trigger({type:"loadeddata",target:track});};parser.parse(srcContent);if(errors.length>0){if(window_1.console&&window_1.console.groupCollapsed){window_1.console.groupCollapsed("Text Track parsing errors for "+track.src);}errors.forEach(function(error){return log$1.error(error)});if(window_1.console&&window_1.console.groupEnd){window_1.console.groupEnd();}}parser.flush();};var loadTrack=function loadTrack(src,track){var opts={uri:src};var crossOrigin=isCrossOrigin(src);if(crossOrigin){opts.cors=crossOrigin;}var withCredentials=track.tech_.crossOrigin()==="use-credentials";if(withCredentials){opts.withCredentials=withCredentials;}lib.exports(opts,bind(this,function(err,response,responseBody){if(err){return log$1.error(err,response)}track.loaded_=true;if(typeof window_1.WebVTT!=="function"){if(track.tech_){track.tech_.any(["vttjsloaded","vttjserror"],function(event){if(event.type==="vttjserror"){log$1.error("vttjs failed to load, stopping trying to process "+track.src);return}return parseCues(responseBody,track)});}}else {parseCues(responseBody,track);}}));};var TextTrack=function(_Track){_inheritsLoose(TextTrack,_Track);function TextTrack(options){var _this;if(options===void 0){options={};}if(!options.tech){throw new Error("A tech was not provided.")}var settings=mergeOptions$3(options,{kind:TextTrackKind[options.kind]||"subtitles",language:options.language||options.srclang||""});var mode=TextTrackMode[settings.mode]||"disabled";var default_=settings["default"];if(settings.kind==="metadata"||settings.kind==="chapters"){mode="hidden";}_this=_Track.call(this,settings)||this;_this.tech_=settings.tech;_this.cues_=[];_this.activeCues_=[];_this.preload_=_this.tech_.preloadTextTracks!==false;var cues=new TextTrackCueList(_this.cues_);var activeCues=new TextTrackCueList(_this.activeCues_);var changed=false;_this.timeupdateHandler=bind(_assertThisInitialized(_this),function(event){if(event===void 0){event={};}if(this.tech_.isDisposed()){return}if(!this.tech_.isReady_){if(event.type!=="timeupdate"){this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler);}return}this.activeCues=this.activeCues;if(changed){this.trigger("cuechange");changed=false;}if(event.type!=="timeupdate"){this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler);}});var disposeHandler=function disposeHandler(){_this.stopTracking();};_this.tech_.one("dispose",disposeHandler);if(mode!=="disabled"){_this.startTracking();}Object.defineProperties(_assertThisInitialized(_this),{"default":{get:function get(){return default_},set:function set(){}},mode:{get:function get(){return mode},set:function set(newMode){if(!TextTrackMode[newMode]){return}if(mode===newMode){return}mode=newMode;if(!this.preload_&&mode!=="disabled"&&this.cues.length===0){loadTrack(this.src,this);}this.stopTracking();if(mode!=="disabled"){this.startTracking();}this.trigger("modechange");}},cues:{get:function get(){if(!this.loaded_){return null}return cues},set:function set(){}},activeCues:{get:function get(){if(!this.loaded_){return null}if(this.cues.length===0){return activeCues}var ct=this.tech_.currentTime();var active=[];for(var i=0,l=this.cues.length;i<l;i++){var cue=this.cues[i];if(cue.startTime<=ct&&cue.endTime>=ct){active.push(cue);}else if(cue.startTime===cue.endTime&&cue.startTime<=ct&&cue.startTime+.5>=ct){active.push(cue);}}changed=false;if(active.length!==this.activeCues_.length){changed=true;}else {for(var _i=0;_i<active.length;_i++){if(this.activeCues_.indexOf(active[_i])===-1){changed=true;}}}this.activeCues_=active;activeCues.setCues_(this.activeCues_);return activeCues},set:function set(){}}});if(settings.src){_this.src=settings.src;if(!_this.preload_){_this.loaded_=true;}if(_this.preload_||settings.kind!=="subtitles"&&settings.kind!=="captions"){loadTrack(_this.src,_assertThisInitialized(_this));}}else {_this.loaded_=true;}return _this}var _proto=TextTrack.prototype;_proto.startTracking=function startTracking(){this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler);this.tech_.on("timeupdate",this.timeupdateHandler);};_proto.stopTracking=function stopTracking(){if(this.rvf_){this.tech_.cancelVideoFrameCallback(this.rvf_);this.rvf_=undefined;}this.tech_.off("timeupdate",this.timeupdateHandler);};_proto.addCue=function addCue(originalCue){var cue=originalCue;if(window_1.vttjs&&!(originalCue instanceof window_1.vttjs.VTTCue)){cue=new window_1.vttjs.VTTCue(originalCue.startTime,originalCue.endTime,originalCue.text);for(var prop in originalCue){if(!(prop in cue)){cue[prop]=originalCue[prop];}}cue.id=originalCue.id;cue.originalCue_=originalCue;}var tracks=this.tech_.textTracks();for(var i=0;i<tracks.length;i++){if(tracks[i]!==this){tracks[i].removeCue(cue);}}this.cues_.push(cue);this.cues.setCues_(this.cues_);};_proto.removeCue=function removeCue(_removeCue){var i=this.cues_.length;while(i--){var cue=this.cues_[i];if(cue===_removeCue||cue.originalCue_&&cue.originalCue_===_removeCue){this.cues_.splice(i,1);this.cues.setCues_(this.cues_);break}}};return TextTrack}(Track);TextTrack.prototype.allowedEvents_={cuechange:"cuechange"};var AudioTrack=function(_Track){_inheritsLoose(AudioTrack,_Track);function AudioTrack(options){var _this;if(options===void 0){options={};}var settings=mergeOptions$3(options,{kind:AudioTrackKind[options.kind]||""});_this=_Track.call(this,settings)||this;var enabled=false;Object.defineProperty(_assertThisInitialized(_this),"enabled",{get:function get(){return enabled},set:function set(newEnabled){if(typeof newEnabled!=="boolean"||newEnabled===enabled){return}enabled=newEnabled;this.trigger("enabledchange");}});if(settings.enabled){_this.enabled=settings.enabled;}_this.loaded_=true;return _this}return AudioTrack}(Track);var VideoTrack=function(_Track){_inheritsLoose(VideoTrack,_Track);function VideoTrack(options){var _this;if(options===void 0){options={};}var settings=mergeOptions$3(options,{kind:VideoTrackKind[options.kind]||""});_this=_Track.call(this,settings)||this;var selected=false;Object.defineProperty(_assertThisInitialized(_this),"selected",{get:function get(){return selected},set:function set(newSelected){if(typeof newSelected!=="boolean"||newSelected===selected){return}selected=newSelected;this.trigger("selectedchange");}});if(settings.selected){_this.selected=settings.selected;}return _this}return VideoTrack}(Track);var NONE=0;var LOADING=1;var LOADED=2;var ERROR=3;var HTMLTrackElement=function(_EventTarget){_inheritsLoose(HTMLTrackElement,_EventTarget);function HTMLTrackElement(options){var _this;if(options===void 0){options={};}_this=_EventTarget.call(this)||this;var readyState;var track=new TextTrack(options);_this.kind=track.kind;_this.src=track.src;_this.srclang=track.language;_this.label=track.label;_this["default"]=track["default"];Object.defineProperties(_assertThisInitialized(_this),{readyState:{get:function get(){return readyState}},track:{get:function get(){return track}}});readyState=NONE;track.addEventListener("loadeddata",function(){readyState=LOADED;_this.trigger({type:"load",target:_assertThisInitialized(_this)});});return _this}return HTMLTrackElement}(EventTarget$2);HTMLTrackElement.prototype.allowedEvents_={load:"load"};HTMLTrackElement.NONE=NONE;HTMLTrackElement.LOADING=LOADING;HTMLTrackElement.LOADED=LOADED;HTMLTrackElement.ERROR=ERROR;var NORMAL={audio:{ListClass:AudioTrackList,TrackClass:AudioTrack,capitalName:"Audio"},video:{ListClass:VideoTrackList,TrackClass:VideoTrack,capitalName:"Video"},text:{ListClass:TextTrackList,TrackClass:TextTrack,capitalName:"Text"}};Object.keys(NORMAL).forEach(function(type){NORMAL[type].getterName=type+"Tracks";NORMAL[type].privateName=type+"Tracks_";});var REMOTE={remoteText:{ListClass:TextTrackList,TrackClass:TextTrack,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:HtmlTrackElementList,TrackClass:HTMLTrackElement,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}};var ALL=_extends$3({},NORMAL,REMOTE);REMOTE.names=Object.keys(REMOTE);NORMAL.names=Object.keys(NORMAL);ALL.names=[].concat(REMOTE.names).concat(NORMAL.names);function createTrackHelper(self1,kind,label,language,options){if(options===void 0){options={};}var tracks=self1.textTracks();options.kind=kind;if(label){options.label=label;}if(language){options.language=language;}options.tech=self1;var track=new ALL.text.TrackClass(options);tracks.addTrack(track);return track}var Tech=function(_Component){_inheritsLoose(Tech,_Component);function Tech(options,ready){var _this;if(options===void 0){options={};}if(ready===void 0){ready=function ready(){};}options.reportTouchActivity=false;_this=_Component.call(this,null,options,ready)||this;_this.onDurationChange_=function(e){return _this.onDurationChange(e)};_this.trackProgress_=function(e){return _this.trackProgress(e)};_this.trackCurrentTime_=function(e){return _this.trackCurrentTime(e)};_this.stopTrackingCurrentTime_=function(e){return _this.stopTrackingCurrentTime(e)};_this.disposeSourceHandler_=function(e){return _this.disposeSourceHandler(e)};_this.queuedHanders_=new Set;_this.hasStarted_=false;_this.on("playing",function(){this.hasStarted_=true;});_this.on("loadstart",function(){this.hasStarted_=false;});ALL.names.forEach(function(name){var props=ALL[name];if(options&&options[props.getterName]){_this[props.privateName]=options[props.getterName];}});if(!_this.featuresProgressEvents){_this.manualProgressOn();}if(!_this.featuresTimeupdateEvents){_this.manualTimeUpdatesOn();}["Text","Audio","Video"].forEach(function(track){if(options["native"+track+"Tracks"]===false){_this["featuresNative"+track+"Tracks"]=false;}});if(options.nativeCaptions===false||options.nativeTextTracks===false){_this.featuresNativeTextTracks=false;}else if(options.nativeCaptions===true||options.nativeTextTracks===true){_this.featuresNativeTextTracks=true;}if(!_this.featuresNativeTextTracks){_this.emulateTextTracks();}_this.preloadTextTracks=options.preloadTextTracks!==false;_this.autoRemoteTextTracks_=new ALL.text.ListClass;_this.initTrackListeners();if(!options.nativeControlsForTouch){_this.emitTapEvents();}if(_this.constructor){_this.name_=_this.constructor.name||"Unknown Tech";}return _this}var _proto=Tech.prototype;_proto.triggerSourceset=function triggerSourceset(src){var _this2=this;if(!this.isReady_){this.one("ready",function(){return _this2.setTimeout(function(){return _this2.triggerSourceset(src)},1)});}this.trigger({src:src,type:"sourceset"});};_proto.manualProgressOn=function manualProgressOn(){this.on("durationchange",this.onDurationChange_);this.manualProgress=true;this.one("ready",this.trackProgress_);};_proto.manualProgressOff=function manualProgressOff(){this.manualProgress=false;this.stopTrackingProgress();this.off("durationchange",this.onDurationChange_);};_proto.trackProgress=function trackProgress(event){this.stopTrackingProgress();this.progressInterval=this.setInterval(bind(this,function(){var numBufferedPercent=this.bufferedPercent();if(this.bufferedPercent_!==numBufferedPercent){this.trigger("progress");}this.bufferedPercent_=numBufferedPercent;if(numBufferedPercent===1){this.stopTrackingProgress();}}),500);};_proto.onDurationChange=function onDurationChange(event){this.duration_=this.duration();};_proto.buffered=function buffered(){return createTimeRanges(0,0)};_proto.bufferedPercent=function bufferedPercent$1(){return bufferedPercent(this.buffered(),this.duration_)};_proto.stopTrackingProgress=function stopTrackingProgress(){this.clearInterval(this.progressInterval);};_proto.manualTimeUpdatesOn=function manualTimeUpdatesOn(){this.manualTimeUpdates=true;this.on("play",this.trackCurrentTime_);this.on("pause",this.stopTrackingCurrentTime_);};_proto.manualTimeUpdatesOff=function manualTimeUpdatesOff(){this.manualTimeUpdates=false;this.stopTrackingCurrentTime();this.off("play",this.trackCurrentTime_);this.off("pause",this.stopTrackingCurrentTime_);};_proto.trackCurrentTime=function trackCurrentTime(){if(this.currentTimeInterval){this.stopTrackingCurrentTime();}this.currentTimeInterval=this.setInterval(function(){this.trigger({type:"timeupdate",target:this,manuallyTriggered:true});},250);};_proto.stopTrackingCurrentTime=function stopTrackingCurrentTime(){this.clearInterval(this.currentTimeInterval);this.trigger({type:"timeupdate",target:this,manuallyTriggered:true});};_proto.dispose=function dispose(){this.clearTracks(NORMAL.names);if(this.manualProgress){this.manualProgressOff();}if(this.manualTimeUpdates){this.manualTimeUpdatesOff();}_Component.prototype.dispose.call(this);};_proto.clearTracks=function clearTracks(types){var _this3=this;types=[].concat(types);types.forEach(function(type){var list=_this3[type+"Tracks"]()||[];var i=list.length;while(i--){var track=list[i];if(type==="text"){_this3.removeRemoteTextTrack(track);}list.removeTrack(track);}});};_proto.cleanupAutoTextTracks=function cleanupAutoTextTracks(){var list=this.autoRemoteTextTracks_||[];var i=list.length;while(i--){var track=list[i];this.removeRemoteTextTrack(track);}};_proto.reset=function reset(){};_proto.crossOrigin=function crossOrigin(){};_proto.setCrossOrigin=function setCrossOrigin(){};_proto.error=function error(err){if(err!==undefined){this.error_=new MediaError(err);this.trigger("error");}return this.error_};_proto.played=function played(){if(this.hasStarted_){return createTimeRanges(0,0)}return createTimeRanges()};_proto.play=function play(){};_proto.setScrubbing=function setScrubbing(){};_proto.scrubbing=function scrubbing(){};_proto.setCurrentTime=function setCurrentTime(){if(this.manualTimeUpdates){this.trigger({type:"timeupdate",target:this,manuallyTriggered:true});}};_proto.initTrackListeners=function initTrackListeners(){var _this4=this;NORMAL.names.forEach(function(name){var props=NORMAL[name];var trackListChanges=function trackListChanges(){_this4.trigger(name+"trackchange");};var tracks=_this4[props.getterName]();tracks.addEventListener("removetrack",trackListChanges);tracks.addEventListener("addtrack",trackListChanges);_this4.on("dispose",function(){tracks.removeEventListener("removetrack",trackListChanges);tracks.removeEventListener("addtrack",trackListChanges);});});};_proto.addWebVttScript_=function addWebVttScript_(){var _this5=this;if(window_1.WebVTT){return}if(document_1.body.contains(this.el())){if(!this.options_["vtt.js"]&&isPlain(browserIndex.exports)&&Object.keys(browserIndex.exports).length>0){this.trigger("vttjsloaded");return}var script=document_1.createElement("script");script.src=this.options_["vtt.js"]||"https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js";script.onload=function(){_this5.trigger("vttjsloaded");};script.onerror=function(){_this5.trigger("vttjserror");};this.on("dispose",function(){script.onload=null;script.onerror=null;});window_1.WebVTT=true;this.el().parentNode.appendChild(script);}else {this.ready(this.addWebVttScript_);}};_proto.emulateTextTracks=function emulateTextTracks(){var _this6=this;var tracks=this.textTracks();var remoteTracks=this.remoteTextTracks();var handleAddTrack=function handleAddTrack(e){return tracks.addTrack(e.track)};var handleRemoveTrack=function handleRemoveTrack(e){return tracks.removeTrack(e.track)};remoteTracks.on("addtrack",handleAddTrack);remoteTracks.on("removetrack",handleRemoveTrack);this.addWebVttScript_();var updateDisplay=function updateDisplay(){return _this6.trigger("texttrackchange")};var textTracksChanges=function textTracksChanges(){updateDisplay();for(var i=0;i<tracks.length;i++){var track=tracks[i];track.removeEventListener("cuechange",updateDisplay);if(track.mode==="showing"){track.addEventListener("cuechange",updateDisplay);}}};textTracksChanges();tracks.addEventListener("change",textTracksChanges);tracks.addEventListener("addtrack",textTracksChanges);tracks.addEventListener("removetrack",textTracksChanges);this.on("dispose",function(){remoteTracks.off("addtrack",handleAddTrack);remoteTracks.off("removetrack",handleRemoveTrack);tracks.removeEventListener("change",textTracksChanges);tracks.removeEventListener("addtrack",textTracksChanges);tracks.removeEventListener("removetrack",textTracksChanges);for(var i=0;i<tracks.length;i++){var track=tracks[i];track.removeEventListener("cuechange",updateDisplay);}});};_proto.addTextTrack=function addTextTrack(kind,label,language){if(!kind){throw new Error("TextTrack kind is required but was not provided")}return createTrackHelper(this,kind,label,language)};_proto.createRemoteTextTrack=function createRemoteTextTrack(options){var track=mergeOptions$3(options,{tech:this});return new REMOTE.remoteTextEl.TrackClass(track)};_proto.addRemoteTextTrack=function addRemoteTextTrack(options,manualCleanup){var _this7=this;if(options===void 0){options={};}var htmlTrackElement=this.createRemoteTextTrack(options);if(manualCleanup!==true&&manualCleanup!==false){log$1.warn('Calling addRemoteTextTrack without explicitly setting the "manualCleanup" parameter to `true` is deprecated and default to `false` in future version of video.js');manualCleanup=true;}this.remoteTextTrackEls().addTrackElement_(htmlTrackElement);this.remoteTextTracks().addTrack(htmlTrackElement.track);if(manualCleanup!==true){this.ready(function(){return _this7.autoRemoteTextTracks_.addTrack(htmlTrackElement.track)});}return htmlTrackElement};_proto.removeRemoteTextTrack=function removeRemoteTextTrack(track){var trackElement=this.remoteTextTrackEls().getTrackElementByTrack_(track);this.remoteTextTrackEls().removeTrackElement_(trackElement);this.remoteTextTracks().removeTrack(track);this.autoRemoteTextTracks_.removeTrack(track);};_proto.getVideoPlaybackQuality=function getVideoPlaybackQuality(){return {}};_proto.requestPictureInPicture=function requestPictureInPicture(){var PromiseClass=this.options_.Promise||window_1.Promise;if(PromiseClass){return PromiseClass.reject()}};_proto.disablePictureInPicture=function disablePictureInPicture(){return true};_proto.setDisablePictureInPicture=function setDisablePictureInPicture(){};_proto.requestVideoFrameCallback=function requestVideoFrameCallback(cb){var _this8=this;var id=newGUID();if(!this.isReady_||this.paused()){this.queuedHanders_.add(id);this.one("playing",function(){if(_this8.queuedHanders_.has(id)){_this8.queuedHanders_["delete"](id);cb();}});}else {this.requestNamedAnimationFrame(id,cb);}return id};_proto.cancelVideoFrameCallback=function cancelVideoFrameCallback(id){if(this.queuedHanders_.has(id)){this.queuedHanders_["delete"](id);}else {this.cancelNamedAnimationFrame(id);}};_proto.setPoster=function setPoster(){};_proto.playsinline=function playsinline(){};_proto.setPlaysinline=function setPlaysinline(){};_proto.overrideNativeAudioTracks=function overrideNativeAudioTracks(){};_proto.overrideNativeVideoTracks=function overrideNativeVideoTracks(){};_proto.canPlayType=function canPlayType(){return ""};Tech.canPlayType=function canPlayType(){return ""};Tech.canPlaySource=function canPlaySource(srcObj,options){return Tech.canPlayType(srcObj.type)};Tech.isTech=function isTech(component){return component.prototype instanceof Tech||component instanceof Tech||component===Tech};Tech.registerTech=function registerTech(name,tech){if(!Tech.techs_){Tech.techs_={};}if(!Tech.isTech(tech)){throw new Error("Tech "+name+" must be a Tech")}if(!Tech.canPlayType){throw new Error("Techs must have a static canPlayType method on them")}if(!Tech.canPlaySource){throw new Error("Techs must have a static canPlaySource method on them")}name=toTitleCase$1(name);Tech.techs_[name]=tech;Tech.techs_[toLowerCase(name)]=tech;if(name!=="Tech"){Tech.defaultTechOrder_.push(name);}return tech};Tech.getTech=function getTech(name){if(!name){return}if(Tech.techs_&&Tech.techs_[name]){return Tech.techs_[name]}name=toTitleCase$1(name);if(window_1&&window_1.videojs&&window_1.videojs[name]){log$1.warn("The "+name+" tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)");return window_1.videojs[name]}};return Tech}(Component$1);ALL.names.forEach(function(name){var props=ALL[name];Tech.prototype[props.getterName]=function(){this[props.privateName]=this[props.privateName]||new props.ListClass;return this[props.privateName]};});Tech.prototype.featuresVolumeControl=true;Tech.prototype.featuresMuteControl=true;Tech.prototype.featuresFullscreenResize=false;Tech.prototype.featuresPlaybackRate=false;Tech.prototype.featuresProgressEvents=false;Tech.prototype.featuresSourceset=false;Tech.prototype.featuresTimeupdateEvents=false;Tech.prototype.featuresNativeTextTracks=false;Tech.prototype.featuresVideoFrameCallback=false;Tech.withSourceHandlers=function(_Tech){_Tech.registerSourceHandler=function(handler,index){var handlers=_Tech.sourceHandlers;if(!handlers){handlers=_Tech.sourceHandlers=[];}if(index===undefined){index=handlers.length;}handlers.splice(index,0,handler);};_Tech.canPlayType=function(type){var handlers=_Tech.sourceHandlers||[];var can;for(var i=0;i<handlers.length;i++){can=handlers[i].canPlayType(type);if(can){return can}}return ""};_Tech.selectSourceHandler=function(source,options){var handlers=_Tech.sourceHandlers||[];var can;for(var i=0;i<handlers.length;i++){can=handlers[i].canHandleSource(source,options);if(can){return handlers[i]}}return null};_Tech.canPlaySource=function(srcObj,options){var sh=_Tech.selectSourceHandler(srcObj,options);if(sh){return sh.canHandleSource(srcObj,options)}return ""};var deferrable=["seekable","seeking","duration"];deferrable.forEach(function(fnName){var originalFn=this[fnName];if(typeof originalFn!=="function"){return}this[fnName]=function(){if(this.sourceHandler_&&this.sourceHandler_[fnName]){return this.sourceHandler_[fnName].apply(this.sourceHandler_,arguments)}return originalFn.apply(this,arguments)};},_Tech.prototype);_Tech.prototype.setSource=function(source){var sh=_Tech.selectSourceHandler(source,this.options_);if(!sh){if(_Tech.nativeSourceHandler){sh=_Tech.nativeSourceHandler;}else {log$1.error("No source handler found for the current source.");}}this.disposeSourceHandler();this.off("dispose",this.disposeSourceHandler_);if(sh!==_Tech.nativeSourceHandler){this.currentSource_=source;}this.sourceHandler_=sh.handleSource(source,this,this.options_);this.one("dispose",this.disposeSourceHandler_);};_Tech.prototype.disposeSourceHandler=function(){if(this.currentSource_){this.clearTracks(["audio","video"]);this.currentSource_=null;}this.cleanupAutoTextTracks();if(this.sourceHandler_){if(this.sourceHandler_.dispose){this.sourceHandler_.dispose();}this.sourceHandler_=null;}};};Component$1.registerComponent("Tech",Tech);Tech.registerTech("Tech",Tech);Tech.defaultTechOrder_=[];var middlewares={};var middlewareInstances={};var TERMINATOR={};function use(type,middleware){middlewares[type]=middlewares[type]||[];middlewares[type].push(middleware);}function setSource(player,src,next){player.setTimeout(function(){return setSourceHelper(src,middlewares[src.type],next,player)},1);}function setTech(middleware,tech){middleware.forEach(function(mw){return mw.setTech&&mw.setTech(tech)});}function get(middleware,tech,method){return middleware.reduceRight(middlewareIterator(method),tech[method]())}function set(middleware,tech,method,arg){return tech[method](middleware.reduce(middlewareIterator(method),arg))}function mediate(middleware,tech,method,arg){if(arg===void 0){arg=null;}var callMethod="call"+toTitleCase$1(method);var middlewareValue=middleware.reduce(middlewareIterator(callMethod),arg);var terminated=middlewareValue===TERMINATOR;var returnValue=terminated?null:tech[method](middlewareValue);executeRight(middleware,method,returnValue,terminated);return returnValue}var allowedGetters={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1};var allowedSetters={setCurrentTime:1,setMuted:1,setVolume:1};var allowedMediators={play:1,pause:1};function middlewareIterator(method){return function(value,mw){if(value===TERMINATOR){return TERMINATOR}if(mw[method]){return mw[method](value)}return value}}function executeRight(mws,method,value,terminated){for(var i=mws.length-1;i>=0;i--){var mw=mws[i];if(mw[method]){mw[method](terminated,value);}}}function clearCacheForPlayer(player){middlewareInstances[player.id()]=null;}function getOrCreateFactory(player,mwFactory){var mws=middlewareInstances[player.id()];var mw=null;if(mws===undefined||mws===null){mw=mwFactory(player);middlewareInstances[player.id()]=[[mwFactory,mw]];return mw}for(var i=0;i<mws.length;i++){var _mws$i=mws[i],mwf=_mws$i[0],mwi=_mws$i[1];if(mwf!==mwFactory){continue}mw=mwi;}if(mw===null){mw=mwFactory(player);mws.push([mwFactory,mw]);}return mw}function setSourceHelper(src,middleware,next,player,acc,lastRun){if(src===void 0){src={};}if(middleware===void 0){middleware=[];}if(acc===void 0){acc=[];}if(lastRun===void 0){lastRun=false;}var _middleware=middleware,mwFactory=_middleware[0],mwrest=_middleware.slice(1);if(typeof mwFactory==="string"){setSourceHelper(src,middlewares[mwFactory],next,player,acc,lastRun);}else if(mwFactory){var mw=getOrCreateFactory(player,mwFactory);if(!mw.setSource){acc.push(mw);return setSourceHelper(src,mwrest,next,player,acc,lastRun)}mw.setSource(assign({},src),function(err,_src){if(err){return setSourceHelper(src,mwrest,next,player,acc,lastRun)}acc.push(mw);setSourceHelper(_src,src.type===_src.type?mwrest:middlewares[_src.type],next,player,acc,lastRun);});}else if(mwrest.length){setSourceHelper(src,mwrest,next,player,acc,lastRun);}else if(lastRun){next(src,acc);}else {setSourceHelper(src,middlewares["*"],next,player,acc,true);}}var MimetypesKind={opus:"video/ogg",ogv:"video/ogg",mp4:"video/mp4",mov:"video/mp4",m4v:"video/mp4",mkv:"video/x-matroska",m4a:"audio/mp4",mp3:"audio/mpeg",aac:"audio/aac",caf:"audio/x-caf",flac:"audio/flac",oga:"audio/ogg",wav:"audio/wav",m3u8:"application/x-mpegURL",mpd:"application/dash+xml",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",png:"image/png",svg:"image/svg+xml",webp:"image/webp"};var getMimetype=function getMimetype(src){if(src===void 0){src="";}var ext=getFileExtension(src);var mimetype=MimetypesKind[ext.toLowerCase()];return mimetype||""};var findMimetype=function findMimetype(player,src){if(!src){return ""}if(player.cache_.source.src===src&&player.cache_.source.type){return player.cache_.source.type}var matchingSources=player.cache_.sources.filter(function(s){return s.src===src});if(matchingSources.length){return matchingSources[0].type}var sources=player.$$("source");for(var i=0;i<sources.length;i++){var s=sources[i];if(s.type&&s.src&&s.src===src){return s.type}}return getMimetype(src)};var filterSource=function filterSource(src){if(Array.isArray(src)){var newsrc=[];src.forEach(function(srcobj){srcobj=filterSource(srcobj);if(Array.isArray(srcobj)){newsrc=newsrc.concat(srcobj);}else if(isObject(srcobj)){newsrc.push(srcobj);}});src=newsrc;}else if(typeof src==="string"&&src.trim()){src=[fixSource({src:src})];}else if(isObject(src)&&typeof src.src==="string"&&src.src&&src.src.trim()){src=[fixSource(src)];}else {src=[];}return src};function fixSource(src){if(!src.type){var mimetype=getMimetype(src.src);if(mimetype){src.type=mimetype;}}return src}var MediaLoader=function(_Component){_inheritsLoose(MediaLoader,_Component);function MediaLoader(player,options,ready){var _this;var options_=mergeOptions$3({createEl:false},options);_this=_Component.call(this,player,options_,ready)||this;if(!options.playerOptions.sources||options.playerOptions.sources.length===0){for(var i=0,j=options.playerOptions.techOrder;i<j.length;i++){var techName=toTitleCase$1(j[i]);var tech=Tech.getTech(techName);if(!techName){tech=Component$1.getComponent(techName);}if(tech&&tech.isSupported()){player.loadTech_(techName);break}}}else {player.src(options.playerOptions.sources);}return _this}return MediaLoader}(Component$1);Component$1.registerComponent("MediaLoader",MediaLoader);var ClickableComponent=function(_Component){_inheritsLoose(ClickableComponent,_Component);function ClickableComponent(player,options){var _this;_this=_Component.call(this,player,options)||this;if(_this.options_.controlText){_this.controlText(_this.options_.controlText);}_this.handleMouseOver_=function(e){return _this.handleMouseOver(e)};_this.handleMouseOut_=function(e){return _this.handleMouseOut(e)};_this.handleClick_=function(e){return _this.handleClick(e)};_this.handleKeyDown_=function(e){return _this.handleKeyDown(e)};_this.emitTapEvents();_this.enable();return _this}var _proto=ClickableComponent.prototype;_proto.createEl=function createEl$1(tag,props,attributes){if(tag===void 0){tag="div";}if(props===void 0){props={};}if(attributes===void 0){attributes={};}props=assign({className:this.buildCSSClass(),tabIndex:0},props);if(tag==="button"){log$1.error("Creating a ClickableComponent with an HTML element of "+tag+" is not supported; use a Button instead.");}attributes=assign({role:"button"},attributes);this.tabIndex_=props.tabIndex;var el=createEl(tag,props,attributes);el.appendChild(createEl("span",{className:"vjs-icon-placeholder"},{"aria-hidden":true}));this.createControlTextEl(el);return el};_proto.dispose=function dispose(){this.controlTextEl_=null;_Component.prototype.dispose.call(this);};_proto.createControlTextEl=function createControlTextEl(el){this.controlTextEl_=createEl("span",{className:"vjs-control-text"},{"aria-live":"polite"});if(el){el.appendChild(this.controlTextEl_);}this.controlText(this.controlText_,el);return this.controlTextEl_};_proto.controlText=function controlText(text,el){if(el===void 0){el=this.el();}if(text===undefined){return this.controlText_||"Need Text"}var localizedText=this.localize(text);this.controlText_=text;textContent(this.controlTextEl_,localizedText);if(!this.nonIconControl&&!this.player_.options_.noUITitleAttributes){el.setAttribute("title",localizedText);}};_proto.buildCSSClass=function buildCSSClass(){return "vjs-control vjs-button "+_Component.prototype.buildCSSClass.call(this)};_proto.enable=function enable(){if(!this.enabled_){this.enabled_=true;this.removeClass("vjs-disabled");this.el_.setAttribute("aria-disabled","false");if(typeof this.tabIndex_!=="undefined"){this.el_.setAttribute("tabIndex",this.tabIndex_);}this.on(["tap","click"],this.handleClick_);this.on("keydown",this.handleKeyDown_);}};_proto.disable=function disable(){this.enabled_=false;this.addClass("vjs-disabled");this.el_.setAttribute("aria-disabled","true");if(typeof this.tabIndex_!=="undefined"){this.el_.removeAttribute("tabIndex");}this.off("mouseover",this.handleMouseOver_);this.off("mouseout",this.handleMouseOut_);this.off(["tap","click"],this.handleClick_);this.off("keydown",this.handleKeyDown_);};_proto.handleLanguagechange=function handleLanguagechange(){this.controlText(this.controlText_);};_proto.handleClick=function handleClick(event){if(this.options_.clickHandler){this.options_.clickHandler.call(this,arguments);}};_proto.handleKeyDown=function handleKeyDown(event){if(keycode.isEventKey(event,"Space")||keycode.isEventKey(event,"Enter")){event.preventDefault();event.stopPropagation();this.trigger("click");}else {_Component.prototype.handleKeyDown.call(this,event);}};return ClickableComponent}(Component$1);Component$1.registerComponent("ClickableComponent",ClickableComponent);var PosterImage=function(_ClickableComponent){_inheritsLoose(PosterImage,_ClickableComponent);function PosterImage(player,options){var _this;_this=_ClickableComponent.call(this,player,options)||this;_this.update();_this.update_=function(e){return _this.update(e)};player.on("posterchange",_this.update_);return _this}var _proto=PosterImage.prototype;_proto.dispose=function dispose(){this.player().off("posterchange",this.update_);_ClickableComponent.prototype.dispose.call(this);};_proto.createEl=function createEl$1(){var el=createEl("div",{className:"vjs-poster",tabIndex:-1});return el};_proto.update=function update(event){var url=this.player().poster();this.setSrc(url);if(url){this.show();}else {this.hide();}};_proto.setSrc=function setSrc(url){var backgroundImage="";if(url){backgroundImage='url("'+url+'")';}this.el_.style.backgroundImage=backgroundImage;};_proto.handleClick=function handleClick(event){if(!this.player_.controls()){return}var sourceIsEncrypted=this.player_.usingPlugin("eme")&&this.player_.eme.sessions&&this.player_.eme.sessions.length>0;if(this.player_.tech(true)&&!((IE_VERSION||IS_EDGE)&&sourceIsEncrypted)){this.player_.tech(true).focus();}if(this.player_.paused()){silencePromise(this.player_.play());}else {this.player_.pause();}};return PosterImage}(ClickableComponent);Component$1.registerComponent("PosterImage",PosterImage);var darkGray="#222";var lightGray="#ccc";var fontMap={monospace:"monospace",sansSerif:"sans-serif",serif:"serif",monospaceSansSerif:'"Andale Mono", "Lucida Console", monospace',monospaceSerif:'"Courier New", monospace',proportionalSansSerif:"sans-serif",proportionalSerif:"serif",casual:'"Comic Sans MS", Impact, fantasy',script:'"Monotype Corsiva", cursive',smallcaps:'"Andale Mono", "Lucida Console", monospace, sans-serif'};function constructColor(color,opacity){var hex;if(color.length===4){hex=color[1]+color[1]+color[2]+color[2]+color[3]+color[3];}else if(color.length===7){hex=color.slice(1);}else {throw new Error("Invalid color code provided, "+color+"; must be formatted as e.g. #f0e or #f604e2.")}return "rgba("+parseInt(hex.slice(0,2),16)+","+parseInt(hex.slice(2,4),16)+","+parseInt(hex.slice(4,6),16)+","+opacity+")"}function tryUpdateStyle(el,style,rule){try{el.style[style]=rule;}catch(e){return}}var TextTrackDisplay=function(_Component){_inheritsLoose(TextTrackDisplay,_Component);function TextTrackDisplay(player,options,ready){var _this;_this=_Component.call(this,player,options,ready)||this;var updateDisplayHandler=function updateDisplayHandler(e){return _this.updateDisplay(e)};player.on("loadstart",function(e){return _this.toggleDisplay(e)});player.on("texttrackchange",updateDisplayHandler);player.on("loadedmetadata",function(e){return _this.preselectTrack(e)});player.ready(bind(_assertThisInitialized(_this),function(){if(player.tech_&&player.tech_.featuresNativeTextTracks){this.hide();return}player.on("fullscreenchange",updateDisplayHandler);player.on("playerresize",updateDisplayHandler);window_1.addEventListener("orientationchange",updateDisplayHandler);player.on("dispose",function(){return window_1.removeEventListener("orientationchange",updateDisplayHandler)});var tracks=this.options_.playerOptions.tracks||[];for(var i=0;i<tracks.length;i++){this.player_.addRemoteTextTrack(tracks[i],true);}this.preselectTrack();}));return _this}var _proto=TextTrackDisplay.prototype;_proto.preselectTrack=function preselectTrack(){var modes={captions:1,subtitles:1};var trackList=this.player_.textTracks();var userPref=this.player_.cache_.selectedLanguage;var firstDesc;var firstCaptions;var preferredTrack;for(var i=0;i<trackList.length;i++){var track=trackList[i];if(userPref&&userPref.enabled&&userPref.language&&userPref.language===track.language&&track.kind in modes){if(track.kind===userPref.kind){preferredTrack=track;}else if(!preferredTrack){preferredTrack=track;}}else if(userPref&&!userPref.enabled){preferredTrack=null;firstDesc=null;firstCaptions=null;}else if(track["default"]){if(track.kind==="descriptions"&&!firstDesc){firstDesc=track;}else if(track.kind in modes&&!firstCaptions){firstCaptions=track;}}}if(preferredTrack){preferredTrack.mode="showing";}else if(firstCaptions){firstCaptions.mode="showing";}else if(firstDesc){firstDesc.mode="showing";}};_proto.toggleDisplay=function toggleDisplay(){if(this.player_.tech_&&this.player_.tech_.featuresNativeTextTracks){this.hide();}else {this.show();}};_proto.createEl=function createEl(){return _Component.prototype.createEl.call(this,"div",{className:"vjs-text-track-display"},{"translate":"yes","aria-live":"off","aria-atomic":"true"})};_proto.clearDisplay=function clearDisplay(){if(typeof window_1.WebVTT==="function"){window_1.WebVTT.processCues(window_1,[],this.el_);}};_proto.updateDisplay=function updateDisplay(){var tracks=this.player_.textTracks();var allowMultipleShowingTracks=this.options_.allowMultipleShowingTracks;this.clearDisplay();if(allowMultipleShowingTracks){var showingTracks=[];for(var _i=0;_i<tracks.length;++_i){var track=tracks[_i];if(track.mode!=="showing"){continue}showingTracks.push(track);}this.updateForTrack(showingTracks);return}var descriptionsTrack=null;var captionsSubtitlesTrack=null;var i=tracks.length;while(i--){var _track=tracks[i];if(_track.mode==="showing"){if(_track.kind==="descriptions"){descriptionsTrack=_track;}else {captionsSubtitlesTrack=_track;}}}if(captionsSubtitlesTrack){if(this.getAttribute("aria-live")!=="off"){this.setAttribute("aria-live","off");}this.updateForTrack(captionsSubtitlesTrack);}else if(descriptionsTrack){if(this.getAttribute("aria-live")!=="assertive"){this.setAttribute("aria-live","assertive");}this.updateForTrack(descriptionsTrack);}};_proto.updateDisplayState=function updateDisplayState(track){var overrides=this.player_.textTrackSettings.getValues();var cues=track.activeCues;var i=cues.length;while(i--){var cue=cues[i];if(!cue){continue}var cueDiv=cue.displayState;if(overrides.color){cueDiv.firstChild.style.color=overrides.color;}if(overrides.textOpacity){tryUpdateStyle(cueDiv.firstChild,"color",constructColor(overrides.color||"#fff",overrides.textOpacity));}if(overrides.backgroundColor){cueDiv.firstChild.style.backgroundColor=overrides.backgroundColor;}if(overrides.backgroundOpacity){tryUpdateStyle(cueDiv.firstChild,"backgroundColor",constructColor(overrides.backgroundColor||"#000",overrides.backgroundOpacity));}if(overrides.windowColor){if(overrides.windowOpacity){tryUpdateStyle(cueDiv,"backgroundColor",constructColor(overrides.windowColor,overrides.windowOpacity));}else {cueDiv.style.backgroundColor=overrides.windowColor;}}if(overrides.edgeStyle){if(overrides.edgeStyle==="dropshadow"){cueDiv.firstChild.style.textShadow="2px 2px 3px "+darkGray+", 2px 2px 4px "+darkGray+", 2px 2px 5px "+darkGray;}else if(overrides.edgeStyle==="raised"){cueDiv.firstChild.style.textShadow="1px 1px "+darkGray+", 2px 2px "+darkGray+", 3px 3px "+darkGray;}else if(overrides.edgeStyle==="depressed"){cueDiv.firstChild.style.textShadow="1px 1px "+lightGray+", 0 1px "+lightGray+", -1px -1px "+darkGray+", 0 -1px "+darkGray;}else if(overrides.edgeStyle==="uniform"){cueDiv.firstChild.style.textShadow="0 0 4px "+darkGray+", 0 0 4px "+darkGray+", 0 0 4px "+darkGray+", 0 0 4px "+darkGray;}}if(overrides.fontPercent&&overrides.fontPercent!==1){var fontSize=window_1.parseFloat(cueDiv.style.fontSize);cueDiv.style.fontSize=fontSize*overrides.fontPercent+"px";cueDiv.style.height="auto";cueDiv.style.top="auto";}if(overrides.fontFamily&&overrides.fontFamily!=="default"){if(overrides.fontFamily==="small-caps"){cueDiv.firstChild.style.fontVariant="small-caps";}else {cueDiv.firstChild.style.fontFamily=fontMap[overrides.fontFamily];}}}};_proto.updateForTrack=function updateForTrack(tracks){if(!Array.isArray(tracks)){tracks=[tracks];}if(typeof window_1.WebVTT!=="function"||tracks.every(function(track){return !track.activeCues})){return}var cues=[];for(var i=0;i<tracks.length;++i){var track=tracks[i];for(var j=0;j<track.activeCues.length;++j){cues.push(track.activeCues[j]);}}window_1.WebVTT.processCues(window_1,cues,this.el_);for(var _i2=0;_i2<tracks.length;++_i2){var _track2=tracks[_i2];for(var _j=0;_j<_track2.activeCues.length;++_j){var cueEl=_track2.activeCues[_j].displayState;addClass(cueEl,"vjs-text-track-cue");addClass(cueEl,"vjs-text-track-cue-"+(_track2.language?_track2.language:_i2));if(_track2.language){setAttribute(cueEl,"lang",_track2.language);}}if(this.player_.textTrackSettings){this.updateDisplayState(_track2);}}};return TextTrackDisplay}(Component$1);Component$1.registerComponent("TextTrackDisplay",TextTrackDisplay);var LoadingSpinner=function(_Component){_inheritsLoose(LoadingSpinner,_Component);function LoadingSpinner(){return _Component.apply(this,arguments)||this}var _proto=LoadingSpinner.prototype;_proto.createEl=function createEl$1(){var isAudio=this.player_.isAudio();var playerType=this.localize(isAudio?"Audio Player":"Video Player");var controlText=createEl("span",{className:"vjs-control-text",textContent:this.localize("{1} is loading.",[playerType])});var el=_Component.prototype.createEl.call(this,"div",{className:"vjs-loading-spinner",dir:"ltr"});el.appendChild(controlText);return el};return LoadingSpinner}(Component$1);Component$1.registerComponent("LoadingSpinner",LoadingSpinner);var Button=function(_ClickableComponent){_inheritsLoose(Button,_ClickableComponent);function Button(){return _ClickableComponent.apply(this,arguments)||this}var _proto=Button.prototype;_proto.createEl=function createEl$1(tag,props,attributes){if(props===void 0){props={};}if(attributes===void 0){attributes={};}tag="button";props=assign({className:this.buildCSSClass()},props);attributes=assign({type:"button"},attributes);var el=createEl(tag,props,attributes);el.appendChild(createEl("span",{className:"vjs-icon-placeholder"},{"aria-hidden":true}));this.createControlTextEl(el);return el};_proto.addChild=function addChild(child,options){if(options===void 0){options={};}var className=this.constructor.name;log$1.warn("Adding an actionable (user controllable) child to a Button ("+className+") is not supported; use a ClickableComponent instead.");return Component$1.prototype.addChild.call(this,child,options)};_proto.enable=function enable(){_ClickableComponent.prototype.enable.call(this);this.el_.removeAttribute("disabled");};_proto.disable=function disable(){_ClickableComponent.prototype.disable.call(this);this.el_.setAttribute("disabled","disabled");};_proto.handleKeyDown=function handleKeyDown(event){if(keycode.isEventKey(event,"Space")||keycode.isEventKey(event,"Enter")){event.stopPropagation();return}_ClickableComponent.prototype.handleKeyDown.call(this,event);};return Button}(ClickableComponent);Component$1.registerComponent("Button",Button);var BigPlayButton=function(_Button){_inheritsLoose(BigPlayButton,_Button);function BigPlayButton(player,options){var _this;_this=_Button.call(this,player,options)||this;_this.mouseused_=false;_this.on("mousedown",function(e){return _this.handleMouseDown(e)});return _this}var _proto=BigPlayButton.prototype;_proto.buildCSSClass=function buildCSSClass(){return "vjs-big-play-button"};_proto.handleClick=function handleClick(event){var playPromise=this.player_.play();if(this.mouseused_&&event.clientX&&event.clientY){var sourceIsEncrypted=this.player_.usingPlugin("eme")&&this.player_.eme.sessions&&this.player_.eme.sessions.length>0;silencePromise(playPromise);if(this.player_.tech(true)&&!((IE_VERSION||IS_EDGE)&&sourceIsEncrypted)){this.player_.tech(true).focus();}return}var cb=this.player_.getChild("controlBar");var playToggle=cb&&cb.getChild("playToggle");if(!playToggle){this.player_.tech(true).focus();return}var playFocus=function playFocus(){return playToggle.focus()};if(isPromise(playPromise)){playPromise.then(playFocus,function(){});}else {this.setTimeout(playFocus,1);}};_proto.handleKeyDown=function handleKeyDown(event){this.mouseused_=false;_Button.prototype.handleKeyDown.call(this,event);};_proto.handleMouseDown=function handleMouseDown(event){this.mouseused_=true;};return BigPlayButton}(Button);BigPlayButton.prototype.controlText_="Play Video";Component$1.registerComponent("BigPlayButton",BigPlayButton);var CloseButton=function(_Button){_inheritsLoose(CloseButton,_Button);function CloseButton(player,options){var _this;_this=_Button.call(this,player,options)||this;_this.controlText(options&&options.controlText||_this.localize("Close"));return _this}var _proto=CloseButton.prototype;_proto.buildCSSClass=function buildCSSClass(){return "vjs-close-button "+_Button.prototype.buildCSSClass.call(this)};_proto.handleClick=function handleClick(event){this.trigger({type:"close",bubbles:false});};_proto.handleKeyDown=function handleKeyDown(event){if(keycode.isEventKey(event,"Esc")){event.preventDefault();event.stopPropagation();this.trigger("click");}else {_Button.prototype.handleKeyDown.call(this,event);}};return CloseButton}(Button);Component$1.registerComponent("CloseButton",CloseButton);var PlayToggle=function(_Button){_inheritsLoose(PlayToggle,_Button);function PlayToggle(player,options){var _this;if(options===void 0){options={};}_this=_Button.call(this,player,options)||this;options.replay=options.replay===undefined||options.replay;_this.on(player,"play",function(e){return _this.handlePlay(e)});_this.on(player,"pause",function(e){return _this.handlePause(e)});if(options.replay){_this.on(player,"ended",function(e){return _this.handleEnded(e)});}return _this}var _proto=PlayToggle.prototype;_proto.buildCSSClass=function buildCSSClass(){return "vjs-play-control "+_Button.prototype.buildCSSClass.call(this)};_proto.handleClick=function handleClick(event){if(this.player_.paused()){silencePromise(this.player_.play());}else {this.player_.pause();}};_proto.handleSeeked=function handleSeeked(event){this.removeClass("vjs-ended");if(this.player_.paused()){this.handlePause(event);}else {this.handlePlay(event);}};_proto.handlePlay=function handlePlay(event){this.removeClass("vjs-ended");this.removeClass("vjs-paused");this.addClass("vjs-playing");this.controlText("Pause");};_proto.handlePause=function handlePause(event){this.removeClass("vjs-playing");this.addClass("vjs-paused");this.controlText("Play");};_proto.handleEnded=function handleEnded(event){var _this2=this;this.removeClass("vjs-playing");this.addClass("vjs-ended");this.controlText("Replay");this.one(this.player_,"seeked",function(e){return _this2.handleSeeked(e)});};return PlayToggle}(Button);PlayToggle.prototype.controlText_="Play";Component$1.registerComponent("PlayToggle",PlayToggle);var defaultImplementation=function defaultImplementation(seconds,guide){seconds=seconds<0?0:seconds;var s=Math.floor(seconds%60);var m=Math.floor(seconds/60%60);var h=Math.floor(seconds/3600);var gm=Math.floor(guide/60%60);var gh=Math.floor(guide/3600);if(isNaN(seconds)||seconds===Infinity){h=m=s="-";}h=h>0||gh>0?h+":":"";m=((h||gm>=10)&&m<10?"0"+m:m)+":";s=s<10?"0"+s:s;return h+m+s};var implementation=defaultImplementation;function setFormatTime(customImplementation){implementation=customImplementation;}function resetFormatTime(){implementation=defaultImplementation;}function formatTime(seconds,guide){if(guide===void 0){guide=seconds;}return implementation(seconds,guide)}var TimeDisplay=function(_Component){_inheritsLoose(TimeDisplay,_Component);function TimeDisplay(player,options){var _this;_this=_Component.call(this,player,options)||this;_this.on(player,["timeupdate","ended"],function(e){return _this.updateContent(e)});_this.updateTextNode_();return _this}var _proto=TimeDisplay.prototype;_proto.createEl=function createEl$1(){var className=this.buildCSSClass();var el=_Component.prototype.createEl.call(this,"div",{className:className+" vjs-time-control vjs-control"});var span=createEl("span",{className:"vjs-control-text",textContent:this.localize(this.labelText_)+"\xa0"},{role:"presentation"});el.appendChild(span);this.contentEl_=createEl("span",{className:className+"-display"},{"aria-live":"off","role":"presentation"});el.appendChild(this.contentEl_);return el};_proto.dispose=function dispose(){this.contentEl_=null;this.textNode_=null;_Component.prototype.dispose.call(this);};_proto.updateTextNode_=function updateTextNode_(time){var _this2=this;if(time===void 0){time=0;}time=formatTime(time);if(this.formattedTime_===time){return}this.formattedTime_=time;this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_",function(){if(!_this2.contentEl_){return}var oldNode=_this2.textNode_;if(oldNode&&_this2.contentEl_.firstChild!==oldNode){oldNode=null;log$1.warn("TimeDisplay#updateTextnode_: Prevented replacement of text node element since it was no longer a child of this node. Appending a new node instead.");}_this2.textNode_=document_1.createTextNode(_this2.formattedTime_);if(!_this2.textNode_){return}if(oldNode){_this2.contentEl_.replaceChild(_this2.textNode_,oldNode);}else {_this2.contentEl_.appendChild(_this2.textNode_);}});};_proto.updateContent=function updateContent(event){};return TimeDisplay}(Component$1);TimeDisplay.prototype.labelText_="Time";TimeDisplay.prototype.controlText_="Time";Component$1.registerComponent("TimeDisplay",TimeDisplay);var CurrentTimeDisplay=function(_TimeDisplay){_inheritsLoose(CurrentTimeDisplay,_TimeDisplay);function CurrentTimeDisplay(){return _TimeDisplay.apply(this,arguments)||this}var _proto=CurrentTimeDisplay.prototype;_proto.buildCSSClass=function buildCSSClass(){return "vjs-current-time"};_proto.updateContent=function updateContent(event){var time;if(this.player_.ended()){time=this.player_.duration();}else {time=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();}this.updateTextNode_(time);};return CurrentTimeDisplay}(TimeDisplay);CurrentTimeDisplay.prototype.labelText_="Current Time";CurrentTimeDisplay.prototype.controlText_="Current Time";Component$1.registerComponent("CurrentTimeDisplay",CurrentTimeDisplay);var DurationDisplay=function(_TimeDisplay){_inheritsLoose(DurationDisplay,_TimeDisplay);function DurationDisplay(player,options){var _this;_this=_TimeDisplay.call(this,player,options)||this;var updateContent=function updateContent(e){return _this.updateContent(e)};_this.on(player,"durationchange",updateContent);_this.on(player,"loadstart",updateContent);_this.on(player,"loadedmetadata",updateContent);return _this}var _proto=DurationDisplay.prototype;_proto.buildCSSClass=function buildCSSClass(){return "vjs-duration"};_proto.updateContent=function updateContent(event){var duration=this.player_.duration();this.updateTextNode_(duration);};return DurationDisplay}(TimeDisplay);DurationDisplay.prototype.labelText_="Duration";DurationDisplay.prototype.controlText_="Duration";Component$1.registerComponent("DurationDisplay",DurationDisplay);var TimeDivider=function(_Component){_inheritsLoose(TimeDivider,_Component);function TimeDivider(){return _Component.apply(this,arguments)||this}var _proto=TimeDivider.prototype;_proto.createEl=function createEl(){var el=_Component.prototype.createEl.call(this,"div",{className:"vjs-time-control vjs-time-divider"},{"aria-hidden":true});var div=_Component.prototype.createEl.call(this,"div");var span=_Component.prototype.createEl.call(this,"span",{textContent:"/"});div.appendChild(span);el.appendChild(div);return el};return TimeDivider}(Component$1);Component$1.registerComponent("TimeDivider",TimeDivider);var RemainingTimeDisplay=function(_TimeDisplay){_inheritsLoose(RemainingTimeDisplay,_TimeDisplay);function RemainingTimeDisplay(player,options){var _this;_this=_TimeDisplay.call(this,player,options)||this;_this.on(player,"durationchange",function(e){return _this.updateContent(e)});return _this}var _proto=RemainingTimeDisplay.prototype;_proto.buildCSSClass=function buildCSSClass(){return "vjs-remaining-time"};_proto.createEl=function createEl$1(){var el=_TimeDisplay.prototype.createEl.call(this);if(this.options_.displayNegative!==false){el.insertBefore(createEl("span",{},{"aria-hidden":true},"-"),this.contentEl_);}return el};_proto.updateContent=function updateContent(event){if(typeof this.player_.duration()!=="number"){return}var time;if(this.player_.ended()){time=0;}else if(this.player_.remainingTimeDisplay){time=this.player_.remainingTimeDisplay();}else {time=this.player_.remainingTime();}this.updateTextNode_(time);};return RemainingTimeDisplay}(TimeDisplay);RemainingTimeDisplay.prototype.labelText_="Remaining Time";RemainingTimeDisplay.prototype.controlText_="Remaining Time";Component$1.registerComponent("RemainingTimeDisplay",RemainingTimeDisplay);var LiveDisplay=function(_Component){_inheritsLoose(LiveDisplay,_Component);function LiveDisplay(player,options){var _this;_this=_Component.call(this,player,options)||this;_this.updateShowing();_this.on(_this.player(),"durationchange",function(e){return _this.updateShowing(e)});return _this}var _proto=LiveDisplay.prototype;_proto.createEl=function createEl$1(){var el=_Component.prototype.createEl.call(this,"div",{className:"vjs-live-control vjs-control"});this.contentEl_=createEl("div",{className:"vjs-live-display"},{"aria-live":"off"});this.contentEl_.appendChild(createEl("span",{className:"vjs-control-text",textContent:this.localize("Stream Type")+"\xa0"}));this.contentEl_.appendChild(document_1.createTextNode(this.localize("LIVE")));el.appendChild(this.contentEl_);return el};_proto.dispose=function dispose(){this.contentEl_=null;_Component.prototype.dispose.call(this);};_proto.updateShowing=function updateShowing(event){if(this.player().duration()===Infinity){this.show();}else {this.hide();}};return LiveDisplay}(Component$1);Component$1.registerComponent("LiveDisplay",LiveDisplay);var SeekToLive=function(_Button){_inheritsLoose(SeekToLive,_Button);function SeekToLive(player,options){var _this;_this=_Button.call(this,player,options)||this;_this.updateLiveEdgeStatus();if(_this.player_.liveTracker){_this.updateLiveEdgeStatusHandler_=function(e){return _this.updateLiveEdgeStatus(e)};_this.on(_this.player_.liveTracker,"liveedgechange",_this.updateLiveEdgeStatusHandler_);}return _this}var _proto=SeekToLive.prototype;_proto.createEl=function createEl$1(){var el=_Button.prototype.createEl.call(this,"button",{className:"vjs-seek-to-live-control vjs-control"});this.textEl_=createEl("span",{className:"vjs-seek-to-live-text",textContent:this.localize("LIVE")},{"aria-hidden":"true"});el.appendChild(this.textEl_);return el};_proto.updateLiveEdgeStatus=function updateLiveEdgeStatus(){if(!this.player_.liveTracker||this.player_.liveTracker.atLiveEdge()){this.setAttribute("aria-disabled",true);this.addClass("vjs-at-live-edge");this.controlText("Seek to live, currently playing live");}else {this.setAttribute("aria-disabled",false);this.removeClass("vjs-at-live-edge");this.controlText("Seek to live, currently behind live");}};_proto.handleClick=function handleClick(){this.player_.liveTracker.seekToLiveEdge();};_proto.dispose=function dispose(){if(this.player_.liveTracker){this.off(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_);}this.textEl_=null;_Button.prototype.dispose.call(this);};return SeekToLive}(Button);SeekToLive.prototype.controlText_="Seek to live, currently playing live";Component$1.registerComponent("SeekToLive",SeekToLive);var clamp=function clamp(number,min,max){number=Number(number);return Math.min(max,Math.max(min,isNaN(number)?min:number))};var Slider=function(_Component){_inheritsLoose(Slider,_Component);function Slider(player,options){var _this;_this=_Component.call(this,player,options)||this;_this.handleMouseDown_=function(e){return _this.handleMouseDown(e)};_this.handleMouseUp_=function(e){return _this.handleMouseUp(e)};_this.handleKeyDown_=function(e){return _this.handleKeyDown(e)};_this.handleClick_=function(e){return _this.handleClick(e)};_this.handleMouseMove_=function(e){return _this.handleMouseMove(e)};_this.update_=function(e){return _this.update(e)};_this.bar=_this.getChild(_this.options_.barName);_this.vertical(!!_this.options_.vertical);_this.enable();return _this}var _proto=Slider.prototype;_proto.enabled=function enabled(){return this.enabled_};_proto.enable=function enable(){if(this.enabled()){return}this.on("mousedown",this.handleMouseDown_);this.on("touchstart",this.handleMouseDown_);this.on("keydown",this.handleKeyDown_);this.on("click",this.handleClick_);this.on(this.player_,"controlsvisible",this.update);if(this.playerEvent){this.on(this.player_,this.playerEvent,this.update);}this.removeClass("disabled");this.setAttribute("tabindex",0);this.enabled_=true;};_proto.disable=function disable(){if(!this.enabled()){return}var doc=this.bar.el_.ownerDocument;this.off("mousedown",this.handleMouseDown_);this.off("touchstart",this.handleMouseDown_);this.off("keydown",this.handleKeyDown_);this.off("click",this.handleClick_);this.off(this.player_,"controlsvisible",this.update_);this.off(doc,"mousemove",this.handleMouseMove_);this.off(doc,"mouseup",this.handleMouseUp_);this.off(doc,"touchmove",this.handleMouseMove_);this.off(doc,"touchend",this.handleMouseUp_);this.removeAttribute("tabindex");this.addClass("disabled");if(this.playerEvent){this.off(this.player_,this.playerEvent,this.update);}this.enabled_=false;};_proto.createEl=function createEl(type,props,attributes){if(props===void 0){props={};}if(attributes===void 0){attributes={};}props.className=props.className+" vjs-slider";props=assign({tabIndex:0},props);attributes=assign({"role":"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100,"tabIndex":0},attributes);return _Component.prototype.createEl.call(this,type,props,attributes)};_proto.handleMouseDown=function handleMouseDown(event){var doc=this.bar.el_.ownerDocument;if(event.type==="mousedown"){event.preventDefault();}if(event.type==="touchstart"&&!IS_CHROME){event.preventDefault();}blockTextSelection();this.addClass("vjs-sliding");this.trigger("slideractive");this.on(doc,"mousemove",this.handleMouseMove_);this.on(doc,"mouseup",this.handleMouseUp_);this.on(doc,"touchmove",this.handleMouseMove_);this.on(doc,"touchend",this.handleMouseUp_);this.handleMouseMove(event,true);};_proto.handleMouseMove=function handleMouseMove(event){};_proto.handleMouseUp=function handleMouseUp(){var doc=this.bar.el_.ownerDocument;unblockTextSelection();this.removeClass("vjs-sliding");this.trigger("sliderinactive");this.off(doc,"mousemove",this.handleMouseMove_);this.off(doc,"mouseup",this.handleMouseUp_);this.off(doc,"touchmove",this.handleMouseMove_);this.off(doc,"touchend",this.handleMouseUp_);this.update();};_proto.update=function update(){var _this2=this;if(!this.el_||!this.bar){return}var progress=this.getProgress();if(progress===this.progress_){return progress}this.progress_=progress;this.requestNamedAnimationFrame("Slider#update",function(){var sizeKey=_this2.vertical()?"height":"width";_this2.bar.el().style[sizeKey]=(progress*100).toFixed(2)+"%";});return progress};_proto.getProgress=function getProgress(){return Number(clamp(this.getPercent(),0,1).toFixed(4))};_proto.calculateDistance=function calculateDistance(event){var position=getPointerPosition(this.el_,event);if(this.vertical()){return position.y}return position.x};_proto.handleKeyDown=function handleKeyDown(event){if(keycode.isEventKey(event,"Left")||keycode.isEventKey(event,"Down")){event.preventDefault();event.stopPropagation();this.stepBack();}else if(keycode.isEventKey(event,"Right")||keycode.isEventKey(event,"Up")){event.preventDefault();event.stopPropagation();this.stepForward();}else {_Component.prototype.handleKeyDown.call(this,event);}};_proto.handleClick=function handleClick(event){event.stopPropagation();event.preventDefault();};_proto.vertical=function vertical(bool){if(bool===undefined){return this.vertical_||false}this.vertical_=!!bool;if(this.vertical_){this.addClass("vjs-slider-vertical");}else {this.addClass("vjs-slider-horizontal");}};return Slider}(Component$1);Component$1.registerComponent("Slider",Slider);var percentify=function percentify(time,end){return clamp(time/end*100,0,100).toFixed(2)+"%"};var LoadProgressBar=function(_Component){_inheritsLoose(LoadProgressBar,_Component);function LoadProgressBar(player,options){var _this;_this=_Component.call(this,player,options)||this;_this.partEls_=[];_this.on(player,"progress",function(e){return _this.update(e)});return _this}var _proto=LoadProgressBar.prototype;_proto.createEl=function createEl$1(){var el=_Component.prototype.createEl.call(this,"div",{className:"vjs-load-progress"});var wrapper=createEl("span",{className:"vjs-control-text"});var loadedText=createEl("span",{textContent:this.localize("Loaded")});var separator=document_1.createTextNode(": ");this.percentageEl_=createEl("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"});el.appendChild(wrapper);wrapper.appendChild(loadedText);wrapper.appendChild(separator);wrapper.appendChild(this.percentageEl_);return el};_proto.dispose=function dispose(){this.partEls_=null;this.percentageEl_=null;_Component.prototype.dispose.call(this);};_proto.update=function update(event){var _this2=this;this.requestNamedAnimationFrame("LoadProgressBar#update",function(){var liveTracker=_this2.player_.liveTracker;var buffered=_this2.player_.buffered();var duration=liveTracker&&liveTracker.isLive()?liveTracker.seekableEnd():_this2.player_.duration();var bufferedEnd=_this2.player_.bufferedEnd();var children=_this2.partEls_;var percent=percentify(bufferedEnd,duration);if(_this2.percent_!==percent){_this2.el_.style.width=percent;textContent(_this2.percentageEl_,percent);_this2.percent_=percent;}for(var i=0;i<buffered.length;i++){var start=buffered.start(i);var end=buffered.end(i);var part=children[i];if(!part){part=_this2.el_.appendChild(createEl());children[i]=part;}if(part.dataset.start===start&&part.dataset.end===end){continue}part.dataset.start=start;part.dataset.end=end;part.style.left=percentify(start,bufferedEnd);part.style.width=percentify(end-start,bufferedEnd);}for(var _i=children.length;_i>buffered.length;_i--){_this2.el_.removeChild(children[_i-1]);}children.length=buffered.length;});};return LoadProgressBar}(Component$1);Component$1.registerComponent("LoadProgressBar",LoadProgressBar);var TimeTooltip=function(_Component){_inheritsLoose(TimeTooltip,_Component);function TimeTooltip(player,options){var _this;_this=_Component.call(this,player,options)||this;_this.update=throttle(bind(_assertThisInitialized(_this),_this.update),UPDATE_REFRESH_INTERVAL);return _this}var _proto=TimeTooltip.prototype;_proto.createEl=function createEl(){return _Component.prototype.createEl.call(this,"div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})};_proto.update=function update(seekBarRect,seekBarPoint,content){var tooltipRect=findPosition(this.el_);var playerRect=getBoundingClientRect(this.player_.el());var seekBarPointPx=seekBarRect.width*seekBarPoint;if(!playerRect||!tooltipRect){return}var spaceLeftOfPoint=seekBarRect.left-playerRect.left+seekBarPointPx;var spaceRightOfPoint=seekBarRect.width-seekBarPointPx+(playerRect.right-seekBarRect.right);var pullTooltipBy=tooltipRect.width/2;if(spaceLeftOfPoint<pullTooltipBy){pullTooltipBy+=pullTooltipBy-spaceLeftOfPoint;}else if(spaceRightOfPoint<pullTooltipBy){pullTooltipBy=spaceRightOfPoint;}if(pullTooltipBy<0){pullTooltipBy=0;}else if(pullTooltipBy>tooltipRect.width){pullTooltipBy=tooltipRect.width;}pullTooltipBy=Math.round(pullTooltipBy);this.el_.style.right="-"+pullTooltipBy+"px";this.write(content);};_proto.write=function write(content){textContent(this.el_,content);};_proto.updateTime=function updateTime(seekBarRect,seekBarPoint,time,cb){var _this2=this;this.requestNamedAnimationFrame("TimeTooltip#updateTime",function(){var content;var duration=_this2.player_.duration();if(_this2.player_.liveTracker&&_this2.player_.liveTracker.isLive()){var liveWindow=_this2.player_.liveTracker.liveWindow();var secondsBehind=liveWindow-seekBarPoint*liveWindow;content=(secondsBehind<1?"":"-")+formatTime(secondsBehind,liveWindow);}else {content=formatTime(time,duration);}_this2.update(seekBarRect,seekBarPoint,content);if(cb){cb();}});};return TimeTooltip}(Component$1);Component$1.registerComponent("TimeTooltip",TimeTooltip);var PlayProgressBar=function(_Component){_inheritsLoose(PlayProgressBar,_Component);function PlayProgressBar(player,options){var _this;_this=_Component.call(this,player,options)||this;_this.update=throttle(bind(_assertThisInitialized(_this),_this.update),UPDATE_REFRESH_INTERVAL);return _this}var _proto=PlayProgressBar.prototype;_proto.createEl=function createEl(){return _Component.prototype.createEl.call(this,"div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})};_proto.update=function update(seekBarRect,seekBarPoint){var timeTooltip=this.getChild("timeTooltip");if(!timeTooltip){return}var time=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();timeTooltip.updateTime(seekBarRect,seekBarPoint,time);};return PlayProgressBar}(Component$1);PlayProgressBar.prototype.options_={children:[]};if(!IS_IOS&&!IS_ANDROID){PlayProgressBar.prototype.options_.children.push("timeTooltip");}Component$1.registerComponent("PlayProgressBar",PlayProgressBar);var MouseTimeDisplay=function(_Component){_inheritsLoose(MouseTimeDisplay,_Component);function MouseTimeDisplay(player,options){var _this;_this=_Component.call(this,player,options)||this;_this.update=throttle(bind(_assertThisInitialized(_this),_this.update),UPDATE_REFRESH_INTERVAL);return _this}var _proto=MouseTimeDisplay.prototype;_proto.createEl=function createEl(){return _Component.prototype.createEl.call(this,"div",{className:"vjs-mouse-display"})};_proto.update=function update(seekBarRect,seekBarPoint){var _this2=this;var time=seekBarPoint*this.player_.duration();this.getChild("timeTooltip").updateTime(seekBarRect,seekBarPoint,time,function(){_this2.el_.style.left=seekBarRect.width*seekBarPoint+"px";});};return MouseTimeDisplay}(Component$1);MouseTimeDisplay.prototype.options_={children:["timeTooltip"]};Component$1.registerComponent("MouseTimeDisplay",MouseTimeDisplay);var STEP_SECONDS=5;var PAGE_KEY_MULTIPLIER=12;var SeekBar=function(_Slider){_inheritsLoose(SeekBar,_Slider);function SeekBar(player,options){var _this;_this=_Slider.call(this,player,options)||this;_this.setEventHandlers_();return _this}var _proto=SeekBar.prototype;_proto.setEventHandlers_=function setEventHandlers_(){var _this2=this;this.update_=bind(this,this.update);this.update=throttle(this.update_,UPDATE_REFRESH_INTERVAL);this.on(this.player_,["ended","durationchange","timeupdate"],this.update);if(this.player_.liveTracker){this.on(this.player_.liveTracker,"liveedgechange",this.update);}this.updateInterval=null;this.enableIntervalHandler_=function(e){return _this2.enableInterval_(e)};this.disableIntervalHandler_=function(e){return _this2.disableInterval_(e)};this.on(this.player_,["playing"],this.enableIntervalHandler_);this.on(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_);if("hidden"in document_1&&"visibilityState"in document_1){this.on(document_1,"visibilitychange",this.toggleVisibility_);}};_proto.toggleVisibility_=function toggleVisibility_(e){if(document_1.visibilityState==="hidden"){this.cancelNamedAnimationFrame("SeekBar#update");this.cancelNamedAnimationFrame("Slider#update");this.disableInterval_(e);}else {if(!this.player_.ended()&&!this.player_.paused()){this.enableInterval_();}this.update();}};_proto.enableInterval_=function enableInterval_(){if(this.updateInterval){return}this.updateInterval=this.setInterval(this.update,UPDATE_REFRESH_INTERVAL);};_proto.disableInterval_=function disableInterval_(e){if(this.player_.liveTracker&&this.player_.liveTracker.isLive()&&e&&e.type!=="ended"){return}if(!this.updateInterval){return}this.clearInterval(this.updateInterval);this.updateInterval=null;};_proto.createEl=function createEl(){return _Slider.prototype.createEl.call(this,"div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})};_proto.update=function update(event){var _this3=this;if(document_1.visibilityState==="hidden"){return}var percent=_Slider.prototype.update.call(this);this.requestNamedAnimationFrame("SeekBar#update",function(){var currentTime=_this3.player_.ended()?_this3.player_.duration():_this3.getCurrentTime_();var liveTracker=_this3.player_.liveTracker;var duration=_this3.player_.duration();if(liveTracker&&liveTracker.isLive()){duration=_this3.player_.liveTracker.liveCurrentTime();}if(_this3.percent_!==percent){_this3.el_.setAttribute("aria-valuenow",(percent*100).toFixed(2));_this3.percent_=percent;}if(_this3.currentTime_!==currentTime||_this3.duration_!==duration){_this3.el_.setAttribute("aria-valuetext",_this3.localize("progress bar timing: currentTime={1} duration={2}",[formatTime(currentTime,duration),formatTime(duration,duration)],"{1} of {2}"));_this3.currentTime_=currentTime;_this3.duration_=duration;}if(_this3.bar){_this3.bar.update(getBoundingClientRect(_this3.el()),_this3.getProgress());}});return percent};_proto.userSeek_=function userSeek_(ct){if(this.player_.liveTracker&&this.player_.liveTracker.isLive()){this.player_.liveTracker.nextSeekedFromUser();}this.player_.currentTime(ct);};_proto.getCurrentTime_=function getCurrentTime_(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()};_proto.getPercent=function getPercent(){var currentTime=this.getCurrentTime_();var percent;var liveTracker=this.player_.liveTracker;if(liveTracker&&liveTracker.isLive()){percent=(currentTime-liveTracker.seekableStart())/liveTracker.liveWindow();if(liveTracker.atLiveEdge()){percent=1;}}else {percent=currentTime/this.player_.duration();}return percent};_proto.handleMouseDown=function handleMouseDown(event){if(!isSingleLeftClick(event)){return}event.stopPropagation();this.videoWasPlaying=!this.player_.paused();this.player_.pause();_Slider.prototype.handleMouseDown.call(this,event);};_proto.handleMouseMove=function handleMouseMove(event,mouseDown){if(mouseDown===void 0){mouseDown=false;}if(!isSingleLeftClick(event)){return}if(!mouseDown&&!this.player_.scrubbing()){this.player_.scrubbing(true);}var newTime;var distance=this.calculateDistance(event);var liveTracker=this.player_.liveTracker;if(!liveTracker||!liveTracker.isLive()){newTime=distance*this.player_.duration();if(newTime===this.player_.duration()){newTime=newTime-.1;}}else {if(distance>=.99){liveTracker.seekToLiveEdge();return}var seekableStart=liveTracker.seekableStart();var seekableEnd=liveTracker.liveCurrentTime();newTime=seekableStart+distance*liveTracker.liveWindow();if(newTime>=seekableEnd){newTime=seekableEnd;}if(newTime<=seekableStart){newTime=seekableStart+.1;}if(newTime===Infinity){return}}this.userSeek_(newTime);};_proto.enable=function enable(){_Slider.prototype.enable.call(this);var mouseTimeDisplay=this.getChild("mouseTimeDisplay");if(!mouseTimeDisplay){return}mouseTimeDisplay.show();};_proto.disable=function disable(){_Slider.prototype.disable.call(this);var mouseTimeDisplay=this.getChild("mouseTimeDisplay");if(!mouseTimeDisplay){return}mouseTimeDisplay.hide();};_proto.handleMouseUp=function handleMouseUp(event){_Slider.prototype.handleMouseUp.call(this,event);if(event){event.stopPropagation();}this.player_.scrubbing(false);this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:true});if(this.videoWasPlaying){silencePromise(this.player_.play());}else {this.update_();}};_proto.stepForward=function stepForward(){this.userSeek_(this.player_.currentTime()+STEP_SECONDS);};_proto.stepBack=function stepBack(){this.userSeek_(this.player_.currentTime()-STEP_SECONDS);};_proto.handleAction=function handleAction(event){if(this.player_.paused()){this.player_.play();}else {this.player_.pause();}};_proto.handleKeyDown=function handleKeyDown(event){var liveTracker=this.player_.liveTracker;if(keycode.isEventKey(event,"Space")||keycode.isEventKey(event,"Enter")){event.preventDefault();event.stopPropagation();this.handleAction(event);}else if(keycode.isEventKey(event,"Home")){event.preventDefault();event.stopPropagation();this.userSeek_(0);}else if(keycode.isEventKey(event,"End")){event.preventDefault();event.stopPropagation();if(liveTracker&&liveTracker.isLive()){this.userSeek_(liveTracker.liveCurrentTime());}else {this.userSeek_(this.player_.duration());}}else if(/^[0-9]$/.test(keycode(event))){event.preventDefault();event.stopPropagation();var gotoFraction=(keycode.codes[keycode(event)]-keycode.codes["0"])*10/100;if(liveTracker&&liveTracker.isLive()){this.userSeek_(liveTracker.seekableStart()+liveTracker.liveWindow()*gotoFraction);}else {this.userSeek_(this.player_.duration()*gotoFraction);}}else if(keycode.isEventKey(event,"PgDn")){event.preventDefault();event.stopPropagation();this.userSeek_(this.player_.currentTime()-STEP_SECONDS*PAGE_KEY_MULTIPLIER);}else if(keycode.isEventKey(event,"PgUp")){event.preventDefault();event.stopPropagation();this.userSeek_(this.player_.currentTime()+STEP_SECONDS*PAGE_KEY_MULTIPLIER);}else {_Slider.prototype.handleKeyDown.call(this,event);}};_proto.dispose=function dispose(){this.disableInterval_();this.off(this.player_,["ended","durationchange","timeupdate"],this.update);if(this.player_.liveTracker){this.off(this.player_.liveTracker,"liveedgechange",this.update);}this.off(this.player_,["playing"],this.enableIntervalHandler_);this.off(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_);if("hidden"in document_1&&"visibilityState"in document_1){this.off(document_1,"visibilitychange",this.toggleVisibility_);}_Slider.prototype.dispose.call(this);};return SeekBar}(Slider);SeekBar.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"};if(!IS_IOS&&!IS_ANDROID){SeekBar.prototype.options_.children.splice(1,0,"mouseTimeDisplay");}Component$1.registerComponent("SeekBar",SeekBar);var ProgressControl=function(_Component){_inheritsLoose(ProgressControl,_Component);function ProgressControl(player,options){var _this;_this=_Component.call(this,player,options)||this;_this.handleMouseMove=throttle(bind(_assertThisInitialized(_this),_this.handleMouseMove),UPDATE_REFRESH_INTERVAL);_this.throttledHandleMouseSeek=throttle(bind(_assertThisInitialized(_this),_this.handleMouseSeek),UPDATE_REFRESH_INTERVAL);_this.handleMouseUpHandler_=function(e){return _this.handleMouseUp(e)};_this.handleMouseDownHandler_=function(e){return _this.handleMouseDown(e)};_this.enable();return _this}var _proto=ProgressControl.prototype;_proto.createEl=function createEl(){return _Component.prototype.createEl.call(this,"div",{className:"vjs-progress-control vjs-control"})};_proto.handleMouseMove=function handleMouseMove(event){var seekBar=this.getChild("seekBar");if(!seekBar){return}var playProgressBar=seekBar.getChild("playProgressBar");var mouseTimeDisplay=seekBar.getChild("mouseTimeDisplay");if(!playProgressBar&&!mouseTimeDisplay){return}var seekBarEl=seekBar.el();var seekBarRect=findPosition(seekBarEl);var seekBarPoint=getPointerPosition(seekBarEl,event).x;seekBarPoint=clamp(seekBarPoint,0,1);if(mouseTimeDisplay){mouseTimeDisplay.update(seekBarRect,seekBarPoint);}if(playProgressBar){playProgressBar.update(seekBarRect,seekBar.getProgress());}};_proto.handleMouseSeek=function handleMouseSeek(event){var seekBar=this.getChild("seekBar");if(seekBar){seekBar.handleMouseMove(event);}};_proto.enabled=function enabled(){return this.enabled_};_proto.disable=function disable(){this.children().forEach(function(child){return child.disable&&child.disable()});if(!this.enabled()){return}this.off(["mousedown","touchstart"],this.handleMouseDownHandler_);this.off(this.el_,"mousemove",this.handleMouseMove);this.removeListenersAddedOnMousedownAndTouchstart();this.addClass("disabled");this.enabled_=false;if(this.player_.scrubbing()){var seekBar=this.getChild("seekBar");this.player_.scrubbing(false);if(seekBar.videoWasPlaying){silencePromise(this.player_.play());}}};_proto.enable=function enable(){this.children().forEach(function(child){return child.enable&&child.enable()});if(this.enabled()){return}this.on(["mousedown","touchstart"],this.handleMouseDownHandler_);this.on(this.el_,"mousemove",this.handleMouseMove);this.removeClass("disabled");this.enabled_=true;};_proto.removeListenersAddedOnMousedownAndTouchstart=function removeListenersAddedOnMousedownAndTouchstart(){var doc=this.el_.ownerDocument;this.off(doc,"mousemove",this.throttledHandleMouseSeek);this.off(doc,"touchmove",this.throttledHandleMouseSeek);this.off(doc,"mouseup",this.handleMouseUpHandler_);this.off(doc,"touchend",this.handleMouseUpHandler_);};_proto.handleMouseDown=function handleMouseDown(event){var doc=this.el_.ownerDocument;var seekBar=this.getChild("seekBar");if(seekBar){seekBar.handleMouseDown(event);}this.on(doc,"mousemove",this.throttledHandleMouseSeek);this.on(doc,"touchmove",this.throttledHandleMouseSeek);this.on(doc,"mouseup",this.handleMouseUpHandler_);this.on(doc,"touchend",this.handleMouseUpHandler_);};_proto.handleMouseUp=function handleMouseUp(event){var seekBar=this.getChild("seekBar");if(seekBar){seekBar.handleMouseUp(event);}this.removeListenersAddedOnMousedownAndTouchstart();};return ProgressControl}(Component$1);ProgressControl.prototype.options_={children:["seekBar"]};Component$1.registerComponent("ProgressControl",ProgressControl);var PictureInPictureToggle=function(_Button){_inheritsLoose(PictureInPictureToggle,_Button);function PictureInPictureToggle(player,options){var _this;_this=_Button.call(this,player,options)||this;_this.on(player,["enterpictureinpicture","leavepictureinpicture"],function(e){return _this.handlePictureInPictureChange(e)});_this.on(player,["disablepictureinpicturechanged","loadedmetadata"],function(e){return _this.handlePictureInPictureEnabledChange(e)});_this.on(player,["loadedmetadata","audioonlymodechange","audiopostermodechange"],function(){var isSourceAudio=player.currentType().substring(0,5)==="audio";if(isSourceAudio||player.audioPosterMode()||player.audioOnlyMode()){if(player.isInPictureInPicture()){player.exitPictureInPicture();}_this.hide();}else {_this.show();}});_this.disable();return _this}var _proto=PictureInPictureToggle.prototype;_proto.buildCSSClass=function buildCSSClass(){return "vjs-picture-in-picture-control "+_Button.prototype.buildCSSClass.call(this)};_proto.handlePictureInPictureEnabledChange=function handlePictureInPictureEnabledChange(){if(document_1.pictureInPictureEnabled&&this.player_.disablePictureInPicture()===false){this.enable();}else {this.disable();}};_proto.handlePictureInPictureChange=function handlePictureInPictureChange(event){if(this.player_.isInPictureInPicture()){this.controlText("Exit Picture-in-Picture");}else {this.controlText("Picture-in-Picture");}this.handlePictureInPictureEnabledChange();};_proto.handleClick=function handleClick(event){if(!this.player_.isInPictureInPicture()){this.player_.requestPictureInPicture();}else {this.player_.exitPictureInPicture();}};return PictureInPictureToggle}(Button);PictureInPictureToggle.prototype.controlText_="Picture-in-Picture";Component$1.registerComponent("PictureInPictureToggle",PictureInPictureToggle);var FullscreenToggle=function(_Button){_inheritsLoose(FullscreenToggle,_Button);function FullscreenToggle(player,options){var _this;_this=_Button.call(this,player,options)||this;_this.on(player,"fullscreenchange",function(e){return _this.handleFullscreenChange(e)});if(document_1[player.fsApi_.fullscreenEnabled]===false){_this.disable();}return _this}var _proto=FullscreenToggle.prototype;_proto.buildCSSClass=function buildCSSClass(){return "vjs-fullscreen-control "+_Button.prototype.buildCSSClass.call(this)};_proto.handleFullscreenChange=function handleFullscreenChange(event){if(this.player_.isFullscreen()){this.controlText("Non-Fullscreen");}else {this.controlText("Fullscreen");}};_proto.handleClick=function handleClick(event){if(!this.player_.isFullscreen()){this.player_.requestFullscreen();}else {this.player_.exitFullscreen();}};return FullscreenToggle}(Button);FullscreenToggle.prototype.controlText_="Fullscreen";Component$1.registerComponent("FullscreenToggle",FullscreenToggle);var checkVolumeSupport=function checkVolumeSupport(self1,player){if(player.tech_&&!player.tech_.featuresVolumeControl){self1.addClass("vjs-hidden");}self1.on(player,"loadstart",function(){if(!player.tech_.featuresVolumeControl){self1.addClass("vjs-hidden");}else {self1.removeClass("vjs-hidden");}});};var VolumeLevel=function(_Component){_inheritsLoose(VolumeLevel,_Component);function VolumeLevel(){return _Component.apply(this,arguments)||this}var _proto=VolumeLevel.prototype;_proto.createEl=function createEl(){var el=_Component.prototype.createEl.call(this,"div",{className:"vjs-volume-level"});el.appendChild(_Component.prototype.createEl.call(this,"span",{className:"vjs-control-text"}));return el};return VolumeLevel}(Component$1);Component$1.registerComponent("VolumeLevel",VolumeLevel);var VolumeLevelTooltip=function(_Component){_inheritsLoose(VolumeLevelTooltip,_Component);function VolumeLevelTooltip(player,options){var _this;_this=_Component.call(this,player,options)||this;_this.update=throttle(bind(_assertThisInitialized(_this),_this.update),UPDATE_REFRESH_INTERVAL);return _this}var _proto=VolumeLevelTooltip.prototype;_proto.createEl=function createEl(){return _Component.prototype.createEl.call(this,"div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})};_proto.update=function update(rangeBarRect,rangeBarPoint,vertical,content){if(!vertical){var tooltipRect=getBoundingClientRect(this.el_);var playerRect=getBoundingClientRect(this.player_.el());var volumeBarPointPx=rangeBarRect.width*rangeBarPoint;if(!playerRect||!tooltipRect){return}var spaceLeftOfPoint=rangeBarRect.left-playerRect.left+volumeBarPointPx;var spaceRightOfPoint=rangeBarRect.width-volumeBarPointPx+(playerRect.right-rangeBarRect.right);var pullTooltipBy=tooltipRect.width/2;if(spaceLeftOfPoint<pullTooltipBy){pullTooltipBy+=pullTooltipBy-spaceLeftOfPoint;}else if(spaceRightOfPoint<pullTooltipBy){pullTooltipBy=spaceRightOfPoint;}if(pullTooltipBy<0){pullTooltipBy=0;}else if(pullTooltipBy>tooltipRect.width){pullTooltipBy=tooltipRect.width;}this.el_.style.right="-"+pullTooltipBy+"px";}this.write(content+"%");};_proto.write=function write(content){textContent(this.el_,content);};_proto.updateVolume=function updateVolume(rangeBarRect,rangeBarPoint,vertical,volume,cb){var _this2=this;this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",function(){_this2.update(rangeBarRect,rangeBarPoint,vertical,volume.toFixed(0));if(cb){cb();}});};return VolumeLevelTooltip}(Component$1);Component$1.registerComponent("VolumeLevelTooltip",VolumeLevelTooltip);var MouseVolumeLevelDisplay=function(_Component){_inheritsLoose(MouseVolumeLevelDisplay,_Component);function MouseVolumeLevelDisplay(player,options){var _this;_this=_Component.call(this,player,options)||this;_this.update=throttle(bind(_assertThisInitialized(_this),_this.update),UPDATE_REFRESH_INTERVAL);return _this}var _proto=MouseVolumeLevelDisplay.prototype;_proto.createEl=function createEl(){return _Component.prototype.createEl.call(this,"div",{className:"vjs-mouse-display"})};_proto.update=function update(rangeBarRect,rangeBarPoint,vertical){var _this2=this;var volume=100*rangeBarPoint;this.getChild("volumeLevelTooltip").updateVolume(rangeBarRect,rangeBarPoint,vertical,volume,function(){if(vertical){_this2.el_.style.bottom=rangeBarRect.height*rangeBarPoint+"px";}else {_this2.el_.style.left=rangeBarRect.width*rangeBarPoint+"px";}});};return MouseVolumeLevelDisplay}(Component$1);MouseVolumeLevelDisplay.prototype.options_={children:["volumeLevelTooltip"]};Component$1.registerComponent("MouseVolumeLevelDisplay",MouseVolumeLevelDisplay);var VolumeBar=function(_Slider){_inheritsLoose(VolumeBar,_Slider);function VolumeBar(player,options){var _this;_this=_Slider.call(this,player,options)||this;_this.on("slideractive",function(e){return _this.updateLastVolume_(e)});_this.on(player,"volumechange",function(e){return _this.updateARIAAttributes(e)});player.ready(function(){return _this.updateARIAAttributes()});return _this}var _proto=VolumeBar.prototype;_proto.createEl=function createEl(){return _Slider.prototype.createEl.call(this,"div",{className:"vjs-volume-bar vjs-slider-bar"},{"aria-label":this.localize("Volume Level"),"aria-live":"polite"})};_proto.handleMouseDown=function handleMouseDown(event){if(!isSingleLeftClick(event)){return}_Slider.prototype.handleMouseDown.call(this,event);};_proto.handleMouseMove=function handleMouseMove(event){var mouseVolumeLevelDisplay=this.getChild("mouseVolumeLevelDisplay");if(mouseVolumeLevelDisplay){var volumeBarEl=this.el();var volumeBarRect=getBoundingClientRect(volumeBarEl);var vertical=this.vertical();var volumeBarPoint=getPointerPosition(volumeBarEl,event);volumeBarPoint=vertical?volumeBarPoint.y:volumeBarPoint.x;volumeBarPoint=clamp(volumeBarPoint,0,1);mouseVolumeLevelDisplay.update(volumeBarRect,volumeBarPoint,vertical);}if(!isSingleLeftClick(event)){return}this.checkMuted();this.player_.volume(this.calculateDistance(event));};_proto.checkMuted=function checkMuted(){if(this.player_.muted()){this.player_.muted(false);}};_proto.getPercent=function getPercent(){if(this.player_.muted()){return 0}return this.player_.volume()};_proto.stepForward=function stepForward(){this.checkMuted();this.player_.volume(this.player_.volume()+.1);};_proto.stepBack=function stepBack(){this.checkMuted();this.player_.volume(this.player_.volume()-.1);};_proto.updateARIAAttributes=function updateARIAAttributes(event){var ariaValue=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",ariaValue);this.el_.setAttribute("aria-valuetext",ariaValue+"%");};_proto.volumeAsPercentage_=function volumeAsPercentage_(){return Math.round(this.player_.volume()*100)};_proto.updateLastVolume_=function updateLastVolume_(){var _this2=this;var volumeBeforeDrag=this.player_.volume();this.one("sliderinactive",function(){if(_this2.player_.volume()===0){_this2.player_.lastVolume_(volumeBeforeDrag);}});};return VolumeBar}(Slider);VolumeBar.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"};if(!IS_IOS&&!IS_ANDROID){VolumeBar.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay");}VolumeBar.prototype.playerEvent="volumechange";Component$1.registerComponent("VolumeBar",VolumeBar);var VolumeControl=function(_Component){_inheritsLoose(VolumeControl,_Component);function VolumeControl(player,options){var _this;if(options===void 0){options={};}options.vertical=options.vertical||false;if(typeof options.volumeBar==="undefined"||isPlain(options.volumeBar)){options.volumeBar=options.volumeBar||{};options.volumeBar.vertical=options.vertical;}_this=_Component.call(this,player,options)||this;checkVolumeSupport(_assertThisInitialized(_this),player);_this.throttledHandleMouseMove=throttle(bind(_assertThisInitialized(_this),_this.handleMouseMove),UPDATE_REFRESH_INTERVAL);_this.handleMouseUpHandler_=function(e){return _this.handleMouseUp(e)};_this.on("mousedown",function(e){return _this.handleMouseDown(e)});_this.on("touchstart",function(e){return _this.handleMouseDown(e)});_this.on("mousemove",function(e){return _this.handleMouseMove(e)});_this.on(_this.volumeBar,["focus","slideractive"],function(){_this.volumeBar.addClass("vjs-slider-active");_this.addClass("vjs-slider-active");_this.trigger("slideractive");});_this.on(_this.volumeBar,["blur","sliderinactive"],function(){_this.volumeBar.removeClass("vjs-slider-active");_this.removeClass("vjs-slider-active");_this.trigger("sliderinactive");});return _this}var _proto=VolumeControl.prototype;_proto.createEl=function createEl(){var orientationClass="vjs-volume-horizontal";if(this.options_.vertical){orientationClass="vjs-volume-vertical";}return _Component.prototype.createEl.call(this,"div",{className:"vjs-volume-control vjs-control "+orientationClass})};_proto.handleMouseDown=function handleMouseDown(event){var doc=this.el_.ownerDocument;this.on(doc,"mousemove",this.throttledHandleMouseMove);this.on(doc,"touchmove",this.throttledHandleMouseMove);this.on(doc,"mouseup",this.handleMouseUpHandler_);this.on(doc,"touchend",this.handleMouseUpHandler_);};_proto.handleMouseUp=function handleMouseUp(event){var doc=this.el_.ownerDocument;this.off(doc,"mousemove",this.throttledHandleMouseMove);this.off(doc,"touchmove",this.throttledHandleMouseMove);this.off(doc,"mouseup",this.handleMouseUpHandler_);this.off(doc,"touchend",this.handleMouseUpHandler_);};_proto.handleMouseMove=function handleMouseMove(event){this.volumeBar.handleMouseMove(event);};return VolumeControl}(Component$1);VolumeControl.prototype.options_={children:["volumeBar"]};Component$1.registerComponent("VolumeControl",VolumeControl);var checkMuteSupport=function checkMuteSupport(self1,player){if(player.tech_&&!player.tech_.featuresMuteControl){self1.addClass("vjs-hidden");}self1.on(player,"loadstart",function(){if(!player.tech_.featuresMuteControl){self1.addClass("vjs-hidden");}else {self1.removeClass("vjs-hidden");}});};var MuteToggle=function(_Button){_inheritsLoose(MuteToggle,_Button);function MuteToggle(player,options){var _this;_this=_Button.call(this,player,options)||this;checkMuteSupport(_assertThisInitialized(_this),player);_this.on(player,["loadstart","volumechange"],function(e){return _this.update(e)});return _this}var _proto=MuteToggle.prototype;_proto.buildCSSClass=function buildCSSClass(){return "vjs-mute-control "+_Button.prototype.buildCSSClass.call(this)};_proto.handleClick=function handleClick(event){var vol=this.player_.volume();var lastVolume=this.player_.lastVolume_();if(vol===0){var volumeToSet=lastVolume<.1?.1:lastVolume;this.player_.volume(volumeToSet);this.player_.muted(false);}else {this.player_.muted(this.player_.muted()?false:true);}};_proto.update=function update(event){this.updateIcon_();this.updateControlText_();};_proto.updateIcon_=function updateIcon_(){var vol=this.player_.volume();var level=3;if(IS_IOS&&this.player_.tech_&&this.player_.tech_.el_){this.player_.muted(this.player_.tech_.el_.muted);}if(vol===0||this.player_.muted()){level=0;}else if(vol<.33){level=1;}else if(vol<.67){level=2;}for(var i=0;i<4;i++){removeClass(this.el_,"vjs-vol-"+i);}addClass(this.el_,"vjs-vol-"+level);};_proto.updateControlText_=function updateControlText_(){var soundOff=this.player_.muted()||this.player_.volume()===0;var text=soundOff?"Unmute":"Mute";if(this.controlText()!==text){this.controlText(text);}};return MuteToggle}(Button);MuteToggle.prototype.controlText_="Mute";Component$1.registerComponent("MuteToggle",MuteToggle);var VolumePanel=function(_Component){_inheritsLoose(VolumePanel,_Component);function VolumePanel(player,options){var _this;if(options===void 0){options={};}if(typeof options.inline!=="undefined"){options.inline=options.inline;}else {options.inline=true;}if(typeof options.volumeControl==="undefined"||isPlain(options.volumeControl)){options.volumeControl=options.volumeControl||{};options.volumeControl.vertical=!options.inline;}_this=_Component.call(this,player,options)||this;_this.handleKeyPressHandler_=function(e){return _this.handleKeyPress(e)};_this.on(player,["loadstart"],function(e){return _this.volumePanelState_(e)});_this.on(_this.muteToggle,"keyup",function(e){return _this.handleKeyPress(e)});_this.on(_this.volumeControl,"keyup",function(e){return _this.handleVolumeControlKeyUp(e)});_this.on("keydown",function(e){return _this.handleKeyPress(e)});_this.on("mouseover",function(e){return _this.handleMouseOver(e)});_this.on("mouseout",function(e){return _this.handleMouseOut(e)});_this.on(_this.volumeControl,["slideractive"],_this.sliderActive_);_this.on(_this.volumeControl,["sliderinactive"],_this.sliderInactive_);return _this}var _proto=VolumePanel.prototype;_proto.sliderActive_=function sliderActive_(){this.addClass("vjs-slider-active");};_proto.sliderInactive_=function sliderInactive_(){this.removeClass("vjs-slider-active");};_proto.volumePanelState_=function volumePanelState_(){if(this.volumeControl.hasClass("vjs-hidden")&&this.muteToggle.hasClass("vjs-hidden")){this.addClass("vjs-hidden");}if(this.volumeControl.hasClass("vjs-hidden")&&!this.muteToggle.hasClass("vjs-hidden")){this.addClass("vjs-mute-toggle-only");}};_proto.createEl=function createEl(){var orientationClass="vjs-volume-panel-horizontal";if(!this.options_.inline){orientationClass="vjs-volume-panel-vertical";}return _Component.prototype.createEl.call(this,"div",{className:"vjs-volume-panel vjs-control "+orientationClass})};_proto.dispose=function dispose(){this.handleMouseOut();_Component.prototype.dispose.call(this);};_proto.handleVolumeControlKeyUp=function handleVolumeControlKeyUp(event){if(keycode.isEventKey(event,"Esc")){this.muteToggle.focus();}};_proto.handleMouseOver=function handleMouseOver(event){this.addClass("vjs-hover");on(document_1,"keyup",this.handleKeyPressHandler_);};_proto.handleMouseOut=function handleMouseOut(event){this.removeClass("vjs-hover");off(document_1,"keyup",this.handleKeyPressHandler_);};_proto.handleKeyPress=function handleKeyPress(event){if(keycode.isEventKey(event,"Esc")){this.handleMouseOut();}};return VolumePanel}(Component$1);VolumePanel.prototype.options_={children:["muteToggle","volumeControl"]};Component$1.registerComponent("VolumePanel",VolumePanel);var Menu=function(_Component){_inheritsLoose(Menu,_Component);function Menu(player,options){var _this;_this=_Component.call(this,player,options)||this;if(options){_this.menuButton_=options.menuButton;}_this.focusedChild_=-1;_this.on("keydown",function(e){return _this.handleKeyDown(e)});_this.boundHandleBlur_=function(e){return _this.handleBlur(e)};_this.boundHandleTapClick_=function(e){return _this.handleTapClick(e)};return _this}var _proto=Menu.prototype;_proto.addEventListenerForItem=function addEventListenerForItem(component){if(!(component instanceof Component$1)){return}this.on(component,"blur",this.boundHandleBlur_);this.on(component,["tap","click"],this.boundHandleTapClick_);};_proto.removeEventListenerForItem=function removeEventListenerForItem(component){if(!(component instanceof Component$1)){return}this.off(component,"blur",this.boundHandleBlur_);this.off(component,["tap","click"],this.boundHandleTapClick_);};_proto.removeChild=function removeChild(component){if(typeof component==="string"){component=this.getChild(component);}this.removeEventListenerForItem(component);_Component.prototype.removeChild.call(this,component);};_proto.addItem=function addItem(component){var childComponent=this.addChild(component);if(childComponent){this.addEventListenerForItem(childComponent);}};_proto.createEl=function createEl$1(){var contentElType=this.options_.contentElType||"ul";this.contentEl_=createEl(contentElType,{className:"vjs-menu-content"});this.contentEl_.setAttribute("role","menu");var el=_Component.prototype.createEl.call(this,"div",{append:this.contentEl_,className:"vjs-menu"});el.appendChild(this.contentEl_);on(el,"click",function(event){event.preventDefault();event.stopImmediatePropagation();});return el};_proto.dispose=function dispose(){this.contentEl_=null;this.boundHandleBlur_=null;this.boundHandleTapClick_=null;_Component.prototype.dispose.call(this);};_proto.handleBlur=function handleBlur(event){var relatedTarget=event.relatedTarget||document_1.activeElement;if(!this.children().some(function(element){return element.el()===relatedTarget})){var btn=this.menuButton_;if(btn&&btn.buttonPressed_&&relatedTarget!==btn.el().firstChild){btn.unpressButton();}}};_proto.handleTapClick=function handleTapClick(event){if(this.menuButton_){this.menuButton_.unpressButton();var childComponents=this.children();if(!Array.isArray(childComponents)){return}var foundComponent=childComponents.filter(function(component){return component.el()===event.target})[0];if(!foundComponent){return}if(foundComponent.name()!=="CaptionSettingsMenuItem"){this.menuButton_.focus();}}};_proto.handleKeyDown=function handleKeyDown(event){if(keycode.isEventKey(event,"Left")||keycode.isEventKey(event,"Down")){event.preventDefault();event.stopPropagation();this.stepForward();}else if(keycode.isEventKey(event,"Right")||keycode.isEventKey(event,"Up")){event.preventDefault();event.stopPropagation();this.stepBack();}};_proto.stepForward=function stepForward(){var stepChild=0;if(this.focusedChild_!==undefined){stepChild=this.focusedChild_+1;}this.focus(stepChild);};_proto.stepBack=function stepBack(){var stepChild=0;if(this.focusedChild_!==undefined){stepChild=this.focusedChild_-1;}this.focus(stepChild);};_proto.focus=function focus(item){if(item===void 0){item=0;}var children=this.children().slice();var haveTitle=children.length&&children[0].hasClass("vjs-menu-title");if(haveTitle){children.shift();}if(children.length>0){if(item<0){item=0;}else if(item>=children.length){item=children.length-1;}this.focusedChild_=item;children[item].el_.focus();}};return Menu}(Component$1);Component$1.registerComponent("Menu",Menu);var MenuButton=function(_Component){_inheritsLoose(MenuButton,_Component);function MenuButton(player,options){var _this;if(options===void 0){options={};}_this=_Component.call(this,player,options)||this;_this.menuButton_=new Button(player,options);_this.menuButton_.controlText(_this.controlText_);_this.menuButton_.el_.setAttribute("aria-haspopup","true");var buttonClass=Button.prototype.buildCSSClass();_this.menuButton_.el_.className=_this.buildCSSClass()+" "+buttonClass;_this.menuButton_.removeClass("vjs-control");_this.addChild(_this.menuButton_);_this.update();_this.enabled_=true;var handleClick=function handleClick(e){return _this.handleClick(e)};_this.handleMenuKeyUp_=function(e){return _this.handleMenuKeyUp(e)};_this.on(_this.menuButton_,"tap",handleClick);_this.on(_this.menuButton_,"click",handleClick);_this.on(_this.menuButton_,"keydown",function(e){return _this.handleKeyDown(e)});_this.on(_this.menuButton_,"mouseenter",function(){_this.addClass("vjs-hover");_this.menu.show();on(document_1,"keyup",_this.handleMenuKeyUp_);});_this.on("mouseleave",function(e){return _this.handleMouseLeave(e)});_this.on("keydown",function(e){return _this.handleSubmenuKeyDown(e)});return _this}var _proto=MenuButton.prototype;_proto.update=function update(){var menu=this.createMenu();if(this.menu){this.menu.dispose();this.removeChild(this.menu);}this.menu=menu;this.addChild(menu);this.buttonPressed_=false;this.menuButton_.el_.setAttribute("aria-expanded","false");if(this.items&&this.items.length<=this.hideThreshold_){this.hide();this.menu.contentEl_.removeAttribute("role");}else {this.show();this.menu.contentEl_.setAttribute("role","menu");}};_proto.createMenu=function createMenu(){var menu=new Menu(this.player_,{menuButton:this});this.hideThreshold_=0;if(this.options_.title){var titleEl=createEl("li",{className:"vjs-menu-title",textContent:toTitleCase$1(this.options_.title),tabIndex:-1});var titleComponent=new Component$1(this.player_,{el:titleEl});menu.addItem(titleComponent);}this.items=this.createItems();if(this.items){for(var i=0;i<this.items.length;i++){menu.addItem(this.items[i]);}}return menu};_proto.createItems=function createItems(){};_proto.createEl=function createEl(){return _Component.prototype.createEl.call(this,"div",{className:this.buildWrapperCSSClass()},{})};_proto.buildWrapperCSSClass=function buildWrapperCSSClass(){var menuButtonClass="vjs-menu-button";if(this.options_.inline===true){menuButtonClass+="-inline";}else {menuButtonClass+="-popup";}var buttonClass=Button.prototype.buildCSSClass();return "vjs-menu-button "+menuButtonClass+" "+buttonClass+" "+_Component.prototype.buildCSSClass.call(this)};_proto.buildCSSClass=function buildCSSClass(){var menuButtonClass="vjs-menu-button";if(this.options_.inline===true){menuButtonClass+="-inline";}else {menuButtonClass+="-popup";}return "vjs-menu-button "+menuButtonClass+" "+_Component.prototype.buildCSSClass.call(this)};_proto.controlText=function controlText(text,el){if(el===void 0){el=this.menuButton_.el();}return this.menuButton_.controlText(text,el)};_proto.dispose=function dispose(){this.handleMouseLeave();_Component.prototype.dispose.call(this);};_proto.handleClick=function handleClick(event){if(this.buttonPressed_){this.unpressButton();}else {this.pressButton();}};_proto.handleMouseLeave=function handleMouseLeave(event){this.removeClass("vjs-hover");off(document_1,"keyup",this.handleMenuKeyUp_);};_proto.focus=function focus(){this.menuButton_.focus();};_proto.blur=function blur(){this.menuButton_.blur();};_proto.handleKeyDown=function handleKeyDown(event){if(keycode.isEventKey(event,"Esc")||keycode.isEventKey(event,"Tab")){if(this.buttonPressed_){this.unpressButton();}if(!keycode.isEventKey(event,"Tab")){event.preventDefault();this.menuButton_.focus();}}else if(keycode.isEventKey(event,"Up")||keycode.isEventKey(event,"Down")){if(!this.buttonPressed_){event.preventDefault();this.pressButton();}}};_proto.handleMenuKeyUp=function handleMenuKeyUp(event){if(keycode.isEventKey(event,"Esc")||keycode.isEventKey(event,"Tab")){this.removeClass("vjs-hover");}};_proto.handleSubmenuKeyPress=function handleSubmenuKeyPress(event){this.handleSubmenuKeyDown(event);};_proto.handleSubmenuKeyDown=function handleSubmenuKeyDown(event){if(keycode.isEventKey(event,"Esc")||keycode.isEventKey(event,"Tab")){if(this.buttonPressed_){this.unpressButton();}if(!keycode.isEventKey(event,"Tab")){event.preventDefault();this.menuButton_.focus();}}};_proto.pressButton=function pressButton(){if(this.enabled_){this.buttonPressed_=true;this.menu.show();this.menu.lockShowing();this.menuButton_.el_.setAttribute("aria-expanded","true");if(IS_IOS&&isInFrame()){return}this.menu.focus();}};_proto.unpressButton=function unpressButton(){if(this.enabled_){this.buttonPressed_=false;this.menu.unlockShowing();this.menu.hide();this.menuButton_.el_.setAttribute("aria-expanded","false");}};_proto.disable=function disable(){this.unpressButton();this.enabled_=false;this.addClass("vjs-disabled");this.menuButton_.disable();};_proto.enable=function enable(){this.enabled_=true;this.removeClass("vjs-disabled");this.menuButton_.enable();};return MenuButton}(Component$1);Component$1.registerComponent("MenuButton",MenuButton);var TrackButton=function(_MenuButton){_inheritsLoose(TrackButton,_MenuButton);function TrackButton(player,options){var _this;var tracks=options.tracks;_this=_MenuButton.call(this,player,options)||this;if(_this.items.length<=1){_this.hide();}if(!tracks){return _assertThisInitialized(_this)}var updateHandler=bind(_assertThisInitialized(_this),_this.update);tracks.addEventListener("removetrack",updateHandler);tracks.addEventListener("addtrack",updateHandler);tracks.addEventListener("labelchange",updateHandler);_this.player_.on("ready",updateHandler);_this.player_.on("dispose",function(){tracks.removeEventListener("removetrack",updateHandler);tracks.removeEventListener("addtrack",updateHandler);tracks.removeEventListener("labelchange",updateHandler);});return _this}return TrackButton}(MenuButton);Component$1.registerComponent("TrackButton",TrackButton);var MenuKeys=["Tab","Esc","Up","Down","Right","Left"];var MenuItem=function(_ClickableComponent){_inheritsLoose(MenuItem,_ClickableComponent);function MenuItem(player,options){var _this;_this=_ClickableComponent.call(this,player,options)||this;_this.selectable=options.selectable;_this.isSelected_=options.selected||false;_this.multiSelectable=options.multiSelectable;_this.selected(_this.isSelected_);if(_this.selectable){if(_this.multiSelectable){_this.el_.setAttribute("role","menuitemcheckbox");}else {_this.el_.setAttribute("role","menuitemradio");}}else {_this.el_.setAttribute("role","menuitem");}return _this}var _proto=MenuItem.prototype;_proto.createEl=function createEl$1(type,props,attrs){this.nonIconControl=true;var el=_ClickableComponent.prototype.createEl.call(this,"li",assign({className:"vjs-menu-item",tabIndex:-1},props),attrs);el.replaceChild(createEl("span",{className:"vjs-menu-item-text",textContent:this.localize(this.options_.label)}),el.querySelector(".vjs-icon-placeholder"));return el};_proto.handleKeyDown=function handleKeyDown(event){if(!MenuKeys.some(function(key){return keycode.isEventKey(event,key)})){_ClickableComponent.prototype.handleKeyDown.call(this,event);}};_proto.handleClick=function handleClick(event){this.selected(true);};_proto.selected=function selected(_selected){if(this.selectable){if(_selected){this.addClass("vjs-selected");this.el_.setAttribute("aria-checked","true");this.controlText(", selected");this.isSelected_=true;}else {this.removeClass("vjs-selected");this.el_.setAttribute("aria-checked","false");this.controlText("");this.isSelected_=false;}}};return MenuItem}(ClickableComponent);Component$1.registerComponent("MenuItem",MenuItem);var TextTrackMenuItem=function(_MenuItem){_inheritsLoose(TextTrackMenuItem,_MenuItem);function TextTrackMenuItem(player,options){var _this;var track=options.track;var tracks=player.textTracks();options.label=track.label||track.language||"Unknown";options.selected=track.mode==="showing";_this=_MenuItem.call(this,player,options)||this;_this.track=track;_this.kinds=(options.kinds||[options.kind||_this.track.kind]).filter(Boolean);var changeHandler=function changeHandler(){for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this.handleTracksChange.apply(_assertThisInitialized(_this),args);};var selectedLanguageChangeHandler=function selectedLanguageChangeHandler(){for(var _len2=arguments.length,args=new Array(_len2),_key2=0;_key2<_len2;_key2++){args[_key2]=arguments[_key2];}_this.handleSelectedLanguageChange.apply(_assertThisInitialized(_this),args);};player.on(["loadstart","texttrackchange"],changeHandler);tracks.addEventListener("change",changeHandler);tracks.addEventListener("selectedlanguagechange",selectedLanguageChangeHandler);_this.on("dispose",function(){player.off(["loadstart","texttrackchange"],changeHandler);tracks.removeEventListener("change",changeHandler);tracks.removeEventListener("selectedlanguagechange",selectedLanguageChangeHandler);});if(tracks.onchange===undefined){var event;_this.on(["tap","click"],function(){if(typeof window_1.Event!=="object"){try{event=new window_1.Event("change");}catch(err){}}if(!event){event=document_1.createEvent("Event");event.initEvent("change",true,true);}tracks.dispatchEvent(event);});}_this.handleTracksChange();return _this}var _proto=TextTrackMenuItem.prototype;_proto.handleClick=function handleClick(event){var referenceTrack=this.track;var tracks=this.player_.textTracks();_MenuItem.prototype.handleClick.call(this,event);if(!tracks){return}for(var i=0;i<tracks.length;i++){var track=tracks[i];if(this.kinds.indexOf(track.kind)===-1){continue}if(track===referenceTrack){if(track.mode!=="showing"){track.mode="showing";}}else if(track.mode!=="disabled"){track.mode="disabled";}}};_proto.handleTracksChange=function handleTracksChange(event){var shouldBeSelected=this.track.mode==="showing";if(shouldBeSelected!==this.isSelected_){this.selected(shouldBeSelected);}};_proto.handleSelectedLanguageChange=function handleSelectedLanguageChange(event){if(this.track.mode==="showing"){var selectedLanguage=this.player_.cache_.selectedLanguage;if(selectedLanguage&&selectedLanguage.enabled&&selectedLanguage.language===this.track.language&&selectedLanguage.kind!==this.track.kind){return}this.player_.cache_.selectedLanguage={enabled:true,language:this.track.language,kind:this.track.kind};}};_proto.dispose=function dispose(){this.track=null;_MenuItem.prototype.dispose.call(this);};return TextTrackMenuItem}(MenuItem);Component$1.registerComponent("TextTrackMenuItem",TextTrackMenuItem);var OffTextTrackMenuItem=function(_TextTrackMenuItem){_inheritsLoose(OffTextTrackMenuItem,_TextTrackMenuItem);function OffTextTrackMenuItem(player,options){options.track={player:player,kind:options.kind,kinds:options.kinds,"default":false,mode:"disabled"};if(!options.kinds){options.kinds=[options.kind];}if(options.label){options.track.label=options.label;}else {options.track.label=options.kinds.join(" and ")+" off";}options.selectable=true;options.multiSelectable=false;return _TextTrackMenuItem.call(this,player,options)||this}var _proto=OffTextTrackMenuItem.prototype;_proto.handleTracksChange=function handleTracksChange(event){var tracks=this.player().textTracks();var shouldBeSelected=true;for(var i=0,l=tracks.length;i<l;i++){var track=tracks[i];if(this.options_.kinds.indexOf(track.kind)>-1&&track.mode==="showing"){shouldBeSelected=false;break}}if(shouldBeSelected!==this.isSelected_){this.selected(shouldBeSelected);}};_proto.handleSelectedLanguageChange=function handleSelectedLanguageChange(event){var tracks=this.player().textTracks();var allHidden=true;for(var i=0,l=tracks.length;i<l;i++){var track=tracks[i];if(["captions","descriptions","subtitles"].indexOf(track.kind)>-1&&track.mode==="showing"){allHidden=false;break}}if(allHidden){this.player_.cache_.selectedLanguage={enabled:false};}};return OffTextTrackMenuItem}(TextTrackMenuItem);Component$1.registerComponent("OffTextTrackMenuItem",OffTextTrackMenuItem);var TextTrackButton=function(_TrackButton){_inheritsLoose(TextTrackButton,_TrackButton);function TextTrackButton(player,options){if(options===void 0){options={};}options.tracks=player.textTracks();return _TrackButton.call(this,player,options)||this}var _proto=TextTrackButton.prototype;_proto.createItems=function createItems(items,TrackMenuItem){if(items===void 0){items=[];}if(TrackMenuItem===void 0){TrackMenuItem=TextTrackMenuItem;}var label;if(this.label_){label=this.label_+" off";}items.push(new OffTextTrackMenuItem(this.player_,{kinds:this.kinds_,kind:this.kind_,label:label}));this.hideThreshold_+=1;var tracks=this.player_.textTracks();if(!Array.isArray(this.kinds_)){this.kinds_=[this.kind_];}for(var i=0;i<tracks.length;i++){var track=tracks[i];if(this.kinds_.indexOf(track.kind)>-1){var item=new TrackMenuItem(this.player_,{track:track,kinds:this.kinds_,kind:this.kind_,selectable:true,multiSelectable:false});item.addClass("vjs-"+track.kind+"-menu-item");items.push(item);}}return items};return TextTrackButton}(TrackButton);Component$1.registerComponent("TextTrackButton",TextTrackButton);var ChaptersTrackMenuItem=function(_MenuItem){_inheritsLoose(ChaptersTrackMenuItem,_MenuItem);function ChaptersTrackMenuItem(player,options){var _this;var track=options.track;var cue=options.cue;var currentTime=player.currentTime();options.selectable=true;options.multiSelectable=false;options.label=cue.text;options.selected=cue.startTime<=currentTime&¤tTime<cue.endTime;_this=_MenuItem.call(this,player,options)||this;_this.track=track;_this.cue=cue;return _this}var _proto=ChaptersTrackMenuItem.prototype;_proto.handleClick=function handleClick(event){_MenuItem.prototype.handleClick.call(this);this.player_.currentTime(this.cue.startTime);};return ChaptersTrackMenuItem}(MenuItem);Component$1.registerComponent("ChaptersTrackMenuItem",ChaptersTrackMenuItem);var ChaptersButton=function(_TextTrackButton){_inheritsLoose(ChaptersButton,_TextTrackButton);function ChaptersButton(player,options,ready){var _this;_this=_TextTrackButton.call(this,player,options,ready)||this;_this.selectCurrentItem_=function(){_this.items.forEach(function(item){item.selected(_this.track_.activeCues[0]===item.cue);});};return _this}var _proto=ChaptersButton.prototype;_proto.buildCSSClass=function buildCSSClass(){return "vjs-chapters-button "+_TextTrackButton.prototype.buildCSSClass.call(this)};_proto.buildWrapperCSSClass=function buildWrapperCSSClass(){return "vjs-chapters-button "+_TextTrackButton.prototype.buildWrapperCSSClass.call(this)};_proto.update=function update(event){if(event&&event.track&&event.track.kind!=="chapters"){return}var track=this.findChaptersTrack();if(track!==this.track_){this.setTrack(track);_TextTrackButton.prototype.update.call(this);}else if(!this.items||track&&track.cues&&track.cues.length!==this.items.length){_TextTrackButton.prototype.update.call(this);}};_proto.setTrack=function setTrack(track){if(this.track_===track){return}if(!this.updateHandler_){this.updateHandler_=this.update.bind(this);}if(this.track_){var remoteTextTrackEl=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);if(remoteTextTrackEl){remoteTextTrackEl.removeEventListener("load",this.updateHandler_);}this.track_.removeEventListener("cuechange",this.selectCurrentItem_);this.track_=null;}this.track_=track;if(this.track_){this.track_.mode="hidden";var _remoteTextTrackEl=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);if(_remoteTextTrackEl){_remoteTextTrackEl.addEventListener("load",this.updateHandler_);}this.track_.addEventListener("cuechange",this.selectCurrentItem_);}};_proto.findChaptersTrack=function findChaptersTrack(){var tracks=this.player_.textTracks()||[];for(var i=tracks.length-1;i>=0;i--){var track=tracks[i];if(track.kind===this.kind_){return track}}};_proto.getMenuCaption=function getMenuCaption(){if(this.track_&&this.track_.label){return this.track_.label}return this.localize(toTitleCase$1(this.kind_))};_proto.createMenu=function createMenu(){this.options_.title=this.getMenuCaption();return _TextTrackButton.prototype.createMenu.call(this)};_proto.createItems=function createItems(){var items=[];if(!this.track_){return items}var cues=this.track_.cues;if(!cues){return items}for(var i=0,l=cues.length;i<l;i++){var cue=cues[i];var mi=new ChaptersTrackMenuItem(this.player_,{track:this.track_,cue:cue});items.push(mi);}return items};return ChaptersButton}(TextTrackButton);ChaptersButton.prototype.kind_="chapters";ChaptersButton.prototype.controlText_="Chapters";Component$1.registerComponent("ChaptersButton",ChaptersButton);var DescriptionsButton=function(_TextTrackButton){_inheritsLoose(DescriptionsButton,_TextTrackButton);function DescriptionsButton(player,options,ready){var _this;_this=_TextTrackButton.call(this,player,options,ready)||this;var tracks=player.textTracks();var changeHandler=bind(_assertThisInitialized(_this),_this.handleTracksChange);tracks.addEventListener("change",changeHandler);_this.on("dispose",function(){tracks.removeEventListener("change",changeHandler);});return _this}var _proto=DescriptionsButton.prototype;_proto.handleTracksChange=function handleTracksChange(event){var tracks=this.player().textTracks();var disabled=false;for(var i=0,l=tracks.length;i<l;i++){var track=tracks[i];if(track.kind!==this.kind_&&track.mode==="showing"){disabled=true;break}}if(disabled){this.disable();}else {this.enable();}};_proto.buildCSSClass=function buildCSSClass(){return "vjs-descriptions-button "+_TextTrackButton.prototype.buildCSSClass.call(this)};_proto.buildWrapperCSSClass=function buildWrapperCSSClass(){return "vjs-descriptions-button "+_TextTrackButton.prototype.buildWrapperCSSClass.call(this)};return DescriptionsButton}(TextTrackButton);DescriptionsButton.prototype.kind_="descriptions";DescriptionsButton.prototype.controlText_="Descriptions";Component$1.registerComponent("DescriptionsButton",DescriptionsButton);var SubtitlesButton=function(_TextTrackButton){_inheritsLoose(SubtitlesButton,_TextTrackButton);function SubtitlesButton(player,options,ready){return _TextTrackButton.call(this,player,options,ready)||this}var _proto=SubtitlesButton.prototype;_proto.buildCSSClass=function buildCSSClass(){return "vjs-subtitles-button "+_TextTrackButton.prototype.buildCSSClass.call(this)};_proto.buildWrapperCSSClass=function buildWrapperCSSClass(){return "vjs-subtitles-button "+_TextTrackButton.prototype.buildWrapperCSSClass.call(this)};return SubtitlesButton}(TextTrackButton);SubtitlesButton.prototype.kind_="subtitles";SubtitlesButton.prototype.controlText_="Subtitles";Component$1.registerComponent("SubtitlesButton",SubtitlesButton);var CaptionSettingsMenuItem=function(_TextTrackMenuItem){_inheritsLoose(CaptionSettingsMenuItem,_TextTrackMenuItem);function CaptionSettingsMenuItem(player,options){var _this;options.track={player:player,kind:options.kind,label:options.kind+" settings",selectable:false,"default":false,mode:"disabled"};options.selectable=false;options.name="CaptionSettingsMenuItem";_this=_TextTrackMenuItem.call(this,player,options)||this;_this.addClass("vjs-texttrack-settings");_this.controlText(", opens "+options.kind+" settings dialog");return _this}var _proto=CaptionSettingsMenuItem.prototype;_proto.handleClick=function handleClick(event){this.player().getChild("textTrackSettings").open();};return CaptionSettingsMenuItem}(TextTrackMenuItem);Component$1.registerComponent("CaptionSettingsMenuItem",CaptionSettingsMenuItem);var CaptionsButton=function(_TextTrackButton){_inheritsLoose(CaptionsButton,_TextTrackButton);function CaptionsButton(player,options,ready){return _TextTrackButton.call(this,player,options,ready)||this}var _proto=CaptionsButton.prototype;_proto.buildCSSClass=function buildCSSClass(){return "vjs-captions-button "+_TextTrackButton.prototype.buildCSSClass.call(this)};_proto.buildWrapperCSSClass=function buildWrapperCSSClass(){return "vjs-captions-button "+_TextTrackButton.prototype.buildWrapperCSSClass.call(this)};_proto.createItems=function createItems(){var items=[];if(!(this.player().tech_&&this.player().tech_.featuresNativeTextTracks)&&this.player().getChild("textTrackSettings")){items.push(new CaptionSettingsMenuItem(this.player_,{kind:this.kind_}));this.hideThreshold_+=1;}return _TextTrackButton.prototype.createItems.call(this,items)};return CaptionsButton}(TextTrackButton);CaptionsButton.prototype.kind_="captions";CaptionsButton.prototype.controlText_="Captions";Component$1.registerComponent("CaptionsButton",CaptionsButton);var SubsCapsMenuItem=function(_TextTrackMenuItem){_inheritsLoose(SubsCapsMenuItem,_TextTrackMenuItem);function SubsCapsMenuItem(){return _TextTrackMenuItem.apply(this,arguments)||this}var _proto=SubsCapsMenuItem.prototype;_proto.createEl=function createEl$1(type,props,attrs){var el=_TextTrackMenuItem.prototype.createEl.call(this,type,props,attrs);var parentSpan=el.querySelector(".vjs-menu-item-text");if(this.options_.track.kind==="captions"){parentSpan.appendChild(createEl("span",{className:"vjs-icon-placeholder"},{"aria-hidden":true}));parentSpan.appendChild(createEl("span",{className:"vjs-control-text",textContent:" "+this.localize("Captions")}));}return el};return SubsCapsMenuItem}(TextTrackMenuItem);Component$1.registerComponent("SubsCapsMenuItem",SubsCapsMenuItem);var SubsCapsButton=function(_TextTrackButton){_inheritsLoose(SubsCapsButton,_TextTrackButton);function SubsCapsButton(player,options){var _this;if(options===void 0){options={};}_this=_TextTrackButton.call(this,player,options)||this;_this.label_="subtitles";if(["en","en-us","en-ca","fr-ca"].indexOf(_this.player_.language_)>-1){_this.label_="captions";}_this.menuButton_.controlText(toTitleCase$1(_this.label_));return _this}var _proto=SubsCapsButton.prototype;_proto.buildCSSClass=function buildCSSClass(){return "vjs-subs-caps-button "+_TextTrackButton.prototype.buildCSSClass.call(this)};_proto.buildWrapperCSSClass=function buildWrapperCSSClass(){return "vjs-subs-caps-button "+_TextTrackButton.prototype.buildWrapperCSSClass.call(this)};_proto.createItems=function createItems(){var items=[];if(!(this.player().tech_&&this.player().tech_.featuresNativeTextTracks)&&this.player().getChild("textTrackSettings")){items.push(new CaptionSettingsMenuItem(this.player_,{kind:this.label_}));this.hideThreshold_+=1;}items=_TextTrackButton.prototype.createItems.call(this,items,SubsCapsMenuItem);return items};return SubsCapsButton}(TextTrackButton);SubsCapsButton.prototype.kinds_=["captions","subtitles"];SubsCapsButton.prototype.controlText_="Subtitles";Component$1.registerComponent("SubsCapsButton",SubsCapsButton);var AudioTrackMenuItem=function(_MenuItem){_inheritsLoose(AudioTrackMenuItem,_MenuItem);function AudioTrackMenuItem(player,options){var _this;var track=options.track;var tracks=player.audioTracks();options.label=track.label||track.language||"Unknown";options.selected=track.enabled;_this=_MenuItem.call(this,player,options)||this;_this.track=track;_this.addClass("vjs-"+track.kind+"-menu-item");var changeHandler=function changeHandler(){for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this.handleTracksChange.apply(_assertThisInitialized(_this),args);};tracks.addEventListener("change",changeHandler);_this.on("dispose",function(){tracks.removeEventListener("change",changeHandler);});return _this}var _proto=AudioTrackMenuItem.prototype;_proto.createEl=function createEl$1(type,props,attrs){var el=_MenuItem.prototype.createEl.call(this,type,props,attrs);var parentSpan=el.querySelector(".vjs-menu-item-text");if(this.options_.track.kind==="main-desc"){parentSpan.appendChild(createEl("span",{className:"vjs-icon-placeholder"},{"aria-hidden":true}));parentSpan.appendChild(createEl("span",{className:"vjs-control-text",textContent:" "+this.localize("Descriptions")}));}return el};_proto.handleClick=function handleClick(event){_MenuItem.prototype.handleClick.call(this,event);this.track.enabled=true;if(this.player_.tech_.featuresNativeAudioTracks){var tracks=this.player_.audioTracks();for(var i=0;i<tracks.length;i++){var track=tracks[i];if(track===this.track){continue}track.enabled=track===this.track;}}};_proto.handleTracksChange=function handleTracksChange(event){this.selected(this.track.enabled);};return AudioTrackMenuItem}(MenuItem);Component$1.registerComponent("AudioTrackMenuItem",AudioTrackMenuItem);var AudioTrackButton=function(_TrackButton){_inheritsLoose(AudioTrackButton,_TrackButton);function AudioTrackButton(player,options){if(options===void 0){options={};}options.tracks=player.audioTracks();return _TrackButton.call(this,player,options)||this}var _proto=AudioTrackButton.prototype;_proto.buildCSSClass=function buildCSSClass(){return "vjs-audio-button "+_TrackButton.prototype.buildCSSClass.call(this)};_proto.buildWrapperCSSClass=function buildWrapperCSSClass(){return "vjs-audio-button "+_TrackButton.prototype.buildWrapperCSSClass.call(this)};_proto.createItems=function createItems(items){if(items===void 0){items=[];}this.hideThreshold_=1;var tracks=this.player_.audioTracks();for(var i=0;i<tracks.length;i++){var track=tracks[i];items.push(new AudioTrackMenuItem(this.player_,{track:track,selectable:true,multiSelectable:false}));}return items};return AudioTrackButton}(TrackButton);AudioTrackButton.prototype.controlText_="Audio Track";Component$1.registerComponent("AudioTrackButton",AudioTrackButton);var PlaybackRateMenuItem=function(_MenuItem){_inheritsLoose(PlaybackRateMenuItem,_MenuItem);function PlaybackRateMenuItem(player,options){var _this;var label=options.rate;var rate=parseFloat(label,10);options.label=label;options.selected=rate===player.playbackRate();options.selectable=true;options.multiSelectable=false;_this=_MenuItem.call(this,player,options)||this;_this.label=label;_this.rate=rate;_this.on(player,"ratechange",function(e){return _this.update(e)});return _this}var _proto=PlaybackRateMenuItem.prototype;_proto.handleClick=function handleClick(event){_MenuItem.prototype.handleClick.call(this);this.player().playbackRate(this.rate);};_proto.update=function update(event){this.selected(this.player().playbackRate()===this.rate);};return PlaybackRateMenuItem}(MenuItem);PlaybackRateMenuItem.prototype.contentElType="button";Component$1.registerComponent("PlaybackRateMenuItem",PlaybackRateMenuItem);var PlaybackRateMenuButton=function(_MenuButton){_inheritsLoose(PlaybackRateMenuButton,_MenuButton);function PlaybackRateMenuButton(player,options){var _this;_this=_MenuButton.call(this,player,options)||this;_this.menuButton_.el_.setAttribute("aria-describedby",_this.labelElId_);_this.updateVisibility();_this.updateLabel();_this.on(player,"loadstart",function(e){return _this.updateVisibility(e)});_this.on(player,"ratechange",function(e){return _this.updateLabel(e)});_this.on(player,"playbackrateschange",function(e){return _this.handlePlaybackRateschange(e)});return _this}var _proto=PlaybackRateMenuButton.prototype;_proto.createEl=function createEl$1(){var el=_MenuButton.prototype.createEl.call(this);this.labelElId_="vjs-playback-rate-value-label-"+this.id_;this.labelEl_=createEl("div",{className:"vjs-playback-rate-value",id:this.labelElId_,textContent:"1x"});el.appendChild(this.labelEl_);return el};_proto.dispose=function dispose(){this.labelEl_=null;_MenuButton.prototype.dispose.call(this);};_proto.buildCSSClass=function buildCSSClass(){return "vjs-playback-rate "+_MenuButton.prototype.buildCSSClass.call(this)};_proto.buildWrapperCSSClass=function buildWrapperCSSClass(){return "vjs-playback-rate "+_MenuButton.prototype.buildWrapperCSSClass.call(this)};_proto.createItems=function createItems(){var rates=this.playbackRates();var items=[];for(var i=rates.length-1;i>=0;i--){items.push(new PlaybackRateMenuItem(this.player(),{rate:rates[i]+"x"}));}return items};_proto.updateARIAAttributes=function updateARIAAttributes(){this.el().setAttribute("aria-valuenow",this.player().playbackRate());};_proto.handleClick=function handleClick(event){var currentRate=this.player().playbackRate();var rates=this.playbackRates();var currentIndex=rates.indexOf(currentRate);var newIndex=(currentIndex+1)%rates.length;this.player().playbackRate(rates[newIndex]);};_proto.handlePlaybackRateschange=function handlePlaybackRateschange(event){this.update();};_proto.playbackRates=function playbackRates(){var player=this.player();return player.playbackRates&&player.playbackRates()||[]};_proto.playbackRateSupported=function playbackRateSupported(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&this.playbackRates().length>0};_proto.updateVisibility=function updateVisibility(event){if(this.playbackRateSupported()){this.removeClass("vjs-hidden");}else {this.addClass("vjs-hidden");}};_proto.updateLabel=function updateLabel(event){if(this.playbackRateSupported()){this.labelEl_.textContent=this.player().playbackRate()+"x";}};return PlaybackRateMenuButton}(MenuButton);PlaybackRateMenuButton.prototype.controlText_="Playback Rate";Component$1.registerComponent("PlaybackRateMenuButton",PlaybackRateMenuButton);var Spacer=function(_Component){_inheritsLoose(Spacer,_Component);function Spacer(){return _Component.apply(this,arguments)||this}var _proto=Spacer.prototype;_proto.buildCSSClass=function buildCSSClass(){return "vjs-spacer "+_Component.prototype.buildCSSClass.call(this)};_proto.createEl=function createEl(tag,props,attributes){if(tag===void 0){tag="div";}if(props===void 0){props={};}if(attributes===void 0){attributes={};}if(!props.className){props.className=this.buildCSSClass();}return _Component.prototype.createEl.call(this,tag,props,attributes)};return Spacer}(Component$1);Component$1.registerComponent("Spacer",Spacer);var CustomControlSpacer=function(_Spacer){_inheritsLoose(CustomControlSpacer,_Spacer);function CustomControlSpacer(){return _Spacer.apply(this,arguments)||this}var _proto=CustomControlSpacer.prototype;_proto.buildCSSClass=function buildCSSClass(){return "vjs-custom-control-spacer "+_Spacer.prototype.buildCSSClass.call(this)};_proto.createEl=function createEl(){return _Spacer.prototype.createEl.call(this,"div",{className:this.buildCSSClass(),textContent:"\xa0"})};return CustomControlSpacer}(Spacer);Component$1.registerComponent("CustomControlSpacer",CustomControlSpacer);var ControlBar=function(_Component){_inheritsLoose(ControlBar,_Component);function ControlBar(){return _Component.apply(this,arguments)||this}var _proto=ControlBar.prototype;_proto.createEl=function createEl(){return _Component.prototype.createEl.call(this,"div",{className:"vjs-control-bar",dir:"ltr"})};return ControlBar}(Component$1);ControlBar.prototype.options_={children:["playToggle","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","fullscreenToggle"]};if("exitPictureInPicture"in document_1){ControlBar.prototype.options_.children.splice(ControlBar.prototype.options_.children.length-1,0,"pictureInPictureToggle");}Component$1.registerComponent("ControlBar",ControlBar);var ErrorDisplay=function(_ModalDialog){_inheritsLoose(ErrorDisplay,_ModalDialog);function ErrorDisplay(player,options){var _this;_this=_ModalDialog.call(this,player,options)||this;_this.on(player,"error",function(e){return _this.open(e)});return _this}var _proto=ErrorDisplay.prototype;_proto.buildCSSClass=function buildCSSClass(){return "vjs-error-display "+_ModalDialog.prototype.buildCSSClass.call(this)};_proto.content=function content(){var error=this.player().error();return error?this.localize(error.message):""};return ErrorDisplay}(ModalDialog);ErrorDisplay.prototype.options_=_extends$3({},ModalDialog.prototype.options_,{pauseOnOpen:false,fillAlways:true,temporary:false,uncloseable:true});Component$1.registerComponent("ErrorDisplay",ErrorDisplay);var LOCAL_STORAGE_KEY$1="vjs-text-track-settings";var COLOR_BLACK=["#000","Black"];var COLOR_BLUE=["#00F","Blue"];var COLOR_CYAN=["#0FF","Cyan"];var COLOR_GREEN=["#0F0","Green"];var COLOR_MAGENTA=["#F0F","Magenta"];var COLOR_RED=["#F00","Red"];var COLOR_WHITE=["#FFF","White"];var COLOR_YELLOW=["#FF0","Yellow"];var OPACITY_OPAQUE=["1","Opaque"];var OPACITY_SEMI=["0.5","Semi-Transparent"];var OPACITY_TRANS=["0","Transparent"];var selectConfigs={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[COLOR_BLACK,COLOR_WHITE,COLOR_RED,COLOR_GREEN,COLOR_BLUE,COLOR_YELLOW,COLOR_MAGENTA,COLOR_CYAN]},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Transparency",options:[OPACITY_OPAQUE,OPACITY_SEMI,OPACITY_TRANS]},color:{selector:".vjs-fg-color > select",id:"captions-foreground-color-%s",label:"Color",options:[COLOR_WHITE,COLOR_BLACK,COLOR_RED,COLOR_GREEN,COLOR_BLUE,COLOR_YELLOW,COLOR_MAGENTA,COLOR_CYAN]},edgeStyle:{selector:".vjs-edge-style > select",id:"%s",label:"Text Edge Style",options:[["none","None"],["raised","Raised"],["depressed","Depressed"],["uniform","Uniform"],["dropshadow","Dropshadow"]]},fontFamily:{selector:".vjs-font-family > select",id:"captions-font-family-%s",label:"Font Family",options:[["proportionalSansSerif","Proportional Sans-Serif"],["monospaceSansSerif","Monospace Sans-Serif"],["proportionalSerif","Proportional Serif"],["monospaceSerif","Monospace Serif"],["casual","Casual"],["script","Script"],["small-caps","Small Caps"]]},fontPercent:{selector:".vjs-font-percent > select",id:"captions-font-size-%s",label:"Font Size",options:[["0.50","50%"],["0.75","75%"],["1.00","100%"],["1.25","125%"],["1.50","150%"],["1.75","175%"],["2.00","200%"],["3.00","300%"],["4.00","400%"]],"default":2,parser:function parser(v){return v==="1.00"?null:Number(v)}},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Transparency",options:[OPACITY_OPAQUE,OPACITY_SEMI]},windowColor:{selector:".vjs-window-color > select",id:"captions-window-color-%s",label:"Color"},windowOpacity:{selector:".vjs-window-opacity > select",id:"captions-window-opacity-%s",label:"Transparency",options:[OPACITY_TRANS,OPACITY_SEMI,OPACITY_OPAQUE]}};selectConfigs.windowColor.options=selectConfigs.backgroundColor.options;function parseOptionValue(value,parser){if(parser){value=parser(value);}if(value&&value!=="none"){return value}}function getSelectedOptionValue(el,parser){var value=el.options[el.options.selectedIndex].value;return parseOptionValue(value,parser)}function setSelectedOption(el,value,parser){if(!value){return}for(var i=0;i<el.options.length;i++){if(parseOptionValue(el.options[i].value,parser)===value){el.selectedIndex=i;break}}}var TextTrackSettings=function(_ModalDialog){_inheritsLoose(TextTrackSettings,_ModalDialog);function TextTrackSettings(player,options){var _this;options.temporary=false;_this=_ModalDialog.call(this,player,options)||this;_this.updateDisplay=_this.updateDisplay.bind(_assertThisInitialized(_this));_this.fill();_this.hasBeenOpened_=_this.hasBeenFilled_=true;_this.endDialog=createEl("p",{className:"vjs-control-text",textContent:_this.localize("End of dialog window.")});_this.el().appendChild(_this.endDialog);_this.setDefaults();if(options.persistTextTrackSettings===undefined){_this.options_.persistTextTrackSettings=_this.options_.playerOptions.persistTextTrackSettings;}_this.on(_this.$(".vjs-done-button"),"click",function(){_this.saveSettings();_this.close();});_this.on(_this.$(".vjs-default-button"),"click",function(){_this.setDefaults();_this.updateDisplay();});each(selectConfigs,function(config){_this.on(_this.$(config.selector),"change",_this.updateDisplay);});if(_this.options_.persistTextTrackSettings){_this.restoreSettings();}return _this}var _proto=TextTrackSettings.prototype;_proto.dispose=function dispose(){this.endDialog=null;_ModalDialog.prototype.dispose.call(this);};_proto.createElSelect_=function createElSelect_(key,legendId,type){var _this2=this;if(legendId===void 0){legendId="";}if(type===void 0){type="label";}var config=selectConfigs[key];var id=config.id.replace("%s",this.id_);var selectLabelledbyIds=[legendId,id].join(" ").trim();return ["<"+type+' id="'+id+'" class="'+(type==="label"?"vjs-label":"")+'">',this.localize(config.label),"</"+type+">",'<select aria-labelledby="'+selectLabelledbyIds+'">'].concat(config.options.map(function(o){var optionId=id+"-"+o[1].replace(/\W+/g,"");return ['<option id="'+optionId+'" value="'+o[0]+'" ','aria-labelledby="'+selectLabelledbyIds+" "+optionId+'">',_this2.localize(o[1]),"</option>"].join("")})).concat("</select>").join("")};_proto.createElFgColor_=function createElFgColor_(){var legendId="captions-text-legend-"+this.id_;return ['<fieldset class="vjs-fg-color vjs-track-setting">','<legend id="'+legendId+'">',this.localize("Text"),"</legend>",this.createElSelect_("color",legendId),'<span class="vjs-text-opacity vjs-opacity">',this.createElSelect_("textOpacity",legendId),"</span>","</fieldset>"].join("")};_proto.createElBgColor_=function createElBgColor_(){var legendId="captions-background-"+this.id_;return ['<fieldset class="vjs-bg-color vjs-track-setting">','<legend id="'+legendId+'">',this.localize("Background"),"</legend>",this.createElSelect_("backgroundColor",legendId),'<span class="vjs-bg-opacity vjs-opacity">',this.createElSelect_("backgroundOpacity",legendId),"</span>","</fieldset>"].join("")};_proto.createElWinColor_=function createElWinColor_(){var legendId="captions-window-"+this.id_;return ['<fieldset class="vjs-window-color vjs-track-setting">','<legend id="'+legendId+'">',this.localize("Window"),"</legend>",this.createElSelect_("windowColor",legendId),'<span class="vjs-window-opacity vjs-opacity">',this.createElSelect_("windowOpacity",legendId),"</span>","</fieldset>"].join("")};_proto.createElColors_=function createElColors_(){return createEl("div",{className:"vjs-track-settings-colors",innerHTML:[this.createElFgColor_(),this.createElBgColor_(),this.createElWinColor_()].join("")})};_proto.createElFont_=function createElFont_(){return createEl("div",{className:"vjs-track-settings-font",innerHTML:['<fieldset class="vjs-font-percent vjs-track-setting">',this.createElSelect_("fontPercent","","legend"),"</fieldset>",'<fieldset class="vjs-edge-style vjs-track-setting">',this.createElSelect_("edgeStyle","","legend"),"</fieldset>",'<fieldset class="vjs-font-family vjs-track-setting">',this.createElSelect_("fontFamily","","legend"),"</fieldset>"].join("")})};_proto.createElControls_=function createElControls_(){var defaultsDescription=this.localize("restore all settings to the default values");return createEl("div",{className:"vjs-track-settings-controls",innerHTML:['<button type="button" class="vjs-default-button" title="'+defaultsDescription+'">',this.localize("Reset"),'<span class="vjs-control-text"> '+defaultsDescription+"</span>","</button>",'<button type="button" class="vjs-done-button">'+this.localize("Done")+"</button>"].join("")})};_proto.content=function content(){return [this.createElColors_(),this.createElFont_(),this.createElControls_()]};_proto.label=function label(){return this.localize("Caption Settings Dialog")};_proto.description=function description(){return this.localize("Beginning of dialog window. Escape will cancel and close the window.")};_proto.buildCSSClass=function buildCSSClass(){return _ModalDialog.prototype.buildCSSClass.call(this)+" vjs-text-track-settings"};_proto.getValues=function getValues(){var _this3=this;return reduce(selectConfigs,function(accum,config,key){var value=getSelectedOptionValue(_this3.$(config.selector),config.parser);if(value!==undefined){accum[key]=value;}return accum},{})};_proto.setValues=function setValues(values){var _this4=this;each(selectConfigs,function(config,key){setSelectedOption(_this4.$(config.selector),values[key],config.parser);});};_proto.setDefaults=function setDefaults(){var _this5=this;each(selectConfigs,function(config){var index=config.hasOwnProperty("default")?config["default"]:0;_this5.$(config.selector).selectedIndex=index;});};_proto.restoreSettings=function restoreSettings(){var values;try{values=JSON.parse(window_1.localStorage.getItem(LOCAL_STORAGE_KEY$1));}catch(err){log$1.warn(err);}if(values){this.setValues(values);}};_proto.saveSettings=function saveSettings(){if(!this.options_.persistTextTrackSettings){return}var values=this.getValues();try{if(Object.keys(values).length){window_1.localStorage.setItem(LOCAL_STORAGE_KEY$1,JSON.stringify(values));}else {window_1.localStorage.removeItem(LOCAL_STORAGE_KEY$1);}}catch(err){log$1.warn(err);}};_proto.updateDisplay=function updateDisplay(){var ttDisplay=this.player_.getChild("textTrackDisplay");if(ttDisplay){ttDisplay.updateDisplay();}};_proto.conditionalBlur_=function conditionalBlur_(){this.previouslyActiveEl_=null;var cb=this.player_.controlBar;var subsCapsBtn=cb&&cb.subsCapsButton;var ccBtn=cb&&cb.captionsButton;if(subsCapsBtn){subsCapsBtn.focus();}else if(ccBtn){ccBtn.focus();}};return TextTrackSettings}(ModalDialog);Component$1.registerComponent("TextTrackSettings",TextTrackSettings);var ResizeManager=function(_Component){_inheritsLoose(ResizeManager,_Component);function ResizeManager(player,options){var _this;var RESIZE_OBSERVER_AVAILABLE=options.ResizeObserver||window_1.ResizeObserver;if(options.ResizeObserver===null){RESIZE_OBSERVER_AVAILABLE=false;}var options_=mergeOptions$3({createEl:!RESIZE_OBSERVER_AVAILABLE,reportTouchActivity:false},options);_this=_Component.call(this,player,options_)||this;_this.ResizeObserver=options.ResizeObserver||window_1.ResizeObserver;_this.loadListener_=null;_this.resizeObserver_=null;_this.debouncedHandler_=debounce(function(){_this.resizeHandler();},100,false,_assertThisInitialized(_this));if(RESIZE_OBSERVER_AVAILABLE){_this.resizeObserver_=new _this.ResizeObserver(_this.debouncedHandler_);_this.resizeObserver_.observe(player.el());}else {_this.loadListener_=function(){if(!_this.el_||!_this.el_.contentWindow){return}var debouncedHandler_=_this.debouncedHandler_;var unloadListener_=_this.unloadListener_=function(){off(this,"resize",debouncedHandler_);off(this,"unload",unloadListener_);unloadListener_=null;};on(_this.el_.contentWindow,"unload",unloadListener_);on(_this.el_.contentWindow,"resize",debouncedHandler_);};_this.one("load",_this.loadListener_);}return _this}var _proto=ResizeManager.prototype;_proto.createEl=function createEl(){return _Component.prototype.createEl.call(this,"iframe",{className:"vjs-resize-manager",tabIndex:-1,title:this.localize("No content")},{"aria-hidden":"true"})};_proto.resizeHandler=function resizeHandler(){if(!this.player_||!this.player_.trigger){return}this.player_.trigger("playerresize");};_proto.dispose=function dispose(){if(this.debouncedHandler_){this.debouncedHandler_.cancel();}if(this.resizeObserver_){if(this.player_.el()){this.resizeObserver_.unobserve(this.player_.el());}this.resizeObserver_.disconnect();}if(this.loadListener_){this.off("load",this.loadListener_);}if(this.el_&&this.el_.contentWindow&&this.unloadListener_){this.unloadListener_.call(this.el_.contentWindow);}this.ResizeObserver=null;this.resizeObserver=null;this.debouncedHandler_=null;this.loadListener_=null;_Component.prototype.dispose.call(this);};return ResizeManager}(Component$1);Component$1.registerComponent("ResizeManager",ResizeManager);var defaults={trackingThreshold:20,liveTolerance:15};var LiveTracker=function(_Component){_inheritsLoose(LiveTracker,_Component);function LiveTracker(player,options){var _this;var options_=mergeOptions$3(defaults,options,{createEl:false});_this=_Component.call(this,player,options_)||this;_this.handleVisibilityChange_=function(e){return _this.handleVisibilityChange(e)};_this.trackLiveHandler_=function(){return _this.trackLive_()};_this.handlePlay_=function(e){return _this.handlePlay(e)};_this.handleFirstTimeupdate_=function(e){return _this.handleFirstTimeupdate(e)};_this.handleSeeked_=function(e){return _this.handleSeeked(e)};_this.seekToLiveEdge_=function(e){return _this.seekToLiveEdge(e)};_this.reset_();_this.on(_this.player_,"durationchange",function(e){return _this.handleDurationchange(e)});_this.on(_this.player_,"canplay",function(){return _this.toggleTracking()});if(IE_VERSION&&"hidden"in document_1&&"visibilityState"in document_1){_this.on(document_1,"visibilitychange",_this.handleVisibilityChange_);}return _this}var _proto=LiveTracker.prototype;_proto.handleVisibilityChange=function handleVisibilityChange(){if(this.player_.duration()!==Infinity){return}if(document_1.hidden){this.stopTracking();}else {this.startTracking();}};_proto.trackLive_=function trackLive_(){var seekable=this.player_.seekable();if(!seekable||!seekable.length){return}var newTime=Number(window_1.performance.now().toFixed(4));var deltaTime=this.lastTime_===-1?0:(newTime-this.lastTime_)/1e3;this.lastTime_=newTime;this.pastSeekEnd_=this.pastSeekEnd()+deltaTime;var liveCurrentTime=this.liveCurrentTime();var currentTime=this.player_.currentTime();var isBehind=this.player_.paused()||this.seekedBehindLive_||Math.abs(liveCurrentTime-currentTime)>this.options_.liveTolerance;if(!this.timeupdateSeen_||liveCurrentTime===Infinity){isBehind=false;}if(isBehind!==this.behindLiveEdge_){this.behindLiveEdge_=isBehind;this.trigger("liveedgechange");}};_proto.handleDurationchange=function handleDurationchange(){this.toggleTracking();};_proto.toggleTracking=function toggleTracking(){if(this.player_.duration()===Infinity&&this.liveWindow()>=this.options_.trackingThreshold){if(this.player_.options_.liveui){this.player_.addClass("vjs-liveui");}this.startTracking();}else {this.player_.removeClass("vjs-liveui");this.stopTracking();}};_proto.startTracking=function startTracking(){if(this.isTracking()){return}if(!this.timeupdateSeen_){this.timeupdateSeen_=this.player_.hasStarted();}this.trackingInterval_=this.setInterval(this.trackLiveHandler_,UPDATE_REFRESH_INTERVAL);this.trackLive_();this.on(this.player_,["play","pause"],this.trackLiveHandler_);if(!this.timeupdateSeen_){this.one(this.player_,"play",this.handlePlay_);this.one(this.player_,"timeupdate",this.handleFirstTimeupdate_);}else {this.on(this.player_,"seeked",this.handleSeeked_);}};_proto.handleFirstTimeupdate=function handleFirstTimeupdate(){this.timeupdateSeen_=true;this.on(this.player_,"seeked",this.handleSeeked_);};_proto.handleSeeked=function handleSeeked(){var timeDiff=Math.abs(this.liveCurrentTime()-this.player_.currentTime());this.seekedBehindLive_=this.nextSeekedFromUser_&&timeDiff>2;this.nextSeekedFromUser_=false;this.trackLive_();};_proto.handlePlay=function handlePlay(){this.one(this.player_,"timeupdate",this.seekToLiveEdge_);};_proto.reset_=function reset_(){this.lastTime_=-1;this.pastSeekEnd_=0;this.lastSeekEnd_=-1;this.behindLiveEdge_=true;this.timeupdateSeen_=false;this.seekedBehindLive_=false;this.nextSeekedFromUser_=false;this.clearInterval(this.trackingInterval_);this.trackingInterval_=null;this.off(this.player_,["play","pause"],this.trackLiveHandler_);this.off(this.player_,"seeked",this.handleSeeked_);this.off(this.player_,"play",this.handlePlay_);this.off(this.player_,"timeupdate",this.handleFirstTimeupdate_);this.off(this.player_,"timeupdate",this.seekToLiveEdge_);};_proto.nextSeekedFromUser=function nextSeekedFromUser(){this.nextSeekedFromUser_=true;};_proto.stopTracking=function stopTracking(){if(!this.isTracking()){return}this.reset_();this.trigger("liveedgechange");};_proto.seekableEnd=function seekableEnd(){var seekable=this.player_.seekable();var seekableEnds=[];var i=seekable?seekable.length:0;while(i--){seekableEnds.push(seekable.end(i));}return seekableEnds.length?seekableEnds.sort()[seekableEnds.length-1]:Infinity};_proto.seekableStart=function seekableStart(){var seekable=this.player_.seekable();var seekableStarts=[];var i=seekable?seekable.length:0;while(i--){seekableStarts.push(seekable.start(i));}return seekableStarts.length?seekableStarts.sort()[0]:0};_proto.liveWindow=function liveWindow(){var liveCurrentTime=this.liveCurrentTime();if(liveCurrentTime===Infinity){return 0}return liveCurrentTime-this.seekableStart()};_proto.isLive=function isLive(){return this.isTracking()};_proto.atLiveEdge=function atLiveEdge(){return !this.behindLiveEdge()};_proto.liveCurrentTime=function liveCurrentTime(){return this.pastSeekEnd()+this.seekableEnd()};_proto.pastSeekEnd=function pastSeekEnd(){var seekableEnd=this.seekableEnd();if(this.lastSeekEnd_!==-1&&seekableEnd!==this.lastSeekEnd_){this.pastSeekEnd_=0;}this.lastSeekEnd_=seekableEnd;return this.pastSeekEnd_};_proto.behindLiveEdge=function behindLiveEdge(){return this.behindLiveEdge_};_proto.isTracking=function isTracking(){return typeof this.trackingInterval_==="number"};_proto.seekToLiveEdge=function seekToLiveEdge(){this.seekedBehindLive_=false;if(this.atLiveEdge()){return}this.nextSeekedFromUser_=false;this.player_.currentTime(this.liveCurrentTime());};_proto.dispose=function dispose(){this.off(document_1,"visibilitychange",this.handleVisibilityChange_);this.stopTracking();_Component.prototype.dispose.call(this);};return LiveTracker}(Component$1);Component$1.registerComponent("LiveTracker",LiveTracker);var sourcesetLoad=function sourcesetLoad(tech){var el=tech.el();if(el.hasAttribute("src")){tech.triggerSourceset(el.src);return true}var sources=tech.$$("source");var srcUrls=[];var src="";if(!sources.length){return false}for(var i=0;i<sources.length;i++){var url=sources[i].src;if(url&&srcUrls.indexOf(url)===-1){srcUrls.push(url);}}if(!srcUrls.length){return false}if(srcUrls.length===1){src=srcUrls[0];}tech.triggerSourceset(src);return true};var innerHTMLDescriptorPolyfill=Object.defineProperty({},"innerHTML",{get:function get(){return this.cloneNode(true).innerHTML},set:function set(v){var dummy=document_1.createElement(this.nodeName.toLowerCase());dummy.innerHTML=v;var docFrag=document_1.createDocumentFragment();while(dummy.childNodes.length){docFrag.appendChild(dummy.childNodes[0]);}this.innerText="";window_1.Element.prototype.appendChild.call(this,docFrag);return this.innerHTML}});var getDescriptor=function getDescriptor(priority,prop){var descriptor={};for(var i=0;i<priority.length;i++){descriptor=Object.getOwnPropertyDescriptor(priority[i],prop);if(descriptor&&descriptor.set&&descriptor.get){break}}descriptor.enumerable=true;descriptor.configurable=true;return descriptor};var getInnerHTMLDescriptor=function getInnerHTMLDescriptor(tech){return getDescriptor([tech.el(),window_1.HTMLMediaElement.prototype,window_1.Element.prototype,innerHTMLDescriptorPolyfill],"innerHTML")};var firstSourceWatch=function firstSourceWatch(tech){var el=tech.el();if(el.resetSourceWatch_){return}var old={};var innerDescriptor=getInnerHTMLDescriptor(tech);var appendWrapper=function appendWrapper(appendFn){return function(){for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}var retval=appendFn.apply(el,args);sourcesetLoad(tech);return retval}};["append","appendChild","insertAdjacentHTML"].forEach(function(k){if(!el[k]){return}old[k]=el[k];el[k]=appendWrapper(old[k]);});Object.defineProperty(el,"innerHTML",mergeOptions$3(innerDescriptor,{set:appendWrapper(innerDescriptor.set)}));el.resetSourceWatch_=function(){el.resetSourceWatch_=null;Object.keys(old).forEach(function(k){el[k]=old[k];});Object.defineProperty(el,"innerHTML",innerDescriptor);};tech.one("sourceset",el.resetSourceWatch_);};var srcDescriptorPolyfill=Object.defineProperty({},"src",{get:function get(){if(this.hasAttribute("src")){return getAbsoluteURL(window_1.Element.prototype.getAttribute.call(this,"src"))}return ""},set:function set(v){window_1.Element.prototype.setAttribute.call(this,"src",v);return v}});var getSrcDescriptor=function getSrcDescriptor(tech){return getDescriptor([tech.el(),window_1.HTMLMediaElement.prototype,srcDescriptorPolyfill],"src")};var setupSourceset=function setupSourceset(tech){if(!tech.featuresSourceset){return}var el=tech.el();if(el.resetSourceset_){return}var srcDescriptor=getSrcDescriptor(tech);var oldSetAttribute=el.setAttribute;var oldLoad=el.load;Object.defineProperty(el,"src",mergeOptions$3(srcDescriptor,{set:function set(v){var retval=srcDescriptor.set.call(el,v);tech.triggerSourceset(el.src);return retval}}));el.setAttribute=function(n,v){var retval=oldSetAttribute.call(el,n,v);if(/src/i.test(n)){tech.triggerSourceset(el.src);}return retval};el.load=function(){var retval=oldLoad.call(el);if(!sourcesetLoad(tech)){tech.triggerSourceset("");firstSourceWatch(tech);}return retval};if(el.currentSrc){tech.triggerSourceset(el.currentSrc);}else if(!sourcesetLoad(tech)){firstSourceWatch(tech);}el.resetSourceset_=function(){el.resetSourceset_=null;el.load=oldLoad;el.setAttribute=oldSetAttribute;Object.defineProperty(el,"src",srcDescriptor);if(el.resetSourceWatch_){el.resetSourceWatch_();}};};var defineLazyProperty=function defineLazyProperty(obj,key,getValue,setter){if(setter===void 0){setter=true;}var set=function set(value){return Object.defineProperty(obj,key,{value:value,enumerable:true,writable:true})};var options={configurable:true,enumerable:true,get:function get(){var value=getValue();set(value);return value}};if(setter){options.set=set;}return Object.defineProperty(obj,key,options)};var Html5=function(_Tech){_inheritsLoose(Html5,_Tech);function Html5(options,ready){var _this;_this=_Tech.call(this,options,ready)||this;var source=options.source;var crossoriginTracks=false;_this.featuresVideoFrameCallback=_this.featuresVideoFrameCallback&&_this.el_.tagName==="VIDEO";if(source&&(_this.el_.currentSrc!==source.src||options.tag&&options.tag.initNetworkState_===3)){_this.setSource(source);}else {_this.handleLateInit_(_this.el_);}if(options.enableSourceset){_this.setupSourcesetHandling_();}_this.isScrubbing_=false;if(_this.el_.hasChildNodes()){var nodes=_this.el_.childNodes;var nodesLength=nodes.length;var removeNodes=[];while(nodesLength--){var node=nodes[nodesLength];var nodeName=node.nodeName.toLowerCase();if(nodeName==="track"){if(!_this.featuresNativeTextTracks){removeNodes.push(node);}else {_this.remoteTextTrackEls().addTrackElement_(node);_this.remoteTextTracks().addTrack(node.track);_this.textTracks().addTrack(node.track);if(!crossoriginTracks&&!_this.el_.hasAttribute("crossorigin")&&isCrossOrigin(node.src)){crossoriginTracks=true;}}}}for(var i=0;i<removeNodes.length;i++){_this.el_.removeChild(removeNodes[i]);}}_this.proxyNativeTracks_();if(_this.featuresNativeTextTracks&&crossoriginTracks){log$1.warn("Text Tracks are being loaded from another origin but the crossorigin attribute isn't used.\n"+"This may prevent text tracks from loading.");}_this.restoreMetadataTracksInIOSNativePlayer_();if((TOUCH_ENABLED||IS_IPHONE||IS_NATIVE_ANDROID)&&options.nativeControlsForTouch===true){_this.setControls(true);}_this.proxyWebkitFullscreen_();_this.triggerReady();return _this}var _proto=Html5.prototype;_proto.dispose=function dispose(){if(this.el_&&this.el_.resetSourceset_){this.el_.resetSourceset_();}Html5.disposeMediaElement(this.el_);this.options_=null;_Tech.prototype.dispose.call(this);};_proto.setupSourcesetHandling_=function setupSourcesetHandling_(){setupSourceset(this);};_proto.restoreMetadataTracksInIOSNativePlayer_=function restoreMetadataTracksInIOSNativePlayer_(){var textTracks=this.textTracks();var metadataTracksPreFullscreenState;var takeMetadataTrackSnapshot=function takeMetadataTrackSnapshot(){metadataTracksPreFullscreenState=[];for(var i=0;i<textTracks.length;i++){var track=textTracks[i];if(track.kind==="metadata"){metadataTracksPreFullscreenState.push({track:track,storedMode:track.mode});}}};takeMetadataTrackSnapshot();textTracks.addEventListener("change",takeMetadataTrackSnapshot);this.on("dispose",function(){return textTracks.removeEventListener("change",takeMetadataTrackSnapshot)});var restoreTrackMode=function restoreTrackMode(){for(var i=0;i<metadataTracksPreFullscreenState.length;i++){var storedTrack=metadataTracksPreFullscreenState[i];if(storedTrack.track.mode==="disabled"&&storedTrack.track.mode!==storedTrack.storedMode){storedTrack.track.mode=storedTrack.storedMode;}}textTracks.removeEventListener("change",restoreTrackMode);};this.on("webkitbeginfullscreen",function(){textTracks.removeEventListener("change",takeMetadataTrackSnapshot);textTracks.removeEventListener("change",restoreTrackMode);textTracks.addEventListener("change",restoreTrackMode);});this.on("webkitendfullscreen",function(){textTracks.removeEventListener("change",takeMetadataTrackSnapshot);textTracks.addEventListener("change",takeMetadataTrackSnapshot);textTracks.removeEventListener("change",restoreTrackMode);});};_proto.overrideNative_=function overrideNative_(type,override){var _this2=this;if(override!==this["featuresNative"+type+"Tracks"]){return}var lowerCaseType=type.toLowerCase();if(this[lowerCaseType+"TracksListeners_"]){Object.keys(this[lowerCaseType+"TracksListeners_"]).forEach(function(eventName){var elTracks=_this2.el()[lowerCaseType+"Tracks"];elTracks.removeEventListener(eventName,_this2[lowerCaseType+"TracksListeners_"][eventName]);});}this["featuresNative"+type+"Tracks"]=!override;this[lowerCaseType+"TracksListeners_"]=null;this.proxyNativeTracksForType_(lowerCaseType);};_proto.overrideNativeAudioTracks=function overrideNativeAudioTracks(override){this.overrideNative_("Audio",override);};_proto.overrideNativeVideoTracks=function overrideNativeVideoTracks(override){this.overrideNative_("Video",override);};_proto.proxyNativeTracksForType_=function proxyNativeTracksForType_(name){var _this3=this;var props=NORMAL[name];var elTracks=this.el()[props.getterName];var techTracks=this[props.getterName]();if(!this["featuresNative"+props.capitalName+"Tracks"]||!elTracks||!elTracks.addEventListener){return}var listeners={change:function change(e){var event={type:"change",target:techTracks,currentTarget:techTracks,srcElement:techTracks};techTracks.trigger(event);if(name==="text"){_this3[REMOTE.remoteText.getterName]().trigger(event);}},addtrack:function addtrack(e){techTracks.addTrack(e.track);},removetrack:function removetrack(e){techTracks.removeTrack(e.track);}};var removeOldTracks=function removeOldTracks(){var removeTracks=[];for(var i=0;i<techTracks.length;i++){var found=false;for(var j=0;j<elTracks.length;j++){if(elTracks[j]===techTracks[i]){found=true;break}}if(!found){removeTracks.push(techTracks[i]);}}while(removeTracks.length){techTracks.removeTrack(removeTracks.shift());}};this[props.getterName+"Listeners_"]=listeners;Object.keys(listeners).forEach(function(eventName){var listener=listeners[eventName];elTracks.addEventListener(eventName,listener);_this3.on("dispose",function(e){return elTracks.removeEventListener(eventName,listener)});});this.on("loadstart",removeOldTracks);this.on("dispose",function(e){return _this3.off("loadstart",removeOldTracks)});};_proto.proxyNativeTracks_=function proxyNativeTracks_(){var _this4=this;NORMAL.names.forEach(function(name){_this4.proxyNativeTracksForType_(name);});};_proto.createEl=function createEl(){var el=this.options_.tag;if(!el||!(this.options_.playerElIngest||this.movingMediaElementInDOM)){if(el){var clone=el.cloneNode(true);if(el.parentNode){el.parentNode.insertBefore(clone,el);}Html5.disposeMediaElement(el);el=clone;}else {el=document_1.createElement("video");var tagAttributes=this.options_.tag&&getAttributes(this.options_.tag);var attributes=mergeOptions$3({},tagAttributes);if(!TOUCH_ENABLED||this.options_.nativeControlsForTouch!==true){delete attributes.controls;}setAttributes(el,assign(attributes,{id:this.options_.techId,"class":"vjs-tech"}));}el.playerId=this.options_.playerId;}if(typeof this.options_.preload!=="undefined"){setAttribute(el,"preload",this.options_.preload);}if(this.options_.disablePictureInPicture!==undefined){el.disablePictureInPicture=this.options_.disablePictureInPicture;}var settingsAttrs=["loop","muted","playsinline","autoplay"];for(var i=0;i<settingsAttrs.length;i++){var attr=settingsAttrs[i];var value=this.options_[attr];if(typeof value!=="undefined"){if(value){setAttribute(el,attr,attr);}else {removeAttribute(el,attr);}el[attr]=value;}}return el};_proto.handleLateInit_=function handleLateInit_(el){if(el.networkState===0||el.networkState===3){return}if(el.readyState===0){var loadstartFired=false;var setLoadstartFired=function setLoadstartFired(){loadstartFired=true;};this.on("loadstart",setLoadstartFired);var triggerLoadstart=function triggerLoadstart(){if(!loadstartFired){this.trigger("loadstart");}};this.on("loadedmetadata",triggerLoadstart);this.ready(function(){this.off("loadstart",setLoadstartFired);this.off("loadedmetadata",triggerLoadstart);if(!loadstartFired){this.trigger("loadstart");}});return}var eventsToTrigger=["loadstart"];eventsToTrigger.push("loadedmetadata");if(el.readyState>=2){eventsToTrigger.push("loadeddata");}if(el.readyState>=3){eventsToTrigger.push("canplay");}if(el.readyState>=4){eventsToTrigger.push("canplaythrough");}this.ready(function(){eventsToTrigger.forEach(function(type){this.trigger(type);},this);});};_proto.setScrubbing=function setScrubbing(isScrubbing){this.isScrubbing_=isScrubbing;};_proto.scrubbing=function scrubbing(){return this.isScrubbing_};_proto.setCurrentTime=function setCurrentTime(seconds){try{if(this.isScrubbing_&&this.el_.fastSeek&&IS_ANY_SAFARI){this.el_.fastSeek(seconds);}else {this.el_.currentTime=seconds;}}catch(e){log$1(e,"Video is not ready. (Video.js)");}};_proto.duration=function duration(){var _this5=this;if(this.el_.duration===Infinity&&IS_ANDROID&&IS_CHROME&&this.el_.currentTime===0){var checkProgress=function checkProgress(){if(_this5.el_.currentTime>0){if(_this5.el_.duration===Infinity){_this5.trigger("durationchange");}_this5.off("timeupdate",checkProgress);}};this.on("timeupdate",checkProgress);return NaN}return this.el_.duration||NaN};_proto.width=function width(){return this.el_.offsetWidth};_proto.height=function height(){return this.el_.offsetHeight};_proto.proxyWebkitFullscreen_=function proxyWebkitFullscreen_(){var _this6=this;if(!("webkitDisplayingFullscreen"in this.el_)){return}var endFn=function endFn(){this.trigger("fullscreenchange",{isFullscreen:false});if(this.el_.controls&&!this.options_.nativeControlsForTouch&&this.controls()){this.el_.controls=false;}};var beginFn=function beginFn(){if("webkitPresentationMode"in this.el_&&this.el_.webkitPresentationMode!=="picture-in-picture"){this.one("webkitendfullscreen",endFn);this.trigger("fullscreenchange",{isFullscreen:true,nativeIOSFullscreen:true});}};this.on("webkitbeginfullscreen",beginFn);this.on("dispose",function(){_this6.off("webkitbeginfullscreen",beginFn);_this6.off("webkitendfullscreen",endFn);});};_proto.supportsFullScreen=function supportsFullScreen(){if(typeof this.el_.webkitEnterFullScreen==="function"){var userAgent=window_1.navigator&&window_1.navigator.userAgent||"";if(/Android/.test(userAgent)||!/Chrome|Mac OS X 10.5/.test(userAgent)){return true}}return false};_proto.enterFullScreen=function enterFullScreen(){var video=this.el_;if(video.paused&&video.networkState<=video.HAVE_METADATA){silencePromise(this.el_.play());this.setTimeout(function(){video.pause();try{video.webkitEnterFullScreen();}catch(e){this.trigger("fullscreenerror",e);}},0);}else {try{video.webkitEnterFullScreen();}catch(e){this.trigger("fullscreenerror",e);}}};_proto.exitFullScreen=function exitFullScreen(){if(!this.el_.webkitDisplayingFullscreen){this.trigger("fullscreenerror",new Error("The video is not fullscreen"));return}this.el_.webkitExitFullScreen();};_proto.requestPictureInPicture=function requestPictureInPicture(){return this.el_.requestPictureInPicture()};_proto.requestVideoFrameCallback=function requestVideoFrameCallback(cb){if(this.featuresVideoFrameCallback&&!this.el_.webkitKeys){return this.el_.requestVideoFrameCallback(cb)}return _Tech.prototype.requestVideoFrameCallback.call(this,cb)};_proto.cancelVideoFrameCallback=function cancelVideoFrameCallback(id){if(this.featuresVideoFrameCallback&&!this.el_.webkitKeys){this.el_.cancelVideoFrameCallback(id);}else {_Tech.prototype.cancelVideoFrameCallback.call(this,id);}};_proto.src=function src(_src){if(_src===undefined){return this.el_.src}this.setSrc(_src);};_proto.reset=function reset(){Html5.resetMediaElement(this.el_);};_proto.currentSrc=function currentSrc(){if(this.currentSource_){return this.currentSource_.src}return this.el_.currentSrc};_proto.setControls=function setControls(val){this.el_.controls=!!val;};_proto.addTextTrack=function addTextTrack(kind,label,language){if(!this.featuresNativeTextTracks){return _Tech.prototype.addTextTrack.call(this,kind,label,language)}return this.el_.addTextTrack(kind,label,language)};_proto.createRemoteTextTrack=function createRemoteTextTrack(options){if(!this.featuresNativeTextTracks){return _Tech.prototype.createRemoteTextTrack.call(this,options)}var htmlTrackElement=document_1.createElement("track");if(options.kind){htmlTrackElement.kind=options.kind;}if(options.label){htmlTrackElement.label=options.label;}if(options.language||options.srclang){htmlTrackElement.srclang=options.language||options.srclang;}if(options["default"]){htmlTrackElement["default"]=options["default"];}if(options.id){htmlTrackElement.id=options.id;}if(options.src){htmlTrackElement.src=options.src;}return htmlTrackElement};_proto.addRemoteTextTrack=function addRemoteTextTrack(options,manualCleanup){var htmlTrackElement=_Tech.prototype.addRemoteTextTrack.call(this,options,manualCleanup);if(this.featuresNativeTextTracks){this.el().appendChild(htmlTrackElement);}return htmlTrackElement};_proto.removeRemoteTextTrack=function removeRemoteTextTrack(track){_Tech.prototype.removeRemoteTextTrack.call(this,track);if(this.featuresNativeTextTracks){var tracks=this.$$("track");var i=tracks.length;while(i--){if(track===tracks[i]||track===tracks[i].track){this.el().removeChild(tracks[i]);}}}};_proto.getVideoPlaybackQuality=function getVideoPlaybackQuality(){if(typeof this.el().getVideoPlaybackQuality==="function"){return this.el().getVideoPlaybackQuality()}var videoPlaybackQuality={};if(typeof this.el().webkitDroppedFrameCount!=="undefined"&&typeof this.el().webkitDecodedFrameCount!=="undefined"){videoPlaybackQuality.droppedVideoFrames=this.el().webkitDroppedFrameCount;videoPlaybackQuality.totalVideoFrames=this.el().webkitDecodedFrameCount;}if(window_1.performance&&typeof window_1.performance.now==="function"){videoPlaybackQuality.creationTime=window_1.performance.now();}else if(window_1.performance&&window_1.performance.timing&&typeof window_1.performance.timing.navigationStart==="number"){videoPlaybackQuality.creationTime=window_1.Date.now()-window_1.performance.timing.navigationStart;}return videoPlaybackQuality};return Html5}(Tech);defineLazyProperty(Html5,"TEST_VID",function(){if(!isReal()){return}var video=document_1.createElement("video");var track=document_1.createElement("track");track.kind="captions";track.srclang="en";track.label="English";video.appendChild(track);return video});Html5.isSupported=function(){try{Html5.TEST_VID.volume=.5;}catch(e){return false}return !!(Html5.TEST_VID&&Html5.TEST_VID.canPlayType)};Html5.canPlayType=function(type){return Html5.TEST_VID.canPlayType(type)};Html5.canPlaySource=function(srcObj,options){return Html5.canPlayType(srcObj.type)};Html5.canControlVolume=function(){try{var volume=Html5.TEST_VID.volume;Html5.TEST_VID.volume=volume/2+.1;var canControl=volume!==Html5.TEST_VID.volume;if(canControl&&IS_IOS){window_1.setTimeout(function(){if(Html5&&Html5.prototype){Html5.prototype.featuresVolumeControl=volume!==Html5.TEST_VID.volume;}});return false}return canControl}catch(e){return false}};Html5.canMuteVolume=function(){try{var muted=Html5.TEST_VID.muted;Html5.TEST_VID.muted=!muted;if(Html5.TEST_VID.muted){setAttribute(Html5.TEST_VID,"muted","muted");}else {removeAttribute(Html5.TEST_VID,"muted","muted");}return muted!==Html5.TEST_VID.muted}catch(e){return false}};Html5.canControlPlaybackRate=function(){if(IS_ANDROID&&IS_CHROME&&CHROME_VERSION<58){return false}try{var playbackRate=Html5.TEST_VID.playbackRate;Html5.TEST_VID.playbackRate=playbackRate/2+.1;return playbackRate!==Html5.TEST_VID.playbackRate}catch(e){return false}};Html5.canOverrideAttributes=function(){try{var noop=function noop(){};Object.defineProperty(document_1.createElement("video"),"src",{get:noop,set:noop});Object.defineProperty(document_1.createElement("audio"),"src",{get:noop,set:noop});Object.defineProperty(document_1.createElement("video"),"innerHTML",{get:noop,set:noop});Object.defineProperty(document_1.createElement("audio"),"innerHTML",{get:noop,set:noop});}catch(e){return false}return true};Html5.supportsNativeTextTracks=function(){return IS_ANY_SAFARI||IS_IOS&&IS_CHROME};Html5.supportsNativeVideoTracks=function(){return !!(Html5.TEST_VID&&Html5.TEST_VID.videoTracks)};Html5.supportsNativeAudioTracks=function(){return !!(Html5.TEST_VID&&Html5.TEST_VID.audioTracks)};Html5.Events=["loadstart","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","progress","play","pause","ratechange","resize","volumechange"];[["featuresMuteControl","canMuteVolume"],["featuresPlaybackRate","canControlPlaybackRate"],["featuresSourceset","canOverrideAttributes"],["featuresNativeTextTracks","supportsNativeTextTracks"],["featuresNativeVideoTracks","supportsNativeVideoTracks"],["featuresNativeAudioTracks","supportsNativeAudioTracks"]].forEach(function(_ref){var key=_ref[0],fn=_ref[1];defineLazyProperty(Html5.prototype,key,function(){return Html5[fn]()},true);});Html5.prototype.featuresVolumeControl=Html5.canControlVolume();Html5.prototype.movingMediaElementInDOM=!IS_IOS;Html5.prototype.featuresFullscreenResize=true;Html5.prototype.featuresProgressEvents=true;Html5.prototype.featuresTimeupdateEvents=true;Html5.prototype.featuresVideoFrameCallback=!!(Html5.TEST_VID&&Html5.TEST_VID.requestVideoFrameCallback);var canPlayType;Html5.patchCanPlayType=function(){if(ANDROID_VERSION>=4&&!IS_FIREFOX&&!IS_CHROME){canPlayType=Html5.TEST_VID&&Html5.TEST_VID.constructor.prototype.canPlayType;Html5.TEST_VID.constructor.prototype.canPlayType=function(type){var mpegurlRE=/^application\/(?:x-|vnd\.apple\.)mpegurl/i;if(type&&mpegurlRE.test(type)){return "maybe"}return canPlayType.call(this,type)};}};Html5.unpatchCanPlayType=function(){var r=Html5.TEST_VID.constructor.prototype.canPlayType;if(canPlayType){Html5.TEST_VID.constructor.prototype.canPlayType=canPlayType;}return r};Html5.patchCanPlayType();Html5.disposeMediaElement=function(el){if(!el){return}if(el.parentNode){el.parentNode.removeChild(el);}while(el.hasChildNodes()){el.removeChild(el.firstChild);}el.removeAttribute("src");if(typeof el.load==="function"){(function(){try{el.load();}catch(e){}})();}};Html5.resetMediaElement=function(el){if(!el){return}var sources=el.querySelectorAll("source");var i=sources.length;while(i--){el.removeChild(sources[i]);}el.removeAttribute("src");if(typeof el.load==="function"){(function(){try{el.load();}catch(e){}})();}};["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach(function(prop){Html5.prototype[prop]=function(){return this.el_[prop]||this.el_.hasAttribute(prop)};});["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(prop){Html5.prototype["set"+toTitleCase$1(prop)]=function(v){this.el_[prop]=v;if(v){this.el_.setAttribute(prop,prop);}else {this.el_.removeAttribute(prop);}};});["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","disablePictureInPicture","played","networkState","readyState","videoWidth","videoHeight","crossOrigin"].forEach(function(prop){Html5.prototype[prop]=function(){return this.el_[prop]};});["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach(function(prop){Html5.prototype["set"+toTitleCase$1(prop)]=function(v){this.el_[prop]=v;};});["pause","load","play"].forEach(function(prop){Html5.prototype[prop]=function(){return this.el_[prop]()};});Tech.withSourceHandlers(Html5);Html5.nativeSourceHandler={};Html5.nativeSourceHandler.canPlayType=function(type){try{return Html5.TEST_VID.canPlayType(type)}catch(e){return ""}};Html5.nativeSourceHandler.canHandleSource=function(source,options){if(source.type){return Html5.nativeSourceHandler.canPlayType(source.type)}else if(source.src){var ext=getFileExtension(source.src);return Html5.nativeSourceHandler.canPlayType("video/"+ext)}return ""};Html5.nativeSourceHandler.handleSource=function(source,tech,options){tech.setSrc(source.src);};Html5.nativeSourceHandler.dispose=function(){};Html5.registerSourceHandler(Html5.nativeSourceHandler);Tech.registerTech("Html5",Html5);var TECH_EVENTS_RETRIGGER=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"];var TECH_EVENTS_QUEUE={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"};var BREAKPOINT_ORDER=["tiny","xsmall","small","medium","large","xlarge","huge"];var BREAKPOINT_CLASSES={};BREAKPOINT_ORDER.forEach(function(k){var v=k.charAt(0)==="x"?"x-"+k.substring(1):k;BREAKPOINT_CLASSES[k]="vjs-layout-"+v;});var DEFAULT_BREAKPOINTS={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:Infinity};var Player=function(_Component){_inheritsLoose(Player,_Component);function Player(tag,options,ready){var _this;tag.id=tag.id||options.id||"vjs_video_"+newGUID();options=assign(Player.getTagSettings(tag),options);options.initChildren=false;options.createEl=false;options.evented=false;options.reportTouchActivity=false;if(!options.language){if(typeof tag.closest==="function"){var closest=tag.closest("[lang]");if(closest&&closest.getAttribute){options.language=closest.getAttribute("lang");}}else {var element=tag;while(element&&element.nodeType===1){if(getAttributes(element).hasOwnProperty("lang")){options.language=element.getAttribute("lang");break}element=element.parentNode;}}}_this=_Component.call(this,null,options,ready)||this;_this.boundDocumentFullscreenChange_=function(e){return _this.documentFullscreenChange_(e)};_this.boundFullWindowOnEscKey_=function(e){return _this.fullWindowOnEscKey(e)};_this.boundUpdateStyleEl_=function(e){return _this.updateStyleEl_(e)};_this.boundApplyInitTime_=function(e){return _this.applyInitTime_(e)};_this.boundUpdateCurrentBreakpoint_=function(e){return _this.updateCurrentBreakpoint_(e)};_this.boundHandleTechClick_=function(e){return _this.handleTechClick_(e)};_this.boundHandleTechDoubleClick_=function(e){return _this.handleTechDoubleClick_(e)};_this.boundHandleTechTouchStart_=function(e){return _this.handleTechTouchStart_(e)};_this.boundHandleTechTouchMove_=function(e){return _this.handleTechTouchMove_(e)};_this.boundHandleTechTouchEnd_=function(e){return _this.handleTechTouchEnd_(e)};_this.boundHandleTechTap_=function(e){return _this.handleTechTap_(e)};_this.isFullscreen_=false;_this.log=createLogger(_this.id_);_this.fsApi_=FullscreenApi;_this.isPosterFromTech_=false;_this.queuedCallbacks_=[];_this.isReady_=false;_this.hasStarted_=false;_this.userActive_=false;_this.debugEnabled_=false;_this.audioOnlyMode_=false;_this.audioPosterMode_=false;_this.audioOnlyCache_={playerHeight:null,hiddenChildren:[]};if(!_this.options_||!_this.options_.techOrder||!_this.options_.techOrder.length){throw new Error("No techOrder specified. Did you overwrite "+"videojs.options instead of just changing the "+"properties you want to override?")}_this.tag=tag;_this.tagAttributes=tag&&getAttributes(tag);_this.language(_this.options_.language);if(options.languages){var languagesToLower={};Object.getOwnPropertyNames(options.languages).forEach(function(name){languagesToLower[name.toLowerCase()]=options.languages[name];});_this.languages_=languagesToLower;}else {_this.languages_=Player.prototype.options_.languages;}_this.resetCache_();_this.poster_=options.poster||"";_this.controls_=!!options.controls;tag.controls=false;tag.removeAttribute("controls");_this.changingSrc_=false;_this.playCallbacks_=[];_this.playTerminatedQueue_=[];if(tag.hasAttribute("autoplay")){_this.autoplay(true);}else {_this.autoplay(_this.options_.autoplay);}if(options.plugins){Object.keys(options.plugins).forEach(function(name){if(typeof _this[name]!=="function"){throw new Error('plugin "'+name+'" does not exist')}});}_this.scrubbing_=false;_this.el_=_this.createEl();evented(_assertThisInitialized(_this),{eventBusKey:"el_"});if(_this.fsApi_.requestFullscreen){on(document_1,_this.fsApi_.fullscreenchange,_this.boundDocumentFullscreenChange_);_this.on(_this.fsApi_.fullscreenchange,_this.boundDocumentFullscreenChange_);}if(_this.fluid_){_this.on(["playerreset","resize"],_this.boundUpdateStyleEl_);}var playerOptionsCopy=mergeOptions$3(_this.options_);if(options.plugins){Object.keys(options.plugins).forEach(function(name){_this[name](options.plugins[name]);});}if(options.debug){_this.debug(true);}_this.options_.playerOptions=playerOptionsCopy;_this.middleware_=[];_this.playbackRates(options.playbackRates);_this.initChildren();_this.isAudio(tag.nodeName.toLowerCase()==="audio");if(_this.controls()){_this.addClass("vjs-controls-enabled");}else {_this.addClass("vjs-controls-disabled");}_this.el_.setAttribute("role","region");if(_this.isAudio()){_this.el_.setAttribute("aria-label",_this.localize("Audio Player"));}else {_this.el_.setAttribute("aria-label",_this.localize("Video Player"));}if(_this.isAudio()){_this.addClass("vjs-audio");}if(_this.flexNotSupported_()){_this.addClass("vjs-no-flex");}if(TOUCH_ENABLED){_this.addClass("vjs-touch-enabled");}if(!IS_IOS){_this.addClass("vjs-workinghover");}Player.players[_this.id_]=_assertThisInitialized(_this);var majorVersion=version$5.split(".")[0];_this.addClass("vjs-v"+majorVersion);_this.userActive(true);_this.reportUserActivity();_this.one("play",function(e){return _this.listenForUserActivity_(e)});_this.on("stageclick",function(e){return _this.handleStageClick_(e)});_this.on("keydown",function(e){return _this.handleKeyDown(e)});_this.on("languagechange",function(e){return _this.handleLanguagechange(e)});_this.breakpoints(_this.options_.breakpoints);_this.responsive(_this.options_.responsive);_this.on("ready",function(){_this.audioPosterMode(_this.options_.audioPosterMode);_this.audioOnlyMode(_this.options_.audioOnlyMode);});return _this}var _proto=Player.prototype;_proto.dispose=function dispose(){var _this2=this;this.trigger("dispose");this.off("dispose");off(document_1,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_);off(document_1,"keydown",this.boundFullWindowOnEscKey_);if(this.styleEl_&&this.styleEl_.parentNode){this.styleEl_.parentNode.removeChild(this.styleEl_);this.styleEl_=null;}Player.players[this.id_]=null;if(this.tag&&this.tag.player){this.tag.player=null;}if(this.el_&&this.el_.player){this.el_.player=null;}if(this.tech_){this.tech_.dispose();this.isPosterFromTech_=false;this.poster_="";}if(this.playerElIngest_){this.playerElIngest_=null;}if(this.tag){this.tag=null;}clearCacheForPlayer(this);ALL.names.forEach(function(name){var props=ALL[name];var list=_this2[props.getterName]();if(list&&list.off){list.off();}});_Component.prototype.dispose.call(this,{restoreEl:this.options_.restoreEl});};_proto.createEl=function createEl(){var tag=this.tag;var el;var playerElIngest=this.playerElIngest_=tag.parentNode&&tag.parentNode.hasAttribute&&tag.parentNode.hasAttribute("data-vjs-player");var divEmbed=this.tag.tagName.toLowerCase()==="video-js";if(playerElIngest){el=this.el_=tag.parentNode;}else if(!divEmbed){el=this.el_=_Component.prototype.createEl.call(this,"div");}var attrs=getAttributes(tag);if(divEmbed){el=this.el_=tag;tag=this.tag=document_1.createElement("video");while(el.children.length){tag.appendChild(el.firstChild);}if(!hasClass(el,"video-js")){addClass(el,"video-js");}el.appendChild(tag);playerElIngest=this.playerElIngest_=el;Object.keys(el).forEach(function(k){try{tag[k]=el[k];}catch(e){}});}tag.setAttribute("tabindex","-1");attrs.tabindex="-1";if(IE_VERSION||IS_CHROME&&IS_WINDOWS){tag.setAttribute("role","application");attrs.role="application";}tag.removeAttribute("width");tag.removeAttribute("height");if("width"in attrs){delete attrs.width;}if("height"in attrs){delete attrs.height;}Object.getOwnPropertyNames(attrs).forEach(function(attr){if(!(divEmbed&&attr==="class")){el.setAttribute(attr,attrs[attr]);}if(divEmbed){tag.setAttribute(attr,attrs[attr]);}});tag.playerId=tag.id;tag.id+="_html5_api";tag.className="vjs-tech";tag.player=el.player=this;this.addClass("vjs-paused");if(window_1.VIDEOJS_NO_DYNAMIC_STYLE!==true){this.styleEl_=createStyleElement("vjs-styles-dimensions");var defaultsStyleEl=$(".vjs-styles-defaults");var head=$("head");head.insertBefore(this.styleEl_,defaultsStyleEl?defaultsStyleEl.nextSibling:head.firstChild);}this.fill_=false;this.fluid_=false;this.width(this.options_.width);this.height(this.options_.height);this.fill(this.options_.fill);this.fluid(this.options_.fluid);this.aspectRatio(this.options_.aspectRatio);this.crossOrigin(this.options_.crossOrigin||this.options_.crossorigin);var links=tag.getElementsByTagName("a");for(var i=0;i<links.length;i++){var linkEl=links.item(i);addClass(linkEl,"vjs-hidden");linkEl.setAttribute("hidden","hidden");}tag.initNetworkState_=tag.networkState;if(tag.parentNode&&!playerElIngest){tag.parentNode.insertBefore(el,tag);}prependTo(tag,el);this.children_.unshift(tag);this.el_.setAttribute("lang",this.language_);this.el_.setAttribute("translate","no");this.el_=el;return el};_proto.crossOrigin=function crossOrigin(value){if(!value){return this.techGet_("crossOrigin")}if(value!=="anonymous"&&value!=="use-credentials"){log$1.warn('crossOrigin must be "anonymous" or "use-credentials", given "'+value+'"');return}this.techCall_("setCrossOrigin",value);return};_proto.width=function width(value){return this.dimension("width",value)};_proto.height=function height(value){return this.dimension("height",value)};_proto.dimension=function dimension(_dimension,value){var privDimension=_dimension+"_";if(value===undefined){return this[privDimension]||0}if(value===""||value==="auto"){this[privDimension]=undefined;this.updateStyleEl_();return}var parsedVal=parseFloat(value);if(isNaN(parsedVal)){log$1.error('Improper value "'+value+'" supplied for for '+_dimension);return}this[privDimension]=parsedVal;this.updateStyleEl_();};_proto.fluid=function fluid(bool){var _this3=this;if(bool===undefined){return !!this.fluid_}this.fluid_=!!bool;if(isEvented(this)){this.off(["playerreset","resize"],this.boundUpdateStyleEl_);}if(bool){this.addClass("vjs-fluid");this.fill(false);addEventedCallback(this,function(){_this3.on(["playerreset","resize"],_this3.boundUpdateStyleEl_);});}else {this.removeClass("vjs-fluid");}this.updateStyleEl_();};_proto.fill=function fill(bool){if(bool===undefined){return !!this.fill_}this.fill_=!!bool;if(bool){this.addClass("vjs-fill");this.fluid(false);}else {this.removeClass("vjs-fill");}};_proto.aspectRatio=function aspectRatio(ratio){if(ratio===undefined){return this.aspectRatio_}if(!/^\d+\:\d+$/.test(ratio)){throw new Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.")}this.aspectRatio_=ratio;this.fluid(true);this.updateStyleEl_();};_proto.updateStyleEl_=function updateStyleEl_(){if(window_1.VIDEOJS_NO_DYNAMIC_STYLE===true){var _width=typeof this.width_==="number"?this.width_:this.options_.width;var _height=typeof this.height_==="number"?this.height_:this.options_.height;var techEl=this.tech_&&this.tech_.el();if(techEl){if(_width>=0){techEl.width=_width;}if(_height>=0){techEl.height=_height;}}return}var width;var height;var aspectRatio;var idClass;if(this.aspectRatio_!==undefined&&this.aspectRatio_!=="auto"){aspectRatio=this.aspectRatio_;}else if(this.videoWidth()>0){aspectRatio=this.videoWidth()+":"+this.videoHeight();}else {aspectRatio="16:9";}var ratioParts=aspectRatio.split(":");var ratioMultiplier=ratioParts[1]/ratioParts[0];if(this.width_!==undefined){width=this.width_;}else if(this.height_!==undefined){width=this.height_/ratioMultiplier;}else {width=this.videoWidth()||300;}if(this.height_!==undefined){height=this.height_;}else {height=width*ratioMultiplier;}if(/^[^a-zA-Z]/.test(this.id())){idClass="dimensions-"+this.id();}else {idClass=this.id()+"-dimensions";}this.addClass(idClass);setTextContent(this.styleEl_,"\n ."+idClass+" {\n width: "+width+"px;\n height: "+height+"px;\n }\n\n ."+idClass+".vjs-fluid:not(.vjs-audio-only-mode) {\n padding-top: "+ratioMultiplier*100+"%;\n }\n ");};_proto.loadTech_=function loadTech_(techName,source){var _this4=this;if(this.tech_){this.unloadTech_();}var titleTechName=toTitleCase$1(techName);var camelTechName=techName.charAt(0).toLowerCase()+techName.slice(1);if(titleTechName!=="Html5"&&this.tag){Tech.getTech("Html5").disposeMediaElement(this.tag);this.tag.player=null;this.tag=null;}this.techName_=titleTechName;this.isReady_=false;var autoplay=this.autoplay();if(typeof this.autoplay()==="string"||this.autoplay()===true&&this.options_.normalizeAutoplay){autoplay=false;}var techOptions={source:source,autoplay:autoplay,"nativeControlsForTouch":this.options_.nativeControlsForTouch,"playerId":this.id(),"techId":this.id()+"_"+camelTechName+"_api","playsinline":this.options_.playsinline,"preload":this.options_.preload,"loop":this.options_.loop,"disablePictureInPicture":this.options_.disablePictureInPicture,"muted":this.options_.muted,"poster":this.poster(),"language":this.language(),"playerElIngest":this.playerElIngest_||false,"vtt.js":this.options_["vtt.js"],"canOverridePoster":!!this.options_.techCanOverridePoster,"enableSourceset":this.options_.enableSourceset,"Promise":this.options_.Promise};ALL.names.forEach(function(name){var props=ALL[name];techOptions[props.getterName]=_this4[props.privateName];});assign(techOptions,this.options_[titleTechName]);assign(techOptions,this.options_[camelTechName]);assign(techOptions,this.options_[techName.toLowerCase()]);if(this.tag){techOptions.tag=this.tag;}if(source&&source.src===this.cache_.src&&this.cache_.currentTime>0){techOptions.startTime=this.cache_.currentTime;}var TechClass=Tech.getTech(techName);if(!TechClass){throw new Error("No Tech named '"+titleTechName+"' exists! '"+titleTechName+"' should be registered using videojs.registerTech()'")}this.tech_=new TechClass(techOptions);this.tech_.ready(bind(this,this.handleTechReady_),true);textTrackConverter.jsonToTextTracks(this.textTracksJson_||[],this.tech_);TECH_EVENTS_RETRIGGER.forEach(function(event){_this4.on(_this4.tech_,event,function(e){return _this4["handleTech"+toTitleCase$1(event)+"_"](e)});});Object.keys(TECH_EVENTS_QUEUE).forEach(function(event){_this4.on(_this4.tech_,event,function(eventObj){if(_this4.tech_.playbackRate()===0&&_this4.tech_.seeking()){_this4.queuedCallbacks_.push({callback:_this4["handleTech"+TECH_EVENTS_QUEUE[event]+"_"].bind(_this4),event:eventObj});return}_this4["handleTech"+TECH_EVENTS_QUEUE[event]+"_"](eventObj);});});this.on(this.tech_,"loadstart",function(e){return _this4.handleTechLoadStart_(e)});this.on(this.tech_,"sourceset",function(e){return _this4.handleTechSourceset_(e)});this.on(this.tech_,"waiting",function(e){return _this4.handleTechWaiting_(e)});this.on(this.tech_,"ended",function(e){return _this4.handleTechEnded_(e)});this.on(this.tech_,"seeking",function(e){return _this4.handleTechSeeking_(e)});this.on(this.tech_,"play",function(e){return _this4.handleTechPlay_(e)});this.on(this.tech_,"firstplay",function(e){return _this4.handleTechFirstPlay_(e)});this.on(this.tech_,"pause",function(e){return _this4.handleTechPause_(e)});this.on(this.tech_,"durationchange",function(e){return _this4.handleTechDurationChange_(e)});this.on(this.tech_,"fullscreenchange",function(e,data){return _this4.handleTechFullscreenChange_(e,data)});this.on(this.tech_,"fullscreenerror",function(e,err){return _this4.handleTechFullscreenError_(e,err)});this.on(this.tech_,"enterpictureinpicture",function(e){return _this4.handleTechEnterPictureInPicture_(e)});this.on(this.tech_,"leavepictureinpicture",function(e){return _this4.handleTechLeavePictureInPicture_(e)});this.on(this.tech_,"error",function(e){return _this4.handleTechError_(e)});this.on(this.tech_,"posterchange",function(e){return _this4.handleTechPosterChange_(e)});this.on(this.tech_,"textdata",function(e){return _this4.handleTechTextData_(e)});this.on(this.tech_,"ratechange",function(e){return _this4.handleTechRateChange_(e)});this.on(this.tech_,"loadedmetadata",this.boundUpdateStyleEl_);this.usingNativeControls(this.techGet_("controls"));if(this.controls()&&!this.usingNativeControls()){this.addTechControlsListeners_();}if(this.tech_.el().parentNode!==this.el()&&(titleTechName!=="Html5"||!this.tag)){prependTo(this.tech_.el(),this.el());}if(this.tag){this.tag.player=null;this.tag=null;}};_proto.unloadTech_=function unloadTech_(){var _this5=this;ALL.names.forEach(function(name){var props=ALL[name];_this5[props.privateName]=_this5[props.getterName]();});this.textTracksJson_=textTrackConverter.textTracksToJson(this.tech_);this.isReady_=false;this.tech_.dispose();this.tech_=false;if(this.isPosterFromTech_){this.poster_="";this.trigger("posterchange");}this.isPosterFromTech_=false;};_proto.tech=function tech(safety){if(safety===undefined){log$1.warn("Using the tech directly can be dangerous. I hope you know what you're doing.\n"+"See https://github.com/videojs/video.js/issues/2617 for more info.\n");}return this.tech_};_proto.addTechControlsListeners_=function addTechControlsListeners_(){this.removeTechControlsListeners_();this.on(this.tech_,"click",this.boundHandleTechClick_);this.on(this.tech_,"dblclick",this.boundHandleTechDoubleClick_);this.on(this.tech_,"touchstart",this.boundHandleTechTouchStart_);this.on(this.tech_,"touchmove",this.boundHandleTechTouchMove_);this.on(this.tech_,"touchend",this.boundHandleTechTouchEnd_);this.on(this.tech_,"tap",this.boundHandleTechTap_);};_proto.removeTechControlsListeners_=function removeTechControlsListeners_(){this.off(this.tech_,"tap",this.boundHandleTechTap_);this.off(this.tech_,"touchstart",this.boundHandleTechTouchStart_);this.off(this.tech_,"touchmove",this.boundHandleTechTouchMove_);this.off(this.tech_,"touchend",this.boundHandleTechTouchEnd_);this.off(this.tech_,"click",this.boundHandleTechClick_);this.off(this.tech_,"dblclick",this.boundHandleTechDoubleClick_);};_proto.handleTechReady_=function handleTechReady_(){this.triggerReady();if(this.cache_.volume){this.techCall_("setVolume",this.cache_.volume);}this.handleTechPosterChange_();this.handleTechDurationChange_();};_proto.handleTechLoadStart_=function handleTechLoadStart_(){this.removeClass("vjs-ended");this.removeClass("vjs-seeking");this.error(null);this.handleTechDurationChange_();if(!this.paused()){this.trigger("loadstart");this.trigger("firstplay");}else {this.hasStarted(false);this.trigger("loadstart");}this.manualAutoplay_(this.autoplay()===true&&this.options_.normalizeAutoplay?"play":this.autoplay());};_proto.manualAutoplay_=function manualAutoplay_(type){var _this6=this;if(!this.tech_||typeof type!=="string"){return}var resolveMuted=function resolveMuted(){var previouslyMuted=_this6.muted();_this6.muted(true);var restoreMuted=function restoreMuted(){_this6.muted(previouslyMuted);};_this6.playTerminatedQueue_.push(restoreMuted);var mutedPromise=_this6.play();if(!isPromise(mutedPromise)){return}return mutedPromise["catch"](function(err){restoreMuted();throw new Error("Rejection at manualAutoplay. Restoring muted value. "+(err?err:""))})};var promise;if(type==="any"&&!this.muted()){promise=this.play();if(isPromise(promise)){promise=promise["catch"](resolveMuted);}}else if(type==="muted"&&!this.muted()){promise=resolveMuted();}else {promise=this.play();}if(!isPromise(promise)){return}return promise.then(function(){_this6.trigger({type:"autoplay-success",autoplay:type});})["catch"](function(){_this6.trigger({type:"autoplay-failure",autoplay:type});})};_proto.updateSourceCaches_=function updateSourceCaches_(srcObj){if(srcObj===void 0){srcObj="";}var src=srcObj;var type="";if(typeof src!=="string"){src=srcObj.src;type=srcObj.type;}this.cache_.source=this.cache_.source||{};this.cache_.sources=this.cache_.sources||[];if(src&&!type){type=findMimetype(this,src);}this.cache_.source=mergeOptions$3({},srcObj,{src:src,type:type});var matchingSources=this.cache_.sources.filter(function(s){return s.src&&s.src===src});var sourceElSources=[];var sourceEls=this.$$("source");var matchingSourceEls=[];for(var i=0;i<sourceEls.length;i++){var sourceObj=getAttributes(sourceEls[i]);sourceElSources.push(sourceObj);if(sourceObj.src&&sourceObj.src===src){matchingSourceEls.push(sourceObj.src);}}if(matchingSourceEls.length&&!matchingSources.length){this.cache_.sources=sourceElSources;}else if(!matchingSources.length){this.cache_.sources=[this.cache_.source];}this.cache_.src=src;};_proto.handleTechSourceset_=function handleTechSourceset_(event){var _this7=this;if(!this.changingSrc_){var updateSourceCaches=function updateSourceCaches(src){return _this7.updateSourceCaches_(src)};var playerSrc=this.currentSource().src;var eventSrc=event.src;if(playerSrc&&!/^blob:/.test(playerSrc)&&/^blob:/.test(eventSrc)){if(!this.lastSource_||this.lastSource_.tech!==eventSrc&&this.lastSource_.player!==playerSrc){updateSourceCaches=function updateSourceCaches(){};}}updateSourceCaches(eventSrc);if(!event.src){this.tech_.any(["sourceset","loadstart"],function(e){if(e.type==="sourceset"){return}var techSrc=_this7.techGet("currentSrc");_this7.lastSource_.tech=techSrc;_this7.updateSourceCaches_(techSrc);});}}this.lastSource_={player:this.currentSource().src,tech:event.src};this.trigger({src:event.src,type:"sourceset"});};_proto.hasStarted=function hasStarted(request){if(request===undefined){return this.hasStarted_}if(request===this.hasStarted_){return}this.hasStarted_=request;if(this.hasStarted_){this.addClass("vjs-has-started");this.trigger("firstplay");}else {this.removeClass("vjs-has-started");}};_proto.handleTechPlay_=function handleTechPlay_(){this.removeClass("vjs-ended");this.removeClass("vjs-paused");this.addClass("vjs-playing");this.hasStarted(true);this.trigger("play");};_proto.handleTechRateChange_=function handleTechRateChange_(){if(this.tech_.playbackRate()>0&&this.cache_.lastPlaybackRate===0){this.queuedCallbacks_.forEach(function(queued){return queued.callback(queued.event)});this.queuedCallbacks_=[];}this.cache_.lastPlaybackRate=this.tech_.playbackRate();this.trigger("ratechange");};_proto.handleTechWaiting_=function handleTechWaiting_(){var _this8=this;this.addClass("vjs-waiting");this.trigger("waiting");var timeWhenWaiting=this.currentTime();var timeUpdateListener=function timeUpdateListener(){if(timeWhenWaiting!==_this8.currentTime()){_this8.removeClass("vjs-waiting");_this8.off("timeupdate",timeUpdateListener);}};this.on("timeupdate",timeUpdateListener);};_proto.handleTechCanPlay_=function handleTechCanPlay_(){this.removeClass("vjs-waiting");this.trigger("canplay");};_proto.handleTechCanPlayThrough_=function handleTechCanPlayThrough_(){this.removeClass("vjs-waiting");this.trigger("canplaythrough");};_proto.handleTechPlaying_=function handleTechPlaying_(){this.removeClass("vjs-waiting");this.trigger("playing");};_proto.handleTechSeeking_=function handleTechSeeking_(){this.addClass("vjs-seeking");this.trigger("seeking");};_proto.handleTechSeeked_=function handleTechSeeked_(){this.removeClass("vjs-seeking");this.removeClass("vjs-ended");this.trigger("seeked");};_proto.handleTechFirstPlay_=function handleTechFirstPlay_(){if(this.options_.starttime){log$1.warn("Passing the `starttime` option to the player will be deprecated in 6.0");this.currentTime(this.options_.starttime);}this.addClass("vjs-has-started");this.trigger("firstplay");};_proto.handleTechPause_=function handleTechPause_(){this.removeClass("vjs-playing");this.addClass("vjs-paused");this.trigger("pause");};_proto.handleTechEnded_=function handleTechEnded_(){this.addClass("vjs-ended");this.removeClass("vjs-waiting");if(this.options_.loop){this.currentTime(0);this.play();}else if(!this.paused()){this.pause();}this.trigger("ended");};_proto.handleTechDurationChange_=function handleTechDurationChange_(){this.duration(this.techGet_("duration"));};_proto.handleTechClick_=function handleTechClick_(event){if(!this.controls_){return}if(this.options_===undefined||this.options_.userActions===undefined||this.options_.userActions.click===undefined||this.options_.userActions.click!==false){if(this.options_!==undefined&&this.options_.userActions!==undefined&&typeof this.options_.userActions.click==="function"){this.options_.userActions.click.call(this,event);}else if(this.paused()){silencePromise(this.play());}else {this.pause();}}};_proto.handleTechDoubleClick_=function handleTechDoubleClick_(event){if(!this.controls_){return}var inAllowedEls=Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),function(el){return el.contains(event.target)});if(!inAllowedEls){if(this.options_===undefined||this.options_.userActions===undefined||this.options_.userActions.doubleClick===undefined||this.options_.userActions.doubleClick!==false){if(this.options_!==undefined&&this.options_.userActions!==undefined&&typeof this.options_.userActions.doubleClick==="function"){this.options_.userActions.doubleClick.call(this,event);}else if(this.isFullscreen()){this.exitFullscreen();}else {this.requestFullscreen();}}}};_proto.handleTechTap_=function handleTechTap_(){this.userActive(!this.userActive());};_proto.handleTechTouchStart_=function handleTechTouchStart_(){this.userWasActive=this.userActive();};_proto.handleTechTouchMove_=function handleTechTouchMove_(){if(this.userWasActive){this.reportUserActivity();}};_proto.handleTechTouchEnd_=function handleTechTouchEnd_(event){if(event.cancelable){event.preventDefault();}};_proto.handleStageClick_=function handleStageClick_(){this.reportUserActivity();};_proto.toggleFullscreenClass_=function toggleFullscreenClass_(){if(this.isFullscreen()){this.addClass("vjs-fullscreen");}else {this.removeClass("vjs-fullscreen");}};_proto.documentFullscreenChange_=function documentFullscreenChange_(e){var targetPlayer=e.target.player;if(targetPlayer&&targetPlayer!==this){return}var el=this.el();var isFs=document_1[this.fsApi_.fullscreenElement]===el;if(!isFs&&el.matches){isFs=el.matches(":"+this.fsApi_.fullscreen);}else if(!isFs&&el.msMatchesSelector){isFs=el.msMatchesSelector(":"+this.fsApi_.fullscreen);}this.isFullscreen(isFs);};_proto.handleTechFullscreenChange_=function handleTechFullscreenChange_(event,data){var _this9=this;if(data){if(data.nativeIOSFullscreen){this.addClass("vjs-ios-native-fs");this.tech_.one("webkitendfullscreen",function(){_this9.removeClass("vjs-ios-native-fs");});}this.isFullscreen(data.isFullscreen);}};_proto.handleTechFullscreenError_=function handleTechFullscreenError_(event,err){this.trigger("fullscreenerror",err);};_proto.togglePictureInPictureClass_=function togglePictureInPictureClass_(){if(this.isInPictureInPicture()){this.addClass("vjs-picture-in-picture");}else {this.removeClass("vjs-picture-in-picture");}};_proto.handleTechEnterPictureInPicture_=function handleTechEnterPictureInPicture_(event){this.isInPictureInPicture(true);};_proto.handleTechLeavePictureInPicture_=function handleTechLeavePictureInPicture_(event){this.isInPictureInPicture(false);};_proto.handleTechError_=function handleTechError_(){var error=this.tech_.error();this.error(error);};_proto.handleTechTextData_=function handleTechTextData_(){var data=null;if(arguments.length>1){data=arguments[1];}this.trigger("textdata",data);};_proto.getCache=function getCache(){return this.cache_};_proto.resetCache_=function resetCache_(){this.cache_={currentTime:0,initTime:0,inactivityTimeout:this.options_.inactivityTimeout,duration:NaN,lastVolume:1,lastPlaybackRate:this.defaultPlaybackRate(),media:null,src:"",source:{},sources:[],playbackRates:[],volume:1};};_proto.techCall_=function techCall_(method,arg){this.ready(function(){if(method in allowedSetters){return set(this.middleware_,this.tech_,method,arg)}else if(method in allowedMediators){return mediate(this.middleware_,this.tech_,method,arg)}try{if(this.tech_){this.tech_[method](arg);}}catch(e){log$1(e);throw e}},true);};_proto.techGet_=function techGet_(method){if(!this.tech_||!this.tech_.isReady_){return}if(method in allowedGetters){return get(this.middleware_,this.tech_,method)}else if(method in allowedMediators){return mediate(this.middleware_,this.tech_,method)}try{return this.tech_[method]()}catch(e){if(this.tech_[method]===undefined){log$1("Video.js: "+method+" method not defined for "+this.techName_+" playback technology.",e);throw e}if(e.name==="TypeError"){log$1("Video.js: "+method+" unavailable on "+this.techName_+" playback technology element.",e);this.tech_.isReady_=false;throw e}log$1(e);throw e}};_proto.play=function play(){var _this10=this;var PromiseClass=this.options_.Promise||window_1.Promise;if(PromiseClass){return new PromiseClass(function(resolve){_this10.play_(resolve);})}return this.play_()};_proto.play_=function play_(callback){var _this11=this;if(callback===void 0){callback=silencePromise;}this.playCallbacks_.push(callback);var isSrcReady=Boolean(!this.changingSrc_&&(this.src()||this.currentSrc()));if(this.waitToPlay_){this.off(["ready","loadstart"],this.waitToPlay_);this.waitToPlay_=null;}if(!this.isReady_||!isSrcReady){this.waitToPlay_=function(e){_this11.play_();};this.one(["ready","loadstart"],this.waitToPlay_);if(!isSrcReady&&(IS_ANY_SAFARI||IS_IOS)){this.load();}return}var val=this.techGet_("play");if(val===null){this.runPlayTerminatedQueue_();}else {this.runPlayCallbacks_(val);}};_proto.runPlayTerminatedQueue_=function runPlayTerminatedQueue_(){var queue=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[];queue.forEach(function(q){q();});};_proto.runPlayCallbacks_=function runPlayCallbacks_(val){var callbacks=this.playCallbacks_.slice(0);this.playCallbacks_=[];this.playTerminatedQueue_=[];callbacks.forEach(function(cb){cb(val);});};_proto.pause=function pause(){this.techCall_("pause");};_proto.paused=function paused(){return this.techGet_("paused")===false?false:true};_proto.played=function played(){return this.techGet_("played")||createTimeRanges(0,0)};_proto.scrubbing=function scrubbing(isScrubbing){if(typeof isScrubbing==="undefined"){return this.scrubbing_}this.scrubbing_=!!isScrubbing;this.techCall_("setScrubbing",this.scrubbing_);if(isScrubbing){this.addClass("vjs-scrubbing");}else {this.removeClass("vjs-scrubbing");}};_proto.currentTime=function currentTime(seconds){if(typeof seconds!=="undefined"){if(seconds<0){seconds=0;}if(!this.isReady_||this.changingSrc_||!this.tech_||!this.tech_.isReady_){this.cache_.initTime=seconds;this.off("canplay",this.boundApplyInitTime_);this.one("canplay",this.boundApplyInitTime_);return}this.techCall_("setCurrentTime",seconds);this.cache_.initTime=0;return}this.cache_.currentTime=this.techGet_("currentTime")||0;return this.cache_.currentTime};_proto.applyInitTime_=function applyInitTime_(){this.currentTime(this.cache_.initTime);};_proto.duration=function duration(seconds){if(seconds===undefined){return this.cache_.duration!==undefined?this.cache_.duration:NaN}seconds=parseFloat(seconds);if(seconds<0){seconds=Infinity;}if(seconds!==this.cache_.duration){this.cache_.duration=seconds;if(seconds===Infinity){this.addClass("vjs-live");}else {this.removeClass("vjs-live");}if(!isNaN(seconds)){this.trigger("durationchange");}}};_proto.remainingTime=function remainingTime(){return this.duration()-this.currentTime()};_proto.remainingTimeDisplay=function remainingTimeDisplay(){return Math.floor(this.duration())-Math.floor(this.currentTime())};_proto.buffered=function buffered(){var buffered=this.techGet_("buffered");if(!buffered||!buffered.length){buffered=createTimeRanges(0,0);}return buffered};_proto.bufferedPercent=function bufferedPercent$1(){return bufferedPercent(this.buffered(),this.duration())};_proto.bufferedEnd=function bufferedEnd(){var buffered=this.buffered();var duration=this.duration();var end=buffered.end(buffered.length-1);if(end>duration){end=duration;}return end};_proto.volume=function volume(percentAsDecimal){var vol;if(percentAsDecimal!==undefined){vol=Math.max(0,Math.min(1,parseFloat(percentAsDecimal)));this.cache_.volume=vol;this.techCall_("setVolume",vol);if(vol>0){this.lastVolume_(vol);}return}vol=parseFloat(this.techGet_("volume"));return isNaN(vol)?1:vol};_proto.muted=function muted(_muted){if(_muted!==undefined){this.techCall_("setMuted",_muted);return}return this.techGet_("muted")||false};_proto.defaultMuted=function defaultMuted(_defaultMuted){if(_defaultMuted!==undefined){return this.techCall_("setDefaultMuted",_defaultMuted)}return this.techGet_("defaultMuted")||false};_proto.lastVolume_=function lastVolume_(percentAsDecimal){if(percentAsDecimal!==undefined&&percentAsDecimal!==0){this.cache_.lastVolume=percentAsDecimal;return}return this.cache_.lastVolume};_proto.supportsFullScreen=function supportsFullScreen(){return this.techGet_("supportsFullScreen")||false};_proto.isFullscreen=function isFullscreen(isFS){if(isFS!==undefined){var oldValue=this.isFullscreen_;this.isFullscreen_=Boolean(isFS);if(this.isFullscreen_!==oldValue&&this.fsApi_.prefixed){this.trigger("fullscreenchange");}this.toggleFullscreenClass_();return}return this.isFullscreen_};_proto.requestFullscreen=function requestFullscreen(fullscreenOptions){var PromiseClass=this.options_.Promise||window_1.Promise;if(PromiseClass){var self1=this;return new PromiseClass(function(resolve,reject){function offHandler(){self1.off("fullscreenerror",errorHandler);self1.off("fullscreenchange",changeHandler);}function changeHandler(){offHandler();resolve();}function errorHandler(e,err){offHandler();reject(err);}self1.one("fullscreenchange",changeHandler);self1.one("fullscreenerror",errorHandler);var promise=self1.requestFullscreenHelper_(fullscreenOptions);if(promise){promise.then(offHandler,offHandler);promise.then(resolve,reject);}})}return this.requestFullscreenHelper_()};_proto.requestFullscreenHelper_=function requestFullscreenHelper_(fullscreenOptions){var _this12=this;var fsOptions;if(!this.fsApi_.prefixed){fsOptions=this.options_.fullscreen&&this.options_.fullscreen.options||{};if(fullscreenOptions!==undefined){fsOptions=fullscreenOptions;}}if(this.fsApi_.requestFullscreen){var promise=this.el_[this.fsApi_.requestFullscreen](fsOptions);if(promise){promise.then(function(){return _this12.isFullscreen(true)},function(){return _this12.isFullscreen(false)});}return promise}else if(this.tech_.supportsFullScreen()&&!this.options_.preferFullWindow===true){this.techCall_("enterFullScreen");}else {this.enterFullWindow();}};_proto.exitFullscreen=function exitFullscreen(){var PromiseClass=this.options_.Promise||window_1.Promise;if(PromiseClass){var self1=this;return new PromiseClass(function(resolve,reject){function offHandler(){self1.off("fullscreenerror",errorHandler);self1.off("fullscreenchange",changeHandler);}function changeHandler(){offHandler();resolve();}function errorHandler(e,err){offHandler();reject(err);}self1.one("fullscreenchange",changeHandler);self1.one("fullscreenerror",errorHandler);var promise=self1.exitFullscreenHelper_();if(promise){promise.then(offHandler,offHandler);promise.then(resolve,reject);}})}return this.exitFullscreenHelper_()};_proto.exitFullscreenHelper_=function exitFullscreenHelper_(){var _this13=this;if(this.fsApi_.requestFullscreen){var promise=document_1[this.fsApi_.exitFullscreen]();if(promise){silencePromise(promise.then(function(){return _this13.isFullscreen(false)}));}return promise}else if(this.tech_.supportsFullScreen()&&!this.options_.preferFullWindow===true){this.techCall_("exitFullScreen");}else {this.exitFullWindow();}};_proto.enterFullWindow=function enterFullWindow(){this.isFullscreen(true);this.isFullWindow=true;this.docOrigOverflow=document_1.documentElement.style.overflow;on(document_1,"keydown",this.boundFullWindowOnEscKey_);document_1.documentElement.style.overflow="hidden";addClass(document_1.body,"vjs-full-window");this.trigger("enterFullWindow");};_proto.fullWindowOnEscKey=function fullWindowOnEscKey(event){if(keycode.isEventKey(event,"Esc")){if(this.isFullscreen()===true){if(!this.isFullWindow){this.exitFullscreen();}else {this.exitFullWindow();}}}};_proto.exitFullWindow=function exitFullWindow(){this.isFullscreen(false);this.isFullWindow=false;off(document_1,"keydown",this.boundFullWindowOnEscKey_);document_1.documentElement.style.overflow=this.docOrigOverflow;removeClass(document_1.body,"vjs-full-window");this.trigger("exitFullWindow");};_proto.disablePictureInPicture=function disablePictureInPicture(value){if(value===undefined){return this.techGet_("disablePictureInPicture")}this.techCall_("setDisablePictureInPicture",value);this.options_.disablePictureInPicture=value;this.trigger("disablepictureinpicturechanged");};_proto.isInPictureInPicture=function isInPictureInPicture(isPiP){if(isPiP!==undefined){this.isInPictureInPicture_=!!isPiP;this.togglePictureInPictureClass_();return}return !!this.isInPictureInPicture_};_proto.requestPictureInPicture=function requestPictureInPicture(){if("pictureInPictureEnabled"in document_1&&this.disablePictureInPicture()===false){return this.techGet_("requestPictureInPicture")}};_proto.exitPictureInPicture=function exitPictureInPicture(){if("pictureInPictureEnabled"in document_1){return document_1.exitPictureInPicture()}};_proto.handleKeyDown=function handleKeyDown(event){var userActions=this.options_.userActions;if(!userActions||!userActions.hotkeys){return}var excludeElement=function excludeElement(el){var tagName=el.tagName.toLowerCase();if(el.isContentEditable){return true}var allowedInputTypes=["button","checkbox","hidden","radio","reset","submit"];if(tagName==="input"){return allowedInputTypes.indexOf(el.type)===-1}var excludedTags=["textarea"];return excludedTags.indexOf(tagName)!==-1};if(excludeElement(this.el_.ownerDocument.activeElement)){return}if(typeof userActions.hotkeys==="function"){userActions.hotkeys.call(this,event);}else {this.handleHotkeys(event);}};_proto.handleHotkeys=function handleHotkeys(event){var hotkeys=this.options_.userActions?this.options_.userActions.hotkeys:{};var _hotkeys$fullscreenKe=hotkeys.fullscreenKey,fullscreenKey=_hotkeys$fullscreenKe===void 0?function(keydownEvent){return keycode.isEventKey(keydownEvent,"f")}:_hotkeys$fullscreenKe,_hotkeys$muteKey=hotkeys.muteKey,muteKey=_hotkeys$muteKey===void 0?function(keydownEvent){return keycode.isEventKey(keydownEvent,"m")}:_hotkeys$muteKey,_hotkeys$playPauseKey=hotkeys.playPauseKey,playPauseKey=_hotkeys$playPauseKey===void 0?function(keydownEvent){return keycode.isEventKey(keydownEvent,"k")||keycode.isEventKey(keydownEvent,"Space")}:_hotkeys$playPauseKey;if(fullscreenKey.call(this,event)){event.preventDefault();event.stopPropagation();var FSToggle=Component$1.getComponent("FullscreenToggle");if(document_1[this.fsApi_.fullscreenEnabled]!==false){FSToggle.prototype.handleClick.call(this,event);}}else if(muteKey.call(this,event)){event.preventDefault();event.stopPropagation();var MuteToggle=Component$1.getComponent("MuteToggle");MuteToggle.prototype.handleClick.call(this,event);}else if(playPauseKey.call(this,event)){event.preventDefault();event.stopPropagation();var PlayToggle=Component$1.getComponent("PlayToggle");PlayToggle.prototype.handleClick.call(this,event);}};_proto.canPlayType=function canPlayType(type){var can;for(var i=0,j=this.options_.techOrder;i<j.length;i++){var techName=j[i];var tech=Tech.getTech(techName);if(!tech){tech=Component$1.getComponent(techName);}if(!tech){log$1.error('The "'+techName+'" tech is undefined. Skipped browser support check for that tech.');continue}if(tech.isSupported()){can=tech.canPlayType(type);if(can){return can}}}return ""};_proto.selectSource=function selectSource(sources){var _this14=this;var techs=this.options_.techOrder.map(function(techName){return [techName,Tech.getTech(techName)]}).filter(function(_ref){var techName=_ref[0],tech=_ref[1];if(tech){return tech.isSupported()}log$1.error('The "'+techName+'" tech is undefined. Skipped browser support check for that tech.');return false});var findFirstPassingTechSourcePair=function findFirstPassingTechSourcePair(outerArray,innerArray,tester){var found;outerArray.some(function(outerChoice){return innerArray.some(function(innerChoice){found=tester(outerChoice,innerChoice);if(found){return true}})});return found};var foundSourceAndTech;var flip=function flip(fn){return function(a,b){return fn(b,a)}};var finder=function finder(_ref2,source){var techName=_ref2[0],tech=_ref2[1];if(tech.canPlaySource(source,_this14.options_[techName.toLowerCase()])){return {source:source,tech:techName}}};if(this.options_.sourceOrder){foundSourceAndTech=findFirstPassingTechSourcePair(sources,techs,flip(finder));}else {foundSourceAndTech=findFirstPassingTechSourcePair(techs,sources,finder);}return foundSourceAndTech||false};_proto.handleSrc_=function handleSrc_(source,isRetry){var _this15=this;if(typeof source==="undefined"){return this.cache_.src||""}if(this.resetRetryOnError_){this.resetRetryOnError_();}var sources=filterSource(source);if(!sources.length){this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage});},0);return}this.changingSrc_=true;if(!isRetry){this.cache_.sources=sources;}this.updateSourceCaches_(sources[0]);setSource(this,sources[0],function(middlewareSource,mws){_this15.middleware_=mws;if(!isRetry){_this15.cache_.sources=sources;}_this15.updateSourceCaches_(middlewareSource);var err=_this15.src_(middlewareSource);if(err){if(sources.length>1){return _this15.handleSrc_(sources.slice(1))}_this15.changingSrc_=false;_this15.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage});},0);_this15.triggerReady();return}setTech(mws,_this15.tech_);});if(this.options_.retryOnError&&sources.length>1){var retry=function retry(){_this15.error(null);_this15.handleSrc_(sources.slice(1),true);};var stopListeningForErrors=function stopListeningForErrors(){_this15.off("error",retry);};this.one("error",retry);this.one("playing",stopListeningForErrors);this.resetRetryOnError_=function(){_this15.off("error",retry);_this15.off("playing",stopListeningForErrors);};}};_proto.src=function src(source){return this.handleSrc_(source,false)};_proto.src_=function src_(source){var _this16=this;var sourceTech=this.selectSource([source]);if(!sourceTech){return true}if(!titleCaseEquals(sourceTech.tech,this.techName_)){this.changingSrc_=true;this.loadTech_(sourceTech.tech,sourceTech.source);this.tech_.ready(function(){_this16.changingSrc_=false;});return false}this.ready(function(){if(this.tech_.constructor.prototype.hasOwnProperty("setSource")){this.techCall_("setSource",source);}else {this.techCall_("src",source.src);}this.changingSrc_=false;},true);return false};_proto.load=function load(){this.techCall_("load");};_proto.reset=function reset(){var _this17=this;var PromiseClass=this.options_.Promise||window_1.Promise;if(this.paused()||!PromiseClass){this.doReset_();}else {var playPromise=this.play();silencePromise(playPromise.then(function(){return _this17.doReset_()}));}};_proto.doReset_=function doReset_(){if(this.tech_){this.tech_.clearTracks("text");}this.resetCache_();this.poster("");this.loadTech_(this.options_.techOrder[0],null);this.techCall_("reset");this.resetControlBarUI_();if(isEvented(this)){this.trigger("playerreset");}};_proto.resetControlBarUI_=function resetControlBarUI_(){this.resetProgressBar_();this.resetPlaybackRate_();this.resetVolumeBar_();};_proto.resetProgressBar_=function resetProgressBar_(){this.currentTime(0);var _ref3=this.controlBar||{},durationDisplay=_ref3.durationDisplay,remainingTimeDisplay=_ref3.remainingTimeDisplay;if(durationDisplay){durationDisplay.updateContent();}if(remainingTimeDisplay){remainingTimeDisplay.updateContent();}};_proto.resetPlaybackRate_=function resetPlaybackRate_(){this.playbackRate(this.defaultPlaybackRate());this.handleTechRateChange_();};_proto.resetVolumeBar_=function resetVolumeBar_(){this.volume(1);this.trigger("volumechange");};_proto.currentSources=function currentSources(){var source=this.currentSource();var sources=[];if(Object.keys(source).length!==0){sources.push(source);}return this.cache_.sources||sources};_proto.currentSource=function currentSource(){return this.cache_.source||{}};_proto.currentSrc=function currentSrc(){return this.currentSource()&&this.currentSource().src||""};_proto.currentType=function currentType(){return this.currentSource()&&this.currentSource().type||""};_proto.preload=function preload(value){if(value!==undefined){this.techCall_("setPreload",value);this.options_.preload=value;return}return this.techGet_("preload")};_proto.autoplay=function autoplay(value){if(value===undefined){return this.options_.autoplay||false}var techAutoplay;if(typeof value==="string"&&/(any|play|muted)/.test(value)||value===true&&this.options_.normalizeAutoplay){this.options_.autoplay=value;this.manualAutoplay_(typeof value==="string"?value:"play");techAutoplay=false;}else if(!value){this.options_.autoplay=false;}else {this.options_.autoplay=true;}techAutoplay=typeof techAutoplay==="undefined"?this.options_.autoplay:techAutoplay;if(this.tech_){this.techCall_("setAutoplay",techAutoplay);}};_proto.playsinline=function playsinline(value){if(value!==undefined){this.techCall_("setPlaysinline",value);this.options_.playsinline=value;return this}return this.techGet_("playsinline")};_proto.loop=function loop(value){if(value!==undefined){this.techCall_("setLoop",value);this.options_.loop=value;return}return this.techGet_("loop")};_proto.poster=function poster(src){if(src===undefined){return this.poster_}if(!src){src="";}if(src===this.poster_){return}this.poster_=src;this.techCall_("setPoster",src);this.isPosterFromTech_=false;this.trigger("posterchange");};_proto.handleTechPosterChange_=function handleTechPosterChange_(){if((!this.poster_||this.options_.techCanOverridePoster)&&this.tech_&&this.tech_.poster){var newPoster=this.tech_.poster()||"";if(newPoster!==this.poster_){this.poster_=newPoster;this.isPosterFromTech_=true;this.trigger("posterchange");}}};_proto.controls=function controls(bool){if(bool===undefined){return !!this.controls_}bool=!!bool;if(this.controls_===bool){return}this.controls_=bool;if(this.usingNativeControls()){this.techCall_("setControls",bool);}if(this.controls_){this.removeClass("vjs-controls-disabled");this.addClass("vjs-controls-enabled");this.trigger("controlsenabled");if(!this.usingNativeControls()){this.addTechControlsListeners_();}}else {this.removeClass("vjs-controls-enabled");this.addClass("vjs-controls-disabled");this.trigger("controlsdisabled");if(!this.usingNativeControls()){this.removeTechControlsListeners_();}}};_proto.usingNativeControls=function usingNativeControls(bool){if(bool===undefined){return !!this.usingNativeControls_}bool=!!bool;if(this.usingNativeControls_===bool){return}this.usingNativeControls_=bool;if(this.usingNativeControls_){this.addClass("vjs-using-native-controls");this.trigger("usingnativecontrols");}else {this.removeClass("vjs-using-native-controls");this.trigger("usingcustomcontrols");}};_proto.error=function error(err){var _this18=this;if(err===undefined){return this.error_||null}hooks("beforeerror").forEach(function(hookFunction){var newErr=hookFunction(_this18,err);if(!(isObject(newErr)&&!Array.isArray(newErr)||typeof newErr==="string"||typeof newErr==="number"||newErr===null)){_this18.log.error("please return a value that MediaError expects in beforeerror hooks");return}err=newErr;});if(this.options_.suppressNotSupportedError&&err&&err.code===4){var triggerSuppressedError=function triggerSuppressedError(){this.error(err);};this.options_.suppressNotSupportedError=false;this.any(["click","touchstart"],triggerSuppressedError);this.one("loadstart",function(){this.off(["click","touchstart"],triggerSuppressedError);});return}if(err===null){this.error_=err;this.removeClass("vjs-error");if(this.errorDisplay){this.errorDisplay.close();}return}this.error_=new MediaError(err);this.addClass("vjs-error");log$1.error("(CODE:"+this.error_.code+" "+MediaError.errorTypes[this.error_.code]+")",this.error_.message,this.error_);this.trigger("error");hooks("error").forEach(function(hookFunction){return hookFunction(_this18,_this18.error_)});return};_proto.reportUserActivity=function reportUserActivity(event){this.userActivity_=true;};_proto.userActive=function userActive(bool){if(bool===undefined){return this.userActive_}bool=!!bool;if(bool===this.userActive_){return}this.userActive_=bool;if(this.userActive_){this.userActivity_=true;this.removeClass("vjs-user-inactive");this.addClass("vjs-user-active");this.trigger("useractive");return}if(this.tech_){this.tech_.one("mousemove",function(e){e.stopPropagation();e.preventDefault();});}this.userActivity_=false;this.removeClass("vjs-user-active");this.addClass("vjs-user-inactive");this.trigger("userinactive");};_proto.listenForUserActivity_=function listenForUserActivity_(){var mouseInProgress;var lastMoveX;var lastMoveY;var handleActivity=bind(this,this.reportUserActivity);var handleMouseMove=function handleMouseMove(e){if(e.screenX!==lastMoveX||e.screenY!==lastMoveY){lastMoveX=e.screenX;lastMoveY=e.screenY;handleActivity();}};var handleMouseDown=function handleMouseDown(){handleActivity();this.clearInterval(mouseInProgress);mouseInProgress=this.setInterval(handleActivity,250);};var handleMouseUpAndMouseLeave=function handleMouseUpAndMouseLeave(event){handleActivity();this.clearInterval(mouseInProgress);};this.on("mousedown",handleMouseDown);this.on("mousemove",handleMouseMove);this.on("mouseup",handleMouseUpAndMouseLeave);this.on("mouseleave",handleMouseUpAndMouseLeave);var controlBar=this.getChild("controlBar");if(controlBar&&!IS_IOS&&!IS_ANDROID){controlBar.on("mouseenter",function(event){if(this.player().options_.inactivityTimeout!==0){this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout;}this.player().options_.inactivityTimeout=0;});controlBar.on("mouseleave",function(event){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout;});}this.on("keydown",handleActivity);this.on("keyup",handleActivity);var inactivityTimeout;this.setInterval(function(){if(!this.userActivity_){return}this.userActivity_=false;this.userActive(true);this.clearTimeout(inactivityTimeout);var timeout=this.options_.inactivityTimeout;if(timeout<=0){return}inactivityTimeout=this.setTimeout(function(){if(!this.userActivity_){this.userActive(false);}},timeout);},250);};_proto.playbackRate=function playbackRate(rate){if(rate!==undefined){this.techCall_("setPlaybackRate",rate);return}if(this.tech_&&this.tech_.featuresPlaybackRate){return this.cache_.lastPlaybackRate||this.techGet_("playbackRate")}return 1};_proto.defaultPlaybackRate=function defaultPlaybackRate(rate){if(rate!==undefined){return this.techCall_("setDefaultPlaybackRate",rate)}if(this.tech_&&this.tech_.featuresPlaybackRate){return this.techGet_("defaultPlaybackRate")}return 1};_proto.isAudio=function isAudio(bool){if(bool!==undefined){this.isAudio_=!!bool;return}return !!this.isAudio_};_proto.enableAudioOnlyUI_=function enableAudioOnlyUI_(){var _this19=this;this.addClass("vjs-audio-only-mode");var playerChildren=this.children();var controlBar=this.getChild("ControlBar");var controlBarHeight=controlBar&&controlBar.currentHeight();playerChildren.forEach(function(child){if(child===controlBar){return}if(child.el_&&!child.hasClass("vjs-hidden")){child.hide();_this19.audioOnlyCache_.hiddenChildren.push(child);}});this.audioOnlyCache_.playerHeight=this.currentHeight();this.height(controlBarHeight);this.trigger("audioonlymodechange");};_proto.disableAudioOnlyUI_=function disableAudioOnlyUI_(){this.removeClass("vjs-audio-only-mode");this.audioOnlyCache_.hiddenChildren.forEach(function(child){return child.show()});this.height(this.audioOnlyCache_.playerHeight);this.trigger("audioonlymodechange");};_proto.audioOnlyMode=function audioOnlyMode(value){var _this20=this;if(typeof value!=="boolean"||value===this.audioOnlyMode_){return this.audioOnlyMode_}this.audioOnlyMode_=value;var PromiseClass=this.options_.Promise||window_1.Promise;if(PromiseClass){if(value){var exitPromises=[];if(this.isInPictureInPicture()){exitPromises.push(this.exitPictureInPicture());}if(this.isFullscreen()){exitPromises.push(this.exitFullscreen());}if(this.audioPosterMode()){exitPromises.push(this.audioPosterMode(false));}return PromiseClass.all(exitPromises).then(function(){return _this20.enableAudioOnlyUI_()})}return PromiseClass.resolve().then(function(){return _this20.disableAudioOnlyUI_()})}if(value){if(this.isInPictureInPicture()){this.exitPictureInPicture();}if(this.isFullscreen()){this.exitFullscreen();}this.enableAudioOnlyUI_();}else {this.disableAudioOnlyUI_();}};_proto.enablePosterModeUI_=function enablePosterModeUI_(){var tech=this.tech_&&this.tech_;tech.hide();this.addClass("vjs-audio-poster-mode");this.trigger("audiopostermodechange");};_proto.disablePosterModeUI_=function disablePosterModeUI_(){var tech=this.tech_&&this.tech_;tech.show();this.removeClass("vjs-audio-poster-mode");this.trigger("audiopostermodechange");};_proto.audioPosterMode=function audioPosterMode(value){var _this21=this;if(typeof value!=="boolean"||value===this.audioPosterMode_){return this.audioPosterMode_}this.audioPosterMode_=value;var PromiseClass=this.options_.Promise||window_1.Promise;if(PromiseClass){if(value){if(this.audioOnlyMode()){var audioOnlyModePromise=this.audioOnlyMode(false);return audioOnlyModePromise.then(function(){_this21.enablePosterModeUI_();})}return PromiseClass.resolve().then(function(){_this21.enablePosterModeUI_();})}return PromiseClass.resolve().then(function(){_this21.disablePosterModeUI_();})}if(value){if(this.audioOnlyMode()){this.audioOnlyMode(false);}this.enablePosterModeUI_();return}this.disablePosterModeUI_();};_proto.addTextTrack=function addTextTrack(kind,label,language){if(this.tech_){return this.tech_.addTextTrack(kind,label,language)}};_proto.addRemoteTextTrack=function addRemoteTextTrack(options,manualCleanup){if(this.tech_){return this.tech_.addRemoteTextTrack(options,manualCleanup)}};_proto.removeRemoteTextTrack=function removeRemoteTextTrack(obj){if(obj===void 0){obj={};}var _obj=obj,track=_obj.track;if(!track){track=obj;}if(this.tech_){return this.tech_.removeRemoteTextTrack(track)}};_proto.getVideoPlaybackQuality=function getVideoPlaybackQuality(){return this.techGet_("getVideoPlaybackQuality")};_proto.videoWidth=function videoWidth(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0};_proto.videoHeight=function videoHeight(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0};_proto.language=function language(code){if(code===undefined){return this.language_}if(this.language_!==String(code).toLowerCase()){this.language_=String(code).toLowerCase();if(isEvented(this)){this.trigger("languagechange");}}};_proto.languages=function languages(){return mergeOptions$3(Player.prototype.options_.languages,this.languages_)};_proto.toJSON=function toJSON(){var options=mergeOptions$3(this.options_);var tracks=options.tracks;options.tracks=[];for(var i=0;i<tracks.length;i++){var track=tracks[i];track=mergeOptions$3(track);track.player=undefined;options.tracks[i]=track;}return options};_proto.createModal=function createModal(content,options){var _this22=this;options=options||{};options.content=content||"";var modal=new ModalDialog(this,options);this.addChild(modal);modal.on("dispose",function(){_this22.removeChild(modal);});modal.open();return modal};_proto.updateCurrentBreakpoint_=function updateCurrentBreakpoint_(){if(!this.responsive()){return}var currentBreakpoint=this.currentBreakpoint();var currentWidth=this.currentWidth();for(var i=0;i<BREAKPOINT_ORDER.length;i++){var candidateBreakpoint=BREAKPOINT_ORDER[i];var maxWidth=this.breakpoints_[candidateBreakpoint];if(currentWidth<=maxWidth){if(currentBreakpoint===candidateBreakpoint){return}if(currentBreakpoint){this.removeClass(BREAKPOINT_CLASSES[currentBreakpoint]);}this.addClass(BREAKPOINT_CLASSES[candidateBreakpoint]);this.breakpoint_=candidateBreakpoint;break}}};_proto.removeCurrentBreakpoint_=function removeCurrentBreakpoint_(){var className=this.currentBreakpointClass();this.breakpoint_="";if(className){this.removeClass(className);}};_proto.breakpoints=function breakpoints(_breakpoints){if(_breakpoints===undefined){return assign(this.breakpoints_)}this.breakpoint_="";this.breakpoints_=assign({},DEFAULT_BREAKPOINTS,_breakpoints);this.updateCurrentBreakpoint_();return assign(this.breakpoints_)};_proto.responsive=function responsive(value){if(value===undefined){return this.responsive_}value=Boolean(value);var current=this.responsive_;if(value===current){return}this.responsive_=value;if(value){this.on("playerresize",this.boundUpdateCurrentBreakpoint_);this.updateCurrentBreakpoint_();}else {this.off("playerresize",this.boundUpdateCurrentBreakpoint_);this.removeCurrentBreakpoint_();}return value};_proto.currentBreakpoint=function currentBreakpoint(){return this.breakpoint_};_proto.currentBreakpointClass=function currentBreakpointClass(){return BREAKPOINT_CLASSES[this.breakpoint_]||""};_proto.loadMedia=function loadMedia(media,ready){var _this23=this;if(!media||typeof media!=="object"){return}this.reset();this.cache_.media=mergeOptions$3(media);var _this$cache_$media=this.cache_.media,artwork=_this$cache_$media.artwork,poster=_this$cache_$media.poster,src=_this$cache_$media.src,textTracks=_this$cache_$media.textTracks;if(!artwork&&poster){this.cache_.media.artwork=[{src:poster,type:getMimetype(poster)}];}if(src){this.src(src);}if(poster){this.poster(poster);}if(Array.isArray(textTracks)){textTracks.forEach(function(tt){return _this23.addRemoteTextTrack(tt,false)});}this.ready(ready);};_proto.getMedia=function getMedia(){if(!this.cache_.media){var poster=this.poster();var src=this.currentSources();var textTracks=Array.prototype.map.call(this.remoteTextTracks(),function(tt){return {kind:tt.kind,label:tt.label,language:tt.language,src:tt.src}});var media={src:src,textTracks:textTracks};if(poster){media.poster=poster;media.artwork=[{src:media.poster,type:getMimetype(media.poster)}];}return media}return mergeOptions$3(this.cache_.media)};Player.getTagSettings=function getTagSettings(tag){var baseOptions={sources:[],tracks:[]};var tagOptions=getAttributes(tag);var dataSetup=tagOptions["data-setup"];if(hasClass(tag,"vjs-fill")){tagOptions.fill=true;}if(hasClass(tag,"vjs-fluid")){tagOptions.fluid=true;}if(dataSetup!==null){var _safeParseTuple=tuple(dataSetup||"{}"),err=_safeParseTuple[0],data=_safeParseTuple[1];if(err){log$1.error(err);}assign(tagOptions,data);}assign(baseOptions,tagOptions);if(tag.hasChildNodes()){var children=tag.childNodes;for(var i=0,j=children.length;i<j;i++){var child=children[i];var childName=child.nodeName.toLowerCase();if(childName==="source"){baseOptions.sources.push(getAttributes(child));}else if(childName==="track"){baseOptions.tracks.push(getAttributes(child));}}}return baseOptions};_proto.flexNotSupported_=function flexNotSupported_(){var elem=document_1.createElement("i");return !("flexBasis"in elem.style||"webkitFlexBasis"in elem.style||"mozFlexBasis"in elem.style||"msFlexBasis"in elem.style||"msFlexOrder"in elem.style)};_proto.debug=function debug(enabled){if(enabled===undefined){return this.debugEnabled_}if(enabled){this.trigger("debugon");this.previousLogLevel_=this.log.level;this.log.level("debug");this.debugEnabled_=true;}else {this.trigger("debugoff");this.log.level(this.previousLogLevel_);this.previousLogLevel_=undefined;this.debugEnabled_=false;}};_proto.playbackRates=function playbackRates(newRates){if(newRates===undefined){return this.cache_.playbackRates}if(!Array.isArray(newRates)){return}if(!newRates.every(function(rate){return typeof rate==="number"})){return}this.cache_.playbackRates=newRates;this.trigger("playbackrateschange");};return Player}(Component$1);ALL.names.forEach(function(name){var props=ALL[name];Player.prototype[props.getterName]=function(){if(this.tech_){return this.tech_[props.getterName]()}this[props.privateName]=this[props.privateName]||new props.ListClass;return this[props.privateName]};});Player.prototype.crossorigin=Player.prototype.crossOrigin;Player.players={};var navigator=window_1.navigator;Player.prototype.options_={techOrder:Tech.defaultTechOrder_,html5:{},inactivityTimeout:2e3,playbackRates:[],liveui:false,children:["mediaLoader","posterImage","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:navigator&&(navigator.languages&&navigator.languages[0]||navigator.userLanguage||navigator.language)||"en",languages:{},notSupportedMessage:"No compatible source was found for this media.",normalizeAutoplay:false,fullscreen:{options:{navigationUI:"hide"}},breakpoints:{},responsive:false,audioOnlyMode:false,audioPosterMode:false};["ended","seeking","seekable","networkState","readyState"].forEach(function(fn){Player.prototype[fn]=function(){return this.techGet_(fn)};});TECH_EVENTS_RETRIGGER.forEach(function(event){Player.prototype["handleTech"+toTitleCase$1(event)+"_"]=function(){return this.trigger(event)};});Component$1.registerComponent("Player",Player);var BASE_PLUGIN_NAME="plugin";var PLUGIN_CACHE_KEY="activePlugins_";var pluginStorage={};var pluginExists=function pluginExists(name){return pluginStorage.hasOwnProperty(name)};var getPlugin=function getPlugin(name){return pluginExists(name)?pluginStorage[name]:undefined};var markPluginAsActive=function markPluginAsActive(player,name){player[PLUGIN_CACHE_KEY]=player[PLUGIN_CACHE_KEY]||{};player[PLUGIN_CACHE_KEY][name]=true;};var triggerSetupEvent=function triggerSetupEvent(player,hash,before){var eventName=(before?"before":"")+"pluginsetup";player.trigger(eventName,hash);player.trigger(eventName+":"+hash.name,hash);};var createBasicPlugin=function createBasicPlugin(name,plugin){var basicPluginWrapper=function basicPluginWrapper(){triggerSetupEvent(this,{name:name,plugin:plugin,instance:null},true);var instance=plugin.apply(this,arguments);markPluginAsActive(this,name);triggerSetupEvent(this,{name:name,plugin:plugin,instance:instance});return instance};Object.keys(plugin).forEach(function(prop){basicPluginWrapper[prop]=plugin[prop];});return basicPluginWrapper};var createPluginFactory=function createPluginFactory(name,PluginSubClass){PluginSubClass.prototype.name=name;return function(){triggerSetupEvent(this,{name:name,plugin:PluginSubClass,instance:null},true);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}var instance=_construct(PluginSubClass,[this].concat(args));this[name]=function(){return instance};triggerSetupEvent(this,instance.getEventHash());return instance}};var Plugin=function(){function Plugin(player){if(this.constructor===Plugin){throw new Error("Plugin must be sub-classed; not directly instantiated.")}this.player=player;if(!this.log){this.log=this.player.log.createLogger(this.name);}evented(this);delete this.trigger;stateful(this,this.constructor.defaultState);markPluginAsActive(player,this.name);this.dispose=this.dispose.bind(this);player.on("dispose",this.dispose);}var _proto=Plugin.prototype;_proto.version=function version(){return this.constructor.VERSION};_proto.getEventHash=function getEventHash(hash){if(hash===void 0){hash={};}hash.name=this.name;hash.plugin=this.constructor;hash.instance=this;return hash};_proto.trigger=function trigger$1(event,hash){if(hash===void 0){hash={};}return trigger(this.eventBusEl_,event,this.getEventHash(hash))};_proto.handleStateChanged=function handleStateChanged(e){};_proto.dispose=function dispose(){var name=this.name,player=this.player;this.trigger("dispose");this.off();player.off("dispose",this.dispose);player[PLUGIN_CACHE_KEY][name]=false;this.player=this.state=null;player[name]=createPluginFactory(name,pluginStorage[name]);};Plugin.isBasic=function isBasic(plugin){var p=typeof plugin==="string"?getPlugin(plugin):plugin;return typeof p==="function"&&!Plugin.prototype.isPrototypeOf(p.prototype)};Plugin.registerPlugin=function registerPlugin(name,plugin){if(typeof name!=="string"){throw new Error('Illegal plugin name, "'+name+'", must be a string, was '+typeof name+".")}if(pluginExists(name)){log$1.warn('A plugin named "'+name+'" already exists. You may want to avoid re-registering plugins!');}else if(Player.prototype.hasOwnProperty(name)){throw new Error('Illegal plugin name, "'+name+'", cannot share a name with an existing player method!')}if(typeof plugin!=="function"){throw new Error('Illegal plugin for "'+name+'", must be a function, was '+typeof plugin+".")}pluginStorage[name]=plugin;if(name!==BASE_PLUGIN_NAME){if(Plugin.isBasic(plugin)){Player.prototype[name]=createBasicPlugin(name,plugin);}else {Player.prototype[name]=createPluginFactory(name,plugin);}}return plugin};Plugin.deregisterPlugin=function deregisterPlugin(name){if(name===BASE_PLUGIN_NAME){throw new Error("Cannot de-register base plugin.")}if(pluginExists(name)){delete pluginStorage[name];delete Player.prototype[name];}};Plugin.getPlugins=function getPlugins(names){if(names===void 0){names=Object.keys(pluginStorage);}var result;names.forEach(function(name){var plugin=getPlugin(name);if(plugin){result=result||{};result[name]=plugin;}});return result};Plugin.getPluginVersion=function getPluginVersion(name){var plugin=getPlugin(name);return plugin&&plugin.VERSION||""};return Plugin}();Plugin.getPlugin=getPlugin;Plugin.BASE_PLUGIN_NAME=BASE_PLUGIN_NAME;Plugin.registerPlugin(BASE_PLUGIN_NAME,Plugin);Player.prototype.usingPlugin=function(name){return !!this[PLUGIN_CACHE_KEY]&&this[PLUGIN_CACHE_KEY][name]===true};Player.prototype.hasPlugin=function(name){return !!pluginExists(name)};var hasLogged=false;var extend=function extend(superClass,subClassMethods){if(subClassMethods===void 0){subClassMethods={};}if(!hasLogged){log$1.warn("videojs.extend is deprecated as of Video.js 7.22.0 and will be removed in Video.js 8.0.0");hasLogged=true;}var subClass=function subClass(){superClass.apply(this,arguments);};var methods={};if(typeof subClassMethods==="object"){if(subClassMethods.constructor!==Object.prototype.constructor){subClass=subClassMethods.constructor;}methods=subClassMethods;}else if(typeof subClassMethods==="function"){subClass=subClassMethods;}_inherits(subClass,superClass);if(superClass){subClass.super_=superClass;}for(var name in methods){if(methods.hasOwnProperty(name)){subClass.prototype[name]=methods[name];}}return subClass};var normalizeId=function normalizeId(id){return id.indexOf("#")===0?id.slice(1):id};function videojs(id,options,ready){var player=videojs.getPlayer(id);if(player){if(options){log$1.warn('Player "'+id+'" is already initialised. Options will not be applied.');}if(ready){player.ready(ready);}return player}var el=typeof id==="string"?$("#"+normalizeId(id)):id;if(!isEl(el)){throw new TypeError("The element or ID supplied is not valid. (videojs)")}if(!el.ownerDocument.defaultView||!el.ownerDocument.body.contains(el)){log$1.warn("The element supplied is not included in the DOM");}options=options||{};if(options.restoreEl===true){options.restoreEl=(el.parentNode&&el.parentNode.hasAttribute("data-vjs-player")?el.parentNode:el).cloneNode(true);}hooks("beforesetup").forEach(function(hookFunction){var opts=hookFunction(el,mergeOptions$3(options));if(!isObject(opts)||Array.isArray(opts)){log$1.error("please return an object in beforesetup hooks");return}options=mergeOptions$3(options,opts);});var PlayerComponent=Component$1.getComponent("Player");player=new PlayerComponent(el,options,ready);hooks("setup").forEach(function(hookFunction){return hookFunction(player)});return player}videojs.hooks_=hooks_;videojs.hooks=hooks;videojs.hook=hook;videojs.hookOnce=hookOnce;videojs.removeHook=removeHook;if(window_1.VIDEOJS_NO_DYNAMIC_STYLE!==true&&isReal()){var style=$(".vjs-styles-defaults");if(!style){style=createStyleElement("vjs-styles-defaults");var head=$("head");if(head){head.insertBefore(style,head.firstChild);}setTextContent(style,"\n .video-js {\n width: 300px;\n height: 150px;\n }\n\n .vjs-fluid:not(.vjs-audio-only-mode) {\n padding-top: 56.25%\n }\n ");}}autoSetupTimeout(1,videojs);videojs.VERSION=version$5;videojs.options=Player.prototype.options_;videojs.getPlayers=function(){return Player.players};videojs.getPlayer=function(id){var players=Player.players;var tag;if(typeof id==="string"){var nId=normalizeId(id);var player=players[nId];if(player){return player}tag=$("#"+nId);}else {tag=id;}if(isEl(tag)){var _tag=tag,_player=_tag.player,playerId=_tag.playerId;if(_player||players[playerId]){return _player||players[playerId]}}};videojs.getAllPlayers=function(){return Object.keys(Player.players).map(function(k){return Player.players[k]}).filter(Boolean)};videojs.players=Player.players;videojs.getComponent=Component$1.getComponent;videojs.registerComponent=function(name,comp){if(Tech.isTech(comp)){log$1.warn("The "+name+" tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)");}Component$1.registerComponent.call(Component$1,name,comp);};videojs.getTech=Tech.getTech;videojs.registerTech=Tech.registerTech;videojs.use=use;Object.defineProperty(videojs,"middleware",{value:{},writeable:false,enumerable:true});Object.defineProperty(videojs.middleware,"TERMINATOR",{value:TERMINATOR,writeable:false,enumerable:true});videojs.browser=browser;videojs.TOUCH_ENABLED=TOUCH_ENABLED;videojs.extend=extend;videojs.mergeOptions=mergeOptions$3;videojs.bind=bind;videojs.registerPlugin=Plugin.registerPlugin;videojs.deregisterPlugin=Plugin.deregisterPlugin;videojs.plugin=function(name,plugin){log$1.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead");return Plugin.registerPlugin(name,plugin)};videojs.getPlugins=Plugin.getPlugins;videojs.getPlugin=Plugin.getPlugin;videojs.getPluginVersion=Plugin.getPluginVersion;videojs.addLanguage=function(code,data){var _mergeOptions;code=(""+code).toLowerCase();videojs.options.languages=mergeOptions$3(videojs.options.languages,(_mergeOptions={},_mergeOptions[code]=data,_mergeOptions));return videojs.options.languages[code]};videojs.log=log$1;videojs.createLogger=createLogger;videojs.createTimeRange=videojs.createTimeRanges=createTimeRanges;videojs.formatTime=formatTime;videojs.setFormatTime=setFormatTime;videojs.resetFormatTime=resetFormatTime;videojs.parseUrl=parseUrl;videojs.isCrossOrigin=isCrossOrigin;videojs.EventTarget=EventTarget$2;videojs.on=on;videojs.one=one;videojs.off=off;videojs.trigger=trigger;videojs.xhr=lib.exports;videojs.TextTrack=TextTrack;videojs.AudioTrack=AudioTrack;videojs.VideoTrack=VideoTrack;["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach(function(k){videojs[k]=function(){log$1.warn("videojs."+k+"() is deprecated; use videojs.dom."+k+"() instead");return Dom[k].apply(null,arguments)};});videojs.computedStyle=computedStyle;videojs.dom=Dom;videojs.url=Url;videojs.defineLazyProperty=defineLazyProperty;videojs.addLanguage("en",{"Non-Fullscreen":"Exit Fullscreen"});/*! @name @videojs/http-streaming @version 2.16.0 @license Apache-2.0 */var resolveUrl=resolveUrl$1;var resolveManifestRedirect=function resolveManifestRedirect(handleManifestRedirect,url,req){if(handleManifestRedirect&&req&&req.responseURL&&url!==req.responseURL){return req.responseURL}return url};var logger=function logger(source){if(videojs.log.debug){return videojs.log.debug.bind(videojs,"VHS:",source+" >")}return function(){}};var TIME_FUDGE_FACTOR=1/30;var SAFE_TIME_DELTA=TIME_FUDGE_FACTOR*3;var filterRanges=function filterRanges(timeRanges,predicate){var results=[];var i;if(timeRanges&&timeRanges.length){for(i=0;i<timeRanges.length;i++){if(predicate(timeRanges.start(i),timeRanges.end(i))){results.push([timeRanges.start(i),timeRanges.end(i)]);}}}return videojs.createTimeRanges(results)};var findRange=function findRange(buffered,time){return filterRanges(buffered,function(start,end){return start-SAFE_TIME_DELTA<=time&&end+SAFE_TIME_DELTA>=time})};var findNextRange=function findNextRange(timeRanges,time){return filterRanges(timeRanges,function(start){return start-TIME_FUDGE_FACTOR>=time})};var findGaps=function findGaps(buffered){if(buffered.length<2){return videojs.createTimeRanges()}var ranges=[];for(var i=1;i<buffered.length;i++){var start=buffered.end(i-1);var end=buffered.start(i);ranges.push([start,end]);}return videojs.createTimeRanges(ranges)};var bufferIntersection=function bufferIntersection(bufferA,bufferB){var start=null;var end=null;var arity=0;var extents=[];var ranges=[];if(!bufferA||!bufferA.length||!bufferB||!bufferB.length){return videojs.createTimeRange()}var count=bufferA.length;while(count--){extents.push({time:bufferA.start(count),type:"start"});extents.push({time:bufferA.end(count),type:"end"});}count=bufferB.length;while(count--){extents.push({time:bufferB.start(count),type:"start"});extents.push({time:bufferB.end(count),type:"end"});}extents.sort(function(a,b){return a.time-b.time});for(count=0;count<extents.length;count++){if(extents[count].type==="start"){arity++;if(arity===2){start=extents[count].time;}}else if(extents[count].type==="end"){arity--;if(arity===1){end=extents[count].time;}}if(start!==null&&end!==null){ranges.push([start,end]);start=null;end=null;}}return videojs.createTimeRanges(ranges)};var printableRange=function printableRange(range){var strArr=[];if(!range||!range.length){return ""}for(var i=0;i<range.length;i++){strArr.push(range.start(i)+" => "+range.end(i));}return strArr.join(", ")};var timeUntilRebuffer=function timeUntilRebuffer(buffered,currentTime,playbackRate){if(playbackRate===void 0){playbackRate=1;}var bufferedEnd=buffered.length?buffered.end(buffered.length-1):0;return (bufferedEnd-currentTime)/playbackRate};var timeRangesToArray=function timeRangesToArray(timeRanges){var timeRangesList=[];for(var i=0;i<timeRanges.length;i++){timeRangesList.push({start:timeRanges.start(i),end:timeRanges.end(i)});}return timeRangesList};var isRangeDifferent=function isRangeDifferent(a,b){if(a===b){return false}if(!a&&b||!b&&a){return true}if(a.length!==b.length){return true}for(var i=0;i<a.length;i++){if(a.start(i)!==b.start(i)||a.end(i)!==b.end(i)){return true}}return false};var lastBufferedEnd=function lastBufferedEnd(a){if(!a||!a.length||!a.end){return}return a.end(a.length-1)};var timeAheadOf=function timeAheadOf(range,startTime){var time=0;if(!range||!range.length){return time}for(var i=0;i<range.length;i++){var start=range.start(i);var end=range.end(i);if(startTime>end){continue}if(startTime>start&&startTime<=end){time+=end-startTime;continue}time+=end-start;}return time};var createTimeRange=videojs.createTimeRange;var segmentDurationWithParts=function segmentDurationWithParts(playlist,segment){if(!segment.preload){return segment.duration}var result=0;(segment.parts||[]).forEach(function(p){result+=p.duration;});(segment.preloadHints||[]).forEach(function(p){if(p.type==="PART"){result+=playlist.partTargetDuration;}});return result};var getPartsAndSegments=function getPartsAndSegments(playlist){return (playlist.segments||[]).reduce(function(acc,segment,si){if(segment.parts){segment.parts.forEach(function(part,pi){acc.push({duration:part.duration,segmentIndex:si,partIndex:pi,part:part,segment:segment});});}else {acc.push({duration:segment.duration,segmentIndex:si,partIndex:null,segment:segment,part:null});}return acc},[])};var getLastParts=function getLastParts(media){var lastSegment=media.segments&&media.segments.length&&media.segments[media.segments.length-1];return lastSegment&&lastSegment.parts||[]};var getKnownPartCount=function getKnownPartCount(_ref){var preloadSegment=_ref.preloadSegment;if(!preloadSegment){return}var parts=preloadSegment.parts,preloadHints=preloadSegment.preloadHints;var partCount=(preloadHints||[]).reduce(function(count,hint){return count+(hint.type==="PART"?1:0)},0);partCount+=parts&&parts.length?parts.length:0;return partCount};var liveEdgeDelay=function liveEdgeDelay(master,media){if(media.endList){return 0}if(master&&master.suggestedPresentationDelay){return master.suggestedPresentationDelay}var hasParts=getLastParts(media).length>0;if(hasParts&&media.serverControl&&media.serverControl.partHoldBack){return media.serverControl.partHoldBack}else if(hasParts&&media.partTargetDuration){return media.partTargetDuration*3}else if(media.serverControl&&media.serverControl.holdBack){return media.serverControl.holdBack}else if(media.targetDuration){return media.targetDuration*3}return 0};var backwardDuration=function backwardDuration(playlist,endSequence){var result=0;var i=endSequence-playlist.mediaSequence;var segment=playlist.segments[i];if(segment){if(typeof segment.start!=="undefined"){return {result:segment.start,precise:true}}if(typeof segment.end!=="undefined"){return {result:segment.end-segment.duration,precise:true}}}while(i--){segment=playlist.segments[i];if(typeof segment.end!=="undefined"){return {result:result+segment.end,precise:true}}result+=segmentDurationWithParts(playlist,segment);if(typeof segment.start!=="undefined"){return {result:result+segment.start,precise:true}}}return {result:result,precise:false}};var forwardDuration=function forwardDuration(playlist,endSequence){var result=0;var segment;var i=endSequence-playlist.mediaSequence;for(;i<playlist.segments.length;i++){segment=playlist.segments[i];if(typeof segment.start!=="undefined"){return {result:segment.start-result,precise:true}}result+=segmentDurationWithParts(playlist,segment);if(typeof segment.end!=="undefined"){return {result:segment.end-result,precise:true}}}return {result:-1,precise:false}};var intervalDuration=function intervalDuration(playlist,endSequence,expired){if(typeof endSequence==="undefined"){endSequence=playlist.mediaSequence+playlist.segments.length;}if(endSequence<playlist.mediaSequence){return 0}var backward=backwardDuration(playlist,endSequence);if(backward.precise){return backward.result}var forward=forwardDuration(playlist,endSequence);if(forward.precise){return forward.result}return backward.result+expired};var duration=function duration(playlist,endSequence,expired){if(!playlist){return 0}if(typeof expired!=="number"){expired=0;}if(typeof endSequence==="undefined"){if(playlist.totalDuration){return playlist.totalDuration}if(!playlist.endList){return window_1.Infinity}}return intervalDuration(playlist,endSequence,expired)};var sumDurations=function sumDurations(_ref2){var defaultDuration=_ref2.defaultDuration,durationList=_ref2.durationList,startIndex=_ref2.startIndex,endIndex=_ref2.endIndex;var durations=0;if(startIndex>endIndex){var _ref3=[endIndex,startIndex];startIndex=_ref3[0];endIndex=_ref3[1];}if(startIndex<0){for(var i=startIndex;i<Math.min(0,endIndex);i++){durations+=defaultDuration;}startIndex=0;}for(var _i=startIndex;_i<endIndex;_i++){durations+=durationList[_i].duration;}return durations};var playlistEnd=function playlistEnd(playlist,expired,useSafeLiveEnd,liveEdgePadding){if(!playlist||!playlist.segments){return null}if(playlist.endList){return duration(playlist)}if(expired===null){return null}expired=expired||0;var lastSegmentEndTime=intervalDuration(playlist,playlist.mediaSequence+playlist.segments.length,expired);if(useSafeLiveEnd){liveEdgePadding=typeof liveEdgePadding==="number"?liveEdgePadding:liveEdgeDelay(null,playlist);lastSegmentEndTime-=liveEdgePadding;}return Math.max(0,lastSegmentEndTime)};var seekable=function seekable(playlist,expired,liveEdgePadding){var useSafeLiveEnd=true;var seekableStart=expired||0;var seekableEnd=playlistEnd(playlist,expired,useSafeLiveEnd,liveEdgePadding);if(seekableEnd===null){return createTimeRange()}return createTimeRange(seekableStart,seekableEnd)};var getMediaInfoForTime=function getMediaInfoForTime(_ref4){var playlist=_ref4.playlist,currentTime=_ref4.currentTime,startingSegmentIndex=_ref4.startingSegmentIndex,startingPartIndex=_ref4.startingPartIndex,startTime=_ref4.startTime,experimentalExactManifestTimings=_ref4.experimentalExactManifestTimings;var time=currentTime-startTime;var partsAndSegments=getPartsAndSegments(playlist);var startIndex=0;for(var i=0;i<partsAndSegments.length;i++){var partAndSegment=partsAndSegments[i];if(startingSegmentIndex!==partAndSegment.segmentIndex){continue}if(typeof startingPartIndex==="number"&&typeof partAndSegment.partIndex==="number"&&startingPartIndex!==partAndSegment.partIndex){continue}startIndex=i;break}if(time<0){if(startIndex>0){for(var _i2=startIndex-1;_i2>=0;_i2--){var _partAndSegment=partsAndSegments[_i2];time+=_partAndSegment.duration;if(experimentalExactManifestTimings){if(time<0){continue}}else if(time+TIME_FUDGE_FACTOR<=0){continue}return {partIndex:_partAndSegment.partIndex,segmentIndex:_partAndSegment.segmentIndex,startTime:startTime-sumDurations({defaultDuration:playlist.targetDuration,durationList:partsAndSegments,startIndex:startIndex,endIndex:_i2})}}}return {partIndex:partsAndSegments[0]&&partsAndSegments[0].partIndex||null,segmentIndex:partsAndSegments[0]&&partsAndSegments[0].segmentIndex||0,startTime:currentTime}}if(startIndex<0){for(var _i3=startIndex;_i3<0;_i3++){time-=playlist.targetDuration;if(time<0){return {partIndex:partsAndSegments[0]&&partsAndSegments[0].partIndex||null,segmentIndex:partsAndSegments[0]&&partsAndSegments[0].segmentIndex||0,startTime:currentTime}}}startIndex=0;}for(var _i4=startIndex;_i4<partsAndSegments.length;_i4++){var _partAndSegment2=partsAndSegments[_i4];time-=_partAndSegment2.duration;if(experimentalExactManifestTimings){if(time>0){continue}}else if(time-TIME_FUDGE_FACTOR>=0){continue}return {partIndex:_partAndSegment2.partIndex,segmentIndex:_partAndSegment2.segmentIndex,startTime:startTime+sumDurations({defaultDuration:playlist.targetDuration,durationList:partsAndSegments,startIndex:startIndex,endIndex:_i4})}}return {segmentIndex:partsAndSegments[partsAndSegments.length-1].segmentIndex,partIndex:partsAndSegments[partsAndSegments.length-1].partIndex,startTime:currentTime}};var isBlacklisted=function isBlacklisted(playlist){return playlist.excludeUntil&&playlist.excludeUntil>Date.now()};var isIncompatible=function isIncompatible(playlist){return playlist.excludeUntil&&playlist.excludeUntil===Infinity};var isEnabled=function isEnabled(playlist){var blacklisted=isBlacklisted(playlist);return !playlist.disabled&&!blacklisted};var isDisabled=function isDisabled(playlist){return playlist.disabled};var isAes=function isAes(media){for(var i=0;i<media.segments.length;i++){if(media.segments[i].key){return true}}return false};var hasAttribute=function hasAttribute(attr,playlist){return playlist.attributes&&playlist.attributes[attr]};var estimateSegmentRequestTime=function estimateSegmentRequestTime(segmentDuration,bandwidth,playlist,bytesReceived){if(bytesReceived===void 0){bytesReceived=0;}if(!hasAttribute("BANDWIDTH",playlist)){return NaN}var size=segmentDuration*playlist.attributes.BANDWIDTH;return (size-bytesReceived*8)/bandwidth};var isLowestEnabledRendition=function isLowestEnabledRendition(master,media){if(master.playlists.length===1){return true}var currentBandwidth=media.attributes.BANDWIDTH||Number.MAX_VALUE;return master.playlists.filter(function(playlist){if(!isEnabled(playlist)){return false}return (playlist.attributes.BANDWIDTH||0)<currentBandwidth}).length===0};var playlistMatch=function playlistMatch(a,b){if(!a&&!b||!a&&b||a&&!b){return false}if(a===b){return true}if(a.id&&b.id&&a.id===b.id){return true}if(a.resolvedUri&&b.resolvedUri&&a.resolvedUri===b.resolvedUri){return true}if(a.uri&&b.uri&&a.uri===b.uri){return true}return false};var someAudioVariant=function someAudioVariant(master,callback){var AUDIO=master&&master.mediaGroups&&master.mediaGroups.AUDIO||{};var found=false;for(var groupName in AUDIO){for(var label in AUDIO[groupName]){found=callback(AUDIO[groupName][label]);if(found){break}}if(found){break}}return !!found};var isAudioOnly=function isAudioOnly(master){if(!master||!master.playlists||!master.playlists.length){var found=someAudioVariant(master,function(variant){return variant.playlists&&variant.playlists.length||variant.uri});return found}var _loop=function _loop(i){var playlist=master.playlists[i];var CODECS=playlist.attributes&&playlist.attributes.CODECS;if(CODECS&&CODECS.split(",").every(function(c){return isAudioCodec(c)})){return "continue"}var found=someAudioVariant(master,function(variant){return playlistMatch(playlist,variant)});if(found){return "continue"}return {v:false}};for(var i=0;i<master.playlists.length;i++){var _ret=_loop(i);if(_ret==="continue")continue;if(typeof _ret==="object")return _ret.v}return true};var Playlist={liveEdgeDelay:liveEdgeDelay,duration:duration,seekable:seekable,getMediaInfoForTime:getMediaInfoForTime,isEnabled:isEnabled,isDisabled:isDisabled,isBlacklisted:isBlacklisted,isIncompatible:isIncompatible,playlistEnd:playlistEnd,isAes:isAes,hasAttribute:hasAttribute,estimateSegmentRequestTime:estimateSegmentRequestTime,isLowestEnabledRendition:isLowestEnabledRendition,isAudioOnly:isAudioOnly,playlistMatch:playlistMatch,segmentDurationWithParts:segmentDurationWithParts};var log=videojs.log;var createPlaylistID=function createPlaylistID(index,uri){return index+"-"+uri};var parseManifest=function parseManifest(_ref){var onwarn=_ref.onwarn,oninfo=_ref.oninfo,manifestString=_ref.manifestString,_ref$customTagParsers=_ref.customTagParsers,customTagParsers=_ref$customTagParsers===void 0?[]:_ref$customTagParsers,_ref$customTagMappers=_ref.customTagMappers,customTagMappers=_ref$customTagMappers===void 0?[]:_ref$customTagMappers,experimentalLLHLS=_ref.experimentalLLHLS;var parser=new Parser;if(onwarn){parser.on("warn",onwarn);}if(oninfo){parser.on("info",oninfo);}customTagParsers.forEach(function(customParser){return parser.addParser(customParser)});customTagMappers.forEach(function(mapper){return parser.addTagMapper(mapper)});parser.push(manifestString);parser.end();var manifest=parser.manifest;if(!experimentalLLHLS){["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach(function(k){if(manifest.hasOwnProperty(k)){delete manifest[k];}});if(manifest.segments){manifest.segments.forEach(function(segment){["parts","preloadHints"].forEach(function(k){if(segment.hasOwnProperty(k)){delete segment[k];}});});}}if(!manifest.targetDuration){var targetDuration=10;if(manifest.segments&&manifest.segments.length){targetDuration=manifest.segments.reduce(function(acc,s){return Math.max(acc,s.duration)},0);}if(onwarn){onwarn("manifest has no targetDuration defaulting to "+targetDuration);}manifest.targetDuration=targetDuration;}var parts=getLastParts(manifest);if(parts.length&&!manifest.partTargetDuration){var partTargetDuration=parts.reduce(function(acc,p){return Math.max(acc,p.duration)},0);if(onwarn){onwarn("manifest has no partTargetDuration defaulting to "+partTargetDuration);log.error("LL-HLS manifest has parts but lacks required #EXT-X-PART-INF:PART-TARGET value. See https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-09#section-4.4.3.7. Playback is not guaranteed.");}manifest.partTargetDuration=partTargetDuration;}return manifest};var forEachMediaGroup=function forEachMediaGroup(master,callback){if(!master.mediaGroups){return}["AUDIO","SUBTITLES"].forEach(function(mediaType){if(!master.mediaGroups[mediaType]){return}for(var groupKey in master.mediaGroups[mediaType]){for(var labelKey in master.mediaGroups[mediaType][groupKey]){var mediaProperties=master.mediaGroups[mediaType][groupKey][labelKey];callback(mediaProperties,mediaType,groupKey,labelKey);}}});};var setupMediaPlaylist=function setupMediaPlaylist(_ref2){var playlist=_ref2.playlist,uri=_ref2.uri,id=_ref2.id;playlist.id=id;playlist.playlistErrors_=0;if(uri){playlist.uri=uri;}playlist.attributes=playlist.attributes||{};};var setupMediaPlaylists=function setupMediaPlaylists(master){var i=master.playlists.length;while(i--){var playlist=master.playlists[i];setupMediaPlaylist({playlist:playlist,id:createPlaylistID(i,playlist.uri)});playlist.resolvedUri=resolveUrl(master.uri,playlist.uri);master.playlists[playlist.id]=playlist;master.playlists[playlist.uri]=playlist;if(!playlist.attributes.BANDWIDTH){log.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.");}}};var resolveMediaGroupUris=function resolveMediaGroupUris(master){forEachMediaGroup(master,function(properties){if(properties.uri){properties.resolvedUri=resolveUrl(master.uri,properties.uri);}});};var masterForMedia=function masterForMedia(media,uri){var id=createPlaylistID(0,uri);var master={mediaGroups:{"AUDIO":{},"VIDEO":{},"CLOSED-CAPTIONS":{},"SUBTITLES":{}},uri:window_1.location.href,resolvedUri:window_1.location.href,playlists:[{uri:uri,id:id,resolvedUri:uri,attributes:{}}]};master.playlists[id]=master.playlists[0];master.playlists[uri]=master.playlists[0];return master};var addPropertiesToMaster=function addPropertiesToMaster(master,uri){master.uri=uri;for(var i=0;i<master.playlists.length;i++){if(!master.playlists[i].uri){var phonyUri="placeholder-uri-"+i;master.playlists[i].uri=phonyUri;}}var audioOnlyMaster=isAudioOnly(master);forEachMediaGroup(master,function(properties,mediaType,groupKey,labelKey){var groupId="placeholder-uri-"+mediaType+"-"+groupKey+"-"+labelKey;if(!properties.playlists||!properties.playlists.length){if(audioOnlyMaster&&mediaType==="AUDIO"&&!properties.uri){for(var _i=0;_i<master.playlists.length;_i++){var p=master.playlists[_i];if(p.attributes&&p.attributes.AUDIO&&p.attributes.AUDIO===groupKey){return}}}properties.playlists=[_extends$3({},properties)];}properties.playlists.forEach(function(p,i){var id=createPlaylistID(i,groupId);if(p.uri){p.resolvedUri=p.resolvedUri||resolveUrl(master.uri,p.uri);}else {p.uri=i===0?groupId:id;p.resolvedUri=p.uri;}p.id=p.id||id;p.attributes=p.attributes||{};master.playlists[p.id]=p;master.playlists[p.uri]=p;});});setupMediaPlaylists(master);resolveMediaGroupUris(master);};var mergeOptions$2=videojs.mergeOptions,EventTarget$1=videojs.EventTarget;var addLLHLSQueryDirectives=function addLLHLSQueryDirectives(uri,media){if(media.endList||!media.serverControl){return uri}var parameters={};if(media.serverControl.canBlockReload){var preloadSegment=media.preloadSegment;var nextMSN=media.mediaSequence+media.segments.length;if(preloadSegment){var parts=preloadSegment.parts||[];var nextPart=getKnownPartCount(media)-1;if(nextPart>-1&&nextPart!==parts.length-1){parameters._HLS_part=nextPart;}if(nextPart>-1||parts.length){nextMSN--;}}parameters._HLS_msn=nextMSN;}if(media.serverControl&&media.serverControl.canSkipUntil){parameters._HLS_skip=media.serverControl.canSkipDateranges?"v2":"YES";}if(Object.keys(parameters).length){var parsedUri=new window_1.URL(uri);["_HLS_skip","_HLS_msn","_HLS_part"].forEach(function(name){if(!parameters.hasOwnProperty(name)){return}parsedUri.searchParams.set(name,parameters[name]);});uri=parsedUri.toString();}return uri};var updateSegment=function updateSegment(a,b){if(!a){return b}var result=mergeOptions$2(a,b);if(a.preloadHints&&!b.preloadHints){delete result.preloadHints;}if(a.parts&&!b.parts){delete result.parts;}else if(a.parts&&b.parts){for(var i=0;i<b.parts.length;i++){if(a.parts&&a.parts[i]){result.parts[i]=mergeOptions$2(a.parts[i],b.parts[i]);}}}if(!a.skipped&&b.skipped){result.skipped=false;}if(a.preload&&!b.preload){result.preload=false;}return result};var updateSegments=function updateSegments(original,update,offset){var oldSegments=original.slice();var newSegments=update.slice();offset=offset||0;var result=[];var currentMap;for(var newIndex=0;newIndex<newSegments.length;newIndex++){var oldSegment=oldSegments[newIndex+offset];var newSegment=newSegments[newIndex];if(oldSegment){currentMap=oldSegment.map||currentMap;result.push(updateSegment(oldSegment,newSegment));}else {if(currentMap&&!newSegment.map){newSegment.map=currentMap;}result.push(newSegment);}}return result};var resolveSegmentUris=function resolveSegmentUris(segment,baseUri){if(!segment.resolvedUri&&segment.uri){segment.resolvedUri=resolveUrl(baseUri,segment.uri);}if(segment.key&&!segment.key.resolvedUri){segment.key.resolvedUri=resolveUrl(baseUri,segment.key.uri);}if(segment.map&&!segment.map.resolvedUri){segment.map.resolvedUri=resolveUrl(baseUri,segment.map.uri);}if(segment.map&&segment.map.key&&!segment.map.key.resolvedUri){segment.map.key.resolvedUri=resolveUrl(baseUri,segment.map.key.uri);}if(segment.parts&&segment.parts.length){segment.parts.forEach(function(p){if(p.resolvedUri){return}p.resolvedUri=resolveUrl(baseUri,p.uri);});}if(segment.preloadHints&&segment.preloadHints.length){segment.preloadHints.forEach(function(p){if(p.resolvedUri){return}p.resolvedUri=resolveUrl(baseUri,p.uri);});}};var getAllSegments=function getAllSegments(media){var segments=media.segments||[];var preloadSegment=media.preloadSegment;if(preloadSegment&&preloadSegment.parts&&preloadSegment.parts.length){if(preloadSegment.preloadHints){for(var i=0;i<preloadSegment.preloadHints.length;i++){if(preloadSegment.preloadHints[i].type==="MAP"){return segments}}}preloadSegment.duration=media.targetDuration;preloadSegment.preload=true;segments.push(preloadSegment);}return segments};var isPlaylistUnchanged=function isPlaylistUnchanged(a,b){return a===b||a.segments&&b.segments&&a.segments.length===b.segments.length&&a.endList===b.endList&&a.mediaSequence===b.mediaSequence&&a.preloadSegment===b.preloadSegment};var updateMaster$1=function updateMaster(master,newMedia,unchangedCheck){if(unchangedCheck===void 0){unchangedCheck=isPlaylistUnchanged;}var result=mergeOptions$2(master,{});var oldMedia=result.playlists[newMedia.id];if(!oldMedia){return null}if(unchangedCheck(oldMedia,newMedia)){return null}newMedia.segments=getAllSegments(newMedia);var mergedPlaylist=mergeOptions$2(oldMedia,newMedia);if(mergedPlaylist.preloadSegment&&!newMedia.preloadSegment){delete mergedPlaylist.preloadSegment;}if(oldMedia.segments){if(newMedia.skip){newMedia.segments=newMedia.segments||[];for(var i=0;i<newMedia.skip.skippedSegments;i++){newMedia.segments.unshift({skipped:true});}}mergedPlaylist.segments=updateSegments(oldMedia.segments,newMedia.segments,newMedia.mediaSequence-oldMedia.mediaSequence);}mergedPlaylist.segments.forEach(function(segment){resolveSegmentUris(segment,mergedPlaylist.resolvedUri);});for(var _i=0;_i<result.playlists.length;_i++){if(result.playlists[_i].id===newMedia.id){result.playlists[_i]=mergedPlaylist;}}result.playlists[newMedia.id]=mergedPlaylist;result.playlists[newMedia.uri]=mergedPlaylist;forEachMediaGroup(master,function(properties,mediaType,groupKey,labelKey){if(!properties.playlists){return}for(var _i2=0;_i2<properties.playlists.length;_i2++){if(newMedia.id===properties.playlists[_i2].id){properties.playlists[_i2]=mergedPlaylist;}}});return result};var refreshDelay=function refreshDelay(media,update){var segments=media.segments||[];var lastSegment=segments[segments.length-1];var lastPart=lastSegment&&lastSegment.parts&&lastSegment.parts[lastSegment.parts.length-1];var lastDuration=lastPart&&lastPart.duration||lastSegment&&lastSegment.duration;if(update&&lastDuration){return lastDuration*1e3}return (media.partTargetDuration||media.targetDuration||10)*500};var PlaylistLoader=function(_EventTarget){_inheritsLoose(PlaylistLoader,_EventTarget);function PlaylistLoader(src,vhs,options){var _this;if(options===void 0){options={};}_this=_EventTarget.call(this)||this;if(!src){throw new Error("A non-empty playlist URL or object is required")}_this.logger_=logger("PlaylistLoader");var _options=options,_options$withCredenti=_options.withCredentials,withCredentials=_options$withCredenti===void 0?false:_options$withCredenti,_options$handleManife=_options.handleManifestRedirects,handleManifestRedirects=_options$handleManife===void 0?false:_options$handleManife;_this.src=src;_this.vhs_=vhs;_this.withCredentials=withCredentials;_this.handleManifestRedirects=handleManifestRedirects;var vhsOptions=vhs.options_;_this.customTagParsers=vhsOptions&&vhsOptions.customTagParsers||[];_this.customTagMappers=vhsOptions&&vhsOptions.customTagMappers||[];_this.experimentalLLHLS=vhsOptions&&vhsOptions.experimentalLLHLS||false;if(videojs.browser.IE_VERSION){_this.experimentalLLHLS=false;}_this.state="HAVE_NOTHING";_this.handleMediaupdatetimeout_=_this.handleMediaupdatetimeout_.bind(_assertThisInitialized(_this));_this.on("mediaupdatetimeout",_this.handleMediaupdatetimeout_);return _this}var _proto=PlaylistLoader.prototype;_proto.handleMediaupdatetimeout_=function handleMediaupdatetimeout_(){var _this2=this;if(this.state!=="HAVE_METADATA"){return}var media=this.media();var uri=resolveUrl(this.master.uri,media.uri);if(this.experimentalLLHLS){uri=addLLHLSQueryDirectives(uri,media);}this.state="HAVE_CURRENT_METADATA";this.request=this.vhs_.xhr({uri:uri,withCredentials:this.withCredentials},function(error,req){if(!_this2.request){return}if(error){return _this2.playlistRequestError(_this2.request,_this2.media(),"HAVE_METADATA")}_this2.haveMetadata({playlistString:_this2.request.responseText,url:_this2.media().uri,id:_this2.media().id});});};_proto.playlistRequestError=function playlistRequestError(xhr,playlist,startingState){var uri=playlist.uri,id=playlist.id;this.request=null;if(startingState){this.state=startingState;}this.error={playlist:this.master.playlists[id],status:xhr.status,message:"HLS playlist request error at URL: "+uri+".",responseText:xhr.responseText,code:xhr.status>=500?4:2};this.trigger("error");};_proto.parseManifest_=function parseManifest_(_ref){var _this3=this;var url=_ref.url,manifestString=_ref.manifestString;return parseManifest({onwarn:function onwarn(_ref2){var message=_ref2.message;return _this3.logger_("m3u8-parser warn for "+url+": "+message)},oninfo:function oninfo(_ref3){var message=_ref3.message;return _this3.logger_("m3u8-parser info for "+url+": "+message)},manifestString:manifestString,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers,experimentalLLHLS:this.experimentalLLHLS})};_proto.haveMetadata=function haveMetadata(_ref4){var playlistString=_ref4.playlistString,playlistObject=_ref4.playlistObject,url=_ref4.url,id=_ref4.id;this.request=null;this.state="HAVE_METADATA";var playlist=playlistObject||this.parseManifest_({url:url,manifestString:playlistString});playlist.lastRequest=Date.now();setupMediaPlaylist({playlist:playlist,uri:url,id:id});var update=updateMaster$1(this.master,playlist);this.targetDuration=playlist.partTargetDuration||playlist.targetDuration;this.pendingMedia_=null;if(update){this.master=update;this.media_=this.master.playlists[id];}else {this.trigger("playlistunchanged");}this.updateMediaUpdateTimeout_(refreshDelay(this.media(),!!update));this.trigger("loadedplaylist");};_proto.dispose=function dispose(){this.trigger("dispose");this.stopRequest();window_1.clearTimeout(this.mediaUpdateTimeout);window_1.clearTimeout(this.finalRenditionTimeout);this.off();};_proto.stopRequest=function stopRequest(){if(this.request){var oldRequest=this.request;this.request=null;oldRequest.onreadystatechange=null;oldRequest.abort();}};_proto.media=function media(playlist,shouldDelay){var _this4=this;if(!playlist){return this.media_}if(this.state==="HAVE_NOTHING"){throw new Error("Cannot switch media playlist from "+this.state)}if(typeof playlist==="string"){if(!this.master.playlists[playlist]){throw new Error("Unknown playlist URI: "+playlist)}playlist=this.master.playlists[playlist];}window_1.clearTimeout(this.finalRenditionTimeout);if(shouldDelay){var delay=(playlist.partTargetDuration||playlist.targetDuration)/2*1e3||5*1e3;this.finalRenditionTimeout=window_1.setTimeout(this.media.bind(this,playlist,false),delay);return}var startingState=this.state;var mediaChange=!this.media_||playlist.id!==this.media_.id;var masterPlaylistRef=this.master.playlists[playlist.id];if(masterPlaylistRef&&masterPlaylistRef.endList||playlist.endList&&playlist.segments.length){if(this.request){this.request.onreadystatechange=null;this.request.abort();this.request=null;}this.state="HAVE_METADATA";this.media_=playlist;if(mediaChange){this.trigger("mediachanging");if(startingState==="HAVE_MASTER"){this.trigger("loadedmetadata");}else {this.trigger("mediachange");}}return}this.updateMediaUpdateTimeout_(refreshDelay(playlist,true));if(!mediaChange){return}this.state="SWITCHING_MEDIA";if(this.request){if(playlist.resolvedUri===this.request.url){return}this.request.onreadystatechange=null;this.request.abort();this.request=null;}if(this.media_){this.trigger("mediachanging");}this.pendingMedia_=playlist;this.request=this.vhs_.xhr({uri:playlist.resolvedUri,withCredentials:this.withCredentials},function(error,req){if(!_this4.request){return}playlist.lastRequest=Date.now();playlist.resolvedUri=resolveManifestRedirect(_this4.handleManifestRedirects,playlist.resolvedUri,req);if(error){return _this4.playlistRequestError(_this4.request,playlist,startingState)}_this4.haveMetadata({playlistString:req.responseText,url:playlist.uri,id:playlist.id});if(startingState==="HAVE_MASTER"){_this4.trigger("loadedmetadata");}else {_this4.trigger("mediachange");}});};_proto.pause=function pause(){if(this.mediaUpdateTimeout){window_1.clearTimeout(this.mediaUpdateTimeout);this.mediaUpdateTimeout=null;}this.stopRequest();if(this.state==="HAVE_NOTHING"){this.started=false;}if(this.state==="SWITCHING_MEDIA"){if(this.media_){this.state="HAVE_METADATA";}else {this.state="HAVE_MASTER";}}else if(this.state==="HAVE_CURRENT_METADATA"){this.state="HAVE_METADATA";}};_proto.load=function load(shouldDelay){var _this5=this;if(this.mediaUpdateTimeout){window_1.clearTimeout(this.mediaUpdateTimeout);this.mediaUpdateTimeout=null;}var media=this.media();if(shouldDelay){var delay=media?(media.partTargetDuration||media.targetDuration)/2*1e3:5*1e3;this.mediaUpdateTimeout=window_1.setTimeout(function(){_this5.mediaUpdateTimeout=null;_this5.load();},delay);return}if(!this.started){this.start();return}if(media&&!media.endList){this.trigger("mediaupdatetimeout");}else {this.trigger("loadedplaylist");}};_proto.updateMediaUpdateTimeout_=function updateMediaUpdateTimeout_(delay){var _this6=this;if(this.mediaUpdateTimeout){window_1.clearTimeout(this.mediaUpdateTimeout);this.mediaUpdateTimeout=null;}if(!this.media()||this.media().endList){return}this.mediaUpdateTimeout=window_1.setTimeout(function(){_this6.mediaUpdateTimeout=null;_this6.trigger("mediaupdatetimeout");_this6.updateMediaUpdateTimeout_(delay);},delay);};_proto.start=function start(){var _this7=this;this.started=true;if(typeof this.src==="object"){if(!this.src.uri){this.src.uri=window_1.location.href;}this.src.resolvedUri=this.src.uri;setTimeout(function(){_this7.setupInitialPlaylist(_this7.src);},0);return}this.request=this.vhs_.xhr({uri:this.src,withCredentials:this.withCredentials},function(error,req){if(!_this7.request){return}_this7.request=null;if(error){_this7.error={status:req.status,message:"HLS playlist request error at URL: "+_this7.src+".",responseText:req.responseText,code:2};if(_this7.state==="HAVE_NOTHING"){_this7.started=false;}return _this7.trigger("error")}_this7.src=resolveManifestRedirect(_this7.handleManifestRedirects,_this7.src,req);var manifest=_this7.parseManifest_({manifestString:req.responseText,url:_this7.src});_this7.setupInitialPlaylist(manifest);});};_proto.srcUri=function srcUri(){return typeof this.src==="string"?this.src:this.src.uri};_proto.setupInitialPlaylist=function setupInitialPlaylist(manifest){this.state="HAVE_MASTER";if(manifest.playlists){this.master=manifest;addPropertiesToMaster(this.master,this.srcUri());manifest.playlists.forEach(function(playlist){playlist.segments=getAllSegments(playlist);playlist.segments.forEach(function(segment){resolveSegmentUris(segment,playlist.resolvedUri);});});this.trigger("loadedplaylist");if(!this.request){this.media(this.master.playlists[0]);}return}var uri=this.srcUri()||window_1.location.href;this.master=masterForMedia(manifest,uri);this.haveMetadata({playlistObject:manifest,url:uri,id:this.master.playlists[0].id});this.trigger("loadedmetadata");};return PlaylistLoader}(EventTarget$1);var videojsXHR=videojs.xhr,mergeOptions$1=videojs.mergeOptions;var callbackWrapper=function callbackWrapper(request,error,response,callback){var reqResponse=request.responseType==="arraybuffer"?request.response:request.responseText;if(!error&&reqResponse){request.responseTime=Date.now();request.roundTripTime=request.responseTime-request.requestTime;request.bytesReceived=reqResponse.byteLength||reqResponse.length;if(!request.bandwidth){request.bandwidth=Math.floor(request.bytesReceived/request.roundTripTime*8*1e3);}}if(response.headers){request.responseHeaders=response.headers;}if(error&&error.code==="ETIMEDOUT"){request.timedout=true;}if(!error&&!request.aborted&&response.statusCode!==200&&response.statusCode!==206&&response.statusCode!==0){error=new Error("XHR Failed with a response of: "+(request&&(reqResponse||request.responseText)));}callback(error,request);};var xhrFactory=function xhrFactory(){var xhr=function XhrFunction(options,callback){options=mergeOptions$1({timeout:45e3},options);var beforeRequest=XhrFunction.beforeRequest||videojs.Vhs.xhr.beforeRequest;if(beforeRequest&&typeof beforeRequest==="function"){var newOptions=beforeRequest(options);if(newOptions){options=newOptions;}}var xhrMethod=videojs.Vhs.xhr.original===true?videojsXHR:videojs.Vhs.xhr;var request=xhrMethod(options,function(error,response){return callbackWrapper(request,error,response,callback)});var originalAbort=request.abort;request.abort=function(){request.aborted=true;return originalAbort.apply(request,arguments)};request.uri=options.uri;request.requestTime=Date.now();return request};xhr.original=true;return xhr};var byterangeStr=function byterangeStr(byterange){var byterangeEnd;var byterangeStart=byterange.offset;if(typeof byterange.offset==="bigint"||typeof byterange.length==="bigint"){byterangeEnd=window_1.BigInt(byterange.offset)+window_1.BigInt(byterange.length)-window_1.BigInt(1);}else {byterangeEnd=byterange.offset+byterange.length-1;}return "bytes="+byterangeStart+"-"+byterangeEnd};var segmentXhrHeaders=function segmentXhrHeaders(segment){var headers={};if(segment.byterange){headers.Range=byterangeStr(segment.byterange);}return headers};var textRange=function textRange(range,i){return range.start(i)+"-"+range.end(i)};var formatHexString=function formatHexString(e,i){var value=e.toString(16);return "00".substring(0,2-value.length)+value+(i%2?" ":"")};var formatAsciiString=function formatAsciiString(e){if(e>=32&&e<126){return String.fromCharCode(e)}return "."};var createTransferableMessage=function createTransferableMessage(message){var transferable={};Object.keys(message).forEach(function(key){var value=message[key];if(isArrayBufferView(value)){transferable[key]={bytes:value.buffer,byteOffset:value.byteOffset,byteLength:value.byteLength};}else {transferable[key]=value;}});return transferable};var initSegmentId=function initSegmentId(initSegment){var byterange=initSegment.byterange||{length:Infinity,offset:0};return [byterange.length,byterange.offset,initSegment.resolvedUri].join(",")};var segmentKeyId=function segmentKeyId(key){return key.resolvedUri};var hexDump=function hexDump(data){var bytes=Array.prototype.slice.call(data);var step=16;var result="";var hex;var ascii;for(var j=0;j<bytes.length/step;j++){hex=bytes.slice(j*step,j*step+step).map(formatHexString).join("");ascii=bytes.slice(j*step,j*step+step).map(formatAsciiString).join("");result+=hex+" "+ascii+"\n";}return result};var tagDump=function tagDump(_ref){var bytes=_ref.bytes;return hexDump(bytes)};var textRanges=function textRanges(ranges){var result="";var i;for(i=0;i<ranges.length;i++){result+=textRange(ranges,i)+" ";}return result};var utils=Object.freeze({__proto__:null,createTransferableMessage:createTransferableMessage,initSegmentId:initSegmentId,segmentKeyId:segmentKeyId,hexDump:hexDump,tagDump:tagDump,textRanges:textRanges});var SEGMENT_END_FUDGE_PERCENT=.25;var playerTimeToProgramTime=function playerTimeToProgramTime(playerTime,segment){if(!segment.dateTimeObject){return null}var transmuxerPrependedSeconds=segment.videoTimingInfo.transmuxerPrependedSeconds;var transmuxedStart=segment.videoTimingInfo.transmuxedPresentationStart;var startOfSegment=transmuxedStart+transmuxerPrependedSeconds;var offsetFromSegmentStart=playerTime-startOfSegment;return new Date(segment.dateTimeObject.getTime()+offsetFromSegmentStart*1e3)};var originalSegmentVideoDuration=function originalSegmentVideoDuration(videoTimingInfo){return videoTimingInfo.transmuxedPresentationEnd-videoTimingInfo.transmuxedPresentationStart-videoTimingInfo.transmuxerPrependedSeconds};var findSegmentForProgramTime=function findSegmentForProgramTime(programTime,playlist){var dateTimeObject;try{dateTimeObject=new Date(programTime);}catch(e){return null}if(!playlist||!playlist.segments||playlist.segments.length===0){return null}var segment=playlist.segments[0];if(dateTimeObject<segment.dateTimeObject){return null}for(var i=0;i<playlist.segments.length-1;i++){segment=playlist.segments[i];var nextSegmentStart=playlist.segments[i+1].dateTimeObject;if(dateTimeObject<nextSegmentStart){break}}var lastSegment=playlist.segments[playlist.segments.length-1];var lastSegmentStart=lastSegment.dateTimeObject;var lastSegmentDuration=lastSegment.videoTimingInfo?originalSegmentVideoDuration(lastSegment.videoTimingInfo):lastSegment.duration+lastSegment.duration*SEGMENT_END_FUDGE_PERCENT;var lastSegmentEnd=new Date(lastSegmentStart.getTime()+lastSegmentDuration*1e3);if(dateTimeObject>lastSegmentEnd){return null}if(dateTimeObject>lastSegmentStart){segment=lastSegment;}return {segment:segment,estimatedStart:segment.videoTimingInfo?segment.videoTimingInfo.transmuxedPresentationStart:Playlist.duration(playlist,playlist.mediaSequence+playlist.segments.indexOf(segment)),type:segment.videoTimingInfo?"accurate":"estimate"}};var findSegmentForPlayerTime=function findSegmentForPlayerTime(time,playlist){if(!playlist||!playlist.segments||playlist.segments.length===0){return null}var segmentEnd=0;var segment;for(var i=0;i<playlist.segments.length;i++){segment=playlist.segments[i];segmentEnd=segment.videoTimingInfo?segment.videoTimingInfo.transmuxedPresentationEnd:segmentEnd+segment.duration;if(time<=segmentEnd){break}}var lastSegment=playlist.segments[playlist.segments.length-1];if(lastSegment.videoTimingInfo&&lastSegment.videoTimingInfo.transmuxedPresentationEnd<time){return null}if(time>segmentEnd){if(time>segmentEnd+lastSegment.duration*SEGMENT_END_FUDGE_PERCENT){return null}segment=lastSegment;}return {segment:segment,estimatedStart:segment.videoTimingInfo?segment.videoTimingInfo.transmuxedPresentationStart:segmentEnd-segment.duration,type:segment.videoTimingInfo?"accurate":"estimate"}};var getOffsetFromTimestamp=function getOffsetFromTimestamp(comparisonTimeStamp,programTime){var segmentDateTime;var programDateTime;try{segmentDateTime=new Date(comparisonTimeStamp);programDateTime=new Date(programTime);}catch(e){}var segmentTimeEpoch=segmentDateTime.getTime();var programTimeEpoch=programDateTime.getTime();return (programTimeEpoch-segmentTimeEpoch)/1e3};var verifyProgramDateTimeTags=function verifyProgramDateTimeTags(playlist){if(!playlist.segments||playlist.segments.length===0){return false}for(var i=0;i<playlist.segments.length;i++){var segment=playlist.segments[i];if(!segment.dateTimeObject){return false}}return true};var getProgramTime=function getProgramTime(_ref){var playlist=_ref.playlist,_ref$time=_ref.time,time=_ref$time===void 0?undefined:_ref$time,callback=_ref.callback;if(!callback){throw new Error("getProgramTime: callback must be provided")}if(!playlist||time===undefined){return callback({message:"getProgramTime: playlist and time must be provided"})}var matchedSegment=findSegmentForPlayerTime(time,playlist);if(!matchedSegment){return callback({message:"valid programTime was not found"})}if(matchedSegment.type==="estimate"){return callback({message:"Accurate programTime could not be determined."+" Please seek to e.seekTime and try again",seekTime:matchedSegment.estimatedStart})}var programTimeObject={mediaSeconds:time};var programTime=playerTimeToProgramTime(time,matchedSegment.segment);if(programTime){programTimeObject.programDateTime=programTime.toISOString();}return callback(null,programTimeObject)};var seekToProgramTime=function seekToProgramTime(_ref2){var programTime=_ref2.programTime,playlist=_ref2.playlist,_ref2$retryCount=_ref2.retryCount,retryCount=_ref2$retryCount===void 0?2:_ref2$retryCount,seekTo=_ref2.seekTo,_ref2$pauseAfterSeek=_ref2.pauseAfterSeek,pauseAfterSeek=_ref2$pauseAfterSeek===void 0?true:_ref2$pauseAfterSeek,tech=_ref2.tech,callback=_ref2.callback;if(!callback){throw new Error("seekToProgramTime: callback must be provided")}if(typeof programTime==="undefined"||!playlist||!seekTo){return callback({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"})}if(!playlist.endList&&!tech.hasStarted_){return callback({message:"player must be playing a live stream to start buffering"})}if(!verifyProgramDateTimeTags(playlist)){return callback({message:"programDateTime tags must be provided in the manifest "+playlist.resolvedUri})}var matchedSegment=findSegmentForProgramTime(programTime,playlist);if(!matchedSegment){return callback({message:programTime+" was not found in the stream"})}var segment=matchedSegment.segment;var mediaOffset=getOffsetFromTimestamp(segment.dateTimeObject,programTime);if(matchedSegment.type==="estimate"){if(retryCount===0){return callback({message:programTime+" is not buffered yet. Try again"})}seekTo(matchedSegment.estimatedStart+mediaOffset);tech.one("seeked",function(){seekToProgramTime({programTime:programTime,playlist:playlist,retryCount:retryCount-1,seekTo:seekTo,pauseAfterSeek:pauseAfterSeek,tech:tech,callback:callback});});return}var seekToTime=segment.start+mediaOffset;var seekedCallback=function seekedCallback(){return callback(null,tech.currentTime())};tech.one("seeked",seekedCallback);if(pauseAfterSeek){tech.pause();}seekTo(seekToTime);};var callbackOnCompleted=function callbackOnCompleted(request,cb){if(request.readyState===4){return cb()}return};var containerRequest=function containerRequest(uri,xhr,cb){var bytes=[];var id3Offset;var finished=false;var endRequestAndCallback=function endRequestAndCallback(err,req,type,_bytes){req.abort();finished=true;return cb(err,req,type,_bytes)};var progressListener=function progressListener(error,request){if(finished){return}if(error){return endRequestAndCallback(error,request,"",bytes)}var newPart=request.responseText.substring(bytes&&bytes.byteLength||0,request.responseText.length);bytes=concatTypedArrays(bytes,stringToBytes(newPart,true));id3Offset=id3Offset||getId3Offset(bytes);if(bytes.length<10||id3Offset&&bytes.length<id3Offset+2){return callbackOnCompleted(request,function(){return endRequestAndCallback(error,request,"",bytes)})}var type=detectContainerForBytes(bytes);if(type==="ts"&&bytes.length<188){return callbackOnCompleted(request,function(){return endRequestAndCallback(error,request,"",bytes)})}if(!type&&bytes.length<376){return callbackOnCompleted(request,function(){return endRequestAndCallback(error,request,"",bytes)})}return endRequestAndCallback(null,request,type,bytes)};var options={uri:uri,beforeSend:function beforeSend(request){request.overrideMimeType("text/plain; charset=x-user-defined");request.addEventListener("progress",function(_ref){_ref.total;_ref.loaded;return callbackWrapper(request,null,{statusCode:request.status},progressListener)});}};var request=xhr(options,function(error,response){return callbackWrapper(request,error,response,progressListener)});return request};var EventTarget=videojs.EventTarget,mergeOptions=videojs.mergeOptions;var dashPlaylistUnchanged=function dashPlaylistUnchanged(a,b){if(!isPlaylistUnchanged(a,b)){return false}if(a.sidx&&b.sidx&&(a.sidx.offset!==b.sidx.offset||a.sidx.length!==b.sidx.length)){return false}else if(!a.sidx&&b.sidx||a.sidx&&!b.sidx){return false}if(a.segments&&!b.segments||!a.segments&&b.segments){return false}if(!a.segments&&!b.segments){return true}for(var i=0;i<a.segments.length;i++){var aSegment=a.segments[i];var bSegment=b.segments[i];if(aSegment.uri!==bSegment.uri){return false}if(!aSegment.byterange&&!bSegment.byterange){continue}var aByterange=aSegment.byterange;var bByterange=bSegment.byterange;if(aByterange&&!bByterange||!aByterange&&bByterange){return false}if(aByterange.offset!==bByterange.offset||aByterange.length!==bByterange.length){return false}}return true};var parseMasterXml=function parseMasterXml(_ref){var masterXml=_ref.masterXml,srcUrl=_ref.srcUrl,clientOffset=_ref.clientOffset,sidxMapping=_ref.sidxMapping,previousManifest=_ref.previousManifest;var manifest=parse(masterXml,{manifestUri:srcUrl,clientOffset:clientOffset,sidxMapping:sidxMapping,previousManifest:previousManifest});addPropertiesToMaster(manifest,srcUrl);return manifest};var updateMaster=function updateMaster(oldMaster,newMaster,sidxMapping){var noChanges=true;var update=mergeOptions(oldMaster,{duration:newMaster.duration,minimumUpdatePeriod:newMaster.minimumUpdatePeriod,timelineStarts:newMaster.timelineStarts});for(var i=0;i<newMaster.playlists.length;i++){var playlist=newMaster.playlists[i];if(playlist.sidx){var sidxKey=generateSidxKey(playlist.sidx);if(sidxMapping&&sidxMapping[sidxKey]&&sidxMapping[sidxKey].sidx){addSidxSegmentsToPlaylist$1(playlist,sidxMapping[sidxKey].sidx,playlist.sidx.resolvedUri);}}var playlistUpdate=updateMaster$1(update,playlist,dashPlaylistUnchanged);if(playlistUpdate){update=playlistUpdate;noChanges=false;}}forEachMediaGroup(newMaster,function(properties,type,group,label){if(properties.playlists&&properties.playlists.length){var id=properties.playlists[0].id;var _playlistUpdate=updateMaster$1(update,properties.playlists[0],dashPlaylistUnchanged);if(_playlistUpdate){update=_playlistUpdate;update.mediaGroups[type][group][label].playlists[0]=update.playlists[id];noChanges=false;}}});if(newMaster.minimumUpdatePeriod!==oldMaster.minimumUpdatePeriod){noChanges=false;}if(noChanges){return null}return update};var equivalentSidx=function equivalentSidx(a,b){var neitherMap=Boolean(!a.map&&!b.map);var equivalentMap=neitherMap||Boolean(a.map&&b.map&&a.map.byterange.offset===b.map.byterange.offset&&a.map.byterange.length===b.map.byterange.length);return equivalentMap&&a.uri===b.uri&&a.byterange.offset===b.byterange.offset&&a.byterange.length===b.byterange.length};var compareSidxEntry=function compareSidxEntry(playlists,oldSidxMapping){var newSidxMapping={};for(var id in playlists){var playlist=playlists[id];var currentSidxInfo=playlist.sidx;if(currentSidxInfo){var key=generateSidxKey(currentSidxInfo);if(!oldSidxMapping[key]){break}var savedSidxInfo=oldSidxMapping[key].sidxInfo;if(equivalentSidx(savedSidxInfo,currentSidxInfo)){newSidxMapping[key]=oldSidxMapping[key];}}}return newSidxMapping};var filterChangedSidxMappings=function filterChangedSidxMappings(master,oldSidxMapping){var videoSidx=compareSidxEntry(master.playlists,oldSidxMapping);var mediaGroupSidx=videoSidx;forEachMediaGroup(master,function(properties,mediaType,groupKey,labelKey){if(properties.playlists&&properties.playlists.length){var playlists=properties.playlists;mediaGroupSidx=mergeOptions(mediaGroupSidx,compareSidxEntry(playlists,oldSidxMapping));}});return mediaGroupSidx};var DashPlaylistLoader=function(_EventTarget){_inheritsLoose(DashPlaylistLoader,_EventTarget);function DashPlaylistLoader(srcUrlOrPlaylist,vhs,options,masterPlaylistLoader){var _this;if(options===void 0){options={};}_this=_EventTarget.call(this)||this;_this.masterPlaylistLoader_=masterPlaylistLoader||_assertThisInitialized(_this);if(!masterPlaylistLoader){_this.isMaster_=true;}var _options=options,_options$withCredenti=_options.withCredentials,withCredentials=_options$withCredenti===void 0?false:_options$withCredenti,_options$handleManife=_options.handleManifestRedirects,handleManifestRedirects=_options$handleManife===void 0?false:_options$handleManife;_this.vhs_=vhs;_this.withCredentials=withCredentials;_this.handleManifestRedirects=handleManifestRedirects;if(!srcUrlOrPlaylist){throw new Error("A non-empty playlist URL or object is required")}_this.on("minimumUpdatePeriod",function(){_this.refreshXml_();});_this.on("mediaupdatetimeout",function(){_this.refreshMedia_(_this.media().id);});_this.state="HAVE_NOTHING";_this.loadedPlaylists_={};_this.logger_=logger("DashPlaylistLoader");if(_this.isMaster_){_this.masterPlaylistLoader_.srcUrl=srcUrlOrPlaylist;_this.masterPlaylistLoader_.sidxMapping_={};}else {_this.childPlaylist_=srcUrlOrPlaylist;}return _this}var _proto=DashPlaylistLoader.prototype;_proto.requestErrored_=function requestErrored_(err,request,startingState){if(!this.request){return true}this.request=null;if(err){this.error=typeof err==="object"&&!(err instanceof Error)?err:{status:request.status,message:"DASH request error at URL: "+request.uri,response:request.response,code:2};if(startingState){this.state=startingState;}this.trigger("error");return true}};_proto.addSidxSegments_=function addSidxSegments_(playlist,startingState,cb){var _this2=this;var sidxKey=playlist.sidx&&generateSidxKey(playlist.sidx);if(!playlist.sidx||!sidxKey||this.masterPlaylistLoader_.sidxMapping_[sidxKey]){this.mediaRequest_=window_1.setTimeout(function(){return cb(false)},0);return}var uri=resolveManifestRedirect(this.handleManifestRedirects,playlist.sidx.resolvedUri);var fin=function fin(err,request){if(_this2.requestErrored_(err,request,startingState)){return}var sidxMapping=_this2.masterPlaylistLoader_.sidxMapping_;var sidx;try{sidx=parseSidx_1(toUint8(request.response).subarray(8));}catch(e){_this2.requestErrored_(e,request,startingState);return}sidxMapping[sidxKey]={sidxInfo:playlist.sidx,sidx:sidx};addSidxSegmentsToPlaylist$1(playlist,sidx,playlist.sidx.resolvedUri);return cb(true)};this.request=containerRequest(uri,this.vhs_.xhr,function(err,request,container,bytes){if(err){return fin(err,request)}if(!container||container!=="mp4"){return fin({status:request.status,message:"Unsupported "+(container||"unknown")+" container type for sidx segment at URL: "+uri,response:"",playlist:playlist,internal:true,blacklistDuration:Infinity,code:2},request)}var _playlist$sidx$bytera=playlist.sidx.byterange,offset=_playlist$sidx$bytera.offset,length=_playlist$sidx$bytera.length;if(bytes.length>=length+offset){return fin(err,{response:bytes.subarray(offset,offset+length),status:request.status,uri:request.uri})}_this2.request=_this2.vhs_.xhr({uri:uri,responseType:"arraybuffer",headers:segmentXhrHeaders({byterange:playlist.sidx.byterange})},fin);});};_proto.dispose=function dispose(){this.trigger("dispose");this.stopRequest();this.loadedPlaylists_={};window_1.clearTimeout(this.minimumUpdatePeriodTimeout_);window_1.clearTimeout(this.mediaRequest_);window_1.clearTimeout(this.mediaUpdateTimeout);this.mediaUpdateTimeout=null;this.mediaRequest_=null;this.minimumUpdatePeriodTimeout_=null;if(this.masterPlaylistLoader_.createMupOnMedia_){this.off("loadedmetadata",this.masterPlaylistLoader_.createMupOnMedia_);this.masterPlaylistLoader_.createMupOnMedia_=null;}this.off();};_proto.hasPendingRequest=function hasPendingRequest(){return this.request||this.mediaRequest_};_proto.stopRequest=function stopRequest(){if(this.request){var oldRequest=this.request;this.request=null;oldRequest.onreadystatechange=null;oldRequest.abort();}};_proto.media=function media(playlist){var _this3=this;if(!playlist){return this.media_}if(this.state==="HAVE_NOTHING"){throw new Error("Cannot switch media playlist from "+this.state)}var startingState=this.state;if(typeof playlist==="string"){if(!this.masterPlaylistLoader_.master.playlists[playlist]){throw new Error("Unknown playlist URI: "+playlist)}playlist=this.masterPlaylistLoader_.master.playlists[playlist];}var mediaChange=!this.media_||playlist.id!==this.media_.id;if(mediaChange&&this.loadedPlaylists_[playlist.id]&&this.loadedPlaylists_[playlist.id].endList){this.state="HAVE_METADATA";this.media_=playlist;if(mediaChange){this.trigger("mediachanging");this.trigger("mediachange");}return}if(!mediaChange){return}if(this.media_){this.trigger("mediachanging");}this.addSidxSegments_(playlist,startingState,function(sidxChanged){_this3.haveMetadata({startingState:startingState,playlist:playlist});});};_proto.haveMetadata=function haveMetadata(_ref2){var startingState=_ref2.startingState,playlist=_ref2.playlist;this.state="HAVE_METADATA";this.loadedPlaylists_[playlist.id]=playlist;this.mediaRequest_=null;this.refreshMedia_(playlist.id);if(startingState==="HAVE_MASTER"){this.trigger("loadedmetadata");}else {this.trigger("mediachange");}};_proto.pause=function pause(){if(this.masterPlaylistLoader_.createMupOnMedia_){this.off("loadedmetadata",this.masterPlaylistLoader_.createMupOnMedia_);this.masterPlaylistLoader_.createMupOnMedia_=null;}this.stopRequest();window_1.clearTimeout(this.mediaUpdateTimeout);this.mediaUpdateTimeout=null;if(this.isMaster_){window_1.clearTimeout(this.masterPlaylistLoader_.minimumUpdatePeriodTimeout_);this.masterPlaylistLoader_.minimumUpdatePeriodTimeout_=null;}if(this.state==="HAVE_NOTHING"){this.started=false;}};_proto.load=function load(isFinalRendition){var _this4=this;window_1.clearTimeout(this.mediaUpdateTimeout);this.mediaUpdateTimeout=null;var media=this.media();if(isFinalRendition){var delay=media?media.targetDuration/2*1e3:5*1e3;this.mediaUpdateTimeout=window_1.setTimeout(function(){return _this4.load()},delay);return}if(!this.started){this.start();return}if(media&&!media.endList){if(this.isMaster_&&!this.minimumUpdatePeriodTimeout_){this.trigger("minimumUpdatePeriod");this.updateMinimumUpdatePeriodTimeout_();}this.trigger("mediaupdatetimeout");}else {this.trigger("loadedplaylist");}};_proto.start=function start(){var _this5=this;this.started=true;if(!this.isMaster_){this.mediaRequest_=window_1.setTimeout(function(){return _this5.haveMaster_()},0);return}this.requestMaster_(function(req,masterChanged){_this5.haveMaster_();if(!_this5.hasPendingRequest()&&!_this5.media_){_this5.media(_this5.masterPlaylistLoader_.master.playlists[0]);}});};_proto.requestMaster_=function requestMaster_(cb){var _this6=this;this.request=this.vhs_.xhr({uri:this.masterPlaylistLoader_.srcUrl,withCredentials:this.withCredentials},function(error,req){if(_this6.requestErrored_(error,req)){if(_this6.state==="HAVE_NOTHING"){_this6.started=false;}return}var masterChanged=req.responseText!==_this6.masterPlaylistLoader_.masterXml_;_this6.masterPlaylistLoader_.masterXml_=req.responseText;if(req.responseHeaders&&req.responseHeaders.date){_this6.masterLoaded_=Date.parse(req.responseHeaders.date);}else {_this6.masterLoaded_=Date.now();}_this6.masterPlaylistLoader_.srcUrl=resolveManifestRedirect(_this6.handleManifestRedirects,_this6.masterPlaylistLoader_.srcUrl,req);if(masterChanged){_this6.handleMaster_();_this6.syncClientServerClock_(function(){return cb(req,masterChanged)});return}return cb(req,masterChanged)});};_proto.syncClientServerClock_=function syncClientServerClock_(done){var _this7=this;var utcTiming=parseUTCTiming(this.masterPlaylistLoader_.masterXml_);if(utcTiming===null){this.masterPlaylistLoader_.clientOffset_=this.masterLoaded_-Date.now();return done()}if(utcTiming.method==="DIRECT"){this.masterPlaylistLoader_.clientOffset_=utcTiming.value-Date.now();return done()}this.request=this.vhs_.xhr({uri:resolveUrl(this.masterPlaylistLoader_.srcUrl,utcTiming.value),method:utcTiming.method,withCredentials:this.withCredentials},function(error,req){if(!_this7.request){return}if(error){_this7.masterPlaylistLoader_.clientOffset_=_this7.masterLoaded_-Date.now();return done()}var serverTime;if(utcTiming.method==="HEAD"){if(!req.responseHeaders||!req.responseHeaders.date){serverTime=_this7.masterLoaded_;}else {serverTime=Date.parse(req.responseHeaders.date);}}else {serverTime=Date.parse(req.responseText);}_this7.masterPlaylistLoader_.clientOffset_=serverTime-Date.now();done();});};_proto.haveMaster_=function haveMaster_(){this.state="HAVE_MASTER";if(this.isMaster_){this.trigger("loadedplaylist");}else if(!this.media_){this.media(this.childPlaylist_);}};_proto.handleMaster_=function handleMaster_(){this.mediaRequest_=null;var oldMaster=this.masterPlaylistLoader_.master;var newMaster=parseMasterXml({masterXml:this.masterPlaylistLoader_.masterXml_,srcUrl:this.masterPlaylistLoader_.srcUrl,clientOffset:this.masterPlaylistLoader_.clientOffset_,sidxMapping:this.masterPlaylistLoader_.sidxMapping_,previousManifest:oldMaster});if(oldMaster){newMaster=updateMaster(oldMaster,newMaster,this.masterPlaylistLoader_.sidxMapping_);}this.masterPlaylistLoader_.master=newMaster?newMaster:oldMaster;var location=this.masterPlaylistLoader_.master.locations&&this.masterPlaylistLoader_.master.locations[0];if(location&&location!==this.masterPlaylistLoader_.srcUrl){this.masterPlaylistLoader_.srcUrl=location;}if(!oldMaster||newMaster&&newMaster.minimumUpdatePeriod!==oldMaster.minimumUpdatePeriod){this.updateMinimumUpdatePeriodTimeout_();}return Boolean(newMaster)};_proto.updateMinimumUpdatePeriodTimeout_=function updateMinimumUpdatePeriodTimeout_(){var mpl=this.masterPlaylistLoader_;if(mpl.createMupOnMedia_){mpl.off("loadedmetadata",mpl.createMupOnMedia_);mpl.createMupOnMedia_=null;}if(mpl.minimumUpdatePeriodTimeout_){window_1.clearTimeout(mpl.minimumUpdatePeriodTimeout_);mpl.minimumUpdatePeriodTimeout_=null;}var mup=mpl.master&&mpl.master.minimumUpdatePeriod;if(mup===0){if(mpl.media()){mup=mpl.media().targetDuration*1e3;}else {mpl.createMupOnMedia_=mpl.updateMinimumUpdatePeriodTimeout_;mpl.one("loadedmetadata",mpl.createMupOnMedia_);}}if(typeof mup!=="number"||mup<=0){if(mup<0){this.logger_("found invalid minimumUpdatePeriod of "+mup+", not setting a timeout");}return}this.createMUPTimeout_(mup);};_proto.createMUPTimeout_=function createMUPTimeout_(mup){var mpl=this.masterPlaylistLoader_;mpl.minimumUpdatePeriodTimeout_=window_1.setTimeout(function(){mpl.minimumUpdatePeriodTimeout_=null;mpl.trigger("minimumUpdatePeriod");mpl.createMUPTimeout_(mup);},mup);};_proto.refreshXml_=function refreshXml_(){var _this8=this;this.requestMaster_(function(req,masterChanged){if(!masterChanged){return}if(_this8.media_){_this8.media_=_this8.masterPlaylistLoader_.master.playlists[_this8.media_.id];}_this8.masterPlaylistLoader_.sidxMapping_=filterChangedSidxMappings(_this8.masterPlaylistLoader_.master,_this8.masterPlaylistLoader_.sidxMapping_);_this8.addSidxSegments_(_this8.media(),_this8.state,function(sidxChanged){_this8.refreshMedia_(_this8.media().id);});});};_proto.refreshMedia_=function refreshMedia_(mediaID){var _this9=this;if(!mediaID){throw new Error("refreshMedia_ must take a media id")}if(this.media_&&this.isMaster_){this.handleMaster_();}var playlists=this.masterPlaylistLoader_.master.playlists;var mediaChanged=!this.media_||this.media_!==playlists[mediaID];if(mediaChanged){this.media_=playlists[mediaID];}else {this.trigger("playlistunchanged");}if(!this.mediaUpdateTimeout){var createMediaUpdateTimeout=function createMediaUpdateTimeout(){if(_this9.media().endList){return}_this9.mediaUpdateTimeout=window_1.setTimeout(function(){_this9.trigger("mediaupdatetimeout");createMediaUpdateTimeout();},refreshDelay(_this9.media(),Boolean(mediaChanged)));};createMediaUpdateTimeout();}this.trigger("loadedplaylist");};return DashPlaylistLoader}(EventTarget);var Config={GOAL_BUFFER_LENGTH:30,MAX_GOAL_BUFFER_LENGTH:60,BACK_BUFFER_LENGTH:30,GOAL_BUFFER_LENGTH_RATE:1,INITIAL_BANDWIDTH:4194304,BANDWIDTH_VARIANCE:1.2,BUFFER_LOW_WATER_LINE:0,MAX_BUFFER_LOW_WATER_LINE:30,EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:16,BUFFER_LOW_WATER_LINE_RATE:1,BUFFER_HIGH_WATER_LINE:30};var stringToArrayBuffer=function stringToArrayBuffer(string){var view=new Uint8Array(new ArrayBuffer(string.length));for(var i=0;i<string.length;i++){view[i]=string.charCodeAt(i);}return view.buffer};var browserWorkerPolyFill=function browserWorkerPolyFill(workerObj){workerObj.on=workerObj.addEventListener;workerObj.off=workerObj.removeEventListener;return workerObj};var createObjectURL=function createObjectURL(str){try{return URL.createObjectURL(new Blob([str],{type:"application/javascript"}))}catch(e){var blob=new BlobBuilder;blob.append(str);return URL.createObjectURL(blob.getBlob())}};var factory=function factory(code){return function(){var objectUrl=createObjectURL(code);var worker=browserWorkerPolyFill(new Worker(objectUrl));worker.objURL=objectUrl;var terminate=worker.terminate;worker.on=worker.addEventListener;worker.off=worker.removeEventListener;worker.terminate=function(){URL.revokeObjectURL(objectUrl);return terminate.call(this)};return worker}};var transform=function transform(code){return "var browserWorkerPolyFill = "+browserWorkerPolyFill.toString()+";\n"+"browserWorkerPolyFill(self);\n"+code};var getWorkerString=function getWorkerString(fn){return fn.toString().replace(/^function.+?{/,"").slice(0,-1)};var workerCode$1=transform(getWorkerString(function(){var Stream=function Stream(){this.init=function(){var listeners={};this.on=function(type,listener){if(!listeners[type]){listeners[type]=[];}listeners[type]=listeners[type].concat(listener);};this.off=function(type,listener){var index;if(!listeners[type]){return false}index=listeners[type].indexOf(listener);listeners[type]=listeners[type].slice();listeners[type].splice(index,1);return index>-1};this.trigger=function(type){var callbacks,i,length,args;callbacks=listeners[type];if(!callbacks){return}if(arguments.length===2){length=callbacks.length;for(i=0;i<length;++i){callbacks[i].call(this,arguments[1]);}}else {args=[];i=arguments.length;for(i=1;i<arguments.length;++i){args.push(arguments[i]);}length=callbacks.length;for(i=0;i<length;++i){callbacks[i].apply(this,args);}}};this.dispose=function(){listeners={};};};};Stream.prototype.pipe=function(destination){this.on("data",function(data){destination.push(data);});this.on("done",function(flushSource){destination.flush(flushSource);});this.on("partialdone",function(flushSource){destination.partialFlush(flushSource);});this.on("endedtimeline",function(flushSource){destination.endTimeline(flushSource);});this.on("reset",function(flushSource){destination.reset(flushSource);});return destination};Stream.prototype.push=function(data){this.trigger("data",data);};Stream.prototype.flush=function(flushSource){this.trigger("done",flushSource);};Stream.prototype.partialFlush=function(flushSource){this.trigger("partialdone",flushSource);};Stream.prototype.endTimeline=function(flushSource){this.trigger("endedtimeline",flushSource);};Stream.prototype.reset=function(flushSource){this.trigger("reset",flushSource);};var stream=Stream;var MAX_UINT32$1=Math.pow(2,32);var getUint64$2=function getUint64(uint8){var dv=new DataView(uint8.buffer,uint8.byteOffset,uint8.byteLength);var value;if(dv.getBigUint64){value=dv.getBigUint64(0);if(value<Number.MAX_SAFE_INTEGER){return Number(value)}return value}return dv.getUint32(0)*MAX_UINT32$1+dv.getUint32(4)};var numbers={getUint64:getUint64$2,MAX_UINT32:MAX_UINT32$1};var MAX_UINT32=numbers.MAX_UINT32;var box,dinf,esds,ftyp,mdat,mfhd,minf,moof,moov,mvex,mvhd,trak,tkhd,mdia,mdhd,hdlr,sdtp,stbl,stsd,traf,trex,trun$1,types,MAJOR_BRAND,MINOR_VERSION,AVC1_BRAND,VIDEO_HDLR,AUDIO_HDLR,HDLR_TYPES,VMHD,SMHD,DREF,STCO,STSC,STSZ,STTS;(function(){var i;types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],pasp:[],sdtp:[],smhd:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],styp:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[]};if(typeof Uint8Array==="undefined"){return}for(i in types){if(types.hasOwnProperty(i)){types[i]=[i.charCodeAt(0),i.charCodeAt(1),i.charCodeAt(2),i.charCodeAt(3)];}}MAJOR_BRAND=new Uint8Array(["i".charCodeAt(0),"s".charCodeAt(0),"o".charCodeAt(0),"m".charCodeAt(0)]);AVC1_BRAND=new Uint8Array(["a".charCodeAt(0),"v".charCodeAt(0),"c".charCodeAt(0),"1".charCodeAt(0)]);MINOR_VERSION=new Uint8Array([0,0,0,1]);VIDEO_HDLR=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]);AUDIO_HDLR=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]);HDLR_TYPES={video:VIDEO_HDLR,audio:AUDIO_HDLR};DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]);SMHD=new Uint8Array([0,0,0,0,0,0,0,0]);STCO=new Uint8Array([0,0,0,0,0,0,0,0]);STSC=STCO;STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]);STTS=STCO;VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]);})();box=function box(type){var payload=[],size=0,i,result,view;for(i=1;i<arguments.length;i++){payload.push(arguments[i]);}i=payload.length;while(i--){size+=payload[i].byteLength;}result=new Uint8Array(size+8);view=new DataView(result.buffer,result.byteOffset,result.byteLength);view.setUint32(0,result.byteLength);result.set(type,4);for(i=0,size=8;i<payload.length;i++){result.set(payload[i],size);size+=payload[i].byteLength;}return result};dinf=function dinf(){return box(types.dinf,box(types.dref,DREF))};esds=function esds(track){return box(types.esds,new Uint8Array([0,0,0,0,3,25,0,0,0,4,17,64,21,0,6,0,0,0,218,192,0,0,218,192,5,2,track.audioobjecttype<<3|track.samplingfrequencyindex>>>1,track.samplingfrequencyindex<<7|track.channelcount<<3,6,1,2]))};ftyp=function ftyp(){return box(types.ftyp,MAJOR_BRAND,MINOR_VERSION,MAJOR_BRAND,AVC1_BRAND)};hdlr=function hdlr(type){return box(types.hdlr,HDLR_TYPES[type])};mdat=function mdat(data){return box(types.mdat,data)};mdhd=function mdhd(track){var result=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,track.duration>>>24&255,track.duration>>>16&255,track.duration>>>8&255,track.duration&255,85,196,0,0]);if(track.samplerate){result[12]=track.samplerate>>>24&255;result[13]=track.samplerate>>>16&255;result[14]=track.samplerate>>>8&255;result[15]=track.samplerate&255;}return box(types.mdhd,result)};mdia=function mdia(track){return box(types.mdia,mdhd(track),hdlr(track.type),minf(track))};mfhd=function mfhd(sequenceNumber){return box(types.mfhd,new Uint8Array([0,0,0,0,(sequenceNumber&4278190080)>>24,(sequenceNumber&16711680)>>16,(sequenceNumber&65280)>>8,sequenceNumber&255]))};minf=function minf(track){return box(types.minf,track.type==="video"?box(types.vmhd,VMHD):box(types.smhd,SMHD),dinf(),stbl(track))};moof=function moof(sequenceNumber,tracks){var trackFragments=[],i=tracks.length;while(i--){trackFragments[i]=traf(tracks[i]);}return box.apply(null,[types.moof,mfhd(sequenceNumber)].concat(trackFragments))};moov=function moov(tracks){var i=tracks.length,boxes=[];while(i--){boxes[i]=trak(tracks[i]);}return box.apply(null,[types.moov,mvhd(4294967295)].concat(boxes).concat(mvex(tracks)))};mvex=function mvex(tracks){var i=tracks.length,boxes=[];while(i--){boxes[i]=trex(tracks[i]);}return box.apply(null,[types.mvex].concat(boxes))};mvhd=function mvhd(duration){var bytes=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(duration&4278190080)>>24,(duration&16711680)>>16,(duration&65280)>>8,duration&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 box(types.mvhd,bytes)};sdtp=function sdtp(track){var samples=track.samples||[],bytes=new Uint8Array(4+samples.length),flags,i;for(i=0;i<samples.length;i++){flags=samples[i].flags;bytes[i+4]=flags.dependsOn<<4|flags.isDependedOn<<2|flags.hasRedundancy;}return box(types.sdtp,bytes)};stbl=function stbl(track){return box(types.stbl,stsd(track),box(types.stts,STTS),box(types.stsc,STSC),box(types.stsz,STSZ),box(types.stco,STCO))};(function(){var videoSample,audioSample;stsd=function stsd(track){return box(types.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),track.type==="video"?videoSample(track):audioSample(track))};videoSample=function videoSample(track){var sps=track.sps||[],pps=track.pps||[],sequenceParameterSets=[],pictureParameterSets=[],i,avc1Box;for(i=0;i<sps.length;i++){sequenceParameterSets.push((sps[i].byteLength&65280)>>>8);sequenceParameterSets.push(sps[i].byteLength&255);sequenceParameterSets=sequenceParameterSets.concat(Array.prototype.slice.call(sps[i]));}for(i=0;i<pps.length;i++){pictureParameterSets.push((pps[i].byteLength&65280)>>>8);pictureParameterSets.push(pps[i].byteLength&255);pictureParameterSets=pictureParameterSets.concat(Array.prototype.slice.call(pps[i]));}avc1Box=[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,(track.width&65280)>>8,track.width&255,(track.height&65280)>>8,track.height&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),box(types.avcC,new Uint8Array([1,track.profileIdc,track.profileCompatibility,track.levelIdc,255].concat([sps.length],sequenceParameterSets,[pps.length],pictureParameterSets))),box(types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))];if(track.sarRatio){var hSpacing=track.sarRatio[0],vSpacing=track.sarRatio[1];avc1Box.push(box(types.pasp,new Uint8Array([(hSpacing&4278190080)>>24,(hSpacing&16711680)>>16,(hSpacing&65280)>>8,hSpacing&255,(vSpacing&4278190080)>>24,(vSpacing&16711680)>>16,(vSpacing&65280)>>8,vSpacing&255])));}return box.apply(null,avc1Box)};audioSample=function audioSample(track){return box(types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(track.channelcount&65280)>>8,track.channelcount&255,(track.samplesize&65280)>>8,track.samplesize&255,0,0,0,0,(track.samplerate&65280)>>8,track.samplerate&255,0,0]),esds(track))};})();tkhd=function tkhd(track){var result=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(track.id&4278190080)>>24,(track.id&16711680)>>16,(track.id&65280)>>8,track.id&255,0,0,0,0,(track.duration&4278190080)>>24,(track.duration&16711680)>>16,(track.duration&65280)>>8,track.duration&255,0,0,0,0,0,0,0,0,0,0,0,0,1,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,(track.width&65280)>>8,track.width&255,0,0,(track.height&65280)>>8,track.height&255,0,0]);return box(types.tkhd,result)};traf=function traf(track){var trackFragmentHeader,trackFragmentDecodeTime,trackFragmentRun,sampleDependencyTable,dataOffset,upperWordBaseMediaDecodeTime,lowerWordBaseMediaDecodeTime;trackFragmentHeader=box(types.tfhd,new Uint8Array([0,0,0,58,(track.id&4278190080)>>24,(track.id&16711680)>>16,(track.id&65280)>>8,track.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0]));upperWordBaseMediaDecodeTime=Math.floor(track.baseMediaDecodeTime/MAX_UINT32);lowerWordBaseMediaDecodeTime=Math.floor(track.baseMediaDecodeTime%MAX_UINT32);trackFragmentDecodeTime=box(types.tfdt,new Uint8Array([1,0,0,0,upperWordBaseMediaDecodeTime>>>24&255,upperWordBaseMediaDecodeTime>>>16&255,upperWordBaseMediaDecodeTime>>>8&255,upperWordBaseMediaDecodeTime&255,lowerWordBaseMediaDecodeTime>>>24&255,lowerWordBaseMediaDecodeTime>>>16&255,lowerWordBaseMediaDecodeTime>>>8&255,lowerWordBaseMediaDecodeTime&255]));dataOffset=32+20+8+16+8+8;if(track.type==="audio"){trackFragmentRun=trun$1(track,dataOffset);return box(types.traf,trackFragmentHeader,trackFragmentDecodeTime,trackFragmentRun)}sampleDependencyTable=sdtp(track);trackFragmentRun=trun$1(track,sampleDependencyTable.length+dataOffset);return box(types.traf,trackFragmentHeader,trackFragmentDecodeTime,trackFragmentRun,sampleDependencyTable)};trak=function trak(track){track.duration=track.duration||4294967295;return box(types.trak,tkhd(track),mdia(track))};trex=function trex(track){var result=new Uint8Array([0,0,0,0,(track.id&4278190080)>>24,(track.id&16711680)>>16,(track.id&65280)>>8,track.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);if(track.type!=="video"){result[result.length-1]=0;}return box(types.trex,result)};(function(){var audioTrun,videoTrun,trunHeader;trunHeader=function trunHeader(samples,offset){var durationPresent=0,sizePresent=0,flagsPresent=0,compositionTimeOffset=0;if(samples.length){if(samples[0].duration!==undefined){durationPresent=1;}if(samples[0].size!==undefined){sizePresent=2;}if(samples[0].flags!==undefined){flagsPresent=4;}if(samples[0].compositionTimeOffset!==undefined){compositionTimeOffset=8;}}return [0,0,durationPresent|sizePresent|flagsPresent|compositionTimeOffset,1,(samples.length&4278190080)>>>24,(samples.length&16711680)>>>16,(samples.length&65280)>>>8,samples.length&255,(offset&4278190080)>>>24,(offset&16711680)>>>16,(offset&65280)>>>8,offset&255]};videoTrun=function videoTrun(track,offset){var bytesOffest,bytes,header,samples,sample,i;samples=track.samples||[];offset+=8+12+16*samples.length;header=trunHeader(samples,offset);bytes=new Uint8Array(header.length+samples.length*16);bytes.set(header);bytesOffest=header.length;for(i=0;i<samples.length;i++){sample=samples[i];bytes[bytesOffest++]=(sample.duration&4278190080)>>>24;bytes[bytesOffest++]=(sample.duration&16711680)>>>16;bytes[bytesOffest++]=(sample.duration&65280)>>>8;bytes[bytesOffest++]=sample.duration&255;bytes[bytesOffest++]=(sample.size&4278190080)>>>24;bytes[bytesOffest++]=(sample.size&16711680)>>>16;bytes[bytesOffest++]=(sample.size&65280)>>>8;bytes[bytesOffest++]=sample.size&255;bytes[bytesOffest++]=sample.flags.isLeading<<2|sample.flags.dependsOn;bytes[bytesOffest++]=sample.flags.isDependedOn<<6|sample.flags.hasRedundancy<<4|sample.flags.paddingValue<<1|sample.flags.isNonSyncSample;bytes[bytesOffest++]=sample.flags.degradationPriority&240<<8;bytes[bytesOffest++]=sample.flags.degradationPriority&15;bytes[bytesOffest++]=(sample.compositionTimeOffset&4278190080)>>>24;bytes[bytesOffest++]=(sample.compositionTimeOffset&16711680)>>>16;bytes[bytesOffest++]=(sample.compositionTimeOffset&65280)>>>8;bytes[bytesOffest++]=sample.compositionTimeOffset&255;}return box(types.trun,bytes)};audioTrun=function audioTrun(track,offset){var bytes,bytesOffest,header,samples,sample,i;samples=track.samples||[];offset+=8+12+8*samples.length;header=trunHeader(samples,offset);bytes=new Uint8Array(header.length+samples.length*8);bytes.set(header);bytesOffest=header.length;for(i=0;i<samples.length;i++){sample=samples[i];bytes[bytesOffest++]=(sample.duration&4278190080)>>>24;bytes[bytesOffest++]=(sample.duration&16711680)>>>16;bytes[bytesOffest++]=(sample.duration&65280)>>>8;bytes[bytesOffest++]=sample.duration&255;bytes[bytesOffest++]=(sample.size&4278190080)>>>24;bytes[bytesOffest++]=(sample.size&16711680)>>>16;bytes[bytesOffest++]=(sample.size&65280)>>>8;bytes[bytesOffest++]=sample.size&255;}return box(types.trun,bytes)};trun$1=function trun(track,offset){if(track.type==="audio"){return audioTrun(track,offset)}return videoTrun(track,offset)};})();var mp4Generator={ftyp:ftyp,mdat:mdat,moof:moof,moov:moov,initSegment:function initSegment(tracks){var fileType=ftyp(),movie=moov(tracks),result;result=new Uint8Array(fileType.byteLength+movie.byteLength);result.set(fileType);result.set(movie,fileType.byteLength);return result}};var groupNalsIntoFrames=function groupNalsIntoFrames(nalUnits){var i,currentNal,currentFrame=[],frames=[];frames.byteLength=0;frames.nalCount=0;frames.duration=0;currentFrame.byteLength=0;for(i=0;i<nalUnits.length;i++){currentNal=nalUnits[i];if(currentNal.nalUnitType==="access_unit_delimiter_rbsp"){if(currentFrame.length){currentFrame.duration=currentNal.dts-currentFrame.dts;frames.byteLength+=currentFrame.byteLength;frames.nalCount+=currentFrame.length;frames.duration+=currentFrame.duration;frames.push(currentFrame);}currentFrame=[currentNal];currentFrame.byteLength=currentNal.data.byteLength;currentFrame.pts=currentNal.pts;currentFrame.dts=currentNal.dts;}else {if(currentNal.nalUnitType==="slice_layer_without_partitioning_rbsp_idr"){currentFrame.keyFrame=true;}currentFrame.duration=currentNal.dts-currentFrame.dts;currentFrame.byteLength+=currentNal.data.byteLength;currentFrame.push(currentNal);}}if(frames.length&&(!currentFrame.duration||currentFrame.duration<=0)){currentFrame.duration=frames[frames.length-1].duration;}frames.byteLength+=currentFrame.byteLength;frames.nalCount+=currentFrame.length;frames.duration+=currentFrame.duration;frames.push(currentFrame);return frames};var groupFramesIntoGops=function groupFramesIntoGops(frames){var i,currentFrame,currentGop=[],gops=[];currentGop.byteLength=0;currentGop.nalCount=0;currentGop.duration=0;currentGop.pts=frames[0].pts;currentGop.dts=frames[0].dts;gops.byteLength=0;gops.nalCount=0;gops.duration=0;gops.pts=frames[0].pts;gops.dts=frames[0].dts;for(i=0;i<frames.length;i++){currentFrame=frames[i];if(currentFrame.keyFrame){if(currentGop.length){gops.push(currentGop);gops.byteLength+=currentGop.byteLength;gops.nalCount+=currentGop.nalCount;gops.duration+=currentGop.duration;}currentGop=[currentFrame];currentGop.nalCount=currentFrame.length;currentGop.byteLength=currentFrame.byteLength;currentGop.pts=currentFrame.pts;currentGop.dts=currentFrame.dts;currentGop.duration=currentFrame.duration;}else {currentGop.duration+=currentFrame.duration;currentGop.nalCount+=currentFrame.length;currentGop.byteLength+=currentFrame.byteLength;currentGop.push(currentFrame);}}if(gops.length&¤tGop.duration<=0){currentGop.duration=gops[gops.length-1].duration;}gops.byteLength+=currentGop.byteLength;gops.nalCount+=currentGop.nalCount;gops.duration+=currentGop.duration;gops.push(currentGop);return gops};var extendFirstKeyFrame=function extendFirstKeyFrame(gops){var currentGop;if(!gops[0][0].keyFrame&&gops.length>1){currentGop=gops.shift();gops.byteLength-=currentGop.byteLength;gops.nalCount-=currentGop.nalCount;gops[0][0].dts=currentGop.dts;gops[0][0].pts=currentGop.pts;gops[0][0].duration+=currentGop.duration;}return gops};var createDefaultSample=function createDefaultSample(){return {size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}};var sampleForFrame=function sampleForFrame(frame,dataOffset){var sample=createDefaultSample();sample.dataOffset=dataOffset;sample.compositionTimeOffset=frame.pts-frame.dts;sample.duration=frame.duration;sample.size=4*frame.length;sample.size+=frame.byteLength;if(frame.keyFrame){sample.flags.dependsOn=2;sample.flags.isNonSyncSample=0;}return sample};var generateSampleTable$1=function generateSampleTable(gops,baseDataOffset){var h,i,sample,currentGop,currentFrame,dataOffset=baseDataOffset||0,samples=[];for(h=0;h<gops.length;h++){currentGop=gops[h];for(i=0;i<currentGop.length;i++){currentFrame=currentGop[i];sample=sampleForFrame(currentFrame,dataOffset);dataOffset+=sample.size;samples.push(sample);}}return samples};var concatenateNalData=function concatenateNalData(gops){var h,i,j,currentGop,currentFrame,currentNal,dataOffset=0,nalsByteLength=gops.byteLength,numberOfNals=gops.nalCount,totalByteLength=nalsByteLength+4*numberOfNals,data=new Uint8Array(totalByteLength),view=new DataView(data.buffer);for(h=0;h<gops.length;h++){currentGop=gops[h];for(i=0;i<currentGop.length;i++){currentFrame=currentGop[i];for(j=0;j<currentFrame.length;j++){currentNal=currentFrame[j];view.setUint32(dataOffset,currentNal.data.byteLength);dataOffset+=4;data.set(currentNal.data,dataOffset);dataOffset+=currentNal.data.byteLength;}}}return data};var generateSampleTableForFrame=function generateSampleTableForFrame(frame,baseDataOffset){var sample,dataOffset=baseDataOffset||0,samples=[];sample=sampleForFrame(frame,dataOffset);samples.push(sample);return samples};var concatenateNalDataForFrame=function concatenateNalDataForFrame(frame){var i,currentNal,dataOffset=0,nalsByteLength=frame.byteLength,numberOfNals=frame.length,totalByteLength=nalsByteLength+4*numberOfNals,data=new Uint8Array(totalByteLength),view=new DataView(data.buffer);for(i=0;i<frame.length;i++){currentNal=frame[i];view.setUint32(dataOffset,currentNal.data.byteLength);dataOffset+=4;data.set(currentNal.data,dataOffset);dataOffset+=currentNal.data.byteLength;}return data};var frameUtils={groupNalsIntoFrames:groupNalsIntoFrames,groupFramesIntoGops:groupFramesIntoGops,extendFirstKeyFrame:extendFirstKeyFrame,generateSampleTable:generateSampleTable$1,concatenateNalData:concatenateNalData,generateSampleTableForFrame:generateSampleTableForFrame,concatenateNalDataForFrame:concatenateNalDataForFrame};var highPrefix=[33,16,5,32,164,27];var lowPrefix=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252];var zeroFill=function zeroFill(count){var a=[];while(count--){a.push(0);}return a};var makeTable=function makeTable(metaTable){return Object.keys(metaTable).reduce(function(obj,key){obj[key]=new Uint8Array(metaTable[key].reduce(function(arr,part){return arr.concat(part)},[]));return obj},{})};var silence;var silence_1=function silence_1(){if(!silence){var coneOfSilence={96e3:[highPrefix,[227,64],zeroFill(154),[56]],88200:[highPrefix,[231],zeroFill(170),[56]],64e3:[highPrefix,[248,192],zeroFill(240),[56]],48e3:[highPrefix,[255,192],zeroFill(268),[55,148,128],zeroFill(54),[112]],44100:[highPrefix,[255,192],zeroFill(268),[55,163,128],zeroFill(84),[112]],32e3:[highPrefix,[255,192],zeroFill(268),[55,234],zeroFill(226),[112]],24e3:[highPrefix,[255,192],zeroFill(268),[55,255,128],zeroFill(268),[111,112],zeroFill(126),[224]],16e3:[highPrefix,[255,192],zeroFill(268),[55,255,128],zeroFill(268),[111,255],zeroFill(269),[223,108],zeroFill(195),[1,192]],12e3:[lowPrefix,zeroFill(268),[3,127,248],zeroFill(268),[6,255,240],zeroFill(268),[13,255,224],zeroFill(268),[27,253,128],zeroFill(259),[56]],11025:[lowPrefix,zeroFill(268),[3,127,248],zeroFill(268),[6,255,240],zeroFill(268),[13,255,224],zeroFill(268),[27,255,192],zeroFill(268),[55,175,128],zeroFill(108),[112]],8e3:[lowPrefix,zeroFill(268),[3,121,16],zeroFill(47),[7]]};silence=makeTable(coneOfSilence);}return silence};var ONE_SECOND_IN_TS$4=9e4,secondsToVideoTs,secondsToAudioTs,videoTsToSeconds,audioTsToSeconds,audioTsToVideoTs,videoTsToAudioTs,metadataTsToSeconds;secondsToVideoTs=function secondsToVideoTs(seconds){return seconds*ONE_SECOND_IN_TS$4};secondsToAudioTs=function secondsToAudioTs(seconds,sampleRate){return seconds*sampleRate};videoTsToSeconds=function videoTsToSeconds(timestamp){return timestamp/ONE_SECOND_IN_TS$4};audioTsToSeconds=function audioTsToSeconds(timestamp,sampleRate){return timestamp/sampleRate};audioTsToVideoTs=function audioTsToVideoTs(timestamp,sampleRate){return secondsToVideoTs(audioTsToSeconds(timestamp,sampleRate))};videoTsToAudioTs=function videoTsToAudioTs(timestamp,sampleRate){return secondsToAudioTs(videoTsToSeconds(timestamp),sampleRate)};metadataTsToSeconds=function metadataTsToSeconds(timestamp,timelineStartPts,keepOriginalTimestamps){return videoTsToSeconds(keepOriginalTimestamps?timestamp:timestamp-timelineStartPts)};var clock={ONE_SECOND_IN_TS:ONE_SECOND_IN_TS$4,secondsToVideoTs:secondsToVideoTs,secondsToAudioTs:secondsToAudioTs,videoTsToSeconds:videoTsToSeconds,audioTsToSeconds:audioTsToSeconds,audioTsToVideoTs:audioTsToVideoTs,videoTsToAudioTs:videoTsToAudioTs,metadataTsToSeconds:metadataTsToSeconds};var sumFrameByteLengths=function sumFrameByteLengths(array){var i,currentObj,sum=0;for(i=0;i<array.length;i++){currentObj=array[i];sum+=currentObj.data.byteLength;}return sum};var prefixWithSilence=function prefixWithSilence(track,frames,audioAppendStartTs,videoBaseMediaDecodeTime){var baseMediaDecodeTimeTs,frameDuration=0,audioGapDuration=0,audioFillFrameCount=0,audioFillDuration=0,silentFrame,i,firstFrame;if(!frames.length){return}baseMediaDecodeTimeTs=clock.audioTsToVideoTs(track.baseMediaDecodeTime,track.samplerate);frameDuration=Math.ceil(clock.ONE_SECOND_IN_TS/(track.samplerate/1024));if(audioAppendStartTs&&videoBaseMediaDecodeTime){audioGapDuration=baseMediaDecodeTimeTs-Math.max(audioAppendStartTs,videoBaseMediaDecodeTime);audioFillFrameCount=Math.floor(audioGapDuration/frameDuration);audioFillDuration=audioFillFrameCount*frameDuration;}if(audioFillFrameCount<1||audioFillDuration>clock.ONE_SECOND_IN_TS/2){return}silentFrame=silence_1()[track.samplerate];if(!silentFrame){silentFrame=frames[0].data;}for(i=0;i<audioFillFrameCount;i++){firstFrame=frames[0];frames.splice(0,0,{data:silentFrame,dts:firstFrame.dts-frameDuration,pts:firstFrame.pts-frameDuration});}track.baseMediaDecodeTime-=Math.floor(clock.videoTsToAudioTs(audioFillDuration,track.samplerate));return audioFillDuration};var trimAdtsFramesByEarliestDts=function trimAdtsFramesByEarliestDts(adtsFrames,track,earliestAllowedDts){if(track.minSegmentDts>=earliestAllowedDts){return adtsFrames}track.minSegmentDts=Infinity;return adtsFrames.filter(function(currentFrame){if(currentFrame.dts>=earliestAllowedDts){track.minSegmentDts=Math.min(track.minSegmentDts,currentFrame.dts);track.minSegmentPts=track.minSegmentDts;return true}return false})};var generateSampleTable=function generateSampleTable(frames){var i,currentFrame,samples=[];for(i=0;i<frames.length;i++){currentFrame=frames[i];samples.push({size:currentFrame.data.byteLength,duration:1024});}return samples};var concatenateFrameData=function concatenateFrameData(frames){var i,currentFrame,dataOffset=0,data=new Uint8Array(sumFrameByteLengths(frames));for(i=0;i<frames.length;i++){currentFrame=frames[i];data.set(currentFrame.data,dataOffset);dataOffset+=currentFrame.data.byteLength;}return data};var audioFrameUtils={prefixWithSilence:prefixWithSilence,trimAdtsFramesByEarliestDts:trimAdtsFramesByEarliestDts,generateSampleTable:generateSampleTable,concatenateFrameData:concatenateFrameData};var ONE_SECOND_IN_TS$3=clock.ONE_SECOND_IN_TS;var collectDtsInfo=function collectDtsInfo(track,data){if(typeof data.pts==="number"){if(track.timelineStartInfo.pts===undefined){track.timelineStartInfo.pts=data.pts;}if(track.minSegmentPts===undefined){track.minSegmentPts=data.pts;}else {track.minSegmentPts=Math.min(track.minSegmentPts,data.pts);}if(track.maxSegmentPts===undefined){track.maxSegmentPts=data.pts;}else {track.maxSegmentPts=Math.max(track.maxSegmentPts,data.pts);}}if(typeof data.dts==="number"){if(track.timelineStartInfo.dts===undefined){track.timelineStartInfo.dts=data.dts;}if(track.minSegmentDts===undefined){track.minSegmentDts=data.dts;}else {track.minSegmentDts=Math.min(track.minSegmentDts,data.dts);}if(track.maxSegmentDts===undefined){track.maxSegmentDts=data.dts;}else {track.maxSegmentDts=Math.max(track.maxSegmentDts,data.dts);}}};var clearDtsInfo=function clearDtsInfo(track){delete track.minSegmentDts;delete track.maxSegmentDts;delete track.minSegmentPts;delete track.maxSegmentPts;};var calculateTrackBaseMediaDecodeTime=function calculateTrackBaseMediaDecodeTime(track,keepOriginalTimestamps){var baseMediaDecodeTime,scale,minSegmentDts=track.minSegmentDts;if(!keepOriginalTimestamps){minSegmentDts-=track.timelineStartInfo.dts;}baseMediaDecodeTime=track.timelineStartInfo.baseMediaDecodeTime;baseMediaDecodeTime+=minSegmentDts;baseMediaDecodeTime=Math.max(0,baseMediaDecodeTime);if(track.type==="audio"){scale=track.samplerate/ONE_SECOND_IN_TS$3;baseMediaDecodeTime*=scale;baseMediaDecodeTime=Math.floor(baseMediaDecodeTime);}return baseMediaDecodeTime};var trackDecodeInfo={clearDtsInfo:clearDtsInfo,calculateTrackBaseMediaDecodeTime:calculateTrackBaseMediaDecodeTime,collectDtsInfo:collectDtsInfo};var USER_DATA_REGISTERED_ITU_T_T35=4,RBSP_TRAILING_BITS=128;var parseSei=function parseSei(bytes){var i=0,result={payloadType:-1,payloadSize:0},payloadType=0,payloadSize=0;while(i<bytes.byteLength){if(bytes[i]===RBSP_TRAILING_BITS){break}while(bytes[i]===255){payloadType+=255;i++;}payloadType+=bytes[i++];while(bytes[i]===255){payloadSize+=255;i++;}payloadSize+=bytes[i++];if(!result.payload&&payloadType===USER_DATA_REGISTERED_ITU_T_T35){var userIdentifier=String.fromCharCode(bytes[i+3],bytes[i+4],bytes[i+5],bytes[i+6]);if(userIdentifier==="GA94"){result.payloadType=payloadType;result.payloadSize=payloadSize;result.payload=bytes.subarray(i,i+payloadSize);break}else {result.payload=void 0;}}i+=payloadSize;payloadType=0;payloadSize=0;}return result};var parseUserData=function parseUserData(sei){if(sei.payload[0]!==181){return null}if((sei.payload[1]<<8|sei.payload[2])!==49){return null}if(String.fromCharCode(sei.payload[3],sei.payload[4],sei.payload[5],sei.payload[6])!=="GA94"){return null}if(sei.payload[7]!==3){return null}return sei.payload.subarray(8,sei.payload.length-1)};var parseCaptionPackets=function parseCaptionPackets(pts,userData){var results=[],i,count,offset,data;if(!(userData[0]&64)){return results}count=userData[0]&31;for(i=0;i<count;i++){offset=i*3;data={type:userData[offset+2]&3,pts:pts};if(userData[offset+2]&4){data.ccData=userData[offset+3]<<8|userData[offset+4];results.push(data);}}return results};var discardEmulationPreventionBytes$1=function discardEmulationPreventionBytes(data){var length=data.byteLength,emulationPreventionBytesPositions=[],i=1,newLength,newData;while(i<length-2){if(data[i]===0&&data[i+1]===0&&data[i+2]===3){emulationPreventionBytesPositions.push(i+2);i+=2;}else {i++;}}if(emulationPreventionBytesPositions.length===0){return data}newLength=length-emulationPreventionBytesPositions.length;newData=new Uint8Array(newLength);var sourceIndex=0;for(i=0;i<newLength;sourceIndex++,i++){if(sourceIndex===emulationPreventionBytesPositions[0]){sourceIndex++;emulationPreventionBytesPositions.shift();}newData[i]=data[sourceIndex];}return newData};var captionPacketParser={parseSei:parseSei,parseUserData:parseUserData,parseCaptionPackets:parseCaptionPackets,discardEmulationPreventionBytes:discardEmulationPreventionBytes$1,USER_DATA_REGISTERED_ITU_T_T35:USER_DATA_REGISTERED_ITU_T_T35};var CaptionStream$1=function CaptionStream(options){options=options||{};CaptionStream.prototype.init.call(this);this.parse708captions_=typeof options.parse708captions==="boolean"?options.parse708captions:true;this.captionPackets_=[];this.ccStreams_=[new Cea608Stream(0,0),new Cea608Stream(0,1),new Cea608Stream(1,0),new Cea608Stream(1,1)];if(this.parse708captions_){this.cc708Stream_=new Cea708Stream({captionServices:options.captionServices});}this.reset();this.ccStreams_.forEach(function(cc){cc.on("data",this.trigger.bind(this,"data"));cc.on("partialdone",this.trigger.bind(this,"partialdone"));cc.on("done",this.trigger.bind(this,"done"));},this);if(this.parse708captions_){this.cc708Stream_.on("data",this.trigger.bind(this,"data"));this.cc708Stream_.on("partialdone",this.trigger.bind(this,"partialdone"));this.cc708Stream_.on("done",this.trigger.bind(this,"done"));}};CaptionStream$1.prototype=new stream;CaptionStream$1.prototype.push=function(event){var sei,userData,newCaptionPackets;if(event.nalUnitType!=="sei_rbsp"){return}sei=captionPacketParser.parseSei(event.escapedRBSP);if(!sei.payload){return}if(sei.payloadType!==captionPacketParser.USER_DATA_REGISTERED_ITU_T_T35){return}userData=captionPacketParser.parseUserData(sei);if(!userData){return}if(event.dts<this.latestDts_){this.ignoreNextEqualDts_=true;return}else if(event.dts===this.latestDts_&&this.ignoreNextEqualDts_){this.numSameDts_--;if(!this.numSameDts_){this.ignoreNextEqualDts_=false;}return}newCaptionPackets=captionPacketParser.parseCaptionPackets(event.pts,userData);this.captionPackets_=this.captionPackets_.concat(newCaptionPackets);if(this.latestDts_!==event.dts){this.numSameDts_=0;}this.numSameDts_++;this.latestDts_=event.dts;};CaptionStream$1.prototype.flushCCStreams=function(flushType){this.ccStreams_.forEach(function(cc){return flushType==="flush"?cc.flush():cc.partialFlush()},this);};CaptionStream$1.prototype.flushStream=function(flushType){if(!this.captionPackets_.length){this.flushCCStreams(flushType);return}this.captionPackets_.forEach(function(elem,idx){elem.presortIndex=idx;});this.captionPackets_.sort(function(a,b){if(a.pts===b.pts){return a.presortIndex-b.presortIndex}return a.pts-b.pts});this.captionPackets_.forEach(function(packet){if(packet.type<2){this.dispatchCea608Packet(packet);}else {this.dispatchCea708Packet(packet);}},this);this.captionPackets_.length=0;this.flushCCStreams(flushType);};CaptionStream$1.prototype.flush=function(){return this.flushStream("flush")};CaptionStream$1.prototype.partialFlush=function(){return this.flushStream("partialFlush")};CaptionStream$1.prototype.reset=function(){this.latestDts_=null;this.ignoreNextEqualDts_=false;this.numSameDts_=0;this.activeCea608Channel_=[null,null];this.ccStreams_.forEach(function(ccStream){ccStream.reset();});};CaptionStream$1.prototype.dispatchCea608Packet=function(packet){if(this.setsTextOrXDSActive(packet)){this.activeCea608Channel_[packet.type]=null;}else if(this.setsChannel1Active(packet)){this.activeCea608Channel_[packet.type]=0;}else if(this.setsChannel2Active(packet)){this.activeCea608Channel_[packet.type]=1;}if(this.activeCea608Channel_[packet.type]===null){return}this.ccStreams_[(packet.type<<1)+this.activeCea608Channel_[packet.type]].push(packet);};CaptionStream$1.prototype.setsChannel1Active=function(packet){return (packet.ccData&30720)===4096};CaptionStream$1.prototype.setsChannel2Active=function(packet){return (packet.ccData&30720)===6144};CaptionStream$1.prototype.setsTextOrXDSActive=function(packet){return (packet.ccData&28928)===256||(packet.ccData&30974)===4138||(packet.ccData&30974)===6186};CaptionStream$1.prototype.dispatchCea708Packet=function(packet){if(this.parse708captions_){this.cc708Stream_.push(packet);}};var CHARACTER_TRANSLATION_708={127:9834,4128:32,4129:160,4133:8230,4138:352,4140:338,4144:9608,4145:8216,4146:8217,4147:8220,4148:8221,4149:8226,4153:8482,4154:353,4156:339,4157:8480,4159:376,4214:8539,4215:8540,4216:8541,4217:8542,4218:9168,4219:9124,4220:9123,4221:9135,4222:9126,4223:9121,4256:12600};var get708CharFromCode=function get708CharFromCode(code){var newCode=CHARACTER_TRANSLATION_708[code]||code;if(code&4096&&code===newCode){return ""}return String.fromCharCode(newCode)};var within708TextBlock=function within708TextBlock(b){return 32<=b&&b<=127||160<=b&&b<=255};var Cea708Window=function Cea708Window(windowNum){this.windowNum=windowNum;this.reset();};Cea708Window.prototype.reset=function(){this.clearText();this.pendingNewLine=false;this.winAttr={};this.penAttr={};this.penLoc={};this.penColor={};this.visible=0;this.rowLock=0;this.columnLock=0;this.priority=0;this.relativePositioning=0;this.anchorVertical=0;this.anchorHorizontal=0;this.anchorPoint=0;this.rowCount=1;this.virtualRowCount=this.rowCount+1;this.columnCount=41;this.windowStyle=0;this.penStyle=0;};Cea708Window.prototype.getText=function(){return this.rows.join("\n")};Cea708Window.prototype.clearText=function(){this.rows=[""];this.rowIdx=0;};Cea708Window.prototype.newLine=function(pts){if(this.rows.length>=this.virtualRowCount&&typeof this.beforeRowOverflow==="function"){this.beforeRowOverflow(pts);}if(this.rows.length>0){this.rows.push("");this.rowIdx++;}while(this.rows.length>this.virtualRowCount){this.rows.shift();this.rowIdx--;}};Cea708Window.prototype.isEmpty=function(){if(this.rows.length===0){return true}else if(this.rows.length===1){return this.rows[0]===""}return false};Cea708Window.prototype.addText=function(text){this.rows[this.rowIdx]+=text;};Cea708Window.prototype.backspace=function(){if(!this.isEmpty()){var row=this.rows[this.rowIdx];this.rows[this.rowIdx]=row.substr(0,row.length-1);}};var Cea708Service=function Cea708Service(serviceNum,encoding,stream){this.serviceNum=serviceNum;this.text="";this.currentWindow=new Cea708Window(-1);this.windows=[];this.stream=stream;if(typeof encoding==="string"){this.createTextDecoder(encoding);}};Cea708Service.prototype.init=function(pts,beforeRowOverflow){this.startPts=pts;for(var win=0;win<8;win++){this.windows[win]=new Cea708Window(win);if(typeof beforeRowOverflow==="function"){this.windows[win].beforeRowOverflow=beforeRowOverflow;}}};Cea708Service.prototype.setCurrentWindow=function(windowNum){this.currentWindow=this.windows[windowNum];};Cea708Service.prototype.createTextDecoder=function(encoding){if(typeof TextDecoder==="undefined"){this.stream.trigger("log",{level:"warn",message:"The `encoding` option is unsupported without TextDecoder support"});}else {try{this.textDecoder_=new TextDecoder(encoding);}catch(error){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+encoding+" encoding. "+error});}}};var Cea708Stream=function Cea708Stream(options){options=options||{};Cea708Stream.prototype.init.call(this);var self1=this;var captionServices=options.captionServices||{};var captionServiceEncodings={};var serviceProps;Object.keys(captionServices).forEach(function(serviceName){serviceProps=captionServices[serviceName];if(/^SERVICE/.test(serviceName)){captionServiceEncodings[serviceName]=serviceProps.encoding;}});this.serviceEncodings=captionServiceEncodings;this.current708Packet=null;this.services={};this.push=function(packet){if(packet.type===3){self1.new708Packet();self1.add708Bytes(packet);}else {if(self1.current708Packet===null){self1.new708Packet();}self1.add708Bytes(packet);}};};Cea708Stream.prototype=new stream;Cea708Stream.prototype.new708Packet=function(){if(this.current708Packet!==null){this.push708Packet();}this.current708Packet={data:[],ptsVals:[]};};Cea708Stream.prototype.add708Bytes=function(packet){var data=packet.ccData;var byte0=data>>>8;var byte1=data&255;this.current708Packet.ptsVals.push(packet.pts);this.current708Packet.data.push(byte0);this.current708Packet.data.push(byte1);};Cea708Stream.prototype.push708Packet=function(){var packet708=this.current708Packet;var packetData=packet708.data;var serviceNum=null;var blockSize=null;var i=0;var b=packetData[i++];packet708.seq=b>>6;packet708.sizeCode=b&63;for(;i<packetData.length;i++){b=packetData[i++];serviceNum=b>>5;blockSize=b&31;if(serviceNum===7&&blockSize>0){b=packetData[i++];serviceNum=b;}this.pushServiceBlock(serviceNum,i,blockSize);if(blockSize>0){i+=blockSize-1;}}};Cea708Stream.prototype.pushServiceBlock=function(serviceNum,start,size){var b;var i=start;var packetData=this.current708Packet.data;var service=this.services[serviceNum];if(!service){service=this.initService(serviceNum,i);}for(;i<start+size&&i<packetData.length;i++){b=packetData[i];if(within708TextBlock(b)){i=this.handleText(i,service);}else if(b===24){i=this.multiByteCharacter(i,service);}else if(b===16){i=this.extendedCommands(i,service);}else if(128<=b&&b<=135){i=this.setCurrentWindow(i,service);}else if(152<=b&&b<=159){i=this.defineWindow(i,service);}else if(b===136){i=this.clearWindows(i,service);}else if(b===140){i=this.deleteWindows(i,service);}else if(b===137){i=this.displayWindows(i,service);}else if(b===138){i=this.hideWindows(i,service);}else if(b===139){i=this.toggleWindows(i,service);}else if(b===151){i=this.setWindowAttributes(i,service);}else if(b===144){i=this.setPenAttributes(i,service);}else if(b===145){i=this.setPenColor(i,service);}else if(b===146){i=this.setPenLocation(i,service);}else if(b===143){service=this.reset(i,service);}else if(b===8){service.currentWindow.backspace();}else if(b===12){service.currentWindow.clearText();}else if(b===13){service.currentWindow.pendingNewLine=true;}else if(b===14){service.currentWindow.clearText();}else if(b===141){i++;}else;}};Cea708Stream.prototype.extendedCommands=function(i,service){var packetData=this.current708Packet.data;var b=packetData[++i];if(within708TextBlock(b)){i=this.handleText(i,service,{isExtended:true});}return i};Cea708Stream.prototype.getPts=function(byteIndex){return this.current708Packet.ptsVals[Math.floor(byteIndex/2)]};Cea708Stream.prototype.initService=function(serviceNum,i){var serviceName="SERVICE"+serviceNum;var self1=this;var serviceName;var encoding;if(serviceName in this.serviceEncodings){encoding=this.serviceEncodings[serviceName];}this.services[serviceNum]=new Cea708Service(serviceNum,encoding,self1);this.services[serviceNum].init(this.getPts(i),function(pts){self1.flushDisplayed(pts,self1.services[serviceNum]);});return this.services[serviceNum]};Cea708Stream.prototype.handleText=function(i,service,options){var isExtended=options&&options.isExtended;var isMultiByte=options&&options.isMultiByte;var packetData=this.current708Packet.data;var extended=isExtended?4096:0;var currentByte=packetData[i];var nextByte=packetData[i+1];var win=service.currentWindow;var _char;var charCodeArray;if(service.textDecoder_&&!isExtended){if(isMultiByte){charCodeArray=[currentByte,nextByte];i++;}else {charCodeArray=[currentByte];}_char=service.textDecoder_.decode(new Uint8Array(charCodeArray));}else {_char=get708CharFromCode(extended|currentByte);}if(win.pendingNewLine&&!win.isEmpty()){win.newLine(this.getPts(i));}win.pendingNewLine=false;win.addText(_char);return i};Cea708Stream.prototype.multiByteCharacter=function(i,service){var packetData=this.current708Packet.data;var firstByte=packetData[i+1];var secondByte=packetData[i+2];if(within708TextBlock(firstByte)&&within708TextBlock(secondByte)){i=this.handleText(++i,service,{isMultiByte:true});}return i};Cea708Stream.prototype.setCurrentWindow=function(i,service){var packetData=this.current708Packet.data;var b=packetData[i];var windowNum=b&7;service.setCurrentWindow(windowNum);return i};Cea708Stream.prototype.defineWindow=function(i,service){var packetData=this.current708Packet.data;var b=packetData[i];var windowNum=b&7;service.setCurrentWindow(windowNum);var win=service.currentWindow;b=packetData[++i];win.visible=(b&32)>>5;win.rowLock=(b&16)>>4;win.columnLock=(b&8)>>3;win.priority=b&7;b=packetData[++i];win.relativePositioning=(b&128)>>7;win.anchorVertical=b&127;b=packetData[++i];win.anchorHorizontal=b;b=packetData[++i];win.anchorPoint=(b&240)>>4;win.rowCount=b&15;b=packetData[++i];win.columnCount=b&63;b=packetData[++i];win.windowStyle=(b&56)>>3;win.penStyle=b&7;win.virtualRowCount=win.rowCount+1;return i};Cea708Stream.prototype.setWindowAttributes=function(i,service){var packetData=this.current708Packet.data;var b=packetData[i];var winAttr=service.currentWindow.winAttr;b=packetData[++i];winAttr.fillOpacity=(b&192)>>6;winAttr.fillRed=(b&48)>>4;winAttr.fillGreen=(b&12)>>2;winAttr.fillBlue=b&3;b=packetData[++i];winAttr.borderType=(b&192)>>6;winAttr.borderRed=(b&48)>>4;winAttr.borderGreen=(b&12)>>2;winAttr.borderBlue=b&3;b=packetData[++i];winAttr.borderType+=(b&128)>>5;winAttr.wordWrap=(b&64)>>6;winAttr.printDirection=(b&48)>>4;winAttr.scrollDirection=(b&12)>>2;winAttr.justify=b&3;b=packetData[++i];winAttr.effectSpeed=(b&240)>>4;winAttr.effectDirection=(b&12)>>2;winAttr.displayEffect=b&3;return i};Cea708Stream.prototype.flushDisplayed=function(pts,service){var displayedText=[];for(var winId=0;winId<8;winId++){if(service.windows[winId].visible&&!service.windows[winId].isEmpty()){displayedText.push(service.windows[winId].getText());}}service.endPts=pts;service.text=displayedText.join("\n\n");this.pushCaption(service);service.startPts=pts;};Cea708Stream.prototype.pushCaption=function(service){if(service.text!==""){this.trigger("data",{startPts:service.startPts,endPts:service.endPts,text:service.text,stream:"cc708_"+service.serviceNum});service.text="";service.startPts=service.endPts;}};Cea708Stream.prototype.displayWindows=function(i,service){var packetData=this.current708Packet.data;var b=packetData[++i];var pts=this.getPts(i);this.flushDisplayed(pts,service);for(var winId=0;winId<8;winId++){if(b&1<<winId){service.windows[winId].visible=1;}}return i};Cea708Stream.prototype.hideWindows=function(i,service){var packetData=this.current708Packet.data;var b=packetData[++i];var pts=this.getPts(i);this.flushDisplayed(pts,service);for(var winId=0;winId<8;winId++){if(b&1<<winId){service.windows[winId].visible=0;}}return i};Cea708Stream.prototype.toggleWindows=function(i,service){var packetData=this.current708Packet.data;var b=packetData[++i];var pts=this.getPts(i);this.flushDisplayed(pts,service);for(var winId=0;winId<8;winId++){if(b&1<<winId){service.windows[winId].visible^=1;}}return i};Cea708Stream.prototype.clearWindows=function(i,service){var packetData=this.current708Packet.data;var b=packetData[++i];var pts=this.getPts(i);this.flushDisplayed(pts,service);for(var winId=0;winId<8;winId++){if(b&1<<winId){service.windows[winId].clearText();}}return i};Cea708Stream.prototype.deleteWindows=function(i,service){var packetData=this.current708Packet.data;var b=packetData[++i];var pts=this.getPts(i);this.flushDisplayed(pts,service);for(var winId=0;winId<8;winId++){if(b&1<<winId){service.windows[winId].reset();}}return i};Cea708Stream.prototype.setPenAttributes=function(i,service){var packetData=this.current708Packet.data;var b=packetData[i];var penAttr=service.currentWindow.penAttr;b=packetData[++i];penAttr.textTag=(b&240)>>4;penAttr.offset=(b&12)>>2;penAttr.penSize=b&3;b=packetData[++i];penAttr.italics=(b&128)>>7;penAttr.underline=(b&64)>>6;penAttr.edgeType=(b&56)>>3;penAttr.fontStyle=b&7;return i};Cea708Stream.prototype.setPenColor=function(i,service){var packetData=this.current708Packet.data;var b=packetData[i];var penColor=service.currentWindow.penColor;b=packetData[++i];penColor.fgOpacity=(b&192)>>6;penColor.fgRed=(b&48)>>4;penColor.fgGreen=(b&12)>>2;penColor.fgBlue=b&3;b=packetData[++i];penColor.bgOpacity=(b&192)>>6;penColor.bgRed=(b&48)>>4;penColor.bgGreen=(b&12)>>2;penColor.bgBlue=b&3;b=packetData[++i];penColor.edgeRed=(b&48)>>4;penColor.edgeGreen=(b&12)>>2;penColor.edgeBlue=b&3;return i};Cea708Stream.prototype.setPenLocation=function(i,service){var packetData=this.current708Packet.data;var b=packetData[i];var penLoc=service.currentWindow.penLoc;service.currentWindow.pendingNewLine=true;b=packetData[++i];penLoc.row=b&15;b=packetData[++i];penLoc.column=b&63;return i};Cea708Stream.prototype.reset=function(i,service){var pts=this.getPts(i);this.flushDisplayed(pts,service);return this.initService(service.serviceNum,i)};var CHARACTER_TRANSLATION={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,304:174,305:176,306:189,307:191,308:8482,309:162,310:163,311:9834,312:224,313:160,314:232,315:226,316:234,317:238,318:244,319:251,544:193,545:201,546:211,547:218,548:220,549:252,550:8216,551:161,552:42,553:39,554:8212,555:169,556:8480,557:8226,558:8220,559:8221,560:192,561:194,562:199,563:200,564:202,565:203,566:235,567:206,568:207,569:239,570:212,571:217,572:249,573:219,574:171,575:187,800:195,801:227,802:205,803:204,804:236,805:210,806:242,807:213,808:245,809:123,810:125,811:92,812:94,813:95,814:124,815:126,816:196,817:228,818:214,819:246,820:223,821:165,822:164,823:9474,824:197,825:229,826:216,827:248,828:9484,829:9488,830:9492,831:9496};var getCharFromCode=function getCharFromCode(code){if(code===null){return ""}code=CHARACTER_TRANSLATION[code]||code;return String.fromCharCode(code)};var BOTTOM_ROW=14;var ROWS=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152];var createDisplayBuffer=function createDisplayBuffer(){var result=[],i=BOTTOM_ROW+1;while(i--){result.push("");}return result};var Cea608Stream=function Cea608Stream(field,dataChannel){Cea608Stream.prototype.init.call(this);this.field_=field||0;this.dataChannel_=dataChannel||0;this.name_="CC"+((this.field_<<1|this.dataChannel_)+1);this.setConstants();this.reset();this.push=function(packet){var data,swap,char0,char1,text;data=packet.ccData&32639;if(data===this.lastControlCode_){this.lastControlCode_=null;return}if((data&61440)===4096){this.lastControlCode_=data;}else if(data!==this.PADDING_){this.lastControlCode_=null;}char0=data>>>8;char1=data&255;if(data===this.PADDING_){return}else if(data===this.RESUME_CAPTION_LOADING_){this.mode_="popOn";}else if(data===this.END_OF_CAPTION_){this.mode_="popOn";this.clearFormatting(packet.pts);this.flushDisplayed(packet.pts);swap=this.displayed_;this.displayed_=this.nonDisplayed_;this.nonDisplayed_=swap;this.startPts_=packet.pts;}else if(data===this.ROLL_UP_2_ROWS_){this.rollUpRows_=2;this.setRollUp(packet.pts);}else if(data===this.ROLL_UP_3_ROWS_){this.rollUpRows_=3;this.setRollUp(packet.pts);}else if(data===this.ROLL_UP_4_ROWS_){this.rollUpRows_=4;this.setRollUp(packet.pts);}else if(data===this.CARRIAGE_RETURN_){this.clearFormatting(packet.pts);this.flushDisplayed(packet.pts);this.shiftRowsUp_();this.startPts_=packet.pts;}else if(data===this.BACKSPACE_){if(this.mode_==="popOn"){this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1);}else {this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1);}}else if(data===this.ERASE_DISPLAYED_MEMORY_){this.flushDisplayed(packet.pts);this.displayed_=createDisplayBuffer();}else if(data===this.ERASE_NON_DISPLAYED_MEMORY_){this.nonDisplayed_=createDisplayBuffer();}else if(data===this.RESUME_DIRECT_CAPTIONING_){if(this.mode_!=="paintOn"){this.flushDisplayed(packet.pts);this.displayed_=createDisplayBuffer();}this.mode_="paintOn";this.startPts_=packet.pts;}else if(this.isSpecialCharacter(char0,char1)){char0=(char0&3)<<8;text=getCharFromCode(char0|char1);this[this.mode_](packet.pts,text);this.column_++;}else if(this.isExtCharacter(char0,char1)){if(this.mode_==="popOn"){this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1);}else {this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1);}char0=(char0&3)<<8;text=getCharFromCode(char0|char1);this[this.mode_](packet.pts,text);this.column_++;}else if(this.isMidRowCode(char0,char1)){this.clearFormatting(packet.pts);this[this.mode_](packet.pts," ");this.column_++;if((char1&14)===14){this.addFormatting(packet.pts,["i"]);}if((char1&1)===1){this.addFormatting(packet.pts,["u"]);}}else if(this.isOffsetControlCode(char0,char1)){this.column_+=char1&3;}else if(this.isPAC(char0,char1)){var row=ROWS.indexOf(data&7968);if(this.mode_==="rollUp"){if(row-this.rollUpRows_+1<0){row=this.rollUpRows_-1;}this.setRollUp(packet.pts,row);}if(row!==this.row_){this.clearFormatting(packet.pts);this.row_=row;}if(char1&1&&this.formatting_.indexOf("u")===-1){this.addFormatting(packet.pts,["u"]);}if((data&16)===16){this.column_=((data&14)>>1)*4;}if(this.isColorPAC(char1)){if((char1&14)===14){this.addFormatting(packet.pts,["i"]);}}}else if(this.isNormalChar(char0)){if(char1===0){char1=null;}text=getCharFromCode(char0);text+=getCharFromCode(char1);this[this.mode_](packet.pts,text);this.column_+=text.length;}};};Cea608Stream.prototype=new stream;Cea608Stream.prototype.flushDisplayed=function(pts){var content=this.displayed_.map(function(row,index){try{return row.trim()}catch(e){this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+index+"."});return ""}},this).join("\n").replace(/^\n+|\n+$/g,"");if(content.length){this.trigger("data",{startPts:this.startPts_,endPts:pts,text:content,stream:this.name_});}};Cea608Stream.prototype.reset=function(){this.mode_="popOn";this.topRow_=0;this.startPts_=0;this.displayed_=createDisplayBuffer();this.nonDisplayed_=createDisplayBuffer();this.lastControlCode_=null;this.column_=0;this.row_=BOTTOM_ROW;this.rollUpRows_=2;this.formatting_=[];};Cea608Stream.prototype.setConstants=function(){if(this.dataChannel_===0){this.BASE_=16;this.EXT_=17;this.CONTROL_=(20|this.field_)<<8;this.OFFSET_=23;}else if(this.dataChannel_===1){this.BASE_=24;this.EXT_=25;this.CONTROL_=(28|this.field_)<<8;this.OFFSET_=31;}this.PADDING_=0;this.RESUME_CAPTION_LOADING_=this.CONTROL_|32;this.END_OF_CAPTION_=this.CONTROL_|47;this.ROLL_UP_2_ROWS_=this.CONTROL_|37;this.ROLL_UP_3_ROWS_=this.CONTROL_|38;this.ROLL_UP_4_ROWS_=this.CONTROL_|39;this.CARRIAGE_RETURN_=this.CONTROL_|45;this.RESUME_DIRECT_CAPTIONING_=this.CONTROL_|41;this.BACKSPACE_=this.CONTROL_|33;this.ERASE_DISPLAYED_MEMORY_=this.CONTROL_|44;this.ERASE_NON_DISPLAYED_MEMORY_=this.CONTROL_|46;};Cea608Stream.prototype.isSpecialCharacter=function(char0,char1){return char0===this.EXT_&&char1>=48&&char1<=63};Cea608Stream.prototype.isExtCharacter=function(char0,char1){return (char0===this.EXT_+1||char0===this.EXT_+2)&&char1>=32&&char1<=63};Cea608Stream.prototype.isMidRowCode=function(char0,char1){return char0===this.EXT_&&char1>=32&&char1<=47};Cea608Stream.prototype.isOffsetControlCode=function(char0,char1){return char0===this.OFFSET_&&char1>=33&&char1<=35};Cea608Stream.prototype.isPAC=function(char0,char1){return char0>=this.BASE_&&char0<this.BASE_+8&&char1>=64&&char1<=127};Cea608Stream.prototype.isColorPAC=function(char1){return char1>=64&&char1<=79||char1>=96&&char1<=127};Cea608Stream.prototype.isNormalChar=function(_char2){return _char2>=32&&_char2<=127};Cea608Stream.prototype.setRollUp=function(pts,newBaseRow){if(this.mode_!=="rollUp"){this.row_=BOTTOM_ROW;this.mode_="rollUp";this.flushDisplayed(pts);this.nonDisplayed_=createDisplayBuffer();this.displayed_=createDisplayBuffer();}if(newBaseRow!==undefined&&newBaseRow!==this.row_){for(var i=0;i<this.rollUpRows_;i++){this.displayed_[newBaseRow-i]=this.displayed_[this.row_-i];this.displayed_[this.row_-i]="";}}if(newBaseRow===undefined){newBaseRow=this.row_;}this.topRow_=newBaseRow-this.rollUpRows_+1;};Cea608Stream.prototype.addFormatting=function(pts,format){this.formatting_=this.formatting_.concat(format);var text=format.reduce(function(text,format){return text+"<"+format+">"},"");this[this.mode_](pts,text);};Cea608Stream.prototype.clearFormatting=function(pts){if(!this.formatting_.length){return}var text=this.formatting_.reverse().reduce(function(text,format){return text+"</"+format+">"},"");this.formatting_=[];this[this.mode_](pts,text);};Cea608Stream.prototype.popOn=function(pts,text){var baseRow=this.nonDisplayed_[this.row_];baseRow+=text;this.nonDisplayed_[this.row_]=baseRow;};Cea608Stream.prototype.rollUp=function(pts,text){var baseRow=this.displayed_[this.row_];baseRow+=text;this.displayed_[this.row_]=baseRow;};Cea608Stream.prototype.shiftRowsUp_=function(){var i;for(i=0;i<this.topRow_;i++){this.displayed_[i]="";}for(i=this.row_+1;i<BOTTOM_ROW+1;i++){this.displayed_[i]="";}for(i=this.topRow_;i<this.row_;i++){this.displayed_[i]=this.displayed_[i+1];}this.displayed_[this.row_]="";};Cea608Stream.prototype.paintOn=function(pts,text){var baseRow=this.displayed_[this.row_];baseRow+=text;this.displayed_[this.row_]=baseRow;};var captionStream={CaptionStream:CaptionStream$1,Cea608Stream:Cea608Stream,Cea708Stream:Cea708Stream};var streamTypes={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21};var MAX_TS=8589934592;var RO_THRESH=4294967296;var TYPE_SHARED="shared";var handleRollover$1=function handleRollover(value,reference){var direction=1;if(value>reference){direction=-1;}while(Math.abs(reference-value)>RO_THRESH){value+=direction*MAX_TS;}return value};var TimestampRolloverStream$1=function TimestampRolloverStream(type){var lastDTS,referenceDTS;TimestampRolloverStream.prototype.init.call(this);this.type_=type||TYPE_SHARED;this.push=function(data){if(this.type_!==TYPE_SHARED&&data.type!==this.type_){return}if(referenceDTS===undefined){referenceDTS=data.dts;}data.dts=handleRollover$1(data.dts,referenceDTS);data.pts=handleRollover$1(data.pts,referenceDTS);lastDTS=data.dts;this.trigger("data",data);};this.flush=function(){referenceDTS=lastDTS;this.trigger("done");};this.endTimeline=function(){this.flush();this.trigger("endedtimeline");};this.discontinuity=function(){referenceDTS=void 0;lastDTS=void 0;};this.reset=function(){this.discontinuity();this.trigger("reset");};};TimestampRolloverStream$1.prototype=new stream;var timestampRolloverStream={TimestampRolloverStream:TimestampRolloverStream$1,handleRollover:handleRollover$1};var percentEncode$1=function percentEncode(bytes,start,end){var i,result="";for(i=start;i<end;i++){result+="%"+("00"+bytes[i].toString(16)).slice(-2);}return result},parseUtf8=function parseUtf8(bytes,start,end){return decodeURIComponent(percentEncode$1(bytes,start,end))},parseIso88591$1=function parseIso88591(bytes,start,end){return unescape(percentEncode$1(bytes,start,end))},parseSyncSafeInteger$1=function parseSyncSafeInteger(data){return data[0]<<21|data[1]<<14|data[2]<<7|data[3]},tagParsers={TXXX:function TXXX(tag){var i;if(tag.data[0]!==3){return}for(i=1;i<tag.data.length;i++){if(tag.data[i]===0){tag.description=parseUtf8(tag.data,1,i);tag.value=parseUtf8(tag.data,i+1,tag.data.length).replace(/\0*$/,"");break}}tag.data=tag.value;},WXXX:function WXXX(tag){var i;if(tag.data[0]!==3){return}for(i=1;i<tag.data.length;i++){if(tag.data[i]===0){tag.description=parseUtf8(tag.data,1,i);tag.url=parseUtf8(tag.data,i+1,tag.data.length);break}}},PRIV:function PRIV(tag){var i;for(i=0;i<tag.data.length;i++){if(tag.data[i]===0){tag.owner=parseIso88591$1(tag.data,0,i);break}}tag.privateData=tag.data.subarray(i+1);tag.data=tag.privateData;}},_MetadataStream;_MetadataStream=function MetadataStream(options){var settings={descriptor:options&&options.descriptor},tagSize=0,buffer=[],bufferSize=0,i;_MetadataStream.prototype.init.call(this);this.dispatchType=streamTypes.METADATA_STREAM_TYPE.toString(16);if(settings.descriptor){for(i=0;i<settings.descriptor.length;i++){this.dispatchType+=("00"+settings.descriptor[i].toString(16)).slice(-2);}}this.push=function(chunk){var tag,frameStart,frameSize,frame,i,frameHeader;if(chunk.type!=="timed-metadata"){return}if(chunk.dataAlignmentIndicator){bufferSize=0;buffer.length=0;}if(buffer.length===0&&(chunk.data.length<10||chunk.data[0]!=="I".charCodeAt(0)||chunk.data[1]!=="D".charCodeAt(0)||chunk.data[2]!=="3".charCodeAt(0))){this.trigger("log",{level:"warn",message:"Skipping unrecognized metadata packet"});return}buffer.push(chunk);bufferSize+=chunk.data.byteLength;if(buffer.length===1){tagSize=parseSyncSafeInteger$1(chunk.data.subarray(6,10));tagSize+=10;}if(bufferSize<tagSize){return}tag={data:new Uint8Array(tagSize),frames:[],pts:buffer[0].pts,dts:buffer[0].dts};for(i=0;i<tagSize;){tag.data.set(buffer[0].data.subarray(0,tagSize-i),i);i+=buffer[0].data.byteLength;bufferSize-=buffer[0].data.byteLength;buffer.shift();}frameStart=10;if(tag.data[5]&64){frameStart+=4;frameStart+=parseSyncSafeInteger$1(tag.data.subarray(10,14));tagSize-=parseSyncSafeInteger$1(tag.data.subarray(16,20));}do{frameSize=parseSyncSafeInteger$1(tag.data.subarray(frameStart+4,frameStart+8));if(frameSize<1){this.trigger("log",{level:"warn",message:"Malformed ID3 frame encountered. Skipping metadata parsing."});return}frameHeader=String.fromCharCode(tag.data[frameStart],tag.data[frameStart+1],tag.data[frameStart+2],tag.data[frameStart+3]);frame={id:frameHeader,data:tag.data.subarray(frameStart+10,frameStart+frameSize+10)};frame.key=frame.id;if(tagParsers[frame.id]){tagParsers[frame.id](frame);if(frame.owner==="com.apple.streaming.transportStreamTimestamp"){var d=frame.data,size=(d[3]&1)<<30|d[4]<<22|d[5]<<14|d[6]<<6|d[7]>>>2;size*=4;size+=d[7]&3;frame.timeStamp=size;if(tag.pts===undefined&&tag.dts===undefined){tag.pts=frame.timeStamp;tag.dts=frame.timeStamp;}this.trigger("timestamp",frame);}}tag.frames.push(frame);frameStart+=10;frameStart+=frameSize;}while(frameStart<tagSize);this.trigger("data",tag);};};_MetadataStream.prototype=new stream;var metadataStream=_MetadataStream;var TimestampRolloverStream=timestampRolloverStream.TimestampRolloverStream;var _TransportPacketStream,_TransportParseStream,_ElementaryStream;var MP2T_PACKET_LENGTH$1=188,SYNC_BYTE$1=71;_TransportPacketStream=function TransportPacketStream(){var buffer=new Uint8Array(MP2T_PACKET_LENGTH$1),bytesInBuffer=0;_TransportPacketStream.prototype.init.call(this);this.push=function(bytes){var startIndex=0,endIndex=MP2T_PACKET_LENGTH$1,everything;if(bytesInBuffer){everything=new Uint8Array(bytes.byteLength+bytesInBuffer);everything.set(buffer.subarray(0,bytesInBuffer));everything.set(bytes,bytesInBuffer);bytesInBuffer=0;}else {everything=bytes;}while(endIndex<everything.byteLength){if(everything[startIndex]===SYNC_BYTE$1&&everything[endIndex]===SYNC_BYTE$1){this.trigger("data",everything.subarray(startIndex,endIndex));startIndex+=MP2T_PACKET_LENGTH$1;endIndex+=MP2T_PACKET_LENGTH$1;continue}startIndex++;endIndex++;}if(startIndex<everything.byteLength){buffer.set(everything.subarray(startIndex),0);bytesInBuffer=everything.byteLength-startIndex;}};this.flush=function(){if(bytesInBuffer===MP2T_PACKET_LENGTH$1&&buffer[0]===SYNC_BYTE$1){this.trigger("data",buffer);bytesInBuffer=0;}this.trigger("done");};this.endTimeline=function(){this.flush();this.trigger("endedtimeline");};this.reset=function(){bytesInBuffer=0;this.trigger("reset");};};_TransportPacketStream.prototype=new stream;_TransportParseStream=function TransportParseStream(){var parsePsi,parsePat,parsePmt,self1;_TransportParseStream.prototype.init.call(this);self1=this;this.packetsWaitingForPmt=[];this.programMapTable=undefined;parsePsi=function parsePsi(payload,psi){var offset=0;if(psi.payloadUnitStartIndicator){offset+=payload[offset]+1;}if(psi.type==="pat"){parsePat(payload.subarray(offset),psi);}else {parsePmt(payload.subarray(offset),psi);}};parsePat=function parsePat(payload,pat){pat.section_number=payload[7];pat.last_section_number=payload[8];self1.pmtPid=(payload[10]&31)<<8|payload[11];pat.pmtPid=self1.pmtPid;};parsePmt=function parsePmt(payload,pmt){var sectionLength,tableEnd,programInfoLength,offset;if(!(payload[5]&1)){return}self1.programMapTable={video:null,audio:null,"timed-metadata":{}};sectionLength=(payload[1]&15)<<8|payload[2];tableEnd=3+sectionLength-4;programInfoLength=(payload[10]&15)<<8|payload[11];offset=12+programInfoLength;while(offset<tableEnd){var streamType=payload[offset];var pid=(payload[offset+1]&31)<<8|payload[offset+2];if(streamType===streamTypes.H264_STREAM_TYPE&&self1.programMapTable.video===null){self1.programMapTable.video=pid;}else if(streamType===streamTypes.ADTS_STREAM_TYPE&&self1.programMapTable.audio===null){self1.programMapTable.audio=pid;}else if(streamType===streamTypes.METADATA_STREAM_TYPE){self1.programMapTable["timed-metadata"][pid]=streamType;}offset+=((payload[offset+3]&15)<<8|payload[offset+4])+5;}pmt.programMapTable=self1.programMapTable;};this.push=function(packet){var result={},offset=4;result.payloadUnitStartIndicator=!!(packet[1]&64);result.pid=packet[1]&31;result.pid<<=8;result.pid|=packet[2];if((packet[3]&48)>>>4>1){offset+=packet[offset]+1;}if(result.pid===0){result.type="pat";parsePsi(packet.subarray(offset),result);this.trigger("data",result);}else if(result.pid===this.pmtPid){result.type="pmt";parsePsi(packet.subarray(offset),result);this.trigger("data",result);while(this.packetsWaitingForPmt.length){this.processPes_.apply(this,this.packetsWaitingForPmt.shift());}}else if(this.programMapTable===undefined){this.packetsWaitingForPmt.push([packet,offset,result]);}else {this.processPes_(packet,offset,result);}};this.processPes_=function(packet,offset,result){if(result.pid===this.programMapTable.video){result.streamType=streamTypes.H264_STREAM_TYPE;}else if(result.pid===this.programMapTable.audio){result.streamType=streamTypes.ADTS_STREAM_TYPE;}else {result.streamType=this.programMapTable["timed-metadata"][result.pid];}result.type="pes";result.data=packet.subarray(offset);this.trigger("data",result);};};_TransportParseStream.prototype=new stream;_TransportParseStream.STREAM_TYPES={h264:27,adts:15};_ElementaryStream=function ElementaryStream(){var self1=this,segmentHadPmt=false,video={data:[],size:0},audio={data:[],size:0},timedMetadata={data:[],size:0},programMapTable,parsePes=function parsePes(payload,pes){var ptsDtsFlags;var startPrefix=payload[0]<<16|payload[1]<<8|payload[2];pes.data=new Uint8Array;if(startPrefix!==1){return}pes.packetLength=6+(payload[4]<<8|payload[5]);pes.dataAlignmentIndicator=(payload[6]&4)!==0;ptsDtsFlags=payload[7];if(ptsDtsFlags&192){pes.pts=(payload[9]&14)<<27|(payload[10]&255)<<20|(payload[11]&254)<<12|(payload[12]&255)<<5|(payload[13]&254)>>>3;pes.pts*=4;pes.pts+=(payload[13]&6)>>>1;pes.dts=pes.pts;if(ptsDtsFlags&64){pes.dts=(payload[14]&14)<<27|(payload[15]&255)<<20|(payload[16]&254)<<12|(payload[17]&255)<<5|(payload[18]&254)>>>3;pes.dts*=4;pes.dts+=(payload[18]&6)>>>1;}}pes.data=payload.subarray(9+payload[8]);},flushStream=function flushStream(stream,type,forceFlush){var packetData=new Uint8Array(stream.size),event={type:type},i=0,offset=0,packetFlushable=false,fragment;if(!stream.data.length||stream.size<9){return}event.trackId=stream.data[0].pid;for(i=0;i<stream.data.length;i++){fragment=stream.data[i];packetData.set(fragment.data,offset);offset+=fragment.data.byteLength;}parsePes(packetData,event);packetFlushable=type==="video"||event.packetLength<=stream.size;if(forceFlush||packetFlushable){stream.size=0;stream.data.length=0;}if(packetFlushable){self1.trigger("data",event);}};_ElementaryStream.prototype.init.call(this);this.push=function(data){({pat:function pat(){},pes:function pes(){var stream,streamType;switch(data.streamType){case streamTypes.H264_STREAM_TYPE:stream=video;streamType="video";break;case streamTypes.ADTS_STREAM_TYPE:stream=audio;streamType="audio";break;case streamTypes.METADATA_STREAM_TYPE:stream=timedMetadata;streamType="timed-metadata";break;default:return}if(data.payloadUnitStartIndicator){flushStream(stream,streamType,true);}stream.data.push(data);stream.size+=data.data.byteLength;},pmt:function pmt(){var event={type:"metadata",tracks:[]};programMapTable=data.programMapTable;if(programMapTable.video!==null){event.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+programMapTable.video,codec:"avc",type:"video"});}if(programMapTable.audio!==null){event.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+programMapTable.audio,codec:"adts",type:"audio"});}segmentHadPmt=true;self1.trigger("data",event);}})[data.type]();};this.reset=function(){video.size=0;video.data.length=0;audio.size=0;audio.data.length=0;this.trigger("reset");};this.flushStreams_=function(){flushStream(video,"video");flushStream(audio,"audio");flushStream(timedMetadata,"timed-metadata");};this.flush=function(){if(!segmentHadPmt&&programMapTable){var pmt={type:"metadata",tracks:[]};if(programMapTable.video!==null){pmt.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+programMapTable.video,codec:"avc",type:"video"});}if(programMapTable.audio!==null){pmt.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+programMapTable.audio,codec:"adts",type:"audio"});}self1.trigger("data",pmt);}segmentHadPmt=false;this.flushStreams_();this.trigger("done");};};_ElementaryStream.prototype=new stream;var m2ts={PAT_PID:0,MP2T_PACKET_LENGTH:MP2T_PACKET_LENGTH$1,TransportPacketStream:_TransportPacketStream,TransportParseStream:_TransportParseStream,ElementaryStream:_ElementaryStream,TimestampRolloverStream:TimestampRolloverStream,CaptionStream:captionStream.CaptionStream,Cea608Stream:captionStream.Cea608Stream,Cea708Stream:captionStream.Cea708Stream,MetadataStream:metadataStream};for(var type in streamTypes){if(streamTypes.hasOwnProperty(type)){m2ts[type]=streamTypes[type];}}var m2ts_1=m2ts;var ONE_SECOND_IN_TS$2=clock.ONE_SECOND_IN_TS;var _AdtsStream;var ADTS_SAMPLING_FREQUENCIES$1=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];_AdtsStream=function AdtsStream(handlePartialSegments){var buffer,frameNum=0;_AdtsStream.prototype.init.call(this);this.skipWarn_=function(start,end){this.trigger("log",{level:"warn",message:"adts skiping bytes "+start+" to "+end+" in frame "+frameNum+" outside syncword"});};this.push=function(packet){var i=0,frameLength,protectionSkipBytes,oldBuffer,sampleCount,adtsFrameDuration;if(!handlePartialSegments){frameNum=0;}if(packet.type!=="audio"){return}if(buffer&&buffer.length){oldBuffer=buffer;buffer=new Uint8Array(oldBuffer.byteLength+packet.data.byteLength);buffer.set(oldBuffer);buffer.set(packet.data,oldBuffer.byteLength);}else {buffer=packet.data;}var skip;while(i+7<buffer.length){if(buffer[i]!==255||(buffer[i+1]&246)!==240){if(typeof skip!=="number"){skip=i;}i++;continue}if(typeof skip==="number"){this.skipWarn_(skip,i);skip=null;}protectionSkipBytes=(~buffer[i+1]&1)*2;frameLength=(buffer[i+3]&3)<<11|buffer[i+4]<<3|(buffer[i+5]&224)>>5;sampleCount=((buffer[i+6]&3)+1)*1024;adtsFrameDuration=sampleCount*ONE_SECOND_IN_TS$2/ADTS_SAMPLING_FREQUENCIES$1[(buffer[i+2]&60)>>>2];if(buffer.byteLength-i<frameLength){break}this.trigger("data",{pts:packet.pts+frameNum*adtsFrameDuration,dts:packet.dts+frameNum*adtsFrameDuration,sampleCount:sampleCount,audioobjecttype:(buffer[i+2]>>>6&3)+1,channelcount:(buffer[i+2]&1)<<2|(buffer[i+3]&192)>>>6,samplerate:ADTS_SAMPLING_FREQUENCIES$1[(buffer[i+2]&60)>>>2],samplingfrequencyindex:(buffer[i+2]&60)>>>2,samplesize:16,data:buffer.subarray(i+7+protectionSkipBytes,i+frameLength)});frameNum++;i+=frameLength;}if(typeof skip==="number"){this.skipWarn_(skip,i);skip=null;}buffer=buffer.subarray(i);};this.flush=function(){frameNum=0;this.trigger("done");};this.reset=function(){buffer=void 0;this.trigger("reset");};this.endTimeline=function(){buffer=void 0;this.trigger("endedtimeline");};};_AdtsStream.prototype=new stream;var adts=_AdtsStream;var ExpGolomb;ExpGolomb=function ExpGolomb(workingData){var workingBytesAvailable=workingData.byteLength,workingWord=0,workingBitsAvailable=0;this.length=function(){return 8*workingBytesAvailable};this.bitsAvailable=function(){return 8*workingBytesAvailable+workingBitsAvailable};this.loadWord=function(){var position=workingData.byteLength-workingBytesAvailable,workingBytes=new Uint8Array(4),availableBytes=Math.min(4,workingBytesAvailable);if(availableBytes===0){throw new Error("no bytes available")}workingBytes.set(workingData.subarray(position,position+availableBytes));workingWord=new DataView(workingBytes.buffer).getUint32(0);workingBitsAvailable=availableBytes*8;workingBytesAvailable-=availableBytes;};this.skipBits=function(count){var skipBytes;if(workingBitsAvailable>count){workingWord<<=count;workingBitsAvailable-=count;}else {count-=workingBitsAvailable;skipBytes=Math.floor(count/8);count-=skipBytes*8;workingBytesAvailable-=skipBytes;this.loadWord();workingWord<<=count;workingBitsAvailable-=count;}};this.readBits=function(size){var bits=Math.min(workingBitsAvailable,size),valu=workingWord>>>32-bits;workingBitsAvailable-=bits;if(workingBitsAvailable>0){workingWord<<=bits;}else if(workingBytesAvailable>0){this.loadWord();}bits=size-bits;if(bits>0){return valu<<bits|this.readBits(bits)}return valu};this.skipLeadingZeros=function(){var leadingZeroCount;for(leadingZeroCount=0;leadingZeroCount<workingBitsAvailable;++leadingZeroCount){if((workingWord&2147483648>>>leadingZeroCount)!==0){workingWord<<=leadingZeroCount;workingBitsAvailable-=leadingZeroCount;return leadingZeroCount}}this.loadWord();return leadingZeroCount+this.skipLeadingZeros()};this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros());};this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros());};this.readUnsignedExpGolomb=function(){var clz=this.skipLeadingZeros();return this.readBits(clz+1)-1};this.readExpGolomb=function(){var valu=this.readUnsignedExpGolomb();if(1&valu){return 1+valu>>>1}return -1*(valu>>>1)};this.readBoolean=function(){return this.readBits(1)===1};this.readUnsignedByte=function(){return this.readBits(8)};this.loadWord();};var expGolomb=ExpGolomb;var _H264Stream,_NalByteStream;var PROFILES_WITH_OPTIONAL_SPS_DATA;_NalByteStream=function NalByteStream(){var syncPoint=0,i,buffer;_NalByteStream.prototype.init.call(this);this.push=function(data){var swapBuffer;if(!buffer){buffer=data.data;}else {swapBuffer=new Uint8Array(buffer.byteLength+data.data.byteLength);swapBuffer.set(buffer);swapBuffer.set(data.data,buffer.byteLength);buffer=swapBuffer;}var len=buffer.byteLength;for(;syncPoint<len-3;syncPoint++){if(buffer[syncPoint+2]===1){i=syncPoint+5;break}}while(i<len){switch(buffer[i]){case 0:if(buffer[i-1]!==0){i+=2;break}else if(buffer[i-2]!==0){i++;break}if(syncPoint+3!==i-2){this.trigger("data",buffer.subarray(syncPoint+3,i-2));}do{i++;}while(buffer[i]!==1&&i<len);syncPoint=i-2;i+=3;break;case 1:if(buffer[i-1]!==0||buffer[i-2]!==0){i+=3;break}this.trigger("data",buffer.subarray(syncPoint+3,i-2));syncPoint=i-2;i+=3;break;default:i+=3;break}}buffer=buffer.subarray(syncPoint);i-=syncPoint;syncPoint=0;};this.reset=function(){buffer=null;syncPoint=0;this.trigger("reset");};this.flush=function(){if(buffer&&buffer.byteLength>3){this.trigger("data",buffer.subarray(syncPoint+3));}buffer=null;syncPoint=0;this.trigger("done");};this.endTimeline=function(){this.flush();this.trigger("endedtimeline");};};_NalByteStream.prototype=new stream;PROFILES_WITH_OPTIONAL_SPS_DATA={100:true,110:true,122:true,244:true,44:true,83:true,86:true,118:true,128:true,138:true,139:true,134:true};_H264Stream=function H264Stream(){var nalByteStream=new _NalByteStream,self1,trackId,currentPts,currentDts,discardEmulationPreventionBytes,readSequenceParameterSet,skipScalingList;_H264Stream.prototype.init.call(this);self1=this;this.push=function(packet){if(packet.type!=="video"){return}trackId=packet.trackId;currentPts=packet.pts;currentDts=packet.dts;nalByteStream.push(packet);};nalByteStream.on("data",function(data){var event={trackId:trackId,pts:currentPts,dts:currentDts,data:data,nalUnitTypeCode:data[0]&31};switch(event.nalUnitTypeCode){case 5:event.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:event.nalUnitType="sei_rbsp";event.escapedRBSP=discardEmulationPreventionBytes(data.subarray(1));break;case 7:event.nalUnitType="seq_parameter_set_rbsp";event.escapedRBSP=discardEmulationPreventionBytes(data.subarray(1));event.config=readSequenceParameterSet(event.escapedRBSP);break;case 8:event.nalUnitType="pic_parameter_set_rbsp";break;case 9:event.nalUnitType="access_unit_delimiter_rbsp";break}self1.trigger("data",event);});nalByteStream.on("done",function(){self1.trigger("done");});nalByteStream.on("partialdone",function(){self1.trigger("partialdone");});nalByteStream.on("reset",function(){self1.trigger("reset");});nalByteStream.on("endedtimeline",function(){self1.trigger("endedtimeline");});this.flush=function(){nalByteStream.flush();};this.partialFlush=function(){nalByteStream.partialFlush();};this.reset=function(){nalByteStream.reset();};this.endTimeline=function(){nalByteStream.endTimeline();};skipScalingList=function skipScalingList(count,expGolombDecoder){var lastScale=8,nextScale=8,j,deltaScale;for(j=0;j<count;j++){if(nextScale!==0){deltaScale=expGolombDecoder.readExpGolomb();nextScale=(lastScale+deltaScale+256)%256;}lastScale=nextScale===0?lastScale:nextScale;}};discardEmulationPreventionBytes=function discardEmulationPreventionBytes(data){var length=data.byteLength,emulationPreventionBytesPositions=[],i=1,newLength,newData;while(i<length-2){if(data[i]===0&&data[i+1]===0&&data[i+2]===3){emulationPreventionBytesPositions.push(i+2);i+=2;}else {i++;}}if(emulationPreventionBytesPositions.length===0){return data}newLength=length-emulationPreventionBytesPositions.length;newData=new Uint8Array(newLength);var sourceIndex=0;for(i=0;i<newLength;sourceIndex++,i++){if(sourceIndex===emulationPreventionBytesPositions[0]){sourceIndex++;emulationPreventionBytesPositions.shift();}newData[i]=data[sourceIndex];}return newData};readSequenceParameterSet=function readSequenceParameterSet(data){var frameCropLeftOffset=0,frameCropRightOffset=0,frameCropTopOffset=0,frameCropBottomOffset=0,expGolombDecoder,profileIdc,levelIdc,profileCompatibility,chromaFormatIdc,picOrderCntType,numRefFramesInPicOrderCntCycle,picWidthInMbsMinus1,picHeightInMapUnitsMinus1,frameMbsOnlyFlag,scalingListCount,sarRatio=[1,1],aspectRatioIdc,i;expGolombDecoder=new expGolomb(data);profileIdc=expGolombDecoder.readUnsignedByte();profileCompatibility=expGolombDecoder.readUnsignedByte();levelIdc=expGolombDecoder.readUnsignedByte();expGolombDecoder.skipUnsignedExpGolomb();if(PROFILES_WITH_OPTIONAL_SPS_DATA[profileIdc]){chromaFormatIdc=expGolombDecoder.readUnsignedExpGolomb();if(chromaFormatIdc===3){expGolombDecoder.skipBits(1);}expGolombDecoder.skipUnsignedExpGolomb();expGolombDecoder.skipUnsignedExpGolomb();expGolombDecoder.skipBits(1);if(expGolombDecoder.readBoolean()){scalingListCount=chromaFormatIdc!==3?8:12;for(i=0;i<scalingListCount;i++){if(expGolombDecoder.readBoolean()){if(i<6){skipScalingList(16,expGolombDecoder);}else {skipScalingList(64,expGolombDecoder);}}}}}expGolombDecoder.skipUnsignedExpGolomb();picOrderCntType=expGolombDecoder.readUnsignedExpGolomb();if(picOrderCntType===0){expGolombDecoder.readUnsignedExpGolomb();}else if(picOrderCntType===1){expGolombDecoder.skipBits(1);expGolombDecoder.skipExpGolomb();expGolombDecoder.skipExpGolomb();numRefFramesInPicOrderCntCycle=expGolombDecoder.readUnsignedExpGolomb();for(i=0;i<numRefFramesInPicOrderCntCycle;i++){expGolombDecoder.skipExpGolomb();}}expGolombDecoder.skipUnsignedExpGolomb();expGolombDecoder.skipBits(1);picWidthInMbsMinus1=expGolombDecoder.readUnsignedExpGolomb();picHeightInMapUnitsMinus1=expGolombDecoder.readUnsignedExpGolomb();frameMbsOnlyFlag=expGolombDecoder.readBits(1);if(frameMbsOnlyFlag===0){expGolombDecoder.skipBits(1);}expGolombDecoder.skipBits(1);if(expGolombDecoder.readBoolean()){frameCropLeftOffset=expGolombDecoder.readUnsignedExpGolomb();frameCropRightOffset=expGolombDecoder.readUnsignedExpGolomb();frameCropTopOffset=expGolombDecoder.readUnsignedExpGolomb();frameCropBottomOffset=expGolombDecoder.readUnsignedExpGolomb();}if(expGolombDecoder.readBoolean()){if(expGolombDecoder.readBoolean()){aspectRatioIdc=expGolombDecoder.readUnsignedByte();switch(aspectRatioIdc){case 1:sarRatio=[1,1];break;case 2:sarRatio=[12,11];break;case 3:sarRatio=[10,11];break;case 4:sarRatio=[16,11];break;case 5:sarRatio=[40,33];break;case 6:sarRatio=[24,11];break;case 7:sarRatio=[20,11];break;case 8:sarRatio=[32,11];break;case 9:sarRatio=[80,33];break;case 10:sarRatio=[18,11];break;case 11:sarRatio=[15,11];break;case 12:sarRatio=[64,33];break;case 13:sarRatio=[160,99];break;case 14:sarRatio=[4,3];break;case 15:sarRatio=[3,2];break;case 16:sarRatio=[2,1];break;case 255:{sarRatio=[expGolombDecoder.readUnsignedByte()<<8|expGolombDecoder.readUnsignedByte(),expGolombDecoder.readUnsignedByte()<<8|expGolombDecoder.readUnsignedByte()];break}}if(sarRatio){sarRatio[0]/sarRatio[1];}}}return {profileIdc:profileIdc,levelIdc:levelIdc,profileCompatibility:profileCompatibility,width:(picWidthInMbsMinus1+1)*16-frameCropLeftOffset*2-frameCropRightOffset*2,height:(2-frameMbsOnlyFlag)*(picHeightInMapUnitsMinus1+1)*16-frameCropTopOffset*2-frameCropBottomOffset*2,sarRatio:sarRatio}};};_H264Stream.prototype=new stream;var h264={H264Stream:_H264Stream,NalByteStream:_NalByteStream};var ADTS_SAMPLING_FREQUENCIES=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];var parseId3TagSize=function parseId3TagSize(header,byteIndex){var returnSize=header[byteIndex+6]<<21|header[byteIndex+7]<<14|header[byteIndex+8]<<7|header[byteIndex+9],flags=header[byteIndex+5],footerPresent=(flags&16)>>4;returnSize=returnSize>=0?returnSize:0;if(footerPresent){return returnSize+20}return returnSize+10};var getId3Offset=function getId3Offset(data,offset){if(data.length-offset<10||data[offset]!=="I".charCodeAt(0)||data[offset+1]!=="D".charCodeAt(0)||data[offset+2]!=="3".charCodeAt(0)){return offset}offset+=parseId3TagSize(data,offset);return getId3Offset(data,offset)};var isLikelyAacData$1=function isLikelyAacData(data){var offset=getId3Offset(data,0);return data.length>=offset+2&&(data[offset]&255)===255&&(data[offset+1]&240)===240&&(data[offset+1]&22)===16};var parseSyncSafeInteger=function parseSyncSafeInteger(data){return data[0]<<21|data[1]<<14|data[2]<<7|data[3]};var percentEncode=function percentEncode(bytes,start,end){var i,result="";for(i=start;i<end;i++){result+="%"+("00"+bytes[i].toString(16)).slice(-2);}return result};var parseIso88591=function parseIso88591(bytes,start,end){return unescape(percentEncode(bytes,start,end))};var parseAdtsSize=function parseAdtsSize(header,byteIndex){var lowThree=(header[byteIndex+5]&224)>>5,middle=header[byteIndex+4]<<3,highTwo=header[byteIndex+3]&3<<11;return highTwo|middle|lowThree};var parseType$2=function parseType(header,byteIndex){if(header[byteIndex]==="I".charCodeAt(0)&&header[byteIndex+1]==="D".charCodeAt(0)&&header[byteIndex+2]==="3".charCodeAt(0)){return "timed-metadata"}else if(header[byteIndex]&255===255&&(header[byteIndex+1]&240)===240){return "audio"}return null};var parseSampleRate=function parseSampleRate(packet){var i=0;while(i+5<packet.length){if(packet[i]!==255||(packet[i+1]&246)!==240){i++;continue}return ADTS_SAMPLING_FREQUENCIES[(packet[i+2]&60)>>>2]}return null};var parseAacTimestamp=function parseAacTimestamp(packet){var frameStart,frameSize,frame,frameHeader;frameStart=10;if(packet[5]&64){frameStart+=4;frameStart+=parseSyncSafeInteger(packet.subarray(10,14));}do{frameSize=parseSyncSafeInteger(packet.subarray(frameStart+4,frameStart+8));if(frameSize<1){return null}frameHeader=String.fromCharCode(packet[frameStart],packet[frameStart+1],packet[frameStart+2],packet[frameStart+3]);if(frameHeader==="PRIV"){frame=packet.subarray(frameStart+10,frameStart+frameSize+10);for(var i=0;i<frame.byteLength;i++){if(frame[i]===0){var owner=parseIso88591(frame,0,i);if(owner==="com.apple.streaming.transportStreamTimestamp"){var d=frame.subarray(i+1);var size=(d[3]&1)<<30|d[4]<<22|d[5]<<14|d[6]<<6|d[7]>>>2;size*=4;size+=d[7]&3;return size}break}}}frameStart+=10;frameStart+=frameSize;}while(frameStart<packet.byteLength);return null};var utils={isLikelyAacData:isLikelyAacData$1,parseId3TagSize:parseId3TagSize,parseAdtsSize:parseAdtsSize,parseType:parseType$2,parseSampleRate:parseSampleRate,parseAacTimestamp:parseAacTimestamp};var _AacStream;_AacStream=function AacStream(){var everything=new Uint8Array,timeStamp=0;_AacStream.prototype.init.call(this);this.setTimestamp=function(timestamp){timeStamp=timestamp;};this.push=function(bytes){var frameSize=0,byteIndex=0,bytesLeft,chunk,packet,tempLength;if(everything.length){tempLength=everything.length;everything=new Uint8Array(bytes.byteLength+tempLength);everything.set(everything.subarray(0,tempLength));everything.set(bytes,tempLength);}else {everything=bytes;}while(everything.length-byteIndex>=3){if(everything[byteIndex]==="I".charCodeAt(0)&&everything[byteIndex+1]==="D".charCodeAt(0)&&everything[byteIndex+2]==="3".charCodeAt(0)){if(everything.length-byteIndex<10){break}frameSize=utils.parseId3TagSize(everything,byteIndex);if(byteIndex+frameSize>everything.length){break}chunk={type:"timed-metadata",data:everything.subarray(byteIndex,byteIndex+frameSize)};this.trigger("data",chunk);byteIndex+=frameSize;continue}else if((everything[byteIndex]&255)===255&&(everything[byteIndex+1]&240)===240){if(everything.length-byteIndex<7){break}frameSize=utils.parseAdtsSize(everything,byteIndex);if(byteIndex+frameSize>everything.length){break}packet={type:"audio",data:everything.subarray(byteIndex,byteIndex+frameSize),pts:timeStamp,dts:timeStamp};this.trigger("data",packet);byteIndex+=frameSize;continue}byteIndex++;}bytesLeft=everything.length-byteIndex;if(bytesLeft>0){everything=everything.subarray(byteIndex);}else {everything=new Uint8Array;}};this.reset=function(){everything=new Uint8Array;this.trigger("reset");};this.endTimeline=function(){everything=new Uint8Array;this.trigger("endedtimeline");};};_AacStream.prototype=new stream;var aac=_AacStream;var AUDIO_PROPERTIES=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"];var audioProperties=AUDIO_PROPERTIES;var VIDEO_PROPERTIES=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"];var videoProperties=VIDEO_PROPERTIES;var H264Stream=h264.H264Stream;var isLikelyAacData=utils.isLikelyAacData;var ONE_SECOND_IN_TS$1=clock.ONE_SECOND_IN_TS;var _VideoSegmentStream,_AudioSegmentStream,_Transmuxer,_CoalesceStream;var retriggerForStream=function retriggerForStream(key,event){event.stream=key;this.trigger("log",event);};var addPipelineLogRetriggers=function addPipelineLogRetriggers(transmuxer,pipeline){var keys=Object.keys(pipeline);for(var i=0;i<keys.length;i++){var key=keys[i];if(key==="headOfPipeline"||!pipeline[key].on){continue}pipeline[key].on("log",retriggerForStream.bind(transmuxer,key));}};var arrayEquals=function arrayEquals(a,b){var i;if(a.length!==b.length){return false}for(i=0;i<a.length;i++){if(a[i]!==b[i]){return false}}return true};var generateSegmentTimingInfo=function generateSegmentTimingInfo(baseMediaDecodeTime,startDts,startPts,endDts,endPts,prependedContentDuration){var ptsOffsetFromDts=startPts-startDts,decodeDuration=endDts-startDts,presentationDuration=endPts-startPts;return {start:{dts:baseMediaDecodeTime,pts:baseMediaDecodeTime+ptsOffsetFromDts},end:{dts:baseMediaDecodeTime+decodeDuration,pts:baseMediaDecodeTime+presentationDuration},prependedContentDuration:prependedContentDuration,baseMediaDecodeTime:baseMediaDecodeTime}};_AudioSegmentStream=function AudioSegmentStream(track,options){var adtsFrames=[],sequenceNumber,earliestAllowedDts=0,audioAppendStartTs=0,videoBaseMediaDecodeTime=Infinity;options=options||{};sequenceNumber=options.firstSequenceNumber||0;_AudioSegmentStream.prototype.init.call(this);this.push=function(data){trackDecodeInfo.collectDtsInfo(track,data);if(track){audioProperties.forEach(function(prop){track[prop]=data[prop];});}adtsFrames.push(data);};this.setEarliestDts=function(earliestDts){earliestAllowedDts=earliestDts;};this.setVideoBaseMediaDecodeTime=function(baseMediaDecodeTime){videoBaseMediaDecodeTime=baseMediaDecodeTime;};this.setAudioAppendStart=function(timestamp){audioAppendStartTs=timestamp;};this.flush=function(){var frames,moof,mdat,boxes,frameDuration,segmentDuration,videoClockCyclesOfSilencePrefixed;if(adtsFrames.length===0){this.trigger("done","AudioSegmentStream");return}frames=audioFrameUtils.trimAdtsFramesByEarliestDts(adtsFrames,track,earliestAllowedDts);track.baseMediaDecodeTime=trackDecodeInfo.calculateTrackBaseMediaDecodeTime(track,options.keepOriginalTimestamps);videoClockCyclesOfSilencePrefixed=audioFrameUtils.prefixWithSilence(track,frames,audioAppendStartTs,videoBaseMediaDecodeTime);track.samples=audioFrameUtils.generateSampleTable(frames);mdat=mp4Generator.mdat(audioFrameUtils.concatenateFrameData(frames));adtsFrames=[];moof=mp4Generator.moof(sequenceNumber,[track]);boxes=new Uint8Array(moof.byteLength+mdat.byteLength);sequenceNumber++;boxes.set(moof);boxes.set(mdat,moof.byteLength);trackDecodeInfo.clearDtsInfo(track);frameDuration=Math.ceil(ONE_SECOND_IN_TS$1*1024/track.samplerate);if(frames.length){segmentDuration=frames.length*frameDuration;this.trigger("segmentTimingInfo",generateSegmentTimingInfo(clock.audioTsToVideoTs(track.baseMediaDecodeTime,track.samplerate),frames[0].dts,frames[0].pts,frames[0].dts+segmentDuration,frames[0].pts+segmentDuration,videoClockCyclesOfSilencePrefixed||0));this.trigger("timingInfo",{start:frames[0].pts,end:frames[0].pts+segmentDuration});}this.trigger("data",{track:track,boxes:boxes});this.trigger("done","AudioSegmentStream");};this.reset=function(){trackDecodeInfo.clearDtsInfo(track);adtsFrames=[];this.trigger("reset");};};_AudioSegmentStream.prototype=new stream;_VideoSegmentStream=function VideoSegmentStream(track,options){var sequenceNumber,nalUnits=[],gopsToAlignWith=[],config,pps;options=options||{};sequenceNumber=options.firstSequenceNumber||0;_VideoSegmentStream.prototype.init.call(this);delete track.minPTS;this.gopCache_=[];this.push=function(nalUnit){trackDecodeInfo.collectDtsInfo(track,nalUnit);if(nalUnit.nalUnitType==="seq_parameter_set_rbsp"&&!config){config=nalUnit.config;track.sps=[nalUnit.data];videoProperties.forEach(function(prop){track[prop]=config[prop];},this);}if(nalUnit.nalUnitType==="pic_parameter_set_rbsp"&&!pps){pps=nalUnit.data;track.pps=[nalUnit.data];}nalUnits.push(nalUnit);};this.flush=function(){var frames,gopForFusion,gops,moof,mdat,boxes,prependedContentDuration=0,firstGop,lastGop;while(nalUnits.length){if(nalUnits[0].nalUnitType==="access_unit_delimiter_rbsp"){break}nalUnits.shift();}if(nalUnits.length===0){this.resetStream_();this.trigger("done","VideoSegmentStream");return}frames=frameUtils.groupNalsIntoFrames(nalUnits);gops=frameUtils.groupFramesIntoGops(frames);if(!gops[0][0].keyFrame){gopForFusion=this.getGopForFusion_(nalUnits[0],track);if(gopForFusion){prependedContentDuration=gopForFusion.duration;gops.unshift(gopForFusion);gops.byteLength+=gopForFusion.byteLength;gops.nalCount+=gopForFusion.nalCount;gops.pts=gopForFusion.pts;gops.dts=gopForFusion.dts;gops.duration+=gopForFusion.duration;}else {gops=frameUtils.extendFirstKeyFrame(gops);}}if(gopsToAlignWith.length){var alignedGops;if(options.alignGopsAtEnd){alignedGops=this.alignGopsAtEnd_(gops);}else {alignedGops=this.alignGopsAtStart_(gops);}if(!alignedGops){this.gopCache_.unshift({gop:gops.pop(),pps:track.pps,sps:track.sps});this.gopCache_.length=Math.min(6,this.gopCache_.length);nalUnits=[];this.resetStream_();this.trigger("done","VideoSegmentStream");return}trackDecodeInfo.clearDtsInfo(track);gops=alignedGops;}trackDecodeInfo.collectDtsInfo(track,gops);track.samples=frameUtils.generateSampleTable(gops);mdat=mp4Generator.mdat(frameUtils.concatenateNalData(gops));track.baseMediaDecodeTime=trackDecodeInfo.calculateTrackBaseMediaDecodeTime(track,options.keepOriginalTimestamps);this.trigger("processedGopsInfo",gops.map(function(gop){return {pts:gop.pts,dts:gop.dts,byteLength:gop.byteLength}}));firstGop=gops[0];lastGop=gops[gops.length-1];this.trigger("segmentTimingInfo",generateSegmentTimingInfo(track.baseMediaDecodeTime,firstGop.dts,firstGop.pts,lastGop.dts+lastGop.duration,lastGop.pts+lastGop.duration,prependedContentDuration));this.trigger("timingInfo",{start:gops[0].pts,end:gops[gops.length-1].pts+gops[gops.length-1].duration});this.gopCache_.unshift({gop:gops.pop(),pps:track.pps,sps:track.sps});this.gopCache_.length=Math.min(6,this.gopCache_.length);nalUnits=[];this.trigger("baseMediaDecodeTime",track.baseMediaDecodeTime);this.trigger("timelineStartInfo",track.timelineStartInfo);moof=mp4Generator.moof(sequenceNumber,[track]);boxes=new Uint8Array(moof.byteLength+mdat.byteLength);sequenceNumber++;boxes.set(moof);boxes.set(mdat,moof.byteLength);this.trigger("data",{track:track,boxes:boxes});this.resetStream_();this.trigger("done","VideoSegmentStream");};this.reset=function(){this.resetStream_();nalUnits=[];this.gopCache_.length=0;gopsToAlignWith.length=0;this.trigger("reset");};this.resetStream_=function(){trackDecodeInfo.clearDtsInfo(track);config=undefined;pps=undefined;};this.getGopForFusion_=function(nalUnit){var halfSecond=45e3,allowableOverlap=1e4,nearestDistance=Infinity,dtsDistance,nearestGopObj,currentGop,currentGopObj,i;for(i=0;i<this.gopCache_.length;i++){currentGopObj=this.gopCache_[i];currentGop=currentGopObj.gop;if(!(track.pps&&arrayEquals(track.pps[0],currentGopObj.pps[0]))||!(track.sps&&arrayEquals(track.sps[0],currentGopObj.sps[0]))){continue}if(currentGop.dts<track.timelineStartInfo.dts){continue}dtsDistance=nalUnit.dts-currentGop.dts-currentGop.duration;if(dtsDistance>=-allowableOverlap&&dtsDistance<=halfSecond){if(!nearestGopObj||nearestDistance>dtsDistance){nearestGopObj=currentGopObj;nearestDistance=dtsDistance;}}}if(nearestGopObj){return nearestGopObj.gop}return null};this.alignGopsAtStart_=function(gops){var alignIndex,gopIndex,align,gop,byteLength,nalCount,duration,alignedGops;byteLength=gops.byteLength;nalCount=gops.nalCount;duration=gops.duration;alignIndex=gopIndex=0;while(alignIndex<gopsToAlignWith.length&&gopIndex<gops.length){align=gopsToAlignWith[alignIndex];gop=gops[gopIndex];if(align.pts===gop.pts){break}if(gop.pts>align.pts){alignIndex++;continue}gopIndex++;byteLength-=gop.byteLength;nalCount-=gop.nalCount;duration-=gop.duration;}if(gopIndex===0){return gops}if(gopIndex===gops.length){return null}alignedGops=gops.slice(gopIndex);alignedGops.byteLength=byteLength;alignedGops.duration=duration;alignedGops.nalCount=nalCount;alignedGops.pts=alignedGops[0].pts;alignedGops.dts=alignedGops[0].dts;return alignedGops};this.alignGopsAtEnd_=function(gops){var alignIndex,gopIndex,align,gop,alignEndIndex,matchFound;alignIndex=gopsToAlignWith.length-1;gopIndex=gops.length-1;alignEndIndex=null;matchFound=false;while(alignIndex>=0&&gopIndex>=0){align=gopsToAlignWith[alignIndex];gop=gops[gopIndex];if(align.pts===gop.pts){matchFound=true;break}if(align.pts>gop.pts){alignIndex--;continue}if(alignIndex===gopsToAlignWith.length-1){alignEndIndex=gopIndex;}gopIndex--;}if(!matchFound&&alignEndIndex===null){return null}var trimIndex;if(matchFound){trimIndex=gopIndex;}else {trimIndex=alignEndIndex;}if(trimIndex===0){return gops}var alignedGops=gops.slice(trimIndex);var metadata=alignedGops.reduce(function(total,gop){total.byteLength+=gop.byteLength;total.duration+=gop.duration;total.nalCount+=gop.nalCount;return total},{byteLength:0,duration:0,nalCount:0});alignedGops.byteLength=metadata.byteLength;alignedGops.duration=metadata.duration;alignedGops.nalCount=metadata.nalCount;alignedGops.pts=alignedGops[0].pts;alignedGops.dts=alignedGops[0].dts;return alignedGops};this.alignGopsWith=function(newGopsToAlignWith){gopsToAlignWith=newGopsToAlignWith;};};_VideoSegmentStream.prototype=new stream;_CoalesceStream=function CoalesceStream(options,metadataStream){this.numberOfTracks=0;this.metadataStream=metadataStream;options=options||{};if(typeof options.remux!=="undefined"){this.remuxTracks=!!options.remux;}else {this.remuxTracks=true;}if(typeof options.keepOriginalTimestamps==="boolean"){this.keepOriginalTimestamps=options.keepOriginalTimestamps;}else {this.keepOriginalTimestamps=false;}this.pendingTracks=[];this.videoTrack=null;this.pendingBoxes=[];this.pendingCaptions=[];this.pendingMetadata=[];this.pendingBytes=0;this.emittedTracks=0;_CoalesceStream.prototype.init.call(this);this.push=function(output){if(output.text){return this.pendingCaptions.push(output)}if(output.frames){return this.pendingMetadata.push(output)}this.pendingTracks.push(output.track);this.pendingBytes+=output.boxes.byteLength;if(output.track.type==="video"){this.videoTrack=output.track;this.pendingBoxes.push(output.boxes);}if(output.track.type==="audio"){this.audioTrack=output.track;this.pendingBoxes.unshift(output.boxes);}};};_CoalesceStream.prototype=new stream;_CoalesceStream.prototype.flush=function(flushSource){var offset=0,event={captions:[],captionStreams:{},metadata:[],info:{}},caption,id3,initSegment,timelineStartPts=0,i;if(this.pendingTracks.length<this.numberOfTracks){if(flushSource!=="VideoSegmentStream"&&flushSource!=="AudioSegmentStream"){return}else if(this.remuxTracks){return}else if(this.pendingTracks.length===0){this.emittedTracks++;if(this.emittedTracks>=this.numberOfTracks){this.trigger("done");this.emittedTracks=0;}return}}if(this.videoTrack){timelineStartPts=this.videoTrack.timelineStartInfo.pts;videoProperties.forEach(function(prop){event.info[prop]=this.videoTrack[prop];},this);}else if(this.audioTrack){timelineStartPts=this.audioTrack.timelineStartInfo.pts;audioProperties.forEach(function(prop){event.info[prop]=this.audioTrack[prop];},this);}if(this.videoTrack||this.audioTrack){if(this.pendingTracks.length===1){event.type=this.pendingTracks[0].type;}else {event.type="combined";}this.emittedTracks+=this.pendingTracks.length;initSegment=mp4Generator.initSegment(this.pendingTracks);event.initSegment=new Uint8Array(initSegment.byteLength);event.initSegment.set(initSegment);event.data=new Uint8Array(this.pendingBytes);for(i=0;i<this.pendingBoxes.length;i++){event.data.set(this.pendingBoxes[i],offset);offset+=this.pendingBoxes[i].byteLength;}for(i=0;i<this.pendingCaptions.length;i++){caption=this.pendingCaptions[i];caption.startTime=clock.metadataTsToSeconds(caption.startPts,timelineStartPts,this.keepOriginalTimestamps);caption.endTime=clock.metadataTsToSeconds(caption.endPts,timelineStartPts,this.keepOriginalTimestamps);event.captionStreams[caption.stream]=true;event.captions.push(caption);}for(i=0;i<this.pendingMetadata.length;i++){id3=this.pendingMetadata[i];id3.cueTime=clock.metadataTsToSeconds(id3.pts,timelineStartPts,this.keepOriginalTimestamps);event.metadata.push(id3);}event.metadata.dispatchType=this.metadataStream.dispatchType;this.pendingTracks.length=0;this.videoTrack=null;this.pendingBoxes.length=0;this.pendingCaptions.length=0;this.pendingBytes=0;this.pendingMetadata.length=0;this.trigger("data",event);for(i=0;i<event.captions.length;i++){caption=event.captions[i];this.trigger("caption",caption);}for(i=0;i<event.metadata.length;i++){id3=event.metadata[i];this.trigger("id3Frame",id3);}}if(this.emittedTracks>=this.numberOfTracks){this.trigger("done");this.emittedTracks=0;}};_CoalesceStream.prototype.setRemux=function(val){this.remuxTracks=val;};_Transmuxer=function Transmuxer(options){var self1=this,hasFlushed=true,videoTrack,audioTrack;_Transmuxer.prototype.init.call(this);options=options||{};this.baseMediaDecodeTime=options.baseMediaDecodeTime||0;this.transmuxPipeline_={};this.setupAacPipeline=function(){var pipeline={};this.transmuxPipeline_=pipeline;pipeline.type="aac";pipeline.metadataStream=new m2ts_1.MetadataStream;pipeline.aacStream=new aac;pipeline.audioTimestampRolloverStream=new m2ts_1.TimestampRolloverStream("audio");pipeline.timedMetadataTimestampRolloverStream=new m2ts_1.TimestampRolloverStream("timed-metadata");pipeline.adtsStream=new adts;pipeline.coalesceStream=new _CoalesceStream(options,pipeline.metadataStream);pipeline.headOfPipeline=pipeline.aacStream;pipeline.aacStream.pipe(pipeline.audioTimestampRolloverStream).pipe(pipeline.adtsStream);pipeline.aacStream.pipe(pipeline.timedMetadataTimestampRolloverStream).pipe(pipeline.metadataStream).pipe(pipeline.coalesceStream);pipeline.metadataStream.on("timestamp",function(frame){pipeline.aacStream.setTimestamp(frame.timeStamp);});pipeline.aacStream.on("data",function(data){if(data.type!=="timed-metadata"&&data.type!=="audio"||pipeline.audioSegmentStream){return}audioTrack=audioTrack||{timelineStartInfo:{baseMediaDecodeTime:self1.baseMediaDecodeTime},codec:"adts",type:"audio"};pipeline.coalesceStream.numberOfTracks++;pipeline.audioSegmentStream=new _AudioSegmentStream(audioTrack,options);pipeline.audioSegmentStream.on("log",self1.getLogTrigger_("audioSegmentStream"));pipeline.audioSegmentStream.on("timingInfo",self1.trigger.bind(self1,"audioTimingInfo"));pipeline.adtsStream.pipe(pipeline.audioSegmentStream).pipe(pipeline.coalesceStream);self1.trigger("trackinfo",{hasAudio:!!audioTrack,hasVideo:!!videoTrack});});pipeline.coalesceStream.on("data",this.trigger.bind(this,"data"));pipeline.coalesceStream.on("done",this.trigger.bind(this,"done"));addPipelineLogRetriggers(this,pipeline);};this.setupTsPipeline=function(){var pipeline={};this.transmuxPipeline_=pipeline;pipeline.type="ts";pipeline.metadataStream=new m2ts_1.MetadataStream;pipeline.packetStream=new m2ts_1.TransportPacketStream;pipeline.parseStream=new m2ts_1.TransportParseStream;pipeline.elementaryStream=new m2ts_1.ElementaryStream;pipeline.timestampRolloverStream=new m2ts_1.TimestampRolloverStream;pipeline.adtsStream=new adts;pipeline.h264Stream=new H264Stream;pipeline.captionStream=new m2ts_1.CaptionStream(options);pipeline.coalesceStream=new _CoalesceStream(options,pipeline.metadataStream);pipeline.headOfPipeline=pipeline.packetStream;pipeline.packetStream.pipe(pipeline.parseStream).pipe(pipeline.elementaryStream).pipe(pipeline.timestampRolloverStream);pipeline.timestampRolloverStream.pipe(pipeline.h264Stream);pipeline.timestampRolloverStream.pipe(pipeline.adtsStream);pipeline.timestampRolloverStream.pipe(pipeline.metadataStream).pipe(pipeline.coalesceStream);pipeline.h264Stream.pipe(pipeline.captionStream).pipe(pipeline.coalesceStream);pipeline.elementaryStream.on("data",function(data){var i;if(data.type==="metadata"){i=data.tracks.length;while(i--){if(!videoTrack&&data.tracks[i].type==="video"){videoTrack=data.tracks[i];videoTrack.timelineStartInfo.baseMediaDecodeTime=self1.baseMediaDecodeTime;}else if(!audioTrack&&data.tracks[i].type==="audio"){audioTrack=data.tracks[i];audioTrack.timelineStartInfo.baseMediaDecodeTime=self1.baseMediaDecodeTime;}}if(videoTrack&&!pipeline.videoSegmentStream){pipeline.coalesceStream.numberOfTracks++;pipeline.videoSegmentStream=new _VideoSegmentStream(videoTrack,options);pipeline.videoSegmentStream.on("log",self1.getLogTrigger_("videoSegmentStream"));pipeline.videoSegmentStream.on("timelineStartInfo",function(timelineStartInfo){if(audioTrack&&!options.keepOriginalTimestamps){audioTrack.timelineStartInfo=timelineStartInfo;pipeline.audioSegmentStream.setEarliestDts(timelineStartInfo.dts-self1.baseMediaDecodeTime);}});pipeline.videoSegmentStream.on("processedGopsInfo",self1.trigger.bind(self1,"gopInfo"));pipeline.videoSegmentStream.on("segmentTimingInfo",self1.trigger.bind(self1,"videoSegmentTimingInfo"));pipeline.videoSegmentStream.on("baseMediaDecodeTime",function(baseMediaDecodeTime){if(audioTrack){pipeline.audioSegmentStream.setVideoBaseMediaDecodeTime(baseMediaDecodeTime);}});pipeline.videoSegmentStream.on("timingInfo",self1.trigger.bind(self1,"videoTimingInfo"));pipeline.h264Stream.pipe(pipeline.videoSegmentStream).pipe(pipeline.coalesceStream);}if(audioTrack&&!pipeline.audioSegmentStream){pipeline.coalesceStream.numberOfTracks++;pipeline.audioSegmentStream=new _AudioSegmentStream(audioTrack,options);pipeline.audioSegmentStream.on("log",self1.getLogTrigger_("audioSegmentStream"));pipeline.audioSegmentStream.on("timingInfo",self1.trigger.bind(self1,"audioTimingInfo"));pipeline.audioSegmentStream.on("segmentTimingInfo",self1.trigger.bind(self1,"audioSegmentTimingInfo"));pipeline.adtsStream.pipe(pipeline.audioSegmentStream).pipe(pipeline.coalesceStream);}self1.trigger("trackinfo",{hasAudio:!!audioTrack,hasVideo:!!videoTrack});}});pipeline.coalesceStream.on("data",this.trigger.bind(this,"data"));pipeline.coalesceStream.on("id3Frame",function(id3Frame){id3Frame.dispatchType=pipeline.metadataStream.dispatchType;self1.trigger("id3Frame",id3Frame);});pipeline.coalesceStream.on("caption",this.trigger.bind(this,"caption"));pipeline.coalesceStream.on("done",this.trigger.bind(this,"done"));addPipelineLogRetriggers(this,pipeline);};this.setBaseMediaDecodeTime=function(baseMediaDecodeTime){var pipeline=this.transmuxPipeline_;if(!options.keepOriginalTimestamps){this.baseMediaDecodeTime=baseMediaDecodeTime;}if(audioTrack){audioTrack.timelineStartInfo.dts=undefined;audioTrack.timelineStartInfo.pts=undefined;trackDecodeInfo.clearDtsInfo(audioTrack);if(pipeline.audioTimestampRolloverStream){pipeline.audioTimestampRolloverStream.discontinuity();}}if(videoTrack){if(pipeline.videoSegmentStream){pipeline.videoSegmentStream.gopCache_=[];}videoTrack.timelineStartInfo.dts=undefined;videoTrack.timelineStartInfo.pts=undefined;trackDecodeInfo.clearDtsInfo(videoTrack);pipeline.captionStream.reset();}if(pipeline.timestampRolloverStream){pipeline.timestampRolloverStream.discontinuity();}};this.setAudioAppendStart=function(timestamp){if(audioTrack){this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(timestamp);}};this.setRemux=function(val){var pipeline=this.transmuxPipeline_;options.remux=val;if(pipeline&&pipeline.coalesceStream){pipeline.coalesceStream.setRemux(val);}};this.alignGopsWith=function(gopsToAlignWith){if(videoTrack&&this.transmuxPipeline_.videoSegmentStream){this.transmuxPipeline_.videoSegmentStream.alignGopsWith(gopsToAlignWith);}};this.getLogTrigger_=function(key){var self1=this;return function(event){event.stream=key;self1.trigger("log",event);}};this.push=function(data){if(hasFlushed){var isAac=isLikelyAacData(data);if(isAac&&this.transmuxPipeline_.type!=="aac"){this.setupAacPipeline();}else if(!isAac&&this.transmuxPipeline_.type!=="ts"){this.setupTsPipeline();}hasFlushed=false;}this.transmuxPipeline_.headOfPipeline.push(data);};this.flush=function(){hasFlushed=true;this.transmuxPipeline_.headOfPipeline.flush();};this.endTimeline=function(){this.transmuxPipeline_.headOfPipeline.endTimeline();};this.reset=function(){if(this.transmuxPipeline_.headOfPipeline){this.transmuxPipeline_.headOfPipeline.reset();}};this.resetCaptions=function(){if(this.transmuxPipeline_.captionStream){this.transmuxPipeline_.captionStream.reset();}};};_Transmuxer.prototype=new stream;var transmuxer={Transmuxer:_Transmuxer,VideoSegmentStream:_VideoSegmentStream,AudioSegmentStream:_AudioSegmentStream,AUDIO_PROPERTIES:audioProperties,VIDEO_PROPERTIES:videoProperties,generateSegmentTimingInfo:generateSegmentTimingInfo};var toUnsigned$3=function toUnsigned(value){return value>>>0};var toHexString$1=function toHexString(value){return ("00"+value.toString(16)).slice(-2)};var bin={toUnsigned:toUnsigned$3,toHexString:toHexString$1};var parseType$1=function parseType(buffer){var result="";result+=String.fromCharCode(buffer[0]);result+=String.fromCharCode(buffer[1]);result+=String.fromCharCode(buffer[2]);result+=String.fromCharCode(buffer[3]);return result};var parseType_1=parseType$1;var toUnsigned$2=bin.toUnsigned;var findBox=function findBox(data,path){var results=[],i,size,type,end,subresults;if(!path.length){return null}for(i=0;i<data.byteLength;){size=toUnsigned$2(data[i]<<24|data[i+1]<<16|data[i+2]<<8|data[i+3]);type=parseType_1(data.subarray(i+4,i+8));end=size>1?i+size:data.byteLength;if(type===path[0]){if(path.length===1){results.push(data.subarray(i+8,end));}else {subresults=findBox(data.subarray(i+8,end),path.slice(1));if(subresults.length){results=results.concat(subresults);}}}i=end;}return results};var findBox_1=findBox;var toUnsigned$1=bin.toUnsigned;var getUint64$1=numbers.getUint64;var tfdt=function tfdt(data){var result={version:data[0],flags:new Uint8Array(data.subarray(1,4))};if(result.version===1){result.baseMediaDecodeTime=getUint64$1(data.subarray(4));}else {result.baseMediaDecodeTime=toUnsigned$1(data[4]<<24|data[5]<<16|data[6]<<8|data[7]);}return result};var parseTfdt=tfdt;var parseSampleFlags=function parseSampleFlags(flags){return {isLeading:(flags[0]&12)>>>2,dependsOn:flags[0]&3,isDependedOn:(flags[1]&192)>>>6,hasRedundancy:(flags[1]&48)>>>4,paddingValue:(flags[1]&14)>>>1,isNonSyncSample:flags[1]&1,degradationPriority:flags[2]<<8|flags[3]}};var parseSampleFlags_1=parseSampleFlags;var trun=function trun(data){var result={version:data[0],flags:new Uint8Array(data.subarray(1,4)),samples:[]},view=new DataView(data.buffer,data.byteOffset,data.byteLength),dataOffsetPresent=result.flags[2]&1,firstSampleFlagsPresent=result.flags[2]&4,sampleDurationPresent=result.flags[1]&1,sampleSizePresent=result.flags[1]&2,sampleFlagsPresent=result.flags[1]&4,sampleCompositionTimeOffsetPresent=result.flags[1]&8,sampleCount=view.getUint32(4),offset=8,sample;if(dataOffsetPresent){result.dataOffset=view.getInt32(offset);offset+=4;}if(firstSampleFlagsPresent&&sampleCount){sample={flags:parseSampleFlags_1(data.subarray(offset,offset+4))};offset+=4;if(sampleDurationPresent){sample.duration=view.getUint32(offset);offset+=4;}if(sampleSizePresent){sample.size=view.getUint32(offset);offset+=4;}if(sampleCompositionTimeOffsetPresent){if(result.version===1){sample.compositionTimeOffset=view.getInt32(offset);}else {sample.compositionTimeOffset=view.getUint32(offset);}offset+=4;}result.samples.push(sample);sampleCount--;}while(sampleCount--){sample={};if(sampleDurationPresent){sample.duration=view.getUint32(offset);offset+=4;}if(sampleSizePresent){sample.size=view.getUint32(offset);offset+=4;}if(sampleFlagsPresent){sample.flags=parseSampleFlags_1(data.subarray(offset,offset+4));offset+=4;}if(sampleCompositionTimeOffsetPresent){if(result.version===1){sample.compositionTimeOffset=view.getInt32(offset);}else {sample.compositionTimeOffset=view.getUint32(offset);}offset+=4;}result.samples.push(sample);}return result};var parseTrun=trun;var tfhd=function tfhd(data){var view=new DataView(data.buffer,data.byteOffset,data.byteLength),result={version:data[0],flags:new Uint8Array(data.subarray(1,4)),trackId:view.getUint32(4)},baseDataOffsetPresent=result.flags[2]&1,sampleDescriptionIndexPresent=result.flags[2]&2,defaultSampleDurationPresent=result.flags[2]&8,defaultSampleSizePresent=result.flags[2]&16,defaultSampleFlagsPresent=result.flags[2]&32,durationIsEmpty=result.flags[0]&65536,defaultBaseIsMoof=result.flags[0]&131072,i;i=8;if(baseDataOffsetPresent){i+=4;result.baseDataOffset=view.getUint32(12);i+=4;}if(sampleDescriptionIndexPresent){result.sampleDescriptionIndex=view.getUint32(i);i+=4;}if(defaultSampleDurationPresent){result.defaultSampleDuration=view.getUint32(i);i+=4;}if(defaultSampleSizePresent){result.defaultSampleSize=view.getUint32(i);i+=4;}if(defaultSampleFlagsPresent){result.defaultSampleFlags=view.getUint32(i);}if(durationIsEmpty){result.durationIsEmpty=true;}if(!baseDataOffsetPresent&&defaultBaseIsMoof){result.baseDataOffsetIsMoof=true;}return result};var parseTfhd=tfhd;var commonjsGlobal=typeof globalThis!=="undefined"?globalThis:typeof window!=="undefined"?window:typeof global!=="undefined"?global:typeof self!=="undefined"?self:{};var win;if(typeof window!=="undefined"){win=window;}else if(typeof commonjsGlobal!=="undefined"){win=commonjsGlobal;}else if(typeof self!=="undefined"){win=self;}else {win={};}var window_1=win;var discardEmulationPreventionBytes=captionPacketParser.discardEmulationPreventionBytes;var CaptionStream=captionStream.CaptionStream;var mapToSample=function mapToSample(offset,samples){var approximateOffset=offset;for(var i=0;i<samples.length;i++){var sample=samples[i];if(approximateOffset<sample.size){return sample}approximateOffset-=sample.size;}return null};var findSeiNals=function findSeiNals(avcStream,samples,trackId){var avcView=new DataView(avcStream.buffer,avcStream.byteOffset,avcStream.byteLength),result={logs:[],seiNals:[]},seiNal,i,length,lastMatchedSample;for(i=0;i+4<avcStream.length;i+=length){length=avcView.getUint32(i);i+=4;if(length<=0){continue}switch(avcStream[i]&31){case 6:var data=avcStream.subarray(i+1,i+1+length);var matchingSample=mapToSample(i,samples);seiNal={nalUnitType:"sei_rbsp",size:length,data:data,escapedRBSP:discardEmulationPreventionBytes(data),trackId:trackId};if(matchingSample){seiNal.pts=matchingSample.pts;seiNal.dts=matchingSample.dts;lastMatchedSample=matchingSample;}else if(lastMatchedSample){seiNal.pts=lastMatchedSample.pts;seiNal.dts=lastMatchedSample.dts;}else {result.logs.push({level:"warn",message:"We've encountered a nal unit without data at "+i+" for trackId "+trackId+". See mux.js#223."});break}result.seiNals.push(seiNal);break}}return result};var parseSamples=function parseSamples(truns,baseMediaDecodeTime,tfhd){var currentDts=baseMediaDecodeTime;var defaultSampleDuration=tfhd.defaultSampleDuration||0;var defaultSampleSize=tfhd.defaultSampleSize||0;var trackId=tfhd.trackId;var allSamples=[];truns.forEach(function(trun){var trackRun=parseTrun(trun);var samples=trackRun.samples;samples.forEach(function(sample){if(sample.duration===undefined){sample.duration=defaultSampleDuration;}if(sample.size===undefined){sample.size=defaultSampleSize;}sample.trackId=trackId;sample.dts=currentDts;if(sample.compositionTimeOffset===undefined){sample.compositionTimeOffset=0;}if(typeof currentDts==="bigint"){sample.pts=currentDts+window_1.BigInt(sample.compositionTimeOffset);currentDts+=window_1.BigInt(sample.duration);}else {sample.pts=currentDts+sample.compositionTimeOffset;currentDts+=sample.duration;}});allSamples=allSamples.concat(samples);});return allSamples};var parseCaptionNals=function parseCaptionNals(segment,videoTrackId){var trafs=findBox_1(segment,["moof","traf"]);var mdats=findBox_1(segment,["mdat"]);var captionNals={};var mdatTrafPairs=[];mdats.forEach(function(mdat,index){var matchingTraf=trafs[index];mdatTrafPairs.push({mdat:mdat,traf:matchingTraf});});mdatTrafPairs.forEach(function(pair){var mdat=pair.mdat;var traf=pair.traf;var tfhd=findBox_1(traf,["tfhd"]);var headerInfo=parseTfhd(tfhd[0]);var trackId=headerInfo.trackId;var tfdt=findBox_1(traf,["tfdt"]);var baseMediaDecodeTime=tfdt.length>0?parseTfdt(tfdt[0]).baseMediaDecodeTime:0;var truns=findBox_1(traf,["trun"]);var samples;var result;if(videoTrackId===trackId&&truns.length>0){samples=parseSamples(truns,baseMediaDecodeTime,headerInfo);result=findSeiNals(mdat,samples,trackId);if(!captionNals[trackId]){captionNals[trackId]={seiNals:[],logs:[]};}captionNals[trackId].seiNals=captionNals[trackId].seiNals.concat(result.seiNals);captionNals[trackId].logs=captionNals[trackId].logs.concat(result.logs);}});return captionNals};var parseEmbeddedCaptions=function parseEmbeddedCaptions(segment,trackId,timescale){var captionNals;if(trackId===null){return null}captionNals=parseCaptionNals(segment,trackId);var trackNals=captionNals[trackId]||{};return {seiNals:trackNals.seiNals,logs:trackNals.logs,timescale:timescale}};var CaptionParser=function CaptionParser(){var isInitialized=false;var captionStream;var segmentCache;var trackId;var timescale;var parsedCaptions;var parsingPartial;this.isInitialized=function(){return isInitialized};this.init=function(options){captionStream=new CaptionStream;isInitialized=true;parsingPartial=options?options.isPartial:false;captionStream.on("data",function(event){event.startTime=event.startPts/timescale;event.endTime=event.endPts/timescale;parsedCaptions.captions.push(event);parsedCaptions.captionStreams[event.stream]=true;});captionStream.on("log",function(log){parsedCaptions.logs.push(log);});};this.isNewInit=function(videoTrackIds,timescales){if(videoTrackIds&&videoTrackIds.length===0||timescales&&typeof timescales==="object"&&Object.keys(timescales).length===0){return false}return trackId!==videoTrackIds[0]||timescale!==timescales[trackId]};this.parse=function(segment,videoTrackIds,timescales){var parsedData;if(!this.isInitialized()){return null}else if(!videoTrackIds||!timescales){return null}else if(this.isNewInit(videoTrackIds,timescales)){trackId=videoTrackIds[0];timescale=timescales[trackId];}else if(trackId===null||!timescale){segmentCache.push(segment);return null}while(segmentCache.length>0){var cachedSegment=segmentCache.shift();this.parse(cachedSegment,videoTrackIds,timescales);}parsedData=parseEmbeddedCaptions(segment,trackId,timescale);if(parsedData&&parsedData.logs){parsedCaptions.logs=parsedCaptions.logs.concat(parsedData.logs);}if(parsedData===null||!parsedData.seiNals){if(parsedCaptions.logs.length){return {logs:parsedCaptions.logs,captions:[],captionStreams:[]}}return null}this.pushNals(parsedData.seiNals);this.flushStream();return parsedCaptions};this.pushNals=function(nals){if(!this.isInitialized()||!nals||nals.length===0){return null}nals.forEach(function(nal){captionStream.push(nal);});};this.flushStream=function(){if(!this.isInitialized()){return null}if(!parsingPartial){captionStream.flush();}else {captionStream.partialFlush();}};this.clearParsedCaptions=function(){parsedCaptions.captions=[];parsedCaptions.captionStreams={};parsedCaptions.logs=[];};this.resetCaptionStream=function(){if(!this.isInitialized()){return null}captionStream.reset();};this.clearAllCaptions=function(){this.clearParsedCaptions();this.resetCaptionStream();};this.reset=function(){segmentCache=[];trackId=null;timescale=null;if(!parsedCaptions){parsedCaptions={captions:[],captionStreams:{},logs:[]};}else {this.clearParsedCaptions();}this.resetCaptionStream();};this.reset();};var captionParser=CaptionParser;var toUnsigned=bin.toUnsigned;var toHexString=bin.toHexString;var getUint64=numbers.getUint64;var timescale,startTime,compositionStartTime,getVideoTrackIds,getTracks,getTimescaleFromMediaHeader;timescale=function timescale(init){var result={},traks=findBox_1(init,["moov","trak"]);return traks.reduce(function(result,trak){var tkhd,version,index,id,mdhd;tkhd=findBox_1(trak,["tkhd"])[0];if(!tkhd){return null}version=tkhd[0];index=version===0?12:20;id=toUnsigned(tkhd[index]<<24|tkhd[index+1]<<16|tkhd[index+2]<<8|tkhd[index+3]);mdhd=findBox_1(trak,["mdia","mdhd"])[0];if(!mdhd){return null}version=mdhd[0];index=version===0?12:20;result[id]=toUnsigned(mdhd[index]<<24|mdhd[index+1]<<16|mdhd[index+2]<<8|mdhd[index+3]);return result},result)};startTime=function startTime(timescale,fragment){var trafs;trafs=findBox_1(fragment,["moof","traf"]);var lowestTime=trafs.reduce(function(acc,traf){var tfhd=findBox_1(traf,["tfhd"])[0];var id=toUnsigned(tfhd[4]<<24|tfhd[5]<<16|tfhd[6]<<8|tfhd[7]);var scale=timescale[id]||9e4;var tfdt=findBox_1(traf,["tfdt"])[0];var dv=new DataView(tfdt.buffer,tfdt.byteOffset,tfdt.byteLength);var baseTime;if(tfdt[0]===1){baseTime=getUint64(tfdt.subarray(4,12));}else {baseTime=dv.getUint32(4);}var seconds;if(typeof baseTime==="bigint"){seconds=baseTime/window_1.BigInt(scale);}else if(typeof baseTime==="number"&&!isNaN(baseTime)){seconds=baseTime/scale;}if(seconds<Number.MAX_SAFE_INTEGER){seconds=Number(seconds);}if(seconds<acc){acc=seconds;}return acc},Infinity);return typeof lowestTime==="bigint"||isFinite(lowestTime)?lowestTime:0};compositionStartTime=function compositionStartTime(timescales,fragment){var trafBoxes=findBox_1(fragment,["moof","traf"]);var baseMediaDecodeTime=0;var compositionTimeOffset=0;var trackId;if(trafBoxes&&trafBoxes.length){var tfhd=findBox_1(trafBoxes[0],["tfhd"])[0];var trun=findBox_1(trafBoxes[0],["trun"])[0];var tfdt=findBox_1(trafBoxes[0],["tfdt"])[0];if(tfhd){var parsedTfhd=parseTfhd(tfhd);trackId=parsedTfhd.trackId;}if(tfdt){var parsedTfdt=parseTfdt(tfdt);baseMediaDecodeTime=parsedTfdt.baseMediaDecodeTime;}if(trun){var parsedTrun=parseTrun(trun);if(parsedTrun.samples&&parsedTrun.samples.length){compositionTimeOffset=parsedTrun.samples[0].compositionTimeOffset||0;}}}var timescale=timescales[trackId]||9e4;if(typeof baseMediaDecodeTime==="bigint"){compositionTimeOffset=window_1.BigInt(compositionTimeOffset);timescale=window_1.BigInt(timescale);}var result=(baseMediaDecodeTime+compositionTimeOffset)/timescale;if(typeof result==="bigint"&&result<Number.MAX_SAFE_INTEGER){result=Number(result);}return result};getVideoTrackIds=function getVideoTrackIds(init){var traks=findBox_1(init,["moov","trak"]);var videoTrackIds=[];traks.forEach(function(trak){var hdlrs=findBox_1(trak,["mdia","hdlr"]);var tkhds=findBox_1(trak,["tkhd"]);hdlrs.forEach(function(hdlr,index){var handlerType=parseType_1(hdlr.subarray(8,12));var tkhd=tkhds[index];var view;var version;var trackId;if(handlerType==="vide"){view=new DataView(tkhd.buffer,tkhd.byteOffset,tkhd.byteLength);version=view.getUint8(0);trackId=version===0?view.getUint32(12):view.getUint32(20);videoTrackIds.push(trackId);}});});return videoTrackIds};getTimescaleFromMediaHeader=function getTimescaleFromMediaHeader(mdhd){var version=mdhd[0];var index=version===0?12:20;return toUnsigned(mdhd[index]<<24|mdhd[index+1]<<16|mdhd[index+2]<<8|mdhd[index+3])};getTracks=function getTracks(init){var traks=findBox_1(init,["moov","trak"]);var tracks=[];traks.forEach(function(trak){var track={};var tkhd=findBox_1(trak,["tkhd"])[0];var view,tkhdVersion;if(tkhd){view=new DataView(tkhd.buffer,tkhd.byteOffset,tkhd.byteLength);tkhdVersion=view.getUint8(0);track.id=tkhdVersion===0?view.getUint32(12):view.getUint32(20);}var hdlr=findBox_1(trak,["mdia","hdlr"])[0];if(hdlr){var type=parseType_1(hdlr.subarray(8,12));if(type==="vide"){track.type="video";}else if(type==="soun"){track.type="audio";}else {track.type=type;}}var stsd=findBox_1(trak,["mdia","minf","stbl","stsd"])[0];if(stsd){var sampleDescriptions=stsd.subarray(8);track.codec=parseType_1(sampleDescriptions.subarray(4,8));var codecBox=findBox_1(sampleDescriptions,[track.codec])[0];var codecConfig,codecConfigType;if(codecBox){if(/^[asm]vc[1-9]$/i.test(track.codec)){codecConfig=codecBox.subarray(78);codecConfigType=parseType_1(codecConfig.subarray(4,8));if(codecConfigType==="avcC"&&codecConfig.length>11){track.codec+=".";track.codec+=toHexString(codecConfig[9]);track.codec+=toHexString(codecConfig[10]);track.codec+=toHexString(codecConfig[11]);}else {track.codec="avc1.4d400d";}}else if(/^mp4[a,v]$/i.test(track.codec)){codecConfig=codecBox.subarray(28);codecConfigType=parseType_1(codecConfig.subarray(4,8));if(codecConfigType==="esds"&&codecConfig.length>20&&codecConfig[19]!==0){track.codec+="."+toHexString(codecConfig[19]);track.codec+="."+toHexString(codecConfig[20]>>>2&63).replace(/^0/,"");}else {track.codec="mp4a.40.2";}}else {track.codec=track.codec.toLowerCase();}}}var mdhd=findBox_1(trak,["mdia","mdhd"])[0];if(mdhd){track.timescale=getTimescaleFromMediaHeader(mdhd);}tracks.push(track);});return tracks};var probe$2={findBox:findBox_1,parseType:parseType_1,timescale:timescale,startTime:startTime,compositionStartTime:compositionStartTime,videoTrackIds:getVideoTrackIds,tracks:getTracks,getTimescaleFromMediaHeader:getTimescaleFromMediaHeader};var parsePid=function parsePid(packet){var pid=packet[1]&31;pid<<=8;pid|=packet[2];return pid};var parsePayloadUnitStartIndicator=function parsePayloadUnitStartIndicator(packet){return !!(packet[1]&64)};var parseAdaptionField=function parseAdaptionField(packet){var offset=0;if((packet[3]&48)>>>4>1){offset+=packet[4]+1;}return offset};var parseType=function parseType(packet,pmtPid){var pid=parsePid(packet);if(pid===0){return "pat"}else if(pid===pmtPid){return "pmt"}else if(pmtPid){return "pes"}return null};var parsePat=function parsePat(packet){var pusi=parsePayloadUnitStartIndicator(packet);var offset=4+parseAdaptionField(packet);if(pusi){offset+=packet[offset]+1;}return (packet[offset+10]&31)<<8|packet[offset+11]};var parsePmt=function parsePmt(packet){var programMapTable={};var pusi=parsePayloadUnitStartIndicator(packet);var payloadOffset=4+parseAdaptionField(packet);if(pusi){payloadOffset+=packet[payloadOffset]+1;}if(!(packet[payloadOffset+5]&1)){return}var sectionLength,tableEnd,programInfoLength;sectionLength=(packet[payloadOffset+1]&15)<<8|packet[payloadOffset+2];tableEnd=3+sectionLength-4;programInfoLength=(packet[payloadOffset+10]&15)<<8|packet[payloadOffset+11];var offset=12+programInfoLength;while(offset<tableEnd){var i=payloadOffset+offset;programMapTable[(packet[i+1]&31)<<8|packet[i+2]]=packet[i];offset+=((packet[i+3]&15)<<8|packet[i+4])+5;}return programMapTable};var parsePesType=function parsePesType(packet,programMapTable){var pid=parsePid(packet);var type=programMapTable[pid];switch(type){case streamTypes.H264_STREAM_TYPE:return "video";case streamTypes.ADTS_STREAM_TYPE:return "audio";case streamTypes.METADATA_STREAM_TYPE:return "timed-metadata";default:return null}};var parsePesTime=function parsePesTime(packet){var pusi=parsePayloadUnitStartIndicator(packet);if(!pusi){return null}var offset=4+parseAdaptionField(packet);if(offset>=packet.byteLength){return null}var pes=null;var ptsDtsFlags;ptsDtsFlags=packet[offset+7];if(ptsDtsFlags&192){pes={};pes.pts=(packet[offset+9]&14)<<27|(packet[offset+10]&255)<<20|(packet[offset+11]&254)<<12|(packet[offset+12]&255)<<5|(packet[offset+13]&254)>>>3;pes.pts*=4;pes.pts+=(packet[offset+13]&6)>>>1;pes.dts=pes.pts;if(ptsDtsFlags&64){pes.dts=(packet[offset+14]&14)<<27|(packet[offset+15]&255)<<20|(packet[offset+16]&254)<<12|(packet[offset+17]&255)<<5|(packet[offset+18]&254)>>>3;pes.dts*=4;pes.dts+=(packet[offset+18]&6)>>>1;}}return pes};var parseNalUnitType=function parseNalUnitType(type){switch(type){case 5:return "slice_layer_without_partitioning_rbsp_idr";case 6:return "sei_rbsp";case 7:return "seq_parameter_set_rbsp";case 8:return "pic_parameter_set_rbsp";case 9:return "access_unit_delimiter_rbsp";default:return null}};var videoPacketContainsKeyFrame=function videoPacketContainsKeyFrame(packet){var offset=4+parseAdaptionField(packet);var frameBuffer=packet.subarray(offset);var frameI=0;var frameSyncPoint=0;var foundKeyFrame=false;var nalType;for(;frameSyncPoint<frameBuffer.byteLength-3;frameSyncPoint++){if(frameBuffer[frameSyncPoint+2]===1){frameI=frameSyncPoint+5;break}}while(frameI<frameBuffer.byteLength){switch(frameBuffer[frameI]){case 0:if(frameBuffer[frameI-1]!==0){frameI+=2;break}else if(frameBuffer[frameI-2]!==0){frameI++;break}if(frameSyncPoint+3!==frameI-2){nalType=parseNalUnitType(frameBuffer[frameSyncPoint+3]&31);if(nalType==="slice_layer_without_partitioning_rbsp_idr"){foundKeyFrame=true;}}do{frameI++;}while(frameBuffer[frameI]!==1&&frameI<frameBuffer.length);frameSyncPoint=frameI-2;frameI+=3;break;case 1:if(frameBuffer[frameI-1]!==0||frameBuffer[frameI-2]!==0){frameI+=3;break}nalType=parseNalUnitType(frameBuffer[frameSyncPoint+3]&31);if(nalType==="slice_layer_without_partitioning_rbsp_idr"){foundKeyFrame=true;}frameSyncPoint=frameI-2;frameI+=3;break;default:frameI+=3;break}}frameBuffer=frameBuffer.subarray(frameSyncPoint);frameI-=frameSyncPoint;frameSyncPoint=0;if(frameBuffer&&frameBuffer.byteLength>3){nalType=parseNalUnitType(frameBuffer[frameSyncPoint+3]&31);if(nalType==="slice_layer_without_partitioning_rbsp_idr"){foundKeyFrame=true;}}return foundKeyFrame};var probe$1={parseType:parseType,parsePat:parsePat,parsePmt:parsePmt,parsePayloadUnitStartIndicator:parsePayloadUnitStartIndicator,parsePesType:parsePesType,parsePesTime:parsePesTime,videoPacketContainsKeyFrame:videoPacketContainsKeyFrame};var handleRollover=timestampRolloverStream.handleRollover;var probe={};probe.ts=probe$1;probe.aac=utils;var ONE_SECOND_IN_TS=clock.ONE_SECOND_IN_TS;var MP2T_PACKET_LENGTH=188,SYNC_BYTE=71;var parsePsi_=function parsePsi_(bytes,pmt){var startIndex=0,endIndex=MP2T_PACKET_LENGTH,packet,type;while(endIndex<bytes.byteLength){if(bytes[startIndex]===SYNC_BYTE&&bytes[endIndex]===SYNC_BYTE){packet=bytes.subarray(startIndex,endIndex);type=probe.ts.parseType(packet,pmt.pid);switch(type){case"pat":pmt.pid=probe.ts.parsePat(packet);break;case"pmt":var table=probe.ts.parsePmt(packet);pmt.table=pmt.table||{};Object.keys(table).forEach(function(key){pmt.table[key]=table[key];});break}startIndex+=MP2T_PACKET_LENGTH;endIndex+=MP2T_PACKET_LENGTH;continue}startIndex++;endIndex++;}};var parseAudioPes_=function parseAudioPes_(bytes,pmt,result){var startIndex=0,endIndex=MP2T_PACKET_LENGTH,packet,type,pesType,pusi,parsed;var endLoop=false;while(endIndex<=bytes.byteLength){if(bytes[startIndex]===SYNC_BYTE&&(bytes[endIndex]===SYNC_BYTE||endIndex===bytes.byteLength)){packet=bytes.subarray(startIndex,endIndex);type=probe.ts.parseType(packet,pmt.pid);switch(type){case"pes":pesType=probe.ts.parsePesType(packet,pmt.table);pusi=probe.ts.parsePayloadUnitStartIndicator(packet);if(pesType==="audio"&&pusi){parsed=probe.ts.parsePesTime(packet);if(parsed){parsed.type="audio";result.audio.push(parsed);endLoop=true;}}break}if(endLoop){break}startIndex+=MP2T_PACKET_LENGTH;endIndex+=MP2T_PACKET_LENGTH;continue}startIndex++;endIndex++;}endIndex=bytes.byteLength;startIndex=endIndex-MP2T_PACKET_LENGTH;endLoop=false;while(startIndex>=0){if(bytes[startIndex]===SYNC_BYTE&&(bytes[endIndex]===SYNC_BYTE||endIndex===bytes.byteLength)){packet=bytes.subarray(startIndex,endIndex);type=probe.ts.parseType(packet,pmt.pid);switch(type){case"pes":pesType=probe.ts.parsePesType(packet,pmt.table);pusi=probe.ts.parsePayloadUnitStartIndicator(packet);if(pesType==="audio"&&pusi){parsed=probe.ts.parsePesTime(packet);if(parsed){parsed.type="audio";result.audio.push(parsed);endLoop=true;}}break}if(endLoop){break}startIndex-=MP2T_PACKET_LENGTH;endIndex-=MP2T_PACKET_LENGTH;continue}startIndex--;endIndex--;}};var parseVideoPes_=function parseVideoPes_(bytes,pmt,result){var startIndex=0,endIndex=MP2T_PACKET_LENGTH,packet,type,pesType,pusi,parsed,frame,i,pes;var endLoop=false;var currentFrame={data:[],size:0};while(endIndex<bytes.byteLength){if(bytes[startIndex]===SYNC_BYTE&&bytes[endIndex]===SYNC_BYTE){packet=bytes.subarray(startIndex,endIndex);type=probe.ts.parseType(packet,pmt.pid);switch(type){case"pes":pesType=probe.ts.parsePesType(packet,pmt.table);pusi=probe.ts.parsePayloadUnitStartIndicator(packet);if(pesType==="video"){if(pusi&&!endLoop){parsed=probe.ts.parsePesTime(packet);if(parsed){parsed.type="video";result.video.push(parsed);endLoop=true;}}if(!result.firstKeyFrame){if(pusi){if(currentFrame.size!==0){frame=new Uint8Array(currentFrame.size);i=0;while(currentFrame.data.length){pes=currentFrame.data.shift();frame.set(pes,i);i+=pes.byteLength;}if(probe.ts.videoPacketContainsKeyFrame(frame)){var firstKeyFrame=probe.ts.parsePesTime(frame);if(firstKeyFrame){result.firstKeyFrame=firstKeyFrame;result.firstKeyFrame.type="video";}else {console.warn("Failed to extract PTS/DTS from PES at first keyframe. "+"This could be an unusual TS segment, or else mux.js did not "+"parse your TS segment correctly. If you know your TS "+"segments do contain PTS/DTS on keyframes please file a bug "+"report! You can try ffprobe to double check for yourself.");}}currentFrame.size=0;}}currentFrame.data.push(packet);currentFrame.size+=packet.byteLength;}}break}if(endLoop&&result.firstKeyFrame){break}startIndex+=MP2T_PACKET_LENGTH;endIndex+=MP2T_PACKET_LENGTH;continue}startIndex++;endIndex++;}endIndex=bytes.byteLength;startIndex=endIndex-MP2T_PACKET_LENGTH;endLoop=false;while(startIndex>=0){if(bytes[startIndex]===SYNC_BYTE&&bytes[endIndex]===SYNC_BYTE){packet=bytes.subarray(startIndex,endIndex);type=probe.ts.parseType(packet,pmt.pid);switch(type){case"pes":pesType=probe.ts.parsePesType(packet,pmt.table);pusi=probe.ts.parsePayloadUnitStartIndicator(packet);if(pesType==="video"&&pusi){parsed=probe.ts.parsePesTime(packet);if(parsed){parsed.type="video";result.video.push(parsed);endLoop=true;}}break}if(endLoop){break}startIndex-=MP2T_PACKET_LENGTH;endIndex-=MP2T_PACKET_LENGTH;continue}startIndex--;endIndex--;}};var adjustTimestamp_=function adjustTimestamp_(segmentInfo,baseTimestamp){if(segmentInfo.audio&&segmentInfo.audio.length){var audioBaseTimestamp=baseTimestamp;if(typeof audioBaseTimestamp==="undefined"||isNaN(audioBaseTimestamp)){audioBaseTimestamp=segmentInfo.audio[0].dts;}segmentInfo.audio.forEach(function(info){info.dts=handleRollover(info.dts,audioBaseTimestamp);info.pts=handleRollover(info.pts,audioBaseTimestamp);info.dtsTime=info.dts/ONE_SECOND_IN_TS;info.ptsTime=info.pts/ONE_SECOND_IN_TS;});}if(segmentInfo.video&&segmentInfo.video.length){var videoBaseTimestamp=baseTimestamp;if(typeof videoBaseTimestamp==="undefined"||isNaN(videoBaseTimestamp)){videoBaseTimestamp=segmentInfo.video[0].dts;}segmentInfo.video.forEach(function(info){info.dts=handleRollover(info.dts,videoBaseTimestamp);info.pts=handleRollover(info.pts,videoBaseTimestamp);info.dtsTime=info.dts/ONE_SECOND_IN_TS;info.ptsTime=info.pts/ONE_SECOND_IN_TS;});if(segmentInfo.firstKeyFrame){var frame=segmentInfo.firstKeyFrame;frame.dts=handleRollover(frame.dts,videoBaseTimestamp);frame.pts=handleRollover(frame.pts,videoBaseTimestamp);frame.dtsTime=frame.dts/ONE_SECOND_IN_TS;frame.ptsTime=frame.pts/ONE_SECOND_IN_TS;}}};var inspectAac_=function inspectAac_(bytes){var endLoop=false,audioCount=0,sampleRate=null,timestamp=null,frameSize=0,byteIndex=0,packet;while(bytes.length-byteIndex>=3){var type=probe.aac.parseType(bytes,byteIndex);switch(type){case"timed-metadata":if(bytes.length-byteIndex<10){endLoop=true;break}frameSize=probe.aac.parseId3TagSize(bytes,byteIndex);if(frameSize>bytes.length){endLoop=true;break}if(timestamp===null){packet=bytes.subarray(byteIndex,byteIndex+frameSize);timestamp=probe.aac.parseAacTimestamp(packet);}byteIndex+=frameSize;break;case"audio":if(bytes.length-byteIndex<7){endLoop=true;break}frameSize=probe.aac.parseAdtsSize(bytes,byteIndex);if(frameSize>bytes.length){endLoop=true;break}if(sampleRate===null){packet=bytes.subarray(byteIndex,byteIndex+frameSize);sampleRate=probe.aac.parseSampleRate(packet);}audioCount++;byteIndex+=frameSize;break;default:byteIndex++;break}if(endLoop){return null}}if(sampleRate===null||timestamp===null){return null}var audioTimescale=ONE_SECOND_IN_TS/sampleRate;var result={audio:[{type:"audio",dts:timestamp,pts:timestamp},{type:"audio",dts:timestamp+audioCount*1024*audioTimescale,pts:timestamp+audioCount*1024*audioTimescale}]};return result};var inspectTs_=function inspectTs_(bytes){var pmt={pid:null,table:null};var result={};parsePsi_(bytes,pmt);for(var pid in pmt.table){if(pmt.table.hasOwnProperty(pid)){var type=pmt.table[pid];switch(type){case streamTypes.H264_STREAM_TYPE:result.video=[];parseVideoPes_(bytes,pmt,result);if(result.video.length===0){delete result.video;}break;case streamTypes.ADTS_STREAM_TYPE:result.audio=[];parseAudioPes_(bytes,pmt,result);if(result.audio.length===0){delete result.audio;}break}}}return result};var inspect=function inspect(bytes,baseTimestamp){var isAacData=probe.aac.isLikelyAacData(bytes);var result;if(isAacData){result=inspectAac_(bytes);}else {result=inspectTs_(bytes);}if(!result||!result.audio&&!result.video){return null}adjustTimestamp_(result,baseTimestamp);return result};var tsInspector={inspect:inspect,parseAudioPes_:parseAudioPes_};var wireTransmuxerEvents=function wireTransmuxerEvents(self1,transmuxer){transmuxer.on("data",function(segment){var initArray=segment.initSegment;segment.initSegment={data:initArray.buffer,byteOffset:initArray.byteOffset,byteLength:initArray.byteLength};var typedArray=segment.data;segment.data=typedArray.buffer;self1.postMessage({action:"data",segment:segment,byteOffset:typedArray.byteOffset,byteLength:typedArray.byteLength},[segment.data]);});transmuxer.on("done",function(data){self1.postMessage({action:"done"});});transmuxer.on("gopInfo",function(gopInfo){self1.postMessage({action:"gopInfo",gopInfo:gopInfo});});transmuxer.on("videoSegmentTimingInfo",function(timingInfo){var videoSegmentTimingInfo={start:{decode:clock.videoTsToSeconds(timingInfo.start.dts),presentation:clock.videoTsToSeconds(timingInfo.start.pts)},end:{decode:clock.videoTsToSeconds(timingInfo.end.dts),presentation:clock.videoTsToSeconds(timingInfo.end.pts)},baseMediaDecodeTime:clock.videoTsToSeconds(timingInfo.baseMediaDecodeTime)};if(timingInfo.prependedContentDuration){videoSegmentTimingInfo.prependedContentDuration=clock.videoTsToSeconds(timingInfo.prependedContentDuration);}self1.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:videoSegmentTimingInfo});});transmuxer.on("audioSegmentTimingInfo",function(timingInfo){var audioSegmentTimingInfo={start:{decode:clock.videoTsToSeconds(timingInfo.start.dts),presentation:clock.videoTsToSeconds(timingInfo.start.pts)},end:{decode:clock.videoTsToSeconds(timingInfo.end.dts),presentation:clock.videoTsToSeconds(timingInfo.end.pts)},baseMediaDecodeTime:clock.videoTsToSeconds(timingInfo.baseMediaDecodeTime)};if(timingInfo.prependedContentDuration){audioSegmentTimingInfo.prependedContentDuration=clock.videoTsToSeconds(timingInfo.prependedContentDuration);}self1.postMessage({action:"audioSegmentTimingInfo",audioSegmentTimingInfo:audioSegmentTimingInfo});});transmuxer.on("id3Frame",function(id3Frame){self1.postMessage({action:"id3Frame",id3Frame:id3Frame});});transmuxer.on("caption",function(caption){self1.postMessage({action:"caption",caption:caption});});transmuxer.on("trackinfo",function(trackInfo){self1.postMessage({action:"trackinfo",trackInfo:trackInfo});});transmuxer.on("audioTimingInfo",function(audioTimingInfo){self1.postMessage({action:"audioTimingInfo",audioTimingInfo:{start:clock.videoTsToSeconds(audioTimingInfo.start),end:clock.videoTsToSeconds(audioTimingInfo.end)}});});transmuxer.on("videoTimingInfo",function(videoTimingInfo){self1.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:clock.videoTsToSeconds(videoTimingInfo.start),end:clock.videoTsToSeconds(videoTimingInfo.end)}});});transmuxer.on("log",function(log){self1.postMessage({action:"log",log:log});});};var MessageHandlers=function(){function MessageHandlers(self1,options){this.options=options||{};this.self=self1;this.init();}var _proto=MessageHandlers.prototype;_proto.init=function init(){if(this.transmuxer){this.transmuxer.dispose();}this.transmuxer=new transmuxer.Transmuxer(this.options);wireTransmuxerEvents(this.self,this.transmuxer);};_proto.pushMp4Captions=function pushMp4Captions(data){if(!this.captionParser){this.captionParser=new captionParser;this.captionParser.init();}var segment=new Uint8Array(data.data,data.byteOffset,data.byteLength);var parsed=this.captionParser.parse(segment,data.trackIds,data.timescales);this.self.postMessage({action:"mp4Captions",captions:parsed&&parsed.captions||[],logs:parsed&&parsed.logs||[],data:segment.buffer},[segment.buffer]);};_proto.probeMp4StartTime=function probeMp4StartTime(_ref){var timescales=_ref.timescales,data=_ref.data;var startTime=probe$2.startTime(timescales,data);this.self.postMessage({action:"probeMp4StartTime",startTime:startTime,data:data},[data.buffer]);};_proto.probeMp4Tracks=function probeMp4Tracks(_ref2){var data=_ref2.data;var tracks=probe$2.tracks(data);this.self.postMessage({action:"probeMp4Tracks",tracks:tracks,data:data},[data.buffer]);};_proto.probeTs=function probeTs(_ref3){var data=_ref3.data,baseStartTime=_ref3.baseStartTime;var tsStartTime=typeof baseStartTime==="number"&&!isNaN(baseStartTime)?baseStartTime*clock.ONE_SECOND_IN_TS:void 0;var timeInfo=tsInspector.inspect(data,tsStartTime);var result=null;if(timeInfo){result={hasVideo:timeInfo.video&&timeInfo.video.length===2||false,hasAudio:timeInfo.audio&&timeInfo.audio.length===2||false};if(result.hasVideo){result.videoStart=timeInfo.video[0].ptsTime;}if(result.hasAudio){result.audioStart=timeInfo.audio[0].ptsTime;}}this.self.postMessage({action:"probeTs",result:result,data:data},[data.buffer]);};_proto.clearAllMp4Captions=function clearAllMp4Captions(){if(this.captionParser){this.captionParser.clearAllCaptions();}};_proto.clearParsedMp4Captions=function clearParsedMp4Captions(){if(this.captionParser){this.captionParser.clearParsedCaptions();}};_proto.push=function push(data){var segment=new Uint8Array(data.data,data.byteOffset,data.byteLength);this.transmuxer.push(segment);};_proto.reset=function reset(){this.transmuxer.reset();};_proto.setTimestampOffset=function setTimestampOffset(data){var timestampOffset=data.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(clock.secondsToVideoTs(timestampOffset)));};_proto.setAudioAppendStart=function setAudioAppendStart(data){this.transmuxer.setAudioAppendStart(Math.ceil(clock.secondsToVideoTs(data.appendStart)));};_proto.setRemux=function setRemux(data){this.transmuxer.setRemux(data.remux);};_proto.flush=function flush(data){this.transmuxer.flush();self.postMessage({action:"done",type:"transmuxed"});};_proto.endTimeline=function endTimeline(){this.transmuxer.endTimeline();self.postMessage({action:"endedtimeline",type:"transmuxed"});};_proto.alignGopsWith=function alignGopsWith(data){this.transmuxer.alignGopsWith(data.gopsToAlignWith.slice());};return MessageHandlers}();self.onmessage=function(event){if(event.data.action==="init"&&event.data.options){this.messageHandlers=new MessageHandlers(self,event.data.options);return}if(!this.messageHandlers){this.messageHandlers=new MessageHandlers(self);}if(event.data&&event.data.action&&event.data.action!=="init"){if(this.messageHandlers[event.data.action]){this.messageHandlers[event.data.action](event.data);}}};}));var TransmuxWorker=factory(workerCode$1);var handleData_=function handleData_(event,transmuxedData,callback){var _event$data$segment=event.data.segment,type=_event$data$segment.type,initSegment=_event$data$segment.initSegment,captions=_event$data$segment.captions,captionStreams=_event$data$segment.captionStreams,metadata=_event$data$segment.metadata,videoFrameDtsTime=_event$data$segment.videoFrameDtsTime,videoFramePtsTime=_event$data$segment.videoFramePtsTime;transmuxedData.buffer.push({captions:captions,captionStreams:captionStreams,metadata:metadata});var boxes=event.data.segment.boxes||{data:event.data.segment.data};var result={type:type,data:new Uint8Array(boxes.data,boxes.data.byteOffset,boxes.data.byteLength),initSegment:new Uint8Array(initSegment.data,initSegment.byteOffset,initSegment.byteLength)};if(typeof videoFrameDtsTime!=="undefined"){result.videoFrameDtsTime=videoFrameDtsTime;}if(typeof videoFramePtsTime!=="undefined"){result.videoFramePtsTime=videoFramePtsTime;}callback(result);};var handleDone_=function handleDone_(_ref){var transmuxedData=_ref.transmuxedData,callback=_ref.callback;transmuxedData.buffer=[];callback(transmuxedData);};var handleGopInfo_=function handleGopInfo_(event,transmuxedData){transmuxedData.gopInfo=event.data.gopInfo;};var processTransmux=function processTransmux(options){var transmuxer=options.transmuxer,bytes=options.bytes,audioAppendStart=options.audioAppendStart,gopsToAlignWith=options.gopsToAlignWith,remux=options.remux,onData=options.onData,onTrackInfo=options.onTrackInfo,onAudioTimingInfo=options.onAudioTimingInfo,onVideoTimingInfo=options.onVideoTimingInfo,onVideoSegmentTimingInfo=options.onVideoSegmentTimingInfo,onAudioSegmentTimingInfo=options.onAudioSegmentTimingInfo,onId3=options.onId3,onCaptions=options.onCaptions,onDone=options.onDone,onEndedTimeline=options.onEndedTimeline,onTransmuxerLog=options.onTransmuxerLog,isEndOfTimeline=options.isEndOfTimeline;var transmuxedData={buffer:[]};var waitForEndedTimelineEvent=isEndOfTimeline;var handleMessage=function handleMessage(event){if(transmuxer.currentTransmux!==options){return}if(event.data.action==="data"){handleData_(event,transmuxedData,onData);}if(event.data.action==="trackinfo"){onTrackInfo(event.data.trackInfo);}if(event.data.action==="gopInfo"){handleGopInfo_(event,transmuxedData);}if(event.data.action==="audioTimingInfo"){onAudioTimingInfo(event.data.audioTimingInfo);}if(event.data.action==="videoTimingInfo"){onVideoTimingInfo(event.data.videoTimingInfo);}if(event.data.action==="videoSegmentTimingInfo"){onVideoSegmentTimingInfo(event.data.videoSegmentTimingInfo);}if(event.data.action==="audioSegmentTimingInfo"){onAudioSegmentTimingInfo(event.data.audioSegmentTimingInfo);}if(event.data.action==="id3Frame"){onId3([event.data.id3Frame],event.data.id3Frame.dispatchType);}if(event.data.action==="caption"){onCaptions(event.data.caption);}if(event.data.action==="endedtimeline"){waitForEndedTimelineEvent=false;onEndedTimeline();}if(event.data.action==="log"){onTransmuxerLog(event.data.log);}if(event.data.type!=="transmuxed"){return}if(waitForEndedTimelineEvent){return}transmuxer.onmessage=null;handleDone_({transmuxedData:transmuxedData,callback:onDone});dequeue(transmuxer);};transmuxer.onmessage=handleMessage;if(audioAppendStart){transmuxer.postMessage({action:"setAudioAppendStart",appendStart:audioAppendStart});}if(Array.isArray(gopsToAlignWith)){transmuxer.postMessage({action:"alignGopsWith",gopsToAlignWith:gopsToAlignWith});}if(typeof remux!=="undefined"){transmuxer.postMessage({action:"setRemux",remux:remux});}if(bytes.byteLength){var buffer=bytes instanceof ArrayBuffer?bytes:bytes.buffer;var byteOffset=bytes instanceof ArrayBuffer?0:bytes.byteOffset;transmuxer.postMessage({action:"push",data:buffer,byteOffset:byteOffset,byteLength:bytes.byteLength},[buffer]);}if(isEndOfTimeline){transmuxer.postMessage({action:"endTimeline"});}transmuxer.postMessage({action:"flush"});};var dequeue=function dequeue(transmuxer){transmuxer.currentTransmux=null;if(transmuxer.transmuxQueue.length){transmuxer.currentTransmux=transmuxer.transmuxQueue.shift();if(typeof transmuxer.currentTransmux==="function"){transmuxer.currentTransmux();}else {processTransmux(transmuxer.currentTransmux);}}};var processAction=function processAction(transmuxer,action){transmuxer.postMessage({action:action});dequeue(transmuxer);};var enqueueAction=function enqueueAction(action,transmuxer){if(!transmuxer.currentTransmux){transmuxer.currentTransmux=action;processAction(transmuxer,action);return}transmuxer.transmuxQueue.push(processAction.bind(null,transmuxer,action));};var reset=function reset(transmuxer){enqueueAction("reset",transmuxer);};var endTimeline=function endTimeline(transmuxer){enqueueAction("endTimeline",transmuxer);};var transmux=function transmux(options){if(!options.transmuxer.currentTransmux){options.transmuxer.currentTransmux=options;processTransmux(options);return}options.transmuxer.transmuxQueue.push(options);};var createTransmuxer=function createTransmuxer(options){var transmuxer=new TransmuxWorker;transmuxer.currentTransmux=null;transmuxer.transmuxQueue=[];var term=transmuxer.terminate;transmuxer.terminate=function(){transmuxer.currentTransmux=null;transmuxer.transmuxQueue.length=0;return term.call(transmuxer)};transmuxer.postMessage({action:"init",options:options});return transmuxer};var segmentTransmuxer={reset:reset,endTimeline:endTimeline,transmux:transmux,createTransmuxer:createTransmuxer};var workerCallback=function workerCallback(options){var transmuxer=options.transmuxer;var endAction=options.endAction||options.action;var callback=options.callback;var message=_extends$3({},options,{endAction:null,transmuxer:null,callback:null});var listenForEndEvent=function listenForEndEvent(event){if(event.data.action!==endAction){return}transmuxer.removeEventListener("message",listenForEndEvent);if(event.data.data){event.data.data=new Uint8Array(event.data.data,options.byteOffset||0,options.byteLength||event.data.data.byteLength);if(options.data){options.data=event.data.data;}}callback(event.data);};transmuxer.addEventListener("message",listenForEndEvent);if(options.data){var isArrayBuffer=options.data instanceof ArrayBuffer;message.byteOffset=isArrayBuffer?0:options.data.byteOffset;message.byteLength=options.data.byteLength;var transfers=[isArrayBuffer?options.data:options.data.buffer];transmuxer.postMessage(message,transfers);}else {transmuxer.postMessage(message);}};var REQUEST_ERRORS={FAILURE:2,TIMEOUT:-101,ABORTED:-102};var abortAll=function abortAll(activeXhrs){activeXhrs.forEach(function(xhr){xhr.abort();});};var getRequestStats=function getRequestStats(request){return {bandwidth:request.bandwidth,bytesReceived:request.bytesReceived||0,roundTripTime:request.roundTripTime||0}};var getProgressStats=function getProgressStats(progressEvent){var request=progressEvent.target;var roundTripTime=Date.now()-request.requestTime;var stats={bandwidth:Infinity,bytesReceived:0,roundTripTime:roundTripTime||0};stats.bytesReceived=progressEvent.loaded;stats.bandwidth=Math.floor(stats.bytesReceived/stats.roundTripTime*8*1e3);return stats};var handleErrors=function handleErrors(error,request){if(request.timedout){return {status:request.status,message:"HLS request timed-out at URL: "+request.uri,code:REQUEST_ERRORS.TIMEOUT,xhr:request}}if(request.aborted){return {status:request.status,message:"HLS request aborted at URL: "+request.uri,code:REQUEST_ERRORS.ABORTED,xhr:request}}if(error){return {status:request.status,message:"HLS request errored at URL: "+request.uri,code:REQUEST_ERRORS.FAILURE,xhr:request}}if(request.responseType==="arraybuffer"&&request.response.byteLength===0){return {status:request.status,message:"Empty HLS response at URL: "+request.uri,code:REQUEST_ERRORS.FAILURE,xhr:request}}return null};var handleKeyResponse=function handleKeyResponse(segment,objects,finishProcessingFn){return function(error,request){var response=request.response;var errorObj=handleErrors(error,request);if(errorObj){return finishProcessingFn(errorObj,segment)}if(response.byteLength!==16){return finishProcessingFn({status:request.status,message:"Invalid HLS key at URL: "+request.uri,code:REQUEST_ERRORS.FAILURE,xhr:request},segment)}var view=new DataView(response);var bytes=new Uint32Array([view.getUint32(0),view.getUint32(4),view.getUint32(8),view.getUint32(12)]);for(var i=0;i<objects.length;i++){objects[i].bytes=bytes;}return finishProcessingFn(null,segment)}};var parseInitSegment=function parseInitSegment(segment,_callback){var type=detectContainerForBytes(segment.map.bytes);if(type!=="mp4"){var uri=segment.map.resolvedUri||segment.map.uri;return _callback({internal:true,message:"Found unsupported "+(type||"unknown")+" container for initialization segment at URL: "+uri,code:REQUEST_ERRORS.FAILURE})}workerCallback({action:"probeMp4Tracks",data:segment.map.bytes,transmuxer:segment.transmuxer,callback:function callback(_ref){var tracks=_ref.tracks,data=_ref.data;segment.map.bytes=data;tracks.forEach(function(track){segment.map.tracks=segment.map.tracks||{};if(segment.map.tracks[track.type]){return}segment.map.tracks[track.type]=track;if(typeof track.id==="number"&&track.timescale){segment.map.timescales=segment.map.timescales||{};segment.map.timescales[track.id]=track.timescale;}});return _callback(null)}});};var handleInitSegmentResponse=function handleInitSegmentResponse(_ref2){var segment=_ref2.segment,finishProcessingFn=_ref2.finishProcessingFn;return function(error,request){var errorObj=handleErrors(error,request);if(errorObj){return finishProcessingFn(errorObj,segment)}var bytes=new Uint8Array(request.response);if(segment.map.key){segment.map.encryptedBytes=bytes;return finishProcessingFn(null,segment)}segment.map.bytes=bytes;parseInitSegment(segment,function(parseError){if(parseError){parseError.xhr=request;parseError.status=request.status;return finishProcessingFn(parseError,segment)}finishProcessingFn(null,segment);});}};var handleSegmentResponse=function handleSegmentResponse(_ref3){var segment=_ref3.segment,finishProcessingFn=_ref3.finishProcessingFn,responseType=_ref3.responseType;return function(error,request){var errorObj=handleErrors(error,request);if(errorObj){return finishProcessingFn(errorObj,segment)}var newBytes=responseType==="arraybuffer"||!request.responseText?request.response:stringToArrayBuffer(request.responseText.substring(segment.lastReachedChar||0));segment.stats=getRequestStats(request);if(segment.key){segment.encryptedBytes=new Uint8Array(newBytes);}else {segment.bytes=new Uint8Array(newBytes);}return finishProcessingFn(null,segment)}};var transmuxAndNotify=function transmuxAndNotify(_ref4){var segment=_ref4.segment,bytes=_ref4.bytes,trackInfoFn=_ref4.trackInfoFn,timingInfoFn=_ref4.timingInfoFn,videoSegmentTimingInfoFn=_ref4.videoSegmentTimingInfoFn,audioSegmentTimingInfoFn=_ref4.audioSegmentTimingInfoFn,id3Fn=_ref4.id3Fn,captionsFn=_ref4.captionsFn,isEndOfTimeline=_ref4.isEndOfTimeline,endedTimelineFn=_ref4.endedTimelineFn,dataFn=_ref4.dataFn,doneFn=_ref4.doneFn,onTransmuxerLog=_ref4.onTransmuxerLog;var fmp4Tracks=segment.map&&segment.map.tracks||{};var isMuxed=Boolean(fmp4Tracks.audio&&fmp4Tracks.video);var audioStartFn=timingInfoFn.bind(null,segment,"audio","start");var audioEndFn=timingInfoFn.bind(null,segment,"audio","end");var videoStartFn=timingInfoFn.bind(null,segment,"video","start");var videoEndFn=timingInfoFn.bind(null,segment,"video","end");var finish=function finish(){return transmux({bytes:bytes,transmuxer:segment.transmuxer,audioAppendStart:segment.audioAppendStart,gopsToAlignWith:segment.gopsToAlignWith,remux:isMuxed,onData:function onData(result){result.type=result.type==="combined"?"video":result.type;dataFn(segment,result);},onTrackInfo:function onTrackInfo(trackInfo){if(trackInfoFn){if(isMuxed){trackInfo.isMuxed=true;}trackInfoFn(segment,trackInfo);}},onAudioTimingInfo:function onAudioTimingInfo(audioTimingInfo){if(audioStartFn&&typeof audioTimingInfo.start!=="undefined"){audioStartFn(audioTimingInfo.start);audioStartFn=null;}if(audioEndFn&&typeof audioTimingInfo.end!=="undefined"){audioEndFn(audioTimingInfo.end);}},onVideoTimingInfo:function onVideoTimingInfo(videoTimingInfo){if(videoStartFn&&typeof videoTimingInfo.start!=="undefined"){videoStartFn(videoTimingInfo.start);videoStartFn=null;}if(videoEndFn&&typeof videoTimingInfo.end!=="undefined"){videoEndFn(videoTimingInfo.end);}},onVideoSegmentTimingInfo:function onVideoSegmentTimingInfo(videoSegmentTimingInfo){videoSegmentTimingInfoFn(videoSegmentTimingInfo);},onAudioSegmentTimingInfo:function onAudioSegmentTimingInfo(audioSegmentTimingInfo){audioSegmentTimingInfoFn(audioSegmentTimingInfo);},onId3:function onId3(id3Frames,dispatchType){id3Fn(segment,id3Frames,dispatchType);},onCaptions:function onCaptions(captions){captionsFn(segment,[captions]);},isEndOfTimeline:isEndOfTimeline,onEndedTimeline:function onEndedTimeline(){endedTimelineFn();},onTransmuxerLog:onTransmuxerLog,onDone:function onDone(result){if(!doneFn){return}result.type=result.type==="combined"?"video":result.type;doneFn(null,segment,result);}})};workerCallback({action:"probeTs",transmuxer:segment.transmuxer,data:bytes,baseStartTime:segment.baseStartTime,callback:function callback(data){segment.bytes=bytes=data.data;var probeResult=data.result;if(probeResult){trackInfoFn(segment,{hasAudio:probeResult.hasAudio,hasVideo:probeResult.hasVideo,isMuxed:isMuxed});trackInfoFn=null;if(probeResult.hasAudio&&!isMuxed){audioStartFn(probeResult.audioStart);}if(probeResult.hasVideo){videoStartFn(probeResult.videoStart);}audioStartFn=null;videoStartFn=null;}finish();}});};var handleSegmentBytes=function handleSegmentBytes(_ref5){var segment=_ref5.segment,bytes=_ref5.bytes,trackInfoFn=_ref5.trackInfoFn,timingInfoFn=_ref5.timingInfoFn,videoSegmentTimingInfoFn=_ref5.videoSegmentTimingInfoFn,audioSegmentTimingInfoFn=_ref5.audioSegmentTimingInfoFn,id3Fn=_ref5.id3Fn,captionsFn=_ref5.captionsFn,isEndOfTimeline=_ref5.isEndOfTimeline,endedTimelineFn=_ref5.endedTimelineFn,dataFn=_ref5.dataFn,doneFn=_ref5.doneFn,onTransmuxerLog=_ref5.onTransmuxerLog;var bytesAsUint8Array=new Uint8Array(bytes);if(isLikelyFmp4MediaSegment(bytesAsUint8Array)){segment.isFmp4=true;var tracks=segment.map.tracks;var trackInfo={isFmp4:true,hasVideo:!!tracks.video,hasAudio:!!tracks.audio};if(tracks.audio&&tracks.audio.codec&&tracks.audio.codec!=="enca"){trackInfo.audioCodec=tracks.audio.codec;}if(tracks.video&&tracks.video.codec&&tracks.video.codec!=="encv"){trackInfo.videoCodec=tracks.video.codec;}if(tracks.video&&tracks.audio){trackInfo.isMuxed=true;}trackInfoFn(segment,trackInfo);var finishLoading=function finishLoading(captions){dataFn(segment,{data:bytesAsUint8Array,type:trackInfo.hasAudio&&!trackInfo.isMuxed?"audio":"video"});if(captions&&captions.length){captionsFn(segment,captions);}doneFn(null,segment,{});};workerCallback({action:"probeMp4StartTime",timescales:segment.map.timescales,data:bytesAsUint8Array,transmuxer:segment.transmuxer,callback:function callback(_ref6){var data=_ref6.data,startTime=_ref6.startTime;bytes=data.buffer;segment.bytes=bytesAsUint8Array=data;if(trackInfo.hasAudio&&!trackInfo.isMuxed){timingInfoFn(segment,"audio","start",startTime);}if(trackInfo.hasVideo){timingInfoFn(segment,"video","start",startTime);}if(!tracks.video||!data.byteLength||!segment.transmuxer){finishLoading();return}workerCallback({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:segment.transmuxer,data:bytesAsUint8Array,timescales:segment.map.timescales,trackIds:[tracks.video.id],callback:function callback(message){bytes=message.data.buffer;segment.bytes=bytesAsUint8Array=message.data;message.logs.forEach(function(log){onTransmuxerLog(videojs.mergeOptions(log,{stream:"mp4CaptionParser"}));});finishLoading(message.captions);}});}});return}if(!segment.transmuxer){doneFn(null,segment,{});return}if(typeof segment.container==="undefined"){segment.container=detectContainerForBytes(bytesAsUint8Array);}if(segment.container!=="ts"&&segment.container!=="aac"){trackInfoFn(segment,{hasAudio:false,hasVideo:false});doneFn(null,segment,{});return}transmuxAndNotify({segment:segment,bytes:bytes,trackInfoFn:trackInfoFn,timingInfoFn:timingInfoFn,videoSegmentTimingInfoFn:videoSegmentTimingInfoFn,audioSegmentTimingInfoFn:audioSegmentTimingInfoFn,id3Fn:id3Fn,captionsFn:captionsFn,isEndOfTimeline:isEndOfTimeline,endedTimelineFn:endedTimelineFn,dataFn:dataFn,doneFn:doneFn,onTransmuxerLog:onTransmuxerLog});};var decrypt=function decrypt(_ref7,callback){var id=_ref7.id,key=_ref7.key,encryptedBytes=_ref7.encryptedBytes,decryptionWorker=_ref7.decryptionWorker;var decryptionHandler=function decryptionHandler(event){if(event.data.source===id){decryptionWorker.removeEventListener("message",decryptionHandler);var decrypted=event.data.decrypted;callback(new Uint8Array(decrypted.bytes,decrypted.byteOffset,decrypted.byteLength));}};decryptionWorker.addEventListener("message",decryptionHandler);var keyBytes;if(key.bytes.slice){keyBytes=key.bytes.slice();}else {keyBytes=new Uint32Array(Array.prototype.slice.call(key.bytes));}decryptionWorker.postMessage(createTransferableMessage({source:id,encrypted:encryptedBytes,key:keyBytes,iv:key.iv}),[encryptedBytes.buffer,keyBytes.buffer]);};var decryptSegment=function decryptSegment(_ref8){var decryptionWorker=_ref8.decryptionWorker,segment=_ref8.segment,trackInfoFn=_ref8.trackInfoFn,timingInfoFn=_ref8.timingInfoFn,videoSegmentTimingInfoFn=_ref8.videoSegmentTimingInfoFn,audioSegmentTimingInfoFn=_ref8.audioSegmentTimingInfoFn,id3Fn=_ref8.id3Fn,captionsFn=_ref8.captionsFn,isEndOfTimeline=_ref8.isEndOfTimeline,endedTimelineFn=_ref8.endedTimelineFn,dataFn=_ref8.dataFn,doneFn=_ref8.doneFn,onTransmuxerLog=_ref8.onTransmuxerLog;decrypt({id:segment.requestId,key:segment.key,encryptedBytes:segment.encryptedBytes,decryptionWorker:decryptionWorker},function(decryptedBytes){segment.bytes=decryptedBytes;handleSegmentBytes({segment:segment,bytes:segment.bytes,trackInfoFn:trackInfoFn,timingInfoFn:timingInfoFn,videoSegmentTimingInfoFn:videoSegmentTimingInfoFn,audioSegmentTimingInfoFn:audioSegmentTimingInfoFn,id3Fn:id3Fn,captionsFn:captionsFn,isEndOfTimeline:isEndOfTimeline,endedTimelineFn:endedTimelineFn,dataFn:dataFn,doneFn:doneFn,onTransmuxerLog:onTransmuxerLog});});};var waitForCompletion=function waitForCompletion(_ref9){var activeXhrs=_ref9.activeXhrs,decryptionWorker=_ref9.decryptionWorker,trackInfoFn=_ref9.trackInfoFn,timingInfoFn=_ref9.timingInfoFn,videoSegmentTimingInfoFn=_ref9.videoSegmentTimingInfoFn,audioSegmentTimingInfoFn=_ref9.audioSegmentTimingInfoFn,id3Fn=_ref9.id3Fn,captionsFn=_ref9.captionsFn,isEndOfTimeline=_ref9.isEndOfTimeline,endedTimelineFn=_ref9.endedTimelineFn,dataFn=_ref9.dataFn,doneFn=_ref9.doneFn,onTransmuxerLog=_ref9.onTransmuxerLog;var count=0;var didError=false;return function(error,segment){if(didError){return}if(error){didError=true;abortAll(activeXhrs);return doneFn(error,segment)}count+=1;if(count===activeXhrs.length){var segmentFinish=function segmentFinish(){if(segment.encryptedBytes){return decryptSegment({decryptionWorker:decryptionWorker,segment:segment,trackInfoFn:trackInfoFn,timingInfoFn:timingInfoFn,videoSegmentTimingInfoFn:videoSegmentTimingInfoFn,audioSegmentTimingInfoFn:audioSegmentTimingInfoFn,id3Fn:id3Fn,captionsFn:captionsFn,isEndOfTimeline:isEndOfTimeline,endedTimelineFn:endedTimelineFn,dataFn:dataFn,doneFn:doneFn,onTransmuxerLog:onTransmuxerLog})}handleSegmentBytes({segment:segment,bytes:segment.bytes,trackInfoFn:trackInfoFn,timingInfoFn:timingInfoFn,videoSegmentTimingInfoFn:videoSegmentTimingInfoFn,audioSegmentTimingInfoFn:audioSegmentTimingInfoFn,id3Fn:id3Fn,captionsFn:captionsFn,isEndOfTimeline:isEndOfTimeline,endedTimelineFn:endedTimelineFn,dataFn:dataFn,doneFn:doneFn,onTransmuxerLog:onTransmuxerLog});};segment.endOfAllRequests=Date.now();if(segment.map&&segment.map.encryptedBytes&&!segment.map.bytes){return decrypt({decryptionWorker:decryptionWorker,id:segment.requestId+"-init",encryptedBytes:segment.map.encryptedBytes,key:segment.map.key},function(decryptedBytes){segment.map.bytes=decryptedBytes;parseInitSegment(segment,function(parseError){if(parseError){abortAll(activeXhrs);return doneFn(parseError,segment)}segmentFinish();});})}segmentFinish();}}};var handleLoadEnd=function handleLoadEnd(_ref10){var loadendState=_ref10.loadendState,abortFn=_ref10.abortFn;return function(event){var request=event.target;if(request.aborted&&abortFn&&!loadendState.calledAbortFn){abortFn();loadendState.calledAbortFn=true;}}};var handleProgress=function handleProgress(_ref11){var segment=_ref11.segment,progressFn=_ref11.progressFn;_ref11.trackInfoFn;_ref11.timingInfoFn;_ref11.videoSegmentTimingInfoFn;_ref11.audioSegmentTimingInfoFn;_ref11.id3Fn;_ref11.captionsFn;_ref11.isEndOfTimeline;_ref11.endedTimelineFn;_ref11.dataFn;return function(event){var request=event.target;if(request.aborted){return}segment.stats=videojs.mergeOptions(segment.stats,getProgressStats(event));if(!segment.stats.firstBytesReceivedAt&&segment.stats.bytesReceived){segment.stats.firstBytesReceivedAt=Date.now();}return progressFn(event,segment)}};var mediaSegmentRequest=function mediaSegmentRequest(_ref12){var xhr=_ref12.xhr,xhrOptions=_ref12.xhrOptions,decryptionWorker=_ref12.decryptionWorker,segment=_ref12.segment,abortFn=_ref12.abortFn,progressFn=_ref12.progressFn,trackInfoFn=_ref12.trackInfoFn,timingInfoFn=_ref12.timingInfoFn,videoSegmentTimingInfoFn=_ref12.videoSegmentTimingInfoFn,audioSegmentTimingInfoFn=_ref12.audioSegmentTimingInfoFn,id3Fn=_ref12.id3Fn,captionsFn=_ref12.captionsFn,isEndOfTimeline=_ref12.isEndOfTimeline,endedTimelineFn=_ref12.endedTimelineFn,dataFn=_ref12.dataFn,doneFn=_ref12.doneFn,onTransmuxerLog=_ref12.onTransmuxerLog;var activeXhrs=[];var finishProcessingFn=waitForCompletion({activeXhrs:activeXhrs,decryptionWorker:decryptionWorker,trackInfoFn:trackInfoFn,timingInfoFn:timingInfoFn,videoSegmentTimingInfoFn:videoSegmentTimingInfoFn,audioSegmentTimingInfoFn:audioSegmentTimingInfoFn,id3Fn:id3Fn,captionsFn:captionsFn,isEndOfTimeline:isEndOfTimeline,endedTimelineFn:endedTimelineFn,dataFn:dataFn,doneFn:doneFn,onTransmuxerLog:onTransmuxerLog});if(segment.key&&!segment.key.bytes){var objects=[segment.key];if(segment.map&&!segment.map.bytes&&segment.map.key&&segment.map.key.resolvedUri===segment.key.resolvedUri){objects.push(segment.map.key);}var keyRequestOptions=videojs.mergeOptions(xhrOptions,{uri:segment.key.resolvedUri,responseType:"arraybuffer"});var keyRequestCallback=handleKeyResponse(segment,objects,finishProcessingFn);var keyXhr=xhr(keyRequestOptions,keyRequestCallback);activeXhrs.push(keyXhr);}if(segment.map&&!segment.map.bytes){var differentMapKey=segment.map.key&&(!segment.key||segment.key.resolvedUri!==segment.map.key.resolvedUri);if(differentMapKey){var mapKeyRequestOptions=videojs.mergeOptions(xhrOptions,{uri:segment.map.key.resolvedUri,responseType:"arraybuffer"});var mapKeyRequestCallback=handleKeyResponse(segment,[segment.map.key],finishProcessingFn);var mapKeyXhr=xhr(mapKeyRequestOptions,mapKeyRequestCallback);activeXhrs.push(mapKeyXhr);}var initSegmentOptions=videojs.mergeOptions(xhrOptions,{uri:segment.map.resolvedUri,responseType:"arraybuffer",headers:segmentXhrHeaders(segment.map)});var initSegmentRequestCallback=handleInitSegmentResponse({segment:segment,finishProcessingFn:finishProcessingFn});var initSegmentXhr=xhr(initSegmentOptions,initSegmentRequestCallback);activeXhrs.push(initSegmentXhr);}var segmentRequestOptions=videojs.mergeOptions(xhrOptions,{uri:segment.part&&segment.part.resolvedUri||segment.resolvedUri,responseType:"arraybuffer",headers:segmentXhrHeaders(segment)});var segmentRequestCallback=handleSegmentResponse({segment:segment,finishProcessingFn:finishProcessingFn,responseType:segmentRequestOptions.responseType});var segmentXhr=xhr(segmentRequestOptions,segmentRequestCallback);segmentXhr.addEventListener("progress",handleProgress({segment:segment,progressFn:progressFn,trackInfoFn:trackInfoFn,timingInfoFn:timingInfoFn,videoSegmentTimingInfoFn:videoSegmentTimingInfoFn,audioSegmentTimingInfoFn:audioSegmentTimingInfoFn,id3Fn:id3Fn,captionsFn:captionsFn,isEndOfTimeline:isEndOfTimeline,endedTimelineFn:endedTimelineFn,dataFn:dataFn}));activeXhrs.push(segmentXhr);var loadendState={};activeXhrs.forEach(function(activeXhr){activeXhr.addEventListener("loadend",handleLoadEnd({loadendState:loadendState,abortFn:abortFn}));});return function(){return abortAll(activeXhrs)}};var logFn$1=logger("CodecUtils");var getCodecs=function getCodecs(media){var mediaAttributes=media.attributes||{};if(mediaAttributes.CODECS){return parseCodecs(mediaAttributes.CODECS)}};var isMaat=function isMaat(master,media){var mediaAttributes=media.attributes||{};return master&&master.mediaGroups&&master.mediaGroups.AUDIO&&mediaAttributes.AUDIO&&master.mediaGroups.AUDIO[mediaAttributes.AUDIO]};var isMuxed=function isMuxed(master,media){if(!isMaat(master,media)){return true}var mediaAttributes=media.attributes||{};var audioGroup=master.mediaGroups.AUDIO[mediaAttributes.AUDIO];for(var groupId in audioGroup){if(!audioGroup[groupId].uri&&!audioGroup[groupId].playlists){return true}}return false};var unwrapCodecList=function unwrapCodecList(codecList){var codecs={};codecList.forEach(function(_ref){var mediaType=_ref.mediaType,type=_ref.type,details=_ref.details;codecs[mediaType]=codecs[mediaType]||[];codecs[mediaType].push(translateLegacyCodec(""+type+details));});Object.keys(codecs).forEach(function(mediaType){if(codecs[mediaType].length>1){logFn$1("multiple "+mediaType+" codecs found as attributes: "+codecs[mediaType].join(", ")+". Setting playlist codecs to null so that we wait for mux.js to probe segments for real codecs.");codecs[mediaType]=null;return}codecs[mediaType]=codecs[mediaType][0];});return codecs};var codecCount=function codecCount(codecObj){var count=0;if(codecObj.audio){count++;}if(codecObj.video){count++;}return count};var codecsForPlaylist=function codecsForPlaylist(master,media){var mediaAttributes=media.attributes||{};var codecInfo=unwrapCodecList(getCodecs(media)||[]);if(isMaat(master,media)&&!codecInfo.audio){if(!isMuxed(master,media)){var defaultCodecs=unwrapCodecList(codecsFromDefault(master,mediaAttributes.AUDIO)||[]);if(defaultCodecs.audio){codecInfo.audio=defaultCodecs.audio;}}}return codecInfo};var logFn=logger("PlaylistSelector");var representationToString=function representationToString(representation){if(!representation||!representation.playlist){return}var playlist=representation.playlist;return JSON.stringify({id:playlist.id,bandwidth:representation.bandwidth,width:representation.width,height:representation.height,codecs:playlist.attributes&&playlist.attributes.CODECS||""})};var safeGetComputedStyle=function safeGetComputedStyle(el,property){if(!el){return ""}var result=window_1.getComputedStyle(el);if(!result){return ""}return result[property]};var stableSort=function stableSort(array,sortFn){var newArray=array.slice();array.sort(function(left,right){var cmp=sortFn(left,right);if(cmp===0){return newArray.indexOf(left)-newArray.indexOf(right)}return cmp});};var comparePlaylistBandwidth=function comparePlaylistBandwidth(left,right){var leftBandwidth;var rightBandwidth;if(left.attributes.BANDWIDTH){leftBandwidth=left.attributes.BANDWIDTH;}leftBandwidth=leftBandwidth||window_1.Number.MAX_VALUE;if(right.attributes.BANDWIDTH){rightBandwidth=right.attributes.BANDWIDTH;}rightBandwidth=rightBandwidth||window_1.Number.MAX_VALUE;return leftBandwidth-rightBandwidth};var comparePlaylistResolution=function comparePlaylistResolution(left,right){var leftWidth;var rightWidth;if(left.attributes.RESOLUTION&&left.attributes.RESOLUTION.width){leftWidth=left.attributes.RESOLUTION.width;}leftWidth=leftWidth||window_1.Number.MAX_VALUE;if(right.attributes.RESOLUTION&&right.attributes.RESOLUTION.width){rightWidth=right.attributes.RESOLUTION.width;}rightWidth=rightWidth||window_1.Number.MAX_VALUE;if(leftWidth===rightWidth&&left.attributes.BANDWIDTH&&right.attributes.BANDWIDTH){return left.attributes.BANDWIDTH-right.attributes.BANDWIDTH}return leftWidth-rightWidth};var simpleSelector=function simpleSelector(master,playerBandwidth,playerWidth,playerHeight,limitRenditionByPlayerDimensions,masterPlaylistController){if(!master){return}var options={bandwidth:playerBandwidth,width:playerWidth,height:playerHeight,limitRenditionByPlayerDimensions:limitRenditionByPlayerDimensions};var playlists=master.playlists;if(Playlist.isAudioOnly(master)){playlists=masterPlaylistController.getAudioTrackPlaylists_();options.audioOnly=true;}var sortedPlaylistReps=playlists.map(function(playlist){var bandwidth;var width=playlist.attributes&&playlist.attributes.RESOLUTION&&playlist.attributes.RESOLUTION.width;var height=playlist.attributes&&playlist.attributes.RESOLUTION&&playlist.attributes.RESOLUTION.height;bandwidth=playlist.attributes&&playlist.attributes.BANDWIDTH;bandwidth=bandwidth||window_1.Number.MAX_VALUE;return {bandwidth:bandwidth,width:width,height:height,playlist:playlist}});stableSort(sortedPlaylistReps,function(left,right){return left.bandwidth-right.bandwidth});sortedPlaylistReps=sortedPlaylistReps.filter(function(rep){return !Playlist.isIncompatible(rep.playlist)});var enabledPlaylistReps=sortedPlaylistReps.filter(function(rep){return Playlist.isEnabled(rep.playlist)});if(!enabledPlaylistReps.length){enabledPlaylistReps=sortedPlaylistReps.filter(function(rep){return !Playlist.isDisabled(rep.playlist)});}var bandwidthPlaylistReps=enabledPlaylistReps.filter(function(rep){return rep.bandwidth*Config.BANDWIDTH_VARIANCE<playerBandwidth});var highestRemainingBandwidthRep=bandwidthPlaylistReps[bandwidthPlaylistReps.length-1];var bandwidthBestRep=bandwidthPlaylistReps.filter(function(rep){return rep.bandwidth===highestRemainingBandwidthRep.bandwidth})[0];if(limitRenditionByPlayerDimensions===false){var _chosenRep=bandwidthBestRep||enabledPlaylistReps[0]||sortedPlaylistReps[0];if(_chosenRep&&_chosenRep.playlist){var type="sortedPlaylistReps";if(bandwidthBestRep){type="bandwidthBestRep";}if(enabledPlaylistReps[0]){type="enabledPlaylistReps";}logFn("choosing "+representationToString(_chosenRep)+" using "+type+" with options",options);return _chosenRep.playlist}logFn("could not choose a playlist with options",options);return null}var haveResolution=bandwidthPlaylistReps.filter(function(rep){return rep.width&&rep.height});stableSort(haveResolution,function(left,right){return left.width-right.width});var resolutionBestRepList=haveResolution.filter(function(rep){return rep.width===playerWidth&&rep.height===playerHeight});highestRemainingBandwidthRep=resolutionBestRepList[resolutionBestRepList.length-1];var resolutionBestRep=resolutionBestRepList.filter(function(rep){return rep.bandwidth===highestRemainingBandwidthRep.bandwidth})[0];var resolutionPlusOneList;var resolutionPlusOneSmallest;var resolutionPlusOneRep;if(!resolutionBestRep){resolutionPlusOneList=haveResolution.filter(function(rep){return rep.width>playerWidth||rep.height>playerHeight});resolutionPlusOneSmallest=resolutionPlusOneList.filter(function(rep){return rep.width===resolutionPlusOneList[0].width&&rep.height===resolutionPlusOneList[0].height});highestRemainingBandwidthRep=resolutionPlusOneSmallest[resolutionPlusOneSmallest.length-1];resolutionPlusOneRep=resolutionPlusOneSmallest.filter(function(rep){return rep.bandwidth===highestRemainingBandwidthRep.bandwidth})[0];}var leastPixelDiffRep;if(masterPlaylistController.experimentalLeastPixelDiffSelector){var leastPixelDiffList=haveResolution.map(function(rep){rep.pixelDiff=Math.abs(rep.width-playerWidth)+Math.abs(rep.height-playerHeight);return rep});stableSort(leastPixelDiffList,function(left,right){if(left.pixelDiff===right.pixelDiff){return right.bandwidth-left.bandwidth}return left.pixelDiff-right.pixelDiff});leastPixelDiffRep=leastPixelDiffList[0];}var chosenRep=leastPixelDiffRep||resolutionPlusOneRep||resolutionBestRep||bandwidthBestRep||enabledPlaylistReps[0]||sortedPlaylistReps[0];if(chosenRep&&chosenRep.playlist){var _type="sortedPlaylistReps";if(leastPixelDiffRep){_type="leastPixelDiffRep";}else if(resolutionPlusOneRep){_type="resolutionPlusOneRep";}else if(resolutionBestRep){_type="resolutionBestRep";}else if(bandwidthBestRep){_type="bandwidthBestRep";}else if(enabledPlaylistReps[0]){_type="enabledPlaylistReps";}logFn("choosing "+representationToString(chosenRep)+" using "+_type+" with options",options);return chosenRep.playlist}logFn("could not choose a playlist with options",options);return null};var lastBandwidthSelector=function lastBandwidthSelector(){var pixelRatio=this.useDevicePixelRatio?window_1.devicePixelRatio||1:1;return simpleSelector(this.playlists.master,this.systemBandwidth,parseInt(safeGetComputedStyle(this.tech_.el(),"width"),10)*pixelRatio,parseInt(safeGetComputedStyle(this.tech_.el(),"height"),10)*pixelRatio,this.limitRenditionByPlayerDimensions,this.masterPlaylistController_)};var movingAverageBandwidthSelector=function movingAverageBandwidthSelector(decay){var average=-1;var lastSystemBandwidth=-1;if(decay<0||decay>1){throw new Error("Moving average bandwidth decay must be between 0 and 1.")}return function(){var pixelRatio=this.useDevicePixelRatio?window_1.devicePixelRatio||1:1;if(average<0){average=this.systemBandwidth;lastSystemBandwidth=this.systemBandwidth;}if(this.systemBandwidth>0&&this.systemBandwidth!==lastSystemBandwidth){average=decay*this.systemBandwidth+(1-decay)*average;lastSystemBandwidth=this.systemBandwidth;}return simpleSelector(this.playlists.master,average,parseInt(safeGetComputedStyle(this.tech_.el(),"width"),10)*pixelRatio,parseInt(safeGetComputedStyle(this.tech_.el(),"height"),10)*pixelRatio,this.limitRenditionByPlayerDimensions,this.masterPlaylistController_)}};var minRebufferMaxBandwidthSelector=function minRebufferMaxBandwidthSelector(settings){var master=settings.master,currentTime=settings.currentTime,bandwidth=settings.bandwidth,duration=settings.duration,segmentDuration=settings.segmentDuration,timeUntilRebuffer=settings.timeUntilRebuffer,currentTimeline=settings.currentTimeline,syncController=settings.syncController;var compatiblePlaylists=master.playlists.filter(function(playlist){return !Playlist.isIncompatible(playlist)});var enabledPlaylists=compatiblePlaylists.filter(Playlist.isEnabled);if(!enabledPlaylists.length){enabledPlaylists=compatiblePlaylists.filter(function(playlist){return !Playlist.isDisabled(playlist)});}var bandwidthPlaylists=enabledPlaylists.filter(Playlist.hasAttribute.bind(null,"BANDWIDTH"));var rebufferingEstimates=bandwidthPlaylists.map(function(playlist){var syncPoint=syncController.getSyncPoint(playlist,duration,currentTimeline,currentTime);var numRequests=syncPoint?1:2;var requestTimeEstimate=Playlist.estimateSegmentRequestTime(segmentDuration,bandwidth,playlist);var rebufferingImpact=requestTimeEstimate*numRequests-timeUntilRebuffer;return {playlist:playlist,rebufferingImpact:rebufferingImpact}});var noRebufferingPlaylists=rebufferingEstimates.filter(function(estimate){return estimate.rebufferingImpact<=0});stableSort(noRebufferingPlaylists,function(a,b){return comparePlaylistBandwidth(b.playlist,a.playlist)});if(noRebufferingPlaylists.length){return noRebufferingPlaylists[0]}stableSort(rebufferingEstimates,function(a,b){return a.rebufferingImpact-b.rebufferingImpact});return rebufferingEstimates[0]||null};var lowestBitrateCompatibleVariantSelector=function lowestBitrateCompatibleVariantSelector(){var _this=this;var playlists=this.playlists.master.playlists.filter(Playlist.isEnabled);stableSort(playlists,function(a,b){return comparePlaylistBandwidth(a,b)});var playlistsWithVideo=playlists.filter(function(playlist){return !!codecsForPlaylist(_this.playlists.master,playlist).video});return playlistsWithVideo[0]||null};var concatSegments=function concatSegments(segmentObj){var offset=0;var tempBuffer;if(segmentObj.bytes){tempBuffer=new Uint8Array(segmentObj.bytes);segmentObj.segments.forEach(function(segment){tempBuffer.set(segment,offset);offset+=segment.byteLength;});}return tempBuffer};var createCaptionsTrackIfNotExists=function createCaptionsTrackIfNotExists(inbandTextTracks,tech,captionStream){if(!inbandTextTracks[captionStream]){tech.trigger({type:"usage",name:"vhs-608"});tech.trigger({type:"usage",name:"hls-608"});var instreamId=captionStream;if(/^cc708_/.test(captionStream)){instreamId="SERVICE"+captionStream.split("_")[1];}var track=tech.textTracks().getTrackById(instreamId);if(track){inbandTextTracks[captionStream]=track;}else {var captionServices=tech.options_.vhs&&tech.options_.vhs.captionServices||{};var label=captionStream;var language=captionStream;var def=false;var captionService=captionServices[instreamId];if(captionService){label=captionService.label;language=captionService.language;def=captionService["default"];}inbandTextTracks[captionStream]=tech.addRemoteTextTrack({kind:"captions",id:instreamId,"default":def,label:label,language:language},false).track;}}};var addCaptionData=function addCaptionData(_ref){var inbandTextTracks=_ref.inbandTextTracks,captionArray=_ref.captionArray,timestampOffset=_ref.timestampOffset;if(!captionArray){return}var Cue=window_1.WebKitDataCue||window_1.VTTCue;captionArray.forEach(function(caption){var track=caption.stream;inbandTextTracks[track].addCue(new Cue(caption.startTime+timestampOffset,caption.endTime+timestampOffset,caption.text));});};var deprecateOldCue=function deprecateOldCue(cue){Object.defineProperties(cue.frame,{id:{get:function get(){videojs.log.warn("cue.frame.id is deprecated. Use cue.value.key instead.");return cue.value.key}},value:{get:function get(){videojs.log.warn("cue.frame.value is deprecated. Use cue.value.data instead.");return cue.value.data}},privateData:{get:function get(){videojs.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead.");return cue.value.data}}});};var addMetadata=function addMetadata(_ref2){var inbandTextTracks=_ref2.inbandTextTracks,metadataArray=_ref2.metadataArray,timestampOffset=_ref2.timestampOffset,videoDuration=_ref2.videoDuration;if(!metadataArray){return}var Cue=window_1.WebKitDataCue||window_1.VTTCue;var metadataTrack=inbandTextTracks.metadataTrack_;if(!metadataTrack){return}metadataArray.forEach(function(metadata){var time=metadata.cueTime+timestampOffset;if(typeof time!=="number"||window_1.isNaN(time)||time<0||!(time<Infinity)){return}metadata.frames.forEach(function(frame){var cue=new Cue(time,time,frame.value||frame.url||frame.data||"");cue.frame=frame;cue.value=frame;deprecateOldCue(cue);metadataTrack.addCue(cue);});});if(!metadataTrack.cues||!metadataTrack.cues.length){return}var cues=metadataTrack.cues;var cuesArray=[];for(var i=0;i<cues.length;i++){if(cues[i]){cuesArray.push(cues[i]);}}var cuesGroupedByStartTime=cuesArray.reduce(function(obj,cue){var timeSlot=obj[cue.startTime]||[];timeSlot.push(cue);obj[cue.startTime]=timeSlot;return obj},{});var sortedStartTimes=Object.keys(cuesGroupedByStartTime).sort(function(a,b){return Number(a)-Number(b)});sortedStartTimes.forEach(function(startTime,idx){var cueGroup=cuesGroupedByStartTime[startTime];var nextTime=Number(sortedStartTimes[idx+1])||videoDuration;cueGroup.forEach(function(cue){cue.endTime=nextTime;});});};var createMetadataTrackIfNotExists=function createMetadataTrackIfNotExists(inbandTextTracks,dispatchType,tech){if(inbandTextTracks.metadataTrack_){return}inbandTextTracks.metadataTrack_=tech.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},false).track;inbandTextTracks.metadataTrack_.inBandMetadataTrackDispatchType=dispatchType;};var removeCuesFromTrack=function removeCuesFromTrack(start,end,track){var i;var cue;if(!track){return}if(!track.cues){return}i=track.cues.length;while(i--){cue=track.cues[i];if(cue.startTime>=start&&cue.endTime<=end){track.removeCue(cue);}}};var removeDuplicateCuesFromTrack=function removeDuplicateCuesFromTrack(track){var cues=track.cues;if(!cues){return}for(var i=0;i<cues.length;i++){var duplicates=[];var occurrences=0;for(var j=0;j<cues.length;j++){if(cues[i].startTime===cues[j].startTime&&cues[i].endTime===cues[j].endTime&&cues[i].text===cues[j].text){occurrences++;if(occurrences>1){duplicates.push(cues[j]);}}}if(duplicates.length){duplicates.forEach(function(dupe){return track.removeCue(dupe)});}}};var gopsSafeToAlignWith=function gopsSafeToAlignWith(buffer,currentTime,mapping){if(typeof currentTime==="undefined"||currentTime===null||!buffer.length){return []}var currentTimePts=Math.ceil((currentTime-mapping+3)*clock.ONE_SECOND_IN_TS);var i;for(i=0;i<buffer.length;i++){if(buffer[i].pts>currentTimePts){break}}return buffer.slice(i)};var updateGopBuffer=function updateGopBuffer(buffer,gops,replace){if(!gops.length){return buffer}if(replace){return gops.slice()}var start=gops[0].pts;var i=0;for(i;i<buffer.length;i++){if(buffer[i].pts>=start){break}}return buffer.slice(0,i).concat(gops)};var removeGopBuffer=function removeGopBuffer(buffer,start,end,mapping){var startPts=Math.ceil((start-mapping)*clock.ONE_SECOND_IN_TS);var endPts=Math.ceil((end-mapping)*clock.ONE_SECOND_IN_TS);var updatedBuffer=buffer.slice();var i=buffer.length;while(i--){if(buffer[i].pts<=endPts){break}}if(i===-1){return updatedBuffer}var j=i+1;while(j--){if(buffer[j].pts<=startPts){break}}j=Math.max(j,0);updatedBuffer.splice(j,i-j+1);return updatedBuffer};var shallowEqual=function shallowEqual(a,b){if(!a&&!b||!a&&b||a&&!b){return false}if(a===b){return true}var akeys=Object.keys(a).sort();var bkeys=Object.keys(b).sort();if(akeys.length!==bkeys.length){return false}for(var i=0;i<akeys.length;i++){var key=akeys[i];if(key!==bkeys[i]){return false}if(a[key]!==b[key]){return false}}return true};var QUOTA_EXCEEDED_ERR=22;var getSyncSegmentCandidate=function getSyncSegmentCandidate(currentTimeline,segments,targetTime){segments=segments||[];var timelineSegments=[];var time=0;for(var i=0;i<segments.length;i++){var segment=segments[i];if(currentTimeline===segment.timeline){timelineSegments.push(i);time+=segment.duration;if(time>targetTime){return i}}}if(timelineSegments.length===0){return 0}return timelineSegments[timelineSegments.length-1]};var MIN_BACK_BUFFER=1;var CHECK_BUFFER_DELAY=500;var finite=function finite(num){return typeof num==="number"&&isFinite(num)};var MIN_SEGMENT_DURATION_TO_SAVE_STATS=1/60;var illegalMediaSwitch=function illegalMediaSwitch(loaderType,startingMedia,trackInfo){if(loaderType!=="main"||!startingMedia||!trackInfo){return null}if(!trackInfo.hasAudio&&!trackInfo.hasVideo){return "Neither audio nor video found in segment."}if(startingMedia.hasVideo&&!trackInfo.hasVideo){return "Only audio found in segment when we expected video."+" We can't switch to audio only from a stream that had video."+" To get rid of this message, please add codec information to the manifest."}if(!startingMedia.hasVideo&&trackInfo.hasVideo){return "Video found in segment when we expected only audio."+" We can't switch to a stream with video from an audio only stream."+" To get rid of this message, please add codec information to the manifest."}return null};var safeBackBufferTrimTime=function safeBackBufferTrimTime(seekable,currentTime,targetDuration){var trimTime=currentTime-Config.BACK_BUFFER_LENGTH;if(seekable.length){trimTime=Math.max(trimTime,seekable.start(0));}var maxTrimTime=currentTime-targetDuration;return Math.min(maxTrimTime,trimTime)};var segmentInfoString=function segmentInfoString(segmentInfo){var startOfSegment=segmentInfo.startOfSegment,duration=segmentInfo.duration,segment=segmentInfo.segment,part=segmentInfo.part,_segmentInfo$playlist=segmentInfo.playlist,seq=_segmentInfo$playlist.mediaSequence,id=_segmentInfo$playlist.id,_segmentInfo$playlist2=_segmentInfo$playlist.segments,segments=_segmentInfo$playlist2===void 0?[]:_segmentInfo$playlist2,index=segmentInfo.mediaIndex,partIndex=segmentInfo.partIndex,timeline=segmentInfo.timeline;var segmentLen=segments.length-1;var selection="mediaIndex/partIndex increment";if(segmentInfo.getMediaInfoForTime){selection="getMediaInfoForTime ("+segmentInfo.getMediaInfoForTime+")";}else if(segmentInfo.isSyncRequest){selection="getSyncSegmentCandidate (isSyncRequest)";}if(segmentInfo.independent){selection+=" with independent "+segmentInfo.independent;}var hasPartIndex=typeof partIndex==="number";var name=segmentInfo.segment.uri?"segment":"pre-segment";var zeroBasedPartCount=hasPartIndex?getKnownPartCount({preloadSegment:segment})-1:0;return name+" ["+(seq+index)+"/"+(seq+segmentLen)+"]"+(hasPartIndex?" part ["+partIndex+"/"+zeroBasedPartCount+"]":"")+(" segment start/end ["+segment.start+" => "+segment.end+"]")+(hasPartIndex?" part start/end ["+part.start+" => "+part.end+"]":"")+(" startOfSegment ["+startOfSegment+"]")+(" duration ["+duration+"]")+(" timeline ["+timeline+"]")+(" selected by ["+selection+"]")+(" playlist ["+id+"]")};var timingInfoPropertyForMedia=function timingInfoPropertyForMedia(mediaType){return mediaType+"TimingInfo"};var timestampOffsetForSegment=function timestampOffsetForSegment(_ref){var segmentTimeline=_ref.segmentTimeline,currentTimeline=_ref.currentTimeline,startOfSegment=_ref.startOfSegment,buffered=_ref.buffered,overrideCheck=_ref.overrideCheck;if(!overrideCheck&&segmentTimeline===currentTimeline){return null}if(segmentTimeline<currentTimeline){return startOfSegment}return buffered.length?buffered.end(buffered.length-1):startOfSegment};var shouldWaitForTimelineChange=function shouldWaitForTimelineChange(_ref2){var timelineChangeController=_ref2.timelineChangeController,currentTimeline=_ref2.currentTimeline,segmentTimeline=_ref2.segmentTimeline,loaderType=_ref2.loaderType,audioDisabled=_ref2.audioDisabled;if(currentTimeline===segmentTimeline){return false}if(loaderType==="audio"){var lastMainTimelineChange=timelineChangeController.lastTimelineChange({type:"main"});return !lastMainTimelineChange||lastMainTimelineChange.to!==segmentTimeline}if(loaderType==="main"&&audioDisabled){var pendingAudioTimelineChange=timelineChangeController.pendingTimelineChange({type:"audio"});if(pendingAudioTimelineChange&&pendingAudioTimelineChange.to===segmentTimeline){return false}return true}return false};var mediaDuration=function mediaDuration(timingInfos){var maxDuration=0;["video","audio"].forEach(function(type){var typeTimingInfo=timingInfos[type+"TimingInfo"];if(!typeTimingInfo){return}var start=typeTimingInfo.start,end=typeTimingInfo.end;var duration;if(typeof start==="bigint"||typeof end==="bigint"){duration=window_1.BigInt(end)-window_1.BigInt(start);}else if(typeof start==="number"&&typeof end==="number"){duration=end-start;}if(typeof duration!=="undefined"&&duration>maxDuration){maxDuration=duration;}});if(typeof maxDuration==="bigint"&&maxDuration<Number.MAX_SAFE_INTEGER){maxDuration=Number(maxDuration);}return maxDuration};var segmentTooLong=function segmentTooLong(_ref3){var segmentDuration=_ref3.segmentDuration,maxDuration=_ref3.maxDuration;if(!segmentDuration){return false}return Math.round(segmentDuration)>maxDuration+TIME_FUDGE_FACTOR};var getTroublesomeSegmentDurationMessage=function getTroublesomeSegmentDurationMessage(segmentInfo,sourceType){if(sourceType!=="hls"){return null}var segmentDuration=mediaDuration({audioTimingInfo:segmentInfo.audioTimingInfo,videoTimingInfo:segmentInfo.videoTimingInfo});if(!segmentDuration){return null}var targetDuration=segmentInfo.playlist.targetDuration;var isSegmentWayTooLong=segmentTooLong({segmentDuration:segmentDuration,maxDuration:targetDuration*2});var isSegmentSlightlyTooLong=segmentTooLong({segmentDuration:segmentDuration,maxDuration:targetDuration});var segmentTooLongMessage="Segment with index "+segmentInfo.mediaIndex+" "+("from playlist "+segmentInfo.playlist.id+" ")+("has a duration of "+segmentDuration+" ")+("when the reported duration is "+segmentInfo.duration+" ")+("and the target duration is "+targetDuration+". ")+"For HLS content, a duration in excess of the target duration may result in "+"playback issues. See the HLS specification section on EXT-X-TARGETDURATION for "+"more details: "+"https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.3.1";if(isSegmentWayTooLong||isSegmentSlightlyTooLong){return {severity:isSegmentWayTooLong?"warn":"info",message:segmentTooLongMessage}}return null};var SegmentLoader=function(_videojs$EventTarget){_inheritsLoose(SegmentLoader,_videojs$EventTarget);function SegmentLoader(settings,options){var _this;_this=_videojs$EventTarget.call(this)||this;if(!settings){throw new TypeError("Initialization settings are required")}if(typeof settings.currentTime!=="function"){throw new TypeError("No currentTime getter specified")}if(!settings.mediaSource){throw new TypeError("No MediaSource specified")}_this.bandwidth=settings.bandwidth;_this.throughput={rate:0,count:0};_this.roundTrip=NaN;_this.resetStats_();_this.mediaIndex=null;_this.partIndex=null;_this.hasPlayed_=settings.hasPlayed;_this.currentTime_=settings.currentTime;_this.seekable_=settings.seekable;_this.seeking_=settings.seeking;_this.duration_=settings.duration;_this.mediaSource_=settings.mediaSource;_this.vhs_=settings.vhs;_this.loaderType_=settings.loaderType;_this.currentMediaInfo_=void 0;_this.startingMediaInfo_=void 0;_this.segmentMetadataTrack_=settings.segmentMetadataTrack;_this.goalBufferLength_=settings.goalBufferLength;_this.sourceType_=settings.sourceType;_this.sourceUpdater_=settings.sourceUpdater;_this.inbandTextTracks_=settings.inbandTextTracks;_this.state_="INIT";_this.timelineChangeController_=settings.timelineChangeController;_this.shouldSaveSegmentTimingInfo_=true;_this.parse708captions_=settings.parse708captions;_this.useDtsForTimestampOffset_=settings.useDtsForTimestampOffset;_this.captionServices_=settings.captionServices;_this.experimentalExactManifestTimings=settings.experimentalExactManifestTimings;_this.checkBufferTimeout_=null;_this.error_=void 0;_this.currentTimeline_=-1;_this.pendingSegment_=null;_this.xhrOptions_=null;_this.pendingSegments_=[];_this.audioDisabled_=false;_this.isPendingTimestampOffset_=false;_this.gopBuffer_=[];_this.timeMapping_=0;_this.safeAppend_=videojs.browser.IE_VERSION>=11;_this.appendInitSegment_={audio:true,video:true};_this.playlistOfLastInitSegment_={audio:null,video:null};_this.callQueue_=[];_this.loadQueue_=[];_this.metadataQueue_={id3:[],caption:[]};_this.waitingOnRemove_=false;_this.quotaExceededErrorRetryTimeout_=null;_this.activeInitSegmentId_=null;_this.initSegments_={};_this.cacheEncryptionKeys_=settings.cacheEncryptionKeys;_this.keyCache_={};_this.decrypter_=settings.decrypter;_this.syncController_=settings.syncController;_this.syncPoint_={segmentIndex:0,time:0};_this.transmuxer_=_this.createTransmuxer_();_this.triggerSyncInfoUpdate_=function(){return _this.trigger("syncinfoupdate")};_this.syncController_.on("syncinfoupdate",_this.triggerSyncInfoUpdate_);_this.mediaSource_.addEventListener("sourceopen",function(){if(!_this.isEndOfStream_()){_this.ended_=false;}});_this.fetchAtBuffer_=false;_this.logger_=logger("SegmentLoader["+_this.loaderType_+"]");Object.defineProperty(_assertThisInitialized(_this),"state",{get:function get(){return this.state_},set:function set(newState){if(newState!==this.state_){this.logger_(this.state_+" -> "+newState);this.state_=newState;this.trigger("statechange");}}});_this.sourceUpdater_.on("ready",function(){if(_this.hasEnoughInfoToAppend_()){_this.processCallQueue_();}});if(_this.loaderType_==="main"){_this.timelineChangeController_.on("pendingtimelinechange",function(){if(_this.hasEnoughInfoToAppend_()){_this.processCallQueue_();}});}if(_this.loaderType_==="audio"){_this.timelineChangeController_.on("timelinechange",function(){if(_this.hasEnoughInfoToLoad_()){_this.processLoadQueue_();}if(_this.hasEnoughInfoToAppend_()){_this.processCallQueue_();}});}return _this}var _proto=SegmentLoader.prototype;_proto.createTransmuxer_=function createTransmuxer_(){return segmentTransmuxer.createTransmuxer({remux:false,alignGopsAtEnd:this.safeAppend_,keepOriginalTimestamps:true,parse708captions:this.parse708captions_,captionServices:this.captionServices_})};_proto.resetStats_=function resetStats_(){this.mediaBytesTransferred=0;this.mediaRequests=0;this.mediaRequestsAborted=0;this.mediaRequestsTimedout=0;this.mediaRequestsErrored=0;this.mediaTransferDuration=0;this.mediaSecondsLoaded=0;this.mediaAppends=0;};_proto.dispose=function dispose(){this.trigger("dispose");this.state="DISPOSED";this.pause();this.abort_();if(this.transmuxer_){this.transmuxer_.terminate();}this.resetStats_();if(this.checkBufferTimeout_){window_1.clearTimeout(this.checkBufferTimeout_);}if(this.syncController_&&this.triggerSyncInfoUpdate_){this.syncController_.off("syncinfoupdate",this.triggerSyncInfoUpdate_);}this.off();};_proto.setAudio=function setAudio(enable){this.audioDisabled_=!enable;if(enable){this.appendInitSegment_.audio=true;}else {this.sourceUpdater_.removeAudio(0,this.duration_());}};_proto.abort=function abort(){if(this.state!=="WAITING"){if(this.pendingSegment_){this.pendingSegment_=null;}return}this.abort_();this.state="READY";if(!this.paused()){this.monitorBuffer_();}};_proto.abort_=function abort_(){if(this.pendingSegment_&&this.pendingSegment_.abortRequests){this.pendingSegment_.abortRequests();}this.pendingSegment_=null;this.callQueue_=[];this.loadQueue_=[];this.metadataQueue_.id3=[];this.metadataQueue_.caption=[];this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_);this.waitingOnRemove_=false;window_1.clearTimeout(this.quotaExceededErrorRetryTimeout_);this.quotaExceededErrorRetryTimeout_=null;};_proto.checkForAbort_=function checkForAbort_(requestId){if(this.state==="APPENDING"&&!this.pendingSegment_){this.state="READY";return true}if(!this.pendingSegment_||this.pendingSegment_.requestId!==requestId){return true}return false};_proto.error=function error(_error){if(typeof _error!=="undefined"){this.logger_("error occurred:",_error);this.error_=_error;}this.pendingSegment_=null;return this.error_};_proto.endOfStream=function endOfStream(){this.ended_=true;if(this.transmuxer_){segmentTransmuxer.reset(this.transmuxer_);}this.gopBuffer_.length=0;this.pause();this.trigger("ended");};_proto.buffered_=function buffered_(){var trackInfo=this.getMediaInfo_();if(!this.sourceUpdater_||!trackInfo){return videojs.createTimeRanges()}if(this.loaderType_==="main"){var hasAudio=trackInfo.hasAudio,hasVideo=trackInfo.hasVideo,isMuxed=trackInfo.isMuxed;if(hasVideo&&hasAudio&&!this.audioDisabled_&&!isMuxed){return this.sourceUpdater_.buffered()}if(hasVideo){return this.sourceUpdater_.videoBuffered()}}return this.sourceUpdater_.audioBuffered()};_proto.initSegmentForMap=function initSegmentForMap(map,set){if(set===void 0){set=false;}if(!map){return null}var id=initSegmentId(map);var storedMap=this.initSegments_[id];if(set&&!storedMap&&map.bytes){this.initSegments_[id]=storedMap={resolvedUri:map.resolvedUri,byterange:map.byterange,bytes:map.bytes,tracks:map.tracks,timescales:map.timescales};}return storedMap||map};_proto.segmentKey=function segmentKey(key,set){if(set===void 0){set=false;}if(!key){return null}var id=segmentKeyId(key);var storedKey=this.keyCache_[id];if(this.cacheEncryptionKeys_&&set&&!storedKey&&key.bytes){this.keyCache_[id]=storedKey={resolvedUri:key.resolvedUri,bytes:key.bytes};}var result={resolvedUri:(storedKey||key).resolvedUri};if(storedKey){result.bytes=storedKey.bytes;}return result};_proto.couldBeginLoading_=function couldBeginLoading_(){return this.playlist_&&!this.paused()};_proto.load=function load(){this.monitorBuffer_();if(!this.playlist_){return}if(this.state==="INIT"&&this.couldBeginLoading_()){return this.init_()}if(!this.couldBeginLoading_()||this.state!=="READY"&&this.state!=="INIT"){return}this.state="READY";};_proto.init_=function init_(){this.state="READY";this.resetEverything();return this.monitorBuffer_()};_proto.playlist=function playlist(newPlaylist,options){if(options===void 0){options={};}if(!newPlaylist){return}var oldPlaylist=this.playlist_;var segmentInfo=this.pendingSegment_;this.playlist_=newPlaylist;this.xhrOptions_=options;if(this.state==="INIT"){newPlaylist.syncInfo={mediaSequence:newPlaylist.mediaSequence,time:0};if(this.loaderType_==="main"){this.syncController_.setDateTimeMappingForStart(newPlaylist);}}var oldId=null;if(oldPlaylist){if(oldPlaylist.id){oldId=oldPlaylist.id;}else if(oldPlaylist.uri){oldId=oldPlaylist.uri;}}this.logger_("playlist update ["+oldId+" => "+(newPlaylist.id||newPlaylist.uri)+"]");this.trigger("syncinfoupdate");if(this.state==="INIT"&&this.couldBeginLoading_()){return this.init_()}if(!oldPlaylist||oldPlaylist.uri!==newPlaylist.uri){if(this.mediaIndex!==null){if(!newPlaylist.endList){this.resetLoader();}else {this.resyncLoader();}}this.currentMediaInfo_=void 0;this.trigger("playlistupdate");return}var mediaSequenceDiff=newPlaylist.mediaSequence-oldPlaylist.mediaSequence;this.logger_("live window shift ["+mediaSequenceDiff+"]");if(this.mediaIndex!==null){this.mediaIndex-=mediaSequenceDiff;if(this.mediaIndex<0){this.mediaIndex=null;this.partIndex=null;}else {var segment=this.playlist_.segments[this.mediaIndex];if(this.partIndex&&(!segment.parts||!segment.parts.length||!segment.parts[this.partIndex])){var mediaIndex=this.mediaIndex;this.logger_("currently processing part (index "+this.partIndex+") no longer exists.");this.resetLoader();this.mediaIndex=mediaIndex;}}}if(segmentInfo){segmentInfo.mediaIndex-=mediaSequenceDiff;if(segmentInfo.mediaIndex<0){segmentInfo.mediaIndex=null;segmentInfo.partIndex=null;}else {if(segmentInfo.mediaIndex>=0){segmentInfo.segment=newPlaylist.segments[segmentInfo.mediaIndex];}if(segmentInfo.partIndex>=0&&segmentInfo.segment.parts){segmentInfo.part=segmentInfo.segment.parts[segmentInfo.partIndex];}}}this.syncController_.saveExpiredSegmentInfo(oldPlaylist,newPlaylist);};_proto.pause=function pause(){if(this.checkBufferTimeout_){window_1.clearTimeout(this.checkBufferTimeout_);this.checkBufferTimeout_=null;}};_proto.paused=function paused(){return this.checkBufferTimeout_===null};_proto.resetEverything=function resetEverything(done){this.ended_=false;this.appendInitSegment_={audio:true,video:true};this.resetLoader();this.remove(0,Infinity,done);if(this.transmuxer_){this.transmuxer_.postMessage({action:"clearAllMp4Captions"});this.transmuxer_.postMessage({action:"reset"});}};_proto.resetLoader=function resetLoader(){this.fetchAtBuffer_=false;this.resyncLoader();};_proto.resyncLoader=function resyncLoader(){if(this.transmuxer_){segmentTransmuxer.reset(this.transmuxer_);}this.mediaIndex=null;this.partIndex=null;this.syncPoint_=null;this.isPendingTimestampOffset_=false;this.callQueue_=[];this.loadQueue_=[];this.metadataQueue_.id3=[];this.metadataQueue_.caption=[];this.abort();if(this.transmuxer_){this.transmuxer_.postMessage({action:"clearParsedMp4Captions"});}};_proto.remove=function remove(start,end,done,force){if(done===void 0){done=function done(){};}if(force===void 0){force=false;}if(end===Infinity){end=this.duration_();}if(end<=start){this.logger_("skipping remove because end ${end} is <= start ${start}");return}if(!this.sourceUpdater_||!this.getMediaInfo_()){this.logger_("skipping remove because no source updater or starting media info");return}var removesRemaining=1;var removeFinished=function removeFinished(){removesRemaining--;if(removesRemaining===0){done();}};if(force||!this.audioDisabled_){removesRemaining++;this.sourceUpdater_.removeAudio(start,end,removeFinished);}if(force||this.loaderType_==="main"){this.gopBuffer_=removeGopBuffer(this.gopBuffer_,start,end,this.timeMapping_);removesRemaining++;this.sourceUpdater_.removeVideo(start,end,removeFinished);}for(var track in this.inbandTextTracks_){removeCuesFromTrack(start,end,this.inbandTextTracks_[track]);}removeCuesFromTrack(start,end,this.segmentMetadataTrack_);removeFinished();};_proto.monitorBuffer_=function monitorBuffer_(){if(this.checkBufferTimeout_){window_1.clearTimeout(this.checkBufferTimeout_);}this.checkBufferTimeout_=window_1.setTimeout(this.monitorBufferTick_.bind(this),1);};_proto.monitorBufferTick_=function monitorBufferTick_(){if(this.state==="READY"){this.fillBuffer_();}if(this.checkBufferTimeout_){window_1.clearTimeout(this.checkBufferTimeout_);}this.checkBufferTimeout_=window_1.setTimeout(this.monitorBufferTick_.bind(this),CHECK_BUFFER_DELAY);};_proto.fillBuffer_=function fillBuffer_(){if(this.sourceUpdater_.updating()){return}var segmentInfo=this.chooseNextRequest_();if(!segmentInfo){return}if(typeof segmentInfo.timestampOffset==="number"){this.isPendingTimestampOffset_=false;this.timelineChangeController_.pendingTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:segmentInfo.timeline});}this.loadSegment_(segmentInfo);};_proto.isEndOfStream_=function isEndOfStream_(mediaIndex,playlist,partIndex){if(mediaIndex===void 0){mediaIndex=this.mediaIndex;}if(playlist===void 0){playlist=this.playlist_;}if(partIndex===void 0){partIndex=this.partIndex;}if(!playlist||!this.mediaSource_){return false}var segment=typeof mediaIndex==="number"&&playlist.segments[mediaIndex];var appendedLastSegment=mediaIndex+1===playlist.segments.length;var appendedLastPart=!segment||!segment.parts||partIndex+1===segment.parts.length;return playlist.endList&&this.mediaSource_.readyState==="open"&&appendedLastSegment&&appendedLastPart};_proto.chooseNextRequest_=function chooseNextRequest_(){var buffered=this.buffered_();var bufferedEnd=lastBufferedEnd(buffered)||0;var bufferedTime=timeAheadOf(buffered,this.currentTime_());var preloaded=!this.hasPlayed_()&&bufferedTime>=1;var haveEnoughBuffer=bufferedTime>=this.goalBufferLength_();var segments=this.playlist_.segments;if(!segments.length||preloaded||haveEnoughBuffer){return null}this.syncPoint_=this.syncPoint_||this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_());var next={partIndex:null,mediaIndex:null,startOfSegment:null,playlist:this.playlist_,isSyncRequest:Boolean(!this.syncPoint_)};if(next.isSyncRequest){next.mediaIndex=getSyncSegmentCandidate(this.currentTimeline_,segments,bufferedEnd);}else if(this.mediaIndex!==null){var segment=segments[this.mediaIndex];var partIndex=typeof this.partIndex==="number"?this.partIndex:-1;next.startOfSegment=segment.end?segment.end:bufferedEnd;if(segment.parts&&segment.parts[partIndex+1]){next.mediaIndex=this.mediaIndex;next.partIndex=partIndex+1;}else {next.mediaIndex=this.mediaIndex+1;}}else {var _Playlist$getMediaInf=Playlist.getMediaInfoForTime({experimentalExactManifestTimings:this.experimentalExactManifestTimings,playlist:this.playlist_,currentTime:this.fetchAtBuffer_?bufferedEnd:this.currentTime_(),startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time}),segmentIndex=_Playlist$getMediaInf.segmentIndex,startTime=_Playlist$getMediaInf.startTime,_partIndex=_Playlist$getMediaInf.partIndex;next.getMediaInfoForTime=this.fetchAtBuffer_?"bufferedEnd "+bufferedEnd:"currentTime "+this.currentTime_();next.mediaIndex=segmentIndex;next.startOfSegment=startTime;next.partIndex=_partIndex;}var nextSegment=segments[next.mediaIndex];var nextPart=nextSegment&&typeof next.partIndex==="number"&&nextSegment.parts&&nextSegment.parts[next.partIndex];if(!nextSegment||typeof next.partIndex==="number"&&!nextPart){return null}if(typeof next.partIndex!=="number"&&nextSegment.parts){next.partIndex=0;nextPart=nextSegment.parts[0];}if(!bufferedTime&&nextPart&&!nextPart.independent){if(next.partIndex===0){var lastSegment=segments[next.mediaIndex-1];var lastSegmentLastPart=lastSegment.parts&&lastSegment.parts.length&&lastSegment.parts[lastSegment.parts.length-1];if(lastSegmentLastPart&&lastSegmentLastPart.independent){next.mediaIndex-=1;next.partIndex=lastSegment.parts.length-1;next.independent="previous segment";}}else if(nextSegment.parts[next.partIndex-1].independent){next.partIndex-=1;next.independent="previous part";}}var ended=this.mediaSource_&&this.mediaSource_.readyState==="ended";if(next.mediaIndex>=segments.length-1&&ended&&!this.seeking_()){return null}return this.generateSegmentInfo_(next)};_proto.generateSegmentInfo_=function generateSegmentInfo_(options){var independent=options.independent,playlist=options.playlist,mediaIndex=options.mediaIndex,startOfSegment=options.startOfSegment,isSyncRequest=options.isSyncRequest,partIndex=options.partIndex,forceTimestampOffset=options.forceTimestampOffset,getMediaInfoForTime=options.getMediaInfoForTime;var segment=playlist.segments[mediaIndex];var part=typeof partIndex==="number"&&segment.parts[partIndex];var segmentInfo={requestId:"segment-loader-"+Math.random(),uri:part&&part.resolvedUri||segment.resolvedUri,mediaIndex:mediaIndex,partIndex:part?partIndex:null,isSyncRequest:isSyncRequest,startOfSegment:startOfSegment,playlist:playlist,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:segment.timeline,duration:part&&part.duration||segment.duration,segment:segment,part:part,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:getMediaInfoForTime,independent:independent};var overrideCheck=typeof forceTimestampOffset!=="undefined"?forceTimestampOffset:this.isPendingTimestampOffset_;segmentInfo.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:segment.timeline,currentTimeline:this.currentTimeline_,startOfSegment:startOfSegment,buffered:this.buffered_(),overrideCheck:overrideCheck});var audioBufferedEnd=lastBufferedEnd(this.sourceUpdater_.audioBuffered());if(typeof audioBufferedEnd==="number"){segmentInfo.audioAppendStart=audioBufferedEnd-this.sourceUpdater_.audioTimestampOffset();}if(this.sourceUpdater_.videoBuffered().length){segmentInfo.gopsToAlignWith=gopsSafeToAlignWith(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_);}return segmentInfo};_proto.timestampOffsetForSegment_=function timestampOffsetForSegment_(options){return timestampOffsetForSegment(options)};_proto.earlyAbortWhenNeeded_=function earlyAbortWhenNeeded_(stats){if(this.vhs_.tech_.paused()||!this.xhrOptions_.timeout||!this.playlist_.attributes.BANDWIDTH){return}if(Date.now()-(stats.firstBytesReceivedAt||Date.now())<1e3){return}var currentTime=this.currentTime_();var measuredBandwidth=stats.bandwidth;var segmentDuration=this.pendingSegment_.duration;var requestTimeRemaining=Playlist.estimateSegmentRequestTime(segmentDuration,measuredBandwidth,this.playlist_,stats.bytesReceived);var timeUntilRebuffer$1=timeUntilRebuffer(this.buffered_(),currentTime,this.vhs_.tech_.playbackRate())-1;if(requestTimeRemaining<=timeUntilRebuffer$1){return}var switchCandidate=minRebufferMaxBandwidthSelector({master:this.vhs_.playlists.master,currentTime:currentTime,bandwidth:measuredBandwidth,duration:this.duration_(),segmentDuration:segmentDuration,timeUntilRebuffer:timeUntilRebuffer$1,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(!switchCandidate){return}var rebufferingImpact=requestTimeRemaining-timeUntilRebuffer$1;var timeSavedBySwitching=rebufferingImpact-switchCandidate.rebufferingImpact;var minimumTimeSaving=.5;if(timeUntilRebuffer$1<=TIME_FUDGE_FACTOR){minimumTimeSaving=1;}if(!switchCandidate.playlist||switchCandidate.playlist.uri===this.playlist_.uri||timeSavedBySwitching<minimumTimeSaving){return}this.bandwidth=switchCandidate.playlist.attributes.BANDWIDTH*Config.BANDWIDTH_VARIANCE+1;this.trigger("earlyabort");};_proto.handleAbort_=function handleAbort_(segmentInfo){this.logger_("Aborting "+segmentInfoString(segmentInfo));this.mediaRequestsAborted+=1;};_proto.handleProgress_=function handleProgress_(event,simpleSegment){this.earlyAbortWhenNeeded_(simpleSegment.stats);if(this.checkForAbort_(simpleSegment.requestId)){return}this.trigger("progress");};_proto.handleTrackInfo_=function handleTrackInfo_(simpleSegment,trackInfo){this.earlyAbortWhenNeeded_(simpleSegment.stats);if(this.checkForAbort_(simpleSegment.requestId)){return}if(this.checkForIllegalMediaSwitch(trackInfo)){return}trackInfo=trackInfo||{};if(!shallowEqual(this.currentMediaInfo_,trackInfo)){this.appendInitSegment_={audio:true,video:true};this.startingMediaInfo_=trackInfo;this.currentMediaInfo_=trackInfo;this.logger_("trackinfo update",trackInfo);this.trigger("trackinfo");}if(this.checkForAbort_(simpleSegment.requestId)){return}this.pendingSegment_.trackInfo=trackInfo;if(this.hasEnoughInfoToAppend_()){this.processCallQueue_();}};_proto.handleTimingInfo_=function handleTimingInfo_(simpleSegment,mediaType,timeType,time){this.earlyAbortWhenNeeded_(simpleSegment.stats);if(this.checkForAbort_(simpleSegment.requestId)){return}var segmentInfo=this.pendingSegment_;var timingInfoProperty=timingInfoPropertyForMedia(mediaType);segmentInfo[timingInfoProperty]=segmentInfo[timingInfoProperty]||{};segmentInfo[timingInfoProperty][timeType]=time;this.logger_("timinginfo: "+mediaType+" - "+timeType+" - "+time);if(this.hasEnoughInfoToAppend_()){this.processCallQueue_();}};_proto.handleCaptions_=function handleCaptions_(simpleSegment,captionData){var _this2=this;this.earlyAbortWhenNeeded_(simpleSegment.stats);if(this.checkForAbort_(simpleSegment.requestId)){return}if(captionData.length===0){this.logger_("SegmentLoader received no captions from a caption event");return}var segmentInfo=this.pendingSegment_;if(!segmentInfo.hasAppendedData_){this.metadataQueue_.caption.push(this.handleCaptions_.bind(this,simpleSegment,captionData));return}var timestampOffset=this.sourceUpdater_.videoTimestampOffset()===null?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset();var captionTracks={};captionData.forEach(function(caption){captionTracks[caption.stream]=captionTracks[caption.stream]||{startTime:Infinity,captions:[],endTime:0};var captionTrack=captionTracks[caption.stream];captionTrack.startTime=Math.min(captionTrack.startTime,caption.startTime+timestampOffset);captionTrack.endTime=Math.max(captionTrack.endTime,caption.endTime+timestampOffset);captionTrack.captions.push(caption);});Object.keys(captionTracks).forEach(function(trackName){var _captionTracks$trackN=captionTracks[trackName],startTime=_captionTracks$trackN.startTime,endTime=_captionTracks$trackN.endTime,captions=_captionTracks$trackN.captions;var inbandTextTracks=_this2.inbandTextTracks_;_this2.logger_("adding cues from "+startTime+" -> "+endTime+" for "+trackName);createCaptionsTrackIfNotExists(inbandTextTracks,_this2.vhs_.tech_,trackName);removeCuesFromTrack(startTime,endTime,inbandTextTracks[trackName]);addCaptionData({captionArray:captions,inbandTextTracks:inbandTextTracks,timestampOffset:timestampOffset});});if(this.transmuxer_){this.transmuxer_.postMessage({action:"clearParsedMp4Captions"});}};_proto.handleId3_=function handleId3_(simpleSegment,id3Frames,dispatchType){this.earlyAbortWhenNeeded_(simpleSegment.stats);if(this.checkForAbort_(simpleSegment.requestId)){return}var segmentInfo=this.pendingSegment_;if(!segmentInfo.hasAppendedData_){this.metadataQueue_.id3.push(this.handleId3_.bind(this,simpleSegment,id3Frames,dispatchType));return}var timestampOffset=this.sourceUpdater_.videoTimestampOffset()===null?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset();createMetadataTrackIfNotExists(this.inbandTextTracks_,dispatchType,this.vhs_.tech_);addMetadata({inbandTextTracks:this.inbandTextTracks_,metadataArray:id3Frames,timestampOffset:timestampOffset,videoDuration:this.duration_()});};_proto.processMetadataQueue_=function processMetadataQueue_(){this.metadataQueue_.id3.forEach(function(fn){return fn()});this.metadataQueue_.caption.forEach(function(fn){return fn()});this.metadataQueue_.id3=[];this.metadataQueue_.caption=[];};_proto.processCallQueue_=function processCallQueue_(){var callQueue=this.callQueue_;this.callQueue_=[];callQueue.forEach(function(fun){return fun()});};_proto.processLoadQueue_=function processLoadQueue_(){var loadQueue=this.loadQueue_;this.loadQueue_=[];loadQueue.forEach(function(fun){return fun()});};_proto.hasEnoughInfoToLoad_=function hasEnoughInfoToLoad_(){if(this.loaderType_!=="audio"){return true}var segmentInfo=this.pendingSegment_;if(!segmentInfo){return false}if(!this.getCurrentMediaInfo_()){return true}if(shouldWaitForTimelineChange({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:segmentInfo.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_})){return false}return true};_proto.getCurrentMediaInfo_=function getCurrentMediaInfo_(segmentInfo){if(segmentInfo===void 0){segmentInfo=this.pendingSegment_;}return segmentInfo&&segmentInfo.trackInfo||this.currentMediaInfo_};_proto.getMediaInfo_=function getMediaInfo_(segmentInfo){if(segmentInfo===void 0){segmentInfo=this.pendingSegment_;}return this.getCurrentMediaInfo_(segmentInfo)||this.startingMediaInfo_};_proto.hasEnoughInfoToAppend_=function hasEnoughInfoToAppend_(){if(!this.sourceUpdater_.ready()){return false}if(this.waitingOnRemove_||this.quotaExceededErrorRetryTimeout_){return false}var segmentInfo=this.pendingSegment_;var trackInfo=this.getCurrentMediaInfo_();if(!segmentInfo||!trackInfo){return false}var hasAudio=trackInfo.hasAudio,hasVideo=trackInfo.hasVideo,isMuxed=trackInfo.isMuxed;if(hasVideo&&!segmentInfo.videoTimingInfo){return false}if(hasAudio&&!this.audioDisabled_&&!isMuxed&&!segmentInfo.audioTimingInfo){return false}if(shouldWaitForTimelineChange({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:segmentInfo.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_})){return false}return true};_proto.handleData_=function handleData_(simpleSegment,result){this.earlyAbortWhenNeeded_(simpleSegment.stats);if(this.checkForAbort_(simpleSegment.requestId)){return}if(this.callQueue_.length||!this.hasEnoughInfoToAppend_()){this.callQueue_.push(this.handleData_.bind(this,simpleSegment,result));return}var segmentInfo=this.pendingSegment_;this.setTimeMapping_(segmentInfo.timeline);this.updateMediaSecondsLoaded_(segmentInfo.part||segmentInfo.segment);if(this.mediaSource_.readyState==="closed"){return}if(simpleSegment.map){simpleSegment.map=this.initSegmentForMap(simpleSegment.map,true);segmentInfo.segment.map=simpleSegment.map;}if(simpleSegment.key){this.segmentKey(simpleSegment.key,true);}segmentInfo.isFmp4=simpleSegment.isFmp4;segmentInfo.timingInfo=segmentInfo.timingInfo||{};if(segmentInfo.isFmp4){this.trigger("fmp4");segmentInfo.timingInfo.start=segmentInfo[timingInfoPropertyForMedia(result.type)].start;}else {var trackInfo=this.getCurrentMediaInfo_();var useVideoTimingInfo=this.loaderType_==="main"&&trackInfo&&trackInfo.hasVideo;var firstVideoFrameTimeForData;if(useVideoTimingInfo){firstVideoFrameTimeForData=segmentInfo.videoTimingInfo.start;}segmentInfo.timingInfo.start=this.trueSegmentStart_({currentStart:segmentInfo.timingInfo.start,playlist:segmentInfo.playlist,mediaIndex:segmentInfo.mediaIndex,currentVideoTimestampOffset:this.sourceUpdater_.videoTimestampOffset(),useVideoTimingInfo:useVideoTimingInfo,firstVideoFrameTimeForData:firstVideoFrameTimeForData,videoTimingInfo:segmentInfo.videoTimingInfo,audioTimingInfo:segmentInfo.audioTimingInfo});}this.updateAppendInitSegmentStatus(segmentInfo,result.type);this.updateSourceBufferTimestampOffset_(segmentInfo);if(segmentInfo.isSyncRequest){this.updateTimingInfoEnd_(segmentInfo);this.syncController_.saveSegmentTimingInfo({segmentInfo:segmentInfo,shouldSaveTimelineMapping:this.loaderType_==="main"});var next=this.chooseNextRequest_();if(next.mediaIndex!==segmentInfo.mediaIndex||next.partIndex!==segmentInfo.partIndex){this.logger_("sync segment was incorrect, not appending");return}this.logger_("sync segment was correct, appending");}segmentInfo.hasAppendedData_=true;this.processMetadataQueue_();this.appendData_(segmentInfo,result);};_proto.updateAppendInitSegmentStatus=function updateAppendInitSegmentStatus(segmentInfo,type){if(this.loaderType_==="main"&&typeof segmentInfo.timestampOffset==="number"&&!segmentInfo.changedTimestampOffset){this.appendInitSegment_={audio:true,video:true};}if(this.playlistOfLastInitSegment_[type]!==segmentInfo.playlist){this.appendInitSegment_[type]=true;}};_proto.getInitSegmentAndUpdateState_=function getInitSegmentAndUpdateState_(_ref4){var type=_ref4.type,initSegment=_ref4.initSegment,map=_ref4.map,playlist=_ref4.playlist;if(map){var id=initSegmentId(map);if(this.activeInitSegmentId_===id){return null}initSegment=this.initSegmentForMap(map,true).bytes;this.activeInitSegmentId_=id;}if(initSegment&&this.appendInitSegment_[type]){this.playlistOfLastInitSegment_[type]=playlist;this.appendInitSegment_[type]=false;this.activeInitSegmentId_=null;return initSegment}return null};_proto.handleQuotaExceededError_=function handleQuotaExceededError_(_ref5,error){var _this3=this;var segmentInfo=_ref5.segmentInfo,type=_ref5.type,bytes=_ref5.bytes;var audioBuffered=this.sourceUpdater_.audioBuffered();var videoBuffered=this.sourceUpdater_.videoBuffered();if(audioBuffered.length>1){this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: "+timeRangesToArray(audioBuffered).join(", "));}if(videoBuffered.length>1){this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: "+timeRangesToArray(videoBuffered).join(", "));}var audioBufferStart=audioBuffered.length?audioBuffered.start(0):0;var audioBufferEnd=audioBuffered.length?audioBuffered.end(audioBuffered.length-1):0;var videoBufferStart=videoBuffered.length?videoBuffered.start(0):0;var videoBufferEnd=videoBuffered.length?videoBuffered.end(videoBuffered.length-1):0;if(audioBufferEnd-audioBufferStart<=MIN_BACK_BUFFER&&videoBufferEnd-videoBufferStart<=MIN_BACK_BUFFER){this.logger_("On QUOTA_EXCEEDED_ERR, single segment too large to append to "+"buffer, triggering an error. "+("Appended byte length: "+bytes.byteLength+", ")+("audio buffer: "+timeRangesToArray(audioBuffered).join(", ")+", ")+("video buffer: "+timeRangesToArray(videoBuffered).join(", ")+", "));this.error({message:"Quota exceeded error with append of a single segment of content",excludeUntil:Infinity});this.trigger("error");return}this.waitingOnRemove_=true;this.callQueue_.push(this.appendToSourceBuffer_.bind(this,{segmentInfo:segmentInfo,type:type,bytes:bytes}));var currentTime=this.currentTime_();var timeToRemoveUntil=currentTime-MIN_BACK_BUFFER;this.logger_("On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to "+timeToRemoveUntil);this.remove(0,timeToRemoveUntil,function(){_this3.logger_("On QUOTA_EXCEEDED_ERR, retrying append in "+MIN_BACK_BUFFER+"s");_this3.waitingOnRemove_=false;_this3.quotaExceededErrorRetryTimeout_=window_1.setTimeout(function(){_this3.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue");_this3.quotaExceededErrorRetryTimeout_=null;_this3.processCallQueue_();},MIN_BACK_BUFFER*1e3);},true);};_proto.handleAppendError_=function handleAppendError_(_ref6,error){var segmentInfo=_ref6.segmentInfo,type=_ref6.type,bytes=_ref6.bytes;if(!error){return}if(error.code===QUOTA_EXCEEDED_ERR){this.handleQuotaExceededError_({segmentInfo:segmentInfo,type:type,bytes:bytes});return}this.logger_("Received non QUOTA_EXCEEDED_ERR on append",error);this.error(type+" append of "+bytes.length+"b failed for segment "+("#"+segmentInfo.mediaIndex+" in playlist "+segmentInfo.playlist.id));this.trigger("appenderror");};_proto.appendToSourceBuffer_=function appendToSourceBuffer_(_ref7){var segmentInfo=_ref7.segmentInfo,type=_ref7.type,initSegment=_ref7.initSegment,data=_ref7.data,bytes=_ref7.bytes;if(!bytes){var segments=[data];var byteLength=data.byteLength;if(initSegment){segments.unshift(initSegment);byteLength+=initSegment.byteLength;}bytes=concatSegments({bytes:byteLength,segments:segments});}this.sourceUpdater_.appendBuffer({segmentInfo:segmentInfo,type:type,bytes:bytes},this.handleAppendError_.bind(this,{segmentInfo:segmentInfo,type:type,bytes:bytes}));};_proto.handleSegmentTimingInfo_=function handleSegmentTimingInfo_(type,requestId,segmentTimingInfo){if(!this.pendingSegment_||requestId!==this.pendingSegment_.requestId){return}var segment=this.pendingSegment_.segment;var timingInfoProperty=type+"TimingInfo";if(!segment[timingInfoProperty]){segment[timingInfoProperty]={};}segment[timingInfoProperty].transmuxerPrependedSeconds=segmentTimingInfo.prependedContentDuration||0;segment[timingInfoProperty].transmuxedPresentationStart=segmentTimingInfo.start.presentation;segment[timingInfoProperty].transmuxedDecodeStart=segmentTimingInfo.start.decode;segment[timingInfoProperty].transmuxedPresentationEnd=segmentTimingInfo.end.presentation;segment[timingInfoProperty].transmuxedDecodeEnd=segmentTimingInfo.end.decode;segment[timingInfoProperty].baseMediaDecodeTime=segmentTimingInfo.baseMediaDecodeTime;};_proto.appendData_=function appendData_(segmentInfo,result){var type=result.type,data=result.data;if(!data||!data.byteLength){return}if(type==="audio"&&this.audioDisabled_){return}var initSegment=this.getInitSegmentAndUpdateState_({type:type,initSegment:result.initSegment,playlist:segmentInfo.playlist,map:segmentInfo.isFmp4?segmentInfo.segment.map:null});this.appendToSourceBuffer_({segmentInfo:segmentInfo,type:type,initSegment:initSegment,data:data});};_proto.loadSegment_=function loadSegment_(segmentInfo){var _this4=this;this.state="WAITING";this.pendingSegment_=segmentInfo;this.trimBackBuffer_(segmentInfo);if(typeof segmentInfo.timestampOffset==="number"){if(this.transmuxer_){this.transmuxer_.postMessage({action:"clearAllMp4Captions"});}}if(!this.hasEnoughInfoToLoad_()){this.loadQueue_.push(function(){var options=_extends$3({},segmentInfo,{forceTimestampOffset:true});_extends$3(segmentInfo,_this4.generateSegmentInfo_(options));_this4.isPendingTimestampOffset_=false;_this4.updateTransmuxerAndRequestSegment_(segmentInfo);});return}this.updateTransmuxerAndRequestSegment_(segmentInfo);};_proto.updateTransmuxerAndRequestSegment_=function updateTransmuxerAndRequestSegment_(segmentInfo){var _this5=this;if(this.shouldUpdateTransmuxerTimestampOffset_(segmentInfo.timestampOffset)){this.gopBuffer_.length=0;segmentInfo.gopsToAlignWith=[];this.timeMapping_=0;this.transmuxer_.postMessage({action:"reset"});this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:segmentInfo.timestampOffset});}var simpleSegment=this.createSimplifiedSegmentObj_(segmentInfo);var isEndOfStream=this.isEndOfStream_(segmentInfo.mediaIndex,segmentInfo.playlist,segmentInfo.partIndex);var isWalkingForward=this.mediaIndex!==null;var isDiscontinuity=segmentInfo.timeline!==this.currentTimeline_&&segmentInfo.timeline>0;var isEndOfTimeline=isEndOfStream||isWalkingForward&&isDiscontinuity;this.logger_("Requesting "+segmentInfoString(segmentInfo));if(simpleSegment.map&&!simpleSegment.map.bytes){this.logger_("going to request init segment.");this.appendInitSegment_={video:true,audio:true};}segmentInfo.abortRequests=mediaSegmentRequest({xhr:this.vhs_.xhr,xhrOptions:this.xhrOptions_,decryptionWorker:this.decrypter_,segment:simpleSegment,abortFn:this.handleAbort_.bind(this,segmentInfo),progressFn:this.handleProgress_.bind(this),trackInfoFn:this.handleTrackInfo_.bind(this),timingInfoFn:this.handleTimingInfo_.bind(this),videoSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"video",segmentInfo.requestId),audioSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"audio",segmentInfo.requestId),captionsFn:this.handleCaptions_.bind(this),isEndOfTimeline:isEndOfTimeline,endedTimelineFn:function endedTimelineFn(){_this5.logger_("received endedtimeline callback");},id3Fn:this.handleId3_.bind(this),dataFn:this.handleData_.bind(this),doneFn:this.segmentRequestFinished_.bind(this),onTransmuxerLog:function onTransmuxerLog(_ref8){var message=_ref8.message,level=_ref8.level,stream=_ref8.stream;_this5.logger_(segmentInfoString(segmentInfo)+" logged from transmuxer stream "+stream+" as a "+level+": "+message);}});};_proto.trimBackBuffer_=function trimBackBuffer_(segmentInfo){var removeToTime=safeBackBufferTrimTime(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);if(removeToTime>0){this.remove(0,removeToTime);}};_proto.createSimplifiedSegmentObj_=function createSimplifiedSegmentObj_(segmentInfo){var segment=segmentInfo.segment;var part=segmentInfo.part;var simpleSegment={resolvedUri:part?part.resolvedUri:segment.resolvedUri,byterange:part?part.byterange:segment.byterange,requestId:segmentInfo.requestId,transmuxer:segmentInfo.transmuxer,audioAppendStart:segmentInfo.audioAppendStart,gopsToAlignWith:segmentInfo.gopsToAlignWith,part:segmentInfo.part};var previousSegment=segmentInfo.playlist.segments[segmentInfo.mediaIndex-1];if(previousSegment&&previousSegment.timeline===segment.timeline){if(previousSegment.videoTimingInfo){simpleSegment.baseStartTime=previousSegment.videoTimingInfo.transmuxedDecodeEnd;}else if(previousSegment.audioTimingInfo){simpleSegment.baseStartTime=previousSegment.audioTimingInfo.transmuxedDecodeEnd;}}if(segment.key){var iv=segment.key.iv||new Uint32Array([0,0,0,segmentInfo.mediaIndex+segmentInfo.playlist.mediaSequence]);simpleSegment.key=this.segmentKey(segment.key);simpleSegment.key.iv=iv;}if(segment.map){simpleSegment.map=this.initSegmentForMap(segment.map);}return simpleSegment};_proto.saveTransferStats_=function saveTransferStats_(stats){this.mediaRequests+=1;if(stats){this.mediaBytesTransferred+=stats.bytesReceived;this.mediaTransferDuration+=stats.roundTripTime;}};_proto.saveBandwidthRelatedStats_=function saveBandwidthRelatedStats_(duration,stats){this.pendingSegment_.byteLength=stats.bytesReceived;if(duration<MIN_SEGMENT_DURATION_TO_SAVE_STATS){this.logger_("Ignoring segment's bandwidth because its duration of "+duration+(" is less than the min to record "+MIN_SEGMENT_DURATION_TO_SAVE_STATS));return}this.bandwidth=stats.bandwidth;this.roundTrip=stats.roundTripTime;};_proto.handleTimeout_=function handleTimeout_(){this.mediaRequestsTimedout+=1;this.bandwidth=1;this.roundTrip=NaN;this.trigger("bandwidthupdate");this.trigger("timeout");};_proto.segmentRequestFinished_=function segmentRequestFinished_(error,simpleSegment,result){if(this.callQueue_.length){this.callQueue_.push(this.segmentRequestFinished_.bind(this,error,simpleSegment,result));return}this.saveTransferStats_(simpleSegment.stats);if(!this.pendingSegment_){return}if(simpleSegment.requestId!==this.pendingSegment_.requestId){return}if(error){this.pendingSegment_=null;this.state="READY";if(error.code===REQUEST_ERRORS.ABORTED){return}this.pause();if(error.code===REQUEST_ERRORS.TIMEOUT){this.handleTimeout_();return}this.mediaRequestsErrored+=1;this.error(error);this.trigger("error");return}var segmentInfo=this.pendingSegment_;this.saveBandwidthRelatedStats_(segmentInfo.duration,simpleSegment.stats);segmentInfo.endOfAllRequests=simpleSegment.endOfAllRequests;if(result.gopInfo){this.gopBuffer_=updateGopBuffer(this.gopBuffer_,result.gopInfo,this.safeAppend_);}this.state="APPENDING";this.trigger("appending");this.waitForAppendsToComplete_(segmentInfo);};_proto.setTimeMapping_=function setTimeMapping_(timeline){var timelineMapping=this.syncController_.mappingForTimeline(timeline);if(timelineMapping!==null){this.timeMapping_=timelineMapping;}};_proto.updateMediaSecondsLoaded_=function updateMediaSecondsLoaded_(segment){if(typeof segment.start==="number"&&typeof segment.end==="number"){this.mediaSecondsLoaded+=segment.end-segment.start;}else {this.mediaSecondsLoaded+=segment.duration;}};_proto.shouldUpdateTransmuxerTimestampOffset_=function shouldUpdateTransmuxerTimestampOffset_(timestampOffset){if(timestampOffset===null){return false}if(this.loaderType_==="main"&×tampOffset!==this.sourceUpdater_.videoTimestampOffset()){return true}if(!this.audioDisabled_&×tampOffset!==this.sourceUpdater_.audioTimestampOffset()){return true}return false};_proto.trueSegmentStart_=function trueSegmentStart_(_ref9){var currentStart=_ref9.currentStart,playlist=_ref9.playlist,mediaIndex=_ref9.mediaIndex,firstVideoFrameTimeForData=_ref9.firstVideoFrameTimeForData,currentVideoTimestampOffset=_ref9.currentVideoTimestampOffset,useVideoTimingInfo=_ref9.useVideoTimingInfo,videoTimingInfo=_ref9.videoTimingInfo,audioTimingInfo=_ref9.audioTimingInfo;if(typeof currentStart!=="undefined"){return currentStart}if(!useVideoTimingInfo){return audioTimingInfo.start}var previousSegment=playlist.segments[mediaIndex-1];if(mediaIndex===0||!previousSegment||typeof previousSegment.start==="undefined"||previousSegment.end!==firstVideoFrameTimeForData+currentVideoTimestampOffset){return firstVideoFrameTimeForData}return videoTimingInfo.start};_proto.waitForAppendsToComplete_=function waitForAppendsToComplete_(segmentInfo){var trackInfo=this.getCurrentMediaInfo_(segmentInfo);if(!trackInfo){this.error({message:"No starting media returned, likely due to an unsupported media format.",blacklistDuration:Infinity});this.trigger("error");return}var hasAudio=trackInfo.hasAudio,hasVideo=trackInfo.hasVideo,isMuxed=trackInfo.isMuxed;var waitForVideo=this.loaderType_==="main"&&hasVideo;var waitForAudio=!this.audioDisabled_&&hasAudio&&!isMuxed;segmentInfo.waitingOnAppends=0;if(!segmentInfo.hasAppendedData_){if(!segmentInfo.timingInfo&&typeof segmentInfo.timestampOffset==="number"){this.isPendingTimestampOffset_=true;}segmentInfo.timingInfo={start:0};segmentInfo.waitingOnAppends++;if(!this.isPendingTimestampOffset_){this.updateSourceBufferTimestampOffset_(segmentInfo);this.processMetadataQueue_();}this.checkAppendsDone_(segmentInfo);return}if(waitForVideo){segmentInfo.waitingOnAppends++;}if(waitForAudio){segmentInfo.waitingOnAppends++;}if(waitForVideo){this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this,segmentInfo));}if(waitForAudio){this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this,segmentInfo));}};_proto.checkAppendsDone_=function checkAppendsDone_(segmentInfo){if(this.checkForAbort_(segmentInfo.requestId)){return}segmentInfo.waitingOnAppends--;if(segmentInfo.waitingOnAppends===0){this.handleAppendsDone_();}};_proto.checkForIllegalMediaSwitch=function checkForIllegalMediaSwitch(trackInfo){var illegalMediaSwitchError=illegalMediaSwitch(this.loaderType_,this.getCurrentMediaInfo_(),trackInfo);if(illegalMediaSwitchError){this.error({message:illegalMediaSwitchError,blacklistDuration:Infinity});this.trigger("error");return true}return false};_proto.updateSourceBufferTimestampOffset_=function updateSourceBufferTimestampOffset_(segmentInfo){if(segmentInfo.timestampOffset===null||typeof segmentInfo.timingInfo.start!=="number"||segmentInfo.changedTimestampOffset||this.loaderType_!=="main"){return}var didChange=false;segmentInfo.timestampOffset-=this.getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:segmentInfo.segment.videoTimingInfo,audioTimingInfo:segmentInfo.segment.audioTimingInfo,timingInfo:segmentInfo.timingInfo});segmentInfo.changedTimestampOffset=true;if(segmentInfo.timestampOffset!==this.sourceUpdater_.videoTimestampOffset()){this.sourceUpdater_.videoTimestampOffset(segmentInfo.timestampOffset);didChange=true;}if(segmentInfo.timestampOffset!==this.sourceUpdater_.audioTimestampOffset()){this.sourceUpdater_.audioTimestampOffset(segmentInfo.timestampOffset);didChange=true;}if(didChange){this.trigger("timestampoffset");}};_proto.getSegmentStartTimeForTimestampOffsetCalculation_=function getSegmentStartTimeForTimestampOffsetCalculation_(_ref10){var videoTimingInfo=_ref10.videoTimingInfo,audioTimingInfo=_ref10.audioTimingInfo,timingInfo=_ref10.timingInfo;if(!this.useDtsForTimestampOffset_){return timingInfo.start}if(videoTimingInfo&&typeof videoTimingInfo.transmuxedDecodeStart==="number"){return videoTimingInfo.transmuxedDecodeStart}if(audioTimingInfo&&typeof audioTimingInfo.transmuxedDecodeStart==="number"){return audioTimingInfo.transmuxedDecodeStart}return timingInfo.start};_proto.updateTimingInfoEnd_=function updateTimingInfoEnd_(segmentInfo){segmentInfo.timingInfo=segmentInfo.timingInfo||{};var trackInfo=this.getMediaInfo_();var useVideoTimingInfo=this.loaderType_==="main"&&trackInfo&&trackInfo.hasVideo;var prioritizedTimingInfo=useVideoTimingInfo&&segmentInfo.videoTimingInfo?segmentInfo.videoTimingInfo:segmentInfo.audioTimingInfo;if(!prioritizedTimingInfo){return}segmentInfo.timingInfo.end=typeof prioritizedTimingInfo.end==="number"?prioritizedTimingInfo.end:prioritizedTimingInfo.start+segmentInfo.duration;};_proto.handleAppendsDone_=function handleAppendsDone_(){if(this.pendingSegment_){this.trigger("appendsdone");}if(!this.pendingSegment_){this.state="READY";if(!this.paused()){this.monitorBuffer_();}return}var segmentInfo=this.pendingSegment_;this.updateTimingInfoEnd_(segmentInfo);if(this.shouldSaveSegmentTimingInfo_){this.syncController_.saveSegmentTimingInfo({segmentInfo:segmentInfo,shouldSaveTimelineMapping:this.loaderType_==="main"});}var segmentDurationMessage=getTroublesomeSegmentDurationMessage(segmentInfo,this.sourceType_);if(segmentDurationMessage){if(segmentDurationMessage.severity==="warn"){videojs.log.warn(segmentDurationMessage.message);}else {this.logger_(segmentDurationMessage.message);}}this.recordThroughput_(segmentInfo);this.pendingSegment_=null;this.state="READY";if(segmentInfo.isSyncRequest){this.trigger("syncinfoupdate");if(!segmentInfo.hasAppendedData_){this.logger_("Throwing away un-appended sync request "+segmentInfoString(segmentInfo));return}}this.logger_("Appended "+segmentInfoString(segmentInfo));this.addSegmentMetadataCue_(segmentInfo);this.fetchAtBuffer_=true;if(this.currentTimeline_!==segmentInfo.timeline){this.timelineChangeController_.lastTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:segmentInfo.timeline});if(this.loaderType_==="main"&&!this.audioDisabled_){this.timelineChangeController_.lastTimelineChange({type:"audio",from:this.currentTimeline_,to:segmentInfo.timeline});}}this.currentTimeline_=segmentInfo.timeline;this.trigger("syncinfoupdate");var segment=segmentInfo.segment;var part=segmentInfo.part;var badSegmentGuess=segment.end&&this.currentTime_()-segment.end>segmentInfo.playlist.targetDuration*3;var badPartGuess=part&&part.end&&this.currentTime_()-part.end>segmentInfo.playlist.partTargetDuration*3;if(badSegmentGuess||badPartGuess){this.logger_("bad "+(badSegmentGuess?"segment":"part")+" "+segmentInfoString(segmentInfo));this.resetEverything();return}var isWalkingForward=this.mediaIndex!==null;if(isWalkingForward){this.trigger("bandwidthupdate");}this.trigger("progress");this.mediaIndex=segmentInfo.mediaIndex;this.partIndex=segmentInfo.partIndex;if(this.isEndOfStream_(segmentInfo.mediaIndex,segmentInfo.playlist,segmentInfo.partIndex)){this.endOfStream();}this.trigger("appended");if(segmentInfo.hasAppendedData_){this.mediaAppends++;}if(!this.paused()){this.monitorBuffer_();}};_proto.recordThroughput_=function recordThroughput_(segmentInfo){if(segmentInfo.duration<MIN_SEGMENT_DURATION_TO_SAVE_STATS){this.logger_("Ignoring segment's throughput because its duration of "+segmentInfo.duration+(" is less than the min to record "+MIN_SEGMENT_DURATION_TO_SAVE_STATS));return}var rate=this.throughput.rate;var segmentProcessingTime=Date.now()-segmentInfo.endOfAllRequests+1;var segmentProcessingThroughput=Math.floor(segmentInfo.byteLength/segmentProcessingTime*8*1e3);this.throughput.rate+=(segmentProcessingThroughput-rate)/++this.throughput.count;};_proto.addSegmentMetadataCue_=function addSegmentMetadataCue_(segmentInfo){if(!this.segmentMetadataTrack_){return}var segment=segmentInfo.segment;var start=segment.start;var end=segment.end;if(!finite(start)||!finite(end)){return}removeCuesFromTrack(start,end,this.segmentMetadataTrack_);var Cue=window_1.WebKitDataCue||window_1.VTTCue;var value={custom:segment.custom,dateTimeObject:segment.dateTimeObject,dateTimeString:segment.dateTimeString,bandwidth:segmentInfo.playlist.attributes.BANDWIDTH,resolution:segmentInfo.playlist.attributes.RESOLUTION,codecs:segmentInfo.playlist.attributes.CODECS,byteLength:segmentInfo.byteLength,uri:segmentInfo.uri,timeline:segmentInfo.timeline,playlist:segmentInfo.playlist.id,start:start,end:end};var data=JSON.stringify(value);var cue=new Cue(start,end,data);cue.value=value;this.segmentMetadataTrack_.addCue(cue);};return SegmentLoader}(videojs.EventTarget);function noop(){}var toTitleCase=function toTitleCase(string){if(typeof string!=="string"){return string}return string.replace(/./,function(w){return w.toUpperCase()})};var bufferTypes=["video","audio"];var _updating=function updating(type,sourceUpdater){var sourceBuffer=sourceUpdater[type+"Buffer"];return sourceBuffer&&sourceBuffer.updating||sourceUpdater.queuePending[type]};var nextQueueIndexOfType=function nextQueueIndexOfType(type,queue){for(var i=0;i<queue.length;i++){var queueEntry=queue[i];if(queueEntry.type==="mediaSource"){return null}if(queueEntry.type===type){return i}}return null};var shiftQueue=function shiftQueue(type,sourceUpdater){if(sourceUpdater.queue.length===0){return}var queueIndex=0;var queueEntry=sourceUpdater.queue[queueIndex];if(queueEntry.type==="mediaSource"){if(!sourceUpdater.updating()&&sourceUpdater.mediaSource.readyState!=="closed"){sourceUpdater.queue.shift();queueEntry.action(sourceUpdater);if(queueEntry.doneFn){queueEntry.doneFn();}shiftQueue("audio",sourceUpdater);shiftQueue("video",sourceUpdater);}return}if(type==="mediaSource"){return}if(!sourceUpdater.ready()||sourceUpdater.mediaSource.readyState==="closed"||_updating(type,sourceUpdater)){return}if(queueEntry.type!==type){queueIndex=nextQueueIndexOfType(type,sourceUpdater.queue);if(queueIndex===null){return}queueEntry=sourceUpdater.queue[queueIndex];}sourceUpdater.queue.splice(queueIndex,1);sourceUpdater.queuePending[type]=queueEntry;queueEntry.action(type,sourceUpdater);if(!queueEntry.doneFn){sourceUpdater.queuePending[type]=null;shiftQueue(type,sourceUpdater);return}};var cleanupBuffer=function cleanupBuffer(type,sourceUpdater){var buffer=sourceUpdater[type+"Buffer"];var titleType=toTitleCase(type);if(!buffer){return}buffer.removeEventListener("updateend",sourceUpdater["on"+titleType+"UpdateEnd_"]);buffer.removeEventListener("error",sourceUpdater["on"+titleType+"Error_"]);sourceUpdater.codecs[type]=null;sourceUpdater[type+"Buffer"]=null;};var inSourceBuffers=function inSourceBuffers(mediaSource,sourceBuffer){return mediaSource&&sourceBuffer&&Array.prototype.indexOf.call(mediaSource.sourceBuffers,sourceBuffer)!==-1};var actions={appendBuffer:function appendBuffer(bytes,segmentInfo,onError){return function(type,sourceUpdater){var sourceBuffer=sourceUpdater[type+"Buffer"];if(!inSourceBuffers(sourceUpdater.mediaSource,sourceBuffer)){return}sourceUpdater.logger_("Appending segment "+segmentInfo.mediaIndex+"'s "+bytes.length+" bytes to "+type+"Buffer");try{sourceBuffer.appendBuffer(bytes);}catch(e){sourceUpdater.logger_("Error with code "+e.code+" "+(e.code===QUOTA_EXCEEDED_ERR?"(QUOTA_EXCEEDED_ERR) ":"")+("when appending segment "+segmentInfo.mediaIndex+" to "+type+"Buffer"));sourceUpdater.queuePending[type]=null;onError(e);}}},remove:function remove(start,end){return function(type,sourceUpdater){var sourceBuffer=sourceUpdater[type+"Buffer"];if(!inSourceBuffers(sourceUpdater.mediaSource,sourceBuffer)){return}sourceUpdater.logger_("Removing "+start+" to "+end+" from "+type+"Buffer");try{sourceBuffer.remove(start,end);}catch(e){sourceUpdater.logger_("Remove "+start+" to "+end+" from "+type+"Buffer failed");}}},timestampOffset:function timestampOffset(offset){return function(type,sourceUpdater){var sourceBuffer=sourceUpdater[type+"Buffer"];if(!inSourceBuffers(sourceUpdater.mediaSource,sourceBuffer)){return}sourceUpdater.logger_("Setting "+type+"timestampOffset to "+offset);sourceBuffer.timestampOffset=offset;}},callback:function callback(_callback){return function(type,sourceUpdater){_callback();}},endOfStream:function endOfStream(error){return function(sourceUpdater){if(sourceUpdater.mediaSource.readyState!=="open"){return}sourceUpdater.logger_("Calling mediaSource endOfStream("+(error||"")+")");try{sourceUpdater.mediaSource.endOfStream(error);}catch(e){videojs.log.warn("Failed to call media source endOfStream",e);}}},duration:function duration(_duration){return function(sourceUpdater){sourceUpdater.logger_("Setting mediaSource duration to "+_duration);try{sourceUpdater.mediaSource.duration=_duration;}catch(e){videojs.log.warn("Failed to set media source duration",e);}}},abort:function abort(){return function(type,sourceUpdater){if(sourceUpdater.mediaSource.readyState!=="open"){return}var sourceBuffer=sourceUpdater[type+"Buffer"];if(!inSourceBuffers(sourceUpdater.mediaSource,sourceBuffer)){return}sourceUpdater.logger_("calling abort on "+type+"Buffer");try{sourceBuffer.abort();}catch(e){videojs.log.warn("Failed to abort on "+type+"Buffer",e);}}},addSourceBuffer:function addSourceBuffer(type,codec){return function(sourceUpdater){var titleType=toTitleCase(type);var mime=getMimeForCodec(codec);sourceUpdater.logger_("Adding "+type+"Buffer with codec "+codec+" to mediaSource");var sourceBuffer=sourceUpdater.mediaSource.addSourceBuffer(mime);sourceBuffer.addEventListener("updateend",sourceUpdater["on"+titleType+"UpdateEnd_"]);sourceBuffer.addEventListener("error",sourceUpdater["on"+titleType+"Error_"]);sourceUpdater.codecs[type]=codec;sourceUpdater[type+"Buffer"]=sourceBuffer;}},removeSourceBuffer:function removeSourceBuffer(type){return function(sourceUpdater){var sourceBuffer=sourceUpdater[type+"Buffer"];cleanupBuffer(type,sourceUpdater);if(!inSourceBuffers(sourceUpdater.mediaSource,sourceBuffer)){return}sourceUpdater.logger_("Removing "+type+"Buffer with codec "+sourceUpdater.codecs[type]+" from mediaSource");try{sourceUpdater.mediaSource.removeSourceBuffer(sourceBuffer);}catch(e){videojs.log.warn("Failed to removeSourceBuffer "+type+"Buffer",e);}}},changeType:function changeType(codec){return function(type,sourceUpdater){var sourceBuffer=sourceUpdater[type+"Buffer"];var mime=getMimeForCodec(codec);if(!inSourceBuffers(sourceUpdater.mediaSource,sourceBuffer)){return}if(sourceUpdater.codecs[type]===codec){return}sourceUpdater.logger_("changing "+type+"Buffer codec from "+sourceUpdater.codecs[type]+" to "+codec);sourceBuffer.changeType(mime);sourceUpdater.codecs[type]=codec;}}};var pushQueue=function pushQueue(_ref){var type=_ref.type,sourceUpdater=_ref.sourceUpdater,action=_ref.action,doneFn=_ref.doneFn,name=_ref.name;sourceUpdater.queue.push({type:type,action:action,doneFn:doneFn,name:name});shiftQueue(type,sourceUpdater);};var onUpdateend=function onUpdateend(type,sourceUpdater){return function(e){if(sourceUpdater.queuePending[type]){var doneFn=sourceUpdater.queuePending[type].doneFn;sourceUpdater.queuePending[type]=null;if(doneFn){doneFn(sourceUpdater[type+"Error_"]);}}shiftQueue(type,sourceUpdater);}};var SourceUpdater=function(_videojs$EventTarget){_inheritsLoose(SourceUpdater,_videojs$EventTarget);function SourceUpdater(mediaSource){var _this;_this=_videojs$EventTarget.call(this)||this;_this.mediaSource=mediaSource;_this.sourceopenListener_=function(){return shiftQueue("mediaSource",_assertThisInitialized(_this))};_this.mediaSource.addEventListener("sourceopen",_this.sourceopenListener_);_this.logger_=logger("SourceUpdater");_this.audioTimestampOffset_=0;_this.videoTimestampOffset_=0;_this.queue=[];_this.queuePending={audio:null,video:null};_this.delayedAudioAppendQueue_=[];_this.videoAppendQueued_=false;_this.codecs={};_this.onVideoUpdateEnd_=onUpdateend("video",_assertThisInitialized(_this));_this.onAudioUpdateEnd_=onUpdateend("audio",_assertThisInitialized(_this));_this.onVideoError_=function(e){_this.videoError_=e;};_this.onAudioError_=function(e){_this.audioError_=e;};_this.createdSourceBuffers_=false;_this.initializedEme_=false;_this.triggeredReady_=false;return _this}var _proto=SourceUpdater.prototype;_proto.initializedEme=function initializedEme(){this.initializedEme_=true;this.triggerReady();};_proto.hasCreatedSourceBuffers=function hasCreatedSourceBuffers(){return this.createdSourceBuffers_};_proto.hasInitializedAnyEme=function hasInitializedAnyEme(){return this.initializedEme_};_proto.ready=function ready(){return this.hasCreatedSourceBuffers()&&this.hasInitializedAnyEme()};_proto.createSourceBuffers=function createSourceBuffers(codecs){if(this.hasCreatedSourceBuffers()){return}this.addOrChangeSourceBuffers(codecs);this.createdSourceBuffers_=true;this.trigger("createdsourcebuffers");this.triggerReady();};_proto.triggerReady=function triggerReady(){if(this.ready()&&!this.triggeredReady_){this.triggeredReady_=true;this.trigger("ready");}};_proto.addSourceBuffer=function addSourceBuffer(type,codec){pushQueue({type:"mediaSource",sourceUpdater:this,action:actions.addSourceBuffer(type,codec),name:"addSourceBuffer"});};_proto.abort=function abort(type){pushQueue({type:type,sourceUpdater:this,action:actions.abort(type),name:"abort"});};_proto.removeSourceBuffer=function removeSourceBuffer(type){if(!this.canRemoveSourceBuffer()){videojs.log.error("removeSourceBuffer is not supported!");return}pushQueue({type:"mediaSource",sourceUpdater:this,action:actions.removeSourceBuffer(type),name:"removeSourceBuffer"});};_proto.canRemoveSourceBuffer=function canRemoveSourceBuffer(){return !videojs.browser.IE_VERSION&&!videojs.browser.IS_FIREFOX&&window_1.MediaSource&&window_1.MediaSource.prototype&&typeof window_1.MediaSource.prototype.removeSourceBuffer==="function"};SourceUpdater.canChangeType=function canChangeType(){return window_1.SourceBuffer&&window_1.SourceBuffer.prototype&&typeof window_1.SourceBuffer.prototype.changeType==="function"};_proto.canChangeType=function canChangeType(){return this.constructor.canChangeType()};_proto.changeType=function changeType(type,codec){if(!this.canChangeType()){videojs.log.error("changeType is not supported!");return}pushQueue({type:type,sourceUpdater:this,action:actions.changeType(codec),name:"changeType"});};_proto.addOrChangeSourceBuffers=function addOrChangeSourceBuffers(codecs){var _this2=this;if(!codecs||typeof codecs!=="object"||Object.keys(codecs).length===0){throw new Error("Cannot addOrChangeSourceBuffers to undefined codecs")}Object.keys(codecs).forEach(function(type){var codec=codecs[type];if(!_this2.hasCreatedSourceBuffers()){return _this2.addSourceBuffer(type,codec)}if(_this2.canChangeType()){_this2.changeType(type,codec);}});};_proto.appendBuffer=function appendBuffer(options,doneFn){var _this3=this;var segmentInfo=options.segmentInfo,type=options.type,bytes=options.bytes;this.processedAppend_=true;if(type==="audio"&&this.videoBuffer&&!this.videoAppendQueued_){this.delayedAudioAppendQueue_.push([options,doneFn]);this.logger_("delayed audio append of "+bytes.length+" until video append");return}var onError=doneFn;pushQueue({type:type,sourceUpdater:this,action:actions.appendBuffer(bytes,segmentInfo||{mediaIndex:-1},onError),doneFn:doneFn,name:"appendBuffer"});if(type==="video"){this.videoAppendQueued_=true;if(!this.delayedAudioAppendQueue_.length){return}var queue=this.delayedAudioAppendQueue_.slice();this.logger_("queuing delayed audio "+queue.length+" appendBuffers");this.delayedAudioAppendQueue_.length=0;queue.forEach(function(que){_this3.appendBuffer.apply(_this3,que);});}};_proto.audioBuffered=function audioBuffered(){if(!inSourceBuffers(this.mediaSource,this.audioBuffer)){return videojs.createTimeRange()}return this.audioBuffer.buffered?this.audioBuffer.buffered:videojs.createTimeRange()};_proto.videoBuffered=function videoBuffered(){if(!inSourceBuffers(this.mediaSource,this.videoBuffer)){return videojs.createTimeRange()}return this.videoBuffer.buffered?this.videoBuffer.buffered:videojs.createTimeRange()};_proto.buffered=function buffered(){var video=inSourceBuffers(this.mediaSource,this.videoBuffer)?this.videoBuffer:null;var audio=inSourceBuffers(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;if(audio&&!video){return this.audioBuffered()}if(video&&!audio){return this.videoBuffered()}return bufferIntersection(this.audioBuffered(),this.videoBuffered())};_proto.setDuration=function setDuration(duration,doneFn){if(doneFn===void 0){doneFn=noop;}pushQueue({type:"mediaSource",sourceUpdater:this,action:actions.duration(duration),name:"duration",doneFn:doneFn});};_proto.endOfStream=function endOfStream(error,doneFn){if(error===void 0){error=null;}if(doneFn===void 0){doneFn=noop;}if(typeof error!=="string"){error=undefined;}pushQueue({type:"mediaSource",sourceUpdater:this,action:actions.endOfStream(error),name:"endOfStream",doneFn:doneFn});};_proto.removeAudio=function removeAudio(start,end,done){if(done===void 0){done=noop;}if(!this.audioBuffered().length||this.audioBuffered().end(0)===0){done();return}pushQueue({type:"audio",sourceUpdater:this,action:actions.remove(start,end),doneFn:done,name:"remove"});};_proto.removeVideo=function removeVideo(start,end,done){if(done===void 0){done=noop;}if(!this.videoBuffered().length||this.videoBuffered().end(0)===0){done();return}pushQueue({type:"video",sourceUpdater:this,action:actions.remove(start,end),doneFn:done,name:"remove"});};_proto.updating=function updating(){if(_updating("audio",this)||_updating("video",this)){return true}return false};_proto.audioTimestampOffset=function audioTimestampOffset(offset){if(typeof offset!=="undefined"&&this.audioBuffer&&this.audioTimestampOffset_!==offset){pushQueue({type:"audio",sourceUpdater:this,action:actions.timestampOffset(offset),name:"timestampOffset"});this.audioTimestampOffset_=offset;}return this.audioTimestampOffset_};_proto.videoTimestampOffset=function videoTimestampOffset(offset){if(typeof offset!=="undefined"&&this.videoBuffer&&this.videoTimestampOffset!==offset){pushQueue({type:"video",sourceUpdater:this,action:actions.timestampOffset(offset),name:"timestampOffset"});this.videoTimestampOffset_=offset;}return this.videoTimestampOffset_};_proto.audioQueueCallback=function audioQueueCallback(callback){if(!this.audioBuffer){return}pushQueue({type:"audio",sourceUpdater:this,action:actions.callback(callback),name:"callback"});};_proto.videoQueueCallback=function videoQueueCallback(callback){if(!this.videoBuffer){return}pushQueue({type:"video",sourceUpdater:this,action:actions.callback(callback),name:"callback"});};_proto.dispose=function dispose(){var _this4=this;this.trigger("dispose");bufferTypes.forEach(function(type){_this4.abort(type);if(_this4.canRemoveSourceBuffer()){_this4.removeSourceBuffer(type);}else {_this4[type+"QueueCallback"](function(){return cleanupBuffer(type,_this4)});}});this.videoAppendQueued_=false;this.delayedAudioAppendQueue_.length=0;if(this.sourceopenListener_){this.mediaSource.removeEventListener("sourceopen",this.sourceopenListener_);}this.off();};return SourceUpdater}(videojs.EventTarget);var uint8ToUtf8=function uint8ToUtf8(uintArray){return decodeURIComponent(escape(String.fromCharCode.apply(null,uintArray)))};var VTT_LINE_TERMINATORS=new Uint8Array("\n\n".split("").map(function(_char3){return _char3.charCodeAt(0)}));var NoVttJsError=function(_Error){_inheritsLoose(NoVttJsError,_Error);function NoVttJsError(){return _Error.call(this,"Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.")||this}return NoVttJsError}(_wrapNativeSuper(Error));var VTTSegmentLoader=function(_SegmentLoader){_inheritsLoose(VTTSegmentLoader,_SegmentLoader);function VTTSegmentLoader(settings,options){var _this;if(options===void 0){options={};}_this=_SegmentLoader.call(this,settings,options)||this;_this.mediaSource_=null;_this.subtitlesTrack_=null;_this.loaderType_="subtitle";_this.featuresNativeTextTracks_=settings.featuresNativeTextTracks;_this.loadVttJs=settings.loadVttJs;_this.shouldSaveSegmentTimingInfo_=false;return _this}var _proto=VTTSegmentLoader.prototype;_proto.createTransmuxer_=function createTransmuxer_(){return null};_proto.buffered_=function buffered_(){if(!this.subtitlesTrack_||!this.subtitlesTrack_.cues||!this.subtitlesTrack_.cues.length){return videojs.createTimeRanges()}var cues=this.subtitlesTrack_.cues;var start=cues[0].startTime;var end=cues[cues.length-1].startTime;return videojs.createTimeRanges([[start,end]])};_proto.initSegmentForMap=function initSegmentForMap(map,set){if(set===void 0){set=false;}if(!map){return null}var id=initSegmentId(map);var storedMap=this.initSegments_[id];if(set&&!storedMap&&map.bytes){var combinedByteLength=VTT_LINE_TERMINATORS.byteLength+map.bytes.byteLength;var combinedSegment=new Uint8Array(combinedByteLength);combinedSegment.set(map.bytes);combinedSegment.set(VTT_LINE_TERMINATORS,map.bytes.byteLength);this.initSegments_[id]=storedMap={resolvedUri:map.resolvedUri,byterange:map.byterange,bytes:combinedSegment};}return storedMap||map};_proto.couldBeginLoading_=function couldBeginLoading_(){return this.playlist_&&this.subtitlesTrack_&&!this.paused()};_proto.init_=function init_(){this.state="READY";this.resetEverything();return this.monitorBuffer_()};_proto.track=function track(_track){if(typeof _track==="undefined"){return this.subtitlesTrack_}this.subtitlesTrack_=_track;if(this.state==="INIT"&&this.couldBeginLoading_()){this.init_();}return this.subtitlesTrack_};_proto.remove=function remove(start,end){removeCuesFromTrack(start,end,this.subtitlesTrack_);};_proto.fillBuffer_=function fillBuffer_(){var _this2=this;var segmentInfo=this.chooseNextRequest_();if(!segmentInfo){return}if(this.syncController_.timestampOffsetForTimeline(segmentInfo.timeline)===null){var checkTimestampOffset=function checkTimestampOffset(){_this2.state="READY";if(!_this2.paused()){_this2.monitorBuffer_();}};this.syncController_.one("timestampoffset",checkTimestampOffset);this.state="WAITING_ON_TIMELINE";return}this.loadSegment_(segmentInfo);};_proto.timestampOffsetForSegment_=function timestampOffsetForSegment_(){return null};_proto.chooseNextRequest_=function chooseNextRequest_(){return this.skipEmptySegments_(_SegmentLoader.prototype.chooseNextRequest_.call(this))};_proto.skipEmptySegments_=function skipEmptySegments_(segmentInfo){while(segmentInfo&&segmentInfo.segment.empty){if(segmentInfo.mediaIndex+1>=segmentInfo.playlist.segments.length){segmentInfo=null;break}segmentInfo=this.generateSegmentInfo_({playlist:segmentInfo.playlist,mediaIndex:segmentInfo.mediaIndex+1,startOfSegment:segmentInfo.startOfSegment+segmentInfo.duration,isSyncRequest:segmentInfo.isSyncRequest});}return segmentInfo};_proto.stopForError=function stopForError(error){this.error(error);this.state="READY";this.pause();this.trigger("error");};_proto.segmentRequestFinished_=function segmentRequestFinished_(error,simpleSegment,result){var _this3=this;if(!this.subtitlesTrack_){this.state="READY";return}this.saveTransferStats_(simpleSegment.stats);if(!this.pendingSegment_){this.state="READY";this.mediaRequestsAborted+=1;return}if(error){if(error.code===REQUEST_ERRORS.TIMEOUT){this.handleTimeout_();}if(error.code===REQUEST_ERRORS.ABORTED){this.mediaRequestsAborted+=1;}else {this.mediaRequestsErrored+=1;}this.stopForError(error);return}var segmentInfo=this.pendingSegment_;this.saveBandwidthRelatedStats_(segmentInfo.duration,simpleSegment.stats);if(simpleSegment.key){this.segmentKey(simpleSegment.key,true);}this.state="APPENDING";this.trigger("appending");var segment=segmentInfo.segment;if(segment.map){segment.map.bytes=simpleSegment.map.bytes;}segmentInfo.bytes=simpleSegment.bytes;if(typeof window_1.WebVTT!=="function"&&typeof this.loadVttJs==="function"){this.state="WAITING_ON_VTTJS";this.loadVttJs().then(function(){return _this3.segmentRequestFinished_(error,simpleSegment,result)},function(){return _this3.stopForError({message:"Error loading vtt.js"})});return}segment.requested=true;try{this.parseVTTCues_(segmentInfo);}catch(e){this.stopForError({message:e.message});return}this.updateTimeMapping_(segmentInfo,this.syncController_.timelines[segmentInfo.timeline],this.playlist_);if(segmentInfo.cues.length){segmentInfo.timingInfo={start:segmentInfo.cues[0].startTime,end:segmentInfo.cues[segmentInfo.cues.length-1].endTime};}else {segmentInfo.timingInfo={start:segmentInfo.startOfSegment,end:segmentInfo.startOfSegment+segmentInfo.duration};}if(segmentInfo.isSyncRequest){this.trigger("syncinfoupdate");this.pendingSegment_=null;this.state="READY";return}segmentInfo.byteLength=segmentInfo.bytes.byteLength;this.mediaSecondsLoaded+=segment.duration;segmentInfo.cues.forEach(function(cue){_this3.subtitlesTrack_.addCue(_this3.featuresNativeTextTracks_?new window_1.VTTCue(cue.startTime,cue.endTime,cue.text):cue);});removeDuplicateCuesFromTrack(this.subtitlesTrack_);this.handleAppendsDone_();};_proto.handleData_=function handleData_(){};_proto.updateTimingInfoEnd_=function updateTimingInfoEnd_(){};_proto.parseVTTCues_=function parseVTTCues_(segmentInfo){var decoder;var decodeBytesToString=false;if(typeof window_1.WebVTT!=="function"){throw new NoVttJsError}if(typeof window_1.TextDecoder==="function"){decoder=new window_1.TextDecoder("utf8");}else {decoder=window_1.WebVTT.StringDecoder();decodeBytesToString=true;}var parser=new window_1.WebVTT.Parser(window_1,window_1.vttjs,decoder);segmentInfo.cues=[];segmentInfo.timestampmap={MPEGTS:0,LOCAL:0};parser.oncue=segmentInfo.cues.push.bind(segmentInfo.cues);parser.ontimestampmap=function(map){segmentInfo.timestampmap=map;};parser.onparsingerror=function(error){videojs.log.warn("Error encountered when parsing cues: "+error.message);};if(segmentInfo.segment.map){var mapData=segmentInfo.segment.map.bytes;if(decodeBytesToString){mapData=uint8ToUtf8(mapData);}parser.parse(mapData);}var segmentData=segmentInfo.bytes;if(decodeBytesToString){segmentData=uint8ToUtf8(segmentData);}parser.parse(segmentData);parser.flush();};_proto.updateTimeMapping_=function updateTimeMapping_(segmentInfo,mappingObj,playlist){var segment=segmentInfo.segment;if(!mappingObj){return}if(!segmentInfo.cues.length){segment.empty=true;return}var timestampmap=segmentInfo.timestampmap;var diff=timestampmap.MPEGTS/clock.ONE_SECOND_IN_TS-timestampmap.LOCAL+mappingObj.mapping;segmentInfo.cues.forEach(function(cue){cue.startTime+=diff;cue.endTime+=diff;});if(!playlist.syncInfo){var firstStart=segmentInfo.cues[0].startTime;var lastStart=segmentInfo.cues[segmentInfo.cues.length-1].startTime;playlist.syncInfo={mediaSequence:playlist.mediaSequence+segmentInfo.mediaIndex,time:Math.min(firstStart,lastStart-segment.duration)};}};return VTTSegmentLoader}(SegmentLoader);var findAdCue=function findAdCue(track,mediaTime){var cues=track.cues;for(var i=0;i<cues.length;i++){var cue=cues[i];if(mediaTime>=cue.adStartTime&&mediaTime<=cue.adEndTime){return cue}}return null};var updateAdCues=function updateAdCues(media,track,offset){if(offset===void 0){offset=0;}if(!media.segments){return}var mediaTime=offset;var cue;for(var i=0;i<media.segments.length;i++){var segment=media.segments[i];if(!cue){cue=findAdCue(track,mediaTime+segment.duration/2);}if(cue){if("cueIn"in segment){cue.endTime=mediaTime;cue.adEndTime=mediaTime;mediaTime+=segment.duration;cue=null;continue}if(mediaTime<cue.endTime){mediaTime+=segment.duration;continue}cue.endTime+=segment.duration;}else {if("cueOut"in segment){cue=new window_1.VTTCue(mediaTime,mediaTime+segment.duration,segment.cueOut);cue.adStartTime=mediaTime;cue.adEndTime=mediaTime+parseFloat(segment.cueOut);track.addCue(cue);}if("cueOutCont"in segment){var _segment$cueOutCont$s=segment.cueOutCont.split("/").map(parseFloat),adOffset=_segment$cueOutCont$s[0],adTotal=_segment$cueOutCont$s[1];cue=new window_1.VTTCue(mediaTime,mediaTime+segment.duration,"");cue.adStartTime=mediaTime-adOffset;cue.adEndTime=cue.adStartTime+adTotal;track.addCue(cue);}}mediaTime+=segment.duration;}};var MAX_MEDIA_SEQUENCE_DIFF_FOR_SYNC=86400;var syncPointStrategies=[{name:"VOD",run:function run(syncController,playlist,duration,currentTimeline,currentTime){if(duration!==Infinity){var syncPoint={time:0,segmentIndex:0,partIndex:null};return syncPoint}return null}},{name:"ProgramDateTime",run:function run(syncController,playlist,duration,currentTimeline,currentTime){if(!Object.keys(syncController.timelineToDatetimeMappings).length){return null}var syncPoint=null;var lastDistance=null;var partsAndSegments=getPartsAndSegments(playlist);currentTime=currentTime||0;for(var i=0;i<partsAndSegments.length;i++){var index=playlist.endList||currentTime===0?i:partsAndSegments.length-(i+1);var partAndSegment=partsAndSegments[index];var segment=partAndSegment.segment;var datetimeMapping=syncController.timelineToDatetimeMappings[segment.timeline];if(!datetimeMapping||!segment.dateTimeObject){continue}var segmentTime=segment.dateTimeObject.getTime()/1e3;var start=segmentTime+datetimeMapping;if(segment.parts&&typeof partAndSegment.partIndex==="number"){for(var z=0;z<partAndSegment.partIndex;z++){start+=segment.parts[z].duration;}}var distance=Math.abs(currentTime-start);if(lastDistance!==null&&(distance===0||lastDistance<distance)){break}lastDistance=distance;syncPoint={time:start,segmentIndex:partAndSegment.segmentIndex,partIndex:partAndSegment.partIndex};}return syncPoint}},{name:"Segment",run:function run(syncController,playlist,duration,currentTimeline,currentTime){var syncPoint=null;var lastDistance=null;currentTime=currentTime||0;var partsAndSegments=getPartsAndSegments(playlist);for(var i=0;i<partsAndSegments.length;i++){var index=playlist.endList||currentTime===0?i:partsAndSegments.length-(i+1);var partAndSegment=partsAndSegments[index];var segment=partAndSegment.segment;var start=partAndSegment.part&&partAndSegment.part.start||segment&&segment.start;if(segment.timeline===currentTimeline&&typeof start!=="undefined"){var distance=Math.abs(currentTime-start);if(lastDistance!==null&&lastDistance<distance){break}if(!syncPoint||lastDistance===null||lastDistance>=distance){lastDistance=distance;syncPoint={time:start,segmentIndex:partAndSegment.segmentIndex,partIndex:partAndSegment.partIndex};}}}return syncPoint}},{name:"Discontinuity",run:function run(syncController,playlist,duration,currentTimeline,currentTime){var syncPoint=null;currentTime=currentTime||0;if(playlist.discontinuityStarts&&playlist.discontinuityStarts.length){var lastDistance=null;for(var i=0;i<playlist.discontinuityStarts.length;i++){var segmentIndex=playlist.discontinuityStarts[i];var discontinuity=playlist.discontinuitySequence+i+1;var discontinuitySync=syncController.discontinuities[discontinuity];if(discontinuitySync){var distance=Math.abs(currentTime-discontinuitySync.time);if(lastDistance!==null&&lastDistance<distance){break}if(!syncPoint||lastDistance===null||lastDistance>=distance){lastDistance=distance;syncPoint={time:discontinuitySync.time,segmentIndex:segmentIndex,partIndex:null};}}}}return syncPoint}},{name:"Playlist",run:function run(syncController,playlist,duration,currentTimeline,currentTime){if(playlist.syncInfo){var syncPoint={time:playlist.syncInfo.time,segmentIndex:playlist.syncInfo.mediaSequence-playlist.mediaSequence,partIndex:null};return syncPoint}return null}}];var SyncController=function(_videojs$EventTarget){_inheritsLoose(SyncController,_videojs$EventTarget);function SyncController(options){var _this;_this=_videojs$EventTarget.call(this)||this;_this.timelines=[];_this.discontinuities=[];_this.timelineToDatetimeMappings={};_this.logger_=logger("SyncController");return _this}var _proto=SyncController.prototype;_proto.getSyncPoint=function getSyncPoint(playlist,duration,currentTimeline,currentTime){var syncPoints=this.runStrategies_(playlist,duration,currentTimeline,currentTime);if(!syncPoints.length){return null}return this.selectSyncPoint_(syncPoints,{key:"time",value:currentTime})};_proto.getExpiredTime=function getExpiredTime(playlist,duration){if(!playlist||!playlist.segments){return null}var syncPoints=this.runStrategies_(playlist,duration,playlist.discontinuitySequence,0);if(!syncPoints.length){return null}var syncPoint=this.selectSyncPoint_(syncPoints,{key:"segmentIndex",value:0});if(syncPoint.segmentIndex>0){syncPoint.time*=-1;}return Math.abs(syncPoint.time+sumDurations({defaultDuration:playlist.targetDuration,durationList:playlist.segments,startIndex:syncPoint.segmentIndex,endIndex:0}))};_proto.runStrategies_=function runStrategies_(playlist,duration,currentTimeline,currentTime){var syncPoints=[];for(var i=0;i<syncPointStrategies.length;i++){var strategy=syncPointStrategies[i];var syncPoint=strategy.run(this,playlist,duration,currentTimeline,currentTime);if(syncPoint){syncPoint.strategy=strategy.name;syncPoints.push({strategy:strategy.name,syncPoint:syncPoint});}}return syncPoints};_proto.selectSyncPoint_=function selectSyncPoint_(syncPoints,target){var bestSyncPoint=syncPoints[0].syncPoint;var bestDistance=Math.abs(syncPoints[0].syncPoint[target.key]-target.value);var bestStrategy=syncPoints[0].strategy;for(var i=1;i<syncPoints.length;i++){var newDistance=Math.abs(syncPoints[i].syncPoint[target.key]-target.value);if(newDistance<bestDistance){bestDistance=newDistance;bestSyncPoint=syncPoints[i].syncPoint;bestStrategy=syncPoints[i].strategy;}}this.logger_("syncPoint for ["+target.key+": "+target.value+"] chosen with strategy"+(" ["+bestStrategy+"]: [time:"+bestSyncPoint.time+",")+(" segmentIndex:"+bestSyncPoint.segmentIndex)+(typeof bestSyncPoint.partIndex==="number"?",partIndex:"+bestSyncPoint.partIndex:"")+"]");return bestSyncPoint};_proto.saveExpiredSegmentInfo=function saveExpiredSegmentInfo(oldPlaylist,newPlaylist){var mediaSequenceDiff=newPlaylist.mediaSequence-oldPlaylist.mediaSequence;if(mediaSequenceDiff>MAX_MEDIA_SEQUENCE_DIFF_FOR_SYNC){videojs.log.warn("Not saving expired segment info. Media sequence gap "+mediaSequenceDiff+" is too large.");return}for(var i=mediaSequenceDiff-1;i>=0;i--){var lastRemovedSegment=oldPlaylist.segments[i];if(lastRemovedSegment&&typeof lastRemovedSegment.start!=="undefined"){newPlaylist.syncInfo={mediaSequence:oldPlaylist.mediaSequence+i,time:lastRemovedSegment.start};this.logger_("playlist refresh sync: [time:"+newPlaylist.syncInfo.time+","+(" mediaSequence: "+newPlaylist.syncInfo.mediaSequence+"]"));this.trigger("syncinfoupdate");break}}};_proto.setDateTimeMappingForStart=function setDateTimeMappingForStart(playlist){this.timelineToDatetimeMappings={};if(playlist.segments&&playlist.segments.length&&playlist.segments[0].dateTimeObject){var firstSegment=playlist.segments[0];var playlistTimestamp=firstSegment.dateTimeObject.getTime()/1e3;this.timelineToDatetimeMappings[firstSegment.timeline]=-playlistTimestamp;}};_proto.saveSegmentTimingInfo=function saveSegmentTimingInfo(_ref){var segmentInfo=_ref.segmentInfo,shouldSaveTimelineMapping=_ref.shouldSaveTimelineMapping;var didCalculateSegmentTimeMapping=this.calculateSegmentTimeMapping_(segmentInfo,segmentInfo.timingInfo,shouldSaveTimelineMapping);var segment=segmentInfo.segment;if(didCalculateSegmentTimeMapping){this.saveDiscontinuitySyncInfo_(segmentInfo);if(!segmentInfo.playlist.syncInfo){segmentInfo.playlist.syncInfo={mediaSequence:segmentInfo.playlist.mediaSequence+segmentInfo.mediaIndex,time:segment.start};}}var dateTime=segment.dateTimeObject;if(segment.discontinuity&&shouldSaveTimelineMapping&&dateTime){this.timelineToDatetimeMappings[segment.timeline]=-(dateTime.getTime()/1e3);}};_proto.timestampOffsetForTimeline=function timestampOffsetForTimeline(timeline){if(typeof this.timelines[timeline]==="undefined"){return null}return this.timelines[timeline].time};_proto.mappingForTimeline=function mappingForTimeline(timeline){if(typeof this.timelines[timeline]==="undefined"){return null}return this.timelines[timeline].mapping};_proto.calculateSegmentTimeMapping_=function calculateSegmentTimeMapping_(segmentInfo,timingInfo,shouldSaveTimelineMapping){var segment=segmentInfo.segment;var part=segmentInfo.part;var mappingObj=this.timelines[segmentInfo.timeline];var start;var end;if(typeof segmentInfo.timestampOffset==="number"){mappingObj={time:segmentInfo.startOfSegment,mapping:segmentInfo.startOfSegment-timingInfo.start};if(shouldSaveTimelineMapping){this.timelines[segmentInfo.timeline]=mappingObj;this.trigger("timestampoffset");this.logger_("time mapping for timeline "+segmentInfo.timeline+": "+("[time: "+mappingObj.time+"] [mapping: "+mappingObj.mapping+"]"));}start=segmentInfo.startOfSegment;end=timingInfo.end+mappingObj.mapping;}else if(mappingObj){start=timingInfo.start+mappingObj.mapping;end=timingInfo.end+mappingObj.mapping;}else {return false}if(part){part.start=start;part.end=end;}if(!segment.start||start<segment.start){segment.start=start;}segment.end=end;return true};_proto.saveDiscontinuitySyncInfo_=function saveDiscontinuitySyncInfo_(segmentInfo){var playlist=segmentInfo.playlist;var segment=segmentInfo.segment;if(segment.discontinuity){this.discontinuities[segment.timeline]={time:segment.start,accuracy:0};}else if(playlist.discontinuityStarts&&playlist.discontinuityStarts.length){for(var i=0;i<playlist.discontinuityStarts.length;i++){var segmentIndex=playlist.discontinuityStarts[i];var discontinuity=playlist.discontinuitySequence+i+1;var mediaIndexDiff=segmentIndex-segmentInfo.mediaIndex;var accuracy=Math.abs(mediaIndexDiff);if(!this.discontinuities[discontinuity]||this.discontinuities[discontinuity].accuracy>accuracy){var time=void 0;if(mediaIndexDiff<0){time=segment.start-sumDurations({defaultDuration:playlist.targetDuration,durationList:playlist.segments,startIndex:segmentInfo.mediaIndex,endIndex:segmentIndex});}else {time=segment.end+sumDurations({defaultDuration:playlist.targetDuration,durationList:playlist.segments,startIndex:segmentInfo.mediaIndex+1,endIndex:segmentIndex});}this.discontinuities[discontinuity]={time:time,accuracy:accuracy};}}}};_proto.dispose=function dispose(){this.trigger("dispose");this.off();};return SyncController}(videojs.EventTarget);var TimelineChangeController=function(_videojs$EventTarget){_inheritsLoose(TimelineChangeController,_videojs$EventTarget);function TimelineChangeController(){var _this;_this=_videojs$EventTarget.call(this)||this;_this.pendingTimelineChanges_={};_this.lastTimelineChanges_={};return _this}var _proto=TimelineChangeController.prototype;_proto.clearPendingTimelineChange=function clearPendingTimelineChange(type){this.pendingTimelineChanges_[type]=null;this.trigger("pendingtimelinechange");};_proto.pendingTimelineChange=function pendingTimelineChange(_ref){var type=_ref.type,from=_ref.from,to=_ref.to;if(typeof from==="number"&&typeof to==="number"){this.pendingTimelineChanges_[type]={type:type,from:from,to:to};this.trigger("pendingtimelinechange");}return this.pendingTimelineChanges_[type]};_proto.lastTimelineChange=function lastTimelineChange(_ref2){var type=_ref2.type,from=_ref2.from,to=_ref2.to;if(typeof from==="number"&&typeof to==="number"){this.lastTimelineChanges_[type]={type:type,from:from,to:to};delete this.pendingTimelineChanges_[type];this.trigger("timelinechange");}return this.lastTimelineChanges_[type]};_proto.dispose=function dispose(){this.trigger("dispose");this.pendingTimelineChanges_={};this.lastTimelineChanges_={};this.off();};return TimelineChangeController}(videojs.EventTarget);var workerCode=transform(getWorkerString(function(){var commonjsGlobal=typeof globalThis!=="undefined"?globalThis:typeof window!=="undefined"?window:typeof global!=="undefined"?global:typeof self!=="undefined"?self:{};function createCommonjsModule(fn,basedir,module){return module={path:basedir,exports:{},require:function require(path,base){return commonjsRequire(path,base===undefined||base===null?module.path:base)}},fn(module,module.exports),module.exports}function commonjsRequire(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var createClass=createCommonjsModule(function(module){function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor}module.exports=_createClass;module.exports["default"]=module.exports,module.exports.__esModule=true;});var setPrototypeOf=createCommonjsModule(function(module){function _setPrototypeOf(o,p){module.exports=_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o};module.exports["default"]=module.exports,module.exports.__esModule=true;return _setPrototypeOf(o,p)}module.exports=_setPrototypeOf;module.exports["default"]=module.exports,module.exports.__esModule=true;});var inheritsLoose=createCommonjsModule(function(module){function _inheritsLoose(subClass,superClass){subClass.prototype=Object.create(superClass.prototype);subClass.prototype.constructor=subClass;setPrototypeOf(subClass,superClass);}module.exports=_inheritsLoose;module.exports["default"]=module.exports,module.exports.__esModule=true;});var Stream=function(){function Stream(){this.listeners={};}var _proto=Stream.prototype;_proto.on=function on(type,listener){if(!this.listeners[type]){this.listeners[type]=[];}this.listeners[type].push(listener);};_proto.off=function off(type,listener){if(!this.listeners[type]){return false}var index=this.listeners[type].indexOf(listener);this.listeners[type]=this.listeners[type].slice(0);this.listeners[type].splice(index,1);return index>-1};_proto.trigger=function trigger(type){var callbacks=this.listeners[type];if(!callbacks){return}if(arguments.length===2){var length=callbacks.length;for(var i=0;i<length;++i){callbacks[i].call(this,arguments[1]);}}else {var args=Array.prototype.slice.call(arguments,1);var _length=callbacks.length;for(var _i=0;_i<_length;++_i){callbacks[_i].apply(this,args);}}};_proto.dispose=function dispose(){this.listeners={};};_proto.pipe=function pipe(destination){this.on("data",function(data){destination.push(data);});};return Stream}();/*! @name pkcs7 @version 1.0.4 @license Apache-2.0 */function unpad(padded){return padded.subarray(0,padded.byteLength-padded[padded.byteLength-1])}/*! @name aes-decrypter @version 3.1.3 @license Apache-2.0 */var precompute=function precompute(){var tables=[[[],[],[],[],[]],[[],[],[],[],[]]];var encTable=tables[0];var decTable=tables[1];var sbox=encTable[4];var sboxInv=decTable[4];var i;var x;var xInv;var d=[];var th=[];var x2;var x4;var x8;var s;var tEnc;var tDec;for(i=0;i<256;i++){th[(d[i]=i<<1^(i>>7)*283)^i]=i;}for(x=xInv=0;!sbox[x];x^=x2||1,xInv=th[xInv]||1){s=xInv^xInv<<1^xInv<<2^xInv<<3^xInv<<4;s=s>>8^s&255^99;sbox[x]=s;sboxInv[s]=x;x8=d[x4=d[x2=d[x]]];tDec=x8*16843009^x4*65537^x2*257^x*16843008;tEnc=d[s]*257^s*16843008;for(i=0;i<4;i++){encTable[i][x]=tEnc=tEnc<<24^tEnc>>>8;decTable[i][s]=tDec=tDec<<24^tDec>>>8;}}for(i=0;i<5;i++){encTable[i]=encTable[i].slice(0);decTable[i]=decTable[i].slice(0);}return tables};var aesTables=null;var AES=function(){function AES(key){if(!aesTables){aesTables=precompute();}this._tables=[[aesTables[0][0].slice(),aesTables[0][1].slice(),aesTables[0][2].slice(),aesTables[0][3].slice(),aesTables[0][4].slice()],[aesTables[1][0].slice(),aesTables[1][1].slice(),aesTables[1][2].slice(),aesTables[1][3].slice(),aesTables[1][4].slice()]];var i;var j;var tmp;var sbox=this._tables[0][4];var decTable=this._tables[1];var keyLen=key.length;var rcon=1;if(keyLen!==4&&keyLen!==6&&keyLen!==8){throw new Error("Invalid aes key size")}var encKey=key.slice(0);var decKey=[];this._key=[encKey,decKey];for(i=keyLen;i<4*keyLen+28;i++){tmp=encKey[i-1];if(i%keyLen===0||keyLen===8&&i%keyLen===4){tmp=sbox[tmp>>>24]<<24^sbox[tmp>>16&255]<<16^sbox[tmp>>8&255]<<8^sbox[tmp&255];if(i%keyLen===0){tmp=tmp<<8^tmp>>>24^rcon<<24;rcon=rcon<<1^(rcon>>7)*283;}}encKey[i]=encKey[i-keyLen]^tmp;}for(j=0;i;j++,i--){tmp=encKey[j&3?i:i-4];if(i<=4||j<4){decKey[j]=tmp;}else {decKey[j]=decTable[0][sbox[tmp>>>24]]^decTable[1][sbox[tmp>>16&255]]^decTable[2][sbox[tmp>>8&255]]^decTable[3][sbox[tmp&255]];}}}var _proto=AES.prototype;_proto.decrypt=function decrypt(encrypted0,encrypted1,encrypted2,encrypted3,out,offset){var key=this._key[1];var a=encrypted0^key[0];var b=encrypted3^key[1];var c=encrypted2^key[2];var d=encrypted1^key[3];var a2;var b2;var c2;var nInnerRounds=key.length/4-2;var i;var kIndex=4;var table=this._tables[1];var table0=table[0];var table1=table[1];var table2=table[2];var table3=table[3];var sbox=table[4];for(i=0;i<nInnerRounds;i++){a2=table0[a>>>24]^table1[b>>16&255]^table2[c>>8&255]^table3[d&255]^key[kIndex];b2=table0[b>>>24]^table1[c>>16&255]^table2[d>>8&255]^table3[a&255]^key[kIndex+1];c2=table0[c>>>24]^table1[d>>16&255]^table2[a>>8&255]^table3[b&255]^key[kIndex+2];d=table0[d>>>24]^table1[a>>16&255]^table2[b>>8&255]^table3[c&255]^key[kIndex+3];kIndex+=4;a=a2;b=b2;c=c2;}for(i=0;i<4;i++){out[(3&-i)+offset]=sbox[a>>>24]<<24^sbox[b>>16&255]<<16^sbox[c>>8&255]<<8^sbox[d&255]^key[kIndex++];a2=a;a=b;b=c;c=d;d=a2;}};return AES}();var AsyncStream=function(_Stream){inheritsLoose(AsyncStream,_Stream);function AsyncStream(){var _this;_this=_Stream.call(this,Stream)||this;_this.jobs=[];_this.delay=1;_this.timeout_=null;return _this}var _proto=AsyncStream.prototype;_proto.processJob_=function processJob_(){this.jobs.shift()();if(this.jobs.length){this.timeout_=setTimeout(this.processJob_.bind(this),this.delay);}else {this.timeout_=null;}};_proto.push=function push(job){this.jobs.push(job);if(!this.timeout_){this.timeout_=setTimeout(this.processJob_.bind(this),this.delay);}};return AsyncStream}(Stream);var ntoh=function ntoh(word){return word<<24|(word&65280)<<8|(word&16711680)>>8|word>>>24};var decrypt=function decrypt(encrypted,key,initVector){var encrypted32=new Int32Array(encrypted.buffer,encrypted.byteOffset,encrypted.byteLength>>2);var decipher=new AES(Array.prototype.slice.call(key));var decrypted=new Uint8Array(encrypted.byteLength);var decrypted32=new Int32Array(decrypted.buffer);var init0;var init1;var init2;var init3;var encrypted0;var encrypted1;var encrypted2;var encrypted3;var wordIx;init0=initVector[0];init1=initVector[1];init2=initVector[2];init3=initVector[3];for(wordIx=0;wordIx<encrypted32.length;wordIx+=4){encrypted0=ntoh(encrypted32[wordIx]);encrypted1=ntoh(encrypted32[wordIx+1]);encrypted2=ntoh(encrypted32[wordIx+2]);encrypted3=ntoh(encrypted32[wordIx+3]);decipher.decrypt(encrypted0,encrypted1,encrypted2,encrypted3,decrypted32,wordIx);decrypted32[wordIx]=ntoh(decrypted32[wordIx]^init0);decrypted32[wordIx+1]=ntoh(decrypted32[wordIx+1]^init1);decrypted32[wordIx+2]=ntoh(decrypted32[wordIx+2]^init2);decrypted32[wordIx+3]=ntoh(decrypted32[wordIx+3]^init3);init0=encrypted0;init1=encrypted1;init2=encrypted2;init3=encrypted3;}return decrypted};var Decrypter=function(){function Decrypter(encrypted,key,initVector,done){var step=Decrypter.STEP;var encrypted32=new Int32Array(encrypted.buffer);var decrypted=new Uint8Array(encrypted.byteLength);var i=0;this.asyncStream_=new AsyncStream;this.asyncStream_.push(this.decryptChunk_(encrypted32.subarray(i,i+step),key,initVector,decrypted));for(i=step;i<encrypted32.length;i+=step){initVector=new Uint32Array([ntoh(encrypted32[i-4]),ntoh(encrypted32[i-3]),ntoh(encrypted32[i-2]),ntoh(encrypted32[i-1])]);this.asyncStream_.push(this.decryptChunk_(encrypted32.subarray(i,i+step),key,initVector,decrypted));}this.asyncStream_.push(function(){done(null,unpad(decrypted));});}var _proto=Decrypter.prototype;_proto.decryptChunk_=function decryptChunk_(encrypted,key,initVector,decrypted){return function(){var bytes=decrypt(encrypted,key,initVector);decrypted.set(bytes,encrypted.byteOffset);}};createClass(Decrypter,null,[{key:"STEP",get:function get(){return 32e3}}]);return Decrypter}();var win;if(typeof window!=="undefined"){win=window;}else if(typeof commonjsGlobal!=="undefined"){win=commonjsGlobal;}else if(typeof self!=="undefined"){win=self;}else {win={};}var window_1=win;var isArrayBufferView=function isArrayBufferView(obj){if(ArrayBuffer.isView==="function"){return ArrayBuffer.isView(obj)}return obj&&obj.buffer instanceof ArrayBuffer};var BigInt=window_1.BigInt||Number;[BigInt("0x1"),BigInt("0x100"),BigInt("0x10000"),BigInt("0x1000000"),BigInt("0x100000000"),BigInt("0x10000000000"),BigInt("0x1000000000000"),BigInt("0x100000000000000"),BigInt("0x10000000000000000")];var createTransferableMessage=function createTransferableMessage(message){var transferable={};Object.keys(message).forEach(function(key){var value=message[key];if(isArrayBufferView(value)){transferable[key]={bytes:value.buffer,byteOffset:value.byteOffset,byteLength:value.byteLength};}else {transferable[key]=value;}});return transferable};self.onmessage=function(event){var data=event.data;var encrypted=new Uint8Array(data.encrypted.bytes,data.encrypted.byteOffset,data.encrypted.byteLength);var key=new Uint32Array(data.key.bytes,data.key.byteOffset,data.key.byteLength/4);var iv=new Uint32Array(data.iv.bytes,data.iv.byteOffset,data.iv.byteLength/4);new Decrypter(encrypted,key,iv,function(err,bytes){self.postMessage(createTransferableMessage({source:data.source,decrypted:bytes}),[bytes.buffer]);});};}));var Decrypter=factory(workerCode);var audioTrackKind_=function audioTrackKind_(properties){var kind=properties["default"]?"main":"alternative";if(properties.characteristics&&properties.characteristics.indexOf("public.accessibility.describes-video")>=0){kind="main-desc";}return kind};var stopLoaders=function stopLoaders(segmentLoader,mediaType){segmentLoader.abort();segmentLoader.pause();if(mediaType&&mediaType.activePlaylistLoader){mediaType.activePlaylistLoader.pause();mediaType.activePlaylistLoader=null;}};var startLoaders=function startLoaders(playlistLoader,mediaType){mediaType.activePlaylistLoader=playlistLoader;playlistLoader.load();};var onGroupChanged=function onGroupChanged(type,settings){return function(){var _settings$segmentLoad=settings.segmentLoaders,segmentLoader=_settings$segmentLoad[type],mainSegmentLoader=_settings$segmentLoad.main,mediaType=settings.mediaTypes[type];var activeTrack=mediaType.activeTrack();var activeGroup=mediaType.getActiveGroup();var previousActiveLoader=mediaType.activePlaylistLoader;var lastGroup=mediaType.lastGroup_;if(activeGroup&&lastGroup&&activeGroup.id===lastGroup.id){return}mediaType.lastGroup_=activeGroup;mediaType.lastTrack_=activeTrack;stopLoaders(segmentLoader,mediaType);if(!activeGroup||activeGroup.isMasterPlaylist){return}if(!activeGroup.playlistLoader){if(previousActiveLoader){mainSegmentLoader.resetEverything();}return}segmentLoader.resyncLoader();startLoaders(activeGroup.playlistLoader,mediaType);}};var onGroupChanging=function onGroupChanging(type,settings){return function(){var segmentLoader=settings.segmentLoaders[type],mediaType=settings.mediaTypes[type];mediaType.lastGroup_=null;segmentLoader.abort();segmentLoader.pause();}};var onTrackChanged=function onTrackChanged(type,settings){return function(){var masterPlaylistLoader=settings.masterPlaylistLoader,_settings$segmentLoad2=settings.segmentLoaders,segmentLoader=_settings$segmentLoad2[type],mainSegmentLoader=_settings$segmentLoad2.main,mediaType=settings.mediaTypes[type];var activeTrack=mediaType.activeTrack();var activeGroup=mediaType.getActiveGroup();var previousActiveLoader=mediaType.activePlaylistLoader;var lastTrack=mediaType.lastTrack_;if(lastTrack&&activeTrack&&lastTrack.id===activeTrack.id){return}mediaType.lastGroup_=activeGroup;mediaType.lastTrack_=activeTrack;stopLoaders(segmentLoader,mediaType);if(!activeGroup){return}if(activeGroup.isMasterPlaylist){if(!activeTrack||!lastTrack||activeTrack.id===lastTrack.id){return}var mpc=settings.vhs.masterPlaylistController_;var newPlaylist=mpc.selectPlaylist();if(mpc.media()===newPlaylist){return}mediaType.logger_("track change. Switching master audio from "+lastTrack.id+" to "+activeTrack.id);masterPlaylistLoader.pause();mainSegmentLoader.resetEverything();mpc.fastQualityChange_(newPlaylist);return}if(type==="AUDIO"){if(!activeGroup.playlistLoader){mainSegmentLoader.setAudio(true);mainSegmentLoader.resetEverything();return}segmentLoader.setAudio(true);mainSegmentLoader.setAudio(false);}if(previousActiveLoader===activeGroup.playlistLoader){startLoaders(activeGroup.playlistLoader,mediaType);return}if(segmentLoader.track){segmentLoader.track(activeTrack);}segmentLoader.resetEverything();startLoaders(activeGroup.playlistLoader,mediaType);}};var onError={AUDIO:function AUDIO(type,settings){return function(){var segmentLoader=settings.segmentLoaders[type],mediaType=settings.mediaTypes[type],blacklistCurrentPlaylist=settings.blacklistCurrentPlaylist;stopLoaders(segmentLoader,mediaType);var activeTrack=mediaType.activeTrack();var activeGroup=mediaType.activeGroup();var id=(activeGroup.filter(function(group){return group["default"]})[0]||activeGroup[0]).id;var defaultTrack=mediaType.tracks[id];if(activeTrack===defaultTrack){blacklistCurrentPlaylist({message:"Problem encountered loading the default audio track."});return}videojs.log.warn("Problem encountered loading the alternate audio track."+"Switching back to default.");for(var trackId in mediaType.tracks){mediaType.tracks[trackId].enabled=mediaType.tracks[trackId]===defaultTrack;}mediaType.onTrackChanged();}},SUBTITLES:function SUBTITLES(type,settings){return function(){var segmentLoader=settings.segmentLoaders[type],mediaType=settings.mediaTypes[type];videojs.log.warn("Problem encountered loading the subtitle track."+"Disabling subtitle track.");stopLoaders(segmentLoader,mediaType);var track=mediaType.activeTrack();if(track){track.mode="disabled";}mediaType.onTrackChanged();}}};var setupListeners={AUDIO:function AUDIO(type,playlistLoader,settings){if(!playlistLoader){return}var tech=settings.tech,requestOptions=settings.requestOptions,segmentLoader=settings.segmentLoaders[type];playlistLoader.on("loadedmetadata",function(){var media=playlistLoader.media();segmentLoader.playlist(media,requestOptions);if(!tech.paused()||media.endList&&tech.preload()!=="none"){segmentLoader.load();}});playlistLoader.on("loadedplaylist",function(){segmentLoader.playlist(playlistLoader.media(),requestOptions);if(!tech.paused()){segmentLoader.load();}});playlistLoader.on("error",onError[type](type,settings));},SUBTITLES:function SUBTITLES(type,playlistLoader,settings){var tech=settings.tech,requestOptions=settings.requestOptions,segmentLoader=settings.segmentLoaders[type],mediaType=settings.mediaTypes[type];playlistLoader.on("loadedmetadata",function(){var media=playlistLoader.media();segmentLoader.playlist(media,requestOptions);segmentLoader.track(mediaType.activeTrack());if(!tech.paused()||media.endList&&tech.preload()!=="none"){segmentLoader.load();}});playlistLoader.on("loadedplaylist",function(){segmentLoader.playlist(playlistLoader.media(),requestOptions);if(!tech.paused()){segmentLoader.load();}});playlistLoader.on("error",onError[type](type,settings));}};var initialize={"AUDIO":function AUDIO(type,settings){var vhs=settings.vhs,sourceType=settings.sourceType,segmentLoader=settings.segmentLoaders[type],requestOptions=settings.requestOptions,mediaGroups=settings.master.mediaGroups,_settings$mediaTypes$=settings.mediaTypes[type],groups=_settings$mediaTypes$.groups,tracks=_settings$mediaTypes$.tracks,logger_=_settings$mediaTypes$.logger_,masterPlaylistLoader=settings.masterPlaylistLoader;var audioOnlyMaster=isAudioOnly(masterPlaylistLoader.master);if(!mediaGroups[type]||Object.keys(mediaGroups[type]).length===0){mediaGroups[type]={main:{"default":{"default":true}}};if(audioOnlyMaster){mediaGroups[type].main["default"].playlists=masterPlaylistLoader.master.playlists;}}for(var groupId in mediaGroups[type]){if(!groups[groupId]){groups[groupId]=[];}for(var variantLabel in mediaGroups[type][groupId]){var properties=mediaGroups[type][groupId][variantLabel];var playlistLoader=void 0;if(audioOnlyMaster){logger_("AUDIO group '"+groupId+"' label '"+variantLabel+"' is a master playlist");properties.isMasterPlaylist=true;playlistLoader=null;}else if(sourceType==="vhs-json"&&properties.playlists){playlistLoader=new PlaylistLoader(properties.playlists[0],vhs,requestOptions);}else if(properties.resolvedUri){playlistLoader=new PlaylistLoader(properties.resolvedUri,vhs,requestOptions);}else if(properties.playlists&&sourceType==="dash"){playlistLoader=new DashPlaylistLoader(properties.playlists[0],vhs,requestOptions,masterPlaylistLoader);}else {playlistLoader=null;}properties=videojs.mergeOptions({id:variantLabel,playlistLoader:playlistLoader},properties);setupListeners[type](type,properties.playlistLoader,settings);groups[groupId].push(properties);if(typeof tracks[variantLabel]==="undefined"){var track=new videojs.AudioTrack({id:variantLabel,kind:audioTrackKind_(properties),enabled:false,language:properties.language,"default":properties["default"],label:variantLabel});tracks[variantLabel]=track;}}}segmentLoader.on("error",onError[type](type,settings));},"SUBTITLES":function SUBTITLES(type,settings){var tech=settings.tech,vhs=settings.vhs,sourceType=settings.sourceType,segmentLoader=settings.segmentLoaders[type],requestOptions=settings.requestOptions,mediaGroups=settings.master.mediaGroups,_settings$mediaTypes$2=settings.mediaTypes[type],groups=_settings$mediaTypes$2.groups,tracks=_settings$mediaTypes$2.tracks,masterPlaylistLoader=settings.masterPlaylistLoader;for(var groupId in mediaGroups[type]){if(!groups[groupId]){groups[groupId]=[];}for(var variantLabel in mediaGroups[type][groupId]){if(mediaGroups[type][groupId][variantLabel].forced){continue}var properties=mediaGroups[type][groupId][variantLabel];var playlistLoader=void 0;if(sourceType==="hls"){playlistLoader=new PlaylistLoader(properties.resolvedUri,vhs,requestOptions);}else if(sourceType==="dash"){var playlists=properties.playlists.filter(function(p){return p.excludeUntil!==Infinity});if(!playlists.length){return}playlistLoader=new DashPlaylistLoader(properties.playlists[0],vhs,requestOptions,masterPlaylistLoader);}else if(sourceType==="vhs-json"){playlistLoader=new PlaylistLoader(properties.playlists?properties.playlists[0]:properties.resolvedUri,vhs,requestOptions);}properties=videojs.mergeOptions({id:variantLabel,playlistLoader:playlistLoader},properties);setupListeners[type](type,properties.playlistLoader,settings);groups[groupId].push(properties);if(typeof tracks[variantLabel]==="undefined"){var track=tech.addRemoteTextTrack({id:variantLabel,kind:"subtitles","default":properties["default"]&&properties.autoselect,language:properties.language,label:variantLabel},false).track;tracks[variantLabel]=track;}}}segmentLoader.on("error",onError[type](type,settings));},"CLOSED-CAPTIONS":function CLOSEDCAPTIONS(type,settings){var tech=settings.tech,mediaGroups=settings.master.mediaGroups,_settings$mediaTypes$3=settings.mediaTypes[type],groups=_settings$mediaTypes$3.groups,tracks=_settings$mediaTypes$3.tracks;for(var groupId in mediaGroups[type]){if(!groups[groupId]){groups[groupId]=[];}for(var variantLabel in mediaGroups[type][groupId]){var properties=mediaGroups[type][groupId][variantLabel];if(!/^(?:CC|SERVICE)/.test(properties.instreamId)){continue}var captionServices=tech.options_.vhs&&tech.options_.vhs.captionServices||{};var newProps={label:variantLabel,language:properties.language,instreamId:properties.instreamId,"default":properties["default"]&&properties.autoselect};if(captionServices[newProps.instreamId]){newProps=videojs.mergeOptions(newProps,captionServices[newProps.instreamId]);}if(newProps["default"]===undefined){delete newProps["default"];}groups[groupId].push(videojs.mergeOptions({id:variantLabel},properties));if(typeof tracks[variantLabel]==="undefined"){var track=tech.addRemoteTextTrack({id:newProps.instreamId,kind:"captions","default":newProps["default"],language:newProps.language,label:newProps.label},false).track;tracks[variantLabel]=track;}}}}};var groupMatch=function groupMatch(list,media){for(var i=0;i<list.length;i++){if(playlistMatch(media,list[i])){return true}if(list[i].playlists&&groupMatch(list[i].playlists,media)){return true}}return false};var activeGroup=function activeGroup(type,settings){return function(track){var masterPlaylistLoader=settings.masterPlaylistLoader,groups=settings.mediaTypes[type].groups;var media=masterPlaylistLoader.media();if(!media){return null}var variants=null;if(media.attributes[type]){variants=groups[media.attributes[type]];}var groupKeys=Object.keys(groups);if(!variants){if(type==="AUDIO"&&groupKeys.length>1&&isAudioOnly(settings.master)){for(var i=0;i<groupKeys.length;i++){var groupPropertyList=groups[groupKeys[i]];if(groupMatch(groupPropertyList,media)){variants=groupPropertyList;break}}}else if(groups.main){variants=groups.main;}else if(groupKeys.length===1){variants=groups[groupKeys[0]];}}if(typeof track==="undefined"){return variants}if(track===null||!variants){return null}return variants.filter(function(props){return props.id===track.id})[0]||null}};var activeTrack={AUDIO:function AUDIO(type,settings){return function(){var tracks=settings.mediaTypes[type].tracks;for(var id in tracks){if(tracks[id].enabled){return tracks[id]}}return null}},SUBTITLES:function SUBTITLES(type,settings){return function(){var tracks=settings.mediaTypes[type].tracks;for(var id in tracks){if(tracks[id].mode==="showing"||tracks[id].mode==="hidden"){return tracks[id]}}return null}}};var getActiveGroup=function getActiveGroup(type,_ref){var mediaTypes=_ref.mediaTypes;return function(){var activeTrack_=mediaTypes[type].activeTrack();if(!activeTrack_){return null}return mediaTypes[type].activeGroup(activeTrack_)}};var setupMediaGroups=function setupMediaGroups(settings){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(function(type){initialize[type](type,settings);});var mediaTypes=settings.mediaTypes,masterPlaylistLoader=settings.masterPlaylistLoader,tech=settings.tech,vhs=settings.vhs,_settings$segmentLoad3=settings.segmentLoaders,audioSegmentLoader=_settings$segmentLoad3["AUDIO"],mainSegmentLoader=_settings$segmentLoad3.main;["AUDIO","SUBTITLES"].forEach(function(type){mediaTypes[type].activeGroup=activeGroup(type,settings);mediaTypes[type].activeTrack=activeTrack[type](type,settings);mediaTypes[type].onGroupChanged=onGroupChanged(type,settings);mediaTypes[type].onGroupChanging=onGroupChanging(type,settings);mediaTypes[type].onTrackChanged=onTrackChanged(type,settings);mediaTypes[type].getActiveGroup=getActiveGroup(type,settings);});var audioGroup=mediaTypes.AUDIO.activeGroup();if(audioGroup){var groupId=(audioGroup.filter(function(group){return group["default"]})[0]||audioGroup[0]).id;mediaTypes.AUDIO.tracks[groupId].enabled=true;mediaTypes.AUDIO.onGroupChanged();mediaTypes.AUDIO.onTrackChanged();var activeAudioGroup=mediaTypes.AUDIO.getActiveGroup();if(!activeAudioGroup.playlistLoader){mainSegmentLoader.setAudio(true);}else {mainSegmentLoader.setAudio(false);audioSegmentLoader.setAudio(true);}}masterPlaylistLoader.on("mediachange",function(){["AUDIO","SUBTITLES"].forEach(function(type){return mediaTypes[type].onGroupChanged()});});masterPlaylistLoader.on("mediachanging",function(){["AUDIO","SUBTITLES"].forEach(function(type){return mediaTypes[type].onGroupChanging()});});var onAudioTrackChanged=function onAudioTrackChanged(){mediaTypes.AUDIO.onTrackChanged();tech.trigger({type:"usage",name:"vhs-audio-change"});tech.trigger({type:"usage",name:"hls-audio-change"});};tech.audioTracks().addEventListener("change",onAudioTrackChanged);tech.remoteTextTracks().addEventListener("change",mediaTypes.SUBTITLES.onTrackChanged);vhs.on("dispose",function(){tech.audioTracks().removeEventListener("change",onAudioTrackChanged);tech.remoteTextTracks().removeEventListener("change",mediaTypes.SUBTITLES.onTrackChanged);});tech.clearTracks("audio");for(var id in mediaTypes.AUDIO.tracks){tech.audioTracks().addTrack(mediaTypes.AUDIO.tracks[id]);}};var createMediaTypes=function createMediaTypes(){var mediaTypes={};["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(function(type){mediaTypes[type]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:noop,activeTrack:noop,getActiveGroup:noop,onGroupChanged:noop,onTrackChanged:noop,lastTrack_:null,logger_:logger("MediaGroups["+type+"]")};});return mediaTypes};var ABORT_EARLY_BLACKLIST_SECONDS=60*2;var Vhs$1;var loaderStats=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"];var sumLoaderStat=function sumLoaderStat(stat){return this.audioSegmentLoader_[stat]+this.mainSegmentLoader_[stat]};var shouldSwitchToMedia=function shouldSwitchToMedia(_ref){var currentPlaylist=_ref.currentPlaylist,buffered=_ref.buffered,currentTime=_ref.currentTime,nextPlaylist=_ref.nextPlaylist,bufferLowWaterLine=_ref.bufferLowWaterLine,bufferHighWaterLine=_ref.bufferHighWaterLine,duration=_ref.duration,experimentalBufferBasedABR=_ref.experimentalBufferBasedABR,log=_ref.log;if(!nextPlaylist){videojs.log.warn("We received no playlist to switch to. Please check your stream.");return false}var sharedLogLine="allowing switch "+(currentPlaylist&¤tPlaylist.id||"null")+" -> "+nextPlaylist.id;if(!currentPlaylist){log(sharedLogLine+" as current playlist is not set");return true}if(nextPlaylist.id===currentPlaylist.id){return false}var isBuffered=Boolean(findRange(buffered,currentTime).length);if(!currentPlaylist.endList){if(!isBuffered&&typeof currentPlaylist.partTargetDuration==="number"){log("not "+sharedLogLine+" as current playlist is live llhls, but currentTime isn't in buffered.");return false}log(sharedLogLine+" as current playlist is live");return true}var forwardBuffer=timeAheadOf(buffered,currentTime);var maxBufferLowWaterLine=experimentalBufferBasedABR?Config.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:Config.MAX_BUFFER_LOW_WATER_LINE;if(duration<maxBufferLowWaterLine){log(sharedLogLine+" as duration < max low water line ("+duration+" < "+maxBufferLowWaterLine+")");return true}var nextBandwidth=nextPlaylist.attributes.BANDWIDTH;var currBandwidth=currentPlaylist.attributes.BANDWIDTH;if(nextBandwidth<currBandwidth&&(!experimentalBufferBasedABR||forwardBuffer<bufferHighWaterLine)){var logLine=sharedLogLine+" as next bandwidth < current bandwidth ("+nextBandwidth+" < "+currBandwidth+")";if(experimentalBufferBasedABR){logLine+=" and forwardBuffer < bufferHighWaterLine ("+forwardBuffer+" < "+bufferHighWaterLine+")";}log(logLine);return true}if((!experimentalBufferBasedABR||nextBandwidth>currBandwidth)&&forwardBuffer>=bufferLowWaterLine){var _logLine=sharedLogLine+" as forwardBuffer >= bufferLowWaterLine ("+forwardBuffer+" >= "+bufferLowWaterLine+")";if(experimentalBufferBasedABR){_logLine+=" and next bandwidth > current bandwidth ("+nextBandwidth+" > "+currBandwidth+")";}log(_logLine);return true}log("not "+sharedLogLine+" as no switching criteria met");return false};var MasterPlaylistController=function(_videojs$EventTarget){_inheritsLoose(MasterPlaylistController,_videojs$EventTarget);function MasterPlaylistController(options){var _this;_this=_videojs$EventTarget.call(this)||this;var src=options.src,handleManifestRedirects=options.handleManifestRedirects,withCredentials=options.withCredentials,tech=options.tech,bandwidth=options.bandwidth,externVhs=options.externVhs,useCueTags=options.useCueTags,blacklistDuration=options.blacklistDuration,enableLowInitialPlaylist=options.enableLowInitialPlaylist,sourceType=options.sourceType,cacheEncryptionKeys=options.cacheEncryptionKeys,experimentalBufferBasedABR=options.experimentalBufferBasedABR,experimentalLeastPixelDiffSelector=options.experimentalLeastPixelDiffSelector,captionServices=options.captionServices;if(!src){throw new Error("A non-empty playlist URL or JSON manifest string is required")}var maxPlaylistRetries=options.maxPlaylistRetries;if(maxPlaylistRetries===null||typeof maxPlaylistRetries==="undefined"){maxPlaylistRetries=Infinity;}Vhs$1=externVhs;_this.experimentalBufferBasedABR=Boolean(experimentalBufferBasedABR);_this.experimentalLeastPixelDiffSelector=Boolean(experimentalLeastPixelDiffSelector);_this.withCredentials=withCredentials;_this.tech_=tech;_this.vhs_=tech.vhs;_this.sourceType_=sourceType;_this.useCueTags_=useCueTags;_this.blacklistDuration=blacklistDuration;_this.maxPlaylistRetries=maxPlaylistRetries;_this.enableLowInitialPlaylist=enableLowInitialPlaylist;if(_this.useCueTags_){_this.cueTagsTrack_=_this.tech_.addTextTrack("metadata","ad-cues");_this.cueTagsTrack_.inBandMetadataTrackDispatchType="";}_this.requestOptions_={withCredentials:withCredentials,handleManifestRedirects:handleManifestRedirects,maxPlaylistRetries:maxPlaylistRetries,timeout:null};_this.on("error",_this.pauseLoading);_this.mediaTypes_=createMediaTypes();_this.mediaSource=new window_1.MediaSource;_this.handleDurationChange_=_this.handleDurationChange_.bind(_assertThisInitialized(_this));_this.handleSourceOpen_=_this.handleSourceOpen_.bind(_assertThisInitialized(_this));_this.handleSourceEnded_=_this.handleSourceEnded_.bind(_assertThisInitialized(_this));_this.mediaSource.addEventListener("durationchange",_this.handleDurationChange_);_this.mediaSource.addEventListener("sourceopen",_this.handleSourceOpen_);_this.mediaSource.addEventListener("sourceended",_this.handleSourceEnded_);_this.seekable_=videojs.createTimeRanges();_this.hasPlayed_=false;_this.syncController_=new SyncController(options);_this.segmentMetadataTrack_=tech.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},false).track;_this.decrypter_=new Decrypter;_this.sourceUpdater_=new SourceUpdater(_this.mediaSource);_this.inbandTextTracks_={};_this.timelineChangeController_=new TimelineChangeController;var segmentLoaderSettings={vhs:_this.vhs_,parse708captions:options.parse708captions,useDtsForTimestampOffset:options.useDtsForTimestampOffset,captionServices:captionServices,mediaSource:_this.mediaSource,currentTime:_this.tech_.currentTime.bind(_this.tech_),seekable:function seekable(){return _this.seekable()},seeking:function seeking(){return _this.tech_.seeking()},duration:function duration(){return _this.duration()},hasPlayed:function hasPlayed(){return _this.hasPlayed_},goalBufferLength:function goalBufferLength(){return _this.goalBufferLength()},bandwidth:bandwidth,syncController:_this.syncController_,decrypter:_this.decrypter_,sourceType:_this.sourceType_,inbandTextTracks:_this.inbandTextTracks_,cacheEncryptionKeys:cacheEncryptionKeys,sourceUpdater:_this.sourceUpdater_,timelineChangeController:_this.timelineChangeController_,experimentalExactManifestTimings:options.experimentalExactManifestTimings};_this.masterPlaylistLoader_=_this.sourceType_==="dash"?new DashPlaylistLoader(src,_this.vhs_,_this.requestOptions_):new PlaylistLoader(src,_this.vhs_,_this.requestOptions_);_this.setupMasterPlaylistLoaderListeners_();_this.mainSegmentLoader_=new SegmentLoader(videojs.mergeOptions(segmentLoaderSettings,{segmentMetadataTrack:_this.segmentMetadataTrack_,loaderType:"main"}),options);_this.audioSegmentLoader_=new SegmentLoader(videojs.mergeOptions(segmentLoaderSettings,{loaderType:"audio"}),options);_this.subtitleSegmentLoader_=new VTTSegmentLoader(videojs.mergeOptions(segmentLoaderSettings,{loaderType:"vtt",featuresNativeTextTracks:_this.tech_.featuresNativeTextTracks,loadVttJs:function loadVttJs(){return new Promise(function(resolve,reject){function onLoad(){tech.off("vttjserror",onError);resolve();}function onError(){tech.off("vttjsloaded",onLoad);reject();}tech.one("vttjsloaded",onLoad);tech.one("vttjserror",onError);tech.addWebVttScript_();})}}),options);_this.setupSegmentLoaderListeners_();if(_this.experimentalBufferBasedABR){_this.masterPlaylistLoader_.one("loadedplaylist",function(){return _this.startABRTimer_()});_this.tech_.on("pause",function(){return _this.stopABRTimer_()});_this.tech_.on("play",function(){return _this.startABRTimer_()});}loaderStats.forEach(function(stat){_this[stat+"_"]=sumLoaderStat.bind(_assertThisInitialized(_this),stat);});_this.logger_=logger("MPC");_this.triggeredFmp4Usage=false;if(_this.tech_.preload()==="none"){_this.loadOnPlay_=function(){_this.loadOnPlay_=null;_this.masterPlaylistLoader_.load();};_this.tech_.one("play",_this.loadOnPlay_);}else {_this.masterPlaylistLoader_.load();}_this.timeToLoadedData__=-1;_this.mainAppendsToLoadedData__=-1;_this.audioAppendsToLoadedData__=-1;var event=_this.tech_.preload()==="none"?"play":"loadstart";_this.tech_.one(event,function(){var timeToLoadedDataStart=Date.now();_this.tech_.one("loadeddata",function(){_this.timeToLoadedData__=Date.now()-timeToLoadedDataStart;_this.mainAppendsToLoadedData__=_this.mainSegmentLoader_.mediaAppends;_this.audioAppendsToLoadedData__=_this.audioSegmentLoader_.mediaAppends;});});return _this}var _proto=MasterPlaylistController.prototype;_proto.mainAppendsToLoadedData_=function mainAppendsToLoadedData_(){return this.mainAppendsToLoadedData__};_proto.audioAppendsToLoadedData_=function audioAppendsToLoadedData_(){return this.audioAppendsToLoadedData__};_proto.appendsToLoadedData_=function appendsToLoadedData_(){var main=this.mainAppendsToLoadedData_();var audio=this.audioAppendsToLoadedData_();if(main===-1||audio===-1){return -1}return main+audio};_proto.timeToLoadedData_=function timeToLoadedData_(){return this.timeToLoadedData__};_proto.checkABR_=function checkABR_(reason){if(reason===void 0){reason="abr";}var nextPlaylist=this.selectPlaylist();if(nextPlaylist&&this.shouldSwitchToMedia_(nextPlaylist)){this.switchMedia_(nextPlaylist,reason);}};_proto.switchMedia_=function switchMedia_(playlist,cause,delay){var oldMedia=this.media();var oldId=oldMedia&&(oldMedia.id||oldMedia.uri);var newId=playlist.id||playlist.uri;if(oldId&&oldId!==newId){this.logger_("switch media "+oldId+" -> "+newId+" from "+cause);this.tech_.trigger({type:"usage",name:"vhs-rendition-change-"+cause});}this.masterPlaylistLoader_.media(playlist,delay);};_proto.startABRTimer_=function startABRTimer_(){var _this2=this;this.stopABRTimer_();this.abrTimer_=window_1.setInterval(function(){return _this2.checkABR_()},250);};_proto.stopABRTimer_=function stopABRTimer_(){if(this.tech_.scrubbing&&this.tech_.scrubbing()){return}window_1.clearInterval(this.abrTimer_);this.abrTimer_=null;};_proto.getAudioTrackPlaylists_=function getAudioTrackPlaylists_(){var master=this.master();var defaultPlaylists=master&&master.playlists||[];if(!master||!master.mediaGroups||!master.mediaGroups.AUDIO){return defaultPlaylists}var AUDIO=master.mediaGroups.AUDIO;var groupKeys=Object.keys(AUDIO);var track;if(Object.keys(this.mediaTypes_.AUDIO.groups).length){track=this.mediaTypes_.AUDIO.activeTrack();}else {var defaultGroup=AUDIO.main||groupKeys.length&&AUDIO[groupKeys[0]];for(var label in defaultGroup){if(defaultGroup[label]["default"]){track={label:label};break}}}if(!track){return defaultPlaylists}var playlists=[];for(var group in AUDIO){if(AUDIO[group][track.label]){var properties=AUDIO[group][track.label];if(properties.playlists&&properties.playlists.length){playlists.push.apply(playlists,properties.playlists);}else if(properties.uri){playlists.push(properties);}else if(master.playlists.length){for(var i=0;i<master.playlists.length;i++){var playlist=master.playlists[i];if(playlist.attributes&&playlist.attributes.AUDIO&&playlist.attributes.AUDIO===group){playlists.push(playlist);}}}}}if(!playlists.length){return defaultPlaylists}return playlists};_proto.setupMasterPlaylistLoaderListeners_=function setupMasterPlaylistLoaderListeners_(){var _this3=this;this.masterPlaylistLoader_.on("loadedmetadata",function(){var media=_this3.masterPlaylistLoader_.media();var requestTimeout=media.targetDuration*1.5*1e3;if(isLowestEnabledRendition(_this3.masterPlaylistLoader_.master,_this3.masterPlaylistLoader_.media())){_this3.requestOptions_.timeout=0;}else {_this3.requestOptions_.timeout=requestTimeout;}if(media.endList&&_this3.tech_.preload()!=="none"){_this3.mainSegmentLoader_.playlist(media,_this3.requestOptions_);_this3.mainSegmentLoader_.load();}setupMediaGroups({sourceType:_this3.sourceType_,segmentLoaders:{AUDIO:_this3.audioSegmentLoader_,SUBTITLES:_this3.subtitleSegmentLoader_,main:_this3.mainSegmentLoader_},tech:_this3.tech_,requestOptions:_this3.requestOptions_,masterPlaylistLoader:_this3.masterPlaylistLoader_,vhs:_this3.vhs_,master:_this3.master(),mediaTypes:_this3.mediaTypes_,blacklistCurrentPlaylist:_this3.blacklistCurrentPlaylist.bind(_this3)});_this3.triggerPresenceUsage_(_this3.master(),media);_this3.setupFirstPlay();if(!_this3.mediaTypes_.AUDIO.activePlaylistLoader||_this3.mediaTypes_.AUDIO.activePlaylistLoader.media()){_this3.trigger("selectedinitialmedia");}else {_this3.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata",function(){_this3.trigger("selectedinitialmedia");});}});this.masterPlaylistLoader_.on("loadedplaylist",function(){if(_this3.loadOnPlay_){_this3.tech_.off("play",_this3.loadOnPlay_);}var updatedPlaylist=_this3.masterPlaylistLoader_.media();if(!updatedPlaylist){_this3.excludeUnsupportedVariants_();var selectedMedia;if(_this3.enableLowInitialPlaylist){selectedMedia=_this3.selectInitialPlaylist();}if(!selectedMedia){selectedMedia=_this3.selectPlaylist();}if(!selectedMedia||!_this3.shouldSwitchToMedia_(selectedMedia)){return}_this3.initialMedia_=selectedMedia;_this3.switchMedia_(_this3.initialMedia_,"initial");var haveJsonSource=_this3.sourceType_==="vhs-json"&&_this3.initialMedia_.segments;if(!haveJsonSource){return}updatedPlaylist=_this3.initialMedia_;}_this3.handleUpdatedMediaPlaylist(updatedPlaylist);});this.masterPlaylistLoader_.on("error",function(){_this3.blacklistCurrentPlaylist(_this3.masterPlaylistLoader_.error);});this.masterPlaylistLoader_.on("mediachanging",function(){_this3.mainSegmentLoader_.abort();_this3.mainSegmentLoader_.pause();});this.masterPlaylistLoader_.on("mediachange",function(){var media=_this3.masterPlaylistLoader_.media();var requestTimeout=media.targetDuration*1.5*1e3;if(isLowestEnabledRendition(_this3.masterPlaylistLoader_.master,_this3.masterPlaylistLoader_.media())){_this3.requestOptions_.timeout=0;}else {_this3.requestOptions_.timeout=requestTimeout;}_this3.masterPlaylistLoader_.load();_this3.mainSegmentLoader_.playlist(media,_this3.requestOptions_);_this3.mainSegmentLoader_.load();_this3.tech_.trigger({type:"mediachange",bubbles:true});});this.masterPlaylistLoader_.on("playlistunchanged",function(){var updatedPlaylist=_this3.masterPlaylistLoader_.media();if(updatedPlaylist.lastExcludeReason_==="playlist-unchanged"){return}var playlistOutdated=_this3.stuckAtPlaylistEnd_(updatedPlaylist);if(playlistOutdated){_this3.blacklistCurrentPlaylist({message:"Playlist no longer updating.",reason:"playlist-unchanged"});_this3.tech_.trigger("playliststuck");}});this.masterPlaylistLoader_.on("renditiondisabled",function(){_this3.tech_.trigger({type:"usage",name:"vhs-rendition-disabled"});_this3.tech_.trigger({type:"usage",name:"hls-rendition-disabled"});});this.masterPlaylistLoader_.on("renditionenabled",function(){_this3.tech_.trigger({type:"usage",name:"vhs-rendition-enabled"});_this3.tech_.trigger({type:"usage",name:"hls-rendition-enabled"});});};_proto.handleUpdatedMediaPlaylist=function handleUpdatedMediaPlaylist(updatedPlaylist){if(this.useCueTags_){this.updateAdCues_(updatedPlaylist);}this.mainSegmentLoader_.playlist(updatedPlaylist,this.requestOptions_);this.updateDuration(!updatedPlaylist.endList);if(!this.tech_.paused()){this.mainSegmentLoader_.load();if(this.audioSegmentLoader_){this.audioSegmentLoader_.load();}}};_proto.triggerPresenceUsage_=function triggerPresenceUsage_(master,media){var mediaGroups=master.mediaGroups||{};var defaultDemuxed=true;var audioGroupKeys=Object.keys(mediaGroups.AUDIO);for(var mediaGroup in mediaGroups.AUDIO){for(var label in mediaGroups.AUDIO[mediaGroup]){var properties=mediaGroups.AUDIO[mediaGroup][label];if(!properties.uri){defaultDemuxed=false;}}}if(defaultDemuxed){this.tech_.trigger({type:"usage",name:"vhs-demuxed"});this.tech_.trigger({type:"usage",name:"hls-demuxed"});}if(Object.keys(mediaGroups.SUBTITLES).length){this.tech_.trigger({type:"usage",name:"vhs-webvtt"});this.tech_.trigger({type:"usage",name:"hls-webvtt"});}if(Vhs$1.Playlist.isAes(media)){this.tech_.trigger({type:"usage",name:"vhs-aes"});this.tech_.trigger({type:"usage",name:"hls-aes"});}if(audioGroupKeys.length&&Object.keys(mediaGroups.AUDIO[audioGroupKeys[0]]).length>1){this.tech_.trigger({type:"usage",name:"vhs-alternate-audio"});this.tech_.trigger({type:"usage",name:"hls-alternate-audio"});}if(this.useCueTags_){this.tech_.trigger({type:"usage",name:"vhs-playlist-cue-tags"});this.tech_.trigger({type:"usage",name:"hls-playlist-cue-tags"});}};_proto.shouldSwitchToMedia_=function shouldSwitchToMedia_(nextPlaylist){var currentPlaylist=this.masterPlaylistLoader_.media()||this.masterPlaylistLoader_.pendingMedia_;var currentTime=this.tech_.currentTime();var bufferLowWaterLine=this.bufferLowWaterLine();var bufferHighWaterLine=this.bufferHighWaterLine();var buffered=this.tech_.buffered();return shouldSwitchToMedia({buffered:buffered,currentTime:currentTime,currentPlaylist:currentPlaylist,nextPlaylist:nextPlaylist,bufferLowWaterLine:bufferLowWaterLine,bufferHighWaterLine:bufferHighWaterLine,duration:this.duration(),experimentalBufferBasedABR:this.experimentalBufferBasedABR,log:this.logger_})};_proto.setupSegmentLoaderListeners_=function setupSegmentLoaderListeners_(){var _this4=this;this.mainSegmentLoader_.on("bandwidthupdate",function(){_this4.checkABR_("bandwidthupdate");_this4.tech_.trigger("bandwidthupdate");});this.mainSegmentLoader_.on("timeout",function(){if(_this4.experimentalBufferBasedABR){_this4.mainSegmentLoader_.load();}});if(!this.experimentalBufferBasedABR){this.mainSegmentLoader_.on("progress",function(){_this4.trigger("progress");});}this.mainSegmentLoader_.on("error",function(){_this4.blacklistCurrentPlaylist(_this4.mainSegmentLoader_.error());});this.mainSegmentLoader_.on("appenderror",function(){_this4.error=_this4.mainSegmentLoader_.error_;_this4.trigger("error");});this.mainSegmentLoader_.on("syncinfoupdate",function(){_this4.onSyncInfoUpdate_();});this.mainSegmentLoader_.on("timestampoffset",function(){_this4.tech_.trigger({type:"usage",name:"vhs-timestamp-offset"});_this4.tech_.trigger({type:"usage",name:"hls-timestamp-offset"});});this.audioSegmentLoader_.on("syncinfoupdate",function(){_this4.onSyncInfoUpdate_();});this.audioSegmentLoader_.on("appenderror",function(){_this4.error=_this4.audioSegmentLoader_.error_;_this4.trigger("error");});this.mainSegmentLoader_.on("ended",function(){_this4.logger_("main segment loader ended");_this4.onEndOfStream();});this.mainSegmentLoader_.on("earlyabort",function(event){if(_this4.experimentalBufferBasedABR){return}_this4.delegateLoaders_("all",["abort"]);_this4.blacklistCurrentPlaylist({message:"Aborted early because there isn't enough bandwidth to complete the "+"request without rebuffering."},ABORT_EARLY_BLACKLIST_SECONDS);});var updateCodecs=function updateCodecs(){if(!_this4.sourceUpdater_.hasCreatedSourceBuffers()){return _this4.tryToCreateSourceBuffers_()}var codecs=_this4.getCodecsOrExclude_();if(!codecs){return}_this4.sourceUpdater_.addOrChangeSourceBuffers(codecs);};this.mainSegmentLoader_.on("trackinfo",updateCodecs);this.audioSegmentLoader_.on("trackinfo",updateCodecs);this.mainSegmentLoader_.on("fmp4",function(){if(!_this4.triggeredFmp4Usage){_this4.tech_.trigger({type:"usage",name:"vhs-fmp4"});_this4.tech_.trigger({type:"usage",name:"hls-fmp4"});_this4.triggeredFmp4Usage=true;}});this.audioSegmentLoader_.on("fmp4",function(){if(!_this4.triggeredFmp4Usage){_this4.tech_.trigger({type:"usage",name:"vhs-fmp4"});_this4.tech_.trigger({type:"usage",name:"hls-fmp4"});_this4.triggeredFmp4Usage=true;}});this.audioSegmentLoader_.on("ended",function(){_this4.logger_("audioSegmentLoader ended");_this4.onEndOfStream();});};_proto.mediaSecondsLoaded_=function mediaSecondsLoaded_(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)};_proto.load=function load(){this.mainSegmentLoader_.load();if(this.mediaTypes_.AUDIO.activePlaylistLoader){this.audioSegmentLoader_.load();}if(this.mediaTypes_.SUBTITLES.activePlaylistLoader){this.subtitleSegmentLoader_.load();}};_proto.smoothQualityChange_=function smoothQualityChange_(media){if(media===void 0){media=this.selectPlaylist();}this.fastQualityChange_(media);};_proto.fastQualityChange_=function fastQualityChange_(media){var _this5=this;if(media===void 0){media=this.selectPlaylist();}if(media===this.masterPlaylistLoader_.media()){this.logger_("skipping fastQualityChange because new media is same as old");return}this.switchMedia_(media,"fast-quality");this.mainSegmentLoader_.resetEverything(function(){if(videojs.browser.IE_VERSION||videojs.browser.IS_EDGE){_this5.tech_.setCurrentTime(_this5.tech_.currentTime()+.04);}else {_this5.tech_.setCurrentTime(_this5.tech_.currentTime());}});};_proto.play=function play(){if(this.setupFirstPlay()){return}if(this.tech_.ended()){this.tech_.setCurrentTime(0);}if(this.hasPlayed_){this.load();}var seekable=this.tech_.seekable();if(this.tech_.duration()===Infinity){if(this.tech_.currentTime()<seekable.start(0)){return this.tech_.setCurrentTime(seekable.end(seekable.length-1))}}};_proto.setupFirstPlay=function setupFirstPlay(){var _this6=this;var media=this.masterPlaylistLoader_.media();if(!media||this.tech_.paused()||this.hasPlayed_){return false}if(!media.endList){var seekable=this.seekable();if(!seekable.length){return false}if(videojs.browser.IE_VERSION&&this.tech_.readyState()===0){this.tech_.one("loadedmetadata",function(){_this6.trigger("firstplay");_this6.tech_.setCurrentTime(seekable.end(0));_this6.hasPlayed_=true;});return false}this.trigger("firstplay");this.tech_.setCurrentTime(seekable.end(0));}this.hasPlayed_=true;this.load();return true};_proto.handleSourceOpen_=function handleSourceOpen_(){this.tryToCreateSourceBuffers_();if(this.tech_.autoplay()){var playPromise=this.tech_.play();if(typeof playPromise!=="undefined"&&typeof playPromise.then==="function"){playPromise.then(null,function(e){});}}this.trigger("sourceopen");};_proto.handleSourceEnded_=function handleSourceEnded_(){if(!this.inbandTextTracks_.metadataTrack_){return}var cues=this.inbandTextTracks_.metadataTrack_.cues;if(!cues||!cues.length){return}var duration=this.duration();cues[cues.length-1].endTime=isNaN(duration)||Math.abs(duration)===Infinity?Number.MAX_VALUE:duration;};_proto.handleDurationChange_=function handleDurationChange_(){this.tech_.trigger("durationchange");};_proto.onEndOfStream=function onEndOfStream(){var isEndOfStream=this.mainSegmentLoader_.ended_;if(this.mediaTypes_.AUDIO.activePlaylistLoader){var mainMediaInfo=this.mainSegmentLoader_.getCurrentMediaInfo_();if(!mainMediaInfo||mainMediaInfo.hasVideo){isEndOfStream=isEndOfStream&&this.audioSegmentLoader_.ended_;}else {isEndOfStream=this.audioSegmentLoader_.ended_;}}if(!isEndOfStream){return}this.stopABRTimer_();this.sourceUpdater_.endOfStream();};_proto.stuckAtPlaylistEnd_=function stuckAtPlaylistEnd_(playlist){var seekable=this.seekable();if(!seekable.length){return false}var expired=this.syncController_.getExpiredTime(playlist,this.duration());if(expired===null){return false}var absolutePlaylistEnd=Vhs$1.Playlist.playlistEnd(playlist,expired);var currentTime=this.tech_.currentTime();var buffered=this.tech_.buffered();if(!buffered.length){return absolutePlaylistEnd-currentTime<=SAFE_TIME_DELTA}var bufferedEnd=buffered.end(buffered.length-1);return bufferedEnd-currentTime<=SAFE_TIME_DELTA&&absolutePlaylistEnd-bufferedEnd<=SAFE_TIME_DELTA};_proto.blacklistCurrentPlaylist=function blacklistCurrentPlaylist(error,blacklistDuration){if(error===void 0){error={};}var currentPlaylist=error.playlist||this.masterPlaylistLoader_.media();blacklistDuration=blacklistDuration||error.blacklistDuration||this.blacklistDuration;if(!currentPlaylist){this.error=error;if(this.mediaSource.readyState!=="open"){this.trigger("error");}else {this.sourceUpdater_.endOfStream("network");}return}currentPlaylist.playlistErrors_++;var playlists=this.masterPlaylistLoader_.master.playlists;var enabledPlaylists=playlists.filter(isEnabled);var isFinalRendition=enabledPlaylists.length===1&&enabledPlaylists[0]===currentPlaylist;if(playlists.length===1&&blacklistDuration!==Infinity){videojs.log.warn("Problem encountered with playlist "+currentPlaylist.id+". "+"Trying again since it is the only playlist.");this.tech_.trigger("retryplaylist");return this.masterPlaylistLoader_.load(isFinalRendition)}if(isFinalRendition){var reincluded=false;playlists.forEach(function(playlist){if(playlist===currentPlaylist){return}var excludeUntil=playlist.excludeUntil;if(typeof excludeUntil!=="undefined"&&excludeUntil!==Infinity){reincluded=true;delete playlist.excludeUntil;}});if(reincluded){videojs.log.warn("Removing other playlists from the exclusion list because the last "+"rendition is about to be excluded.");this.tech_.trigger("retryplaylist");}}var excludeUntil;if(currentPlaylist.playlistErrors_>this.maxPlaylistRetries){excludeUntil=Infinity;}else {excludeUntil=Date.now()+blacklistDuration*1e3;}currentPlaylist.excludeUntil=excludeUntil;if(error.reason){currentPlaylist.lastExcludeReason_=error.reason;}this.tech_.trigger("blacklistplaylist");this.tech_.trigger({type:"usage",name:"vhs-rendition-blacklisted"});this.tech_.trigger({type:"usage",name:"hls-rendition-blacklisted"});var nextPlaylist=this.selectPlaylist();if(!nextPlaylist){this.error="Playback cannot continue. No available working or supported playlists.";this.trigger("error");return}var logFn=error.internal?this.logger_:videojs.log.warn;var errorMessage=error.message?" "+error.message:"";logFn((error.internal?"Internal problem":"Problem")+" encountered with playlist "+currentPlaylist.id+"."+(errorMessage+" Switching to playlist "+nextPlaylist.id+"."));if(nextPlaylist.attributes.AUDIO!==currentPlaylist.attributes.AUDIO){this.delegateLoaders_("audio",["abort","pause"]);}if(nextPlaylist.attributes.SUBTITLES!==currentPlaylist.attributes.SUBTITLES){this.delegateLoaders_("subtitle",["abort","pause"]);}this.delegateLoaders_("main",["abort","pause"]);var delayDuration=nextPlaylist.targetDuration/2*1e3||5*1e3;var shouldDelay=typeof nextPlaylist.lastRequest==="number"&&Date.now()-nextPlaylist.lastRequest<=delayDuration;return this.switchMedia_(nextPlaylist,"exclude",isFinalRendition||shouldDelay)};_proto.pauseLoading=function pauseLoading(){this.delegateLoaders_("all",["abort","pause"]);this.stopABRTimer_();};_proto.delegateLoaders_=function delegateLoaders_(filter,fnNames){var _this7=this;var loaders=[];var dontFilterPlaylist=filter==="all";if(dontFilterPlaylist||filter==="main"){loaders.push(this.masterPlaylistLoader_);}var mediaTypes=[];if(dontFilterPlaylist||filter==="audio"){mediaTypes.push("AUDIO");}if(dontFilterPlaylist||filter==="subtitle"){mediaTypes.push("CLOSED-CAPTIONS");mediaTypes.push("SUBTITLES");}mediaTypes.forEach(function(mediaType){var loader=_this7.mediaTypes_[mediaType]&&_this7.mediaTypes_[mediaType].activePlaylistLoader;if(loader){loaders.push(loader);}});["main","audio","subtitle"].forEach(function(name){var loader=_this7[name+"SegmentLoader_"];if(loader&&(filter===name||filter==="all")){loaders.push(loader);}});loaders.forEach(function(loader){return fnNames.forEach(function(fnName){if(typeof loader[fnName]==="function"){loader[fnName]();}})});};_proto.setCurrentTime=function setCurrentTime(currentTime){var buffered=findRange(this.tech_.buffered(),currentTime);if(!(this.masterPlaylistLoader_&&this.masterPlaylistLoader_.media())){return 0}if(!this.masterPlaylistLoader_.media().segments){return 0}if(buffered&&buffered.length){return currentTime}this.mainSegmentLoader_.resetEverything();this.mainSegmentLoader_.abort();if(this.mediaTypes_.AUDIO.activePlaylistLoader){this.audioSegmentLoader_.resetEverything();this.audioSegmentLoader_.abort();}if(this.mediaTypes_.SUBTITLES.activePlaylistLoader){this.subtitleSegmentLoader_.resetEverything();this.subtitleSegmentLoader_.abort();}this.load();};_proto.duration=function duration(){if(!this.masterPlaylistLoader_){return 0}var media=this.masterPlaylistLoader_.media();if(!media){return 0}if(!media.endList){return Infinity}if(this.mediaSource){return this.mediaSource.duration}return Vhs$1.Playlist.duration(media)};_proto.seekable=function seekable(){return this.seekable_};_proto.onSyncInfoUpdate_=function onSyncInfoUpdate_(){var audioSeekable;if(!this.masterPlaylistLoader_){return}var media=this.masterPlaylistLoader_.media();if(!media){return}var expired=this.syncController_.getExpiredTime(media,this.duration());if(expired===null){return}var master=this.masterPlaylistLoader_.master;var mainSeekable=Vhs$1.Playlist.seekable(media,expired,Vhs$1.Playlist.liveEdgeDelay(master,media));if(mainSeekable.length===0){return}if(this.mediaTypes_.AUDIO.activePlaylistLoader){media=this.mediaTypes_.AUDIO.activePlaylistLoader.media();expired=this.syncController_.getExpiredTime(media,this.duration());if(expired===null){return}audioSeekable=Vhs$1.Playlist.seekable(media,expired,Vhs$1.Playlist.liveEdgeDelay(master,media));if(audioSeekable.length===0){return}}var oldEnd;var oldStart;if(this.seekable_&&this.seekable_.length){oldEnd=this.seekable_.end(0);oldStart=this.seekable_.start(0);}if(!audioSeekable){this.seekable_=mainSeekable;}else if(audioSeekable.start(0)>mainSeekable.end(0)||mainSeekable.start(0)>audioSeekable.end(0)){this.seekable_=mainSeekable;}else {this.seekable_=videojs.createTimeRanges([[audioSeekable.start(0)>mainSeekable.start(0)?audioSeekable.start(0):mainSeekable.start(0),audioSeekable.end(0)<mainSeekable.end(0)?audioSeekable.end(0):mainSeekable.end(0)]]);}if(this.seekable_&&this.seekable_.length){if(this.seekable_.end(0)===oldEnd&&this.seekable_.start(0)===oldStart){return}}this.logger_("seekable updated ["+printableRange(this.seekable_)+"]");this.tech_.trigger("seekablechanged");};_proto.updateDuration=function updateDuration(isLive){if(this.updateDuration_){this.mediaSource.removeEventListener("sourceopen",this.updateDuration_);this.updateDuration_=null;}if(this.mediaSource.readyState!=="open"){this.updateDuration_=this.updateDuration.bind(this,isLive);this.mediaSource.addEventListener("sourceopen",this.updateDuration_);return}if(isLive){var seekable=this.seekable();if(!seekable.length){return}if(isNaN(this.mediaSource.duration)||this.mediaSource.duration<seekable.end(seekable.length-1)){this.sourceUpdater_.setDuration(seekable.end(seekable.length-1));}return}var buffered=this.tech_.buffered();var duration=Vhs$1.Playlist.duration(this.masterPlaylistLoader_.media());if(buffered.length>0){duration=Math.max(duration,buffered.end(buffered.length-1));}if(this.mediaSource.duration!==duration){this.sourceUpdater_.setDuration(duration);}};_proto.dispose=function dispose(){var _this8=this;this.trigger("dispose");this.decrypter_.terminate();this.masterPlaylistLoader_.dispose();this.mainSegmentLoader_.dispose();if(this.loadOnPlay_){this.tech_.off("play",this.loadOnPlay_);}["AUDIO","SUBTITLES"].forEach(function(type){var groups=_this8.mediaTypes_[type].groups;for(var id in groups){groups[id].forEach(function(group){if(group.playlistLoader){group.playlistLoader.dispose();}});}});this.audioSegmentLoader_.dispose();this.subtitleSegmentLoader_.dispose();this.sourceUpdater_.dispose();this.timelineChangeController_.dispose();this.stopABRTimer_();if(this.updateDuration_){this.mediaSource.removeEventListener("sourceopen",this.updateDuration_);}this.mediaSource.removeEventListener("durationchange",this.handleDurationChange_);this.mediaSource.removeEventListener("sourceopen",this.handleSourceOpen_);this.mediaSource.removeEventListener("sourceended",this.handleSourceEnded_);this.off();};_proto.master=function master(){return this.masterPlaylistLoader_.master};_proto.media=function media(){return this.masterPlaylistLoader_.media()||this.initialMedia_};_proto.areMediaTypesKnown_=function areMediaTypesKnown_(){var usingAudioLoader=!!this.mediaTypes_.AUDIO.activePlaylistLoader;var hasMainMediaInfo=!!this.mainSegmentLoader_.getCurrentMediaInfo_();var hasAudioMediaInfo=!usingAudioLoader?true:!!this.audioSegmentLoader_.getCurrentMediaInfo_();if(!hasMainMediaInfo||!hasAudioMediaInfo){return false}return true};_proto.getCodecsOrExclude_=function getCodecsOrExclude_(){var _this9=this;var media={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}};media.video=media.main;var playlistCodecs=codecsForPlaylist(this.master(),this.media());var codecs={};var usingAudioLoader=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(media.main.hasVideo){codecs.video=playlistCodecs.video||media.main.videoCodec||DEFAULT_VIDEO_CODEC;}if(media.main.isMuxed){codecs.video+=","+(playlistCodecs.audio||media.main.audioCodec||DEFAULT_AUDIO_CODEC);}if(media.main.hasAudio&&!media.main.isMuxed||media.audio.hasAudio||usingAudioLoader){codecs.audio=playlistCodecs.audio||media.main.audioCodec||media.audio.audioCodec||DEFAULT_AUDIO_CODEC;media.audio.isFmp4=media.main.hasAudio&&!media.main.isMuxed?media.main.isFmp4:media.audio.isFmp4;}if(!codecs.audio&&!codecs.video){this.blacklistCurrentPlaylist({playlist:this.media(),message:"Could not determine codecs for playlist.",blacklistDuration:Infinity});return}var supportFunction=function supportFunction(isFmp4,codec){return isFmp4?browserSupportsCodec(codec):muxerSupportsCodec(codec)};var unsupportedCodecs={};var unsupportedAudio;["video","audio"].forEach(function(type){if(codecs.hasOwnProperty(type)&&!supportFunction(media[type].isFmp4,codecs[type])){var supporter=media[type].isFmp4?"browser":"muxer";unsupportedCodecs[supporter]=unsupportedCodecs[supporter]||[];unsupportedCodecs[supporter].push(codecs[type]);if(type==="audio"){unsupportedAudio=supporter;}}});if(usingAudioLoader&&unsupportedAudio&&this.media().attributes.AUDIO){var audioGroup=this.media().attributes.AUDIO;this.master().playlists.forEach(function(variant){var variantAudioGroup=variant.attributes&&variant.attributes.AUDIO;if(variantAudioGroup===audioGroup&&variant!==_this9.media()){variant.excludeUntil=Infinity;}});this.logger_("excluding audio group "+audioGroup+" as "+unsupportedAudio+' does not support codec(s): "'+codecs.audio+'"');}if(Object.keys(unsupportedCodecs).length){var message=Object.keys(unsupportedCodecs).reduce(function(acc,supporter){if(acc){acc+=", ";}acc+=supporter+' does not support codec(s): "'+unsupportedCodecs[supporter].join(",")+'"';return acc},"")+".";this.blacklistCurrentPlaylist({playlist:this.media(),internal:true,message:message,blacklistDuration:Infinity});return}if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){var switchMessages=[];["video","audio"].forEach(function(type){var newCodec=(parseCodecs(_this9.sourceUpdater_.codecs[type]||"")[0]||{}).type;var oldCodec=(parseCodecs(codecs[type]||"")[0]||{}).type;if(newCodec&&oldCodec&&newCodec.toLowerCase()!==oldCodec.toLowerCase()){switchMessages.push('"'+_this9.sourceUpdater_.codecs[type]+'" -> "'+codecs[type]+'"');}});if(switchMessages.length){this.blacklistCurrentPlaylist({playlist:this.media(),message:"Codec switching not supported: "+switchMessages.join(", ")+".",blacklistDuration:Infinity,internal:true});return}}return codecs};_proto.tryToCreateSourceBuffers_=function tryToCreateSourceBuffers_(){if(this.mediaSource.readyState!=="open"||this.sourceUpdater_.hasCreatedSourceBuffers()){return}if(!this.areMediaTypesKnown_()){return}var codecs=this.getCodecsOrExclude_();if(!codecs){return}this.sourceUpdater_.createSourceBuffers(codecs);var codecString=[codecs.video,codecs.audio].filter(Boolean).join(",");this.excludeIncompatibleVariants_(codecString);};_proto.excludeUnsupportedVariants_=function excludeUnsupportedVariants_(){var _this10=this;var playlists=this.master().playlists;var ids=[];Object.keys(playlists).forEach(function(key){var variant=playlists[key];if(ids.indexOf(variant.id)!==-1){return}ids.push(variant.id);var codecs=codecsForPlaylist(_this10.master,variant);var unsupported=[];if(codecs.audio&&!muxerSupportsCodec(codecs.audio)&&!browserSupportsCodec(codecs.audio)){unsupported.push("audio codec "+codecs.audio);}if(codecs.video&&!muxerSupportsCodec(codecs.video)&&!browserSupportsCodec(codecs.video)){unsupported.push("video codec "+codecs.video);}if(codecs.text&&codecs.text==="stpp.ttml.im1t"){unsupported.push("text codec "+codecs.text);}if(unsupported.length){variant.excludeUntil=Infinity;_this10.logger_("excluding "+variant.id+" for unsupported: "+unsupported.join(", "));}});};_proto.excludeIncompatibleVariants_=function excludeIncompatibleVariants_(codecString){var _this11=this;var ids=[];var playlists=this.master().playlists;var codecs=unwrapCodecList(parseCodecs(codecString));var codecCount_=codecCount(codecs);var videoDetails=codecs.video&&parseCodecs(codecs.video)[0]||null;var audioDetails=codecs.audio&&parseCodecs(codecs.audio)[0]||null;Object.keys(playlists).forEach(function(key){var variant=playlists[key];if(ids.indexOf(variant.id)!==-1||variant.excludeUntil===Infinity){return}ids.push(variant.id);var blacklistReasons=[];var variantCodecs=codecsForPlaylist(_this11.masterPlaylistLoader_.master,variant);var variantCodecCount=codecCount(variantCodecs);if(!variantCodecs.audio&&!variantCodecs.video){return}if(variantCodecCount!==codecCount_){blacklistReasons.push('codec count "'+variantCodecCount+'" !== "'+codecCount_+'"');}if(!_this11.sourceUpdater_.canChangeType()){var variantVideoDetails=variantCodecs.video&&parseCodecs(variantCodecs.video)[0]||null;var variantAudioDetails=variantCodecs.audio&&parseCodecs(variantCodecs.audio)[0]||null;if(variantVideoDetails&&videoDetails&&variantVideoDetails.type.toLowerCase()!==videoDetails.type.toLowerCase()){blacklistReasons.push('video codec "'+variantVideoDetails.type+'" !== "'+videoDetails.type+'"');}if(variantAudioDetails&&audioDetails&&variantAudioDetails.type.toLowerCase()!==audioDetails.type.toLowerCase()){blacklistReasons.push('audio codec "'+variantAudioDetails.type+'" !== "'+audioDetails.type+'"');}}if(blacklistReasons.length){variant.excludeUntil=Infinity;_this11.logger_("blacklisting "+variant.id+": "+blacklistReasons.join(" && "));}});};_proto.updateAdCues_=function updateAdCues_(media){var offset=0;var seekable=this.seekable();if(seekable.length){offset=seekable.start(0);}updateAdCues(media,this.cueTagsTrack_,offset);};_proto.goalBufferLength=function goalBufferLength(){var currentTime=this.tech_.currentTime();var initial=Config.GOAL_BUFFER_LENGTH;var rate=Config.GOAL_BUFFER_LENGTH_RATE;var max=Math.max(initial,Config.MAX_GOAL_BUFFER_LENGTH);return Math.min(initial+currentTime*rate,max)};_proto.bufferLowWaterLine=function bufferLowWaterLine(){var currentTime=this.tech_.currentTime();var initial=Config.BUFFER_LOW_WATER_LINE;var rate=Config.BUFFER_LOW_WATER_LINE_RATE;var max=Math.max(initial,Config.MAX_BUFFER_LOW_WATER_LINE);var newMax=Math.max(initial,Config.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(initial+currentTime*rate,this.experimentalBufferBasedABR?newMax:max)};_proto.bufferHighWaterLine=function bufferHighWaterLine(){return Config.BUFFER_HIGH_WATER_LINE};return MasterPlaylistController}(videojs.EventTarget);var enableFunction=function enableFunction(loader,playlistID,changePlaylistFn){return function(enable){var playlist=loader.master.playlists[playlistID];var incompatible=isIncompatible(playlist);var currentlyEnabled=isEnabled(playlist);if(typeof enable==="undefined"){return currentlyEnabled}if(enable){delete playlist.disabled;}else {playlist.disabled=true;}if(enable!==currentlyEnabled&&!incompatible){changePlaylistFn();if(enable){loader.trigger("renditionenabled");}else {loader.trigger("renditiondisabled");}}return enable}};var Representation=function Representation(vhsHandler,playlist,id){var mpc=vhsHandler.masterPlaylistController_,smoothQualityChange=vhsHandler.options_.smoothQualityChange;var changeType=smoothQualityChange?"smooth":"fast";var qualityChangeFunction=mpc[changeType+"QualityChange_"].bind(mpc);if(playlist.attributes){var resolution=playlist.attributes.RESOLUTION;this.width=resolution&&resolution.width;this.height=resolution&&resolution.height;this.bandwidth=playlist.attributes.BANDWIDTH;this.frameRate=playlist.attributes["FRAME-RATE"];}this.codecs=codecsForPlaylist(mpc.master(),playlist);this.playlist=playlist;this.id=id;this.enabled=enableFunction(vhsHandler.playlists,playlist.id,qualityChangeFunction);};var renditionSelectionMixin=function renditionSelectionMixin(vhsHandler){vhsHandler.representations=function(){var master=vhsHandler.masterPlaylistController_.master();var playlists=isAudioOnly(master)?vhsHandler.masterPlaylistController_.getAudioTrackPlaylists_():master.playlists;if(!playlists){return []}return playlists.filter(function(media){return !isIncompatible(media)}).map(function(e,i){return new Representation(vhsHandler,e,e.id)})};};var timerCancelEvents=["seeking","seeked","pause","playing","error"];var PlaybackWatcher=function(){function PlaybackWatcher(options){var _this=this;this.masterPlaylistController_=options.masterPlaylistController;this.tech_=options.tech;this.seekable=options.seekable;this.allowSeeksWithinUnsafeLiveWindow=options.allowSeeksWithinUnsafeLiveWindow;this.liveRangeSafeTimeDelta=options.liveRangeSafeTimeDelta;this.media=options.media;this.consecutiveUpdates=0;this.lastRecordedTime=null;this.timer_=null;this.checkCurrentTimeTimeout_=null;this.logger_=logger("PlaybackWatcher");this.logger_("initialize");var playHandler=function playHandler(){return _this.monitorCurrentTime_()};var canPlayHandler=function canPlayHandler(){return _this.monitorCurrentTime_()};var waitingHandler=function waitingHandler(){return _this.techWaiting_()};var cancelTimerHandler=function cancelTimerHandler(){return _this.cancelTimer_()};var mpc=this.masterPlaylistController_;var loaderTypes=["main","subtitle","audio"];var loaderChecks={};loaderTypes.forEach(function(type){loaderChecks[type]={reset:function reset(){return _this.resetSegmentDownloads_(type)},updateend:function updateend(){return _this.checkSegmentDownloads_(type)}};mpc[type+"SegmentLoader_"].on("appendsdone",loaderChecks[type].updateend);mpc[type+"SegmentLoader_"].on("playlistupdate",loaderChecks[type].reset);_this.tech_.on(["seeked","seeking"],loaderChecks[type].reset);});var setSeekingHandlers=function setSeekingHandlers(fn){["main","audio"].forEach(function(type){mpc[type+"SegmentLoader_"][fn]("appended",_this.seekingAppendCheck_);});};this.seekingAppendCheck_=function(){if(_this.fixesBadSeeks_()){_this.consecutiveUpdates=0;_this.lastRecordedTime=_this.tech_.currentTime();setSeekingHandlers("off");}};this.clearSeekingAppendCheck_=function(){return setSeekingHandlers("off")};this.watchForBadSeeking_=function(){_this.clearSeekingAppendCheck_();setSeekingHandlers("on");};this.tech_.on("seeked",this.clearSeekingAppendCheck_);this.tech_.on("seeking",this.watchForBadSeeking_);this.tech_.on("waiting",waitingHandler);this.tech_.on(timerCancelEvents,cancelTimerHandler);this.tech_.on("canplay",canPlayHandler);this.tech_.one("play",playHandler);this.dispose=function(){_this.clearSeekingAppendCheck_();_this.logger_("dispose");_this.tech_.off("waiting",waitingHandler);_this.tech_.off(timerCancelEvents,cancelTimerHandler);_this.tech_.off("canplay",canPlayHandler);_this.tech_.off("play",playHandler);_this.tech_.off("seeking",_this.watchForBadSeeking_);_this.tech_.off("seeked",_this.clearSeekingAppendCheck_);loaderTypes.forEach(function(type){mpc[type+"SegmentLoader_"].off("appendsdone",loaderChecks[type].updateend);mpc[type+"SegmentLoader_"].off("playlistupdate",loaderChecks[type].reset);_this.tech_.off(["seeked","seeking"],loaderChecks[type].reset);});if(_this.checkCurrentTimeTimeout_){window_1.clearTimeout(_this.checkCurrentTimeTimeout_);}_this.cancelTimer_();};}var _proto=PlaybackWatcher.prototype;_proto.monitorCurrentTime_=function monitorCurrentTime_(){this.checkCurrentTime_();if(this.checkCurrentTimeTimeout_){window_1.clearTimeout(this.checkCurrentTimeTimeout_);}this.checkCurrentTimeTimeout_=window_1.setTimeout(this.monitorCurrentTime_.bind(this),250);};_proto.resetSegmentDownloads_=function resetSegmentDownloads_(type){var loader=this.masterPlaylistController_[type+"SegmentLoader_"];if(this[type+"StalledDownloads_"]>0){this.logger_("resetting possible stalled download count for "+type+" loader");}this[type+"StalledDownloads_"]=0;this[type+"Buffered_"]=loader.buffered_();};_proto.checkSegmentDownloads_=function checkSegmentDownloads_(type){var mpc=this.masterPlaylistController_;var loader=mpc[type+"SegmentLoader_"];var buffered=loader.buffered_();var isBufferedDifferent=isRangeDifferent(this[type+"Buffered_"],buffered);this[type+"Buffered_"]=buffered;if(isBufferedDifferent){this.resetSegmentDownloads_(type);return}this[type+"StalledDownloads_"]++;this.logger_("found #"+this[type+"StalledDownloads_"]+" "+type+" appends that did not increase buffer (possible stalled download)",{playlistId:loader.playlist_&&loader.playlist_.id,buffered:timeRangesToArray(buffered)});if(this[type+"StalledDownloads_"]<10){return}this.logger_(type+" loader stalled download exclusion");this.resetSegmentDownloads_(type);this.tech_.trigger({type:"usage",name:"vhs-"+type+"-download-exclusion"});if(type==="subtitle"){return}mpc.blacklistCurrentPlaylist({message:"Excessive "+type+" segment downloading detected."},Infinity);};_proto.checkCurrentTime_=function checkCurrentTime_(){if(this.tech_.paused()||this.tech_.seeking()){return}var currentTime=this.tech_.currentTime();var buffered=this.tech_.buffered();if(this.lastRecordedTime===currentTime&&(!buffered.length||currentTime+SAFE_TIME_DELTA>=buffered.end(buffered.length-1))){return this.techWaiting_()}if(this.consecutiveUpdates>=5&¤tTime===this.lastRecordedTime){this.consecutiveUpdates++;this.waiting_();}else if(currentTime===this.lastRecordedTime){this.consecutiveUpdates++;}else {this.consecutiveUpdates=0;this.lastRecordedTime=currentTime;}};_proto.cancelTimer_=function cancelTimer_(){this.consecutiveUpdates=0;if(this.timer_){this.logger_("cancelTimer_");clearTimeout(this.timer_);}this.timer_=null;};_proto.fixesBadSeeks_=function fixesBadSeeks_(){var seeking=this.tech_.seeking();if(!seeking){return false}var seekable=this.seekable();var currentTime=this.tech_.currentTime();var isAfterSeekableRange=this.afterSeekableWindow_(seekable,currentTime,this.media(),this.allowSeeksWithinUnsafeLiveWindow);var seekTo;if(isAfterSeekableRange){var seekableEnd=seekable.end(seekable.length-1);seekTo=seekableEnd;}if(this.beforeSeekableWindow_(seekable,currentTime)){var seekableStart=seekable.start(0);seekTo=seekableStart+(seekableStart===seekable.end(0)?0:SAFE_TIME_DELTA);}if(typeof seekTo!=="undefined"){this.logger_("Trying to seek outside of seekable at time "+currentTime+" with "+("seekable range "+printableRange(seekable)+". Seeking to ")+(seekTo+"."));this.tech_.setCurrentTime(seekTo);return true}var sourceUpdater=this.masterPlaylistController_.sourceUpdater_;var buffered=this.tech_.buffered();var audioBuffered=sourceUpdater.audioBuffer?sourceUpdater.audioBuffered():null;var videoBuffered=sourceUpdater.videoBuffer?sourceUpdater.videoBuffered():null;var media=this.media();var minAppendedDuration=media.partTargetDuration?media.partTargetDuration:(media.targetDuration-TIME_FUDGE_FACTOR)*2;var bufferedToCheck=[audioBuffered,videoBuffered];for(var i=0;i<bufferedToCheck.length;i++){if(!bufferedToCheck[i]){continue}var timeAhead=timeAheadOf(bufferedToCheck[i],currentTime);if(timeAhead<minAppendedDuration){return false}}var nextRange=findNextRange(buffered,currentTime);if(nextRange.length===0){return false}seekTo=nextRange.start(0)+SAFE_TIME_DELTA;this.logger_("Buffered region starts ("+nextRange.start(0)+") "+(" just beyond seek point ("+currentTime+"). Seeking to "+seekTo+"."));this.tech_.setCurrentTime(seekTo);return true};_proto.waiting_=function waiting_(){if(this.techWaiting_()){return}var currentTime=this.tech_.currentTime();var buffered=this.tech_.buffered();var currentRange=findRange(buffered,currentTime);if(currentRange.length&¤tTime+3<=currentRange.end(0)){this.cancelTimer_();this.tech_.setCurrentTime(currentTime);this.logger_("Stopped at "+currentTime+" while inside a buffered region "+("["+currentRange.start(0)+" -> "+currentRange.end(0)+"]. Attempting to resume ")+"playback by seeking to the current time.");this.tech_.trigger({type:"usage",name:"vhs-unknown-waiting"});this.tech_.trigger({type:"usage",name:"hls-unknown-waiting"});return}};_proto.techWaiting_=function techWaiting_(){var seekable=this.seekable();var currentTime=this.tech_.currentTime();if(this.tech_.seeking()||this.timer_!==null){return true}if(this.beforeSeekableWindow_(seekable,currentTime)){var livePoint=seekable.end(seekable.length-1);this.logger_("Fell out of live window at time "+currentTime+". Seeking to "+("live point (seekable end) "+livePoint));this.cancelTimer_();this.tech_.setCurrentTime(livePoint);this.tech_.trigger({type:"usage",name:"vhs-live-resync"});this.tech_.trigger({type:"usage",name:"hls-live-resync"});return true}var sourceUpdater=this.tech_.vhs.masterPlaylistController_.sourceUpdater_;var buffered=this.tech_.buffered();var videoUnderflow=this.videoUnderflow_({audioBuffered:sourceUpdater.audioBuffered(),videoBuffered:sourceUpdater.videoBuffered(),currentTime:currentTime});if(videoUnderflow){this.cancelTimer_();this.tech_.setCurrentTime(currentTime);this.tech_.trigger({type:"usage",name:"vhs-video-underflow"});this.tech_.trigger({type:"usage",name:"hls-video-underflow"});return true}var nextRange=findNextRange(buffered,currentTime);if(nextRange.length>0){var difference=nextRange.start(0)-currentTime;this.logger_("Stopped at "+currentTime+", setting timer for "+difference+", seeking "+("to "+nextRange.start(0)));this.cancelTimer_();this.timer_=setTimeout(this.skipTheGap_.bind(this),difference*1e3,currentTime);return true}return false};_proto.afterSeekableWindow_=function afterSeekableWindow_(seekable,currentTime,playlist,allowSeeksWithinUnsafeLiveWindow){if(allowSeeksWithinUnsafeLiveWindow===void 0){allowSeeksWithinUnsafeLiveWindow=false;}if(!seekable.length){return false}var allowedEnd=seekable.end(seekable.length-1)+SAFE_TIME_DELTA;var isLive=!playlist.endList;if(isLive&&allowSeeksWithinUnsafeLiveWindow){allowedEnd=seekable.end(seekable.length-1)+playlist.targetDuration*3;}if(currentTime>allowedEnd){return true}return false};_proto.beforeSeekableWindow_=function beforeSeekableWindow_(seekable,currentTime){if(seekable.length&&seekable.start(0)>0&¤tTime<seekable.start(0)-this.liveRangeSafeTimeDelta){return true}return false};_proto.videoUnderflow_=function videoUnderflow_(_ref){var videoBuffered=_ref.videoBuffered,audioBuffered=_ref.audioBuffered,currentTime=_ref.currentTime;if(!videoBuffered){return}var gap;if(videoBuffered.length&&audioBuffered.length){var lastVideoRange=findRange(videoBuffered,currentTime-3);var videoRange=findRange(videoBuffered,currentTime);var audioRange=findRange(audioBuffered,currentTime);if(audioRange.length&&!videoRange.length&&lastVideoRange.length){gap={start:lastVideoRange.end(0),end:audioRange.end(0)};}}else {var nextRange=findNextRange(videoBuffered,currentTime);if(!nextRange.length){gap=this.gapFromVideoUnderflow_(videoBuffered,currentTime);}}if(gap){this.logger_("Encountered a gap in video from "+gap.start+" to "+gap.end+". "+("Seeking to current time "+currentTime));return true}return false};_proto.skipTheGap_=function skipTheGap_(scheduledCurrentTime){var buffered=this.tech_.buffered();var currentTime=this.tech_.currentTime();var nextRange=findNextRange(buffered,currentTime);this.cancelTimer_();if(nextRange.length===0||currentTime!==scheduledCurrentTime){return}this.logger_("skipTheGap_:","currentTime:",currentTime,"scheduled currentTime:",scheduledCurrentTime,"nextRange start:",nextRange.start(0));this.tech_.setCurrentTime(nextRange.start(0)+TIME_FUDGE_FACTOR);this.tech_.trigger({type:"usage",name:"vhs-gap-skip"});this.tech_.trigger({type:"usage",name:"hls-gap-skip"});};_proto.gapFromVideoUnderflow_=function gapFromVideoUnderflow_(buffered,currentTime){var gaps=findGaps(buffered);for(var i=0;i<gaps.length;i++){var start=gaps.start(i);var end=gaps.end(i);if(currentTime-start<4&¤tTime-start>2){return {start:start,end:end}}}return null};return PlaybackWatcher}();var defaultOptions={errorInterval:30,getSource:function getSource(next){var tech=this.tech({IWillNotUseThisInPlugins:true});var sourceObj=tech.currentSource_||this.currentSource();return next(sourceObj)}};var initPlugin=function initPlugin(player,options){var lastCalled=0;var seekTo=0;var localOptions=videojs.mergeOptions(defaultOptions,options);player.ready(function(){player.trigger({type:"usage",name:"vhs-error-reload-initialized"});player.trigger({type:"usage",name:"hls-error-reload-initialized"});});var loadedMetadataHandler=function loadedMetadataHandler(){if(seekTo){player.currentTime(seekTo);}};var setSource=function setSource(sourceObj){if(sourceObj===null||sourceObj===undefined){return}seekTo=player.duration()!==Infinity&&player.currentTime()||0;player.one("loadedmetadata",loadedMetadataHandler);player.src(sourceObj);player.trigger({type:"usage",name:"vhs-error-reload"});player.trigger({type:"usage",name:"hls-error-reload"});player.play();};var errorHandler=function errorHandler(){if(Date.now()-lastCalled<localOptions.errorInterval*1e3){player.trigger({type:"usage",name:"vhs-error-reload-canceled"});player.trigger({type:"usage",name:"hls-error-reload-canceled"});return}if(!localOptions.getSource||typeof localOptions.getSource!=="function"){videojs.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!");return}lastCalled=Date.now();return localOptions.getSource.call(player,setSource)};var cleanupEvents=function cleanupEvents(){player.off("loadedmetadata",loadedMetadataHandler);player.off("error",errorHandler);player.off("dispose",cleanupEvents);};var reinitPlugin=function reinitPlugin(newOptions){cleanupEvents();initPlugin(player,newOptions);};player.on("error",errorHandler);player.on("dispose",cleanupEvents);player.reloadSourceOnError=reinitPlugin;};var reloadSourceOnError=function reloadSourceOnError(options){initPlugin(this,options);};var version$4="2.16.0";var version$3="6.0.1";var version$2="0.22.1";var version$1="4.8.0";var version="3.1.3";var Vhs={PlaylistLoader:PlaylistLoader,Playlist:Playlist,utils:utils,STANDARD_PLAYLIST_SELECTOR:lastBandwidthSelector,INITIAL_PLAYLIST_SELECTOR:lowestBitrateCompatibleVariantSelector,lastBandwidthSelector:lastBandwidthSelector,movingAverageBandwidthSelector:movingAverageBandwidthSelector,comparePlaylistBandwidth:comparePlaylistBandwidth,comparePlaylistResolution:comparePlaylistResolution,xhr:xhrFactory()};Object.keys(Config).forEach(function(prop){Object.defineProperty(Vhs,prop,{get:function get(){videojs.log.warn("using Vhs."+prop+" is UNSAFE be sure you know what you are doing");return Config[prop]},set:function set(value){videojs.log.warn("using Vhs."+prop+" is UNSAFE be sure you know what you are doing");if(typeof value!=="number"||value<0){videojs.log.warn("value of Vhs."+prop+" must be greater than or equal to 0");return}Config[prop]=value;}});});var LOCAL_STORAGE_KEY="videojs-vhs";var handleVhsMediaChange=function handleVhsMediaChange(qualityLevels,playlistLoader){var newPlaylist=playlistLoader.media();var selectedIndex=-1;for(var i=0;i<qualityLevels.length;i++){if(qualityLevels[i].id===newPlaylist.id){selectedIndex=i;break}}qualityLevels.selectedIndex_=selectedIndex;qualityLevels.trigger({selectedIndex:selectedIndex,type:"change"});};var handleVhsLoadedMetadata=function handleVhsLoadedMetadata(qualityLevels,vhs){vhs.representations().forEach(function(rep){qualityLevels.addQualityLevel(rep);});handleVhsMediaChange(qualityLevels,vhs.playlists);};Vhs.canPlaySource=function(){return videojs.log.warn("HLS is no longer a tech. Please remove it from "+"your player's techOrder.")};var emeKeySystems=function emeKeySystems(keySystemOptions,mainPlaylist,audioPlaylist){if(!keySystemOptions){return keySystemOptions}var codecs={};if(mainPlaylist&&mainPlaylist.attributes&&mainPlaylist.attributes.CODECS){codecs=unwrapCodecList(parseCodecs(mainPlaylist.attributes.CODECS));}if(audioPlaylist&&audioPlaylist.attributes&&audioPlaylist.attributes.CODECS){codecs.audio=audioPlaylist.attributes.CODECS;}var videoContentType=getMimeForCodec(codecs.video);var audioContentType=getMimeForCodec(codecs.audio);var keySystemContentTypes={};for(var keySystem in keySystemOptions){keySystemContentTypes[keySystem]={};if(audioContentType){keySystemContentTypes[keySystem].audioContentType=audioContentType;}if(videoContentType){keySystemContentTypes[keySystem].videoContentType=videoContentType;}if(mainPlaylist.contentProtection&&mainPlaylist.contentProtection[keySystem]&&mainPlaylist.contentProtection[keySystem].pssh){keySystemContentTypes[keySystem].pssh=mainPlaylist.contentProtection[keySystem].pssh;}if(typeof keySystemOptions[keySystem]==="string"){keySystemContentTypes[keySystem].url=keySystemOptions[keySystem];}}return videojs.mergeOptions(keySystemOptions,keySystemContentTypes)};var getAllPsshKeySystemsOptions=function getAllPsshKeySystemsOptions(playlists,keySystems){return playlists.reduce(function(keySystemsArr,playlist){if(!playlist.contentProtection){return keySystemsArr}var keySystemsOptions=keySystems.reduce(function(keySystemsObj,keySystem){var keySystemOptions=playlist.contentProtection[keySystem];if(keySystemOptions&&keySystemOptions.pssh){keySystemsObj[keySystem]={pssh:keySystemOptions.pssh};}return keySystemsObj},{});if(Object.keys(keySystemsOptions).length){keySystemsArr.push(keySystemsOptions);}return keySystemsArr},[])};var waitForKeySessionCreation=function waitForKeySessionCreation(_ref){var player=_ref.player,sourceKeySystems=_ref.sourceKeySystems,audioMedia=_ref.audioMedia,mainPlaylists=_ref.mainPlaylists;if(!player.eme.initializeMediaKeys){return Promise.resolve()}var playlists=audioMedia?mainPlaylists.concat([audioMedia]):mainPlaylists;var keySystemsOptionsArr=getAllPsshKeySystemsOptions(playlists,Object.keys(sourceKeySystems));var initializationFinishedPromises=[];var keySessionCreatedPromises=[];keySystemsOptionsArr.forEach(function(keySystemsOptions){keySessionCreatedPromises.push(new Promise(function(resolve,reject){player.tech_.one("keysessioncreated",resolve);}));initializationFinishedPromises.push(new Promise(function(resolve,reject){player.eme.initializeMediaKeys({keySystems:keySystemsOptions},function(err){if(err){reject(err);return}resolve();});}));});return Promise.race([Promise.all(initializationFinishedPromises),Promise.race(keySessionCreatedPromises)])};var setupEmeOptions=function setupEmeOptions(_ref2){var player=_ref2.player,sourceKeySystems=_ref2.sourceKeySystems,media=_ref2.media,audioMedia=_ref2.audioMedia;var sourceOptions=emeKeySystems(sourceKeySystems,media,audioMedia);if(!sourceOptions){return false}player.currentSource().keySystems=sourceOptions;if(sourceOptions&&!player.eme){videojs.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin");return false}return true};var getVhsLocalStorage=function getVhsLocalStorage(){if(!window_1.localStorage){return null}var storedObject=window_1.localStorage.getItem(LOCAL_STORAGE_KEY);if(!storedObject){return null}try{return JSON.parse(storedObject)}catch(e){return null}};var updateVhsLocalStorage=function updateVhsLocalStorage(options){if(!window_1.localStorage){return false}var objectToStore=getVhsLocalStorage();objectToStore=objectToStore?videojs.mergeOptions(objectToStore,options):options;try{window_1.localStorage.setItem(LOCAL_STORAGE_KEY,JSON.stringify(objectToStore));}catch(e){return false}return objectToStore};var expandDataUri=function expandDataUri(dataUri){if(dataUri.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")===0){return JSON.parse(dataUri.substring(dataUri.indexOf(",")+1))}return dataUri};Vhs.supportsNativeHls=function(){if(!document_1||!document_1.createElement){return false}var video=document_1.createElement("video");if(!videojs.getTech("Html5").isSupported()){return false}var canPlay=["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"];return canPlay.some(function(canItPlay){return /maybe|probably/i.test(video.canPlayType(canItPlay))})}();Vhs.supportsNativeDash=function(){if(!document_1||!document_1.createElement||!videojs.getTech("Html5").isSupported()){return false}return /maybe|probably/i.test(document_1.createElement("video").canPlayType("application/dash+xml"))}();Vhs.supportsTypeNatively=function(type){if(type==="hls"){return Vhs.supportsNativeHls}if(type==="dash"){return Vhs.supportsNativeDash}return false};Vhs.isSupported=function(){return videojs.log.warn("HLS is no longer a tech. Please remove it from "+"your player's techOrder.")};var Component=videojs.getComponent("Component");var VhsHandler=function(_Component){_inheritsLoose(VhsHandler,_Component);function VhsHandler(source,tech,options){var _this;_this=_Component.call(this,tech,videojs.mergeOptions(options.hls,options.vhs))||this;if(options.hls&&Object.keys(options.hls).length){videojs.log.warn("Using hls options is deprecated. Please rename `hls` to `vhs` in your options object.");}if(typeof options.initialBandwidth==="number"){_this.options_.bandwidth=options.initialBandwidth;}_this.logger_=logger("VhsHandler");if(tech.options_&&tech.options_.playerId){var _player=videojs(tech.options_.playerId);if(!_player.hasOwnProperty("hls")){Object.defineProperty(_player,"hls",{get:function get(){videojs.log.warn("player.hls is deprecated. Use player.tech().vhs instead.");tech.trigger({type:"usage",name:"hls-player-access"});return _assertThisInitialized(_this)},configurable:true});}if(!_player.hasOwnProperty("vhs")){Object.defineProperty(_player,"vhs",{get:function get(){videojs.log.warn("player.vhs is deprecated. Use player.tech().vhs instead.");tech.trigger({type:"usage",name:"vhs-player-access"});return _assertThisInitialized(_this)},configurable:true});}if(!_player.hasOwnProperty("dash")){Object.defineProperty(_player,"dash",{get:function get(){videojs.log.warn("player.dash is deprecated. Use player.tech().vhs instead.");return _assertThisInitialized(_this)},configurable:true});}_this.player_=_player;}_this.tech_=tech;_this.source_=source;_this.stats={};_this.ignoreNextSeekingEvent_=false;_this.setOptions_();if(_this.options_.overrideNative&&tech.overrideNativeAudioTracks&&tech.overrideNativeVideoTracks){tech.overrideNativeAudioTracks(true);tech.overrideNativeVideoTracks(true);}else if(_this.options_.overrideNative&&(tech.featuresNativeVideoTracks||tech.featuresNativeAudioTracks)){throw new Error("Overriding native HLS requires emulated tracks. "+"See https://git.io/vMpjB")}_this.on(document_1,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],function(event){var fullscreenElement=document_1.fullscreenElement||document_1.webkitFullscreenElement||document_1.mozFullScreenElement||document_1.msFullscreenElement;if(fullscreenElement&&fullscreenElement.contains(_this.tech_.el())){_this.masterPlaylistController_.fastQualityChange_();}else {_this.masterPlaylistController_.checkABR_();}});_this.on(_this.tech_,"seeking",function(){if(this.ignoreNextSeekingEvent_){this.ignoreNextSeekingEvent_=false;return}this.setCurrentTime(this.tech_.currentTime());});_this.on(_this.tech_,"error",function(){if(this.tech_.error()&&this.masterPlaylistController_){this.masterPlaylistController_.pauseLoading();}});_this.on(_this.tech_,"play",_this.play);return _this}var _proto=VhsHandler.prototype;_proto.setOptions_=function setOptions_(){var _this2=this;this.options_.withCredentials=this.options_.withCredentials||false;this.options_.handleManifestRedirects=this.options_.handleManifestRedirects===false?false:true;this.options_.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions===false?false:true;this.options_.useDevicePixelRatio=this.options_.useDevicePixelRatio||false;this.options_.smoothQualityChange=this.options_.smoothQualityChange||false;this.options_.useBandwidthFromLocalStorage=typeof this.source_.useBandwidthFromLocalStorage!=="undefined"?this.source_.useBandwidthFromLocalStorage:this.options_.useBandwidthFromLocalStorage||false;this.options_.useNetworkInformationApi=this.options_.useNetworkInformationApi||false;this.options_.useDtsForTimestampOffset=this.options_.useDtsForTimestampOffset||false;this.options_.customTagParsers=this.options_.customTagParsers||[];this.options_.customTagMappers=this.options_.customTagMappers||[];this.options_.cacheEncryptionKeys=this.options_.cacheEncryptionKeys||false;if(typeof this.options_.blacklistDuration!=="number"){this.options_.blacklistDuration=5*60;}if(typeof this.options_.bandwidth!=="number"){if(this.options_.useBandwidthFromLocalStorage){var storedObject=getVhsLocalStorage();if(storedObject&&storedObject.bandwidth){this.options_.bandwidth=storedObject.bandwidth;this.tech_.trigger({type:"usage",name:"vhs-bandwidth-from-local-storage"});this.tech_.trigger({type:"usage",name:"hls-bandwidth-from-local-storage"});}if(storedObject&&storedObject.throughput){this.options_.throughput=storedObject.throughput;this.tech_.trigger({type:"usage",name:"vhs-throughput-from-local-storage"});this.tech_.trigger({type:"usage",name:"hls-throughput-from-local-storage"});}}}if(typeof this.options_.bandwidth!=="number"){this.options_.bandwidth=Config.INITIAL_BANDWIDTH;}this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===Config.INITIAL_BANDWIDTH;["withCredentials","useDevicePixelRatio","limitRenditionByPlayerDimensions","bandwidth","smoothQualityChange","customTagParsers","customTagMappers","handleManifestRedirects","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","experimentalBufferBasedABR","liveRangeSafeTimeDelta","experimentalLLHLS","useNetworkInformationApi","useDtsForTimestampOffset","experimentalExactManifestTimings","experimentalLeastPixelDiffSelector"].forEach(function(option){if(typeof _this2.source_[option]!=="undefined"){_this2.options_[option]=_this2.source_[option];}});this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions;this.useDevicePixelRatio=this.options_.useDevicePixelRatio;};_proto.src=function src(_src,type){var _this3=this;if(!_src){return}this.setOptions_();this.options_.src=expandDataUri(this.source_.src);this.options_.tech=this.tech_;this.options_.externVhs=Vhs;this.options_.sourceType=simpleTypeFromSourceType(type);this.options_.seekTo=function(time){_this3.tech_.setCurrentTime(time);};if(this.options_.smoothQualityChange){videojs.log.warn("smoothQualityChange is deprecated and will be removed in the next major version");}this.masterPlaylistController_=new MasterPlaylistController(this.options_);var playbackWatcherOptions=videojs.mergeOptions({liveRangeSafeTimeDelta:SAFE_TIME_DELTA},this.options_,{seekable:function seekable(){return _this3.seekable()},media:function media(){return _this3.masterPlaylistController_.media()},masterPlaylistController:this.masterPlaylistController_});this.playbackWatcher_=new PlaybackWatcher(playbackWatcherOptions);this.masterPlaylistController_.on("error",function(){var player=videojs.players[_this3.tech_.options_.playerId];var error=_this3.masterPlaylistController_.error;if(typeof error==="object"&&!error.code){error.code=3;}else if(typeof error==="string"){error={message:error,code:3};}player.error(error);});var defaultSelector=this.options_.experimentalBufferBasedABR?Vhs.movingAverageBandwidthSelector(.55):Vhs.STANDARD_PLAYLIST_SELECTOR;this.masterPlaylistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):defaultSelector.bind(this);this.masterPlaylistController_.selectInitialPlaylist=Vhs.INITIAL_PLAYLIST_SELECTOR.bind(this);this.playlists=this.masterPlaylistController_.masterPlaylistLoader_;this.mediaSource=this.masterPlaylistController_.mediaSource;Object.defineProperties(this,{selectPlaylist:{get:function get(){return this.masterPlaylistController_.selectPlaylist},set:function set(selectPlaylist){this.masterPlaylistController_.selectPlaylist=selectPlaylist.bind(this);}},throughput:{get:function get(){return this.masterPlaylistController_.mainSegmentLoader_.throughput.rate},set:function set(throughput){this.masterPlaylistController_.mainSegmentLoader_.throughput.rate=throughput;this.masterPlaylistController_.mainSegmentLoader_.throughput.count=1;}},bandwidth:{get:function get(){var playerBandwidthEst=this.masterPlaylistController_.mainSegmentLoader_.bandwidth;var networkInformation=window_1.navigator.connection||window_1.navigator.mozConnection||window_1.navigator.webkitConnection;var tenMbpsAsBitsPerSecond=1e7;if(this.options_.useNetworkInformationApi&&networkInformation){var networkInfoBandwidthEstBitsPerSec=networkInformation.downlink*1e3*1e3;if(networkInfoBandwidthEstBitsPerSec>=tenMbpsAsBitsPerSecond&&playerBandwidthEst>=tenMbpsAsBitsPerSecond){playerBandwidthEst=Math.max(playerBandwidthEst,networkInfoBandwidthEstBitsPerSec);}else {playerBandwidthEst=networkInfoBandwidthEstBitsPerSec;}}return playerBandwidthEst},set:function set(bandwidth){this.masterPlaylistController_.mainSegmentLoader_.bandwidth=bandwidth;this.masterPlaylistController_.mainSegmentLoader_.throughput={rate:0,count:0};}},systemBandwidth:{get:function get(){var invBandwidth=1/(this.bandwidth||1);var invThroughput;if(this.throughput>0){invThroughput=1/this.throughput;}else {invThroughput=0;}var systemBitrate=Math.floor(1/(invBandwidth+invThroughput));return systemBitrate},set:function set(){videojs.log.error('The "systemBandwidth" property is read-only');}}});if(this.options_.bandwidth){this.bandwidth=this.options_.bandwidth;}if(this.options_.throughput){this.throughput=this.options_.throughput;}Object.defineProperties(this.stats,{bandwidth:{get:function get(){return _this3.bandwidth||0},enumerable:true},mediaRequests:{get:function get(){return _this3.masterPlaylistController_.mediaRequests_()||0},enumerable:true},mediaRequestsAborted:{get:function get(){return _this3.masterPlaylistController_.mediaRequestsAborted_()||0},enumerable:true},mediaRequestsTimedout:{get:function get(){return _this3.masterPlaylistController_.mediaRequestsTimedout_()||0},enumerable:true},mediaRequestsErrored:{get:function get(){return _this3.masterPlaylistController_.mediaRequestsErrored_()||0},enumerable:true},mediaTransferDuration:{get:function get(){return _this3.masterPlaylistController_.mediaTransferDuration_()||0},enumerable:true},mediaBytesTransferred:{get:function get(){return _this3.masterPlaylistController_.mediaBytesTransferred_()||0},enumerable:true},mediaSecondsLoaded:{get:function get(){return _this3.masterPlaylistController_.mediaSecondsLoaded_()||0},enumerable:true},mediaAppends:{get:function get(){return _this3.masterPlaylistController_.mediaAppends_()||0},enumerable:true},mainAppendsToLoadedData:{get:function get(){return _this3.masterPlaylistController_.mainAppendsToLoadedData_()||0},enumerable:true},audioAppendsToLoadedData:{get:function get(){return _this3.masterPlaylistController_.audioAppendsToLoadedData_()||0},enumerable:true},appendsToLoadedData:{get:function get(){return _this3.masterPlaylistController_.appendsToLoadedData_()||0},enumerable:true},timeToLoadedData:{get:function get(){return _this3.masterPlaylistController_.timeToLoadedData_()||0},enumerable:true},buffered:{get:function get(){return timeRangesToArray(_this3.tech_.buffered())},enumerable:true},currentTime:{get:function get(){return _this3.tech_.currentTime()},enumerable:true},currentSource:{get:function get(){return _this3.tech_.currentSource_},enumerable:true},currentTech:{get:function get(){return _this3.tech_.name_},enumerable:true},duration:{get:function get(){return _this3.tech_.duration()},enumerable:true},master:{get:function get(){return _this3.playlists.master},enumerable:true},playerDimensions:{get:function get(){return _this3.tech_.currentDimensions()},enumerable:true},seekable:{get:function get(){return timeRangesToArray(_this3.tech_.seekable())},enumerable:true},timestamp:{get:function get(){return Date.now()},enumerable:true},videoPlaybackQuality:{get:function get(){return _this3.tech_.getVideoPlaybackQuality()},enumerable:true}});this.tech_.one("canplay",this.masterPlaylistController_.setupFirstPlay.bind(this.masterPlaylistController_));this.tech_.on("bandwidthupdate",function(){if(_this3.options_.useBandwidthFromLocalStorage){updateVhsLocalStorage({bandwidth:_this3.bandwidth,throughput:Math.round(_this3.throughput)});}});this.masterPlaylistController_.on("selectedinitialmedia",function(){renditionSelectionMixin(_this3);});this.masterPlaylistController_.sourceUpdater_.on("createdsourcebuffers",function(){_this3.setupEme_();});this.on(this.masterPlaylistController_,"progress",function(){this.tech_.trigger("progress");});this.on(this.masterPlaylistController_,"firstplay",function(){this.ignoreNextSeekingEvent_=true;});this.setupQualityLevels_();if(!this.tech_.el()){return}this.mediaSourceUrl_=window_1.URL.createObjectURL(this.masterPlaylistController_.mediaSource);this.tech_.src(this.mediaSourceUrl_);};_proto.createKeySessions_=function createKeySessions_(){var _this4=this;var audioPlaylistLoader=this.masterPlaylistController_.mediaTypes_.AUDIO.activePlaylistLoader;this.logger_("waiting for EME key session creation");waitForKeySessionCreation({player:this.player_,sourceKeySystems:this.source_.keySystems,audioMedia:audioPlaylistLoader&&audioPlaylistLoader.media(),mainPlaylists:this.playlists.master.playlists}).then(function(){_this4.logger_("created EME key session");_this4.masterPlaylistController_.sourceUpdater_.initializedEme();})["catch"](function(err){_this4.logger_("error while creating EME key session",err);_this4.player_.error({message:"Failed to initialize media keys for EME",code:3});});};_proto.handleWaitingForKey_=function handleWaitingForKey_(){this.logger_("waitingforkey fired, attempting to create any new key sessions");this.createKeySessions_();};_proto.setupEme_=function setupEme_(){var _this5=this;var audioPlaylistLoader=this.masterPlaylistController_.mediaTypes_.AUDIO.activePlaylistLoader;var didSetupEmeOptions=setupEmeOptions({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:audioPlaylistLoader&&audioPlaylistLoader.media()});this.player_.tech_.on("keystatuschange",function(e){if(e.status!=="output-restricted"){return}var masterPlaylist=_this5.masterPlaylistController_.master();if(!masterPlaylist||!masterPlaylist.playlists){return}var excludedHDPlaylists=[];masterPlaylist.playlists.forEach(function(playlist){if(playlist&&playlist.attributes&&playlist.attributes.RESOLUTION&&playlist.attributes.RESOLUTION.height>=720){if(!playlist.excludeUntil||playlist.excludeUntil<Infinity){playlist.excludeUntil=Infinity;excludedHDPlaylists.push(playlist);}}});if(excludedHDPlaylists.length){var _videojs$log;(_videojs$log=videojs.log).warn.apply(_videojs$log,['DRM keystatus changed to "output-restricted." Removing the following HD playlists '+"that will most likely fail to play and clearing the buffer. "+"This may be due to HDCP restrictions on the stream and the capabilities of the current device."].concat(excludedHDPlaylists));_this5.masterPlaylistController_.fastQualityChange_();}});this.handleWaitingForKey_=this.handleWaitingForKey_.bind(this);this.player_.tech_.on("waitingforkey",this.handleWaitingForKey_);if(videojs.browser.IE_VERSION===11||!didSetupEmeOptions){this.masterPlaylistController_.sourceUpdater_.initializedEme();return}this.createKeySessions_();};_proto.setupQualityLevels_=function setupQualityLevels_(){var _this6=this;var player=videojs.players[this.tech_.options_.playerId];if(!player||!player.qualityLevels||this.qualityLevels_){return}this.qualityLevels_=player.qualityLevels();this.masterPlaylistController_.on("selectedinitialmedia",function(){handleVhsLoadedMetadata(_this6.qualityLevels_,_this6);});this.playlists.on("mediachange",function(){handleVhsMediaChange(_this6.qualityLevels_,_this6.playlists);});};VhsHandler.version=function version$5(){return {"@videojs/http-streaming":version$4,"mux.js":version$3,"mpd-parser":version$2,"m3u8-parser":version$1,"aes-decrypter":version}};_proto.version=function version(){return this.constructor.version()};_proto.canChangeType=function canChangeType(){return SourceUpdater.canChangeType()};_proto.play=function play(){this.masterPlaylistController_.play();};_proto.setCurrentTime=function setCurrentTime(currentTime){this.masterPlaylistController_.setCurrentTime(currentTime);};_proto.duration=function duration(){return this.masterPlaylistController_.duration()};_proto.seekable=function seekable(){return this.masterPlaylistController_.seekable()};_proto.dispose=function dispose(){if(this.playbackWatcher_){this.playbackWatcher_.dispose();}if(this.masterPlaylistController_){this.masterPlaylistController_.dispose();}if(this.qualityLevels_){this.qualityLevels_.dispose();}if(this.player_){delete this.player_.vhs;delete this.player_.dash;delete this.player_.hls;}if(this.tech_&&this.tech_.vhs){delete this.tech_.vhs;}if(this.tech_){delete this.tech_.hls;}if(this.mediaSourceUrl_&&window_1.URL.revokeObjectURL){window_1.URL.revokeObjectURL(this.mediaSourceUrl_);this.mediaSourceUrl_=null;}if(this.tech_){this.tech_.off("waitingforkey",this.handleWaitingForKey_);}_Component.prototype.dispose.call(this);};_proto.convertToProgramTime=function convertToProgramTime(time,callback){return getProgramTime({playlist:this.masterPlaylistController_.media(),time:time,callback:callback})};_proto.seekToProgramTime=function seekToProgramTime$1(programTime,callback,pauseAfterSeek,retryCount){if(pauseAfterSeek===void 0){pauseAfterSeek=true;}if(retryCount===void 0){retryCount=2;}return seekToProgramTime({programTime:programTime,playlist:this.masterPlaylistController_.media(),retryCount:retryCount,pauseAfterSeek:pauseAfterSeek,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:callback})};return VhsHandler}(Component);var VhsSourceHandler={name:"videojs-http-streaming",VERSION:version$4,canHandleSource:function canHandleSource(srcObj,options){if(options===void 0){options={};}var localOptions=videojs.mergeOptions(videojs.options,options);return VhsSourceHandler.canPlayType(srcObj.type,localOptions)},handleSource:function handleSource(source,tech,options){if(options===void 0){options={};}var localOptions=videojs.mergeOptions(videojs.options,options);tech.vhs=new VhsHandler(source,tech,localOptions);if(!videojs.hasOwnProperty("hls")){Object.defineProperty(tech,"hls",{get:function get(){videojs.log.warn("player.tech().hls is deprecated. Use player.tech().vhs instead.");return tech.vhs},configurable:true});}tech.vhs.xhr=xhrFactory();tech.vhs.src(source.src,source.type);return tech.vhs},canPlayType:function canPlayType(type,options){var simpleType=simpleTypeFromSourceType(type);if(!simpleType){return ""}var overrideNative=VhsSourceHandler.getOverrideNative(options);var supportsTypeNatively=Vhs.supportsTypeNatively(simpleType);var canUseMsePlayback=!supportsTypeNatively||overrideNative;return canUseMsePlayback?"maybe":""},getOverrideNative:function getOverrideNative(options){if(options===void 0){options={};}var _options=options,_options$vhs=_options.vhs,vhs=_options$vhs===void 0?{}:_options$vhs,_options$hls=_options.hls,hls=_options$hls===void 0?{}:_options$hls;var defaultOverrideNative=!(videojs.browser.IS_ANY_SAFARI||videojs.browser.IS_IOS);var _vhs$overrideNative=vhs.overrideNative,overrideNative=_vhs$overrideNative===void 0?defaultOverrideNative:_vhs$overrideNative;var _hls$overrideNative=hls.overrideNative,legacyOverrideNative=_hls$overrideNative===void 0?false:_hls$overrideNative;return legacyOverrideNative||overrideNative}};var supportsNativeMediaSources=function supportsNativeMediaSources(){return browserSupportsCodec("avc1.4d400d,mp4a.40.2")};if(supportsNativeMediaSources()){videojs.getTech("Html5").registerSourceHandler(VhsSourceHandler,0);}videojs.VhsHandler=VhsHandler;Object.defineProperty(videojs,"HlsHandler",{get:function get(){videojs.log.warn("videojs.HlsHandler is deprecated. Use videojs.VhsHandler instead.");return VhsHandler},configurable:true});videojs.VhsSourceHandler=VhsSourceHandler;Object.defineProperty(videojs,"HlsSourceHandler",{get:function get(){videojs.log.warn("videojs.HlsSourceHandler is deprecated. "+"Use videojs.VhsSourceHandler instead.");return VhsSourceHandler},configurable:true});videojs.Vhs=Vhs;Object.defineProperty(videojs,"Hls",{get:function get(){videojs.log.warn("videojs.Hls is deprecated. Use videojs.Vhs instead.");return Vhs},configurable:true});if(!videojs.use){videojs.registerComponent("Hls",Vhs);videojs.registerComponent("Vhs",Vhs);}videojs.options.vhs=videojs.options.vhs||{};videojs.options.hls=videojs.options.hls||{};if(!videojs.getPlugin||!videojs.getPlugin("reloadSourceOnError")){var registerPlugin=videojs.registerPlugin||videojs.plugin;registerPlugin("reloadSourceOnError",reloadSourceOnError);}
|
|
178
|
+
|
|
179
|
+
var video_es = /*#__PURE__*/Object.freeze({
|
|
180
|
+
__proto__: null,
|
|
181
|
+
default: videojs
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
var require$$0 = /*@__PURE__*/getAugmentedNamespace(video_es);
|
|
185
|
+
|
|
186
|
+
(function(module,exports){(function(root,factory){{var videojs=require$$0;module.exports=factory(videojs.default||videojs);}})(commonjsGlobal,function(videojs){var _isOnMobile=videojs.browser.IS_IOS||videojs.browser.IS_NATIVE_ANDROID;var Tech=videojs.getTech("Tech");class Youtube extends Tech{constructor(options,ready){super(options,ready);this.setPoster(options.poster);this.setSrc(this.options_.source,true);this.setTimeout((function(){if(this.el_){this.el_.parentNode.className+=" vjs-youtube";if(_isOnMobile){this.el_.parentNode.className+=" vjs-youtube-mobile";}if(Youtube.isApiReady){this.initYTPlayer();}else {Youtube.apiReadyQueue.push(this);}}}).bind(this));}dispose(){if(this.ytPlayer){if(this.ytPlayer.stopVideo){this.ytPlayer.stopVideo();}if(this.ytPlayer.destroy){this.ytPlayer.destroy();}}else {var index=Youtube.apiReadyQueue.indexOf(this);if(index!==-1){Youtube.apiReadyQueue.splice(index,1);}}this.ytPlayer=null;this.el_.parentNode.className=this.el_.parentNode.className.replace(" vjs-youtube","").replace(" vjs-youtube-mobile","");this.el_.parentNode.removeChild(this.el_);Tech.prototype.dispose.call(this);}createEl(){var div=document.createElement("div");div.setAttribute("id",this.options_.techId);div.setAttribute("style","width:100%;height:100%;top:0;left:0;position:absolute");div.setAttribute("class","vjs-tech");var divWrapper=document.createElement("div");divWrapper.appendChild(div);if(!_isOnMobile&&!this.options_.ytControls){var divBlocker=document.createElement("div");divBlocker.setAttribute("class","vjs-iframe-blocker");divBlocker.setAttribute("style","position:absolute;top:0;left:0;width:100%;height:100%");divBlocker.onclick=(function(){this.pause();}).bind(this);divWrapper.appendChild(divBlocker);}return divWrapper}initYTPlayer(){var playerVars={controls:0,modestbranding:1,rel:0,showinfo:0,loop:this.options_.loop?1:0};if(typeof this.options_.autohide!=="undefined"){playerVars.autohide=this.options_.autohide;}if(typeof this.options_["cc_load_policy"]!=="undefined"){playerVars["cc_load_policy"]=this.options_["cc_load_policy"];}if(typeof this.options_.ytControls!=="undefined"){playerVars.controls=this.options_.ytControls;}if(typeof this.options_.disablekb!=="undefined"){playerVars.disablekb=this.options_.disablekb;}if(typeof this.options_.color!=="undefined"){playerVars.color=this.options_.color;}if(!playerVars.controls){playerVars.fs=0;}else if(typeof this.options_.fs!=="undefined"){playerVars.fs=this.options_.fs;}if(this.options_.source.src.indexOf("end=")!==-1){var srcEndTime=this.options_.source.src.match(/end=([0-9]*)/);this.options_.end=parseInt(srcEndTime[1]);}if(typeof this.options_.end!=="undefined"){playerVars.end=this.options_.end;}if(typeof this.options_.hl!=="undefined"){playerVars.hl=this.options_.hl;}else if(typeof this.options_.language!=="undefined"){playerVars.hl=this.options_.language.substr(0,2);}if(typeof this.options_["iv_load_policy"]!=="undefined"){playerVars["iv_load_policy"]=this.options_["iv_load_policy"];}if(typeof this.options_.list!=="undefined"){playerVars.list=this.options_.list;}else if(this.url&&typeof this.url.listId!=="undefined"){playerVars.list=this.url.listId;}if(typeof this.options_.listType!=="undefined"){playerVars.listType=this.options_.listType;}if(typeof this.options_.modestbranding!=="undefined"){playerVars.modestbranding=this.options_.modestbranding;}if(typeof this.options_.playlist!=="undefined"){playerVars.playlist=this.options_.playlist;}if(typeof this.options_.playsinline!=="undefined"){playerVars.playsinline=this.options_.playsinline;}if(typeof this.options_.rel!=="undefined"){playerVars.rel=this.options_.rel;}if(typeof this.options_.showinfo!=="undefined"){playerVars.showinfo=this.options_.showinfo;}if(this.options_.source.src.indexOf("start=")!==-1){var srcStartTime=this.options_.source.src.match(/start=([0-9]*)/);this.options_.start=parseInt(srcStartTime[1]);}if(typeof this.options_.start!=="undefined"){playerVars.start=this.options_.start;}if(typeof this.options_.theme!=="undefined"){playerVars.theme=this.options_.theme;}if(typeof this.options_.customVars!=="undefined"){var customVars=this.options_.customVars;Object.keys(customVars).forEach(function(key){playerVars[key]=customVars[key];});}this.activeVideoId=this.url?this.url.videoId:null;this.activeList=playerVars.list;var playerConfig={videoId:this.activeVideoId,playerVars:playerVars,events:{onReady:this.onPlayerReady.bind(this),onPlaybackQualityChange:this.onPlayerPlaybackQualityChange.bind(this),onPlaybackRateChange:this.onPlayerPlaybackRateChange.bind(this),onStateChange:this.onPlayerStateChange.bind(this),onVolumeChange:this.onPlayerVolumeChange.bind(this),onError:this.onPlayerError.bind(this)}};if(typeof this.options_.enablePrivacyEnhancedMode!=="undefined"&&this.options_.enablePrivacyEnhancedMode){playerConfig.host="https://www.youtube-nocookie.com";}this.ytPlayer=new YT.Player(this.options_.techId,playerConfig);}onPlayerReady(){if(this.options_.muted){this.ytPlayer.mute();}var playbackRates=this.ytPlayer.getAvailablePlaybackRates();if(playbackRates.length>1){this.featuresPlaybackRate=true;}this.playerReady_=true;this.triggerReady();if(this.playOnReady){this.play();}else if(this.cueOnReady){this.cueVideoById_(this.url.videoId);this.activeVideoId=this.url.videoId;}}onPlayerPlaybackQualityChange(){}onPlayerPlaybackRateChange(){this.trigger("ratechange");}onPlayerStateChange(e){var state=e.data;if(state===this.lastState||this.errorNumber){return}this.lastState=state;switch(state){case-1:this.trigger("loadstart");this.trigger("loadedmetadata");this.trigger("durationchange");this.trigger("ratechange");break;case YT.PlayerState.ENDED:this.trigger("ended");break;case YT.PlayerState.PLAYING:this.trigger("timeupdate");this.trigger("durationchange");this.trigger("playing");this.trigger("play");if(this.isSeeking){this.onSeeked();}break;case YT.PlayerState.PAUSED:this.trigger("canplay");if(this.isSeeking){this.onSeeked();}else {this.trigger("pause");}break;case YT.PlayerState.BUFFERING:this.player_.trigger("timeupdate");this.player_.trigger("waiting");break}}onPlayerVolumeChange(){this.trigger("volumechange");}onPlayerError(e){this.errorNumber=e.data;this.trigger("pause");this.trigger("error");}error(){var code=1e3+this.errorNumber;switch(this.errorNumber){case 5:return {code:code,message:"Error while trying to play the video"};case 2:case 100:return {code:code,message:"Unable to find the video"};case 101:case 150:return {code:code,message:"Playback on other Websites has been disabled by the video owner."}}return {code:code,message:"YouTube unknown error ("+this.errorNumber+")"}}loadVideoById_(id){var options={videoId:id};if(this.options_.start){options.startSeconds=this.options_.start;}if(this.options_.end){options.endSeconds=this.options_.end;}this.ytPlayer.loadVideoById(options);}cueVideoById_(id){var options={videoId:id};if(this.options_.start){options.startSeconds=this.options_.start;}if(this.options_.end){options.endSeconds=this.options_.end;}this.ytPlayer.cueVideoById(options);}src(src){if(src){this.setSrc({src:src});}return this.source}poster(){if(_isOnMobile){return null}return this.poster_}setPoster(poster){this.poster_=poster;}setSrc(source){if(!source||!source.src){return}delete this.errorNumber;this.source=source;this.url=Youtube.parseUrl(source.src);if(!this.options_.poster){if(this.url.videoId){this.poster_="https://img.youtube.com/vi/"+this.url.videoId+"/0.jpg";this.trigger("posterchange");this.checkHighResPoster();}}if(this.options_.autoplay&&!_isOnMobile){if(this.isReady_){this.play();}else {this.playOnReady=true;}}else if(this.activeVideoId!==this.url.videoId){if(this.isReady_){this.cueVideoById_(this.url.videoId);this.activeVideoId=this.url.videoId;}else {this.cueOnReady=true;}}}autoplay(){return this.options_.autoplay}setAutoplay(val){this.options_.autoplay=val;}loop(){return this.options_.loop}setLoop(val){this.options_.loop=val;}play(){if(!this.url||!this.url.videoId){return}this.wasPausedBeforeSeek=false;if(this.isReady_){if(this.url.listId){if(this.activeList===this.url.listId){this.ytPlayer.playVideo();}else {this.ytPlayer.loadPlaylist(this.url.listId);this.activeList=this.url.listId;}}if(this.activeVideoId===this.url.videoId){this.ytPlayer.playVideo();}else {this.loadVideoById_(this.url.videoId);this.activeVideoId=this.url.videoId;}}else {this.trigger("waiting");this.playOnReady=true;}}pause(){if(this.ytPlayer){this.ytPlayer.pauseVideo();}}paused(){return this.ytPlayer?this.lastState!==YT.PlayerState.PLAYING&&this.lastState!==YT.PlayerState.BUFFERING:true}currentTime(){return this.ytPlayer?this.ytPlayer.getCurrentTime():0}setCurrentTime(seconds){if(this.lastState===YT.PlayerState.PAUSED){this.timeBeforeSeek=this.currentTime();}if(!this.isSeeking){this.wasPausedBeforeSeek=this.paused();}this.ytPlayer.seekTo(seconds,true);this.trigger("timeupdate");this.trigger("seeking");this.isSeeking=true;if(this.lastState===YT.PlayerState.PAUSED&&this.timeBeforeSeek!==seconds){clearInterval(this.checkSeekedInPauseInterval);this.checkSeekedInPauseInterval=setInterval((function(){if(this.lastState!==YT.PlayerState.PAUSED||!this.isSeeking){clearInterval(this.checkSeekedInPauseInterval);}else if(this.currentTime()!==this.timeBeforeSeek){this.trigger("timeupdate");this.onSeeked();}}).bind(this),250);}}seeking(){return this.isSeeking}seekable(){if(!this.ytPlayer){return videojs.createTimeRange()}return videojs.createTimeRange(0,this.ytPlayer.getDuration())}onSeeked(){clearInterval(this.checkSeekedInPauseInterval);this.isSeeking=false;if(this.wasPausedBeforeSeek){this.pause();}this.trigger("seeked");}playbackRate(){return this.ytPlayer?this.ytPlayer.getPlaybackRate():1}setPlaybackRate(suggestedRate){if(!this.ytPlayer){return}this.ytPlayer.setPlaybackRate(suggestedRate);}duration(){return this.ytPlayer?this.ytPlayer.getDuration():0}currentSrc(){return this.source&&this.source.src}ended(){return this.ytPlayer?this.lastState===YT.PlayerState.ENDED:false}volume(){return this.ytPlayer?this.ytPlayer.getVolume()/100:1}setVolume(percentAsDecimal){if(!this.ytPlayer){return}this.ytPlayer.setVolume(percentAsDecimal*100);}muted(){return this.ytPlayer?this.ytPlayer.isMuted():false}setMuted(mute){if(!this.ytPlayer){return}else {this.muted(true);}if(mute){this.ytPlayer.mute();}else {this.ytPlayer.unMute();}this.setTimeout(function(){this.trigger("volumechange");},50);}buffered(){if(!this.ytPlayer||!this.ytPlayer.getVideoLoadedFraction){return videojs.createTimeRange()}var bufferedEnd=this.ytPlayer.getVideoLoadedFraction()*this.ytPlayer.getDuration();return videojs.createTimeRange(0,bufferedEnd)}preload(){}load(){}reset(){}networkState(){if(!this.ytPlayer){return 0}switch(this.ytPlayer.getPlayerState()){case-1:return 0;case 3:return 2;default:return 1}}readyState(){if(!this.ytPlayer){return 0}switch(this.ytPlayer.getPlayerState()){case-1:return 0;case 5:return 1;case 3:return 2;default:return 4}}supportsFullScreen(){return document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled}checkHighResPoster(){var uri="https://img.youtube.com/vi/"+this.url.videoId+"/maxresdefault.jpg";try{var image=new Image;image.onload=(function(){if("naturalHeight"in image){if(image.naturalHeight<=90||image.naturalWidth<=120){return}}else if(image.height<=90||image.width<=120){return}this.poster_=uri;this.trigger("posterchange");}).bind(this);image.onerror=function(){};image.src=uri;}catch(e){}}}Youtube.isSupported=function(){return true};Youtube.canPlaySource=function(e){return Youtube.canPlayType(e.type)};Youtube.canPlayType=function(e){return e==="video/youtube"};Youtube.parseUrl=function(url){var result={videoId:null};var regex=/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/;var match=url.match(regex);if(match&&match[2].length===11){result.videoId=match[2];}var regPlaylist=/[?&]list=([^#\&\?]+)/;match=url.match(regPlaylist);if(match&&match[1]){result.listId=match[1];}return result};function apiLoaded(){YT.ready(function(){Youtube.isApiReady=true;for(var i=0;i<Youtube.apiReadyQueue.length;++i){Youtube.apiReadyQueue[i].initYTPlayer();}});}function loadScript(src,callback){var loaded=false;var tag=document.createElement("script");var firstScriptTag=document.getElementsByTagName("script")[0];if(!firstScriptTag){return}firstScriptTag.parentNode.insertBefore(tag,firstScriptTag);tag.onload=function(){if(!loaded){loaded=true;callback();}};tag.onreadystatechange=function(){if(!loaded&&(this.readyState==="complete"||this.readyState==="loaded")){loaded=true;callback();}};tag.src=src;}function injectCss(){var css=".vjs-youtube .vjs-iframe-blocker { display: none; }"+".vjs-youtube.vjs-user-inactive .vjs-iframe-blocker { display: block; }"+".vjs-youtube .vjs-poster { background-size: cover; }"+".vjs-youtube-mobile .vjs-big-play-button { display: none; }";var head=document.head||document.getElementsByTagName("head")[0];var style=document.createElement("style");style.type="text/css";if(style.styleSheet){style.styleSheet.cssText=css;}else {style.appendChild(document.createTextNode(css));}head.appendChild(style);}Youtube.apiReadyQueue=[];if(typeof document!=="undefined"){loadScript("https://www.youtube.com/iframe_api",apiLoaded);injectCss();}if(typeof videojs.registerTech!=="undefined"){videojs.registerTech("Youtube",Youtube);}else {videojs.registerComponent("Youtube",Youtube);}});})(Youtube);
|
|
187
|
+
|
|
188
|
+
class Video{constructor(element){this.element=element;this.prefix=this.element.dataset.prefix;this.controlsprefix=`${this.prefix}--video--controls`;this.init();}init(){this.cacheDomReferences().start().setupHandlers().enable();return this}cacheDomReferences(){this.VideoElement=this.element.querySelector(`.${this.prefix}--video--element`);return this}setupHandlers(){return this}enable(){return this}start(){this.player=videojs(this.VideoElement,{autoplay:false,controls:true,preload:"auto",bigPlayButton:false,controlBar:{descriptionsButton:false,playbackRateMenuButton:false,chaptersButton:false,audioTrackButton:false,pictureInPictureToggle:false,subsCapsButton:false,seekToLive:false,liveDisplay:false},textTrackDisplay:false,liveTracker:false,errorDisplay:false,textTrackSettings:false,resizeManager:false,sources:[{type:this.element.dataset.vjsType,src:this.element.dataset.src}],dataSetup:{techOrder:["youtube"]}});return this}}
|
|
189
|
+
|
|
190
|
+
Drupal.behaviors.media={attach(){Array.prototype.forEach.call(document.querySelectorAll(`[data-loadcomponent="Video"]`),element=>{if(!element.dataset.jsProcessed){new Video(element);element.dataset.jsProcessed=true;}});}};
|
|
191
|
+
|
|
192
|
+
})();
|