From eacf500d18641e8d935bba90919ca43dce570dc1 Mon Sep 17 00:00:00 2001 From: Jacek Pyziak Date: Fri, 23 May 2025 19:27:41 +0200 Subject: [PATCH] feat: Add YouTube video support and update admin templates - Introduced a new YouTube tech integration in `youtube.min.js` for enhanced video playback. - Created new admin template files for managing video settings, including `index.php` and `steasyvideo-pro.tpl`. - Updated hook templates (`device_mode.tpl`, `forquickview.tpl`, `header.tpl`, `miniature.tpl`, `miniature_tb.tpl`, and predefined templates) to include video functionality. - Implemented caching headers in several PHP files to improve performance. - Ensured all new templates include proper licensing information and copyright notices. --- modules/steasyvideo/.htaccess | 12 + modules/steasyvideo/classes/EasyVideoBase.php | 357 +++ .../steasyvideo/classes/StEasyVideoClass.php | 167 ++ .../classes/StEasyVideoYuyanClass.php | 62 + modules/steasyvideo/classes/index.php | 34 + modules/steasyvideo/composer.json | 34 + modules/steasyvideo/composer.lock | 23 + modules/steasyvideo/config.xml | 11 + modules/steasyvideo/config/common.yml | 8 + modules/steasyvideo/config/front/index.php | 34 + modules/steasyvideo/config/front/services.yml | 2 + modules/steasyvideo/config/index.php | 34 + .../AdminStEasyVideoCategoryController.php | 90 + .../admin/AdminStEasyVideoController.php | 17 + .../AdminStEasyVideoGalleryController.php | 421 +++ .../admin/AdminStEasyVideoListController.php | 576 ++++ ...AdminStEasyVideoManufacturerController.php | 49 + ...dminStEasyVideoMiniatureBaseController.php | 317 +++ .../AdminStEasyVideoMiniatureController.php | 37 + ...inStEasyVideoMiniatureMobileController.php | 23 + .../AdminStEasyVideoProductController.php | 168 ++ ...asyVideoProductMobileSettingController.php | 24 + ...minStEasyVideoProductSettingController.php | 24 + ...nStEasyVideoQuickViewSettingController.php | 23 + .../AdminStEasyVideoSettingController.php | 188 ++ .../steasyvideo/controllers/admin/index.php | 34 + .../steasyvideo/controllers/front/ajax.php | 22 + .../steasyvideo/controllers/front/index.php | 34 + modules/steasyvideo/controllers/index.php | 34 + modules/steasyvideo/index.php | 35 + modules/steasyvideo/logo.png | Bin 0 -> 5681 bytes .../src/Repository/VideoRepository.php | 39 + modules/steasyvideo/src/Repository/index.php | 34 + modules/steasyvideo/src/index.php | 34 + modules/steasyvideo/steasyvideo.php | 1021 +++++++ modules/steasyvideo/translations/index.php | 35 + modules/steasyvideo/upgrade/index.php | 35 + modules/steasyvideo/upgrade/install-1.0.5.php | 42 + modules/steasyvideo/upgrade/install-1.2.0.php | 83 + modules/steasyvideo/upgrade/install-1.2.3.php | 44 + modules/steasyvideo/vendor/.htaccess | 10 + modules/steasyvideo/vendor/autoload.php | 7 + .../vendor/composer/ClassLoader.php | 572 ++++ .../vendor/composer/InstalledVersions.php | 350 +++ modules/steasyvideo/vendor/composer/LICENSE | 21 + .../vendor/composer/autoload_classmap.php | 12 + .../vendor/composer/autoload_namespaces.php | 9 + .../vendor/composer/autoload_psr4.php | 10 + .../vendor/composer/autoload_real.php | 48 + .../vendor/composer/autoload_static.php | 38 + .../vendor/composer/installed.json | 5 + .../steasyvideo/vendor/composer/installed.php | 23 + .../vendor/composer/platform_check.php | 26 + modules/steasyvideo/views/css/admin.css | 22 + modules/steasyvideo/views/css/front.css | 150 + modules/steasyvideo/views/css/index.php | 34 + modules/steasyvideo/views/css/skin-0.css | 72 + modules/steasyvideo/views/css/skin-1.css | 78 + modules/steasyvideo/views/css/skin-2.css | 77 + modules/steasyvideo/views/css/skin-3.css | 71 + modules/steasyvideo/views/css/video-js.css | 2011 ++++++++++++++ .../steasyvideo/views/css/video-js.min.css | 1 + modules/steasyvideo/views/index.php | 35 + modules/steasyvideo/views/js/admin.js | 215 ++ modules/steasyvideo/views/js/front.js | 1052 +++++++ modules/steasyvideo/views/js/index.php | 35 + modules/steasyvideo/views/js/video.min.js | 53 + .../steasyvideo/views/js/videojs-vimeo.umd.js | 2417 +++++++++++++++++ modules/steasyvideo/views/js/youtube.min.js | 12 + .../views/templates/admin/index.php | 35 + .../views/templates/admin/steasyvideo-pro.tpl | 27 + .../views/templates/hook/device_mode.tpl | 26 + .../views/templates/hook/forquickview.tpl | 34 + .../views/templates/hook/header.tpl | 30 + .../views/templates/hook/index.php | 35 + .../views/templates/hook/miniature.tpl | 41 + .../views/templates/hook/miniature_tb.tpl | 37 + .../views/templates/hook/predefined/1.tpl | 26 + .../views/templates/hook/predefined/2.tpl | 26 + .../views/templates/hook/predefined/3.tpl | 26 + .../views/templates/hook/predefined/index.php | 35 + modules/steasyvideo/views/templates/index.php | 35 + .../front/details/detail3382420090.tpl | 6 +- 83 files changed, 12143 insertions(+), 3 deletions(-) create mode 100644 modules/steasyvideo/.htaccess create mode 100644 modules/steasyvideo/classes/EasyVideoBase.php create mode 100644 modules/steasyvideo/classes/StEasyVideoClass.php create mode 100644 modules/steasyvideo/classes/StEasyVideoYuyanClass.php create mode 100644 modules/steasyvideo/classes/index.php create mode 100644 modules/steasyvideo/composer.json create mode 100644 modules/steasyvideo/composer.lock create mode 100644 modules/steasyvideo/config.xml create mode 100644 modules/steasyvideo/config/common.yml create mode 100644 modules/steasyvideo/config/front/index.php create mode 100644 modules/steasyvideo/config/front/services.yml create mode 100644 modules/steasyvideo/config/index.php create mode 100644 modules/steasyvideo/controllers/admin/AdminStEasyVideoCategoryController.php create mode 100644 modules/steasyvideo/controllers/admin/AdminStEasyVideoController.php create mode 100644 modules/steasyvideo/controllers/admin/AdminStEasyVideoGalleryController.php create mode 100644 modules/steasyvideo/controllers/admin/AdminStEasyVideoListController.php create mode 100644 modules/steasyvideo/controllers/admin/AdminStEasyVideoManufacturerController.php create mode 100644 modules/steasyvideo/controllers/admin/AdminStEasyVideoMiniatureBaseController.php create mode 100644 modules/steasyvideo/controllers/admin/AdminStEasyVideoMiniatureController.php create mode 100644 modules/steasyvideo/controllers/admin/AdminStEasyVideoMiniatureMobileController.php create mode 100644 modules/steasyvideo/controllers/admin/AdminStEasyVideoProductController.php create mode 100644 modules/steasyvideo/controllers/admin/AdminStEasyVideoProductMobileSettingController.php create mode 100644 modules/steasyvideo/controllers/admin/AdminStEasyVideoProductSettingController.php create mode 100644 modules/steasyvideo/controllers/admin/AdminStEasyVideoQuickViewSettingController.php create mode 100644 modules/steasyvideo/controllers/admin/AdminStEasyVideoSettingController.php create mode 100644 modules/steasyvideo/controllers/admin/index.php create mode 100644 modules/steasyvideo/controllers/front/ajax.php create mode 100644 modules/steasyvideo/controllers/front/index.php create mode 100644 modules/steasyvideo/controllers/index.php create mode 100644 modules/steasyvideo/index.php create mode 100644 modules/steasyvideo/logo.png create mode 100644 modules/steasyvideo/src/Repository/VideoRepository.php create mode 100644 modules/steasyvideo/src/Repository/index.php create mode 100644 modules/steasyvideo/src/index.php create mode 100644 modules/steasyvideo/steasyvideo.php create mode 100644 modules/steasyvideo/translations/index.php create mode 100644 modules/steasyvideo/upgrade/index.php create mode 100644 modules/steasyvideo/upgrade/install-1.0.5.php create mode 100644 modules/steasyvideo/upgrade/install-1.2.0.php create mode 100644 modules/steasyvideo/upgrade/install-1.2.3.php create mode 100644 modules/steasyvideo/vendor/.htaccess create mode 100644 modules/steasyvideo/vendor/autoload.php create mode 100644 modules/steasyvideo/vendor/composer/ClassLoader.php create mode 100644 modules/steasyvideo/vendor/composer/InstalledVersions.php create mode 100644 modules/steasyvideo/vendor/composer/LICENSE create mode 100644 modules/steasyvideo/vendor/composer/autoload_classmap.php create mode 100644 modules/steasyvideo/vendor/composer/autoload_namespaces.php create mode 100644 modules/steasyvideo/vendor/composer/autoload_psr4.php create mode 100644 modules/steasyvideo/vendor/composer/autoload_real.php create mode 100644 modules/steasyvideo/vendor/composer/autoload_static.php create mode 100644 modules/steasyvideo/vendor/composer/installed.json create mode 100644 modules/steasyvideo/vendor/composer/installed.php create mode 100644 modules/steasyvideo/vendor/composer/platform_check.php create mode 100644 modules/steasyvideo/views/css/admin.css create mode 100644 modules/steasyvideo/views/css/front.css create mode 100644 modules/steasyvideo/views/css/index.php create mode 100644 modules/steasyvideo/views/css/skin-0.css create mode 100644 modules/steasyvideo/views/css/skin-1.css create mode 100644 modules/steasyvideo/views/css/skin-2.css create mode 100644 modules/steasyvideo/views/css/skin-3.css create mode 100644 modules/steasyvideo/views/css/video-js.css create mode 100644 modules/steasyvideo/views/css/video-js.min.css create mode 100644 modules/steasyvideo/views/index.php create mode 100644 modules/steasyvideo/views/js/admin.js create mode 100644 modules/steasyvideo/views/js/front.js create mode 100644 modules/steasyvideo/views/js/index.php create mode 100644 modules/steasyvideo/views/js/video.min.js create mode 100644 modules/steasyvideo/views/js/videojs-vimeo.umd.js create mode 100644 modules/steasyvideo/views/js/youtube.min.js create mode 100644 modules/steasyvideo/views/templates/admin/index.php create mode 100644 modules/steasyvideo/views/templates/admin/steasyvideo-pro.tpl create mode 100644 modules/steasyvideo/views/templates/hook/device_mode.tpl create mode 100644 modules/steasyvideo/views/templates/hook/forquickview.tpl create mode 100644 modules/steasyvideo/views/templates/hook/header.tpl create mode 100644 modules/steasyvideo/views/templates/hook/index.php create mode 100644 modules/steasyvideo/views/templates/hook/miniature.tpl create mode 100644 modules/steasyvideo/views/templates/hook/miniature_tb.tpl create mode 100644 modules/steasyvideo/views/templates/hook/predefined/1.tpl create mode 100644 modules/steasyvideo/views/templates/hook/predefined/2.tpl create mode 100644 modules/steasyvideo/views/templates/hook/predefined/3.tpl create mode 100644 modules/steasyvideo/views/templates/hook/predefined/index.php create mode 100644 modules/steasyvideo/views/templates/index.php diff --git a/modules/steasyvideo/.htaccess b/modules/steasyvideo/.htaccess new file mode 100644 index 00000000..b62defe9 --- /dev/null +++ b/modules/steasyvideo/.htaccess @@ -0,0 +1,12 @@ + + # Apache 2.2 + + Order deny,allow + Deny from all + + + # Apache 2.4 + + Require all denied + + \ No newline at end of file diff --git a/modules/steasyvideo/classes/EasyVideoBase.php b/modules/steasyvideo/classes/EasyVideoBase.php new file mode 100644 index 00000000..3ae88bc2 --- /dev/null +++ b/modules/steasyvideo/classes/EasyVideoBase.php @@ -0,0 +1,357 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +if (!defined('_PS_VERSION_')) { + exit; +} + +class EasyVideoBase +{ + public static $device = ['desktop' => 'DESKTOP', 'mobile' => 'MOBILE', 'quickview' => 'QUICKVIEW']; + + public static $selectors = array( + 'miniature_video_selector_desktop' => array( + 'classic' => '.product-thumbnail', + 'st' => '.pro_first_box', + 'warehouse' => '.thumbnail-container', + ), + 'miniature_button_selector_desktop' => array( + 'classic' => '.thumbnail-top', + 'st' => '.pro_first_box', + 'warehouse' => '.thumbnail-container', + ), + 'miniature_video_selector_mobile' => array( + 'classic' => '.product-thumbnail', + 'st' => '.pro_first_box', + 'warehouse' => '.thumbnail-container', + ), + 'miniature_button_selector_mobile' => array( + 'classic' => '.thumbnail-top', + 'st' => '.pro_first_box', + 'warehouse' => '.thumbnail-container', + ), + 'gallery_video_selector_desktop' => array( + 'classic' => '.page-product:not(.modal-open) .images-container .product-cover', + 'st' => '.page-product:not(.modal-open) .pro_gallery_top_inner', + 'warehouse' => '.page-product:not(.modal-open) .images-container .product-cover', + ), + 'gallery_button_selector_desktop' => array( + 'classic' => '.page-product:not(.modal-open) .images-container .product-cover', + 'st' => '.page-product:not(.modal-open) .pro_gallery_top_inner', + 'warehouse' => '.page-product:not(.modal-open) .images-container .product-cover', + ), + 'gallery_type_desktop' => array( + 'st' => 1, + 'warehouse' => 1, + ), + 'gallery_thumbnail_type_desktop' => array( + 'classic' => 5, + 'st' => 1, + 'warehouse' => 1, + ), + 'gallery_slider_selector_desktop' => array( + 'st' => '.page-product:not(.modal-open) .pro_gallery_top', + 'warehouse' => '.page-product:not(.modal-open) #product-images-large', + ), + 'gallery_thumbnail_selector_desktop' => array( + 'st' => '.page-product:not(.modal-open) .pro_gallery_thumbs', + 'warehouse' => '.page-product:not(.modal-open) #product-images-thumbs', + ), + 'gallery_thumbnail_item_selector_desktop' => array( + 'classic' => '.images-container .thumb-container', + 'st' => '.pro_gallery_thumbs_container .swiper-slide', + 'warehouse' => '#product-images-thumbs .slick-slide', + ), + 'gallery_video_template_desktop' => array( + 'st' => 2, + 'warehouse' => 3, + ), + 'gallery_video_image_type_desktop' => array( + 'classic' => 'large_default', + 'st' => 'medium_default', + 'warehouse' => 'large_default', + ), + 'gallery_button_template_desktop' => array( + 'st' => 1, + 'warehouse' => 1, + ), + 'gallery_button_image_type_desktop' => array( + 'classic' => 'small_default', + 'st' => 'cart_default', + 'warehouse' => 'medium_default', + ), + + + 'gallery_video_selector_mobile' => array( + 'classic' => '.page-product:not(.modal-open) .images-container .product-cover', + 'st' => '.page-product:not(.modal-open) .pro_gallery_top_inner', + 'warehouse' => '.page-product:not(.modal-open) .images-container .product-cover', + ), + 'gallery_button_selector_mobile' => array( + 'classic' => '.page-product:not(.modal-open) .images-container .product-cover', + 'st' => '.page-product:not(.modal-open) .pro_gallery_top_inner', + 'warehouse' => '.page-product:not(.modal-open) .images-container .product-cover', + ), + 'gallery_type_mobile' => array( + 'st' => 1, + 'warehouse' => 1, + ), + 'gallery_thumbnail_type_mobile' => array( + 'classic' => 5, + 'st' => 1, + 'warehouse' => 1, + ), + 'gallery_slider_selector_mobile' => array( + 'st' => '.page-product:not(.modal-open) .pro_gallery_top', + 'warehouse' => '.page-product:not(.modal-open) #product-images-large', + ), + 'gallery_thumbnail_selector_mobile' => array( + 'st' => '.page-product:not(.modal-open) .pro_gallery_thumbs', + 'warehouse' => '.page-product:not(.modal-open) #product-images-thumbs', + ), + 'gallery_thumbnail_item_selector_mobile' => array( + 'classic' => '.images-container .thumb-container', + 'st' => '.pro_gallery_thumbs_container .swiper-slide', + 'warehouse' => '#product-images-thumbs .slick-slide', + ), + 'gallery_video_template_mobile' => array( + 'st' => 2, + 'warehouse' => 3, + ), + 'gallery_video_image_type_mobile' => array( + 'classic' => 'large_default', + 'st' => 'medium_default', + 'warehouse' => 'large_default', + ), + 'gallery_button_template_mobile' => array( + 'st' => 1, + 'warehouse' => 1, + ), + 'gallery_button_image_type_mobile' => array( + 'classic' => 'small_default', + 'st' => 'cart_default', + 'warehouse' => 'medium_default', + ), + + + 'gallery_video_selector_quickview' => array( + 'classic' => '.modal.quickview .images-container .product-cover', + 'st' => '.modal.quickview .pro_gallery_top_inner', + 'warehouse' => '.modal.quickview .images-container .product-cover', + ), + 'gallery_button_selector_quickview' => array( + 'classic' => '.modal.quickview .images-container .product-cover', + 'st' => '.modal.quickview .pro_gallery_top_inner', + 'warehouse' => '.modal.quickview .images-container .product-cover', + ), + 'gallery_type_quickview' => array( + 'st' => 1, + 'warehouse' => 1, + ), + 'gallery_thumbnail_type_quickview' => array( + 'classic' => 5, + 'st' => 1, + 'warehouse' => 1, + ), + 'gallery_slider_selector_quickview' => array( + 'st' => '.modal.quickview .pro_gallery_top', + 'warehouse' => '.modal.quickview #product-images-large', + ), + 'gallery_thumbnail_selector_quickview' => array( + 'st' => '.modal.quickview .pro_gallery_thumbs', + 'warehouse' => '.modal.quickview #product-images-thumbs', + ), + 'gallery_thumbnail_item_selector_quickview' => array( + 'classic' => '.images-container .thumb-container', + 'st' => '.pro_gallery_thumbs_container .swiper-slide', + 'warehouse' => '#product-images-thumbs .slick-slide', + ), + 'gallery_video_template_quickview' => array( + 'st' => 2, + 'warehouse' => 3, + ), + 'gallery_video_image_type_quickview' => array( + 'classic' => 'large_default', + 'st' => 'medium_default', + 'warehouse' => 'large_default', + ), + 'gallery_button_template_quickview' => array( + 'st' => 1, + 'warehouse' => 1, + ), + 'gallery_button_image_type_quickview' => array( + 'classic' => 'small_default', + 'st' => 'cart_default', + 'warehouse' => 'medium_default', + ), + + 'gallery_video_zindex' => array( + 'classic' => 9, + 'st' => 9, + 'warehouse' => 23, + ), + 'miniature_video_zindex' => array( + 'classic' => 1, + 'st' => 1, + 'warehouse' => 1, + ), + ); + + public static $_theme_name; + + public static function getThemeName(){ + if(!self::$_theme_name){ + self::$_theme_name = Configuration::get('ST_EASY_VIDEO_THEME_NAME'); + if (!self::$_theme_name) { + self::$_theme_name = Tools::strtolower(Context::getContext()->shop->theme->getName()); + $parent_theme_name = Tools::strtolower(Context::getContext()->shop->theme->get("parent", "")); + if ($parent_theme_name == 'panda') { + self::$_theme_name = 'panda'; + } elseif ($parent_theme_name == 'transformer') { + self::$_theme_name = 'transformer'; + } elseif ($parent_theme_name == 'warehouse') { + self::$_theme_name = 'warehouse'; + } + } + } + return self::$_theme_name; + } + public static function getSelector($key, $device = '', $default = '') + { + $theme_name = self::getThemeName(); + $theme_name = $theme_name == 'panda' || $theme_name == 'transformer' ? 'st' : $theme_name; + $key = $device ? $key.'_'.$device : $key; + return isset(self::$selectors[$key]) && array_key_exists($theme_name, self::$selectors[$key]) ? self::$selectors[$key][$theme_name] : (isset(self::$selectors[$key]['classic']) ? self::$selectors[$key]['classic'] : $default); + } + + + public static function fetchMediaServer(&$video) + { + if($video){ + $image = _PS_IMG_DIR_ . 'steasyvideo/' . $video['id_st_easy_video'] . '.jpg'; + if (file_exists($image)) { + $image_url = _PS_IMG_ . 'steasyvideo/' . $video['id_st_easy_video'] . '.jpg'; + $video['thumbnail'] = Context::getContext()->link->protocol_content.Tools::getMediaServer($image_url).$image_url; + } + } + } + public static function getVideosByProduct($id_product, $locations=[], $limit=0, $link_rewrite='', $video_templates=[], $button_templates=[]) + { + if(!$id_product) + return false; + $cover = Product::getCover($id_product); + $gallery_video_template = $gallery_button_template = $miniature_video_template = $miniature_button_template = $gallery_video_image_type = $gallery_button_image_type = $gallery_video_placeholder_url = $gallery_button_placeholder_url = $miniature_video_image_type = $miniature_button_image_type = $miniature_video_placeholder_url = $miniature_button_placeholder_url = []; + foreach (self::$device as $kl => $ku) { + $gallery_video_template[$kl] = Configuration::get('ST_EASY_VIDEO_GALLERY_VIDEO_TEMPLATE_'.$ku); + if(!$gallery_video_template[$kl] && ($id = self::getSelector('gallery_video_template', $kl)) && !empty($video_templates[$id])) + $gallery_video_template[$kl] = $video_templates[$id]; + $gallery_button_template[$kl] = Configuration::get('ST_EASY_VIDEO_GALLERY_BUTTON_TEMPLATE_'.$ku); + if(!$gallery_button_template[$kl] && ($id = self::getSelector('gallery_button_template', $kl)) && !empty($button_templates[$id])) + $gallery_button_template[$kl] = $button_templates[$id]; + $miniature_video_template[$kl] = Configuration::get('ST_EASY_VIDEO_MINIATURE_VIDEO_TEMPLATE_'.$ku); + $miniature_button_template[$kl] = Configuration::get('ST_EASY_VIDEO_MINIATURE_BUTTON_TEMPLATE_'.$ku); + + $gallery_video_image_type[$kl] = Configuration::get('ST_EASY_VIDEO_GALLERY_VIDEO_IMAGE_TYPE_'.$ku); + $gallery_video_image_type[$kl] = $gallery_video_image_type[$kl] ?: self::getSelector('gallery_video_image_type', $kl); + $gallery_button_image_type[$kl] = Configuration::get('ST_EASY_VIDEO_GALLERY_BUTTON_IMAGE_TYPE_'.$ku); + $gallery_button_image_type[$kl] = $gallery_button_image_type[$kl] ?: self::getSelector('gallery_button_image_type', $kl); + $miniature_video_image_type[$kl] = Configuration::get('ST_EASY_VIDEO_MINIATURE_VIDEO_IMAGE_TYPE_'.$ku); + $miniature_video_image_type[$kl] = $miniature_video_image_type[$kl] ?: self::getSelector('miniature_video_image_type', $kl); + $miniature_button_image_type[$kl] = Configuration::get('ST_EASY_VIDEO_MINIATURE_BUTTON_IMAGE_TYPE_'.$ku); + $miniature_button_image_type[$kl] = $miniature_button_image_type[$kl] ?: self::getSelector('miniature_button_image_type', $kl); + + if ($cover) { + $gallery_video_placeholder_url[$kl] = Context::getContext()->link->getImageLink($link_rewrite, $cover['id_image'], $gallery_video_image_type[$kl]); + $gallery_button_placeholder_url[$kl] = Context::getContext()->link->getImageLink($link_rewrite, $cover['id_image'], $gallery_button_image_type[$kl]); + $miniature_video_placeholder_url[$kl] = Context::getContext()->link->getImageLink($link_rewrite, $cover['id_image'], $miniature_video_image_type[$kl]); + $miniature_button_placeholder_url[$kl] = Context::getContext()->link->getImageLink($link_rewrite, $cover['id_image'], $miniature_button_image_type[$kl]); + } else { + $gallery_video_placeholder_url[$kl] = Tools::getCurrentUrlProtocolPrefix().Tools::getMediaServer(_THEME_PROD_DIR_)._THEME_PROD_DIR_.Context::getContext()->language->iso_code.'-default-'.$gallery_video_image_type[$kl].'.jpg'; + $gallery_button_placeholder_url[$kl] = Tools::getCurrentUrlProtocolPrefix().Tools::getMediaServer(_THEME_PROD_DIR_)._THEME_PROD_DIR_.Context::getContext()->language->iso_code.'-default-'.$gallery_button_image_type[$kl].'.jpg'; + $miniature_video_placeholder_url[$kl] = Tools::getCurrentUrlProtocolPrefix().Tools::getMediaServer(_THEME_PROD_DIR_)._THEME_PROD_DIR_.Context::getContext()->language->iso_code.'-default-'.$miniature_video_image_type[$kl].'.jpg'; + $miniature_button_placeholder_url[$kl] = Tools::getCurrentUrlProtocolPrefix().Tools::getMediaServer(_THEME_PROD_DIR_)._THEME_PROD_DIR_.Context::getContext()->language->iso_code.'-default-'.$miniature_button_image_type[$kl].'.jpg'; + } + } + + + $videos_for_template = []; + if ($videos = StEasyVideoClass::getVideos($id_product, $locations, Context::getContext()->language->id, $limit)) { + foreach ($videos as $index => $video) { + self::fetchMediaServer($video); + if (preg_match("/youtu(\.be|be\.com)/", $video['url'])) { + $video['url'] = preg_replace("(^https?)", "", $video['url']); + if (!$video['thumbnail'] && $video['online_thumbnail'] && ($youtube_id = self::getYoutubeId($video['url']))) { + $video['thumbnail'] = "//img.youtube.com/vi/".$youtube_id."/default.jpg"; + } + } + foreach (self::$device as $kl => $ku) { + if (!empty($gallery_video_template[$kl])) { + $video['gallery_video_template_'.$kl] = self::prepareTemplate($gallery_video_template[$kl], $video, $gallery_video_placeholder_url[$kl], $gallery_video_image_type[$kl]); + } + if (!empty($gallery_button_template[$kl])) { + $video['gallery_button_template_'.$kl] = self::prepareTemplate($gallery_button_template[$kl], $video, $gallery_button_placeholder_url[$kl], $gallery_button_image_type[$kl]); + } + if (!empty($miniature_video_template[$kl])) { + $video['miniature_video_template_'.$kl] = self::prepareTemplate($miniature_video_template[$kl], $video, $miniature_video_placeholder_url[$kl], $miniature_video_image_type[$kl]); + } + if (!empty($miniature_button_template[$kl])) { + $video['miniature_button_template_'.$kl] = self::prepareTemplate($miniature_button_template[$kl], $video, $miniature_button_placeholder_url[$kl], $miniature_button_image_type[$kl]); + } + } + + $video['autoplay'] = (int)$video['autoplay']; + $video['loop'] = (int)$video['loop']; + $video['muted'] = (int)$video['muted']; + $video['desktop_ran'] = false; + $video['mobile_ran'] = false; + $video['quickview_ran'] = false; + $videos_for_template['product_'.$id_product.'_'.$index] = $video; + } + } + return $videos_for_template; + } + public static function prepareTemplate($template, $video, $placehoder_url, $image_type) + { + $image_size = Image::getSize($image_type); + $template = str_replace('@thumbnail_url@', ($video['thumbnail'] ?: $placehoder_url), $template); + $template = str_replace('@placeholder_url@', $placehoder_url, $template); + if ($image_size) { + $template = str_replace('@placeholder_width@', $image_size['width'], $template); + $template = str_replace('@placeholder_height@', $image_size['height'], $template); + } else { + $template = str_replace('@placeholder_width@', '', $template); + $template = str_replace('@placeholder_height@', '', $template); + } + return $template; + } + + public static function getYoutubeId($url) + { + preg_match("/.*(?:youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|shorts\/)([^#\&\?]*).*/", $url, $match); + return ($match && Tools::strlen($match[1]) == 11) ? $match[1] : false; + } + +} diff --git a/modules/steasyvideo/classes/StEasyVideoClass.php b/modules/steasyvideo/classes/StEasyVideoClass.php new file mode 100644 index 00000000..12931b57 --- /dev/null +++ b/modules/steasyvideo/classes/StEasyVideoClass.php @@ -0,0 +1,167 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +if (!defined('_PS_VERSION_')) { + exit; +} + +class StEasyVideoClass extends ObjectModel +{ + public $id; + public $id_st_easy_video; + public $position; + public $active; + public $url; + public $thumbnail; + public $online_thumbnail; + public $name; + public $loop; + public $muted; + public $autoplay; + public $sub_category; + public $id_product; + public $id_category; + public $id_manufacturer; + public $ratio; + public $location; + /** + * @see ObjectModel::$definition + */ + public static $definition = array( + 'table' => 'st_easy_video', + 'primary' => 'id_st_easy_video', + 'multilang' => false, + 'fields' => array( + 'position' => array('type' => self::TYPE_INT, 'validate' => 'isunsignedInt'), + 'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), + 'url' => array('type' => self::TYPE_STRING, 'validate' => 'isAnything', 'size' => 255, 'required'=>true), + 'thumbnail' => array('type' => self::TYPE_STRING, 'validate' => 'isAnything', 'size' => 255), + 'online_thumbnail' => array('type' => self::TYPE_INT, 'validate' => 'isunsignedInt'), + 'name' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'size' => 255), + 'loop' => array('type' => self::TYPE_INT, 'validate' => 'isunsignedInt'), + 'muted' => array('type' => self::TYPE_INT, 'validate' => 'isunsignedInt'), + 'autoplay' => array('type' => self::TYPE_INT, 'validate' => 'isunsignedInt'), + 'sub_category' => array('type' => self::TYPE_INT, 'validate' => 'isunsignedInt'), + 'id_product' => array('type' => self::TYPE_STRING, 'validate' => 'isAnything'), + 'id_category' => array('type' => self::TYPE_INT, 'validate' => 'isunsignedInt'), + 'id_manufacturer' => array('type' => self::TYPE_INT, 'validate' => 'isunsignedInt'), + 'location' => array('type' => self::TYPE_INT, 'validate' => 'isunsignedInt'), + 'ratio' => array('type' => self::TYPE_STRING, 'validate' => 'isAnything', 'size' => 255), + ), + ); + + public function __construct($id = null, $id_lang = null, $id_shop = null) + { + Shop::addTableAssociation(self::$definition['table'], array('type' => 'shop')); + parent::__construct($id, $id_lang, $id_shop); + } + + public function delete() + { + $image = _PS_IMG_DIR_ . 'steasyvideo/' . $this->id . '.jpg'; + if (file_exists($image)) + @unlink($image); + + return parent::delete(); + } + public static function getOneVideo($id_product, $location=0) + { + Shop::addTableAssociation('st_easy_video', array('type' => 'shop')); + $sql = 'SELECT * + FROM `'._DB_PREFIX_.'st_easy_video` spv + '.Shop::addSqlAssociation('st_easy_video', 'spv').' + WHERE spv.`active`=1 AND ('.self::getProductWhereConds($id_product).') '.($location ? ' AND spv.`location` IN (0, 2, 3) ' : ' AND spv.`location` IN (0, 3) ').' + ORDER BY spv.`position` desc'; + + return Db::getInstance()->getRow($sql); + } + + public static function getVideos($id_product, $locations=[], $lang=0, $limit=0) + { + Shop::addTableAssociation('st_easy_video', array('type' => 'shop')); + $sql = 'SELECT * + FROM `'._DB_PREFIX_.'st_easy_video` spv + INNER JOIN `'._DB_PREFIX_.'st_easy_video_yuyan` yy ON yy.id_st_easy_video = spv.id_st_easy_video + '.Shop::addSqlAssociation('st_easy_video', 'spv').' + WHERE spv.`active`=1 AND ('.self::getProductWhereConds($id_product).') '.(count($locations) ? ' AND spv.`location` IN ('.implode(',', $locations).') ' : '').($lang ? ' AND ( yy.`id_lang` = 0 OR yy.`id_lang` = '.(int)$lang.')' : '').' + ORDER BY spv.`position` desc'.($limit ? ' LIMIT '.(int)$limit : ''); + + return Db::getInstance()->executeS($sql); + } + + public static function get_lang_obj_data($id) + { + $data=Db::getInstance()->executeS((new DbQuery())->from(self::$definition['table'].'_yuyan')->where('id_st_easy_video='.(int)$id)); + $new_data=[]; + if($data && !empty($data)){ + $new_data=array_column($data,'id_lang'); + } + return $new_data; + } + + public static function getProductWhereConds($id) + { + $where = '0'; + $product = new Product($id); + if ($product->id_manufacturer) { + $where .= ' OR (spv.`id_manufacturer` > 0 AND spv.`id_manufacturer`='.(int)$product->id_manufacturer.')'; + } + $id_category = $product->id_category_default; + if ($cates = $product->getCategories()) { + $categories = array(); + $parents = array(); + foreach ($cates as $id_cate) { + $category = new Category($id_cate); + if (!$category->active || !$category->id) { + continue; + } + if ($category->id) { + // For all product categories instead of deafult category. + $categories[] = (int)$category->id; + + $id_array = array(); + $category_parents = $category->getParentsCategories(); + if (is_array($category_parents) && count($category_parents)) { + foreach ($category_parents as $v) { + $id_array[] = $v['id_category']; + } + } + if (in_array($id_category, $id_array)) { + $parents = array_merge($parents, $id_array); + } + } + } + + $where .= ' OR (spv.`id_category` > 0 AND spv.`id_category` IN('.implode(',', array_unique(array_merge($categories, $parents))).') AND spv.`sub_category`=1) OR (spv.`id_category` > 0 AND spv.`id_category` IN('.implode(',', $categories).') AND spv.`sub_category`=0)'; + } + if ($product->id) { + $where .= ' OR ( find_in_set(\''.(int)$product->id.'\', spv.`id_product`))'; + } + + return $where; + } + +} diff --git a/modules/steasyvideo/classes/StEasyVideoYuyanClass.php b/modules/steasyvideo/classes/StEasyVideoYuyanClass.php new file mode 100644 index 00000000..6dc6e380 --- /dev/null +++ b/modules/steasyvideo/classes/StEasyVideoYuyanClass.php @@ -0,0 +1,62 @@ + +* @copyright 2007-2016 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +if (!defined('_PS_VERSION_')) { + exit; +} + +class StEasyVideoYuyanClass +{ + public static function deleteByVideo($id_st_easy_video) + { + if (!$id_st_easy_video) { + return false; + } + return Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'st_easy_video_yuyan WHERE `id_st_easy_video`='.(int)$id_st_easy_video); + } + public static function getByVideo($id_st_easy_video) + { + if (!$id_st_easy_video) { + return false; + } + return Db::getInstance()->executeS('SELECT * FROM '._DB_PREFIX_.'st_easy_video_yuyan WHERE `id_st_easy_video`='.(int)$id_st_easy_video); + } + + public static function changeVideoYuyan($id_st_easy_video, $yuyans) + { + if (!$id_st_easy_video) { + return false; + } + $res = true; + foreach ($yuyans as $id_lang) { + $res &= Db::getInstance()->insert('st_easy_video_yuyan', array( + 'id_st_easy_video' => (int)$id_st_easy_video, + 'id_lang' => $id_lang + )); + } + return $res; + } +} diff --git a/modules/steasyvideo/classes/index.php b/modules/steasyvideo/classes/index.php new file mode 100644 index 00000000..b36c776a --- /dev/null +++ b/modules/steasyvideo/classes/index.php @@ -0,0 +1,34 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/modules/steasyvideo/composer.json b/modules/steasyvideo/composer.json new file mode 100644 index 00000000..8daea124 --- /dev/null +++ b/modules/steasyvideo/composer.json @@ -0,0 +1,34 @@ +{ + "name": "prestashop/steasyvideo", + "description": "PrestaShop module steasyvideo", + "homepage": "https://www.sunnytoo.com", + "license": "", + "authors": [ + { + "name": "ST-THEMES", + "email": "helloleemj@gmail.com" + } + ], + "require": { + "php": ">=5.6.0" + }, + "require-dev": { + }, + "config": { + "preferred-install": "dist", + "classmap-authoritative": true, + "optimize-autoloader": true, + "prepend-autoloader": false, + "platform": { + "php": "5.6" + } + }, + "autoload": { + "psr-4": { + "PrestaShop\\Module\\StEasyVideo\\": "src/" + }, + "classmap": ["steasyvideo.php"], + "exclude-from-classmap": [] + }, + "type": "prestashop-module" +} diff --git a/modules/steasyvideo/composer.lock b/modules/steasyvideo/composer.lock new file mode 100644 index 00000000..8e84dcb5 --- /dev/null +++ b/modules/steasyvideo/composer.lock @@ -0,0 +1,23 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "a373d9efff58dd240072b733ce534f28", + "packages": [], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=5.6.0" + }, + "platform-dev": [], + "platform-overrides": { + "php": "5.6" + }, + "plugin-api-version": "2.1.0" +} diff --git a/modules/steasyvideo/config.xml b/modules/steasyvideo/config.xml new file mode 100644 index 00000000..c5703bec --- /dev/null +++ b/modules/steasyvideo/config.xml @@ -0,0 +1,11 @@ + + + steasyvideo + + + + + + 1 + 0 + \ No newline at end of file diff --git a/modules/steasyvideo/config/common.yml b/modules/steasyvideo/config/common.yml new file mode 100644 index 00000000..e186dd1d --- /dev/null +++ b/modules/steasyvideo/config/common.yml @@ -0,0 +1,8 @@ +services: + _defaults: + public: true + + st_steasyvideo_repository: + class: PrestaShop\Module\StEasyVideo\Repository\VideoRepository + arguments: + - '@prestashop.adapter.legacy.context' #used for product presenter diff --git a/modules/steasyvideo/config/front/index.php b/modules/steasyvideo/config/front/index.php new file mode 100644 index 00000000..03f4b267 --- /dev/null +++ b/modules/steasyvideo/config/front/index.php @@ -0,0 +1,34 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/modules/steasyvideo/config/front/services.yml b/modules/steasyvideo/config/front/services.yml new file mode 100644 index 00000000..6e16e432 --- /dev/null +++ b/modules/steasyvideo/config/front/services.yml @@ -0,0 +1,2 @@ +imports: + - { resource: ../common.yml } diff --git a/modules/steasyvideo/config/index.php b/modules/steasyvideo/config/index.php new file mode 100644 index 00000000..03f4b267 --- /dev/null +++ b/modules/steasyvideo/config/index.php @@ -0,0 +1,34 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/modules/steasyvideo/controllers/admin/AdminStEasyVideoCategoryController.php b/modules/steasyvideo/controllers/admin/AdminStEasyVideoCategoryController.php new file mode 100644 index 00000000..f2e544a5 --- /dev/null +++ b/modules/steasyvideo/controllers/admin/AdminStEasyVideoCategoryController.php @@ -0,0 +1,90 @@ + +* @copyright Since 2007 PrestaShop SA and Contributors +* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) +*/ + +if (!defined('_PS_VERSION_')) { + exit; +} +require_once dirname(__FILE__) . '/AdminStEasyVideoListController.php'; +class AdminStEasyVideoCategoryController extends AdminStEasyVideoListController +{ + protected $contr = 'category'; + public function addWhere($where = '') + { + return $where.' AND id_product=\'\' AND id_category!=0 AND id_manufacturer=0 '; + } + + public function filterFormFields(&$fileds, $obj) + { + array_splice($fileds['input'], 1, 0, array( + array( + 'type' => 'select', + 'label' => $this->l('Select a category:'), + 'required' => true, + 'name' => 'id_category', + 'class' => 'fixed-width-xxl', + 'options' => array( + 'query' => $this->getApplyCategory(), + 'id' => 'id', + 'name' => 'name', + 'default' => array( + 'value' => '', + 'label' => $this->l('Please select') + ) + ), + ), + array( + 'type' => 'switch', + 'label' => $this->l('Apply to subcategories:'), + 'name' => 'sub_category', + 'is_bool' => true, + 'default_value' => 0, + 'values' => array( + array( + 'id' => 'sub_category_on', + 'value' => 1, + 'label' => $this->l('Enabled') + ), + array( + 'id' => 'sub_category_off', + 'value' => 0, + 'label' => $this->l('Disabled') + ) + ), + ), + )); + } + public function getApplyCategory() + { + $category_arr = array(); + $this->getCategoryOption($category_arr, Category::getRootCategory()->id, (int)$this->context->language->id, (int)Shop::getContextShopID(), true); + return $category_arr; + } + + public function getCategoryOption(&$category_arr, $id_category = 1, $id_lang = false, $id_shop = false, $recursive = true) + { + $id_lang = $id_lang ? (int)$id_lang : (int)Context::getContext()->language->id; + $category = new Category((int)$id_category, (int)$id_lang, (int)$id_shop); + + if (is_null($category->id)) { + return; + } + + if ($recursive) { + $children = Category::getChildren((int)$id_category, (int)$id_lang, true, (int)$id_shop); + $spacer = str_repeat(' ', $this->spacer_size * (int)$category->level_depth); + } + + $shop = (object) Shop::getShop((int)$category->getShopID()); + $category_arr[] = array('id' => (int)$category->id,'name' => (isset($spacer) ? $spacer : '').$category->name.' ('.$shop->name.')'); + + if (isset($children) && is_array($children) && count($children)) { + foreach ($children as $child) { + $this->getCategoryOption($category_arr, (int)$child['id_category'], (int)$id_lang, (int)$child['id_shop'], $recursive); + } + } + } +} diff --git a/modules/steasyvideo/controllers/admin/AdminStEasyVideoController.php b/modules/steasyvideo/controllers/admin/AdminStEasyVideoController.php new file mode 100644 index 00000000..164b652c --- /dev/null +++ b/modules/steasyvideo/controllers/admin/AdminStEasyVideoController.php @@ -0,0 +1,17 @@ + +* @copyright Since 2007 PrestaShop SA and Contributors +* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) +*/ + +if (!defined('_PS_VERSION_')) { + exit; +} +class AdminStEasyVideoController extends ModuleAdminController +{ + public function __construct() + { + Tools::redirectAdmin($this->context->link->getAdminLink('AdminStEasyVideoList')); + } +} diff --git a/modules/steasyvideo/controllers/admin/AdminStEasyVideoGalleryController.php b/modules/steasyvideo/controllers/admin/AdminStEasyVideoGalleryController.php new file mode 100644 index 00000000..87ae328c --- /dev/null +++ b/modules/steasyvideo/controllers/admin/AdminStEasyVideoGalleryController.php @@ -0,0 +1,421 @@ + +* @copyright Since 2007 PrestaShop SA and Contributors +* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) +*/ + +if (!defined('_PS_VERSION_')) { + exit; +} +class AdminStEasyVideoGalleryController extends ModuleAdminController +{ + protected $contr = ''; + public function __construct() + { + $this->bootstrap = true; + parent::__construct(); + + $image_types_arr = array( + array('id' => '','name' => $this->l('Use the predefined value.'),) + ); + $imagesTypes = ImageType::getImagesTypes('products'); + foreach ($imagesTypes as $k => $imageType) { + if (Tools::substr($imageType['name'], -3) == '_2x') { + continue; + } + $image_types_arr[] = array('id' => $imageType['name'], 'name' => $imageType['name'].'('.$imageType['width'].'x'.$imageType['height'].')'); + } + $selector_desc = $this->contr == 'QUICKVIEW' ? $this->l('In most cases, selectors in quickview should start with .modal.quickview') : ($this->contr == 'DESKTOP' ? $this->l('In most cases, selectors start with .page-product:not(.modal-open) to avoid conflict with selectors in quickview window.') : ''); + + $play_icon_fields = $this->module->getButtonFiledsOptions('PLAY_ICON'); + unset($play_icon_fields[$this->module->_prefix_st.'PLAY_ICON_BTN_HOVER_COLOR_'.$this->contr], $play_icon_fields[$this->module->_prefix_st.'PLAY_ICON_BTN_HOVER_BG_'.$this->contr]); + + $this->fields_options = array( + 'general' => array( + 'title' => $this->l('General Settings'), + 'icon' => 'icon-cogs', + 'fields' => array( + $this->module->_prefix_st.'GALLERY_DISPLAY_'.$this->contr => array( + 'type' => 'radio', + 'title' => $this->l('How to display vidoes'), + 'validation' => 'isUnsignedInt', + 'choices' => array( + 0 => $this->l('No'), + 1 => $this->l('Buttons'), + 2 => $this->l('Videos'), + 3 => $this->l('Add videos to a slider'), + 4 => $this->l('Add buttons to a thumbnail slider, videos show out when the buttons are clicked'), + 5 => $this->l('Add videos to a slider, add buttons to a synchronized thumbnail slider'), + 6 => $this->l('Videos, add buttons to a thumbnail slider.'),// panda transformer gallery image scrolling + 7 => $this->l('A button on the first image, and a video icon on the first item of thumbnail slider'), + ), + ), + $this->module->_prefix_st.'GALLERY_VIDEO_SELECTOR_'.$this->contr => array( + 'type' => 'text', + 'title' => $this->l('Video selector'), + 'validation' => 'isAnything', + 'desc' => $selector_desc, + ), + $this->module->_prefix_st.'GALLERY_VIDEO_APPEND_'.$this->contr => [ + 'title' => $this->l('How to add'), + 'cast' => 'intval', + 'type' => 'select', + 'identifier' => 'id', + 'list' => $this->module::$_appends, + ], + $this->module->_prefix_st.'GALLERY_VIDEO_POSITION_'.$this->contr => [ + 'type' => 'radio', + 'cast' => 'intval', + 'title' => $this->l('How to video player'), + 'validation' => 'isUnsignedInt', + 'choices' => array( + 0 => $this->l('Display on an element (Position: absolute)'), + 1 => $this->l('Normal document flow (Position: static)'), + ), + ], + $this->module->_prefix_st.'GALLERY_BUTTON_SELECTOR_'.$this->contr => array( + 'type' => 'text', + 'title' => $this->l('Button selector'), + 'validation' => 'isAnything', + 'desc' => $selector_desc, + ), + $this->module->_prefix_st.'GALLERY_BUTTON_APPEND_'.$this->contr => [ + 'title' => $this->l('How to add'), + 'cast' => 'intval', + 'type' => 'select', + 'identifier' => 'id', + 'list' => $this->module::$_appends, + ], + $this->module->_prefix_st.'GALLERY_BUTTON_POSITION_'.$this->contr => [ + 'type' => 'radio', + 'cast' => 'intval', + 'title' => $this->l('How to display buttons'), + 'validation' => 'isUnsignedInt', + 'choices' => array( + 0 => $this->l('Display on an element (Position: absolute)'), + 1 => $this->l('Normal document flow (Position: static)'), + ), + ], + $this->module->_prefix_st.'GALLERY_BUTTON_LAYOUT_'.$this->contr => array( + 'type' => 'radio', + 'cast' => 'intval', + 'title' => $this->l('Play button layout'), + 'validation' => 'isUnsignedInt', + 'choices' => array( + 0 => $this->l('Icon'), + 1 => $this->l('Text'), + 2 => $this->l('Icon + text horizontally'), + 3 => $this->l('Icon + text vertically'), + ), + ), + $this->module->_prefix_st.'GALLERY_BUTTON_HIDE_'.$this->contr => array( + 'title' => $this->l('Hide the play button when videos start play'), + 'validation' => 'isBool', + 'type' => 'bool', + 'is_bool' => true, + ), + + $this->module->_prefix_st.'GALLERY_TYPE_'.$this->contr => array( + 'type' => 'radio', + 'title' => $this->l('Slider'), + 'validation' => 'isUnsignedInt', + 'choices' => array( + 0 => $this->l('Use the predefined value.'), + 1 => $this->l('Swiper'), + 2 => $this->l('Slick slider'), + 3 => $this->l('Owl carrousel 2'), + 4 => $this->l('Owl carrousel 1'), + // 5 => $this->l('PrestaShop classic theme - Scrollbox'), + ), + 'desc' => $this->l('Select the first option if you are using one of these themes: Classic theme, Panda theme, Transformer theme and Warehouse theme.'), + ), + $this->module->_prefix_st.'GALLERY_SLIDER_APPEND_'.$this->contr => [ + 'title' => $this->l('How to add'), + 'cast' => 'intval', + 'type' => 'select', + 'identifier' => 'id', + 'list' => array( + 0 => array( + 'id' => 0, + 'name' => '1', + ), + 1 => array( + 'id' => 1, + 'name' => '2', + ), + 2 => array( + 'id' => 2, + 'name' => '3', + ), + 100 => array( + 'id' => 100, + 'name' => 'End', + ), + ), + ], + $this->module->_prefix_st.'GALLERY_SLIDER_SELECTOR_'.$this->contr => array( + 'type' => 'text', + 'title' => $this->l('Gallery selector'), + 'validation' => 'isAnything', + 'desc' => $this->l('Leave it empty to use the predefined value.').$selector_desc, + ), + $this->module->_prefix_st.'GALLERY_THUMBNAIL_TYPE_'.$this->contr => array( + 'type' => 'radio', + 'title' => $this->l('Thumbnail slider'), + 'validation' => 'isUnsignedInt', + 'choices' => array( + 0 => $this->l('Use the predefined value.'), + 1 => $this->l('Swiper'), + 2 => $this->l('Slick slider'), + 3 => $this->l('Owl carrousel 2'), + 4 => $this->l('Owl carrousel 1'), + 5 => $this->l('PrestaShop classic theme - Scrollbox'), + ), + 'desc' => $this->l('Select the first option if you are using one of these themes: Classic theme, Panda theme, Transformer theme and Warehouse theme.'), + ), + $this->module->_prefix_st.'GALLERY_THUMBNAIL_APPEND_'.$this->contr => [ + 'title' => $this->l('How to add'), + 'cast' => 'intval', + 'type' => 'select', + 'identifier' => 'id', + 'list' => array( + 0 => array( + 'id' => 0, + 'name' => '1', + ), + 1 => array( + 'id' => 1, + 'name' => '2', + ), + 2 => array( + 'id' => 2, + 'name' => '3', + ), + 100 => array( + 'id' => 100, + 'name' => 'End', + ), + ), + ], + $this->module->_prefix_st.'GALLERY_THUMBNAIL_SELECTOR_'.$this->contr => array( + 'type' => 'text', + 'title' => $this->l('Thumbnail selector'), + 'validation' => 'isAnything', + 'desc' => $this->l('Leave it empty to use the predefined value.').$selector_desc, + ), + $this->module->_prefix_st.'GALLERY_THUMBNAIL_ITEM_SELECTOR_'.$this->contr => array( + 'type' => 'text', + 'title' => $this->l('Thumbnail item selector'), + 'validation' => 'isAnything', + 'desc' => $this->l('Leave it empty to use the predefined value.').$selector_desc, + ), + $this->module->_prefix_st.'GALLERY_CLOSE_VIDEO_'.$this->contr => array( + 'type' => 'radio', + 'cast' => 'intval', + 'title' => $this->l('Close video'), + 'validation' => 'isUnsignedInt', + 'choices' => array( + 0 => $this->l('Default'), + 1 => $this->l('When a thumbnail item is clicked.'), + 2 => $this->l('When a thumbnail item is on hover.'), + ), + ), + $this->module->_prefix_st.'GALLERY_VIDEO_TEMPLATE_'.$this->contr => [ + 'title' => $this->l('Video template'), + 'validation' => 'isAnything', + 'type' => 'textarea', + 'cols' => 30, + 'rows' => 5, + 'desc' => array( + $this->l('They are four variables you can use: @placeholder_url@, @placeholder_width@, @placeholder_height@, and @thumbnail_url@.'), + $this->l('Disable the "Use HTMLPurifier Library" setting on the "BO>Preferences>General" page, otherwise the value won\'t be saved.'), + ), + ], + $this->module->_prefix_st.'GALLERY_VIDEO_IMAGE_TYPE_'.$this->contr => [ + 'title' => $this->l('Placeholder image for videos'), + 'validation' => 'isAnything', + 'required' => false, + 'type' => 'select', + 'list' => $image_types_arr, + 'identifier' => 'id', + ], + $this->module->_prefix_st.'GALLERY_BUTTON_TEMPLATE_'.$this->contr => [ + 'title' => $this->l('Button template'), + 'validation' => 'isAnything', + 'type' => 'textarea', + 'cols' => 30, + 'rows' => 5, + 'desc' => array( + $this->l('They are four variables you can use: @placeholder_url@, @placeholder_width@, @placeholder_height@, and @thumbnail_url@.'), + $this->l('Disable the "Use HTMLPurifier Library" setting on the "BO>Preferences>General" page, otherwise the value won\'t be saved.'), + ), + ], + $this->module->_prefix_st.'GALLERY_BUTTON_IMAGE_TYPE_'.$this->contr => [ + 'title' => $this->l('Placeholder image for buttons'), + 'validation' => 'isAnything', + 'required' => false, + 'type' => 'select', + 'list' => $image_types_arr, + 'identifier' => 'id', + ], + ), + 'submit' => array('title' => $this->l('Save all')), + ), + 'player' => array( + 'title' => $this->l('Player'), + 'icon' => 'icon-cogs', + 'fields' => array( + $this->module->_prefix_st.'GALLERY_AUTOPLAY_'.$this->contr => array( + 'title' => $this->l('Autoplay'), + 'validation' => 'isBool', + 'type' => 'bool', + 'is_bool' => true, + 'desc' => $this->l('When videos are displayed in video palyers'), + ), + $this->module->_prefix_st.'GALLERY_MUTED_'.$this->contr => array( + 'title' => $this->l('Muted'), + 'validation' => 'isBool', + 'type' => 'bool', + 'is_bool' => true, + 'desc' => $this->l('Only muted videos can be autoplay'), + ), + $this->module->_prefix_st.'GALLERY_LOOP_'.$this->contr => array( + 'title' => $this->l('Loop'), + 'validation' => 'isBool', + 'type' => 'bool', + 'is_bool' => true, + ), + $this->module->_prefix_st.'GALLERY_CONTROLS_'.$this->contr => array( + 'title' => $this->l('Show controls'), + 'validation' => 'isBool', + 'type' => 'bool', + 'is_bool' => true, + ), + ), + 'submit' => array('title' => $this->l('Save all')), + ), + 'player_style' => array( + 'title' => $this->l('Player style'), + 'icon' => 'icon-cogs', + 'fields' => array( + $this->module->_prefix_st.'GALLERY_PLAYER_BG_'.$this->contr => [ + 'title' => $this->l('Color'), + 'validation' => 'isColor', + 'type' => 'color', + 'size' => 5, + 'name' => $this->module->_prefix_st.'GALLERY_PLAYER_BG_'.$this->contr, + ], + $this->module->_prefix_st.'GALLERY_VIDEO_ZINDEX_'.$this->contr => [ + 'title' => $this->l('Z-index'), + 'validation' => 'isUnsignedId', + 'required' => false, + 'cast' => 'intval', + 'type' => 'text', + ], + ), + 'submit' => array('title' => $this->l('Save all')), + ), + 'button_style' => array( + 'title' => $this->l('Play button style'), + 'icon' => 'icon-cogs', + 'fields' => array( + $this->module->_prefix_st.'GALLERY_PLAY_BTN_POSITION_'.$this->contr => [ + 'type' => 'radio', + 'cast' => 'intval', + 'title' => $this->l('Position'), + 'validation' => 'isUnsignedInt', + 'choices' => array( + 0 => $this->l('Center'), + 1 => $this->l('Top left'), + 2 => $this->l('Top right'), + 3 => $this->l('Bottom right'), + 4 => $this->l('Bottom left'), + ), + ], + $this->module->_prefix_st.'GALLERY_PLAY_BTN_OFFSET_X_'.$this->contr => [ + 'title' => $this->l('Offset x'), + 'validation' => 'isUnsignedInt', + 'cast' => 'intval', + 'type' => 'text', + 'suffix' => $this->l('pixels'), + ], + $this->module->_prefix_st.'GALLERY_PLAY_BTN_OFFSET_Y_'.$this->contr => [ + 'title' => $this->l('Offset y'), + 'validation' => 'isUnsignedInt', + 'cast' => 'intval', + 'type' => 'text', + 'suffix' => $this->l('pixels'), + ], + ) + $this->module->getButtonFiledsOptions('GALLERY_PLAY', '_'.$this->contr) + array( + $this->module->_prefix_st.'GALLERY_PLAY_TEXT_COLOR_'.$this->contr => [ + 'title' => $this->l('Play" text color'), + 'validation' => 'isColor', + 'type' => 'color', + 'size' => 5, + 'name' => $this->module->_prefix_st.'GALLERY_PLAY_TEXT_COLOR_'.$this->contr, + ], + $this->module->_prefix_st.'GALLERY_PLAY_TEXT_BG_'.$this->contr => [ + 'title' => $this->l('Play" text background'), + 'validation' => 'isColor', + 'type' => 'color', + 'size' => 5, + 'name' => $this->module->_prefix_st.'GALLERY_PLAY_TEXT_BG_'.$this->contr, + ], + ), + 'submit' => array('title' => $this->l('Save all')), + ), + 'close_style' => array( + 'title' => $this->l('Close button style'), + 'icon' => 'icon-cogs', + 'fields' => array( + $this->module->_prefix_st.'GALLERY_CLOSE_BTN_POSITION_'.$this->contr => [ + 'type' => 'radio', + 'cast' => 'intval', + 'title' => $this->l('Position'), + 'validation' => 'isUnsignedInt', + 'choices' => array( + 0 => $this->l('Center'), + 1 => $this->l('Top left'), + 2 => $this->l('Top right'), + 3 => $this->l('Bottom right'), + 4 => $this->l('Bottom left'), + ), + ], + $this->module->_prefix_st.'GALLERY_CLOSE_BTN_OFFSET_X_'.$this->contr => [ + 'title' => $this->l('Offset x'), + 'validation' => 'isUnsignedInt', + 'cast' => 'intval', + 'type' => 'text', + 'suffix' => $this->l('pixels'), + ], + $this->module->_prefix_st.'GALLERY_CLOSE_BTN_OFFSET_Y_'.$this->contr => [ + 'title' => $this->l('Offset y'), + 'validation' => 'isUnsignedInt', + 'cast' => 'intval', + 'type' => 'text', + 'suffix' => $this->l('pixels'), + ], + ) + $this->module->getButtonFiledsOptions('GALLERY_CLOSE', '_'.$this->contr), + 'submit' => array('title' => $this->l('Save all')), + ), + 'play_icon_style' => array( + 'title' => $this->l('Play icon style'), + 'icon' => 'icon-cogs', + 'fields' => $play_icon_fields, + 'submit' => array('title' => $this->l('Save all')), + ), + ); + } + + public function postProcess() + { + parent::postProcess(); + } + public function setMedia($isNewTheme = false) + { + parent::setMedia($isNewTheme); + $this->addCss(_MODULE_DIR_.$this->module->name.'/views/css/admin.css'); + $this->addJs(_MODULE_DIR_.$this->module->name.'/views/js/admin.js?108'); + } +} diff --git a/modules/steasyvideo/controllers/admin/AdminStEasyVideoListController.php b/modules/steasyvideo/controllers/admin/AdminStEasyVideoListController.php new file mode 100644 index 00000000..973943bc --- /dev/null +++ b/modules/steasyvideo/controllers/admin/AdminStEasyVideoListController.php @@ -0,0 +1,576 @@ + +* @copyright Since 2007 PrestaShop SA and Contributors +* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) +*/ + +if (!defined('_PS_VERSION_')) { + exit; +} +class AdminStEasyVideoListController extends ModuleAdminController +{ + protected $spacer_size = '5'; + protected $contr = ''; + public function __construct() + { + $this->bootstrap = true; + $this->table = 'st_easy_video'; + $this->className = 'StEasyVideoClass'; + $this->lang = false; + $this->addRowAction('edit'); + $this->addRowAction('delete'); + + if (Shop::isFeatureActive()) { + Shop::addTableAssociation($this->table, array('type' => 'shop')); + } + + parent::__construct(); + + $this->bulk_actions = array( + 'delete' => array( + 'text' => $this->trans('Delete selected', array(), 'Modules.StEasyVideo.Admin'), + 'icon' => 'icon-trash', + 'confirm' => $this->trans('Delete selected items?', array(), 'Modules.StEasyVideo.Admin'), + ) + ); + + if (!file_exists(_PS_IMG_DIR_.'/steasyvideo')) { + @mkdir(_PS_IMG_DIR_.'/steasyvideo', 0775, true) + || @chmod(_PS_IMG_DIR_.'/steasyvideo', 0775); + } + + $this->fieldImageSettings = [ + 'name' => 'thumbnail', + 'dir' => 'steasyvideo', + ]; + + $this->fields_list = array( + 'id_st_easy_video' => array( + 'title' => $this->trans('ID', array(), 'Modules.StEasyVideo.Admin'), + 'class' => 'fixed-width-xs' + ), + 'url' => array( + 'title' => $this->l('Url'), + 'type' => 'text', + 'search' => false, + 'orderby' => false, + 'class' => 'fixed-width-xl', + ), + 'name' => array( + 'title' => $this->l('Name'), + 'width' => 140, + 'type' => 'text', + 'search' => false, + 'orderby' => false, + ), + 'id_product' => array( + 'title' => $this->l('Add to'), + 'width' => 140, + 'type' => 'text', + 'callback' => 'displayAddTo', + 'search' => false, + 'orderby' => false, + 'class' => 'fixed-width-xl', + ), + 'id_category' => array( + 'title' => $this->l('Language'), + 'width' => 140, + 'type' => 'text', + 'callback' => 'displayYuyan', + 'search' => false, + 'orderby' => false, + 'class' => 'fixed-width-xs', + ), + 'autoplay' => array( + 'title' => $this->trans('Autoplay', array(), 'Modules.StEasyVideo.Admin'), + 'type' => 'text', + 'callback' => 'displayState', + 'orderby' => false, + 'class' => 'fixed-width-md', + ), + 'muted' => array( + 'title' => $this->trans('Muted', array(), 'Modules.StEasyVideo.Admin'), + 'type' => 'text', + 'callback' => 'displayState', + 'orderby' => false, + 'class' => 'fixed-width-md', + ), + 'loop' => array( + 'title' => $this->trans('Loop', array(), 'Modules.StEasyVideo.Admin'), + 'type' => 'text', + 'callback' => 'displayState', + 'orderby' => false, + 'class' => 'fixed-width-md', + ), + 'active' => array( + 'title' => $this->trans('Status', array(), 'Modules.StEasyVideo.Admin'), + 'active' => 'status', + 'type' => 'bool', + 'orderby' => false, + 'class' => 'fixed-width-md', + ), + ); + + $this->_where = $this->addWhere(); + $this->_orderBy = 'id_st_easy_video'; + $this->_orderWay = 'DESC'; + + + if (Tools::isSubmit('ajax_product_list')) { + $this->getAjaxProductsList(); + } + + Media::addJsDefL('stsb_comfirmation_msg', $this->trans('Are you sure?', array(), 'Modules.StEasyVideo.Admin')); + } + + public function postProcess() + { + if (Tools::getValue('deletethumbnail')) { + if (file_exists(_PS_IMG_DIR_.'/steasyvideo/'.(int)Tools::getValue('id_st_easy_video').'.jpg') + && !unlink(_PS_IMG_DIR_.'/steasyvideo/'.(int)Tools::getValue('id_st_easy_video').'.jpg')) { + $this->context->controller->errors[] = $this->trans('Error while delete', array(), 'Admin.Notifications.Error'); + } + Tools::redirectAdmin(self::$currentIndex.'&conf=7&' . $this->identifier . '='.(int)Tools::getValue('id_st_easy_video').'&update' . $this->table . '&token=' . $this->token); + } + return parent::postProcess(); + } + public function setMedia($isNewTheme = false) + { + parent::setMedia($isNewTheme); + $this->addJqueryPlugin(array('autocomplete')); + $this->addJs(_MODULE_DIR_.$this->module->name.'/views/js/admin.js?108'); + } + public function displayState($value, $tr) + { + $arr = array( + '0' => $this->l('No'), + '1' => $this->l('Yes'), + '2' => $this->l('Default'), + ); + return array_key_exists($value, $arr) ? $arr[$value] : ''; + } + public function displayYuyan($value, $tr) + { + $res = ''; + $yuyuan = StEasyVideoYuyanClass::getByVideo($tr['id_st_easy_video']); + if ($yuyuan && is_array($yuyuan)) { + $all_languages = Language::getLanguages(false); + foreach ($yuyuan as $y) { + foreach ($all_languages as $language) { + if ($y['id_lang'] == $language['id_lang']) { + $res .= $language['name']; + break; + } + } + } + } else { + $res = $this->l('All'); + } + return $res; + } + public function displayAddTo($value, $tr) + { + $name = ''; + if ($tr['id_category'] > 0) { + $category = new Category($tr['id_category'], Context::getContext()->language->id); + if (Validate::isLoadedObject($category)) { + $name .= $category->name; + } + } elseif ($tr['id_product'] != '') { + $products = Db::getInstance()->executeS('SELECT id_product,name from `'._DB_PREFIX_.'product_lang` WHERE id_product IN ('.trim($tr['id_product'], ',').') AND id_lang='.Context::getContext()->language->id.' AND id_shop='.Context::getContext()->shop->id); + if ($products && is_array($products)) { + foreach ($products as $key => $val) { + if ($key == 0) { + $name .= ''.$val['name']; + } else { + $name .= '
'.$val['name']; + } + + } + } + + } elseif ($tr['id_manufacturer'] > 0) { + $manufacturer = new Manufacturer($tr['id_manufacturer'], Context::getContext()->language->id); + if (Validate::isLoadedObject($manufacturer)) { + $name .= $manufacturer->name; + } + } + return $name; + } + public function renderForm() + { + if (!($obj = $this->loadObject(true))) { + return; + } + + $image = _PS_IMG_DIR_ . $this->fieldImageSettings['dir'] . '/' . $obj->id . '.jpg'; + $image_size = false; + $image_tag = ''; + if (file_exists($image)) { + $image_size = filesize($image) / 1000; + $image_url = _PS_IMG_ . $this->fieldImageSettings['dir'] . '/' . $obj->id . '.jpg'; + $image_tag = ''; + } + + Media::addJsDef(array( + '_currentIndex' => $this->context->link->getAdminLink('AdminModules'), + '_token' => Tools::getAdminTokenLite('AdminModules') + )); + + $this->fields_form = array( + 'tinymce' => true, + 'legend' => array( + 'title' => $this->l('Add a video'), + 'icon' => 'icon-tags', + ), + 'input' => array( + array( + 'type' => 'text', + 'label' => $this->l('Video url:'), + 'name' => 'url', + 'default_value' => '', + 'class' => 'fixed-width-xxl', + 'required' => true, + 'desc' => array( + $this->l('Url of a .mp4 file or a youtube url or a vimeo url.'), + $this->l('You can upload mp4 files to your site via FTP, another way is using the text editor at the bottom of this page to upload videos to your site to get urls.'), + '
' + ), + ), + array( + 'type' => 'textarea', + 'label' => $this->l('For uploading videos:'), + 'name' => 'for_uploading_videos', + 'desc' => $this->l('You can use the video button in the text editor to upload videos to your site to get their urls.'), + 'autoload_rte' => 'rte', + ), + array( + 'type' => 'radio', + 'label' => $this->l('Display on:'), + 'name' => 'location', + 'is_bool' => false, + 'default_value' => 0, + 'values' => array( + array( + 'id' => 'location_0', + 'value' => 0, + 'label' => $this->l('All'), + ), + array( + 'id' => 'location_1', + 'value' => 1, + 'label' => $this->l('Main gallery on the product page'), + ), + array( + 'id' => 'location_2', + 'value' => 2, + 'label' => $this->l('Product miniature on the product listing pages'), + ), + array( + 'id' => 'location_3', + 'value' => 3, + 'label' => $this->l('Product miniatures'), + ), + ), + 'validation' => 'isUnsignedInt', + ), + array( + 'type' => 'text', + 'label' => $this->l('Name:'), + 'name' => 'name', + 'size' => 64, + 'desc' => $this->l('As a reminder, show on backoffice only.'), + ), + array( + 'type' => 'switch', + 'label' => $this->l('Use youtube thumbnail if it is a youtube video.'), + 'name' => 'online_thumbnail', + 'is_bool' => true, + 'default_value' => 1, + 'values' => array( + array( + 'id' => 'online_thumbnail_on', + 'value' => 1, + 'label' => $this->l('Enabled') + ), + array( + 'id' => 'online_thumbnail_off', + 'value' => 0, + 'label' => $this->l('Disabled') + ) + ), + ), + 'thumbnail' => array( + 'type' => 'file', + 'label' => $this->l('Custom thumbnail:'), + 'name' => 'thumbnail', + 'display_image' => true, + 'image' => $image_tag ? $image_tag : false, + 'size' => $image_size, + 'delete_url' => self::$currentIndex.'&deletethumbnail=1&' . $this->identifier . '='.(int)$obj->id.'&update' . $this->table . '&token=' . $this->token, + ), + + array( + 'type' => 'radio', + 'label' => $this->l('Autoplay:'), + 'name' => 'autoplay', + 'is_bool' => false, + 'default_value' => 2, + 'values' => array( + array( + 'id' => 'autoplay_on', + 'value' => 1, + 'label' => $this->l('Yes'), + ), + array( + 'id' => 'autoplay_off', + 'value' => 0, + 'label' => $this->l('No'), + ), + array( + 'id' => 'autoplay_default', + 'value' => 2, + 'label' => $this->l('Use default'), + ), + ), + 'validation' => 'isUnsignedInt', + 'desc' => array( + $this->l('This option is NOT a guarantee that your video will autoplay.'), + $this->l('This option would not take effect if videos are put to the end of thumbnail gallery.'), + $this->l('Check the description of this module on sunnytoo.com for more info.'), + ), + ), + array( + 'type' => 'radio', + 'label' => $this->l('Loop:'), + 'name' => 'loop', + 'default_value' => 2, + 'values' => array( + array( + 'id' => 'loop_on', + 'value' => 1, + 'label' => $this->l('Yes'), + ), + array( + 'id' => 'loop_off', + 'value' => 0, + 'label' => $this->l('No'), + ), + /*array( + 'id' => 'loop_no', + 'value' => 3, + 'label' => $this->l('No, close player after a video ends'), + ),*/ + array( + 'id' => 'loop_default', + 'value' => 2, + 'label' => $this->l('Use default'), + ), + ), + 'validation' => 'isUnsignedInt', + ), + array( + 'type' => 'radio', + 'label' => $this->l('Muted:'), + 'name' => 'muted', + 'is_bool' => true, + 'default_value' => 2, + 'values' => array( + array( + 'id' => 'muted_on', + 'value' => 1, + 'label' => $this->l('Yes'), + ), + array( + 'id' => 'muted_off', + 'value' => 0, + 'label' => $this->l('No'), + ), + array( + 'id' => 'muted_default', + 'value' => 2, + 'label' => $this->l('Use default'), + ), + ), + 'validation' => 'isUnsignedInt', + ), + array( + 'type' => 'text', + 'label' => $this->l('Aspect ratio:'), + 'name' => 'ratio', + 'size' => 64, + 'desc' => $this->l('Generally, the video ratio should be the same as the product images. But if the vidoe ratio is different, then you can force the video to display at a specific ratio, use one of the values 16:9, 4:3, 9:16, 1:1.'), + ), + array( + 'type' => 'switch', + 'label' => $this->l('Status:'), + 'name' => 'active', + 'is_bool' => true, + 'default_value' => 1, + 'values' => array( + array( + 'id' => 'active_on', + 'value' => 1, + 'label' => $this->l('Enabled') + ), + array( + 'id' => 'active_off', + 'value' => 0, + 'label' => $this->l('Disabled') + ) + ), + ), + array( + 'type' => 'checkbox', + 'label' => $this->l('Language:'), + 'name' => 'id_lang', + 'values' => array( + 'query' => $this->getAllLanguages(), + 'id' => 'id', + 'name' => 'name', + ), + 'desc' => $this->l('It will show out on all languages if you don\'t select any.'), + + ), + array( + 'type' => 'text', + 'label' => $this->l('Position:'), + 'name' => 'position', + 'default_value' => 0, + 'class' => 'fixed-width-sm' + ), + ), + 'buttons' => array( + array( + 'title' => $this->l('Save all'), + 'class' => 'btn btn-default pull-right', + 'icon' => 'process-icon-save', + 'type' => 'submit' + ) + ), + 'submit' => array( + 'title' => $this->l('Save and stay'), + 'stay' => true + ), + ); + + + if (Shop::isFeatureActive()) { + $this->fields_form['input'][] = array( + 'type' => 'shop', + 'label' => $this->l('Shop association:'), + 'name' => 'checkBoxShopAsso', + ); + } + + if (method_exists($this, 'filterFormFields')) { + $this->filterFormFields($this->fields_form, $obj); + } + + return parent::renderForm(); + } + public function getFieldsValue($obj) + { + foreach ($this->fields_form as $fieldset) { + if (isset($fieldset['form']['input'])) { + foreach ($fieldset['form']['input'] as $input) { + if (!isset($this->fields_value[$input['name']])) { + if (isset($input['type']) && $input['type'] == 'shop') { + if ($obj->id) { + $result = Shop::getShopById((int) $obj->id, $this->identifier, $this->table); + foreach ($result as $row) { + $this->fields_value['shop'][$row['id_' . $input['type']]][] = $row['id_shop']; + } + } + } elseif (isset($input['name']) && $input['name']=='id_lang') { + $lang_obj_data= StEasyVideoClass::get_lang_obj_data($obj->id); + foreach ($this->getAllLanguages() as $language) { + if(in_array($language['id'],$lang_obj_data)){ + $this->fields_value['id_lang_'.$language['id']]=$language['id']; + } elseif (count($lang_obj_data) == 1 && $lang_obj_data[0] == 0) { + $this->fields_value['id_lang_'.$language['id']]=$language['id']; + } + } + + } else { + $field_value = $this->getFieldValue($obj, $input['name']); + if ($field_value === false && isset($input['default_value'])) { + $field_value = $input['default_value']; + } + $this->fields_value[$input['name']] = $field_value; + } + } + } + } + } + + return $this->fields_value; + } + protected function copyFromPost(&$object, $table) + { + parent::copyFromPost($object, $table); + if ($this->contr == 'product') { + if ($ids = Tools::getValue('st_id_product')) { + $object->id_product = ','.implode(',', $ids).','; + } else { + $this->errors[] = $this->l('Please select products.'); + } + $object->id_category = 0; + $object->id_manufacturer = 0; + } elseif ($this->contr == 'category') { + $object->id_product = ''; + $object->id_manufacturer = 0; + if (!$object->id_category) { + $this->errors[] = $this->l('Please select a category.'); + } + } elseif ($this->contr == 'manufacturer') { + $object->id_category = 0; + $object->id_product = ''; + if (!$object->id_manufacturer) { + $this->errors[] = $this->l('Please select a manufacturer.'); + } + } else { + $this->errors[] = $this->l('Where do you want to add the video.'); + } + } + + public function afterAdd($object) + { + return $this->updateAssoLang($object->id); + } + public function afterUpdate($object) + { + return $this->updateAssoLang($object->id); + } + public function updateAssoLang($id, $lang = []) + { + StEasyVideoYuyanClass::deleteByVideo($id); + $lang_arr = array(); + $all_languages = Language::getLanguages(false); + foreach ($all_languages as $lang) { + if (Tools::getValue('id_lang_'.$lang['id_lang'])) { + $lang_arr[] = $lang['id_lang']; + } + } + $res = true; + if (count($lang_arr) && count($lang_arr) < count($all_languages)) { + $res = StEasyVideoYuyanClass::changeVideoYuyan($id, $lang_arr); + }else{ + $res = StEasyVideoYuyanClass::changeVideoYuyan($id, [0]); + } + return $res; + } + public function getAllLanguages() + { + $lang_list = Language::getLanguages(false); + $new = []; + foreach ($lang_list as $val) { + $new[] = [ + 'id' => $val['id_lang'], + 'name' => $val['name'] + ]; + } + return $new; + } +} diff --git a/modules/steasyvideo/controllers/admin/AdminStEasyVideoManufacturerController.php b/modules/steasyvideo/controllers/admin/AdminStEasyVideoManufacturerController.php new file mode 100644 index 00000000..2cbcda09 --- /dev/null +++ b/modules/steasyvideo/controllers/admin/AdminStEasyVideoManufacturerController.php @@ -0,0 +1,49 @@ + +* @copyright Since 2007 PrestaShop SA and Contributors +* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) +*/ + +if (!defined('_PS_VERSION_')) { + exit; +} +require_once dirname(__FILE__) . '/AdminStEasyVideoListController.php'; +class AdminStEasyVideoManufacturerController extends AdminStEasyVideoListController +{ + protected $contr = 'manufacturer'; + public function addWhere($where = '') + { + return $where.' AND id_product=\'\' AND id_category=0 AND id_manufacturer!=0 '; + } + public function filterFormFields(&$fileds, $obj) + { + array_splice($fileds['input'], 1, 0, array( + array( + 'type' => 'select', + 'label' => $this->l('Select a manufacture:'), + 'required' => true, + 'name' => 'id_manufacturer', + 'class' => 'fixed-width-xxl', + 'options' => array( + 'query' => $this->getApplyManufacture(), + 'id' => 'id', + 'name' => 'name', + 'default' => array( + 'value' => '', + 'label' => $this->l('Please select') + ) + ), + ), + )); + } + public function getApplyManufacture() + { + $manufacturer_arr = array(); + $manufacturers = Manufacturer::getManufacturers(false, $this->context->language->id); + foreach ($manufacturers as $manufacturer) { + $manufacturer_arr[] = array('id' => $manufacturer['id_manufacturer'],'name' => $manufacturer['name']); + } + return $manufacturer_arr; + } +} diff --git a/modules/steasyvideo/controllers/admin/AdminStEasyVideoMiniatureBaseController.php b/modules/steasyvideo/controllers/admin/AdminStEasyVideoMiniatureBaseController.php new file mode 100644 index 00000000..a551a5ac --- /dev/null +++ b/modules/steasyvideo/controllers/admin/AdminStEasyVideoMiniatureBaseController.php @@ -0,0 +1,317 @@ + +* @copyright Since 2007 PrestaShop SA and Contributors +* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) +*/ + +if (!defined('_PS_VERSION_')) { + exit; +} +class AdminStEasyVideoMiniatureBaseController extends ModuleAdminController +{ + protected $contr = ''; + public function __construct() + { + $this->bootstrap = true; + parent::__construct(); + + $image_types_arr = array( + array('id' => '','name' => $this->l('Use the predefined value.'),) + ); + $imagesTypes = ImageType::getImagesTypes('products'); + foreach ($imagesTypes as $k => $imageType) { + if (Tools::substr($imageType['name'], -3) == '_2x') { + continue; + } + $image_types_arr[] = array('id' => $imageType['name'], 'name' => $imageType['name'].'('.$imageType['width'].'x'.$imageType['height'].')'); + } + $display_options = array( + 0 => $this->l('No'), + 1 => $this->l('Buttons'), + 2 => $this->l('Video players'), + 3 => $this->l('Play on hover'), + 4 => $this->l('Show buttons, play on hover'), + ); + if($this->contr=='MOBILE') + unset($display_options[3], $display_options[4]); + $this->fields_options = array( + 'general' => array( + 'title' => $this->l('General Settings'), + 'icon' => 'icon-cogs', + 'fields' => array( + $this->module->_prefix_st.'MINIATURE_DISPLAY_'.$this->contr => array( + 'type' => 'radio', + 'cast' => 'intval', + 'title' => $this->l('How to display videos'), + 'validation' => 'isUnsignedInt', + 'choices' => $display_options, + ), + $this->module->_prefix_st.'MINIATURE_VIDEO_SELECTOR_'.$this->contr => array( + 'type' => 'text', + 'title' => $this->l('Video selector'), + 'validation' => 'isAnything', + 'desc' => $this->l('A slector inside the miniature.'), + ), + $this->module->_prefix_st.'MINIATURE_VIDEO_APPEND_'.$this->contr => [ + 'title' => $this->l('How to add videos'), + 'cast' => 'intval', + 'type' => 'select', + 'identifier' => 'id', + 'list' => $this->module::$_appends, + ], + $this->module->_prefix_st.'MINIATURE_VIDEO_POSITION_'.$this->contr => [ + 'type' => 'radio', + 'cast' => 'intval', + 'title' => $this->l('How to display players'), + 'validation' => 'isUnsignedInt', + 'choices' => array( + 0 => $this->l('Display on an element (Position: absolute)'), + 1 => $this->l('Normal document flow (Position: static)'), + ), + ], + $this->module->_prefix_st.'MINIATURE_BUTTON_SELECTOR_'.$this->contr => array( + 'type' => 'text', + 'title' => $this->l('Button selector'), + 'validation' => 'isAnything', + 'desc' => $this->l('A slector inside the miniature.'), + ), + $this->module->_prefix_st.'MINIATURE_BUTTON_APPEND_'.$this->contr => [ + 'title' => $this->l('How to add buttons'), + 'cast' => 'intval', + 'type' => 'select', + 'identifier' => 'id', + 'list' => $this->module::$_appends, + ], + $this->module->_prefix_st.'MINIATURE_BUTTON_POSITION_'.$this->contr => [ + 'type' => 'radio', + 'cast' => 'intval', + 'title' => $this->l('How to display buttons'), + 'validation' => 'isUnsignedInt', + 'choices' => array( + 0 => $this->l('Display on an element (Position: absolute)'), + 1 => $this->l('Normal document flow (Position: static)'), + ), + ], + $this->module->_prefix_st.'MINIATURE_BUTTON_LAYOUT_'.$this->contr => array( + 'type' => 'radio', + 'cast' => 'intval', + 'title' => $this->l('Play button layout'), + 'validation' => 'isUnsignedInt', + 'choices' => array( + 0 => $this->l('Icon'), + 1 => $this->l('Text'), + 2 => $this->l('Icon + text horizontally'), + 3 => $this->l('Icon + text vertically'), + ), + ), + $this->module->_prefix_st.'MINIATURE_BUTTON_HIDE_'.$this->contr => array( + 'title' => $this->l('Hide the play button when videos start play'), + 'validation' => 'isBool', + 'type' => 'bool', + 'is_bool' => true, + ), + $this->module->_prefix_st.'MINIATURE_SELECTOR_'.$this->contr => array( + 'type' => 'text', + 'title' => $this->l('Miniature selector'), + 'validation' => 'isAnything', + 'desc' => $this->l('The default value .js-product-miniature works for amolst all sites'), + ), + $this->module->_prefix_st.'MINIATURE_VIDEO_TEMPLATE_'.$this->contr => [ + 'title' => $this->l('Video template'), + 'validation' => 'isAnything', + 'type' => 'textarea', + 'cols' => 30, + 'rows' => 5, + 'desc' => array( + $this->l('They are four variables you can use: @placeholder_url@, @placeholder_width@, @placeholder_height@, and @thumbnail_url@.'), + $this->l('Disable the "Use HTMLPurifier Library" setting on the "BO>Preferences>General" page, otherwise the value won\'t be saved.'), + ), + ], + $this->module->_prefix_st.'MINIATURE_VIDEO_IMAGE_TYPE_'.$this->contr => [ + 'title' => $this->l('Placeholder image for videos'), + 'validation' => 'isAnything', + 'required' => false, + 'type' => 'select', + 'list' => $image_types_arr, + 'identifier' => 'id', + ], + $this->module->_prefix_st.'MINIATURE_BUTTON_TEMPLATE_'.$this->contr => [ + 'title' => $this->l('Button template'), + 'validation' => 'isAnything', + 'type' => 'textarea', + 'cols' => 30, + 'rows' => 5, + 'desc' => array( + $this->l('They are four variables you can use: @placeholder_url@, @placeholder_width@, @placeholder_height@, and @thumbnail_url@.'), + $this->l('Disable the "Use HTMLPurifier Library" setting on the "BO>Preferences>General" page, otherwise the value won\'t be saved.'), + ), + ], + $this->module->_prefix_st.'MINIATURE_BUTTON_IMAGE_TYPE_'.$this->contr => [ + 'title' => $this->l('Placeholder image for buttons'), + 'validation' => 'isAnything', + 'required' => false, + 'type' => 'select', + 'list' => $image_types_arr, + 'identifier' => 'id', + ], + $this->module->_prefix_st.'MINIATURE_VIDEO_ZINDEX_'.$this->contr => [ + 'title' => $this->l('Z-index:'), + 'validation' => 'isUnsignedId', + 'required' => false, + 'cast' => 'intval', + 'type' => 'text', + ], + $this->module->_prefix_st.'MINIATURE_POINTER_EVENTS_NONE_'.$this->contr => array( + 'title' => $this->l('Link to the product page'), + 'validation' => 'isBool', + 'type' => 'bool', + 'is_bool' => true, + 'desc' => $this->l('In most cases, clicking on the video goes to the product page without enabling this setting. But if that\'s not your case, then enable this setting may help.'), + ), + ), + 'submit' => array('title' => $this->l('Save all')), + ), + 'player' => array( + 'title' => $this->l('Player'), + 'icon' => 'icon-cogs', + 'fields' => array( + $this->module->_prefix_st.'MINIATURE_AUTOPLAY_'.$this->contr => array( + 'title' => $this->l('Autoplay'), + 'validation' => 'isBool', + 'type' => 'bool', + 'is_bool' => true, + 'desc' => $this->l('When videos are displayed in video palyers'), + ), + $this->module->_prefix_st.'MINIATURE_MUTED_'.$this->contr => array( + 'title' => $this->l('Muted'), + 'validation' => 'isBool', + 'type' => 'bool', + 'is_bool' => true, + 'desc' => $this->l('Only muted videos can be autoplay'), + ), + $this->module->_prefix_st.'MINIATURE_LOOP_'.$this->contr => array( + 'title' => $this->l('Loop'), + 'validation' => 'isBool', + 'type' => 'bool', + 'is_bool' => true, + ), + $this->module->_prefix_st.'MINIATURE_CONTROLS_'.$this->contr => array( + 'title' => $this->l('Show controls'), + 'validation' => 'isBool', + 'type' => 'bool', + 'is_bool' => true, + ), + ), + 'submit' => array('title' => $this->l('Save all')), + ), + 'player_style' => array( + 'title' => $this->l('Player style'), + 'icon' => 'icon-cogs', + 'fields' => array( + $this->module->_prefix_st.'MINIATURE_PLAYER_BG_'.$this->contr => [ + 'title' => $this->l('Color'), + 'validation' => 'isColor', + 'type' => 'color', + 'size' => 5, + 'name' => $this->module->_prefix_st.'MINIATURE_PLAYER_BG_'.$this->contr, + ], + ), + 'submit' => array('title' => $this->l('Save all')), + ), + 'button_style' => array( + 'title' => $this->l('Play button style'), + 'icon' => 'icon-cogs', + 'fields' => array( + $this->module->_prefix_st.'MINIATURE_PLAY_BTN_POSITION_'.$this->contr => [ + 'type' => 'radio', + 'cast' => 'intval', + 'title' => $this->l('Position'), + 'validation' => 'isUnsignedInt', + 'choices' => array( + 0 => $this->l('Center'), + 1 => $this->l('Top left'), + 2 => $this->l('Top right'), + 3 => $this->l('Bottom right'), + 4 => $this->l('Bottom left'), + ), + ], + $this->module->_prefix_st.'MINIATURE_PLAY_BTN_OFFSET_X_'.$this->contr => [ + 'title' => $this->l('Offset x'), + 'validation' => 'isUnsignedInt', + 'cast' => 'intval', + 'type' => 'text', + 'suffix' => $this->l('pixels'), + ], + $this->module->_prefix_st.'MINIATURE_PLAY_BTN_OFFSET_Y_'.$this->contr => [ + 'title' => $this->l('Offset y'), + 'validation' => 'isUnsignedInt', + 'cast' => 'intval', + 'type' => 'text', + 'suffix' => $this->l('pixels'), + ], + ) + $this->module->getButtonFiledsOptions('MINIATURE_PLAY', '_'.$this->contr) + array( + $this->module->_prefix_st.'MINIATURE_PLAY_TEXT_COLOR_'.$this->contr => [ + 'title' => $this->l('"Play" text color'), + 'validation' => 'isColor', + 'type' => 'color', + 'size' => 5, + 'name' => $this->module->_prefix_st.'MINIATURE_PLAY_TEXT_COLOR_'.$this->contr, + ], + $this->module->_prefix_st.'MINIATURE_PLAY_TEXT_BG_'.$this->contr => [ + 'title' => $this->l('"Play" text background'), + 'validation' => 'isColor', + 'type' => 'color', + 'size' => 5, + 'name' => $this->module->_prefix_st.'MINIATURE_PLAY_TEXT_BG_'.$this->contr, + ], + ), + 'submit' => array('title' => $this->l('Save all')), + ), + 'close_style' => array( + 'title' => $this->l('Close button style'), + 'icon' => 'icon-cogs', + 'fields' => array( + $this->module->_prefix_st.'MINIATURE_CLOSE_BTN_POSITION_'.$this->contr => [ + 'type' => 'radio', + 'cast' => 'intval', + 'title' => $this->l('Position'), + 'validation' => 'isUnsignedInt', + 'choices' => array( + 0 => $this->l('Center'), + 1 => $this->l('Top left'), + 2 => $this->l('Top right'), + 3 => $this->l('Bottom right'), + 4 => $this->l('Bottom left'), + ), + ], + $this->module->_prefix_st.'MINIATURE_CLOSE_BTN_OFFSET_X_'.$this->contr => [ + 'title' => $this->l('Offset x'), + 'validation' => 'isUnsignedInt', + 'cast' => 'intval', + 'type' => 'text', + 'suffix' => $this->l('pixels'), + ], + $this->module->_prefix_st.'MINIATURE_CLOSE_BTN_OFFSET_Y_'.$this->contr => [ + 'title' => $this->l('Offset y'), + 'validation' => 'isUnsignedInt', + 'cast' => 'intval', + 'type' => 'text', + 'suffix' => $this->l('pixels'), + ], + ) + $this->module->getButtonFiledsOptions('MINIATURE_CLOSE', '_'.$this->contr), + 'submit' => array('title' => $this->l('Save all')), + ), + ); + } + + public function postProcess() + { + parent::postProcess(); + } + public function setMedia($isNewTheme = false) + { + parent::setMedia($isNewTheme); + $this->addJs(_MODULE_DIR_.$this->module->name.'/views/js/admin.js?108'); + } +} diff --git a/modules/steasyvideo/controllers/admin/AdminStEasyVideoMiniatureController.php b/modules/steasyvideo/controllers/admin/AdminStEasyVideoMiniatureController.php new file mode 100644 index 00000000..5b177192 --- /dev/null +++ b/modules/steasyvideo/controllers/admin/AdminStEasyVideoMiniatureController.php @@ -0,0 +1,37 @@ + +* @copyright Since 2007 PrestaShop SA and Contributors +* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) +*/ + +if (!defined('_PS_VERSION_')) { + exit; +} +require_once dirname(__FILE__) . '/AdminStEasyVideoMiniatureBaseController.php'; +class AdminStEasyVideoMiniatureController extends AdminStEasyVideoMiniatureBaseController +{ + protected $contr = 'DESKTOP'; + + public function __construct() + { + parent::__construct(); + + $this->fields_options['general']['fields'] = $this->fields_options['general']['fields'] + array( + $this->module->_prefix_st.'MINIATURE_HOVER_ELEMENT' => array( + 'type' => 'text', + 'title' => $this->l('Play the video when this selector is on hover'), + 'validation' => 'isAnything', + ), + ); + } + + public function updateOptionStEasyVideoMiniatureVideoTemplateDesktop($val) + { + Configuration::updateValue($this->module->_prefix_st.'MINIATURE_VIDEO_TEMPLATE_DESKTOP', $val, true); + } + public function updateOptionStEasyVideoMiniatureButtonTemplateDesktop($val) + { + Configuration::updateValue($this->module->_prefix_st.'MINIATURE_BUTTON_TEMPLATE_DESKTOP', $val, true); + } +} diff --git a/modules/steasyvideo/controllers/admin/AdminStEasyVideoMiniatureMobileController.php b/modules/steasyvideo/controllers/admin/AdminStEasyVideoMiniatureMobileController.php new file mode 100644 index 00000000..94768eb4 --- /dev/null +++ b/modules/steasyvideo/controllers/admin/AdminStEasyVideoMiniatureMobileController.php @@ -0,0 +1,23 @@ + +* @copyright Since 2007 PrestaShop SA and Contributors +* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) +*/ + +if (!defined('_PS_VERSION_')) { + exit; +} +require_once dirname(__FILE__) . '/AdminStEasyVideoMiniatureBaseController.php'; +class AdminStEasyVideoMiniatureMobileController extends AdminStEasyVideoMiniatureBaseController +{ + protected $contr = 'MOBILE'; + public function updateOptionStEasyVideoMiniatureVideoTemplateMobile($val) + { + Configuration::updateValue($this->module->_prefix_st.'MINIATURE_VIDEO_TEMPLATE_MOBILE', $val, true); + } + public function updateOptionStEasyVideoMiniatureButtonTemplateMobile($val) + { + Configuration::updateValue($this->module->_prefix_st.'MINIATURE_BUTTON_TEMPLATE_MOBILE', $val, true); + } +} diff --git a/modules/steasyvideo/controllers/admin/AdminStEasyVideoProductController.php b/modules/steasyvideo/controllers/admin/AdminStEasyVideoProductController.php new file mode 100644 index 00000000..a145890a --- /dev/null +++ b/modules/steasyvideo/controllers/admin/AdminStEasyVideoProductController.php @@ -0,0 +1,168 @@ + +* @copyright Since 2007 PrestaShop SA and Contributors +* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) +*/ + +if (!defined('_PS_VERSION_')) { + exit; +} +require_once dirname(__FILE__) . '/AdminStEasyVideoListController.php'; +class AdminStEasyVideoProductController extends AdminStEasyVideoListController +{ + protected $contr = 'product'; + public function addWhere($where = '') + { + return $where.' AND id_product!=\'\' AND id_category=0 AND id_manufacturer=0 '; + } + public function filterFormFields(&$fileds, $obj) + { + $products_html = ''; + if (($id_product = (int)Tools::getValue('id_product')) && Tools::getValue('ref') == 'product') { + $obj->id_product = (int)$id_product; + } + foreach (explode(',', trim($obj->id_product, ',')) as $id_product) { + if (!(int)$id_product) { + continue; + } + $product = new Product((int)$id_product, false, $this->context->language->id); + $products_html .= '
  • '.$product->name.'['.$product->reference.'] + +
  • '; + } + + array_splice($fileds['input'], 1, 0, array( + 'products' => array( + 'type' => 'text', + 'label' => $this->l('Products:'), + 'name' => 'ac_products', + 'autocomplete' => false, + 'required' => true, + 'class' => 'fixed-width-xxl ac_products', + 'desc' => $this->l('Enter product names here:').'
    '.$this->l('Selected products') + .': ', + ), + )); + } + public function getAjaxProductsList() + { + $query = Tools::getValue('q', false); + if (!$query || $query == '' || strlen($query) < 1) { + die(); + } + if ($pos = strpos($query, ' (ref:')) { + $query = substr($query, 0, $pos); + } + + $excludeIds = Tools::getValue('excludeIds', false); + if ($excludeIds && $excludeIds != 'NaN') { + $excludeIds = implode(',', array_map('intval', explode(',', $excludeIds))); + } else { + $excludeIds = ''; + } + + // Excluding downloadable products from packs because download from pack is not supported + $forceJson = Tools::getValue('forceJson', false); + $disableCombination = Tools::getValue('disableCombination', false); + $excludeVirtuals = (bool)Tools::getValue('excludeVirtuals', true); + $exclude_packs = (bool)Tools::getValue('exclude_packs', false); + + $context = Context::getContext(); + + $sql = 'SELECT p.`id_product`, pl.`link_rewrite`, p.`reference`, pl.`name`, image_shop.`id_image` id_image, il.`legend`, p.`cache_default_attribute` + FROM `'._DB_PREFIX_.'product` p + '.Shop::addSqlAssociation('product', 'p').' + LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.id_product = p.id_product AND pl.id_lang = '.(int)$context->language->id.Shop::addSqlRestrictionOnLang('pl').') + LEFT JOIN `'._DB_PREFIX_.'image_shop` image_shop + ON (image_shop.`id_product` = p.`id_product` AND image_shop.cover=1 AND image_shop.id_shop='.(int)$context->shop->id.') + LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (image_shop.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$context->language->id.') + WHERE (pl.name LIKE \'%'.pSQL($query).'%\' OR p.reference LIKE \'%'.pSQL($query).'%\')'. + (!empty($excludeIds) ? ' AND p.id_product NOT IN ('.$excludeIds.') ' : ' '). + ($excludeVirtuals ? 'AND NOT EXISTS (SELECT 1 FROM `'._DB_PREFIX_.'product_download` pd WHERE (pd.id_product = p.id_product))' : ''). + ($exclude_packs ? 'AND (p.cache_is_pack IS NULL OR p.cache_is_pack = 0)' : ''). + ' GROUP BY p.id_product'; + + $items = Db::getInstance()->executeS($sql); + + if ($items && ($disableCombination || $excludeIds)) { + $results = []; + foreach ($items as $item) { + if (!$forceJson) { + $item['name'] = str_replace('|', '|', $item['name']); + $results[] = trim($item['name']).(!empty($item['reference']) ? ' (ref: '.$item['reference'].')' : '').'|'.(int)($item['id_product']); + } else { + $results[] = array( + 'id' => $item['id_product'], + 'name' => $item['name'].(!empty($item['reference']) ? ' (ref: '.$item['reference'].')' : ''), + 'ref' => (!empty($item['reference']) ? $item['reference'] : ''), + 'image' => str_replace('http://', Tools::getShopProtocol(), $context->link->getImageLink($item['link_rewrite'], $item['id_image'], 'home'.'_'.'default')), + ); + } + } + + if (!$forceJson) { + echo implode("\n", $results); + } else { + echo json_encode($results); + } + } elseif ($items) { + // packs + $results = array(); + foreach ($items as $item) { + // check if product have combination + if (Combination::isFeatureActive() && $item['cache_default_attribute']) { + $sql = 'SELECT pa.`id_product_attribute`, pa.`reference`, ag.`id_attribute_group`, pai.`id_image`, agl.`name` AS group_name, al.`name` AS attribute_name, + a.`id_attribute` + FROM `'._DB_PREFIX_.'product_attribute` pa + '.Shop::addSqlAssociation('product_attribute', 'pa').' + LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON pac.`id_product_attribute` = pa.`id_product_attribute` + LEFT JOIN `'._DB_PREFIX_.'attribute` a ON a.`id_attribute` = pac.`id_attribute` + LEFT JOIN `'._DB_PREFIX_.'attribute_group` ag ON ag.`id_attribute_group` = a.`id_attribute_group` + LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al ON (a.`id_attribute` = al.`id_attribute` AND al.`id_lang` = '.(int)$context->language->id.') + LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang` agl ON (ag.`id_attribute_group` = agl.`id_attribute_group` AND agl.`id_lang` = '.(int)$context->language->id.') + LEFT JOIN `'._DB_PREFIX_.'product_attribute_image` pai ON pai.`id_product_attribute` = pa.`id_product_attribute` + WHERE pa.`id_product` = '.(int)$item['id_product'].' + GROUP BY pa.`id_product_attribute`, ag.`id_attribute_group` + ORDER BY pa.`id_product_attribute`'; + + $combinations = Db::getInstance()->executeS($sql); + if (!empty($combinations)) { + foreach ($combinations as $k => $combination) { + $results[$combination['id_product_attribute']]['id'] = $item['id_product']; + $results[$combination['id_product_attribute']]['id_product_attribute'] = $combination['id_product_attribute']; + !empty($results[$combination['id_product_attribute']]['name']) ? $results[$combination['id_product_attribute']]['name'] .= ' '.$combination['group_name'].'-'.$combination['attribute_name'] + : $results[$combination['id_product_attribute']]['name'] = $item['name'].' '.$combination['group_name'].'-'.$combination['attribute_name']; + if (!empty($combination['reference'])) { + $results[$combination['id_product_attribute']]['ref'] = $combination['reference']; + } else { + $results[$combination['id_product_attribute']]['ref'] = !empty($item['reference']) ? $item['reference'] : ''; + } + if (empty($results[$combination['id_product_attribute']]['image'])) { + $results[$combination['id_product_attribute']]['image'] = str_replace('http://', Tools::getShopProtocol(), $context->link->getImageLink($item['link_rewrite'], $combination['id_image'], 'home'.'_'.'default')); + } + } + } else { + $results[] = array( + 'id' => $item['id_product'], + 'name' => $item['name'], + 'ref' => (!empty($item['reference']) ? $item['reference'] : ''), + 'image' => str_replace('http://', Tools::getShopProtocol(), $context->link->getImageLink($item['link_rewrite'], $item['id_image'], 'home'.'_'.'default')), + ); + } + } else { + $results[] = array( + 'id' => $item['id_product'], + 'name' => $item['name'], + 'ref' => (!empty($item['reference']) ? $item['reference'] : ''), + 'image' => str_replace('http://', Tools::getShopProtocol(), $context->link->getImageLink($item['link_rewrite'], $item['id_image'], 'home'.'_'.'default')), + ); + } + } + echo json_encode(array_values($results)); + } else { + echo json_encode([]); + } + die; + } +} diff --git a/modules/steasyvideo/controllers/admin/AdminStEasyVideoProductMobileSettingController.php b/modules/steasyvideo/controllers/admin/AdminStEasyVideoProductMobileSettingController.php new file mode 100644 index 00000000..53299ae9 --- /dev/null +++ b/modules/steasyvideo/controllers/admin/AdminStEasyVideoProductMobileSettingController.php @@ -0,0 +1,24 @@ + +* @copyright Since 2007 PrestaShop SA and Contributors +* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) +*/ + +if (!defined('_PS_VERSION_')) { + exit; +} +require_once dirname(__FILE__) . '/AdminStEasyVideoGalleryController.php'; +class AdminStEasyVideoProductMobileSettingController extends AdminStEasyVideoGalleryController +{ + protected $contr = 'MOBILE'; + + public function updateOptionStEasyVideoGalleryVideoTemplateMobile($val) + { + Configuration::updateValue($this->module->_prefix_st.'GALLERY_VIDEO_TEMPLATE_MOBILE', $val, true); + } + public function updateOptionStEasyVideoGalleryButtonTemplateMobile($val) + { + Configuration::updateValue($this->module->_prefix_st.'GALLERY_BUTTON_TEMPLATE_MOBILE', $val, true); + } +} diff --git a/modules/steasyvideo/controllers/admin/AdminStEasyVideoProductSettingController.php b/modules/steasyvideo/controllers/admin/AdminStEasyVideoProductSettingController.php new file mode 100644 index 00000000..fb3544af --- /dev/null +++ b/modules/steasyvideo/controllers/admin/AdminStEasyVideoProductSettingController.php @@ -0,0 +1,24 @@ + +* @copyright Since 2007 PrestaShop SA and Contributors +* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) +*/ + +if (!defined('_PS_VERSION_')) { + exit; +} +require_once dirname(__FILE__) . '/AdminStEasyVideoGalleryController.php'; +class AdminStEasyVideoProductSettingController extends AdminStEasyVideoGalleryController +{ + protected $contr = 'DESKTOP'; + + public function updateOptionStEasyVideoGalleryVideoTemplateDesktop($val) + { + Configuration::updateValue($this->module->_prefix_st.'GALLERY_VIDEO_TEMPLATE_DESKTOP', $val, true); + } + public function updateOptionStEasyVideoGalleryButtonTemplateDesktop($val) + { + Configuration::updateValue($this->module->_prefix_st.'GALLERY_BUTTON_TEMPLATE_DESKTOP', $val, true); + } +} diff --git a/modules/steasyvideo/controllers/admin/AdminStEasyVideoQuickViewSettingController.php b/modules/steasyvideo/controllers/admin/AdminStEasyVideoQuickViewSettingController.php new file mode 100644 index 00000000..4a6442e3 --- /dev/null +++ b/modules/steasyvideo/controllers/admin/AdminStEasyVideoQuickViewSettingController.php @@ -0,0 +1,23 @@ + +* @copyright Since 2007 PrestaShop SA and Contributors +* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) +*/ + +if (!defined('_PS_VERSION_')) { + exit; +} +require_once dirname(__FILE__) . '/AdminStEasyVideoGalleryController.php'; +class AdminStEasyVideoQuickViewSettingController extends AdminStEasyVideoGalleryController +{ + protected $contr = 'QUICKVIEW'; + public function updateOptionStEasyVideoGalleryVideoTemplateQuickView($val) + { + Configuration::updateValue($this->module->_prefix_st.'GALLERY_VIDEO_TEMPLATE_QUICKVIEW', $val, true); + } + public function updateOptionStEasyVideoGalleryButtonTemplateQuickView($val) + { + Configuration::updateValue($this->module->_prefix_st.'GALLERY_BUTTON_TEMPLATE_QUICKVIEW', $val, true); + } +} diff --git a/modules/steasyvideo/controllers/admin/AdminStEasyVideoSettingController.php b/modules/steasyvideo/controllers/admin/AdminStEasyVideoSettingController.php new file mode 100644 index 00000000..01ae291f --- /dev/null +++ b/modules/steasyvideo/controllers/admin/AdminStEasyVideoSettingController.php @@ -0,0 +1,188 @@ + +* @copyright Since 2007 PrestaShop SA and Contributors +* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) +*/ + +if (!defined('_PS_VERSION_')) { + exit; +} +class AdminStEasyVideoSettingController extends ModuleAdminController +{ + public function __construct() + { + $this->bootstrap = true; + parent::__construct(); + + $this->fields_options = array( + 'general' => array( + 'title' => $this->l('General Settings'), + 'icon' => 'icon-cogs', + 'fields' => array( + $this->module->_prefix_st.'THEME_NAME' => array( + 'type' => 'radio', + 'title' => $this->l('Theme name:'), + 'validation' => 'isGenericName', + 'choices' => array( + '' => $this->l('Auto detect'), + 'classic' => $this->l('PrestaShop 1.7 classic'), + 'panda' => $this->l('Panda theme v2'), + 'transformer' => $this->l('Transformer theme v4'), + 'warehouse' => $this->l('Warehouse for 1.7'), + ), + 'desc' => $this->l('Select a theme to use its predefined settings.'), + ), + $this->module->_prefix_st.'MAXIMUM_TRIES' => [ + 'title' => $this->l('Maximum times of detecting if the gallery slider is initialized on the product page.'), + 'validation' => 'isUnsignedId', + 'required' => false, + 'cast' => 'intval', + 'type' => 'text', + ], + $this->module->_prefix_st.'PLAY_VIDEO_TEXT' => [ + 'title' => $this->l('"Play video" text'), + 'size' => 6, + 'type' => 'textLang', + ], + $this->module->_prefix_st.'YOUTUBE_API' => array( + 'title' => $this->l('Stop loading YouTube api'), + 'validation' => 'isBool', + 'type' => 'bool', + 'is_bool' => true, + 'desc' => $this->l('If you aren\'t going to use any youtube videos, stop loading the YouTube api for better performace.'), + ), + $this->module->_prefix_st.'VIMEO_API' => array( + 'title' => $this->l('Stop loading Vimeo api'), + 'validation' => 'isBool', + 'type' => 'bool', + 'is_bool' => true, + 'desc' => $this->l('If you aren\'t going to use any vimeo videos, stop loading the vimeo api for better performace.'), + ), + $this->module->_prefix_st.'BREAKPOINT' => array( + 'type' => 'text', + 'title' => $this->l('Mobile device breakpoint'), + 'validation' => 'isUnsignedInt', + 'cast' => 'intval', + 'desc' => $this->l('If the gallery displays in different ways on mobile, then set the breakpoint here to use different settings on mobile.'), + ), + ), + 'submit' => array('title' => $this->l('Save all')), + ), + 'player' => array( + 'title' => $this->l('Player'), + 'icon' => 'icon-cogs', + 'fields' => array( + $this->module->_prefix_st.'PLAYER_SKIN' => array( + 'title' => $this->l('Skin'), + 'cast' => 'intval', + 'type' => 'select', + 'identifier' => 'id', + 'list' => array( + 0 => array( + 'id' => 0, + 'name' => 'Sublime', + ), + 1 => array( + 'id' => 1, + 'name' => 'OGZ', + ), + 2 => array( + 'id' => 2, + 'name' => 'Youtube', + ), + 3 => array( + 'id' => 3, + 'name' => 'Facebook', + ), + ), + ), + + $this->module->_prefix_st.'BG_COLOR' => array( + 'title' => $this->l('Control bar background'), + 'validation' => 'isColor', + 'type' => 'color', + 'size' => 5, + 'name' => $this->module->_prefix_st.'BG_COLOR', + ), + + $this->module->_prefix_st.'BG_OPACITY' => [ + 'title' => $this->l('Control bar background opacity'), + 'validation' => 'isFloat', + 'cast' => 'floatval', + 'type' => 'text', + 'desc' => $this->l('From 0.0 (fully transparent) to 1.0 (fully opaque).'), + ], + $this->module->_prefix_st.'CONTROL_COLOR' => array( + 'title' => $this->l('Buttons color'), + 'validation' => 'isColor', + 'type' => 'color', + 'size' => 5, + 'name' => $this->module->_prefix_st.'CONTROL_COLOR', + ), + $this->module->_prefix_st.'CONTROL_SIZE' => [ + 'title' => $this->l('Buttons size'), + 'validation' => 'isUnsignedInt', + 'cast' => 'intval', + 'type' => 'text', + 'suffix' => $this->l('pixels'), + ], + $this->module->_prefix_st.'PROGRESS_BAR_COLOR' => array( + 'title' => $this->l('Progress bar color'), + 'validation' => 'isColor', + 'type' => 'color', + 'size' => 5, + 'name' => $this->module->_prefix_st.'PROGRESS_BAR_COLOR', + ), + $this->module->_prefix_st.'PROGRESS_BAR_OPACITY' => [ + 'title' => $this->l('Progress bar opacity'), + 'validation' => 'isFloat', + 'cast' => 'floatval', + 'type' => 'text', + 'desc' => $this->l('From 0.0 (fully transparent) to 1.0 (fully opaque).'), + ], + $this->module->_prefix_st.'PROGRESS_BAR_HIGHLIGHT_COLOR' => array( + 'title' => $this->l('Progress bar highlighted color'), + 'validation' => 'isColor', + 'type' => 'color', + 'size' => 5, + 'name' => $this->module->_prefix_st.'PROGRESS_BAR_HIGHLIGHT_COLOR', + ), + + ), + 'submit' => array('title' => $this->l('Save all')), + ), + 'player_play_button' => array( + 'title' => $this->l('Player\'s play button'), + 'icon' => 'icon-cogs', + 'fields' => $this->module->getButtonFiledsOptions('PLAYER_PLAY'), + 'submit' => array('title' => $this->l('Save all')), + ), + 'player_close_button' => array( + 'title' => $this->l('Player\'s close button'), + 'icon' => 'icon-cogs', + 'fields' => $this->module->getButtonFiledsOptions('PLAYER_CLOSE'), + 'submit' => array('title' => $this->l('Save all')), + ), + 'style' => array( + 'title' => $this->l('Style'), + 'icon' => 'icon-cogs', + 'fields' => array( + $this->module->_prefix_st.'CUSTOM_CSS' => [ + 'title' => $this->l('Custom CSS Code'), + 'validation' => 'isAnything', + 'type' => 'textarea', + 'cols' => 30, + 'rows' => 5, + ], + ), + 'submit' => array('title' => $this->l('Save all')), + ), + ); + } + public function updateOptionStEasyVideoCustomCss($val) + { + Configuration::updateValue($this->module->_prefix_st.'CUSTOM_CSS', $val, true); + } + +} diff --git a/modules/steasyvideo/controllers/admin/index.php b/modules/steasyvideo/controllers/admin/index.php new file mode 100644 index 00000000..b36c776a --- /dev/null +++ b/modules/steasyvideo/controllers/admin/index.php @@ -0,0 +1,34 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/modules/steasyvideo/controllers/front/ajax.php b/modules/steasyvideo/controllers/front/ajax.php new file mode 100644 index 00000000..0f6caa9a --- /dev/null +++ b/modules/steasyvideo/controllers/front/ajax.php @@ -0,0 +1,22 @@ + +* @copyright Since 2007 PrestaShop SA and Contributors +* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) +*/ +if (!defined('_PS_VERSION_')) { + exit; +} + +class StEasyVideoAjaxModuleFrontController extends ModuleFrontController +{ + public function initContent() + { + $id_product = (int)Tools::getValue('id_product'); + $product = new Product($id_product, false, Configuration::get('PS_LANG_DEFAULT'), $this->context->shop->id); + $video_data = $this->module->getVideosByProduct($product); + ob_end_clean(); + header('Content-Type: application/json'); + die(json_encode($video_data)); + } +} diff --git a/modules/steasyvideo/controllers/front/index.php b/modules/steasyvideo/controllers/front/index.php new file mode 100644 index 00000000..b36c776a --- /dev/null +++ b/modules/steasyvideo/controllers/front/index.php @@ -0,0 +1,34 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/modules/steasyvideo/controllers/index.php b/modules/steasyvideo/controllers/index.php new file mode 100644 index 00000000..b36c776a --- /dev/null +++ b/modules/steasyvideo/controllers/index.php @@ -0,0 +1,34 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/modules/steasyvideo/index.php b/modules/steasyvideo/index.php new file mode 100644 index 00000000..76cd9dd3 --- /dev/null +++ b/modules/steasyvideo/index.php @@ -0,0 +1,35 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/modules/steasyvideo/logo.png b/modules/steasyvideo/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..c834d45a50214fa32d5496aa146fc7e7fd83109d GIT binary patch literal 5681 zcmbVQXH-+$wx)MTC`v#|0uhiJN+=Pem#6_mI#NOsIs`(1&<$0QCISLdRX`C@R79Gf z^mYL0MWlB@x+uttr`&gc+;QI+Z;!qAnrrR(eRHl^e(ZJI)Yy=ng`b6rii#a+q-RDM z6MsKU43u|8llCRbz(>@#CSJ$85QESJ9F;Z}?~DT@z0s~XGaMQl?AM7?r=p^DaW}Un zTBEKaFnDiS^lu$mlD97fO+}@yN%BQwJaI&@GtSlBM?++*u2BT+j@1ycf}>z4UtOG= zyHN-McRj?|924S+QNxO8UIMF=5EKG$91#sBd3*WzBS;z|fAS(I^6zCi5%8ZXL{ANo zznrp0nSyok1RNMHt0;qk$;*S4m1X6X;L6JK(qILcyn-Bzax2ToDu|P`Xc1yf`Wo%gA`@)1XnqEH8r*09103D6b%{wU>_oyB;(^R z`VWI1&L2Z?_a(aHeZapN(a!h)qJ{{?)4#Uh?TbSFi`d8i??6#PCPza1%E`;Zf&dB{Pj(;nbf0if}_*?u}=~E{EY95>qrDF(`)<9d^BB`jj z&`3RPbJD~{Ua&9EXkL5c;AelND1`iu=){dl1{(V#7WXTu=kE|Coxaru<~{$+Q{_xn8A$3-!yi7f;?sfVi0|Ue#2x)69=eon?TKQ=u21~on_Zm~9|6*3I%{!nb3Zy4QL_N?=l-;vPT_?0LFwJbQgSn07Frk=(5Cb&^=QB&gVZy~9;iS9_%m)(q-oI*Wn+CrY4Yx4DTdZ!Az zApnx)VB_Uwj9V`|pRxPkP+#O*tj@RC=5O@T!1iSNm4ev4WusB0!cs;LPpLgU5$}b* z5T!2ig>Xa|@Z32_k}v@6rSX`V8$6VB(-c|w^a&LcOvl1vIc_B^X9^HZtxZ=c1%f@y&Z@z2SUJ{itSr7 zGS$E|r6oTenxv^Iwnbk>vx0DjhS!SCZmZM_lxSBvnBgUWF_CR-bZ2Fq3U8rMx(o|t z#p|ZVc~M~tObhmPsR$x4bulff6nm4?U64I=(YhV}j7+(K*WMSoBF9+19tSfdq6I*uvbhT) zMWLJeE1PwL!%2*fQx{a5sY-$6Ijgg&&6_89=-*?Mbi?^N?4<2nBCNAuR3k2 zn@4Pg0^5_Mo+`it=2Q`m$AHHNUwg@I&u88Vf!2^8yE7s6&gUOw$mkC+f2bIB&^=C4 z0k7mdYe;$~zPU0KzHryjnn@DJ3?;v?sbVq1(AJJT7oU}!wZ+fdIbzN^e)BHW{CLqZ zV`?JxIr7^==aZ97M_ovvsawJ!G49EC>jF+1x_uwPFd#WkOP zx5KA%pEMV?&l}Yr3f1OE@NbW*Xw`*{Uq@e12n{@Y*4AOt!g(@+cXcAZpnr>HK(vD) z1Q~j9?#26r3QGM^4bVo{7j~dj?oR3VSY8f9&5d&;!d%!c9(4)|w?aswTsdyH)*?35 zI({D1G}`7UF_Yusyo#|03i+2qTHC}-@TqBsU-j2~6_JU&;Ckm+&r$|Dg*LL^Jn*7_ zZC^Pa^6dOiGGwR@5?NESmJn0CkgO>Z@QpiW^F~yE_@OpP{-b?xB2?a~Rx!U-7J%8x zgPLFAzOr1&iHPSu-Ew@iYiI(g41T@7^Pr=L&)wAgc}n~?9c=FnJ^DLSdd|>bDd))% zzgfa*mSDunS$c!yC?LyW2ruf;nnM?WENRcpd}1aX$+p;0$|QZ`);C&!R_$!uLx&X5 zZK_$|o6SunrI6WOP^bnQIaX-=TGyvVXxi46)-v}q&d9|xZoINQfUGr-KqAwwbdJvz zqgTVt-;c>@8gx$pssj>pjS+&KdBP>!^L3lfhMz97u$|mYlegMW3>v6c_Tzmjea@-p z2({4~X-MqlUx6yAvanH`msea4JwtOx4H`@X3L(~w0_5s#2Vfav2aK-E&Xlay-fc+j z|H5a@LZ8&2miVH+ZoNNd>}V{Dnm*(Mx>6IGQ4@ATG^{*~|3OHzH(7+$mZi%{6R)g2 zuSRUzo10Y?H=2a<{WwRDZ5xri{RiVp!pD;5-N?PMs)Tr97kdi+4#1nInU=GTA*LX9Q!vOgl-z_DIAA zaq6M;kmGF#Y0{f1(v@$0&+-lQ0SPp`v@a7%MnVf)oq<=f&bU+hTiWrDx0*bm_v$WB zvZl$K1l1Qd4mPUOvd#IWwG%Vk@;}||Pdi^upJF%CZJwrBRw+^Ql+UzhhJ@Bkl19Vt}I2~ z*$k=K0>p5}ebCRnL4g!!!vdN~@-^dp>6RF!i>;_KJ)!xm;(bG?<==EMWH|{E}87l(m9PSDd7VTs;#xQd-5HAj2Z0A zKw{hrmLD#|CT1KA%LGHDnZxo+&eY9smEM&1x-ETq@HHjs{p~LeVRe^ zu;_6QZCBUT&6=k2@%)K;A@565=Mv}~Ii&Mhkmj8!99p6(+7fNfxktUmIq5zj`K~#+ z#><0U;>1y|!1RXukBI@ZJB-3Fx0UNz*Q*w|S*E2XBLKRx=4#;;4lX_XQTA+nQ#GfQRGjDco`5j!*+5$xs>sDbOY(*GQcbif$wh!6iwfJ;t~s6y z+Tj_Tbd5)-zPF0X#O($dQzUx!{xKWRHK4aA^~$aIqRg?^=PUr1n2KJ#de@)os~c*R zd080ApDcUgXQCAF_4SlR12Au7+5YiU=RKp1FMx`VYoC$@Z=I~ZCjN3Jx8^pJ z7(mU=B_yKgE znrs{cnRhy8YLx?2R32e|9^_8xr*E(uCWnF!+R_wir%4#oQfMAKg6 zo%_XlVW+JouHvnXUFu^yJ~x~m6?$4r@XYm(!g;I4IotuTm>Bfv z>){r5G$|2lmG-G0H19ci;y=-hZD0$&S1GggaB_AzrJ(|Qh1I!02o*0X%7ZjBR?B;S z`O1f8kV9OJi5b5`$hJN-MR*y?7Pz_C50SVpyC_%eofCRN5@snEJ;Lf1I?HQ{K&Z0Q z_BNz;y_#l@Dy|M!dblKmaPTUqtdfAeA96mY0 z+kem{mCLbCIyy-$dlu@iHNQ%gem7oTyon8@$!r2W^0s@;uo#de%Fv&nIunU-o8UixvZEt#zPtBaZ!YLs!q6 zop0&R$^Q0z8z_>|V3@WVtC7~D*tExpY7%zJZyO!IJ>qyQAZ~Rk`mi9(>}^vFKfg6M z%dSm*o4lB@)_kq2_VfOJXcmpG1}c?`C-gL2;Plrc)w&45NnSIbozdYU!o(YC*v6YJ z!anRIg#SWbpDAnFW$l$Uo%M;T@6N-LZ+xb14HaKmyw{d`TtQgs*&Fz#45w*GYZ>PD z`OaIdb1&9#g}x(9QoF2y{eHE#?sEQT>1yVY(Nepn^svqK=GN*jaa#3vD!Y>-Ugl=i z- zy=8lQrZz6mx`|h4>|+nF0kl3c=Uw5{fdpz;g-YH}so!!MRBh?_SrzCgh1E6fqrq@o zV^CcR;K5`&a%Q}_`(UI2!-%NH8+O-LJ$dIRa_8spYZnMCP+Ic+0sIy{sjV)4>ZRTl z)`hpqd%3FQifG27R1f3TwU~+V){oGOZrRXc9*zm`7~`)$Jv})=aQ^0{Ud$+$hnL=> zDTicXgOcIMew4FEK(oeGO-NUL{=)>1iNXG)ewL@@Jj@A?ABU<21&O}J3)dRu`zJ?P zSj5f*%mW2flGC3geFF$5n_lNGbM2#fpbYo+!>WMiAqaqglWRvY0s(?PJqT<`7LK0q zQwz@`xU>x;b|pat2iS@E$4sUdc1~M5Bg2E&EdyQh%@x@!6kT3T4_eS|}SuwY41ENX>^gE%(oi-@%G)L{5x?>gnMCp zZo~;#ZXBOJ^6;wGmV8OuVViC85%6Pfl@PaH&EdsrRML1<66#5oD(A5OQlZCz*IbeT zBgZqvr8f-adlg%A7#&dBf2jiMFG z5^L^1ERT?aE#;P_FrRgjE(rNNHEN{T`_!$*(H+DcKMcOAWA(C<9HYwj`RAdom_ss+ zPAQ+xEb!;$Qo#*|wq0+7a&!X6*;w)tJm*QJq|T?uO0b-q!O`(G?^nS$YXYvy%BxXj zH9NoEs}3vJ(z~L#vgeAW?z~}Q{AefrBY%p4o!x*wAfV^Qy@0{$>vvMl58iKMNtRs! z64Q7*b&?M&r$M{o6F1xH4KVw#rBsZUOBdsnh-;*%wYo-0B@pgh$qhsPZZPl3SDF^?Y&Q$91Si|KnV?GY2jYQO>i`w$nYZ>(3L;}rEj&(1Xq literal 0 HcmV?d00001 diff --git a/modules/steasyvideo/src/Repository/VideoRepository.php b/modules/steasyvideo/src/Repository/VideoRepository.php new file mode 100644 index 00000000..b50928f8 --- /dev/null +++ b/modules/steasyvideo/src/Repository/VideoRepository.php @@ -0,0 +1,39 @@ + +* @copyright Since 2007 PrestaShop SA and Contributors +* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) +*/ + +namespace PrestaShop\Module\StEasyVideo\Repository; + +if (!defined('_PS_VERSION_')) { + exit; +} + +use PrestaShop\PrestaShop\Adapter\LegacyContext; +use Db; +use Context; +use Tools; +use Shop; +use ProductListingFrontController; + +require_once _PS_MODULE_DIR_ . '/steasyvideo/classes/StEasyVideoClass.php'; +require_once _PS_MODULE_DIR_ . '/steasyvideo/classes/EasyVideoBase.php'; + +class VideoRepository +{ + private $context; + + public function __construct( + LegacyContext $context + ) { + $this->context = $context->getContext(); + } + + public function getListingVideo($product) + { + $videos = \EasyVideoBase::getVideosByProduct($product['id_product'], $this->context->controller instanceof ProductListingFrontController ? [0,2,3] : [0,3], 1, $product['link_rewrite']); + return $videos && count($videos) ? array_pop($videos) : false; + } +} diff --git a/modules/steasyvideo/src/Repository/index.php b/modules/steasyvideo/src/Repository/index.php new file mode 100644 index 00000000..03f4b267 --- /dev/null +++ b/modules/steasyvideo/src/Repository/index.php @@ -0,0 +1,34 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/modules/steasyvideo/src/index.php b/modules/steasyvideo/src/index.php new file mode 100644 index 00000000..45df26c5 --- /dev/null +++ b/modules/steasyvideo/src/index.php @@ -0,0 +1,34 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) + */ +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../'); +exit; diff --git a/modules/steasyvideo/steasyvideo.php b/modules/steasyvideo/steasyvideo.php new file mode 100644 index 00000000..f149b3c7 --- /dev/null +++ b/modules/steasyvideo/steasyvideo.php @@ -0,0 +1,1021 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +if (!defined('_PS_VERSION_')) { + exit; +} + +include_once(dirname(__FILE__).'/classes/StEasyVideoClass.php'); +include_once(dirname(__FILE__).'/classes/StEasyVideoYuyanClass.php'); +include_once(dirname(__FILE__).'/classes/EasyVideoBase.php'); + +class StEasyVideo extends Module +{ + private $_html = ''; + public $fields_form; + public $fields_value; + private $spacer_size = '5'; + public $_prefix_st = 'ST_EASY_VIDEO_'; + public $validation_errors = array(); + private static $video_position = array(); + private static $_bo_menu = array( + array( + 'class_name' => 'AdminParentStEasyVideo', + 'name' => 'Product videos', + 'tab' => 'IMPROVE', + 'active' => 1, + 'icon' => 'play_arrow', + ), + array( + 'class_name' => 'AdminStEasyVideoLieBiao', + 'name' => 'Videos', + 'tab' => 'AdminParentStEasyVideo', + 'active' => 1, + ), + array( + 'class_name' => 'AdminStEasyVideoProduct', + 'name' => 'Product', + 'tab' => 'AdminStEasyVideoLieBiao', + 'active' => 1, + ), + array( + 'class_name' => 'AdminStEasyVideoCategory', + 'name' => 'Category', + 'tab' => 'AdminStEasyVideoLieBiao', + 'active' => 1, + ), + array( + 'class_name' => 'AdminStEasyVideoManufacturer', + 'name' => 'Brand', + 'tab' => 'AdminStEasyVideoLieBiao', + 'active' => 1, + ), + array( + 'class_name' => 'AdminStEasyVideoPeiZhi', + 'name' => 'Settings', + 'tab' => 'AdminParentStEasyVideo', + 'active' => 1, + ), + array( + 'class_name' => 'AdminStEasyVideoSetting', + 'name' => 'General', + 'tab' => 'AdminStEasyVideoPeiZhi', + 'active' => 1, + ), + array( + 'class_name' => 'AdminStEasyVideoMiniature', + 'name' => 'Miniature', + 'tab' => 'AdminStEasyVideoPeiZhi', + 'active' => 1, + ), + array( + 'class_name' => 'AdminStEasyVideoMiniatureMobile', + 'name' => 'Miniature on Mobile', + 'tab' => 'AdminStEasyVideoPeiZhi', + 'active' => 1, + ), + array( + 'class_name' => 'AdminStEasyVideoProductSetting', + 'name' => 'Product Page', + 'tab' => 'AdminStEasyVideoPeiZhi', + 'active' => 1, + ), + array( + 'class_name' => 'AdminStEasyVideoProductMobileSetting', + 'name' => 'Product Page (Mobile)', + 'tab' => 'AdminStEasyVideoPeiZhi', + 'active' => 1, + ), + array( + 'class_name' => 'AdminStEasyVideoQuickViewSetting', + 'name' => 'Quick View', + 'tab' => 'AdminStEasyVideoPeiZhi', + 'active' => 1, + ), + ); + + public static $_appends = array( + 0 => array( + 'id' => 0, + 'name' => 'append', + ), + 1 => array( + 'id' => 1, + 'name' => 'before', + ), + 2 => array( + 'id' => 2, + 'name' => 'after', + ), + 3 => array( + 'id' => 3, + 'name' => 'prepend', + ), + 4 => array( + 'id' => 4, + 'name' => 'parent append', + ), + 5 => array( + 'id' => 5, + 'name' => 'parent before', + ), + 6 => array( + 'id' => 6, + 'name' => 'parent after', + ), + 7 => array( + 'id' => 7, + 'name' => 'parent prepend', + ), + 8 => array( + 'id' => 8, + 'name' => 'parent parent append', + ), + 9 => array( + 'id' => 9, + 'name' => 'parent parent before', + ), + 10 => array( + 'id' => 10, + 'name' => 'parent parent after', + ), + 11 => array( + 'id' => 11, + 'name' => 'parent parent prepend', + ), + 12 => array( + 'id' => 12, + 'name' => 'html', + ), + ); + public function __construct() + { + $this->name = 'steasyvideo'; + $this->tab = 'front_office_features'; + $this->version = '1.2.3'; + $this->author = 'ST THEMES'; + $this->module_key = '29305c4dbfaf92c4baf89df2dff337db'; + $this->need_instance = 0; + $this->bootstrap = true; + parent::__construct(); + + $this->displayName = $this->l('Easy product video module'); + $this->description = $this->l('Using a fancy way to display self-hosted videos or youtube videos for products.'); + $this->ps_versions_compliancy = array('min' => '1.7', 'max' => _PS_VERSION_); + + self::$video_position = array( + 1 => array( + 'id' => 1, + 'name' => $this->l('Top left') + ), + 2 => array( + 'id' => 2, + 'name' => $this->l('Top center') + ), + 3 => array( + 'id' => 3, + 'name' => $this->l('Top right') + ), + 4 => array( + 'id' => 4, + 'name' => $this->l('Center left') + ), + /*5 => array( + 'id' => 5, + 'name' => $this->l('Center center') + ),*/ + 6 => array( + 'id' => 6, + 'name' => $this->l('Center right') + ), + 7 => array( + 'id' => 7, + 'name' => $this->l('Bottom left') + ), + 8 => array( + 'id' => 8, + 'name' => $this->l('Bottom center') + ), + 9 => array( + 'id' => 9, + 'name' => $this->l('Bottom right') + ), + ); + + } + + public function install() + { + if (!parent::install() + || !$this->installDB() + || !$this->installTab() + // || !$this->registerHook('actionProductDelete') to do + || !$this->registerHook('displayHeader') + || !$this->registerHook('displayProductListReviews') + || !$this->registerHook('displayAdminProductsExtra') + || !$this->registerHook('displayProductAdditionalInfo') + || !$this->registerHook('displayBeforeBodyClosingTag') + || !Configuration::updateValue($this->_prefix_st.'THEME_NAME', '') + || !Configuration::updateValue($this->_prefix_st.'PLAYER_SKIN', 1) + || !Configuration::updateValue($this->_prefix_st.'CUSTOM_CSS', '') + || !Configuration::updateValue($this->_prefix_st.'YOUTUBE_API', 0) + || !Configuration::updateValue($this->_prefix_st.'VIMEO_API', 1) + || !Configuration::updateValue($this->_prefix_st.'BREAKPOINT', 0) + || !Configuration::updateValue($this->_prefix_st.'MAXIMUM_TRIES', 10) + || !Configuration::updateValue($this->_prefix_st.'MINIATURE_HOVER_ELEMENT', '') + ) { + return false; + } + + $languages = Language::getLanguages(); + $play_video_text = array(); + foreach ($languages as $language) { + $play_video_text[$language['id_lang']] = 'Play'; + } + Configuration::updateValue($this->_prefix_st.'PLAY_VIDEO_TEXT', $play_video_text, true); + + $res = true; + foreach (EasyVideoBase::$device as $kl => $ku) { + if (!Configuration::updateValue($this->_prefix_st.'GALLERY_DISPLAY_'.$ku, $ku == 'DESKTOP' ? 1 : 0) + || !Configuration::updateValue($this->_prefix_st.'GALLERY_VIDEO_SELECTOR_'.$ku, '') + || !Configuration::updateValue($this->_prefix_st.'GALLERY_VIDEO_APPEND_'.$ku, 0) + || !Configuration::updateValue($this->_prefix_st.'GALLERY_VIDEO_POSITION_'.$ku, 0) + || !Configuration::updateValue($this->_prefix_st.'GALLERY_BUTTON_SELECTOR_'.$ku, '') + || !Configuration::updateValue($this->_prefix_st.'GALLERY_BUTTON_APPEND_'.$ku, 0) + || !Configuration::updateValue($this->_prefix_st.'GALLERY_BUTTON_POSITION_'.$ku, 0) + || !Configuration::updateValue($this->_prefix_st.'GALLERY_BUTTON_LAYOUT_'.$ku, 0) + || !Configuration::updateValue($this->_prefix_st.'GALLERY_BUTTON_HIDE_'.$ku, 1) + || !Configuration::updateValue($this->_prefix_st.'GALLERY_CLOSE_VIDEO_'.$ku, 0) + || !Configuration::updateValue($this->_prefix_st.'GALLERY_TYPE_'.$ku, 0) + || !Configuration::updateValue($this->_prefix_st.'GALLERY_THUMBNAIL_TYPE_'.$ku, 0) + || !Configuration::updateValue($this->_prefix_st.'GALLERY_SLIDER_APPEND_'.$ku, 0) + || !Configuration::updateValue($this->_prefix_st.'GALLERY_SLIDER_SELECTOR_'.$ku, '') + || !Configuration::updateValue($this->_prefix_st.'GALLERY_THUMBNAIL_SELECTOR_'.$ku, '') + || !Configuration::updateValue($this->_prefix_st.'GALLERY_THUMBNAIL_ITEM_SELECTOR_'.$ku, '') + || !Configuration::updateValue($this->_prefix_st.'GALLERY_THUMBNAIL_APPEND_'.$ku, '') + || !Configuration::updateValue($this->_prefix_st.'GALLERY_VIDEO_TEMPLATE_'.$ku, '') + || !Configuration::updateValue($this->_prefix_st.'GALLERY_VIDEO_IMAGE_TYPE_'.$ku, '') + || !Configuration::updateValue($this->_prefix_st.'GALLERY_BUTTON_TEMPLATE_'.$ku, '') + || !Configuration::updateValue($this->_prefix_st.'GALLERY_BUTTON_IMAGE_TYPE_'.$ku, '') + || !Configuration::updateValue($this->_prefix_st.'GALLERY_AUTOPLAY_'.$ku, 1) + || !Configuration::updateValue($this->_prefix_st.'GALLERY_MUTED_'.$ku, 1) + || !Configuration::updateValue($this->_prefix_st.'GALLERY_LOOP_'.$ku, 1) + || !Configuration::updateValue($this->_prefix_st.'GALLERY_CONTROLS_'.$ku, 1) + + || !Configuration::updateValue($this->_prefix_st.'GALLERY_VIDEO_ZINDEX_'.$ku, 0) + + || !Configuration::updateValue($this->_prefix_st.'GALLERY_PLAY_BTN_POSITION_'.$ku, 0) + || !Configuration::updateValue($this->_prefix_st.'GALLERY_PLAY_BTN_OFFSET_X_'.$ku, 0) + || !Configuration::updateValue($this->_prefix_st.'GALLERY_PLAY_BTN_OFFSET_Y_'.$ku, 0) + || !Configuration::updateValue($this->_prefix_st.'GALLERY_PLAY_TEXT_COLOR_'.$ku, '') + || !Configuration::updateValue($this->_prefix_st.'GALLERY_PLAY_TEXT_BG_'.$ku, '') + || !Configuration::updateValue($this->_prefix_st.'GALLERY_CLOSE_BTN_POSITION_'.$ku, 2) + || !Configuration::updateValue($this->_prefix_st.'GALLERY_CLOSE_BTN_OFFSET_X_'.$ku, 0) + || !Configuration::updateValue($this->_prefix_st.'GALLERY_CLOSE_BTN_OFFSET_Y_'.$ku, 0) + ) { + $res &= false; + } + if(!$this->installBtn(['GALLERY_PLAY', 'PLAY_ICON', 'GALLERY_CLOSE'], '_'.$ku)) + $res &= false; + + if($kl=='quickview') + continue; + if(!Configuration::updateValue($this->_prefix_st.'MINIATURE_DISPLAY_'.$ku, 2) + || !Configuration::updateValue($this->_prefix_st.'MINIATURE_SELECTOR_'.$ku, '.js-product-miniature') + || !Configuration::updateValue($this->_prefix_st.'MINIATURE_VIDEO_SELECTOR_'.$ku, '') + || !Configuration::updateValue($this->_prefix_st.'MINIATURE_VIDEO_APPEND_'.$ku, 0) + || !Configuration::updateValue($this->_prefix_st.'MINIATURE_VIDEO_POSITION_'.$ku, 0) + || !Configuration::updateValue($this->_prefix_st.'MINIATURE_BUTTON_SELECTOR_'.$ku, '') + || !Configuration::updateValue($this->_prefix_st.'MINIATURE_BUTTON_APPEND_'.$ku, 0) + || !Configuration::updateValue($this->_prefix_st.'MINIATURE_BUTTON_POSITION_'.$ku, 0) + || !Configuration::updateValue($this->_prefix_st.'MINIATURE_BUTTON_LAYOUT_'.$ku, 0) + || !Configuration::updateValue($this->_prefix_st.'MINIATURE_BUTTON_HIDE_'.$ku, 1) + || !Configuration::updateValue($this->_prefix_st.'MINIATURE_AUTOPLAY_'.$ku, 1) + || !Configuration::updateValue($this->_prefix_st.'MINIATURE_MUTED_'.$ku, 1) + || !Configuration::updateValue($this->_prefix_st.'MINIATURE_LOOP_'.$ku, 1) + || !Configuration::updateValue($this->_prefix_st.'MINIATURE_CONTROLS_'.$ku, 0) + || !Configuration::updateValue($this->_prefix_st.'MINIATURE_VIDEO_TEMPLATE_'.$ku, '') + || !Configuration::updateValue($this->_prefix_st.'MINIATURE_VIDEO_IMAGE_TYPE_'.$ku, '') + || !Configuration::updateValue($this->_prefix_st.'MINIATURE_BUTTON_TEMPLATE_'.$ku, '') + || !Configuration::updateValue($this->_prefix_st.'MINIATURE_BUTTON_IMAGE_TYPE_'.$ku, '') + || !Configuration::updateValue($this->_prefix_st.'MINIATURE_VIDEO_ZINDEX_'.$ku, 0) + || !Configuration::updateValue($this->_prefix_st.'MINIATURE_POINTER_EVENTS_NONE_'.$ku, 0) + || !Configuration::updateValue($this->_prefix_st.'MINIATURE_PLAY_BTN_POSITION_'.$ku, 0) + || !Configuration::updateValue($this->_prefix_st.'MINIATURE_PLAY_BTN_OFFSET_X_'.$ku, 0) + || !Configuration::updateValue($this->_prefix_st.'MINIATURE_PLAY_BTN_OFFSET_Y_'.$ku, 0) + || !Configuration::updateValue($this->_prefix_st.'MINIATURE_PLAY_TEXT_COLOR_'.$ku, '') + || !Configuration::updateValue($this->_prefix_st.'MINIATURE_PLAY_TEXT_BG_'.$ku, '') + || !Configuration::updateValue($this->_prefix_st.'MINIATURE_CLOSE_BTN_POSITION_'.$ku, 2) + || !Configuration::updateValue($this->_prefix_st.'MINIATURE_CLOSE_BTN_OFFSET_X_'.$ku, 0) + || !Configuration::updateValue($this->_prefix_st.'MINIATURE_CLOSE_BTN_OFFSET_Y_'.$ku, 0)) + $res &= false; + + if(!$this->installBtn(['MINIATURE_PLAY', 'MINIATURE_CLOSE'], '_'.$ku)) + $res &= false; + } + if (!$res) { + return false; + } + if(!$this->installBtn(['PLAYER_PLAY', 'PLAYER_CLOSE'])) + return false; + + + return true; + } + + public function installBtn($keys, $surfix=''){ + $res = true; + foreach ($keys as $key) { + if (!Configuration::updateValue($this->_prefix_st.$key.'_BTN_COLOR'.$surfix, '') + || !Configuration::updateValue($this->_prefix_st.$key.'_BTN_BG'.$surfix, '') + || !Configuration::updateValue($this->_prefix_st.$key.'_BTN_BG_OPACITY'.$surfix, 1) + || !Configuration::updateValue($this->_prefix_st.$key.'_BTN_HOVER_COLOR'.$surfix, '') + || !Configuration::updateValue($this->_prefix_st.$key.'_BTN_HOVER_BG'.$surfix, '') + || !Configuration::updateValue($this->_prefix_st.$key.'_BTN_SIZE'.$surfix, 0) + || !Configuration::updateValue($this->_prefix_st.$key.'_BTN_ICON_SIZE'.$surfix, 0) + || !Configuration::updateValue($this->_prefix_st.$key.'_BTN_BORDER_COLOR'.$surfix, '') + || !Configuration::updateValue($this->_prefix_st.$key.'_BTN_BORDER_SIZE'.$surfix, 0) + || !Configuration::updateValue($this->_prefix_st.$key.'_BTN_BORDER_RADIUS'.$surfix, '') + ) { + $res &= false; + } + } + return $res; + } + + public function installTab() + { + $result = true; + foreach (self::$_bo_menu as $v) { + $tab = new Tab(); + $tab->active = (int)$v['active']; + $tab->class_name = $v['class_name']; + $tab->name = array(); + foreach (Language::getLanguages(true) as $lang) { + $tab->name[$lang['id_lang']] = $v['name']; + } + $tab->id_parent = (int)Tab::getIdFromClassName($v['tab']); + $tab->module = $this->name; + + if (isset($v['icon'])) { + $tab->icon = $v['icon']; + } + + $result &= $tab->add(); + } + return $result; + } + + public function uninstallTab() + { + $result = true; + + foreach (self::$_bo_menu as $v) { + $id_tab = (int)Tab::getIdFromClassName($v['class_name']); + if ($id_tab) { + $tab = new Tab($id_tab); + $result &= $tab->delete(); + } else { + $result = true; + } + } + return $result; + } + + private function installDB() + { + $res = Db::getInstance()->execute(' + CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'st_easy_video` ( + `id_st_easy_video` int(11) unsigned NOT NULL AUTO_INCREMENT, + `url` varchar(255) DEFAULT NULL, + `thumbnail` varchar(255) DEFAULT NULL, + `name` varchar(255) DEFAULT NULL, + `position` int(10) unsigned NOT NULL DEFAULT 0, + `active` tinyint(1) unsigned NOT NULL DEFAULT 1, + `online_thumbnail` tinyint(1) unsigned NOT NULL DEFAULT 1, + `loop` tinyint(1) unsigned NOT NULL DEFAULT 2, + `muted` tinyint(1) unsigned NOT NULL DEFAULT 2, + `autoplay` tinyint(1) unsigned NOT NULL DEFAULT 2, + `id_product` TEXT DEFAULT NULL, + `id_category` int(10) unsigned NOT NULL DEFAULT 0, + `sub_category` tinyint(1) unsigned NOT NULL DEFAULT 1, + `id_manufacturer` int(10) unsigned NOT NULL DEFAULT 0, + `location` tinyint(1) unsigned NOT NULL DEFAULT 0, + `ratio` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id_st_easy_video`) + ) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;'); + + $res &= Db::getInstance()->execute(' + CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'st_easy_video_shop` ( + `id_st_easy_video` int(10) NOT NULL, + `id_shop` int(11) NOT NULL, + PRIMARY KEY (`id_st_easy_video`,`id_shop`), + KEY `id_shop` (`id_shop`) + ) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8 ;'); + + $res &= Db::getInstance()->execute(' + CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'st_easy_video_yuyan` ( + `id_st_easy_video` INT UNSIGNED NOT NULL, + `id_lang` int(10) unsigned NOT NULL, + PRIMARY KEY (`id_st_easy_video`, `id_lang`) + ) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8 ;'); + + return $res; + } + private function uninstallDB() + { + return Db::getInstance()->execute('DROP TABLE IF EXISTS `'._DB_PREFIX_.'st_easy_video`,`'._DB_PREFIX_.'st_easy_video_shop`,`'._DB_PREFIX_.'st_easy_video_yuyan`'); + } + public function uninstall() + { + // $this->_clearCache('steasyvideo.tpl'); + if (!parent::uninstall() || + !$this->uninstallDB() || + !$this->uninstallTab()) { + return false; + } + return true; + } + + public function getContent() + { + Tools::redirectAdmin($this->context->link->getAdminLink('AdminStEasyVideoProduct')); + } + + + public function getPredefinedTemplate($id){ + if(!$id) + return ''; + $content = $this->fetch('module:steasyvideo/views/templates/hook/predefined/'.$id.'.tpl'); + if ($content && _PS_MODE_DEV_) { + $pattern = "/\<\!--\s+(.+?)\s+--\>/s"; + $content = preg_replace_callback($pattern, function($matches){ + if (isset($matches[1]) && (int)$matches[1]) { + return ''; + } + }, $content); + $content = trim($content); + } + return $content; + } + public function hookDisplayHeader($params) + { + $st_easy_video = array( + 'miniature' => array( + 'current' => [], + ), + 'gallery' => array( + 'current' => [], + ), + 'theme_name' => EasyVideoBase::getThemeName(), + 'maximum_tries' => (int)Configuration::get($this->_prefix_st.'MAXIMUM_TRIES'), + 'play_video_text' => html_entity_decode(Configuration::get($this->_prefix_st.'PLAY_VIDEO_TEXT', $this->context->language->id)), + 'get_videos_url' => $this->context->link->getModuleLink('steasyvideo', 'ajax'), + ); + + + foreach (EasyVideoBase::$device as $kl => $ku) { + $miniature_selector = Configuration::get($this->_prefix_st.'MINIATURE_SELECTOR_'.$ku); + if(!$miniature_selector) + $miniature_selector = '.js-product-miniature'; + + $gallery_video_selector = Configuration::get($this->_prefix_st.'GALLERY_VIDEO_SELECTOR_'.$ku); + $gallery_video_selector = $gallery_video_selector ?: EasyVideoBase::getSelector('gallery_video_selector', $kl); + $gallery_button_selector = Configuration::get($this->_prefix_st.'GALLERY_BUTTON_SELECTOR_'.$ku); + $gallery_button_selector = $gallery_button_selector ?: EasyVideoBase::getSelector('gallery_button_selector', $kl); + $gallery_type = Configuration::get($this->_prefix_st.'GALLERY_TYPE_'.$ku); + $gallery_type = $gallery_type ?: EasyVideoBase::getSelector('gallery_type', $kl, 0); + $gallery_thumbnail_type = Configuration::get($this->_prefix_st.'GALLERY_THUMBNAIL_TYPE_'.$ku); + $gallery_thumbnail_type = $gallery_thumbnail_type ?: EasyVideoBase::getSelector('gallery_thumbnail_type', $kl, 0); + $gallery_slider_selector = Configuration::get($this->_prefix_st.'GALLERY_SLIDER_SELECTOR_'.$ku); + $gallery_slider_selector = $gallery_slider_selector ?: EasyVideoBase::getSelector('gallery_slider_selector', $kl); + $gallery_thumbnail_selector = Configuration::get($this->_prefix_st.'GALLERY_THUMBNAIL_SELECTOR_'.$ku); + $gallery_thumbnail_selector = $gallery_thumbnail_selector ?: EasyVideoBase::getSelector('gallery_thumbnail_selector', $kl); + $gallery_thumbnail_item_selector = Configuration::get($this->_prefix_st.'GALLERY_THUMBNAIL_ITEM_SELECTOR_'.$ku); + $gallery_thumbnail_item_selector = $gallery_thumbnail_item_selector ?: EasyVideoBase::getSelector('gallery_thumbnail_item_selector', $kl); + $st_easy_video['gallery'][$kl] = array( + 'display' => (int)Configuration::get($this->_prefix_st.'GALLERY_DISPLAY_'.$ku), + 'video_selector' => $gallery_video_selector, + 'video_append' => (int)Configuration::get($this->_prefix_st.'GALLERY_VIDEO_APPEND_'.$ku), + 'video_position' => (int)Configuration::get($this->_prefix_st.'GALLERY_VIDEO_POSITION_'.$ku), + 'button_selector' => $gallery_button_selector, + 'button_append' => (int)Configuration::get($this->_prefix_st.'GALLERY_BUTTON_APPEND_'.$ku), + 'button_position' => (int)Configuration::get($this->_prefix_st.'GALLERY_BUTTON_POSITION_'.$ku), + 'button_layout' => (int)Configuration::get($this->_prefix_st.'GALLERY_BUTTON_LAYOUT_'.$ku), + 'button_hide' => (int)Configuration::get($this->_prefix_st.'GALLERY_BUTTON_HIDE_'.$ku), + 'close_video' => (int)Configuration::get($this->_prefix_st.'GALLERY_CLOSE_VIDEO_'.$ku), + 'type' => (int)$gallery_type, + 'thumbnail_type' => (int)$gallery_thumbnail_type, + 'slider_append' => (int)Configuration::get($this->_prefix_st.'GALLERY_SLIDER_APPEND_'.$ku), + 'thumbnail_append' => (int)Configuration::get($this->_prefix_st.'GALLERY_THUMBNAIL_APPEND_'.$ku), + 'slider_selector' => $gallery_slider_selector, + 'thumbnail_selector' => $gallery_thumbnail_selector, + 'thumbnail_item_selector' => $gallery_thumbnail_item_selector, + 'has_custom_button_template' => Configuration::get($this->_prefix_st.'GALLERY_BUTTON_TEMPLATE_'.$ku) != '', + 'has_custom_video_template' => Configuration::get($this->_prefix_st.'GALLERY_VIDEO_TEMPLATE_'.$ku) != '', + 'player_settings' => array( + 'autoplay' => (int)Configuration::get($this->_prefix_st.'GALLERY_AUTOPLAY_'.$ku), + 'muted' => (int)Configuration::get($this->_prefix_st.'GALLERY_MUTED_'.$ku), + 'loop' => (int)Configuration::get($this->_prefix_st.'GALLERY_LOOP_'.$ku), + 'controls' => (int)Configuration::get($this->_prefix_st.'GALLERY_CONTROLS_'.$ku), + ), + ); + + if($kl=='quickview') + continue; + + $miniature_video_selector = Configuration::get($this->_prefix_st.'MINIATURE_VIDEO_SELECTOR_'.$ku); + $miniature_video_selector = $miniature_video_selector ?: EasyVideoBase::getSelector('miniature_video_selector', $kl); + $miniature_button_selector = Configuration::get($this->_prefix_st.'MINIATURE_BUTTON_SELECTOR_'.$ku); + $miniature_button_selector = $miniature_button_selector ?: EasyVideoBase::getSelector('miniature_button_selector', $kl); + + $st_easy_video['miniature'][$kl] = array( + 'display' => (int)Configuration::get($this->_prefix_st.'MINIATURE_DISPLAY_'.$ku), + 'selector' => $miniature_selector, + 'video_selector' => $miniature_video_selector, + 'video_append' => (int)Configuration::get($this->_prefix_st.'MINIATURE_VIDEO_APPEND_'.$ku), + 'video_position' => (int)Configuration::get($this->_prefix_st.'MINIATURE_VIDEO_POSITION_'.$ku), + 'button_selector' => $miniature_button_selector, + 'button_append' => (int)Configuration::get($this->_prefix_st.'MINIATURE_BUTTON_APPEND_'.$ku), + 'button_position' => (int)Configuration::get($this->_prefix_st.'MINIATURE_BUTTON_POSITION_'.$ku), + 'button_layout' => (int)Configuration::get($this->_prefix_st.'MINIATURE_BUTTON_LAYOUT_'.$ku), + 'button_hide' => (int)Configuration::get($this->_prefix_st.'MINIATURE_BUTTON_HIDE_'.$ku), + 'video_template' => Configuration::get($this->_prefix_st.'MINIATURE_VIDEO_TEMPLATE_'.$ku), + 'button_template' => Configuration::get($this->_prefix_st.'MINIATURE_BUTTON_TEMPLATE_'.$ku), + 'player_settings' => array( + 'autoplay' => (int)Configuration::get($this->_prefix_st.'MINIATURE_AUTOPLAY_'.$ku), + 'muted' => (int)Configuration::get($this->_prefix_st.'MINIATURE_MUTED_'.$ku), + 'loop' => (int)Configuration::get($this->_prefix_st.'MINIATURE_LOOP_'.$ku), + 'controls' => (int)Configuration::get($this->_prefix_st.'MINIATURE_CONTROLS_'.$ku), + ), + ); + if($kl=='desktop') + $st_easy_video['miniature']['desktop']['hover_element'] = Configuration::get($this->_prefix_st.'MINIATURE_HOVER_ELEMENT'); + } + if (method_exists($this->context->controller, 'getProduct')) { + $product = $this->context->controller->getProduct(); + $video_templates = []; + $button_templates = []; + foreach (EasyVideoBase::$device as $kl => $ku) { + if($id = EasyVideoBase::getSelector('gallery_video_template', $kl)){ + $video_templates[$id] = $this->getPredefinedTemplate($id); + } + if($id = EasyVideoBase::getSelector('gallery_button_template', $kl)){ + $button_templates[$id] = $this->getPredefinedTemplate($id); + } + } + if ($video_data = EasyVideoBase::getVideosByProduct($product->id, [0, 1], 0, $product->link_rewrite, $video_templates, $button_templates)) { + $st_easy_video = array_merge($st_easy_video, ['id_product' => $product->id, 'videos' => $video_data]); + } + } + + Media::addJsDef(array('steasyvideo' => $st_easy_video)); + + $this->context->controller->addJS($this->_path.'views/js/front.js'); + $this->context->controller->addCSS($this->_path.'views/css/front.css'); + $this->context->controller->addJS($this->_path.'views/js/video.min.js'); + $this->context->controller->addCSS($this->_path.'views/css/video-js.css'); + + if (!Configuration::get($this->_prefix_st.'YOUTUBE_API')) { + $this->context->controller->addJS($this->_path.'views/js/youtube.min.js'); + } + if (!Configuration::get($this->_prefix_st.'VIMEO_API')) { + $this->context->controller->addJS($this->_path.'views/js/videojs-vimeo.umd.js'); + } + if ($skin = Configuration::get($this->_prefix_st.'PLAYER_SKIN')) { + $this->context->controller->addCSS($this->_path.'views/css/skin-'.$skin.'.css'); + } + + $template_file = 'module:steasyvideo/views/templates/hook/header.tpl'; + $css = ''; + if (!$this->isCached($template_file, $this->getCacheId())) { + $breakpoint = (int)Configuration::get($this->_prefix_st.'BREAKPOINT'); + if ($breakpoint) { + $css .= '@media (max-width: '.$breakpoint.'px){#st_easy_video_device_mode:after {content: \'mobile\';}}'; + } + + if (($bg_color = Configuration::get($this->_prefix_st.'BG_COLOR')) && Validate::isColor($bg_color)) { + $bg_opacity = Configuration::get($this->_prefix_st.'BG_OPACITY'); + if (!$bg_opacity || $bg_opacity == 1) { + $css .= '.video-js .vjs-control-bar,.video-js .vjs-menu-button .vjs-menu-content{background-color: '.$bg_color.'; }'; + } else { + $bg_color_arr = self::hex2rgb($bg_color); + if (is_array($bg_color_arr)) { + if ($bg_opacity < 0 || $bg_opacity > 1) { + $bg_opacity = 0.5; + } + $css .= '.video-js .vjs-control-bar,.video-js .vjs-menu-button .vjs-menu-content{background-color: rgba('.$bg_color_arr[0].','.$bg_color_arr[1].','.$bg_color_arr[2].','.$bg_opacity.'); }'; + } + } + } + if ($control_color = Configuration::get($this->_prefix_st.'CONTROL_COLOR')) { + $css .= '.video-js{color: '.$control_color.'; }'; + } + if ($control_size = Configuration::get($this->_prefix_st.'CONTROL_SIZE')) { + $css .= '.video-js .vjs-control-bar{font-size: '.$control_size.'px; }'; + } + + if (($progress_bar_color = Configuration::get($this->_prefix_st.'PROGRESS_BAR_COLOR')) && Validate::isColor($progress_bar_color)) { + $progress_bar_opacity = Configuration::get($this->_prefix_st.'PROGRESS_BAR_OPACITY'); + if (!$progress_bar_opacity || $progress_bar_opacity == 1) { + $css .= '.video-js .vjs-slider, .video-js .vjs-load-progress{background-color: '.$progress_bar_color.'; }'; + } else { + $progress_bar_color_arr = self::hex2rgb($progress_bar_color); + if (is_array($progress_bar_color_arr)) { + if ($progress_bar_opacity < 0 || $progress_bar_opacity > 1) { + $progress_bar_opacity = 0.5; + } + $css .= '.video-js .vjs-slider, .video-js .vjs-load-progress{background-color: rgba('.$progress_bar_color_arr[0].','.$progress_bar_color_arr[1].','.$progress_bar_color_arr[2].','.$progress_bar_opacity.'); }'; + } + } + } + if ($progress_bar_highlight_color = Configuration::get($this->_prefix_st.'PROGRESS_BAR_HIGHLIGHT_COLOR')) { + $css .= '.video-js .vjs-volume-level,.video-js .vjs-play-progress,.video-js .vjs-slider-bar{background: '.$progress_bar_highlight_color.'; }'; + } + + $css .= $this->generateBtnCss([ + ['prefix'=>'PLAYER_PLAY', 'normal'=>'.video-js .vjs-big-play-button', 'hover'=>'.video-js:hover .vjs-big-play-button', 'surfix'=>''], + ['prefix'=>'PLAYER_CLOSE', 'normal'=>'.st_easy_video_close .vjs-icon-placeholder', 'hover'=>'.st_easy_video_close:hover .vjs-icon-placeholder', 'surfix'=>''], + ]); + + foreach (EasyVideoBase::$device as $kl => $ku) { + if($kl=='mobile' && !$breakpoint) + continue; + if($kl=='mobile') + $css .= '@media (max-width: '.$breakpoint.'px){'; + + $gallery_video_zindex = (int)Configuration::get($this->_prefix_st.'GALLERY_VIDEO_ZINDEX_'.$ku); + $gallery_video_zindex = $gallery_video_zindex ?: EasyVideoBase::getSelector('gallery_video_zindex', '', 1); + if ($gallery_video_zindex) { + $css .= $this->generateGalleryPrefix('.st_easy_video_box.st_easy_video_box_absolute', $kl).'{z-index: '.$gallery_video_zindex.';}'; + $css .= $this->generateGalleryPrefix('.st_easy_video_btn', $kl).'{z-index: '.($gallery_video_zindex + 1).';}'; + } + + if ($bg_color = Configuration::get($this->_prefix_st.'GALLERY_PLAYER_BG_'.$ku)) { + $css .= $this->generateGalleryPrefix('.st_easy_video_box_1, .st_easy_video_box_1 .st_easy_video', $kl).'{background: '.$bg_color.';}'; + } + if ($width = Configuration::get($this->_prefix_st.'GALLERY_PLAYER_WIDTH_'.$ku)) { + $css .= $this->generateGalleryPrefix('.st_easy_video_box_1', $kl).'{max-width: '.$width.'px;}'; + } + + $css .= $this->generateGalleryPrefix('.st_easy_video_play_1.st_easy_video_btn_absolute', $kl).'{ '.$this->generateBtnPositionCss((int)Configuration::get($this->_prefix_st.'GALLERY_PLAY_BTN_POSITION_'.$ku), (int)Configuration::get($this->_prefix_st.'GALLERY_PLAY_BTN_OFFSET_X_'.$ku), (int)Configuration::get($this->_prefix_st.'GALLERY_PLAY_BTN_OFFSET_Y_'.$ku)).' }'; + + if ($play_text_color = Configuration::get($this->_prefix_st.'GALLERY_PLAY_TEXT_COLOR_'.$ku)) { + $css .= $this->generateGalleryPrefix('.st_easy_video_play_1 .st_play_video_text', $kl).'{color: '.$play_text_color.'; }'; + } + if ($play_text_bg = Configuration::get($this->_prefix_st.'GALLERY_PLAY_TEXT_BG_'.$ku)) { + $css .= $this->generateGalleryPrefix('.st_easy_video_play_1 .st_play_video_text', $kl).'{background-color: '.$play_text_bg.';padding: 0 3px 1px;}'; + } + $css .= $this->generateGalleryPrefix('.st_easy_video_close_1.st_easy_video_btn_absolute', $kl).'{ '.$this->generateBtnPositionCss((int)Configuration::get($this->_prefix_st.'GALLERY_CLOSE_BTN_POSITION_'.$ku), (int)Configuration::get($this->_prefix_st.'GALLERY_CLOSE_BTN_OFFSET_X_'.$ku), (int)Configuration::get($this->_prefix_st.'GALLERY_CLOSE_BTN_OFFSET_Y_'.$ku)).' }'; + + $play_icon_btn_size = (int)Configuration::get($this->_prefix_st.'PLAY_ICON_BTN_SIZE_'.$ku); + if (!$play_icon_btn_size) { + $play_icon_btn_size = 36; + } + $css .= $this->generateGalleryPrefix('.st_easy_video_play_icon.st_easy_video_btn_absolute', $kl).'{ '.$this->generateBtnPositionCss(0, floor($play_icon_btn_size / 2), floor($play_icon_btn_size / 2)).' }'; + + $css .= $this->generateBtnCss([ + ['prefix'=>'GALLERY_PLAY', 'normal'=>$this->generateGalleryPrefix('.st_easy_video_play_1 .vjs-icon-placeholder', $kl), 'hover'=>$this->generateGalleryPrefix('.st_easy_video_play_1:hover .vjs-icon-placeholder', $kl), 'surfix'=>'_'.$ku], + ['prefix'=>'GALLERY_CLOSE', 'normal'=>$this->generateGalleryPrefix('.st_easy_video_close_1 .vjs-icon-placeholder', $kl), 'hover'=>$this->generateGalleryPrefix('.st_easy_video_close_1:hover .vjs-icon-placeholder', $kl), 'surfix'=>'_'.$ku], + ['prefix'=>'PLAY_ICON', 'normal'=>$this->generateGalleryPrefix('.st_easy_video_play_icon .vjs-icon-placeholder', $kl), 'hover'=>$this->generateGalleryPrefix('.st_easy_video_play_icon:hover .vjs-icon-placeholder', $kl), 'surfix'=>'_'.$ku], + ]); + + if($kl=='quickview') + continue; + + $miniature_video_zindex = (int)Configuration::get($this->_prefix_st.'MINIATURE_VIDEO_ZINDEX_'.$ku); + $miniature_video_zindex = $miniature_video_zindex ?: EasyVideoBase::getSelector('miniature_video_zindex', '', 1); + $miniature_selector = Configuration::get($this->_prefix_st.'MINIATURE_SELECTOR_'.$ku); + if(!$miniature_selector) + $miniature_selector = '.js-product-miniature'; + + if ($miniature_video_zindex) { + $css .= $miniature_selector.' .st_easy_video_box.st_easy_video_box_absolute{z-index: '.$miniature_video_zindex.';}'; + $css .= $miniature_selector.' .st_easy_video_btn{z-index: '.($miniature_video_zindex + 1).';}'; + } + + if (Configuration::get($this->_prefix_st.'MINIATURE_POINTER_EVENTS_NONE_'.$ku)) { + $css .= '.st_easy_video_box_0{pointer-events: none;}'; + } + if ($bg_color = Configuration::get($this->_prefix_st.'MINIATURE_PLAYER_BG_'.$ku)) { + $css .= '.st_easy_video_box_0, .st_easy_video_box_0 .st_easy_video{background: '.$bg_color.';}'; + } + if ($width = Configuration::get($this->_prefix_st.'MINIATURE_PLAYER_WIDTH_'.$ku)) { + $css .= '.st_easy_video_box_0{max-width: '.$width.'px;}'; + } + + $css .= '.st_easy_video_play_0.st_easy_video_btn_absolute{ '.$this->generateBtnPositionCss((int)Configuration::get($this->_prefix_st.'MINIATURE_PLAY_BTN_POSITION_'.$ku), (int)Configuration::get($this->_prefix_st.'MINIATURE_PLAY_BTN_OFFSET_X_'.$ku), (int)Configuration::get($this->_prefix_st.'MINIATURE_PLAY_BTN_OFFSET_Y_'.$ku)).' }'; + + if ($play_text_color = Configuration::get($this->_prefix_st.'MINIATURE_PLAY_TEXT_COLOR_'.$ku)) { + $css .= '.st_easy_video_play_0 .st_play_video_text{color: '.$play_text_color.'; }'; + } + if ($play_text_bg = Configuration::get($this->_prefix_st.'MINIATURE_PLAY_TEXT_BG_'.$ku)) { + $css .= '.st_easy_video_play_0 .st_play_video_text{background-color: '.$play_text_bg.';padding: 0 3px 1px;}'; + } + $css .= '.st_easy_video_close_0.st_easy_video_btn_absolute{ '.$this->generateBtnPositionCss((int)Configuration::get($this->_prefix_st.'MINIATURE_CLOSE_BTN_POSITION_'.$ku), (int)Configuration::get($this->_prefix_st.'MINIATURE_CLOSE_BTN_OFFSET_X_'.$ku), (int)Configuration::get($this->_prefix_st.'MINIATURE_CLOSE_BTN_OFFSET_Y_'.$ku)).' }'; + + $css .= $this->generateBtnCss([ + ['prefix'=>'MINIATURE_PLAY', 'normal'=>'.st_easy_video_play_0 .vjs-icon-placeholder', 'hover'=>'.st_easy_video_play_0:hover .vjs-icon-placeholder', 'surfix'=>'_'.$ku], + ['prefix'=>'MINIATURE_CLOSE', 'normal'=>'.st_easy_video_close_0 .vjs-icon-placeholder', 'hover'=>'.st_easy_video_close_1:hover .vjs-icon-placeholder', 'surfix'=>'_'.$ku], + ]); + + if($kl=='mobile') + $css .= '}'; + } + + if ($custom_css = Configuration::get($this->_prefix_st.'CUSTOM_CSS')) { + $css .= html_entity_decode(str_replace('¤', '\\', $custom_css)); + } + } + $this->context->smarty->assign('st_easy_video_css', $css); + + return $this->fetch($template_file, $this->getCacheId()); + } + + public function generateGalleryPrefix($selector, $device){ + if($device=='quickview'){ + $selectors = explode(',', $selector); + $selectors = array_map(function($value){ + return '.modal.quickview '.$value.', .stsb_side_panel_show[data-elementor-type="quickview"] '.$value; + }, $selectors); + $selector = implode(',', $selectors); + } + return $selector; + } + public function generateBtnPositionCss($position, $offset_x, $offset_y) + { + $css = ''; + switch ($position) { + case 1: + $css .= 'top: ' . $offset_y . 'px;left: ' . $offset_x . 'px;right: auto; bottom: auto;'; + break; + case 2: + $css .= 'top: ' . $offset_y . 'px;left: auto;right: ' . $offset_x . 'px; bottom: auto;'; + break; + case 3: + $css .= 'top: auto;left: auto;right: ' . $offset_x . 'px; bottom: ' . $offset_y . 'px;'; + break; + case 4: + $css .= 'top: auto;left: ' . $offset_x . 'px;right: auto; bottom: ' . $offset_y . 'px;'; + break; + default: + $css .= 'margin-left: -'.$offset_x.'px;margin-top: -'.$offset_y.'px;'; + $css .= 'top: 50%;left: 50%;right: auto; bottom: auto;'; + break; + } + return $css; + } + + public function generateBtnCss($btns) + { + $css = ''; + foreach ($btns as $v) { + if ($play_btn_color = Configuration::get($this->_prefix_st.$v['prefix'].'_BTN_COLOR'.$v['surfix'])) { + $css .= $v['normal'].'{color: '.$play_btn_color.'; }'; + } + if (($play_btn_bg = Configuration::get($this->_prefix_st.$v['prefix'].'_BTN_BG'.$v['surfix'])) && Validate::isColor($play_btn_bg)) { + $play_btn_opacity = Configuration::get($this->_prefix_st.$v['prefix'].'_BTN_BG_OPACITY'.$v['surfix']); + if (!$play_btn_opacity || $play_btn_opacity == 1) { + $css .= $v['normal'].'{background-color: '.$play_btn_bg.'; }'; + } else { + $play_btn_bg_arr = self::hex2rgb($play_btn_bg); + if (is_array($play_btn_bg_arr)) { + if ($play_btn_opacity < 0 || $play_btn_opacity > 1) { + $play_btn_opacity = 0.5; + } + $css .= $v['normal'].'{background-color: rgba('.$play_btn_bg_arr[0].','.$play_btn_bg_arr[1].','.$play_btn_bg_arr[2].','.$play_btn_opacity.'); }'; + } + } + } + if ($btn_hover_color = Configuration::get($this->_prefix_st.$v['prefix'].'_BTN_HOVER_COLOR'.$v['surfix'])) { + $css .= $v['hover'].'{color:'.$btn_hover_color.';}'; + } + if (($btn_hover_bg = Configuration::get($this->_prefix_st.$v['prefix'].'_BTN_HOVER_BG'.$v['surfix'])) && Validate::isColor($btn_hover_bg)) { + $btn_bg_opacity = Configuration::get($this->_prefix_st.$v['prefix'].'_BTN_BG_OPACITY'.$v['surfix']); + if (!$btn_bg_opacity || $btn_bg_opacity == 1) { + $css .= $v['hover'].'{background-color: '.$btn_hover_bg.'; border-color:'.$btn_hover_bg.';}'; + } else { + $btn_hover_bg_arr = self::hex2rgb($btn_hover_bg); + if (is_array($btn_hover_bg_arr)) { + if ($btn_bg_opacity < 0 || $btn_bg_opacity > 1) { + $btn_bg_opacity = 0.5; + } + $css .= $v['hover'].'{background-color: rgba('.$btn_hover_bg_arr[0].','.$btn_hover_bg_arr[1].','.$btn_hover_bg_arr[2].','.$btn_bg_opacity.'); border-color:: rgba('.$btn_hover_bg_arr[0].','.$btn_hover_bg_arr[1].','.$btn_hover_bg_arr[2].','.$btn_bg_opacity.');}'; + } + } + } + $play_btn_border_size = Configuration::get($this->_prefix_st.$v['prefix'].'_BTN_BORDER_SIZE'.$v['surfix']); + if ($play_btn_border_size || $play_btn_border_size === 0 || $play_btn_border_size === '0') { + $css .= $v['normal'].'{border-width: '.$play_btn_border_size.'px; }'; + } + $play_btn_size = (int)Configuration::get($this->_prefix_st.$v['prefix'].'_BTN_SIZE'.$v['surfix']); + if ($play_btn_size) { + $css .= $v['normal'].'{width: '.$play_btn_size.'px;height: '.$play_btn_size.'px;line-height: '.($play_btn_size - 2 * (int)$play_btn_border_size).'px; }'; + } else { + $play_btn_size = 36; + } + if ($play_btn_icon_size = Configuration::get($this->_prefix_st.$v['prefix'].'_BTN_ICON_SIZE'.$v['surfix'])) { + $css .= $v['normal'].'{font-size: '.$play_btn_icon_size.'px; }'; + } + + if ($play_btn_border_color = Configuration::get($this->_prefix_st.$v['prefix'].'_BTN_BORDER_COLOR'.$v['surfix'])) { + $css .= $v['normal'].'{border-color: '.$play_btn_border_color.'; }'; + }; + $play_btn_border_radius = Configuration::get($this->_prefix_st.$v['prefix'].'_BTN_BORDER_RADIUS'.$v['surfix']); + if ($play_btn_border_radius || $play_btn_border_radius === 0 || $play_btn_border_radius === '0') { + $css .= $v['normal'].'{border-radius: '.$play_btn_border_radius.'px; }'; + } + } + return $css; + } + + public function getButtonFiledsOptions($key, $surfix='') + { + return array( + $this->_prefix_st.$key.'_BTN_COLOR'.$surfix => [ + 'title' => $this->l('Color'), + 'validation' => 'isColor', + 'type' => 'color', + 'size' => 5, + 'name' => $this->_prefix_st.$key.'_BTN_COLOR'.$surfix, + ], + $this->_prefix_st.$key.'_BTN_BG'.$surfix => [ + 'title' => $this->l('Background'), + 'validation' => 'isColor', + 'type' => 'color', + 'size' => 5, + 'name' => $this->_prefix_st.$key.'_BTN_BG'.$surfix, + ], + $this->_prefix_st.$key.'_BTN_BG_OPACITY'.$surfix => [ + 'title' => $this->l('Background opacity'), + 'validation' => 'isFloat', + 'cast' => 'floatval', + 'type' => 'text', + 'desc' => $this->l('From 0.0 (fully transparent) to 1.0 (fully opaque).'), + ], + $this->_prefix_st.$key.'_BTN_HOVER_COLOR'.$surfix => [ + 'title' => $this->l('Hover color'), + 'validation' => 'isColor', + 'type' => 'color', + 'size' => 5, + 'name' => $this->_prefix_st.$key.'_BTN_HOVER_COLOR'.$surfix, + ], + $this->_prefix_st.$key.'_BTN_HOVER_BG'.$surfix => [ + 'title' => $this->l('Hover background'), + 'validation' => 'isColor', + 'type' => 'color', + 'size' => 5, + 'name' => $this->_prefix_st.$key.'_BTN_HOVER_BG'.$surfix, + ], + $this->_prefix_st.$key.'_BTN_SIZE'.$surfix => [ + 'title' => $this->l('Size'), + 'validation' => 'isUnsignedInt', + 'cast' => 'intval', + 'type' => 'text', + 'suffix' => $this->l('pixels'), + ], + $this->_prefix_st.$key.'_BTN_ICON_SIZE'.$surfix => [ + 'title' => $this->l('Play icon size'), + 'validation' => 'isUnsignedInt', + 'cast' => 'intval', + 'type' => 'text', + 'suffix' => $this->l('pixels'), + ], + $this->_prefix_st.$key.'_BTN_BORDER_COLOR'.$surfix => [ + 'title' => $this->l('Border color'), + 'validation' => 'isColor', + 'type' => 'color', + 'size' => 5, + 'name' => $this->_prefix_st.$key.'_BTN_BORDER_COLOR'.$surfix, + ], + $this->_prefix_st.$key.'_BTN_BORDER_SIZE'.$surfix => [ + 'title' => $this->l('Border size'), + 'validation' => 'isAnything', + 'type' => 'text', + 'suffix' => $this->l('pixels'), + ], + $this->_prefix_st.$key.'_BTN_BORDER_RADIUS'.$surfix => [ + 'title' => $this->l('Border radius'), + 'validation' => 'isAnything', + 'type' => 'text', + 'suffix' => $this->l('pixels'), + ], + ); + } + public function hookDisplayProductAdditionalInfo($params) + { + if (!isset($params['product']) || Tools::getValue('action') != 'quickview') { + return ''; + } + $product = $this->context->controller->getProduct(); + if ($video_data = EasyVideoBase::getVideosByProduct($product)) { + $this->context->smarty->assign(array( + 'video_data' => $video_data, + 'id_product' => $product->id, + 'id_product_attribute' => (int) Tools::getValue('id_product_attribute'), + )); + return $this->fetch('module:steasyvideo/views/templates/hook/forquickview.tpl'); + } + return ''; + } + /*public function hookDisplayAfterBodyOpeningTag($params) + { + return $this->display(__FILE__,'views/templates/hook/device_mode.tpl', $this->getCacheId()); + }*/ + public function hookDisplayBeforeBodyClosingTag($params) + { + return $this->fetch('module:steasyvideo/views/templates/hook/device_mode.tpl', $this->getCacheId()); + } + public function hookDisplayAdminProductsExtra($params) + { + $id_product = $params['id_product']; + $this->smarty->assign(array( + 'tiaozhuan_url' => $this->context->link->getAdminLink('AdminStEasyVideoProduct', true).'&addst_easy_video&ref=product&id_product='.$id_product, + )); + return $this->display(__FILE__, 'views/templates/admin/steasyvideo-pro.tpl'); + } + public static function hex2rgb($hex) + { + $hex = str_replace("#", "", $hex); + + if (strlen($hex) == 3) { + $r = hexdec(substr($hex, 0, 1).substr($hex, 0, 1)); + $g = hexdec(substr($hex, 1, 1).substr($hex, 1, 1)); + $b = hexdec(substr($hex, 2, 1).substr($hex, 2, 1)); + } else { + $r = hexdec(substr($hex, 0, 2)); + $g = hexdec(substr($hex, 2, 2)); + $b = hexdec(substr($hex, 4, 2)); + } + $rgb = array($r, $g, $b); + return $rgb; + } + /*public function hookActionProductDelete($params) + { + if (isset($params['id_product']) && $params['id_product']) + StEasyVideoClass::deleteByProductId($params['id_product']); + return; + }*/ + + /*public function hookFilterProductSearch($params) + { + if(Configuration::get($this->_prefix_st.'MINIATURE')){ + if(isset($params['searchVariables']) && isset($params['searchVariables']['products'])) { + foreach ($params['searchVariables']['products'] as $key => $product) { + $videos = StEasyVideoClass::getProVideos($product['id_product'], $this->context->language->id); + if(!empty($videos)){ + $video = array_shift($videos); + $params['searchVariables']['products'][$key]['steasyvideoo'] = $video['url']; + } + } + } + } + }*/ + public function hookDisplayProductListReviews($params) + { + /*$miniature = (int)Configuration::get($this->_prefix_st.'MINIATURE'); + if(!$miniature) + return '';*/ + if (!isset($params['product'])) { + return ''; + } + if(defined('_TB_VERSION_')){ + $this->context->smarty->assign('easy_video_product', [ + 'id_product' => $params['product']['id_product'], + 'id_manufacturer' => $params['product']['id_manufacturer'], + 'link_rewrite' => $params['product']['link_rewrite'], + ]); + return $this->display(__FILE__, 'views/templates/hook/miniature_tb.tpl'); + }else{ + $this->context->smarty->assign('easy_video_product', [ + 'id_product' => $params['product']->id_product, + 'id_manufacturer' => $params['product']->id_manufacturer, + 'link_rewrite' => $params['product']->link_rewrite, + ]); + return $this->display(__FILE__, 'views/templates/hook/miniature.tpl'); + } + } +} diff --git a/modules/steasyvideo/translations/index.php b/modules/steasyvideo/translations/index.php new file mode 100644 index 00000000..76cd9dd3 --- /dev/null +++ b/modules/steasyvideo/translations/index.php @@ -0,0 +1,35 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/modules/steasyvideo/upgrade/index.php b/modules/steasyvideo/upgrade/index.php new file mode 100644 index 00000000..76cd9dd3 --- /dev/null +++ b/modules/steasyvideo/upgrade/index.php @@ -0,0 +1,35 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/modules/steasyvideo/upgrade/install-1.0.5.php b/modules/steasyvideo/upgrade/install-1.0.5.php new file mode 100644 index 00000000..a7f07c2c --- /dev/null +++ b/modules/steasyvideo/upgrade/install-1.0.5.php @@ -0,0 +1,42 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ +use Elementor\Core\Breakpoints\Manager as Breakpoints_Manager; +if (!defined('_PS_VERSION_')) + exit; + +function upgrade_module_1_0_5($object) +{ + $result = true; + + $field = Db::getInstance()->executeS('Describe `'._DB_PREFIX_.'st_easy_video` `location`'); + if(!is_array($field) || !count($field)) { + $result &= (bool)Db::getInstance()->execute('ALTER TABLE '._DB_PREFIX_.'st_easy_video ADD `location` tinyint(1) unsigned NOT NULL DEFAULT 0'); + } + + $result &= Configuration::updateValue($object->_prefix_st.'VIMEO_API', 1); + + return $result; +} \ No newline at end of file diff --git a/modules/steasyvideo/upgrade/install-1.2.0.php b/modules/steasyvideo/upgrade/install-1.2.0.php new file mode 100644 index 00000000..16938556 --- /dev/null +++ b/modules/steasyvideo/upgrade/install-1.2.0.php @@ -0,0 +1,83 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ +use Elementor\Core\Breakpoints\Manager as Breakpoints_Manager; +if (!defined('_PS_VERSION_')) + exit; + +function upgrade_module_1_2_0($object) +{ + $result = true; + + // Add new tab + $classes = [ + ['cls' => 'AdminStEasyVideoMiniatureMobile', 'name' => 'Miniature on Mobile'], + ]; + + foreach($classes as $class) { + if (!Tab::getIdFromClassName($class['cls'])) { + $tab = new Tab(); + $tab->active = 1; + $tab->class_name = $class['cls']; + $tab->name = array(); + foreach (Language::getLanguages(true) as $lang) { + $tab->name[$lang['id_lang']] = $class['name']; + } + $tab->id_parent = (int)Tab::getIdFromClassName('AdminStEasyVideoPeiZhi'); + $tab->module = $object->name; + $result &= $tab->add(); + } + } + + if(!Configuration::updateValue($object->_prefix_st.'MINIATURE_DISPLAY_DESKTOP', Configuration::get($object->_prefix_st.'MINIATURE_DISPLAY')) + || !Configuration::updateValue($object->_prefix_st.'MINIATURE_SELECTOR_DESKTOP', Configuration::get($object->_prefix_st.'MINIATURE_SELECTOR')) + || !Configuration::updateValue($object->_prefix_st.'MINIATURE_HOVER_ELEMENT_DESKTOP', Configuration::get($object->_prefix_st.'MINIATURE_HOVER_ELEMENT')) + || !Configuration::updateValue($object->_prefix_st.'MINIATURE_VIDEO_SELECTOR_DESKTOP', Configuration::get($object->_prefix_st.'MINIATURE_VIDEO_SELECTOR')) + || !Configuration::updateValue($object->_prefix_st.'MINIATURE_VIDEO_APPEND_DESKTOP', Configuration::get($object->_prefix_st.'MINIATURE_VIDEO_APPEND')) + || !Configuration::updateValue($object->_prefix_st.'MINIATURE_VIDEO_POSITION_DESKTOP', Configuration::get($object->_prefix_st.'MINIATURE_VIDEO_POSITION')) + || !Configuration::updateValue($object->_prefix_st.'MINIATURE_BUTTON_SELECTOR_DESKTOP', Configuration::get($object->_prefix_st.'MINIATURE_BUTTON_SELECTOR')) + || !Configuration::updateValue($object->_prefix_st.'MINIATURE_BUTTON_APPEND_DESKTOP', Configuration::get($object->_prefix_st.'MINIATURE_BUTTON_APPEND')) + || !Configuration::updateValue($object->_prefix_st.'MINIATURE_BUTTON_POSITION_DESKTOP', Configuration::get($object->_prefix_st.'MINIATURE_BUTTON_POSITION')) + || !Configuration::updateValue($object->_prefix_st.'MINIATURE_BUTTON_LAYOUT_DESKTOP', Configuration::get($object->_prefix_st.'MINIATURE_BUTTON_LAYOUT')) + || !Configuration::updateValue($object->_prefix_st.'MINIATURE_BUTTON_HIDE_DESKTOP', Configuration::get($object->_prefix_st.'MINIATURE_BUTTON_HIDE')) + || !Configuration::updateValue($object->_prefix_st.'MINIATURE_AUTOPLAY_DESKTOP', Configuration::get($object->_prefix_st.'MINIATURE_AUTOPLAY')) + || !Configuration::updateValue($object->_prefix_st.'MINIATURE_MUTED_DESKTOP', Configuration::get($object->_prefix_st.'MINIATURE_MUTED')) + || !Configuration::updateValue($object->_prefix_st.'MINIATURE_LOOP_DESKTOP', Configuration::get($object->_prefix_st.'MINIATURE_LOOP')) + || !Configuration::updateValue($object->_prefix_st.'MINIATURE_CONTROLS_DESKTOP', Configuration::get($object->_prefix_st.'MINIATURE_CONTROLS')) + || !Configuration::updateValue($object->_prefix_st.'MINIATURE_VIDEO_TEMPLATE_DESKTOP', Configuration::get($object->_prefix_st.'MINIATURE_VIDEO_TEMPLATE')) + || !Configuration::updateValue($object->_prefix_st.'MINIATURE_VIDEO_ZINDEX_DESKTOP', Configuration::get($object->_prefix_st.'MINIATURE_VIDEO_ZINDEX')) + || !Configuration::updateValue($object->_prefix_st.'MINIATURE_PLAY_BTN_POSITION_DESKTOP', Configuration::get($object->_prefix_st.'MINIATURE_PLAY_BTN_POSITION')) + || !Configuration::updateValue($object->_prefix_st.'MINIATURE_PLAY_BTN_OFFSET_X_DESKTOP', Configuration::get($object->_prefix_st.'MINIATURE_PLAY_BTN_OFFSET')) + || !Configuration::updateValue($object->_prefix_st.'MINIATURE_PLAY_BTN_OFFSET_Y_DESKTOP', Configuration::get($object->_prefix_st.'MINIATURE_PLAY_BTN_OFFSET')) + || !Configuration::updateValue($object->_prefix_st.'MINIATURE_PLAY_TEXT_COLOR_DESKTOP', Configuration::get($object->_prefix_st.'MINIATURE_PLAY_TEXT_COLOR')) + || !Configuration::updateValue($object->_prefix_st.'MINIATURE_PLAY_TEXT_BG_DESKTOP', Configuration::get($object->_prefix_st.'MINIATURE_PLAY_TEXT_BG')) + || !Configuration::updateValue($object->_prefix_st.'MINIATURE_CLOSE_BTN_POSITION_DESKTOP', Configuration::get($object->_prefix_st.'MINIATURE_CLOSE_BTN_POSITION')) + || !Configuration::updateValue($object->_prefix_st.'MINIATURE_CLOSE_BTN_OFFSET_X_DESKTOP', Configuration::get($object->_prefix_st.'MINIATURE_CLOSE_BTN_OFFSET')) + || !Configuration::updateValue($object->_prefix_st.'MINIATURE_CLOSE_BTN_OFFSET_Y_DESKTOP', Configuration::get($object->_prefix_st.'MINIATURE_CLOSE_BTN_OFFSET')) + ) + $result &= false; + + return $result; +} \ No newline at end of file diff --git a/modules/steasyvideo/upgrade/install-1.2.3.php b/modules/steasyvideo/upgrade/install-1.2.3.php new file mode 100644 index 00000000..5905beb9 --- /dev/null +++ b/modules/steasyvideo/upgrade/install-1.2.3.php @@ -0,0 +1,44 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ +use Elementor\Core\Breakpoints\Manager as Breakpoints_Manager; +if (!defined('_PS_VERSION_')) + exit; + +function upgrade_module_1_2_3($object) +{ + $result = true; + Db::getInstance()->execute('TRUNCATE TABLE ' . _DB_PREFIX_ . 'st_easy_video_yuyan'); + $videos = Db::getInstance()->executeS('SELECT * FROM `'._DB_PREFIX_.'st_easy_video`'); + if($videos){ + $data = []; + foreach ($videos as $v) { + $data[] = ['id_st_easy_video' => (int)$v['id_st_easy_video'], 'id_lang' => 0]; + } + $result &= Db::getInstance()->insert('st_easy_video_yuyan', $data); + } + + return $result; +} \ No newline at end of file diff --git a/modules/steasyvideo/vendor/.htaccess b/modules/steasyvideo/vendor/.htaccess new file mode 100644 index 00000000..3de9e400 --- /dev/null +++ b/modules/steasyvideo/vendor/.htaccess @@ -0,0 +1,10 @@ +# Apache 2.2 + + Order deny,allow + Deny from all + + +# Apache 2.4 + + Require all denied + diff --git a/modules/steasyvideo/vendor/autoload.php b/modules/steasyvideo/vendor/autoload.php new file mode 100644 index 00000000..e9c6aef9 --- /dev/null +++ b/modules/steasyvideo/vendor/autoload.php @@ -0,0 +1,7 @@ + + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Composer\Autoload; + +/** + * ClassLoader implements a PSR-0, PSR-4 and classmap class loader. + * + * $loader = new \Composer\Autoload\ClassLoader(); + * + * // register classes with namespaces + * $loader->add('Symfony\Component', __DIR__.'/component'); + * $loader->add('Symfony', __DIR__.'/framework'); + * + * // activate the autoloader + * $loader->register(); + * + * // to enable searching the include path (eg. for PEAR packages) + * $loader->setUseIncludePath(true); + * + * In this example, if you try to use a class in the Symfony\Component + * namespace or one of its children (Symfony\Component\Console for instance), + * the autoloader will first look for the class under the component/ + * directory, and it will then fallback to the framework/ directory if not + * found before giving up. + * + * This class is loosely based on the Symfony UniversalClassLoader. + * + * @author Fabien Potencier + * @author Jordi Boggiano + * @see https://www.php-fig.org/psr/psr-0/ + * @see https://www.php-fig.org/psr/psr-4/ + */ +class ClassLoader +{ + /** @var ?string */ + private $vendorDir; + + // PSR-4 + /** + * @var array[] + * @psalm-var array> + */ + private $prefixLengthsPsr4 = array(); + /** + * @var array[] + * @psalm-var array> + */ + private $prefixDirsPsr4 = array(); + /** + * @var array[] + * @psalm-var array + */ + private $fallbackDirsPsr4 = array(); + + // PSR-0 + /** + * @var array[] + * @psalm-var array> + */ + private $prefixesPsr0 = array(); + /** + * @var array[] + * @psalm-var array + */ + private $fallbackDirsPsr0 = array(); + + /** @var bool */ + private $useIncludePath = false; + + /** + * @var string[] + * @psalm-var array + */ + private $classMap = array(); + + /** @var bool */ + private $classMapAuthoritative = false; + + /** + * @var bool[] + * @psalm-var array + */ + private $missingClasses = array(); + + /** @var ?string */ + private $apcuPrefix; + + /** + * @var self[] + */ + private static $registeredLoaders = array(); + + /** + * @param ?string $vendorDir + */ + public function __construct($vendorDir = null) + { + $this->vendorDir = $vendorDir; + } + + /** + * @return string[] + */ + public function getPrefixes() + { + if (!empty($this->prefixesPsr0)) { + return call_user_func_array('array_merge', array_values($this->prefixesPsr0)); + } + + return array(); + } + + /** + * @return array[] + * @psalm-return array> + */ + public function getPrefixesPsr4() + { + return $this->prefixDirsPsr4; + } + + /** + * @return array[] + * @psalm-return array + */ + public function getFallbackDirs() + { + return $this->fallbackDirsPsr0; + } + + /** + * @return array[] + * @psalm-return array + */ + public function getFallbackDirsPsr4() + { + return $this->fallbackDirsPsr4; + } + + /** + * @return string[] Array of classname => path + * @psalm-var array + */ + public function getClassMap() + { + return $this->classMap; + } + + /** + * @param string[] $classMap Class to filename map + * @psalm-param array $classMap + * + * @return void + */ + public function addClassMap(array $classMap) + { + if ($this->classMap) { + $this->classMap = array_merge($this->classMap, $classMap); + } else { + $this->classMap = $classMap; + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, either + * appending or prepending to the ones previously set for this prefix. + * + * @param string $prefix The prefix + * @param string[]|string $paths The PSR-0 root directories + * @param bool $prepend Whether to prepend the directories + * + * @return void + */ + public function add($prefix, $paths, $prepend = false) + { + if (!$prefix) { + if ($prepend) { + $this->fallbackDirsPsr0 = array_merge( + (array) $paths, + $this->fallbackDirsPsr0 + ); + } else { + $this->fallbackDirsPsr0 = array_merge( + $this->fallbackDirsPsr0, + (array) $paths + ); + } + + return; + } + + $first = $prefix[0]; + if (!isset($this->prefixesPsr0[$first][$prefix])) { + $this->prefixesPsr0[$first][$prefix] = (array) $paths; + + return; + } + if ($prepend) { + $this->prefixesPsr0[$first][$prefix] = array_merge( + (array) $paths, + $this->prefixesPsr0[$first][$prefix] + ); + } else { + $this->prefixesPsr0[$first][$prefix] = array_merge( + $this->prefixesPsr0[$first][$prefix], + (array) $paths + ); + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, either + * appending or prepending to the ones previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param string[]|string $paths The PSR-4 base directories + * @param bool $prepend Whether to prepend the directories + * + * @throws \InvalidArgumentException + * + * @return void + */ + public function addPsr4($prefix, $paths, $prepend = false) + { + if (!$prefix) { + // Register directories for the root namespace. + if ($prepend) { + $this->fallbackDirsPsr4 = array_merge( + (array) $paths, + $this->fallbackDirsPsr4 + ); + } else { + $this->fallbackDirsPsr4 = array_merge( + $this->fallbackDirsPsr4, + (array) $paths + ); + } + } elseif (!isset($this->prefixDirsPsr4[$prefix])) { + // Register directories for a new namespace. + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = (array) $paths; + } elseif ($prepend) { + // Prepend directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + (array) $paths, + $this->prefixDirsPsr4[$prefix] + ); + } else { + // Append directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + $this->prefixDirsPsr4[$prefix], + (array) $paths + ); + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, + * replacing any others previously set for this prefix. + * + * @param string $prefix The prefix + * @param string[]|string $paths The PSR-0 base directories + * + * @return void + */ + public function set($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr0 = (array) $paths; + } else { + $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, + * replacing any others previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param string[]|string $paths The PSR-4 base directories + * + * @throws \InvalidArgumentException + * + * @return void + */ + public function setPsr4($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr4 = (array) $paths; + } else { + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = (array) $paths; + } + } + + /** + * Turns on searching the include path for class files. + * + * @param bool $useIncludePath + * + * @return void + */ + public function setUseIncludePath($useIncludePath) + { + $this->useIncludePath = $useIncludePath; + } + + /** + * Can be used to check if the autoloader uses the include path to check + * for classes. + * + * @return bool + */ + public function getUseIncludePath() + { + return $this->useIncludePath; + } + + /** + * Turns off searching the prefix and fallback directories for classes + * that have not been registered with the class map. + * + * @param bool $classMapAuthoritative + * + * @return void + */ + public function setClassMapAuthoritative($classMapAuthoritative) + { + $this->classMapAuthoritative = $classMapAuthoritative; + } + + /** + * Should class lookup fail if not found in the current class map? + * + * @return bool + */ + public function isClassMapAuthoritative() + { + return $this->classMapAuthoritative; + } + + /** + * APCu prefix to use to cache found/not-found classes, if the extension is enabled. + * + * @param string|null $apcuPrefix + * + * @return void + */ + public function setApcuPrefix($apcuPrefix) + { + $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null; + } + + /** + * The APCu prefix in use, or null if APCu caching is not enabled. + * + * @return string|null + */ + public function getApcuPrefix() + { + return $this->apcuPrefix; + } + + /** + * Registers this instance as an autoloader. + * + * @param bool $prepend Whether to prepend the autoloader or not + * + * @return void + */ + public function register($prepend = false) + { + spl_autoload_register(array($this, 'loadClass'), true, $prepend); + + if (null === $this->vendorDir) { + return; + } + + if ($prepend) { + self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders; + } else { + unset(self::$registeredLoaders[$this->vendorDir]); + self::$registeredLoaders[$this->vendorDir] = $this; + } + } + + /** + * Unregisters this instance as an autoloader. + * + * @return void + */ + public function unregister() + { + spl_autoload_unregister(array($this, 'loadClass')); + + if (null !== $this->vendorDir) { + unset(self::$registeredLoaders[$this->vendorDir]); + } + } + + /** + * Loads the given class or interface. + * + * @param string $class The name of the class + * @return true|null True if loaded, null otherwise + */ + public function loadClass($class) + { + if ($file = $this->findFile($class)) { + includeFile($file); + + return true; + } + + return null; + } + + /** + * Finds the path to the file where the class is defined. + * + * @param string $class The name of the class + * + * @return string|false The path if found, false otherwise + */ + public function findFile($class) + { + // class map lookup + if (isset($this->classMap[$class])) { + return $this->classMap[$class]; + } + if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) { + return false; + } + if (null !== $this->apcuPrefix) { + $file = apcu_fetch($this->apcuPrefix.$class, $hit); + if ($hit) { + return $file; + } + } + + $file = $this->findFileWithExtension($class, '.php'); + + // Search for Hack files if we are running on HHVM + if (false === $file && defined('HHVM_VERSION')) { + $file = $this->findFileWithExtension($class, '.hh'); + } + + if (null !== $this->apcuPrefix) { + apcu_add($this->apcuPrefix.$class, $file); + } + + if (false === $file) { + // Remember that this class does not exist. + $this->missingClasses[$class] = true; + } + + return $file; + } + + /** + * Returns the currently registered loaders indexed by their corresponding vendor directories. + * + * @return self[] + */ + public static function getRegisteredLoaders() + { + return self::$registeredLoaders; + } + + /** + * @param string $class + * @param string $ext + * @return string|false + */ + private function findFileWithExtension($class, $ext) + { + // PSR-4 lookup + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; + + $first = $class[0]; + if (isset($this->prefixLengthsPsr4[$first])) { + $subPath = $class; + while (false !== $lastPos = strrpos($subPath, '\\')) { + $subPath = substr($subPath, 0, $lastPos); + $search = $subPath . '\\'; + if (isset($this->prefixDirsPsr4[$search])) { + $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); + foreach ($this->prefixDirsPsr4[$search] as $dir) { + if (file_exists($file = $dir . $pathEnd)) { + return $file; + } + } + } + } + } + + // PSR-4 fallback dirs + foreach ($this->fallbackDirsPsr4 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { + return $file; + } + } + + // PSR-0 lookup + if (false !== $pos = strrpos($class, '\\')) { + // namespaced class name + $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1) + . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); + } else { + // PEAR-like class name + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; + } + + if (isset($this->prefixesPsr0[$first])) { + foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { + if (0 === strpos($class, $prefix)) { + foreach ($dirs as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + } + } + } + + // PSR-0 fallback dirs + foreach ($this->fallbackDirsPsr0 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + + // PSR-0 include paths. + if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) { + return $file; + } + + return false; + } +} + +/** + * Scope isolated include. + * + * Prevents access to $this/self from included files. + * + * @param string $file + * @return void + * @private + */ +function includeFile($file) +{ + include $file; +} diff --git a/modules/steasyvideo/vendor/composer/InstalledVersions.php b/modules/steasyvideo/vendor/composer/InstalledVersions.php new file mode 100644 index 00000000..d50e0c9f --- /dev/null +++ b/modules/steasyvideo/vendor/composer/InstalledVersions.php @@ -0,0 +1,350 @@ + + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Composer; + +use Composer\Autoload\ClassLoader; +use Composer\Semver\VersionParser; + +/** + * This class is copied in every Composer installed project and available to all + * + * See also https://getcomposer.org/doc/07-runtime.md#installed-versions + * + * To require its presence, you can require `composer-runtime-api ^2.0` + */ +class InstalledVersions +{ + /** + * @var mixed[]|null + * @psalm-var array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array}|array{}|null + */ + private static $installed; + + /** + * @var bool|null + */ + private static $canGetVendors; + + /** + * @var array[] + * @psalm-var array}> + */ + private static $installedByVendor = array(); + + /** + * Returns a list of all package names which are present, either by being installed, replaced or provided + * + * @return string[] + * @psalm-return list + */ + public static function getInstalledPackages() + { + $packages = array(); + foreach (self::getInstalled() as $installed) { + $packages[] = array_keys($installed['versions']); + } + + if (1 === \count($packages)) { + return $packages[0]; + } + + return array_keys(array_flip(\call_user_func_array('array_merge', $packages))); + } + + /** + * Returns a list of all package names with a specific type e.g. 'library' + * + * @param string $type + * @return string[] + * @psalm-return list + */ + public static function getInstalledPackagesByType($type) + { + $packagesByType = array(); + + foreach (self::getInstalled() as $installed) { + foreach ($installed['versions'] as $name => $package) { + if (isset($package['type']) && $package['type'] === $type) { + $packagesByType[] = $name; + } + } + } + + return $packagesByType; + } + + /** + * Checks whether the given package is installed + * + * This also returns true if the package name is provided or replaced by another package + * + * @param string $packageName + * @param bool $includeDevRequirements + * @return bool + */ + public static function isInstalled($packageName, $includeDevRequirements = true) + { + foreach (self::getInstalled() as $installed) { + if (isset($installed['versions'][$packageName])) { + return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']); + } + } + + return false; + } + + /** + * Checks whether the given package satisfies a version constraint + * + * e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call: + * + * Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3') + * + * @param VersionParser $parser Install composer/semver to have access to this class and functionality + * @param string $packageName + * @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package + * @return bool + */ + public static function satisfies(VersionParser $parser, $packageName, $constraint) + { + $constraint = $parser->parseConstraints($constraint); + $provided = $parser->parseConstraints(self::getVersionRanges($packageName)); + + return $provided->matches($constraint); + } + + /** + * Returns a version constraint representing all the range(s) which are installed for a given package + * + * It is easier to use this via isInstalled() with the $constraint argument if you need to check + * whether a given version of a package is installed, and not just whether it exists + * + * @param string $packageName + * @return string Version constraint usable with composer/semver + */ + public static function getVersionRanges($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + $ranges = array(); + if (isset($installed['versions'][$packageName]['pretty_version'])) { + $ranges[] = $installed['versions'][$packageName]['pretty_version']; + } + if (array_key_exists('aliases', $installed['versions'][$packageName])) { + $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']); + } + if (array_key_exists('replaced', $installed['versions'][$packageName])) { + $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']); + } + if (array_key_exists('provided', $installed['versions'][$packageName])) { + $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']); + } + + return implode(' || ', $ranges); + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present + */ + public static function getVersion($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + if (!isset($installed['versions'][$packageName]['version'])) { + return null; + } + + return $installed['versions'][$packageName]['version']; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present + */ + public static function getPrettyVersion($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + if (!isset($installed['versions'][$packageName]['pretty_version'])) { + return null; + } + + return $installed['versions'][$packageName]['pretty_version']; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference + */ + public static function getReference($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + if (!isset($installed['versions'][$packageName]['reference'])) { + return null; + } + + return $installed['versions'][$packageName]['reference']; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path. + */ + public static function getInstallPath($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @return array + * @psalm-return array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string} + */ + public static function getRootPackage() + { + $installed = self::getInstalled(); + + return $installed[0]['root']; + } + + /** + * Returns the raw installed.php data for custom implementations + * + * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect. + * @return array[] + * @psalm-return array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array} + */ + public static function getRawData() + { + @trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED); + + if (null === self::$installed) { + // only require the installed.php file if this file is loaded from its dumped location, + // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 + if (substr(__DIR__, -8, 1) !== 'C') { + self::$installed = include __DIR__ . '/installed.php'; + } else { + self::$installed = array(); + } + } + + return self::$installed; + } + + /** + * Returns the raw data of all installed.php which are currently loaded for custom implementations + * + * @return array[] + * @psalm-return list}> + */ + public static function getAllRawData() + { + return self::getInstalled(); + } + + /** + * Lets you reload the static array from another file + * + * This is only useful for complex integrations in which a project needs to use + * this class but then also needs to execute another project's autoloader in process, + * and wants to ensure both projects have access to their version of installed.php. + * + * A typical case would be PHPUnit, where it would need to make sure it reads all + * the data it needs from this class, then call reload() with + * `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure + * the project in which it runs can then also use this class safely, without + * interference between PHPUnit's dependencies and the project's dependencies. + * + * @param array[] $data A vendor/composer/installed.php data set + * @return void + * + * @psalm-param array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array} $data + */ + public static function reload($data) + { + self::$installed = $data; + self::$installedByVendor = array(); + } + + /** + * @return array[] + * @psalm-return list}> + */ + private static function getInstalled() + { + if (null === self::$canGetVendors) { + self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders'); + } + + $installed = array(); + + if (self::$canGetVendors) { + foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) { + if (isset(self::$installedByVendor[$vendorDir])) { + $installed[] = self::$installedByVendor[$vendorDir]; + } elseif (is_file($vendorDir.'/composer/installed.php')) { + $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php'; + if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { + self::$installed = $installed[count($installed) - 1]; + } + } + } + } + + if (null === self::$installed) { + // only require the installed.php file if this file is loaded from its dumped location, + // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 + if (substr(__DIR__, -8, 1) !== 'C') { + self::$installed = require __DIR__ . '/installed.php'; + } else { + self::$installed = array(); + } + } + $installed[] = self::$installed; + + return $installed; + } +} diff --git a/modules/steasyvideo/vendor/composer/LICENSE b/modules/steasyvideo/vendor/composer/LICENSE new file mode 100644 index 00000000..f27399a0 --- /dev/null +++ b/modules/steasyvideo/vendor/composer/LICENSE @@ -0,0 +1,21 @@ + +Copyright (c) Nils Adermann, Jordi Boggiano + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + diff --git a/modules/steasyvideo/vendor/composer/autoload_classmap.php b/modules/steasyvideo/vendor/composer/autoload_classmap.php new file mode 100644 index 00000000..0fd33ceb --- /dev/null +++ b/modules/steasyvideo/vendor/composer/autoload_classmap.php @@ -0,0 +1,12 @@ + $vendorDir . '/composer/InstalledVersions.php', + 'PrestaShop\\Module\\StEasyVideo\\Repository\\VideoRepository' => $baseDir . '/src/Repository/VideoRepository.php', + 'StEasyVideo' => $baseDir . '/steasyvideo.php', +); diff --git a/modules/steasyvideo/vendor/composer/autoload_namespaces.php b/modules/steasyvideo/vendor/composer/autoload_namespaces.php new file mode 100644 index 00000000..b7fc0125 --- /dev/null +++ b/modules/steasyvideo/vendor/composer/autoload_namespaces.php @@ -0,0 +1,9 @@ + array($baseDir . '/src'), +); diff --git a/modules/steasyvideo/vendor/composer/autoload_real.php b/modules/steasyvideo/vendor/composer/autoload_real.php new file mode 100644 index 00000000..a7347344 --- /dev/null +++ b/modules/steasyvideo/vendor/composer/autoload_real.php @@ -0,0 +1,48 @@ += 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); + if ($useStaticLoader) { + require __DIR__ . '/autoload_static.php'; + + call_user_func(\Composer\Autoload\ComposerStaticInit409bb44f31d5474bbf9ab50b7b661a82::getInitializer($loader)); + } else { + $classMap = require __DIR__ . '/autoload_classmap.php'; + if ($classMap) { + $loader->addClassMap($classMap); + } + } + + $loader->setClassMapAuthoritative(true); + $loader->register(false); + + return $loader; + } +} diff --git a/modules/steasyvideo/vendor/composer/autoload_static.php b/modules/steasyvideo/vendor/composer/autoload_static.php new file mode 100644 index 00000000..4f8e18ce --- /dev/null +++ b/modules/steasyvideo/vendor/composer/autoload_static.php @@ -0,0 +1,38 @@ + + array ( + 'PrestaShop\\Module\\StEasyVideo\\' => 30, + ), + ); + + public static $prefixDirsPsr4 = array ( + 'PrestaShop\\Module\\StEasyVideo\\' => + array ( + 0 => __DIR__ . '/../..' . '/src', + ), + ); + + public static $classMap = array ( + 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', + 'PrestaShop\\Module\\StEasyVideo\\Repository\\VideoRepository' => __DIR__ . '/../..' . '/src/Repository/VideoRepository.php', + 'StEasyVideo' => __DIR__ . '/../..' . '/steasyvideo.php', + ); + + public static function getInitializer(ClassLoader $loader) + { + return \Closure::bind(function () use ($loader) { + $loader->prefixLengthsPsr4 = ComposerStaticInit409bb44f31d5474bbf9ab50b7b661a82::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit409bb44f31d5474bbf9ab50b7b661a82::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInit409bb44f31d5474bbf9ab50b7b661a82::$classMap; + + }, null, ClassLoader::class); + } +} diff --git a/modules/steasyvideo/vendor/composer/installed.json b/modules/steasyvideo/vendor/composer/installed.json new file mode 100644 index 00000000..87fda747 --- /dev/null +++ b/modules/steasyvideo/vendor/composer/installed.json @@ -0,0 +1,5 @@ +{ + "packages": [], + "dev": true, + "dev-package-names": [] +} diff --git a/modules/steasyvideo/vendor/composer/installed.php b/modules/steasyvideo/vendor/composer/installed.php new file mode 100644 index 00000000..a54d9072 --- /dev/null +++ b/modules/steasyvideo/vendor/composer/installed.php @@ -0,0 +1,23 @@ + array( + 'pretty_version' => '1.0.0+no-version-set', + 'version' => '1.0.0.0', + 'type' => 'prestashop-module', + 'install_path' => __DIR__ . '/../../', + 'aliases' => array(), + 'reference' => NULL, + 'name' => 'prestashop/steasyvideo', + 'dev' => true, + ), + 'versions' => array( + 'prestashop/steasyvideo' => array( + 'pretty_version' => '1.0.0+no-version-set', + 'version' => '1.0.0.0', + 'type' => 'prestashop-module', + 'install_path' => __DIR__ . '/../../', + 'aliases' => array(), + 'reference' => NULL, + 'dev_requirement' => false, + ), + ), +); diff --git a/modules/steasyvideo/vendor/composer/platform_check.php b/modules/steasyvideo/vendor/composer/platform_check.php new file mode 100644 index 00000000..8b379f44 --- /dev/null +++ b/modules/steasyvideo/vendor/composer/platform_check.php @@ -0,0 +1,26 @@ += 50600)) { + $issues[] = 'Your Composer dependencies require a PHP version ">= 5.6.0". You are running ' . PHP_VERSION . '.'; +} + +if ($issues) { + if (!headers_sent()) { + header('HTTP/1.1 500 Internal Server Error'); + } + if (!ini_get('display_errors')) { + if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { + fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL); + } elseif (!headers_sent()) { + echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL; + } + } + trigger_error( + 'Composer detected issues in your platform: ' . implode(' ', $issues), + E_USER_ERROR + ); +} diff --git a/modules/steasyvideo/views/css/admin.css b/modules/steasyvideo/views/css/admin.css new file mode 100644 index 00000000..d925d9fc --- /dev/null +++ b/modules/steasyvideo/views/css/admin.css @@ -0,0 +1,22 @@ +#conf_id_ST_EASY_VIDEO_GALLERY_VIDEO_SELECTOR_DESKTOP, +#conf_id_ST_EASY_VIDEO_GALLERY_BUTTON_SELECTOR_DESKTOP, +#conf_id_ST_EASY_VIDEO_GALLERY_TYPE_DESKTOP, +#conf_id_ST_EASY_VIDEO_GALLERY_THUMBNAIL_TYPE_DESKTOP, +#conf_id_ST_EASY_VIDEO_GALLERY_THUMBNAIL_SELECTOR_DESKTOP, +#conf_id_ST_EASY_VIDEO_GALLERY_VIDEO_TEMPLATE_DESKTOP, +#conf_id_ST_EASY_VIDEO_GALLERY_VIDEO_SELECTOR_MOBILE, +#conf_id_ST_EASY_VIDEO_GALLERY_BUTTON_SELECTOR_MOBILE, +#conf_id_ST_EASY_VIDEO_GALLERY_TYPE_MOBILE, +#conf_id_ST_EASY_VIDEO_GALLERY_THUMBNAIL_TYPE_MOBILE, +#conf_id_ST_EASY_VIDEO_GALLERY_THUMBNAIL_SELECTOR_MOBILE, +#conf_id_ST_EASY_VIDEO_GALLERY_VIDEO_TEMPLATE_MOBILE, +#conf_id_ST_EASY_VIDEO_GALLERY_VIDEO_SELECTOR_QUICKVIEW, +#conf_id_ST_EASY_VIDEO_GALLERY_BUTTON_SELECTOR_QUICKVIEW, +#conf_id_ST_EASY_VIDEO_GALLERY_TYPE_QUICKVIEW, +#conf_id_ST_EASY_VIDEO_GALLERY_THUMBNAIL_TYPE_QUICKVIEW, +#conf_id_ST_EASY_VIDEO_GALLERY_THUMBNAIL_SELECTOR_QUICKVIEW, +#conf_id_ST_EASY_VIDEO_GALLERY_VIDEO_TEMPLATE_QUICKVIEW +{ + border-top: 1px solid #BBCDD2; + padding-top: 19px; +} \ No newline at end of file diff --git a/modules/steasyvideo/views/css/front.css b/modules/steasyvideo/views/css/front.css new file mode 100644 index 00000000..d8624813 --- /dev/null +++ b/modules/steasyvideo/views/css/front.css @@ -0,0 +1,150 @@ +.st_easy_video_box{ + position: relative; + background: #fff; +} +.st_easy_video_box.st_easy_video_box_absolute{ + position: absolute; + z-index: 9; + top: 0; + right: 0; + bottom: 0; + left: 0; +} +.pro_gallery_top .st_easy_video_box{ +} +@media (min-width: 1200px){ +} +@media only screen and (max-width: 991px) and (min-width: 768px){ +} +@media (max-width: 767px){ +} + +.pro_video_cover_invisible .pro_gallery_thumb, .hightlight_curr_thumbs .pro_video_cover_invisible.clicked_thumb .pro_gallery_thumb, .st_easy_video_placeholder, .st_easy_video_thumb_invisiable .thumb,.st_easy_video_no_image_thumb{ + opacity: 0; +} +.pro_video_cover_invisible .pro_gallery_thumb_box{ + border: none; +} +.st_easy_video_btn:focus,.video-js button:focus{ +outline: none; +} +.st_easy_video.video-js{position: static;} +.st_easy_video_btn{ + position: relative; + cursor: pointer; + z-index: 10; + outline: none; + border:none; + background: transparent; + text-align: center; + padding: 0; + display: flex; + align-items: center; + justify-content: center; +} +.st_easy_video_btn.st_easy_video_btn_absolute{ + position: absolute; +} +.st_easy_video_btn .vjs-icon-placeholder{ + display: block; + width:36px; + height: 36px; + line-height: 36px; + background: rgba(0,0,0,0.5); + color: #fff; + font-size: 22px; + border-radius: 100%; + padding: 0; + border:none; + border-style: solid; + border-width: 0; + font-size: 30px; + box-sizing: border-box; +} +.st_play_video_text{display: block;} +.st_easy_video_btn.st_easy_video_close{ + right: 10px; top: 10px;left:auto;bottom: auto; +} +.st_easy_video_play_icon{pointer-events:none;} +.pro_gallery_thumbs_container .st_easy_video_play, +.st_easy_video_play_icon{ + left: 50%; + top: 50%; + margin-left: -18px; + margin-top: -18px; + bottom: auto; +} +.st_easy_video_btn .vjs-icon-placeholder:before{ + width: 100%; + height: 100%; + text-align: center; + font-family: VideoJS; + font-weight: normal; + font-style: normal; + content: "\f101"; +} +.st_easy_video_btn.st_easy_video_close .vjs-icon-placeholder:before{ + content: "\f119"; +} + +.st_easy_video_play{z-index: 10;} +.st_easy_video_flex{display:-webkit-box;display:-moz-box;display:box;display:-moz-flex;display:-ms-flexbox;display:flex;-webkit-box-align:center;box-align:center;-moz-align-items:center;-ms-align-items:center;-o-align-items:center;align-items:center;-ms-flex-align:center} +.st_easy_video_invisible, .st_easy_video_btn.st_easy_video_invisible{display: none;} +.pro_popup_trigger.layer_icon_wrap.st_active.st_easy_video_invisible{ + display: none; +} + +.product-images>li.thumb-container{position: relative;} +.st_easy_video_relative{ + position: relative; +} +.st_easy_video_absolute{ + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; +} +.st_easy_video_layer{ + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + background: #fff; +} +.vjs-youtube-mobile .vjs-big-play-button { display: none!important; } +.vjs-youtube-mobile .vjs-resize-manager { display: none!important; } +.st_easy_video_controls_youtubev .js-youtube .vjs-poster{display: none;}/*when youtube control is on, youtube de poster hui ba bo fang qi dang zhu*/ +.st_easy_video_miaoshu{margin-bottom: 30px;} +.st_easy_video_miaoshu .st_easy_video_invisible{display: block;} +.st_easy_video_miaoshu .st_easy_video_box{position: relative;} +#product-images-large .slick-slide{position:relative;} /*for warehouse theme*/ + + +.st_easy_video_play_layout_0 .st_play_video_text{ + display: none; +} +.st_easy_video_play_layout_1 .vjs-icon-placeholder{ + display: none; +} +.st_easy_video_play_layout_2{ +} +.st_easy_video_play_layout_3{ + flex-direction: column; +} +.st_easy_video_screen_only +{ + position: absolute; + top: -10000em; //for safari browser compatibility + width: 1px; + height: 1px; + margin: -1px; + padding: 0; + overflow: hidden; + clip: rect(0,0,0,0); + border: 0; +} + +#st_easy_video_device_mode:after {content: 'desktop';} +/*@media (max-width: 767px){#st_easy_video_device_mode:after {content: 'mobile';}}*/ \ No newline at end of file diff --git a/modules/steasyvideo/views/css/index.php b/modules/steasyvideo/views/css/index.php new file mode 100644 index 00000000..b36c776a --- /dev/null +++ b/modules/steasyvideo/views/css/index.php @@ -0,0 +1,34 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/modules/steasyvideo/views/css/skin-0.css b/modules/steasyvideo/views/css/skin-0.css new file mode 100644 index 00000000..24fc1d24 --- /dev/null +++ b/modules/steasyvideo/views/css/skin-0.css @@ -0,0 +1,72 @@ +/* + Player Skin Designer for Video.js + http://videojs.com + + To customize the player skin edit + the CSS below. Click "details" + below to add comments or questions. + This file uses some SCSS. Learn more + at http://sass-lang.com/guide) + + This designer can be linked to at: + https://codepen.io/heff/pen/EarCt/left/?editors=010 +*/ +.video-js { + /* The base font size controls the size of everything, not just text. + All dimensions use em-based sizes so that the scale along with the font size. + Try increasing it to 15px and see what happens. */ + font-size: 10px; + /* The main font color changes the ICON COLORS as well as the text */ + color: #ffffff; +} + +/* The "Big Play Button" is the play button that shows before the video plays. + To center it set the align values to center and middle. The typical location + of the button is the center, but there is trend towards moving it to a corner + where it gets out of the way of valuable content in the poster image.*/ +.video-js.vjs-big-play-centered .vjs-big-play-button { + /* The font size is what makes the big play button...big. + All width/height values use ems, which are a multiple of the font size. + If the .video-js font-size is 10px, then 3em equals 30px.*/ + font-size: 50px; + /* We're using SCSS vars here because the values are used in multiple places. + Now that font size is set, the following em values will be a multiple of the + new font size. If the font-size is 3em (30px), then setting any of + the following values to 3em would equal 30px. 3 * font-size. */ + /* 1.5em = 45px default */ + line-height: 50px; + height: 50px; + width: 50px; + /* 0.06666em = 2px default */ + border: 0; + /* 0.3em = 9px default */ + border-radius: 0.3em; + /* Align center */ + left: 50%; + top: 50%; + margin-left: -25px; + margin-top: -25px; + background: transparent; +} + +/* The default color of control backgrounds is mostly black but with a little + bit of blue so it can still be seen on all-black video frames, which are common. */ +.video-js .vjs-control-bar, +.video-js .vjs-big-play-button, +.video-js .vjs-menu-button .vjs-menu-content { + background-color: transparent; +} + +/* Slider - used for Volume bar and Progress bar */ +.video-js .vjs-slider, .video-js .vjs-load-progress { + background-color: rgba(255,255,255,0.3); +} +.video-js .vjs-load-progress div{ background-color: rgba(115, 133, 159, 0.75);} + +/* The slider bar color is used for the progress bar and the volume bar + (the first two can be removed after a fix that's coming) */ +.video-js .vjs-volume-level, +.video-js .vjs-play-progress, +.video-js .vjs-slider-bar { + background: #fff; +} diff --git a/modules/steasyvideo/views/css/skin-1.css b/modules/steasyvideo/views/css/skin-1.css new file mode 100644 index 00000000..0a80f80f --- /dev/null +++ b/modules/steasyvideo/views/css/skin-1.css @@ -0,0 +1,78 @@ +/* + Player Skin Designer for Video.js + http://videojs.com + + To customize the player skin edit + the CSS below. Click "details" + below to add comments or questions. + This file uses some SCSS. Learn more + at http://sass-lang.com/guide) + + This designer can be linked to at: + https://codepen.io/heff/pen/EarCt/left/?editors=010 +*/ +.video-js { + /* The base font size controls the size of everything, not just text. + All dimensions use em-based sizes so that the scale along with the font size. + Try increasing it to 15px and see what happens. */ + font-size: 10px; + /* The main font color changes the ICON COLORS as well as the text */ + color: #465324; +} + +/* The "Big Play Button" is the play button that shows before the video plays. + To center it set the align values to center and middle. The typical location + of the button is the center, but there is trend towards moving it to a corner + where it gets out of the way of valuable content in the poster image.*/ +.video-js.vjs-big-play-centered .vjs-big-play-button { + /* The font size is what makes the big play button...big. + All width/height values use ems, which are a multiple of the font size. + If the .video-js font-size is 10px, then 3em equals 30px.*/ + font-size: 2.5em; + /* We're using SCSS vars here because the values are used in multiple places. + Now that font size is set, the following em values will be a multiple of the + new font size. If the font-size is 3em (30px), then setting any of + the following values to 3em would equal 30px. 3 * font-size. */ + /* 1.5em = 45px default */ + line-height: 1.5em; + height: 1.5em; + width: 2em; + /* 0.06666em = 2px default */ + border: 0.06666em solid #465324; + /* 0.3em = 9px default */ + border-radius: 0.2em; + /* Align center */ + left: 50%; + top: 50%; + margin-left: -1em; + margin-top: -0.75em; +} + +/* The default color of control backgrounds is mostly black but with a little + bit of blue so it can still be seen on all-black video frames, which are common. */ +.video-js .vjs-control-bar, +.video-js .vjs-big-play-button, +.video-js .vjs-menu-button .vjs-menu-content { + background-color: rgba(0, 0, 0, 0.9); +} + +/* Slider - used for Volume bar and Progress bar */ +.video-js .vjs-slider, .video-js .vjs-load-progress { + background-color: rgba(230, 230, 230, 0.9); +} +.video-js .vjs-load-progress div{ background-color: rgba(230, 230, 230, 0.9);} + +/* The slider bar color is used for the progress bar and the volume bar + (the first two can be removed after a fix that's coming) */ +.video-js .vjs-volume-level, +.video-js .vjs-play-progress, +.video-js .vjs-slider-bar { + background: #465324; +} + + +.video-js:hover .vjs-big-play-button, +.video-js .vjs-big-play-button:focus { + background-color: rgba(0, 0, 0, 0.95); + border-color: #647733; +} diff --git a/modules/steasyvideo/views/css/skin-2.css b/modules/steasyvideo/views/css/skin-2.css new file mode 100644 index 00000000..cb741f1f --- /dev/null +++ b/modules/steasyvideo/views/css/skin-2.css @@ -0,0 +1,77 @@ +/* + Player Skin Designer for Video.js + http://videojs.com + + To customize the player skin edit + the CSS below. Click "details" + below to add comments or questions. + This file uses some SCSS. Learn more + at http://sass-lang.com/guide) + + This designer can be linked to at: + https://codepen.io/heff/pen/EarCt/left/?editors=010 +*/ +.video-js { + /* The base font size controls the size of everything, not just text. + All dimensions use em-based sizes so that the scale along with the font size. + Try increasing it to 15px and see what happens. */ + font-size: 10px; + /* The main font color changes the ICON COLORS as well as the text */ + color: #ffffff; +} + +/* The "Big Play Button" is the play button that shows before the video plays. + To center it set the align values to center and middle. The typical location + of the button is the center, but there is trend towards moving it to a corner + where it gets out of the way of valuable content in the poster image.*/ +.video-js.vjs-big-play-centered .vjs-big-play-button { + /* The font size is what makes the big play button...big. + All width/height values use ems, which are a multiple of the font size. + If the .video-js font-size is 10px, then 3em equals 30px.*/ + font-size: 2.5em; + /* We're using SCSS vars here because the values are used in multiple places. + Now that font size is set, the following em values will be a multiple of the + new font size. If the font-size is 3em (30px), then setting any of + the following values to 3em would equal 30px. 3 * font-size. */ + /* 1.5em = 45px default */ + line-height: 1.5em; + height: 1.5em; + width: 2em; + /* 0.06666em = 2px default */ + border: none; + /* 0.3em = 9px default */ + border-radius: 10px; + /* Align center */ + left: 50%; + top: 50%; + margin-left: -1em; + margin-top: -0.75em; + background: rgba(0,0,0,0.5); +} + +/* The default color of control backgrounds is mostly black but with a little + bit of blue so it can still be seen on all-black video frames, which are common. */ +.video-js .vjs-control-bar, +.video-js .vjs-big-play-button, +.video-js .vjs-menu-button .vjs-menu-content { + background-color: rgba(0, 0, 0, 0.3); +} + +/* Slider - used for Volume bar and Progress bar */ +.video-js .vjs-slider, .video-js .vjs-load-progress { + background-color: rgba(115,133,159,0.5); +} +.video-js .vjs-load-progress div{ background-color: rgba(255,255,255,0.5);} +/* The slider bar color is used for the progress bar and the volume bar + (the first two can be removed after a fix that's coming) */ +.video-js .vjs-volume-level, +.video-js .vjs-play-progress, +.video-js .vjs-slider-bar { + background: #cc181e; +} + + +.video-js:hover .vjs-big-play-button, +.video-js .vjs-big-play-button:focus { + background-color: #cc181e; +} diff --git a/modules/steasyvideo/views/css/skin-3.css b/modules/steasyvideo/views/css/skin-3.css new file mode 100644 index 00000000..9a3b9a29 --- /dev/null +++ b/modules/steasyvideo/views/css/skin-3.css @@ -0,0 +1,71 @@ +/* + Player Skin Designer for Video.js + http://videojs.com + + To customize the player skin edit + the CSS below. Click "details" + below to add comments or questions. + This file uses some SCSS. Learn more + at http://sass-lang.com/guide) + + This designer can be linked to at: + https://codepen.io/heff/pen/EarCt/left/?editors=010 +*/ +.video-js { + /* The base font size controls the size of everything, not just text. + All dimensions use em-based sizes so that the scale along with the font size. + Try increasing it to 15px and see what happens. */ + font-size: 10px; + /* The main font color changes the ICON COLORS as well as the text */ + color: #ffffff; +} + +/* The "Big Play Button" is the play button that shows before the video plays. + To center it set the align values to center and middle. The typical location + of the button is the center, but there is trend towards moving it to a corner + where it gets out of the way of valuable content in the poster image.*/ +.video-js.vjs-big-play-centered .vjs-big-play-button { + /* The font size is what makes the big play button...big. + All width/height values use ems, which are a multiple of the font size. + If the .video-js font-size is 10px, then 3em equals 30px.*/ + font-size: 3em; + /* We're using SCSS vars here because the values are used in multiple places. + Now that font size is set, the following em values will be a multiple of the + new font size. If the font-size is 3em (30px), then setting any of + the following values to 3em would equal 30px. 3 * font-size. */ + /* 1.5em = 45px default */ + line-height: 1.9em; + height: 2em; + width: 2em; + /* 0.06666em = 2px default */ + border: 3px solid #ffffff; + /* 0.3em = 9px default */ + border-radius: 2em; + /* Align center */ + left: 50%; + top: 50%; + margin-left: -1em; + margin-top: -1em; + background: rgba(0,0,0,0.35); +} + +/* The default color of control backgrounds is mostly black but with a little + bit of blue so it can still be seen on all-black video frames, which are common. */ +.video-js .vjs-control-bar, +.video-js .vjs-big-play-button, +.video-js .vjs-menu-button .vjs-menu-content { + background-color: transparent; +} + +/* Slider - used for Volume bar and Progress bar */ +.video-js .vjs-slider, .video-js .vjs-load-progress { + background-color: rgba(115,133,159,0.5); +} +.video-js .vjs-load-progress div{ background-color: rgba(255,255,255,0.5);} +/* The slider bar color is used for the progress bar and the volume bar + (the first two can be removed after a fix that's coming) */ +.video-js .vjs-volume-level, +.video-js .vjs-play-progress, +.video-js .vjs-slider-bar { + background: #2483d5; +} diff --git a/modules/steasyvideo/views/css/video-js.css b/modules/steasyvideo/views/css/video-js.css new file mode 100644 index 00000000..4d5e1009 --- /dev/null +++ b/modules/steasyvideo/views/css/video-js.css @@ -0,0 +1,2011 @@ +.vjs-svg-icon { + display: inline-block; + background-repeat: no-repeat; + background-position: center; + fill: currentColor; + height: 1.8em; + width: 1.8em; +} +.vjs-svg-icon:before { + content: none !important; +} + +.vjs-svg-icon:hover, +.vjs-control:focus .vjs-svg-icon { + filter: drop-shadow(0 0 0.25em #fff); +} + +.vjs-modal-dialog .vjs-modal-dialog-content, .video-js .vjs-modal-dialog, .vjs-button > .vjs-icon-placeholder:before, .video-js .vjs-big-play-button .vjs-icon-placeholder:before { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; +} + +.vjs-button > .vjs-icon-placeholder:before, .video-js .vjs-big-play-button .vjs-icon-placeholder:before { + text-align: center; +} + +@font-face { + font-family: VideoJS; + src: url(data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAABTsAAsAAAAAIpAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAADsAAABUIIslek9TLzIAAAFEAAAAPgAAAFZRiV32Y21hcAAAAYQAAAEJAAAD5p42+VxnbHlmAAACkAAADtIAABckI4l972hlYWQAABFkAAAAKwAAADYsvIjpaGhlYQAAEZAAAAAdAAAAJA+RCL1obXR4AAARsAAAABcAAAC8Q2YAAGxvY2EAABHIAAAAYAAAAGB7CIGGbWF4cAAAEigAAAAfAAAAIAFAAI9uYW1lAAASSAAAASUAAAIK1cf1oHBvc3QAABNwAAABfAAAAnXdFqh1eJxjYGRgYOBiMGCwY2BycfMJYeDLSSzJY5BiYGGAAJA8MpsxJzM9kYEDxgPKsYBpDiBmg4gCACY7BUgAeJxjYGR7yDiBgZWBgaWQ5RkDA8MvCM0cwxDOeI6BgYmBlZkBKwhIc01hcPjI+FGPHcRdyA4RZgQRADaGCyYAAHic7dPXbcMwAEXRK1vuvffem749XAbKV3bjBA6fXsaIgMMLEWoQJaAEFKNnlELyQ4K27zib5PNF6vl8yld+TKr5kH0+cUw0xv00Hwvx2DResUyFKrV4XoMmLdp06NKjz4AhI8ZMmDJjzoIlK9Zs2LJjz4EjJ85cuHLjziPe/0UWL17mf2tqKLz/9jK9f8tXpGCoRdPKhtS0RqFkWvVQNtSKoVYNtWaoddPXEBqG2jQ9XWgZattQO4baNdSeofYNdWCoQ0MdGerYUCeGOjXUmaHODXVhqEtDXRnq2lA3hro11J2h7g31YKhHQz0Z6tlQL4Z6NdSbod4N9WGoT9MfHF6GmhnZLxyDcRMAAAB4nJ1YC1hU17U+a5/HMA4iA3NmVBDmoQwP5TFnHlFeA4gYiUFRQINoSCBAyK3G2yi+0aipYtFcHYo2xsb4NiY3+VrNxSaX5uvt495ozNdoYoxmem2/L8HGpLc+InB279pnhlGr5mvL4eyz99nrrL32eu1/DQcc/okdYgdHOA6MQKp4r9gx0EcMHMezOalVasW5BM7NcXoSb9fFgE6KtSSBxWz1FYDPG+vMBGcKb9cebu2VS5s2aaTkCvRSf6C7Y+Ppibm5E09v7IDs2/3uZQtbD0zIyppwoHXh/93ukmyYgdePNRp65p5v+3v/9otQl2O7wP34cT88p8Md2YxpYLQZoRcy6FlSBRnwnGAe6BPMSCZo+7NJVqS0cE4uHendzhSnbPH6TDqL1+Nme5LZXkCHnGyoH0kne30WH+gswhm3q+pt/mTas9NLS64GnjmSlTPw0wVQT/ewRaBgxtydy3cuUB9/6SW+vb5yRvr+t0eOfPKJZ/9t3+4tL7xj32Xd3thCxi+ge6ifdsAN+l5+wi5HQ/cCoeull1AszS7CUfEcJzK7sKWJAdJhCd0sPM4+EY7QDm5ov08hXRQXE5bf6PV5Q5+IjW7X7Nku92Ask4l2hCRRD6TPqISiCJeQna3SCFwrhrNzXHzo4yFevBwxpzxk8WCIIfkvVEKVy32SbT8n68gzgaslpaiO2zIGIyuSb7RNf9HSuN26y/7OC1tgEmpiyA6aD4qcgTOiLThwGG0eB694FI8NHLLN6OBlRVaMxNAFS4JdXUG6mW8PwpKuYLCLXKGbu8iwYNdgO06Sn3Th+/vyZAxs8Ro30DjHe9gy8Fywi24OMm7Qyzh3MTZVOMYhLBnoC+J79lpTUyQmorjhnMwlcQ5uPEYGpDjsOkkH49BjQLQBqs3jFtFdJNlksYmoQFDArLh8Xh+Qd6Ghcsb6FUuehDi+U/lqD71K/qiegeV1imcwjl7ExwiSrf4BZyCujV6cVcFo6VX+G9IcPyFjJnUufbU/jzrL1X99as36reXl8K32nFaOr+E8jWJEcJ55DpMVfSMe95/AJaOsGBH2GJCNpiRQbK4C8BjdmQA22QY2j03Em13i2YHqtNLU1NI04Yj2HJgA6fQc6VPNpA/D+Ryks554NnVy2mB72uRUfPLsqR4N0LOBQKArwJYO+5W2fgZX8oC1HR6HjNaQTVIG2FPwnTcXXGZZfNB7TE6pTKZUwaw91XWLAoFFGcnB5PHjsckgBjbWutrL+0h5Y1xw3DRGDumsnXb3MJwXrJIN5U7m0rgJ3yG5w4he5ckFG4pmNEkOm0/xOO4r4yL87wqtQM+hiJIVp+6iG2wPBKD35ElGkDx+UfC2v1mFG1o+M3AjNFty8biKMXwzyxnZLds8wYD2BxmCPHAldPOeLsy/0BugftYhVYFAhO8SqQ0j3oK7dHJZnI/jxmUS4onlxskSF8thmvNZjIrRZwEPxr0lBuLRuz3oy/FOHCsxwOPYh2M+e9u3J5pgPYz9gp6G7C9m0A11F9ddqKMfV+4sbq45/YspOysXvT+3pdFdYNg2fHbW8Dz301MqDVuGrz0Fuh0YMW8mddrpqzST7rV9BcvqPoNvadRndWp0p8HvbiqrFj5yFQ/vNFSXDpxpLEFWp+DcrF3FT1afWshFcmCfeAMjEvO65i0Y6XijQfSRPWx3TV/Df7Km3E1l+kLt56s/rwVzuRusNMhudznkwdLaS+QNdeal2jDPP4l9qHc98vTYZOSkxzD+njBWVWjFPKgipx6DkWvXQiW8OYcewVHE5yukinDMcfGgc0opDltYKDxIGBedkzc6jSfE7tlvESCDFUw0Hx0opS+U0lHCxNottbNWSxX9zZVvEhKWUSyBpaXwBc2a98M6UqPeXAs/GDon8Ax7hsthO8cM5HU7Ad0UvRR9lHmtyQKZ4MAe814X5h9MSUkQmhf96eVJ6p90OjIiqSIjvykvr2l5U55O/fPQKD+jIomYpNyGJQ25uQ2kIikRfAmuBHCPsWqkSDEqgZ5KDI2sifS/R43MbZg0idFHbCPNxXxZws1ACVE6hAhOdJwRkJLFBLPZpRGYJ50pko6XzMkgmSx40ljik6AQcKhFnLcQE6rF7PXFe1Ocoj0T3AXgSgJTDIhHRfHlYZKuSzc6uievOJGXY+i5GJkkTp7UM3y0LqATDbtFcbdBxO7o4T25JYlEjoH0uynUh8rapkxp62QN70svSF+hT4gGPlovlmcm/ComLi7mV4kTykV9NFWjE/QrwgQ4uIcAP0rQF4VZYRP2o3PhHHzfPMJj9Ir+uzKUlrH49ntT18AVvj1sc3YGjUT/Mt2Dxawa8ArcA7bCQIpvfwAYu22vEG/No/5RvPdA7g+AelLrPwzy+LtkLPhnpIxH14m4EYq8eeMHbPEPNm6G7Nv9B4jcFPZ8bJj0SEjP3MPgQdKTqqEoy2v6G32P/Y6dxOv04AxnoAeq+GILvUavtYCBXm+BaIhuodcfrN5B/V2EYMCPh+SxavjGyPwV0x4CJgUPGT0mQaODGBACIJZGsMXwAD0LGXx7l3CdAcKMIKI+f5CepWeD0BvyU/GcdBxPF8SwejC6LGZmAURFdsSWKR5HyHld2kbdIZO1Ixx+bnnzU7n5+blPNV9jnUDWhP2tC68tbN3PVIldsQPxSAcSpjOav7Q05uXn5zW2LLvDXn9B6syscPy9iDLEMmSrJz6nYuWMipukjM0AH8JkGS+XFyMRkzSCH7KD/hwm172SAyZYumHlefr5AddrtA0O0TnwaVZxcRY9Bfukn9Gf05N1r9DV9MoBsJ1f+ZrqUvtPHizJAntWybv7hmqLt6QLuK6ZS9Fqi1jO5rDoWPZXXII5Tgajg53cIXCjDCGIcYrRIY2n6+mXOa/W0bdhau3ryiEYe2FV/5oeaIYK/5w5frCyll6/cYO8DiNhw6t1MBWmznt91QX62UF1N7l0eHBZTRGpKaqpKVIPF9UcIzmReud9TSY75+K899GHbBu6wjoR7RKKZVYiYxSPf5/2wJT5e3NAhmUbVn5KLx1Ujg0+BGvpAIh0DezInTkzF37KVocxrKU3r1+XLtAe2lO3l66kfQfB/unKY+q8N375Ru8bc4pJXfEcESU95q+p8ZNZRTWH1d9FzvUdYXk5rLkcdkEisoKKVHQW/b3GEx6tPaYcoJfOr9wAbSBnv1IHpep0OExr4LPMkpJM+j7sly7UHkOzXjoAZljHCGiyegtNlwljM0v+c19ET9Pvst09a2Mtgcf5/ZSzYO5h1156+eyydfAsxGa9XAuF6vzjh6CssLq6ECysperXX0sX5h5ZdpZe3guxsGIPEtHk/aqXX1hVqP5HYVVVISkrrNqvXorIc+5Ou91Hnr/LcD2afi6eX7UBloOcs7cOpqgGaNfs1g7bNbs9z6wASaylN69d0/TFTIz6Ws8+oGV3mE2612wRTHKcVUbhjKadebloMc+dyXgMVtVK6BwMB/+mVW09igdRBWaRtNQX59d/VD//xdQ0TCiYNj1KT9sq6Wdu5WTbqk3qDXyDaLa1fv621LS01G3z61sD6lH8lAxDLicV921s6Bf92JOYvzNYCL1khbqBXEFUzC521N5NyzNaQIWhjyFyDoBIVrAjmv2UEaLlI+c6zw1jmVIPLLLZZUTj6GxGHW+mq1tgHXR2D85p4Q934+jLbtjVLcyCdS10NVzpHqxp4Q/hK7WopY/NRGx9HGsPGdFjOjcpjBnGYMVqY/4eqT5khWEHWUup2A/pTw7pdWgsWft7ETUERL96nRg0HNFPmCYba6pylECaExX89A9WLUOVB4oKLu/o1oqSYHCgLzBUlAz8hNFDRpeSU1XT+LRmDUgPaKbYdHDn9suF/tu13nHJij0N97LfS0QmqONuyONk7zvUI6Qa0pF9f2+oABL92AT6e0U//z9YqAiWtJLU1JK0gS+1aacwamiNqK067u9ZQ8f1d4qLodMzz3uL89Z68V/Hnr++hXWUuHgw8dfi972PeTyPefu3aNNucemQ74qFuIaJnVkOu4Q+yjuwmmC1FqZpl1i4uzoPxjkpPf3Xv545tl26Rr+dOvUd+omqJzch9dOeU7f10Y64nMcKK137DccIZq2WdXtdZjbEoLSzHwiMtrjYLDxpHQW8gjMX6XFYAE2zSWVD04EGYSs9MbO6sEo20BMEAB4mpvSypsKjZ4Stgzb+c3A9/MQT2+vrBy+qvyFxLUtLlSRF/Ri2wjfZ2dus2Q8lXx4608/jnqK5OOap6NY2PSjYYnECCjiEeLJll/pbmqfeIK+ps3+MxrlEhqmTPipVP7kqlF4VhpEb6r+Q7YOJg38kJ9SHBf3NBl6+9YchfbUjb5ahLSzUM3kPHmwFAsZ5rpai0S7E5xWzZ1j+fW7zsUWP2g5NXTw52ySCTrgG0+lbw60l2Y/CB185CoA8NK+tbRKxfjy6pm5hzQRRR+cMqv1Jbiw6STivtEvt3DRcy0QEh92JlUGo2PG4tSKHl00YD6xc8CK+YPYyy3io2lN8BcSjKRzrIV6ypOAobqxViJPaT9M9Hy5szY33mp7OX/Zu89L/7Ww5vqY2Y8b0pKgoiUhG5cPDPzq8qTV/WkzUOIvXVVA96kmjcBrr3HrYC/Wn+fYP6Z7T1rqy3zknbvqma/FvVk96fNXGkuaXrdHW5JGSxZT/2I/O73v+yNWafMdzc5NdxYurHs6h86e01sLKLz9EBrg+x36rxAaED7hRnAMx7Vzu+9wabh3zG8XLQjx0ablUJzmxdErxYT3kzQSd0SSafVqF5PXgpp0OyYJ1EyNHpGUZmvK575ySzd85JSqF7IBzSAbMM04+MbE58xF3/njXOGecSaermlw2y9PsSQdytLJVr8t+wg+rR8cZYoeNxVIzNdk3Bngi8U5LAlgTFoQnzJCa5EsCgYhCaGL+qPj7TdhG31p9tej3R04N//PXxNwJvyUqwaJqRPJY98TJ5TPndmflRAkAhBfe46sfKW5wizSge08Xb7Ca/GUVs55trngkKkrUS2WPzKttaaqq+idmahugkY+W6fN0I6i3gPt/x88U4wAAeJxjYGRgYADiGU9YXsXz23xl4GZnAIFH7fO+IdMc/WBxDgYmEAUASbMKwAB4nGNgZGBgZwABjj4Ghv//OfoZGBlQgT4ARicDZAAAAHicY2BgYGAfxJijD8Fmu4EqBwCSpgKpAAAAAAAADgBoAH4AzADgAQIBQgFsAZgB7gIuAooC0AL8A2IDjAOoA+AEMASwBNoFCAVaBcAGCAYuBnAGrAb2B04HigfSCCoIcAiGCJwIyAkkCVYJiAmsCfIKIApWCsQLknicY2BkYGDQZ2hmYGcAASYg5gJCBob/YD4DABqrAdAAeJxdkE1qg0AYhl8Tk9AIoVDaVSmzahcF87PMARLIMoFAl0ZHY1BHdBJIT9AT9AQ9RQ9Qeqy+yteNMzDzfM+88w0K4BY/cNAMB6N2bUaPPBLukybCLvleeAAPj8JD+hfhMV7hC3u4wxs7OO4NzQSZcI/8Ltwnfwi75E/hAR7wJTyk/xYeY49fYQ/PztM+jbTZ7LY6OWdBJdX/pqs6NYWa+zMxa13oKrA6Uoerqi/JwtpYxZXJ1coUVmeZUWVlTjq0/tHacjmdxuL90OR8O0UEDYMNdtiSEpz5XQGqzlm30kzUdAYFFOb8R7NOZk0q2lwAyz1i7oAr1xoXvrOgtYhZx8wY5KRV269JZ5yGpmzPTjQhvY9je6vEElPOuJP3mWKnP5M3V+YAAAB4nG2ReVPbMBDF/ULi2EkDBFqO3gdHLxUzDB9IkdexBllydRD49ihO3Ckz7B/a31utZnafkkGyiXnyclxhgB0MMUKKMTLkmGCKV5hhF3vYxxwHOMRrvMERjnGCU7zFO7zHB3zEJ3zGF3zFN5zhHBe4xHf8wE/8wm8w/MEVimTYKv44XR9MSCsUjVoeHE3vjQoNsSZ4mmxZmVWPjSz7jlou6/0qKOWEJdKMtCe793/hQfqxa6XWZHMXFl56RS4TvPXSaDeoy0zUUZB109KstDK8lHo5q6Qi1hcOnqkImubPS6aqRq7mlnaEWabub4iYblba3SRmgldS0+FWdhNtt04F14JUaqkl7tcpOpJtErvNt3Bd9HRT5JWxK25Ldjvp6br4hzfFiIdSmlzTg2fSUzNrLd1LE1ynxq4OVaVoKLjzJ60UPtj1RKzHzsbjly6inVnFBS2MucviPncU7Rr7lfTxRepDs1A2j3ZHRc7PuzFYSfE3ZOd4kjwBy227hA==) format("woff"); + font-weight: normal; + font-style: normal; +} +.vjs-icon-play, .video-js .vjs-play-control .vjs-icon-placeholder, .video-js .vjs-big-play-button .vjs-icon-placeholder:before { + font-family: VideoJS; + font-weight: normal; + font-style: normal; +} +.vjs-icon-play:before, .video-js .vjs-play-control .vjs-icon-placeholder:before, .video-js .vjs-big-play-button .vjs-icon-placeholder:before { + content: "\f101"; +} + +.vjs-icon-play-circle { + font-family: VideoJS; + font-weight: normal; + font-style: normal; +} +.vjs-icon-play-circle:before { + content: "\f102"; +} + +.vjs-icon-pause, .video-js .vjs-play-control.vjs-playing .vjs-icon-placeholder { + font-family: VideoJS; + font-weight: normal; + font-style: normal; +} +.vjs-icon-pause:before, .video-js .vjs-play-control.vjs-playing .vjs-icon-placeholder:before { + content: "\f103"; +} + +.vjs-icon-volume-mute, .video-js .vjs-mute-control.vjs-vol-0 .vjs-icon-placeholder { + font-family: VideoJS; + font-weight: normal; + font-style: normal; +} +.vjs-icon-volume-mute:before, .video-js .vjs-mute-control.vjs-vol-0 .vjs-icon-placeholder:before { + content: "\f104"; +} + +.vjs-icon-volume-low, .video-js .vjs-mute-control.vjs-vol-1 .vjs-icon-placeholder { + font-family: VideoJS; + font-weight: normal; + font-style: normal; +} +.vjs-icon-volume-low:before, .video-js .vjs-mute-control.vjs-vol-1 .vjs-icon-placeholder:before { + content: "\f105"; +} + +.vjs-icon-volume-mid, .video-js .vjs-mute-control.vjs-vol-2 .vjs-icon-placeholder { + font-family: VideoJS; + font-weight: normal; + font-style: normal; +} +.vjs-icon-volume-mid:before, .video-js .vjs-mute-control.vjs-vol-2 .vjs-icon-placeholder:before { + content: "\f106"; +} + +.vjs-icon-volume-high, .video-js .vjs-mute-control .vjs-icon-placeholder { + font-family: VideoJS; + font-weight: normal; + font-style: normal; +} +.vjs-icon-volume-high:before, .video-js .vjs-mute-control .vjs-icon-placeholder:before { + content: "\f107"; +} + +.vjs-icon-fullscreen-enter, .video-js .vjs-fullscreen-control .vjs-icon-placeholder { + font-family: VideoJS; + font-weight: normal; + font-style: normal; +} +.vjs-icon-fullscreen-enter:before, .video-js .vjs-fullscreen-control .vjs-icon-placeholder:before { + content: "\f108"; +} + +.vjs-icon-fullscreen-exit, .video-js.vjs-fullscreen .vjs-fullscreen-control .vjs-icon-placeholder { + font-family: VideoJS; + font-weight: normal; + font-style: normal; +} +.vjs-icon-fullscreen-exit:before, .video-js.vjs-fullscreen .vjs-fullscreen-control .vjs-icon-placeholder:before { + content: "\f109"; +} + +.vjs-icon-spinner { + font-family: VideoJS; + font-weight: normal; + font-style: normal; +} +.vjs-icon-spinner:before { + content: "\f10a"; +} + +.vjs-icon-subtitles, .video-js .vjs-subs-caps-button .vjs-icon-placeholder, +.video-js.video-js:lang(en-GB) .vjs-subs-caps-button .vjs-icon-placeholder, +.video-js.video-js:lang(en-IE) .vjs-subs-caps-button .vjs-icon-placeholder, +.video-js.video-js:lang(en-AU) .vjs-subs-caps-button .vjs-icon-placeholder, +.video-js.video-js:lang(en-NZ) .vjs-subs-caps-button .vjs-icon-placeholder, .video-js .vjs-subtitles-button .vjs-icon-placeholder { + font-family: VideoJS; + font-weight: normal; + font-style: normal; +} +.vjs-icon-subtitles:before, .video-js .vjs-subs-caps-button .vjs-icon-placeholder:before, +.video-js.video-js:lang(en-GB) .vjs-subs-caps-button .vjs-icon-placeholder:before, +.video-js.video-js:lang(en-IE) .vjs-subs-caps-button .vjs-icon-placeholder:before, +.video-js.video-js:lang(en-AU) .vjs-subs-caps-button .vjs-icon-placeholder:before, +.video-js.video-js:lang(en-NZ) .vjs-subs-caps-button .vjs-icon-placeholder:before, .video-js .vjs-subtitles-button .vjs-icon-placeholder:before { + content: "\f10b"; +} + +.vjs-icon-captions, .video-js:lang(en) .vjs-subs-caps-button .vjs-icon-placeholder, +.video-js:lang(fr-CA) .vjs-subs-caps-button .vjs-icon-placeholder, .video-js .vjs-captions-button .vjs-icon-placeholder { + font-family: VideoJS; + font-weight: normal; + font-style: normal; +} +.vjs-icon-captions:before, .video-js:lang(en) .vjs-subs-caps-button .vjs-icon-placeholder:before, +.video-js:lang(fr-CA) .vjs-subs-caps-button .vjs-icon-placeholder:before, .video-js .vjs-captions-button .vjs-icon-placeholder:before { + content: "\f10c"; +} + +.vjs-icon-hd { + font-family: VideoJS; + font-weight: normal; + font-style: normal; +} +.vjs-icon-hd:before { + content: "\f10d"; +} + +.vjs-icon-chapters, .video-js .vjs-chapters-button .vjs-icon-placeholder { + font-family: VideoJS; + font-weight: normal; + font-style: normal; +} +.vjs-icon-chapters:before, .video-js .vjs-chapters-button .vjs-icon-placeholder:before { + content: "\f10e"; +} + +.vjs-icon-downloading { + font-family: VideoJS; + font-weight: normal; + font-style: normal; +} +.vjs-icon-downloading:before { + content: "\f10f"; +} + +.vjs-icon-file-download { + font-family: VideoJS; + font-weight: normal; + font-style: normal; +} +.vjs-icon-file-download:before { + content: "\f110"; +} + +.vjs-icon-file-download-done { + font-family: VideoJS; + font-weight: normal; + font-style: normal; +} +.vjs-icon-file-download-done:before { + content: "\f111"; +} + +.vjs-icon-file-download-off { + font-family: VideoJS; + font-weight: normal; + font-style: normal; +} +.vjs-icon-file-download-off:before { + content: "\f112"; +} + +.vjs-icon-share { + font-family: VideoJS; + font-weight: normal; + font-style: normal; +} +.vjs-icon-share:before { + content: "\f113"; +} + +.vjs-icon-cog { + font-family: VideoJS; + font-weight: normal; + font-style: normal; +} +.vjs-icon-cog:before { + content: "\f114"; +} + +.vjs-icon-square { + font-family: VideoJS; + font-weight: normal; + font-style: normal; +} +.vjs-icon-square:before { + content: "\f115"; +} + +.vjs-icon-circle, .vjs-seek-to-live-control .vjs-icon-placeholder, .video-js .vjs-volume-level, .video-js .vjs-play-progress { + font-family: VideoJS; + font-weight: normal; + font-style: normal; +} +.vjs-icon-circle:before, .vjs-seek-to-live-control .vjs-icon-placeholder:before, .video-js .vjs-volume-level:before, .video-js .vjs-play-progress:before { + content: "\f116"; +} + +.vjs-icon-circle-outline { + font-family: VideoJS; + font-weight: normal; + font-style: normal; +} +.vjs-icon-circle-outline:before { + content: "\f117"; +} + +.vjs-icon-circle-inner-circle { + font-family: VideoJS; + font-weight: normal; + font-style: normal; +} +.vjs-icon-circle-inner-circle:before { + content: "\f118"; +} + +.vjs-icon-cancel, .video-js .vjs-control.vjs-close-button .vjs-icon-placeholder { + font-family: VideoJS; + font-weight: normal; + font-style: normal; +} +.vjs-icon-cancel:before, .video-js .vjs-control.vjs-close-button .vjs-icon-placeholder:before { + content: "\f119"; +} + +.vjs-icon-repeat { + font-family: VideoJS; + font-weight: normal; + font-style: normal; +} +.vjs-icon-repeat:before { + content: "\f11a"; +} + +.vjs-icon-replay, .video-js .vjs-play-control.vjs-ended .vjs-icon-placeholder { + font-family: VideoJS; + font-weight: normal; + font-style: normal; +} +.vjs-icon-replay:before, .video-js .vjs-play-control.vjs-ended .vjs-icon-placeholder:before { + content: "\f11b"; +} + +.vjs-icon-replay-5, .video-js .vjs-skip-backward-5 .vjs-icon-placeholder { + font-family: VideoJS; + font-weight: normal; + font-style: normal; +} +.vjs-icon-replay-5:before, .video-js .vjs-skip-backward-5 .vjs-icon-placeholder:before { + content: "\f11c"; +} + +.vjs-icon-replay-10, .video-js .vjs-skip-backward-10 .vjs-icon-placeholder { + font-family: VideoJS; + font-weight: normal; + font-style: normal; +} +.vjs-icon-replay-10:before, .video-js .vjs-skip-backward-10 .vjs-icon-placeholder:before { + content: "\f11d"; +} + +.vjs-icon-replay-30, .video-js .vjs-skip-backward-30 .vjs-icon-placeholder { + font-family: VideoJS; + font-weight: normal; + font-style: normal; +} +.vjs-icon-replay-30:before, .video-js .vjs-skip-backward-30 .vjs-icon-placeholder:before { + content: "\f11e"; +} + +.vjs-icon-forward-5, .video-js .vjs-skip-forward-5 .vjs-icon-placeholder { + font-family: VideoJS; + font-weight: normal; + font-style: normal; +} +.vjs-icon-forward-5:before, .video-js .vjs-skip-forward-5 .vjs-icon-placeholder:before { + content: "\f11f"; +} + +.vjs-icon-forward-10, .video-js .vjs-skip-forward-10 .vjs-icon-placeholder { + font-family: VideoJS; + font-weight: normal; + font-style: normal; +} +.vjs-icon-forward-10:before, .video-js .vjs-skip-forward-10 .vjs-icon-placeholder:before { + content: "\f120"; +} + +.vjs-icon-forward-30, .video-js .vjs-skip-forward-30 .vjs-icon-placeholder { + font-family: VideoJS; + font-weight: normal; + font-style: normal; +} +.vjs-icon-forward-30:before, .video-js .vjs-skip-forward-30 .vjs-icon-placeholder:before { + content: "\f121"; +} + +.vjs-icon-audio, .video-js .vjs-audio-button .vjs-icon-placeholder { + font-family: VideoJS; + font-weight: normal; + font-style: normal; +} +.vjs-icon-audio:before, .video-js .vjs-audio-button .vjs-icon-placeholder:before { + content: "\f122"; +} + +.vjs-icon-next-item { + font-family: VideoJS; + font-weight: normal; + font-style: normal; +} +.vjs-icon-next-item:before { + content: "\f123"; +} + +.vjs-icon-previous-item { + font-family: VideoJS; + font-weight: normal; + font-style: normal; +} +.vjs-icon-previous-item:before { + content: "\f124"; +} + +.vjs-icon-shuffle { + font-family: VideoJS; + font-weight: normal; + font-style: normal; +} +.vjs-icon-shuffle:before { + content: "\f125"; +} + +.vjs-icon-cast { + font-family: VideoJS; + font-weight: normal; + font-style: normal; +} +.vjs-icon-cast:before { + content: "\f126"; +} + +.vjs-icon-picture-in-picture-enter, .video-js .vjs-picture-in-picture-control .vjs-icon-placeholder { + font-family: VideoJS; + font-weight: normal; + font-style: normal; +} +.vjs-icon-picture-in-picture-enter:before, .video-js .vjs-picture-in-picture-control .vjs-icon-placeholder:before { + content: "\f127"; +} + +.vjs-icon-picture-in-picture-exit, .video-js.vjs-picture-in-picture .vjs-picture-in-picture-control .vjs-icon-placeholder { + font-family: VideoJS; + font-weight: normal; + font-style: normal; +} +.vjs-icon-picture-in-picture-exit:before, .video-js.vjs-picture-in-picture .vjs-picture-in-picture-control .vjs-icon-placeholder:before { + content: "\f128"; +} + +.vjs-icon-facebook { + font-family: VideoJS; + font-weight: normal; + font-style: normal; +} +.vjs-icon-facebook:before { + content: "\f129"; +} + +.vjs-icon-linkedin { + font-family: VideoJS; + font-weight: normal; + font-style: normal; +} +.vjs-icon-linkedin:before { + content: "\f12a"; +} + +.vjs-icon-twitter { + font-family: VideoJS; + font-weight: normal; + font-style: normal; +} +.vjs-icon-twitter:before { + content: "\f12b"; +} + +.vjs-icon-tumblr { + font-family: VideoJS; + font-weight: normal; + font-style: normal; +} +.vjs-icon-tumblr:before { + content: "\f12c"; +} + +.vjs-icon-pinterest { + font-family: VideoJS; + font-weight: normal; + font-style: normal; +} +.vjs-icon-pinterest:before { + content: "\f12d"; +} + +.vjs-icon-audio-description, .video-js .vjs-descriptions-button .vjs-icon-placeholder { + font-family: VideoJS; + font-weight: normal; + font-style: normal; +} +.vjs-icon-audio-description:before, .video-js .vjs-descriptions-button .vjs-icon-placeholder:before { + content: "\f12e"; +} + +.video-js { + display: inline-block; + vertical-align: top; + box-sizing: border-box; + color: #fff; + background-color: #000; + position: relative; + padding: 0; + font-size: 10px; + line-height: 1; + font-weight: normal; + font-style: normal; + font-family: Arial, Helvetica, sans-serif; + word-break: initial; +} +.video-js:-moz-full-screen { + position: absolute; +} +.video-js:-webkit-full-screen { + width: 100% !important; + height: 100% !important; +} + +.video-js[tabindex="-1"] { + outline: none; +} + +.video-js *, +.video-js *:before, +.video-js *:after { + box-sizing: inherit; +} + +.video-js ul { + font-family: inherit; + font-size: inherit; + line-height: inherit; + list-style-position: outside; + margin-left: 0; + margin-right: 0; + margin-top: 0; + margin-bottom: 0; +} + +.video-js.vjs-fluid, +.video-js.vjs-16-9, +.video-js.vjs-4-3, +.video-js.vjs-9-16, +.video-js.vjs-1-1 { + width: 100%; + max-width: 100%; +} + +.video-js.vjs-fluid:not(.vjs-audio-only-mode), +.video-js.vjs-16-9:not(.vjs-audio-only-mode), +.video-js.vjs-4-3:not(.vjs-audio-only-mode), +.video-js.vjs-9-16:not(.vjs-audio-only-mode), +.video-js.vjs-1-1:not(.vjs-audio-only-mode) { + height: 0; +} + +.video-js.vjs-16-9:not(.vjs-audio-only-mode) { + padding-top: 56.25%; +} + +.video-js.vjs-4-3:not(.vjs-audio-only-mode) { + padding-top: 75%; +} + +.video-js.vjs-9-16:not(.vjs-audio-only-mode) { + padding-top: 177.7777777778%; +} + +.video-js.vjs-1-1:not(.vjs-audio-only-mode) { + padding-top: 100%; +} + +.video-js.vjs-fill:not(.vjs-audio-only-mode) { + width: 100%; + height: 100%; +} + +.video-js .vjs-tech { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; +} + +.video-js.vjs-audio-only-mode .vjs-tech { + display: none; +} + +body.vjs-full-window, +body.vjs-pip-window { + padding: 0; + margin: 0; + height: 100%; +} + +.vjs-full-window .video-js.vjs-fullscreen, +body.vjs-pip-window .video-js { + position: fixed; + overflow: hidden; + z-index: 1000; + left: 0; + top: 0; + bottom: 0; + right: 0; +} + +.video-js.vjs-fullscreen:not(.vjs-ios-native-fs), +body.vjs-pip-window .video-js { + width: 100% !important; + height: 100% !important; + padding-top: 0 !important; + display: block; +} + +.video-js.vjs-fullscreen.vjs-user-inactive { + cursor: none; +} + +.vjs-pip-container .vjs-pip-text { + position: absolute; + bottom: 10%; + font-size: 2em; + background-color: rgba(0, 0, 0, 0.7); + padding: 0.5em; + text-align: center; + width: 100%; +} + +.vjs-layout-tiny.vjs-pip-container .vjs-pip-text, +.vjs-layout-x-small.vjs-pip-container .vjs-pip-text, +.vjs-layout-small.vjs-pip-container .vjs-pip-text { + bottom: 0; + font-size: 1.4em; +} + +.vjs-hidden { + display: none !important; +} + +.vjs-disabled { + opacity: 0.5; + cursor: default; +} + +.video-js .vjs-offscreen { + height: 1px; + left: -9999px; + position: absolute; + top: 0; + width: 1px; +} + +.vjs-lock-showing { + display: block !important; + opacity: 1 !important; + visibility: visible !important; +} + +.vjs-no-js { + padding: 20px; + color: #fff; + background-color: #000; + font-size: 18px; + font-family: Arial, Helvetica, sans-serif; + text-align: center; + width: 300px; + height: 150px; + margin: 0px auto; +} + +.vjs-no-js a, +.vjs-no-js a:visited { + color: #66A8CC; +} + +.video-js .vjs-big-play-button { + font-size: 3em; + line-height: 1.5em; + height: 1.63332em; + width: 3em; + display: block; + position: absolute; + top: 50%; + left: 50%; + padding: 0; + margin-top: -0.81666em; + margin-left: -1.5em; + cursor: pointer; + opacity: 1; + border: 0.06666em solid #fff; + background-color: #2B333F; + background-color: rgba(43, 51, 63, 0.7); + border-radius: 0.3em; + transition: all 0.4s; +} +.vjs-big-play-button .vjs-svg-icon { + width: 1em; + height: 1em; + position: absolute; + top: 50%; + left: 50%; + line-height: 1; + transform: translate(-50%, -50%); +} + +.video-js:hover .vjs-big-play-button, +.video-js .vjs-big-play-button:focus { + border-color: #fff; + background-color: #73859f; + background-color: rgba(115, 133, 159, 0.5); + transition: all 0s; +} + +.vjs-controls-disabled .vjs-big-play-button, +.vjs-has-started .vjs-big-play-button, +.vjs-using-native-controls .vjs-big-play-button, +.vjs-error .vjs-big-play-button { + display: none; +} + +.vjs-has-started.vjs-paused.vjs-show-big-play-button-on-pause:not(.vjs-seeking, .vjs-scrubbing, .vjs-error) .vjs-big-play-button { + display: block; +} + +.video-js button { + background: none; + border: none; + color: inherit; + display: inline-block; + font-size: inherit; + line-height: inherit; + text-transform: none; + text-decoration: none; + transition: none; + -webkit-appearance: none; + -moz-appearance: none; + appearance: none; +} + +.video-js.vjs-spatial-navigation-enabled .vjs-button:focus { + outline: 0.0625em solid white; + box-shadow: none; +} + +.vjs-control .vjs-button { + width: 100%; + height: 100%; +} + +.video-js .vjs-control.vjs-close-button { + cursor: pointer; + height: 3em; + position: absolute; + right: 0; + top: 0.5em; + z-index: 2; +} +.video-js .vjs-modal-dialog { + background: rgba(0, 0, 0, 0.8); + background: linear-gradient(180deg, rgba(0, 0, 0, 0.8), rgba(255, 255, 255, 0)); + overflow: auto; +} + +.video-js .vjs-modal-dialog > * { + box-sizing: border-box; +} + +.vjs-modal-dialog .vjs-modal-dialog-content { + font-size: 1.2em; + line-height: 1.5; + padding: 20px 24px; + z-index: 1; +} + +.vjs-menu-button { + cursor: pointer; +} + +.vjs-menu-button.vjs-disabled { + cursor: default; +} + +.vjs-workinghover .vjs-menu-button.vjs-disabled:hover .vjs-menu { + display: none; +} + +.vjs-menu .vjs-menu-content { + display: block; + padding: 0; + margin: 0; + font-family: Arial, Helvetica, sans-serif; + overflow: auto; +} + +.vjs-menu .vjs-menu-content > * { + box-sizing: border-box; +} + +.vjs-scrubbing .vjs-control.vjs-menu-button:hover .vjs-menu { + display: none; +} + +.vjs-menu li { + display: flex; + justify-content: center; + list-style: none; + margin: 0; + padding: 0.2em 0; + line-height: 1.4em; + font-size: 1.2em; + text-align: center; + text-transform: lowercase; +} + +.vjs-menu li.vjs-menu-item:focus, +.vjs-menu li.vjs-menu-item:hover, +.js-focus-visible .vjs-menu li.vjs-menu-item:hover { + background-color: #73859f; + background-color: rgba(115, 133, 159, 0.5); +} + +.vjs-menu li.vjs-selected, +.vjs-menu li.vjs-selected:focus, +.vjs-menu li.vjs-selected:hover, +.js-focus-visible .vjs-menu li.vjs-selected:hover { + background-color: #fff; + color: #2B333F; +} +.vjs-menu li.vjs-selected .vjs-svg-icon, +.vjs-menu li.vjs-selected:focus .vjs-svg-icon, +.vjs-menu li.vjs-selected:hover .vjs-svg-icon, +.js-focus-visible .vjs-menu li.vjs-selected:hover .vjs-svg-icon { + fill: #000000; +} + +.video-js .vjs-menu *:not(.vjs-selected):focus:not(:focus-visible), +.js-focus-visible .vjs-menu *:not(.vjs-selected):focus:not(.focus-visible) { + background: none; +} + +.vjs-menu li.vjs-menu-title { + text-align: center; + text-transform: uppercase; + font-size: 1em; + line-height: 2em; + padding: 0; + margin: 0 0 0.3em 0; + font-weight: bold; + cursor: default; +} + +.vjs-menu-button-popup .vjs-menu { + display: none; + position: absolute; + bottom: 0; + width: 10em; + left: -3em; + height: 0em; + margin-bottom: 1.5em; + border-top-color: rgba(43, 51, 63, 0.7); +} + +.vjs-pip-window .vjs-menu-button-popup .vjs-menu { + left: unset; + right: 1em; +} + +.vjs-menu-button-popup .vjs-menu .vjs-menu-content { + background-color: #2B333F; + background-color: rgba(43, 51, 63, 0.7); + position: absolute; + width: 100%; + bottom: 1.5em; + max-height: 15em; +} + +.vjs-layout-tiny .vjs-menu-button-popup .vjs-menu .vjs-menu-content, +.vjs-layout-x-small .vjs-menu-button-popup .vjs-menu .vjs-menu-content { + max-height: 5em; +} + +.vjs-layout-small .vjs-menu-button-popup .vjs-menu .vjs-menu-content { + max-height: 10em; +} + +.vjs-layout-medium .vjs-menu-button-popup .vjs-menu .vjs-menu-content { + max-height: 14em; +} + +.vjs-layout-large .vjs-menu-button-popup .vjs-menu .vjs-menu-content, +.vjs-layout-x-large .vjs-menu-button-popup .vjs-menu .vjs-menu-content, +.vjs-layout-huge .vjs-menu-button-popup .vjs-menu .vjs-menu-content { + max-height: 25em; +} + +.vjs-workinghover .vjs-menu-button-popup.vjs-hover .vjs-menu, +.vjs-menu-button-popup .vjs-menu.vjs-lock-showing { + display: block; +} + +.video-js .vjs-menu-button-inline { + transition: all 0.4s; + overflow: hidden; +} + +.video-js .vjs-menu-button-inline:before { + width: 2.222222222em; +} + +.video-js .vjs-menu-button-inline:hover, +.video-js .vjs-menu-button-inline:focus, +.video-js .vjs-menu-button-inline.vjs-slider-active { + width: 12em; +} + +.vjs-menu-button-inline .vjs-menu { + opacity: 0; + height: 100%; + width: auto; + position: absolute; + left: 4em; + top: 0; + padding: 0; + margin: 0; + transition: all 0.4s; +} + +.vjs-menu-button-inline:hover .vjs-menu, +.vjs-menu-button-inline:focus .vjs-menu, +.vjs-menu-button-inline.vjs-slider-active .vjs-menu { + display: block; + opacity: 1; +} + +.vjs-menu-button-inline .vjs-menu-content { + width: auto; + height: 100%; + margin: 0; + overflow: hidden; +} + +.video-js .vjs-control-bar { + display: none; + width: 100%; + position: absolute; + bottom: 0; + left: 0; + right: 0; + height: 3em; + background-color: #2B333F; + background-color: rgba(43, 51, 63, 0.7); +} + +.video-js.vjs-spatial-navigation-enabled .vjs-control-bar { + gap: 1px; +} + +.video-js:not(.vjs-controls-disabled, .vjs-using-native-controls, .vjs-error) .vjs-control-bar.vjs-lock-showing { + display: flex !important; +} + +.vjs-has-started .vjs-control-bar, +.vjs-audio-only-mode .vjs-control-bar { + display: flex; + visibility: visible; + opacity: 1; + transition: visibility 0.1s, opacity 0.1s; +} + +.vjs-has-started.vjs-user-inactive.vjs-playing .vjs-control-bar { + visibility: visible; + opacity: 0; + pointer-events: none; + transition: visibility 1s, opacity 1s; +} + +.vjs-controls-disabled .vjs-control-bar, +.vjs-using-native-controls .vjs-control-bar, +.vjs-error .vjs-control-bar { + display: none !important; +} + +.vjs-audio.vjs-has-started.vjs-user-inactive.vjs-playing .vjs-control-bar, +.vjs-audio-only-mode.vjs-has-started.vjs-user-inactive.vjs-playing .vjs-control-bar { + opacity: 1; + visibility: visible; + pointer-events: auto; +} + +.video-js .vjs-control { + position: relative; + text-align: center; + margin: 0; + padding: 0; + height: 100%; + width: 4em; + flex: none; +} + +.video-js .vjs-control.vjs-visible-text { + width: auto; + padding-left: 1em; + padding-right: 1em; +} + +.vjs-button > .vjs-icon-placeholder:before { + font-size: 1.8em; + line-height: 1.67; +} + +.vjs-button > .vjs-icon-placeholder { + display: block; +} + +.vjs-button > .vjs-svg-icon { + display: inline-block; +} + +.video-js .vjs-control:focus:before, +.video-js .vjs-control:hover:before, +.video-js .vjs-control:focus { + text-shadow: 0em 0em 1em white; +} + +.video-js *:not(.vjs-visible-text) > .vjs-control-text { + border: 0; + clip: rect(0 0 0 0); + height: 1px; + overflow: hidden; + padding: 0; + position: absolute; + width: 1px; +} + +.video-js .vjs-custom-control-spacer { + display: none; +} + +.video-js .vjs-progress-control { + cursor: pointer; + flex: auto; + display: flex; + align-items: center; + min-width: 4em; + touch-action: none; +} + +.video-js .vjs-progress-control.disabled { + cursor: default; +} + +.vjs-live .vjs-progress-control { + display: none; +} + +.vjs-liveui .vjs-progress-control { + display: flex; + align-items: center; +} + +.video-js .vjs-progress-holder { + flex: auto; + transition: all 0.2s; + height: 0.3em; +} + +.video-js .vjs-progress-control .vjs-progress-holder { + margin: 0 10px; +} + +.video-js .vjs-progress-control:hover .vjs-progress-holder { + font-size: 1.6666666667em; +} + +.video-js .vjs-progress-control:hover .vjs-progress-holder.disabled { + font-size: 1em; +} + +.video-js .vjs-progress-holder .vjs-play-progress, +.video-js .vjs-progress-holder .vjs-load-progress, +.video-js .vjs-progress-holder .vjs-load-progress div { + position: absolute; + display: block; + height: 100%; + margin: 0; + padding: 0; + width: 0; +} + +.video-js .vjs-play-progress { + background-color: #fff; +} +.video-js .vjs-play-progress:before { + font-size: 0.9em; + position: absolute; + right: -0.5em; + line-height: 0.35em; + z-index: 1; +} + +.vjs-svg-icons-enabled .vjs-play-progress:before { + content: none !important; +} + +.vjs-play-progress .vjs-svg-icon { + position: absolute; + top: -0.35em; + right: -0.4em; + width: 0.9em; + height: 0.9em; + pointer-events: none; + line-height: 0.15em; + z-index: 1; +} + +.video-js .vjs-load-progress { + background: rgba(115, 133, 159, 0.5); +} + +.video-js .vjs-load-progress div { + background: rgba(115, 133, 159, 0.75); +} + +.video-js .vjs-time-tooltip { + background-color: #fff; + background-color: rgba(255, 255, 255, 0.8); + border-radius: 0.3em; + color: #000; + float: right; + font-family: Arial, Helvetica, sans-serif; + font-size: 1em; + padding: 6px 8px 8px 8px; + pointer-events: none; + position: absolute; + top: -3.4em; + visibility: hidden; + z-index: 1; +} + +.video-js .vjs-progress-holder:focus .vjs-time-tooltip { + display: none; +} + +.video-js .vjs-progress-control:hover .vjs-time-tooltip, +.video-js .vjs-progress-control:hover .vjs-progress-holder:focus .vjs-time-tooltip { + display: block; + font-size: 0.6em; + visibility: visible; +} + +.video-js .vjs-progress-control.disabled:hover .vjs-time-tooltip { + font-size: 1em; +} + +.video-js .vjs-progress-control .vjs-mouse-display { + display: none; + position: absolute; + width: 1px; + height: 100%; + background-color: #000; + z-index: 1; +} + +.video-js .vjs-progress-control:hover .vjs-mouse-display { + display: block; +} + +.video-js.vjs-user-inactive .vjs-progress-control .vjs-mouse-display { + visibility: hidden; + opacity: 0; + transition: visibility 1s, opacity 1s; +} + +.vjs-mouse-display .vjs-time-tooltip { + color: #fff; + background-color: #000; + background-color: rgba(0, 0, 0, 0.8); +} + +.video-js .vjs-slider { + position: relative; + cursor: pointer; + padding: 0; + margin: 0 0.45em 0 0.45em; + /* iOS Safari */ + -webkit-touch-callout: none; + /* Safari, and Chrome 53 */ + -webkit-user-select: none; + /* Non-prefixed version, currently supported by Chrome and Opera */ + -moz-user-select: none; + user-select: none; + background-color: #73859f; + background-color: rgba(115, 133, 159, 0.5); +} + +.video-js .vjs-slider.disabled { + cursor: default; +} + +.video-js .vjs-slider:focus { + text-shadow: 0em 0em 1em white; + box-shadow: 0 0 1em #fff; +} + +.video-js.vjs-spatial-navigation-enabled .vjs-slider:focus { + outline: 0.0625em solid white; +} + +.video-js .vjs-mute-control { + cursor: pointer; + flex: none; +} +.video-js .vjs-volume-control { + cursor: pointer; + margin-right: 1em; + display: flex; +} + +.video-js .vjs-volume-control.vjs-volume-horizontal { + width: 5em; +} + +.video-js .vjs-volume-panel .vjs-volume-control { + visibility: visible; + opacity: 0; + width: 1px; + height: 1px; + margin-left: -1px; +} + +.video-js .vjs-volume-panel { + transition: width 1s; +} +.video-js .vjs-volume-panel.vjs-hover .vjs-volume-control, .video-js .vjs-volume-panel:active .vjs-volume-control, .video-js .vjs-volume-panel:focus .vjs-volume-control, .video-js .vjs-volume-panel .vjs-volume-control:active, .video-js .vjs-volume-panel.vjs-hover .vjs-mute-control ~ .vjs-volume-control, .video-js .vjs-volume-panel .vjs-volume-control.vjs-slider-active { + visibility: visible; + opacity: 1; + position: relative; + transition: visibility 0.1s, opacity 0.1s, height 0.1s, width 0.1s, left 0s, top 0s; +} +.video-js .vjs-volume-panel.vjs-hover .vjs-volume-control.vjs-volume-horizontal, .video-js .vjs-volume-panel:active .vjs-volume-control.vjs-volume-horizontal, .video-js .vjs-volume-panel:focus .vjs-volume-control.vjs-volume-horizontal, .video-js .vjs-volume-panel .vjs-volume-control:active.vjs-volume-horizontal, .video-js .vjs-volume-panel.vjs-hover .vjs-mute-control ~ .vjs-volume-control.vjs-volume-horizontal, .video-js .vjs-volume-panel .vjs-volume-control.vjs-slider-active.vjs-volume-horizontal { + width: 5em; + height: 3em; + margin-right: 0; +} +.video-js .vjs-volume-panel.vjs-hover .vjs-volume-control.vjs-volume-vertical, .video-js .vjs-volume-panel:active .vjs-volume-control.vjs-volume-vertical, .video-js .vjs-volume-panel:focus .vjs-volume-control.vjs-volume-vertical, .video-js .vjs-volume-panel .vjs-volume-control:active.vjs-volume-vertical, .video-js .vjs-volume-panel.vjs-hover .vjs-mute-control ~ .vjs-volume-control.vjs-volume-vertical, .video-js .vjs-volume-panel .vjs-volume-control.vjs-slider-active.vjs-volume-vertical { + left: -3.5em; + transition: left 0s; +} +.video-js .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-hover, .video-js .vjs-volume-panel.vjs-volume-panel-horizontal:active, .video-js .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active { + width: 10em; + transition: width 0.1s; +} +.video-js .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-mute-toggle-only { + width: 4em; +} + +.video-js .vjs-volume-panel .vjs-volume-control.vjs-volume-vertical { + height: 8em; + width: 3em; + left: -3000em; + transition: visibility 1s, opacity 1s, height 1s 1s, width 1s 1s, left 1s 1s, top 1s 1s; +} + +.video-js .vjs-volume-panel .vjs-volume-control.vjs-volume-horizontal { + transition: visibility 1s, opacity 1s, height 1s 1s, width 1s, left 1s 1s, top 1s 1s; +} + +.video-js .vjs-volume-panel { + display: flex; +} + +.video-js .vjs-volume-bar { + margin: 1.35em 0.45em; +} + +.vjs-volume-bar.vjs-slider-horizontal { + width: 5em; + height: 0.3em; +} + +.vjs-volume-bar.vjs-slider-vertical { + width: 0.3em; + height: 5em; + margin: 1.35em auto; +} + +.video-js .vjs-volume-level { + position: absolute; + bottom: 0; + left: 0; + background-color: #fff; +} +.video-js .vjs-volume-level:before { + position: absolute; + font-size: 0.9em; + z-index: 1; +} + +.vjs-slider-vertical .vjs-volume-level { + width: 0.3em; +} +.vjs-slider-vertical .vjs-volume-level:before { + top: -0.5em; + left: -0.3em; + z-index: 1; +} + +.vjs-svg-icons-enabled .vjs-volume-level:before { + content: none; +} + +.vjs-volume-level .vjs-svg-icon { + position: absolute; + width: 0.9em; + height: 0.9em; + pointer-events: none; + z-index: 1; +} + +.vjs-slider-horizontal .vjs-volume-level { + height: 0.3em; +} +.vjs-slider-horizontal .vjs-volume-level:before { + line-height: 0.35em; + right: -0.5em; +} + +.vjs-slider-horizontal .vjs-volume-level .vjs-svg-icon { + right: -0.3em; + transform: translateY(-50%); +} + +.vjs-slider-vertical .vjs-volume-level .vjs-svg-icon { + top: -0.55em; + transform: translateX(-50%); +} + +.video-js .vjs-volume-panel.vjs-volume-panel-vertical { + width: 4em; +} + +.vjs-volume-bar.vjs-slider-vertical .vjs-volume-level { + height: 100%; +} + +.vjs-volume-bar.vjs-slider-horizontal .vjs-volume-level { + width: 100%; +} + +.video-js .vjs-volume-vertical { + width: 3em; + height: 8em; + bottom: 8em; + background-color: #2B333F; + background-color: rgba(43, 51, 63, 0.7); +} + +.video-js .vjs-volume-horizontal .vjs-menu { + left: -2em; +} + +.video-js .vjs-volume-tooltip { + background-color: #fff; + background-color: rgba(255, 255, 255, 0.8); + border-radius: 0.3em; + color: #000; + float: right; + font-family: Arial, Helvetica, sans-serif; + font-size: 1em; + padding: 6px 8px 8px 8px; + pointer-events: none; + position: absolute; + top: -3.4em; + visibility: hidden; + z-index: 1; +} + +.video-js .vjs-volume-control:hover .vjs-volume-tooltip, +.video-js .vjs-volume-control:hover .vjs-progress-holder:focus .vjs-volume-tooltip { + display: block; + font-size: 1em; + visibility: visible; +} + +.video-js .vjs-volume-vertical:hover .vjs-volume-tooltip, +.video-js .vjs-volume-vertical:hover .vjs-progress-holder:focus .vjs-volume-tooltip { + left: 1em; + top: -12px; +} + +.video-js .vjs-volume-control.disabled:hover .vjs-volume-tooltip { + font-size: 1em; +} + +.video-js .vjs-volume-control .vjs-mouse-display { + display: none; + position: absolute; + width: 100%; + height: 1px; + background-color: #000; + z-index: 1; +} + +.video-js .vjs-volume-horizontal .vjs-mouse-display { + width: 1px; + height: 100%; +} + +.video-js .vjs-volume-control:hover .vjs-mouse-display { + display: block; +} + +.video-js.vjs-user-inactive .vjs-volume-control .vjs-mouse-display { + visibility: hidden; + opacity: 0; + transition: visibility 1s, opacity 1s; +} + +.vjs-mouse-display .vjs-volume-tooltip { + color: #fff; + background-color: #000; + background-color: rgba(0, 0, 0, 0.8); +} + +.vjs-poster { + display: inline-block; + vertical-align: middle; + cursor: pointer; + margin: 0; + padding: 0; + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + height: 100%; +} + +.vjs-has-started .vjs-poster, +.vjs-using-native-controls .vjs-poster { + display: none; +} + +.vjs-audio.vjs-has-started .vjs-poster, +.vjs-has-started.vjs-audio-poster-mode .vjs-poster, +.vjs-pip-container.vjs-has-started .vjs-poster { + display: block; +} + +.vjs-poster img { + width: 100%; + height: 100%; + object-fit: contain; +} + +.video-js .vjs-live-control { + display: flex; + align-items: flex-start; + flex: auto; + font-size: 1em; + line-height: 3em; +} + +.video-js:not(.vjs-live) .vjs-live-control, +.video-js.vjs-liveui .vjs-live-control { + display: none; +} + +.video-js .vjs-seek-to-live-control { + align-items: center; + cursor: pointer; + flex: none; + display: inline-flex; + height: 100%; + padding-left: 0.5em; + padding-right: 0.5em; + font-size: 1em; + line-height: 3em; + width: auto; + min-width: 4em; +} + +.video-js.vjs-live:not(.vjs-liveui) .vjs-seek-to-live-control, +.video-js:not(.vjs-live) .vjs-seek-to-live-control { + display: none; +} + +.vjs-seek-to-live-control.vjs-control.vjs-at-live-edge { + cursor: auto; +} + +.vjs-seek-to-live-control .vjs-icon-placeholder { + margin-right: 0.5em; + color: #888; +} + +.vjs-svg-icons-enabled .vjs-seek-to-live-control { + line-height: 0; +} + +.vjs-seek-to-live-control .vjs-svg-icon { + width: 1em; + height: 1em; + pointer-events: none; + fill: #888888; +} + +.vjs-seek-to-live-control.vjs-control.vjs-at-live-edge .vjs-icon-placeholder { + color: red; +} + +.vjs-seek-to-live-control.vjs-control.vjs-at-live-edge .vjs-svg-icon { + fill: red; +} + +.video-js .vjs-time-control { + flex: none; + font-size: 1em; + line-height: 3em; + min-width: 2em; + width: auto; + padding-left: 1em; + padding-right: 1em; +} + +.vjs-live .vjs-time-control, +.vjs-live .vjs-time-divider, +.video-js .vjs-current-time, +.video-js .vjs-duration { + display: none; +} + +.vjs-time-divider { + display: none; + line-height: 3em; +} + +.vjs-normalise-time-controls:not(.vjs-live) .vjs-time-control { + display: flex; +} + +.video-js .vjs-play-control { + cursor: pointer; +} + +.video-js .vjs-play-control .vjs-icon-placeholder { + flex: none; +} + +.vjs-text-track-display { + position: absolute; + bottom: 3em; + left: 0; + right: 0; + top: 0; + pointer-events: none; +} + +.vjs-error .vjs-text-track-display { + display: none; +} + +.video-js.vjs-controls-disabled .vjs-text-track-display, +.video-js.vjs-user-inactive.vjs-playing .vjs-text-track-display { + bottom: 1em; +} + +.video-js .vjs-text-track { + font-size: 1.4em; + text-align: center; + margin-bottom: 0.1em; +} + +.vjs-subtitles { + color: #fff; +} + +.vjs-captions { + color: #fc6; +} + +.vjs-tt-cue { + display: block; +} + +video::-webkit-media-text-track-display { + transform: translateY(-3em); +} + +.video-js.vjs-controls-disabled video::-webkit-media-text-track-display, +.video-js.vjs-user-inactive.vjs-playing video::-webkit-media-text-track-display { + transform: translateY(-1.5em); +} + +.video-js.vjs-force-center-align-cues .vjs-text-track-cue { + text-align: center !important; + width: 80% !important; +} + +@supports not (inset: 10px) { + .video-js .vjs-text-track-display > div { + top: 0; + right: 0; + bottom: 0; + left: 0; + } +} +.video-js .vjs-picture-in-picture-control { + cursor: pointer; + flex: none; +} +.video-js.vjs-audio-only-mode .vjs-picture-in-picture-control, +.vjs-pip-window .vjs-picture-in-picture-control { + display: none; +} + +.video-js .vjs-fullscreen-control { + cursor: pointer; + flex: none; +} +.video-js.vjs-audio-only-mode .vjs-fullscreen-control, +.vjs-pip-window .vjs-fullscreen-control { + display: none; +} + +.vjs-playback-rate > .vjs-menu-button, +.vjs-playback-rate .vjs-playback-rate-value { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; +} + +.vjs-playback-rate .vjs-playback-rate-value { + pointer-events: none; + font-size: 1.5em; + line-height: 2; + text-align: center; +} + +.vjs-playback-rate .vjs-menu { + width: 4em; + left: 0em; +} + +.vjs-error .vjs-error-display .vjs-modal-dialog-content { + font-size: 1.4em; + text-align: center; +} + +.vjs-loading-spinner { + display: none; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + opacity: 0.85; + text-align: left; + border: 0.6em solid rgba(43, 51, 63, 0.7); + box-sizing: border-box; + background-clip: padding-box; + width: 5em; + height: 5em; + border-radius: 50%; + visibility: hidden; +} + +.vjs-seeking .vjs-loading-spinner, +.vjs-waiting .vjs-loading-spinner { + display: flex; + justify-content: center; + align-items: center; + animation: vjs-spinner-show 0s linear 0.3s forwards; +} + +.vjs-error .vjs-loading-spinner { + display: none; +} + +.vjs-loading-spinner:before, +.vjs-loading-spinner:after { + content: ""; + position: absolute; + box-sizing: inherit; + width: inherit; + height: inherit; + border-radius: inherit; + opacity: 1; + border: inherit; + border-color: transparent; + border-top-color: white; +} + +.vjs-seeking .vjs-loading-spinner:before, +.vjs-seeking .vjs-loading-spinner:after, +.vjs-waiting .vjs-loading-spinner:before, +.vjs-waiting .vjs-loading-spinner:after { + animation: vjs-spinner-spin 1.1s cubic-bezier(0.6, 0.2, 0, 0.8) infinite, vjs-spinner-fade 1.1s linear infinite; +} + +.vjs-seeking .vjs-loading-spinner:before, +.vjs-waiting .vjs-loading-spinner:before { + border-top-color: rgb(255, 255, 255); +} + +.vjs-seeking .vjs-loading-spinner:after, +.vjs-waiting .vjs-loading-spinner:after { + border-top-color: rgb(255, 255, 255); + animation-delay: 0.44s; +} + +@keyframes vjs-spinner-show { + to { + visibility: visible; + } +} +@keyframes vjs-spinner-spin { + 100% { + transform: rotate(360deg); + } +} +@keyframes vjs-spinner-fade { + 0% { + border-top-color: #73859f; + } + 20% { + border-top-color: #73859f; + } + 35% { + border-top-color: white; + } + 60% { + border-top-color: #73859f; + } + 100% { + border-top-color: #73859f; + } +} +.video-js.vjs-audio-only-mode .vjs-captions-button { + display: none; +} + +.vjs-chapters-button .vjs-menu ul { + width: 24em; +} + +.video-js.vjs-audio-only-mode .vjs-descriptions-button { + display: none; +} + +.vjs-subs-caps-button + .vjs-menu .vjs-captions-menu-item .vjs-svg-icon { + width: 1.5em; + height: 1.5em; +} + +.video-js .vjs-subs-caps-button + .vjs-menu .vjs-captions-menu-item .vjs-menu-item-text .vjs-icon-placeholder { + vertical-align: middle; + display: inline-block; + margin-bottom: -0.1em; +} + +.video-js .vjs-subs-caps-button + .vjs-menu .vjs-captions-menu-item .vjs-menu-item-text .vjs-icon-placeholder:before { + font-family: VideoJS; + content: "\f10c"; + font-size: 1.5em; + line-height: inherit; +} + +.video-js.vjs-audio-only-mode .vjs-subs-caps-button { + display: none; +} + +.video-js .vjs-audio-button + .vjs-menu .vjs-descriptions-menu-item .vjs-menu-item-text .vjs-icon-placeholder, +.video-js .vjs-audio-button + .vjs-menu .vjs-main-desc-menu-item .vjs-menu-item-text .vjs-icon-placeholder { + vertical-align: middle; + display: inline-block; + margin-bottom: -0.1em; +} + +.video-js .vjs-audio-button + .vjs-menu .vjs-descriptions-menu-item .vjs-menu-item-text .vjs-icon-placeholder:before, +.video-js .vjs-audio-button + .vjs-menu .vjs-main-desc-menu-item .vjs-menu-item-text .vjs-icon-placeholder:before { + font-family: VideoJS; + content: " \f12e"; + font-size: 1.5em; + line-height: inherit; +} + +.video-js.vjs-layout-small .vjs-current-time, +.video-js.vjs-layout-small .vjs-time-divider, +.video-js.vjs-layout-small .vjs-duration, +.video-js.vjs-layout-small .vjs-remaining-time, +.video-js.vjs-layout-small .vjs-playback-rate, +.video-js.vjs-layout-small .vjs-volume-control, .video-js.vjs-layout-x-small .vjs-current-time, +.video-js.vjs-layout-x-small .vjs-time-divider, +.video-js.vjs-layout-x-small .vjs-duration, +.video-js.vjs-layout-x-small .vjs-remaining-time, +.video-js.vjs-layout-x-small .vjs-playback-rate, +.video-js.vjs-layout-x-small .vjs-volume-control, .video-js.vjs-layout-tiny .vjs-current-time, +.video-js.vjs-layout-tiny .vjs-time-divider, +.video-js.vjs-layout-tiny .vjs-duration, +.video-js.vjs-layout-tiny .vjs-remaining-time, +.video-js.vjs-layout-tiny .vjs-playback-rate, +.video-js.vjs-layout-tiny .vjs-volume-control { + display: none; +} +.video-js.vjs-layout-small .vjs-volume-panel.vjs-volume-panel-horizontal:hover, .video-js.vjs-layout-small .vjs-volume-panel.vjs-volume-panel-horizontal:active, .video-js.vjs-layout-small .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active, .video-js.vjs-layout-small .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-hover, .video-js.vjs-layout-x-small .vjs-volume-panel.vjs-volume-panel-horizontal:hover, .video-js.vjs-layout-x-small .vjs-volume-panel.vjs-volume-panel-horizontal:active, .video-js.vjs-layout-x-small .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active, .video-js.vjs-layout-x-small .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-hover, .video-js.vjs-layout-tiny .vjs-volume-panel.vjs-volume-panel-horizontal:hover, .video-js.vjs-layout-tiny .vjs-volume-panel.vjs-volume-panel-horizontal:active, .video-js.vjs-layout-tiny .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active, .video-js.vjs-layout-tiny .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-hover { + width: auto; + width: initial; +} +.video-js.vjs-layout-x-small .vjs-progress-control, .video-js.vjs-layout-tiny .vjs-progress-control { + display: none; +} +.video-js.vjs-layout-x-small .vjs-custom-control-spacer { + flex: auto; + display: block; +} + +.vjs-modal-dialog.vjs-text-track-settings { + background-color: #2B333F; + background-color: rgba(43, 51, 63, 0.75); + color: #fff; + height: 70%; +} +.vjs-spatial-navigation-enabled .vjs-modal-dialog.vjs-text-track-settings { + height: 80%; +} + +.vjs-error .vjs-text-track-settings { + display: none; +} + +.vjs-text-track-settings .vjs-modal-dialog-content { + display: table; +} + +.vjs-text-track-settings .vjs-track-settings-colors, +.vjs-text-track-settings .vjs-track-settings-font, +.vjs-text-track-settings .vjs-track-settings-controls { + display: table-cell; +} + +.vjs-text-track-settings .vjs-track-settings-controls { + text-align: right; + vertical-align: bottom; +} + +@supports (display: grid) { + .vjs-text-track-settings .vjs-modal-dialog-content { + display: grid; + grid-template-columns: 1fr 1fr; + grid-template-rows: 1fr; + padding: 20px 24px 0px 24px; + } + .vjs-track-settings-controls .vjs-default-button { + margin-bottom: 20px; + } + .vjs-text-track-settings .vjs-track-settings-controls { + grid-column: 1/-1; + } + .vjs-layout-small .vjs-text-track-settings .vjs-modal-dialog-content, + .vjs-layout-x-small .vjs-text-track-settings .vjs-modal-dialog-content, + .vjs-layout-tiny .vjs-text-track-settings .vjs-modal-dialog-content { + grid-template-columns: 1fr; + } +} +.vjs-text-track-settings select { + font-size: inherit; +} + +.vjs-track-setting > select { + margin-right: 1em; + margin-bottom: 0.5em; +} + +.vjs-text-track-settings fieldset { + margin: 10px; + border: none; +} + +.vjs-text-track-settings fieldset span { + display: inline-block; + padding: 0 0.6em 0.8em; +} + +.vjs-text-track-settings fieldset span > select { + max-width: 7.3em; +} + +.vjs-text-track-settings legend { + color: #fff; + font-weight: bold; + font-size: 1.2em; +} + +.vjs-text-track-settings .vjs-label { + margin: 0 0.5em 0.5em 0; +} + +.vjs-track-settings-controls button:focus, +.vjs-track-settings-controls button:active { + outline-style: solid; + outline-width: medium; + background-image: linear-gradient(0deg, #fff 88%, #73859f 100%); +} + +.vjs-track-settings-controls button:hover { + color: rgba(43, 51, 63, 0.75); +} + +.vjs-track-settings-controls button { + background-color: #fff; + background-image: linear-gradient(-180deg, #fff 88%, #73859f 100%); + color: #2B333F; + cursor: pointer; + border-radius: 2px; +} + +.vjs-track-settings-controls .vjs-default-button { + margin-right: 1em; +} + +.vjs-title-bar { + background: rgba(0, 0, 0, 0.9); + background: linear-gradient(180deg, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.7) 60%, rgba(0, 0, 0, 0) 100%); + font-size: 1.2em; + line-height: 1.5; + transition: opacity 0.1s; + padding: 0.666em 1.333em 4em; + pointer-events: none; + position: absolute; + top: 0; + width: 100%; +} + +.vjs-error .vjs-title-bar { + display: none; +} + +.vjs-title-bar-title, +.vjs-title-bar-description { + margin: 0; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.vjs-title-bar-title { + font-weight: bold; + margin-bottom: 0.333em; +} + +.vjs-playing.vjs-user-inactive .vjs-title-bar { + opacity: 0; + transition: opacity 1s; +} + +.video-js .vjs-skip-forward-5 { + cursor: pointer; +} +.video-js .vjs-skip-forward-10 { + cursor: pointer; +} +.video-js .vjs-skip-forward-30 { + cursor: pointer; +} +.video-js .vjs-skip-backward-5 { + cursor: pointer; +} +.video-js .vjs-skip-backward-10 { + cursor: pointer; +} +.video-js .vjs-skip-backward-30 { + cursor: pointer; +} +.video-js .vjs-transient-button { + position: absolute; + height: 3em; + display: flex; + align-items: center; + justify-content: center; + background-color: rgba(50, 50, 50, 0.5); + cursor: pointer; + opacity: 1; + transition: opacity 1s; +} + +.video-js:not(.vjs-has-started) .vjs-transient-button { + display: none; +} + +.video-js.not-hover .vjs-transient-button:not(.force-display), +.video-js.vjs-user-inactive .vjs-transient-button:not(.force-display) { + opacity: 0; +} + +.video-js .vjs-transient-button span { + padding: 0 0.5em; +} + +.video-js .vjs-transient-button.vjs-left { + left: 1em; +} + +.video-js .vjs-transient-button.vjs-right { + right: 1em; +} + +.video-js .vjs-transient-button.vjs-top { + top: 1em; +} + +.video-js .vjs-transient-button.vjs-near-top { + top: 4em; +} + +.video-js .vjs-transient-button.vjs-bottom { + bottom: 4em; +} + +.video-js .vjs-transient-button:hover { + background-color: rgba(50, 50, 50, 0.9); +} + +@media print { + .video-js > *:not(.vjs-tech):not(.vjs-poster) { + visibility: hidden; + } +} +.vjs-resize-manager { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + border: none; + z-index: -1000; +} + +.js-focus-visible .video-js *:focus:not(.focus-visible) { + outline: none; +} + +.video-js *:focus:not(:focus-visible) { + outline: none; +} diff --git a/modules/steasyvideo/views/css/video-js.min.css b/modules/steasyvideo/views/css/video-js.min.css new file mode 100644 index 00000000..1b81144e --- /dev/null +++ b/modules/steasyvideo/views/css/video-js.min.css @@ -0,0 +1 @@ +.vjs-svg-icon{display:inline-block;background-repeat:no-repeat;background-position:center;fill:currentColor;height:1.8em;width:1.8em}.vjs-svg-icon:before{content:none!important}.vjs-control:focus .vjs-svg-icon,.vjs-svg-icon:hover{filter:drop-shadow(0 0 .25em #fff)}.video-js .vjs-big-play-button .vjs-icon-placeholder:before,.video-js .vjs-modal-dialog,.vjs-button>.vjs-icon-placeholder:before,.vjs-modal-dialog .vjs-modal-dialog-content{position:absolute;top:0;left:0;width:100%;height:100%}.video-js .vjs-big-play-button .vjs-icon-placeholder:before,.vjs-button>.vjs-icon-placeholder:before{text-align:center}@font-face{font-family:VideoJS;src:url(data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAABTsAAsAAAAAIpAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAADsAAABUIIslek9TLzIAAAFEAAAAPgAAAFZRiV32Y21hcAAAAYQAAAEJAAAD5p42+VxnbHlmAAACkAAADtIAABckI4l972hlYWQAABFkAAAAKwAAADYsvIjpaGhlYQAAEZAAAAAdAAAAJA+RCL1obXR4AAARsAAAABcAAAC8Q2YAAGxvY2EAABHIAAAAYAAAAGB7CIGGbWF4cAAAEigAAAAfAAAAIAFAAI9uYW1lAAASSAAAASUAAAIK1cf1oHBvc3QAABNwAAABfAAAAnXdFqh1eJxjYGRgYOBiMGCwY2BycfMJYeDLSSzJY5BiYGGAAJA8MpsxJzM9kYEDxgPKsYBpDiBmg4gCACY7BUgAeJxjYGR7yDiBgZWBgaWQ5RkDA8MvCM0cwxDOeI6BgYmBlZkBKwhIc01hcPjI+FGPHcRdyA4RZgQRADaGCyYAAHic7dPXbcMwAEXRK1vuvffem749XAbKV3bjBA6fXsaIgMMLEWoQJaAEFKNnlELyQ4K27zib5PNF6vl8yld+TKr5kH0+cUw0xv00Hwvx2DResUyFKrV4XoMmLdp06NKjz4AhI8ZMmDJjzoIlK9Zs2LJjz4EjJ85cuHLjziPe/0UWL17mf2tqKLz/9jK9f8tXpGCoRdPKhtS0RqFkWvVQNtSKoVYNtWaoddPXEBqG2jQ9XWgZattQO4baNdSeofYNdWCoQ0MdGerYUCeGOjXUmaHODXVhqEtDXRnq2lA3hro11J2h7g31YKhHQz0Z6tlQL4Z6NdSbod4N9WGoT9MfHF6GmhnZLxyDcRMAAAB4nJ1YC1hU17U+a5/HMA4iA3NmVBDmoQwP5TFnHlFeA4gYiUFRQINoSCBAyK3G2yi+0aipYtFcHYo2xsb4NiY3+VrNxSaX5uvt495ozNdoYoxmem2/L8HGpLc+InB279pnhlGr5mvL4eyz99nrrL32eu1/DQcc/okdYgdHOA6MQKp4r9gx0EcMHMezOalVasW5BM7NcXoSb9fFgE6KtSSBxWz1FYDPG+vMBGcKb9cebu2VS5s2aaTkCvRSf6C7Y+Ppibm5E09v7IDs2/3uZQtbD0zIyppwoHXh/93ukmyYgdePNRp65p5v+3v/9otQl2O7wP34cT88p8Md2YxpYLQZoRcy6FlSBRnwnGAe6BPMSCZo+7NJVqS0cE4uHendzhSnbPH6TDqL1+Nme5LZXkCHnGyoH0kne30WH+gswhm3q+pt/mTas9NLS64GnjmSlTPw0wVQT/ewRaBgxtydy3cuUB9/6SW+vb5yRvr+t0eOfPKJZ/9t3+4tL7xj32Xd3thCxi+ge6ifdsAN+l5+wi5HQ/cCoeull1AszS7CUfEcJzK7sKWJAdJhCd0sPM4+EY7QDm5ov08hXRQXE5bf6PV5Q5+IjW7X7Nku92Ask4l2hCRRD6TPqISiCJeQna3SCFwrhrNzXHzo4yFevBwxpzxk8WCIIfkvVEKVy32SbT8n68gzgaslpaiO2zIGIyuSb7RNf9HSuN26y/7OC1tgEmpiyA6aD4qcgTOiLThwGG0eB694FI8NHLLN6OBlRVaMxNAFS4JdXUG6mW8PwpKuYLCLXKGbu8iwYNdgO06Sn3Th+/vyZAxs8Ro30DjHe9gy8Fywi24OMm7Qyzh3MTZVOMYhLBnoC+J79lpTUyQmorjhnMwlcQ5uPEYGpDjsOkkH49BjQLQBqs3jFtFdJNlksYmoQFDArLh8Xh+Qd6Ghcsb6FUuehDi+U/lqD71K/qiegeV1imcwjl7ExwiSrf4BZyCujV6cVcFo6VX+G9IcPyFjJnUufbU/jzrL1X99as36reXl8K32nFaOr+E8jWJEcJ55DpMVfSMe95/AJaOsGBH2GJCNpiRQbK4C8BjdmQA22QY2j03Em13i2YHqtNLU1NI04Yj2HJgA6fQc6VPNpA/D+Ryks554NnVy2mB72uRUfPLsqR4N0LOBQKArwJYO+5W2fgZX8oC1HR6HjNaQTVIG2FPwnTcXXGZZfNB7TE6pTKZUwaw91XWLAoFFGcnB5PHjsckgBjbWutrL+0h5Y1xw3DRGDumsnXb3MJwXrJIN5U7m0rgJ3yG5w4he5ckFG4pmNEkOm0/xOO4r4yL87wqtQM+hiJIVp+6iG2wPBKD35ElGkDx+UfC2v1mFG1o+M3AjNFty8biKMXwzyxnZLds8wYD2BxmCPHAldPOeLsy/0BugftYhVYFAhO8SqQ0j3oK7dHJZnI/jxmUS4onlxskSF8thmvNZjIrRZwEPxr0lBuLRuz3oy/FOHCsxwOPYh2M+e9u3J5pgPYz9gp6G7C9m0A11F9ddqKMfV+4sbq45/YspOysXvT+3pdFdYNg2fHbW8Dz301MqDVuGrz0Fuh0YMW8mddrpqzST7rV9BcvqPoNvadRndWp0p8HvbiqrFj5yFQ/vNFSXDpxpLEFWp+DcrF3FT1afWshFcmCfeAMjEvO65i0Y6XijQfSRPWx3TV/Df7Km3E1l+kLt56s/rwVzuRusNMhudznkwdLaS+QNdeal2jDPP4l9qHc98vTYZOSkxzD+njBWVWjFPKgipx6DkWvXQiW8OYcewVHE5yukinDMcfGgc0opDltYKDxIGBedkzc6jSfE7tlvESCDFUw0Hx0opS+U0lHCxNottbNWSxX9zZVvEhKWUSyBpaXwBc2a98M6UqPeXAs/GDon8Ax7hsthO8cM5HU7Ad0UvRR9lHmtyQKZ4MAe814X5h9MSUkQmhf96eVJ6p90OjIiqSIjvykvr2l5U55O/fPQKD+jIomYpNyGJQ25uQ2kIikRfAmuBHCPsWqkSDEqgZ5KDI2sifS/R43MbZg0idFHbCPNxXxZws1ACVE6hAhOdJwRkJLFBLPZpRGYJ50pko6XzMkgmSx40ljik6AQcKhFnLcQE6rF7PXFe1Ocoj0T3AXgSgJTDIhHRfHlYZKuSzc6uievOJGXY+i5GJkkTp7UM3y0LqATDbtFcbdBxO7o4T25JYlEjoH0uynUh8rapkxp62QN70svSF+hT4gGPlovlmcm/ComLi7mV4kTykV9NFWjE/QrwgQ4uIcAP0rQF4VZYRP2o3PhHHzfPMJj9Ir+uzKUlrH49ntT18AVvj1sc3YGjUT/Mt2Dxawa8ArcA7bCQIpvfwAYu22vEG/No/5RvPdA7g+AelLrPwzy+LtkLPhnpIxH14m4EYq8eeMHbPEPNm6G7Nv9B4jcFPZ8bJj0SEjP3MPgQdKTqqEoy2v6G32P/Y6dxOv04AxnoAeq+GILvUavtYCBXm+BaIhuodcfrN5B/V2EYMCPh+SxavjGyPwV0x4CJgUPGT0mQaODGBACIJZGsMXwAD0LGXx7l3CdAcKMIKI+f5CepWeD0BvyU/GcdBxPF8SwejC6LGZmAURFdsSWKR5HyHld2kbdIZO1Ixx+bnnzU7n5+blPNV9jnUDWhP2tC68tbN3PVIldsQPxSAcSpjOav7Q05uXn5zW2LLvDXn9B6syscPy9iDLEMmSrJz6nYuWMipukjM0AH8JkGS+XFyMRkzSCH7KD/hwm172SAyZYumHlefr5AddrtA0O0TnwaVZxcRY9Bfukn9Gf05N1r9DV9MoBsJ1f+ZrqUvtPHizJAntWybv7hmqLt6QLuK6ZS9Fqi1jO5rDoWPZXXII5Tgajg53cIXCjDCGIcYrRIY2n6+mXOa/W0bdhau3ryiEYe2FV/5oeaIYK/5w5frCyll6/cYO8DiNhw6t1MBWmznt91QX62UF1N7l0eHBZTRGpKaqpKVIPF9UcIzmReud9TSY75+K899GHbBu6wjoR7RKKZVYiYxSPf5/2wJT5e3NAhmUbVn5KLx1Ujg0+BGvpAIh0DezInTkzF37KVocxrKU3r1+XLtAe2lO3l66kfQfB/unKY+q8N375Ru8bc4pJXfEcESU95q+p8ZNZRTWH1d9FzvUdYXk5rLkcdkEisoKKVHQW/b3GEx6tPaYcoJfOr9wAbSBnv1IHpep0OExr4LPMkpJM+j7sly7UHkOzXjoAZljHCGiyegtNlwljM0v+c19ET9Pvst09a2Mtgcf5/ZSzYO5h1156+eyydfAsxGa9XAuF6vzjh6CssLq6ECysperXX0sX5h5ZdpZe3guxsGIPEtHk/aqXX1hVqP5HYVVVISkrrNqvXorIc+5Ou91Hnr/LcD2afi6eX7UBloOcs7cOpqgGaNfs1g7bNbs9z6wASaylN69d0/TFTIz6Ws8+oGV3mE2612wRTHKcVUbhjKadebloMc+dyXgMVtVK6BwMB/+mVW09igdRBWaRtNQX59d/VD//xdQ0TCiYNj1KT9sq6Wdu5WTbqk3qDXyDaLa1fv621LS01G3z61sD6lH8lAxDLicV921s6Bf92JOYvzNYCL1khbqBXEFUzC521N5NyzNaQIWhjyFyDoBIVrAjmv2UEaLlI+c6zw1jmVIPLLLZZUTj6GxGHW+mq1tgHXR2D85p4Q934+jLbtjVLcyCdS10NVzpHqxp4Q/hK7WopY/NRGx9HGsPGdFjOjcpjBnGYMVqY/4eqT5khWEHWUup2A/pTw7pdWgsWft7ETUERL96nRg0HNFPmCYba6pylECaExX89A9WLUOVB4oKLu/o1oqSYHCgLzBUlAz8hNFDRpeSU1XT+LRmDUgPaKbYdHDn9suF/tu13nHJij0N97LfS0QmqONuyONk7zvUI6Qa0pF9f2+oABL92AT6e0U//z9YqAiWtJLU1JK0gS+1aacwamiNqK067u9ZQ8f1d4qLodMzz3uL89Z68V/Hnr++hXWUuHgw8dfi972PeTyPefu3aNNucemQ74qFuIaJnVkOu4Q+yjuwmmC1FqZpl1i4uzoPxjkpPf3Xv545tl26Rr+dOvUd+omqJzch9dOeU7f10Y64nMcKK137DccIZq2WdXtdZjbEoLSzHwiMtrjYLDxpHQW8gjMX6XFYAE2zSWVD04EGYSs9MbO6sEo20BMEAB4mpvSypsKjZ4Stgzb+c3A9/MQT2+vrBy+qvyFxLUtLlSRF/Ri2wjfZ2dus2Q8lXx4608/jnqK5OOap6NY2PSjYYnECCjiEeLJll/pbmqfeIK+ps3+MxrlEhqmTPipVP7kqlF4VhpEb6r+Q7YOJg38kJ9SHBf3NBl6+9YchfbUjb5ahLSzUM3kPHmwFAsZ5rpai0S7E5xWzZ1j+fW7zsUWP2g5NXTw52ySCTrgG0+lbw60l2Y/CB185CoA8NK+tbRKxfjy6pm5hzQRRR+cMqv1Jbiw6STivtEvt3DRcy0QEh92JlUGo2PG4tSKHl00YD6xc8CK+YPYyy3io2lN8BcSjKRzrIV6ypOAobqxViJPaT9M9Hy5szY33mp7OX/Zu89L/7Ww5vqY2Y8b0pKgoiUhG5cPDPzq8qTV/WkzUOIvXVVA96kmjcBrr3HrYC/Wn+fYP6Z7T1rqy3zknbvqma/FvVk96fNXGkuaXrdHW5JGSxZT/2I/O73v+yNWafMdzc5NdxYurHs6h86e01sLKLz9EBrg+x36rxAaED7hRnAMx7Vzu+9wabh3zG8XLQjx0ablUJzmxdErxYT3kzQSd0SSafVqF5PXgpp0OyYJ1EyNHpGUZmvK575ySzd85JSqF7IBzSAbMM04+MbE58xF3/njXOGecSaermlw2y9PsSQdytLJVr8t+wg+rR8cZYoeNxVIzNdk3Bngi8U5LAlgTFoQnzJCa5EsCgYhCaGL+qPj7TdhG31p9tej3R04N//PXxNwJvyUqwaJqRPJY98TJ5TPndmflRAkAhBfe46sfKW5wizSge08Xb7Ca/GUVs55trngkKkrUS2WPzKttaaqq+idmahugkY+W6fN0I6i3gPt/x88U4wAAeJxjYGRgYADiGU9YXsXz23xl4GZnAIFH7fO+IdMc/WBxDgYmEAUASbMKwAB4nGNgZGBgZwABjj4Ghv//OfoZGBlQgT4ARicDZAAAAHicY2BgYGAfxJijD8Fmu4EqBwCSpgKpAAAAAAAADgBoAH4AzADgAQIBQgFsAZgB7gIuAooC0AL8A2IDjAOoA+AEMASwBNoFCAVaBcAGCAYuBnAGrAb2B04HigfSCCoIcAiGCJwIyAkkCVYJiAmsCfIKIApWCsQLknicY2BkYGDQZ2hmYGcAASYg5gJCBob/YD4DABqrAdAAeJxdkE1qg0AYhl8Tk9AIoVDaVSmzahcF87PMARLIMoFAl0ZHY1BHdBJIT9AT9AQ9RQ9Qeqy+yteNMzDzfM+88w0K4BY/cNAMB6N2bUaPPBLukybCLvleeAAPj8JD+hfhMV7hC3u4wxs7OO4NzQSZcI/8Ltwnfwi75E/hAR7wJTyk/xYeY49fYQ/PztM+jbTZ7LY6OWdBJdX/pqs6NYWa+zMxa13oKrA6Uoerqi/JwtpYxZXJ1coUVmeZUWVlTjq0/tHacjmdxuL90OR8O0UEDYMNdtiSEpz5XQGqzlm30kzUdAYFFOb8R7NOZk0q2lwAyz1i7oAr1xoXvrOgtYhZx8wY5KRV269JZ5yGpmzPTjQhvY9je6vEElPOuJP3mWKnP5M3V+YAAAB4nG2ReVPbMBDF/ULi2EkDBFqO3gdHLxUzDB9IkdexBllydRD49ihO3Ckz7B/a31utZnafkkGyiXnyclxhgB0MMUKKMTLkmGCKV5hhF3vYxxwHOMRrvMERjnGCU7zFO7zHB3zEJ3zGF3zFN5zhHBe4xHf8wE/8wm8w/MEVimTYKv44XR9MSCsUjVoeHE3vjQoNsSZ4mmxZmVWPjSz7jlou6/0qKOWEJdKMtCe793/hQfqxa6XWZHMXFl56RS4TvPXSaDeoy0zUUZB109KstDK8lHo5q6Qi1hcOnqkImubPS6aqRq7mlnaEWabub4iYblba3SRmgldS0+FWdhNtt04F14JUaqkl7tcpOpJtErvNt3Bd9HRT5JWxK25Ldjvp6br4hzfFiIdSmlzTg2fSUzNrLd1LE1ynxq4OVaVoKLjzJ60UPtj1RKzHzsbjly6inVnFBS2MucviPncU7Rr7lfTxRepDs1A2j3ZHRc7PuzFYSfE3ZOd4kjwBy227hA==) format("woff");font-weight:400;font-style:normal}.video-js .vjs-big-play-button .vjs-icon-placeholder:before,.video-js .vjs-play-control .vjs-icon-placeholder,.vjs-icon-play{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-big-play-button .vjs-icon-placeholder:before,.video-js .vjs-play-control .vjs-icon-placeholder:before,.vjs-icon-play:before{content:"\f101"}.vjs-icon-play-circle{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-play-circle:before{content:"\f102"}.video-js .vjs-play-control.vjs-playing .vjs-icon-placeholder,.vjs-icon-pause{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-play-control.vjs-playing .vjs-icon-placeholder:before,.vjs-icon-pause:before{content:"\f103"}.video-js .vjs-mute-control.vjs-vol-0 .vjs-icon-placeholder,.vjs-icon-volume-mute{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-mute-control.vjs-vol-0 .vjs-icon-placeholder:before,.vjs-icon-volume-mute:before{content:"\f104"}.video-js .vjs-mute-control.vjs-vol-1 .vjs-icon-placeholder,.vjs-icon-volume-low{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-mute-control.vjs-vol-1 .vjs-icon-placeholder:before,.vjs-icon-volume-low:before{content:"\f105"}.video-js .vjs-mute-control.vjs-vol-2 .vjs-icon-placeholder,.vjs-icon-volume-mid{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-mute-control.vjs-vol-2 .vjs-icon-placeholder:before,.vjs-icon-volume-mid:before{content:"\f106"}.video-js .vjs-mute-control .vjs-icon-placeholder,.vjs-icon-volume-high{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-mute-control .vjs-icon-placeholder:before,.vjs-icon-volume-high:before{content:"\f107"}.video-js .vjs-fullscreen-control .vjs-icon-placeholder,.vjs-icon-fullscreen-enter{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-fullscreen-control .vjs-icon-placeholder:before,.vjs-icon-fullscreen-enter:before{content:"\f108"}.video-js.vjs-fullscreen .vjs-fullscreen-control .vjs-icon-placeholder,.vjs-icon-fullscreen-exit{font-family:VideoJS;font-weight:400;font-style:normal}.video-js.vjs-fullscreen .vjs-fullscreen-control .vjs-icon-placeholder:before,.vjs-icon-fullscreen-exit:before{content:"\f109"}.vjs-icon-spinner{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-spinner:before{content:"\f10a"}.video-js .vjs-subs-caps-button .vjs-icon-placeholder,.video-js .vjs-subtitles-button .vjs-icon-placeholder,.video-js.video-js:lang(en-AU) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js.video-js:lang(en-GB) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js.video-js:lang(en-IE) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js.video-js:lang(en-NZ) .vjs-subs-caps-button .vjs-icon-placeholder,.vjs-icon-subtitles{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js .vjs-subtitles-button .vjs-icon-placeholder:before,.video-js.video-js:lang(en-AU) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js.video-js:lang(en-GB) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js.video-js:lang(en-IE) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js.video-js:lang(en-NZ) .vjs-subs-caps-button .vjs-icon-placeholder:before,.vjs-icon-subtitles:before{content:"\f10b"}.video-js .vjs-captions-button .vjs-icon-placeholder,.video-js:lang(en) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js:lang(fr-CA) .vjs-subs-caps-button .vjs-icon-placeholder,.vjs-icon-captions{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-captions-button .vjs-icon-placeholder:before,.video-js:lang(en) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js:lang(fr-CA) .vjs-subs-caps-button .vjs-icon-placeholder:before,.vjs-icon-captions:before{content:"\f10c"}.vjs-icon-hd{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-hd:before{content:"\f10d"}.video-js .vjs-chapters-button .vjs-icon-placeholder,.vjs-icon-chapters{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-chapters-button .vjs-icon-placeholder:before,.vjs-icon-chapters:before{content:"\f10e"}.vjs-icon-downloading{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-downloading:before{content:"\f10f"}.vjs-icon-file-download{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-file-download:before{content:"\f110"}.vjs-icon-file-download-done{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-file-download-done:before{content:"\f111"}.vjs-icon-file-download-off{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-file-download-off:before{content:"\f112"}.vjs-icon-share{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-share:before{content:"\f113"}.vjs-icon-cog{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-cog:before{content:"\f114"}.vjs-icon-square{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-square:before{content:"\f115"}.video-js .vjs-play-progress,.video-js .vjs-volume-level,.vjs-icon-circle,.vjs-seek-to-live-control .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-play-progress:before,.video-js .vjs-volume-level:before,.vjs-icon-circle:before,.vjs-seek-to-live-control .vjs-icon-placeholder:before{content:"\f116"}.vjs-icon-circle-outline{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-circle-outline:before{content:"\f117"}.vjs-icon-circle-inner-circle{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-circle-inner-circle:before{content:"\f118"}.video-js .vjs-control.vjs-close-button .vjs-icon-placeholder,.vjs-icon-cancel{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-control.vjs-close-button .vjs-icon-placeholder:before,.vjs-icon-cancel:before{content:"\f119"}.vjs-icon-repeat{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-repeat:before{content:"\f11a"}.video-js .vjs-play-control.vjs-ended .vjs-icon-placeholder,.vjs-icon-replay{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-play-control.vjs-ended .vjs-icon-placeholder:before,.vjs-icon-replay:before{content:"\f11b"}.video-js .vjs-skip-backward-5 .vjs-icon-placeholder,.vjs-icon-replay-5{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-skip-backward-5 .vjs-icon-placeholder:before,.vjs-icon-replay-5:before{content:"\f11c"}.video-js .vjs-skip-backward-10 .vjs-icon-placeholder,.vjs-icon-replay-10{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-skip-backward-10 .vjs-icon-placeholder:before,.vjs-icon-replay-10:before{content:"\f11d"}.video-js .vjs-skip-backward-30 .vjs-icon-placeholder,.vjs-icon-replay-30{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-skip-backward-30 .vjs-icon-placeholder:before,.vjs-icon-replay-30:before{content:"\f11e"}.video-js .vjs-skip-forward-5 .vjs-icon-placeholder,.vjs-icon-forward-5{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-skip-forward-5 .vjs-icon-placeholder:before,.vjs-icon-forward-5:before{content:"\f11f"}.video-js .vjs-skip-forward-10 .vjs-icon-placeholder,.vjs-icon-forward-10{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-skip-forward-10 .vjs-icon-placeholder:before,.vjs-icon-forward-10:before{content:"\f120"}.video-js .vjs-skip-forward-30 .vjs-icon-placeholder,.vjs-icon-forward-30{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-skip-forward-30 .vjs-icon-placeholder:before,.vjs-icon-forward-30:before{content:"\f121"}.video-js .vjs-audio-button .vjs-icon-placeholder,.vjs-icon-audio{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-audio-button .vjs-icon-placeholder:before,.vjs-icon-audio:before{content:"\f122"}.vjs-icon-next-item{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-next-item:before{content:"\f123"}.vjs-icon-previous-item{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-previous-item:before{content:"\f124"}.vjs-icon-shuffle{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-shuffle:before{content:"\f125"}.vjs-icon-cast{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-cast:before{content:"\f126"}.video-js .vjs-picture-in-picture-control .vjs-icon-placeholder,.vjs-icon-picture-in-picture-enter{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-picture-in-picture-control .vjs-icon-placeholder:before,.vjs-icon-picture-in-picture-enter:before{content:"\f127"}.video-js.vjs-picture-in-picture .vjs-picture-in-picture-control .vjs-icon-placeholder,.vjs-icon-picture-in-picture-exit{font-family:VideoJS;font-weight:400;font-style:normal}.video-js.vjs-picture-in-picture .vjs-picture-in-picture-control .vjs-icon-placeholder:before,.vjs-icon-picture-in-picture-exit:before{content:"\f128"}.vjs-icon-facebook{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-facebook:before{content:"\f129"}.vjs-icon-linkedin{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-linkedin:before{content:"\f12a"}.vjs-icon-twitter{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-twitter:before{content:"\f12b"}.vjs-icon-tumblr{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-tumblr:before{content:"\f12c"}.vjs-icon-pinterest{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-pinterest:before{content:"\f12d"}.video-js .vjs-descriptions-button .vjs-icon-placeholder,.vjs-icon-audio-description{font-family:VideoJS;font-weight:400;font-style:normal}.video-js .vjs-descriptions-button .vjs-icon-placeholder:before,.vjs-icon-audio-description:before{content:"\f12e"}.video-js{display:inline-block;vertical-align:top;box-sizing:border-box;color:#fff;background-color:#000;position:relative;padding:0;font-size:10px;line-height:1;font-weight:400;font-style:normal;font-family:Arial,Helvetica,sans-serif;word-break:initial}.video-js:-moz-full-screen{position:absolute}.video-js:-webkit-full-screen{width:100%!important;height:100%!important}.video-js[tabindex="-1"]{outline:0}.video-js *,.video-js :after,.video-js :before{box-sizing:inherit}.video-js ul{font-family:inherit;font-size:inherit;line-height:inherit;list-style-position:outside;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}.video-js.vjs-1-1,.video-js.vjs-16-9,.video-js.vjs-4-3,.video-js.vjs-9-16,.video-js.vjs-fluid{width:100%;max-width:100%}.video-js.vjs-1-1:not(.vjs-audio-only-mode),.video-js.vjs-16-9:not(.vjs-audio-only-mode),.video-js.vjs-4-3:not(.vjs-audio-only-mode),.video-js.vjs-9-16:not(.vjs-audio-only-mode),.video-js.vjs-fluid:not(.vjs-audio-only-mode){height:0}.video-js.vjs-16-9:not(.vjs-audio-only-mode){padding-top:56.25%}.video-js.vjs-4-3:not(.vjs-audio-only-mode){padding-top:75%}.video-js.vjs-9-16:not(.vjs-audio-only-mode){padding-top:177.7777777778%}.video-js.vjs-1-1:not(.vjs-audio-only-mode){padding-top:100%}.video-js.vjs-fill:not(.vjs-audio-only-mode){width:100%;height:100%}.video-js .vjs-tech{position:absolute;top:0;left:0;width:100%;height:100%}.video-js.vjs-audio-only-mode .vjs-tech{display:none}body.vjs-full-window,body.vjs-pip-window{padding:0;margin:0;height:100%}.vjs-full-window .video-js.vjs-fullscreen,body.vjs-pip-window .video-js{position:fixed;overflow:hidden;z-index:1000;left:0;top:0;bottom:0;right:0}.video-js.vjs-fullscreen:not(.vjs-ios-native-fs),body.vjs-pip-window .video-js{width:100%!important;height:100%!important;padding-top:0!important;display:block}.video-js.vjs-fullscreen.vjs-user-inactive{cursor:none}.vjs-pip-container .vjs-pip-text{position:absolute;bottom:10%;font-size:2em;background-color:rgba(0,0,0,.7);padding:.5em;text-align:center;width:100%}.vjs-layout-small.vjs-pip-container .vjs-pip-text,.vjs-layout-tiny.vjs-pip-container .vjs-pip-text,.vjs-layout-x-small.vjs-pip-container .vjs-pip-text{bottom:0;font-size:1.4em}.vjs-hidden{display:none!important}.vjs-disabled{opacity:.5;cursor:default}.video-js .vjs-offscreen{height:1px;left:-9999px;position:absolute;top:0;width:1px}.vjs-lock-showing{display:block!important;opacity:1!important;visibility:visible!important}.vjs-no-js{padding:20px;color:#fff;background-color:#000;font-size:18px;font-family:Arial,Helvetica,sans-serif;text-align:center;width:300px;height:150px;margin:0 auto}.vjs-no-js a,.vjs-no-js a:visited{color:#66a8cc}.video-js .vjs-big-play-button{font-size:3em;line-height:1.5em;height:1.63332em;width:3em;display:block;position:absolute;top:50%;left:50%;padding:0;margin-top:-.81666em;margin-left:-1.5em;cursor:pointer;opacity:1;border:.06666em solid #fff;background-color:#2b333f;background-color:rgba(43,51,63,.7);border-radius:.3em;transition:all .4s}.vjs-big-play-button .vjs-svg-icon{width:1em;height:1em;position:absolute;top:50%;left:50%;line-height:1;transform:translate(-50%,-50%)}.video-js .vjs-big-play-button:focus,.video-js:hover .vjs-big-play-button{border-color:#fff;background-color:#73859f;background-color:rgba(115,133,159,.5);transition:all 0s}.vjs-controls-disabled .vjs-big-play-button,.vjs-error .vjs-big-play-button,.vjs-has-started .vjs-big-play-button,.vjs-using-native-controls .vjs-big-play-button{display:none}.vjs-has-started.vjs-paused.vjs-show-big-play-button-on-pause:not(.vjs-seeking,.vjs-scrubbing,.vjs-error) .vjs-big-play-button{display:block}.video-js button{background:0 0;border:none;color:inherit;display:inline-block;font-size:inherit;line-height:inherit;text-transform:none;text-decoration:none;transition:none;-webkit-appearance:none;-moz-appearance:none;appearance:none}.video-js.vjs-spatial-navigation-enabled .vjs-button:focus{outline:.0625em solid #fff;box-shadow:none}.vjs-control .vjs-button{width:100%;height:100%}.video-js .vjs-control.vjs-close-button{cursor:pointer;height:3em;position:absolute;right:0;top:.5em;z-index:2}.video-js .vjs-modal-dialog{background:rgba(0,0,0,.8);background:linear-gradient(180deg,rgba(0,0,0,.8),rgba(255,255,255,0));overflow:auto}.video-js .vjs-modal-dialog>*{box-sizing:border-box}.vjs-modal-dialog .vjs-modal-dialog-content{font-size:1.2em;line-height:1.5;padding:20px 24px;z-index:1}.vjs-menu-button{cursor:pointer}.vjs-menu-button.vjs-disabled{cursor:default}.vjs-workinghover .vjs-menu-button.vjs-disabled:hover .vjs-menu{display:none}.vjs-menu .vjs-menu-content{display:block;padding:0;margin:0;font-family:Arial,Helvetica,sans-serif;overflow:auto}.vjs-menu .vjs-menu-content>*{box-sizing:border-box}.vjs-scrubbing .vjs-control.vjs-menu-button:hover .vjs-menu{display:none}.vjs-menu li{display:flex;justify-content:center;list-style:none;margin:0;padding:.2em 0;line-height:1.4em;font-size:1.2em;text-align:center;text-transform:lowercase}.js-focus-visible .vjs-menu li.vjs-menu-item:hover,.vjs-menu li.vjs-menu-item:focus,.vjs-menu li.vjs-menu-item:hover{background-color:#73859f;background-color:rgba(115,133,159,.5)}.js-focus-visible .vjs-menu li.vjs-selected:hover,.vjs-menu li.vjs-selected,.vjs-menu li.vjs-selected:focus,.vjs-menu li.vjs-selected:hover{background-color:#fff;color:#2b333f}.js-focus-visible .vjs-menu li.vjs-selected:hover .vjs-svg-icon,.vjs-menu li.vjs-selected .vjs-svg-icon,.vjs-menu li.vjs-selected:focus .vjs-svg-icon,.vjs-menu li.vjs-selected:hover .vjs-svg-icon{fill:#000}.js-focus-visible .vjs-menu :not(.vjs-selected):focus:not(.focus-visible),.video-js .vjs-menu :not(.vjs-selected):focus:not(:focus-visible){background:0 0}.vjs-menu li.vjs-menu-title{text-align:center;text-transform:uppercase;font-size:1em;line-height:2em;padding:0;margin:0 0 .3em 0;font-weight:700;cursor:default}.vjs-menu-button-popup .vjs-menu{display:none;position:absolute;bottom:0;width:10em;left:-3em;height:0;margin-bottom:1.5em;border-top-color:rgba(43,51,63,.7)}.vjs-pip-window .vjs-menu-button-popup .vjs-menu{left:unset;right:1em}.vjs-menu-button-popup .vjs-menu .vjs-menu-content{background-color:#2b333f;background-color:rgba(43,51,63,.7);position:absolute;width:100%;bottom:1.5em;max-height:15em}.vjs-layout-tiny .vjs-menu-button-popup .vjs-menu .vjs-menu-content,.vjs-layout-x-small .vjs-menu-button-popup .vjs-menu .vjs-menu-content{max-height:5em}.vjs-layout-small .vjs-menu-button-popup .vjs-menu .vjs-menu-content{max-height:10em}.vjs-layout-medium .vjs-menu-button-popup .vjs-menu .vjs-menu-content{max-height:14em}.vjs-layout-huge .vjs-menu-button-popup .vjs-menu .vjs-menu-content,.vjs-layout-large .vjs-menu-button-popup .vjs-menu .vjs-menu-content,.vjs-layout-x-large .vjs-menu-button-popup .vjs-menu .vjs-menu-content{max-height:25em}.vjs-menu-button-popup .vjs-menu.vjs-lock-showing,.vjs-workinghover .vjs-menu-button-popup.vjs-hover .vjs-menu{display:block}.video-js .vjs-menu-button-inline{transition:all .4s;overflow:hidden}.video-js .vjs-menu-button-inline:before{width:2.222222222em}.video-js .vjs-menu-button-inline.vjs-slider-active,.video-js .vjs-menu-button-inline:focus,.video-js .vjs-menu-button-inline:hover{width:12em}.vjs-menu-button-inline .vjs-menu{opacity:0;height:100%;width:auto;position:absolute;left:4em;top:0;padding:0;margin:0;transition:all .4s}.vjs-menu-button-inline.vjs-slider-active .vjs-menu,.vjs-menu-button-inline:focus .vjs-menu,.vjs-menu-button-inline:hover .vjs-menu{display:block;opacity:1}.vjs-menu-button-inline .vjs-menu-content{width:auto;height:100%;margin:0;overflow:hidden}.video-js .vjs-control-bar{display:none;width:100%;position:absolute;bottom:0;left:0;right:0;height:3em;background-color:#2b333f;background-color:rgba(43,51,63,.7)}.video-js.vjs-spatial-navigation-enabled .vjs-control-bar{gap:1px}.video-js:not(.vjs-controls-disabled,.vjs-using-native-controls,.vjs-error) .vjs-control-bar.vjs-lock-showing{display:flex!important}.vjs-audio-only-mode .vjs-control-bar,.vjs-has-started .vjs-control-bar{display:flex;visibility:visible;opacity:1;transition:visibility .1s,opacity .1s}.vjs-has-started.vjs-user-inactive.vjs-playing .vjs-control-bar{visibility:visible;opacity:0;pointer-events:none;transition:visibility 1s,opacity 1s}.vjs-controls-disabled .vjs-control-bar,.vjs-error .vjs-control-bar,.vjs-using-native-controls .vjs-control-bar{display:none!important}.vjs-audio-only-mode.vjs-has-started.vjs-user-inactive.vjs-playing .vjs-control-bar,.vjs-audio.vjs-has-started.vjs-user-inactive.vjs-playing .vjs-control-bar{opacity:1;visibility:visible;pointer-events:auto}.video-js .vjs-control{position:relative;text-align:center;margin:0;padding:0;height:100%;width:4em;flex:none}.video-js .vjs-control.vjs-visible-text{width:auto;padding-left:1em;padding-right:1em}.vjs-button>.vjs-icon-placeholder:before{font-size:1.8em;line-height:1.67}.vjs-button>.vjs-icon-placeholder{display:block}.vjs-button>.vjs-svg-icon{display:inline-block}.video-js .vjs-control:focus,.video-js .vjs-control:focus:before,.video-js .vjs-control:hover:before{text-shadow:0 0 1em #fff}.video-js :not(.vjs-visible-text)>.vjs-control-text{border:0;clip:rect(0 0 0 0);height:1px;overflow:hidden;padding:0;position:absolute;width:1px}.video-js .vjs-custom-control-spacer{display:none}.video-js .vjs-progress-control{cursor:pointer;flex:auto;display:flex;align-items:center;min-width:4em;touch-action:none}.video-js .vjs-progress-control.disabled{cursor:default}.vjs-live .vjs-progress-control{display:none}.vjs-liveui .vjs-progress-control{display:flex;align-items:center}.video-js .vjs-progress-holder{flex:auto;transition:all .2s;height:.3em}.video-js .vjs-progress-control .vjs-progress-holder{margin:0 10px}.video-js .vjs-progress-control:hover .vjs-progress-holder{font-size:1.6666666667em}.video-js .vjs-progress-control:hover .vjs-progress-holder.disabled{font-size:1em}.video-js .vjs-progress-holder .vjs-load-progress,.video-js .vjs-progress-holder .vjs-load-progress div,.video-js .vjs-progress-holder .vjs-play-progress{position:absolute;display:block;height:100%;margin:0;padding:0;width:0}.video-js .vjs-play-progress{background-color:#fff}.video-js .vjs-play-progress:before{font-size:.9em;position:absolute;right:-.5em;line-height:.35em;z-index:1}.vjs-svg-icons-enabled .vjs-play-progress:before{content:none!important}.vjs-play-progress .vjs-svg-icon{position:absolute;top:-.35em;right:-.4em;width:.9em;height:.9em;pointer-events:none;line-height:.15em;z-index:1}.video-js .vjs-load-progress{background:rgba(115,133,159,.5)}.video-js .vjs-load-progress div{background:rgba(115,133,159,.75)}.video-js .vjs-time-tooltip{background-color:#fff;background-color:rgba(255,255,255,.8);border-radius:.3em;color:#000;float:right;font-family:Arial,Helvetica,sans-serif;font-size:1em;padding:6px 8px 8px 8px;pointer-events:none;position:absolute;top:-3.4em;visibility:hidden;z-index:1}.video-js .vjs-progress-holder:focus .vjs-time-tooltip{display:none}.video-js .vjs-progress-control:hover .vjs-progress-holder:focus .vjs-time-tooltip,.video-js .vjs-progress-control:hover .vjs-time-tooltip{display:block;font-size:.6em;visibility:visible}.video-js .vjs-progress-control.disabled:hover .vjs-time-tooltip{font-size:1em}.video-js .vjs-progress-control .vjs-mouse-display{display:none;position:absolute;width:1px;height:100%;background-color:#000;z-index:1}.video-js .vjs-progress-control:hover .vjs-mouse-display{display:block}.video-js.vjs-user-inactive .vjs-progress-control .vjs-mouse-display{visibility:hidden;opacity:0;transition:visibility 1s,opacity 1s}.vjs-mouse-display .vjs-time-tooltip{color:#fff;background-color:#000;background-color:rgba(0,0,0,.8)}.video-js .vjs-slider{position:relative;cursor:pointer;padding:0;margin:0 .45em 0 .45em;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;background-color:#73859f;background-color:rgba(115,133,159,.5)}.video-js .vjs-slider.disabled{cursor:default}.video-js .vjs-slider:focus{text-shadow:0 0 1em #fff;box-shadow:0 0 1em #fff}.video-js.vjs-spatial-navigation-enabled .vjs-slider:focus{outline:.0625em solid #fff}.video-js .vjs-mute-control{cursor:pointer;flex:none}.video-js .vjs-volume-control{cursor:pointer;margin-right:1em;display:flex}.video-js .vjs-volume-control.vjs-volume-horizontal{width:5em}.video-js .vjs-volume-panel .vjs-volume-control{visibility:visible;opacity:0;width:1px;height:1px;margin-left:-1px}.video-js .vjs-volume-panel{transition:width 1s}.video-js .vjs-volume-panel .vjs-volume-control.vjs-slider-active,.video-js .vjs-volume-panel .vjs-volume-control:active,.video-js .vjs-volume-panel.vjs-hover .vjs-mute-control~.vjs-volume-control,.video-js .vjs-volume-panel.vjs-hover .vjs-volume-control,.video-js .vjs-volume-panel:active .vjs-volume-control,.video-js .vjs-volume-panel:focus .vjs-volume-control{visibility:visible;opacity:1;position:relative;transition:visibility .1s,opacity .1s,height .1s,width .1s,left 0s,top 0s}.video-js .vjs-volume-panel .vjs-volume-control.vjs-slider-active.vjs-volume-horizontal,.video-js .vjs-volume-panel .vjs-volume-control:active.vjs-volume-horizontal,.video-js .vjs-volume-panel.vjs-hover .vjs-mute-control~.vjs-volume-control.vjs-volume-horizontal,.video-js .vjs-volume-panel.vjs-hover .vjs-volume-control.vjs-volume-horizontal,.video-js .vjs-volume-panel:active .vjs-volume-control.vjs-volume-horizontal,.video-js .vjs-volume-panel:focus .vjs-volume-control.vjs-volume-horizontal{width:5em;height:3em;margin-right:0}.video-js .vjs-volume-panel .vjs-volume-control.vjs-slider-active.vjs-volume-vertical,.video-js .vjs-volume-panel .vjs-volume-control:active.vjs-volume-vertical,.video-js .vjs-volume-panel.vjs-hover .vjs-mute-control~.vjs-volume-control.vjs-volume-vertical,.video-js .vjs-volume-panel.vjs-hover .vjs-volume-control.vjs-volume-vertical,.video-js .vjs-volume-panel:active .vjs-volume-control.vjs-volume-vertical,.video-js .vjs-volume-panel:focus .vjs-volume-control.vjs-volume-vertical{left:-3.5em;transition:left 0s}.video-js .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-hover,.video-js .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active,.video-js .vjs-volume-panel.vjs-volume-panel-horizontal:active{width:10em;transition:width .1s}.video-js .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-mute-toggle-only{width:4em}.video-js .vjs-volume-panel .vjs-volume-control.vjs-volume-vertical{height:8em;width:3em;left:-3000em;transition:visibility 1s,opacity 1s,height 1s 1s,width 1s 1s,left 1s 1s,top 1s 1s}.video-js .vjs-volume-panel .vjs-volume-control.vjs-volume-horizontal{transition:visibility 1s,opacity 1s,height 1s 1s,width 1s,left 1s 1s,top 1s 1s}.video-js .vjs-volume-panel{display:flex}.video-js .vjs-volume-bar{margin:1.35em .45em}.vjs-volume-bar.vjs-slider-horizontal{width:5em;height:.3em}.vjs-volume-bar.vjs-slider-vertical{width:.3em;height:5em;margin:1.35em auto}.video-js .vjs-volume-level{position:absolute;bottom:0;left:0;background-color:#fff}.video-js .vjs-volume-level:before{position:absolute;font-size:.9em;z-index:1}.vjs-slider-vertical .vjs-volume-level{width:.3em}.vjs-slider-vertical .vjs-volume-level:before{top:-.5em;left:-.3em;z-index:1}.vjs-svg-icons-enabled .vjs-volume-level:before{content:none}.vjs-volume-level .vjs-svg-icon{position:absolute;width:.9em;height:.9em;pointer-events:none;z-index:1}.vjs-slider-horizontal .vjs-volume-level{height:.3em}.vjs-slider-horizontal .vjs-volume-level:before{line-height:.35em;right:-.5em}.vjs-slider-horizontal .vjs-volume-level .vjs-svg-icon{right:-.3em;transform:translateY(-50%)}.vjs-slider-vertical .vjs-volume-level .vjs-svg-icon{top:-.55em;transform:translateX(-50%)}.video-js .vjs-volume-panel.vjs-volume-panel-vertical{width:4em}.vjs-volume-bar.vjs-slider-vertical .vjs-volume-level{height:100%}.vjs-volume-bar.vjs-slider-horizontal .vjs-volume-level{width:100%}.video-js .vjs-volume-vertical{width:3em;height:8em;bottom:8em;background-color:#2b333f;background-color:rgba(43,51,63,.7)}.video-js .vjs-volume-horizontal .vjs-menu{left:-2em}.video-js .vjs-volume-tooltip{background-color:#fff;background-color:rgba(255,255,255,.8);border-radius:.3em;color:#000;float:right;font-family:Arial,Helvetica,sans-serif;font-size:1em;padding:6px 8px 8px 8px;pointer-events:none;position:absolute;top:-3.4em;visibility:hidden;z-index:1}.video-js .vjs-volume-control:hover .vjs-progress-holder:focus .vjs-volume-tooltip,.video-js .vjs-volume-control:hover .vjs-volume-tooltip{display:block;font-size:1em;visibility:visible}.video-js .vjs-volume-vertical:hover .vjs-progress-holder:focus .vjs-volume-tooltip,.video-js .vjs-volume-vertical:hover .vjs-volume-tooltip{left:1em;top:-12px}.video-js .vjs-volume-control.disabled:hover .vjs-volume-tooltip{font-size:1em}.video-js .vjs-volume-control .vjs-mouse-display{display:none;position:absolute;width:100%;height:1px;background-color:#000;z-index:1}.video-js .vjs-volume-horizontal .vjs-mouse-display{width:1px;height:100%}.video-js .vjs-volume-control:hover .vjs-mouse-display{display:block}.video-js.vjs-user-inactive .vjs-volume-control .vjs-mouse-display{visibility:hidden;opacity:0;transition:visibility 1s,opacity 1s}.vjs-mouse-display .vjs-volume-tooltip{color:#fff;background-color:#000;background-color:rgba(0,0,0,.8)}.vjs-poster{display:inline-block;vertical-align:middle;cursor:pointer;margin:0;padding:0;position:absolute;top:0;right:0;bottom:0;left:0;height:100%}.vjs-has-started .vjs-poster,.vjs-using-native-controls .vjs-poster{display:none}.vjs-audio.vjs-has-started .vjs-poster,.vjs-has-started.vjs-audio-poster-mode .vjs-poster,.vjs-pip-container.vjs-has-started .vjs-poster{display:block}.vjs-poster img{width:100%;height:100%;object-fit:contain}.video-js .vjs-live-control{display:flex;align-items:flex-start;flex:auto;font-size:1em;line-height:3em}.video-js.vjs-liveui .vjs-live-control,.video-js:not(.vjs-live) .vjs-live-control{display:none}.video-js .vjs-seek-to-live-control{align-items:center;cursor:pointer;flex:none;display:inline-flex;height:100%;padding-left:.5em;padding-right:.5em;font-size:1em;line-height:3em;width:auto;min-width:4em}.video-js.vjs-live:not(.vjs-liveui) .vjs-seek-to-live-control,.video-js:not(.vjs-live) .vjs-seek-to-live-control{display:none}.vjs-seek-to-live-control.vjs-control.vjs-at-live-edge{cursor:auto}.vjs-seek-to-live-control .vjs-icon-placeholder{margin-right:.5em;color:#888}.vjs-svg-icons-enabled .vjs-seek-to-live-control{line-height:0}.vjs-seek-to-live-control .vjs-svg-icon{width:1em;height:1em;pointer-events:none;fill:#888}.vjs-seek-to-live-control.vjs-control.vjs-at-live-edge .vjs-icon-placeholder{color:red}.vjs-seek-to-live-control.vjs-control.vjs-at-live-edge .vjs-svg-icon{fill:red}.video-js .vjs-time-control{flex:none;font-size:1em;line-height:3em;min-width:2em;width:auto;padding-left:1em;padding-right:1em}.video-js .vjs-current-time,.video-js .vjs-duration,.vjs-live .vjs-time-control,.vjs-live .vjs-time-divider{display:none}.vjs-time-divider{display:none;line-height:3em}.vjs-normalise-time-controls:not(.vjs-live) .vjs-time-control{display:flex}.video-js .vjs-play-control{cursor:pointer}.video-js .vjs-play-control .vjs-icon-placeholder{flex:none}.vjs-text-track-display{position:absolute;bottom:3em;left:0;right:0;top:0;pointer-events:none}.vjs-error .vjs-text-track-display{display:none}.video-js.vjs-controls-disabled .vjs-text-track-display,.video-js.vjs-user-inactive.vjs-playing .vjs-text-track-display{bottom:1em}.video-js .vjs-text-track{font-size:1.4em;text-align:center;margin-bottom:.1em}.vjs-subtitles{color:#fff}.vjs-captions{color:#fc6}.vjs-tt-cue{display:block}video::-webkit-media-text-track-display{transform:translateY(-3em)}.video-js.vjs-controls-disabled video::-webkit-media-text-track-display,.video-js.vjs-user-inactive.vjs-playing video::-webkit-media-text-track-display{transform:translateY(-1.5em)}.video-js.vjs-force-center-align-cues .vjs-text-track-cue{text-align:center!important;width:80%!important}@supports not (inset:10px){.video-js .vjs-text-track-display>div{top:0;right:0;bottom:0;left:0}}.video-js .vjs-picture-in-picture-control{cursor:pointer;flex:none}.video-js.vjs-audio-only-mode .vjs-picture-in-picture-control,.vjs-pip-window .vjs-picture-in-picture-control{display:none}.video-js .vjs-fullscreen-control{cursor:pointer;flex:none}.video-js.vjs-audio-only-mode .vjs-fullscreen-control,.vjs-pip-window .vjs-fullscreen-control{display:none}.vjs-playback-rate .vjs-playback-rate-value,.vjs-playback-rate>.vjs-menu-button{position:absolute;top:0;left:0;width:100%;height:100%}.vjs-playback-rate .vjs-playback-rate-value{pointer-events:none;font-size:1.5em;line-height:2;text-align:center}.vjs-playback-rate .vjs-menu{width:4em;left:0}.vjs-error .vjs-error-display .vjs-modal-dialog-content{font-size:1.4em;text-align:center}.vjs-loading-spinner{display:none;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);opacity:.85;text-align:left;border:.6em solid rgba(43,51,63,.7);box-sizing:border-box;background-clip:padding-box;width:5em;height:5em;border-radius:50%;visibility:hidden}.vjs-seeking .vjs-loading-spinner,.vjs-waiting .vjs-loading-spinner{display:flex;justify-content:center;align-items:center;animation:vjs-spinner-show 0s linear .3s forwards}.vjs-error .vjs-loading-spinner{display:none}.vjs-loading-spinner:after,.vjs-loading-spinner:before{content:"";position:absolute;box-sizing:inherit;width:inherit;height:inherit;border-radius:inherit;opacity:1;border:inherit;border-color:transparent;border-top-color:#fff}.vjs-seeking .vjs-loading-spinner:after,.vjs-seeking .vjs-loading-spinner:before,.vjs-waiting .vjs-loading-spinner:after,.vjs-waiting .vjs-loading-spinner:before{animation:vjs-spinner-spin 1.1s cubic-bezier(.6,.2,0,.8) infinite,vjs-spinner-fade 1.1s linear infinite}.vjs-seeking .vjs-loading-spinner:before,.vjs-waiting .vjs-loading-spinner:before{border-top-color:#fff}.vjs-seeking .vjs-loading-spinner:after,.vjs-waiting .vjs-loading-spinner:after{border-top-color:#fff;animation-delay:.44s}@keyframes vjs-spinner-show{to{visibility:visible}}@keyframes vjs-spinner-spin{100%{transform:rotate(360deg)}}@keyframes vjs-spinner-fade{0%{border-top-color:#73859f}20%{border-top-color:#73859f}35%{border-top-color:#fff}60%{border-top-color:#73859f}100%{border-top-color:#73859f}}.video-js.vjs-audio-only-mode .vjs-captions-button{display:none}.vjs-chapters-button .vjs-menu ul{width:24em}.video-js.vjs-audio-only-mode .vjs-descriptions-button{display:none}.vjs-subs-caps-button+.vjs-menu .vjs-captions-menu-item .vjs-svg-icon{width:1.5em;height:1.5em}.video-js .vjs-subs-caps-button+.vjs-menu .vjs-captions-menu-item .vjs-menu-item-text .vjs-icon-placeholder{vertical-align:middle;display:inline-block;margin-bottom:-.1em}.video-js .vjs-subs-caps-button+.vjs-menu .vjs-captions-menu-item .vjs-menu-item-text .vjs-icon-placeholder:before{font-family:VideoJS;content:"\f10c";font-size:1.5em;line-height:inherit}.video-js.vjs-audio-only-mode .vjs-subs-caps-button{display:none}.video-js .vjs-audio-button+.vjs-menu .vjs-descriptions-menu-item .vjs-menu-item-text .vjs-icon-placeholder,.video-js .vjs-audio-button+.vjs-menu .vjs-main-desc-menu-item .vjs-menu-item-text .vjs-icon-placeholder{vertical-align:middle;display:inline-block;margin-bottom:-.1em}.video-js .vjs-audio-button+.vjs-menu .vjs-descriptions-menu-item .vjs-menu-item-text .vjs-icon-placeholder:before,.video-js .vjs-audio-button+.vjs-menu .vjs-main-desc-menu-item .vjs-menu-item-text .vjs-icon-placeholder:before{font-family:VideoJS;content:" \f12e";font-size:1.5em;line-height:inherit}.video-js.vjs-layout-small .vjs-current-time,.video-js.vjs-layout-small .vjs-duration,.video-js.vjs-layout-small .vjs-playback-rate,.video-js.vjs-layout-small .vjs-remaining-time,.video-js.vjs-layout-small .vjs-time-divider,.video-js.vjs-layout-small .vjs-volume-control,.video-js.vjs-layout-tiny .vjs-current-time,.video-js.vjs-layout-tiny .vjs-duration,.video-js.vjs-layout-tiny .vjs-playback-rate,.video-js.vjs-layout-tiny .vjs-remaining-time,.video-js.vjs-layout-tiny .vjs-time-divider,.video-js.vjs-layout-tiny .vjs-volume-control,.video-js.vjs-layout-x-small .vjs-current-time,.video-js.vjs-layout-x-small .vjs-duration,.video-js.vjs-layout-x-small .vjs-playback-rate,.video-js.vjs-layout-x-small .vjs-remaining-time,.video-js.vjs-layout-x-small .vjs-time-divider,.video-js.vjs-layout-x-small .vjs-volume-control{display:none}.video-js.vjs-layout-small .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-hover,.video-js.vjs-layout-small .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active,.video-js.vjs-layout-small .vjs-volume-panel.vjs-volume-panel-horizontal:active,.video-js.vjs-layout-small .vjs-volume-panel.vjs-volume-panel-horizontal:hover,.video-js.vjs-layout-tiny .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-hover,.video-js.vjs-layout-tiny .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active,.video-js.vjs-layout-tiny .vjs-volume-panel.vjs-volume-panel-horizontal:active,.video-js.vjs-layout-tiny .vjs-volume-panel.vjs-volume-panel-horizontal:hover,.video-js.vjs-layout-x-small .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-hover,.video-js.vjs-layout-x-small .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active,.video-js.vjs-layout-x-small .vjs-volume-panel.vjs-volume-panel-horizontal:active,.video-js.vjs-layout-x-small .vjs-volume-panel.vjs-volume-panel-horizontal:hover{width:auto;width:initial}.video-js.vjs-layout-tiny .vjs-progress-control,.video-js.vjs-layout-x-small .vjs-progress-control{display:none}.video-js.vjs-layout-x-small .vjs-custom-control-spacer{flex:auto;display:block}.vjs-modal-dialog.vjs-text-track-settings{background-color:#2b333f;background-color:rgba(43,51,63,.75);color:#fff;height:70%}.vjs-spatial-navigation-enabled .vjs-modal-dialog.vjs-text-track-settings{height:80%}.vjs-error .vjs-text-track-settings{display:none}.vjs-text-track-settings .vjs-modal-dialog-content{display:table}.vjs-text-track-settings .vjs-track-settings-colors,.vjs-text-track-settings .vjs-track-settings-controls,.vjs-text-track-settings .vjs-track-settings-font{display:table-cell}.vjs-text-track-settings .vjs-track-settings-controls{text-align:right;vertical-align:bottom}@supports (display:grid){.vjs-text-track-settings .vjs-modal-dialog-content{display:grid;grid-template-columns:1fr 1fr;grid-template-rows:1fr;padding:20px 24px 0 24px}.vjs-track-settings-controls .vjs-default-button{margin-bottom:20px}.vjs-text-track-settings .vjs-track-settings-controls{grid-column:1/-1}.vjs-layout-small .vjs-text-track-settings .vjs-modal-dialog-content,.vjs-layout-tiny .vjs-text-track-settings .vjs-modal-dialog-content,.vjs-layout-x-small .vjs-text-track-settings .vjs-modal-dialog-content{grid-template-columns:1fr}}.vjs-text-track-settings select{font-size:inherit}.vjs-track-setting>select{margin-right:1em;margin-bottom:.5em}.vjs-text-track-settings fieldset{margin:10px;border:none}.vjs-text-track-settings fieldset span{display:inline-block;padding:0 .6em .8em}.vjs-text-track-settings fieldset span>select{max-width:7.3em}.vjs-text-track-settings legend{color:#fff;font-weight:700;font-size:1.2em}.vjs-text-track-settings .vjs-label{margin:0 .5em .5em 0}.vjs-track-settings-controls button:active,.vjs-track-settings-controls button:focus{outline-style:solid;outline-width:medium;background-image:linear-gradient(0deg,#fff 88%,#73859f 100%)}.vjs-track-settings-controls button:hover{color:rgba(43,51,63,.75)}.vjs-track-settings-controls button{background-color:#fff;background-image:linear-gradient(-180deg,#fff 88%,#73859f 100%);color:#2b333f;cursor:pointer;border-radius:2px}.vjs-track-settings-controls .vjs-default-button{margin-right:1em}.vjs-title-bar{background:rgba(0,0,0,.9);background:linear-gradient(180deg,rgba(0,0,0,.9) 0,rgba(0,0,0,.7) 60%,rgba(0,0,0,0) 100%);font-size:1.2em;line-height:1.5;transition:opacity .1s;padding:.666em 1.333em 4em;pointer-events:none;position:absolute;top:0;width:100%}.vjs-error .vjs-title-bar{display:none}.vjs-title-bar-description,.vjs-title-bar-title{margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.vjs-title-bar-title{font-weight:700;margin-bottom:.333em}.vjs-playing.vjs-user-inactive .vjs-title-bar{opacity:0;transition:opacity 1s}.video-js .vjs-skip-forward-5{cursor:pointer}.video-js .vjs-skip-forward-10{cursor:pointer}.video-js .vjs-skip-forward-30{cursor:pointer}.video-js .vjs-skip-backward-5{cursor:pointer}.video-js .vjs-skip-backward-10{cursor:pointer}.video-js .vjs-skip-backward-30{cursor:pointer}.video-js .vjs-transient-button{position:absolute;height:3em;display:flex;align-items:center;justify-content:center;background-color:rgba(50,50,50,.5);cursor:pointer;opacity:1;transition:opacity 1s}.video-js:not(.vjs-has-started) .vjs-transient-button{display:none}.video-js.not-hover .vjs-transient-button:not(.force-display),.video-js.vjs-user-inactive .vjs-transient-button:not(.force-display){opacity:0}.video-js .vjs-transient-button span{padding:0 .5em}.video-js .vjs-transient-button.vjs-left{left:1em}.video-js .vjs-transient-button.vjs-right{right:1em}.video-js .vjs-transient-button.vjs-top{top:1em}.video-js .vjs-transient-button.vjs-near-top{top:4em}.video-js .vjs-transient-button.vjs-bottom{bottom:4em}.video-js .vjs-transient-button:hover{background-color:rgba(50,50,50,.9)}@media print{.video-js>:not(.vjs-tech):not(.vjs-poster){visibility:hidden}}.vjs-resize-manager{position:absolute;top:0;left:0;width:100%;height:100%;border:none;z-index:-1000}.js-focus-visible .video-js :focus:not(.focus-visible){outline:0}.video-js :focus:not(:focus-visible){outline:0} \ No newline at end of file diff --git a/modules/steasyvideo/views/index.php b/modules/steasyvideo/views/index.php new file mode 100644 index 00000000..76cd9dd3 --- /dev/null +++ b/modules/steasyvideo/views/index.php @@ -0,0 +1,35 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/modules/steasyvideo/views/js/admin.js b/modules/steasyvideo/views/js/admin.js new file mode 100644 index 00000000..7c9ba402 --- /dev/null +++ b/modules/steasyvideo/views/js/admin.js @@ -0,0 +1,215 @@ +/** + * Copyright since 2007 PrestaShop SA and Contributors + * PrestaShop is an International Registered Trademark & Property of PrestaShop SA + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.md. + * It is also available through the world-wide-web at this URL: + * https://opensource.org/licenses/OSL-3.0 + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@prestashop.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade PrestaShop to newer + * versions in the future. If you wish to customize PrestaShop for your + * needs please refer to https://devdocs.prestashop.com/ for more information. + * + * @author PrestaShop SA and Contributors + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ +jQuery(function($){ + + $('.st_delete_image').click(function(){ + var self = $(this); + var id = self.data('id'); + $.getJSON(currentIndex+'&token='+token+'&configure=steasyvideo&id_st_easy_video='+id+'&act=delete_image&ts='+new Date().getTime(), + function(json){ + if(json.r) { + self.closest('.form-group').remove(); + } + else + alert('Error'); + } + ); + return false; + }); + $(document).on('change', '#st_easy_video_form #url', function(){ + var regExp = /.*(?:youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=)([^#\&\?]*).*/; + var match = $(this).val().match(regExp); + if (match && match[1].length == 11) + $('#youtube_thumbnail').html(''); + else + $('#youtube_thumbnail').empty(); + }); + if($('#st_easy_video_form #url').val()) + $('#st_easy_video_form #url').trigger('change'); + + /*handle_contr($('[name="contr"]').val()); + $(document).on('change', '[name="contr"]', function(){ + handle_contr($(this).val()); + });*/ + + $(document).on('click', '.st_ac_del_product', function(){ + $(this).closest('li').remove(); + var $ac = $(this).closest('.form-group').find('.ac_products'); + if(!$ac.hasClass('ac_input')) + steasyvideoo_admin.ac($ac); + $ac.setOptions({ + extraParams: { + excludeIds : getProductExcIds($(this).closest('.form-group').find('.curr_products')) + } + }); + }); + $(document).on('focus', '.ac_products', function(){ + if(!$(this).hasClass('ac_input')) + steasyvideoo_admin.ac($(this)); + }); + $(document).on('click', '.stsb_ac_del_product', function(){ + $(this).closest('li').remove(); + var $ac = $(this).closest('.form-group').find('.ac_products'); + if(!$ac.hasClass('ac_input')) + steasyvideoo_admin.ac($ac, 'product'); + $ac.setOptions({ + extraParams: { + excludeIds : getProductExcIds($(this).closest('.form-group').find('.curr_product')) + } + }); + }); + + $(document).on('change', 'input[name="ST_EASY_VIDEO_MINIATURE_DISPLAY_DESKTOP"], input[name="ST_EASY_VIDEO_MINIATURE_DISPLAY_MOBILE"]', function(){ + steasyvideoo_admin.miniature_form(); + }); + steasyvideoo_admin.miniature_form(); + + $(document).on('change', 'input[name="ST_EASY_VIDEO_GALLERY_DISPLAY_DESKTOP"], input[name="ST_EASY_VIDEO_GALLERY_DISPLAY_MOBILE"], input[name="ST_EASY_VIDEO_GALLERY_DISPLAY_QUICKVIEW"]', function(){ + steasyvideoo_admin.gallery_form(); + }); + steasyvideoo_admin.gallery_form(); + + $(document).on('change', 'input[name="ST_EASY_VIDEO_MINIATURE_PLAY_BTN_POSITION"]', function(){ + steasyvideoo_admin.btn_position('MINIATURE'); + }); + $(document).on('change', 'input[name="ST_EASY_VIDEO_GALLERY_PLAY_BTN_POSITION"]', function(){ + steasyvideoo_admin.btn_position('GALLERY'); + }); + steasyvideoo_admin.btn_position('MINIATURE'); + steasyvideoo_admin.btn_position('GALLERY'); + +}); + +var steasyvideoo_admin = { + 'ac': function($that) { + var $cp = $that.closest('.form-group').find('.curr_products'); + $that.autocomplete(currentIndex+'&token='+token+'&ajax_product_list&disableCombination=true', { + minChars: 1, + autoFill: true, + max:200, + matchContains: true, + mustMatch:true, + scroll:true, + cacheLength:0, + extraParams:{ excludeIds:getProductExcIds($cp)}, + formatItem: function(item) { + if (item.length == 2) { + return item[1]+' - '+item[0]; + } else { + return '--'; + } + } + }).result(function(event, data, formatted) { + if (data == null || data.length != 2) + return false; + var id = data[1]; + var name = data[0]; + $cp.append('
  • '+name+'
  • '); + + $that.setOptions({ + extraParams: { + excludeIds : getProductExcIds($cp) + } + }); + }); + }, + 'miniature_form': function(){ + var value = 0, device=0; + if($('input[name="ST_EASY_VIDEO_MINIATURE_DISPLAY_DESKTOP"]:checked').length){ + value = $('input[name="ST_EASY_VIDEO_MINIATURE_DISPLAY_DESKTOP"]:checked').val(); + device = 'DESKTOP'; + }else if($('input[name="ST_EASY_VIDEO_MINIATURE_DISPLAY_MOBILE"]:checked').length){ + value = $('input[name="ST_EASY_VIDEO_MINIATURE_DISPLAY_MOBILE"]:checked').val(); + device = 'MOBILE'; + } + + $('input[name="ST_EASY_VIDEO_MINIATURE_VIDEO_SELECTOR_'+device+'"], select[name="ST_EASY_VIDEO_MINIATURE_VIDEO_APPEND_'+device+'"], input[name="ST_EASY_VIDEO_MINIATURE_VIDEO_POSITION_'+device+'"]').parents('.form-group').toggle(value=='2' || value=='1' || value=='3' || value=='4'); + $('input[name="ST_EASY_VIDEO_MINIATURE_BUTTON_SELECTOR_'+device+'"], select[name="ST_EASY_VIDEO_MINIATURE_BUTTON_APPEND_'+device+'"], input[name="ST_EASY_VIDEO_MINIATURE_BUTTON_POSITION_'+device+'"], input[name="ST_EASY_VIDEO_MINIATURE_BUTTON_LAYOUT_'+device+'"], input[name="ST_EASY_VIDEO_MINIATURE_BUTTON_HIDE_'+device+'"]').parents('.form-group').toggle(value=='1' || value=='4'); + if(device=='DESKTOP') + $('input[name="ST_EASY_VIDEO_MINIATURE_HOVER_ELEMENT"]').parents('.form-group').toggle(value=='3' || value=='4'); + return true; + }, + 'btn_position': function(type){ + $('input[name="ST_EASY_VIDEO_'+type+'_PLAY_BTN_OFFSET"]').parents('.form-group').toggle($('input[name="ST_EASY_VIDEO_'+type+'_PLAY_BTN_POSITION"]:checked').val()!='0'); + }, + 'gallery_form': function(){ + var groups = []; + var display = 0, device=0; + if($('input[name="ST_EASY_VIDEO_GALLERY_DISPLAY_DESKTOP"]:checked').length){ + display = $('input[name="ST_EASY_VIDEO_GALLERY_DISPLAY_DESKTOP"]:checked').val(); + device = 'DESKTOP'; + }else if($('input[name="ST_EASY_VIDEO_GALLERY_DISPLAY_MOBILE"]:checked').length){ + display = $('input[name="ST_EASY_VIDEO_GALLERY_DISPLAY_MOBILE"]:checked').val(); + device = 'MOBILE'; + }else if($('input[name="ST_EASY_VIDEO_GALLERY_DISPLAY_QUICKVIEW"]:checked').length){ + display = $('input[name="ST_EASY_VIDEO_GALLERY_DISPLAY_QUICKVIEW"]:checked').val(); + device = 'QUICKVIEW'; + } + if(display==1) + groups.push('button', 'video', 'thumbnail', 'close'); + else if(display==2) + groups.push('video'); + else if(display==3) + groups.push('gallery'); + else if(display==4) + groups.push('video', 'thumbnail', 'close'); + else if(display==5) + groups.push('gallery', 'thumbnail'); + else if(display==6) + groups.push('video', 'thumbnail'); + else if(display==7) + groups.push('button', 'video', 'gallery', 'thumbnail'); + + $('input[name="ST_EASY_VIDEO_GALLERY_VIDEO_SELECTOR_'+device+'"], select[name="ST_EASY_VIDEO_GALLERY_VIDEO_APPEND_'+device+'"],input[name="ST_EASY_VIDEO_GALLERY_VIDEO_POSITION_'+device+'"]').parents('.form-group').toggle(groups.includes('video')); + $('input[name="ST_EASY_VIDEO_GALLERY_BUTTON_SELECTOR_'+device+'"], select[name="ST_EASY_VIDEO_GALLERY_BUTTON_APPEND_'+device+'"], input[name="ST_EASY_VIDEO_GALLERY_BUTTON_POSITION_'+device+'"], input[name="ST_EASY_VIDEO_GALLERY_BUTTON_LAYOUT_'+device+'"], input[name="ST_EASY_VIDEO_GALLERY_BUTTON_HIDE_'+device+'"]').parents('.form-group').toggle(groups.includes('button')); + + $('input[name="ST_EASY_VIDEO_GALLERY_TYPE_'+device+'"],input[name="ST_EASY_VIDEO_GALLERY_SLIDER_SELECTOR_'+device+'"],input[name="ST_EASY_VIDEO_GALLERY_SLIDE_SELECTOR_'+device+'"],select[name="ST_EASY_VIDEO_GALLERY_SLIDER_APPEND_'+device+'"]').parents('.form-group').toggle(groups.includes('gallery')); + $('input[name="ST_EASY_VIDEO_GALLERY_THUMBNAIL_TYPE_'+device+'"], input[name="ST_EASY_VIDEO_GALLERY_THUMBNAIL_ITEM_SELECTOR_'+device+'"], input[name="ST_EASY_VIDEO_GALLERY_THUMBNAIL_SELECTOR_'+device+'"],input[name="ST_EASY_VIDEO_GALLERY_THUMBNAIL_SLIDE_SELECTOR_'+device+'"],select[name="ST_EASY_VIDEO_GALLERY_THUMBNAIL_APPEND_'+device+'"]').parents('.form-group').toggle(groups.includes('thumbnail')); + + $('input[name="ST_EASY_VIDEO_GALLERY_CLOSE_VIDEO_'+device+'"]').parents('.form-group').toggle(groups.includes('close')); + + $('textarea[name="ST_EASY_VIDEO_GALLERY_BUTTON_TEMPLATE_'+device+'"],select[name="ST_EASY_VIDEO_GALLERY_BUTTON_IMAGE_TYPE_'+device+'"]').parents('.form-group').toggle(groups.includes('button') || groups.includes('thumbnail')); + + + return true; + }, + 'buyaosanchu': 1 +}; +var getProductExcIds = function(dom) +{ + var excludeIds = []; + $(dom).find(':hidden[name="st_id_product[]"]').each(function(){ + excludeIds.push($(this).val()); + }); + return excludeIds.join( ',' ); +}; +function handle_contr(val) +{ + var fm = {'category': 'id_category', 'product': 'ac_products', 'manufacturer': 'id_manufacturer'}; + $.each(fm, function(k,v){ + $('#'+v).closest('.form-group').toggle(k == val); + $('#sub_category_on').closest('.form-group').toggle(k == val && k=='category'); + }); +} diff --git a/modules/steasyvideo/views/js/front.js b/modules/steasyvideo/views/js/front.js new file mode 100644 index 00000000..66a0cbab --- /dev/null +++ b/modules/steasyvideo/views/js/front.js @@ -0,0 +1,1052 @@ +/** + * Copyright since 2007 PrestaShop SA and Contributors + * PrestaShop is an International Registered Trademark & Property of PrestaShop SA + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.md. + * It is also available through the world-wide-web at this URL: + * https://opensource.org/licenses/OSL-3.0 + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@prestashop.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade PrestaShop to newer + * versions in the future. If you wish to customize PrestaShop for your + * needs please refer to https://devdocs.prestashop.com/ for more information. + * + * @author PrestaShop SA and Contributors + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ +(function() +{ + this.easyVideo = function() + { + var defaults = {}; + + this.elements = []; + this.settings = (arguments[0] && typeof arguments[0] === 'object') ? extendDefaults(defaults,arguments[0]) : defaults; + this.tries = 0; + this.slider_timer = null; + this.resize_timer = null; + this.product_videos = null; + this.device = ''; + + $(document).on('click','.st_easy_video_doplay', function(e){ + e.preventDefault(); + e.stopPropagation(); + bofang($(this).data('id')); + return false; + }); + + $(document).on('click','.st_easy_video_template', function(e){ + e.preventDefault(); + e.stopPropagation(); + if($(this).find('.st_easy_video_doplay').length) + bofang($(this).find('.st_easy_video_doplay').data('id')); + return false; + }); + + $(document).on('click','.st_easy_video_close', function(e){ + e.preventDefault(); + e.stopPropagation(); + tingzhi($(this).data('id')); + return false; + }); + prestashop.on('updatedProduct', $.proxy(function (event) { + window.setTimeout($.proxy(function(){ + $.each(steasyvideo.videos, (function(id, video){ + this.reset(id, ''); + }).bind(this)); + this.init(); + }, this), 2000); + }, this)); + + prestashop.on('updateProductList', $.proxy(function (event) { + this.init(); + }, this)); + + if((steasyvideo.miniature.desktop.display==3 || steasyvideo.miniature.desktop.display==4) && steasyvideo.miniature.desktop.hover_element){ + $(document).on( 'mouseenter', steasyvideo.miniature.desktop.hover_element, function(){ + if('desktop' == getCurrentDeviceMode()){ + var video_box = $(this).find('.st_easy_video_box').first(); + if(video_box.length) + bofang(video_box.data('id')); + } + } ).on( 'mouseleave', steasyvideo.miniature.desktop.hover_element, function(){ + if('desktop' == getCurrentDeviceMode()){ + var video_box = $(this).find('.st_easy_video_box').first(); + if(video_box.length) + tingzhi(video_box.data('id')); + } + } ); + } + + $(window).resize($.proxy(function() { + clearTimeout(this.resize_timer); + this.resize_timer = setTimeout($.proxy(function(){ + if(!$('.modal.quickview').length && !$('.stsb_side_panel_show[data-elementor-type="quickview"]').length){ + var device = getCurrentDeviceMode(); + if(this.device != device){ + // this.setSettings(device) + this.init(); + } + } + }, this), 200); + }, this)); + this.init(); + } + + + easyVideo.prototype.setSettings = function(device) + { + this.device = device; + steasyvideo.gallery.current = JSON.parse(JSON.stringify(steasyvideo['gallery'][device])); + steasyvideo.miniature.current = JSON.parse(JSON.stringify(steasyvideo['miniature'][device])); + } + easyVideo.prototype.quickView = function(data, id_product, id_product_attribute) + { + if(typeof(steasyvideo.videos)!='undefined') + this.product_videos = JSON.parse(JSON.stringify(steasyvideo.videos)); + steasyvideo.videos = data.videos; + $(`#quickview-modal-${id_product}-${id_product_attribute}`).on('hidden.bs.modal', $.proxy(function () { + this.quiteQuickView(); + }, this)); + this.setSettings('quickview') + this.init(); + } + easyVideo.prototype.quiteQuickView = function() + { + if(this.product_videos) + steasyvideo.videos = JSON.parse(JSON.stringify(this.product_videos)); + this.setSettings(getCurrentDeviceMode()); // bu yong init + } + easyVideo.prototype.init = function(x) + { + if(typeof(x)!='undefined'){ + if(x>steasyvideo.maximum_tries) + return false; + } + var device = getCurrentDeviceMode() + if(device!='desktop' && device!='mobile') + return false; + this.setSettings(device); + + // build.call(this); + if(typeof(easy_video_arr)!='undefined'){ + $.each(easy_video_arr, (function(id, video){ + if(video[device+'_ran']) + return true; + this.miniature_reset(id, this.device); + }).bind(this)); + if(steasyvideo.miniature.current.display!=0 && steasyvideo.miniature.current.video_selector){ + $.each(easy_video_arr, (function(id, video){ + if(video[device+'_ran']) + return true; + var $video_container = $('#'+id).closest(steasyvideo.miniature.current.selector ? steasyvideo.miniature.current.selector : '.js-product-miniature').find(steasyvideo.miniature.current.video_selector).first(); + if(!$video_container.length) + return true; + video = intVideo(video); + if(steasyvideo.miniature.current.display==1 || steasyvideo.miniature.current.display==4){ + var $button_container = $('#'+id).closest(steasyvideo.miniature.current.selector ? steasyvideo.miniature.current.selector : '.js-product-miniature').find(steasyvideo.miniature.current.button_selector).first(); + if(!$button_container.length) + return true; + _append($button_container, steasyvideo.miniature.current.button_append, prepare_template(build_paly_button(0, id, steasyvideo.miniature.current.button_position, steasyvideo.miniature.current.button_layout, true, steasyvideo.miniature.current.button_hide), video['miniature_button_template_'+device])); + } + if(_append($video_container, steasyvideo.miniature.current.video_append, prepare_template(bulid_video_html(0, id, video, steasyvideo.miniature.current.display == 2, steasyvideo.miniature.current.video_position, (steasyvideo.miniature.current.display != 3 && steasyvideo.miniature.current.display != 4)), video['miniature_video_template_'+device]))){ + var player_settings = preparePlayerSettings(steasyvideo.miniature.current.player_settings, video); + create_player(id, player_settings, $video_container); + if(steasyvideo.miniature.current.display != 3 && steasyvideo.miniature.current.display != 4 && player_settings.autoplay) + bofang(id); + } + easy_video_arr[id][device+'_ran'] = true; + }).bind(this)); + } + } + if(typeof(steasyvideo.videos)!='undefined'){ + $.each(steasyvideo.videos, (function(id, video){ + if(video[this.device+'_ran']) + return true; + this.reset(id, this.device); + }).bind(this)); + if(steasyvideo.gallery.current.display) + this.gallery(); + } + } + + + easyVideo.prototype.reset = function(id, skip) + { + $.each(['desktop', 'mobile', 'quickview'], (function(index, device){ + if(skip==device) + return true; + if(steasyvideo['videos'][id][device+'_ran']){ + this.remove_video(device, id); + steasyvideo['videos'][id][device+'_ran'] = false; + } + }).bind(this)); + } + + easyVideo.prototype.miniature_reset = function(id, skip) + { + $.each(['desktop', 'mobile'], (function(index, device){ + if(skip==device) + return true; + if(easy_video_arr[id][device+'_ran']){ + this.miniature_remove_video(device, id); + easy_video_arr[id][device+'_ran'] = false; + } + }).bind(this)); + } + + + easyVideo.prototype.update = function(element) + { + } + + easyVideo.prototype.gallery = function() + { + switch(steasyvideo.gallery.current.display){ + case 1: + this.sort_videos([0,2,4,6,8,10].includes(steasyvideo.gallery.current.video_append)); + $.each(steasyvideo.videos, (function(id, video){ + if(video[this.device+'_ran']) + return true; + if(this.handle_click_on_thumb(id)) + { + var $button_container = $(steasyvideo.gallery.current.button_selector).first(); + _append($button_container, steasyvideo.gallery.current.button_append, prepare_template(build_paly_button(1, id, steasyvideo.gallery.current.button_position, steasyvideo.gallery.current.button_layout, true, steasyvideo.gallery.current.button_hide), (steasyvideo.gallery.current.has_custom_button_template ? video['gallery_button_template_'+this.device] : ''))); + + var $video_container = $(steasyvideo.gallery.current.video_selector).first(); + if(_append($video_container, steasyvideo.gallery.current.video_append, prepare_template(bulid_video_html(1, id, video, false, steasyvideo.gallery.current.video_position, true),(steasyvideo.gallery.current.has_custom_video_template ? video['gallery_video_template_'+this.device] : '')))){ + var player_settings = preparePlayerSettings(steasyvideo.gallery.current.player_settings, video); + create_player(id, player_settings, $video_container); + if(player_settings.autoplay) + bofang(id); + steasyvideo.videos[id][this.device+'_ran'] = true; + } + } + }).bind(this)); + break; + case 7: + this.sort_videos([0,2,4,6,8,10].includes(steasyvideo.gallery.current.video_append)); + $.each(steasyvideo.videos, (function(id, video){ + if(video[this.device+'_ran']) + return false; // one video only + var player_settings = preparePlayerSettings(steasyvideo.gallery.current.player_settings, video); + if(this.handle_click_on_first_thumb(id, player_settings.autoplay)) + { + var $button_container = $(steasyvideo.gallery.current.button_selector).first(); + _append($button_container, steasyvideo.gallery.current.button_append, prepare_template(build_paly_button(1, id, steasyvideo.gallery.current.button_position, steasyvideo.gallery.current.button_layout, true, steasyvideo.gallery.current.button_hide), (steasyvideo.gallery.current.has_custom_button_template ? video['gallery_button_template_'+this.device] : ''))); + + var $video_container = $(steasyvideo.gallery.current.video_selector).first(); + if(_append($video_container, steasyvideo.gallery.current.video_append, prepare_template(bulid_video_html(1, id, video, false, steasyvideo.gallery.current.video_position, true),(steasyvideo.gallery.current.has_custom_video_template ? video['gallery_video_template_'+this.device] : '')))){ + create_player(id, player_settings, $video_container); + if(player_settings.autoplay) + bofang(id); + steasyvideo.videos[id][this.device+'_ran'] = true; + } + this.add_icon_on_first_thumb(id); + } + return false; // one video only + }).bind(this)); + break; + case 2: + this.sort_videos([0,2,4,6,8,10].includes(steasyvideo.gallery.current.video_append)); + $.each(steasyvideo.videos, (function(id, video){ + if(video[this.device+'_ran']) + return true; + var $video_container = $(steasyvideo.gallery.current.video_selector).first(); + if(_append($video_container, steasyvideo.gallery.current.video_append, prepare_template(bulid_video_html(1, id, video, true, steasyvideo.gallery.current.video_position, true),(steasyvideo.gallery.current.has_custom_video_template ? video['gallery_video_template_'+this.device] : '')))){ + create_player(id, preparePlayerSettings(steasyvideo.gallery.current.player_settings, video), $video_container); + steasyvideo.videos[id][this.device+'_ran'] = true; + } + }).bind(this)); + break; + case 3: + this.sort_videos(steasyvideo.gallery.current.slider_append); + $.each(steasyvideo.videos, (function(id, video){ + if(video[this.device+'_ran']) + return true; + var $gallery_container = $(steasyvideo.gallery.current.slider_selector).first(); + if(this.add_slide($gallery_container, steasyvideo.gallery.current.type, steasyvideo.gallery.current.slider_append, prepare_template(bulid_video_html(1, id, video, true, 1, true), video['gallery_video_template_'+this.device]))){ + create_player(id, preparePlayerSettings(steasyvideo.gallery.current.player_settings, video), $gallery_container, $('.st_easy_video_box[data-id="'+id+'"]')); + steasyvideo.videos[id][this.device+'_ran'] = true; + }else + return true; + }).bind(this)); + break; + case 4: + this.sort_videos(steasyvideo.gallery.current.thumbnail_append); + $.each(steasyvideo.videos, (function(id, video){ + if(video[this.device+'_ran']) + return true; + var $thumbnail_container = $(steasyvideo.gallery.current.thumbnail_selector).first(); + if(this.add_slide($thumbnail_container, steasyvideo.gallery.current.thumbnail_type, steasyvideo.gallery.current.thumbnail_append, prepare_template(build_paly_button(1, id, steasyvideo.gallery.current.button_position, steasyvideo.gallery.current.button_layout, true, steasyvideo.gallery.current.button_hide), video['gallery_button_template_'+this.device]),steasyvideo.gallery.current.thumbnail_item_selector)){ + var player_settings = preparePlayerSettings(steasyvideo.gallery.current.player_settings, video); + this.handle_click_on_thumb(id); + var $video_container = $(steasyvideo.gallery.current.video_selector).first(); + if(_append($video_container, steasyvideo.gallery.current.video_append, prepare_template(bulid_video_html(1, id, video, false, steasyvideo.gallery.current.video_position, true), (steasyvideo.gallery.current.has_custom_video_template ? video['gallery_video_template_'+this.device] : '')))){ + create_player(id, player_settings, $video_container, $('.st_easy_video_box[data-id="'+id+'"]')); + if(player_settings.autoplay) + bofang(id); + steasyvideo.videos[id][this.device+'_ran'] = true; + } + + }else{ + return true; + } + + }).bind(this)); + break; + case 5: + this.sort_videos(steasyvideo.gallery.current.slider_append); + $.each(steasyvideo.videos, (function(id, video){ + if(video[this.device+'_ran']) + return true; + var $thumbnail_container = $(steasyvideo.gallery.current.thumbnail_selector).first(); + if(this.add_slide($thumbnail_container, steasyvideo.gallery.current.thumbnail_type, steasyvideo.gallery.current.thumbnail_append, prepare_template(build_paly_button(1, id, steasyvideo.gallery.current.button_position, steasyvideo.gallery.current.button_layout, false, steasyvideo.gallery.current.button_hide), video['gallery_button_template_'+this.device]),steasyvideo.gallery.current.thumbnail_item_selector)){ + var $gallery_container = $(steasyvideo.gallery.current.slider_selector).first(); + if(this.add_slide($gallery_container, steasyvideo.gallery.current.type, steasyvideo.gallery.current.slider_append, prepare_template(bulid_video_html(1, id, video, true, 1, true), video['gallery_video_template_'+this.device]))){ + create_player(id, preparePlayerSettings(steasyvideo.gallery.current.player_settings, video), $gallery_container, $('.st_easy_video_box[data-id="'+id+'"]')); + steasyvideo.videos[id][this.device+'_ran'] = true; + }else + return true; + }else{ + return true; + } + }).bind(this)); + break; + case 6: + this.sort_videos(steasyvideo.gallery.current.thumbnail_append); + $.each(steasyvideo.videos, (function(id, video){ + if(video[this.device+'_ran']) + return true; + var $thumbnail_container = $(steasyvideo.gallery.current.thumbnail_selector).first(); + if(this.add_slide($thumbnail_container, steasyvideo.gallery.current.thumbnail_type, steasyvideo.gallery.current.thumbnail_append, prepare_template(build_paly_button(1, id, steasyvideo.gallery.current.button_position, steasyvideo.gallery.current.button_layout, false, steasyvideo.gallery.current.button_hide), video['gallery_button_template_'+this.device]),steasyvideo.gallery.current.thumbnail_item_selector)){ + var $video_container = $(steasyvideo.gallery.current.video_selector).first(); + if(_append($video_container, steasyvideo.gallery.current.video_append, prepare_template(bulid_video_html(1, id, video, true, steasyvideo.gallery.current.video_position, true), (steasyvideo.gallery.current.has_custom_video_template ? video['gallery_video_template_'+this.device] : '')))){ + create_player(id, preparePlayerSettings(steasyvideo.gallery.current.player_settings, video), $video_container, $('.st_easy_video_box[data-id="'+id+'"]')); + steasyvideo.videos[id][this.device+'_ran'] = true; + } + }else{ + return true; + } + }).bind(this)); + break; + } + } + easyVideo.prototype.add_icon_on_first_thumb = function(id){ + var $thumbnail_item_container = $(steasyvideo.gallery.current.thumbnail_item_selector).first(); + if($thumbnail_item_container.length){ + $thumbnail_item_container.addClass('st_easy_video_relative').append(''); + } + } + easyVideo.prototype.handle_click_on_thumb = function(id){ + if(!steasyvideo.gallery.current.close_video) + return true; + var event_name = steasyvideo.gallery.current.close_video==1 ? 'click' : 'mouseenter'; + switch(steasyvideo.gallery.current.thumbnail_type){ + case 0: + break; + case 1: + if($(steasyvideo.gallery.current.thumbnail_selector).length && typeof($(steasyvideo.gallery.current.thumbnail_selector)[0].swiper)!='undefined'){ + $(steasyvideo.gallery.current.thumbnail_selector)[0].swiper.on(event_name, function(swiper){ + if(!$(swiper.slides).eq(swiper.clickedIndex).find('.st_easy_video_play_icon').length) + toggle_btns(2, id); + }); + return true; + }else{ + this.slider_timer = window.setTimeout((function(){ + this.init(++this.tries); + }).bind(this), 500); + return false; + } + break; + case 2: + if($(steasyvideo.gallery.current.thumbnail_selector).length && $(steasyvideo.gallery.current.thumbnail_selector).hasClass('slick-initialized')){ + $(steasyvideo.gallery.current.thumbnail_selector).on(event_name, steasyvideo.gallery.current.thumbnail_item_selector ? steasyvideo.gallery.current.thumbnail_item_selector : '.slick-slide', function(){ + if(!$(this).find('.st_easy_video_play_icon').length) + toggle_btns(2, id); + }); + return true; + }else{ + this.slider_timer = window.setTimeout((function(){ + this.init(++this.tries); + }).bind(this), 500); + return false; + } + break; + case 3: + break; + case 4: + if($(steasyvideo.gallery.current.thumbnail_selector).length && typeof($(steasyvideo.gallery.current.thumbnail_selector).data("owlCarousel"))!='undefined'){ + $(steasyvideo.gallery.current.thumbnail_selector).on(event_name, steasyvideo.gallery.current.thumbnail_item_selector ? steasyvideo.gallery.current.thumbnail_item_selector : '.owl-item', function(e){ + e.preventDefault(); + if(!$(this).find('.st_easy_video_play_icon').length) + toggle_btns(2, id); + }); + return true; + }else{ + this.slider_timer = window.setTimeout((function(){ + this.init(++this.tries); + }).bind(this), 500); + return false; + } + break; + case 5: + $(steasyvideo.gallery.current.thumbnail_item_selector).on(event_name, function(){ + if(!$(this).find('.st_easy_video_play_icon').length) + toggle_btns(2, id); + }); + return true; + break; + } + } + easyVideo.prototype.handle_click_on_first_thumb = function(id, autoplay){ + var classname = '.st_easy_video_play[data-id="'+id+'"]'; + if(steasyvideo.gallery.current.slider_selector){ + switch(steasyvideo.gallery.current.type){ + case 0: + break; + case 1: + if($(steasyvideo.gallery.current.slider_selector).length && typeof($(steasyvideo.gallery.current.slider_selector)[0].swiper)!='undefined'){ + handle_first($(steasyvideo.gallery.current.slider_selector)[0].swiper.isBeginning, id, autoplay); + $(steasyvideo.gallery.current.slider_selector)[0].swiper.on('slideChangeTransitionEnd', function(swiper){ + handle_first(swiper.isBeginning, id, autoplay); + }); + return true; + }else{ + this.slider_timer = window.setTimeout((function(){ + this.init(++this.tries); + }).bind(this), 500); + return false; + } + break; + case 2: + if($(steasyvideo.gallery.current.slider_selector).hasClass('slick-initialized')){ + handle_first($(steasyvideo.gallery.current.slider_selector).slick('slickCurrentSlide')==0, id, autoplay); + $(steasyvideo.gallery.current.slider_selector).on('afterChange', function(event, slick, currentSlide, nextSlide){ + handle_first($(steasyvideo.gallery.current.slider_selector).slick('slickCurrentSlide')==0, id, autoplay); + }); + return true; + }else{ + this.slider_timer = window.setTimeout((function(){ + this.init(++this.tries); + }).bind(this), 500); + return false; + } + break; + case 3: + break; + case 4: + if($(steasyvideo.gallery.current.slider_selector).length && typeof($(steasyvideo.gallery.current.slider_selector).data("owlCarousel"))!='undefined'){ + handle_first($(steasyvideo.gallery.current.slider_selector).data("owlCarousel").owl.currentItem==0, id, autoplay); + $(document).on('main_gallery_after_action', function(){ + handle_first($(steasyvideo.gallery.current.slider_selector).data("owlCarousel").owl.currentItem==0, id, autoplay); + }); + return true; + }else{ + this.slider_timer = window.setTimeout((function(){ + this.init(++this.tries); + }).bind(this), 500); + return false; + } + break; + } + } + if(steasyvideo.gallery.current.thumbnail_type){ + switch(steasyvideo.gallery.current.thumbnail_type){ + case 0: + break; + case 1: + if($(steasyvideo.gallery.current.thumbnail_selector).length && typeof($(steasyvideo.gallery.current.thumbnail_selector)[0].swiper)!='undefined'){ + $(steasyvideo.gallery.current.thumbnail_selector)[0].swiper.on('click', function(swiper){ + handle_first($(swiper.slides).eq(swiper.clickedIndex).find('.st_easy_video_play_icon').length, id, autoplay); + }); + return true; + }else{ + this.slider_timer = window.setTimeout((function(){ + this.init(++this.tries); + }).bind(this), 500); + return false; + } + break; + case 2: + if($(steasyvideo.gallery.current.thumbnail_selector).hasClass('slick-initialized')){ + $(steasyvideo.gallery.current.thumbnail_selector).on('click', '.slick-slide', function(){ + handle_first($(this).find('.st_easy_video_play_icon').length, id, autoplay); + }); + return true; + }else{ + this.slider_timer = window.setTimeout((function(){ + this.init(++this.tries); + }).bind(this), 500); + return false; + } + break; + case 3: + break; + case 4: + if($(steasyvideo.gallery.current.thumbnail_selector).length && typeof($(steasyvideo.gallery.current.thumbnail_selector).data("owlCarousel"))!='undefined'){ + $(steasyvideo.gallery.current.thumbnail_selector).on('click', '.owl-item', function(e){ + e.preventDefault(); + handle_first($(this).find('.st_easy_video_play_icon').length, id, autoplay); + }); + return true; + }else{ + this.slider_timer = window.setTimeout((function(){ + this.init(++this.tries); + }).bind(this), 500); + return false; + } + break; + case 5: + $(steasyvideo.gallery.current.thumbnail_item_selector).on('click', function(){ + handle_first($(this).find('.st_easy_video_play_icon').length, id, autoplay); + }); + return true; + break; + } + } + } + easyVideo.prototype.sort_videos = function(append) + { + if(steasyvideo.videos.length<2) + return true; + + if(append<100){ + if(steasyvideo.videos[Object.keys(steasyvideo.videos)[0]].position < steasyvideo.videos[Object.keys(steasyvideo.videos)[Object.keys(steasyvideo.videos).length-1]].position) + steasyvideo.videos = Object.fromEntries(Object.entries(steasyvideo.videos).reverse()); + }else{ + if(steasyvideo.videos[Object.keys(steasyvideo.videos)[0]].position > steasyvideo.videos[Object.keys(steasyvideo.videos)[Object.keys(steasyvideo.videos).length-1]].position) + steasyvideo.videos = Object.fromEntries(Object.entries(steasyvideo.videos).reverse()); + } + } + easyVideo.prototype.miniature_remove_video = function(device, id) + { + var setting = device=='mobile' ? steasyvideo.miniature.mobile : steasyvideo.miniature.desktop; + + var $video_container = $('#'+id).closest(setting.selector ? setting.selector : '.js-product-miniature').find(setting.video_selector).first(); + if($video_container.length){ + remove_player($video_container.find('.st_easy_video_box[data-id="'+id+'"]')); + $video_container.find('.st_easy_video_close[data-id="'+id+'"]').remove(); + } + + var $button_container = $('#'+id).closest(setting.selector ? setting.selector : '.js-product-miniature').find(setting.button_selector).first(); + if($button_container.length) + remove_button($button_container.find('.st_easy_video_play[data-id="'+id+'"]')); + } + easyVideo.prototype.remove_video = function(device, id) + { + var setting = device=='mobile' ? steasyvideo.gallery.mobile : (device=='quickview' ? steasyvideo.gallery.quickview : steasyvideo.gallery.desktop); + switch(setting.display){ + case 1: + case 2: + case 7: + var $video_container = $(setting.video_selector).first(); + if($video_container.length){ + remove_player($video_container.find('.st_easy_video_box[data-id="'+id+'"]')); + $video_container.find('.st_easy_video_close[data-id="'+id+'"]').remove(); + } + + var $button_container = $(setting.button_selector).first(); + if($button_container.length) + remove_button($button_container.find('.st_easy_video_play[data-id="'+id+'"]')); + + $(steasyvideo.gallery.current.thumbnail_item_selector).find('.st_easy_video_play_icon[data-id="'+id+'"]').remove(); + break; + case 3: + var $gallery_container = $(setting.slider_selector).first(); + this.remove_slide($gallery_container, setting.type, id); + break; + case 4: + var $thumbnail_container = $(setting.thumbnail_selector).first(); + this.remove_slide($thumbnail_container, setting.thumbnail_type, id); + + var $video_container = $(setting.video_selector).first(); + if($video_container){ + remove_player($video_container.find('.st_easy_video_box[data-id="'+id+'"]')); + $video_container.find('.st_easy_video_close[data-id="'+id+'"]').remove(); + } + break; + case 5: + var $gallery_container = $(setting.slider_selector).first(); + this.remove_slide($gallery_container, setting.type, id); + var $thumbnail_container = $(setting.thumbnail_selector).first(); + this.remove_slide($thumbnail_container, setting.thumbnail_type, id); + break; + case 6: + var $thumbnail_container = $(setting.thumbnail_selector).first(); + this.remove_slide($thumbnail_container, setting.thumbnail_type, id); + + var $video_container = $(setting.video_selector).first(); + if($video_container){ + remove_player($video_container.find('.st_easy_video_box[data-id="'+id+'"]')); + $video_container.find('.st_easy_video_close[data-id="'+id+'"]').remove(); + } + break; + } + } + + easyVideo.prototype.remove_slide = function(slider, type, id) + { + if(!slider || !slider.length || !type) + return false; + switch(type){ + case 1://Swiper + if(typeof(slider[0].swiper)!='undefined'){ + if(slider.find('.st_easy_video_box[data-id="'+id+'"]').closest('.swiper-slide').length){ + slider.find('.st_easy_video_box[data-id="'+id+'"]').closest('.swiper-slide').remove(); + slider[0].swiper.update(); + } + if(slider.find('.st_easy_video_play[data-id="'+id+'"]').closest('.swiper-slide').length){ + slider.find('.st_easy_video_play[data-id="'+id+'"]').closest('.swiper-slide').remove(); + slider[0].swiper.update(); + } + } + break; + case 2://Slick + if(slider.hasClass('slick-initialized')){ + if(slider.find('.st_easy_video_box[data-id="'+id+'"]').closest('.slick-slide').length) + slider.slick('slickRemove', slider.find('.st_easy_video_box[data-id="'+id+'"]').closest('.slick-slide').data("slick-index")); + if(slider.find('.st_easy_video_play[data-id="'+id+'"]').closest('.slick-slide').length) + slider.slick('slickRemove', slider.find('.st_easy_video_play[data-id="'+id+'"]').closest('.slick-slide').data("slick-index")); + } + break; + case 3://Owl 2 + if(slider.data("owl.carousel")){ + // remove.owl.carousel // don\'t know how to get index + if(slider.find('.st_easy_video_box[data-id="'+id+'"]').closest('.owl-item').length){ + slider.find('.st_easy_video_box[data-id="'+id+'"]').closest('.owl-item').remove(); + slider.trigger('refresh.owl.carousel'); + } + if(slider.find('.st_easy_video_play[data-id="'+id+'"]').closest('.owl-item').length){ + slider.find('.st_easy_video_play[data-id="'+id+'"]').closest('.owl-item').remove(); + slider.trigger('refresh.owl.carousel'); + } + } + break; + case 4://Owl 1 + if(slider.data("owlCarousel")){ + if(slider.find('.st_easy_video_box[data-id="'+id+'"]').closest('.owl-item').length){ + slider.find('.st_easy_video_box[data-id="'+id+'"]').closest('.owl-item').remove(); + slider.data("owlCarousel").updateVars(); + } + if(slider.find('.st_easy_video_play[data-id="'+id+'"]').closest('.owl-item').length){ + slider.find('.st_easy_video_play[data-id="'+id+'"]').closest('.owl-item').remove(); + slider.data("owlCarousel").updateVars(); + } + } + break; + case 5://Classic Scrollbox, not a slider + /*thumb cai you 5, thumb li mian mei you video + var player = slider.find('.st_easy_video_box[data-id="'+id+'"]'); + if(player.length){ + if(player.closest('.st_easy_video_template').length) + player.closest('.st_easy_video_template').remove(); + else + player.remove(); + }*/ + var button = slider.find('.st_easy_video_play[data-id="'+id+'"]'); + if(button.length){ + if(button.closest('.st_easy_video_template').length) + button.closest('.st_easy_video_template').remove(); + else + button.remove(); + } + break; + } + } + easyVideo.prototype.add_slide = function(slider, type, index, html,thumbnail_item_selector) + { + if(!slider || !slider.length || !type) + return false; + switch(type){ + case 1://Swiper + if(typeof(slider[0].swiper)!='undefined'){ + if(index==100){ + slider[0].swiper.appendSlide(html); + }else{ + slider[0].swiper.addSlide(index, html); + if(index==0) + slider[0].swiper.params.loop ? slider[0].swiper.slideToLoop(0) : slider[0].swiper.slideTo(0); + } + return true; + }else{ + this.slider_timer = window.setTimeout((function(){ + this.init(++this.tries); + }).bind(this), 500); + return false; + } + break; + case 2://Slick + if(slider.hasClass('slick-initialized')){ + index==100 ? slider.slick('slickAdd', html) : slider.slick('slickAdd', html, index, true); + return true; + }else{ + this.slider_timer = window.setTimeout((function(){ + this.init(++this.tries); + }).bind(this), 500); + return false; + } + break; + case 3://Owl 2 + if(slider.data("owl.carousel")){ + index==100 ? slider.trigger('add.owl.carousel', [$(html)]).trigger('refresh.owl.carousel') : slider.trigger('add.owl.carousel', [$(html), index]).trigger('refresh.owl.carousel'); + return true; + }else{ + this.slider_timer = window.setTimeout((function(){ + this.init(++this.tries); + }).bind(this), 500); + return false; + } + break; + case 4://Owl 1 + if(slider.data("owlCarousel")){ + index==100 ? slider.data("owlCarousel").addItem(html, -1) : slider.data("owlCarousel").addItem(html, index); + return true; + }else{ + this.slider_timer = window.setTimeout((function(){ + this.init(++this.tries); + }).bind(this), 500); + return false; + } + break; + case 5://Classic Scrollbox, not a slider + if(index==100) + slider.append(html); + else if(index==0) + slider.prepend(html); + else{ + _append($('thumbnail_item_selector').eq(index), 1, html); + } + return true; + break; + } + } + + function run(element) + { + } + function remove_player(player) + { + if(player.length){ + if(player.closest('.st_easy_video_template').length) + player.closest('.st_easy_video_template').remove(); + else + player.remove(); + } + } + function remove_button(button) + { + if(button.length){ + if(button.closest('.st_easy_video_template').length) + button.closest('.st_easy_video_template').remove(); + else + button.remove(); + } + } + + function intVideo(video) + { + video.autoplay = parseInt(video.autoplay, 10); + video.muted = parseInt(video.muted, 10); + video.loop = parseInt(video.loop, 10); + return video; + } + function create_player(id, video, $container) + { + // if(typeof(video.ran)=='undefined'){ + var $player = $('.st_easy_video_box[data-id="'+id+'"] .st_easy_video'); + var options = { + 'autoplay': 1, + 'muted' : 0, + 'loop': 1, + 'controls': 1, + 'techOrder': ['html5'], + 'fluid': true, + "playsinline": "playsinline", + 'preload':'metadata' + }; + if(video.url.indexOf('youtube')!==-1){ + var youtube_options = {"enablePrivacyEnhancedMode": typeof(window.stEasyVideoEnablePrivacyEnhancedMode)!='undefined' ? window.stEasyVideoEnablePrivacyEnhancedMode : 0}; //, customVars:{'wmode': 'transparent'} // bu qi zuo yong + if(isYouTubeShorts(video.url)) + youtube_options = $.extend(youtube_options, { + "width": 960, + "height": 1280 + }); + options = $.extend(options, { + techOrder: ['youtube'], + "youtube": youtube_options + }); + + }else if(video.url.indexOf('vimeo.com')!==-1){ + options = $.extend(options, { + techOrder: ['vimeo'], + 'vimeo':{ + 'color': '#ff0000', + 'autoplay': true, + 'muted' : true, + }, + }) + } + var myPlayer = videojs($player[0], $.extend(options, video)); + + var isPlaying = false; + var remember = false; + var observer = scrollObserver( { + callback: function( event ) { + if ( event.isInViewport ) { + if((remember || video.autoplay) && !$('.st_easy_video_box[data-id="'+id+'"]').hasClass('st_easy_video_invisible')) + myPlayer.play(); + }else{ + remember=isPlaying; + myPlayer.pause(); + } + }, + } ); + observer.observe( $('.st_easy_video_box[data-id="'+id+'"]')[0] ); + + myPlayer.on(['waiting', 'pause'], function () { + isPlaying = false; + }); + + myPlayer.on('play', function () { + isPlaying = true; + }); + + + } + function preparePlayerSettings(global_settings, video) { + if(video.autoplay=='2') + video.autoplay = global_settings.autoplay; + if(video.muted=='2') + video.muted = global_settings.muted; + if(video.loop=='2') + video.loop = global_settings.loop; + video.controls = global_settings.controls; + if(video.ratio) + video.aspectRatio = video.ratio; + return video; + } + function getYouTubeShortsID(url) { + var regex = /(?:youtube\.com\/shorts\/)([a-zA-Z0-9_-]{11})/; + var match = url.match(regex); + return match ? match[1] : null; + } + function isYouTubeShorts(url) { + return /youtube\.com\/shorts\//.test(url); + } + function prepare_template(html, template){ + if(template){ + html = $(template).addClass('st_easy_video_template').append(html)[0]; + } + return html; + } + function bulid_video_html(type, id, video, display, position, close_button){ + var video_url = video.url; + if(isYouTubeShorts(video_url)){ + var youtube_id = getYouTubeShortsID(video_url); + if(youtube_id) + video_url = 'https://www.youtube.com/watch?v='+youtube_id; + } + + var html = '
    '; + + if(!display && close_button) + html += ''; + + return html; + } + function build_paly_button(type, id, position, layout, doplay, toggleble){ + return ''; + } + function toggle_btns(display, id) { + $('.st_easy_video_close[data-id="'+id+'"], .st_easy_video_box[data-id="'+id+'"]').toggleClass('st_easy_video_invisible', display==2 || display==3); + $('.st_easy_video_play_toggleble.st_easy_video_btn_absolute[data-id="'+id+'"]').toggleClass('st_easy_video_invisible', (display==1 || display==3)); + } + function bofang(id) { + toggle_btns(1, id); + var $video = $('.st_easy_video_box[data-id="'+id+'"] .st_easy_video'); + if(!$video.length) + return false; + var player = videojs.getPlayer($video[0]) + if(player) + player.play(); + } + function tingzhi(id) { + toggle_btns(2, id); + // _pause(id); + } + function handle_first(first,id,autoplay) { + if(first){ + if($('.st_easy_video_box[data-id="'+id+'"]').hasClass('st_easy_video_invisible')){ + if(autoplay) + bofang(id); + else + toggle_btns(2, id); + } + }else{ + // _pause(id); + toggle_btns(3, id) + } + } + function _pause(id){ + var $video = $('.st_easy_video_box[data-id="'+id+'"] .st_easy_video'); + if(!$video.length) + return false; + var player = videojs.getPlayer($video[0]) + if(player) + player.pause(); + } + function _append($dom, append, template){ + if(!$dom.length || !template) + return false; + var res = true; + switch (append) { + case 0: + $dom.append(template); + break; + case 1: + $dom.before(template); + break; + case 2: + $dom.after(template); + break; + case 3: + $dom.prepend(template); + break; + case 4: + if(!$dom.parent().length) + res = false; + else + $dom.parent().append(template); + break; + case 5: + if(!$dom.parent().length) + res = false; + else + $dom.parent().before(template); + break; + case 6: + if(!$dom.parent().length) + res = false; + else + $dom.parent().after(template); + break; + case 7: + if(!$dom.parent().length) + res = false; + else + $dom.parent().prepend(template); + break; + case 8: + if(!$dom.parent().length) + res = false; + else if(!$dom.parent().parent().length) + res = false; + else + $dom.parent().parent().append(template); + break; + case 9: + if(!$dom.parent().length) + res = false; + else if(!$dom.parent().parent().length) + res = false; + else + $dom.parent().parent().before(template); + break; + case 10: + if(!$dom.parent().length) + res = false; + else if(!$dom.parent().parent().length) + res = false; + else + $dom.parent().parent().after(template); + break; + case 11: + if(!$dom.parent().length) + res = false; + else if(!$dom.parent().parent().length) + res = false; + else + $dom.parent().parent().prepend(template); + break; + case 12: + $dom.html(template); + break; + } + return true; + } + function getCurrentDeviceMode() { + if(typeof(sttheme)!='undefined' && typeof(sttheme.is_mobile_device)!='undefined') + return sttheme.is_mobile_device ? 'mobile' : 'desktop'; + // st themes + return getComputedStyle( $('#st_easy_video_device_mode')[0], ':after' ).content.replace( /"/g, '' ); + } + function extendDefaults(defaults,properties) + { + Object.keys(properties).forEach(property => { + if(properties.hasOwnProperty(property)) + { + defaults[property] = properties[property]; + } + }); + return defaults; + } + + function scrollObserver( obj ) { + let lastScrollY = 0; + + // Generating threshholds points along the animation height + // More threshholds points = more trigger points of the callback + const buildThreshholds = function( sensitivityPercentage = 0 ){ + const threshholds = []; + + if ( sensitivityPercentage > 0 && sensitivityPercentage <= 100 ) { + const increment = 100 / sensitivityPercentage; + + for ( let i = 0; i <= 100; i += increment ) { + threshholds.push( i / 100 ); + } + } else { + threshholds.push( 0 ); + } + + return threshholds; + }; + + const options = { + root: obj.root || null, + rootMargin: obj.offset || '0px', + threshold: buildThreshholds( obj.sensitivity ), + }; + + function handleIntersect( entries ) { + const currentScrollY = entries[ 0 ].boundingClientRect.y, + isInViewport = entries[ 0 ].isIntersecting, + intersectionScrollDirection = ( currentScrollY < lastScrollY ) ? 'down' : 'up', + scrollPercentage = Math.abs( parseFloat( ( entries[ 0 ].intersectionRatio * 100 ).toFixed( 2 ) ) ); + + obj.callback( { + sensitivity: obj.sensitivity, + isInViewport, + scrollPercentage, + intersectionScrollDirection, + } ); + + lastScrollY = currentScrollY; + } + + return new IntersectionObserver( handleIntersect, options ); + } +}()); +var easyVideoObj; +$(document).ready(function(){ + easyVideoObj = new easyVideo(); +}); \ No newline at end of file diff --git a/modules/steasyvideo/views/js/index.php b/modules/steasyvideo/views/js/index.php new file mode 100644 index 00000000..76cd9dd3 --- /dev/null +++ b/modules/steasyvideo/views/js/index.php @@ -0,0 +1,35 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/modules/steasyvideo/views/js/video.min.js b/modules/steasyvideo/views/js/video.min.js new file mode 100644 index 00000000..ec84268d --- /dev/null +++ b/modules/steasyvideo/views/js/video.min.js @@ -0,0 +1,53 @@ +/** + * @license + * Video.js 8.19.1 + * Copyright Brightcove, Inc. + * Available under Apache License Version 2.0 + * + * + * Includes vtt.js + * Available under Apache License Version 2.0 + * + */ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).videojs=t()}(this,function(){var M="8.19.1";let U={},B=function(e,t){return U[e]=U[e]||[],t&&(U[e]=U[e].concat(t)),U[e]};function F(e,t){return!((t=B(e).indexOf(t))<=-1||(U[e]=U[e].slice(),U[e].splice(t,1),0))}let q={prefixed:!0};var j=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"]],H=j[0];let V;for(let e=0;e{var e,i=d.levels[i],r=new RegExp(`^(${i})$`);let n=l;if("log"!==t&&s.unshift(t.toUpperCase()+":"),h&&(n="%c"+l,s.unshift(h)),s.unshift(n+":"),z&&(z.push([].concat(s)),e=z.length-1e3,z.splice(0,0s(r+` ${t=void 0!==t?t:n} `+e,t,void 0!==i?i:a),o.createNewLogger=(e,t,i)=>s(e,t,i),o.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:t},o.level=e=>{if("string"==typeof e){if(!o.levels.hasOwnProperty(e))throw new Error(`"${e}" in not a valid log level`);t=e}return t},(o.history=()=>z?[].concat(z):[]).filter=t=>(z||[]).filter(e=>new RegExp(`.*${t}.*`).test(e[0])),o.history.clear=()=>{z&&(z.length=0)},o.history.disable=()=>{null!==z&&(z.length=0,z=null)},o.history.enable=()=>{null===z&&(z=[])},o.error=(...e)=>i("error",t,e),o.warn=(...e)=>i("warn",t,e),o.debug=(...e)=>i("debug",t,e),o}("VIDEOJS"),W=o.createLogger,G=Object.prototype.toString;function X(t,i){$(t).forEach(e=>i(t[e],e))}function K(i,s,e=0){return $(i).reduce((e,t)=>s(e,i[t],t),e)}function Y(e){return!!e&&"object"==typeof e}function Q(e){return Y(e)&&"[object Object]"===G.call(e)&&e.constructor===Object}function d(...e){let i={};return e.forEach(e=>{e&&X(e,(e,t)=>{Q(e)?(Q(i[t])||(i[t]={}),i[t]=d(i[t],e)):i[t]=e})}),i}function J(e={}){var t,i,s=[];for(t in e)e.hasOwnProperty(t)&&(i=e[t],s.push(i));return s}function Z(t,i,s,e=!0){let r=e=>Object.defineProperty(t,i,{value:e,enumerable:!0,writable:!0});var n={configurable:!0,enumerable:!0,get(){var e=s();return r(e),e}};return e&&(n.set=r),Object.defineProperty(t,i,n)}let ee=Object.freeze({__proto__:null,each:X,reduce:K,isObject:Y,isPlain:Q,merge:d,values:J,defineLazyProperty:Z}),te=!1,ie=null,se=!1,re,ne=!1,ae=!1,oe=!1,le=!1,de=null,he=null;var e=Boolean(window.cast&&window.cast.framework&&window.cast.framework.CastReceiverContext);let ue=null,ce=!1,pe=!1,me=!1,ge=!1,fe=!1,ye=!1,_e=!1,ve=Boolean(Ee()&&("ontouchstart"in window||window.navigator.maxTouchPoints||window.DocumentTouch&&window.document instanceof window.DocumentTouch));var be,t=window.navigator&&window.navigator.userAgentData;if(t&&t.platform&&t.brands&&(se="Android"===t.platform,ae=Boolean(t.brands.find(e=>"Microsoft Edge"===e.brand)),oe=Boolean(t.brands.find(e=>"Chromium"===e.brand)),le=!ae&&oe,de=he=(t.brands.find(e=>"Chromium"===e.brand)||{}).version||null,pe="Windows"===t.platform),!oe){let i=window.navigator&&window.navigator.userAgent||"";te=/iPod/i.test(i),ie=(t=i.match(/OS (\d+)_/i))&&t[1]?t[1]:null,se=/Android/i.test(i),re=(t=i.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i))?(vi=t[1]&&parseFloat(t[1]),be=t[2]&&parseFloat(t[2]),vi&&be?parseFloat(t[1]+"."+t[2]):vi||null):null,ne=/Firefox/i.test(i),ae=/Edg/i.test(i),oe=/Chrome/i.test(i)||/CriOS/i.test(i),le=!ae&&oe,de=he=(be=i.match(/(Chrome|CriOS)\/(\d+)/))&&be[2]?parseFloat(be[2]):null,ue=function(){var e=/MSIE\s(\d+)\.\d/.exec(i);let t=e&&parseFloat(e[1]);return t=!t&&/Trident\/7.0/i.test(i)&&/rv:11.0/.test(i)?11:t}(),fe=/Tizen/i.test(i),ye=/Web0S/i.test(i),_e=fe||ye,ce=/Safari/i.test(i)&&!le&&!se&&!ae&&!_e,pe=/Windows/i.test(i),me=/iPad/i.test(i)||ce&&ve&&!/iPhone/i.test(i),ge=/iPhone/i.test(i)&&!me}let u=ge||me||te,Te=(ce||u)&&!le;var Se=Object.freeze({__proto__:null,get IS_IPOD(){return te},get IOS_VERSION(){return ie},get IS_ANDROID(){return se},get ANDROID_VERSION(){return re},get IS_FIREFOX(){return ne},get IS_EDGE(){return ae},get IS_CHROMIUM(){return oe},get IS_CHROME(){return le},get CHROMIUM_VERSION(){return de},get CHROME_VERSION(){return he},IS_CHROMECAST_RECEIVER:e,get IE_VERSION(){return ue},get IS_SAFARI(){return ce},get IS_WINDOWS(){return pe},get IS_IPAD(){return me},get IS_IPHONE(){return ge},get IS_TIZEN(){return fe},get IS_WEBOS(){return ye},get IS_SMART_TV(){return _e},TOUCH_ENABLED:ve,IS_IOS:u,IS_ANY_SAFARI:Te});function we(e){return"string"==typeof e&&Boolean(e.trim())}function Ee(){return document===window.document}function Ce(e){return Y(e)&&1===e.nodeType}function ke(){try{return window.parent!==window.self}catch(e){return!0}}function Ie(i){return function(e,t){return we(e)?(t=Ce(t=we(t)?document.querySelector(t):t)?t:document)[i]&&t[i](e):document[i](null)}}function l(e="div",i={},t={},s){let r=document.createElement(e);return Object.getOwnPropertyNames(i).forEach(function(e){var t=i[e];"textContent"===e?xe(r,t):r[e]===t&&"tabIndex"!==e||(r[e]=t)}),Object.getOwnPropertyNames(t).forEach(function(e){r.setAttribute(e,t[e])}),s&&Ge(r,s),r}function xe(e,t){return"undefined"==typeof e.textContent?e.innerText=t:e.textContent=t,e}function Ae(e,t){t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)}function De(e,t){if(0<=t.indexOf(" "))throw new Error("class has illegal whitespace characters");return e.classList.contains(t)}function Pe(e,...t){return e.classList.add(...t.reduce((e,t)=>e.concat(t.split(/\s+/)),[])),e}function Le(e,...t){return e?(e.classList.remove(...t.reduce((e,t)=>e.concat(t.split(/\s+/)),[])),e):(o.warn("removeClass was called with an element that doesn't exist"),null)}function Oe(t,e,i){return"boolean"!=typeof(i="function"==typeof i?i(t,e):i)&&(i=void 0),e.split(/\s+/).forEach(e=>t.classList.toggle(e,i)),t}function Re(i,s){Object.getOwnPropertyNames(s).forEach(function(e){var t=s[e];null===t||"undefined"==typeof t||!1===t?i.removeAttribute(e):i.setAttribute(e,!0===t?"":t)})}function Ne(e){var i={},s=["autoplay","controls","playsinline","loop","muted","default","defaultMuted"];if(e&&e.attributes&&0{void 0!==t[e]&&(i[e]=t[e])}),i.height||(i.height=parseFloat(Je(e,"height"))),i.width||(i.width=parseFloat(Je(e,"width"))),i}}function He(e){if(!e||!e.offsetParent)return{left:0,top:0,width:0,height:0};var t=e.offsetWidth,i=e.offsetHeight;let s=0,r=0;for(;e.offsetParent&&e!==document[q.fullscreenElement];)s+=e.offsetLeft,r+=e.offsetTop,e=e.offsetParent;return{left:s,top:r,width:t,height:i}}function Ve(t,e){var i={x:0,y:0};if(u){let e=t;for(;e&&"html"!==e.nodeName.toLowerCase();){var s,r=Je(e,"transform");/^matrix/.test(r)?(s=r.slice(7,-1).split(/,\s/).map(Number),i.x+=s[4],i.y+=s[5]):/^matrix3d/.test(r)&&(s=r.slice(9,-1).split(/,\s/).map(Number),i.x+=s[12],i.y+=s[13]),e.assignedSlot&&e.assignedSlot.parentElement&&window.WebKitCSSMatrix&&(r=window.getComputedStyle(e.assignedSlot.parentElement).transform,r=new window.WebKitCSSMatrix(r),i.x+=r.m41,i.y+=r.m42),e=e.parentNode||e.host}}var n={},a=He(e.target),t=He(t),o=t.width,l=t.height;let d=e.offsetY-(t.top-a.top),h=e.offsetX-(t.left-a.left);return e.changedTouches&&(h=e.changedTouches[0].pageX-t.left,d=e.changedTouches[0].pageY+t.top,u)&&(h-=i.x,d-=i.y),n.y=1-Math.max(0,Math.min(1,d/l)),n.x=Math.max(0,Math.min(1,h/o)),n}function ze(e){return Y(e)&&3===e.nodeType}function $e(e){for(;e.firstChild;)e.removeChild(e.firstChild);return e}function We(e){return"function"==typeof e&&(e=e()),(Array.isArray(e)?e:[e]).map(e=>Ce(e="function"==typeof e?e():e)||ze(e)?e:"string"==typeof e&&/\S/.test(e)?document.createTextNode(e):void 0).filter(e=>e)}function Ge(t,e){return We(e).forEach(e=>t.appendChild(e)),t}function Xe(e,t){return Ge($e(e),t)}function Ke(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||"mousedown"===e.type&&0===e.button&&0===e.buttons||0===e.button&&1===e.buttons}let Ye=Ie("querySelector"),Qe=Ie("querySelectorAll");function Je(t,i){if(!t||!i)return"";if("function"!=typeof window.getComputedStyle)return"";{let e;try{e=window.getComputedStyle(t)}catch(e){return""}return e?e.getPropertyValue(i)||e[i]:""}}function Ze(s){[...document.styleSheets].forEach(t=>{try{var i=[...t.cssRules].map(e=>e.cssText).join(""),e=document.createElement("style");e.textContent=i,s.document.head.appendChild(e)}catch(e){i=document.createElement("link");i.rel="stylesheet",i.type=t.type,i.media=t.media.mediaText,i.href=t.href,s.document.head.appendChild(i)}})}var et=Object.freeze({__proto__:null,isReal:Ee,isEl:Ce,isInFrame:ke,createEl:l,textContent:xe,prependTo:Ae,hasClass:De,addClass:Pe,removeClass:Le,toggleClass:Oe,setAttributes:Re,getAttributes:Ne,getAttribute:Me,setAttribute:Ue,removeAttribute:Be,blockTextSelection:Fe,unblockTextSelection:qe,getBoundingClientRect:je,findPosition:He,getPointerPosition:Ve,isTextNode:ze,emptyEl:$e,normalizeContent:We,appendContent:Ge,insertContent:Xe,isSingleLeftClick:Ke,$:Ye,$$:Qe,computedStyle:Je,copyStyleSheetsToWindow:Ze});function tt(){if(!1!==st.options.autoSetup){var e=Array.prototype.slice.call(document.getElementsByTagName("video")),t=Array.prototype.slice.call(document.getElementsByTagName("audio")),i=Array.prototype.slice.call(document.getElementsByTagName("video-js")),s=e.concat(t,i);if(s&&0=s&&(i(...e),r=t)}}function bt(s,r,n,a=window){let o;function e(){let e=this,t=arguments,i=function(){o=null,i=null,n||s.apply(e,t)};!o&&n&&s.apply(e,t),a.clearTimeout(o),o=a.setTimeout(i,r)}return e.cancel=()=>{a.clearTimeout(o),o=null},e}let Tt=Object.freeze({__proto__:null,UPDATE_REFRESH_INTERVAL:30,bind_:p,throttle:vt,debounce:bt}),St;class wt{on(e,t){var i=this.addEventListener;this.addEventListener=()=>{},mt(this,e,t),this.addEventListener=i}off(e,t){c(this,e,t)}one(e,t){var i=this.addEventListener;this.addEventListener=()=>{},ft(this,e,t),this.addEventListener=i}any(e,t){var i=this.addEventListener;this.addEventListener=()=>{},yt(this,e,t),this.addEventListener=i}trigger(e){var t=e.type||e;e=ut(e="string"==typeof e?{type:t}:e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),gt(this,e)}queueTrigger(e){St=St||new Map;let t=e.type||e,i=St.get(this);i||(i=new Map,St.set(this,i));var s=i.get(t),s=(i.delete(t),window.clearTimeout(s),window.setTimeout(()=>{i.delete(t),0===i.size&&(i=null,St.delete(this)),this.trigger(e)},0));i.set(t,s)}}wt.prototype.allowedEvents_={},wt.prototype.addEventListener=wt.prototype.on,wt.prototype.removeEventListener=wt.prototype.off,wt.prototype.dispatchEvent=wt.prototype.trigger;let Et=e=>"function"==typeof e.name?e.name():"string"==typeof e.name?e.name:e.name_||(e.constructor&&e.constructor.name?e.constructor.name:typeof e),Ct=t=>t instanceof wt||!!t.eventBusEl_&&["on","one","off","trigger"].every(e=>"function"==typeof t[e]),kt=e=>"string"==typeof e&&/\S/.test(e)||Array.isArray(e)&&!!e.length,It=(e,t,i)=>{if(!e||!e.nodeName&&!Ct(e))throw new Error(`Invalid target for ${Et(t)}#${i}; must be a DOM node or evented object.`)},xt=(e,t,i)=>{if(!kt(e))throw new Error(`Invalid event type for ${Et(t)}#${i}; must be a non-empty string or array.`)},At=(e,t,i)=>{if("function"!=typeof e)throw new Error(`Invalid listener for ${Et(t)}#${i}; must be a function.`)},Dt=(e,t,i)=>{var s=t.length<3||t[0]===e||t[0]===e.eventBusEl_;let r,n,a;return s?(r=e.eventBusEl_,3<=t.length&&t.shift(),[n,a]=t):(r=t[0],n=t[1],a=t[2]),It(r,e,i),xt(n,e,i),At(a,e,i),a=p(e,a),{isTargetingSelf:s,target:r,type:n,listener:a}},Pt=(e,t,i,s)=>{It(e,e,t),e.nodeName?_t[t](e,i,s):e[t](i,s)},Lt={on(...t){let{isTargetingSelf:e,target:i,type:s,listener:r}=Dt(this,t,"on");if(Pt(i,"on",s,r),!e){let e=()=>this.off(i,s,r);e.guid=r.guid;t=()=>this.off("dispose",e);t.guid=r.guid,Pt(this,"on","dispose",e),Pt(i,"on","dispose",t)}},one(...e){let{isTargetingSelf:t,target:i,type:s,listener:r}=Dt(this,e,"one");if(t)Pt(i,"one",s,r);else{let t=(...e)=>{this.off(i,s,t),r.apply(null,e)};t.guid=r.guid,Pt(i,"one",s,t)}},any(...e){let{isTargetingSelf:t,target:i,type:s,listener:r}=Dt(this,e,"any");if(t)Pt(i,"any",s,r);else{let t=(...e)=>{this.off(i,s,t),r.apply(null,e)};t.guid=r.guid,Pt(i,"any",s,t)}},off(e,t,i){!e||kt(e)?c(this.eventBusEl_,e,t):(e=e,t=t,It(e,this,"off"),xt(t,this,"off"),At(i,this,"off"),i=p(this,i),this.off("dispose",i),e.nodeName?(c(e,t,i),c(e,"dispose",i)):Ct(e)&&(e.off(t,i),e.off("dispose",i)))},trigger(e,t){It(this.eventBusEl_,this,"trigger");var i=e&&"string"!=typeof e?e.type:e;if(kt(i))return gt(this.eventBusEl_,e,t);throw new Error(`Invalid event type for ${Et(this)}#trigger; `+"must be a non-empty string or object with a type key that has a non-empty value.")}};function Ot(e,t={}){t=t.eventBusKey;if(t){if(!e[t].nodeName)throw new Error(`The eventBusKey "${t}" does not refer to an element.`);e.eventBusEl_=e[t]}else e.eventBusEl_=l("span",{className:"vjs-event-bus"});Object.assign(e,Lt),e.eventedCallbacks&&e.eventedCallbacks.forEach(e=>{e()}),e.on("dispose",()=>{e.off(),[e,e.el_,e.eventBusEl_].forEach(function(e){e&&h.has(e)&&h.delete(e)}),window.setTimeout(()=>{e.eventBusEl_=null},0)})}let Rt={state:{},setState(e){"function"==typeof e&&(e=e());let i;return X(e,(e,t)=>{this.state[t]!==e&&((i=i||{})[t]={from:this.state[t],to:e}),this.state[t]=e}),i&&Ct(this)&&this.trigger({changes:i,type:"statechanged"}),i}};function Nt(e,t){Object.assign(e,Rt),e.state=Object.assign({},e.state,t),"function"==typeof e.handleStateChanged&&Ct(e)&&e.on("statechanged",e.handleStateChanged)}function Mt(e){return"string"!=typeof e?e:e.replace(/./,e=>e.toLowerCase())}function m(e){return"string"!=typeof e?e:e.replace(/./,e=>e.toUpperCase())}function Ut(e,t){return m(e)===m(t)}let Bt=Object.freeze({__proto__:null,toLowerCase:Mt,toTitleCase:m,titleCaseEquals:Ut});class g{constructor(e,t,i){!e&&this.play?this.player_=e=this:this.player_=e,this.isDisposed_=!1,this.parentComponent_=null,this.options_=d({},this.options_),t=this.options_=d(this.options_,t),this.id_=t.id||t.el&&t.el.id,this.id_||(e=e&&e.id&&e.id()||"no_player",this.id_=e+"_component_"+lt++),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(e=>this.addClass(e)),["on","off","one","any","trigger"].forEach(e=>{this[e]=void 0}),!1!==t.evented&&(Ot(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange)),Nt(this,this.constructor.defaultState),this.children_=[],this.childIndex_={},this.childNameIndex_={},this.setTimeoutIds_=new Set,this.setIntervalIds_=new Set,this.rafIds_=new Set,this.namedRafs_=new Map,(this.clearingTimersOnDispose_=!1)!==t.initChildren&&this.initChildren(),this.ready(i),!1!==t.reportTouchActivity&&this.enableTouchActivity()}dispose(e={}){if(!this.isDisposed_){if(this.readyQueue_&&(this.readyQueue_.length=0),this.trigger({type:"dispose",bubbles:!1}),this.isDisposed_=!0,this.children_)for(let e=this.children_.length-1;0<=e;e--)this.children_[e].dispose&&this.children_[e].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}}isDisposed(){return Boolean(this.isDisposed_)}player(){return this.player_}options(e){return e&&(this.options_=d(this.options_,e)),this.options_}el(){return this.el_}createEl(e,t,i){return l(e,t,i)}localize(e,s,t=e){var i=this.player_.language&&this.player_.language(),r=this.player_.languages&&this.player_.languages(),n=r&&r[i],i=i&&i.split("-")[0],r=r&&r[i];let a=t;return n&&n[e]?a=n[e]:r&&r[e]&&(a=r[e]),a=s?a.replace(/\{(\d+)\}/g,function(e,t){t=s[t-1];let i="undefined"==typeof t?e:t;return i}):a}handleLanguagechange(){}contentEl(){return this.contentEl_||this.el_}id(){return this.id_}name(){return this.name_}children(){return this.children_}getChildById(e){return this.childIndex_[e]}getChild(e){if(e)return this.childNameIndex_[e]}getDescendant(...t){t=t.reduce((e,t)=>e.concat(t),[]);let i=this;for(let e=0;e{let t,i;return i="string"==typeof e?(t=e,r[t]||this.options_[t]||{}):(t=e.name,e),{name:t,opts:i}}).filter(e=>{e=g.getComponent(e.opts.componentClass||m(e.name));return e&&!t.isTech(e)}).forEach(e=>{var t=e.name;let i=e.opts;!1!==(i=void 0!==s[t]?s[t]:i)&&((i=!0===i?{}:i).playerOptions=this.options_.playerOptions,e=this.addChild(t,i))&&(this[t]=e)})}}buildCSSClass(){return""}ready(e,t=!1){e&&(this.isReady_?t?e.call(this):this.setTimeout(e,1):(this.readyQueue_=this.readyQueue_||[],this.readyQueue_.push(e)))}triggerReady(){this.isReady_=!0,this.setTimeout(function(){var e=this.readyQueue_;this.readyQueue_=[],e&&0{this.setTimeoutIds_.has(i)&&this.setTimeoutIds_.delete(i),e()},t),this.setTimeoutIds_.add(i),i}clearTimeout(e){return this.setTimeoutIds_.has(e)&&(this.setTimeoutIds_.delete(e),window.clearTimeout(e)),e}setInterval(e,t){e=p(this,e),this.clearTimersOnDispose_();e=window.setInterval(e,t);return this.setIntervalIds_.add(e),e}clearInterval(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),window.clearInterval(e)),e}requestAnimationFrame(e){var t;return this.clearTimersOnDispose_(),e=p(this,e),t=window.requestAnimationFrame(()=>{this.rafIds_.has(t)&&this.rafIds_.delete(t),e()}),this.rafIds_.add(t),t}requestNamedAnimationFrame(e,t){this.namedRafs_.has(e)&&this.cancelNamedAnimationFrame(e),this.clearTimersOnDispose_(),t=p(this,t);var i=this.requestAnimationFrame(()=>{t(),this.namedRafs_.has(e)&&this.namedRafs_.delete(e)});return this.namedRafs_.set(e,i),e}cancelNamedAnimationFrame(e){this.namedRafs_.has(e)&&(this.cancelAnimationFrame(this.namedRafs_.get(e)),this.namedRafs_.delete(e))}cancelAnimationFrame(e){return this.rafIds_.has(e)&&(this.rafIds_.delete(e),window.cancelAnimationFrame(e)),e}clearTimersOnDispose_(){this.clearingTimersOnDispose_||(this.clearingTimersOnDispose_=!0,this.one("dispose",()=>{[["namedRafs_","cancelNamedAnimationFrame"],["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach(([e,i])=>{this[e].forEach((e,t)=>this[i](t))}),this.clearingTimersOnDispose_=!1}))}getIsDisabled(){return Boolean(this.el_.disabled)}getIsExpresslyInert(){return this.el_.inert&&!this.el_.ownerDocument.documentElement.inert}getIsFocusable(e){return 0<=(e||this.el_).tabIndex&&!(this.getIsDisabled()||this.getIsExpresslyInert())}getIsAvailableToBeFocused(e){function t(e){var e=window.getComputedStyle(e,null),t=e.getPropertyValue("visibility");return"none"!==e.getPropertyValue("display")&&!["hidden","collapse"].includes(t)}var i;return!(!function(t){if(t.offsetWidth+t.offsetHeight+t.getBoundingClientRect().height+t.getBoundingClientRect().width!==0){var i={x:t.getBoundingClientRect().left+t.offsetWidth/2,y:t.getBoundingClientRect().top+t.offsetHeight/2};if(!(i.x<0||i.x>(document.documentElement.clientWidth||window.innerWidth)||i.y<0||i.y>(document.documentElement.clientHeight||window.innerHeight))){let e=document.elementFromPoint(i.x,i.y);for(;e;){if(e===t)return 1;if(!e.parentNode)return;e=e.parentNode}}}}(e=e||this.el())||!t((i=e).parentElement)||!t(i)||"0"===i.style.opacity||"0px"===window.getComputedStyle(i).height||"0px"===window.getComputedStyle(i).width||e.parentElement&&!(0<=e.tabIndex))}static registerComponent(t,e){if("string"!=typeof t||!t)throw new Error(`Illegal component name, "${t}"; must be a non-empty string.`);var i=g.getComponent("Tech"),i=i&&i.isTech(e),s=g===e||g.prototype.isPrototypeOf(e.prototype);if(i||!s){let e;throw e=i?"techs must be registered using Tech.registerTech()":"must be a Component subclass",new Error(`Illegal component, "${t}"; ${e}.`)}t=m(t),g.components_||(g.components_={});s=g.getComponent("Player");if("Player"===t&&s&&s.players){let t=s.players;i=Object.keys(t);if(t&&0t[e]).every(Boolean))throw new Error("Can not register Player component after player has been created.")}return g.components_[t]=e,g.components_[Mt(t)]=e}static getComponent(e){if(e&&g.components_)return g.components_[e]}}function Ft(e,t,i,s){var r=s,n=i.length-1;if("number"!=typeof r||r<0||n(e||[]).values()),t}function jt(e,t){return Array.isArray(e)?qt(e):void 0===e||void 0===t?qt():qt([[e,t]])}g.registerComponent("Component",g);function Ht(e,t){e=e<0?0:e;let i=Math.floor(e%60),s=Math.floor(e/60%60),r=Math.floor(e/3600);var n=Math.floor(t/60%60),t=Math.floor(t/3600);return r=0<(r=!isNaN(e)&&e!==1/0?r:s=i="-")||0i&&(n=i),s+=n-r;return s/i}function i(e){if(e instanceof i)return e;"number"==typeof e?this.code=e:"string"==typeof e?this.message=e:Y(e)&&("number"==typeof e.code&&(this.code=e.code),Object.assign(this,e)),this.message||(this.message=i.defaultMessages[this.code]||"")}function Xt(e){return null!=e&&"function"==typeof e.then}function Kt(e){Xt(e)&&e.then(null,e=>{})}i.prototype.code=0,i.prototype.message="",i.prototype.status=null,i.prototype.metadata=null,i.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"],i.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."},i.MEDIA_ERR_CUSTOM=0,i.prototype.MEDIA_ERR_CUSTOM=0,i.MEDIA_ERR_ABORTED=1,i.prototype.MEDIA_ERR_ABORTED=1,i.MEDIA_ERR_NETWORK=2,i.prototype.MEDIA_ERR_NETWORK=2,i.MEDIA_ERR_DECODE=3,i.prototype.MEDIA_ERR_DECODE=3,i.MEDIA_ERR_SRC_NOT_SUPPORTED=4,i.prototype.MEDIA_ERR_SRC_NOT_SUPPORTED=4,i.MEDIA_ERR_ENCRYPTED=5,i.prototype.MEDIA_ERR_ENCRYPTED=5;function Yt(s){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce((e,t,i)=>(s[t]&&(e[t]=s[t]),e),{cues:s.cues&&Array.prototype.map.call(s.cues,function(e){return{startTime:e.startTime,endTime:e.endTime,text:e.text,id:e.id}})})}var Qt,Jt=function(e){var t=e.$$("track");let i=Array.prototype.map.call(t,e=>e.track);return Array.prototype.map.call(t,function(e){var t=Yt(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(Yt))},Zt=function(e,i){return e.forEach(function(e){let t=i.addRemoteTextTrack(e).track;!e.src&&e.cues&&e.cues.forEach(e=>t.addCue(e))}),i.textTracks()};Yt;let ei="vjs-modal-dialog";class ti extends g{constructor(e,t){super(e,t),this.handleKeyDown_=e=>this.handleKeyDown(e),this.close_=e=>this.close(e),this.opened_=this.hasBeenOpened_=this.hasBeenFilled_=!1,this.closeable(!this.options_.uncloseable),this.content(this.options_.content),this.contentEl_=l("div",{className:ei+"-content"},{role:"document"}),this.descEl_=l("p",{className:ei+"-description vjs-control-text",id:this.el().getAttribute("aria-describedby")}),xe(this.descEl_,this.description()),this.el_.appendChild(this.descEl_),this.el_.appendChild(this.contentEl_)}createEl(){return super.createEl("div",{className:this.buildCSSClass(),tabIndex:-1},{"aria-describedby":this.id()+"_description","aria-hidden":"true","aria-label":this.label(),role:"dialog","aria-live":"polite"})}dispose(){this.contentEl_=null,this.descEl_=null,this.previouslyActiveEl_=null,super.dispose()}buildCSSClass(){return ei+" vjs-hidden "+super.buildCSSClass()}label(){return this.localize(this.options_.label||"Modal Window")}description(){let 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}open(){var e;this.opened_?this.options_.fillAlways&&this.fill():(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)}opened(e){return"boolean"==typeof e&&this[e?"open":"close"](),this.opened_}close(){var e;this.opened_&&(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({type:"modalclose",bubbles:!0}),this.conditionalBlur_(),this.options_.temporary)&&this.dispose()}closeable(t){if("boolean"==typeof t){var i,t=this.closeable_=!!t;let e=this.getChild("closeButton");t&&!e&&(i=this.contentEl_,this.contentEl_=this.el_,e=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=i,this.on(e,"close",this.close_)),!t&&e&&(this.off(e,"close",this.close_),this.removeChild(e),e.dispose())}return this.closeable_}fill(){this.fillWith(this.content())}fillWith(e){var t=this.contentEl(),i=t.parentNode,s=t.nextSibling,e=(this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,i.removeChild(t),this.empty(),Xe(t,e),this.trigger("modalfill"),s?i.insertBefore(t,s):i.appendChild(t),this.getChild("closeButton"));e&&i.appendChild(e.el_),this.trigger("aftermodalfill")}empty(){this.trigger("beforemodalempty"),$e(this.contentEl()),this.trigger("modalempty")}content(e){return"undefined"!=typeof e&&(this.content_=e),this.content_}conditionalFocus_(){var e=document.activeElement,t=this.player_.el_;this.previouslyActiveEl_=null,!t.contains(e)&&t!==e||(this.previouslyActiveEl_=e,this.focus())}conditionalBlur_(){this.previouslyActiveEl_&&(this.previouslyActiveEl_.focus(),this.previouslyActiveEl_=null)}handleKeyDown(e){if(this.trigger({type:"modalKeydown",originalEvent:e,target:this,bubbles:!0}),e.stopPropagation(),"Escape"===e.key&&this.closeable())e.preventDefault(),this.close();else if("Tab"===e.key){var i=this.focusableEls_(),s=this.el_.querySelector(":focus");let t;for(let e=0;e(e instanceof window.HTMLAnchorElement||e instanceof window.HTMLAreaElement)&&e.hasAttribute("href")||(e instanceof window.HTMLInputElement||e instanceof window.HTMLSelectElement||e instanceof window.HTMLTextAreaElement||e instanceof window.HTMLButtonElement)&&!e.hasAttribute("disabled")||e instanceof window.HTMLIFrameElement||e instanceof window.HTMLObjectElement||e instanceof window.HTMLEmbedElement||e.hasAttribute("tabindex")&&-1!==e.getAttribute("tabindex")||e.hasAttribute("contenteditable"))}}ti.prototype.options_={pauseOnOpen:!0,temporary:!0},g.registerComponent("ModalDialog",ti);class ii extends wt{constructor(t=[]){super(),this.tracks_=[],Object.defineProperty(this,"length",{get(){return this.tracks_.length}});for(let e=0;e{this.trigger({track:e,type:"labelchange",target:this})},Ct(e)&&e.addEventListener("labelchange",e.labelchange_)}removeTrack(i){let s;for(let e=0,t=this.length;e{this.changing_||(this.changing_=!0,si(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("enabledchange",e.enabledChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.enabledChange_&&(e.removeEventListener("enabledchange",e.enabledChange_),e.enabledChange_=null)}}function ni(t,i){for(let e=0;e{this.changing_||(this.changing_=!0,ni(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("selectedchange",e.selectedChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.selectedChange_&&(e.removeEventListener("selectedchange",e.selectedChange_),e.selectedChange_=null)}}class oi extends ii{addTrack(e){super.addTrack(e),this.queueChange_||(this.queueChange_=()=>this.queueTrigger("change")),this.triggerSelectedlanguagechange||(this.triggerSelectedlanguagechange_=()=>this.trigger("selectedlanguagechange")),e.addEventListener("modechange",this.queueChange_);-1===["metadata","chapters"].indexOf(e.kind)&&e.addEventListener("modechange",this.triggerSelectedlanguagechange_)}removeTrack(e){super.removeTrack(e),e.removeEventListener&&(this.queueChange_&&e.removeEventListener("modechange",this.queueChange_),this.selectedlanguagechange_)&&e.removeEventListener("modechange",this.triggerSelectedlanguagechange_)}}class li{constructor(e){li.prototype.setCues_.call(this,e),Object.defineProperty(this,"length",{get(){return this.length_}})}setCues_(e){var t=this.length||0;let i=0;function s(e){""+e in this||Object.defineProperty(this,""+e,{get(){return this.cues_[e]}})}var r=e.length;this.cues_=e,this.length_=e.length;if(t=e.length?{done:!0}:{done:!1,value:e[i++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ki(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,s=new Array(t);io.error(e)),window.console)&&window.console.groupEnd&&window.console.groupEnd(),i.flush()}function Ui(e,s){var t={uri:e};(e=fi(e))&&(t.cors=e),(e="use-credentials"===s.tech_.crossOrigin())&&(t.withCredentials=e),Di(t,p(this,function(e,t,i){if(e)return o.error(e,t);s.loaded_=!0,"function"!=typeof window.WebVTT?s.tech_&&s.tech_.any(["vttjsloaded","vttjserror"],e=>{if("vttjserror"!==e.type)return Mi(i,s);o.error("vttjs failed to load, stopping trying to process "+s.src)}):Mi(i,s)}))}class Bi extends pi{constructor(e={}){if(!e.tech)throw new Error("A tech was not provided.");e=d(e,{kind:ui[e.kind]||"subtitles",language:e.language||e.srclang||""});let t=ci[e.mode]||"disabled",i=e.default,s=("metadata"!==e.kind&&"chapters"!==e.kind||(t="hidden"),super(e),this.tech_=e.tech,this.cues_=[],this.activeCues_=[],this.preload_=!1!==this.tech_.preloadTextTracks,new li(this.cues_)),n=new li(this.activeCues_),a=!1;this.timeupdateHandler=p(this,function(e={}){this.tech_.isDisposed()||(this.tech_.isReady_&&(this.activeCues=this.activeCues,a)&&(this.trigger("cuechange"),a=!1),"timeupdate"!==e.type&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler)))});this.tech_.one("dispose",()=>{this.stopTracking()}),"disabled"!==t&&this.startTracking(),Object.defineProperties(this,{default:{get(){return i},set(){}},mode:{get(){return t},set(e){ci[e]&&t!==e&&(t=e,this.preload_||"disabled"===t||0!==this.cues.length||Ui(this.src,this),this.stopTracking(),"disabled"!==t&&this.startTracking(),this.trigger("modechange"))}},cues:{get(){return this.loaded_?s:null},set(){}},activeCues:{get(){if(!this.loaded_)return null;if(0!==this.cues.length){var i=this.tech_.currentTime(),s=[];for(let e=0,t=this.cues.length;e{t=ji.LOADED,this.trigger({type:"load",target:this})})}}ji.prototype.allowedEvents_={load:"load"},ji.NONE=0,ji.LOADING=1,ji.LOADED=2,ji.ERROR=3;let Hi={audio:{ListClass:ri,TrackClass:Fi,capitalName:"Audio"},video:{ListClass:ai,TrackClass:qi,capitalName:"Video"},text:{ListClass:oi,TrackClass:Bi,capitalName:"Text"}},Vi=(Object.keys(Hi).forEach(function(e){Hi[e].getterName=e+"Tracks",Hi[e].privateName=e+"Tracks_"}),{remoteText:{ListClass:oi,TrackClass:Bi,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:class{constructor(i=[]){this.trackElements_=[],Object.defineProperty(this,"length",{get(){return this.trackElements_.length}});for(let e=0,t=i.length;e]*>?)?/))[1]||o[2],t=t.substr(o.length),o):null);)"<"===o[0]?"/"===o[1]?h.length&&h[h.length-1]===o.substr(2).replace(">","")&&(h.pop(),d=d.parentNode):(s=Xi(o.substr(1,o.length-2)))?(i=e.document.createProcessingInstruction("timestamp",s),d.appendChild(i)):(s=o.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/))&&(r=s[1],n=s[3],a=void 0,a=Ji[r],i=a?(a=e.document.createElement(a),(r=es[r])&&n&&(a[r]=n.trim()),a):null)&&(r=d,ts[(n=i).localName]&&ts[n.localName]!==r.localName||(s[2]&&((a=s[2].split(".")).forEach(function(e){var t=/^bg_/.test(e),e=t?e.slice(3):e;Zi.hasOwnProperty(e)&&(e=Zi[e],i.style[t?"background-color":"color"]=e)}),i.className=a.join(" ")),h.push(s[1]),d.appendChild(i),d=i)):d.appendChild(e.document.createTextNode((n=o,Qi.innerHTML=n,n=Qi.textContent,Qi.textContent="",n)));return l}var ss=[[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 rs(e){var t=[],i="";if(e&&e.childNodes)for(n(t,e);i=function e(t){var i,s,r;return t&&t.length?(s=(i=t.pop()).textContent||i.innerText)?(r=s.match(/^.*(\n|\r)/))?r[t.length=0]:s:"ruby"===i.tagName?e(t):i.childNodes?(n(t,i),e(t)):void 0:null}(t);)for(var s=0;s=i[0]&&e<=i[1])return 1}}(i.charCodeAt(s)))return"rtl";return"ltr";function n(e,t){for(var i=t.childNodes.length-1;0<=i;i--)e.push(t.childNodes[i])}}function ns(){}function as(e,t,i){ns.call(this),this.cue=t,this.cueDiv=is(e,t.text);this.applyStyles({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.cueDiv),this.div=e.document.createElement("div"),e={direction:rs(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(e),this.div.appendChild(this.cueDiv);var s=0;switch(t.positionAlign){case"start":case"line-left":s=t.position;break;case"center":s=t.position-t.size/2;break;case"end":case"line-right":s=t.position-t.size}""===t.vertical?this.applyStyles({left:this.formatStyle(s,"%"),width:this.formatStyle(t.size,"%")}):this.applyStyles({top:this.formatStyle(s,"%"),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 _(e){var t,i,s,r;e.div&&(t=e.div.offsetHeight,i=e.div.offsetWidth,s=e.div.offsetTop,r=(r=(r=e.div.childNodes)&&r[0])&&r.getClientRects&&r.getClientRects(),e=e.div.getBoundingClientRect(),r=r?Math.max(r[0]&&r[0].height||0,e.height/r.length):0),this.left=e.left,this.right=e.right,this.top=e.top||s,this.height=e.height||t,this.bottom=e.bottom||s+(e.height||t),this.width=e.width||i,this.lineHeight=void 0!==r?r:e.lineHeight}function os(e,t,o,l){var i,s=new _(t),r=t.cue,n=function(e){if("number"==typeof e.line&&(e.snapToLines||0<=e.line&&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,s=0,r=0;ru&&(h=h<0?-1:1,h*=Math.ceil(u/d)*d),n<0&&(h+=""===r.vertical?o.height:o.width,a=a.reverse()),s.move(c,h)}else{var p=s.lineHeight/o.height*100;switch(r.lineAlign){case"center":n-=p/2;break;case"end":n-=p}switch(r.vertical){case"":t.applyStyles({top:t.formatStyle(n,"%")});break;case"rl":t.applyStyles({left:t.formatStyle(n,"%")});break;case"lr":t.applyStyles({right:t.formatStyle(n,"%")})}a=["+y","-x","+x","-y"],s=new _(t)}u=function(e,t){for(var i,s=new _(e),r=1,n=0;ne.left&&this.tope.top},_.prototype.overlapsAny=function(e){for(var t=0;t=e.top&&this.bottom<=e.bottom&&this.left>=e.left&&this.right<=e.right},_.prototype.overlapsOppositeAxis=function(e,t){switch(t){case"+x":return this.lefte.right;case"+y":return this.tope.bottom}},_.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)},_.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}},_.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,s=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||s,height:e.height||t,bottom:e.bottom||s+(e.height||t),width:e.width||i}},ls.StringDecoder=function(){return{decode:function(e){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}},ls.convertCueToDOMTree=function(e,t){return e&&t?is(e,t):null};ls.processCues=function(e,t,i){if(!e||!t||!i)return null;for(;i.firstChild;)i.removeChild(i.firstChild);var s=e.document.createElement("div");if(s.style.position="absolute",s.style.left="0",s.style.right="0",s.style.top="0",s.style.bottom="0",s.style.margin="1.5%",i.appendChild(s),function(e){for(var t=0;tthis.onDurationChange(e),this.trackProgress_=e=>this.trackProgress(e),this.trackCurrentTime_=e=>this.trackCurrentTime(e),this.stopTrackingCurrentTime_=e=>this.stopTrackingCurrentTime(e),this.disposeSourceHandler_=e=>this.disposeSourceHandler(e),this.queuedHanders_=new Set,this.hasStarted_=!1,this.on("playing",function(){this.hasStarted_=!0}),this.on("loadstart",function(){this.hasStarted_=!1}),a.names.forEach(e=>{e=a[e];t&&t[e.getterName]&&(this[e.privateName]=t[e.getterName])}),this.featuresProgressEvents||this.manualProgressOn(),this.featuresTimeupdateEvents||this.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach(e=>{!1===t[`native${e}Tracks`]&&(this[`featuresNative${e}Tracks`]=!1)}),!1===t.nativeCaptions||!1===t.nativeTextTracks?this.featuresNativeTextTracks=!1:!0!==t.nativeCaptions&&!0!==t.nativeTextTracks||(this.featuresNativeTextTracks=!0),this.featuresNativeTextTracks||this.emulateTextTracks(),this.preloadTextTracks=!1!==t.preloadTextTracks,this.autoRemoteTextTracks_=new a.text.ListClass,this.initTrackListeners(),t.nativeControlsForTouch||this.emitTapEvents(),this.constructor&&(this.name_=this.constructor.name||"Unknown Tech")}triggerSourceset(e){this.isReady_||this.one("ready",()=>this.setTimeout(()=>this.triggerSourceset(e),1)),this.trigger({src:e,type:"sourceset"})}manualProgressOn(){this.on("durationchange",this.onDurationChange_),this.manualProgress=!0,this.one("ready",this.trackProgress_)}manualProgressOff(){this.manualProgress=!1,this.stopTrackingProgress(),this.off("durationchange",this.onDurationChange_)}trackProgress(e){this.stopTrackingProgress(),this.progressInterval=this.setInterval(p(this,function(){var e=this.bufferedPercent();this.bufferedPercent_!==e&&this.trigger("progress"),1===(this.bufferedPercent_=e)&&this.stopTrackingProgress()}),500)}onDurationChange(e){this.duration_=this.duration()}buffered(){return jt(0,0)}bufferedPercent(){return Gt(this.buffered(),this.duration_)}stopTrackingProgress(){this.clearInterval(this.progressInterval)}manualTimeUpdatesOn(){this.manualTimeUpdates=!0,this.on("play",this.trackCurrentTime_),this.on("pause",this.stopTrackingCurrentTime_)}manualTimeUpdatesOff(){this.manualTimeUpdates=!1,this.stopTrackingCurrentTime(),this.off("play",this.trackCurrentTime_),this.off("pause",this.stopTrackingCurrentTime_)}trackCurrentTime(){this.currentTimeInterval&&this.stopTrackingCurrentTime(),this.currentTimeInterval=this.setInterval(function(){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},250)}stopTrackingCurrentTime(){this.clearInterval(this.currentTimeInterval),this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}dispose(){this.clearTracks(Hi.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),super.dispose()}clearTracks(e){(e=[].concat(e)).forEach(e=>{var t=this[e+"Tracks"]()||[];let i=t.length;for(;i--;){var s=t[i];"text"===e&&this.removeRemoteTextTrack(s),t.removeTrack(s)}})}cleanupAutoTextTracks(){var e=this.autoRemoteTextTracks_||[];let t=e.length;for(;t--;){var i=e[t];this.removeRemoteTextTrack(i)}}reset(){}crossOrigin(){}setCrossOrigin(){}error(e){return void 0!==e&&(this.error_=new i(e),this.trigger("error")),this.error_}played(){return this.hasStarted_?jt(0,0):jt()}play(){}setScrubbing(e){}scrubbing(){}setCurrentTime(e){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}initTrackListeners(){Hi.names.forEach(e=>{var t=Hi[e];let i=()=>{this.trigger(e+"trackchange")},s=this[t.getterName]();s.addEventListener("removetrack",i),s.addEventListener("addtrack",i),this.on("dispose",()=>{s.removeEventListener("removetrack",i),s.removeEventListener("addtrack",i)})})}addWebVttScript_(){if(!window.WebVTT)if(document.body.contains(this.el()))if(!this.options_["vtt.js"]&&Q(_s)&&0{this.trigger("vttjsloaded")},e.onerror=()=>{this.trigger("vttjserror")},this.on("dispose",()=>{e.onload=null,e.onerror=null}),window.WebVTT=!0,this.el().parentNode.appendChild(e)}else this.ready(this.addWebVttScript_)}emulateTextTracks(){let i=this.textTracks(),e=this.remoteTextTracks(),t=e=>i.addTrack(e.track),s=e=>i.removeTrack(e.track),r=(e.on("addtrack",t),e.on("removetrack",s),this.addWebVttScript_(),()=>this.trigger("texttrackchange")),n=()=>{r();for(let e=0;ethis.autoRemoteTextTracks_.addTrack(i.track)),i}removeRemoteTextTrack(e){var t=this.remoteTextTrackEls().getTrackElementByTrack_(e);this.remoteTextTrackEls().removeTrackElement_(t),this.remoteTextTracks().removeTrack(e),this.autoRemoteTextTracks_.removeTrack(e)}getVideoPlaybackQuality(){return{}}requestPictureInPicture(){return Promise.reject()}disablePictureInPicture(){return!0}setDisablePictureInPicture(){}requestVideoFrameCallback(e){let t=lt++;return!this.isReady_||this.paused()?(this.queuedHanders_.add(t),this.one("playing",()=>{this.queuedHanders_.has(t)&&(this.queuedHanders_.delete(t),e())})):this.requestNamedAnimationFrame(t,e),t}cancelVideoFrameCallback(e){this.queuedHanders_.has(e)?this.queuedHanders_.delete(e):this.cancelNamedAnimationFrame(e)}setPoster(){}playsinline(){}setPlaysinline(){}overrideNativeAudioTracks(e){}overrideNativeVideoTracks(e){}canPlayType(e){return""}static canPlayType(e){return""}static canPlaySource(e,t){return v.canPlayType(e.type)}static isTech(e){return e.prototype instanceof v||e instanceof v||e===v}static registerTech(e,t){if(v.techs_||(v.techs_={}),!v.isTech(t))throw new Error(`Tech ${e} must be a Tech`);if(!v.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(v.canPlaySource)return e=m(e),v.techs_[e]=t,v.techs_[Mt(e)]=t,"Tech"!==e&&v.defaultTechOrder_.push(e),t;throw new Error("Techs must have a static canPlaySource method on them")}static getTech(e){if(e)return v.techs_&&v.techs_[e]?v.techs_[e]:(e=m(e),window&&window.videojs&&window.videojs[e]?(o.warn(`The ${e} tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)`),window.videojs[e]):void 0)}}a.names.forEach(function(e){let t=a[e];v.prototype[t.getterName]=function(){return this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName]}}),v.prototype.featuresVolumeControl=!0,v.prototype.featuresMuteControl=!0,v.prototype.featuresFullscreenResize=!1,v.prototype.featuresPlaybackRate=!1,v.prototype.featuresProgressEvents=!1,v.prototype.featuresSourceset=!1,v.prototype.featuresTimeupdateEvents=!1,v.prototype.featuresNativeTextTracks=!1,v.prototype.featuresVideoFrameCallback=!1,v.withSourceHandlers=function(r){r.registerSourceHandler=function(e,t){let i=r.sourceHandlers;i=i||(r.sourceHandlers=[]),void 0===t&&(t=i.length),i.splice(t,0,e)},r.canPlayType=function(t){var i,s=r.sourceHandlers||[];for(let e=0;efunction s(r={},e=[],n,a,o=[],l=!1){let[t,...d]=e;if("string"==typeof t)s(r,vs[t],n,a,o,l);else if(t){let i=xs(a,t);if(!i.setSource)return o.push(i),s(r,d,n,a,o,l);i.setSource(Object.assign({},r),function(e,t){if(e)return s(r,d,n,a,o,l);o.push(i),s(t,r.type===t.type?d:vs[t.type],n,a,o,l)})}else d.length?s(r,d,n,a,o,l):l?n(r,o):s(r,vs["*"],n,a,o,!0)}(t,vs[t.type],i,e),1)}function ws(e,t,i,s=null){var r="call"+m(i),r=e.reduce(Is(r),s),s=r===Ts,t=s?null:t[i](r),n=e,a=i,o=t,l=s;for(let e=n.length-1;0<=e;e--){var d=n[e];d[a]&&d[a](l,o)}return t}let Es={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},Cs={setCurrentTime:1,setMuted:1,setVolume:1},ks={play:1,pause:1};function Is(i){return(e,t)=>e===Ts?Ts:t[i]?t[i](e):e}function xs(e,t){var i=bs[e.id()];let s=null;if(null==i)s=t(e),bs[e.id()]=[[t,s]];else{for(let e=0;e{this.focus(this.updateFocusableComponents()[0])}),this.player_.on("modalclose",()=>{this.refocusComponent()}),this.player_.on("focusin",this.handlePlayerFocus_.bind(this)),this.player_.on("focusout",this.handlePlayerBlur_.bind(this)),this.isListening_=!0,this.player_.errorDisplay&&this.player_.errorDisplay.on("aftermodalfill",()=>{this.updateFocusableComponents(),this.focusableComponents.length&&(1{if(e.hasOwnProperty("el_")){if(e.getIsFocusable&&e.getIsAvailableToBeFocused&&e.getIsFocusable()&&e.getIsAvailableToBeFocused(e.el()))return void i.push(e);e.hasOwnProperty("children_")&&0{i.push({name:()=>"ModalButton"+(e+1),el:()=>t,getPositions:()=>{var e=t.getBoundingClientRect();return{boundingClientRect:{x:e.x,y:e.y,width:e.width,height:e.height,top:e.top,right:e.right,bottom:e.bottom,left:e.left},center:{x:e.left+e.width/2,y:e.top+e.height/2,width:0,height:0,top:e.top+e.height/2,right:e.left+e.width/2,bottom:e.top+e.height/2,left:e.left+e.width/2}}},getIsAvailableToBeFocused:()=>!0,getIsFocusable:e=>!0,focus:()=>t.focus()})})}),this.focusableComponents=i,this.focusableComponents}findSuitableDOMChild(e){return e.el()?function t(i){if(e.getIsFocusable(i)&&e.getIsAvailableToBeFocused(i))return i;for(let e=0;ee!==s&&this.isInDirection_(t.boundingClientRect,e.getPositions().boundingClientRect,i)),e=this.findBestCandidate_(t.center,e,i);e?this.focus(e):this.trigger({type:"endOfFocusableComponents",direction:i,focusedComponent:s})}}findBestCandidate_(e,t,i){let s=1/0,r=null;for(var n of t){var a=n.getPositions().center,a=this.calculateDistance_(e,a,i);a=e.right;case"left":return t.right<=e.left;case"down":return t.top>=e.bottom;case"up":return t.bottom<=e.top;default:return!1}}refocusComponent(){if(this.lastFocusedComponent_){this.player_.userActive()||this.player_.userActive(!0),this.updateFocusableComponents();for(let e=0;ethis.handleMouseOver(e),this.handleMouseOut_=e=>this.handleMouseOut(e),this.handleClick_=e=>this.handleClick(e),this.handleKeyDown_=e=>this.handleKeyDown(e),this.emitTapEvents(),this.enable()}createEl(e="div",t={},i={}){t=Object.assign({className:this.buildCSSClass(),tabIndex:0},t),"button"===e&&o.error(`Creating a ClickableComponent with an HTML element of ${e} is not supported; use a Button instead.`),i=Object.assign({role:"button"},i),this.tabIndex_=t.tabIndex;e=l(e,t,i);return this.player_.options_.experimentalSvgIcons||e.appendChild(l("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(e),e}dispose(){this.controlTextEl_=null,super.dispose()}createControlTextEl(e){return this.controlTextEl_=l("span",{className:"vjs-control-text"},{"aria-live":"polite"}),e&&e.appendChild(this.controlTextEl_),this.controlText(this.controlText_,e),this.controlTextEl_}controlText(e,t=this.el()){if(void 0===e)return this.controlText_||"Need Text";var i=this.localize(e);this.controlText_=e,xe(this.controlTextEl_,i),this.nonIconControl||this.player_.options_.noUITitleAttributes||t.setAttribute("title",i)}buildCSSClass(){return"vjs-control vjs-button "+super.buildCSSClass()}enable(){this.enabled_||(this.enabled_=!0,this.removeClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","false"),"undefined"!=typeof this.tabIndex_&&this.el_.setAttribute("tabIndex",this.tabIndex_),this.on(["tap","click"],this.handleClick_),this.on("keydown",this.handleKeyDown_))}disable(){this.enabled_=!1,this.addClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","true"),"undefined"!=typeof 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_)}handleLanguagechange(){this.controlText(this.controlText_)}handleClick(e){this.options_.clickHandler&&this.options_.clickHandler.call(this,arguments)}handleKeyDown(e){" "===e.key||"Enter"===e.key?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}g.registerComponent("ClickableComponent",Ms);class Us extends Ms{constructor(e,t){super(e,t),this.update(),this.update_=e=>this.update(e),e.on("posterchange",this.update_)}dispose(){this.player().off("posterchange",this.update_),super.dispose()}createEl(){return l("div",{className:"vjs-poster"})}crossOrigin(e){if("undefined"==typeof e)return this.$("img")?this.$("img").crossOrigin:this.player_.tech_&&this.player_.tech_.isReady_?this.player_.crossOrigin():this.player_.options_.crossOrigin||this.player_.options_.crossorigin||null;null!==e&&"anonymous"!==e&&"use-credentials"!==e?this.player_.log.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`):this.$("img")&&(this.$("img").crossOrigin=e)}update(e){var t=this.player().poster();this.setSrc(t),t?this.show():this.hide()}setSrc(e){e?(this.$("img")||this.el_.appendChild(l("picture",{className:"vjs-poster",tabIndex:-1},{},l("img",{loading:"lazy",crossOrigin:this.crossOrigin()},{alt:""}))),this.$("img").src=e):this.el_.textContent=""}handleClick(e){this.player_.controls()&&(this.player_.tech(!0)&&this.player_.tech(!0).focus(),this.player_.paused()?Kt(this.player_.play()):this.player_.pause())}}Us.prototype.crossorigin=Us.prototype.crossOrigin,g.registerComponent("PosterImage",Us);let Bs={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 Fs(e,t){let 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 qs(e,t,i){try{e.style[t]=i}catch(e){}}function js(e){return e?e+"px":""}class Hs extends g{constructor(s,e,t){super(s,e,t);let r=e=>{this.updateDisplayOverlay(),this.updateDisplay(e)};s.on("loadstart",e=>this.toggleDisplay(e)),s.on("texttrackchange",e=>this.updateDisplay(e)),s.on("loadedmetadata",e=>{this.updateDisplayOverlay(),this.preselectTrack(e)}),s.ready(p(this,function(){if(s.tech_&&s.tech_.featuresNativeTextTracks)this.hide();else{s.on("fullscreenchange",r),s.on("playerresize",r);let e=window.screen.orientation||window,t=window.screen.orientation?"change":"orientationchange";e.addEventListener(t,r),s.on("dispose",()=>e.removeEventListener(t,r));var i=this.options_.playerOptions.tracks||[];for(let e=0;e{var t;e.style.inset&&3===(t=e.style.inset.split(" ")).length&&Object.assign(e.style,{top:t[0],right:t[1],bottom:t[2],left:"unset"})}))}}updateDisplayOverlay(){if(this.player_.videoHeight()&&window.CSS.supports("inset-inline: 10px")){var i=this.player_.currentWidth(),s=this.player_.currentHeight(),r=i/s,n=this.player_.videoWidth()/this.player_.videoHeight();let e=0,t=0;.1!e.activeCues)){var t=[];for(let e=0;ethis.handleMouseDown(e))}buildCSSClass(){return"vjs-big-play-button"}handleClick(t){var i=this.player_.play();if(this.mouseused_&&"clientX"in t&&"clientY"in t)Kt(i),this.player_.tech(!0)&&this.player_.tech(!0).focus();else{var t=this.player_.getChild("controlBar");let e=t&&t.getChild("playToggle");e?(t=()=>e.focus(),Xt(i)?i.then(t,()=>{}):this.setTimeout(t,1)):this.player_.tech(!0).focus()}}handleKeyDown(e){this.mouseused_=!1,super.handleKeyDown(e)}handleMouseDown(e){this.mouseused_=!0}}zs.prototype.controlText_="Play Video",g.registerComponent("BigPlayButton",zs);class $s extends s{constructor(e,t){super(e,t),this.setIcon("cancel"),this.controlText(t&&t.controlText||this.localize("Close"))}buildCSSClass(){return"vjs-close-button "+super.buildCSSClass()}handleClick(e){this.trigger({type:"close",bubbles:!1})}handleKeyDown(e){"Escape"===e.key?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}g.registerComponent("CloseButton",$s);class Ws extends s{constructor(e,t={}){super(e,t),t.replay=void 0===t.replay||t.replay,this.setIcon("play"),this.on(e,"play",e=>this.handlePlay(e)),this.on(e,"pause",e=>this.handlePause(e)),t.replay&&this.on(e,"ended",e=>this.handleEnded(e))}buildCSSClass(){return"vjs-play-control "+super.buildCSSClass()}handleClick(e){this.player_.paused()?Kt(this.player_.play()):this.player_.pause()}handleSeeked(e){this.removeClass("vjs-ended"),this.player_.paused()?this.handlePause(e):this.handlePlay(e)}handlePlay(e){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.setIcon("pause"),this.controlText("Pause")}handlePause(e){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.setIcon("play"),this.controlText("Play")}handleEnded(e){this.removeClass("vjs-playing"),this.addClass("vjs-ended"),this.setIcon("replay"),this.controlText("Replay"),this.one(this.player_,"seeked",e=>this.handleSeeked(e))}}Ws.prototype.controlText_="Play",g.registerComponent("PlayToggle",Ws);class Gs extends g{constructor(e,t){super(e,t),this.on(e,["timeupdate","ended","seeking"],e=>this.update(e)),this.updateTextNode_()}createEl(){var e=this.buildCSSClass(),t=super.createEl("div",{className:e+" vjs-time-control vjs-control"}),i=l("span",{className:"vjs-control-text",textContent:this.localize(this.labelText_)+" "},{role:"presentation"});return t.appendChild(i),this.contentEl_=l("span",{className:e+"-display"},{role:"presentation"}),t.appendChild(this.contentEl_),t}dispose(){this.contentEl_=null,this.textNode_=null,super.dispose()}update(e){!this.player_.options_.enableSmoothSeeking&&"seeking"===e.type||this.updateContent(e)}updateTextNode_(e=0){e=Wt(e),this.formattedTime_!==e&&(this.formattedTime_=e,this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_",()=>{if(this.contentEl_){let e=this.textNode_;e&&this.contentEl_.firstChild!==e&&(e=null,o.warn("TimeDisplay#updateTextnode_: Prevented replacement of text node element since it was no longer a child of this node. Appending a new node instead.")),this.textNode_=document.createTextNode(this.formattedTime_),this.textNode_&&(e?this.contentEl_.replaceChild(this.textNode_,e):this.contentEl_.appendChild(this.textNode_))}}))}updateContent(e){}}Gs.prototype.labelText_="Time",Gs.prototype.controlText_="Time",g.registerComponent("TimeDisplay",Gs);class Xs extends Gs{buildCSSClass(){return"vjs-current-time"}updateContent(e){let t;t=this.player_.ended()?this.player_.duration():this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),this.updateTextNode_(t)}}Xs.prototype.labelText_="Current Time",Xs.prototype.controlText_="Current Time",g.registerComponent("CurrentTimeDisplay",Xs);class Ks extends Gs{constructor(e,t){super(e,t);t=e=>this.updateContent(e);this.on(e,"durationchange",t),this.on(e,"loadstart",t),this.on(e,"loadedmetadata",t)}buildCSSClass(){return"vjs-duration"}updateContent(e){var t=this.player_.duration();this.updateTextNode_(t)}}Ks.prototype.labelText_="Duration",Ks.prototype.controlText_="Duration",g.registerComponent("DurationDisplay",Ks);class Ys extends g{createEl(){var e=super.createEl("div",{className:"vjs-time-control vjs-time-divider"},{"aria-hidden":!0}),t=super.createEl("div"),i=super.createEl("span",{textContent:"/"});return t.appendChild(i),e.appendChild(t),e}}g.registerComponent("TimeDivider",Ys);class Qs extends Gs{constructor(e,t){super(e,t),this.on(e,"durationchange",e=>this.updateContent(e))}buildCSSClass(){return"vjs-remaining-time"}createEl(){var e=super.createEl();return!1!==this.options_.displayNegative&&e.insertBefore(l("span",{},{"aria-hidden":!0},"-"),this.contentEl_),e}updateContent(e){if("number"==typeof this.player_.duration()){let e;e=this.player_.ended()?0:this.player_.remainingTimeDisplay?this.player_.remainingTimeDisplay():this.player_.remainingTime(),this.updateTextNode_(e)}}}Qs.prototype.labelText_="Remaining Time",Qs.prototype.controlText_="Remaining Time",g.registerComponent("RemainingTimeDisplay",Qs);class Js extends g{constructor(e,t){super(e,t),this.updateShowing(),this.on(this.player(),"durationchange",e=>this.updateShowing(e))}createEl(){var e=super.createEl("div",{className:"vjs-live-control vjs-control"});return this.contentEl_=l("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(l("span",{className:"vjs-control-text",textContent:this.localize("Stream Type")+" "})),this.contentEl_.appendChild(document.createTextNode(this.localize("LIVE"))),e.appendChild(this.contentEl_),e}dispose(){this.contentEl_=null,super.dispose()}updateShowing(e){this.player().duration()===1/0?this.show():this.hide()}}g.registerComponent("LiveDisplay",Js);class Zs extends s{constructor(e,t){super(e,t),this.updateLiveEdgeStatus(),this.player_.liveTracker&&(this.updateLiveEdgeStatusHandler_=e=>this.updateLiveEdgeStatus(e),this.on(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_))}createEl(){var e=super.createEl("button",{className:"vjs-seek-to-live-control vjs-control"});return this.setIcon("circle",e),this.textEl_=l("span",{className:"vjs-seek-to-live-text",textContent:this.localize("LIVE")},{"aria-hidden":"true"}),e.appendChild(this.textEl_),e}updateLiveEdgeStatus(){!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"))}handleClick(){this.player_.liveTracker.seekToLiveEdge()}dispose(){this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_),this.textEl_=null,super.dispose()}}function er(e,t,i){return e=Number(e),Math.min(i,Math.max(t,isNaN(e)?t:e))}Zs.prototype.controlText_="Seek to live, currently playing live",g.registerComponent("SeekToLive",Zs);zi=Object.freeze({__proto__:null,clamp:er});class tr extends g{constructor(e,t){super(e,t),this.handleMouseDown_=e=>this.handleMouseDown(e),this.handleMouseUp_=e=>this.handleMouseUp(e),this.handleKeyDown_=e=>this.handleKeyDown(e),this.handleClick_=e=>this.handleClick(e),this.handleMouseMove_=e=>this.handleMouseMove(e),this.update_=e=>this.update(e),this.bar=this.getChild(this.options_.barName),this.vertical(!!this.options_.vertical),this.enable()}enabled(){return this.enabled_}enable(){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)}disable(){var e;this.enabled()&&(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)}createEl(e,t={},i={}){return t.className=t.className+" vjs-slider",t=Object.assign({tabIndex:0},t),i=Object.assign({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100},i),super.createEl(e,t,i)}handleMouseDown(e){var t=this.bar.el_.ownerDocument;"mousedown"===e.type&&e.preventDefault(),"touchstart"!==e.type||le||e.preventDefault(),Fe(),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)}handleMouseMove(e){}handleMouseUp(e){var t=this.bar.el_.ownerDocument;qe(),this.removeClass("vjs-sliding"),this.trigger("sliderinactive"),this.off(t,"mousemove",this.handleMouseMove_),this.off(t,"mouseup",this.handleMouseUp_),this.off(t,"touchmove",this.handleMouseMove_),this.off(t,"touchend",this.handleMouseUp_),this.update()}update(){if(this.el_&&this.bar){let t=this.getProgress();return t!==this.progress_&&(this.progress_=t,this.requestNamedAnimationFrame("Slider#update",()=>{var e=this.vertical()?"height":"width";this.bar.el().style[e]=(100*t).toFixed(2)+"%"})),t}}getProgress(){return Number(er(this.getPercent(),0,1).toFixed(4))}calculateDistance(e){e=Ve(this.el_,e);return this.vertical()?e.y:e.x}handleKeyDown(e){var t=this.options_.playerOptions.spatialNavigation,i=t&&t.enabled,t=t&&t.horizontalSeek;i?t&&"ArrowLeft"===e.key||!t&&"ArrowDown"===e.key?(e.preventDefault(),e.stopPropagation(),this.stepBack()):t&&"ArrowRight"===e.key||!t&&"ArrowUp"===e.key?(e.preventDefault(),e.stopPropagation(),this.stepForward()):super.handleKeyDown(e):"ArrowLeft"===e.key||"ArrowDown"===e.key?(e.preventDefault(),e.stopPropagation(),this.stepBack()):"ArrowUp"===e.key||"ArrowRight"===e.key?(e.preventDefault(),e.stopPropagation(),this.stepForward()):super.handleKeyDown(e)}handleClick(e){e.stopPropagation(),e.preventDefault()}vertical(e){if(void 0===e)return this.vertical_||!1;this.vertical_=!!e,this.vertical_?this.addClass("vjs-slider-vertical"):this.addClass("vjs-slider-horizontal")}}g.registerComponent("Slider",tr);let ir=(e,t)=>er(e/t*100,0,100).toFixed(2)+"%";class sr extends g{constructor(e,t){super(e,t),this.partEls_=[],this.on(e,"progress",e=>this.update(e))}createEl(){var e=super.createEl("div",{className:"vjs-load-progress"}),t=l("span",{className:"vjs-control-text"}),i=l("span",{textContent:this.localize("Loaded")}),s=document.createTextNode(": ");return this.percentageEl_=l("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),e.appendChild(t),t.appendChild(i),t.appendChild(s),t.appendChild(this.percentageEl_),e}dispose(){this.partEls_=null,this.percentageEl_=null,super.dispose()}update(e){this.requestNamedAnimationFrame("LoadProgressBar#update",()=>{var e=this.player_.liveTracker,i=this.player_.buffered(),e=e&&e.isLive()?e.seekableEnd():this.player_.duration(),s=this.player_.bufferedEnd(),r=this.partEls_,e=ir(s,e);this.percent_!==e&&(this.el_.style.width=e,xe(this.percentageEl_,e),this.percent_=e);for(let t=0;ti.length;e--)this.el_.removeChild(r[e-1]);r.length=i.length})}}g.registerComponent("LoadProgressBar",sr);class rr extends g{constructor(e,t){super(e,t),this.update=vt(p(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})}update(s,r,n){var a=He(this.el_),o=je(this.player_.el()),r=s.width*r;if(o&&a){let e=s.left-o.left+r,t=s.width-r+(o.right-s.right),i=(t||(t=s.width-r,e=r),a.width/2);ea.width&&(i=a.width),i=Math.round(i),this.el_.style.right=`-${i}px`,this.write(n)}}write(e){xe(this.el_,e)}updateTime(r,n,a,o){this.requestNamedAnimationFrame("TimeTooltip#updateTime",()=>{let e;var t,i,s=this.player_.duration();e=this.player_.liveTracker&&this.player_.liveTracker.isLive()?((i=(t=this.player_.liveTracker.liveWindow())-n*t)<1?"":"-")+Wt(i,t):Wt(a,s),this.update(r,n,e),o&&o()})}}g.registerComponent("TimeTooltip",rr);class nr extends g{constructor(e,t){super(e,t),this.setIcon("circle"),this.update=vt(p(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})}update(e,t){var i,s=this.getChild("timeTooltip");s&&(i=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),s.updateTime(e,t,i))}}nr.prototype.options_={children:[]},u||se||nr.prototype.options_.children.push("timeTooltip"),g.registerComponent("PlayProgressBar",nr);class ar extends g{constructor(e,t){super(e,t),this.update=vt(p(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t){var i=t*this.player_.duration();this.getChild("timeTooltip").updateTime(e,t,i,()=>{this.el_.style.left=e.width*t+"px"})}}ar.prototype.options_={children:["timeTooltip"]},g.registerComponent("MouseTimeDisplay",ar);class or extends tr{constructor(e,t){super(e,t),this.setEventHandlers_()}setEventHandlers_(){this.update_=p(this,this.update),this.update=vt(this.update_,30),this.on(this.player_,["durationchange","timeupdate"],this.update),this.on(this.player_,["ended"],this.update_),this.player_.liveTracker&&this.on(this.player_.liveTracker,"liveedgechange",this.update),this.updateInterval=null,this.enableIntervalHandler_=e=>this.enableInterval_(e),this.disableIntervalHandler_=e=>this.disableInterval_(e),this.on(this.player_,["playing"],this.enableIntervalHandler_),this.on(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in document&&"visibilityState"in document&&this.on(document,"visibilitychange",this.toggleVisibility_)}toggleVisibility_(e){"hidden"===document.visibilityState?(this.cancelNamedAnimationFrame("SeekBar#update"),this.cancelNamedAnimationFrame("Slider#update"),this.disableInterval_(e)):(this.player_.ended()||this.player_.paused()||this.enableInterval_(),this.update())}enableInterval_(){this.updateInterval||(this.updateInterval=this.setInterval(this.update,30))}disableInterval_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&e&&"ended"!==e.type||this.updateInterval&&(this.clearInterval(this.updateInterval),this.updateInterval=null)}createEl(){return super.createEl("div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})}update(e){if("hidden"!==document.visibilityState){let s=super.update();return this.requestNamedAnimationFrame("SeekBar#update",()=>{var e=this.player_.ended()?this.player_.duration():this.getCurrentTime_(),t=this.player_.liveTracker;let i=this.player_.duration();t&&t.isLive()&&(i=this.player_.liveTracker.liveCurrentTime()),this.percent_!==s&&(this.el_.setAttribute("aria-valuenow",(100*s).toFixed(2)),this.percent_=s),this.currentTime_===e&&this.duration_===i||(this.el_.setAttribute("aria-valuetext",this.localize("progress bar timing: currentTime={1} duration={2}",[Wt(e,i),Wt(i,i)],"{1} of {2}")),this.currentTime_=e,this.duration_=i),this.bar&&this.bar.update(je(this.el()),this.getProgress())}),s}}userSeek_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)}getCurrentTime_(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()}getPercent(){var e=this.getCurrentTime_();let t;var i=this.player_.liveTracker;return i&&i.isLive()?(t=(e-i.seekableStart())/i.liveWindow(),i.atLiveEdge()&&(t=1)):t=e/this.player_.duration(),t}handleMouseDown(e){Ke(e)&&(e.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),this.player_.pause(),super.handleMouseDown(e))}handleMouseMove(t,i=!1){if(Ke(t)&&!isNaN(this.player_.duration())){i||this.player_.scrubbing()||this.player_.scrubbing(!0);let e;i=this.calculateDistance(t),t=this.player_.liveTracker;if(t&&t.isLive()){if(.99<=i)return void t.seekToLiveEdge();var s=t.seekableStart(),r=t.liveCurrentTime();if((e=(e=(e=s+i*t.liveWindow())>=r?r:e)<=s?s+.1:e)===1/0)return}else(e=i*this.player_.duration())===this.player_.duration()&&(e-=.1);this.userSeek_(e),this.player_.options_.enableSmoothSeeking&&this.update()}}enable(){super.enable();var e=this.getChild("mouseTimeDisplay");e&&e.show()}disable(){super.disable();var e=this.getChild("mouseTimeDisplay");e&&e.hide()}handleMouseUp(e){super.handleMouseUp(e),e&&e.stopPropagation(),this.player_.scrubbing(!1),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0}),this.videoWasPlaying?Kt(this.player_.play()):this.update_()}stepForward(){this.userSeek_(this.player_.currentTime()+5)}stepBack(){this.userSeek_(this.player_.currentTime()-5)}handleAction(e){this.player_.paused()?this.player_.play():this.player_.pause()}handleKeyDown(e){var t,i=this.player_.liveTracker;" "===e.key||"Enter"===e.key?(e.preventDefault(),e.stopPropagation(),this.handleAction(e)):"Home"===e.key?(e.preventDefault(),e.stopPropagation(),this.userSeek_(0)):"End"===e.key?(e.preventDefault(),e.stopPropagation(),i&&i.isLive()?this.userSeek_(i.liveCurrentTime()):this.userSeek_(this.player_.duration())):/^[0-9]$/.test(e.key)?(e.preventDefault(),e.stopPropagation(),t=.1*parseInt(e.key,10),i&&i.isLive()?this.userSeek_(i.seekableStart()+i.liveWindow()*t):this.userSeek_(this.player_.duration()*t)):"PageDown"===e.key?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()-60)):"PageUp"===e.key?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()+60)):super.handleKeyDown(e)}dispose(){this.disableInterval_(),this.off(this.player_,["durationchange","timeupdate"],this.update),this.off(this.player_,["ended"],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 document&&"visibilityState"in document&&this.off(document,"visibilitychange",this.toggleVisibility_),super.dispose()}}or.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"},u||se||or.prototype.options_.children.splice(1,0,"mouseTimeDisplay"),g.registerComponent("SeekBar",or);class lr extends g{constructor(e,t){super(e,t),this.handleMouseMove=vt(p(this,this.handleMouseMove),30),this.throttledHandleMouseSeek=vt(p(this,this.handleMouseSeek),30),this.handleMouseUpHandler_=e=>this.handleMouseUp(e),this.handleMouseDownHandler_=e=>this.handleMouseDown(e),this.enable()}createEl(){return super.createEl("div",{className:"vjs-progress-control vjs-control"})}handleMouseMove(e){var t,i,s,r,n=this.getChild("seekBar");n&&(t=n.getChild("playProgressBar"),i=n.getChild("mouseTimeDisplay"),t||i)&&(s=He(r=n.el()),r=er(r=Ve(r,e).x,0,1),i&&i.update(s,r),t)&&t.update(s,n.getProgress())}handleMouseSeek(e){var t=this.getChild("seekBar");t&&t.handleMouseMove(e)}enabled(){return this.enabled_}disable(){var e;this.children().forEach(e=>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())&&(e=this.getChild("seekBar"),this.player_.scrubbing(!1),e.videoWasPlaying)&&Kt(this.player_.play())}enable(){this.children().forEach(e=>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)}removeListenersAddedOnMousedownAndTouchstart(){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_)}handleMouseDown(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_)}handleMouseUp(e){var t=this.getChild("seekBar");t&&t.handleMouseUp(e),this.removeListenersAddedOnMousedownAndTouchstart()}}lr.prototype.options_={children:["seekBar"]},g.registerComponent("ProgressControl",lr);class dr extends s{constructor(e,t){super(e,t),this.setIcon("picture-in-picture-enter"),this.on(e,["enterpictureinpicture","leavepictureinpicture"],e=>this.handlePictureInPictureChange(e)),this.on(e,["disablepictureinpicturechanged","loadedmetadata"],e=>this.handlePictureInPictureEnabledChange(e)),this.on(e,["loadedmetadata","audioonlymodechange","audiopostermodechange"],()=>this.handlePictureInPictureAudioModeChange()),this.disable()}buildCSSClass(){return"vjs-picture-in-picture-control vjs-hidden "+super.buildCSSClass()}handlePictureInPictureAudioModeChange(){"audio"===this.player_.currentType().substring(0,5)||this.player_.audioPosterMode()||this.player_.audioOnlyMode()?(this.player_.isInPictureInPicture()&&this.player_.exitPictureInPicture(),this.hide()):this.show()}handlePictureInPictureEnabledChange(){document.pictureInPictureEnabled&&!1===this.player_.disablePictureInPicture()||this.player_.options_.enableDocumentPictureInPicture&&"documentPictureInPicture"in window?this.enable():this.disable()}handlePictureInPictureChange(e){this.player_.isInPictureInPicture()?(this.setIcon("picture-in-picture-exit"),this.controlText("Exit Picture-in-Picture")):(this.setIcon("picture-in-picture-enter"),this.controlText("Picture-in-Picture")),this.handlePictureInPictureEnabledChange()}handleClick(e){this.player_.isInPictureInPicture()?this.player_.exitPictureInPicture():this.player_.requestPictureInPicture()}show(){"function"==typeof document.exitPictureInPicture&&super.show()}}dr.prototype.controlText_="Picture-in-Picture",g.registerComponent("PictureInPictureToggle",dr);class hr extends s{constructor(e,t){super(e,t),this.setIcon("fullscreen-enter"),this.on(e,"fullscreenchange",e=>this.handleFullscreenChange(e)),!1===document[e.fsApi_.fullscreenEnabled]&&this.disable()}buildCSSClass(){return"vjs-fullscreen-control "+super.buildCSSClass()}handleFullscreenChange(e){this.player_.isFullscreen()?(this.controlText("Exit Fullscreen"),this.setIcon("fullscreen-exit")):(this.controlText("Fullscreen"),this.setIcon("fullscreen-enter"))}handleClick(e){this.player_.isFullscreen()?this.player_.exitFullscreen():this.player_.requestFullscreen()}}hr.prototype.controlText_="Fullscreen",g.registerComponent("FullscreenToggle",hr);class ur extends g{createEl(){var e=super.createEl("div",{className:"vjs-volume-level"});return this.setIcon("circle",e),e.appendChild(super.createEl("span",{className:"vjs-control-text"})),e}}g.registerComponent("VolumeLevel",ur);class cr extends g{constructor(e,t){super(e,t),this.update=vt(p(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})}update(t,i,s,e){if(!s){var s=je(this.el_),r=je(this.player_.el()),i=t.width*i;if(!r||!s)return;var n=t.left-r.left+i,i=t.width-i+(r.right-t.right);let e=s.width/2;ns.width&&(e=s.width),this.el_.style.right=`-${e}px`}this.write(e+"%")}write(e){xe(this.el_,e)}updateVolume(e,t,i,s,r){this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",()=>{this.update(e,t,i,s.toFixed(0)),r&&r()})}}g.registerComponent("VolumeLevelTooltip",cr);class pr extends g{constructor(e,t){super(e,t),this.update=vt(p(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t,i){var s=100*t;this.getChild("volumeLevelTooltip").updateVolume(e,t,i,s,()=>{i?this.el_.style.bottom=e.height*t+"px":this.el_.style.left=e.width*t+"px"})}}pr.prototype.options_={children:["volumeLevelTooltip"]},g.registerComponent("MouseVolumeLevelDisplay",pr);class mr extends tr{constructor(e,t){super(e,t),this.on("slideractive",e=>this.updateLastVolume_(e)),this.on(e,"volumechange",e=>this.updateARIAAttributes(e)),e.ready(()=>this.updateARIAAttributes())}createEl(){return super.createEl("div",{className:"vjs-volume-bar vjs-slider-bar"},{"aria-label":this.localize("Volume Level"),"aria-live":"polite"})}handleMouseDown(e){Ke(e)&&super.handleMouseDown(e)}handleMouseMove(e){var t,i,s,r=this.getChild("mouseVolumeLevelDisplay");r&&(t=je(s=this.el()),i=this.vertical(),s=Ve(s,e),s=er(s=i?s.y:s.x,0,1),r.update(t,s,i)),Ke(e)&&(this.checkMuted(),this.player_.volume(this.calculateDistance(e)))}checkMuted(){this.player_.muted()&&this.player_.muted(!1)}getPercent(){return this.player_.muted()?0:this.player_.volume()}stepForward(){this.checkMuted(),this.player_.volume(this.player_.volume()+.1)}stepBack(){this.checkMuted(),this.player_.volume(this.player_.volume()-.1)}updateARIAAttributes(e){var t=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",t),this.el_.setAttribute("aria-valuetext",t+"%")}volumeAsPercentage_(){return Math.round(100*this.player_.volume())}updateLastVolume_(){let e=this.player_.volume();this.one("sliderinactive",()=>{0===this.player_.volume()&&this.player_.lastVolume_(e)})}}mr.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"},u||se||mr.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay"),mr.prototype.playerEvent="volumechange",g.registerComponent("VolumeBar",mr);class gr extends g{constructor(e,t={}){var i,s;t.vertical=t.vertical||!1,"undefined"!=typeof t.volumeBar&&!Q(t.volumeBar)||(t.volumeBar=t.volumeBar||{},t.volumeBar.vertical=t.vertical),super(e,t),i=this,(s=e).tech_&&!s.tech_.featuresVolumeControl&&i.addClass("vjs-hidden"),i.on(s,"loadstart",function(){s.tech_.featuresVolumeControl?i.removeClass("vjs-hidden"):i.addClass("vjs-hidden")}),this.throttledHandleMouseMove=vt(p(this,this.handleMouseMove),30),this.handleMouseUpHandler_=e=>this.handleMouseUp(e),this.on("mousedown",e=>this.handleMouseDown(e)),this.on("touchstart",e=>this.handleMouseDown(e)),this.on("mousemove",e=>this.handleMouseMove(e)),this.on(this.volumeBar,["focus","slideractive"],()=>{this.volumeBar.addClass("vjs-slider-active"),this.addClass("vjs-slider-active"),this.trigger("slideractive")}),this.on(this.volumeBar,["blur","sliderinactive"],()=>{this.volumeBar.removeClass("vjs-slider-active"),this.removeClass("vjs-slider-active"),this.trigger("sliderinactive")})}createEl(){let e="vjs-volume-horizontal";return this.options_.vertical&&(e="vjs-volume-vertical"),super.createEl("div",{className:"vjs-volume-control vjs-control "+e})}handleMouseDown(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_)}handleMouseUp(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_)}handleMouseMove(e){this.volumeBar.handleMouseMove(e)}}gr.prototype.options_={children:["volumeBar"]},g.registerComponent("VolumeControl",gr);class fr extends s{constructor(e,t){var i,s;super(e,t),i=this,(s=e).tech_&&!s.tech_.featuresMuteControl&&i.addClass("vjs-hidden"),i.on(s,"loadstart",function(){s.tech_.featuresMuteControl?i.removeClass("vjs-hidden"):i.addClass("vjs-hidden")}),this.on(e,["loadstart","volumechange"],e=>this.update(e))}buildCSSClass(){return"vjs-mute-control "+super.buildCSSClass()}handleClick(e){var t=this.player_.volume(),i=this.player_.lastVolume_();0===t?(this.player_.volume(i<.1?.1:i),this.player_.muted(!1)):this.player_.muted(!this.player_.muted())}update(e){this.updateIcon_(),this.updateControlText_()}updateIcon_(){var e=this.player_.volume();let t=3;this.setIcon("volume-high"),u&&this.player_.tech_&&this.player_.tech_.el_&&this.player_.muted(this.player_.tech_.el_.muted),0===e||this.player_.muted()?(this.setIcon("volume-mute"),t=0):e<.33?(this.setIcon("volume-low"),t=1):e<.67&&(this.setIcon("volume-medium"),t=2),Le(this.el_,[0,1,2,3].reduce((e,t)=>e+`${t?" ":""}vjs-vol-`+t,"")),Pe(this.el_,"vjs-vol-"+t)}updateControlText_(){var e=this.player_.muted()||0===this.player_.volume()?"Unmute":"Mute";this.controlText()!==e&&this.controlText(e)}}fr.prototype.controlText_="Mute",g.registerComponent("MuteToggle",fr);class yr extends g{constructor(e,t={}){"undefined"!=typeof t.inline?t.inline=t.inline:t.inline=!0,"undefined"!=typeof t.volumeControl&&!Q(t.volumeControl)||(t.volumeControl=t.volumeControl||{},t.volumeControl.vertical=!t.inline),super(e,t),this.handleKeyPressHandler_=e=>this.handleKeyPress(e),this.on(e,["loadstart"],e=>this.volumePanelState_(e)),this.on(this.muteToggle,"keyup",e=>this.handleKeyPress(e)),this.on(this.volumeControl,"keyup",e=>this.handleVolumeControlKeyUp(e)),this.on("keydown",e=>this.handleKeyPress(e)),this.on("mouseover",e=>this.handleMouseOver(e)),this.on("mouseout",e=>this.handleMouseOut(e)),this.on(this.volumeControl,["slideractive"],this.sliderActive_),this.on(this.volumeControl,["sliderinactive"],this.sliderInactive_)}sliderActive_(){this.addClass("vjs-slider-active")}sliderInactive_(){this.removeClass("vjs-slider-active")}volumePanelState_(){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")}createEl(){let e="vjs-volume-panel-horizontal";return this.options_.inline||(e="vjs-volume-panel-vertical"),super.createEl("div",{className:"vjs-volume-panel vjs-control "+e})}dispose(){this.handleMouseOut(),super.dispose()}handleVolumeControlKeyUp(e){"Escape"===e.key&&this.muteToggle.focus()}handleMouseOver(e){this.addClass("vjs-hover"),mt(document,"keyup",this.handleKeyPressHandler_)}handleMouseOut(e){this.removeClass("vjs-hover"),c(document,"keyup",this.handleKeyPressHandler_)}handleKeyPress(e){"Escape"===e.key&&this.handleMouseOut()}}yr.prototype.options_={children:["muteToggle","volumeControl"]},g.registerComponent("VolumePanel",yr);class _r extends s{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipForwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.setIcon("forward-"+this.skipTime),this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime.toLocaleString(e.language())])),this.show()):this.hide()}getSkipForwardTime(){var e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.forward}buildCSSClass(){return`vjs-skip-forward-${this.getSkipForwardTime()} `+super.buildCSSClass()}handleClick(e){if(!isNaN(this.player_.duration())){var t=this.player_.currentTime(),i=this.player_.liveTracker,i=i&&i.isLive()?i.seekableEnd():this.player_.duration();let e;e=t+this.skipTime<=i?t+this.skipTime:i,this.player_.currentTime(e)}}handleLanguagechange(){this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime]))}}_r.prototype.controlText_="Skip Forward",g.registerComponent("SkipForward",_r);class vr extends s{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipBackwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.setIcon("replay-"+this.skipTime),this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime.toLocaleString(e.language())])),this.show()):this.hide()}getSkipBackwardTime(){var e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.backward}buildCSSClass(){return`vjs-skip-backward-${this.getSkipBackwardTime()} `+super.buildCSSClass()}handleClick(e){var t=this.player_.currentTime(),i=this.player_.liveTracker,i=i&&i.isLive()&&i.seekableStart();let s;s=i&&t-this.skipTime<=i?i:t>=this.skipTime?t-this.skipTime:0,this.player_.currentTime(s)}handleLanguagechange(){this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime]))}}vr.prototype.controlText_="Skip Backward",g.registerComponent("SkipBackward",vr);class br extends g{constructor(e,t){super(e,t),t&&(this.menuButton_=t.menuButton),this.focusedChild_=-1,this.on("keydown",e=>this.handleKeyDown(e)),this.boundHandleBlur_=e=>this.handleBlur(e),this.boundHandleTapClick_=e=>this.handleTapClick(e)}addEventListenerForItem(e){e instanceof g&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))}removeEventListenerForItem(e){e instanceof g&&(this.off(e,"blur",this.boundHandleBlur_),this.off(e,["tap","click"],this.boundHandleTapClick_))}removeChild(e){"string"==typeof e&&(e=this.getChild(e)),this.removeEventListenerForItem(e),super.removeChild(e)}addItem(e){e=this.addChild(e);e&&this.addEventListenerForItem(e)}createEl(){var e=this.options_.contentElType||"ul",e=(this.contentEl_=l(e,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu"),super.createEl("div",{append:this.contentEl_,className:"vjs-menu"}));return e.appendChild(this.contentEl_),mt(e,"click",function(e){e.preventDefault(),e.stopImmediatePropagation()}),e}dispose(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,super.dispose()}handleBlur(e){let t=e.relatedTarget||document.activeElement;this.children().some(e=>e.el()===t)||(e=this.menuButton_)&&e.buttonPressed_&&t!==e.el().firstChild&&e.unpressButton()}handleTapClick(t){var e;this.menuButton_&&(this.menuButton_.unpressButton(),e=this.children(),Array.isArray(e))&&(e=e.filter(e=>e.el()===t.target)[0])&&"CaptionSettingsMenuItem"!==e.name()&&this.menuButton_.focus()}handleKeyDown(e){"ArrowLeft"===e.key||"ArrowDown"===e.key?(e.preventDefault(),e.stopPropagation(),this.stepForward()):"ArrowRight"!==e.key&&"ArrowUp"!==e.key||(e.preventDefault(),e.stopPropagation(),this.stepBack())}stepForward(){let e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_+1),this.focus(e)}stepBack(){let e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_-1),this.focus(e)}focus(e=0){var t=this.children().slice();t.length&&t[0].hasClass("vjs-menu-title")&&t.shift(),0this.handleClick(e);this.handleMenuKeyUp_=e=>this.handleMenuKeyUp(e),this.on(this.menuButton_,"tap",t),this.on(this.menuButton_,"click",t),this.on(this.menuButton_,"keydown",e=>this.handleKeyDown(e)),this.on(this.menuButton_,"mouseenter",()=>{this.addClass("vjs-hover"),this.menu.show(),mt(document,"keyup",this.handleMenuKeyUp_)}),this.on("mouseleave",e=>this.handleMouseLeave(e)),this.on("keydown",e=>this.handleSubmenuKeyDown(e))}update(){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"))}createMenu(){var e,t=new br(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title&&(e=l("li",{className:"vjs-menu-title",textContent:m(this.options_.title),tabIndex:-1}),e=new g(this.player_,{el:e}),t.addItem(e)),this.items=this.createItems(),this.items)for(let e=0;e{this.handleTracksChange.apply(this,e)}),n=(...e)=>{this.handleSelectedLanguageChange.apply(this,e)};if(e.on(["loadstart","texttrackchange"],r),s.addEventListener("change",r),s.addEventListener("selectedlanguagechange",n),this.on("dispose",function(){e.off(["loadstart","texttrackchange"],r),s.removeEventListener("change",r),s.removeEventListener("selectedlanguagechange",n)}),void 0===s.onchange){let e;this.on(["tap","click"],function(){if("object"!=typeof window.Event)try{e=new window.Event("change")}catch(e){}e||(e=document.createEvent("Event")).initEvent("change",!0,!0),s.dispatchEvent(e)})}this.handleTracksChange()}handleClick(e){var t=this.track,i=this.player_.textTracks();if(super.handleClick(e),i)for(let e=0;e{this.items.forEach(e=>{e.selected(this.track_.activeCues[0]===e.cue)})}}buildCSSClass(){return"vjs-chapters-button "+super.buildCSSClass()}buildWrapperCSSClass(){return"vjs-chapters-button "+super.buildWrapperCSSClass()}update(e){e&&e.track&&"chapters"!==e.track.kind||((e=this.findChaptersTrack())!==this.track_?(this.setTrack(e),super.update()):(!this.items||e&&e.cues&&e.cues.length!==this.items.length)&&super.update())}setTrack(e){var t;this.track_!==e&&(this.updateHandler_||(this.updateHandler_=this.update.bind(this)),this.track_&&((t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_))&&t.removeEventListener("load",this.updateHandler_),this.track_.removeEventListener("cuechange",this.selectCurrentItem_),this.track_=null),this.track_=e,this.track_)&&(this.track_.mode="hidden",(t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_))&&t.addEventListener("load",this.updateHandler_),this.track_.addEventListener("cuechange",this.selectCurrentItem_))}findChaptersTrack(){var t=this.player_.textTracks()||[];for(let e=t.length-1;0<=e;e--){var i=t[e];if(i.kind===this.kind_)return i}}getMenuCaption(){return this.track_&&this.track_.label?this.track_.label:this.localize(m(this.kind_))}createMenu(){return this.options_.title=this.getMenuCaption(),super.createMenu()}createItems(){var i=[];if(this.track_){var s=this.track_.cues;if(s)for(let e=0,t=s.length;e{this.handleTracksChange.apply(this,e)});s.addEventListener("change",r),this.on("dispose",()=>{s.removeEventListener("change",r)})}createEl(e,t,i){e=super.createEl(e,t,i),t=e.querySelector(".vjs-menu-item-text");return 0<=["main-desc","descriptions"].indexOf(this.options_.track.kind)&&(t.appendChild(l("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),t.appendChild(l("span",{className:"vjs-control-text",textContent:" "+this.localize("Descriptions")}))),e}handleClick(e){if(super.handleClick(e),this.track.enabled=!0,this.player_.tech_.featuresNativeAudioTracks){var t=this.player_.audioTracks();for(let e=0;ethis.update(e))}handleClick(e){super.handleClick(),this.player().playbackRate(this.rate)}update(e){this.selected(this.player().playbackRate()===this.rate)}}Ur.prototype.contentElType="button",g.registerComponent("PlaybackRateMenuItem",Ur);class Br extends Tr{constructor(e,t){super(e,t),this.menuButton_.el_.setAttribute("aria-describedby",this.labelElId_),this.updateVisibility(),this.updateLabel(),this.on(e,"loadstart",e=>this.updateVisibility(e)),this.on(e,"ratechange",e=>this.updateLabel(e)),this.on(e,"playbackrateschange",e=>this.handlePlaybackRateschange(e))}createEl(){var e=super.createEl();return this.labelElId_="vjs-playback-rate-value-label-"+this.id_,this.labelEl_=l("div",{className:"vjs-playback-rate-value",id:this.labelElId_,textContent:"1x"}),e.appendChild(this.labelEl_),e}dispose(){this.labelEl_=null,super.dispose()}buildCSSClass(){return"vjs-playback-rate "+super.buildCSSClass()}buildWrapperCSSClass(){return"vjs-playback-rate "+super.buildWrapperCSSClass()}createItems(){var t=this.playbackRates(),i=[];for(let e=t.length-1;0<=e;e--)i.push(new Ur(this.player(),{rate:t[e]+"x"}));return i}handlePlaybackRateschange(e){this.update()}playbackRates(){var e=this.player();return e.playbackRates&&e.playbackRates()||[]}playbackRateSupported(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&0{this.open(e)})}buildCSSClass(){return"vjs-error-display "+super.buildCSSClass()}content(){var e=this.player().error();return e?this.localize(e.message):""}}Hr.prototype.options_=Object.assign({},ti.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0}),g.registerComponent("ErrorDisplay",Hr);class Vr extends g{constructor(e,t={}){super(e,t),this.el_.setAttribute("aria-labelledby",this.selectLabelledbyIds)}createEl(){return this.selectLabelledbyIds=[this.options_.legendId,this.options_.labelId].join(" ").trim(),l("select",{id:this.options_.id},{},this.options_.SelectOptions.map(e=>{var t=(this.options_.labelId||"vjs-track-option-"+lt++)+"-"+e[1].replace(/\W+/g,""),e=l("option",{id:t,value:this.localize(e[0]),textContent:e[1]});return e.setAttribute("aria-labelledby",this.selectLabelledbyIds+" "+t),e}))}}g.registerComponent("TextTrackSelect",Vr);class zr extends g{constructor(t,e={}){super(t,e);var i,e=l("legend",{textContent:this.localize(this.options_.legendText),id:this.options_.legendId}),e=(this.el().appendChild(e),this.options_.selects);for(i of e){var s=this.options_.selectConfigs[i],r=s.className,n=s.id.replace("%s",this.options_.id_);let e=null;var a="vjs_select_"+lt++,r=("colors"===this.options_.type&&(e=l("span",{className:r}),(r=l("label",{id:n,className:"vjs-label",textContent:s.label})).setAttribute("for",a),e.appendChild(r)),new Vr(t,{SelectOptions:s.options,legendId:this.options_.legendId,id:a,labelId:n}));this.addChild(r),"colors"===this.options_.type&&(e.appendChild(r.el()),this.el().appendChild(e))}}createEl(){return l("fieldset",{className:this.options_.className})}}g.registerComponent("TextTrackFieldset",zr);class $r extends g{constructor(e,t={}){super(e,t);var t=this.options_.textTrackComponentid,i=new zr(e,{id_:t,legendId:"captions-text-legend-"+t,legendText:this.localize("Text"),className:"vjs-fg vjs-track-setting",selects:this.options_.fieldSets[0],selectConfigs:this.options_.selectConfigs,type:"colors"}),i=(this.addChild(i),new zr(e,{id_:t,legendId:"captions-background-"+t,legendText:this.localize("Text Background"),className:"vjs-bg vjs-track-setting",selects:this.options_.fieldSets[1],selectConfigs:this.options_.selectConfigs,type:"colors"})),i=(this.addChild(i),new zr(e,{id_:t,legendId:"captions-window-"+t,legendText:this.localize("Caption Area Background"),className:"vjs-window vjs-track-setting",selects:this.options_.fieldSets[2],selectConfigs:this.options_.selectConfigs,type:"colors"}));this.addChild(i)}createEl(){return l("div",{className:"vjs-track-settings-colors"})}}g.registerComponent("TextTrackSettingsColors",$r);class Wr extends g{constructor(e,t={}){super(e,t);var t=this.options_.textTrackComponentid,i=new zr(e,{id_:t,legendId:"captions-font-size-"+t,legendText:"Font Size",className:"vjs-font-percent vjs-track-setting",selects:this.options_.fieldSets[0],selectConfigs:this.options_.selectConfigs,type:"font"}),i=(this.addChild(i),new zr(e,{id_:t,legendId:"captions-edge-style-"+t,legendText:this.localize("Text Edge Style"),className:"vjs-edge-style vjs-track-setting",selects:this.options_.fieldSets[1],selectConfigs:this.options_.selectConfigs,type:"font"})),i=(this.addChild(i),new zr(e,{id_:t,legendId:"captions-font-family-"+t,legendText:this.localize("Font Family"),className:"vjs-font-family vjs-track-setting",selects:this.options_.fieldSets[2],selectConfigs:this.options_.selectConfigs,type:"font"}));this.addChild(i)}createEl(){return l("div",{className:"vjs-track-settings-font"})}}g.registerComponent("TextTrackSettingsFont",Wr);class Gr extends g{constructor(e,t={}){super(e,t);var t=this.localize("restore all settings to the default values"),i=new s(e,{controlText:t,className:"vjs-default-button"}),i=(i.el().classList.remove("vjs-control","vjs-button"),i.el().textContent=this.localize("Reset"),this.addChild(i),new s(e,{controlText:t,className:"vjs-done-button"}));i.el().classList.remove("vjs-control","vjs-button"),i.el().textContent=this.localize("Done"),this.addChild(i)}createEl(){return l("div",{className:"vjs-track-settings-controls"})}}g.registerComponent("TrackSettingsControls",Gr);let Xr="vjs-text-track-settings";var e=["#000","Black"],Ii=["#00F","Blue"],Kr=["#0FF","Cyan"],Yr=["#0F0","Green"],r=["#F0F","Magenta"],Qr=["#F00","Red"],Jr=["#FFF","White"],n=["#FF0","Yellow"],Zr=["1","Opaque"],en=["0.5","Semi-Transparent"],tn=["0","Transparent"];let sn={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[e,Jr,Qr,Yr,Ii,n,r,Kr],className:"vjs-bg-color"},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Opacity",options:[Zr,en,tn],className:"vjs-bg-opacity vjs-opacity"},color:{selector:".vjs-text-color > select",id:"captions-foreground-color-%s",label:"Color",options:[Jr,e,Qr,Yr,Ii,n,r,Kr],className:"vjs-text-color"},edgeStyle:{selector:".vjs-edge-style > select",id:"",label:"Text Edge Style",options:[["none","None"],["raised","Raised"],["depressed","Depressed"],["uniform","Uniform"],["dropshadow","Drop shadow"]]},fontFamily:{selector:".vjs-font-family > select",id:"",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:"",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:e=>"1.00"===e?null:Number(e)},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Opacity",options:[Zr,en],className:"vjs-text-opacity vjs-opacity"},windowColor:{selector:".vjs-window-color > select",id:"captions-window-color-%s",label:"Color",className:"vjs-window-color"},windowOpacity:{selector:".vjs-window-opacity > select",id:"captions-window-opacity-%s",label:"Opacity",options:[tn,en,Zr],className:"vjs-window-opacity vjs-opacity"}};function rn(e,t){if((e=t?t(e):e)&&"none"!==e)return e}sn.windowColor.options=sn.backgroundColor.options;class nn extends ti{constructor(e,t){t.temporary=!1,super(e,t),this.updateDisplay=this.updateDisplay.bind(this),this.fill(),this.hasBeenOpened_=this.hasBeenFilled_=!0,this.renderModalComponents(e),this.endDialog=l("p",{className:"vjs-control-text",textContent:this.localize("End of dialog window.")}),this.el().appendChild(this.endDialog),this.setDefaults(),void 0===t.persistTextTrackSettings&&(this.options_.persistTextTrackSettings=this.options_.playerOptions.persistTextTrackSettings),this.bindFunctionsToSelectsAndButtons(),this.options_.persistTextTrackSettings&&this.restoreSettings()}renderModalComponents(e){var t=new $r(e,{textTrackComponentid:this.id_,selectConfigs:sn,fieldSets:[["color","textOpacity"],["backgroundColor","backgroundOpacity"],["windowColor","windowOpacity"]]}),t=(this.addChild(t),new Wr(e,{textTrackComponentid:this.id_,selectConfigs:sn,fieldSets:[["fontPercent"],["edgeStyle"],["fontFamily"]]})),t=(this.addChild(t),new Gr(e));this.addChild(t)}bindFunctionsToSelectsAndButtons(){this.on(this.$(".vjs-done-button"),["click","tap"],()=>{this.saveSettings(),this.close()}),this.on(this.$(".vjs-default-button"),["click","tap"],()=>{this.setDefaults(),this.updateDisplay()}),X(sn,e=>{this.on(this.$(e.selector),"change",this.updateDisplay)})}dispose(){this.endDialog=null,super.dispose()}label(){return this.localize("Caption Settings Dialog")}description(){return this.localize("Beginning of dialog window. Escape will cancel and close the window.")}buildCSSClass(){return super.buildCSSClass()+" vjs-text-track-settings"}getValues(){return K(sn,(e,t,i)=>{s=this.$(t.selector),t=t.parser;var s=rn(s.options[s.options.selectedIndex].value,t);return void 0!==s&&(e[i]=s),e},{})}setValues(n){X(sn,(e,t)=>{var i=this.$(e.selector),s=n[t],r=e.parser;if(s)for(let e=0;e{var t=e.hasOwnProperty("default")?e.default:0;this.$(e.selector).selectedIndex=t})}restoreSettings(){let e;try{e=JSON.parse(window.localStorage.getItem(Xr))}catch(e){o.warn(e)}e&&this.setValues(e)}saveSettings(){if(this.options_.persistTextTrackSettings){var e=this.getValues();try{Object.keys(e).length?window.localStorage.setItem(Xr,JSON.stringify(e)):window.localStorage.removeItem(Xr)}catch(e){o.warn(e)}}}updateDisplay(){var e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()}handleLanguagechange(){this.fill(),this.renderModalComponents(this.player_),this.bindFunctionsToSelectsAndButtons()}}g.registerComponent("TextTrackSettings",nn);class an extends g{constructor(e,t){let i=t.ResizeObserver||window.ResizeObserver;super(e,d({createEl:!(i=null===t.ResizeObserver?!1:i),reportTouchActivity:!1},t)),this.ResizeObserver=t.ResizeObserver||window.ResizeObserver,this.loadListener_=null,this.resizeObserver_=null,this.debouncedHandler_=bt(()=>{this.resizeHandler()},100,!1,this),i?(this.resizeObserver_=new this.ResizeObserver(this.debouncedHandler_),this.resizeObserver_.observe(e.el())):(this.loadListener_=()=>{if(this.el_&&this.el_.contentWindow){let e=this.debouncedHandler_,t=this.unloadListener_=function(){c(this,"resize",e),c(this,"unload",t),t=null};mt(this.el_.contentWindow,"unload",t),mt(this.el_.contentWindow,"resize",e)}},this.one("load",this.loadListener_))}createEl(){return super.createEl("iframe",{className:"vjs-resize-manager",tabIndex:-1,title:this.localize("No content")},{"aria-hidden":"true"})}resizeHandler(){this.player_&&this.player_.trigger&&this.player_.trigger("playerresize")}dispose(){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,super.dispose()}}g.registerComponent("ResizeManager",an);let on={trackingThreshold:20,liveTolerance:15};class ln extends g{constructor(e,t){super(e,d(on,t,{createEl:!1})),this.trackLiveHandler_=()=>this.trackLive_(),this.handlePlay_=e=>this.handlePlay(e),this.handleFirstTimeupdate_=e=>this.handleFirstTimeupdate(e),this.handleSeeked_=e=>this.handleSeeked(e),this.seekToLiveEdge_=e=>this.seekToLiveEdge(e),this.reset_(),this.on(this.player_,"durationchange",e=>this.handleDurationchange(e)),this.on(this.player_,"canplay",()=>this.toggleTracking())}trackLive_(){var t=this.player_.seekable();if(t&&t.length){var t=Number(window.performance.now().toFixed(4)),i=-1===this.lastTime_?0:(t-this.lastTime_)/1e3,t=(this.lastTime_=t,this.pastSeekEnd_=this.pastSeekEnd()+i,this.liveCurrentTime()),i=this.player_.currentTime();let e=this.player_.paused()||this.seekedBehindLive_||Math.abs(t-i)>this.options_.liveTolerance;(e=this.timeupdateSeen_&&t!==1/0?e:!1)!==this.behindLiveEdge_&&(this.behindLiveEdge_=e,this.trigger("liveedgechange"))}}handleDurationchange(){this.toggleTracking()}toggleTracking(){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())}startTracking(){this.isTracking()||(this.timeupdateSeen_||(this.timeupdateSeen_=this.player_.hasStarted()),this.trackingInterval_=this.setInterval(this.trackLiveHandler_,30),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_)))}handleFirstTimeupdate(){this.timeupdateSeen_=!0,this.on(this.player_,"seeked",this.handleSeeked_)}handleSeeked(){var e=Math.abs(this.liveCurrentTime()-this.player_.currentTime());this.seekedBehindLive_=this.nextSeekedFromUser_&&2this.updateDom_()),this.updateDom_()}createEl(){return this.els={title:l("div",{className:"vjs-title-bar-title",id:"vjs-title-bar-title-"+lt++}),description:l("div",{className:"vjs-title-bar-description",id:"vjs-title-bar-description-"+lt++})},l("div",{className:"vjs-title-bar"},{},J(this.els))}updateDom_(){var e=this.player_.tech_;let s=e&&e.el_,r={title:"aria-labelledby",description:"aria-describedby"};["title","description"].forEach(e=>{var t=this.state[e],i=this.els[e],e=r[e];$e(i),t&&xe(i,t),s&&(s.removeAttribute(e),t)&&s.setAttribute(e,i.id)}),this.state.title||this.state.description?this.show():this.hide()}update(e){this.setState(e)}dispose(){var e=this.player_.tech_,e=e&&e.el_;e&&(e.removeAttribute("aria-labelledby"),e.removeAttribute("aria-describedby")),super.dispose(),this.els=null}}g.registerComponent("TitleBar",dn);let hn={initialDisplay:4e3,position:[],takeFocus:!1};class un extends s{constructor(e,t){super(e,t=d(hn,t)),this.controlText(t.controlText),this.hide(),this.on(this.player_,["useractive","userinactive"],e=>{this.removeClass("force-display")})}buildCSSClass(){return"vjs-transient-button focus-visible "+this.options_.position.map(e=>"vjs-"+e).join(" ")}createEl(){var e=l("button",{},{type:"button",class:this.buildCSSClass()},l("span"));return this.controlTextEl_=e.querySelector("span"),e}show(){super.show(),this.addClass("force-display"),this.options_.takeFocus&&this.el().focus({preventScroll:!0}),this.forceDisplayTimeout=this.player_.setTimeout(()=>{this.removeClass("force-display")},this.options_.initialDisplay)}hide(){this.removeClass("force-display"),super.hide()}dispose(){this.player_.clearTimeout(this.forceDisplayTimeout),super.dispose()}}g.registerComponent("TransientButton",un);function cn(s){let r=s.el();if(!r.resetSourceWatch_){let t={},e=yn(s),i=t=>(...e)=>{e=t.apply(r,e);return mn(s),e};["append","appendChild","insertAdjacentHTML"].forEach(e=>{r[e]&&(t[e]=r[e],r[e]=i(t[e]))}),Object.defineProperty(r,"innerHTML",d(e,{set:i(e.set)})),r.resetSourceWatch_=()=>{r.resetSourceWatch_=null,Object.keys(t).forEach(e=>{r[e]=t[e]}),Object.defineProperty(r,"innerHTML",e)},s.one("sourceset",r.resetSourceWatch_)}}function pn(n){if(n.featuresSourceset){let r=n.el();if(!r.resetSourceset_){e=n;let t=fn([e.el(),window.HTMLMediaElement.prototype,_n],"src");var e;let i=r.setAttribute,s=r.load;Object.defineProperty(r,"src",d(t,{set:e=>{e=t.set.call(r,e);return n.triggerSourceset(r.src),e}})),r.setAttribute=(e,t)=>{t=i.call(r,e,t);return/src/i.test(e)&&n.triggerSourceset(r.src),t},r.load=()=>{var e=s.call(r);return mn(n)||(n.triggerSourceset(""),cn(n)),e},r.currentSrc?n.triggerSourceset(r.currentSrc):mn(n)||cn(n),r.resetSourceset_=()=>{r.resetSourceset_=null,r.load=s,r.setAttribute=i,Object.defineProperty(r,"src",t),r.resetSourceWatch_&&r.resetSourceWatch_()}}}}let mn=t=>{var e=t.el();if(e.hasAttribute("src"))t.triggerSourceset(e.src);else{var i=t.$$("source"),s=[];let e="";if(!i.length)return!1;for(let e=0;e{let s={};for(let e=0;efn([e.el(),window.HTMLMediaElement.prototype,window.Element.prototype,gn],"innerHTML"),_n=Object.defineProperty({},"src",{get(){return this.hasAttribute("src")?gi(window.Element.prototype.getAttribute.call(this,"src")):""},set(e){return window.Element.prototype.setAttribute.call(this,"src",e),e}});class b extends v{constructor(e,t){super(e,t);t=e.source;let i=!1;if(this.featuresVideoFrameCallback=this.featuresVideoFrameCallback&&"VIDEO"===this.el_.tagName,t&&(this.el_.currentSrc!==t.src||e.tag&&3===e.tag.initNetworkState_)?this.setSource(t):this.handleLateInit_(this.el_),e.enableSourceset&&this.setupSourcesetHandling_(),this.isScrubbing_=!1,this.el_.hasChildNodes()){var s=this.el_.childNodes;let e=s.length;for(var r=[];e--;){var n=s[e];"track"===n.nodeName.toLowerCase()&&(this.featuresNativeTextTracks?(this.remoteTextTrackEls().addTrackElement_(n),this.remoteTextTracks().addTrack(n.track),this.textTracks().addTrack(n.track),i||this.el_.hasAttribute("crossorigin")||!fi(n.src)||(i=!0)):r.push(n))}for(let e=0;e{s=[];for(let e=0;ei.removeEventListener("change",e)),()=>{for(let e=0;e{i.removeEventListener("change",e),i.removeEventListener("change",r),i.addEventListener("change",r)}),this.on("webkitendfullscreen",()=>{i.removeEventListener("change",e),i.addEventListener("change",e),i.removeEventListener("change",r)})}overrideNative_(e,i){if(i===this[`featuresNative${e}Tracks`]){let t=e.toLowerCase();this[t+"TracksListeners_"]&&Object.keys(this[t+"TracksListeners_"]).forEach(e=>{this.el()[t+"Tracks"].removeEventListener(e,this[t+"TracksListeners_"][e])}),this[`featuresNative${e}Tracks`]=!i,this[t+"TracksListeners_"]=null,this.proxyNativeTracksForType_(t)}}overrideNativeAudioTracks(e){this.overrideNative_("Audio",e)}overrideNativeVideoTracks(e){this.overrideNative_("Video",e)}proxyNativeTracksForType_(i){var s=Hi[i];let r=this.el()[s.getterName],n=this[s.getterName]();if(this[`featuresNative${s.capitalName}Tracks`]&&r&&r.addEventListener){let e={change:e=>{var t={type:"change",target:n,currentTarget:n,srcElement:n};n.trigger(t),"text"===i&&this[Vi.remoteText.getterName]().trigger(t)},addtrack(e){n.addTrack(e.track)},removetrack(e){n.removeTrack(e.track)}},t=function(){var e=[];for(let i=0;i{let i=e[t];r.addEventListener(t,i),this.on("dispose",e=>r.removeEventListener(t,i))}),this.on("loadstart",t),this.on("dispose",e=>this.off("loadstart",t))}}proxyNativeTracks_(){Hi.names.forEach(e=>{this.proxyNativeTracksForType_(e)})}createEl(){let t=this.options_.tag;t&&(this.options_.playerElIngest||this.movingMediaElementInDOM)||(t?(e=t.cloneNode(!0),t.parentNode&&t.parentNode.insertBefore(e,t),b.disposeMediaElement(t),t=e):(t=document.createElement("video"),e=d({},this.options_.tag&&Ne(this.options_.tag)),ve&&!0===this.options_.nativeControlsForTouch||delete e.controls,Re(t,Object.assign(e,{id:this.options_.techId,class:"vjs-tech"}))),t.playerId=this.options_.playerId),"undefined"!=typeof this.options_.preload&&Ue(t,"preload",this.options_.preload),void 0!==this.options_.disablePictureInPicture&&(t.disablePictureInPicture=this.options_.disablePictureInPicture);var e,i=["loop","muted","playsinline","autoplay"];for(let e=0;e{0{this.off("webkitbeginfullscreen",t),this.off("webkitendfullscreen",e)})}}supportsFullScreen(){return"function"==typeof this.el_.webkitEnterFullScreen}enterFullScreen(){let e=this.el_;if(e.paused&&e.networkState<=e.HAVE_METADATA)Kt(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)}}exitFullScreen(){this.el_.webkitDisplayingFullscreen?this.el_.webkitExitFullScreen():this.trigger("fullscreenerror",new Error("The video is not fullscreen"))}requestPictureInPicture(){return this.el_.requestPictureInPicture()}requestVideoFrameCallback(e){return this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.requestVideoFrameCallback(e):super.requestVideoFrameCallback(e)}cancelVideoFrameCallback(e){this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.cancelVideoFrameCallback(e):super.cancelVideoFrameCallback(e)}src(e){if(void 0===e)return this.el_.src;this.setSrc(e)}addSourceElement(e,t){return e?(e={src:e},t&&(e.type=t),t=l("source",{},e),this.el_.appendChild(t),!0):(o.error("Invalid source URL."),!1)}removeSourceElement(e){if(e){var t;for(t of this.el_.querySelectorAll("source"))if(t.src===e)return this.el_.removeChild(t),!0;o.warn("No matching source element found with src: "+e)}else o.error("Source URL is required to remove the source element.");return!1}reset(){b.resetMediaElement(this.el_)}currentSrc(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc}setControls(e){this.el_.controls=!!e}addTextTrack(e,t,i){return this.featuresNativeTextTracks?this.el_.addTextTrack(e,t,i):super.addTextTrack(e,t,i)}createRemoteTextTrack(e){var t;return this.featuresNativeTextTracks?(t=document.createElement("track"),e.kind&&(t.kind=e.kind),e.label&&(t.label=e.label),(e.language||e.srclang)&&(t.srclang=e.language||e.srclang),e.default&&(t.default=e.default),e.id&&(t.id=e.id),e.src&&(t.src=e.src),t):super.createRemoteTextTrack(e)}addRemoteTextTrack(e,t){e=super.addRemoteTextTrack(e,t);return this.featuresNativeTextTracks&&this.el().appendChild(e),e}removeRemoteTextTrack(t){if(super.removeRemoteTextTrack(t),this.featuresNativeTextTracks){var i=this.$$("track");let e=i.length;for(;e--;)t!==i[e]&&t!==i[e].track||this.el().removeChild(i[e])}}getVideoPlaybackQuality(){var e;return"function"==typeof this.el().getVideoPlaybackQuality?this.el().getVideoPlaybackQuality():(e={},"undefined"!=typeof this.el().webkitDroppedFrameCount&&"undefined"!=typeof this.el().webkitDecodedFrameCount&&(e.droppedVideoFrames=this.el().webkitDroppedFrameCount,e.totalVideoFrames=this.el().webkitDecodedFrameCount),window.performance&&(e.creationTime=window.performance.now()),e)}}Z(b,"TEST_VID",function(){var e,t;if(Ee())return e=document.createElement("video"),(t=document.createElement("track")).kind="captions",t.srclang="en",t.label="English",e.appendChild(t),e}),b.isSupported=function(){try{b.TEST_VID.volume=.5}catch(e){return!1}return!(!b.TEST_VID||!b.TEST_VID.canPlayType)},b.canPlayType=function(e){return b.TEST_VID.canPlayType(e)},b.canPlaySource=function(e,t){return b.canPlayType(e.type)},b.canControlVolume=function(){try{let e=b.TEST_VID.volume;b.TEST_VID.volume=e/2+.1;var t=e!==b.TEST_VID.volume;return t&&u?(window.setTimeout(()=>{b&&b.prototype&&(b.prototype.featuresVolumeControl=e!==b.TEST_VID.volume)}),!1):t}catch(e){return!1}},b.canMuteVolume=function(){try{var e=b.TEST_VID.muted;return b.TEST_VID.muted=!e,b.TEST_VID.muted?Ue(b.TEST_VID,"muted","muted"):Be(b.TEST_VID,"muted"),e!==b.TEST_VID.muted}catch(e){return!1}},b.canControlPlaybackRate=function(){if(se&&le&&he<58)return!1;try{var e=b.TEST_VID.playbackRate;return b.TEST_VID.playbackRate=e/2+.1,e!==b.TEST_VID.playbackRate}catch(e){return!1}},b.canOverrideAttributes=function(){try{var e=()=>{};Object.defineProperty(document.createElement("video"),"src",{get:e,set:e}),Object.defineProperty(document.createElement("audio"),"src",{get:e,set:e}),Object.defineProperty(document.createElement("video"),"innerHTML",{get:e,set:e}),Object.defineProperty(document.createElement("audio"),"innerHTML",{get:e,set:e})}catch(e){return!1}return!0},b.supportsNativeTextTracks=function(){return Te||u&&le},b.supportsNativeVideoTracks=function(){return!(!b.TEST_VID||!b.TEST_VID.videoTracks)},b.supportsNativeAudioTracks=function(){return!(!b.TEST_VID||!b.TEST_VID.audioTracks)},b.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,t]){Z(b.prototype,e,()=>b[t](),!0)}),b.prototype.featuresVolumeControl=b.canControlVolume(),b.prototype.movingMediaElementInDOM=!u,b.prototype.featuresFullscreenResize=!0,b.prototype.featuresProgressEvents=!0,b.prototype.featuresTimeupdateEvents=!0,b.prototype.featuresVideoFrameCallback=!(!b.TEST_VID||!b.TEST_VID.requestVideoFrameCallback),b.disposeMediaElement=function(e){if(e){for(e.parentNode&&e.parentNode.removeChild(e);e.hasChildNodes();)e.removeChild(e.firstChild);if(e.removeAttribute("src"),"function"==typeof e.load)try{e.load()}catch(e){}}},b.resetMediaElement=function(t){if(t){var i=t.querySelectorAll("source");let e=i.length;for(;e--;)t.removeChild(i[e]);if(t.removeAttribute("src"),"function"==typeof t.load)try{t.load()}catch(e){}}},["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach(function(e){b.prototype[e]=function(){return this.el_[e]||this.el_.hasAttribute(e)}}),["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(t){b.prototype["set"+m(t)]=function(e){(this.el_[t]=e)?this.el_.setAttribute(t,t):this.el_.removeAttribute(t)}}),["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","disablePictureInPicture","played","networkState","readyState","videoWidth","videoHeight","crossOrigin"].forEach(function(e){b.prototype[e]=function(){return this.el_[e]}}),["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach(function(t){b.prototype["set"+m(t)]=function(e){this.el_[t]=e}}),["pause","load","play"].forEach(function(e){b.prototype[e]=function(){return this.el_[e]()}}),v.withSourceHandlers(b),b.nativeSourceHandler={},b.nativeSourceHandler.canPlayType=function(e){try{return b.TEST_VID.canPlayType(e)}catch(e){return""}},b.nativeSourceHandler.canHandleSource=function(e,t){return e.type?b.nativeSourceHandler.canPlayType(e.type):e.src?(e=yi(e.src),b.nativeSourceHandler.canPlayType("video/"+e)):""},b.nativeSourceHandler.handleSource=function(e,t,i){t.setSrc(e.src)},b.nativeSourceHandler.dispose=function(){},b.registerSourceHandler(b.nativeSourceHandler),v.registerTech("Html5",b);let vn=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],bn={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},Tn=["tiny","xsmall","small","medium","large","xlarge","huge"],Sn={},wn=(Tn.forEach(e=>{var t="x"===e.charAt(0)?"x-"+e.substring(1):e;Sn[e]="vjs-layout-"+t}),{tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0});class T extends g{constructor(e,i,t){if(e.id=e.id||i.id||"vjs_video_"+lt++,(i=Object.assign(T.getTagSettings(e),i)).initChildren=!1,i.createEl=!1,i.evented=!1,i.reportTouchActivity=!1,i.language||(s=e.closest("[lang]"))&&(i.language=s.getAttribute("lang")),super(null,i,t),this.boundDocumentFullscreenChange_=e=>this.documentFullscreenChange_(e),this.boundFullWindowOnEscKey_=e=>this.fullWindowOnEscKey(e),this.boundUpdateStyleEl_=e=>this.updateStyleEl_(e),this.boundApplyInitTime_=e=>this.applyInitTime_(e),this.boundUpdateCurrentBreakpoint_=e=>this.updateCurrentBreakpoint_(e),this.boundHandleTechClick_=e=>this.handleTechClick_(e),this.boundHandleTechDoubleClick_=e=>this.handleTechDoubleClick_(e),this.boundHandleTechTouchStart_=e=>this.handleTechTouchStart_(e),this.boundHandleTechTouchMove_=e=>this.handleTechTouchMove_(e),this.boundHandleTechTouchEnd_=e=>this.handleTechTouchEnd_(e),this.boundHandleTechTap_=e=>this.handleTechTap_(e),this.boundUpdatePlayerHeightOnAudioOnlyMode_=e=>this.updatePlayerHeightOnAudioOnlyMode_(e),this.isFullscreen_=!1,this.log=W(this.id_),this.fsApi_=q,this.isPosterFromTech_=!1,this.queuedCallbacks_=[],this.isReady_=!1,this.hasStarted_=!1,this.userActive_=!1,this.debugEnabled_=!1,this.audioOnlyMode_=!1,this.audioPosterMode_=!1,this.audioOnlyCache_={controlBarHeight:null,playerHeight:null,hiddenChildren:[]},!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?");if(this.tag=e,this.tagAttributes=e&&Ne(e),this.language(this.options_.language),i.languages){let t={};Object.getOwnPropertyNames(i.languages).forEach(function(e){t[e.toLowerCase()]=i.languages[e]}),this.languages_=t}else this.languages_=T.prototype.options_.languages;this.resetCache_(),this.poster_=i.poster||"",this.controls_=!!i.controls,e.controls=!1,e.removeAttribute("controls"),this.changingSrc_=!1,this.playCallbacks_=[],this.playTerminatedQueue_=[],e.hasAttribute("autoplay")?this.autoplay(!0):this.autoplay(this.options_.autoplay),i.plugins&&Object.keys(i.plugins).forEach(e=>{if("function"!=typeof this[e])throw new Error(`plugin "${e}" does not exist`)}),this.scrubbing_=!1,this.el_=this.createEl(),Ot(this,{eventBusKey:"el_"}),this.fsApi_.requestFullscreen&&(mt(document,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),this.on(this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_)),this.fluid_&&this.on(["playerreset","resize"],this.boundUpdateStyleEl_);var s=d(this.options_),t=(i.plugins&&Object.keys(i.plugins).forEach(e=>{this[e](i.plugins[e])}),i.debug&&this.debug(!0),this.options_.playerOptions=s,this.middleware_=[],this.playbackRates(i.playbackRates),i.experimentalSvgIcons&&((t=(new window.DOMParser).parseFromString('\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n',"image/svg+xml")).querySelector("parsererror")?(o.warn("Failed to load SVG Icons. Falling back to Font Icons."),this.options_.experimentalSvgIcons=null):((s=t.documentElement).style.display="none",this.el_.appendChild(s),this.addClass("vjs-svg-icons-enabled"))),this.initChildren(),this.isAudio("audio"===e.nodeName.toLowerCase()),this.controls()?this.addClass("vjs-controls-enabled"):this.addClass("vjs-controls-disabled"),this.el_.setAttribute("role","region"),this.isAudio()?this.el_.setAttribute("aria-label",this.localize("Audio Player")):this.el_.setAttribute("aria-label",this.localize("Video Player")),this.isAudio()&&this.addClass("vjs-audio"),i.spatialNavigation&&i.spatialNavigation.enabled&&(this.spatialNavigation=new Rs(this),this.addClass("vjs-spatial-navigation-enabled")),ve&&this.addClass("vjs-touch-enabled"),u||this.addClass("vjs-workinghover"),T.players[this.id_]=this,M.split(".")[0]);this.addClass("vjs-v"+t),this.userActive(!0),this.reportUserActivity(),this.one("play",e=>this.listenForUserActivity_(e)),this.on("keydown",e=>this.handleKeyDown(e)),this.on("languagechange",e=>this.handleLanguagechange(e)),this.breakpoints(this.options_.breakpoints),this.responsive(this.options_.responsive),this.on("ready",()=>{this.audioPosterMode(this.options_.audioPosterMode),this.audioOnlyMode(this.options_.audioOnlyMode)})}dispose(){var e;this.trigger("dispose"),this.off("dispose"),c(document,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),c(document,"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),e=this,bs.hasOwnProperty(e.id())&&delete bs[e.id()],a.names.forEach(e=>{e=this[a[e].getterName]();e&&e.off&&e.off()}),super.dispose({restoreEl:this.options_.restoreEl})}createEl(){let t=this.tag,i,e=this.playerElIngest_=t.parentNode&&t.parentNode.hasAttribute&&t.parentNode.hasAttribute("data-vjs-player"),s="video-js"===this.tag.tagName.toLowerCase(),r=(e?i=this.el_=t.parentNode:s||(i=this.el_=super.createEl("div")),Ne(t));if(s){for(i=this.el_=t,t=this.tag=document.createElement("video");i.children.length;)t.appendChild(i.firstChild);De(i,"video-js")||Pe(i,"video-js"),i.appendChild(t),e=this.playerElIngest_=i,Object.keys(i).forEach(e=>{try{t[e]=i[e]}catch(e){}})}t.setAttribute("tabindex","-1"),r.tabindex="-1",le&&pe&&(t.setAttribute("role","application"),r.role="application"),t.removeAttribute("width"),t.removeAttribute("height"),"width"in r&&delete r.width,"height"in r&&delete r.height,Object.getOwnPropertyNames(r).forEach(function(e){s&&"class"===e||i.setAttribute(e,r[e]),s&&t.setAttribute(e,r[e])}),t.playerId=t.id,t.id+="_html5_api",t.className="vjs-tech",(t.player=i.player=this).addClass("vjs-paused");var n,a=["IS_SMART_TV","IS_TIZEN","IS_WEBOS","IS_ANDROID","IS_IPAD","IS_IPHONE","IS_CHROMECAST_RECEIVER"].filter(e=>Se[e]).map(e=>"vjs-device-"+e.substring(3).toLowerCase().replace(/\_/g,"-")),o=(this.addClass(...a),!0!==window.VIDEOJS_NO_DYNAMIC_STYLE&&(this.styleEl_=at("vjs-styles-dimensions"),a=Ye(".vjs-styles-defaults"),(n=Ye("head")).insertBefore(this.styleEl_,a?a.nextSibling:n.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),t.getElementsByTagName("a"));for(let e=0;e{this.on(["playerreset","resize"],this.boundUpdateStyleEl_)},Ct(e)?t():(e.eventedCallbacks||(e.eventedCallbacks=[]),e.eventedCallbacks.push(t))):this.removeClass("vjs-fluid"),this.updateStyleEl_()}fill(e){if(void 0===e)return!!this.fill_;this.fill_=!!e,e?(this.addClass("vjs-fill"),this.fluid(!1)):this.removeClass("vjs-fill")}aspectRatio(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_()}updateStyleEl_(){if(!0===window.VIDEOJS_NO_DYNAMIC_STYLE){let e="number"==typeof this.width_?this.width_:this.options_.width,t="number"==typeof this.height_?this.height_:this.options_.height;var r=this.tech_&&this.tech_.el();void(r&&(0<=e&&(r.width=e),0<=t)&&(r.height=t))}else{let e,t,i,s;r=(i=void 0!==this.aspectRatio_&&"auto"!==this.aspectRatio_?this.aspectRatio_:0{e=a[e];n[e.getterName]=this[e.privateName]}),Object.assign(n,this.options_[i]),Object.assign(n,this.options_[s]),Object.assign(n,this.options_[e.toLowerCase()]),this.tag&&(n.tag=this.tag),t&&t.src===this.cache_.src&&0{this.on(this.tech_,t,e=>this[`handleTech${m(t)}_`](e))}),Object.keys(bn).forEach(t=>{this.on(this.tech_,t,e=>{0===this.tech_.playbackRate()&&this.tech_.seeking()?this.queuedCallbacks_.push({callback:this[`handleTech${bn[t]}_`].bind(this),event:e}):this[`handleTech${bn[t]}_`](e)})}),this.on(this.tech_,"loadstart",e=>this.handleTechLoadStart_(e)),this.on(this.tech_,"sourceset",e=>this.handleTechSourceset_(e)),this.on(this.tech_,"waiting",e=>this.handleTechWaiting_(e)),this.on(this.tech_,"ended",e=>this.handleTechEnded_(e)),this.on(this.tech_,"seeking",e=>this.handleTechSeeking_(e)),this.on(this.tech_,"play",e=>this.handleTechPlay_(e)),this.on(this.tech_,"pause",e=>this.handleTechPause_(e)),this.on(this.tech_,"durationchange",e=>this.handleTechDurationChange_(e)),this.on(this.tech_,"fullscreenchange",(e,t)=>this.handleTechFullscreenChange_(e,t)),this.on(this.tech_,"fullscreenerror",(e,t)=>this.handleTechFullscreenError_(e,t)),this.on(this.tech_,"enterpictureinpicture",e=>this.handleTechEnterPictureInPicture_(e)),this.on(this.tech_,"leavepictureinpicture",e=>this.handleTechLeavePictureInPicture_(e)),this.on(this.tech_,"error",e=>this.handleTechError_(e)),this.on(this.tech_,"posterchange",e=>this.handleTechPosterChange_(e)),this.on(this.tech_,"textdata",e=>this.handleTechTextData_(e)),this.on(this.tech_,"ratechange",e=>this.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"===i&&this.tag||Ae(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)}unloadTech_(){a.names.forEach(e=>{e=a[e];this[e.privateName]=this[e.getterName]()}),this.textTracksJson_=Jt(this.tech_),this.isReady_=!1,this.tech_.dispose(),this.tech_=!1,this.isPosterFromTech_&&(this.poster_="",this.trigger("posterchange")),this.isPosterFromTech_=!1}tech(e){return void 0===e&&o.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_}version(){return{"video.js":M}}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_)}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_)}handleTechReady_(){this.triggerReady(),this.cache_.volume&&this.techCall_("setVolume",this.cache_.volume),this.handleTechPosterChange_(),this.handleTechDurationChange_()}handleTechLoadStart_(){this.removeClass("vjs-ended","vjs-seeking"),this.error(null),this.handleTechDurationChange_(),this.paused()&&this.hasStarted(!1),this.trigger("loadstart"),this.manualAutoplay_(!0===this.autoplay()&&this.options_.normalizeAutoplay?"play":this.autoplay())}manualAutoplay_(t){if(this.tech_&&"string"==typeof t){var i=()=>{let e=this.muted(),t=(this.muted(!0),()=>{this.muted(e)});this.playTerminatedQueue_.push(t);var i=this.play();if(Xt(i))return i.catch(e=>{throw t(),new Error("Rejection at manualAutoplay. Restoring muted value. "+(e||""))})};let e;if("any"!==t||this.muted()?e="muted"!==t||this.muted()?this.play():i():Xt(e=this.play())&&(e=e.catch(i)),Xt(e))return e.then(()=>{this.trigger({type:"autoplay-success",autoplay:t})}).catch(()=>{this.trigger({type:"autoplay-failure",autoplay:t})})}}updateSourceCaches_(e=""){let 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=((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(e=>e.src===t);if(i.length)return i[0].type;var s=e.$$("source");for(let e=0;ee.src&&e.src===t),s=[],r=this.$$("source"),n=[];for(let e=0;ethis.updateSourceCaches_(e);var i=this.currentSource().src,s=t.src;(e=!i||/^blob:/.test(i)||!/^blob:/.test(s)||this.lastSource_&&(this.lastSource_.tech===s||this.lastSource_.player===i)?e:()=>{})(s),t.src||this.tech_.any(["sourceset","loadstart"],e=>{"sourceset"!==e.type&&(e=this.techGet_("currentSrc"),this.lastSource_.tech=e,this.updateSourceCaches_(e))})}this.lastSource_={player:this.currentSource().src,tech:t.src},this.trigger({src:t.src,type:"sourceset"})}hasStarted(e){if(void 0===e)return this.hasStarted_;e!==this.hasStarted_&&(this.hasStarted_=e,this.hasStarted_?this.addClass("vjs-has-started"):this.removeClass("vjs-has-started"))}handleTechPlay_(){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.hasStarted(!0),this.trigger("play")}handleTechRateChange_(){0e.callback(e.event)),this.queuedCallbacks_=[]),this.cache_.lastPlaybackRate=this.tech_.playbackRate(),this.trigger("ratechange")}handleTechWaiting_(){this.addClass("vjs-waiting"),this.trigger("waiting");let e=this.currentTime(),t=()=>{e!==this.currentTime()&&(this.removeClass("vjs-waiting"),this.off("timeupdate",t))};this.on("timeupdate",t)}handleTechCanPlay_(){this.removeClass("vjs-waiting"),this.trigger("canplay")}handleTechCanPlayThrough_(){this.removeClass("vjs-waiting"),this.trigger("canplaythrough")}handleTechPlaying_(){this.removeClass("vjs-waiting"),this.trigger("playing")}handleTechSeeking_(){this.addClass("vjs-seeking"),this.trigger("seeking")}handleTechSeeked_(){this.removeClass("vjs-seeking","vjs-ended"),this.trigger("seeked")}handleTechPause_(){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.trigger("pause")}handleTechEnded_(){this.addClass("vjs-ended"),this.removeClass("vjs-waiting"),this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause(),this.trigger("ended")}handleTechDurationChange_(){this.duration(this.techGet_("duration"))}handleTechClick_(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()?Kt(this.play()):this.pause())}handleTechDoubleClick_(t){!this.controls_||Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),e=>e.contains(t.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,t):this.isInPictureInPicture()&&!document.pictureInPictureElement?this.exitPictureInPicture():this.isFullscreen()?this.exitFullscreen():this.requestFullscreen())}handleTechTap_(){this.userActive(!this.userActive())}handleTechTouchStart_(){this.userWasActive=this.userActive()}handleTechTouchMove_(){this.userWasActive&&this.reportUserActivity()}handleTechTouchEnd_(e){e.cancelable&&e.preventDefault()}toggleFullscreenClass_(){this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen")}documentFullscreenChange_(t){t=t.target.player;if(!t||t===this){t=this.el();let e=document[this.fsApi_.fullscreenElement]===t;!e&&t.matches&&(e=t.matches(":"+this.fsApi_.fullscreen)),this.isFullscreen(e)}}handleTechFullscreenChange_(e,t){t&&(t.nativeIOSFullscreen&&(this.addClass("vjs-ios-native-fs"),this.tech_.one("webkitendfullscreen",()=>{this.removeClass("vjs-ios-native-fs")})),this.isFullscreen(t.isFullscreen))}handleTechFullscreenError_(e,t){this.trigger("fullscreenerror",t)}togglePictureInPictureClass_(){this.isInPictureInPicture()?this.addClass("vjs-picture-in-picture"):this.removeClass("vjs-picture-in-picture")}handleTechEnterPictureInPicture_(e){this.isInPictureInPicture(!0)}handleTechLeavePictureInPicture_(e){this.isInPictureInPicture(!1)}handleTechError_(){var e=this.tech_.error();e&&this.error(e)}handleTechTextData_(){let e=1{this.play_(e)})}play_(e=Kt){this.playCallbacks_.push(e);var t,e=Boolean(!this.changingSrc_&&(this.src()||this.currentSrc())),i=Boolean(Te||u);this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),this.isReady_&&e?(t=this.techGet_("play"),i&&this.hasClass("vjs-ended")&&this.resetProgressBar_(),null===t?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(t)):(this.waitToPlay_=e=>{this.play_()},this.one(["ready","loadstart"],this.waitToPlay_),!e&&i&&this.load())}runPlayTerminatedQueue_(){var e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],e.forEach(function(e){e()})}runPlayCallbacks_(t){var e=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],e.forEach(function(e){e(t)})}pause(){this.techCall_("pause")}paused(){return!1!==this.techGet_("paused")}played(){return this.techGet_("played")||jt(0,0)}scrubbing(e){if("undefined"==typeof e)return this.scrubbing_;this.scrubbing_=!!e,this.techCall_("setScrubbing",this.scrubbing_),e?this.addClass("vjs-scrubbing"):this.removeClass("vjs-scrubbing")}currentTime(e){if(void 0===e)return this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime;e<0&&(e=0),this.isReady_&&!this.changingSrc_&&this.tech_&&this.tech_.isReady_?(this.techCall_("setCurrentTime",e),this.cache_.initTime=0,isFinite(e)&&(this.cache_.currentTime=Number(e))):(this.cache_.initTime=e,this.off("canplay",this.boundApplyInitTime_),this.one("canplay",this.boundApplyInitTime_))}applyInitTime_(){this.currentTime(this.cache_.initTime)}duration(e){if(void 0===e)return void 0!==this.cache_.duration?this.cache_.duration:NaN;(e=(e=parseFloat(e))<0?1/0:e)!==this.cache_.duration&&((this.cache_.duration=e)===1/0?this.addClass("vjs-live"):this.removeClass("vjs-live"),isNaN(e)||this.trigger("durationchange"))}remainingTime(){return this.duration()-this.currentTime()}remainingTimeDisplay(){return Math.floor(this.duration())-Math.floor(this.currentTime())}buffered(){let e=this.techGet_("buffered");return e=e&&e.length?e:jt(0,0)}seekable(){let e=this.techGet_("seekable");return e=e&&e.length?e:jt(0,0)}seeking(){return this.techGet_("seeking")}ended(){return this.techGet_("ended")}networkState(){return this.techGet_("networkState")}readyState(){return this.techGet_("readyState")}bufferedPercent(){return Gt(this.buffered(),this.duration())}bufferedEnd(){var e=this.buffered(),t=this.duration();let i=e.end(e.length-1);return i=i>t?t:i}volume(e){let t;if(void 0===e)return t=parseFloat(this.techGet_("volume")),isNaN(t)?1:t;t=Math.max(0,Math.min(1,e)),this.cache_.volume=t,this.techCall_("setVolume",t),0{function s(){o.off("fullscreenerror",r),o.off("fullscreenchange",t)}function t(){s(),e()}function r(e,t){s(),i(t)}o.one("fullscreenchange",t),o.one("fullscreenerror",r);var n=o.requestFullscreenHelper_(a);n&&(n.then(s,s),n.then(e,i))})}requestFullscreenHelper_(e){let t;if(this.fsApi_.prefixed||(t=this.options_.fullscreen&&this.options_.fullscreen.options||{},void 0!==e&&(t=e)),this.fsApi_.requestFullscreen)return(e=this.el_[this.fsApi_.requestFullscreen](t))&&e.then(()=>this.isFullscreen(!0),()=>this.isFullscreen(!1)),e;this.tech_.supportsFullScreen()&&!0==!this.options_.preferFullWindow?this.techCall_("enterFullScreen"):this.enterFullWindow()}exitFullscreen(){let a=this;return new Promise((e,i)=>{function s(){a.off("fullscreenerror",r),a.off("fullscreenchange",t)}function t(){s(),e()}function r(e,t){s(),i(t)}a.one("fullscreenchange",t),a.one("fullscreenerror",r);var n=a.exitFullscreenHelper_();n&&(n.then(s,s),n.then(e,i))})}exitFullscreenHelper_(){var e;if(this.fsApi_.requestFullscreen)return(e=document[this.fsApi_.exitFullscreen]())&&Kt(e.then(()=>this.isFullscreen(!1))),e;this.tech_.supportsFullScreen()&&!0==!this.options_.preferFullWindow?this.techCall_("exitFullScreen"):this.exitFullWindow()}enterFullWindow(){this.isFullscreen(!0),this.isFullWindow=!0,this.docOrigOverflow=document.documentElement.style.overflow,mt(document,"keydown",this.boundFullWindowOnEscKey_),document.documentElement.style.overflow="hidden",Pe(document.body,"vjs-full-window"),this.trigger("enterFullWindow")}fullWindowOnEscKey(e){"Escape"===e.key&&!0===this.isFullscreen()&&(this.isFullWindow?this.exitFullWindow():this.exitFullscreen())}exitFullWindow(){this.isFullscreen(!1),this.isFullWindow=!1,c(document,"keydown",this.boundFullWindowOnEscKey_),document.documentElement.style.overflow=this.docOrigOverflow,Le(document.body,"vjs-full-window"),this.trigger("exitFullWindow")}disablePictureInPicture(e){if(void 0===e)return this.techGet_("disablePictureInPicture");this.techCall_("setDisablePictureInPicture",e),this.options_.disablePictureInPicture=e,this.trigger("disablepictureinpicturechanged")}isInPictureInPicture(e){if(void 0===e)return!!this.isInPictureInPicture_;this.isInPictureInPicture_=!!e,this.togglePictureInPictureClass_()}requestPictureInPicture(){if(this.options_.enableDocumentPictureInPicture&&window.documentPictureInPicture){let t=document.createElement(this.el().tagName);return t.classList=this.el().classList,t.classList.add("vjs-pip-container"),this.posterImage&&t.appendChild(this.posterImage.el().cloneNode(!0)),this.titleBar&&t.appendChild(this.titleBar.el().cloneNode(!0)),t.appendChild(l("p",{className:"vjs-pip-text"},{},this.localize("Playing in picture-in-picture"))),window.documentPictureInPicture.requestWindow({width:this.videoWidth(),height:this.videoHeight()}).then(e=>(Ze(e),this.el_.parentNode.insertBefore(t,this.el_),e.document.body.appendChild(this.el_),e.document.body.classList.add("vjs-pip-window"),this.player_.isInPictureInPicture(!0),this.player_.trigger({type:"enterpictureinpicture",pipWindow:e}),e.addEventListener("pagehide",e=>{e=e.target.querySelector(".video-js");t.parentNode.replaceChild(e,t),this.player_.isInPictureInPicture(!1),this.player_.trigger("leavepictureinpicture")}),e))}return"pictureInPictureEnabled"in document&&!1===this.disablePictureInPicture()?this.techGet_("requestPictureInPicture"):Promise.reject("No PiP mode is available")}exitPictureInPicture(){return window.documentPictureInPicture&&window.documentPictureInPicture.window?(window.documentPictureInPicture.window.close(),Promise.resolve()):"pictureInPictureEnabled"in document?document.exitPictureInPicture():void 0}handleKeyDown(e){var t,i,s=this.options_.userActions;s&&s.hotkeys&&(t=this.el_.ownerDocument.activeElement,i=t.tagName.toLowerCase(),t.isContentEditable||("input"===i?-1===["button","checkbox","hidden","radio","reset","submit"].indexOf(t.type):-1!==["textarea"].indexOf(i))||("function"==typeof s.hotkeys?s.hotkeys.call(this,e):this.handleHotkeys(e)))}handleHotkeys(t){var{fullscreenKey:e=e=>"f"===t.key.toLowerCase(),muteKey:i=e=>"m"===t.key.toLowerCase(),playPauseKey:s=e=>"k"===t.key.toLowerCase()||" "===t.key.toLowerCase()}=this.options_.userActions?this.options_.userActions.hotkeys:{};e.call(this,t)?(t.preventDefault(),t.stopPropagation(),e=g.getComponent("FullscreenToggle"),!1!==document[this.fsApi_.fullscreenEnabled]&&e.prototype.handleClick.call(this,t)):i.call(this,t)?(t.preventDefault(),t.stopPropagation(),g.getComponent("MuteToggle").prototype.handleClick.call(this,t)):s.call(this,t)&&(t.preventDefault(),t.stopPropagation(),g.getComponent("PlayToggle").prototype.handleClick.call(this,t))}canPlayType(s){var r;for(let t=0,i=this.options_.techOrder;ti.some(e=>{if(r=s(t,e))return!0})),r}var i=this.options_.techOrder.map(e=>[e,v.getTech(e)]).filter(([e,t])=>t?t.isSupported():(o.error(`The "${e}" tech is undefined. Skipped browser support check for that tech.`),!1));let s;var r,n=([e,t],i)=>{if(t.canPlaySource(i,this.options_[e.toLowerCase()]))return{source:i,tech:e}};return(s=this.options_.sourceOrder?t(e,i,(r=n,(e,t)=>r(t,e))):t(i,e,n))||!1}handleSrc_(e,s){if("undefined"==typeof e)return this.cache_.src||"";this.resetRetryOnError_&&this.resetRetryOnError_();let r=As(e);if(r.length){if(this.changingSrc_=!0,s||(this.cache_.sources=r),this.updateSourceCaches_(r[0]),Ss(this,r[0],(e,t)=>{var i;if(this.middleware_=t,s||(this.cache_.sources=r),this.updateSourceCaches_(e),this.src_(e))return 1e.setTech&&e.setTech(i))}),1{this.error(null),this.handleSrc_(r.slice(1),!0)},t=()=>{this.off("error",e)};this.one("error",e),this.one("playing",t),this.resetRetryOnError_=()=>{this.off("error",e),this.off("playing",t)}}}else this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0)}src(e){return this.handleSrc_(e,!1)}src_(e){var t=this.selectSource([e]);return!t||(Ut(t.tech,this.techName_)?this.ready(function(){this.tech_.constructor.prototype.hasOwnProperty("setSource")?this.techCall_("setSource",e):this.techCall_("src",e.src),this.changingSrc_=!1},!0):(this.changingSrc_=!0,this.loadTech_(t.tech,t.source),this.tech_.ready(()=>{this.changingSrc_=!1})),!1)}addSourceElement(e,t){return!!this.tech_&&this.tech_.addSourceElement(e,t)}removeSourceElement(e){return!!this.tech_&&this.tech_.removeSourceElement(e)}load(){this.tech_&&this.tech_.vhs?this.src(this.currentSource()):this.techCall_("load")}reset(){this.paused()?this.doReset_():Kt(this.play().then(()=>this.doReset_()))}doReset_(){this.tech_&&this.tech_.clearTracks("text"),this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.resetCache_(),this.poster(""),this.loadTech_(this.options_.techOrder[0],null),this.techCall_("reset"),this.resetControlBarUI_(),this.error(null),this.titleBar&&this.titleBar.update({title:void 0,description:void 0}),Ct(this)&&this.trigger("playerreset")}resetControlBarUI_(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()}resetProgressBar_(){this.currentTime(0);var{currentTimeDisplay:e,durationDisplay:t,progressControl:i,remainingTimeDisplay:s}=this.controlBar||{},i=(i||{}).seekBar;e&&e.updateContent(),t&&t.updateContent(),s&&s.updateContent(),i&&(i.update(),i.loadProgressBar)&&i.loadProgressBar.update()}resetPlaybackRate_(){this.playbackRate(this.defaultPlaybackRate()),this.handleTechRateChange_()}resetVolumeBar_(){this.volume(1),this.trigger("volumechange")}currentSources(){var e=this.currentSource(),t=[];return 0!==Object.keys(e).length&&t.push(e),this.cache_.sources||t}currentSource(){return this.cache_.source||{}}currentSrc(){return this.currentSource()&&this.currentSource().src||""}currentType(){return this.currentSource()&&this.currentSource().type||""}preload(e){if(void 0===e)return this.techGet_("preload");this.techCall_("setPreload",e),this.options_.preload=e}autoplay(e){if(void 0===e)return this.options_.autoplay||!1;let 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="undefined"==typeof t?this.options_.autoplay:t,this.tech_&&this.techCall_("setAutoplay",t)}playsinline(e){return void 0!==e&&(this.techCall_("setPlaysinline",e),this.options_.playsinline=e),this.techGet_("playsinline")}loop(e){if(void 0===e)return this.techGet_("loop");this.techCall_("setLoop",e),this.options_.loop=e}poster(e){if(void 0===e)return this.poster_;(e=e||"")!==this.poster_&&(this.poster_=e,this.techCall_("setPoster",e),this.isPosterFromTech_=!1,this.trigger("posterchange"))}handleTechPosterChange_(){var e;(!this.poster_||this.options_.techCanOverridePoster)&&this.tech_&&this.tech_.poster&&(e=this.tech_.poster()||"")!==this.poster_&&(this.poster_=e,this.isPosterFromTech_=!0,this.trigger("posterchange"))}controls(e){if(void 0===e)return!!this.controls_;this.controls_!==(e=!!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_()))}usingNativeControls(e){if(void 0===e)return!!this.usingNativeControls_;this.usingNativeControls_!==(e=!!e)&&(this.usingNativeControls_=e,this.usingNativeControls_?(this.addClass("vjs-using-native-controls"),this.trigger("usingnativecontrols")):(this.removeClass("vjs-using-native-controls"),this.trigger("usingcustomcontrols")))}error(t){if(void 0===t)return this.error_||null;if(B("beforeerror").forEach(e=>{e=e(this,t);Y(e)&&!Array.isArray(e)||"string"==typeof e||"number"==typeof e||null===e?t=e:this.log.error("please return a value that MediaError expects in beforeerror hooks")}),this.options_.suppressNotSupportedError&&t&&4===t.code){let e=function(){this.error(t)};this.options_.suppressNotSupportedError=!1,this.any(["click","touchstart"],e),void this.one("loadstart",function(){this.off(["click","touchstart"],e)})}else null===t?(this.error_=null,this.removeClass("vjs-error"),this.errorDisplay&&this.errorDisplay.close()):(this.error_=new i(t),this.addClass("vjs-error"),o.error(`(CODE:${this.error_.code} ${i.errorTypes[this.error_.code]})`,this.error_.message,this.error_),this.trigger("error"),B("error").forEach(e=>e(this,this.error_)))}reportUserActivity(e){this.userActivity_=!0}userActive(e){if(void 0===e)return this.userActive_;(e=!!e)!==this.userActive_&&(this.userActive_=e,this.userActive_?(this.userActivity_=!0,this.removeClass("vjs-user-inactive"),this.addClass("vjs-user-active"),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")))}listenForUserActivity_(){let t,i,s,r=p(this,this.reportUserActivity);function e(e){r(),this.clearInterval(t)}this.on("mousedown",function(){r(),this.clearInterval(t),t=this.setInterval(r,250)}),this.on("mousemove",function(e){e.screenX===i&&e.screenY===s||(i=e.screenX,s=e.screenY,r())}),this.on("mouseup",e),this.on("mouseleave",e);var n=this.getChild("controlBar");!n||u||se||(n.on("mouseenter",function(e){0!==this.player().options_.inactivityTimeout&&(this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout),this.player().options_.inactivityTimeout=0}),n.on("mouseleave",function(e){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout})),this.on("keydown",r),this.on("keyup",r);let a;this.setInterval(function(){var e;this.userActivity_&&(this.userActivity_=!1,this.userActive(!0),this.clearTimeout(a),(e=this.options_.inactivityTimeout)<=0||(a=this.setTimeout(function(){this.userActivity_||this.userActive(!1)},e)))},250)}playbackRate(e){if(void 0===e)return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1;this.techCall_("setPlaybackRate",e)}defaultPlaybackRate(e){return void 0!==e?this.techCall_("setDefaultPlaybackRate",e):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1}isAudio(e){if(void 0===e)return!!this.isAudio_;this.isAudio_=!!e}updatePlayerHeightOnAudioOnlyMode_(){var e=this.getChild("ControlBar");e&&this.audioOnlyCache_.controlBarHeight!==e.currentHeight()&&(this.audioOnlyCache_.controlBarHeight=e.currentHeight(),this.height(this.audioOnlyCache_.controlBarHeight))}enableAudioOnlyUI_(){this.addClass("vjs-audio-only-mode");var e=this.children();let t=this.getChild("ControlBar");var i=t&&t.currentHeight();e.forEach(e=>{e!==t&&e.el_&&!e.hasClass("vjs-hidden")&&(e.hide(),this.audioOnlyCache_.hiddenChildren.push(e))}),this.audioOnlyCache_.playerHeight=this.currentHeight(),this.audioOnlyCache_.controlBarHeight=i,this.on("playerresize",this.boundUpdatePlayerHeightOnAudioOnlyMode_),this.height(i),this.trigger("audioonlymodechange")}disableAudioOnlyUI_(){this.removeClass("vjs-audio-only-mode"),this.off("playerresize",this.boundUpdatePlayerHeightOnAudioOnlyMode_),this.audioOnlyCache_.hiddenChildren.forEach(e=>e.show()),this.height(this.audioOnlyCache_.playerHeight),this.trigger("audioonlymodechange")}audioOnlyMode(e){return"boolean"!=typeof e||e===this.audioOnlyMode_?this.audioOnlyMode_:(this.audioOnlyMode_=e)?(e=[],this.isInPictureInPicture()&&e.push(this.exitPictureInPicture()),this.isFullscreen()&&e.push(this.exitFullscreen()),this.audioPosterMode()&&e.push(this.audioPosterMode(!1)),Promise.all(e).then(()=>this.enableAudioOnlyUI_())):Promise.resolve().then(()=>this.disableAudioOnlyUI_())}enablePosterModeUI_(){(this.tech_&&this.tech_).hide(),this.addClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}disablePosterModeUI_(){(this.tech_&&this.tech_).show(),this.removeClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}audioPosterMode(e){return"boolean"!=typeof e||e===this.audioPosterMode_?this.audioPosterMode_:(this.audioPosterMode_=e)?(this.audioOnlyMode()?this.audioOnlyMode(!1):Promise.resolve()).then(()=>{this.enablePosterModeUI_()}):Promise.resolve().then(()=>{this.disablePosterModeUI_()})}addTextTrack(e,t,i){if(this.tech_)return this.tech_.addTextTrack(e,t,i)}addRemoteTextTrack(e,t){if(this.tech_)return this.tech_.addRemoteTextTrack(e,t)}removeRemoteTextTrack(e={}){let t=e.track;if(t=t||e,this.tech_)return this.tech_.removeRemoteTextTrack(t)}getVideoPlaybackQuality(){return this.techGet_("getVideoPlaybackQuality")}videoWidth(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0}videoHeight(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0}language(e){if(void 0===e)return this.language_;this.language_!==String(e).toLowerCase()&&(this.language_=String(e).toLowerCase(),Ct(this))&&this.trigger("languagechange")}languages(){return d(T.prototype.options_.languages,this.languages_)}toJSON(){var t=d(this.options_),i=t.tracks;t.tracks=[];for(let e=0;e{this.removeChild(i)}),i.open(),i}updateCurrentBreakpoint_(){if(this.responsive()){var t=this.currentBreakpoint(),i=this.currentWidth();for(let e=0;ethis.addRemoteTextTrack(e,!1)),this.titleBar&&this.titleBar.update({title:l,description:r||e||""}),this.ready(t))}getMedia(){var e,t;return this.cache_.media?d(this.cache_.media):(e=this.poster(),t={src:this.currentSources(),textTracks:Array.prototype.map.call(this.remoteTextTracks(),e=>({kind:e.kind,label:e.label,language:e.language,src:e.src}))},e&&(t.poster=e,t.artwork=[{src:t.poster,type:Ps(t.poster)}]),t)}static getTagSettings(e){var i={sources:[],tracks:[]},t=Ne(e),s=t["data-setup"];if(De(e,"vjs-fill")&&(t.fill=!0),De(e,"vjs-fluid")&&(t.fluid=!0),null!==s)try{Object.assign(t,JSON.parse(s||"{}"))}catch(e){o.error("data-setup",e)}if(Object.assign(i,t),e.hasChildNodes()){var r=e.childNodes;for(let e=0,t=r.length;e"number"==typeof e)&&(this.cache_.playbackRates=e,this.trigger("playbackrateschange"))}}a.names.forEach(function(e){let t=a[e];T.prototype[t.getterName]=function(){return this.tech_?this.tech_[t.getterName]():(this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName])}}),T.prototype.crossorigin=T.prototype.crossOrigin,T.players={};Jr=window.navigator;T.prototype.options_={techOrder:v.defaultTechOrder_,html5:{},enableSourceset:!0,inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","titleBar","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:Jr&&(Jr.languages&&Jr.languages[0]||Jr.userLanguage||Jr.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,spatialNavigation:{enabled:!1,horizontalSeek:!1},enableSmoothSeeking:!1},vn.forEach(function(e){T.prototype[`handleTech${m(e)}_`]=function(){return this.trigger(e)}}),g.registerComponent("Player",T);function En(t,i){function s(){Pn(this,{name:t,plugin:i,instance:null},!0);var e=i.apply(this,arguments);return Dn(this,t),Pn(this,{name:t,plugin:i,instance:e}),e}return Object.keys(i).forEach(function(e){s[e]=i[e]}),s}let Cn="plugin",kn="activePlugins_",In={},xn=e=>In.hasOwnProperty(e),An=e=>xn(e)?In[e]:void 0,Dn=(e,t)=>{e[kn]=e[kn]||{},e[kn][t]=!0},Pn=(e,t,i)=>{i=(i?"before":"")+"pluginsetup";e.trigger(i,t),e.trigger(i+":"+t.name,t)},Ln=(i,s)=>(s.prototype.name=i,function(...e){Pn(this,{name:i,plugin:s,instance:null},!0);let t=new s(this,...e);return this[i]=()=>t,Pn(this,t.getEventHash()),t});class On{constructor(e){if(this.constructor===On)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=e,this.log||(this.log=this.player.log.createLogger(this.name)),Ot(this),delete this.trigger,Nt(this,this.constructor.defaultState),Dn(e,this.name),this.dispose=this.dispose.bind(this),e.on("dispose",this.dispose)}version(){return this.constructor.VERSION}getEventHash(e={}){return e.name=this.name,e.plugin=this.constructor,e.instance=this,e}trigger(e,t={}){return gt(this.eventBusEl_,e,this.getEventHash(t))}handleStateChanged(e){}dispose(){var{name:e,player:t}=this;this.trigger("dispose"),this.off(),t.off("dispose",this.dispose),t[kn][e]=!1,this.player=this.state=null,t[e]=Ln(e,In[e])}static isBasic(e){e="string"==typeof e?An(e):e;return"function"==typeof e&&!On.prototype.isPrototypeOf(e.prototype)}static registerPlugin(e,t){if("string"!=typeof e)throw new Error(`Illegal plugin name, "${e}", must be a string, was ${typeof e}.`);if(xn(e))o.warn(`A plugin named "${e}" already exists. You may want to avoid re-registering plugins!`);else if(T.prototype.hasOwnProperty(e))throw new Error(`Illegal plugin name, "${e}", cannot share a name with an existing player method!`);if("function"!=typeof t)throw new Error(`Illegal plugin for "${e}", must be a function, was ${typeof t}.`);return In[e]=t,e!==Cn&&(On.isBasic(t)?T.prototype[e]=En(e,t):T.prototype[e]=Ln(e,t)),t}static deregisterPlugin(e){if(e===Cn)throw new Error("Cannot de-register base plugin.");xn(e)&&(delete In[e],delete T.prototype[e])}static getPlugins(e=Object.keys(In)){let i;return e.forEach(e=>{var t=An(e);t&&((i=i||{})[e]=t)}),i}static getPluginVersion(e){e=An(e);return e&&e.VERSION||""}}function Rn(e,i,s,r){{var n=i+` is deprecated and will be removed in ${e}.0; please use ${s} instead.`,a=r;let t=!1;return function(...e){return t||o.warn(n),t=!0,a.apply(this,e)}}}On.getPlugin=An,On.BASE_PLUGIN_NAME=Cn,On.registerPlugin(Cn,On),T.prototype.usingPlugin=function(e){return!!this[kn]&&!0===this[kn][e]},T.prototype.hasPlugin=function(e){return!!xn(e)};let Nn=e=>0===e.indexOf("#")?e.slice(1):e;function E(e,i,s){let r=E.getPlayer(e);if(r)i&&o.warn(`Player "${e}" is already initialised. Options will not be applied.`),s&&r.ready(s);else{let t="string"==typeof e?Ye("#"+Nn(e)):e;if(!Ce(t))throw new TypeError("The element or ID supplied is not valid. (videojs)");e="getRootNode"in t&&t.getRootNode()instanceof window.ShadowRoot?t.getRootNode():t.ownerDocument.body,e=(t.ownerDocument.defaultView&&e.contains(t)||o.warn("The element supplied is not included in the DOM"),!0===(i=i||{}).restoreEl&&(i.restoreEl=(t.parentNode&&t.parentNode.hasAttribute&&t.parentNode.hasAttribute("data-vjs-player")?t.parentNode:t).cloneNode(!0)),B("beforesetup").forEach(e=>{e=e(t,d(i));!Y(e)||Array.isArray(e)?o.error("please return an object in beforesetup hooks"):i=d(i,e)}),g.getComponent("Player"));r=new e(t,i,s),B("setup").forEach(e=>e(r))}return r}E.hooks_=U,E.hooks=B,E.hook=function(e,t){B(e,t)},E.hookOnce=function(s,e){B(s,[].concat(e).map(t=>{let i=(...e)=>(F(s,i),t(...e));return i}))},E.removeHook=F,!0!==window.VIDEOJS_NO_DYNAMIC_STYLE&&Ee()&&!(e=Ye(".vjs-styles-defaults"))&&(e=at("vjs-styles-defaults"),(Qr=Ye("head"))&&Qr.insertBefore(e,Qr.firstChild),ot(e,` + .video-js { + width: 300px; + height: 150px; + } + + .vjs-fluid:not(.vjs-audio-only-mode) { + padding-top: 56.25% + } + `)),rt(1,E),E.VERSION=M,E.options=T.prototype.options_,E.getPlayers=()=>T.players,E.getPlayer=e=>{var t=T.players;let i;if("string"==typeof e){var s=Nn(e),r=t[s];if(r)return r;i=Ye("#"+s)}else i=e;if(Ce(i)){var{player:r,playerId:s}=i;if(r||t[s])return r||t[s]}},E.getAllPlayers=()=>Object.keys(T.players).map(e=>T.players[e]).filter(Boolean),E.players=T.players,E.getComponent=g.getComponent,E.registerComponent=(e,t)=>(v.isTech(t)&&o.warn(`The ${e} tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)`),g.registerComponent.call(g,e,t)),E.getTech=v.getTech,E.registerTech=v.registerTech,E.use=function(e,t){vs[e]=vs[e]||[],vs[e].push(t)},Object.defineProperty(E,"middleware",{value:{},writeable:!1,enumerable:!0}),Object.defineProperty(E.middleware,"TERMINATOR",{value:Ts,writeable:!1,enumerable:!0}),E.browser=Se,E.obj=ee,E.mergeOptions=Rn(9,"videojs.mergeOptions","videojs.obj.merge",d),E.defineLazyProperty=Rn(9,"videojs.defineLazyProperty","videojs.obj.defineLazyProperty",Z),E.bind=Rn(9,"videojs.bind","native Function.prototype.bind",p),E.registerPlugin=On.registerPlugin,E.deregisterPlugin=On.deregisterPlugin,E.plugin=(e,t)=>(o.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),On.registerPlugin(e,t)),E.getPlugins=On.getPlugins,E.getPlugin=On.getPlugin,E.getPluginVersion=On.getPluginVersion,E.addLanguage=function(e,t){return e=(""+e).toLowerCase(),E.options.languages=d(E.options.languages,{[e]:t}),E.options.languages[e]},E.log=o,E.createLogger=W,E.time=t,E.createTimeRange=Rn(9,"videojs.createTimeRange","videojs.time.createTimeRanges",jt),E.createTimeRanges=Rn(9,"videojs.createTimeRanges","videojs.time.createTimeRanges",jt),E.formatTime=Rn(9,"videojs.formatTime","videojs.time.formatTime",Wt),E.setFormatTime=Rn(9,"videojs.setFormatTime","videojs.time.setFormatTime",zt),E.resetFormatTime=Rn(9,"videojs.resetFormatTime","videojs.time.resetFormatTime",$t),E.parseUrl=Rn(9,"videojs.parseUrl","videojs.url.parseUrl",mi),E.isCrossOrigin=Rn(9,"videojs.isCrossOrigin","videojs.url.isCrossOrigin",fi),E.EventTarget=wt,E.any=yt,E.on=mt,E.one=ft,E.off=c,E.trigger=gt,E.xhr=Di,E.TextTrack=Bi,E.AudioTrack=Fi,E.VideoTrack=qi,["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach(e=>{E[e]=function(){return o.warn(`videojs.${e}() is deprecated; use videojs.dom.${e}() instead`),et[e].apply(null,arguments)}}),E.computedStyle=Rn(9,"videojs.computedStyle","videojs.dom.computedStyle",Je),E.dom=et,E.fn=Tt,E.num=zi,E.str=Bt,E.url=_i,E.Error={NetworkBadStatus:"networkbadstatus",NetworkRequestFailed:"networkrequestfailed",NetworkRequestAborted:"networkrequestaborted",NetworkRequestTimeout:"networkrequesttimeout",NetworkBodyParserFailed:"networkbodyparserfailed",StreamingHlsPlaylistParserError:"streaminghlsplaylistparsererror",StreamingDashManifestParserError:"streamingdashmanifestparsererror",StreamingContentSteeringParserError:"streamingcontentsteeringparsererror",StreamingVttParserError:"streamingvttparsererror",StreamingFailedToSelectNextSegment:"streamingfailedtoselectnextsegment",StreamingFailedToDecryptSegment:"streamingfailedtodecryptsegment",StreamingFailedToTransmuxSegment:"streamingfailedtotransmuxsegment",StreamingFailedToAppendSegment:"streamingfailedtoappendsegment",StreamingCodecsChangeError:"streamingcodecschangeerror"},bi(function(e,t){ +/*! @name videojs-contrib-quality-levels @version 4.1.0 @license Apache-2.0 */ +e.exports=function(e){function t(e){return e&&typeof e==="object"&&"default"in e?e:{default:e}}var i=t(e);class s{constructor(e){let t=this;t.id=e.id;t.label=t.id;t.width=e.width;t.height=e.height;t.bitrate=e.bandwidth;t.frameRate=e.frameRate;t.enabled_=e.enabled;Object.defineProperty(t,"enabled",{get(){return t.enabled_()},set(e){t.enabled_(e)}});return t}}class n extends i["default"].EventTarget{constructor(){super();let e=this;e.levels_=[];e.selectedIndex_=-1;Object.defineProperty(e,"selectedIndex",{get(){return e.selectedIndex_}});Object.defineProperty(e,"length",{get(){return e.levels_.length}});e[Symbol.iterator]=()=>e.levels_.values();return e}addQualityLevel(e){let t=this.getQualityLevelById(e.id);if(t)return t;const i=this.levels_.length;t=new s(e);if(!(""+i in this))Object.defineProperty(this,i,{get(){return this.levels_[i]}});this.levels_.push(t);this.trigger({qualityLevel:t,type:"addqualitylevel"});return t}removeQualityLevel(i){let s=null;for(let e=0,t=this.length;ee)this.selectedIndex_--;break}if(s)this.trigger({qualityLevel:i,type:"removequalitylevel"});return s}getQualityLevelById(i){for(let e=0,t=this.length;es;e.qualityLevels.VERSION=a;return s},o=function(e){return r(this,i["default"].obj.merge({},e))};return i["default"].registerPlugin("qualityLevels",o),o.VERSION=a,o}(E)});function Mn(e){return window.atob?window.atob(e):Buffer.from(e,"base64").toString("binary")}var Un="https://example.com",Bn=function(e,t){if(/^[a-z]+:/i.test(t))return t;/^data:/.test(e)&&(e=window.location&&window.location.href||"");var i=/^\/\//.test(e),s=!window.location&&!/\/\//i.test(e),t=(e=new window.URL(e,window.location||Un),new URL(t,e));return s?t.href.slice(Un.length):i?t.href.slice(t.protocol.length):t.href},Yr=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){return!!this.listeners[e]&&(t=this.listeners[e].indexOf(t),this.listeners[e]=this.listeners[e].slice(0),this.listeners[e].splice(t,1),-1{var e=e.split("x"),t={};return e[0]&&(t.width=parseInt(e[0],10)),e[1]&&(t.height=parseInt(e[1],10)),t};class zn extends Yr{constructor(){super(),this.customParsers=[],this.tagMappers=[]}push(i){let a,o;0!==(i=i.trim()).length&&("#"!==i[0]?this.trigger("data",{type:"uri",uri:i}):this.tagMappers.reduce((e,t)=>{t=t(i);return t===i?e:e.concat([t])},[i]).forEach(t=>{for(let e=0;ee),this.customParsers.push(e=>{if(t.exec(e))return this.trigger("data",{type:"custom",data:s(e),customType:i,segment:r}),!0})}addTagMapper({expression:t,map:i}){this.tagMappers.push(e=>t.test(e)?i(e):e)}}function $n(t){let i={};return Object.keys(t).forEach(function(e){i[e.toLowerCase().replace(/-(\w)/g,e=>e[1].toUpperCase())]=t[e]}),i}function Wn(e){var t,i,s,r,n,{serverControl:e,targetDuration:a,partTargetDuration:o}=e;e&&(t="#EXT-X-SERVER-CONTROL",i="holdBack",s="partHoldBack",r=a&&3*a,n=o&&2*o,a&&!e.hasOwnProperty(i)&&(e[i]=r,this.trigger("info",{message:t+` defaulting HOLD-BACK to targetDuration * 3 (${r}).`})),r&&e[i]{o.uri||!o.parts&&!o.preloadHints||(!o.map&&l&&(o.map=l),!o.key&&d&&(o.key=d),o.timeline||"number"!=typeof c||(o.timeline=c),this.manifest.preloadSegment=o)}),this.parseStream.on("data",function(n){let t,i;if(r.manifest.definitions)for(var e in r.manifest.definitions)if(n.uri&&(n.uri=n.uri.replace(`{$${e}}`,r.manifest.definitions[e])),n.attributes)for(var s in n.attributes)"string"==typeof n.attributes[s]&&(n.attributes[s]=n.attributes[s].replace(`{$${e}}`,r.manifest.definitions[e]));({tag(){({version(){n.version&&(this.manifest.version=n.version)},"allow-cache"(){this.manifest.allowCache=n.allowed,"allowed"in n||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange(){var e={};"length"in n&&((o.byterange=e).length=n.length,"offset"in n||(n.offset=p)),"offset"in n&&((o.byterange=e).offset=n.offset),p=e.offset+e.length},endlist(){this.manifest.endList=!0},inf(){"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"})),n.title&&(o.title=n.title),0(t.programDateTime=e-1e3*t.duration,t.programDateTime),this.lastProgramDateTime)},targetduration(){!isFinite(n.duration)||n.duration<0?this.trigger("warn",{message:"ignoring invalid target duration: "+n.duration}):(this.manifest.targetDuration=n.duration,Wn.call(this,this.manifest))},start(){!n.attributes||isNaN(n.attributes["TIME-OFFSET"])?this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"}):this.manifest.start={timeOffset:n.attributes["TIME-OFFSET"],precise:n.attributes.PRECISE}},"cue-out"(){o.cueOut=n.data},"cue-out-cont"(){o.cueOutCont=n.data},"cue-in"(){o.cueIn=n.data},skip(){this.manifest.skip=$n(n.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",n.attributes,["SKIPPED-SEGMENTS"])},part(){h=!0;var e=this.manifest.segments.length,t=$n(n.attributes),t=(o.parts=o.parts||[],o.parts.push(t),t.byterange&&(t.byterange.hasOwnProperty("offset")||(t.byterange.offset=m),m=t.byterange.offset+t.byterange.length),o.parts.length-1);this.warnOnMissingAttributes_(`#EXT-X-PART #${t} for segment #`+e,n.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach((e,t)=>{e.hasOwnProperty("lastPart")||this.trigger("warn",{message:`#EXT-X-RENDITION-REPORT #${t} lacks required attribute(s): LAST-PART`})})},"server-control"(){var e=this.manifest.serverControl=$n(n.attributes);e.hasOwnProperty("canBlockReload")||(e.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),Wn.call(this,this.manifest),e.canSkipDateranges&&!e.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"(){var t=this.manifest.segments.length,i=$n(n.attributes),e=i.type&&"PART"===i.type,s=(o.preloadHints=o.preloadHints||[],o.preloadHints.push(i),!i.byterange||i.byterange.hasOwnProperty("offset")||(i.byterange.offset=e?m:0,e&&(m=i.byterange.offset+i.byterange.length)),o.preloadHints.length-1);if(this.warnOnMissingAttributes_(`#EXT-X-PRELOAD-HINT #${s} for segment #`+t,n.attributes,["TYPE","URI"]),i.type)for(let e=0;ee.id===t.id);this.manifest.dateRanges[e]=f(this.manifest.dateRanges[e],t),g[t.id]=f(g[t.id],t),this.manifest.dateRanges.pop()}else g[t.id]=t},"independent-segments"(){this.manifest.independentSegments=!0},"i-frames-only"(){this.manifest.iFramesOnly=!0,this.requiredCompatibilityversion(this.manifest.version,4)},"content-steering"(){this.manifest.contentSteering=$n(n.attributes),this.warnOnMissingAttributes_("#EXT-X-CONTENT-STEERING",n.attributes,["SERVER-URI"])},define(){this.manifest.definitions=this.manifest.definitions||{};var e,t=(e,t)=>{e in this.manifest.definitions?this.trigger("error",{message:"EXT-X-DEFINE: Duplicate name "+e}):this.manifest.definitions[e]=t};return"QUERYPARAM"in n.attributes?"NAME"in n.attributes||"IMPORT"in n.attributes?void this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"}):(e=this.params.get(n.attributes.QUERYPARAM))?void t(n.attributes.QUERYPARAM,decodeURIComponent(e)):void this.trigger("error",{message:"EXT-X-DEFINE: No query param "+n.attributes.QUERYPARAM}):"NAME"in n.attributes?"IMPORT"in n.attributes?void this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"}):"VALUE"in n.attributes&&"string"==typeof n.attributes.VALUE?void t(n.attributes.NAME,n.attributes.VALUE):void this.trigger("error",{message:"EXT-X-DEFINE: No value for "+n.attributes.NAME}):"IMPORT"in n.attributes?this.mainDefinitions[n.attributes.IMPORT]?void t(n.attributes.IMPORT,this.mainDefinitions[n.attributes.IMPORT]):void this.trigger("error",{message:`EXT-X-DEFINE: No value ${n.attributes.IMPORT} to import, or IMPORT used on main playlist`}):void this.trigger("error",{message:"EXT-X-DEFINE: No attribute"})},"i-frame-playlist"(){this.manifest.iFramePlaylists.push({attributes:n.attributes,uri:n.uri,timeline:c}),this.warnOnMissingAttributes_("#EXT-X-I-FRAME-STREAM-INF",n.attributes,["BANDWIDTH","URI"])}}[n.tagType]||function(){}).call(r)},uri(){o.uri=n.uri,a.push(o),!this.manifest.targetDuration||"duration"in o||(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),o.duration=this.manifest.targetDuration),d&&(o.key=d),o.timeline=c,l&&(o.map=l),m=0,null!==this.lastProgramDateTime&&(o.programDateTime=this.lastProgramDateTime,this.lastProgramDateTime+=1e3*o.duration),o={}},comment(){},custom(){n.segment?(o.custom=o.custom||{},o.custom[n.customType]=n.data):(this.manifest.custom=this.manifest.custom||{},this.manifest.custom[n.customType]=n.data)}})[n.type].call(r)})}requiredCompatibilityversion(e,t){(e=e.length&&t.call(e,function(e,t){return e===(n[t]?n[t]&i[r+t]:i[r+t])})},fa=function(r,e,n){e.forEach(function(e){for(var t in r.mediaGroups[e])for(var i in r.mediaGroups[e][t]){var s=r.mediaGroups[e][t][i];n(s,e,t,i)}})};function ya(e,t){return(t=void 0===t?Object:t)&&"function"==typeof t.freeze?t.freeze(e):e}var _a=ya({HTML:"text/html",isHTML:function(e){return e===_a.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),va=ya({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(e){return e===va.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"}),ba={assign:function(e,t){if(null===e||"object"!=typeof 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},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 s=0;s"==e&&">")||("&"==e?"&":'"'==e&&""")||"&#"+e.charCodeAt()+";"}function Fa(e,t){if(t(e))return 1;if(e=e.firstChild)do{if(Fa(e,t))return 1}while(e=e.nextSibling)}function qa(){this.ownerDocument=this}function ja(e,t,i){e&&e._inc++,i.namespaceURI===Sa.XMLNS&&delete t._nsMap[i.prefix?i.localName:""]}function Ha(e,t,i){if(e&&e._inc){e._inc++;var s=t.childNodes;if(i)s[s.length++]=i;else{for(var r=t.firstChild,n=0;r;)r=(s[n++]=r).nextSibling;s.length=n,delete s[s.length]}}}function Va(e,t){var i=t.previousSibling,s=t.nextSibling;return i?i.nextSibling=s:e.firstChild=s,s?s.previousSibling=i:e.lastChild=i,t.parentNode=null,t.previousSibling=null,t.nextSibling=null,Ha(e.ownerDocument,e),t}function za(e){return e&&e.nodeType===A.DOCUMENT_TYPE_NODE}function $a(e){return e&&e.nodeType===A.ELEMENT_NODE}function Wa(e){return e&&e.nodeType===A.TEXT_NODE}function Ga(e,t){var i,e=e.childNodes||[];if(!Ta(e,$a)&&!za(t))return i=Ta(e,za),!(t&&i&&e.indexOf(i)>e.indexOf(t))}function Xa(e,t){var i,e=e.childNodes||[];if(!Ta(e,function(e){return $a(e)&&e!==t}))return i=Ta(e,za),!(t&&i&&e.indexOf(i)>e.indexOf(t))}function Ka(e,t,i){if(!(s=e)||s.nodeType!==A.DOCUMENT_NODE&&s.nodeType!==A.DOCUMENT_FRAGMENT_NODE&&s.nodeType!==A.ELEMENT_NODE)throw new x(xa,"Unexpected parent node type "+e.nodeType);var s;if(i&&i.parentNode!==e)throw new x(Aa,"child not in parent");if(!(s=t)||!($a(s)||Wa(s)||za(s)||s.nodeType===A.DOCUMENT_FRAGMENT_NODE||s.nodeType===A.COMMENT_NODE||s.nodeType===A.PROCESSING_INSTRUCTION_NODE)||za(t)&&e.nodeType!==A.DOCUMENT_NODE)throw new x(xa,"Unexpected node type "+t.nodeType+" for parent node type "+e.nodeType)}function Ya(e,t,i){var s=e.childNodes||[],r=t.childNodes||[];if(t.nodeType===A.DOCUMENT_FRAGMENT_NODE){var n=r.filter($a);if(1"),i&&/^script$/i.test(l))for(;o;)o.data?t.push(o.data):fo(o,t,i,s,r.slice()),o=o.nextSibling;else for(;o;)fo(o,t,i,s,r.slice()),o=o.nextSibling;t.push("")}else t.push("/>");return;case 9:case 11:for(o=e.firstChild;o;)fo(o,t,i,s,r.slice()),o=o.nextSibling;return;case 2:return go(t,e.name,e.value);case 3:return t.push(e.data.replace(/[<&>]/g,Ba));case 4:return t.push("");case 8:return t.push("\x3c!--",e.data,"--\x3e");case 10:var _=e.publicId,v=e.systemId;return t.push("")):v&&"."!=v?t.push(" SYSTEM ",v,">"):((_=e.internalSubset)&&t.push(" [",_,"]"),t.push(">")));case 7:return t.push("");case 5:return t.push("&",e.nodeName,";");default:t.push("??",e.nodeName)}}function yo(e,t,i){e[t]=i}r.INVALID_STATE_ERR=(I[11]="Invalid state",11),r.SYNTAX_ERR=(I[12]="Syntax error",12),r.INVALID_MODIFICATION_ERR=(I[13]="Invalid modification",13),r.NAMESPACE_ERR=(I[14]="Invalid namespace",14),r.INVALID_ACCESS_ERR=(I[15]="Invalid access",15),x.prototype=Error.prototype,ka(r,x),Da.prototype={length:0,item:function(e){return 0<=e&&e",lt:"<",quot:'"'}),t.HTML_ENTITIES=i({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:"‌"}),t.entityMap=t.HTML_ENTITIES}),vo=(_o.XML_ENTITIES,ba.NAMESPACE),tn=/[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]/,en=new RegExp("[\\-\\.0-9"+tn.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),bo=new RegExp("^"+tn.source+en.source+"*(?::"+tn.source+en.source+"*)?$"),To=0,So=1,wo=2,Eo=3,Co=4,ko=5,Io=6,xo=7;function Ao(e,t){this.message=e,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,Ao)}function Do(){}function Po(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}function Lo(e,t,i){for(var s=e.tagName,r=null,n=e.length;n--;){var a=e[n],o=a.qName,l=a.value,o=0<(h=o.indexOf(":"))?(d=a.prefix=o.slice(0,h),u=o.slice(h+1),"xmlns"===d&&u):(d=null,"xmlns"===(u=o)&&"");a.localName=u,!1!==o&&(null==r&&(r={},Oo(i,i={})),i[o]=r[o]=l,a.uri=vo.XMLNS,t.startPrefixMapping(o,l))}for(var d,n=e.length;n--;)(d=(a=e[n]).prefix)&&("xml"===d&&(a.uri=vo.XML),"xmlns"!==d)&&(a.uri=i[d||""]);var h,u=0<(h=s.indexOf(":"))?(d=e.prefix=s.slice(0,h),e.localName=s.slice(h+1)):(d=null,e.localName=s),c=e.uri=i[d||""];if(t.startElement(c,u,s,e),!e.closed)return e.currentNSMap=i,e.localNSMap=r,1;if(t.endElement(c,u,s),r)for(d in r)Object.prototype.hasOwnProperty.call(r,d)&&t.endPrefixMapping(d)}function Oo(e,t){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}function Ro(){this.attributeNames={}}(Ao.prototype=new Error).name=Ao.name,Do.prototype={parse:function(e,t,i){var s=this.domBuilder;s.startDocument(),Oo(t,t={}),function(i,e,s,r,n){function a(e){var t=e.slice(1,-1);return Object.hasOwnProperty.call(s,t)?s[t]:"#"===t.charAt(0)?65535<(t=parseInt(t.substr(1).replace("x","0x")))?(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t))):String.fromCharCode(t):(n.error("entity not found:"+e),e)}function t(e){var t;m",y+3),v=i.substring(y+2,_).replace(/[ \t\n\r]+$/g,""),b=c.pop(),T=(_<0?(v=i.substring(y+2).replace(/[\s<].*/,""),n.error("end tag name: "+v+" is not complete:"+b.tagName),_=y+1+v.length):v.match(/\s",t);if(s){e=e.substring(t,s).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);if(e)return e[0].length,i.processingInstruction(e[1],e[2]),s+2}return-1}(i,y,r);break;case"!":u&&o(y),_=function(e,t,i,s){{if("-"===e.charAt(t+2))return"-"===e.charAt(t+3)?(n=e.indexOf("--\x3e",t+4),t",t+9),i.startCDATA(),i.characters(e,t+9,n-t-9),i.endCDATA(),n+3;var r,s=function(e,t){var i,s=[],r=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;r.lastIndex=t,r.exec(e);for(;i=r.exec(e);)if(s.push(i),i[1])return s}(e,t),n=s.length;if(1":switch(d){case To:s.setTagName(e.slice(t,l));case ko:case Io:case xo:break;case Co:case So:"/"===(u=e.slice(t,l)).slice(-1)&&(s.closed=!0,u=u.slice(0,-1));case wo:d===wo&&(u=o),d==Co?(n.warning('attribute "'+u+'" missed quot(")!'),a(o,u,t)):(vo.isHTML(i[""])&&u.match(/^(?:disabled|checked|selected)$/i)||n.warning('attribute "'+u+'" missed value!! "'+u+'" instead!!'),a(u,u,t));break;case Eo:throw new Error("attribute value missed!!")}return l;case"€":h=" ";default:if(h<=" ")switch(d){case To:s.setTagName(e.slice(t,l)),d=Io;break;case So:o=e.slice(t,l),d=wo;break;case Co:var u=e.slice(t,l);n.warning('attribute "'+u+'" missed quot(")!!'),a(o,u,t);case ko:d=Io}else switch(d){case wo:s.tagName,vo.isHTML(i[""])&&o.match(/^(?:disabled|checked|selected)$/i)||n.warning('attribute "'+o+'" missed value!! "'+o+'" instead2!!'),a(o,o,t),t=l,d=So;break;case ko:n.warning('attribute space is required"'+o+'"!!');case Io:d=So,t=l;break;case Eo:d=Co,t=l;break;case xo:throw new Error("elements closed character '/' and '>' must be connected to")}}l++}}(i,y,E,C,a,n),k=E.length;if(!E.closed&&function(e,t,i,s){var r=s[i];null==r&&((r=e.lastIndexOf(""))",t),e=e.substring(t+1,n);if(/[&<]/.test(e))return/^script$/i.test(i)?r.characters(e,0,e.length):(e=e.replace(/&#?\w+;/g,s),r.characters(e,0,e.length)),n}return t+1}(i,_,E.tagName,a,r):_++}}catch(e){if(e instanceof Ao)throw e;n.error("element parse error: "+e),_=-1}m<_?m=_:t(Math.max(y,m)+1)}}(e,t,i,s,this.errorHandler),s.endDocument()}},Ro.prototype={setTagName:function(e){if(!bo.test(e))throw new Error("invalid tagName:"+e);this.tagName=e},addValue:function(e,t,i){if(!bo.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}};var Zr={XMLReader:Do,ParseError:Ao},No=Kr.DOMImplementation,Mo=ba.NAMESPACE,Uo=Zr.ParseError,Bo=Zr.XMLReader;function Fo(e){return e.replace(/\r[\n\u0085]/g,"\n").replace(/[\r\u0085\u2028]/g,"\n")}function qo(e){this.options=e||{locator:{}}}function jo(){this.cdata=!1}function Ho(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber}function Vo(e){if(e)return"\n@"+(e.systemId||"")+"#[line:"+e.lineNumber+",col:"+e.columnNumber+"]"}function zo(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 $o(e,t){(e.currentElement||e.doc).appendChild(t)}qo.prototype.parseFromString=function(e,t){var i=this.options,s=new Bo,r=i.domBuilder||new jo,n=i.errorHandler,a=i.locator,o=i.xmlns||{},t=/\/x?html?$/.test(t),l=t?_o.HTML_ENTITIES:_o.XML_ENTITIES,n=(a&&r.setDocumentLocator(a),s.errorHandler=function(s,e,r){if(!s){if(e instanceof jo)return e;s=e}var n={},a=s instanceof Function;function t(t){var i=s[t];!i&&a&&(i=2==s.length?function(e){s(t,e)}:s),n[t]=i?function(e){i("[xmldom "+t+"]\t"+e+Vo(r))}:function(){}}return r=r||{},t("warning"),t("error"),t("fatalError"),n}(n,r,a),s.domBuilder=i.domBuilder||r,t&&(o[""]=Mo.HTML),o.xml=o.xml||Mo.XML,i.normalizeLineEndings||Fo);return e&&"string"==typeof e?s.parse(n(e),o,l):s.errorHandler.error("invalid doc source"),r.doc},jo.prototype={startDocument:function(){this.doc=(new No).createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(e,t,i,s){var r=this.doc,n=r.createElementNS(e,i||t),a=s.length;$o(this,n),this.currentElement=n,this.locator&&Ho(this.locator,n);for(var o=0;o!!e&&"object"==typeof e,D=(...e)=>e.reduce((t,i)=>("object"==typeof i&&Object.keys(i).forEach(e=>{Array.isArray(t[e])&&Array.isArray(i[e])?t[e]=t[e].concat(i[e]):Go(t[e])&&Go(i[e])?t[e]=D(t[e],i[e]):t[e]=i[e]}),t),{}),Xo=t=>Object.keys(t).map(e=>t[e]),Ko=(t,i)=>{var s=[];for(let e=t;ee.reduce((e,t)=>e.concat(t),[]),Qo=t=>{if(!t.length)return[];var i=[];for(let e=0;ee.reduce((e,t,i)=>(t[s]&&e.push(i),e),[]),Zo=(e,i)=>Xo(e.reduce((t,e)=>(e.forEach(e=>{t[i(e)]=e}),t),{}));var el={INVALID_NUMBER_OF_PERIOD:"INVALID_NUMBER_OF_PERIOD",INVALID_NUMBER_OF_CONTENT_STEERING:"INVALID_NUMBER_OF_CONTENT_STEERING",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"};let tl=({baseUrl:s="",source:r="",range:n="",indexRange:a=""})=>{s={uri:r,resolvedUri:Bn(s||"",r)};if(n||a){r=(n||a).split("-");let e=window.BigInt?window.BigInt(r[0]):parseInt(r[0],10),t=window.BigInt?window.BigInt(r[1]):parseInt(r[1],10);e{let t;return t="bigint"==typeof e.offset||"bigint"==typeof e.length?window.BigInt(e.offset)+window.BigInt(e.length)-window.BigInt(1):e.offset+e.length-1,e.offset+"-"+t},sl=e=>(e&&"number"!=typeof e&&(e=parseInt(e,10)),isNaN(e)?null:e),rl={static(e){var{duration:t,timescale:i=1,sourceDuration:s,periodDuration:r}=e,e=sl(e.endNumber),t=t/i;return"number"==typeof e?{start:0,end:e}:"number"==typeof r?{start:0,end:r/t}:{start:0,end:s/t}},dynamic(e){var{NOW:t,clientOffset:i,availabilityStartTime:s,timescale:r=1,duration:n,periodStart:a=0,minimumUpdatePeriod:o=0,timeShiftBufferDepth:l=1/0}=e,e=sl(e.endNumber),t=(t+i)/1e3,i=s+a,s=Math.ceil((t+o-i)*r/n),a=Math.floor((t-i-l)*r/n),o=Math.floor((t-i)*r/n);return{start:Math.max(0,a),end:"number"==typeof e?e:Math.min(s,o)}}},nl=n=>e=>{var{duration:t,timescale:i=1,periodStart:s,startNumber:r=1}=n;return{number:r+e,duration:t/i,timeline:s,time:e*t}},al=e=>{var{type:t,duration:i,timescale:s=1,periodDuration:r,sourceDuration:n}=e,{start:a,end:o}=rl[t](e),a=Ko(a,o).map(nl(e));return"static"===t&&(a[o=a.length-1].duration=("number"==typeof r?r:n)-i/s*o),a},ol=e=>{var{baseUrl:t,initialization:i={},sourceDuration:s,indexRange:r="",periodStart:n,presentationTime:a,number:o=0,duration:l}=e;if(t)return i=tl({baseUrl:t,source:i.sourceURL,range:i.range}),(t=tl({baseUrl:t,source:t,indexRange:r})).map=i,l?(r=al(e)).length&&(t.duration=r[0].duration,t.timeline=r[0].timeline):s&&(t.duration=s,t.timeline=n),t.presentationTime=a||n,t.number=o,[t];throw new Error(el.NO_BASE_URL)},ll=(e,i,s)=>{var r=e.sidx.map||null,n=e.sidx.duration,a=e.timeline||0,t=e.sidx.byterange,t=t.offset+t.length,o=i.timescale,l=i.references.filter(e=>1!==e.referenceType),d=[],h=e.endList?"static":"dynamic",u=e.sidx.timeline;let c=u,p=e.mediaSequence||0,m;m="bigint"==typeof i.firstOffset?window.BigInt(t)+i.firstOffset:t+i.firstOffset;for(let t=0;tZo(e,({timeline:e})=>e).sort((e,t)=>e.timeline>t.timeline?1:-1),cl=(t,i)=>{for(let e=0;e{let r=[];return fa(e,dl,(e,t,i,s)=>{r=r.concat(e.playlists||[])}),r},ml=({playlist:i,mediaSequence:e})=>{i.mediaSequence=e,i.segments.forEach((e,t)=>{e.number=i.mediaSequence+t})},gl=({oldPlaylists:t,newPlaylists:e,timelineStarts:r})=>{e.forEach(i=>{i.discontinuitySequence=r.findIndex(function({timeline:e}){return e===i.timeline});var e=cl(t,i.attributes.NAME);if(e&&!i.sidx){let t=i.segments[0];var s=e.segments.findIndex(function(e){return Math.abs(e.presentationTime-t.presentationTime)e.timeline||e.segments.length&&i.timeline>e.segments[e.segments.length-1].timeline)&&i.discontinuitySequence--):(e.segments[s].discontinuity&&!t.discontinuity&&(t.discontinuity=!0,i.discontinuityStarts.unshift(0),i.discontinuitySequence--),ml({playlist:i,mediaSequence:e.segments[s].number}))}})},fl=({oldManifest:e,newManifest:t})=>{var i=e.playlists.concat(pl(e)),s=t.playlists.concat(pl(t));return t.timelineStarts=ul([e.timelineStarts,t.timelineStarts]),gl({oldPlaylists:i,newPlaylists:s,timelineStarts:t.timelineStarts}),t},yl=e=>e&&e.uri+"-"+il(e.byterange),_l=e=>{e=e.reduce(function(e,t){return e[t.attributes.baseUrl]||(e[t.attributes.baseUrl]=[]),e[t.attributes.baseUrl].push(t),e},{});let t=[];return Object.values(e).forEach(e=>{e=Xo(e.reduce((e,t)=>{var i=t.attributes.id+(t.attributes.lang||"");return e[i]?(t.segments&&(t.segments[0]&&(t.segments[0].discontinuity=!0),e[i].segments.push(...t.segments)),t.attributes.contentProtection&&(e[i].attributes.contentProtection=t.attributes.contentProtection)):(e[i]=t,e[i].attributes.timelineStarts=[]),e[i].attributes.timelineStarts.push({start:t.attributes.periodStart,timeline:t.attributes.periodStart}),e},{}));t=t.concat(e)}),t.map(e=>(e.discontinuityStarts=Jo(e.segments||[],"discontinuity"),e))},vl=(e,t)=>{var i=yl(e.sidx),t=i&&t[i]&&t[i].sidx;return t&&ll(e,t,e.sidx.resolvedUri),e},bl=(e,t={})=>{if(Object.keys(t).length)for(var i in e)e[i]=vl(e[i],t);return e},Tl=({attributes:e,segments:t,sidx:i,mediaSequence:s,discontinuitySequence:r,discontinuityStarts:n},a)=>{r={attributes:{NAME:e.id,BANDWIDTH:e.bandwidth,CODECS:e.codecs,"PROGRAM-ID":1},uri:"",endList:"static"===e.type,timeline:e.periodStart,resolvedUri:e.baseUrl||"",targetDuration:e.duration,discontinuitySequence:r,discontinuityStarts:n,timelineStarts:e.timelineStarts,mediaSequence:s,segments:t};return e.contentProtection&&(r.contentProtection=e.contentProtection),e.serviceLocation&&(r.attributes.serviceLocation=e.serviceLocation),i&&(r.sidx=i),a&&(r.attributes.AUDIO="audio",r.attributes.SUBTITLES="subs"),r},Sl=({attributes:e,segments:t,mediaSequence:i,discontinuityStarts:s,discontinuitySequence:r})=>{"undefined"==typeof t&&(t=[{uri:e.baseUrl,timeline:e.periodStart,resolvedUri:e.baseUrl||"",duration:e.sourceDuration,number:0}],e.duration=e.sourceDuration);var n={NAME:e.id,BANDWIDTH:e.bandwidth,"PROGRAM-ID":1},n=(e.codecs&&(n.CODECS=e.codecs),{attributes:n,uri:"",endList:"static"===e.type,timeline:e.periodStart,resolvedUri:e.baseUrl||"",targetDuration:e.duration,timelineStarts:e.timelineStarts,discontinuityStarts:s,discontinuitySequence:r,mediaSequence:i,segments:t});return e.serviceLocation&&(n.attributes.serviceLocation=e.serviceLocation),n},wl=(e,n={},a=!1)=>{let o;e=e.reduce((e,t)=>{var i=t.attributes.role&&t.attributes.role.value||"",s=t.attributes.lang||"";let r=t.attributes.label||"main";e[r=s&&!t.attributes.label?t.attributes.lang+(i?` (${i})`:""):r]||(e[r]={language:s,autoselect:!0,default:"main"===i,playlists:[],uri:""});s=vl(Tl(t,a),n);return e[r].playlists.push(s),"undefined"==typeof o&&"main"===i&&((o=t).default=!0),e},{});return o||(e[Object.keys(e)[0]].default=!0),e},El=(e,r={})=>e.reduce((e,t)=>{var i=t.attributes.label||t.attributes.lang||"text",s=t.attributes.lang||"und";return e[i]||(e[i]={language:s,default:!1,autoselect:!1,playlists:[],uri:""}),e[i].playlists.push(vl(Sl(t),r)),e},{}),Cl=e=>e.reduce((s,e)=>(e&&e.forEach(e=>{var{channel:t,language:i}=e;s[i]={autoselect:!1,default:!1,instreamId:t,language:i},e.hasOwnProperty("aspectRatio")&&(s[i].aspectRatio=e.aspectRatio),e.hasOwnProperty("easyReader")&&(s[i].easyReader=e.easyReader),e.hasOwnProperty("3D")&&(s[i]["3D"]=e["3D"])}),s),{}),kl=({attributes:e,segments:t,sidx:i,discontinuityStarts:s})=>{s={attributes:{NAME:e.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:e.width,height:e.height},CODECS:e.codecs,BANDWIDTH:e.bandwidth,"PROGRAM-ID":1},uri:"",endList:"static"===e.type,timeline:e.periodStart,resolvedUri:e.baseUrl||"",targetDuration:e.duration,discontinuityStarts:s,timelineStarts:e.timelineStarts,segments:t};return e.frameRate&&(s.attributes["FRAME-RATE"]=e.frameRate),e.contentProtection&&(s.contentProtection=e.contentProtection),e.serviceLocation&&(s.attributes.serviceLocation=e.serviceLocation),i&&(s.sidx=i),s},Il=({attributes:e})=>"video/mp4"===e.mimeType||"video/webm"===e.mimeType||"video"===e.contentType,xl=({attributes:e})=>"audio/mp4"===e.mimeType||"audio/webm"===e.mimeType||"audio"===e.contentType,Al=({attributes:e})=>"text/vtt"===e.mimeType||"text"===e.contentType,Dl=(e,i)=>{e.forEach(t=>{t.mediaSequence=0,t.discontinuitySequence=i.findIndex(function({timeline:e}){return e===t.timeline}),t.segments&&t.segments.forEach((e,t)=>{e.number=t})})},Pl=i=>i?Object.keys(i).reduce((e,t)=>{t=i[t];return e.concat(t.playlists)},[]):[],Ll=({dashPlaylists:e,locations:t,contentSteering:i,sidxMapping:s={},previousManifest:r,eventStream:n})=>{var a,o,l,d,h,u,c;return e.length?({sourceDuration:d,type:u,suggestedPresentationDelay:c,minimumUpdatePeriod:h}=e[0].attributes,a=_l(e.filter(Il)).map(kl),o=_l(e.filter(xl)),l=_l(e.filter(Al)),e=e.map(e=>e.attributes.captionServices).filter(Boolean),d={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:"",duration:d,playlists:bl(a,s)},0<=h&&(d.minimumUpdatePeriod=1e3*h),t&&(d.locations=t),i&&(d.contentSteering=i),"dynamic"===u&&(d.suggestedPresentationDelay=c),n&&0e),d.timelineStarts=ul(c),Dl(u,d.timelineStarts),t&&(d.mediaGroups.AUDIO.audio=t),i&&(d.mediaGroups.SUBTITLES.subs=i),e.length&&(d.mediaGroups["CLOSED-CAPTIONS"].cc=Cl(e)),r?fl({oldManifest:r,newManifest:d}):d):{}},Ol=(e,t,i)=>{var{NOW:e,clientOffset:s,availabilityStartTime:r,timescale:n=1,periodStart:a=0,minimumUpdatePeriod:o=0}=e;return Math.ceil((((e+s)/1e3+o-(r+a))*n-t)/i)},Rl=(s,r)=>{var{type:n,minimumUpdatePeriod:a=0,media:o="",sourceDuration:l,timescale:d=1,startNumber:h=1,periodStart:u}=s,c=[];let p=-1;for(let i=0;ip&&(p=m);let e;e=f<0?(m=i+1)===r.length?"dynamic"===n&&0(e,t,i,s)=>{return"$$"===e?"$":"undefined"==typeof r[t]?e:(e=""+r[t],"RepresentationID"===t||(s=i?parseInt(s,10):1)<=e.length?e:new Array(s-e.length+1).join("0")+e)},Ul=(e,t)=>e.replace(Nl,Ml(t)),Bl=(e,t)=>e.duration||t?e.duration?al(e):Rl(e,t):[{number:e.startNumber||1,duration:e.sourceDuration,time:0,timeline:e.periodStart}],Fl=(s,e)=>{let r={RepresentationID:s.id,Bandwidth:s.bandwidth||0};var{initialization:t={sourceURL:"",range:""}}=s;let n=tl({baseUrl:s.baseUrl,source:Ul(t.sourceURL,r),range:t.range});return Bl(s,e).map(e=>{r.Number=e.number,r.Time=e.time;var t=Ul(s.media||"",r),i=s.timescale||1,i=s.periodStart+(e.time-(s.presentationTimeOffset||0))/i;return{uri:t,timeline:e.timeline,duration:e.duration,resolvedUri:Bn(s.baseUrl||"",t),map:n,number:e.number,presentationTime:i}})},ql=(e,t)=>{var{baseUrl:e,initialization:i={}}=e,i=tl({baseUrl:e,source:i.sourceURL,range:i.range}),e=tl({baseUrl:e,source:t.media,range:t.mediaRange});return e.map=i,e},jl=(r,e)=>{let{duration:t,segmentUrls:i=[],periodStart:n}=r;if(!t&&!e||t&&e)throw new Error(el.SEGMENT_TIME_UNSPECIFIED);let a=i.map(e=>ql(r,e)),s;return t&&(s=al(r)),(s=e?Rl(r,e):s).map((e,t)=>{var i,s;if(a[t])return t=a[t],i=r.timescale||1,s=r.presentationTimeOffset||0,t.timeline=e.timeline,t.duration=e.duration,t.number=e.number,t.presentationTime=n+(e.time-s)/i,t}).filter(e=>e)},Hl=({attributes:e,segmentInfo:t})=>{let i,s;t.template?(s=Fl,i=D(e,t.template)):t.base?(s=ol,i=D(e,t.base)):t.list&&(s=jl,i=D(e,t.list));var r,n,a,e={attributes:e};return s&&(r=s(i,t.segmentTimeline),i.duration?({duration:n,timescale:a=1}=i,i.duration=n/a):r.length?i.duration=r.reduce((e,t)=>Math.max(e,Math.ceil(t.duration)),0):i.duration=0,e.attributes=i,e.segments=r,t.base)&&i.indexRange&&(e.sidx=r[0],e.segments=[]),e},Vl=e=>e.map(Hl),P=(e,t)=>Qo(e.childNodes).filter(({tagName:e})=>e===t),zl=e=>e.textContent.trim(),$l=e=>{var t,i,s,r,n,e=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(e);return e?([e,t,i,s,r,n]=e.slice(1),31536e3*parseFloat(e||0)+2592e3*parseFloat(t||0)+86400*parseFloat(i||0)+3600*parseFloat(s||0)+60*parseFloat(r||0)+parseFloat(n||0)):0},Wl={mediaPresentationDuration(e){return $l(e)},availabilityStartTime(e){return/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(e=e)&&(e+="Z"),Date.parse(e)/1e3},minimumUpdatePeriod(e){return $l(e)},suggestedPresentationDelay(e){return $l(e)},type(e){return e},timeShiftBufferDepth(e){return $l(e)},start(e){return $l(e)},width(e){return parseInt(e,10)},height(e){return parseInt(e,10)},bandwidth(e){return parseInt(e,10)},frameRate(e){return parseFloat(e.split("/").reduce((e,t)=>e/t))},startNumber(e){return parseInt(e,10)},timescale(e){return parseInt(e,10)},presentationTimeOffset(e){return parseInt(e,10)},duration(e){var t=parseInt(e,10);return isNaN(t)?$l(e):t},d(e){return parseInt(e,10)},t(e){return parseInt(e,10)},r(e){return parseInt(e,10)},presentationTime(e){return parseInt(e,10)},DEFAULT(e){return e}},L=e=>e&&e.attributes?Qo(e.attributes).reduce((e,t)=>{var i=Wl[t.name]||Wl.DEFAULT;return e[t.name]=i(t.value),e},{}):{},Gl={"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","urn:mpeg:dash:mp4protection:2011":"mp4protection"},Xl=(e,t)=>t.length?Yo(e.map(function(s){return t.map(function(e){var t=zl(e),i=Bn(s.baseUrl,t),e=D(L(e),{baseUrl:i});return i!==t&&!e.serviceLocation&&s.serviceLocation&&(e.serviceLocation=s.serviceLocation),e})})):e,Kl=e=>{var t=P(e,"SegmentTemplate")[0],i=P(e,"SegmentList")[0],s=i&&P(i,"SegmentURL").map(e=>D({tag:"SegmentURL"},L(e))),e=P(e,"SegmentBase")[0],r=i||t,r=r&&P(r,"SegmentTimeline")[0],n=i||e||t,n=n&&P(n,"Initialization")[0],t=t&&L(t);t&&n?t.initialization=n&&L(n):t&&t.initialization&&(t.initialization={sourceURL:t.initialization});let a={template:t,segmentTimeline:r&&P(r,"S").map(e=>L(e)),list:i&&D(L(i),{segmentUrls:s,initialization:L(n)}),base:e&&D(L(e),{initialization:L(n)})};return Object.keys(a).forEach(e=>{a[e]||delete a[e]}),a},Yl=(r,n,a)=>e=>{var t=P(e,"BaseURL"),t=Xl(n,t);let i=D(r,L(e)),s=Kl(e);return t.map(e=>({segmentInfo:D(a,s),attributes:D(i,e)}))},Ql=e=>e.reduce((e,t)=>{var i=L(t),s=(i.schemeIdUri&&(i.schemeIdUri=i.schemeIdUri.toLowerCase()),Gl[i.schemeIdUri]);return s&&(e[s]={attributes:i},i=P(t,"cenc:pssh")[0])&&(t=zl(i),e[s].pssh=t&&Fn(t)),e},{}),Jl=e=>{return"urn:scte:dash:cc:cea-608:2015"===e.schemeIdUri?("string"!=typeof e.value?[]:e.value.split(";")).map(e=>{let t,i;return i=e,/^CC\d=/.test(e)?[t,i]=e.split("="):/^CC\d$/.test(e)&&(t=e),{channel:t,language:i}}):"urn:scte:dash:cc:cea-708:2015"===e.schemeIdUri?("string"!=typeof e.value?[]:e.value.split(";")).map(e=>{let i={channel:void 0,language:void 0,aspectRatio:1,easyReader:0,"3D":0};var t,s;return/=/.test(e)?([t,s=""]=e.split("="),i.channel=t,i.language=e,s.split(",").forEach(e=>{var[e,t]=e.split(":");"lang"===e?i.language=t:"er"===e?i.easyReader=Number(t):"war"===e?i.aspectRatio=Number(t):"3D"===e&&(i["3D"]=Number(t))})):i.language=e,i.channel&&(i.channel="SERVICE"+i.channel),i}):void 0},Zl=o=>Yo(P(o.node,"EventStream").map(e=>{let n=L(e),a=n.schemeIdUri;return P(e,"Event").map(e=>{var t=L(e),i=t.presentationTime||0,s=n.timescale||1,r=t.duration||0,i=i/s+o.attributes.start;return{schemeIdUri:a,value:n.value,id:t.id,start:i,end:i+r/s,messageData:zl(e)||t.messageData,contentEncoding:n.contentEncoding,presentationTimeOffset:n.presentationTimeOffset||0}})})),ed=(n,a,o)=>e=>{var t=L(e),i=Xl(a,P(e,"BaseURL")),s=P(e,"Role")[0],s={role:L(s)};let r=D(n,t,s);t=P(e,"Accessibility")[0],s=Jl(L(t)),s&&(r=D(r,{captionServices:s})),t=P(e,"Label")[0],t&&t.childNodes.length&&(s=t.childNodes[0].nodeValue.trim(),r=D(r,{label:s})),t=Ql(P(e,"ContentProtection")),Object.keys(t).length&&(r=D(r,{contentProtection:t})),s=Kl(e),t=P(e,"Representation"),e=D(o,s);return Yo(t.map(Yl(r,i,e)))},td=(n,a)=>(e,t)=>{var i=Xl(a,P(e.node,"BaseURL")),s=D(n,{periodStart:e.attributes.start}),r=("number"==typeof e.attributes.duration&&(s.periodDuration=e.attributes.duration),P(e.node,"AdaptationSet")),e=Kl(e.node);return Yo(r.map(ed(s,i,e)))},id=(e,t)=>{return 1"number"==typeof e.start?e.start:t&&"number"==typeof t.start&&"number"==typeof t.duration?t.start+t.duration:t||"static"!==i?null:0,rd=(e,t={})=>{var{manifestUri:t="",NOW:i=Date.now(),clientOffset:s=0,eventHandler:r=function(){}}=t,n=P(e,"Period");if(!n.length)throw new Error(el.INVALID_NUMBER_OF_PERIOD);var a=P(e,"Location");let o=L(e);t=Xl([{baseUrl:t}],P(e,"BaseURL")),e=P(e,"ContentSteering");o.type=o.type||"static",o.sourceDuration=o.mediaPresentationDuration||0,o.NOW=i,o.clientOffset=s,a.length&&(o.locations=a.map(zl));let l=[];return n.forEach((e,t)=>{var i=L(e),t=l[t-1];i.start=sd({attributes:i,priorPeriodAttributes:t?t.attributes:null,mpdType:o.type}),l.push({node:e,attributes:i})}),{locations:o.locations,contentSteeringInfo:id(e,r),representationInfo:Yo(l.map(td(o,t))),eventStream:Yo(l.map(Zl))}},nd=e=>{if(""===e)throw new Error(el.DASH_EMPTY_MANIFEST);var t,i=new Wo;let s;try{t=i.parseFromString(e,"application/xml"),s=t&&"MPD"===t.documentElement.tagName?t.documentElement:null}catch(e){}if(!s||s&&0(e=>{e=P(e,"UTCTiming")[0];if(!e)return null;var t=L(e);switch(t.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":t.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":t.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":t.method="DIRECT",t.value=Date.parse(t.value);break;default:throw new Error(el.UNSUPPORTED_UTC_TIMING_SCHEME)}return t})(nd(e));function od(e,t){var i,s,r;return void 0===t&&(t=0),(e=w(e)).length-t<10||!k(e,md,{offset:t})?t:(t+=(void 0===(s=t)&&(s=0),r=(i=w(i=e))[s+5],i=i[s+6]<<21|i[s+7]<<14|i[s+8]<<7|i[s+9],(16&r)>>4?20+i:10+i),od(e,t))}function ld(e,t,i){var s;return i>=t.length?t.length:(s=Td(t,i,!1),k(e.bytes,s.bytes)?i:ld(e,t,i+(e=Td(t,i+s.length)).length+e.value+s.length))}function dd(e,t){i=t,t=Array.isArray(i)?i.map(function(e){return Sd(e)}):[Sd(i)],e=w(e);var i,s=[];if(t.length)for(var r=0;re.length?e.length:o+a.value),o=e.subarray(o,l);k(t[0],n.bytes)&&(1===t.length?s.push(o):s=s.concat(dd(o,t.slice(1)))),r+=n.length+a.length+o.length}return s}function hd(e,t,i,s){void 0===s&&(s=1/0),e=w(e),i=[].concat(i);for(var r,n=0,a=0;n>1&63),-1!==i.indexOf(l)&&(r=n+o),n+=o+("h264"===t?1:2)}else n++}return e.subarray(0,0)}var ud=Math.pow(2,32),cd=function(e){var t,e=new DataView(e.buffer,e.byteOffset,e.byteLength);return e.getBigUint64?(t=e.getBigUint64(0))>>7,referencedSize:2147483647&t.getUint32(s),subsegmentDuration:t.getUint32(s+4),startsWithSap:!!(128&e[s+8]),sapType:(112&e[s+8])>>>4,sapDeltaTime:268435455&t.getUint32(s+8)});return i},md=w([73,68,51]),gd=function(e){return"string"==typeof e?ga(e):e},fd=function(e){return Array.isArray(e)?e.map(function(e){return gd(e)}):[gd(e)]},yd=function e(t,i,s){void 0===s&&(s=!1),i=fd(i),t=w(t);var r=[];if(i.length)for(var n=0;n>>0,o=t.subarray(n+4,n+8);if(0==a)break;a=n+a;if(a>t.length){if(s)break;a=t.length}var l=t.subarray(n+8,a);k(o,i[0])&&(1===i.length?r.push(l):r.push.apply(r,e(l,i.slice(1),s))),n=a}return r},_d={EBML:w([26,69,223,163]),DocType:w([66,130]),Segment:w([24,83,128,103]),SegmentInfo:w([21,73,169,102]),Tracks:w([22,84,174,107]),Track:w([174]),TrackNumber:w([215]),DefaultDuration:w([35,227,131]),TrackEntry:w([174]),TrackType:w([131]),FlagDefault:w([136]),CodecID:w([134]),CodecPrivate:w([99,162]),VideoTrack:w([224]),AudioTrack:w([225]),Cluster:w([31,67,182,117]),Timestamp:w([231]),TimestampScale:w([42,215,177]),BlockGroup:w([160]),BlockDuration:w([155]),Block:w([161]),SimpleBlock:w([163])},vd=[128,64,32,16,8,4,2,1],bd=function(e){for(var t=1,i=0;it&&t.responseURL&&e!==t.responseURL?t.responseURL:e,Md=e=>E.log.debug?E.log.debug.bind(E,"VHS:",e+" >"):function(){};function O(...e){var t=E.obj||E;return(t.merge||t.mergeOptions).apply(t,e)}function Ud(...e){var t=E.time||E;return(t.createTimeRanges||t.createTimeRanges).apply(t,e)}function Bd(e,i){return Wd(e,function(e,t){return e-$d<=i&&t+$d>=i})}function Fd(e,t){return Wd(e,function(e){return e-zd>=t})}function qd(e){if(e&&e.length&&e.end)return e.end(e.length-1)}function jd(t,i){let s=0;if(t&&t.length)for(let e=0;e{var i=[];if(!t||!t.length)return"";for(let e=0;e "+t.end(e));return i.join(", ")},Xd=t=>{var i=[];for(let e=0;e{if(!e.preload)return e.duration;let i=0;return(e.parts||[]).forEach(function(e){i+=e.duration}),(e.preloadHints||[]).forEach(function(e){"PART"===e.type&&(i+=t.partTargetDuration)}),i},Yd=e=>(e.segments||[]).reduce((i,s,r)=>(s.parts?s.parts.forEach(function(e,t){i.push({duration:e.duration,segmentIndex:r,partIndex:t,part:e,segment:s})}):i.push({duration:s.duration,segmentIndex:r,partIndex:null,segment:s,part:null}),i),[]),Qd=e=>{e=e.segments&&e.segments.length&&e.segments[e.segments.length-1];return e&&e.parts||[]},Jd=({preloadSegment:e})=>{var t;if(e)return{parts:e,preloadHints:t}=e,(t||[]).reduce((e,t)=>e+("PART"===t.type?1:0),0)+(e&&e.length?e.length:0)},Zd=(e,t)=>{return t.endList?0:e&&e.suggestedPresentationDelay?e.suggestedPresentationDelay:(e=0Date.now()}function nh(e){return e.excludeUntil&&e.excludeUntil===1/0}function ah(e){var t=rh(e);return!e.disabled&&!t}function oh(e,t){return t.attributes&&t.attributes[e]}function lh(e,t){var i,s=e&&e.mediaGroups&&e.mediaGroups.AUDIO||{};let r=!1;for(i in s){for(var n in s[i])if(r=t(s[i][n]))break;if(r)break}return!!r}let dh=(e,t)=>{if(1===e.playlists.length)return!0;let i=t.attributes.BANDWIDTH||Number.MAX_VALUE;return 0===e.playlists.filter(e=>!!ah(e)&&(e.attributes.BANDWIDTH||0)!(!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)),uh=i=>{if(!i||!i.playlists||!i.playlists.length)return lh(i,e=>e.playlists&&e.playlists.length||e.uri);for(let e=0;eXn(e))){s=lh(i,e=>hh(t,e));if(!s)return!1}}return!0};var ch={liveEdgeDelay:Zd,duration:sh,seekable:function(e,t,i){var s=t||0;let r=Vd(e,t,!0,i);return null===r?Ud():Ud(s,r=rzd),m=0===o,p=p&&0<=o+zd;if(!m&&!p||e===l.length-1){if(a){if(0e+"-"+t,gh=(e,t,i)=>`placeholder-uri-${e}-${t}-`+i,fh=(r,n)=>{r.mediaGroups&&["AUDIO","SUBTITLES"].forEach(e=>{if(r.mediaGroups[e])for(var t in r.mediaGroups[e])for(var i in r.mediaGroups[e][t]){var s=r.mediaGroups[e][t][i];n(s,e,t,i)}})},yh=({playlist:e,uri:t,id:i})=>{e.id=i,e.playlistErrors_=0,t&&(e.uri=t),e.attributes=e.attributes||{}},_h=(o,e,l=gh)=>{o.uri=e;for(let e=0;e{if(!e.playlists||!e.playlists.length){if(i&&"AUDIO"===r&&!e.uri)for(let e=0;e{let t=e.playlists.length;for(;t--;){var i=e.playlists[t];yh({playlist:i,id:mh(t,i.uri)}),i.resolvedUri=Rd(e.uri,i.uri),e.playlists[i.id]=i,(e.playlists[i.uri]=i).attributes.BANDWIDTH||ph.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}})(o),s=o,fh(s,e=>{e.uri&&(e.resolvedUri=Rd(s.uri,e.uri))})};class vh{constructor(){this.offset_=null,this.pendingDateRanges_=new Map,this.processedDateRanges_=new Map}setOffset(e=[]){null===this.offset_&&e.length&&([e]=e,void 0!==e.programDateTime)&&(this.offset_=e.programDateTime/1e3)}setPendingDateRanges(e=[]){var t;e.length&&([t]=e,t=t.startDate.getTime(),this.trimProcessedDateRanges_(t),this.pendingDateRanges_=e.reduce((e,t)=>(e.set(t.id,t),e),new Map))}processDateRange(e){this.pendingDateRanges_.delete(e.id),this.processedDateRanges_.set(e.id,e)}getDateRangesToProcess(){if(null===this.offset_)return[];let i={},s=[];this.pendingDateRanges_.forEach((e,t)=>{this.processedDateRanges_.has(t)||(e.startTime=e.startDate.getTime()/1e3-this.offset_,e.processDateRange=()=>this.processDateRange(e),s.push(e),e.class&&(i[e.class]?(t=i[e.class].push(e),e.classListIndex=t-1):(i[e.class]=[e],e.classListIndex=0)))});for(var e of s){var t=i[e.class]||[];e.endDate?e.endTime=e.endDate.getTime()/1e3-this.offset_:e.endOnNext&&t[e.classListIndex+1]?e.endTime=t[e.classListIndex+1].startTime:e.duration?e.endTime=e.startTime+e.duration:e.plannedDuration?e.endTime=e.startTime+e.plannedDuration:e.endTime=e.startTime}return s}trimProcessedDateRanges_(i){new Map(this.processedDateRanges_).forEach((e,t)=>{e.startDate.getTime(){var r=t.status<200||299{if(!t)return i;var s=O(t,i);if(t.preloadHints&&!i.preloadHints&&delete s.preloadHints,t.parts&&!i.parts)delete s.parts;else if(t.parts&&i.parts)for(let e=0;e{!e.resolvedUri&&e.uri&&(e.resolvedUri=Rd(t,e.uri)),e.key&&!e.key.resolvedUri&&(e.key.resolvedUri=Rd(t,e.key.uri)),e.map&&!e.map.resolvedUri&&(e.map.resolvedUri=Rd(t,e.map.uri)),e.map&&e.map.key&&!e.map.key.resolvedUri&&(e.map.key.resolvedUri=Rd(t,e.map.key.uri)),e.parts&&e.parts.length&&e.parts.forEach(e=>{e.resolvedUri||(e.resolvedUri=Rd(t,e.uri))}),e.preloadHints&&e.preloadHints.length&&e.preloadHints.forEach(e=>{e.resolvedUri||(e.resolvedUri=Rd(t,e.uri))})},Eh=(e,t)=>e===t||e.segments&&t.segments&&e.segments.length===t.segments.length&&e.endList===t.endList&&e.mediaSequence===t.mediaSequence&&e.preloadSegment===t.preloadSegment,Ch=(e,r,t=Eh)=>{var i=O(e,{}),s=i.playlists[r.id];if(!s)return null;if(t(s,r))return null;r.segments=Th(r);let n=O(s,r);if(n.preloadSegment&&!r.preloadSegment&&delete n.preloadSegment,s.segments){if(r.skip){r.segments=r.segments||[];for(let e=0;e{var s=e.slice(),r=t.slice(),n=(i=i||0,[]);let a;for(let e=0;e{wh(e,n.resolvedUri)});for(let e=0;e{if(t.playlists)for(let e=0;e{var i=e.segments||[],i=i[i.length-1],s=i&&i.parts&&i.parts[i.parts.length-1],s=s&&s.duration||i&&i.duration;return t&&s?1e3*s:500*(e.partTargetDuration||e.targetDuration||10)},Ih=(e,t,i)=>{if(e){let r=[];return e.forEach(e=>{var t,i,s;e.attributes&&({BANDWIDTH:t,RESOLUTION:i,CODECS:s}=e.attributes,r.push({id:e.id,bandwidth:t,resolution:i,codecs:s}))}),{type:t,isLive:i,renditions:r}}};class xh extends Jr{constructor(e,t,i={}){if(super(),!e)throw new Error("A non-empty playlist URL or object is required");this.logger_=Md("PlaylistLoader");var{withCredentials:s=!1}=i,e=(this.src=e,this.vhs_=t,this.withCredentials=s,this.addDateRangesToTextTrack_=i.addDateRangesToTextTrack,t.options_);this.customTagParsers=e&&e.customTagParsers||[],this.customTagMappers=e&&e.customTagMappers||[],this.llhls=e&&e.llhls,this.dateRangesStorage_=new vh,this.state="HAVE_NOTHING",this.handleMediaupdatetimeout_=this.handleMediaupdatetimeout_.bind(this),this.on("mediaupdatetimeout",this.handleMediaupdatetimeout_),this.on("loadedplaylist",this.handleLoadedPlaylist_.bind(this))}handleLoadedPlaylist_(){var e=this.media();e&&(this.dateRangesStorage_.setOffset(e.segments),this.dateRangesStorage_.setPendingDateRanges(e.dateRanges),(e=this.dateRangesStorage_.getDateRangesToProcess()).length)&&this.addDateRangesToTextTrack_&&this.addDateRangesToTextTrack_(e)}handleMediaupdatetimeout_(){if("HAVE_METADATA"===this.state){var t=this.media();let e=Rd(this.main.uri,t.uri);this.llhls&&(e=((e,t)=>{if(!t.endList&&t.serverControl){let i={};if(t.serverControl.canBlockReload){var s,r=t.preloadSegment;let e=t.mediaSequence+t.segments.length;r&&(r=r.parts||[],-1<(s=Jd(t)-1)&&s!=r.length-1&&(i._HLS_part=s),-1{if(this.request)return e?this.playlistRequestError(this.request,this.media(),"HAVE_METADATA"):void this.haveMetadata({playlistString:this.request.responseText,url:this.media().uri,id:this.media().id})})}}playlistRequestError(e,t,i){var{uri:t,id:s}=t;this.request=null,i&&(this.state=i),this.error={playlist:this.main.playlists[s],status:e.status,message:`HLS playlist request error at URL: ${t}.`,responseText:e.responseText,code:500<=e.status?4:2,metadata:bh({requestType:e.requestType,request:e,error:e.error})},this.trigger("error")}parseManifest_({url:t,manifestString:e}){try{return(({onwarn:t,oninfo:e,manifestString:i,customTagParsers:s=[],customTagMappers:r=[],llhls:n})=>{let a=new Gn,o=(t&&a.on("warn",t),e&&a.on("info",e),s.forEach(e=>a.addParser(e)),r.forEach(e=>a.addTagMapper(e)),a.push(i),a.end(),a.manifest);if(n||(["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach(function(e){o.hasOwnProperty(e)&&delete o[e]}),o.segments&&o.segments.forEach(function(t){["parts","preloadHints"].forEach(function(e){t.hasOwnProperty(e)&&delete t[e]})})),!o.targetDuration){let e=10;o.segments&&o.segments.length&&(e=o.segments.reduce((e,t)=>Math.max(e,t.duration),0)),t&&t({message:"manifest has no targetDuration defaulting to "+e}),o.targetDuration=e}e=Qd(o);return e.length&&!o.partTargetDuration&&(s=e.reduce((e,t)=>Math.max(e,t.duration),0),t&&(t({message:"manifest has no partTargetDuration defaulting to "+s}),ph.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.")),o.partTargetDuration=s),o})({onwarn:({message:e})=>this.logger_(`m3u8-parser warn for ${t}: `+e),oninfo:({message:e})=>this.logger_(`m3u8-parser info for ${t}: `+e),manifestString:e,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers,llhls:this.llhls})}catch(e){this.error=e,this.error.metadata={errorType:E.Error.StreamingHlsPlaylistParserError,error:e}}}haveMetadata({playlistString:e,playlistObject:t,url:i,id:s}){this.request=null,this.state="HAVE_METADATA";var r={playlistInfo:{type:"media",uri:i}},t=(this.trigger({type:"playlistparsestart",metadata:r}),t||this.parseManifest_({url:i,manifestString:e})),e=(t.lastRequest=Date.now(),yh({playlist:t,uri:i,id:s}),Ch(this.main,t));this.targetDuration=t.partTargetDuration||t.targetDuration,this.pendingMedia_=null,e?(this.main=e,this.media_=this.main.playlists[s]):this.trigger("playlistunchanged"),this.updateMediaUpdateTimeout_(kh(this.media(),!!e)),r.parsedPlaylist=Ih(this.main.playlists,r.playlistInfo.type,!this.media_.endList),this.trigger({type:"playlistparsecomplete",metadata:r}),this.trigger("loadedplaylist")}dispose(){this.trigger("dispose"),this.stopRequest(),window.clearTimeout(this.mediaUpdateTimeout),window.clearTimeout(this.finalRenditionTimeout),this.dateRangesStorage_=new vh,this.off()}stopRequest(){var e;this.request&&(e=this.request,this.request=null,e.onreadystatechange=null,e.abort())}media(r,e){if(!r)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);if("string"==typeof r){if(!this.main.playlists[r])throw new Error("Unknown playlist URI: "+r);r=this.main.playlists[r]}if(window.clearTimeout(this.finalRenditionTimeout),e)e=(r.partTargetDuration||r.targetDuration)/2*1e3||5e3,this.finalRenditionTimeout=window.setTimeout(this.media.bind(this,r,!1),e);else{let s=this.state;var e=!this.media_||r.id!==this.media_.id,t=this.main.playlists[r.id];if(t&&t.endList||r.endList&&r.segments.length)this.request&&(this.request.onreadystatechange=null,this.request.abort(),this.request=null),this.state="HAVE_METADATA",this.media_=r,e&&(this.trigger("mediachanging"),"HAVE_MAIN_MANIFEST"===s?this.trigger("loadedmetadata"):this.trigger("mediachange"));else if(this.updateMediaUpdateTimeout_(kh(r,!0)),e){if(this.state="SWITCHING_MEDIA",this.request){if(r.resolvedUri===this.request.url)return;this.request.onreadystatechange=null,this.request.abort(),this.request=null}this.media_&&this.trigger("mediachanging");let i={playlistInfo:{type:"media",uri:(this.pendingMedia_=r).uri}};this.trigger({type:"playlistrequeststart",metadata:i}),this.request=this.vhs_.xhr({uri:r.resolvedUri,withCredentials:this.withCredentials,requestType:"hls-playlist"},(e,t)=>{if(this.request){if(r.lastRequest=Date.now(),r.resolvedUri=Nd(r.resolvedUri,t),e)return this.playlistRequestError(this.request,r,s);this.trigger({type:"playlistrequestcomplete",metadata:i}),this.haveMetadata({playlistString:t.responseText,url:r.uri,id:r.id}),"HAVE_MAIN_MANIFEST"===s?this.trigger("loadedmetadata"):this.trigger("mediachange")}})}}}pause(){this.mediaUpdateTimeout&&(window.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_MAIN_MANIFEST":"HAVE_CURRENT_METADATA"===this.state&&(this.state="HAVE_METADATA")}load(e){this.mediaUpdateTimeout&&(window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);var t=this.media();e?(e=t?(t.partTargetDuration||t.targetDuration)/2*1e3:5e3,this.mediaUpdateTimeout=window.setTimeout(()=>{this.mediaUpdateTimeout=null,this.load()},e)):this.started?t&&!t.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist"):this.start()}updateMediaUpdateTimeout_(e){this.mediaUpdateTimeout&&(window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.media()&&!this.media().endList&&(this.mediaUpdateTimeout=window.setTimeout(()=>{this.mediaUpdateTimeout=null,this.trigger("mediaupdatetimeout"),this.updateMediaUpdateTimeout_(e)},e))}start(){if(this.started=!0,"object"==typeof this.src)this.src.uri||(this.src.uri=window.location.href),this.src.resolvedUri=this.src.uri,setTimeout(()=>{this.setupInitialPlaylist(this.src)},0);else{let i={playlistInfo:{type:"multivariant",uri:this.src}};this.trigger({type:"playlistrequeststart",metadata:i}),this.request=this.vhs_.xhr({uri:this.src,withCredentials:this.withCredentials,requestType:"hls-playlist"},(e,t)=>{if(this.request){if(this.request=null,e)return this.error={status:t.status,message:`HLS playlist request error at URL: ${this.src}.`,responseText:t.responseText,code:2,metadata:bh({requestType:t.requestType,request:t,error:e})},"HAVE_NOTHING"===this.state&&(this.started=!1),this.trigger("error");this.trigger({type:"playlistrequestcomplete",metadata:i}),this.src=Nd(this.src,t),this.trigger({type:"playlistparsestart",metadata:i});e=this.parseManifest_({manifestString:t.responseText,url:this.src});i.parsedPlaylist=Ih(e.playlists,i.playlistInfo.type,!1),this.trigger({type:"playlistparsecomplete",metadata:i}),this.setupInitialPlaylist(e)}})}}srcUri(){return"string"==typeof this.src?this.src:this.src.uri}setupInitialPlaylist(e){var t,i,s,r;this.state="HAVE_MAIN_MANIFEST",e.playlists?(this.main=e,_h(this.main,this.srcUri()),e.playlists.forEach(t=>{t.segments=Th(t),t.segments.forEach(e=>{wh(e,t.resolvedUri)})}),this.trigger("loadedplaylist"),this.request||this.media(this.main.playlists[0])):(t=this.srcUri()||window.location.href,this.main=(i=t,s=mh(0,i),(r={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:window.location.href,resolvedUri:window.location.href,playlists:[{uri:i,id:s,resolvedUri:i,attributes:{}}]}).playlists[s]=r.playlists[0],r.playlists[i]=r.playlists[0],r),this.haveMetadata({playlistObject:e,url:t,id:this.main.playlists[0].id}),this.trigger("loadedmetadata"))}updateOrDeleteClone(e,t){var i=this.main,s=e.ID;let r=i.playlists.length;for(;r--;){var n,a,o,l,d,h=i.playlists[r];h.attributes["PATHWAY-ID"]===s&&(n=h.resolvedUri,a=h.id,t?(o=this.createCloneURI_(h.resolvedUri,e),l=mh(s,o),d=this.createCloneAttributes_(s,h.attributes),h=this.createClonePlaylist_(h,l,e,d),i.playlists[r]=h,i.playlists[l]=h,i.playlists[o]=h):i.playlists.splice(r,1),delete i.playlists[a],delete i.playlists[n])}this.updateOrDeleteCloneMedia(e,t)}updateOrDeleteCloneMedia(e,t){let s=this.main,r=e.ID;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{if(s.mediaGroups[e]&&s.mediaGroups[e][r])for(var t in s.mediaGroups[e])if(t===r){for(var i in s.mediaGroups[e][t])s.mediaGroups[e][t][i].playlists.forEach((e,t)=>{var e=s.playlists[e.id],i=e.id,e=e.resolvedUri;delete s.playlists[i],delete s.playlists[e]});delete s.mediaGroups[e][t]}}),t&&this.createClonedMediaGroups_(e)}addClonePathway(e,t={}){var i=this.main,s=i.playlists.length,r=this.createCloneURI_(t.resolvedUri,e),n=mh(e.ID,r),a=this.createCloneAttributes_(e.ID,t.attributes),t=this.createClonePlaylist_(t,n,e,a);i.playlists[s]=t,i.playlists[n]=t,i.playlists[r]=t,this.createClonedMediaGroups_(e)}createClonedMediaGroups_(l){let d=l.ID,s=l["BASE-ID"],h=this.main;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(o=>{if(h.mediaGroups[o]&&!h.mediaGroups[o][d])for(var e in h.mediaGroups[o])if(e===s){h.mediaGroups[o][d]={};for(let a in h.mediaGroups[o][e]){var t=h.mediaGroups[o][e][a];h.mediaGroups[o][d][a]=f({},t);let n=h.mediaGroups[o][d][a];var i=this.createCloneURI_(t.resolvedUri,l);n.resolvedUri=i,n.uri=i,n.playlists=[],t.playlists.forEach((e,t)=>{var i,s=h.playlists[e.id],r=gh(o,d,a),r=mh(d,r);s&&!h.playlists[r]&&(i=(s=this.createClonePlaylist_(s,r,l)).resolvedUri,h.playlists[r]=s,h.playlists[i]=s),n.playlists[t]=this.createClonePlaylist_(e,r,l)})}}})}createClonePlaylist_(e,t,i,s){i=this.createCloneURI_(e.resolvedUri,i),i={resolvedUri:i,uri:i,id:t};return e.segments&&(i.segments=[]),s&&(i.attributes=s),O(e,i)}createCloneURI_(e,t){var i,s=new URL(e),r=(s.hostname=t["URI-REPLACEMENT"].HOST,t["URI-REPLACEMENT"].PARAMS);for(i of Object.keys(r))s.searchParams.set(i,r[i]);return s.href}createCloneAttributes_(t,i){let s={"PATHWAY-ID":t};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{i[e]&&(s[e]=t)}),s}getKeyIdSet(e){if(e.contentProtection){var t,i=new Set;for(t in e.contentProtection){var s=e.contentProtection[t].attributes.keyId;s&&i.add(s.toLowerCase())}return i}}}function Ah(e,t,i,s){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),s(t=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))),e)}function Dh(){function d(e,a){e=O({timeout:45e3},e);var t=d.beforeRequest||E.Vhs.xhr.beforeRequest,i=d._requestCallbackSet||E.Vhs.xhr._requestCallbackSet||new Set;let o=d._responseCallbackSet||E.Vhs.xhr._responseCallbackSet;t&&"function"==typeof t&&(E.log.warn("beforeRequest is deprecated, use onRequest instead."),i.add(t));var s=(!0===E.Vhs.xhr.original?E:E.Vhs).xhr,r=((e,i)=>{if(e&&e.size){let t=i;return e.forEach(e=>{t=e(t)}),t}})(i,e);i.delete(t);let l=s(r||e,function(e,t){var i,s,r,n;return i=o,s=l,r=e,n=t,i&&i.size&&i.forEach(e=>{e(s,r,n)}),Ah(l,e,t,a)}),n=l.abort;return l.abort=function(){return l.aborted=!0,n.apply(l,arguments)},l.uri=e.uri,l.requestType=e.requestType,l.requestTime=Date.now(),l}return d.original=!0,d}function Ph(e){var t={};return e.byterange&&(t.Range=function(e){let t;return"bytes="+e.offset+"-"+(t="bigint"==typeof e.offset||"bigint"==typeof e.length?window.BigInt(e.offset)+window.BigInt(e.length)-window.BigInt(1):e.offset+e.length-1)}(e.byterange)),t}function Lh(e,t){return e=e.toString(16),"00".substring(0,2-e.length)+e+(t%2?" ":"")}function Oh(e){return 32<=e&&e<126?String.fromCharCode(e):"."}function Rh(e){var t=e.byterange||{length:1/0,offset:0};return[t.length,t.offset,e.resolvedUri].join(",")}function Nh(e){return e.resolvedUri}let Mh=function(i){let s={};return Object.keys(i).forEach(e=>{var t=i[e];ua(t)?s[e]={bytes:t.buffer,byteOffset:t.byteOffset,byteLength:t.byteLength}:s[e]=t}),s},Uh=e=>{var t,i,s=Array.prototype.slice.call(e);let r="";for(let e=0;eUh(e),textRanges:e=>{let t="",i;for(i=0;ie.transmuxedPresentationEnd-e.transmuxedPresentationStart-e.transmuxerPrependedSeconds,qh=({playlist:e,time:t=void 0,callback:i})=>{var s,r;if(i)return e&&void 0!==t?(e=((t,i)=>{if(!i||!i.segments||0===i.segments.length)return null;let s=0,r;for(let e=0;es){if(t>s+e.duration*Bh)return null;r=e}return{segment:r,estimatedStart:r.videoTimingInfo?r.videoTimingInfo.transmuxedPresentationStart:s-r.duration,type:r.videoTimingInfo?"accurate":"estimate"}})(t,e))?"estimate"===e.type?i({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:e.estimatedStart}):(s={mediaSeconds:t},t=t,(r=(e=e.segment).dateTimeObject?(r=e.videoTimingInfo.transmuxerPrependedSeconds,t=t-(e.videoTimingInfo.transmuxedPresentationStart+r),new Date(e.dateTimeObject.getTime()+1e3*t)):null)&&(s.programDateTime=r.toISOString()),i(null,s)):i({message:"valid programTime was not found"}):i({message:"getProgramTime: playlist and time must be provided"});throw new Error("getProgramTime: callback must be provided")},jh=({programTime:e,playlist:t,retryCount:i=2,seekTo:s,pauseAfterSeek:r=!0,tech:n,callback:a})=>{var o,l,d;if(a)return"undefined"!=typeof e&&t&&s?t.endList||n.hasStarted_?(t=>{if(!t.segments||0===t.segments.length)return!1;for(let e=0;e{let i;try{i=new Date(e)}catch(e){return null}if(!t||!t.segments||0===t.segments.length)return null;let s=t.segments[0];if(ia?null:{segment:s=i>new Date(n)?e:s,estimatedStart:s.videoTimingInfo?s.videoTimingInfo.transmuxedPresentationStart:ch.duration(t,t.mediaSequence+t.segments.indexOf(s)),type:s.videoTimingInfo?"accurate":"estimate"}})(e,t))?(l=((e,t)=>{let i,s;try{i=new Date(e),s=new Date(t)}catch(e){}e=i.getTime();return(s.getTime()-e)/1e3})((o=d.segment).dateTimeObject,e),"estimate"===d.type?0===i?a({message:e+" is not buffered yet. Try again"}):(s(d.estimatedStart+l),void n.one("seeked",()=>{jh({programTime:e,playlist:t,retryCount:i-1,seekTo:s,pauseAfterSeek:r,tech:n,callback:a})})):(d=o.start+l,n.one("seeked",()=>a(null,n.currentTime())),r&&n.pause(),void s(d))):a({message:e+" was not found in the stream"}):a({message:"programDateTime tags must be provided in the manifest "+t.resolvedUri}):a({message:"player must be playing a live stream to start buffering"}):a({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"});throw new Error("seekToProgramTime: callback must be provided")},Hh=(e,t)=>{if(4===e.readyState)return t()},Vh=(e,t,r,s)=>{function n(e,t,i,s){return t.abort(),l=!0,r(e,t,i,s)}function i(e,t){var i;if(!l)return e?(e.metadata=bh({requestType:s,request:t,error:e}),n(e,t,"",a)):(i=t.responseText.substring(a&&a.byteLength||0,t.responseText.length),a=function(){for(var e,t,i,s=arguments.length,r=new Array(s),n=0;nn(e,t,"",a)):n(null,t,i,a))}let a=[],o,l=!1;let d=t({uri:e,beforeSend(e){e.overrideMimeType("text/plain; charset=x-user-defined"),e.addEventListener("progress",function({}){return Ah(e,null,{statusCode:e.status},i)})}},function(e,t){return Ah(d,e,t,i)});return d};e=E.EventTarget;function zh(t,i){if(!Eh(t,i))return!1;if(t.sidx&&i.sidx&&(t.sidx.offset!==i.sidx.offset||t.sidx.length!==i.sidx.length))return!1;if(!t.sidx&&i.sidx||t.sidx&&!i.sidx)return!1;if(t.segments&&!i.segments||!t.segments&&i.segments)return!1;if(t.segments||i.segments)for(let e=0;e{return`placeholder-uri-${e}-${t}-`+(s.attributes.NAME||i)},Wh=({mainXml:e,srcUrl:t,clientOffset:i,sidxMapping:s,previousManifest:r})=>{e=e,i={manifestUri:t,clientOffset:i,sidxMapping:s,previousManifest:r},e=rd(nd(e),i),s=Vl(e.representationInfo);r=Ll({dashPlaylists:s,locations:e.locations,contentSteering:e.contentSteeringInfo,sidxMapping:i.sidxMapping,previousManifest:i.previousManifest,eventStream:e.eventStream});return _h(r,t,$h),r},Gh=(e,t,i)=>{let a=!0,o=O(e,{duration:t.duration,minimumUpdatePeriod:t.minimumUpdatePeriod,timelineStarts:t.timelineStarts});for(let e=0;e{var r,n;e.playlists&&e.playlists.length&&(r=e.playlists[0].id,n=Ch(o,e.playlists[0],zh))&&(s in(o=n).mediaGroups[t][i]||(o.mediaGroups[t][i][s]=e),o.mediaGroups[t][i][s].playlists[0]=o.playlists[r],a=!1)}),n=o,l=t,fh(n,(e,t,i,s)=>{l.mediaGroups[t][i]&&s in l.mediaGroups[t][i]||delete n.mediaGroups[t][i][s]}),(a=t.minimumUpdatePeriod===e.minimumUpdatePeriod&&a)?null:o},Xh=(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},Kh=(e,t)=>{var i,s={};for(i in e){var r=e[i].sidx;if(r){var n=yl(r);if(!t[n])break;var a=t[n].sidxInfo;Xh(a,r)&&(s[n]=t[n])}}return s};class Yh extends e{constructor(e,t,i={},s){super(),this.mainPlaylistLoader_=s||this,s||(this.isMain_=!0);var{withCredentials:s=!1}=i;if(this.vhs_=t,this.withCredentials=s,this.addMetadataToTextTrack=i.addMetadataToTextTrack,!e)throw new Error("A non-empty playlist URL or object is required");this.on("minimumUpdatePeriod",()=>{this.refreshXml_()}),this.on("mediaupdatetimeout",()=>{this.refreshMedia_(this.media().id)}),this.state="HAVE_NOTHING",this.loadedPlaylists_={},this.logger_=Md("DashPlaylistLoader"),this.isMain_?(this.mainPlaylistLoader_.srcUrl=e,this.mainPlaylistLoader_.sidxMapping_={}):this.childPlaylist_=e}requestErrored_(e,t,i){return!this.request||(this.request=null,e?(this.error="object"!=typeof e||e instanceof Error?{status:t.status,message:"DASH request error at URL: "+t.uri,response:t.response,code:2,metadata:e.metadata}:e,i&&(this.state=i),this.trigger("error"),!0):void 0)}addSidxSegments_(l,r,n){let d=l.sidx&&yl(l.sidx);if(l.sidx&&d&&!this.mainPlaylistLoader_.sidxMapping_[d]){let a=Nd(l.sidx.resolvedUri),o=(t,i)=>{if(!this.requestErrored_(t,i,r)){var t=this.mainPlaylistLoader_.sidxMapping_,s=i.requestType;let e;try{e=pd(w(i.response).subarray(8))}catch(e){return e.metadata=bh({requestType:s,request:i,parseFailure:!0}),void this.requestErrored_(e,i,r)}return t[d]={sidxInfo:l.sidx,sidx:e},ll(l,e,l.sidx.resolvedUri),n(!0)}};this.request=Vh(a,this.vhs_.xhr,(e,t,i,s)=>{var r,n;return e?o(e,t):i&&"mp4"===i?({offset:r,length:n}=l.sidx.byterange,s.length>=n+r?o(e,{response:s.subarray(r,r+n),status:t.status,uri:t.uri}):void(this.request=this.vhs_.xhr({uri:a,responseType:"arraybuffer",requestType:"dash-sidx",headers:Ph({byterange:l.sidx.byterange})},o))):(e=i||"unknown",o({status:t.status,message:`Unsupported ${e} container type for sidx segment at URL: `+a,response:"",playlist:l,internal:!0,playlistExclusionDuration:1/0,code:2},t))},"dash-sidx")}else this.mediaRequest_=window.setTimeout(()=>n(!1),0)}dispose(){this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},window.clearTimeout(this.minimumUpdatePeriodTimeout_),window.clearTimeout(this.mediaRequest_),window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.mediaRequest_=null,this.minimumUpdatePeriodTimeout_=null,this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.off()}hasPendingRequest(){return this.request||this.mediaRequest_}stopRequest(){var e;this.request&&(e=this.request,this.request=null,e.onreadystatechange=null,e.abort())}media(t){if(!t)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);let i=this.state;if("string"==typeof t){if(!this.mainPlaylistLoader_.main.playlists[t])throw new Error("Unknown playlist URI: "+t);t=this.mainPlaylistLoader_.main.playlists[t]}var e=!this.media_||t.id!==this.media_.id;e&&this.loadedPlaylists_[t.id]&&this.loadedPlaylists_[t.id].endList?(this.state="HAVE_METADATA",this.media_=t,e&&(this.trigger("mediachanging"),this.trigger("mediachange"))):e&&(this.media_&&this.trigger("mediachanging"),this.addSidxSegments_(t,i,e=>{this.haveMetadata({startingState:i,playlist:t})}))}haveMetadata({startingState:e,playlist:t}){this.state="HAVE_METADATA",this.loadedPlaylists_[t.id]=t,this.mediaRequest_=null,this.refreshMedia_(t.id),"HAVE_MAIN_MANIFEST"===e?this.trigger("loadedmetadata"):this.trigger("mediachange")}pause(){this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.stopRequest(),window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMain_&&(window.clearTimeout(this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_),this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_=null),"HAVE_NOTHING"===this.state&&(this.started=!1)}load(e){window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;var t=this.media();e?(e=t?t.targetDuration/2*1e3:5e3,this.mediaUpdateTimeout=window.setTimeout(()=>this.load(),e)):this.started?t&&!t.endList?(this.isMain_&&!this.minimumUpdatePeriodTimeout_&&(this.trigger("minimumUpdatePeriod"),this.updateMinimumUpdatePeriodTimeout_()),this.trigger("mediaupdatetimeout")):this.trigger("loadedplaylist"):this.start()}start(){this.started=!0,this.isMain_?this.requestMain_((e,t)=>{this.haveMain_(),this.hasPendingRequest()||this.media_||this.media(this.mainPlaylistLoader_.main.playlists[0])}):this.mediaRequest_=window.setTimeout(()=>this.haveMain_(),0)}requestMain_(s){let r={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestrequeststart",metadata:r}),this.request=this.vhs_.xhr({uri:this.mainPlaylistLoader_.srcUrl,withCredentials:this.withCredentials,requestType:"dash-manifest"},(e,t)=>{var i;if(e&&(i=t.requestType,e.metadata=bh({requestType:i,request:t,error:e})),this.requestErrored_(e,t))"HAVE_NOTHING"===this.state&&(this.started=!1);else{this.trigger({type:"manifestrequestcomplete",metadata:r});let e=t.responseText!==this.mainPlaylistLoader_.mainXml_;if(this.mainPlaylistLoader_.mainXml_=t.responseText,t.responseHeaders&&t.responseHeaders.date?this.mainLoaded_=Date.parse(t.responseHeaders.date):this.mainLoaded_=Date.now(),this.mainPlaylistLoader_.srcUrl=Nd(this.mainPlaylistLoader_.srcUrl,t),!e)return s(t,e);this.handleMain_(),this.syncClientServerClock_(()=>s(t,e))}})}syncClientServerClock_(r){let n=ad(this.mainPlaylistLoader_.mainXml_);return null===n?(this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),r()):"DIRECT"===n.method?(this.mainPlaylistLoader_.clientOffset_=n.value-Date.now(),r()):void(this.request=this.vhs_.xhr({uri:Rd(this.mainPlaylistLoader_.srcUrl,n.value),method:n.method,withCredentials:this.withCredentials,requestType:"dash-clock-sync"},(t,i)=>{if(this.request){var s;if(t)return s=i.requestType,this.error.metadata=bh({requestType:s,request:i,error:t}),this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),r();let e;e="HEAD"===n.method?i.responseHeaders&&i.responseHeaders.date?Date.parse(i.responseHeaders.date):this.mainLoaded_:Date.parse(i.responseText),this.mainPlaylistLoader_.clientOffset_=e-Date.now(),r()}}))}haveMain_(){this.state="HAVE_MAIN_MANIFEST",this.isMain_?this.trigger("loadedplaylist"):this.media_||this.media(this.childPlaylist_)}handleMain_(){this.mediaRequest_=null;var e=this.mainPlaylistLoader_.main,i={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestparsestart",metadata:i});let s;try{s=Wh({mainXml:this.mainPlaylistLoader_.mainXml_,srcUrl:this.mainPlaylistLoader_.srcUrl,clientOffset:this.mainPlaylistLoader_.clientOffset_,sidxMapping:this.mainPlaylistLoader_.sidxMapping_,previousManifest:e})}catch(e){this.error=e,this.error.metadata={errorType:E.Error.StreamingDashManifestParserError,error:e},this.trigger("error")}e&&(s=Gh(e,s,this.mainPlaylistLoader_.sidxMapping_)),this.mainPlaylistLoader_.main=s||e;var r=this.mainPlaylistLoader_.main.locations&&this.mainPlaylistLoader_.main.locations[0];if(r&&r!==this.mainPlaylistLoader_.srcUrl&&(this.mainPlaylistLoader_.srcUrl=r),(!e||s&&s.minimumUpdatePeriod!==e.minimumUpdatePeriod)&&this.updateMinimumUpdatePeriodTimeout_(),this.addEventStreamToMetadataTrack_(s),s){var{duration:r,endList:e}=s;let t=[];s.playlists.forEach(e=>{t.push({id:e.id,bandwidth:e.attributes.BANDWIDTH,resolution:e.attributes.RESOLUTION,codecs:e.attributes.CODECS})});r={duration:r,isLive:!e,renditions:t};i.parsedManifest=r,this.trigger({type:"manifestparsecomplete",metadata:i})}return Boolean(s)}updateMinimumUpdatePeriodTimeout_(){var e=this.mainPlaylistLoader_;e.createMupOnMedia_&&(e.off("loadedmetadata",e.createMupOnMedia_),e.createMupOnMedia_=null),e.minimumUpdatePeriodTimeout_&&(window.clearTimeout(e.minimumUpdatePeriodTimeout_),e.minimumUpdatePeriodTimeout_=null);let t=e.main&&e.main.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)}createMUPTimeout_(e){let t=this.mainPlaylistLoader_;t.minimumUpdatePeriodTimeout_=window.setTimeout(()=>{t.minimumUpdatePeriodTimeout_=null,t.trigger("minimumUpdatePeriod"),t.createMUPTimeout_(e)},e)}refreshXml_(){this.requestMain_((e,t)=>{t&&(this.media_&&(this.media_=this.mainPlaylistLoader_.main.playlists[this.media_.id]),this.mainPlaylistLoader_.sidxMapping_=((e,r)=>{let n=Kh(e.playlists,r);return fh(e,(e,t,i,s)=>{e.playlists&&e.playlists.length&&(e=e.playlists,n=O(n,Kh(e,r)))}),n})(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.sidxMapping_),this.addSidxSegments_(this.media(),this.state,e=>{this.refreshMedia_(this.media().id)}))})}refreshMedia_(e){if(!e)throw new Error("refreshMedia_ must take a media id");this.media_&&this.isMain_&&this.handleMain_();var t=this.mainPlaylistLoader_.main.playlists;let i=!this.media_||this.media_!==t[e];if(i?this.media_=t[e]:this.trigger("playlistunchanged"),!this.mediaUpdateTimeout){let e=()=>{this.media().endList||(this.mediaUpdateTimeout=window.setTimeout(()=>{this.trigger("mediaupdatetimeout"),e()},kh(this.media(),Boolean(i))))};e()}this.trigger("loadedplaylist")}addEventStreamToMetadataTrack_(e){e&&this.mainPlaylistLoader_.main.eventStream&&(e=this.mainPlaylistLoader_.main.eventStream.map(e=>({cueTime:e.start,frames:[{data:e.messageData}]})),this.addMetadataToTextTrack("EventStream",e,this.mainPlaylistLoader_.main.duration))}getKeyIdSet(e){if(e.contentProtection){var t,i=new Set;for(t in e.contentProtection){var s=e.contentProtection[t].attributes["cenc:default_KID"];s&&i.add(s.replace(/-/g,"").toLowerCase())}return i}}}var R={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};function Qh(e){return e.on=e.addEventListener,e.off=e.removeEventListener,e}let Jh=t=>{var i=new Uint8Array(new ArrayBuffer(t.length));for(let e=0;e>>1,e.samplingfrequencyindex<<7|e.channelcount<<3,6,1,2]))},X=function(e){return l(d.hdlr,re[e])},G=function(e){var t=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&&(t[12]=e.samplerate>>>24&255,t[13]=e.samplerate>>>16&255,t[14]=e.samplerate>>>8&255,t[15]=255&e.samplerate),l(d.mdhd,t)},W=function(e){return l(d.mdia,G(e),X(e.type),q(e))},F=function(e){return l(d.mfhd,new Uint8Array([0,0,0,0,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e]))},q=function(e){return l(d.minf,"video"===e.type?l(d.vmhd,ne):l(d.smhd,ae),M(),Y(e))},H=function(e){for(var t=e.length,i=[];t--;)i[t]=Z(e[t]);return l.apply(null,[d.mvex].concat(i))},V=function(e){e=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 l(d.mvhd,e)},K=function(e){for(var t,i=e.samples||[],s=new Uint8Array(4+i.length),r=0;r>>8),n.push(255&s[o].byteLength),n=n.concat(Array.prototype.slice.call(s[o]));for(o=0;o>>8),a.push(255&r[o].byteLength),a=a.concat(Array.prototype.slice.call(r[o]));return t=[d.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]),l(d.avcC,new Uint8Array([1,e.profileIdc,e.profileCompatibility,e.levelIdc,255].concat([s.length],n,[r.length],a))),l(d.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],e.sarRatio&&(i=e.sarRatio[0],e=e.sarRatio[1],t.push(l(d.pasp,new Uint8Array([(4278190080&i)>>24,(16711680&i)>>16,(65280&i)>>8,255&i,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e])))),l.apply(null,t)},pe=function(e){return l(d.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]),U(e))},$=function(e){e=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 l(d.tkhd,e)},J=function(e){var t,i=l(d.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/be),r=Math.floor(e.baseMediaDecodeTime%be),s=l(d.tfdt,new Uint8Array([1,0,0,0,s>>>24&255,s>>>16&255,s>>>8&255,255&s,r>>>24&255,r>>>16&255,r>>>8&255,255&r]));return"audio"===e.type?(t=ee(e,92),l(d.traf,i,s,t)):(r=K(e),t=ee(e,r.length+92),l(d.traf,i,s,t,r))},z=function(e){return e.duration=e.duration||4294967295,l(d.trak,$(e),W(e))},Z=function(e){var t=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&&(t[t.length-1]=0),l(d.trex,t)},me=function(e,t){var i=0,s=0,r=0,n=0;return e.length&&(void 0!==e[0].duration&&(i=1),void 0!==e[0].size&&(s=2),void 0!==e[0].flags&&(r=4),void 0!==e[0].compositionTimeOffset)&&(n=8),[0,0,i|s|r|n,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]},ge=function(e,t){var i,s,r,n,a=e.samples||[];for(t+=20+16*a.length,e=me(a,t),(s=new Uint8Array(e.length+16*a.length)).set(e),i=e.length,n=0;n>>24,s[i++]=(16711680&r.duration)>>>16,s[i++]=(65280&r.duration)>>>8,s[i++]=255&r.duration,s[i++]=(4278190080&r.size)>>>24,s[i++]=(16711680&r.size)>>>16,s[i++]=(65280&r.size)>>>8,s[i++]=255&r.size,s[i++]=r.flags.isLeading<<2|r.flags.dependsOn,s[i++]=r.flags.isDependedOn<<6|r.flags.hasRedundancy<<4|r.flags.paddingValue<<1|r.flags.isNonSyncSample,s[i++]=61440&r.flags.degradationPriority,s[i++]=15&r.flags.degradationPriority,s[i++]=(4278190080&r.compositionTimeOffset)>>>24,s[i++]=(16711680&r.compositionTimeOffset)>>>16,s[i++]=(65280&r.compositionTimeOffset)>>>8,s[i++]=255&r.compositionTimeOffset;return l(d.trun,s)},fe=function(e,t){var i,s,r,n,a=e.samples||[];for(t+=20+8*a.length,e=me(a,t),(i=new Uint8Array(e.length+8*a.length)).set(e),s=e.length,n=0;n>>24,i[s++]=(16711680&r.duration)>>>16,i[s++]=(65280&r.duration)>>>8,i[s++]=255&r.duration,i[s++]=(4278190080&r.size)>>>24,i[s++]=(16711680&r.size)>>>16,i[s++]=(65280&r.size)>>>8,i[s++]=255&r.size;return l(d.trun,i)},ee=function(e,t){return("audio"===e.type?fe:ge)(e,t)};function Te(e,t){var i=Ae();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}function s(e){for(var t=[];e--;)t.push(0);return t}function r(e){e=e||{},r.prototype.init.call(this),this.parse708captions_="boolean"!=typeof e.parse708captions||e.parse708captions,this.captionPackets_=[],this.ccStreams_=[new p(0,0),new p(0,1),new p(1,0),new p(1,1)],this.parse708captions_&&(this.cc708Stream_=new c({captionServices:e.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")))}function Se(e){return 32<=e&&e<=127||160<=e&&e<=255}function n(e){this.windowNum=e,this.reset()}function we(e,t,i){this.serviceNum=e,this.text="",this.currentWindow=new n(-1),this.windows=[],this.stream=i,"string"==typeof t&&this.createTextDecoder(t)}function Ee(e){return null===e?"":(e=je[e]||e,String.fromCharCode(e))}function a(){for(var e=[],t=He+1;t--;)e.push({text:"",indent:0,offset:0});return e}function Ce(e,t){var i=1;for(tGe;)e+=i*We;return e}function ke(e){var t,i;ke.prototype.init.call(this),this.type_=e||"shared",this.push=function(e){"metadata"===e.type?this.trigger("data",e):"shared"!==this.type_&&e.type!==this.type_||(void 0===i&&(i=e.dts),e.dts=Ce(e.dts,i),e.pts=Ce(e.pts,i),t=e.dts,this.trigger("data",e))},this.flush=function(){i=t,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){t=i=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}}var Ie,xe={ftyp:B=function(){return l(d.ftyp,te,ie,te,se)},mdat:function(e){return l(d.mdat,e)},moof:function(e,t){for(var i=[],s=t.length;s--;)i[s]=J(t[s]);return l.apply(null,[d.moof,F(e)].concat(i))},moov:j=function(e){for(var t=e.length,i=[];t--;)i[t]=z(e[t]);return l.apply(null,[d.moov,V(4294967295)].concat(i).concat(H(e)))},initSegment:function(e){var t=B(),e=j(e),i=new Uint8Array(t.byteLength+e.byteLength);return i.set(t),i.set(e,t.byteLength),i}},Ae=function(){return{size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}},De={groupNalsIntoFrames:function(e){var t,i,s=[],r=[];for(r.byteLength=0,r.nalCount=0,t=s.byteLength=r.duration=0;tUe.ONE_SECOND_IN_TS/2))){for(a=(a=Me()[e.samplerate])||t[0].data,o=0;o=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)}))},generateSampleTable:function(e){for(var t=[],i=0;i=this.virtualRowCount&&"function"==typeof this.beforeRowOverflow&&this.beforeRowOverflow(e),0this.virtualRowCount;)this.rows.shift(),this.rowIdx--},n.prototype.isEmpty=function(){return 0===this.rows.length||1===this.rows.length&&""===this.rows[0]},n.prototype.addText=function(e){this.rows[this.rowIdx]+=e},n.prototype.backspace=function(){var e;this.isEmpty()||(e=this.rows[this.rowIdx],this.rows[this.rowIdx]=e.substr(0,e.length-1))},we.prototype.init=function(e,t){this.startPts=e;for(var i=0;i<8;i++)this.windows[i]=new n(i),"function"==typeof t&&(this.windows[i].beforeRowOverflow=t)},we.prototype.setCurrentWindow=function(e){this.currentWindow=this.windows[e]},we.prototype.createTextDecoder=function(t){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(t)}catch(e){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+t+" encoding. "+e})}},function(e){e=e||{},c.prototype.init.call(this);var t,i=this,s=e.captionServices||{},r={};Object.keys(s).forEach(e=>{t=s[e],/^SERVICE/.test(e)&&(r[e]=t.encoding)}),this.serviceEncodings=r,this.current708Packet=null,this.services={},this.push=function(e){(3===e.type||null===i.current708Packet)&&i.new708Packet(),i.add708Bytes(e)}}),je=(c.prototype=new u,c.prototype.new708Packet=function(){null!==this.current708Packet&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},c.prototype.add708Bytes=function(e){var t=e.ccData,i=t>>>8,t=255&t;this.current708Packet.ptsVals.push(e.pts),this.current708Packet.data.push(i),this.current708Packet.data.push(t)},c.prototype.push708Packet=function(){var e,t=this.current708Packet,i=t.data,s=null,r=0,n=i[r++];for(t.seq=n>>6,t.sizeCode=63&n;r>5)&&0("0"+(255&e).toString(16)).slice(-2)).join(""),String.fromCharCode(parseInt(n,16))):(t=qe[r=a|o]||r,4096&r&&r===t?"":String.fromCharCode(t)),l.pendingNewLine&&!l.isEmpty()&&l.newLine(this.getPts(e)),l.pendingNewLine=!1,l.addText(i),e},c.prototype.multiByteCharacter=function(e,t){var i=this.current708Packet.data,s=i[e+1];return e=Se(s)&&Se(i[e+2])?this.handleText(++e,t,{isMultiByte:!0}):e},c.prototype.setCurrentWindow=function(e,t){var i=this.current708Packet.data[e];return t.setCurrentWindow(7&i),e},c.prototype.defineWindow=function(e,t){var i=this.current708Packet.data,s=i[e],t=(t.setCurrentWindow(7&s),t.currentWindow),s=i[++e];return t.visible=(32&s)>>5,t.rowLock=(16&s)>>4,t.columnLock=(8&s)>>3,t.priority=7&s,s=i[++e],t.relativePositioning=(128&s)>>7,t.anchorVertical=127&s,s=i[++e],t.anchorHorizontal=s,s=i[++e],t.anchorPoint=(240&s)>>4,t.rowCount=15&s,s=i[++e],t.columnCount=63&s,s=i[++e],t.windowStyle=(56&s)>>3,t.penStyle=7&s,t.virtualRowCount=t.rowCount+1,e},c.prototype.setWindowAttributes=function(e,t){var i=this.current708Packet.data,t=(i[e],t.currentWindow.winAttr),s=i[++e];return t.fillOpacity=(192&s)>>6,t.fillRed=(48&s)>>4,t.fillGreen=(12&s)>>2,t.fillBlue=3&s,s=i[++e],t.borderType=(192&s)>>6,t.borderRed=(48&s)>>4,t.borderGreen=(12&s)>>2,t.borderBlue=3&s,s=i[++e],t.borderType+=(128&s)>>5,t.wordWrap=(64&s)>>6,t.printDirection=(48&s)>>4,t.scrollDirection=(12&s)>>2,t.justify=3&s,s=i[++e],t.effectSpeed=(240&s)>>4,t.effectDirection=(12&s)>>2,t.displayEffect=3&s,e},c.prototype.flushDisplayed=function(e,t){for(var i=[],s=0;s<8;s++)t.windows[s].visible&&!t.windows[s].isEmpty()&&i.push(t.windows[s].getText());t.endPts=e,t.text=i.join("\n\n"),this.pushCaption(t),t.startPts=e},c.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)},c.prototype.displayWindows=function(e,t){var i=this.current708Packet.data[++e],s=this.getPts(e);this.flushDisplayed(s,t);for(var r=0;r<8;r++)i&1<>4,t.offset=(12&s)>>2,t.penSize=3&s,s=i[++e],t.italics=(128&s)>>7,t.underline=(64&s)>>6,t.edgeType=(56&s)>>3,t.fontStyle=7&s,e},c.prototype.setPenColor=function(e,t){var i=this.current708Packet.data,t=(i[e],t.currentWindow.penColor),s=i[++e];return t.fgOpacity=(192&s)>>6,t.fgRed=(48&s)>>4,t.fgGreen=(12&s)>>2,t.fgBlue=3&s,s=i[++e],t.bgOpacity=(192&s)>>6,t.bgRed=(48&s)>>4,t.bgGreen=(12&s)>>2,t.bgBlue=3&s,s=i[++e],t.edgeRed=(48&s)>>4,t.edgeGreen=(12&s)>>2,t.edgeBlue=3&s,e},c.prototype.setPenLocation=function(e,t){var i=this.current708Packet.data,s=(i[e],t.currentWindow.penLoc);return t.currentWindow.pendingNewLine=!0,t=i[++e],s.row=15&t,t=i[++e],s.column=63&t,e},c.prototype.reset=function(e,t){var i=this.getPts(e);return this.flushDisplayed(i,t),this.initService(t.serviceNum,e)},{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}),He=14,Ve=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],p=function(e,t){p.prototype.init.call(this),this.field_=e||0,this.dataChannel_=t||0,this.name_="CC"+(1+(this.field_<<1|this.dataChannel_)),this.setConstants(),this.reset(),this.push=function(e){var t,i,s,r,n=32639&e.ccData;n===this.lastControlCode_?this.lastControlCode_=null:(4096==(61440&n)?this.lastControlCode_=n:n!==this.PADDING_&&(this.lastControlCode_=null),t=n>>>8,i=255&n,n!==this.PADDING_&&(n===this.RESUME_CAPTION_LOADING_?this.mode_="popOn":n===this.END_OF_CAPTION_?(this.mode_="popOn",this.clearFormatting(e.pts),this.flushDisplayed(e.pts),r=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=r,this.startPts_=e.pts):n===this.ROLL_UP_2_ROWS_?(this.rollUpRows_=2,this.setRollUp(e.pts)):n===this.ROLL_UP_3_ROWS_?(this.rollUpRows_=3,this.setRollUp(e.pts)):n===this.ROLL_UP_4_ROWS_?(this.rollUpRows_=4,this.setRollUp(e.pts)):n===this.CARRIAGE_RETURN_?(this.clearFormatting(e.pts),this.flushDisplayed(e.pts),this.shiftRowsUp_(),this.startPts_=e.pts):n===this.BACKSPACE_?"popOn"===this.mode_?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1):n===this.ERASE_DISPLAYED_MEMORY_?(this.flushDisplayed(e.pts),this.displayed_=a()):n===this.ERASE_NON_DISPLAYED_MEMORY_?this.nonDisplayed_=a():n===this.RESUME_DIRECT_CAPTIONING_?("paintOn"!==this.mode_&&(this.flushDisplayed(e.pts),this.displayed_=a()),this.mode_="paintOn",this.startPts_=e.pts):this.isSpecialCharacter(t,i)?(s=Ee((t=(3&t)<<8)|i),this[this.mode_](e.pts,s),this.column_++):this.isExtCharacter(t,i)?("popOn"===this.mode_?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1),s=Ee((t=(3&t)<<8)|i),this[this.mode_](e.pts,s),this.column_++):this.isMidRowCode(t,i)?(this.clearFormatting(e.pts),this[this.mode_](e.pts," "),this.column_++,14==(14&i)&&this.addFormatting(e.pts,["i"]),1==(1&i)&&this.addFormatting(e.pts,["u"])):this.isOffsetControlCode(t,i)?(this.nonDisplayed_[this.row_].offset=r=3&i,this.column_+=r):this.isPAC(t,i)?(r=Ve.indexOf(7968&n),"rollUp"===this.mode_&&(r-this.rollUpRows_+1<0&&(r=this.rollUpRows_-1),this.setRollUp(e.pts,r)),r!==this.row_&&0<=r&&r<=14&&(this.clearFormatting(e.pts),this.row_=r),1&i&&-1===this.formatting_.indexOf("u")&&this.addFormatting(e.pts,["u"]),16==(16&n)&&(this.column_=4*(r=(14&n)>>1),this.nonDisplayed_[this.row_].indent+=r),this.isColorPAC(i)&&14==(14&i)&&this.addFormatting(e.pts,["i"])):this.isNormalChar(t)&&(0===i&&(i=null),s=Ee(t),s+=Ee(i),this[this.mode_](e.pts,s),this.column_+=s.length)))}},u=(p.prototype=new u,p.prototype.flushDisplayed=function(e){let i=e=>{this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+e+"."})},s=[];this.displayed_.forEach((e,t)=>{if(e&&e.text&&e.text.length){try{e.text=e.text.trim()}catch(e){i(t)}e.text.length&&s.push({text:e.text,line:t+1,position:10+Math.min(70,10*e.indent)+2.5*e.offset})}else null==e&&i(t)}),s.length&&this.trigger("data",{startPts:this.startPts_,endPts:e,content:s,stream:this.name_})},p.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=a(),this.nonDisplayed_=a(),this.lastControlCode_=null,this.column_=0,this.row_=He,this.rollUpRows_=2,this.formatting_=[]},p.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_},p.prototype.isSpecialCharacter=function(e,t){return e===this.EXT_&&48<=t&&t<=63},p.prototype.isExtCharacter=function(e,t){return(e===this.EXT_+1||e===this.EXT_+2)&&32<=t&&t<=63},p.prototype.isMidRowCode=function(e,t){return e===this.EXT_&&32<=t&&t<=47},p.prototype.isOffsetControlCode=function(e,t){return e===this.OFFSET_&&33<=t&&t<=35},p.prototype.isPAC=function(e,t){return e>=this.BASE_&&e"},"");this[this.mode_](e,t)},p.prototype.clearFormatting=function(e){var t;this.formatting_.length&&(t=this.formatting_.reverse().reduce(function(e,t){return e+""},""),this.formatting_=[],this[this.mode_](e,t))},p.prototype.popOn=function(e,t){var i=this.nonDisplayed_[this.row_].text;this.nonDisplayed_[this.row_].text=i+=t},p.prototype.rollUp=function(e,t){var i=this.displayed_[this.row_].text;this.displayed_[this.row_].text=i+=t},p.prototype.shiftRowsUp_=function(){for(var e=0;e{if(e)for(var s=i;s>>2,o.timeStamp=a=(a*=4)+(3&n[7]),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=i+10+s)>>4&&(i+=e[i]+1),0===t.pid)t.type="pat",s(e.subarray(i),t),this.trigger("data",t);else if(t.pid===this.pmtPid)for(t.type="pmt",s(e.subarray(i),t),this.trigger("data",t);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else void 0===this.programMapTable?this.packetsWaitingForPmt.push([e,i,t]):this.processPes_(e,i,t)},this.processPes_=function(e,t,i){i.pid===this.programMapTable.video?i.streamType=T.H264_STREAM_TYPE:i.pid===this.programMapTable.audio?i.streamType=T.ADTS_STREAM_TYPE:i.streamType=this.programMapTable["timed-metadata"][i.pid],i.type="pes",i.data=e.subarray(t),this.trigger("data",i)}}).prototype=new b,Ke.STREAM_TYPES={h264:27,adts:15},(Ye=function(){function s(e,t,i){var s,r=new Uint8Array(e.size),n={type:t},a=0,o=0;if(e.data.length&&!(e.size<9)){for(n.trackId=e.data[0].pid,a=0;a>>3,t.pts*=4,t.pts+=(6&e[13])>>>1,t.dts=t.pts,64&i)&&(t.dts=(14&e[14])<<27|(255&e[15])<<20|(254&e[16])<<12|(255&e[17])<<5|(254&e[18])>>>3,t.dts*=4,t.dts+=(6&e[18])>>>1),t.data=e.subarray(9+e[8]))};Ye.prototype.init.call(this),this.push=function(i){({pat:function(){},pes:function(){var e,t;switch(i.streamType){case T.H264_STREAM_TYPE:e=n,t="video";break;case T.ADTS_STREAM_TYPE:e=a,t="audio";break;case T.METADATA_STREAM_TYPE:e=o,t="timed-metadata";break;default:return}i.payloadUnitStartIndicator&&s(e,t,!0),e.data.push(i),e.size+=i.data.byteLength},pmt:function(){var e={type:"metadata",tracks:[]};null!==(t=i.programMapTable).video&&e.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.video,codec:"avc",type:"video"}),null!==t.audio&&e.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.audio,codec:"adts",type:"audio"}),r=!0,l.trigger("data",e)}})[i.type]()},this.reset=function(){n.size=0,n.data.length=0,a.size=0,a.data.length=0,this.trigger("reset")},this.flushStreams_=function(){s(n,"video"),s(a,"audio"),s(o,"timed-metadata")},this.flush=function(){var e;!r&&t&&(e={type:"metadata",tracks:[]},null!==t.video&&e.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.video,codec:"avc",type:"video"}),null!==t.audio&&e.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.audio,codec:"adts",type:"audio"}),l.trigger("data",e)),r=!1,this.flushStreams_(),this.trigger("done")}}).prototype=new b,{PAT_PID:0,MP2T_PACKET_LENGTH:188,TransportPacketStream:nt,TransportParseStream:Ke,ElementaryStream:Ye,TimestampRolloverStream:$e,CaptionStream:rt.CaptionStream,Cea608Stream:rt.Cea608Stream,Cea708Stream:rt.Cea708Stream,MetadataStream:_});for(Qe in T)T.hasOwnProperty(Qe)&&(at[Qe]=T[Qe]);var ot,lt,b=at,$e=t,dt=h.ONE_SECOND_IN_TS,ht=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],ut=function(l){var d,h=0;ut.prototype.init.call(this),this.skipWarn_=function(e,t){this.trigger("log",{level:"warn",message:`adts skiping bytes ${e} to ${t} in frame ${h} outside syncword`})},this.push=function(e){var t,i,s,r,n,a,o=0;if(l||(h=0),"audio"===e.type){for(d&&d.length?(s=d,(d=new Uint8Array(s.byteLength+e.data.byteLength)).set(s),d.set(e.data,s.byteLength)):d=e.data;o+7>5,n=(r=1024*(1+(3&d[o+6])))*dt/ht[(60&d[o+2])>>>2],d.byteLength-o>>6&3),channelcount:(1&d[o+2])<<2|(192&d[o+3])>>>6,samplerate:ht[(60&d[o+2])>>>2],samplingfrequencyindex:(60&d[o+2])>>>2,samplesize:16,data:d.subarray(o+7+i,o+t)}),h++,o+=t}"number"==typeof a&&(this.skipWarn_(a,o),a=null),d=d.subarray(o)}},this.flush=function(){h=0,this.trigger("done")},this.reset=function(){d=void 0,this.trigger("reset")},this.endTimeline=function(){d=void 0,this.trigger("endedtimeline")}},rt=(ut.prototype=new $e,ut),_=t,ct=function(s){var r=s.byteLength,n=0,a=0;this.length=function(){return 8*r},this.bitsAvailable=function(){return 8*r+a},this.loadWord=function(){var e=s.byteLength-r,t=new Uint8Array(4),i=Math.min(4,r);if(0===i)throw new Error("no bytes available");t.set(s.subarray(e,e+i)),n=new DataView(t.buffer).getUint32(0),a=8*i,r-=i},this.skipBits=function(e){var t;e>>32-t;return 0<(a-=t)?n<<=t:0>>e))return n<<=e,a-=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()},pt=function(){var s,r,n=0;pt.prototype.init.call(this),this.push=function(e){for(var t,i=(r=r?((t=new Uint8Array(r.byteLength+e.data.byteLength)).set(r),t.set(e.data,r.byteLength),t):e.data).byteLength;n>4?20+i:10+i},yt=function(e,t){return e.length-t<10||e[t]!=="I".charCodeAt(0)||e[t+1]!=="D".charCodeAt(0)||e[t+2]!=="3".charCodeAt(0)?t:(t+=ft(e,t),yt(e,t))},_t=function(e,t,i){for(var s="",r=t;r=t+2&&255==(255&e[t])&&240==(240&e[t+1])&&16==(22&e[t+1])},parseId3TagSize:ft,parseAdtsSize:function(e,t){var i=(224&e[t+5])>>5;return 6144&e[t+3]|e[t+4]<<3|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==(240&e[t+1])?"audio":null},parseSampleRate:function(e){for(var t=0;t+5>>2];t++}return null},parseAacTimestamp:function(e){var t,i=10;64&e[5]&&(i=(i+=4)+mt(e.subarray(10,14)));do{if((t=mt(e.subarray(i+4,i+8)))<1)return null;if("PRIV"===String.fromCharCode(e[i],e[i+1],e[i+2],e[i+3]))for(var s,r,n=e.subarray(i+10,i+t+10),a=0;a>>2,(r*=4)+(3&s[7]);break}}while((i=i+10+t)n.length)break;t={type:"timed-metadata",data:n.subarray(r,r+s)},this.trigger("data",t),r+=s}else if(255==(255&n[r])&&240==(240&n[r+1])){if(n.length-r<7)break;if(r+(s=vt.parseAdtsSize(n,r))>n.length)break;t={type:"audio",data:n.subarray(r,r+s),pts:a,dts:a},this.trigger("data",t),r+=s}else r++;n=0=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0))}if(this.videoTrack?(a=this.videoTrack.timelineStartInfo.pts,Rt.forEach(function(e){n.info[e]=this.videoTrack[e]},this)):this.audioTrack&&(a=this.audioTrack.timelineStartInfo.pts,Ot.forEach(function(e){n.info[e]=this.audioTrack[e]},this)),this.videoTrack||this.audioTrack){for(1===this.pendingTracks.length?n.type=this.pendingTracks[0].type:n.type="combined",this.emittedTracks+=this.pendingTracks.length,e=E.initSegment(this.pendingTracks),n.initSegment=new Uint8Array(e.byteLength),n.initSegment.set(e),n.data=new Uint8Array(this.pendingBytes),s=0;s=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},w.prototype.setRemux=function(e){this.remuxTracks=e},(Ct=function(s){var r,n,a=this,i=!0;Ct.prototype.init.call(this),s=s||{},this.baseMediaDecodeTime=s.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var t={};(this.transmuxPipeline_=t).type="aac",t.metadataStream=new I.MetadataStream,t.aacStream=new Dt,t.audioTimestampRolloverStream=new I.TimestampRolloverStream("audio"),t.timedMetadataTimestampRolloverStream=new I.TimestampRolloverStream("timed-metadata"),t.adtsStream=new xt,t.coalesceStream=new w(s,t.metadataStream),t.headOfPipeline=t.aacStream,t.aacStream.pipe(t.audioTimestampRolloverStream).pipe(t.adtsStream),t.aacStream.pipe(t.timedMetadataTimestampRolloverStream).pipe(t.metadataStream).pipe(t.coalesceStream),t.metadataStream.on("timestamp",function(e){t.aacStream.setTimestamp(e.timeStamp)}),t.aacStream.on("data",function(e){"timed-metadata"!==e.type&&"audio"!==e.type||t.audioSegmentStream||(n=n||{timelineStartInfo:{baseMediaDecodeTime:a.baseMediaDecodeTime},codec:"adts",type:"audio"},t.coalesceStream.numberOfTracks++,t.audioSegmentStream=new Mt(n,s),t.audioSegmentStream.on("log",a.getLogTrigger_("audioSegmentStream")),t.audioSegmentStream.on("timingInfo",a.trigger.bind(a,"audioTimingInfo")),t.adtsStream.pipe(t.audioSegmentStream).pipe(t.coalesceStream),a.trigger("trackinfo",{hasAudio:!!n,hasVideo:!!r}))}),t.coalesceStream.on("data",this.trigger.bind(this,"data")),t.coalesceStream.on("done",this.trigger.bind(this,"done")),Tt(this,t)},this.setupTsPipeline=function(){var i={};(this.transmuxPipeline_=i).type="ts",i.metadataStream=new I.MetadataStream,i.packetStream=new I.TransportPacketStream,i.parseStream=new I.TransportParseStream,i.elementaryStream=new I.ElementaryStream,i.timestampRolloverStream=new I.TimestampRolloverStream,i.adtsStream=new xt,i.h264Stream=new At,i.captionStream=new I.CaptionStream(s),i.coalesceStream=new w(s,i.metadataStream),i.headOfPipeline=i.packetStream,i.packetStream.pipe(i.parseStream).pipe(i.elementaryStream).pipe(i.timestampRolloverStream),i.timestampRolloverStream.pipe(i.h264Stream),i.timestampRolloverStream.pipe(i.adtsStream),i.timestampRolloverStream.pipe(i.metadataStream).pipe(i.coalesceStream),i.h264Stream.pipe(i.captionStream).pipe(i.coalesceStream),i.elementaryStream.on("data",function(e){var t;if("metadata"===e.type){for(t=e.tracks.length;t--;)r||"video"!==e.tracks[t].type?n||"audio"!==e.tracks[t].type||((n=e.tracks[t]).timelineStartInfo.baseMediaDecodeTime=a.baseMediaDecodeTime):(r=e.tracks[t]).timelineStartInfo.baseMediaDecodeTime=a.baseMediaDecodeTime;r&&!i.videoSegmentStream&&(i.coalesceStream.numberOfTracks++,i.videoSegmentStream=new Et(r,s),i.videoSegmentStream.on("log",a.getLogTrigger_("videoSegmentStream")),i.videoSegmentStream.on("timelineStartInfo",function(e){n&&!s.keepOriginalTimestamps&&(n.timelineStartInfo=e,i.audioSegmentStream.setEarliestDts(e.dts-a.baseMediaDecodeTime))}),i.videoSegmentStream.on("processedGopsInfo",a.trigger.bind(a,"gopInfo")),i.videoSegmentStream.on("segmentTimingInfo",a.trigger.bind(a,"videoSegmentTimingInfo")),i.videoSegmentStream.on("baseMediaDecodeTime",function(e){n&&i.audioSegmentStream.setVideoBaseMediaDecodeTime(e)}),i.videoSegmentStream.on("timingInfo",a.trigger.bind(a,"videoTimingInfo")),i.h264Stream.pipe(i.videoSegmentStream).pipe(i.coalesceStream)),n&&!i.audioSegmentStream&&(i.coalesceStream.numberOfTracks++,i.audioSegmentStream=new Mt(n,s),i.audioSegmentStream.on("log",a.getLogTrigger_("audioSegmentStream")),i.audioSegmentStream.on("timingInfo",a.trigger.bind(a,"audioTimingInfo")),i.audioSegmentStream.on("segmentTimingInfo",a.trigger.bind(a,"audioSegmentTimingInfo")),i.adtsStream.pipe(i.audioSegmentStream).pipe(i.coalesceStream)),a.trigger("trackinfo",{hasAudio:!!n,hasVideo:!!r})}}),i.coalesceStream.on("data",this.trigger.bind(this,"data")),i.coalesceStream.on("id3Frame",function(e){e.dispatchType=i.metadataStream.dispatchType,a.trigger("id3Frame",e)}),i.coalesceStream.on("caption",this.trigger.bind(this,"caption")),i.coalesceStream.on("done",this.trigger.bind(this,"done")),Tt(this,i)},this.setBaseMediaDecodeTime=function(e){var t=this.transmuxPipeline_;s.keepOriginalTimestamps||(this.baseMediaDecodeTime=e),n&&(n.timelineStartInfo.dts=void 0,n.timelineStartInfo.pts=void 0,k.clearDtsInfo(n),t.audioTimestampRolloverStream)&&t.audioTimestampRolloverStream.discontinuity(),r&&(t.videoSegmentStream&&(t.videoSegmentStream.gopCache_=[]),r.timelineStartInfo.dts=void 0,r.timelineStartInfo.pts=void 0,k.clearDtsInfo(r),t.captionStream.reset()),t.timestampRolloverStream&&t.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(e){n&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(e)},this.setRemux=function(e){var t=this.transmuxPipeline_;s.remux=e,t&&t.coalesceStream&&t.coalesceStream.setRemux(e)},this.alignGopsWith=function(e){r&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(e)},this.getLogTrigger_=function(t){var i=this;return function(e){e.stream=t,i.trigger("log",e)}},this.push=function(e){var t;i&&((t=Pt(e))&&"aac"!==this.transmuxPipeline_.type?this.setupAacPipeline():t||"ts"===this.transmuxPipeline_.type||this.setupTsPipeline(),i=!1),this.transmuxPipeline_.headOfPipeline.push(e)},this.flush=function(){i=!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()}}).prototype=new S;function Ut(e){var t="";return(t+=String.fromCharCode(e[0]))+String.fromCharCode(e[1])+String.fromCharCode(e[2])+String.fromCharCode(e[3])}function Bt(e,t){var i,s,r,n=[];if(!t.length)return null;for(i=0;i>>4&&(t+=e[4]+1),t}function $t(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}}var Wt=Ct,t=function(e){return e>>>0},Le=function(e){return("00"+e.toString(16)).slice(-2)},Gt=t,Xt=Ut,Kt=t,Yt=ve.getUint64,Qt=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]}},Oe="undefined"!=typeof window?window:"undefined"!=typeof ye?ye:"undefined"!=typeof self?self:{},b=Oe,Jt=Ne.discardEmulationPreventionBytes,Zt=u.CaptionStream,x=Bt,ei=Ft,ti=qt,ii=jt,si=b,ri=function(e,t){for(var i=e,s=0;s>>2&63).replace(/^0/,"")):i.codec="mp4a.40.2"):i.codec=i.codec.toLowerCase()),D(e,["mdia","mdhd"])[0]);s&&(i.timescale=_i(s)),n.push(i)}),n},Ti=function(e,i=0){return D(e,["emsg"]).map(e=>{var e=mi.parseEmsgBox(new Uint8Array(e)),t=yi(e.message_data);return{cueTime:mi.scaleTime(e.presentation_time,e.timescale,e.presentation_time_delta,i),duration:mi.scaleTime(e.event_duration,e.timescale),frames:t}})},Si=ze,wi=ze,P=Je,L={},O=(L.ts={parseType:function(e,t){e=Ht(e);return 0===e?"pat":e===t?"pmt":t?"pes":null},parsePat:function(e){var t=Vt(e),i=4+zt(e);return t&&(i+=e[i]+1),(31&e[i+10])<<8|e[i+11]},parsePmt:function(e){var t={},i=Vt(e),s=4+zt(e);if(i&&(s+=e[s]+1),1&e[s+5]){for(var r=3+((15&e[s+1])<<8|e[s+2])-4,n=12+((15&e[s+10])<<8|e[s+11]);n=e.byteLength?null:(i=null,192&(s=e[t+7])&&((i={}).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,i.pts*=4,i.pts+=(6&e[t+13])>>>1,i.dts=i.pts,64&s)&&(i.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,i.dts*=4,i.dts+=(6&e[t+18])>>>1),i)},videoPacketContainsKeyFrame:function(e){for(var t=4+zt(e),i=e.subarray(t),s=0,r=0,n=!1;re.length?s=!0:(null===a&&(t=e.subarray(l,l+o),a=L.aac.parseAacTimestamp(t)),l+=o);break;case"audio":e.length-l<7?s=!0:(o=L.aac.parseAdtsSize(e,l))>e.length?s=!0:(null===n&&(t=e.subarray(l,l+o),n=L.aac.parseSampleRate(t)),r++,l+=o);break;default:l++}if(s)return null}return null===n||null===a?null:{audio:[{type:"audio",dts:a,pts:a},{type:"audio",dts:a+1024*r*(i=O/n),pts:a+1024*r*i}]}}:function(e){var t,i={pid:null,table:null},s={};for(t in Ei(e,i),i.table)if(i.table.hasOwnProperty(t))switch(i.table[t]){case wi.H264_STREAM_TYPE:s.video=[],ki(e,i,s),0===s.video.length&&delete s.video;break;case wi.ADTS_STREAM_TYPE:s.audio=[],Ci(e,i,s),0===s.audio.length&&delete s.audio}return s})(e);return e&&(e.audio||e.video)?(t=t,(i=e).audio&&i.audio.length&&("undefined"!=typeof(s=t)&&!isNaN(s)||(s=i.audio[0].dts),i.audio.forEach(function(e){e.dts=P(e.dts,s),e.pts=P(e.pts,s),e.dtsTime=e.dts/O,e.ptsTime=e.pts/O})),i.video&&i.video.length&&("undefined"!=typeof(r=t)&&!isNaN(r)||(r=i.video[0].dts),i.video.forEach(function(e){e.dts=P(e.dts,r),e.pts=P(e.pts,r),e.dtsTime=e.dts/O,e.ptsTime=e.pts/O}),i.firstKeyFrame)&&((t=i.firstKeyFrame).dts=P(t.dts,r),t.pts=P(t.pts,r),t.dtsTime=t.dts/O,t.ptsTime=t.pts/O),e):null};class xi{constructor(e,t){this.options=t||{},this.self=e,this.init()}init(){var i,e;this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new Wt(this.options),i=this.self,(e=this.transmuxer).on("data",function(e){var t=e.initSegment,t=(e.initSegment={data:t.buffer,byteOffset:t.byteOffset,byteLength:t.byteLength},e.data);e.data=t.buffer,i.postMessage({action:"data",segment:e,byteOffset:t.byteOffset,byteLength:t.byteLength},[e.data])}),e.on("done",function(e){i.postMessage({action:"done"})}),e.on("gopInfo",function(e){i.postMessage({action:"gopInfo",gopInfo:e})}),e.on("videoSegmentTimingInfo",function(e){var t={start:{decode:h.videoTsToSeconds(e.start.dts),presentation:h.videoTsToSeconds(e.start.pts)},end:{decode:h.videoTsToSeconds(e.end.dts),presentation:h.videoTsToSeconds(e.end.pts)},baseMediaDecodeTime:h.videoTsToSeconds(e.baseMediaDecodeTime)};e.prependedContentDuration&&(t.prependedContentDuration=h.videoTsToSeconds(e.prependedContentDuration)),i.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:t})}),e.on("audioSegmentTimingInfo",function(e){var t={start:{decode:h.videoTsToSeconds(e.start.dts),presentation:h.videoTsToSeconds(e.start.pts)},end:{decode:h.videoTsToSeconds(e.end.dts),presentation:h.videoTsToSeconds(e.end.pts)},baseMediaDecodeTime:h.videoTsToSeconds(e.baseMediaDecodeTime)};e.prependedContentDuration&&(t.prependedContentDuration=h.videoTsToSeconds(e.prependedContentDuration)),i.postMessage({action:"audioSegmentTimingInfo",audioSegmentTimingInfo:t})}),e.on("id3Frame",function(e){i.postMessage({action:"id3Frame",id3Frame:e})}),e.on("caption",function(e){i.postMessage({action:"caption",caption:e})}),e.on("trackinfo",function(e){i.postMessage({action:"trackinfo",trackInfo:e})}),e.on("audioTimingInfo",function(e){i.postMessage({action:"audioTimingInfo",audioTimingInfo:{start:h.videoTsToSeconds(e.start),end:h.videoTsToSeconds(e.end)}})}),e.on("videoTimingInfo",function(e){i.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:h.videoTsToSeconds(e.start),end:h.videoTsToSeconds(e.end)}})}),e.on("log",function(e){i.postMessage({action:"log",log:e})})}pushMp4Captions(e){this.captionParser||(this.captionParser=new li,this.captionParser.init());var t=new Uint8Array(e.data,e.byteOffset,e.byteLength),e=this.captionParser.parse(t,e.trackIds,e.timescales);this.self.postMessage({action:"mp4Captions",captions:e&&e.captions||[],logs:e&&e.logs||[],data:t.buffer},[t.buffer])}probeMp4StartTime({timescales:e,data:t}){e=vi(e,t);this.self.postMessage({action:"probeMp4StartTime",startTime:e,data:t},[t.buffer])}probeMp4Tracks({data:e}){var t=bi(e);this.self.postMessage({action:"probeMp4Tracks",tracks:t,data:e},[e.buffer])}probeEmsgID3({data:e,offset:t}){t=Ti(e,t);this.self.postMessage({action:"probeEmsgID3",id3Frames:t,emsgData:e},[e.buffer])}probeTs({data:e,baseStartTime:t}){t="number"!=typeof t||isNaN(t)?void 0:t*h.ONE_SECOND_IN_TS,t=Ii(e,t);let i=null;t&&((i={hasVideo:t.video&&2===t.video.length||!1,hasAudio:t.audio&&2===t.audio.length||!1}).hasVideo&&(i.videoStart=t.video[0].ptsTime),i.hasAudio)&&(i.audioStart=t.audio[0].ptsTime),this.self.postMessage({action:"probeTs",result:i,data:e},[e.buffer])}clearAllMp4Captions(){this.captionParser&&this.captionParser.clearAllCaptions()}clearParsedMp4Captions(){this.captionParser&&this.captionParser.clearParsedCaptions()}push(e){e=new Uint8Array(e.data,e.byteOffset,e.byteLength);this.transmuxer.push(e)}reset(){this.transmuxer.reset()}setTimestampOffset(e){e=e.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(h.secondsToVideoTs(e)))}setAudioAppendStart(e){this.transmuxer.setAudioAppendStart(Math.ceil(h.secondsToVideoTs(e.appendStart)))}setRemux(e){this.transmuxer.setRemux(e.remux)}flush(e){this.transmuxer.flush(),self.postMessage({action:"done",type:"transmuxed"})}endTimeline(){this.transmuxer.endTimeline(),self.postMessage({action:"endedtimeline",type:"transmuxed"})}alignGopsWith(e){this.transmuxer.alignGopsWith(e.gopsToAlignWith.slice())}}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))}})));let su=(e,t,i)=>{var{type:s,initSegment:r,captions:n,captionStreams:a,metadata:o,videoFrameDtsTime:l,videoFramePtsTime:d}=e.data.segment,t=(t.buffer.push({captions:n,captionStreams:a,metadata:o}),e.data.segment.boxes||{data:e.data.segment.data}),n={type:s,data:new Uint8Array(t.data,t.data.byteOffset,t.data.byteLength),initSegment:new Uint8Array(r.data,r.byteOffset,r.byteLength)};"undefined"!=typeof l&&(n.videoFrameDtsTime=l),"undefined"!=typeof d&&(n.videoFramePtsTime=d),i(n)},ru=({transmuxedData:e,callback:t})=>{e.buffer=[],t(e)},nu=(e,t)=>{t.gopInfo=e.data.gopInfo},au=t=>{let{transmuxer:i,bytes:e,audioAppendStart:s,gopsToAlignWith:r,remux:n,onData:a,onTrackInfo:o,onAudioTimingInfo:l,onVideoTimingInfo:d,onVideoSegmentTimingInfo:h,onAudioSegmentTimingInfo:u,onId3:c,onCaptions:p,onDone:m,onEndedTimeline:g,onTransmuxerLog:f,isEndOfTimeline:y,segment:_,triggerSegmentEventFn:v}=t,b={buffer:[]},T=y;var S,w;i.onmessage=e=>{i.currentTransmux!==t||("data"===e.data.action&&su(e,b,a),"trackinfo"===e.data.action&&o(e.data.trackInfo),"gopInfo"===e.data.action&&nu(e,b),"audioTimingInfo"===e.data.action&&l(e.data.audioTimingInfo),"videoTimingInfo"===e.data.action&&d(e.data.videoTimingInfo),"videoSegmentTimingInfo"===e.data.action&&h(e.data.videoSegmentTimingInfo),"audioSegmentTimingInfo"===e.data.action&&u(e.data.audioSegmentTimingInfo),"id3Frame"===e.data.action&&c([e.data.id3Frame],e.data.id3Frame.dispatchType),"caption"===e.data.action&&p(e.data.caption),"endedtimeline"===e.data.action&&(T=!1,g()),"log"===e.data.action&&f(e.data.log),"transmuxed"!==e.data.type)||T||(i.onmessage=null,ru({transmuxedData:b,callback:m}),ou(i))},i.onerror=()=>{var e={message:"Received an error message from the transmuxer worker",metadata:{errorType:E.Error.StreamingFailedToTransmuxSegment,segmentInfo:Qu({segment:_})}};m(null,e)},s&&i.postMessage({action:"setAudioAppendStart",appendStart:s}),Array.isArray(r)&&i.postMessage({action:"alignGopsWith",gopsToAlignWith:r}),"undefined"!=typeof n&&i.postMessage({action:"setRemux",remux:n}),e.byteLength&&(S=e instanceof ArrayBuffer?e:e.buffer,w=e instanceof ArrayBuffer?0:e.byteOffset,v({type:"segmenttransmuxingstart",segment:_}),i.postMessage({action:"push",data:S,byteOffset:w,byteLength:e.byteLength},[S])),y&&i.postMessage({action:"endTimeline"}),i.postMessage({action:"flush"})},ou=e=>{e.currentTransmux=null,e.transmuxQueue.length&&(e.currentTransmux=e.transmuxQueue.shift(),"function"==typeof e.currentTransmux?e.currentTransmux():au(e.currentTransmux))},lu=(e,t)=>{e.postMessage({action:t}),ou(e)},du=(e,t)=>{t.currentTransmux?t.transmuxQueue.push(lu.bind(null,t,e)):(t.currentTransmux=e,lu(t,e))};let hu=e=>{e.transmuxer.currentTransmux?e.transmuxer.transmuxQueue.push(e):(e.transmuxer.currentTransmux=e,au(e))};var uu=e=>{du("reset",e)},cu=(hu,e=>{let t=new iu,i=(t.currentTransmux=null,t.transmuxQueue=[],t.terminate);return t.terminate=()=>(t.currentTransmux=null,t.transmuxQueue.length=0,i.call(t)),t.postMessage({action:"init",options:e}),t});function pu(e){let t=0;return e.audio&&t++,e.video&&t++,t}function mu(e,t){var i=t.attributes||{},s=Lu(function(e){e=e.attributes||{};if(e.CODECS)return ra(e.CODECS)}(t)||[]);return!Pu(e,t)||s.audio||((e,t)=>{if(!Pu(e,t))return!0;var i,t=t.attributes||{},s=e.mediaGroups.AUDIO[t.AUDIO];for(i in s)if(!s[i].uri&&!s[i].playlists)return!0;return!1})(e,t)||(t=Lu(function(e,t){if(e.mediaGroups.AUDIO&&t){var i=e.mediaGroups.AUDIO[t];if(i)for(var s in i){s=i[s];if(s.default&&s.playlists)return ra(s.playlists[0].attributes.CODECS)}}return null}(e,i.AUDIO)||[])).audio&&(s.audio=t.audio),s}function gu(e,t){return(e=e&&window.getComputedStyle(e))?e[t]:""}function fu(e,t){let i,s;return i=(i=e.attributes.BANDWIDTH?e.attributes.BANDWIDTH:i)||window.Number.MAX_VALUE,s=(s=t.attributes.BANDWIDTH?t.attributes.BANDWIDTH:s)||window.Number.MAX_VALUE,i-s}let yu=function(t){let i=t.transmuxer,s=t.endAction||t.action,r=t.callback;var e,n=f({},t,{endAction:null,transmuxer:null,callback:null});let a=e=>{e.data.action===s&&(i.removeEventListener("message",a),e.data.data&&(e.data.data=new Uint8Array(e.data.data,t.byteOffset||0,t.byteLength||e.data.data.byteLength),t.data)&&(t.data=e.data.data),r(e.data))};i.addEventListener("message",a),t.data?(e=t.data instanceof ArrayBuffer,n.byteOffset=e?0:t.data.byteOffset,n.byteLength=t.data.byteLength,e=[e?t.data:t.data.buffer],i.postMessage(n,e)):i.postMessage(n)},_u={FAILURE:2,TIMEOUT:-101,ABORTED:-102},vu=e=>{e.forEach(e=>{e.abort()})},bu=e=>({bandwidth:e.bandwidth,bytesReceived:e.bytesReceived||0,roundTripTime:e.roundTripTime||0}),Tu=e=>{var t=e.target,t={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-t.requestTime||0};return t.bytesReceived=e.loaded,t.bandwidth=Math.floor(t.bytesReceived/t.roundTripTime*8*1e3),t},Su=(e,t)=>{var i=t.requestType,i=bh({requestType:i,request:t,error:e});return t.timedout?{status:t.status,message:"HLS request timed-out at URL: "+t.uri,code:_u.TIMEOUT,xhr:t,metadata:i}:t.aborted?{status:t.status,message:"HLS request aborted at URL: "+t.uri,code:_u.ABORTED,xhr:t,metadata:i}:e?{status:t.status,message:"HLS request errored at URL: "+t.uri,code:_u.FAILURE,xhr:t,metadata:i}:"arraybuffer"===t.responseType&&0===t.response.byteLength?{status:t.status,message:"Empty HLS response at URL: "+t.uri,code:_u.FAILURE,xhr:t,metadata:i}:null},wu=(r,n,a,o)=>(e,t)=>{var i=t.response,e=Su(e,t);if(e)return a(e,r);if(16!==i.byteLength)return a({status:t.status,message:"Invalid HLS key at URL: "+t.uri,code:_u.FAILURE,xhr:t},r);var e=new DataView(i),s=new Uint32Array([e.getUint32(0),e.getUint32(4),e.getUint32(8),e.getUint32(12)]);for(let e=0;e{var e,t=Pd(i.map.bytes);if("mp4"!==t)return e=i.map.resolvedUri||i.map.uri,s({internal:!0,message:`Found unsupported ${t=t||"unknown"} container for initialization segment at URL: `+e,code:_u.FAILURE,metadata:{mediaType:t}});yu({action:"probeMp4Tracks",data:i.map.bytes,transmuxer:i.transmuxer,callback:({tracks:e,data:t})=>(i.map.bytes=t,e.forEach(function(e){i.map.tracks=i.map.tracks||{},i.map.tracks[e.type]||"number"==typeof(i.map.tracks[e.type]=e).id&&e.timescale&&(i.map.timescales=i.map.timescales||{},i.map.timescales[e.id]=e.timescale)}),s(null))})},Cu=({segment:i,bytes:t,trackInfoFn:s,timingInfoFn:e,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:d,dataFn:h,doneFn:u,onTransmuxerLog:c,triggerSegmentEventFn:p})=>{var m=i.map&&i.map.tracks||{};let g=Boolean(m.audio&&m.video),f=e.bind(null,i,"audio","start"),y=e.bind(null,i,"audio","end"),_=e.bind(null,i,"video","start"),v=e.bind(null,i,"video","end");yu({action:"probeTs",transmuxer:i.transmuxer,data:t,baseStartTime:i.baseStartTime,callback:e=>{i.bytes=t=e.data;e=e.result;e&&(s(i,{hasAudio:e.hasAudio,hasVideo:e.hasVideo,isMuxed:g}),s=null),hu({bytes:t,transmuxer:i.transmuxer,audioAppendStart:i.audioAppendStart,gopsToAlignWith:i.gopsToAlignWith,remux:g,onData:e=>{e.type="combined"===e.type?"video":e.type,h(i,e)},onTrackInfo:e=>{s&&(g&&(e.isMuxed=!0),s(i,e))},onAudioTimingInfo:e=>{f&&"undefined"!=typeof e.start&&(f(e.start),f=null),y&&"undefined"!=typeof e.end&&y(e.end)},onVideoTimingInfo:e=>{_&&"undefined"!=typeof e.start&&(_(e.start),_=null),v&&"undefined"!=typeof e.end&&v(e.end)},onVideoSegmentTimingInfo:e=>{var t={pts:{start:e.start.presentation,end:e.end.presentation},dts:{start:e.start.decode,end:e.end.decode}};p({type:"segmenttransmuxingtiminginfoavailable",segment:i,timingInfo:t}),r(e)},onAudioSegmentTimingInfo:e=>{var t={pts:{start:e.start.pts,end:e.end.pts},dts:{start:e.start.dts,end:e.end.dts}};p({type:"segmenttransmuxingtiminginfoavailable",segment:i,timingInfo:t}),n(e)},onId3:(e,t)=>{a(i,e,t)},onCaptions:e=>{o(i,[e])},isEndOfTimeline:l,onEndedTimeline:()=>{d()},onTransmuxerLog:c,onDone:(e,t)=>{u&&(e.type="combined"===e.type?"video":e.type,p({type:"segmenttransmuxingcomplete",segment:i}),u(t,i,e))},segment:i,triggerSegmentEventFn:p})}})},ku=({segment:n,bytes:a,trackInfoFn:e,timingInfoFn:o,videoSegmentTimingInfoFn:t,audioSegmentTimingInfoFn:i,id3Fn:l,captionsFn:d,isEndOfTimeline:s,endedTimelineFn:r,dataFn:h,doneFn:u,onTransmuxerLog:c,triggerSegmentEventFn:p})=>{let m=new Uint8Array(a);if(Ld(m)){n.isFmp4=!0;let i=n.map.tracks,s={isFmp4:!0,hasVideo:!!i.video,hasAudio:!!i.audio},r=(i.audio&&i.audio.codec&&"enca"!==i.audio.codec&&(s.audioCodec=i.audio.codec),i.video&&i.video.codec&&"encv"!==i.video.codec&&(s.videoCodec=i.video.codec),i.video&&i.audio&&(s.isMuxed=!0),e(n,s),(e,t)=>{h(n,{data:m,type:s.hasAudio&&!s.isMuxed?"audio":"video"}),t&&t.length&&l(n,t),e&&e.length&&d(n,e),u(null,n,{})});void yu({action:"probeMp4StartTime",timescales:n.map.timescales,data:m,transmuxer:n.transmuxer,callback:({data:e,startTime:t})=>{a=e.buffer,n.bytes=m=e,s.hasAudio&&!s.isMuxed&&o(n,"audio","start",t),s.hasVideo&&o(n,"video","start",t),yu({action:"probeEmsgID3",data:m,transmuxer:n.transmuxer,offset:t,callback:({emsgData:e,id3Frames:t})=>{a=e.buffer,n.bytes=m=e,i.video&&e.byteLength&&n.transmuxer?yu({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:n.transmuxer,data:m,timescales:n.map.timescales,trackIds:[i.video.id],callback:e=>{a=e.data.buffer,n.bytes=m=e.data,e.logs.forEach(function(e){c(O(e,{stream:"mp4CaptionParser"}))}),r(e.captions,t)}}):r(void 0,t)}})}})}else n.transmuxer?("undefined"==typeof n.container&&(n.container=Pd(m)),"ts"!==n.container&&"aac"!==n.container?(e(n,{hasAudio:!1,hasVideo:!1}),u(null,n,{})):Cu({segment:n,bytes:a,trackInfoFn:e,timingInfoFn:o,videoSegmentTimingInfoFn:t,audioSegmentTimingInfoFn:i,id3Fn:l,captionsFn:d,isEndOfTimeline:s,endedTimelineFn:r,dataFn:h,doneFn:u,onTransmuxerLog:c,triggerSegmentEventFn:p})):u(null,n,{})},Iu=function({id:t,key:e,encryptedBytes:i,decryptionWorker:s,segment:r,doneFn:n},a){let o=e=>{e.data.source===t&&(s.removeEventListener("message",o),e=e.data.decrypted,a(new Uint8Array(e.bytes,e.byteOffset,e.byteLength)))};s.onerror=()=>{var e="An error occurred in the decryption worker",t=Qu({segment:r}),e={message:e,metadata:{error:new Error(e),errorType:E.Error.StreamingFailedToDecryptSegment,segmentInfo:t,keyInfo:{uri:r.key.resolvedUri||r.map.key.resolvedUri}}};n(e,r)},s.addEventListener("message",o);let l;l=e.bytes.slice?e.bytes.slice():new Uint32Array(Array.prototype.slice.call(e.bytes)),s.postMessage(Mh({source:t,encrypted:i,key:l,iv:e.iv}),[i.buffer,l.buffer])},xu=({decryptionWorker:e,segment:t,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:d,dataFn:h,doneFn:u,onTransmuxerLog:c,triggerSegmentEventFn:p})=>{p({type:"segmentdecryptionstart"}),Iu({id:t.requestId,key:t.key,encryptedBytes:t.encryptedBytes,decryptionWorker:e,segment:t,doneFn:u},e=>{t.bytes=e,p({type:"segmentdecryptioncomplete",segment:t}),ku({segment:t,bytes:t.bytes,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:d,dataFn:h,doneFn:u,onTransmuxerLog:c,triggerSegmentEventFn:p})})},Au=({xhr:e,xhrOptions:t,decryptionWorker:i,segment:s,abortFn:r,progressFn:n,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:d,id3Fn:h,captionsFn:u,isEndOfTimeline:c,endedTimelineFn:p,dataFn:m,doneFn:g,onTransmuxerLog:f,triggerSegmentEventFn:y})=>{let _=[];var v,b,T,S,w,E,C,k,I,i=(({activeXhrs:s,decryptionWorker:r,trackInfoFn:n,timingInfoFn:a,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:l,id3Fn:d,captionsFn:h,isEndOfTimeline:u,endedTimelineFn:c,dataFn:p,doneFn:m,onTransmuxerLog:g,triggerSegmentEventFn:f})=>{let t=0,y=!1;return(e,i)=>{if(!y){if(e)return y=!0,vu(s),m(e,i);if((t+=1)===s.length){let t=function(){if(i.encryptedBytes)return xu({decryptionWorker:r,segment:i,trackInfoFn:n,timingInfoFn:a,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:l,id3Fn:d,captionsFn:h,isEndOfTimeline:u,endedTimelineFn:c,dataFn:p,doneFn:m,onTransmuxerLog:g,triggerSegmentEventFn:f});ku({segment:i,bytes:i.bytes,trackInfoFn:n,timingInfoFn:a,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:l,id3Fn:d,captionsFn:h,isEndOfTimeline:u,endedTimelineFn:c,dataFn:p,doneFn:m,onTransmuxerLog:g,triggerSegmentEventFn:f})};if(i.endOfAllRequests=Date.now(),i.map&&i.map.encryptedBytes&&!i.map.bytes)return f({type:"segmentdecryptionstart",segment:i}),Iu({decryptionWorker:r,id:i.requestId+"-init",encryptedBytes:i.map.encryptedBytes,key:i.map.key,segment:i,doneFn:m},e=>{i.map.bytes=e,f({type:"segmentdecryptioncomplete",segment:i}),Eu(i,e=>{if(e)return vu(s),m(e,i);t()})});t()}}}})({activeXhrs:_,decryptionWorker:i,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:d,id3Fn:h,captionsFn:u,isEndOfTimeline:c,endedTimelineFn:p,dataFn:m,doneFn:g,onTransmuxerLog:f,triggerSegmentEventFn:y}),f=(s.key&&!s.key.bytes&&(a=[s.key],s.map&&!s.map.bytes&&s.map.key&&s.map.key.resolvedUri===s.key.resolvedUri&&a.push(s.map.key),o=O(t,{uri:s.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),l=wu(s,a,i,y),y({type:"segmentkeyloadstart",segment:s,keyInfo:{uri:s.key.resolvedUri}}),d=e(o,l),_.push(d)),s.map&&!s.map.bytes&&(!s.map.key||s.key&&s.key.resolvedUri===s.map.key.resolvedUri||(h=O(t,{uri:s.map.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),u=wu(s,[s.map.key],i,y),y({type:"segmentkeyloadstart",segment:s,keyInfo:{uri:s.map.key.resolvedUri}}),c=e(h,u),_.push(c)),p=O(t,{uri:s.map.resolvedUri,responseType:"arraybuffer",headers:Ph(s.map),requestType:"segment-media-initialization"}),{segment:v,finishProcessingFn:b,triggerSegmentEventFn:T}=[{segment:s,finishProcessingFn:i,triggerSegmentEventFn:y}][0],m=(e,t)=>{var e=Su(e,t);return e?b(e,v):(e=new Uint8Array(t.response),T({type:"segmentloaded",segment:v}),v.map.key?(v.map.encryptedBytes=e,b(null,v)):(v.map.bytes=e,void Eu(v,function(e){if(e)return e.xhr=t,e.status=t.status,b(e,v);b(null,v)})))},y({type:"segmentloadstart",segment:s}),g=e(p,m),_.push(g)),O(t,{uri:s.part&&s.part.resolvedUri||s.resolvedUri,responseType:"arraybuffer",headers:Ph(s),requestType:"segment"})),a=({segment:S,finishProcessingFn:w,responseType:E,triggerSegmentEventFn:C}=[{segment:s,finishProcessingFn:i,responseType:f.responseType,triggerSegmentEventFn:y}][0],(e,t)=>{e=Su(e,t);if(e)return w(e,S);C({type:"segmentloaded",segment:S});e="arraybuffer"!==E&&t.responseText?Jh(t.responseText.substring(S.lastReachedChar||0)):t.response;return S.stats=bu(t),S.key?S.encryptedBytes=new Uint8Array(e):S.bytes=new Uint8Array(e),w(null,S)}),o=(y({type:"segmentloadstart",segment:s}),e(f,a));o.addEventListener("progress",({segment:k,progressFn:I}=[{segment:s,progressFn:n}][0],e=>{var t=e.target;if(!t.aborted)return k.stats=O(k.stats,Tu(e)),!k.stats.firstBytesReceivedAt&&k.stats.bytesReceived&&(k.stats.firstBytesReceivedAt=Date.now()),I(e,k)})),_.push(o);let x={};return _.forEach(e=>{var t,i;e.addEventListener("loadend",({loadendState:t,abortFn:i}=[{loadendState:x,abortFn:r}][0],e=>{e.target.aborted&&i&&!t.calledAbortFn&&(i(),t.calledAbortFn=!0)}))}),()=>vu(_)},Du=Md("CodecUtils"),Pu=(e,t)=>{t=t.attributes||{};return e&&e.mediaGroups&&e.mediaGroups.AUDIO&&t.AUDIO&&e.mediaGroups.AUDIO[t.AUDIO]},Lu=function(e){let s={};return e.forEach(({mediaType:e,type:t,details:i})=>{s[e]=s[e]||[],s[e].push(sa(""+t+i))}),Object.keys(s).forEach(function(e){1{var t=e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width,i=e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.height,s=e.attributes&&e.attributes.BANDWIDTH;return{bandwidth:s||window.Number.MAX_VALUE,width:t,height:i,playlist:e}})),a=(Nu(n,(e,t)=>e.bandwidth-t.bandwidth),(n=n.filter(e=>!ch.isIncompatible(e.playlist))).filter(e=>ch.isEnabled(e.playlist)));l=(a=a.length?a:n.filter(e=>!ch.isDisabled(e.playlist))).filter(e=>e.bandwidth*R.BANDWIDTH_VARIANCEe.bandwidth===o.bandwidth)[0];if(!1===u){let t=m||a[0]||n[0];if(t&&t.playlist){let e=m?"bandwidthBestRep":"sortedPlaylistReps";return a[0]&&(e="enabledPlaylistReps"),Ou(`choosing ${Ru(t)} using ${e} with options`,p),t.playlist}}else{var g,u=l.filter(e=>e.width&&e.height),l=(Nu(u,(e,t)=>e.width-t.width),u.filter(e=>e.width===d&&e.height===h)),l=(o=l[l.length-1],l.filter(e=>e.bandwidth===o.bandwidth)[0]);let t,i;l||(g=(t=u.filter(e=>e.width>d||he.width===t[0].width&&e.height===t[0].height),o=g[g.length-1],i=g.filter(e=>e.bandwidth===o.bandwidth)[0]);let s,r=(c.leastPixelDiffSelector&&(g=u.map(e=>(e.pixelDiff=Math.abs(e.width-d)+Math.abs(e.height-h),e)),Nu(g,(e,t)=>e.pixelDiff===t.pixelDiff?t.bandwidth-e.bandwidth:e.pixelDiff-t.pixelDiff),s=g[0]),s||i||l||m||a[0]||n[0]);if(r&&r.playlist){let e="sortedPlaylistReps";return s?e="leastPixelDiffRep":i?e="resolutionPlusOneRep":l?e="resolutionBestRep":m?e="bandwidthBestRep":a[0]&&(e="enabledPlaylistReps"),Ou(`choosing ${Ru(r)} using ${e} with options`,p),r.playlist}}return Ou("could not choose a playlist with options",p),null}}function Uu(){let e=this.useDevicePixelRatio&&window.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(e=this.customPixelRatio),Mu(this.playlists.main,this.systemBandwidth,parseInt(gu(this.tech_.el(),"width"),10)*e,parseInt(gu(this.tech_.el(),"height"),10)*e,this.limitRenditionByPlayerDimensions,this.playlistController_)}function Bu(e){try{return new URL(e).pathname.split("/").slice(-2).join("/")}catch(e){return""}}function Fu(e,t,i){let s;var r;if(i&&i.cues)for(s=i.cues.length;s--;)(r=i.cues[s]).startTime>=e&&r.endTime<=t&&i.removeCue(r)}let qu=({inbandTextTracks:e,metadataArray:t,timestampOffset:i,videoDuration:o})=>{if(t){let r=window.WebKitDataCue||window.VTTCue,a=e.metadataTrack_;if(a&&(t.forEach(e=>{let s=e.cueTime+i;!("number"!=typeof s||window.isNaN(s)||s<0)&&s<1/0&&e.frames&&e.frames.length&&e.frames.forEach(e=>{var t,i=new r(s,s,e.value||e.url||e.data||"");i.frame=e,i.value=e,t=i,Object.defineProperties(t.frame,{id:{get(){return E.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),t.value.key}},value:{get(){return E.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),t.value.data}},privateData:{get(){return E.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),t.value.data}}}),a.addCue(i)})}),a.cues)&&a.cues.length){var s=a.cues,l=[];for(let e=0;e{var i=e[t.startTime]||[];return i.push(t),e[t.startTime]=i,e},{}),n=Object.keys(r).sort((e,t)=>Number(e)-Number(t));n.forEach((e,t)=>{var i=r[e],e=isFinite(o)?o:e;let s=Number(n[t+1])||e;i.forEach(e=>{e.endTime=s})})}}},ju={id:"ID",class:"CLASS",startDate:"START-DATE",duration:"DURATION",endDate:"END-DATE",endOnNext:"END-ON-NEXT",plannedDuration:"PLANNED-DURATION",scte35Out:"SCTE35-OUT",scte35In:"SCTE35-IN"},Hu=new Set(["id","class","startDate","duration","endDate","endOnNext","startTime","endTime","processDateRange"]),Vu=(e,t,i)=>{e.metadataTrack_||(e.metadataTrack_=i.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,E.browser.IS_ANY_SAFARI)||(e.metadataTrack_.inBandMetadataTrackDispatchType=t)},zu=e=>"number"==typeof e&&isFinite(e),$u=e=>{var{startOfSegment:t,duration:i,segment:s,part:r,playlist:{mediaSequence:n,id:a,segments:o=[]},mediaIndex:l,partIndex:d,timeline:h}=e,o=o.length-1;let u="mediaIndex/partIndex increment";e.getMediaInfoForTime?u=`getMediaInfoForTime (${e.getMediaInfoForTime})`:e.isSyncRequest&&(u="getSyncSegmentCandidate (isSyncRequest)"),e.independent&&(u+=" with independent "+e.independent);var c="number"==typeof d,e=e.segment.uri?"segment":"pre-segment",p=c?Jd({preloadSegment:s})-1:0;return e+` [${n+l}/${n+o}]`+(c?` part [${d}/${p}]`:"")+` segment start/end [${s.start} => ${s.end}]`+(c?` part start/end [${r.start} => ${r.end}]`:"")+` startOfSegment [${t}]`+` duration [${i}]`+` timeline [${h}]`+` selected by [${u}]`+` playlist [${a}]`},Wu=e=>e+"TimingInfo",Gu=({timelineChangeController:e,currentTimeline:t,segmentTimeline:i,loaderType:s,audioDisabled:r})=>{return!(t===i||("audio"===s?(t=e.lastTimelineChange({type:"main"}))&&t.to===i:"main"!==s||!r||(t=e.pendingTimelineChange({type:"audio"}))&&t.to===i))},Xu=e=>{var t,i,s,r=e.pendingSegment_;r&&Gu({timelineChangeController:e.timelineChangeController_,currentTimeline:e.currentTimeline_,segmentTimeline:r.timeline,loaderType:e.loaderType_,audioDisabled:e.audioDisabled_})&&!!((r=e.timelineChangeController_)&&(t=r.pendingTimelineChange({type:"audio"}),r=r.pendingTimelineChange({type:"main"}),s=(i=t&&r)&&t.to!==r.to,i)&&-1!==t.from&&-1!==r.from&&s)&&(t=(i=e).timelineChangeController_.pendingTimelineChange({type:"audio"}),i=i.timelineChangeController_.pendingTimelineChange({type:"main"}),t&&i&&t.to!!e&&Math.round(e)>t+zd,Yu=(e,t)=>{var i,s,r;return"hls"===t&&(t=(e=>{let s=0;return["video","audio"].forEach(function(t){t=e[t+"TimingInfo"];if(t){var{start:t,end:i}=t;let e;"bigint"==typeof t||"bigint"==typeof i?e=window.BigInt(i)-window.BigInt(t):"number"==typeof t&&"number"==typeof i&&(e=i-t),"undefined"!=typeof e&&e>s&&(s=e)}}),s="bigint"==typeof s&&s{var i,s,r;if(t)return i=Boolean(t.key||t.map&&t.map.ke),s=Boolean(t.map&&!t.map.bytes),r=void 0===t.startOfSegment?t.start:t.startOfSegment,{type:e||t.type,uri:t.resolvedUri||t.uri,start:r,duration:t.duration,isEncrypted:i,isMediaInitialization:s}};class Ju extends E.EventTarget{constructor(e,t=0){if(super(),!e)throw new TypeError("Initialization settings are required");if("function"!=typeof e.currentTime)throw new TypeError("No currentTime getter specified");if(!e.mediaSource)throw new TypeError("No MediaSource specified");this.bandwidth=e.bandwidth,this.throughput={rate:0,count:0},this.roundTrip=NaN,this.resetStats_(),this.mediaIndex=null,this.partIndex=null,this.hasPlayed_=e.hasPlayed,this.currentTime_=e.currentTime,this.seekable_=e.seekable,this.seeking_=e.seeking,this.duration_=e.duration,this.mediaSource_=e.mediaSource,this.vhs_=e.vhs,this.loaderType_=e.loaderType,this.currentMediaInfo_=void 0,this.startingMediaInfo_=void 0,this.segmentMetadataTrack_=e.segmentMetadataTrack,this.goalBufferLength_=e.goalBufferLength,this.sourceType_=e.sourceType,this.sourceUpdater_=e.sourceUpdater,this.inbandTextTracks_=e.inbandTextTracks,this.state_="INIT",this.timelineChangeController_=e.timelineChangeController,this.shouldSaveSegmentTimingInfo_=!0,this.parse708captions_=e.parse708captions,this.useDtsForTimestampOffset_=e.useDtsForTimestampOffset,this.captionServices_=e.captionServices,this.exactManifestTimings=e.exactManifestTimings,this.addMetadataToTextTrack=e.addMetadataToTextTrack,this.checkBufferTimeout_=null,this.error_=void 0,this.currentTimeline_=-1,this.shouldForceTimestampOffsetAfterResync_=!1,this.pendingSegment_=null,this.xhrOptions_=null,this.pendingSegments_=[],this.audioDisabled_=!1,this.isPendingTimestampOffset_=!1,this.gopBuffer_=[],this.timeMapping_=0,this.safeAppend_=!1,this.appendInitSegment_={audio:!0,video:!0},this.playlistOfLastInitSegment_={audio:null,video:null},this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_={id3:[],caption:[]},this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=null,this.activeInitSegmentId_=null,this.initSegments_={},this.cacheEncryptionKeys_=e.cacheEncryptionKeys,this.keyCache_={},this.decrypter_=e.decrypter,this.syncController_=e.syncController,this.syncPoint_={segmentIndex:0,time:0},this.transmuxer_=this.createTransmuxer_(),this.triggerSyncInfoUpdate_=()=>this.trigger("syncinfoupdate"),this.syncController_.on("syncinfoupdate",this.triggerSyncInfoUpdate_),this.mediaSource_.addEventListener("sourceopen",()=>{this.isEndOfStream_()||(this.ended_=!1)}),this.fetchAtBuffer_=!1,this.logger_=Md(`SegmentLoader[${this.loaderType_}]`),Object.defineProperty(this,"state",{get(){return this.state_},set(e){e!==this.state_&&(this.logger_(this.state_+" -> "+e),this.state_=e,this.trigger("statechange"))}}),this.sourceUpdater_.on("ready",()=>{this.hasEnoughInfoToAppend_()?this.processCallQueue_():Xu(this)}),this.sourceUpdater_.on("codecschange",e=>{this.trigger(f({type:"codecschange"},e))}),"main"===this.loaderType_&&this.timelineChangeController_.on("pendingtimelinechange",()=>{this.hasEnoughInfoToAppend_()?this.processCallQueue_():Xu(this)}),"audio"===this.loaderType_&&this.timelineChangeController_.on("timelinechange",e=>{this.trigger(f({type:"timelinechange"},e)),this.hasEnoughInfoToLoad_()?this.processLoadQueue_():Xu(this),this.hasEnoughInfoToAppend_()?this.processCallQueue_():Xu(this)})}get mediaSequenceSync_(){return this.syncController_.getMediaSequenceSync(this.loaderType_)}createTransmuxer_(){return cu({remux:!1,alignGopsAtEnd:this.safeAppend_,keepOriginalTimestamps:!0,parse708captions:this.parse708captions_,captionServices:this.captionServices_})}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}dispose(){this.trigger("dispose"),this.state="DISPOSED",this.pause(),this.abort_(),this.transmuxer_&&this.transmuxer_.terminate(),this.resetStats_(),this.checkBufferTimeout_&&window.clearTimeout(this.checkBufferTimeout_),this.syncController_&&this.triggerSyncInfoUpdate_&&this.syncController_.off("syncinfoupdate",this.triggerSyncInfoUpdate_),this.off()}setAudio(e){this.audioDisabled_=!e,e?this.appendInitSegment_.audio=!0:this.sourceUpdater_.removeAudio(0,this.duration_())}abort(){"WAITING"!==this.state?this.pendingSegment_&&(this.pendingSegment_=null):(this.abort_(),this.state="READY",this.paused()||this.monitorBuffer_())}abort_(){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,window.clearTimeout(this.quotaExceededErrorRetryTimeout_),this.quotaExceededErrorRetryTimeout_=null}checkForAbort_(e){return"APPENDING"!==this.state||this.pendingSegment_?!this.pendingSegment_||this.pendingSegment_.requestId!==e:(this.state="READY",!0)}error(e){return"undefined"!=typeof e&&(this.logger_("error occurred:",e),this.error_=e),this.pendingSegment_=null,this.error_}endOfStream(){this.ended_=!0,this.transmuxer_&&uu(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")}buffered_(){var e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return Ud();if("main"===this.loaderType_){var{hasAudio:e,hasVideo:t,isMuxed:i}=e;if(t&&e&&!this.audioDisabled_&&!i)return this.sourceUpdater_.buffered();if(t)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()}initSegmentForMap(e,t=!1){if(!e)return null;var i=Rh(e);let s=this.initSegments_[i];return t&&!s&&e.bytes&&(this.initSegments_[i]=s={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes,tracks:e.tracks,timescales:e.timescales}),s||e}segmentKey(e,t=!1){if(!e)return null;var i=Nh(e);let s=this.keyCache_[i];this.cacheEncryptionKeys_&&t&&!s&&e.bytes&&(this.keyCache_[i]=s={resolvedUri:e.resolvedUri,bytes:e.bytes});t={resolvedUri:(s||e).resolvedUri};return s&&(t.bytes=s.bytes),t}couldBeginLoading_(){return this.playlist_&&!this.paused()}load(){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"))}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}playlist(t,i={}){if(t){var s,r=this.playlist_,n=this.pendingSegment_;this.playlist_=t,this.xhrOptions_=i,"INIT"===this.state&&(t.syncInfo={mediaSequence:t.mediaSequence,time:0},"main"===this.loaderType_)&&this.syncController_.setDateTimeMappingForStart(t);let e=null;if(r&&(r.id?e=r.id:r.uri&&(e=r.uri)),this.logger_(`playlist update [${e} => ${t.id||t.uri}]`),this.mediaSequenceSync_&&(this.mediaSequenceSync_.update(t,this.currentTime_()),this.logger_(`Playlist update: +currentTime: ${this.currentTime_()} +bufferedEnd: ${qd(this.buffered_())} +`,this.mediaSequenceSync_.diagnostics)),this.trigger("syncinfoupdate"),"INIT"===this.state&&this.couldBeginLoading_())return this.init_();r&&r.uri===t.uri?(i=t.mediaSequence-r.mediaSequence,this.logger_(`live window shift [${i}]`),null!==this.mediaIndex&&(this.mediaIndex-=i,this.mediaIndex<0?(this.mediaIndex=null,this.partIndex=null):(s=this.playlist_.segments[this.mediaIndex],!this.partIndex||s.parts&&s.parts.length&&s.parts[this.partIndex]||(s=this.mediaIndex,this.logger_(`currently processing part (index ${this.partIndex}) no longer exists.`),this.resetLoader(),this.mediaIndex=s))),n&&(n.mediaIndex-=i,n.mediaIndex<0?(n.mediaIndex=null,n.partIndex=null):(0<=n.mediaIndex&&(n.segment=t.segments[n.mediaIndex]),0<=n.partIndex&&n.segment.parts&&(n.part=n.segment.parts[n.partIndex]))),this.syncController_.saveExpiredSegmentInfo(r,t)):(null!==this.mediaIndex&&(!t.endList&&"number"==typeof t.partTargetDuration?this.resetLoader():this.resyncLoader()),this.currentMediaInfo_=void 0,this.trigger("playlistupdate"))}}pause(){this.checkBufferTimeout_&&(window.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)}paused(){return null===this.checkBufferTimeout_}resetEverything(e){this.ended_=!1,this.activeInitSegmentId_=null,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"}))}resetLoader(){this.fetchAtBuffer_=!1,this.mediaSequenceSync_&&this.mediaSequenceSync_.resetAppendedStatus(),this.resyncLoader()}resyncLoader(){this.transmuxer_&&uu(this.transmuxer_),this.mediaIndex=null,this.partIndex=null,this.syncPoint_=null,this.isPendingTimestampOffset_=!1;var e=this.currentMediaInfo_&&this.currentMediaInfo_.isFmp4;"hls"!==this.sourceType_||e||(this.shouldForceTimestampOffsetAfterResync_=!0),this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.abort(),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}remove(t,i,s=()=>{},r=!1){if((i=i===1/0?this.duration_():i)<=t)this.logger_("skipping remove because end ${end} is <= start ${start}");else if(this.sourceUpdater_&&this.getMediaInfo_()){let e=1;var n,a=()=>{0===--e&&s()};for(n in!r&&this.audioDisabled_||(e++,this.sourceUpdater_.removeAudio(t,i,a)),!r&&"main"!==this.loaderType_||(this.gopBuffer_=((t,i,e,s)=>{var r=Math.ceil((i-s)*Od),n=Math.ceil((e-s)*Od),i=t.slice();let a=t.length;for(;a--&&!(t[a].pts<=n););if(-1!==a){let e=a+1;for(;e--&&!(t[e].pts<=r););e=Math.max(e,0),i.splice(e,a-e+1)}return i})(this.gopBuffer_,t,i,this.timeMapping_),e++,this.sourceUpdater_.removeVideo(t,i,a)),this.inbandTextTracks_)Fu(t,i,this.inbandTextTracks_[n]);Fu(t,i,this.segmentMetadataTrack_),a()}else this.logger_("skipping remove because no source updater or starting media info")}monitorBuffer_(){this.checkBufferTimeout_&&window.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=window.setTimeout(this.monitorBufferTick_.bind(this),1)}monitorBufferTick_(){"READY"===this.state&&this.fillBuffer_(),this.checkBufferTimeout_&&window.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=window.setTimeout(this.monitorBufferTick_.bind(this),500)}fillBuffer_(){var e,t;this.sourceUpdater_.updating()||(e=this.chooseNextRequest_())&&(t={segmentInfo:Qu({type:this.loaderType_,segment:e})},this.trigger({type:"segmentselected",metadata:t}),"number"==typeof e.timestampOffset&&(this.isPendingTimestampOffset_=!1,this.timelineChangeController_.pendingTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline})),this.loadSegment_(e))}isEndOfStream_(e=this.mediaIndex,t=this.playlist_,i=this.partIndex){var s;return!(!t||!this.mediaSource_)&&(s="number"==typeof e&&t.segments[e],e=e+1===t.segments.length,i=!s||!s.parts||i+1===s.parts.length,t.endList)&&"open"===this.mediaSource_.readyState&&e&&i}chooseNextRequest_(){var e=this.buffered_(),s=qd(e)||0,e=jd(e,this.currentTime_()),r=!this.hasPlayed_()&&1<=e,n=e>=this.goalBufferLength_(),t=this.playlist_.segments;if(!t.length||r||n)return null;this.syncPoint_=this.syncPoint_||this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_(),this.loaderType_);r={partIndex:null,mediaIndex:null,startOfSegment:null,playlist:this.playlist_,isSyncRequest:Boolean(!this.syncPoint_)};if(r.isSyncRequest)r.mediaIndex=function(t,i,s){i=i||[];var r=[];let n=0;for(let e=0;es))return e}return 0===r.length?0:r[r.length-1]}(this.currentTimeline_,t,s),this.logger_("choose next request. Can not find sync point. Fallback to media Index: "+r.mediaIndex);else if(null!==this.mediaIndex){var n=t[this.mediaIndex],a="number"==typeof this.partIndex?this.partIndex:-1;r.startOfSegment=n.end||s,n.parts&&n.parts[a+1]?(r.mediaIndex=this.mediaIndex,r.partIndex=a+1):r.mediaIndex=this.mediaIndex+1}else{let e,t,i;n=this.fetchAtBuffer_?s:this.currentTime_();if(this.mediaSequenceSync_&&this.logger_(`chooseNextRequest_ request after Quality Switch: +For TargetTime: ${n}. +CurrentTime: ${this.currentTime_()} +BufferedEnd: ${s} +Fetch At Buffer: ${this.fetchAtBuffer_} +`,this.mediaSequenceSync_.diagnostics),this.mediaSequenceSync_&&this.mediaSequenceSync_.isReliable){a=this.getSyncInfoFromMediaSequenceSync_(n);if(!a)return this.error({message:s="No sync info found while using media sequence sync",metadata:{errorType:E.Error.StreamingFailedToSelectNextSegment,error:new Error(s)}}),this.logger_("chooseNextRequest_ - no sync info found using media sequence sync"),null;this.logger_(`chooseNextRequest_ mediaSequence syncInfo (${a.start} --> ${a.end})`),e=a.segmentIndex,t=a.partIndex,i=a.start}else{this.logger_("chooseNextRequest_ - fallback to a regular segment selection algorithm, based on a syncPoint.");s=ch.getMediaInfoForTime({exactManifestTimings:this.exactManifestTimings,playlist:this.playlist_,currentTime:n,startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time});e=s.segmentIndex,t=s.partIndex,i=s.startTime}r.getMediaInfoForTime=this.fetchAtBuffer_?"bufferedEnd "+n:"currentTime "+n,r.mediaIndex=e,r.startOfSegment=i,r.partIndex=t,this.logger_(`choose next request. Playlist switched and we have a sync point. Media Index: ${r.mediaIndex} `)}a=t[r.mediaIndex];let i=a&&"number"==typeof r.partIndex&&a.parts&&a.parts[r.partIndex];if(!a||"number"==typeof r.partIndex&&!i)return null;"number"!=typeof r.partIndex&&a.parts&&(r.partIndex=0,i=a.parts[0]);s=this.vhs_.playlists&&this.vhs_.playlists.main&&this.vhs_.playlists.main.independentSegments||this.playlist_.independentSegments,e||!i||s||i.independent||(0===r.partIndex?(e=(n=t[r.mediaIndex-1]).parts&&n.parts.length&&n.parts[n.parts.length-1])&&e.independent&&(--r.mediaIndex,r.partIndex=n.parts.length-1,r.independent="previous segment"):a.parts[r.partIndex-1].independent&&(--r.partIndex,r.independent="previous part")),s=this.mediaSource_&&"ended"===this.mediaSource_.readyState;return r.mediaIndex>=t.length-1&&s&&!this.seeking_()?null:(this.shouldForceTimestampOffsetAfterResync_&&(this.shouldForceTimestampOffsetAfterResync_=!1,r.forceTimestampOffset=!0,this.logger_("choose next request. Force timestamp offset after loader resync")),this.generateSegmentInfo_(r))}getSyncInfoFromMediaSequenceSync_(e){var t;return this.mediaSequenceSync_&&(e!==(t=Math.max(e,this.mediaSequenceSync_.start))&&this.logger_(`getSyncInfoFromMediaSequenceSync_. Pulled target time from ${e} to `+t),e=this.mediaSequenceSync_.getSyncInfoForTime(t))?e.isAppended?(t=this.mediaSequenceSync_.getSyncInfoForTime(e.end))?(t.isAppended&&this.logger_("getSyncInfoFromMediaSequenceSync_: We encounter unexpected scenario where next media sequence sync info is also appended!"),t):null:e:null}generateSegmentInfo_(e){var{independent:e,playlist:t,mediaIndex:i,startOfSegment:s,isSyncRequest:r,partIndex:n,forceTimestampOffset:a,getMediaInfoForTime:o}=e,l=t.segments[i],d="number"==typeof n&&l.parts[n],i={requestId:"segment-loader-"+Math.random(),uri:d&&d.resolvedUri||l.resolvedUri,mediaIndex:i,partIndex:d?n:null,isSyncRequest:r,startOfSegment:s,playlist:t,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:l.timeline,duration:d&&d.duration||l.duration,segment:l,part:d,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:o,independent:e},n="undefined"!=typeof a?a:this.isPendingTimestampOffset_,r=(i.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:l.timeline,currentTimeline:this.currentTimeline_,startOfSegment:s,buffered:this.buffered_(),overrideCheck:n}),qd(this.sourceUpdater_.audioBuffered()));return"number"==typeof r&&(i.audioAppendStart=r-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(i.gopsToAlignWith=((e,t,i)=>{if("undefined"==typeof t||null===t||!e.length)return[];var s=Math.ceil((t-i+3)*Od);let r;for(r=0;rs);r++);return e.slice(r)})(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),i}timestampOffsetForSegment_(e){return{segmentTimeline:e,currentTimeline:t,startOfSegment:i,buffered:s,overrideCheck:r}=[e][0],r||e!==t?!(e!ch.isIncompatible(e));let d=e.filter(ch.isEnabled);var e=(d=d.length?d:e.filter(e=>!ch.isDisabled(e))).filter(ch.hasAttribute.bind(null,"BANDWIDTH")).map(e=>{var t=l.getSyncPoint(e,r,o,i)?1:2;return{playlist:e,rebufferingImpact:ch.estimateSegmentRequestTime(n,s,e)*t-a}}),h=e.filter(e=>e.rebufferingImpact<=0);return Nu(h,(e,t)=>fu(t.playlist,e.playlist)),h.length?h[0]:(Nu(e,(e,t)=>e.rebufferingImpact-t.rebufferingImpact),e[0]||null)}({main:this.vhs_.playlists.main,currentTime:e,bandwidth:i,duration:this.duration_(),segmentDuration:s,timeUntilRebuffer:r,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(n){var a=t-r-n.rebufferingImpact;let e=.5;r<=zd&&(e=1),!n.playlist||n.playlist.uri===this.playlist_.uri||a{a[e.stream]=a[e.stream]||{startTime:1/0,captions:[],endTime:0};var t=a[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(a).forEach(e=>{var{startTime:t,endTime:i,captions:s}=a[e],r=this.inbandTextTracks_;this.logger_(`adding cues from ${t} -> ${i} for `+e),function(r,n,a){if(!r[a]){n.trigger({type:"usage",name:"vhs-608"});let s=a;/^cc708_/.test(a)&&(s="SERVICE"+a.split("_")[1]);var o=n.textTracks().getTrackById(s);if(o)r[a]=o;else{let e=a,t=a,i=!1;o=(n.options_.vhs&&n.options_.vhs.captionServices||{})[s];o&&(e=o.label,t=o.language,i=o.default),r[a]=n.addRemoteTextTrack({kind:"captions",id:s,default:i,label:e,language:t},!1).track}}}(r,this.vhs_.tech_,e),Fu(t,i,r[e]),function({inbandTextTracks:n,captionArray:e,timestampOffset:a}){if(e){let r=window.WebKitDataCue||window.VTTCue;e.forEach(i=>{let s=i.stream;i.content?i.content.forEach(e=>{var t=new r(i.startTime+a,i.endTime+a,e.text);t.line=e.line,t.align="left",t.position=e.position,t.positionAlign="line-left",n[s].addCue(t)}):n[s].addCue(new r(i.startTime+a,i.endTime+a,i.text))})}}({captionArray:s,inbandTextTracks:r,timestampOffset:n})}),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}else this.metadataQueue_.caption.push(this.handleCaptions_.bind(this,e,t))}handleId3_(e,t,i){this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId)||(this.pendingSegment_.hasAppendedData_?this.addMetadataToTextTrack(i,t,this.duration_()):this.metadataQueue_.id3.push(this.handleId3_.bind(this,e,t,i)))}processMetadataQueue_(){this.metadataQueue_.id3.forEach(e=>e()),this.metadataQueue_.caption.forEach(e=>e()),this.metadataQueue_.id3=[],this.metadataQueue_.caption=[]}processCallQueue_(){var e=this.callQueue_;this.callQueue_=[],e.forEach(e=>e())}processLoadQueue_(){var e=this.loadQueue_;this.loadQueue_=[],e.forEach(e=>e())}hasEnoughInfoToLoad_(){var e;return"audio"!==this.loaderType_||!(!(e=this.pendingSegment_)||this.getCurrentMediaInfo_()&&Gu({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))}getCurrentMediaInfo_(e=this.pendingSegment_){return e&&e.trackInfo||this.currentMediaInfo_}getMediaInfo_(e=this.pendingSegment_){return this.getCurrentMediaInfo_(e)||this.startingMediaInfo_}getPendingSegmentPlaylist(){return this.pendingSegment_?this.pendingSegment_.playlist:null}hasEnoughInfoToAppend_(){var e,t,i,s;return!!this.sourceUpdater_.ready()&&!(this.waitingOnRemove_||this.quotaExceededErrorRetryTimeout_||(e=this.pendingSegment_,t=this.getCurrentMediaInfo_(),!e)||!t||({hasAudio:t,hasVideo:i,isMuxed:s}=t,i&&!e.videoTimingInfo)||t&&!this.audioDisabled_&&!s&&!e.audioTimingInfo||Gu({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))}handleData_(t,e){if(this.earlyAbortWhenNeeded_(t.stats),!this.checkForAbort_(t.requestId))if(this.callQueue_.length||!this.hasEnoughInfoToAppend_())Xu(this),this.callQueue_.push(this.handleData_.bind(this,t,e));else{var i=this.pendingSegment_;if(this.setTimeMapping_(i.timeline),this.updateMediaSecondsLoaded_(i.part||i.segment),"closed"!==this.mediaSource_.readyState){if(t.map&&(t.map=this.initSegmentForMap(t.map,!0),i.segment.map=t.map),t.key&&this.segmentKey(t.key,!0),i.isFmp4=t.isFmp4,i.timingInfo=i.timingInfo||{},i.isFmp4)this.trigger("fmp4"),i.timingInfo.start=i[Wu(e.type)].start;else{t=this.getCurrentMediaInfo_(),t="main"===this.loaderType_&&t&&t.hasVideo;let e;t&&(e=i.videoTimingInfo.start),i.timingInfo.start=this.trueSegmentStart_({currentStart:i.timingInfo.start,playlist:i.playlist,mediaIndex:i.mediaIndex,currentVideoTimestampOffset:this.sourceUpdater_.videoTimestampOffset(),useVideoTimingInfo:t,firstVideoFrameTimeForData:e,videoTimingInfo:i.videoTimingInfo,audioTimingInfo:i.audioTimingInfo})}if(this.updateAppendInitSegmentStatus(i,e.type),this.updateSourceBufferTimestampOffset_(i),i.isSyncRequest){this.updateTimingInfoEnd_(i),this.syncController_.saveSegmentTimingInfo({segmentInfo:i,shouldSaveTimelineMapping:"main"===this.loaderType_});t=this.chooseNextRequest_();if(t.mediaIndex!==i.mediaIndex||t.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,e)}}}updateAppendInitSegmentStatus(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)}getInitSegmentAndUpdateState_({type:e,initSegment:t,map:i,playlist:s}){if(i){var r=Rh(i);if(this.activeInitSegmentId_===r)return null;t=this.initSegmentForMap(i,!0).bytes,this.activeInitSegmentId_=r}return t&&this.appendInitSegment_[e]?(this.playlistOfLastInitSegment_[e]=s,this.appendInitSegment_[e]=!1,this.activeInitSegmentId_=null,t):null}handleQuotaExceededError_({segmentInfo:e,type:t,bytes:i},s){var r=this.sourceUpdater_.audioBuffered(),n=this.sourceUpdater_.videoBuffered(),a=(1{this.logger_("On QUOTA_EXCEEDED_ERR, retrying append in 1s"),this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=window.setTimeout(()=>{this.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),this.quotaExceededErrorRetryTimeout_=null,this.processCallQueue_()},1e3)},!0))}handleAppendError_({segmentInfo:e,type:t,bytes:i},s){s&&(22===s.code?this.handleQuotaExceededError_({segmentInfo:e,type:t,bytes:i}):(this.logger_("Received non QUOTA_EXCEEDED_ERR on append",s),this.error({message:`${t} append of ${i.length}b failed for segment `+`#${e.mediaIndex} in playlist `+e.playlist.id,metadata:{errorType:E.Error.StreamingFailedToAppendSegment}}),this.trigger("appenderror")))}appendToSourceBuffer_({segmentInfo:e,type:t,initSegment:i,data:s,bytes:r}){if(!r){var n=[s];let e=s.byteLength;i&&(n.unshift(i),e+=i.byteLength),r=(e=>{let t=0,i;return e.bytes&&(i=new Uint8Array(e.bytes),e.segments.forEach(e=>{i.set(e,t),t+=e.byteLength})),i})({bytes:e,segments:n})}s={segmentInfo:Qu({type:this.loaderType_,segment:e})};this.trigger({type:"segmentappendstart",metadata:s}),this.sourceUpdater_.appendBuffer({segmentInfo:e,type:t,bytes:r},this.handleAppendError_.bind(this,{segmentInfo:e,type:t,bytes:r}))}handleSegmentTimingInfo_(e,t,i){this.pendingSegment_&&t===this.pendingSegment_.requestId&&((t=this.pendingSegment_.segment)[e=e+"TimingInfo"]||(t[e]={}),t[e].transmuxerPrependedSeconds=i.prependedContentDuration||0,t[e].transmuxedPresentationStart=i.start.presentation,t[e].transmuxedDecodeStart=i.start.decode,t[e].transmuxedPresentationEnd=i.end.presentation,t[e].transmuxedDecodeEnd=i.end.decode,t[e].baseMediaDecodeTime=i.baseMediaDecodeTime)}appendData_(e,t){var{type:i,data:s}=t;s&&s.byteLength&&("audio"===i&&this.audioDisabled_||(t=this.getInitSegmentAndUpdateState_({type:i,initSegment:t.initSegment,playlist:e.playlist,map:e.isFmp4?e.segment.map:null}),this.appendToSourceBuffer_({segmentInfo:e,type:i,initSegment:t,data:s})))}loadSegment_(t){this.state="WAITING",this.pendingSegment_=t,this.trimBackBuffer_(t),"number"==typeof t.timestampOffset&&this.transmuxer_&&this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.hasEnoughInfoToLoad_()?this.updateTransmuxerAndRequestSegment_(t):(Xu(this),this.loadQueue_.push(()=>{var e=f({},t,{forceTimestampOffset:!0});f(t,this.generateSegmentInfo_(e)),this.isPendingTimestampOffset_=!1,this.updateTransmuxerAndRequestSegment_(t)}))}updateTransmuxerAndRequestSegment_(s){this.shouldUpdateTransmuxerTimestampOffset_(s.timestampOffset)&&(this.gopBuffer_.length=0,s.gopsToAlignWith=[],this.timeMapping_=0,this.transmuxer_.postMessage({action:"reset"}),this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:s.timestampOffset}));var e=this.createSimplifiedSegmentObj_(s),t=this.isEndOfStream_(s.mediaIndex,s.playlist,s.partIndex),i=null!==this.mediaIndex,r=s.timeline!==this.currentTimeline_&&0{this.logger_("received endedtimeline callback")},id3Fn:this.handleId3_.bind(this),dataFn:this.handleData_.bind(this),doneFn:this.segmentRequestFinished_.bind(this),onTransmuxerLog:({message:e,level:t,stream:i})=>{this.logger_($u(s)+` logged from transmuxer stream ${i} as a ${t}: `+e)},triggerSegmentEventFn:({type:e,segment:t,keyInfo:i,trackInfo:s,timingInfo:r})=>{t={segmentInfo:Qu({segment:t})};i&&(t.keyInfo=i),s&&(t.trackInfo=s),r&&(t.timingInfo=r),this.trigger({type:e,metadata:t})}})}trimBackBuffer_(e){var t=((e,t,i)=>{let s=t-R.BACK_BUFFER_LENGTH;return e.length&&(s=Math.max(s,e.start(0))),Math.min(t-i,s)})(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);0{if(!t.length)return e;if(i)return t.slice();var s=t[0].pts;let r=0;for(r;r=s);r++);return e.slice(0,r).concat(t)})(this.gopBuffer_,i.gopInfo,this.safeAppend_)),this.state="APPENDING",this.trigger("appending"),this.waitForAppendsToComplete_(e)}}setTimeMapping_(e){e=this.syncController_.mappingForTimeline(e);null!==e&&(this.timeMapping_=e)}updateMediaSecondsLoaded_(e){"number"==typeof e.start&&"number"==typeof e.end?this.mediaSecondsLoaded+=e.end-e.start:this.mediaSecondsLoaded+=e.duration}shouldUpdateTransmuxerTimestampOffset_(e){return null!==e&&("main"===this.loaderType_&&e!==this.sourceUpdater_.videoTimestampOffset()||!this.audioDisabled_&&e!==this.sourceUpdater_.audioTimestampOffset())}trueSegmentStart_({currentStart:e,playlist:t,mediaIndex:i,firstVideoFrameTimeForData:s,currentVideoTimestampOffset:r,useVideoTimingInfo:n,videoTimingInfo:a,audioTimingInfo:o}){return"undefined"!=typeof e?e:n?(e=t.segments[i-1],0!==i&&e&&"undefined"!=typeof e.start&&e.end===s+r?a.start:s):o.start}waitForAppendsToComplete_(e){var t,i,s=this.getCurrentMediaInfo_(e);s?({hasAudio:s,hasVideo:i,isMuxed:t}=s,i="main"===this.loaderType_&&i,s=!this.audioDisabled_&&s&&!t,e.waitingOnAppends=0,e.hasAppendedData_?(i&&e.waitingOnAppends++,s&&e.waitingOnAppends++,i&&this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this,e)),s&&this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this,e))):(e.timingInfo||"number"!=typeof e.timestampOffset||(this.isPendingTimestampOffset_=!0),e.timingInfo={start:0},e.waitingOnAppends++,this.isPendingTimestampOffset_||(this.updateSourceBufferTimestampOffset_(e),this.processMetadataQueue_()),this.checkAppendsDone_(e))):(this.error({message:"No starting media returned, likely due to an unsupported media format.",playlistExclusionDuration:1/0}),this.trigger("error"))}checkAppendsDone_(e){this.checkForAbort_(e.requestId)||(e.waitingOnAppends--,0===e.waitingOnAppends&&this.handleAppendsDone_())}checkForIllegalMediaSwitch(e){i=this.loaderType_,t=this.getCurrentMediaInfo_(),e=e;var t,i="main"===i&&t&&e?e.hasAudio||e.hasVideo?t.hasVideo&&!e.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&&e.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;return!!i&&(this.error({message:i,playlistExclusionDuration:1/0}),this.trigger("error"),!0)}updateSourceBufferTimestampOffset_(t){if(null!==t.timestampOffset&&"number"==typeof t.timingInfo.start&&!t.changedTimestampOffset&&"main"===this.loaderType_){let e=!1;t.timestampOffset-=this.getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:t.segment.videoTimingInfo,audioTimingInfo:t.segment.audioTimingInfo,timingInfo:t.timingInfo}),t.changedTimestampOffset=!0,t.timestampOffset!==this.sourceUpdater_.videoTimestampOffset()&&(this.sourceUpdater_.videoTimestampOffset(t.timestampOffset),e=!0),t.timestampOffset!==this.sourceUpdater_.audioTimestampOffset()&&(this.sourceUpdater_.audioTimestampOffset(t.timestampOffset),e=!0),e&&this.trigger("timestampoffset")}}getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e,audioTimingInfo:t,timingInfo:i}){return this.useDtsForTimestampOffset_?e&&"number"==typeof e.transmuxedDecodeStart?e.transmuxedDecodeStart:t&&"number"==typeof t.transmuxedDecodeStart?t.transmuxedDecodeStart:i.start:i.start}updateTimingInfoEnd_(e){e.timingInfo=e.timingInfo||{};var t=this.getMediaInfo_(),t="main"===this.loaderType_&&t&&t.hasVideo&&e.videoTimingInfo?e.videoTimingInfo:e.audioTimingInfo;t&&(e.timingInfo.end="number"==typeof t.end?t.end:t.start+e.duration)}handleAppendsDone_(){var e,t,i;this.pendingSegment_&&(e={segmentInfo:Qu({type:this.loaderType_,segment:this.pendingSegment_})},this.trigger({type:"appendsdone",metadata:e})),this.pendingSegment_?((e=this.pendingSegment_).part&&e.part.syncInfo?e.part.syncInfo.markAppended():e.segment.syncInfo&&e.segment.syncInfo.markAppended(),this.updateTimingInfoEnd_(e),this.shouldSaveSegmentTimingInfo_&&this.syncController_.saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:"main"===this.loaderType_}),(t=Yu(e,this.sourceType_))&&("warn"===t.severity?E.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_("Throwing away un-appended sync request "+$u(e)):(this.logger_("Appended "+$u(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"),t=e.segment,i=e.part,t=t.end&&this.currentTime_()-t.end>3*e.playlist.targetDuration,i=i&&i.end&&this.currentTime_()-i.end>3*e.playlist.partTargetDuration,t||i?(this.logger_(`bad ${t?"segment":"part"} `+$u(e)),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_()))):(this.state="READY",this.paused()||this.monitorBuffer_())}recordThroughput_(e){var t,i;e.duration<1/60?this.logger_("Ignoring segment's throughput because its duration of "+e.duration+" is less than the min to record "+1/60):(t=this.throughput.rate,i=Date.now()-e.endOfAllRequests+1,e=Math.floor(e.byteLength/i*8*1e3),this.throughput.rate+=(e-t)/++this.throughput.count)}addSegmentMetadataCue_(e){var t,i,s,r;this.segmentMetadataTrack_&&(t=(r=e.segment).start,i=r.end,zu(t))&&zu(i)&&(Fu(t,i,this.segmentMetadataTrack_),s=window.WebKitDataCue||window.VTTCue,r={custom:r.custom,dateTimeObject:r.dateTimeObject,dateTimeString:r.dateTimeString,programDateTime:r.programDateTime,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:t,end:i},(e=new s(t,i,JSON.stringify(r))).value=r,this.segmentMetadataTrack_.addCue(e))}}function Zu(){}function ec(e){return"string"!=typeof e?e:e.replace(/./,e=>e.toUpperCase())}let tc=["video","audio"],ic=(e,t)=>{var i=t[e+"Buffer"];return i&&i.updating||t.queuePending[e]},sc=(i,s)=>{if(0!==s.queue.length){let e=0,t=s.queue[e];if("mediaSource"===t.type)s.updating()||"closed"===s.mediaSource.readyState||(s.queue.shift(),t.action(s),t.doneFn&&t.doneFn(),sc("audio",s),sc("video",s));else if("mediaSource"!==i&&s.ready()&&"closed"!==s.mediaSource.readyState&&!ic(i,s)){if(t.type!==i){if(null===(e=((t,i)=>{for(let e=0;e{var i=t[e+"Buffer"],s=ec(e);i&&(i.removeEventListener("updateend",t[`on${s}UpdateEnd_`]),i.removeEventListener("error",t[`on${s}Error_`]),t.codecs[e]=null,t[e+"Buffer"]=null)},nc=(e,t)=>e&&t&&-1!==Array.prototype.indexOf.call(e.sourceBuffers,t),ac={appendBuffer:(s,r,n)=>(t,i)=>{var e=i[t+"Buffer"];if(nc(i.mediaSource,e)){i.logger_(`Appending segment ${r.mediaIndex}'s ${s.length} bytes to ${t}Buffer`);try{e.appendBuffer(s)}catch(e){i.logger_(`Error with code ${e.code} `+(22===e.code?"(QUOTA_EXCEEDED_ERR) ":"")+`when appending segment ${r.mediaIndex} to ${t}Buffer`),i.queuePending[t]=null,n(e)}}},remove:(s,r)=>(t,i)=>{var e=i[t+"Buffer"];if(nc(i.mediaSource,e)){i.logger_(`Removing ${s} to ${r} from ${t}Buffer`);try{e.remove(s,r)}catch(e){i.logger_(`Remove ${s} to ${r} from ${t}Buffer failed`)}}},timestampOffset:s=>(e,t)=>{var i=t[e+"Buffer"];nc(t.mediaSource,i)&&(t.logger_(`Setting ${e}timestampOffset to `+s),i.timestampOffset=s)},callback:i=>(e,t)=>{i()},endOfStream:t=>e=>{if("open"===e.mediaSource.readyState){e.logger_(`Calling mediaSource endOfStream(${t||""})`);try{e.mediaSource.endOfStream(t)}catch(e){E.log.warn("Failed to call media source endOfStream",e)}}},duration:t=>e=>{e.logger_("Setting mediaSource duration to "+t);try{e.mediaSource.duration=t}catch(e){E.log.warn("Failed to set media source duration",e)}},abort:()=>(t,e)=>{if("open"===e.mediaSource.readyState){var i=e[t+"Buffer"];if(nc(e.mediaSource,i)){e.logger_(`calling abort on ${t}Buffer`);try{i.abort()}catch(e){E.log.warn(`Failed to abort on ${t}Buffer`,e)}}}},addSourceBuffer:(s,r)=>e=>{var t=ec(s),i=na(r),i=(e.logger_(`Adding ${s}Buffer with codec ${r} to mediaSource`),e.mediaSource.addSourceBuffer(i));i.addEventListener("updateend",e[`on${t}UpdateEnd_`]),i.addEventListener("error",e[`on${t}Error_`]),e.codecs[s]=r,e[s+"Buffer"]=i},removeSourceBuffer:i=>e=>{var t=e[i+"Buffer"];if(rc(i,e),nc(e.mediaSource,t)){e.logger_(`Removing ${i}Buffer with codec ${e.codecs[i]} from mediaSource`);try{e.mediaSource.removeSourceBuffer(t)}catch(e){E.log.warn(`Failed to removeSourceBuffer ${i}Buffer`,e)}}},changeType:o=>(t,i)=>{var e=i[t+"Buffer"],s=na(o);if(nc(i.mediaSource,e)){var r=o.substring(0,o.indexOf(".")),n=i.codecs[t],a=n.substring(0,n.indexOf("."));if(a!==r){a={codecsChangeInfo:{from:n,to:o}};i.trigger({type:"codecschange",metadata:a}),i.logger_(`changing ${t}Buffer codec from ${n} to `+o);try{e.changeType(s),i.codecs[t]=o}catch(e){a.errorType=E.Error.StreamingCodecsChangeError,(a.error=e).metadata=a,i.error_=e,i.trigger("error"),E.log.warn(`Failed to changeType on ${t}Buffer`,e)}}}}},oc=({type:e,sourceUpdater:t,action:i,doneFn:s,name:r})=>{t.queue.push({type:e,action:i,doneFn:s,name:r}),sc(e,t)},lc=(i,s)=>e=>{var t=function(t){if(0===t.length)return"Buffered Ranges are empty";let i="Buffered Ranges: \n";for(let e=0;e ${r}. Duration (${r-s}) +`}return i}(s[i+"Buffered"]());s.logger_(`received "updateend" event for ${i} Source Buffer: `,t),s.queuePending[i]&&(t=s.queuePending[i].doneFn,s.queuePending[i]=null,t)&&t(s[i+"Error_"]),sc(i,s)};class dc extends E.EventTarget{constructor(e){super(),this.mediaSource=e,this.sourceopenListener_=()=>sc("mediaSource",this),this.mediaSource.addEventListener("sourceopen",this.sourceopenListener_),this.logger_=Md("SourceUpdater"),this.audioTimestampOffset_=0,this.videoTimestampOffset_=0,this.queue=[],this.queuePending={audio:null,video:null},this.delayedAudioAppendQueue_=[],this.videoAppendQueued_=!1,this.codecs={},this.onVideoUpdateEnd_=lc("video",this),this.onAudioUpdateEnd_=lc("audio",this),this.onVideoError_=e=>{this.videoError_=e},this.onAudioError_=e=>{this.audioError_=e},this.createdSourceBuffers_=!1,this.initializedEme_=!1,this.triggeredReady_=!1}initializedEme(){this.initializedEme_=!0,this.triggerReady()}hasCreatedSourceBuffers(){return this.createdSourceBuffers_}hasInitializedAnyEme(){return this.initializedEme_}ready(){return this.hasCreatedSourceBuffers()&&this.hasInitializedAnyEme()}createSourceBuffers(e){this.hasCreatedSourceBuffers()||(this.addOrChangeSourceBuffers(e),this.createdSourceBuffers_=!0,this.trigger("createdsourcebuffers"),this.triggerReady())}triggerReady(){this.ready()&&!this.triggeredReady_&&(this.triggeredReady_=!0,this.trigger("ready"))}addSourceBuffer(e,t){oc({type:"mediaSource",sourceUpdater:this,action:ac.addSourceBuffer(e,t),name:"addSourceBuffer"})}abort(e){oc({type:e,sourceUpdater:this,action:ac.abort(e),name:"abort"})}removeSourceBuffer(e){this.canRemoveSourceBuffer()?oc({type:"mediaSource",sourceUpdater:this,action:ac.removeSourceBuffer(e),name:"removeSourceBuffer"}):E.log.error("removeSourceBuffer is not supported!")}canRemoveSourceBuffer(){return!E.browser.IS_FIREFOX&&window.MediaSource&&window.MediaSource.prototype&&"function"==typeof window.MediaSource.prototype.removeSourceBuffer}static canChangeType(){return window.SourceBuffer&&window.SourceBuffer.prototype&&"function"==typeof window.SourceBuffer.prototype.changeType}canChangeType(){return this.constructor.canChangeType()}changeType(e,t){this.canChangeType()?oc({type:e,sourceUpdater:this,action:ac.changeType(t),name:"changeType"}):E.log.error("changeType is not supported!")}addOrChangeSourceBuffers(i){if(!i||"object"!=typeof i||0===Object.keys(i).length)throw new Error("Cannot addOrChangeSourceBuffers to undefined codecs");Object.keys(i).forEach(e=>{var t=i[e];if(!this.hasCreatedSourceBuffers())return this.addSourceBuffer(e,t);this.canChangeType()&&this.changeType(e,t)})}appendBuffer(e,t){var{segmentInfo:i,type:s,bytes:r}=e;this.processedAppend_=!0,"audio"===s&&this.videoBuffer&&!this.videoAppendQueued_?(this.delayedAudioAppendQueue_.push([e,t]),this.logger_(`delayed audio append of ${r.length} until video append`)):(e=t,oc({type:s,sourceUpdater:this,action:ac.appendBuffer(r,i||{mediaIndex:-1},e),doneFn:t,name:"appendBuffer"}),"video"===s&&(this.videoAppendQueued_=!0,this.delayedAudioAppendQueue_.length)&&(r=this.delayedAudioAppendQueue_.slice(),this.logger_(`queuing delayed audio ${r.length} appendBuffers`),this.delayedAudioAppendQueue_.length=0,r.forEach(e=>{this.appendBuffer.apply(this,e)})))}audioBuffered(){return nc(this.mediaSource,this.audioBuffer)&&this.audioBuffer.buffered||Ud()}videoBuffered(){return nc(this.mediaSource,this.videoBuffer)&&this.videoBuffer.buffered||Ud()}buffered(){var e=nc(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,t=nc(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;return t&&!e?this.audioBuffered():e&&!t?this.videoBuffered():function(e,t){let i=null,s=null,r=0;var n=[],a=[];if(!(e&&e.length&&t&&t.length))return Ud();let o=e.length;for(;o--;)n.push({time:e.start(o),type:"start"}),n.push({time:e.end(o),type:"end"});for(o=t.length;o--;)n.push({time:t.start(o),type:"start"}),n.push({time:t.end(o),type:"end"});for(n.sort(function(e,t){return e.time-t.time}),o=0;o{this.abort(e),this.canRemoveSourceBuffer()?this.removeSourceBuffer(e):this[e+"QueueCallback"](()=>rc(e,this))}),this.videoAppendQueued_=!1,this.delayedAudioAppendQueue_.length=0,this.sourceopenListener_&&this.mediaSource.removeEventListener("sourceopen",this.sourceopenListener_),this.off()}}let hc=e=>decodeURIComponent(escape(String.fromCharCode.apply(null,e))),uc=new Uint8Array("\n\n".split("").map(e=>e.charCodeAt(0)));class cc extends Error{constructor(){super("Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.")}}class pc extends Ju{constructor(e,t={}){super(e,t),this.mediaSource_=null,this.subtitlesTrack_=null,this.featuresNativeTextTracks_=e.featuresNativeTextTracks,this.loadVttJs=e.loadVttJs,this.shouldSaveSegmentTimingInfo_=!1}createTransmuxer_(){return null}buffered_(){var e;return this.subtitlesTrack_&&this.subtitlesTrack_.cues&&this.subtitlesTrack_.cues.length?Ud([[(e=this.subtitlesTrack_.cues)[0].startTime,e[e.length-1].startTime]]):Ud()}initSegmentForMap(e,t=!1){if(!e)return null;var i=Rh(e);let s=this.initSegments_[i];return t&&!s&&e.bytes&&(t=uc.byteLength+e.bytes.byteLength,(t=new Uint8Array(t)).set(e.bytes),t.set(uc,e.bytes.byteLength),this.initSegments_[i]=s={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:t}),s||e}couldBeginLoading_(){return this.playlist_&&this.subtitlesTrack_&&!this.paused()}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}track(e){return"undefined"!=typeof e&&(this.subtitlesTrack_=e,"INIT"===this.state&&this.couldBeginLoading_())&&this.init_(),this.subtitlesTrack_}remove(e,t){Fu(e,t,this.subtitlesTrack_)}fillBuffer_(){var e=this.chooseNextRequest_();e&&(null===this.syncController_.timestampOffsetForTimeline(e.timeline)?(this.syncController_.one("timestampoffset",()=>{this.state="READY",this.paused()||this.monitorBuffer_()}),this.state="WAITING_ON_TIMELINE"):this.loadSegment_(e))}timestampOffsetForSegment_(){return null}chooseNextRequest_(){return this.skipEmptySegments_(super.chooseNextRequest_())}skipEmptySegments_(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}stopForError(e){this.error(e),this.state="READY",this.pause(),this.trigger("error")}segmentRequestFinished_(e,t,i){if(this.subtitlesTrack_)if(this.saveTransferStats_(t.stats),this.pendingSegment_)if(e)e.code===_u.TIMEOUT&&this.handleTimeout_(),e.code===_u.ABORTED?this.mediaRequestsAborted+=1:this.mediaRequestsErrored+=1,this.stopForError(e);else{var s=this.pendingSegment_,r=(this.saveBandwidthRelatedStats_(s.duration,t.stats),t.key&&this.segmentKey(t.key,!0),this.state="APPENDING",this.trigger("appending"),s.segment);if(r.map&&(r.map.bytes=t.map.bytes),s.bytes=t.bytes,"function"!=typeof window.WebVTT&&"function"==typeof this.loadVttJs)this.state="WAITING_ON_VTTJS",this.loadVttJs().then(()=>this.segmentRequestFinished_(e,t,i),()=>this.stopForError({message:"Error loading vtt.js"}));else{r.requested=!0;try{this.parseVTTCues_(s)}catch(e){return void this.stopForError({message:e.message,metadata:{errorType:E.Error.StreamingVttParserError,error:e}})}this.updateTimeMapping_(s,this.syncController_.timelines[s.timeline],this.playlist_),s.cues.length?s.timingInfo={start:s.cues[0].startTime,end:s.cues[s.cues.length-1].endTime}:s.timingInfo={start:s.startOfSegment,end:s.startOfSegment+s.duration},s.isSyncRequest?(this.trigger("syncinfoupdate"),this.pendingSegment_=null,this.state="READY"):(s.byteLength=s.bytes.byteLength,this.mediaSecondsLoaded+=r.duration,s.cues.forEach(e=>{this.subtitlesTrack_.addCue(this.featuresNativeTextTracks_?new window.VTTCue(e.startTime,e.endTime,e.text):e)}),function(t){var i=t.cues;if(i){var s={};for(let e=i.length-1;0<=e;e--){var r=i[e],n=r.startTime+`-${r.endTime}-`+r.text;s[n]?t.removeCue(r):s[n]=r}}}(this.subtitlesTrack_),this.handleAppendsDone_())}}else this.state="READY",this.mediaRequestsAborted+=1;else this.state="READY"}handleData_(){}updateTimingInfoEnd_(){}parseVTTCues_(t){let e,i=!1;if("function"!=typeof window.WebVTT)throw new cc;"function"==typeof window.TextDecoder?e=new window.TextDecoder("utf8"):(e=window.WebVTT.StringDecoder(),i=!0);var s=new window.WebVTT.Parser(window,window.vttjs,e);if(t.cues=[],t.timestampmap={MPEGTS:0,LOCAL:0},s.oncue=t.cues.push.bind(t.cues),s.ontimestampmap=e=>{t.timestampmap=e},s.onparsingerror=e=>{E.log.warn("Error encountered when parsing cues: "+e.message)},t.segment.map){let e=t.segment.map.bytes;i&&(e=hc(e)),s.parse(e)}let r=t.bytes;i&&(r=hc(r)),s.parse(r),s.flush()}updateTimeMapping_(e,r,t){var i=e.segment;if(r)if(e.cues.length){var{MPEGTS:n,LOCAL:a}=e.timestampmap;let s=n/Od-a+r.mapping;e.cues.forEach(e=>{var t=e.endTime-e.startTime,i=this.handleRollover_(e.startTime+s,r.time);e.startTime=Math.max(i,0),e.endTime=Math.max(i+t,0)}),t.syncInfo||(n=e.cues[0].startTime,a=e.cues[e.cues.length-1].startTime,t.syncInfo={mediaSequence:t.mediaSequence+e.mediaIndex,time:Math.min(n,a-i.duration)})}else i.empty=!0}handleRollover_(e,t){if(null===t)return e;let i=e*Od;var s=t*Od;let r;for(r=s=this.start&&ee.resetAppendedStatus())}}class fc{constructor(){this.storage_=new Map,this.diagnostics_="",this.isReliable_=!1,this.start_=-1/0,this.end_=1/0}get start(){return this.start_}get end(){return this.end_}get diagnostics(){return this.diagnostics_}get isReliable(){return this.isReliable_}resetAppendedStatus(){this.storage_.forEach(e=>e.resetAppendStatus())}update(e,t){var{mediaSequence:e,segments:i}=e;if(this.isReliable_=this.isReliablePlaylist_(e,i),this.isReliable_)return this.updateStorage_(i,e,this.calculateBaseTime_(e,t))}getSyncInfoForTime(e){for(var{segmentSyncInfo:t,partsSyncInfo:i}of this.storage_.values())if(i.length){for(var s of i)if(s.isInRange(e))return s}else if(t.isInRange(e))return t;return null}getSyncInfoForMediaSequence(e){return this.storage_.get(e)}updateStorage_(e,t,i){let d=new Map,h="\n",u=i,c=t;this.start_=u,e.forEach((e,a)=>{let o=this.storage_.get(c);var t=u,i=t+e.duration,s=Boolean(o&&o.segmentSyncInfo&&o.segmentSyncInfo.isAppended),r=new mc({start:t,end:i,appended:s,segmentIndex:a});e.syncInfo=r;let l=u;var n=(e.parts||[]).map((e,t)=>{var i=l,s=l+e.duration,r=Boolean(o&&o.partsSyncInfo&&o.partsSyncInfo[t]&&o.partsSyncInfo[t].isAppended),n=new mc({start:i,end:s,appended:r,segmentIndex:a,partIndex:t});return l=s,h+=`Media Sequence: ${c}.${t} | Range: ${i} --> ${s} | Appended: ${r} +`,e.syncInfo=n});d.set(c,new gc(r,n)),h+=`${Bu(e.resolvedUri)} | Media Sequence: ${c} | Range: ${t} --> ${i} | Appended: ${s}\n`,c++,u=i}),this.end_=u,this.storage_=d,this.diagnostics_=h}calculateBaseTime_(e,t){return this.storage_.size?this.storage_.has(e)?this.storage_.get(e).segmentSyncInfo.start:t:0}isReliablePlaylist_(e,t){return null!=e&&Array.isArray(t)&&t.length}}class yc extends fc{constructor(e){super(),this.parent_=e}calculateBaseTime_(e,t){return this.storage_.size?super.calculateBaseTime_(e,t):(t=this.parent_.getSyncInfoForMediaSequence(e))?t.segmentSyncInfo.start:0}}let _c=[{name:"VOD",run:(e,t,i,s,r)=>{return i!==1/0?{time:0,segmentIndex:0,partIndex:null}:null}},{name:"MediaSequence",run:(e,t,i,s,r,n)=>{e=e.getMediaSequenceSync(n);return e&&e.isReliable&&(n=e.getSyncInfoForTime(r))?{time:n.start,partIndex:n.partIndex,segmentIndex:n.segmentIndex}:null}},{name:"ProgramDateTime",run:(t,i,e,s,r)=>{if(!Object.keys(t.timelineToDatetimeMappings).length)return null;let n=null,a=null;var o=Yd(i);r=r||0;for(let e=0;e{let n=null,a=null;r=r||0;var o=Yd(t);for(let e=0;e=d)&&(a=d,n={time:h,segmentIndex:l.segmentIndex,partIndex:l.partIndex})}}return n}},{name:"Discontinuity",run:(i,s,e,t,r)=>{let n=null;if(r=r||0,s.discontinuityStarts&&s.discontinuityStarts.length){let t=null;for(let e=0;e=l)&&(t=l,n={time:o.time,segmentIndex:a,partIndex:null})}}}return n}},{name:"Playlist",run:(e,t,i,s,r)=>{return t.syncInfo?{time:t.syncInfo.time,segmentIndex:t.syncInfo.mediaSequence-t.mediaSequence,partIndex:null}:null}}];class vc extends E.EventTarget{constructor(e=0){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={};var t=new fc,i=new yc(t),s=new yc(t);this.mediaSequenceStorage_={main:t,audio:i,vtt:s},this.logger_=Md("SyncController")}getMediaSequenceSync(e){return this.mediaSequenceStorage_[e]||null}getSyncPoint(e,t,i,s,r){if(t!==1/0)return _c.find(({name:e})=>"VOD"===e).run(this,e,t);var n,t=this.runStrategies_(e,t,i,s,r);if(!t.length)return null;for(n of t){var{syncPoint:a,strategy:o}=n,{segmentIndex:l,time:d}=a;if(!(l<0)){var h=d+e.segments[l].duration;if(this.logger_(`Strategy: ${o}. Current time: ${s}. selected segment: ${l}. Time: [${d} -> ${h}]}`),d<=s&&so){let e;e=a<0?s.start-Hd({defaultDuration:i.targetDuration,durationList:i.segments,startIndex:t.mediaIndex,endIndex:r}):s.end+Hd({defaultDuration:i.targetDuration,durationList:i.segments,startIndex:t.mediaIndex+1,endIndex:r}),this.discontinuities[n]={time:e,accuracy:o}}}}dispose(){this.trigger("dispose"),this.off()}}class bc extends E.EventTarget{constructor(){super(),this.pendingTimelineChanges_={},this.lastTimelineChanges_={}}clearPendingTimelineChange(e){this.pendingTimelineChanges_[e]=null,this.trigger("pendingtimelinechange")}pendingTimelineChange({type:e,from:t,to:i}){return"number"==typeof t&&"number"==typeof i&&(this.pendingTimelineChanges_[e]={type:e,from:t,to:i},this.trigger("pendingtimelinechange")),this.pendingTimelineChanges_[e]}lastTimelineChange({type:e,from:t,to:i}){return"number"==typeof t&&"number"==typeof i&&(this.lastTimelineChanges_[e]={type:e,from:t,to:i},delete this.pendingTimelineChanges_[e],this.trigger({type:"timelinechange",metadata:{timelineChangeInfo:{from:t,to:i}}})),this.lastTimelineChanges_[e]}dispose(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()}}var Tc=Zh(eu(tu(function(){var e=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){return!!this.listeners[e]&&(t=this.listeners[e].indexOf(t),this.listeners[e]=this.listeners[e].slice(0),this.listeners[e].splice(t,1),-1>7))^n]=n;for(a=o=0;!s[a];a^=l||1,o=p[o]||1)for(u=(u=o^o<<1^o<<2^o<<3^o<<4)>>8^255&u^99,h=c[d=c[l=c[r[s[a]=u]=a]]],g=16843009*h^65537*d^257*l^16843008*a,m=257*c[u]^16843008*u,n=0;n<4;n++)t[n][a]=m=m<<24^m>>>8,i[n][u]=g=g<<24^g>>>8;for(n=0;n<5;n++)t[n]=t[n].slice(0),i[n]=i[n].slice(0);return e}(),this._tables=[[h[0][0].slice(),h[0][1].slice(),h[0][2].slice(),h[0][3].slice(),h[0][4].slice()],[h[1][0].slice(),h[1][1].slice(),h[1][2].slice(),h[1][3].slice(),h[1][4].slice()]];let t,i,s;var r=this._tables[0][4],n=this._tables[1],a=e.length;let o=1;if(4!==a&&6!==a&&8!==a)throw new Error("Invalid aes key size");var l=e.slice(0),d=[];for(this._key=[l,d],t=a;t<4*a+28;t++)s=l[t-1],(t%a==0||8===a&&t%a==4)&&(s=r[s>>>24]<<24^r[s>>16&255]<<16^r[s>>8&255]<<8^r[255&s],t%a==0)&&(s=s<<8^s>>>24^o<<24,o=o<<1^283*(o>>7)),l[t]=l[t-a]^s;for(i=0;t;i++,t--)s=l[3&i?t:t-4],t<=4||i<4?d[i]=s:d[i]=n[0][r[s>>>24]]^n[1][r[s>>16&255]]^n[2][r[s>>8&255]]^n[3][r[255&s]]}decrypt(e,t,i,s,r,n){var a,o,l=this._key[1];let d=e^l[0],h=s^l[1],u=i^l[2],c=t^l[3],p;var m=l.length/4-2;let g,f=4;var e=this._tables[1],y=e[0],_=e[1],v=e[2],b=e[3],T=e[4];for(g=0;g>>24]^_[h>>16&255]^v[u>>8&255]^b[255&c]^l[f],a=y[h>>>24]^_[u>>16&255]^v[c>>8&255]^b[255&d]^l[f+1],o=y[u>>>24]^_[c>>16&255]^v[d>>8&255]^b[255&h]^l[f+2],c=y[c>>>24]^_[d>>16&255]^v[h>>8&255]^b[255&u]^l[f+3],f+=4,d=p,h=a,u=o;for(g=0;g<4;g++)r[(3&-g)+n]=T[d>>>24]<<24^T[h>>16&255]<<16^T[u>>8&255]<<8^T[255&c]^l[f++],p=d,d=h,h=u,u=c,c=p}}class l extends e{constructor(){super(e),this.jobs=[],this.delay=1,this.timeout_=null}processJob_(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null}push(e){this.jobs.push(e),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))}}function f(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24}class d{constructor(e,t,i,s){var r=d.STEP,n=new Int32Array(e.buffer);let a=new Uint8Array(e.byteLength),o=0;for(this.asyncStream_=new l,this.asyncStream_.push(this.decryptChunk_(n.subarray(o,o+r),t,i,a)),o=r;o>2),l=new g(Array.prototype.slice.call(t)),t=new Uint8Array(e.byteLength),d=new Int32Array(t.buffer);let h,u,c,p,m;for(h=i[0],u=i[1],c=i[2],p=i[3],m=0;m{var t,i=s[e];t=i,("function"===ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer)?r[e]={bytes:i.buffer,byteOffset:i.byteOffset,byteLength:i.byteLength}:r[e]=i}),r}self.onmessage=function(e){let i=e.data;var e=new Uint8Array(i.encrypted.bytes,i.encrypted.byteOffset,i.encrypted.byteLength),t=new Uint32Array(i.key.bytes,i.key.byteOffset,i.key.byteLength/4),s=new Uint32Array(i.iv.bytes,i.iv.byteOffset,i.iv.byteLength/4);new d(e,t,s,function(e,t){self.postMessage(r({source:i.source,decrypted:t}),[t.buffer])})}})));let Sc=(e,t)=>{e.abort(),e.pause(),t&&t.activePlaylistLoader&&(t.activePlaylistLoader.pause(),t.activePlaylistLoader=null)},wc=(e,t)=>{(t.activePlaylistLoader=e).load()},Ec={AUDIO:(a,o)=>()=>{var{mediaTypes:{[a]:e},excludePlaylist:t}=o,i=e.activeTrack(),s=e.activeGroup(),s=(s.filter(e=>e.default)[0]||s[0]).id,r=e.tracks[s];if(i===r)t({error:{message:"Problem encountered loading the default audio track."}});else{for(var n in E.log.warn("Problem encountered loading the alternate audio track.Switching back to default."),e.tracks)e.tracks[n].enabled=e.tracks[n]===r;e.onTrackChanged()}},SUBTITLES:(i,s)=>()=>{var{[i]:e}=s.mediaTypes,t=(E.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track."),e.activeTrack());t&&(t.mode="disabled"),e.onTrackChanged()}},Cc={AUDIO:(e,t,i)=>{if(!t)return;let{tech:s,requestOptions:r,segmentLoaders:{[e]:n}}=i;t.on("loadedmetadata",()=>{var e=t.media();n.playlist(e,r),(!s.paused()||e.endList&&"none"!==s.preload())&&n.load()}),t.on("loadedplaylist",()=>{n.playlist(t.media(),r),s.paused()||n.load()}),t.on("error",Ec[e](e,i))},SUBTITLES:(e,t,i)=>{let{tech:s,requestOptions:r,segmentLoaders:{[e]:n},mediaTypes:{[e]:a}}=i;t.on("loadedmetadata",()=>{var e=t.media();n.playlist(e,r),n.track(a.activeTrack()),(!s.paused()||e.endList&&"none"!==s.preload())&&n.load()}),t.on("loadedplaylist",()=>{n.playlist(t.media(),r),s.paused()||n.load()}),t.on("error",Ec[e](e,i))}},kc={AUDIO:(i,s)=>{var r,n,{vhs:a,sourceType:o,segmentLoaders:{[i]:e},requestOptions:l,main:{mediaGroups:d},mediaTypes:{[i]:{groups:h,tracks:u,logger_:c}},mainPlaylistLoader:p}=s,m=uh(p.main);for(r in d[i]&&0!==Object.keys(d[i]).length||(d[i]={main:{default:{default:!0}}},m&&(d[i].main.default.playlists=p.main.playlists)),d[i])for(var g in h[r]||(h[r]=[]),d[i][r]){let e=d[i][r][g],t;t=m?(c(`AUDIO group '${r}' label '${g}' is a main playlist`),e.isMainPlaylist=!0,null):"vhs-json"===o&&e.playlists?new xh(e.playlists[0],a,l):e.resolvedUri?new xh(e.resolvedUri,a,l):e.playlists&&"dash"===o?new Yh(e.playlists[0],a,l,p):null,e=O({id:g,playlistLoader:t},e),Cc[i](i,e.playlistLoader,s),h[r].push(e),"undefined"==typeof u[g]&&(n=new E.AudioTrack({id:g,kind:(e=>{let t=e.default?"main":"alternative";return t=e.characteristics&&0<=e.characteristics.indexOf("public.accessibility.describes-video")?"main-desc":t})(e),enabled:!1,language:e.language,default:e.default,label:g}),u[g]=n)}e.on("error",Ec[i](i,s))},SUBTITLES:(i,s)=>{var r,n,{tech:a,vhs:o,sourceType:l,segmentLoaders:{[i]:e},requestOptions:d,main:{mediaGroups:h},mediaTypes:{[i]:{groups:u,tracks:c}},mainPlaylistLoader:p}=s;for(r in h[i])for(var m in u[r]||(u[r]=[]),h[i][r])if(o.options_.useForcedSubtitles||!h[i][r][m].forced){let e=h[i][r][m],t;if("hls"===l)t=new xh(e.resolvedUri,o,d);else if("dash"===l){if(!e.playlists.filter(e=>e.excludeUntil!==1/0).length)return;t=new Yh(e.playlists[0],o,d,p)}else"vhs-json"===l&&(t=new xh(e.playlists?e.playlists[0]:e.resolvedUri,o,d));e=O({id:m,playlistLoader:t},e),Cc[i](i,e.playlistLoader,s),u[r].push(e),"undefined"==typeof c[m]&&(n=a.addRemoteTextTrack({id:m,kind:"subtitles",default:e.default&&e.autoselect,language:e.language,label:m},!1).track,c[m]=n)}e.on("error",Ec[i](i,s))},"CLOSED-CAPTIONS":(e,t)=>{var i,{tech:s,main:{mediaGroups:r},mediaTypes:{[e]:{groups:n,tracks:a}}}=t;for(i in r[e])for(var o in n[i]||(n[i]=[]),r[e][i]){var l=r[e][i][o];if(/^(?:CC|SERVICE)/.test(l.instreamId)){var d=s.options_.vhs&&s.options_.vhs.captionServices||{};let e={label:o,language:l.language,instreamId:l.instreamId,default:l.default&&l.autoselect};void 0===(e=d[e.instreamId]?O(e,d[e.instreamId]):e).default&&delete e.default,n[i].push(O({id:o},l)),"undefined"==typeof a[o]&&(d=s.addRemoteTextTrack({id:e.instreamId,kind:"captions",default:e.default,language:e.language,label:e.label},!1).track,a[o]=d)}}}},Ic=(t,i)=>{for(let e=0;e()=>{var e,{[i]:{tracks:t}}=s.mediaTypes;for(e in t)if(t[e].enabled)return t[e];return null},SUBTITLES:(i,s)=>()=>{var e,{[i]:{tracks:t}}=s.mediaTypes;for(e in t)if("showing"===t[e].mode||"hidden"===t[e].mode)return t[e];return null}},Ac=n=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{kc[e](e,n)});let{mediaTypes:a,mainPlaylistLoader:e,tech:t,vhs:i,segmentLoaders:{AUDIO:s,main:r}}=n;["AUDIO","SUBTITLES"].forEach(e=>{var o,l,d,h,i,s,u,c,t,r;a[e].activeGroup=(o=e,l=n,t=>{var{mainPlaylistLoader:e,mediaTypes:{[o]:{groups:i}}}=l,s=e.media();if(!s)return null;let r=null;s.attributes[o]&&(r=i[s.attributes[o]]);var n=Object.keys(i);if(!r)if("AUDIO"===o&&1e.id===t.id)[0]||null}),a[e].activeTrack=xc[e](e,n),a[e].onGroupChanged=(d=e,h=n,()=>{var{segmentLoaders:{[d]:e,main:t},mediaTypes:{[d]:i}}=h,s=i.activeTrack(),r=i.getActiveGroup(),n=i.activePlaylistLoader,a=i.lastGroup_;r&&a&&r.id===a.id||(i.lastGroup_=r,i.lastTrack_=s,Sc(e,i),r&&!r.isMainPlaylist&&(r.playlistLoader?(e.resyncLoader(),wc(r.playlistLoader,i)):n&&t.resetEverything()))}),a[e].onGroupChanging=(i=e,s=n,()=>{var{segmentLoaders:{[i]:e},mediaTypes:{[i]:t}}=s;t.lastGroup_=null,e.abort(),e.pause()}),a[e].onTrackChanged=(u=e,c=n,()=>{var e,t,{mainPlaylistLoader:i,segmentLoaders:{[u]:s,main:r},mediaTypes:{[u]:n}}=c,a=n.activeTrack(),o=n.getActiveGroup(),l=n.activePlaylistLoader,d=n.lastTrack_;if((!d||!a||d.id!==a.id)&&(n.lastGroup_=o,n.lastTrack_=a,Sc(s,n),o)){if(o.isMainPlaylist)return!a||!d||a.id===d.id||(t=(e=c.vhs.playlistController_).selectPlaylist(),e.media()===t)?void 0:(n.logger_(`track change. Switching main audio from ${d.id} to `+a.id),i.pause(),r.resetEverything(),void e.fastQualityChange_(t));if("AUDIO"===u){if(!o.playlistLoader)return r.setAudio(!0),void r.resetEverything();s.setAudio(!0),r.setAudio(!1)}l===o.playlistLoader||(s.track&&s.track(a),s.resetEverything()),wc(o.playlistLoader,n)}}),a[e].getActiveGroup=([t,r]=[e,n.mediaTypes],()=>{var e=r[t].activeTrack();return e?r[t].activeGroup(e):null})});var o,l=a.AUDIO.activeGroup();l&&(l=(l.filter(e=>e.default)[0]||l[0]).id,a.AUDIO.tracks[l].enabled=!0,a.AUDIO.onGroupChanged(),a.AUDIO.onTrackChanged(),(a.AUDIO.getActiveGroup().playlistLoader?(r.setAudio(!1),s):r).setAudio(!0)),e.on("mediachange",()=>{["AUDIO","SUBTITLES"].forEach(e=>a[e].onGroupChanged())}),e.on("mediachanging",()=>{["AUDIO","SUBTITLES"].forEach(e=>a[e].onGroupChanging())});let d=()=>{a.AUDIO.onTrackChanged(),t.trigger({type:"usage",name:"vhs-audio-change"})};for(o in t.audioTracks().addEventListener("change",d),t.remoteTextTracks().addEventListener("change",a.SUBTITLES.onTrackChanged),i.on("dispose",()=>{t.audioTracks().removeEventListener("change",d),t.remoteTextTracks().removeEventListener("change",a.SUBTITLES.onTrackChanged)}),t.clearTracks("audio"),a.AUDIO.tracks)t.audioTracks().addTrack(a.AUDIO.tracks[o])};class Dc{constructor(){this.priority_=[],this.pathwayClones_=new Map}set version(e){1===e&&(this.version_=e)}set ttl(e){this.ttl_=e||300}set reloadUri(e){e&&(this.reloadUri_=Rd(this.reloadUri_,e))}set priority(e){e&&e.length&&(this.priority_=e)}set pathwayClones(e){e&&e.length&&(this.pathwayClones_=new Map(e.map(e=>[e.ID,e])))}get version(){return this.version_}get ttl(){return this.ttl_}get reloadUri(){return this.reloadUri_}get priority(){return this.priority_}get pathwayClones(){return this.pathwayClones_}}class Pc extends E.EventTarget{constructor(e,t){super(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=!1,this.availablePathways_=new Set,this.steeringManifest=new Dc,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.currentPathwayClones=new Map,this.nextPathwayClones=new Map,this.excludedSteeringManifestURLs=new Set,this.logger_=Md("Content Steering"),this.xhr_=e,this.getBandwidth_=t}assignTagProperties(e,t){this.manifestType_=t.serverUri?"HLS":"DASH";var i=t.serverUri||t.serverURL;i?i.startsWith("data:")?this.decodeDataUriManifest_(i.substring(i.indexOf(",")+1)):(this.steeringManifest.reloadUri=Rd(e,i),this.defaultPathway=t.pathwayId||t.defaultServiceLocation,this.queryBeforeStart=t.queryBeforeStart,this.proxyServerUrl_=t.proxyServerURL,this.defaultPathway&&!this.queryBeforeStart&&this.trigger("content-steering")):(this.logger_(`steering manifest URL is ${i}, cannot request steering manifest.`),this.trigger("error"))}requestSteeringManifest(e){var t=this.steeringManifest.reloadUri;if(t){let r=e?t:this.getRequestURI(t);if(r){let s={contentSteeringInfo:{uri:r}};this.trigger({type:"contentsteeringloadstart",metadata:s}),this.request_=this.xhr_({uri:r,requestType:"content-steering-manifest"},(e,t)=>{if(e)return 410===t.status?(this.logger_(`manifest request 410 ${e}.`),this.logger_(`There will be no more content steering requests to ${r} this session.`),void this.excludedSteeringManifestURLs.add(r)):429===t.status?(t=t.responseHeaders["retry-after"],this.logger_(`manifest request 429 ${e}.`),this.logger_(`content steering will retry in ${t} seconds.`),void this.startTTLTimeout_(parseInt(t,10))):(this.logger_(`manifest failed to load ${e}.`),void this.startTTLTimeout_());this.trigger({type:"contentsteeringloadcomplete",metadata:s});let i;try{i=JSON.parse(this.request_.responseText)}catch(e){t={errorType:E.Error.StreamingContentSteeringParserError,error:e};this.trigger({type:"error",metadata:t})}this.assignSteeringProperties_(i);e={contentSteeringInfo:s.contentSteeringInfo,contentSteeringManifest:{version:this.steeringManifest.version,reloadUri:this.steeringManifest.reloadUri,priority:this.steeringManifest.priority}};this.trigger({type:"contentsteeringparsed",metadata:e}),this.startTTLTimeout_()})}else this.logger_("No valid content steering manifest URIs. Stopping content steering."),this.trigger("error"),this.dispose()}}setProxyServerUrl_(e){var e=new window.URL(e),t=new window.URL(this.proxyServerUrl_);return t.searchParams.set("url",encodeURI(e.toString())),this.setSteeringParams_(t.toString())}decodeDataUriManifest_(e){e=JSON.parse(window.atob(e));this.assignSteeringProperties_(e)}setSteeringParams_(e){var t,e=new window.URL(e),i=this.getPathway(),s=this.getBandwidth_();return i&&(t=`_${this.manifestType_}_pathway`,e.searchParams.set(t,i)),s&&(t=`_${this.manifestType_}_throughput`,e.searchParams.set(t,s)),e.toString()}assignSteeringProperties_(e){var t;this.steeringManifest.version=e.VERSION,this.steeringManifest.version?(this.steeringManifest.ttl=e.TTL,this.steeringManifest.reloadUri=e["RELOAD-URI"],this.steeringManifest.priority=e["PATHWAY-PRIORITY"]||e["SERVICE-LOCATION-PRIORITY"],this.steeringManifest.pathwayClones=e["PATHWAY-CLONES"],this.nextPathwayClones=this.steeringManifest.pathwayClones,this.availablePathways_.size||(this.logger_("There are no available pathways for content steering. Ending content steering."),this.trigger("error"),this.dispose()),t=(e=>{for(var t of e)if(this.availablePathways_.has(t))return t;return[...this.availablePathways_][0]})(this.steeringManifest.priority),this.currentPathway!==t&&(this.currentPathway=t,this.trigger("content-steering"))):(this.logger_(`manifest version is ${e.VERSION}, which is not supported.`),this.trigger("error"))}getPathway(){return this.currentPathway||this.defaultPathway}getRequestURI(e){if(!e)return null;var t=e=>this.excludedSteeringManifestURLs.has(e);if(this.proxyServerUrl_){var i=this.setProxyServerUrl_(e);if(!t(i))return i}i=this.setSteeringParams_(e);return t(i)?null:i}startTTLTimeout_(e=this.steeringManifest.ttl){this.ttlTimeout_=window.setTimeout(()=>{this.requestSteeringManifest()},1e3*e)}clearTTLTimeout_(){window.clearTimeout(this.ttlTimeout_),this.ttlTimeout_=null}abort(){this.request_&&this.request_.abort(),this.request_=null}dispose(){this.off("content-steering"),this.off("error"),this.abort(),this.clearTTLTimeout_(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=null,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.excludedSteeringManifestURLs=new Set,this.availablePathways_=new Set,this.steeringManifest=new Dc}addAvailablePathway(e){e&&this.availablePathways_.add(e)}clearAvailablePathways(){this.availablePathways_.clear()}excludePathway(e){return this.availablePathways_.delete(e)}didDASHTagChange(e,t){return!t&&this.steeringManifest.reloadUri||t&&(Rd(e,t.serverURL)!==this.steeringManifest.reloadUri||t.defaultServiceLocation!==this.defaultPathway||t.queryBeforeStart!==this.queryBeforeStart||t.proxyServerURL!==this.proxyServerUrl_)}getAvailablePathways(){return this.availablePathways_}}let Lc,Oc=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"];class Rc extends E.EventTarget{constructor(e){super();let{src:t,withCredentials:i,tech:r,bandwidth:s,externVhs:n,useCueTags:a,playlistExclusionDuration:o,enableLowInitialPlaylist:l,sourceType:d,cacheEncryptionKeys:h,bufferBasedABR:u,leastPixelDiffSelector:c,captionServices:p,experimentalUseMMS:m}=e;if(!t)throw new Error("A non-empty playlist URL or JSON manifest string is required");let g=e.maxPlaylistRetries;null!==g&&"undefined"!=typeof g||(g=1/0),Lc=n,this.bufferBasedABR=Boolean(u),this.leastPixelDiffSelector=Boolean(c),this.withCredentials=i,this.tech_=r,this.vhs_=r.vhs,this.player_=e.player_,this.sourceType_=d,this.useCueTags_=a,this.playlistExclusionDuration=o,this.maxPlaylistRetries=g,this.enableLowInitialPlaylist=l,this.useCueTags_&&(this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues"),this.cueTagsTrack_.inBandMetadataTrackDispatchType=""),this.requestOptions_={withCredentials:i,maxPlaylistRetries:g,timeout:null},this.on("error",this.pauseLoading),this.mediaTypes_=(()=>{let t={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{t[e]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:Zu,activeTrack:Zu,getActiveGroup:Zu,onGroupChanged:Zu,onTrackChanged:Zu,lastTrack_:null,logger_:Md(`MediaGroups[${e}]`)}}),t})(),m&&window.ManagedMediaSource?(this.tech_.el_.disableRemotePlayback=!0,this.mediaSource=new window.ManagedMediaSource,E.log("Using ManagedMediaSource")):window.MediaSource&&(this.mediaSource=new window.MediaSource),this.handleDurationChange_=this.handleDurationChange_.bind(this),this.handleSourceOpen_=this.handleSourceOpen_.bind(this),this.handleSourceEnded_=this.handleSourceEnded_.bind(this),this.load=this.load.bind(this),this.pause=this.pause.bind(this),this.mediaSource.addEventListener("durationchange",this.handleDurationChange_),this.mediaSource.addEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.addEventListener("sourceended",this.handleSourceEnded_),this.mediaSource.addEventListener("startstreaming",this.load),this.mediaSource.addEventListener("endstreaming",this.pause),this.seekable_=Ud(),this.hasPlayed_=!1,this.syncController_=new vc(e),this.segmentMetadataTrack_=r.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.decrypter_=new Tc,this.sourceUpdater_=new dc(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new bc,this.keyStatusMap_=new Map;var f={vhs:this.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,captionServices:p,mediaSource:this.mediaSource,currentTime:this.tech_.currentTime.bind(this.tech_),seekable:()=>this.seekable(),seeking:()=>this.tech_.seeking(),duration:()=>this.duration(),hasPlayed:()=>this.hasPlayed_,goalBufferLength:()=>this.goalBufferLength(),bandwidth:s,syncController:this.syncController_,decrypter:this.decrypter_,sourceType:this.sourceType_,inbandTextTracks:this.inbandTextTracks_,cacheEncryptionKeys:h,sourceUpdater:this.sourceUpdater_,timelineChangeController:this.timelineChangeController_,exactManifestTimings:e.exactManifestTimings,addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)},f=(this.mainPlaylistLoader_="dash"===this.sourceType_?new Yh(t,this.vhs_,O(this.requestOptions_,{addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)})):new xh(t,this.vhs_,O(this.requestOptions_,{addDateRangesToTextTrack:this.addDateRangesToTextTrack_.bind(this)})),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new Ju(O(f,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new Ju(O(f,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new pc(O(f,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise((e,t)=>{function i(){r.off("vttjserror",s),e()}function s(){r.off("vttjsloaded",i),t()}r.one("vttjsloaded",i),r.one("vttjserror",s),r.addWebVttScript_()})}),e),this.contentSteeringController_=new Pc(this.vhs_.xhr,()=>this.mainSegmentLoader_.bandwidth),this.setupSegmentLoaderListeners_(),this.bufferBasedABR&&(this.mainPlaylistLoader_.one("loadedplaylist",()=>this.startABRTimer_()),this.tech_.on("pause",()=>this.stopABRTimer_()),this.tech_.on("play",()=>this.startABRTimer_())),Oc.forEach(e=>{this[e+"_"]=function(e){return this.audioSegmentLoader_[e]+this.mainSegmentLoader_[e]}.bind(this,e)}),this.logger_=Md("pc"),this.triggeredFmp4Usage=!1,"none"===this.tech_.preload()?(this.loadOnPlay_=()=>{this.loadOnPlay_=null,this.mainPlaylistLoader_.load()},this.tech_.one("play",this.loadOnPlay_)):this.mainPlaylistLoader_.load(),this.timeToLoadedData__=-1,this.mainAppendsToLoadedData__=-1,this.audioAppendsToLoadedData__=-1,"none"===this.tech_.preload()?"play":"loadstart");this.tech_.one(f,()=>{let e=Date.now();this.tech_.one("loadeddata",()=>{this.timeToLoadedData__=Date.now()-e,this.mainAppendsToLoadedData__=this.mainSegmentLoader_.mediaAppends,this.audioAppendsToLoadedData__=this.audioSegmentLoader_.mediaAppends})})}mainAppendsToLoadedData_(){return this.mainAppendsToLoadedData__}audioAppendsToLoadedData_(){return this.audioAppendsToLoadedData__}appendsToLoadedData_(){var e=this.mainAppendsToLoadedData_(),t=this.audioAppendsToLoadedData_();return-1===e||-1===t?-1:e+t}timeToLoadedData_(){return this.timeToLoadedData__}checkABR_(e="abr"){var t=this.selectPlaylist();t&&this.shouldSwitchToMedia_(t)&&this.switchMedia_(t,e)}switchMedia_(e,t,i){var s=this.media(),s=s&&(s.id||s.uri),r=e&&(e.id||e.uri);s&&s!==r&&(this.logger_(`switch media ${s} -> ${r} from `+t),s={renditionInfo:{id:r,bandwidth:e.attributes.BANDWIDTH,resolution:e.attributes.RESOLUTION,codecs:e.attributes.CODECS},cause:t},this.trigger({type:"renditionselected",metadata:s}),this.tech_.trigger({type:"usage",name:"vhs-rendition-change-"+t})),this.mainPlaylistLoader_.media(e,i)}switchMediaForDASHContentSteering_(){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{var t=this.mediaTypes_[e],t=t?t.activeGroup():null;let i=this.contentSteeringController_.getPathway();t&&i&&(t=(t.length?t[0]:t).playlists.filter(e=>e.attributes.serviceLocation===i)).length&&this.mediaTypes_[e].activePlaylistLoader.media(t[0])})}startABRTimer_(){this.stopABRTimer_(),this.abrTimer_=window.setInterval(()=>this.checkABR_(),250)}stopABRTimer_(){this.tech_.scrubbing&&this.tech_.scrubbing()||(window.clearInterval(this.abrTimer_),this.abrTimer_=null)}getAudioTrackPlaylists_(){var t=this.main(),e=t&&t.playlists||[];if(!t||!t.mediaGroups||!t.mediaGroups.AUDIO)return e;var i=t.mediaGroups.AUDIO,s=Object.keys(i);let r;if(Object.keys(this.mediaTypes_.AUDIO.groups).length)r=this.mediaTypes_.AUDIO.activeTrack();else{var n,a=i.main||s.length&&i[s[0]];for(n in a)if(a[n].default){r={label:n};break}}if(!r)return e;var o,l=[];for(o in i)if(i[o][r.label]){var d=i[o][r.label];if(d.playlists&&d.playlists.length)l.push.apply(l,d.playlists);else if(d.uri)l.push(d);else if(t.playlists.length)for(let e=0;e{var e=this.mainPlaylistLoader_.media(),t=1.5*e.targetDuration*1e3;dh(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=t,e.endList&&"none"!==this.tech_.preload()&&(this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.mainSegmentLoader_.load()),Ac({sourceType:this.sourceType_,segmentLoaders:{AUDIO:this.audioSegmentLoader_,SUBTITLES:this.subtitleSegmentLoader_,main:this.mainSegmentLoader_},tech:this.tech_,requestOptions:this.requestOptions_,mainPlaylistLoader:this.mainPlaylistLoader_,vhs:this.vhs_,main:this.main(),mediaTypes:this.mediaTypes_,excludePlaylist:this.excludePlaylist.bind(this)}),this.triggerPresenceUsage_(this.main(),e),this.setupFirstPlay(),!this.mediaTypes_.AUDIO.activePlaylistLoader||this.mediaTypes_.AUDIO.activePlaylistLoader.media()?this.trigger("selectedinitialmedia"):this.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata",()=>{this.trigger("selectedinitialmedia")})}),this.mainPlaylistLoader_.on("loadedplaylist",()=>{this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_);let t=this.mainPlaylistLoader_.media();if(!t){this.attachContentSteeringListeners_(),this.initContentSteeringController_(),this.excludeUnsupportedVariants_();let e;if(!(e=(e=this.enableLowInitialPlaylist?this.selectInitialPlaylist():e)||this.selectPlaylist())||!this.shouldSwitchToMedia_(e))return;if(this.initialMedia_=e,this.switchMedia_(this.initialMedia_,"initial"),!("vhs-json"===this.sourceType_&&this.initialMedia_.segments))return;t=this.initialMedia_}this.handleUpdatedMediaPlaylist(t)}),this.mainPlaylistLoader_.on("error",()=>{var e=this.mainPlaylistLoader_.error;this.excludePlaylist({playlistToExclude:e.playlist,error:e})}),this.mainPlaylistLoader_.on("mediachanging",()=>{this.mainSegmentLoader_.abort(),this.mainSegmentLoader_.pause()}),this.mainPlaylistLoader_.on("mediachange",()=>{var e=this.mainPlaylistLoader_.media(),t=1.5*e.targetDuration*1e3;dh(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=t,"dash"===this.sourceType_&&this.mainPlaylistLoader_.load(),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_?this.runFastQualitySwitch_():this.mainSegmentLoader_.load(),this.tech_.trigger({type:"mediachange",bubbles:!0})}),this.mainPlaylistLoader_.on("playlistunchanged",()=>{var e=this.mainPlaylistLoader_.media();"playlist-unchanged"!==e.lastExcludeReason_&&this.stuckAtPlaylistEnd_(e)&&(this.excludePlaylist({error:{message:"Playlist no longer updating.",reason:"playlist-unchanged"}}),this.tech_.trigger("playliststuck"))}),this.mainPlaylistLoader_.on("renditiondisabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-disabled"})}),this.mainPlaylistLoader_.on("renditionenabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-enabled"})});["manifestrequeststart","manifestrequestcomplete","manifestparsestart","manifestparsecomplete","playlistrequeststart","playlistrequestcomplete","playlistparsestart","playlistparsecomplete","renditiondisabled","renditionenabled"].forEach(e=>{this.mainPlaylistLoader_.on(e,e=>{this.player_.trigger(f({},e))})})}handleUpdatedMediaPlaylist(e){this.useCueTags_&&this.updateAdCues_(e),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_&&this.runFastQualitySwitch_(),this.updateDuration(!e.endList),this.tech_.paused()||(this.mainSegmentLoader_.load(),this.audioSegmentLoader_&&this.audioSegmentLoader_.load())}triggerPresenceUsage_(e,t){var i=e.mediaGroups||{};let s=!0;var r,e=Object.keys(i.AUDIO);for(r in i.AUDIO)for(var n in i.AUDIO[r])i.AUDIO[r][n].uri||(s=!1);s&&this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),Object.keys(i.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),Lc.Playlist.isAes(t)&&this.tech_.trigger({type:"usage",name:"vhs-aes"}),e.length&&1 `+s.id;if(!e)return l(d+" as current playlist is not set"),!0;if(s.id!==e.id){var h=Boolean(Bd(t,i).length);if(!e.endList)return h||"number"!=typeof e.partTargetDuration?(l(d+" as current playlist is live"),!0):(l(`not ${d} as current playlist is live llhls, but currentTime isn't in buffered.`),!1);h=jd(t,i),t=o?R.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:R.MAX_BUFFER_LOW_WATER_LINE;if(a= bufferLowWaterLine (${h} >= ${r})`;return o&&(e+=` and next bandwidth > current bandwidth (${i} > ${a})`),l(e),!0}l(`not ${d} as no switching criteria met`)}}else E.log.warn("We received no playlist to switch to. Please check your stream.");return!1}({buffered:this.tech_.buffered(),currentTime:i,currentPlaylist:t,nextPlaylist:e,bufferLowWaterLine:s,bufferHighWaterLine:r,duration:this.duration(),bufferBasedABR:this.bufferBasedABR,log:this.logger_})}setupSegmentLoaderListeners_(){this.mainSegmentLoader_.on("bandwidthupdate",()=>{this.checkABR_("bandwidthupdate"),this.tech_.trigger("bandwidthupdate")}),this.mainSegmentLoader_.on("timeout",()=>{this.bufferBasedABR&&this.mainSegmentLoader_.load()}),this.bufferBasedABR||this.mainSegmentLoader_.on("progress",()=>{this.trigger("progress")}),this.mainSegmentLoader_.on("error",()=>{var e=this.mainSegmentLoader_.error();this.excludePlaylist({playlistToExclude:e.playlist,error:e})}),this.mainSegmentLoader_.on("appenderror",()=>{this.error=this.mainSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.mainSegmentLoader_.on("timestampoffset",()=>{this.tech_.trigger({type:"usage",name:"vhs-timestamp-offset"})}),this.audioSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.audioSegmentLoader_.on("appenderror",()=>{this.error=this.audioSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("ended",()=>{this.logger_("main segment loader ended"),this.onEndOfStream()}),this.timelineChangeController_.on("audioTimelineBehind",()=>{var e=this.audioSegmentLoader_.pendingSegment_;e&&e.segment&&e.segment.syncInfo&&(e=e.segment.syncInfo.end+.01,this.tech_.setCurrentTime(e))}),this.mainSegmentLoader_.on("earlyabort",e=>{this.bufferBasedABR||(this.delegateLoaders_("all",["abort"]),this.excludePlaylist({error:{message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},playlistExclusionDuration:10}))});var e=()=>{if(!this.sourceUpdater_.hasCreatedSourceBuffers())return this.tryToCreateSourceBuffers_();var e=this.getCodecsOrExclude_();e&&this.sourceUpdater_.addOrChangeSourceBuffers(e)};this.mainSegmentLoader_.on("trackinfo",e),this.audioSegmentLoader_.on("trackinfo",e),this.mainSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("ended",()=>{this.logger_("audioSegmentLoader ended"),this.onEndOfStream()});["segmentselected","segmentloadstart","segmentloaded","segmentkeyloadstart","segmentkeyloadcomplete","segmentdecryptionstart","segmentdecryptioncomplete","segmenttransmuxingstart","segmenttransmuxingcomplete","segmenttransmuxingtrackinfoavailable","segmenttransmuxingtiminginfoavailable","segmentappendstart","appendsdone","bandwidthupdated","timelinechange","codecschange"].forEach(e=>{this.mainSegmentLoader_.on(e,e=>{this.player_.trigger(f({},e))}),this.audioSegmentLoader_.on(e,e=>{this.player_.trigger(f({},e))}),this.subtitleSegmentLoader_.on(e,e=>{this.player_.trigger(f({},e))})})}mediaSecondsLoaded_(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)}load(){this.mainSegmentLoader_.load(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.load(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.load()}pause(){this.mainSegmentLoader_.pause(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.pause(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.pause()}fastQualityChange_(e=this.selectPlaylist()){e&&e===this.mainPlaylistLoader_.media()?this.logger_("skipping fastQualityChange because new media is same as old"):(this.switchMedia_(e,"fast-quality"),this.waitingForFastQualityPlaylistReceived_=!0)}runFastQualitySwitch_(){this.waitingForFastQualityPlaylistReceived_=!1,this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(()=>{this.mainSegmentLoader_.load()})}play(){var e;if(!this.setupFirstPlay())return this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_&&this.load(),e=this.tech_.seekable(),this.tech_.duration()===1/0&&this.tech_.currentTime(){}),this.trigger("sourceopen")}handleSourceEnded_(){var e,t;this.inbandTextTracks_.metadataTrack_&&(e=this.inbandTextTracks_.metadataTrack_.cues)&&e.length&&(t=this.duration(),e[e.length-1].endTime=isNaN(t)||Math.abs(t)===1/0?Number.MAX_VALUE:t)}handleDurationChange_(){this.tech_.trigger("durationchange")}onEndOfStream(){let e=this.mainSegmentLoader_.ended_;var t;this.mediaTypes_.AUDIO.activePlaylistLoader&&(t=this.mainSegmentLoader_.getCurrentMediaInfo_(),e=(t&&!t.hasVideo||e)&&this.audioSegmentLoader_.ended_),e&&(this.stopABRTimer_(),this.sourceUpdater_.endOfStream())}stuckAtPlaylistEnd_(e){var t,i;return!!this.seekable().length&&null!==(t=this.syncController_.getExpiredTime(e,this.duration()))&&(e=Lc.Playlist.playlistEnd(e,t),t=this.tech_.currentTime(),(i=this.tech_.buffered()).length?(i=i.end(i.length-1))-t<=$d&&e-i<=$d:e-t<=$d)}excludePlaylist({playlistToExclude:s=this.mainPlaylistLoader_.media(),error:t={},playlistExclusionDuration:i}){if(s=s||this.mainPlaylistLoader_.media(),i=i||t.playlistExclusionDuration||this.playlistExclusionDuration,s){s.playlistErrors_++;var r=this.mainPlaylistLoader_.main.playlists,n=r.filter(ah),n=1===n.length&&n[0]===s;if(1===r.length&&i!==1/0)return E.log.warn(`Problem encountered with playlist ${s.id}. `+"Trying again since it is the only playlist."),this.tech_.trigger("retryplaylist"),this.mainPlaylistLoader_.load(n);if(n){if(this.main().contentSteering){let e=this.pathwayAttribute_(s);var a=1e3*this.contentSteeringController_.steeringManifest.ttl;return this.contentSteeringController_.excludePathway(e),this.excludeThenChangePathway_(),void setTimeout(()=>{this.contentSteeringController_.addAvailablePathway(e)},a)}let i=!1;r.forEach(e=>{var t;e!==s&&"undefined"!=typeof(t=e.excludeUntil)&&t!==1/0&&(i=!0,delete e.excludeUntil)}),i&&(E.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}let e;e=s.playlistErrors_>this.maxPlaylistRetries?1/0:Date.now()+1e3*i,s.excludeUntil=e,t.reason&&(s.lastExcludeReason_=t.reason),this.tech_.trigger("excludeplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-excluded"});a=this.selectPlaylist();if(a)return(t.internal?this.logger_:E.log.warn)(`${t.internal?"Internal problem":"Problem"} encountered with playlist ${s.id}.`+(t.message?" "+t.message:"")+` Switching to playlist ${a.id}.`),a.attributes.AUDIO!==s.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),a.attributes.SUBTITLES!==s.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]),r=a.targetDuration/2*1e3||5e3,i="number"==typeof a.lastRequest&&Date.now()-a.lastRequest<=r,this.switchMedia_(a,"exclude",n||i);this.error="Playback cannot continue. No available working or supported playlists.",this.trigger("error")}else this.error=t,"open"!==this.mediaSource.readyState?this.trigger("error"):this.sourceUpdater_.endOfStream("network")}pauseLoading(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()}delegateLoaders_(i,e){let s=[];var t="all"===i,r=(!t&&"main"!==i||s.push(this.mainPlaylistLoader_),[]);!t&&"audio"!==i||r.push("AUDIO"),!t&&"subtitle"!==i||(r.push("CLOSED-CAPTIONS"),r.push("SUBTITLES")),r.forEach(e=>{e=this.mediaTypes_[e]&&this.mediaTypes_[e].activePlaylistLoader;e&&s.push(e)}),["main","audio","subtitle"].forEach(e=>{var t=this[e+"SegmentLoader_"];!t||i!==e&&"all"!==i||s.push(t)}),s.forEach(t=>e.forEach(e=>{"function"==typeof t[e]&&t[e]()}))}setCurrentTime(e){var t=Bd(this.tech_.buffered(),e);return this.mainPlaylistLoader_&&this.mainPlaylistLoader_.media()&&this.mainPlaylistLoader_.media().segments?t&&t.length?e:(this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),void this.load()):0}duration(){var e;return this.mainPlaylistLoader_&&(e=this.mainPlaylistLoader_.media())?e.endList?this.mediaSource?this.mediaSource.duration:Lc.Playlist.duration(e):1/0:0}seekable(){return this.seekable_}onSyncInfoUpdate_(){let i;if(this.mainPlaylistLoader_){var s=this.mainPlaylistLoader_.media();if(s){var r=this.syncController_.getExpiredTime(s,this.duration());if(null!==r){var n=this.mainPlaylistLoader_.main,a=Lc.Playlist.seekable(s,r,Lc.Playlist.liveEdgeDelay(n,s));if(0!==a.length){if(this.mediaTypes_.AUDIO.activePlaylistLoader){if(s=this.mediaTypes_.AUDIO.activePlaylistLoader.media(),null===(r=this.syncController_.getExpiredTime(s,this.duration())))return;if(0===(i=Lc.Playlist.seekable(s,r,Lc.Playlist.liveEdgeDelay(n,s))).length)return}let e,t;this.seekable_&&this.seekable_.length&&(e=this.seekable_.end(0),t=this.seekable_.start(0)),!i||i.start(0)>a.end(0)||a.start(0)>i.end(0)?this.seekable_=a:this.seekable_=Ud([[(i.start(0)>a.start(0)?i:a).start(0),(i.end(0){var t,i=this.mediaTypes_[e].groups;for(t in i)i[t].forEach(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()}main(){return this.mainPlaylistLoader_.main}media(){return this.mainPlaylistLoader_.media()||this.initialMedia_}areMediaTypesKnown_(){var e=!!this.mediaTypes_.AUDIO.activePlaylistLoader,t=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),e=!e||!!this.audioSegmentLoader_.getCurrentMediaInfo_();return t&&e}getCodecsOrExclude_(){let n={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}},i=this.mainSegmentLoader_.getPendingSegmentPlaylist()||this.media();n.video=n.main;var e=mu(this.main(),i);let a={};var t=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(n.main.hasVideo&&(a.video=e.video||n.main.videoCodec||"avc1.4d400d"),n.main.isMuxed&&(a.video+=","+(e.audio||n.main.audioCodec||aa)),(n.main.hasAudio&&!n.main.isMuxed||n.audio.hasAudio||t)&&(a.audio=e.audio||n.main.audioCodec||n.audio.audioCodec||aa,n.audio.isFmp4=(n.main.hasAudio&&!n.main.isMuxed?n.main:n.audio).isFmp4),a.audio||a.video){let s={},r;if(["video","audio"].forEach(function(e){var t,i;a.hasOwnProperty(e)&&(t=n[e].isFmp4,i=a[e],!(t?Yn:Qn)(i))&&(t=n[e].isFmp4?"browser":"muxer",s[t]=s[t]||[],s[t].push(a[e]),"audio"===e&&(r=t))}),t&&r&&i.attributes.AUDIO){let t=i.attributes.AUDIO;this.main().playlists.forEach(e=>{(e.attributes&&e.attributes.AUDIO)===t&&e!==i&&(e.excludeUntil=1/0)}),this.logger_(`excluding audio group ${t} as ${r} does not support codec(s): "${a.audio}"`)}if(!Object.keys(s).length){if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){let s=[];if(["video","audio"].forEach(e=>{var t=(ra(this.sourceUpdater_.codecs[e]||"")[0]||{}).type,i=(ra(a[e]||"")[0]||{}).type;t&&i&&t.toLowerCase()!==i.toLowerCase()&&s.push(`"${this.sourceUpdater_.codecs[e]}" -> "${a[e]}"`)}),s.length)return void this.excludePlaylist({playlistToExclude:i,error:{message:`Codec switching not supported: ${s.join(", ")}.`,internal:!0},playlistExclusionDuration:1/0})}return a}e=Object.keys(s).reduce((e,t)=>(e&&(e+=", "),e+=`${t} does not support codec(s): "${s[t].join(",")}"`),"")+".",this.excludePlaylist({playlistToExclude:i,error:{internal:!0,message:e},playlistExclusionDuration:1/0})}else this.excludePlaylist({playlistToExclude:i,error:{message:"Could not determine codecs for playlist."},playlistExclusionDuration:1/0})}tryToCreateSourceBuffers_(){var e;"open"!==this.mediaSource.readyState||this.sourceUpdater_.hasCreatedSourceBuffers()||this.areMediaTypesKnown_()&&(e=this.getCodecsOrExclude_())&&(this.sourceUpdater_.createSourceBuffers(e),e=[e.video,e.audio].filter(Boolean).join(","),this.excludeIncompatibleVariants_(e))}excludeUnsupportedVariants_(){let s=this.main().playlists,r=[];Object.keys(s).forEach(e=>{var t,i,e=s[e];-1===r.indexOf(e.id)&&(r.push(e.id),i=[],!(t=mu(this.main,e)).audio||Qn(t.audio)||Yn(t.audio)||i.push("audio codec "+t.audio),!t.video||Qn(t.video)||Yn(t.video)||i.push("video codec "+t.video),t.text&&"stpp.ttml.im1t"===t.text&&i.push("text codec "+t.text),i.length)&&(e.excludeUntil=1/0,this.logger_(`excluding ${e.id} for unsupported: `+i.join(", ")))})}excludeIncompatibleVariants_(e){let r=[],n=this.main().playlists;e=Lu(ra(e));let a=pu(e),o=e.video&&ra(e.video)[0]||null,l=e.audio&&ra(e.audio)[0]||null;Object.keys(n).forEach(e=>{var t,i,s,e=n[e];-1===r.indexOf(e.id)&&e.excludeUntil!==1/0&&(r.push(e.id),t=[],s=mu(this.mainPlaylistLoader_.main,e),i=pu(s),s.audio||s.video)&&(i!==a&&t.push(`codec count "${i}" !== "${a}"`),this.sourceUpdater_.canChangeType()||(i=s.video&&ra(s.video)[0]||null,s=s.audio&&ra(s.audio)[0]||null,i&&o&&i.type.toLowerCase()!==o.type.toLowerCase()&&t.push(`video codec "${i.type}" !== "${o.type}"`),s&&l&&s.type.toLowerCase()!==l.type.toLowerCase()&&t.push(`audio codec "${s.type}" !== "${l.type}"`)),t.length)&&(e.excludeUntil=1/0,this.logger_(`excluding ${e.id}: `+t.join(" && ")))})}updateAdCues_(e){let t=0;var i=this.seekable();i.length&&(t=i.start(0)),function(s,r,e=0){if(s.segments){let t=e,i;for(let e=0;e=s.adStartTime&&t<=s.adEndTime)return s}return null}(r,t+o.duration/2)){if("cueIn"in o){i.endTime=t,i.adEndTime=t,t+=o.duration,i=null;continue}if(t{let r=e.metadataTrack_;if(r){let s=window.WebKitDataCue||window.VTTCue;t.forEach(e=>{for(var t of Object.keys(e)){var i;Hu.has(t)||((i=new s(e.startTime,e.endTime,"")).id=e.id,i.type="com.apple.quicktime.HLS",i.value={key:ju[t],data:e[t]},"scte35Out"!==t&&"scte35In"!==t||(i.value.data=new Uint8Array(i.value.data.match(/[\da-f]{2}/gi)).buffer),r.addCue(i))}e.processDateRange()})}})({inbandTextTracks:this.inbandTextTracks_,dateRanges:e})}addMetadataToTextTrack(e,t,i){var s=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();Vu(this.inbandTextTracks_,e,this.tech_),qu({inbandTextTracks:this.inbandTextTracks_,metadataArray:t,timestampOffset:s,videoDuration:i})}pathwayAttribute_(e){return e.attributes["PATHWAY-ID"]||e.attributes.serviceLocation}initContentSteeringController_(){var e=this.main();if(e.contentSteering){for(var t of e.playlists)this.contentSteeringController_.addAvailablePathway(this.pathwayAttribute_(t));this.contentSteeringController_.assignTagProperties(e.uri,e.contentSteering),this.contentSteeringController_.queryBeforeStart?this.contentSteeringController_.requestSteeringManifest(!0):this.tech_.one("canplay",()=>{this.contentSteeringController_.requestSteeringManifest()})}}resetContentSteeringController_(){this.contentSteeringController_.clearAvailablePathways(),this.contentSteeringController_.dispose(),this.initContentSteeringController_()}attachContentSteeringListeners_(){this.contentSteeringController_.on("content-steering",this.excludeThenChangePathway_.bind(this));["contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"].forEach(e=>{this.contentSteeringController_.on(e,e=>{this.trigger(f({},e))})}),"dash"===this.sourceType_&&this.mainPlaylistLoader_.on("loadedplaylist",()=>{let r=this.main();(this.contentSteeringController_.didDASHTagChange(r.uri,r.contentSteering)||(()=>{var e,t=this.contentSteeringController_.getAvailablePathways(),i=[];for(e of r.playlists){var s=e.attributes.serviceLocation;if(s&&(i.push(s),!t.has(s)))return!0}return!(i.length||!t.size)})())&&this.resetContentSteeringController_()})}excludeThenChangePathway_(){let a=this.contentSteeringController_.getPathway();if(a){this.handlePathwayClones_();let s=this.main().playlists,r=new Set,n=!1;Object.keys(s).forEach(e=>{var e=s[e],t=this.pathwayAttribute_(e),t=t&&a!==t,i=(e.excludeUntil===1/0&&"content-steering"===e.lastExcludeReason_&&!t&&(delete e.excludeUntil,delete e.lastExcludeReason_,n=!0),!e.excludeUntil&&e.excludeUntil!==1/0);!r.has(e.id)&&t&&i&&(r.add(e.id),e.excludeUntil=1/0,e.lastExcludeReason_="content-steering",this.logger_(`excluding ${e.id} for `+e.lastExcludeReason_))}),"DASH"===this.contentSteeringController_.manifestType_&&Object.keys(this.mediaTypes_).forEach(e=>{var e=this.mediaTypes_[e];e.activePlaylistLoader&&(e=e.activePlaylistLoader.media_)&&e.attributes.serviceLocation!==a&&(n=!0)}),n&&this.changeSegmentPathway_()}}handlePathwayClones_(){var i=this.main().playlists,s=this.contentSteeringController_.currentPathwayClones,r=this.contentSteeringController_.nextPathwayClones;if(s&&s.size||r&&r.size){for(var[e,t]of s.entries())r.get(e)||(this.mainPlaylistLoader_.updateOrDeleteClone(t),this.contentSteeringController_.excludePathway(e));for(let[e,t]of r.entries()){var n=s.get(e);n?this.equalPathwayClones_(n,t)||(this.mainPlaylistLoader_.updateOrDeleteClone(t,!0),this.contentSteeringController_.addAvailablePathway(e)):(i.filter(e=>e.attributes["PATHWAY-ID"]===t["BASE-ID"]).forEach(e=>{this.mainPlaylistLoader_.addClonePathway(t,e)}),this.contentSteeringController_.addAvailablePathway(e))}this.contentSteeringController_.currentPathwayClones=new Map(JSON.parse(JSON.stringify([...r])))}}equalPathwayClones_(e,t){if(e["BASE-ID"]!==t["BASE-ID"]||e.ID!==t.ID||e["URI-REPLACEMENT"].HOST!==t["URI-REPLACEMENT"].HOST)return!1;var i,s,r=e["URI-REPLACEMENT"].PARAMS,n=t["URI-REPLACEMENT"].PARAMS;for(i in r)if(r[i]!==n[i])return!1;for(s in n)if(r[s]!==n[s])return!1;return!0}changeSegmentPathway_(){var e=this.selectPlaylist();this.pauseLoading(),"DASH"===this.contentSteeringController_.manifestType_&&this.switchMediaForDASHContentSteering_(),this.switchMedia_(e,"content-steering")}excludeNonUsablePlaylistsByKeyId_(){if(this.mainPlaylistLoader_&&this.mainPlaylistLoader_.main){let r=0,n="non-usable";this.mainPlaylistLoader_.main.playlists.forEach(s=>{var e=this.mainPlaylistLoader_.getKeyIdSet(s);e&&e.size&&e.forEach(e=>{var t="usable",t=this.keyStatusMap_.has(e)&&this.keyStatusMap_.get(e)===t,i=s.lastExcludeReason_===n&&s.excludeUntil===1/0;t?i&&(delete s.excludeUntil,delete s.lastExcludeReason_,this.logger_(`enabling playlist ${s.id} because key ID ${e} is usable`)):(s.excludeUntil!==1/0&&s.lastExcludeReason_!==n&&(s.excludeUntil=1/0,s.lastExcludeReason_=n,this.logger_(`excluding playlist ${s.id} because the key ID ${e} doesn't exist in the keyStatusMap or is not usable`)),r++)})}),r>=this.mainPlaylistLoader_.main.playlists.length&&this.mainPlaylistLoader_.main.playlists.forEach(e=>{var t=e&&e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.height<720,i=e.excludeUntil===1/0&&e.lastExcludeReason_===n;t&&i&&(delete e.excludeUntil,E.log.warn(`enabling non-HD playlist ${e.id} because all playlists were excluded due to ${n} key IDs`))})}}addKeyStatus_(e,t){e=("string"==typeof e?e:(e=>{e=new Uint8Array(e);return Array.from(e).map(e=>e.toString(16).padStart(2,"0")).join("")})(e)).slice(0,32).toLowerCase();this.logger_(`KeyStatus '${t}' with key ID ${e} added to the keyStatusMap`),this.keyStatusMap_.set(e,t)}updatePlaylistByKeyStatus(e,t){this.addKeyStatus_(e,t),this.waitingForFastQualityPlaylistReceived_||this.excludeNonUsableThenChangePlaylist_(),this.mainPlaylistLoader_.off("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this)),this.mainPlaylistLoader_.on("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this))}excludeNonUsableThenChangePlaylist_(){this.excludeNonUsablePlaylistsByKeyId_(),this.fastQualityChange_()}}class Nc{constructor(e,t,i){var s,n,a,o,r=e.playlistController_,l=r.fastQualityChange_.bind(r);t.attributes&&(s=t.attributes.RESOLUTION,this.width=s&&s.width,this.height=s&&s.height,this.bandwidth=t.attributes.BANDWIDTH,this.frameRate=t.attributes["FRAME-RATE"]),this.codecs=mu(r.main(),t),this.playlist=t,this.id=i,this.enabled=(n=e.playlists,a=t.id,o=l,e=>{var t=n.main.playlists[a],i=nh(t),s=ah(t);if("undefined"==typeof e)return s;e?delete t.disabled:t.disabled=!0;var r={renditionInfo:{id:a,bandwidth:t.attributes.BANDWIDTH,resolution:t.attributes.RESOLUTION,codecs:t.attributes.CODECS},cause:"fast-quality"};return e===s||i||(o(t),e?n.trigger({type:"renditionenabled",metadata:r}):n.trigger({type:"renditiondisabled",metadata:r})),e})}}let Mc=["seeking","seeked","pause","playing","error"];class Uc extends E.EventTarget{constructor(e){super(),this.playlistController_=e.playlistController,this.tech_=e.tech,this.seekable=e.seekable,this.allowSeeksWithinUnsafeLiveWindow=e.allowSeeksWithinUnsafeLiveWindow,this.liveRangeSafeTimeDelta=e.liveRangeSafeTimeDelta,this.media=e.media,this.playedRanges_=[],this.consecutiveUpdates=0,this.lastRecordedTime=null,this.checkCurrentTimeTimeout_=null,this.logger_=Md("PlaybackWatcher"),this.logger_("initialize");let t=()=>this.monitorCurrentTime_(),i=()=>this.monitorCurrentTime_(),s=()=>this.techWaiting_(),r=()=>this.resetTimeUpdate_(),n=this.playlistController_,a=["main","subtitle","audio"],o={},l=(a.forEach(e=>{o[e]={reset:()=>this.resetSegmentDownloads_(e),updateend:()=>this.checkSegmentDownloads_(e)},n[e+"SegmentLoader_"].on("appendsdone",o[e].updateend),n[e+"SegmentLoader_"].on("playlistupdate",o[e].reset),this.tech_.on(["seeked","seeking"],o[e].reset)}),t=>{["main","audio"].forEach(e=>{n[e+"SegmentLoader_"][t]("appended",this.seekingAppendCheck_)})});this.seekingAppendCheck_=()=>{this.fixesBadSeeks_()&&(this.consecutiveUpdates=0,this.lastRecordedTime=this.tech_.currentTime(),l("off"))},this.clearSeekingAppendCheck_=()=>l("off"),this.watchForBadSeeking_=()=>{this.clearSeekingAppendCheck_(),l("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",s),this.tech_.on(Mc,r),this.tech_.on("canplay",i),this.tech_.one("play",t),this.dispose=()=>{this.clearSeekingAppendCheck_(),this.logger_("dispose"),this.tech_.off("waiting",s),this.tech_.off(Mc,r),this.tech_.off("canplay",i),this.tech_.off("play",t),this.tech_.off("seeking",this.watchForBadSeeking_),this.tech_.off("seeked",this.clearSeekingAppendCheck_),a.forEach(e=>{n[e+"SegmentLoader_"].off("appendsdone",o[e].updateend),n[e+"SegmentLoader_"].off("playlistupdate",o[e].reset),this.tech_.off(["seeked","seeking"],o[e].reset)}),this.checkCurrentTimeTimeout_&&window.clearTimeout(this.checkCurrentTimeTimeout_),this.resetTimeUpdate_()}}monitorCurrentTime_(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&window.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=window.setTimeout(this.monitorCurrentTime_.bind(this),250)}resetSegmentDownloads_(e){var t=this.playlistController_[e+"SegmentLoader_"];0=t.end(t.length-1))?this.techWaiting_():void(5<=this.consecutiveUpdates&&e===this.lastRecordedTime?(this.consecutiveUpdates++,this.waiting_()):e===this.lastRecordedTime?this.consecutiveUpdates++:(this.playedRanges_.push(Ud([this.lastRecordedTime,e])),t={playedRanges:this.playedRanges_},this.playlistController_.trigger({type:"playedrangeschanged",metadata:t}),this.consecutiveUpdates=0,this.lastRecordedTime=e))}resetTimeUpdate_(){this.consecutiveUpdates=0}fixesBadSeeks_(){if(!this.tech_.seeking())return!1;var e=this.seekable(),t=this.tech_.currentTime();let i;if(this.afterSeekableWindow_(e,t,this.media(),this.allowSeeksWithinUnsafeLiveWindow)&&(s=e.end(e.length-1),i=s),this.beforeSeekableWindow_(e,t)&&(s=e.start(0),i=s+(s===e.end(0)?0:$d)),"undefined"!=typeof i)this.logger_(`Trying to seek outside of seekable at time ${t} with `+`seekable range ${Gd(e)}. Seeking to `+i+".");else{var s=this.playlistController_.sourceUpdater_,e=this.tech_.buffered(),r=s.audioBuffer?s.audioBuffered():null,s=s.videoBuffer?s.videoBuffered():null,n=this.media(),a=n.partTargetDuration||2*(n.targetDuration-zd),o=[r,s];for(let e=0;e ${t.end(0)}]. Attempting to resume `+"playback by seeking to the current time."),this.tech_.trigger({type:"usage",name:"vhs-unknown-waiting"})))}techWaiting_(){var e,t=this.seekable(),i=this.tech_.currentTime();return!!this.tech_.seeking()||(this.beforeSeekableWindow_(t,i)?(t=t.end(t.length-1),this.logger_(`Fell out of live window at time ${i}. Seeking to `+"live point (seekable end) "+t),this.resetTimeUpdate_(),this.tech_.setCurrentTime(t),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),!0):(t=this.tech_.vhs.playlistController_.sourceUpdater_,e=this.tech_.buffered(),this.videoUnderflow_({audioBuffered:t.audioBuffered(),videoBuffered:t.videoBuffered(),currentTime:i})?(this.resetTimeUpdate_(),this.tech_.setCurrentTime(i),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),!0):0<(t=Fd(e,i)).length&&(this.logger_(`Stopped at ${i} and seeking to `+t.start(0)),this.resetTimeUpdate_(),this.skipTheGap_(i),!0)))}afterSeekableWindow_(e,t,i,s=!1){if(!e.length)return!1;let r=e.end(e.length-1)+$d;var n=!i.endList;return t>(r=n&&("number"==typeof i.partTargetDuration||s)?e.end(e.length-1)+3*i.targetDuration:r)}beforeSeekableWindow_(e,t){return!!(e.length&&0{t.trigger({type:"usage",name:"vhs-error-reload-initialized"})}),function(){a&&t.currentTime(a)});t.on("error",s),t.on("dispose",r),t.reloadSourceOnError=function(e){r(),Fc(t,e)}};function qc(t,e){var i=e.media();let s=-1;for(let e=0;efu(e,t)),e.filter(e=>!!mu(this.playlists.main,e).video));return e[0]||null},lastBandwidthSelector:Uu,movingAverageBandwidthSelector:function(t){let i=-1,s=-1;if(t<0||1{Object.defineProperty(N,t,{get(){return E.log.warn(`using Vhs.${t} is UNSAFE be sure you know what you are doing`),R[t]},set(e){E.log.warn(`using Vhs.${t} is UNSAFE be sure you know what you are doing`),"number"!=typeof e||e<0?E.log.warn(`value of Vhs.${t} must be greater than or equal to 0`):R[t]=e}})}),"videojs-vhs"),Hc=(N.canPlaySource=function(){return E.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")},({player:s,sourceKeySystems:e,audioMedia:t,mainPlaylists:i})=>{if(!s.eme.initializeMediaKeys)return Promise.resolve();var r,t=t?i.concat([t]):i,t=(i=t,r=Object.keys(e),i.reduce((e,s)=>{var t;return s.contentProtection&&(t=r.reduce((e,t)=>{var i=s.contentProtection[t];return i&&i.pssh&&(e[t]={pssh:i.pssh}),e},{}),Object.keys(t).length)&&e.push(t),e},[]));let n=[],a=[];return t.forEach(e=>{a.push(new Promise((e,t)=>{s.tech_.one("keysessioncreated",e)})),n.push(new Promise((t,i)=>{s.eme.initializeMediaKeys({keySystems:e},e=>{e?i(e):t()})}))}),Promise.race([Promise.all(n),Promise.race(a)])}),Vc=({player:e,sourceKeySystems:t,media:i,audioMedia:s})=>{t=((e,t,i)=>{if(!e)return e;let s={};t&&t.attributes&&t.attributes.CODECS&&(s=Lu(ra(t.attributes.CODECS))),i&&i.attributes&&i.attributes.CODECS&&(s.audio=i.attributes.CODECS);var r,n=na(s.video),a=na(s.audio),o={};for(r in e)o[r]={},a&&(o[r].audioContentType=a),n&&(o[r].videoContentType=n),t.contentProtection&&t.contentProtection[r]&&t.contentProtection[r].pssh&&(o[r].pssh=t.contentProtection[r].pssh),"string"==typeof e[r]&&(o[r].url=e[r]);return O(e,o)})(t,i,s);return!(!t||(e.currentSource().keySystems=t)&&!e.eme&&(E.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),1))},zc=()=>{if(!window.localStorage)return null;var e=window.localStorage.getItem(jc);if(!e)return null;try{return JSON.parse(e)}catch(e){return null}},$c=(e,t)=>{e._requestCallbackSet||(e._requestCallbackSet=new Set),e._requestCallbackSet.add(t)},Wc=(e,t)=>{e._responseCallbackSet||(e._responseCallbackSet=new Set),e._responseCallbackSet.add(t)},Gc=(e,t)=>{e._requestCallbackSet&&(e._requestCallbackSet.delete(t),e._requestCallbackSet.size||delete e._requestCallbackSet)},Xc=(e,t)=>{e._responseCallbackSet&&(e._responseCallbackSet.delete(t),e._responseCallbackSet.size||delete e._responseCallbackSet)};N.supportsNativeHls=function(){if(!document||!document.createElement)return!1;let t=document.createElement("video");return!!E.getTech("Html5").isSupported()&&["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some(function(e){return/maybe|probably/i.test(t.canPlayType(e))})}(),N.supportsNativeDash=!!(document&&document.createElement&&E.getTech("Html5").isSupported())&&/maybe|probably/i.test(document.createElement("video").canPlayType("application/dash+xml")),N.supportsTypeNatively=e=>"hls"===e?N.supportsNativeHls:"dash"===e&&N.supportsNativeDash,N.isSupported=function(){return E.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")},N.xhr.onRequest=function(e){$c(N.xhr,e)},N.xhr.onResponse=function(e){Wc(N.xhr,e)},N.xhr.offRequest=function(e){Gc(N.xhr,e)},N.xhr.offResponse=function(e){Xc(N.xhr,e)};t=E.getComponent("Component");class Kc extends t{constructor(e,t,i){if(super(t,i.vhs),"number"==typeof i.initialBandwidth&&(this.options_.bandwidth=i.initialBandwidth),this.logger_=Md("VhsHandler"),t.options_&&t.options_.playerId&&(i=E.getPlayer(t.options_.playerId),this.player_=i),this.tech_=t,this.source_=e,this.stats={},this.ignoreNextSeekingEvent_=!1,this.setOptions_(),this.options_.overrideNative&&t.overrideNativeAudioTracks&&t.overrideNativeVideoTracks)t.overrideNativeAudioTracks(!0),t.overrideNativeVideoTracks(!0);else if(this.options_.overrideNative&&(t.featuresNativeVideoTracks||t.featuresNativeAudioTracks))throw new Error("Overriding native VHS requires emulated tracks. See https://git.io/vMpjB");this.on(document,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],e=>{var t=document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement;t&&t.contains(this.tech_.el())?this.playlistController_.fastQualityChange_():this.playlistController_.checkABR_()}),this.on(this.tech_,"seeking",function(){this.ignoreNextSeekingEvent_?this.ignoreNextSeekingEvent_=!1:this.setCurrentTime(this.tech_.currentTime())}),this.on(this.tech_,"error",function(){this.tech_.error()&&this.playlistController_&&this.playlistController_.pauseLoading()}),this.on(this.tech_,"play",this.play)}setOptions_(e={}){this.options_=O(this.options_,e),this.options_.withCredentials=this.options_.withCredentials||!1,this.options_.limitRenditionByPlayerDimensions=!1!==this.options_.limitRenditionByPlayerDimensions,this.options_.useDevicePixelRatio=this.options_.useDevicePixelRatio||!1,this.options_.useBandwidthFromLocalStorage="undefined"!=typeof this.source_.useBandwidthFromLocalStorage?this.source_.useBandwidthFromLocalStorage:this.options_.useBandwidthFromLocalStorage||!1,this.options_.useForcedSubtitles=this.options_.useForcedSubtitles||!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,this.options_.llhls=!1!==this.options_.llhls,this.options_.bufferBasedABR=this.options_.bufferBasedABR||!1,"number"!=typeof this.options_.playlistExclusionDuration&&(this.options_.playlistExclusionDuration=60),"number"!=typeof this.options_.bandwidth&&this.options_.useBandwidthFromLocalStorage&&((e=zc())&&e.bandwidth&&(this.options_.bandwidth=e.bandwidth,this.tech_.trigger({type:"usage",name:"vhs-bandwidth-from-local-storage"})),e)&&e.throughput&&(this.options_.throughput=e.throughput,this.tech_.trigger({type:"usage",name:"vhs-throughput-from-local-storage"})),"number"!=typeof this.options_.bandwidth&&(this.options_.bandwidth=R.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===R.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","customPixelRatio","limitRenditionByPlayerDimensions","bandwidth","customTagParsers","customTagMappers","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","bufferBasedABR","liveRangeSafeTimeDelta","llhls","useForcedSubtitles","useNetworkInformationApi","useDtsForTimestampOffset","exactManifestTimings","leastPixelDiffSelector"].forEach(e=>{"undefined"!=typeof this.source_[e]&&(this.options_[e]=this.source_[e])}),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions,this.useDevicePixelRatio=this.options_.useDevicePixelRatio;e=this.options_.customPixelRatio;"number"==typeof e&&0<=e&&(this.customPixelRatio=e)}setOptions(e={}){this.setOptions_(e)}src(e,t){e&&(this.setOptions_(),this.options_.src=0===(e=this.source_.src).toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")?JSON.parse(e.substring(e.indexOf(",")+1)):e,this.options_.tech=this.tech_,this.options_.externVhs=N,this.options_.sourceType=Jn(t),this.options_.seekTo=e=>{this.tech_.setCurrentTime(e)},this.options_.player_=this.player_,this.playlistController_=new Rc(this.options_),e=O({liveRangeSafeTimeDelta:$d},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_}),this.playbackWatcher_=new Uc(e),this.attachStreamingEventListeners_(),this.playlistController_.on("error",()=>{var e=E.players[this.tech_.options_.playerId];let t=this.playlistController_.error;"object"!=typeof t||t.code?"string"==typeof t&&(t={message:t,code:3}):t.code=3,e.error(t)}),t=this.options_.bufferBasedABR?N.movingAverageBandwidthSelector(.55):N.STANDARD_PLAYLIST_SELECTOR,this.playlistController_.selectPlaylist=(this.selectPlaylist||t).bind(this),this.playlistController_.selectInitialPlaylist=N.INITIAL_PLAYLIST_SELECTOR.bind(this),this.playlists=this.playlistController_.mainPlaylistLoader_,this.mediaSource=this.playlistController_.mediaSource,Object.defineProperties(this,{selectPlaylist:{get(){return this.playlistController_.selectPlaylist},set(e){this.playlistController_.selectPlaylist=e.bind(this)}},throughput:{get(){return this.playlistController_.mainSegmentLoader_.throughput.rate},set(e){this.playlistController_.mainSegmentLoader_.throughput.rate=e,this.playlistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get(){let e=this.playlistController_.mainSegmentLoader_.bandwidth;var t=window.navigator.connection||window.navigator.mozConnection||window.navigator.webkitConnection;return this.options_.useNetworkInformationApi&&t&&(t=1e3*t.downlink*1e3,e=1e7<=t&&1e7<=e?Math.max(e,t):t),e},set(e){this.playlistController_.mainSegmentLoader_.bandwidth=e,this.playlistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get(){var e=1/(this.bandwidth||1);let t;return t=0this.bandwidth||0,enumerable:!0},mediaRequests:{get:()=>this.playlistController_.mediaRequests_()||0,enumerable:!0},mediaRequestsAborted:{get:()=>this.playlistController_.mediaRequestsAborted_()||0,enumerable:!0},mediaRequestsTimedout:{get:()=>this.playlistController_.mediaRequestsTimedout_()||0,enumerable:!0},mediaRequestsErrored:{get:()=>this.playlistController_.mediaRequestsErrored_()||0,enumerable:!0},mediaTransferDuration:{get:()=>this.playlistController_.mediaTransferDuration_()||0,enumerable:!0},mediaBytesTransferred:{get:()=>this.playlistController_.mediaBytesTransferred_()||0,enumerable:!0},mediaSecondsLoaded:{get:()=>this.playlistController_.mediaSecondsLoaded_()||0,enumerable:!0},mediaAppends:{get:()=>this.playlistController_.mediaAppends_()||0,enumerable:!0},mainAppendsToLoadedData:{get:()=>this.playlistController_.mainAppendsToLoadedData_()||0,enumerable:!0},audioAppendsToLoadedData:{get:()=>this.playlistController_.audioAppendsToLoadedData_()||0,enumerable:!0},appendsToLoadedData:{get:()=>this.playlistController_.appendsToLoadedData_()||0,enumerable:!0},timeToLoadedData:{get:()=>this.playlistController_.timeToLoadedData_()||0,enumerable:!0},buffered:{get:()=>Xd(this.tech_.buffered()),enumerable:!0},currentTime:{get:()=>this.tech_.currentTime(),enumerable:!0},currentSource:{get:()=>this.tech_.currentSource_,enumerable:!0},currentTech:{get:()=>this.tech_.name_,enumerable:!0},duration:{get:()=>this.tech_.duration(),enumerable:!0},main:{get:()=>this.playlists.main,enumerable:!0},playerDimensions:{get:()=>this.tech_.currentDimensions(),enumerable:!0},seekable:{get:()=>Xd(this.tech_.seekable()),enumerable:!0},timestamp:{get:()=>Date.now(),enumerable:!0},videoPlaybackQuality:{get:()=>this.tech_.getVideoPlaybackQuality(),enumerable:!0}}),this.tech_.one("canplay",this.playlistController_.setupFirstPlay.bind(this.playlistController_)),this.tech_.on("bandwidthupdate",()=>{if(this.options_.useBandwidthFromLocalStorage){var e={bandwidth:this.bandwidth,throughput:Math.round(this.throughput)};if(window.localStorage){var t=(t=zc())?O(t,e):e;try{window.localStorage.setItem(jc,JSON.stringify(t))}catch(e){return}}}}),this.playlistController_.on("selectedinitialmedia",()=>{var i;(i=this).representations=()=>{var e=i.playlistController_.main(),e=uh(e)?i.playlistController_.getAudioTrackPlaylists_():e.playlists;return e?e.filter(e=>!nh(e)).map((e,t)=>new Nc(i,e,e.id)):[]}}),this.playlistController_.sourceUpdater_.on("createdsourcebuffers",()=>{this.setupEme_()}),this.on(this.playlistController_,"progress",function(){this.tech_.trigger("progress")}),this.on(this.playlistController_,"firstplay",function(){this.ignoreNextSeekingEvent_=!0}),this.setupQualityLevels_(),this.tech_.el())&&(this.mediaSourceUrl_=window.URL.createObjectURL(this.playlistController_.mediaSource),(E.browser.IS_ANY_SAFARI||E.browser.IS_IOS)&&this.options_.overrideNative&&"hls"===this.options_.sourceType&&"function"==typeof this.tech_.addSourceElement?(this.tech_.addSourceElement(this.mediaSourceUrl_),this.tech_.addSourceElement(this.source_.src)):this.tech_.src(this.mediaSourceUrl_))}createKeySessions_(){var e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;this.logger_("waiting for EME key session creation"),Hc({player:this.player_,sourceKeySystems:this.source_.keySystems,audioMedia:e&&e.media(),mainPlaylists:this.playlists.main.playlists}).then(()=>{this.logger_("created EME key session"),this.playlistController_.sourceUpdater_.initializedEme()}).catch(e=>{this.logger_("error while creating EME key session",e),this.player_.error({message:"Failed to initialize media keys for EME",code:3})})}handleWaitingForKey_(){this.logger_("waitingforkey fired, attempting to create any new key sessions"),this.createKeySessions_()}setupEme_(){var e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader,e=Vc({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:e&&e.media()});this.player_.tech_.on("keystatuschange",e=>{this.playlistController_.updatePlaylistByKeyStatus(e.keyId,e.status)}),this.handleWaitingForKey_=this.handleWaitingForKey_.bind(this),this.player_.tech_.on("waitingforkey",this.handleWaitingForKey_),e?this.createKeySessions_():this.playlistController_.sourceUpdater_.initializedEme()}setupQualityLevels_(){var e=E.players[this.tech_.options_.playerId];e&&e.qualityLevels&&!this.qualityLevels_&&(this.qualityLevels_=e.qualityLevels(),this.playlistController_.on("selectedinitialmedia",()=>{var t,e;t=this.qualityLevels_,(e=this).representations().forEach(e=>{t.addQualityLevel(e)}),qc(t,e.playlists)}),this.playlists.on("mediachange",()=>{qc(this.qualityLevels_,this.playlists)}))}static version(){return{"@videojs/http-streaming":"3.15.0","mux.js":"7.0.3","mpd-parser":"1.3.1","m3u8-parser":"7.2.0","aes-decrypter":"4.0.2"}}version(){return this.constructor.version()}canChangeType(){return dc.canChangeType()}play(){this.playlistController_.play()}setCurrentTime(e){this.playlistController_.setCurrentTime(e)}duration(){return this.playlistController_.duration()}seekable(){return this.playlistController_.seekable()}dispose(){this.playbackWatcher_&&this.playbackWatcher_.dispose(),this.playlistController_&&this.playlistController_.dispose(),this.qualityLevels_&&this.qualityLevels_.dispose(),this.tech_&&this.tech_.vhs&&delete this.tech_.vhs,this.mediaSourceUrl_&&window.URL.revokeObjectURL&&(window.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),super.dispose()}convertToProgramTime(e,t){return qh({playlist:this.playlistController_.media(),time:e,callback:t})}seekToProgramTime(e,t,i=!0,s=2){return jh({programTime:e,playlist:this.playlistController_.media(),retryCount:s,pauseAfterSeek:i,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})}setupXhrHooks_(){this.xhr.onRequest=e=>{$c(this.xhr,e)},this.xhr.onResponse=e=>{Wc(this.xhr,e)},this.xhr.offRequest=e=>{Gc(this.xhr,e)},this.xhr.offResponse=e=>{Xc(this.xhr,e)},this.player_.trigger("xhr-hooks-ready")}attachStreamingEventListeners_(){["seekablerangeschanged","bufferedrangeschanged","contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"].forEach(e=>{this.playlistController_.on(e,e=>{this.player_.trigger(f({},e))})}),["gapjumped","playedrangeschanged"].forEach(e=>{this.playbackWatcher_.on(e,e=>{this.player_.trigger(f({},e))})})}}let Yc={name:"videojs-http-streaming",VERSION:"3.15.0",canHandleSource(e,t={}){t=O(E.options,t);return!(!t.vhs.experimentalUseMMS&&!Yn("avc1.4d400d,mp4a.40.2",!1))&&Yc.canPlayType(e.type,t)},handleSource(e,t,i={}){i=O(E.options,i);return t.vhs=new Kc(e,t,i),t.vhs.xhr=Dh(),t.vhs.setupXhrHooks_(),t.vhs.src(e.src,e.type),t.vhs},canPlayType(e,t){e=Jn(e);return e&&(t=Yc.getOverrideNative(t),!N.supportsTypeNatively(e)||t)?"maybe":""},getOverrideNative(e={}){var{vhs:e={}}=e,t=!(E.browser.IS_ANY_SAFARI||E.browser.IS_IOS),{overrideNative:e=t}=e;return e}};return Yn("avc1.4d400d,mp4a.40.2",!0)&&E.getTech("Html5").registerSourceHandler(Yc,0),E.VhsHandler=Kc,E.VhsSourceHandler=Yc,E.Vhs=N,E.use||E.registerComponent("Vhs",N),E.options.vhs=E.options.vhs||{},E.getPlugin&&E.getPlugin("reloadSourceOnError")||E.registerPlugin("reloadSourceOnError",function(e){Fc(this,e)}),E}); \ No newline at end of file diff --git a/modules/steasyvideo/views/js/videojs-vimeo.umd.js b/modules/steasyvideo/views/js/videojs-vimeo.umd.js new file mode 100644 index 00000000..37791c7a --- /dev/null +++ b/modules/steasyvideo/views/js/videojs-vimeo.umd.js @@ -0,0 +1,2417 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('video.js')) : + typeof define === 'function' && define.amd ? define(['video.js'], factory) : + (global = global || self, global['videojs-vimeo'] = factory(global.videojs)); +}(this, (function (videojs) { 'use strict'; + + videojs = videojs && videojs.hasOwnProperty('default') ? videojs['default'] : videojs; + + /*! @vimeo/player v2.10.0 | (c) 2019 Vimeo | MIT License | https://github.com/vimeo/player.js */ + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + + 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 lib/functions + */ + + /** + * Check to see this is a node environment. + * @type {Boolean} + */ + + /* global global */ + var isNode = typeof global !== 'undefined' && {}.toString.call(global) === '[object global]'; + /** + * Get the name of the method for a given getter or setter. + * + * @param {string} prop The name of the property. + * @param {string} type Either “get” or “set”. + * @return {string} + */ + + function getMethodName(prop, type) { + if (prop.indexOf(type.toLowerCase()) === 0) { + return prop; + } + + return "".concat(type.toLowerCase()).concat(prop.substr(0, 1).toUpperCase()).concat(prop.substr(1)); + } + /** + * Check to see if the object is a DOM Element. + * + * @param {*} element The object to check. + * @return {boolean} + */ + + function isDomElement(element) { + return Boolean(element && element.nodeType === 1 && 'nodeName' in element && element.ownerDocument && element.ownerDocument.defaultView); + } + /** + * Check to see whether the value is a number. + * + * @see http://dl.dropboxusercontent.com/u/35146/js/tests/isNumber.html + * @param {*} value The value to check. + * @param {boolean} integer Check if the value is an integer. + * @return {boolean} + */ + + function isInteger(value) { + // eslint-disable-next-line eqeqeq + return !isNaN(parseFloat(value)) && isFinite(value) && Math.floor(value) == value; + } + /** + * Check to see if the URL is a Vimeo url. + * + * @param {string} url The url string. + * @return {boolean} + */ + + function isVimeoUrl(url) { + return /^(https?:)?\/\/((player|www)\.)?vimeo\.com(?=$|\/)/.test(url); + } + /** + * Get the Vimeo URL from an element. + * The element must have either a data-vimeo-id or data-vimeo-url attribute. + * + * @param {object} oEmbedParameters The oEmbed parameters. + * @return {string} + */ + + function getVimeoUrl() { + var oEmbedParameters = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + var id = oEmbedParameters.id; + var url = oEmbedParameters.url; + var idOrUrl = id || url; + + if (!idOrUrl) { + throw new Error('An id or url must be passed, either in an options object or as a data-vimeo-id or data-vimeo-url attribute.'); + } + + if (isInteger(idOrUrl)) { + return "https://vimeo.com/".concat(idOrUrl); + } + + if (isVimeoUrl(idOrUrl)) { + return idOrUrl.replace('http:', 'https:'); + } + + if (id) { + throw new TypeError("\u201C".concat(id, "\u201D is not a valid video id.")); + } + + throw new TypeError("\u201C".concat(idOrUrl, "\u201D is not a vimeo.com url.")); + } + + var arrayIndexOfSupport = typeof Array.prototype.indexOf !== 'undefined'; + var postMessageSupport = typeof window !== 'undefined' && typeof window.postMessage !== 'undefined'; + + if (!isNode && (!arrayIndexOfSupport || !postMessageSupport)) { + throw new Error('Sorry, the Vimeo Player API is not available in this browser.'); + } + + var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; + + function createCommonjsModule(fn, module) { + return module = { exports: {} }, fn(module, module.exports), module.exports; + } + + /*! + * weakmap-polyfill v2.0.0 - ECMAScript6 WeakMap polyfill + * https://github.com/polygonplanet/weakmap-polyfill + * Copyright (c) 2015-2025 polygon planet + * @license MIT + */ + (function (self) { + + if (self.WeakMap) { + return; + } + + var hasOwnProperty = Object.prototype.hasOwnProperty; + + var defineProperty = function (object, name, value) { + if (Object.defineProperty) { + Object.defineProperty(object, name, { + configurable: true, + writable: true, + value: value + }); + } else { + object[name] = value; + } + }; + + self.WeakMap = function () { + // ECMA-262 23.3 WeakMap Objects + function WeakMap() { + if (this === void 0) { + throw new TypeError("Constructor WeakMap requires 'new'"); + } + + defineProperty(this, '_id', genId('_WeakMap')); // ECMA-262 23.3.1.1 WeakMap([iterable]) + + if (arguments.length > 0) { + // Currently, WeakMap `iterable` argument is not supported + throw new TypeError('WeakMap iterable is not supported'); + } + } // ECMA-262 23.3.3.2 WeakMap.prototype.delete(key) + + + defineProperty(WeakMap.prototype, 'delete', function (key) { + checkInstance(this, 'delete'); + + if (!isObject(key)) { + return false; + } + + var entry = key[this._id]; + + if (entry && entry[0] === key) { + delete key[this._id]; + return true; + } + + return false; + }); // ECMA-262 23.3.3.3 WeakMap.prototype.get(key) + + defineProperty(WeakMap.prototype, 'get', function (key) { + checkInstance(this, 'get'); + + if (!isObject(key)) { + return void 0; + } + + var entry = key[this._id]; + + if (entry && entry[0] === key) { + return entry[1]; + } + + return void 0; + }); // ECMA-262 23.3.3.4 WeakMap.prototype.has(key) + + defineProperty(WeakMap.prototype, 'has', function (key) { + checkInstance(this, 'has'); + + if (!isObject(key)) { + return false; + } + + var entry = key[this._id]; + + if (entry && entry[0] === key) { + return true; + } + + return false; + }); // ECMA-262 23.3.3.5 WeakMap.prototype.set(key, value) + + defineProperty(WeakMap.prototype, 'set', function (key, value) { + checkInstance(this, 'set'); + + if (!isObject(key)) { + throw new TypeError('Invalid value used as weak map key'); + } + + var entry = key[this._id]; + + if (entry && entry[0] === key) { + entry[1] = value; + return this; + } + + defineProperty(key, this._id, [key, value]); + return this; + }); + + function checkInstance(x, methodName) { + if (!isObject(x) || !hasOwnProperty.call(x, '_id')) { + throw new TypeError(methodName + ' method called on incompatible receiver ' + typeof x); + } + } + + function genId(prefix) { + return prefix + '_' + rand() + '.' + rand(); + } + + function rand() { + return Math.random().toString().substring(2); + } + + defineProperty(WeakMap, '_polyfill', true); + return WeakMap; + }(); + + function isObject(x) { + return Object(x) === x; + } + })(typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : typeof commonjsGlobal !== 'undefined' ? commonjsGlobal : commonjsGlobal); + + var npo_src = createCommonjsModule(function (module) { + /*! Native Promise Only + v0.8.1 (c) Kyle Simpson + MIT License: http://getify.mit-license.org + */ + (function UMD(name, context, definition) { + // special form of UMD for polyfilling across evironments + context[name] = context[name] || definition(); + + if (module.exports) { + module.exports = context[name]; + } + })("Promise", typeof commonjsGlobal != "undefined" ? commonjsGlobal : commonjsGlobal, function DEF() { + + var builtInProp, + cycle, + scheduling_queue, + ToString = Object.prototype.toString, + timer = typeof setImmediate != "undefined" ? function timer(fn) { + return setImmediate(fn); + } : setTimeout; // dammit, IE8. + + try { + Object.defineProperty({}, "x", {}); + + builtInProp = function builtInProp(obj, name, val, config) { + return Object.defineProperty(obj, name, { + value: val, + writable: true, + configurable: config !== false + }); + }; + } catch (err) { + builtInProp = function builtInProp(obj, name, val) { + obj[name] = val; + return obj; + }; + } // Note: using a queue instead of array for efficiency + + + scheduling_queue = function Queue() { + var first, last, item; + + function Item(fn, self) { + this.fn = fn; + this.self = self; + this.next = void 0; + } + + return { + add: function add(fn, self) { + item = new Item(fn, self); + + if (last) { + last.next = item; + } else { + first = item; + } + + last = item; + item = void 0; + }, + drain: function drain() { + var f = first; + first = last = cycle = void 0; + + while (f) { + f.fn.call(f.self); + f = f.next; + } + } + }; + }(); + + function schedule(fn, self) { + scheduling_queue.add(fn, self); + + if (!cycle) { + cycle = timer(scheduling_queue.drain); + } + } // promise duck typing + + + function isThenable(o) { + var _then, + o_type = typeof o; + + if (o != null && (o_type == "object" || o_type == "function")) { + _then = o.then; + } + + return typeof _then == "function" ? _then : false; + } + + function notify() { + for (var i = 0; i < this.chain.length; i++) { + notifyIsolated(this, this.state === 1 ? this.chain[i].success : this.chain[i].failure, this.chain[i]); + } + + this.chain.length = 0; + } // NOTE: This is a separate function to isolate + // the `try..catch` so that other code can be + // optimized better + + + function notifyIsolated(self, cb, chain) { + var ret, _then; + + try { + if (cb === false) { + chain.reject(self.msg); + } else { + if (cb === true) { + ret = self.msg; + } else { + ret = cb.call(void 0, self.msg); + } + + if (ret === chain.promise) { + chain.reject(TypeError("Promise-chain cycle")); + } else if (_then = isThenable(ret)) { + _then.call(ret, chain.resolve, chain.reject); + } else { + chain.resolve(ret); + } + } + } catch (err) { + chain.reject(err); + } + } + + function resolve(msg) { + var _then, + self = this; // already triggered? + + + if (self.triggered) { + return; + } + + self.triggered = true; // unwrap + + if (self.def) { + self = self.def; + } + + try { + if (_then = isThenable(msg)) { + schedule(function () { + var def_wrapper = new MakeDefWrapper(self); + + try { + _then.call(msg, function $resolve$() { + resolve.apply(def_wrapper, arguments); + }, function $reject$() { + reject.apply(def_wrapper, arguments); + }); + } catch (err) { + reject.call(def_wrapper, err); + } + }); + } else { + self.msg = msg; + self.state = 1; + + if (self.chain.length > 0) { + schedule(notify, self); + } + } + } catch (err) { + reject.call(new MakeDefWrapper(self), err); + } + } + + function reject(msg) { + var self = this; // already triggered? + + if (self.triggered) { + return; + } + + self.triggered = true; // unwrap + + if (self.def) { + self = self.def; + } + + self.msg = msg; + self.state = 2; + + if (self.chain.length > 0) { + schedule(notify, self); + } + } + + function iteratePromises(Constructor, arr, resolver, rejecter) { + for (var idx = 0; idx < arr.length; idx++) { + (function IIFE(idx) { + Constructor.resolve(arr[idx]).then(function $resolver$(msg) { + resolver(idx, msg); + }, rejecter); + })(idx); + } + } + + function MakeDefWrapper(self) { + this.def = self; + this.triggered = false; + } + + function MakeDef(self) { + this.promise = self; + this.state = 0; + this.triggered = false; + this.chain = []; + this.msg = void 0; + } + + function Promise(executor) { + if (typeof executor != "function") { + throw TypeError("Not a function"); + } + + if (this.__NPO__ !== 0) { + throw TypeError("Not a promise"); + } // instance shadowing the inherited "brand" + // to signal an already "initialized" promise + + + this.__NPO__ = 1; + var def = new MakeDef(this); + + this["then"] = function then(success, failure) { + var o = { + success: typeof success == "function" ? success : true, + failure: typeof failure == "function" ? failure : false + }; // Note: `then(..)` itself can be borrowed to be used against + // a different promise constructor for making the chained promise, + // by substituting a different `this` binding. + + o.promise = new this.constructor(function extractChain(resolve, reject) { + if (typeof resolve != "function" || typeof reject != "function") { + throw TypeError("Not a function"); + } + + o.resolve = resolve; + o.reject = reject; + }); + def.chain.push(o); + + if (def.state !== 0) { + schedule(notify, def); + } + + return o.promise; + }; + + this["catch"] = function $catch$(failure) { + return this.then(void 0, failure); + }; + + try { + executor.call(void 0, function publicResolve(msg) { + resolve.call(def, msg); + }, function publicReject(msg) { + reject.call(def, msg); + }); + } catch (err) { + reject.call(def, err); + } + } + + var PromisePrototype = builtInProp({}, "constructor", Promise, + /*configurable=*/ + false); // Note: Android 4 cannot use `Object.defineProperty(..)` here + + Promise.prototype = PromisePrototype; // built-in "brand" to signal an "uninitialized" promise + + builtInProp(PromisePrototype, "__NPO__", 0, + /*configurable=*/ + false); + builtInProp(Promise, "resolve", function Promise$resolve(msg) { + var Constructor = this; // spec mandated checks + // note: best "isPromise" check that's practical for now + + if (msg && typeof msg == "object" && msg.__NPO__ === 1) { + return msg; + } + + return new Constructor(function executor(resolve, reject) { + if (typeof resolve != "function" || typeof reject != "function") { + throw TypeError("Not a function"); + } + + resolve(msg); + }); + }); + builtInProp(Promise, "reject", function Promise$reject(msg) { + return new this(function executor(resolve, reject) { + if (typeof resolve != "function" || typeof reject != "function") { + throw TypeError("Not a function"); + } + + reject(msg); + }); + }); + builtInProp(Promise, "all", function Promise$all(arr) { + var Constructor = this; // spec mandated checks + + if (ToString.call(arr) != "[object Array]") { + return Constructor.reject(TypeError("Not an array")); + } + + if (arr.length === 0) { + return Constructor.resolve([]); + } + + return new Constructor(function executor(resolve, reject) { + if (typeof resolve != "function" || typeof reject != "function") { + throw TypeError("Not a function"); + } + + var len = arr.length, + msgs = Array(len), + count = 0; + iteratePromises(Constructor, arr, function resolver(idx, msg) { + msgs[idx] = msg; + + if (++count === len) { + resolve(msgs); + } + }, reject); + }); + }); + builtInProp(Promise, "race", function Promise$race(arr) { + var Constructor = this; // spec mandated checks + + if (ToString.call(arr) != "[object Array]") { + return Constructor.reject(TypeError("Not an array")); + } + + return new Constructor(function executor(resolve, reject) { + if (typeof resolve != "function" || typeof reject != "function") { + throw TypeError("Not a function"); + } + + iteratePromises(Constructor, arr, function resolver(idx, msg) { + resolve(msg); + }, reject); + }); + }); + return Promise; + }); + }); + + /** + * @module lib/callbacks + */ + var callbackMap = new WeakMap(); + /** + * Store a callback for a method or event for a player. + * + * @param {Player} player The player object. + * @param {string} name The method or event name. + * @param {(function(this:Player, *): void|{resolve: function, reject: function})} callback + * The callback to call or an object with resolve and reject functions for a promise. + * @return {void} + */ + + function storeCallback(player, name, callback) { + var playerCallbacks = callbackMap.get(player.element) || {}; + + if (!(name in playerCallbacks)) { + playerCallbacks[name] = []; + } + + playerCallbacks[name].push(callback); + callbackMap.set(player.element, playerCallbacks); + } + /** + * Get the callbacks for a player and event or method. + * + * @param {Player} player The player object. + * @param {string} name The method or event name + * @return {function[]} + */ + + function getCallbacks(player, name) { + var playerCallbacks = callbackMap.get(player.element) || {}; + return playerCallbacks[name] || []; + } + /** + * Remove a stored callback for a method or event for a player. + * + * @param {Player} player The player object. + * @param {string} name The method or event name + * @param {function} [callback] The specific callback to remove. + * @return {boolean} Was this the last callback? + */ + + function removeCallback(player, name, callback) { + var playerCallbacks = callbackMap.get(player.element) || {}; + + if (!playerCallbacks[name]) { + return true; + } // If no callback is passed, remove all callbacks for the event + + + if (!callback) { + playerCallbacks[name] = []; + callbackMap.set(player.element, playerCallbacks); + return true; + } + + var index = playerCallbacks[name].indexOf(callback); + + if (index !== -1) { + playerCallbacks[name].splice(index, 1); + } + + callbackMap.set(player.element, playerCallbacks); + return playerCallbacks[name] && playerCallbacks[name].length === 0; + } + /** + * Return the first stored callback for a player and event or method. + * + * @param {Player} player The player object. + * @param {string} name The method or event name. + * @return {function} The callback, or false if there were none + */ + + function shiftCallbacks(player, name) { + var playerCallbacks = getCallbacks(player, name); + + if (playerCallbacks.length < 1) { + return false; + } + + var callback = playerCallbacks.shift(); + removeCallback(player, name, callback); + return callback; + } + /** + * Move callbacks associated with an element to another element. + * + * @param {HTMLElement} oldElement The old element. + * @param {HTMLElement} newElement The new element. + * @return {void} + */ + + function swapCallbacks(oldElement, newElement) { + var playerCallbacks = callbackMap.get(oldElement); + callbackMap.set(newElement, playerCallbacks); + callbackMap.delete(oldElement); + } + + /** + * @module lib/embed + */ + var oEmbedParameters = ['autopause', 'autoplay', 'background', 'byline', 'color', 'controls', 'dnt', 'height', 'id', 'loop', 'maxheight', 'maxwidth', 'muted', 'playsinline', 'portrait', 'responsive', 'speed', 'texttrack', 'title', 'transparent', 'url', 'width']; + /** + * Get the 'data-vimeo'-prefixed attributes from an element as an object. + * + * @param {HTMLElement} element The element. + * @param {Object} [defaults={}] The default values to use. + * @return {Object} + */ + + function getOEmbedParameters(element) { + var defaults = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + return oEmbedParameters.reduce(function (params, param) { + var value = element.getAttribute("data-vimeo-".concat(param)); + + if (value || value === '') { + params[param] = value === '' ? 1 : value; + } + + return params; + }, defaults); + } + /** + * Create an embed from oEmbed data inside an element. + * + * @param {object} data The oEmbed data. + * @param {HTMLElement} element The element to put the iframe in. + * @return {HTMLIFrameElement} The iframe embed. + */ + + function createEmbed(_ref, element) { + var html = _ref.html; + + if (!element) { + throw new TypeError('An element must be provided'); + } + + if (element.getAttribute('data-vimeo-initialized') !== null) { + return element.querySelector('iframe'); + } + + var div = document.createElement('div'); + div.innerHTML = html; + element.appendChild(div.firstChild); + element.setAttribute('data-vimeo-initialized', 'true'); + return element.querySelector('iframe'); + } + /** + * Make an oEmbed call for the specified URL. + * + * @param {string} videoUrl The vimeo.com url for the video. + * @param {Object} [params] Parameters to pass to oEmbed. + * @param {HTMLElement} element The element. + * @return {Promise} + */ + + function getOEmbedData(videoUrl) { + var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + var element = arguments.length > 2 ? arguments[2] : undefined; + return new Promise(function (resolve, reject) { + if (!isVimeoUrl(videoUrl)) { + throw new TypeError("\u201C".concat(videoUrl, "\u201D is not a vimeo.com url.")); + } + + var url = "https://vimeo.com/api/oembed.json?url=".concat(encodeURIComponent(videoUrl)); + + for (var param in params) { + if (params.hasOwnProperty(param)) { + url += "&".concat(param, "=").concat(encodeURIComponent(params[param])); + } + } + + var xhr = 'XDomainRequest' in window ? new XDomainRequest() : new XMLHttpRequest(); + xhr.open('GET', url, true); + + xhr.onload = function () { + if (xhr.status === 404) { + reject(new Error("\u201C".concat(videoUrl, "\u201D was not found."))); + return; + } + + if (xhr.status === 403) { + reject(new Error("\u201C".concat(videoUrl, "\u201D is not embeddable."))); + return; + } + + try { + var json = JSON.parse(xhr.responseText); // Check api response for 403 on oembed + + if (json.domain_status_code === 403) { + // We still want to create the embed to give users visual feedback + createEmbed(json, element); + reject(new Error("\u201C".concat(videoUrl, "\u201D is not embeddable."))); + return; + } + + resolve(json); + } catch (error) { + reject(error); + } + }; + + xhr.onerror = function () { + var status = xhr.status ? " (".concat(xhr.status, ")") : ''; + reject(new Error("There was an error fetching the embed code from Vimeo".concat(status, "."))); + }; + + xhr.send(); + }); + } + /** + * Initialize all embeds within a specific element + * + * @param {HTMLElement} [parent=document] The parent element. + * @return {void} + */ + + function initializeEmbeds() { + var parent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document; + var elements = [].slice.call(parent.querySelectorAll('[data-vimeo-id], [data-vimeo-url]')); + + var handleError = function handleError(error) { + if ('console' in window && console.error) { + console.error("There was an error creating an embed: ".concat(error)); + } + }; + + elements.forEach(function (element) { + try { + // Skip any that have data-vimeo-defer + if (element.getAttribute('data-vimeo-defer') !== null) { + return; + } + + var params = getOEmbedParameters(element); + var url = getVimeoUrl(params); + getOEmbedData(url, params, element).then(function (data) { + return createEmbed(data, element); + }).catch(handleError); + } catch (error) { + handleError(error); + } + }); + } + /** + * Resize embeds when messaged by the player. + * + * @param {HTMLElement} [parent=document] The parent element. + * @return {void} + */ + + function resizeEmbeds() { + var parent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document; + + // Prevent execution if users include the player.js script multiple times. + if (window.VimeoPlayerResizeEmbeds_) { + return; + } + + window.VimeoPlayerResizeEmbeds_ = true; + + var onMessage = function onMessage(event) { + if (!isVimeoUrl(event.origin)) { + return; + } // 'spacechange' is fired only on embeds with cards + + + if (!event.data || event.data.event !== 'spacechange') { + return; + } + + var iframes = parent.querySelectorAll('iframe'); + + for (var i = 0; i < iframes.length; i++) { + if (iframes[i].contentWindow !== event.source) { + continue; + } // Change padding-bottom of the enclosing div to accommodate + // card carousel without distorting aspect ratio + + + var space = iframes[i].parentElement; + space.style.paddingBottom = "".concat(event.data.data[0].bottom, "px"); + break; + } + }; + + if (window.addEventListener) { + window.addEventListener('message', onMessage, false); + } else if (window.attachEvent) { + window.attachEvent('onmessage', onMessage); + } + } + + /** + * @module lib/postmessage + */ + /** + * Parse a message received from postMessage. + * + * @param {*} data The data received from postMessage. + * @return {object} + */ + + function parseMessageData(data) { + if (typeof data === 'string') { + try { + data = JSON.parse(data); + } catch (error) { + // If the message cannot be parsed, throw the error as a warning + console.warn(error); + return {}; + } + } + + return data; + } + /** + * Post a message to the specified target. + * + * @param {Player} player The player object to use. + * @param {string} method The API method to call. + * @param {object} params The parameters to send to the player. + * @return {void} + */ + + function postMessage(player, method, params) { + if (!player.element.contentWindow || !player.element.contentWindow.postMessage) { + return; + } + + var message = { + method: method + }; + + if (params !== undefined) { + message.value = params; + } // IE 8 and 9 do not support passing messages, so stringify them + + + var ieVersion = parseFloat(navigator.userAgent.toLowerCase().replace(/^.*msie (\d+).*$/, '$1')); + + if (ieVersion >= 8 && ieVersion < 10) { + message = JSON.stringify(message); + } + + player.element.contentWindow.postMessage(message, player.origin); + } + /** + * Parse the data received from a message event. + * + * @param {Player} player The player that received the message. + * @param {(Object|string)} data The message data. Strings will be parsed into JSON. + * @return {void} + */ + + function processData(player, data) { + data = parseMessageData(data); + var callbacks = []; + var param; + + if (data.event) { + if (data.event === 'error') { + var promises = getCallbacks(player, data.data.method); + promises.forEach(function (promise) { + var error = new Error(data.data.message); + error.name = data.data.name; + promise.reject(error); + removeCallback(player, data.data.method, promise); + }); + } + + callbacks = getCallbacks(player, "event:".concat(data.event)); + param = data.data; + } else if (data.method) { + var callback = shiftCallbacks(player, data.method); + + if (callback) { + callbacks.push(callback); + param = data.value; + } + } + + callbacks.forEach(function (callback) { + try { + if (typeof callback === 'function') { + callback.call(player, param); + return; + } + + callback.resolve(param); + } catch (e) {// empty + } + }); + } + + var playerMap = new WeakMap(); + var readyMap = new WeakMap(); + + var Player = + /*#__PURE__*/ + function () { + /** + * Create a Player. + * + * @param {(HTMLIFrameElement|HTMLElement|string|jQuery)} element A reference to the Vimeo + * player iframe, and id, or a jQuery object. + * @param {object} [options] oEmbed parameters to use when creating an embed in the element. + * @return {Player} + */ + function Player(element) { + var _this = this; + + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + + _classCallCheck(this, Player); + + /* global jQuery */ + if (window.jQuery && element instanceof jQuery) { + if (element.length > 1 && window.console && console.warn) { + console.warn('A jQuery object with multiple elements was passed, using the first element.'); + } + + element = element[0]; + } // Find an element by ID + + + if (typeof document !== 'undefined' && typeof element === 'string') { + element = document.getElementById(element); + } // Not an element! + + + if (!isDomElement(element)) { + throw new TypeError('You must pass either a valid element or a valid id.'); + } + + var win = element.ownerDocument.defaultView; // Already initialized an embed in this div, so grab the iframe + + if (element.nodeName !== 'IFRAME') { + var iframe = element.querySelector('iframe'); + + if (iframe) { + element = iframe; + } + } // iframe url is not a Vimeo url + + + if (element.nodeName === 'IFRAME' && !isVimeoUrl(element.getAttribute('src') || '')) { + throw new Error('The player element passed isn’t a Vimeo embed.'); + } // If there is already a player object in the map, return that + + + if (playerMap.has(element)) { + return playerMap.get(element); + } + + this.element = element; + this.origin = '*'; + var readyPromise = new npo_src(function (resolve, reject) { + var onMessage = function onMessage(event) { + if (!isVimeoUrl(event.origin) || _this.element.contentWindow !== event.source) { + return; + } + + if (_this.origin === '*') { + _this.origin = event.origin; + } + + var data = parseMessageData(event.data); + var isError = data && data.event === 'error'; + var isReadyError = isError && data.data && data.data.method === 'ready'; + + if (isReadyError) { + var error = new Error(data.data.message); + error.name = data.data.name; + reject(error); + return; + } + + var isReadyEvent = data && data.event === 'ready'; + var isPingResponse = data && data.method === 'ping'; + + if (isReadyEvent || isPingResponse) { + _this.element.setAttribute('data-ready', 'true'); + + resolve(); + return; + } + + processData(_this, data); + }; + + if (win.addEventListener) { + win.addEventListener('message', onMessage, false); + } else if (win.attachEvent) { + win.attachEvent('onmessage', onMessage); + } + + if (_this.element.nodeName !== 'IFRAME') { + var params = getOEmbedParameters(element, options); + var url = getVimeoUrl(params); + getOEmbedData(url, params, element).then(function (data) { + var iframe = createEmbed(data, element); // Overwrite element with the new iframe, + // but store reference to the original element + + _this.element = iframe; + _this._originalElement = element; + swapCallbacks(element, iframe); + playerMap.set(_this.element, _this); + return data; + }).catch(reject); + } + }); // Store a copy of this Player in the map + + readyMap.set(this, readyPromise); + playerMap.set(this.element, this); // Send a ping to the iframe so the ready promise will be resolved if + // the player is already ready. + + if (this.element.nodeName === 'IFRAME') { + postMessage(this, 'ping'); + } + + return this; + } + /** + * Get a promise for a method. + * + * @param {string} name The API method to call. + * @param {Object} [args={}] Arguments to send via postMessage. + * @return {Promise} + */ + + + _createClass(Player, [{ + key: "callMethod", + value: function callMethod(name) { + var _this2 = this; + + var args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + return new npo_src(function (resolve, reject) { + // We are storing the resolve/reject handlers to call later, so we + // can’t return here. + // eslint-disable-next-line promise/always-return + return _this2.ready().then(function () { + storeCallback(_this2, name, { + resolve: resolve, + reject: reject + }); + postMessage(_this2, name, args); + }).catch(reject); + }); + } + /** + * Get a promise for the value of a player property. + * + * @param {string} name The property name + * @return {Promise} + */ + + }, { + key: "get", + value: function get(name) { + var _this3 = this; + + return new npo_src(function (resolve, reject) { + name = getMethodName(name, 'get'); // We are storing the resolve/reject handlers to call later, so we + // can’t return here. + // eslint-disable-next-line promise/always-return + + return _this3.ready().then(function () { + storeCallback(_this3, name, { + resolve: resolve, + reject: reject + }); + postMessage(_this3, name); + }).catch(reject); + }); + } + /** + * Get a promise for setting the value of a player property. + * + * @param {string} name The API method to call. + * @param {mixed} value The value to set. + * @return {Promise} + */ + + }, { + key: "set", + value: function set(name, value) { + var _this4 = this; + + return new npo_src(function (resolve, reject) { + name = getMethodName(name, 'set'); + + if (value === undefined || value === null) { + throw new TypeError('There must be a value to set.'); + } // We are storing the resolve/reject handlers to call later, so we + // can’t return here. + // eslint-disable-next-line promise/always-return + + + return _this4.ready().then(function () { + storeCallback(_this4, name, { + resolve: resolve, + reject: reject + }); + postMessage(_this4, name, value); + }).catch(reject); + }); + } + /** + * Add an event listener for the specified event. Will call the + * callback with a single parameter, `data`, that contains the data for + * that event. + * + * @param {string} eventName The name of the event. + * @param {function(*)} callback The function to call when the event fires. + * @return {void} + */ + + }, { + key: "on", + value: function on(eventName, callback) { + if (!eventName) { + throw new TypeError('You must pass an event name.'); + } + + if (!callback) { + throw new TypeError('You must pass a callback function.'); + } + + if (typeof callback !== 'function') { + throw new TypeError('The callback must be a function.'); + } + + var callbacks = getCallbacks(this, "event:".concat(eventName)); + + if (callbacks.length === 0) { + this.callMethod('addEventListener', eventName).catch(function () {// Ignore the error. There will be an error event fired that + // will trigger the error callback if they are listening. + }); + } + + storeCallback(this, "event:".concat(eventName), callback); + } + /** + * Remove an event listener for the specified event. Will remove all + * listeners for that event if a `callback` isn’t passed, or only that + * specific callback if it is passed. + * + * @param {string} eventName The name of the event. + * @param {function} [callback] The specific callback to remove. + * @return {void} + */ + + }, { + key: "off", + value: function off(eventName, callback) { + if (!eventName) { + throw new TypeError('You must pass an event name.'); + } + + if (callback && typeof callback !== 'function') { + throw new TypeError('The callback must be a function.'); + } + + var lastCallback = removeCallback(this, "event:".concat(eventName), callback); // If there are no callbacks left, remove the listener + + if (lastCallback) { + this.callMethod('removeEventListener', eventName).catch(function (e) {// Ignore the error. There will be an error event fired that + // will trigger the error callback if they are listening. + }); + } + } + /** + * A promise to load a new video. + * + * @promise LoadVideoPromise + * @fulfill {number} The video with this id successfully loaded. + * @reject {TypeError} The id was not a number. + */ + + /** + * Load a new video into this embed. The promise will be resolved if + * the video is successfully loaded, or it will be rejected if it could + * not be loaded. + * + * @param {number|object} options The id of the video or an object with embed options. + * @return {LoadVideoPromise} + */ + + }, { + key: "loadVideo", + value: function loadVideo(options) { + return this.callMethod('loadVideo', options); + } + /** + * A promise to perform an action when the Player is ready. + * + * @todo document errors + * @promise LoadVideoPromise + * @fulfill {void} + */ + + /** + * Trigger a function when the player iframe has initialized. You do not + * need to wait for `ready` to trigger to begin adding event listeners + * or calling other methods. + * + * @return {ReadyPromise} + */ + + }, { + key: "ready", + value: function ready() { + var readyPromise = readyMap.get(this) || new npo_src(function (resolve, reject) { + reject(new Error('Unknown player. Probably unloaded.')); + }); + return npo_src.resolve(readyPromise); + } + /** + * A promise to add a cue point to the player. + * + * @promise AddCuePointPromise + * @fulfill {string} The id of the cue point to use for removeCuePoint. + * @reject {RangeError} the time was less than 0 or greater than the + * video’s duration. + * @reject {UnsupportedError} Cue points are not supported with the current + * player or browser. + */ + + /** + * Add a cue point to the player. + * + * @param {number} time The time for the cue point. + * @param {object} [data] Arbitrary data to be returned with the cue point. + * @return {AddCuePointPromise} + */ + + }, { + key: "addCuePoint", + value: function addCuePoint(time) { + var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + return this.callMethod('addCuePoint', { + time: time, + data: data + }); + } + /** + * A promise to remove a cue point from the player. + * + * @promise AddCuePointPromise + * @fulfill {string} The id of the cue point that was removed. + * @reject {InvalidCuePoint} The cue point with the specified id was not + * found. + * @reject {UnsupportedError} Cue points are not supported with the current + * player or browser. + */ + + /** + * Remove a cue point from the video. + * + * @param {string} id The id of the cue point to remove. + * @return {RemoveCuePointPromise} + */ + + }, { + key: "removeCuePoint", + value: function removeCuePoint(id) { + return this.callMethod('removeCuePoint', id); + } + /** + * A representation of a text track on a video. + * + * @typedef {Object} VimeoTextTrack + * @property {string} language The ISO language code. + * @property {string} kind The kind of track it is (captions or subtitles). + * @property {string} label The human‐readable label for the track. + */ + + /** + * A promise to enable a text track. + * + * @promise EnableTextTrackPromise + * @fulfill {VimeoTextTrack} The text track that was enabled. + * @reject {InvalidTrackLanguageError} No track was available with the + * specified language. + * @reject {InvalidTrackError} No track was available with the specified + * language and kind. + */ + + /** + * Enable the text track with the specified language, and optionally the + * specified kind (captions or subtitles). + * + * When set via the API, the track language will not change the viewer’s + * stored preference. + * + * @param {string} language The two‐letter language code. + * @param {string} [kind] The kind of track to enable (captions or subtitles). + * @return {EnableTextTrackPromise} + */ + + }, { + key: "enableTextTrack", + value: function enableTextTrack(language, kind) { + if (!language) { + throw new TypeError('You must pass a language.'); + } + + return this.callMethod('enableTextTrack', { + language: language, + kind: kind + }); + } + /** + * A promise to disable the active text track. + * + * @promise DisableTextTrackPromise + * @fulfill {void} The track was disabled. + */ + + /** + * Disable the currently-active text track. + * + * @return {DisableTextTrackPromise} + */ + + }, { + key: "disableTextTrack", + value: function disableTextTrack() { + return this.callMethod('disableTextTrack'); + } + /** + * A promise to pause the video. + * + * @promise PausePromise + * @fulfill {void} The video was paused. + */ + + /** + * Pause the video if it’s playing. + * + * @return {PausePromise} + */ + + }, { + key: "pause", + value: function pause() { + return this.callMethod('pause'); + } + /** + * A promise to play the video. + * + * @promise PlayPromise + * @fulfill {void} The video was played. + */ + + /** + * Play the video if it’s paused. **Note:** on iOS and some other + * mobile devices, you cannot programmatically trigger play. Once the + * viewer has tapped on the play button in the player, however, you + * will be able to use this function. + * + * @return {PlayPromise} + */ + + }, { + key: "play", + value: function play() { + return this.callMethod('play'); + } + /** + * A promise to unload the video. + * + * @promise UnloadPromise + * @fulfill {void} The video was unloaded. + */ + + /** + * Return the player to its initial state. + * + * @return {UnloadPromise} + */ + + }, { + key: "unload", + value: function unload() { + return this.callMethod('unload'); + } + /** + * Cleanup the player and remove it from the DOM + * + * It won't be usable and a new one should be constructed + * in order to do any operations. + * + * @return {Promise} + */ + + }, { + key: "destroy", + value: function destroy() { + var _this5 = this; + + return new npo_src(function (resolve) { + readyMap.delete(_this5); + playerMap.delete(_this5.element); + + if (_this5._originalElement) { + playerMap.delete(_this5._originalElement); + + _this5._originalElement.removeAttribute('data-vimeo-initialized'); + } + + if (_this5.element && _this5.element.nodeName === 'IFRAME' && _this5.element.parentNode) { + _this5.element.parentNode.removeChild(_this5.element); + } + + resolve(); + }); + } + /** + * A promise to get the autopause behavior of the video. + * + * @promise GetAutopausePromise + * @fulfill {boolean} Whether autopause is turned on or off. + * @reject {UnsupportedError} Autopause is not supported with the current + * player or browser. + */ + + /** + * Get the autopause behavior for this player. + * + * @return {GetAutopausePromise} + */ + + }, { + key: "getAutopause", + value: function getAutopause() { + return this.get('autopause'); + } + /** + * A promise to set the autopause behavior of the video. + * + * @promise SetAutopausePromise + * @fulfill {boolean} Whether autopause is turned on or off. + * @reject {UnsupportedError} Autopause is not supported with the current + * player or browser. + */ + + /** + * Enable or disable the autopause behavior of this player. + * + * By default, when another video is played in the same browser, this + * player will automatically pause. Unless you have a specific reason + * for doing so, we recommend that you leave autopause set to the + * default (`true`). + * + * @param {boolean} autopause + * @return {SetAutopausePromise} + */ + + }, { + key: "setAutopause", + value: function setAutopause(autopause) { + return this.set('autopause', autopause); + } + /** + * A promise to get the buffered property of the video. + * + * @promise GetBufferedPromise + * @fulfill {Array} Buffered Timeranges converted to an Array. + */ + + /** + * Get the buffered property of the video. + * + * @return {GetBufferedPromise} + */ + + }, { + key: "getBuffered", + value: function getBuffered() { + return this.get('buffered'); + } + /** + * A promise to get the color of the player. + * + * @promise GetColorPromise + * @fulfill {string} The hex color of the player. + */ + + /** + * Get the color for this player. + * + * @return {GetColorPromise} + */ + + }, { + key: "getColor", + value: function getColor() { + return this.get('color'); + } + /** + * A promise to set the color of the player. + * + * @promise SetColorPromise + * @fulfill {string} The color was successfully set. + * @reject {TypeError} The string was not a valid hex or rgb color. + * @reject {ContrastError} The color was set, but the contrast is + * outside of the acceptable range. + * @reject {EmbedSettingsError} The owner of the player has chosen to + * use a specific color. + */ + + /** + * Set the color of this player to a hex or rgb string. Setting the + * color may fail if the owner of the video has set their embed + * preferences to force a specific color. + * + * @param {string} color The hex or rgb color string to set. + * @return {SetColorPromise} + */ + + }, { + key: "setColor", + value: function setColor(color) { + return this.set('color', color); + } + /** + * A representation of a cue point. + * + * @typedef {Object} VimeoCuePoint + * @property {number} time The time of the cue point. + * @property {object} data The data passed when adding the cue point. + * @property {string} id The unique id for use with removeCuePoint. + */ + + /** + * A promise to get the cue points of a video. + * + * @promise GetCuePointsPromise + * @fulfill {VimeoCuePoint[]} The cue points added to the video. + * @reject {UnsupportedError} Cue points are not supported with the current + * player or browser. + */ + + /** + * Get an array of the cue points added to the video. + * + * @return {GetCuePointsPromise} + */ + + }, { + key: "getCuePoints", + value: function getCuePoints() { + return this.get('cuePoints'); + } + /** + * A promise to get the current time of the video. + * + * @promise GetCurrentTimePromise + * @fulfill {number} The current time in seconds. + */ + + /** + * Get the current playback position in seconds. + * + * @return {GetCurrentTimePromise} + */ + + }, { + key: "getCurrentTime", + value: function getCurrentTime() { + return this.get('currentTime'); + } + /** + * A promise to set the current time of the video. + * + * @promise SetCurrentTimePromise + * @fulfill {number} The actual current time that was set. + * @reject {RangeError} the time was less than 0 or greater than the + * video’s duration. + */ + + /** + * Set the current playback position in seconds. If the player was + * paused, it will remain paused. Likewise, if the player was playing, + * it will resume playing once the video has buffered. + * + * You can provide an accurate time and the player will attempt to seek + * to as close to that time as possible. The exact time will be the + * fulfilled value of the promise. + * + * @param {number} currentTime + * @return {SetCurrentTimePromise} + */ + + }, { + key: "setCurrentTime", + value: function setCurrentTime(currentTime) { + return this.set('currentTime', currentTime); + } + /** + * A promise to get the duration of the video. + * + * @promise GetDurationPromise + * @fulfill {number} The duration in seconds. + */ + + /** + * Get the duration of the video in seconds. It will be rounded to the + * nearest second before playback begins, and to the nearest thousandth + * of a second after playback begins. + * + * @return {GetDurationPromise} + */ + + }, { + key: "getDuration", + value: function getDuration() { + return this.get('duration'); + } + /** + * A promise to get the ended state of the video. + * + * @promise GetEndedPromise + * @fulfill {boolean} Whether or not the video has ended. + */ + + /** + * Get the ended state of the video. The video has ended if + * `currentTime === duration`. + * + * @return {GetEndedPromise} + */ + + }, { + key: "getEnded", + value: function getEnded() { + return this.get('ended'); + } + /** + * A promise to get the loop state of the player. + * + * @promise GetLoopPromise + * @fulfill {boolean} Whether or not the player is set to loop. + */ + + /** + * Get the loop state of the player. + * + * @return {GetLoopPromise} + */ + + }, { + key: "getLoop", + value: function getLoop() { + return this.get('loop'); + } + /** + * A promise to set the loop state of the player. + * + * @promise SetLoopPromise + * @fulfill {boolean} The loop state that was set. + */ + + /** + * Set the loop state of the player. When set to `true`, the player + * will start over immediately once playback ends. + * + * @param {boolean} loop + * @return {SetLoopPromise} + */ + + }, { + key: "setLoop", + value: function setLoop(loop) { + return this.set('loop', loop); + } + /** + * A promise to set the muted state of the player. + * + * @promise SetMutedPromise + * @fulfill {boolean} The muted state that was set. + */ + + /** + * Set the muted state of the player. When set to `true`, the player + * volume will be muted. + * + * @param {boolean} muted + * @return {SetMutedPromise} + */ + + }, { + key: "setMuted", + value: function setMuted(muted) { + return this.set('muted', muted); + } + /** + * A promise to get the muted state of the player. + * + * @promise GetMutedPromise + * @fulfill {boolean} Whether or not the player is muted. + */ + + /** + * Get the muted state of the player. + * + * @return {GetMutedPromise} + */ + + }, { + key: "getMuted", + value: function getMuted() { + return this.get('muted'); + } + /** + * A promise to get the paused state of the player. + * + * @promise GetLoopPromise + * @fulfill {boolean} Whether or not the video is paused. + */ + + /** + * Get the paused state of the player. + * + * @return {GetLoopPromise} + */ + + }, { + key: "getPaused", + value: function getPaused() { + return this.get('paused'); + } + /** + * A promise to get the playback rate of the player. + * + * @promise GetPlaybackRatePromise + * @fulfill {number} The playback rate of the player on a scale from 0.5 to 2. + */ + + /** + * Get the playback rate of the player on a scale from `0.5` to `2`. + * + * @return {GetPlaybackRatePromise} + */ + + }, { + key: "getPlaybackRate", + value: function getPlaybackRate() { + return this.get('playbackRate'); + } + /** + * A promise to set the playbackrate of the player. + * + * @promise SetPlaybackRatePromise + * @fulfill {number} The playback rate was set. + * @reject {RangeError} The playback rate was less than 0.5 or greater than 2. + */ + + /** + * Set the playback rate of the player on a scale from `0.5` to `2`. When set + * via the API, the playback rate will not be synchronized to other + * players or stored as the viewer's preference. + * + * @param {number} playbackRate + * @return {SetPlaybackRatePromise} + */ + + }, { + key: "setPlaybackRate", + value: function setPlaybackRate(playbackRate) { + return this.set('playbackRate', playbackRate); + } + /** + * A promise to get the played property of the video. + * + * @promise GetPlayedPromise + * @fulfill {Array} Played Timeranges converted to an Array. + */ + + /** + * Get the played property of the video. + * + * @return {GetPlayedPromise} + */ + + }, { + key: "getPlayed", + value: function getPlayed() { + return this.get('played'); + } + /** + * A promise to get the seekable property of the video. + * + * @promise GetSeekablePromise + * @fulfill {Array} Seekable Timeranges converted to an Array. + */ + + /** + * Get the seekable property of the video. + * + * @return {GetSeekablePromise} + */ + + }, { + key: "getSeekable", + value: function getSeekable() { + return this.get('seekable'); + } + /** + * A promise to get the seeking property of the player. + * + * @promise GetSeekingPromise + * @fulfill {boolean} Whether or not the player is currently seeking. + */ + + /** + * Get if the player is currently seeking. + * + * @return {GetSeekingPromise} + */ + + }, { + key: "getSeeking", + value: function getSeeking() { + return this.get('seeking'); + } + /** + * A promise to get the text tracks of a video. + * + * @promise GetTextTracksPromise + * @fulfill {VimeoTextTrack[]} The text tracks associated with the video. + */ + + /** + * Get an array of the text tracks that exist for the video. + * + * @return {GetTextTracksPromise} + */ + + }, { + key: "getTextTracks", + value: function getTextTracks() { + return this.get('textTracks'); + } + /** + * A promise to get the embed code for the video. + * + * @promise GetVideoEmbedCodePromise + * @fulfill {string} The `