1/*! For license information please see globalComponets.js.LICENSE.txt */ 2(()=>{var e={9959:(e,t,r)=>{"use strict";function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var i,n,a,s,o=[],l=!0,u=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;l=!1}else for(;!(l=(i=a.call(r)).done)&&(o.push(i.value),o.length!==t);l=!0);}catch(e){u=!0,n=e}finally{try{if(!l&&null!=r.return&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw n}}return o}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return n(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return n(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=new Array(t);r<t;r++)i[r]=e[r];return i}var a=r(4691),s=r(9800),o=r(3209);window.updateSku=function(e){TurnToCmd("set",{sku:e}),TurnToCmd("reviewsList.writeReview")};var l,u=[],d={};function c(e,t){u[t]={},u[t].tablistNode=e,u[t].tabs=[],u[t].firstTab=null,u[t].lastTab=null,u[t].tabs=Array.from(u[t].tablistNode.querySelectorAll("[role=tab]")),u[t].tabpanels=[];for(var r=function(){var e=u[t].tabs[i],r=document.getElementById(e.getAttribute("aria-controls")+"-tab")?document.getElementById(e.getAttribute("aria-controls")+"-tab"):document.getElementById(e.getAttribute("aria-controls")+"Tab");e.tabIndex=-1,e.setAttribute("aria-selected","false"),u[t].tabpanels.push(r),e.addEventListener("keydown",d.onKeydown.bind(u[t])),e.addEventListener("click",(function(){d.setSelectedTab(e,null,t),$(window).width()<1024&&!$(e.closest(".header-menu-sub-menu")).hasClass("isSubMenuOpen")?setTimeout((function(){$('.header-menu-sub-menu [data-toggle="tab"]').attr("tabindex","-1"),$(".header-menu-sub-menu-title").attr("tabindex","-1"),$(".category-button").attr("tabindex","-1"),$(".header-menu-sub-menu-title.back").attr("tabindex","0")}),500):$(window).width()<1024&&e.closest(".header-menu-nav")&&setTimeout((function(){$('.header-menu-nav [data-toggle="tab"]').attr("tabindex","0")}),500)})),u[t].firstTab||(u[t].firstTab=e),u[t].lastTab=e},i=0;i<u[t].tabs.length;i+=1)r();d.setSelectedTab(u[t].firstTab,!1,t)}function h(){screen.availWidth>1200?document.body.classList.add("zoomed-in-400"):document.body.classList.remove("zoomed-in-400")}d.setSelectedTab=function(e,t,r){"boolean"!=typeof t&&(t=!0);for(var i=0;i<u[r].tabs.length;i+=1){var n=u[r].tabs[i];e===n?(n.setAttribute("aria-selected","true"),n.removeAttribute("tabindex"),u[r].tabpanels[i]&&u[r].tabpanels[i].classList.remove("is-hidden"),t&&n.focus()):(n.setAttribute("aria-selected","false"),n.tabIndex=-1,u[r].tabpanels[i]&&u[r].tabpanels[i].classList.add("is-hidden"))}},d.setSelectedToPreviousTab=function(e,t){var r;e===u[t].firstTab?u[t].lastTab.focus():(r=u[t].tabs.indexOf(e),u[t].tabs[r-1].focus())},d.setSelectedToNextTab=function(e,t){var r;e===u[t].lastTab?u[t].firstTab.focus():(r=u[t].tabs.indexOf(e),u[t].tabs[r+1].focus())},d.onKeydown=function(e){for(var t,r=e.currentTarget,i=r.closest(".product-warranty")?r.parentNode:r.parentNode.parentNode,n=0;n<l.length;n+=1)if(i===l[n]){t=n;break}var a=!1;switch(e.key){case"ArrowLeft":d.setSelectedToPreviousTab(r,t),a=!0;break;case"ArrowRight":d.setSelectedToNextTab(r,t),a=!0;break;case"Home":u[t].firstTab.focus(),a=!0;break;case"End":u[t].lastTab.focus(),a=!0}a&&(e.stopPropagation(),e.preventDefault())},window.addEventListener("resize",h),e.exports={checkZoomLevel:h,initializeTooltips:function(){$(document).on("mouseenter focus",'[data-toggle="tooltip"]',(function(){$(this).tooltip({trigger:"hover focus",placement:"bottom",html:!0,title:'<a href="#" class="close" data-dismiss="alert">×</a>'}).tooltip("show")})),$(document).on("click",'[data-toggle="tooltip"]',(function(e){var t=$(this);setTimeout((function(){$(".tooltip-inner").prepend('<button href="javascript:void(0)" class="close close-tooltip" data-dismiss="alert" type="button" aria-label="close">×</button>'),t.hasClass("secondary-tool-info")&&t.addClass("test")}),100),setTimeout((function(){$(".tooltip-inner .close").focus()}),300)}
2)),$(document).on("click",".close-tooltip",(function(){var e=$(this).closest(".tooltip").attr("id");$('[aria-describedby="'+e+'"]').hasClass("test")&&($(".tracerNumber").focus(),$('[aria-describedby="'+e+'"]').removeClass("test")),$("#"+e).tooltip("hide")})),$(document).on("hide.bs.tooltip",".secondary-tool-info",(function(e){$(e.currentTarget).hasClass("test")&&e.preventDefault()}))},videoADAcontrols:function(){$("video").each((function(){var e=document.createElement("div");e.classList="video-ADA-controls isPlaying",e.setAttribute("tabindex",0),e.setAttribute("role","button"),e.setAttribute("aria-label","Pause Video"),$(e).css("margin-right",$(this).parent().css("padding-right")),e.addEventListener("click",(function(){$(this).parent().find("video").get(0).paused?($(this).parent().find("video").get(0).play(),e.setAttribute("aria-label","Pause Video"),e.classList="video-ADA-controls isPlaying"):($(this).parent().find("video").get(0).pause(),e.setAttribute("aria-label","Play Video"),e.classList="video-ADA-controls isPaused")}),!1),$(this).parent().append(e)}))},displayNotification:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:4e3,i=window.sessionStorage.getItem("accountNotification");if(e=e||i){var n=document.createElement("div");n.innerHTML='\n <div class="common-notification">\n <div class="container">\n <div class="row">\n <div class="col-10 pr-0">\n <p class="notification_message m-0 '.concat(t?"":"error",'" aria-live="polite" role="alert">').concat(e,'</p>\n </div>\n <div class="col-2 text-right">\n <a href="javascript:void(0)" class="remove-notification"><svg width="17" height="18" viewBox="0 0 17 18" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path fill-rule="evenodd" clip-rule="evenodd" d="M0 1.20833L0.708333 0.5L8.50715 8.29881L16.0937 0.71224L16.8021 1.42057L9.21548 9.00715L17 16.7917L16.2917 17.5L8.50715 9.71548L0.921224 17.3014L0.212891 16.5931L7.79881 9.00715L0 1.20833Z" fill="#1b1c1e"/>\n </svg></a>\n </div>\n </div>\n </div>\n </div>'),$("header").after(n);var a=document.querySelector(".header").getBoundingClientRect(),s=a.y+a.height;$(".sticky-container").hasClass("active")&&(s+=document.querySelector(".sticky-container").getBoundingClientRect().height),s<1?$(".common-notification").css("top","0"):$(".common-notification").css("top",s),$(".remove-notification").on("click",(function(){$(".common-notification").css("display","none")})),setTimeout((function(){$(".common-notification").remove(),window.sessionStorage.removeItem("accountNotification")}),r)}},setNotificationMessage:function(e){e&&window.sessionStorage.setItem("accountNotification",e)},updateTabForComponents:function(){window.addEventListener("load",(function(){l=document.querySelectorAll("[role=menu].nav-tabs, [role=tablist]");for(var e=0;e<l.length;e+=1)c(l[e],e)}))},checkUserLoggedIn:function(){$(window).width()>1024?$('#footer-my-account, [aria-labelledby="footer-my-account"] a:eq(0)').on("click",(function(e){e.preventDefault();$("#footer-my-account").attr("href");$("#myaccount").length>0?window.location=$("#footer-my-account").attr("href"):$("#requestLoginModal").modal("show")})):$('[aria-labelledby="footer-my-account"] a:eq(0)').on("click",(function(e){e.preventDefault(),$("#myaccount").length>0?window.location=$("#footer-my-account").attr("href"):$("#requestLoginModal").modal("show")}))},registerType:function(){var e=document.querySelector(".service-repairs-signin");e&&e.addEventListener("click",(function(){document.querySelector("li.login-tab a.nav-link").classList.add("active"),document.querySelector("li.register-tab a.nav-link").classList.remove("active"),document.querySelector("#login").classList.add("active"),document.querySelector("#register").classList.remove("active")}));var t=document.querySelector(".service-repairs-register");t&&t.addEventListener("click",(function(){document.querySelector("li.register-tab a.nav-link").classList.add("active"),document.querySelector("li.login-tab a.nav-link").classList.remove("active"),document.querySelector("#register").classList.add("active"),document.querySelector("#login").classList.remove("active")}))},logoutPopup:function(){var e=window.pageContext?window.pageContext.ns:"",t=window.location.href.indexOf("rurl=1");"homepage"===e&&t>-1&&$('[data-target="#requestLoginModal"]').click()},timerInitialize:function(){var e=this;document.querySelectorAll(".countdown-time").forEach((function(t){var r=t.dataset.id;e.countdownTimer("."+r)}))},countdownTimer:function(e){var t=$(e).closest(".countdown-time").find(".end-time").val(),r=new Date(t).getTime(),i=setInterval((function(){var t=(new Date).getTime(),n=r-t,a=Math.floor(n/864e5),s=Math.floor(n%864e5/36e5),o=Math.floor(n%36e5/6e4),l=Math.floor(n%6e4/1e3);a>0?$(e+" .days").html(a+" "+(a>1?window.Resources.days:window.Resources.day)):($(e+" .days").html(""),$(e+" .hours").html(s<10?"0"+s+":":s+":"),$(e+" .mins").html(o<10?"0"+o+":":o+":"),$(e+" .secs").html(l<10?"0"+l:l)),n<0&&(clearInterval(i),$(e+" .hours").html(""),$(e+" .mins").html(""),$(e+" .secs").html(""))}),1e3)},orderSummeryinMobile:function(){$(document).on("click",".mobile-cart-review",(function(e){e.preventDefault(),$(".order-mobile").toggleClass("d-block"),$(".mobile-cart-review .text-right").toggleClass("svg-icon")}))},confirmationPageCreateAccount:function(){$(".order-confirmation").length>0&&$("#requestLoginModal").on("shown.bs.modal",(function(e){"create-account"===e.relatedTarget.dataset.login?$("#register-tab").trigger("click"):$("#login-tab").trigger("click")}))}
2,loadEmarsys:function(){var e=$("#emarsys-newsletter-subscription");if(e.length){var t=new IntersectionObserver((function(r){if(r[0].isIntersecting){var i=$("#loadEmarsysJsDynamically");i.length&&!i.data("loaded")&&s.loadJsDynamically(i);var n=$("#loadEmarsysCssDynamically");n.length&&!n.data("loaded")&&s.loadCssDynamically(n);var a=$("#isLoyalty");if(a.length&&a.data("value")){var o=$("#URLuiElements");o.length&&!o.data("loaded")&&s.loadJsDynamically(o);var l=$("#URLexaccess");l.length&&!l.data("loaded")&&s.loadJsDynamically(l)}t.unobserve(e[0])}}),{rootMargin:"0px",threshold:0});t.observe(e[0])}},turnToLazyLoad:function(){var e,t=$(".order-confirmation"),r=$("#pdp-review-section"),i=$(".purchase-order-details-container");if((e=r.length?r:t.length?t:i).length){var n=new IntersectionObserver((function(t){function r(){loadCssDynamically($("#loadTurntoCssDynamically")),loadJsDynamically($("#loadTurntoJsDynamically")),n.unobserve(e[0])}setTimeout((function(){r(),$("#pdp-review-section").css("padding-bottom","0")}),5e3),t[0].isIntersecting&&r()}),{rootMargin:"0px",threshold:0});n.observe(e[0])}}
2,showHideRepairQuestionere:function(){var e=$(".showMoreQue"),t=e.attr("data-show-label"),r=e.attr("data-hide-label");e&&$(".showMoreQue").on("click",(function(e){var i=$(e.target);i.hasClass("showMoreQue")?(i.removeClass("showMoreQue"),i.addClass("hideMoreQue"),i.html(r)):(i.removeClass("hideMoreQue"),i.addClass("showMoreQue"),i.html(t))}))},addToCartDonationModule:function(){$("body").find(".donations-cta").on("click",(function(e){var t=$(e.target).attr("data-skuid");$(".donationsModule button.add-to-cart").attr("data-pid",t),$(".donationsModule button.add-to-cart").trigger("click")}))},trackOrderModule:function(){$(document).on("submit","form.return-order-form",(function(e){e.preventDefault();var t=$(this),r=$("[name=orderReturnUrl]").val(),i={};""!==$(this).find("[name=returnOrderNumber]").val()&&/^[a-zA-Z0-9]*$/.test($(this).find("[name=returnOrderNumber]").val())||(i.returnOrderNumber="please enter valid order number");""!==$(this).find("[name=returnEmailId]").val()&&/^[\w]+([\w.%\+\-]?)+[a-zA-Z0-9]@[a-zA-Z0-9\-]+(?:\.[a-zA-Z0-9\-]+)+$/.test($(this).find("[name=returnEmailId]").val())||(i.returnEmailId="please enter valid email");return""!==$(this).find("[name=returnPostalCode]").val()&&/(^\d{5}(-\d{4})?$)|(^[abceghjklmnprstvxyABCEGHJKLMNPRSTVXY]{1}\d{1}[A-Za-z]{1} *\d{1}[A-Za-z]{1}\d{1}$)/.test($(this).find("[name=returnPostalCode]").val())||(i.returnPostalCode="please enter valid postal code"),Object.keys(i).length>0?(a(t,{fields:i}),!1):(t.spinner().start(),$.ajax({url:r,type:"post",dataType:"json",data:t.serialize(),success:function(e){t.spinner().stop(),e.isValid?window.location.href=e.redirectUrl:a(t,e)}}),!1)}))}
2,vasComponentCarousel:function(){var e=$(".vasSwiper");if($(window).width()<640&&e.length)new swiperCarousel.Swiper(".vasSwiper",{modules:[swiperCarousel.Lazy,swiperCarousel.Autoplay],slidesPerView:1,spaceBetween:30,loop:!0,lazy:!0,centeredSlides:!0,autoplay:{delay:2500,disableOnInteraction:!1},breakpoints:{645:{slidesPerView:1,spaceBetween:30}}})},bindFocusOnErrorField:function(){$("body").on("click",'form button[type="submit"], form input[type="submit"], form button[name="submit"], .continue-button-right button',(function(){var e=$(this).closest("form"),t=!!$(this).parent(".continue-button-right").length;setTimeout((function(){if(t)var r=$("form input.is-invalid").first().focus();else r=e.find(".is-invalid").first();if(r.length)return setTimeout((function(){$(r)[0].scrollIntoView({behavior:"smooth",block:"center"})}),0),setTimeout((function(){t?$("form input.is-invalid").first().focus():e.find(".is-invalid").first().focus()}),500),!1}),750)})),$(".g-recaptcha").on("click",(function(){var e=$(this).closest("form"),t=!!$(this).parents(".checkout-content-right").length;setTimeout((function(){if(t)var r=$("form input.is-invalid").first().focus();else r=e.find(".is-invalid").first();if(r.length)return setTimeout((function(){$(r)[0].scrollIntoView({behavior:"smooth",block:"center"})}),0),setTimeout((function(){e.find(".is-invalid").first().focus()}),500),!1}),750)}))},removeAriaModalAttribute:function(){$(".modal").on("shown.bs.modal",(function(){$(this).removeAttr("aria-modal")}))},recommendationTabs:function(){if($(".tabBasedRecommendation.new-recommendation-carousel").length)o();else{var e=$(".reccomendation-carousel-tabs");if(!e.length)return;setTimeout((function(){var t=[],r=$(".reccomendation-carousel-panels > div");if(r.each((function(){$(this).children().length&&t.push(this.id)})),r.length<=1)return $(".reccomendation-carousel-panel-container .slottabs").hide(),void $(".reccomendation-carousel-panels").show();r.each((function(t){var r=$(this).attr("id");$(this).children().length&&$(e).append('\n <li class="nav-item" role="presentation">\n <a class="nav-link '.concat(0===t?"active":"",'" href="#').concat(r,'" data-toggle="tab" role="tab" aria-selected="false">\n ').concat($(this).find(".content-slot-title").html(),"\n </a>\n </li>\n ")),0===t&&$(this).addClass("active"),$(this).addClass("pdp-reccomendation-carousel-panel tab-pane")})),$(".reccomendation-carousel-panels").addClass("tabs-enabled"),$(".reccomendation-carousel-panels").show(),$(".tabs_common_heading").show()}),4e3)}},triggerMonetateReporting:function(){$(document).ready((function(){var e=new Set(JSON.parse(sessionStorage.getItem("monetateSentCookies")||"[]")),t=0;$("li.header-menu-nav-links").on("click mouseenter",(function(){if(!t){t++;var r=document.cookie.split(";").reduce((function(e,t){var r=i(t.trim().split("="),2),n=r[0],a=r[1];return e[n]=a,e}),{}),n=[],a=[],s=r["mt.v"];if(s){if(Object.keys(r).forEach((function(t){if(t.startsWith("monetateImpressionId_")){var i=t.replace("monetateImpressionId_","");!0!==(window.monetateExpImpressionReportingConfig||{})[i]||e.has(i)||(n.push(r[t]),a.push(i))}})),0!==n.length){var o={monetateId:s,channel:$("#monetateChannelId").val(),events:[{eventType:"monetate:record:Impressions",impressionIds:n}]};$.ajax({url:$("#monetateApiEndPointUrl").val(),type:"POST",contentType:"application/json",data:JSON.stringify(o),success:function(t){console.log("Success:",t),a.forEach((function(t){return e.add(t)})),sessionStorage.setItem("monetateSentCookies",JSON.stringify(Array.from(e)))},error:function(e,r,i){console.error("Error:",r,i),sessionStorage.removeItem("monetateSentCookies"),t=0}})}}else console.log("mt.v cookie not found â skipping request")}}))}))},bindTriggerEventToProductFinderQuiz:function(){$(document).on("click","[data-quiz-id]",(function(e){e.preventDefault();var t=$(e.currentTarget),r=$(this).data("quiz-id"),i=$(this).attr("data-url");$.ajax({url:i+r,type:"get",success:function(e){$("#quizModal-product-finder").html(e);var i=$(".quiz-modal-"+r);$(i).attr("data-finder-title",t.attr("data-finder-title")),$(i.find(".product-finder-quiz-question")[0]).removeClass("d-none");for(var n=0;n<$(i).find(".product-finder-quiz-question .product-finder-steps").length;n++){var a=$(i).find(".product-finder-quiz-question .product-finder-steps")[n];$(a).html($(a).html().replace("{0}",n+1).replace("{1}",$(i).find(".product-finder-quiz-question .product-finder-steps").length))}$("#product-finder-quiz").modal("show")},error:function(e){}})}))}}},1542:e=>{"use strict";var t=$("<div>",{class:"sr-only","aria-live":"polite","aria-atomic":"true",id:"bookmark-removed",role:"status"}).appendTo(document.body);function r(){var e=sessionStorage.getItem("wishlistPidArray");e?($(".saved-item-icon").removeClass("d-none"),(e=e.split(",")).map((function(e,t){$("[data-wid = "+e+"]").addClass("bookmarked").attr("aria-label","Remove from wishlist")}))):$(".saved-item-icon").addClass("d-none")}e.exports={getWishlistItem:r,bookmark:function(){var e=document.createElement("div");if(e.innerHTML='\n <div class="saved-item-notification">\n <div class="container">\n <div class="row">\n <div class="col-sm-7 col-8 align-items-center d-flex">\n <img class="product-image-url desktop-specific" src="" alt=""/>\n <a href="javascript:void(0)" class="mobile-specific"><svg width="16" height="20" viewBox="0 0 16 20" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path fill-rule="evenodd" clip-rule="evenodd" d="M0 0H16V20L8 16.2017L0 20V0Z" fill="#1B1C1E"/>\n </svg></a>\n <p class="desktop-specific" role="alert" aria-live="polite">'.concat(window.Resources.bookmarkaddeddesktop,'</p>\n <p class="mobile-specific" role="alert" aria-live="polite">').concat(window.Resources.bookmarkaddedmobile,'</p>\n </div>\n <div class="col-sm-5 col-4 text-right btn-wrapper">\n <a href="javascript:void(0)" class="button button--primary desktop-specific view-saved-items-button">').concat(window.Resources.bookmarkview,'</a>\n <a href="javascript:void(0)" class="mobile-specific view-saved-items-button">').concat(window.Resources.view,'</a>\n <a href="javascript:void(0)" class="remove-notification"><svg width="17" height="18" viewBox="0 0 17 18" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path fill-rule="evenodd" clip-rule="evenodd" d="M0 1.20833L0.708333 0.5L8.50715 8.29881L16.0937 0.71224L16.8021 1.42057L9.21548 9.00715L17 16.7917L16.2917 17.5L8.50715 9.71548L0.921224 17.3014L0.212891 16.593
21L7.79881 9.00715L0 1.20833Z" fill="#1b1c1e"/>\n </svg></a>\n </div>\n </div>\n </div>\n </div>'),$(document).on("wishlist:add",(function(){$(document).ready((function(){var e=localStorage.getItem("currWishlistID")||"";""!==e&&null!==e&&($('.bookmark[data-pid = "'+e+'"]').trigger("click"),$(".cart-page").length>0&&$('.product-move .move-to-wishlist[data-pid = "'+e+'"]').trigger("click"))}))})),$(".sort-filter").keydown((function(e){27==e.which&&$(".dropdown-menu-right").removeClass("show")})),$(document).trigger("wishlist:add"),$(".remove-from-wishlist").length>0){var r=$(".remove-from-wishlist").first().data("list"),i=$(".remove-from-wishlist").first().attr("product-url")||"";r&&$("body").trigger("product:wishlistView",[r,i])}$(document).on("click",".bookmark, .product-move .move-to-wishlist",(function(t){t.preventDefault();var r=t.currentTarget,i=$(r).hasClass("bookmarked"),n="";if(i){var a=$(this).attr("data-pid"),s=$(this).attr("data-removeurl")+"?pid="+a,o=$("#pageHeader").data("loggedinstatusurl");$.get(o).done((function(e){e.isAuthenticated?$.ajax({url:s,type:"post",dataType:"json",data:{pid:a,optionId:u,optionVal:d},success:function(e){e&&$("body").trigger("product:removeFromWishlist",[e.queryString,e.upc]),$(r).removeClass("bookmarked").addClass("bookkmark").attr("aria-label","Add to wishlist"),localStorage.removeItem("currWishlistID");var t=e.wishlistPidArray;sessionStorage.setItem("wishlistPidArray",t),""==sessionStorage.wishlistPidArray.split(",")[0]&&($(".saved-item-icon").addClass("d-none"),$("body").trigger("product:clearWishlist",e.queryString))},error:function(e){console.log("error sfl move")}}):($("#requestLoginModal").find(".login-info").addClass("d-none"),$("#requestLoginModal").find(".bookmark-info").removeClass("d-none"),$("#requestLoginModal").modal("show"),localStorage.setItem("currWishlistID",r.getAttribute("data-pid")))}))}else{a=$(this).attr("data-pid"),s=$(this).attr("href")+"?pid="+a;var l=$(this).attr("data-href")||$(this).attr("product-url")||"",u=$(this).closest(".product-info").find(".lineItem-options-values").data("option-id"),d=$(this).closest(".product-info").find(".lineItem-options-values").data("value-id");if(u=u||null,d=d||null,!s||!a)return;o=$("#pageHeader").data("loggedinstatusurl");$.get(o).done((function(t){t.isAuthenticated?$.ajax({url:s,type:"post",dataType:"json",data:{pid:a,optionId:u,optionVal:d},success:function(t){if(t.error)console.log(t.error);else{if(t.addedProduct){$("body").trigger("product:addToWishlist",t.addedProduct);var i="",s="";t.productDetails&&(i=t.productDetails.upc||t.productDetails.UPC||"",s=t.productDetails.category||t.productDetails.collection||"",n=t.productDetails.masterId||""),!i&&t.addedProduct&&(i=t.addedProduct.UPC||t.addedProduct.upc||"",n=t.addedProduct.masterId||""),!s&&t.addedProduct&&(s=t.addedProduct.category||t.addedProduct.collection||"");var o=Object.assign({},t.addedProduct,{upc:i,category:s,masterId:n});$("body").trigger("product:addToWishlistNew",[o,l])}var u=t.wishlistPidArray;sessionStorage.setItem("wishlistPidArray",u),""!=sessionStorage.wishlistPidArray.split(",")[0]&&$(".saved-item-icon").removeClass("d-none"),$("header").after(e),document.querySelector(".product-image-url").src=t.productDetails.imageUrl,$(".view-saved-items-button").attr("href",t.wishlistLandingUrl);var d=document.querySelector(".header").getBoundingClientRect(),c=d.y+d.height;$(".sticky-container").hasClass("active")&&(c+=document.querySelector(".sticky-container").getBoundingClientRect().height),c<1?$(".saved-item-notification").css("top","0"):$(".saved-item-notification").css("top",c),$(".remove-notification").on("click",(function(){$(".saved-item-notification").css("display","none")})),$(".saved-item-notification").css("display","block").delay(4e3).fadeOut(),$(".cart-page").length>0||$(r).addClass("bookmarked").attr("aria-label","Remove from wishlist"),localStorage.removeItem("currWishlistID")}$(".cart-page").length>0&&($(r).addClass("cart-delete-confirmation-btn"),$(r).removeClass("move-to-wishlist"),$('.cart-delete-confirmation-btn[data-pid = "'+(a||"")+'"]').trigger("click"),function(e){$.spinner().stop();var t=e.success?"alert-success":"alert-danger";
20===$(".add-to-wishlist-messages").length&&$("body").append('<div class="add-to-wishlist-messages "></div>'),$(".add-to-wishlist-messages").append('<div class="add-to-wishlist-alert text-center '+t+'">'+e.msg+"</div>"),setTimeout((function(){$(".add-to-wishlist-messages").remove()}),1500)}(t),location.reload())},error:function(e){console.log("error sfl move")}}):($("#requestLoginModal").find(".login-info").addClass("d-none"),$("#requestLoginModal").find(".bookmark-info").removeClass("d-none"),$("#requestLoginModal").modal("show"),$("#requestLoginModal").attr("data-wishlist",r.getAttribute("data-pid")))}))}})),$(document).on("click",".remove-from-wishlist",(function(e){e.preventDefault(),e.stopImmediatePropagation();var r=e.currentTarget,i=($(r).data("masterid")||$(r).attr("data-masterid")||$(r).data("pid"),$(this).attr("data-pid")),n=$(this).attr("data-url"),a=$("#pageHeader").data("loggedinstatusurl");$.get(a).done((function(e){e.isAuthenticated?$.ajax({url:n,type:"post",dataType:"json",data:{pid:i},success:function(e){if(e){$("body").trigger("product:removeFromWishlist",[e.queryString,e.upc]),$(r).removeClass("bookmarked").addClass("bookkmark").attr("aria-label","Add to wishlist"),localStorage.removeItem("currWishlistID");var i=e.wishlistPidArray;sessionStorage.setItem("wishlistPidArray",i),""==sessionStorage.wishlistPidArray.split(",")[0]&&($(".saved-item-icon").addClass("d-none"),$("body").trigger("product:clearWishlist",e.queryString)),e&&e.listIsEmpty&&$("body").trigger("product:clearWishlist",e.queryString);var n=e.wishlistPidArray.length;n=n>0?" ("+n+")":"",$(".wishlist-title .wishlist-count").html(n),$(".wishlist-title .hold_focus")[0].focus(),t.html(" "),setTimeout((function(){e.wishlistPidArray.length>0?t.html("Item Removed from saved list. Saved Items"+n):t.html("Item Removed from saved list. There are no Saved Items")}),1e3)}},error:function(e){console.log("error sfl move")}}):($("#requestLoginModal").find(".login-info").addClass("d-none"),$("#requestLoginModal").find(".bookmark-info").removeClass("d-none"),$("#requestLoginModal").modal("show"),localStorage.setItem("currWishlistID",r.getAttribute("data-pid")))}))})),$(document).on("click","[data-wishlist] #button-login",(function(){var e=$
2(this).closest("#requestLoginModal").attr("data-wishlist");localStorage.setItem("currWishlistID",e)})),$("#requestLoginModal").on("hidden.bs.modal",(function(e){$("#requestLoginModal").removeAttr("data-wishlist")}))},bookmarked:function(){r()},signout:function(){$(document).on("click",".signout-button",(function(){sessionStorage.removeItem("wishlistPidArray"),r()}))},sortByMenu:function(){var e=$(".sort-filter,.dropdown-menu-right");$(document).mouseup((function(t){e.is(t.target)||0!==e.has(t.target).length||(e.removeClass("show"),e.find(".dropdown-toggle").attr("aria-expanded","false"))})),$(document).on("click",".dropdown-toggle,.remove-sort-modal",(function(t){t.preventDefault(),e.toggleClass("show"),e.hasClass("show")?e.find(".dropdown-toggle").attr("aria-expanded","true"):e.find(".dropdown-toggle").attr("aria-expanded","false")})),$(".sort-filter").keydown((function(e){27==e.which&&($(".dropdown-menu-right").removeClass("show"),$(".dropdown-toggle").attr("aria-expanded","false"))}))}}},7094:e=>{e.exports={contentBanner:function(){var e=function(e){var t=e;t.slides.forEach((function(e){$(e).hasClass("swiper-slide-active")?($(e).find("a").attr("tabindex","0"),$(e).find("button").attr("tabindex","0")):($(e).find("a").attr("tabindex","-1"),$(e).find("button").attr("tabindex","-1"))}));var r=t.navigation.nextEl,i=t.navigation.prevEl;r&&i&&(r.setAttribute("tabindex",-!!r.classList.contains("swiper-button-disabled")),r.setAttribute("aria-disabled",r.classList.contains("swiper-button-disabled")),i.setAttribute("tabindex",-!!i.classList.contains("swiper-button-disabled")),i.setAttribute("aria-disabled",i.classList.contains("swiper-button-disabled")))};if($(".content-banner-swiper"))new swiperCarousel.Swiper(".content-banner-swiper",{modules:[swiperCarousel.Navigation,swiperCarousel.Pagination],slidesPerView:1,grabCursor:!0,watchSlidesProgress:!1,pagination:{el:".swiper-pagination",type:"bullets",clickable:!0},breakpoints:{1024:{watchSlidesProgress:!0,grabCursor:!1,navigation:{nextEl:".swiper-button-next",prevEl:".swiper-button-prev"}}},on:{init:function(){e(this)},slideChangeTransitionEnd:function(){e(this)}}})}}},3437:()=>{"use strict";function e(e){return function(e){if(Array.isArray(e))return t(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,r){if(!e)return;if("string"==typeof e)return t(e,r);var i=Object.prototype.toString.call(e).slice(8,-1);"Object"===i&&e.constructor&&(i=e.constructor.name);if("Map"===i||"Set"===i)return Array.from(e);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return t(e,r)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=new Array(t);r<t;r++)i[r]=e[r];return i}$(document).ready((function(){var t=document.querySelectorAll(".qa");if(t.length>0){var r=document.querySelectorAll(".faq-filter-container ul.categories li"),i=r[r.length-1];r.forEach((function(r){setTimeout((function(){$(r).hasClass("active")?($(r).find("a").attr("aria-selected","true"),$(r).find("a").attr("tabindex","0")):($(r).find("a").attr("aria-selected","false"),$(r).find("a").attr("tabindex","-1"))}),4e3),r.addEventListener("click",(function(){n(),r.classList.add("active");var i=r.getAttribute("rel");e(t).filter((function(e){e.getAttribute("class").includes(i)?e.style.display="block":e.style.display="none"}))}))})),i&&i.addEventListener("click",(function(){t.forEach((function(e){e.style.display="block"}))})),$(".read-more-toggle").off("click").on("click",(function(e){$(e.target).parent().toggleClass("active"),$(e.target).attr("aria-expanded","false"==$(this).attr("aria-expanded")),$(e.target).parent().next(".answer").toggleClass("d-block")}));var n=function(){r.forEach((function(e){e.removeAttribute("class"),e.classList.remove("active")}))}}}))},4691:e=>{"use strict";function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(e)}e.exports=function(e,r){if(function(e){$(e).find(".form-control.is-invalid").removeClass("is-invalid")}(e),$(".alert",e).remove(),"object"===t(r)&&r.fields&&Object.keys(r.fields).forEac
2h((function(t){if(r.fields[t]){var i=$(e).find('[name="'+t+'"]').parent().children(".invalid-feedback");i.length>0&&(Array.isArray(r[t])?i.html(r.fields[t].join("<br/>")):i.html(r.fields[t]),i.siblings(".form-control").addClass("is-invalid"))}})),r&&r.error){var i="FORM"===$(e).prop("tagName")?$(e):$(e).parents("form");$("form.login").find(".alert-message")?$("form .alert-message").append('<div class="alert alert-danger" role="alert">'+r.error.join("<br/>")+"</div>"):i.prepend('<div class="alert alert-danger" role="alert">'+r.error.join("<br/>")+"</div>")}}},4951:e=>{"use strict";var t=$(".hero-banner .lazy-video");e.exports={heroSwiperInitialize:function(){if($(".hero-swiper"))new swiperCarousel.Swiper(".hero-swiper",{modules:[swiperCarousel.Navigation],autoplay:{delay:5e3},navigation:{nextEl:".hero-slide-next",prevEl:".hero-slide-prev"}})},videoLoad:function(){t&&t.map((function(e,t){$(t).hasClass("js-s7-video")&&$(t).attr("data-hls")||(window.innerWidth>640?($(t).find("source")[0].src=$(t).attr("data-dv"),$(t)[0].load()):($(t).find("source")[0].src=$(t).attr("data-mv"),$(t)[0].load()))}))}}},1577:(e,t,r)=>{"use strict";var i=r(7094),n=r(5750),a=r(1965);r(9959);e.exports={loadHomePageSlots:function(){if($("#homePageOne").length){if(!$("#homePageOne").hasClass("homeSlotsLoaded")){$("#homePageOne").addClass("homeSlotsLoaded");var e=$("#homePageOne").data("url");e&&$.ajax({url:e,type:"get",success:function(e){$(e).insertAfter($("#homePageOne")),window.timeKitEnabled&&window.enableAlltimeKitTargets(),i.contentBanner(),n.storeLocator();var t=0,r=setInterval((function(){$(".einstein-carousel-container .swiper-slide").length?($(".einstein-carousel-container").each((function(){a.renderSwiperForEinstienCarousel(this)})),clearInterval(r)):t>5?clearInterval(r):t+=1}),1e3);$.spinner().stop()},error:function(){$.spinner().stop()}})}}}}},4629:e=>{"use strict";e.exports={plpProductCarousel:function(e){document.querySelectorAll(".plp-product-swiper").forEach((function(e){if(!$(e).hasClass("swiper-initialized")&&!$(e).parents(".relfection-carousel-container").length)new swiperCarousel.Swiper(e,{modules:[swiperCarousel.Navigation,swiperCarousel.Pagination,swiperCarousel.Scrollbar],slidesPerView:1,slidesPerGroup:1,spaceBetween:4,watchSlidesProgress:!0,a11y:{prevSlideMessage:e.closest(".plp-product-swiper").querySelector(":scope > .collections-prev"),nextSlideMessage:e.closest(".plp-product-swiper").querySelector(":scope > .collections-next")},keyboard:{enabled:!0},navigation:{nextEl:e.closest(".plp-product-swiper").querySelector(":scope > .collections-next"),prevEl:e.closest(".plp-product-swiper").querySelector(":scope > .collections-prev")},pagination:{el:e.closest(".plp-product-swiper").getElementsByClassName("swiper-pagination")[0],type:"bullets",clickable:!0},scrollbar:{el:e.closest(".plp-product-swiper").getElementsByClassName("swiper-scrollbar")[0],hide:!1},on:{init:function(){var e=this,t=!0,r=this.navigation.nextEl,i=this.navigation.prevEl;r&&i&&(r.setAttribute("tabindex",-!!r.classList.contains("swiper-button-disabled")),r.setAttribute("aria-disabled",r.classList.contains("swiper-button-disabled")),i.setAttribute("tabindex",-!!i.classList.contains("swiper-button-disabled")),i.setAttribute("aria-disabled",i.classList.contains("swiper-button-disabled"))),$(r).on("click",(function(){t=!1}));var n=this.el;n.addEventListener("mouseenter",(function(){t&&e.slideTo(1)})),n.addEventListener("mouseleave",(function(){t&&e.slideTo(0)})),n.addEventListener("blur",(function(){t&&e.slideTo(0)}));var a=new IntersectionObserver((function(e,t){e.forEach((function(e){e.isIntersecting&&$(e.target).find("img").each((function(){this.src=this.dataset.src,a.unobserve(this)}))}))}));a.observe(n)},slideChangeTransitionEnd:function(){var e=this.navigation.nextEl,t=this.navigation.prevEl;e&&t&&(e.setAttribute("tabindex",-!!e.classList.contains("swiper-button-disabled")),e.setAttribute("aria-disabled",e.classList.contains("swiper-button-disabled")),t.setAttribute("tabindex",-!!t.classList.contains("swiper-button-disabled")),t.setAttribute("aria-disabled",t.classList.contains("swiper-button-disabled")))}
2,slideChange:function(){var e=$(this.$el);setTimeout((function(){e.parent(".image-container").find(".swiper-slide-visible").first().find(".product-tile-title a").focus()}),300),$(this.$el).parent(".image-container").find(".swiper-slide")&&($(this.$el).parent(".image-container").find(".swiper-slide").find("a").attr("tabindex","-1"),$(this.$el).parent(".image-container").find(".swiper-slide").find("button").attr("tabindex","-1"),$(this.$el).parent(".image-container").find(".swiper-slide.swiper-slide-visible").find("a").attr("tabindex","0"),$(this.$el).parent(".image-container").find(".swiper-slide.swiper-slide-visible .image-container").find("a").attr("tabindex","-1"),$(this.$el).parent(".image-container").find(".swiper-slide.swiper-slide-visible").find("button").attr("tabindex","0"))}}})})),$(".badge-message").each((function(){$(this).html($(this).text().trim())}))}}},6572:(e,t,r)=>{"use strict";var i=r(6489);"undefined"==typeof window||window.Hls||(window.Hls=i);var n=640;function a(e){return!!e&&"null"!==e}function s(e,t){return!!a(e)&&(!/webm/i.test(t||"")&&!/webm|amplience/i.test(e))}function o(e){for(;e.firstChild;)e.removeChild(e.firstChild);e.removeAttribute("src")}function l(e){e.muted=!0,e.defaultMuted=!0,e.setAttribute("playsinline","playsinline");var t=e.play();t&&t.catch&&t.catch((function(){}))}function u(e,t){var r=function(e){return a(e)?e.replace(/\.m3u8(\?.*)?$/i,"").replace(/-AVS$/i,""):""}(t);r&&(o(e),e.src=r,e.load(),l(e))}function d(e,t){var r,i=((r=(t||"").match(/^(https?:\/\/[^/]+)/))?r[1]:"")+"/is/content/";"function"==typeof window.fetch?window.fetch(function(e){return e.replace("/is/content/","/is/image/").replace(/\.m3u8(\?.*)?$/i,"")+"?req=set,json"}(t)).then((function(e){return e.text()})).then((function(r){var a=function(e){try{var t=e.substring(e.indexOf("(")+1).replace(/\)\s*;?\s*$/,"").replace(/,\s*"[^"]*"\s*$/,""),r=JSON.parse(t),i=r&&r.set&&r.set.item;return i?(Array.isArray(i)?i:[i]).map((function(e){return e&&e.v})).filter((function(e){return e&&e.id&&e.dy})):[]}catch(e){return[]}}(r);(function(e,t,r){if(!t.length)return!1;var i=t.slice().sort((function(e,t){return Number(e.dy)-Number(t.dy)||Number(e.bitrate)-Number(t.bitrate)})),a=i[0],s=i[i.length-1];function u(t,i){var n=document.createElement("source");n.src=r+t.id,n.type="video/mp4",i&&n.setAttribute("media",i),e.appendChild(n)}return o(e),s!==a&&u(a,"(max-width: "+n+"px)"),u(s,""),e.load(),l(e),!0})(e,a,i)||u(e,t)})).catch((function(){u(e,t)})):u(e,t)}function c(e){if(!e.getAttribute("data-s7-init")){var t=function(e){var t=(e.getAttribute("data-engine")||"").toLowerCase();return"hls"===t||"progressive"===t?t:"hls"===window.tumiVideoEngine?"hls":"progressive"}(e),r=e.getAttribute("data-hls");if("hls"===t){if(!a(r))return;return e.setAttribute("data-s7-init","1"),o(e),e.crossOrigin="anonymous",void(i.isSupported()?function(e,t){e.loop=!1;var r=new i({abrEwmaDefaultEstimate:8e6});r.on(i.Events.MANIFEST_PARSED,(function(){l(e)})),r.loadSource(t),r.attachMedia(e),e.addEventListener("ended",(function(){e.currentTime=0,l(e)}))}(e,r):e.canPlayType("application/vnd.apple.mpegurl")&&(e.src=r,l(e)))}if(function(e){if(s(e.getAttribute("src"),e.getAttribute("type")))return!0;for(var t=e.getElementsByTagName("source"),r=0;r<t.length;r+=1)if(s(t[r].getAttribute("src"),t[r].getAttribute("type")))return!0;return!1}(e))return e.setAttribute("data-s7-init","1"),void l(e);a(r)&&(e.setAttribute("data-s7-init","1"),d(e,r))}}e.exports={init:function(){var e=document.querySelectorAll("video.js-s7-video");Array.prototype.forEach.call(e,c)}}},6036:(e,t,r)=>{"use strict";function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}var n,a=r(7174),s=$(".suggestions-wrapper").data("url"),o=!1,l=parseInt($("#searchListTimerThreshold").val(),10),u=r(217),d=r(4629).plpProductCarousel,c=r(4191).validateAddToCompare;window.handlebarHelpers=window.handlebarHelpers||r(9432);var h=r(7107);window.bookmark=window.bookmark||r(1542);$("#specialMarketCategoryUrls").length>0&&"null"!==$("#specialMarketCategoryUrls").val()&&JSON.parse($("#specialMarketCategoryUrls").val()),window.isFacetedURLEnabled;var f=[];function g(){if(f)for(var e in f)$("#"+f[e]+".card-header").addClass("active activeState"),$("#"+f[e]+".card-header").next().addClass("active")}function v(e){var t=$(e),r=[];return $(t).find(".ctnr-product-item").map((function(e){r.push({sku:$($(".ctnr-product-item")[e]).attr("data-pid")})})),r}function p(e,t,r,i){var n,a=$("#cgidName").val()?$("[name=searchCategoryUrl]").val():"search/",s=$(".selected-filter-tile .selected-tile").length;
2f=function(){var e=$(".list-of-filters.active"),t=[];e.filter((function(r){t.push($(e[r]).parent().attr("id"))})),window.activeShowMoreFacets=t;var r=$(".activeState"),i=[],n=0;for(var a in r)$(".activeState")[n]&&(i.push($(".activeState")[n].id),n+=1);return i}();var o=[],l=!1;if(t){n=$(e.currentTarget).attr("data-url"),l=$(e.currentTarget).parents(".seo-facet-link").length>0||$(e.currentTarget).hasClass("sfcc-clear-btn")||$(e.currentTarget).hasClass("clear-all reset");var u=decodeURIComponent(n.split("?")[0]);u.substring(u.indexOf(a)+a.length,u.length).split("/").filter((function(e){return!!e})).forEach((function(e){e.split("|").forEach((function(e){e&&o.push(e)}))}))}else n=r?$(e.currentTarget).attr("data-search-url"):$(".permalink").val();return"search/"!==a&&t&&(window.isFacedApplied||l||1===o.length&&2===s||0===s&&1===o.length)||$(e.currentTarget).hasClass("clear-all reset")&&$("[data-quiz-id]").length?(window.location.href=n,!0):(window.history.pushState({},document.title,n),!1)}function m(e){"undefined"!==e&&window.scrollTo({top:e,left:0,behavior:"auto"})}function y(e){return(new DOMParser).parseFromString(e,"text/html").documentElement.textContent}function E(e,t){$(e).each((function(){$(this).html(t)}))}function b(e,t,r){$(e).each((function(){$(this).attr(t,r)}))}function T(){var e=$("#gridBreakerPositions").val();if("null"!==e&&void 0!==e){var t=JSON.parse(e);window.gridBreakerSlots||(window.gridBreakerSlots={},gridBreakerSlots.slot1Ele=document.querySelectorAll(".slot-1"),gridBreakerSlots.slot2Ele=document.querySelectorAll(".slot-2"),gridBreakerSlots.slot3Ele=document.querySelectorAll(".slot-3"),gridBreakerSlots.slot4Ele=document.querySelectorAll(".slot-4"),gridBreakerSlots.slot5Ele=document.querySelectorAll(".slot-5"),gridBreakerSlots.slot6Ele=document.querySelectorAll(".slot-6"),gridBreakerSlots.slot7Ele=document.querySelectorAll(".slot-7")),gridBreakerSlots.slot1=0,gridBreakerSlots.slot2=0,gridBreakerSlots.slot3=0,gridBreakerSlots.slot4=0,gridBreakerSlots.slot5=0,gridBreakerSlots.slot6=0,gridBreakerSlots.slot7=0;var r=gridBreakerSlots;Object.keys(t).forEach((function(e){var i=t[e].ID.split("-")[t[e].ID.split("-").length-1],n=r["slot".concat(i,"Ele")][r["slot".concat(i)]];n&&function(e,i,n){r["slot".concat(n)]+=1;var a=parseInt(t[e].Position,10)-1,s=parseInt(t[e].minItems,10)-1||0;a>=0&&$(".product-grid .temp_"+s).length&&$(".product-grid .temp_"+a).length?($(".product-grid .temp_"+a).after(i),i.classList.add("active")):a<0&&$(".product-grid .temp_0").length&&$(".product-grid .temp_"+s).length&&($(".product-grid .temp_0").before(i),i.classList.add("active")),i.getElementsByTagName("video").length&&i.getElementsByTagName("video")[0].play()}(e,n,i)}))}}function S(e,t){var r=e.find(t);$(t).empty().html(r.html())}function w(e){$(".refinement.active").each((function(){$(this).removeClass("active");var t=e.find("."+$(this)[0].className.replace(/ /g,"."));t.addClass("active"),t.find("button.title").attr("aria-expanded","true")})),S(e,".refinements")}function A(e){var t=$("<div>").append($(e)),r={".refinements":w};[".grid-header",".header-bar",".header.page-title",".product-grid",".show-more",".filter-bar",".selected-filter-wrapper",".search-results-count-desktop",".sfcc-filter",".dropdown-menu.dropdown-menu-right",".dropdown-toggle.sfcc"].forEach((function(e){S(t,e)})),Object.keys(r).forEach((function(e){r[e](t)}))}function L(e,t){var r=e.data("url");$.ajax({url:r,method:"GET",success:function(e){t.append(e)},error:function(){console.log("error")}})}function I(e){var t=$(".suggestions .item");0===t.filter(".selected").length?(t.first().addClass("selected"),$("input.search-field").each((function(){$(this).attr("aria-activedescendant",t.first()[0].id)}))):t.each((function(r){var i=r+e;return!$(this).hasClass("selected")||($(this).removeClass("selected"),$(this).removeAttr("aria-selected"),0!==t.eq(i).length?(t.eq(i).addClass("selected"),t.eq(i).attr("aria-selected",!0),$(this).removeProp("aria-selected"),$("input.search-field").each((function(){$(this).attr("aria-activedescendant",t.eq(i)[0].id)}))):(t.first().addClass("selected"),t.first().attr("aria-selected",!0),$("input.search-field").each((function(){$(this).attr("aria-activedescendant",t.first()[0].id)}))),!1)}))}function k(e){var t=".search-mobile button.",r="fa-search",i="fa-close";"close"===e?$(t+r).removeClass(r).addClass(i).attr("type","button"):$(t+i).removeClass(i).addClass(r).attr("type","submit")}function R(e){return $(e).siblings(".suggestions-wrapper")}function D(e){return!!$(e).closest(".search-mobile").length}function C(e){var t,r,n,a,s,l=R(this).empty(),u=[".trending-items-list"],d=$(e).find(".search_count").html();if($(".search-count").html(" "),setTimeout((function(){$(".search-count").html(d)}),1e3),o||u.push(".popular-categories .listofcategories"),u.forEach((function(e){$(e).empty()})),$.spinner().stop(),$("#searchModal").spinner().stop(),"object"!==i(e)){var c=$("<div>").append($(e));[".view-all-results"].forEach((function(e){var t=c.find(e);$(e).replaceWith(t)})),function(e,t){var r=$(e),i=[".trending-items-list"];
2t||i.push(".popular-categories .listofcategories"),i.forEach((function(e){S(r,e)}))}(e,o);var h=$(".trending-items-list"),f=$(".popular-categories"),g=$(".trending-title"),v=$("input.search-field").val().trim(),p=g.data("noresponse"),m=g.data("update"),y=g.data("loading");if(!v)return f.show(),g.find(".trending-title-text").text(y),void $(".view-all-results.button").addClass("d-none");f.show(),$(".view-all-results.button").removeClass("d-none"),g.find(".trending-title-text").text(m+' "'+v+'"'),0===h.children().length&&($(".view-all-results.button").addClass("d-none"),g.find(".trending-title-text").text(p+' "'+v+'"')),0===$(".listofcategories a").length&&f.hide(),o=!1,$(this).siblings(".reset-button").addClass("d-sm-block"),D(t=this)&&(s=(n=$(t)).offset().top,r=n.outerHeight(),(a=R(t).find(".suggestions")).css("top",s+r),handleMoreContentBelowIcon(t),a.scroll((function(){handleMoreContentBelowIcon(this)}))),D(this)&&(k("close"),function(e){D(e)&&($("body").addClass("modal-open"),$("header").siblings().attr("aria-hidden","true"),R(e).find(".suggestions").addClass("modal"))}(this));var E=$(".suggestions .item");$(E).length?$("input.search-field").attr("aria-describedby","search-result-count"):$("input.search-field").removeAttr("aria-describedby"),$(".view-all-results.button").removeClass("d-none")}else l.hide()}function P(e){if($(e).val().length>=3||window.reflektion_query_keyphrase_value){$("#searchModal .modal-content").spinner().start();var t=$(e).val().length>=3?encodeURIComponent($(e).val()):window.reflektion_query_keyphrase_value;"true"===$("[name=PFASLocation]").val()&&(t+="&PFAS=true"),$.ajax({context:e,url:s+t,method:"GET",success:C,error:function(){$.spinner().stop()}})}else[".popular-categories .listofcategories",".trending-items-list"].forEach((function(e){$(e).empty()})),k("search"),$(e).siblings(".reset-button").removeClass("d-sm-block"),$("body").removeClass("modal-open"),$("header").siblings().attr("aria-hidden","false"),$(".suggestions").removeClass("modal"),R(e).empty()}function _(){var e=$(".grid-footer"),t=(e.attr("data-page-number"),$("#lazyLoadThreshold").val());if(e.length){new IntersectionObserver((function(r){var i=parseInt(e.attr("data-page-size"),10),n=parseInt(e.attr("data-default-size"),10);parseInt(i/n,10)<parseInt(t,10)&&r[0].isIntersecting&&$(".show-more button").trigger("click")}),{rootMargin:"0px",threshold:0}).observe(e[0])}}e.exports={getHandleBarTemplate:function(e){if(e){if("true"===$("[name=EnablePromotionalMessaging]").val()){var t=[];e.content.product.value.forEach((function(e){e&&(t.includes(e.sku)||t.push(e.sku),e.swatch_list&&e.swatch_list.length>0&&e.swatch_list.forEach((function(e){var r=e.product_url.split("/"),i=r[r.indexOf("p")+1].split("-"),n=i[i.length-1];e&&!t.includes(n)&&t.push(n)})),e.swatch_list_us&&e.swatch_list_us.length>0&&e.swatch_list_us.forEach((function(e){var r=e.product_url.split("/"),i=r[r.indexOf("p")+1].split("-"),n=i[i.length-1];e&&!t.includes(n)&&t.push(n)})),e.swatch_list_ca&&e.swatch_list_ca.length>0&&e.swatch_list_ca.forEach((function(e){var r=e.product_url.split("/"),i=r[r.indexOf("p")+1].split("-"),n=i[i.length-1];e&&!t.includes(n)&&t.push(n)})))})),function(e){$.ajax({url:$("[name=tilePromotionInfoUrl]").val()+"?productIds="+e,method:"GET",success:function(e){if(e.promotionInfo)for(var t=0;t<e.promotionInfo.length;t++){var r=e.promotionInfo[t];r&&(E($(".tile-promotion-msg_"+r.productId),r.appliedPromotionCallout),E($(".tile-promotion-price_"+r.productId),r.finalDiscountPrice),r.hasDiscount?r.salePrice===r.listPrice?$(".tile-promotion-price_"+r.productId).parents(".price").find(".sales").removeClass("d-none").addClass("strike-through-price"):$(".tile-promotion-price_"+r.productId).parents(".price").find(".sales").addClass("d-none").removeClass("strike-through-price"):$(".tile-promotion-price_"+r.productId).parents(".price").find(".sales").removeClass("d-none").removeClass("strike-through-price"),b($("[data-swatch-sku="+r.productId+"]"),"data-hasdiscount",r.hasDiscount||!1),b($("[data-swatch-sku="+r.productId+"]"),"data-finaldiscountprice",r.finalDiscountPrice||""),b($("[data-swatch-sku="+r.productId+"]"),"data-promotionmsg",r.appliedPromotionCallout||""))}},error:function(){console.error()}})}(t)}var r=handlebarHelpers.transformTileImages(e);r&&(e=r),handlebarHelpers.getHandlebarHelpers();var i=$("#currentCategoryId").val();e=updateFilters(e,i),e=mergeFacetFilters(e);var n=$("#customizeBadgeSKUs");if(n.length>0&&window.badgeABtestActive){var a=JSON.parse(n.val());Array.isArray(a)&&a.length>0?e=updateCustomizeBadge(e,JSON.parse(n.val())):Object.keys(a).length>0&&(e=updateCustomizeBadge(e,Object.values(a)))}e.facetedRefinementMapping=window.facetedRefinementMapping?window.facetedRefinementMapping:{};var s=Handlebars.compile($("#producttile-handlebar").html())(e);$(".productTileTemplates").append(s);var o=Handlebars.compile($("#filter-template").html())(e);$(".refinements").html(o),$(".productTileTemplates").find('[role="radiogroup"]').each((function(e,t){new u(t)})),d()}},getCompareSuggestion:function(){var e=window.enrichedEinsteinCompareSuggestionsResults?window.enrichedEinsteinCompareSuggestionsResults:window.rfkCompareSuggestionsResults;if(e){handlebarHelpers.getHandlebarHelpers();var t=Handlebars.compile($("#compare-products-suggestion").html())(e);$(".compare-products-suggestion").append(t)}},gridGenerator:T,updateToggleShowMoreFiler:function(){$(document).on("click keypress",".isShowMoreLink",(function(e){var t=$(e.target);"click"!==e.type&&("keypress"!==e.type||13!==e.keyCode&&32!==e.keyCode)||(e.stopPropagation(),e.preventDefault(),t.parent(".isLinkVisible").parent(".list-of-filters").addClass("active").find(".hideShowMore").css("display","inline-block"),t.closest(".isLinkVisible").closest(".list-of-filters").addClass("active").find(".hideShowMore").first().find("label").focus())})),$(document).on("click keypress",".isShowLessLink",(function(e){var t=$(e.target);"click"!==e.type&&("keypress"!==e.type||13!==e.keyCode&&32!==e.keyCode)||(e.stopPropagation(),e.preventDefault(),t.parent(".isLinkVisible").parent(".list-of-filters").removeClass("active").find(".hideShowMore").css("display","none"),t.closest(".isLinkVisible").find(".isShowMoreLink").focus())}))},loadSFCCSearch:function(){$('form[name="simpleSearch"]').submit((function(e){var t=$(".suggestions .item");0!==t.filter(".selected").length&&(e.preventDefault(),t.filter(".selected").find("a")[0].click())}));
2var e=$(".trending-title").attr("data-loading"),t=$(".popular-title").attr("data-loading");$(".trending-title").find(".trending-title-text").text(e),$(".popular-title").text(t),$("input.search-field").each((function(){var r=a(P,300),i=$(".trending-title").attr("data-update"),n=$(".popular-title").attr("data-update");$(this).on("keyup focus",(function(a){var s=$(this).val();switch(s?($(".trending-title").attr({role:"status","aria-live":"assertive"}).find(".trending-title-text").html("".concat(i,' "').concat(s,'"')),$(".popular-title").text(n)):($(".trending-title").find(".trending-title-text").text(e),$(".popular-title").text(t)),a.which){case 40:I(1),a.preventDefault();break;case 38:I(-1),a.preventDefault();break;default:r(this,a)}}))}))},updatingComparePidsInLocalStorage:function(){var e=$(".product-comparison").attr("data-pids"),t=$("#cgidOrQ").val();void 0!==e&&"null"!==e&&void 0!==t&&"null"!==t&&localStorage.setItem("compare_"+t,e)},filter:function(){$(".container").on("click","button.filter-results",(function(){$(".refinement-bar, .modal-background").show(),$(".refinement-bar").siblings().attr("aria-hidden",!0),$(".refinement-bar").closest(".row").siblings().attr("aria-hidden",!0),$(".refinement-bar").closest(".tab-pane.active").siblings().attr("aria-hidden",!0),$(".refinement-bar").closest(".container.search-results").siblings().attr("aria-hidden",!0),$(".refinement-bar .close").focus()}))},closeRefinements:function(){$(".container").on("click",".refinement-bar button.close, .modal-background",(function(){$(".refinement-bar, .modal-background").hide(),$(".refinement-bar").siblings().attr("aria-hidden",!1),$(".refinement-bar").closest(".row").siblings().attr("aria-hidden",!1),$(".refinement-bar").closest(".tab-pane.active").siblings().attr("aria-hidden",!1),$(".refinement-bar").closest(".container.search-results").siblings().attr("aria-hidden",!1),$(".btn.filter-results").focus()}))},resize:function(){$(window).resize((function(){$(".refinement-bar, .modal-background").hide(),$(".refinement-bar").siblings().attr("aria-hidden",!1),$(".refinement-bar").closest(".row").siblings().attr("aria-hidden",!1),$(".refinement-bar").closest(".tab-pane.active").siblings().attr("aria-hidden",!1),$(".refinement-bar").closest(".container.search-results").siblings().attr("aria-hidden",!1)}))},sort:function(){$(".container").on("change","[name=sort-order]",(function(e){e.preventDefault(),$(this).trigger("search:sort",this.value),p(e,!1,!0)||($.spinner().start(),$.ajax({url:this.value,data:{selectedUrl:this.value},method:"GET",success:function(e){A(e),m(0),$(".sort-filter .dropdown-toggle").trigger("click");var t=v(e);$("body").trigger("product:monetateQlistItemView",{items:t,reset:!0}),$("body").trigger("product:listItemView",{items:t,reset:!0}),T(),_(),g(),d(),$.spinner().stop(),c()},error:function(){$.spinner().stop()}}))}))},sfccLoad:function(){window.pageContext&&"compare"===window.pageContext.type&&($(document).ready((function(){$(".product-comparison .products-detail").find(".alternateViewsimageslot").each((function(e){var t=$(".alternateViewsimage").val(),r=$(this),i="",n=$($("div.image-container")[e]).attr("data-alt-images"),a="<div class='alt-image-container'>";if(void 0!==n&&""!==n&&"null"!==n){var s=n.split(","),o="null"!==$("#s7PresetsPlp").val()?$("#s7PresetsPlp").val():"";if(s.length>0){if(i+="<div class='product-tile'><div class='image-container'><div class=\"primary-image ".concat(t,'" data-id="').concat(t,'">\n <img class="tile-image active" src="').concat(s[0]).concat(o,'" alt="').concat(s[0]).concat(o,'" data-src="').concat(s[0]).concat(o,'" data-master-image="').concat(s[0]).concat(o,'" title=""/>\n <div class="dark-overlay-plp"></div>'),s.length-1>0){for(i+='<div class="image-wrapper">',e=0;e<s.length;e+=1)i+='<div class="image-carousel" data-swatch-id="span_'.concat(e,'" data-final-image="').concat(s[e]).concat(o,'"></div>');for(e=0;e<3;e+=1)a+='<div class="image-wrapper"><img class="alternativ-image" src=\''.concat(s[e]).concat(o,"' alt=\"").concat(s[e]).concat(o,'"/><div class="dark-overlay-plp"></div></div>');for(i+='</div><div class="pagination">',e=0;e<s.length;e+=1)i+='<span class="span_'.concat(e,'" class=""></span>');i+="</div>"}i+="</div></div></div>"}}else i+="<div class='product-tile no-alt-image'><div class='image-container'><div class=\"primary-image ".concat(t,'" data-id="').concat(t,'">\n <img class="tile-image active" src="https://cdn.media.amplience.net/i/tumi/image?w=420&h=580" data-src="" data-master-image="" alt="tile image" title=""/>\n <div class="dark-overlay-plp"></div>\n <div class="image-wrapper"></div>\n <div class="pagination"></div>\n </div></div></div>'),a+='<div class="image-wrapper"><img class="alternativ-image" src=\'https://cdn.media.amplience.net/i/tumi/image?w=420&h=580\' alt="https://cdn.media.amplience.net/i/tumi/image?w=420&h=580"/><div class="dark-overlay-plp"></div></div>';a+="</div>",r.find(".alternate-image-swiper-wrapper").html(i),r.find(".mobile-alt-images").html(a)}));
2var e=$("#pidsLength").val();1===parseInt(e,10)&&$(".remove-item").hide()})),h.updateMouseMove())},sfccLazyLoad:function(){_()},showMore:function(){$(".container").on("click",".show-more button",(function(e){e.stopPropagation();var t=$(this).data("url");e.preventDefault(),$(this).trigger("search:showMore",e),$.spinner().start(),$.ajax({url:t,data:{selectedUrl:t},method:"GET",success:function(t){var r=$("<div>").append($(t));$(".grid-footer").replaceWith(r.find(".grid-footer")),$(".product-grid.productTileTemplates").append(r.find(".product-grid.productTileTemplates").children());var i=v(t);$("body").trigger("product:monetateQlistItemView",{items:i,reset:!1}),$("body").trigger("product:listItemView",{items:i,reset:!1});var n=function(e){var t=$(e),r=[];return $(t).find("[data-itemgajson]").map((function(e){var i=JSON.parse($($(t).find("[data-itemgajson]")[e]).attr("data-itemgajson"))[0];r.push(i)})),r}(t);$("body").trigger("product:viewItemList",[n]),function(e){$("<div>").append($(e)).find(".grid-footer").data("sort-options").options.forEach((function(e){$(".sort-filter .form-check-input."+e.id).val(e.url),$(".sort-filter .form-check-input."+e.id).data("search-url",e.searchBaseUrl)}))}(t);p(e,!1,!1);_(),T(),g(),d(),$.spinner().stop(),c()},error:function(){$.spinner().stop()}})}))},applyFilter:function(){$(".container").on("click",".refinements li input.sfcc-input, .refinements li a input.sfcc-input, .refinement-bar button.reset, .selected-filter-container button.reset, .selected-filter-container .selected-tile .sfcc-clear-btn, .filter-value button, .swatch-filter button",(function(e){e.preventDefault(),e.stopPropagation();var t=$(this).hasClass("reset")||$(this).hasClass("clear-all"),r=$(this).hasClass("sfcc-clear-btn"),i="";if(t)i="All filters cleared";else if(r){var n=$(this).attr("aria-label");if(n&&0===n.toLowerCase().indexOf("clear "))i=n.substring(6)+" cleared";else{var a=$(this).attr("data-name");i=a?a+" filter cleared":"Filter cleared"}}i&&$("<div>",{class:"sr-only",role:"alert","aria-live":"polite",text:i}).appendTo("body").delay(5e3).fadeOut((function(){$(this).remove()})),p(e,!0)||($.spinner().start(),$(this).trigger("search:filter",e),$.ajax({url:$(this).data("href"),data:{page:$(".grid-footer").data("page-number"),selectedUrl:$(this).data("href")},method:"GET",success:function(e){A(e),m(0);var t=v(e);$("body").trigger("product:monetateQlistItemView",{items:t,reset:!0}),$("body").trigger("product:listItemView",{items:t,reset:!0}),_(),T(),g(),$(".selected-filter-container").hasClass("active")||$(".selected-filter-container").addClass("active"),d(),$.spinner().stop(),c(),i&&$("<div>",{class:"sr-only",role:"alert","aria-live":"polite",text:i}).appendTo("body").delay(5e3).fadeOut((function(){$(this).remove()}))},error:function(){$.spinner().stop()}}))})),$(".refinement-bar").on("click",".refinements .card-header",(function(){$(this).toggleClass("active activeState"),$(this).closest(".refinement").find(".card-body").toggleClass("active"),$(this).closest(".refinement").find(".card-body").hasClass("active")?$(this).closest(".refinement").find(".card-header").find("button.title").attr("aria-expanded","true"):$(this).closest(".refinement").find(".card-header").find("button.title").attr("aria-expanded","false")})),$(".search-results").on("click",".close-filters",(function(){$(".refinement-bar.active").removeClass("active"),$(".btn-filter-text").text(window.Resources.showFilters),$(".selected-filter-container").addClass("active")}))},showContentTab:function(){$(".container").on("click",".content-search",(function(){""===$("#content-search-results").html()&&L($(this),$("#content-search-results"))})),$(".container").on("click",".show-more-content button",(function(){L($(this),$("#content-search-results")),$(".show-more-content").remove()}))},searchFormSubmit:function(){$("#siteSearchForm").on("submit",(function(e){var t=$(".search-field-reflektion").val();if(t.indexOf("@")>-1)return!1;if(t){var r=this.getAttribute("data-redirect")||"";return r&&(e.preventDefault(),window.location.href=r),!0}return!1}))},openSearchTile:function(){$(document).on("click",".search-products",(function(e){e.preventDefault(),$("#searchModal").modal("show"),window.defaultSearchSuggestionData=null,P($("input.search-field")),$("#searchModal").on("shown.bs.modal",(function(){$(".search-field-reflektion").trigger("focus")})),$("#searchModal").on("hidden.bs.modal",(function(){$(".search-field").val()!==$(".search-field")[0].defaultValue&&($(".search-field").val(""),$(".clear-search-text").hide(),$(".search-field").trigger("keyup")),$(".search-products").focus()}))}))},onHoverSFCCSearchList:function(){$(document).on("mouseover",'.popular-categories .listofcategories li a:not(".content-available")',(function(e){var t=this;e.preventDefault(),clearTimeout(n),n=setTimeout((function(){var e=$
2(t),r=$(".trending-title").attr("data-update");if(e.attr("data-response")){o=!0,C(e.attr("data-response"));var i=e.html();i&&$(".trending-title").attr({role:"status","aria-live":"assertive"}).find(".trending-title-text").html("<span>".concat(r,' "').concat(i,'"</span>'))}else $(t).attr("data-search-href")&&$.ajax({url:$(t).attr("data-search-href"),method:"GET",success:function(t){o=!0,C(t);var i=e.html();e.attr("data-response",t),i&&$(".trending-title").attr({role:"status","aria-live":"assertive"}).find(".trending-title-text").html("<span>".concat(r,' "').concat(i,'"</span>'))},error:function(){$.spinner().stop()}})}),l)}))},onHoverSearchList:function(){$(document).on("mouseover",'.listofcategories a:not(".no-ajax")',(function(e){e.preventDefault();var t=$(this).text();$(this);t=t.toString()}))},onHoverSearchListWithoutAjax:function(){$(document).on("mouseover",".listofcategories a.no-ajax",(function(e){e.preventDefault();var t=$(this).text(),r=$(".trending-title").attr("data-update"),i=JSON.parse($(this).attr("data-pjson")),n=$("#searchtrending-handlebar").html(),a=Handlebars.compile(n)(i);if($(".trending-items .trending-items-list").html(a),$(".trending-title").find(".trending-title-text").text(r+' "'+t+'"'),$(".trending-title").attr("data-searchData",t),$(".trending-title").attr("data-autocomplete",i.autocomplete),i.total_item>i.n_item){$(".view-all-results").removeClass("d-none");var s=$(".view-all-results").attr("data-querystring");s=s+"?q="+t,$(".view-all-results").attr("href",s)}}))},clearSearchField:function(){$(document).on("click keydown",".clear-search-text",(function(e){if("click"===e.type||"keydown"===e.type&&"Enter"===e.key){var t=$(".trending-title").attr("data-loading"),r=$(".popular-title").attr("data-loading");$(".search-field").length&&$(".search-field").val(""),$(".search-products").trigger("click"),$(".popular-categories .listofcategories").empty(),$(".trending-items .trending-items-list").empty(),$(".trending-title").find(".trending-title-text").text(t),$(".popular-title").text(r),$("<div>",{class:"sr-only",role:"alert","aria-live":"polite",text:"Search field cleared"}).appendTo(".site-search").delay(5e3).fadeOut(),$(this).hide()}})),$(".search-input .search-field").keyup((function(){$(".clear-search-text").show()}))}
2,onLoad:function(){var e=$("#isFirstFilterExposed").val(),t=$("#abTestForBadge").val(),r=$("#customizeBadgeSKUs").val();if("true"!==e||$($(".refinement-bar .refinements .card-header")[0]).hasClass("active activeState")||$($(".refinement-bar .refinements .card-header")[0]).trigger("click"),window.facetedRefinementMapping){var i={};Object.keys(window.facetedRefinementMapping).forEach((function(e){i[y(e)]={},Object.keys(window.facetedRefinementMapping[e]).forEach((function(t){i[y(e)][y(t)]=y(window.facetedRefinementMapping[e][t])}))})),window.facetedRefinementMapping=i}window.dataLayer&&window.dataLayer[0]&&window.dataLayer[0].ab_tests&&window.dataLayer[0].ab_tests.length>0&&(window.dataLayer[0].ab_tests.filter((function(e){return e.abTestID===t&&"Experiment"===e.isControlOrExperiment})).length>0&&r&&(window.badgeABtestActive=!0,(Array.isArray(JSON.parse(r))?JSON.parse(r):Object.values(JSON.parse(r))).forEach((function(e){var t=$(".ctnr-product-item[data-pid="+e+"]");t.length>0&&(t.find(".badge-message").html(window.customizedProductBadge),$(".travelLiesure").length>0&&$(".travelLiesure").hasClass("d-none")&&$(".travelLiesure").removeClass("d-none"))}))));d()}
2,render19DegreeBuyingGuidePLP:function(){var e=$(".buying-guide-component-plp").attr("data-href");e&&"true"===$(".buying-guide-component-plp").attr("data-render")&&$.ajax({url:e,type:"get",success:function(e){$(".buying-guide-component-plp").html(e),$(".product-buying-guide-tile .buying-guide-color-attribute").on("click",(function(){$(this).parents(".wrap-items").find("button").removeClass("selected focus"),$(this).addClass("selected focus");var e=$(this).attr("data-mainproductimage"),t=$(this).parents(".19-degree-buying-guide-lineitem"),r=$(this).attr("data-attr-value"),i=t.find(".product-buying-guide-tile").attr("produrls")?JSON.parse(t.find(".product-buying-guide-tile").attr("produrls")):{};t.find(".product-buying-guide-image a").attr("href",i[r]),t.find(".product-buying-guide-image img").attr("src",e)}));var t=0,r=0;function i(e,t){var r=$(e),i=$(t),n=0;i.each((function(){$(this).height("auto")})),setTimeout((function(){r.each((function(){var e=$(this).find(t);n=Math.max(n,$(e).height())})),r.each((function(){var e=$
2(this).find(t);$(e).height(n)}))}),10)}$(window).on("resize",(function(){r=$(window).width(),t!=r&&(i(".product-buying-guide.collectionName-container",".product-value.collectionName"),i(".product-buying-guide.primaryMaterial-container",".primaryMaterial-height"),i(".product-buying-guide.weight-container",".product-value.weight"),i(".product-buying-guide.sizesOffered-container",".product-value.sizesOffered"),i(".product-buying-guide.durability-container",".product-value.durability"),i(".product-buying-guide.expandable-container",".product-value.expandable"),i(".product-buying-guide.price-container",".product-value.price"),t=$(window).width())})).resize()},error:function(e){throw e}})}}},3863:()=>{function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(t,r){for(var i=0;i<r.length;i++){var n=r[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,(a=n.key,s=void 0,s=function(t,r){if("object"!==e(t)||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,r||"default");if("object"!==e(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(a,"string"),"symbol"===e(s)?s:String(s)),n)}var a,s}function r(t){var r=a();return function(){var i,n=o(t);if(r){var a=o(this).constructor;i=Reflect.construct(n,arguments,a)}else i=n.apply(this,arguments);return function(t,r){if(r&&("object"===e(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(t)}(this,i)}}function i(e){var t="function"==typeof Map?new Map:void 0;return i=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,i)}function i(){return n(e,arguments,o(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),s(i,e)},i(e)}function n(e,t,r){return n=a()?Reflect.construct.bind():function(e,t,r){var i=[null];i.push.apply(i,t);var n=new(Function.bind.apply(e,i));return r&&s(n,r.prototype),n},n.apply(null,arguments)}function a(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}
2function s(e,t){return s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},s(e,t)}function o(e){return o=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},o(e)}var l=document.createElement("template");l.innerHTML='\n <link rel="stylesheet" href="../css/store-component.css" />\n\n <div class="row store-info">\n <div class="col-md-12 col-sm-6 col-12">\n <div class="store-image">\n <img src="" class="img-fluid" alt="x" />\n </div>\n </div>\n\n <div class="col-md-12 col-sm-6 col-12">\n <div class="store-address">\n <p class="title">\n <strong></strong>\n <a href="#"></a>\n </p>\n </div>\n <div class="store-cta">\n <button class="btn button__primary">\n </button>\n </div>\n </div>\n </div>';var u=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t)}(u,e);var i,n,a,o=r(u);function u(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,u),(e=o.call(this)).attachShadow({mode:"open"}),e.shadowRoot.appendChild(l.content.cloneNode(!0)),e.shadowRoot.querySelector(".store-image img").src=e.getAttribute("storeImage"),e.shadowRoot.querySelector(".title strong").innerText=e.getAttribute("storeTitle"),e.shadowRoot.querySelector(".title a").innerText=e.getAttribute("storeChangeText"),e.shadowRoot.querySelector(".title a").href=e.getAttribute("storeChangeLink");var t=document.createElement("p");t.innerText=e.getAttribute("addressLineOne"),e.shadowRoot.querySelector(".store-address").appendChild(t);var r=document.createElement("p");r.innerText=e.getAttribute("addressLineTwo"),e.shadowRoot.querySelector(".store-address").appendChild(r);var i=document.createElement("a");return i.setAttribute("href","tel:".concat(e.getAttribute("phoneNo"))),i.innerText=e.getAttribute("phoneNo"),e.shadowRoot.querySelector(".store-address").appendChild(i),e.shadowRoot.querySelector(".store-cta button").innerText=e.getAttribute("btnText"),e}return i=u,n&&t(i.prototype,n),a&&t(i,a),Object.defineProperty(i,"prototype",{writable:!1}),i}(i(HTMLElement));customElements.define("store-info",u)},9530:e=>{"use strict";e.exports=function(){if($(".sub-hero-category").length>0)new swiperCarousel.Swiper(".sub-hero-category",{modules:[swiperCarousel.Navigation,swiperCarousel.Lazy,swiperCarousel.FreeMode],slidesPerView:1.3,spaceBetween:20,lazy:!0,watchSlidesProgress:!0,freeMode:!0,breakpoints:{645:{slidesPerView:3.2,spaceBetween:20},1024:{slidesPerView:4,spaceBetween:20,slidesPerGroup:4,navigation:{nextEl:".sub-categories-next",prevEl:".sub-categories-prev"}}},on:{init:function(){document.querySelectorAll(".sub-hero-component .swiper-slide").forEach((function(e){$(e).find("a").first().attr("tabindex","-1"),$(e).hasClass("swiper-slide-visible")?($(e).find("a:not(:first)").attr("tabindex","0"),$(e).find("button").attr("tabindex","0")):($(e).find("a:not(:first)").attr("tabindex","-1"),$(e).find("button").attr("tabindex","-1"))}))},slideChangeTransitionEnd:function(){var e=this.navigation.nextEl,t=this.navigation.prevEl;e&&t&&(e.setAttribute("tabindex",-!!e.classList.contains("swiper-button-disabled")),e.setAttribute("aria-disabled",e.classList.contains("swiper-button-disabled")),t.setAttribute("tabindex",-!!t.classList.contains("swiper-button-disabled")),t.setAttribute("aria-disabled",t.classList.contains("swiper-button-disabled")))}
2,slideChange:function(){var e=$(this.$el);setTimeout((function(){e.find(".swiper-slide.swiper-slide-visible").first().attr("tabindex","-1").focus().focus()}),300),$(this.$el).find(".swiper-slide")&&($(this.$el).find(".swiper-slide").find("a:not(:first)").first().attr("tabindex","-1"),$(this.$el).find(".swiper-slide").find("a:not(:first)").attr("tabindex","-1"),$(this.$el).find(".swiper-slide.swiper-slide-visible").find("a:not(:first)").attr("tabindex","0"))}}});if($(".sub-hero-collection").length>0)new swiperCarousel.Swiper(".sub-hero-collection",{modules:[swiperCarousel.Navigation,swiperCarousel.Lazy,swiperCarousel.FreeMode],slidesPerView:1.3,spaceBetween:20,lazy:!0,watchSlidesProgress:!0,freeMode:!0,breakpoints:{645:{slidesPerView:3.2,spaceBetween:20},1024:{slidesPerView:4,spaceBetween:20,slidesPerGroup:4,navigation:{nextEl:".sub-collections-next",prevEl:".sub-collections-prev"}}},on:{init:function(){document.querySelectorAll(".sub-hero-component .swiper-slide").forEach((function(e){$(e).hasClass("swiper-slide-visible")?($(e).find("a:not(:first)").attr("tabindex","0"),$(e).find("button").attr("tabindex","0")):($(e).find("a:not(:first)").attr("tabindex","-1"),$(e).find("button").attr("tabindex","-1"))}))},slideChangeTransitionEnd:function(){var e=this.navigation.nextEl,t=this.navigation.prevEl;e&&t&&(e.setAttribute("tabindex",-!!e.classList.contains("swiper-button-disabled")),e.setAttribute("aria-disabled",e.classList.contains("swiper-button-disabled")),t.setAttribute("tabindex",-!!t.classList.contains("swiper-button-disabled")),t.setAttribute("aria-disabled",t.classList.contains("swiper-button-disabled")))}
2,slideChange:function(){var e=$(this.$el);setTimeout((function(){e.find(".swiper-slide.swiper-slide-visible").first().attr("tabindex","-1").focus().focus()}),300),$(this.$el).find(".swiper-slide")&&($(this.$el).find(".swiper-slide").find("a:not(:first)").attr("tabindex","-1"),$(this.$el).find(".swiper-slide.swiper-slide-visible").find("a:not(:first)").attr("tabindex","0"))}}});var e=document.querySelectorAll("#myTabContent");if(e.length){var t=new IntersectionObserver((function(e,t){e.forEach((function(e){if(e.isIntersecting){document.querySelectorAll(".sub-hero-category .swiper-slide").forEach((function(e){$(e).hasClass("swiper-slide-visible")?$(e).find("a:not(:first)").attr("tabindex","0"):$(e).find("a:not(:first)").attr("tabindex","-1")}));var t=document.querySelectorAll(".sub-hero-collection .swiper-slide"),r=!1;t.forEach((function(e){$(e).hasClass("swiper-slide-visible")?(r=!0,$(e).find("a:not(:first)").attr("tabindex","0")):$(e).find("a:not(:first)").attr("tabindex","-1")})),r||t.forEach((function(e,t){t<4?$(e).find("a:not(:first)").attr("tabindex","0"):$(e).find("a:not(:first)").attr("tabindex","-1")}))}}))}),{rootMargin:"0px",threshold:0});e.forEach((function(e){t.observe(e)}))}$(".sub-hero-notab .mySwiper").each((function(e){var t=$(this).closest(".sub-hero-notab"),r=t.find(".sub-hero-prev")[0],i=t.find(".sub-hero-next")[0];new swiperCarousel.Swiper(this,{modules:[swiperCarousel.Navigation,swiperCarousel.Lazy],slidesPerView:1.3,spaceBetween:20,lazy:!0,watchSlidesProgress:!0,navigation:{nextEl:i,prevEl:r},breakpoints:{645:{slidesPerView:3.2,spaceBetween:20},1024:{slidesPerView:4,spaceBetween:20,slidesPerGroup:4}},on:{init:function(){document.querySelectorAll(".sub-hero-component .swiper-slide").forEach((function(e){$(e).hasClass("swiper-slide-visible")?($(e).find("a:not(:first)").attr("tabindex","0"),$(e).find("button").attr("tabindex","0")):($(e).find("a:not(:first)").attr("tabindex","-1"),$(e).find("button").attr("tabindex","-1"))}))},slideChangeTransitionEnd:function(){var e=this.navigation.nextEl,t=this.navigation.prevEl;e&&t&&(e.setAttribute("tabindex",-!!e.classList.contains("swiper-button-disabled")),e.setAttribute("aria-disabled",e.classList.contains("swiper-button-disabled")),t.setAttribute("tabindex",-!!t.classList.contains("swiper-button-disabled")),t.setAttribute("aria-disabled",t.classList.contains("swiper-button-disabled")))}
2,slideChange:function(){var e=$(this.$el);setTimeout((function(){e.find(".swiper-slide.swiper-slide-visible").first().attr("tabindex","-1").focus().focus()}),300),$(this.$el).find(".swiper-slide")&&($(this.$el).find(".swiper-slide").find("a:not(:first)").attr("tabindex","-1"),$(this.$el).find(".swiper-slide.swiper-slide-visible").find("a:not(:first)").attr("tabindex","0"))}}})}))}},5868:e=>{"use strict";e.exports=function(){if($(".tumi-service-swiper"))new swiperCarousel.Swiper(".tumi-service-swiper",{slidesPerView:"2.5",spaceBetween:16,breakpoints:{768:{slidesPerView:"4"},1024:{slidesPerView:"0"}}})}},217:e=>{"use strict";function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(e)}function r(e,r){for(var i=0;i<r.length;i++){var n=r[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,(a=n.key,s=void 0,s=function(e,r){if("object"!==t(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var n=i.call(e,r||"default");if("object"!==t(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(a,"string"),"symbol"===t(s)?s:String(s)),n)}var a,s}var i=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.groupNode=t,this.radioButtons=[],this.firstRadioButton=null,this.lastRadioButton=null;for(var r=this.groupNode.querySelectorAll("[role=radio]"),i=0;i<r.length;i++){var n=r[i],a={keydown:this.handleKeydown.bind(this),click:this.handleClick.bind(this),focus:this.handleFocus.bind(this),blur:this.handleBlur.bind(this)};n._boundHandlers=a;var s=this.groupNode.querySelector("[role=radio].selected");s?(s.setAttribute("aria-checked","true"),s.tabIndex=0):(n.tabIndex=-1,n.setAttribute("aria-checked","false")),n.addEventListener("keydown",a.keydown),n.addEventListener("click",a.click),n.addEventListener("focus",a.focus),n.addEventListener("blur",a.blur),this.radioButtons.push(n),this.firstRadioButton||(this.firstRadioButton=n),this.lastRadioButton=n}}var t,i,n;return t=e,(i=[{key:"setChecked",value:function(e){for(var t=0;t<this.radioButtons.length;t++){var r=this.radioButtons[t];r.setAttribute("aria-checked","false"),r.tabIndex=-1,r.classList.remove("selected")}e.setAttribute("aria-checked","true"),e.tabIndex=0,e.classList.add("selected"),e.focus()}},{key:"setCheckedToPreviousItem",value:function(e){var t;e===this.firstRadioButton?e.focus():(t=this.radioButtons.indexOf(e),this.radioButtons[t-1].focus())}},{key:"setCheckedToNextItem",value:function(e){var t;e===this.lastRadioButton?e.focus():(t=this.radioButtons.indexOf(e),this.radioButtons[t+1].focus())}},{key:"handleKeydown",value:function(e){var t=e.currentTarget,r=!1;switch(e.key){case" ":this.setChecked(t),r=!0;break;case"Up":case"ArrowUp":case"Left":case"ArrowLeft":this.setCheckedToPreviousItem(t),r=!0;break;case"Down":case"ArrowDown":case"Right":case"ArrowRight":this.setCheckedToNextItem(t),r=!0}r&&(e.stopPropagation(),e.preventDefault())}},{key:"handleClick",value:function(e){e.preventDefault(),this.setChecked(e.currentTarget)}},{key:"handleFocus",value:function(e){e.currentTarget.classList.add("focus")}},{key:"handleBlur",value:function(e){e.currentTarget.classList.remove("focus")}}])&&r(t.prototype,i),n&&r(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();window.addEventListener("load",(function(){for(var e=document.querySelectorAll('[role="radiogroup"]'),t=0;t<e.length;t++)new i(e[t])})),e.exports=i},9800:e=>{"use strict";e.exports={loadJsDynamically:function(e){var t=$(e);if(t.length&&!t.data("loaded")){var r=t.data("jspath");$('script[src="'+r+'"]').remove(),$("<script>").attr("type","text/javascript").attr("src",r).appendTo("head"),t.data("loaded",!0)}},loadCssDynamically:function(e){var t=$(e);if(t.length&&!t.data("loaded")){var r=t.data("csspath");$('link[href="'+r+'"]').remove(),$("<link>").attr("rel","stylesheet").attr("href",r).appendTo("head"),t.data("loaded",!0)}}}},3209:e=>{"use strict";
2e.exports=function(){var e=$(".new-recommendation-carousel");e.length&&e.each((function(){var e=$(this),t=e.find(".reccomendation-carousel-tabs"),r=e.find(".reccomendation-carousel-panels"),i=r.find(".tab-pane");if(i.length){i.each((function(){var e=$(this),r=e.attr("id");e.find(".einstein-container-wrapper").length>0||function(e,t){t.find('li[data-panel-id="'+e+'"]').remove(),$("#"+e).remove()}(r,t)}));var n=r.find(".tab-pane"),a=n.length;0!==a?(1===a?(e.find(".slottabs").hide(),n.addClass("active show")):function(e){var t=e.find(".nav-link").first();if(t.length){e.find(".nav-link").removeClass("active").attr("aria-selected","false"),e.find(".tab-pane").removeClass("active show"),t.addClass("active").attr("aria-selected","true");var r=t.attr("href");$(r).addClass("active show")}}(t),e.find(".tabs_common_heading").show(),r.addClass("tabs-enabled").show(),e.removeClass("d-none")):e.remove()}}))}},9432:(e,t,r)=>{"use strict";var i,n=r(4629).plpProductCarousel,a=$("#customizeBadgeSKUs")&&$("#customizeBadgeSKUs").val()&&JSON.parse($("#customizeBadgeSKUs").val())||[],s=$("[name=isTumiEmployee]").val(),o=function(e){var t=$("#enableCountryandLocaleSelector").val(),r=$("#locale").val();return"true"===t&&r&&(e="/"+r.split("_")[0]+e),e};function l(e,t){var r={};return Object.keys(t).forEach((function(i){var n={};Object.keys(t[i]).forEach((function(r){var a;n[r.toString()]="".concat((a=e,a.split("?")[0]),"?").concat(t[i][r])})),r[i]="".concat(n["1x"]," 1x, ").concat(n["2x"]," 2x, ").concat(n["3x"]," 3x")})),r}function u(e){if(e){var t=document.createElement("picture");t.classList.add("product-main-picture"),Object.keys(e).forEach((function(r){if(e[r]){var i=document.createElement("source");i.setAttribute("data-main-image",e[r]),i.setAttribute("srcset",e[r]),i.setAttribute("type","image/"+r),t.append(i)}}));var r=document.createElement("img");return r.classList.add("tile-image"),r.classList.add("active"),r.setAttribute("fetchpriority","high"),r.setAttribute("haspopup","dialog"),r.setAttribute("itemprop","image"),r.setAttribute("src",e.jpeg),r.setAttribute("data-master-image",e.jpeg),r.setAttribute("title",""),r.setAttribute("alt",""),t.append(r),t}}function d(e,t){if(window.InstanceType===window.PRODUCTION_SYSTEM||window.InstanceType===window.STAGING_SYSTEM)return e;var r=window.currentInstanceHostName,i=window.InstanceTypeHosts;if(null!==i){var n=i.split(",");for(var a in n)if(0===r.indexOf(n[a]))return e}return"string"==typeof e&&"string"==typeof t?e.slice(0,-1)+t:""}function c(e){if(!e.hasClass("selected")){var t=e.attr("data-alt-swatch-image"),r=$("#s7PresetsPlp").val();!t&&e.attr("data-main-image")&&(t=e.attr("data-main-image")),e.closest(".image-wrapper").length>0&&window.innerWidth>1024&&(r="?wid=840&hei=1168&fit=hfit&qlt=75"),e.closest(".product-tile-footer").find(".color-attribute").removeClass("selected").attr({"aria-checked":!1,tabindex:-1}),e.addClass("selected").attr({"aria-checked":!0,tabindex:0});var i=e.closest(".product-tile").find(".primary-image img").attr("data-master-image");t=t.split("_")[0]+"_main"+r,e.closest(".product-tile").find(".primary-image img").attr("src",t),e.closest(".product-tile").find(".image-container .primary-image img").attr("data-master-alt-image",i),"compare"!==pageContext.type&&function(e,t){var r=$("#s7PresetsPlp").val(),i=t;t.indexOf("https")>-1||(i="https:"+t);var a=e.attr("data-swatch-id");e.parents(".product").find(".primary-image."+a+" .tile-image").attr("data-master-image",t);var s=e.attr("data-alt-swatch-image")?e.attr("data-alt-swatch-image").split(","):[];for(var o in s)s[o]=s[o]+r;var l="";for(var o in 0!==s.length?s.splice(0,0,i):l+='<div class="swiper-slide"><img class="tile-image active" fetchpriority="high" src="'.concat(i,'" data-src="').concat(i,'" alt="product image" title="').concat(i,'"/></div>'),s)l+='<div class="swiper-slide"><img class="alt-image active" fetchpriority="high" src="'.concat(s[o],'" data-src="').concat(s[o],'" alt="product Image" title="').concat(s[o],'"/></div>');e.parents(".product").find(".primary-image."+a).find(".pagination").remove(),e.parents(".product").find(".primary-image."+a).find(".image-wrapper").remove(),e.parents(".product").find(".primary-image."+a+" .plp-product-swiper .swiper-wrapper").children().remove(),e.parents(".product").find(".primary-image."+a+" .plp-product-swiper .swiper-pagination").children().remove(),e.parents(".product").find(".primary-image."+a+" .plp-product-swiper .swiper-wrapper").append(l),e.parents(".product").find(".primary-image."+a+" .plp-product-swiper").removeClass("swiper-initialized"),n()}(e,t)}}
2e.exports={getHandlebarHelpers:function(){Handlebars.registerHelper("altImageUrls",(function(e){this.altImageUrls="string"==typeof e?e.split(","):""})),Handlebars.registerHelper("generateSearchUrl",(function(e){return"string"==typeof e&&"string"==typeof searchUrl?searchUrl+"?q="+e:""})),Handlebars.registerHelper("calculateRating",(function(e){var t="<span class='rating-value' style='width:"+e/5*100+"%'></span>";return new Handlebars.SafeString(t)})),Handlebars.registerHelper("isUrl",(function(e,t,r){return"string"==typeof e&&"string"==typeof t&&"string"==typeof r?e+t+r:e})),Handlebars.registerHelper("collectionUrl",(function(e,t){return"string"==typeof e&&e?e=o(e):"string"==typeof t&&t?searchUrl+"?q="+t:""})),Handlebars.registerHelper("generateSuggestionCategoryUrl",(function(e){return"string"==typeof e&&e?e=o(e):""})),Handlebars.registerHelper("listOfRestrictedLimitedSKUs",(function(e){return window.listOfRestrictedLimitedSKUs&&window.listOfRestrictedLimitedSKUs[e]?"disable-product-atc":""})),Handlebars.registerHelper("listOfRestrictedLimitedSKUsTitle",(function(e){return window.listOfRestrictedLimitedSKUs&&window.listOfRestrictedLimitedSKUs[e]?'title="'+window.Resources.maximumQuantityReached+'"':""})),Handlebars.registerHelper("listOfRestrictedLimitedSKUsStyle",(function(e){return window.listOfRestrictedLimitedSKUs&&window.listOfRestrictedLimitedSKUs[e]?'style="background-color:#ccc !important"':""})),Handlebars.registerHelper("mainUrl",(function(e,t){if(window.InstanceType===window.PRODUCTION_SYSTEM||window.InstanceType===window.STAGING_SYSTEM)return e;var r=window.currentInstanceHostName,i=window.InstanceTypeHosts;if(null!==i){var n=i.split(",");for(var a in n)if(0===r.indexOf(n[a]))return e}return"string"==typeof e&&"string"==typeof t?e.slice(0,-1)+t:""})),Handlebars.registerHelper("productTilePrice",(function(e,t){var r="";return parseFloat(e)!==parseFloat(t)?(t=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format(t),r+='\n <del role="text">\n <span class="strike-through list">\n <span class="sr-only">List Price:</span>\n <span class="value" content="'.concat(t,'">\n ').concat(t,'\n </span>\n </span>\n </del>\n <ins role="text">\n <span class="sales">\n <span class="sr-only">Sale Price:</span>\n <span class="value" content="').concat(e,'">\n ').concat(new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format(e),"\n </span>\n </span>\n </ins>")):r+='\n <span class="sales" role="text">\n <span class="sr-only">List Price:</span>\n <span class="value" content="'.concat(t,'">\n ').concat(new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format(t),"\n </span>\n </span>"),new Handlebars.SafeString(r)})),Handlebars.registerHelper("productTilePriceCA",(function(e,t){var r="",i=!1;try{if(window.location&&(window.location.href.includes("/fr/")||window.location.href.includes("fr_CA")||window.location.pathname.includes("/fr/")))"fr_CA",i=!0;else if(window.currentLocale&&"fr_CA"===window.currentLocale)window.currentLocale,i=!0;else if("undefined"!=typeof $&&$("#currentLocale").length>0){var n=$("#currentLocale").val()||"";"fr_CA"===n&&(n,i=!0)}else window.request&&"fr_CA"===window.request.locale&&(window.request.locale,i=!0)}catch(e){window.location&&(window.location.href.includes("/fr/")||window.location.href.includes("fr_CA")||window.location.pathname.includes("/fr/"))&&("fr_CA",i=!0)}function a(e){return i?e.replace(/,(\d{3})/g,".$1"):e}function s(e){return"string"==typeof e?parseFloat(e.replace(/[$,]/g,"")):parseFloat(e)||0}var s,o=s(e);if(o!==(s=s(t))){var l=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format(s),u=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}
2).format(o);l=a(l),u=a(u),r+='\n <del role="text">\n <span class="strike-through list">\n <span class="sr-only">List Price:</span>\n <span class="value" content="'.concat(l,'">\n ').concat(l,'\n </span>\n </span>\n </del>\n <ins role="text">\n <span class="sales">\n <span class="sr-only">Sale Price:</span>\n <span class="value" content="').concat(u,'">\n ').concat(u,"\n </span>\n </span>\n </ins>")}else{l=a(l=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format(s)),r+='\n <span class="sales" role="text">\n <span class="sr-only">List Price:</span>\n <span class="value" content="'.concat(l,'">\n ').concat(l,"\n </span>\n </span>")}return new Handlebars.SafeString(r)})),Handlebars.registerHelper("each_upto",(function(e,t){var r=$(window).width()<=1024?3:5;if(!e||0==e.length)return t.inverse(this);for(var i=[],n=0;n<r&&n<e.length;++n)i.push(t.fn(e[n]));return i.join("")})),Handlebars.registerHelper("SortSwatches",(function(e,t,r){if(e&&e.length)for(var i=0;i<e.length;i++){if(r===(a=e[i].product_url.split("/")[2].split("-"))[a.length-1]){var n=e[0];e[0]=e[i],e[i]=n}}else if(t&&t.length)for(i=0;i<t.length;i++){var a;if(r===(a=t[i].product_url.split("/")[2].split("-"))[a.length-1]){var s=t[0];t[0]=t[i],t[i]=s}}currentCountry,this.loopedSwatchList=e||t})),Handlebars.registerHelper("wishListAddProductRfk",(function(){return window.wishListAddProductRfk})),Handlebars.registerHelper("removeWishlistProductRfk",(function(){return window.removeWishlistProductRfk})),Handlebars.registerHelper("filterCount",(function(e){if(0===e)return"disabled"})),Handlebars.registerHelper("isMoreFlag",(function(e){return e<8?"isShowMore":"hideShowMore"})),Handlebars.registerHelper("getColorValue",(function(e,t){var r=(document.querySelector("input[name=rfkColorSwatchesHexaValues]")||{}).value,i=r&&JSON.parse(r)&&JSON.parse(r)[currentLocaleID]?JSON.parse(r)[currentLocaleID]:{},n=t?t.toLowerCase():null;if(e.indexOf("color")>-1&&n&&i[n]){var a=i[n];return a.startsWith("#")?"background-color: ".concat(a):a.startsWith("rgb")?"background: ".concat(a):'background-image: url("'.concat(a,'")')}return"background-color: `#ffffff`"})),Handlebars.registerHelper("isToggleShowHide",(function(e){return e>8?"isLinkVisible":"isLinkNotVisible"})),Handlebars.registerHelper("isDynamicClass",(function(e,t){return e+t.replace(/[^a-zA-Z0-9]/g,"")})),Handlebars.registerHelper("colorCountDesktop",(function(e,t){if(e&&Object.keys(e).length>5){var r='<a class="desktop" href ="'.concat(d(t,".html"),'"><span class="desktop">+').concat(Object.keys(e).length-5,' <span class="sr-only">').concat(Object.keys(e).length-5>1?"More Colors":"More Color","</span></span></a>");return new Handlebars.SafeString(r)}return""})),Handlebars.registerHelper("colorCountMobile",(function(e,t){if(e&&Object.keys(e).length>3){var r='<a class="mobile" href ="'.concat(d(t,".html"),'"><span class="mobile">+').concat(Object.keys(e).length-3,' <span class="sr-only">').concat(Object.keys(e).length-3>1?"More Colors":"More Color","</span></span></a>");return new Handlebars.SafeString(r)}return""})),Handlebars.registerHelper("productUrl",(function(e){var t=e.split("/"),r=t[t.indexOf("p")+1].split("-");return[].push(r),r[r.length-1]})),Handlebars.registerHelper("imageUrls",(function(e){var t;return(t="CA"===currentCountry?e.swatch_list_ca?e.swatch_list_ca:e.swatch_list:e.swatch_list_us?e.swatch_list_us:e.swatch_list)?t.map((function(e){return e&&e.altimage_url})):null})),Handlebars.registerHelper("addCompareUrl",(function(e){var t=$("#pidsLength").val(),r=$(".compared-suggestions").attr("data-compareurl");return 1===parseInt(t)?r+"&pid1="+e+"&backUrl=":r+"&pid2="+e+"&backUrl="})),Handlebars.registerHelper("dollarFormat",(function(e){return e=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format(e)})),Handlebars.registerHelper("dollarFormatCA",(function(e){return e=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format(e)})),Handlebars.registerHelper("imageQuery",(function(e){return e+$("#s7PresetsPlp").val()})),Handlebars.registerHelper("selectedSwatch",(function(e,t){var r=(e=e.split("/"))[e.length-2].split("-");return r[r.length-1]===t?"selected":""})),Handlebars.registerHelper("removeCompareItemUrl",(function(e){var t=$(".product-comparison").attr("data-removeitemurl"),r=$(".product-comparison").attr("data-pids").split(",").filter((function(t){return t!==e}));return 2===r.length?t+"&pid0="+r[0]+"&pid1="+r[1]+"&backUrl=":1===r.length?t+"&pid0="+r[0]+"&backUrl=":""})),Handlebars.registerHelper("isFormatId",(function(e){return e.replace(/\=/g,"")})),Handlebars.registerHelper("dataSrcOrSrc",(function(e,t){var r=$("#s7PresetsPlp").val(),i=$("#s7imageNotFound").val();return e<6?t+r:i})),Handlebars.registerHelper("checkAvailability",(function(e){var t=window.compareVariationsData[e];return t&&1==t.available?"":"disabled"})),Handlebars.registerHelper("transformedUrls",(function(e){return e?JSON.stringify(e):""})),Handlebars.registerHelper("mappedText",(function(e,t){window.facetedRefinementMapping&&Object.keys(facetedRefinementMapping).includes(e)&&(this.mappedText=facetedRefinementMapping[e][t])})),Handlebars.registerHelper("mainImageUrl",(function(e){return e?e.replace("_sw","_main"):""})),Handlebars.registerHelper("updateIndex",(function(e,t){var r=e.split("/"),i=r[r.length-2].split("-");return i[i.length-1]===t?"0":"-1"})),Handlebars.registerHelper("updateRadioStatus",(function(e,t){var r=e.split("/"),i=r[r.length-2].split("-");return i[i.length-1]===t?"true":"false"}))},handleColorSwatchesInTile:function(){$(document).on("click mouseover mouseout",".product-tile .color-attribute",(function(e){var t=$(e.target),r=t.attr("data-swatch-sku");c(t);var i=t.attr("data-final-price"),n=t.attr("data-price");if(i&&"null"!==i&&n&&"null"!==n){var o=i,l=n;i=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format(i),n=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format(n);var u=!1;try{(window.location&&(window.location.href.includes("/fr/")||window.location.href.includes("fr_CA")||window.location.pathname.includes("/fr/"))||"fr_CA"===window.currentLocale||"undefined"!=typeof $&&$("#currentLocale").length>0&&"fr_CA"===$("#currentLocale").val())&&(u=!0)}catch(e){window.location&&(window.location.href.includes("/fr/")||window.location.href.includes("fr_CA")||window.location.pathname.includes("/fr/"))&&(u=!0)}u&&(i=i.replace(/,(\d{3})/g,".$1"),n=n.replace(/,(\d{3})/g,".$1"));var d="<span>";"true"===s&&(i=n);var h=t.attr("data-finaldiscountprice"),f=t.attr("data-hasdiscount"),g=t.attr("data-promotionmsg");parseFloat(o)!==parseFloat(l)&&parseFloat(l)>parseFloat(o)&&"false"===s?d+='\n <del role="text">
2\n <span class="strike-through list">\n <span class="sr-only">List Price:</span>\n <span class="value" content="'.concat(n,'">\n ').concat(n,'\n </span>\n </span>\n </del>\n <ins role="text">\n <span class="sales ').concat("true"===f?"d-none":"",'">\n <span class="sr-only">Sale Price:</span>\n <span class="value" content=').concat(i,'">').concat(i,"</span>\n </ins>"):d+='\n <span class="sales '.concat("true"===f?i===h?"d-none":"strike-through-price":"",'" role="text">\n <span class="sr-only">List Price:</span>\n <span class="value" content=').concat(i,'">').concat(i,"</span>\n </span>"),"true"===f&&(d+='\n <span class="final-sales">\n <span class="value tile-promotion-price_'.concat(r,'">\n ').concat(h,"\n </span>\n </span>\n ")),(d+="</span>")&&t.closest(".product-tile").find(".price span").replaceWith(d)}t.parents(".product-tile").find(".product-tile-promotion-msg").removeClass().addClass("product-tile-promotion-msg").addClass("tile-promotion-msg_"+r),t.parents(".product-tile").find(".final-sales .value").removeClass().addClass("value").addClass("tile-promotion-price_"+r),t.parents(".product-tile").find(".product-tile-promotion-msg").html(g||"");var v=t.attr("data-attr-value");if(t.closest(".product").attr("data-pid",v),$(".compare-landing").length>0){var p=window.compareVariationsData[v];p&&1==p.available?t.closest(".product-tile").find(".add-to-cart").attr("disabled",!1):t.closest(".product-tile").find(".add-to-cart").attr("disabled",!0)}var m=t.attr("data-product-url");t.closest(".product-tile").find(".image-container a").attr("href",m);var y=t.attr("data-swatch-badge"),E=t.attr("data-swatch-sku");Object.keys(a).length>0&&!Array.isArray(a)&&(a=Object.values(a)),window.customizedProductBadge&&E&&a.includes(E)&&window.badgeABtestActive&&(y=window.customizedProductBadge,$(".travelLiesure").length>0&&$(".travelLiesure").hasClass("d-none")&&$(".travelLiesure").removeClass("d-none")),t.closest(".product-tile").find(".badge-message").html(y)}))},getPictureElement:u,transformTileImages:function(e){try{if(!(e&&e.content&&e.content.product&&e.content.product.value))return e;if("true"!==$("#scaledImageEnabledTile").val())return e;if(!i){var t=$("input[name=imageConfigs]").val();i=t?JSON.parse(t):{}}var r=i&&i.tile;return r?(e.content.product.value.forEach((function(e){e&&(e.image_url||e.altimage_url)&&function(e,t){e.transformedURL={};var r=e.image_url;r&&(e.transformedURL.mainImageURL=l(r,t)),e.transformedURL.altImages={};var i=0;if(e.altimage_url){var n=e.altimage_url.split(",");e.transformedURL.mainImageURL?(e.transformedURL.altImages[i]=e.transformedURL.mainImageURL,i+=1):(e.transformedURL.mainImageURL=l(n[0].split("_")[0]+"_main",t),e.transformedURL.altImages[i]=e.transformedURL.mainImageURL,i+=1),n.forEach((function(r){e.transformedURL.altImages[i]=l(r,t),i+=1}))}}(e,r)})),e):e}catch(t){return e}}}},6417:(e,t,r)=>{"use strict";var i=r(2343);$(document).ready((function(){i(r(1135)),i(r(8438))}))},8438:()=>{"use strict";$(document).ready((function(){"true"===$("[name=appleEnabled]").val()&&AppleID.auth.init({clientId:"com.dev-us.tumi",scope:"name email",redirectURI:$("#appleid-signin").data("redirecturl"),state:"123fasf21312312",nonce:"dev15",usePopup:!0}),document.addEventListener("AppleIDSignInOnSuccess",(function(e){var t=JSON.parse(atob(e.detail.authorization.id_token.split(".")[1])),r=e.detail.user,i=JSON.stringify({authorization:{code:e.detail.authorization.code,state:e.detail.state,id_token:t},user:r});$.ajax({url:$("#appleid-signin").data("reentrynurl"),type:"POST",contentType:"application/JSON",data:i,success:function(e){e.success?window.location.href=$("#appleid-signin").data("returnurl"):console.info("Error occured in Apple login
2wihtin SFCC")},error:function(e){console.error("Error occured in Apple login wihtin SFCC",e)}}),console.log(e)})),document.addEventListener("AppleIDSignInOnFailure",(function(e){console.error("Error occured in Apple login from APPLE"),console.log("errro"),console.log(e)}))}))},1135:(e,t,r)=>{"use strict";function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function n(){n=function(){return t};var e,t={},r=Object.prototype,a=r.hasOwnProperty,s=Object.defineProperty||function(e,t,r){e[t]=r.value},o="function"==typeof Symbol?Symbol:{},l=o.iterator||"@@iterator",u=o.asyncIterator||"@@asyncIterator",d=o.toStringTag||"@@toStringTag";function c(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,r){return e[t]=r}}function h(e,t,r,i){var n=t&&t.prototype instanceof E?t:E,a=Object.create(n.prototype),o=new _(i||[]);return s(a,"_invoke",{value:R(e,r,o)}),a}function f(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=h;var g="suspendedStart",v="suspendedYield",p="executing",m="completed",y={};function E(){}function b(){}function T(){}var S={};c(S,l,(function(){return this}));var w=Object.getPrototypeOf,A=w&&w(w(x([])));A&&A!==r&&a.call(A,l)&&(S=A);var L=T.prototype=E.prototype=Object.create(S);function I(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function k(e,t){function r(n,s,o,l){var u=f(e[n],e,s);if("throw"!==u.type){var d=u.arg,c=d.value;return c&&"object"==i(c)&&a.call(c,"__await")?t.resolve(c.__await).then((function(e){r("next",e,o,l)}),(function(e){r("throw",e,o,l)})):t.resolve(c).then((function(e){d.value=e,o(d)}),(function(e){return r("throw",e,o,l)}))}l(u.arg)}var n;s(this,"_invoke",{value:function(e,i){function a(){return new t((function(t,n){r(e,i,t,n)}))}return n=n?n.then(a,a):a()}})}function R(t,r,i){var n=g;return function(a,s){if(n===p)throw new Error("Generator is already running");if(n===m){if("throw"===a)throw s;return{value:e,done:!0}}for(i.method=a,i.arg=s;;){var o=i.delegate;if(o){var l=D(o,i);if(l){if(l===y)continue;return l}}if("next"===i.method)i.sent=i._sent=i.arg;else if("throw"===i.method){if(n===g)throw n=m,i.arg;i.dispatchException(i.arg)}else"return"===i.method&&i.abrupt("return",i.arg);n=p;var u=f(t,r,i);if("normal"===u.type){if(n=i.done?m:v,u.arg===y)continue;return{value:u.arg,done:i.done}}"throw"===u.type&&(n=m,i.method="throw",i.arg=u.arg)}}}function D(t,r){var i=r.method,n=t.iterator[i];if(n===e)return r.delegate=null,"throw"===i&&t.iterator.return&&(r.method="return",r.arg=e,D(t,r),"throw"===r.method)||"return"!==i&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+i+"' method")),y;var a=f(n,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,y;var s=a.arg;return s?s.done?(r[t.resultName]=s.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,y):s:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}function C(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function _(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(C,this),this.reset(!0)}function x(t){if(t||""===t){var r=t[l];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,s=function r(){for(;++n<t.length;)if(a.call(t,n))return r.value=t[n],r.done=!1,r;return r.value=e,r.done=!0,r};return s.next=s}}throw new TypeError(i(t)+" is not iterable")}return b.prototype=T,s(L,"constructor",{value:T,configurable:!0}),s(T,"constructor",{value:b,configurable:!0}),b.displayName=c(T,d,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===b||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,T):(e.__proto__=T,c(e,d,"GeneratorFunction")),e.prototype=Object.create(L),e},t.awrap=function(e){return{__await:e}},I(k.prototype),c(k.prototype,u,(function(){return this})),t.AsyncIterator=k,t.async=function(e,r,i,n,a){void 0===a&&(a=Promise);var s=new k(h(e,r,i,n),a);return t.isGeneratorFunction(r)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},I(L),c(L,d,"Generator"),c(L,l,(function(){return this})),c(L,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var i in t)r.push(i);return r.reverse(),function e(){for(;r.length;){var i=r.pop();if(i in t)return e.value=i,e.done=!1,e}return e.done=!0,e}},t.values=x,_.prototype={constructor:_,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEac
2h(P),!t)for(var r in this)"t"===r.charAt(0)&&a.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function i(i,n){return o.type="throw",o.arg=t,r.next=i,n&&(r.method="next",r.arg=e),!!n}for(var n=this.tryEntries.length-1;n>=0;--n){var s=this.tryEntries[n],o=s.completion;if("root"===s.tryLoc)return i("end");if(s.tryLoc<=this.prev){var l=a.call(s,"catchLoc"),u=a.call(s,"finallyLoc");if(l&&u){if(this.prev<s.catchLoc)return i(s.catchLoc,!0);if(this.prev<s.finallyLoc)return i(s.finallyLoc)}else if(l){if(this.prev<s.catchLoc)return i(s.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return i(s.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&a.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var n=i;break}}n&&("break"===e||"continue"===e)&&n.tryLoc<=t&&t<=n.finallyLoc&&(n=null);var s=n?n.completion:{};return s.type=e,s.arg=t,n?(this.method="next",this.next=n.finallyLoc,y):this.complete(s)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),P(r),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var i=r.completion;if("throw"===i.type){var n=i.arg;P(r)}return n}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,i){return this.delegate={iterator:x(t),resultName:r,nextLoc:i},"next"===this.method&&(this.arg=e),y}},t}function a(e,t,r,i,n,a,s){try{var o=e[a](s),l=o.value}catch(e){return void r(e)}o.done?t(l):Promise.resolve(l).then(i,n)}var s=r(4691),o=r(6722),l=r(1542);r(8854);var u=$("[name=enableVisibleRecaptchaOnAccountLogin]").val();var d=function(e){if(e)if(e.visible){for(var t=0;t<$(".g-recaptcha[data-action=CheckUserExistence]").length;t+=1){var r=$(".g-recaptcha[data-action=CheckUserExistence]")[t];$(r).removeClass("d-none")}for(var i=0;i<$(".account-login.visible-recaptcha").length;i+=1){var n=$(".account-login.visible-recaptcha")[i];$(n).addClass("d-none")}}else{for(var a=0;a<$(".g-recaptcha[data-action=CheckUserExistence]").length;a+=1){var s=$(".g-recaptcha[data-action=CheckUserExistence]")[a];$(s).addClass("d-none")}for(var o=0;o<$(".account-login.visible-recaptcha").length;o+=1){var l=$(".account-login.visible-recaptcha")[o];$(l).removeClass("d-none")}}};function c(){$.ajax({url:$(".login-page").data("csrf-url"),type:"post",dataType:"json",success:function(e){if(e.csrf){var t='input[name="'+e.csrf.tokenName+'"]';$(t).val(e.csrf.token)}else location.reload()},error:function(e){location.reload()}})}function h(){return new Promise((function(e,t){$.ajax({url:$(".login-page").data("csrf-url"),type:"post",dataType:"json",success:function(t){e(t)},error:function(e){t(e)}})}))}function f(e){for(var t=e+"=",r=decodeURIComponent(document.cookie).split(";"),i=0;i<r.length;i++){for(var n=r[i];" "===n.charAt(0);)n=n.substring(1);if(0===n.indexOf(t))return n.substring(t.length,n.length)}return""}function g(){"T"===f("unitedEmployee")&&f("united_employee_type")?($(".united-luggage-program").addClass("active"),$(".loggin-user").removeClass("active"),$(".non-united-header-promo-banner").addClass("d-none"),$(".patnership-united-header-promo-banner").addClass("d-none"),$(".Luggageprogram-united-header-promo-banner").removeClass("d-none")):"T"===f("unitedEmployee")?($(".qualified-user").addClass("active"),$(".loggin-user").removeClass("active"),$(".non-united-header-promo-banner").addClass("d-none"),$(".patnership-united-header-promo-banner").removeClass("d-none"),$(".Luggageprogram-united-header-promo-banner").addClass("d-none")):($(".not-qualified-user").addClass("active"),$(".loggin-user").removeClass("active"),$(".non-united-header-promo-banner").removeClass("d-none"),$(".patnership-united-header-promo-banner").addClass("d-none"),$(".Luggageprogram-united-header-promo-banner").addClass("d-none"))}
2function v(){var e=$("#promocategoryId").length>0?$("#promocategoryId").val():null;f("promoCategory")&&f("promoCategory")===e?($(".promotionCategory-loggin-user").removeClass("active"),$(".promotionCategory-qualified-user").addClass("active")):($(".promotionCategory-not-qualified-user").addClass("active"),$(".promotionCategory-loggin-user").removeClass("active"))}var p=8,m=1,y=1;function E(e){var t=!1;$("#password-error").addClass("d-none");var r=$(e).val(),i=$("input[name=mustcontain]").val();if(r){var n=[];r.length<p&&(i="",n.push($("input[name=mustbeatleast]").val()+" "+p+" "+$("input[name=messagecharacters]").val())),new RegExp("[0-9]{"+m+"}").test(r)||n.push(" "+$("input[name=messagenumber]").val()),new RegExp("[a-z]{"+y+"}").test(r)||n.push(" "+$("input[name=lowercaseletter]").val()),new RegExp("[A-Z]{"+y+"}").test(r)||n.push(" "+$("input[name=uppercaseletter]").val());new RegExp(/[`!@#$%*()_+\-=\[\]{}\\|,.\/?~&^'";:><]/).test(r)||n.push(" "+$("input[name=specialcharacter]").val()),""===i&&n.length>1&&(n[0]+=" "+$("input[name=andcontain]").val());for(var a=0;a<n.length;a++)0===a?i+=n[a]:a===n.length-1&&n.length<3&&i.indexOf($("input[name=mustbeatleast]").val()+" "+p+" "+$("input[name=charactersandcontain]").val())>-1?i+=" "+$("input[name=messageand]").val()+n[a]:a===n.length-1&&n[a-1]!==$("input[name=mustbeatleast]").val()+" "+p+" "+$("input[name=charactersandcontain]").val()?n.length<3?i+=" "+$("input[name=messageand]").val()+n[a]:i+=", "+$("input[name=messageand]").val()+n[a]:i!==$("input[name=mustbeatleast]").val()+" "+p+" "+$("input[name=charactersandcontain]").val()?i+=","+n[a]:i+=n[a];return i!=$("input[name=mustcontain]").val()&&(i+=".",t=!0,$("#password-error").text(i),$("#password-error").removeClass("d-none")),t}}function b(){var e;return e=n().mark((function e(t,r,i){var a,s,o,l;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=(new TextEncoder).encode(t),e.next=3,crypto.subtle.digest("SHA-256",a);case 3:return s=e.sent,o=Array.from(new Uint8Array(s)),l=o.map((function(e){return e.toString(16).padStart(2,"0")})).join(""),r&&window.dataLayer&&window.dataLayer[0]&&(i?setCookie(r,l,i):setCookie(r,l)),e.abrupt("return",l);case 8:case"end":return e.stop()}}),e)})),b=function(){var t=this,r=arguments;return new Promise((function(i,n){var s=e.apply(t,r);function o(e){a(s,i,n,o,l,"next",e)}function l(e){a(s,i,n,o,l,"throw",e)}o(void 0)}))},b.apply(this,arguments)}function T(e){window.dataLayer=window.dataLayer||[];var t=window.dataLayer[0];try{var r=$("#login-form-email").val()||"";t.customer_email=t.customerID,t.customerName="",t.customerDisplayUID=r,t.customerPrefLanguage="en",t.visitorLoginState="registered",t.email=r,function(e,t,r){return b.apply(this,arguments)}(r,"hashed_email").then((function(e){t.hashed_email=e})),e.tumiID&&(t.tid=e.tumiID,setCookie("tid",e.tumiID,90))}catch(e){console.log("generateLoginDataLayerJson ",e.message)}}function S(e){if("sfcc"===e.toLowerCase()){$(".login-register").removeClass("register-active").removeClass("check-user-existence").addClass("login-active").removeClass("verify-account-active").removeClass("apple-login").removeClass("google-login");document.querySelector("form.login");document.querySelectorAll("form.login input").forEach((function(e){return e.classList.remove("is-invalid")})),document.querySelector("#requestLoginModal .modal-body").classList.remove("mlogin"),$("#loginForm #login-form-password").focus()}else if("google"===e.toLowerCase())$(".login-register").removeClass("register-active").removeClass("check-user-existence").removeClass("apple-login").addClass("google-login").removeClass("verify-account-active");else if("apple"===e.toLowerCase()){$(".login-register").removeClass("register-active").removeClass("check-user-existence").addClass("login-active").removeClass("verify-account-active").removeClass("apple-login").removeClass("google-login");document.querySelector("form.login");document.querySelectorAll("form.login input").forEach((function(e){return e.classList.remove("is-invalid")})),document.querySelector("#requestLoginModal .modal-body").classList.remove("mlogin"),$("#loginForm #login-form-password").focus()}}function w(){$(".login-register").removeClass("register-active").addClass("check-user-existence").removeClass("login-active").removeClass("verify-account-active").removeClass("apple-login").removeClass("google-login"),document.querySelector("#requestLoginModal .modal-body").classList.remove("mlogin"),$("#existingUserCheckForm #existing-usercheck-form-email").focus()}function A(e,t){t&&$("[name=".concat(t.tokenName,"]")).val(t.token);var r=$(e);r.spinner().start();var i=$(e).attr("action"),n=r.serialize(),a=window.recaptchaToken;a&&(n+="&g_recaptcha_response="+a.ctr+"&visibleRecaptcha="+a.visible,delete window.recaptchaToken),$.ajax({url:i,type:"post",dataType:"json",data:n,success:function(e){var t="account_login_visible_recaptcha";if($("body").trigger("Enable:VisibleRecaptchaButton","accountlogin"),e.reCaptchaInvalid)"true"===u&&(d(a),$("body").trigger("Disable:VisibleRecaptchaButton","accountlogin"),document.querySelectorAll("#"+t).forEach((function(e){if($(e).removeClass("d-none"),$(e).attr("widgetId"))window.grecaptcha.reset($(e).attr("widgetId"));else{var t=window.grecaptcha.render(e,{sitekey:$("[name=visiblereCaptchaSiteKey]").val(),callback:window.recaptchaVisibleVerification,"expired-callback":window.visibleRecaptchaExpired});$(e).attr("widgetId",t)}})));else{if("united.com"===e.loginEmail.split("@")[1].toLowerCase()&&$("#unitedSSOURI").length>0)return void(window.location.href=$("#unitedSSOURI").val());e.userExists?(S(e.accountType),$("#login-form-email").val(e.loginEmail)):($(".login-register").addClass("register-active").removeClass("check-user-existence").removeClass("login-active").removeClass("verify-account-active").removeClass("apple-login").removeClass("google-login"),document.querySelector("form.registration").reset(),document.querySelectorAll("form.registration input").forEach((function(e){return e.classList.remove("is-invalid")})),$("#registrationForm #registration-form-fname").focus(),$("#registration-form-email").val(e.loginEmail))}"true"===u&&!e.reCaptchaInvalid&&a&&a.visible&&(d(a),document.querySelectorAll("#"+t).forEach((function(e){$(e).addClass("d-none")}))),r.spinner().stop()},error:function(e){r.spinner().stop()}})}function L(e,t,r){r&&$("[name=".concat(r.tokenName,"]")).val(r.token);var i=$(e),n=i.attr("action");if(window.trigger="GLOBAL",$("#united-container").length>0&&(window.trigger="UNITED"),$("#promotionCategory-container").length>0&&(window.trigger="PROMOLOGIN"),$(".service-repairs").length>0&&(n=n.replace("rurl=1","rurl=3"),window.trigger="SERVICEREPAIR"),$('.tumi-tracer .signin a[data-login="sign-in"]').length>0){n=n.replace("rurl=1","rurl=4"),window.trigger="TRACERREG";var a=location.href.split("?")[1],o="";if(a){var u=new URLSearchParams(a);o=u.get("tracerID")}}$("#requestLoginModal").find(".bookmark-info").hasClass("d-none")||(window.trigger="WISHLIST"),localStorage.getItem("currentStoreID")&&$("[for=store_"+localStorage.getItem("currentStoreID")+"]").attr("checked","true")&&(window.trigger="STORELOCATOR");var d="cart"===$("input[name=page-name]").val();
2d&&(window.trigger="CARTUPDATE"),"true"===$("#isUserLogginInCheckout").val()&&(window.trigger="CHECKUPDATE",n=n+"?checkoutPageLogin="+!0),i.spinner().start();var h=i.find(":input:disabled").removeAttr("disabled"),p=i.serialize();return h.attr("disabled","disabled"),$("form.login").trigger("login:submit",t),$.ajax({url:n,type:"post",dataType:"json",data:p,success:function(e){if($.spinner().stop(),e.success){var t=e;if("accountVerified"in e&&!e.accountVerified)return"linkExpired"in e&&e.linkExpired?$(".account-verification-notification.login").html("".concat(e.message," <br/><a href='").concat(e.link,"'>").concat(e.linkName,"</a>")):$(".account-verification-notification.login").html(e.message),c(),!1;sessionStorage.removeItem("storeHeaderResponse");var r=e.wishlistPidArray;sessionStorage.setItem("wishlistPidArray",r),l.getWishlistItem();var n=e.queryString||"",a=e.redirectUrl||"",u=e.signInredirectEnabled,h=e.signInRedirectUrl;if($("form.login").trigger("login:success",e),d)return sessionStorage.setItem("showAccountFlyoutAfterLogin","true"),location.reload(),!1;var p=e.unitedRedirectionUrl||"";$.get($(".accountheader").data("actionurl")).done((function(e){if($(".accountheader").html(),$(".accountheader").html(e),$("#requestLoginModal").modal("hide"),"TRACERREG"===window.trigger){var r=a;if(o)r=a+"?tracerID="+o;location.href=r}else"SERVICEREPAIR"===window.trigger?(sessionStorage.setItem("showAccountFlyoutAfterLogin","true"),location.href=a):"STORELOCATOR"===window.trigger?$(document).trigger("storelocator:add"):"CARTUPDATE"===window.trigger?$(document).trigger("cart:loginUpdate"):"CHECKUPDATE"===window.trigger?(sessionStorage.setItem("showAccountFlyoutAfterLogin","true"),location.reload()):"UNITED"===window.trigger?g():"PROMOLOGIN"===window.trigger?v():("WISHLIST"==window.trigger&&($(document).trigger("wishlist:add"),u&&(location.href=h)),"WISHLIST"!==window.trigger&&n.indexOf("1")>-1&&(u&&(location.href=h),sessionStorage.setItem("showAccountFlyoutAfterLogin","true"),"T"===f("unitedEmployee")&&p||location.reload()),"WISHLIST"!==window.trigger&&n.indexOf("2")>-1&&(location.href=a));T(t),$(".container.tumi-tracer").length&&(sessionStorage.setItem("showAccountFlyoutAfterLogin","true"),window.location.reload())}));var m=e.lpgaRedirectionUrl;"T"===f("unitedEmployee")&&p?window.location.href=p:m?window.location.href=m:!window.pageContext||"productdetail"!==window.pageContext.type&&"productlist"!==window.pageContext.type||(sessionStorage.setItem("showAccountFlyoutAfterLogin","true"),location.reload())}else s(i,e),$("form.login").trigger("login:error",e)},error:function(e){e.responseJSON&&e.responseJSON.redirectUrl?window.location.href=e.responseJSON.redirectUrl:($("form.login").trigger("login:error",e),i.spinner().stop(),location.reload()),c()}}),!1}e.exports={unitedLogin:function(){$("#united-container").spinner().start(),"true"===$(".authenticated-status").attr("data-authenticated")?($(".loggin-user").removeClass("active"),g()):($(".loggin-user").addClass("active"),$(".non-united-header-promo-banner").removeClass("d-none"),$(".patnership-united-header-promo-banner").addClass("d-none"),$(".Luggageprogram-united-header-promo-banner").addClass("d-none")),$("#united-container").spinner().stop()},promoLogin:function(){"true"===$(".authenticated-status").attr("data-authenticated")?($(".promotionCategory-loggin-user").removeClass("active"),v()):$(".promotionCategory-loggin-user").addClass("active")},login:function(){$("form.login").submit((function(e){e.preventDefault();var t=this;h().then((function(r){L(t,e,r.csrf)})).catch((function(r){L(t,e)}))}))},intiateAccountLoginRecaptcha:function(){$("body").on("form:CheckUserExistence",(function(e,t){window.recaptchaToken=t,window.recaptchaTriggeredPosition&&(window.visibleRecaptchaTriggeredPosition=window.recaptchaTriggeredPosition),delete window.recaptchaTriggeredPosition,e.stopImmediatePropagation(),$("form.existingUserCheckForm").submit()})),"true"===u&&($("body").on("CheckUserExistence:VisibleRecaptcha",(function(e,t){e.stopImmediatePropagation(),window.recaptchaToken=t,$("body").trigger("Enable:VisibleRecaptchaButton","accountlogin")}
2)),$(".account-login.visible-recaptcha").on("click",(function(e){var t=$("[id=account_login_visible_recaptcha]:visible");window.grecaptcha.getResponse(t.attr("widgetid"))&&window.recaptchaToken?$("body").trigger("form:CheckUserExistence",window.recaptchaToken):$("body").trigger("Disable:VisibleRecaptchaButton","accountlogin")})))},existingUserCheckForm:function(){$("form.existingUserCheckForm").submit((function(e){if(e.preventDefault(),$("#login-form-password").val(""),"true"!==$("[name=isInvisibleRecaptchaEnabledOnAccountLogin]").val()||window.recaptchaToken){var t=this;h().then((function(e){A(t,e.csrf)})).catch((function(e){A(t)}))}else $("form.existingUserCheckForm .g-recaptcha").click()}))},emailEdit:function(){$(".email-edit").on("click",(function(e){e.preventDefault(),w()}))},returnToLogin:function(){$(".return-to-login").on("click",(function(e){e.preventDefault(),w()}))},loginModal:function(){$("#requestLoginModal").on("shown.bs.modal",(function(e){var t=window.getCookie("loginEmail"),r=window.getCookie("loginName");t&&r?($(".welcome-msg").html(window.Resources.welcomeback+" "+r+"!"),$("[name=existingUserCheckEmail]").val(t)):($(".welcome-msg").html(window.Resources.welcome),$("[name=existingUserCheckEmail]").val("")),$("#existingUserCheckForm #existing-usercheck-form-email").focus()})),$("#requestLoginModal").on("hidden.bs.modal",(function(e){if(w(),$(".alert","form#loginForm.login").remove(),$("#registrationForm .password-info").addClass("d-none"),$("#registrationForm .pwstrength_progress .progress-bar").attr("style","width: 0%;"),$("#registrationForm .pwstrength_progress .progress-bar .password-verdict").html(""),"true"===u){for(var t=0;t<$(".g-recaptcha[data-action=CheckUserExistence]").length;t+=1){var r=$(".g-recaptcha[data-action=CheckUserExistence]")[t];$(r).removeClass("d-none")}for(var i=0;i<$(".account-login.visible-recaptcha").length;i+=1){var n=$(".account-login.visible-recaptcha")[i];$(n).addClass("d-none")}document.querySelectorAll("#account_login_visible_recaptcha").forEach((function(e){$(e).addClass("d-none")})),$("body").trigger("Enable:VisibleRecaptchaButton","accountlogin")}$("#existing-usercheck-form-email").removeClass("is-invalid"),$("#existingUserCheckForm")[0].reset()}))},validateRegisterEmail:function(){"true"==$("input[name=restrictUnitedAccCreation]").val()&&$("body").on("focusout","#registration-form-email",(function(){var e=$
2(this).closest("div").find(".invalid-feedback-us");e.hasClass("d-none")||e.addClass("d-none"),$(this).val().match(/([a-z0-9]+@[united]+\.[a-z]{2,3})$/g)&&e.removeClass("d-none")}))},register:function(){$("form.registration").submit((function(e){if(E("#registration-form-password"))return!1;if($(".invalid-feedback-us").is(":visible"))return!1;var t=$(this);e.preventDefault();var r=t.attr("action");t.spinner().start();var i=t.find(":input:disabled").removeAttr("disabled"),n=t.serialize();return i.attr("disabled","disabled"),$("form.registration").trigger("login:register",e),$.ajax({url:r,type:"post",dataType:"json",data:n,success:function(e){t.spinner().stop(),e.success?($("form.registration").trigger("login:register:success",e),e.orderID&&(sessionStorage.setItem("showAccountFlyoutAfterLogin","true"),location.href=e.redirectUrl),$(".login-register").removeClass("register-active").removeClass("check-user-existence").removeClass("login-active").addClass("verify-account-active").removeClass("apple-login").removeClass("google-login"),$(".account-verification-notification.registration").html(e.message),$(".verify-your-acount-info").html(window.Resources.verificationemailsent+" "+e.email+" "+window.Resources.emailsentwithlink),$(".verify-your-acount-info").focus(),$("#resendVerificationMail [name=verificationMail]").val(e.email)):e.serverError?o($(".error-messaging"),e.errorMessage):($("form.registration").trigger("login:register:error",e),s(t,e)),c()},error:function(e){e.responseJSON&&(e.responseJSON.redirectUrl?window.location.href=e.responseJSON.redirectUrl:o($(".error-messaging"),e.responseJSON.errorMessage),c()),t.spinner().stop(),location.reload()}}),!1}))},resendAccountVerificationMail:function(){$("form#resendVerificationMail").submit((function(e){e.preventDefault();var t=$(this).attr("action")+"?verificationMail="+$(this).find("[name=verificationMail]").val();$.ajax({url:t,type:"get",dataType:"json",success:function(e){$(".verify-your-acount-info").html(window.Resources.resendVerificationText.replace("{mailPlaceHolder}",e.email))},error:function(e){}})}))},resetPassword:function(){$(".reset-password-form").submit((function(e){var t=$(this);e.preventDefault();var r=t.attr("action");return t.spinner().start(),$(".reset-password-form").trigger("login:register",e),$.ajax({url:r,type:"post",dataType:"json",data:t.serialize(),success:function(e){if(t.spinner().stop(),e.success)if(e.expiredForm){var r=$(".reset-password-form").attr("data-confirmationdesc"),i=$("#reset-password-email").val(),n=$(".reset-password-form").attr("data-backtologin");$(".request-password-body").addClass("d-none"),$(".confirmation-password-body").empty().append("<p>"+r+"</p>"),$(".reset-password-form").addClass("active"),$(".resetemail").text(i),$(".back-to-login").html('<a href="'+e.returnUrl+'" class="button button-secondary w-100">'+e.buttonText+"</a>")}else{var a=$(".reset-password-form").attr("data-confirmation");r=$(".reset-password-form").attr("data-confirmationdesc"),n=$(".reset-password-form").attr("data-backtologin");if($(".request-password-title").text(e.receivedMsgHeading),$(".request-password-body").addClass("d-none"),$(".confirmation-password-body").empty().append("<h6>"+a+"</h6><p>"+r+"</p>"),$(".reset-password-form").addClass("active"),e.mobile)$(".send-email-btn").empty().html('<a href="'+e.returnUrl+'" class="btn btn-primary btn-block">'+e.buttonText+"</a>");else{n=$(".reset-password-form").attr("data-backtologin");$("#submitEmailButton").text(n)}}else s(t,e)},error:function(){t.spinner().stop()}}),!1}))},clearResetForm:function(){$("#login .modal").on("hidden.bs.modal",(function(){$("#reset-password-email").val(""),$(".modal-dialog .form-control.is-invalid").removeClass("is-invalid")}))}
2,togglePassword:function(){var e=$(".toggle-password");e.each((function(){var e="pwd-toggle-tooltip-"+Math.random().toString(36).substr(2,9);$(this).after('<div id="'+e+'" role="tooltip" class="pwd-toggle-tooltip sr-only">Toggle password visibility</div>'),$(this).attr("aria-labelledby",e),$(this).removeAttr("title")})),e.on("touchstart keypress click",(function(e){if("touchstart"===e.type&&e.preventDefault(),13===e.which||"click"===e.type){var t=$(this);t.toggleClass("active");var r=t.closest(".form-group").find("input"),i="password"===r.attr("type")?"text":"password",n="password"===i?"Show password":"Hide password";t.attr("aria-pressed","text"===i),$("#"+t.attr("aria-labelledby")).text(n),r.attr("type",i)}}))},toggleCheckbox:function(){$("input:checkbox").on("keypress",(function(e){13!==e.which&&" "!==e.key&&"spacebar"!==e.key||$(this).prop("checked",!$(this).prop("checked"))}))},backtoLogin:function(){var e=document.querySelector("#password-reset"),t=document.querySelector(".return-to-login"),r=document.querySelector(".return-to-login-verification"),i=document.querySelector("#backtologin");e.addEventListener("click",(function(e){e.preventDefault();var t=$("#existing-usercheck-form-email").val();$("#reset-password-email").val(t),document.querySelector("#requestLoginModal .modal-body").classList.add("mlogin")})),t.addEventListener("click",(function(e){e.preventDefault(),S()})),r.addEventListener("click",(function(e){e.preventDefault(),w()})),i.addEventListener("click",(function(e){e.preventDefault(),$(".reset-password-form").removeClass("active"),$(".request-password-body").removeClass("d-none"),$("#reset-password-email").val(""),$(".confirmation-password-body").empty(),document.querySelector("#requestLoginModal .modal-body").classList.remove("mlogin")}))},initPasswordPluginForRegistration:function(){if(void 0===$.fn.pwstrength)return methods.log("initPasswordPluginForRegistration: plugin missing."),!1;var e=$("#registration-form-password");if(!e.length)return methods.log("initPasswordPluginForRegistration: target not found."),!1;var t;t={ui:{progressBarEmptyPercentage:0,useVerdictCssClass:!0,colorClasses:["danger","danger","warning","warning","success","success"],viewports:{progress:".pwstrength_progress"},showVerdictsInsideProgressBar:!0},rules:{wordUppercase:!0,wordThreeNumbers:!0,wordOneSpecialChar:!0,wordTwoSpecialChar:!0},common:{debug:!1,minChar:6}},e.pwstrength(t)},initiallPageLoadUpAccountVerification:function(){var e=window.location.href,t=new URL(e).searchParams;if(t.has("page")){var r=t.get("page"),i=!!t.has("message")&&t.get("message"),n=!!t.has("link")&&t.get("link"),a=!!t.has("linkName")&&t.get("linkName");"true"!==$(".user a[data-authenticated]").attr("data-authenticated")&&("login"===r&&$("#requestLoginModal").modal("show"),i&&"login"===r&&$(".account-verification-notification.login").html(i),n&&a&&"login"===r&&$(".account-verification-notification.user-check").html("".concat(i," <br/><a href='").concat(n,"'>").concat(a,"</a>")))}},validatePassword:function(){$("#registration-form-password").keyup((function(e){E("#registration-form-password")}))}},$(document).ready((function(){"true"===sessionStorage.getItem("showAccountFlyoutAfterLogin")&&(sessionStorage.removeItem("showAccountFlyoutAfterLogin"),$(document).ready((function(){var e=$
2("#signedInModal"),t=$("#myaccount");e.length&&t.length&&e.modal("show")})))}))},8854:(e,t,r)=>{function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}e=r.nmd(e),function(t){var r={};!function(e){"use strict";r.fallback={wordMinLength:$("input[name=wordMinLength]").val(),wordMaxLength:$("input[name=wordMaxLength]").val(),wordInvalidChar:$("input[name=wordInvalidChar]").val(),wordNotEmail:$("input[name=wordNotEmail]").val(),wordSimilarToUsername:$("input[name=wordSimilarToUsername]").val(),wordTwoCharacterClasses:$("input[name=wordTwoCharacterClasses]").val(),wordRepetitions:$("input[name=wordRepetitions]").val(),wordSequences:$("input[name=wordSequences]").val(),errorList:$("input[name=errorList]").val(),veryWeak:$("input[name=veryWeak]").val(),weak:$("input[name=weak]").val(),normal:$("input[name=normal]").val(),medium:$("input[name=medium]").val(),strong:$("input[name=strong]").val(),veryStrong:$("input[name=veryStrong]").val()},r.t=function(t){var i="";return(i=e?e.t(t):r.fallback[t])===t?"":i}}(window.i18next);var n={};!function(e){"use strict";var t={};n.forbiddenSequences=["0123456789","abcdefghijklmnopqrstuvwxyz","qwertyuiop","asdfghjkl","zxcvbnm","!@#$%^&*()_+"],t.w
2ordNotEmail=function(e,t,r){return t.match(/^([\w!#$%&'*+\-/=?^`{|}~]+\.)*[\w!#$%&'*+\-/=?^`{|}~]+@((((([a-z0-9]{1}[a-z0-9-]{0,62}[a-z0-9]{1})|[a-z])\.)+[a-z]{2,6})|(\d{1,3}\.){3}\d{1,3}(:\d{1,5})?)$/i)?r:0},t.wordMinLength=function(e,t,r){var i=t.length,n=Math.pow(i,e.rules.raisePower);return i<e.common.minChar&&(n+=r),n},t.wordMaxLength=function(e,t,r){var i=t.length,n=Math.pow(i,e.rules.raisePower);return i>e.common.maxChar?r:n},t.wordInvalidChar=function(e,t,r){return e.common.invalidCharsRegExp.test(t)?r:0},t.wordMinLengthStaticScore=function(e,t,r){return t.length<e.common.minChar?0:r},t.wordMaxLengthStaticScore=function(e,t,r){return t.length>e.common.maxChar?0:r},t.wordSimilarToUsername=function(t,r,i){var n=e(t.common.usernameField).val();return n&&r.toLowerCase().match(n.replace(/[-[\]/{}()*+=?:.\\^$|!,]/g,"\\$&").toLowerCase())?i:0},t.wordTwoCharacterClasses=function(e,t,r){var i=new RegExp("(."+e.rules.specialCharClass+")");if(t.match(/([a-z].*[A-Z])|([A-Z].*[a-z])/)||t.match(/([a-zA-Z])/)&&t.match(/([0-9])/)||t.match(i)&&t.match(/[a-zA-Z0-9_]/))return r},t.wordRepetitions=function(e,t,r){return t.match(/(.)\1\1/)?r:0},t.wordSequences=function(t,r,i){var a,s=!1;return r.length>2&&(e.each(n.forbiddenSequences,(function(t,i){var n;s||(n=[i,i.split("").reverse().join("")],e.each(n,(function(e,t){for(a=0;a<r.length-2;a+=1)t.indexOf(r.toLowerCase().substring(a,a+3))>-1&&(s=!0)})))})),s)?i:0},t.wordLowercase=function(e,t,r){return t.match(/[a-z]/)&&r},t.wordUppercase=function(e,t,r){return t.match(/[A-Z]/)&&r},t.wordOneNumber=function(e,t,r){return t.match(/\d+/)&&r},t.wordThreeNumbers=function(e,t,r){return t.match(/(.*[0-9].*[0-9].*[0-9])/)&&r},t.wordOneSpecialChar=function(e,t,r){var i=new RegExp(e.rules.specialCharClass);return t.match(i)&&r},t.wordTwoSpecialChar=function(e,t,r){var i=new RegExp("(.*"+e.rules.specialCharClass+".*"+e.rules.specialCharClass+")");return t.match(i)&&r},t.wordUpperLowerCombo=function(e,t,r){return t.match(/([a-z].*[A-Z])|([A-Z].*[a-z])/)&&r},t.wordLetterNumberCombo=function(e,t,r){return t.match(/([a-zA-Z])/)&&t.match(/([0-9])/)&&r},t.wordLetterNumberCharCombo=function(e,t,r){var i=new RegExp("([a-zA-Z0-9].*"+e.rules.specialCharClass+")|("+e.rules.specialCharClass+".*[a-zA-Z0-9])");return t.match(i)&&r},t.wordIsACommonPassword=function(t,r,i){return e.inArray(r,t.rules.commonPasswords)>=0?i:0},n.validation=t,n.executeRules=function(t,r){var i=0;return e.each(t.rules.activated,(function(a,s){var o,l,u,d;s&&(o=t.rules.scores[a],"function"!=typeof(l=n.validation[a])&&(l=t.rules.extra[a]),"function"==typeof l&&((u=l(t,r,o))&&(i+=u),(u<0||!e.isNumeric(u)&&!u)&&(d=t.ui.spanError(t,a)).length>0&&t.instances.errors.push(d)))})),i}}(t);try{e&&e.exports&&(e.exports=n)}catch(e){}var a={common:{}};a.common.minChar=6,a.common.maxChar=20,a.common.usernameField="#username",a.common.invalidCharsRegExp=new RegExp(/[\s,'"]/),a.common.userInputs=[],a.common.onLoad=void 0,a.common.onKeyUp=void 0,a.common.onScore=void 0,a.common.zxcvbn=!1,a.common.zxcvbnTerms=[],a.common.events=["keyup","change","paste"],a.common.debug=!1,a.rules={},a.rules.extra={},a.rules.scores={wordNotEmail:-100,wordMinLength:-50,wordMaxLength:-50,wordInvalidChar:-100,wordSimilarToUsername:-100,wordSequences:-20,wordTwoCharacterClasses:2,wordRepetitions:-25,wordLowercase:1,wordUppercase:3,wordOneNumber:3,wordThreeNumbers:5,wordOneSpecialChar:3,wordTwoSpecialChar:5,wordUpperLowerCombo:2,wordLetterNumberCombo:2,wordLetterNumberCharCombo:2,wordIsACommonPassword:-100},a.rules.activated={wordNotEmail:!0,wordMinLength:!0,wordMaxLength:!1,wordInvalidChar:!1,wordSimilarToUsername:!0,wordSequences:!0,wordTwoCharacterClasses:!0,wordRepetitions:!0,wordLowercase:!0,wordUppercase:!0,wordOneNumber:!0,wordThreeNumbers:!0,wordOneSpecialChar:!0,wordTwoSpecialChar:!0,wordUpperLowerCombo:!0,wordLetterNumberCombo:!0,wordLetterNumberCharCombo:!0,wordIsACommonPassword:!0},a.rules.raisePower=1.4,a.rules.specialCharClass="[!,@,#,$,%,^,&,*,?,_,~]",a.rules.commonPasswords=["123456","password","12345678","qwerty","123456789","12345","1234","111111","1234567","dragon","123123","baseball","abc123","football","monkey","letmein","696969","shadow","master","666666","qwertyuiop","123321","mustang","1234567890","michael","654321","pussy","superman","1qaz2wsx","7777777","fuckyou","121212","000000","qazwsx","123qwe","killer","trustno1","jordan","jennifer","zxcvbnm","asdfgh","hunter","buster","soccer","harley","batman","andrew","tigger","sunshine","iloveyou","fuckme","2000","charlie","robert","thomas","hockey","ranger","daniel","starwars","klaster","112233","george","asshole","computer","michelle","jessica","pepper","1111","zxcvbn","555555","11111111","131313","freedom","777777","pass","fuck","maggie","159753","aaaaaa","ginger","princess","joshua","cheese","amanda","summer","love","ashley","6969","nicole","chelsea","biteme","matthew","access","yankees","987654321","dallas","austin","thunder","taylor","matrix"],a.ui={},a.ui.bootstrap2=!1,a.ui.bootstrap3=!1,a.ui.colorClasses=["danger","danger","danger","warning","warning","success"],a.ui.showProgressBar=!0,a.ui.progressBarEmptyPercentage=1,a.ui.progressBarMinWidth=1,a.ui.progressBarMinPercentage=1,a.ui.progressExtraCssClasse
2s="",a.ui.progressBarExtraCssClasses="",a.ui.showPopover=!1,a.ui.popoverPlacement="bottom",a.ui.showStatus=!1,a.ui.spanError=function(e,t){"use strict";var r=e.i18n.t(t);return r?'<span style="color: #d52929">'+r+"</span>":""},a.ui.popoverError=function(e){"use strict";var r=e.instances.errors,i="<div>"+e.i18n.t("errorList")+'<ul class="error-list" style="margin-bottom: 0;">';return t.each(r,(function(e,t){i+="<li>"+t+"</li>"})),i+="</ul></div>"},a.ui.showVerdicts=!0,a.ui.showVerdictsInsideProgressBar=!1,a.ui.useVerdictCssClass=!1,a.ui.showErrors=!1,a.ui.showScore=!1,a.ui.container=void 0,a.ui.viewports={progress:void 0,verdict:void 0,errors:void 0,score:void 0},a.ui.scores=[0,14,26,38,50],a.i18n={},a.i18n.t=r.t;var s={};!function(e){"use strict";var t=["error","warning","success"],r=["veryWeak","weak","normal","medium","strong","veryStrong"];s.getContainer=function(t,r){var i;return(i=e(t.ui.container))&&1===i.length||(i=r.parent()),i},s.findElement=function(e,t,r){return t?e.find(t).find(r):e.find(r)},s.getUIElements=function(e,t){var r,i;return e.instances.viewports?e.instances.viewports:(r=s.getContainer(e,t),(i={}).$progressbar=s.findElement(r,e.ui.viewports.progress,"div.progress"),e.ui.showVerdictsInsideProgressBar&&(i.$verdict=i.$progressbar.find("span.password-verdict")),e.ui.showPopover||(e.ui.showVerdictsInsideProgressBar||(i.$verdict=s.findElement(r,e.ui.viewports.verdict,"span.password-verdict")),i.$errors=s.findElement(r,e.ui.viewports.errors,"ul.error-list")),i.$score=s.findElement(r,e.ui.viewports.score,"span.password-score"),e.instances.viewports=i,i)},s.initHelper=function(t,r,i,n){var a=s.getContainer(t,r);n?a.find(n).append(i):e(i).insertAfter(r)},s.initVerdict=function(e,t){s.initHelper(e,t,'<span class="password-verdict"></span>',e.ui.viewports.verdict)},s.initErrorList=function(e,t){s.initHelper(e,t,'<ul class="error-list"></ul>',e.ui.viewports.errors)},s.initScore=function(e,t){s.initHelper(e,t,'<span class="password-score"></span>',e.ui.viewports.score)},s.initUI=function(e,t){e.ui.showPopover?s.initPopover(e,t):(e.ui.showErrors&&s.initErrorList(e,t),e.ui.showVerdicts&&!e.ui.showVerdictsInsideProgressBar&&s.initVerdict(e,t)),e.ui.showProgressBar&&s.initProgressBar(e,t),e.ui.showScore&&s.initScore(e,t)},s.updateVerdict=function(e,t,r,i){var n=s.getUIElements(e,t).$verdict;n.removeClass(e.ui.colorClasses.join(" ")),r>-1&&n.addClass(e.ui.colorClasses[r]),e.ui.showVerdictsInsideProgressBar&&n.css("white-space","nowrap"),n.html(i)},s.updateErrors=function(t,r,i){var n=s.getUIElements(t,r).$errors,a="";i||e.each(t.instances.errors,(function(e,t){a+="<li>"+t+"</li>"})),n.html(a)},s.updateScore=function(e,t,r,i){var n=s.getUIElements(e,t).$score,a="";i||(a=r.toFixed(2)),n.html(a)},s.updateFieldStatus=function(r,i,n,a){var o=i;r.ui.bootstrap2?o=i.parents(".control-group").first():r.ui.bootstrap3&&(o=i.parents(".form-group").first()),e.each(t,(function(e,t){t=s.cssClassesForBS(r,t),o.removeClass(t)})),a||(n=t[Math.floor(n/2)],n=s.cssClassesForBS(r,n),o.addClass(n))}
2,s.cssClassesForBS=function(e,t){return e.ui.bootstrap3?t="has-"+t:e.ui.bootstrap2||("error"===t&&(t="danger"),t="border-"+t),t},s.getVerdictAndCssClass=function(e,t){var i,n;return void 0===t?["",0]:(i=t<=e.ui.scores[0]?0:t<e.ui.scores[1]?1:t<e.ui.scores[2]?2:t<e.ui.scores[3]?3:t<e.ui.scores[4]?4:5,n=r[i],[e.i18n.t(n),i])},s.updateUI=function(e,t,r){var i,n,a;i=s.getVerdictAndCssClass(e,r),n=0===r?"":i[0],i=i[1],a=e.ui.useVerdictCssClass?i:-1,e.ui.showProgressBar&&s.showProgressBar(e,t,r,i,a,n),e.ui.showStatus&&s.updateFieldStatus(e,t,i,void 0===r),e.ui.showPopover?s.updatePopover(e,t,n,void 0===r):(e.ui.showVerdicts&&!e.ui.showVerdictsInsideProgressBar&&s.updateVerdict(e,t,a,n),e.ui.showErrors&&s.updateErrors(e,t,void 0===r)),e.ui.showScore&&s.updateScore(e,t,r,void 0===r)}}(t),function(e){"use strict";s.percentage=function(e,t,r){var i=Math.floor(100*t/r),n=e.ui.progressBarMinPercentage;return i=(i=i<=n?n:i)>100?100:i},s.initProgressBar=function(t,r){var i=s.getContainer(t,r),n='<div class="progress ';t.ui.bootstrap2?n+=t.ui.progressBarExtraCssClasses+'"><div class="':n+=t.ui.progressExtraCssClasses+'"><div class="'+t.ui.progressBarExtraCssClasses+" progress-",n+='bar">',t.ui.showVerdictsInsideProgressBar&&(n+='<span class="password-verdict"></span>'),n+="</div></div>",t.ui.viewports.progress?i.find(t.ui.viewports.progress).append(n):e(n).insertAfter(r)},s.showProgressBar=function(e,t,r,i,n,a){var o;o=void 0===r?e.ui.progressBarEmptyPercentage:s.percentage(e,r,e.ui.scores[4]),s.updateProgressBar(e,t,i,o),e.ui.showVerdictsInsideProgressBar&&s.updateVerdict(e,t,n,a)},s.updateProgressBar=function(t,r,i,n){var a=s.getUIElements(t,r).$progressbar,o=a.find(".progress-bar"),l="progress-";t.ui.bootstrap2&&(o=a.find(".bar"),l=""),e.each(t.ui.colorClasses,(function(e,r){t.ui.bootstrap2||t.ui.bootstrap3?o.removeClass(l+"bar-"+r):o.removeClass("bg-"+r)})),t.ui.bootstrap2||t.ui.bootstrap3?o.addClass(l+"bar-"+t.ui.colorClasses[i]):o.addClass("bg-"+t.ui.colorClasses[i]),n>0?o.css("min-width",t.ui.progressBarMinWidth+"px"):o.css("min-width",""),o.css("width",n+"%")}}(t),function(){"use strict";s.initPopover=function(e,t){try{t.popover("destroy")}catch(e){t.popover("dispose")}t.popover({html:!0,placement:e.ui.popoverPlacement,trigger:"manual",content:" "})},s.updatePopover=function(e,t,r,i){var n=t.data("bs.popover"),a="",s=!0,o=!1;e.ui.showVerdicts&&!e.ui.showVerdictsInsideProgressBar&&r.length>0&&(a='<h5><span class="password-verdict">'+r+"</span></h5>",s=!1),e.ui.showErrors&&(e.instances.errors.length>0&&(s=!1),a+=e.ui.popoverError(e)),s||i?t.popover("hide"):(e.ui.bootstrap2?n=t.data("popover"):n||(n=bootstrap.Popover.getInstance(t[0]),o=!0),(o?$(n.tip).is(":visible"):n.$arrow&&n.$arrow.parents("body").length>0)?o?$(n.tip).find(".popover-body").html(a):t.find("+ .popover .popover-content").html(a):(e.ui.bootstrap2||e.ui.bootstrap3?n.options.content=a:o?n._config.content=a:n.config.content=a,t.popover("show")))}}();var o={};!function(e){"use strict";var t,r,l;t=function(t){var r,i,a,o,l=e(t.target),u=l.data("pwstrength-bootstrap"),d=l.val();void 0!==u&&(u.instances.errors=[],0===d.length?o=void 0:(u.common.zxcvbn?(r=[],e.each(u.common.userInputs.concat([u.common.usernameField]),(function(t,i){var n=e(i).val();n&&r.push(n)})),r=r.concat(u.common.zxcvbnTerms),o=zxcvbn(d,r).guesses,o=Math.log(o)*Math.LOG2E):o=n.executeRules(u,d),"function"==typeof u.common.onScore&&(o=u.common.onScore(u,d,o))),s.updateUI(u,l,o),a=(i=s.getVerdictAndCssClass(u,o))[1],i=i[0],u.common.debug&&console.log(o+" - "+i),"function"==typeof u.common.onKeyUp&&u.common.onKeyUp(t,{score:o,verdictText:i,verdictLevel:a}))},r=function(r){var i,n=e(r.target),a=n.val(),s=0;i=function(){n.val()!==a?t(r):s<3&&(s+=1,setTimeout(i,100))},setTimeout(i,100)},o.init=function(i){return this.each((function(n,o){var l=e.extend(!0,{},a),u=e.extend(!0,l,i),d=e(o);u.instances={},d.data("pwstrength-bootstrap",u),e.each(u.common.events,(function(e,i){var n="paste"===i?r:t;d.on(i,n)})),s.initUI(u,d),d.trigger("keyup"),"function"==typeof u.common.onLoad&&u.common.onLoad()})),this},o.destroy=function(){return this.each((function(t,r){var i=e(r),n=i.data("pwstrength-bootstrap"),a=s.getUIElements(n,i);a.$progressbar.remove(),a.$verdict.remove(),a.$errors.remove(),i.removeData("pwstrength-bootstrap")})),this},o.forceUpdate=function(){return this.each((function(e,r){t({target:r})})),this},o.addRule=function(t,r,i,n){return this.each((function(a,s){var o=e(s).data("pwstrength-bootstrap");o.rules.activated[t]=n,o.rules.scores[t]=i,o.rules.extra[t]=r})),this},l=function(t,r,i){this.each((function(n,a){e(a).data("pwstrength-bootstrap").rules[r][t]=i}))},o.changeScore=function(e,t){return l.call(this,e,"scores",t),this},o.ruleActive=function(e,t){return l.call(this,e,"activated",t),this},o.ruleIsMet=function(t){var r=0;return"wordMinLength"===t?t="wordMinLengthStaticScore":"wordMaxLength"===t&&(t="wordMaxLengthStaticScore"),this.each((function(i,a){var s,o=e(a).data("pwstrength-bootstrap"),l=n.validation[t];"function"!=typeof l&&(l=o.rules.extra[t]),"function"==typeof l&&(s=l(o,e(a).val(),1),e.isNumeric(s)&&(r+=s))})),r===this.length},e.fn.pwstrength=function(t){var r;return o[t]?r=o[t].apply(this,Array.prototype.slice.call(arguments,1
2)):"object"!==i(t)&&t?e.error("Method "+t+" does not exist on jQuery.pwstrength-bootstrap"):r=o.init.apply(this,arguments),r}}(t)}(jQuery)},4191:e=>{"use strict";var t=$(".compare-bar-wrapper"),r=[],i=$("button.compare").text(),n=location.href,a=parseInt($(".compare-bar").data("max-slots"),10);$(window).width()<640&&(a-=1);var s=$("<div>",{class:"sr-only","aria-live":"polite","aria-atomic":"true",id:"compare-announcer",role:"status"}).appendTo(document.body);function o(e){var t=e.map((function(e,t){return function(e,t){var r=e.pid,i="pid"+t;return'<div class="col-6 col-sm-4 selected-product"><div class="slot" data-pid="'+r+'"><div class="img-wrapper"><img alt="'+(e.altText?e.altText:e.categoryTitle)+'" src="'+e.imgSrc+'"></div><div class="content"><p class="product-category">'+e.categoryName+'</p><p class="product-title">'+e.categoryTitle+'</p><a class="close" role="button" tabindex="0" aria-label="remove '+(e.altText?e.altText:e.categoryTitle)+' from compare list">'+window.Resources.removeitem+'</a><a class="close-mobile" aria-label="remove"></a></div></div><input type="hidden" name="'+i+'" value="'+r+'"></div>\n'}(e,t)})).join("");if(e.length<a)for(var r=a-e.length,i=0;i<r;i++)0===i&&e.length<2?t+='<div class="col-6 col-sm-4 selected-product"><div class="slot"><div class="min-products-msg">'+$(".compare-bar").data("min-products-msg")+"</div></div></div>":t+='<div class="col-6 col-sm-4 selected-product"><div class="slot"></div></div>';$(".compare-bar .product-slots").empty().append(t)}function l(e){e>0?$("button.compare").text(i+"("+e+")"):$("button.compare").text(i),e<2?$("button.compare").attr("disabled",!0).removeClass("active"):$("button.compare").attr("disabled",!1).addClass("active")}function u(e){return e.map((function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r]})),t}))}function d(e,r){var i=u(e)||[];return i=i.filter((function(e){return e.pid!==r})),setTimeout((function(){s.html(""),setTimeout((function(){s.html("Product removed. "+i.length+" of "+a+" products selected for comparison.")}),100)}),100),0===i.length&&t.hide(),$("input#compare_"+r).prop("checked",!1),$("input[type=checkbox]:not(:checked)").removeAttr("disabled"),o(i),l(i.length),i}function c(e){r.forEach((function(e){$(this).trigger("compare:deselected",{pid:e.pid})})),r=[],$(".compare input").prop("checked",!1),$(".compare input[type=checkbox]:not(:checked)").removeAttr("disabled"),f(r),t.hide(),s.html(" "),0===e.detail&&$(".footer").find("a")[0].focus(),setTimeout((function(){s.html("Product comparison closed.")}),1e3)}
2function h(){var e=$("#cgidName").val();return"null"!==e&&void 0!==e||(e=$("#qName").val()),e}function f(e){var t="";if(e.length>0){for(var r=0;r<e.length-1;r+=1)t+=e[r].pid+",";t+=e[e.length-1].pid}var i=h();""!==t&&"null"!==i&&void 0!==i&&localStorage.setItem("compare_"+i,t),""===t&&localStorage.removeItem("compare_"+i)}function g(e){var t=$("#turnToCustomDimensionList").val()&&JSON.parse($("#turnToCustomDimensionList").val())?JSON.parse($("#turnToCustomDimensionList").val()):[],r=!1;return Object.keys(t).forEach((function(i){t[i]==e&&(r=!0)})),r}function v(e,t){e.length===t.length&&e.css("height","0")}e.exports={handleCompareClick:function(){$("div.page").on("click",".compare input[type=checkbox]",(function(){var e=$(this).is(":checked"),i=$(this).attr("data-pid"),n=$(this).attr("data-categoryname"),c=$(this).attr("data-categorytitle"),h=$(this).attr("data-imgsrc"),g=$(this).attr("data-alttext");e?(r=function(e,r,i,n,d,c){var h=u(e)||[];return h.length<a&&(h.push({pid:r,imgSrc:i,altText:n,categoryName:d,categoryTitle:c}),setTimeout((function(){s.html(""),setTimeout((function(){s.html("Product comparison opened. "+h.length+" of "+a+" products selected. Navigate to the Product Comparison landmark to access the comparison tray at the bottom of the page.")}),100)}),100),h.length===a&&$(".product-tile input[type=checkbox]:not(:checked)").attr("disabled",!0),o(h),l(h.length),t.show()),h}(r,i,h,g,n,c),$(this).trigger("compare:selected",{pid:i,imgSrc:h,altText:g,categoryName:n,categoryTitle:c})):(r=d(r,i),$(this).trigger("compare:deselected",{pid:i})),f(r)})),$(document).ready((function(){var e=h();if("null"!==e&&void 0!==e){var t=localStorage.getItem("compare_"+e);if(""!==t&&void 0!==t&&"null"!==t&&null!==t){var r=t.split(",");for(var i in r)$('.compare input[type=checkbox][data-pid = "'+r[i]+'"]').prop("checked",!1).trigger("click")}}var n=$("#turntoCDNUrl").val(),a=$("#turntoSiteAuthKey").val(),s=$("#turnToLocale").val(),o=$(".ratings-compare");for(i=0;i<o.length;i++){var l=o[i],u=n+a+"/"+$(l).attr("data-pid")+"/d/review/summary/"+s+"?";$(".rating-description").spinner().start(),$.ajax({url:u,method:"GET",success:function(e){var t="",r="",i=e&&e.catItem&&e.catItem.sku||"";if(e&&e.rating||0==e.rating){var n=e.rating/5*100;r='<div class="ratings"><div class="stars"><span class="rating-value" style="width: '.concat(n,'%;"></span></div><div class="count">(').concat(e.reviewsCount,")</div></div>"),$('.ratings-compare[data-pid="'+i+'"]').find(".reviews-section").html(r)}if(e&&e.customDimensions&&e.customDimensions.length>0){for(var a=0;a<e.customDimensions.length;a++){var s=e.customDimensions[a].label;if(g(s)){t+='<div class="rating-info"><div class="label">'.concat(s,"</div>"),t+='<div class="span-info">';var o=e.customDimensions[a].values;if(o&&o.length>0)for(var l=0;l<o.length;l++){var u=o[l];t+='<span class="custom-value"> '.concat(u.label," (").concat(u.count,") </span>")}t+="</div></div></div>"}}i=e.catItem.sku;$('.ratings-compare[data-pid="'+i+'"]').find(".rating-description").html(t)}$(".rating-description").spinner().stop()},error:function(e){console.log(e),$(".rating-description").spinner().stop()}})}}))},handleClearAll:function(){$(".compare-bar a.clear-all").on("click",(function(e){e.preventDefault(),c(e)}))},deselectProductOnCompareBar:function(){$(".compare-bar").off("click",".close").on("click",".close",(function(e){var t=$(e.target).closest(".slot").attr("data-pid");r=d(r,t),$(this).trigger("compare:deselected",{pid:t}),f(r)}))},deselectProductOnCompareBarMobile:function(){$(".compare-bar").off("click",".close-mobile").on("click",".close-mobile",(function(e){var t=$(e.target).closest(".slot").attr("data-pid");r=d(r,t),$(this).trigger("compare:deselected",{pid:t}),f(r)}))},selectCheckedProducts:function(){},setBackUrl:function(){$(".search-results").on("click",".refinements a",(function(){$('input[name="backUrl"]').val($(this).prop("href"))}))},setPushState:function(){$(".compare-products-form").on("submit",(function(){var e,t;e=$(".compare-products-form"),(t=e.attr("action").split("?"))[1]&&(t[1].split("&").forEach((function(t){var r=t.split("="),i=decodeURIComponent(r[0]),n=decodeURIComponent(r[1]);i&&n&&0===e.find('[name="'+i+'"]').length&&e.append('<input type="hidden" name="'+i+'" value="'+n+'" />')})),e.attr("action",t[0])),window.location.href.indexOf("Wishlist-Show")>
20&&e.append('<input type="hidden" name="isFromWhishlist" value="true" />');var r=$(".compare input:checked").map((function(){return this.id})).get().join(","),i=sessionStorage.getItem("filterParam");i?(n=n.split("?")[0],n+="?"+i,sessionStorage.removeItem("filterParam")):n=location.href.split("#")[0],history.pushState({},document.title,n+"#"+r),location.hash=r,$(this).find('input[name="cgid"]').attr("value",$("input.category-id").val())}))},catchFilterChange:function(){$(".container").on("click",".refinements li a, .refinement-bar a.reset",(function(e){e.preventDefault(),c(e)}))},listenToFilterChange:function(){$("body").on("search:filter",(function(e,t){n=t.currentTarget.href}))},handleMeasurementClick:function(){$("div.page").on("click",".measurement-selection input[type=radio]",(function(){$(this).attr("data-id");for(var e=$(".content.basicspecifications"),t=$(".content.basicspecificationsmetric"),r=0;r<e.length;r++){var i=$(e[r]).find(".content-attr"),n=$(t[r]).find(".content-attr"),a=$(n).html(),s=$(i).html();$(i).html(a),$(n).html(s)}}))},handleRemoveProductClick:function(){$("div.page").on("click",".compare-product-romove",(function(e){e.preventDefault();var t=$(this).attr("data-pid"),r=$('.product-comparison .compare-detail-product[data-pid="'+t+'"]');if(1!=$(".product-comparison .compare-detail-product").length){var i=$('.product-comparison .compare-attr-detail-product[data-pid="'+t+'"]');r.remove(),i.remove(),$(".product-compared-suggestions").removeClass("invisible")}else window.history.back()}))},defaultFunctionality:function(){$("#imperial").prop("checked",!0)}
2,updateRatingValue:function(){var e=$(".rating-value").attr("data-rating")/5*100;$(".rating-value").css("width",e+"%")},updateMouseMove:function(){$(document).on("mouseenter",".compare-attr-detail-product .image-container .image-carousel",(function(e){var t=$(e.target),r=t.attr("data-final-image"),i=t.attr("data-swatch-id");t.closest(".product-tile").find(".image-wrapper").show(),t.closest(".product-tile").find(".pagination span."+i).addClass("active"),t.closest(".product-tile").find(".primary-image img").attr("src",r)})),$(document).on("mouseout",".compare-attr-detail-product .image-container .primary-image",(function(e){var t=$(e.target),r=t.attr("data-master-image");t.closest(".product-tile").find(".primary-image img").attr("src",r),t.closest(".product-tile").find(".pagination span").removeClass("active")}))},updateEmptyMetalDesc:function(){v($(".only-basic-feature:visible"),$(".only-basic-feature.no-space:visible")),v($(".only-collection-feature:visible"),$(".only-collection-feature.no-space-collection:visible"))},validateAddToCompare:function(){setTimeout((function(){3===r.length&&$(".product-tile input[type=checkbox]:not(:checked)").attr("disabled",!0)}),0)}}},1965:(e,t,r)=>{"use strict";function i(e){e&&e.querySelectorAll(".einstein-wrapper").forEach((function(e){if(!$(e).hasClass("swiper-initialized"))if($(e).parents("#miniCartModal").length)new swiperCarousel.Swiper(e,{modules:[swiperCarousel.Navigation],slidesPerView:2.35,slidesPerGroup:2,watchSlidesProgress:!0,a11y:!0,keyboard:{enabled:!0},breakpoints:{768:{slidesPerView:2,slidesPerGroup:2}},navigation:{nextEl:e.closest(".einstein-carousel-container").querySelector(":scope > .collections-next"),prevEl:e.closest(".einstein-carousel-container").querySelector(":scope > .collections-prev")},on:{init:function(){var e=this.navigation.nextEl,t=this.navigation.prevEl;e&&t&&(e.setAttribute("tabindex",-!!e.classList.contains("swiper-button-disabled")),e.setAttribute("aria-disabled",e.classList.contains("swiper-button-disabled")),t.setAttribute("tabindex",-!!t.classList.contains("swiper-button-disabled")),t.setAttribute("aria-disabled",t.classList.contains("swiper-button-disabled")))},slideChangeTransitionEnd:function(){var e=this.navigation.nextEl,t=this.navigation.prevEl;e&&t&&(e.setAttribute("tabindex",-!!e.classList.contains("swiper-button-disabled")),e.setAttribute("aria-disabled",e.classList.contains("swiper-button-disabled")),t.setAttribute("tabindex",-!!t.classList.contains("swiper-button-disabled")),t.setAttribute("aria-disabled",t.classList.contains("swiper-button-disabled")))}
2,slideChange:function(){var e=$(this.$el);setTimeout((function(){e.parent(".einstein-carousel").find(".swiper-slide-visible").first().find(".image-container a").focus()}),300),$(this.$el).parent(".einstein-carousel").find(".swiper-slide")&&($(this.$el).parent(".einstein-carousel").find(".swiper-slide").find("a").attr("tabindex","-1"),$(this.$el).parent(".einstein-carousel").find(".swiper-slide").find("button").attr("tabindex","-1"),$(this.$el).parent(".einstein-carousel").find(".swiper-slide.swiper-slide-visible").find("a").attr("tabindex","0"),$(this.$el).parent(".einstein-carousel").find(".swiper-slide.swiper-slide-visible .image-container").find("a").attr("tabindex","-1"),$(this.$el).parent(".einstein-carousel").find(".swiper-slide.swiper-slide-visible").find("button").attr("tabindex","0"))}}});else if($(e).parents("#pdp-above-fold-reco").length)new swiperCarousel.Swiper(e,{modules:[swiperCarousel.Navigation],slidesPerView:2.5,slidesPerGroup:2,watchSlidesProgress:!0,a11y:!0,keyboard:{enabled:!0},breakpoints:{768:{slidesPerView:3,slidesPerGroup:3}},navigation:{nextEl:e.closest(".einstein-carousel-container").querySelector(":scope > .collections-next"),prevEl:e.closest(".einstein-carousel-container").querySelector(":scope > .collections-prev")},on:{init:function(){var e=this.navigation.nextEl,t=this.navigation.prevEl;e&&t&&(e.setAttribute("tabindex",-!!e.classList.contains("swiper-button-disabled")),e.setAttribute("aria-disabled",e.classList.contains("swiper-button-disabled")),t.setAttribute("tabindex",-!!t.classList.contains("swiper-button-disabled")),t.setAttribute("aria-disabled",t.classList.contains("swiper-button-disabled")))},slideChangeTransitionEnd:function(){var e=this.navigation.nextEl,t=this.navigation.prevEl;e&&t&&(e.setAttribute("tabindex",-!!e.classList.contains("swiper-button-disabled")),e.setAttribute("aria-disabled",e.classList.contains("swiper-button-disabled")),t.setAttribute("tabindex",-!!t.classList.contains("swiper-button-disabled")),t.setAttribute("aria-disabled",t.classList.contains("swiper-button-disabled")))}
2,slideChange:function(){var e=$(this.$el);setTimeout((function(){e.parent(".einstein-carousel").find(".swiper-slide-visible").first().find(".image-container a").focus()}),300),$(this.$el).parent(".einstein-carousel").find(".swiper-slide")&&($(this.$el).parent(".einstein-carousel").find(".swiper-slide").find("a").attr("tabindex","-1"),$(this.$el).parent(".einstein-carousel").find(".swiper-slide").find("button").attr("tabindex","-1"),$(this.$el).parent(".einstein-carousel").find(".swiper-slide.swiper-slide-visible").find("a").attr("tabindex","0"),$(this.$el).parent(".einstein-carousel").find(".swiper-slide.swiper-slide-visible .image-container").find("a").attr("tabindex","-1"),$(this.$el).parent(".einstein-carousel").find(".swiper-slide.swiper-slide-visible").find("button").attr("tabindex","0"))}}});else if("cartpage"!==window.pageContext.type)new swiperCarousel.Swiper(e,{modules:[swiperCarousel.Navigation],slidesPerView:2.5,slidesPerGroup:2,watchSlidesProgress:!0,a11y:!0,keyboard:{enabled:!0},breakpoints:{768:{slidesPerView:4,slidesPerGroup:4}},navigation:{nextEl:e.closest(".einstein-carousel-container").querySelector(":scope > .collections-next"),prevEl:e.closest(".einstein-carousel-container").querySelector(":scope > .collections-prev")},on:{init:function(){var e=this.navigation.nextEl,t=this.navigation.prevEl;e&&t&&(e.setAttribute("tabindex",-!!e.classList.contains("swiper-button-disabled")),e.setAttribute("aria-disabled",e.classList.contains("swiper-button-disabled")),t.setAttribute("tabindex",-!!t.classList.contains("swiper-button-disabled")),t.setAttribute("aria-disabled",t.classList.contains("swiper-button-disabled")))},slideChangeTransitionEnd:function(){var e=this.navigation.nextEl,t=this.navigation.prevEl;e&&t&&(e.setAttribute("tabindex",-!!e.classList.contains("swiper-button-disabled")),e.setAttribute("aria-disabled",e.classList.contains("swiper-button-disabled")),t.setAttribute("tabindex",-!!t.classList.contains("swiper-button-disabled")),t.setAttribute("aria-disabled",t.classList.contains("swiper-button-disabled")))}
2,slideChange:function(){var e=$(this.$el);setTimeout((function(){e.parent(".einstein-carousel").find(".swiper-slide-visible").first().find(".image-container a").focus()}),300),$(this.$el).parent(".einstein-carousel").find(".swiper-slide")&&($(this.$el).parent(".einstein-carousel").find(".swiper-slide").find("a").attr("tabindex","-1"),$(this.$el).parent(".einstein-carousel").find(".swiper-slide").find("button").attr("tabindex","-1"),$(this.$el).parent(".einstein-carousel").find(".swiper-slide.swiper-slide-visible").find("a").attr("tabindex","0"),$(this.$el).parent(".einstein-carousel").find(".swiper-slide.swiper-slide-visible .image-container").find("a").attr("tabindex","-1"),$(this.$el).parent(".einstein-carousel").find(".swiper-slide.swiper-slide-visible").find("button").attr("tabindex","0"))}}});else new swiperCarousel.Swiper(e,{modules:[swiperCarousel.Navigation],slidesPerView:2.5,slidesPerGroup:1,watchSlidesProgress:!0,a11y:{prevSlideMessage:e.closest(".einstein-carousel-container").querySelector(":scope > .collections-prev"),nextSlideMessage:e.closest(".einstein-carousel-container").querySelector(":scope > .collections-next")},keyboard:{enabled:!0},breakpoints:{768:{slidesPerView:2,slidesPerGroup:2}},navigation:{nextEl:e.closest(".einstein-carousel-container").querySelector(":scope > .collections-next"),prevEl:e.closest(".einstein-carousel-container").querySelector(":scope > .collections-prev")},on:{init:function(){var e=this.navigation.nextEl,t=this.navigation.prevEl;e&&t&&(e.setAttribute("tabindex",-!!e.classList.contains("swiper-button-disabled")),e.setAttribute("aria-disabled",e.classList.contains("swiper-button-disabled")),t.setAttribute("tabindex",-!!t.classList.contains("swiper-button-disabled")),t.setAttribute("aria-disabled",t.classList.contains("swiper-button-disabled")))},slideChangeTransitionEnd:function(){var e=this.navigation.nextEl,t=this.navigation.prevEl;e&&t&&(e.setAttribute("tabindex",-!!e.classList.contains("swiper-button-disabled")),e.setAttribute("aria-disabled",e.classList.contains("swiper-button-disabled")),t.setAttribute("tabindex",-!!t.classList.contains("swiper-button-disabled")),t.setAttribute("aria-disabled",t.classList.contains("swiper-button-disabled")))}
2,slideChange:function(){var e=$(this.$el);setTimeout((function(){e.parent(".einstein-carousel").find(".swiper-slide-visible").first().find(".product-tile-title a").focus()}),300),$(this.$el).parent(".einstein-carousel").find(".swiper-slide")&&($(this.$el).parent(".einstein-carousel").find(".swiper-slide").find("a").attr("tabindex","-1"),$(this.$el).parent(".einstein-carousel").find(".swiper-slide").find("button").attr("tabindex","-1"),$(this.$el).parent(".einstein-carousel").find(".swiper-slide.swiper-slide-visible").find("a").attr("tabindex","0"),$(this.$el).parent(".einstein-carousel").find(".swiper-slide.swiper-slide-visible .image-container").find("a").attr("tabindex","-1"),$(this.$el).parent(".einstein-carousel").find(".swiper-slide.swiper-slide-visible").find("button").attr("tabindex","0"))}}})}))}function n(){var e=0;$(".einstein-carousel-container").each((function(){var t=this;if($(t).find(".swiper-slide").length)i(this);else var r=setInterval((function(){$(t).find(".swiper-slide").length&&i(this),e>10?clearInterval(r):e+=1}),1e3)}))}window.handlebarHelpers=window.handlebarHelpers||r(9432),e.exports={renderTemplate:function(){$(document).ready((function(){handlebarHelpers.handleColorSwatchesInTile()})),$(window).on("load",(function(){new MutationObserver((function(e){e.forEach((function(e){$(e.addedNodes).each((function(){($(this).hasClass("einstein-container-wrapper")||$(this).find(".einstein-container-wrapper").length)&&n()}))}))})).observe(document.body,{childList:!0,subtree:!0})}));var e=0,t=setInterval((function(){n(),e>5?clearInterval(t):e+=1}),1e3)},handleColorSwatchesInTileonHover:function(){$(document).on("mouseover",".productTileTemplates .product-tile .image-container",(function(e){var t=$(e.target),r=t.attr("data-master-alt-image");t.closest(".product-tile").find(".image-container .primary-image img").attr("src",r)})),$(document).on("mouseout",".productTileTemplates .product-tile .image-container",(function(e){var t=$(e.target),r=t.attr("data-master-image");t.closest(".product-tile").find(".image-container .primary-image img").attr("src",r)}))},renderSwiperForEinstienCarousel:i}},7107:(e,t,r)=>{"use strict";window.handlebarHelpers=window.handlebarHelpers||r(9432),window.bookmark=window.bookmark||r(1542);handlebarHelpers.getPictureElement;function i(){var e=$(".product-tile .color a.mobile"),t=$(".product-tile .color a.desktop");$(window).width()<640?(t.attr("tabindex","-1"),e.attr("tabindex","0")):(e.attr("tabindex","-1"),t.attr("tabindex","0"))}$(window).resize((function(){i()})),e.exports={swiperInit:function(){if($(".service-hightlights-swiper"))new swiperCarousel.Swiper(".service-hightlights-swiper",{slidesPerView:"2.3",spaceBetween:16,breakpoints:{768:{slidesPerView:"4"},1024:{slidesPerView:"4",spaceBetween:18}}})}
2,handleImageCarousel:function(){var e=$(".productTileTemplates").find(".primary-image"),t=new Array;$.each(e,(function(){t.push($(this).attr("data-id"))}));var r=0;e.each((function(){var e=$("#s7PresetsPlp").val(),i=$(this).find(".tile-image").attr("data-master-image"),n=i.indexOf("https:")>-1?i:"https:"+i,a=$(this).attr("data-alt-images")?$(this).attr("data-alt-images").split(","):[];for(var s in a)a[s]=a[s]+e;var o='<div class="image-wrapper">';for(var l in 0!==a.length?a.splice(0,0,n):o+='<div class="image-carousel" data-final-image='.concat(n,"></div>"),a){if(l>=4)break;o+='<div class="image-carousel" data-swatch-id="span_'.concat(l,'" data-final-image=').concat(a[l],"></div>")}for(var u in o+='</div><div class="pagination">',a){if(u>=4)break;o+='<span class="span_'.concat(u,'"></span>')}o+="</div>",$(".primary-image."+t[r]).find(".pagination").remove(),$(".primary-image."+t[r]).find(".image-wrapper").remove(),$(".primary-image."+t[r]).append(o),r+=1}))},updateMouseMove:function(){$(document).on("mouseenter",".productTileTemplates .image-container .image-carousel",(function(e){var t=$(e.currentTarget),r=t.attr("data-swatch-id");t.closest(".product-tile").find(".image-wrapper").show(),t.closest(".product-tile").find(".pagination span."+r).addClass("active");var i=t.attr("data-final-image");t.closest(".product-tile").find(".primary-image img").attr({src:i})})),$(document).on("mouseout",".productTileTemplates .image-container .primary-image",(function(e){var t=$(e.currentTarget);t.closest(".product-tile").find(".pagination span").removeClass("active");var r=t.attr("data-master-image");t.closest(".product-tile").find(".primary-image img").attr("src",r)})),$(document).on("click",".plp-prev-btn",(function(e){e.preventDefault(),e.stopPropagation();var t=$(e.currentTarget),r=t.closest(".product-tile").find(".primary-image img").attr("data-active-image")||"span_0",i="span_"+(parseInt(r.split("").pop())-1),n=t.closest(".product-tile").find(".image-carousel[data-swatch-id="+i+"]").attr("data-final-image");t.closest(".product-tile").find(".primary-image img").attr({src:n}),t.closest(".product-tile").find(".primary-image img").attr({"data-active-image":i}),t.closest(".product-tile").find(".plp-next-btn").removeClass("d-none"),t.closest(".product-tile").find(".pagination span").removeClass("active"),t.closest(".product-tile").find(".pagination ."+i).addClass("active"),parseInt(r.split("").pop()-1)||(t.closest(".product-tile").find(".plp-prev-btn").addClass("d-none"),t.closest(".product-tile").find(".plp-next-btn").focus())})),$(document).on("click",".plp-next-btn",(function(e){e.preventDefault(),e.stopPropagation();var t=$(e.currentTarget),r=t.closest(".product-tile").find(".primary-image img").attr("data-active-image")||"span_0",i="span_"+(parseInt(r.split("").pop())+1),n=t.closest(".product-tile").find(".image-carousel[data-swatch-id="+i+"]").attr("data-final-image");t.closest(".product-tile").find(".primary-image img").attr({src:n}),t.closest(".product-tile").find(".primary-image img").attr({"data-active-image":i}),t.closest(".product-tile").find(".plp-prev-btn").removeClass("d-none"),t.closest(".product-tile").find(".pagination span").removeClass("active"),t.closest(".product-tile").find(".pagination ."+i).addClass("active"),parseInt(i.split("").pop())+1>t.closest(".product-tile").find(".image-wrapper").children().length-1&&(t.closest(".product-tile").find(".plp-next-btn").addClass("d-none"),t.closest(".product-tile").find(".plp-prev-btn").focus())}))},imageLazyLoadPlp:function(){var e=document.querySelectorAll(".product-tile img[data-src]"),t=new IntersectionObserver((function(e,r){e.forEach((function(e){if(e.isIntersecting){var r=e.target;r.src=r.dataset.src,t.unobserve(r)}}))}));e.forEach((function(e){t.observe(e)}))},swatchCountPlp:i}},5750:e=>{"use strict";var t="Mon",r="Tue",i="Wed",n="Thu",a="Fri",s="Sat",o="Sun";function l(e){if($("#service-page-store").length){var t="https://maps.google.com/?daddr="+e.store.latitude+","+e.store.longitude,r=e.locale,i=("fr_CA"===r?"https://ca.tumi.com/fr/store/":"en_CA"===r?"https://ca.tumi.com/en/store/":"https://www.tumi.com/store/")+e.store.ID,n=d(e);$("#service-page-store .nearby-store").removeClass("d-none").addClass("d-flex"),$("#service-page-store .no-nearby-store").addClass("d-none").removeClass("d-flex"),$("#service-page-store .store-location").text(e.store.name),$("#service-page-store .home-store-image").attr("src",e.store.largeImage);var a="";
2if(e.storeDistance&&e.storeDistance<=1?(a='<a class="mile-distance" href="javascript:void(0)">'.concat(e.storeDistance," ").concat(window.Resources.milesway,"</a>"),n&&(a+=" ⢠".concat(n))):e.storeDistance&&e.storeDistance>1?(a='<a class="mile-distance" href="'.concat(t,'" target="_blank">').concat(e.storeDistance," ").concat(window.Resources.milesway,"</a>"),n&&(a+=" ⢠".concat(n))):n&&(a=n),$("#service-page-store .store-distance").html(a),$("#service-page-store .store-detail").attr("href",i),e.store.services){var s="";e.store.services.forEach((function(e){s+='<p class="store-services">'.concat(e,"</p>")})),$("#service-page-store .store-services-container").html(s)}}}function u(e){var t="https://maps.google.com/?daddr="+e.store.latitude+","+e.store.longitude,r=e.locale,i=("fr_CA"===r?"https://ca.tumi.com/fr/store/":"en_CA"===r?"https://ca.tumi.com/en/store/":"https://www.tumi.com/store/")+e.store.ID,n="",a=d(e);return n+='\n <div class="row">\n <div class="col-sm-6 text-content d-flex flex-column align-items-center justify-content-center order-2 order-sm-2 order-md-1">\n <div class="title">'.concat(e.getResources.storeHeading,'</div>\n <h2 class="store-location" id="store-location">').concat(e.store.name,"</h2>"),e.storeDistance&&e.storeDistance<=1?(n+='<p class="store-distance" id="store-distance"> \n <a class="mile-distance" href="javascript:void(0)">'.concat(e.storeDistance," ").concat(window.Resources.milesway," </a>"),a&&(n+="⢠".concat(a)),n+="</p>"):e.storeDistance&&e.storeDistance>1?(n+='<p class="store-distance" id="store-distance"> \n <a class="mile-distance" href="'.concat(t,'" target="_blank">').concat(e.storeDistance," ").concat(window.Resources.milesway,"</a>"),a&&(n+="⢠".concat(a)),n+="</p>"):a&&(n+="<p>".concat(a,"</p>")),n+='<a class="button button--primary appointment" href="'.concat(i,'">').concat(e.getResources.storescheduleAppointment,"</a>"),e.store.phone&&(n+='<a class="button button--secondary call-us" href="tel:'.concat(e.store.phone,'">')+window.Resources.callusat+" "+e.store.phone+"</a>"),n+='</div>\n <div class="col-sm-6 store-img order-1 order-sm-1 order-md-2">\n <img class="home-store-image" src="'.concat(e.store.largeImage,'" alt=""/>\n </div>\n </div>')}function d(e){if(e){var l="",u=(new Date).getHours(),d=new Date;d.setHours(d.getHours()+24);var c=parseInt(e.openUntil&&e.openUntil.split(" ")[0]);c=(c=e.openUntil?e.openUntil.indexOf("AM")>=0?c:c+12:NaN)>24?c-12:c;var h=parseInt(e.openAt&&e.openAt.split(" ")[0]);return h=(h=e.openAt?e.openAt.indexOf("PM")>=0?h+12:h:NaN)>24?h-12:h,e.openAt=h>=12?e.openAt.replace("AM","PM"):e.openAt,c&&h&&c>u&&h<=u?l+="".concat(window.Resources.openuntil," ").concat(e.openUntil):0<=u&&h>u?l+="".concat(window.Resources.openstodayat," ").concat(e.openAt):e.openTommorowAt||d.toString().substring(0,3)===e.nextDay?l+="".concat(window.Resources.openstommorowat," ").concat(e.openTommorowAt||e.nextDayAt):e.nextDayAt&&e.nextDay&&(e.nextDay==o?l+="".concat(window.Resources.openssundayat," ").concat(e.nextDayAt):e.nextDay==t?l+="".concat(window.Resources.opensmondayat," ").concat(e.nextDayAt):e.nextDay==r?l+="".concat(window.Resources.openstuesat," ").concat(e.nextDayAt):e.nextDay==i?l+="".concat(window.Resources.openswedat," ").concat(e.nextDayAt):e.nextDay==n?l+="".concat(window.Resources.opensthursat," at ").concat(e.nextDayAt):e.nextDay==a?l+="".concat(window.Resources.opensfridat," ").concat(e.nextDayAt):e.nextDay==s&&(l+="".concat(window.Resources.openssatat," ").concat(e.nextDayAt))),l}}function c(e){var t=d(e),r="";return r+='<li class="mobile-store-locator">\n <img alt="Store Image" src="'.concat(e.store.headerFooterImage,'" title="">\n <div class="img-content-wrapper">'),e.store.name&&(r+='<a href="'.concat(e.storeLocatorUrl,'" aria-label="Change To Near-By Tumi Store">').concat(e.store.name,"</a>")),t&&(r+="<p>".concat(t,"</p>")),r+="</div></li>"}function h(e){return'\n <div class="row">\n <div class="col-sm-6 text-content d-flex flex-column align-items-center justify-content-center order-2 order-sm-2 order-md-1">\n <h5 class="title">'.concat(e.getResources.nostoreHeading,'</h5>\n <h4 class="store-location">').concat(e.getResources.nostoreLocation,'</h4>\n <p class="store-distance">').concat(e.getResources.nostoreDescription,'</p>\n <a class="button button--primary find-store" href="').concat(e.storeLocatorUrl,'">').concat(e.getResources.nostoreButtonFindStore,'</a>\n </div>\n <div class="col-sm-6 store-img order-1 order-sm-1 order-md-2">\n <img class="home-store-image" src="').concat(e.getResources.nostoreLargeImage,'" alt=""/>\n </div>\n </div>\n')}function f(e){var t=e.locale,r=("fr_CA"===t?"https://ca.tumi.com/fr/store/":"en_CA"===t?"https://ca.tumi.com/en/store/":"https://www.tumi.com/store/")+e.store.ID;return'<a href="'.concat(r,'" aria-label="Change To Near-By Tumi Store">').concat(e.store.name,"</a>")}function g(e){var t=e.locale,r=("fr_CA"===t?"https://ca.tumi.com/fr/store/":"en_CA"===t?"https://ca.tumi.com/en/store/":"https://www.tumi.com/store/")+e.store.ID,i='\n<div class="col-md-12 col-sm-6 col-12 mb-3">\n <div class="store-image">\n <img src="'.concat(e.store.headerFooterImage,'" itemprop="logo" alt=""/>\n </div>\n</div>\n<div class="col-md-12 col-sm-6 col-12">
2\n <div class="footer-store-info-details">\n <div class="address">\n <p class="title">').concat(e.store.name,'</p>\n <a class="change_loc" href="').concat(e.storeLocatorUrl,'" aria-label="Change To Near-By Tumi Store">change</a>\n <p>').concat(e.store.address1,"</p><p>");return e.store.address2&&(i+=e.store.address2+", "),i+="".concat(e.store.city," ").concat(e.store.postalCode,"</p>\n ").concat(e.store.phone?"<p>"+e.store.phone+"</p>":"",'\n </div>\n <div class="store-cta">\n <a href="').concat(e.storeLocatorUrl,'">\n ').concat(e.getResources.storescheduleAppointment,"\n </a>\n <a>\n ").concat(e.getResources.headerGetDirection,'\n </a>\n <a href="').concat(r,'" class="button d-block button--secondary-dark">').concat(e.getResources.storescheduleAppointment,"</a>\n </div>\n </div>\n</div>\n")}function v(e){return'\n <div class="col-md-12 col-sm-6 col-12 mb-3">\n <div class="store-image">\n <img src="'.concat(e.getResources.nostoreImage,'" itemprop="logo" alt=""/>\n </div>\n </div>\n <div class="col-md-12 col-sm-6 col-12">\n <div class="footer-store-info-details">\n <div class="address">\n <p class="title">').concat(e.getResources.nostoreLocation,"</p>\n <p>").concat(e.getResources.nostoreDescription,'</p>\n </div>\n <div class="store-cta">\n <a href="').concat(e.storeLocatorUrl,'">\n ').concat(e.getResources.nostoreButtonFindStore,'\n <span class="store-cta-icon" aria-hidden="true"> > </span>\n </a>\n <a href="').concat(e.storeLocatorUrl,'" class="button button--secondary-dark">').concat(e.getResources.nostoreButtonFindStore,"</a>\n </div>\n </div>\n </div>\n ")}function p(e){var t="https://maps.google.com/?daddr="+e.store.latitude+","+e.store.longitude,r=e.locale,i=("fr_CA"===r?"https://ca.tumi.com/fr/store/":"en_CA"===r?"https://ca.tumi.com/en/store/":"https://www.tumi.com/store/")+e.store.ID,n=d(e),a="";return a+='\n <h2 class="d-none d-md-block">'.concat(e.getResources.headerStoreHeading,'</h2>\n <img src="').concat(e.store.headerFooterImage,'" alt="Store Image"/>\n <div class="address pb-3">\n <p class="title">\n <span>').concat(e.store.name,'</span>\n <a href="').concat(e.storeLocatorUrl,'" aria-label="Change To Near-By Tumi Store">').concat(window.Resources.change,"</a>\n </p>"),e.storeDistance&&e.storeDistance<=1?a+='<p class="store-distance" id="store-distance"> '.concat(e.storeDistance," ").concat(window.Resources.milesway,"</p>\n <p>").concat(n,"</p>"):e.storeDistance&&e.storeDistance>1?a+='<p class="store-distance" id="store-distance"> '.concat(e.storeDistance," ").concat(window.Resources.milesway,"</p>\n <p>").concat(n,"</p>"):a+="<p>".concat(n,"</p>"),a+='\n </div>\n <a href="'.concat(i,'" class="button d-block button--primary">\n ').concat(e.getResources.storescheduleAppointment,'\n </a>\n <a href="').concat(t,'" target="_blank" class="button d-block button--secondary">\n ').concat(e.getResources.headerGetDirection,"\n </a>\n ")}function m(e){return'\n <h2 class="d-none d-md-block">'.concat(e.getResources.headerStoreHeading,'</h2>\n <img src="').concat(e.getResources.nostoreImage,'" alt="Please select store"/>\n <div class="address pb-3">\n <p class="title">\n ').concat(e.getResources.nostoreLocation,"\n </p>\n <p>").concat(e.getResources.nostoreDescription,'</p>\n </div>\n <a href="').concat(e.storeLocatorUrl,'" aria-label="Change To Near-By Tumi Store" class="button d-block button--primary">\n ').concat(e.getResources.nostoreButtonFindStore,"\n </a>\n ")}function y(e,t){var r=e;return r+=(-1!==r.indexOf("?")?"&":"?")+Object.keys(t).map((function(e){return e+"="+encodeURIComponent(t[e])})).join("&")}function E(e){if(e.store&&e.store.ID&&"airport"!==e.store.retailSetting){var t=u(e),r=g(e),i=p(e),n=f(e),a=c(e),s=l(e);$("#home-your-store").html(t),$("#service-page-store").html(s),$("#footer-store-info").html(r),$("#header-store-loc").html(i),$("#store-name-text").html(n),$(".mobile-bottom-section ul .mobile-store-locator").length>0?$(".mobile-bottom-section ul .mobile-store-locator").html(a):$(".mobile-bottom-section ul").append(a)}else{var o=h(e),d=v(e),y=m(e);$("#home-no-store").html(o),$("#footer-store-info").html(d),$("#header-store-loc").html(y)}}function b(e){var t=$(".results"),r=$(".results-status-msg"),i=$(".map-canvas"),n=e.stores.length>0;
2n?$(".store-locator-no-results").hide():$(".store-locator-no-results").show(),t.empty().data("has-results",n).data("radius",e.radius).data("search-key",e.searchKey),i.attr("data-locations",e.locations),i.data("has-google-api")?T():$(".store-locator-no-apiKey").show(),e.storesResultsHtml&&(r.html("".concat(window.Resources.storeresults," (").concat(e.stores.length,")")),t.append(e.storesResultsHtml))}function T(e){var t,r=new google.maps.InfoWindow,i={scrollwheel:!1,zoom:5,center:new google.maps.LatLng(37.09024,-95.712891)};t=new google.maps.Map($(".map-canvas")[0],i),google.maps.event.addListenerOnce(t,"idle",(function(){$(".map-canvas").find("iframe").attr("title","Store Locator Map")}));var n=$(".map-canvas").attr("data-locations");n=JSON.parse(n),e&&(n=n.filter((function(t){return t.latitude===e.lat&t.longitude===e.lng&&t.name===e.name})));var a=new google.maps.LatLngBounds,s=$(".map-canvas"),o={retail:s.data("tumistore"),outlet:s.data("tumioutlet"),dealer:s.data("tumiretaiil")},l=function(e){if(!e||"all"===e.toLowerCase())return[];var t={store:"retail",retail:"dealer",outlet:"outlet"};return e.toLowerCase().split("|").map((function(e){return t[e]})).filter(Boolean)}(s.data("location-type"));Object.keys(n).forEach((function(e){var i=n[e],s=(i.storeType||"").toLowerCase();if(!l.length||l.includes(s)){var u=o[s]||o.dealer,d=new google.maps.LatLng(i.latitude,i.longitude),c=new google.maps.Marker({position:d,map:t,title:i.name,icon:u});c.addListener("click",(function(){r.setOptions({content:i.infoWindowHtml}),r.open(t,c)})),a.extend(c.position)}})),n&&n.length>1?t.fitBounds(a):n&&1==n.length&&(t.setCenter(a.getCenter()),t.setZoom(18))}function S(e){var t=$("#save-my-store-url").val();$.ajax({url:t,type:"POST",data:{storeId:e},success:function(t){t.success&&($("[for^=store_]").text("Save as My Store"),$("[for=store_"+e+"]").text("My Store")),sessionStorage.removeItem("storeHeaderResponse"),localStorage.removeItem("currentStoreID"),$.spinner().stop()}})}e.exports={getStoreStatus:d,init:function(){$(".map-canvas").data("has-google-api")?T():$(".store-locator-no-apiKey").show(),$(".results").data("has-results")||$(".store-locator-no-results").show()},detectLocation:function(){$(".detect-location").on("click",(function(){$.spinner().start(),navigator.geolocation.getCurrentPosition((function(e){var t=$(".detect-location").data("action");t=y(t,{radius:$(".results").data("radius"),lat:e.coords.latitude,long:e.coords.longitude}),$.ajax({url:t,type:"get",dataType:"json",success:function(e){$.spinner().stop(),b(e),$(".select-store").prop("disabled",!0)}})}),(function(){$.spinner().stop()}))}))},selectLocation:function(){$(document).on("click",".store-details a, .store-details .save-my-store",(function(e){e.stopPropagation()})),$(document).on("click",".store-details",(function(){var e={};e.lat=parseFloat($(this).data("lat")),e.lng=parseFloat($(this).data("lng")),e.name=$(this).data("store-name"),T(e)}))},updateMyStore:function(){$(document).on("storelocator:add",(function(){var e=localStorage.getItem("currentStoreID")||"";""!==e&&null!==e&&S(e)})),$(document).on("change","input[name=my-store]:radio",(function(e){var t=e.currentTarget,r=this.value,i=$("#pageHeader").data("loggedinstatusurl");$.get(i).done((function(e){e.isAuthenticated?($("body").spinner().start(),S(r)):($("#requestLoginModal").find(".login-info").addClass("d-none"),$("#requestLoginModal").modal("show"),localStorage.setItem("currentStoreID",t.value))}))}))},search:function(){$(".store-locator-container form.store-locator").submit((function(e){e.preventDefault(),function(e){var t=e.closest(".in-store-inventory-dialog"),r=t.length?t.spinner():$.spinner(),i=e.closest(".store-locator"),n=$("#storeSearchRadius").val(),a=i.attr("action"),s={radius:n,location:$("#storeLocationType").val()},o=i.attr("method"),l=i.find('[name="postalCode"]').val();a=y(a,s);var u=new google.maps.Geocoder,d=$(".store-zipcode-errormsg");u.geocode({address:l},(function(e,t){if(t==google.maps.GeocoderStatus.OK){var i=null;e[0].address_components&&1===e[0].address_components.length&&e[0].types&&e[0].types.length>0&&"COUNTRY"===e[0].types[0].toUpperCase()&&(i=e[0].address_components[0].short_name,a=y(a,{countrycode:i})),d.empty();var n={lat:e[0].geometry.location.lat(),long:e[0].geometry.location.lng()};return r.start(),$.ajax({url:a,type:o,data:n,dataType:"json",success:function(e){r.stop(),b(e),$(".select-store").prop("disabled",!0)}}),!1}var s=d.attr("data-wrong-postal");
2$(".invalid-feedback").length&&d.html(""),d.html('<p class="error" aria-invalid="true" role="alert">'+s+"</p>")}))}($(this))}))},storeLocator:function(){!function(){"true"===getCookie("deleteStoreRes")&&(sessionStorage.removeItem("storeHeaderResponse"),setCookie("deleteStoreRes","null",0));var e=sessionStorage.getItem("storeHeaderResponse");if(e)E(JSON.parse(e));else{var t=$("#storeurl").val(),r=$("#storeSearchRadius").val(),i=$("#storeLocationType").val(),n=new Date,a=new Date;a.setHours(a.getHours()+24),t=y(t,{locationEnabled:!0,radius:r,location:i,currDate:n.toString(),nextDate:a.toString()}),$.ajax({url:t,type:"get",dataType:"json",success:function(e){E(e),sessionStorage.setItem("storeHeaderResponse",JSON.stringify(e))}})}}()},ToggleStoreDetails:function(){$(document).on("click",".store-locator-container #view-store-details, .map-canvas #view-store-details",(function(e){var t=$(this).data("store-id");$(this).toggleClass("icon");var r=$(".store-locator-container .store-timing-section_"+t);$(this).parents(".map-canvas").length>0&&(r=$(".map-canvas .store-timing-section_"+t)),r.toggleClass("d-block"),r.hasClass("d-block")?(this.textContent=window.Resources.hideDetails,$(this).attr("aria-expanded","true")):(this.textContent=window.Resources.viewDetails,$(this).attr("aria-expanded","false")),e.preventDefault()}))}}},6489:(e,t,r)=>{var i,n;function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}!function s(o){var l;l=function(){"use strict";function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}function t(e,t,r,i,n,a,s){try{var o=e[a](s),l=o.value}catch(e){return void r(e)}o.done?t(l):Promise.resolve(l).then(i,n)}function r(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,E(i.key),i)}}function i(e,t,i){return t&&r(e.prototype,t),i&&r(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e}function n(t,r){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(i)return(i=i.call(t)).next.bind(i);if(Array.isArray(t)||(i=function(t,r){if(t){if("string"==typeof t)return e(t,r);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?e(t,r):void 0}}(t))||r){i&&(t=i);var n=0;return function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function l(e,t,r){return(t=E(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function u(){return u=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var i in r)({}).hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},u.apply(null,arguments)}function d(e){return d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},d(e)}function c(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,y(e,t)}function h(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(h=function(){return!!e})()}function f(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function g(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?f(Object(r),!0).forEach((function(t){l(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):f(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function v(e,t){if(null==e)return{};var r={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(-1!==t.indexOf(i))continue;
vendor: 4,178 bytes, line 2
2r[i]=e[i]}return r}function p(){var e,t,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",n=r.toStringTag||"@@toStringTag";function a(r,i,n,a){var l=i&&i.prototype instanceof o?i:o,u=Object.create(l.prototype);return m(u,"_invoke",function(r,i,n){var a,o,l,u=0,d=n||[],c=!1,h={p:0,n:0,v:e,a:f,f:f.bind(e,4),d:function(t,r){return a=t,o=0,l=e,h.n=r,s}};function f(r,i){for(o=r,l=i,t=0;!c&&u&&!n&&t<d.length;t++){var n,a=d[t],f=h.p,g=a[2];r>3?(n=g===i)&&(l=a[(o=a[4])?5:(o=3,3)],a[4]=a[5]=e):a[0]<=f&&((n=r<2&&f<a[1])?(o=0,h.v=i,h.n=a[1]):f<g&&(n=r<3||a[0]>i||i>g)&&(a[4]=r,a[5]=i,h.n=g,o=0))}if(n||r>1)return s;throw c=!0,i}return function(n,d,g){if(u>1)throw TypeError("Generator is already running");for(c&&1===d&&f(d,g),o=d,l=g;(t=o<2?e:l)||!c;){a||(o?o<3?(o>1&&(h.n=-1),f(o,l)):h.n=l:h.v=l);try{if(u=2,a){if(o||(n="next"),t=a[n]){if(!(t=t.call(a,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,o<2&&(o=0)}else 1===o&&(t=a.return)&&t.call(a),o<2&&(l=TypeError("The iterator does not provide a '"+n+"' method"),o=1);a=e}else if((t=(c=h.n<0)?l:r.call(i,h))!==s)break}catch(t){a=e,o=1,l=t}finally{u=1}}return{value:t,done:c}}}(r,n,a),!0),u}var s={};function o(){}function l(){}function u(){}t=Object.getPrototypeOf;var d=[][i]?t(t([][i]())):(m(t={},i,(function(){return this})),t),c=u.prototype=o.prototype=Object.create(d);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,m(e,n,"GeneratorFunction")),e.prototype=Object.create(c),e}return l.prototype=u,m(c,"constructor",u),m(u,"constructor",l),l.displayName="GeneratorFunction",m(u,n,"GeneratorFunction"),m(c),m(c,n,"Generator"),m(c,i,(function(){return this})),m(c,"toString",(function(){return"[object Generator]"})),(p=function(){return{w:a,m:h}})()}function m(e,t,r,i){var n=Object.defineProperty;try{n({},"",{})}catch(e){n=0}m=function(e,t,r,i){function a(t,r){m(e,t,(function(e){return this._invoke(t,r,e)}))}t?n?n(e,t,{value:r,enumerable:!i,configurable:!i,writable:!i}):e[t]=r:(a("next",0),a("throw",1),a("return",2))},m(e,t,r,i)}function y(e,t){return y=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},y(e,t)}function E(e){var t=function(e,t){if("object"!=a(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t);if("object"!=a(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==a(t)?t:t+""}function b(e){var t="function"==typeof Map?new Map:void 0;return b=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return function(e,t,r){if(h())return Reflect.construct.apply(null,arguments);var i=[null];i.push.apply(i,t);var n=new(e.bind.apply(e,i));return r&&y(n,r.prototype),n}(e,arguments,d(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),y(r,e)},b(e)}function T(e){return e instanceof ArrayBuffer||"undefined"!=typeof SharedArrayBuffer&&e instanceof SharedArrayBuffer}var S="utf-16",w="utf-16be",A="utf-16le",L="utf-8";function I(e,t){if(e<0)return-I(-e,t);var r=Math.pow(10,t);if(Math.abs(e*r%1-.5)<Number.EPSILON){var i=Math.floor(e*r);return(i%2==0?i:i+1)/r}return Math.round(e*r)/r}function k(){try{return crypto.randomUUID()}catch(i){try{var e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)}catch(e){var r=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=(r+16*Math.random())%16|0;return r=Math.floor(r/16),("x"==e?t:3&t|8).toString(16)}))}}}function R(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var D,C,P={exports:{}},_=(D||(D=1,function(e){var t=Object.prototype.hasOwnProperty,r="~";function i(){}function n(e,t,r){this.fn=e,this.context=t,this.once=r||!1}
vendor: 4,595 bytes, line 2
2function a(e,t,i,a,s){if("function"!=typeof i)throw new TypeError("The listener must be a function");var o=new n(i,a||e,s),l=r?r+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],o]:e._events[l].push(o):(e._events[l]=o,e._eventsCount++),e}function s(e,t){0==--e._eventsCount?e._events=new i:delete e._events[t]}function o(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(r=!1)),o.prototype.eventNames=function(){var e,i,n=[];if(0===this._eventsCount)return n;for(i in e=this._events)t.call(e,i)&&n.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},o.prototype.listeners=function(e){var t=r?r+e:e,i=this._events[t];if(!i)return[];if(i.fn)return[i.fn];for(var n=0,a=i.length,s=new Array(a);n<a;n++)s[n]=i[n].fn;return s},o.prototype.listenerCount=function(e){var t=r?r+e:e,i=this._events[t];return i?i.fn?1:i.length:0},o.prototype.emit=function(e,t,i,n,a,s){var o=r?r+e:e;if(!this._events[o])return!1;var l,u,d=this._events[o],c=arguments.length;if(d.fn){switch(d.once&&this.removeListener(e,d.fn,void 0,!0),c){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,t),!0;case 3:return d.fn.call(d.context,t,i),!0;case 4:return d.fn.call(d.context,t,i,n),!0;case 5:return d.fn.call(d.context,t,i,n,a),!0;case 6:return d.fn.call(d.context,t,i,n,a,s),!0}for(u=1,l=new Array(c-1);u<c;u++)l[u-1]=arguments[u];d.fn.apply(d.context,l)}else{var h,f=d.length;for(u=0;u<f;u++)switch(d[u].once&&this.removeListener(e,d[u].fn,void 0,!0),c){case 1:d[u].fn.call(d[u].context);break;case 2:d[u].fn.call(d[u].context,t);break;case 3:d[u].fn.call(d[u].context,t,i);break;case 4:d[u].fn.call(d[u].context,t,i,n);break;default:if(!l)for(h=1,l=new Array(c-1);h<c;h++)l[h-1]=arguments[h];d[u].fn.apply(d[u].context,l)}}return!0},o.prototype.on=function(e,t,r){return a(this,e,t,r,!1)},o.prototype.once=function(e,t,r){return a(this,e,t,r,!0)},o.prototype.removeListener=function(e,t,i,n){var a=r?r+e:e;if(!this._events[a])return this;if(!t)return s(this,a),this;var o=this._events[a];if(o.fn)o.fn!==t||n&&!o.once||i&&o.context!==i||s(this,a);else{for(var l=0,u=[],d=o.length;l<d;l++)(o[l].fn!==t||n&&!o[l].once||i&&o[l].context!==i)&&u.push(o[l]);u.length?this._events[a]=1===u.length?u[0]:u:s(this,a)}return this},o.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&s(this,t)):(this._events=new i,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=r,o.EventEmitter=o,e.exports=o}(P)),P.exports),x=R(_),O={exports:{}},M=(C||(C=1,function(e,t){var r,i,n,a,s;r=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,i=/^(?=([^\/?#]*))\1([^]*)$/,n=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,s={buildAbsoluteURL:function(e,t,r){if(r=r||{},e=e.trim(),!(t=t.trim())){if(!r.alwaysNormalize)return e;var n=s.parseURL(e);if(!n)throw new Error("Error trying to parse base URL.");return n.path=s.normalizePath(n.path),s.buildURLFromParts(n)}var a=s.parseURL(t);if(!a)throw new Error("Error trying to parse relative URL.");if(a.scheme)return r.alwaysNormalize?(a.path=s.normalizePath(a.path),s.buildURLFromParts(a)):t;var o=s.parseURL(e);if(!o)throw new Error("Error trying to parse base URL.");if(!o.netLoc&&o.path&&"/"!==o.path[0]){var l=i.exec(o.path);o.netLoc=l[1],o.path=l[2]}o.netLoc&&!o.path&&(o.path="/");var u={scheme:o.scheme,netLoc:a.netLoc,path:null,params:a.params,query:a.query,fragment:a.fragment};if(!a.netLoc&&(u.netLoc=o.netLoc,"/"!==a.path[0]))if(a.path){var d=o.path,c=d.substring(0,d.lastIndexOf("/")+1)+a.path;u.path=s.normalizePath(c)}else u.path=o.path,a.params||(u.params=o.params,a.query||(u.query=o.query));return null===u.path&&(u.path=r.alwaysNormalize?s.normalizePath(a.path):a.path),s.buildURLFromParts(u)},parseURL:function(e){var t=r.exec(e);return t?{scheme:t[1]||"",netLoc:t[2]||"",path:t[3]||"",params:t[4]||"",query:t[5]||"",fragment:t[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(n,"");e.length!==(e=e.replace(a,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}},e.exports=s}(O)),O.exports),F=Number.isFinite||function(e){return"number"==typeof e&&isFinite(e)},N=Number.isSafeInteger||function(e){return"number"==typeof e&&Math.abs(e)<=U},U=Number.MAX_SAFE_INTEGER||9007199254740991,B=function(e){return e.NETWORK_E
2RROR="networkError",e.MEDIA_ERROR="mediaError",e.KEY_SYSTEM_ERROR="keySystemError",e.MUX_ERROR="muxError",e.OTHER_ERROR="otherError",e}({}),$=function(e){return e.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",e.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",e.KEY_SYSTEM_NO_SESSION="keySystemNoSession",e.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",e.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",e.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",e.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",e.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",e.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",e.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",e.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR="keySystemDestroyMediaKeysError",e.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR="keySystemDestroyCloseSessionError",e.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR="keySystemDestroyRemoveSessionError",e.MANIFEST_LOAD_ERROR="manifestLoadError",e.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",e.MANIFEST_PARSING_ERROR="manifestParsingError",e.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",e.LEVEL_EMPTY_ERROR="levelEmptyError",e.PLAYLIST_UNCHANGED_ERROR="playlistUnchangedError",e.LEVEL_LOAD_ERROR="levelLoadError",e.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",e.LEVEL_PARSING_ERROR="levelParsingError",e.LEVEL_SWITCH_ERROR="levelSwitchError",e.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",e.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",e.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",e.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",e.FRAG_LOAD_ERROR="fragLoadError",e.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",e.FRAG_DECRYPT_ERROR="fragDecryptError",e.FRAG_PARSING_ERROR="fragParsingError",e.FRAG_GAP="fragGap",e.REMUX_ALLOC_ERROR="remuxAllocError",e.KEY_LOAD_ERROR="keyLoadError",e.KEY_LOAD_TIMEOUT="keyLoadTimeOut",e.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",e.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",e.BUFFER_APPEND_ERROR="bufferAppendError",e.BUFFER_APPENDING_ERROR="bufferAppendingError",e.BUFFER_APPEND_NO_PROGRESS="bufferAppendNoProgress",e.BUFFER_STALLED_ERROR="bufferStalledError",e.BUFFER_FULL_ERROR="bufferFullError",e.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",e.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",e.ASSET_LIST_LOAD_ERROR="assetListLoadError",e.ASSET_LIST_LOAD_TIMEOUT="assetListLoadTimeout",e.ASSET_LIST_PARSING_ERROR="assetListParsingError",e.INTERSTITIAL_ASSET_ITEM_ERROR="interstitialAssetItemError",e.INTERNAL_EXCEPTION="internalException",e.INTERNAL_ABORTED="aborted",e.ATTACH_MEDIA_ERROR="attachMediaError",e.MEDIA_SOURCE_REQUIRES_RESET="mediaSourceRequiresReset",e.UNKNOWN="unknown",e}({}),G=function(e){return e.MEDIA_ATTACHING="hlsMediaAttaching",e.MEDIA_ATTACHED="hlsMediaAttached",e.MEDIA_DETACHING="hlsMediaDetaching",e.MEDIA_DETACHED="hlsMediaDetached",e.MEDIA_ENDED="hlsMediaEnded",e.STALL_RESOLVED="hlsStallResolved",e.BUFFER_RESET="hlsBufferReset",e.BUFFER_CODECS="hlsBufferCodecs",e.BUFFER_CREATED="hlsBufferCreated",e.BUFFER_APPENDING="hlsBufferAppending",e.BUFFER_APPENDED="hlsBufferAppended",e.BUFFER_EOS="hlsBufferEos",e.BUFFERED_TO_END="hlsBufferedToEnd",e.BUFFER_FLUSHING="hlsBufferFlushing",e.BUFFER_FLUSHED="hlsBufferFlushed",e.MANIFEST_LOADING="hlsManifestLoading",e.MANIFEST_LOADED="hlsManifestLoaded",e.MANIFEST_PARSED="hlsManifestParsed",e.LEVEL_SWITCHING="hlsLevelSwitching",e.LEVEL_SWITCHED="hlsLevelSwitched",e.LEVEL_LOADING="hlsLevelLoading",e.LEVEL_LOADED="hlsLevelLoaded",e.LEVEL_UPDATED="hlsLevelUpdated",e.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",e.LEVELS_UPDATED="hlsLevelsUpdated",e.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",e.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",e.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",e.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",e.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",e.AUDIO_TRACK_UPDATED="hlsAudioTrackUpdated",e.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",e.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",e.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",e.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",e.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",e.SUBTITLE_TRACK_UPDATED="hlsSubtitleTrackUpdated",e.SUBTITLE_FRAG_PROCESSED="hl
2sSubtitleFragProcessed",e.CUES_PARSED="hlsCuesParsed",e.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",e.INIT_PTS_FOUND="hlsInitPtsFound",e.FRAG_LOADING="hlsFragLoading",e.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",e.FRAG_LOADED="hlsFragLoaded",e.FRAG_DECRYPTED="hlsFragDecrypted",e.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",e.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",e.FRAG_PARSING_METADATA="hlsFragParsingMetadata",e.FRAG_PARSED="hlsFragParsed",e.FRAG_BUFFERED="hlsFragBuffered",e.FRAG_CHANGED="hlsFragChanged",e.FPS_DROP="hlsFpsDrop",e.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",e.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",e.ERROR="hlsError",e.DESTROYING="hlsDestroying",e.KEY_LOADING="hlsKeyLoading",e.KEY_LOADED="hlsKeyLoaded",e.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",e.BACK_BUFFER_REACHED="hlsBackBufferReached",e.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",e.ASSET_LIST_LOADING="hlsAssetListLoading",e.ASSET_LIST_LOADED="hlsAssetListLoaded",e.INTERSTITIALS_UPDATED="hlsInterstitialsUpdated",e.INTERSTITIALS_BUFFERED_TO_BOUNDARY="hlsInterstitialsBufferedToBoundary",e.INTERSTITIAL_ASSET_PLAYER_CREATED="hlsInterstitialAssetPlayerCreated",e.INTERSTITIAL_STARTED="hlsInterstitialStarted",e.INTERSTITIAL_ASSET_STARTED="hlsInterstitialAssetStarted",e.INTERSTITIAL_ASSET_ENDED="hlsInterstitialAssetEnded",e.INTERSTITIAL_ASSET_ERROR="hlsInterstitialAssetError",e.INTERSTITIAL_ENDED="hlsInterstitialEnded",e.INTERSTITIALS_PRIMARY_RESUMED="hlsInterstitialsPrimaryResumed",e.PLAYOUT_LIMIT_REACHED="hlsPlayoutLimitReached",e.EVENT_CUE_ENTER="hlsEventCueEnter",e}({}),H=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}},V=function(e){return e.MANIFEST="manifest",e.LEVEL="level",e.AUDIO_TRACK="audioTrack",e.SUBTITLE_TRACK="subtitleTrack",e.MEDIA_FRAGMENT="media-fragment",e.KEY="key",e.STEERING_MANIFEST="steering-manifest",e.SERVER_CERTIFICATE="server-certificate",e.INTERSTITIAL_ASSET_LIST="interstitial-asset-list",e}({}),K=function(e){return e.MAIN="main",e.AUDIO="audio",e.SUBTITLE="subtitle",e}({}),j={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"},q=function(){function e(e){var t,r,i;this._byteRange=null,this._url=null,this._stats=null,this._streams=null,this.base=void 0,this.relurl=void 0,"string"==typeof e&&(e={url:e}),this.base=e,(i=J(t=this,r="stats"))&&(i.enumerable=!0,Object.defineProperty(t,r,i))}var t=e.prototype;return t.setByteRange=function(e,t){var r,i=e.split("@",2);r=1===i.length?(null==t?void 0:t.byteRangeEndOffset)||0:parseInt(i[1]),this._byteRange=[r,parseInt(i[0])+r]},t.clearElementaryStreamInfo=function(){var e=this.elementaryStreams;e[j.AUDIO]=null,e[j.VIDEO]=null,e[j.AUDIOVIDEO]=null,this.url=null},i(e,[{key:"baseurl",get:function(){return this.base.url}},{key:"byteRange",get:function(){return null===this._byteRange?[]:this._byteRange}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"elementaryStreams",get:function(){var e;return null===this._streams&&(this._streams=((e={})[j.AUDIO]=null,e[j.VIDEO]=null,e[j.AUDIOVIDEO]=null,e)),this._streams},set:function(e){this._streams=e}},{key:"hasStats",get:function(){return null!==this._stats}},{key:"hasStreams",get:function(){return null!==this._streams}},{key:"stats",get:function(){return null===this._stats&&(this._stats=new H),this._stats},set:function(e){this._stats=e}},{key:"url",get:function(){return!this._url&&this.relurl&&(this._url=M.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(e){this._url=e}}])}();function W(e){return"initSegment"!==e.sn}function Y(e,t){return e.sn===(null==t?void 0:t.sn)&&e.level===t.level}function z(e,t){return e.sn===(null==t?void 0:t.sn)&&e.level===t.level&&e.cc===t.cc}var Q=function(e){function t(t,r){var i;return(i=e.call(this,r)||this)._decryptdata=null,i._programDateTime=null,i._ref=null,i._bitrate=void 0,i.rawProgramDateTime=null,i.tagList=[],i.duration=0,i.sn=0,i.levelkeys=void 0,i.type=void 0,i.loader=null,i.keyLoader=null,i.level=-1,i.cc=0,i.startPTS=void 0,i.endPTS=void 0,i.startDTS=void 0,i.endDTS=void 0,i.start=0,i.playlistOffset=0,i.deltaPTS=void 0,i.maxStartPTS=void 0,i.minEndPTS=void 0,i.data=void 0,i.bitrateTest=!1,i.title=null,i.initSegment=null,i.endList=void 0,i.gap=void 0,i.urlId=0,i.type=t,i}c(t,e);var r=t.prototype;return r.addStart=function(e){this.setStart(this.start+e)},r.setStart=function(e){this.start=e,this._ref&&(this._ref.start=e)},r.setDuration=function(e){this.duration=e,this._ref&&(this._ref.duration=e)},r.setKeyFormat=function(e){var t=this.levelkeys;if(t){var r,i=t[e];!i||null!=(r=this._decryptdata)&&r.keyId||(this._decryptdata=i.getDecryptData(this.sn,t))}},r.abortRequests=function(){var e,t;null==(e=this.loader)||e.abort(),null==(t=this.keyLoader)||t.abort()},r.setElementaryStreamInfo=function(e,t,r,i,n,a){void 0===a&&(a=!1);var s=this.elementaryStreams,o=s[e];o?(o.startPTS=Math.min(o.startPTS,t),o.endPTS=Math.max(o.endPTS,r),o.startDTS=Math.min(o.startDTS,i),o.endDTS=Math.max(o.endDTS,n)):s[e]={startPTS:t,endPTS:r,startDTS:i,endDTS:n,partial:a}},i(t,[{key:"byteLength",get:function(){if(this.hasStats){var e=this.stats.total;if(e)return e}if(this.byteRange.length){var t=this.byteRange[0],r=this.byteRange[1];if(F(t)&&F(r))return r-t}return null}},{key:"bitrate",get:function(){return this.byteLength?8*this.byteLength/this.duration:this._bitrate?this._bitrate:null},set:function(e){this._bitrate=e}},{key:"decryptdata",get:function(){var e,t=this.levelkeys;if(!t||t.NONE)return null;if(t.identity)this._decryptdata||(this._decryptdata=t.identity.getDecryptData(this.sn));else if(null==(e=this._decryptdata)||!e.keyId){var r=Object.keys(t);if(1===r.length){var i=this._decryptdata=t[r[0]]||null;i&&(this._decryptdata=i.getDecryptData(this.sn,t))}}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(null===this.programDateTime)return null;var e=F(this.duration)?this.duration:0;return this.programDateTime+1e3*e}},{key:"encrypted",get:function(){var e;if(null!=(e=this._decryptdata)&&e.encrypted)return!0;
vendor: 3,331 bytes, line 2
2if(this.levelkeys){var t,r=Object.keys(this.levelkeys),i=r.length;if(i>1||1===i&&null!=(t=this.levelkeys[r[0]])&&t.encrypted)return!0}return!1}},{key:"programDateTime",get:function(){return null===this._programDateTime&&this.rawProgramDateTime&&(this.programDateTime=Date.parse(this.rawProgramDateTime)),this._programDateTime},set:function(e){F(e)?this._programDateTime=e:this._programDateTime=this.rawProgramDateTime=null}},{key:"ref",get:function(){return W(this)?(this._ref||(this._ref={base:this.base,start:this.start,duration:this.duration,sn:this.sn,programDateTime:this.programDateTime}),this._ref):null}}])}(q),X=function(e){function t(t,r,i,n,a){var s;(s=e.call(this,i)||this).fragOffset=0,s.duration=0,s.independent=!1,s.relurl=void 0,s.fragment=void 0,s.index=void 0,s.gap=!1,s.duration=t.decimalFloatingPoint("DURATION"),s.gap=t.bool("GAP"),s.independent=t.bool("INDEPENDENT"),s.relurl=t.enumeratedString("URI"),s.fragment=r,s.index=n;var o=t.enumeratedString("BYTERANGE");return o&&s.setByteRange(o,a),a&&(s.fragOffset=a.fragOffset+a.duration),s}return c(t,e),i(t,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var e=this.elementaryStreams;return!!(e.audio||e.video||e.audiovideo||this.fragment.type===K.SUBTITLE&&this.stats.loading.end>0)}}])}(q);function J(e,t){var r=Object.getPrototypeOf(e);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i||J(r,t)}}function Z(e){switch(e.details){case $.FRAG_LOAD_TIMEOUT:case $.KEY_LOAD_TIMEOUT:case $.LEVEL_LOAD_TIMEOUT:case $.MANIFEST_LOAD_TIMEOUT:case $.AUDIO_TRACK_LOAD_TIMEOUT:case $.SUBTITLE_TRACK_LOAD_TIMEOUT:case $.ASSET_LIST_LOAD_TIMEOUT:return!0}return!1}function ee(e){return e.details.startsWith("key")}function te(e){return ee(e)&&!!e.frag&&!e.frag.decryptdata}function re(e,t){var r=Z(t);return e.default[(r?"timeout":"error")+"Retry"]}function ie(e,t){var r="linear"===e.backoff?1:Math.pow(2,t);return Math.min(r*e.retryDelayMs,e.maxRetryDelayMs)}function ne(e){return g(g({},e),{errorRetry:null,timeoutRetry:null})}function ae(e,t,r,i){if(!e)return!1;var n=null==i?void 0:i.code,a=t<e.maxNumRetry&&(function(e){return se(e)||!!e&&(e<400||e>499)}(n)||!!r);return e.shouldRetry?e.shouldRetry(e,t,r,i,a):a}function se(e){return 0===e&&!1===navigator.onLine}function oe(e,t){return t>0&&e.loadError>0&&0!==e.loadErrorTime&&self.performance.now()-e.loadErrorTime>t}var le=function(){function e(e,t,r){void 0===t&&(t=0),void 0===r&&(r=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=r}var t=e.prototype;return t.sample=function(e,t){var r=Math.pow(this.alpha_,e);this.estimate_=t*(1-r)+r*this.estimate_,this.totalWeight_+=e},t.getTotalWeight=function(){return this.totalWeight_},t.getEstimate=function(){if(this.alpha_){var e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_},e}(),ue=function(){function e(e,t,r,i){void 0===i&&(i=100),this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=r,this.minWeight_=.001,this.minDelayMs_=50,this.slow_
vendor: 50,167 bytes, line 2
2=new le(e),this.fast_=new le(t),this.defaultTTFB_=i,this.ttfb_=new le(e)}var t=e.prototype;return t.update=function(e,t){var r=this.slow_,i=this.fast_,n=this.ttfb_;r.halfLife!==e&&(this.slow_=new le(e,r.getEstimate(),r.getTotalWeight())),i.halfLife!==t&&(this.fast_=new le(t,i.getEstimate(),i.getTotalWeight())),n.halfLife!==e&&(this.ttfb_=new le(e,n.getEstimate(),n.getTotalWeight()))},t.sample=function(e,t){if(!(t<=0)){var r=Math.min(this.minDelayMs_,t/1e5),i=8*t,n=Math.max(e,r)/1e3,a=i/n;this.fast_.sample(n,a),this.slow_.sample(n,a)}},t.sampleTTFB=function(e){var t=e/1e3,r=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(r,Math.max(e,5))},t.canEstimate=function(){return this.fast_.getTotalWeight()>=this.minWeight_},t.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},t.getEstimateTTFB=function(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_},t.destroy=function(){},i(e,[{key:"defaultEstimate",get:function(){return this.defaultEstimate_}}])}(),de=function(e,t){this.trace=void 0,this.debug=void 0,this.log=void 0,this.warn=void 0,this.info=void 0,this.error=void 0;var r="["+e+"]:";this.trace=ce,this.debug=t.debug.bind(null,r),this.log=t.log.bind(null,r),this.warn=t.warn.bind(null,r),this.info=t.info.bind(null,r),this.error=t.error.bind(null,r)},ce=function(){},he={trace:ce,debug:ce,log:ce,warn:ce,info:ce,error:ce};function fe(){return u({},he)}function ge(e,t,r){return t[e]?t[e].bind(t):function(e,t){var r=self.console[e];return r?r.bind(self.console,(t?"["+t+"] ":"")+"["+e+"] >"):ce}(e,r)}var ve=fe();function pe(e,t,r){var i=fe();if("object"===("undefined"==typeof console?"undefined":a(console))&&!0===e||"object"===a(e)){var n=["debug","log","info","warn","error"];n.forEach((function(t){i[t]=ge(t,e,r)}));try{i.log('Debug logs enabled for "'+t+'" in hls.js version 1.7.3')}catch(e){return fe()}n.forEach((function(t){ve[t]=ge(t,e)}))}else u(ve,i);return i}var me=ve;function ye(e){if(void 0===e&&(e=!0),"undefined"!=typeof self)return(e||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function Ee(e,t){var r=Object.keys(e),i=Object.keys(t),n=r.length,a=i.length;return!n||!a||n===a&&!r.some((function(e){return-1===i.indexOf(e)}))}function be(e,t){return t+10<=e.length&&73===e[t]&&68===e[t+1]&&51===e[t+2]&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128}function Te(e,t){var r=0;return r=(127&e[t])<<21,r|=(127&e[t+1])<<14,r|=(127&e[t+2])<<7,r|=127&e[t+3]}function Se(e,t){return be(e,t)&&Te(e,t+6)+10<=e.length-t}function we(e,t){return t+10<=e.length&&51===e[t]&&68===e[t+1]&&73===e[t+2]&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128}function Ae(e,t){for(var r=t,i=0;be(e,t);)i+=10,i+=Te(e,t+6),we(e,t+10)&&(i+=10),t+=i;if(i>0)return e.subarray(r,r+i)}function Le(e,t,r){return void 0===t&&(t=0),void 0===r&&(r=1/0),function(e,t,r,i){var n,a=T(n=e)?n:n.buffer,s=1;"BYTES_PER_ELEMENT"in i&&(s=i.BYTES_PER_ELEMENT);var o,l=(o=e)&&T(o.buffer)&&void 0!==o.byteLength&&void 0!==o.byteOffset?e.byteOffset:0,u=(l+e.byteLength)/s,d=(l+t)/s,c=Math.floor(Math.max(0,Math.min(d,u)));return new i(a,c,Math.floor(Math.min(c+Math.max(r,0),u))-c)}(e,t,r,Uint8Array)}function Ie(e,t){void 0===t&&(t=!1);var r=t?e.indexOf(0):e.length,i=function(e,t){var r;void 0===t&&(t={}),r=T(e)?new DataView(e):new DataView(e.buffer,e.byteOffset,e.byteLength);var i=0,n=t.encoding;if(!n){var a=r.getUint8(0),s=r.getUint8(1);239==a&&187==s&&191==r.getUint8(2)?(n=L,i=3):254==a&&255==s?(n=w,i=2):255==a&&254==s?(n=A,i=2):n=L}if("undefined"!=typeof TextDecoder)return new TextDecoder(n).decode(r);for(var o,l=r.byteLength,u=n!==w,d="";i<l;){switch(n){case L:if((o=r.getUint8(i))<128)i++;else if(o>=194&&o<=223)if(i+1<l){var c=r.getUint8(i+1);c>=128&&c<=191?(o=(31&o)<<6|63&c,i+=2):i++}else i++;else if(o>=224&&o<=239)if(i+2<=l-1){var h=r.getUint8(i+1),f=r.getUint8(i+2);h>=128&&h<=191&&f>=128&&f<=191?(o=(15&o)<<12|(63&h)<<6|63&f,i+=3):i++}else i++;else if(o>=240&&o<=244)if(i+3<=l-1){var g=r.getUint8(i+1),v=r.getUint8(i+2),p=r.getUint8(i+3);g>=128&&g<=191&&v>=128&&v<=191&&p>=128&&p<=191?(o=(7&o)<<18|(63&g)<<12|(63&v)<<6|63&p,i+=4):i++}else i++;else i++;break;case w:case S:case A:o=r.getUint16(i,u),i+=2}d+=String.fromCodePoint(o)}return d}(new DataView(e.buffer,e.byteOffset,r),{encoding:L});return t?i:i.replace(/\0/g,"")}function ke(e){var t={key:e.type,description:"",data:"",mimeType:null,pictureType:null};if(!(e.size<2))if(3===e.data[0]){var r=e.data.subarray(1).indexOf(0);if(-1!==r){var i=Ie(Le(e.data,1,r)),n=e.data[2+r],a=e.data.subarray(3+r).indexOf(0);if(-1!==a){var s,o,l=Ie(Le(e.data,3+r,a));return s="--\x3e"===i?Ie(Le(e.data,4+r+a)):T(o=e.data.subarray(4+r+a))?o:0==o.byteOffset&&o.byteLength==o.buffer.byteLength?o.buffer:new Uint8Array(o).buffer,t.mimeType=i,t.pictureType=n,t.description=l,t.data=s,t}}}else console.log("Ignore frame with unrecognized character encoding")}function Re(e){return"PRIV"===e.type?function(e){if(!(e.size<2)){var t=Ie(e.data,!0),r=new Uint8Array(e.data.subarray(t.length+1));return{key:e.type,info:t,data:r.buffer}}}(e):"W"===e.type[0]?function(e){if("WXXX"===e.type){if(e.size<2)return;var t=1,r=Ie(e.data.subarray(t),!0);t+=r.length+1;var i=Ie(e.data.subarray(t));return{key:e.type,info:r,data:i}}var n=Ie(e.data);return{key:e.type,info:"",data:n}}(e):"APIC"===e.type?ke(e):function(e){if(!(e.size<2)){if("TXXX"===e.type){var t=1,r=e.data,i=Ie(r.subarray(t),!0);t+=i.length+1;var n=Ie(r.subarray(t));return{key:e.type,info:i,data:n}}var a=Ie(e.data.subarray(1));return{key:e.type,info:"",data:a}}}(e)}function De(e){var t=String.fromCharCode(e[0],e[1],e[2],e[3]),r=Te(e,4);return{type:t,size:r,data:e.subarray(10,10+r)}}var Ce=10,Pe=10;function _e(e){for(var t=0,r=[];be(e,t);){var i=Te(e,t+6);e[t+5]>>6&1&&(t+=Ce);for(var n=(t+=Ce)+i;t+Pe<n;){var a=De(e.subarray(t)),s=Re(a);s&&r.push(s),t+=a.size+Ce}we(e,t)&&(t+=Ce)}return r}function xe(e){return e&&"PRIV"===e.key&&"com.apple.streaming.transportStreamTimestamp"===e.info}function Oe(e){if(8===e.data.byteLength){var t=new Uint8Array(e.data),r=1&t[3],i=(t[4]<<23)+(t[5]<<15)+(t[6]<<7)+t[7];return i/=45,r&&(i+=47721858.84),Math.round(i)}}function Me(e){for(var t,r=n(_e(e));!(t=r()).done;){var i=t.value;if(xe(i))return Oe(i)}}function Fe(e){for(var t="",r=0;r<e.length;r++){var i=e[r].toString(16);i.length<2&&(i="0"+i),t+=i}return t}function Ne(e){return Uint8Array.from(e.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}function Ue(e){return Uint8Array.from(atob(e),(function(e){return e.charCodeAt(0)}))}function Be(e){return String.fromCharCode.apply(null,e)}var $e,Ge=Math.pow(2,32)-1,He={avc1:1635148593,avcC:1635148611,hvc1:1752589105,hvcC:1752589123,btrt:1651798644,dinf:1684631142,dref:1685218662,esds:1702061171,free:1718773093,ftyp:1718909296,hdlr:1751411826,mdat:1835295092,mdhd:1835296868,mdia:1835297121,mfhd:1835427940,minf:1835626086,moof:1836019558,moov:1836019574,mp4a:1836069985,".mp3":778924083,dac3:1684103987,"ac-3":1633889587,mvex:1836475768,mvhd:1836476516,pasp:1885434736,sdtp:1935963248,stbl:1937007212,stco:1937007471,stsc:1937011555,stsd:1937011556,stsz:1937011578,stts:1937011827,tfdt:1952867444,tfhd:1952868452,traf:1953653094,trak:1953653099,trun:1953658222,trex:1953654136,tkhd:1953196132,vmhd:1986881636,smhd:1936549988},Ve={video:1,audio:2,id3:3,text:4};function Ke(e,t){var r=e[t]<<8|e[t+1];return r<0?65536+r:r}function je(e,t){var r=e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3];return r<0?4294967296+r:r}function qe(e,t){var r=je(e,t);return r*=Math.pow(2,32),r+=je(e,t+4)}function We(e,t){for(var r="",i=t;i<e.length;i++)if(r+=String.fromCharCode(e[i]),0===e[i])return r;return null}function Ye(e,t){return e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}function ze(e,t,r){e[t]=r>>24,e[t+1]=r>>16&255,e[t+2]=r>>8&255,e[t+3]=255&r}function Qe(e,t,r){var i=t.byteOffset-e.byteOffset-8,n=8+r,a=t.byteLength+8-n;a<8||(ze(e,i,n),ze(e,i+n,a),ze(e,i+n+4,He.free))}function Xe(e,t){return[e.byteOffset-t-8,e.byteOffset-t+e.byteLength]}function Je(e,t){t.sort((function(e,t){return e[0]-t[0]}));for(var r=t.reduce((function(e,t){var r=t[0];return e+t[1]-r}),0),i=new Uint8Array(e.byteLength-r),n=0,a=0,s=0;s<t.length;s++){var o=t[s],l=o[0],u=o[1];i.set(e.subarray(n,l),a),a+=l-n,n=u}return i.set(e.subarray(n),a),{result:i,dropped:r,droppedBefore:function(e){return t.reduce((function(t,r){var i=r[0],n=r[1];return n<=e?t+n-i:t}),0)}}}function Ze(e,t){var r=[];return t.length?(et(e,t,0,0,e.byteLength,r),r):r}function et(e,t,r,i,n,a){var s=t[r];if(4===(null==s?void 0:s.length))for(var o=s.charCodeAt(0),l=s.charCodeAt(1),u=s.charCodeAt(2),d=s.charCodeAt(3),c=t.length-1,h=i;h<n;){var f=h+8<=n,g=h+4<=n?16777216*e[h]+(e[h+1]<<16|e[h+2]<<8|e[h+3]):je(e,h),v=g>1?h+g:n;if(f&&e[h+4]===o&&e[h+5]===l&&e[h+6]===u&&e[h+7]===d){var p=Math.min(v,n);r===c?a.push(e.subarray(h+8,p)):et(e,t,r+1,h+8,p,a)}h=v}}function tt(e){var t=[],r=e[0],i=8,n=je(e,i);i+=4;var a=0,s=0;0===r?(a=je(e,i),s=je(e,i+4),i+=8):(a=qe(e,i),s=qe(e,i+8),i+=16),i+=2;var o=e.length+s,l=Ke(e,i);i+=2;for(var u=0;u<l;u++){var d=i,c=je(e,d);d+=4;var h=2147483647&c;if(1==(2147483648&c)>>>31)return me.warn("SIDX has hierarchical references (not supported)"),null;var f=je(e,d);d+=4,t.push({referenceSize:h,subsegmentDuration:f,info:{duration:f/n,start:o,end:o+h-1}}),o+=h,i=d+=4}return{earliestPresentationTime:a,timescale:n,version:r,referencesCount:l,references:t}}function rt(e){for(var t=[],r=Ze(e,["moov","trak"]),i=0;i<r.length;i++){var n=r[i],a=Ze(n,["tkhd"])[0];if(a){var s=a[0],o=je(a,0===s?12:20),l=Ze(n,["mdia","mdhd"])[0];if(l){var u=je(l,0===(s=l[0])?12:20),d=Ze(n,["mdia","hdlr"])[0];if(d){var c=Be(d.subarray(8,12)),h={soun:j.AUDIO,vide:j.VIDEO}[c],f=it(Ze(n,["mdia","minf","stbl","stsd"])[0]);h?(t[o]={timescale:u,type:h,stsd:f},t[h]=g({timescale:u,id:o},f)):t[o]={timescale:u,type:c,stsd:f}}}}}return Ze(e,["moov","mvex","trex"]).forEach((function(e){var r=je(e,4),i=t[r];i&&(i.default={duration:je(e,12),sampleSize:je(e,16),flags:je(e,20)})})),t}function it(e){var t,r=e.subarray(8),i=r.subarray(86),n=Be(r.subarray(4,8)),a=n,s="enca"===n||"encv"===n;if(s){var o=Ze(r,[n])[0];Ze(o.subarray("enca"===n?28:78),["sinf"]).forEach((function(e){var t=Ze(e,["schm"])[0];if(t){var r=Be(t.subarray(4,8));if("cbcs"===r||"cenc"===r){var i=Ze(e,["frma"])[0];i&&(a=Be(i))}}}))}var l=a;switch(a){case"avc1":case"avc2":case"avc3":case"avc4":var u=Ze(i,["avcC"])[0];u&&u.length>3&&(a+="."+st(u[1])+st(u[2])+st(u[3]),t=nt("avc1"===l?"dva1":"dvav",i));break;case"mp4a":var d=Ze(r,[n])[0],c=Ze(d.subarray(28),["esds"])[0];if(c&&c.length>7){var h=4;if(3!==c[h++])break;h=at(c,h),h+=2;var f=c[h++];if(128&f&&(h+=2),64&f&&(h+=c[h++]),4!==c[h++])break;h=at(c,h);var g=c[h++];if(64!==g)break;if(a+="."+st(g),h+=12,5!==c[h++])break;h=at(c,h);var v=c[h++],p=(248&v)>>3;31===p&&(p+=1+((7&v)<<3)+((224&c[h])>>5)),a+="."+p}break;case"hvc1":case"hev1":var m=Ze(i,["hvcC"])[0];if(m&&m.length>12){var y=m[1],E=["","A","B","C"][y>>6],b=31&y,T=je(m,2),S=(32&y)>>5?"H":"L",w=m[12],A=m.subarray(6,12);a+="."+E+b,a+="."+function(e){for(var t=0,r=0;r<32;r++)t|=(e>>r&1)<<31-r;return t>>>0}(T).toString(16).toUpperCase(),a+="."+S+w;for(var L="",I=A.length;I--;){var k=A[I];(k||L)&&(L="."+k.toString(16).toUpperCase()+L)}a+=L}t=nt("hev1"==l?"dvhe":"dvh1",i);break;case"dvh1":case"dvhe":case"dvav":case"dva1":case"dav1":a=nt(a,i)||a;break;case"vp09":var R=Ze(i,["vpcC"])[0];if(R&&R.length>6){var D=R[4],C=R[5],P=R[6]>>4&15;a+="."+ot(D)+"."+ot(C)+"."+ot(P)}break;case"av01":var _=Ze(i,["av1C"])[0];if(_&&_.length>2){var x=_[1]>>>5,O=31&_[1],M=_[2]>>>7?"H":"M",F=(64&_[2])>>6,N=(32&_[2])>>5,U=2===x&&F?N?12:10:F?10:8,B=(16&_[2])>>4,$=(8&_[2])>>3,G=(4&_[2])>>2,H=3&_[2];a+="."+x+"."+ot(O)+M+"."+ot(U)+"."+B+"."+$+G+H+"."+ot(1)+"."+ot(1)+"."+ot(1)+".0",t=nt("dav1",i)}}return{codec:a,encrypted:s,supplemental:t}}function nt(e,t){var r=Ze(t,["dvvC"]),i=r.length?r[0]:Ze(t,["dvcC"])[0];if(i){var n=i[2]>>1&127,a=i[2]<<5&32|i[3]>>3&31;return e+"."+ot(n)+"."+ot(a)}}function at(e,t){for(var r=t+5;128&e[t++]&&t<r;);return t}function st(e){return("0"+e.toString(16).toUpperCase()).slice(-2)}function ot(e){return(e<10?"0":"")+e}function lt(e,t){Ze(e,["moov","trak"]).forEach((function(e){var r=Ze(e,["mdia","minf","stbl","stsd"])[0];if(r){var i=r.subarray(8),n=Ze(i,["enca"]),a=n.length>0;a||(n=Ze(i,["encv"])),n.forEach((function(e){Ze(a?e.subarray(28):e.subarray(78),["sinf"]).forEach((function(e){var r=ut(e);r&&t(r,a)}))}))}}))}function ut(e){var t=Ze(e,["schm"])[0];if(t){var r=Be(t.subarray(4,8));if("cbcs"===r||"cenc"===r){var i=Ze(e,["schi","tenc"])[0];if(i)return i}}}function dt(e){return"undefined"==typeof TextDecoder?Ie(e):($e||($e=new TextDecoder("utf-8"))).decode(e).replace(/\0/g,"")}function ct(e,t,r,i,n){for(var a={},s=!1,o=function(e){for(var t=e.byteLength,r=[],i=0;i<t;){var n=i+8<=t,a=i+4<=t?16777216*e[i]+(e[i+1]<<16|e[i+2]<<8|e[i+3]):je(e,i),s=a>1?i+a:t;if(n&&109===e[i+4]&&111===e[i+5]&&111===e[i+6]&&102===e[i+7])for(var o=Math.min(s,t),l=i+8;l<o;){var u=l+8<=o,d=l+4<=o?16777216*e[l]+(e[l+1]<<16|e[l+2]<<8|e[l+3]):je(e,l),c=d>1?l+d:o;if(u&&116===e[l+4]&&114===e[l+5]&&97===e[l+6]&&102===e[l+7]){for(var h=Math.min(c,o),f=void 0,g=void 0,v=[],p=l+8;p<h;){var m=p+8<=h,y=p+4<=h?16777216*e[p]+(e[p+1]<<16|e[p+2]<<8|e[p+3]):je(e,p),E=y>1?p+y:h;if(m&&116===e[p+4]){var b=Math.min(E,h);102===e[p+5]&&104===e[p+6]&&100===e[p+7]?g||(g=e.subarray(p+8,b)):102===e[p+5]&&100===e[p+6]&&116===e[p+7]?f||(f=e.subarray(p+8,b)):114===e[p+5]&&117===e[p+6]&&110===e[p+7]&&v.push(e.subarray(p+8,b))}p=E}r.push({moofOffset:e.byteOffset+i,tfdt:f,tfhd:g,truns:v})}l=c}i=s}return r}(e),l=e.byteLength,u=0;u<o.length;u++){var d=o[u],c=d.moofOffset,h=d.tfdt,f=d.tfhd,g=d.truns,v=je(f,4),p=t[v];if(p){var m=a[v]||(a[v]={start:NaN,duration:0,sampleCount:0,trun:[],timescale:p.timescale,type:p.type}),y=void 0;if(h){var E=h[0];y=je(h,4),1===E&&(y===Ge?r.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"):(y*=Ge+1,y+=je(h,8))),F(y)&&(!F(m.start)||y<m.start)&&(m.start=y),n&&F(y)&&(n.timeOffset=y/n.timescale)}var b=(null==n?void 0:n.trackId)===v&&p.type===j.VIDEO,T=p.default,S=16777215&je(f,0),w=(null==T?void 0:T.duration)||0,A=void 0,L=(null==T?void 0:T.sampleSize)||0,I=8;1&S&&(I+=8),2&S&&(I+=4),8&S&&(w=je(f,I),A=f.byteOffset-e.byteOffset+I,I+=4),16&S&&(L=je(f,I));var k=0,R=0!=(1&S),D=!R&&0!=(131072&S);R?(k=je(f,8),k*=Math.pow(2,32),k+=je(f,12)):D&&(k=c);for(var C=y||0,P=0,_=w,x=0;x<g.length;x++){var O=g[x],M=je(O,4),N=m.sampleCount;m.sampleCount+=M;var U=1&O[3],B=0,$=4&O[3],G=1&O[2],H=2&O[2],V=4&O[2],K=8&O[2],q=8;U&&(B=Ye(O,q),q+=4),$&&(1&O[q+1]||void 0!==m.keyFrameIndex||(m.keyFrameIndex=N),q+=4);var W=k+B;if(i||0!==O[1]||6!==O[2]||1!==O[3]){var Y=void 0,z=void 0;i&&(z={sampleOffset:W,samples:Y=[],defaultSampleDurationOffset:A},W<=l&&m.trun.push(z));for(var Q=void 0,X=0;X<M;X++){var J=void 0;G?(i&&(J=O.byteOffset-e.byteOffset+q),_=je(O,q),q+=4):_=w,H?(Q=je(O,q),q+=4):Q=L;var Z=void 0,ee=void 0;V&&(ee=1&O[q+1]?1:0,i&&(Z={isNonSync:ee,dependsOn:1==(3&O[q])?1:2}),q+=4);var te=0;if(K&&(te=0===O[0]?je(O,q):Ye(O,q),q+=4),b){for(var re=W,ie=0;ie<Q;){var ne=je(e,re);re+=4,gt(n.isHEVCFlavor,e[re])&&vt(e.subarray(re,re+ne),n.isHEVCFlavor?2:1,n.timeOffset+te/n.timescale,n.samples),re+=ne,ie+=ne+4}n.timeOffset+=_/n.timescale}if((W+=Q)<=l){z&&void 0!==J&&(z.lastSampleDurationOffset=J),0===ee&&void 0===m.keyFrameIndex&&(m.keyFrameIndex=X,m.keyFrameStart=C);var ae=C+te;(!F(m.ptsMin)||ae<m.ptsMin)&&(m.ptsMin=ae),(!F(m.ptsMax)||ae+_>m.ptsMax)&&(m.ptsMax=ae+_),Y&&(Y[X]={cts:te,duration:_,flags:Z,size:Q})}C+=_,P+=_}!P&&w&&(P+=w*M)}else{for(var se,oe,le=C,ue=W,de=q,ce=-1,he=0,fe=0,ge=null!=(se=null==n?void 0:n.timeOffset)?se:0,ve=w/(null!=(oe=null==n?void 0:n.timescale)?oe:1),pe=!0===(null==n?void 0:n.isHEVCFlavor),me=pe?2:1,ye=0;ye<M;ye++){var Ee=0===O[q]?O[q+1]<<16|O[q+2]<<8|O[q+3]:je(O,q),be=-1===ce&&void 0===m.keyFrameIndex&&0==(1&O[q+5]);q+=8;var Te=W+Ee;if(b){if(Ee>0){var Se=W;do{var we=0===e[Se]?e[Se+1]<<16|e[Se+2]<<8|e[Se+3]:je(e,Se),Ae=e[Se+=4],Le=pe?Ae>>1&63:31&Ae;(pe?39===Le||40===Le:6===Le)&&vt(e.subarray(Se,Se+we),me,ge,n.samples),Se+=we}while(Se<Te)}ge+=ve}W=Te,be&&(ce=ye,he=W)}if(W<=l)fe=M;else for(var Ie=ue,ke=de,Re=0;Re<M&&!((Ie+=0===O[ke]?O[ke+1]<<16|O[ke+2]<<8|O[ke+3]:je(O,ke))>l);Re++)fe=Re+1,ke+=8;if(b&&(n.timeOffset=ge),-1!==ce&&he<=l&&void 0===m.keyFrameIndex&&(m.keyFrameIndex=ce,m.keyFrameStart=le+ce*w),fe){(!F(m.ptsMin)||le<m.ptsMin)&&(m.ptsMin=le);var De=le+fe*w;(!F(m.ptsMax)||De>m.ptsMax)&&(m.ptsMax=De)}var Ce=w*M;C=le+Ce,P+=Ce}}m.duration+=P,m.duration&&(s=!0)}}if(!s){for(var Pe=1/0,_e=0,xe=Ze(e,["sidx"]),Oe=0;Oe<xe.length;Oe++){var Me=tt(xe[Oe]);if(null!=Me&&Me.references){Pe=Math.min(Pe,Me.earliestPresentationTime/Me.timescale);var Fe=Me.references.reduce((function(e,t){return e+t.info.duration||0}),0);_e=Math.max(_e,Fe+Me.earliestPresentationTime/Me.timescale)}}_e&&F(_e)&&Object.keys(a).forEach((function(e){a[e].duration||(a[e].duration=_e*a[e].timescale-a[e].start)}))}return a}function ht(e,t){var r=new Uint8Array(e.length+t.length);return r.set(e),r.set(t,e.length),r}function ft(e){if(!e)return!1;var t=e.substring(0,4);return"hvc1"===t||"hev1"===t||"dvh1"===t||"dvhe"===t}function gt(e,t){if(e){var r=t>>1&63;return 39===r||40===r}return 6==(31&t)}function vt(e,t,r,i){var n=pt(e),a=0;a+=t;for(var s=0,o=0,l=0;a<n.length;){s=0;do{if(a>=n.length)break;s+=l=n[a++]}while(255===l);o=0;do{if(a>=n.length)break;o+=l=n[a++]}while(255===l);var u=n.length-a,d=a;if(o<u)a+=o;else if(o>u){me.error("Malformed SEI payload. "+o+" is too small, only "+u+" bytes left to parse.");break}if(4===s){if(181===n[d++]){var c=Ke(n,d);if(d+=2,49===c){var h=je(n,d);if(d+=4,1195456820===h){var f=n[d++];if(3===f){var g=n[d++],v=64&g,p=v?2+3*(31&g):0,m=new Uint8Array(p);if(v){m[0]=g;for(var y=1;y<p;y++)m[y]=n[d++]}i.push({type:f,payloadType:s,pts:r,bytes:m})}}}}}else if(5===s&&o>16){for(var E=[],b=0;b<16;b++){var T=n[d++].toString(16);E.push(1==T.length?"0"+T:T),3!==b&&5!==b&&7!==b&&9!==b||E.push("-")}for(var S=o-16,w=new Uint8Array(S),A=0;A<S;A++)w[A]=n[d++];i.push({payloadType:s,pts:r,uuid:E.join(""),userData:dt(w),userDataBytes:w})}}}function pt(e){for(var t,r=e.byteLength,i=e.indexOf(3,3);-1!==i;)0===e[i-1]&&0===e[i-2]&&(t||(t=[])).push(i),i=e.indexOf(3,i+1);if(!t)return e;for(var n=r-t.length,a=new Uint8Array(n),s=0,o=0,l=0;l<n;o++,l++)o===t[s]&&(o++,s++),a[l]=e[o];return a}function mt(e,t,r){if(16!==e.byteLength)throw new RangeError("Invalid system id");var i,n;i=new Uint8Array,n=new Uint8Array;var a=new Uint8Array(4);return r.byteLength>0&&new DataView(a.buffer).setUint32(0,r.byteLength,!1),function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];for(var n=r.length,a=8,s=n;s--;)a+=r[s].byteLength;var o=new Uint8Array(a);for(o[0]=a>>24&255,o[1]=a>>16&255,o[2]=a>>8&255,o[3]=255&a,o.set(e,4),s=0,a=8;s<n;s++)o.set(r[s],a),a+=r[s].byteLength;return o}([112,115,115,104],new Uint8Array([0,0,0,0]),e,n,i,a,r)}function yt(e){var t=[];if(e instanceof ArrayBuffer)for(var r=e.byteLength,i=0;i+32<r;){var n=Et(new DataView(e,i));t.push(n),i+=n.size}return t}function Et(e){var t=e.getUint32(0),r=e.byteOffset,i=e.byteLength;if(i<t)return{offset:r,size:i};if(1886614376!==e.getUint32(4))return{offset:r,size:t};var n=e.getUint32(8)>>>24;if(0!==n&&1!==n)return{offset:r,size:t};var a,s=e.buffer,o=Fe(new Uint8Array(s,r+12,16)),l=null,u=0;if(0===n)u=28;else{var d=e.getUint32(28);if(!d||i<32+16*d)return{offset:r,size:t};l=[];for(var c=0;c<d;c++)l.push(new Uint8Array(s,r+32+16*c,16));u=32+16*d}if(!u)return{offset:r,size:t};var h=e.getUint32(u);return t-32<h?{offset:r,size:t}:(a=new Uint8Array(s,r+u+4,h),0===n&&(l=function(e){for(var t=[],r=0;r<e.length;){var i=e[r++],n=7&i;if(0!==n)if(2===n){for(var a=0,s=0,o=128;128&o;s+=7)a|=(127&(o=e[r++]))<<s;if(i>>3==2)if(32===a){for(var l=new Uint8Array(16),u=0;u<16;u++)l[u]=parseInt(String.fromCharCode(e[r+2*u],e[r+2*u+1]),16);t.push(l)}else 16===a&&t.push(e.subarray(r,r+16));r+=a}else r+=1===n?8:4;else for(;128&e[r++];);}return t}(a)),{version:n,systemId:o,kids:l,data:a,offset:r,size:t})}var bt,Tt,St,wt=Lt("userAgent"),At=Lt("vendor");function Lt(e){try{return navigator[e]||""}catch(e){}return""}function It(){if(void 0===bt){var e=wt.match(/Chrome\/(\d+)/i);bt=e?parseInt(e[1]):0}return bt}function kt(){return/\(Windows.+Firefox\//i.test(wt)}var Rt={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,dav1:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1},image:{mjpg:1}};function Dt(e,t){var r=Rt[t];return!!r&&!!r[e.slice(0,4)]}function Ct(e,t,r){return void 0===r&&(r=!0),!e.split(",").some((function(e){return!Pt(e,t,r)}))}function Pt(e,t,r){var i;void 0===r&&(r=!0);var n=ye(r);return null!=(i=null==n?void 0:n.isTypeSupported(_t(e,t)))&&i}function _t(e,t){return t+"/mp4;codecs="+e}function xt(e){if(e){var t=e.substring(0,4);return Rt.video[t]}return 2}function Ot(e){var t=kt();return e.split(",").reduce((function(e,r){var i=t&&ft(r)?9:Rt.video[r];return i?(2*i+e)/(e?3:2):(Rt.audio[r]+e)/(e?2:1)}),0)}var Mt={},Ft=/flac|opus|mp4a\.40\.34/i;function Nt(e,t){return void 0===t&&(t=!0),e.replace(Ft,(function(e){return function(e,t){if(void 0===t&&(t=!0),Mt[e])return Mt[e];for(var r={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"],"mp4a.40.34":["mp3"]}[e],i=0;i<r.length;i++){var n;if(Pt(r[i],"audio",t))return Mt[e]=r[i],r[i];if("mp3"===r[i]&&null!=(n=ye(t))&&n.isTypeSupported("audio/mpeg"))return""}return e}(e.toLowerCase(),t)}))}function Ut(e,t){if(e&&(e.length>4||-1!==["ac-3","ec-3","alac","fLaC","Opus"].indexOf(e))&&(Bt(e,"audio")||Bt(e,"video")))return e;if(t){var r=t.split(",");if(r.length>1){if(e)for(var i=r.length;i--;)if(r[i].substring(0,4)===e.substring(0,4))return r[i];return r[0]}}return t||e}function Bt(e,t){return Dt(e,t)&&Pt(e,t)}function $t(e){if(e.startsWith("av01.")){for(var t=e.split("."),r=["0","111","01","01","01","0"],i=t.length;i>4&&i<10;i++)t[i]=r[i-4];return t.join(".")}return e}function Gt(e){var t=ye(e)||{isTypeSupported:function(){return!1}};return{mpeg:t.isTypeSupported("audio/mpeg"),mp3:t.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:t.isTypeSupported('audio/mp4; codecs="ac-3"')}}function Ht(e){return e.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}var Vt={supported:!1,smooth:!1,powerEfficient:!1},Kt={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]};function jt(e,t){return{supported:!1,configurations:t,decodingInfoResults:[Vt],error:e}}function qt(e,t,r,i){void 0===i&&(i={});var n=e.videoCodec;if(!n&&!e.audioCodec||!r)return Promise.resolve(Kt);for(var a=[],s=function(e){var t,r=null==(t=e.videoCodec)?void 0:t.split(","),i=Yt(e),n=e.width||640,a=e.height||480,s=e.frameRate||30,o=e.videoRange.toLowerCase();return r?r.map((function(e){var t={contentType:_t($t(e),"video"),width:n,height:a,bitrate:i,framerate:s};return"sdr"!==o&&(t.transferFunction=o),t})):[]}(e),o=s.length,l=function(e,t,r){var i,n=null==(i=e.audioCodec)?void 0:i.split(","),a=Yt(e);return n&&e.audioGroups?e.audioGroups.reduce((function(e,i){var s,o=i?null==(s=t.groups[i])?void 0:s.tracks:null;return o?o.reduce((function(e,t){if(t.groupId===i){var s=parseFloat(t.channels||"");n.forEach((function(t){var i={contentType:_t(t,"audio"),bitrate:r?Wt(t,a):a};s&&(i.channels=""+s),e.push(i)}))}return e}),e):e}),[]):[]}(e,t,o>0),u=l.length,d=o||1*u||1;d--;){var c={type:"media-source"};if(o&&(c.video=s[d%o]),u){c.audio=l[d%u];var h=c.audio.bitrate;c.video&&h&&(c.video.bitrate-=h)}a.push(c)}if(n){var f=navigator.userAgent;if(n.split(",").some((function(e){return ft(e)}))&&kt())return Promise.resolve(jt(new Error("Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent string: ("+f+")"),a))}return Promise.all(a.map((function(e){var t,n,a,s,o=(n="",a=(t=e).audio,(s=t.video)&&(n+=Ht(s.contentType)+"_r"+s.height+"x"+s.width+"f"+Math.ceil(s.framerate)+(s.transferFunction||"sd")+"_"+Math.ceil(s.bitrate/1e5)),a&&(n+=(s?"_":"")+Ht(a.contentType)+"_c"+a.channels),n);return i[o]||(i[o]=r.decodingInfo(e))}))).then((function(e){return{supported:!e.some((function(e){return!e.supported})),configurations:a,decodingInfoResults:e}})).catch((function(e){return{supported:!1,configurations:a,decodingInfoResults:[],error:e}}))}function Wt(e,t){if(t<=1)return 1;var r=128e3;return"ec-3"===e?r=768e3:"ac-3"===e&&(r=64e4),Math.min(t/2,r)}function Yt(e){return 1e3*Math.ceil(Math.max(.9*e.bitrate,e.averageBitrate)/1e3)||1}function zt(e,t,r){var i=encodeURIComponent(t),n=i+"="+encodeURIComponent(r),a=!1,s=[];e.search.substring(1).split("&").forEach((function(e){e===i||e.startsWith(i+"=")?a||(s.push(n),a=!0):e&&s.push(e)})),a||s.push(n),e.search=s.join("&")}var Qt=["NONE","TYPE-0","TYPE-1",null],Xt=["SDR","PQ","HLG"],Jt="",Zt="YES",er="v2";function tr(e){var t=e.canSkipUntil,r=e.canSkipDateRanges,i=e.age;return t&&i<t/2?r?er:Zt:Jt}var rr=function(){function e(e,t,r){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=r}return e.prototype.addDirectives=function(e){var t=new self.URL(e);return void 0!==this.msn&&zt(t,"_HLS_msn",this.msn.toString()),void 0!==this.part&&zt(t,"_HLS_part",this.part.toString()),this.skip&&zt(t,"_HLS_skip",this.skip),t.href},e}(),ir=function(){function e(e){if(this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.url=void 0,this.frameRate=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.supplemental=void 0,this.videoCodec=void 0,this.width=void 0,this.imageCodec=void 0,this.iframes=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loadErrorTime=0,this.loaded=void 0,this.realBitrate=0,this.supportedPromise=void 0,this.supportedResult=void 0,this._avgBitrate=0,this._audioGroups=void 0,this._subtitleGroups=void 0,this._urlId=0,this.url=[e.url],this._attrs=[e.attrs],this.bitrate=e.bitrate,e.details&&(this.details=e.details),this.id=e.id||0,this.name=e.name,this.width=e.width||0,this.height=e.height||0,this.frameRate=e.attrs.optionalFloat("FRAME-RATE",0),this._avgBitrate=e.attrs.decimalInteger("AVERAGE-BANDWIDTH"),this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,"imageCodec"in e&&(this.imageCodec=e.imageCodec),this.codecSet=[e.videoCodec,e.audioCodec].filter((function(e){return!!e})).map((function(e){return e.substring(0,4)})).join(","),"supplemental"in e){var t;this.supplemental=e.supplemental;var r=null==(t=e.supplemental)?void 0:t.videoCodec;r&&r!==e.videoCodec&&(this.codecSet+=","+r.substring(0,4))}"iframes"in e&&e.iframes?this.iframes=!0:(this.addGroupId("audio",e.attrs.AUDIO),this.addGroupId("text",e.attrs.SUBTITLES))}var t=e.prototype;return t.hasAudioGroup=function(e){return nr(this._audioGroups,e)},t.hasSubtitleGroup=function(e){return nr(this._subtitleGroups,e)},t.addGroupId=function(e,t){if(t)if("audio"===e){var r=this._audioGroups;r||(r=this._audioGroups=[]),-1===r.indexOf(t)&&r.push(t)}else if("text"===e){var i=this._subtitleGroups;i||(i=this._subtitleGroups=[]),-1===i.indexOf(t)&&i.push(t)}},t.addFallback=function(){},i(e,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"averageBitrate",get:function(){return this._avgBitrate||this.realBitrate||this.bitrate}},{key:"attrs",get:function(){return this._attrs[0]}},{key:"codecs",get:function(){return this.attrs.CODECS||""}},{key:"pathwayId",get:function(){return this.attrs["PATHWAY-ID"]||"."}},{key:"videoRange",get:function(){return this.attrs["VIDEO-RANGE"]||"SDR"}},{key:"score",get:function(){return this.attrs.optionalFloat("SCORE",0)}},{key:"uri",get:function(){return this.url[0]||""}},{key:"audioGroups",get:function(){return this._audioGroups}},{key:"subtitleGroups",get:function(){return this._subtitleGroups}},{key:"urlId",get:function(){return 0},set:function(e){}},{key:"audioGroupIds",get:function(){return this.audioGroups?[this.audioGroupId]:void 0}},{key:"textGroupIds",get:function(){return this.subtitleGroups?[this.textGroupId]:void 0}},{key:"audioGroupId",get:function(){var e;return null==(e=this.audioGroups)?void 0:e[0]}},{key:"textGroupId",get:function(){var e;return null==(e=this.subtitleGroups)?void 0:e[0]}}])}();function nr(e,t){return!(!t||!e)&&-1!==e.indexOf(t)}function ar(e,t){var r=!1,i=[];if(e&&(r="SDR"!==e,i=[e]),t){var n="SDR"!==(i=t.allowedVideoRanges||Xt.slice(0)).join("")&&!t.videoCodec;(r=void 0!==t.preferHDR?t.preferHDR:n&&function(){if("function"==typeof matchMedia){var e=matchMedia("(dynamic-range: high)"),t=matchMedia("bad query");if(e.media!==t.media)return!0===e.matches}return!1}())||(i=["SDR"])}return{preferHDR:r,allowedVideoRanges:i}}var sr=function(e,t){return JSON.stringify(e,function(e){var t=new WeakSet;return function(r,i){if(e&&(i=e(r,i)),"object"===a(i)&&null!==i){if(t.has(i))return;t.add(i)}return i}}(t))};function or(e,t){me.log('[abr] start candidates with "'+e+'" ignored because '+t)}function lr(e){return e.reduce((function(e,t){var r=e.groups[t.groupId];r||(r=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),r.tracks.push(t);var i=t.channels||"2";return r.channels[i]=(r.channels[i]||0)+1,r.hasDefault=r.hasDefault||t.default,r.hasAutoSelect=r.hasAutoSelect||t.autoselect,r.hasDefault&&(e.hasDefaultAudio=!0),r.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e}),{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function ur(e){if(!e)return e;var t=e;return{lang:t.lang,assocLang:t.assocLang,characteristics:t.characteristics,channels:t.channels,audioCodec:t.audioCodec}}function dr(e,t,r){if("attrs"in e){var i=t.indexOf(e);if(-1!==i)return i}for(var n=0;n<t.length;n++)if(cr(e,t[n],r))return n;return-1}function cr(e,t,r){var i,n,a=e.groupId,s=e.name,o=e.lang,l=e.assocLang,u=e.default,d=e.forced;return(void 0===a||t.groupId===a)&&(void 0===s||t.name===s)&&(void 0===o||(i=o,void 0===(n=t.lang)&&(n="--"),i.length===n.length?i===n:i.startsWith(n)||n.startsWith(i)))&&(void 0===l||t.assocLang===l)&&(void 0===u||t.default===u)&&(void 0===d||t.forced===d)&&(!("characteristics"in e)||function(e,t){void 0===t&&(t="");var r=e.split(","),i=t.split(",");return r.length===i.length&&!r.some((function(e){return-1===i.indexOf(e)}))}(e.characteristics||"",t.characteristics))&&(void 0===r||r(e,t))}function hr(e,t){var r=e.audioCodec,i=e.channels;return!(void 0!==r&&(t.audioCodec||"").substring(0,4)!==r.substring(0,4)||void 0!==i&&i!==(t.channels||"2"))}function fr(e,t,r){for(var i=t;i>-1;i--)if(r(e[i]))return i;for(var n=t+1;n<e.length;n++)if(r(e[n]))return n;return-1}function gr(e,t){var r;return!!e&&e!==(null==(r=t.loadLevelObj)?void 0:r.uri)}function vr(e,t){return!t||-1!==t.indexOf(e)}function pr(e,t){if(t||e){var r=u({},t);return e&&(e.videoCodec&&(r.videoCodec=e.videoCodec),e.videoRange&&(r.allowedVideoRanges=[e.videoRange])),r}}var mr=function(e){function t(t){var r;return(r=e.call(this,"abr",t.logger)||this).hls=void 0,r.lastLevelLoadSec=0,r.lastLoadedFragLevel=-1,r.firstSelection=-1,r.firstAutoFloor=-1,r._nextAutoLevel=-1,r.nextAutoLevelKey="",r.audioTracksByGroup=null,r.codecTiers=null,r.timer=-1,r.fragCurrent=null,r.partCurrent=null,r.bitrateTestDelay=0,r.rebufferNotice=-1,r.supportedCache={},r.bwEstimator=void 0,r._abandonRulesCheck=function(e){var t,i=r,n=i.fragCurrent,a=i.partCurrent,s=i.hls;if(s){var o=s.autoLevelEnabled,l=s.media;if(n&&l){var u=performance.now(),d=a?a.stats:n.stats,c=a?a.duration:n.duration,h=u-d.loading.start,f=s.minAutoLevel,g=n.level,v=r._nextAutoLevel;if(d.aborted||d.loaded&&d.loaded===d.total||g<=f)return r.clearTimer(),void(r._nextAutoLevel=-1);if(o){var p=v>-1&&v!==g,m=!!e||p;if(m||!l.paused&&l.playbackRate&&l.readyState){var y=s.mainForwardBufferInfo;if(m||null!==y){var E=r.bwEstimator.getEstimateTTFB(),b=Math.abs(l.playbackRate);if(!(h<=Math.max(E,c/(2*b)*1e3))){var T=y?y.len/b:0,S=d.loading.first?d.loading.first-d.loading.start:-1,w=d.loaded&&S>-1,A=r.getBwEstimate(),L=s.levels,I=L[g],k=Math.max(d.loaded,Math.round(c*(n.bitrate||I.averageBitrate)/8)),R=w?h-S:h;R<1&&w&&(R=Math.min(h,8*d.loaded/A));var D=w?1e3*d.loaded/R:0,C=E/1e3,P=D?(k-d.loaded)/D:8*k/A+C;if(!(P<=T)){var _,x=D?8*D:A,O=!0===(null==(t=(null==e?void 0:e.details)||s.latestLevelDetails)?void 0:t.live),M=s.config.abrBandWidthUpFactor,N=Number.POSITIVE_INFINITY;for(_=g-1;_>f;_--){var U=L[_].maxBitrate,B=!L[_].details||O;if((N=r.getTimeToLoadFrag(C,x,c*U,B))<Math.min(T,c+C))break}if(!(N>=P||N>10*c)){w?r.bwEstimator.sample(h-Math.min(E,S),d.loaded):r.bwEstimator.sampleTTFB(h);var $=L[_].maxBitrate;r.getBwEstimate()*M>$&&(r.firstAutoFloor=Math.min(_,s.firstLevel),r.resetEstimator($));var H=r.findBestLevel($,f,_,0,T,1,1);H>-1&&(_=H),r.warn("Fragment "+n.sn+(a?" part "+a.index:"")+" of level "+g+" is loading too slowly;\n Fragment duration: "+n.duration.toFixed(3)+"\n Time to underbuffer: "+T.toFixed(3)+" s\n Estimated load time for current fragment: "+P.toFixed(3)+" s\n Estimated load time for down switch fragment: "+N.toFixed(3)+" s\n TTFB estimate: "+(0|S)+" ms\n Current BW estimate: "+(F(A)?0|A:"Unknown")+" bps\n New BW estimate: "+(0|r.getBwEstimate())+" bps\n Switching to level "+_+" @ "+(0|$)+" bps"),s.nextLoadLevel=s.nextAutoLevel=_,r.clearTimer();var V=function(){r.clearTimer();var e=r.hls;if(r.fragCurrent===n&&e.loadLevel===_&&_>0){var t=r.getStarvationDelay();if(r.warn("Aborting inflight request "+(_>0?"and switching down":"")+"\n Fragment duration: "+n.duration.toFixed(3)+" s\n Time to underbuffer: "+t.toFixed(3)+" s"),n.abortRequests(),r.fragCurrent=r.partCurrent=null,_>f){var i=r.findBestLevel(e.levels[f].bitrate,f,_,0,t,1,1);-1===i&&(i=f),e.nextLoadLevel=e.nextAutoLevel=i,r.firstAutoFloor=Math.min(i,e.firstLevel),r.resetEstimator(e.levels[i].bitrate)}}};p||P>2*N?V():r.timer=self.setInterval(V,1e3*N),s.trigger(G.FRAG_LOAD_EMERGENCY_ABORTED,{frag:n,part:a,stats:d})}}}}}}}}},r.hls=t,r.bwEstimator=r.initEstimator(),r.registerListeners(),r}c(t,e);var r=t.prototype;return r.resetEstimator=function(e){this.hls&&(e&&(this.log("setting initial bwe to "+e),this.hls.config.abrEwmaDefaultEstimate=e),this.firstSelection=-1,this.bwEstimator=this.initEstimator())},r.initEstimator=function(){var e=this.hls.config;return new ue(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)},r.registerListeners=function(){var e=this.hls;e.on(G.MANIFEST_LOADING,this.onManifestLoading,this),e.on(G.FRAG_LOADING,this.onFragLoading,this),e.on(G.FRAG_LOADED,this.onFragLoaded,this),e.on(G.FRAG_BUFFERED,this.onFragBuffered,this),e.on(G.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(G.LEVEL_LOADED,this.onLevelLoaded,this),e.on(G.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(G.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(G.ERROR,this.onError,this)},r.unregisterListeners=function(){var e=this.hls;e&&(e.off(G.MANIFEST_LOADING,this.onManifestLoading,this),e.off(G.FRAG_LOADING,this.onFragLoading,this),e.off(G.FRAG_LOADED,this.onFragLoaded,this),e.off(G.FRAG_BUFFERED,this.onFragBuffered,this),e.off(G.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(G.LEVEL_LOADED,this.onLevelLoaded,this),e.off(G.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(G.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(G.ERROR,this.onError,this))},r.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=this.supportedCache=null,this.audioTracksByGroup=this.codecTiers=this.fragCurrent=this.partCurrent=null},r.onManifestLoading=function(e,t){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.firstAutoFloor=-1,this.lastLevelLoadSec=0,this.supportedCache={},this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()},r.onLevelsUpdated=function(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null},r.onMaxAutoLevelUpdated=function(){this.firstSelection=-1,this.nextAutoLevelKey=""},r.onFragLoading=function(e,t){var r,i=t.frag;this.ignoreFragment(i)||(i.bitrateTest||(this.fragCurrent=i,this.partCurrent=null!=(r=t.part)?r:null),this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100))},r.onLevelSwitching=function(e,t){this.clearTimer()},r.onError=function(e,t){if(!t.fatal)switch(t.details){case $.BUFFER_ADD_CODEC_ERROR:case $.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case $.FRAG_LOAD_TIMEOUT:var r=t.frag,i=this.fragCurrent,n=this.partCurrent;if(r&&z(r,i)){var a=performance.now(),s=n?n.stats:r.stats,o=a-s.loading.start,l=s.loading.first?s.loading.first-s.loading.start:-1;if(s.loaded&&l>-1){var u=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(o-Math.min(u,l),s.loaded)}else this.bwEstimator.sampleTTFB(o)}}},r.getTimeToLoadFrag=function(e,t,r,i){return e+r/t+(i?e+this.lastLevelLoadSec:0)},r.onLevelLoaded=function(e,t){var r=this.hls.config,i=t.stats.loading,n=i.end-i.first;F(n)&&(this.lastLevelLoadSec=n/1e3),t.details.live?this.bwEstimator.update(r.abrEwmaSlowLive,r.abrEwmaFastLive):this.bwEstimator.update(r.abrEwmaSlowVoD,r.abrEwmaFastVoD),this.timer>-1&&this._abandonRulesCheck(t.levelInfo)},r.onFragLoaded=function(e,t){var r,i=t.frag,n=t.part,a=n?n.stats:i.stats;if(i.type===K.MAIN&&this.bwEstimator.sampleTTFB(a.loading.first-a.loading.start),!this.ignoreFragment(i)){if(this.clearTimer(),i.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,null!=(r=this.hls)&&r.config.abrMaxWithRealBitrate){var s=n?n.duration:i.duration,o=this.hls.levels[i.level],l=(o.loaded?o.loaded.bytes:0)+a.loaded,u=(o.loaded?o.loaded.duration:0)+s;o.loaded={bytes:l,duration:u},o.realBitrate=Math.round(8*l/u)}if(i.bitrateTest){var d={stats:a,frag:i,part:n,id:i.type};this.onFragBuffered(G.FRAG_BUFFERED,d),i.bitrateTest=!1}else this.lastLoadedFragLevel=i.level}},r.onFragBuffered=function(e,t){var r=t.frag,i=t.part,n=null!=i&&i.stats.loaded?i.stats:r.stats;if(!n.aborted&&!this.ignoreFragment(r)){var a=((r.bitrate||0)>=1e5?n.parsing.end:n.loading.end)-n.loading.start-Math.min(n.loading.first-n.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(a,n.loaded),n.bwEstimate=this.getBwEstimate(),r.bitrateTest?this.bitrateTestDelay=a/1e3:(this.bitrateTestDelay=0,this.firstAutoFloor>-1&&this.bwEstimator.canEstimate()&&(this.firstAutoFloor=-1))}},r.ignoreFragment=function(e){return e.type!==K.MAIN||"initSegment"===e.sn},r.clearTimer=function(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)},r.getAutoLevelKey=function(){return this.getBwEstimate()+"_"+this.getStarvationDelay().toFixed(2)},r.getNextABRAutoLevel=function(){var e=this.fragCurrent,t=this.partCurrent,r=this.hls;if(!r)return-1;if(r.levels.length<=1)return r.loadLevel;var i=r.maxAutoLevel,n=r.config,a=r.minAutoLevel,s=t?t.duration:e?e.duration:0,o=this.getBwEstimate(),l=this.getStarvationDelay(),u=n.abrBandWidthFactor,d=n.abrBandWidthUpFactor;if(l){var c=this.findBestLevel(o,a,i,l,0,u,d);if(c>=0)return this.rebufferNotice=-1,c}var h=s?Math.min(s,n.maxStarvationDelay):n.maxStarvationDelay;if(!l){var f=this.bitrateTestDelay;f&&(h=(s?Math.min(s,n.maxLoadingDelay):n.maxLoadingDelay)-f,this.info("bitrate test took "+Math.round(1e3*f)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*h)+" ms"),u=d=1)}var g=this.findBestLevel(o,a,i,l,h,u,d);if(this.rebufferNotice!==g&&(this.rebufferNotice=g,this.info((l?"rebuffering expected":"buffer is empty")+", optimal quality level "+g)),g>-1)return g;var v=r.levels[a],p=r.loadLevelObj;return p&&(null==v?void 0:v.bitrate)<p.bitrate?a:r.loadLevel},r.getStarvationDelay=function(){var e=this.hls,t=null==e?void 0:e.media;if(!t)return 1/0;var r=t&&0!==t.playbackRate?Math.abs(t.playbackRate):1,i=e.mainForwardBufferInfo;return(i?i.len:0)/r},r.getBwEstimate=function(){return this.bwEstimator.getEstimate()},r.findBestLevel=function(e,t,r,i,n,a,s){var o=this,l=this.hls,u=this.lastLoadedFragLevel,d=this.fragCurrent,c=this.partCurrent;if(!l)return-1;var h=i+n,f=-1===u?l.firstLevel:u,g=l.levels,v=l.allAudioTracks,p=l.loadLevel,m=l.latestLevelDetails,y=l.config;if(1===g.length)return 0;var E,b=g[f],T=!(null==m||!m.live),S=-1===p||-1===u,w="SDR",A=(null==b?void 0:b.frameRate)||0,L=y.audioPreference,I=y.videoPreference,k=this.audioTracksByGroup||(this.audioTracksByGroup=lr(v)),R=-1;if(S){if(-1!==this.firstSelection)return this.firstSelection;var D=this.codecTiers||(this.codecTiers=function(e,t,r,i){return e.slice(r,i+1).reduce((function(e,r,i){if(!r.codecSet)return e;var n=r.audioGroups,a=e[r.codecSet];a||(e[r.codecSet]=a={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,minIndex:i,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!n,fragmentError:0}),a.minBitrate=Math.min(a.minBitrate,r.bitrate);var s=Math.min(r.height,r.width);return a.minHeight=Math.min(a.minHeight,s),a.minFramerate=Math.min(a.minFramerate,r.frameRate),a.minIndex=Math.min(a.minIndex,i),a.maxScore=Math.max(a.maxScore,r.score),a.fragmentError+=r.fragmentError,a.videoRanges[r.videoRange]=(a.videoRanges[r.videoRange]||0)+1,n&&n.forEach((function(e){if(e){var r=t.groups[e];r&&(a.hasDefaultAudio=a.hasDefaultAudio||t.hasDefaultAudio?r.hasDefault:r.hasAutoSelect||!t.hasDefaultAudio&&!t.hasAutoSelectAudio,Object.keys(r.channels).forEach((function(e){a.channels[e]=(a.channels[e]||0)+r.channels[e]})))}})),e}),{})}(g,k,t,r)),C=function(e,t,r,i,n){for(var a=Object.keys(e),s=null==i?void 0:i.channels,o=null==i?void 0:i.audioCodec,l=null==n?void 0:n.videoCodec,u=s&&2===parseInt(s),d=!1,c=!1,h=1/0,f=1/0,g=1/0,v=1/0,p=0,m=[],y=ar(t,n),E=y.preferHDR,b=y.allowedVideoRanges,T=function(){var t=e[a[S]];d||(d=t.channels[2]>0),h=Math.min(h,t.minHeight),f=Math.min(f,t.minFramerate),g=Math.min(g,t.minBitrate),b.filter((function(e){return t.videoRanges[e]>0})).length>0&&(c=!0)},S=a.length;S--;)T();h=F(h)?h:0,f=F(f)?f:0;var w=Math.max(1080,h),A=Math.max(30,f);g=F(g)?g:r,r=Math.max(g,r),c||(t=void 0);var L=a.length>1;return{codecSet:a.reduce((function(t,i){var n=e[i];if(i===t)return t;if(m=c?b.filter((function(e){return n.videoRanges[e]>0})):[],L){if(n.minBitrate>r)return or(i,"min bitrate of "+n.minBitrate+" > current estimate of "+r),t;if(!n.hasDefaultAudio)return or(i,"no renditions with default or auto-select sound found"),t;if(o&&i.indexOf(o.substring(0,4))%5!=0)return or(i,'audio codec preference "'+o+'" not found'),t;if(s&&!u){if(!n.channels[s])return or(i,"no renditions with "+s+" channel sound found (channels options: "+Object.keys(n.channels)+")"),t}else if((!o||u)&&d&&0===n.channels[2])return or(i,"no renditions with stereo sound found"),t;if(n.minHeight>w)return or(i,"min resolution of "+n.minHeight+" > maximum of "+w),t;if(n.minFramerate>A)return or(i,"min framerate of "+n.minFramerate+" > maximum of "+A),t;if(!m.some((function(e){return n.videoRanges[e]>0})))return or(i,"no variants with VIDEO-RANGE of "+sr(m)+" found"),t;if(l&&i.indexOf(l.substring(0,4))%5!=0)return or(i,'video codec preference "'+l+'" not found'),t;if(n.maxScore<p)return or(i,"max score of "+n.maxScore+" < selected max of "+p),t}return t&&(Ot(i)>=Ot(t)||n.fragmentError>e[t].fragmentError)?t:(v=n.minIndex,p=n.maxScore,i)}),void 0),videoRanges:m,preferHDR:E,minFramerate:f,minBitrate:g,minIndex:v}}(D,w,e,L,I),P=C.codecSet,_=C.videoRanges,x=C.minFramerate,O=C.minBitrate,M=C.minIndex,N=C.preferHDR;R=M,E=P,w=N?_[_.length-1]:_[0],A=x,e=Math.max(e,O),this.log("picked start tier "+sr(C))}else E=null==b?void 0:b.codecSet,w=null==b?void 0:b.videoRange;for(var U,B=c?c.duration:d?d.duration:0,$=this.bwEstimator.getEstimateTTFB()/1e3,G=[],H=function(){var t,l=g[V],d=V>f;if(!l)return 0;if(y.useMediaCapabilities&&!l.supportedResult&&!l.supportedPromise){var v=navigator.mediaCapabilities;"function"==typeof(null==v?void 0:v.decodingInfo)&&function(e,t,r,i,n,a){var s=e.videoCodec,o=e.audioCodec?e.audioGroups:null,l=null==a?void 0:a.audioCodec,u=null==a?void 0:a.channels,d=u?parseInt(u):l?1/0:2,c=null;if(null!=o&&o.length)try{c=1===o.length&&o[0]?t.groups[o[0]].channels:o.reduce((function(e,r){if(r){var i=t.groups[r];if(!i)throw new Error("Audio track group "+r+" not found");Object.keys(i.channels).forEach((function(t){e[t]=(e[t]||0)+i.channels[t]}))}return e}),{2:0})}catch(e){return!0}return void 0!==s&&(s.split(",").some((function(e){return ft(e)}))||e.width>1920&&e.height>1088||e.height>1920&&e.width>1088||e.frameRate>Math.max(i,30)||"SDR"!==e.videoRange&&e.videoRange!==r||e.bitrate>Math.max(n,8e6))||!!c&&F(d)&&Object.keys(c).some((function(e){return parseInt(e)>d}))}(l,k,w,A,e,L)?(l.supportedPromise=qt(l,k,v,o.supportedCache),l.supportedPromise.then((function(e){if(o.hls){l.supportedResult=e;var t=o.hls.levels,r=t.indexOf(l);e.error?o.warn('MediaCapabilities decodingInfo error: "'+e.error+'" for level '+r+" "+sr(e)):e.supported?e.decodingInfoResults.some((function(e){return!1===e.smooth||!1===e.powerEfficient}))&&o.log("MediaCapabilities decodingInfo for level "+r+" not smooth or powerEfficient: "+sr(e)):(o.warn("Unsupported MediaCapabilities decodingInfo result for level "+r+" "+sr(e)),r>-1&&t.length>1&&(o.log("Removing unsupported level "+r),o.hls.removeLevel(r),-1===o.hls.loadLevel&&(o.hls.nextLoadLevel=0)))}})).catch((function(e){o.warn("Error handling MediaCapabilities decodingInfo: "+e)}))):l.supportedResult=Kt}if((E&&l.codecSet!==E||w&&l.videoRange!==w||d&&A>l.frameRate||!d&&A>0&&A<l.frameRate||null!=(t=l.supportedResult)&&null!=(t=t.decodingInfoResults)&&t.some((function(e){return!1===e.smooth})))&&(!S||V!==R))return G.push(V),0;var m,b=l.details,I=(c?null==b?void 0:b.partTarget:null==b?void 0:b.averagetargetduration)||B||1;m=d?s*e:a*e;var D=B&&i>=2*B&&0===n?l.averageBitrate:l.maxBitrate,C=o.getTimeToLoadFrag($,m,D*I,!b||b.live);if(m>=D&&(V===u||0===l.loadError&&0===l.fragmentError||oe(l,y.errorPenaltyExpireMs))&&(C<=$||!F(C)||T&&!o.bitrateTestDelay||C<h)){var P=o.forcedAutoLevel;return V===p||-1!==P&&P===p||(G.length&&o.trace("Skipped level(s) "+G.join(",")+" of "+r+' max with CODECS and VIDEO-RANGE:"'+g[G[0]].codecs+'" '+g[G[0]].videoRange+'; not compatible with "'+E+'" '+w),o.info("switch candidate:"+f+"->"+V+" adjustedbw("+Math.round(m)+")-bitrate="+Math.round(m-D)+" ttfb:"+$.toFixed(1)+" avgDuration:"+I.toFixed(1)+" maxFetchDuration:"+h.toFixed(1)+" fetchDuration:"+C.toFixed(1)+" firstSelection:"+S+" codecSet:"+l.codecSet+" videoRange:"+l.videoRange+" hls.loadLevel:"+p)),S&&(o.firstSelection=V),{v:V}}},V=r;V>=t;V--)if(0!==(U=H())&&U)return U.v;return-1},r.deriveNextAutoLevel=function(e){if(!this.hls)return-1;var t=this.hls,r=t.maxAutoLevel,i=t.minAutoLevel;return Math.min(Math.max(e,i),r)},i(t,[{key:"firstAutoLevel",get:function(){var e=this.hls;if(!e)return 0;var t=e.maxAutoLevel,r=e.minAutoLevel,i=this.getBwEstimate(),n=this.getStarvationDelay(),a=e.config.maxStarvationDelay,s=this.findBestLevel(i,r,t,n/2,a,1,1);if(s>-1)return s;var o=e.firstLevel,l=-1===this.firstAutoFloor?1/0:this.firstAutoFloor,u=Math.min(Math.max(o,r),t,l);return this.warn("Could not find best starting auto level. Defaulting to first in playlist "+o+" clamped to "+u),u}},{key:"forcedAutoLevel",get:function(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}},{key:"nextAutoLevel",get:function(){if(!this.hls)return-1;var e=this.forcedAutoLevel,t=this.bwEstimator.canEstimate(),r=this.lastLoadedFragLevel>-1;if(!(-1===e||t&&r&&this.nextAutoLevelKey!==this.getAutoLevelKey()))return e;var i=t&&r?this.getNextABRAutoLevel():this.firstAutoLevel;if(-1!==e){var n=this.hls.levels;if(n.length>Math.max(e,i)&&n[e].loadError<=n[i].loadError)return e}return this._nextAutoLevel=i,this.nextAutoLevelKey=this.getAutoLevelKey(),i},set:function(e){var t=this.deriveNextAutoLevel(e);this._nextAutoLevel!==t&&(this.nextAutoLevelKey="",this._nextAutoLevel=t)}}])}(de),yr=function(e,t){for(var r=0,i=e.length-1,n=null,a=null;r<=i;){var s=t(a=e[n=(r+i)/2|0]);if(s>0)r=n+1;else{if(!(s<0))return a;i=n-1}}return null};function Er(e,t,r,i,n){void 0===r&&(r=0),void 0===i&&(i=0),void 0===n&&(n=.005);var a=null;if(e){a=t[1+e.sn-t[0].sn]||null;var s=e.endDTS-r;s>0&&s<15e-7&&(r+=15e-7),a&&e.level!==a.level&&a.end<=e.end&&(a=t[2+e.sn-t[0].sn]||null)}else 0===r&&0===t[0].start&&(a=t[0]);if(a&&((!e||e.level===a.level)&&0===br(r,i,a)||function(e,t,r){if(0===(null==t?void 0:t.start)&&t.level<e.level&&(t.endPTS||0)>0){var i=t.tagList.reduce((function(e,t){return"INF"===t[0]&&(e+=parseFloat(t[1])),e}),r);return e.start<=i}return!1}(a,e,Math.min(n,i))))return a;var o=yr(t,br.bind(null,r,i));return!o||o===e&&a?a:o}function br(e,t,r){if(void 0===e&&(e=0),void 0===t&&(t=0),r.start<=e&&r.start+r.duration>e)return 0;var i=Math.min(t,r.duration+(r.deltaPTS?r.deltaPTS:0));return r.start+r.duration-i<=e?1:r.start-i>e&&r.start?-1:0}function Tr(e,t,r){var i=1e3*Math.min(t,r.duration+(r.deltaPTS?r.deltaPTS:0));return(r.endProgramDateTime||0)-i>e}function Sr(e,t,r){if(e&&e.startCC<=t&&e.endCC>=t){var i,n=e.fragments,a=e.fragmentHint;return a&&(n=n.concat(a)),yr(n,(function(e){return e.cc<t?1:e.cc>t?-1:(i=e,e.end<=r?1:e.start>r?-1:0)})),i||null}return null}function wr(e,t){return t===e.endSN&&e.fragmentHint?e.fragmentHint:e.fragments[1+t-e.startSN]||null}var Ar=0,Lr=2,Ir=3,kr=5,Rr=0,Dr=1,Cr=2,Pr=4,_r=8,xr=16,Or=function(e){function t(t){var r;return(r=e.call(this,"error-controller",t.logger)||this).hls=void 0,r.playlistError=0,r.hls=t,r.registerListeners(),r}c(t,e);var r=t.prototype;return r.registerListeners=function(){var e=this.hls;e.on(G.ERROR,this.onError,this),e.on(G.MANIFEST_LOADING,this.onManifestLoading,this),e.on(G.LEVEL_UPDATED,this.onLevelUpdated,this)},r.unregisterListeners=function(){var e=this.hls;e&&(e.off(G.ERROR,this.onError,this),e.off(G.ERROR,this.onErrorOut,this),e.off(G.MANIFEST_LOADING,this.onManifestLoading,this),e.off(G.
vendor: 5,230 bytes, line 2
2LEVEL_UPDATED,this.onLevelUpdated,this))},r.destroy=function(){this.unregisterListeners(),this.hls=null},r.startLoad=function(e){},r.stopLoad=function(){this.playlistError=0},r.getVariantLevelIndex=function(e){return(null==e?void 0:e.type)===K.MAIN?e.level:this.getVariantIndex()},r.getVariantIndex=function(){var e,t=this.hls,r=t.currentLevel;return null!=(e=t.loadLevelObj)&&e.details||-1===r?t.loadLevel:r},r.variantHasKey=function(e,t){if(e){var r;if(null!=(r=e.details)&&r.hasKey(t))return!0;var i=e.audioGroups;if(i)return this.hls.allAudioTracks.filter((function(e){return i.indexOf(e.groupId)>=0})).some((function(e){var r;return null==(r=e.details)?void 0:r.hasKey(t)}))}return!1},r.onManifestLoading=function(){this.playlistError=0},r.onLevelUpdated=function(){this.playlistError=0},r.onError=function(e,t){var r;if(!t.fatal){var i=this.hls,n=t.context;switch(t.details){case $.FRAG_LOAD_ERROR:case $.FRAG_LOAD_TIMEOUT:case $.KEY_LOAD_ERROR:case $.KEY_LOAD_TIMEOUT:return void(t.errorAction=this.getFragRetryOrSwitchAction(t));case $.FRAG_PARSING_ERROR:if(null!=(r=t.frag)&&r.gap)return void(t.errorAction=Nr());case $.FRAG_GAP:case $.FRAG_DECRYPT_ERROR:return t.errorAction=this.getFragRetryOrSwitchAction(t),void(t.errorAction.action=Lr);case $.PLAYLIST_UNCHANGED_ERROR:case $.LEVEL_EMPTY_ERROR:case $.LEVEL_PARSING_ERROR:var a,s=t.parent===K.MAIN?t.level:i.loadLevel;return void(t.details===$.LEVEL_EMPTY_ERROR&&null!=(a=t.context)&&null!=(a=a.levelDetails)&&a.live?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,s):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,s)));case $.LEVEL_LOAD_ERROR:case $.LEVEL_LOAD_TIMEOUT:return void("number"==typeof(null==n?void 0:n.level)&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,n.level)));case $.AUDIO_TRACK_LOAD_ERROR:case $.AUDIO_TRACK_LOAD_TIMEOUT:case $.SUBTITLE_LOAD_ERROR:case $.SUBTITLE_TRACK_LOAD_TIMEOUT:if(n){var o=i.loadLevelObj;if(o&&(n.type===V.AUDIO_TRACK&&o.hasAudioGroup(n.groupId)||n.type===V.SUBTITLE_TRACK&&o.hasSubtitleGroup(n.groupId)))return t.errorAction=this.getPlaylistRetryOrSwitchAction(t,i.loadLevel),t.errorAction.action=Lr,void(t.errorAction.flags=Dr)}return;case $.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:return void(t.errorAction={action:Lr,flags:Cr});case $.KEY_SYSTEM_SESSION_UPDATE_FAILED:case $.KEY_SYSTEM_STATUS_INTERNAL_ERROR:case $.KEY_SYSTEM_NO_SESSION:return void(t.errorAction={action:Lr,flags:Pr});case $.BUFFER_ADD_CODEC_ERROR:case $.REMUX_ALLOC_ERROR:case $.BUFFER_APPEND_ERROR:return void(t.errorAction||(t.errorAction=this.getLevelSwitchAction(t,t.level)));case $.MEDIA_SOURCE_REQUIRES_RESET:return t.errorAction||(t.errorAction=this.getLevelSwitchAction(t,t.level)),void(t.errorAction.flags|=xr|_r);case $.INTERNAL_EXCEPTION:case $.BUFFER_APPENDING_ERROR:case $.BUFFER_APPEND_NO_PROGRESS:case $.BUFFER_FULL_ERROR:case $.LEVEL_SWITCH_ERROR:case $.BUFFER_STALLED_ERROR:case $.BUFFER_SEEK_OVER_HOLE:case $.BUFFER_NUDGE_ON_STALL:return void(t.errorAction=Nr())}t.type===B.KEY_SYSTEM_ERROR&&(t.levelRetry=!1,t.errorAction=Nr())}},r.getPlaylistRetryOrSwitchAction=function(e,t){var r=re(this.hls.config.playlistLoadPolicy,e),i=this.playlistError++;if(ae(r,i,Z(e),e.response))return{action:kr,flags:Rr,retryConfig:r,retryCount:i};var n=this.getLevelSwitchAction(e,t);return r&&(n.retryConfig=r,n.retryCount=i),n},r.getFragRetryOrSwitchAction=function(e){var t=this.hls,r=this.getVariantLevelIndex(e.frag),i=t.levels[r],n=t.config,a=n.fragLoadPolicy,s=n.keyLoadPolicy,o=re(ee(e)?s:a,e),l=t.levels.reduce((function(e,t){return e+t.fragmentError}),0);if(i&&(e.details!==$.FRAG_GAP&&i.fragmentError++,!te(e)&&ae(o,l,Z(e),e.response)))return{action:kr,flags:Rr,retryConfig:o,retryCount:l};var u=this.getLevelSwitchAction(e,r);return o&&(u.retryConfig=o,u.retryCount=l),u},r.getLevelSwitchAction=function(e,t){var r=this.hls;null==t&&(t=r.loadLevel);var i=this.hls.levels[t];if(i){var n,a,s=e.details;i.loadError++,i.loadErrorTime=self.performance.now(),s===$.BUFFER_APPEND_ERROR&&i.fragmentError++;var o=-1,l=r.levels,u=r.loadLevel,d=r.minAutoLevel,c=r.maxAutoLevel;r.autoLevelEnabled||r.config.preserveManualLevelOnError||(r.loadLevel=-1);for(var h,f=null==(n=e.frag)?void 0:n.type,g=(f===K.AUDIO&&s===$.FRAG_PARSING_ERROR||"audio"===e.sourceBufferName&&Mr(e))&&l.some((function(e){var t=e.audioCodec;return i.audioCodec!==t})),v="video"===e.sourceBufferName&&Mr(e)&&l.some((function(e){var t=e.codecSet,r=e.audioCodec;return i.codecSet!==t&&i.audioCodec===r})),p=null!=(a=e.context)?a:{},m=p.type,y=p.groupId,E=function(){var t=(b+u)%l.length;if(t!==u&&t>=d&&t<=c&&(0===l[t].loadError||oe(l[t],r.config.errorPenaltyExpireMs))){var n,a,h=l[t];if(s===$.FRAG_GAP&&f===K.MAIN&&e.frag){var p=l[t].details;if(p){var E=Er(e.frag,p.fragments,e.frag.start);if(null!=E&&E.gap)return 0}}else{if(m===V.AUDIO_TRACK&&h.hasAudioGroup(y)||m===V.SUBTITLE_TRACK&&h.hasSubtitleGroup(y))return 0;if(f===K.AUDIO&&null!=(n=i.audioGroups)&&n.some((function(e){return h.hasAudioGroup(e)}))||f===K.SUBTITLE&&null!=(a=i.subtitleGroups)&&a.some((function(e){return h.hasSubtitleGroup(e)}))||g&&i.audioCodec===h.audioCodec||v&&i.codecSet===h.codecSet||!g&&i.audioCodec!==h.audioCodec)return 0}return o=t,1}},b=l.length;b--&&(0===(h=E())||1!==h););
vendor: 4,205 bytes, line 2
2if(o>-1&&r.loadLevel!==o)return e.levelRetry=!0,this.playlistError=0,{action:Lr,flags:Rr,nextAutoLevel:o}}return{action:Lr,flags:Dr}},r.onErrorOut=function(e,t){var r,i;switch(null==(r=t.errorAction)?void 0:r.action){case Ar:break;case Lr:this.sendAlternateToPenaltyBox(t),t.errorAction.resolved||t.details===$.FRAG_GAP||t.details===$.PLAYLIST_UNCHANGED_ERROR||Fr(t)||(t.fatal=!0)}((null==(i=t.errorAction)?void 0:i.flags)||0)&xr&&this.hls.recoverMediaError(),t.fatal&&this.hls.stopLoad()},r.sendAlternateToPenaltyBox=function(e){var t=this.hls,r=e.errorAction;if(r){var i=r.nextAutoLevel;if(r.flags===Rr)this.switchLevel(e,i);else if(r.flags&_r)for(var n=this.hls.levels,a=n.length;a--;)"SDR"!==n[a].videoRange?(n[a].fragmentError++,n[a].loadError++):void 0===i&&(i=a);else if(r.flags&Cr){var s=this.getVariantLevelIndex(e.frag),o=t.levels[s],l=null==o?void 0:o.attrs["HDCP-LEVEL"];r.hdcpLevel=l;var u="NONE"===l;l&&!u?(t.maxHdcpLevel=Qt[Qt.indexOf(l)-1],r.resolved=!0,this.warn('Restricting playback to HDCP-LEVEL of "'+t.maxHdcpLevel+'" or lower')):(u&&this.warn("HDCP policy resticted output with HDCP-LEVEL=NONE"),r.flags|=Pr)}if(r.flags&Pr){var d=e.decryptdata;if(d){for(var c=this.hls.levels,h=c.length,f=h;f--;){var g,v;this.variantHasKey(c[f],d)&&(this.log("Banned key found in level "+f+" ("+c[f].bitrate+'bps) or audio group "'+(null==(g=c[f].audioGroups)?void 0:g.join(","))+'" ('+(null==(v=e.frag)?void 0:v.type)+" fragment) "+Fe(d.keyId||[])),c[f].fragmentError++,c[f].loadError++,this.log("Removing level "+f+" with key error ("+e.error+")"),this.hls.removeLevel(f))}var p=e.frag;if(this.hls.levels.length<h)r.resolved=!0;else if(p&&p.type!==K.MAIN){var m=p.decryptdata;m&&!d.matches(m)&&(r.resolved=!0)}}}r.resolved||this.switchLevel(e,i)}},r.switchLevel=function(e,t){if(void 0!==t&&e.errorAction&&(this.warn("switching to level "+t+" after "+e.details),this.hls.nextAutoLevel=t,e.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel,e.details===$.BUFFER_ADD_CODEC_ERROR&&e.mimeType&&"audiovideo"!==e.sourceBufferName))for(var r=Ht(e.mimeType),i=this.hls.levels,n=i.length;n--;)i[n][e.sourceBufferName+"Codec"]===r&&(this.log("Removing level "+n+" for "+e.details+' ("'+r+'" not supported)'),this.hls.removeLevel(n))},t}(de);function Mr(e){var t=e.details;return t===$.BUFFER_ADD_CODEC_ERROR||t===$.MEDIA_SOURCE_REQUIRES_RESET||t===$.BUFFER_APPEND_ERROR&&!Fr(e)}function Fr(e){return e.details===$.BUFFER_APPEND_ERROR&&("QuotaExceededError"===e.error.name||"InvalidStateError"===e.error.name)}function Nr(e){var t={action:Ar,flags:Rr};return e&&(t.resolved=!0),t}var Ur="NOT_LOADED",Br="APPENDING",$r="PARTIAL",Gr="OK",Hr=function(){function e(e){this.activePartLists=Object.create(null),this.endListFragments=Object.create(null),this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hasGaps=!1,this.hls=e,this._registerListeners()}var t=e.prototype;return t._registerListeners=function(){var e=this.hls;e&&(e.on(G.MANIFEST_LOADING,this.onManifestLoading,this),e.on(G.BUFFER_APPENDED,this.onBufferAppended,this),e.on(G.FRAG_BUFFERED,this.onFragBuffered,this),e.on(G.FRAG_LOADED,this.onFragLoaded,this))},t._unregisterListeners=function(){var e=this.hls;e&&(e.off(G.MANIFEST_LOADING,this.onManifestLoading,this),e.off(G.BUFFER_APPENDED,this.onBufferAppended,this),e.off(G.FRAG_BUFFERED,this.onFragBuffered,this),e.off(G.FRAG_LOADED,this.onFragLoaded,this))},t.destroy=function(){this._unregisterListeners(),this.hls=this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null},t.getAppendedFrag=function(e,t){var r=this.activePartLists[t];if(r)for(var i=r.length;i--;){var n=r[i];if(!n)break;if(n.start<=e&&e<=n.end&&n.loaded)return n}return this.getBufferedFrag(e,t)},t.getBufferedFrag=function(e,t){return this.getFragAtPos(e,t,!0)},t.getFragAtPos=function(e,t,r){for(var i=this.fragments,n=Object.keys(i),a=n.length;a--;){var s=i[n[a]];if((null==s?void 0:s.body.type)===t&&(!r||s.buffered)){var o=s.body;if(o.start<=e&&e<=o.end)return o}}return null},t.detectEvictedFragments=function(e,t,r,i,n,a){var s=this;this.timeRanges&&(this.timeRanges[e]=t);var o=(null==n?void 0:n.fragment.sn)||-1;
vendor: 4,161 bytes, line 2
2Object.keys(this.fragments).forEach((function(n){var l=s.fragments[n];if(l&&s.hls){var u=l.body;if(!(o>=u.sn))if(l.buffered||l.loaded&&!a){var d=l.range[e];if(d)if(0!==d.time.length){if(d.time.some((function(e){var r=!s.isTimeBuffered(e.startPTS,e.endPTS,t);return r&&s.removeFragment(u),r})),i&&i!==u&&It()){var c=i.endPTS,h=u.startPTS;if(c&&h&&l.range.video){var f=h-c;f<0&&f>-.1&&(s.removeFragment(u),s.hls.trigger(G.BUFFER_FLUSHING,{startOffset:c+.004,endOffset:1/0,type:"video"}))}}}else s.removeFragment(u)}else u.type===r&&s.removeFragment(u)}}))},t.detectPartialFragments=function(e){var t=this,r=this.timeRanges,i=e.frag,n=e.part,a=e.id;if(r&&W(i)){var s=Kr(i),o=this.fragments[s];if(!(!o||o.buffered&&i.gap)){var l=!i.relurl;Object.keys(r).forEach((function(e){var s=i.elementaryStreams[e];if(s){var u=r[e],d=l||!0===s.partial;o.range[e]=t.getBufferedTimes(i,n,d,u),t.detectEvictedFragments(e,u,a,i,n)}})),o.loaded=null;var u=Object.keys(o.range);if(u.length){if(this.bufferedEnd(o,i),Vr(o)||this.removeParts(i.sn-1,i.type),!n){var d=Math.min(.004,i.duration);u.some((function(e){var r,n=null==(r=o.range[e])?void 0:r.time,a=0===n.length||1===n.length&&n[0].endPTS-n[0].startPTS<d;return a&&t.addAsGap(i),a}))}}else this.removeFragment(i)}}},t.addAsGap=function(e){e.gap=!0,this.removeFragment(e),this.fragBuffered(e,!0)},t.bufferedEnd=function(e,t){e.buffered=!0,(e.body.endList=t.endList||e.body.endList)&&!t.gap&&(this.endListFragments[e.body.type]=e)},t.removeParts=function(e,t){var r=this.activePartLists[t];r&&(this.activePartLists[t]=jr(r,(function(t){return t.fragment.sn>=e})))},t.fragBuffered=function(e,t){var r=Kr(e),i=this.fragments[r];return!i&&t&&(i=this.fragments[r]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),i&&(i.loaded=null,this.bufferedEnd(i,e)),i},t.getBufferedTimes=function(e,t,r,i){for(var n={time:[],partial:r},a=e.start,s=e.end,o=e.minEndPTS||s,l=e.maxStartPTS||a,u=0;u<i.length;u++){var d=i.start(u)-this.bufferPadding,c=i.end(u)+this.bufferPadding;if(l>=d&&o<=c){n.time.push({startPTS:Math.max(a,i.start(u)),endPTS:Math.min(s,i.end(u))});break}if(a<c&&s>d){var h=Math.max(a,i.start(u)),f=Math.min(s,i.end(u));f>h&&(n.partial=!0,n.time.push({startPTS:h,endPTS:f}))}else if(s<=d)break}return n},t.getPartialFragment=function(e){var t,r,i,n=null,a=0,s=this.bufferPadding,o=this.fragments;return Object.keys(o).forEach((function(l){var u=o[l];u&&Vr(u)&&(r=u.body.start-s,i=u.body.end+s,e>=r&&e<=i&&(t=Math.min(e-r,i-e),a<=t&&(n=u.body,a=t)))})),n},t.isEndListAppended=function(e){var t=this.endListFragments[e];return void 0!==t&&(t.buffered||Vr(t))},t.getState=function(e){var t=Kr(e),r=this.fragments[t];return r?r.buffered?Vr(r)?$r:Gr:Br:Ur},t.isTimeBuffered=function(e,t,r){for(var i,n,a=0;a<r.length;a++){if(i=r.start(a)-this.bufferPadding,n=r.end(a)+this.bufferPadding,e>=i&&t<=n)return!0;if(t<=i)return!1}return!1},t.onManifestLoading=function(){this.removeAllFragments()},t.onFragLoaded=function(e,t){if(W(t.frag)&&!t.frag.bitrateTest){var r=t.frag,i=t.part?null:t,n=Kr(r);this.fragments[n]={body:r,appendedPTS:null,loaded:i,buffered:!1,range:Object.create(null)}}},t.onBufferAppended=function(e,t){var r=t.frag,i=t.part,n=t.timeRanges;if(W(r)){var a=r.type;if(i){var s=this.activePartLists[a];s||(this.activePartLists[a]=s=[]),s.push(i)}this.timeRanges=n}},t.onFragBuffered=function(e,t){this.detectPartialFragments(t)},t.hasFragment=function(e){var t=Kr(e);return!!this.fragments[t]},t.hasFragments=function(e){var t=this.fragments,r=Object.keys(t);if(!e)return r.length>0;for(var i=r.length;i--;){var n=t[r[i]];if((null==n?void 0:n.body.type)===e)return!0}return!1},t.hasParts=function(e){var t;return!(null==(t=this.activePartLists[e])||!t.length)},t.getBackBufferEvictionEnd=function(e,t,r){for(var i=this.fragments,n=0,a=0,s=Object.keys(i),o=0;o<s.length;o++){var l=i[s[o]];if(l&&l.buffered&&l.body.type===t){var u=l.body;if(u.gap)return 0;var d=u.hasStats&&u.stats.loaded||u.byteLength||u.bitrate&&8*u.bitrate*u.duration;if(u.end<=e&&d&&(n+=d,a=Math.max(a,u.end),n>=r))return a}}return a>0?a:0},t.removeFragmentsInRange=function(e,t,r,i,n){var a=this;
vendor: 4,315 bytes, line 2
2i&&!this.hasGaps||Object.keys(this.fragments).forEach((function(s){var o=a.fragments[s];if(o){var l=o.body;l.type!==r||i&&!l.gap||l.start<t&&l.end>e&&(o.buffered||n)&&a.removeFragment(l)}}))},t.removeFragment=function(e){var t=Kr(e);e.clearElementaryStreamInfo();var r=this.activePartLists[e.type];if(r){var i=e.sn;this.activePartLists[e.type]=jr(r,(function(e){return e.fragment.sn!==i}))}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]},t.removeAllFragments=function(){var e;this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1;var t=null==(e=this.hls)||null==(e=e.latestLevelDetails)?void 0:e.partList;t&&t.forEach((function(e){return e.clearElementaryStreamInfo()}))},e}();function Vr(e){var t,r,i,n;return e.buffered&&!!(e.body.gap||null!=(t=e.range.video)&&t.partial||null!=(r=e.range.audio)&&r.partial||null!=(i=e.range.audiovideo)&&i.partial||null!=(n=e.range.subs)&&n.partial)}function Kr(e){return e.type+"_"+e.level+"_"+e.sn}function jr(e,t){return e.filter((function(e){var r=t(e);return r||e.clearElementaryStreamInfo(),r}))}var qr=0,Wr=1,Yr=function(){function e(e,t,r){this.subtle=void 0,this.aesIV=void 0,this.aesMode=void 0,this.subtle=e,this.aesIV=t,this.aesMode=r}return e.prototype.decrypt=function(e,t){switch(this.aesMode){case qr:return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e);case Wr:return this.subtle.decrypt({name:"AES-CTR",counter:this.aesIV,length:64},t,e);default:throw new Error("[AESCrypto] invalid aes mode "+this.aesMode)}},e}(),zr=function(){function e(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}var t=e.prototype;return t.uint8ArrayToUint32Array_=function(e){for(var t=new DataView(e),r=new Uint32Array(4),i=0;i<4;i++)r[i]=t.getUint32(4*i);return r},t.initTable=function(){var e=this.sBox,t=this.invSBox,r=this.subMix,i=r[0],n=r[1],a=r[2],s=r[3],o=this.invSubMix,l=o[0],u=o[1],d=o[2],c=o[3],h=new Uint32Array(256),f=0,g=0,v=0;for(v=0;v<256;v++)h[v]=v<128?v<<1:v<<1^283;for(v=0;v<256;v++){var p=g^g<<1^g<<2^g<<3^g<<4;p=p>>>8^255&p^99,e[f]=p,t[p]=f;var m=h[f],y=h[m],E=h[y],b=257*h[p]^16843008*p;i[f]=b<<24|b>>>8,n[f]=b<<16|b>>>16,a[f]=b<<8|b>>>24,s[f]=b,b=16843009*E^65537*y^257*m^16843008*f,l[p]=b<<24|b>>>8,u[p]=b<<16|b>>>16,d[p]=b<<8|b>>>24,c[p]=b,f?(f=m^h[h[h[E^m]]],g^=h[h[g]]):f=g=1}},t.expandKey=function(e){for(var t=this.uint8ArrayToUint32Array_(e),r=!0,i=0;i<t.length&&r;)r=t[i]===this.key[i],i++;if(!r){this.key=t;var n=this.keySize=t.length;if(4!==n&&6!==n&&8!==n)throw new Error("Invalid aes key size="+n);var a,s,o,l,u=this.ksRows=4*(n+6+1),d=this.keySchedule=new Uint32Array(u),c=this.invKeySchedule=new Uint32Array(u),h=this.sBox,f=this.rcon,g=this.invSubMix,v=g[0],p=g[1],m=g[2],y=g[3];for(a=0;a<u;a++)a<n?o=d[a]=t[a]:(l=o,a%n==0?(l=h[(l=l<<8|l>>>24)>>>24]<<24|h[l>>>16&255]<<16|h[l>>>8&255]<<8|h[255&l],l^=f[a/n|0]<<24):n>6&&a%n==4&&(l=h[l>>>24]<<24|h[l>>>16&255]<<16|h[l>>>8&255]<<8|h[255&l]),d[a]=o=(d[a-n]^l)>>>0);for(s=0;s<u;s++)a=u-s,l=3&s?d[a]:d[a-4],c[s]=s<4||a<=4?l:v[h[l>>>24]]^p[h[l>>>16&255]]^m[h[l>>>8&255]]^y[h[255&l]],c[s]=c[s]>>>0}},t.networkToHostOrderSwap=function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24},t.decrypt=function(e,t,r){for(var i,n,a,s,o,l,u,d,c,h,f,g,v,p,m=this.keySize+6,y=this.invKeySchedule,E=this.invSBox,b=this.invSubMix,T=b[0],S=b[1],w=b[2],A=b[3],L=this.uint8ArrayToUint32Array_(r),I=L[0],k=L[1],R=L[2],D=L[3],C=new Int32Array(e),P=new Int32Array(C.length),_=this.networkToHostOrderSwap;t<C.length;){for(c=_(C[t]),h=_(C[t+1]),f=_(C[t+2]),g=_(C[t+3]),o=c^y[0],l=g^y[1],u=f^y[2],d=h^y[3],v=4,p=1;p<m;p++)i=T[o>>>24]^S[l>>16&255]^w[u>>8&255]^A[255&d]^y[v],n=T[l>>>24]^S[u>>16&255]^w[d>>8&255]^A[255&o]^y[v+1],a=T[u>>>24]^S[d>>16&255]^w[o>>8&255]^A[255&l]^y[v+2],s=T[d>>>24]^S[o>>16&255]^w[l>>8&255]^A[255&u]^y[v+3],o=i,l=n,u=a,d=s,v+=4;i=E[o>>>24]<<24^E[l>>16&255]<<16^E[u>>8&255]<<8^E[255&d]^y[v],n=E[l>>
vendor: 4,971 bytes, line 2
2>24]<<24^E[u>>16&255]<<16^E[d>>8&255]<<8^E[255&o]^y[v+1],a=E[u>>>24]<<24^E[d>>16&255]<<16^E[o>>8&255]<<8^E[255&l]^y[v+2],s=E[d>>>24]<<24^E[o>>16&255]<<16^E[l>>8&255]<<8^E[255&u]^y[v+3],P[t]=_(i^I),P[t+1]=_(s^k),P[t+2]=_(a^R),P[t+3]=_(n^D),I=c,k=h,R=f,D=g,t+=4}return P.buffer},e}(),Qr=function(){function e(e,t,r){this.subtle=void 0,this.key=void 0,this.aesMode=void 0,this.subtle=e,this.key=t,this.aesMode=r}return e.prototype.expandKey=function(){var e=function(e){switch(e){case qr:return"AES-CBC";case Wr:return"AES-CTR";default:throw new Error("[FastAESKey] invalid aes mode "+e)}}(this.aesMode);return this.subtle.importKey("raw",this.key,{name:e},!1,["encrypt","decrypt"])},e}(),Xr=function(){function e(e,t){if(this.logEnabled=!0,this.decryptRange=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.useSoftware=void 0,this.enableSoftwareAES=void 0,this.enableSoftwareAES=e.enableSoftwareAES,!0!==t)try{var r=self.crypto;r&&(this.subtle=r.subtle||r.webkitSubtle)}catch(e){}this.useSoftware=!this.subtle}var t=e.prototype;return t.destroy=function(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null},t.isSync=function(){return this.useSoftware},t.flush=function(){var e=this.currentResult,t=this.remainderData;if(!e||t)return this.reset(),null;var r=new Uint8Array(e);this.reset();var i,n,a,s=this.decryptRange;return s?0===s.start&&s.end>=r.length?r:r.slice(s.start,s.end):(n=(i=r).byteLength,(a=n&&new DataView(i.buffer).getUint8(n-1))?i.slice(0,n-a):i)},t.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},t.decrypt=function(e,t,r,i,n){var a=this;return this.decryptRange=n,this.useSoftware||n?new Promise((function(n,s){var o=ArrayBuffer.isView(e)?e:new Uint8Array(e);a.softwareDecrypt(o,t,r,i);var l=a.flush();l?n(l.buffer):s(new Error("[softwareDecrypt] Failed to decrypt data"))})):this.webCryptoDecrypt(new Uint8Array(e),t,r,i)},t.softwareDecrypt=function(e,t,r,i){var n=this.currentIV,a=this.currentResult,s=this.remainderData;if(i!==qr||16!==t.byteLength)return me.warn("SoftwareDecrypt: can only handle AES-128-CBC"),null;this.logOnce("JS AES decrypt"),s&&(e=ht(s,e),this.remainderData=null);var o=this.getValidChunk(e);if(!o.length)return null;n&&(r=n);var l=this.softwareDecrypter;l||(l=this.softwareDecrypter=new zr),l.expandKey(t);var u=a;return this.currentResult=l.decrypt(o.buffer,0,r),this.currentIV=o.slice(-16).buffer,u||null},t.webCryptoDecrypt=function(e,t,r,i){var n=this;if(this.key!==t||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(e,t,r,i));this.key=t,this.fastAesKey=new Qr(this.subtle,t,i)}return this.fastAesKey.expandKey().then((function(t){return n.subtle?(n.logOnce("WebCrypto AES decrypt"),new Yr(n.subtle,new Uint8Array(r),i).decrypt(e.buffer,t)):Promise.reject(new Error("web crypto not initialized"))})).catch((function(a){return me.warn("[decrypter]: WebCrypto Error, disable WebCrypto API, "+a.name+": "+a.message),n.onWebCryptoError(e,t,r,i)}))},t.onWebCryptoError=function(e,t,r,i){var n=this.enableSoftwareAES;if(n){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,r,i);var a=this.flush();if(a)return a.buffer}throw new Error("WebCrypto"+(n?" and softwareDecrypt":"")+": failed to decrypt data")},t.getValidChunk=function(e){var t=e,r=e.length-e.length%16;return r!==e.length&&(t=e.slice(0,r),this.remainderData=e.slice(r)),t},t.logOnce=function(e){this.logEnabled&&(me.log("[decrypter]: "+e),this.logEnabled=!1)},e}(),Jr=Math.pow(2,17),Zr=function(){function e(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}var t=e.prototype;return t.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},t.abort=function(){this.loader&&this.loader.abort()},t.load=function(e,t,r,i){var n=this,a=e.url;if(!a)return Promise.reject(new ii({type:B.NETWORK_ERROR,details:$.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error("Fragment does not have a "+(a?"part list":"url")),networkDetails:null}));this.abort();var s=this.config,o=s.fLoader,l=s.loader;return new Promise((function(u,d){if(n.loader&&n.loader.destroy(),e.gap){if(e.tagList.some((function(e){return"GAP"===e[0]})))return void d(ri(e));e.gap=!1}var c=n.loader=o?new o(s):new l(s),h=ei(e,null,t);e.loader=c;var f=ne(s.fragLoadPolicy.default),v={loadPolicy:f,timeout:f.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:"initSegment"===e.sn?1/0:Jr};c.stats.retry=e.stats.retry,e.stats=c.stats;var p={onSuccess:function(t,r,i,a){n.resetLoader(e,c);var s=t.data;i.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(s.slice(0,16)),s=s.slice(16)),u({frag:e,part:null,payload:s,networkDetails:a})},onError:function(t,r,i,s){n.resetLoader(e,c),d(new ii({type:B.NETWORK_E
vendor: 13,867 bytes, line 2
2RROR,details:$.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:g({url:a,data:void 0},t),error:new Error("HTTP Error "+t.code+" "+t.text),networkDetails:i,stats:s}))},onAbort:function(t,r,i){n.resetLoader(e,c),d(new ii({type:B.NETWORK_ERROR,details:$.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:i,stats:t}))},onTimeout:function(t,r,i){n.resetLoader(e,c),d(new ii({type:B.NETWORK_ERROR,details:$.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error("Timeout after "+v.timeout+"ms"),networkDetails:i,stats:t}))}};if(r){var m=n.gateProgress(r,i);p.onProgress=function(t,r,i,n){return m({frag:e,part:null,payload:i,networkDetails:n})}}c.load(h,v,p)}))},t.gateProgress=function(e,t){var r=e;if(t){var i=[],n=!1;t.then((function(){n=!0,i.forEach((function(t){return e(t)})),i.length=0})).catch((function(){})),r=function(t){n?e(t):i.push(t)}}return r},t.loadPart=function(e,t,r){var i=this;this.abort();var n=this.config,a=n.fLoader,s=n.loader;return new Promise((function(o,l){if(i.loader&&i.loader.destroy(),e.gap||t.gap)l(ri(e,t));else{var u=i.loader=a?new a(n):new s(n),d=ei(e,t);e.loader=u;var c=ne(n.fragLoadPolicy.default),h={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:Jr};t.stats=u.stats,u.load(d,h,{onSuccess:function(n,a,s,l){i.resetLoader(e,u),i.updateStatsFromPart(e,t);var d={frag:e,part:t,payload:n.data,networkDetails:l};r(d),o(d)},onError:function(r,n,a,s){i.resetLoader(e,u),l(new ii({type:B.NETWORK_ERROR,details:$.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:g({url:d.url,data:void 0},r),error:new Error("HTTP Error "+r.code+" "+r.text),networkDetails:a,stats:s}))},onAbort:function(r,n,a){e.stats.aborted=t.stats.aborted,i.resetLoader(e,u),l(new ii({type:B.NETWORK_ERROR,details:$.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:a,stats:r}))},onTimeout:function(r,n,a){i.resetLoader(e,u),l(new ii({type:B.NETWORK_ERROR,details:$.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error("Timeout after "+h.timeout+"ms"),networkDetails:a,stats:r}))}})}}))},t.updateStatsFromPart=function(e,t){var r=e.stats,i=t.stats,n=i.total;if(r.loaded+=i.loaded,n){var a=Math.round(e.duration/t.duration),s=Math.min(Math.round(r.loaded/n),a),o=(a-s)*Math.round(r.loaded/s);r.total=r.loaded+o}else r.total=Math.max(r.loaded,r.total);var l=r.loading,u=i.loading;l.start?l.first+=u.first-u.start:(l.start=u.start,l.first=u.first),l.end=u.end},t.resetLoader=function(e,t){e.loader=null,e.url=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()},e}();function ei(e,t,r){void 0===t&&(t=null);var i=t||e,n={type:V.MEDIA_FRAGMENT,frag:e,part:t,responseType:"arraybuffer",url:i.url,headers:{},rangeStart:0,rangeEnd:0},a=ti(e,t,r);return a.resetIV&&(n.resetIV=!0),a.byteRange&&(n.rangeStart=a.byteRange.start,n.rangeEnd=a.byteRange.end),n}function ti(e,t,r){void 0===t&&(t=null);var i,n,a={},s=t||e,o=s.byteRangeStartOffset,l=s.byteRangeEndOffset;if(F(o)&&F(l))if("initSegment"!==e.sn&&!r||"AES-128"!==(n=null==(i=e.decryptdata)?void 0:i.method)&&"AES-256"!==n)a.byteRange={start:o,end:l};else{var u=16*Math.floor(o/16),d=16*Math.ceil(l/16);a.decryptRange={start:o-u,end:l-u},u>=16&&(a.resetIV=!0,u-=16),a.byteRange={start:u,end:d}}return a}function ri(e,t){var r=new Error("GAP "+(e.gap?"tag":"attribute")+" found"),i={type:B.MEDIA_ERROR,details:$.FRAG_GAP,fatal:!1,frag:e,error:r,networkDetails:null};return t&&(i.part=t),(t||e).stats.aborted=!0,new ii(i)}var ii=function(e){function t(t){var r;return(r=e.call(this,t.error.message)||this).data=void 0,r.data=t,r}return c(t,e),t}(b(Error)),ni=function(e){function t(t,r){var i;return(i=e.call(this,t,r)||this)._boundTick=void 0,i._tickTimer=null,i._tickInterval=null,i._tickCallCount=0,i._boundTick=i.tick.bind(i),i}c(t,e);var r=t.prototype;return r.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},r.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},r.onHandlerDestroyed=function(){},r.hasInterval=function(){return!!this._tickInterval},r.hasNextTick=function(){return!!this._tickTimer},r.setInterval=function(e){return!this._tickInterval&&(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,e),!0)},r.clearInterval=function(){return!!this._tickInterval&&(self.clearInterval(this._tickInterval),this._tickInterval=null,!0)},r.clearNextTick=function(){return!!this._tickTimer&&(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0)},r.tick=function(){this._tickCallCount++,1===this._tickCallCount?(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0):(this.log("possible exception thrown in task-loop ("+this.constructor.name+".doTick)"),this._tickCallCount=0)},r.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},r.doTick=function(){},t}(de),ai=function(e,t,r,i,n,a,s,o,l){void 0===i&&(i=0),void 0===n&&(n=-1),void 0===a&&(a=!1),this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.iframe=void 0,this.duration=void 0,this.decryptRange=void 0,this.transmuxing={start:0,executeStart:0,executeEnd:0,end:0},this.buffering={audio:{start:0,executeStart:0,executeEnd:0,end:0},video:{start:0,executeStart:0,executeEnd:0,end:0},audiovideo:{start:0,executeStart:0,executeEnd:0,end:0}},this.level=e,this.sn=t,this.id=r,this.size=i,this.part=n,this.partial=a,this.duration=s||0,this.decryptRange=l,this.iframe=o||!1},si={length:0,start:function(){return 0},end:function(){return 0}},oi=function(){function e(){}return e.isBuffered=function(t,r){if(t)for(var i=e.getBuffered(t),n=i.length;n--;)if(r>=i.start(n)&&r<=i.end(n))return!0;return!1},e.bufferedRanges=function(t){if(t){var r=e.getBuffered(t);return e.timeRangesToArray(r)}return[]},e.timeRangesToArray=function(e){for(var t=[],r=0;r<e.length;r++)t.push({start:e.start(r),end:e.end(r)});return t},e.bufferInfo=function(t,r,i){if(t){var n=e.bufferedRanges(t);if(n.length)return e.bufferedInfo(n,r,i)}return{len:0,start:r,end:r,bufferedIndex:-1}},e.bufferedInfo=function(e,t,r){t=Math.max(0,t),e.length>1&&e.sort((function(e,t){return e.start-t.start||t.end-e.end}));var i=-1,n=[];if(r)for(var a=0;a<e.length;a++){t>=e[a].start&&t<=e[a].end&&(i=a);var s=n.length;if(s){var o=n[s-1].end;e[a].start-o<r?e[a].end>o&&(n[s-1].end=e[a].end):n.push(e[a])}else n.push(e[a])}else n=e;for(var l,u=0,d=t,c=t,h=0;h<n.length;h++){var f=n[h].start,g=n[h].end;if(-1===i&&t>=f&&t<=g&&(i=h),t+r>=f&&t<g)d=f,u=(c=g)-t;else if(t+r<f){l=f;break}}return{len:u,start:d||0,end:c||0,nextStart:l,buffered:e,bufferedIndex:i}},e.getBuffered=function(e){try{return e.buffered||si}catch(e){return me.log("failed to get media.buffered",e),si}},e}(),li=/\{\$([a-zA-Z0-9-_]+)\}/g;function ui(e){return li.lastIndex=0,li.test(e)}function di(e,t){if(null!==e.variableList||e.hasVariableRefs){var r=e.variableList;return t.replace(li,(function(t){var i=t.substring(2,t.length-1),n=null==r?void 0:r[i];return void 0===n?(e.playlistParsingError||(e.playlistParsingError=new Error('Missing preceding EXT-X-DEFINE tag for Variable Reference: "'+i+'"')),t):n}))}return t}function ci(e,t,r){var i,n,a=e.variableList;if(a||(e.variableList=a={}),"QUERYPARAM"in t){i=t.QUERYPARAM;try{var s=new self.URL(r).searchParams;if(!s.has(i))throw new Error('"'+i+'" does not match any query parameter in URI: "'+r+'"');n=s.get(i)}catch(t){e.playlistParsingError||(e.playlistParsingError=new Error("EXT-X-DEFINE QUERYPARAM: "+t.message))}}else i=t.NAME,n=t.VALUE;i in a?e.playlistParsingError||(e.playlistParsingError=new Error('EXT-X-DEFINE duplicate Variable Name declarations: "'+i+'"')):a[i]=n||""}function hi(e,t,r){var i=t.IMPORT;if(r&&i in r){var n=e.variableList;n||(e.variableList=n={}),n[i]=r[i]}else e.playlistParsingError||(e.playlistParsingError=new Error('EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "'+i+'"'))}var fi=/^(\d+)x(\d+)$/,gi=/(.+?)=(".*?"|.*?)(?:,|$)/g,vi=function(){function e(t,r){"string"==typeof t&&(t=e.parseAttrList(t,r)),u(this,t)}var t=e.prototype;return t.decimalInteger=function(e){var t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t},t.hexadecimalInteger=function(e){if(this[e]){var t=(this[e]||"0x").slice(2);t=(1&t.length?"0":"")+t;for(var r=new Uint8Array(t.length/2),i=0;i<t.length/2;i++)r[i]=parseInt(t.slice(2*i,2*i+2),16);return r}return null},t.hexadecimalIntegerAsNumber=function(e){var t=parseInt(this[e],16);return t>Number.MAX_SAFE_INTEGER?1/0:t},t.decimalFloatingPoint=function(e){return parseFloat(this[e])},t.optionalFloat=function(e,t){var r=this[e];return r?parseFloat(r):t},t.enumeratedString=function(e){return this[e]},t.enumeratedStringList=function(e,t){var r=this[e];return(r?r.split(/[ ,]+/):[]).reduce((function(e,t){return e[t.toLowerCase()]=!0,e}),t)},t.bool=function(e){return"YES"===this[e]},t.decimalResolution=function(e){var t=fi.exec(this[e]);if(null!==t)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}},e.parseAttrList=function(e,t){var r,i={};for(gi.lastIndex=0;null!==(r=gi.exec(e));){var n=r[1].trim(),a=r[2],s=0===a.indexOf('"')&&a.lastIndexOf('"')===a.length-1,o=!1;if(s)a=a.slice(1,-1);else switch(n){case"IV":case"SCTE35-CMD":case"SCTE35-IN":case"SCTE35-OUT":o=!0}if(t&&(s||o))a=di(t,a);else if(!o&&!s)switch(n){case"CLOSED-CAPTIONS":if("NONE"===a)break;case"ALLOWED-CPC":case"CLASS":case"ASSOC-LANGUAGE":case"AUDIO":case"BYTERANGE":case"CHANNELS":case"CHARACTERISTICS":case"CODECS":case"DATA-ID":case"END-DATE":case"GROUP-ID":case"ID":case"IMPORT":case"INSTREAM-ID":case"KEYFORMAT":case"KEYFORMATVERSIONS":case"LANGUAGE":case"NAME":case"PATHWAY-ID":case"QUERYPARAM":case"RECENTLY-REMOVED-DATERANGES":case"SERVER-URI":case"STABLE-RENDITION-ID":case"STABLE-VARIANT-ID":case"START-DATE":case"SUBTITLES":case"SUPPLEMENTAL-CODECS":case"URI":case"VALUE":case"VIDEO":case"X-ASSET-LIST":case"X-ASSET-URI":me.warn(e+": attribute "+n+" is missing quotes")}i[n]=a}return i},i(e,[{key:"clientAttrs",get:function(){return Object.keys(this).filter((function(e){return"X-"===e.substring(0,2)}))}}])}();function pi(e){return"SCTE35-OUT"===e||"SCTE35-IN"===e||"SCTE35-CMD"===e}var mi=function(){return i((function(e,t,r){var i;if(void 0===r&&(r=0),this.attr=void 0,this.tagAnchor=void 0,this.tagOrder=void 0,this._startDate=void 0,this._endDate=void 0,this._dateAtEnd=void 0,this._cue=void 0,this._badValueForSameId=void 0,this.tagAnchor=(null==t?void 0:t.tagAnchor)||null,this.tagOrder=null!=(i=null==t?void 0:t.tagOrder)?i:r,t){var n=t.attr;for(var a in n)if(Object.prototype.hasOwnProperty.call(e,a)&&e[a]!==n[a]){me.warn('DATERANGE tag attribute: "'+a+'" does not match for tags with ID: "'+e.ID+'"'),this._badValueForSameId=a;break}e=u(new vi({}),n,e)}if(this.attr=e,t?(this._startDate=t._startDate,this._cue=t._cue,this._endDate=t._endDate,this._dateAtEnd=t._dateAtEnd):this._startDate=new Date(e["START-DATE"]),"END-DATE"in e){var s=(null==t?void 0:t.endDate)||new Date(e["END-DATE"]);F(s.getTime())&&(this._endDate=s)}}),[{key:"id",get:function(){return this.attr.ID}},{key:"class",get:function(){return this.attr.CLASS}},{key:"cue",get:function(){var e=this._cue;return void 0===e?this._cue=this.attr.enumeratedStringList(this.attr.CUE?"CUE":"X-CUE",{pre:!1,post:!1,once:!1}):e}},{key:"startTime",get:function(){var e=this.tagAnchor;return null===e||null===e.programDateTime?(me.warn('Expected tagAnchor Fragment with PDT set for DateRange "'+this.id+'": '+e),NaN):e.start+(this.startDate.getTime()-e.programDateTime)/1e3}},{key:"startDate",get:function(){return this._startDate}},{key:"endDate",get:function(){var e=this._endDate||this._dateAtEnd;if(e)return e;var t=this.duration;return null!==t?this._dateAtEnd=new Date(this._startDate.getTime()+1e3*t):null}},{key:"duration",get:function(){if("DURATION"in this.attr){var e=this.attr.decimalFloatingPoint("DURATION");if(F(e))return e}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}},{key:"plannedDuration",get:function(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}},{key:"endOnNext",get:function(){return this.attr.bool("END-ON-NEXT")}},{key:"isInterstitial",get:function(){return"com.apple.hls.interstitial"===this.class}},{key:"isValid",get:function(){return!!this.id&&!this._badValueForSameId&&F(this.startDate.getTime())&&(null===this.duration||this.duration>=0)&&(!this.endOnNext||!!this.class)&&(!this.attr.CUE||!this.cue.pre&&!this.cue.post||this.cue.pre!==this.cue.post)&&(!this.isInterstitial||"X-ASSET-URI"in this.attr||"X-ASSET-LIST"in this.attr)}},{key:"invalidReason",get:function(){return this.id?this._badValueForSameId?"Date range "+this._badValueForSameId+" mismatch":F(this.startDate.getTime())?!this.isInterstitial||"X-ASSET-URI"in this.attr||"X-ASSET-LIST"in this.attr?this.isValid?null:"Unknown (check DURATION(|END|NEXT), CLASS, and CUE)":"Interstitial Date range missing X-ASSET-(LIST|URI)":"Date range invalid start date":"Missing ID"}}])}(),yi=function(){function e(e){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.dateRangeTagCount=0,this.live=!0,this.iframesOnly=!1,this.requestScheduled=-1,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.drift
vendor: 1,036 bytes, line 2
2StartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.appliedTimelineOffset=void 0,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=e}var t=e.prototype;return t.reloaded=function(e){if(!e)return this.advanced=!0,void(this.updated=!0);var t=this.lastPartSn-e.lastPartSn,r=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!r||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||0===t&&r>0,this.updated||this.advanced?this.misses=0:this.misses=e.misses+1},t.hasKey=function(e){return this.encryptedFragments.some((function(t){var r=t.decryptdata;return r||(t.setKeyFormat(e.keyFormat),r=t.decryptdata),!!r&&e.matches(r)}))},i(e,[{key:"hasProgramDateTime",get:function(){return!!this.fragments.length&&F(this.fragments[this.fragments.length-1].programDateTime)}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||10}}
vendor: 16,471 bytes, line 2
2,{key:"drift",get:function(){var e=this.driftEndTime-this.driftStartTime;return e>0?1e3*(this.driftEnd-this.driftStart)/e:1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){return this.fragments.length?this.fragments[this.fragments.length-1].end:0}},{key:"fragmentStart",get:function(){return this.fragments.length?this.fragments[0].start:0}},{key:"age",get:function(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}},{key:"lastPartIndex",get:function(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].index:-1}},{key:"maxPartIndex",get:function(){var e=this.partList;if(e){var t=this.lastPartIndex;if(-1!==t){for(var r=e.length;r--;)if(e[r].index>t)return e[r].index;return t}}return 0}},{key:"lastPartSn",get:function(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}},{key:"expired",get:function(){if(this.live&&this.age&&this.misses<3){var e=this.partEnd-this.fragmentStart;return this.age>Math.max(e,this.totalduration)+this.levelTargetDuration}return!1}}])}();function Ei(e,t){return e.length===t.length&&!e.some((function(e,r){return e!==t[r]}))}function bi(e,t){return!e&&!t||!(!e||!t)&&Ei(e,t)}function Ti(e){return"AES-128"===e||"AES-256"===e||"AES-256-CTR"===e}function Si(e){switch(e){case"AES-128":case"AES-256":return qr;case"AES-256-CTR":return Wr;default:throw new Error("invalid full segment method "+e)}}function wi(e){return Uint8Array.from(unescape(encodeURIComponent(e)),(function(e){return e.charCodeAt(0)}))}function Ai(e){var t=function(e,t,r){var i=e[t];e[t]=e[r],e[r]=i};t(e,0,3),t(e,1,2),t(e,4,5),t(e,6,7)}function Li(e){var t,r,i=e.split(":"),n=null;if("data"===i[0]&&2===i.length){var a=i[1].split(";"),s=a[a.length-1].split(",");if(2===s.length){var o="base64"===s[0],l=s[1];o?(a.splice(-1,1),n=Ue(l)):(t=wi(l).subarray(0,16),(r=new Uint8Array(16)).set(t,16-t.length),n=r)}}return n}var Ii="undefined"!=typeof self?self:void 0,ki={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},Ri="org.w3.clearkey",Di="com.apple.streamingkeydelivery",Ci="com.microsoft.playready",Pi="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";function _i(e){switch(e){case Di:return ki.FAIRPLAY;case Ci:return ki.PLAYREADY;case Pi:return ki.WIDEVINE;case Ri:return ki.CLEARKEY}}var xi="edef8ba979d64acea3c827dcd51d21ed";function Oi(e){switch(e){case ki.FAIRPLAY:return Di;case ki.PLAYREADY:return Ci;case ki.WIDEVINE:return Pi;case ki.CLEARKEY:return Ri}}function Mi(e){var t=e.drmSystems,r=e.widevineLicenseUrl,i=t?[ki.FAIRPLAY,ki.WIDEVINE,ki.PLAYREADY,ki.CLEARKEY].filter((function(e){return!!t[e]})):[];return!i[ki.WIDEVINE]&&r&&i.push(ki.WIDEVINE),i}var Fi,Ni=null!=Ii&&null!=(Fi=Ii.navigator)&&Fi.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null;function Ui(e){var t=Be(new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2)),r=t.substring(t.indexOf("<"),t.length),i=(new DOMParser).parseFromString(r,"text/xml").getElementsByTagName("KID")[0];if(i){var n=i.childNodes[0]?i.childNodes[0].nodeValue:i.getAttribute("VALUE");if(n){var a=Ue(n).subarray(0,16);return Ai(a),a}}return null}var Bi={},$i=function(){function e(e,t,r,i,n,a){void 0===i&&(i=[1]),void 0===n&&(n=null),this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pssh=null,this.scheme=void 0,this.method=e,this.uri=t,this.keyFormat=r,this.keyFormatVersions=i,this.iv=n,this.encrypted=!!e&&"NONE"!==e,this.isCommonEncryption=this.encrypted&&!Ti(e),null!=a&&a.startsWith("0x")&&(this.keyId=new Uint8Array(Ne(a)))}e.clearKeyUriToKeyIdMap=function(){Bi={}},e.setKeyIdForUri=function(e,t){Bi[e]=t},e.addKeyIdForUri=function(e){var t=Object.keys(Bi).length%Number.MAX_SAFE_INTEGER,r=new Uint8Array(16);return new DataView(r.buffer,12,4).setUint32(0,t),Bi[e]=r,r};var t=e.prototype;return t.matches=function(e){return e.uri===this.uri&&e.method===this.method&&e.encrypted===this.encrypted&&e.keyFormat===this.keyFormat&&Ei(e.keyFormatVersions,this.keyFormatVersions)&&bi(e.iv,this.iv)&&bi(e.keyId,this.keyId)},t.isSupported=function(){if(this.method){if(Ti(this.method)||"NONE"===this.method)return!0;if("identity"===this.keyFormat)return"SAMPLE-AES"===this.method;switch(this.keyFormat){case Di:case Pi:case Ci:case Ri:return-1!==["SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)}}return!1},t.getDecryptData=function(t,r){var i;if(!this.encrypted||!this.uri)return null;if(Ti(this.method)){var n=this.iv;return n||("number"!=typeof t&&(me.warn('missing IV for initialization segment with method="'+this.method+'" - compliance issue'),t=0),n=function(e){for(var t=new Uint8Array(16),r=12;r<16;r++)t[r]=e>>8*(15-r)&255;return t}(t)),new e(this.method,this.uri,"identity",this.keyFormatVersions,n)}if(this.keyId){var a=Bi[this.uri];if(a&&!Ei(this.keyId,a)&&e.setKeyIdForUri(this.uri,this.keyId),this.pssh)return this}var s,o=Li(this.uri);if(o)switch(this.keyFormat){case Pi:if(this.pssh=o,!this.keyId){var l=yt(o.buffer).filter((function(e){return e.systemId===xi}));if(l.length){var u,d=l[0];this.keyId=null!=(u=d.kids)&&u.length?d.kids[0]:null}}this.keyId||(this.keyId=Gi(r));break;case Ci:var c=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=mt(c,0,o),this.keyId=Ui(o);break;default:var h=o.subarray(0,16);if(16!==h.length){var f=new Uint8Array(16);f.set(h,16-h.length),h=f}this.keyId=h}return 16!==(null==(i=this.keyId)?void 0:i.byteLength)&&(s=function(e){var t=null==e?void 0:e[Pi];return t?t.keyId:null}(r),s||(s=Gi(r))||(s=Bi[this.uri]),s&&(this.keyId=s,e.setKeyIdForUri(this.uri,s))),this},e}();function Gi(e){var t=null==e?void 0:e[Ci];if(t){var r=Li(t.uri);if(r)return Ui(r)}return null}var Hi=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-(I-FRAME-STREAM-INF|SESSION-DATA|SESSION-KEY|DEFINE|CONTENT-STEERING|START):([^\r\n]*)(?:[\r\n]+|$)/g,Vi=/#EXT-X-MEDIA:(.*)/g,Ki=/^#EXT(?:INF|-X-TARGETDURATION):/m,ji=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#.*/.source].join("|"),"g"),qi=new RegExp([/#EXT-X-(PROGRAM-DATE-TIME|BYTERANGE|DATERANGE|DEFINE|KEY|MAP|PART|PART-INF|PLAYLIST-TYPE|PRELOAD-HINT|RENDITION-REPORT|SERVER-CONTROL|SKIP|START):(.+)/.source,/#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\d+)/.source,/#EXT-X-(DISCONTINUITY|ENDLIST|GAP|INDEPENDENT-SEGMENTS|I-FRAMES-ONLY)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),Wi=function(){function e(){}return e.findGroup=function(e,t){for(var r=0;r<e.length;r++){var i=e[r];if(i.id===t)return i}},e.resolve=function(e,t){return M.buildAbsoluteURL(t,e,{alwaysNormalize:!0})},e.isMediaPlaylist=function(e){return Ki.test(e)},e.parseMasterPlaylist=function(t,r){var i,n={contentSteering:null,levels:[],iframeVariants:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:ui(t)},a=[];if(Hi.lastIndex=0,!t.startsWith("#EXTM3U"))return n.playlistParsingError=new Error("no EXTM3U delimiter"),n;for(;null!=(i=Hi.exec(t));)if(i[1]){var s=Yi(new vi(i[1],n),i[2],r,n,a);s&&n.levels.push(s)}else if(i[3]){var o=i[3],l=i[4];switch(o){case"I-FRAME-STREAM-INF":var u=new vi(l,n),d=Yi(u,u.URI,r,n,a,!0);d&&n.iframeVariants.push(d);break;case"SESSION-DATA":var c=new vi(l,n),h=c["DATA-ID"];h&&(null===n.sessionData&&(n.sessionData={}),n.sessionData[h]=c);break;case"SESSION-KEY":var f=Xi(l,r,n);f.encrypted&&f.isSupported()?(null===n.sessionKeys&&(n.sessionKeys=[]),n.sessionKeys.push(f)):me.warn('[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "'+l+'"');break;case"DEFINE":ci(n,new vi(l,n),r);break;case"CONTENT-STEERING":var g=new vi(l,n);n.contentSteering={uri:e.resolve(g["SERVER-URI"],r),pathwayId:g["PATHWAY-ID"]||"."};break;case"START":n.startTimeOffset=Ji(l)}}var v=a.length>0&&a.length<n.levels.length;return n.levels=v?a:n.levels,0===n.levels.length&&(n.playlistParsingError=new Error("no levels found in manifest")),n},e.parseMasterPlaylistMedia=function(t,r,i){var n,a={},s=i.levels,o={AUDIO:s.map((function(e){return{id:e.attrs.AUDIO,audioCodec:e.audioCodec}})),SUBTITLES:s.map((function(e){return{id:e.attrs.SUBTITLES,textCodec:e.textCodec}})),"CLOSED-CAPTIONS":[]},l=0;for(Vi.lastIndex=0;null!==(n=Vi.exec(t));){var u=new vi(n[1],i),d=u.TYPE;if(d){var c=o[d],h=a[d]||[];a[d]=h;var f=u.LANGUAGE,g=u["ASSOC-LANGUAGE"],v=u.CHANNELS,p=u.CHARACTERISTICS,m=u["INSTREAM-ID"],y={attrs:u,bitrate:0,id:l++,groupId:u["GROUP-ID"]||"",name:u.NAME||f||"",type:d,default:u.bool("DEFAULT"),autoselect:u.bool("AUTOSELECT"),forced:u.bool("FORCED"),lang:f,url:u.URI?e.resolve(u.URI,r):""};if(g&&(y.assocLang=g),v&&(y.channels=v),p&&(y.characteristics=p),m&&(y.instreamId=m),null!=c&&c.length){var E=e.findGroup(c,y.groupId)||c[0];en(y,E,"audioCodec"),en(y,E,"textCodec")}h.push(y)}}return a},e.parseLevelPlaylist=function(e,t,r,i,n,a){var s,o,l,d,c,h={url:t},f=new yi(t),g=f.fragments,v=[],p=null,m=0,y=0,E=0,b=0,T=0,S=null,w=new Q(i,h),A=-1,L=!1,I=null;if(ji.lastIndex=0,f.m3u8=e,f.hasVariableRefs=ui(e),"#EXTM3U"!==(null==(s=ji.exec(e))?void 0:s[0]))return f.playlistParsingError=new Error("Missing format identifier #EXTM3U"),f;for(;null!==(o=ji.exec(e));){L&&(L=!1,(w=new Q(i,h)).playlistOffset=E,w.setStart(E),w.sn=m,w.cc=b,T&&(w.bitrate=T),w.level=r,p&&(w.initSegment=p,p.rawProgramDateTime&&(w.rawProgramDateTime=p.rawProgramDateTime,p.rawProgramDateTime=null),I&&(w.setByteRange(I),I=null)));var k=o[1];if(k){w.duration=parseFloat(k);var R=(" "+o[2]).slice(1);w.title=R||null,w.tagList.push(R?["INF",k,R]:["INF",k])}else if(o[3]){if(F(w.duration)){var D;w.playlistOffset=E,w.setStart(E),d&&nn(w,d,f),w.sn=m,w.level=r,w.cc=b;var C=(" "+o[3]).slice(1);w.relurl=di(f,C),tn(w,S,v),S=w,E+=w.duration,m++,y=0;var P=w.byteRange;if(2===P.length&&(w.bitrate=8*(P[1]-P[0])/w.duration|0),f.iframesOnly&&P[0]&&(null==(D=p)?void 0:D.cc)!==b){var _=new Q(i,h);_.relurl=w.relurl,_.setByteRange(Math.min(P[0],1316)+"@0"),_.level=r,_.sn="initSegment",d&&(_.levelkeys=d,d.identity&&(_._decryptdata=d.identity.getDecryptData(0))),p=_,w.initSegment=p}g.push(w),L=!0}}else{if(!(o=o[0].match(qi))){me.warn("No matches on slow regex match for level playlist!");continue}for(l=1;l<o.length&&void 0===o[l];l++);var x=(" "+o[l]).slice(1),O=(" "+o[l+1]).slice(1),M=o[l+2]?(" "+o[l+2]).slice(1):null;switch(x){case"BYTERANGE":S?w.setByteRange(O,S):w.setByteRange(O);break;case"PROGRAM-DATE-TIME":w.rawProgramDateTime=O,w.tagList.push(["PROGRAM-DATE-TIME",O]),-1===A&&(A=g.length);break;case"PLAYLIST-TYPE":f.type&&an(f,x,o),f.type=O.toUpperCase();break;case"MEDIA-SEQUENCE":0!==f.startSN?an(f,x,o):null!==S&&sn(f,x,o),f.startSN=parseInt(O),m=f.startSN+f.skippedSegments;break;case"SKIP":f.skippedSegments&&an(f,x,o);var N=new vi(O,f),U=N.decimalInteger("SKIPPED-SEGMENTS");if(F(U)){f.skippedSegments+=U;for(var B=U;B--;)g.push(null);m+=U}var $=N.enumeratedString("RECENTLY-REMOVED-DATERANGES");$&&(f.recentlyRemovedDateranges=(f.recentlyRemovedDateranges||[]).concat($.split("\t")));break;case"TARGETDURATION":0!==f.targetduration&&an(f,x,o),f.targetduration=Math.max(parseInt(O),1);break;case"VERSION":null!==f.version&&an(f,x,o),f.version=parseInt(O);break;case"INDEPENDENT-SEGMENTS":break;case"I-FRAMES-ONLY":f.iframesOnly=!0;break;case"ENDLIST":f.live||an(f,x,o),f.live=!1;break;case"#":(O||M)&&w.tagList.push(M?[O,M]:[O]);break;case"DISCONTINUITY":b++,w.tagList.push(["DIS"]);break;case"GAP":w.gap=!0,w.tagList.push([x]);break;case"BITRATE":w.tagList.push([x,O]),T=1e3*parseInt(O),F(T)?w.bitrate=T:T=0;break;case"DATERANGE":var G=new vi(O,f),H=new mi(G,f.dateRanges[G.ID],f.dateRangeTagCount);f.dateRangeTagCount++,H.isValid||f.skippedSegments?f.dateRanges[H.id]=H:me.log("Ignoring invalid DATERANGE tag: "+H.invalidReason+": "+O),w.tagList.push(["EXT-X-DATERANGE",O]);break;case"DEFINE":var V=new vi(O,f);"IMPORT"in V?hi(f,V,a):ci(f,V,t);break;case"DISCONTINUITY-SEQUENCE":0!==f.startCC&&an(f,x,o),f.startCC=b=parseInt(O),g.forEach((function(e){return e&&(e.cc=b)}));break;case"KEY":var K=Xi(O,t,f);if(K.isSupported()){if("NONE"===K.method){d=void 0;break}d||(d={});var j=d[K.keyFormat];null!=j&&j.matches(K)||(j&&(d=u({},d)),d[K.keyFormat]=K)}else me.warn('[Keys] Ignoring unsupported EXT-X-KEY tag: "'+O+'"');break;case"START":f.startTimeOffset=Ji(O);break;case"MAP":var q=new vi(O,f);if(w.duration){var W=new Q(i,h);rn(W,q,r,d),p=W,w.initSegment=p,p.rawProgramDateTime&&!w.rawProgramDateTime&&(w.rawProgramDateTime=p.rawProgramDateTime)}else{var Y=w.byteRangeEndOffset;if(Y){var z=w.byteRangeStartOffset;I=Y-z+"@"+z}else I=null;rn(w,q,r,d),p=w,L=!0}p.cc=b;break;case"SERVER-CONTROL":c&&an(f,x,o),c=new vi(O),f.canBlockReload=c.bool("CAN-BLOCK-RELOAD"),f.canSkipUntil=c.optionalFloat("CAN-SKIP-UNTIL",0),f.canSkipDateRanges=f.canSkipUntil>0&&c.bool("CAN-SKIP-DATERANGES"),f.partHoldBack=c.optionalFloat("PART-HOLD-BACK",0),f.holdBack=c.optionalFloat("HOLD-BACK",0);break;case"PART-INF":f.partTarget&&an(f,x,o);var J=new vi(O);f.partTarget=J.decimalFloatingPoint("PART-TARGET");break;case"PART":var Z=f.partList;Z||(Z=f.partList=[]);var ee=y>0?Z[Z.length-1]:void 0,te=y++,re=new vi(O,f),ie=new X(re,w,h,te,ee);Z.push(ie),w.duration+=ie.duration;break;case"PRELOAD-HINT":var ne=new vi(O,f);f.preloadHint=ne;break;case"RENDITION-REPORT":var ae=new vi(O,f);f.renditionReports=f.renditionReports||[],f.renditionReports.push(ae);break;default:me.warn("line parsed but not handled: "+o)}}}S&&!S.relurl?(g.pop(),E-=S.duration,f.partList&&(f.fragmentHint=S)):f.partList&&(tn(w,S,v),w.cc=b,f.fragmentHint=w,d&&nn(w,d,f)),f.targetduration||(f.playlistParsingError=new Error("Missing Target Duration"));var se=g.length,oe=g[0],le=g[se-1];if((E+=f.skippedSegments*f.targetduration)>0&&se&&le){f.averagetargetduration=E/se;var ue=le.sn;f.endSN="initSegment"!==ue?ue:0,f.live||(le.endList=!0),A>0&&(function(e,t,r){if(r||(r=e[t]),r)for(var i=t;i--;){var n=e[i];if(!n)return;n.programDateTime=r.programDateTime-1e3*n.duration,r=n}}(g,A,A>se-1?w:null),oe&&v.unshift(oe))}return f.fragmentHint&&(E+=f.fragmentHint.duration),f.totalduration=E,v.length&&f.dateRangeTagCount&&oe&&zi(v,f),f.endCC=b,f},e}();function Yi(e,t,r,i,n,a){var s;if(void 0===t)return null;var o=di(i,t),l={attrs:e,bitrate:e.decimalInteger("BANDWIDTH")||e.decimalInteger("AVERAGE-BANDWIDTH"),name:e.NAME,url:Wi.resolve(o,r)},u=e.decimalResolution("RESOLUTION");u&&(l.width=u.width,l.height=u.height),Zi(e.CODECS,l);var d=e["SUPPLEMENTAL-CODECS"];return d&&(l.supplemental={},Zi(d,l.supplemental)),null!=(s=l.unknownCodecs)&&s.length||n.push(l),a&&(l.iframes=!0),l}function zi(e,t){var r=e.length;if(!r){if(!t.hasProgramDateTime)return;var i=t.fragments[t.fragments.length-1];e.push(i),r++}for(var n=e[r-1],a=t.live?1/0:t.totalduration,s=Object.keys(t.dateRanges),o=s.length;o--;){var l=t.dateRanges[s[o]],u=l.startDate.getTime();l.tagAnchor=n.ref;for(var d=r;d--;){var c;if((null==(c=e[d])?void 0:c.sn)<t.startSN)break;var h=Qi(t,u,e,d,a);if(h){l.tagAnchor=h.ref;break}}}}function Qi(e,t,r,i,n){var a=r[i];if(a){var s,o=a.programDateTime;if((t>=o||0===i)&&t<=o+1e3*(((null==(s=r[i+1])?void 0:s.start)||n)-a.start)){var l=a.sn-e.startSN,u=e.fragments;if(l>=0&&l<u.length){if(u.length>r.length)for(var d=r[i+1]||u[u.length-1],c=Math.min(d.sn-e.startSN,u.length-1);c>l;c--){var h=u[c].programDateTime;if(t>=h&&t<h+1e3*u[c].duration)return u[c]}return u[l]}}}return null}function Xi(e,t,r){var i,n,a=new vi(e,r),s=null!=(i=a.METHOD)?i:"",o=a.URI,l=a.hexadecimalInteger("IV"),u=a.KEYFORMATVERSIONS,d=null!=(n=a.KEYFORMAT)?n:"identity";o&&a.IV&&!l&&me.error("Invalid IV: "+a.IV);var c=o?Wi.resolve(o,t):"",h=(u||"1").split("/").map(Number).filter(Number.isFinite);return new $i(s,c,d,h,l,a.KEYID)}function Ji(e){var t=new vi(e).decimalFloatingPoint("TIME-OFFSET");return F(t)?t:null}function Zi(e,t){var r=(e||"").split(/[ ,]+/).filter((function(e){return e}));["video","audio","text","image"].forEach((function(e){var i=r.filter((function(t){return Dt(t,e)}));i.length&&(t[e+"Codec"]=i.map((function(e){return e.split("/")[0]})).join(","),r=r.filter((function(e){return-1===i.indexOf(e)})))}
vendor: 3,183 bytes, line 2
2)),t.unknownCodecs=r}function en(e,t,r){var i=t[r];i&&(e[r]=i)}function tn(e,t,r){e.rawProgramDateTime?r.push(e):null!=t&&t.programDateTime&&(e.programDateTime=t.endProgramDateTime)}function rn(e,t,r,i){e.relurl=t.URI,t.BYTERANGE&&e.setByteRange(t.BYTERANGE),e.level=r,e.sn="initSegment",i&&(e.levelkeys=i),e.initSegment=null}function nn(e,t,r){e.levelkeys=t;var i=r.encryptedFragments;i.length&&i[i.length-1].levelkeys===t||!Object.keys(t).some((function(e){return t[e].isCommonEncryption}))||i.push(e)}function an(e,t,r){e.playlistParsingError=new Error("#EXT-X-"+t+" must not appear more than once ("+r[0]+")")}function sn(e,t,r){e.playlistParsingError=new Error("#EXT-X-"+t+" must appear before the first Media Segment ("+r[0]+")")}function on(e,t){var r=t.startPTS;if(F(r)){var i,n=0;t.sn>e.sn?(n=r-e.start,i=e):(n=e.start-r,i=t),i.duration!==n&&i.setDuration(n)}else t.sn>e.sn?e.cc===t.cc&&e.minEndPTS?t.setStart(e.start+(e.minEndPTS-e.start)):t.setStart(e.start+e.duration):t.setStart(Math.max(e.start-t.duration,0))}function ln(e,t,r,i,n,a,s,o){i-r<=0&&(o.warn("Fragment should have a positive duration",t),i=r+t.duration,a=n+t.duration);var l=r,u=i,d=t.startPTS,c=t.endPTS;if(F(d)){var h=Math.abs(d-r);e&&h>e.totalduration?o.warn("media timestamps and playlist times differ by "+h+"s for level "+t.level+" "+e.url):F(t.deltaPTS)?t.deltaPTS=Math.max(h,t.deltaPTS):t.deltaPTS=h,l=Math.max(r,d),r=Math.min(r,d),n=void 0!==t.startDTS?Math.min(n,t.startDTS):n,u=Math.min(i,c),i=Math.max(i,c),a=void 0!==t.endDTS?Math.max(a,t.endDTS):a}var f=r-t.start;0!==t.start&&t.setStart(r),t.setDuration(i-t.start),t.startPTS=r,t.maxStartPTS=l,t.startDTS=n,t.endPTS=i,t.minEndPTS=u,t.endDTS=a;var g,v=t.sn;if(!e||v<e.startSN||v>e.endSN)return 0;var p=v-e.startSN,m=e.fragments;for(m[p]=t,g=p;g>0;g--)on(m[g],m[g-1]);for(g=p;g<m.length-1;g++)on(m[g],m[g+1]);return e.fragmentHint&&on(m[m.length-1],e.fragmentHint),e.PTSKnown=e.alignedSliding=!0,f}function un(e,t,r){if(e!==t){for(var i,n=null,a=e.fragments,s=a.length-1;s>=0;s--){var o=a[s].initSegment;if(o){n=o;break}}e.fragmentHint&&delete e.fragmentHint.endPTS,function(e,t,r){for(var i,n=t.skippedSegments,a=Math.max(e.startSN,t.startSN)-t.startSN,s=(e.fragmentHint?1:0)+(n?t.endSN:Math.min(e.endSN,t.endSN))-t.startSN,o=t.startSN-e.startSN,l=t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments,u=null!=(i=e.fragmentHint)&&i.duration?e.fragments.concat(e.fragmentHint):e.fragments,d=a;d<=s;d++){var c=u[o+d],h=l[d];if(n&&!h&&c&&(h=t.fragments[d]=c),c&&h){r(c,h,d,l);var f=c.relurl,g=h.relurl;if(f&&mn(f,g))return void(t.playlistParsingError=dn("media sequence mismatch "+h.sn+":",e,t,0,h));if(c.cc!==h.cc)return void(t.playlistParsingError=dn("discontinuity sequence mismatch ("+c.cc+"!="+h.cc+")",e,t,0,h))}}}(e,t,(function(e,r,a,s){if((!t.startCC||t.skippedSegments)&&r.cc!==e.cc){for(var o=e.cc-r.cc,l=a;l<s.length;l++)s[l].cc+=o;t.endCC=s[s.length-1].cc}F(e.startPTS)&&F(e.endPTS)&&(r.setStart(r.startPTS=e.startPTS),r.startDTS=e.startDTS,r.maxStartPTS=e.maxStartPTS,r.endPTS=e.endPTS,r.endDTS=e.endDTS,r.minEndPTS=e.minEndPTS,r.setDuration(e.endPTS-e.startPTS),r.duration&&(i=r),t.PTSKnown=t.alignedSliding=!0),e.hasStream
vendor: 5,666 bytes, line 2
2s&&(r.elementaryStreams=e.elementaryStreams),r.loader=e.loader,e.hasStats&&(r.stats=e.stats),e.initSegment&&(r.initSegment=e.initSegment,n=e.initSegment)}));var l=t.fragments,d=t.fragmentHint?l.concat(t.fragmentHint):l;if(n&&d.forEach((function(e){var t;!e||e.initSegment&&e.initSegment.relurl!==(null==(t=n)?void 0:t.relurl)||(e.initSegment=n)})),t.skippedSegments){if(t.deltaUpdateFailed=l.some((function(e){return!e})),t.deltaUpdateFailed){r.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var c=t.skippedSegments;c--;)l.shift();t.startSN=l[0].sn}else{t.canSkipDateRanges&&(t.dateRanges=function(e,t,r){var i=t.dateRanges,n=t.recentlyRemovedDateranges,a=u({},e);n&&n.forEach((function(e){delete a[e]}));var s=Object.keys(a).length;return s?(Object.keys(i).forEach((function(e){var t=a[e],n=new mi(i[e].attr,t);n.isValid?(a[e]=n,t||(n.tagOrder+=s)):r.warn('Ignoring invalid Playlist Delta Update DATERANGE tag: "'+sr(i[e].attr)+'"')})),a):i}(e.dateRanges,t,r));var h=e.fragments.filter((function(e){return e.rawProgramDateTime}));if(e.hasProgramDateTime&&!t.hasProgramDateTime)for(var f=1;f<d.length;f++)null===d[f].programDateTime&&tn(d[f],d[f-1],h);zi(h,t)}t.endCC=l[l.length-1].cc}if(!t.startCC){var g,v=fn(e,t.startSN-1);t.startCC=null!=(g=null==v?void 0:v.cc)?g:l[0].cc}(function(e,t,r){if(e&&t)for(var i=0,n=0,a=e.length;n<a;n++){var s=e[n],o=t[n+i];s&&o&&s.index===o.index&&s.fragment.sn===o.fragment.sn?r(s,o):i--}})(e.partList,t.partList,(function(e,t){t.elementaryStreams=e.elementaryStreams,t.stats=e.stats,t.gap=e.gap||t.gap})),i?(t.iframesOnly&&(i.type,K.MAIN),ln(t,i,i.startPTS,i.endPTS,i.startDTS,i.endDTS,0,r)):cn(e,t),l.length&&(t.totalduration=t.edge-l[0].start),t.driftStartTime=e.driftStartTime,t.driftStart=e.driftStart;var p=t.advancedDateTime;if(t.advanced&&p){var m=t.edge;t.driftStart||(t.driftStartTime=p,t.driftStart=m),t.driftEndTime=p,t.driftEnd=m}else t.driftEndTime=e.driftEndTime,t.driftEnd=e.driftEnd,t.advancedDateTime=e.advancedDateTime;-1===t.requestScheduled&&(t.requestScheduled=e.requestScheduled)}}function dn(e,t,r,i,n){return new Error(e+" "+n.url+"\nPlaylist starting @"+t.startSN+"\n"+t.m3u8+"\n\nPlaylist starting @"+r.startSN+"\n"+r.m3u8)}function cn(e,t,r,i){void 0===r&&(r=!0);var n=t.startSN+t.skippedSegments-e.startSN,a=e.fragments,s=n>=0,o=0;if(s&&n<a.length)o=a[n].start,null==i||i.log("Aligning playlists based on SN "+t.startSN+" (diff: "+o+")");else if(s&&t.startSN===e.endSN+1)o=e.fragmentEnd,null==i||i.log("Aligning playlists based on first/last SN "+t.startSN+" (diff: "+o+")");else if(s&&r)o=e.fragmentStart+n*t.levelTargetDuration;else{if(t.skippedSegments||0!==t.fragmentStart)return o;o=e.fragmentStart,null==i||i.log("Aligning playlists based on first SN "+t.startSN+" (diff: "+o+")")}return function(e,t){if(t){for(var r=e.fragments,i=e.skippedSegments;i<r.length;i++)r[i].addStart(t);e.fragmentHint&&e.fragmentHint.addStart(t)}}(t,o),o}function hn(e,t){void 0===t&&(t=1/0);var r=1e3*e.targetduration;if(e.updated){var i=e.fragments;if(i.length&&4*r>t){var n=1e3*i[i.length-1].duration;n>0&&n<r&&(r=n)}}else r/=2;return Math.round(r)}function fn(e,t,r){var i;if(!e)return null;var n=e.fragments[t-e.startSN];return n||((null==(i=n=e.fragmentHint)?void 0:i.sn)===t?n:r&&t<e.startSN&&r.sn===t?r:null)}function gn(e,t,r){return e?vn(e.partList,t,r):null}function vn(e,t,r){if(e)for(var i=e.length;i--;){var n=e[i];if(n.index===r&&n.fragment.sn===t)return n}return null}function pn(e){e.forEach((function(e,t){var r;null==(r=e.details)||r.fragments.forEach((function(e){e.level=t,e.initSegment&&(e.initSegment.level=t)}))}))}function mn(e,t){return!(e===t||!t)&&yn(e)!==yn(t)}function yn(e){return e.replace(/\?[^?]*$/,"")}function En(e,t){for(var r=0,i=e.length;r<i;r++){var n;if((null==(n=e[r])?void 0:n.cc)===t)return e[r]}return null}function bn(e,t){var r=e.start+t;e.setStart(r)}function Tn(e,t){for(var r=t.fragments,i=0,n=r.length;i<n;i++)bn(r[i],e);t.fragmentHint&&bn(t.fragmentHint,e),t.alignedSliding=!0}function Sn(e,t,r){e&&(function(e,t,r){if(function(e,t){return!!(e&&t.startCC<e.endCC&&t.endCC>e.startCC)}(t,e)){var i=Math.min(t.endCC,e.endCC),n=En(t.fragments,i),a=En(e.fragments,i);if(n&&a){var s=n.start-a.start;r.log("Aligning playlists using dicontinuity sequence "+i+" (diff: "+s+")"),Tn(s,e)}}}(t,e,r),t.alignedSliding||function(e,t,r){if(e.hasProgramDateTime&&t.hasProgramDateTime){var i,n,a=e.fragments,s=t.fragments;if(a.length&&s.length){var o=Math.min(t.endCC,e.endCC);t.startCC<o&&e.startCC<o&&(i=En(s,o),n=En(a,o)),i&&n||(n=En(a,(i=s[Math.floor(s.length/2)]||s.filter((function(e){return!!e}))[0]).cc)||a[Math.floor(a.length/2)]);var l=i.programDateTime,u=n.programDateTime;if(l&&u){var d=(u-l)/1e3;if(Math.abs(d)>Math.max(60,e.totalduration))r.log("Cannot align playlists using PDT without overlap ("+Math.abs(d)+" > "+e.totalduration+")");else{var c=d-(n.start-i.start);r.log("Aligning playlists using PDT (diff: "+c+")"),Tn(c,e)}}}}}(t,e,r),t.alignedSliding||t.skippedSegments||cn(e,t,!1,r))}function wn(e,t,r){An(e,t,r),e.addEventListener(t,r)}function An(e,t,r){e.removeEventListener(t,r)}function Ln(e){for(var t="",r=e.length,i=0;i<r;i++)t+="["+e.start(i).toFixed(3)+"-"+e.end(i).toFixed(3)+"]";return t}var In={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},kn=function(e){function t(t,r,i,n,a){var s;return(s=e.call(this,n,t.logger)||this).hls=void 0,s.fragPrevious=null,
vendor: 6,239 bytes, line 2
2s.fragCurrent=null,s.fragPlaying=null,s.fragmentTracker=void 0,s.transmuxer=null,s._state=In.STOPPED,s.playlistType=void 0,s.media=null,s.mediaBuffer=null,s.config=void 0,s.bitrateTest=!1,s.lastCurrentTime=0,s.nextLoadPosition=0,s.startPosition=-1,s.startTimeOffset=null,s.retryDate=0,s.levels=null,s.fragmentLoader=void 0,s.initFragmentLoader=void 0,s.keyLoader=void 0,s.levelLastLoaded=null,s.startFragRequested=!1,s.decrypter=void 0,s.initPTS=[],s.buffering=!0,s.loadingParts=!1,s.loopSn=void 0,s.onMediaSeeking=function(){var e=s,t=e.config,r=e.fragCurrent,i=e.media,n=e.mediaBuffer,a=e.state,o=i?i.currentTime:0,l=oi.bufferInfo(n||i,o,t.maxBufferHole),u=l.len;if(s.log("Media seeking to "+o+", state: "+a+", "+(u?"in":"out of")+" buffer"),s.state===In.ENDED)s.resetLoadingState();else if(r){var d=t.maxFragLookUpTolerance,c=r.start-d,h=r.start+r.duration+d;if(!u||h<l.start||c>l.end){var f=o<c,g=o>h;(f||g)&&(!r.loader||!g&&s.isFragmentNearlyDownloaded(r)?s.fragPrevious=null:(s.log("Cancelling fragment load for seek (sn: "+r.sn+") - "+(f?"backward":"forward")+" seek"),r.abortRequests(),s.resetLoadingState()))}}if(i&&(s.fragmentTracker.removeFragmentsInRange(o,1/0,s.playlistType,!0),o>s.lastCurrentTime&&(s.lastCurrentTime=o),!s.loadingParts)){var v=Math.max(l.end,o),p=s.shouldLoadParts(s.getLevelDetails(),v);p&&(s.log("LL-Part loading ON after seeking to "+o+" with buffer @"+v),s.loadingParts=p)}var m=!oi.isBuffered(i,o);s.hls.hasEnoughToStart&&!m||(s.log("Setting "+(m?"startPosition":"nextLoadPosition")+" to "+o+" for seek without enough to start"),s.nextLoadPosition=o,m&&(s.startPosition=o)),u<1&&s.state===In.IDLE&&s.tickImmediate()},s.onMediaEnded=function(){s.log("setting startPosition to 0 because media ended"),s.startPosition=s.lastCurrentTime=0},s.playlistType=a,s.hls=t,s.fragmentLoader=new Zr(t.config),s.initFragmentLoader=new Zr(t.config),s.keyLoader=i,s.fragmentTracker=r,s.config=t.config,s.decrypter=new Xr(t.config),s}c(t,e);var r=t.prototype;return r.registerListeners=function(){var e=this.hls;e.on(G.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(G.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(G.MANIFEST_LOADING,this.onManifestLoading,this),e.on(G.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(G.ERROR,this.onError,this)},r.unregisterListeners=function(){var e=this.hls;e.off(G.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(G.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(G.MANIFEST_LOADING,this.onManifestLoading,this),e.off(G.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(G.ERROR,this.onError,this)},r.doTick=function(){this.onTickEnd()},r.onTickEnd=function(){},r.startLoad=function(e){},r.stopLoad=function(){if(this.state!==In.STOPPED){this.fragmentLoader.abort(),this.initFragmentLoader.abort(),this.keyLoader.abort(this.playlistType);var e=this.fragCurrent;null!=e&&e.loader&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=In.STOPPED}},r.pauseBuffering=function(){this.buffering=!1},r.resumeBuffering=function(){this.buffering=!0},r._streamEnded=function(e,t){if(t.live||!this.media)return!1;var r=e.end||0,i=this.config.timelineOffset||0;if(r<=i)return!1;var n=e.buffered;this.config.maxBufferHole&&n&&n.length>1&&(e=oi.bufferedInfo(n,e.start,0));var a=e.nextStart;if(a&&a>i&&a<t.edge)return!1;if(this.media.currentTime<e.start)return!1;var s=t.partList;if(null!=s&&s.length){var o=s[s.length-1];return oi.isBuffered(this.media,o.start+o.duration/2)}var l=t.fragments[t.fragments.length-1];return this.fragmentTracker.isEndListAppended(l.type)},r.getLevelDetails=function(){if(this.levels&&null!==this.levelLastLoaded)return this.levelLastLoaded.details},r.onMediaAttached=function(e,t){var r=this.media=this.mediaBuffer=t.media;wn(r,"seeking",this.onMediaSeeking),wn(r,"ended",this.onMediaEnded);var i=this.config;this.levels&&i.autoStartLoad&&this.state===In.STOPPED&&this.startLoad(i.startPosition)},r.onMediaDetaching=function(e,t){this.fragPlaying=null;var r=!!t.transferMedia,i=this.media;if(null!==i){if(i.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),An(i,"seeking",this.onMediaSeeking),An(i,"ended",this.onMediaEnded),this.media=this.mediaBuffer=null,this.loopSn=void 0,r)return this.resetLoadingState(),void this.resetTransmuxer();this.loadingParts=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()}},r.onManifestLoading=function(){this.initPTS=[],this.fragPlaying=this.levels=this.levelLastLoaded=this.fragCurrent=null,this.lastCurrentTime=0,this.startPosition=-1,this.startFragRequested=!1},r.onError=function(e,t){},r.onManifestLoaded=function(e,t){this.startTimeOffset=t.startTimeOffset},r.onHandlerDestroying=function(){this.stopLoad(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),e.prototype.onHandlerDestroying.call(this),this.hls=this.onMediaSeeking=this.onMediaEnded=null},r.onHandlerDestroyed=function(){this.state=In.STOPPED,this.fragmentLoader&&this.fragmentLoader.destroy(),this.initFragmentLoader&&this.initFragmentLoader.destroy(),this.keyLoader&&this.keyLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.decrypter=this.keyLoader=null,this.fragmentLoader=this.initFragmentLoader=this.fragmentTracker=null,e.prototype.onHandlerDestroyed.call(this)},r.loadFragment=function(e,t,r){this.startFragRequested=!0,this._loadFragForPlayback(e,t,r)},r._loadFragForPlayback=function(e,t,r){var i=this;this._doFragLoad(e,t,r,(function(e){var t=e.frag;if(i.fragContextChanged(t))return i.warn(t.type+" sn: "+t.sn+(e.part?" part: "+e.part.index:"")+" of "+i.fragInfo(t,!1,e.part)+" was dropped during download."),void i.fragmentTracker.removeFragment(t);var r=++t.stats.chunkCount;i.log("load progress "+t.type+" sn: "+t.sn+(e.part?" part: "+e.part.index:"")+" of "+i.fragInfo(t,!1,e.part)+" chunk: "+r),i._handleFragmentLoadProgress(e)})).then((function(e){if(e){var t=i.state,r=e.frag;i.fragContextChanged(r)?(t===In.FRAG_LOADING||!i.fragCurrent&&t===In.PARSING)&&(i.fragmentTracker.removeFragment(r),i.state=In.IDLE):("payload"in e&&(i.log("Loaded "+r.type+" sn: "+r.sn+" of "+i.playlistLabel()+" "+r.level
vendor: 6,054 bytes, line 2
2+" (bytes "+r.stats.loaded+")"),i.hls.trigger(G.FRAG_LOADED,e)),i._handleFragmentLoadComplete(e))}})).catch((function(t){i.state!==In.STOPPED&&i.state!==In.ERROR&&(i.log("Frag error "+e.type+" sn:"+e.sn+" cc:"+e.cc+": "+((null==t?void 0:t.message)||t)),i.resetFragmentLoading(e))}))},r.clearTrackerIfNeeded=function(e){var t,r=this.fragmentTracker;if(r.getState(e)===Br){var i=e.type,n=this.getFwdBufferInfo(this.mediaBuffer,i),a=Math.max(e.duration,n?n.len:this.config.maxBufferLength),s=this.backtrackFragment;(1==(s?e.sn-s.sn:0)||this.reduceMaxBufferLength(a,e.duration))&&r.removeFragment(e)}else 0===(null==(t=this.mediaBuffer)?void 0:t.buffered.length)?r.removeAllFragments():r.hasParts(e.type)&&(r.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),r.getState(e)===$r&&r.removeFragment(e))},r.checkLiveUpdate=function(e){if(e.updated&&!e.live){var t=this.fragmentTracker,r=e.fragments[e.fragments.length-1];if(r.endList&&!t.isEndListAppended(this.playlistType)){var i=t.getPartialFragment(r.end);i&&(t.removeFragment(i),t.fragBuffered(r,!0))}t.detectPartialFragments({frag:r,part:null,stats:r.stats,id:r.type})}e.fragments[0]||(e.deltaUpdateFailed=!0)},r.waitForLive=function(e){var t=e.details;return(null==t?void 0:t.live)&&"EVENT"!==t.type&&(this.levelLastLoaded!==e||t.expired)},r.flushMainBuffer=function(e,t,r){if(void 0===r&&(r=null),e-t){var i={startOffset:e,endOffset:t,type:r};this.hls.trigger(G.BUFFER_FLUSHING,i)}},r._loadInitSegment=function(e){var t=this,r=this.hls;return this.initFragmentLoader.abort(),r.trigger(G.FRAG_LOADING,{frag:e,targetBufferTime:0}),this.initFragmentLoader.load(e).then((function(e){var r,i=e.frag;if(!t.levels||!z(i,null==(r=t.fragCurrent)?void 0:r.initSegment))throw new ii({type:B.NETWORK_ERROR,details:$.INTERNAL_ABORTED,error:new Error("init load aborted"),fatal:!1,frag:i,networkDetails:null});return e})).then((function(e){var i=e.frag,n=e.payload,a=i.decryptdata;if(n&&n.byteLength>0&&null!=a&&a.key&&a.iv&&Ti(a.method)){var s=self.performance.now(),o=ti(i,null,t.iframesOnly).decryptRange;return t.decrypter.decrypt(new Uint8Array(n),a.key.buffer,a.iv.buffer,Si(a.method),o).catch((function(e){throw r.trigger(G.ERROR,{type:B.MEDIA_ERROR,details:$.FRAG_DECRYPT_ERROR,fatal:!1,error:e,reason:e.message,frag:i}),t.fragmentLoader.abort(),e})).then((function(n){var a=self.performance.now();return r.trigger(G.FRAG_DECRYPTED,{frag:i,part:null,payload:n,stats:{tstart:s,tdecrypt:a}}),e.payload=n,t.completeInitSegmentLoad(e)}))}return t.completeInitSegmentLoad(e)}))},r.completeInitSegmentLoad=function(e){var t=e.frag.stats;e.frag.data=new Uint8Array(e.payload),t.parsing.start=t.buffering.start=self.performance.now(),t.parsing.end=t.buffering.end=self.performance.now()},r.loadInitSegmentIfNeeded=function(e){var t,r=this,i=e.initSegment;if(!this.bitrateTest&&W(e)&&i&&!i.data)return(!i.encrypted||null!=(t=i.decryptdata)&&t.key?this._loadInitSegment(i):this.keyLoader.load(i).then((function(){return r._loadInitSegment(i)}))).catch((function(t){if(r.state===In.STOPPED||r.state===In.ERROR)throw t;throw"data"in t&&(t.data.frag=e,r.fragmentLoader.abort(),r.handleFragLoadError(t)),r.resetFragmentLoading(e),t}))},r.unhandledEncryptionError=function(e,t){var r,i,n=e.tracks;if(n&&!t.encrypted&&(null!=(r=n.audio)&&r.encrypted||null!=(i=n.video)&&i.encrypted)&&(!this.config.emeEnabled||!this.keyLoader.emeController)){var a=this.media,s=new Error("Encrypted track with no key in "+this.fragInfo(t)+" (media "+(a?"attached mediaKeys: "+a.mediaKeys:"detached")+")");return this.warn(s.message),!(!a||a.mediaKeys)&&(this.hls.trigger(G.ERROR,{type:B.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_NO_KEYS,fatal:!1,error:s,frag:t}),this.resetTransmuxer(),!0)}return!1},r.fragContextChanged=function(e){var t=this.fragCurrent;return!e||!z(e,t)},r.fragBufferedComplete=function(e,t){var r=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log("Buffered "+e.type+" sn: "+e.sn+(t?" part: "+t.index:"")+" of "+this.fragInfo(e,!1,t)+" > buffer:"+(r?Ln(oi.getBuffered(r)):"(detached)")+")"),W(e)){var i;if(e.type!==K.SUBTITLE){var n=e.elementaryStreams;if(!Object.keys(n).some((function(e){return!!n[e]})))return void(this.state=In.IDLE)}var a=null==(i=this.levels)?void 0:i[e.level];null!=a&&a.fragmentError&&(t||this.fragmentTracker.getState(e)!==$r)&&(this.log("Resetting level fragment error count of "+a.fragmentError+" on frag buffered"),a.fragmentError=0,e.stats.retry=0)}this.state=In.IDLE},r._handleFragmentLoadComplete=function(e){var t=this.transmuxer;if(t){var r=e.frag,i=e.part,n=e.partsLoaded,a=!n||0===n.length||n.some((function(e){return!e})),s=ti(r,i).decryptRange,o=new ai(r.level,r.sn,r.stats.chunkCount+1,0,i?i.index:-1,!a,r.duration,this.iframesOnly,s);this.log("load complete "+r.type+" sn: "+r.sn+(i?" part: "+i.index:"")+" of "+this.fragInfo(r,!1,i)),t.flush(o)}},r._handleFragmentLoadProgress=function(e){},r.loadKeyFor=function(e,t,r){var i,n=this,a=null;return!e.encrypted||null!=(i=e.decryptdata)&&i.key?e.encrypted||(a=this.keyLoader.loadClear(e,t.encryptedFragments,this.startFragRequested))&&this.log("[eme] blocking frag sn: "+e.sn+" load until media-keys acquired"):(this.log("Loading key for "+e.sn+" of ["+t.startSN+"-"+t.endSN+"], "+this.playlistLabel()+" "+e.level),this.state=In.KEY_LOADING,a=this.keyLoader.load(e,r).then((function(e){if(!n.fragContextChanged(e.frag))return n.hls.trigger(G.KEY_LOADED,e),n.state===In.KEY_LOADING&&(n.state=In.IDLE),e})),this.hls.trigger(G.KEY_LOADING,{frag:e})),a},r._doFragLoad=function(e,t,r,i){var n=this;void 0===r&&(r=null),this.fragCurrent=e;var a=t.details;if(!this.levels||!a)throw new Error("frag load aborted, missing level"+(a?"":" detail")+"s");var s,o=this.fragPrevious;if(!Y(e,o)){var l=this.shouldLoadParts(t.details,e.end);l!==this.loadingParts&&(this.log("LL-Part loading "+(l?"ON":"OFF")+" loading sn "+(null==o?void 0:o.sn)+"->"+e.sn),this.loadingParts=l)}if(r=Math.max(e.start,r||0),this.loadingParts){var u=a.partList;if(u&&i){r>a.fragmentEnd&&a.fragmentHint&&(e=a.fragmentHint);var d=this.getNextPart(u,e,r);
vendor: 6,022 bytes, line 2
2if(d>-1){var c=u[d];if(!Y(e=this.fragCurrent=c.fragment,o)&&!this.shouldLoadParts(t.details,e.end))return this.log("LL-Part loading OFF @"+this.playhead+" next part: "+this.fragInfo(e,!1,c)),this.loadingParts=!1,Promise.resolve(null);if(!this.filterReplacedPrimary(c,t.details))return Promise.resolve(null);var h,f=this.loadKeyFor(e,a);if(this.fragContextChanged(e))return Promise.resolve(null);this.log("Loading "+e.type+" sn: "+e.sn+" part: "+c.index+" ("+d+"/"+(u.length-1)+") of "+this.fragInfo(e,!1,c)+" cc: "+e.cc+" ["+a.startSN+"-"+a.endSN+"], target: "+r+(c.byteRange.length?" range:"+c.byteRange.join("-"):"")),this.nextLoadPosition=c.start+c.duration,this.state=In.FRAG_LOADING;var g=this.loadInitSegmentIfNeeded(e);if(f||g){var v=!!f;h=Promise.all([f,g]).then((function(r){var a=r[0];return!v||a&&!n.fragContextChanged(a.frag)?n.doFragPartsLoad(e,c,t,i):null})).catch((function(e){return n.handleFragLoadError(e)}))}else h=this.doFragPartsLoad(e,c,t,i).catch((function(e){return n.handleFragLoadError(e)}));return this.hls.trigger(G.FRAG_LOADING,{frag:e,part:c,targetBufferTime:r}),null===this.fragCurrent?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):h}if(!e.url||this.loadedEndOfParts(u,r))return Promise.resolve(null)}}if(this.loadingParts)this.log("LL-Part loading OFF after next part miss @"+r+" Check buffer at sn: "+e.sn+" loaded parts: "+(null==(s=a.partList)?void 0:s.filter((function(e){return e.loaded})).map((function(e){return"["+e.start+"-"+e.end+"]"})))),this.loadingParts=!1;else if(!e.url)return Promise.resolve(null);if(!this.filterReplacedPrimary(e,t.details))return Promise.resolve(null);var p,m=this.loadInitSegmentIfNeeded(e),y=this.loadKeyFor(e,a,m);if(this.fragContextChanged(e))return this.log("Context changed in KEY_LOADING sn: "+e.sn+" "+e.relurl+" > "+(null==(p=this.fragCurrent)?void 0:p.relurl)),null==m||m.catch((function(){return null})),null==y||y.catch((function(){return null})),Promise.resolve(null);this.log("Loading "+e.type+" sn: "+e.sn+" of "+this.fragInfo(e,!1)+" cc: "+e.cc+" ["+a.startSN+"-"+a.endSN+"], target: "+r+(e.byteRange.length?" range:"+e.byteRange.join("-"):"")),F(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=In.FRAG_LOADING;var E,b=this.config.progressive&&e.type!==K.SUBTITLE;return E=b&&y?y.then((function(t){return!t||n.fragContextChanged(t.frag)?null:n.fragmentLoader.load(e,n.iframesOnly,i,m)})).catch((function(e){return n.handleFragLoadError(e)})):Promise.all([this.fragmentLoader.load(e,this.iframesOnly,b?i:void 0,b?m:void 0),y,m]).then((function(e){var t=e[0];return!b&&i&&i(t),t})).catch((function(e){return n.handleFragLoadError(e)})),this.hls.trigger(G.FRAG_LOADING,{frag:e,targetBufferTime:r}),null===this.fragCurrent?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):Promise.all([E,m]).then((function(e){return e[0]}))},r.doFragPartsLoad=function(e,t,r,i){var n=this;return new Promise((function(a,s){var o,l=[],u=null==(o=r.details)?void 0:o.partList,d=function(t){n.fragmentLoader.loadPart(e,t,i).then((function(i){l[t.index]=i;var s=i.part;n.hls.trigger(G.FRAG_LOADED,i);var o=gn(r.details,e.sn,t.index+1)||vn(u,e.sn,t.index+1);if(!o)return a({frag:e,part:s,partsLoaded:l});d(o)})).catch(s)};d(t)}))},r.handleFragLoadError=function(e){if("data"in e){var t=e.data;t.frag&&t.details===$.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):t.frag&&t.type===B.KEY_SYSTEM_ERROR&&!t.fatal&&(t.frag.abortRequests(),this.resetStartWhenNotLoaded(),this.resetFragmentLoading(t.frag)),this.hls.trigger(G.ERROR,t)}else this.hls.trigger(G.ERROR,{type:B.OTHER_ERROR,details:$.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null},r._handleTransmuxerFlush=function(e){var t=this.getCurrentContext(e);if(t&&this.state===In.PARSING){var r=t.frag,i=t.part,n=t.level,a=self.performance.now();r.stats.parsing.end=a,i&&(i.stats.parsing.end=a);var s=this.getLevelDetails(),o=s&&r.sn>s.endSN||this.shouldLoadParts(s,r.end);o!==this.loadingParts&&(this.log("LL-Part loading "+(o?"ON":"OFF")+" after parsing segment ending @"+r.end),this.loadingParts=o),this.updateLevelTiming(r,i,n,e)}else this.fragCurrent||this.state===In.STOPPED||this.state===In.ERROR||(this.state=In.IDLE)},r.shouldLoadParts=function(e,t){if(this.config.lowLatencyMode){if(!e)return this.loadingParts;if(e.partList&&!this.iframesOnly){var r,i=e.partList[0];if(t>=i.end+((null==(r=e.fragmentHint)?void 0:r.duration)||0)&&this.playhead>i.start-i.fragment.duration)return!0}}return!1},r.getCurrentContext=function(e){var t=this.levels,r=this.fragCurrent,i=e.level,n=e.sn,a=e.part;if(null==t||!t[i])return this.warn("Levels object was unset while buffering fragment "+n+" of "+this.playlistLabel()+" "+i+". The current chunk will not be buffered."),null;var s=t[i],o=s.details,l=a>-1?gn(o,n,a):null,u=l?l.fragment:fn(o,n,r);return u?(r&&r!==u&&(u.stats=r.stats),{frag:u,part:l,level:s}):null},r.bufferFragmentData=function(e,t,r,i,n){if(this.state===In.PARSING){W(t)&&!this.fragContextChanged(t)&&(this.fragPrevious=t);var a=e.data1,s=e.data2,o=a;if(s&&(o=ht(a,s)),o.length){var l=this.initPTS[t.cc],u=l?-l.baseTime/l.timescale:void 0,d={type:e.type,frag:t,part:r,chunkMeta:i,offset:u,parent:t.type,data:o};if(this.hls.trigger(G.BUFFER_APPENDING,d),e.dropped&&e.independent&&!r){if(n)return;this.flushBufferGap(t)}}}},r.flushBufferGap=function(e){var t=this.media;if(t)if(oi.isBuffered(t,t.currentTime)){var r=t.currentTime,i=oi.bufferInfo(t,r,0),n=e.duration,a=Math.min(2*this.config.maxFragLookUpTolerance,.25*n),s=Math.max(Math.min(e.start-a,i.end-a),r+a);e.start-s>a&&this.flushMainBuffer(s,e.start)}else this.flushMainBuffer(0,e.start)},r.getFwdBufferInfo=function(e,t){var r,i=this.playhead,n=this.lastCurrentTime>i||null!=(r=this.media)&&r.paused?0:this.config.maxBufferHole;return this.getFwdBufferInfoAtPos(e,i,t,n)},r.getFwdBufferInfoAtPos=function(e,t,r,i){var n=oi.bufferInfo(e,t,i);if(0===n.len&&void 0!==n.nextStart){var a=this.fragmentTracker.getBufferedFrag(t,r);
vendor: 5,108 bytes, line 2
2if(a&&(n.nextStart<=a.end||a.gap)){var s=Math.max(Math.min(n.nextStart,a.end)-t,i);return oi.bufferInfo(e,t,s)}}return n},r.getMaxBufferLength=function(e){var t,r=this.config;return t=e?Math.max(8*r.maxBufferSize/e,r.maxBufferLength):r.maxBufferLength,Math.min(t,r.maxMaxBufferLength)},r.exceedsMaxBuffer=function(e,t,r){var i=e.nextStart;if(i&&r.start>i){var n=e.buffered;if(n){for(var a=e.len,s=e.bufferedIndex,o=n.length-1;o>s;o--)n[o].start<r.start&&(a+=n[o].end-n[o].start);return a>=t}}return!1},r.reduceMaxBufferLength=function(e,t){var r=this.config,i=Math.max(Math.min(e-t,r.maxBufferLength),t/2),n=Math.max(e-3*t,r.maxMaxBufferLength/2,i);return n>=i&&(r.maxMaxBufferLength=n,this.warn("Reduce max buffer length to "+n+"s"),!0)},r.getAppendedFrag=function(e){var t=this.fragmentTracker?this.fragmentTracker.getAppendedFrag(e,this.playlistType):null;return t&&"fragment"in t?t.fragment:t},r.getNextFragment=function(e,t){var r=t.fragments,i=r.length;if(!i)return null;var n=this.config,a=t.fragmentStart,s=n.lowLatencyMode&&!!t.partList,o=null;if(t.live){var l=n.initialLiveManifestSize;if(i<l)return this.warn("Not enough fragments to start playback (have: "+i+", need: "+l+")"),null;if(this.startFragRequested||!s||this.loadingParts||(this.log("LL-Part loading ON for initial live fragment"),this.loadingParts=!0),!t.PTSKnown&&!this.startFragRequested&&-1===this.startPosition||e<a){var u;o=this.getInitialLiveFragment(t);var d,c,h=this.config.startPosition,f=this.hls.startPosition,g=this.hls.liveSyncPosition,v=(null==(u=o)?void 0:u.start)||0;if(-1!==f&&f>=a?(d=f,c=f===h?"config":"next load start"):g?(d=g,c="live edge"):(d=e,c="buffer pos"),d<v&&(d=v,c="live frag start"),d<a&&(d=a,c="playlist start"),this.startPosition!=d||this.nextLoadPosition!=d){var p=t.live&&!this.filterReplacedPrimary(o,t)?-1:d;this.log("Setting startPosition to "+p+" next load "+d+" "+(-1===f?"":"(from "+h+") ")+"based on "+c+". live edge: "+g+" live frag start: "+v+" playlist start: "+a+" buffer pos: "+e),this.startPosition=p,this.nextLoadPosition=d}}}else e<=a&&(o=r[0]);if(!o){var m=this.loadingParts?t.partEnd:t.fragmentEnd;o=this.getFragmentAtPosition(e,m,t)}var y=this.filterReplacedPrimary(o,t);return!y&&o&&(y=wr(t,o.sn))&&(this.nextLoadPosition=y.start),y},r.isLoopLoading=function(e,t){if(this.nextLoadPosition<=t)return!1;var r=this.fragmentTracker.getState(e);if(r===Gr)return!0;if(r===$r){if(e.gap)return!0;if(e.stats.retry>1)return!0}return!1},r.getNextFragmentLoopLoading=function(e,t,r,i,n){var a=null;if(e.gap&&(a=this.getNextFragment(this.nextLoadPosition,t))&&!a.gap&&r.nextStart){var s=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,r.nextStart,i,0);if(null!==s&&r.len+s.len>=n){var o=a.sn;return this.loopSn!==o&&(this.log('buffer full after gaps in "'+i+'" playlist starting at sn: '+o),this.loopSn=o),null}}return this.loopSn=void 0,a},r.filterReplacedPrimary=function(e,t){if(!e)return e;if(Dn(this.config)&&("type"in e?e:e.fragment).type!==K.SUBTITLE){var r=this.hls.interstitialsManager,i=null==r?void 0:r.bufferingItem;if(i){var n=i.event;if(n){if(!n.appendInPlace&&(Math.abs(e.start-i.start)>1||0===i.start))return null}else{if(e.end<=i.start&&!1===(null==t?void 0:t.live))return null;if(e.start>=i.end&&i.nextEvent&&(i.nextEvent.appendInPlace&&!i.nextEvent.hasPlayed||e.start-i.end>1))return null}}if(Rn(e,null==r?void 0:r.playerQueue,this.playhead))return null}return e},r.getNextPart=function(e,t,r){for(var i=-1,n=!1,a=!0,s=0,o=e.length;s<o;s++){var l=e[s];if(a=a&&!l.independent,i>-1&&r<l.start)break;var u=l.loaded||l.gap;u?i=-1:(n||(l.independent||a)&&l.fragment===t)&&(i=s),n=u&&!l.gap}var d=e[i];return d&&d.fragment!==t&&this.log("Need buffer at "+r+" but next unloaded part starts at "+d.start+" (sn: "+t.sn+" -> "+d.fragment.sn+")"),i},r.loadedEndOfParts=function(e,t){for(var r,i=e.length;i--;){if(!(r=e[i]).loaded)return!1;if(t>r.start)return!0}return!1},r.getInitialLiveFragment=function(e){var t=e.fragments,r=this.fragPrevious,i=null;if(r){if(e.hasProgramDateTime&&(i=function(e,t,r){if(null===t||!Array.isArray(e)||!e.length||!F(t))return null;if(t<(e[0].programDateTime||0))return null;if(t>=(e[e.length-1].endProgramDateTime||0))return null;for(var i=0;i<e.length;++i){var n=e[i];if(Tr(t,r,n))return n}return null}(t,r.endProgramDateTime,this.config.maxFragLookUpTolerance),i&&this.log("Live playlist, switching playlist, load frag with same PDT: "+r.programDateTime)),!i){var n=r.sn+1;if(n>=e.startSN&&n<=e.endSN){var a=t[n-e.startSN];r.cc===a.cc&&(i=a,this.log("Live playlist, switching playlist, load frag with next SN: "+i.sn))}i||(i=Sr(e,r.cc,r.end))&&this.log("Live playlist, switching playlist, load frag with same CC: "+i.sn)}}else{var s=this.hls.liveSyncPosition;null!==s&&(i=this.getFragmentAtPosition(s,this.bitrateTest?e.fragmentEnd:e.edge,e))}return i},r.getFragmentAtPosition=function(e,t,r){var i,n,a=this.config,s=this.fragPrevious,o=r.fragments,l=r.endSN,u=r.fragmentHint,d=a.maxFragLookUpTolerance,c=r.partList,h=!!(this.loadingParts&&null!=c&&c.length&&u);if(h&&!this.bitrateTest&&c[c.length-1].fragment.sn===u.sn&&(o=o.c
vendor: 7,705 bytes, line 2
2oncat(u),l=u.sn),s&&this.fragmentTracker.getState(s)===Ur&&(s=null),i=e<t?Er(s,o,e,e<this.lastCurrentTime||e>t-d||null!=(n=this.media)&&n.paused||!this.startFragRequested?0:d):o[o.length-1]){var f=i.sn-r.startSN,g=this.fragmentTracker.getState(i);if((g===Gr||g===$r&&i.gap)&&(s=i),Y(i,s)&&(!h||c[0].fragment.sn>i.sn||!r.live)){var v=o[f+1];i=i.sn<l&&this.fragmentTracker.getState(v)!==Gr?v:null}}return i},r.alignPlaylists=function(e,t,r){var i=e.fragments.length;if(!i)return this.warn("No fragments in live playlist"),0;var n=e.fragmentStart,a=!t,s=e.alignedSliding&&F(n);if(a||!s&&!n){Sn(r,e,this);var o=e.fragmentStart;return this.log("Live playlist sliding: "+o+" start-sn: "+(t?t.startSN:"na")+"->"+e.startSN+" fragments: "+i),o}return n},r.waitForCdnTuneIn=function(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,3*e.partTarget)},r.setStartPosition=function(e,t){var r=this.startPosition;r<t&&(r=-1);var i=this.timelineOffset;if(-1===r){var n=null!==this.startTimeOffset,a=n?this.startTimeOffset:e.startTimeOffset;if(null!==a&&F(a))r=t+a,a<0&&(r+=e.edge),r=Math.min(Math.max(t,r),t+e.totalduration),this.log("Setting startPosition to "+r+" for start time offset "+a+" found in "+(n?"multivariant":"media")+" playlist"),this.startPosition=r;else if(e.live){var s=this.hls.liveSyncPosition;r=s||t,this.log("Setting startPosition to -1 to start at "+(s?"live edge":"playlist start")+" "+r),this.startPosition=-1}else this.log("setting startPosition to 0 by default"),this.startPosition=r=0;this.lastCurrentTime=r+i}this.nextLoadPosition=r+i},r.getLoadPosition=function(){var e,t=this.media,r=0;return null!=(e=this.hls)&&e.hasEnoughToStart&&t&&!this.iframesOnly?r=t.currentTime:this.nextLoadPosition>=0&&(r=this.nextLoadPosition),r},r.handleFragLoadAborted=function(e,t){this.transmuxer&&e.type===this.playlistType&&W(e)&&e.stats.aborted&&(this.log("Fragment "+e.sn+(t?" part "+t.index:"")+" of "+this.playlistLabel()+" "+e.level+" was aborted"),this.resetFragmentLoading(e))},r.resetFragmentLoading=function(e){this.fragCurrent&&(this.fragContextChanged(e)||this.state===In.FRAG_LOADING_WAITING_RETRY)||(this.state=In.IDLE)},r.onFragmentOrKeyLoadError=function(e,t){if(t.chunkMeta&&!t.frag){var r=this.getCurrentContext(t.chunkMeta);r&&(t.frag=r.frag)}var i=t.frag,n=t.part;if(i&&this.levels&&i.type===e)if(this.fragContextChanged(i)){var a;this.warn("Frag load error must match current frag to retry "+i.relurl+" > "+(null==(a=this.fragCurrent)?void 0:a.relurl))}else{var s=t.details===$.FRAG_GAP;s&&this.fragmentTracker.addAsGap(i);var o=t.errorAction;if(o){var l=o.action,u=o.flags,d=o.retryCount,c=void 0===d?0:d,h=o.retryConfig,f=!!h,g=f&&l===kr,v=f&&!o.resolved&&u&Dr,p=this.hls.latestLevelDetails,m=null==p?void 0:p.live;if(!g&&v&&W(i)&&m&&i.sn<p.endSN&&!te(t))this.resetFragmentErrors(e),n?n.gap=!0:this.treatAsGap(i),o.resolved=!0;else if((g||v)&&c<h.maxNumRetry){var y,E=se(null==(y=t.response)?void 0:y.code),b=ie(h,c);if(this.resetStartWhenNotLoaded(),this.retryDate=self.performance.now()+b,this.state=In.FRAG_LOADING_WAITING_RETRY,o.resolved=!0,E)return this.log("Waiting for connection (offline)"),this.retryDate=1/0,void(t.reason="offline");this.warn("Fragment "+i.sn+" of "+e+" "+i.level+" errored with "+t.details+", retrying loading "+(c+1)+"/"+h.maxNumRetry+" in "+b+"ms")}else if(h){if(this.resetFragmentErrors(e),!(c<h.maxNumRetry))return void this.warn(t.details+" reached or exceeded max retry ("+c+")");s||l===Ir||(o.resolved=!0)}else this.state=l===Lr?In.WAITING_LEVEL:In.ERROR;this.tickImmediate()}else this.state=In.ERROR}},r.checkRetryDate=function(){var e=self.performance.now(),t=this.retryDate,r=t===1/0;(!t||e>=t||r&&!se(0))&&(r&&this.log("Connection restored (online)"),this.resetStartWhenNotLoaded(),this.state=In.IDLE)},r.reduceLengthAndFlushBuffer=function(e){if(this.state===In.PARSING||this.state===In.PARSED){var t=e.frag,r=e.parent,i=this.getFwdBufferInfo(this.mediaBuffer,r),n=i&&i.len>.5;n&&this.reduceMaxBufferLength(i.len,(null==t?void 0:t.duration)||10);var a=!n;return a?this.warn("Buffer full error while media.currentTime ("+this.playhead+") is not buffered, flush "+r+" buffer"):i.nextStart&&t&&i.nextStart>t.start&&this.flushMainBuffer(i.nextStart,Number.POSITIVE_INFINITY,r===K.AUDIO?r:void 0),t&&(this.fragmentTracker.removeFragment(t),this.nextLoadPosition=t.start),this.resetLoadingState(),a}return!1},r.resetFragmentErrors=function(e){e===K.AUDIO&&(this.fragCurrent=null),this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.state!==In.STOPPED&&(this.state=In.IDLE)},r.afterBufferFlushed=function(e,t){if(e){var r=oi.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,r,this.playlistType),this.state===In.ENDED&&this.resetLoadingState()}},r.resetLoadingState=function(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==In.STOPPED&&(this.state=In.IDLE)},r.resetStartWhenNotLoaded=function(){if(!this.hls.hasEnoughToStart){this.startFragRequested=!1;var e=this.getLevelDetails();null!=e&&e.live?(this.log("resetting startPosition for live start"),this.startPosition=-1,this.setStartPosition(e,e.fragmentStart),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}},r.resetWhenMissingContext=function(e){this.log("Loading context changed while buffering sn "+e.sn+" of "+this.playlistLabel()+" "+(-1===e.level?"<removed>":e.level)+". This chunk will not be buffered."),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(),this.resetLoadingState()},r.removeUnbufferedFrags=function(e){void 0===e&&(e=0),this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)},r.updateLevelTiming=function(e,t,r,i){var n=this,a=r.details;if(a){if(this.log("update level timing "+e.type+" sn: "+e.sn+(t?" part: "+t.index:"")+" of "+this.fragInfo(e,!1,t)),!Object.keys(e.elementaryStreams).reduce((function(t,s){var o=e.elementaryStreams[s];if(o){var l=o.endPTS-o.startPTS;if(l<=0)return n.warn("Could not parse fragment "+e.sn+" "+s+" duration reliably ("+l+")"),t||!1;var u=i.partial?0:ln(a,e,o.startPTS,o.endPTS,o.startDTS,o.endDTS,n.iframesOnly,n);return n.hls.trigger(G.LEVEL_PTS_UPDATED,{details:a,level:r,drift:u,type:s,frag:e,start:o.startPTS,end:o.endPTS}),!0}return t}),!1)){var s,o,l,u,d=null===(null==(s=this.transmuxer)?void 0:s.error),c=null!=(null==(o=this.transmuxer)?void 0:o.error),h=(null!=(l=null==(u=this.levels)?void 0:u.length)?l:0)>1;if((0===r.fragmentError||d&&(r.fragmentError<2||e.endList)||c&&h)&&this.treatAsGap(e,r),d){var f=new Error("Found no media in "+this.playlistLabel()+" "+e.level+" "+(t?"part: "+t.index+" of ":"")+"sn: "+e.sn+" at playlist time: "+e.start+". Resetting transmuxer to fallback to playlist timing");if(this.warn(f.message),this.hls.trigger(G.ERROR,{type:B.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,fatal:!1,error:f,frag:e,reason:"Found no media in msn "+e.sn+" of "+this.playlistLabel()+' "'+r.url+'"'}),!this.hls)return;this.resetTransmuxer()}}this.state=In.PARSED,this.log("Parsed "+e.type+" sn: "+e.sn+(t?" part: "+t.index:"")+" of "+this.fragInfo(e,!1,t)),this.hls.trigger(G.FRAG_PARSED,{frag:e,part:t,chunkMeta:i})}else this.warn("level.details undefined")},r.playlistLabel=function(){return this.playlistType+" playlist"},r.fragInfo=function(e,t,r){var i,n;return void 0===t&&(t=!0),this.playlistLabel()+" "+e.level+" ("+(r?"part":"frag")+":["+(null!=(i=t&&!r?e.startPTS:(r||e).start)?i:NaN)+"-"+(null!=(n=t&&!r?e.endPTS:(r||e).end)?n:NaN)+"]"+(r&&"main"===e.type?"INDEPENDENT="+(r.independent?"YES":"NO"):"")+")"},r.treatAsGap=function(e,t){t&&t.fragmentError++,this.fragmentTracker.addAsGap(e)},r.resetTransmuxer=function(){var e;null==(e=this.transmuxer)||e.reset()}
vendor: 44,640 bytes, line 2
2,r.isFragmentNearlyDownloaded=function(e){var t,r=null==(t=e.loader)?void 0:t.stats;if(!r)return!1;var i=r.loading.first>0,n=(r.total-r.loaded)/(this.hls.bandwidthEstimate||this.hls.config.abrEwmaDefaultEstimate);return i&&n<=.15},r.recoverWorkerError=function(e){"demuxerWorker"===e.event&&(this.fragmentTracker.removeAllFragments(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),this.resetStartWhenNotLoaded(),this.resetLoadingState())},r.calculateOptimalSwitchPoint=function(e,t){var r=0,i=this.hls,n=this.media,a=this.config,s=this.levels,o=this.playlistType,l=this.getLevelDetails();if(n&&!n.paused&&s){var u,d=o===K.AUDIO?Wt(e.audioCodec,128e3):e.maxBitrate,c=1+i.ttfbEstimate/1e3,h=i.bandwidthEstimate*a.abrBandWidthUpFactor;r=c+d*(l&&(this.loadingParts?l.partTarget:l.averagetargetduration)||(null==(u=this.fragCurrent)?void 0:u.duration)||6)/h,e.details||(r+=c)}var f=this.playhead;return{fetchdelay:r,okToFlushForwardBuffer:!(null!=l&&l.live)||t.end-f>1.5*r}},r.scheduleTrackSwitch=function(e,t,r){var i=this.media,n=this.playlistType;if(i&&e){var a=r?this.getBufferedFrag(this.playhead+t):null;if(a){var s=this.followingBufferedFrag(a);if(s){var o;this.abortCurrentFrag();var l=s.maxStartPTS?s.maxStartPTS:s.start,u=s.duration,d=Math.max(a.end,l+Math.min(Math.max(u-this.config.maxFragLookUpTolerance,u*(this.couldBacktrack?.5:.125)),u*(this.couldBacktrack?.75:.25)));if(((null==(o=this.getLevelDetails())?void 0:o.fragmentStart)||0)>d)return;var c=n===K.MAIN?null:"audio";this.flushMainBuffer(d,Number.POSITIVE_INFINITY,c),this.cleanupBackBuffer()}}}},r.cleanupBackBuffer=function(){var e=this.media,t=this.playlistType;if(e){var r=this.getAppendedFrag(this.playhead);if(r&&r.start>1){var i=t===K.AUDIO;this.flushMainBuffer(0,r.start-(i?0:1),i?"audio":null)}}},r.getBufferedFrag=function(e){return this.fragmentTracker.getBufferedFrag(e,this.playlistType)},r.followingBufferedFrag=function(e){return e?this.getBufferedFrag(e.end+.5):null},r.abortCurrentFrag=function(){var e=this.fragCurrent;switch(this.fragCurrent=null,e&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.state){case In.KEY_LOADING:case In.FRAG_LOADING:case In.FRAG_LOADING_WAITING_RETRY:case In.PARSING:case In.PARSED:this.state=In.IDLE}this.nextLoadPosition=this.playhead},r.checkFragPlaying=function(){var e=this.media,t=null;if(e&&e.readyState>1&&!1===e.seeking){var r=e.currentTime;if(oi.isBuffered(e,r)?t=this.getAppendedFrag(r):oi.isBuffered(e,r+.1)&&(t=this.getAppendedFrag(r+.1)),t&&(this.backtrackFragment=void 0,!Y(t,this.fragPlaying)))return this.fragPlaying=t,!0}return!1},r.getBufferOutput=function(){return null},r.nextLevelSwitch=function(){var e=this.levels,t=this.media,r=this.hls,i=this.config,n=this.playlistType;if(null!=t&&t.readyState&&e&&r&&i){var a=this.getBufferOutput(),s=this.getFwdBufferInfo(a,n);if(!s)return;var o=e[n===K.AUDIO?r.nextAudioTrack:r.nextLoadLevel],l=this.calculateOptimalSwitchPoint(o,s),u=l.fetchdelay,d=l.okToFlushForwardBuffer;this.scheduleTrackSwitch(s,u,d)}this.tickImmediate()},i(t,[{key:"startPositionValue",get:function(){var e=this.nextLoadPosition,t=this.startPosition;if(-1===t&&e){var r=this.getLevelDetails();return null!=r&&r.live?(this.hls.liveSyncPosition||r.fragmentStart)+this.timelineOffset:e}return t}},{key:"bufferingEnabled",get:function(){return this.buffering}},{key:"backtrackFragment",get:function(){},set:function(e){}},{key:"couldBacktrack",get:function(){return!1},set:function(e){}},{key:"inFlightFrag",get:function(){return{frag:this.fragCurrent,state:this.state}}},{key:"timelineOffset",get:function(){var e,t=this.config.timelineOffset;return t?(null==(e=this.getLevelDetails())?void 0:e.appliedTimelineOffset)||t:0}},{key:"primaryPrefetch",get:function(){var e;return!(!Dn(this.config)||!(null==(e=this.hls.interstitialsManager)||null==(e=e.playingItem)?void 0:e.event))}},{key:"playhead",get:function(){var e;if(null!=(e=this.hls)&&e.hasEnoughToStart){var t,r=null==(t=this.media)?void 0:t.currentTime;return F(r)?r:this.lastCurrentTime}return this.getLoadPosition()}},{key:"iframesOnly",get:function(){var e;if(this.playlistType!==K.MAIN)return!1;var t=this.getLevelDetails();return t?t.iframesOnly:null==(e=this.levelLastLoaded)?void 0:e.iframes}},{key:"state",get:function(){return this._state},set:function(e){var t=this._state;t!==e&&(this._state=e,this.log(t+"->"+e))}}])}(ni);function Rn(e,t,r){if(t)for(var i=t.length;i--;){var n=t[i].interstitial,a=n.startTime,s=Math.min(a+n.duration,n.resumeTime);if(n.appendInPlace){if(e.start>=a&&e.end<=s)return!0;if(r>e.start&&e.end>a&&e.start<s)return!0}}return!1}function Dn(e){return!!e.interstitialsController&&!1!==e.enableInterstitialPlayback}var Cn=function(){function e(){this.chunks=[],this.dataLength=0}var t=e.prototype;return t.push=function(e){this.chunks.push(e),this.dataLength+=e.length},t.flush=function(){var e,t=this.chunks,r=this.dataLength;return t.length?(e=1===t.length?t[0]:function(e,t){for(var r=new Uint8Array(t),i=0,n=0;n<e.length;n++){var a=e[n];r.set(a,i),i+=a.length}return r}(t,r),this.reset(),e):new Uint8Array(0)},t.reset=function(){this.chunks.length=0,this.dataLength=0},e}();function Pn(e,t){return 255===e[t]&&240==(246&e[t+1])}function _n(e,t){return 1&e[t+1]?7:9}function xn(e,t){return(3&e[t+3])<<11|e[t+4]<<3|(224&e[t+5])>>>5}function On(e,t){return t+1<e.length&&Pn(e,t)}function Mn(e,t){if(On(e,t)){var r=_n(e,t);if(t+r>=e.length)return!1;var i=xn(e,t);if(i<=r)return!1;var n=t+i;return n===e.length||On(e,n)}return!1}function Fn(e,t,r,i,n){if(!e.samplerate){var a=function(e,t,r,i){var n=t[r+2],a=n>>2&15;if(!(a>12)){var s,o=1+(n>>6&3),l=t[r+3]>>6&3|(1&n)<<2,u=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350][a],d=a;5!==o&&29!==o||(d-=3);var c=(14&d)>>1,h=(1&d)<<7|l<<3,f=0;if(1===o&&a>=6){var g=a-3;s=[(f=5)<<3|c,h|(14&g)>>1,(1&g)<<7|8,0]}else s=[o<<3|c,h];var v="mp4a.40."+(f||o);return me.log("manifest codec:"+i+", parsed codec:"+v+", channels:"+l+", rate:"+u+" (ADTS object type:"+o+" sampling index:"+a+" esds config:["+s.join(",")+"])"),{config:s,samplerate:u,channelCount:l,codec:v,parsedCodec:v,manifestCodec:i}}var p=new Error("invalid ADTS sampling index:"+a);e.emit(G.ERROR,G.ERROR,{type:B.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,fatal:!0,error:p,reason:p.message})}(t,r,i,n);if(!a)return;u(e,a)}}function Nn(e){return 9216e4/e}function Un(e,t,r,i,n){var a,s=i+n*Nn(e.samplerate),o=function(e,t){var r=_n(e,t);if(t+r<=e.length){var i=xn(e,t)-r;if(i>0)return{headerLength:r,frameLength:i}}}(t,r);if(o){var l=o.frameLength,u=o.headerLength,d=u+l,c=Math.max(0,r+d-t.length);c?(a=new Uint8Array(d-u)).set(t.subarray(r+u,t.length),0):a=t.subarray(r+u,r+d);var h={unit:a,pts:s};return c||e.samples.push(h),{sample:h,length:d,missing:c}}var f=t.length-r;return(a=new Uint8Array(f)).set(t.subarray(r,t.length),0),{sample:{unit:a,pts:s},length:f,missing:-1}}var Bn=function(e){return e.audioId3="org.id3",e.dateRange="com.apple.quicktime.HLS",e.emsg="https://aomedia.org/emsg/ID3",e.misbklv="urn:misb:KLV:bin:1910.1",e}({});function $n(e,t){return void 0===e&&(e=""),void 0===t&&(t=9e4),{type:e,id:-1,pid:-1,inputTimeScale:t,sequenceNumber:-1,samples:[],dropped:0}}var Gn=function(){function e(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}var t=e.prototype;return t.resetInitSegment=function(e,t,r,i){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},t.resetTimeStamp=function(e){this.initPTS=e,this.resetContiguity()},t.resetContiguity=function(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0},t.canParse=function(e,t){return!1},t.appendFrame=function(e,t,r){},t.demux=function(e,t){this.cachedData&&(e=ht(this.cachedData,e),this.cachedData=null);var r,i=Ae(e,0),n=i?i.length:0,a=this._audioTrack,s=this._id3Track,o=i?Me(i):void 0,l=e.length;for((null===this.basePTS||0===this.frameIndex&&F(o))&&(this.basePTS=Hn(o,t,this.initPTS),this.lastPTS=this.basePTS),null===this.lastPTS&&(this.lastPTS=this.basePTS),i&&i.length>0&&s.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:Bn.audioId3,duration:Number.POSITIVE_INFINITY});n<l;){if(this.canParse(e,n)){var u=this.appendFrame(a,e,n);u?(this.frameIndex++,this.lastPTS=u.sample.pts,r=n+=u.length):n=l}else Se(e,n)?(i=Ae(e,n),s.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:Bn.audioId3,duration:Number.POSITIVE_INFINITY}),r=n+=i.length):n++;if(n===l&&r!==l){var d=e.slice(r);this.cachedData?this.cachedData=ht(this.cachedData,d):this.cachedData=d}}return{audioTrack:a,videoTrack:$n(),id3Track:s,textTrack:$n()}},t.demuxSampleAes=function(e,t,r){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},t.flush=function(e){var t=this.cachedData;return t&&(this.cachedData=null,this.demux(t,0)),{audioTrack:this._audioTrack,videoTrack:$n(),id3Track:this._id3Track,textTrack:$n()}},t.destroy=function(){this.cachedData=null,this._audioTrack=this._id3Track=void 0},e}(),Hn=function(e,t,r){return F(e)?90*e:9e4*t+(r?9e4*r.baseTime/r.timescale:0)},Vn=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],Kn=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],jn=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],qn=[0,1,1,4];function Wn(e,t,r,i,n){if(!(r+24>t.length)){var a=Yn(t,r);if(a&&r+a.frameLength<=t.length){var s=i+n*(9e4*a.samplesPerFrame/a.sampleRate),o={unit:t.subarray(r,r+a.frameLength),pts:s,dts:s};return e.config=[],e.channelCount=a.channelCount,e.samplerate=a.sampleRate,e.samples.push(o),{sample:o,length:a.frameLength,missing:0}}}}function Yn(e,t){var r=e[t+1]>>3&3,i=e[t+1]>>1&3,n=e[t+2]>>4&15,a=e[t+2]>>2&3;if(1!==r&&0!==n&&15!==n&&3!==a){var s=e[t+2]>>1&1,o=e[t+3]>>6,l=1e3*Vn[14*(3===r?3-i:3===i?3:4)+n-1],u=Kn[3*(3===r?0:2===r?1:2)+a],d=3===o?1:2,c=jn[r][i],h=qn[i],f=8*c*h,g=Math.floor(c*l/u+s)*h,v=It();return!!v&&v<=87&&2===i&&l>=224e3&&0===o&&(e[t+3]=128|e[t+3]),{sampleRate:u,channelCount:d,frameLength:g,samplesPerFrame:f}}}function zn(e,t){return 255===e[t]&&224==(224&e[t+1])&&0!=(6&e[t+1])}function Qn(e,t){return t+1<e.length&&zn(e,t)}function Xn(e,t){if(t+1<e.length&&zn(e,t)){var r=Yn(e,t),i=4;null!=r&&r.frameLength&&(i=r.frameLength);var n=t+i;return n===e.length||Qn(e,n)}return!1}var Jn=function(){function e(e,t,r){this.keyData=void 0,this.decrypter=void 0,this.keyData=r,this.decrypter=new Xr(t,!0)}var t=e.prototype;return t.decryptBuffer=function(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer,qr,{start:0,end:e.byteLength})},t.decryptAacSample=function(e,t,r){var i=this,n=e[t].unit;if(!(n.length<=16)){var a=n.subarray(16,n.length-n.length%16),s=a.buffer.slice(a.byteOffset,a.byteOffset+a.length);this.decryptBuffer(s).then((function(a){var s=new Uint8Array(a);n.set(s,16),i.decrypter.isSync()||i.decryptAacSamples(e,t+1,r)})).catch(r)}},t.decryptAacSamples=function(e,t,r){for(;;t++){if(t>=e.length)return void r();if(!(e[t].unit.length<32||(this.decryptAacSample(e,t,r),this.decrypter.isSync())))return}},t.getAvcEncryptedData=function(e){for(var t=16*Math.floor((e.length-48)/160)+16,r=new Int8Array(t),i=0,n=32;n<e.length-16;n+=160,i+=16)r.set(e.subarray(n,n+16),i);return r},t.getAvcDecryptedUnit=function(e,t){for(var r=new Uint8Array(t),i=0,n=32;n<e.length-16;n+=160,i+=16)e.set(r.subarray(i,i+16),n);return e},t.decryptAvcSample=function(e,t,r,i,n){var a=this,s=pt(n.data),o=this.getAvcEncryptedData(s);this.decryptBuffer(o.buffer).then((function(o){n.data=a.getAvcDecryptedUnit(s,o),a.decrypter.isSync()||a.decryptAvcSamples(e,t,r+1,i)})).catch(i)},t.decryptAvcSamples=function(e,t,r,i){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,r=0){if(t>=e.length)return void i();for(var n=e[t].units;!(r>=n.length);r++){var a=n[r];if(!(a.data.length<=48||1!==a.type&&5!==a.type||(this.decryptAvcSample(e,t,r,i,a),this.decrypter.isSync())))return}}},e}(),Zn=function(e){function t(t,r){var i;return(i=e.call(this)||this).observer=void 0,i.config=void 0,i.sampleAes=null,i.observer=t,i.config=r,i}c(t,e);var r=t.prototype;return r.resetInitSegment=function(t,r,i,n){e.prototype.resetInitSegment.call(this,t,r,i,n),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:r,duration:n,inputTimeScale:9e4,dropped:0}},t.probe=function(e,t){if(!e)return!1;var r=Ae(e,0),i=(null==r?void 0:r.length)||0;if(Xn(e,i))return!1;for(var n=e.length;i<n;i++)if(Mn(e,i))return t.log("ADTS sync word found !"),!0;return!1},r.canParse=function(e,t){return function(e,t){return function(e,t){return t+5<e.length}(e,t)&&Pn(e,t)&&xn(e,t)<=e.length-t}(e,t)},r.appendFrame=function(e,t,r){Fn(e,this.observer,t,r,e.manifestCodec);var i=Un(e,t,r,this.basePTS,this.frameIndex);if(0===(null==i?void 0:i.missing))return i},r.demuxSampleAes=function(e,t,r){var i=this.demux(e,r),n=this.sampleAes=new Jn(this.observer,this.config,t);return new Promise((function(e){n.decryptAacSamples(i.audioTrack.samples,0,(function(){e(i)}))}))},t}(Gn),ea=function(e,t){var r=0,i=5;t+=i;for(var n=new Uint32Array(1),a=new Uint32Array(1),s=new Uint8Array(1);i>0;){s[0]=e[t];var o=Math.min(i,8),l=8-o;a[0]=4278190080>>>24+l<<l,n[0]=(s[0]&a[0])>>l,r=r?r<<o|n[0]:n[0],t+=1,i-=o}return r},ta=function(e){function t(t){var r;return(r=e.call(this)||this).observer=void 0,r.observer=t,r}c(t,e);var r=t.prototype;return r.resetInitSegment=function(t,r,i,n){e.prototype.resetInitSegment.call(this,t,r,i,n),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:r,duration:n,inputTimeScale:9e4,dropped:0}},r.canParse=function(e,t){return t+64<e.length},r.appendFrame=function(e,t,r){var i=ra(e,t,r,this.basePTS,this.frameIndex);if(-1!==i)return{sample:e.samples[e.samples.length-1],length:i,missing:0}},t.probe=function(e){if(!e)return!1;var t=Ae(e,0);if(!t)return!1;var r=t.length;if(11===e[r]&&119===e[r+1]&&void 0!==Me(t)){if(ea(e,r)<16)return!0;throw new Error("Containerless ec-3 is not supported")}return!1},t}(Gn);function ra(e,t,r,i,n){if(r+8>t.length)return-1;if(11!==t[r]||119!==t[r+1])return-1;var a=t[r+4]>>6;if(a>=3)return-1;var s=[48e3,44100,32e3][a],o=63&t[r+4],l=2*[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920][3*o+a];if(r+l>t.length)return-1;var u=t[r+6]>>5,d=0;2===u?d+=2:(1&u&&1!==u&&(d+=2),4&u&&(d+=2));var c=(t[r+6]<<8|t[r+7])>>12-d&1,h=[2,1,2,3,3,4,4,5][u]+c,f=t[r+5]>>3,g=7&t[r+5],v=new Uint8Array([a<<6|f<<1|g>>2,(3&g)<<6|u<<3|c<<2|o>>4,o<<4&224]),p=i+n*(1536/s*9e4),m=t.subarray(r,r+l);return e.config=v,e.channelCount=h,e.samplerate=s,e.samples.push({unit:m,pts:p}),l}var ia=function(e){function t(){return e.apply(this,arguments)||this}c(t,e);var r=t.prototype;return r.resetInitSegment=function(t,r,i,n){e.prototype.resetInitSegment.call(this,t,r,i,n),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:r,duration:n,inputTimeScale:9e4,dropped:0}},t.probe=function(e){if(!e)return!1;var t=Ae(e,0),r=(null==t?void 0:t.length)||0;if(t&&11===e[r]&&119===e[r+1]&&void 0!==Me(t)&&ea(e,r)<=16)return!1;for(var i=e.length;r<i;r++)if(Xn(e,r))return me.log("MPEG Audio sync word found !"),!0;return!1},r.canParse=function(e,t){return function(e,t){return zn(e,t)&&4<=e.length-t}(e,t)},r.appendFrame=function(e,t,r){if(null!==this.basePTS)return Wn(e,t,r,this.basePTS,this.frameIndex)},t}(Gn),na=/\/emsg[-/]ID3/i,aa=function(){function e(e,t,r,i){void 0===i&&(i=me),this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.initData=void 0,this.logger=void 0,this.config=t,this.logger=i}var t=e.prototype;return t.resetTimeStamp=function(){},t.resetInitSegment=function(e,t,r,i){var n=this.videoTrack=$n("video",1),a=this.audioTrack=$n("audio",1),s=this.txtTrack=$n("text",1);if(this.id3Track=$n("id3",1),this.initData=void 0,this.timeOffset=0,null!=e&&e.byteLength){var o=this.initData=rt(e);if(o.video){var l=o.video,u=l.id,d=l.timescale,c=l.codec,h=l.supplemental;n.id=u,n.timescale=s.timescale=d,n.codec=c,n.supplemental=h}if(o.audio){var f=o.audio,g=f.id,v=f.timescale,p=f.codec;a.id=g,a.timescale=v,a.codec=p}s.id=Ve.text,n.sampleDuration=0,n.duration=a.duration=i}},t.resetContiguity=function(){this.remainderData=null},e.probe=function(e){return function(e,t){for(var r=e.byteLength,i=0;i<r;){var n=je(e,i);if(n>8&&je(e,i+4)===He[t])return!0;i=n>1?i+n:r}return!1}(e,"moof")},t.demux=function(e,t,r){this.timeOffset=t;var i=e,n=this.videoTrack,a=this.txtTrack;if(this.config.progressive){this.remainderData&&(i=ht(this.remainderData,e));var s=function(e){var t={valid:null,remainder:null},r=Ze(e,["moof"]);if(r.length<2)return t.remainder=e,t;var i=r[r.length-1];return t.valid=e.slice(0,i.byteOffset-8),t.remainder=e.slice(i.byteOffset-8),t}(i);this.remainderData=s.remainder,n.samples=s.valid||new Uint8Array}else n.samples=i;var o=this.extractID3Track(n,t),l=this.parseFragment(n,a,t,r);return{videoTrack:n,audioTrack:this.audioTrack,id3Track:o,textTrack:this.txtTrack,initData:this.initData,sampleData:l}},t.flush=function(e,t){var r=this.timeOffset,i=this.videoTrack,n=this.txtTrack;i.samples=this.remainderData||new Uint8Array,this.remainderData=null;var a=this.extractID3Track(i,this.timeOffset),s=this.parseFragment(i,n,r,t);return{videoTrack:i,audioTrack:$n(),id3Track:a,textTrack:$n(),initData:this.initData,sampleData:s}},t.parseFragment=function(e,t,r,i){var n=this.initData;if(n&&i){var a=function(e,t,r,i,n){void 0===n&&(n=!1);var a=[];return{samples:a,sampleData:{includeSampleDetails:n,tracks:ct(t.samples,r,i,n,{isHEVCFlavor:ft(t.codec),samples:a,timeOffset:e,timescale:t.timescale,trackId:t.id})}}}(r,e,n,this.logger,i.iframe),s=a.samples,o=a.sampleData;return t.samples=s,o}t.samples=function(e,t){var r=[],i=t.samples,n=t.timescale,a=t.id,s=!1;return Ze(i,["moof"]).map((function(o){var l=o.byteOffset-8;Ze(o,["traf"]).map((function(o){var u=Ze(o,["tfdt"]).map((function(e){var t=e[0],r=je(e,4);return 1===t&&(r*=Math.pow(2,32),r+=je(e,8)),r/n}))[0];return void 0!==u&&(e=u),Ze(o,["tfhd"]).map((function(u){var d=je(u,4),c=16777215&je(u,0),h=0!=(1&c),f=0,g=0!=(2&c),v=0!=(8&c),p=0,m=0!=(16&c),y=0,E=0!=(32&c),b=!h&&0!=(131072&c),T=8;d===a&&(h?(f=je(u,T),T+=4,f*=Math.pow(2,32),f+=je(u,T),T+=4):b&&(f=l),g&&(T+=4),v&&(p=je(u,T),T+=4),m&&(y=je(u,T),T+=4),E&&(T+=4),"video"===t.type&&(s=ft(t.codec)),Ze(o,["trun"]).map((function(a){var o=a[0],l=16777215&je(a,0),u=0!=(1&l),d=0,c=0!=(4&l),h=0!=(256&l),g=0,v=0!=(512&l),m=0,E=0!=(1024&l),b=0!=(2048&l),T=0,S=je(a,4),w=8;u&&(d=je(a,w),w+=4),c&&(w+=4);for(var A=f+d,L=0;L<S;L++){if(h?(g=je(a,w),w+=4):g=p,v?(m=je(a,w),w+=4):m=y,E&&(w+=4),b&&(T=0===o?je(a,w):Ye(a,w),w+=4),t.type===j.VIDEO)for(var I=0;I<m;){var k=je(i,A);gt(s,i[A+=4])&&vt(i.subarray(A,A+k),s?2:1,e+T/n,r),A+=k,I+=k+4}e+=g/n}})))}))}))})),r}(r,e)},t.extractID3Track=function(e,t){var r=this,i=this.id3Track;if(e.samples.length){var n=Ze(e.samples,["emsg"]);n&&n.forEach((function(e){var n=function(e){var t,r=e[0],i="",n="",a=0,s=0,o=0,l=0,u=4;if(0===r){var d=We(e,u),c=null!==d?We(e,u+d.length):null;null!==d&&null!==c?(i=d,n=c,a=je(e,u+=d.length+c.length),s=je(e,u+=4),o=je(e,u+=4),l=je(e,u+=4),u+=4):(me.warn("Unterminated "+(null===d?"scheme_id_uri":"value")+" in parsing emsg box: version 0 box ends inside a string, dropping all of its fields"),u=e.length)}else if(1===r){a=je(e,u);var h=je(e,u+=4),f=je(e,u+=4);u+=4,t=Math.pow(2,32)*h+f,N(t)||(t=Number.MAX_SAFE_INTEGER,me.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),o=je(e,u),l=je(e,u+=4);var g=We(e,u+=4),v=null!==g?We(e,u+g.length):null;null!==g&&(i=g,u+=g.length),null!==v?(n=v,u+=v.length):(me.warn("Unterminated "+(null===g?"scheme_id_uri":"value")+" in parsing emsg box: version 1 box ends inside a string, dropping its "+(null===g?"strings and payload":"value and payload")),u=e.length)}return{schemeIdUri:i,value:n,timeScale:a,presentationTime:t,presentationTimeDelta:s,eventDuration:o,id:l,payload:e.subarray(u,e.byteLength)}}(e);if(na.test(n.schemeIdUri)){var a=sa(n,t),s=4294967295===n.eventDuration?Number.POSITIVE_INFINITY:n.eventDuration/n.timeScale;s<=.001&&(s=Number.POSITIVE_INFINITY);var o=n.payload;i.samples.push({data:o,len:o.byteLength,dts:a,pts:a,type:Bn.emsg,duration:s})}else if(r.config.enableEmsgKLVMetadata){var l=r.config.emsgKLVSchemaUri||Bn.misbklv;if(n.schemeIdUri.startsWith(l)){var u=sa(n,t);i.samples.push({data:n.payload,len:n.payload.byteLength,dts:u,pts:u,type:Bn.misbklv,duration:Number.POSITIVE_INFINITY})}}}))}return i},t.demuxSampleAes=function(e,t,r){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},t.destroy=function(){this.config=null,this.remainderData=null,this.videoTrack=this.audioTrack=this.id3Track=this.txtTrack=void 0,this.initData=void 0},e}();function sa(e,t){return F(e.presentationTime)?e.presentationTime/e.timeScale:t+e.presentationTimeDelta/e.timeScale}var oa=function(){function e(){this.VideoSample=null}var t=e.prototype;return t.createVideoSample=function(e,t,r){return{key:e,frame:!1,pts:t,dts:r,units:[],length:0}},t.getLastNalUnit=function(e){var t,r,i=this.VideoSample;if(i&&0!==i.units.length||(i=e[e.length-1]),null!=(t=i)&&t.units){var n=i.units;r=n[n.length-1]}return r},t.pushAccessUnit=function(e,t){if(e.units.length&&e.frame){if(void 0===e.pts){var r=t.samples,i=r.length;if(!i)return void t.dropped++;var n=r[i-1];e.pts=n.pts,e.dts=n.dts}t.samples.push(e)}},t.parseNALu=function(e,t,r){var i=t.byteLength;if(0===i)return[];var n=e.naluState||0,a=-1===n?0:n,s=[],o=0,l=0,u=-1,d=0;for(-1===n&&(u=0,d=this.getNALuType(t,0),l=1);l<i;){var c=t.indexOf(1,l);if(-1===c)break;l=c+1;for(var h=c;h>0&&0===t[h-1];)h--;if(!(c-h+(0===h?a:0)<2)){if(u>=0)s.push({data:t.subarray(u,h),type:d});else{var f=this.getLastNalUnit(e.samples);f&&(h>0?f.data=ht(f.data,t.subarray(0,h)):a>0&&(f.data=f.data.subarray(0,f.data.byteLength-a)),f.state=0)}if(!(l<i)){o=-1,u=-1;break}u=l,d=this.getNALuType(t,l)}}if(-1!==o){for(var g=i;g>0&&0===t[g-1];)g--;o=i-g+(0===g?a:0)}if(u>=0)s.push({data:t.subarray(u),type:d,state:o});else if(0===s.length&&-1!==o){var v=this.getLastNalUnit(e.samples);v&&(v.data=ht(v.data,t),v.state=o)}return e.naluState=o,s},e}(),la=function(){function e(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}var t=e.prototype;return t.loadWord=function(){var e=this.data,t=this.bytesAvailable,r=e.byteLength-t,i=new Uint8Array(4),n=Math.min(4,t);if(0===n)throw new Error("no bytes available");i.set(e.subarray(r,r+n)),this.word=new DataView(i.buffer).getUint32(0),this.bitsAvailable=8*n,this.bytesAvailable-=n},t.skipBits=function(e){var t;e=Math.min(e,8*this.bytesAvailable+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,e-=(t=e>>3)<<3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)},t.readBits=function(e){var t=Math.min(this.bitsAvailable,e),r=this.word>>>32-t;if(e>32&&me.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0)this.word<<=t;else{if(!(this.bytesAvailable>0))throw new Error("no bits available");this.loadWord()}return(t=e-t)>0&&this.bitsAvailable?r<<t|this.readBits(t):r},t.skipLZ=function(){var e;for(e=0;e<this.bitsAvailable;++e)if(0!=(this.word&2147483648>>>e))return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()},t.skipUEG=function(){this.skipBits(1+this.skipLZ())},t.skipEG=function(){this.skipBits(1+this.skipLZ())},t.readUEG=function(){var e=this.skipLZ();return this.readBits(e+1)-1},t.readEG=function(){var e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)},t.readBoolean=function(){return 1===this.readBits(1)},t.readUByte=function(){return this.readBits(8)},e}(),ua=function(e){function t(){return e.apply(this,arguments)||this}c(t,e);var r=t.prototype;return r.parsePES=function(e,t,r,i,n){var a,s=this,o=n.iframe,l=this.parseNALu(e,r.data,i),u=this.VideoSample,d=!1;r.data=null,u&&l.length&&!e.audFound&&(this.pushAccessUnit(u,e),u=this.VideoSample=this.createVideoSample(!1,r.pts,r.dts)),l.forEach((function(i){var n,l;switch(i.type){case 1:if(o)break;var c=!1;a=!0;var h,f=i.data;if(d&&f.length>4){var g=s.readSliceType(f);2!==g&&4!==g&&7!==g&&9!==g||(c=!0)}c&&null!=(h=u)&&h.frame&&!u.key&&(s.pushAccessUnit(u,e),u=s.VideoSample=null),u||(u=s.VideoSample=s.createVideoSample(!0,r.pts,r.dts)),u.frame=!0,u.key=c;break;case 5:a=!0,null!=(n=u)&&n.frame&&!u.key&&(s.pushAccessUnit(u,e),u=s.VideoSample=null),u||(u=s.VideoSample=s.createVideoSample(!0,r.pts,r.dts)),u.key=!0,u.frame=!0;break;case 6:if(o)break;a=!0,vt(i.data,1,r.pts,t.samples);break;case 7:var v,p;a=!0,d=!0;var m=i.data,y=s.readSPS(m);if(!e.sps||e.width!==y.width||e.height!==y.height||(null==(v=e.pixelRatio)?void 0:v[0])!==y.pixelRatio[0]||(null==(p=e.pixelRatio)?void 0:p[1])!==y.pixelRatio[1]){e.width=y.width,e.height=y.height,e.pixelRatio=y.pixelRatio,e.sps=[m];for(var E=m.subarray(1,4),b="avc1.",T=0;T<3;T++){var S=E[T].toString(16);S.length<2&&(S="0"+S),b+=S}e.codec=b}break;case 8:a=!0,e.pps=[i.data];break;case 9:a=!0,e.audFound=!0,null!=(l=u)&&l.frame&&(s.pushAccessUnit(u,e),u=null),u||(u=s.VideoSample=s.createVideoSample(!1,r.pts,r.dts));break;case 12:a=!0;break;default:a=!1}u&&a&&u.units.push(i)})),i&&u&&(this.pushAccessUnit(u,e),this.VideoSample=null)},r.getNALuType=function(e,t){return 31&e[t]},r.readSliceType=function(e){var t=new la(e);return t.readUByte(),t.readUEG(),t.readUEG()},r.skipScalingList=function(e,t){for(var r=8,i=8,n=0;n<e;n++)0!==i&&(i=(r+t.readEG()+256)%256),r=0===i?r:i},r.readSPS=function(e){var t,r,i,n=new la(e),a=0,s=0,o=0,l=0,u=n.readUByte.bind(n),d=n.readBits.bind(n),c=n.readUEG.bind(n),h=n.readBoolean.bind(n),f=n.skipBits.bind(n),g=n.skipEG.bind(n),v=n.skipUEG.bind(n),p=this.skipScalingList.bind(this);u();var m=u();if(d(5),f(3),u(),v(),100===m||110===m||122===m||244===m||44===m||83===m||86===m||118===m||128===m){var y=c();if(3===y&&f(1),v(),v(),f(1),h())for(r=3!==y?8:12,i=0;i<r;i++)h()&&p(i<6?16:64,n)}v();var E=c();if(0===E)c();else if(1===E)for(f(1),g(),g(),t=c(),i=0;i<t;i++)g();v(),f(1);var b=c(),T=c(),S=d(1);0===S&&f(1),f(1),h()&&(a=c(),s=c(),o=c(),l=c());var w=[1,1];if(h()&&h())switch(u()){case 1:w=[1,1];break;case 2:w=[12,11];break;case 3:w=[10,11];break;case 4:w=[16,11];break;case 5:w=[40,33];break;case 6:w=[24,11];break;case 7:w=[20,11];break;case 8:w=[32,11];break;case 9:w=[80,33];break;case 10:w=[18,11];break;case 11:w=[15,11];break;case 12:w=[64,33];break;case 13:w=[160,99];break;case 14:w=[4,3];break;case 15:w=[3,2];break;case 16:w=[2,1];break;case 255:w=[u()<<8|u(),u()<<8|u()]}return{width:Math.ceil(16*(b+1)-2*a-2*s),height:(2-S)*(T+1)*16-(S?2:4)*(o+l),pixelRatio:w}},t}(oa),da=function(e){function t(){for(var t,r=arguments.length,i=new Array(r),n=0;n<r;n++)i[n]=arguments[n];return(t=e.call.apply(e,[this].concat(i))||this).initVPS=null,t}c(t,e);var r=t.prototype;return r.parsePES=function(e,t,r,i){var n,s=this,o=this.parseNALu(e,r.data,i),l=this.VideoSample,d=!1;r.data=null;var c=function(e){return l=s.VideoSample=s.createVideoSample(e,r.pts,r.dts)};o.forEach((function(i,o){var h,f;if(s.startsNewAccessUnit(l,e,i,o)){s.pushAccessUnit(l,e);var g=i.type>=16&&i.type<=23;l=c(g),d=!1}switch(i.type){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:l||(l=c(!1)),l.frame=!0,n=!0;break;case 16:case 17:case 18:case 21:case 22:case 23:var v;n=!0,d&&null!=(v=l)&&v.frame&&!l.key&&(s.pushAccessUnit(l,e),l=s.VideoSample=null),l||(l=c(!0)),l.key=!0,l.frame=!0;break;case 19:case 20:n=!0,null!=(h=l)&&h.frame&&!l.key&&(s.pushAccessUnit(l,e),l=s.VideoSample=null),l||(l=c(!0)),l.key=!0,l.frame=!0;break;case 39:n=!0,vt(i.data,2,r.pts,t.samples);break;case 32:n=!0,e.vps||("object"!==a(e.params)&&(e.params={}),e.params=u(e.params,s.readVPS(i.data)),s.initVPS=i.data),e.vps=[i.data];break;case 33:if(n=!0,d=!0,void 0===e.vps||e.vps[0]===s.initVPS||void 0===e.sps||s.matchSPS(e.sps[0],i.data)||(s.initVPS=e.vps[0],e.sps=e.pps=void 0),!e.sps){var p=s.readSPS(i.data);for(var m in e.width=p.width,e.height=p.height,e.pixelRatio=p.pixelRatio,e.codec=p.codecString,e.sps=[],"object"!==a(e.params)&&(e.params={}),p.params)e.params[m]=p.params[m]}s.pushParameterSet(e.sps,i.data,e.vps),l||(l=c(!1));break;case 34:if(n=!0,"object"===a(e.params)){if(!e.pps){e.pps=[];var y=s.readPPS(i.data);for(var E in y)e.params[E]=y[E]}s.pushParameterSet(e.pps,i.data,e.vps)}break;case 35:n=!0,e.audFound=!0,null!=(f=l)&&f.frame&&(s.pushAccessUnit(l,e),l=null),l||(l=c(!1));break;default:n=!1}l&&n&&l.units.push(i)})),i&&l&&(this.pushAccessUnit(l,e),this.VideoSample=null)},r.pushParameterSet=function(e,t,r){(r&&r[0]===this.initVPS||!r&&!e.length)&&e.push(t)},r.startsNewAccessUnit=function(e,t,r,i){if(!e)return!1;if(!t.audFound&&0===i)return!0;if(!e.frame)return!1;var n=r.type,a=r.data;return!!(n>=32&&n<=35||39===n||n>=41&&n<=44||n>=48&&n<=55)||n<=31&&a.length>2&&0!=(128&a[2])},r.getNALuType=function(e,t){return(126&e[t])>>>1},r.ebsp2rbsp=function(e){for(var t=new Uint8Array(e.byteLength),r=0,i=0;i<e.byteLength;i++)i>=2&&3===e[i]&&0===e[i-1]&&0===e[i-2]||(t[r]=e[i],r++);return new Uint8Array(t.buffer,0,r)},r.pushAccessUnit=function(t,r){e.prototype.pushAccessUnit.call(this,t,r),this.initVPS&&(this.initVPS=null)},r.readVPS=function(e){var t=new la(e);return t.readUByte(),t.readUByte(),t.readBits(4),t.skipBits(2),t.readBits(6),{numTemporalLayers:t.readBits(3)+1,temporalIdNested:t.readBoolean()}},r.readSPS=function(e){var t=new la(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.readBits(4);var r=t.readBits(3);t.readBoolean();for(var i=t.readBits(2),n=t.readBoolean(),a=t.readBits(5),s=t.readUByte(),o=t.readUByte(),l=t.readUByte(),u=t.readUByte(),d=t.readUByte(),c=t.readUByte(),h=t.readUByte(),f=t.readUByte(),g=t.readUByte(),v=t.readUByte(),p=t.readUByte(),m=[],y=[],E=0;E<r;E++)m.push(t.readBoolean()),y.push(t.readBoolean());if(r>0)for(var b=r;b<8;b++)t.readBits(2);for(var T=0;T<r;T++)m[T]&&(t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte()),y[T]&&t.readUByte();t.readUEG();var S=t.readUEG();3==S&&t.skipBits(1);var w=t.readUEG(),A=t.readUEG(),L=t.readBoolean(),I=0,k=0,R=0,D=0;L&&(I+=t.readUEG(),k+=t.readUEG(),R+=t.readUEG(),D+=t.readUEG());for(var C=t.readUEG(),P=t.readUEG(),_=t.readUEG(),x=t.readBoolean()?0:r;x<=r;x++)t.skipUEG(),t.skipUEG(),t.skipUEG();if(t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),t.readBoolean()&&t.readBoolean())for(var O=0;O<4;O++)for(var M=0;M<(3===O?2:6);M++)if(t.readBoolean()){var F=Math.min(64,1<<4+(O<<1));O>1&&t.readEG();for(var N=0;N<F;N++)t.readEG()}else t.readUEG();t.readBoolean(),t.readBoolean(),t.readBoolean()&&(t.readUByte(),t.skipUEG(),t.skipUEG(),t.readBoolean());for(var U=t.readUEG(),B=0,$=0;$<U;$++){var G=!1;if(0!==$&&(G=t.readBoolean()),G){$===U&&t.readUEG(),t.readBoolean(),t.readUEG();for(var H=0,V=0;V<=B;V++){var K=t.readBoolean(),j=!1;K||(j=t.readBoolean()),(K||j)&&H++}B=H}else{var q=t.readUEG(),W=t.readUEG();B=q+W;for(var Y=0;Y<q;Y++)t.readUEG(),t.readBoolean();for(var z=0;z<W;z++)t.readUEG(),t.readBoolean()}}if(t.readBoolean())for(var Q=t.readUEG(),X=0;X<Q;X++){for(var J=0;J<_+4;J++)t.readBits(1);t.readBits(1)}var Z=0,ee=1,te=1,re=!0,ie=1,ne=0;if(t.readBoolean(),t.readBoolean(),t.readBoolean()){if(t.readBoolean()){var ae=t.readUByte();ae>0&&ae<16?(ee=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][ae-1],te=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][ae-1]):255===ae&&(ee=t.readBits(16),te=t.readBits(16))}if(t.readBoolean()&&t.readBoolean(),t.readBoolean()&&(t.readBits(3),t.readBoolean(),t.readBoolean()&&(t.readUByte(),t.readUByte(),t.readUByte())),t.readBoolean()&&(t.readUEG(),t.readUEG()),t.readBoolean(),t.readBoolean(),t.readBoolean(),t.readBoolean()&&(t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG()),t.readBoolean()&&(ie=t.readBits(32),ne=t.readBits(32),t.readBoolean()&&t.readUEG(),t.readBoolean())){var se=t.readBoolean(),oe=t.readBoolean(),le=!1;(se||oe)&&((le=t.readBoolean())&&(t.readUByte(),t.readBits(5),t.readBoolean(),t.readBits(5)),t.readBits(4),t.readBits(4),le&&t.readBits(4),t.readBits(5),t.readBits(5),t.readBits(5));for(var ue=0;ue<=r;ue++){var de=!1;(re=t.readBoolean())||t.readBoolean()?t.readEG():de=t.readBoolean();var ce=de?1:t.readUEG()+1;if(se)for(var he=0;he<ce;he++)t.readUEG(),t.readUEG(),le&&(t.readUEG(),t.readUEG()),t.skipBits(1);if(oe)for(var fe=0;fe<ce;fe++)t.readUEG(),t.readUEG(),le&&(t.readUEG(),t.readUEG()),t.skipBits(1)}}t.readBoolean()&&(t.readBoolean(),t.readBoolean(),t.readBoolean(),Z=t.readUEG())}var ge=w,ve=A;if(L){var pe=1,me=1;1===S?pe=me=2:2==S&&(pe=2),ge=w-pe*k-pe*I,ve=A-me*D-me*R}for(var ye=i?["A","B","C"][i]:"",Ee=s<<24|o<<16|l<<8|u,be=0,Te=0;Te<32;Te++)be=(be|(Ee>>Te&1)<<31-Te)>>>0;var Se=be.toString(16);return 1===a&&"2"===Se&&(Se="6"),{codecString:"hvc1."+ye+a+"."+Se+"."+(n?"H":"L")+p+".B0",params:{general_tier_flag:n,general_profile_idc:a,general_profile_space:i,general_profile_compatibility_flags:[s,o,l,u],general_constraint_indicator_flags:[d,c,h,f,g,v],general_level_idc:p,bit_depth:C+8,bit_depth_luma_minus8:C,bit_depth_chroma_minus8:P,min_spatial_segmentation_idc:Z,chroma_format_idc:S,frame_rate:{fixed:re,fps:ne/ie}},width:ge,height:ve,pixelRatio:[ee,te]}},r.readPPS=function(e){var t=new la(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.skipUEG(),t.skipUEG(),t.skipBits(2),t.skipBits(3),t.skipBits(2),t.skipUEG(),t.skipUEG(),t.skipEG(),t.skipBits(2),t.readBoolean()&&t.skipUEG(),t.skipEG(),t.skipEG(),t.skipBits(4);var r=t.readBoolean(),i=t.readBoolean(),n=1;return i&&r?n=0:i?n=3:r&&(n=2),{parallelismType:n}},r.matchSPS=function(e,t){return Be(e).substring(3)===Be(t).substring(3)},t}(oa),ca=188,ha=function(){function e(e,t,r,i){this.logger=void 0,this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this._klvPid=-1,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.videoIntegrityChecker=null,this.observer=e,this.config=t,this.typeSupported=r,this.logger=i,this.videoParser=null}e.probe=function(t,r){var i=e.syncOffset(t);return i>0&&r.warn("MPEG2-TS detected but first sync word found @ offset "+i),-1!==i},e.syncOffset=function(e){for(var t=e.length,r=Math.min(940,t-ca)+1,i=0;i<r;){for(var n=!1,a=-1,s=0,o=i;o<t;o+=ca){if(71!==e[o]||t-o!==ca&&71!==e[o+ca]){if(s)return-1;break}if(s++,-1===a&&0!==(a=o)&&(r=Math.min(a+18612,e.length-ca)+1),n||(n=0===fa(e,o)),n&&s>1&&(0===a&&s>2||o+ca>r))return a}i++}return-1},e.createTrack=function(e,t){return{container:"video"===e||"audio"===e?"video/mp2t":void 0,type:e,id:Ve[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:"audio"===e?t:void 0}};var t=e.prototype;return t.resetInitSegment=function(t,r,i,n,a,s){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=e.createTrack("video"),this._videoTrack.duration=n,this.videoIntegrityChecker="skip"===this.config.handleMpegTsVideoIntegrityErrors?new ba(this.logger):null,this._audioTrack=e.createTrack("audio",n),this._id3Track=e.createTrack("id3"),this._txtTrack=e.createTrack("text"),this._audioTrack.segmentCodec="aac",this.videoParser=null,this.aacOverFlow=null,this.remainderData=null,this.audioCodec=r,this.videoCodec=i,t&&this.demux(t,0,s,"SAMPLE-AES"===(null==a?void 0:a.method))},t.resetTimeStamp=function(){},t.resetContiguity=function(){var e=this._audioTrack,t=this._videoTrack,r=this._id3Track;e&&(e.pesData=null),t&&(t.pesData=null),r&&(r.pesData=null),this.aacOverFlow=null,this.remainderData=null},t.demux=function(t,r,i,n,a){var s;void 0===n&&(n=!1),void 0===a&&(a=!1),n||(this.sampleAes=null);var o=this._videoTrack,l=this.videoIntegrityChecker,u=this._audioTrack,d=this._id3Track,c=this._txtTrack,h=i.iframe,f=o.pid,g=o.pesData,v=u.pid,p=d.pid,m=this._klvPid,y=u.pesData,E=d.pesData,b=null,T=null,S=this.pmtParsed,w=this._pmtId,A=t.length;if(this.remainderData&&(A=(t=ht(this.remainderData,t)).length,this.remainderData=null),A<ca&&!a)return this.remainderData=t,{audioTrack:u,videoTrack:o,id3Track:d,textTrack:c};var L=Math.max(0,e.syncOffset(t));(A-=(A-L)%ca)<t.byteLength&&!a&&(this.remainderData=new Uint8Array(t.buffer,A,t.buffer.byteLength-A));for(var I=0,k=L;k<A;k+=ca)if(71===t[k]){var R=!!(64&t[k+1]),D=fa(t,k),C=void 0;if((48&t[k+3])>>4>1){if((C=k+5+t[k+4])===k+ca)continue}else C=k+4;switch(D){case f:R&&(!g||null!=l&&l.isCorrupted||!(s=ya(g,this.logger))||(this.readyVideoParser(o.segmentCodec),null!==this.videoParser&&this.videoParser.parsePES(o,c,s,!1,i)),g={data:[],size:0},null==l||l.reset(f)),null==l||l.handlePacket(t.subarray(k)),g&&(g.data.push(t.subarray(C,k+ca)),g.size+=k+ca-C);break;case v:if(h)break;if(R){if(y&&(s=ya(y,this.logger)))switch(u.segmentCodec){case"aac":this.parseAACPES(u,s,i);break;case"mp3":this.parseMPEGPES(u,s);break;case"ac3":this.parseAC3PES(u,s)}y={data:[],size:0}}y&&(y.data.push(t.subarray(C,k+ca)),y.size+=k+ca-C);break;case p:if(h)break;R&&(E&&(s=ya(E,this.logger))&&this.parseID3PES(d,s),E={data:[],size:0}),E&&(E.data.push(t.subarray(C,k+ca)),E.size+=k+ca-C);break;case m:if(h)break;R&&(b&&(s=ya(b,this.logger))&&this.parseKlvPES(d,s),b={data:[],size:0}),b&&(b.data.push(t.subarray(C,k+ca)),b.size+=k+ca-C);break;case 0:R&&(C+=t[C]+1),w=this._pmtId=ga(t,C);break;case w:R&&(C+=t[C]+1);var P=va(t,C,this.typeSupported,n,this.observer,this.logger,this.config,i);(f=P.videoPid)>0&&(o.pid=f,o.segmentCodec=P.segmentVideoCodec),(v=P.audioPid)>0&&(u.pid=v,u.segmentCodec=P.segmentAudioCodec),(p=P.id3Pid)>0&&(d.pid=p),(m=P.klvPid)>0&&(this._klvPid=m),null===T||S||(this.logger.warn("MPEG-TS PMT found at "+k+" after unknown PID '"+T+"'. Backtracking to sync byte @"+L+" to parse all TS packets."),T=null,k=L-188),S=this.pmtParsed=!0;break;case 17:case 8191:break;default:T=D}}else I++;I>0&&pa(this.observer,new Error("Found "+I+" TS packet/s that do not start with 0x47"),i,void 0,this.logger),o.pesData=g,u.pesData=y,d.pesData=E;var _={audioTrack:u,videoTrack:o,id3Track:d,textTrack:c};return a&&this.extractRemainingSamples(_,i),_},t.flush=function(e,t){var r,i=this.remainderData;return this.remainderData=null,r=i?this.demux(i,0,t,!1,!0):{videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(r,t),this.sampleAes?this.decrypt(r,this.sampleAes):r},t.extractRemainingSamples=function(e,t){var r,i=e.audioTrack,n=e.videoTrack,a=e.id3Track,s=e.textTrack,o=n.pesData,l=i.pesData,u=a.pesData,d=this.videoIntegrityChecker;if(!o||null!=d&&d.isCorrupted||!(r=ya(o,this.logger))?n.pesData=o:(this.readyVideoParser(n.segmentCodec),null!==this.videoParser&&(this.videoParser.parsePES(n,s,r,!0,t),n.pesData=null)),l&&(r=ya(l,this.logger))){switch(i.segmentCodec){case"aac":this.parseAACPES(i,r,t);break;case"mp3":this.parseMPEGPES(i,r);break;case"ac3":this.parseAC3PES(i,r)}i.pesData=null}else null!=l&&l.size&&this.logger.log("last AAC PES packet truncated,might overlap between fragments"),i.pesData=l;u&&(r=ya(u,this.logger))?(this.parseID3PES(a,r),a.pesData=null):a.pesData=u},t.demuxSampleAes=function(e,t,r,i){var n=this.demux(e,r,i,!0,!this.config.progressive),a=this.sampleAes=new Jn(this.observer,this.config,t);return this.decrypt(n,a)},t.readyVideoParser=function(e){null===this.videoParser&&("avc"===e?this.videoParser=new ua:"hevc"===e&&(this.videoParser=new da))},t.decrypt=function(e,t){return new Promise((function(r){var i=e.audioTrack,n=e.videoTrack;i.samples&&"aac"===i.segmentCodec?t.decryptAacSamples(i.samples,0,(function(){n.samples?t.decryptAvcSamples(n.samples,0,0,(function(){r(e)})):r(e)})):n.samples&&t.decryptAvcSamples(n.samples,0,0,(function(){r(e)}))}))},t.destroy=function(){this.observer&&this.observer.removeAllListeners(),this.config=this.logger=this.observer=null,this.aacOverFlow=this.videoParser=this.remainderData=this.sampleAes=null,this._videoTrack=this._audioTrack=this._id3Track=this._txtTrack=void 0,this.videoIntegrityChecker=null},t.parseAACPES=function(e,t,r){var i,n,a,s=0,o=this.aacOverFlow,l=t.data;if(o){this.aacOverFlow=null;var u=o.missing,d=o.sample.unit.byteLength;if(-1===u)l=ht(o.sample.unit,l);else{var c=d-u;o.sample.unit.set(l.subarray(0,u),c),e.samples.push(o.sample),s=o.missing}}for(i=s,n=l.length;i<n-1&&!On(l,i);i++);if(i!==s){var h,f=i<n-1;if(h=f?"AAC PES did not start with ADTS header,offset:"+i:"No ADTS header found in AAC PES",pa(this.observer,new Error(h),r,f,this.logger),!f)return}if(Fn(e,this.observer,l,i,this.audioCodec),void 0!==t.pts)a=t.pts;else{if(!o)return void this.logger.warn("[tsdemuxer]: AAC PES unknown PTS");var g=Nn(e.samplerate);a=o.sample.pts+g}for(var v,p=0;i<n;){if(i+=(v=Un(e,l,i,a,p)).length,v.missing){this.aacOverFlow=v;break}for(p++;i<n-1&&!On(l,i);i++);}},t.parseMPEGPES=function(e,t){var r=t.data,i=r.length,n=0,a=0,s=t.pts;if(void 0!==s)for(;a<i;)if(Qn(r,a)){var o=Wn(e,r,a,s,n);if(!o)break;a+=o.length,n++}else a++;else this.logger.warn("[tsdemuxer]: MPEG PES unknown PTS")},t.parseAC3PES=function(e,t){var r=t.data,i=t.pts;if(void 0!==i)for(var n,a=r.length,s=0,o=0;o<a&&(n=ra(e,r,o,i,s++))>0;)o+=n;else this.logger.warn("[tsdemuxer]: AC3 PES unknown PTS")},t.parseID3PES=function(e,t){if(void 0!==t.pts){var r=u({},t,{type:this._videoTrack?Bn.emsg:Bn.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(r)}else this.logger.warn("[tsdemuxer]: ID3 PES unknown PTS")},t.parseKlvPES=function(e,t){var r,i=null!=(r=t.pts)?r:t.dts;if(void 0!==i){var n=t.data;if(n.length<16)this.logger.warn("[tsdemuxer]: KLV PES payload too short");else for(var a=0;a<n.length;){var s;if(a+16>n.length)break;var o=a;if((a+=16)>=n.length)break;var l=n[a];a+=1;var u=0;if(128&l){var d=127&l;if(0===d||d>4||a+d>n.length){this.logger.warn("[tsdemuxer]: Invalid KLV length encoding");break}for(var c=0;c<d;c++)u=u<<8|n[a+c];a+=d}else u=l;if(a+u>n.length){this.logger.warn("[tsdemuxer]: KLV value extends beyond PES payload");break}var h=a+u,f=n.subarray(o,h),g={data:f,len:f.byteLength,pts:i,dts:null!=(s=t.dts)?s:i,type:Bn.misbklv,duration:Number.POSITIVE_INFINITY};e.samples.push(g),a=h}}else this.logger.warn("[tsdemuxer]: KLV PES unknown PTS and DTS")},e}();function fa(e,t){return((31&e[t+1])<<8)+e[t+2]}function ga(e,t){return(31&e[t+10])<<8|e[t+11]}function va(e,t,r,i,n,a,s,o){var l={audioPid:-1,videoPid:-1,id3Pid:-1,klvPid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},u=t+3+((15&e[t+1])<<8|e[t+2])-4;for(t+=12+((15&e[t+10])<<8|e[t+11]);t<u;){var d=fa(e,t),c=(15&e[t+3])<<8|e[t+4];switch(e[t]){case 207:if(!i){ma("ADTS AAC",a);break}case 15:-1===l.audioPid&&(l.audioPid=d);break;case 21:-1===l.id3Pid&&(l.id3Pid=d);break;case 219:if(!i){ma("H.264",a);break}case 27:-1===l.videoPid&&(l.videoPid=d);break;case 3:case 4:r.mpeg||r.mp3?-1===l.audioPid&&(l.audioPid=d,l.segmentAudioCodec="mp3"):a.log("MPEG audio found, not supported in this browser");break;case 193:if(!i){ma("AC-3",a);break}case 129:r.ac3?-1===l.audioPid&&(l.audioPid=d,l.segmentAudioCodec="ac3"):a.log("AC-3 audio found, not supported in this browser");break;case 6:if(c>0)for(var h=t+5,f=c;f>2;){switch(e[h]){case 106:-1===l.audioPid&&(!0!==r.ac3?a.log("AC-3 audio found, not supported in this browser for now"):(l.audioPid=d,l.segmentAudioCodec="ac3"));break;case 5:-1===l.klvPid&&s.enableEmsgKLVMetadata&&(l.klvPid=d,a.log("KLV metadata PID found: "+d))}var g=e[h+1]+2;h+=g,f-=g}break;case 194:case 135:return pa(n,new Error("Unsupported EC-3 in M2TS found"),o,void 0,a),l;case 36:-1===l.videoPid&&(l.videoPid=d,l.segmentVideoCodec="hevc",a.log("HEVC in M2TS found"))}t+=c+5}return l}function pa(e,t,r,i,n){n.warn("parsing error: "+t.message),e.emit(G.ERROR,G.ER
vendor: 4,934 bytes, line 2
2ROR,{type:B.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,fatal:!1,levelRetry:i,chunkMeta:r,error:t,reason:t.message})}function ma(e,t){t.log(e+" with AES-128-CBC encryption found in unencrypted stream")}function ya(e,t){var r,i,n,a,s,o=0,l=e.data;if(!e||0===e.size)return null;for(;l[0].length<19&&l.length>1;)l[0]=ht(l[0],l[1]),l.splice(1,1);if(1===((r=l[0])[0]<<16)+(r[1]<<8)+r[2]){if((i=(r[4]<<8)+r[5])&&i>e.size-6)return null;var u=r[7];192&u&&(a=536870912*(14&r[9])+4194304*(255&r[10])+16384*(254&r[11])+128*(255&r[12])+(254&r[13])/2,64&u?a-(s=536870912*(14&r[14])+4194304*(255&r[15])+16384*(254&r[16])+128*(255&r[17])+(254&r[18])/2)>54e5&&(t.warn(Math.round((a-s)/9e4)+"s delta between PTS and DTS, align them"),a=s):s=a);var d=(n=r[8])+9;if(e.size<=d)return null;e.size-=d;for(var c=new Uint8Array(e.size),h=0,f=l.length;h<f;h++){var g=(r=l[h]).byteLength;if(d){if(d>g){d-=g;continue}r=r.subarray(d),g-=d,d=0}c.set(r,o),o+=g}return i&&(i-=n+3),{data:c,pts:a,dts:s,len:i}}return null}var Ea,ba=function(){function e(e){this.logger=void 0,this.pid=0,this.lastContinuityCounter=-1,this.integrityState="ok",this.logger=e}var t=e.prototype;return t.reset=function(e){this.pid=e,this.lastContinuityCounter=-1,this.integrityState="ok"},t.handlePacket=function(e){if(!(e.byteLength<4)){var t=fa(e,0);if(t===this.pid){var r=(48&e[3])>>4;if(0!==r){var i=15&e[3],n=this.lastContinuityCounter;this.lastContinuityCounter=i;var a=0!=(1&r);if(!(0!=(2&r)&&0!=e[4]&&0!=(128&e[5])||n<0)){var s=a?n+1&15:n;return i!==s?(this.logger.warn("MPEG-TS Continuity Counter check failed for PID='"+t+"', CC="+i+", Expected-CC="+s+" Last-CC="+n),void(this.integrityState="cc-failed")):0!=(128&e[1])?(this.logger.warn("MPEG-TS Packet had TEI flag set for PID='"+t+"'"),void(this.integrityState="tei-bit")):void 0}}}else this.logger.debug("Packet PID mismatch, expected "+this.pid+" got "+t)}},i(e,[{key:"isCorrupted",get:function(){return"ok"!==this.integrityState}}])}(),Ta=function(){function e(){}return e.getSilentFrame=function(e,t){if("mp4a.40.2"===e){if(1===t)return new Uint8Array([0,200,0,128,35,128]);if(2===t)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(6===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224])}else{if(1===t)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(2===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(3===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}},e}(),Sa={video:new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),audio:new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0])},wa=new Uint8Array([0,0,0,0,0,0,0,0]),Aa=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),La=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),Ia=new Uint8Array([0,0,0,0,0,0,0,0]),ka=new Uint8Array([0,0,0,0,0,0,0,1]),Ra=new Uint8Array([105,115,111,109]),Da=new Uint8Array([97,118,99,49]),Ca=new Uint8Array([0,0,0,1]),Pa=function(){function e(){}return e.box=function(e){for(var t=8,r=arguments.length,i=new Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];for(var a=i.length,s=a;a--;)t+=i[a].byteLength;var o=new Uint8Array(t);for(ze(o,0,t),ze(o,4,e),a=0,t=8;a<s;a++)o.set(i[a],t),t+=i[a].byteLength;return o},e.hdlr=function(t){return e.box(He.hdlr,Sa[t])},e.mdat=function(t){return e.box(He.mdat,t)},e.mdhd=function(t,r){r*=t;var i=Math.floor(r/(Ge+1)),n=Math.floor(r%(Ge+1));return e.box(He.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,i>>24,i>>16&255,i>>8&255,255&i,n>>24,n>>16&255,n>>8&255,255&n,85,196,0,0]))},e.mdia=function(t){return e.box(He.mdia,e.mdhd(t.timescale||0,t.duration||0),e.hdlr(t.type),e.minf(t))},e.mfhd=function(t){return e.box(He.mfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))},e.minf=function(t){return"audio"===t.type?e.box(He.minf,e.box(He.smhd,Ia),e.DINF,e.stbl(t)):e.box(He.minf,e.box(He.vmhd,La),e.DINF,e.stbl(t))},e.moof=function(t,r,i){return e.box(He.moof,e.mfhd(t),e.traf(i,r))},e.moov=function(t){for(var r=t.length,i=[];r--;)i[r]=e.trak(t[r]);return e.box.apply(null,[He.moov,e.mvhd(t[0].timescale||0,t[0].duration||0)].concat(i).c
vendor: 15,494 bytes, line 2
2oncat(e.mvex(t)))},e.mvex=function(t){for(var r=t.length,i=[];r--;)i[r]=e.trex(t[r]);return e.box.apply(null,[He.mvex].concat(i))},e.mvhd=function(t,r){r*=t;var i=Math.floor(r/(Ge+1)),n=Math.floor(r%(Ge+1)),a=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,i>>24,i>>16&255,i>>8&255,255&i,n>>24,n>>16&255,n>>8&255,255&n,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 e.box(He.mvhd,a)},e.sdtp=function(t){var r,i,n=t.samples||[],a=new Uint8Array(4+n.length);for(r=0;r<n.length;r++)i=n[r].flags,a[r+4]=i.dependsOn<<4|i.isDependedOn<<2|i.hasRedundancy;return e.box(He.sdtp,a)},e.stbl=function(t){return e.box(He.stbl,e.stsd(t),e.box(He.stts,wa),e.box(He.stsc,wa),e.box(He.stsz,Aa),e.box(He.stco,wa))},e.avc1=function(t){var r,i,n,a=[],s=[];for(r=0;r<t.sps.length;r++)n=(i=t.sps[r]).byteLength,a.push(n>>>8&255),a.push(255&n),a=a.concat(Array.prototype.slice.call(i));for(r=0;r<t.pps.length;r++)n=(i=t.pps[r]).byteLength,s.push(n>>>8&255),s.push(255&n),s=s.concat(Array.prototype.slice.call(i));var o=e.box(He.avcC,new Uint8Array([1,a[3],a[4],a[5],255,224|t.sps.length].concat(a).concat([t.pps.length]).concat(s))),l=t.width,u=t.height,d=t.pixelRatio[0],c=t.pixelRatio[1];return e.box(He.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,l>>8&255,255&l,u>>8&255,255&u,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),o,e.box(He.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),e.box(He.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,255&d,c>>24,c>>16&255,c>>8&255,255&c])))},e.esds=function(e){var t=e.config,r=t.length;return new Uint8Array([0,0,0,0,3,23+r,0,1,0,4,15+r,64,21,0,0,0,0,0,0,0,0,0,0,0,5,r].concat(t,[6,1,2]))},e.audioStsd=function(e){var t=e.samplerate||0;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount||0,0,16,0,0,0,0,t>>8&255,255&t,0,0])},e.mp4a=function(t){return e.box(He.mp4a,e.audioStsd(t),e.box(He.esds,e.esds(t)))},e.mp3=function(t){return e.box(He[".mp3"],e.audioStsd(t))},e.ac3=function(t){return e.box(He["ac-3"],e.audioStsd(t),e.box(He.dac3,t.config))},e.stsd=function(t){var r=t.segmentCodec;if("audio"===t.type){if("aac"===r)return e.box(He.stsd,ka,e.mp4a(t));if("ac3"===r&&t.config)return e.box(He.stsd,ka,e.ac3(t));if("mp3"===r&&"mp3"===t.codec)return e.box(He.stsd,ka,e.mp3(t))}else{if(!t.pps||!t.sps)throw new Error("video track missing pps or sps");if("avc"===r)return e.box(He.stsd,ka,e.avc1(t));if("hevc"===r&&t.vps)return e.box(He.stsd,ka,e.hvc1(t))}throw new Error("unsupported "+t.type+" segment codec ("+r+"/"+t.codec+")")},e.tkhd=function(t){var r=t.id,i=(t.duration||0)*(t.timescale||0),n=t.width||0,a=t.height||0,s=Math.floor(i/(Ge+1)),o=Math.floor(i%(Ge+1));return e.box(He.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,r>>24&255,r>>16&255,r>>8&255,255&r,0,0,0,0,s>>24,s>>16&255,s>>8&255,255&s,o>>24,o>>16&255,o>>8&255,255&o,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,n>>8&255,255&n,0,0,a>>8&255,255&a,0,0]))},e.traf=function(t,r){var i=e.sdtp(t),n=t.id,a=Math.floor(r/(Ge+1)),s=Math.floor(r%(Ge+1));return e.box(He.traf,e.box(He.tfhd,new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n])),e.box(He.tfdt,new Uint8Array([1,0,0,0,a>>24,a>>16&255,a>>8&255,255&a,s>>24,s>>16&255,s>>8&255,255&s])),e.trun(t,i.length+16+20+8+16+8+8),i)},e.trak=function(t){return t.duration=t.duration||4294967295,e.box(He.trak,e.tkhd(t),e.mdia(t))},e.trex=function(t){var r=t.id;return e.box(He.trex,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},e.trun=function(t,r){var i,n,a,s,o,l,u=t.samples||[],d=u.length,c=12+16*d,h=new Uint8Array(c);for(r+=8+c,h.set(["video"===t.type?1:0,0,15,1,d>>>24&255,d>>>16&255,d>>>8&255,255&d,r>>>24&255,r>>>16&255,r>>>8&255,255&r],0),i=0;i<d;i++)a=(n=u[i]).duration,s=n.size,o=n.flags,l=n.cts,h.set([a>>>24&255,a>>>16&255,a>>>8&255,255&a,s>>>24&255,s>>>16&255,s>>>8&255,255&s,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.paddingValue<<1|o.isNonSync,61440&o.degradPrio,15&o.degradPrio,l>>>24&255,l>>>16&255,l>>>8&255,255&l],12+16*i);return e.box(He.trun,h)},e.initSegment=function(t){var r=e.moov(t);return ht(e.FTYP,r)},e.hvc1=function(t){for(var r=t.params,i=[t.vps,t.sps,t.pps],n=new Uint8Array([1,r.general_profile_space<<6|(r.general_tier_flag?32:0)|r.general_profile_idc,r.general_profile_compatibility_flags[0],r.general_profile_compatibility_flags[1],r.general_profile_compatibility_flags[2],r.general_profile_compatibility_flags[3],r.general_constraint_indicator_flags[0],r.general_constraint_indicator_flags[1],r.general_constraint_indicator_flags[2],r.general_constraint_indicator_flags[3],r.general_constraint_indicator_flags[4],r.general_constraint_indicator_flags[5],r.general_level_idc,240|r.min_spatial_segmentation_idc>>8,255&r.min_spatial_segmentation_idc,252|r.parallelismType,252|r.chroma_format_idc,248|r.bit_depth_luma_minus8,248|r.bit_depth_chroma_minus8,0,parseInt(r.frame_rate.fps),3|r.temporal_id_nested<<2|r.num_temporal_layers<<3|(r.frame_rate.fixed?64:0),i.length]),a=n.length,s=0;s<i.length;s+=1){a+=3;for(var o=0;o<i[s].length;o+=1)a+=2+i[s][o].length}var l=new Uint8Array(a);l.set(n,0),a=n.length;for(var u=i.length-1,d=0;d<i.length;d+=1){l.set(new Uint8Array([32+d|(d===u?128:0),0,i[d].length]),a),a+=3;for(var c=0;c<i[d].length;c+=1)l.set(new Uint8Array([i[d][c].length>>8,255&i[d][c].length]),a),a+=2,l.set(i[d][c],a),a+=i[d][c].length}var h=e.box(He.hvcC,l),f=t.width,g=t.height,v=t.pixelRatio[0],p=t.pixelRatio[1];return e.box(He.hvc1,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,f>>8&255,255&f,g>>8&255,255&g,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),h,e.box(He.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),e.box(He.pasp,new Uint8Array([v>>24,v>>16&255,v>>8&255,255&v,p>>24,p>>16&255,p>>8&255,255&p])))},e}();Ea=Pa,Pa.FTYP=Ea.box(He.ftyp,Ra,Ca,Ra,Da),Pa.DINF=Ea.box(He.dinf,Ea.box(He.dref,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1])));var _a=9e4;function xa(e,t,r,i){void 0===r&&(r=1),void 0===i&&(i=!1);var n=e*t*r;return i?Math.round(n):n}function Oa(e,t){return xa(e,1e3,1/_a,t)}function Ma(e){var t=e.baseTime,r=e.timescale;return t/r+" ("+t+"/"+r+") trackId: "+e.trackId}var Fa=8589934592;function Na(e,t,r,i){return{duration:t,size:r,cts:i,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:e?2:1,isNonSync:e?0:1,paddingValue:0}}}var Ua=function(e){function t(t,r,i,n){var a;return(a=e.call(this,"mp4-remuxer",n)||this).observer=void 0,a.config=void 0,a.typeSupported=void 0,a.ISGenerated=!1,a._initPTS=null,a._initDTS=null,a.nextVideoTs=null,a.nextAudioTs=null,a.videoSampleDuration=null,a.isAudioContiguous=!1,a.isVideoContiguous=!1,a.videoTrackConfig=void 0,a.observer=t,a.config=r,a.typeSupported=i,a.ISGenerated=!1,a}c(t,e);var r=t.prototype;return r.destroy=function(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null},r.resetTimeStamp=function(e){var t=this._initPTS;t&&e&&e.trackId===t.trackId&&e.baseTime===t.baseTime&&e.timescale===t.timescale||this.log("Reset initPTS: "+(t?Ma(t):t)+" > "+(e?Ma(e):e)),this._initPTS=this._initDTS=e},r.resetNextTimestamp=function(){this.log("reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},r.resetInitSegment=function(){this.log("ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0},r.getVideoStartPts=function(e){var t=!1,r=e[0].pts,i=e.reduce((function(e,i){var n=i.pts,a=n-e;return a<-4294967296&&(t=!0,a=(n=Ba(n,r))-e),a>0?e:n}),r);return t&&this.debug("PTS rollover detected"),i},r.remux=function(e,t,r,i,n,a,s,o,l){var u,d,c,h,f,g,v=n,p=n,m=!l.iframe&&e.pid>-1,y=t.pid>-1,E=t.samples.length,b=e.samples.length>0,T=s&&E>0||E>1;if((!m||b)&&(!y||T)||this.ISGenerated||s){if(this.ISGenerated){var S,w,A,L,I=this.videoTrackConfig;(I&&(t.width!==I.width||t.height!==I.height||(null==(S=t.pixelRatio)?void 0:S[0])!==(null==(w=I.pixelRatio)?void 0:w[0])||(null==(A=t.pixelRatio)?void 0:A[1])!==(null==(L=I.pixelRatio)?void 0:L[1]))||!I&&T||null===this.nextAudioTs&&b)&&this.resetInitSegment()}this.ISGenerated||(c=this.generateIS(e,t,n,a));var k,R=this.isVideoContiguous,D=-1;if(T&&(D=function(e){for(var t=0;t<e.length;t++)if(e[t].key)return t;return-1}(t.samples),!R&&this.config.forceKeyFrameOnDiscontinuity))if(g=!0,D>0){this.warn("Dropped "+D+" out of "+E+" video samples due to a missing keyframe");var C=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(D),t.dropped+=D,k=p+=(t.samples[0].pts-C)/t.inputTimeScale}else-1===D&&(this.warn("No keyframe found out of "+E+" video samples"),g=!1);if(this.ISGenerated){if(b&&T&&n){var P=this.getVideoStartPts(t.samples),_=(Ba(e.samples[0].pts,P)-P)/t.inputTimeScale;v+=Math.max(0,_),p+=Math.max(0,-_)}if(b){if(e.samplerate||(this.warn("regenerate InitSegment as audio detected"),c=this.generateIS(e,t,n,a)),d=this.remuxAudio(e,v,this.isAudioContiguous,a,y||T||o===K.AUDIO?p:void 0,l),T){var x=d?d.endPTS-d.startPTS:0;t.inputTimeScale||(this.warn("regenerate InitSegment as video detected"),c=this.generateIS(e,t,n,a)),u=this.remuxVideo(t,p,R,x,l)}}else T&&(u=this.remuxVideo(t,p,R,0,l));u&&(u.firstKeyFrame=D,u.independent=-1!==D,u.firstKeyFramePTS=k)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(r.samples.length&&(f=$a(r,n,this._initPTS,this._initDTS)),i.samples.length&&(h=Ga(i,n,this._initPTS))),{audio:d,video:u,initSegment:c,independent:g,text:h,id3:f}},r.computeInitPts=function(e,t,r,i){var n=Math.round(r*t),a=Ba(e,n);if(a<n)for(this.log("Adjusting PTS for rollover in timeline near "+(n-a)/t+" "+i);a<n;)a+=Fa;return a-n},r.generateIS=function(e,t,r,i){var n,a,s,o=e.samples,l=t.samples,u=this.typeSupported,d={},c=this._initPTS,h=!c||i,f="audio/mp4",g=-1;if(h&&(n=a=1/0),e.config&&o.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":u.mpeg?(f="audio/mpeg",e.codec=""):u.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3"}if(d.audio={id:"audio",container:f,codec:e.codec,initSegment:"mp3"===e.segmentCodec&&u.mpeg?new Uint8Array(0):Pa.initSegment([e]),metadata:{channelCount:e.channelCount}},h){g=e.id,s=e.inputTimeScale;var v=this.computeInitPts(o[0].pts,s,r,"audio");(!c||s!==c.timescale||0===r&&v<c.baseTime)&&(n=a=v)}}if(t.sps&&t.pps&&l.length){if(t.timescale=t.inputTimeScale,d.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:Pa.initSegment([t]),metadata:{width:t.width,height:t.height}},h){g=t.id,s=t.inputTimeScale;var p=this.getVideoStartPts(l),m=Ba(l[0].dts,p),y=this.computeInitPts(m,s,r,"video"),E=this.computeInitPts(p,s,r,"video");(!c||s!==c.timescale||F(n)||0===r&&E<c.baseTime)&&(a=Math.min(a,y),n=Math.min(n,y))}this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(d).length)return this.ISGenerated=!0,h&&F(n)?(c&&this.warn("Timestamps at playlist time: "+(i?"":"~")+r+" "+n/s+" != initPTS: "+c.baseTime/c.timescale+" ("+c.baseTime+"/"+c.timescale+") trackId: "+c.trackId),this.log("Found initPTS at playlist time: "+r+" offset: "+n/s+" ("+n+"/"+s+") trackId: "+g),this._initPTS={baseTime:n,timescale:s,trackId:g},this._initDTS={baseTime:a,timescale:s,trackId:g}):n=s=void 0,{tracks:d,initPTS:n,timescale:s,trackId:g}},r.remuxVideo=function(e,t,r,i,n){var a,s,o=e.inputTimeScale,l=e.samples,d=[],c=l.length,h=this._initPTS,f=h.baseTime*o/h.timescale,g=this.nextVideoTs,v=8,p=this.videoSampleDuration,m=Number.POSITIVE_INFINITY,y=Number.NEGATIVE_INFINITY,E=!1;if(!r||null===g){var b=f+t*o,T=l[0].pts-Ba(l[0].dts,l[0].pts);It()&&null!==g&&Math.abs(b-T-(g+f))<15e3?r=!0:g=b-T-f}for(var S=g+f,w=0;w<c;w++){var A=l[w];A.pts=Ba(A.pts,S),A.dts=Ba(A.dts,S),A.dts<l[w>0?w-1:w].dts&&(E=!0)}E&&l.sort((function(e,t){var r=e.dts-t.dts,i=e.pts-t.pts;return r||i})),a=l[0].dts;var L=(s=l[l.length-1].dts)-a,I=L?Math.round(L/(c-1)):p||e.inputTimeScale/30;if(r){var k=a-S,R=k>I,D=k<-1;if((R||D)&&(R?this.warn((e.segmentCodec||"").toUpperCase()+": "+Oa(k,!0)+" ms ("+k+"dts) hole between fragments detected at "+t.toFixed(3)):this.warn((e.segmentCodec||"").toUpperCase()+": "+Oa(-k,!0)+" ms ("+k+"dts) overlapping between fragments detected at "+t.toFixed(3)),!D||S>=l[0].pts||It())){a=S;var C=l[0].pts-k;if(R)l[0].dts=a,l[0].pts=C;else for(var P=!0,_=0;_<l.length&&!(l[_].dts>C&&P);_++){var x=l[_].pts;if(l[_].dts-=k,l[_].pts-=k,_<l.length-1){var O=l[_+1].pts;P=O<=l[_].pts==O<=x}}this.log("Video: Initial PTS/DTS adjusted: "+Oa(C,!0)+"/"+Oa(a,!0)+", delta: "+Oa(k,!0)+" ms")}}for(var M=0,F=0,N=a=Math.max(0,a),U=0;U<c;U++){for(var H=l[U],V=H.units,K=V.length,j=0,q=0;q<K;q++)j+=V[q].data.length;F+=j,M+=K,H.length=j,H.dts<N?(H.dts=N,N+=I/4|0||1):N=H.dts,m=Math.min(H.pts,m),y=Math.max(H.pts,y)}s=l[c-1].dts;var W,Y=F+4*M+8;try{W=new Uint8Array(Y)}catch(e){return void this.observer.emit(G.ERROR,G.ERROR,{type:B.MUX_ERROR,details:$.REMUX_ALLOC_ERROR,fatal:!1,chunkMeta:n,error:e,bytes:Y,reason:"fail allocating video mdat "+Y})}ze(W,0,Y),ze(W,4,He.mdat);for(var z=!1,Q=Number.POSITIVE_INFINITY,X=Number.POSITIVE_INFINITY,J=Number.NEGATIVE_INFINITY,Z=Number.NEGATIVE_INFINITY,ee=0;ee<c;ee++){for(var te=l[ee],re=te.units,ie=0,ne=0,ae=re.length;ne<ae;ne++){var se=re[ne],oe=se.data,le=se.data.byteLength;ze(W,v,le),v+=4,W.set(oe,v),v+=le,ie+=4+le}var ue=void 0;if(ee<c-1)p=l[ee+1].dts-te.dts,ue=l[ee+1].pts-te.pts;else{var de=this.config,ce=ee>0?te.dts-l[ee-1].dts:I;if(ue=ee>0?te.pts-l[ee-1].pts:I,de.stretchShortVideoTrack&&null!==this.nextAudioTs){var he=Math.floor(de.maxBufferHole*o),fe=(i?m+i*o:this.nextAudioTs+f)-te.pts;fe>he?((p=fe-ce)<0?p=ce:z=!0,this.log("It is approximately "+fe/90+" ms to the next segment; using duration "+p/90+" ms for the last video frame.")):p=ce}else p=ce}var ge=Math.round(te.pts-te.dts);if(Q=Math.min(Q,p),J=Math.max(J,p),X=Math.min(X,ue),Z=Math.max(Z,ue),!r&&0===ee&&ge>p){var ve=Math.round(ge/I)*I;ve-ge==1&&(this.log("pad first CTS "+ge+" -> "+ve+" of sn: "+n.sn),ge=ve)}d.push(Na(te.key,p,ie,ge))}if(d.length){var pe=It();if(pe){if(pe<70){var me=d[0].flags;me.dependsOn=2,me.isNonSync=0}}else if(function(){if(void 0===St){var e=wt.match(/Safari\/(\d+)/i);St=e?parseInt(e[1]):0}return St}()&&Z-X<J-Q&&I/J<.025&&0===d[0].cts){this.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");for(var ye=a,Ee=0,be=d.length;Ee<be;Ee++){var Te=ye+d[Ee].duration,Se=ye+d[Ee].cts;if(Ee<be-1){var we=Te+d[Ee+1].cts;d[Ee].duration=we-Se}else d[Ee].duration=Ee?d[Ee-1].duration:I;d[Ee].cts=0,ye=Te}}}var Ae=s+(p=z||!p?I:p);this.nextVideoTs=g=Ae-f,this.videoSampleDuration=p,this.isVideoContiguous=!0,n.iframe&&(1===d.length?(d[0].duration=p=n.duration*o,this.nextVideoTs=g=a+p-f):this.warn("Not adjusting IFrame duration (sample count "+d.length+")"));var Le={data1:Pa.moof(n.sn,a,u(e,{samples:d})),data2:W,startPTS:(m-f)/o,endPTS:(y+p-f)/o,startDTS:(a-f)/o,endDTS:g/o,type:"video",hasAudio:!1,hasVideo:!0,nb:d.length,dropped:e.dropped};return e.samples=[],e.dropped=0,Le},r.getSamplesPerFrame=function(e){switch(e.segmentCodec){case"mp3":return 1152;case"ac3":return 1536;default:return 1024}},r.remuxAudio=function(e,t,r,i,n,a){var s=e.inputTimeScale,o=s/(e.samplerate?e.samplerate:s),l=this.getSamplesPerFrame
vendor: 5,352 bytes, line 2
2(e),d=l*o,c=this._initPTS,h="mp3"===e.segmentCodec&&this.typeSupported.mpeg,f=[],g=void 0!==n,v=e.samples,p=h?0:8,m=this.nextAudioTs||-1,y=c.baseTime*s/c.timescale,E=y+t*s;if(this.isAudioContiguous=r=r||v.length&&m>0&&(i&&Math.abs(E-(m+y))<9e3||Math.abs(Ba(v[0].pts,E)-(m+y))<20*d),v.forEach((function(e){e.pts=Ba(e.pts,E)})),!r||m<0){var b=v.length;if(v=v.filter((function(e){return e.pts>=0})),b!==v.length&&this.warn("Removed "+(v.length-b)+" of "+b+" samples (initPTS "+y+" / "+s+")"),!v.length)return;m=0===n?0:i&&!g?Math.max(0,E-y):v[0].pts-y}if("aac"===e.segmentCodec)for(var T=this.config.maxAudioFramesDrift,S=0,w=m+y;S<v.length;S++){var A=v[S],L=A.pts,I=L-w,k=Math.abs(1e3*I/s);if(I<=-T*d&&g)0===S&&(this.warn("Audio frame @ "+(L/s).toFixed(3)+"s overlaps marker by "+Math.round(1e3*I/s)+" ms."),this.nextAudioTs=m=L-y,w=L);else if(I>=T*d&&k<1e4&&g){var R=Math.round(I/d);for(w=L-R*d;w<0&&R&&d;)R--,w+=d;0===S&&(this.nextAudioTs=m=w-y),this.warn("Injecting "+R+" audio frames @ "+((w-y)/s).toFixed(3)+"s due to "+Math.round(1e3*I/s)+" ms gap.");for(var D=0;D<R;D++){var C=Ta.getSilentFrame(e.parsedCodec||e.manifestCodec||e.codec,e.channelCount);C||(this.log("Unable to get silent frame for given audio codec; duplicating last frame instead."),C=A.unit.subarray()),v.splice(S,0,{unit:C,pts:w}),w+=d,S++}}A.pts=w,w+=d}for(var P,_=null,x=null,O=0,M=v.length;M--;)O+=v[M].unit.byteLength;for(var F=0,N=v.length;F<N;F++){var U=v[F],H=U.unit,V=U.pts;if(null!==x)f[F-1].duration=Math.round((V-x)/o);else{if(r&&"aac"===e.segmentCodec&&(V=m+y),_=V,!(O>0))return;O+=p;try{P=new Uint8Array(O)}catch(e){return void this.observer.emit(G.ERROR,G.ERROR,{type:B.MUX_ERROR,details:$.REMUX_ALLOC_ERROR,fatal:!1,chunkMeta:a,error:e,bytes:O,reason:"fail allocating audio mdat "+O})}h||(ze(P,0,O),ze(P,4,He.mdat))}P&&P.set(H,p);var K=H.byteLength;p+=K,f.push(Na(!0,l,K,0)),x=V}var j=f.length;if(j){var q=f[f.length-1];m=x-y,this.nextAudioTs=m+o*q.duration;var W=h?new Uint8Array(0):Pa.moof(e.sequenceNumber++,_/o,u({},e,{samples:f}));e.samples=[];var Y=(_-y)/s,z=this.nextAudioTs/s,Q={data1:W,data2:P,startPTS:Y,endPTS:z,startDTS:Y,endDTS:z,type:"audio",hasAudio:!0,hasVideo:!1,nb:j};return this.isAudioContiguous=!0,Q}},t}(de);function Ba(e,t){var r;if(null===t)return e;for(r=t<e?-Fa:Fa;Math.abs(e-t)>4294967296;)e+=r;return e}function $a(e,t,r,i){var n=e.samples.length;if(n){for(var a=e.inputTimeScale,s=0;s<n;s++){var o=e.samples[s];o.pts=Ba(o.pts-r.baseTime*a/r.timescale,t*a)/a,o.dts=Ba(o.dts-i.baseTime*a/i.timescale,t*a)/a}var l=e.samples;return e.samples=[],{samples:l}}}function Ga(e,t,r){var i=e.samples.length;if(i){for(var n=e.inputTimeScale,a=0;a<i;a++){var s=e.samples[a];s.pts=Ba(s.pts-r.baseTime*n/r.timescale,t*n)/n}e.samples.sort((function(e,t){return e.pts-t.pts}));var o=e.samples;return e.samples=[],{samples:o}}}var Ha,Va=function(e){function t(t,r,i,n){var a;return(a=e.call(this,"passthrough-remuxer",n)||this).observer=void 0,a.emitInitSegment=!1,a.audioCodec=void 0,a.videoCodec=void 0,a.initData=void 0,a.initPTS=null,a.initTracks=void 0,a.lastEndTime=null,a.isVideoContiguous=!1,a.videoOnlyRemux=!1,a.decryptdata=null,a.pendingInitSegment=void 0,a.observer=t,a}c(t,e);var r=t.prototype;return r.destroy=function(){this.observer&&this.observer.removeAllListeners(),this.observer=null},r.resetTimeStamp=function(e){this.lastEndTime=null;var t=this.initPTS;t&&e&&t.baseTime===e.baseTime&&t.timescale===e.timescale||(this.initPTS=e)},r.resetNextTimestamp=function(){this.isVideoContiguous=!1,this.lastEndTime=null},r.resetInitSegment=function(e,t,r,i){this.audioCodec=t,this.videoCodec=r,this.decryptdata=i,this.pendingInitSegment=e,this.videoOnlyRemux=!1,this.initTracks=void 0,this.initData=void 0,this.emitInitSegment=!0},r.generateInitSegment=function(e,t,r){this.videoOnlyRemux=!1;var i=this.audioCodec,n=this.videoCodec;if(null==e||!e.byteLength)return this.initTracks=void 0,void(this.initData=void 0);var a=this.initData=r||rt(e),s=a.audio,o=a.video;if(t)!function(e,t){if(e&&t){var r=t.keyId;16===(null==r?void 0:r.byteLength)&&t.isCommonEncryption&<(e,(function(e,t){var i=e.subarray(8,24);i.some((function(e){return 0!==e}))||(me.log("[eme] Patching keyId in 'enc"+(t?"a":"v")+">sinf>>tenc' box: "+Fe(i)+" -> "+Fe(r)),e.set(r,8))}))}}(e,t);else{var l=s||o;null!=l&&l.encrypted&&this.warn('Init segment with encrypted track with has no key ("'+l.codec+'")!')}s&&(i=ja(s,j.AUDIO,this)),o&&(n=ja(o,j.VIDEO,this));var u={};s&&o?u.audiovideo={container:"video/mp4",codec:i+","+n,supplemental:o.supplemental,encrypted:o.encrypted,initSegment:e,id:"main"}:s?u.audio={container:"audio/mp4",codec:i,encrypted:s.encrypted,initSegment:e,id:"audio"}:o?u.video={container:"video/mp4",codec:n,supplemental:o.supplemental,encrypted:o.encrypted,initSegment:e,id:"main"}:this.warn("initSegment does not contain moov or trak boxes."),this.initTracks=u},r.remux=function(e,t,r,i,n,a,s,o,l,u,d){var c,h,f=this.initPTS,g=this.lastEndTime,v={audio:void 0,video:void 0,text:void 0,id3:r,initSegment:void 0};F(g)||(g=this.lastEndTime=n||0);var p=t.samples;if(!p.length)return v;var m=this.pendingInitSegment;m&&(this.pendingInitSegment=void 0,this.generateInitSegment(m,this.decryptdata,u));var y={initPTS:void 0,timescale:void 0,trackId:void 0},E=this.initData;if(null!=(c=E)&&c.length||(this.generateInitSegment(p),E=this.initData),null==(h=E)||
vendor: 8,959 bytes, line 2
2!h.length)return this.warn("Failed to generate initSegment."),v;if(l.iframe&&E.audio&&E.video){var b,T,S=null==(b=this.initTracks)||null==(b=b.audiovideo)?void 0:b.initSegment,w=S?function(e){var t=Ze(e,["moov"]);if(1!==t.length||Ze(e,["moof"]).length)return null;for(var r=e.byteOffset,i=[],n=[],a=!1,s=Ze(t[0],["trak"]),o=0;o<s.length;o++){var l=s[o],u=Ze(l,["mdia","hdlr"])[0];if("vide"!==(u?Be(u.subarray(8,12)):"")){var d=Ze(l,["tkhd"])[0];if(!d)return null;var c=d[0];n.push(je(d,0===c?12:20)),i.push(Xe(l,r))}else a=!0}if(!a||!i.length)return null;var h=Ze(t[0],["mvex"])[0],f=0;if(h)for(var g=Ze(h,["trex"]),v=0;v<g.length;v++){var p=g[v];-1!==n.indexOf(je(p,4))&&(i.push(Xe(p,r)),f+=p.byteLength+8)}var m=Je(e,i),y=m.result,E=m.dropped,b=m.droppedBefore;if(ze(y,t[0].byteOffset-r-8,t[0].byteLength+8-E),h&&f){var T=h.byteOffset-r-8;ze(y,T-b(T),h.byteLength+8-f)}return y}(S):null;w&&(this.log("Converted muxed init segment to video-only for I-Frame playback"),this.generateInitSegment(w,this.decryptdata),null!=(T=this.initData)&&T.length&&(E=this.initData,this.emitInitSegment=!0,this.videoOnlyRemux=!0))}this.emitInitSegment&&(y.tracks=this.initTracks,v.initSegment=y,this.emitInitSegment=!1);var A=l.iframe,L=!d||A&&!d.includeSampleDetails?function(e,t,r,i,n){return void 0===n&&(n=!0),ct(e,t,i,n)}(p,E,0,this,A):d.tracks,I=E.audio?L[E.audio.id]:null,k=E.video?L[E.video.id]:null,R=!!E.audio,D=!!E.video,C="";R&&(C+="audio"),D&&(C+="video");var P,_=Ka(k,1/0),x=Ka(I,1/0),O=Ka(k,0,!0),M=Ka(I,0,!0),N=0;k&&I&&E.audio&&(x>O||_>M)&&this.warn("audio and video track sample timestamps do not overlap. v: "+_+"-"+O+" a: "+x+"-"+M+"}",k,I);var U=!!I&&(!k||!f&&x<_||!!f&&f.trackId===E.audio.id),B=U?I:k;if(!B)return this.log("No media samples found in "+o+" "+l.level+" "+(-1===l.part?"":"part: "+l.part+" of")+" sn: "+l.sn+" at playlist time: "+n),v;var $,G=p;if(k&&k.sampleCount>=1&&E.video&&l.iframe){var H,V=k.trun,K=k.start,j=1===V.length,q=V.length?j?V[0].samples:(H=V[0].samples).concat.apply(H,V.slice(1).map((function(e){return e.samples}))):[];if(q.length){for(var W=V[0],Y=W,z=V.length;z--;)if(V[z].samples.length){Y=V[z];break}var Q=Y.lastSampleDurationOffset,X=W.defaultSampleDurationOffset,J=Math.abs(l.duration-(O-_))>.05,Z=q.length<k.sampleCount;if(J||Z||this.videoOnlyRemux||!j){var ee=Z?Y.sampleOffset+Y.samples.reduce((function(e,t){return e+t.size}),0):void 0,te=J?l.duration:O-_,re=function(e,t,r,i){if(void 0!==r){for(var n=e[e.length-1],a=t,s=0;s<e.length-1;s++)a-=e[s].duration;return a<=0&&(a=n.duration),n.duration=a,{durationOffset:r,value:a}}if(void 0!==i){for(var o=Math.round(t/e.length),l=0;l<e.length;l++)e[l].duration=o;return{durationOffset:i,value:o}}}(q,te*E.video.timescale,Q,X),ie=function(e,t,r,i,n){if(r<1)return null;var a=Ze(e,["moof"]);if(1!==a.length)return null;for(var s=a[0],o=e.byteOffset,l=[],u=[],d=Ze(s,["traf"]),c=!0,h=0;h<d.length;h++){var f=d[h],g=Ze(f,["tfhd"])[0];if(!g)return null;je(g,4)===t?(l.push(f),131072&je(g,0)||(c=!1)):u.push(Xe(f,o))}if(!l.length)return null;if(u.length&&!c)return null;if(void 0!==i){for(var v=r,p=0;p<l.length;p++){for(var m=l[p],y=0,E=Ze(m,["trun"]),b=0;b<E.length;b++){var T=E[b],S=Math.min(v,je(T,4));if(S){ze(e,T.byteOffset-o+4,S);var w=16777215&je(T,0);Qe(e,T,8+(1&w?4:0)+(4&w?4:0)+S*((256&w?4:0)+(512&w?4:0)+(1024&w?4:0)+(2048&w?4:0)))}else ze(e,T.byteOffset-o-4,He.free);v-=S,y+=S}var A=Ze(m,["senc"])[0];A&&ze(e,A.byteOffset-o+4,y);var L=Ze(m,["saiz"])[0];if(L){var I=4;1&(L[1]<<16|L[2]<<8|L[3])&&(I+=8);var k=L[I];I+=1,ze(e,L.byteOffset-o+I,y),Qe(e,L,I+4+(0===k?y:0))}}var R=Ze(e,["mdat"]);if(1===R.length){var D=R[0].byteOffset-o-8;ze(e,D,i-D)}}var C=e,P=0,_=function(){return 0};if(u.length){var x=Je(e,u);C=x.result,P=x.dropped,_=x.droppedBefore,ze(C,s.byteOffset-o-8,s.byteLength+8-P);for(var O=0;O<l.length;O++){for(var M=l[O],F=_(M.byteOffset-o),N=Ze(M,["trun"]),U=0;U<N.length;U++){var B=N[U];1&je(B,0)&&ze(C,B.byteOffset-o-F+8,je(B,8)-P)}if(F)for(var $=Ze(M,["saio"]),G=0;G<$.length;G++){var H=$[G],V=0===H[0]?4:8,K=1&je(H,0)?12:4,j=je(H,K);for(K+=4;j--;K+=V){var q=K+V-4;ze(C,H.byteOffset-o-F+q,je(H,q)-F)}}}}if(n){var W=n.durationOffset,Y=n.value;ze(C,W-_(W),Y)}return void 0!==i?C.subarray(0,i-P):C}(p,E.video.id,q.length,ee,re);ie?(G=ie,$=function(e,t){for(var r=e,i=e,n=0;n<t.length;n++){var a=t[n],s=a.cts,o=a.duration;i=Math.max(i,r+(s||0)+o),r+=o}return i}(K,q)):this.warn("IFrame remux skipped (sn "+l.sn+"); using native sample duration"),N=ie&&re?te:O-_}else N=O-_}else this.warn("Could not remux IFrame track fragment (no samples in range, trun count "+V.length+")"),N=O-_}else N=U?M-x:O-_;if(this.videoOnlyRemux&&G===p)return this.warn("Dropping muxed I-Frame fragment that could not be remuxed to video-only (sn: "+l.sn+")"),v;var ne=B.timescale,ae=B.start-n*ne,se=U?E.audio.id:E.video.id;if(P=B.start/ne,(a||!f)&&(function(e,t,r,i){if(null===e)return!0;var n=Math.max(i,1),a=t-e.baseTime/e.timescale;return Math.abs(a-r)>=n}(f,P,n,N)||ne!==f.timescale)){var oe=!1,le=U?"audio":"video";if(f){var ue=0!==n?P/n:1+P/1;oe=P>=0&&Math.abs(1-ue)<.001,this.log(le+" timestamps in track "+se+" at playlist time: "+(a?"":"~")+n+" maps to "+P+" with initPTS: "+f.baseTime/f.timescale+" ("+(ae/ne-f.baseTime/f.timescale)+"s diff) ("+C+") drift estimate: "+ue+" "+(oe?"(ignoring drift)":"remapping timestamps (initPTS)"))}oe||(this.log("Found initPTS in "+le+" track "+se+" at playlist time: "+n+" offset: "+(P-n)+" ("+ae+"/"+ne+")"),f=null,y.initPTS=ae,y.timescale=ne,y.trackId=se)}f?(y.initPTS=f.baseTime,y.timescale=f.timescale,y.trackId=f.trackId):(y.timescale&&void 0!==y.trackId&&void 0!==y.initPTS||(this.warn("Could not set initPTS"),y.initPTS=P,y.timescale=1,y.trackId=-1),this.initPTS=f={baseTime:y.initPTS,timescale:y.timescale,trackId:y.trackId});var de=P-f.baseTime/f.timescale,ce=de+N,he=D&&void 0!==(null==B?void 0:B.ptsMin)?B.ptsMin/B.timescale-f.baseTime/f.timescale:de,fe=void 0!==$&&k?$/k.timescale-f.baseTime/f.timescale:D&&null!=B&&B.ptsMax?B.ptsMax/B.timescale-f.baseTime/f.timescale:ce;N>0?this.lastEndTime=ce:(this.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var ge={data1:G,data2:void 0,startPTS:he,startDTS:de,endPTS:fe,endDTS:ce,type:C,hasAudio:R,hasVideo:D,nb:1,dropped:0,encrypted:!!E.audio&&E.audio.encrypted||!!E.video&&E.video.encrypted};v.audio=R&&!D?ge:void 0,v.video=D?ge:void 0;var ve=this.isVideoContiguous,pe=null==k?void 0:k.sampleCount;if(pe){var me=k.keyFrameIndex,ye=-1!==me;ge.nb=pe,ge.dropped=0===me||ve?0:ye?me:pe,ge.independent=ye,ge.firstKeyFrame=me,ye&&k.keyFrameStart&&(ge.firstKeyFramePTS=(k.keyFrameStart-f.baseTime)/f.timescale),ve||(v.independent=ye),this.isVideoContiguous||(this.isVideoContiguous=ye),ge.dropped&&this.warn("fmp4 does not start with IDR: firstIDR "+me+"/"+pe+" dropped: "+ge.dropped+" start: "+(ge.firstKeyFramePTS||"NA"))}return v.initSegment=y,v.id3=$a(r,n,f,f),i.samples.length&&(v.text=Ga(i,n,f)),v},t}(de);function Ka(e,t,r){return void 0===r&&(r=!1),void 0!==(null==e?void 0:e.start)?(e.start+(r?e.duration:0))/e.timescale:t}function ja(e,t,r){var i=e.codec;return i&&i.length>4?i:t===j.AUDIO?"ec-3"===i||"ac-3"===i||"alac"===i?i:"fLaC"===i||"Opus"===i?Nt(i,!1):(r.warn('Unhandled audio codec "'+i+'" in mp4 MAP'),i||"mp4a"):"mjpg"===i?i:(r.warn('Unhandled video codec "'+i+'" in mp4 MAP'),i||"avc1")}try{Ha=self.performance.now.bind(self.performance)}catch(e){Ha=Date.now}var qa=[{demux:aa,remux:Va},{demux:ha,remux:Ua},{demux:Zn,remux:Ua},{demux:ia,remux:Ua}];qa.splice(2,0,{demux:ta,remux:Ua});var Wa=function(){function e(e,t,r,i,n,a){this.asyncResult=!1,this.logger=void 0,this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.observer=e,this.typeSupported=t,this.config=r,this.id=n,this.logger=a}var t=e.prototype;return t.configure=function(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()},t.push=function(e,t,r,i){var n=this;if(!this.observer)return Ya(r);var a=r.transmuxing;a.executeStart=Ha();var s=new Uint8Array(e),o=this.currentTransmuxState,l=this.transmuxConfig;i&&(this.currentTransmuxState=i);var u=i||o,d=u.contiguous,c=u.discontinuity,h=u.trackSwitch,f=u.accurateTimeOffset,g=u.timeOffset,v=u.initSegmentChange,p=l.audioCodec,m=l.videoCodec,y=l.defaultInitPts,E=l.duration,b=l.initSegmentData,T=function(e,t){var r=null;return e.byteLength>0&&null!=(null==t?void 0:t.key)&&null!==t.iv&&null!=t.method&&(r=t),r}(s,t);if(T&&Ti(T.method)){var S=this.getDecrypter(),w=Si(T.method);return this.asyncResult=!0,this.decryptionPromise=S.decrypt(s,T.key.buffer,T.iv.buffer,w,r.decryptRange).then((function(e){var t=n.push(e,null,r);return n.decryptionPromise=null,t})),this.decryptionPromise}var A=this.needsProbing(c,h);if(A){var L=r.iframe&&b&&ha.probe(b,this.logger)?b:s,I=this.configureTransmuxer(L);
vendor: 8,628 bytes, line 2
2if(I)return this.logger.warn("[transmuxer] "+I.message),this.observer.emit(G.ERROR,G.ERROR,{type:B.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,fatal:!1,error:I,reason:I.message}),a.executeEnd=Ha(),Ya(r)}(c||h||v||A)&&this.resetInitSegment(b,p,m,E,t,r),(c||v||A)&&this.resetInitialTimestamp(y),d||this.resetContiguity();var k=this.transmux(s,T,g,f,r);this.asyncResult=za(k);var R=this.currentTransmuxState;return R.contiguous=!0,R.discontinuity=!1,R.trackSwitch=!1,a.executeEnd=Ha(),k},t.flush=function(e){var t=this,r=e.transmuxing;r.executeStart=Ha();var i=this.decrypter,n=this.currentTransmuxState,a=this.decryptionPromise;if(a)return this.asyncResult=!0,a.then((function(){return t.flush(e)}));var s=[],o=n.timeOffset;if(i){var l=i.flush();l&&s.push(this.push(l.buffer,null,e))}var u=this.demuxer,d=this.remuxer;if(!u||!d){r.executeEnd=Ha();var c=[Ya(e)];return this.asyncResult?Promise.resolve(c):c}var h=u.flush(o,e);return za(h)?(this.asyncResult=!0,h.then((function(r){return t.flushRemux(s,r,e),s}))):(this.flushRemux(s,h,e),this.asyncResult?Promise.resolve(s):s)},t.flushRemux=function(e,t,r){if(this.remuxer){var i=t.audioTrack,n=t.videoTrack,a=t.id3Track,s=t.textTrack,o=this.currentTransmuxState,l=o.accurateTimeOffset,u=o.timeOffset;this.logger.log("[transmuxer.ts]: Flushed "+this.id+" sn: "+r.sn+(r.part>-1?" part: "+r.part:"")+" of "+this.id+" playlist "+r.level);var d=this.remuxer.remux(i,n,a,s,u,l,!0,this.id,r,t.initData,t.sampleData);e.push({remuxResult:d,chunkMeta:r}),r.transmuxing.executeEnd=Ha()}},t.resetInitialTimestamp=function(e){var t=this.demuxer,r=this.remuxer;t&&r&&(t.resetTimeStamp(e),r.resetTimeStamp(e))},t.resetContiguity=function(){var e=this.demuxer,t=this.remuxer;e&&t&&(e.resetContiguity(),t.resetNextTimestamp())},t.resetInitSegment=function(e,t,r,i,n,a){var s=this.demuxer,o=this.remuxer;s&&o&&(s.resetInitSegment(e,t,r,i,n,a),o.resetInitSegment(e,t,r,n))},t.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0),this.observer&&this.observer.removeAllListeners(),this.decryptionPromise=null,this.decrypter=this.observer=void 0,this.logger=this.config=this.probe=void 0},t.transmux=function(e,t,r,i,n){return"SAMPLE-AES"===(null==t?void 0:t.method)?this.transmuxSampleAes(e,t,r,i,n):this.transmuxUnencrypted(e,r,i,n)},t.transmuxUnencrypted=function(e,t,r,i){var n=this.demuxer,a=this.remuxer;if(!n||!a)return Ya(i);var s=n.demux(e,t,i,!1,!this.config.progressive),o=s.audioTrack,l=s.videoTrack,u=s.id3Track,d=s.textTrack;return{remuxResult:a.remux(o,l,u,d,t,r,!1,this.id,i,s.initData,s.sampleData),chunkMeta:i}},t.transmuxSampleAes=function(e,t,r,i,n){var a=this;return this.demuxer?this.demuxer.demuxSampleAes(e,t,r,n).then((function(e){return{remuxResult:a.remuxer.remux(e.audioTrack,e.videoTrack,e.id3Track,e.textTrack,r,i,!1,a.id,n,e.initData,e.sampleData),chunkMeta:n}})):Promise.reject(new Error("no demuxer"))},t.configureTransmuxer=function(e){var t=this.config,r=this.observer,i=this.typeSupported;if(r){var n;try{for(var a=0,s=qa.length;a<s;a++){var o;if(null!=(o=qa[a].demux)&&o.probe(e,this.logger)){n=qa[a];break}}}catch(e){return e}if(!n)return new Error("Failed to find demuxer by probing fragment data");var l=this.demuxer,u=this.remuxer,d=n.demux,c=n.remux;l&&l instanceof d||(this.logger.log("Using "+d.name),this.demuxer=new d(r,t,i,this.logger),this.probe=d.probe),u&&u instanceof c||(this.logger.log("Using "+c.name),this.remuxer=new c(r,t,i,this.logger))}},t.needsProbing=function(e,t){return!this.demuxer||!this.remuxer||e||t},t.getDecrypter=function(){var e=this.decrypter;return e||(e=this.decrypter=new Xr(this.config)),e},e}(),Ya=function(e){return{remuxResult:{},chunkMeta:e}};function za(e){return"then"in e&&e.then instanceof Function}var Qa=function(e,t,r,i,n){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=t,this.initSegmentData=r,this.duration=i,this.defaultInitPts=n||null},Xa=function(e,t,r,i,n,a){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=e,this.contiguous=t,this.accurateTimeOffset=r,this.trackSwitch=i,this.timeOffset=n,this.initSegmentChange=a},Ja=[];function Za(e,t,r){if(!((i=t.remuxResult).audio||i.video||i.text||i.id3||i.initSegment))return!1;var i,n=[],a=t.remuxResult,s=a.audio,o=a.video;return s&&es(n,s),o&&es(n,o),e.postMessage({event:"transmuxComplete",data:t,instanceNo:r},n),!0}function es(e,t){t.data1&&e.push(t.data1.buffer),t.data2&&e.push(t.data2.buffer)}function ts(e,t,r,i){t.reduce((function(t,r){return Za(e,r,i)||t}),!1)||e.postMessage({event:"transmuxComplete",data:t[0],instanceNo:i}),e.postMessage({event:"flush",data:r,instanceNo:i})}function rs(e,t,r){self.postMessage({event:e,data:t,instanceNo:r})}void 0!==o&&o&&self.addEventListener("message",(function(e){var t=e.data,r=t.instanceNo;if(void 0!==r){var i=Ja[r];if("reset"===t.cmd&&(delete Ja[t.resetNo],i&&i.destroy(),t.cmd="init"),"init"===t.cmd){var n=JSON.parse(t.config),a=new x;a.on(G.FRAG_DECRYPTED,(function(e,t){return rs(e,t,r)})),a.on(G.ERROR,(function(e,t){return rs(e,t,r)}));var s=pe(n.debug,t.id);return function(e,t){var r=function(r){e[r]=function(){var e=Array.prototype.join.call(arguments," ");rs("workerLog",{logType:r,message:e},t)}};for(var i in e)r(i)}(s,r),Ja[r]=new Wa(a,t.typeSupported,n,"",t.id,s),void rs("init",null,r)}if(i)switch(t.cmd){case"configure":i.configure(t.config);break;case"demux":var o=i.push(t.data,t.decryptdata,t.chunkMeta,t.state);za(o)?o.then((function(e){Za(self,e,r)})).catch((function(e){rs(G.ERROR,{instanceNo:r,type:B.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,chunkMeta:t.chunkMeta,fatal:!1,error:e,err:e,reason:"transmuxer-worker push error"},r)})):Za(self,o,r);break;case"flush":var l=t.chunkMeta,u=i.flush(l);za(u)?u.then((function(e){ts(self,e,l,r)})).catch((function(e){rs(G.ERROR,{type:B.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,chunkMeta:t.chunkMeta,fatal:!1,error:e,err:e,reason:"transmuxer-worker flush error"},r)})):ts(self,u,l,r)}}}));var is="1.7.3",ns={},as=0,ss=function(){function e(e,t,r,i){var n=this;this.error=null,this.hls=void 0,this.id=void 0,this.instanceNo=as++,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.onWorkerMessage=function(e){var t=e.data,r=n.hls;if(r&&null!=t&&t.event&&t.instanceNo===n.instanceNo)switch(t.event){case"init":var i,a=null==(i=n.workerContext)?void 0:i.objectURL;a&&self.URL.revokeObjectURL(a);break;case"transmuxComplete":n.handleTransmuxComplete(t.data);break;case"flush":n.onFlush(t.data);break;case"workerLog":r.logger[t.data.logType]&&r.logger[t.data.logType](t.data.message);break;default:t.data=t.data||{},t.data.frag=n.frag,t.data.part=n.part,t.data.id=n.id,r.trigger(t.event,t.data)}},this.onWorkerError=function(e){if(n.hls){var t=new Error(e.message+" ("+e.filename+":"+e.lineno+")");n.hls.config.enableWorker=!1,n.hls.logger.warn('Error in "'+n.id+'" Web Worker, fallback to inline'),n.hls.trigger(G.ERROR,{type:B.OTHER_ERROR,details:$.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:t})}};var a=e.config;this.hls=e,this.id=t,this.useWorker=!!a.enableWorker,this.onTransmuxComplete=r,this.onFlush=i;var o=function(e,t){(t=t||{}).frag=n.frag||void 0,e===G.ERROR&&(t.parent=n.id,t.part=n.part,n.error=t.error),n.hls.trigger(e,t)};this.observer=new x,this.observer.on(G.FRAG_DECRYPTED,o),this.observer.on(G.ERROR,o);var l=Gt(a.preferManagedMediaSource);if(this.useWorker&&"undefined"!=typeof Worker){var u=this.hls.logger;a.workerPath;try{a.workerPath?(u.log("loading Web Worker "+a.workerPath+' for "'+t+'"'),this.workerContext=function(e){var t=ns[e];if(t)return t.clientCount++,t;var r=new self.URL(e,self.location.href).href,i={worker:new self.Worker(r),scriptURL:r,clientCount:1};return ns[e]=i,i}(a.workerPath)):(u.log('injecting Web Worker for "'+t+'"'),this.workerContext=function(){var e=ns[is];if(e)return e.clientCount++,e;var t=new self.Blob(["var exports={};var module={exports:exports};function define(f){f()};define.amd=true;("+s.toString()+")(true);"],{type:"text/javascript"}),r=self.URL.createObjectURL(t),i={worker:new self.Worker(r),objectURL:r,clientCount:1};return ns[is]=i,i}());var d=this.workerContext.worker;d.addEventListener("message",this.onWorkerMessage),d.addEventListener("error",this.onWorkerError),d.postMessage({instanceNo:this.instanceNo,cmd:"init",typeSupp
vendor: 42,618 bytes, line 2
2orted:l,id:t,config:sr(a)})}catch(r){u.warn('Error setting up "'+t+'" Web Worker, fallback to inline',r),this.terminateWorker(),this.error=null,this.transmuxer=new Wa(this.observer,l,a,"",t,e.logger)}}else this.transmuxer=new Wa(this.observer,l,a,"",t,e.logger)}var t=e.prototype;return t.reset=function(){if(this.frag=null,this.part=null,this.workerContext){var e=this.instanceNo;this.instanceNo=as++;var t=this.hls.config,r=Gt(t.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:"reset",resetNo:e,typeSupported:r,id:this.id,config:sr(t)})}},t.terminateWorker=function(){if(this.workerContext){var e=this.workerContext.worker;this.workerContext=null,e.removeEventListener("message",this.onWorkerMessage),e.removeEventListener("error",this.onWorkerError),function(e){var t=ns[e||is];if(t&&1==t.clientCount--){var r=t.worker,i=t.objectURL;delete ns[e||is],i&&self.URL.revokeObjectURL(i),r.terminate()}}(this.hls.config.workerPath)}},t.destroy=function(){if(this.workerContext)this.terminateWorker(),this.onWorkerMessage=this.onWorkerError=null;else{var e=this.transmuxer;e&&(e.destroy(),this.transmuxer=null)}var t=this.observer;t&&t.removeAllListeners(),this.frag=null,this.part=null,this.observer=null,this.hls=null},t.push=function(e,t,r,i,n,a,s,o,l,u){var d,c,h=this;l.transmuxing.start=self.performance.now();var f=this.instanceNo,g=this.transmuxer,v=a?a.start:n.start,p=n.decryptdata,m=this.frag,y=!m||n.cc!==m.cc,E=!m||l.level!==m.level,b=m?l.sn-m.sn:-1,T=this.part?l.part-this.part.index:-1,S=0===b&&l.id>1&&l.id===(null==m?void 0:m.stats.chunkCount),w=!E&&(1===b||0===b&&(1===T||S&&T<=0)),A=self.performance.now();(E||b||0===n.stats.parsing.start)&&(n.stats.parsing.start=A),!a||!T&&w||(a.stats.parsing.start=A);var L=!(m&&(null==(d=n.initSegment)?void 0:d.url)===(null==(c=m.initSegment)?void 0:c.url)),I=new Xa(y,w,o,E,v,L);if(!w||y||L){this.hls.logger.log("[transmuxer-interface]: Starting new transmux session for "+n.type+" sn: "+l.sn+(l.part>-1?" part: "+l.part:"")+" "+this.id+" playlist: "+l.level+" id: "+l.id+"\n discontinuity: "+y+"\n trackSwitch: "+E+"\n contiguous: "+w+"\n accurateTimeOffset: "+o+"\n timeOffset: "+v+"\n initSegmentChange: "+L);var k=new Qa(r,i,t,s,u);this.configureTransmuxer(k)}if(this.frag=n,this.part=a,this.workerContext)this.workerContext.worker.postMessage({instanceNo:f,cmd:"demux",data:e,decryptdata:p,chunkMeta:l,state:I},e instanceof ArrayBuffer?[e]:[]);else if(g){var R=g.push(e,p,l,I);za(R)?R.then((function(e){h.handleTransmuxComplete(e)})).catch((function(e){h.transmuxerError(e,l,"transmuxer-interface push error")})):this.handleTransmuxComplete(R)}},t.flush=function(e){var t=this;e.transmuxing.start=self.performance.now();var r=this.instanceNo,i=this.transmuxer;if(this.workerContext)this.workerContext.worker.postMessage({instanceNo:r,cmd:"flush",chunkMeta:e});else if(i){var n=i.flush(e);za(n)?n.then((function(r){t.handleFlushResult(r,e)})).catch((function(r){t.transmuxerError(r,e,"transmuxer-interface flush error")})):this.handleFlushResult(n,e)}},t.transmuxerError=function(e,t,r){this.hls&&(this.error=e,this.hls.trigger(G.ERROR,{type:B.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,chunkMeta:t,frag:this.frag||void 0,part:this.part||void 0,fatal:!1,error:e,err:e,reason:r}))},t.handleFlushResult=function(e,t){var r=this;e.forEach((function(e){r.handleTransmuxComplete(e)})),this.onFlush(t)},t.configureTransmuxer=function(e){var t=this.instanceNo,r=this.transmuxer;this.workerContext?this.workerContext.worker.postMessage({instanceNo:t,cmd:"configure",config:e}):r&&r.configure(e)},t.handleTransmuxComplete=function(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)},e}(),os=function(e){function t(t,r,i){var n;return(n=e.call(this,t,r,i,"audio-stream-controller",K.AUDIO)||this).mainAnchor=null,n.mainFragLoading=null,n.audioOnly=!1,n.bufferedTrack=null,n.switchingTrack=null,n.trackId=-1,n.nextTrackId=-1,n.waitingData=null,n.mainDetails=null,n.flushing=!1,n.bufferFlushed=!1,n.cachedTrackLoadedData=null,n.registerListeners(),n}c(t,e);var r=t.prototype;return r.onHandlerDestroying=function(){this.unregisterListeners(),e.prototype.onHandlerDestroying.call(this),this.resetItem()},r.resetItem=function(){this.mainDetails=this.mainAnchor=this.mainFragLoading=this.bufferedTrack=this.switchingTrack=this.waitingData=this.cachedTrackLoadedData=null},r.registerListeners=function(){e.prototype.registerListeners.call(this);var t=this.hls;t.on(G.LEVEL_LOADED,this.onLevelLoaded,this),t.on(G.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),t.on(G.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.on(G.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.on(G.BUFFER_RESET,this.onBufferReset,this),t.on(G.BUFFER_CREATED,this.onBufferCreated,this),t.on(G.BUFFER_FLUSHING,this.onBufferFlushing,this),t.on(G.BUFFER_FLUSHED,this.onBufferFlushed,this),t.on(G.INIT_PTS_FOUND,this.onInitPtsFound,this),t.on(G.FRAG_LOADING,this.onFragLoading,this),t.on(G.FRAG_BUFFERED,this.onFragBuffered,this)},r.unregisterListeners=function(){var t=this.hls;t&&(e.prototype.unregisterListeners.call(this),t.off(G.LEVEL_LOADED,this.onLevelLoaded,this),t.off(G.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),t.off(G.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.off(G.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.off(G.BUFFER_RESET,this.onBufferReset,this),t.off(G.BUFFER_CREATED,this.onBufferCreated,this),t.off(G.BUFFER_FLUSHING,this.onBufferFlushing,this),t.off(G.BUFFER_FLUSHED,this.onBufferFlushed,this),t.off(G.INIT_PTS_FOUND,this.onInitPtsFound,this),t.off(G.FRAG_LOADING,this.onFragLoading,this),t.off(G.FRAG_BUFFERED,this.onFragBuffered,this))},r.onInitPtsFound=function(e,t){var r=t.frag,i=t.id,n=t.initPTS,a=t.timescale,s=t.trackId,o=t.timestampOffsets;if(i===K.MAIN){var l=r.cc,u=this.fragCurrent;if(this.initPTS=o,this.log("InitPTS for cc: "+l+" found from main: "+n/a+" ("+n+"/"+a+") trackId: "+s),this.mainAnchor=r,this.state===In.WAITING_INIT_PTS){var d=this.waitingData;(!d&&!this.loadingParts||d&&d.frag.cc!==l)&&this.syncWithAnchor(r,null==d?void 0:d.frag)}else!this.hls.hasEnoughToStart&&u&&u.cc!==l?(u.abortRequests(),this.syncWithAnchor(r,u)):this.state===In.IDLE&&this.tick()}},r.getLoadPosition=function(){var t;return!this.startFragRequested&&this.nextLoadPosition>=0&&!1!==(null==(t=this.switchingTrack)?void 0:t.flushImmediate)?this.nextLoadPosition:e.prototype.getLoadPosition.call(this)},r.syncWithAnchor=function(e,t){var r,i=(null==(r=this.mainFragLoading)?void 0:r.frag)||null;if(!t||(null==i?void 0:i.cc)!==t.cc){var n=(i||e).cc,a=Sr(this.getLevelDetails(),n,this.getLoadPosition());a&&(this.log("Syncing with main frag at "+a.start+" cc "+a.cc),this.startFragRequested=!1,this.nextLoadPosition=a.start,this.resetLoadingState(),this.state===In.IDLE&&this.doTickIdle())}},r.startLoad=function(e,t){if(!this.levels)return this.startPosition=e,void(this.state=In.STOPPED);var r=this.lastCurrentTime;this.stopLoad(),this.setInterval(100),r>0&&-1===e&&!t&&this.initPTS.length&&(this.log("Override startPosition with lastCurrentTime @"+r.toFixed(3)),e=r),this.state=In.IDLE,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,t||this.fragmentTracker.hasFragments(this.playlistType)||(this.startFragRequested=!1),this.tick()},r.doTick=function(){switch(this.state){case In.IDLE:this.doTickIdle();break;case In.WAITING_TRACK:var t=this.levels,r=this.trackId,i=null==t?void 0:t[r],n=null==i?void 0:i.details;if(n&&!this.waitForLive(i)){if(this.waitForCdnTuneIn(n))break;this.state=In.WAITING_INIT_PTS}break;case In.FRAG_LOADING_WAITING_RETRY:this.checkRetryDate();break;case In.WAITING_INIT_PTS:var a=this.waitingData;if(a){var s=a.frag,o=a.part,l=a.cache,u=a.complete,d=this.mainAnchor;if(void 0!==this.initPTS[s.cc]){this.waitingData=null,this.state=In.FRAG_LOADING;var c={frag:s,part:o,payload:l.flush().buffer,networkDetails:null};this._handleFragmentLoadProgress(c),u&&e.prototype._handleFragmentLoadComplete.call(this,c)}else d&&d.cc!==a.frag.cc&&this.syncWithAnchor(d,a.frag)}else this.state=In.IDLE}this.onTickEnd()},r.resetLoadingState=function(){var t=this.waitingData;t&&(this.fragmentTracker.removeFragment(t.frag),this.waitingData=null),e.prototype.resetLoadingState.call(this)},r.onTickEnd=function(){var e=this.media;null!=e&&e.readyState&&(this.lastCurrentTime=e.currentTime,this.checkFragmentChanged())},r.doTickIdle=function(){var e,t=this.hls,r=this.levels,i=this.media,n=this.trackId,a=t.config;if(this.buffering&&(i||this.primaryPrefetch||!this.startFragRequested&&a.startFragPrefetch)&&null!=r&&r[n]){var s=r[n],o=s.details;if(!o||this.waitForLive(s)||this.waitForCdnTuneIn(o))return this.state=In.WAITING_TRACK,void(this.startFragRequested=!1);var l=this.getBufferOutput();this.bufferFlushed&&l&&(this.bufferFlushed=!1,this.afterBufferFlushed(l,j.AUDIO));var u=this.getFwdBufferInfo();if(null!==u){if(!this.switchingTrack&&this._streamEnded(u,o))return t.trigger(G.BUFFER_EOS,{type:"audio"}),void(this.state=In.ENDED);var d=u.len,c=t.maxBufferLength,h=o.fragments,f=h[0].start,g=this.getLoadPosition(),v=this.flushing||this.switchingTrack&&!this.switchingTrack.flushImmediate?g:u.end;if(this.switchingTrack&&i){var p=g;o.PTSKnown&&p<f&&p>=this.timelineOffset&&(u.end>f||u.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track "+p+" -> "+f+" + 0.05"),i.currentTime=f+.05)}if(!(d>=c&&!this.switchingTrack&&v<h[h.length-1].start)){var m=this.getNextFragment(v,o);if(m&&this.isLoopLoading(m,v)&&(m=this.getNextFragmentLoopLoading(m,o,u,K.MAIN,c)),m){if(!this.exceedsMaxBuffer(u,c,m)){var y=(null==(e=this.mainFragLoading)?void 0:e.frag)||null;if(!this.audioOnly&&this.startFragRequested&&y&&W(m)&&!m.endList&&(!o.live||!this.loadingParts&&v<this.hls.liveSyncPosition)&&(this.fragmentTracker.getState(y)===Gr&&(this.mainFragLoading=y=null),y&&W(y))){if(m.start>y.end){var E=this.fragmentTracker.getFragAtPos(v,K.MAIN);E&&E.end>y.end&&(y=E,this.mainFragLoading={frag:E,targetBufferTime:null})}if(m.start>y.end)return}this.loadFragment(m,s,v)}}else this.bufferFlushed=!0}}}},r.onMediaDetaching=function(t,r){this.bufferFlushed=this.flushing=!1,e.prototype.onMediaDetaching.call(this,t,r)},r.onAudioTracksUpdated=function(e,t){var r=t.audioTracks;this.resetTransmuxer(),this.levels=r.map((function(e){return new ir(e)}))},r.onAudioTrackSwitching=function(e,t){var r=!!t.url;this.trackId=t.id;var i=this.fragCurrent;i&&(i.abortRequests(),this.removeUnbufferedFrags(i.start)),this.resetLoadingState(),r?(this.switchingTrack=t,t.flushImmediate||(this.nextTrackId=t.id,this.nextLevelSwitch()),this.flushAudioIfNeeded(t),this.state!==In.STOPPED&&(this.setInterval(100),this.state=In.IDLE,this.tick())):(this.resetTransmuxer(),this.switchingTrack=null,this.bufferedTrack=t,this.clearInterval())},r.onManifestLoading=function(){e.prototype.onManifestLoading.call(this),this.bufferFlushed=this.flushing=this.audioOnly=!1,this.resetItem(),this.trackId=-1},r.onLevelLoaded=function(e,t){this.mainDetails=t.details;var r=this.cachedTrackLoadedData;r&&(this.cachedTrackLoadedData=null,this.onAudioTrackLoaded(G.AUDIO_TRACK_LOADED,r))},r.onAudioTrackLoaded=function(e,t){var r,i=this.levels,n=t.details,a=t.id,s=t.groupId,o=t.track;if(i){var l=this.mainDetails;if(!l||n.endCC>l.endCC||l.expired)return this.cachedTrackLoadedData=t,void(this.state!==In.STOPPED&&(this.state=In.WAITING_TRACK));this.cachedTrackLoadedData=null,this.log("Audio track "+a+' "'+o.name+'" of "'+s+'" loaded ['+n.startSN+","+n.endSN+"]"+(n.lastPartSn?"[part-"+n.lastPartSn+"-"+n.lastPartIndex+"]":"")+",duration:"+n.totalduration);var u=i[a],d=0;if(n.live||null!=(r=u.details)&&r.live){if(this.checkLiveUpdate(n),n.deltaUpdateFailed)return;var c;u.details&&(d=this.alignPlaylists(n,u.details,null==(c=this.levelLastLoaded)?void 0:c.details)),n.alignedSliding||(Sn(l,n,this),d=n.fragmentStart)}u.details=n,this.levelLastLoaded=u,this.startFragRequested||this.setStartPosition(l,d),this.hls.trigger(G.AUDIO_TRACK_UPDATED,{details:n,id:a,groupId:t.groupId}),this.state!==In.WAITING_TRACK||this.waitForCdnTuneIn(n)||(this.state=In.IDLE),this.tick()}else this.warn("Audio tracks reset while loading track "+a+' "'+o.name+'" of "'+s+'"')},r._handleFragmentLoadProgress=function(e){var t,r=e.frag,i=e.part,n=e.payload,a=this.config,s=this.trackId,o=this.levels;if(o){var l=o[s];if(l){var u=l.details;if(!u)return this.warn("Audio track details undefined on fragment load progress"),void this.removeUnbufferedFrags(r.start);var d=a.defaultAudioCodec||l.audioCodec||"mp4a.40.2",c=this.transmuxer;c||(c=this.transmuxer=new ss(this.hls,K.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var h=this.initPTS[r.cc],f=null==(t=r.initSegment)?void 0:t.data;if(void 0!==h){var g=i?i.index:-1,v=-1!==g,p=new ai(r.level,r.sn,r.stats.chunkCount,n.byteLength,g,v,r.duration);c.push(n,f,d,"",r,i,u.totalduration,!1,p,h)}else this.log("Unknown video PTS for cc "+r.cc+", waiting for video PTS before demuxing audio frag "+r.sn+" of ["+u.startSN+" ,"+u.endSN+"],track "+s),(this.waitingData=this.waitingData||{frag:r,part:i,cache:new Cn,complete:!1}).cache.push(new Uint8Array(n)),this.state!==In.STOPPED&&(this.state=In.WAITING_INIT_PTS)}else this.warn("Audio track is undefined on fragment load progress")}else this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+r.sn+" of level "+r.level+" will not be buffered")},r._handleFragmentLoadComplete=function(t){this.waitingData?this.waitingData.complete=!0:e.prototype._handleFragmentLoadComplete.call(this,t)},r.onBufferReset=function(){this.mediaBuffer=null},r.onBufferCreated=function(e,t){this.bufferFlushed=this.flushing=!1;var r=t.tracks.audio;r&&(this.mediaBuffer=r.buffer||null)},r.onFragLoading=function(e,t){!this.audioOnly&&t.frag.type===K.MAIN&&W(t.frag)&&(this.mainFragLoading=t,this.state===In.IDLE&&this.tick())},r.onFragBuffered=function(e,t){var r=t.frag,i=t.part;if(r.type===K.AUDIO)if(this.fragContextChanged(r))this.warn("Fragment "+r.sn+(i?" p: "+i.index:"")+" of level "+r.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+(this.switchingTrack?this.switchingTrack.name:"false"));else{if(W(r)){var n=this.switchingTrack;n&&(this.bufferedTrack=n)}this.fragBufferedComplete(r,i),this.media&&this.tick()}else this.audioOnly||r.type!==K.MAIN||r.elementaryStreams.video||r.elementaryStreams.audiovideo||(this.audioOnly=!0,this.mainFragLoading=null)},r.getFwdBufferInfo=function(){var t=this.getBufferOutput();return e.prototype.getFwdBufferInfo.call(this,t,K.AUDIO)},r.getBufferOutput=function(){return this.mediaBuffer?this.mediaBuffer:this.media},r.checkFragmentChanged=function(){var e=this.fragPlaying;if(!this.checkFragPlaying())return!1;var t=this.fragPlaying,r=null==e?void 0:e.level;return t&&t.level===r||(e&&this.cleanupBackBuffer(),this.switchingTrack&&this.completeAudioSwitch(this.switchingTrack)),!0},r.onError=function(t,r){var i;if(r.fatal)this.state=In.ERROR;else switch(r.details){case $.FRAG_GAP:case $.FRAG_PARSING_ERROR:case $.FRAG_DECRYPT_ERROR:case $.FRAG_LOAD_ERROR:case $.FRAG_LOAD_TIMEOUT:case $.KEY_LOAD_ERROR:case $.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(K.AUDIO,r);break;case $.AUDIO_TRACK_LOAD_ERROR:case $.AUDIO_TRACK_LOAD_TIMEOUT:case $.LEVEL_PARSING_ERROR:r.levelRetry||this.state!==In.WAITING_TRACK||(null==(i=r.context)?void 0:i.type)!==V.AUDIO_TRACK||(this.state=In.IDLE);break;case $.BUFFER_APPEND_NO_PROGRESS:if("audio"!==r.parent)return;r.frag&&(r.appendsWithoutProgress||0)>=this.config.appendErrorMaxRetry&&(this.warn("Marking fragment "+r.frag.sn+" of track "+r.frag.level+" as a gap after "+r.appendsWithoutProgress+" appends without buffered range growth, to prevent loop loading"),this.fragmentTracker.addAsGap(r.frag));break;case $.BUFFER_ADD_CODEC_ERROR:case $.BUFFER_APPEND_ERROR:if("audio"!==r.parent)return;this.reduceLengthAndFlushBuffer(r)||this.resetLoadingState();break;case $.BUFFER_FULL_ERROR:if("audio"!==r.parent)return;this.reduceLengthAndFlushBuffer(r)&&(this.bufferedTrack=null,e.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio"));break;case $.INTERNAL_EXCEPTION:this.recoverWorkerError(r)}},r.onBufferFlushing=function(e,t){t.type!==j.VIDEO&&(this.flushing=!0)},r.onBufferFlushed=function(e,t){var r=t.type;if(r!==j.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===In.ENDED&&(this.state=In.IDLE);var i=this.getBufferOutput();i&&(this.afterBufferFlushed(i,r),this.tick())}},r._handleTransmuxComplete=function(t){var r,i="audio",n=this.hls,a=t.remuxResult,s=t.chunkMeta,o=this.getCurrentContext(s);if(o){var l=o.frag,d=o.part,c=o.level,h=c.details,f=a.audio,g=a.text,v=a.id3,p=a.initSegment;if(this.fragContextChanged(l)||!h)return this.fragmentTracker.removeFragment(l),void(null!=p&&p.tracks&&this.resetTransmuxer());if(this.state=In.PARSING,f&&this.switchingTrack&&!this.switchingTrack.flushImmediate){var m=this.config.nextAudioTrackBufferFlushForwardOffset,y=Math.max(this.getLoadPosition()+m,l.start);e.prototype.flushMainBuffer.call(this,y,Number.POSITIVE_INFINITY,K.AUDIO)}if(null!=p&&p.tracks){var E=l.initSegment||l;if(this.unhandledEncryptionError(p,l))return;this._bufferInitSegment(c,p.tracks,E,s),n.trigger(G.FRAG_PARSING_INIT_SEGMENT,{frag:E,id:i,tracks:p.tracks})}if(f){var b=f.startPTS,T=f.endPTS,S=f.startDTS,w=f.endDTS;d&&(d.elementaryStreams[j.AUDIO]={startPTS:b,endPTS:T,startDTS:S,endDTS:w}),l.setElementaryStreamInfo(j.AUDIO,b,T,S,w),this.bufferFragmentData(f,l,d,s)}if(null!=v&&null!=(r=v.samples)&&r.length){var A=u({id:i,frag:l,details:h},v);n.trigger(G.FRAG_PARSING_METADATA,A)}if(g){var L=u({id:i,frag:l,details:h},g);n.trigger(G.FRAG_PARSING_USERDATA,L)}}else this.resetWhenMissingContext(s)},r._bufferInitSegment=function(e,t,r,i){if(this.state===In.PARSING&&(t.video&&delete t.video,t.audiovideo&&delete t.audiovideo,t.audio)){var n=t.audio;n.id=K.AUDIO;var a=e.audioCodec;this.log("Init audio buffer, container:"+n.container+", codecs[level/parsed]=["+a+"/"+n.codec+"]"),1===(null==a?void 0:a.split(",").length)&&(n.levelCodec=a),this.hls.trigger(G.BUFFER_CODECS,t);var s=n.initSegment;if(null!=s&&s.byteLength){var o={type:"audio",frag:r,part:null,chunkMeta:i,parent:r.type,data:s};this.hls.trigger(G.BUFFER_APPENDING,o)}this.tickImmediate()}},r.loadFragment=function(t,r,i){var n,a=this.fragmentTracker.getState(t);if(this.switchingTrack||a===Ur||a===$r)if(null!=(n=r.details)&&n.live&&!this.initPTS[t.cc]){this.log("Waiting for video PTS in continuity counter "+t.cc+" of live stream before loading audio fragment "+t.sn+" of level "+this.trackId),this.state=In.WAITING_INIT_PTS;var s=this.mainDetails;s&&s.fragmentStart!==r.details.fragmentStart&&Sn(s,r.details,this)}else e.prototype.loadFragment.call(this,t,r,i);else this.clearTrackerIfNeeded(t)},r.flushAudioIfNeeded=function(t){if(this.media&&this.bufferedTrack&&t.flushImmediate){var r=this.bufferedTrack;cr({name:r.name,lang:r.lang,assocLang:r.assocLang,characteristics:r.characteristics,audioCodec:r.audioCodec,channels:r.channels},t,hr)||(gr(t.url,this.hls)?(this.log("Switching audio track : flushing all audio"),e.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio"),this.bufferedTrack=null):this.bufferedTrack=t)}},r.completeAudioSwitch=function(e){var t=this.hls;this.bufferedTrack=e,this.switchingTrack=null,t.trigger(G.AUDIO_TRACK_SWITCHED,g({},e))},i(t,[{key:"nextAudioTrack",get:function(){return this.nextTrackId}}])}(kn),ls=function(e){function t(t,r){var i;return(i=e.call(this,r,t.logger)||this).hls=void 0,i.canLoad=!1,i.timer=-1,i.loadingSync=!1,i.hls=t,i}c(t,e);var r=t.prototype;return r.destroy=function(){this.clearTimer(),this.hls=null},r.clearTimer=function(){-1!==this.timer&&(self.clearTimeout(this.timer),this.timer=-1)},r.startLoad=function(){this.canLoad=!0,this.loadPlaylist()},r.stopLoad=function(){this.canLoad=!1,this.clearTimer()},r.switchParams=function(e,t,r){var i=null==t?void 0:t.renditionReports;if(i){for(var n=-1,a=0;a<i.length;a++){var s=i[a],o=void 0;try{o=new self.URL(s.URI,t.url).href}catch(e){this.warn("Could not construct new URL for Rendition Report: "+e),o=s.URI||""}if(o===e){n=a;break}o===e.substring(0,o.length)&&(n=a)}if(-1!==n){var l=i[n],u=parseInt(l["LAST-MSN"])||t.lastPartSn,d=parseInt(l["LAST-PART"])||t.lastPartIndex;if(this.hls.config.lowLatencyMode){var c=Math.min(t.age-t.partTarget,t.targetduration);d>=0&&c>t.partTarget&&(d+=1)}var h=r&&tr(r);return new rr(u,d>=0?d:void 0,h)}}},r.loadPlaylist=function(e){this.clearTimer()},r.loadingPlaylist=function(e,t){this.clearTimer()},r.shouldLoadPlaylist=function(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)},r.getUrlWithDirectives=function(e,t){if(t)try{return t.addDirectives(e)}catch(e){this.warn("Could not construct new URL with HLS Delivery Directives: "+e)}return e},r.playlistLoaded=function(e,t,r){var i=t.details,n=t.stats,a=i.fragments,s=self.performance.now(),o=n.loading.first?Math.max(0,Math.floor(s-n.loading.first)):0;i.advancedDateTime=Date.now()-o;var l=this.hls.config.timelineOffset;if(l!==i.appliedTimelineOffset){var u=Math.max(l||0,0);i.appliedTimelineOffset=u,a.forEach((function(e){null==e||e.setStart(e.playlistOffset+u)}))}if(i.live||null!=r&&r.live){var d,c="levelInfo"in t?t.levelInfo:t.track;i.reloaded(r);var h=null==(d=a[a.length-1])?void 0:d.type;if(i.misses>=this.hls.config.liveMaxUnchangedPlaylistRefresh){var f=new Error(h+" playlist "+c.id+" hit max allowed unchanged reloads.");this.warn(f);var g=t.networkDetails,v=t.context;return void this.hls.trigger(G.ERROR,{type:B.NETWORK_ERROR,details:$.PLAYLIST_UNCHANGED_ERROR,fatal:!1,url:i.url,error:f,reason:f.message,level:t.level,parent:h,context:v,networkDetails:g,stats:n})}if(r){un(r,i,this);var p=i.playlistParsingError;if(p){this.warn(p);var m=this.hls;if(!m.config.ignorePlaylistParsingErrors){var y=t.networkDetails;return void m.trigger(G.ERROR,{type:B.NETWORK_ERROR,details:$.LEVEL_PARSING_ERROR,fatal:!1,url:i.url,error:p,reason:p.message,level:t.level,parent:h,networkDetails:y,stats:n})}i.playlistParsingError=null}}-1===i.requestScheduled&&(i.requestScheduled=n.loading.start);var E=this.hls.mainForwardBufferInfo,b=E?E.end-E.len:0,T=hn(i,1e3*(i.edge-b));i.requestScheduled+T<s?i.requestScheduled=s:i.requestScheduled<=s&&(i.requestScheduled+=T);var S,w=t.deliveryDirectives;if(this.log("live playlist "+e+" "+(i.advanced?"REFRESHED "+i.lastPartSn+" - "+i.lastPartIndex:i.updated?"UPDATED":"MISSED (received "+i.lastPartSn+" - "+i.lastPartIndex+(w?" | requested "+w.msn+" - "+w.part:"")+")")),!this.canLoad||!i.live)return;var A=void 0,L=void 0;if(i.canBlockReload&&i.advanced){var I=this.hls.config.lowLatencyMode,k=i.lastPartSn,R=i.endSN,D=i.lastPartIndex,C=k===R;-1!==D?C?(A=R+1,L=I?0:D):(A=k,L=I?D+1:i.maxPartIndex):A=R+1;var P=i.age,_=P+i.ageHeader,x=Math.min(_-i.partTarget,1.5*i.targetduration);if(x>0){if(_>3*i.targetduration)this.log("Playlist last advanced "+P.toFixed(2)+"s ago. Omitting segment and part directives."),A=void 0,L=void 0;else if(null!=r&&r.tuneInGoal&&_-i.partTarget>r.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+r.tuneInGoal+" to: "+x+" with playlist age: "+i.age),x=0;else{var O=Math.floor(x/i.targetduration);A+=O,void 0!==L&&(L+=Math.round(x%i.targetduration/i.partTarget)),this.log("CDN Tune-in age: "+i.ageHeader+"s last advanced "+P.toFixed(2)+"s goal: "+x+" skip sn "+O+" to part "+L)}i.tuneInGoal=x}if(S=this.getDeliveryDirectives(i,t.deliveryDirectives,A,L),I||!C)return i.requestScheduled=s,void this.loadingPlaylist(c,S)}else(i.canBlockReload||i.canSkipUntil)&&(S=this.getDeliveryDirectives(i,t.deliveryDirectives,A,L));S&&void 0!==A&&i.canBlockReload&&(i.requestScheduled=n.loading.first+Math.max(T-2*o,T/2)),this.scheduleLoading(c,S,i)}else this.clearTimer()},r.scheduleLoading=function(e,t,r){var i=this,n=r||e.details;if(n){var a=self.performance.now(),s=n.requestScheduled;if(a>=s&&!this.loadingSync)return this.loadingSync=!0,this.loadingPlaylist(e,t),void(this.loadingSync=!1);var o=Math.max(s-a,0);this.log("reload live playlist "+(e.name||e.bitrate+"bps")+" in "+Math.round(o)+" ms"),this.clearTimer(),this.timer=self.setTimeout((function(){return i.loadingPlaylist(e,t)}),o)}else this.loadingPlaylist(e,t)},r.getDeliveryDirectives=function(e,t,r,i){var n=tr(e);return null!=t&&t.skip&&e.deltaUpdateFailed&&(r=t.msn,i=t.part,n=Jt),new rr(r,i,n)},r.checkRetry=function(e){var t=this,r=e.details,i=Z(e),n=e.errorAction,a=n||{},s=a.action,o=a.retryCount,l=void 0===o?0:o,u=a.retryConfig,d=!!n&&!!u&&(s===kr||!n.resolved&&s===Lr);if(d){var c;if(l>=u.maxNumRetry)return!1;if(i&&null!=(c=e.context)&&c.deliveryDirectives)this.warn("Retrying playlist loading "+(l+1)+"/"+u.maxNumRetry+' after "'+r+'" without delivery-directives'),this.loadPlaylist();else{var h,f=se(null==(h=e.response)?void 0:h.code);if(this.clearTimer(),f)this.log("Waiting for connection (offline)"),e.reason="offline",this.timer=self.setTimeout((function(){return t.checkOfflineStatus()}),1e3);else{var g=ie(u,l);this.warn("Retrying playlist loading "+(l+1)+"/"+u.maxNumRetry+' after "'+r+'" in '+g+"ms"),this.timer=self.setTimeout((function(){return t.loadPlaylist()}),g)}}e.levelRetry=!0,n.resolved=!0}return d},r.checkOfflineStatus=function(){var e=this;this.clearTimer(),se(0)?this.timer=self.setTimeout((function(){return e.checkOfflineStatus()}),1e3):(this.log("Connection restored (online)"),this.loadPlaylist())},t}(de);function us(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!ds(e[r].attrs,t[r].attrs))return!1;return!0}function ds(e,t,r){var i=e["STABLE-RENDITION-ID"];return i&&!r?i===t["STABLE-RENDITION-ID"]:!(r||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some((function(r){return e[r]!==t[r]}))}var cs=function(e){function t(t){var r;return(r=e.call(this,t,"audio-track-controller")||this).tracks=[],r.groupIds=null,r.tracksInGroup=[],r.trackId=-1,r.currentTrack=null,r.selectDefaultTrack=!0,r.registerListeners(),r}c(t,e);var r=t.prototype;return r.registerListeners=function(){var e=this.hls;e.on(G.MANIFEST_LOADING,this.onManifestLoading,this),e.on(G.MANIFEST_PARSED,this.onManifestParsed,this),e.on(G.LEVEL_LOADING,this.onLevelLoading,this),e.on(G.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(G.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(G.ERROR,this.onError,this)},r.unregisterListeners=function(){var e=this.hls;e.off(G.MANIFEST_LOADING,this.onManifestLoading,this),e.off(G.MANIFEST_PARSED,this.onManifestParsed,this),e.off(G.LEVEL_LOADING,this.onLevelLoading,this),e.off(G.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(G.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(G.ERROR,this.onError,this)},r.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,e.prototype.destroy.call(this)},r.onManifestLoading=function(){this.tracks=[],this.tracksInGroup=[],this.groupIds=null,this.currentTrack=null,this.trackId=-1,this.selectDefaultTrack=!0},r.onManifestParsed=function(e,t){this.tracks=t.audioTracks||[]},r.onAudioTrackLoaded=function(e,t){var r=t.id,i=t.groupId,n=t.details,a=this.tracksInGroup[r];if(a&&a.groupId===i){var s=a.details;a.details=t.details,this.log("Audio track "+r+' "'+a.name+'" lang:'+a.lang+" group:"+i+" loaded ["+n.startSN+"-"+n.endSN+"]"),r===this.trackId&&this.playlistLoaded(r,t,s)}else this.warn("Audio track with id:"+r+" and group:"+i+" not found in active group "+(null==a?void 0:a.groupId))},r.onLevelLoading=function(e,t){this.switchLevel(t.level)},r.onLevelSwitching=function(e,t){this.switchLevel(t.level)},r.switchLevel=function(e){var t=this.hls.levels[e];if(t){var r=t.audioGroups||null,i=this.groupIds,n=this.currentTrack;if(!r||(null==i?void 0:i.length)!==(null==r?void 0:r.length)||null!=r&&r.some((function(e){return-1===(null==i?void 0:i.indexOf(e))}))){this.groupIds=r,this.trackId=-1,this.currentTrack=null;var a=this.tracks.filter((function(e){return vr(e.groupId,r)}));if(a.length)this.selectDefaultTrack&&!a.some((function(e){return e.default}))&&(this.selectDefaultTrack=!1),a.forEach((function(e,t){e.id=t}));else if(!n&&!this.tracksInGroup.length)return;this.tracksInGroup=a;var s=this.hls.config.audioPreference;if(!n&&s){var o=dr(s,a,hr);if(o>-1)n=a[o];else{var l=dr(s,this.tracks);n=this.tracks[l]}}var u=this.findTrackId(n);-1===u&&n&&(u=this.findTrackId(null));var d={audioTracks:a};this.log("Updating audio tracks, "+a.length+" track(s) found in group(s): "+(null==r?void 0:r.join(","))),this.hls.trigger(G.AUDIO_TRACKS_UPDATED,d);var c=this.trackId;if(-1!==u&&-1===c)this.setAudioTrack(u);else if(a.length&&-1===c){var h,f=new Error("No audio track selected for current audio group-ID(s): "+(null==(h=this.groupIds)?void 0:h.join(","))+" track count: "+a.length);this.warn(f.message),this.hls.trigger(G.ERROR,{type:B.MEDIA_ERROR,details:$.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:f})}}}},r.onError=function(e,t){!t.fatal&&t.context&&t.context.type===V.AUDIO_TRACK&&t.context.id===this.trackId&&vr(t.context.groupId,this.groupIds)&&this.checkRetry(t)},r.setAudioOption=function(e){var t=this.hls;if(t.config.audioPreference=e,e){var r=this.allAudioTracks;if(this.selectDefaultTrack=!1,r.length){var i=this.currentTrack;if(i&&cr(e,i,hr))return i;var n=dr(e,this.tracksInGroup,hr);if(n>-1){var a=this.tracksInGroup[n];return this.setAudioTrack(n,"flushImmediate"in e&&e.flushImmediate),a}if(i){var s=t.loadLevel;-1===s&&(s=t.firstAutoLevel);var o=function(e,t,r,i,n){var a=t[i],s=t.reduce((function(e,t,r){var i=t.uri;return(e[i]||(e[i]=[])).push(r),e}),{})[a.uri];s.length>1&&(i=Math.max.apply(Math,s));var o=a.videoRange,l=a.frameRate,u=a.codecSet.substring(0,4),d=fr(t,i,(function(t){if(t.videoRange!==o||t.frameRate!==l||t.codecSet.substring(0,4)!==u)return!1;var i=t.audioGroups,a=r.filter((function(e){return vr(e.groupId,i)}));return dr(e,a,n)>-1}));return d>-1?d:fr(t,i,(function(t){var i=t.audioGroups,a=r.filter((function(e){return vr(e.groupId,i)}));return dr(e,a,n)>-1}))}(e,t.levels,r,s,hr);if(-1===o)return null;t.nextLoadLevel=o}if(e.channels||e.audioCodec){var l=dr(e,r);if(l>-1)return r[l]}}}return null},r.setAudioTrack=function(e,t){void 0===t&&(t=!0);var r=this.tracksInGroup;if(e<0||e>=r.length)this.warn("Invalid audio track id: "+e);else{this.selectDefaultTrack=!1;var i=this.currentTrack,n=r[e],a=n.details&&!n.details.live;if(!(e===this.trackId&&n===i&&a||(this.log("Switching to audio-track "+e+' "'+n.name+'" lang:'+n.lang+" group:"+n.groupId+" channels:"+n.channels),this.trackId=e,this.currentTrack=n,this.hls.trigger(G.AUDIO_TRACK_SWITCHING,g(g({},n),{},{flushImmediate:t})),a))){var s=this.switchParams(n.url,null==i?void 0:i.details,n.details);this.loadPlaylist(s)}}},r.findTrackId=function(e){for(var t=this.tracksInGroup,r=0;r<t.length;r++){var i=t[r];if((!this.selectDefaultTrack||i.default)&&(!e||cr(e,i,hr)))return r}if(e){for(var n=e.name,a=e.lang,s=e.assocLang,o=e.characteristics,l=e.audioCodec,u=e.channels,d=0;d<t.length;d++)if(cr({name:n,lang:a,assocLang:s,characteristics:o,audioCodec:l,channels:u},t[d],hr))return d;for(var c=0;c<t.length;c++){var h=t[c];if(ds(e.attrs,h.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return c}for(var f=0;f<t.length;f++){var g=t[f];if(ds(e.attrs,g.attrs,["LANGUAGE"]))return f}}return-1},r.loadPlaylist=function(t){e.prototype.loadPlaylist.call(this);var r=this.currentTrack;this.shouldLoadPlaylist(r)&&gr(r.url,this.hls)&&this.scheduleLoading(r,t)},r.loadingPlaylist=function(t,r){e.prototype.loadingPlaylist.call(this,t,r);var i=t.id,n=t.groupId,a=this.getUrlWithDirectives(t.url,r),s=t.details,o=null==s?void 0:s.age;this.log("Loading audio-track "+i+' "'+t.name+'" lang:'+t.lang+" group:"+n+(void 0!==(null==r?void 0:r.msn)?" at sn "+r.msn+" part "+r.part:"")+(o&&s.live?" age "+o.toFixed(1)+(s.type?" "+s.type||0:""):"")+" "+a),this.hls.trigger(G.AUDIO_TRACK_LOADING,{url:a,id:i,groupId:n,deliveryDirectives:r||null,track:t})},i(t,[{key:"allAudioTracks",get:function(){return this.tracks}},{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}},{key:"nextAudioTrack",get:function(){return this.trackId},set:function(e){this.selectDefaultTrack=!1,this.setAudioTrack(e,!1)}}])}(ls),hs=function(){function e(e){this.tracks=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.tracks=e}var t=e.prototype;return t.destroy=function(){this.tracks=this.queues=null},t.append=function(e,t,r){if(null!==this.queues&&null!==this.tracks){var i=this.queues[t];i.push(e),1!==i.length||r||this.executeNext(t)}},t.appendBlocker=function(e){var t=this;return new Promise((function(r){var i={label:"async-blocker",execute:r,onStart:function(){},onComplete:function(){},onError:function(){}};t.append(i,e)}))},t.prependBlocker=function(e){var t=this;return new Promise((function(r){if(t.queues){var i={label:"async-blocker-prepend",execute:r,onStart:function(){},onComplete:function(){},onError:function(){}};t.queues[e].unshift(i)}}))},t.removeBlockers=function(){null!==this.queues&&[this.queues.video,this.queues.audio,this.queues.audiovideo].forEach((function(e){var t,r=null==(t=e[0])?void 0:t.label;"async-blocker"===r||"async-blocker-prepend"===r?(e[0].execute(),e.splice(0,1)):"block-audio"===r&&e.splice(0,1)}))},t.insertNext=function(e,t){var r;null!==this.queues&&(r=this.queues[t]).splice.apply(r,[1,0].concat(e))},t.unblockAudio=function(){var e;null!==this.queues&&"block-audio"===(null==(e=this.current("audio"))?void 0:e.label)&&this.shiftAndExecuteNext("audio")},t.audioBlocking=function(){return null!==this.queues&&this.queues.audio.some((function(e){return"block-audio"===e.label}))},t.executeNext=function(e){if(null!==this.queues&&null!==this.tracks){var t=this.queues[e];if(t.length){var r=t[0];try{r.execute()}catch(t){var i;if(r.onError(t),null===this.queues||null===this.tracks)return;var n=null==(i=this.tracks[e])?void 0:i.buffer;null!=n&&n.updating||this.shiftAndExecuteNext(e)}}}},t.shiftAndExecuteNext=function(e){null!==this.queues&&(this.queues[e].shift(),this.executeNext(e))},t.current=function(e){var t;return(null==(t=this.queues)?void 0:t[e][0])||null},t.toString=function(){var e=this.queues,t=this.tracks;return null===e||null===t?"<destroyed>":"\n"+this.list("video")+"\n"+this.list("audio")+"\n"+this.list("audiovideo")+"}"},t.list=function(e){var t,r;return null!=(t=this.queues)&&t[e]||null!=(r=this.tracks)&&r[e]?e+": ("+this.listSbInfo(e)+") "+this.listOps(e):""},t.listSbInfo=function(e){var t,r=null==(t=this.tracks)?void 0:t[e],i=null==r?void 0:r.buffer;return i?"SourceBuffer"+(i.updating?" updating":"")+(r.ended?" ended":"")+(r.ending?" ending":""):"none"},t.listOps=function(e){var t;return(null==(t=this.queues)?void 0:t[e].map((function(e){return e.label})).join(", "))||""},e}(),fs=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,gs="HlsJsTrackRemovedError",vs=function(e){function t(t){var r;return(r=e.call(this,t)||this).name=gs,r}return c(t,e),t}(b(Error)),ps=function(e){function t(t,r){var i,n;return(i=e.call(this,"buffer-controller",t.logger)||this).hls=void 0,i.fragmentTracker=void 0,i.fragmentAppendProgress=Object.create(null),i.appendsWithoutProgress=Object.create(null),i.details=null,i._objectUrl=null,i.operationQueue=null,i.bufferCodecEventsTotal=0,i.media=null,i.mediaSource=null,i.lastMpegAudioChunk=null,i.lastVideoAppendEnd=0,i.appendSource=void 0,i.transferData=void 0,i.overrides=void 0,i.appendErrors={audio:0,video:0,audiovideo:0},i.appendError=void 0,i._quotaEvictionPending={},i.tracks={},i.sourceBuffers=[[null,null],[null,null]],i._onEndStreaming=function(e){var t;i.hls&&"open"===(null==(t=i.mediaSource)?void 0:t.readyState)&&i.media&&!i.media.seeking&&i.hls.pauseBuffering()},i._onStartStreaming=function(e){i.hls&&i.hls.resumeBuffering()},i._onMediaSourceOpen=function(e){var t=i,r=t.media,n=t.mediaSource;e&&i.log("Media source opened"),r&&n&&(An(n,"sourceopen",i._onMediaSourceOpen),An(r,"emptied",i._onMediaEmptied),i.updateDuration(),i.hls.trigger(G.MEDIA_ATTACHED,{media:r,mediaSource:n}),null!==i.mediaSource&&i.checkPendingTracks())},i._onMediaSourceClose=function(){if(i.log("Media source closed"),i.media){var e=i.media.error,t=i,r=t.appendError,n=t.appendErrors,a=!1;!r&&e&&(a=Math.max(++n.audio,++n.video,++n.audiovideo)>=i.hls.config.appendErrorMaxRetry);var s=new Error("MediaSource closed while media attached"+Es(a,e));i.warn(s),i.hls.trigger(G.ERROR,u({fatal:a},r,{type:B.MEDIA_ERROR,details:$.MEDIA_SOURCE_REQUIRES_RESET,error:s}))}},i._onMediaSourceEnded=function(){i.log("Media source ended")},i._onMediaEmptied=function(){var e=i,t=e.mediaSrc,r=e._objectUrl;t!==r&&i.error("Media element src was set while attaching MediaSource ("+r+" > "+t+")")},i._onMediaError=function(){var e,t,r=i.media;r&&i.log("Media error (code: "+(null==(e=r.error)?void 0:e.code)+"): "+(null==(t=r.error)?void 0:t.message))},i.hls=t,i.fragmentTracker=r,i.appendSource=(n=ye(t.config.preferManagedMediaSource),"undefined"!=typeof self&&n===self.ManagedMediaSource),i.initTracks(),i.registerListeners(),i}c(t,e);var r=t.prototype;return r.hasSourceTypes=function(){return Object.keys(this.tracks).length>0},r.destroy=function(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=null,this.transferData=this.overrides=void 0,this.operationQueue&&(this.operationQueue.destroy(),this.operationQueue=null),this.hls=this.fragmentTracker=null,this._onMediaSourceOpen=this._onMediaSourceClose=null,this._onMediaSourceEnded=null,this._onStartStreaming=this._onEndStreaming=null,this._onMediaEmptied=this._onMediaError=null},r.registerListeners=function(){var e=this.hls;e.on(G.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(G.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(G.MANIFEST_LOADING,this.onManifestLoading,this),e.on(G.MANIFEST_PARSED,this.onManifestParsed,this),e.on(G.BUFFER_RESET,this.onBufferReset,this),e.on(G.BUFFER_APPENDING,this.onBufferAppending,this),e.on(G.BUFFER_CODECS,this.onBufferCodecs,this),e.on(G.BUFFER_EOS,this.onBufferEos,this),e.on(G.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(G.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(G.FRAG_PARSED,this.onFragParsed,this),e.on(G.FRAG_CHANGED,this.onFragChanged,this),e.on(G.ERROR,this.onError,this)},r.unregisterListeners=function(){var e=this.hls;e.off(G.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(G.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(G.MANIFEST_LOADING,this.onManifestLoading,this),e.off(G.MANIFEST_PARSED,this.onManifestParsed,this),e.off(G.BUFFER_RESET,this.onBufferReset,this),e.off(G.BUFFER_APPENDING,this.onBufferAppending,this),e.off(G.BUFFER_CODECS,this.onBufferCodecs,this),e.off(G.BUFFER_EOS,this.onBufferEos,this),e.off(G.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(G.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(G.FRAG_PARSED,this.onFragParsed,this),e.off(G.FRAG_CHANGED,this.onFragChanged,this),e.off(G.ERROR,this.onError,this)},r.transferMedia=function(){var e=this,t=this.media,r=this.mediaSource;if(!t)return null;var i={};if(this.operationQueue){var n=this.isUpdating();n||this.operationQueue.removeBlockers();var a=this.isQueued();(n||a)&&this.warn("Transfering MediaSource with"+(a?" operations in queue":"")+(n?" updating SourceBuffer(s)":"")+" "+this.operationQueue),this.operationQueue.destroy()}var s=this.transferData;return s&&!this.sourceBufferCount&&s.mediaSource===r?u(i,s.tracks):this.sourceBuffers.forEach((function(t){var r=t[0];r&&(i[r]=u({},e.tracks[r]),e.removeBuffer(r)),t[0]=t[1]=null})),{media:t,mediaSource:r,tracks:i}},r.initTracks=function(){this.resetAppendProgress(),this.sourceBuffers=[[null,null],[null,null]],this.tracks={},this.resetQueue(),this.lastMpegAudioChunk=null,this.lastVideoAppendEnd=0},r.onManifestLoading=function(){this.bufferCodecEventsTotal=0,this.details=null,this.resetAppendErrors(),this.resetAppendProgress()},r.onManifestParsed=function(e,t){var r,i=2;(t.audio&&!t.video||!t.altAudio)&&(i=1),this.bufferCodecEventsTotal=i,this.log(i+" bufferCodec event(s) expected."),null!=(r=this.transferData)&&r.mediaSource&&this.sourceBufferCount&&i&&this.bufferCreated()},r.onMediaAttaching=function(e,t){var r=this.media=t.media;this.transferData=this.overrides=void 0;var i=ye(this.appendSource);if(i){var n=!!t.mediaSource;(n||t.overrides)&&(this.transferData=t,this.overrides=t.overrides);var a=this.mediaSource=t.mediaSource||new i;if(this.assignMediaSource(a),n)this._objectUrl=r.src,this.attachTransferred();else{var s=this._objectUrl=self.URL.createObjectURL(a);if(this.appendSource)try{r.removeAttribute("src");var o=self.ManagedMediaSource;r.disableRemotePlayback=r.disableRemotePlayback||o&&a instanceof o,ms(r),function(e,t){var r=self.document.createElement("source");r.type="video/mp4",r.src=t,e.appendChild(r)}(r,s),r.load()}catch(e){r.src=s}else r.src=s}wn(r,"emptied",this._onMediaEmptied),wn(r,"error",this._onMediaError),this.appendSource&&wn(r,"seeking",this._onStartStreaming)}},r.assignMediaSource=function(e){var t,r;this.log(((null==(t=this.transferData)?void 0:t.mediaSource)===e?"transferred":"created")+" media source: "+(null==(r=e.constructor)?void 0:r.name)),wn(e,"sourceopen",this._onMediaSourceOpen),wn(e,"sourceended",this._onMediaSourceEnded),wn(e,"sourceclose",this._onMediaSourceClose),this.appendSource&&(wn(e,"startstreaming",this._onStartStreaming),wn(e,"endstreaming",this._onEndStreaming))},r.attachTransferred=function(){var e=this,t=this.media,r=this.transferData;if(r&&t){var i=this.tracks,n=r.tracks,a=n?Object.keys(n):null,s=a?a.length:0,o=function(){Promise.resolve().then((function(){e.media&&e.mediaSourceOpenOrEnded&&e._onMediaSourceOpen()}))};if(n&&a&&s){if(!this.tracksReady)return this.hls.config.startFragPrefetch=!0,void this.log("attachTransferred: waiting for SourceBuffer track info");if(this.log("attachTransferred: (bufferCodecEventsTotal "+this.bufferCodecEventsTotal+")\nrequired tracks: "+sr(i,(function(e,t){return"initSegment"===e?void 0:t}))+";\ntransfer tracks: "+sr(n,(function(e,t){return"initSegment"===e?void 0:t}))+"}"),!Ee(n,i)){r.mediaSource=null,r.tracks=void 0;var l=t.currentTime,u=this.details,d=Math.max(l,(null==u?void 0:u.fragments[0].start)||0);return d-l>1?void this.log("attachTransferred: waiting for playback to reach new tracks start time "+l+" -> "+d):(this.warn('attachTransferred: resetting MediaSource for incompatible tracks ("'+Object.keys(n)+'"->"'+Object.keys(i)+'") start time: '+d+" currentTime: "+l),this.onMediaDetaching(G.MEDIA_DETACHING,{}
vendor: 21,472 bytes, line 2
2),this.onMediaAttaching(G.MEDIA_ATTACHING,r),void(t.currentTime=d))}this.transferData=void 0,a.forEach((function(t){var r=t,i=n[r];if(i){var a=i.buffer;if(a){var s=e.fragmentTracker,o=i.id;if(s.hasFragments(o)||s.hasParts(o)){var l=oi.getBuffered(a);s.detectEvictedFragments(r,l,o,null,null,!0)}var u=ys(r),d=[r,a];e.sourceBuffers[u]=d,a.updating&&e.operationQueue&&e.operationQueue.prependBlocker(r),e.trackSourceBuffer(r,i)}}})),o(),this.bufferCreated()}else this.log("attachTransferred: MediaSource w/o SourceBuffers"),o()}},r.onMediaDetaching=function(e,t){var r=this,i=!!t.transferMedia;this.transferData=this.overrides=void 0;var n=this.media,a=this.mediaSource,s=this._objectUrl;if(a){if(this.log("media source "+(i?"transferring":"detaching")),i)this.sourceBuffers.forEach((function(e){var t=e[0];t&&r.removeBuffer(t)})),this.resetQueue();else{if(this.mediaSourceOpenOrEnded){var o="open"===a.readyState;try{for(var l=a.sourceBuffers,u=l.length;u--;)o&&l[u].abort(),a.removeSourceBuffer(l[u]);o&&a.endOfStream()}catch(e){this.warn("onMediaDetaching: "+e.message+" while calling endOfStream")}}this.sourceBufferCount&&this.onBufferReset()}An(a,"sourceopen",this._onMediaSourceOpen),An(a,"sourceended",this._onMediaSourceEnded),An(a,"sourceclose",this._onMediaSourceClose),this.appendSource&&(An(a,"startstreaming",this._onStartStreaming),An(a,"endstreaming",this._onEndStreaming)),this.mediaSource=null,this._objectUrl=null}n&&(An(n,"emptied",this._onMediaEmptied),An(n,"error",this._onMediaError),An(n,"seeking",this._onStartStreaming),i||(s&&self.URL.revokeObjectURL(s),this.mediaSrc===s?(n.removeAttribute("src"),this.appendSource&&ms(n),n.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.media=null)},r.onBufferReset=function(){var e=this;this.sourceBuffers.forEach((function(t){var r=t[0];r&&e.resetBuffer(r)})),this.initTracks()},r.resetBuffer=function(e){var t,r=null==(t=this.tracks[e])?void 0:t.buffer;if(this.removeBuffer(e),r)try{var i;null!=(i=this.mediaSource)&&i.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(r)}catch(t){this.warn("onBufferReset "+e,t)}delete this.tracks[e]},r.removeBuffer=function(e){this.removeBufferListeners(e),this.sourceBuffers[ys(e)]=[null,null];var t=this.tracks[e];t&&(this.clearBufferAppendTimeoutId(t),t.buffer=void 0)},r.resetQueue=function(){this.operationQueue&&this.operationQueue.destroy(),this.operationQueue=new hs(this.tracks)},r.onBufferCodecs=function(e,t){var r,i=this,n=this.tracks,a=Object.keys(t);this.log('BUFFER_CODECS: "'+a+'" (current SB count '+this.sourceBufferCount+")");var s="audiovideo"in t&&(n.audio||n.video)||n.audiovideo&&("audio"in t||"video"in t),o=!s&&this.sourceBufferCount&&this.media&&a.some((function(e){return!n[e]}));s||o?this.warn('Unsupported transition between "'+Object.keys(n)+'" and "'+a+'" SourceBuffers'):(a.forEach((function(e){var r,a,s=t[e],o=s.id,l=s.codec,u=s.levelCodec,d=s.container,c=s.metadata,h=s.supplemental,f=n[e],g=null==(r=i.transferData)||null==(r=r.tracks)?void 0:r[e],v=null!=g&&g.buffer?g:f,p=(null==v?void 0:v.pendingCodec)||(null==v?void 0:v.codec),m=null==v?void 0:v.levelCodec;f||(f=n[e]={buffer:void 0,listeners:[],codec:l,supplemental:h,container:d,levelCodec:u,metadata:c,id:o});var y=Ut(p,m),E=null==y?void 0:y.replace(fs,"$1"),b=Ut(l,u),T=null==(a=b)?void 0:a.replace(fs,"$1");b&&y&&E!==T&&("audio"===e.slice(0,5)&&(b=Nt(b,i.appendSource)),i.log("switching codec "+p+" to "+b),b!==(f.pendingCodec||f.codec)&&(f.pendingCodec=b),f.container=d,i.appendChangeType(e,d,b))})),(this.tracksReady||this.sourceBufferCount)&&(t.tracks=this.sourceBufferTracks),this.sourceBufferCount||(this.bufferCodecEventsTotal>1&&!this.tracks.video&&!t.video&&"main"===(null==(r=t.audio)?void 0:r.id)&&(this.log("Main audio-only"),this.bufferCodecEventsTotal=1),this.mediaSourceOpenOrEnded&&this.checkPendingTracks()))},r.appendChangeType=function(e,t,r){var i=this,n=t+";codecs="+r,a={label:"change-type="+n,execute:function(){var a=i.tracks[e];if(a){var s=a.buffer;null!=s&&s.changeType&&(i.log("changing "+e+" sourceBuffer type to "+n),s.changeType(n),a.codec=r,a.container=t)}i.shiftAndExecuteNext(e)},onStart:function(){},onComplete:function(){},onError:function(t){i.warn("Failed to change "+e+" SourceBuffer type",t)}};this.append(a,e,this.isPending(this.tracks[e]))},r.blockAudio=function(e){var t,r=this,i=e.start,n=i+.05*e.duration;if(!0!==(null==(t=this.fragmentTracker.getAppendedFrag(i,K.MAIN))?void 0:t.gap)){var a={label:"block-audio",execute:function(){var e,t;(r.lastVideoAppendEnd>n||oi.isBuffered(null==(e=r.tracks.video)?void 0:e.buffer,n)||!0===(null==(t=r.fragmentTracker.getAppendedFrag(n,K.MAIN))?void 0:t.gap))&&r.unblockAudio()},onStart:function(){},onComplete:function(){},onError:function(e){r.warn("Error executing block-audio operation",e)}};this.append(a,"audio",!0)}},r.unblockAudio=function(){this.operationQueue&&this.operationQueue.unblockAudio()},r.onBufferAppending=function(e,t){var r=this,i=this.tracks,n=t.data,a=t.type,s=t.parent,o=t.frag,l=t.part,u=t.chunkMeta,d=t.offset,c=u.buffering[a],h=W(o)&&!l&&!o.gap&&!u.partial&&!u.iframe,f=null,g=!1,v=o.sn,p=o.cc,m=self.performance.now();c.start=m;var y=o.stats.buffering,E=l?l.stats.buffering:null;0===y.start&&(y.start=m),0===(null==E?void 0:E.start)&&(E.start=m);var b=i.audio,T=!1;"audio"===a&&"audio/mpeg"===(null==b?void 0:b.container)&&(T=!this.lastMpegAudioChunk||1===u.id||this.lastMpegAudioChunk.sn!==u.sn,this.lastMpegAudioChunk=u);var S=i.video,w=null==S?void 0:S.buffer;if(w&&"initSegment"!==v&&void 0!==d){var A=null==b?void 0:b.buffer,L=l||o;if("audio"===a&&"main"!==s&&!S.ending&&!S.ended&&A&&oi.getBuffered(A).length){var I=L.start+.05*L.duration,k=oi.getBuffered(w),R=this.currentOp("video");k.length||R?!oi.isBuffered(w,I)&&this.lastVideoAppendEnd<I&&this.blockAudio(L):this.blockAudio(L)}else if("video"===a){var D=L.end,C=this.lastVideoAppendEnd-D;this.lastVideoAppendEnd=D,C<0||C>L.duration?this.unblockAudio():this.isAudioBlocked()&&this.executeNext("audio")}}var P=(l||o).start,_={label:"append-"+a,execute:function(){var e;c.executeStart=self.performance.now();var t=null==(e=r.tracks[a])?void 0:e.buffer;t&&(h&&(f=oi.timeRangesToArray(oi.getBuffered(t)),g=Ss(Ts(f,o),o)),T?r.updateTimestampOffset(t,P,.1,a,v,p):void 0!==d&&F(d)&&r.updateTimestampOffset(t,d,1e-6,a,v,p)),r.appendExecutor(n,a)},onStart:function(){},onComplete:function(){r.clearBufferAppendTimeoutId(r.tracks[a]);var e=self.performance.now();c.executeEnd=c.end=e,0===y.first&&(y.first=e),0===(null==E?void 0:E.first)&&(E.first=e);var t={};if(r.sourceBuffers.forEach((function(e){var r=e[0],i=e[1];r&&(t[r]=oi.getBuffered(i))})),h){var i=r.getFragmentAppendProgress(o),n=t[a];if(n&&f){var d=Ts(oi.timeRangesToArray(n),o);i.progressed||(i.progressed=d-Ts(f,o)>.001);var v=g&&Ss(d,o);i.fullyBuffered[a]=(void 0===i.fullyBuffered[a]||i.fullyBuffered[a])&&v}}r.hls.trigger(G.BUFFER_APPENDED,{type:a,frag:o,part:l,chunkMeta:u,parent:s,timeRanges:t})},onError:function(e){var t;r.clearBufferAppendTimeoutId(r.tracks[a]);var i=e.code===DOMException.QUOTA_EXCEEDED_ERR||"QuotaExceededError"==e.name||"quota"in e;if(i&&!r._quotaEvictionPending[a]){var d=r.getBackBufferEvictionTarget(a,n.byteLength,o.type);if(d>0){r._quotaEvictionPending[a]=!0,r.log('QuotaExceededError on "'+a+'" append sn: '+v+" - evicting back buffer to "+d.toFixed(3)+"s and retrying");var c=r.getFlushOp(a,0,d),f=r.getClearEvictionPendingOp(a);return void r.insertNext([c,_,f],a)}r.warn('QuotaExceededError on "'+a+'" sn: '+v+" - no back buffer available to evict")}h&&(r.getFragmentAppendProgress(o).errored=!0);var g={type:B.MEDIA_ERROR,parent:s,details:$.BUFFER_APPEND_ERROR,sourceBufferName:a,frag:o,part:l,chunkMeta:u,error:e,err:e,fatal:!1},p=null==(t=r.media)?void 0:t.error;if(e.name!==gs||0!==r.sourceBufferCount||r.media&&0!==r.pendingTrackCount){var m;i&&(g.details=$.BUFFER_FULL_ERROR);var y=++r.appendErrors[a],E=r.hls.config.appendErrorMaxRetry;r.warn("Failed "+y+"/"+(E+1)+' times to append segment in "'+a+'" sourceBuffer with error: '+e.message),y>=E&&(g.fatal=!i);var b=null==(m=r.mediaSource)?void 0:m.readyState;("ended"===b||"closed"===b||p)&&(r.warn('MediaSource readyState "'+b+'" during SourceBuffer'+Es(g.fatal,p)),g.details=$.MEDIA_SOURCE_REQUIRES_RESET)}else g.errorAction=Nr(!0);r.appendError=g,r.hls.trigger(G.ERROR,g),i&&r.hls&&r.trimBuffers(o.start,1)}};this.log('queuing "'+a+'" append sn: '+v+(l?" p: "+l.index:"")+" of "+s+" playlist "+o.level+" cc: "+p+" offset: "+d+" bytes: "+n.byteLength),this.append(_,a,this.isPending(this.tracks[a]))},r.getClearEvictionPendingOp=function(e){var t=this;return{label:"clear",execute:function(){t._quotaEvictionPending[e]=!1,t.shiftAndExecuteNext(e)},onStart:function(){},onComplete:function(){},onError:function(){}}},r.getFlushOp=function(e,t,r){var i=this;return this.log('queuing "'+e+'" remove '+t+"-"+r),{label:"remove",execute:function(){i.removeExecutor(e,t,r)},onStart:function(){},onComplete:function(){var n,a=null==(n=i.tracks[e])?void 0:n.buffer;i.log("Remove request "+t+"-"+r+" from "+e+" Source Buffer complete > buffer: "+(a?Ln(oi.getBuffered(a)):"(detached)")),i.hls.trigger(G.BUFFER_FLUSHED,{type:e,start:t,end:r})},onError:function(n){i.warn("Failed to remove "+t+"-"+r+' from "'+e+'" SourceBuffer',n),i.hls.trigger(G.BUFFER_FLUSHED,{type:e,start:0,end:0,error:n})}}},r.onBufferFlushing=function(e,t){var r=this,i=t.type,n=t.startOffset,a=t.endOffset;i&&"audio"!==i||this.unblockAudio(),i?this.append(this.getFlushOp(i,n,a),i):this.sourceBuffers.forEach((function(e){var t=e[0];t&&r.append(r.getFlushOp(t,n,a),t)}))},r.onFragParsed=function(e,t){var r=this,i=t.frag,n=t.part,a=t.chunkMeta,s=[],o=n?n.elementaryStreams:i.elementaryStreams;o[j.AUDIOVIDEO]?s.push("audiovideo"):(o[j.AUDIO]&&s.push("audio"),o[j.VIDEO]&&s.push("video")),0===s.length&&this.log("Fragments must have at least one ElementaryStreamType set. "+i.type+" "+i.level+" "+(n?"part: "+n.index+" of ":"")+"sn: "+i.sn),this.blockBuffers((function(){var e=self.performance.now();i.stats.buffering.end=e,n&&(n.stats.buffering.end=e);var t=n?n.stats:i.stats;r.checkAppendProgress(i,n,a,s),r.hls&&(r.hls.trigger(G.FRAG_BUFFERED,{frag:i,part:n,stats:t,id:i.type,chunkMeta:a}),!n&&i.gap&&t.retry&&r.log("Nothing buffered for "+i.type+" level: "+i.level+" sn: "+i.sn+" retries "+t.retry))}),s).catch((function(e){r.warn("Fragment buffered callback "+e.message),r.stepOperationQueue(r.sourceBufferTypes)}))},r.onFragChanged=function(e,t){var r,i,n=this,a=null==(r=this.hls)?void 0:r.config;if(a){var s=a.backBufferLength,o=a.frontBufferFlushThreshold;this.trimBuffers(o,s,t.frag,t.previousFrag);var l=t.frag.elementaryStreams,u=this.appendErrors,d=null==(i=this.appendError)?void 0:i.sourceBufferName;Object.keys(l).forEach((function(e){l[e]&&(u[e]=0,e===d&&(n.appendError=void 0),"audio"===e||"video"===e?(u.audiovideo=0,"audiovideo"===d&&(n.appendError=void 0)):(u.audio=0,u.video=0,"audiovideo"!==d&&(n.appendError=void 0)))}))}},r.onBufferEos=function(e,t){var r,i=this;this.sourceBuffers.forEach((function(e){var r=e[0];if(r){var n=i.tracks[r];t.type&&t.type!==r||(n.ending=!0,n.ended||(n.ended=!0,i.log(r+" buffer reached EOS")))}}));var n=!1!==(null==(r=this.overrides)?void 0:r.endOfStream);this.sourceBufferCount>0&&!this.sourceBuffers.some((function(e){var t,r=e[0];return r&&!(null!=(t=i.tracks[r])&&t.ended)}))?(this.unblockAudio(),n?(this.log("Queueing EOS"),this.blockUntilOpen((function(){i.tracksEnded();var e=i.mediaSource;"open"===(null==e?void 0:e.readyState)?(i.log("Calling mediaSource.endOfStream()"),e.endOfStream(),i.hls.trigger(G.BUFFERED_TO_END,void 0)):e&&i.log("Could not call mediaSource.endOfStream(). mediaSource.readyState: "+e.readyState)}))):(this.tracksEnded(),this.hls.trigger(G.BUFFERED_TO_END,void 0))):"video"===t.type&&this.unblockAudio()},r.tracksEnded=function(){var e=this;this.sourceBuffers.forEach((function(t){var r=t[0];if(null!==r){var i=e.tracks[r];i&&(i.ending=!1)}}))},r.onLevelUpdated=function(e,t){var r=t.details;r.fragments.length&&(this.details=r,this.updateDuration())},r.updateDuration=function(){var e=this;this.blockUntilOpen((function(){var t=e.getDurationAndRange();t&&e.updateMediaSource(t)}))},r.onError=function(e,t){if(t.details===$.BUFFER_APPEND_ERROR&&t.frag){var r,i=null==(r=t.errorAction)?void 0:r.nextAutoLevel;F(i)&&i!==t.frag.level&&this.resetAppendErrors()}},r.getBackBufferEvictionTarget=function(e,t,r){var i=this.media;return i?this.fragmentTracker.getBackBufferEvictionEnd(i.currentTime,r,t):0},r.getFragmentAppendProgress=function(e){var t,r=bs(e),i=this.fragmentAppendProgress[r];return(null==(t=i)?void 0:t.stats)!==e.stats&&(i={stats:e.stats,progressed:!1,errored:!1,fullyBuffered:Object.create(null)},this.fragmentAppendProgress[r]=i),i},r.checkAppendProgress=function(e,t,r,i){if(!(t||!W(e)||e.gap||r.iframe||r.partial)){var n=bs(e),a=this.fragmentAppendProgress[n];delete this.fragmentAppendProgress[n];var s=e.stats.buffering;if(!s.start||s.first){var o=(null==a?void 0:a.stats)===e.stats?a:void 0;if(null==o||!o.errored){var l=i.length>0&&i.every((function(e){return!0===(null==o?void 0:o.fullyBuffered[e])}));if(null!=o&&o.progressed||l)delete this.appendsWithoutProgress[n];else if(o||0!==i.length){var u=(this.appendsWithoutProgress[n]||0)+1,d=this.hls;u>=d.config.appendErrorMaxRetry?delete this.appendsWithoutProgress[n]:this.appendsWithoutProgress[n]=u,this.warn("Fragment "+e.sn+" of "+e.type+" playlist "+e.level+" appended "+u+" time"+(u>1?"s":"")+" without buffered range growth"),d.trigger(G.ERROR,{type:B.MEDIA_ERROR,details:$.BUFFER_APPEND_NO_PROGRESS,fatal:!1,frag:e,chunkMeta:r,parent:e.type,appendsWithoutProgress:u,error:new Error("Fragment append did not increase buffered coverage ("+u+")")})}}}}},r.resetAppendProgress=function(){this.fragmentAppendProgress=Object.create(null),this.appendsWithoutProgress=Object.create(null)},r.resetAppendErrors=function(){this.appendErrors={audio:0,video:0,audiovideo:0},this.appendError=void 0},r.trimBuffers=function(e,t,r,i){var n=this.hls,a=this.details,s=this.media;if(s&&null!==a&&this.sourceBufferCount){var o=n.config,l=s.currentTime,u=a.levelTargetDuration;t=a.live&&null!==o.liveBackBufferLength?o.liveBackBufferLength:t;var d=-1/0;if(F(t)&&t>=0){var c=Math.max(t,u);d=Math.floor(l/u)*u-c}if(r){var h=this.getLoopBackBufferFlushEnd(r,null!=i?i:null);h>0&&(d=Math.max(d,h))}if(d>0&&this.flushBackBuffer(l,u,d),F(e)&&e>0){var f=Math.max(o.maxBufferLength,e),g=Math.max(f,u),v=Math.floor(l/u)*u+g;this.flushFrontBuffer(l,u,v)}}},r.getLoopBackBufferFlushEnd=function(e,t){var r,i=this.media;if(!1===(null==(r=this.hls)?void 0:r.config.loopBackBufferFlush)||null==i||!i.loop||!t||e.level<=t.level)return 0;var n=e.elementaryStreams,a=n.video,s=n.audiovideo;if(null!=a&&a.partial||null!=s&&s.partial)return 0;var o=this.getEarliestElementaryStreamStart(e)-.25;return o<=0?0:(this.log("Flushing lower quality back buffer for loop: level "+e.level+", range [0-"+o.toFixed(3)+"]"),o)},r.getEarliestElementaryStreamStart=function(e){var t=e.elementaryStreams,r=t.audio,i=t.video,n=t.audiovideo,a=e.start;return n?a=Math.min(a,n.startDTS):(r&&(a=Math.min(a,r.startDTS)),i&&(a=Math.min(a,i.startDTS))),a},r.flushBackBuffer=function(e,t,r){var i=this;this.sourceBuffers.forEach((function(e){var t=e[0],n=e[1];if(n){var a=oi.getBuffered(n);if(a.length>0&&r>a.start(0)){var s,o,l;i.hls.trigger(G.BACK_BUFFER_REACHED,{bufferEnd:r});var u=i.tracks[t];if(null!=(s=i.details)&&s.live)i.hls.trigger(G.LIVE_BACK_BUFFER_REACHED,{bufferEnd:r});else if(null!=u&&u.ended&&(null==(o=i.media)||!o.loop||!1===(null==(l=i.hls)?void 0:l.config.loopBackBufferFlush)))return void i.log("Cannot flush "+t+" back buffer while SourceBuffer is in ended state");i.hls.trigger(G.BUFFER_FLUSHING,{startOffset:0,endOffset:r,type:t})}}}))},r.flushFrontBuffer=function(e,t,r){var i=this;this.sourceBuffers.forEach((function(t){var n=t[0],a=t[1];if(a){var s=oi.getBuffered(a),o=s.length;if(o<2)return;var l=s.start(o-1),u=s.end(o-1);if(r>l||e>=l&&e<=u)return;i.hls.trigger(G.BUFFER_FLUSHING,{startOffset:l,endOffset:1/0,type:n})}}))},r.getDurationAndRange=function(){var e,t=this.details,r=this.mediaSource;if(!t||!this.media||"open"!==(null==r?void 0:r.readyState))return null;var i=t.edge;if(t.live&&this.hls.config.liveDurationInfinity){if(t.fragments.length&&r.setLiveSeekableRange){var n=Math.max(0,t.fragmentStart);return{duration:1/0,start:n,end:Math.max(n,i)}}return{duration:1/0}}var a=null==(e=this.overrides)?void 0:e.duration;if(a)return F(a)?{duration:a}:null;var s=this.media.duration;return i>(F(r.duration)?r.duration:0)&&i>s||!F(s)?{duration:i}:null},r.updateMediaSource=function(e){var t=e.duration,r=e.start,i=e.end,n=this.mediaSource;n&&this.media&&"open"===n.readyState&&(n.duration!==t&&(F(t)&&this.log("Updating MediaSource duration to "+t.toFixed(3)),n.duration=t),void 0!==r&&void 0!==i&&(this.log("MediaSource duration is set to "+n.duration+". Setting seekable range to "+r+"-"+i+"."),n.setLiveSeekableRange(r,i)))},r.checkPendingTracks=function(){var e=this.bufferCodecEventsTotal,t=this.pendingTrackCount,r=this.tracks;if(this.log("checkPendingTracks (pending: "+t+" codec events expected: "+e+") "+sr(r)),this.tracksReady){var i,n=null==(i=this.transferData)?void 0:i.tracks;n&&Object.keys(n).length?this.attachTransferred():this.createSourceBuffers()}},r.bufferCreated=function(){var e=this;if(this.sourceBufferCount){var t={};this.sourceBuffers.forEach((function(r){var i=r[0],n=r[1];if(i){var a=e.tracks[i];t[i]={buffer:n,container:a.container,codec:a.codec,supplemental:a.supplemental,levelCodec:a.levelCodec,id:a.id,metadata:a.metadata}}})),this.hls.trigger(G.BUFFER_CREATED,{tracks:t}),this.log("SourceBuffers created. Running queue: "+this.operationQueue),this.sourceBuffers.forEach((function(t){var r=t[0];e.executeNext(r)}))}else{var r=new Error("could not create source buffer for media codec(s)");this.hls.trigger(G.ERROR,{type:B.MEDIA_ERROR,details:$.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:r,reason:r.message})}},r.createSourceBuffers=function(){var e=this.tracks,t=this.sourceBuffers,r=this.mediaSource;if(!r)throw new Error("createSourceBuffers called when mediaSource was null");for(var i in e){var n=i,a=e[n];if(this.isPending(a)){var s=this.getTrackCodec(a,n),o=a.container+";codecs="+s;a.codec=s,this.log("creating sourceBuffer("+o+")"+(this.currentOp(n)?" Queued":"")+" "+sr(a));try{var l=r.addSourceBuffer(o),u=ys(n),d=[n,l];t[u]=d,a.buffer=l}catch(e){var c;return this.error("error while trying to add sourceBuffer: "+e.message),this.shiftAndExecuteNext(n),null==(c=this.operationQueue)||c.removeBlockers(),delete this.tracks[n],void this.hls.trigger(G.ERROR,{type:B.MEDIA_ERROR,details:$.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:e,sourceBufferName:n,mimeType:o,parent:a.id})}this.trackSourceBuffer(n,a)}}this.bufferCreated()},r.clearBufferAppendTimeoutId=function(e){e&&(self.clearTimeout(e.bufferAppendTimeoutId),e.bufferAppendTimeoutId=void 0)},r.getTrackCodec=function(e,t){var r=e.supplemental,i=e.codec;r&&("video"===t||"audiovideo"===t)&&Ct(r,"video")&&(i=function(e,t){var r=[];if(e)for(var i=e.split(","),n=0;n<i.length;n++)Dt(i[n],"video")||r.push(i[n]);return t&&r.push(t),r.join(",")}(i,r));var n=Ut(i,e.levelCodec);return n?"audio"===t.slice(0,5)?Nt(n,this.appendSource):n:""},r.trackSourceBuffer=function(e,t){var r=this,i=t.buffer;if(i){var n=this.getTrackCodec(t,e);this.tracks[e]={buffer:i,codec:n,container:t.container,levelCodec:t.levelCodec,supplemental:t.supplemental,metadata:t.metadata,id:t.id,listeners:[]},this.removeBufferListeners(e),this.addBufferListener(e,"updatestart",this.onSBUpdateStart),this.addBufferListener(e,"updateend",this.onSBUpdateEnd),this.addBufferListener(e,"error",this.onSBUpdateError),this.appendSource&&this.addBufferListener(e,"bufferedchange",(function(e,t){var i=t.removedRanges;null!=i&&i.length&&(r.log(e+" buffer removed "+Ln(i)),r.hls.trigger(G.BUFFER_FLUSHED,{type:e,start:i.start(0),end:i.end(i.length-1)}))}))}},r.onSBUpdateStart=function(e){var t=this.currentOp(e);t&&t.onStart()},r.onSBUpdateEnd=function(e){var t,r,i=this;if("closed"!==(null==(t=this.mediaSource)?void 0:t.readyState)){var n=this.currentOp(e);if(n){if(n.onComplete(),null==(r=this.tracks[e])||null==(r=r.buffer)?void 0:r.updating)return this.log(e+' SourceBuffer updating on "updateend"'),void this.blockUntilOpen((function(){i.shiftAndExecuteNext(e)}));this.shiftAndExecuteNext(e)}}else this.resetBuffer(e)},r.onSBUpdateError=function(e,t){var r,i=null==(r=this.mediaSource)?void 0:r.readyState,n=new Error(e+" SourceBuffer error. MediaSource readyState: "+i);this.error(""+n.message,t),this.hls.trigger(G.ERROR,{type:B.MEDIA_ERROR,details:$.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:n,fatal:!1});var a=this.currentOp(e);a&&a.onError(n)},r.updateTimestampOffset=function(e,t,r,i,n,a){var s=t-e.timestampOffset;Math.abs(s)>=r&&(this.log("Updating "+i+" SourceBuffer timestampOffset to "+t+" (sn: "+n+" cc: "+a+")"),e.timestampOffset=t)},r.removeExecutor=function(e,t,r){var i=this.media,n=this.mediaSource,a=this.tracks[e],s=null==a?void 0:a.buffer;if(!i||!n||!s)throw new Error("Attempting to remove from the "+e+" SourceBuffer, but it does not exist");var o,l=F(i.duration)?i.duration:1/0,u=F(n.duration)?n.duration:1/0,d=Math.max(0,t);if(d>=u)return null==(o=this.currentOp(e))||o.onComplete(),void this.shiftAndExecuteNext(e);var c=Math.min(r,l,u);if(!(c>d)||a.ending&&!a.ended)throw new Error("Cannot remove "+(c<=d?"invali
2d range ("+d+" >= "+c+") ":"")+"from the "+e+" SourceBuffer"+(a.ending?" while track ending":""));a.ended=!1,this.log("Removing ["+d+","+c+"] from the "+e+" SourceBuffer"),s.remove(d,c)},r.appendExecutor=function(e,t){var r=this,i=this.tracks[t],n=null==i?void 0:i.buffer;if(!n)throw new vs("Attempting to append to the "+t+" SourceBuffer, but it does not exist");if(i.ending=!1,i.ended=!1,this.hls.config.appendTimeout!==1/0){var a=this.calculateAppendTimeoutTime(n);i.bufferAppendTimeoutId=self.setTimeout((function(){return r.appendTimeoutHandler(t,n,a)}),a)}n.appendBuffer(e)},r.appendTimeoutHandler=function(e,t,r){this.log("Received timeout after "+r+"ms for append on "+e+" source buffer. Aborting and triggering error.");try{t.abort()}catch(t){this.log("Failed to abort append on "+e+" source buffer after timeout.")}var i=this.currentOp(e);i&&i.onError(new Error(e+"-append-timeout"))},r.calculateAppendTimeoutTime=function(e){var t=10;this.details&&(t=this.details.levelTargetDuration);var r=2*t*1e3;if(null===this.media)return r;var i=oi.bufferInfo(e,this.media.currentTime,0);return i.len?(r=Math.max(1e3*i.len,r),Math.max(this.hls.config.appendTimeout,r)):r},r.blockUntilOpen=function(e){var t=this;if(this.isUpdating()||this.isQueued())this.blockBuffers(e).catch((function(e){t.warn("SourceBuffer blocked callback "+e),t.stepOperationQueue(t.sourceBufferTypes)}));else try{e()}catch(e){this.warn("Callback run without blocking "+this.operationQueue+" "+e)}},r.isUpdating=function(){return this.sourceBuffers.some((function(e){var t=e[0],r=e[1];return t&&r.updating}))},r.isQueued=function(){var e=this;return this.sourceBuffers.some((function(t){var r=t[0];return r&&!!e.currentOp(r)}))},r.isPending=function(e){return!!e&&!e.buffer},r.isAudioBlocked=function(){var e;return"block-audio"===(null==(e=this.currentOp("audio"))?void 0:e.label)},r.isAudioBlocking=function(){return!!this.operationQueue&&this.operationQueue.audioBlocking()},r.blockBuffers=function(e,t){var r=this;if(void 0===t&&(t=this.sourceBufferTypes),!t.length)return this.log("Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(e);var i=this.operationQueue,n=2===t.length&&this.isAudioBlocking()?[this.appendBlocker("video")]:t.map((function(e){return r.appendBlocker(e)}));return Promise.all(n).then((function(t){i===r.operationQueue&&(e(),r.stepOperationQueue(r.sourceBufferTypes))}))},r.stepOperationQueue=function(e){var t=this;e.forEach((function(e){var r,i=null==(r=t.tracks[e])?void 0:r.buffer;!i||i.updating||"audio"===e&&t.isAudioBlocked()||t.shiftAndExecuteNext(e)}))},r.append=function(e,t,r){this.operationQueue&&this.operationQueue.append(e,t,r)},r.insertNext=function(e,t){this.operationQueue&&this.operationQueue.insertNext(e,t)},r.appendBlocker=function(e){if(this.operationQueue)return this.operationQueue.appendBlocker(e)},r.currentOp=function(e){return this.operationQueue?this.operationQueue.current(e):null},r.executeNext=function(e){e&&this.operationQueue&&this.operationQueue.executeNext(e)},r.shiftAndExecuteNext=function(e){this.operationQueue&&this.operationQueue.shiftAndExecuteNext(e)},r.addBufferListener=function(e,t,r){var i=this.tracks[e];if(i){var n=i.buffer;if(n){var a=r.bind(this,e);i.listeners.push({event:t,listener:a}),wn(n,t,a)}}},r.removeBufferListeners=function(e){var t=this.tracks[e];if(t){var r=t.buffer;r&&(t.listeners.forEach((function(e){An(r,e.event,e.listener)})),t.listeners.length=0)}},i(t,[{key:"mediaSourceOpenOrEnded",get:function(){var e,t=null==(e=this.mediaSource)?void 0:e.readyState;return"open"===t||"ended"===t}},{key:"sourceBufferTracks",get:function(){var e=this;return Object.keys(this.tracks).reduce((function(t,r){var i=e.tracks[r];return t[r]={id:i.id,container:i.container,codec:i.codec,levelCodec:i.levelCodec},t}),{})}},{key:"bufferedToEnd",get:function(){var e=this;return this.sourceBufferCount>0&&!this.sourceBuffers.some((function(t){var r=t[0];if(r){var i=e.tracks[r];if(i)return!i.ended||i.ending}return!1}))}},{key:"tracksReady",get:function(){var e=this.pendingTrackCount;return e>0&&(e>=this.bufferCodecEventsTotal||this.isPending(this.tracks.audiovideo))}},{key:"mediaSrc",get:function(){var e,t,r=(null==(e=this.media)||null==(t=e.querySelector)?void 0:t.call(e,"source"))||this.media;return null==r?void 0:r.src}},{key:"pendingTrackCount",get:function(){var e=this;return Object.keys(this.tracks).reduce((function(t,r){return t+(e.isPending(e.tracks[r])?1:0)}),0)}},{key:"sourceBufferCount",get:function(){return this.sourceBuffers.reduce((function(e,t){return e+(t[0]?1:0)}),0)}},{key:"sourceBufferTypes",get:function(){return this.sourceBuffers.map((function(e){return e[0]})).filter((function(e){return!!e}))}}])}(de);function ms(e){var t=e.querySelectorAll("source");[].slice.call(t).forEach((function(t){e.removeChild(t)}))}function ys(e){return"audio"===e?1:0}function Es(e,t){return(e?"":" - triggering recovery")+(t?" with HTMLMediaElement Error: "+t.message:"")}function bs(e){return e.type+"_"+e.sn+"_"+e.level}function Ts(e,t){for(var r=t.start,i=t.end,n=0,a=0;a<e.length;a++){var s=e[a];if(s.start>=i)break;
vendor: 4,368 bytes, line 2
2var o=Math.max(r,s.start),l=Math.min(i,s.end);l>o&&(n+=l-o)}return n}function Ss(e,t){return t.duration-e<=.05}var ws=function(){function e(e){this.hls=null,this.autoLevelCapping=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.observer=void 0,this.clientRect=void 0,this.streamController=void 0,this.hls=e,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.media=null,this.restrictedLevels=[],this.clientRect=null,this.registerListeners()}var t=e.prototype;return t.setStreamController=function(e){this.streamController=e},t.destroy=function(){this.hls&&this.unregisterListener(),(this.timer||this.observer)&&this.stopCapping(),this.media=this.clientRect=this.hls=null,this.streamController=void 0},t.registerListeners=function(){var e=this.hls;e&&(e.on(G.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(G.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(G.MANIFEST_PARSED,this.onManifestParsed,this),e.on(G.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(G.BUFFER_CODECS,this.onBufferCodecs,this),e.on(G.MEDIA_DETACHING,this.onMediaDetaching,this))},t.unregisterListener=function(){var e=this.hls;e&&(e.off(G.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(G.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(G.MANIFEST_PARSED,this.onManifestParsed,this),e.off(G.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(G.BUFFER_CODECS,this.onBufferCodecs,this),e.off(G.MEDIA_DETACHING,this.onMediaDetaching,this))},t.onFpsDropLevelCapping=function(e,t){if(this.hls){var r=this.hls.levels[t.droppedLevel];this.isLevelAllowed(r)&&this.restrictedLevels.push({bitrate:r.bitrate,height:r.height,width:r.width})}},t.onMediaAttaching=function(e,t){var r=t.media;this.clientRect=null,this.hls&&(r instanceof HTMLVideoElement?(this.media=r,this.hls.config.capLevelToPlayerSize&&this.observe()):this.media=null,(this.timer||this.observer)&&this.hls.levels.length>1&&this.detectPlayerSize())},t.onManifestParsed=function(e,t){this.restrictedLevels=[],t.video&&this.startCapping(),this.onLevelsUpdated()},t.onLevelsUpdated=function(){if(this.hls)if((this.timer||this.observer)&&(F(this.autoLevelCapping)||this.clientRect))this.detectPlayerSize();else if(void 0===this.observer&&void 0===this.timer){var e=this.hls.levels;e.length>1&&e.some((function(e){return!!e.videoCodec}))&&this.startCapping()}},t.onBufferCodecs=function(e,t){t.video&&this.startCapping()},t.onMediaDetaching=function(){this.stopCapping(),this.media=null},t.detectPlayerSize=function(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0||!this.hls)return void(this.clientRect=null);var e=this.hls.levels;if(e.length>1){var t=this.hls,r=this.getMaxLevel(e.length-1);r!==this.autoLevelCapping&&t.logger.log("Setting autoLevelCapping to "+r+": "+e[r].height+"p@"+e[r].bitrate+" for media "+this.mediaWidth+"x"+this.mediaHeight),t.autoLevelCapping=r,t.autoLevelEnabled&&t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}else 1===e.length&&this.stopCapping()}},t.getMaxLevel=function(t){var r=this;if(!this.hls)return-1;var i=this.hls.levels;if(!i.length)return-1;var n=i.filter((function(e,i){return r.isLevelAllowed(e)&&i<=t}));return this.observer||(this.clientRect=null),e.getMaxLevelByMediaSize(n,this.mediaWidth,this.mediaHeight)},t.observe=function(){var e=this,t=self.ResizeObserver;t&&(this.observer=new t((function(t){var r,i=null==(r=t[0])?void 0:r.contentRect;i&&(e.clientRect=i,e.detectPlayerSize())}))),this.observer&&this.media&&this.observer.observe(this.media)},t.startCapping=function(){var e;this.timer||this.observer||null==(e=this.hls)||!e.config.capLevelToPlayerSize||(self.clearInterval(this.timer),this.timer=void 0,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.observe(),this.observer||(this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3)),this.detectPlayerSize())},t.stopCapping=function(){this.restrictedLevels=[],this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0),this.observer&&(this.observer.disconnect(),this.observer=void 0)},t.getDimensions=function(){if(this.clientRect)return this.clientRect;var e=this.media,t={width:0,height:0};if(e){var r=e.getBoundingClientRect();t.width=r.width,t.height=r.height,t.width||t.height||(t.width=r.right-r.left||e.
vendor: 4,756 bytes, line 2
2width||0,t.height=r.bottom-r.top||e.height||0)}return this.clientRect=t,t},t.isLevelAllowed=function(e){return!this.restrictedLevels.some((function(t){return e.bitrate===t.bitrate&&e.width===t.width&&e.height===t.height}))},e.getMaxLevelByMediaSize=function(e,t,r){if(null==e||!e.length)return-1;for(var i,n,a=e.length-1,s=Math.max(t,r),o=0;o<e.length;o+=1){var l=e[o];if((l.width>=s||l.height>=s)&&(i=l,!(n=e[o+1])||i.width!==n.width||i.height!==n.height)){a=o;break}}return a},i(e,[{key:"mediaWidth",get:function(){return this.getDimensions().width*this.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*this.contentScaleFactor}},{key:"contentScaleFactor",get:function(){var e=1;if(!this.hls)return e;var t=this.hls.config,r=t.ignoreDevicePixelRatio,i=t.maxDevicePixelRatio;if(!r)try{e=self.devicePixelRatio}catch(e){}return Math.min(e,i)}}])}(),As=function e(t,r){Array.isArray(t)&&(t=t.map((function(t){return t instanceof e?t:new e(t)}))),this.value=t,this.params=r},Ls="Dict";function Is(e,t,r,i){return new Error("failed to "+e+' "'+(n=t,(Array.isArray(n)?JSON.stringify(n):n instanceof Map?"Map{}":n instanceof Set?"Set{}":"object"===a(n)?JSON.stringify(n):String(n))+'" as ')+r,{cause:i});var n}var ks="Bare Item",Rs="Boolean",Ds="Byte Sequence",Cs="Decimal",Ps="Integer",_s="String",xs=/[\x00-\x1f\x7f]+/,Os=function(e){this.description=e},Ms="Token",Fs="Key";function Ns(e,t,r){return Is("serialize",e,t,r)}function Us(e){if(!1===ArrayBuffer.isView(e))throw Ns(e,Ds);return":"+(t=e,btoa(String.fromCharCode.apply(String,t))+":");var t}function Bs(e){if(function(e){return e<-999999999999999||999999999999999<e}(e))throw Ns(e,Ps);return e.toString()}function $s(e){var t=I(e,3);if(Math.floor(Math.abs(t)).toString().length>12)throw Ns(e,Cs);var r=t.toString();return r.includes(".")?r:r+".0"}function Gs(e){var t,r=(t=e).description||t.toString().slice(7,-1);if(!1===/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(r))throw Ns(r,Ms);return r}function Hs(e){switch(a(e)){case"number":if(!F(e))throw Ns(e,ks);return Number.isInteger(e)?Bs(e):$s(e);case"string":return function(e){if(xs.test(e))throw Ns(e,_s);return'"'+e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')+'"'}(e);case"symbol":return Gs(e);case"boolean":return function(e){if("boolean"!=typeof e)throw Ns(e,Rs);return e?"?1":"?0"}(e);case"object":if(e instanceof Date)return function(e){return"@"+Bs(e.getTime()/1e3)}(e);if(e instanceof Uint8Array)return Us(e);if(e instanceof Os)return Gs(e);default:throw Ns(e,ks)}}function Vs(e){if(!1===/^[a-z*][a-z0-9\-_.*]*$/.test(e))throw Ns(e,Fs);return e}function Ks(e){return null==e?"":Object.entries(e).map((function(e){var t=e[0],r=e[1];return!0===r?";"+Vs(t):";"+Vs(t)+"="+Hs(r)})).join("")}function js(e){return e instanceof As?""+Hs(e.value)+Ks(e.params):Hs(e)}function qs(e,t){var r;if(void 0===t&&(t={whitespace:!0}),"object"!==a(e)||null==e)throw Ns(e,Ls);var i=e instanceof Map?e.entries():Object.entries(e),n=null!=(r=t)&&r.whitespace?" ":"";return Array.from(i).map((function(e){var t=e[0],r=e[1];r instanceof As==0&&(r=new As(r));var i,n=Vs(t);return!0===r.value?n+=Ks(r.params):(n+="=",Array.isArray(r.value)?n+="("+(i=r).value.map(js).join(" ")+")"+Ks(i.params):n+=js(r)),n})).join(","+n)}function Ws(e,t){return qs(e,t)}var Ys,zs=["url"],Qs=["version","eventTargets","sid","transmissionMode"],Xs=["customData","headers"],Js=function(e){return e instanceof As?new As(Math.round(e.value),e.params):Math.round(e)},Zs=function(e){return Array.isArray(e)?e.map(Js):Js(e)},eo=function(e,t){return Array.isArray(e)?e.map((function(e){return eo(e,t)})):e instanceof As&&"string"==typeof e.value?new As(eo(e.value,t),e.params):(t.baseUrl&&(e=function(e,t){var r;try{r=new URL(e)}catch(t){return e}var i=new URL(t);if(r.origin!==i.origin)return e;for(var n=r.pathname.split("/").slice(1),a=i.pathname.split("/").slice(1,-1),s=Math.min(n.length,a.length),o=0;o<s&&n[o]===a[o];o++)n.shift(),a.shift();for(;a.length;)a.shift(),n.unshift("..");return n.join("/")+r.search+r.hash}(e,(r=t.baseUrl,(i="string"==typeof r?new URL(r):r).origin+i.pathname.substring(0,i.pathname.lastIndexOf("/")+1)))),1===t.version?encodeURIComponent(e):e);var r,i},to=function(e){return e instanceof As?new As(100*Math.round(e.value/100),e.params):100*Math.round(e/100)},ro=function(e){return Array.isArray(e)?e.map(to):to(e)},io={br:Zs,d:Zs,bl:ro,dl:ro,mtp:ro,nor:function(e,t){var r=e;return t.version>=2&&(e instanceof As&&"string"==typeof e.value?r=new As([e]):"string"==typeof e&&(r=[e])),eo(r,t)},rtp:ro,tb:Zs},no=2,ao="pr",so="b",oo="rr",lo="ce",uo="bc",co="e",ho=oo,fo=lo,go=new Map([["ps","sta"],[ao,"pr"],["c","cid"],[so,"bg"],["bc","br"]]),vo="event",po="request",mo=["cen","e","h","ts"],yo=["ab","bg","bl","br","bs","b
2sa","bsd","bsda","cdn","cid","cs","d","dfa","dl","ec","lab","lb","ltc","msd","mtp","nor","nr","ot","pb","pr","pt","rtp","sf","sid","sn","st","sta","su","tab","tb","tbl","tpb","v"],Eo=/^[a-zA-Z0-9-.]+-[a-zA-Z0-9-.]+$/;function bo(e){return Eo.test(e)}var To=new Set(yo);function So(e){return To.has(e)||bo(e)}var wo=["cmsdd","cmsds","rc","smrt","ttfb","ttfbb","ttlb","url"],Ao=new Set(wo);function Lo(e){return Ao.has(e)}var Io=new Set(mo),ko=new Set(["ab","bl","br","bsa","bsd","bsda","lab","lb","mtp","pb","tab","tb","tbl","tpb"]),Ro=["bl","br","bs","cid","d","dl","mtp","nor","nrr","ot","pr","rtp","sf","sid","st","su","tb","v"],Do=new Set(Ro);function Co(e){return Do.has(e)||bo(e)}var Po=new Set(["ot","sf","st","e","sta"]);function _o(e){return Po.has(e)}function xo(e){return"number"==typeof e?F(e):null!=e&&""!==e&&!1!==e}var Oo=((Ys={})[vo]=function(e){return So(e)||Lo(e)||Io.has(e)},Ys[po]=So,Ys);function Mo(e,t){var r;return Array.isArray(e)?(t&&(r=e.find((function(e){var r;return(null==(r=e.params)?void 0:r.ot)===t}))),r||(r=e[0]),Mo(r)):e instanceof As?e.value:e}function Fo(e,t){void 0===t&&(t={});var r={};if(null==e||"object"!==a(e))return r;var i=t.version||e.v||no,s=t.reportingMode||po,o=1===i?function(e){for(var t={},r=0,i=Object.entries(e);r<i.length;r++){var n=i[r],a=n[0],s=n[1];if(null!=s)if("nor"===a){var o,l=(Array.isArray(s)?s:[s])[0];l instanceof As?(t.nor=l.value,null!=(o=l.params)&&o.r&&(t.nrr=l.params.r)):t.nor=l}else ko.has(a)?t[a]=Mo(s,e.ot):t[a]=s;else t[a]=s}return t}(e):e,l=1===i?Co:Oo[s],u=Object.keys(o).filter(l);o.e&&o.e!==oo&&(u=u.filter((function(e){return!Lo(e)})));var d=t.filter;"function"==typeof d&&(u=u.filter(d));var c=s===vo;if(c){var h=o.e;u.includes("e")||null==h||u.push("e"),u.includes("ts")||u.push("ts"),u.includes("cen")||null==o.cen||h!==lo||u.push("cen");var f=h?go.get(h):void 0;f&&null!=o[f]&&!u.includes(f)&&u.push(f)}if(0===u.length)return r;i>1&&!u.includes("v")&&u.push("v");var g={version:i,reportingMode:s,baseUrl:t.baseUrl};u.sort();for(var v,p=n(u);!(v=p()).done;){var m,y,E=v.value,b=o[E],T=null!=(m=null==(y=t.formatters)?void 0:y[E])?m:io[E];if("function"==typeof T&&(b=T(b,g)),"v"===E){if(1===i)continue;b=i}if("pr"!==E||1!==b||c&&o.e===ao){c&&"ts"===E&&!F(b)&&(b=Date.now());var S=c&&!1===b&&"bg"===E&&o.e===so;(xo(b)||S)&&(_o(E)&&"string"==typeof b&&(b=new Os(b)),r[E]=b)}}return r}var No="CMCD-Object",Uo="CMCD-Request",Bo="CMCD-Session",$o="CMCD-Status",Go={REQUEST:Uo},Ho={ab:No,br:No,d:No,lab:No,lb:No,ot:No,tab:No,tb:No,tpb:No,bl:Uo,cs:Uo,dfa:Uo,dl:Uo,ltc:Uo,mtp:Uo,nor:Uo,nrr:Uo,pb:Uo,sn:Uo,sta:Uo,su:Uo,tbl:Uo,cid:Bo,msd:Bo,sf:Bo,sid:Bo,st:Bo,v:Bo,bg:$o,bs:$o,bsa:$o,bsd:$o,bsda:$o,cdn:$o,ec:$o,nr:$o,pr:$o,pt:$o,rtp:$o};function Vo(e,t){var r={};if(!e)return r;for(var i,n=Object.keys(e),a=t?(i=t,Object.keys(i).reduce((function(e,t){var r;return null==(r=i[t])||r.forEach((function(r){return e[r]=t})),e}),{})):{},s=0,o=n;s<o.length;s++){var l,u=o[s],d=Ho[u]||a[u]||Go.REQUEST;(null!=(l=r[d])?l:r[d]={})[u]=e[u]}return r}var Ko="CMCD";function jo(e){return Ws(e,{whitespace:!1})}function qo(e,t){return void 0===t&&(t={}),e?jo(Fo(e,t)):""}var Wo=[].concat(Ro,yo,wo,mo).filter((function(e,t,r){return r.indexOf(e)===t})),Yo="m",zo="a",Qo="v",Xo="av",Jo="i",Zo="tt",el="s",tl="p",rl="k",il="r",nl="a",al="e",sl="f",ol="d",ll="query",ul="headers";function dl(e,t,r){var i,n=new Set(null!=(i=t.enabledKeys)?i:[]);return{version:t.version||no,reportingMode:e,filter:function(e){return n.has(e)},baseUrl:r}}var cl=Object.is,hl=function(e){return e},fl=Array.from(go,(function(e){var t=e[0],r=e[1];return"br"===r?{event:t,field:r,equal:function(e,t){return void 0===e||void 0===t?e===t:function(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++){var i=e[r],n=t[r];if(i!==n){if("number"==typeof i||"number"==typeof n)return!1;if(i.value!==n.value)return!1;var a=i.params,s=n.params,o=a&&Object.keys(a)[0],l=s&&Object.keys(s)[0];if(o!==l)return!1;if(void 0!==o&&void 0!==l&&a&&s&&a[o]!==s[l])return!1}}return!0}(e,t)},snapshot:function(e){return e.slice()}}:{event:t,field:r,equal:cl,snapshot:hl}})),gl=new Map(fl.map((function(e){return[e.event,e]})));function vl(e){var t=e.url,r=v(e,zs);return fetch(t,r)}var pl=function(){function e(e,t){var r;void 0===t&&(t=vl),this.timeOrigin=performance.timeOrigin||(null==(r=performance.timing)?void 0:r.fetchStart)||Date.now()-performance.now(),this.data={},this.msd=NaN,this.eventTargets=new Map,this.lastEmitted={},this.requestTarget={sn:0,msdSent:!1},this.config=function(e){var t=e.version,r=void 0===t?no:t,i=e.eventTargets,n=void 0===i?[]:i,a=e.sid,s=void 0===a?k():a,o=e.transmissionMode,l=void 0===o?ll:o;return g(g({},v(e,Qs)),{},{version:r,transmissionMode:l,sid:s,eventTargets:n.reduce((function(e,t){var r,i,n;return null!=t&&t.url&&null!=(r=t.events)&&r.length&&e.push({version:t.version||no,enabledKeys:(null==(i=t.enabledKeys)?void 0:i.slice())||[],url:t.url,events:t.events.slice(),interval:null!=(n=t.interval)?n:30,batchSize:t.batchSize||1}),e}),[])})}(e),this.data={cid:this.config.cid,sid:this.config.sid,v:this.config.version},this.requester=t;for(var i,a=n(this.config.eventTargets);!(i=a()).done;){var s=i.value;this.eventTargets.set(s,{intervalId:void 0,sn:0,msdSent:!1,queue:[]})}}
vendor: 69,907 bytes, line 2
2var r=e.prototype;return r.start=function(){var e=this;this.eventTargets.forEach((function(t,r){if(e.disarmInterval(t),0!==r.interval&&r.events.includes("t")){var i=function(){e.recordTargetEvent(t,r,"t"),e.processEventTargets()};t.intervalId=setInterval(i,1e3*r.interval),i()}}))},r.stop=function(e){var t=this;void 0===e&&(e=!1),e&&this.flush(),this.eventTargets.forEach((function(e){t.disarmInterval(e)}))},r.flush=function(){this.processEventTargets(!0)},r.update=function(e){e.sid&&e.sid!==this.data.sid&&this.resetSession(),e.msd&&!isNaN(e.msd)&&(this.msd=e.msd),this.data=g(g(g({},this.data),e),{},{msd:void 0});for(var t=0,r=fl;t<r.length;t++){var i=r[t];i.field in e&&!i.equal(this.data[i.field],this.lastEmitted[i.field])&&this.recordEvent(i.event)}},r.recordEvent=function(e,t){var r=this;void 0===t&&(t={});var i=gl.get(e);if(i){var n,a,s=i.field,o=t[s];void 0!==o&&u(this.data,((n={})[s]=o,n));var l=this.data[s];if(void 0===l)return;if(i.equal(l,this.lastEmitted[s]))return;u(this.lastEmitted,((a={})[s]=i.snapshot(l),a))}this.eventTargets.forEach((function(i,n){r.recordTargetEvent(i,n,e,t)})),this.processEventTargets()},r.recordTargetEvent=function(e,t,r,i){var n;if(void 0===i&&(i={}),t.events.includes(r)){var a=g(g(g({},this.data),i),{},{e:r,ts:null!=(n=i.ts)?n:Date.now(),sn:e.sn++});isNaN(this.msd)||e.msdSent||(a.msd=this.msd,e.msdSent=!0),e.queue.push(a)}},r.recordResponseReceived=function(e,t){var r,i,n;void 0===t&&(t={});var a=e.request,s=null!=(r=t.url)?r:null==a?void 0:a.url;if(s){var o=new URL(s);o.searchParams.delete(Ko);var l={url:o.toString(),rc:e.status},u=e.resourceTiming;u&&(null!=u.startTime&&(l.ts=Math.round(this.timeOrigin+u.startTime),null!=u.responseStart&&(l.ttfb=Math.round(u.responseStart-u.startTime))),null!=u.duration&&(l.ttlb=Math.round(u.duration)));var d=null!=(i=null==(n=a.customData)?void 0:n.cmcd)?i:{};this.recordEvent(oo,g(g(g({},d),l),t))}},r.applyRequestReport=function(e){var t;return null!=(t=this.createRequestReport(e))?t:e},r.isRequestReportingEnabled=function(){var e;return!(null==(e=this.config.enabledKeys)||!e.length)},r.createRequestReport=function(e,t){var r,i=e.customData,n=void 0===i?{}:i,a=e.headers,s=void 0===a?{}:a,o=g(g({},v(e,Xs)),{},{headers:g({},s),customData:g(g({},n),{},{cmcd:{}})});if(null==(r=this.config.enabledKeys)||!r.length||!o.url)return o;var l=new URL(o.url),d=g(g(g({},this.data),t),{},{sn:this.requestTarget.sn++}),c=dl(po,this.config,o.url);isNaN(this.msd)||this.requestTarget.msdSent||(d.msd=this.msd,this.requestTarget.msdSent=!0);var h=o.customData.cmcd=Fo(d,c);switch(this.config.transmissionMode){case ll:var f=jo(h);f&&(l.searchParams.set(Ko,f),o.url=l.toString());break;case ul:u(o.headers,function(e,t){for(var r={},i=Vo(e,t),n=0,a=Object.entries(i);n<a.length;n++){var s=a[n],o=s[0],l=Ws(s[1],{whitespace:!1});l&&(r[o]=l)}return r}(h,c.customHeaderMap))}return o},r.processEventTargets=function(e){var t=this;void 0===e&&(e=!1);var r=!1;this.eventTargets.forEach((function(i,n){var a=i.queue;if(a.length&&(!(a.length<n.batchSize)||e)){var s=e?a.length:n.batchSize,o=a.splice(0,s);t.sendEventReport(n,o).catch((function(){var e;(e=i.queue).unshift.apply(e,o)})),r||(r=a.length>0)}})),r&&this.processEventTargets()},r.sendEventReport=function(){var e,r=(e=p().m((function e(t,r){var i,n,a;return p().w((function(e){for(;;)switch(e.n){case 0:return i=dl(vo,t),e.n=1,this.requester({url:t.url,method:"POST",headers:{"Content-Type":"application/cmcd"},body:r.map((function(e){return qo(e,i)})).join("\n")+"\n"});case 1:if(n=e.v,410!==(a=n.status)){e.n=2;break}this.disposeEventTarget(t),e.n=3;break;case 2:if(!(429===a||a>499&&a<600)){e.n=3;break}throw new Error("Event report failed with status "+a);case 3:return e.a(2)}}),e,this)})),function(){var r=this,i=arguments;return new Promise((function(n,a){var s=e.apply(r,i);function o(e){t(s,n,a,o,l,"next",e)}function l(e){t(s,n,a,o,l,"throw",e)}o(void 0)}))});return function(e,t){return r.apply(this,arguments)}}(),r.disarmInterval=function(e){clearInterval(e.intervalId),e.intervalId=void 0},r.disposeEventTarget=function(e){var t=this.eventTargets.get(e);t&&(this.disarmInterval(t),this.eventTargets.delete(e))},r.resetSession=function(){this.eventTargets.forEach((function(e){return e.sn=0})),this.requestTarget.sn=0,this.lastEmitted={}},e}(),ml="h",yl="v",El="l",bl="ll";new Set(Ro),new Set(Wo);var Tl=["includeKeys"];function Sl(e){return Object.keys(e).every(bo)}var wl=function(){function e(e){var t=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.initialized=!1,this.starved=!1,this.buffering=!0,this.playerState=void 0,this.reporter=void 0,this.playheadLevel=void 0,this.onWaiting=function(){t.initialized&&(t.starved=!0,t.setPlayerState(il)),t.buffering=!0},this.onPlay=function(){t.initialized||t.setPlayerState(el)},this.onPlaying=function(){t.initialized||(t.initialized=!0),t.buffering=!1,t.setPlayerState(tl)},this.onPause=function(){t.media&&!t.media.ended&&t.setPlayerState(nl)},this.onSeeking=function(){t.initialized&&t.setPlayerState(rl)},this.onSeeked=function(){var e;t.initialized&&null!=(e=t.media)&&e.paused&&t.setPlayerState(nl)},this.onRateChange=function(){t.reporter&&t.media&&t.reporter.update({pr:t.media.playbackRate})},this.applyPlaylistData=function(e){try{t.apply(e,{ot:Yo,su:!t.initialized})}catch(e){t.hls.logger.warn("Could not generate manifest CMCD data.",e)}},this.applyFragmentData=function(e){try{var r=e.frag,i=e.part,n=t.hls.levels[r.level],a=t.getObjectType(r,n),s={d:1e3*(i||r).duration,ot:a};if(a===Qo||a===zo||a===Xo||null==a&&("main"===r.type||"audio"===r.type)){var o,l=n.bitrate/1e3;s.br=[l];var u=t.config.cmcd,d=null!=(o=null==u?void 0:u.rtpSafetyFactor)?o:5;if(s.rtp=100*Math.round(l*d/100),a===Xo||null==a&&"main"===r.type){var c=t.getTopBandwidth()/1e3;F(c)&&(s.tb=[c]);var h=t.getLowestBandwidth()/1e3;F(h)&&(s.lb=[h])}var f=t.getBufferLength(r);if(F(f)){var g;s.bl=[f];var v=(null==(g=t.media)?void 0:g.playbackRate)||1;s.dl=100*Math.round(f/v/100)}t.playheadLevel&&(s.pb=[t.playheadLevel.bitrate/1e3]);var p=t.hls.maxAutoLevel;if(p>=0){var m=t.hls.levels[p];m&&(s.tpb=[m.bitrate/1e3])}}var y=i?t.getNextPart(i):t.getNextFrag(r);null!=y&&y.url&&y.url!==r.url&&(y.byteRange.length>0?s.nor=[(E=y.url,b={r:y.byteRange[0]+"-"+y.byteRange[1]},new As(E,b))]:s.nor=[y.url]),t.apply(e,s)}catch(e){t.hls.logger.warn("Could not generate segment CMCD data.",e)}var E,b},this.recordFragmentResponse=function(e,r,i){var n,a=t.config.cmcd,s=null==a||null==(n=a.eventTargets)?void 0:n.some((function(e){var t;return null==(t=e.events)?void 0:t.includes(ho)}));if(t.reporter&&i.loading.first>0&&s)try{t.reporter.recordResponseReceived({request:{url:e},status:r.code,resourceTiming:{startTime:i.loading.start,responseStart:i.loading.first,duration:i.loading.end-i.loading.start,encodedBodySize:i.total}})}catch(e){t.hls.logger.warn("Could not record fragment response CMCD data.",e)}},this.hls=e;var r=this.config=e.config;null!=r.cmcd&&(r.pLoader=this.createPlaylistLoader(),r.fLoader=this.createFragmentLoader(),this.registerListeners())}var t=e.prototype;return t.createReporter=function(){var e,t,r=this.config.cmcd;if(null!=r){var i=r.version||1;if(this.reporter=new pl({sid:r.sessionId||this.hls.sessionId,cid:r.contentId,version:i,transmissionMode:!0===r.useHeaders?ul:ll,enabledKeys:null!=(e=r.includeKeys)?e:[].concat(i>=no?Wo:Ro),eventTargets:(null!=(t=r.eventTargets)?t:[]).map((function(e){var t=e.includeKeys;return g(g({},v(e,Tl)),{},{enabledKeys:null!=t?t:Wo})}))},r.loader),this.reporter.update({sf:ml,sta:this.playerState}),r.reporterCallback){var n=this.reporter,a={updateCustomData:function(e){Sl(e)&&n.update(e)},recordCustomEvent:function(e,t){void 0===t&&(t={}),Sl(t)&&n.recordEvent(fo,g({cen:e},t))}};r.reporterCallback(a)}this.reporter.start()}},t.registerListeners=function(){var e=this.hls;e.on(G.MANIFEST_LOADING,this.onManifestLoading,this),e.on(G.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(G.MEDIA_DETACHED,this.onMediaDetached,this),e.on(G.MEDIA_ENDED,this.onMediaEnded,this),e.on(G.ERROR,this.onError,this),e.on(G.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(G.LEVEL_SWITCHED,this.onLevelSwitched,this),e.on(G.BUFFER_APPENDED,this.onBufferInfoChange,this),e.on(G.BUFFER_FLUSHED,this.onBufferInfoChange,this)},t.unregisterListeners=function(){var e=this.hls;e.off(G.MANIFEST_LOADING,this.onManifestLoading,this),e.off(G.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(G.MEDIA_DETACHED,this.onMediaDetached,this),e.off(G.MEDIA_ENDED,this.onMediaEnded,this),e.off(G.ERROR,this.onError,this),e.off(G.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(G.LEVEL_SWITCHED,this.onLevelSwitched,this),e.off(G.BUFFER_APPENDED,this.onBufferInfoChange,this),e.off(G.BUFFER_FLUSHED,this.onBufferInfoChange,this)},t.destroy=function(){this.unregisterListeners(),this.onMediaDetached(),this.reporter&&(this.reporter.stop(!0),this.reporter=void 0),this.hls=this.config=null,this.onWaiting=this.onPlay=this.onPlaying=this.onPause=null,this.onSeeking=this.onSeeked=this.onRateChange=this.media=null},t.onMediaAttaching=function(e,t){var r=this.media=t.media;this.setPlayerState(this.media.autoplay?el:ol),wn(r,"waiting",this.onWaiting),wn(r,"play",this.onPlay),wn(r,"playing",this.onPlaying),wn(r,"pause",this.onPause),wn(r,"seeking",this.onSeeking),wn(r,"seeked",this.onSeeked),wn(r,"ratechange",this.onRateChange)},t.onMediaDetached=function(){var e=this.media;e&&(An(e,"waiting",this.onWaiting),An(e,"play",this.onPlay),An(e,"playing",this.onPlaying),An(e,"pause",this.onPause),An(e,"seeking",this.onSeeking),An(e,"seeked",this.onSeeked),An(e,"ratechange",this.onRateChange),this.media=null)},t.onMediaEnded=function(e,t){this.setPlayerState(al)},t.onManifestLoading=function(e,t){this.initialized=!1,this.starved=!1,this.buffering=!0,this.reporter&&(this.reporter.stop(!0),this.reporter=void 0),this.createReporter(),this.media||this.setPlayerState(ol)},t.onError=function(e,t){t.fatal&&(this.setPlayerState(sl),this.reporter&&this.reporter.recordEvent(co,{ec:[t.details]}))},t.onLevelSwitching=function(e,t){var r;if(this.reporter){var i={br:[t.bitrate/1e3]},n=null==(r=t.details)?void 0:r.fragments[0];n&&(i.ot=this.getObjectType(n,t)),this.reporter.recordEvent(uo,i)}},t.onLevelSwitched=function(e,t){var r=this.hls.levels[t.level];r&&(this.playheadLevel=r)},t.setPlayerState=function(e){this.playerState=e,this.reporter&&this.reporter.update({sta:e})},t.getStreamType=function(){var e=this.hls.latestLevelDetails;if(e)return e.live?e.partList&&e.canBlockReload?bl:El:yl},t.apply=function(e,t){var r;if(void 0===t&&(t={}),this.reporter){this.reporter.update({mtp:[this.hls.bandwidthEstimate/1e3],pr:null==(r=this.media)?void 0:r.playbackRate,st:this.getStreamType()});var i=t.ot===Jo||t.ot===Qo||t.ot===Xo;this.starved&&i&&(t.bs=!0,t.su=!0,this.starved=!1),null==t.su&&(t.su=this.buffering);var n=this.reporter.createRequestReport({url:e.url,headers:e.headers},t);e.url=n.url,e.headers=n.headers}},t.getNextFrag=function(e){var t,r=null==(t=this.hls.levels[e.level])?void 0:t.details;if(r){var i=e.sn-r.startSN;return r.fragments[i+1]}},t.getNextPart=function(e){var t,r=e.index,i=e.fragment,n=null==(t=this.hls.levels[i.level])||null==(t=t.details)?void 0:t.partList;if(n)for(var a=i.sn,s=n.length-1;s>=0;s--){var o=n[s];if(o.index===r&&o.fragment.sn===a)return n[s+1]}},t.getObjectType=function(e,t){var r=e.type;if("subtitle"===r)return Zo;if("initSegment"===e.sn)return Jo;if("audio"===r)return zo;if("main"===r){if(e.hasStreams){var i=e.elementaryStreams;if(i.audiovideo)return Xo;if(i.video)return Qo;if(i.audio)return zo}if(t){var n=t.audioCodec,a=t.videoCodec;if(!this.hls.audioTracks.length){if(n&&a)return Xo;if(n)return zo}if(a)return Qo}}},t.getTopBandwidth=function(){var e=0,t=this.hls,r=t.maxAutoLevel,i=r>-1?r+1:t.levels.length;return t.levels.slice(0,i).forEach((function(t){t.bitrate>e&&(e=t.bitrate)})),e>0?e:NaN},t.getLowestBandwidth=function(){var e=1/0,t=this.hls,r=t.maxAutoLevel,i=r>-1?r+1:t.levels.length;return t.levels.slice(0,i).forEach((function(t){t.bitrate<e&&(e=t.bitrate)})),F(e)?e:NaN},t.getBufferLength=function(e){if(!this.media)return NaN;var t="audio"===e.type?this.hls.audioForwardBufferInfo:this.hls.mainForwardBufferInfo;return t?1e3*t.len:NaN},t.getEventBufferLength=function(){if(!this.media)return NaN;var e=this.hls.mainForwardBufferInfo,t=this.hls.audioForwardBufferInfo;if(e&&t)return 1e3*Math.min(e.len,t.len);var r=e||t;return r?1e3*r.len:NaN},t.onBufferInfoChange=function(e,t){if(this.reporter){var r=this.getEventBufferLength();F(r)&&this.reporter.update({bl:[r]})}},t.createPlaylistLoader=function(){var e=this.config.pLoader,t=this.applyPlaylistData,r=e||this.config.loader;return function(){function e(e){this.loader=void 0,this.loader=new r(e)}var n=e.prototype;return n.destroy=function(){this.loader.destroy()},n.abort=function(){this.loader.abort()},n.load=function(e,r,i){t(e),this.loader.load(e,r,i)},i(e,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}])}()},t.createFragmentLoader=function(){var e=this.config.fLoader,t=this.applyFragmentData,r=this.recordFragmentResponse,n=e||this.config.loader;return function(){function e(e){this.loader=void 0,this.loader=new n(e)}var a=e.prototype;return a.destroy=function(){this.loader.destroy()},a.abort=function(){this.loader.abort()},a.load=function(e,i,n){t(e);var a=n.onSuccess;this.loader.load(e,i,g(g({},n),{},{onSuccess:function(t,i,n,s){a(t,i,n,s),r(e.url,t,i)}}))},i(e,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}])}()},e}(),Al=function(e){function t(t){var r;return(r=e.call(this,"content-steering",t.logger)||this).hls=void 0,r.loader=null,r.uri=null,r.pathwayId=".",r._pathwayPriority=null,r.timeToLoad=300,r.reloadTimer=-1,r.updated=0,r.started=!1,r.enabled=!0,r.levels=null,r.audioTracks=null,r.subtitleTracks=null,r.penalizedPathways={},r.hls=t,r.registerListeners(),r}c(t,e);var r=t.prototype;return r.registerListeners=function(){var e=this.hls;e.on(G.MANIFEST_LOADING,this.onManifestLoading,this),e.on(G.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(G.MANIFEST_PARSED,this.onManifestParsed,this),e.on(G.ERROR,this.onError,this)},r.unregisterListeners=function(){var e=this.hls;e&&(e.off(G.MANIFEST_LOADING,this.onManifestLoading,this),e.off(G.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(G.MANIFEST_PARSED,this.onManifestParsed,this),e.off(G.ERROR,this.onError,this))},r.pathways=function(){return(this.levels||[]).reduce((function(e,t){return-1===e.indexOf(t.pathwayId)&&e.push(t.pathwayId),e}),[])},r.startLoad=function(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){var e=1e3*this.timeToLoad-(performance.now()-this.updated);if(e>0)return void this.scheduleRefresh(this.uri,e)}this.loadSteeringManifest(this.uri)}},r.stopLoad=function(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()},r.clearTimeout=function(){-1!==this.reloadTimer&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)},r.destroy=function(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null},r.removeLevel=function(e){var t=this.levels;t&&(this.levels=t.filter((function(t){return t!==e})))},r.onManifestLoading=function(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null},r.onManifestLoaded=function(e,t){var r=t.contentSteering;null!==r&&(this.pathwayId=r.pathwayId,this.uri=r.uri,this.started&&this.startLoad())},r.onManifestParsed=function(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks},r.onError=function(e,t){var r=t.errorAction;if((null==r?void 0:r.action)===Lr&&r.flags&Dr){var i=this.levels,n=this._pathwayPriority,a=this.pathwayId;if(t.context){var s=t.context,o=s.groupId,l=s.pathwayId,u=s.type;o&&i?a=this.getPathwayForGroupId(o,u,a):l&&(a=l)}a in this.penalizedPathways||(this.penalizedPathways[a]=performance.now()),!n&&i&&(n=this.pathways()),n&&n.length>1&&(this.updatePathwayPriority(n),r.resolved=this.pathwayId!==a,r.resolved||t.details===$.BUFFER_APPEND_ERROR&&!t.fatal||this.warn("Could not resolve "+t.details+' ("'+t.error.message+'") with content-steering for Pathway: '+a+" levels: "+(i?i.length:i)+" priorities: "+sr(n)+" penalized: "+sr(this.penalizedPathways)))}},r.filterParsedLevels=function(e){this.levels=e;var t=this.getLevelsForPathway(this.pathwayId);if(0===t.length){var r=e[0].pathwayId;this.log("No levels found in Pathway "+this.pathwayId+'. Setting initial Pathway to "'+r+'"'),t=this.getLevelsForPathway(r),this.pathwayId=r}return t.length!==e.length&&this.log("Found "+t.length+"/"+e.length+' levels in Pathway "'+this.pathwayId+'"'),t},r.getLevelsForPathway=function(e){return null===this.levels?[]:this.levels.filter((function(t){return e===t.pathwayId}))},r.updatePathwayPriority=function(e){var t;this._pathwayPriority=e;var r=this.penalizedPathways,i=performance.now();Object.keys(r).forEach((function(e){i-r[e]>3e5&&delete r[e]}));for(var n=0;n<e.length;n++){var a=e[n];if(!(a in r)){if(a===this.pathwayId)return;var s=this.hls.nextLoadLevel,o=this.hls.levels[s];if((t=this.getLevelsForPathway(a)).length>0){this.log('Setting Pathway to "'+a+'"'),this.pathwayId=a,pn(t),this.hls.trigger(G.LEVELS_UPDATED,{levels:t});var l=this.hls.levels[s];o&&l&&this.levels&&(l.attrs["STABLE-VARIANT-ID"]!==o.attrs["STABLE-VARIANT-ID"]&&l.bitrate!==o.bitrate&&this.log("Unstable Pathways change from bitrate "+o.bitrate+" to "+l.bitrate),this.hls.nextLoadLevel=s);break}}}},r.getPathwayForGroupId=function(e,t,r){for(var i=this.getLevelsForPathway(r).concat(this.levels||[]),n=0;n<i.length;n++)if(t===V.AUDIO_TRACK&&i[n].hasAudioGroup(e)||t===V.SUBTITLE_TRACK&&i[n].hasSubtitleGroup(e))return i[n].pathwayId;return r},r.clonePathways=function(e){var t=this,r=this.levels;if(r){var i={},n={};e.forEach((function(e){var a=e.ID,s=e["BASE-ID"],o=e["URI-REPLACEMENT"];if(!r.some((function(e){return e.pathwayId===a}))){var l=t.getLevelsForPathway(s).map((function(e){var t=new vi(e.attrs);t["PATHWAY-ID"]=a;var r=t.AUDIO&&t.AUDIO+"_clone_"+a,s=t.SUBTITLES&&t.SUBTITLES+"_clone_"+a;r&&(i[t.AUDIO]=r,t.AUDIO=r),s&&(n[t.SUBTITLES]=s,t.SUBTITLES=s);var l=Il(e.uri,t["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",o),u=new ir({attrs:t,audioCodec:e.audioCodec,bitrate:e.bitrate,height:e.height,name:e.name,url:l,videoCodec:e.videoCodec,width:e.width});if(e.audioGroups)for(var d=1;d<e.audioGroups.length;d++)u.addGroupId("audio",e.audioGroups[d]+"_clone_"+a);if(e.subtitleGroups)for(var c=1;c<e.subtitleGroups.length;c++)u.addGroupId("text",e.subtitleGroups[c]+"_clone_"+a);return u}));r.push.apply(r,l),Ll(t.audioTracks,i,o,a),Ll(t.subtitleTracks,n,o,a)}}))}},r.loadSteeringManifest=function(e){var t,r=this,i=this.hls.config,n=i.loader;this.loader&&this.loader.destroy(),this.loader=new n(i);try{t=new self.URL(e)}catch(t){return this.enabled=!1,void this.log("Failed to parse Steering Manifest URI: "+e)}if("data:"!==t.protocol){var a=0|(this.hls.bandwidthEstimate||i.abrEwmaDefaultEstimate);zt(t,"_HLS_pathway",this.pathwayId),zt(t,"_HLS_throughput",""+a)}var s={type:V.STEERING_MANIFEST,responseType:"json",url:t.href},o=i.steeringManifestLoadPolicy.default,l=o.errorRetry||o.timeoutRetry||{},u={loadPolicy:o,timeout:o.maxLoadTimeMs,maxRetry:l.maxNumRetry||0,retryDelay:l.retryDelayMs||0,maxRetryDelay:l.maxRetryDelayMs||0},d={onSuccess:function(e,i,n,a){r.log('Loaded steering manifest: "'+t+'"');var s=e.data;if(1===(null==s?void 0:s.VERSION)){r.updated=performance.now(),r.timeToLoad=s.TTL;var o=s["RELOAD-URI"],l=s["PATHWAY-CLONES"],u=s["PATHWAY-PRIORITY"];if(o)try{r.uri=new self.URL(o,t).href}catch(e){return r.enabled=!1,void r.log("Failed to parse Steering Manifest RELOAD-URI: "+o)}r.scheduleRefresh(r.uri||n.url),l&&r.clonePathways(l);var d={steeringManifest:s,url:t.toString()};r.hls.trigger(G.STEERING_MANIFEST_LOADED,d),u&&r.updatePathwayPriority(u)}else r.log("Steering VERSION "+s.VERSION+" not supported!")},onError:function(e,t,i,n){if(r.log("Error loading steering manifest: "+e.code+" "+e.text+" ("+t.url+")"),r.stopLoad(),410===e.code)return r.enabled=!1,void r.log("Steering manifest "+t.url+" no longer available");var a=1e3*r.timeToLoad;if(429!==e.code)r.scheduleRefresh(r.uri||t.url,a);else{var s=r.loader;if("function"==typeof(null==s?void 0:s.getResponseHeader)){var o=s.getResponseHeader("Retry-After");o&&(a=1e3*parseFloat(o))}r.log("Steering manifest "+t.url+" rate limited")}},onTimeout:function(e,t,i){r.log("Timeout loading steering manifest ("+t.url+")"),r.scheduleRefresh(r.uri||t.url)}};this.log("Requesting steering manifest: "+t),this.loader.load(s,u,d)},r.scheduleRefresh=function(e,t){var r=this;void 0===t&&(t=1e3*this.timeToLoad),this.clearTimeout(),this.reloadTimer=self.setTimeout((function(){var t,i=null==(t=r.hls)?void 0:t.media;!i||i.ended?r.scheduleRefresh(e,1e3*r.timeToLoad):r.loadSteeringManifest(e)}),t)},i(t,[{key:"pathwayPriority",get:function(){return this._pathwayPriority},set:function(e){this.updatePathwayPriority(e)}}])}(de);function Ll(e,t,r,i){e&&Object.keys(t).forEach((function(n){var a=e.filter((function(e){return e.groupId===n})).map((function(e){var a=u({},e);return a.details=void 0,a.attrs=new vi(a.attrs),a.url=a.attrs.URI=Il(e.url,e.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",r),a.groupId=a.attrs["GROUP-ID"]=t[n],a.attrs["PATHWAY-ID"]=i,a}));e.push.apply(e,a)}))}function Il(e,t,r,i){if(t){var n=i[r];if(n){var a=n[t];if(a)return a}}var s=i.HOST,o=i.PARAMS,l=new self.URL(e);return s&&(l.hostname=s),o&&Object.keys(o).sort().forEach((function(e){e&&zt(l,e,o[e])})),l.href}var kl=function(){function e(){this.status="initialized",this.requestErrors=[],this.licenseXhr=void 0,this.onmessage=void 0,this.onkeystatuseschange=void 0,this.emitter=new x,this.error=void 0,this.ok=void 0}var t=e.prototype;return t.resolve=function(){this.ok=!0,this.emitter.emit("resolved")},t.reset=function(){this.emitter.removeAllListeners();var e=this.licenseXhr;e&&(e.readyState!==XMLHttpRequest.DONE&&e.abort(),this.licenseXhr=void 0),this.onmessage=this.onkeystatuseschange=void 0},i(e,[{key:"errored",get:function(){return this.error},set:function(e){this.error=e,this.emitter.eventNames().length&&this.emitter.emit("error",e)}},{key:"hasListeners",get:function(){return this.emitter.eventNames().length>0}},{key:"resolved",get:function(){return this.ok}},{key:"useable",get:function(){var e=this;return this.ok?Promise.resolve():this.error?Promise.reject(this.error):new Promise((function(t,r){e.emitter.on("error",r),e.emitter.on("resolved",t)}))}}])}(),Rl=function(e){function t(t,r){var i;return(i=e.call(this,r)||this).data=void 0,t.error||(t.error=new Error(r)),i.data=t,t.err=t.error,i}return c(t,e),t}(b(Error)),Dl=function(e){function t(r){var i;return(i=e.call(this,"eme",r.logger)||this).hls=void 0,i.config=void 0,i.media=null,i.mediaResolved=void 0,i.keyFormatPromise=null,i.keySystemAccessPromises={},i.sessionSetupByUri={},i.mediaKeySessions=[],i.activeKeys={},i.mediaKeys=null,i.setMediaKeysQueue=t.CDMCleanupPromise?[t.CDMCleanupPromise]:[],i.onMediaEncrypted=function(e){var t=e.initDataType,r=e.initData,n='"'+e.type+'" event: init data type: "'+t+'"';if(i.log(n),null!==r){if(!i.keyFormatPromise){var a=Object.keys(i.keySystemAccessPromises);a.length||(a=Mi(i.config));var s=a.map(Oi).filter((function(e){return!!e}));i.keyFormatPromise=i.getKeyFormatPromise(s)}i.keyFormatPromise.then((function(a){var s,o,l=_i(a),u=i.activeLevelKeys();if(l===ki.FAIRPLAY&&"sinf"===t)try{var d=Be(new Uint8Array(r)),c=ut(Ue(JSON.parse(d).sinf));if(!c)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");s=new Uint8Array(c.subarray(8,24))}catch(e){return void i.warn(n+" Failed to parse sinf: "+e)}else if(l===ki.PLAYREADY)s=Ui(new Uint8Array(r));else if(l===ki.WIDEVINE){var h=yt(r).filter((function(e){return e.systemId===xi}));if(h.length){var f,g=h[0];s=null!=(f=g.kids)&&f.length?g.kids[0]:null}}if(s)for(var v=Fe(s),p=0;p<u.length;p++){var m=u[p];if(m.keyId&&(Ei(s,m.keyId)||-1!==m.uri.replace(/-/g,"").indexOf(v))){m.pssh||(m.scheme=t,m.pssh=new Uint8Array(r),m.keyId=s,$i.setKeyIdForUri(m.uri,s)),o=i.getSessionForKey(m,"encrypted-event-key-match");break}}if(!o){var y,E;if(u.length)return(y=u[0]).scheme||(y.scheme=t),(E=u[0]).pssh||(E.pssh=new Uint8Array(r)),i.getSessionForKey(u[0],"encrypted-event-no-match");if(s)throw new Error("Key ID "+Fe(s)+" not encountered in playlist");i.log('Ignoring "'+e.type+'" event - could not determine keyId')}return o})).catch((function(e){return i.handleError(e)}))}},i.onWaitingForKey=function(e){i.log('"'+e.type+'" event')},i.hls=r,i.config=r.config,i.registerListeners(),i}c(t,e);var r=t.prototype;return r.destroy=function(){this.onDestroying(),this.onMediaDetached();var e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.config=null,this.onMediaEncrypted=this.onWaitingForKey=null},r.registerListeners=function(){var e=this.hls;e&&(e.on(G.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(G.MEDIA_DETACHED,this.onMediaDetached,this),e.on(G.MANIFEST_LOADING,this.onManifestLoading,this),e.on(G.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(G.DESTROYING,this.onDestroying,this))},r.unregisterListeners=function(){var e=this.hls;e&&(e.off(G.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(G.MEDIA_DETACHED,this.onMediaDetached,this),e.off(G.MANIFEST_LOADING,this.onManifestLoading,this),e.off(G.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(G.DESTROYING,this.onDestroying,this))},r.attemptKeySystemAccess=function(e){var t=this;if(!this.hls)return Promise.reject(new Error("destroyed"));var r=this.hls.levels,i=function(e,t,r){return!!e&&r.indexOf(e)===t},n=r.map((function(e){return e.audioCodec})).filter(i),a=r.map((function(e){return e.videoCodec})).filter(i);return n.length+a.length===0&&a.push("avc1.42e01e"),new Promise((function(r,i){var s=function(e){var o=e.shift();t.getMediaKeysPromise(o,n,a).then((function(e){return r({keySystem:o,mediaKeys:e})})).catch((function(t){e.length?s(e):i(t instanceof Rl?t:new Rl({type:B.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_NO_ACCESS,error:t,fatal:!0},t.message))}))};s(e)}))},r.requestMediaKeySystemAccess=function(e,t){var r=this.config.requestMediaKeySystemAccessFunc;if("function"!=typeof r){var i="Configured requestMediaKeySystemAccess is not a function "+r;return null===Ni&&"http:"===self.location.protocol&&(i="navigator.requestMediaKeySystemAccess is not available over insecure protocol "+location.protocol),Promise.reject(new Error(i))}return r(e,t)},r.getMediaKeysPromise=function(e,t,r){var i,n=this,a=function(e,t,r,i){var n;switch(e){case ki.FAIRPLAY:n=["cenc","sinf"];break;case ki.WIDEVINE:case ki.PLAYREADY:n=["cenc"];break;case ki.CLEARKEY:n=["cenc","keyids"];break;default:throw new Error("Unknown key-system: "+e)}return function(e,t,r,i){return[{initDataTypes:e,persistentState:i.persistentState||"optional",distinctiveIdentifier:i.distinctiveIdentifier||"optional",sessionTypes:i.sessionTypes||[i.sessionType||"temporary"],audioCapabilities:t.map((function(e){return{contentType:"audio/mp4; codecs="+e,robustness:i.audioRobustness||"",encryptionScheme:i.audioEncryptionScheme||null}})),videoCapabilities:r.map((function(e){return{contentType:"video/mp4; codecs="+e,robustness:i.videoRobustness||"",encryptionScheme:i.videoEncryptionScheme||null}}))}]}(n,t,r,i)}(e,t,r,this.config.drmSystemOptions||{}),s=this.keySystemAccessPromises[e],o=null==(i=s)?void 0:i.keySystemAccess;if(!o){this.log('Requesting encrypted media "'+e+'" key-system access with config: '+sr(a)),o=this.requestMediaKeySystemAccess(e,a);var l=s=this.keySystemAccessPromises[e]={keySystemAccess:o};return o.catch((function(t){n.log('Failed to obtain access to key-system "'+e+'": '+t)})),o.then((function(t){n.throwIfDestroyed(),n.log('Access for key-system "'+t.keySystem+'" obtained');var r=n.fetchServerCertificate(e);n.log('Create media-keys for "'+e+'"');var i=l.mediaKeys=t.createMediaKeys().then((function(t){return n.log('Media-keys created for "'+e+'"'),l.hasMediaKeys=!0,r.then((function(r){return r?n.setMediaKeysServerCertificate(t,e,r):t}))}));return i.catch((function(t){n.error('Failed to create media-keys for "'+e+'"}: '+t)})),i}))}return o.then((function(){return s.mediaKeys}))},r.getMediaKeySessionContext=function(e,t,r,i){for(var n=this.mediaKeySessions,a=' key-session "'+e+'" keyId: '+Fe(r.keyId||[])+" keyUri: "+r.uri+' for "'+i+'"',s=0;s<n.length;s++){var o=n[s];if(!o.initialized&&o.createdFor.levelKey.uri===r.uri)return this.log("Reusing"+a),o}this.log("Creating"+a);var l=t.createSession(),u={keySystem:e,mediaKeys:t,mediaKeysSession:l,keyRequests:{},keyStatuses:{},createdFor:{levelKey:r,reason:i},initialized:!1};return n.push(u),u},r.resetMediaKeys=function(){var e,t=null==(e=this.mediaKeySessions[0])?void 0:e.keySystem,r=this.keySystemAccessPromises[t];r&&(this.log("reset mediaKeys"),this.mediaKeys=null,r.hasMediaKeys=!1,delete r.mediaKeys,delete this.keySystemAccessPromises[t])},r.updateKeySession=function(e,t,r){var i=e.mediaKeysSession;return this.log('Updating key-session "'+i.sessionId+'" for keyId '+Fe(t.keyId||[])+"\n } (data length: "+r.byteLength+")"),i.update(r)},r.getSelectedKeySystemFormats=function(){var e=this;return Object.keys(this.keySystemAccessPromises).map((function(t){return{keySystem:t,hasMediaKeys:e.keySystemAccessPromises[t].hasMediaKeys}})).filter((function(e){return!!e.hasMediaKeys})).map((function(e){return Oi(e.keySystem)})).filter((function(e){return!!e}))},r.getKeySystemAccess=function(e){var t=this;return this.getKeySystemSelectionPromise(e).then((function(e){var r=e.keySystem,i=e.mediaKeys;return t.attemptSetMediaKeys(r,i)}))},r.selectKeySystem=function(e){return this.getKeySystemSelectionPromise(e).then((function(e){var t=e.keySystem,r=Oi(t);if(!r)throw new Error('Unable to find format for key-system "'+t+'"');return r}))},r.selectKeySystemFormat=function(e){var t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log("Selecting key-system from fragment (sn: "+e.sn+" "+e.type+": "+e.level+") key formats "+t.join(", ")),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise},r.getKeyFormatPromise=function(e){var t=Mi(this.config),r=e.map(_i).filter((function(e){return!!e&&-1!==t.indexOf(e)}));return this.selectKeySystem(r)},r.loadClear=function(e,t,r){var i=this;if(this.config.emeEnabled&&!this.getSelectedKeySystemFormats().length){if(t.length)for(var n,a=function(){var n=t[s];if(e.cc<=n.cc&&(!W(e)||!W(n)||e.sn<n.sn)||!r&&s==o-1)return{v:i.selectKeySystemFormat(n).then((function(e){if(i.hls){n.setKeyFormat(e);var t=_i(e);return t?i.getKeySystemAccess([t]):void 0}}))}},s=0,o=t.length;s<o;s++)if(n=a())return n.v;if(this.config.requireKeySystemAccessOnStart){var l=Mi(this.config);if(l.length)return this.getKeySystemAccess(l)}}return null},r.getKeyStatus=function(e){for(var t=this.mediaKeySessions,r=0;r<t.length;r++){var i=Cl(e,t[r]);if(i)return i}},r.loadKey=function(e){var t=e.decryptdata,r=this.getKeyStatus(t);if("internal-error"===r){var i=Pl(r,t);return i.data.frag=e,this.error(i.message+" ("+Fe(t.keyId||[])+")"),Promise.reject(i)}var n=e.type,a=this.activeKeys,s=a[n];s&&!t.matches(s.decryptdata)&&(a.previous||(a.previous=[]),a.previous.push(s),delete a[n]),a[n]||(a[n]=e);for(var o=this.mediaKeySessions.length;o--;){var l=this.mediaKeySessions[o];if(t.keyId&&"expired"===l.keyStatuses[Fe(t.keyId)])return this.renewKeySession(t,l)}return this.updateUsablePromise(t,"playlist-key",e)},r.renewKeySession=function(e,t){var r=this;return this.resetMediaKeys(),this.removeSession(t).then((function(){return r.throwIfDestroyed(),r.updateUsablePromise(e,"expired")}))},r.updateUsablePromise=function(e,t,r){var i=this,n=this.getSessionForKey(e,t);return n.catch((function(e){return i.handleError(e,r)})),n.then((function(t){return e}))},r.getSessionForKey=function(e,t){var r=this,i=this.findContextForKey(e);if(void 0!==i)return Promise.resolve(i);var n,a=e.uri,s=this.sessionSetupByUri[a];n=void 0===s?this.resolveSessionForKey(e,t):s.catch((function(){})).then((function(){return r.throwIfDestroyed(),r.resolveSessionForKey(e,t)})),this.sessionSetupByUri[a]=n;var o=function(){r.sessionSetupByUri[a]===n&&delete r.sessionSetupByUri[a]};return n.then(o,o),n},r.findContextForKey=function(e){for(var t=this.mediaKeySessions,r=t.length;r--;){var i=t[r];if(Cl(e,i))return i}},r.resolveSessionForKey=function(e,t){var r=this;return this.getKeySystemForKeyPromise(e).then((function(i){var n=i.keySystem,a=i.mediaKeys;r.throwIfDestroyed();for(var s=r.mediaKeySessions.length;s--;){var o=r.mediaKeySessions[s];if(Cl(e,o))return o;var l=r.getUsableKeyPromise(o,e,t);if(l)return l}return r.attemptSetMediaKeys(n,a).then((function(){return r.throwIfDestroyed(),r.getMediaKeySessionContext(n,a,e,t)})).then((function(i){r.throwIfDestroyed();var n=e.scheme||"cenc",a=e.pssh?e.pssh.buffer:null;return r.generateRequestWithPreferredKeySession(i,e,n,a,t)}))}))},r.getUsableKeyPromise=function(e,t,r){var i=e.keyRequests[t.uri];if(i)return this.log("Waiting for usable key ("+r+" keyId: "+function(e){if(e.keyFormat===Di)return e.uri;if(null===e.keyId)throw new Error("keyId is null");return Fe(e.keyId)}(t)+' format: "'+t.keyFormat+'" URI: '+t.uri+")"),i.useable.then((function(){return e}))},r.throwIfDestroyed=function(e){if(!this.hls)throw new Error("invalid state")},r.handleError=function(e,t){if(this.hls)if(e instanceof Rl){t&&(e.data.frag=t);var r=e.data.decryptdata;this.error(e.message+(r?" ("+Fe(r.keyId||[])+")":"")),this.hls.trigger(G.ERROR,e.data)}else this.error(e.message),this.hls.trigger(G.ERROR,{type:B.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0})},r.getKeySystemForKeyPromise=function(e){var t=_i(e.keyFormat),r=t?[t]:Mi(this.config);return this.attemptKeySystemAccess(r)},r.getKeySystemSelectionPromise=function(e){if(e.length||(e=Mi(this.config)),0===e.length)throw new Rl({type:B.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},"Missing key-system license configuration options "+sr({drmSystems:this.config.drmSystems}));return this.attemptKeySystemAccess(e)},r.activeLevelKeys=function(){var e=this.activeKeys,t=(e.previous||[]).map((function(e){return e.decryptdata}));return e.audio&&t.unshift(e.audio.decryptdata),e.main&&t.unshift(e.main.decryptdata),t},r.attemptSetMediaKeys=function(e,t){var r=this;if(this.mediaResolved=void 0,this.mediaKeys===t)return Promise.resolve();var i=this.setMediaKeysQueue.slice();this.log('Setting media-keys for "'+e+'"');var n=Promise.all(i).then((function(){return r.media?r.media.setMediaKeys(t):new Promise((function(e,i){r.mediaResolved=function(){if(r.mediaResolved=void 0,!r.media)return i(new Error("Attempted to set mediaKeys without media element attached"));r.mediaKeys=t,r.media.setMediaKeys(t).then(e).catch(i)}}))}));return this.mediaKeys=t,this.setMediaKeysQueue.push(n),n.then((function(){r.log('Media-keys set for "'+e+'"'),i.push(n),r.setMediaKeysQueue=r.setMediaKeysQueue.filter((function(e){return-1===i.indexOf(e)}))}))},r.filterInitData=function(e,t,r,i,n){var a,s=null==(a=this.config.drmSystems)||null==(a=a[e.keySystem])?void 0:a.generateRequest;if(s)try{var o=s.call(this.hls,r,i,u({},e,{decryptdata:t,reason:n}),n);if(!o)throw new Error("Invalid response from configured generateRequest filter");t.scheme=o.initDataType?o.initDataType:"cenc";var l=o.initData?o.initData:null;return t.pssh=l?new Uint8Array(l):null,o}catch(e){var d;if(this.warn(e.message),null!=(d=this.hls)&&d.config.debug)throw e}return{initDataType:r,initData:i}},r.generateRequestWithPreferredKeySession=function(e,t,r,i,n){var a=this,s=this.getUsableKeyPromise(e,t,n);if(s)return s;var o=this.filterInitData(e,t,r,i,n);if(o&&(i=o.initData?o.initData:null,r=o.initDataType),null===i)return n.startsWith("encrypted-event")?Promise.reject(new Error('missing initialization data for "'+n+'"')):(this.log('Skipping key-session request for "'+n+'" (no initData)'),Promise.resolve(e));var l=t.uri,u=new kl;e.keyRequests[l]=u;var d=function(r){var i=e.mediaKeysSession;if(i){var n=r.messageType,s=r.message;u.status=n,a.log('"'+n+'" message event for session "'+i.sessionId+'" message size: '+s.byteLength),"license-request"===n||"license-renewal"===n?a.renewLicense(e,t,s).catch((function(t){u.errored=t,u.hasListeners||a.handleError(t),a.removeSession(e)})):"license-release"===n?e.keySystem===ki.FAIRPLAY&&a.updateKeySession(e,t,wi("acknowledged")).then((function(){return a.removeSession(e)})).catch((function(e){return a.handleError(e)})):a.warn('unhandled media key message type "'+n+'"')}else{var o=new Error("invalid state");u.errored=o}};return u.onmessage=d,wn(e.mediaKeysSession,"message",d),this.generateRequest(e,t,r,i,n,!1)},r.generateRequest=function(e,t,r,i,n,a){var s=this;if(a){var o=this.filterInitData(e,t,r,i,n);o&&(i=o.initData?o.initData:i,r=o.initDataType)}var l=t.uri,u=e.keyRequests[l],d=Fe(t.keyId||[]),c=function(e){var r;e.startsWith("usable")?u.resolve():"internal-error"===e||"output-restricted"===e||"output-downscaled"===e?r=Pl(e,t):"expired"===e?r=new Error("key expired (keyId: "+d+")"):"released"===e?r=new Error("key released"):"status-pending"===e||s.warn('unhandled key status change "'+e+'" (keyId: '+d+")"),r&&(u.errored=r,u.hasListeners||s.handleError(r))},h=function(r){if(e.mediaKeysSession){var i=e.keyStatuses=s.getKeyStatuses(e);if(Object.keys(i).some((function(e){return"status-pending"!==i[e]}))){for(var n=s.activeLevelKeys(),a=0;a<n.length;a++){var o=Fe(n[a].keyId||[]);if("expired"===i[o]){var l;s.log("Expired key "+sr(i)+' in key-session "'+(null==(l=e.mediaKeysSession)?void 0:l.sessionId)+'"'),s.renewKeySession(t,e).catch((function(e){return s.handleError(e)}));break}}var h,f=i[d];if(f)c(f);else e.keyStatusTimeouts||(e.keyStatusTimeouts={}),(h=e.keyStatusTimeouts)[d]||(h[d]=self.setTimeout((function(){var r;if(e.mediaKeysSession){var i,n=s.getKeyStatus(t);if(n&&"status-pending"!==n)return s.log("No status for keyId "+d+' in key-session "'+(null==(i=e.mediaKeysSession)?void 0:i.sessionId)+'". Using session key-status '+n+" from other session."),c(n);s.log("key status for "+d+' in key-session "'+(null==(r=e.mediaKeysSession)?void 0:r.sessionId)+'" timed out after 1000ms'),c(f="internal-error")}}),1e3)),s.log("No status for keyId "+d+" ("+sr(i)+").")}}else{var g=new Error("invalid state");u.errored=g}};u.onkeystatuseschange=h,wn(e.mediaKeysSession,"keystatuseschange",h);var f=u.useable;return this.log('Generating key-session request for "'+n+'" keyId: '+d+" URI: "+l+" (init data type: "+r+" length: "+i.byteLength+")"),u.status="started",e.initialized=!0,e.mediaKeysSession.generateRequest(r,i).then((function(){var t;u.status="generated",s.log('Request generated for key-session "'+(null==(t=e.mediaKeysSession)?void 0:t.sessionId)+'" keyId: '+d+" URI: "+l)})).catch((function(e){throw s.log("mediaKeysSession.generateRequest failed: "+e),new Rl({type:B.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_NO_SESSION,error:e,decryptdata:t,fatal:!1},"Error generating key-session request: "+e)})).then((function(){return f})).catch((function(t){var r;s.log("mediaKeysSession.generateRequest failed: "+t);var i=null==(r=t.data)?void 0:r.details;return i!==$.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED&&i!==$.KEY_SYSTEM_STATUS_INTERNAL_ERROR||!Object.keys(e.keyStatuses).some((function(t){return"usable"===e.keyStatuses[t]}))?s.removeSession(e).then((function(){throw t})):(s.handleError(t),e)})).then((function(){return e}))},r.getKeyStatuses=function(e){var t=this,r={},i=e.mediaKeysSession.sessionId;return e.mediaKeysSession.keyStatuses.forEach((function(n,s){if("string"==typeof s&&"object"===a(n)){var o=s;s=n,n=o}var l="buffer"in s?new Uint8Array(s.buffer,s.byteOffset,s.byteLength):new Uint8Array(s);if(e.keySystem===ki.PLAYREADY&&16===l.length){var u=Fe(l);r[u]=n,Ai(l)}var d=Fe(l);t.log('key status change "'+n+'" for keyStatuses keyId: '+d+' key-session "'+i+'"'),r[d]=n})),r},r.fetchServerCertificate=function(e){var t=this.config,r=new(0,t.loader)(t),i=function(e,t){var r=t.drmSystems,i=null==r?void 0:r[e];if(i)return i.serverCertificateUrl}(e,t);return i?(this.log('Fetching server certificate for "'+e+'"'),new Promise((function(n,a){var s={type:V.SERVER_CERTIFICATE,responseType:"arraybuffer",url:i},o=t.certLoadPolicy.default,l={loadPolicy:o,timeout:o.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},u={onSuccess:function(e,t,r,i){n(e.data)},onError:function(t,r,n,o){a(new Rl({type:B.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:n,response:g({url:s.url,data:void 0},t)},'"'+e+'" certificate request failed ('+i+"). Status: "+t.code+" ("+t.text+")"))},onTimeout:function(t,r,n){a(new Rl({type:B.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:n,response:{url:s.url,data:void 0}},'"'+e+'" certificate request timed out ('+i+")"))},onAbort:function(e,t,r){a(new Error("aborted"))}};r.load(s,l,u)}))):(this.log('No Server Certificate in config.drmSystems["'+e+'"]'),Promise.resolve())},r.setMediaKeysServerCertificate=function(e,t,r){var i=this;return new Promise((function(n,a){e.setServerCertificate(r).then((function(a){i.log("setServerCertificate "+(a?"success":"not supported by CDM")+" ("+r.byteLength+') on "'+t+'"'),n(e)})).catch((function(e){a(new Rl({type:B.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:e,fatal:!0},e.message))}))}))},r.renewLicense=function(e,t,r){var i=this;return this.requestLicense(e,t,new Uint8Array(r)).then((function(r){return i.updateKeySession(e,t,new Uint8Array(r)).catch((function(e){throw new Rl({type:B.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_SESSION_UPDATE_FAILED,decryptdata:t,error:e,fatal:!1},e.message)}))}))},r.unpackPlayReadyKeyMessage=function(e,t){var r=Be(new Uint16Array(t.buffer));if(!r.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;var i=(new DOMParser).parseFromString(r,"application/xml"),n=i.querySelectorAll("HttpHeader");if(n.length>0)for(var a,s=0,o=n.length;s<o;s++){var l,u,d=null==(l=(a=n[s]).querySelector("name"))?void 0:l.textContent,c=null==(u=a.querySelector("value"))?void 0:u.textContent;d&&c&&e.setRequestHeader(d,c)}var h=i.querySelector("Challenge"),f=null==h?void 0:h.textContent;if(!f)throw new Error("Cannot find <Challenge> in key message");return wi(atob(f))},r.setupLicenseXHR=function(e,t,r,i,n){var a=this,s=this.config.licenseXhrSetup;return s?Promise.resolve().then((function(){return a.throwIfDestroyed(),s.call(a.hls,e,t,g(g({},r),{},{decryptdata:i}),n)})).catch((function(o){if(!r.mediaKeysSession)throw o;return e.open("POST",t,!0),s.call(a.hls,e,t,g(g({},r),{},{decryptdata:i}),n)})).then((function(r){return e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:r||n}})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:n}))},r.requestLicense=function(e,t,r){var i=this;return new Promise((function(n,a){var s,o,l,u,d,c=(s=e.keySystem,o=i.config,l=o.drmSystems,u=o.widevineLicenseUrl,(d=null==l?void 0:l[s])?d.licenseUrl:s===ki.WIDEVINE&&u?u:void 0);if(!c)return a(new Error('no license server URL configured for key-system "'+e.keySystem+'"'));var h=e.keyRequests[t.uri];if(!h)return a(new Error("License emitter removed"));i.log("Sending license request to URL: "+c);var f=i.config.keyLoadPolicy.default,v=new XMLHttpRequest;v.responseType="arraybuffer",v.onreadystatechange=function(){if(!i.hls||!e.mediaKeysSession)return a(new Error("invalid state"));if(4===v.readyState)if(200===v.status){h.requestErrors=[];var s=v.response;i.log("License received "+(s instanceof ArrayBuffer?s.byteLength:s));var o=i.config.licenseResponseCallback;if(o)try{s=o.call(i.hls,v,c,g(g({},e),{},{decryptdata:t}))}catch(e){i.error(e)}n(s)}else{var l=f.errorRetry,u=l?l.maxNumRetry:0;if(h.requestErrors.push({status:v.status,message:v.statusText}),h.requestErrors.length>u||v.status>=400&&v.status<500)a(new Rl({type:B.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_LICENSE_REQUEST_FAILED,decryptdata:t,fatal:!0,networkDetails:v,response:{url:c,data:void 0,code:v.status,text:v.statusText}},"License Request XHR failed ("+c+"). Status: "+v.status+" ("+v.statusText+")"));else{var d=u-h.requestErrors.length;i.warn("Retrying license request, "+d+" attempts left"),i.requestLicense(e,t,r).then(n,a)}}},h.licenseXhr&&h.licenseXhr.readyState!==XMLHttpRequest.DONE&&h.licenseXhr.abort(),h.licenseXhr=v,i.setupLicenseXHR(v,c,e,t,r).then((function(t){var r=t.xhr,n=t.licenseChallenge;e.keySystem==ki.PLAYREADY&&(n=i.unpackPlayReadyKeyMessage(r,n)),r.send(n)})).catch(a)}))},r.onDestroying=function(){this.unregisterListeners(),this._clear()},r.onMediaAttached=function(e,t){if(this.config.emeEnabled){var r=t.media;this.media=r,wn(r,"encrypted",this.onMediaEncrypted),wn(r,"waitingforkey",this.onWaitingForKey);var i=this.mediaResolved;i?i():this.mediaKeys=r.mediaKeys}},r.onMediaDetached=function(){var e=this.media;e&&(An(e,"encrypted",this.onMediaEncrypted),An(e,"waitingforkey",this.onWaitingForKey),this.media=null,this.mediaKeys=null)},r._clear=function(){var e,r=this;this.keyFormatPromise=null,this.keySystemAccessPromises={},this.activeKeys={},this.sessionSetupByUri={};var i=this.mediaResolved;if(i&&i(),this.mediaKeys||this.mediaKeySessions.length){var n=this.media,a=this.mediaKeySessions.slice();this.mediaKeySessions=[],this.mediaKeys=null,$i.clearKeyUriToKeyIdMap();var s=a.length;t.CDMCleanupPromise=Promise.all(a.map((function(e){return r.removeSession(e)})).concat((null==n||null==(e=n.setMediaKeys(null))?void 0:e.catch((function(e){r.log("Could not clear media keys: "+e),r.hls&&r.hls.trigger(G.ERROR,{type:B.OTHER_ERROR,details:$.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR,fatal:!1,error:new Error("Could not clear media keys: "+e)})})))||Promise.resolve())).catch((function(e){r.log("Could not close sessions and clear media keys: "+e),r.hls&&r.hls.trigger(G.ERROR,{type:B.OTHER_ERROR,details:$.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error("Could not close sessions and clear media keys: "+e)})})).then((function(){s&&r.log("finished closing key sessions and clearing media keys")}))}},r.onManifestLoading=function(){this._clear(),this.keyFormatPromise=null},r.onManifestLoaded=function(e,t){var r=t.sessionKeys;if(r&&this.config.emeEnabled&&!this.keyFormatPromise){var i=r.reduce((function(e,t){return-1===e.indexOf(t.keyFormat)&&e.push(t.keyFormat),e}),[]);this.log("Selecting key-system from session-keys "+i.join(", ")),this.keyFormatPromise=this.getKeyFormatPromise(i),this.keyFormatPromise.catch((function(){}))}},r.removeSession=function(e){var t=this,r=e.mediaKeysSession;if(r){this.log('Remove licenses and keys and close session "'+r.sessionId+'"'),Object.keys(e.keyRequests).forEach((function(t){var i=e.keyRequests[t];i.onmessage&&r.removeEventListener("message",i.onmessage),i.onkeystatuseschange&&r.removeEventListener("keystatuseschange",i.onkeystatuseschange),i.reset(),e.keyRequests[t]=void 0})),e.mediaKeysSession=void 0;var i=this.mediaKeySessions.indexOf(e);i>-1&&this.mediaKeySessions.splice(i,1);var n=e.keyStatusTimeouts;n&&Object.keys(n).forEach((function(e){return self.clearTimeout(n[e])}));var a=function(e){var t;return!(!e||"persistent-license"!==e.sessionType&&(null==(t=e.sessionTypes)||!t.some((function(e){return"persistent-license"===e}))))}(this.config.drmSystemOptions)?new Promise((function(e,t){self.setTimeout((function(){return t(new Error("MediaKeySession.remove() timeout"))}),8e3),r.remove().then(e).catch(t)})):Promise.resolve();return a.catch((function(e){t.log("Could not remove session: "+e),t.hls&&t.hls.trigger(G.ERROR,{type:B.OTHER_ERROR,details:$.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR,fatal:!1,error:new Error("Could not remove session: "+e)})})).then((function(){return r.close()})).then((function(){return r.closed})).catch((function(e){t.log("Could not close session: "+e),t.hls&&t.hls.trigger(G.ERROR,{type:B.OTHER_ERROR,details:$.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error("Could not close session: "+e)})}))}return Promise.resolve()},t}(de);function Cl(e,t){var r=e.keyId,i=t.mediaKeysSession;if(r&&i){var n=t.mediaKeysSession.keyStatuses;if(n.size)return n.has(r)?n.get(r):t.keyStatuses[Fe(r)]}}function Pl(e,t){var r="output-restricted"===e,i=r?$.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:$.KEY_SYSTEM_STATUS_INTERNAL_ERROR;return new Rl({type:B.KEY_SYSTEM_ERROR,details:i,fatal:!1,decryptdata:t},r?"HDCP level output restricted":'key status changed to "'+e+'"')}Dl.CDMCleanupPromise=void 0;var _l=function(){function e(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners()}var t=e.prototype;return t.setStreamController=function(e){this.streamController=e},t.registerListeners=function(){this.hls.on(G.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.on(G.MEDIA_DETACHING,this.onMediaDetaching,this)},t.unregisterListeners=function(){this.hls.off(G.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.off(G.MEDIA_DETACHING,this.onMediaDetaching,this)},t.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},t.onMediaAttaching=function(e,t){var r=this.hls.config;if(r.capLevelOnFPSDrop){var i=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=i,i&&"function"==typeof i.getVideoPlaybackQuality&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),r.fpsDroppedMonitoringPeriod)}},t.onMediaDetaching=function(){this.media=null},t.checkFPS=function(e,t,r){var i=performance.now();if(t){if(this.lastTime){var n=i-this.lastTime,a=r-this.lastDroppedFrames,s=t-this.lastDecodedFrames,o=1e3*a/n,l=this.hls;if(l.trigger(G.FPS_DROP,{currentDropped:a,currentDecoded:s,totalDroppedFrames:r}),o>0&&a>l.config.fpsDroppedMonitoringThreshold*s){var u=l.currentLevel;l.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+u),u>0&&(-1===l.autoLevelCapping||l.autoLevelCapping>=u)&&(u-=1,l.trigger(G.FPS_DROP_LEVEL_CAPPING,{level:u,droppedLevel:l.currentLevel}),l.autoLevelCapping=u,this.streamController.nextLevelSwitch())}}this.lastTime=i,this.lastDroppedFrames=r,this.lastDecodedFrames=t}},t.checkFPSInterval=function(){var e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){var t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)},e}(),xl=function(e){function t(t,r){var i;return(i=e.call(this,"gap-controller",t.logger)||this).hls=void 0,i.fragmentTracker=void 0,i.media=null,i.mediaSource=void 0,i.nudgeRetry=0,i.skipRetry=0,i.stallReported=!1,i.stalled=null,i.moved=!1,i.seeking=!1,i.buffered={},i.lastCurrentTime=void 0,i.ended=0,i.waiting=0,i.onMediaPlaying=function(){i.ended=0,i.waiting=0},i.onMediaWaiting=function(){var e;null!=(e=i.media)&&e.seeking||(i.waiting=self.performance.now(),i.tick())},i.onMediaEnded=function(){var e;i.hls&&(i.ended=(null==(e=i.media)?void 0:e.currentTime)||1,i.hls.trigger(G.MEDIA_ENDED,{stalled:!1}))},i.hls=t,i.fragmentTracker=r,i.lastCurrentTime=i.getCurrentTime(),i.registerListeners(),i}c(t,e);var r=t.prototype;return r.registerListeners=function(){var e=this.hls;e&&(e.on(G.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(G.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(G.BUFFER_APPENDED,this.onBufferAppended,this))},r.unregisterListeners=function(){var e=this.hls;e&&(e.off(G.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(G.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(G.BUFFER_APPENDED,this.onBufferAppended,this))},r.destroy=function(){e.prototype.destroy.call(this),this.unregisterListeners(),this.media=this.hls=this.fragmentTracker=null,this.mediaSource=void 0},r.onMediaAttached=function(e,t){this.setInterval(100),this.mediaSource=t.mediaSource;var r=this.media=t.media;wn(r,"playing",this.onMediaPlaying),wn(r,"waiting",this.onMediaWaiting),wn(r,"ended",this.onMediaEnded)},r.onMediaDetaching=function(e,t){this.clearInterval();var r=this.media;r&&(An(r,"playing",this.onMediaPlaying),An(r,"waiting",this.onMediaWaiting),An(r,"ended",this.onMediaEnded),this.media=null),this.mediaSource=void 0},r.onBufferAppended=function(e,t){this.buffered=t.timeRanges},r.getCurrentTime=function(){var e,t=(null==(e=this.hls)?void 0:e.config.timelineOffset)||0;return this.media?Math.max(this.media.currentTime,t):t},r.tick=function(){var e;if(null!=(e=this.media)&&e.readyState&&this.hasBuffered){var t=this.getCurrentTime();this.media.currentTime<t||(this.poll(t,this.lastCurrentTime),this.lastCurrentTime=t)}},r.poll=function(e,t){var r,i,n=null==(r=this.hls)?void 0:r.config;if(n){var a=this.media;if(a){var s=a.seeking,o=this.seeking&&!s,l=!this.seeking&&s,u=a.paused&&!s||a.ended||0===a.playbackRate;if(this.seeking=s,e!==t)return t&&(this.ended=0),this.moved=!0,s||(this.skipRetry=this.nudgeRetry=0,n.nudgeOnVideoHole&&!u&&e>t&&this.nudgeOnVideoHole(e,t)),void(0===this.waiting&&this.stallResolved(e));if(l||o)o&&this.stallResolved(e);else{if(u)return this.skipRetry=this.nudgeRetry=0,this.stallResolved(e),void(!this.ended&&a.ended&&this.hls&&(this.ended=e||1,this.hls.trigger(G.MEDIA_ENDED,{stalled:!1})));if(oi.getBuffered(a).length){var d=oi.bufferInfo(a,e,0),c=this.fragmentTracker;c&&this.hls&&Nl(d,e,c,this.hls);var h=d.nextStart||0;if(s&&c&&this.hls){var f=Ol(this.hls.inFlightFragments,e),g=d.len>2,v=!h||f||h-e>2&&!c.getPartialFragment(e);if(g||v)return;this.moved=!1}var p=null==(i=this.hls)?void 0:i.latestLevelDetails;if(!this.moved&&null!==this.stalled&&c){if(!(d.len>0||h))return;var m=Math.max(h,d.start||0)-e,y=null!=p&&p.live?2*p.targetduration:2,E=Fl(e,c);if(m>0&&(m<=y||E))return void(a.paused||this._trySkipBufferHole(E))}var b=n.detectStallWithCurrentTimeMs,T=self.performance.now(),S=this.waiting,w=this.stalled;if(null===w){if(!(S>0&&T-S<b))return void(this.stalled=T);w=this.stalled=S}var A=T-w;if(!s&&(A>=b||S&&this.moved)&&this.hls){var L;if("ended"===(null==(L=this.mediaSource)?void 0:L.readyState)&&(null==p||!p.live)&&Math.abs(e-((null==p?void 0:p.edge)||0))<1){if(this.ended)return;return this.ended=e||1,void this.hls.trigger(G.MEDIA_ENDED,{stalled:!0})}if(this._reportStall(d),!this.media||!this.hls)return;if(a.currentTime!==e){var I=e;return e=a.currentTime,this.moved=!0,void this.log("currentTime changed "+I+" > "+e)}}var k=oi.bufferInfo(a,e,n.maxBufferHole);this._tryFixBufferStall(k,A,e)}else this.skipRetry=this.nudgeRetry=0}}}},r.stallResolved=function(e){var t=this.stalled;if(t&&this.hls&&(this.stalled=null,this.stallReported)){var r=self.performance.now()-t;this.log("playback not stuck anymore @"+e+", after "+Math.round(r)+"ms"),this.stallReported=!1,this.waiting=0,this.hls.trigger(G.STALL_RESOLVED,{})}},r.nudgeOnVideoHole=function(e,t){var r,i=this.buffered.video;if(this.hls&&this.media&&this.fragmentTracker&&null!=(r=this.buffered.audio)&&r.length&&i&&i.length>1&&e>i.end(0)){var n=oi.bufferedInfo(oi.timeRangesToArray(this.buffered.audio),e,0);if(n.len>1&&t>=n.start){var a=oi.timeRangesToArray(i),s=oi.bufferedInfo(a,t,0).bufferedIndex;if(s>-1&&s<a.length-1){var o=oi.bufferedInfo(a,e,0).bufferedIndex,l=a[s].end,u=a[s+1].start;if((-1===o||o>s)&&u-l<1&&e-l<2){var d=new Error("nudging playhead to flush pipeline after video hole. currentTime: "+e+" hole: "+l+" -> "+u+" buffered index: "+o);this.warn(d.message),this.media.currentTime+=1e-6;var c=Fl(e,this.fragmentTracker);c&&"fragment"in c?c=c.fragment:c||(c=void 0);var h=oi.bufferInfo(this.media,e,0);this.hls.trigger(G.ERROR,{type:B.MEDIA_ERROR,details:$.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:d,reason:d.message,frag:c,buffer:h.len,bufferInfo:h})}}}}},r._tryFixBufferStall=function(e,t,r){var i,n,a=this.fragmentTracker,s=this.media,o=null==(i=this.hls)?void 0:i.config;if(s&&a&&o){var l=null==(n=this.hls)?void 0:n.latestLevelDetails,u=Fl(r,a);if((u||null!=l&&l.live&&r<l.fragmentStart)&&(this._trySkipBufferHole(u)||!this.media))return;var d=e.buffered,c=this.adjacentTraversal(e,r);(d&&d.length>1&&e.len>o.maxBufferHole||e.nextStart&&(e.nextStart-r<o.maxBufferHole||c))&&(t>1e3*o.highBufferWatchdogPeriod||this.waiting)&&(this.warn("Trying to nudge playhead over buffer-hole"),this._tryNudgeBuffer(e))}},r.adjacentTraversal=function(e,t){var r=this.fragmentTracker,i=e.nextStart;if(r&&i){var n=r.getFragAtPos(t,K.MAIN),a=r.getFragAtPos(i,K.MAIN);if(n&&a)return a.sn-n.sn<2}return!1},r._reportStall=function(e){var t=this.hls,r=this.media,i=this.stallReported,n=this.stalled;if(!i&&null!==n&&r&&t){this.stallReported=!0;var a=new Error("Playback stalling at @"+r.currentTime+" due to low buffer ("+sr(e)+")");this.warn(a.message),t.trigger(G.ERROR,{type:B.MEDIA_ERROR,details:$.BUFFER_STALLED_ERROR,fatal:!1,error:a,buffer:e.len,bufferInfo:e,stalled:{start:n}})}},r._trySkipBufferHole=function(e){var t=this.fragmentTracker,r=this.media,i=this.hls,n=null==i?void 0:i.config;if(!r||!t||!n)return 0;var a=r.currentTime,s=oi.bufferInfo(r,a,0);Nl(s,a,t,i);var o=a<s.start?s.start:s.nextStart;if(o){var l=s.len<=n.maxBufferHole,u=s.len>0&&s.len<1&&r.readyState<3,d=o-a;if(d>0&&(l||u)){if(d>n.maxBufferHole){var c=!1;if(0===a){var h=t.getAppendedFrag(0,K.MAIN);h&&o<h.end&&(c=!0)}if(!c&&e){var f;if(null==(f=i.loadLevelObj)||!f.details)return 0;if(Ol(i.inFlightFragments,o))return 0;for(var g=!1,v=e.end;v<o;){var p=Fl(v,t),m=p?p.duration:0;if(!(m>0)){g=!0;break}v+=m}if(g)return 0}}var y=n.nudgeMaxRetry,E=n.skipBufferHolePadding,b=++this.skipRetry>y,T=Math.max(o,a)+E;if(b||(this.warn("skipping hole, adjusting currentTime from "+a+" to "+T),this.moved=!0,r.currentTime=T),null==e||!e.gap||b){var S=new Error(b?"Playhead still not moving after seeking over buffer hole from "+a+" to "+T+" after "+n.nudgeMaxRetry+" attempts.":"fragment loaded with buffer holes, seeking from "+a+" to "+T),w={type:B.MEDIA_ERROR,details:$.BUFFER_SEEK_OVER_HOLE,fatal:b,error:S,reason:S.message,buffer:s.len,bufferInfo:s};e&&("fragment"in e?w.part=e:w.frag=e),i.trigger(G.ERROR,w)}return T}}return 0},r._tryNudgeBuffer=function(e){var t=this.hls,r=this.media,i=this.nudgeRetry,n=null==t?void 0:t.config;if(!r||!n)return 0;var a=r.currentTime;if(this.nudgeRetry++,i<n.nudgeMaxRetry){var s=a+(i+1)*n.nudgeOffset,o=new Error("Nudging 'currentTime' from "+a+" to "+s);this.warn(o.message),r.currentTime=s,t.trigger(G.ERROR,{type:B.MEDIA_ERROR,details:$.BUFFER_NUDGE_ON_STALL,error:o,fatal:!1,buffer:e.len,bufferInfo:e})}else{var l=new Error("Playhead still not moving while enough data buffered @"+a+" after "+n.nudgeMaxRetry+" nudges");this.error(l.message),t.trigger(G.ERROR,{type:B.MEDIA_ERROR,details:$.BUFFER_STALLED_ERROR,error:l,fatal:!0,buffer:e.len,bufferInfo:e})}},i(t,[{key:"hasBuffered",get:function(){return Object.keys(this.buffered).length>0}}])}(ni);function Ol(e,t){var r=Ml(e.main);if(r&&r.start<=t)return r;var i=Ml(e.audio);return i&&i.start<=t?i:null}function Ml(e){if(!e)return null;switch(e.state){case In.IDLE:case In.STOPPED:case In.ENDED:case In.ERROR:return null}return e.frag}function Fl(e,t){return t.getAppendedFrag(e,K.MAIN)||t.getPartialFragment(e)}function Nl(e,t,r,i){var n=i.latestLevelDetails,a=Fl(t,r);if(Dn(i.config)&&!e.nextStart&&n&&a&&i.interstitialsManager){var s="type"in a?a:a.fragment,o=wr(n,s.sn);(null==o?void 0:o.level)===s.level&&Rn(o,i.interstitialsManager.playerQueue,t)&&(e.nextStart=o.start)}}function Ul(e,t,r,i,n){void 0===i&&(i=""),void 0===n&&(n="disabled");var a=e.ownerDocument.createElement("track");return a.kind=t,a.label=r,i&&(a.srclang=i),a.src="data:,WEBVTT",a.track.mode=n,e.appendChild(a),a}function Bl(e){return e.forced&&(At.indexOf("Apple")>-1||/iPhone|iPad|iPod/.test(wt))?"forced":e.characteristics&&/transcribes-spoken-dialog/gi.test(e.characteristics)&&/describes-music-and-sound/gi.test(e.characteristics)?"captions":"subtitles"}function $l(e,t){var r=e.mode;if("disabled"===r&&(e.mode="hidden"),e.cues&&!e.cues.getCueById(t.id))try{if(e.addCue(t),!e.cues.getCueById(t.id))throw new Error("addCue is failed for: "+t)}catch(r){me.debug("[texttrack-utils]: "+r);try{var i=new self.TextTrackCue(t.startTime,t.endTime,t.text);i.id=t.id,e.addCue(i)}catch(e){me.debug("[texttrack-utils]: Legacy TextTrackCue fallback failed: "+e)}}"disabled"===r&&(e.mode=r)}function Gl(e,t,r,i){var n=e.mode;if("disabled"===n&&(e.mode="hidden"),e.cues&&e.cues.length>0)for(var a=function(e,t,r){var i=[],n=function(e,t){if(t<=e[0].startTime)return 0;var r=e.length-1;if(t>e[r].endTime)return-1;for(var i,n=0,a=r;n<=a;)if(t<e[i=Math.floor((a+n)/2)].startTime)a=i-1;else{if(!(t>e[i].startTime&&n<r))return i;n=i+1}return e[n].startTime-t<t-e[a].startTime?n:a}(e,t);if(n>-1)for(var a=n,s=e.length;a<s;a++){var o=e[a];if(o.startTime>=t&&o.endTime<=r)i.push(o);else if(o.startTime>r)return i}return i}(e.cues,t,r),s=0;s<a.length;s++)i&&!i(a[s])||e.removeCue(a[s]);"disabled"===n&&(e.mode=n)}function Hl(){if("undefined"!=typeof self)return self.VTTCue||self.TextTrackCue}function Vl(e,t,r,i,n){var a=new e(t,r,"");try{a.value=i,n&&(a.type=n)}catch(s){a=new e(t,r,sr(n?g({type:n},i):i))}return a}var Kl=function(){var e=Hl();try{e&&new e(0,Number.POSITIVE_INFINITY,"")}catch(e){return Number.MAX_VALUE}return Number.POSITIVE_INFINITY}(),jl=function(){function e(e){var t=this;this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.removeCues=!0,this.assetCue=void 0,this.onEventCueEnter=function(){t.hls&&t.hls.trigger(G.EVENT_CUE_ENTER,{})},this.hls=e,this._registerListeners()}var t=e.prototype;return t.destroy=function(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=this.onEventCueEnter=null},t._registerListeners=function(){var e=this.hls;e&&(e.on(G.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(G.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(G.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(G.MANIFEST_LOADING,this.onManifestLoading,this),e.on(G.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(G.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(G.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(G.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))},t._unregisterListeners=function(){var e=this.hls;e&&(e.off(G.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(G.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(G.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(G.MANIFEST_LOADING,this.onManifestLoading,this),e.off(G.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(G.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(G.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(G.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))},t.onMediaAttaching=function(e,t){this.media=t.media},t.onMediaAttached=function(){var e,t=null==(e=this.hls)?void 0:e.latestLevelDetails;t&&this.updateDateRangeCues(t)},t.onMediaDetaching=function(e,t){this.media=null,t.transferMedia||(this.id3Track&&(this.id3Track.remove(),this.id3Track=null),this.dateRangeCuesAppended={})},t.onManifestLoading=function(){this.dateRangeCuesAppended={}},t.createTrack=function(e){return Ul(e,"metadata","id3","","hidden")},t.onFragParsingMetadata=function(e,t){if(this.media&&this.hls){var r=this.hls.config,i=r.enableEmsgMetadataCues,n=r.enableID3MetadataCues;if(i||n){var a=t.samples;this.id3Track||(this.id3Track=this.createTrack(this.media));var s=Hl();if(s)for(var o=0;o<a.length;o++){var l=a[o].type;if((l!==Bn.emsg||i)&&n){var u=_e(a[o].data),d=a[o].pts,c=d+a[o].duration;c>Kl&&(c=Kl),c-d<=0&&(c=d+.25);for(var h=0;h<u.length;h++){var f=u[h];if(!xe(f)){this.updateId3CueEnds(d,l);var g=Vl(s,d,c,f,l);g&&this.id3Track.track.addCue(g)}}}}}}},t.updateId3CueEnds=function(e,t){var r,i=null==(r=this.id3Track)?void 0:r.track.cues;if(i)for(var n=i.length;n--;){var a=i[n];a.type===t&&a.startTime<e&&a.endTime===Kl&&(a.endTime=e)}},t.onBufferFlushing=function(e,t){var r=t.startOffset,i=t.endOffset,n=t.type,a=this.id3Track,s=this.hls;if(s){var o,l=s.config,u=l.enableEmsgMetadataCues,d=l.enableID3MetadataCues;a&&(u||d)&&(o="audio"===n?function(e){return e.type===Bn.audioId3&&d}:"video"===n?function(e){return e.type===Bn.emsg&&u}:function(e){return e.type===Bn.audioId3&&d||e.type===Bn.emsg&&u},Gl(a.track,r,i,o))}},t.onLevelUpdated=function(e,t){var r=t.details;this.updateDateRangeCues(r,!0)},t.onLevelPtsUpdated=function(e,t){Math.abs(t.drift)>.01&&this.updateDateRangeCues(t.details)},t.updateDateRangeCues=function(e,t){var r=this;if(this.hls&&this.media){var i=this.hls.config,n=i.assetPlayerId,a=i.timelineOffset,s=i.enableDateRangeMetadataCues,o=i.interstitialsController;if(s){var l=Hl();if(n&&a&&!o){var u=e.fragmentStart,d=e.fragmentEnd,c=this.assetCue;c?(c.startTime=u,c.endTime=d):l&&(c=this.assetCue=Vl(l,u,d,{assetPlayerId:this.hls.config.assetPlayerId},"hlsjs.interstitial.asset"))&&(c.id=n,this.id3Track||(this.id3Track=this.createTrack(this.media)),this.id3Track.track.addCue(c),c.addEventListener("enter",this.onEventCueEnter))}if(e.hasProgramDateTime){var h,f=this.id3Track,g=e.dateRanges,v=Object.keys(g),p=this.dateRangeCuesAppended;if(f&&t)if(null!=(h=f.track.cues)&&h.length)for(var m=Object.keys(p).filter((function(e){return-1===v.indexOf(e)})),y=function(){var e,t=m[E],i=null==(e=p[t])?void 0:e.cues;delete p[t],i&&Object.keys(i).forEach((function(e){var t=i[e];if(t){t.removeEventListener("enter",r.onEventCueEnter);try{f.track.removeCue(t)}catch(e){}}}))},E=m.length;E--;)y();else p=this.dateRangeCuesAppended={};var b=e.fragments[e.fragments.length-1];if(0!==v.length&&F(null==b?void 0:b.programDateTime)){this.id3Track||(this.id3Track=this.createTrack(this.media));for(var T=function(){var e=v[S],t=g[e],i=t.startTime,n=p[e],a=(null==n?void 0:n.cues)||{},s=(null==n?void 0:n.durationKnown)||!1,u=Kl,d=t.duration;if(t.endDate&&null!==d)u=i+d,s=!0;else if(t.endOnNext&&!s){var c=v.reduce((function(e,r){if(r!==t.id){var i=g[r];if(i.class===t.class&&i.startDate>t.startDate&&(!e||t.startDate<e.startDate))return i}return e}),null);c&&(u=c.startTime,s=!0)}for(var h,f=Object.keys(t.attr),m=0;m<f.length;m++){var y=f[m];if("ID"!==(h=y)&&"CLASS"!==h&&"CUE"!==h&&"START-DATE"!==h&&"DURATION"!==h&&"END-DATE"!==h&&"END-ON-NEXT"!==h){var E=a[y];if(E)!s||null!=n&&n.durationKnown?Math.abs(E.startTime-i)>.01&&(E.startTime=i,E.endTime=u):E.endTime=u;else if(l){var b=t.attr[y];pi(y)&&(b=Ne(b));var T=Vl(l,i,u,{key:y,data:b},Bn.dateRange);T&&(T.id=e,r.id3Track.track.addCue(T),a[y]=T,o&&("X-ASSET-LIST"!==y&&"X-ASSET-URL"!==y||T.addEventListener("enter",r.onEventCueEnter)))}}}p[e]={cues:a,dateRange:t,durationKnown:s}},S=0;S<v.length;S++)T()}}}}},e}();function ql(){return self.SourceBuffer||self.WebKitSourceBuffer}function Wl(){if(!ye())return!1;var e=ql();return!e||e.prototype&&"function"==typeof e.prototype.appendBuffer&&"function"==typeof e.prototype.remove}var Yl,zl,Ql=0,Xl=1,Jl=2,Zl=function(e){function t(t,r,i){var n;return(n=e.call(this,t,r,i,"stream-controller",K.MAIN)||this).audioCodecSwap=!1,n.level=-1,n._forceStartLoad=!1,n._hasEnoughToStart=!1,n.altAudio=Ql,n.audioOnly=!1,n._couldBacktrack=!1,n._backtrackFragment=void 0,n.audioCodecSwitch=!1,n.videoBuffer=null,n.onMediaPlaying=function(){n.tick()},n.onMediaSeeked=function(){var e=n.media,t=e?e.currentTime:null;if(null!==t&&F(t)&&(n.log("Media seeked to "+t),n.getBufferedFrag(t))){var r=n.getFwdBufferInfoAtPos(e,t,K.MAIN,0);r&&0!==r.len?n.tick():n.log("Main buffer empty at "+t+' on "seeked" event: '+(r?r.len:r))}},n.registerListeners(),n}c(t,e);var r=t.prototype;return r.registerListeners=function(){e.prototype.registerListeners.call(this);var t=this.hls;t.on(G.MANIFEST_PARSED,this.onManifestParsed,this),t.on(G.LEVEL_LOADING,this.onLevelLoading,this),t.on(G.LEVEL_LOADED,this.onLevelLoaded,this),t.on(G.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),t.on(G.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.on(G.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.on(G.BUFFER_CREATED,this.onBufferCreated,this),t.on(G.BUFFER_FLUSHED,this.onBufferFlushed,this),t.on(G.LEVELS_UPDATED,this.onLevelsUpdated,this),t.on(G.FRAG_BUFFERED,this.onFragBuffered,this)},r.unregisterListeners=function(){e.prototype.unregisterListeners.call(this);var t=this.hls;t.off(G.MANIFEST_PARSED,this.onManifestParsed,this),t.off(G.LEVEL_LOADED,this.onLevelLoaded,this),t.off(G.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),t.off(G.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.off(G.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.off(G.BUFFER_CREATED,this.onBufferCreated,this),t.off(G.BUFFER_FLUSHED,this.onBufferFlushed,this),t.off(G.LEVELS_UPDATED,this.onLevelsUpdated,this),t.off(G.FRAG_BUFFERED,this.onFragBuffered,this)},r.onHandlerDestroying=function(){this.onMediaPlaying=this.onMediaSeeked=null,this.unregisterListeners(),e.prototype.onHandlerDestroying.call(this)},r.startLoad=function(e,t){if(this.levels){var r=this.lastCurrentTime,i=this.hls;if(this.stopLoad(),this.setInterval(100),this.level=-1,!this.startFragRequested){var n=i.startLevel;-1===n&&(i.config.testBandwidth&&this.levels.length>1?(n=0,this.bitrateTest=!0):n=i.firstAutoLevel),i.nextLoadLevel=n,this.level=i.loadLevel,this._hasEnoughToStart=!!t}r>0&&-1===e&&!t&&this.initPTS.length&&(this.log("Override startPosition with lastCurrentTime @"+r),e=r),this.state=In.IDLE,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,t||this.fragmentTracker.hasFragments(this.playlistType)||(this._hasEnoughToStart=this.startFragRequested=!1),this.tick()}else this._forceStartLoad=!0,this.state=In.STOPPED},r.stopLoad=function(){this._forceStartLoad=!1,e.prototype.stopLoad.c
vendor: 13,483 bytes, line 2
2all(this)},r.doTick=function(){switch(this.state){case In.WAITING_LEVEL:var e=this.levels,t=this.level,r=null==e?void 0:e[t],i=null==r?void 0:r.details;if(i&&(!i.live||this.levelLastLoaded===r&&!this.waitForLive(r))){if(this.waitForCdnTuneIn(i))break;this.state=In.IDLE;break}if(this.hls.nextLoadLevel!==this.level){this.state=In.IDLE;break}break;case In.FRAG_LOADING_WAITING_RETRY:this.checkRetryDate()}this.state===In.IDLE&&this.doTickIdle(),this.onTickEnd()},r.onTickEnd=function(){var t;e.prototype.onTickEnd.call(this),null!=(t=this.media)&&t.readyState&&!1===this.media.seeking&&(this.lastCurrentTime=this.media.currentTime),this.checkFragmentChanged()},r.doTickIdle=function(){var e=this.hls,t=this.levelLastLoaded,r=this.levels,i=this.media;if(null!==t&&(i||this.primaryPrefetch||!this.startFragRequested&&e.config.startFragPrefetch)&&(!this.altAudio||!this.audioOnly)){var n=this.buffering?e.nextLoadLevel:e.loadLevel;if(null!=r&&r[n]){var a=r[n],s=this.getMainFwdBufferInfo();if(null!==s){var o=this.getLevelDetails();if(o&&this._streamEnded(s,o)){var l={type:this.targetBufferType()};return this.hls.trigger(G.BUFFER_EOS,l),void(this.state=In.ENDED)}if(this.buffering){e.loadLevel!==n&&-1===e.manualLevel&&this.log("Adapting to level "+n+" from level "+this.level),this.level=e.nextLoadLevel=n;var u=a.details;if(!u||this.state===In.WAITING_LEVEL||this.waitForLive(a))return this.level=n,this.state=In.WAITING_LEVEL,void(this.startFragRequested=!1);var d=s.len,c=this.getMaxBufferLength(a.maxBitrate);if(!(d>=c)){this.backtrackFragment&&this.backtrackFragment.start>s.end&&(this.backtrackFragment=void 0);var h=this.backtrackFragment?this.backtrackFragment.start:s.end,f=this.getNextFragment(h,u);if(this.couldBacktrack&&!this.fragPrevious&&f&&W(f)&&this.fragmentTracker.getState(f)!==Gr){var g,v=(null!=(g=this.backtrackFragment)?g:f).sn-u.startSN,p=u.fragments[v-1];p&&f.cc===p.cc&&(f=p,this.fragmentTracker.removeFragment(p))}else this.backtrackFragment&&s.len&&(this.backtrackFragment=void 0);if(f&&this.isLoopLoading(f,h)){if(!f.gap){var m=this.audioOnly&&!this.altAudio?j.AUDIO:j.VIDEO,y=(m===j.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;y&&this.afterBufferFlushed(y,m)}f=this.getNextFragmentLoopLoading(f,u,s,K.MAIN,c)}f&&(this.exceedsMaxBuffer(s,c,f)||this.loadFragment(f,a,h))}}}}}},r.loadFragment=function(t,r,i){var n=this.fragmentTracker.getState(t);n===Ur||n===$r?this.bitrateTest?(this.log("Fragment "+t.sn+" of level "+t.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(t,r)):e.prototype.loadFragment.call(this,t,r,i):this.clearTrackerIfNeeded(t)},r.immediateLevelSwitch=function(){var t;this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY),this.altAudio!==Ql&&((null==(t=this.getLevelDetails())?void 0:t.fragmentStart)||0)>this.lastCurrentTime&&e.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")},r.getBufferOutput=function(){return this.mediaBuffer&&this.altAudio===Jl?this.mediaBuffer:this.media},r.checkFragmentChanged=function(){var e=this.fragPlaying;if(!this.checkFragPlaying())return!1;var t=this.fragPlaying;if(t){var r=t.level;this.hls.trigger(G.FRAG_CHANGED,{frag:t,previousFrag:e}),(null==e?void 0:e.level)!==r&&this.hls.trigger(G.LEVEL_SWITCHED,{level:r})}return!0},r.abortCurrentFrag=function(){this.backtrackFragment=void 0,e.prototype.abortCurrentFrag.call(this)},r.flushMainBuffer=function(t,r){e.prototype.flushMainBuffer.call(this,t,r,this.targetBufferType())},r.targetBufferType=function(){return this.altAudio!==Jl||this.audioOnly?null:"video"},r.onMediaAttached=function(t,r){e.prototype.onMediaAttached.call(this,t,r);var i=r.media;wn(i,"playing",this.onMediaPlaying),wn(i,"seeked",this.onMediaSeeked)},r.onMediaDetaching=function(t,r){var i=this.media;i&&(An(i,"playing",this.onMediaPlaying),An(i,"seeked",this.onMediaSeeked)),this.videoBuffer=null,e.prototype.onMediaDetaching.call(this,t,r),r.transferMedia||(this._hasEnoughToStart=!1)},r.onManifestLoading=function(){e.prototype.onManifestLoading.call(this),this.log("Trigger BUFFER_RESET"),this.hls.trigger(G.BUFFER_RESET,void 0),this.couldBacktrack=!1,this.backtrackFragment=void 0,this.altAudio=Ql,this.audioOnly=!1},r.onManifestParsed=function(e,t){for(var r,i,n=!1,a=!1,s=0;s<t.levels.length;s++){var o=t.levels[s].audioCodec;o&&(n=n||-1!==o.indexOf("mp4a.40.2"),a=a||-1!==o.indexOf("mp4a.40.5"))}this.audioCodecSwitch=n&&a&&!("function"==typeof(null==(i=ql())||null==(r=i.prototype)?void 0:r.changeType)),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1},r.onLevelLoading=function(e,t){if(this.levels&&this.state===In.IDLE){var r=t.levelInfo;(!r.details||r.details.live&&(this.levelLastLoaded!==r||r.details.expired)||this.waitForCdnTuneIn(r.details))&&(this.state=In.WAITING_LEVEL)}},r.onLevelLoaded=function(e,t){var r,i=this,n=this.levels,a=this.startFragRequested,s=t.level,o=t.details,l=o.totalduration;if(n){this.log("Level "+s+" loaded ["+o.startSN+","+o.endSN+"]"+(o.lastPartSn?"[part-"+o.lastPartSn+"-"+o.lastPartIndex+"]":"")+", cc ["+o.startCC+", "+o.endCC+"] duration:"+l);var u=t.levelInfo,d=this.fragCurrent;!d||this.state!==In.FRAG_LOADING&&this.state!==In.FRAG_LOADING_WAITING_RETRY||d.level!==t.level&&d.loader&&this.abortCurrentFrag();var c=0;if(o.live||null!=(r=u.details)&&r.live){var h;if(this.checkLiveUpdate(o),o.deltaUpdateFailed)return;c=this.alignPlaylists(o,u.details,null==(h=this.levelLastLoaded)?void 0:h.details)}if(u.details=o,this.levelLastLoaded=u,a||this.setStartPosition(o,c),this.hls.trigger(G.LEVEL_UPDATED,{details:o,level:s}),this.state===In.WAITING_LEVEL){if(this.waitForCdnTuneIn(o))return;this.state=In.IDLE}a&&o.live&&this.synchronizeToLiveEdge(o),this.initPTS.some((function(e,t){if(t>=o.startCC)return!0;delete i.initPTS[t]})),this.tick()}else this.warn("Levels were reset while loading level "+s)},r.synchronizeToLiveEdge=function(e){var t=this.config,r=this.media;if(r){var i=this.hls.liveSyncPosition,n=this.playhead,a=e.fragmentStart,s=e.edge,o=n>=a-t.maxFragLookUpTolerance&&n<=s;if(null!==i&&r.duration>i&&(n<i||!o)){var l=void 0!==t.liveMaxLatencyDuration?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;if((!o&&r.readyState<4||n<s-l)&&(this._hasEnoughToStart||(this.nextLoadPosition=i),r.readyState))if(this.warn("Playback: "+n+" is located too far from the end of live sliding playlist: "+s+", reset currentTime to : "+i),"buffered"===this.config.liveSyncMode){var u,d=oi.bufferInfo(r,i,0);if(null==(u=d.buffered)||!u.length)return void(r.currentTime=i);if(d.start<=n)return void(r.currentTime=i);var c=oi.bufferedInfo(d.buffered,n,0).nextStart;c&&(r.currentTime=c)}else r.currentTime=i}}},r._handleFragmentLoadProgress=function(e){var t,r=e.frag,i=e.part,n=e.payload,a=this.levels;if(a){var s=a[r.level];if(s){var o=s.details;if(!o)return this.warn("Dropping fragment "+r.sn+" of level "+r.level+" after level details were reset"),void this.fragmentTracker.removeFragment(r);var l=s.videoCodec,u=o.PTSKnown||!o.live,d=null==(t=r.initSegment)?void 0:t.data,c=this._getAudioCodec(s),h=this.transmuxer=this.transmuxer||new ss(this.hls,K.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),f=i?i.index:-1,g=-1!==f,v=ti(r,i,this.iframesOnly),p=v.decryptRange,m=v.byteRange,y=new ai(r.level,r.sn,r.stats.chunkCount,m?m.end-m.start:n.byteLength,f,g,r.duration,this.iframesOnly,p),E=this.initPTS[r.cc];h.push(n,d,c,l,r,i,o.totalduration,u,y,E)}else this.warn("Level "+r.level+" not found on progress")}else this.warn("Levels were reset while fragment load was in progress. Fragment "+r.sn+" of level "+r.level+" will not be buffered")},r.onAudioTrackSwitching=function(e,t){var r=this,i=this.hls,n=this.altAudio!==Ql;if(gr(t.url,i))this.altAudio=Xl;else{if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var a=this.fragCurrent;a&&(this.log("Switching to main audio track, cancel main fragment load"),a.abortRequests(),this.fragmentTracker.removeFragment(a)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();if(n)return this.altAudio=Ql,this.fragmentTracker.removeAllFragments(),i.once(G.BUFFER_FLUSHED,(function(){r.hls&&r.hls.trigger(G.AUDIO_TRACK_SWITCHED,t)})),void i.trigger(G.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null});i.trigger(G.AUDIO_TRACK_SWITCHED,t)}},r.onAudioTrackSwitched=function(e,t){var r=gr(t.url,this.hls);if(r){var i=this.videoBuffer;i&&this.mediaBuffer!==i&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=i)}this.altAudio=r?Jl:Ql,this.tick()},r.onBufferCreated=function(e,t){var r,i,n=t.tracks,a=!1;for(var s in n){var o=n[s];if("main"===o.id){if(i=s,r=o,"video"===s){var l=n[s];l&&(this.videoBuffer=l.buffer)}}else a=!0}a&&r?(this.log("Alternate track found, use "+i+".buffered to schedule main fragment loading"),this.mediaBuffer=r.buffer):this.mediaBuffer=this.media},r.onFragBuffered=function(e,t){var r=t.frag,i=t.part,n=r.type===K.MAIN;if(n){if(this.fragContextChanged(r))return this.warn("Fragment "+r.sn+(i?" p: "+i.index:"")+" of level "+r.level+" finished buffering, but was aborted. state: "+this.state),void(this.state===In.PARSED&&(this.state=In.IDLE));var a=!1;if(W(r)&&(a=!!r.gap&&!r.tagList.some((function(e){return"GAP"===e[0]}))),this.fragBufferedComplete(r,i),a){var s;r.stats.retry++;var o=null==(s=this.levels)?void 0:s[r.level];o&&o.fragmentError++}}var l=this.media;l&&(!this._hasEnoughToStart&&oi.getBuffered(l).length&&(this._hasEnoughToStart=!0,this.seekToStartPos()),n&&this.tick())},r.onError=function(e,t){var r;if(t.fatal)this.state=In.ERROR;else switch(t.details){case $.FRAG_GAP:case $.FRAG_PARSING_ERROR:case $.FRAG_DECRYPT_ERROR:case $.FRAG_LOAD_ERROR:case $.FRAG_LOAD_TIMEOUT:case $.KEY_LOAD_ERROR:case $.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(K.MAIN,t);break;case $.LEVEL_LOAD_ERROR:case $.LEVEL_LOAD_TIMEOUT:case $.LEVEL_PARSING_ERROR:t.levelRetry||this.state!==In.WAITING_LEVEL||(null==(r=t.context)?void 0:r.type)!==V.LEVEL||(this.state=In.IDLE);break;case $.BUFFER_APPEND_NO_PROGRESS:if("main"!==t.parent)return;t.frag&&(t.appendsWithoutProgress||0)>=this.config.appendErrorMaxRetry&&(this.warn("Marking fragment "+t.frag.sn+" of level "+t.frag.level+" as a gap after "+t.appendsWithoutProgress+" appends without buffered range growth, to prevent loop loading"),this.fragmentTracker.addAsGap(t.frag));break;case $.BUFFER_ADD_CODEC_ERROR:case $.BUFFER_APPEND_ERROR:if("main"!==t.parent)return;this.reduceLengthAndFlushBuffer(t)&&this.resetLoadingState();break;case $.BUFFER_FULL_ERROR:if("main"!==t.parent)return;this.reduceLengthAndFlushBuffer(t)&&(!this.config.interstitialsController&&this.config.assetPlayerId?this._hasEnoughToStart=!0:this.flushMainBuffer(0,Number.POSITIVE_INFINITY));break;case $.INTERNAL_EXCEPTION:this.recoverWorkerError(t)}},r.onFragLoadEmergencyAborted=function(){this.state=In.IDLE,this._hasEnoughToStart||(this.startFragRequested=!1,this.nextLoadPosition=this.lastCurrentTime),this.tickImmediate()},r.onBufferFlushed=function(e,t){var r=t.type;if(r!==j.AUDIO||!this.altAudio){var i=(r===j.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;i&&(this.afterBufferFlushed(i,r),this.tick())}},r.onLevelsUpdated=function(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level,-1===this.level&&this.resetWhenMissingContext(this.fragCurrent)),this.levels=t.levels},r.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},r.seekToStartPos=function(){var e=this.media;if(e){var t=e.currentTime,r=this.startPosition;if(r>=0&&t<r){if(e.seeking)return void this.log("could not seek to "+r+", already seeking at "+t);var i=this.timelineOffset;i&&r&&(r+=i);var n=this.getLevelDetails(),a=oi.getBuffered(e),s=a.length?a.start(0):0,o=s-r,l=Math.max(this.config.maxBufferHole,this.config.maxFragLookUpTolerance);(this.config.startOnSegmentBoundary||o>0&&(o<l||this.loadingParts&&o<2*((null==n?void 0:n.partTarget)||0)))&&(this.log("adjusting start position by "+o+" to match buffer start"),r+=o,this.startPosition=r),t<r&&(this.log("seek to target start position "+r+" from current time "+t+" buffer start "+s),e.currentTime=r)}}},r._getAudioCodec=function(e){var t=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&t&&(this.log("Swapping audio codec"),t=-1!==t.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),t},r._loadBitrateTestFrag=function(e,t){var r=this;e.bitrateTest=!0,this._doFragLoad(e,t).then((function(e){var i=r.hls,n=null==e?void 0:e.frag;if(n&&!r.fragContextChanged(n)){t.fragmentError=0,r.state=In.IDLE,r.startFragRequested=!1,r.bitrateTest=!1;var a=n.stats;a.parsing.start=a.parsing.end=a.buffering.start=a.buffering.end=self.performance.now(),i.trigger(G.FRAG_LOADED,e),n.bitrateTest=!1}})).catch((function(t){r.state!==In.STOPPED&&r.state!==In.ERROR&&(r.warn(t),r.resetFragmentLoading(e))}))},r._handleTransmuxComplete=function(e){var t=this.playlistType,r=this.hls,i=e.remuxResult,n=e.chunkMeta,a=this.getCurrentContext(n);if(a){var s=a.frag,o=a.part,l=a.level,u=i.video,d=i.text,c=i.id3,h=i.initSegment,f=l.details,g=this.altAudio?void 0:i.audio;if(this.fragContextChanged(s))this.fragmentTracker.removeFragment(s);else{if(this.state=In.PARSING,h){var v=h.tracks;
vendor: 157,938 bytes, line 2
2if(v){var p=s.initSegment||s;if(this.unhandledEncryptionError(h,s))return;this._bufferInitSegment(l,v,p,n),r.trigger(G.FRAG_PARSING_INIT_SEGMENT,{frag:p,id:t,tracks:v})}var m=h.initPTS,y=h.timescale,E=this.initPTS[s.cc];if(F(m)&&(!E||E.baseTime!==m||E.timescale!==y)){var b=h.trackId;this.initPTS[s.cc]={baseTime:m,timescale:y,trackId:b};var T=this.initPTS.slice(0);r.trigger(G.INIT_PTS_FOUND,{timestampOffsets:T,frag:s,id:t,initPTS:m,timescale:y,trackId:b})}}if(u&&f){g&&"audiovideo"===u.type&&this.logMuxedErr(s);var S=f.fragments[s.sn-1-f.startSN],w=s.sn===f.startSN,A=!S||s.cc>S.cc;if(!1!==i.independent){var L=u.startPTS,I=u.endPTS,k=u.startDTS,R=u.endDTS;if(o)o.elementaryStreams[u.type]={startPTS:L,endPTS:I,startDTS:k,endDTS:R};else if(u.firstKeyFrame&&u.independent&&1===n.id&&!A&&(this.couldBacktrack=!0),u.dropped&&u.independent){var D=this.getMainFwdBufferInfo(),C=(D?D.end:this.getLoadPosition())+this.config.maxBufferHole,P=u.firstKeyFramePTS?u.firstKeyFramePTS:L;if(!w&&C<P-this.config.maxBufferHole&&!A)return void this.backtrack(s);A&&(s.gap=!0),s.setElementaryStreamInfo(u.type,s.start,I,s.start,R,!0)}else w&&L-(f.appliedTimelineOffset||0)>2&&(s.gap=!0);s.setElementaryStreamInfo(u.type,L,I,k,R),this.backtrackFragment&&(this.backtrackFragment=s),this.bufferFragmentData(u,s,o,n,w||A)}else{if(!w&&!A)return void this.backtrack(s);s.gap=!0}}if(g){var _=g.startPTS,x=g.endPTS,O=g.startDTS,M=g.endDTS;o&&(o.elementaryStreams[j.AUDIO]={startPTS:_,endPTS:x,startDTS:O,endDTS:M}),s.setElementaryStreamInfo(j.AUDIO,_,x,O,M),this.bufferFragmentData(g,s,o,n)}if(f&&null!=c&&c.samples.length){var N={id:t,frag:s,details:f,samples:c.samples};r.trigger(G.FRAG_PARSING_METADATA,N)}if(f&&d){var U={id:t,frag:s,details:f,samples:d.samples};r.trigger(G.FRAG_PARSING_USERDATA,U)}}}else this.resetWhenMissingContext(n)},r.logMuxedErr=function(e){this.warn((W(e)?"Media":"Init")+" segment with muxed audiovideo where only video expected: "+e.url)},r._bufferInitSegment=function(e,t,r,i){var n=this;if(this.state===In.PARSING){this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&(delete t.audio,t.audiovideo&&this.logMuxedErr(r));var a=t.audio,s=t.video,o=t.audiovideo;if(a){var l=e.audioCodec,u=Ut(a.codec,l);if("mp4a"===u&&(u="mp4a.40.5"),this.audioCodecSwitch){u&&(u=-1!==u.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5");var d=a.metadata;d&&"channelCount"in d&&1!==(d.channelCount||1)&&!function(){if(void 0===Tt){var e=wt.match(/Firefox\/(\d+)/i);Tt=e?parseInt(e[1]):0}return Tt}()&&(u="mp4a.40.5")}u&&-1!==u.indexOf("mp4a.40.5")&&/Android/.test(wt)&&"audio/mpeg"!==a.container&&(u="mp4a.40.2",this.log("Android: force audio codec to "+u)),l&&l!==u&&this.log('Swapping manifest audio codec "'+l+'" for "'+u+'"'),a.levelCodec=u,a.id=K.MAIN,this.log("Init audio buffer, container:"+a.container+", codecs[selected/level/parsed]=["+(u||"")+"/"+(l||"")+"/"+a.codec+"]"),delete t.audiovideo}if(s){s.levelCodec=e.videoCodec,s.id=K.MAIN;var c=s.codec;if(4===(null==c?void 0:c.length))switch(c){case"hvc1":case"hev1":s.codec="hvc1.1.6.L120.90";break;case"av01":s.codec="av01.0.04M.08";break;case"avc1":s.codec="avc1.42e01e"}this.log("Init video buffer, container:"+s.container+", codecs[level/parsed]=["+(e.videoCodec||"")+"/"+c+"]"+(s.codec!==c?" parsed-corrected="+s.codec:"")+(s.supplemental?" supplemental="+s.supplemental:"")),delete t.audiovideo}o&&(this.iframesOnly&&this.logMuxedErr(r),this.log("Init audiovideo buffer, container:"+o.container+", codecs[level/parsed]=["+e.codecs+"/"+o.codec+"]"),delete t.video,delete t.audio);var h=Object.keys(t);if(h.length){if(this.hls.trigger(G.BUFFER_CODECS,t),!this.hls)return;h.forEach((function(e){var a=t[e].initSegment;null!=a&&a.byteLength&&n.hls.trigger(G.BUFFER_APPENDING,{type:e,data:a,frag:r,part:null,chunkMeta:i,parent:r.type})}))}this.tickImmediate()}},r.getMainFwdBufferInfo=function(){var e=this.getBufferOutput();return this.getFwdBufferInfo(e,K.MAIN)},r.backtrack=function(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=In.IDLE},i(t,[{key:"backtrackFragment",get:function(){return this._backtrackFragment},set:function(e){this._backtrackFragment=e}},{key:"couldBacktrack",get:function(){return this._couldBacktrack},set:function(e){this._couldBacktrack=e}},{key:"hasEnoughToStart",get:function(){return this._hasEnoughToStart}},{key:"maxBufferLength",get:function(){var e=this.levels,t=this.level,r=null==e?void 0:e[t];return r?this.getMaxBufferLength(r.maxBitrate):this.config.maxBufferLength}},{key:"nextLevel",get:function(){var e=this.nextBufferedFrag;return e?e.level:-1}},{key:"currentFrag",get:function(){var e;if(this.fragPlaying)return this.fragPlaying;var t=(null==(e=this.media)?void 0:e.currentTime)||this.lastCurrentTime;return F(t)?this.getAppendedFrag(t):null}},{key:"currentProgramDateTime",get:function(){var e,t=(null==(e=this.media)?void 0:e.currentTime)||this.lastCurrentTime;if(F(t)){var r=this.getLevelDetails(),i=this.currentFrag||(r?Er(null,r.fragments,t):null);if(i){var n=i.programDateTime;if(null!==n){var a=n+1e3*(t-i.start);return new Date(a)}}}return null}},{key:"currentLevel",get:function(){var e=this.currentFrag;return e?e.level:-1}},{key:"nextBufferedFrag",get:function(){var e=this.currentFrag;return e?this.followingBufferedFrag(e):null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}])}(kn),eu=function(e){function t(){for(var t,r=arguments.length,i=new Array(r),n=0;n<r;n++)i[n]=arguments[n];return(t=e.call.apply(e,[this].concat(i))||this).currentOp=void 0,t.nextOp=void 0,t.cached=[],t.cachedSize=0,t.cacheFragmentData=!0,t.initDetails=void 0,t.onBufferedToEnd=function(){var e=t.media;null!=e&&e.seeking&&(e.currentTime=e.currentTime)},t.onMediaSeeking=function(){},t}c(t,e);var r=t.prototype;return r.setInitPts=function(e){this.initPTS=e.slice()},r.loadMediaAt=function(e,t){if(this.hls){var r=t.seekOnAppend,i=e+this.timelineOffset;switch(this.nextLoadPosition=this.lastCurrentTime=i,this.startPosition=e,this.state){case In.STOPPED:case In.ENDED:case In.ERROR:this.state=In.IDLE}this.state===In.IDLE?(this.hls.resumeBuffering(),this.tick(),this.currentOp=[i,t]):this.nextOp=[i,t],this.hls.off(G.BUFFERED_TO_END,this.onBufferedToEnd);var n=this.media;r&&n&&this.seekTo(i)&&(this.currentOp=[i,t],this.nextOp=void 0,this.flushPipeline(i,!0))}},r.seekTo=function(e){var t=this.media;if(t){var r,i=null==(r=this.getLevelDetails())?void 0:r.edge,n=void 0!==i?i:t.duration;if(e>=n&&(e=n-.01),oi.bufferInfo(t,e,0).len>0&&this.getBufferedAt(e))return t.currentTime=e,!0}return!1},r.getBufferedAt=function(e){return this.fragmentTracker.getBufferedFrag(e,K.MAIN)},r.cacheSet=function(e,t){if(this.hls){e.data=t;var r=this.cached;r.push(e),this.cachedSize+=t.buffer.byteLength;for(var i=this.hls.config.iframeCacheLimit;this.cachedSize>i&&r.length>1;){var n=r.shift();if(!n.data){this.cached=r.filter((function(e){return!!e.data})),this.cachedSize=r.reduce((function(e,t){var r=t.data;return r?r.buffer.byteLength:0}),0);break}this.cachedSize-=n.data.byteLength,n.data=void 0}}},r.onHandlerDestroying=function(){this.cached.length=0,this.cachedSize=0,e.prototype.onHandlerDestroying.call(this)},r._handleFragmentLoadProgress=function(t){var r=t.frag,i=t.part,n=t.payload;this.cacheFragmentData&&!i&&null!=n&&n.byteLength&&!r.data&&W(r)&&this.cacheSet(r,new Uint8Array(n.slice(0))),e.prototype._handleFragmentLoadProgress.call(this,t)},r.loadFragment=function(t,r,i){var n=this.fragmentTracker.getState(t);n!==Ur&&n!==$r||!this.canReplayCached(t)?e.prototype.loadFragment.call(this,t,r,i):this.replayCachedFragment(t)},r.canReplayCached=function(e){var t;if(!this.cacheFragmentData||null==(t=e.data)||!t.byteLength)return!1;var r=e.decryptdata;return"identity"!==(null==r?void 0:r.keyFormat)||!!r.key},r.replayCachedFragment=function(e){var t=e.data.slice().buffer;this.log("Buffering cached "+e.type+" sn: "+e.sn+" of level "+e.level+" ("+t.byteLength+" bytes)"),this.fragCurrent=e,this.startFragRequested=!0;var r=e.stats=new H;r.loading.start=r.loading.first=r.loading.end=self.performance.now(),r.loaded=r.total=t.byteLength,r.chunkCount=1,this.state=In.FRAG_LOADING;var i={frag:e,part:null,payload:t,networkDetails:null};this._handleFragmentLoadProgress(i),this.hls.trigger(G.FRAG_LOADED,i),this._handleFragmentLoadComplete(i)},r.fragBufferedComplete=function(t,r){e.prototype.fragBufferedComplete.call(this,t,r);var i=this.currentOp,n=this.nextOp;this.currentOp=this.nextOp=void 0,this.state=In.STOPPED,null!=i&&i[1].seekOnAppend&&(this.flushPipeline(i[0],!n),this.seekTo(i[0])||this.log("Could not seek to "+i[0]+" after fragment buffered (superseded or flushed) buffer: "+(this.media?Ln(oi.getBuffered(this.media)):"none"))),n&&this.loadMediaAt.apply(this,n)},r.flushPipeline=function(e,t){if(t){var r=this.media;if(r){var i=oi.bufferInfo(r,e,0),n=i.len?i.nextStart:0;n&&(this.fragmentTracker.removeFragmentsInRange(n,1/0,K.MAIN),this.flushMainBuffer(n,1/0))}this.hls.once(G.BUFFERED_TO_END,this.onBufferedToEnd)}this.hls.trigger(G.BUFFER_EOS,{type:"video"})},r.startLoad=function(){if(!this.startFragRequested){var e=this.hls;e.nextLoadLevel=-1===e.startLevel?0:e.firstAutoLevel}},r.seekToStartPos=function(){},r.setStartPosition=function(){},r.alignPlaylists=function(t,r,i){var n=this.initDetails;return this.initDetails=null,e.prototype.alignPlaylists.call(this,t,r,i||n||void 0)},r.getMainFwdBufferInfo=function(){var e=this.playhead,t=this.getBufferedAt(e);if(t){var r=t.duration;return{len:r,start:e,end:e+r,bufferedIndex:-1}}return{len:0,start:e,end:e,bufferedIndex:-1}},r._streamEnded=function(){var e=this.playhead,t=this.fragmentTracker.getBufferedFrag(e,K.MAIN);return!(null==t||!t.endList)},i(t,[{key:"playhead",get:function(){return this.nextLoadPosition}}])}(Zl),tu=function(e){function t(){for(var t,r=arguments.length,i=new Array(r),n=0;n<r;n++)i[n]=arguments[n];return(t=e.call.apply(e,[this].concat(i))||this)._img=void 0,t.queued=void 0,t.cacheFragmentData=!1,t}c(t,e);var r=t.prototype;return r.loadMediaAt=function(e){if(this.hls){var t=e+this.timelineOffset;switch(this.nextLoadPosition=this.lastCurrentTime=t,this.startPosition=e,this.state){case In.STOPPED:case In.ENDED:case In.ERROR:this.state=In.IDLE}if(this.state===In.IDLE){if(this.hls.resumeBuffering(),this.media||(this.media={}),this.tick(),this.state===In.IDLE){var r=this.getBufferedAt(e);r&&(this.fragCurrent=r,this.updateImage(r,null))}}else{var i=this.fragCurrent;(!i||e>=i.start&&e<i.end)&&(this.queued=[t])}}},r.updateImage=function(e,t,r){var i=this,n=e.data;n||this.fragmentTracker.removeFragment(e);var a=this._img;if(a&&n){var s=self.performance.now();(t?t.stats:e.stats).buffering.start=e.stats.buffering.start=s,a.onload=function(){if(i.hls){var n=i.hls.levels[e.level];null!=n&&n.fragmentError&&(n.fragmentError=0,e.stats.retry=0);var a=self.performance.now(),s=t?t.stats:e.stats;s.buffering.end=e.stats.buffering.end=a,i.hls.trigger(G.FRAG_BUFFERED,{frag:e,part:t,stats:s,id:e.type,chunkMeta:r})}},a.onerror=function(){i.handleError("Image decode error",e,t,r)};var o=a.src;o&&self.URL.revokeObjectURL(o);var l=new Blob([n],{type:"image/jpeg"});a.src=self.URL.createObjectURL(l)}else this.state=In.STOPPED,this.processQueued()},r.processQueued=function(){var e=this.queued;this.queued=void 0,e&&this.loadMediaAt.apply(this,e)},r.handleError=function(e,t,r,i){if(this.hls){var n=new Error(e);this.hls.trigger(G.ERROR,{type:B.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,chunkMeta:i,frag:t,part:r,fatal:!1,error:n,err:n})}},r._bufferInitSegment=function(){},r.bufferFragmentData=function(t,r,i,n){e.prototype.bufferFragmentData.call(this,t,r,i,n,!0);var a=Ze(new Uint8Array(t.data1),["mdat"]);if(0!==a.length){var s=r;this.cacheSet(s,a[0]),this.updateImage(s,i,n)}else this.handleError("Could not find I-Frame mdat",r,i,n)},r.fragBufferedComplete=function(t,r){this.fragmentTracker.fragBuffered(t,!0),e.prototype.fragBufferedComplete.call(this,t,r),this.processQueued()},r.checkFragPlaying=function(){var e,t=null==(e=this.fragPrevious)?void 0:e.start;if(void 0!==t){var r=this.getAppendedFrag(t);if(r&&!Y(r,this.fragPlaying))return this.fragPlaying=r,!0}return!1},r.getMainFwdBufferInfo=function(){return{len:0,start:this.playhead,end:this.playhead,bufferedIndex:-1}},i(t,[{key:"image",get:function(){return this._img},set:function(e){var t,r=null==(t=this._img)?void 0:t.src;r&&self.URL.revokeObjectURL(r),this._img=e}}])}(eu),ru="Image I-Frame player does not accept HTMLMediaElements",iu={seekOnAppend:!0},nu=function(e){function t(t,r){var i;return(i=e.call(this,"iframes",t.logger)||this).hls=void 0,i.stats=void 0,i.variableList=null,i.initPTS=[],i.iframeInstances=void 0,i.instanceCounter=0,Yl||(Yl=function(e){function t(t,r,i,n){var a;return t.streamController||(t.streamController=eu),(a=e.call(this,t)||this)._url=r,a.streamController.setInitPts(i),a.streamController.initDetails=n,a}c(t,e);var r=t.prototype;return r.loadSource=function(){},r.loadMediaAt=function(e,t){if(void 0===t&&(t=iu),!(e<0)){var r=g(g({},iu),t);this.loadingEnabled||this.startLoad(e),this.streamController.loadMediaAt(e,r)}},t}(r)),zl||(zl=function(e){return function(e){function t(t,r,i,n){return t.cmcdController=void 0,t.emeController=void 0,t.streamController||(t.streamController=tu),t.capLevelController=void 0,t.bufferController=void 0,e.call(this,t,r,i,n)||this}c(t,e);var r=t.prototype;return r.attachImage=function(e){this.streamController.image=e},r.detachImage=function(){this.streamController.image=void 0},r.loadSource=function(){},r.attachMedia=function(){throw new Error(ru)},r.detachMedia=function(){},r.recoverMediaError=function(){},r.transferMedia=function(){return null},r.loadMediaAt=function(e){if(e<0)return null;this.loadingEnabled||this.startLoad(e),this.streamController.loadMediaAt(e)},t}(e)}(Yl)),i.hls=t,i.iframeInstances=[],i.registerListeners(),i}c(t,e);var r=t.prototype;return r.registerListeners=function(){var e=this.hls;e&&(e.on(G.MANIFEST_LOADING,this.clearAsset,this),e.on(G.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(G.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(G.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(G.FRAG_BUFFERED,this.onFragBuffered,this),e.on(G.DESTROYING,this.onDestroying,this))},r.unregisterListeners=function(){var e=this.hls;e&&(e.off(G.MANIFEST_LOADING,this.clearAsset,this),e.off(G.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(G.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(G.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(G.FRAG_BUFFERED,this.onFragBuffered,this),e.off(G.DESTROYING,this.onDestroying,this))},r.clearAsset=function(){this.stats=void 0,this.variableList=null,this.initPTS=[],this.iframeInstances.forEach((function(e){return e.destroy()})),this.iframeInstances.length=0},r.onDestroying=function(){this.unregisterListeners(),this.clearAsset(),this.hls=void 0},r.onManifestLoaded=function(e,t){this.stats=t.stats,this.variableList=t.variableList},r.onLevelsUpdated=function(e,t){var r,i=t.levels,n=null==(r=this.hls)?void 0:r.pathwayPriority;i.length&&n&&this.iframeInstances.forEach((function(e){e.pathwayPriority=n}))},r.onInitPtsFound=function(e,t){var r=t.id,i=t.timestampOffsets;r===K.MAIN&&(this.initPTS=i)},r.onFragBuffered=function(e,t){var r,i=this,n=this.hls;n&&n.hasEnoughToStart&&((null==(r=n.mainForwardBufferInfo)?void 0:r.len)||0)>10&&this.iframeInstances.forEach((function(e){var t;e.loadingEnabled||e.startLoad((null==(t=i.hls)||null==(t=t.media)?void 0:t.currentTime)||0)}))},r.createIFramePlayer=function(e){var t;return this.createInstance(Yl,null==(t=this.hls)?void 0:t.iframeVariants,e)},r.createImageIFramePlayer=function(e){var t,r=null==(t=this.hls)?void 0:t.iframeVariants.filter((function(e){return e.imageCodec}));return this.createInstance(zl,r,e,"image-")},r.createInstance=function(e,t,r,i){var n=this.hls;if(!n)return null;var a=n.url,s=n.userConfig,o=n.latestLevelDetails,l=n.loadLevelObj,u=n.loadLevel,d=n.bandwidthEstimate,c=n.sessionId,h=this.stats,f=this.variableList;if(null==t||!t.length||!h||!a)return null;var v=(i||"")+"iframe-player-"+this.instanceCounter++,p=n.levels,m=l||p[u],y=pr(m,s.videoPreference),E=(null==m?void 0:m.pathwayId)||".",b=new e(g(g({},s),{},{loggerId:v,primarySessionId:c,videoPreference:y,abrEwmaDefaultEstimate:d,streamController:void 0,audioStreamController:void 0,audioTrackController:void 0,subtitleStreamController:void 0,subtitleTrackController:void 0,timelineController:void 0,id3TrackController:void 0,fpsController:void 0,gapController:void 0,iframeController:void 0,cmcd:void 0,interstitialsController:void 0,backBufferLength:1/0,maxMaxBufferLength:1,capLevelToPlayerSize:!0,enableWorker:!1,autoStartLoad:!1,startFragPrefetch:!1,testBandwidth:!1,progressive:!1},r),a,this.initPTS,o);return this.iframeInstances=this.iframeInstances.filter((function(e){return!e.url})),this.iframeInstances.push(b),b.trigger(G.MANIFEST_LOADED,{levels:t,contentSteering:{uri:"",pathwayId:E},sessionKeys:null,audioTracks:[],iframeVariants:[],sessionData:null,startTimeOffset:null,stats:h,networkDetails:null,url:a,variableList:f}),b},t}(de);function au(e){for(var t=5381,r=e.length;r;)t=33*t^e.charCodeAt(--r);return(t>>>0).toString()}var su=.025,ou=function(e){return e[e.Point=0]="Point",e[e.Range=1]="Range",e}({});function lu(e,t,r){return e.identifier+"-"+(r+1)+"-"+au(t)}var uu=function(){function e(e,t){this.base=void 0,this._duration=null,this._timelineStart=null,this.appendInPlaceDisabled=void 0,this.appendInPlaceStarted=void 0,this.dateRange=void 0,this.hasPlayed=!1,this.cumulativeDuration=0,this.resumeOffset=NaN,this.playoutLimit=NaN,this.restrictions={skip:!1,jump:!1},this.snapOptions={out:!1,in:!1},this.assetList=[],this.assetListLoader=void 0,this.assetListResponse=null,this.resumeAnchor=void 0,this.error=void 0,this.resetOnResume=void 0,this.base=t,this.dateRange=e,this.setDateRange(e)}var t=e.prototype;return t.setDateRange=function(e){this.dateRange=e,this.resumeOffset=e.attr.optionalFloat("X-RESUME-OFFSET",this.resumeOffset),this.playoutLimit=e.attr.optionalFloat("X-PLAYOUT-LIMIT",this.playoutLimit),this.restrictions=e.attr.enumeratedStringList("X-RESTRICT",this.restrictions),this.snapOptions=e.attr.enumeratedStringList("X-SNAP",this.snapOptions)},t.reset=function(){var e;this.appendInPlaceStarted=!1,null==(e=this.assetListLoader)||e.destroy(),this.assetListLoader=void 0,this.supplementsPrimary||(this.assetListResponse=null,this.assetList=[],this._duration=null)},t.isAssetPastPlayoutLimit=function(e){var t;if(e>0&&e>=this.assetList.length)return!0;var r=this.playoutLimit;return!(e<=0||isNaN(r))&&(0===r||((null==(t=this.assetList[e])?void 0:t.startOffset)||0)>r)},t.findAssetIndex=function(e){return this.assetList.indexOf(e)},t.toString=function(){return'["'+(e=this).identifier+'" '+(e.cue.pre?"<pre>":e.cue.post?"<post>":"")+e.timelineStart.toFixed(2)+"-"+e.resumeTime.toFixed(2)+"]";var e},i(e,[{key:"identifier",get:function(){return this.dateRange.id}},{key:"startDate",get:function(){return this.dateRange.startDate}},{key:"startTime",get:function(){var e=this.dateRange.startTime;if(this.snapOptions.out){var t=this.dateRange.tagAnchor;if(t)return cu(t,e)?du(e,t):e}return e}},{key:"startOffset",get:function(){return this.cue.pre?0:this.startTime}},{key:"startIsAligned",get:function(){if(0===this.startTime||this.snapOptions.out)return!0;var e=this.dateRange.tagAnchor;if(e){var t=this.dateRange.startTime;return t-du(t,e)<.1}return!1}},{key:"resumptionOffset",get:function(){var e=this.resumeOffset,t=F(e)?e:this.duration;return this.cumulativeDuration+t}},{key:"resumeTime",get:function(){var e=this.startOffset+this.resumptionOffset;if(this.snapOptions.in){var t=this.resumeAnchor;if(t)return cu(t,e)?du(e,t):e}return e}},{key:"appendInPlace",get:function(){return!!this.appendInPlaceStarted||!this.appendInPlaceDisabled&&!(this.cue.once||this.cue.pre||!this.startIsAligned||!(isNaN(this.playoutLimit)&&isNaN(this.resumeOffset)||this.resumeOffset&&this.duration&&Math.abs(this.resumeOffset-this.duration)<su))},set:function(e){this.appendInPlaceStarted?this.resetOnResume=!e:this.appendInPlaceDisabled=!e}},{key:"timelineStart",get:function(){return null!==this._timelineStart?this._timelineStart:this.startTime},set:function(e){this._timelineStart=e}},{key:"duration",get:function(){var e,t=this.playoutLimit;return e=null!==this._duration?this._duration:this.dateRange.duration?this.dateRange.duration:this.dateRange.plannedDuration||0,!isNaN(t)&&t<e&&(e=t),e},set:function(e){this._duration=e}},{key:"cue",get:function(){return this.dateRange.cue}},{key:"timelineOccupancy",get:function(){return"RANGE"===this.dateRange.attr["X-TIMELINE-OCCUPIES"]?ou.Range:ou.Point}},{key:"supplementsPrimary",get:function(){return"PRIMARY"===this.dateRange.attr["X-TIMELINE-STYLE"]}},{key:"contentMayVary",get:function(){return"NO"!==this.dateRange.attr["X-CONTENT-MAY-VARY"]}},{key:"assetUrl",get:function(){return this.dateRange.attr["X-ASSET-URI"]}},{key:"assetListUrl",get:function(){return this.dateRange.attr["X-ASSET-LIST"]}},{key:"baseUrl",get:function(){return this.base.url}},{key:"assetListLoaded",get:function(){return this.assetList.length>0||null!==this.assetListResponse}}])}();function du(e,t){return e-t.start<t.duration/2&&!(Math.abs(e-(t.start+t.duration))<su)?t.start:t.start+t.duration}function cu(e,t){return t>e.start-su&&t<e.start+e.duration+su}function hu(e,t,r){var i=new self.URL(e,r);return"data:"!==i.protocol&&zt(i,"_HLS_primary_id",t),i}function fu(e,t){for(;null!=(r=e.assetList[++t])&&r.error;)var r;return t}function gu(e){var t=e.timelineStart,r=e.duration||0;return'["'+e.identifier+'" '+t.toFixed(2)+"-"+(t+r).toFixed(2)+"]"}var vu=function(){function e(e,t,r,i){var n=this;this.hls=void 0,this.interstitial=void 0,this.assetItem=void 0,this.tracks=null,this.hasDetails=!1,this.mediaAttached=null,this._currentTime=void 0,this._bufferedEosTime=void 0,this.checkPlayout=function(){n.reachedPlayout(n.currentTime)&&n.hls&&n.hls.trigger(G.PLAYOUT_LIMIT_REACHED,{})};var a=this.hls=new e(t);this.interstitial=r,this.assetItem=i;var s=function(){n.hasDetails=!0};a.once(G.LEVEL_LOADED,s),a.once(G.AUDIO_TRACK_LOADED,s),a.once(G.SUBTITLE_TRACK_LOADED,s),a.on(G.MEDIA_ATTACHING,(function(e,t){var r=t.media;n.removeMediaListeners(),n.mediaAttached=r,n.interstitial.playoutLimit&&(r.addEventListener("timeupdate",n.checkPlayout),n.appendInPlace&&a.on(G.BUFFER_APPENDED,(function(){var e=n.bufferedEnd;n.reachedPlayout(e)&&(n._bufferedEosTime=e,a.trigger(G.BUFFERED_TO_END,void 0))})))}))}var t=e.prototype;return t.loadSource=function(){var e=this.hls;if(e)if(e.url)e.levels.length&&!e.started&&e.startLoad(-1,!0);else{var t=this.assetItem.uri;try{t=hu(t,e.config.primarySessionId||"").href}catch(e){}e.loadSource(t)}},t.bufferedInPlaceToEnd=function(e,t){var r;if(!this.appendInPlace)return!1;if(null!=(r=this.hls)&&r.bufferedToEnd)return!0;if(!e)return!1;var i=Math.min(this._bufferedEosTime||1/0,this.duration),n=this.timelineOffset+(t||0),a=oi.bufferInfo(e,n,.02);return this.getAssetTime(a.end)>=i-.02},t.reachedPlayout=function(e){var t=this.interstitial.playoutLimit;return this.startOffset+e>=t},t.getAssetTime=function(e){var t=this.timelineOffset,r=this.duration;return Math.min(Math.max(0,e-t),r)},t.removeMediaListeners=function(){var e=this.mediaAttached;e&&(this._currentTime=e.currentTime,this.bufferSnapShot(),e.removeEventListener("timeupdate",this.checkPlayout))},t.bufferSnapShot=function(){var e;this.mediaAttached&&null!=(e=this.hls)&&e.bufferedToEnd&&(this._bufferedEosTime=this.bufferedEnd)},t.destroy=function(){this.removeMediaListeners(),this.hls&&this.hls.destroy(),this.hls=null,this.tracks=this.mediaAttached=this.checkPlayout=null},t.attachMedia=function(e){var t;this.loadSource(),null==(t=this.hls)||t.attachMedia(e)},t.detachMedia=function(){var e;this.removeMediaListeners(),this.mediaAttached=null,null==(e=this.hls)||e.detachMedia()},t.resumeBuffering=function(){var e;null==(e=this.hls)||e.resumeBuffering()},t.pauseBuffering=function(){var e;null==(e=this.hls)||e.pauseBuffering()},t.transferMedia=function(){var e;return this.bufferSnapShot(),(null==(e=this.hls)?void 0:e.transferMedia())||null},t.resetDetails=function(){var e=this.hls;if(e&&this.hasDetails){e.stopLoad();var t=function(e){return delete e.details};e.levels.forEach(t),e.allAudioTracks.forEach(t),e.allSubtitleTracks.forEach(t),this.hasDetails=!1}},t.on=function(e,t,r){var i;null==(i=this.hls)||i.on(e,t)},t.once=function(e,t,r){var i;null==(i=this.hls)||i.once(e,t)},t.off=function(e,t,r){var i;null==(i=this.hls)||i.off(e,t)},t.toString=function(){var e;return"HlsAssetPlayer: "+gu(this.assetItem)+" "+(null==(e=this.hls)?void 0:e.sessionId)+" "+(this.appendInPlace?"append-in-place":"")},i(e,[{key:"appendInPlace",get:function(){return this.interstitial.appendInPlace}},{key:"destroyed",get:function(){var e;return!(null!=(e=this.hls)&&e.userConfig)}},{key:"assetId",get:function(){return this.assetItem.identifier}},{key:"interstitialId",get:function(){return this.assetItem.parentIdentifier}},{key:"media",get:function(){var e;return(null==(e=this.hls)?void 0:e.media)||null}},{key:"bufferedEnd",get:function(){var e=this.media||this.mediaAttached;if(!e)return this._bufferedEosTime?this._bufferedEosTime:this.currentTime;var t=oi.bufferInfo(e,e.currentTime,.001);return this.getAssetTime(t.end)}},{key:"currentTime",get:function(){var e=this.media||this.mediaAttached;return e?this.getAssetTime(e.currentTime):this._currentTime||0}},{key:"duration",get:function(){var e=this.assetItem.duration;if(!e)return 0;var t=this.interstitial.playoutLimit;if(t){var r=t-this.startOffset;if(r>0&&r<e)return r}return e}},{key:"remaining",get:function(){var e=this.duration;return e?Math.max(0,e-this.currentTime):0}},{key:"startOffset",get:function(){return this.assetItem.startOffset}},{key:"timelineOffset",get:function(){var e;return(null==(e=this.hls)?void 0:e.config.timelineOffset)||0},set:function(e){var t=this.timelineOffset;if(e!==t){var r=e-t;if(Math.abs(r)>1/9e4&&this.hls){if(this.hasDetails)throw new Error("Cannot set timelineOffset after playlists are loaded");this.hls.config.timelineOffset=e}}}}])}(),pu=.033,mu=function(e){function t(t,r){var i;return(i=e.call(this,"interstitials-sched",r)||this).onScheduleUpdate=void 0,i.eventMap={},i.events=null,i.items=null,i.durations={primary:0,playout:0,integrated:0},i.onScheduleUpdate=t,i}c(t,e);var r=t.prototype;return r.destroy=function(){this.reset(),this.onScheduleUpdate=null},r.reset=function(){this.eventMap={},this.setDurations(0,0,0),this.events&&this.events.forEach((function(e){return e.reset()})),this.events=this.items=null},r.resetErrorsInRange=function(e,t){return this.events?this.events.reduce((function(r,i){return e<=i.startOffset&&t>i.startOffset?(delete i.error,r+1):r}),0):0},r.getEvent=function(e){return e&&this.eventMap[e]||null},r.hasEvent=function(e){return e in this.eventMap},r.findItemIndex=function(e,t){if(e.event)return this.findEventIndex(e.event.identifier);var r=-1;e.nextEvent?r=this.findEventIndex(e.nextEvent.identifier)-1:e.previousEvent&&(r=this.findEventIndex(e.previousEvent.identifier)+1);var i=this.items;if(i)for(i[r]||(void 0===t&&(t=e.start),r=this.findItemIndexAtTime(t));r>=0&&null!=(n=i[r])&&n.event;){var n;r--}return r},r.findItemIndexAtTime=function(e,t){var r=this.items;if(r)for(var i=0;i<r.length;i++){var n=r[i];t&&"primary"!==t&&(n=n[t]);var a=n.start,s=r[i].event,o=null!=s&&s.cue.pre?s.duration:n.end;if(e===a||e>a&&e<o)return i}return-1},r.findJumpRestrictedIndex=function(e,t){var r=this.items;if(r)for(var i=e;i<=t&&r[i];i++){var n=r[i].event;if(null!=n&&n.restrictions.jump&&!n.appendInPlace)return i}return-1},r.findEventIndex=function(e){var t=this.items;if(t)for(var r=t.length;r--;){var i;if((null==(i=t[r].event)?void 0:i.identifier)===e)return r}return-1},r.findAssetIndex=function(e,t){var r=e.assetList,i=r.length;if(i>1)for(var n=0;n<i;n++){var a=r[n];if(!a.error){var s=a.timelineStart;if(t===s||t>s&&(t<s+(a.duration||0)||n===i-1))return n}}return 0},r.parseInterstitialDateRanges=function(e,t,r){var i=this;void 0===r&&(r=0);var n=e.main.details,a=n.dateRanges,s=this.events,o=this.parseDateRanges(a,{url:n.url},t),l=Object.keys(a),u=s?s.filter((function(e){return-1===l.indexOf(e.identifier)})):[];o.length&&o.sort((function(e,t){var r=e.cue.pre,i=e.cue.post,n=t.cue.pre,a=t.cue.post;if(r&&!n)return-1;if(n&&!r)return 1;if(i&&!a)return 1;if(a&&!i)return-1;if(!(r||n||i||a)){var s=e.startTime,o=t.startTime;if(s!==o)return s-o}return e.dateRange.tagOrder-t.dateRange.tagOrder})),this.events=o,u.forEach((function(e){i.removeEvent(e)})),this.updateSchedule(e,u,r)},r.updateSchedule=function(e,t,r,i){void 0===t&&(t=[]),void 0===r&&(r=0),void 0===i&&(i=!1);var n=this.events||[];if(n.length||t.length||this.length<2){var a=this.items,s=this.parseSchedule(n,e,r);(i||t.length||(null==a?void 0:a.length)!==s.length||s.some((function(e,t){return Math.abs(e.playout.start-a[t].playout.start)>.005||Math.abs(e.playout.end-a[t].playout.end)>.005})))&&(this.items=s,this.onScheduleUpdate(t,a))}},r.parseDateRanges=function(e,t,r){for(var i=[],n=Object.keys(e),a=0;a<n.length;a++){var s=n[a],o=e[s];if(o.isInterstitial){var l=this.eventMap[s];l?l.setDateRange(o):(l=new uu(o,t),this.eventMap[s]=l,!1===r&&(l.appendInPlace=r)),i.push(l)}}return i},r.parseSchedule=function(e,t,r){void 0===r&&(r=0);var i=[],n=t.main.details,a=n.live?1/0:n.edge,s=0;if((e=e.filter((function(e){return!(e.error||e.cue.once&&e.hasPlayed)}))).length){this.resolveOffsets(e,t);var o=0,l=0;if(e.forEach((function(t,u){var d=t.cue.pre,c=t.cue.post,h=e[u-1]||null,f=t.appendInPlace,g=c?a:t.startOffset,v=t.duration,p=t.timelineOccupancy===ou.Range?v:0,m=d&&n.live?r+(t.resumeOffset||0):0,y=m||t.resumptionOffset,E=(null==h?void 0:h.startTime)===g,b=g+t.cumulativeDuration,T=f?b+v:g+y;if(d||!c&&g<=0){var S=l;l+=p,t.timelineStart=b;var w=s;s+=v,i.push({event:t,start:b,end:T,playout:{start:w,end:s},integrated:{start:S,end:l}})}else{if(!(g<=a))return;if(!E){var A=g-o;if(A>pu){var L=o,I=l;l+=A;var k=s;s+=A;var R={previousEvent:e[u-1]||null,nextEvent:t,start:L,end:L+A,playout:{start:k,end:s},integrated:{start:I,end:l}};i.push(R)}else A>0&&h&&(h.cumulativeDuration+=A,i[i.length-1].end=g)}c&&(T=b),t.timelineStart=b;var D=l;l+=p;var C=s;s+=v,i.push({event:t,start:b,end:T,playout:{start:C,end:s},integrated:{start:D,end:l}})}var P=m||t.resumeTime;o=c||P>a?a:!d&&T&&t.appendInPlaceStarted&&P-T>pu?T:P})),o<a){var u,d=o,c=l,h=a-o;l+=h;var f=s;s+=h,i.push({previousEvent:(null==(u=i[i.length-1])?void 0:u.event)||null,nextEvent:null,start:o,end:d+h,playout:{start:f,end:s},integrated:{start:c,end:l}})}this.setDurations(a,s,l)}else i.push({previousEvent:null,nextEvent:null,start:0,end:a,playout:{start:0,end:a},integrated:{start:0,end:a}}),this.setDurations(a,a,a);return i},r.setDurations=function(e,t,r){this.durations={primary:e,playout:t,integrated:r}},r.resolveOffsets=function(e,t){var r=this,i=t.main.details,n=i.live?1/0:i.edge,a=0,s=-1;e.forEach((function(o,l){var u=o.cue.pre,d=o.cue.post,c=u?0:d?n:o.startTime;r.updateAssetDurations(o),s===c?o.cumulativeDuration=a:(a=0,s=c),!d&&o.snapOptions.in&&(o.resumeAnchor=Er(null,i.fragments,o.startOffset+o.resumptionOffset,0,0)||void 0),o.appendInPlace&&!o.appendInPlaceStarted&&(r.primaryCanResumeInPlaceAt(o,t)||(o.appendInPlace=!1)),!o.appendInPlace&&l+1<e.length&&e[l+1].startTime-e[l].resumeTime<pu&&(e[l+1].appendInPlace=!1,e[l+1].appendInPlace&&r.warn("Could not change append strategy for abutting event "+o));var h=F(o.resumeOffset)?o.resumeOffset:o.duration;a+=h}))},r.primaryCanResumeInPlaceAt=function(e,t){var r=this,i=e.resumeTime,n=e.startTime+e.resumptionOffset;return Math.abs(i-n)>su?(this.log('"'+e.identifier+'" resumption '+i+" not aligned with estimated timeline end "+n),!1):!Object.keys(t).some((function(n){var a=t[n].details,s=a.edge;if(i>=s)return r.log('"'+e.identifier+'" resumption '+i+" past "+n+" playlist end "+s),!1;var o=Er(null,a.fragments,i);if(!o)return r.log('"'+e.identifier+'" resumption '+i+" does not align with any fragments in "+n+" playlist ("+a.fragStart+"-"+a.fragmentEnd+")"),!0;var l="audio"===n?.175:0;return!(Math.abs(o.start-i)<su+l||Math.abs(o.end-i)<su+l||(r.log('"'+e.identifier+'" resumption '+i+" not aligned with "+n+" fragment bounds ("+o.start+"-"+o.end+" sn: "+o.sn+" cc: "+o.cc+")"),0))}))},r.updateAssetDurations=function(e){if(e.assetListLoaded){for(var t=e.timelineStart,r=0,i=!1,n=!1,a=0;a<e.assetList.length;a++){var s=e.assetList[a],o=t+r;s.startOffset=r,s.timelineStart=o,i||(i=null===s.duration),n||(n=!!s.error),r+=s.error?0:s.duration||0}e.duration=i&&!n?Math.max(r,e.duration):r}},r.removeEvent=function(e){e.reset(),delete this.eventMap[e.identifier]},i(t,[{key:"duration",get:function(){var e=this.items;return e?e[e.length-1].end:0}},{key:"length",get:function(){return this.items?this.items.length:0}},{key:"assetIdAtEnd",get:function(){var e,t=null==(e=this.items)||null==(e=e[this.length-1])?void 0:e.event;if(t){var r=t.assetList,i=r[r.length-1];if(i)return i.identifier}return null}}])}(de);function yu(e){return"["+(e.event?'"'+e.event.identifier+'"':"primary")+": "+e.start.toFixed(2)+"-"+e.end.toFixed(2)+"]"}var Eu=function(){function e(e){this.hls=void 0,this.hls=e}var t=e.prototype;return t.destroy=function(){this.hls=null},t.loadAssetList=function(e,t){var r,i=this,n=e.assetListUrl;try{r=hu(n,this.hls.sessionId,e.baseUrl)}catch(t){var a=this.assignAssetListError(e,$.ASSET_LIST_LOAD_ERROR,t,n);return void this.hls.trigger(G.ERROR,a)}t&&"data:"!==r.protocol&&zt(r,"_HLS_start_offset",""+t);var s=this.hls.config,o=new(0,s.loader)(s),l={type:V.INTERSTITIAL_ASSET_LIST,responseType:"json",url:r.href},u=s.interstitialAssetListLoadPolicy.default,d={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},c={onSuccess:function(t,r,n,a){var s=t.data,o=null==s?void 0:s.ASSETS;if(Array.isArray(o))e.assetListResponse=s,i.hls.trigger(G.ASSET_LIST_LOADED,{event:e,assetListResponse:s,networkDetails:a});else{var l=i.assignAssetListError(e,$.ASSET_LIST_PARSING_ERROR,new Error("Invalid interstitial asset list"),n.url,r,a);i.hls.trigger(G.ERROR,l)}},onError:function(t,r,n,a){var s=i.assignAssetListError(e,$.ASSET_LIST_LOAD_ERROR,new Error("Error loading X-ASSET-LIST: HTTP status "+t.code+" "+t.text+" ("+r.url+")"),r.url,a,n);i.hls.trigger(G.ERROR,s)},onTimeout:function(t,r,n){var a=i.assignAssetListError(e,$.ASSET_LIST_LOAD_TIMEOUT,new Error("Timeout loading X-ASSET-LIST ("+r.url+")"),r.url,t,n);i.hls.trigger(G.ERROR,a)}};return o.load(l,d,c),this.hls.trigger(G.ASSET_LIST_LOADING,{event:e}),o},t.assignAssetListError=function(e,t,r,i,n,a){return e.error=r,{type:B.NETWORK_ERROR,details:t,fatal:!1,interstitial:e,url:i,error:r,networkDetails:a,stats:n}},e}();function bu(e){var t;null==e||null==(t=e.play())||t.catch((function(){}))}function Tu(e,t){return"["+e+"] Advancing timeline position to "+t}var Su=function(e){function t(t,r){var i;return(i=e.call(this,"interstitials",t.logger)||this).HlsPlayerClass=void 0,i.hls=void 0,i.assetListLoader=void 0,i.mediaSelection=null,i.altSelection=null,i.media=null,i.detachedData=null,i.requiredTracks=null,i.manager=null,i.playerQueue=[],i.bufferedPos=-1,i.timelinePos=-1,i.schedule=void 0,i.playingItem=null,i.bufferingItem=null,i.waitingItem=null,i.endedItem=null,i.playingAsset=null,i.endedAsset=null,i.bufferingAsset=null,i.bufferPastEdge=!1,i.shouldPlay=!1,i.onPlay=function(){i.shouldPlay=!0},i.onPause=function(){i.shouldPlay=!1},i.onSeeking=function(){var e=i.currentTime;if(void 0!==e&&!i.playbackDisabled&&i.schedule){var t=e-i.timelinePos;if(!(Math.abs(t)<1/7056e5)){var r=t<=-.01;-1!==i.timelinePos||i.effectivePlayingItem||i.checkStart(),i.timelinePos=e,i.bufferedPos=e;var n=i.playingItem;if(n)if(r&&i.schedule.resetErrorsInRange(e,e-t)&&i.updateSchedule(!0),i.checkBuffer(),r&&e<n.start||e>=n.end){var a,s=i.findItemIndex(n),o=i.schedule.findItemIndexAtTime(e);if(-1===o&&(o=s+(r?-1:1),i.log("seeked "+(r?"back ":"")+"to position not covered by schedule "+e+" (resolving from "+s+" to "+o+")")),!i.isInterstitial(n)&&null!=(a=i.media)&&a.paused&&(i.shouldPlay=!1),!r&&o>s){var l=i.schedule.findJumpRestrictedIndex(s+1,o);if(l>s)return void i.setSchedulePosition(l)}i.setSchedulePosition(o)}else{var u=i.playingAsset;if(u){var d,c=u.timelineStart,h=u.duration||0;(r&&e<c||e>=c+h)&&(null!=(d=n.event)&&d.appendInPlace&&(i.clearAssetPlayers(n.event,n),i.flushFrontBuffer(e)),i.setScheduleToAssetAtTime(e,u))}else if(i.playingLastItem&&i.isInterstitial(n)){var f=n.event.assetList[0];f&&(i.endedItem=i.playingItem,i.playingItem=null,i.setScheduleToAssetAtTime(e,f))}}else i.checkBuffer()}}},i.onTimeupdate=function(){var e=i.currentTime;if(void 0!==e&&!i.playbackDisabled&&(-1!==i.timelinePos||i.effectivePlayingItem||i.checkStart(),e>i.timelinePos)){i.timelinePos=e,e>i.bufferedPos&&i.checkBuffer();var t=i.playingItem;if(t&&!i.playingLastItem){if(e>=t.end){i.timelinePos=t.end;var r=i.findItemIndex(t);i.setSchedulePosition(r+1)}var n=i.playingAsset;n&&e>=n.timelineStart+(n.duration||0)&&i.setScheduleToAssetAtTime(e,n)}}},i.onScheduleUpdate=function(e,t){var r=i.schedule;if(r){var n=i.playingItem,a=r.events||[],s=r.items||[],o=r.durations,l=e.map((function(e){return e.identifier})),u=!(!a.length&&!l.length);(u||t)&&i.log("INTERSTITIALS_UPDATED ("+a.length+"): "+a+"\nSchedule: "+s.map((function(e){return yu(e)}))+" pos: "+i.timelinePos),l.length&&i.log("Removed events "+l);var d=null,c=null;n&&(d=i.updateItem(n,i.timelinePos),i.itemsMatch(n,d)?i.playingItem=d:i.waitingItem=null),i.waitingItem=i.updateItem(i.waitingItem);var h=i.bufferingItem;if(h&&(c=i.updateItem(h,i.bufferedPos),i.itemsMatch(h,c)?i.bufferingItem=c:h.event&&(i.bufferingItem=i.playingItem,i.clearInterstitial(h.event,null))),e.forEach((function(e){e.assetList.forEach((function(e){i.clearAssetPlayer(e.identifier,null)}))})),i.playerQueue.forEach((function(e){if(e.interstitial.appendInPlace){var t=e.assetItem.timelineStart,r=e.timelineOffset-t;if(r)try{e.timelineOffset=t}catch(n){Math.abs(r)>su&&i.warn(n+' ("'+e.assetId+'" '+e.timelineOffset+"->"+t+")")}}})),u||t){if(i.hls.trigger(G.INTERSTITIALS_UPDATED,{events:a.slice(0),schedule:s.slice(0),durations:o,removedIds:l}),i.isInterstitial(n)&&l.indexOf(n.event.identifier)>-1)return i.warn('Interstitial "'+n.event.identifier+'" removed while playing'),void i.primaryFallback(n.event);n&&i.trimInPlace(d,n),h&&c!==d&&i.trimInPlace(c,h),i.checkBuffer()}}},i.hls=t,i.HlsPlayerClass=r,i.assetListLoader=new Eu(t),i.schedule=new mu(i.onScheduleUpdate,t.logger),i.registerListeners(),i}c(t,e);var r=t.prototype;return r.registerListeners=function(){var e=this.hls;e&&(e.on(G.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(G.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(G.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(G.MANIFEST_LOADING,this.onManifestLoading,this),e.on(G.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(G.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(G.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.on(G.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(G.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.on(G.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.on(G.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.on(G.BUFFER_APPENDED,this.onBufferAppended,this),e.on(G.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(G.BUFFERED_TO_END,this.onBufferedToEnd,this),e.on(G.MEDIA_ENDED,this.onMediaEnded,this),e.on(G.ERROR,this.onError,this),e.on(G.DESTROYING,this.onDestroying,this))},r.unregisterListeners=function(){var e=this.hls;e&&(e.off(G.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(G.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(G.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(G.MANIFEST_LOADING,this.onManifestLoading,this),e.off(G.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(G.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(G.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.off(G.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(G.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.off(G.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.off(G.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.off(G.BUFFER_CODECS,this.onBufferCodecs,this),e.off(G.BUFFER_APPENDED,this.onBufferAppended,this),e.off(G.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(G.BUFFERED_TO_END,this.onBufferedToEnd,this),e.off(G.MEDIA_ENDED,this.onMediaEnded,this),e.off(G.ERROR,this.onError,this),e.off(G.DESTROYING,this.onDestroying,this))},r.startLoad=function(){this.resumeBuffering()},r.stopLoad=function(){this.pauseBuffering()},r.resumeBuffering=function(){var e;null==(e=this.getBufferingPlayer())||e.resumeBuffering()},r.pauseBuffering=function(){var e;null==(e=this.getBufferingPlayer())||e.pauseBuffering()},r.destroy=function(){this.unregisterListeners(),this.stopLoad(),this.assetListLoader&&this.assetListLoader.destroy(),this.emptyPlayerQueue(),this.clearScheduleState(),this.schedule&&this.schedule.destroy(),this.media=this.detachedData=this.mediaSelection=this.requiredTracks=this.altSelection=this.schedule=this.manager=null,this.hls=this.HlsPlayerClass=null,this.assetListLoader=null,this.onPlay=this.onPause=this.onSeeking=this.onTimeupdate=null,this.onScheduleUpdate=null},r.onDestroying=function(){var e=this.primaryMedia||this.media;e&&this.removeMediaListeners(e)},r.removeMediaListeners=function(e){An(e,"play",this.onPlay),An(e,"pause",this.onPause),An(e,"seeking",this.onSeeking),An(e,"timeupdate",this.onTimeupdate)},r.onMediaAttaching=function(e,t){var r=this.media=t.media;wn(r,"seeking",this.onSeeking),wn(r,"timeupdate",this.onTimeupdate),wn(r,"play",this.onPlay),wn(r,"pause",this.onPause)},r.onMediaAttached=function(e,t){var r=this.effectivePlayingItem,i=this.detachedData;if(this.detachedData=null,null===r)this.checkStart();else if(!i){this.clearScheduleState();var n=this.findItemIndex(r);this.setSchedulePosition(n)}},r.clearScheduleState=function(){this.log("clear schedule state"),this.playingItem=this.bufferingItem=this.waitingItem=this.endedItem=this.playingAsset=this.endedAsset=this.bufferingAsset=null},r.onMediaDetaching=function(e,t){var r=!!t.transferMedia,i=this.media;if(this.media=null,!r&&(i&&this.removeMediaListeners(i),this.detachedData)){var n=this.getBufferingPlayer();n&&(this.log("Removing schedule state for detachedData and "+n),this.playingAsset=this.endedAsset=this.bufferingAsset=this.bufferingItem=this.waitingItem=this.detachedData=null,n.detachMedia()),this.shouldPlay=!1}},r.isInterstitial=function(e){return!(null==e||!e.event)},r.retreiveMediaSource=function(e,t){var r=this.getAssetPlayer(e);r&&this.transferMediaFromPlayer(r,t)},r.transferMediaFromPlayer=function(e,t){var r=e.interstitial.appendInPlace,i=e.media;if(r&&i===this.primaryMedia){if(this.bufferingAsset=null,(!t||this.isInterstitial(t)&&!t.event.appendInPlace)&&t&&i)return void(this.detachedData={media:i});var n=e.transferMedia();this.log("transfer MediaSource from "+e+" "+sr(n)),this.detachedData=n}else t&&i&&(this.shouldPlay||(this.shouldPlay=!i.paused))},r.transferMediaTo=function(e,t){var r,i,n=this;if(e.media!==t){var a,s=null,o=this.hls,l=e!==o,u=l&&e.interstitial.appendInPlace,d=null==(r=this.detachedData)?void 0:r.mediaSource;if(o.media)u&&(s=o.transferMedia(),this.detachedData=s),a="Primary";else{var c=this.getBufferingPlayer();c?(s=c.transferMedia(),this.detachedData=s,a=""+c):a=d?"detached MediaSource":"detached media"}if(!s)if(d)s=this.detachedData,this.log("using detachedData: MediaSource "+sr(s));else if(!this.detachedData||o.media===t){var h=this.playerQueue;h.length>1&&h.forEach((function(e){if(l&&e.interstitial.appendInPlace!==u){var t=e.interstitial;n.clearInterstitial(e.interstitial,null),t.appendInPlace=!1,t.appendInPlace&&n.warn("Could not change append strategy for queued assets "+t)}})),this.hls.detachMedia(),this.detachedData={media:t}}var f=s&&"mediaSource"in s&&"closed"!==(null==(i=s.mediaSource)?void 0:i.readyState);if(this.log((f?"transfering MediaSource":"attaching media")+" to "+(l?e:"Primary")+" from "+a+" (media.currentTime: "+t.currentTime+")"),f||l){var v=f&&s?g({},s):{media:t},p=this.schedule;if(p&&l){var m=e.assetId===p.assetIdAtEnd;v.overrides={duration:p.duration,endOfStream:m||!1===e.appendInPlace}}if(!f&&u){var y=e,E=y.assetItem.timelineStart;if(E){var b=y.hls,T=Math.max(this.timelinePos-E,Number.EPSILON);b.startPosition!==T&&(this.log("Set "+y+" startPosition: "+T),b.config.startPosition=T,b.loadingEnabled&&b.startLoad(T))}}e.attachMedia(v)}else e.attachMedia(t)}},r.onInterstitialCueEnter=function(){this.onTimeupdate()},r.checkStart=function(){var e=this.schedule,t=null==e?void 0:e.events,r=this.hls;if(t&&!this.playbackDisabled&&this.media&&r){-1===this.bufferedPos&&(this.bufferedPos=0);var i=this.timelinePos,n=this.effectivePlayingItem;if(-1===i){if(!r.loadingEnabled)return void this.log("waiting for startLoad( <startPosition> )");var a=r.startPosition;if(this.timelinePos=a,0===t.length)this.setSchedulePosition(0);else if(t[0].cue.pre){this.log(Tu("checkStart (preroll)",a));var s=e.findEventIndex(t[0].identifier);this.setSchedulePosition(s)}else if(a>=0||!this.primaryLive){this.log(Tu("checkStart",a));var o=this.timelinePos=a>0?a:0,l=e.findItemIndexAtTime(o);this.setSchedulePosition(l)}else 0===r.liveSyncPosition?this.setSchedulePosition(0):this.log("[checkStart] waiting for live start")}else if(n&&!this.playingItem){this.log(Tu("checkStart (playing item)",n.start));var u=e.findItemIndex(n);this.setSchedulePosition(u)}}},r.advanceAssetBuffering=function(e,t){var r=e.event,i=r.findAssetIndex(t),n=fu(r,i);if(r.isAssetPastPlayoutLimit(n)){if(this.schedule){var a,s=this.getNextItemIndex(e,!0),o=null==(a=this.schedule.items)?void 0:a[s];o&&this.bufferedToItem(o)}}else this.bufferedToEvent(e,n)},r.livePrerollResumption=function(e,t){if(e.cue.pre&&this.primaryLive&&!F(e.resumeOffset)&&this.hls){var r=this.getLiveStartPos();if(t){var i=this.getBufferingPlayer();return r+(null!=i&&i.interstitial.cue.pre?i.remaining:0)}return r}},r.getNextItemIndex=function(e,t){if(this.schedule){var r=this.livePrerollResumption(e.event,t);if(void 0!==r)return this.log("find next item index @"+r),this.schedule.findItemIndexAtTime(r)}return this.findItemIndex(e)+1},r.advanceAfterAssetEnded=function(e,t,r){var i=fu(e,r);if(e.isAssetPastPlayoutLimit(i)){if(this.schedule){var n=this.schedule.items;if(n){var a=n[t],s=a.event?this.getNextItemIndex(a):t+1;if(s>=n.length)return void this.setSchedulePosition(-1);var o=e.resumeTime;this.timelinePos<o&&(this.log(Tu("advanceAfterAssetEnded",o)),this.timelinePos=o,e.appendInPlace&&!n[s].event&&this.hls.startLoad(o+.01),this.checkBuffer(this.bufferedPos<o)),this.setSchedulePosition(s)}}}else{if(e.appendInPlace){var l=e.assetList[i];l&&this.advanceInPlace(l.timelineStart)}this.setSchedulePosition(t,i)}},r.setScheduleToAssetAtTime=function(e,t){var r=this.schedule;if(r){var i=t.parentIdentifier,n=r.getEvent(i);if(n){var a=r.findEventIndex(i),s=r.findAssetIndex(n,e);this.advanceAfterAssetEnded(n,a,s-1)}}},r.setSchedulePosition=function(e,t){var r,i=null==(r=this.schedule)?void 0:r.items;if(i&&!this.playbackDisabled){var n=e>=0?i[e]:null;this.log("setSchedulePosition "+e+", "+t+" ("+(n?yu(n):n)+") pos: "+this.timelinePos);var a=this.waitingItem||this.playingItem,s=this.playingLastItem;if(this.isInterstitial(a)){var o=a.event,l=this.playingAsset,u=null==l?void 0:l.identifier,d=u?this.getAssetPlayer(u):null;if(d&&u&&(!this.eventItemsMatch(a,n)||void 0!==t&&u!==o.assetList[t].identifier)){var c,h=o.findAssetIndex(l);if(this.log("INTERSTITIAL_ASSET_ENDED "+(h+1)+"/"+o.assetList.length+" "+gu(l)),this.endedAsset=l,this.playingAsset=null,this.hls.trigger(G.INTERSTITIAL_ASSET_ENDED,{asset:l,assetListIndex:h,event:o,schedule:i.slice(0),scheduleIndex:e,player:d}),a!==this.playingItem)return void(this.itemsMatch(a,this.playingItem)&&!this.playingAsset&&this.advanceAfterAssetEnded(o,this.findItemIndex(this.playingItem),h));this.retreiveMediaSource(u,n),!d.media||null!=(c=this.detachedData)&&c.mediaSource||d.detachMedia()}if(!this.eventItemsMatch(a,n)&&(this.endedItem=a,this.playingItem=this.waitingItem=null,this.log("INTERSTITIAL_ENDED "+o+" "+yu(a)),o.hasPlayed=!0,this.hls.trigger(G.INTERSTITIAL_ENDED,{event:o,schedule:i.slice(0),scheduleIndex:e}),o.cue.once&&this.hls)){var f;this.updateSchedule();var g=null==(f=this.schedule)?void 0:f.items;if(n&&g){var v=this.findItemIndex(n),p=this.livePrerollResumption(o);if(void 0!==p){var m=p,y=this.getNextItemIndex(a);if(!this.isInterstitial(i[y])){var E,b=null==(E=this.primaryDetails)?void 0:E.fragments;if(o.snapOptions.in&&b){var T=Er(null,b,p);T&&(m=Math.min(Math.max(i[y].start,du(m,T)),i[y].end))}}if(this.log(Tu("live join (preroll)",m)),this.timelinePos=m,y!==v&&(y||0===y))return void this.advanceSchedule(y,g,void 0,a,s)}this.advanceSchedule(v,g,t,a,s)}return}}this.advanceSchedule(e,i,t,a,s)}},r.advanceSchedule=function(e,t,r,i,n){var a=this,s=this.schedule;if(s){var o=t[e]||null,l=this.primaryMedia,u=this.playerQueue;if(u.length&&u.forEach((function(t){var r=t.interstitial,i=s.findEventIndex(r.identifier);(i<e||i>e+1)&&a.clearInterstitial(r,o)})),this.isInterstitial(o)){this.timelinePos=Math.min(Math.max(this.timelinePos,o.start),o.end);var d=o.event;if(void 0===r){var c=fu(d,(r=d.cue.pre?0:s.findAssetIndex(d,this.timelinePos))-1);if(d.isAssetPastPlayoutLimit(c)||d.appendInPlace&&this.timelinePos===o.end)return void this.advanceAfterAssetEnded(d,e,r);r=c}var h=this.waitingItem;this.assetsBuffered(o,l)||this.setBufferingItem(o);var f=this.preloadAssets(d,r);if(this.eventItemsMatch(o,h||i)||(this.waitingItem=o,this.log("INTERSTITIAL_STARTED "+yu(o)+" "+(d.appendInPlace?"append in place":"")),d.hasPlayed=!1,this.hls.trigger(G.INTERSTITIAL_STARTED,{event:d,schedule:t.slice(0),scheduleIndex:e})),!d.assetListLoaded)return void this.log("Waiting for ASSET-LIST to complete loading "+d);if(d.assetListLoader&&(d.assetListLoader.destroy(),d.assetListLoader=void 0),!l)return void this.log("Waiting for attachMedia to start Interstitial "+d);this.waitingItem=this.endedItem=null,this.playingItem=o;var g=d.assetList[r];if(!g)return void this.advanceAfterAssetEnded(d,e,r||0);if(f||(f=this.getAssetPlayer(g.identifier)),null===f||f.destroyed){var v=d.assetList.length;this.warn("asset "+(r+1)+"/"+v+" player destroyed "+d),(f=this.createAssetPlayer(d,g,r)).loadSource()}if(!this.eventItemsMatch(o,this.bufferingItem)&&d.appendInPlace&&this.isAssetBuffered(g))return;this.startAssetPlayer(f,r,t,e,l),this.shouldPlay&&bu(f.media)}else o?(this.resumePrimary(o,e,i),this.shouldPlay&&bu(this.hls.media)):n&&this.isInterstitial(i)&&(this.endedItem=null,this.playingItem=i,i.event.appendInPlace||this.attachPrimary(s.durations.primary,null))}},r.resumePrimary=function(e,t,r){var i,n;this.playingItem=e,this.playingAsset=this.endedAsset=null,this.waitingItem=null,this.bufferedToItem(e),this.endedItem=null,this.log("resuming "+yu(e));var a=this.timelinePos;if(null!=(i=this.detachedData)&&i.mediaSource?this.primaryLive&&this.startLoadingPrimaryAt(a):((a<e.start||a>=e.end||a<this.seekableStart)&&(a=this.getPrimaryResumption(e,t),this.log(Tu("resumePrimary",a)),this.timelinePos=a),this.attachPrimary(a,e)),r){var s=null==(n=this.schedule)?void 0:n.items;s&&(this.log("INTERSTITIALS_PRIMARY_RESUMED "+yu(e)),this.hls.trigger(G.INTERSTITIALS_PRIMARY_RESUMED,{schedule:s.slice(0),scheduleIndex:t}),this.checkBuffer())}},r.getPrimaryResumption=function(e,t,r){var i=e.start;if(this.primaryLive){if(0===t)return this.hls.startPosition;var n=this.endedItem||this.playingItem,a=null!=n&&n.event?this.livePrerollResumption(n.event,r):void 0;if(void 0!==a)return a;var s=this.primaryDetails;if(s){var o=s.fragmentStart,l=s.edge;if(i<o||i>l&&!r){var u=this.hls.liveSyncPosition;return this.log("primary resumption out of bounds ("+i+" ["+o+"-"+l+"]) snapping to liveSync "+u),u||o}}}return this.log("primary resumption itemStart: "+i),i},r.getLiveStartPos=function(){var e,t=this.hls.startPosition,r=this.hls.liveSyncPosition||0,i=3*((null==(e=this.primaryDetails)?void 0:e.targetduration)||10);return-1===t||r&&r-t<i?r||0:t},r.isAssetBuffered=function(e){var t=this.getAssetPlayer(e.identifier);return null!=t&&t.hls?t.hls.bufferedToEnd:oi.bufferInfo(this.primaryMedia,this.timelinePos,0).end+1>=e.timelineStart+(e.duration||0)},r.attachPrimary=function(e,t,r){t?this.setBufferingItem(t):this.bufferingItem=this.playingItem,this.bufferingAsset=null;var i=this.primaryMedia;if(i){var n=this.hls;n.media?this.checkBuffer():(this.transferMediaTo(n,i),r&&this.startLoadingPrimaryAt(e,r)),r||(this.log(Tu("attachPrimary",e)),this.timelinePos=e,this.startLoadingPrimaryAt(e,r))}},r.startLoadingPrimaryAt=function(e,t){var r=this.hls,i=r.loadingEnabled,n=r.bufferingEnabled,a=r.startPosition,s=r.hasEnoughToStart;if(this.log("Start loading primary @"+e+" bufferedPos: "+this.bufferedPos+" startPosition: "+a+" skip seek: "+t+" has enough "+s+" loadingEnabled: "+i+" bufferingEnabled: "+n),!t&&s||!i||Math.abs(a-e)>.1){var o=this.primaryDetails;if(null!=o&&o.live&&e+.5>=o.edge){var l=this.bufferingItem;return this.log("Resume primary loading when live passes "+e+" buffering item: "+(l?yu(l):null)),r.pauseBuffering(),void(this.bufferPastEdge=!0)}r.startLoad(e,t)}else n||r.resumeBuffering()},r.onManifestLoading=function(){var e;this.stopLoad(),null==(e=this.schedule)||e.reset(),this.emptyPlayerQueue(),this.clearScheduleState(),this.shouldPlay=!1,this.bufferedPos=this.timelinePos=-1,this.mediaSelection=this.altSelection=this.manager=this.requiredTracks=null,this.hls.off(G.BUFFER_CODECS,this.onBufferCodecs,this),this.hls.on(G.BUFFER_CODECS,this.onBufferCodecs,this)},r.onLevelUpdated=function(e,t){if(-1!==t.level&&this.schedule){var r=this.hls.levels[t.level];if(r.details){var i=g(g({},this.mediaSelection||this.altSelection),{},{main:r});this.mediaSelection=i;var n=this.hls.startPosition;if(this.schedule.parseInterstitialDateRanges(i,this.hls.config.interstitialAppendInPlace,-1===n?0:n),this.schedule.items)if(this.effectivePlayingItem){if(this.bufferPastEdge){var a=this.primaryDetails,s=this.bufferedPos;if(null!=a&&a.live&&s+.5<a.edge){this.bufferPastEdge=!1;var o=this.bufferingItem;if(this.log("Live edge "+a.edge+" passed buffer: "+s+" buffering item: "+(o?yu(o):null)),(null==o?void 0:o.end)===1/0){var l=this.playingItem,u=this.isInterstitial(l)&&l.event.appendInPlace;this.hls.startLoad(Math.max(s,o.start),u)}else{var d=this.getBufferingPlayer();d&&d.bufferedInPlaceToEnd(this.primaryMedia,d.currentTime)&&d.hls&&d.hls.trigger(G.BUFFERED_TO_END,void 0)}}}}else this.checkStart()}}},r.onAudioTrackUpdated=function(e,t){var r=this.hls.audioTracks[t.id],i=this.mediaSelection;if(i){var n=g(g({},i),{},{audio:r});this.mediaSelection=n}else this.altSelection=g(g({},this.altSelection),{},{audio:r})},r.onSubtitleTrackUpdated=function(e,t){var r=this.hls.subtitleTracks[t.id],i=this.mediaSelection;if(i){var n=g(g({},i),{},{subtitles:r});this.mediaSelection=n}else this.altSelection=g(g({},this.altSelection),{},{subtitles:r})},r.onAudioTrackSwitching=function(e,t){var r=ur(t);this.playerQueue.forEach((function(e){var i=e.hls;return i&&(i.setAudioOption(t)||i.setAudioOption(r))}))},r.onSubtitleTrackSwitch=function(e,t){var r=ur(t);this.playerQueue.forEach((function(e){var i=e.hls;return i&&(i.setSubtitleOption(t)||-1!==t.id&&i.setSubtitleOption(r))}))},r.onBufferCodecs=function(e,t){var r=t.tracks;r&&(this.requiredTracks=r)},r.onBufferAppended=function(e,t){this.checkBuffer()},r.onBufferFlushed=function(e,t){var r=this.playingItem;if(r&&!this.itemsMatch(r,this.bufferingItem)&&!this.isInterstitial(r)){var i=this.timelinePos;this.bufferedPos=i,this.checkBuffer()}},r.onBufferedToEnd=function(e){if(this.schedule){var t=this.schedule.events;if(this.bufferedPos<Number.MAX_VALUE&&t){for(var r=0;r<t.length;r++){var i=t[r];if(i.cue.post){var n=this.getEventItem(i.identifier);n&&this.eventItemsMatch(n,this.bufferingItem)&&this.bufferedToItem(n,0);break}}this.bufferedPos=Number.MAX_VALUE}}},r.onMediaEnded=function(e){var t=this.playingItem;if(!this.playingLastItem&&t){var r=this.findItemIndex(t);this.setSchedulePosition(r+1)}else this.shouldPlay=!1},r.updateItem=function(e,t){var r,i=null==(r=this.schedule)?void 0:r.items;return e&&i&&i[this.findItemIndex(e,t)]||null},r.trimInPlace=function(e,t){var r=this;if(this.isInterstitial(e)&&e.event.appendInPlace&&t.end-e.end>.25){e.event.assetList.forEach((function(t,i){e.event.isAssetPastPlayoutLimit(i)&&r.clearAssetPlayer(t.identifier,null)}));var i=e.end+.25,n=oi.bufferInfo(this.primaryMedia,i,0);(n.end>i||(n.nextStart||0)>i)&&(this.log("trim buffered interstitial "+yu(e)+" (was "+yu(t)+")"),this.attachPrimary(i,null,!0),this.flushFrontBuffer(i))}},r.itemsMatch=function(e,t){return!!t&&(e===t||e.event&&t.event&&this.eventItemsMatch(e,t)||!e.event&&!t.event&&this.findItemIndex(e)===this.findItemIndex(t))},r.eventItemsMatch=function(e,t){var r;return!!t&&(e===t||e.event.identifier===(null==(r=t.event)?void 0:r.identifier))},r.findEventIndex=function(e){return this.schedule?this.schedule.findEventIndex(e):-1},r.getEventItem=function(e){if(this.schedule){var t,r=null==(t=this.schedule.items)?void 0:t[this.findEventIndex(e)];if(this.isInterstitial(r)&&r.event.identifier===e)return r}},r.findItemIndex=function(e,t){return e&&this.schedule?this.schedule.findItemIndex(e,t):-1},r.updateSchedule=function(e){var t,r;void 0===e&&(e=!1);var i=this.mediaSelection;if(i){var n=(null==(t=this.hls)?void 0:t.liveSyncPosition)||0;null==(r=this.schedule)||r.updateSchedule(i,[],n,e)}},r.checkBuffer=function(e){var t,r=null==(t=this.schedule)?void 0:t.items;if(r){var i=oi.bufferInfo(this.primaryMedia,this.timelinePos,0);e&&(this.bufferedPos=this.timelinePos),e||(e=i.len<1),this.updateBufferedPos(i.end,r,e)}},r.updateBufferedPos=function(e,t,r){var i=this.schedule,n=this.bufferingItem;if(!(this.bufferedPos>e)&&i)if(1===t.length&&this.itemsMatch(t[0],n))this.bufferedPos=e;else{var a=this.playingItem,s=this.findItemIndex(a),o=i.findItemIndexAtTime(e);if(this.bufferedPos<e){var l,u=this.findItemIndex(n),d=Math.min(u+1,t.length-1),c=t[d];if((-1===o&&n&&e>=n.end||null!=(l=c.event)&&l.appendInPlace&&e+.01>=c.start)&&(o=d),this.isInterstitial(n)){var h=n.event;if(d-s>1&&!1===h.appendInPlace)return;if(0===h.assetList.length&&h.assetListLoader)return}if(this.bufferedPos=e,o>u&&o>s)this.bufferedToItem(c);else{var f=this.primaryDetails;this.primaryLive&&f&&e>f.edge-f.targetduration&&c.start<f.edge+this.hls.config.interstitialLiveLookAhead&&this.isInterstitial(c)&&this.preloadAssets(c.event,0)}}else r&&a&&!this.itemsMatch(a,n)&&(o===s?this.bufferedToItem(a):o===s+1&&this.bufferedToItem(t[o]))}},r.assetsBuffered=function(e,t){var r=this;return 0!==e.event.assetList.length&&!e.event.assetList.some((function(e){var i=r.getAssetPlayer(e.identifier);return!(null!=i&&i.bufferedInPlaceToEnd(t))}))},r.setBufferingItem=function(e){var t=this,r=this.bufferingItem,i=this.schedule;if(!this.itemsMatch(e,r)&&i){var n=i.items,a=i.events;if(!n||!a)return r;var s=this.isInterstitial(e),o=this.getBufferingPlayer();this.bufferingItem=e,this.bufferedPos=Math.max(e.start,Math.min(e.end,this.timelinePos));var l=o?o.remaining:r?r.end-this.timelinePos:0;if(this.log("INTERSTITIALS_BUFFERED_TO_BOUNDARY "+yu(e)+(r?" ("+l.toFixed(2)+" remaining)":"")),!this.playbackDisabled)if(s){var u=i.findAssetIndex(e.event,this.bufferedPos);e.event.assetList.forEach((function(e,r){var i=t.getAssetPlayer(e.identifier);i&&(r===u&&i.loadSource(),i.resumeBuffering())}))}else this.hls.resumeBuffering(),this.playerQueue.forEach((function(e){return e.pauseBuffering()}));this.hls.trigger(G.INTERSTITIALS_BUFFERED_TO_BOUNDARY,{events:a.slice(0),schedule:n.slice(0),bufferingIndex:this.findItemIndex(e),playingIndex:this.findItemIndex(this.playingItem)})}else this.bufferingItem!==e&&(this.bufferingItem=e);return r},r.bufferedToItem=function(e,t){void 0===t&&(t=0);var r=this.setBufferingItem(e);if(!this.playbackDisabled)if(this.isInterstitial(e))this.bufferedToEvent(e,t);else if(null!==r){this.bufferingAsset=null;var i=this.getPrimaryResumption(e,this.findItemIndex(e),!0),n=this.bufferedPos=Math.max(i,Math.min(this.bufferedPos,e.end),this.timelinePos,e.start),a=this.detachedData;if(a)a.mediaSource?this.attachPrimary(n,e,!0):this.startLoadingPrimaryAt(n);else{var s=this.playingItem,o=this.isInterstitial(s)&&s.event.appendInPlace;this.startLoadingPrimaryAt(n,o)}}},r.bufferedToEvent=function(e,t){var r=e.event,i=0===r.assetList.length&&!r.assetListLoader,n=r.cue.once;if(i||!n){var a=this.preloadAssets(r,t);if(null!=a&&a.interstitial.appendInPlace){var s=this.primaryMedia;s&&this.bufferAssetPlayer(a,s)}}},r.preloadAssets=function(e,t){var r=e.assetUrl,i=e.assetList.length,n=0===i&&!e.assetListLoader,a=e.cue.once;if(n){var s,o,l=e.timelineStart,u=this.playingItem,d=this.getBufferingPlayer();e.appendInPlace&&(this.isInterstitial(u)||(null==u||null==(s=u.nextEvent)?void 0:s.identifier)!==e.identifier||this.flushFrontBuffer(l+.25));var c=0;if(d&&!d.interstitial.cue.pre||!this.primaryLive||(c=this.getLiveStartPos(),d&&(c+=d.remaining)),c&&!e.cue.pre&&!e.cue.post){var h=c-l;h>0&&(o=Math.round(1e3*h)/1e3)}if(this.log("Load interstitial asset "+(t+1)+"/"+(r?1:i)+" "+e+(c?" live-start: "+c+" start-offset: "+o+" (timeline-start: "+l+")":"")),r)return this.createAsset(e,0,0,l,e.duration,r);var f=this.assetListLoader.loadAssetList(e,o);f&&(e.assetListLoader=f)}else if(!a&&i){for(var g=t;g<i;g++){var v=e.assetList[g],p=this.getAssetPlayerQueueIndex(v.identifier);-1!==p&&!this.playerQueue[p].destroyed||v.error||this.createAssetPlayer(e,v,g)}var m=e.assetList[t];if(m){var y=this.getAssetPlayer(m.identifier);return y&&y.loadSource(),y}}return null},r.flushFrontBuffer=function(e){var t=this,r=this.requiredTracks;if(r){var i=this.primaryDetails;i&&e>=i.edge||(this.log("Removing front buffer starting at "+e),Object.keys(r).forEach((function(r){t.hls.trigger(G.BUFFER_FLUSHING,{startOffset:e,endOffset:1/0,type:r})})))}},r.getAssetPlayerQueueIndex=function(e){for(var t=this.playerQueue,r=0;r<t.length;r++)if(e===t[r].assetId)return r;return-1},r.getAssetPlayer=function(e){var t=this.getAssetPlayerQueueIndex(e);return this.playerQueue[t]||null},r.getBufferingPlayer=function(){var e=this.playerQueue,t=this.primaryMedia;if(t)for(var r=0;r<e.length;r++)if(e[r].media===t)return e[r];return null},r.createAsset=function(e,t,r,i,n,a){var s={parentIdentifier:e.identifier,identifier:lu(e,a,t),duration:n,startOffset:r,timelineStart:i,uri:a};return this.createAssetPlayer(e,s,t)},r.createAssetPlayer=function(e,t,r){var i=this,n=this.hls,a=n.userConfig,s=pr(n.loadLevelObj||n.levels[n.currentLevel],a.videoPreference),o=n.audioTracks[n.audioTrack],l=n.subtitleTracks[n.subtitleTrack],d=0;if(this.primaryLive||e.appendInPlace){var c=this.timelinePos-t.timelineStart;if(c>=0){var h=t.duration;h&&c<h&&(d=c)}}var f=t.identifier,v=g(g({},a),{},{maxMaxBufferLength:Math.min(15,n.config.maxMaxBufferLength),autoStartLoad:!0,startFragPrefetch:!0,primarySessionId:n.sessionId,assetPlayerId:f,abrEwmaDefaultEstimate:n.bandwidthEstimate,interstitialsController:void 0,startPosition:d,liveDurationInfinity:!1,testBandwidth:!1,videoPreference:s,audioPreference:o||a.audioPreference,subtitlePreference:l||a.subtitlePreference});e.appendInPlace&&(e.appendInPlaceStarted=!0,t.timelineStart&&(v.timelineOffset=t.timelineStart));var p=v.cmcd;null!=p&&p.sessionId&&p.contentId&&(v.cmcd=u({},p,{contentId:au(t.uri)})),this.getAssetPlayer(f)&&this.warn("Duplicate date range identifier "+e+" and asset "+f);var m=new vu(this.HlsPlayerClass,v,e,t);this.playerQueue.push(m),e.assetList[r]=t;var y=!0,E=function(n){if(n.live){var a=new Error("Interstitials MUST be VOD assets "+e),s={fatal:!0,type:B.OTHER_ERROR,details:$.INTERSTITIAL_ASSET_ITEM_ERROR,error:a},o=i.findEventIndex(e.identifier);i.handleAssetItemError(s,e,o,r,a.message)}else{var l=n.edge-n.fragmentStart,u=t.duration;(y||null===u||l>u)&&(y=!1,i.log('Interstitial asset "'+f+'" duration change '+u+" > "+l),t.duration=l,i.updateSchedule())}};m.on(G.LEVEL_UPDATED,(function(e,t){var r=t.details;return E(r)})),m.on(G.LEVEL_PTS_UPDATED,(function(e,t){var r=t.details;return E(r)})),m.on(G.EVENT_CUE_ENTER,(function(){return i.onInterstitialCueEnter()}));var b=function(e,t){var r=i.getAssetPlayer(f);if(r&&t.tracks){r.off(G.BUFFER_CODECS,b),r.tracks=t.tracks;var n=i.primaryMedia;i.bufferingAsset===r.assetItem&&n&&!r.media&&i.bufferAssetPlayer(r,n)}};m.on(G.BUFFER_CODECS,b),m.on(G.BUFFERED_TO_END,(function(){var t=i.getAssetPlayer(f);if(i.log("buffered to end of asset "+t),t&&i.schedule){var r=i.getEventItem(e.identifier);r&&i.advanceAssetBuffering(r,t.assetItem)}}));var T=function(t){return function(){if(i.getAssetPlayer(f)&&i.schedule){i.shouldPlay=!0;var r=i.findEventIndex(e.identifier);i.advanceAfterAssetEnded(e,r,t)}}};return m.once(G.MEDIA_ENDED,T(r)),m.once(G.PLAYOUT_LIMIT_REACHED,T(1/0)),m.on(G.ERROR,(function(t,n){if(i.schedule){var a=i.getAssetPlayer(f);if(n.details===$.BUFFER_STALLED_ERROR)return null!=a&&a.appendInPlace?void i.handleInPlaceStall(e):(i.onTimeupdate(),void i.checkBuffer(!0));n.details!==$.BUFFER_SEEK_OVER_HOLE&&i.handleAssetItemError(n,e,i.findEventIndex(e.identifier),r,"Asset player error "+n.error+" "+e)}})),m.on(G.DESTROYING,(function(){if(i.getAssetPlayer(f)&&i.schedule){var t=new Error("Asset player destroyed unexpectedly "+f),n={fatal:!0,type:B.OTHER_ERROR,details:$.INTERSTITIAL_ASSET_ITEM_ERROR,error:t};i.handleAssetItemError(n,e,i.findEventIndex(e.identifier),r,t.message)}})),this.log("INTERSTITIAL_ASSET_PLAYER_CREATED "+gu(t)),this.hls.trigger(G.INTERSTITIAL_ASSET_PLAYER_CREATED,{asset:t,assetListIndex:r,event:e,player:m}),m},r.clearInterstitial=function(e,t){this.clearAssetPlayers(e,t),e.reset()},r.clearAssetPlayers=function(e,t){var r=this;e.assetList.forEach((function(e){r.clearAssetPlayer(e.identifier,t)}))},r.resetAssetPlayer=function(e){var t=this.getAssetPlayerQueueIndex(e);if(-1!==t){this.log('reset asset player "'+e+'" after error');var r=this.playerQueue[t];this.transferMediaFromPlayer(r,null),r.resetDetails()}},r.clearAssetPlayer=function(e,t){var r=this.getAssetPlayerQueueIndex(e);if(-1!==r){var i=this.playerQueue[r];this.log("clear "+i+" toSegment: "+(t?yu(t):t)),this.transferMediaFromPlayer(i,t),this.playerQueue.splice(r,1),i.destroy()}},r.emptyPlayerQueue=function(){for(var e;e=this.playerQueue.pop();)e.destroy();this.playerQueue=[]},r.startAssetPlayer=function(e,t,r,i,n){var a=e.interstitial,s=e.assetItem,o=e.assetId,l=a.assetList.length,u=this.playingAsset;this.endedAsset=null,this.playingAsset=s,(null==u?void 0:u.identifier)!==o&&(u&&(this.clearAssetPlayer(u.identifier,r[i]),delete u.error),this.log("INTERSTITIAL_ASSET_STARTED "+(t+1)+"/"+l+" "+gu(s)),this.hls.trigger(G.INTERSTITIAL_ASSET_STARTED,{asset:s,assetListIndex:t,event:a,schedule:r.slice(0),scheduleIndex:i,player:e})),this.bufferAssetPlayer(e,n)},r.bufferAssetPlayer=function(e,t){var r;if(this.schedule){var i=e.interstitial,n=e.assetItem,a=this.getEventItem(i.identifier);if(a)if(e.loadSource(),this.setBufferingItem(a),this.bufferingAsset=n,e.bufferedInPlaceToEnd(this.primaryMedia,e.currentTime))this.advanceAssetBuffering(a,n);else{var s=this.getBufferingPlayer();if(s!==e){var o=i.appendInPlace;if(!o||!1!==(null==s?void 0:s.interstitial.appendInPlace)){var l=(null==s?void 0:s.tracks)||(null==(r=this.detachedData)?void 0:r.tracks)||this.requiredTracks;if(o&&n!==this.playingAsset){if(!e.tracks)return void this.log("Waiting for track info before buffering "+e);if(l&&!Ee(l,e.tracks)){var u=new Error("Asset "+gu(n)+" SourceBuffer tracks ('"+Object.keys(e.tracks)+"') are not compatible with primary content tracks ('"+Object.keys(l)+"')"),d={fatal:!0,type:B.OTHER_ERROR,details:$.INTERSTITIAL_ASSET_ITEM_ERROR,error:u},c=i.findAssetIndex(n);return void this.handleAssetItemError(d,i,this.findEventIndex(i.identifier),c,u.message)}}this.transferMediaTo(e,t)}}}}},r.handleInPlaceStall=function(e){var t=this.schedule,r=this.primaryMedia;if(t&&r){var i=r.currentTime,n=t.findAssetIndex(e,i),a=e.assetList[n];if(a){var s=this.getAssetPlayer(a.identifier);if(s){var o=s.currentTime||i-a.timelineStart,l=s.duration-o;if(this.warn("Stalled at "+o+" of "+(o+l)+" in "+s+" "+e+" (media.currentTime: "+i+")"),o&&(l/r.playbackRate<.5||s.bufferedInPlaceToEnd(r,s.currentTime))&&s.hls){var u=t.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,u,n)}}}}},r.advanceInPlace=function(e){var t=this.primaryMedia;if(t&&t.currentTime<e){var r="advance currentTime to "+e+", duration: "+t.duration;t.duration>e?(this.log(r),t.currentTime=e):this.log("Cannot "+r)}},r.handleAssetItemError=function(e,t,r,i,n){if(e.details!==$.BUFFER_STALLED_ERROR){var a=t.assetList[i]||null;if(this.warn("INTERSTITIAL_ASSET_ERROR "+(a?gu(a):a)+" "+e.error),this.schedule){var s=(null==a?void 0:a.identifier)||"",o=this.getAssetPlayerQueueIndex(s),l=this.playerQueue[o]||null,d=this.schedule.items,c=u({},e,{fatal:!1,errorAction:Nr(!0),asset:a,assetListIndex:i,event:t,schedule:d,scheduleIndex:r,player:l});if(this.hls.trigger(G.INTERSTITIAL_ASSET_ERROR,c),e.fatal){var h=this.playingAsset,f=this.bufferingAsset,g=new Error(n);if(a&&(this.clearAssetPlayer(s,null),a.error=g),t.assetList.some((function(e){return!e.error})))for(var v=i;v<t.assetList.length;v++)this.resetAssetPlayer(t.assetList[v].identifier);else t.error=g;this.updateSchedule(!0),t.error?this.primaryFallback(t):(null==h?void 0:h.identifier)===s?this.advanceAfterAssetEnded(t,r,i):(null==f?void 0:f.identifier)===s&&this.isInterstitial(this.bufferingItem)&&this.advanceAssetBuffering(this.bufferingItem,f)}}}},r.primaryFallback=function(e){var t=e.timelineStart,r=this.effectivePlayingItem,i=this.playingItem,n=this.seekableStart,a=this.hls.startPosition,s=this.timelinePos;if(this.isInterstitial(r)){this.log('Fallback to primary from event "'+e.identifier+'" start: '+t+" pos: "+s+" playing: "+yu(r)+" startPosition: "+a+" seekableStart: "+n+" error: "+e.error),-1===s&&(s=a),s=Math.max(s,n);var o=this.updateItem(r,s);this.itemsMatch(r,o)&&this.clearInterstitial(e,null),e.appendInPlace&&(this.attachPrimary(t,null),this.flushFrontBuffer(t))}else if(-1===s)return void this.checkStart();if(this.schedule&&this.isInterstitial(i)){var l=this.schedule.findItemIndexAtTime(s);this.setSchedulePosition(l)}},r.onAssetListLoaded=function(e,t){var r,i,n=this,a=t.event,s=a.identifier,o=t.assetListResponse.ASSETS;if(null!=(r=this.schedule)&&r.hasEvent(s)){var l=a.timelineStart,u=a.duration,d=0;o.forEach((function(e,t){var r=parseFloat(e.DURATION);n.createAsset(a,t,d,l+d,r,e.URI),d+=r})),a.duration=d,this.log("Loaded asset-list with duration: "+d+" (was: "+u+") "+a);var c=this.waitingItem,h=(null==c?void 0:c.event.identifier)===s;this.updateSchedule();var f=null==(i=this.bufferingItem)?void 0:i.event;if(h){var g=this.findEventIndex(s),v=this.getEventItem(s);if(v){if(!this.playingItem&&this.timelinePos>v.end&&this.schedule.findItemIndexAtTime(this.timelinePos)!==g)return a.error=new Error("Interstitial "+(o.length?"no longer within playback range":"asset-list is empty")+" "+this.timelinePos+" "+a),this.log(a.error.message),this.updateSchedule(!0),void this.primaryFallback(a);this.setBufferingItem(v)}this.setSchedulePosition(g)}else if((null==f?void 0:f.identifier)===s){var p=a.assetList[0];if(p){var m=this.getAssetPlayer(p.identifier);if(f.appendInPlace){var y=this.primaryMedia;m&&y&&this.bufferAssetPlayer(m,y)}else m&&m.loadSource()}}}},r.onError=function(e,t){if(this.schedule)switch(t.details){case $.ASSET_LIST_PARSING_ERROR:case $.ASSET_LIST_LOAD_ERROR:case $.ASSET_LIST_LOAD_TIMEOUT:var r=t.interstitial;r&&(this.updateSchedule(!0),this.primaryFallback(r));break;case $.BUFFER_STALLED_ERROR:var i=this.endedItem||this.waitingItem||this.playingItem;if(this.isInterstitial(i)&&i.event.appendInPlace)return void this.handleInPlaceStall(i.event);var n=this.primaryMedia;this.log("Primary player stall @"+this.timelinePos+" currentTime: "+(null==n?void 0:n.currentTime)+" bufferedPos: "+this.bufferedPos),this.onTimeupdate(),this.checkBuffer(!0)}},i(t,[{key:"interstitialsManager",get:function(){if(!this.hls)return null;if(this.manager)return this.manager;var e=this,t=function(){return e.bufferingItem||e.waitingItem},r=function(t){return t?e.getAssetPlayer(t.identifier):t},i=function(t,i,a,s,o){if(t){var l=t[i].start,u=t.event;if(u){if("playout"===i||u.timelineOccupancy!==ou.Point){var d=r(a);(null==d?void 0:d.interstitial)===u&&(l+=d.assetItem.startOffset+d[o])}}else l+=("bufferedPos"===s?n():e[s])-t.start;return l}return 0},n=function(){var t=e.bufferedPos;return t===Number.MAX_VALUE?a("primary"):Math.max(t,0)},a=function(t){var r,i;return null!=(r=e.primaryDetails)&&r.live?e.primaryDetails.edge:(null==(i=e.schedule)?void 0:i.durations[t])||0},s=function(t,n){var a,s,o=e.effectivePlayingItem;if((null==o||null==(a=o.event)||!a.restrictions.skip)&&e.schedule){e.log("seek to "+t+' "'+n+'"');var l=e.effectivePlayingItem,u=e.schedule.findItemIndexAtTime(t,n),d=null==(s=e.schedule.items)?void 0:s[u],c=e.getBufferingPlayer(),h=null==c?void 0:c.interstitial,f=null==h?void 0:h.appendInPlace,g=l&&e.itemsMatch(l,d);if(l&&(f||g)){var v=r(e.playingAsset),p=(null==v?void 0:v.media)||e.primaryMedia;if(p){var m="primary"===n?p.currentTime:i(l,n,e.playingAsset,"timelinePos","currentTime"),y=t-m,E=(f?m:p.currentTime)+y;if(E>=0&&(!v||f||E<=v.duration))return void(p.currentTime=E)}}if(d){var b=t;if("primary"!==n){var T=t-d[n].start;b=d.start+T}var S=!e.isInterstitial(d);if(e.isInterstitial(l)&&!l.event.appendInPlace||!S&&!d.event.appendInPlace){if(l){var w=e.findItemIndex(l);if(u>w){var A=e.schedule.findJumpRestrictedIndex(w+1,u);if(A>w)return void e.setSchedulePosition(A)}var L=0;if(S)e.timelinePos=b,e.checkBuffer();else for(var I=d.event.assetList,k=t-(d[n]||d).start,R=I.length;R--;){var D=I[R];if(D.duration&&k>=D.startOffset&&k<D.startOffset+D.duration){L=R;break}}e.setSchedulePosition(u,L)}}else{var C=e.media||(f?null==c?void 0:c.media:null);C&&(C.currentTime=b)}}}},o=function(){var r=e.effectivePlayingItem;if(e.isInterstitial(r))return r;var i=t();return e.isInterstitial(i)?i:null},l={get bufferedEnd(){var r,n=t(),a=e.bufferingItem;return a&&a===n&&(i(a,"playout",e.bufferingAsset,"bufferedPos","bufferedEnd")-a.playout.start||(null==(r=e.bufferingAsset)?void 0:r.startOffset))||0},get currentTime(){var t=o(),r=e.effectivePlayingItem;return r&&r===t?i(r,"playout",e.effectivePlayingAsset,"timelinePos","currentTime")-r.playout.start:0},set currentTime(t){var r=o(),i=e.effectivePlayingItem;i&&i===r&&s(t+i.playout.start,"playout")},get duration(){var e=o();return e?e.playout.end-e.playout.start:0},get assetPlayers(){var t,r=null==(t=o())?void 0:t.event.assetList;return r?r.map((function(t){return e.getAssetPlayer(t.identifier)})):[]},get playingIndex(){var t,r=null==(t=o())?void 0:t.event;return r&&e.effectivePlayingAsset?r.findAssetIndex(e.effectivePlayingAsset):-1},get scheduleItem(){return o()}};return this.manager={get events(){var t;return(null==(t=e.schedule)||null==(t=t.events)?void 0:t.slice(0))||[]},get schedule(){var t;return(null==(t=e.schedule)||null==(t=t.items)?void 0:t.slice(0))||[]},get interstitialPlayer(){return o()?l:null},get playerQueue(){return e.playerQueue.slice(0)},get bufferingAsset(){return e.bufferingAsset},get bufferingItem(){return t()},get bufferingIndex(){var r=t();return e.findItemIndex(r)},get playingAsset(){return e.effectivePlayingAsset},get playingItem(){return e.effectivePlayingItem},get playingIndex(){var t=e.effectivePlayingItem;return e.findItemIndex(t)},primary:{get bufferedEnd(){return n()},get currentTime(){var t=e.timelinePos;return t>0?t:0},set currentTime(e){s(e,"primary")},get duration(){return a("primary")},get seekableStart(){return e.seekableStart}},integrated:{get bufferedEnd(){return i(t(),"integrated",e.bufferingAsset,"bufferedPos","bufferedEnd")},get currentTime(){return i(e.effectivePlayingItem,"integrated",e.effectivePlayingAsset,"timelinePos","currentTime")},set currentTime(e){s(e,"integrated")},get duration(){return a("integrated")},get seekableStart(){return function(t,r){var i;if(0!==t&&"primary"!==r&&null!=(i=e.schedule)&&i.length){var n,a=e.schedule.findItemIndexAtTime(t),s=null==(n=e.schedule.items)?void 0:n[a];if(s)return t+(s[r].start-s.start)}return t}(e.seekableStart,"integrated")}},skip:function(){var t=e.effectivePlayingItem,r=null==t?void 0:t.event;if(r&&!r.restrictions.skip){var i=e.findItemIndex(t);if(r.appendInPlace){var n=t.playout.start+t.event.duration;s(n+.001,"playout")}else e.advanceAfterAssetEnded(r,i,1/0)}}}}},{key:"effectivePlayingItem",get:function(){return this.waitingItem||this.playingItem||this.endedItem}},{key:"effectivePlayingAsset",get:function(){return this.playingAsset||this.endedAsset}},{key:"playingLastItem",get:function(){var e,t=this.playingItem,r=null==(e=this.schedule)?void 0:e.items;return!!(this.playbackStarted&&t&&r)&&this.findItemIndex(t)===r.length-1}},{key:"playbackStarted",get:function(){return null!==this.effectivePlayingItem}},{key:"currentTime",get:function(){var e,t;if(null!==this.mediaSelection){var r=this.waitingItem||this.playingItem;if(!this.isInterstitial(r)||r.event.appendInPlace){var i=this.media;!i&&null!=(e=this.bufferingItem)&&null!=(e=e.event)&&e.appendInPlace&&(i=this.primaryMedia);var n=null==(t=i)?void 0:t.currentTime;if(void 0!==n&&F(n))return n}}}},{key:"primaryMedia",get:function(){var e;return this.media||(null==(e=this.detachedData)?void 0:e.media)||null}},{key:"playbackDisabled",get:function(){return!1===this.hls.config.enableInterstitialPlayback}},{key:"primaryDetails",get:function(){var e;return null==(e=this.mediaSelection)?void 0:e.main.details}},{key:"primaryLive",get:function(){var e;return!(null==(e=this.primaryDetails)||!e.live)}},{key:"seekableStart",get:function(){var e;return this.primaryLive&&(null==(e=this.primaryDetails)?void 0:e.fragmentStart)||0}}])}(de),wu=function(){function e(e){var t=this;this.hls=void 0,this.media=null,this.currentTime=0,this.stallCount=0,this._latency=null,this._targetLatencyUpdated=!1,this.onTimeupdate=function(){var e,r=t.media,i=t.levelDetails;if(r&&i&&t.hls){t.currentTime=r.currentTime;var n=t.hls.config,a=t.computeLatency();if(null!==a){t._latency=a;var s=n.lowLatencyMode,o=n.maxLiveSyncPlaybackRate;if(s&&1!==o&&i.live){var l=t.targetLatency;if(null!==l){var u=a-l,d=u<Math.min(t.maxLatency,l+i.targetduration),c=Dn(n)&&!(null==(e=t.hls.interstitialsManager)||null==(e=e.playingItem)||!e.event);if(d&&u>.05&&t.forwardBufferLength>1&&!c){var h=Math.min(2,Math.max(1,o)),f=Math.round(2/(1+Math.exp(-.75*u-t.edgeStalled))*20)/20,g=Math.min(h,Math.max(1,f));t.changeMediaPlaybackRate(r,g)}else 1!==r.playbackRate&&0!==r.playbackRate&&t.changeMediaPlaybackRate(r,1)}}}}},this.hls=e,this.registerListeners()}var t=e.prototype;return t.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.hls=null},t.registerListeners=function(){var e=this.hls;e&&(e.on(G.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(G.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(G.MANIFEST_LOADING,this.onManifestLoading,this),e.on(G.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(G.ERROR,this.onError,this),e.on(G.INTERSTITIAL_ASSET_STARTED,this.onAssetStarted,this))},t.unregisterListeners=function(){var e=this.hls;e&&(e.off(G.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(G.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(G.MANIFEST_LOADING,this.onManifestLoading,this),e.off(G.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(G.ERROR,this.onError,this),e.off(G.INTERSTITIAL_ASSET_STARTED,this.onAssetStarted,this))},t.onMediaAttached=function(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.onTimeupdate)},t.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.onTimeupdate),this.media=null)},t.onManifestLoading=function(){this._latency=null,this.stallCount=0},t.onLevelUpdated=function(e,t){var r=t.details;r.advanced&&this.onTimeupdate(),!r.live&&this.media&&this.media.removeEventListener("timeupdate",this.onTimeupdate)},t.onAssetStarted=function(e,t){var r,i=this.hls,n=this.media||t.event.appendInPlace&&(null==i||null==(r=i.interstitialsManager)?void 0:r.playerQueue.reduce((function(e,t){return e||t.media}),null));i&&n&&n.playbackRate>1&&n.playbackRate<=i.config.maxLiveSyncPlaybackRate&&this.changeMediaPlaybackRate(n,1)},t.onError=function(e,t){var r;t.details===$.BUFFER_STALLED_ERROR&&(this.stallCount++,this.hls&&null!=(r=this.levelDetails)&&r.live&&this.hls.logger.warn("[latency-controller]: Stall detected, adjusting target latency"))},t.changeMediaPlaybackRate=function(e,t){var r,i;e.playbackRate!==t&&(null==(r=this.hls)||r.logger.debug("[latency-controller]: latency="+this.latency.toFixed(3)+", targetLatency="+(null==(i=this.targetLatency)?void 0:i.toFixed(3))+", forwardBufferLength="+this.forwardBufferLength.toFixed(3)+": adjusting playback rate from "+e.playbackRate+" to "+t),e.playbackRate=t)},t.estimateLiveEdge=function(){var e=this.levelDetails;return null===e?null:e.edge+e.age},t.computeLatency=function(){var e=this.estimateLiveEdge();return null===e?null:e-this.currentTime},i(e,[{key:"levelDetails",get:function(){var e;return(null==(e=this.hls)?void 0:e.latestLevelDetails)||null}},{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var e,t=null==(e=this.hls)?void 0:e.config;if(!t)return 0;if(void 0!==t.liveMaxLatencyDuration)return t.liveMaxLatencyDuration;var r=this.levelDetails;return r?t.liveMaxLatencyDurationCount*r.targetduration:0}},{key:"targetLatency",get:function(){var e=this.levelDetails;if(null===e||!this.hls)return null;var t=this.hls.config,r=e.holdBack,i=e.partHoldBack,n=e.targetduration,a=t.liveSyncDuration,s=t.liveSyncDurationCount,o=t.lowLatencyMode,l=this.hls.userConfig,u=o&&i||r;(this._targetLatencyUpdated||l.liveSyncDuration||l.liveSyncDurationCount||0===u)&&(u=void 0!==a?a:s*n);var d=n;return u+Math.min(this.stallCount*t.liveSyncOnStallIncrease,d)},set:function(e){this.hls&&(this.stallCount=0,this.hls.config.liveSyncDuration=e,this._targetLatencyUpdated=!0)}},{key:"liveSyncPosition",get:function(){var e=this.estimateLiveEdge(),t=this.targetLatency;if(null===e||null===t||!this.hls)return null;var r=this.levelDetails;if(null===r)return null;var i=r.edge,n=e-t-this.edgeStalled,a=i-r.totalduration,s=i-(this.hls.config.lowLatencyMode&&r.partTarget||r.targetduration);return Math.min(Math.max(a,n),s)}},{key:"drift",get:function(){var e=this.levelDetails;return null===e?1:e.drift}},{key:"edgeStalled",get:function(){var e=this.levelDetails;if(null===e||!this.hls)return 0;var t=3*(this.hls.config.lowLatencyMode&&e.partTarget||e.targetduration);return Math.max(e.age-t,0)}},{key:"forwardBufferLength",get:function(){var e=this.media,t=this.levelDetails;if(!e||!t)return 0;var r=e.buffered.length;return(r?e.buffered.end(r-1):t.edge)-this.currentTime}}])}(),Au=function(e){function t(t,r,i){var n;return(n=e.call(this,t,r,i,"subtitle-stream-controller",K.SUBTITLE)||this).currentTrackId=-1,n.tracksBuffered=[],n.mainDetails=null,n.registerListeners(),n}c(t,e);var r=t.prototype;return r.onHandlerDestroying=function(){this.unregisterListeners(),e.prototype.onHandlerDestroying.call(this),this.mainDetails=null},r.registerListeners=function(){e.prototype.registerListeners.call(this);var t=this.hls;t.on(G.LEVEL_LOADED,this.onLevelLoaded,this),t.on(G.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.on(G.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),t.on(G.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.on(G.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),t.on(G.BUFFER_FLUSHING,this.onBufferFlushing,this)},r.unregisterListeners=function(){e.prototype.unregisterListeners.call(this);var t=this.hls;t.off(G.LEVEL_LOADED,this.onLevelLoaded,this),t.off(G.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.off(G.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),t.off(G.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.off(G.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),t.off(G.BUFFER_FLUSHING,this.onBufferFlushing,this)},r.startLoad=function(e,t){this.stopLoad(),this.state=In.IDLE,this.setInterval(500),this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()},r.onManifestLoading=function(){e.prototype.onManifestLoading.call(this),this.mainDetails=null},r.onMediaDetaching=function(t,r){this.tracksBuffered=[],e.prototype.onMediaDetaching.call(this,t,r)},r.onLevelLoaded=function(e,t){this.mainDetails=t.details},r.onSubtitleFragProcessed=function(e,t){var r=t.frag,i=t.part;if(t.success){var n=this.tracksBuffered[this.currentTrackId];if(n){for(var a,s=(i||r).start,o=0;o<n.length;o++)if(s>=n[o].start&&s<=n[o].end){a=n[o];break}var l=s+(i||r).duration;if(a?a.end=l:(a={start:s,end:l},n.push(a)),!i||l>=r.end){var u=this.fragmentTracker.fragBuffered(r);i&&u&&(u.range.subs={time:[{startPTS:r.start,endPTS:l}],partial:!0}),W(r)&&!this.fragContextChanged(r)&&(this.fragPrevious=r),this.fragBufferedComplete(r,i),this.media&&this.tickImmediate()}}}},r.onBufferFlushing=function(e,t){var r=t.startOffset,i=t.endOffset;if(0===r&&i!==Number.POSITIVE_INFINITY){var n=i-1;if(n<=0)return;t.endOffsetSubtitles=Math.max(0,n),this.tracksBuffered.forEach((function(e){if(e)for(var t=0;t<e.length;)if(e[t].end<=n)e.shift();else{if(!(e[t].start<n))break;e[t].start=n,t++}})),this.fragmentTracker.removeFragmentsInRange(r,n,K.SUBTITLE)}},r.onError=function(e,t){var r=t.frag;(null==r?void 0:r.type)===K.SUBTITLE&&(t.details===$.FRAG_GAP&&this.fragmentTracker.addAsGap(r),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==In.STOPPED&&(this.state=In.IDLE))},r.onSubtitleTracksUpdated=function(e,t){var r=this,i=t.subtitleTracks;this.levels&&us(this.levels,i)?this.levels=i.map((function(e){return new ir(e)})):(this.tracksBuffered=[],this.levels=i.map((function(e){var t=new ir(e);return r.tracksBuffered[t.id]=[],t})),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,K.SUBTITLE),this.fragPrevious=null,this.mediaBuffer=null)},r.onSubtitleTrackSwitch=function(e,t){var r;if(this.currentTrackId=t.id,this.abortCurrentFrag(),null!=(r=this.levels)&&r.length&&-1!==this.currentTrackId){var i=this.levels[this.currentTrackId];null!=i&&i.details?(this.mediaBuffer=this.mediaBufferTimeRanges,this.state!==In.STOPPED&&this.setInterval(500)):this.mediaBuffer=null}else this.clearInterval()},r.onSubtitleTrackLoaded=function(e,t){var r,i=this.currentTrackId,n=this.levels,a=t.details,s=t.id;if(n){var o=n[s];if(!(s>=n.length)&&o){this.log("Subtitle track "+s+" loaded ["+a.startSN+","+a.endSN+"]"+(a.lastPartSn?"[part-"+a.lastPartSn+"-"+a.lastPartIndex+"]":"")+",duration:"+a.totalduration),this.mediaBuffer=this.mediaBufferTimeRanges;var l=this.mainDetails,u=0;if(a.live||null!=(r=o.details)&&r.live){if(a.deltaUpdateFailed)return;if(!l)return void(this.startFragRequested=!1);var d;o.details&&(u=this.alignPlaylists(a,o.details,null==(d=this.levelLastLoaded)?void 0:d.details)),a.alignedSliding||(Sn(l,a,this),u=a.fragmentStart)}o.details=a,this.levelLastLoaded=o,l&&!this.startFragRequested&&this.setStartPosition(l,u),s===i&&(this.hls.trigger(G.SUBTITLE_TRACK_UPDATED,{details:a,id:s,groupId:t.groupId}),this.tickImmediate())}}else this.warn("Subtitle tracks were reset while loading level "+s)},r._handleFragmentLoadProgress=function(e){var t=e.frag,r=e.part,i=e.payload;r&&null!=i&&i.byteLength&&this.shouldDecrypt(t)&&this.decryptPayload(i,t,r)},r._handleFragmentLoadComplete=function(e){var t=e.frag,r=e.payload;!this.fragContextChanged(t)&&null!=r&&r.byteLength&&this.shouldDecrypt(t)&&this.decryptPayload(r,t,null)},r.shouldDecrypt=function(e){var t=e.decryptdata;return!!(null!=t&&t.key&&t.iv&&Ti(t.method))},r.decryptPayload=function(e,t,r){var i=this,n=t.decryptdata,a=performance.now();this.decrypter.decrypt(new Uint8Array(e),n.key.buffer,n.iv.buffer,Si(n.method)).then((function(e){i.fragContextChanged(t)||i.hls.trigger(G.FRAG_DECRYPTED,{frag:t,part:r,payload:e,stats:{tstart:a,tdecrypt:performance.now()}})})).catch((function(e){i.hls.trigger(G.ERROR,{type:B.MEDIA_ERROR,details:$.FRAG_DECRYPT_ERROR,fatal:!1,error:e,reason:e.message,frag:t,part:r}),r||(i.warn(e.name+": "+e.message),i.state=In.IDLE)}))},r.doTick=function(){if(this.state===In.IDLE&&this.levels){var e;if(!this.media&&!this.primaryPrefetch&&(this.startFragRequested||!this.config.startFragPrefetch))return;var t=this.currentTrackId,r=this.levels[t],i=null==r?void 0:r.details;if(!i||this.waitForLive(r)||this.waitForCdnTuneIn(i))return void(this.startFragRequested=!1);var n=this.config,a=this.playhead,s=oi.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],a,n.maxBufferHole),o=s.end,l=s.len;if(l>Math.max(this.hls.maxBufferLength+i.levelTargetDuration,(null==(e=this.hls.mainForwardBufferInfo)?void 0:e.len)||0)||l&&!this.buffering)return;var u=this.getNextFragment(o,i);if(!u)return;if(W(u)){var d,c=u.sn-i.startSN,h=i.fragments[c-1];u.cc!==(null==h?void 0:h.cc)||null!=(d=i.partList)&&d.length||this.fragmentTracker.getState(h)!==Ur||(u=h)}this.loadFragment(u,r,o)}},r.loadFragment=function(t,r,i){var n=this.fragmentTracker.getState(t);n!==Ur&&n!==$r||e.prototype.loadFragment.call(this,t,r,i)},i(t,[{key:"mediaBufferTimeRanges",get:function(){return new Lu(this.tracksBuffered[this.currentTrackId]||[])}}])}(kn),Lu=function(e){this.buffered=void 0;var t=function(t,r,i){if((r>>>=0)>i-1)throw new DOMException("Failed to execute '"+t+"' on 'TimeRanges': The index provided ("+r+") is greater than the maximum bound ("+i+")");return e[r][t]};this.buffered={get length(){return e.length},end:function(r){return t("end",r,e.length)},start:function(r){return t("start",r,e.length)}}},Iu=function(){if(null!=Ii&&Ii.VTTCue)return self.VTTCue;var e=["","lr","rl"],t=["start","middle","end","left","right"];function r(e,t){if("string"!=typeof t)return!1;if(!Array.isArray(e))return!1;var r=t.toLowerCase();return!!~e.indexOf(r)&&r}function i(e){return r(t,e)}function n(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];for(var n=1;n<arguments.length;n++){var a=arguments[n];for(var s in a)e[s]=a[s]}return e}function a(t,a,s){var o=this,l={enumerable:!0};o.hasBeenReset=!1;var u="",d=!1,c=t,h=a,f=s,g=null,v="",p=!0,m="auto",y="start",E=50,b="middle",T=50,S="middle";Object.defineProperty(o,"id",n({},l,{get:function(){return u},set:function(e){u=""+e}})),Object.defineProperty(o,"pauseOnExit",n({},l,{get:function(){return d},set:function(e){d=!!e}})),Object.defineProperty(o,"startTime",n({},l,{get:function(){return c},set:function(e){if("number"!=typeof e)throw new TypeError("Start time must be set to a number.");c=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"endTime",n({},l,{get:function(){return h},set:function(e){if("number"!=typeof e)throw new TypeError("End time must be set to a number.");h=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"text",n({},l,{get:function(){return f},set:function(e){f=""+e,this.hasBeenReset=!0}})),Object.defineProperty(o,"region",n({},l,{get:function(){return g},set:function(e){g=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"vertical",n({},l,{get:function(){return v},set:function(t){var i=function(t){return r(e,t)}(t);if(!1===i)throw new SyntaxError("An invalid or illegal string was specified.");v=i,this.hasBeenReset=!0}})),Object.defineProperty(o,"snapToLines",n({},l,{get:function(){return p},set:function(e){p=!!e,this.hasBeenReset=!0}})),Object.defineProperty(o,"line",n({},l,{get:function(){return m},set:function(e){if("number"!=typeof e&&"auto"!==e)throw new SyntaxError("An invalid number or illegal string was specified.");m=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"lineAlign",n({},l,{get:function(){return y},set:function(e){var t=i(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");y=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"position",n({},l,{get:function(){return E},set:function(e){if(e<0||e>100)throw new Error("Position must be between 0 and 100.");E=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"positionAlign",n({},l,{get:function(){return b},set:function(e){var t=i(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");b=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"size",n({},l,{get:function(){return T},set:function(e){if(e<0||e>100)throw new Error("Size must be between 0 and 100.");T=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"align",n({},l,{get:function(){return S},set:function(e){var t=i(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");S=t,this.hasBeenReset=!0}})),o.displayState=void 0}return a.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},a}(),ku=function(){function e(){}return e.prototype.decode=function(e,t){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))},e}();function Ru(e){function t(e,t,r,i){return 3600*(0|e)+60*(0|t)+(0|r)+parseFloat(i||0)}var r=e.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return r?parseFloat(r[2])>59?t(r[2],r[3],0,r[4]):t(r[1],r[2],r[3],r[4]):null}var Du=function(){function e(){this.values=Object.create(null)}var t=e.prototype;return t.set=function(e,t){this.get(e)||""===t||(this.values[e]=t)},t.get=function(e,t,r){return r?this.has(e)?this.values[e]:t[r]:this.has(e)?this.values[e]:t},t.has=function(e){return e in this.values},t.alt=function(e,t,r){for(var i=0;i<r.length;++i)if(t===r[i]){this.set(e,t);break}},t.integer=function(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))},t.percent=function(e,t){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(t)){var r=parseFloat(t);if(r>=0&&r<=100)return this.set(e,r),!0}return!1},e}();function Cu(e,t,r,i){var n=i?e.split(i):[e];for(var a in n)if("string"==typeof n[a]){var s=n[a].split(r);2===s.length&&t(s[0],s[1])}}var Pu=new Iu(0,0,""),_u="middle"===Pu.align?"middle":"center";function xu(e,t,r){var i=e;function n(){var t=Ru(e);if(null===t)throw new Error("Malformed timestamp: "+i);return e=e.replace(/^[^\sa-zA-Z-]+/,""),t}function a(){e=e.replace(/^\s+/,"")}if(a(),t.startTime=n(),a(),"--\x3e"!==e.slice(0,3))throw new Error("Malformed time stamp (time stamps must be separated by '--\x3e'): "+i);e=e.slice(3),a(),t.endTime=n(),a(),function(e,t){var i=new Du;Cu(e,(function(e,t){var n;switch(e){case"region":for(var a=r.length-1;a>=0;a--)if(r[a].id===t){i.set(e,r[a].region);break}break;case"vertical":i.alt(e,t,["rl","lr"]);break;case"line":n=t.split(","),i.integer(e,n[0]),i.percent(e,n[0])&&i.set("snapToLines",!1),i.alt(e,n[0],["auto"]),2===n.length&&i.alt("lineAlign",n[1],["start",_u,"end"]);break;case"position":n=t.split(","),i.percent(e,n[0]),2===n.length&&i.alt("positionAlign",n[1],["start",_u,"end","line-left","line-right","auto"]);break;case"size":i.percent(e,t);break;case"align":i.alt(e,t,["start",_u,"end","left","right"])}}),/:/,/\s/),t.region=i.get("region",null),t.vertical=i.get("vertical","");var n=i.get("line","auto");"auto"===n&&-1===Pu.line&&(n=-1),t.line=n,t.lineAlign=i.get("lineAlign","start"),t.snapToLines=i.get("snapToLines",!0),t.size=i.get("size",100),t.align=i.get("align",_u);var a=i.get("position","auto");"auto"===a&&50===Pu.position&&(a="start"===t.align||"left"===t.align?0:"end"===t.align||"right"===t.align?100:50),t.position=a}(e,t)}function Ou(e){return e.replace(/<br(?: \/)?>/gi,"\n")}var Mu=function(){function e(){this.state="INITIAL",this.buffer="",this.decoder=new ku,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var t=e.prototype;return t.parse=function(e){var t=this;function r(){var e=t.buffer,r=0;for(e=Ou(e);r<e.length&&"\r"!==e[r]&&"\n"!==e[r];)++r;var i=e.slice(0,r);return"\r"===e[r]&&++r,"\n"===e[r]&&++r,t.buffer=e.slice(r),i}e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));try{var i="";if("INITIAL"===t.state){if(!/\r\n|\n/.test(t.buffer))return this;var n=(i=r()).match(/^()?WEBVTT([ \t].*)?$/);if(null==n||!n[0])throw new Error("Malformed WebVTT signature.");t.state="HEADER"}for(var a=!1;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(a?a=!1:i=r(),t.state){case"HEADER":/:/.test(i)?Cu(i,(function(e,t){}),/:/):i||(t.state="ID");continue;case"NOTE":i||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(i)){t.state="NOTE";break}if(!i)continue;if(t.cue=new Iu(0,0,""),t.state="CUE",-1===i.indexOf("--\x3e")){t.cue.id=i;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{xu(i,t.cue,t.regionList)}catch(e){t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":var s=-1!==i.indexOf("--\x3e");if(!i||s&&(a=!0)){t.oncue&&t.cue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}if(null===t.cue)continue;t.cue.text&&(t.cue.text+="\n"),t.cue.text+=i;continue;case"BADCUE":i||(t.state="ID")}}}catch(e){"CUETEXT"===t.state&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state="INITIAL"===t.state?"BADWEBVTT":"BADCUE"}return this},t.flush=function(){var e=this;try{if((e.cue||"HEADER"===e.state)&&(e.buffer+="\n\n",e.parse()),"INITIAL"===e.state||"BADWEBVTT"===e.state)throw new Error("Malformed WebVTT signature.")}catch(t){e.onparsingerror&&e.onparsingerror(t)}return e.onflush&&e.onflush(),this},e}(),Fu=/\r\n|\n\r|\n|\r/g,Nu="Missing initPTS for VTT ";function Uu(e,t,r){return au(e.toString())+au(t.toString())+au(r)}function Bu(e,t,r,i,n,a,s){var o,l,u,d=new Mu,c=Ie(new Uint8Array(e)).trim().replace(Fu,"\n").split("\n"),h=[],f=t?(o=t.baseTime,void 0===(l=t.timescale)&&(l=1),xa(o,_a,1/l)):0,g="00:00.000",v=0,p=0,m=!1,y=!0;d.oncue=function(e){var a=r[i],s=r.ccOffset,o=(v-f)/9e4;if(m){if(null!=a&&a.new&&(s=r.ccOffset=a.start),o){if(!t)return void(u=new Error(Nu+"MPEGTS"));s=o-r.presentationOffset}}else{if(!t)return void(u=new Error(Nu+"without X-TIMESTAMP-MAP"));s=-t.baseTime/t.timescale}var l=e.endTime-e.startTime,d=Ba(9e4*(e.startTime+s-p),9e4*n)/9e4;e.startTime=Math.max(d,0),e.endTime=Math.max(d+l,0);var c=e.text.trim();e.text=decodeURIComponent(encodeURIComponent(c)),e.id?i&&(e.id="hlsjscc"+i+"_"+e.id):e.id=Uu(e.startTime,e.endTime,c),e.endTime>0&&h.push(e)},d.onparsingerror=function(e){u=e},d.onflush=function(){u?s(u):a(h)},c.forEach((function(e){if(y){if(e.startsWith("X-TIMESTAMP-MAP=")){y=!1,m=!0,e.slice(16).split(",").forEach((function(e){e.startsWith("LOCAL:")?g=e.slice(6):e.startsWith("MPEGTS:")&&(v=parseInt(e.slice(7)))}));try{p=function(e){var t=parseInt(e.slice(-3)),r=parseInt(e.slice(-6,-4)),i=parseInt(e.slice(-9,-7)),n=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!(F(t)&&F(r)&&F(i)&&F(n)))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+e);return t+=1e3*r,(t+=6e4*i)+36e5*n}(g)/1e3}catch(e){u=e}return}""===e&&(y=!1)}d.parse(e+"\n")})),d.flush()}var $u="stpp.ttml.im1t",Gu=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Hu=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,Vu={left:"start",center:"center",right:"end",start:"start",end:"end"};function Ku(e,t,r,i){var n=Ze(new Uint8Array(e),["mdat"]);if(0!==n.length){var a,s,o,l,d=n.map((function(e){return Ie(e)})),c=(a=t.baseTime,s=1,void 0===(o=t.timescale)&&(o=1),void 0===l&&(l=!1),xa(a,s,1/o,l));try{d.forEach((function(e){return r(function(e,t){var r=(new DOMParser).parseFromString(e,"text/xml"),i=r.getElementsByTagName("tt")[0];if(!i)throw new Error("Invalid ttml");var n={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:1},a=Object.keys(n).reduce((function(e,t){return e[t]=i.getAttribute("ttp:"+t)||n[t],e}),{});!i.getAttribute("ttp:tickRate")&&i.getAttribute("ttp:frameRate")&&(a.tickRate=Number(a.frameRate)*Number(a.subFrameRate));var s="preserve"!==i.getAttribute("xml:space"),o=qu(ju(i,"styling","style")),l=qu(ju(i,"layout","region")),d=ju(i,"body","[begin]");return[].map.call(d,(function(e){var r=Wu(e,s);if(!r||!e.hasAttribute("begin"))return null;var i=Qu(e.getAttribute("begin"),a),n=Qu(e.getAttribute("dur"),a),d=Qu(e.getAttribute("end"),a);if(null===i)throw zu(e);if(null===d){if(null===n)throw zu(e);d=i+n}var c=new Iu(i-t,d-t,r);c.id=Uu(c.startTime,c.endTime,c.text);var h=function(e,t,r){var i="http://www.w3.org/ns/ttml#styling",n=null,a=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],s=null!=e&&e.hasAttribute("style")?e.getAttribute("style"):null;return s&&r.hasOwnProperty(s)&&(n=r[s]),a.reduce((function(r,a){var s=Yu(t,i,a)||Yu(e,i,a)||Yu(n,i,a);return s&&(r[a]=s),r}),{})}(l[e.getAttribute("region")],o[e.getAttribute("style")],o),f=h.textAlign;if(f){var g=Vu[f];g&&(c.lineAlign=g),c.align=f}return u(c,h),c})).filter((function(e){return null!==e}))}(e,c))}))}catch(e){i(e)}}else i(new Error("Could not parse IMSC1 mdat"))}function ju(e,t,r){var i=e.getElementsByTagName(t)[0];return i?[].slice.call(i.querySelectorAll(r)):[]}function qu(e){return e.reduce((function(e,t){var r=t.getAttribute("xml:id");return r&&(e[r]=t),e}),{})}function Wu(e,t){return[].slice.call(e.childNodes).reduce((function(e,r,i){var n;return"br"===r.nodeName&&i?e+"\n":null!=(n=r.childNodes)&&n.length?Wu(r,t):t?e+r.textContent.trim().replace(/\s+/g," "):e+r.textContent}),"")}function Yu(e,t,r){return e&&e.hasAttributeNS(t,r)?e.getAttributeNS(t,r):null}function zu(e){return new Error("Could not parse ttml timestamp "+e)}function Qu(e,t){if(!e)return null;var r=Ru(e);return null===r&&(Gu.test(e)?r=function(e,t){var r=Gu.exec(e),i=(0|r[4])+(0|r[5])/t.subFrameRate;return 3600*(0|r[1])+60*(0|r[2])+(0|r[3])+i/t.frameRate}(e,t):Hu.test(e)&&(r=function(e,t){var r=Hu.exec(e),i=Number(r[1]);switch(r[2]){case"h":return 3600*i;case"m":return 60*i;case"ms":return i/1e3;case"f":return i/t.frameRate;case"t":return i/t.tickRate}return i}(e,t))),r}var Xu=function(e){function t(t){var r;return(r=e.call(this,t,"subtitle-track-controller")||this).media=null,r.tracks=[],r.groupIds=null,r.tracksInGroup=[],r.trackId=-1,r.currentTrack=null,r.selectDefaultTrack=!0,r.queuedDefaultTrack=-1,r.useTextTrackPolling=!1,r.subtitlePollingInterval=-1,r._subtitleDisplay=!0,r.asyncPollTrackChange=function(){return r.pollTrackChange(0)},r.onTextTracksChanged=function(){if(r.useTextTrackPolling||self.clearInterval(r.subtitlePollingInterval),r.media&&r.hls.config.renderTextTracksNatively){var e,t=-1,i=!1;if(r.currentTrack){var n,a=null==(n=r.currentTrack.trackNode)?void 0:n.track.mode;"showing"===a?(t=r.trackId,i=!0):"hidden"===a&&(t=r.trackId)}if(!i)for(var s=0;s<r.tracksInGroup.length;s++){var o,l=null==(o=r.tracksInGroup[s].trackNode)?void 0:o.track.mode;if("showing"===l){t=s;break}t<0&&"hidden"===l&&(t=s)}t>-1&&(r._subtitleDisplay="showing"===(null==(e=r.tracksInGroup[t].trackNode)?void 0:e.track.mode)),r.setSubtitleTrack(t,!0)}},r.registerListeners(),r}c(t,e);var r=t.prototype;return r.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,this.onTextTracksChanged=this.asyncPollTrackChange=null,e.prototype.destroy.call(this)},r.registerListeners=function(){var e=this.hls;e.on(G.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(G.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(G.MANIFEST_LOADING,this.onManifestLoading,this),e.on(G.MANIFEST_PARSED,this.onManifestParsed,this),e.on(G.LEVEL_LOADING,this.onLevelLoading,this),e.on(G.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(G.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(G.ERROR,this.onError,this)},r.unregisterListeners=function(){var e=this.hls;e.off(G.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(G.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(G.MANIFEST_LOADING,this.onManifestLoading,this),e.off(G.MANIFEST_PARSED,this.onManifestParsed,this),e.off(G.LEVEL_LOADING,this.onLevelLoading,this),e.off(G.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(G.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(G.ERROR,this.onError,this)},r.createTracksInGroup=function(){var e,t=this;if(this.media&&this.hls.config.renderTextTracksNatively){this.tracksInGroup.forEach((function(e){e.trackNode||(e.trackNode=Ul(t.media,Bl(e),e.name,e.lang))}));var r=null==(e=this.currentTrack)||null==(e=e.trackNode)?void 0:e.track;"disabled"===(null==r?void 0:r.mode)&&(r.mode=this._subtitleDisplay?"showing":"hidden")}},r.onMediaAttached=function(e,t){var r=t.media;this.media=r;var i=this.trackId;this.queuedDefaultTrack>-1&&(i=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.setSubtitleTrack(i),this.createTracksInGroup(),this.useTextTrackPolling=!(r.textTracks&&"onchange"in r.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):r.textTracks.addEventListener("change",this.asyncPollTrackChange)},r.pollTrackChange=function(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,e)},r.onMediaDetaching=function(e,t){var r=this.media;if(r){var i=!!t.transferMedia;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||r.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId,this.setSubtitleTrack(-1)),this.media=null,i||this.hls.config.renderTextTracksNatively&&this.tracksInGroup.forEach((function(e){var t=e.trackNode;t&&(t.track.mode="hidden",t.remove(),e.trackNode=void 0)}))}},r.onManifestLoading=function(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0},r.onManifestParsed=function(e,t){this.tracks=t.subtitleTracks},r.onSubtitleTrackLoaded=function(e,t){var r=t.id,i=t.groupId,n=t.details,a=this.tracksInGroup[r];if(a&&a.groupId===i){var s=a.details;a.details=t.details,this.log("Subtitle track "+r+' "'+a.name+'" lang:'+a.lang+" group:"+i+" loaded ["+n.startSN+"-"+n.endSN+"]"),r===this.trackId&&this.playlistLoaded(r,t,s)}else this.warn("Subtitle track with id:"+r+" and group:"+i+" not found in active group "+(null==a?void 0:a.groupId))},r.onLevelLoading=function(e,t){this.switchLevel(t.level)},r.onLevelSwitching=function(e,t){this.switchLevel(t.level)},r.switchLevel=function(e){var t=this,r=this.hls.levels[e];if(r){var i=r.subtitleGroups||null,n=this.groupIds,a=this.currentTrack;if(!i||(null==n?void 0:n.length)!==(null==i?void 0:i.length)||null!=i&&i.some((function(e){return-1===(null==n?void 0:n.indexOf(e))}))){this.groupIds=i;var s=[];if(this.tracks.forEach((function(e){(e.textCodec===$u?t.hls.config.enableIMSC1:t.hls.config.enableWebVTT)&&(!i||i.indexOf(e.groupId)>-1?(e.id=s.length,s.push(e)):e.trackNode&&(e.trackNode.remove(),e.trackNode=void 0))})),s.length===this.tracksInGroup.length){for(var o=!1,l=0;l<s.length;l++)if(s[l]!==this.tracksInGroup[l]){o=!0;break}if(!o)return}s.length&&this.selectDefaultTrack&&!s.some((function(e){return e.default}))&&(this.selectDefaultTrack=!1),this.tracksInGroup=s,this.trackId=-1,this.currentTrack=null;var u=this.hls.config.subtitlePreference;if(!a&&u){this.selectDefaultTrack=!1;var d=dr(u,s);if(d>-1)a=s[d];else{var c=dr(u,this.tracks);a=this.tracks[c]}}var h=this.findTrackId(a);-1===h&&a&&(h=this.findTrackId(null));var f={subtitleTracks:s};this.log("Updating subtitle tracks, "+s.length+' track(s) found in "'+(null==i?void 0:i.join(","))+'" group-id'),this.hls.trigger(G.SUBTITLE_TRACKS_UPDATED,f),this.setSubtitleTrack(h),this.createTracksInGroup()}}},r.findTrackId=function(e){for(var t=this.tracksInGroup,r=this.selectDefaultTrack,i=0;i<t.length;i++){var n=t[i];if((!r||n.default)&&(r||e)&&(!e||cr(n,e)))return i}if(e){for(var a=0;a<t.length;a++){var s=t[a];if(ds(e.attrs,s.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return a}for(var o=0;o<t.length;o++){var l=t[o];if(ds(e.attrs,l.attrs,["LANGUAGE"]))return o}}return-1},r.onError=function(e,t){!t.fatal&&t.context&&t.context.type===V.SUBTITLE_TRACK&&t.context.id===this.trackId&&vr(t.context.groupId,this.groupIds)&&this.checkRetry(t)},r.setSubtitleOption=function(e){if(this.hls.config.subtitlePreference=e,e){if(-1===e.id)return this.setSubtitleTrack(-1,!0),null;var t=this.allSubtitleTracks;if(this.selectDefaultTrack=!1,t.length){var r=this.currentTrack;if(r&&cr(e,r))return r;var i=dr(e,this.tracksInGroup);if(i>-1){var n=this.tracksInGroup[i];return this.setSubtitleTrack(i,!0),n}if(r)return null;var a=dr(e,t);if(a>-1)return t[a]}}return null},r.loadPlaylist=function(t){e.prototype.loadPlaylist.call(this),this.shouldLoadPlaylist(this.currentTrack)&&this.scheduleLoading(this.currentTrack,t)},r.loadingPlaylist=function(t,r){e.prototype.loadingPlaylist.call(this,t,r);var i=t.id,n=t.groupId,a=this.getUrlWithDirectives(t.url,r),s=t.details,o=null==s?void 0:s.age;this.log("Loading subtitle "+i+' "'+t.name+'" lang:'+t.lang+" group:"+n+(void 0!==(null==r?void 0:r.msn)?" at sn "+r.msn+" part "+r.part:"")+(o&&s.live?" age "+o.toFixed(1)+(s.type?" "+s.type||0:""):"")+" "+a),this.hls.trigger(G.SUBTITLE_TRACK_LOADING,{url:a,id:i,groupId:n,deliveryDirectives:r||null,track:t})},r.toggleTrackModes=function(){var e=this;if(this.media&&this.hls.config.renderTextTracksNatively){var t=this.currentTrack;this.tracksInGroup.forEach((function(r){if(r.trackNode){var i=r===t?e._subtitleDisplay?"showing":"hidden":"disabled",n=r.trackNode.track;n.mode!==i&&(n.mode=i)}}))}},r.setSubtitleTrack=function(e,t){void 0===t&&(t=!1);var r=this.tracksInGroup;if(this.media||(this.queuedDefaultTrack=e),e<-1||e>=r.length||!F(e))this.warn("Invalid subtitle track id: "+e);else{var i=this.currentTrack,n=r[e]||null;if(this.trackId=e,this.currentTrack=n,t&&this.toggleTrackModes(),n){var a=!!n.details&&!n.details.live;if(n!==i||!a){this.log("Switching to subtitle-track "+e+(n?' "'+n.name+'" lang:'+n.lang+" group:"+n.groupId:""));var s=n.id,o=n.groupId,l=void 0===o?"":o,u=n.name,d=n.type,c=n.url;this.hls.trigger(G.SUBTITLE_TRACK_SWITCH,{id:s,groupId:l,name:u,type:d,url:c});var h=this.switchParams(n.url,null==i?void 0:i.details,n.details);this.loadPlaylist(h)}}else i&&this.hls.trigger(G.SUBTITLE_TRACK_SWITCH,{id:e})}},i(t,[{key:"subtitleDisplay",get:function(){return this._subtitleDisplay},set:function(e){this._subtitleDisplay=e,this.trackId>-1&&this.toggleTrackModes()}},{key:"allSubtitleTracks",get:function(){return this.tracks}},{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(e){this.selectDefaultTrack=!1,this.setSubtitleTrack(e,!0)}}])}(ls),Ju={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},Zu=function(e){return String.fromCharCode(Ju[e]||e)},ed=15,td=42,rd={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},id={17:2,18:4,21:6,22:8,23:10,19:13,20:15},nd={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},ad={25:2,26:4,29:6,30:8,31:10,27:13,28:15},sd=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],od=function(){function e(){this.time=null,this.verboseLevel=0}return e.prototype.log=function(e,t){if(this.verboseLevel>=e){var r="function"==typeof t?t():t;me.log(this.time+" ["+e+"] "+r)}},e}(),ld=function(e){for(var t=[],r=0;r<e.length;r++)t.push(e[r].toString(16));return t},ud=Object.freeze({foreground:"white",underline:!1,italics:!1,background:"black",flash:!1}),dd=function(){function e(){this.styles=ud}var t=e.prototype;return t.reset=function(){this.styles=ud},t.setStyles=function(e){var t=this.styles,r=Object.prototype.hasOwnProperty;this.styles={foreground:r.call(e,"foreground")?e.foreground:t.foreground,underline:r.call(e,"underline")?e.underline:t.underline,italics:r.call(e,"italics")?e.italics:t.italics,background:r.call(e,"background")?e.background:t.background,flash:r.call(e,"flash")?e.flash:t.flash}},t.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},i(e,[{key:"foreground",get:function(){return this.styles.foreground},set:function(e){var t=this.styles;this.styles={foreground:e,underline:t.underline,italics:t.italics,background:t.background,flash:t.flash}}},{key:"underline",get:function(){return this.styles.underline},set:function(e){var t=this.styles;this.styles={foreground:t.foreground,underline:e,italics:t.italics,background:t.background,flash:t.flash}}},{key:"italics",get:function(){return this.styles.italics},set:function(e){var t=this.styles;this.styles={foreground:t.foreground,underline:t.underline,italics:e,background:t.background,flash:t.flash}}},{key:"background",get:function(){return this.styles.background},set:function(e){var t=this.styles;this.styles={foreground:t.foreground,underline:t.underline,italics:t.italics,background:e,flash:t.flash}}},{key:"flash",get:function(){return this.styles.flash},set:function(e){var t=this.styles;this.styles={foreground:t.foreground,underline:t.underline,italics:t.italics,background:t.background,flash:e}}}])}(),cd=function(){function e(){this.uchar=" ",this.penState=new dd}var t=e.prototype;return t.reset=function(){this.uchar=" ",this.penState.reset()},t.setChar=function(e,t){this.uchar=e,this.penState.styles=t.styles},t.setPenState=function(e){this.penState.styles=e.styles},t.copy=function(e){this.uchar=e.uchar,this.penState.styles=e.penState.styles},e}(),hd=function(){function e(e){this.chars=[],this.pos=0,this.currPenState=new dd,this.cueStartTime=null,this.logger=void 0;for(var t=0;t<td;t++)this.chars.push(new cd);this.logger=e}var t=e.prototype;return t.equals=function(e){for(var t=this.chars,r=e.chars,i=0;i<td;i++){var n=t[i],a=r[i];if(n.uchar!==a.uchar)return!1;var s=n.penState.styles,o=a.penState.styles;if(s!==o&&(s.foreground!==o.foreground||s.underline!==o.underline||s.italics!==o.italics||s.background!==o.background||s.flash!==o.flash))return!1}return!0},t.copy=function(e){for(var t=0;t<td;t++)this.chars[t].copy(e.chars[t])},t.isEmpty=function(){for(var e=this.chars,t=0;t<td;t++){var r=e[t];if(" "!==r.uchar)return!1;var i=r.penState.styles;if(i!==ud&&("white"!==i.foreground||i.underline||i.italics||"black"!==i.background||i.flash))return!1}return!0},t.setCursor=function(e){this.pos!==e&&(this.pos=e),this.pos<0?(this.logger.log(3,"Negative cursor position "+this.pos),this.pos=0):this.pos>=td&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=41)},t.moveCursor=function(e){var t=Math.min(this.pos+e,td);if(e>1)for(var r=this.pos+1;r<t;r++)this.chars[r].setPenState(this.currPenState);this.setCursor(t)},t.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},t.insertChar=function(e){var t=this;e>=144&&this.backSpace();var r=Zu(e);this.pos>=td?this.logger.log(0,(function(){return"Cannot insert "+e.toString(16)+" ("+r+") at position "+t.pos+". Skipping it!"})):(this.chars[this.pos].setChar(r,this.currPenState),this.moveCursor(1))},t.clearFromPos=function(e){var t;for(t=e;t<td;t++)this.chars[t].reset()},t.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},t.clearToEndOfRow=function(){this.clearFromPos(this.pos)},t.getTextString=function(){for(var e=[],t=!0,r=0;r<td;r++){var i=this.chars[r].uchar;" "!==i&&(t=!1),e.push(i)}return t?"":e.join("")},t.setPenStyles=function(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)},e}(),fd=function(){function e(e){this.rows=[],this.currRow=14,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(var t=0;t<ed;t++)this.rows.push(new hd(e));this.logger=e}var t=e.prototype;return t.reset=function(){for(var e=0;e<ed;e++)this.rows[e].clear();this.currRow=14},t.equals=function(e){for(var t=!0,r=0;r<ed;r++)if(!this.rows[r].equals(e.rows[r])){t=!1;break}return t},t.copy=function(e){for(var t=0;t<ed;t++)for(var r=this.rows[t].chars,i=e.rows[t].chars,n=0;n<td;n++){var a=r[n],s=i[n];a.uchar=s.uchar,a.penState.styles=s.penState.styles}},t.isEmpty=function(){for(var e=!0,t=0;t<ed;t++)if(!this.rows[t].isEmpty()){e=!1;break}return e},t.backSpace=function(){this.rows[this.currRow].backSpace()},t.clearToEndOfRow=function(){this.rows[this.currRow].clearToEndOfRow()},t.insertChar=function(e){this.rows[this.currRow].insertChar(e)},t.setPen=function(e){this.rows[this.currRow].setPenStyles(e)},t.moveCursor=function(e){this.rows[this.currRow].moveCursor(e)},t.setCursor=function(e){this.logger.log(2,"setCursor: "+e),this.rows[this.currRow].setCursor(e)},t.setPAC=function(e){this.logger.log(2,(function(){return"pacData = "+sr(e)}));var t=e.row-1;if(this.nrRollUpRows&&t<this.nrRollUpRows-1&&(t=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==t){for(var r=0;r<ed;r++)this.rows[r].clear();var i=this.currRow+1-this.nrRollUpRows,n=this.lastOutputScreen;if(n){var a=n.rows[i].cueStartTime,s=this.logger.time;if(null!==a&&null!==s&&a<s)for(var o=0;o<this.nrRollUpRows;o++)this.rows[t-this.nrRollUpRows+o+1].copy(n.rows[i+o])}}this.currRow=t;var l=this.rows[this.currRow];if(null!==e.indent){var u=e.indent,d=Math.max(u-1,0);l.setCursor(e.indent),e.color=l.chars[d].penState.foreground}var c={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(c)},t.setBkgData=function(e){this.logger.log(2,(function(){return"bkgData = "+sr(e)})),this.backSpace(),this.setPen(e),this.insertChar(32)},t.setRollUpRows=function(e){this.nrRollUpRows=e},t.rollUp=function(){var e=this;if(null!==this.nrRollUpRows){this.logger.log(1,(function(){return e.getDisplayText()}));var t=this.currRow+1-this.nrRollUpRows,r=this.rows.splice(t,1)[0];r.clear(),this.rows.splice(this.currRow,0,r),this.logger.log(2,"Rolling up")}else this.logger.log(3,"roll_up but nrRollUpRows not set yet")},t.getDisplayText=function(e){e=e||!1;for(var t=[],r="",i=-1,n=0;n<ed;n++){var a=this.rows[n].getTextString();a&&(i=n+1,e?t.push("Row "+i+": '"+a+"'"):t.push(a.trim()))}return t.length>0&&(r=e?"["+t.join(" | ")+"]":t.join("\n")),r},t.getTextAndFormat=function(){return this.rows},e}(),gd=function(){function e(e,t,r){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new fd(r),this.nonDisplayedMemory=new fd(r),this.lastOutputScreen=new fd(r),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=r}var t=e.prototype;return t.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},t.getHandler=function(){return this.outputFilter},t.setHandler=function(e){this.outputFilter=e},t.setPAC=function(e){this.writeScreen.setPAC(e)},t.setBkgData=function(e){this.writeScreen.setBkgData(e)},t.setMode=function(e){e!==this.mode&&(this.mode=e,this.logger.log(2,(function(){return"MODE="+e})),"MODE_POP-ON"===this.mode?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),"MODE_ROLL-UP"!==this.mode&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)},t.insertChars=function(e){for(var t=this,r=0;r<e.length;r++)this.writeScreen.insertChar(e[r]);var i=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(2,(function(){return i+": "+t.writeScreen.getDisplayText(!0)})),"MODE_PAINT-ON"!==this.mode&&"MODE_ROLL-UP"!==this.mode||(this.logger.log(1,(function(){return"DISPLAYED: "+t.displayedMemory.getDisplayText(!0)})),this.outputDataUpdate())},t.ccRCL=function(){this.logger.log(2,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},t.ccBS=function(){this.logger.log(2,"BS - BackSpace"),"MODE_TEXT"!==this.mode&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())},t.ccAOF=function(){},t.ccAON=function(){},t.ccDER=function(){this.logger.log(2,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},t.ccRU=function(e){this.logger.log(2,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)},t.ccFON=function(){this.logger.log(2,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},t.ccRDC=function(){this.logger.log(2,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},t.ccTR=function(){this.logger.log(2,"TR"),this.setMode("MODE_TEXT")},t.ccRTD=function(){this.logger.log(2,"RTD"),this.setMode("MODE_TEXT")},t.ccEDM=function(){this.logger.log(2,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},t.ccCR=function(){this.logger.log(2,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},t.ccENM=function(){this.logger.log(2,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},t.ccEOC=function(){var e=this;if(this.logger.log(2,"EOC - End Of Caption"),"MODE_POP-ON"===this.mode){var t=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=t,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,(function(){return"DISP: "+e.displayedMemory.getDisplayText()}))}this.outputDataUpdate(!0)},t.ccTO=function(e){this.logger.log(2,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)},t.ccMIDROW=function(e){var t={flash:!1};if(t.underline=e%2==1,t.italics=e>=46,t.italics)t.foreground="white";else{var r=Math.floor(e/2)-16;t.foreground=["white","green","blue","cyan","red","yellow","magenta"][r]}this.logger.log(2,"MIDROW: "+sr(t)),this.writeScreen.setPen(t)},t.outputDataUpdate=function(e){void 0===e&&(e=!1);var t=this.logger.time;null!==t&&this.outputFilter&&(null!==this.cueStartTime||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,t,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:t):this.cueStartTime=t,this.lastOutputScreen.copy(this.displayedMemory))},t.cueSplitAtTime=function(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))},e}(),vd=function(){function e(e,t,r){this.channels=[null,null,null],this.currentChannel=0,this.cmdHistory={a:null,b:null},this.logger=void 0,this.field=void 0,this.outputFilters=void 0,this.logger=new od,this.field=e,this.outputFilters=[null,t,r]}var t=e.prototype;return t.getHandler=function(e){return this.outputFilters[e]},t.setHandler=function(e,t){var r;this.outputFilters[e]=t,null==(r=this.channels[e])||r.setHandler(t)},t.getChannel=function(e){var t=this.channels[e];return t||(t=this.channels[e]=new gd(this.field+e-1,this.outputFilters[e],this.logger)),t},t.addData=function(e,t){var r=this;this.logger.time=e;for(var i=function(e){var i=127&t[e],n=127&t[e+1],a=!1,s=null;if(0===i&&0===n)return 0;r.logger.log(3,(function(){return"["+ld([t[e],t[e+1]])+"] -> ("+ld([i,n])+")"}));var o=r.cmdHistory;if(i>=16&&i<=31){if(function(e,t,r){return r.a===e&&r.b===t}(i,n,o))return pd(null,null,o),r.logger.log(3,(function(){return"Repeated command ("+ld([i,n])+") is dropped"})),0;pd(i,n,r.cmdHistory),(a=r.parseCmd(i,n))||(a=r.parseMidrow(i,n)),a||(a=r.parsePAC(i,n)),a||(a=r.parseBackgroundAttributes(i,n))}else pd(null,null,o);if(!a&&(s=r.parseChars(i,n))){var l=r.currentChannel;l&&l>0?r.getChannel(l).insertChars(s):r.logger.log(2,"No channel found yet. TEXT-MODE?")}a||s||r.logger.log(2,(function(){return"Couldn't parse cleaned data "+ld([i,n])+" orig: "+ld([t[e],t[e+1]])}))},n=0;n<t.length;n+=2)i(n)},t.parseCmd=function(e,t){if(!((20===e||28===e||21===e||29===e)&&t>=32&&t<=47||(23===e||31===e)&&t>=33&&t<=35))return!1;var r=20===e||21===e||23===e?1:2,i=this.getChannel(r);return 20===e||21===e||28===e||29===e?32===t?i.ccRCL():33===t?i.ccBS():34===t?i.ccAOF():35===t?i.ccAON():36===t?i.ccDER():37===t?i.ccRU(2):38===t?i.ccRU(3):39===t?i.ccRU(4):40===t?i.ccFON():41===t?i.ccRDC():42===t?i.ccTR():43===t?i.ccRTD():44===t?i.ccEDM():45===t?i.ccCR():46===t?i.ccENM():47===t&&i.ccEOC():i.ccTO(t-32),this.currentChannel=r,!0},t.parseMidrow=function(e,t){var r=0;if((17===e||25===e)&&t>=32&&t<=47){if((r=17===e?1:2)!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;var i=this.channels[r];return!!i&&(i.ccMIDROW(t),this.logger.log(3,(function(){return"MIDROW ("+ld([e,t])+")"})),!0)}return!1},t.parsePAC=function(e,t){var r;if(!((e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127||(16===e||24===e)&&t>=64&&t<=95))return!1;var i=e<=23?1:2;return r=t>=64&&t<=95?1===i?rd[e]:nd[e]:1===i?id[e]:ad[e],this.getChannel(i).setPAC(this.interpretPAC(r,t)),this.currentChannel=i,!0},t.interpretPAC=function(e,t){var r,i={color:null,italics:!1,indent:null,underline:!1,row:e};return r=t>95?t-96:t-64,i.underline=1==(1&r),r<=13?i.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(r/2)]:r<=15?(i.italics=!0,i.color="white"):i.indent=4*Math.floor((r-16)/2),i},t.parseChars=function(e,t){var r,i,n=null,a=null;return e>=25?(r=2,a=e-8):(r=1,a=e),a>=17&&a<=19?(i=17===a?t+80:18===a?t+112:t+144,this.logger.log(2,(function(){return"Special char '"+Zu(i)+"' in channel "+r})),n=[i]):e>=32&&e<=127&&(n=0===t?[e]:[e,t]),n&&this.logger.log(3,(function(){return"Char codes = "+ld(n).join(",")})),n},t.parseBackgroundAttributes=function(e,t){var r;if(!((16===e||24===e)&&t>=32&&t<=47||(23===e||31===e)&&t>=45&&t<=47))return!1;var i={};16===e||24===e?(r=Math.floor((t-32)/2),i.background=sd[r],t%2==1&&(i.background=i.background+"_semi")):45===t?i.background="transparent":(i.foreground="black",47===t&&(i.underline=!0));var n=e<=23?1:2;return this.getChannel(n).setBkgData(i),!0},t.reset=function(){for(var e=0;e<Object.keys(this.channels).length;e++){var t=this.channels[e];t&&t.reset()}pd(null,null,this.cmdHistory)},t.cueSplitAtTime=function(e){for(var t=0;t<this.channels.length;t++){var r=this.channels[t];r&&r.cueSplitAtTime(e)}},e}();function pd(e,t,r){r.a=e,r.b=t}var md=function(){function e(e,t){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=t}var t=e.prototype;return t.dispatchCue=function(){null!==this.startTime&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)},t.newCue=function(e,t,r){(null===this.startTime||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=r,this.timelineController.createCaptionsTrack(this.trackName)},t.reset=function(){this.cueRanges=[],this.startTime=null},e}(),yd=function(){function e(e){this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.cueCache={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}},this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.config.cueHandler,this.cueCache={},this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},e.on(G.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(G.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(G.MANIFEST_LOADING,this.onManifestLoading,this),e.on(G.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(G.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(G.FRAG_LOADING,this.onFragLoading,this),e.on(G.FRAG_LOADED,this.onFragLoaded,this),e.on(G.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(G.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(G.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(G.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(G.BUFFER_APPENDED,this.onBufferAppended,this),e.on(G.BUFFER_FLUSHING,this.onBufferFlushing,this)}var t=e.prototype;return t.destroy=function(){var e=this.hls;e.off(G.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(G.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(G.MANIFEST_LOADING,this.onManifestLoading,this),e.off(G.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(G.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(G.FRAG_LOADING,this.onFragLoading,this),e.off(G.FRAG_LOADED,this.onFragLoaded,this),e.off(G.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(G.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(G.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(G.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(G.BUFFER_APPENDED,this.onBufferAppended,this),e.off(G.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.media=null,this.cea608Parser1=this.cea608Parser2=void 0},t.initCea608Parsers=function(){var e=new md(this,"textTrack1"),t=new md(this,"textTrack2"),r=new md(this,"textTrack3"),i=new md(this,"textTrack4");this.cea608Parser1=new vd(1,e,t),this.cea608Parser2=new vd(3,r,i)},t.addCues=function(e,t,r,i,n){for(var a,s,o,l,u=!1,d=n.length;d--;){var c=n[d],h=(a=c[0],s=c[1],o=t,l=r,Math.min(s,l)-Math.max(a,o));if(h>=0&&(c[0]=Math.min(c[0],t),c[1]=Math.max(c[1],r),u=!0,h/(r-t)>.5))return}if(u||n.push([t,r]),this.config.renderTextTracksNatively){var f=this.cueCache[e];if(f){var g=this.Cues.newCue(null,t,r,i);g.length&&f.push.apply(f,g)}else{var v=this.captionsTracks[e].track;this.Cues.newCue(v,t,r,i)}}else{var p,m=this.Cues.newCue(null,t,r,i),y=null==(p=this.captionsProperties[e])?void 0:p.media;this.hls.trigger(G.CUES_PARSED,{type:"captions",cues:m,track:e,closedCaptions:y})}},t.onInitPtsFound=function(e,t){var r=this,i=t.id,n=t.timestampOffsets,a=this.unparsedVttFrags;i===K.MAIN&&(this.initPTS=n),a.length&&(this.unparsedVttFrags=[],a.forEach((function(e){r.initPTS[e.frag.cc]?r.onFragLoaded(G.FRAG_LOADED,e):r.hls.trigger(G.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e.frag,part:null,error:new Error("Subtitle discontinuity domain does not match main")})})))},t.createCaptionsTrack=function(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)},t.createNativeTrack=function(e){if(!this.captionsTracks[e]){var t=this.captionsProperties,r=this.captionsTracks,i=this.cueCache,n=this.media,a=t[e],s=a.label,o=a.languageCode;n&&(i[e]=[],r[e]=Ul(n,"captions",s,o,"hidden"))}},t.createNonNativeTrack=function(e){if(!this.nonNativeCaptionsTracks[e]){var t=this.captionsProperties[e];if(t){var r={_id:e,label:t.label,kind:"captions",default:!!t.media&&!!t.media.default,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=r,this.hls.trigger(G.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[r]})}}},t.onMediaAttaching=function(e,t){this.media=t.media},t.onMediaDetaching=function(e,t){var r=!!t.transferMedia;if(this.media=null,!r){if(this.config.renderTextTracksNatively){var i=this.captionsTracks,n=this.cueCache;for(var a in i)i[a].remove(),delete n[a]}this.cueCache={},this.captionsTracks={},this.nonNativeCaptionsTracks={}}},t.onManifestLoading=function(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}},this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},t.onSubtitleTracksUpdated=function(e,t){var r=t.subtitleTracks||[];if(r.length&&!this.config.renderTextTracksNatively&&!us(this.tracks,r)){var i=r.map((function(e){return{label:e.name,kind:e.type.toLowerCase(),default:e.default,subtitleTrack:e}}));this.hls.trigger(G.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:i})}this.tracks=r},t.onManifestLoaded=function(e,t){var r=this;this.config.enableCEA708Captions&&t.captions&&t.captions.forEach((function(e){var t=/(?:CC|SERVICE)([1-4])/.exec(e.instreamId);if(t){var i="textTrack"+t[1],n=r.captionsProperties[i];n&&(n.label=e.name,e.lang&&(n.languageCode=e.lang),n.media=e)}}))},t.closedCaptionsForLevel=function(e){var t=this.hls.levels[e.level];return null==t?void 0:t.attrs["CLOSED-CAPTIONS"]},t.onFragLoading=function(e,t){if(this.enabled&&t.frag.type===K.MAIN){var r,i,n=this.cea608Parser1,a=this.cea608Parser2,s=this.lastSn,o=t.frag,l=o.cc,u=o.sn,d=null!=(r=null==(i=t.part)?void 0:i.index)?r:-1;n&&a&&(u!==s+1||u===s&&d!==this.lastPartIndex+1||l!==this.lastCc)&&(n.reset(),a.reset()),this.lastCc=l,this.lastSn=u,this.lastPartIndex=d}},t.onFragLoaded=function(e,t){var r,i=t.frag,n=t.payload;if(i.level<this.tracks.length&&i.type===K.SUBTITLE)if(n.byteLength||null!=(r=i.initSegment)&&null!=(r=r.data)&&r.byteLength){var a=i.decryptdata,s="stats"in t;if(null==a||!a.encrypted||s){var o=this.tracks[i.level],l=this.vttCCs;l[i.cc]||(l[i.cc]={start:i.start,prevCC:this.prevCC,new:!0},this.prevCC=i.cc),(null==o?void 0:o.textCodec)===$u?this._parseIMSC1(t):this._parseVTTs(t)}}else{var u="part"in t?t.part:null;this.hls.trigger(G.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,part:u,error:new Error("Empty subtitle payload")})}},t._parseIMSC1=function(e){var t=this,r=e.frag,i=e.payload,n="part"in e?e.part:null,a=this.hls;Ku(i,this.initPTS[r.cc],(function(e){t._appendCues(e,r.level),a.trigger(G.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:r,part:n})}),(function(e){a.logger.log("Cannot parse IMSC1 (sn: "+r.sn+" @"+r.start+"): "+e),a.trigger(G.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:r,part:n,error:e})}))},t._parseVTTs=function(e){var t,r=this,i=e.frag,n=e.payload,a="part"in e?e.part:null,s=this.initPTS,o=this.unparsedVttFrags,l=s.length-1;if(s[i.cc]||-1!==l){var u=this.hls,d=null==(t=i.initSegment)?void 0:t.data;Bu(d?ht(d,new Uint8Array(n)).buffer:n,this.initPTS[i.cc],this.vttCCs,i.cc,(a&&!d?a:i).start,(function(e){r._appendCues(e,i.level),u.trigger(G.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:i,part:a})}),(function(t){var n=t.message.startsWith("Missing initPTS");u.logger.log((n?"Deferred parsing of":"Cannot parse")+" VTT cue (sn: "+i.sn+" @"+i.start+"): "+t),n?o.push(e):(r.config.enableIMSC1&&r._fallbackToIMSC1(e),u.trigger(G.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,part:a,error:t}))}))}else o.push(e)},t._fallbackToIMSC1=function(e){var t=this,r=e.frag,i=e.payload,n=this.tracks[r.level];n.textCodec||Ku(i,this.initPTS[r.cc],(function(){n.textCodec=$u,t._parseIMSC1(e)}),(function(){n.textCodec="wvtt"}))},t._appendCues=function(e,t){var r=this.hls;if(this.config.renderTextTracksNatively){var i,n=null==(i=this.tracks[t].trackNode)?void 0:i.track;if(!n||"disabled"===n.mode)return;e.forEach((function(e){return $l(n,e)}))}else{var a=this.tracks[t];if(!a)return;var s=a.default?"default":"subtitles"+t;r.trigger(G.CUES_PARSED,{type:"subtitles",cues:e,track:s,subtitleTrack:a})}},t.onFragDecrypted=function(e,t){t.frag.type===K.SUBTITLE&&this.onFragLoaded(G.FRAG_LOADED,t)},t.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},t.onFragParsingUserdata=function(e,t){if(this.enabled&&this.config.enableCEA708Captions){var r=t.frag,i=t.samples;if(r.type!==K.MAIN||"NONE"!==this.closedCaptionsForLevel(r))for(var n=0;n<i.length;n++){var a=i[n].bytes;if(a){this.cea608Parser1||this.initCea608Parsers();var s=this.extractCea608Data(a);this.cea608Parser1.addData(i[n].pts,s[0]),this.cea608Parser2.addData(i[n].pts,s[1])}}}},t.onBufferAppended=function(e,t){if(this.config.renderTextTracksNatively){var r,i=t.type,n=t.timeRanges;if("video"===i&&null!=(r=n[i])&&r.length){var a=this.captionsTracks,s=this.cueCache;Object.keys(s).forEach((function(e){var t,r=null==(t=a[e])?void 0:t.track;if(r)for(var i=s[e],n=0;n<i.length;n++)$l(r,i[n]);delete s[e]}))}}},t.onBufferFlushing=function(e,t){var r=t.startOffset,i=t.endOffset,n=t.endOffsetSubtitles,a=t.type,s=this.media;if(s&&!(s.currentTime<i)){if(!a||"video"===a){var o=this.captionsTracks,l=this.cueCache;Object.keys(o).forEach((function(e){return Gl(o[e].track,r,i)})),Object.keys(l).forEach((function(e){for(var t=l[e],n=t.length;n--;){var a=t[n];a.startTime>=r&&a.endTime<=i&&t.splice(n,1)}}))}this.config.renderTextTracksNatively&&0===r&&void 0!==n&&this.tracks.forEach((function(e){var t,i=null==(t=e.trackNode)?void 0:t.track;i&&Gl(i,r,n)}))}},t.extractCea608Data=function(e){for(var t=[[],[]],r=31&e[0],i=2,n=0;n<r;n++){var a=e[i++],s=127&e[i++],o=127&e[i++];if((0!==s||0!==o)&&0!=(4&a)){var l=3&a;0!==l&&1!==l||(t[l].push(s),t[l].push(o))}}return t},e}(),Ed=/\s/,bd={newCue:function(e,t,r,i){for(var n,a,s,o,l,u=[],d=self.VTTCue||self.TextTrackCue,c=0;c<i.rows.length;c++)if(s=!0,o=0,l="",!(n=i.rows[c]).isEmpty()){for(var h,f=0;f<n.chars.length;f++)Ed.test(n.chars[f].uchar)&&s?o++:(l+=n.chars[f].uchar,s=!1);n.cueStartTime=t,t===r&&(r+=1e-4),o>=16?o--:o++;var g=Ou(l.trim()),v=Uu(t,r,g);null!=e&&null!=(h=e.cues)&&h.getCueById(v)||((a=new d(t,r,g)).id=v,a.line=c+1,a.align="left",a.position=10+Math.min(80,10*Math.floor(8*o/32)),u.push(a))}return e&&u.length&&(u.sort((function(e,t){return"auto"===e.line||"auto"===t.line?0:e.line>8&&t.line>8?t.line-e.line:e.line-t.line})),u.forEach((function(t){return $l(e,t)}))),u}},Td=function(){function e(){this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=0,this.config=null,this.callbacks=null,this.context=null,this.stats=new H}var t=e.prototype;return t.destroy=function(){this.callbacks=this.context=this.config=null,this.abortInternal(),this.stats=null},t.load=function(e,t,r){var i=this.stats;if(i.loading.start)throw new Error("Loader can only be used once.");i.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=r,this.loadInternal()},t.abort=function(){var e;this.abortInternal(),null!=(e=this.callbacks)&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.getNetworkDetails())},t.loadtimeout=function(){if(this.config){var e=this.config.loadPolicy.timeoutRetry;if(ae(e,this.stats.retry,!0))this.retry(e);else{var t;me.warn("timeout while loading "+(null==(t=this.context)?void 0:t.url));var r=this.callbacks;r&&(this.abortInternal(),r.onTimeout(this.stats,this.context,this.getNetworkDetails()))}}},t.retry=function(e){var t=this,r=this.context,i=this.stats;this.retryDelay=ie(e,i.retry),i.retry++,me.warn((status?"HTTP Status "+status:"Timeout")+" while loading "+(null==r?void 0:r.url)+", retrying "+i.retry+"/"+e.maxNumRetry+" in "+this.retryDelay+"ms"),this.abortInternal(),this.resetInternalLoader(),self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout((function(){return t.loadInternal()}),this.retryDelay)},e}(),Sd=/(\d+)-(\d+)\/(\d+)/,wd=function(e){function t(t){var r;return(r=e.call(this)||this).fetchSetup=void 0,r.request=null,r.response=null,r.controller=null,r.fetchSetup=t.fetchSetup||Ad,r}c(t,e);var r=t.prototype;return r.destroy=function(){this.request=null,e.prototype.destroy.call(this),this.response=null,this.controller=null,this.fetchSetup=null},r.abortInternal=function(){self.clearTimeout(this.retryTimeout),this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())},r.getNetworkDetails=function(){return this.response},r.resetInternalLoader=function(){this.response=null},r.loadInternal=function(){var e=this,t=this.config,r=this.context,i=this.stats;if(t&&r){i.loading.first=0,i.loaded=0,i.aborted=!1,this.controller=new self.AbortController;var n=function(e,t){var r={method:"GET",mode:"cors",credentials:"same-origin",signal:t,headers:new self.Headers(u({},e.headers))};return e.rangeEnd&&r.headers.set("Range","bytes="+e.rangeStart+"-"+String(e.rangeEnd-1)),r}(r,this.controller.signal),a="arraybuffer"===r.responseType,s=a?"byteLength":"length",o=t.loadPolicy,l=o.maxTimeToFirstByteMs,d=o.maxLoadTimeMs;this.request=this.fetchSetup(r,n),self.clearTimeout(this.requestTimeout),t.timeout=l&&F(l)?l:d,this.requestTimeout=self.setTimeout((function(){e.loadtimeout()}),t.timeout),(za(this.request)?this.request.then(self.fetch):self.fetch(this.request)).then((function(n){var s;e.response=n;var o=Math.max(self.performance.now(),i.loading.start);if(self.clearTimeout(e.requestTimeout),t.timeout=d,e.requestTimeout=self.setTimeout((function(){e.loadtimeout()}),d-(o-i.loading.start)),!n.ok){var l=n.status,u=n.statusText;throw new Ld(u||"fetch, bad network response",l,n)}i.loading.first=o,i.total=function(e){var t=e.get("Content-Range");if(t){var r=function(e){var t=Sd.exec(e);if(t)return parseInt(t[2])-parseInt(t[1])+1}(t);if(F(r))return r}var i=e.get("Content-Length");if(i)return parseInt(i)}(n.headers)||i.total;var c=null==(s=e.callbacks)?void 0:s.onProgress;return c&&F(t.highWaterMark)?e.loadProgressively(n,i,r,t.highWaterMark,c):a?n.arrayBuffer():"json"===r.responseType?n.json():n.text()})).then((function(n){var a,o,l=e.response;if(!l)throw new Error("loader destroyed");self.clearTimeout(e.requestTimeout),i.loading.end=Math.max(self.performance.now(),i.loading.first);var u=n[s];u&&(i.loaded=i.total=u);var d={url:l.url,data:n,code:l.status},c=null==(a=e.callbacks)?void 0:a.onProgress;c&&!F(t.highWaterMark)&&c(i,r,n,l),null==(o=e.callbacks)||o.onSuccess(d,i,r,l)})).catch((function(n){if(self.clearTimeout(e.requestTimeout),!i.aborted){var a,s=n&&n.code||0,o=n?n.message:null,l=t.loadPolicy.errorRetry;ae(l,i.retry,!1,{url:r.url,data:void 0,code:s})?e.retry(l):(me.error(s+" while loading "+r.url),null==(a=e.callbacks)||a.onError({code:s,text:o},r,n?n.details:null,i))}}))}},r.getCacheAge=function(){var e=null;if(this.response){var t=this.response.headers.get("age");e=t?parseFloat(t):null}return e},r.getResponseHeader=function(e){return this.response?this.response.headers.get(e):null},r.loadProgressively=function(e,t,r,i,n){void 0===i&&(i=0);var a=new Cn,s=e.body.getReader(),o=function(){return s.read().then((function(s){if(s.done)return a.dataLength&&n(t,r,a.flush().buffer,e),Promise.resolve(new ArrayBuffer(0));var l=s.value,u=l.length;return t.loaded+=u,u<i||a.dataLength?(a.push(l),a.dataLength>=i&&n(t,r,a.flush().buffer,e)):n(t,r,l.buffer,e),o()})).catch((function(){return Promise.reject()}))};return o()},t}(Td);function Ad(e,t){return new self.Request(e.url,t)}var Ld=function(e){function t(t,r,i){var n;return(n=e.call(this,t)||this).code=void 0,n.details=void 0,n.code=r,n.details=i,n}return c(t,e),t}(b(Error)),Id=/^age:\s*[\d.]+\s*$/im,kd=function(e){function t(t){var r;return(r=e.call(this)||this).xhrSetup=void 0,r.loader=null,r.xhrSetup=t.xhrSetup||null,r}c(t,e);var r=t.prototype;return r.destroy=function(){e.prototype.destroy.call(this),this.loader=null,this.xhrSetup=null},r.abortInternal=function(){var e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,4!==e.readyState&&(this.stats.aborted=!0,e.abort()))},r.getNetworkDetails=function(){return this.loader},r.resetInternalLoader=function(){this.loader=null},r.loadInternal=function(){var e=this,t=this.config,r=this.context;if(t&&r){var i=this.loader=new self.XMLHttpRequest,n=this.stats;n.loading.first=0,n.loaded=0,n.aborted=!1;var a=this.xhrSetup;a?Promise.resolve().then((function(){if(e.loader===i&&!e.stats.aborted)return a.call(e,i,r.url,r)})).catch((function(t){if(e.loader===i&&!e.stats.aborted)return i.open("GET",r.url,!0),a.call(e,i,r.url,r)})).then((function(){e.loader!==i||e.stats.aborted||e.openAndSendXhr(i,r,t)})).catch((function(t){var a;null==(a=e.callbacks)||a.onError({code:i.status,text:t.message},r,i,n)})):this.openAndSendXhr(i,r,t)}},r.openAndSendXhr=function(e,t,r){e.readyState||e.open("GET",t.url,!0);var i=t.headers,n=r.loadPolicy,a=n.maxTimeToFirstByteMs,s=n.maxLoadTimeMs;if(i)for(var o in i)e.setRequestHeader(o,i[o]);t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),r.timeout=a&&F(a)?a:s,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),r.timeout),e.send()},r.readystatechange=function(){var e=this.context,t=this.loader,r=this.stats;if(e&&t){var i=t.readyState,n=this.config;if(!r.aborted&&i>=2&&(0===r.loading.first&&(r.loading.first=Math.max(self.performance.now(),r.loading.start),n.timeout!==n.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),n.timeout=n.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),n.loadPolicy.maxLoadTimeMs-(r.loading.first-r.loading.start)))),4===i)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;var a=t.status,s="text"===t.responseType?t.responseText:null;if(a>=200&&a<300){var o=null!=s?s:t.response;if(null!=o){var l,u;r.loading.end=Math.max(self.performance.now(),r.loading.first);var d="arraybuffer"===t.responseType?o.byteLength:o.length;r.loaded=r.total=d,r.bwEstimate=8e3*r.total/(r.loading.end-r.loading.first);var c=null==(l=this.callbacks)?void 0:l.onProgress;c&&c(r,e,o,t);var h={url:t.responseURL,data:o,code:a};return e.rangeEnd&&d!==e.rangeEnd-e.rangeStart&&me.warn("Payload length "+d+" does not match requested Range: bytes="+e.rangeStart+"-"+(e.rangeEnd-1)),void(null==(u=this.callbacks)||u.onSuccess(h,r,e,t))}}var f,g=n.loadPolicy.errorRetry;ae(g,r.retry,!1,{url:e.url,data:void 0,code:a})?this.retry(g):(me.error(a+" while loading "+e.url),null==(f=this.callbacks)||f.onError({code:a,text:t.statusText},e,t,r))}}},r.loadprogress=function(e){var t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)},r.getCacheAge=function(){var e=null;if(this.loader&&Id.test(this.loader.getAllResponseHeaders())){var t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e},r.getResponseHeader=function(e){return this.loader&&new RegExp("^"+e+":\\s*[\\d.]+\\s*$","im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null},t}(Td),Rd=g(g({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,maxDevicePixelRatio:Number.POSITIVE_INFINITY,preferManagedMediaSource:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,loopBackBufferFlush:void 0,startOnSegmentBoundary:!1,nextAudioTrackBufferFlushForwardOffset:.25,maxBufferSize:6e7,maxFragLookUpTolerance:.25,maxBufferHole:.1,detectStallWithCurrentTimeMs:1250,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,nudgeOnVideoHole:!0,skipBufferHolePadding:.1,liveSyncMode:"edge",liveSyncDurationCount:3,liveSyncOnStallIncrease:1,liveMaxLatencyDurationCount:1/0,liveMaxUnchangedPlaylistRefresh:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,appendTimeout:1/0,ignorePlaylistParsingErrors:!1,loader:kd,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,handleMpegTsVideoIntegrityErrors:"process",abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,abrSwitchInterval:0,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:Ni,requireKeySystemAccessOnStart:!1,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableEmsgKLVMetadata:!1,enableID3MetadataCues:!0,emsgKLVSchemaUri:void 0,enableInterstitialPlayback:!0,interstitialAppendInPlace:!0,interstitialLiveLookAhead:10,iframeCacheLimit:2097152,useMediaCapabilities:!0,preserveManualLevelOnError:!1,errorPenaltyExpireMs:0,certLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null}},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},interstitialAssetListLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:3e4,timeoutRetry:{maxNumRetry:0,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:0,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,streamController:Zl,abrController:mr,bufferController:ps,capLevelController:ws,errorController:Or,fpsController:_l,id3TrackController:jl,gapController:xl,latencyController:wu},{cueHandler:bd,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}),{},{subtitleStreamController:Au,subtitleTrackController:Xu,timelineController:yd,audioStreamController:os,audioTrackController:cs,emeController:Dl,cmcdController:wl,contentSteeringController:Al,iframeController:nu,interstitialsController:Su});function Dd(e,t,r){if((t.liveSyncDurationCount||t.liveMaxLatencyDurationCount)&&(t.liveSyncDuration||t.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(void 0!==t.liveMaxLatencyDurationCount&&(void 0===t.liveSyncDurationCount||t.liveMaxLatencyDurationCount<=t.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(void 0!==t.liveMaxLatencyDuration&&(void 0===t.liveSyncDuration||t.liveMaxLatencyDuration<=t.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');if(void 0!==t.liveMaxUnchangedPlaylistRefresh){var i=t.liveMaxUnchangedPlaylistRefresh,n=(a=i,s=2,o=1/0,Math.max(s,Math.min(a,o)));n!==i&&r.warn('hls.js config: "liveMaxUnchangedPlaylistRefresh" clamped from '+i+" to "+n+"."),t.liveMaxUnchangedPlaylistRefresh=n}var a,s,o,l=Cd(e),u=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return["manifest","level","frag"].forEach((function(e){var i=("level"===e?"playlist":e)+"LoadPolicy",n=void 0===t[i],a=[];u.forEach((function(r){var s=e+"Loading"+r,o=t[s];if(void 0!==o&&n){a.push(s);var u=l[i].default;switch(t[i]={default:u},r){case"TimeOut":u.maxLoadTimeMs=o,u.maxTimeToFirstByteMs=o;break;case"MaxRetry":u.errorRetry.maxNumRetry=o,u.timeoutRetry.maxNumRetry=o;break;case"RetryDelay":u.errorRetry.retryDelayMs=o,u.timeoutRetry.retryDelayMs=o;break;case"MaxRetryTimeout":u.errorRetry.maxRetryDelayMs=o,u.timeoutRetry.maxRetryDelayMs=o}}})),a.length&&r.warn('hls.js config: "'+a.join('", "')+'" setting(s) are deprecated, use "'+i+'": '+sr(t[i]))})),g(g({},l),t)}function Cd(e){return e&&"object"===a(e)?Array.isArray(e)?e.map(Cd):Object.keys(e).reduce((function(t,r){return t[r]=Cd(e[r]),t}),{}):e}function Pd(e,t){var r=e.loader;r!==wd&&r!==kd?(t.log("[config]: Custom loader detected, cannot enable progressive streaming"),e.progressive=!1):function(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(e){}return!1}()&&(e.loader=wd,e.progressive=!0,e.enableSoftwareAES=!0,t.log("[config]: Progressive streaming enabled, using FetchLoader"))}var _d=function(e){function t(t,r){var i;return(i=e.call(this,t,"level-controller")||this)._levels=[],i._firstLevel=-1,i._maxAutoLevel=-1,i._startLevel=void 0,i.currentLevel=null,i.currentLevelIndex=-1,i.manualLevelIndex=-1,i.steering=void 0,i.lastABRSwitchTime=-1,i._iframeVariants=[],i.onParsedComplete=void 0,i.steering=r,i._registerListeners(),i}c(t,e);var r=t.prototype;return r._registerListeners=function(){var e=this.hls;e.on(G.MANIFEST_LOADING,this.onManifestLoading,this),e.on(G.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(G.LEVEL_LOADED,this.onLevelLoaded,this),e.on(G.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(G.FRAG_BUFFERED,this.onFragBuffered,this),e.on(G.ERROR,this.onError,this)},r._unregisterListeners=function(){var e=this.hls;e.off(G.MANIFEST_LOADING,this.onManifestLoading,this),e.off(G.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(G.LEVEL_LOADED,this.onLevelLoaded,this),e.off(G.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(G.FRAG_BUFFERED,this.onFragBuffered,this),e.off(G.ERROR,this.onError,this)},r.destroy=function(){this._unregisterListeners(),this.steering=null,this.resetLevels(),e.prototype.destroy.call(this)},r.stopLoad=function(){this._levels.forEach((function(e){e.loadError=0,e.fragmentError=0})),e.prototype.stopLoad.call(this)},r.resetLevels=function(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1,this._iframeVariants=[]},r.onManifestLoading=function(e,t){this.resetLevels()},r.onManifestLoaded=function(e,t){var r=this,i=this.hls.config.preferManagedMediaSource,n=[],a={},s={},o=!1,l=!1,u=!1,d=!1;t.levels.forEach((function(e){var t=e.attrs,c=Md(e,i),h=e.audioCodec,f=e.videoCodec,g=e.imageCodec,v=e.width,p=e.height;if(c){o||(o=!(!v||!p)),l||(l=!!f),u||(u=!!h),d||(d=!!g);var m=t.CODECS,y=t["FRAME-RATE"],E=t["HDCP-LEVEL"],b=t["PATHWAY-ID"],T=t.RESOLUTION,S=t["VIDEO-RANGE"],w=(b||".")+"-"+e.bitrate+"-"+T+"-"+y+"-"+m+"-"+S+"-"+E;if(a[w])if(a[w].uri===e.url||e.attrs["PATHWAY-ID"])e.iframes||(a[w].addGroupId("audio",t.AUDIO),a[w].addGroupId("text",t.SUBTITLES));else{var A=s[w]+=1;e.attrs["PATHWAY-ID"]=new Array(A+1).join(".");var L=r.createLevel(e);a[w]=L,n.push(L)}else{var I=r.createLevel(e);a[w]=I,s[w]=1,n.push(I)}}else r.log('Some or all CODECS not supported "'+t.CODECS+'"')})),this.filterAndSortMediaOptions(n,t,o,l,u,d)},r.createLevel=function(e){var t=new ir(e),r=e.supplemental;if(null!=r&&r.videoCodec&&!Od(r.videoCodec,this.hls.config.preferManagedMediaSource)){var i=new Error('SUPPLEMENTAL-CODECS not supported "'+r.videoCodec+'"');this.log(i.message),t.supportedResult=jt(i,[])}return t},r.filterAndSortMediaOptions=function(e,t,r,i,n,a){var s,o=this,l=[],u=[],d=e,c=(null==(s=t.stats)?void 0:s.parsing)||{},h=this.hls.config.preferManagedMediaSource;if((r||i)&&n&&(d=d.filter((function(e){var t,r=e.videoCodec,i=e.videoRange,n=e.width,a=e.height;return(!!r||!(!n||!a))&&!!(t=i)&&Xt.indexOf(t)>-1}))),i&&a&&(d=d.filter((function(e){return!e.imageCodec}))),0===d.length)return Promise.resolve().then((function(){if(o.hls){var e="no level with compatible codecs found in manifest",r=e;t.levels.length&&(r="one or more CODECS in variant not supported: "+sr(t.levels.map((function(e){return e.attrs.CODECS})).filter((function(e,t,r){return r.indexOf(e)===t}))),o.warn(r),e+=" ("+r+")");var i=new Error(e);o.hls.trigger(G.ERROR,{type:B.MEDIA_ERROR,details:$.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:i,reason:r})}})),void(c.end=performance.now());t.audioTracks&&Fd(l=t.audioTracks.filter((function(e){return!e.audioCodec||xd(e.audioCodec,h)}))),t.subtitles&&Fd(u=t.subtitles);var f=d.slice(0);d.sort((function(e,t){if(e.attrs["HDCP-LEVEL"]!==t.attrs["HDCP-LEVEL"])return(e.attrs["HDCP-LEVEL"]||"")>(t.attrs["HDCP-LEVEL"]||"")?1:-1;if(r&&e.height!==t.height)return e.height-t.height;if(e.frameRate!==t.frameRate)return e.frameRate-t.frameRate;if(e.videoRange!==t.videoRange)return Xt.indexOf(e.videoRange)-Xt.indexOf(t.videoRange);
vendor: 4,599 bytes, line 2
2if(e.videoCodec!==t.videoCodec){var i=xt(e.videoCodec),n=xt(t.videoCodec);if(i!==n)return n-i}if(e.uri===t.uri&&e.codecSet!==t.codecSet){var a=Ot(e.codecSet),s=Ot(t.codecSet);if(a!==s)return s-a}return e.averageBitrate!==t.averageBitrate?e.averageBitrate-t.averageBitrate:0}));var g=f[0];if(this.steering&&(d=this.steering.filterParsedLevels(d)).length!==f.length)for(var v=0;v<f.length;v++)if(f[v].pathwayId===d[0].pathwayId){g=f[v];break}this._levels=d;for(var p=0;p<d.length;p++)if(d[p]===g){var m;this._firstLevel=p;var y=g.bitrate,E=this.hls.bandwidthEstimate;if(this.log("manifest loaded, "+d.length+" level(s) found, first bitrate: "+y),void 0===(null==(m=this.hls.userConfig)?void 0:m.abrEwmaDefaultEstimate)){var b=Math.min(y,this.hls.config.abrEwmaDefaultEstimateMax);b>E&&E===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=b)}break}var T=t.iframeVariants.filter((function(e){return Md(e,h)}));this._iframeVariants=T;var S=n&&!i,w=this.hls.config,A=!(!w.audioStreamController||!w.audioTrackController),L={levels:d,audioTracks:l,subtitleTracks:u,iframeVariants:T,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:n,video:i,altAudio:A&&!S&&l.some((function(e){return!!e.url}))};c.end=performance.now(),this.hls.trigger(G.MANIFEST_PARSED,L)},r.onError=function(e,t){!t.fatal&&t.context&&t.context.type===V.LEVEL&&t.context.level===this.level&&this.checkRetry(t)},r.onFragBuffered=function(e,t){var r=t.frag;if(r.type===K.MAIN){var i=r.elementaryStreams;if(!Object.keys(i).some((function(e){return!!i[e]})))return;var n=this._levels[r.level];null!=n&&n.loadError&&(this.log("Resetting level error count of "+n.loadError+" on frag buffered"),n.loadError=0)}},r.onLevelLoaded=function(e,t){var r,i,n=t.level,a=t.details,s=t.levelInfo;if(!s)return this.warn("Invalid level index "+n),void(null!=(i=t.deliveryDirectives)&&i.skip&&(a.deltaUpdateFailed=!0));if(s===this.currentLevel||t.withoutMultiVariant){0===s.fragmentError&&(s.loadError=0);var o=s.details;o===t.details&&o.advanced&&(o=void 0),this.playlistLoaded(n,t,o)}else null!=(r=t.deliveryDirectives)&&r.skip&&(a.deltaUpdateFailed=!0)},r.loadPlaylist=function(t){e.prototype.loadPlaylist.call(this),this.shouldLoadPlaylist(this.currentLevel)&&this.scheduleLoading(this.currentLevel,t)},r.loadingPlaylist=function(t,r){e.prototype.loadingPlaylist.call(this,t,r);var i=this.getUrlWithDirectives(t.uri,r),n=this.currentLevelIndex,a=t.attrs["PATHWAY-ID"],s=t.details,o=null==s?void 0:s.age;this.log("Loading level index "+n+(void 0!==(null==r?void 0:r.msn)?" at sn "+r.msn+" part "+r.part:"")+(a?" Pathway "+a:"")+(o&&s.live?" age "+o.toFixed(1)+(s.type?" "+s.type||0:""):"")+" "+i),this.hls.trigger(G.LEVEL_LOADING,{url:i,level:n,levelInfo:t,pathwayId:t.attrs["PATHWAY-ID"],id:0,deliveryDirectives:r||null})},r.removeLevel=function(e){var t,r=this;if(1!==this._levels.length){var i=this._levels.filter((function(t,i){return i!==e||(r.steering&&r.steering.removeLevel(t),t===r.currentLevel&&(r.currentLevel=null,r.currentLevelIndex=-1,t.details&&t.details.fragments.forEach((function(e){return e.level=-1}))),!1)}));pn(i),this._levels=i,this.currentLevelIndex>-1&&null!=(t=this.currentLevel)&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.manualLevelIndex>-1&&(this.manualLevelIndex=this.currentLevelIndex);var n=i.length-1;this._firstLevel=Math.min(this._firstLevel,n),this._startLevel&&(this._startLevel=Math.min(this._startLevel,n)),this.hls.trigger(G.LEVELS_UPDATED,{levels:i})}},r.onLevelsUpdated=function(e,t){var r=t.levels;this._levels=r},r.checkMaxAutoUpdated=function(){var e=this.hls,t=e.autoLevelCapping,r=e.maxAutoLevel,i=e.maxHdcpLevel;this._maxAutoLevel!==r&&(this._maxAutoLevel=r,this.hls.trigger(G.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:t,levels:this.levels,maxAutoLevel:r,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:i}))},i(t,[{key:"iframeVariants",get:function(){return 0===this._iframeVariants.length?null:this._iframeVariants}},{key:"levels",get:function(){return 0===this._levels.length?null:this._levels}},{key:"loadLevelObj",get:function(){return this.currentLevel}},{key:"level",get:function(){return this.currentLevelIndex},set:function(e){var t=this._levels;if(0!==t.length){if(e<0||e>=t.length){var r=new Error("invalid level idx"),i=e<0;if(this.hls.trigger(G.ERROR,{type:B.OTHER_ERROR,details:$.LEVEL_SWITCH_ERROR,level:e,fatal:i,error:r,reason:r.message}),i)return;e=Math.min(e,t.length-1)}var n=this.currentLevelIndex,a=this.currentLevel,s=a?a.attrs["PATHWAY-ID"]:void 0,o=t[e],l=o.attrs["PATHWAY-ID"];
vendor: 7,004 bytes, line 2
2if(this.currentLevelIndex=e,this.currentLevel=o,n!==e||!a||s!==l){this.log("Switching to level "+e+" ("+(o.height?o.height+"p ":"")+(o.videoRange?o.videoRange+" ":"")+(o.codecSet?o.codecSet+" ":"")+"@"+o.bitrate+")"+(l?" with Pathway "+l:"")+" from level "+n+(s?" with Pathway "+s:""));var u={level:e,attrs:o.attrs,details:o.details,bitrate:o.bitrate,averageBitrate:o.averageBitrate,maxBitrate:o.maxBitrate,realBitrate:o.realBitrate,width:o.width,height:o.height,codecSet:o.codecSet,audioCodec:o.audioCodec,videoCodec:o.videoCodec,audioGroups:o.audioGroups,subtitleGroups:o.subtitleGroups,loaded:o.loaded,loadError:o.loadError,fragmentError:o.fragmentError,name:o.name,id:o.id,uri:o.uri,url:o.url,urlId:0,audioGroupIds:o.audioGroupIds,textGroupIds:o.textGroupIds};this.hls.trigger(G.LEVEL_SWITCHING,u);var d=o.details;if(!d||d.live){var c=this.switchParams(o.uri,null==a?void 0:a.details,d);this.loadPlaylist(c)}}}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(e){this.manualLevelIndex=e,void 0===this._startLevel&&(this._startLevel=e),-1!==e&&(this.level=e)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(e){this._firstLevel=e}},{key:"startLevel",get:function(){if(void 0===this._startLevel){var e=this.hls.config.startLevel;return void 0!==e?e:this.hls.firstAutoLevel}return this._startLevel},set:function(e){this._startLevel=e}},{key:"pathways",get:function(){return this.steering?this.steering.pathways():[]}},{key:"pathwayPriority",get:function(){return this.steering?this.steering.pathwayPriority:null},set:function(e){if(this.steering){var t=this.steering.pathways(),r=e.filter((function(e){return-1!==t.indexOf(e)}));if(e.length<1)return void this.warn("pathwayPriority "+e+" should contain at least one pathway from list: "+t);this.steering.pathwayPriority=r}}},{key:"nextLoadLevel",get:function(){return-1!==this.manualLevelIndex?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(e){var t=this.currentLevelIndex;if(-1===this.manualLevelIndex&&e!==t&&-1!==e){var r=this.hls.config.abrSwitchInterval;if(r>0){var i=performance.now(),n=i-this.lastABRSwitchTime,a=1e3*r;if(this.lastABRSwitchTime>-1&&n<a)return void this.warn("Preventing ABR level switch: "+t+" -> "+e+" ("+Math.round(n)+"ms < "+a+"ms / "+r+"s)");this.lastABRSwitchTime=i,this.log("Allowing ABR level switch: "+t+" -> "+e+" ("+Math.round(n)+"ms >= "+a+"ms / "+r+"s)")}}this.level=e,-1===this.manualLevelIndex&&(this.hls.nextAutoLevel=e)}}])}(ls);function xd(e,t){return Ct(e,"audio",t)}function Od(e,t){return Ct(e,"video",t)}function Md(e,t){var r=e.audioCodec,i=e.videoCodec;r&&(e.audioCodec=r=Nt(r,t)||void 0),i&&(i=e.videoCodec=function(e){for(var t=e.split(","),r=0;r<t.length;r++){var i=t[r].split(".");i.length>2&&"avc1"===i[0]&&(t[r]="avc1."+parseInt(i[1]).toString(16)+("000"+parseInt(i[2]).toString(16)).slice(-4))}return t.join(",")}(i));var n=e.unknownCodecs;return!((null==n?void 0:n.length)||r&&!xd(r,t)||i&&!Od(i,t))}function Fd(e){var t={};e.forEach((function(e){var r=e.groupId||"";e.id=t[r]=t[r]||0,t[r]++}))}var Nd=function(e){function t(t,r){var i;return(i=e.call(this,"key-loader",r)||this).config=void 0,i.keyLoaderInfo={},i.emeController=null,i.config=t,i}c(t,e);var r=t.prototype;return r.abort=function(e){for(var t in this.keyLoaderInfo){var r=this.keyLoaderInfo[t].loader;if(r){var i;if(e&&e!==(null==(i=r.context)?void 0:i.frag.type))return;r.abort()}}},r.destroy=function(){for(var e in this.keyLoaderInfo){var t=this.keyLoaderInfo[e].loader;t&&t.destroy()}this.emeController=null,this.keyLoaderInfo={}},r.loadClear=function(e,t,r){return this.emeController?this.emeController.loadClear(e,t,r):null},r.load=function(e,t){var r=this;return!e.decryptdata&&e.encrypted&&this.emeController&&this.config.emeEnabled?this.emeController.selectKeySystemFormat(e).then((function(i){return r.loadInternal(e,t,i)})):this.loadInternal(e,t)},r.loadInternal=function(e,t,r){var i=this;r&&e.setKeyFormat(r);var n=e.decryptdata;if(!n){var a=new Error(r?"Expected frag.decryptdata to be defined after setting format "+r:"Missing decryption data on fragment in onKeyLoading (emeEnabled with controller: "+(this.emeController&&this.config.emeEnabled)+")");return Promise.reject(Ud(e,$.KEY_LOAD_ERROR,a))}var s=e;switch(n.method){case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return"identity"===n.keyFormat?this.loadKeyHTTP(s):t?t.then((function(){return i.loadKeyEME(s)})):this.loadKeyEME(s);case"AES-128":case"AES-256":case"AES-256-CTR":return this.loadKeyHTTP(s);default:return Promise.reject(Ud(e,$.KEY_LOAD_ERROR,new Error('Key supplied with unsupported METHOD: "'+n.method+'"')))}},r.loadKeyEME=function(e){if(this.emeController&&this.config.emeEnabled){var t;if(!e.decryptdata.keyId&&null!=(t=e.initSegment)&&t.data){var r=function(e){var t=[];return lt(e,(function(e){return t.push(e.subarray(8,24))})),t}(e.initSegment.data);if(r.length){var i=r[0],n=e.decryptdata.uri;if(i.some((function(e){return 0!==e})))this.log("Using keyId found in init segment "+Fe(i)+" keyUri: "+n),$i.setKeyIdForUri(n,i);else{var a=$i.addKeyIdForUri(n);this.log("Patching empty keyId with "+Fe(a)+" keyUri: "+n),i=a}e.decryptdata.keyId=i}}return this.emeController.loadKey(e).then((function(){return{frag:e,keyInfo:{decryptdata:e.decryptdata}}}))}return Promise.reject(Ud(e,$.KEY_LOAD_ERROR,new Error("emeEnabled with controller: "+(this.emeController&&this.config.emeEnabled)+")")))},r.loadKeyHTTP=function(e){var t=this,r=e.decryptdata,i=r.uri;if(!i)return Promise.reject(Ud(e,$.KEY_LOAD_ERROR,new Error('Invalid key URI: "'+i+'"')));var n=this.keyLoaderInfo[i];if(n){if(n.decryptdata.key)return r.key=n.decryptdata.key,n.keyLoadPromise=null,Promise.resolve({frag:e,keyInfo:n});if(n.keyLoadPromise)return n.keyLoadPromise.then((function(t){return r.key=n.decryptdata.key,g(g({},t),{},{frag:e})}))}this.log("Loading"+(r.keyId?" keyId: "+Fe(r.keyId):"")+" URI: "+r.uri+" from "+e.type+" "+e.level);var a=this.config,s=new(0,a.loader)(a);e.keyLoader=s;var o=this.keyLoaderInfo[i]={decryptdata:r,keyLoadPromise:null,loader:s};return o.keyLoadPromise=new Promise((function(r,n){var l={type:V.KEY,keyInfo:o,frag:e,responseType:"arraybuffer",url:i},u=a.keyLoadPolicy.default,d={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},c={onSuccess:function(e,i,a,s){var o=a.frag,l=a.keyInfo,u=a.url;if(!o.decryptdata||l!==t.keyLoaderInfo[u])return n(Ud(o,$.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),s));l.decryptdata.key=o.decryptdata.key=new Uint8Array(e.data),o.keyLoader=l.loader=l.keyLoadPromise=null,r({frag:o,keyInfo:l})},onError:function(r,a,s,o){t.resetLoader(a),n(Ud(e,$.KEY_LOAD_ERROR,new Error("HTTP Error "+r.code+" loading key "+r.text),s,g({url:i,data:void 0},r)))},onTimeout:function(r,i,a){t.resetLoader(i),n(Ud(e,$.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),a))},onAbort:function(r,i,a){t.resetLoader(i),n(Ud(e,$.INTERNAL_ABORTED,new Error("key loading aborted"),a))}};s.load(l,d,c)}
vendor: 4,554 bytes, line 2
2))},r.resetLoader=function(e){var t=e.frag,r=e.keyInfo,i=e.url,n=r.loader;t.keyLoader===n&&(t.keyLoader=r.loader=r.keyLoadPromise=null),delete this.keyLoaderInfo[i],n&&n.destroy()},t}(de);function Ud(e,t,r,i,n){return void 0===t&&(t=$.KEY_LOAD_ERROR),new ii({type:B.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:n,error:r,networkDetails:i||null})}function Bd(e){switch(e.type){case V.AUDIO_TRACK:return K.AUDIO;case V.SUBTITLE_TRACK:return K.SUBTITLE;default:return K.MAIN}}function $d(e,t){var r=e.url;return void 0!==r&&0!==r.indexOf("data:")||(r=t.url),r}var Gd=function(){function e(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.onManifestLoaded=this.checkAutostartLoad,this.hls=e,this.registerListeners()}var t=e.prototype;return t.startLoad=function(e){},t.stopLoad=function(){this.destroyInternalLoaders()},t.registerListeners=function(){var e=this.hls;e.on(G.MANIFEST_LOADING,this.onManifestLoading,this),e.on(G.LEVEL_LOADING,this.onLevelLoading,this),e.on(G.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(G.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.on(G.LEVELS_UPDATED,this.onLevelsUpdated,this)},t.unregisterListeners=function(){var e=this.hls;e.off(G.MANIFEST_LOADING,this.onManifestLoading,this),e.off(G.LEVEL_LOADING,this.onLevelLoading,this),e.off(G.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(G.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.off(G.LEVELS_UPDATED,this.onLevelsUpdated,this)},t.createInternalLoader=function(e){var t=this.hls.config,r=t.pLoader,i=t.loader,n=new(r||i)(t);return this.loaders[e.type]=n,n},t.getInternalLoader=function(e){return this.loaders[e.type]},t.resetInternalLoader=function(e){this.loaders[e]&&delete this.loaders[e]},t.destroyInternalLoaders=function(){for(var e in this.loaders){var t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}},t.destroy=function(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()},t.onManifestLoading=function(e,t){var r=t.url;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:V.MANIFEST,url:r,deliveryDirectives:null,levelOrTrack:null})},t.onLevelLoading=function(e,t){var r=t.id,i=t.level,n=t.pathwayId,a=t.url,s=t.deliveryDirectives,o=t.levelInfo;this.load({id:r,level:i,pathwayId:n,responseType:"text",type:V.LEVEL,url:a,deliveryDirectives:s,levelOrTrack:o})},t.onAudioTrackLoading=function(e,t){var r=t.id,i=t.groupId,n=t.url,a=t.deliveryDirectives,s=t.track;this.load({id:r,groupId:i,level:null,responseType:"text",type:V.AUDIO_TRACK,url:n,deliveryDirectives:a,levelOrTrack:s})},t.onSubtitleTrackLoading=function(e,t){var r=t.id,i=t.groupId,n=t.url,a=t.deliveryDirectives,s=t.track;this.load({id:r,groupId:i,level:null,responseType:"text",type:V.SUBTITLE_TRACK,url:n,deliveryDirectives:a,levelOrTrack:s})},t.onLevelsUpdated=function(e,t){var r=this.loaders[V.LEVEL];if(r){var i=r.context;i&&!t.levels.some((function(e){return e===i.levelOrTrack}))&&(r.abort(),delete this.loaders[V.LEVEL])}},t.load=function(e){var t,r,i,n=this,a=this.hls.config,s=this.getInternalLoader(e);if(s){var o=this.hls.logger,l=s.context;if((null==l?void 0:l.levelOrTrack)===e.levelOrTrack&&(l.url===e.url||l.deliveryDirectives&&!e.deliveryDirectives))return void(l.url===e.url?o.log("[playlist-loader]: ignore "+e.url+" ongoing request"):o.log("[playlist-loader]: ignore "+e.url+" in favor of "+l.url));o.log("[playlist-loader]: aborting previous loader for type: "+e.type),s.abort()}if(r=e.type===V.MANIFEST?a.manifestLoadPolicy.default:u({},a.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),s=this.createInternalLoader(e),F(null==(t=e.deliveryDirectives)?void 0:t.part)&&(e.type===V.LEVEL&&null!==e.level?i=this.hls.levels[e.level].details:e.type===V.AUDIO_TRACK&&null!==e.id?i=this.hls.audioTracks[e.id].details:e.type===V.SUBTITLE_TRACK&&null!==e.id&&(i=this.hls.subtitleTracks[e.id].details),i)){var d=i.partTarget,c=i.targetduration;if(d&&c){var h=1e3*Math.max(3*d,.8*c);r=u({},r,{maxTimeToFirstByteMs:Math.min(h,r.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(h,r.maxTimeToFirstByteMs)})}}var f=r.errorRetry||r.timeoutRetry||{},g={loadPolicy:r,timeout:r.maxLoadTimeMs,maxRetry:f.maxNumRetry||0,retryDelay:f.retryDelayMs||0,maxRetryDelay:f.maxRetryDelayMs||0},v={onSuccess:function(e,t,r,i){var a=n.getInternalLoader(r);n.resetInternalLoader(r.type);var s=e.data;t.parsing.start=performance.now(),Wi.isMediaPlaylist(s)||r.type!==V.MANIFEST?n.handleTrackOrLevelPlaylist(e,t,r,i||null,a):n.handleMasterPlaylist(e,t,r,i
vendor: 4,155 bytes, line 2
2)},onError:function(e,t,r,i){n.handleNetworkError(t,r,!1,e,i)},onTimeout:function(e,t,r){n.handleNetworkError(t,r,!0,void 0,e)}};s.load(e,g,v)},t.checkAutostartLoad=function(){if(this.hls){var e=this.hls,t=e.config,r=t.autoStartLoad,i=t.startPosition,n=e.forceStartLoad;(r||n)&&(this.hls.logger.log((r?"auto":"force")+" startLoad with configured startPosition "+i),this.hls.startLoad(i))}},t.handleMasterPlaylist=function(e,t,r,i){var n=this,a=this.hls,s=e.data,o=$d(e,r),l=Wi.parseMasterPlaylist(s,o);if(l.playlistParsingError)return t.parsing.end=performance.now(),void this.handleManifestParsingError(e,r,l.playlistParsingError,i,t);var u=l.contentSteering,d=l.levels,c=l.iframeVariants,h=l.sessionData,f=l.sessionKeys,g=l.startTimeOffset,v=l.variableList;this.variableList=v,d.forEach((function(e){var t=e.unknownCodecs;if(t)for(var r=n.hls.config.preferManagedMediaSource,i=e.audioCodec,a=e.videoCodec,s=t.length;s--;){var o=t[s];Ct(o,"audio",r)?(e.audioCodec=i=i?i+","+o:o,Rt.audio[i.substring(0,4)]=2,t.splice(s,1)):Ct(o,"video",r)&&(e.videoCodec=a=a?a+","+o:o,Rt.video[a.substring(0,4)]=2,t.splice(s,1))}}));var p=Wi.parseMasterPlaylistMedia(s,o,l),m=p.AUDIO,y=void 0===m?[]:m,E=p.SUBTITLES,b=p["CLOSED-CAPTIONS"];y.length&&(y.some((function(e){return!e.url}))||!d[0].audioCodec||d[0].attrs.AUDIO||(this.hls.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),y.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new vi({}),bitrate:0,url:""}))),a.trigger(G.MANIFEST_LOADED,{levels:d,audioTracks:y,subtitles:E,iframeVariants:c,captions:b,contentSteering:u,url:o,stats:t,networkDetails:i,sessionData:h,sessionKeys:f,startTimeOffset:g,variableList:v})},t.handleTrackOrLevelPlaylist=function(e,t,r,i,n){var a=this.hls,s=r.id,o=r.level,l=r.type,u=$d(e,r),d=F(o)?o:F(s)?s:0,c=Bd(r),h=Wi.parseLevelPlaylist(e.data,u,d,c,0,this.variableList);if(l===V.MANIFEST){var f={attrs:new vi({}),bitrate:0,details:h,name:"",url:u};h.requestScheduled=t.loading.start+hn(h,0),a.trigger(G.MANIFEST_LOADED,{levels:[f],audioTracks:[],iframeVariants:[],url:u,stats:t,networkDetails:i,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),r.levelDetails=h,this.handlePlaylistLoaded(h,e,t,r,i,n)},t.handleManifestParsingError=function(e,t,r,i,n){this.hls.trigger(G.ERROR,{type:B.NETWORK_ERROR,details:$.MANIFEST_PARSING_ERROR,fatal:t.type===V.MANIFEST,url:e.url,err:r,error:r,reason:r.message,response:e,context:t,networkDetails:i,stats:n})},t.handleNetworkError=function(e,t,r,i,n){void 0===r&&(r=!1);var a="A network "+(r?"timeout":"error"+(i?" (status "+i.code+")":""))+" occurred while loading "+e.type;e.type===V.LEVEL?a+=": "+e.level+" id: "+e.id:e.type!==V.AUDIO_TRACK&&e.type!==V.SUBTITLE_TRACK||(a+=" id: "+e.id+' group-id: "'+e.groupId+'"');var s=new Error(a);this.hls.logger.warn("[playlist-loader]: "+a);var o=$.UNKNOWN,l=!1,u=this.getInternalLoader(e);switch(e.type){case V.MANIFEST:o=r?$.MANIFEST_LOAD_TIMEOUT:$.MANIFEST_LOAD_ERROR,l=!0;break;case V.LEVEL:o=r?$.LEVEL_LOAD_TIMEOUT:$.LEVEL_LOAD_ERROR,l=!1;break;case V.AUDIO_TRACK:o=r?$.AUDIO_TRACK_LOAD_TIMEOUT:$.AUDIO_TRACK_LOAD_ERROR,l=!1;break;case V.SUBTITLE_TRACK:o=r?$.SUBTITLE_TRACK_LOAD_TIMEOUT:$.SUBTITLE_LOAD_ERROR,l=!1}u&&this.resetInternalLoader(e.type);var d={type:B.NETWORK_ERROR,details:o,fatal:l,url:e.url,loader:u,context:e,error:s,networkDetails:t,stats:n};if(i){var c=e.url;t&&"url"in t&&(c=t.url),d.response=g({url:c,data:void 0},i)}this.hls.trigger(G.ERROR,d)},t.handlePlaylistLoaded=function(e,t,r,i,n,a){var s=this.hls,o=i.type,l=i.level,u=i.levelOrTrack,d=i.id,c=i.groupId,h=i.deliveryDirectives,f=$d(t,i),g=Bd(i),v="number"==typeof i.level&&g===K.MAIN?l:void 0;u&&"iframes"in u&&u.iframes&&!e.iframesOnly&&(e.playlistParsingError=new Error("EXT-X-I-FRAME-STREAM-INF media playlist MUST contain an EXT-X-I-FRAMES-ONLY tag"),e.iframesOnly=!0);var p=e.playlistParsingError;if(p){if(this.hls.logger.warn(p+" "+e.url),!s.config.ignorePlaylistParsingErrors)return void s.trigger(G.ERROR,{type:B.NETWORK_E
vendor: 5,584 bytes, line 2
2RROR,details:$.LEVEL_PARSING_ERROR,fatal:!1,url:f,error:p,reason:p.message,response:t,context:i,level:v,parent:g,networkDetails:n,stats:r});e.playlistParsingError=null}if(e.fragments.length)switch(e.live&&a&&(a.getCacheAge&&(e.ageHeader=a.getCacheAge()||0),a.getCacheAge&&!isNaN(e.ageHeader)||(e.ageHeader=0)),o){case V.MANIFEST:case V.LEVEL:if(v)if(u){if(u!==s.levels[v]){var m=s.levels.indexOf(u);m>-1&&(v=m)}}else v=0;s.trigger(G.LEVEL_LOADED,{details:e,levelInfo:u||s.levels[0],level:v||0,id:d||0,stats:r,networkDetails:n,deliveryDirectives:h,withoutMultiVariant:o===V.MANIFEST,context:i});break;case V.AUDIO_TRACK:s.trigger(G.AUDIO_TRACK_LOADED,{details:e,track:u,id:d||0,groupId:c||"",stats:r,networkDetails:n,deliveryDirectives:h,context:i});break;case V.SUBTITLE_TRACK:s.trigger(G.SUBTITLE_TRACK_LOADED,{details:e,track:u,id:d||0,groupId:c||"",stats:r,networkDetails:n,deliveryDirectives:h,context:i})}else{var y=e.playlistParsingError=new Error("No Segments found in Playlist");s.trigger(G.ERROR,{type:B.NETWORK_ERROR,details:$.LEVEL_EMPTY_ERROR,fatal:!1,url:f,error:y,reason:y.message,response:t,context:i,level:v,parent:g,networkDetails:n,stats:r})}},e}(),Hd=function(){function e(t){void 0===t&&(t={}),this.config=void 0,this.userConfig=void 0,this.logger=void 0,this._url=null,this.streamController=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new x,this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.audioStreamController=void 0,this.subtititleStreamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.interstitialsController=void 0,this.iframeController=void 0,this.gapController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this._sessionId=void 0,this.triggeringException=void 0,this.started=!1;var r=this.logger=pe(t.debug||!1,"Hls instance",t.loggerId||t.assetPlayerId),i=this.config=Dd(e.DefaultConfig,t,r);this.userConfig=t,i.progressive&&Pd(i,r);var n=i.streamController,a=i.abrController,s=i.bufferController,o=i.capLevelController,l=i.errorController,u=i.fpsController,d=i.id3TrackController,c=i.iframeController,h=i.gapController,f=new l(this),g=this.abrController=new a(this),v=new Hr(this),p=i.interstitialsController,m=p?this.interstitialsController=new p(this,e):null,y=s?this.bufferController=new s(this,v):null,E=o?this.capLevelController=new o(this):null,b=u?new u(this):null,T=i.cmcdController,S=T?this.cmcdController=new T(this):null,w=new Gd(this),A=i.contentSteeringController,L=A?new A(this):null,I=this.levelController=new _d(this,L),k=d?new d(this):void 0,R=new Nd(this.config,this.logger),D=this.streamController=new n(this,v,R),C=this.gapController=h?new h(this,v):void 0;E&&E.setStreamController(D);var P=[w,I,D];m&&P.splice(1,0,m),L&&P.splice(1,0,L),this.networkControllers=P;var _=[g];y&&_.push(y),C&&_.push(C),E&&_.push(E),b&&(b.setStreamController(D),_.push(b)),k&&_.push(k),_.push(v),this.audioTrackController=this.createController(i.audioTrackController,P);var O=i.audioStreamController;O&&P.push(this.audioStreamController=new O(this,v,R)),this.subtitleTrackController=this.createController(i.subtitleTrackController,P);var M=i.subtitleStreamController;M&&P.push(this.subtititleStreamController=new M(this,v,R)),this.createController(i.timelineController,_),R.emeController=this.emeController=this.createController(i.emeController,_),S&&_.push(S),this.latencyController=this.createController(i.latencyController,_),this.coreComponents=_,this.iframeController=c?new c(this,e):void 0,P.push(f);var F=f.onErrorOut;"function"==typeof F&&this.on(G.ERROR,F,f),this.on(G.MANIFEST_LOADED,w.onManifestLoaded,w)}e.isMSESupported=function(){return Wl()},e.isSupported=function(){return function(){if(!Wl())return!1;var e=ye();return"function"==typeof(null==e?void 0:e.isTypeSupported)&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some((function(t){return e.isTypeSupported(_t(t,"video"))}))||["mp4a.40.2","fLaC"].some((function(t){return e.isTypeSupported(_t(t,"audio"))})))}()},e.getMediaSource=function(){return ye()};var t=e.prototype;return t.createController=function(e,t){if(e){var r=new e(this);return t&&t.push(r),r}return null},t.on=function(e,t,r){void 0===r&&(r=this),this._emitter.on(e,t,r)},t.once=function(e,t,r){void 0===r&&(r=this),this._emitter.once(e,t,r)},t.removeAllListeners=function(e){this._emitter.removeAllListeners(e)},t.off=function(e,t,r,i){void 0===r&&(r=this),this._emitter.off(e,t,r,i)},t.listeners=function(e){return this._emitter.listeners(e)},t.emit=function(e,t,r){return this._emitter.emit(e,t,r)},t.trigger=function(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(t){if(this.logger.error("An internal error happened while handling event "+e+'. Error message: "'+t.message+'". Here is a stacktrace:',t),!this.triggeringException){this.triggeringException=!0;var r=e===G.ERROR;this.trigger(G.ERROR,{type:B.OTHER_ERROR,details:$.INTERNAL_EXCEPTION,fatal:r,event:e,error:t}),this.triggeringException=!1}}return!1},t.listenerCount=function(e){return this._emitter.listenerCount(e)},t.destroy=function(){this.logger.log("destroy"),this.trigger(G.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this._url=null,this.networkControllers.forEach((function(e){return e.destroy()})),this.networkControllers.length=0,this.coreComponents.forEach((function(e){return e.destroy()}
vendor: 8,822 bytes, line 2
2)),this.coreComponents.length=0,this.iframeController=void 0;var e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null},t.attachMedia=function(e){if(!e||"media"in e&&!e.media){var t=new Error("attachMedia failed: invalid argument ("+e+")");this.trigger(G.ERROR,{type:B.OTHER_ERROR,details:$.ATTACH_MEDIA_ERROR,fatal:!0,error:t})}else{this.logger.log("attachMedia"),this._media&&(this.logger.warn("media must be detached before attaching"),this.detachMedia());var r="media"in e,i=r?e.media:e,n=r?e:{media:i};this._media=i,this.trigger(G.MEDIA_ATTACHING,n)}},t.detachMedia=function(){this.logger.log("detachMedia");var e={};this.trigger(G.MEDIA_DETACHING,e),this._media=null,this.trigger(G.MEDIA_DETACHED,e)},t.transferMedia=function(){var e;this._media=null;var t=(null==(e=this.bufferController)?void 0:e.transferMedia())||null,r={transferMedia:t};return this.trigger(G.MEDIA_DETACHING,r),this.trigger(G.MEDIA_DETACHED,r),t},t.loadSource=function(e){var t;this.stopLoad();var r=this.media,i=this._url,n=this._url=M.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.logger.log("loadSource:"+n),r&&i&&(i!==n||null!=(t=this.bufferController)&&t.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(r)),this.trigger(G.MANIFEST_LOADING,{url:e})},t.startLoad=function(e,t){void 0===e&&(e=-1),this.logger.log("startLoad("+e+(t?", <skip seek to start>":"")+")"),this.started=!0,this.resumeBuffering();for(var r=0;r<this.networkControllers.length&&(this.networkControllers[r].startLoad(e,t),this.started&&this.networkControllers);r++);},t.stopLoad=function(){this.logger.log("stopLoad"),this.started=!1;for(var e=0;e<this.networkControllers.length&&(this.networkControllers[e].stopLoad(),!this.started&&this.networkControllers);e++);},t.resumeBuffering=function(){this.bufferingEnabled||(this.logger.log("resume buffering"),this.networkControllers.forEach((function(e){e.resumeBuffering&&e.resumeBuffering()})))},t.pauseBuffering=function(){this.bufferingEnabled&&(this.logger.log("pause buffering"),this.networkControllers.forEach((function(e){e.pauseBuffering&&e.pauseBuffering()})))},t.swapAudioCodec=function(){this.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},t.recoverMediaError=function(){this.logger.log("recoverMediaError");var e=this._media,t=this.started,r=null==e?void 0:e.currentTime;this.detachMedia(),e&&(this.attachMedia(e),t&&(r?this.startLoad(r):this.config.autoStartLoad||this.startLoad()))},t.removeLevel=function(e){this.levelController.removeLevel(e)},t.setAudioOption=function(e){var t;return(null==(t=this.audioTrackController)?void 0:t.setAudioOption(e))||null},t.setSubtitleOption=function(e){var t;return(null==(t=this.subtitleTrackController)?void 0:t.setSubtitleOption(e))||null},t.createIFramePlayer=function(e){return this._url&&this.iframeController?this.iframeController.createIFramePlayer(e):null},t.createImageIFramePlayer=function(e){return this._url&&this.iframeController?this.iframeController.createImageIFramePlayer(e):null},t.getMediaDecodingInfo=function(e,t){return void 0===t&&(t=this.allAudioTracks),qt(e,lr(t),navigator.mediaCapabilities)},i(e,[{key:"url",get:function(){return this._url}},{key:"hasEnoughToStart",get:function(){return this.streamController.hasEnoughToStart}},{key:"startPosition",get:function(){return this.streamController.startPositionValue}},{key:"loadingEnabled",get:function(){return this.started&&this.streamController.state!==In.STOPPED}},{key:"bufferingEnabled",get:function(){return this.streamController.bufferingEnabled}},{key:"inFlightFragments",get:function(){var e,t=((e={})[K.MAIN]=this.streamController.inFlightFrag,e);return this.audioStreamController&&(t[K.AUDIO]=this.audioStreamController.inFlightFrag),this.subtititleStreamController&&(t[K.SUBTITLE]=this.subtititleStreamController.inFlightFrag),t}},{key:"sessionId",get:function(){var e=this._sessionId;return e||(e=this._sessionId=k()),e}},{key:"levels",get:function(){var e=this.levelController.levels;return e||[]}},{key:"latestLevelDetails",get:function(){return this.streamController.getLevelDetails()||null}},{key:"loadLevelObj",get:function(){return this.levelController.loadLevelObj}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(e){this.logger.log("set currentLevel:"+e),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(e){this.logger.log("set nextLevel:"+e),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(e){this.logger.log("set loadLevel:"+e),this.levelController.manualLevel=e}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(e){this.levelController.nextLoadLevel=e}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(e){this.logger.log("set firstLevel:"+e),this.levelController.firstLevel=e}},{key:"startLevel",get:function(){var e=this.levelController.startLevel;return-1===e&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e},set:function(e){this.logger.log("set startLevel:"+e),-1!==e&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(e){var t=this.capLevelController,r=!!e;t&&r!==this.config.capLevelToPlayerSize&&(r?t.startCapping():(t.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=r)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(e){this._autoLevelCapping!==e&&(this.logger.log("set autoLevelCapping:"+e),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}},{key:"bandwidthEstimate",get:function(){var e=this.abrController.bwEstimator;return e?e.getEstimate():NaN},set:function(e){this.abrController.resetEstimator(e)}},{key:"abrEwmaDefaultEstimate",get:function(){var e=this.abrController.bwEstimator;return e?e.defaultEstimate:NaN}},{key:"ttfbEstimate",get:function(){var e=this.abrController.bwEstimator;return e?e.getEstimateTTFB():NaN}},{key:"maxHdcpLevel",get:function(){return this._maxHdcpLevel},set:function(e){(function(e){return Qt.indexOf(e)>-1})(e)&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}},{key:"autoLevelEnabled",get:function(){return-1===this.levelController.manualLevel}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var e=this.levels,t=this.config.minAutoBitrate;if(!e)return 0;for(var r=e.length,i=0;i<r;i++)if(e[i].maxBitrate>=t)return i;return 0}},{key:"maxAutoLevel",get:function(){var e,t=this.levels,r=this.autoLevelCapping,i=this.maxHdcpLevel;if(e=-1===r&&null!=t&&t.length?t.length-1:r,i)for(var n=e;n--;){var a=t[n].attrs["HDCP-LEVEL"];if(a&&a<=i)return n}return e}},{key:"firstAutoLevel",get:function(){return this.abrController.firstAutoLevel}},{key:"nextAutoLevel",get:function(){return this.abrController.nextAutoLevel},set:function(e){this.abrController.nextAutoLevel=e}},{key:"playingDate",get:function(){return this.streamController.currentProgramDateTime}},{key:"mainForwardBufferInfo",get:function(){return this.streamController.getMainFwdBufferInfo()}},{key:"audioForwardBufferInfo",get:function(){var e;return(null==(e=this.audioStreamController)?void 0:e.getFwdBufferInfo())||null}},{key:"maxBufferLength",get:function(){return this.streamController.maxBufferLength}},{key:"allAudioTracks",get:function(){var e=this.audioTrackController;return e?e.allAudioTracks:[]}},{key:"audioTracks",get:function(){var e=this.audioTrackController;return e?e.audioTracks:[]}},{key:"audioTrack",get:function(){var e=this.audioTrackController;return e?e.audioTrack:-1},set:function(e){var t=this.audioTrackController;t&&(t.audioTrack=e)}},{key:"nextAudioTrack",get:function(){var e,t;return null!=(e=null==(t=this.audioStreamController)?void 0:t.nextAudioTrack)?e:-1},set:function(e){var t=this.audioTrackController;t&&(t.nextAudioTrack=e)}},{key:"allSubtitleTracks",get:function(){var e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}},{key:"subtitleTracks",get:function(){var e=this.subtitleTrackController;return e?e.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var e=this.subtitleTrackController;return e?e.subtitleTrack:-1},set:function(e){var t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var e=this.subtitleTrackController;return!!e&&e.subtitleDisplay}
2,set:function(e){var t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(e){this.config.lowLatencyMode=e}},{key:"liveSyncPosition",get:function(){var e,t;return null!=(e=null==(t=this.latencyController)?void 0:t.liveSyncPosition)?e:null}},{key:"latency",get:function(){var e;return(null==(e=this.latencyController)?void 0:e.latency)||0}},{key:"maxLatency",get:function(){var e;return(null==(e=this.latencyController)?void 0:e.maxLatency)||0}},{key:"targetLatency",get:function(){var e;return(null==(e=this.latencyController)?void 0:e.targetLatency)||null},set:function(e){this.latencyController&&(this.latencyController.targetLatency=e)}},{key:"drift",get:function(){var e;return(null==(e=this.latencyController)?void 0:e.drift)||null}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}},{key:"pathways",get:function(){return this.levelController.pathways}},{key:"pathwayPriority",get:function(){return this.levelController.pathwayPriority},set:function(e){this.levelController.pathwayPriority=e}},{key:"bufferedToEnd",get:function(){var e;return!(null==(e=this.bufferController)||!e.bufferedToEnd)}},{key:"interstitialsManager",get:function(){return this.interstitialsController?this.interstitialsController.interstitialsManager:null}},{key:"iframeVariants",get:function(){var e=this.levelController.iframeVariants;return e||[]}}],[{key:"version",get:function(){return is}},{key:"Events",get:function(){return G}},{key:"MetadataSchema",get:function(){return Bn}},{key:"ErrorTypes",get:function(){return B}},{key:"ErrorDetails",get:function(){return $}},{key:"DefaultConfig",get:function(){return e.defaultConfig?e.defaultConfig:Rd},set:function(t){e.defaultConfig=t}}])}();return Hd.defaultConfig=void 0,Hd},"object"===a(t)?e.exports=l():void 0===(n="function"==typeof(i=l)?i.call(t,r,t,e):i)||(e.exports=n)}(!1)},2422:(e,t,r)=>{var i=r(9821).Symbol;e.exports=i},8518:(e,t,r)=>{var i=r(2422),n=r(3735),a=r(9400),s=i?i.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":s&&s in Object(e)?n(e):a(e)}},1336:(e,t,r)=>{var i=r(5781),n=/^\s+/;e.exports=function(e){return e?e.slice(0,i(e)+1).replace(n,""):e}},147:(e,t,r)=>{function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}var n="object"==(void 0===r.g?"undefined":i(r.g))&&r.g&&r.g.Object===Object&&r.g;e.exports=n},3735:(e,t,r)=>{var i=r(2422),n=Object.prototype,a=n.hasOwnProperty,s=n.toString,o=i?i.toStringTag:void 0;e.exports=function(e){var t=a.call(e,o),r=e[o];try{e[o]=void 0;var i=!0}catch(e){}var n=s.call(e);return i&&(t?e[o]=r:delete e[o]),n}},9400:e=>{var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},9821:(e,t,r)=>{function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}var n=r(147),a="object"==("undefined"==typeof self?"undefined":i(self))&&self&&self.Object===Object&&self,s=n||a||Function("return this")();e.exports=s},5781:e=>{var t=/\s/;e.exports=function(e){for(var r=e.length;r--&&t.test(e.charAt(r)););return r}},7174:(e,t,r)=>{var i=r(2306),n=r(6266),a=r(9993),s=Math.max,o=Math.min;e.exports=function(e,t,r){var l,u,d,c,h,f,g=0,v=!1,p=!1,m=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function y(t){var r=l,i=u;return l=u=void 0,g=t,c=e.apply(i,r)}function E(e){var r=e-f;return void 0===f||r>=t||r<0||p&&e-g>=d}function b(){var e=n();if(E(e))return T(e);h=setTimeout(b,function(e){var r=t-(e-f);return p?o(r,d-(e-g)):r}(e))}function T(e){return h=void 0,m&&l?y(e):(l=u=void 0,c)}function S(){var e=n(),r=E(e);if(l=arguments,u=this,f=e,r){if(void 0===h)return function(e){return g=e,h=setTimeout(b,t),v?y(e):c}(f);if(p)return clearTimeout(h),h=setTimeout(b,t),y(f)}return void 0===h&&(h=setTimeout(b,t)),c}return t=a(t)||0,i(r)&&(v=!!r.leading,d=(p="maxWait"in r)?s(a(r.maxWait)||0,t):d,m="trailing"in r?!!r.trailing:m),S.cancel=function(){void 0!==h&&clearTimeout(h),g=0,l=f=u=h=void 0},S.flush=function(){return void 0===h?c:T(n())},S}},2306:e=>{function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(e)}e.exports=function(e){var r=t(e);return null!=e&&("object"==r||"function"==r)}},1269:e=>{function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(e)}e.exports=function(e){return null!=e&&"object"==t(e)}},3159:(e,t,r)=>{function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}var n=r(8518),a=r(1269);e.exports=function(e){return"symbol"==i(e)||a(e)&&"[object Symbol]"==n(e)}},6266:(e,t,r)=>{var i=r(9821);e.exports=function(){return i.Date.now()}},9993:(e,t,r)=>{var i=r(1336),n=r(2306),a=r(3159),s=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,l=/^0o[0-7]+$/i,u=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(a(e))return NaN;if(n(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=n(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=i(e);var r=o.test(e);return r||l.test(e)?u(e.slice(2),r?2:8):s.test(e)?NaN:+e}},6722:e=>{"use strict";e.exports=function(e,t){var r='<div class="alert alert-danger alert-dismissible fade show" role="alert"><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>'+t+"</div>";$(e).append(r)}},2343:e=>{"use strict";function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(e)}e.exports=function(e){"function"==typeof e?e():"object"===t(e)&&Object.keys(e).forEach((function(t){"function"==typeof e[t]&&e[t]()}))}}},t={};function r(i){var n=t[i];if(void 0!==n)return n.exports;var a=t[i]={id:i,loaded:!1,exports:{}};return e[i](a,a.exports,r),a.loaded=!0,a.exports}r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}
2}(),r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{"use strict";var e=r(2343);$(document).ready((function(){e(r(6417)),e(r(3863)),e(r(6036)),e(r(5750)),e(r(4951)),e(r(6572)),e(r(9530)),e(r(7094)),e(r(3437)),e(r(5868)),e(r(1542)),e(r(1965)),e(r(1577)),e(r(4191))}))})()})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.