@elicecontents/content-ui 1.1.2 → 1.1.3-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AIAvatar-NYAGMJJ3.png +0 -0
- package/dist/index.cjs +12803 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.js +12748 -0
- package/dist/index.js.map +1 -0
- package/dist/types/breakpoints/breakpoints.d.ts +1 -1
- package/dist/types/components/AI-feedback/AIFeedback.d.ts +2 -2
- package/dist/types/components/AIDTTypography/AIDTTypography.d.ts +15 -4
- package/dist/types/components/Modal/Modal.d.ts +1 -1
- package/dist/types/components/badge/Badge.d.ts +1 -1
- package/dist/types/components/base-input/BaseInput.d.ts +1 -1
- package/dist/types/components/button/Button.d.ts +2 -2
- package/dist/types/components/chat/Chat.d.ts +14 -4
- package/dist/types/components/chat/TypingIndicator.d.ts +1 -1
- package/dist/types/components/dialog/Dialog.d.ts +2 -2
- package/dist/types/components/dotted-pagination/DottedPagination.d.ts +1 -0
- package/dist/types/components/fluid/EliceBox.d.ts +3 -0
- package/dist/types/components/fluid/EliceFluidLayout.d.ts +46 -0
- package/dist/types/components/fluid/EliceStack.d.ts +3 -0
- package/dist/types/components/fluid/EliceTypography.d.ts +2 -0
- package/dist/types/components/fluid/constants.d.ts +9 -0
- package/dist/types/components/fluid/index.d.ts +7 -0
- package/dist/types/components/fluid/types.d.ts +15 -0
- package/dist/types/components/header-title/HeaderTitle.d.ts +1 -1
- package/dist/types/components/html-viewer/HtmlViewer.d.ts +9 -0
- package/dist/types/components/html-viewer/HtmlViewerContent.d.ts +6 -0
- package/dist/types/components/html-viewer/HtmlViewerContext.d.ts +13 -0
- package/dist/types/components/html-viewer/HtmlViewerHighlightLayer.d.ts +8 -0
- package/dist/types/components/html-viewer/HtmlViewerMemoMenu.d.ts +8 -0
- package/dist/types/components/html-viewer/HtmlViewerToolbar.d.ts +1 -0
- package/dist/types/components/html-viewer/HtmlViewerTypes.d.ts +106 -0
- package/dist/types/components/html-viewer/hooks/useAnchorResolver.d.ts +13 -0
- package/dist/types/components/html-viewer/hooks/useAnnotationStorage.d.ts +9 -0
- package/dist/types/components/html-viewer/hooks/useGestureStateMachine.d.ts +16 -0
- package/dist/types/components/html-viewer/hooks/useHighlightRects.d.ts +2 -0
- package/dist/types/components/html-viewer/hooks/useIntersectionVisibility.d.ts +8 -0
- package/dist/types/components/html-viewer/index.d.ts +2 -0
- package/dist/types/components/icon-button/IconButton.d.ts +2 -2
- package/dist/types/components/index.d.ts +2 -0
- package/dist/types/components/layout/Footer/LayoutFooterPaging.d.ts +2 -2
- package/dist/types/components/layout/Footer/LayoutFooterSubmit.d.ts +2 -1
- package/dist/types/components/layout/Header/LayoutHeaderSubTitle.d.ts +2 -2
- package/dist/types/components/layout/Header/LayoutHeaderTitle.d.ts +2 -2
- package/dist/types/components/layout/Layout.d.ts +9 -28
- package/dist/types/components/layout/index.d.ts +10 -16
- package/dist/types/components/pagination-button/PaginationButton.d.ts +1 -1
- package/dist/types/components/recorder/Recorder.d.ts +3 -3
- package/dist/types/components/recorder-chat/RecorderChat.d.ts +1 -1
- package/dist/types/components/recorder-chat/TypingIndicator.d.ts +1 -1
- package/dist/types/components/recorder-step/RecorderContext.d.ts +2 -1
- package/dist/types/components/recorder-step/RecorderStep.d.ts +3 -3
- package/dist/types/components/selection/Selection.d.ts +2 -2
- package/dist/types/components/sound-visualizer/SoundVisualizer.d.ts +1 -1
- package/dist/types/components/subtitle-button/SubtitleButton.d.ts +2 -2
- package/dist/types/components/table/ColInfoTable.d.ts +1 -1
- package/dist/types/components/table/RowInfoTable.d.ts +1 -1
- package/dist/types/components/table/Table.d.ts +1 -1
- package/dist/types/components/textarea/Textarea.d.ts +9 -3
- package/dist/types/components/tooltip/Tooltip.d.ts +7 -3
- package/dist/types/components/video/VideoPlayer.d.ts +1 -1
- package/dist/types/components/video/VideoV2.d.ts +3 -1
- package/dist/types/components/video/VideoV3.d.ts +37 -0
- package/dist/types/components/video/index.d.ts +2 -0
- package/dist/types/hooks/useAIDTMediaQuery.d.ts +5 -1
- package/dist/types/icons/MoreColumn.d.ts +1 -1
- package/dist/types/icons/QuestionBubble.d.ts +1 -1
- package/dist/types/icons/ReadyRecord.d.ts +1 -1
- package/dist/types/icons/RecordPause.d.ts +1 -1
- package/dist/types/icons/RecordPlay.d.ts +1 -1
- package/dist/types/icons/Recording.d.ts +1 -1
- package/dist/types/icons/ScrollMoreIcon.d.ts +1 -1
- package/dist/types/icons/SearchIcon.d.ts +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/palettes/_typing.d.ts +1 -1
- package/dist/types/palettes/eliceDefault.d.ts +1 -1
- package/dist/types/palettes/type1.d.ts +1 -1
- package/dist/types/palettes/type2.d.ts +1 -1
- package/dist/types/theme/AIDTTheme.d.ts +1 -1
- package/dist/types/theme/_base.d.ts +1 -1
- package/dist/types/theme/createAIDTTheme.d.ts +2 -3
- package/dist/types/theme/createEliceThemeOverride.d.ts +5 -3
- package/dist/types/theme/transitions.d.ts +1 -1
- package/dist/types/tokens/breakpoints/breakpoints.d.ts +2 -2
- package/dist/types/tokens/colors/_typing.d.ts +1 -1
- package/dist/types/tokens/colors/bluepurple.d.ts +1 -1
- package/dist/types/tokens/colors/bluesky.d.ts +1 -1
- package/dist/types/tokens/colors/common.d.ts +1 -1
- package/dist/types/tokens/colors/gray.d.ts +1 -1
- package/dist/types/tokens/colors/green.d.ts +1 -1
- package/dist/types/tokens/colors/mint.d.ts +1 -1
- package/dist/types/tokens/colors/orange.d.ts +1 -1
- package/dist/types/tokens/colors/pink.d.ts +1 -1
- package/dist/types/tokens/colors/purple.d.ts +1 -1
- package/dist/types/tokens/colors/yellow.d.ts +1 -1
- package/dist/types/types/theme-augmentation.d.ts +14 -1
- package/dist/types/types/theme.types.d.ts +4 -2
- package/dist/types/typography/TypographyType.d.ts +798 -42
- package/dist/types/typography/index.d.ts +1 -0
- package/dist/types/typography/typography.d.ts +393 -45
- package/dist/types/typography/typographyFontFamily.d.ts +1 -0
- package/package.json +21 -17
- package/dist/cjs/index.js +0 -797
- package/dist/cjs/index.js.map +0 -1
- package/dist/es/index.js +0 -17963
- package/dist/es/index.js.map +0 -1
- package/dist/utils-B-OwYxKc.js +0 -2
- package/dist/utils-B-OwYxKc.js.map +0 -1
- package/dist/utils-C6l9edAI.mjs +0 -33
- package/dist/utils-C6l9edAI.mjs.map +0 -1
- package/dist/video-BVmBZcCY.mjs +0 -29748
- package/dist/video-BVmBZcCY.mjs.map +0 -1
- package/dist/video-De6bH9lK.js +0 -213
- package/dist/video-De6bH9lK.js.map +0 -1
- package/dist/video-utils-CSAdDJJN.js +0 -9
- package/dist/video-utils-CSAdDJJN.js.map +0 -1
- package/dist/video-utils-DfKS4cGg.mjs +0 -5735
- package/dist/video-utils-DfKS4cGg.mjs.map +0 -1
package/dist/video-De6bH9lK.js
DELETED
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
"use strict";const Pt=require("./video-utils-CSAdDJJN.js");function ve(){return ve=Object.assign?Object.assign.bind():function(s){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)({}).hasOwnProperty.call(t,i)&&(s[i]=t[i])}return s},ve.apply(null,arguments)}var rn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ci(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function Xl(s){if(s.__esModule)return s;var e=s.default;if(typeof e=="function"){var t=function i(){return this instanceof i?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(s).forEach(function(i){var n=Object.getOwnPropertyDescriptor(s,i);Object.defineProperty(t,i,n.get?n:{enumerable:!0,get:function(){return s[i]}})}),t}var pr={exports:{}},Ho;function Yl(){return Ho||(Ho=1,function(s){function e(){return s.exports=e=Object.assign?Object.assign.bind():function(t){for(var i=1;i<arguments.length;i++){var n=arguments[i];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},s.exports.__esModule=!0,s.exports.default=s.exports,e.apply(null,arguments)}s.exports=e,s.exports.__esModule=!0,s.exports.default=s.exports}(pr)),pr.exports}var Zi;typeof window<"u"?Zi=window:typeof rn<"u"?Zi=rn:typeof self<"u"?Zi=self:Zi={};var kn=Zi;const x=Ci(kn),sp={},np=Object.freeze(Object.defineProperty({__proto__:null,default:sp},Symbol.toStringTag,{value:"Module"})),rp=Xl(np);var Vo=typeof rn<"u"?rn:typeof window<"u"?window:{},ap=rp,es;typeof document<"u"?es=document:(es=Vo["__GLOBAL_DOCUMENT_CACHE@4"],es||(es=Vo["__GLOBAL_DOCUMENT_CACHE@4"]=ap));var Jl=es;const N=Ci(Jl);var aa={exports:{}},op=up,lp=Object.prototype.toString;function up(s){if(!s)return!1;var e=lp.call(s);return e==="[object Function]"||typeof s=="function"&&e!=="[object RegExp]"||typeof window<"u"&&(s===window.setTimeout||s===window.alert||s===window.confirm||s===window.prompt)}function hp(s,e){var t=typeof Symbol<"u"&&s[Symbol.iterator]||s["@@iterator"];if(t)return(t=t.call(s)).next.bind(t);if(Array.isArray(s)||(t=dp(s))||e){t&&(s=t);var i=0;return function(){return i>=s.length?{done:!0}:{done:!1,value:s[i++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
2
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function dp(s,e){if(s){if(typeof s=="string")return qo(s,e);var t=Object.prototype.toString.call(s).slice(8,-1);if(t==="Object"&&s.constructor&&(t=s.constructor.name),t==="Map"||t==="Set")return Array.from(s);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return qo(s,e)}}function qo(s,e){(e==null||e>s.length)&&(e=s.length);for(var t=0,i=new Array(e);t<e;t++)i[t]=s[t];return i}var cp=function(){function s(){this.typeToInterceptorsMap_=new Map,this.enabled_=!1}var e=s.prototype;return e.getIsEnabled=function(){return this.enabled_},e.enable=function(){this.enabled_=!0},e.disable=function(){this.enabled_=!1},e.reset=function(){this.typeToInterceptorsMap_=new Map,this.enabled_=!1},e.addInterceptor=function(i,n){this.typeToInterceptorsMap_.has(i)||this.typeToInterceptorsMap_.set(i,new Set);var r=this.typeToInterceptorsMap_.get(i);return r.has(n)?!1:(r.add(n),!0)},e.removeInterceptor=function(i,n){var r=this.typeToInterceptorsMap_.get(i);return r&&r.has(n)?(r.delete(n),!0):!1},e.clearInterceptorsByType=function(i){var n=this.typeToInterceptorsMap_.get(i);return n?(this.typeToInterceptorsMap_.delete(i),this.typeToInterceptorsMap_.set(i,new Set),!0):!1},e.clear=function(){return this.typeToInterceptorsMap_.size?(this.typeToInterceptorsMap_=new Map,!0):!1},e.getForType=function(i){return this.typeToInterceptorsMap_.get(i)||new Set},e.execute=function(i,n){for(var r=this.getForType(i),a=hp(r),l;!(l=a()).done;){var c=l.value;try{n=c(n)}catch{}}return n},s}(),fp=cp,pp=function(){function s(){this.maxAttempts_=1,this.delayFactor_=.1,this.fuzzFactor_=.1,this.initialDelay_=1e3,this.enabled_=!1}var e=s.prototype;return e.getIsEnabled=function(){return this.enabled_},e.enable=function(){this.enabled_=!0},e.disable=function(){this.enabled_=!1},e.reset=function(){this.maxAttempts_=1,this.delayFactor_=.1,this.fuzzFactor_=.1,this.initialDelay_=1e3,this.enabled_=!1},e.getMaxAttempts=function(){return this.maxAttempts_},e.setMaxAttempts=function(i){this.maxAttempts_=i},e.getDelayFactor=function(){return this.delayFactor_},e.setDelayFactor=function(i){this.delayFactor_=i},e.getFuzzFactor=function(){return this.fuzzFactor_},e.setFuzzFactor=function(i){this.fuzzFactor_=i},e.getInitialDelay=function(){return this.initialDelay_},e.setInitialDelay=function(i){this.initialDelay_=i},e.createRetry=function(i){var n=i===void 0?{}:i,r=n.maxAttempts,a=n.delayFactor,l=n.fuzzFactor,c=n.initialDelay;return new mp({maxAttempts:r||this.maxAttempts_,delayFactor:a||this.delayFactor_,fuzzFactor:l||this.fuzzFactor_,initialDelay:c||this.initialDelay_})},s}(),mp=function(){function s(t){this.maxAttempts_=t.maxAttempts,this.delayFactor_=t.delayFactor,this.fuzzFactor_=t.fuzzFactor,this.currentDelay_=t.initialDelay,this.currentAttempt_=1}var e=s.prototype;return e.moveToNextAttempt=function(){this.currentAttempt_++;var i=this.currentDelay_*this.delayFactor_;this.currentDelay_=this.currentDelay_+i},e.shouldRetry=function(){return this.currentAttempt_<this.maxAttempts_},e.getCurrentDelay=function(){return this.currentDelay_},e.getCurrentMinPossibleDelay=function(){return(1-this.fuzzFactor_)*this.currentDelay_},e.getCurrentMaxPossibleDelay=function(){return(1+this.fuzzFactor_)*this.currentDelay_},e.getCurrentFuzzedDelay=function(){var i=this.getCurrentMinPossibleDelay(),n=this.getCurrentMaxPossibleDelay();return i+Math.random()*(n-i)},s}(),gp=pp,_p=kn,yp=function(e,t){return t===void 0&&(t=!1),function(i,n,r){if(i){e(i);return}if(n.statusCode>=400&&n.statusCode<=599){var a=r;if(t)if(_p.TextDecoder){var l=Tp(n.headers&&n.headers["content-type"]);try{a=new TextDecoder(l).decode(r)}catch{}}else a=String.fromCharCode.apply(null,new Uint8Array(r));e({cause:a});return}e(null,r)}};function Tp(s){return s===void 0&&(s=""),s.toLowerCase().split(";").reduce(function(e,t){var i=t.split("="),n=i[0],r=i[1];return n.trim()==="charset"?r.trim():e},"utf-8")}var vp=yp,Zl=kn,bp=Yl(),xp=op,eu=fp,Sp=gp;ge.httpHandler=vp;ge.requestInterceptorsStorage=new eu;ge.responseInterceptorsStorage=new eu;ge.retryManager=new Sp;/**
|
|
3
|
-
* @license
|
|
4
|
-
* slighly modified parse-headers 2.0.2 <https://github.com/kesla/parse-headers/>
|
|
5
|
-
* Copyright (c) 2014 David Björklund
|
|
6
|
-
* Available under the MIT license
|
|
7
|
-
* <https://github.com/kesla/parse-headers/blob/master/LICENCE>
|
|
8
|
-
*/var Cp=function(e){var t={};return e&&e.trim().split(`
|
|
9
|
-
`).forEach(function(i){var n=i.indexOf(":"),r=i.slice(0,n).trim().toLowerCase(),a=i.slice(n+1).trim();typeof t[r]>"u"?t[r]=a:Array.isArray(t[r])?t[r].push(a):t[r]=[t[r],a]}),t};aa.exports=ge;aa.exports.default=ge;ge.XMLHttpRequest=Zl.XMLHttpRequest||Ip;ge.XDomainRequest="withCredentials"in new ge.XMLHttpRequest?ge.XMLHttpRequest:Zl.XDomainRequest;Ep(["get","put","post","patch","head","delete"],function(s){ge[s==="delete"?"del":s]=function(e,t,i){return t=tu(e,t,i),t.method=s.toUpperCase(),oa(t)}});function Ep(s,e){for(var t=0;t<s.length;t++)e(s[t])}function wp(s){for(var e in s)if(s.hasOwnProperty(e))return!1;return!0}function tu(s,e,t){var i=s;return xp(e)?(t=e,typeof s=="string"&&(i={uri:s})):i=bp({},e,{uri:s}),i.callback=t,i}function ge(s,e,t){return e=tu(s,e,t),oa(e)}function oa(s){if(typeof s.callback>"u")throw new Error("callback argument missing");if(s.requestType&&ge.requestInterceptorsStorage.getIsEnabled()){var e={uri:s.uri||s.url,headers:s.headers||{},body:s.body,metadata:s.metadata||{},retry:s.retry,timeout:s.timeout},t=ge.requestInterceptorsStorage.execute(s.requestType,e);s.uri=t.uri,s.headers=t.headers,s.body=t.body,s.metadata=t.metadata,s.retry=t.retry,s.timeout=t.timeout}var i=!1,n=function(O,j,R){i||(i=!0,s.callback(O,j,R))};function r(){p.readyState===4&&!ge.responseInterceptorsStorage.getIsEnabled()&&setTimeout(c,0)}function a(){var B=void 0;if(p.response?B=p.response:B=p.responseText||kp(p),P)try{B=JSON.parse(B)}catch{}return B}function l(B){if(clearTimeout(F),clearTimeout(s.retryTimeout),B instanceof Error||(B=new Error(""+(B||"Unknown XMLHttpRequest Error"))),B.statusCode=0,!_&&ge.retryManager.getIsEnabled()&&s.retry&&s.retry.shouldRetry()){s.retryTimeout=setTimeout(function(){s.retry.moveToNextAttempt(),s.xhr=p,oa(s)},s.retry.getCurrentFuzzedDelay());return}if(s.requestType&&ge.responseInterceptorsStorage.getIsEnabled()){var O={headers:$.headers||{},body:$.body,responseUrl:p.responseURL,responseType:p.responseType},j=ge.responseInterceptorsStorage.execute(s.requestType,O);$.body=j.body,$.headers=j.headers}return n(B,$)}function c(){if(!_){var B;clearTimeout(F),clearTimeout(s.retryTimeout),s.useXDR&&p.status===void 0?B=200:B=p.status===1223?204:p.status;var O=$,j=null;if(B!==0?(O={body:a(),statusCode:B,method:E,headers:{},url:S,rawRequest:p},p.getAllResponseHeaders&&(O.headers=Cp(p.getAllResponseHeaders()))):j=new Error("Internal XMLHttpRequest Error"),s.requestType&&ge.responseInterceptorsStorage.getIsEnabled()){var R={headers:O.headers||{},body:O.body,responseUrl:p.responseURL,responseType:p.responseType},U=ge.responseInterceptorsStorage.execute(s.requestType,R);O.body=U.body,O.headers=U.headers}return n(j,O,O.body)}}var p=s.xhr||null;p||(s.cors||s.useXDR?p=new ge.XDomainRequest:p=new ge.XMLHttpRequest);var g,_,S=p.url=s.uri||s.url,E=p.method=s.method||"GET",w=s.body||s.data,I=p.headers=s.headers||{},L=!!s.sync,P=!1,F,$={body:void 0,headers:{},statusCode:0,method:E,url:S,rawRequest:p};if("json"in s&&s.json!==!1&&(P=!0,I.accept||I.Accept||(I.Accept="application/json"),E!=="GET"&&E!=="HEAD"&&(I["content-type"]||I["Content-Type"]||(I["Content-Type"]="application/json"),w=JSON.stringify(s.json===!0?w:s.json))),p.onreadystatechange=r,p.onload=c,p.onerror=l,p.onprogress=function(){},p.onabort=function(){_=!0,clearTimeout(s.retryTimeout)},p.ontimeout=l,p.open(E,S,!L,s.username,s.password),L||(p.withCredentials=!!s.withCredentials),!L&&s.timeout>0&&(F=setTimeout(function(){if(!_){_=!0,p.abort("timeout");var B=new Error("XMLHttpRequest timeout");B.code="ETIMEDOUT",l(B)}},s.timeout)),p.setRequestHeader)for(g in I)I.hasOwnProperty(g)&&p.setRequestHeader(g,I[g]);else if(s.headers&&!wp(s.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in s&&(p.responseType=s.responseType),"beforeSend"in s&&typeof s.beforeSend=="function"&&s.beforeSend(p),p.send(w||null),p}function kp(s){try{if(s.responseType==="document")return s.responseXML;var e=s.responseXML&&s.responseXML.documentElement.nodeName==="parsererror";if(s.responseType===""&&!e)return s.responseXML}catch{}return null}function Ip(){}var Pp=aa.exports;const iu=Ci(Pp);var su={exports:{}},zo=Jl,la=Object.create||function(){function s(){}return function(e){if(arguments.length!==1)throw new Error("Object.create shim only accepts one parameter.");return s.prototype=e,new s}}();function Ue(s,e){this.name="ParsingError",this.code=s.code,this.message=e||s.message}Ue.prototype=la(Error.prototype);Ue.prototype.constructor=Ue;Ue.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}};function ua(s){function e(i,n,r,a){return(i|0)*3600+(n|0)*60+(r|0)+(a|0)/1e3}var t=s.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);return t?t[3]?e(t[1],t[2],t[3].replace(":",""),t[4]):t[1]>59?e(t[1],t[2],0,t[4]):e(0,t[1],t[2],t[4]):null}function rs(){this.values=la(null)}rs.prototype={set:function(s,e){!this.get(s)&&e!==""&&(this.values[s]=e)},get:function(s,e,t){return t?this.has(s)?this.values[s]:e[t]:this.has(s)?this.values[s]:e},has:function(s){return s in this.values},alt:function(s,e,t){for(var i=0;i<t.length;++i)if(e===t[i]){this.set(s,e);break}},integer:function(s,e){/^-?\d+$/.test(e)&&this.set(s,parseInt(e,10))},percent:function(s,e){return e.match(/^([\d]{1,3})(\.[\d]*)?%$/)&&(e=parseFloat(e),e>=0&&e<=100)?(this.set(s,e),!0):!1}};function ts(s,e,t,i){var n=i?s.split(i):[s];for(var r in n)if(typeof n[r]=="string"){var a=n[r].split(t);if(a.length===2){var l=a[0].trim(),c=a[1].trim();e(l,c)}}}function Ap(s,e,t){var i=s;function n(){var l=ua(s);if(l===null)throw new Ue(Ue.Errors.BadTimeStamp,"Malformed timestamp: "+i);return s=s.replace(/^[^\sa-zA-Z-]+/,""),l}function r(l,c){var p=new rs;ts(l,function(g,_){switch(g){case"region":for(var S=t.length-1;S>=0;S--)if(t[S].id===_){p.set(g,t[S].region);break}break;case"vertical":p.alt(g,_,["rl","lr"]);break;case"line":var E=_.split(","),w=E[0];p.integer(g,w),p.percent(g,w)&&p.set("snapToLines",!1),p.alt(g,w,["auto"]),E.length===2&&p.alt("lineAlign",E[1],["start","center","end"]);break;case"position":E=_.split(","),p.percent(g,E[0]),E.length===2&&p.alt("positionAlign",E[1],["start","center","end"]);break;case"size":p.percent(g,_);break;case"align":p.alt(g,_,["start","center","end","left","right"]);break}},/:/,/\s/),c.region=p.get("region",null),c.vertical=p.get("vertical","");try{c.line=p.get("line","auto")}catch{}c.lineAlign=p.get("lineAlign","start"),c.snapToLines=p.get("snapToLines",!0),c.size=p.get("size",100);try{c.align=p.get("align","center")}catch{c.align=p.get("align","middle")}try{c.position=p.get("position","auto")}catch{c.position=p.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},c.align)}c.positionAlign=p.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},c.align)}function a(){s=s.replace(/^\s+/,"")}if(a(),e.startTime=n(),a(),s.substr(0,3)!=="-->")throw new Ue(Ue.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '-->'): "+i);s=s.substr(3),a(),e.endTime=n(),a(),r(s,e)}var mr=zo.createElement&&zo.createElement("textarea"),Lp={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},Wo={white:"rgba(255,255,255,1)",lime:"rgba(0,255,0,1)",cyan:"rgba(0,255,255,1)",red:"rgba(255,0,0,1)",yellow:"rgba(255,255,0,1)",magenta:"rgba(255,0,255,1)",blue:"rgba(0,0,255,1)",black:"rgba(0,0,0,1)"},Dp={v:"title",lang:"lang"},Go={rt:"ruby"};function nu(s,e){function t(){if(!e)return null;function w(L){return e=e.substr(L.length),L}var I=e.match(/^([^<]*)(<[^>]*>?)?/);return w(I[1]?I[1]:I[2])}function i(w){return mr.innerHTML=w,w=mr.textContent,mr.textContent="",w}function n(w,I){return!Go[I.localName]||Go[I.localName]===w.localName}function r(w,I){var L=Lp[w];if(!L)return null;var P=s.document.createElement(L),F=Dp[w];return F&&I&&(P[F]=I.trim()),P}for(var a=s.document.createElement("div"),l=a,c,p=[];(c=t())!==null;){if(c[0]==="<"){if(c[1]==="/"){p.length&&p[p.length-1]===c.substr(2).replace(">","")&&(p.pop(),l=l.parentNode);continue}var g=ua(c.substr(1,c.length-2)),_;if(g){_=s.document.createProcessingInstruction("timestamp",g),l.appendChild(_);continue}var S=c.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!S||(_=r(S[1],S[3]),!_)||!n(l,_))continue;if(S[2]){var E=S[2].split(".");E.forEach(function(w){var I=/^bg_/.test(w),L=I?w.slice(3):w;if(Wo.hasOwnProperty(L)){var P=I?"background-color":"color",F=Wo[L];_.style[P]=F}}),_.className=E.join(" ")}p.push(S[1]),l.appendChild(_),l=_;continue}l.appendChild(s.document.createTextNode(i(c)))}return a}var Ko=[[1470,1470],[1472,1472],[1475,1475],[1478,1478],[1488,1514],[1520,1524],[1544,1544],[1547,1547],[1549,1549],[1563,1563],[1566,1610],[1645,1647],[1649,1749],[1765,1766],[1774,1775],[1786,1805],[1807,1808],[1810,1839],[1869,1957],[1969,1969],[1984,2026],[2036,2037],[2042,2042],[2048,2069],[2074,2074],[2084,2084],[2088,2088],[2096,2110],[2112,2136],[2142,2142],[2208,2208],[2210,2220],[8207,8207],[64285,64285],[64287,64296],[64298,64310],[64312,64316],[64318,64318],[64320,64321],[64323,64324],[64326,64449],[64467,64829],[64848,64911],[64914,64967],[65008,65020],[65136,65140],[65142,65276],[67584,67589],[67592,67592],[67594,67637],[67639,67640],[67644,67644],[67647,67669],[67671,67679],[67840,67867],[67872,67897],[67903,67903],[67968,68023],[68030,68031],[68096,68096],[68112,68115],[68117,68119],[68121,68147],[68160,68167],[68176,68184],[68192,68223],[68352,68405],[68416,68437],[68440,68466],[68472,68479],[68608,68680],[126464,126467],[126469,126495],[126497,126498],[126500,126500],[126503,126503],[126505,126514],[126516,126519],[126521,126521],[126523,126523],[126530,126530],[126535,126535],[126537,126537],[126539,126539],[126541,126543],[126545,126546],[126548,126548],[126551,126551],[126553,126553],[126555,126555],[126557,126557],[126559,126559],[126561,126562],[126564,126564],[126567,126570],[126572,126578],[126580,126583],[126585,126588],[126590,126590],[126592,126601],[126603,126619],[126625,126627],[126629,126633],[126635,126651],[1114109,1114109]];function Op(s){for(var e=0;e<Ko.length;e++){var t=Ko[e];if(s>=t[0]&&s<=t[1])return!0}return!1}function Mp(s){var e=[],t="",i;if(!s||!s.childNodes)return"ltr";function n(l,c){for(var p=c.childNodes.length-1;p>=0;p--)l.push(c.childNodes[p])}function r(l){if(!l||!l.length)return null;var c=l.pop(),p=c.textContent||c.innerText;if(p){var g=p.match(/^.*(\n|\r)/);return g?(l.length=0,g[0]):p}if(c.tagName==="ruby")return r(l);if(c.childNodes)return n(l,c),r(l)}for(n(e,s);t=r(e);)for(var a=0;a<t.length;a++)if(i=t.charCodeAt(a),Op(i))return"rtl";return"ltr"}function Rp(s){if(typeof s.line=="number"&&(s.snapToLines||s.line>=0&&s.line<=100))return s.line;if(!s.track||!s.track.textTrackList||!s.track.textTrackList.mediaElement)return-1;for(var e=s.track,t=e.textTrackList,i=0,n=0;n<t.length&&t[n]!==e;n++)t[n].mode==="showing"&&i++;return++i*-1}function In(){}In.prototype.applyStyles=function(s,e){e=e||this.div;for(var t in s)s.hasOwnProperty(t)&&(e.style[t]=s[t])};In.prototype.formatStyle=function(s,e){return s===0?0:s+e};function an(s,e,t){In.call(this),this.cue=e,this.cueDiv=nu(s,e.text);var i={color:"rgba(255, 255, 255, 1)",backgroundColor:"rgba(0, 0, 0, 0.8)",position:"relative",left:0,right:0,top:0,bottom:0,display:"inline",writingMode:e.vertical===""?"horizontal-tb":e.vertical==="lr"?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext"};this.applyStyles(i,this.cueDiv),this.div=s.document.createElement("div"),i={direction:Mp(this.cueDiv),writingMode:e.vertical===""?"horizontal-tb":e.vertical==="lr"?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext",textAlign:e.align==="middle"?"center":e.align,font:t.font,whiteSpace:"pre-line",position:"absolute"},this.applyStyles(i),this.div.appendChild(this.cueDiv);var n=0;switch(e.positionAlign){case"start":case"line-left":n=e.position;break;case"center":n=e.position-e.size/2;break;case"end":case"line-right":n=e.position-e.size;break}e.vertical===""?this.applyStyles({left:this.formatStyle(n,"%"),width:this.formatStyle(e.size,"%")}):this.applyStyles({top:this.formatStyle(n,"%"),height:this.formatStyle(e.size,"%")}),this.move=function(r){this.applyStyles({top:this.formatStyle(r.top,"px"),bottom:this.formatStyle(r.bottom,"px"),left:this.formatStyle(r.left,"px"),right:this.formatStyle(r.right,"px"),height:this.formatStyle(r.height,"px"),width:this.formatStyle(r.width,"px")})}}an.prototype=la(In.prototype);an.prototype.constructor=an;function Pe(s){var e,t,i,n;if(s.div){t=s.div.offsetHeight,i=s.div.offsetWidth,n=s.div.offsetTop;var r=(r=s.div.childNodes)&&(r=r[0])&&r.getClientRects&&r.getClientRects();s=s.div.getBoundingClientRect(),e=r?Math.max(r[0]&&r[0].height||0,s.height/r.length):0}this.left=s.left,this.right=s.right,this.top=s.top||n,this.height=s.height||t,this.bottom=s.bottom||n+(s.height||t),this.width=s.width||i,this.lineHeight=e!==void 0?e:s.lineHeight}Pe.prototype.move=function(s,e){switch(e=e!==void 0?e:this.lineHeight,s){case"+x":this.left+=e,this.right+=e;break;case"-x":this.left-=e,this.right-=e;break;case"+y":this.top+=e,this.bottom+=e;break;case"-y":this.top-=e,this.bottom-=e;break}};Pe.prototype.overlaps=function(s){return this.left<s.right&&this.right>s.left&&this.top<s.bottom&&this.bottom>s.top};Pe.prototype.overlapsAny=function(s){for(var e=0;e<s.length;e++)if(this.overlaps(s[e]))return!0;return!1};Pe.prototype.within=function(s){return this.top>=s.top&&this.bottom<=s.bottom&&this.left>=s.left&&this.right<=s.right};Pe.prototype.overlapsOppositeAxis=function(s,e){switch(e){case"+x":return this.left<s.left;case"-x":return this.right>s.right;case"+y":return this.top<s.top;case"-y":return this.bottom>s.bottom}};Pe.prototype.intersectPercentage=function(s){var e=Math.max(0,Math.min(this.right,s.right)-Math.max(this.left,s.left)),t=Math.max(0,Math.min(this.bottom,s.bottom)-Math.max(this.top,s.top)),i=e*t;return i/(this.height*this.width)};Pe.prototype.toCSSCompatValues=function(s){return{top:this.top-s.top,bottom:s.bottom-this.bottom,left:this.left-s.left,right:s.right-this.right,height:this.height,width:this.width}};Pe.getSimpleBoxPosition=function(s){var e=s.div?s.div.offsetHeight:s.tagName?s.offsetHeight:0,t=s.div?s.div.offsetWidth:s.tagName?s.offsetWidth:0,i=s.div?s.div.offsetTop:s.tagName?s.offsetTop:0;s=s.div?s.div.getBoundingClientRect():s.tagName?s.getBoundingClientRect():s;var n={left:s.left,right:s.right,top:s.top||i,height:s.height||e,bottom:s.bottom||i+(s.height||e),width:s.width||t};return n};function Bp(s,e,t,i){function n(L,P){for(var F,$=new Pe(L),B=1,O=0;O<P.length;O++){for(;L.overlapsOppositeAxis(t,P[O])||L.within(t)&&L.overlapsAny(i);)L.move(P[O]);if(L.within(t))return L;var j=L.intersectPercentage(t);B>j&&(F=new Pe(L),B=j),L=new Pe($)}return F||$}var r=new Pe(e),a=e.cue,l=Rp(a),c=[];if(a.snapToLines){var p;switch(a.vertical){case"":c=["+y","-y"],p="height";break;case"rl":c=["+x","-x"],p="width";break;case"lr":c=["-x","+x"],p="width";break}var g=r.lineHeight,_=g*Math.round(l),S=t[p]+g,E=c[0];Math.abs(_)>S&&(_=_<0?-1:1,_*=Math.ceil(S/g)*g),l<0&&(_+=a.vertical===""?t.height:t.width,c=c.reverse()),r.move(E,_)}else{var w=r.lineHeight/t.height*100;switch(a.lineAlign){case"center":l-=w/2;break;case"end":l-=w;break}switch(a.vertical){case"":e.applyStyles({top:e.formatStyle(l,"%")});break;case"rl":e.applyStyles({left:e.formatStyle(l,"%")});break;case"lr":e.applyStyles({right:e.formatStyle(l,"%")});break}c=["+y","-x","+x","-y"],r=new Pe(e)}var I=n(r,c);e.move(I.toCSSCompatValues(t))}function Ei(){}Ei.StringDecoder=function(){return{decode:function(s){if(!s)return"";if(typeof s!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(s))}}};Ei.convertCueToDOMTree=function(s,e){return!s||!e?null:nu(s,e)};var Fp=.05,Np="sans-serif",Up="1.5%";Ei.processCues=function(s,e,t){if(!s||!e||!t)return null;for(;t.firstChild;)t.removeChild(t.firstChild);var i=s.document.createElement("div");i.style.position="absolute",i.style.left="0",i.style.right="0",i.style.top="0",i.style.bottom="0",i.style.margin=Up,t.appendChild(i);function n(g){for(var _=0;_<g.length;_++)if(g[_].hasBeenReset||!g[_].displayState)return!0;return!1}if(!n(e)){for(var r=0;r<e.length;r++)i.appendChild(e[r].displayState);return}var a=[],l=Pe.getSimpleBoxPosition(i),c=Math.round(l.height*Fp*100)/100,p={font:c+"px "+Np};(function(){for(var g,_,S=0;S<e.length;S++)_=e[S],g=new an(s,_,p),i.appendChild(g.div),Bp(s,g,l,a),_.displayState=g.div,a.push(Pe.getSimpleBoxPosition(g))})()};Ei.Parser=function(s,e,t){t||(t=e,e={}),e||(e={}),this.window=s,this.vttjs=e,this.state="INITIAL",this.buffer="",this.decoder=t||new TextDecoder("utf8"),this.regionList=[]};Ei.Parser.prototype={reportOrThrowError:function(s){if(s instanceof Ue)this.onparsingerror&&this.onparsingerror(s);else throw s},parse:function(s){var e=this;s&&(e.buffer+=e.decoder.decode(s,{stream:!0}));function t(){for(var g=e.buffer,_=0;_<g.length&&g[_]!=="\r"&&g[_]!==`
|
|
10
|
-
`;)++_;var S=g.substr(0,_);return g[_]==="\r"&&++_,g[_]===`
|
|
11
|
-
`&&++_,e.buffer=g.substr(_),S}function i(g){var _=new rs;if(ts(g,function(E,w){switch(E){case"id":_.set(E,w);break;case"width":_.percent(E,w);break;case"lines":_.integer(E,w);break;case"regionanchor":case"viewportanchor":var I=w.split(",");if(I.length!==2)break;var L=new rs;if(L.percent("x",I[0]),L.percent("y",I[1]),!L.has("x")||!L.has("y"))break;_.set(E+"X",L.get("x")),_.set(E+"Y",L.get("y"));break;case"scroll":_.alt(E,w,["up"]);break}},/=/,/\s/),_.has("id")){var S=new(e.vttjs.VTTRegion||e.window.VTTRegion);S.width=_.get("width",100),S.lines=_.get("lines",3),S.regionAnchorX=_.get("regionanchorX",0),S.regionAnchorY=_.get("regionanchorY",100),S.viewportAnchorX=_.get("viewportanchorX",0),S.viewportAnchorY=_.get("viewportanchorY",100),S.scroll=_.get("scroll",""),e.onregion&&e.onregion(S),e.regionList.push({id:_.get("id"),region:S})}}function n(g){var _=new rs;ts(g,function(S,E){switch(S){case"MPEGT":_.integer(S+"S",E);break;case"LOCA":_.set(S+"L",ua(E));break}},/[^\d]:/,/,/),e.ontimestampmap&&e.ontimestampmap({MPEGTS:_.get("MPEGTS"),LOCAL:_.get("LOCAL")})}function r(g){g.match(/X-TIMESTAMP-MAP/)?ts(g,function(_,S){switch(_){case"X-TIMESTAMP-MAP":n(S);break}},/=/):ts(g,function(_,S){switch(_){case"Region":i(S);break}},/:/)}try{var a;if(e.state==="INITIAL"){if(!/\r\n|\n/.test(e.buffer))return this;a=t();var l=a.match(/^WEBVTT([ \t].*)?$/);if(!l||!l[0])throw new Ue(Ue.Errors.BadSignature);e.state="HEADER"}for(var c=!1;e.buffer;){if(!/\r\n|\n/.test(e.buffer))return this;switch(c?c=!1:a=t(),e.state){case"HEADER":/:/.test(a)?r(a):a||(e.state="ID");continue;case"NOTE":a||(e.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(a)){e.state="NOTE";break}if(!a)continue;e.cue=new(e.vttjs.VTTCue||e.window.VTTCue)(0,0,"");try{e.cue.align="center"}catch{e.cue.align="middle"}if(e.state="CUE",a.indexOf("-->")===-1){e.cue.id=a;continue}case"CUE":try{Ap(a,e.cue,e.regionList)}catch(g){e.reportOrThrowError(g),e.cue=null,e.state="BADCUE";continue}e.state="CUETEXT";continue;case"CUETEXT":var p=a.indexOf("-->")!==-1;if(!a||p&&(c=!0)){e.oncue&&e.oncue(e.cue),e.cue=null,e.state="ID";continue}e.cue.text&&(e.cue.text+=`
|
|
12
|
-
`),e.cue.text+=a.replace(/\u2028/g,`
|
|
13
|
-
`).replace(/u2029/g,`
|
|
14
|
-
`);continue;case"BADCUE":a||(e.state="ID");continue}}}catch(g){e.reportOrThrowError(g),e.state==="CUETEXT"&&e.cue&&e.oncue&&e.oncue(e.cue),e.cue=null,e.state=e.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},flush:function(){var s=this;try{if(s.buffer+=s.decoder.decode(),(s.cue||s.state==="HEADER")&&(s.buffer+=`
|
|
15
|
-
|
|
16
|
-
`,s.parse()),s.state==="INITIAL")throw new Ue(Ue.Errors.BadSignature)}catch(e){s.reportOrThrowError(e)}return s.onflush&&s.onflush(),this}};var jp=Ei,$p="auto",Hp={"":1,lr:1,rl:1},Vp={start:1,center:1,end:1,left:1,right:1,auto:1,"line-left":1,"line-right":1};function qp(s){if(typeof s!="string")return!1;var e=Hp[s.toLowerCase()];return e?s.toLowerCase():!1}function gr(s){if(typeof s!="string")return!1;var e=Vp[s.toLowerCase()];return e?s.toLowerCase():!1}function ru(s,e,t){this.hasBeenReset=!1;var i="",n=!1,r=s,a=e,l=t,c=null,p="",g=!0,_="auto",S="start",E="auto",w="auto",I=100,L="center";Object.defineProperties(this,{id:{enumerable:!0,get:function(){return i},set:function(P){i=""+P}},pauseOnExit:{enumerable:!0,get:function(){return n},set:function(P){n=!!P}},startTime:{enumerable:!0,get:function(){return r},set:function(P){if(typeof P!="number")throw new TypeError("Start time must be set to a number.");r=P,this.hasBeenReset=!0}},endTime:{enumerable:!0,get:function(){return a},set:function(P){if(typeof P!="number")throw new TypeError("End time must be set to a number.");a=P,this.hasBeenReset=!0}},text:{enumerable:!0,get:function(){return l},set:function(P){l=""+P,this.hasBeenReset=!0}},region:{enumerable:!0,get:function(){return c},set:function(P){c=P,this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return p},set:function(P){var F=qp(P);if(F===!1)throw new SyntaxError("Vertical: an invalid or illegal direction string was specified.");p=F,this.hasBeenReset=!0}},snapToLines:{enumerable:!0,get:function(){return g},set:function(P){g=!!P,this.hasBeenReset=!0}},line:{enumerable:!0,get:function(){return _},set:function(P){if(typeof P!="number"&&P!==$p)throw new SyntaxError("Line: an invalid number or illegal string was specified.");_=P,this.hasBeenReset=!0}},lineAlign:{enumerable:!0,get:function(){return S},set:function(P){var F=gr(P);F?(S=F,this.hasBeenReset=!0):console.warn("lineAlign: an invalid or illegal string was specified.")}},position:{enumerable:!0,get:function(){return E},set:function(P){if(P<0||P>100)throw new Error("Position must be between 0 and 100.");E=P,this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return w},set:function(P){var F=gr(P);F?(w=F,this.hasBeenReset=!0):console.warn("positionAlign: an invalid or illegal string was specified.")}},size:{enumerable:!0,get:function(){return I},set:function(P){if(P<0||P>100)throw new Error("Size must be between 0 and 100.");I=P,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return L},set:function(P){var F=gr(P);if(!F)throw new SyntaxError("align: an invalid or illegal alignment string was specified.");L=F,this.hasBeenReset=!0}}}),this.displayState=void 0}ru.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)};var zp=ru,Wp={"":!0,up:!0};function Gp(s){if(typeof s!="string")return!1;var e=Wp[s.toLowerCase()];return e?s.toLowerCase():!1}function Qi(s){return typeof s=="number"&&s>=0&&s<=100}function Kp(){var s=100,e=3,t=0,i=100,n=0,r=100,a="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return s},set:function(l){if(!Qi(l))throw new Error("Width must be between 0 and 100.");s=l}},lines:{enumerable:!0,get:function(){return e},set:function(l){if(typeof l!="number")throw new TypeError("Lines must be set to a number.");e=l}},regionAnchorY:{enumerable:!0,get:function(){return i},set:function(l){if(!Qi(l))throw new Error("RegionAnchorX must be between 0 and 100.");i=l}},regionAnchorX:{enumerable:!0,get:function(){return t},set:function(l){if(!Qi(l))throw new Error("RegionAnchorY must be between 0 and 100.");t=l}},viewportAnchorY:{enumerable:!0,get:function(){return r},set:function(l){if(!Qi(l))throw new Error("ViewportAnchorY must be between 0 and 100.");r=l}},viewportAnchorX:{enumerable:!0,get:function(){return n},set:function(l){if(!Qi(l))throw new Error("ViewportAnchorX must be between 0 and 100.");n=l}},scroll:{enumerable:!0,get:function(){return a},set:function(l){var c=Gp(l);c===!1?console.warn("Scroll: an invalid or illegal string was specified."):a=c}}})}var Qp=Kp,_t=kn,Zt=su.exports={WebVTT:jp,VTTCue:zp,VTTRegion:Qp};_t.vttjs=Zt;_t.WebVTT=Zt.WebVTT;var Xp=Zt.VTTCue,Yp=Zt.VTTRegion,Jp=_t.VTTCue,Zp=_t.VTTRegion;Zt.shim=function(){_t.VTTCue=Xp,_t.VTTRegion=Yp};Zt.restore=function(){_t.VTTCue=Jp,_t.VTTRegion=Zp};_t.VTTCue||Zt.shim();var em=su.exports;const Qo=Ci(em);var Xo="https://example.com",au=function(e,t){if(/^[a-z]+:/i.test(t))return t;/^data:/.test(e)&&(e=x.location&&x.location.href||"");var i=/^\/\//.test(e),n=!x.location&&!/\/\//i.test(e);e=new x.URL(e,x.location||Xo);var r=new URL(t,e);return n?r.href.slice(Xo.length):i?r.href.slice(r.protocol.length):r.href},Wt={mp4:/^(av0?1|avc0?[1234]|vp0?9|flac|opus|mp3|mp4a|mp4v|stpp.ttml.im1t)/,webm:/^(vp0?[89]|av0?1|opus|vorbis)/,ogg:/^(vp0?[89]|theora|flac|opus|vorbis)/,video:/^(av0?1|avc0?[1234]|vp0?[89]|hvc1|hev1|theora|mp4v)/,audio:/^(mp4a|flac|vorbis|opus|ac-[34]|ec-3|alac|mp3|speex|aac)/,text:/^(stpp.ttml.im1t)/,muxerVideo:/^(avc0?1)/,muxerAudio:/^(mp4a)/,muxerText:/a^/},tm=["video","audio","text"],Yo=["Video","Audio","Text"],ou=function(e){return e&&e.replace(/avc1\.(\d+)\.(\d+)/i,function(t,i,n){var r=("00"+Number(i).toString(16)).slice(-2),a=("00"+Number(n).toString(16)).slice(-2);return"avc1."+r+"00"+a})},it=function(e){e===void 0&&(e="");var t=e.split(","),i=[];return t.forEach(function(n){n=n.trim();var r;tm.forEach(function(a){var l=Wt[a].exec(n.toLowerCase());if(!(!l||l.length<=1)){r=a;var c=n.substring(0,l[1].length),p=n.replace(c,"");i.push({type:c,details:p,mediaType:a})}}),r||i.push({type:n,details:"",mediaType:"unknown"})}),i},im=function(e,t){if(!e.mediaGroups.AUDIO||!t)return null;var i=e.mediaGroups.AUDIO[t];if(!i)return null;for(var n in i){var r=i[n];if(r.default&&r.playlists)return it(r.playlists[0].attributes.CODECS)}return null},lu=function(e){return e===void 0&&(e=""),Wt.audio.test(e.trim().toLowerCase())},sm=function(e){return e===void 0&&(e=""),Wt.text.test(e.trim().toLowerCase())},_i=function(e){if(!(!e||typeof e!="string")){var t=e.toLowerCase().split(",").map(function(r){return ou(r.trim())}),i="video";t.length===1&&lu(t[0])?i="audio":t.length===1&&sm(t[0])&&(i="application");var n="mp4";return t.every(function(r){return Wt.mp4.test(r)})?n="mp4":t.every(function(r){return Wt.webm.test(r)})?n="webm":t.every(function(r){return Wt.ogg.test(r)})&&(n="ogg"),i+"/"+n+';codecs="'+e+'"'}},as=function(e,t){return e===void 0&&(e=""),t===void 0&&(t=!1),x.MediaSource&&x.MediaSource.isTypeSupported&&x.MediaSource.isTypeSupported(_i(e))||t&&x.ManagedMediaSource&&x.ManagedMediaSource.isTypeSupported&&x.ManagedMediaSource.isTypeSupported(_i(e))||!1},_r=function(e){return e===void 0&&(e=""),e.toLowerCase().split(",").every(function(t){t=t.trim();for(var i=0;i<Yo.length;i++){var n=Yo[i];if(Wt["muxer"+n].test(t))return!0}return!1})},Jo="mp4a.40.2",nm="avc1.4d400d",rm=/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i,am=/^application\/dash\+xml/i,uu=function(e){return rm.test(e)?"hls":am.test(e)?"dash":e==="application/vnd.videojs.vhs+json"?"vhs-json":null},om=function(e){return e.toString(2).length},lm=function(e){return Math.ceil(om(e)/8)},hu=function(e){return ArrayBuffer.isView==="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer},um=function(e){return hu(e)},W=function(e){return e instanceof Uint8Array?e:(!Array.isArray(e)&&!um(e)&&!(e instanceof ArrayBuffer)&&(typeof e!="number"||typeof e=="number"&&e!==e?e=0:e=[e]),new Uint8Array(e&&e.buffer||e,e&&e.byteOffset||0,e&&e.byteLength||0))},xe=x.BigInt||Number,Or=[xe("0x1"),xe("0x100"),xe("0x10000"),xe("0x1000000"),xe("0x100000000"),xe("0x10000000000"),xe("0x1000000000000"),xe("0x100000000000000"),xe("0x10000000000000000")];(function(){var s=new Uint16Array([65484]),e=new Uint8Array(s.buffer,s.byteOffset,s.byteLength);return e[0]===255?"big":e[0]===204?"little":"unknown"})();var hm=function(e,t){var i=t===void 0?{}:t,n=i.signed,r=n===void 0?!1:n,a=i.le,l=a===void 0?!1:a;e=W(e);var c=l?"reduce":"reduceRight",p=e[c]?e[c]:Array.prototype[c],g=p.call(e,function(S,E,w){var I=l?w:Math.abs(w+1-e.length);return S+xe(E)*Or[I]},xe(0));if(r){var _=Or[e.length]/xe(2)-xe(1);g=xe(g),g>_&&(g-=_,g-=_,g-=xe(2))}return Number(g)},dm=function(e,t){var i={},n=i.le,r=n===void 0?!1:n;(typeof e!="bigint"&&typeof e!="number"||typeof e=="number"&&e!==e)&&(e=0),e=xe(e);for(var a=lm(e),l=new Uint8Array(new ArrayBuffer(a)),c=0;c<a;c++){var p=r?c:Math.abs(c+1-l.length);l[p]=Number(e/Or[c]&xe(255)),e<0&&(l[p]=Math.abs(~l[p]),l[p]-=c===0?1:2)}return l},du=function(e,t){if(typeof e!="string"&&e&&typeof e.toString=="function"&&(e=e.toString()),typeof e!="string")return new Uint8Array;t||(e=unescape(encodeURIComponent(e)));for(var i=new Uint8Array(e.length),n=0;n<e.length;n++)i[n]=e.charCodeAt(n);return i},cm=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];if(t=t.filter(function(l){return l&&(l.byteLength||l.length)&&typeof l!="string"}),t.length<=1)return W(t[0]);var n=t.reduce(function(l,c,p){return l+(c.byteLength||c.length)},0),r=new Uint8Array(n),a=0;return t.forEach(function(l){l=W(l),r.set(l,a),a+=l.byteLength}),r},de=function(e,t,i){var n=i===void 0?{}:i,r=n.offset,a=r===void 0?0:r,l=n.mask,c=l===void 0?[]:l;e=W(e),t=W(t);var p=t.every?t.every:Array.prototype.every;return t.length&&e.length-a>=t.length&&p.call(t,function(g,_){var S=c[_]?c[_]&e[a+_]:e[a+_];return g===S})},fm=Math.pow(2,32),pm=function(s){var e=new DataView(s.buffer,s.byteOffset,s.byteLength),t;return e.getBigUint64?(t=e.getBigUint64(0),t<Number.MAX_SAFE_INTEGER?Number(t):t):e.getUint32(0)*fm+e.getUint32(4)},mm={getUint64:pm},Zo=mm.getUint64,gm=function(s){var e=new DataView(s.buffer,s.byteOffset,s.byteLength),t={version:s[0],flags:new Uint8Array(s.subarray(1,4)),references:[],referenceId:e.getUint32(4),timescale:e.getUint32(8)},i=12;t.version===0?(t.earliestPresentationTime=e.getUint32(i),t.firstOffset=e.getUint32(i+4),i+=8):(t.earliestPresentationTime=Zo(s.subarray(i)),t.firstOffset=Zo(s.subarray(i+8)),i+=16),i+=2;var n=e.getUint16(i);for(i+=2;n>0;i+=12,n--)t.references.push({referenceType:(s[i]&128)>>>7,referencedSize:e.getUint32(i)&2147483647,subsegmentDuration:e.getUint32(i+4),startsWithSap:!!(s[i+8]&128),sapType:(s[i+8]&112)>>>4,sapDeltaTime:e.getUint32(i+8)&268435455});return t},_m=gm;const ym=Ci(_m);var Tm=W([73,68,51]),vm=function(e,t){t===void 0&&(t=0),e=W(e);var i=e[t+5],n=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9],r=(i&16)>>4;return r?n+20:n+10},is=function s(e,t){return t===void 0&&(t=0),e=W(e),e.length-t<10||!de(e,Tm,{offset:t})?t:(t+=vm(e,t),s(e,t))},el=function(e){return typeof e=="string"?du(e):e},bm=function(e){return Array.isArray(e)?e.map(function(t){return el(t)}):[el(e)]},xm=function s(e,t,i){i===void 0&&(i=!1),t=bm(t),e=W(e);var n=[];if(!t.length)return n;for(var r=0;r<e.length;){var a=(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3])>>>0,l=e.subarray(r+4,r+8);if(a===0)break;var c=r+a;if(c>e.length){if(i)break;c=e.length}var p=e.subarray(r+8,c);de(l,t[0])&&(t.length===1?n.push(p):n.push.apply(n,s(p,t.slice(1),i))),r=c}return n},Xs={EBML:W([26,69,223,163]),DocType:W([66,130]),Segment:W([24,83,128,103]),SegmentInfo:W([21,73,169,102]),Tracks:W([22,84,174,107]),Track:W([174]),TrackNumber:W([215]),DefaultDuration:W([35,227,131]),TrackEntry:W([174]),TrackType:W([131]),FlagDefault:W([136]),CodecID:W([134]),CodecPrivate:W([99,162]),VideoTrack:W([224]),AudioTrack:W([225]),Cluster:W([31,67,182,117]),Timestamp:W([231]),TimestampScale:W([42,215,177]),BlockGroup:W([160]),BlockDuration:W([155]),Block:W([161]),SimpleBlock:W([163])},Mr=[128,64,32,16,8,4,2,1],Sm=function(e){for(var t=1,i=0;i<Mr.length&&!(e&Mr[i]);i++)t++;return t},on=function(e,t,i,n){i===void 0&&(i=!0),n===void 0&&(n=!1);var r=Sm(e[t]),a=e.subarray(t,t+r);return i&&(a=Array.prototype.slice.call(e,t,t+r),a[0]^=Mr[r-1]),{length:r,value:hm(a,{signed:n}),bytes:a}},tl=function s(e){return typeof e=="string"?e.match(/.{1,2}/g).map(function(t){return s(t)}):typeof e=="number"?dm(e):e},Cm=function(e){return Array.isArray(e)?e.map(function(t){return tl(t)}):[tl(e)]},Em=function s(e,t,i){if(i>=t.length)return t.length;var n=on(t,i,!1);if(de(e.bytes,n.bytes))return i;var r=on(t,i+n.length);return s(e,t,i+r.length+r.value+n.length)},il=function s(e,t){t=Cm(t),e=W(e);var i=[];if(!t.length)return i;for(var n=0;n<e.length;){var r=on(e,n,!1),a=on(e,n+r.length),l=n+r.length+a.length;a.value===127&&(a.value=Em(r,e,l),a.value!==e.length&&(a.value-=l));var c=l+a.value>e.length?e.length:l+a.value,p=e.subarray(l,c);de(t[0],r.bytes)&&(t.length===1?i.push(p):i=i.concat(s(p,t.slice(1))));var g=r.length+a.length+p.length;n+=g}return i},wm=W([0,0,0,1]),km=W([0,0,1]),Im=W([0,0,3]),Pm=function(e){for(var t=[],i=1;i<e.length-2;)de(e.subarray(i,i+3),Im)&&(t.push(i+2),i++),i++;if(t.length===0)return e;var n=e.length-t.length,r=new Uint8Array(n),a=0;for(i=0;i<n;a++,i++)a===t[0]&&(a++,t.shift()),r[i]=e[a];return r},cu=function(e,t,i,n){e=W(e),i=[].concat(i);for(var r=0,a,l=0;r<e.length&&(l<n||a);){var c=void 0;if(de(e.subarray(r),wm)?c=4:de(e.subarray(r),km)&&(c=3),!c){r++;continue}if(l++,a)return Pm(e.subarray(a,r));var p=void 0;t==="h264"?p=e[r+c]&31:t==="h265"&&(p=e[r+c]>>1&63),i.indexOf(p)!==-1&&(a=r+c),r+=c+(t==="h264"?1:2)}return e.subarray(0,0)},Am=function(e,t,i){return cu(e,"h264",t,i)},Lm=function(e,t,i){return cu(e,"h265",t,i)},ke={webm:W([119,101,98,109]),matroska:W([109,97,116,114,111,115,107,97]),flac:W([102,76,97,67]),ogg:W([79,103,103,83]),ac3:W([11,119]),riff:W([82,73,70,70]),avi:W([65,86,73]),wav:W([87,65,86,69]),"3gp":W([102,116,121,112,51,103]),mp4:W([102,116,121,112]),fmp4:W([115,116,121,112]),mov:W([102,116,121,112,113,116]),moov:W([109,111,111,118]),moof:W([109,111,111,102])},yi={aac:function(e){var t=is(e);return de(e,[255,16],{offset:t,mask:[255,22]})},mp3:function(e){var t=is(e);return de(e,[255,2],{offset:t,mask:[255,6]})},webm:function(e){var t=il(e,[Xs.EBML,Xs.DocType])[0];return de(t,ke.webm)},mkv:function(e){var t=il(e,[Xs.EBML,Xs.DocType])[0];return de(t,ke.matroska)},mp4:function(e){if(yi["3gp"](e)||yi.mov(e))return!1;if(de(e,ke.mp4,{offset:4})||de(e,ke.fmp4,{offset:4})||de(e,ke.moof,{offset:4})||de(e,ke.moov,{offset:4}))return!0},mov:function(e){return de(e,ke.mov,{offset:4})},"3gp":function(e){return de(e,ke["3gp"],{offset:4})},ac3:function(e){var t=is(e);return de(e,ke.ac3,{offset:t})},ts:function(e){if(e.length<189&&e.length>=1)return e[0]===71;for(var t=0;t+188<e.length&&t<188;){if(e[t]===71&&e[t+188]===71)return!0;t+=1}return!1},flac:function(e){var t=is(e);return de(e,ke.flac,{offset:t})},ogg:function(e){return de(e,ke.ogg)},avi:function(e){return de(e,ke.riff)&&de(e,ke.avi,{offset:8})},wav:function(e){return de(e,ke.riff)&&de(e,ke.wav,{offset:8})},h264:function(e){return Am(e,7,3).length},h265:function(e){return Lm(e,[32,33],3).length}},Rr=Object.keys(yi).filter(function(s){return s!=="ts"&&s!=="h264"&&s!=="h265"}).concat(["ts","h264","h265"]);Rr.forEach(function(s){var e=yi[s];yi[s]=function(t){return e(W(t))}});var Dm=yi,ha=function(e){e=W(e);for(var t=0;t<Rr.length;t++){var i=Rr[t];if(Dm[i](e))return i}return""},Om=function(e){return xm(e,["moof"]).length>0},qt={};/**
|
|
17
|
-
* @license
|
|
18
|
-
* Video.js 8.23.4 <http://videojs.com/>
|
|
19
|
-
* Copyright Brightcove, Inc. <https://www.brightcove.com/>
|
|
20
|
-
* Available under Apache License Version 2.0
|
|
21
|
-
* <https://github.com/videojs/video.js/blob/main/LICENSE>
|
|
22
|
-
*
|
|
23
|
-
* Includes vtt.js <https://github.com/mozilla/vtt.js>
|
|
24
|
-
* Available under Apache License Version 2.0
|
|
25
|
-
* <https://github.com/mozilla/vtt.js/blob/main/LICENSE>
|
|
26
|
-
*/var Br="8.23.4";const pt={},At=function(s,e){return pt[s]=pt[s]||[],e&&(pt[s]=pt[s].concat(e)),pt[s]},Mm=function(s,e){At(s,e)},fu=function(s,e){const t=At(s).indexOf(e);return t<=-1?!1:(pt[s]=pt[s].slice(),pt[s].splice(t,1),!0)},Rm=function(s,e){At(s,[].concat(e).map(t=>{const i=(...n)=>(fu(s,i),t(...n));return i}))},ln={prefixed:!0},tn=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"]],sl=tn[0];let ss;for(let s=0;s<tn.length;s++)if(tn[s][1]in N){ss=tn[s];break}if(ss){for(let s=0;s<ss.length;s++)ln[sl[s]]=ss[s];ln.prefixed=ss[0]!==sl[0]}let De=[];const Bm=(s,e,t)=>(i,n,r)=>{const a=e.levels[n],l=new RegExp(`^(${a})$`);let c=s;if(i!=="log"&&r.unshift(i.toUpperCase()+":"),t&&(c=`%c${s}`,r.unshift(t)),r.unshift(c+":"),De){De.push([].concat(r));const g=De.length-1e3;De.splice(0,g>0?g:0)}if(!x.console)return;let p=x.console[i];!p&&i==="debug"&&(p=x.console.info||x.console.log),!(!p||!a||!l.test(i))&&p[Array.isArray(r)?"apply":"call"](x.console,r)};function Fr(s,e=":",t=""){let i="info",n;function r(...a){n("log",i,a)}return n=Bm(s,r,t),r.createLogger=(a,l,c)=>{const p=l!==void 0?l:e,g=c!==void 0?c:t,_=`${s} ${p} ${a}`;return Fr(_,p,g)},r.createNewLogger=(a,l,c)=>Fr(a,l,c),r.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:i},r.level=a=>{if(typeof a=="string"){if(!r.levels.hasOwnProperty(a))throw new Error(`"${a}" in not a valid log level`);i=a}return i},r.history=()=>De?[].concat(De):[],r.history.filter=a=>(De||[]).filter(l=>new RegExp(`.*${a}.*`).test(l[0])),r.history.clear=()=>{De&&(De.length=0)},r.history.disable=()=>{De!==null&&(De.length=0,De=null)},r.history.enable=()=>{De===null&&(De=[])},r.error=(...a)=>n("error",i,a),r.warn=(...a)=>n("warn",i,a),r.debug=(...a)=>n("debug",i,a),r}const X=Fr("VIDEOJS"),pu=X.createLogger,Fm=Object.prototype.toString,mu=function(s){return lt(s)?Object.keys(s):[]};function li(s,e){mu(s).forEach(t=>e(s[t],t))}function gu(s,e,t=0){return mu(s).reduce((i,n)=>e(i,s[n],n),t)}function lt(s){return!!s&&typeof s=="object"}function Ti(s){return lt(s)&&Fm.call(s)==="[object Object]"&&s.constructor===Object}function se(...s){const e={};return s.forEach(t=>{t&&li(t,(i,n)=>{if(!Ti(i)){e[n]=i;return}Ti(e[n])||(e[n]={}),e[n]=se(e[n],i)})}),e}function _u(s={}){const e=[];for(const t in s)if(s.hasOwnProperty(t)){const i=s[t];e.push(i)}return e}function Pn(s,e,t,i=!0){const n=a=>Object.defineProperty(s,e,{value:a,enumerable:!0,writable:!0}),r={configurable:!0,enumerable:!0,get(){const a=t();return n(a),a}};return i&&(r.set=n),Object.defineProperty(s,e,r)}var Nm=Object.freeze({__proto__:null,each:li,reduce:gu,isObject:lt,isPlain:Ti,merge:se,values:_u,defineLazyProperty:Pn});let da=!1,yu=null,Je=!1,Tu,vu=!1,ui=!1,hi=!1,ut=!1,ca=null,An=null;const Um=!!(x.cast&&x.cast.framework&&x.cast.framework.CastReceiverContext);let bu=null,un=!1,Ln=!1,hn=!1,Dn=!1,dn=!1,cn=!1,fn=!1;const cs=!!(wi()&&("ontouchstart"in x||x.navigator.maxTouchPoints||x.DocumentTouch&&x.document instanceof x.DocumentTouch)),Ct=x.navigator&&x.navigator.userAgentData;Ct&&Ct.platform&&Ct.brands&&(Je=Ct.platform==="Android",ui=!!Ct.brands.find(s=>s.brand==="Microsoft Edge"),hi=!!Ct.brands.find(s=>s.brand==="Chromium"),ut=!ui&&hi,ca=An=(Ct.brands.find(s=>s.brand==="Chromium")||{}).version||null,Ln=Ct.platform==="Windows");if(!hi){const s=x.navigator&&x.navigator.userAgent||"";da=/iPod/i.test(s),yu=function(){const e=s.match(/OS (\d+)_/i);return e&&e[1]?e[1]:null}(),Je=/Android/i.test(s),Tu=function(){const e=s.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;const t=e[1]&&parseFloat(e[1]),i=e[2]&&parseFloat(e[2]);return t&&i?parseFloat(e[1]+"."+e[2]):t||null}(),vu=/Firefox/i.test(s),ui=/Edg/i.test(s),hi=/Chrome/i.test(s)||/CriOS/i.test(s),ut=!ui&&hi,ca=An=function(){const e=s.match(/(Chrome|CriOS)\/(\d+)/);return e&&e[2]?parseFloat(e[2]):null}(),bu=function(){const e=/MSIE\s(\d+)\.\d/.exec(s);let t=e&&parseFloat(e[1]);return!t&&/Trident\/7.0/i.test(s)&&/rv:11.0/.test(s)&&(t=11),t}(),dn=/Tizen/i.test(s),cn=/Web0S/i.test(s),fn=dn||cn,un=/Safari/i.test(s)&&!ut&&!Je&&!ui&&!fn,Ln=/Windows/i.test(s),hn=/iPad/i.test(s)||un&&cs&&!/iPhone/i.test(s),Dn=/iPhone/i.test(s)&&!hn}const Se=Dn||hn||da,On=(un||Se)&&!ut;var xu=Object.freeze({__proto__:null,get IS_IPOD(){return da},get IOS_VERSION(){return yu},get IS_ANDROID(){return Je},get ANDROID_VERSION(){return Tu},get IS_FIREFOX(){return vu},get IS_EDGE(){return ui},get IS_CHROMIUM(){return hi},get IS_CHROME(){return ut},get CHROMIUM_VERSION(){return ca},get CHROME_VERSION(){return An},IS_CHROMECAST_RECEIVER:Um,get IE_VERSION(){return bu},get IS_SAFARI(){return un},get IS_WINDOWS(){return Ln},get IS_IPAD(){return hn},get IS_IPHONE(){return Dn},get IS_TIZEN(){return dn},get IS_WEBOS(){return cn},get IS_SMART_TV(){return fn},TOUCH_ENABLED:cs,IS_IOS:Se,IS_ANY_SAFARI:On});function nl(s){return typeof s=="string"&&!!s.trim()}function jm(s){if(s.indexOf(" ")>=0)throw new Error("class has illegal whitespace characters")}function wi(){return N===x.document}function ki(s){return lt(s)&&s.nodeType===1}function Su(){try{return x.parent!==x.self}catch{return!0}}function Cu(s){return function(e,t){if(!nl(e))return N[s](null);nl(t)&&(t=N.querySelector(t));const i=ki(t)?t:N;return i[s]&&i[s](e)}}function G(s="div",e={},t={},i){const n=N.createElement(s);return Object.getOwnPropertyNames(e).forEach(function(r){const a=e[r];r==="textContent"?Dt(n,a):(n[r]!==a||r==="tabIndex")&&(n[r]=a)}),Object.getOwnPropertyNames(t).forEach(function(r){n.setAttribute(r,t[r])}),i&&fa(n,i),n}function Dt(s,e){return typeof s.textContent>"u"?s.innerText=e:s.textContent=e,s}function Nr(s,e){e.firstChild?e.insertBefore(s,e.firstChild):e.appendChild(s)}function os(s,e){return jm(e),s.classList.contains(e)}function Gt(s,...e){return s.classList.add(...e.reduce((t,i)=>t.concat(i.split(/\s+/)),[])),s}function Mn(s,...e){return s?(s.classList.remove(...e.reduce((t,i)=>t.concat(i.split(/\s+/)),[])),s):(X.warn("removeClass was called with an element that doesn't exist"),null)}function Eu(s,e,t){return typeof t=="function"&&(t=t(s,e)),typeof t!="boolean"&&(t=void 0),e.split(/\s+/).forEach(i=>s.classList.toggle(i,t)),s}function wu(s,e){Object.getOwnPropertyNames(e).forEach(function(t){const i=e[t];i===null||typeof i>"u"||i===!1?s.removeAttribute(t):s.setAttribute(t,i===!0?"":i)})}function kt(s){const e={},t=["autoplay","controls","playsinline","loop","muted","default","defaultMuted"];if(s&&s.attributes&&s.attributes.length>0){const i=s.attributes;for(let n=i.length-1;n>=0;n--){const r=i[n].name;let a=i[n].value;t.includes(r)&&(a=a!==null),e[r]=a}}return e}function ku(s,e){return s.getAttribute(e)}function vi(s,e,t){s.setAttribute(e,t)}function Rn(s,e){s.removeAttribute(e)}function Iu(){N.body.focus(),N.onselectstart=function(){return!1}}function Pu(){N.onselectstart=function(){return!0}}function bi(s){if(s&&s.getBoundingClientRect&&s.parentNode){const e=s.getBoundingClientRect(),t={};return["bottom","height","left","right","top","width"].forEach(i=>{e[i]!==void 0&&(t[i]=e[i])}),t.height||(t.height=parseFloat(xi(s,"height"))),t.width||(t.width=parseFloat(xi(s,"width"))),t}}function fs(s){if(!s||s&&!s.offsetParent)return{left:0,top:0,width:0,height:0};const e=s.offsetWidth,t=s.offsetHeight;let i=0,n=0;for(;s.offsetParent&&s!==N[ln.fullscreenElement];)i+=s.offsetLeft,n+=s.offsetTop,s=s.offsetParent;return{left:i,top:n,width:e,height:t}}function Bn(s,e){const t={x:0,y:0};if(Se){let g=s;for(;g&&g.nodeName.toLowerCase()!=="html";){const _=xi(g,"transform");if(/^matrix/.test(_)){const S=_.slice(7,-1).split(/,\s/).map(Number);t.x+=S[4],t.y+=S[5]}else if(/^matrix3d/.test(_)){const S=_.slice(9,-1).split(/,\s/).map(Number);t.x+=S[12],t.y+=S[13]}if(g.assignedSlot&&g.assignedSlot.parentElement&&x.WebKitCSSMatrix){const S=x.getComputedStyle(g.assignedSlot.parentElement).transform,E=new x.WebKitCSSMatrix(S);t.x+=E.m41,t.y+=E.m42}g=g.parentNode||g.host}}const i={},n=fs(e.target),r=fs(s),a=r.width,l=r.height;let c=e.offsetY-(r.top-n.top),p=e.offsetX-(r.left-n.left);return e.changedTouches&&(p=e.changedTouches[0].pageX-r.left,c=e.changedTouches[0].pageY+r.top,Se&&(p-=t.x,c-=t.y)),i.y=1-Math.max(0,Math.min(1,c/l)),i.x=Math.max(0,Math.min(1,p/a)),i}function Au(s){return lt(s)&&s.nodeType===3}function Fn(s){for(;s.firstChild;)s.removeChild(s.firstChild);return s}function Lu(s){return typeof s=="function"&&(s=s()),(Array.isArray(s)?s:[s]).map(e=>{if(typeof e=="function"&&(e=e()),ki(e)||Au(e))return e;if(typeof e=="string"&&/\S/.test(e))return N.createTextNode(e)}).filter(e=>e)}function fa(s,e){return Lu(e).forEach(t=>s.appendChild(t)),s}function Du(s,e){return fa(Fn(s),e)}function ps(s){return s.button===void 0&&s.buttons===void 0||s.button===0&&s.buttons===void 0||s.type==="mouseup"&&s.button===0&&s.buttons===0||s.type==="mousedown"&&s.button===0&&s.buttons===0?!0:!(s.button!==0||s.buttons!==1)}const Lt=Cu("querySelector"),Ou=Cu("querySelectorAll");function xi(s,e){if(!s||!e)return"";if(typeof x.getComputedStyle=="function"){let t;try{t=x.getComputedStyle(s)}catch{return""}return t?t.getPropertyValue(e)||t[e]:""}return""}function Mu(s){[...N.styleSheets].forEach(e=>{try{const t=[...e.cssRules].map(n=>n.cssText).join(""),i=N.createElement("style");i.textContent=t,s.document.head.appendChild(i)}catch{const i=N.createElement("link");i.rel="stylesheet",i.type=e.type,i.media=e.media.mediaText,i.href=e.href,s.document.head.appendChild(i)}})}var Ru=Object.freeze({__proto__:null,isReal:wi,isEl:ki,isInFrame:Su,createEl:G,textContent:Dt,prependTo:Nr,hasClass:os,addClass:Gt,removeClass:Mn,toggleClass:Eu,setAttributes:wu,getAttributes:kt,getAttribute:ku,setAttribute:vi,removeAttribute:Rn,blockTextSelection:Iu,unblockTextSelection:Pu,getBoundingClientRect:bi,findPosition:fs,getPointerPosition:Bn,isTextNode:Au,emptyEl:Fn,normalizeContent:Lu,appendContent:fa,insertContent:Du,isSingleLeftClick:ps,$:Lt,$$:Ou,computedStyle:xi,copyStyleSheetsToWindow:Mu});let Bu=!1,Ur;const $m=function(){if(Ur.options.autoSetup===!1)return;const s=Array.prototype.slice.call(N.getElementsByTagName("video")),e=Array.prototype.slice.call(N.getElementsByTagName("audio")),t=Array.prototype.slice.call(N.getElementsByTagName("video-js")),i=s.concat(e,t);if(i&&i.length>0)for(let n=0,r=i.length;n<r;n++){const a=i[n];if(a&&a.getAttribute)a.player===void 0&&a.getAttribute("data-setup")!==null&&Ur(a);else{jr(1);break}}else Bu||jr(1)};function jr(s,e){wi()&&(e&&(Ur=e),x.setTimeout($m,s))}function $r(){Bu=!0,x.removeEventListener("load",$r)}wi()&&(N.readyState==="complete"?$r():x.addEventListener("load",$r));const Fu=function(s){const e=N.createElement("style");return e.className=s,e},Nu=function(s,e){s.styleSheet?s.styleSheet.cssText=e:s.textContent=e};var Ae=new WeakMap;const Hm=3;let Vm=Hm;function ze(){return Vm++}function rl(s,e){if(!Ae.has(s))return;const t=Ae.get(s);t.handlers[e].length===0&&(delete t.handlers[e],s.removeEventListener?s.removeEventListener(e,t.dispatcher,!1):s.detachEvent&&s.detachEvent("on"+e,t.dispatcher)),Object.getOwnPropertyNames(t.handlers).length<=0&&(delete t.handlers,delete t.dispatcher,delete t.disabled),Object.getOwnPropertyNames(t).length===0&&Ae.delete(s)}function pa(s,e,t,i){t.forEach(function(n){s(e,n,i)})}function Nn(s){if(s.fixed_)return s;function e(){return!0}function t(){return!1}if(!s||!s.isPropagationStopped||!s.isImmediatePropagationStopped){const i=s||x.event;s={};const n=["layerX","layerY","keyLocation","path","webkitMovementX","webkitMovementY","mozPressure","mozInputSource"];for(const r in i)n.includes(r)||r==="returnValue"&&i.preventDefault||(s[r]=i[r]);if(s.target||(s.target=s.srcElement||N),s.relatedTarget||(s.relatedTarget=s.fromElement===s.target?s.toElement:s.fromElement),s.preventDefault=function(){i.preventDefault&&i.preventDefault(),s.returnValue=!1,i.returnValue=!1,s.defaultPrevented=!0},s.defaultPrevented=!1,s.stopPropagation=function(){i.stopPropagation&&i.stopPropagation(),s.cancelBubble=!0,i.cancelBubble=!0,s.isPropagationStopped=e},s.isPropagationStopped=t,s.stopImmediatePropagation=function(){i.stopImmediatePropagation&&i.stopImmediatePropagation(),s.isImmediatePropagationStopped=e,s.stopPropagation()},s.isImmediatePropagationStopped=t,s.clientX!==null&&s.clientX!==void 0){const r=N.documentElement,a=N.body;s.pageX=s.clientX+(r&&r.scrollLeft||a&&a.scrollLeft||0)-(r&&r.clientLeft||a&&a.clientLeft||0),s.pageY=s.clientY+(r&&r.scrollTop||a&&a.scrollTop||0)-(r&&r.clientTop||a&&a.clientTop||0)}s.which=s.charCode||s.keyCode,s.button!==null&&s.button!==void 0&&(s.button=s.button&1?0:s.button&4?1:s.button&2?2:0)}return s.fixed_=!0,s}let Ys;const qm=function(){if(typeof Ys!="boolean"){Ys=!1;try{const s=Object.defineProperty({},"passive",{get(){Ys=!0}});x.addEventListener("test",null,s),x.removeEventListener("test",null,s)}catch{}}return Ys},zm=["touchstart","touchmove"];function je(s,e,t){if(Array.isArray(e))return pa(je,s,e,t);Ae.has(s)||Ae.set(s,{});const i=Ae.get(s);if(i.handlers||(i.handlers={}),i.handlers[e]||(i.handlers[e]=[]),t.guid||(t.guid=ze()),i.handlers[e].push(t),i.dispatcher||(i.disabled=!1,i.dispatcher=function(n,r){if(i.disabled)return;n=Nn(n);const a=i.handlers[n.type];if(a){const l=a.slice(0);for(let c=0,p=l.length;c<p&&!n.isImmediatePropagationStopped();c++)try{l[c].call(s,n,r)}catch(g){X.error(g)}}}),i.handlers[e].length===1)if(s.addEventListener){let n=!1;qm()&&zm.indexOf(e)>-1&&(n={passive:!0}),s.addEventListener(e,i.dispatcher,n)}else s.attachEvent&&s.attachEvent("on"+e,i.dispatcher)}function Ce(s,e,t){if(!Ae.has(s))return;const i=Ae.get(s);if(!i.handlers)return;if(Array.isArray(e))return pa(Ce,s,e,t);const n=function(a,l){i.handlers[l]=[],rl(a,l)};if(e===void 0){for(const a in i.handlers)Object.prototype.hasOwnProperty.call(i.handlers||{},a)&&n(s,a);return}const r=i.handlers[e];if(r){if(!t){n(s,e);return}if(t.guid)for(let a=0;a<r.length;a++)r[a].guid===t.guid&&r.splice(a--,1);rl(s,e)}}function Ii(s,e,t){const i=Ae.has(s)?Ae.get(s):{},n=s.parentNode||s.ownerDocument;if(typeof e=="string"?e={type:e,target:s}:e.target||(e.target=s),e=Nn(e),i.dispatcher&&i.dispatcher.call(s,e,t),n&&!e.isPropagationStopped()&&e.bubbles===!0)Ii.call(null,n,e,t);else if(!n&&!e.defaultPrevented&&e.target&&e.target[e.type]){Ae.has(e.target)||Ae.set(e.target,{});const r=Ae.get(e.target);e.target[e.type]&&(r.disabled=!0,typeof e.target[e.type]=="function"&&e.target[e.type](),r.disabled=!1)}return!e.defaultPrevented}function Un(s,e,t){if(Array.isArray(e))return pa(Un,s,e,t);const i=function(){Ce(s,e,i),t.apply(this,arguments)};i.guid=t.guid=t.guid||ze(),je(s,e,i)}function ma(s,e,t){const i=function(){Ce(s,e,i),t.apply(this,arguments)};i.guid=t.guid=t.guid||ze(),je(s,e,i)}var Wm=Object.freeze({__proto__:null,fixEvent:Nn,on:je,off:Ce,trigger:Ii,one:Un,any:ma});const We=30,re=function(s,e,t){e.guid||(e.guid=ze());const i=e.bind(s);return i.guid=t?t+"_"+e.guid:e.guid,i},ht=function(s,e){let t=x.performance.now();return function(...n){const r=x.performance.now();r-t>=e&&(s(...n),t=r)}},Uu=function(s,e,t,i=x){let n;const r=()=>{i.clearTimeout(n),n=null},a=function(){const l=this,c=arguments;let p=function(){n=null,p=null,t||s.apply(l,c)};!n&&t&&s.apply(l,c),i.clearTimeout(n),n=i.setTimeout(p,e)};return a.cancel=r,a};var Gm=Object.freeze({__proto__:null,UPDATE_REFRESH_INTERVAL:We,bind_:re,throttle:ht,debounce:Uu});let Xi;class $e{on(e,t){const i=this.addEventListener;this.addEventListener=()=>{},je(this,e,t),this.addEventListener=i}off(e,t){Ce(this,e,t)}one(e,t){const i=this.addEventListener;this.addEventListener=()=>{},Un(this,e,t),this.addEventListener=i}any(e,t){const i=this.addEventListener;this.addEventListener=()=>{},ma(this,e,t),this.addEventListener=i}trigger(e){const t=e.type||e;typeof e=="string"&&(e={type:t}),e=Nn(e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),Ii(this,e)}queueTrigger(e){Xi||(Xi=new Map);const t=e.type||e;let i=Xi.get(this);i||(i=new Map,Xi.set(this,i));const n=i.get(t);i.delete(t),x.clearTimeout(n);const r=x.setTimeout(()=>{i.delete(t),i.size===0&&(i=null,Xi.delete(this)),this.trigger(e)},0);i.set(t,r)}}$e.prototype.allowedEvents_={};$e.prototype.addEventListener=$e.prototype.on;$e.prototype.removeEventListener=$e.prototype.off;$e.prototype.dispatchEvent=$e.prototype.trigger;const jn=s=>typeof s.name=="function"?s.name():typeof s.name=="string"?s.name:s.name_?s.name_:s.constructor&&s.constructor.name?s.constructor.name:typeof s,gt=s=>s instanceof $e||!!s.eventBusEl_&&["on","one","off","trigger"].every(e=>typeof s[e]=="function"),Km=(s,e)=>{gt(s)?e():(s.eventedCallbacks||(s.eventedCallbacks=[]),s.eventedCallbacks.push(e))},Hr=s=>typeof s=="string"&&/\S/.test(s)||Array.isArray(s)&&!!s.length,pn=(s,e,t)=>{if(!s||!s.nodeName&&!gt(s))throw new Error(`Invalid target for ${jn(e)}#${t}; must be a DOM node or evented object.`)},ju=(s,e,t)=>{if(!Hr(s))throw new Error(`Invalid event type for ${jn(e)}#${t}; must be a non-empty string or array.`)},$u=(s,e,t)=>{if(typeof s!="function")throw new Error(`Invalid listener for ${jn(e)}#${t}; must be a function.`)},yr=(s,e,t)=>{const i=e.length<3||e[0]===s||e[0]===s.eventBusEl_;let n,r,a;return i?(n=s.eventBusEl_,e.length>=3&&e.shift(),[r,a]=e):(n=e[0],r=e[1],a=e[2]),pn(n,s,t),ju(r,s,t),$u(a,s,t),a=re(s,a),{isTargetingSelf:i,target:n,type:r,listener:a}},$t=(s,e,t,i)=>{pn(s,s,e),s.nodeName?Wm[e](s,t,i):s[e](t,i)},Qm={on(...s){const{isTargetingSelf:e,target:t,type:i,listener:n}=yr(this,s,"on");if($t(t,"on",i,n),!e){const r=()=>this.off(t,i,n);r.guid=n.guid;const a=()=>this.off("dispose",r);a.guid=n.guid,$t(this,"on","dispose",r),$t(t,"on","dispose",a)}},one(...s){const{isTargetingSelf:e,target:t,type:i,listener:n}=yr(this,s,"one");if(e)$t(t,"one",i,n);else{const r=(...a)=>{this.off(t,i,r),n.apply(null,a)};r.guid=n.guid,$t(t,"one",i,r)}},any(...s){const{isTargetingSelf:e,target:t,type:i,listener:n}=yr(this,s,"any");if(e)$t(t,"any",i,n);else{const r=(...a)=>{this.off(t,i,r),n.apply(null,a)};r.guid=n.guid,$t(t,"any",i,r)}},off(s,e,t){if(!s||Hr(s))Ce(this.eventBusEl_,s,e);else{const i=s,n=e;pn(i,this,"off"),ju(n,this,"off"),$u(t,this,"off"),t=re(this,t),this.off("dispose",t),i.nodeName?(Ce(i,n,t),Ce(i,"dispose",t)):gt(i)&&(i.off(n,t),i.off("dispose",t))}},trigger(s,e){pn(this.eventBusEl_,this,"trigger");const t=s&&typeof s!="string"?s.type:s;if(!Hr(t))throw new Error(`Invalid event type for ${jn(this)}#trigger; must be a non-empty string or object with a type key that has a non-empty value.`);return Ii(this.eventBusEl_,s,e)}};function ga(s,e={}){const{eventBusKey:t}=e;if(t){if(!s[t].nodeName)throw new Error(`The eventBusKey "${t}" does not refer to an element.`);s.eventBusEl_=s[t]}else s.eventBusEl_=G("span",{className:"vjs-event-bus"});return Object.assign(s,Qm),s.eventedCallbacks&&s.eventedCallbacks.forEach(i=>{i()}),s.on("dispose",()=>{s.off(),[s,s.el_,s.eventBusEl_].forEach(function(i){i&&Ae.has(i)&&Ae.delete(i)}),x.setTimeout(()=>{s.eventBusEl_=null},0)}),s}const Xm={state:{},setState(s){typeof s=="function"&&(s=s());let e;return li(s,(t,i)=>{this.state[i]!==t&&(e=e||{},e[i]={from:this.state[i],to:t}),this.state[i]=t}),e&>(this)&&this.trigger({changes:e,type:"statechanged"}),e}};function Hu(s,e){return Object.assign(s,Xm),s.state=Object.assign({},s.state,e),typeof s.handleStateChanged=="function"&>(s)&&s.on("statechanged",s.handleStateChanged),s}const ls=function(s){return typeof s!="string"?s:s.replace(/./,e=>e.toLowerCase())},pe=function(s){return typeof s!="string"?s:s.replace(/./,e=>e.toUpperCase())},Vu=function(s,e){return pe(s)===pe(e)};var Ym=Object.freeze({__proto__:null,toLowerCase:ls,toTitleCase:pe,titleCaseEquals:Vu});class D{constructor(e,t,i){if(!e&&this.play?this.player_=e=this:this.player_=e,this.isDisposed_=!1,this.parentComponent_=null,this.options_=se({},this.options_),t=this.options_=se(this.options_,t),this.id_=t.id||t.el&&t.el.id,!this.id_){const n=e&&e.id&&e.id()||"no_player";this.id_=`${n}_component_${ze()}`}this.name_=t.name||null,t.el?this.el_=t.el:t.createEl!==!1&&(this.el_=this.createEl()),t.className&&this.el_&&t.className.split(" ").forEach(n=>this.addClass(n)),["on","off","one","any","trigger"].forEach(n=>{this[n]=void 0}),t.evented!==!1&&(ga(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange)),Hu(this,this.constructor.defaultState),this.children_=[],this.childIndex_={},this.childNameIndex_={},this.setTimeoutIds_=new Set,this.setIntervalIds_=new Set,this.rafIds_=new Set,this.namedRafs_=new Map,this.clearingTimersOnDispose_=!1,t.initChildren!==!1&&this.initChildren(),this.ready(i),t.reportTouchActivity!==!1&&this.enableTouchActivity()}dispose(e={}){if(!this.isDisposed_){if(this.readyQueue_&&(this.readyQueue_.length=0),this.trigger({type:"dispose",bubbles:!1}),this.isDisposed_=!0,this.children_)for(let t=this.children_.length-1;t>=0;t--)this.children_[t].dispose&&this.children_[t].dispose();this.children_=null,this.childIndex_=null,this.childNameIndex_=null,this.parentComponent_=null,this.el_&&(this.el_.parentNode&&(e.restoreEl?this.el_.parentNode.replaceChild(e.restoreEl,this.el_):this.el_.parentNode.removeChild(this.el_)),this.el_=null),this.player_=null}}isDisposed(){return!!this.isDisposed_}player(){return this.player_}options(e){return e?(this.options_=se(this.options_,e),this.options_):this.options_}el(){return this.el_}createEl(e,t,i){return G(e,t,i)}localize(e,t,i=e){const n=this.player_.language&&this.player_.language(),r=this.player_.languages&&this.player_.languages(),a=r&&r[n],l=n&&n.split("-")[0],c=r&&r[l];let p=i;return a&&a[e]?p=a[e]:c&&c[e]&&(p=c[e]),t&&(p=p.replace(/\{(\d+)\}/g,function(g,_){const S=t[_-1];let E=S;return typeof S>"u"&&(E=g),E})),p}handleLanguagechange(){}contentEl(){return this.contentEl_||this.el_}id(){return this.id_}name(){return this.name_}children(){return this.children_}getChildById(e){return this.childIndex_[e]}getChild(e){if(e)return this.childNameIndex_[e]}getDescendant(...e){e=e.reduce((i,n)=>i.concat(n),[]);let t=this;for(let i=0;i<e.length;i++)if(t=t.getChild(e[i]),!t||!t.getChild)return;return t}setIcon(e,t=this.el()){if(!this.player_.options_.experimentalSvgIcons)return;const i="http://www.w3.org/2000/svg",n=G("span",{className:"vjs-icon-placeholder vjs-svg-icon"},{"aria-hidden":"true"}),r=N.createElementNS(i,"svg");r.setAttributeNS(null,"viewBox","0 0 512 512");const a=N.createElementNS(i,"use");return r.appendChild(a),a.setAttributeNS(null,"href",`#vjs-icon-${e}`),n.appendChild(r),this.iconIsSet_?t.replaceChild(n,t.querySelector(".vjs-icon-placeholder")):t.appendChild(n),this.iconIsSet_=!0,n}addChild(e,t={},i=this.children_.length){let n,r;if(typeof e=="string"){r=pe(e);const a=t.componentClass||r;t.name=r;const l=D.getComponent(a);if(!l)throw new Error(`Component ${a} does not exist`);if(typeof l!="function")return null;n=new l(this.player_||this,t)}else n=e;if(n.parentComponent_&&n.parentComponent_.removeChild(n),this.children_.splice(i,0,n),n.parentComponent_=this,typeof n.id=="function"&&(this.childIndex_[n.id()]=n),r=r||n.name&&pe(n.name()),r&&(this.childNameIndex_[r]=n,this.childNameIndex_[ls(r)]=n),typeof n.el=="function"&&n.el()){let a=null;this.children_[i+1]&&(this.children_[i+1].el_?a=this.children_[i+1].el_:ki(this.children_[i+1])&&(a=this.children_[i+1])),this.contentEl().insertBefore(n.el(),a)}return n}removeChild(e){if(typeof e=="string"&&(e=this.getChild(e)),!e||!this.children_)return;let t=!1;for(let n=this.children_.length-1;n>=0;n--)if(this.children_[n]===e){t=!0,this.children_.splice(n,1);break}if(!t)return;e.parentComponent_=null,this.childIndex_[e.id()]=null,this.childNameIndex_[pe(e.name())]=null,this.childNameIndex_[ls(e.name())]=null;const i=e.el();i&&i.parentNode===this.contentEl()&&this.contentEl().removeChild(e.el())}initChildren(){const e=this.options_.children;if(e){const t=this.options_,i=a=>{const l=a.name;let c=a.opts;if(t[l]!==void 0&&(c=t[l]),c===!1)return;c===!0&&(c={}),c.playerOptions=this.options_.playerOptions;const p=this.addChild(l,c);p&&(this[l]=p)};let n;const r=D.getComponent("Tech");Array.isArray(e)?n=e:n=Object.keys(e),n.concat(Object.keys(this.options_).filter(function(a){return!n.some(function(l){return typeof l=="string"?a===l:a===l.name})})).map(a=>{let l,c;return typeof a=="string"?(l=a,c=e[l]||this.options_[l]||{}):(l=a.name,c=a),{name:l,opts:c}}).filter(a=>{const l=D.getComponent(a.opts.componentClass||pe(a.name));return l&&!r.isTech(l)}).forEach(i)}}buildCSSClass(){return""}ready(e,t=!1){if(e){if(!this.isReady_){this.readyQueue_=this.readyQueue_||[],this.readyQueue_.push(e);return}t?e.call(this):this.setTimeout(e,1)}}triggerReady(){this.isReady_=!0,this.setTimeout(function(){const e=this.readyQueue_;this.readyQueue_=[],e&&e.length>0&&e.forEach(function(t){t.call(this)},this),this.trigger("ready")},1)}$(e,t){return Lt(e,t||this.contentEl())}$$(e,t){return Ou(e,t||this.contentEl())}hasClass(e){return os(this.el_,e)}addClass(...e){Gt(this.el_,...e)}removeClass(...e){Mn(this.el_,...e)}toggleClass(e,t){Eu(this.el_,e,t)}show(){this.removeClass("vjs-hidden")}hide(){this.addClass("vjs-hidden")}lockShowing(){this.addClass("vjs-lock-showing")}unlockShowing(){this.removeClass("vjs-lock-showing")}getAttribute(e){return ku(this.el_,e)}setAttribute(e,t){vi(this.el_,e,t)}removeAttribute(e){Rn(this.el_,e)}width(e,t){return this.dimension("width",e,t)}height(e,t){return this.dimension("height",e,t)}dimensions(e,t){this.width(e,!0),this.height(t)}dimension(e,t,i){if(t!==void 0){(t===null||t!==t)&&(t=0),(""+t).indexOf("%")!==-1||(""+t).indexOf("px")!==-1?this.el_.style[e]=t:t==="auto"?this.el_.style[e]="":this.el_.style[e]=t+"px",i||this.trigger("componentresize");return}if(!this.el_)return 0;const n=this.el_.style[e],r=n.indexOf("px");return parseInt(r!==-1?n.slice(0,r):this.el_["offset"+pe(e)],10)}currentDimension(e){let t=0;if(e!=="width"&&e!=="height")throw new Error("currentDimension only accepts width or height value");if(t=xi(this.el_,e),t=parseFloat(t),t===0||isNaN(t)){const i=`offset${pe(e)}`;t=this.el_[i]}return t}currentDimensions(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}}currentWidth(){return this.currentDimension("width")}currentHeight(){return this.currentDimension("height")}getPositions(){const e=this.el_.getBoundingClientRect(),t={x:e.x,y:e.y,width:e.width,height:e.height,top:e.top,right:e.right,bottom:e.bottom,left:e.left},i={x:e.left+e.width/2,y:e.top+e.height/2,width:0,height:0,top:e.top+e.height/2,right:e.left+e.width/2,bottom:e.top+e.height/2,left:e.left+e.width/2};return{boundingClientRect:t,center:i}}focus(){this.el_.focus()}blur(){this.el_.blur()}handleKeyDown(e){this.player_&&(e.key!=="Tab"&&!(this.player_.options_.playerOptions.spatialNavigation&&this.player_.options_.playerOptions.spatialNavigation.enabled)&&e.stopPropagation(),this.player_.handleKeyDown(e))}handleKeyPress(e){this.handleKeyDown(e)}emitTapEvents(){let e=0,t=null;const i=10,n=200;let r;this.on("touchstart",function(l){l.touches.length===1&&(t={pageX:l.touches[0].pageX,pageY:l.touches[0].pageY},e=x.performance.now(),r=!0)}),this.on("touchmove",function(l){if(l.touches.length>1)r=!1;else if(t){const c=l.touches[0].pageX-t.pageX,p=l.touches[0].pageY-t.pageY;Math.sqrt(c*c+p*p)>i&&(r=!1)}});const a=function(){r=!1};this.on("touchleave",a),this.on("touchcancel",a),this.on("touchend",function(l){t=null,r===!0&&x.performance.now()-e<n&&(l.preventDefault(),this.trigger("tap"))})}enableTouchActivity(){if(!this.player()||!this.player().reportUserActivity)return;const e=re(this.player(),this.player().reportUserActivity);let t;this.on("touchstart",function(){e(),this.clearInterval(t),t=this.setInterval(e,250)});const i=function(n){e(),this.clearInterval(t)};this.on("touchmove",e),this.on("touchend",i),this.on("touchcancel",i)}setTimeout(e,t){var i;return e=re(this,e),this.clearTimersOnDispose_(),i=x.setTimeout(()=>{this.setTimeoutIds_.has(i)&&this.setTimeoutIds_.delete(i),e()},t),this.setTimeoutIds_.add(i),i}clearTimeout(e){return this.setTimeoutIds_.has(e)&&(this.setTimeoutIds_.delete(e),x.clearTimeout(e)),e}setInterval(e,t){e=re(this,e),this.clearTimersOnDispose_();const i=x.setInterval(e,t);return this.setIntervalIds_.add(i),i}clearInterval(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),x.clearInterval(e)),e}requestAnimationFrame(e){this.clearTimersOnDispose_();var t;return e=re(this,e),t=x.requestAnimationFrame(()=>{this.rafIds_.has(t)&&this.rafIds_.delete(t),e()}),this.rafIds_.add(t),t}requestNamedAnimationFrame(e,t){this.namedRafs_.has(e)&&this.cancelNamedAnimationFrame(e),this.clearTimersOnDispose_(),t=re(this,t);const i=this.requestAnimationFrame(()=>{t(),this.namedRafs_.has(e)&&this.namedRafs_.delete(e)});return this.namedRafs_.set(e,i),e}cancelNamedAnimationFrame(e){this.namedRafs_.has(e)&&(this.cancelAnimationFrame(this.namedRafs_.get(e)),this.namedRafs_.delete(e))}cancelAnimationFrame(e){return this.rafIds_.has(e)&&(this.rafIds_.delete(e),x.cancelAnimationFrame(e)),e}clearTimersOnDispose_(){this.clearingTimersOnDispose_||(this.clearingTimersOnDispose_=!0,this.one("dispose",()=>{[["namedRafs_","cancelNamedAnimationFrame"],["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach(([e,t])=>{this[e].forEach((i,n)=>this[t](n))}),this.clearingTimersOnDispose_=!1}))}getIsDisabled(){return!!this.el_.disabled}getIsExpresslyInert(){return this.el_.inert&&!this.el_.ownerDocument.documentElement.inert}getIsFocusable(e){return(e||this.el_).tabIndex>=0&&!(this.getIsDisabled()||this.getIsExpresslyInert())}getIsAvailableToBeFocused(e){function t(r){const a=x.getComputedStyle(r,null),l=a.getPropertyValue("visibility");return a.getPropertyValue("display")!=="none"&&!["hidden","collapse"].includes(l)}function i(r){return!(!t(r.parentElement)||!t(r)||r.style.opacity==="0"||x.getComputedStyle(r).height==="0px"||x.getComputedStyle(r).width==="0px")}function n(r){if(r.offsetWidth+r.offsetHeight+r.getBoundingClientRect().height+r.getBoundingClientRect().width===0)return!1;const a={x:r.getBoundingClientRect().left+r.offsetWidth/2,y:r.getBoundingClientRect().top+r.offsetHeight/2};if(a.x<0||a.x>(N.documentElement.clientWidth||x.innerWidth)||a.y<0||a.y>(N.documentElement.clientHeight||x.innerHeight))return!1;let l=N.elementFromPoint(a.x,a.y);for(;l;){if(l===r)return!0;if(l.parentNode)l=l.parentNode;else return!1}}return e||(e=this.el()),!!(n(e)&&i(e)&&(!e.parentElement||e.tabIndex>=0))}static registerComponent(e,t){if(typeof e!="string"||!e)throw new Error(`Illegal component name, "${e}"; must be a non-empty string.`);const i=D.getComponent("Tech"),n=i&&i.isTech(t),r=D===t||D.prototype.isPrototypeOf(t.prototype);if(n||!r){let l;throw n?l="techs must be registered using Tech.registerTech()":l="must be a Component subclass",new Error(`Illegal component, "${e}"; ${l}.`)}e=pe(e),D.components_||(D.components_={});const a=D.getComponent("Player");if(e==="Player"&&a&&a.players){const l=a.players,c=Object.keys(l);if(l&&c.length>0){for(let p=0;p<c.length;p++)if(l[c[p]]!==null)throw new Error("Can not register Player component after player has been created.")}}return D.components_[e]=t,D.components_[ls(e)]=t,t}static getComponent(e){if(!(!e||!D.components_))return D.components_[e]}}D.registerComponent("Component",D);function Jm(s,e,t){if(typeof e!="number"||e<0||e>t)throw new Error(`Failed to execute '${s}' on 'TimeRanges': The index provided (${e}) is non-numeric or out of bounds (0-${t}).`)}function al(s,e,t,i){return Jm(s,i,t.length-1),t[i][e]}function Tr(s){let e;return s===void 0||s.length===0?e={length:0,start(){throw new Error("This TimeRanges object is empty")},end(){throw new Error("This TimeRanges object is empty")}}:e={length:s.length,start:al.bind(null,"start",0,s),end:al.bind(null,"end",1,s)},x.Symbol&&x.Symbol.iterator&&(e[x.Symbol.iterator]=()=>(s||[]).values()),e}function Ye(s,e){return Array.isArray(s)?Tr(s):s===void 0||e===void 0?Tr():Tr([[s,e]])}const qu=function(s,e){s=s<0?0:s;let t=Math.floor(s%60),i=Math.floor(s/60%60),n=Math.floor(s/3600);const r=Math.floor(e/60%60),a=Math.floor(e/3600);return(isNaN(s)||s===1/0)&&(n=i=t="-"),n=n>0||a>0?n+":":"",i=((n||r>=10)&&i<10?"0"+i:i)+":",t=t<10?"0"+t:t,n+i+t};let _a=qu;function zu(s){_a=s}function Wu(){_a=qu}function Yt(s,e=s){return _a(s,e)}var Zm=Object.freeze({__proto__:null,createTimeRanges:Ye,createTimeRange:Ye,setFormatTime:zu,resetFormatTime:Wu,formatTime:Yt});function Gu(s,e){let t=0,i,n;if(!e)return 0;(!s||!s.length)&&(s=Ye(0,0));for(let r=0;r<s.length;r++)i=s.start(r),n=s.end(r),n>e&&(n=e),t+=n-i;return t/e}function fe(s){if(s instanceof fe)return s;typeof s=="number"?this.code=s:typeof s=="string"?this.message=s:lt(s)&&(typeof s.code=="number"&&(this.code=s.code),Object.assign(this,s)),this.message||(this.message=fe.defaultMessages[this.code]||"")}fe.prototype.code=0;fe.prototype.message="";fe.prototype.status=null;fe.prototype.metadata=null;fe.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"];fe.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail part-way.",3:"The media playback was aborted due to a corruption problem or because the media used features your browser did not support.",4:"The media could not be loaded, either because the server or network failed or because the format is not supported.",5:"The media is encrypted and we do not have the keys to decrypt it."};fe.MEDIA_ERR_CUSTOM=0;fe.prototype.MEDIA_ERR_CUSTOM=0;fe.MEDIA_ERR_ABORTED=1;fe.prototype.MEDIA_ERR_ABORTED=1;fe.MEDIA_ERR_NETWORK=2;fe.prototype.MEDIA_ERR_NETWORK=2;fe.MEDIA_ERR_DECODE=3;fe.prototype.MEDIA_ERR_DECODE=3;fe.MEDIA_ERR_SRC_NOT_SUPPORTED=4;fe.prototype.MEDIA_ERR_SRC_NOT_SUPPORTED=4;fe.MEDIA_ERR_ENCRYPTED=5;fe.prototype.MEDIA_ERR_ENCRYPTED=5;function us(s){return s!=null&&typeof s.then=="function"}function nt(s){us(s)&&s.then(null,e=>{})}const Vr=function(s){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce((t,i,n)=>(s[i]&&(t[i]=s[i]),t),{cues:s.cues&&Array.prototype.map.call(s.cues,function(t){return{startTime:t.startTime,endTime:t.endTime,text:t.text,id:t.id}})})},eg=function(s){const e=s.$$("track"),t=Array.prototype.map.call(e,n=>n.track);return Array.prototype.map.call(e,function(n){const r=Vr(n.track);return n.src&&(r.src=n.src),r}).concat(Array.prototype.filter.call(s.textTracks(),function(n){return t.indexOf(n)===-1}).map(Vr))},tg=function(s,e){return s.forEach(function(t){const i=e.addRemoteTextTrack(t).track;!t.src&&t.cues&&t.cues.forEach(n=>i.addCue(n))}),e.textTracks()};var qr={textTracksToJson:eg,jsonToTextTracks:tg,trackToJson:Vr};const vr="vjs-modal-dialog";class Pi extends D{constructor(e,t){super(e,t),this.handleKeyDown_=i=>this.handleKeyDown(i),this.close_=i=>this.close(i),this.opened_=this.hasBeenOpened_=this.hasBeenFilled_=!1,this.closeable(!this.options_.uncloseable),this.content(this.options_.content),this.contentEl_=G("div",{className:`${vr}-content`},{role:"document"}),this.descEl_=G("p",{className:`${vr}-description vjs-control-text`,id:this.el().getAttribute("aria-describedby")}),Dt(this.descEl_,this.description()),this.el_.appendChild(this.descEl_),this.el_.appendChild(this.contentEl_)}createEl(){return super.createEl("div",{className:this.buildCSSClass(),tabIndex:-1},{"aria-describedby":`${this.id()}_description`,"aria-hidden":"true","aria-label":this.label(),role:"dialog","aria-live":"polite"})}dispose(){this.contentEl_=null,this.descEl_=null,this.previouslyActiveEl_=null,super.dispose()}buildCSSClass(){return`${vr} vjs-hidden ${super.buildCSSClass()}`}label(){return this.localize(this.options_.label||"Modal Window")}description(){let e=this.options_.description||this.localize("This is a modal window.");return this.closeable()&&(e+=" "+this.localize("This modal can be closed by pressing the Escape key or activating the close button.")),e}open(){if(this.opened_){this.options_.fillAlways&&this.fill();return}const e=this.player();this.trigger("beforemodalopen"),this.opened_=!0,(this.options_.fillAlways||!this.hasBeenOpened_&&!this.hasBeenFilled_)&&this.fill(),this.wasPlaying_=!e.paused(),this.options_.pauseOnOpen&&this.wasPlaying_&&e.pause(),this.on("keydown",this.handleKeyDown_),this.hadControls_=e.controls(),e.controls(!1),this.show(),this.conditionalFocus_(),this.el().setAttribute("aria-hidden","false"),this.trigger("modalopen"),this.hasBeenOpened_=!0}opened(e){return typeof e=="boolean"&&this[e?"open":"close"](),this.opened_}close(){if(!this.opened_)return;const e=this.player();this.trigger("beforemodalclose"),this.opened_=!1,this.wasPlaying_&&this.options_.pauseOnOpen&&e.play(),this.off("keydown",this.handleKeyDown_),this.hadControls_&&e.controls(!0),this.hide(),this.el().setAttribute("aria-hidden","true"),this.trigger({type:"modalclose",bubbles:!0}),this.conditionalBlur_(),this.options_.temporary&&this.dispose()}closeable(e){if(typeof e=="boolean"){const t=this.closeable_=!!e;let i=this.getChild("closeButton");if(t&&!i){const n=this.contentEl_;this.contentEl_=this.el_,i=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=n,this.on(i,"close",this.close_)}!t&&i&&(this.off(i,"close",this.close_),this.removeChild(i),i.dispose())}return this.closeable_}fill(){this.fillWith(this.content())}fillWith(e){const t=this.contentEl(),i=t.parentNode,n=t.nextSibling;this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,i.removeChild(t),this.empty(),Du(t,e),this.trigger("modalfill"),n?i.insertBefore(t,n):i.appendChild(t);const r=this.getChild("closeButton");r&&i.appendChild(r.el_),this.trigger("aftermodalfill")}empty(){this.trigger("beforemodalempty"),Fn(this.contentEl()),this.trigger("modalempty")}content(e){return typeof e<"u"&&(this.content_=e),this.content_}conditionalFocus_(){const e=N.activeElement,t=this.player_.el_;this.previouslyActiveEl_=null,(t.contains(e)||t===e)&&(this.previouslyActiveEl_=e,this.focus())}conditionalBlur_(){this.previouslyActiveEl_&&(this.previouslyActiveEl_.focus(),this.previouslyActiveEl_=null)}handleKeyDown(e){if(this.trigger({type:"modalKeydown",originalEvent:e,target:this,bubbles:!0}),e.stopPropagation(),e.key==="Escape"&&this.closeable()){e.preventDefault(),this.close();return}if(e.key!=="Tab")return;const t=this.focusableEls_(),i=this.el_.querySelector(":focus");let n;for(let r=0;r<t.length;r++)if(i===t[r]){n=r;break}N.activeElement===this.el_&&(n=0),e.shiftKey&&n===0?(t[t.length-1].focus(),e.preventDefault()):!e.shiftKey&&n===t.length-1&&(t[0].focus(),e.preventDefault())}focusableEls_(){const e=this.el_.querySelectorAll("*");return Array.prototype.filter.call(e,t=>(t instanceof x.HTMLAnchorElement||t instanceof x.HTMLAreaElement)&&t.hasAttribute("href")||(t instanceof x.HTMLInputElement||t instanceof x.HTMLSelectElement||t instanceof x.HTMLTextAreaElement||t instanceof x.HTMLButtonElement)&&!t.hasAttribute("disabled")||t instanceof x.HTMLIFrameElement||t instanceof x.HTMLObjectElement||t instanceof x.HTMLEmbedElement||t.hasAttribute("tabindex")&&t.getAttribute("tabindex")!==-1||t.hasAttribute("contenteditable"))}}Pi.prototype.options_={pauseOnOpen:!0,temporary:!0};D.registerComponent("ModalDialog",Pi);class Jt extends $e{constructor(e=[]){super(),this.tracks_=[],Object.defineProperty(this,"length",{get(){return this.tracks_.length}});for(let t=0;t<e.length;t++)this.addTrack(e[t])}addTrack(e){const t=this.tracks_.length;""+t in this||Object.defineProperty(this,t,{get(){return this.tracks_[t]}}),this.tracks_.indexOf(e)===-1&&(this.tracks_.push(e),this.trigger({track:e,type:"addtrack",target:this})),e.labelchange_=()=>{this.trigger({track:e,type:"labelchange",target:this})},gt(e)&&e.addEventListener("labelchange",e.labelchange_)}removeTrack(e){let t;for(let i=0,n=this.length;i<n;i++)if(this[i]===e){t=this[i],t.off&&t.off(),this.tracks_.splice(i,1);break}t&&this.trigger({track:t,type:"removetrack",target:this})}getTrackById(e){let t=null;for(let i=0,n=this.length;i<n;i++){const r=this[i];if(r.id===e){t=r;break}}return t}}Jt.prototype.allowedEvents_={change:"change",addtrack:"addtrack",removetrack:"removetrack",labelchange:"labelchange"};for(const s in Jt.prototype.allowedEvents_)Jt.prototype["on"+s]=null;const br=function(s,e){for(let t=0;t<s.length;t++)!Object.keys(s[t]).length||e.id===s[t].id||(s[t].enabled=!1)};class Ku extends Jt{constructor(e=[]){for(let t=e.length-1;t>=0;t--)if(e[t].enabled){br(e,e[t]);break}super(e),this.changing_=!1}addTrack(e){e.enabled&&br(this,e),super.addTrack(e),e.addEventListener&&(e.enabledChange_=()=>{this.changing_||(this.changing_=!0,br(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("enabledchange",e.enabledChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.enabledChange_&&(e.removeEventListener("enabledchange",e.enabledChange_),e.enabledChange_=null)}}const xr=function(s,e){for(let t=0;t<s.length;t++)!Object.keys(s[t]).length||e.id===s[t].id||(s[t].selected=!1)};class Qu extends Jt{constructor(e=[]){for(let t=e.length-1;t>=0;t--)if(e[t].selected){xr(e,e[t]);break}super(e),this.changing_=!1,Object.defineProperty(this,"selectedIndex",{get(){for(let t=0;t<this.length;t++)if(this[t].selected)return t;return-1},set(){}})}addTrack(e){e.selected&&xr(this,e),super.addTrack(e),e.addEventListener&&(e.selectedChange_=()=>{this.changing_||(this.changing_=!0,xr(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("selectedchange",e.selectedChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.selectedChange_&&(e.removeEventListener("selectedchange",e.selectedChange_),e.selectedChange_=null)}}class ya extends Jt{addTrack(e){super.addTrack(e),this.queueChange_||(this.queueChange_=()=>this.queueTrigger("change")),this.triggerSelectedlanguagechange||(this.triggerSelectedlanguagechange_=()=>this.trigger("selectedlanguagechange")),e.addEventListener("modechange",this.queueChange_),["metadata","chapters"].indexOf(e.kind)===-1&&e.addEventListener("modechange",this.triggerSelectedlanguagechange_)}removeTrack(e){super.removeTrack(e),e.removeEventListener&&(this.queueChange_&&e.removeEventListener("modechange",this.queueChange_),this.selectedlanguagechange_&&e.removeEventListener("modechange",this.triggerSelectedlanguagechange_))}toJSON(){return this.tracks_.map(e=>e.toJSON())}}class ig{constructor(e=[]){this.trackElements_=[],Object.defineProperty(this,"length",{get(){return this.trackElements_.length}});for(let t=0,i=e.length;t<i;t++)this.addTrackElement_(e[t])}addTrackElement_(e){const t=this.trackElements_.length;""+t in this||Object.defineProperty(this,t,{get(){return this.trackElements_[t]}}),this.trackElements_.indexOf(e)===-1&&this.trackElements_.push(e)}getTrackElementByTrack_(e){let t;for(let i=0,n=this.trackElements_.length;i<n;i++)if(e===this.trackElements_[i].track){t=this.trackElements_[i];break}return t}removeTrackElement_(e){for(let t=0,i=this.trackElements_.length;t<i;t++)if(e===this.trackElements_[t]){this.trackElements_[t].track&&typeof this.trackElements_[t].track.off=="function"&&this.trackElements_[t].track.off(),typeof this.trackElements_[t].off=="function"&&this.trackElements_[t].off(),this.trackElements_.splice(t,1);break}}}class mn{constructor(e){mn.prototype.setCues_.call(this,e),Object.defineProperty(this,"length",{get(){return this.length_}})}setCues_(e){const t=this.length||0;let i=0;const n=e.length;this.cues_=e,this.length_=e.length;const r=function(a){""+a in this||Object.defineProperty(this,""+a,{get(){return this.cues_[a]}})};if(t<n)for(i=t;i<n;i++)r.call(this,i)}getCueById(e){let t=null;for(let i=0,n=this.length;i<n;i++){const r=this[i];if(r.id===e){t=r;break}}return t}}const sg={alternative:"alternative",captions:"captions",main:"main",sign:"sign",subtitles:"subtitles",commentary:"commentary"},ng={alternative:"alternative",descriptions:"descriptions",main:"main","main-desc":"main-desc",translation:"translation",commentary:"commentary"},rg={subtitles:"subtitles",captions:"captions",descriptions:"descriptions",chapters:"chapters",metadata:"metadata"},ol={disabled:"disabled",hidden:"hidden",showing:"showing"};class Ta extends $e{constructor(e={}){super();const t={id:e.id||"vjs_track_"+ze(),kind:e.kind||"",language:e.language||""};let i=e.label||"";for(const n in t)Object.defineProperty(this,n,{get(){return t[n]},set(){}});Object.defineProperty(this,"label",{get(){return i},set(n){n!==i&&(i=n,this.trigger("labelchange"))}})}}const va=function(s){return new URL(s,N.baseURI)},Xu=function(s){return new URL(s,N.baseURI).href},ba=function(s){if(typeof s=="string"){const t=s.split("?")[0].replace(/\/+$/,"").match(/\.([^.\/]+)$/);return t?t[1].toLowerCase():""}return""},$n=function(s,e=x.location){return va(s).origin!==e.origin};var ag=Object.freeze({__proto__:null,parseUrl:va,getAbsoluteURL:Xu,getFileExtension:ba,isCrossOrigin:$n});const ll=function(s,e){const t=new x.WebVTT.Parser(x,x.vttjs,x.WebVTT.StringDecoder()),i=[];t.oncue=function(n){e.addCue(n)},t.onparsingerror=function(n){i.push(n)},t.onflush=function(){e.trigger({type:"loadeddata",target:e})},t.parse(s),i.length>0&&(x.console&&x.console.groupCollapsed&&x.console.groupCollapsed(`Text Track parsing errors for ${e.src}`),i.forEach(n=>X.error(n)),x.console&&x.console.groupEnd&&x.console.groupEnd()),t.flush()},ul=function(s,e){const t={uri:s},i=$n(s);i&&(t.cors=i);const n=e.tech_.crossOrigin()==="use-credentials";n&&(t.withCredentials=n),iu(t,re(this,function(r,a,l){if(r)return X.error(r,a);e.loaded_=!0,typeof x.WebVTT!="function"?e.tech_&&e.tech_.any(["vttjsloaded","vttjserror"],c=>{if(c.type==="vttjserror"){X.error(`vttjs failed to load, stopping trying to process ${e.src}`);return}return ll(l,e)}):ll(l,e)}))};class gs extends Ta{constructor(e={}){if(!e.tech)throw new Error("A tech was not provided.");const t=se(e,{kind:rg[e.kind]||"subtitles",language:e.language||e.srclang||""});let i=ol[t.mode]||"disabled";const n=t.default;(t.kind==="metadata"||t.kind==="chapters")&&(i="hidden"),super(t),this.tech_=t.tech,this.cues_=[],this.activeCues_=[],this.preload_=this.tech_.preloadTextTracks!==!1;const r=new mn(this.cues_),a=new mn(this.activeCues_);let l=!1;this.timeupdateHandler=re(this,function(p={}){if(!this.tech_.isDisposed()){if(!this.tech_.isReady_){p.type!=="timeupdate"&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler));return}this.activeCues=this.activeCues,l&&(this.trigger("cuechange"),l=!1),p.type!=="timeupdate"&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler))}});const c=()=>{this.stopTracking()};this.tech_.one("dispose",c),i!=="disabled"&&this.startTracking(),Object.defineProperties(this,{default:{get(){return n},set(){}},mode:{get(){return i},set(p){ol[p]&&i!==p&&(i=p,!this.preload_&&i!=="disabled"&&this.cues.length===0&&ul(this.src,this),this.stopTracking(),i!=="disabled"&&this.startTracking(),this.trigger("modechange"))}},cues:{get(){return this.loaded_?r:null},set(){}},activeCues:{get(){if(!this.loaded_)return null;if(this.cues.length===0)return a;const p=this.tech_.currentTime(),g=[];for(let _=0,S=this.cues.length;_<S;_++){const E=this.cues[_];E.startTime<=p&&E.endTime>=p&&g.push(E)}if(l=!1,g.length!==this.activeCues_.length)l=!0;else for(let _=0;_<g.length;_++)this.activeCues_.indexOf(g[_])===-1&&(l=!0);return this.activeCues_=g,a.setCues_(this.activeCues_),a},set(){}}}),t.src?(this.src=t.src,this.preload_||(this.loaded_=!0),(this.preload_||t.kind!=="subtitles"&&t.kind!=="captions")&&ul(this.src,this)):this.loaded_=!0}startTracking(){this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler),this.tech_.on("timeupdate",this.timeupdateHandler)}stopTracking(){this.rvf_&&(this.tech_.cancelVideoFrameCallback(this.rvf_),this.rvf_=void 0),this.tech_.off("timeupdate",this.timeupdateHandler)}addCue(e){let t=e;if(!("getCueAsHTML"in t)){t=new x.vttjs.VTTCue(e.startTime,e.endTime,e.text);for(const n in e)n in t||(t[n]=e[n]);t.id=e.id,t.originalCue_=e}const i=this.tech_.textTracks();for(let n=0;n<i.length;n++)i[n]!==this&&i[n].removeCue(t);this.cues_.push(t),this.cues.setCues_(this.cues_)}toJSON(){return qr.trackToJson(this)}removeCue(e){let t=this.cues_.length;for(;t--;){const i=this.cues_[t];if(i===e||i.originalCue_&&i.originalCue_===e){this.cues_.splice(t,1),this.cues.setCues_(this.cues_);break}}}}gs.prototype.allowedEvents_={cuechange:"cuechange"};class Yu extends Ta{constructor(e={}){const t=se(e,{kind:ng[e.kind]||""});super(t);let i=!1;Object.defineProperty(this,"enabled",{get(){return i},set(n){typeof n!="boolean"||n===i||(i=n,this.trigger("enabledchange"))}}),t.enabled&&(this.enabled=t.enabled),this.loaded_=!0}}class Ju extends Ta{constructor(e={}){const t=se(e,{kind:sg[e.kind]||""});super(t);let i=!1;Object.defineProperty(this,"selected",{get(){return i},set(n){typeof n!="boolean"||n===i||(i=n,this.trigger("selectedchange"))}}),t.selected&&(this.selected=t.selected)}}class yt extends $e{constructor(e={}){super();let t;const i=new gs(e);this.kind=i.kind,this.src=i.src,this.srclang=i.language,this.label=i.label,this.default=i.default,Object.defineProperties(this,{readyState:{get(){return t}},track:{get(){return i}}}),t=yt.NONE,i.addEventListener("loadeddata",()=>{t=yt.LOADED,this.trigger({type:"load",target:this})})}}yt.prototype.allowedEvents_={load:"load"};yt.NONE=0;yt.LOADING=1;yt.LOADED=2;yt.ERROR=3;const qe={audio:{ListClass:Ku,TrackClass:Yu,capitalName:"Audio"},video:{ListClass:Qu,TrackClass:Ju,capitalName:"Video"},text:{ListClass:ya,TrackClass:gs,capitalName:"Text"}};Object.keys(qe).forEach(function(s){qe[s].getterName=`${s}Tracks`,qe[s].privateName=`${s}Tracks_`});const Si={remoteText:{ListClass:ya,TrackClass:gs,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:ig,TrackClass:yt,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}},Ie=Object.assign({},qe,Si);Si.names=Object.keys(Si);qe.names=Object.keys(qe);Ie.names=[].concat(Si.names).concat(qe.names);function og(s,e,t,i,n={}){const r=s.textTracks();n.kind=e,t&&(n.label=t),i&&(n.language=i),n.tech=s;const a=new Ie.text.TrackClass(n);return r.addTrack(a),a}class K extends D{constructor(e={},t=function(){}){e.reportTouchActivity=!1,super(null,e,t),this.onDurationChange_=i=>this.onDurationChange(i),this.trackProgress_=i=>this.trackProgress(i),this.trackCurrentTime_=i=>this.trackCurrentTime(i),this.stopTrackingCurrentTime_=i=>this.stopTrackingCurrentTime(i),this.disposeSourceHandler_=i=>this.disposeSourceHandler(i),this.queuedHanders_=new Set,this.hasStarted_=!1,this.on("playing",function(){this.hasStarted_=!0}),this.on("loadstart",function(){this.hasStarted_=!1}),Ie.names.forEach(i=>{const n=Ie[i];e&&e[n.getterName]&&(this[n.privateName]=e[n.getterName])}),this.featuresProgressEvents||this.manualProgressOn(),this.featuresTimeupdateEvents||this.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach(i=>{e[`native${i}Tracks`]===!1&&(this[`featuresNative${i}Tracks`]=!1)}),e.nativeCaptions===!1||e.nativeTextTracks===!1?this.featuresNativeTextTracks=!1:(e.nativeCaptions===!0||e.nativeTextTracks===!0)&&(this.featuresNativeTextTracks=!0),this.featuresNativeTextTracks||this.emulateTextTracks(),this.preloadTextTracks=e.preloadTextTracks!==!1,this.autoRemoteTextTracks_=new Ie.text.ListClass,this.initTrackListeners(),e.nativeControlsForTouch||this.emitTapEvents(),this.constructor&&(this.name_=this.constructor.name||"Unknown Tech")}triggerSourceset(e){this.isReady_||this.one("ready",()=>this.setTimeout(()=>this.triggerSourceset(e),1)),this.trigger({src:e,type:"sourceset"})}manualProgressOn(){this.on("durationchange",this.onDurationChange_),this.manualProgress=!0,this.one("ready",this.trackProgress_)}manualProgressOff(){this.manualProgress=!1,this.stopTrackingProgress(),this.off("durationchange",this.onDurationChange_)}trackProgress(e){this.stopTrackingProgress(),this.progressInterval=this.setInterval(re(this,function(){const t=this.bufferedPercent();this.bufferedPercent_!==t&&this.trigger("progress"),this.bufferedPercent_=t,t===1&&this.stopTrackingProgress()}),500)}onDurationChange(e){this.duration_=this.duration()}buffered(){return Ye(0,0)}bufferedPercent(){return Gu(this.buffered(),this.duration_)}stopTrackingProgress(){this.clearInterval(this.progressInterval)}manualTimeUpdatesOn(){this.manualTimeUpdates=!0,this.on("play",this.trackCurrentTime_),this.on("pause",this.stopTrackingCurrentTime_)}manualTimeUpdatesOff(){this.manualTimeUpdates=!1,this.stopTrackingCurrentTime(),this.off("play",this.trackCurrentTime_),this.off("pause",this.stopTrackingCurrentTime_)}trackCurrentTime(){this.currentTimeInterval&&this.stopTrackingCurrentTime(),this.currentTimeInterval=this.setInterval(function(){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},250)}stopTrackingCurrentTime(){this.clearInterval(this.currentTimeInterval),this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}dispose(){this.clearTracks(qe.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),super.dispose()}clearTracks(e){e=[].concat(e),e.forEach(t=>{const i=this[`${t}Tracks`]()||[];let n=i.length;for(;n--;){const r=i[n];t==="text"&&this.removeRemoteTextTrack(r),i.removeTrack(r)}})}cleanupAutoTextTracks(){const e=this.autoRemoteTextTracks_||[];let t=e.length;for(;t--;){const i=e[t];this.removeRemoteTextTrack(i)}}reset(){}crossOrigin(){}setCrossOrigin(){}error(e){return e!==void 0&&(this.error_=new fe(e),this.trigger("error")),this.error_}played(){return this.hasStarted_?Ye(0,0):Ye()}play(){}setScrubbing(e){}scrubbing(){}setCurrentTime(e){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}initTrackListeners(){qe.names.forEach(e=>{const t=qe[e],i=()=>{this.trigger(`${e}trackchange`)},n=this[t.getterName]();n.addEventListener("removetrack",i),n.addEventListener("addtrack",i),this.on("dispose",()=>{n.removeEventListener("removetrack",i),n.removeEventListener("addtrack",i)})})}addWebVttScript_(){if(!x.WebVTT)if(N.body.contains(this.el())){if(!this.options_["vtt.js"]&&Ti(Qo)&&Object.keys(Qo).length>0){this.trigger("vttjsloaded");return}const e=N.createElement("script");e.src=this.options_["vtt.js"]||"https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js",e.onload=()=>{this.trigger("vttjsloaded")},e.onerror=()=>{this.trigger("vttjserror")},this.on("dispose",()=>{e.onload=null,e.onerror=null}),x.WebVTT=!0,this.el().parentNode.appendChild(e)}else this.ready(this.addWebVttScript_)}emulateTextTracks(){const e=this.textTracks(),t=this.remoteTextTracks(),i=l=>e.addTrack(l.track),n=l=>e.removeTrack(l.track);t.on("addtrack",i),t.on("removetrack",n),this.addWebVttScript_();const r=()=>this.trigger("texttrackchange"),a=()=>{r();for(let l=0;l<e.length;l++){const c=e[l];c.removeEventListener("cuechange",r),c.mode==="showing"&&c.addEventListener("cuechange",r)}};a(),e.addEventListener("change",a),e.addEventListener("addtrack",a),e.addEventListener("removetrack",a),this.on("dispose",function(){t.off("addtrack",i),t.off("removetrack",n),e.removeEventListener("change",a),e.removeEventListener("addtrack",a),e.removeEventListener("removetrack",a);for(let l=0;l<e.length;l++)e[l].removeEventListener("cuechange",r)})}addTextTrack(e,t,i){if(!e)throw new Error("TextTrack kind is required but was not provided");return og(this,e,t,i)}createRemoteTextTrack(e){const t=se(e,{tech:this});return new Si.remoteTextEl.TrackClass(t)}addRemoteTextTrack(e={},t){const i=this.createRemoteTextTrack(e);return typeof t!="boolean"&&(t=!1),this.remoteTextTrackEls().addTrackElement_(i),this.remoteTextTracks().addTrack(i.track),t===!1&&this.ready(()=>this.autoRemoteTextTracks_.addTrack(i.track)),i}removeRemoteTextTrack(e){const t=this.remoteTextTrackEls().getTrackElementByTrack_(e);this.remoteTextTrackEls().removeTrackElement_(t),this.remoteTextTracks().removeTrack(e),this.autoRemoteTextTracks_.removeTrack(e)}getVideoPlaybackQuality(){return{}}requestPictureInPicture(){return Promise.reject()}disablePictureInPicture(){return!0}setDisablePictureInPicture(){}requestVideoFrameCallback(e){const t=ze();return!this.isReady_||this.paused()?(this.queuedHanders_.add(t),this.one("playing",()=>{this.queuedHanders_.has(t)&&(this.queuedHanders_.delete(t),e())})):this.requestNamedAnimationFrame(t,e),t}cancelVideoFrameCallback(e){this.queuedHanders_.has(e)?this.queuedHanders_.delete(e):this.cancelNamedAnimationFrame(e)}setPoster(){}playsinline(){}setPlaysinline(){}overrideNativeAudioTracks(e){}overrideNativeVideoTracks(e){}canPlayType(e){return""}static canPlayType(e){return""}static canPlaySource(e,t){return K.canPlayType(e.type)}static isTech(e){return e.prototype instanceof K||e instanceof K||e===K}static registerTech(e,t){if(K.techs_||(K.techs_={}),!K.isTech(t))throw new Error(`Tech ${e} must be a Tech`);if(!K.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(!K.canPlaySource)throw new Error("Techs must have a static canPlaySource method on them");return e=pe(e),K.techs_[e]=t,K.techs_[ls(e)]=t,e!=="Tech"&&K.defaultTechOrder_.push(e),t}static getTech(e){if(e){if(K.techs_&&K.techs_[e])return K.techs_[e];if(e=pe(e),x&&x.videojs&&x.videojs[e])return X.warn(`The ${e} tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)`),x.videojs[e]}}}Ie.names.forEach(function(s){const e=Ie[s];K.prototype[e.getterName]=function(){return this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName]}});K.prototype.featuresVolumeControl=!0;K.prototype.featuresMuteControl=!0;K.prototype.featuresFullscreenResize=!1;K.prototype.featuresPlaybackRate=!1;K.prototype.featuresProgressEvents=!1;K.prototype.featuresSourceset=!1;K.prototype.featuresTimeupdateEvents=!1;K.prototype.featuresNativeTextTracks=!1;K.prototype.featuresVideoFrameCallback=!1;K.withSourceHandlers=function(s){s.registerSourceHandler=function(t,i){let n=s.sourceHandlers;n||(n=s.sourceHandlers=[]),i===void 0&&(i=n.length),n.splice(i,0,t)},s.canPlayType=function(t){const i=s.sourceHandlers||[];let n;for(let r=0;r<i.length;r++)if(n=i[r].canPlayType(t),n)return n;return""},s.selectSourceHandler=function(t,i){const n=s.sourceHandlers||[];let r;for(let a=0;a<n.length;a++)if(r=n[a].canHandleSource(t,i),r)return n[a];return null},s.canPlaySource=function(t,i){const n=s.selectSourceHandler(t,i);return n?n.canHandleSource(t,i):""},["seekable","seeking","duration"].forEach(function(t){const i=this[t];typeof i=="function"&&(this[t]=function(){return this.sourceHandler_&&this.sourceHandler_[t]?this.sourceHandler_[t].apply(this.sourceHandler_,arguments):i.apply(this,arguments)})},s.prototype),s.prototype.setSource=function(t){let i=s.selectSourceHandler(t,this.options_);i||(s.nativeSourceHandler?i=s.nativeSourceHandler:X.error("No source handler found for the current source.")),this.disposeSourceHandler(),this.off("dispose",this.disposeSourceHandler_),i!==s.nativeSourceHandler&&(this.currentSource_=t),this.sourceHandler_=i.handleSource(t,this,this.options_),this.one("dispose",this.disposeSourceHandler_)},s.prototype.disposeSourceHandler=function(){this.currentSource_&&(this.clearTracks(["audio","video"]),this.currentSource_=null),this.cleanupAutoTextTracks(),this.sourceHandler_&&(this.sourceHandler_.dispose&&this.sourceHandler_.dispose(),this.sourceHandler_=null)}};D.registerComponent("Tech",K);K.registerTech("Tech",K);K.defaultTechOrder_=[];const Kt={},gn={},_n={};function lg(s,e){Kt[s]=Kt[s]||[],Kt[s].push(e)}function ug(s,e,t){s.setTimeout(()=>Ht(e,Kt[e.type],t,s),1)}function hg(s,e){s.forEach(t=>t.setTech&&t.setTech(e))}function dg(s,e,t){return s.reduceRight(xa(t),e[t]())}function cg(s,e,t,i){return e[t](s.reduce(xa(t),i))}function hl(s,e,t,i=null){const n="call"+pe(t),r=s.reduce(xa(n),i),a=r===_n,l=a?null:e[t](r);return mg(s,t,l,a),l}const fg={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},pg={setCurrentTime:1,setMuted:1,setVolume:1},dl={play:1,pause:1};function xa(s){return(e,t)=>e===_n?_n:t[s]?t[s](e):e}function mg(s,e,t,i){for(let n=s.length-1;n>=0;n--){const r=s[n];r[e]&&r[e](i,t)}}function gg(s){gn.hasOwnProperty(s.id())&&delete gn[s.id()]}function _g(s,e){const t=gn[s.id()];let i=null;if(t==null)return i=e(s),gn[s.id()]=[[e,i]],i;for(let n=0;n<t.length;n++){const[r,a]=t[n];r===e&&(i=a)}return i===null&&(i=e(s),t.push([e,i])),i}function Ht(s={},e=[],t,i,n=[],r=!1){const[a,...l]=e;if(typeof a=="string")Ht(s,Kt[a],t,i,n,r);else if(a){const c=_g(i,a);if(!c.setSource)return n.push(c),Ht(s,l,t,i,n,r);c.setSource(Object.assign({},s),function(p,g){if(p)return Ht(s,l,t,i,n,r);n.push(c),Ht(g,s.type===g.type?l:Kt[g.type],t,i,n,r)})}else l.length?Ht(s,l,t,i,n,r):r?t(s,n):Ht(s,Kt["*"],t,i,n,!0)}const yg={opus:"video/ogg",ogv:"video/ogg",mp4:"video/mp4",mov:"video/mp4",m4v:"video/mp4",mkv:"video/x-matroska",m4a:"audio/mp4",mp3:"audio/mpeg",aac:"audio/aac",caf:"audio/x-caf",flac:"audio/flac",oga:"audio/ogg",wav:"audio/wav",m3u8:"application/x-mpegURL",mpd:"application/dash+xml",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",png:"image/png",svg:"image/svg+xml",webp:"image/webp"},yn=function(s=""){const e=ba(s);return yg[e.toLowerCase()]||""},Tg=(s,e)=>{if(!e)return"";if(s.cache_.source.src===e&&s.cache_.source.type)return s.cache_.source.type;const t=s.cache_.sources.filter(n=>n.src===e);if(t.length)return t[0].type;const i=s.$$("source");for(let n=0;n<i.length;n++){const r=i[n];if(r.type&&r.src&&r.src===e)return r.type}return yn(e)},Zu=function(s){if(Array.isArray(s)){let e=[];s.forEach(function(t){t=Zu(t),Array.isArray(t)?e=e.concat(t):lt(t)&&e.push(t)}),s=e}else typeof s=="string"&&s.trim()?s=[cl({src:s})]:lt(s)&&typeof s.src=="string"&&s.src&&s.src.trim()?s=[cl(s)]:s=[];return s};function cl(s){if(!s.type){const e=yn(s.src);e&&(s.type=e)}return s}var vg=`<svg xmlns="http://www.w3.org/2000/svg">
|
|
27
|
-
<defs>
|
|
28
|
-
<symbol viewBox="0 0 48 48" id="vjs-icon-play">
|
|
29
|
-
<path d="M16 10v28l22-14z"></path>
|
|
30
|
-
</symbol>
|
|
31
|
-
<symbol viewBox="0 0 48 48" id="vjs-icon-pause">
|
|
32
|
-
<path d="M12 38h8V10h-8v28zm16-28v28h8V10h-8z"></path>
|
|
33
|
-
</symbol>
|
|
34
|
-
<symbol viewBox="0 0 48 48" id="vjs-icon-audio">
|
|
35
|
-
<path d="M24 2C14.06 2 6 10.06 6 20v14c0 3.31 2.69 6 6 6h6V24h-8v-4c0-7.73 6.27-14 14-14s14 6.27 14 14v4h-8v16h6c3.31 0 6-2.69 6-6V20c0-9.94-8.06-18-18-18z"></path>
|
|
36
|
-
</symbol>
|
|
37
|
-
<symbol viewBox="0 0 48 48" id="vjs-icon-captions">
|
|
38
|
-
<path d="M38 8H10c-2.21 0-4 1.79-4 4v24c0 2.21 1.79 4 4 4h28c2.21 0 4-1.79 4-4V12c0-2.21-1.79-4-4-4zM22 22h-3v-1h-4v6h4v-1h3v2a2 2 0 0 1-2 2h-6a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v2zm14 0h-3v-1h-4v6h4v-1h3v2a2 2 0 0 1-2 2h-6a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v2z"></path>
|
|
39
|
-
</symbol>
|
|
40
|
-
<symbol viewBox="0 0 48 48" id="vjs-icon-subtitles">
|
|
41
|
-
<path d="M40 8H8c-2.21 0-4 1.79-4 4v24c0 2.21 1.79 4 4 4h32c2.21 0 4-1.79 4-4V12c0-2.21-1.79-4-4-4zM8 24h8v4H8v-4zm20 12H8v-4h20v4zm12 0h-8v-4h8v4zm0-8H20v-4h20v4z"></path>
|
|
42
|
-
</symbol>
|
|
43
|
-
<symbol viewBox="0 0 48 48" id="vjs-icon-fullscreen-enter">
|
|
44
|
-
<path d="M14 28h-4v10h10v-4h-6v-6zm-4-8h4v-6h6v-4H10v10zm24 14h-6v4h10V28h-4v6zm-6-24v4h6v6h4V10H28z"></path>
|
|
45
|
-
</symbol>
|
|
46
|
-
<symbol viewBox="0 0 48 48" id="vjs-icon-fullscreen-exit">
|
|
47
|
-
<path d="M10 32h6v6h4V28H10v4zm6-16h-6v4h10V10h-4v6zm12 22h4v-6h6v-4H28v10zm4-22v-6h-4v10h10v-4h-6z"></path>
|
|
48
|
-
</symbol>
|
|
49
|
-
<symbol viewBox="0 0 48 48" id="vjs-icon-play-circle">
|
|
50
|
-
<path d="M20 33l12-9-12-9v18zm4-29C12.95 4 4 12.95 4 24s8.95 20 20 20 20-8.95 20-20S35.05 4 24 4zm0 36c-8.82 0-16-7.18-16-16S15.18 8 24 8s16 7.18 16 16-7.18 16-16 16z"></path>
|
|
51
|
-
</symbol>
|
|
52
|
-
<symbol viewBox="0 0 48 48" id="vjs-icon-volume-mute">
|
|
53
|
-
<path d="M33 24c0-3.53-2.04-6.58-5-8.05v4.42l4.91 4.91c.06-.42.09-.85.09-1.28zm5 0c0 1.88-.41 3.65-1.08 5.28l3.03 3.03C41.25 29.82 42 27 42 24c0-8.56-5.99-15.72-14-17.54v4.13c5.78 1.72 10 7.07 10 13.41zM8.55 6L6 8.55 15.45 18H6v12h8l10 10V26.55l8.51 8.51c-1.34 1.03-2.85 1.86-4.51 2.36v4.13a17.94 17.94 0 0 0 7.37-3.62L39.45 42 42 39.45l-18-18L8.55 6zM24 8l-4.18 4.18L24 16.36V8z"></path>
|
|
54
|
-
</symbol>
|
|
55
|
-
<symbol viewBox="0 0 48 48" id="vjs-icon-volume-low">
|
|
56
|
-
<path d="M14 18v12h8l10 10V8L22 18h-8z"></path>
|
|
57
|
-
</symbol>
|
|
58
|
-
<symbol viewBox="0 0 48 48" id="vjs-icon-volume-medium">
|
|
59
|
-
<path d="M37 24c0-3.53-2.04-6.58-5-8.05v16.11c2.96-1.48 5-4.53 5-8.06zm-27-6v12h8l10 10V8L18 18h-8z"></path>
|
|
60
|
-
</symbol>
|
|
61
|
-
<symbol viewBox="0 0 48 48" id="vjs-icon-volume-high">
|
|
62
|
-
<path d="M6 18v12h8l10 10V8L14 18H6zm27 6c0-3.53-2.04-6.58-5-8.05v16.11c2.96-1.48 5-4.53 5-8.06zM28 6.46v4.13c5.78 1.72 10 7.07 10 13.41s-4.22 11.69-10 13.41v4.13c8.01-1.82 14-8.97 14-17.54S36.01 8.28 28 6.46z"></path>
|
|
63
|
-
</symbol>
|
|
64
|
-
<symbol viewBox="0 0 48 48" id="vjs-icon-spinner">
|
|
65
|
-
<path d="M18.8 21l9.53-16.51C26.94 4.18 25.49 4 24 4c-4.8 0-9.19 1.69-12.64 4.51l7.33 12.69.11-.2zm24.28-3c-1.84-5.85-6.3-10.52-11.99-12.68L23.77 18h19.31zm.52 2H28.62l.58 1 9.53 16.5C41.99 33.94 44 29.21 44 24c0-1.37-.14-2.71-.4-4zm-26.53 4l-7.8-13.5C6.01 14.06 4 18.79 4 24c0 1.37.14 2.71.4 4h14.98l-2.31-4zM4.92 30c1.84 5.85 6.3 10.52 11.99 12.68L24.23 30H4.92zm22.54 0l-7.8 13.51c1.4.31 2.85.49 4.34.49 4.8 0 9.19-1.69 12.64-4.51L29.31 26.8 27.46 30z"></path>
|
|
66
|
-
</symbol>
|
|
67
|
-
<symbol viewBox="0 0 24 24" id="vjs-icon-hd">
|
|
68
|
-
<path d="M19 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-8 12H9.5v-2h-2v2H6V9h1.5v2.5h2V9H11v6zm2-6h4c.55 0 1 .45 1 1v4c0 .55-.45 1-1 1h-4V9zm1.5 4.5h2v-3h-2v3z"></path>
|
|
69
|
-
</symbol>
|
|
70
|
-
<symbol viewBox="0 0 48 48" id="vjs-icon-chapters">
|
|
71
|
-
<path d="M6 26h4v-4H6v4zm0 8h4v-4H6v4zm0-16h4v-4H6v4zm8 8h28v-4H14v4zm0 8h28v-4H14v4zm0-20v4h28v-4H14z"></path>
|
|
72
|
-
</symbol>
|
|
73
|
-
<symbol viewBox="0 0 40 40" id="vjs-icon-downloading">
|
|
74
|
-
<path d="M18.208 36.875q-3.208-.292-5.979-1.729-2.771-1.438-4.812-3.729-2.042-2.292-3.188-5.229-1.146-2.938-1.146-6.23 0-6.583 4.334-11.416 4.333-4.834 10.833-5.5v3.166q-5.167.75-8.583 4.646Q6.25 14.75 6.25 19.958q0 5.209 3.396 9.104 3.396 3.896 8.562 4.646zM20 28.417L11.542 20l2.083-2.083 4.917 4.916v-11.25h2.916v11.25l4.875-4.916L28.417 20zm1.792 8.458v-3.167q1.833-.25 3.541-.958 1.709-.708 3.167-1.875l2.333 2.292q-1.958 1.583-4.25 2.541-2.291.959-4.791 1.167zm6.791-27.792q-1.541-1.125-3.25-1.854-1.708-.729-3.541-1.021V3.042q2.5.25 4.77 1.208 2.271.958 4.271 2.5zm4.584 21.584l-2.25-2.25q1.166-1.5 1.854-3.209.687-1.708.937-3.541h3.209q-.292 2.5-1.229 4.791-.938 2.292-2.521 4.209zm.541-12.417q-.291-1.833-.958-3.562-.667-1.73-1.833-3.188l2.375-2.208q1.541 1.916 2.458 4.208.917 2.292 1.167 4.75z"></path>
|
|
75
|
-
</symbol>
|
|
76
|
-
<symbol viewBox="0 0 48 48" id="vjs-icon-file-download">
|
|
77
|
-
<path d="M10.8 40.55q-1.35 0-2.375-1T7.4 37.15v-7.7h3.4v7.7h26.35v-7.7h3.4v7.7q0 1.4-1 2.4t-2.4 1zM24 32.1L13.9 22.05l2.45-2.45 5.95 5.95V7.15h3.4v18.4l5.95-5.95 2.45 2.45z"></path>
|
|
78
|
-
</symbol>
|
|
79
|
-
<symbol viewBox="0 0 48 48" id="vjs-icon-file-download-done">
|
|
80
|
-
<path d="M9.8 40.5v-3.45h28.4v3.45zm9.2-9.05L7.4 19.85l2.45-2.35L19 26.65l19.2-19.2 2.4 2.4z"></path>
|
|
81
|
-
</symbol>
|
|
82
|
-
<symbol viewBox="0 0 48 48" id="vjs-icon-file-download-off">
|
|
83
|
-
<path d="M4.9 4.75L43.25 43.1 41 45.3l-4.75-4.75q-.05.05-.075.025-.025-.025-.075-.025H10.8q-1.35 0-2.375-1T7.4 37.15v-7.7h3.4v7.7h22.05l-7-7-1.85 1.8L13.9 21.9l1.85-1.85L2.7 7zm26.75 14.7l2.45 2.45-3.75 3.8-2.45-2.5zM25.7 7.15V21.1l-3.4-3.45V7.15z"></path>
|
|
84
|
-
</symbol>
|
|
85
|
-
<symbol viewBox="0 0 48 48" id="vjs-icon-share">
|
|
86
|
-
<path d="M36 32.17c-1.52 0-2.89.59-3.93 1.54L17.82 25.4c.11-.45.18-.92.18-1.4s-.07-.95-.18-1.4l14.1-8.23c1.07 1 2.5 1.62 4.08 1.62 3.31 0 6-2.69 6-6s-2.69-6-6-6-6 2.69-6 6c0 .48.07.95.18 1.4l-14.1 8.23c-1.07-1-2.5-1.62-4.08-1.62-3.31 0-6 2.69-6 6s2.69 6 6 6c1.58 0 3.01-.62 4.08-1.62l14.25 8.31c-.1.42-.16.86-.16 1.31A5.83 5.83 0 1 0 36 32.17z"></path>
|
|
87
|
-
</symbol>
|
|
88
|
-
<symbol viewBox="0 0 48 48" id="vjs-icon-cog">
|
|
89
|
-
<path d="M38.86 25.95c.08-.64.14-1.29.14-1.95s-.06-1.31-.14-1.95l4.23-3.31c.38-.3.49-.84.24-1.28l-4-6.93c-.25-.43-.77-.61-1.22-.43l-4.98 2.01c-1.03-.79-2.16-1.46-3.38-1.97L29 4.84c-.09-.47-.5-.84-1-.84h-8c-.5 0-.91.37-.99.84l-.75 5.3a14.8 14.8 0 0 0-3.38 1.97L9.9 10.1a1 1 0 0 0-1.22.43l-4 6.93c-.25.43-.14.97.24 1.28l4.22 3.31C9.06 22.69 9 23.34 9 24s.06 1.31.14 1.95l-4.22 3.31c-.38.3-.49.84-.24 1.28l4 6.93c.25.43.77.61 1.22.43l4.98-2.01c1.03.79 2.16 1.46 3.38 1.97l.75 5.3c.08.47.49.84.99.84h8c.5 0 .91-.37.99-.84l.75-5.3a14.8 14.8 0 0 0 3.38-1.97l4.98 2.01a1 1 0 0 0 1.22-.43l4-6.93c.25-.43.14-.97-.24-1.28l-4.22-3.31zM24 31c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7z"></path>
|
|
90
|
-
</symbol>
|
|
91
|
-
<symbol viewBox="0 0 48 48" id="vjs-icon-square">
|
|
92
|
-
<path d="M36 8H12c-2.21 0-4 1.79-4 4v24c0 2.21 1.79 4 4 4h24c2.21 0 4-1.79 4-4V12c0-2.21-1.79-4-4-4zm0 28H12V12h24v24z"></path>
|
|
93
|
-
</symbol>
|
|
94
|
-
<symbol viewBox="0 0 48 48" id="vjs-icon-circle">
|
|
95
|
-
<circle cx="24" cy="24" r="20"></circle>
|
|
96
|
-
</symbol>
|
|
97
|
-
<symbol viewBox="0 0 48 48" id="vjs-icon-circle-outline">
|
|
98
|
-
<path d="M24 4C12.95 4 4 12.95 4 24s8.95 20 20 20 20-8.95 20-20S35.05 4 24 4zm0 36c-8.82 0-16-7.18-16-16S15.18 8 24 8s16 7.18 16 16-7.18 16-16 16z"></path>
|
|
99
|
-
</symbol>
|
|
100
|
-
<symbol viewBox="0 0 48 48" id="vjs-icon-circle-inner-circle">
|
|
101
|
-
<path d="M24 4C12.97 4 4 12.97 4 24s8.97 20 20 20 20-8.97 20-20S35.03 4 24 4zm0 36c-8.82 0-16-7.18-16-16S15.18 8 24 8s16 7.18 16 16-7.18 16-16 16zm6-16c0 3.31-2.69 6-6 6s-6-2.69-6-6 2.69-6 6-6 6 2.69 6 6z"></path>
|
|
102
|
-
</symbol>
|
|
103
|
-
<symbol viewBox="0 0 48 48" id="vjs-icon-cancel">
|
|
104
|
-
<path d="M24 4C12.95 4 4 12.95 4 24s8.95 20 20 20 20-8.95 20-20S35.05 4 24 4zm10 27.17L31.17 34 24 26.83 16.83 34 14 31.17 21.17 24 14 16.83 16.83 14 24 21.17 31.17 14 34 16.83 26.83 24 34 31.17z"></path>
|
|
105
|
-
</symbol>
|
|
106
|
-
<symbol viewBox="0 0 48 48" id="vjs-icon-replay">
|
|
107
|
-
<path d="M24 10V2L14 12l10 10v-8c6.63 0 12 5.37 12 12s-5.37 12-12 12-12-5.37-12-12H8c0 8.84 7.16 16 16 16s16-7.16 16-16-7.16-16-16-16z"></path>
|
|
108
|
-
</symbol>
|
|
109
|
-
<symbol viewBox="0 0 48 48" id="vjs-icon-repeat">
|
|
110
|
-
<path d="M14 14h20v6l8-8-8-8v6H10v12h4v-8zm20 20H14v-6l-8 8 8 8v-6h24V26h-4v8z"></path>
|
|
111
|
-
</symbol>
|
|
112
|
-
<symbol viewBox="0 96 48 48" id="vjs-icon-replay-5">
|
|
113
|
-
<path d="M17.689 98l-8.697 8.696 8.697 8.697 2.486-2.485-4.32-4.319h1.302c4.93 0 9.071 1.722 12.424 5.165 3.352 3.443 5.029 7.638 5.029 12.584h3.55c0-2.958-.553-5.73-1.658-8.313-1.104-2.583-2.622-4.841-4.555-6.774-1.932-1.932-4.19-3.45-6.773-4.555-2.584-1.104-5.355-1.657-8.313-1.657H15.5l4.615-4.615zm-8.08 21.659v13.861h11.357v5.008H9.609V143h12.7c.834 0 1.55-.298 2.146-.894.596-.597.895-1.31.895-2.145v-7.781c0-.835-.299-1.55-.895-2.147a2.929 2.929 0 0 0-2.147-.894h-8.227v-5.096H25.35v-4.384z"></path>
|
|
114
|
-
</symbol>
|
|
115
|
-
<symbol viewBox="0 96 48 48" id="vjs-icon-replay-10">
|
|
116
|
-
<path d="M42.315 125.63c0-4.997-1.694-9.235-5.08-12.713-3.388-3.479-7.571-5.218-12.552-5.218h-1.315l4.363 4.363-2.51 2.51-8.787-8.786L25.221 97l2.45 2.45-4.662 4.663h1.375c2.988 0 5.788.557 8.397 1.673 2.61 1.116 4.892 2.65 6.844 4.602 1.953 1.953 3.487 4.234 4.602 6.844 1.116 2.61 1.674 5.41 1.674 8.398zM8.183 142v-19.657H3.176V117.8h9.643V142zm13.63 0c-1.156 0-2.127-.393-2.912-1.178-.778-.778-1.168-1.746-1.168-2.902v-16.04c0-1.156.393-2.127 1.178-2.912.779-.779 1.746-1.168 2.902-1.168h7.696c1.156 0 2.126.392 2.911 1.177.779.78 1.168 1.747 1.168 2.903v16.04c0 1.156-.392 2.127-1.177 2.912-.779.779-1.746 1.168-2.902 1.168zm.556-4.636h6.583v-15.02H22.37z"></path>
|
|
117
|
-
</symbol>
|
|
118
|
-
<symbol viewBox="0 96 48 48" id="vjs-icon-replay-30">
|
|
119
|
-
<path d="M26.047 97l-8.733 8.732 8.733 8.733 2.496-2.494-4.336-4.338h1.307c4.95 0 9.108 1.73 12.474 5.187 3.367 3.458 5.051 7.668 5.051 12.635h3.565c0-2.97-.556-5.751-1.665-8.346-1.109-2.594-2.633-4.862-4.574-6.802-1.94-1.941-4.208-3.466-6.803-4.575-2.594-1.109-5.375-1.664-8.345-1.664H23.85l4.634-4.634zM2.555 117.531v4.688h10.297v5.25H5.873v4.687h6.979v5.156H2.555V142H13.36c1.061 0 1.95-.395 2.668-1.186.718-.79 1.076-1.772 1.076-2.94v-16.218c0-1.168-.358-2.149-1.076-2.94-.717-.79-1.607-1.185-2.668-1.185zm22.482.14c-1.149 0-2.11.39-2.885 1.165-.78.78-1.172 1.744-1.172 2.893v15.943c0 1.149.388 2.11 1.163 2.885.78.78 1.745 1.172 2.894 1.172h7.649c1.148 0 2.11-.388 2.884-1.163.78-.78 1.17-1.745 1.17-2.894v-15.943c0-1.15-.386-2.111-1.16-2.885-.78-.78-1.746-1.172-2.894-1.172zm.553 4.518h6.545v14.93H25.59z"></path>
|
|
120
|
-
</symbol>
|
|
121
|
-
<symbol viewBox="0 96 48 48" id="vjs-icon-forward-5">
|
|
122
|
-
<path d="M29.508 97l-2.431 2.43 4.625 4.625h-1.364c-2.965 0-5.742.554-8.332 1.66-2.589 1.107-4.851 2.629-6.788 4.566-1.937 1.937-3.458 4.2-4.565 6.788-1.107 2.59-1.66 5.367-1.66 8.331h3.557c0-4.957 1.68-9.16 5.04-12.611 3.36-3.45 7.51-5.177 12.451-5.177h1.304l-4.326 4.33 2.49 2.49 8.715-8.716zm-9.783 21.61v13.89h11.382v5.018H19.725V142h12.727a2.93 2.93 0 0 0 2.15-.896 2.93 2.93 0 0 0 .896-2.15v-7.798c0-.837-.299-1.554-.896-2.152a2.93 2.93 0 0 0-2.15-.896h-8.245V123h11.29v-4.392z"></path>
|
|
123
|
-
</symbol>
|
|
124
|
-
<symbol viewBox="0 96 48 48" id="vjs-icon-forward-10">
|
|
125
|
-
<path d="M23.119 97l-2.386 2.383 4.538 4.538h-1.339c-2.908 0-5.633.543-8.173 1.63-2.54 1.085-4.76 2.577-6.66 4.478-1.9 1.9-3.392 4.12-4.478 6.66-1.085 2.54-1.629 5.264-1.629 8.172h3.49c0-4.863 1.648-8.986 4.944-12.372 3.297-3.385 7.368-5.078 12.216-5.078h1.279l-4.245 4.247 2.443 2.442 8.55-8.55zm-9.52 21.45v4.42h4.871V142h4.513v-23.55zm18.136 0c-1.125 0-2.066.377-2.824 1.135-.764.764-1.148 1.709-1.148 2.834v15.612c0 1.124.38 2.066 1.139 2.824.764.764 1.708 1.145 2.833 1.145h7.489c1.125 0 2.066-.378 2.824-1.136.764-.764 1.145-1.709 1.145-2.833v-15.612c0-1.125-.378-2.067-1.136-2.825-.764-.764-1.708-1.145-2.833-1.145zm.54 4.42h6.408v14.617h-6.407z"></path>
|
|
126
|
-
</symbol>
|
|
127
|
-
<symbol viewBox="0 96 48 48" id="vjs-icon-forward-30">
|
|
128
|
-
<path d="M25.549 97l-2.437 2.434 4.634 4.635H26.38c-2.97 0-5.753.555-8.347 1.664-2.594 1.109-4.861 2.633-6.802 4.574-1.94 1.94-3.465 4.207-4.574 6.802-1.109 2.594-1.664 5.377-1.664 8.347h3.565c0-4.967 1.683-9.178 5.05-12.636 3.366-3.458 7.525-5.187 12.475-5.187h1.307l-4.335 4.338 2.495 2.494 8.732-8.732zm-11.553 20.53v4.689h10.297v5.249h-6.978v4.688h6.978v5.156H13.996V142h10.808c1.06 0 1.948-.395 2.666-1.186.718-.79 1.077-1.771 1.077-2.94v-16.217c0-1.169-.36-2.15-1.077-2.94-.718-.79-1.605-1.186-2.666-1.186zm21.174.168c-1.149 0-2.11.389-2.884 1.163-.78.78-1.172 1.745-1.172 2.894v15.942c0 1.15.388 2.11 1.162 2.885.78.78 1.745 1.17 2.894 1.17h7.649c1.149 0 2.11-.386 2.885-1.16.78-.78 1.17-1.746 1.17-2.895v-15.942c0-1.15-.387-2.11-1.161-2.885-.78-.78-1.745-1.172-2.894-1.172zm.552 4.516h6.542v14.931h-6.542z"></path>
|
|
129
|
-
</symbol>
|
|
130
|
-
<symbol viewBox="0 0 512 512" id="vjs-icon-audio-description">
|
|
131
|
-
<g fill-rule="evenodd"><path d="M227.29 381.351V162.993c50.38-1.017 89.108-3.028 117.631 17.126 27.374 19.342 48.734 56.965 44.89 105.325-4.067 51.155-41.335 94.139-89.776 98.475-24.085 2.155-71.972 0-71.972 0s-.84-1.352-.773-2.568m48.755-54.804c31.43 1.26 53.208-16.633 56.495-45.386 4.403-38.51-21.188-63.552-58.041-60.796v103.612c-.036 1.466.575 2.22 1.546 2.57"></path><path d="M383.78 381.328c13.336 3.71 17.387-11.06 23.215-21.408 12.722-22.571 22.294-51.594 22.445-84.774.221-47.594-18.343-82.517-35.6-106.182h-8.51c-.587 3.874 2.226 7.315 3.865 10.276 13.166 23.762 25.367 56.553 25.54 94.194.2 43.176-14.162 79.278-30.955 107.894"></path><path d="M425.154 381.328c13.336 3.71 17.384-11.061 23.215-21.408 12.721-22.571 22.291-51.594 22.445-84.774.221-47.594-18.343-82.517-35.6-106.182h-8.511c-.586 3.874 2.226 7.315 3.866 10.276 13.166 23.762 25.367 56.553 25.54 94.194.2 43.176-14.162 79.278-30.955 107.894"></path><path d="M466.26 381.328c13.337 3.71 17.385-11.061 23.216-21.408 12.722-22.571 22.292-51.594 22.445-84.774.221-47.594-18.343-82.517-35.6-106.182h-8.51c-.587 3.874 2.225 7.315 3.865 10.276 13.166 23.762 25.367 56.553 25.54 94.194.2 43.176-14.162 79.278-30.955 107.894M4.477 383.005H72.58l18.573-28.484 64.169-.135s.065 19.413.065 28.62h48.756V160.307h-58.816c-5.653 9.537-140.85 222.697-140.85 222.697zm152.667-145.282v71.158l-40.453-.27 40.453-70.888z"></path></g>
|
|
132
|
-
</symbol>
|
|
133
|
-
<symbol viewBox="0 0 48 48" id="vjs-icon-next-item">
|
|
134
|
-
<path d="M12 36l17-12-17-12v24zm20-24v24h4V12h-4z"></path>
|
|
135
|
-
</symbol>
|
|
136
|
-
<symbol viewBox="0 0 48 48" id="vjs-icon-previous-item">
|
|
137
|
-
<path d="M12 12h4v24h-4zm7 12l17 12V12z"></path>
|
|
138
|
-
</symbol>
|
|
139
|
-
<symbol viewBox="0 0 48 48" id="vjs-icon-shuffle">
|
|
140
|
-
<path d="M21.17 18.34L10.83 8 8 10.83l10.34 10.34 2.83-2.83zM29 8l4.09 4.09L8 37.17 10.83 40l25.09-25.09L40 19V8H29zm.66 18.83l-2.83 2.83 6.26 6.26L29 40h11V29l-4.09 4.09-6.25-6.26z"></path>
|
|
141
|
-
</symbol>
|
|
142
|
-
<symbol viewBox="0 0 48 48" id="vjs-icon-cast">
|
|
143
|
-
<path d="M42 6H6c-2.21 0-4 1.79-4 4v6h4v-6h36v28H28v4h14c2.21 0 4-1.79 4-4V10c0-2.21-1.79-4-4-4zM2 36v6h6c0-3.31-2.69-6-6-6zm0-8v4c5.52 0 10 4.48 10 10h4c0-7.73-6.27-14-14-14zm0-8v4c9.94 0 18 8.06 18 18h4c0-12.15-9.85-22-22-22z"></path>
|
|
144
|
-
</symbol>
|
|
145
|
-
<symbol viewBox="0 0 48 48" id="vjs-icon-picture-in-picture-enter">
|
|
146
|
-
<path d="M38 22H22v11.99h16V22zm8 16V9.96C46 7.76 44.2 6 42 6H6C3.8 6 2 7.76 2 9.96V38c0 2.2 1.8 4 4 4h36c2.2 0 4-1.8 4-4zm-4 .04H6V9.94h36v28.1z"></path>
|
|
147
|
-
</symbol>
|
|
148
|
-
<symbol viewBox="0 0 22 18" id="vjs-icon-picture-in-picture-exit">
|
|
149
|
-
<path d="M18 4H4v10h14V4zm4 12V1.98C22 .88 21.1 0 20 0H2C.9 0 0 .88 0 1.98V16c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2zm-2 .02H2V1.97h18v14.05z"></path>
|
|
150
|
-
<path fill="none" d="M-1-3h24v24H-1z"></path>
|
|
151
|
-
</symbol>
|
|
152
|
-
<symbol viewBox="0 0 1792 1792" id="vjs-icon-facebook">
|
|
153
|
-
<path d="M1343 12v264h-157q-86 0-116 36t-30 108v189h293l-39 296h-254v759H734V905H479V609h255V391q0-186 104-288.5T1115 0q147 0 228 12z"></path>
|
|
154
|
-
</symbol>
|
|
155
|
-
<symbol viewBox="0 0 1792 1792" id="vjs-icon-linkedin">
|
|
156
|
-
<path d="M477 625v991H147V625h330zm21-306q1 73-50.5 122T312 490h-2q-82 0-132-49t-50-122q0-74 51.5-122.5T314 148t133 48.5T498 319zm1166 729v568h-329v-530q0-105-40.5-164.5T1168 862q-63 0-105.5 34.5T999 982q-11 30-11 81v553H659q2-399 2-647t-1-296l-1-48h329v144h-2q20-32 41-56t56.5-52 87-43.5T1285 602q171 0 275 113.5t104 332.5z"></path>
|
|
157
|
-
</symbol>
|
|
158
|
-
<symbol viewBox="0 0 1200 1227" id="vjs-icon-twitter">
|
|
159
|
-
<path d="M714.163 519.284L1160.89 0H1055.03L667.137 450.887L357.328 0H0L468.492 681.821L0 1226.37H105.866L515.491 750.218L842.672 1226.37H1200L714.137 519.284H714.163ZM569.165 687.828L521.697 619.934L144.011 79.6944H306.615L611.412 515.685L658.88 583.579L1055.08 1150.3H892.476L569.165 687.854V687.828Z"/>
|
|
160
|
-
</symbol>
|
|
161
|
-
<symbol viewBox="0 0 1792 1792" id="vjs-icon-tumblr">
|
|
162
|
-
<path d="M1328 1329l80 237q-23 35-111 66t-177 32q-104 2-190.5-26T787 1564t-95-106-55.5-120-16.5-118V676H452V461q72-26 129-69.5t91-90 58-102 34-99T779 12q1-5 4.5-8.5T791 0h244v424h333v252h-334v518q0 30 6.5 56t22.5 52.5 49.5 41.5 81.5 14q78-2 134-29z"></path>
|
|
163
|
-
</symbol>
|
|
164
|
-
<symbol viewBox="0 0 1792 1792" id="vjs-icon-pinterest">
|
|
165
|
-
<path d="M1664 896q0 209-103 385.5T1281.5 1561 896 1664q-111 0-218-32 59-93 78-164 9-34 54-211 20 39 73 67.5t114 28.5q121 0 216-68.5t147-188.5 52-270q0-114-59.5-214T1180 449t-255-63q-105 0-196 29t-154.5 77-109 110.5-67 129.5T377 866q0 104 40 183t117 111q30 12 38-20 2-7 8-31t8-30q6-23-11-43-51-61-51-151 0-151 104.5-259.5T904 517q151 0 235.5 82t84.5 213q0 170-68.5 289T980 1220q-61 0-98-43.5T859 1072q8-35 26.5-93.5t30-103T927 800q0-50-27-83t-77-33q-62 0-105 57t-43 142q0 73 25 122l-99 418q-17 70-13 177-206-91-333-281T128 896q0-209 103-385.5T510.5 231 896 128t385.5 103T1561 510.5 1664 896z"></path>
|
|
166
|
-
</symbol>
|
|
167
|
-
</defs>
|
|
168
|
-
</svg>`;const fl=dn?10009:cn?461:8,si={codes:{play:415,pause:19,ff:417,rw:412,back:fl},names:{415:"play",19:"pause",417:"ff",412:"rw",[fl]:"back"},isEventKey(s,e){return e=e.toLowerCase(),!!(this.names[s.keyCode]&&this.names[s.keyCode]===e)},getEventName(s){if(this.names[s.keyCode])return this.names[s.keyCode];if(this.codes[s.code]){const e=this.codes[s.code];return this.names[e]}return null}},pl=5;class bg extends $e{constructor(e){super(),this.player_=e,this.focusableComponents=[],this.isListening_=!1,this.isPaused_=!1,this.onKeyDown_=this.onKeyDown_.bind(this),this.lastFocusedComponent_=null}start(){this.isListening_||(this.player_.on("keydown",this.onKeyDown_),this.player_.on("modalKeydown",this.onKeyDown_),this.player_.on("loadedmetadata",()=>{this.focus(this.updateFocusableComponents()[0])}),this.player_.on("modalclose",()=>{this.refocusComponent()}),this.player_.on("focusin",this.handlePlayerFocus_.bind(this)),this.player_.on("focusout",this.handlePlayerBlur_.bind(this)),this.isListening_=!0,this.player_.errorDisplay&&this.player_.errorDisplay.on("aftermodalfill",()=>{this.updateFocusableComponents(),this.focusableComponents.length&&(this.focusableComponents.length>1?this.focusableComponents[1].focus():this.focusableComponents[0].focus())}))}stop(){this.player_.off("keydown",this.onKeyDown_),this.isListening_=!1}onKeyDown_(e){const t=e.originalEvent?e.originalEvent:e;if(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(t.key)){if(this.isPaused_)return;t.preventDefault();const i=t.key.substring(5).toLowerCase();this.move(i)}else if(si.isEventKey(t,"play")||si.isEventKey(t,"pause")||si.isEventKey(t,"ff")||si.isEventKey(t,"rw")){t.preventDefault();const i=si.getEventName(t);this.performMediaAction_(i)}else si.isEventKey(t,"Back")&&e.target&&typeof e.target.closeable=="function"&&e.target.closeable()&&(t.preventDefault(),e.target.close())}performMediaAction_(e){if(this.player_)switch(e){case"play":this.player_.paused()&&this.player_.play();break;case"pause":this.player_.paused()||this.player_.pause();break;case"ff":this.userSeek_(this.player_.currentTime()+pl);break;case"rw":this.userSeek_(this.player_.currentTime()-pl);break}}userSeek_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)}pause(){this.isPaused_=!0}resume(){this.isPaused_=!1}handlePlayerBlur_(e){const t=e.relatedTarget;let i=null;const n=this.getCurrentComponent(e.target);t&&(i=!!t.closest(".video-js"),t.classList.contains("vjs-text-track-settings")&&!this.isPaused_&&this.searchForTrackSelect_()),(!e.currentTarget.contains(e.relatedTarget)&&!i||!t)&&(n&&n.name()==="CloseButton"?this.refocusComponent():(this.pause(),n&&n.el()&&(this.lastFocusedComponent_=n)))}handlePlayerFocus_(){this.getCurrentComponent()&&this.getCurrentComponent().getIsFocusable()&&this.resume()}updateFocusableComponents(){const e=this.player_,t=[];function i(n){for(const r of n)r.hasOwnProperty("el_")&&r.getIsFocusable()&&r.getIsAvailableToBeFocused(r.el())&&t.push(r),r.hasOwnProperty("children_")&&r.children_.length>0&&i(r.children_)}return e.children_.forEach(n=>{if(n.hasOwnProperty("el_"))if(n.getIsFocusable&&n.getIsAvailableToBeFocused&&n.getIsFocusable()&&n.getIsAvailableToBeFocused(n.el())){t.push(n);return}else n.hasOwnProperty("children_")&&n.children_.length>0?i(n.children_):n.hasOwnProperty("items")&&n.items.length>0?i(n.items):this.findSuitableDOMChild(n)&&t.push(n);if(n.name_==="ErrorDisplay"&&n.opened_){const r=n.el_.querySelector(".vjs-errors-ok-button-container");r&&r.querySelectorAll("button").forEach((l,c)=>{t.push({name:()=>"ModalButton"+(c+1),el:()=>l,getPositions:()=>{const p=l.getBoundingClientRect(),g={x:p.x,y:p.y,width:p.width,height:p.height,top:p.top,right:p.right,bottom:p.bottom,left:p.left},_={x:p.left+p.width/2,y:p.top+p.height/2,width:0,height:0,top:p.top+p.height/2,right:p.left+p.width/2,bottom:p.top+p.height/2,left:p.left+p.width/2};return{boundingClientRect:g,center:_}},getIsAvailableToBeFocused:()=>!0,getIsFocusable:p=>!0,focus:()=>l.focus()})})}}),this.focusableComponents=t,this.focusableComponents}findSuitableDOMChild(e){function t(i){if(e.getIsFocusable(i)&&e.getIsAvailableToBeFocused(i))return i;for(let n=0;n<i.children.length;n++){const r=i.children[n],a=t(r);if(a)return a}return null}return e.el()?t(e.el()):null}getCurrentComponent(e){this.updateFocusableComponents();const t=e||document.activeElement;if(this.focusableComponents.length){for(const i of this.focusableComponents)if(i.el()===t)return i}}add(e){const t=[...this.focusableComponents];e.hasOwnProperty("el_")&&e.getIsFocusable()&&e.getIsAvailableToBeFocused(e.el())&&t.push(e),this.focusableComponents=t,this.trigger({type:"focusableComponentsChanged",focusableComponents:this.focusableComponents})}remove(e){for(let t=0;t<this.focusableComponents.length;t++)if(this.focusableComponents[t].name()===e.name()){this.focusableComponents.splice(t,1),this.trigger({type:"focusableComponentsChanged",focusableComponents:this.focusableComponents});return}}clear(){this.focusableComponents.length>0&&(this.focusableComponents=[],this.trigger({type:"focusableComponentsChanged",focusableComponents:this.focusableComponents}))}move(e){const t=this.getCurrentComponent();if(!t)return;const i=t.getPositions(),n=this.focusableComponents.filter(a=>a!==t&&this.isInDirection_(i.boundingClientRect,a.getPositions().boundingClientRect,e)),r=this.findBestCandidate_(i.center,n,e);r?this.focus(r):this.trigger({type:"endOfFocusableComponents",direction:e,focusedComponent:t})}findBestCandidate_(e,t,i){let n=1/0,r=null;for(const a of t){const l=a.getPositions().center,c=this.calculateDistance_(e,l,i);c<n&&(n=c,r=a)}return r}isInDirection_(e,t,i){switch(i){case"right":return t.left>=e.right;case"left":return t.right<=e.left;case"down":return t.top>=e.bottom;case"up":return t.bottom<=e.top;default:return!1}}refocusComponent(){if(this.lastFocusedComponent_){this.player_.userActive()||this.player_.userActive(!0),this.updateFocusableComponents();for(let e=0;e<this.focusableComponents.length;e++)if(this.focusableComponents[e].name()===this.lastFocusedComponent_.name()){this.focus(this.focusableComponents[e]);return}}else this.focus(this.updateFocusableComponents()[0])}focus(e){typeof e=="object"&&(e.getIsAvailableToBeFocused(e.el())?e.focus():this.findSuitableDOMChild(e)&&this.findSuitableDOMChild(e).focus())}calculateDistance_(e,t,i){const n=Math.abs(e.x-t.x),r=Math.abs(e.y-t.y);let a;switch(i){case"right":case"left":a=n+r*100;break;case"up":a=r*2+n*.5;break;case"down":a=r*5+n;break;default:a=n+r}return a}searchForTrackSelect_(){const e=this;for(const t of e.updateFocusableComponents())if(t.constructor.name==="TextTrackSelect"){e.focus(t);break}}}class xg extends D{constructor(e,t,i){const n=se({createEl:!1},t);if(super(e,n,i),!t.playerOptions.sources||t.playerOptions.sources.length===0)for(let r=0,a=t.playerOptions.techOrder;r<a.length;r++){const l=pe(a[r]);let c=K.getTech(l);if(l||(c=D.getComponent(l)),c&&c.isSupported()){e.loadTech_(l);break}}else e.src(t.playerOptions.sources)}}D.registerComponent("MediaLoader",xg);class Hn extends D{constructor(e,t){super(e,t),this.options_.controlText&&this.controlText(this.options_.controlText),this.handleMouseOver_=i=>this.handleMouseOver(i),this.handleMouseOut_=i=>this.handleMouseOut(i),this.handleClick_=i=>this.handleClick(i),this.handleKeyDown_=i=>this.handleKeyDown(i),this.emitTapEvents(),this.enable()}createEl(e="div",t={},i={}){t=Object.assign({className:this.buildCSSClass(),tabIndex:0},t),e==="button"&&X.error(`Creating a ClickableComponent with an HTML element of ${e} is not supported; use a Button instead.`),i=Object.assign({role:"button"},i),this.tabIndex_=t.tabIndex;const n=G(e,t,i);return this.player_.options_.experimentalSvgIcons||n.appendChild(G("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(n),n}dispose(){this.controlTextEl_=null,super.dispose()}createControlTextEl(e){return this.controlTextEl_=G("span",{className:"vjs-control-text"},{"aria-live":"polite"}),e&&e.appendChild(this.controlTextEl_),this.controlText(this.controlText_,e),this.controlTextEl_}controlText(e,t=this.el()){if(e===void 0)return this.controlText_||"Need Text";const i=this.localize(e);this.controlText_=e,Dt(this.controlTextEl_,i),!this.nonIconControl&&!this.player_.options_.noUITitleAttributes&&t.setAttribute("title",i)}buildCSSClass(){return`vjs-control vjs-button ${super.buildCSSClass()}`}enable(){this.enabled_||(this.enabled_=!0,this.removeClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","false"),typeof this.tabIndex_<"u"&&this.el_.setAttribute("tabIndex",this.tabIndex_),this.on(["tap","click"],this.handleClick_),this.on("keydown",this.handleKeyDown_))}disable(){this.enabled_=!1,this.addClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","true"),typeof this.tabIndex_<"u"&&this.el_.removeAttribute("tabIndex"),this.off("mouseover",this.handleMouseOver_),this.off("mouseout",this.handleMouseOut_),this.off(["tap","click"],this.handleClick_),this.off("keydown",this.handleKeyDown_)}handleLanguagechange(){this.controlText(this.controlText_)}handleClick(e){this.options_.clickHandler&&this.options_.clickHandler.call(this,arguments)}handleKeyDown(e){e.key===" "||e.key==="Enter"?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}D.registerComponent("ClickableComponent",Hn);class zr extends Hn{constructor(e,t){super(e,t),this.update(),this.update_=i=>this.update(i),e.on("posterchange",this.update_)}dispose(){this.player().off("posterchange",this.update_),super.dispose()}createEl(){return G("div",{className:"vjs-poster"})}crossOrigin(e){if(typeof e>"u")return this.$("img")?this.$("img").crossOrigin:this.player_.tech_&&this.player_.tech_.isReady_?this.player_.crossOrigin():this.player_.options_.crossOrigin||this.player_.options_.crossorigin||null;if(e!==null&&e!=="anonymous"&&e!=="use-credentials"){this.player_.log.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`);return}this.$("img")&&(this.$("img").crossOrigin=e)}update(e){const t=this.player().poster();this.setSrc(t),t?this.show():this.hide()}setSrc(e){if(!e){this.el_.textContent="";return}this.$("img")||this.el_.appendChild(G("picture",{className:"vjs-poster",tabIndex:-1},{},G("img",{loading:"lazy",crossOrigin:this.crossOrigin()},{alt:""}))),this.$("img").src=e}handleClick(e){this.player_.controls()&&(this.player_.tech(!0)&&this.player_.tech(!0).focus(),this.player_.paused()?nt(this.player_.play()):this.player_.pause())}}zr.prototype.crossorigin=zr.prototype.crossOrigin;D.registerComponent("PosterImage",zr);const Ve="#222",ml="#ccc",Sg={monospace:"monospace",sansSerif:"sans-serif",serif:"serif",monospaceSansSerif:'"Andale Mono", "Lucida Console", monospace',monospaceSerif:'"Courier New", monospace',proportionalSansSerif:"sans-serif",proportionalSerif:"serif",casual:'"Comic Sans MS", Impact, fantasy',script:'"Monotype Corsiva", cursive',smallcaps:'"Andale Mono", "Lucida Console", monospace, sans-serif'};function Sr(s,e){let t;if(s.length===4)t=s[1]+s[1]+s[2]+s[2]+s[3]+s[3];else if(s.length===7)t=s.slice(1);else throw new Error("Invalid color code provided, "+s+"; must be formatted as e.g. #f0e or #f604e2.");return"rgba("+parseInt(t.slice(0,2),16)+","+parseInt(t.slice(2,4),16)+","+parseInt(t.slice(4,6),16)+","+e+")"}function tt(s,e,t){try{s.style[e]=t}catch{return}}function gl(s){return s?`${s}px`:""}class Cg extends D{constructor(e,t,i){super(e,t,i);const n=a=>this.updateDisplay(a),r=a=>{this.updateDisplayOverlay(),this.updateDisplay(a)};e.on("loadstart",a=>this.toggleDisplay(a)),e.on("useractive",n),e.on("userinactive",n),e.on("texttrackchange",n),e.on("loadedmetadata",a=>{this.updateDisplayOverlay(),this.preselectTrack(a)}),e.ready(re(this,function(){if(e.tech_&&e.tech_.featuresNativeTextTracks){this.hide();return}e.on("fullscreenchange",r),e.on("playerresize",r);const a=x.screen.orientation||x,l=x.screen.orientation?"change":"orientationchange";a.addEventListener(l,r),e.on("dispose",()=>a.removeEventListener(l,r));const c=this.options_.playerOptions.tracks||[];for(let p=0;p<c.length;p++)this.player_.addRemoteTextTrack(c[p],!0);this.preselectTrack()}))}preselectTrack(){const e={captions:1,subtitles:1},t=this.player_.textTracks(),i=this.player_.cache_.selectedLanguage;let n,r,a;for(let l=0;l<t.length;l++){const c=t[l];i&&i.enabled&&i.language&&i.language===c.language&&c.kind in e?c.kind===i.kind?a=c:a||(a=c):i&&!i.enabled?(a=null,n=null,r=null):c.default&&(c.kind==="descriptions"&&!n?n=c:c.kind in e&&!r&&(r=c))}a?a.mode="showing":r?r.mode="showing":n&&(n.mode="showing")}toggleDisplay(){this.player_.tech_&&this.player_.tech_.featuresNativeTextTracks?this.hide():this.show()}createEl(){return super.createEl("div",{className:"vjs-text-track-display"},{translate:"yes","aria-live":"off","aria-atomic":"true"})}clearDisplay(){typeof x.WebVTT=="function"&&x.WebVTT.processCues(x,[],this.el_)}updateDisplay(){const e=this.player_.textTracks(),t=this.options_.allowMultipleShowingTracks;if(this.clearDisplay(),t){const a=[];for(let l=0;l<e.length;++l){const c=e[l];c.mode==="showing"&&a.push(c)}this.updateForTrack(a);return}let i=null,n=null,r=e.length;for(;r--;){const a=e[r];a.mode==="showing"&&(a.kind==="descriptions"?i=a:n=a)}if(n?(this.getAttribute("aria-live")!=="off"&&this.setAttribute("aria-live","off"),this.updateForTrack(n)):i&&(this.getAttribute("aria-live")!=="assertive"&&this.setAttribute("aria-live","assertive"),this.updateForTrack(i)),!x.CSS.supports("inset","10px")){const a=this.el_,l=a.querySelectorAll(".vjs-text-track-cue"),c=this.player_.controlBar.el_.getBoundingClientRect().height,p=this.player_.el_.getBoundingClientRect().height;a.style="",tt(a,"position","relative"),tt(a,"height",p-c+"px"),tt(a,"top","unset"),fn?tt(a,"bottom",p+"px"):tt(a,"bottom","0px"),l.length>0&&l.forEach(g=>{if(g.style.inset){const _=g.style.inset.split(" ");_.length===3&&Object.assign(g.style,{top:_[0],right:_[1],bottom:_[2],left:"unset"})}})}}updateDisplayOverlay(){if(!this.player_.videoHeight()||!x.CSS.supports("inset-inline: 10px"))return;const e=this.player_.currentWidth(),t=this.player_.currentHeight(),i=e/t,n=this.player_.videoWidth()/this.player_.videoHeight();let r=0,a=0;Math.abs(i-n)>.1&&(i>n?r=Math.round((e-t*n)/2):a=Math.round((t-e/n)/2)),tt(this.el_,"insetInline",gl(r)),tt(this.el_,"insetBlock",gl(a))}updateDisplayState(e){const t=this.player_.textTrackSettings.getValues(),i=e.activeCues;let n=i.length;for(;n--;){const r=i[n];if(!r)continue;const a=r.displayState;if(t.color&&(a.firstChild.style.color=t.color),t.textOpacity&&tt(a.firstChild,"color",Sr(t.color||"#fff",t.textOpacity)),t.backgroundColor&&(a.firstChild.style.backgroundColor=t.backgroundColor),t.backgroundOpacity&&tt(a.firstChild,"backgroundColor",Sr(t.backgroundColor||"#000",t.backgroundOpacity)),t.windowColor&&(t.windowOpacity?tt(a,"backgroundColor",Sr(t.windowColor,t.windowOpacity)):a.style.backgroundColor=t.windowColor),t.edgeStyle&&(t.edgeStyle==="dropshadow"?a.firstChild.style.textShadow=`2px 2px 3px ${Ve}, 2px 2px 4px ${Ve}, 2px 2px 5px ${Ve}`:t.edgeStyle==="raised"?a.firstChild.style.textShadow=`1px 1px ${Ve}, 2px 2px ${Ve}, 3px 3px ${Ve}`:t.edgeStyle==="depressed"?a.firstChild.style.textShadow=`1px 1px ${ml}, 0 1px ${ml}, -1px -1px ${Ve}, 0 -1px ${Ve}`:t.edgeStyle==="uniform"&&(a.firstChild.style.textShadow=`0 0 4px ${Ve}, 0 0 4px ${Ve}, 0 0 4px ${Ve}, 0 0 4px ${Ve}`)),t.fontPercent&&t.fontPercent!==1){const l=x.parseFloat(a.style.fontSize);a.style.fontSize=l*t.fontPercent+"px",a.style.height="auto",a.style.top="auto"}t.fontFamily&&t.fontFamily!=="default"&&(t.fontFamily==="small-caps"?a.firstChild.style.fontVariant="small-caps":a.firstChild.style.fontFamily=Sg[t.fontFamily])}}updateForTrack(e){if(Array.isArray(e)||(e=[e]),typeof x.WebVTT!="function"||e.every(i=>!i.activeCues))return;const t=[];for(let i=0;i<e.length;++i){const n=e[i];for(let r=0;r<n.activeCues.length;++r)t.push(n.activeCues[r])}x.WebVTT.processCues(x,t,this.el_);for(let i=0;i<e.length;++i){const n=e[i];for(let r=0;r<n.activeCues.length;++r){const a=n.activeCues[r].displayState;Gt(a,"vjs-text-track-cue","vjs-text-track-cue-"+(n.language?n.language:i)),n.language&&vi(a,"lang",n.language)}this.player_.textTrackSettings&&this.updateDisplayState(n)}}}D.registerComponent("TextTrackDisplay",Cg);class Eg extends D{createEl(){const e=this.player_.isAudio(),t=this.localize(e?"Audio Player":"Video Player"),i=G("span",{className:"vjs-control-text",textContent:this.localize("{1} is loading.",[t])}),n=super.createEl("div",{className:"vjs-loading-spinner",dir:"ltr"});return n.appendChild(i),n}handleLanguagechange(){this.$(".vjs-control-text").textContent=this.localize("{1} is loading.",[this.player_.isAudio()?"Audio Player":"Video Player"])}}D.registerComponent("LoadingSpinner",Eg);class Ee extends Hn{createEl(e,t={},i={}){e="button",t=Object.assign({className:this.buildCSSClass()},t),i=Object.assign({type:"button"},i);const n=G(e,t,i);return this.player_.options_.experimentalSvgIcons||n.appendChild(G("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(n),n}addChild(e,t={}){const i=this.constructor.name;return X.warn(`Adding an actionable (user controllable) child to a Button (${i}) is not supported; use a ClickableComponent instead.`),D.prototype.addChild.call(this,e,t)}enable(){super.enable(),this.el_.removeAttribute("disabled")}disable(){super.disable(),this.el_.setAttribute("disabled","disabled")}handleKeyDown(e){if(e.key===" "||e.key==="Enter"){e.stopPropagation();return}super.handleKeyDown(e)}}D.registerComponent("Button",Ee);class eh extends Ee{constructor(e,t){super(e,t),this.mouseused_=!1,this.setIcon("play"),this.on("mousedown",i=>this.handleMouseDown(i))}buildCSSClass(){return"vjs-big-play-button"}handleClick(e){const t=this.player_.play();if(e.type==="tap"||this.mouseused_&&"clientX"in e&&"clientY"in e){nt(t),this.player_.tech(!0)&&this.player_.tech(!0).focus();return}const i=this.player_.getChild("controlBar"),n=i&&i.getChild("playToggle");if(!n){this.player_.tech(!0).focus();return}const r=()=>n.focus();us(t)?t.then(r,()=>{}):this.setTimeout(r,1)}handleKeyDown(e){this.mouseused_=!1,super.handleKeyDown(e)}handleMouseDown(e){this.mouseused_=!0}}eh.prototype.controlText_="Play Video";D.registerComponent("BigPlayButton",eh);class wg extends Ee{constructor(e,t){super(e,t),this.setIcon("cancel"),this.controlText(t&&t.controlText||this.localize("Close"))}buildCSSClass(){return`vjs-close-button ${super.buildCSSClass()}`}handleClick(e){this.trigger({type:"close",bubbles:!1})}handleKeyDown(e){e.key==="Escape"?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}D.registerComponent("CloseButton",wg);class th extends Ee{constructor(e,t={}){super(e,t),t.replay=t.replay===void 0||t.replay,this.setIcon("play"),this.on(e,"play",i=>this.handlePlay(i)),this.on(e,"pause",i=>this.handlePause(i)),t.replay&&this.on(e,"ended",i=>this.handleEnded(i))}buildCSSClass(){return`vjs-play-control ${super.buildCSSClass()}`}handleClick(e){this.player_.paused()?nt(this.player_.play()):this.player_.pause()}handleSeeked(e){this.removeClass("vjs-ended"),this.player_.paused()?this.handlePause(e):this.handlePlay(e)}handlePlay(e){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.setIcon("pause"),this.controlText("Pause")}handlePause(e){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.setIcon("play"),this.controlText("Play")}handleEnded(e){this.removeClass("vjs-playing"),this.addClass("vjs-ended"),this.setIcon("replay"),this.controlText("Replay"),this.one(this.player_,"seeked",t=>this.handleSeeked(t))}}th.prototype.controlText_="Play";D.registerComponent("PlayToggle",th);class Ai extends D{constructor(e,t){super(e,t),this.on(e,["timeupdate","ended","seeking"],i=>this.update(i)),this.updateTextNode_()}createEl(){const e=this.buildCSSClass(),t=super.createEl("div",{className:`${e} vjs-time-control vjs-control`}),i=G("span",{className:"vjs-control-text",textContent:`${this.localize(this.labelText_)} `},{role:"presentation"});return t.appendChild(i),this.contentEl_=G("span",{className:`${e}-display`},{role:"presentation"}),t.appendChild(this.contentEl_),t}dispose(){this.contentEl_=null,this.textNode_=null,super.dispose()}update(e){!this.player_.options_.enableSmoothSeeking&&e.type==="seeking"||this.updateContent(e)}updateTextNode_(e=0){e=Yt(e),this.formattedTime_!==e&&(this.formattedTime_=e,this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_",()=>{if(!this.contentEl_)return;let t=this.textNode_;t&&this.contentEl_.firstChild!==t&&(t=null,X.warn("TimeDisplay#updateTextnode_: Prevented replacement of text node element since it was no longer a child of this node. Appending a new node instead.")),this.textNode_=N.createTextNode(this.formattedTime_),this.textNode_&&(t?this.contentEl_.replaceChild(this.textNode_,t):this.contentEl_.appendChild(this.textNode_))}))}updateContent(e){}}Ai.prototype.labelText_="Time";Ai.prototype.controlText_="Time";D.registerComponent("TimeDisplay",Ai);class Sa extends Ai{buildCSSClass(){return"vjs-current-time"}updateContent(e){let t;this.player_.ended()?t=this.player_.duration():e&&e.target&&typeof e.target.pendingSeekTime=="function"?t=e.target.pendingSeekTime():t=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),this.updateTextNode_(t)}}Sa.prototype.labelText_="Current Time";Sa.prototype.controlText_="Current Time";D.registerComponent("CurrentTimeDisplay",Sa);class Ca extends Ai{constructor(e,t){super(e,t);const i=n=>this.updateContent(n);this.on(e,"durationchange",i),this.on(e,"loadstart",i),this.on(e,"loadedmetadata",i)}buildCSSClass(){return"vjs-duration"}updateContent(e){const t=this.player_.duration();this.updateTextNode_(t)}}Ca.prototype.labelText_="Duration";Ca.prototype.controlText_="Duration";D.registerComponent("DurationDisplay",Ca);class kg extends D{createEl(){const e=super.createEl("div",{className:"vjs-time-control vjs-time-divider"},{"aria-hidden":!0}),t=super.createEl("div"),i=super.createEl("span",{textContent:"/"});return t.appendChild(i),e.appendChild(t),e}}D.registerComponent("TimeDivider",kg);class Ea extends Ai{constructor(e,t){super(e,t),this.on(e,"durationchange",i=>this.updateContent(i))}buildCSSClass(){return"vjs-remaining-time"}createEl(){const e=super.createEl();return this.options_.displayNegative!==!1&&e.insertBefore(G("span",{},{"aria-hidden":!0},"-"),this.contentEl_),e}updateContent(e){if(typeof this.player_.duration()!="number")return;let t;this.player_.ended()?t=0:this.player_.remainingTimeDisplay?t=this.player_.remainingTimeDisplay():t=this.player_.remainingTime(),this.updateTextNode_(t)}}Ea.prototype.labelText_="Remaining Time";Ea.prototype.controlText_="Remaining Time";D.registerComponent("RemainingTimeDisplay",Ea);class Ig extends D{constructor(e,t){super(e,t),this.updateShowing(),this.on(this.player(),"durationchange",i=>this.updateShowing(i))}createEl(){const e=super.createEl("div",{className:"vjs-live-control vjs-control"});return this.contentEl_=G("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(G("span",{className:"vjs-control-text",textContent:`${this.localize("Stream Type")} `})),this.contentEl_.appendChild(N.createTextNode(this.localize("LIVE"))),e.appendChild(this.contentEl_),e}dispose(){this.contentEl_=null,super.dispose()}updateShowing(e){this.player().duration()===1/0?this.show():this.hide()}}D.registerComponent("LiveDisplay",Ig);class ih extends Ee{constructor(e,t){super(e,t),this.updateLiveEdgeStatus(),this.player_.liveTracker&&(this.updateLiveEdgeStatusHandler_=i=>this.updateLiveEdgeStatus(i),this.on(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_))}createEl(){const e=super.createEl("button",{className:"vjs-seek-to-live-control vjs-control"});return this.setIcon("circle",e),this.textEl_=G("span",{className:"vjs-seek-to-live-text",textContent:this.localize("LIVE")},{"aria-hidden":"true"}),e.appendChild(this.textEl_),e}updateLiveEdgeStatus(){!this.player_.liveTracker||this.player_.liveTracker.atLiveEdge()?(this.setAttribute("aria-disabled",!0),this.addClass("vjs-at-live-edge"),this.controlText("Seek to live, currently playing live")):(this.setAttribute("aria-disabled",!1),this.removeClass("vjs-at-live-edge"),this.controlText("Seek to live, currently behind live"))}handleClick(){this.player_.liveTracker.seekToLiveEdge()}dispose(){this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_),this.textEl_=null,super.dispose()}}ih.prototype.controlText_="Seek to live, currently playing live";D.registerComponent("SeekToLive",ih);function _s(s,e,t){return s=Number(s),Math.min(t,Math.max(e,isNaN(s)?e:s))}var Pg=Object.freeze({__proto__:null,clamp:_s});class wa extends D{constructor(e,t){super(e,t),this.handleMouseDown_=i=>this.handleMouseDown(i),this.handleMouseUp_=i=>this.handleMouseUp(i),this.handleKeyDown_=i=>this.handleKeyDown(i),this.handleClick_=i=>this.handleClick(i),this.handleMouseMove_=i=>this.handleMouseMove(i),this.update_=i=>this.update(i),this.bar=this.getChild(this.options_.barName),this.vertical(!!this.options_.vertical),this.enable()}enabled(){return this.enabled_}enable(){this.enabled()||(this.on("mousedown",this.handleMouseDown_),this.on("touchstart",this.handleMouseDown_),this.on("keydown",this.handleKeyDown_),this.on("click",this.handleClick_),this.on(this.player_,"controlsvisible",this.update),this.playerEvent&&this.on(this.player_,this.playerEvent,this.update),this.removeClass("disabled"),this.setAttribute("tabindex",0),this.enabled_=!0)}disable(){if(!this.enabled())return;const e=this.bar.el_.ownerDocument;this.off("mousedown",this.handleMouseDown_),this.off("touchstart",this.handleMouseDown_),this.off("keydown",this.handleKeyDown_),this.off("click",this.handleClick_),this.off(this.player_,"controlsvisible",this.update_),this.off(e,"mousemove",this.handleMouseMove_),this.off(e,"mouseup",this.handleMouseUp_),this.off(e,"touchmove",this.handleMouseMove_),this.off(e,"touchend",this.handleMouseUp_),this.removeAttribute("tabindex"),this.addClass("disabled"),this.playerEvent&&this.off(this.player_,this.playerEvent,this.update),this.enabled_=!1}createEl(e,t={},i={}){return t.className=t.className+" vjs-slider",t=Object.assign({tabIndex:0},t),i=Object.assign({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100},i),super.createEl(e,t,i)}handleMouseDown(e){const t=this.bar.el_.ownerDocument;e.type==="mousedown"&&e.preventDefault(),e.type==="touchstart"&&!ut&&e.preventDefault(),Iu(),this.addClass("vjs-sliding"),this.trigger("slideractive"),this.on(t,"mousemove",this.handleMouseMove_),this.on(t,"mouseup",this.handleMouseUp_),this.on(t,"touchmove",this.handleMouseMove_),this.on(t,"touchend",this.handleMouseUp_),this.handleMouseMove(e,!0)}handleMouseMove(e){}handleMouseUp(e){const t=this.bar.el_.ownerDocument;Pu(),this.removeClass("vjs-sliding"),this.trigger("sliderinactive"),this.off(t,"mousemove",this.handleMouseMove_),this.off(t,"mouseup",this.handleMouseUp_),this.off(t,"touchmove",this.handleMouseMove_),this.off(t,"touchend",this.handleMouseUp_),this.update()}update(){if(!this.el_||!this.bar)return;const e=this.getProgress();return e===this.progress_||(this.progress_=e,this.requestNamedAnimationFrame("Slider#update",()=>{const t=this.vertical()?"height":"width";this.bar.el().style[t]=(e*100).toFixed(2)+"%"})),e}getProgress(){return Number(_s(this.getPercent(),0,1).toFixed(4))}calculateDistance(e){const t=Bn(this.el_,e);return this.vertical()?t.y:t.x}handleKeyDown(e){const t=this.options_.playerOptions.spatialNavigation,i=t&&t.enabled,n=t&&t.horizontalSeek;i?n&&e.key==="ArrowLeft"||!n&&e.key==="ArrowDown"?(e.preventDefault(),e.stopPropagation(),this.stepBack()):n&&e.key==="ArrowRight"||!n&&e.key==="ArrowUp"?(e.preventDefault(),e.stopPropagation(),this.stepForward()):(this.pendingSeekTime()&&(this.pendingSeekTime(null),this.userSeek_(this.player_.currentTime())),super.handleKeyDown(e)):e.key==="ArrowLeft"||e.key==="ArrowDown"?(e.preventDefault(),e.stopPropagation(),this.stepBack()):e.key==="ArrowUp"||e.key==="ArrowRight"?(e.preventDefault(),e.stopPropagation(),this.stepForward()):super.handleKeyDown(e)}handleClick(e){e.stopPropagation(),e.preventDefault()}vertical(e){if(e===void 0)return this.vertical_||!1;this.vertical_=!!e,this.vertical_?this.addClass("vjs-slider-vertical"):this.addClass("vjs-slider-horizontal")}}D.registerComponent("Slider",wa);const Cr=(s,e)=>_s(s/e*100,0,100).toFixed(2)+"%";class Ag extends D{constructor(e,t){super(e,t),this.partEls_=[],this.on(e,"progress",i=>this.update(i))}createEl(){const e=super.createEl("div",{className:"vjs-load-progress"}),t=G("span",{className:"vjs-control-text"}),i=G("span",{textContent:this.localize("Loaded")}),n=N.createTextNode(": ");return this.percentageEl_=G("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),e.appendChild(t),t.appendChild(i),t.appendChild(n),t.appendChild(this.percentageEl_),e}dispose(){this.partEls_=null,this.percentageEl_=null,super.dispose()}update(e){this.requestNamedAnimationFrame("LoadProgressBar#update",()=>{const t=this.player_.liveTracker,i=this.player_.buffered(),n=t&&t.isLive()?t.seekableEnd():this.player_.duration(),r=this.player_.bufferedEnd(),a=this.partEls_,l=Cr(r,n);this.percent_!==l&&(this.el_.style.width=l,Dt(this.percentageEl_,l),this.percent_=l);for(let c=0;c<i.length;c++){const p=i.start(c),g=i.end(c);let _=a[c];_||(_=this.el_.appendChild(G()),a[c]=_),!(_.dataset.start===p&&_.dataset.end===g)&&(_.dataset.start=p,_.dataset.end=g,_.style.left=Cr(p,r),_.style.width=Cr(g-p,r))}for(let c=a.length;c>i.length;c--)this.el_.removeChild(a[c-1]);a.length=i.length})}}D.registerComponent("LoadProgressBar",Ag);class Lg extends D{constructor(e,t){super(e,t),this.update=ht(re(this,this.update),We)}createEl(){return super.createEl("div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})}update(e,t,i){const n=fs(this.el_),r=bi(this.player_.el()),a=e.width*t;if(!r||!n)return;let l=e.left-r.left+a,c=e.width-a+(r.right-e.right);c||(c=e.width-a,l=a);let p=n.width/2;l<p?p+=p-l:c<p&&(p=c),p<0?p=0:p>n.width&&(p=n.width),p=Math.round(p),this.el_.style.right=`-${p}px`,this.write(i)}write(e){Dt(this.el_,e)}updateTime(e,t,i,n){this.requestNamedAnimationFrame("TimeTooltip#updateTime",()=>{let r;const a=this.player_.duration();if(this.player_.liveTracker&&this.player_.liveTracker.isLive()){const l=this.player_.liveTracker.liveWindow(),c=l-t*l;r=(c<1?"":"-")+Yt(c,l)}else r=Yt(i,a);this.update(e,t,r),n&&n()})}}D.registerComponent("TimeTooltip",Lg);class ka extends D{constructor(e,t){super(e,t),this.setIcon("circle"),this.update=ht(re(this,this.update),We)}createEl(){return super.createEl("div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})}update(e,t,i){const n=this.getChild("timeTooltip");if(!n)return;const r=i&&i.target&&typeof i.target.pendingSeekTime=="function"?i.target.pendingSeekTime():this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();n.updateTime(e,t,r)}}ka.prototype.options_={children:[]};!Se&&!Je&&ka.prototype.options_.children.push("timeTooltip");D.registerComponent("PlayProgressBar",ka);class sh extends D{constructor(e,t){super(e,t),this.update=ht(re(this,this.update),We)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t){const i=t*this.player_.duration();this.getChild("timeTooltip").updateTime(e,t,i,()=>{this.el_.style.left=`${e.width*t}px`})}}sh.prototype.options_={children:["timeTooltip"]};D.registerComponent("MouseTimeDisplay",sh);class Vn extends wa{constructor(e,t){t=se(Vn.prototype.options_,t),t.children=[...t.children];const i=e.options_.disableSeekWhileScrubbingOnMobile&&(Se||Je)||e.options_.disableSeekWhileScrubbingOnSTV;(!Se&&!Je||i)&&t.children.splice(1,0,"mouseTimeDisplay"),super(e,t),this.shouldDisableSeekWhileScrubbing_=i,this.pendingSeekTime_=null,this.setEventHandlers_()}setEventHandlers_(){this.update_=re(this,this.update),this.update=ht(this.update_,We),this.on(this.player_,["durationchange","timeupdate"],this.update),this.on(this.player_,["ended"],this.update_),this.player_.liveTracker&&this.on(this.player_.liveTracker,"liveedgechange",this.update),this.updateInterval=null,this.enableIntervalHandler_=e=>this.enableInterval_(e),this.disableIntervalHandler_=e=>this.disableInterval_(e),this.on(this.player_,["playing"],this.enableIntervalHandler_),this.on(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in N&&"visibilityState"in N&&this.on(N,"visibilitychange",this.toggleVisibility_)}toggleVisibility_(e){N.visibilityState==="hidden"?(this.cancelNamedAnimationFrame("SeekBar#update"),this.cancelNamedAnimationFrame("Slider#update"),this.disableInterval_(e)):(!this.player_.ended()&&!this.player_.paused()&&this.enableInterval_(),this.update())}enableInterval_(){this.updateInterval||(this.updateInterval=this.setInterval(this.update,We))}disableInterval_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&e&&e.type!=="ended"||this.updateInterval&&(this.clearInterval(this.updateInterval),this.updateInterval=null)}createEl(){return super.createEl("div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})}update(e){if(N.visibilityState==="hidden")return;const t=super.update();return this.requestNamedAnimationFrame("SeekBar#update",()=>{const i=this.player_.ended()?this.player_.duration():this.getCurrentTime_(),n=this.player_.liveTracker;let r=this.player_.duration();n&&n.isLive()&&(r=this.player_.liveTracker.liveCurrentTime()),this.percent_!==t&&(this.el_.setAttribute("aria-valuenow",(t*100).toFixed(2)),this.percent_=t),(this.currentTime_!==i||this.duration_!==r)&&(this.el_.setAttribute("aria-valuetext",this.localize("progress bar timing: currentTime={1} duration={2}",[Yt(i,r),Yt(r,r)],"{1} of {2}")),this.currentTime_=i,this.duration_=r),this.bar&&this.bar.update(bi(this.el()),this.getProgress(),e)}),t}userSeek_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)}getCurrentTime_(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()}pendingSeekTime(e){if(e!==void 0)if(e!==null){const t=this.player_.duration();this.pendingSeekTime_=Math.max(0,Math.min(e,t))}else this.pendingSeekTime_=null;return this.pendingSeekTime_}getPercent(){if(this.pendingSeekTime()!==null)return this.pendingSeekTime()/this.player_.duration();const e=this.getCurrentTime_();let t;const i=this.player_.liveTracker;return i&&i.isLive()?(t=(e-i.seekableStart())/i.liveWindow(),i.atLiveEdge()&&(t=1)):t=e/this.player_.duration(),t}handleMouseDown(e){ps(e)&&(e.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),this.shouldDisableSeekWhileScrubbing_||this.player_.pause(),super.handleMouseDown(e))}handleMouseMove(e,t=!1){if(!ps(e)||isNaN(this.player_.duration()))return;!t&&!this.player_.scrubbing()&&this.player_.scrubbing(!0);let i;const n=this.calculateDistance(e),r=this.player_.liveTracker;if(!r||!r.isLive())i=n*this.player_.duration(),i===this.player_.duration()&&(i=i-.1);else{if(n>=.99){r.seekToLiveEdge();return}const a=r.seekableStart(),l=r.liveCurrentTime();if(i=a+n*r.liveWindow(),i>=l&&(i=l),i<=a&&(i=a+.1),i===1/0)return}this.shouldDisableSeekWhileScrubbing_?this.pendingSeekTime(i):this.userSeek_(i),this.player_.options_.enableSmoothSeeking&&this.update()}enable(){super.enable();const e=this.getChild("mouseTimeDisplay");e&&e.show()}disable(){super.disable();const e=this.getChild("mouseTimeDisplay");e&&e.hide()}handleMouseUp(e){super.handleMouseUp(e),e&&e.stopPropagation(),this.player_.scrubbing(!1),this.pendingSeekTime()!==null&&(this.userSeek_(this.pendingSeekTime()),this.pendingSeekTime(null)),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0}),this.videoWasPlaying?nt(this.player_.play()):this.update_()}handlePendingSeek_(e){this.player_.paused()||this.player_.pause();const t=this.pendingSeekTime()!==null?this.pendingSeekTime():this.player_.currentTime();this.pendingSeekTime(t+e),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}stepForward(){this.shouldDisableSeekWhileScrubbing_?this.handlePendingSeek_(this.options().stepSeconds):this.userSeek_(this.player_.currentTime()+this.options().stepSeconds)}stepBack(){this.shouldDisableSeekWhileScrubbing_?this.handlePendingSeek_(-this.options().stepSeconds):this.userSeek_(this.player_.currentTime()-this.options().stepSeconds)}handleAction(e){this.pendingSeekTime()!==null&&(this.userSeek_(this.pendingSeekTime()),this.pendingSeekTime(null)),this.player_.paused()?this.player_.play():this.player_.pause()}handleKeyDown(e){const t=this.player_.liveTracker;if(e.key===" "||e.key==="Enter")e.preventDefault(),e.stopPropagation(),this.handleAction(e);else if(e.key==="Home")e.preventDefault(),e.stopPropagation(),this.userSeek_(0);else if(e.key==="End")e.preventDefault(),e.stopPropagation(),t&&t.isLive()?this.userSeek_(t.liveCurrentTime()):this.userSeek_(this.player_.duration());else if(/^[0-9]$/.test(e.key)){e.preventDefault(),e.stopPropagation();const i=parseInt(e.key,10)*.1;t&&t.isLive()?this.userSeek_(t.seekableStart()+t.liveWindow()*i):this.userSeek_(this.player_.duration()*i)}else e.key==="PageDown"?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()-this.options().stepSeconds*this.options().pageMultiplier)):e.key==="PageUp"?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()+this.options().stepSeconds*this.options().pageMultiplier)):super.handleKeyDown(e)}dispose(){this.disableInterval_(),this.off(this.player_,["durationchange","timeupdate"],this.update),this.off(this.player_,["ended"],this.update_),this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.update),this.off(this.player_,["playing"],this.enableIntervalHandler_),this.off(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in N&&"visibilityState"in N&&this.off(N,"visibilitychange",this.toggleVisibility_),super.dispose()}}Vn.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar",stepSeconds:5,pageMultiplier:12};D.registerComponent("SeekBar",Vn);class nh extends D{constructor(e,t){super(e,t),this.handleMouseMove=ht(re(this,this.handleMouseMove),We),this.throttledHandleMouseSeek=ht(re(this,this.handleMouseSeek),We),this.handleMouseUpHandler_=i=>this.handleMouseUp(i),this.handleMouseDownHandler_=i=>this.handleMouseDown(i),this.enable()}createEl(){return super.createEl("div",{className:"vjs-progress-control vjs-control"})}handleMouseMove(e){const t=this.getChild("seekBar");if(!t)return;const i=t.getChild("playProgressBar"),n=t.getChild("mouseTimeDisplay");if(!i&&!n)return;const r=t.el(),a=fs(r);let l=Bn(r,e).x;l=_s(l,0,1),n&&n.update(a,l),i&&i.update(a,t.getProgress())}handleMouseSeek(e){const t=this.getChild("seekBar");t&&t.handleMouseMove(e)}enabled(){return this.enabled_}disable(){if(this.children().forEach(e=>e.disable&&e.disable()),!!this.enabled()&&(this.off(["mousedown","touchstart"],this.handleMouseDownHandler_),this.off(this.el_,["mousemove","touchmove"],this.handleMouseMove),this.removeListenersAddedOnMousedownAndTouchstart(),this.addClass("disabled"),this.enabled_=!1,this.player_.scrubbing())){const e=this.getChild("seekBar");this.player_.scrubbing(!1),e.videoWasPlaying&&nt(this.player_.play())}}enable(){this.children().forEach(e=>e.enable&&e.enable()),!this.enabled()&&(this.on(["mousedown","touchstart"],this.handleMouseDownHandler_),this.on(this.el_,["mousemove","touchmove"],this.handleMouseMove),this.removeClass("disabled"),this.enabled_=!0)}removeListenersAddedOnMousedownAndTouchstart(){const e=this.el_.ownerDocument;this.off(e,"mousemove",this.throttledHandleMouseSeek),this.off(e,"touchmove",this.throttledHandleMouseSeek),this.off(e,"mouseup",this.handleMouseUpHandler_),this.off(e,"touchend",this.handleMouseUpHandler_)}handleMouseDown(e){const t=this.el_.ownerDocument,i=this.getChild("seekBar");i&&i.handleMouseDown(e),this.on(t,"mousemove",this.throttledHandleMouseSeek),this.on(t,"touchmove",this.throttledHandleMouseSeek),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){const t=this.getChild("seekBar");t&&t.handleMouseUp(e),this.removeListenersAddedOnMousedownAndTouchstart()}}nh.prototype.options_={children:["seekBar"]};D.registerComponent("ProgressControl",nh);class rh extends Ee{constructor(e,t){super(e,t),this.setIcon("picture-in-picture-enter"),this.on(e,["enterpictureinpicture","leavepictureinpicture"],i=>this.handlePictureInPictureChange(i)),this.on(e,["disablepictureinpicturechanged","loadedmetadata"],i=>this.handlePictureInPictureEnabledChange(i)),this.on(e,["loadedmetadata","audioonlymodechange","audiopostermodechange"],()=>this.handlePictureInPictureAudioModeChange()),this.disable()}buildCSSClass(){return`vjs-picture-in-picture-control vjs-hidden ${super.buildCSSClass()}`}handlePictureInPictureAudioModeChange(){if(!(this.player_.currentType().substring(0,5)==="audio"||this.player_.audioPosterMode()||this.player_.audioOnlyMode())){this.show();return}this.player_.isInPictureInPicture()&&this.player_.exitPictureInPicture(),this.hide()}handlePictureInPictureEnabledChange(){N.pictureInPictureEnabled&&this.player_.disablePictureInPicture()===!1||this.player_.options_.enableDocumentPictureInPicture&&"documentPictureInPicture"in x?this.enable():this.disable()}handlePictureInPictureChange(e){this.player_.isInPictureInPicture()?(this.setIcon("picture-in-picture-exit"),this.controlText("Exit Picture-in-Picture")):(this.setIcon("picture-in-picture-enter"),this.controlText("Picture-in-Picture")),this.handlePictureInPictureEnabledChange()}handleClick(e){this.player_.isInPictureInPicture()?this.player_.exitPictureInPicture():this.player_.requestPictureInPicture()}show(){typeof N.exitPictureInPicture=="function"&&super.show()}}rh.prototype.controlText_="Picture-in-Picture";D.registerComponent("PictureInPictureToggle",rh);class ah extends Ee{constructor(e,t){super(e,t),this.setIcon("fullscreen-enter"),this.on(e,"fullscreenchange",i=>this.handleFullscreenChange(i)),N[e.fsApi_.fullscreenEnabled]===!1&&this.disable()}buildCSSClass(){return`vjs-fullscreen-control ${super.buildCSSClass()}`}handleFullscreenChange(e){this.player_.isFullscreen()?(this.controlText("Exit Fullscreen"),this.setIcon("fullscreen-exit")):(this.controlText("Fullscreen"),this.setIcon("fullscreen-enter"))}handleClick(e){this.player_.isFullscreen()?this.player_.exitFullscreen():this.player_.requestFullscreen()}}ah.prototype.controlText_="Fullscreen";D.registerComponent("FullscreenToggle",ah);const Dg=function(s,e){e.tech_&&!e.tech_.featuresVolumeControl&&s.addClass("vjs-hidden"),s.on(e,"loadstart",function(){e.tech_.featuresVolumeControl?s.removeClass("vjs-hidden"):s.addClass("vjs-hidden")})};class Og extends D{createEl(){const e=super.createEl("div",{className:"vjs-volume-level"});return this.setIcon("circle",e),e.appendChild(super.createEl("span",{className:"vjs-control-text"})),e}}D.registerComponent("VolumeLevel",Og);class Mg extends D{constructor(e,t){super(e,t),this.update=ht(re(this,this.update),We)}createEl(){return super.createEl("div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})}update(e,t,i,n){if(!i){const r=bi(this.el_),a=bi(this.player_.el()),l=e.width*t;if(!a||!r)return;const c=e.left-a.left+l,p=e.width-l+(a.right-e.right);let g=r.width/2;c<g?g+=g-c:p<g&&(g=p),g<0?g=0:g>r.width&&(g=r.width),this.el_.style.right=`-${g}px`}this.write(`${n}%`)}write(e){Dt(this.el_,e)}updateVolume(e,t,i,n,r){this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",()=>{this.update(e,t,i,n.toFixed(0)),r&&r()})}}D.registerComponent("VolumeLevelTooltip",Mg);class oh extends D{constructor(e,t){super(e,t),this.update=ht(re(this,this.update),We)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t,i){const n=100*t;this.getChild("volumeLevelTooltip").updateVolume(e,t,i,n,()=>{i?this.el_.style.bottom=`${e.height*t}px`:this.el_.style.left=`${e.width*t}px`})}}oh.prototype.options_={children:["volumeLevelTooltip"]};D.registerComponent("MouseVolumeLevelDisplay",oh);class qn extends wa{constructor(e,t){super(e,t),this.on("slideractive",i=>this.updateLastVolume_(i)),this.on(e,"volumechange",i=>this.updateARIAAttributes(i)),e.ready(()=>this.updateARIAAttributes())}createEl(){return super.createEl("div",{className:"vjs-volume-bar vjs-slider-bar"},{"aria-label":this.localize("Volume Level"),"aria-live":"polite"})}handleMouseDown(e){ps(e)&&super.handleMouseDown(e)}handleMouseMove(e){const t=this.getChild("mouseVolumeLevelDisplay");if(t){const i=this.el(),n=bi(i),r=this.vertical();let a=Bn(i,e);a=r?a.y:a.x,a=_s(a,0,1),t.update(n,a,r)}ps(e)&&(this.checkMuted(),this.player_.volume(this.calculateDistance(e)))}checkMuted(){this.player_.muted()&&this.player_.muted(!1)}getPercent(){return this.player_.muted()?0:this.player_.volume()}stepForward(){this.checkMuted(),this.player_.volume(this.player_.volume()+.1)}stepBack(){this.checkMuted(),this.player_.volume(this.player_.volume()-.1)}updateARIAAttributes(e){const t=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",t),this.el_.setAttribute("aria-valuetext",t+"%")}volumeAsPercentage_(){return Math.round(this.player_.volume()*100)}updateLastVolume_(){const e=this.player_.volume();this.one("sliderinactive",()=>{this.player_.volume()===0&&this.player_.lastVolume_(e)})}}qn.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"};!Se&&!Je&&qn.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay");qn.prototype.playerEvent="volumechange";D.registerComponent("VolumeBar",qn);class lh extends D{constructor(e,t={}){t.vertical=t.vertical||!1,(typeof t.volumeBar>"u"||Ti(t.volumeBar))&&(t.volumeBar=t.volumeBar||{},t.volumeBar.vertical=t.vertical),super(e,t),Dg(this,e),this.throttledHandleMouseMove=ht(re(this,this.handleMouseMove),We),this.handleMouseUpHandler_=i=>this.handleMouseUp(i),this.on("mousedown",i=>this.handleMouseDown(i)),this.on("touchstart",i=>this.handleMouseDown(i)),this.on("mousemove",i=>this.handleMouseMove(i)),this.on(this.volumeBar,["focus","slideractive"],()=>{this.volumeBar.addClass("vjs-slider-active"),this.addClass("vjs-slider-active"),this.trigger("slideractive")}),this.on(this.volumeBar,["blur","sliderinactive"],()=>{this.volumeBar.removeClass("vjs-slider-active"),this.removeClass("vjs-slider-active"),this.trigger("sliderinactive")})}createEl(){let e="vjs-volume-horizontal";return this.options_.vertical&&(e="vjs-volume-vertical"),super.createEl("div",{className:`vjs-volume-control vjs-control ${e}`})}handleMouseDown(e){const t=this.el_.ownerDocument;this.on(t,"mousemove",this.throttledHandleMouseMove),this.on(t,"touchmove",this.throttledHandleMouseMove),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){const t=this.el_.ownerDocument;this.off(t,"mousemove",this.throttledHandleMouseMove),this.off(t,"touchmove",this.throttledHandleMouseMove),this.off(t,"mouseup",this.handleMouseUpHandler_),this.off(t,"touchend",this.handleMouseUpHandler_)}handleMouseMove(e){this.volumeBar.handleMouseMove(e)}}lh.prototype.options_={children:["volumeBar"]};D.registerComponent("VolumeControl",lh);const Rg=function(s,e){e.tech_&&!e.tech_.featuresMuteControl&&s.addClass("vjs-hidden"),s.on(e,"loadstart",function(){e.tech_.featuresMuteControl?s.removeClass("vjs-hidden"):s.addClass("vjs-hidden")})};class uh extends Ee{constructor(e,t){super(e,t),Rg(this,e),this.on(e,["loadstart","volumechange"],i=>this.update(i))}buildCSSClass(){return`vjs-mute-control ${super.buildCSSClass()}`}handleClick(e){const t=this.player_.volume(),i=this.player_.lastVolume_();if(t===0){const n=i<.1?.1:i;this.player_.volume(n),this.player_.muted(!1)}else this.player_.muted(!this.player_.muted())}update(e){this.updateIcon_(),this.updateControlText_()}updateIcon_(){const e=this.player_.volume();let t=3;this.setIcon("volume-high"),Se&&this.player_.tech_&&this.player_.tech_.el_&&this.player_.muted(this.player_.tech_.el_.muted),e===0||this.player_.muted()?(this.setIcon("volume-mute"),t=0):e<.33?(this.setIcon("volume-low"),t=1):e<.67&&(this.setIcon("volume-medium"),t=2),Mn(this.el_,[0,1,2,3].reduce((i,n)=>i+`${n?" ":""}vjs-vol-${n}`,"")),Gt(this.el_,`vjs-vol-${t}`)}updateControlText_(){const t=this.player_.muted()||this.player_.volume()===0?"Unmute":"Mute";this.controlText()!==t&&this.controlText(t)}}uh.prototype.controlText_="Mute";D.registerComponent("MuteToggle",uh);class hh extends D{constructor(e,t={}){typeof t.inline<"u"?t.inline=t.inline:t.inline=!0,(typeof t.volumeControl>"u"||Ti(t.volumeControl))&&(t.volumeControl=t.volumeControl||{},t.volumeControl.vertical=!t.inline),super(e,t),this.handleKeyPressHandler_=i=>this.handleKeyPress(i),this.on(e,["loadstart"],i=>this.volumePanelState_(i)),this.on(this.muteToggle,"keyup",i=>this.handleKeyPress(i)),this.on(this.volumeControl,"keyup",i=>this.handleVolumeControlKeyUp(i)),this.on("keydown",i=>this.handleKeyPress(i)),this.on("mouseover",i=>this.handleMouseOver(i)),this.on("mouseout",i=>this.handleMouseOut(i)),this.on(this.volumeControl,["slideractive"],this.sliderActive_),this.on(this.volumeControl,["sliderinactive"],this.sliderInactive_)}sliderActive_(){this.addClass("vjs-slider-active")}sliderInactive_(){this.removeClass("vjs-slider-active")}volumePanelState_(){this.volumeControl.hasClass("vjs-hidden")&&this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-hidden"),this.volumeControl.hasClass("vjs-hidden")&&!this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-mute-toggle-only")}createEl(){let e="vjs-volume-panel-horizontal";return this.options_.inline||(e="vjs-volume-panel-vertical"),super.createEl("div",{className:`vjs-volume-panel vjs-control ${e}`})}dispose(){this.handleMouseOut(),super.dispose()}handleVolumeControlKeyUp(e){e.key==="Escape"&&this.muteToggle.focus()}handleMouseOver(e){this.addClass("vjs-hover"),je(N,"keyup",this.handleKeyPressHandler_)}handleMouseOut(e){this.removeClass("vjs-hover"),Ce(N,"keyup",this.handleKeyPressHandler_)}handleKeyPress(e){e.key==="Escape"&&this.handleMouseOut()}}hh.prototype.options_={children:["muteToggle","volumeControl"]};D.registerComponent("VolumePanel",hh);class dh extends Ee{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipForwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.setIcon(`forward-${this.skipTime}`),this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime.toLocaleString(e.language())])),this.show()):this.hide()}getSkipForwardTime(){const e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.forward}buildCSSClass(){return`vjs-skip-forward-${this.getSkipForwardTime()} ${super.buildCSSClass()}`}handleClick(e){if(isNaN(this.player_.duration()))return;const t=this.player_.currentTime(),i=this.player_.liveTracker,n=i&&i.isLive()?i.seekableEnd():this.player_.duration();let r;t+this.skipTime<=n?r=t+this.skipTime:r=n,this.player_.currentTime(r)}handleLanguagechange(){this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime]))}}dh.prototype.controlText_="Skip Forward";D.registerComponent("SkipForward",dh);class ch extends Ee{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipBackwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.setIcon(`replay-${this.skipTime}`),this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime.toLocaleString(e.language())])),this.show()):this.hide()}getSkipBackwardTime(){const e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.backward}buildCSSClass(){return`vjs-skip-backward-${this.getSkipBackwardTime()} ${super.buildCSSClass()}`}handleClick(e){const t=this.player_.currentTime(),i=this.player_.liveTracker,n=i&&i.isLive()&&i.seekableStart();let r;n&&t-this.skipTime<=n?r=n:t>=this.skipTime?r=t-this.skipTime:r=0,this.player_.currentTime(r)}handleLanguagechange(){this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime]))}}ch.prototype.controlText_="Skip Backward";D.registerComponent("SkipBackward",ch);class fh extends D{constructor(e,t){super(e,t),t&&(this.menuButton_=t.menuButton),this.focusedChild_=-1,this.on("keydown",i=>this.handleKeyDown(i)),this.boundHandleBlur_=i=>this.handleBlur(i),this.boundHandleTapClick_=i=>this.handleTapClick(i)}addEventListenerForItem(e){e instanceof D&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))}removeEventListenerForItem(e){e instanceof D&&(this.off(e,"blur",this.boundHandleBlur_),this.off(e,["tap","click"],this.boundHandleTapClick_))}removeChild(e){typeof e=="string"&&(e=this.getChild(e)),this.removeEventListenerForItem(e),super.removeChild(e)}addItem(e){const t=this.addChild(e);t&&this.addEventListenerForItem(t)}createEl(){const e=this.options_.contentElType||"ul";this.contentEl_=G(e,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu");const t=super.createEl("div",{append:this.contentEl_,className:"vjs-menu"});return t.appendChild(this.contentEl_),je(t,"click",function(i){i.preventDefault(),i.stopImmediatePropagation()}),t}dispose(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,super.dispose()}handleBlur(e){const t=e.relatedTarget||N.activeElement;if(!this.children().some(i=>i.el()===t)){const i=this.menuButton_;i&&i.buttonPressed_&&t!==i.el().firstChild&&i.unpressButton()}}handleTapClick(e){if(this.menuButton_){this.menuButton_.unpressButton();const t=this.children();if(!Array.isArray(t))return;const i=t.filter(n=>n.el()===e.target)[0];if(!i)return;i.name()!=="CaptionSettingsMenuItem"&&this.menuButton_.focus()}}handleKeyDown(e){e.key==="ArrowLeft"||e.key==="ArrowDown"?(e.preventDefault(),e.stopPropagation(),this.stepForward()):(e.key==="ArrowRight"||e.key==="ArrowUp")&&(e.preventDefault(),e.stopPropagation(),this.stepBack())}stepForward(){let e=0;this.focusedChild_!==void 0&&(e=this.focusedChild_+1),this.focus(e)}stepBack(){let e=0;this.focusedChild_!==void 0&&(e=this.focusedChild_-1),this.focus(e)}focus(e=0){const t=this.children().slice();t.length&&t[0].hasClass("vjs-menu-title")&&t.shift(),t.length>0&&(e<0?e=0:e>=t.length&&(e=t.length-1),this.focusedChild_=e,t[e].el_.focus())}}D.registerComponent("Menu",fh);class Ia extends D{constructor(e,t={}){super(e,t),this.menuButton_=new Ee(e,t),this.menuButton_.controlText(this.controlText_),this.menuButton_.el_.setAttribute("aria-haspopup","true");const i=Ee.prototype.buildCSSClass();this.menuButton_.el_.className=this.buildCSSClass()+" "+i,this.menuButton_.removeClass("vjs-control"),this.addChild(this.menuButton_),this.update(),this.enabled_=!0;const n=r=>this.handleClick(r);this.handleMenuKeyUp_=r=>this.handleMenuKeyUp(r),this.on(this.menuButton_,"tap",n),this.on(this.menuButton_,"click",n),this.on(this.menuButton_,"keydown",r=>this.handleKeyDown(r)),this.on(this.menuButton_,"mouseenter",()=>{this.addClass("vjs-hover"),this.menu.show(),je(N,"keyup",this.handleMenuKeyUp_)}),this.on("mouseleave",r=>this.handleMouseLeave(r)),this.on("keydown",r=>this.handleSubmenuKeyDown(r))}update(){const e=this.createMenu();this.menu&&(this.menu.dispose(),this.removeChild(this.menu)),this.menu=e,this.addChild(e),this.buttonPressed_=!1,this.menuButton_.el_.setAttribute("aria-expanded","false"),this.items&&this.items.length<=this.hideThreshold_?(this.hide(),this.menu.contentEl_.removeAttribute("role")):(this.show(),this.menu.contentEl_.setAttribute("role","menu"))}createMenu(){const e=new fh(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){const t=G("li",{className:"vjs-menu-title",textContent:pe(this.options_.title),tabIndex:-1}),i=new D(this.player_,{el:t});e.addItem(i)}if(this.items=this.createItems(),this.items)for(let t=0;t<this.items.length;t++)e.addItem(this.items[t]);return e}createItems(){}createEl(){return super.createEl("div",{className:this.buildWrapperCSSClass()},{})}setIcon(e){super.setIcon(e,this.menuButton_.el_)}buildWrapperCSSClass(){let e="vjs-menu-button";this.options_.inline===!0?e+="-inline":e+="-popup";const t=Ee.prototype.buildCSSClass();return`vjs-menu-button ${e} ${t} ${super.buildCSSClass()}`}buildCSSClass(){let e="vjs-menu-button";return this.options_.inline===!0?e+="-inline":e+="-popup",`vjs-menu-button ${e} ${super.buildCSSClass()}`}controlText(e,t=this.menuButton_.el()){return this.menuButton_.controlText(e,t)}dispose(){this.handleMouseLeave(),super.dispose()}handleClick(e){this.buttonPressed_?this.unpressButton():this.pressButton()}handleMouseLeave(e){this.removeClass("vjs-hover"),Ce(N,"keyup",this.handleMenuKeyUp_)}focus(){this.menuButton_.focus()}blur(){this.menuButton_.blur()}handleKeyDown(e){e.key==="Escape"||e.key==="Tab"?(this.buttonPressed_&&this.unpressButton(),!e.key==="Tab"&&(e.preventDefault(),this.menuButton_.focus())):(e.key==="Up"||e.key==="Down"&&!(this.player_.options_.playerOptions.spatialNavigation&&this.player_.options_.playerOptions.spatialNavigation.enabled))&&(this.buttonPressed_||(e.preventDefault(),this.pressButton()))}handleMenuKeyUp(e){(e.key==="Escape"||e.key==="Tab")&&this.removeClass("vjs-hover")}handleSubmenuKeyPress(e){this.handleSubmenuKeyDown(e)}handleSubmenuKeyDown(e){(e.key==="Escape"||e.key==="Tab")&&(this.buttonPressed_&&this.unpressButton(),!e.key==="Tab"&&(e.preventDefault(),this.menuButton_.focus()))}pressButton(){if(this.enabled_){if(this.buttonPressed_=!0,this.menu.show(),this.menu.lockShowing(),this.menuButton_.el_.setAttribute("aria-expanded","true"),Se&&Su())return;this.menu.focus()}}unpressButton(){this.enabled_&&(this.buttonPressed_=!1,this.menu.unlockShowing(),this.menu.hide(),this.menuButton_.el_.setAttribute("aria-expanded","false"))}disable(){this.unpressButton(),this.enabled_=!1,this.addClass("vjs-disabled"),this.menuButton_.disable()}enable(){this.enabled_=!0,this.removeClass("vjs-disabled"),this.menuButton_.enable()}}D.registerComponent("MenuButton",Ia);class Pa extends Ia{constructor(e,t){const i=t.tracks;if(super(e,t),this.items.length<=1&&this.hide(),!i)return;const n=re(this,this.update);i.addEventListener("removetrack",n),i.addEventListener("addtrack",n),i.addEventListener("labelchange",n),this.player_.on("ready",n),this.player_.on("dispose",function(){i.removeEventListener("removetrack",n),i.removeEventListener("addtrack",n),i.removeEventListener("labelchange",n)})}}D.registerComponent("TrackButton",Pa);class ys extends Hn{constructor(e,t){super(e,t),this.selectable=t.selectable,this.isSelected_=t.selected||!1,this.multiSelectable=t.multiSelectable,this.selected(this.isSelected_),this.selectable?this.multiSelectable?this.el_.setAttribute("role","menuitemcheckbox"):this.el_.setAttribute("role","menuitemradio"):this.el_.setAttribute("role","menuitem")}createEl(e,t,i){this.nonIconControl=!0;const n=super.createEl("li",Object.assign({className:"vjs-menu-item",tabIndex:-1},t),i),r=G("span",{className:"vjs-menu-item-text",textContent:this.localize(this.options_.label)});return this.player_.options_.experimentalSvgIcons?n.appendChild(r):n.replaceChild(r,n.querySelector(".vjs-icon-placeholder")),n}handleKeyDown(e){["Tab","Escape","ArrowUp","ArrowLeft","ArrowRight","ArrowDown"].includes(e.key)||super.handleKeyDown(e)}handleClick(e){this.selected(!0)}selected(e){this.selectable&&(e?(this.addClass("vjs-selected"),this.el_.setAttribute("aria-checked","true"),this.controlText(", selected"),this.isSelected_=!0):(this.removeClass("vjs-selected"),this.el_.setAttribute("aria-checked","false"),this.controlText(""),this.isSelected_=!1))}}D.registerComponent("MenuItem",ys);class Ts extends ys{constructor(e,t){const i=t.track,n=e.textTracks();t.label=i.label||i.language||"Unknown",t.selected=i.mode==="showing",super(e,t),this.track=i,this.kinds=(t.kinds||[t.kind||this.track.kind]).filter(Boolean);const r=(...l)=>{this.handleTracksChange.apply(this,l)},a=(...l)=>{this.handleSelectedLanguageChange.apply(this,l)};if(e.on(["loadstart","texttrackchange"],r),n.addEventListener("change",r),n.addEventListener("selectedlanguagechange",a),this.on("dispose",function(){e.off(["loadstart","texttrackchange"],r),n.removeEventListener("change",r),n.removeEventListener("selectedlanguagechange",a)}),n.onchange===void 0){let l;this.on(["tap","click"],function(){if(typeof x.Event!="object")try{l=new x.Event("change")}catch{}l||(l=N.createEvent("Event"),l.initEvent("change",!0,!0)),n.dispatchEvent(l)})}this.handleTracksChange()}handleClick(e){const t=this.track,i=this.player_.textTracks();if(super.handleClick(e),!!i)for(let n=0;n<i.length;n++){const r=i[n];this.kinds.indexOf(r.kind)!==-1&&(r===t?r.mode!=="showing"&&(r.mode="showing"):r.mode!=="disabled"&&(r.mode="disabled"))}}handleTracksChange(e){const t=this.track.mode==="showing";t!==this.isSelected_&&this.selected(t)}handleSelectedLanguageChange(e){if(this.track.mode==="showing"){const t=this.player_.cache_.selectedLanguage;if(t&&t.enabled&&t.language===this.track.language&&t.kind!==this.track.kind)return;this.player_.cache_.selectedLanguage={enabled:!0,language:this.track.language,kind:this.track.kind}}}dispose(){this.track=null,super.dispose()}}D.registerComponent("TextTrackMenuItem",Ts);class ph extends Ts{constructor(e,t){t.track={player:e,kind:t.kind,kinds:t.kinds,default:!1,mode:"disabled"},t.kinds||(t.kinds=[t.kind]),t.label?t.track.label=t.label:t.track.label=t.kinds.join(" and ")+" off",t.selectable=!0,t.multiSelectable=!1,super(e,t)}handleTracksChange(e){const t=this.player().textTracks();let i=!0;for(let n=0,r=t.length;n<r;n++){const a=t[n];if(this.options_.kinds.indexOf(a.kind)>-1&&a.mode==="showing"){i=!1;break}}i!==this.isSelected_&&this.selected(i)}handleSelectedLanguageChange(e){const t=this.player().textTracks();let i=!0;for(let n=0,r=t.length;n<r;n++){const a=t[n];if(["captions","descriptions","subtitles"].indexOf(a.kind)>-1&&a.mode==="showing"){i=!1;break}}i&&(this.player_.cache_.selectedLanguage={enabled:!1})}handleLanguagechange(){this.$(".vjs-menu-item-text").textContent=this.player_.localize(this.options_.label),super.handleLanguagechange()}}D.registerComponent("OffTextTrackMenuItem",ph);class Li extends Pa{constructor(e,t={}){t.tracks=e.textTracks(),super(e,t)}createItems(e=[],t=Ts){let i;this.label_&&(i=`${this.label_} off`),e.push(new ph(this.player_,{kinds:this.kinds_,kind:this.kind_,label:i})),this.hideThreshold_+=1;const n=this.player_.textTracks();Array.isArray(this.kinds_)||(this.kinds_=[this.kind_]);for(let r=0;r<n.length;r++){const a=n[r];if(this.kinds_.indexOf(a.kind)>-1){const l=new t(this.player_,{track:a,kinds:this.kinds_,kind:this.kind_,selectable:!0,multiSelectable:!1});l.addClass(`vjs-${a.kind}-menu-item`),e.push(l)}}return e}}D.registerComponent("TextTrackButton",Li);class mh extends ys{constructor(e,t){const i=t.track,n=t.cue,r=e.currentTime();t.selectable=!0,t.multiSelectable=!1,t.label=n.text,t.selected=n.startTime<=r&&r<n.endTime,super(e,t),this.track=i,this.cue=n}handleClick(e){super.handleClick(),this.player_.currentTime(this.cue.startTime)}}D.registerComponent("ChaptersTrackMenuItem",mh);class Aa extends Li{constructor(e,t,i){super(e,t,i),this.setIcon("chapters"),this.selectCurrentItem_=()=>{this.items.forEach(n=>{n.selected(this.track_.activeCues[0]===n.cue)})}}buildCSSClass(){return`vjs-chapters-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-chapters-button ${super.buildWrapperCSSClass()}`}update(e){if(e&&e.track&&e.track.kind!=="chapters")return;const t=this.findChaptersTrack();t!==this.track_?(this.setTrack(t),super.update()):(!this.items||t&&t.cues&&t.cues.length!==this.items.length)&&super.update()}setTrack(e){if(this.track_!==e){if(this.updateHandler_||(this.updateHandler_=this.update.bind(this)),this.track_){const t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);t&&t.removeEventListener("load",this.updateHandler_),this.track_.removeEventListener("cuechange",this.selectCurrentItem_),this.track_=null}if(this.track_=e,this.track_){this.track_.mode="hidden";const t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);t&&t.addEventListener("load",this.updateHandler_),this.track_.addEventListener("cuechange",this.selectCurrentItem_)}}}findChaptersTrack(){const e=this.player_.textTracks()||[];for(let t=e.length-1;t>=0;t--){const i=e[t];if(i.kind===this.kind_)return i}}getMenuCaption(){return this.track_&&this.track_.label?this.track_.label:this.localize(pe(this.kind_))}createMenu(){return this.options_.title=this.getMenuCaption(),super.createMenu()}createItems(){const e=[];if(!this.track_)return e;const t=this.track_.cues;if(!t)return e;for(let i=0,n=t.length;i<n;i++){const r=t[i],a=new mh(this.player_,{track:this.track_,cue:r});e.push(a)}return e}}Aa.prototype.kind_="chapters";Aa.prototype.controlText_="Chapters";D.registerComponent("ChaptersButton",Aa);class La extends Li{constructor(e,t,i){super(e,t,i),this.setIcon("audio-description");const n=e.textTracks(),r=re(this,this.handleTracksChange);n.addEventListener("change",r),this.on("dispose",function(){n.removeEventListener("change",r)})}handleTracksChange(e){const t=this.player().textTracks();let i=!1;for(let n=0,r=t.length;n<r;n++){const a=t[n];if(a.kind!==this.kind_&&a.mode==="showing"){i=!0;break}}i?this.disable():this.enable()}buildCSSClass(){return`vjs-descriptions-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-descriptions-button ${super.buildWrapperCSSClass()}`}}La.prototype.kind_="descriptions";La.prototype.controlText_="Descriptions";D.registerComponent("DescriptionsButton",La);class Da extends Li{constructor(e,t,i){super(e,t,i),this.setIcon("subtitles")}buildCSSClass(){return`vjs-subtitles-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-subtitles-button ${super.buildWrapperCSSClass()}`}}Da.prototype.kind_="subtitles";Da.prototype.controlText_="Subtitles";D.registerComponent("SubtitlesButton",Da);class Oa extends Ts{constructor(e,t){t.track={player:e,kind:t.kind,label:t.kind+" settings",selectable:!1,default:!1,mode:"disabled"},t.selectable=!1,t.name="CaptionSettingsMenuItem",super(e,t),this.addClass("vjs-texttrack-settings"),this.controlText(", opens "+t.kind+" settings dialog")}handleClick(e){this.player().getChild("textTrackSettings").open()}handleLanguagechange(){this.$(".vjs-menu-item-text").textContent=this.player_.localize(this.options_.kind+" settings"),super.handleLanguagechange()}}D.registerComponent("CaptionSettingsMenuItem",Oa);class Ma extends Li{constructor(e,t,i){super(e,t,i),this.setIcon("captions")}buildCSSClass(){return`vjs-captions-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-captions-button ${super.buildWrapperCSSClass()}`}createItems(){const e=[];return!(this.player().tech_&&this.player().tech_.featuresNativeTextTracks)&&this.player().getChild("textTrackSettings")&&(e.push(new Oa(this.player_,{kind:this.kind_})),this.hideThreshold_+=1),super.createItems(e)}}Ma.prototype.kind_="captions";Ma.prototype.controlText_="Captions";D.registerComponent("CaptionsButton",Ma);class gh extends Ts{createEl(e,t,i){const n=super.createEl(e,t,i),r=n.querySelector(".vjs-menu-item-text");return this.options_.track.kind==="captions"&&(this.player_.options_.experimentalSvgIcons?this.setIcon("captions",n):r.appendChild(G("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),r.appendChild(G("span",{className:"vjs-control-text",textContent:` ${this.localize("Captions")}`}))),n}}D.registerComponent("SubsCapsMenuItem",gh);class Ra extends Li{constructor(e,t={}){super(e,t),this.label_="subtitles",this.setIcon("subtitles"),["en","en-us","en-ca","fr-ca"].indexOf(this.player_.language_)>-1&&(this.label_="captions",this.setIcon("captions")),this.menuButton_.controlText(pe(this.label_))}buildCSSClass(){return`vjs-subs-caps-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-subs-caps-button ${super.buildWrapperCSSClass()}`}createItems(){let e=[];return!(this.player().tech_&&this.player().tech_.featuresNativeTextTracks)&&this.player().getChild("textTrackSettings")&&(e.push(new Oa(this.player_,{kind:this.label_})),this.hideThreshold_+=1),e=super.createItems(e,gh),e}}Ra.prototype.kinds_=["captions","subtitles"];Ra.prototype.controlText_="Subtitles";D.registerComponent("SubsCapsButton",Ra);class _h extends ys{constructor(e,t){const i=t.track,n=e.audioTracks();t.label=i.label||i.language||"Unknown",t.selected=i.enabled,super(e,t),this.track=i,this.addClass(`vjs-${i.kind}-menu-item`);const r=(...a)=>{this.handleTracksChange.apply(this,a)};n.addEventListener("change",r),this.on("dispose",()=>{n.removeEventListener("change",r)})}createEl(e,t,i){const n=super.createEl(e,t,i),r=n.querySelector(".vjs-menu-item-text");return["main-desc","descriptions"].indexOf(this.options_.track.kind)>=0&&(r.appendChild(G("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),r.appendChild(G("span",{className:"vjs-control-text",textContent:" "+this.localize("Descriptions")}))),n}handleClick(e){if(super.handleClick(e),this.track.enabled=!0,this.player_.tech_.featuresNativeAudioTracks){const t=this.player_.audioTracks();for(let i=0;i<t.length;i++){const n=t[i];n!==this.track&&(n.enabled=n===this.track)}}}handleTracksChange(e){this.selected(this.track.enabled)}}D.registerComponent("AudioTrackMenuItem",_h);class yh extends Pa{constructor(e,t={}){t.tracks=e.audioTracks(),super(e,t),this.setIcon("audio")}buildCSSClass(){return`vjs-audio-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-audio-button ${super.buildWrapperCSSClass()}`}createItems(e=[]){this.hideThreshold_=1;const t=this.player_.audioTracks();for(let i=0;i<t.length;i++){const n=t[i];e.push(new _h(this.player_,{track:n,selectable:!0,multiSelectable:!1}))}return e}}yh.prototype.controlText_="Audio Track";D.registerComponent("AudioTrackButton",yh);class Ba extends ys{constructor(e,t){const i=t.rate,n=parseFloat(i,10);t.label=i,t.selected=n===e.playbackRate(),t.selectable=!0,t.multiSelectable=!1,super(e,t),this.label=i,this.rate=n,this.on(e,"ratechange",r=>this.update(r))}handleClick(e){super.handleClick(),this.player().playbackRate(this.rate)}update(e){this.selected(this.player().playbackRate()===this.rate)}}Ba.prototype.contentElType="button";D.registerComponent("PlaybackRateMenuItem",Ba);class Th extends Ia{constructor(e,t){super(e,t),this.menuButton_.el_.setAttribute("aria-describedby",this.labelElId_),this.updateVisibility(),this.updateLabel(),this.on(e,"loadstart",i=>this.updateVisibility(i)),this.on(e,"ratechange",i=>this.updateLabel(i)),this.on(e,"playbackrateschange",i=>this.handlePlaybackRateschange(i))}createEl(){const e=super.createEl();return this.labelElId_="vjs-playback-rate-value-label-"+this.id_,this.labelEl_=G("div",{className:"vjs-playback-rate-value",id:this.labelElId_,textContent:"1x"}),e.appendChild(this.labelEl_),e}dispose(){this.labelEl_=null,super.dispose()}buildCSSClass(){return`vjs-playback-rate ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-playback-rate ${super.buildWrapperCSSClass()}`}createItems(){const e=this.playbackRates(),t=[];for(let i=e.length-1;i>=0;i--)t.push(new Ba(this.player(),{rate:e[i]+"x"}));return t}handlePlaybackRateschange(e){this.update()}playbackRates(){const e=this.player();return e.playbackRates&&e.playbackRates()||[]}playbackRateSupported(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&this.playbackRates().length>0}updateVisibility(e){this.playbackRateSupported()?this.removeClass("vjs-hidden"):this.addClass("vjs-hidden")}updateLabel(e){this.playbackRateSupported()&&(this.labelEl_.textContent=this.player().playbackRate()+"x")}}Th.prototype.controlText_="Playback Rate";D.registerComponent("PlaybackRateMenuButton",Th);class vh extends D{buildCSSClass(){return`vjs-spacer ${super.buildCSSClass()}`}createEl(e="div",t={},i={}){return t.className||(t.className=this.buildCSSClass()),super.createEl(e,t,i)}}D.registerComponent("Spacer",vh);class Bg extends vh{buildCSSClass(){return`vjs-custom-control-spacer ${super.buildCSSClass()}`}createEl(){return super.createEl("div",{className:this.buildCSSClass(),textContent:" "})}}D.registerComponent("CustomControlSpacer",Bg);class bh extends D{createEl(){return super.createEl("div",{className:"vjs-control-bar",dir:"ltr"})}}bh.prototype.options_={children:["playToggle","skipBackward","skipForward","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","pictureInPictureToggle","fullscreenToggle"]};D.registerComponent("ControlBar",bh);class xh extends Pi{constructor(e,t){super(e,t),this.on(e,"error",i=>{this.open(i)})}buildCSSClass(){return`vjs-error-display ${super.buildCSSClass()}`}content(){const e=this.player().error();return e?this.localize(e.message):""}}xh.prototype.options_=Object.assign({},Pi.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0});D.registerComponent("ErrorDisplay",xh);class Sh extends D{constructor(e,t={}){super(e,t),this.el_.setAttribute("aria-labelledby",this.selectLabelledbyIds)}createEl(){return this.selectLabelledbyIds=[this.options_.legendId,this.options_.labelId].join(" ").trim(),G("select",{id:this.options_.id},{},this.options_.SelectOptions.map(t=>{const i=(this.options_.labelId?this.options_.labelId:`vjs-track-option-${ze()}`)+"-"+t[1].replace(/\W+/g,""),n=G("option",{id:i,value:this.localize(t[0]),textContent:this.localize(t[1])});return n.setAttribute("aria-labelledby",`${this.selectLabelledbyIds} ${i}`),n}))}}D.registerComponent("TextTrackSelect",Sh);class Qt extends D{constructor(e,t={}){super(e,t);const i=G("legend",{textContent:this.localize(this.options_.legendText),id:this.options_.legendId});this.el().appendChild(i);const n=this.options_.selects;for(const r of n){const a=this.options_.selectConfigs[r],l=a.className,c=a.id.replace("%s",this.options_.id_);let p=null;const g=`vjs_select_${ze()}`;if(this.options_.type==="colors"){p=G("span",{className:l});const S=G("label",{id:c,className:"vjs-label",textContent:this.localize(a.label)});S.setAttribute("for",g),p.appendChild(S)}const _=new Sh(e,{SelectOptions:a.options,legendId:this.options_.legendId,id:g,labelId:c});this.addChild(_),this.options_.type==="colors"&&(p.appendChild(_.el()),this.el().appendChild(p))}}createEl(){return G("fieldset",{className:this.options_.className})}}D.registerComponent("TextTrackFieldset",Qt);class Ch extends D{constructor(e,t={}){super(e,t);const i=this.options_.textTrackComponentid,n=new Qt(e,{id_:i,legendId:`captions-text-legend-${i}`,legendText:this.localize("Text"),className:"vjs-fg vjs-track-setting",selects:this.options_.fieldSets[0],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(n);const r=new Qt(e,{id_:i,legendId:`captions-background-${i}`,legendText:this.localize("Text Background"),className:"vjs-bg vjs-track-setting",selects:this.options_.fieldSets[1],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(r);const a=new Qt(e,{id_:i,legendId:`captions-window-${i}`,legendText:this.localize("Caption Area Background"),className:"vjs-window vjs-track-setting",selects:this.options_.fieldSets[2],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(a)}createEl(){return G("div",{className:"vjs-track-settings-colors"})}}D.registerComponent("TextTrackSettingsColors",Ch);class Eh extends D{constructor(e,t={}){super(e,t);const i=this.options_.textTrackComponentid,n=new Qt(e,{id_:i,legendId:`captions-font-size-${i}`,legendText:"Font Size",className:"vjs-font-percent vjs-track-setting",selects:this.options_.fieldSets[0],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(n);const r=new Qt(e,{id_:i,legendId:`captions-edge-style-${i}`,legendText:this.localize("Text Edge Style"),className:"vjs-edge-style vjs-track-setting",selects:this.options_.fieldSets[1],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(r);const a=new Qt(e,{id_:i,legendId:`captions-font-family-${i}`,legendText:this.localize("Font Family"),className:"vjs-font-family vjs-track-setting",selects:this.options_.fieldSets[2],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(a)}createEl(){return G("div",{className:"vjs-track-settings-font"})}}D.registerComponent("TextTrackSettingsFont",Eh);class wh extends D{constructor(e,t={}){super(e,t);const i=new Ee(e,{controlText:this.localize("restore all settings to the default values"),className:"vjs-default-button"});i.el().classList.remove("vjs-control","vjs-button"),i.el().textContent=this.localize("Reset"),this.addChild(i);const n=this.localize("Done"),r=new Ee(e,{controlText:n,className:"vjs-done-button"});r.el().classList.remove("vjs-control","vjs-button"),r.el().textContent=n,this.addChild(r)}createEl(){return G("div",{className:"vjs-track-settings-controls"})}}D.registerComponent("TrackSettingsControls",wh);const Er="vjs-text-track-settings",_l=["#000","Black"],yl=["#00F","Blue"],Tl=["#0FF","Cyan"],vl=["#0F0","Green"],bl=["#F0F","Magenta"],xl=["#F00","Red"],Sl=["#FFF","White"],Cl=["#FF0","Yellow"],wr=["1","Opaque"],kr=["0.5","Semi-Transparent"],El=["0","Transparent"],It={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[_l,Sl,xl,vl,yl,Cl,bl,Tl],className:"vjs-bg-color"},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Opacity",options:[wr,kr,El],className:"vjs-bg-opacity vjs-opacity"},color:{selector:".vjs-text-color > select",id:"captions-foreground-color-%s",label:"Color",options:[Sl,_l,xl,vl,yl,Cl,bl,Tl],className:"vjs-text-color"},edgeStyle:{selector:".vjs-edge-style > select",id:"",label:"Text Edge Style",options:[["none","None"],["raised","Raised"],["depressed","Depressed"],["uniform","Uniform"],["dropshadow","Drop shadow"]]},fontFamily:{selector:".vjs-font-family > select",id:"",label:"Font Family",options:[["proportionalSansSerif","Proportional Sans-Serif"],["monospaceSansSerif","Monospace Sans-Serif"],["proportionalSerif","Proportional Serif"],["monospaceSerif","Monospace Serif"],["casual","Casual"],["script","Script"],["small-caps","Small Caps"]]},fontPercent:{selector:".vjs-font-percent > select",id:"",label:"Font Size",options:[["0.50","50%"],["0.75","75%"],["1.00","100%"],["1.25","125%"],["1.50","150%"],["1.75","175%"],["2.00","200%"],["3.00","300%"],["4.00","400%"]],default:2,parser:s=>s==="1.00"?null:Number(s)},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Opacity",options:[wr,kr],className:"vjs-text-opacity vjs-opacity"},windowColor:{selector:".vjs-window-color > select",id:"captions-window-color-%s",label:"Color",className:"vjs-window-color"},windowOpacity:{selector:".vjs-window-opacity > select",id:"captions-window-opacity-%s",label:"Opacity",options:[El,kr,wr],className:"vjs-window-opacity vjs-opacity"}};It.windowColor.options=It.backgroundColor.options;function kh(s,e){if(e&&(s=e(s)),s&&s!=="none")return s}function Fg(s,e){const t=s.options[s.options.selectedIndex].value;return kh(t,e)}function Ng(s,e,t){if(e){for(let i=0;i<s.options.length;i++)if(kh(s.options[i].value,t)===e){s.selectedIndex=i;break}}}class Ug extends Pi{constructor(e,t){t.temporary=!1,super(e,t),this.updateDisplay=this.updateDisplay.bind(this),this.fill(),this.hasBeenOpened_=this.hasBeenFilled_=!0,this.renderModalComponents(e),this.endDialog=G("p",{className:"vjs-control-text",textContent:this.localize("End of dialog window.")}),this.el().appendChild(this.endDialog),this.setDefaults(),t.persistTextTrackSettings===void 0&&(this.options_.persistTextTrackSettings=this.options_.playerOptions.persistTextTrackSettings),this.bindFunctionsToSelectsAndButtons(),this.options_.persistTextTrackSettings&&this.restoreSettings()}renderModalComponents(e){const t=new Ch(e,{textTrackComponentid:this.id_,selectConfigs:It,fieldSets:[["color","textOpacity"],["backgroundColor","backgroundOpacity"],["windowColor","windowOpacity"]]});this.addChild(t);const i=new Eh(e,{textTrackComponentid:this.id_,selectConfigs:It,fieldSets:[["fontPercent"],["edgeStyle"],["fontFamily"]]});this.addChild(i);const n=new wh(e);this.addChild(n)}bindFunctionsToSelectsAndButtons(){this.on(this.$(".vjs-done-button"),["click","tap"],()=>{this.saveSettings(),this.close()}),this.on(this.$(".vjs-default-button"),["click","tap"],()=>{this.setDefaults(),this.updateDisplay()}),li(It,e=>{this.on(this.$(e.selector),"change",this.updateDisplay)})}dispose(){this.endDialog=null,super.dispose()}label(){return this.localize("Caption Settings Dialog")}description(){return this.localize("Beginning of dialog window. Escape will cancel and close the window.")}buildCSSClass(){return super.buildCSSClass()+" vjs-text-track-settings"}getValues(){return gu(It,(e,t,i)=>{const n=Fg(this.$(t.selector),t.parser);return n!==void 0&&(e[i]=n),e},{})}setValues(e){li(It,(t,i)=>{Ng(this.$(t.selector),e[i],t.parser)})}setDefaults(){li(It,e=>{const t=e.hasOwnProperty("default")?e.default:0;this.$(e.selector).selectedIndex=t})}restoreSettings(){let e;try{e=JSON.parse(x.localStorage.getItem(Er))}catch(t){X.warn(t)}e&&this.setValues(e)}saveSettings(){if(!this.options_.persistTextTrackSettings)return;const e=this.getValues();try{Object.keys(e).length?x.localStorage.setItem(Er,JSON.stringify(e)):x.localStorage.removeItem(Er)}catch(t){X.warn(t)}}updateDisplay(){const e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()}handleLanguagechange(){this.fill(),this.renderModalComponents(this.player_),this.bindFunctionsToSelectsAndButtons()}}D.registerComponent("TextTrackSettings",Ug);class jg extends D{constructor(e,t){let i=t.ResizeObserver||x.ResizeObserver;t.ResizeObserver===null&&(i=!1);const n=se({createEl:!i,reportTouchActivity:!1},t);super(e,n),this.ResizeObserver=t.ResizeObserver||x.ResizeObserver,this.loadListener_=null,this.resizeObserver_=null,this.debouncedHandler_=Uu(()=>{this.resizeHandler()},100,!1,this),i?(this.resizeObserver_=new this.ResizeObserver(this.debouncedHandler_),this.resizeObserver_.observe(e.el())):(this.loadListener_=()=>{if(!this.el_||!this.el_.contentWindow)return;const r=this.debouncedHandler_;let a=this.unloadListener_=function(){Ce(this,"resize",r),Ce(this,"unload",a),a=null};je(this.el_.contentWindow,"unload",a),je(this.el_.contentWindow,"resize",r)},this.one("load",this.loadListener_))}createEl(){return super.createEl("iframe",{className:"vjs-resize-manager",tabIndex:-1,title:this.localize("No content")},{"aria-hidden":"true"})}resizeHandler(){!this.player_||!this.player_.trigger||this.player_.trigger("playerresize")}dispose(){this.debouncedHandler_&&this.debouncedHandler_.cancel(),this.resizeObserver_&&(this.player_.el()&&this.resizeObserver_.unobserve(this.player_.el()),this.resizeObserver_.disconnect()),this.loadListener_&&this.off("load",this.loadListener_),this.el_&&this.el_.contentWindow&&this.unloadListener_&&this.unloadListener_.call(this.el_.contentWindow),this.ResizeObserver=null,this.resizeObserver=null,this.debouncedHandler_=null,this.loadListener_=null,super.dispose()}}D.registerComponent("ResizeManager",jg);const $g={trackingThreshold:20,liveTolerance:15};class Hg extends D{constructor(e,t){const i=se($g,t,{createEl:!1});super(e,i),this.trackLiveHandler_=()=>this.trackLive_(),this.handlePlay_=n=>this.handlePlay(n),this.handleFirstTimeupdate_=n=>this.handleFirstTimeupdate(n),this.handleSeeked_=n=>this.handleSeeked(n),this.seekToLiveEdge_=n=>this.seekToLiveEdge(n),this.reset_(),this.on(this.player_,"durationchange",n=>this.handleDurationchange(n)),this.on(this.player_,"canplay",()=>this.toggleTracking())}trackLive_(){const e=this.player_.seekable();if(!e||!e.length)return;const t=Number(x.performance.now().toFixed(4)),i=this.lastTime_===-1?0:(t-this.lastTime_)/1e3;this.lastTime_=t,this.pastSeekEnd_=this.pastSeekEnd()+i;const n=this.liveCurrentTime(),r=this.player_.currentTime();let a=this.player_.paused()||this.seekedBehindLive_||Math.abs(n-r)>this.options_.liveTolerance;(!this.timeupdateSeen_||n===1/0)&&(a=!1),a!==this.behindLiveEdge_&&(this.behindLiveEdge_=a,this.trigger("liveedgechange"))}handleDurationchange(){this.toggleTracking()}toggleTracking(){this.player_.duration()===1/0&&this.liveWindow()>=this.options_.trackingThreshold?(this.player_.options_.liveui&&this.player_.addClass("vjs-liveui"),this.startTracking()):(this.player_.removeClass("vjs-liveui"),this.stopTracking())}startTracking(){this.isTracking()||(this.timeupdateSeen_||(this.timeupdateSeen_=this.player_.hasStarted()),this.trackingInterval_=this.setInterval(this.trackLiveHandler_,We),this.trackLive_(),this.on(this.player_,["play","pause"],this.trackLiveHandler_),this.timeupdateSeen_?this.on(this.player_,"seeked",this.handleSeeked_):(this.one(this.player_,"play",this.handlePlay_),this.one(this.player_,"timeupdate",this.handleFirstTimeupdate_)))}handleFirstTimeupdate(){this.timeupdateSeen_=!0,this.on(this.player_,"seeked",this.handleSeeked_)}handleSeeked(){const e=Math.abs(this.liveCurrentTime()-this.player_.currentTime());this.seekedBehindLive_=this.nextSeekedFromUser_&&e>2,this.nextSeekedFromUser_=!1,this.trackLive_()}handlePlay(){this.one(this.player_,"timeupdate",this.seekToLiveEdge_)}reset_(){this.lastTime_=-1,this.pastSeekEnd_=0,this.lastSeekEnd_=-1,this.behindLiveEdge_=!0,this.timeupdateSeen_=!1,this.seekedBehindLive_=!1,this.nextSeekedFromUser_=!1,this.clearInterval(this.trackingInterval_),this.trackingInterval_=null,this.off(this.player_,["play","pause"],this.trackLiveHandler_),this.off(this.player_,"seeked",this.handleSeeked_),this.off(this.player_,"play",this.handlePlay_),this.off(this.player_,"timeupdate",this.handleFirstTimeupdate_),this.off(this.player_,"timeupdate",this.seekToLiveEdge_)}nextSeekedFromUser(){this.nextSeekedFromUser_=!0}stopTracking(){this.isTracking()&&(this.reset_(),this.trigger("liveedgechange"))}seekableEnd(){const e=this.player_.seekable(),t=[];let i=e?e.length:0;for(;i--;)t.push(e.end(i));return t.length?t.sort()[t.length-1]:1/0}seekableStart(){const e=this.player_.seekable(),t=[];let i=e?e.length:0;for(;i--;)t.push(e.start(i));return t.length?t.sort()[0]:0}liveWindow(){const e=this.liveCurrentTime();return e===1/0?0:e-this.seekableStart()}isLive(){return this.isTracking()}atLiveEdge(){return!this.behindLiveEdge()}liveCurrentTime(){return this.pastSeekEnd()+this.seekableEnd()}pastSeekEnd(){const e=this.seekableEnd();return this.lastSeekEnd_!==-1&&e!==this.lastSeekEnd_&&(this.pastSeekEnd_=0),this.lastSeekEnd_=e,this.pastSeekEnd_}behindLiveEdge(){return this.behindLiveEdge_}isTracking(){return typeof this.trackingInterval_=="number"}seekToLiveEdge(){this.seekedBehindLive_=!1,!this.atLiveEdge()&&(this.nextSeekedFromUser_=!1,this.player_.currentTime(this.liveCurrentTime()))}dispose(){this.stopTracking(),super.dispose()}}D.registerComponent("LiveTracker",Hg);class Vg extends D{constructor(e,t){super(e,t),this.on("statechanged",i=>this.updateDom_()),this.updateDom_()}createEl(){return this.els={title:G("div",{className:"vjs-title-bar-title",id:`vjs-title-bar-title-${ze()}`}),description:G("div",{className:"vjs-title-bar-description",id:`vjs-title-bar-description-${ze()}`})},G("div",{className:"vjs-title-bar"},{},_u(this.els))}updateDom_(){const e=this.player_.tech_,t=e&&e.el_,i={title:"aria-labelledby",description:"aria-describedby"};["title","description"].forEach(n=>{const r=this.state[n],a=this.els[n],l=i[n];Fn(a),r&&Dt(a,r),t&&(t.removeAttribute(l),r&&t.setAttribute(l,a.id))}),this.state.title||this.state.description?this.show():this.hide()}update(e){this.setState(e)}dispose(){const e=this.player_.tech_,t=e&&e.el_;t&&(t.removeAttribute("aria-labelledby"),t.removeAttribute("aria-describedby")),super.dispose(),this.els=null}}D.registerComponent("TitleBar",Vg);const qg={initialDisplay:4e3,position:[],takeFocus:!1};class zg extends Ee{constructor(e,t){t=se(qg,t),super(e,t),this.controlText(t.controlText),this.hide(),this.on(this.player_,["useractive","userinactive"],i=>{this.removeClass("force-display")})}buildCSSClass(){return`vjs-transient-button focus-visible ${this.options_.position.map(e=>`vjs-${e}`).join(" ")}`}createEl(){const e=G("button",{},{type:"button",class:this.buildCSSClass()},G("span"));return this.controlTextEl_=e.querySelector("span"),e}show(){super.show(),this.addClass("force-display"),this.options_.takeFocus&&this.el().focus({preventScroll:!0}),this.forceDisplayTimeout=this.player_.setTimeout(()=>{this.removeClass("force-display")},this.options_.initialDisplay)}hide(){this.removeClass("force-display"),super.hide()}dispose(){this.player_.clearTimeout(this.forceDisplayTimeout),super.dispose()}}D.registerComponent("TransientButton",zg);const Wr=s=>{const e=s.el();if(e.hasAttribute("src"))return s.triggerSourceset(e.src),!0;const t=s.$$("source"),i=[];let n="";if(!t.length)return!1;for(let r=0;r<t.length;r++){const a=t[r].src;a&&i.indexOf(a)===-1&&i.push(a)}return i.length?(i.length===1&&(n=i[0]),s.triggerSourceset(n),!0):!1},Wg=Object.defineProperty({},"innerHTML",{get(){return this.cloneNode(!0).innerHTML},set(s){const e=N.createElement(this.nodeName.toLowerCase());e.innerHTML=s;const t=N.createDocumentFragment();for(;e.childNodes.length;)t.appendChild(e.childNodes[0]);return this.innerText="",x.Element.prototype.appendChild.call(this,t),this.innerHTML}}),Ih=(s,e)=>{let t={};for(let i=0;i<s.length&&(t=Object.getOwnPropertyDescriptor(s[i],e),!(t&&t.set&&t.get));i++);return t.enumerable=!0,t.configurable=!0,t},Gg=s=>Ih([s.el(),x.HTMLMediaElement.prototype,x.Element.prototype,Wg],"innerHTML"),wl=function(s){const e=s.el();if(e.resetSourceWatch_)return;const t={},i=Gg(s),n=r=>(...a)=>{const l=r.apply(e,a);return Wr(s),l};["append","appendChild","insertAdjacentHTML"].forEach(r=>{e[r]&&(t[r]=e[r],e[r]=n(t[r]))}),Object.defineProperty(e,"innerHTML",se(i,{set:n(i.set)})),e.resetSourceWatch_=()=>{e.resetSourceWatch_=null,Object.keys(t).forEach(r=>{e[r]=t[r]}),Object.defineProperty(e,"innerHTML",i)},s.one("sourceset",e.resetSourceWatch_)},Kg=Object.defineProperty({},"src",{get(){return this.hasAttribute("src")?Xu(x.Element.prototype.getAttribute.call(this,"src")):""},set(s){return x.Element.prototype.setAttribute.call(this,"src",s),s}}),Qg=s=>Ih([s.el(),x.HTMLMediaElement.prototype,Kg],"src"),Xg=function(s){if(!s.featuresSourceset)return;const e=s.el();if(e.resetSourceset_)return;const t=Qg(s),i=e.setAttribute,n=e.load;Object.defineProperty(e,"src",se(t,{set:r=>{const a=t.set.call(e,r);return s.triggerSourceset(e.src),a}})),e.setAttribute=(r,a)=>{const l=i.call(e,r,a);return/src/i.test(r)&&s.triggerSourceset(e.src),l},e.load=()=>{const r=n.call(e);return Wr(s)||(s.triggerSourceset(""),wl(s)),r},e.currentSrc?s.triggerSourceset(e.currentSrc):Wr(s)||wl(s),e.resetSourceset_=()=>{e.resetSourceset_=null,e.load=n,e.setAttribute=i,Object.defineProperty(e,"src",t),e.resetSourceWatch_&&e.resetSourceWatch_()}};class V extends K{constructor(e,t){super(e,t);const i=e.source;let n=!1;if(this.featuresVideoFrameCallback=this.featuresVideoFrameCallback&&this.el_.tagName==="VIDEO",i&&(this.el_.currentSrc!==i.src||e.tag&&e.tag.initNetworkState_===3)?this.setSource(i):this.handleLateInit_(this.el_),e.enableSourceset&&this.setupSourcesetHandling_(),this.isScrubbing_=!1,this.el_.hasChildNodes()){const r=this.el_.childNodes;let a=r.length;const l=[];for(;a--;){const c=r[a];c.nodeName.toLowerCase()==="track"&&(this.featuresNativeTextTracks?(this.remoteTextTrackEls().addTrackElement_(c),this.remoteTextTracks().addTrack(c.track),this.textTracks().addTrack(c.track),!n&&!this.el_.hasAttribute("crossorigin")&&$n(c.src)&&(n=!0)):l.push(c))}for(let c=0;c<l.length;c++)this.el_.removeChild(l[c])}this.proxyNativeTracks_(),this.featuresNativeTextTracks&&n&&X.warn(`Text Tracks are being loaded from another origin but the crossorigin attribute isn't used.
|
|
169
|
-
This may prevent text tracks from loading.`),this.restoreMetadataTracksInIOSNativePlayer_(),(cs||Dn)&&e.nativeControlsForTouch===!0&&this.setControls(!0),this.proxyWebkitFullscreen_(),this.triggerReady()}dispose(){this.el_&&this.el_.resetSourceset_&&this.el_.resetSourceset_(),V.disposeMediaElement(this.el_),this.options_=null,super.dispose()}setupSourcesetHandling_(){Xg(this)}restoreMetadataTracksInIOSNativePlayer_(){const e=this.textTracks();let t;const i=()=>{t=[];for(let r=0;r<e.length;r++){const a=e[r];a.kind==="metadata"&&t.push({track:a,storedMode:a.mode})}};i(),e.addEventListener("change",i),this.on("dispose",()=>e.removeEventListener("change",i));const n=()=>{for(let r=0;r<t.length;r++){const a=t[r];a.track.mode==="disabled"&&a.track.mode!==a.storedMode&&(a.track.mode=a.storedMode)}e.removeEventListener("change",n)};this.on("webkitbeginfullscreen",()=>{e.removeEventListener("change",i),e.removeEventListener("change",n),e.addEventListener("change",n)}),this.on("webkitendfullscreen",()=>{e.removeEventListener("change",i),e.addEventListener("change",i),e.removeEventListener("change",n)})}overrideNative_(e,t){if(t!==this[`featuresNative${e}Tracks`])return;const i=e.toLowerCase();this[`${i}TracksListeners_`]&&Object.keys(this[`${i}TracksListeners_`]).forEach(n=>{this.el()[`${i}Tracks`].removeEventListener(n,this[`${i}TracksListeners_`][n])}),this[`featuresNative${e}Tracks`]=!t,this[`${i}TracksListeners_`]=null,this.proxyNativeTracksForType_(i)}overrideNativeAudioTracks(e){this.overrideNative_("Audio",e)}overrideNativeVideoTracks(e){this.overrideNative_("Video",e)}proxyNativeTracksForType_(e){const t=qe[e],i=this.el()[t.getterName],n=this[t.getterName]();if(!this[`featuresNative${t.capitalName}Tracks`]||!i||!i.addEventListener)return;const r={change:l=>{const c={type:"change",target:n,currentTarget:n,srcElement:n};n.trigger(c),e==="text"&&this[Si.remoteText.getterName]().trigger(c)},addtrack(l){n.addTrack(l.track)},removetrack(l){n.removeTrack(l.track)}},a=function(){const l=[];for(let c=0;c<n.length;c++){let p=!1;for(let g=0;g<i.length;g++)if(i[g]===n[c]){p=!0;break}p||l.push(n[c])}for(;l.length;)n.removeTrack(l.shift())};this[t.getterName+"Listeners_"]=r,Object.keys(r).forEach(l=>{const c=r[l];i.addEventListener(l,c),this.on("dispose",p=>i.removeEventListener(l,c))}),this.on("loadstart",a),this.on("dispose",l=>this.off("loadstart",a))}proxyNativeTracks_(){qe.names.forEach(e=>{this.proxyNativeTracksForType_(e)})}createEl(){let e=this.options_.tag;if(!e||!(this.options_.playerElIngest||this.movingMediaElementInDOM)){if(e){const i=e.cloneNode(!0);e.parentNode&&e.parentNode.insertBefore(i,e),V.disposeMediaElement(e),e=i}else{e=N.createElement("video");const i=this.options_.tag&&kt(this.options_.tag),n=se({},i);(!cs||this.options_.nativeControlsForTouch!==!0)&&delete n.controls,wu(e,Object.assign(n,{id:this.options_.techId,class:"vjs-tech"}))}e.playerId=this.options_.playerId}typeof this.options_.preload<"u"&&vi(e,"preload",this.options_.preload),this.options_.disablePictureInPicture!==void 0&&(e.disablePictureInPicture=this.options_.disablePictureInPicture);const t=["loop","muted","playsinline","autoplay"];for(let i=0;i<t.length;i++){const n=t[i],r=this.options_[n];typeof r<"u"&&(r?vi(e,n,n):Rn(e,n),e[n]=r)}return e}handleLateInit_(e){if(e.networkState===0||e.networkState===3)return;if(e.readyState===0){let i=!1;const n=function(){i=!0};this.on("loadstart",n);const r=function(){i||this.trigger("loadstart")};this.on("loadedmetadata",r),this.ready(function(){this.off("loadstart",n),this.off("loadedmetadata",r),i||this.trigger("loadstart")});return}const t=["loadstart"];t.push("loadedmetadata"),e.readyState>=2&&t.push("loadeddata"),e.readyState>=3&&t.push("canplay"),e.readyState>=4&&t.push("canplaythrough"),this.ready(function(){t.forEach(function(i){this.trigger(i)},this)})}setScrubbing(e){this.isScrubbing_=e}scrubbing(){return this.isScrubbing_}setCurrentTime(e){try{this.isScrubbing_&&this.el_.fastSeek&&On?this.el_.fastSeek(e):this.el_.currentTime=e}catch(t){X(t,"Video is not ready. (Video.js)")}}duration(){if(this.el_.duration===1/0&&Je&&ut&&this.el_.currentTime===0){const e=()=>{this.el_.currentTime>0&&(this.el_.duration===1/0&&this.trigger("durationchange"),this.off("timeupdate",e))};return this.on("timeupdate",e),NaN}return this.el_.duration||NaN}width(){return this.el_.offsetWidth}height(){return this.el_.offsetHeight}proxyWebkitFullscreen_(){if(!("webkitDisplayingFullscreen"in this.el_))return;const e=function(){this.trigger("fullscreenchange",{isFullscreen:!1}),this.el_.controls&&!this.options_.nativeControlsForTouch&&this.controls()&&(this.el_.controls=!1)},t=function(){"webkitPresentationMode"in this.el_&&this.el_.webkitPresentationMode!=="picture-in-picture"&&(this.one("webkitendfullscreen",e),this.trigger("fullscreenchange",{isFullscreen:!0,nativeIOSFullscreen:!0}))};this.on("webkitbeginfullscreen",t),this.on("dispose",()=>{this.off("webkitbeginfullscreen",t),this.off("webkitendfullscreen",e)})}supportsFullScreen(){return typeof this.el_.webkitEnterFullScreen=="function"}enterFullScreen(){const e=this.el_;if(e.paused&&e.networkState<=e.HAVE_METADATA)nt(this.el_.play()),this.setTimeout(function(){e.pause();try{e.webkitEnterFullScreen()}catch(t){this.trigger("fullscreenerror",t)}},0);else try{e.webkitEnterFullScreen()}catch(t){this.trigger("fullscreenerror",t)}}exitFullScreen(){if(!this.el_.webkitDisplayingFullscreen){this.trigger("fullscreenerror",new Error("The video is not fullscreen"));return}this.el_.webkitExitFullScreen()}requestPictureInPicture(){return this.el_.requestPictureInPicture()}requestVideoFrameCallback(e){return this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.requestVideoFrameCallback(e):super.requestVideoFrameCallback(e)}cancelVideoFrameCallback(e){this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.cancelVideoFrameCallback(e):super.cancelVideoFrameCallback(e)}src(e){if(e===void 0)return this.el_.src;this.setSrc(e)}addSourceElement(e,t){if(!e)return X.error("Invalid source URL."),!1;const i={src:e};t&&(i.type=t);const n=G("source",{},i);return this.el_.appendChild(n),!0}removeSourceElement(e){if(!e)return X.error("Source URL is required to remove the source element."),!1;const t=this.el_.querySelectorAll("source");for(const i of t)if(i.src===e)return this.el_.removeChild(i),!0;return X.warn(`No matching source element found with src: ${e}`),!1}reset(){V.resetMediaElement(this.el_)}currentSrc(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc}setControls(e){this.el_.controls=!!e}addTextTrack(e,t,i){return this.featuresNativeTextTracks?this.el_.addTextTrack(e,t,i):super.addTextTrack(e,t,i)}createRemoteTextTrack(e){if(!this.featuresNativeTextTracks)return super.createRemoteTextTrack(e);const t=N.createElement("track");return e.kind&&(t.kind=e.kind),e.label&&(t.label=e.label),(e.language||e.srclang)&&(t.srclang=e.language||e.srclang),e.default&&(t.default=e.default),e.id&&(t.id=e.id),e.src&&(t.src=e.src),t}addRemoteTextTrack(e,t){const i=super.addRemoteTextTrack(e,t);return this.featuresNativeTextTracks&&this.el().appendChild(i),i}removeRemoteTextTrack(e){if(super.removeRemoteTextTrack(e),this.featuresNativeTextTracks){const t=this.$$("track");let i=t.length;for(;i--;)(e===t[i]||e===t[i].track)&&this.el().removeChild(t[i])}}getVideoPlaybackQuality(){if(typeof this.el().getVideoPlaybackQuality=="function")return this.el().getVideoPlaybackQuality();const e={};return typeof this.el().webkitDroppedFrameCount<"u"&&typeof this.el().webkitDecodedFrameCount<"u"&&(e.droppedVideoFrames=this.el().webkitDroppedFrameCount,e.totalVideoFrames=this.el().webkitDecodedFrameCount),x.performance&&(e.creationTime=x.performance.now()),e}}Pn(V,"TEST_VID",function(){if(!wi())return;const s=N.createElement("video"),e=N.createElement("track");return e.kind="captions",e.srclang="en",e.label="English",s.appendChild(e),s});V.isSupported=function(){try{V.TEST_VID.volume=.5}catch{return!1}return!!(V.TEST_VID&&V.TEST_VID.canPlayType)};V.canPlayType=function(s){return V.TEST_VID.canPlayType(s)};V.canPlaySource=function(s,e){return V.canPlayType(s.type)};V.canControlVolume=function(){try{const s=V.TEST_VID.volume;V.TEST_VID.volume=s/2+.1;const e=s!==V.TEST_VID.volume;return e&&Se?(x.setTimeout(()=>{V&&V.prototype&&(V.prototype.featuresVolumeControl=s!==V.TEST_VID.volume)}),!1):e}catch{return!1}};V.canMuteVolume=function(){try{const s=V.TEST_VID.muted;return V.TEST_VID.muted=!s,V.TEST_VID.muted?vi(V.TEST_VID,"muted","muted"):Rn(V.TEST_VID,"muted","muted"),s!==V.TEST_VID.muted}catch{return!1}};V.canControlPlaybackRate=function(){if(Je&&ut&&An<58)return!1;try{const s=V.TEST_VID.playbackRate;return V.TEST_VID.playbackRate=s/2+.1,s!==V.TEST_VID.playbackRate}catch{return!1}};V.canOverrideAttributes=function(){try{const s=()=>{};Object.defineProperty(N.createElement("video"),"src",{get:s,set:s}),Object.defineProperty(N.createElement("audio"),"src",{get:s,set:s}),Object.defineProperty(N.createElement("video"),"innerHTML",{get:s,set:s}),Object.defineProperty(N.createElement("audio"),"innerHTML",{get:s,set:s})}catch{return!1}return!0};V.supportsNativeTextTracks=function(){return On||Se&&ut};V.supportsNativeVideoTracks=function(){return!!(V.TEST_VID&&V.TEST_VID.videoTracks)};V.supportsNativeAudioTracks=function(){return!!(V.TEST_VID&&V.TEST_VID.audioTracks)};V.Events=["loadstart","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","progress","play","pause","ratechange","resize","volumechange"];[["featuresMuteControl","canMuteVolume"],["featuresPlaybackRate","canControlPlaybackRate"],["featuresSourceset","canOverrideAttributes"],["featuresNativeTextTracks","supportsNativeTextTracks"],["featuresNativeVideoTracks","supportsNativeVideoTracks"],["featuresNativeAudioTracks","supportsNativeAudioTracks"]].forEach(function([s,e]){Pn(V.prototype,s,()=>V[e](),!0)});V.prototype.featuresVolumeControl=V.canControlVolume();V.prototype.movingMediaElementInDOM=!Se;V.prototype.featuresFullscreenResize=!0;V.prototype.featuresProgressEvents=!0;V.prototype.featuresTimeupdateEvents=!0;V.prototype.featuresVideoFrameCallback=!!(V.TEST_VID&&V.TEST_VID.requestVideoFrameCallback);V.disposeMediaElement=function(s){if(s){for(s.parentNode&&s.parentNode.removeChild(s);s.hasChildNodes();)s.removeChild(s.firstChild);s.removeAttribute("src"),typeof s.load=="function"&&function(){try{s.load()}catch{}}()}};V.resetMediaElement=function(s){if(!s)return;const e=s.querySelectorAll("source");let t=e.length;for(;t--;)s.removeChild(e[t]);s.removeAttribute("src"),typeof s.load=="function"&&function(){try{s.load()}catch{}}()};["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach(function(s){V.prototype[s]=function(){return this.el_[s]||this.el_.hasAttribute(s)}});["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(s){V.prototype["set"+pe(s)]=function(e){this.el_[s]=e,e?this.el_.setAttribute(s,s):this.el_.removeAttribute(s)}});["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","disablePictureInPicture","played","networkState","readyState","videoWidth","videoHeight","crossOrigin"].forEach(function(s){V.prototype[s]=function(){return this.el_[s]}});["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach(function(s){V.prototype["set"+pe(s)]=function(e){this.el_[s]=e}});["pause","load","play"].forEach(function(s){V.prototype[s]=function(){return this.el_[s]()}});K.withSourceHandlers(V);V.nativeSourceHandler={};V.nativeSourceHandler.canPlayType=function(s){try{return V.TEST_VID.canPlayType(s)}catch{return""}};V.nativeSourceHandler.canHandleSource=function(s,e){if(s.type)return V.nativeSourceHandler.canPlayType(s.type);if(s.src){const t=ba(s.src);return V.nativeSourceHandler.canPlayType(`video/${t}`)}return""};V.nativeSourceHandler.handleSource=function(s,e,t){e.setSrc(s.src)};V.nativeSourceHandler.dispose=function(){};V.registerSourceHandler(V.nativeSourceHandler);K.registerTech("Html5",V);const Ph=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],Ir={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},Gr=["tiny","xsmall","small","medium","large","xlarge","huge"],sn={};Gr.forEach(s=>{const e=s.charAt(0)==="x"?`x-${s.substring(1)}`:s;sn[s]=`vjs-layout-${e}`});const Yg={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0};class J extends D{constructor(e,t,i){if(e.id=e.id||t.id||`vjs_video_${ze()}`,t=Object.assign(J.getTagSettings(e),t),t.initChildren=!1,t.createEl=!1,t.evented=!1,t.reportTouchActivity=!1,!t.language){const a=e.closest("[lang]");a&&(t.language=a.getAttribute("lang"))}if(super(null,t,i),this.boundDocumentFullscreenChange_=a=>this.documentFullscreenChange_(a),this.boundFullWindowOnEscKey_=a=>this.fullWindowOnEscKey(a),this.boundUpdateStyleEl_=a=>this.updateStyleEl_(a),this.boundApplyInitTime_=a=>this.applyInitTime_(a),this.boundUpdateCurrentBreakpoint_=a=>this.updateCurrentBreakpoint_(a),this.boundHandleTechClick_=a=>this.handleTechClick_(a),this.boundHandleTechDoubleClick_=a=>this.handleTechDoubleClick_(a),this.boundHandleTechTouchStart_=a=>this.handleTechTouchStart_(a),this.boundHandleTechTouchMove_=a=>this.handleTechTouchMove_(a),this.boundHandleTechTouchEnd_=a=>this.handleTechTouchEnd_(a),this.boundHandleTechTap_=a=>this.handleTechTap_(a),this.boundUpdatePlayerHeightOnAudioOnlyMode_=a=>this.updatePlayerHeightOnAudioOnlyMode_(a),this.isFullscreen_=!1,this.log=pu(this.id_),this.fsApi_=ln,this.isPosterFromTech_=!1,this.queuedCallbacks_=[],this.isReady_=!1,this.hasStarted_=!1,this.userActive_=!1,this.debugEnabled_=!1,this.audioOnlyMode_=!1,this.audioPosterMode_=!1,this.audioOnlyCache_={controlBarHeight:null,playerHeight:null,hiddenChildren:[]},!this.options_||!this.options_.techOrder||!this.options_.techOrder.length)throw new Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?");if(this.tag=e,this.tagAttributes=e&&kt(e),this.language(this.options_.language),t.languages){const a={};Object.getOwnPropertyNames(t.languages).forEach(function(l){a[l.toLowerCase()]=t.languages[l]}),this.languages_=a}else this.languages_=J.prototype.options_.languages;this.resetCache_(),this.poster_=t.poster||"",this.controls_=!!t.controls,e.controls=!1,e.removeAttribute("controls"),this.changingSrc_=!1,this.playCallbacks_=[],this.playTerminatedQueue_=[],e.hasAttribute("autoplay")?this.autoplay(!0):this.autoplay(this.options_.autoplay),t.plugins&&Object.keys(t.plugins).forEach(a=>{if(typeof this[a]!="function")throw new Error(`plugin "${a}" does not exist`)}),this.scrubbing_=!1,this.el_=this.createEl(),ga(this,{eventBusKey:"el_"}),this.fsApi_.requestFullscreen&&(je(N,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),this.on(this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_)),this.fluid_&&this.on(["playerreset","resize"],this.boundUpdateStyleEl_);const n=se(this.options_);if(t.plugins&&Object.keys(t.plugins).forEach(a=>{this[a](t.plugins[a])}),t.debug&&this.debug(!0),this.options_.playerOptions=n,this.middleware_=[],this.playbackRates(t.playbackRates),t.experimentalSvgIcons){const l=new x.DOMParser().parseFromString(vg,"image/svg+xml");if(l.querySelector("parsererror"))X.warn("Failed to load SVG Icons. Falling back to Font Icons."),this.options_.experimentalSvgIcons=null;else{const p=l.documentElement;p.style.display="none",this.el_.appendChild(p),this.addClass("vjs-svg-icons-enabled")}}this.initChildren(),this.isAudio(e.nodeName.toLowerCase()==="audio"),this.controls()?this.addClass("vjs-controls-enabled"):this.addClass("vjs-controls-disabled"),this.el_.setAttribute("role","region"),this.isAudio()?this.el_.setAttribute("aria-label",this.localize("Audio Player")):this.el_.setAttribute("aria-label",this.localize("Video Player")),this.isAudio()&&this.addClass("vjs-audio"),t.spatialNavigation&&t.spatialNavigation.enabled&&(this.spatialNavigation=new bg(this),this.addClass("vjs-spatial-navigation-enabled")),cs&&this.addClass("vjs-touch-enabled"),Se||this.addClass("vjs-workinghover"),J.players[this.id_]=this;const r=Br.split(".")[0];this.addClass(`vjs-v${r}`),this.userActive(!0),this.reportUserActivity(),this.one("play",a=>this.listenForUserActivity_(a)),this.on("keydown",a=>this.handleKeyDown(a)),this.on("languagechange",a=>this.handleLanguagechange(a)),this.breakpoints(this.options_.breakpoints),this.responsive(this.options_.responsive),this.on("ready",()=>{this.audioPosterMode(this.options_.audioPosterMode),this.audioOnlyMode(this.options_.audioOnlyMode)})}dispose(){this.trigger("dispose"),this.off("dispose"),Ce(N,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),Ce(N,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),J.players[this.id_]=null,this.tag&&this.tag.player&&(this.tag.player=null),this.el_&&this.el_.player&&(this.el_.player=null),this.tech_&&(this.tech_.dispose(),this.isPosterFromTech_=!1,this.poster_=""),this.playerElIngest_&&(this.playerElIngest_=null),this.tag&&(this.tag=null),gg(this),Ie.names.forEach(e=>{const t=Ie[e],i=this[t.getterName]();i&&i.off&&i.off()}),super.dispose({restoreEl:this.options_.restoreEl})}createEl(){let e=this.tag,t,i=this.playerElIngest_=e.parentNode&&e.parentNode.hasAttribute&&e.parentNode.hasAttribute("data-vjs-player");const n=this.tag.tagName.toLowerCase()==="video-js";i?t=this.el_=e.parentNode:n||(t=this.el_=super.createEl("div"));const r=kt(e);if(n){for(t=this.el_=e,e=this.tag=N.createElement("video");t.children.length;)e.appendChild(t.firstChild);os(t,"video-js")||Gt(t,"video-js"),t.appendChild(e),i=this.playerElIngest_=t,Object.keys(t).forEach(c=>{try{e[c]=t[c]}catch{}})}e.setAttribute("tabindex","-1"),r.tabindex="-1",ut&&Ln&&(e.setAttribute("role","application"),r.role="application"),e.removeAttribute("width"),e.removeAttribute("height"),"width"in r&&delete r.width,"height"in r&&delete r.height,Object.getOwnPropertyNames(r).forEach(function(c){n&&c==="class"||t.setAttribute(c,r[c]),n&&e.setAttribute(c,r[c])}),e.playerId=e.id,e.id+="_html5_api",e.className="vjs-tech",e.player=t.player=this,this.addClass("vjs-paused");const a=["IS_SMART_TV","IS_TIZEN","IS_WEBOS","IS_ANDROID","IS_IPAD","IS_IPHONE","IS_CHROMECAST_RECEIVER"].filter(c=>xu[c]).map(c=>"vjs-device-"+c.substring(3).toLowerCase().replace(/\_/g,"-"));if(this.addClass(...a),x.VIDEOJS_NO_DYNAMIC_STYLE!==!0){this.styleEl_=Fu("vjs-styles-dimensions");const c=Lt(".vjs-styles-defaults"),p=Lt("head");p.insertBefore(this.styleEl_,c?c.nextSibling:p.firstChild)}this.fill_=!1,this.fluid_=!1,this.width(this.options_.width),this.height(this.options_.height),this.fill(this.options_.fill),this.fluid(this.options_.fluid),this.aspectRatio(this.options_.aspectRatio),this.crossOrigin(this.options_.crossOrigin||this.options_.crossorigin);const l=e.getElementsByTagName("a");for(let c=0;c<l.length;c++){const p=l.item(c);Gt(p,"vjs-hidden"),p.setAttribute("hidden","hidden")}return e.initNetworkState_=e.networkState,e.parentNode&&!i&&e.parentNode.insertBefore(t,e),Nr(e,t),this.children_.unshift(e),this.el_.setAttribute("lang",this.language_),this.el_.setAttribute("translate","no"),this.el_=t,t}crossOrigin(e){if(typeof e>"u")return this.techGet_("crossOrigin");if(e!==null&&e!=="anonymous"&&e!=="use-credentials"){X.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`);return}this.techCall_("setCrossOrigin",e),this.posterImage&&this.posterImage.crossOrigin(e)}width(e){return this.dimension("width",e)}height(e){return this.dimension("height",e)}dimension(e,t){const i=e+"_";if(t===void 0)return this[i]||0;if(t===""||t==="auto"){this[i]=void 0,this.updateStyleEl_();return}const n=parseFloat(t);if(isNaN(n)){X.error(`Improper value "${t}" supplied for for ${e}`);return}this[i]=n,this.updateStyleEl_()}fluid(e){if(e===void 0)return!!this.fluid_;this.fluid_=!!e,gt(this)&&this.off(["playerreset","resize"],this.boundUpdateStyleEl_),e?(this.addClass("vjs-fluid"),this.fill(!1),Km(this,()=>{this.on(["playerreset","resize"],this.boundUpdateStyleEl_)})):this.removeClass("vjs-fluid"),this.updateStyleEl_()}fill(e){if(e===void 0)return!!this.fill_;this.fill_=!!e,e?(this.addClass("vjs-fill"),this.fluid(!1)):this.removeClass("vjs-fill")}aspectRatio(e){if(e===void 0)return this.aspectRatio_;if(!/^\d+\:\d+$/.test(e))throw new Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.");this.aspectRatio_=e,this.fluid(!0),this.updateStyleEl_()}updateStyleEl_(){if(x.VIDEOJS_NO_DYNAMIC_STYLE===!0){const l=typeof this.width_=="number"?this.width_:this.options_.width,c=typeof this.height_=="number"?this.height_:this.options_.height,p=this.tech_&&this.tech_.el();p&&(l>=0&&(p.width=l),c>=0&&(p.height=c));return}let e,t,i,n;this.aspectRatio_!==void 0&&this.aspectRatio_!=="auto"?i=this.aspectRatio_:this.videoWidth()>0?i=this.videoWidth()+":"+this.videoHeight():i="16:9";const r=i.split(":"),a=r[1]/r[0];this.width_!==void 0?e=this.width_:this.height_!==void 0?e=this.height_/a:e=this.videoWidth()||300,this.height_!==void 0?t=this.height_:t=e*a,/^[^a-zA-Z]/.test(this.id())?n="dimensions-"+this.id():n=this.id()+"-dimensions",this.addClass(n),Nu(this.styleEl_,`
|
|
170
|
-
.${n} {
|
|
171
|
-
width: ${e}px;
|
|
172
|
-
height: ${t}px;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
.${n}.vjs-fluid:not(.vjs-audio-only-mode) {
|
|
176
|
-
padding-top: ${a*100}%;
|
|
177
|
-
}
|
|
178
|
-
`)}loadTech_(e,t){this.tech_&&this.unloadTech_();const i=pe(e),n=e.charAt(0).toLowerCase()+e.slice(1);i!=="Html5"&&this.tag&&(K.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=i,this.isReady_=!1;let r=this.autoplay();(typeof this.autoplay()=="string"||this.autoplay()===!0&&this.options_.normalizeAutoplay)&&(r=!1);const a={source:t,autoplay:r,nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:`${this.id()}_${n}_api`,playsinline:this.options_.playsinline,preload:this.options_.preload,loop:this.options_.loop,disablePictureInPicture:this.options_.disablePictureInPicture,muted:this.options_.muted,poster:this.poster(),language:this.language(),playerElIngest:this.playerElIngest_||!1,"vtt.js":this.options_["vtt.js"],canOverridePoster:!!this.options_.techCanOverridePoster,enableSourceset:this.options_.enableSourceset};Ie.names.forEach(c=>{const p=Ie[c];a[p.getterName]=this[p.privateName]}),Object.assign(a,this.options_[i]),Object.assign(a,this.options_[n]),Object.assign(a,this.options_[e.toLowerCase()]),this.tag&&(a.tag=this.tag),t&&t.src===this.cache_.src&&this.cache_.currentTime>0&&(a.startTime=this.cache_.currentTime);const l=K.getTech(e);if(!l)throw new Error(`No Tech named '${i}' exists! '${i}' should be registered using videojs.registerTech()'`);this.tech_=new l(a),this.tech_.ready(re(this,this.handleTechReady_),!0),qr.jsonToTextTracks(this.textTracksJson_||[],this.tech_),Ph.forEach(c=>{this.on(this.tech_,c,p=>this[`handleTech${pe(c)}_`](p))}),Object.keys(Ir).forEach(c=>{this.on(this.tech_,c,p=>{if(this.tech_.playbackRate()===0&&this.tech_.seeking()){this.queuedCallbacks_.push({callback:this[`handleTech${Ir[c]}_`].bind(this),event:p});return}this[`handleTech${Ir[c]}_`](p)})}),this.on(this.tech_,"loadstart",c=>this.handleTechLoadStart_(c)),this.on(this.tech_,"sourceset",c=>this.handleTechSourceset_(c)),this.on(this.tech_,"waiting",c=>this.handleTechWaiting_(c)),this.on(this.tech_,"ended",c=>this.handleTechEnded_(c)),this.on(this.tech_,"seeking",c=>this.handleTechSeeking_(c)),this.on(this.tech_,"play",c=>this.handleTechPlay_(c)),this.on(this.tech_,"pause",c=>this.handleTechPause_(c)),this.on(this.tech_,"durationchange",c=>this.handleTechDurationChange_(c)),this.on(this.tech_,"fullscreenchange",(c,p)=>this.handleTechFullscreenChange_(c,p)),this.on(this.tech_,"fullscreenerror",(c,p)=>this.handleTechFullscreenError_(c,p)),this.on(this.tech_,"enterpictureinpicture",c=>this.handleTechEnterPictureInPicture_(c)),this.on(this.tech_,"leavepictureinpicture",c=>this.handleTechLeavePictureInPicture_(c)),this.on(this.tech_,"error",c=>this.handleTechError_(c)),this.on(this.tech_,"posterchange",c=>this.handleTechPosterChange_(c)),this.on(this.tech_,"textdata",c=>this.handleTechTextData_(c)),this.on(this.tech_,"ratechange",c=>this.handleTechRateChange_(c)),this.on(this.tech_,"loadedmetadata",this.boundUpdateStyleEl_),this.usingNativeControls(this.techGet_("controls")),this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_(),this.tech_.el().parentNode!==this.el()&&(i!=="Html5"||!this.tag)&&Nr(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)}unloadTech_(){Ie.names.forEach(e=>{const t=Ie[e];this[t.privateName]=this[t.getterName]()}),this.textTracksJson_=qr.textTracksToJson(this.tech_),this.isReady_=!1,this.tech_.dispose(),this.tech_=!1,this.isPosterFromTech_&&(this.poster_="",this.trigger("posterchange")),this.isPosterFromTech_=!1}tech(e){return e===void 0&&X.warn(`Using the tech directly can be dangerous. I hope you know what you're doing.
|
|
179
|
-
See https://github.com/videojs/video.js/issues/2617 for more info.
|
|
180
|
-
`),this.tech_}version(){return{"video.js":Br}}addTechControlsListeners_(){this.removeTechControlsListeners_(),this.on(this.tech_,"click",this.boundHandleTechClick_),this.on(this.tech_,"dblclick",this.boundHandleTechDoubleClick_),this.on(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.on(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.on(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.on(this.tech_,"tap",this.boundHandleTechTap_)}removeTechControlsListeners_(){this.off(this.tech_,"tap",this.boundHandleTechTap_),this.off(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.off(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.off(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.off(this.tech_,"click",this.boundHandleTechClick_),this.off(this.tech_,"dblclick",this.boundHandleTechDoubleClick_)}handleTechReady_(){this.triggerReady(),this.cache_.volume&&this.techCall_("setVolume",this.cache_.volume),this.handleTechPosterChange_(),this.handleTechDurationChange_()}handleTechLoadStart_(){this.removeClass("vjs-ended","vjs-seeking"),this.error(null),this.handleTechDurationChange_(),this.paused()?(this.hasStarted(!1),this.trigger("loadstart")):this.trigger("loadstart"),this.manualAutoplay_(this.autoplay()===!0&&this.options_.normalizeAutoplay?"play":this.autoplay())}manualAutoplay_(e){if(!this.tech_||typeof e!="string")return;const t=()=>{const n=this.muted();this.muted(!0);const r=()=>{this.muted(n)};this.playTerminatedQueue_.push(r);const a=this.play();if(us(a))return a.catch(l=>{throw r(),new Error(`Rejection at manualAutoplay. Restoring muted value. ${l||""}`)})};let i;if(e==="any"&&!this.muted()?(i=this.play(),us(i)&&(i=i.catch(t))):e==="muted"&&!this.muted()?i=t():i=this.play(),!!us(i))return i.then(()=>{this.trigger({type:"autoplay-success",autoplay:e})}).catch(()=>{this.trigger({type:"autoplay-failure",autoplay:e})})}updateSourceCaches_(e=""){let t=e,i="";typeof t!="string"&&(t=e.src,i=e.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],t&&!i&&(i=Tg(this,t)),this.cache_.source=se({},e,{src:t,type:i});const n=this.cache_.sources.filter(c=>c.src&&c.src===t),r=[],a=this.$$("source"),l=[];for(let c=0;c<a.length;c++){const p=kt(a[c]);r.push(p),p.src&&p.src===t&&l.push(p.src)}l.length&&!n.length?this.cache_.sources=r:n.length||(this.cache_.sources=[this.cache_.source]),this.cache_.src=t}handleTechSourceset_(e){if(!this.changingSrc_){let t=r=>this.updateSourceCaches_(r);const i=this.currentSource().src,n=e.src;i&&!/^blob:/.test(i)&&/^blob:/.test(n)&&(!this.lastSource_||this.lastSource_.tech!==n&&this.lastSource_.player!==i)&&(t=()=>{}),t(n),e.src||this.tech_.any(["sourceset","loadstart"],r=>{if(r.type==="sourceset")return;const a=this.techGet_("currentSrc");this.lastSource_.tech=a,this.updateSourceCaches_(a)})}this.lastSource_={player:this.currentSource().src,tech:e.src},this.trigger({src:e.src,type:"sourceset"})}hasStarted(e){if(e===void 0)return this.hasStarted_;e!==this.hasStarted_&&(this.hasStarted_=e,this.hasStarted_?this.addClass("vjs-has-started"):this.removeClass("vjs-has-started"))}handleTechPlay_(){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.hasStarted(!0),this.trigger("play")}handleTechRateChange_(){this.tech_.playbackRate()>0&&this.cache_.lastPlaybackRate===0&&(this.queuedCallbacks_.forEach(e=>e.callback(e.event)),this.queuedCallbacks_=[]),this.cache_.lastPlaybackRate=this.tech_.playbackRate(),this.trigger("ratechange")}handleTechWaiting_(){this.addClass("vjs-waiting"),this.trigger("waiting");const e=this.currentTime(),t=()=>{e!==this.currentTime()&&(this.removeClass("vjs-waiting"),this.off("timeupdate",t))};this.on("timeupdate",t)}handleTechCanPlay_(){this.removeClass("vjs-waiting"),this.trigger("canplay")}handleTechCanPlayThrough_(){this.removeClass("vjs-waiting"),this.trigger("canplaythrough")}handleTechPlaying_(){this.removeClass("vjs-waiting"),this.trigger("playing")}handleTechSeeking_(){this.addClass("vjs-seeking"),this.trigger("seeking")}handleTechSeeked_(){this.removeClass("vjs-seeking","vjs-ended"),this.trigger("seeked")}handleTechPause_(){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.trigger("pause")}handleTechEnded_(){this.addClass("vjs-ended"),this.removeClass("vjs-waiting"),this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause(),this.trigger("ended")}handleTechDurationChange_(){this.duration(this.techGet_("duration"))}handleTechClick_(e){this.controls_&&(this.options_===void 0||this.options_.userActions===void 0||this.options_.userActions.click===void 0||this.options_.userActions.click!==!1)&&(this.options_!==void 0&&this.options_.userActions!==void 0&&typeof this.options_.userActions.click=="function"?this.options_.userActions.click.call(this,e):this.paused()?nt(this.play()):this.pause())}handleTechDoubleClick_(e){if(!this.controls_)return;Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),i=>i.contains(e.target))||(this.options_===void 0||this.options_.userActions===void 0||this.options_.userActions.doubleClick===void 0||this.options_.userActions.doubleClick!==!1)&&(this.options_!==void 0&&this.options_.userActions!==void 0&&typeof this.options_.userActions.doubleClick=="function"?this.options_.userActions.doubleClick.call(this,e):this.isInPictureInPicture()&&!N.pictureInPictureElement?this.exitPictureInPicture():this.isFullscreen()?this.exitFullscreen():this.requestFullscreen())}handleTechTap_(){this.userActive(!this.userActive())}handleTechTouchStart_(){this.userWasActive=this.userActive()}handleTechTouchMove_(){this.userWasActive&&this.reportUserActivity()}handleTechTouchEnd_(e){e.cancelable&&e.preventDefault()}toggleFullscreenClass_(){this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen")}documentFullscreenChange_(e){const t=e.target.player;if(t&&t!==this)return;const i=this.el();let n=N[this.fsApi_.fullscreenElement]===i;!n&&i.matches&&(n=i.matches(":"+this.fsApi_.fullscreen)),this.isFullscreen(n)}handleTechFullscreenChange_(e,t){t&&(t.nativeIOSFullscreen&&(this.addClass("vjs-ios-native-fs"),this.tech_.one("webkitendfullscreen",()=>{this.removeClass("vjs-ios-native-fs")})),this.isFullscreen(t.isFullscreen))}handleTechFullscreenError_(e,t){this.trigger("fullscreenerror",t)}togglePictureInPictureClass_(){this.isInPictureInPicture()?this.addClass("vjs-picture-in-picture"):this.removeClass("vjs-picture-in-picture")}handleTechEnterPictureInPicture_(e){this.isInPictureInPicture(!0)}handleTechLeavePictureInPicture_(e){this.isInPictureInPicture(!1)}handleTechError_(){const e=this.tech_.error();e&&this.error(e)}handleTechTextData_(){let e=null;arguments.length>1&&(e=arguments[1]),this.trigger("textdata",e)}getCache(){return this.cache_}resetCache_(){this.cache_={currentTime:0,initTime:0,inactivityTimeout:this.options_.inactivityTimeout,duration:NaN,lastVolume:1,lastPlaybackRate:this.defaultPlaybackRate(),media:null,src:"",source:{},sources:[],playbackRates:[],volume:1}}techCall_(e,t){this.ready(function(){if(e in pg)return cg(this.middleware_,this.tech_,e,t);if(e in dl)return hl(this.middleware_,this.tech_,e,t);try{this.tech_&&this.tech_[e](t)}catch(i){throw X(i),i}},!0)}techGet_(e){if(!(!this.tech_||!this.tech_.isReady_)){if(e in fg)return dg(this.middleware_,this.tech_,e);if(e in dl)return hl(this.middleware_,this.tech_,e);try{return this.tech_[e]()}catch(t){throw this.tech_[e]===void 0?(X(`Video.js: ${e} method not defined for ${this.techName_} playback technology.`,t),t):t.name==="TypeError"?(X(`Video.js: ${e} unavailable on ${this.techName_} playback technology element.`,t),this.tech_.isReady_=!1,t):(X(t),t)}}}play(){return new Promise(e=>{this.play_(e)})}play_(e=nt){this.playCallbacks_.push(e);const t=!!(!this.changingSrc_&&(this.src()||this.currentSrc())),i=!!(On||Se);if(this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),!this.isReady_||!t){this.waitToPlay_=a=>{this.play_()},this.one(["ready","loadstart"],this.waitToPlay_),!t&&i&&this.load();return}const n=this.techGet_("play");i&&this.hasClass("vjs-ended")&&this.resetProgressBar_(),n===null?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(n)}runPlayTerminatedQueue_(){const e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],e.forEach(function(t){t()})}runPlayCallbacks_(e){const t=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],t.forEach(function(i){i(e)})}pause(){this.techCall_("pause")}paused(){return this.techGet_("paused")!==!1}played(){return this.techGet_("played")||Ye(0,0)}scrubbing(e){if(typeof e>"u")return this.scrubbing_;this.scrubbing_=!!e,this.techCall_("setScrubbing",this.scrubbing_),e?this.addClass("vjs-scrubbing"):this.removeClass("vjs-scrubbing")}currentTime(e){if(e===void 0)return this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime;if(e<0&&(e=0),!this.isReady_||this.changingSrc_||!this.tech_||!this.tech_.isReady_){this.cache_.initTime=e,this.off("canplay",this.boundApplyInitTime_),this.one("canplay",this.boundApplyInitTime_);return}this.techCall_("setCurrentTime",e),this.cache_.initTime=0,isFinite(e)&&(this.cache_.currentTime=Number(e))}applyInitTime_(){this.currentTime(this.cache_.initTime)}duration(e){if(e===void 0)return this.cache_.duration!==void 0?this.cache_.duration:NaN;e=parseFloat(e),e<0&&(e=1/0),e!==this.cache_.duration&&(this.cache_.duration=e,e===1/0?this.addClass("vjs-live"):this.removeClass("vjs-live"),isNaN(e)||this.trigger("durationchange"))}remainingTime(){return this.duration()-this.currentTime()}remainingTimeDisplay(){return Math.floor(this.duration())-Math.floor(this.currentTime())}buffered(){let e=this.techGet_("buffered");return(!e||!e.length)&&(e=Ye(0,0)),e}seekable(){let e=this.techGet_("seekable");return(!e||!e.length)&&(e=Ye(0,0)),e}seeking(){return this.techGet_("seeking")}ended(){return this.techGet_("ended")}networkState(){return this.techGet_("networkState")}readyState(){return this.techGet_("readyState")}bufferedPercent(){return Gu(this.buffered(),this.duration())}bufferedEnd(){const e=this.buffered(),t=this.duration();let i=e.end(e.length-1);return i>t&&(i=t),i}volume(e){let t;if(e!==void 0){t=Math.max(0,Math.min(1,e)),this.cache_.volume=t,this.techCall_("setVolume",t),t>0&&this.lastVolume_(t);return}return t=parseFloat(this.techGet_("volume")),isNaN(t)?1:t}muted(e){if(e!==void 0){this.techCall_("setMuted",e);return}return this.techGet_("muted")||!1}defaultMuted(e){return e!==void 0&&this.techCall_("setDefaultMuted",e),this.techGet_("defaultMuted")||!1}lastVolume_(e){if(e!==void 0&&e!==0){this.cache_.lastVolume=e;return}return this.cache_.lastVolume}supportsFullScreen(){return this.techGet_("supportsFullScreen")||!1}isFullscreen(e){if(e!==void 0){const t=this.isFullscreen_;this.isFullscreen_=!!e,this.isFullscreen_!==t&&this.fsApi_.prefixed&&this.trigger("fullscreenchange"),this.toggleFullscreenClass_();return}return this.isFullscreen_}requestFullscreen(e){this.isInPictureInPicture()&&this.exitPictureInPicture();const t=this;return new Promise((i,n)=>{function r(){t.off("fullscreenerror",l),t.off("fullscreenchange",a)}function a(){r(),i()}function l(p,g){r(),n(g)}t.one("fullscreenchange",a),t.one("fullscreenerror",l);const c=t.requestFullscreenHelper_(e);c&&(c.then(r,r),c.then(i,n))})}requestFullscreenHelper_(e){let t;if(this.fsApi_.prefixed||(t=this.options_.fullscreen&&this.options_.fullscreen.options||{},e!==void 0&&(t=e)),this.fsApi_.requestFullscreen){const i=this.el_[this.fsApi_.requestFullscreen](t);return i&&i.then(()=>this.isFullscreen(!0),()=>this.isFullscreen(!1)),i}else this.tech_.supportsFullScreen()&&!this.options_.preferFullWindow?this.techCall_("enterFullScreen"):this.enterFullWindow()}exitFullscreen(){const e=this;return new Promise((t,i)=>{function n(){e.off("fullscreenerror",a),e.off("fullscreenchange",r)}function r(){n(),t()}function a(c,p){n(),i(p)}e.one("fullscreenchange",r),e.one("fullscreenerror",a);const l=e.exitFullscreenHelper_();l&&(l.then(n,n),l.then(t,i))})}exitFullscreenHelper_(){if(this.fsApi_.requestFullscreen){const e=N[this.fsApi_.exitFullscreen]();return e&&nt(e.then(()=>this.isFullscreen(!1))),e}else this.tech_.supportsFullScreen()&&!this.options_.preferFullWindow?this.techCall_("exitFullScreen"):this.exitFullWindow()}enterFullWindow(){this.isFullscreen(!0),this.isFullWindow=!0,this.docOrigOverflow=N.documentElement.style.overflow,je(N,"keydown",this.boundFullWindowOnEscKey_),N.documentElement.style.overflow="hidden",Gt(N.body,"vjs-full-window"),this.trigger("enterFullWindow")}fullWindowOnEscKey(e){e.key==="Escape"&&this.isFullscreen()===!0&&(this.isFullWindow?this.exitFullWindow():this.exitFullscreen())}exitFullWindow(){this.isFullscreen(!1),this.isFullWindow=!1,Ce(N,"keydown",this.boundFullWindowOnEscKey_),N.documentElement.style.overflow=this.docOrigOverflow,Mn(N.body,"vjs-full-window"),this.trigger("exitFullWindow")}disablePictureInPicture(e){if(e===void 0)return this.techGet_("disablePictureInPicture");this.techCall_("setDisablePictureInPicture",e),this.options_.disablePictureInPicture=e,this.trigger("disablepictureinpicturechanged")}isInPictureInPicture(e){if(e!==void 0){this.isInPictureInPicture_=!!e,this.togglePictureInPictureClass_();return}return!!this.isInPictureInPicture_}requestPictureInPicture(){if(this.options_.enableDocumentPictureInPicture&&x.documentPictureInPicture){const e=N.createElement(this.el().tagName);return e.classList=this.el().classList,e.classList.add("vjs-pip-container"),this.posterImage&&e.appendChild(this.posterImage.el().cloneNode(!0)),this.titleBar&&e.appendChild(this.titleBar.el().cloneNode(!0)),e.appendChild(G("p",{className:"vjs-pip-text"},{},this.localize("Playing in picture-in-picture"))),x.documentPictureInPicture.requestWindow({width:this.videoWidth(),height:this.videoHeight()}).then(t=>(Mu(t),this.el_.parentNode.insertBefore(e,this.el_),t.document.body.appendChild(this.el_),t.document.body.classList.add("vjs-pip-window"),this.player_.isInPictureInPicture(!0),this.player_.trigger({type:"enterpictureinpicture",pipWindow:t}),t.addEventListener("pagehide",i=>{const n=i.target.querySelector(".video-js");e.parentNode.replaceChild(n,e),this.player_.isInPictureInPicture(!1),this.player_.trigger("leavepictureinpicture")}),t))}return"pictureInPictureEnabled"in N&&this.disablePictureInPicture()===!1?this.techGet_("requestPictureInPicture"):Promise.reject("No PiP mode is available")}exitPictureInPicture(){if(x.documentPictureInPicture&&x.documentPictureInPicture.window)return x.documentPictureInPicture.window.close(),Promise.resolve();if("pictureInPictureEnabled"in N)return N.exitPictureInPicture()}handleKeyDown(e){const{userActions:t}=this.options_;!t||!t.hotkeys||(n=>{const r=n.tagName.toLowerCase();if(n.isContentEditable)return!0;const a=["button","checkbox","hidden","radio","reset","submit"];return r==="input"?a.indexOf(n.type)===-1:["textarea"].indexOf(r)!==-1})(this.el_.ownerDocument.activeElement)||(typeof t.hotkeys=="function"?t.hotkeys.call(this,e):this.handleHotkeys(e))}handleHotkeys(e){const t=this.options_.userActions?this.options_.userActions.hotkeys:{},{fullscreenKey:i=a=>e.key.toLowerCase()==="f",muteKey:n=a=>e.key.toLowerCase()==="m",playPauseKey:r=a=>e.key.toLowerCase()==="k"||e.key.toLowerCase()===" "}=t;if(i.call(this,e)){e.preventDefault(),e.stopPropagation();const a=D.getComponent("FullscreenToggle");N[this.fsApi_.fullscreenEnabled]!==!1&&a.prototype.handleClick.call(this,e)}else n.call(this,e)?(e.preventDefault(),e.stopPropagation(),D.getComponent("MuteToggle").prototype.handleClick.call(this,e)):r.call(this,e)&&(e.preventDefault(),e.stopPropagation(),D.getComponent("PlayToggle").prototype.handleClick.call(this,e))}canPlayType(e){let t;for(let i=0,n=this.options_.techOrder;i<n.length;i++){const r=n[i];let a=K.getTech(r);if(a||(a=D.getComponent(r)),!a){X.error(`The "${r}" tech is undefined. Skipped browser support check for that tech.`);continue}if(a.isSupported()&&(t=a.canPlayType(e),t))return t}return""}selectSource(e){const t=this.options_.techOrder.map(l=>[l,K.getTech(l)]).filter(([l,c])=>c?c.isSupported():(X.error(`The "${l}" tech is undefined. Skipped browser support check for that tech.`),!1)),i=function(l,c,p){let g;return l.some(_=>c.some(S=>{if(g=p(_,S),g)return!0})),g};let n;const r=l=>(c,p)=>l(p,c),a=([l,c],p)=>{if(c.canPlaySource(p,this.options_[l.toLowerCase()]))return{source:p,tech:l}};return this.options_.sourceOrder?n=i(e,t,r(a)):n=i(t,e,a),n||!1}handleSrc_(e,t){if(typeof e>"u")return this.cache_.src||"";this.resetRetryOnError_&&this.resetRetryOnError_();const i=Zu(e);if(!i.length){this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0);return}if(this.changingSrc_=!0,t||(this.cache_.sources=i),this.updateSourceCaches_(i[0]),ug(this,i[0],(n,r)=>{if(this.middleware_=r,t||(this.cache_.sources=i),this.updateSourceCaches_(n),this.src_(n)){if(i.length>1)return this.handleSrc_(i.slice(1));this.changingSrc_=!1,this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0),this.triggerReady();return}hg(r,this.tech_)}),i.length>1){const n=()=>{this.error(null),this.handleSrc_(i.slice(1),!0)},r=()=>{this.off("error",n)};this.one("error",n),this.one("playing",r),this.resetRetryOnError_=()=>{this.off("error",n),this.off("playing",r)}}}src(e){return this.handleSrc_(e,!1)}src_(e){const t=this.selectSource([e]);return t?Vu(t.tech,this.techName_)?(this.ready(function(){this.tech_.constructor.prototype.hasOwnProperty("setSource")?this.techCall_("setSource",e):this.techCall_("src",e.src),this.changingSrc_=!1},!0),!1):(this.changingSrc_=!0,this.loadTech_(t.tech,t.source),this.tech_.ready(()=>{this.changingSrc_=!1}),!1):!0}addSourceElement(e,t){return this.tech_?this.tech_.addSourceElement(e,t):!1}removeSourceElement(e){return this.tech_?this.tech_.removeSourceElement(e):!1}load(){if(this.tech_&&this.tech_.vhs){this.src(this.currentSource());return}this.techCall_("load")}reset(){if(this.paused())this.doReset_();else{const e=this.play();nt(e.then(()=>this.doReset_()))}}doReset_(){this.tech_&&this.tech_.clearTracks("text"),this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.resetCache_(),this.poster(""),this.loadTech_(this.options_.techOrder[0],null),this.techCall_("reset"),this.resetControlBarUI_(),this.error(null),this.titleBar&&this.titleBar.update({title:void 0,description:void 0}),gt(this)&&this.trigger("playerreset")}resetControlBarUI_(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()}resetProgressBar_(){this.currentTime(0);const{currentTimeDisplay:e,durationDisplay:t,progressControl:i,remainingTimeDisplay:n}=this.controlBar||{},{seekBar:r}=i||{};e&&e.updateContent(),t&&t.updateContent(),n&&n.updateContent(),r&&(r.update(),r.loadProgressBar&&r.loadProgressBar.update())}resetPlaybackRate_(){this.playbackRate(this.defaultPlaybackRate()),this.handleTechRateChange_()}resetVolumeBar_(){this.volume(1),this.trigger("volumechange")}currentSources(){const e=this.currentSource(),t=[];return Object.keys(e).length!==0&&t.push(e),this.cache_.sources||t}currentSource(){return this.cache_.source||{}}currentSrc(){return this.currentSource()&&this.currentSource().src||""}currentType(){return this.currentSource()&&this.currentSource().type||""}preload(e){if(e!==void 0){this.techCall_("setPreload",e),this.options_.preload=e;return}return this.techGet_("preload")}autoplay(e){if(e===void 0)return this.options_.autoplay||!1;let t;typeof e=="string"&&/(any|play|muted)/.test(e)||e===!0&&this.options_.normalizeAutoplay?(this.options_.autoplay=e,this.manualAutoplay_(typeof e=="string"?e:"play"),t=!1):e?this.options_.autoplay=!0:this.options_.autoplay=!1,t=typeof t>"u"?this.options_.autoplay:t,this.tech_&&this.techCall_("setAutoplay",t)}playsinline(e){return e!==void 0&&(this.techCall_("setPlaysinline",e),this.options_.playsinline=e),this.techGet_("playsinline")}loop(e){if(e!==void 0){this.techCall_("setLoop",e),this.options_.loop=e;return}return this.techGet_("loop")}poster(e){if(e===void 0)return this.poster_;e||(e=""),e!==this.poster_&&(this.poster_=e,this.techCall_("setPoster",e),this.isPosterFromTech_=!1,this.trigger("posterchange"))}handleTechPosterChange_(){if((!this.poster_||this.options_.techCanOverridePoster)&&this.tech_&&this.tech_.poster){const e=this.tech_.poster()||"";e!==this.poster_&&(this.poster_=e,this.isPosterFromTech_=!0,this.trigger("posterchange"))}}controls(e){if(e===void 0)return!!this.controls_;e=!!e,this.controls_!==e&&(this.controls_=e,this.usingNativeControls()&&this.techCall_("setControls",e),this.controls_?(this.removeClass("vjs-controls-disabled"),this.addClass("vjs-controls-enabled"),this.trigger("controlsenabled"),this.usingNativeControls()||this.addTechControlsListeners_()):(this.removeClass("vjs-controls-enabled"),this.addClass("vjs-controls-disabled"),this.trigger("controlsdisabled"),this.usingNativeControls()||this.removeTechControlsListeners_()))}usingNativeControls(e){if(e===void 0)return!!this.usingNativeControls_;e=!!e,this.usingNativeControls_!==e&&(this.usingNativeControls_=e,this.usingNativeControls_?(this.addClass("vjs-using-native-controls"),this.trigger("usingnativecontrols")):(this.removeClass("vjs-using-native-controls"),this.trigger("usingcustomcontrols")))}error(e){if(e===void 0)return this.error_||null;if(At("beforeerror").forEach(t=>{const i=t(this,e);if(!(lt(i)&&!Array.isArray(i)||typeof i=="string"||typeof i=="number"||i===null)){this.log.error("please return a value that MediaError expects in beforeerror hooks");return}e=i}),this.options_.suppressNotSupportedError&&e&&e.code===4){const t=function(){this.error(e)};this.options_.suppressNotSupportedError=!1,this.any(["click","touchstart"],t),this.one("loadstart",function(){this.off(["click","touchstart"],t)});return}if(e===null){this.error_=null,this.removeClass("vjs-error"),this.errorDisplay&&this.errorDisplay.close();return}this.error_=new fe(e),this.addClass("vjs-error"),X.error(`(CODE:${this.error_.code} ${fe.errorTypes[this.error_.code]})`,this.error_.message,this.error_),this.trigger("error"),At("error").forEach(t=>t(this,this.error_))}reportUserActivity(e){this.userActivity_=!0}userActive(e){if(e===void 0)return this.userActive_;if(e=!!e,e!==this.userActive_){if(this.userActive_=e,this.userActive_){this.userActivity_=!0,this.removeClass("vjs-user-inactive"),this.addClass("vjs-user-active"),this.trigger("useractive");return}this.tech_&&this.tech_.one("mousemove",function(t){t.stopPropagation(),t.preventDefault()}),this.userActivity_=!1,this.removeClass("vjs-user-active"),this.addClass("vjs-user-inactive"),this.trigger("userinactive")}}listenForUserActivity_(){let e,t,i;const n=re(this,this.reportUserActivity),r=function(_){(_.screenX!==t||_.screenY!==i)&&(t=_.screenX,i=_.screenY,n())},a=function(){n(),this.clearInterval(e),e=this.setInterval(n,250)},l=function(_){n(),this.clearInterval(e)};this.on("mousedown",a),this.on("mousemove",r),this.on("mouseup",l),this.on("mouseleave",l);const c=this.getChild("controlBar");c&&!Se&&!Je&&(c.on("mouseenter",function(_){this.player().options_.inactivityTimeout!==0&&(this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout),this.player().options_.inactivityTimeout=0}),c.on("mouseleave",function(_){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout})),this.on("keydown",n),this.on("keyup",n);let p;const g=function(){if(!this.userActivity_)return;this.userActivity_=!1,this.userActive(!0),this.clearTimeout(p);const _=this.options_.inactivityTimeout;_<=0||(p=this.setTimeout(function(){this.userActivity_||this.userActive(!1)},_))};this.setInterval(g,250)}playbackRate(e){if(e!==void 0){this.techCall_("setPlaybackRate",e);return}return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1}defaultPlaybackRate(e){return e!==void 0?this.techCall_("setDefaultPlaybackRate",e):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1}isAudio(e){if(e!==void 0){this.isAudio_=!!e;return}return!!this.isAudio_}updatePlayerHeightOnAudioOnlyMode_(){const e=this.getChild("ControlBar");!e||this.audioOnlyCache_.controlBarHeight===e.currentHeight()||(this.audioOnlyCache_.controlBarHeight=e.currentHeight(),this.height(this.audioOnlyCache_.controlBarHeight))}enableAudioOnlyUI_(){this.addClass("vjs-audio-only-mode");const e=this.children(),t=this.getChild("ControlBar"),i=t&&t.currentHeight();e.forEach(n=>{n!==t&&n.el_&&!n.hasClass("vjs-hidden")&&(n.hide(),this.audioOnlyCache_.hiddenChildren.push(n))}),this.audioOnlyCache_.playerHeight=this.currentHeight(),this.audioOnlyCache_.controlBarHeight=i,this.on("playerresize",this.boundUpdatePlayerHeightOnAudioOnlyMode_),this.height(i),this.trigger("audioonlymodechange")}disableAudioOnlyUI_(){this.removeClass("vjs-audio-only-mode"),this.off("playerresize",this.boundUpdatePlayerHeightOnAudioOnlyMode_),this.audioOnlyCache_.hiddenChildren.forEach(e=>e.show()),this.height(this.audioOnlyCache_.playerHeight),this.trigger("audioonlymodechange")}audioOnlyMode(e){if(typeof e!="boolean"||e===this.audioOnlyMode_)return this.audioOnlyMode_;if(this.audioOnlyMode_=e,e){const t=[];return this.isInPictureInPicture()&&t.push(this.exitPictureInPicture()),this.isFullscreen()&&t.push(this.exitFullscreen()),this.audioPosterMode()&&t.push(this.audioPosterMode(!1)),Promise.all(t).then(()=>this.enableAudioOnlyUI_())}return Promise.resolve().then(()=>this.disableAudioOnlyUI_())}enablePosterModeUI_(){(this.tech_&&this.tech_).hide(),this.addClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}disablePosterModeUI_(){(this.tech_&&this.tech_).show(),this.removeClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}audioPosterMode(e){return typeof e!="boolean"||e===this.audioPosterMode_?this.audioPosterMode_:(this.audioPosterMode_=e,e?this.audioOnlyMode()?this.audioOnlyMode(!1).then(()=>{this.enablePosterModeUI_()}):Promise.resolve().then(()=>{this.enablePosterModeUI_()}):Promise.resolve().then(()=>{this.disablePosterModeUI_()}))}addTextTrack(e,t,i){if(this.tech_)return this.tech_.addTextTrack(e,t,i)}addRemoteTextTrack(e,t){if(this.tech_)return this.tech_.addRemoteTextTrack(e,t)}removeRemoteTextTrack(e={}){let{track:t}=e;if(t||(t=e),this.tech_)return this.tech_.removeRemoteTextTrack(t)}getVideoPlaybackQuality(){return this.techGet_("getVideoPlaybackQuality")}videoWidth(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0}videoHeight(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0}language(e){if(e===void 0)return this.language_;this.language_!==String(e).toLowerCase()&&(this.language_=String(e).toLowerCase(),gt(this)&&this.trigger("languagechange"))}languages(){return se(J.prototype.options_.languages,this.languages_)}toJSON(){const e=se(this.options_),t=e.tracks;e.tracks=[];for(let i=0;i<t.length;i++){let n=t[i];n=se(n),n.player=void 0,e.tracks[i]=n}return e}createModal(e,t){t=t||{},t.content=e||"";const i=new Pi(this,t);return this.addChild(i),i.on("dispose",()=>{this.removeChild(i)}),i.open(),i}updateCurrentBreakpoint_(){if(!this.responsive())return;const e=this.currentBreakpoint(),t=this.currentWidth();for(let i=0;i<Gr.length;i++){const n=Gr[i],r=this.breakpoints_[n];if(t<=r){if(e===n)return;e&&this.removeClass(sn[e]),this.addClass(sn[n]),this.breakpoint_=n;break}}}removeCurrentBreakpoint_(){const e=this.currentBreakpointClass();this.breakpoint_="",e&&this.removeClass(e)}breakpoints(e){return e===void 0?Object.assign(this.breakpoints_):(this.breakpoint_="",this.breakpoints_=Object.assign({},Yg,e),this.updateCurrentBreakpoint_(),Object.assign(this.breakpoints_))}responsive(e){if(e===void 0)return this.responsive_;e=!!e;const t=this.responsive_;if(e!==t)return this.responsive_=e,e?(this.on("playerresize",this.boundUpdateCurrentBreakpoint_),this.updateCurrentBreakpoint_()):(this.off("playerresize",this.boundUpdateCurrentBreakpoint_),this.removeCurrentBreakpoint_()),e}currentBreakpoint(){return this.breakpoint_}currentBreakpointClass(){return sn[this.breakpoint_]||""}loadMedia(e,t){if(!e||typeof e!="object")return;const i=this.crossOrigin();this.reset(),this.cache_.media=se(e);const{artist:n,artwork:r,description:a,poster:l,src:c,textTracks:p,title:g}=this.cache_.media;!r&&l&&(this.cache_.media.artwork=[{src:l,type:yn(l)}]),i&&this.crossOrigin(i),c&&this.src(c),l&&this.poster(l),Array.isArray(p)&&p.forEach(_=>this.addRemoteTextTrack(_,!1)),this.titleBar&&this.titleBar.update({title:g,description:a||n||""}),this.ready(t)}getMedia(){if(!this.cache_.media){const e=this.poster(),t=this.currentSources(),i=Array.prototype.map.call(this.remoteTextTracks(),r=>({kind:r.kind,label:r.label,language:r.language,src:r.src})),n={src:t,textTracks:i};return e&&(n.poster=e,n.artwork=[{src:n.poster,type:yn(n.poster)}]),n}return se(this.cache_.media)}static getTagSettings(e){const t={sources:[],tracks:[]},i=kt(e),n=i["data-setup"];if(os(e,"vjs-fill")&&(i.fill=!0),os(e,"vjs-fluid")&&(i.fluid=!0),n!==null)try{Object.assign(i,JSON.parse(n||"{}"))}catch(r){X.error("data-setup",r)}if(Object.assign(t,i),e.hasChildNodes()){const r=e.childNodes;for(let a=0,l=r.length;a<l;a++){const c=r[a],p=c.nodeName.toLowerCase();p==="source"?t.sources.push(kt(c)):p==="track"&&t.tracks.push(kt(c))}}return t}debug(e){if(e===void 0)return this.debugEnabled_;e?(this.trigger("debugon"),this.previousLogLevel_=this.log.level,this.log.level("debug"),this.debugEnabled_=!0):(this.trigger("debugoff"),this.log.level(this.previousLogLevel_),this.previousLogLevel_=void 0,this.debugEnabled_=!1)}playbackRates(e){if(e===void 0)return this.cache_.playbackRates;Array.isArray(e)&&e.every(t=>typeof t=="number")&&(this.cache_.playbackRates=e,this.trigger("playbackrateschange"))}}J.prototype.videoTracks=()=>{};J.prototype.audioTracks=()=>{};J.prototype.textTracks=()=>{};J.prototype.remoteTextTracks=()=>{};J.prototype.remoteTextTrackEls=()=>{};Ie.names.forEach(function(s){const e=Ie[s];J.prototype[e.getterName]=function(){return this.tech_?this.tech_[e.getterName]():(this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName])}});J.prototype.crossorigin=J.prototype.crossOrigin;J.players={};const Yi=x.navigator;J.prototype.options_={techOrder:K.defaultTechOrder_,html5:{},enableSourceset:!0,inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","titleBar","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:Yi&&(Yi.languages&&Yi.languages[0]||Yi.userLanguage||Yi.language)||"en",languages:{},notSupportedMessage:"No compatible source was found for this media.",normalizeAutoplay:!1,fullscreen:{options:{navigationUI:"hide"}},breakpoints:{},responsive:!1,audioOnlyMode:!1,audioPosterMode:!1,spatialNavigation:{enabled:!1,horizontalSeek:!1},enableSmoothSeeking:!1,disableSeekWhileScrubbingOnMobile:!1,disableSeekWhileScrubbingOnSTV:!1};Ph.forEach(function(s){J.prototype[`handleTech${pe(s)}_`]=function(){return this.trigger(s)}});D.registerComponent("Player",J);const Tn="plugin",di="activePlugins_",ri={},vn=s=>ri.hasOwnProperty(s),nn=s=>vn(s)?ri[s]:void 0,Ah=(s,e)=>{s[di]=s[di]||{},s[di][e]=!0},bn=(s,e,t)=>{const i=(t?"before":"")+"pluginsetup";s.trigger(i,e),s.trigger(i+":"+e.name,e)},Jg=function(s,e){const t=function(){bn(this,{name:s,plugin:e,instance:null},!0);const i=e.apply(this,arguments);return Ah(this,s),bn(this,{name:s,plugin:e,instance:i}),i};return Object.keys(e).forEach(function(i){t[i]=e[i]}),t},kl=(s,e)=>(e.prototype.name=s,function(...t){bn(this,{name:s,plugin:e,instance:null},!0);const i=new e(this,...t);return this[s]=()=>i,bn(this,i.getEventHash()),i});class Re{constructor(e){if(this.constructor===Re)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=e,this.log||(this.log=this.player.log.createLogger(this.name)),ga(this),delete this.trigger,Hu(this,this.constructor.defaultState),Ah(e,this.name),this.dispose=this.dispose.bind(this),e.on("dispose",this.dispose)}version(){return this.constructor.VERSION}getEventHash(e={}){return e.name=this.name,e.plugin=this.constructor,e.instance=this,e}trigger(e,t={}){return Ii(this.eventBusEl_,e,this.getEventHash(t))}handleStateChanged(e){}dispose(){const{name:e,player:t}=this;this.trigger("dispose"),this.off(),t.off("dispose",this.dispose),t[di][e]=!1,this.player=this.state=null,t[e]=kl(e,ri[e])}static isBasic(e){const t=typeof e=="string"?nn(e):e;return typeof t=="function"&&!Re.prototype.isPrototypeOf(t.prototype)}static registerPlugin(e,t){if(typeof e!="string")throw new Error(`Illegal plugin name, "${e}", must be a string, was ${typeof e}.`);if(vn(e))X.warn(`A plugin named "${e}" already exists. You may want to avoid re-registering plugins!`);else if(J.prototype.hasOwnProperty(e))throw new Error(`Illegal plugin name, "${e}", cannot share a name with an existing player method!`);if(typeof t!="function")throw new Error(`Illegal plugin for "${e}", must be a function, was ${typeof t}.`);return ri[e]=t,e!==Tn&&(Re.isBasic(t)?J.prototype[e]=Jg(e,t):J.prototype[e]=kl(e,t)),t}static deregisterPlugin(e){if(e===Tn)throw new Error("Cannot de-register base plugin.");vn(e)&&(delete ri[e],delete J.prototype[e])}static getPlugins(e=Object.keys(ri)){let t;return e.forEach(i=>{const n=nn(i);n&&(t=t||{},t[i]=n)}),t}static getPluginVersion(e){const t=nn(e);return t&&t.VERSION||""}}Re.getPlugin=nn;Re.BASE_PLUGIN_NAME=Tn;Re.registerPlugin(Tn,Re);J.prototype.usingPlugin=function(s){return!!this[di]&&this[di][s]===!0};J.prototype.hasPlugin=function(s){return!!vn(s)};function Zg(s,e){let t=!1;return function(...i){return t||X.warn(s),t=!0,e.apply(this,i)}}function Ze(s,e,t,i){return Zg(`${e} is deprecated and will be removed in ${s}.0; please use ${t} instead.`,i)}var e0={NetworkBadStatus:"networkbadstatus",NetworkRequestFailed:"networkrequestfailed",NetworkRequestAborted:"networkrequestaborted",NetworkRequestTimeout:"networkrequesttimeout",NetworkBodyParserFailed:"networkbodyparserfailed",StreamingHlsPlaylistParserError:"streaminghlsplaylistparsererror",StreamingDashManifestParserError:"streamingdashmanifestparsererror",StreamingContentSteeringParserError:"streamingcontentsteeringparsererror",StreamingVttParserError:"streamingvttparsererror",StreamingFailedToSelectNextSegment:"streamingfailedtoselectnextsegment",StreamingFailedToDecryptSegment:"streamingfailedtodecryptsegment",StreamingFailedToTransmuxSegment:"streamingfailedtotransmuxsegment",StreamingFailedToAppendSegment:"streamingfailedtoappendsegment",StreamingCodecsChangeError:"streamingcodecschangeerror"};const Lh=s=>s.indexOf("#")===0?s.slice(1):s;function k(s,e,t){let i=k.getPlayer(s);if(i)return e&&X.warn(`Player "${s}" is already initialised. Options will not be applied.`),t&&i.ready(t),i;const n=typeof s=="string"?Lt("#"+Lh(s)):s;if(!ki(n))throw new TypeError("The element or ID supplied is not valid. (videojs)");const a=("getRootNode"in n?n.getRootNode()instanceof x.ShadowRoot:!1)?n.getRootNode():n.ownerDocument.body;(!n.ownerDocument.defaultView||!a.contains(n))&&X.warn("The element supplied is not included in the DOM"),e=e||{},e.restoreEl===!0&&(e.restoreEl=(n.parentNode&&n.parentNode.hasAttribute&&n.parentNode.hasAttribute("data-vjs-player")?n.parentNode:n).cloneNode(!0)),At("beforesetup").forEach(c=>{const p=c(n,se(e));if(!lt(p)||Array.isArray(p)){X.error("please return an object in beforesetup hooks");return}e=se(e,p)});const l=D.getComponent("Player");return i=new l(n,e,t),At("setup").forEach(c=>c(i)),i}k.hooks_=pt;k.hooks=At;k.hook=Mm;k.hookOnce=Rm;k.removeHook=fu;if(x.VIDEOJS_NO_DYNAMIC_STYLE!==!0&&wi()){let s=Lt(".vjs-styles-defaults");if(!s){s=Fu("vjs-styles-defaults");const e=Lt("head");e&&e.insertBefore(s,e.firstChild),Nu(s,`
|
|
181
|
-
.video-js {
|
|
182
|
-
width: 300px;
|
|
183
|
-
height: 150px;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
.vjs-fluid:not(.vjs-audio-only-mode) {
|
|
187
|
-
padding-top: 56.25%
|
|
188
|
-
}
|
|
189
|
-
`)}}jr(1,k);k.VERSION=Br;k.options=J.prototype.options_;k.getPlayers=()=>J.players;k.getPlayer=s=>{const e=J.players;let t;if(typeof s=="string"){const i=Lh(s),n=e[i];if(n)return n;t=Lt("#"+i)}else t=s;if(ki(t)){const{player:i,playerId:n}=t;if(i||e[n])return i||e[n]}};k.getAllPlayers=()=>Object.keys(J.players).map(s=>J.players[s]).filter(Boolean);k.players=J.players;k.getComponent=D.getComponent;k.registerComponent=(s,e)=>(K.isTech(e)&&X.warn(`The ${s} tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)`),D.registerComponent.call(D,s,e));k.getTech=K.getTech;k.registerTech=K.registerTech;k.use=lg;Object.defineProperty(k,"middleware",{value:{},writeable:!1,enumerable:!0});Object.defineProperty(k.middleware,"TERMINATOR",{value:_n,writeable:!1,enumerable:!0});k.browser=xu;k.obj=Nm;k.mergeOptions=Ze(9,"videojs.mergeOptions","videojs.obj.merge",se);k.defineLazyProperty=Ze(9,"videojs.defineLazyProperty","videojs.obj.defineLazyProperty",Pn);k.bind=Ze(9,"videojs.bind","native Function.prototype.bind",re);k.registerPlugin=Re.registerPlugin;k.deregisterPlugin=Re.deregisterPlugin;k.plugin=(s,e)=>(X.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),Re.registerPlugin(s,e));k.getPlugins=Re.getPlugins;k.getPlugin=Re.getPlugin;k.getPluginVersion=Re.getPluginVersion;k.addLanguage=function(s,e){return s=(""+s).toLowerCase(),k.options.languages=se(k.options.languages,{[s]:e}),k.options.languages[s]};k.log=X;k.createLogger=pu;k.time=Zm;k.createTimeRange=Ze(9,"videojs.createTimeRange","videojs.time.createTimeRanges",Ye);k.createTimeRanges=Ze(9,"videojs.createTimeRanges","videojs.time.createTimeRanges",Ye);k.formatTime=Ze(9,"videojs.formatTime","videojs.time.formatTime",Yt);k.setFormatTime=Ze(9,"videojs.setFormatTime","videojs.time.setFormatTime",zu);k.resetFormatTime=Ze(9,"videojs.resetFormatTime","videojs.time.resetFormatTime",Wu);k.parseUrl=Ze(9,"videojs.parseUrl","videojs.url.parseUrl",va);k.isCrossOrigin=Ze(9,"videojs.isCrossOrigin","videojs.url.isCrossOrigin",$n);k.EventTarget=$e;k.any=ma;k.on=je;k.one=Un;k.off=Ce;k.trigger=Ii;k.xhr=iu;k.TrackList=Jt;k.TextTrack=gs;k.TextTrackList=ya;k.AudioTrack=Yu;k.AudioTrackList=Ku;k.VideoTrack=Ju;k.VideoTrackList=Qu;["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach(s=>{k[s]=function(){return X.warn(`videojs.${s}() is deprecated; use videojs.dom.${s}() instead`),Ru[s].apply(null,arguments)}});k.computedStyle=Ze(9,"videojs.computedStyle","videojs.dom.computedStyle",xi);k.dom=Ru;k.fn=Gm;k.num=Pg;k.str=Ym;k.url=ag;k.Error=e0;/*! @name videojs-contrib-quality-levels @version 4.1.0 @license Apache-2.0 */class t0{constructor(e){let t=this;return t.id=e.id,t.label=t.id,t.width=e.width,t.height=e.height,t.bitrate=e.bandwidth,t.frameRate=e.frameRate,t.enabled_=e.enabled,Object.defineProperty(t,"enabled",{get(){return t.enabled_()},set(i){t.enabled_(i)}}),t}}class xn extends k.EventTarget{constructor(){super();let e=this;return e.levels_=[],e.selectedIndex_=-1,Object.defineProperty(e,"selectedIndex",{get(){return e.selectedIndex_}}),Object.defineProperty(e,"length",{get(){return e.levels_.length}}),e[Symbol.iterator]=()=>e.levels_.values(),e}addQualityLevel(e){let t=this.getQualityLevelById(e.id);if(t)return t;const i=this.levels_.length;return t=new t0(e),""+i in this||Object.defineProperty(this,i,{get(){return this.levels_[i]}}),this.levels_.push(t),this.trigger({qualityLevel:t,type:"addqualitylevel"}),t}removeQualityLevel(e){let t=null;for(let i=0,n=this.length;i<n;i++)if(this[i]===e){t=this.levels_.splice(i,1)[0],this.selectedIndex_===i?this.selectedIndex_=-1:this.selectedIndex_>i&&this.selectedIndex_--;break}return t&&this.trigger({qualityLevel:e,type:"removequalitylevel"}),t}getQualityLevelById(e){for(let t=0,i=this.length;t<i;t++){const n=this[t];if(n.id===e)return n}return null}dispose(){this.selectedIndex_=-1,this.levels_.length=0}}xn.prototype.allowedEvents_={change:"change",addqualitylevel:"addqualitylevel",removequalitylevel:"removequalitylevel"};for(const s in xn.prototype.allowedEvents_)xn.prototype["on"+s]=null;var Dh="4.1.0";const i0=function(s,e){const t=s.qualityLevels,i=new xn,n=function(){i.dispose(),s.qualityLevels=t,s.off("dispose",n)};return s.on("dispose",n),s.qualityLevels=()=>i,s.qualityLevels.VERSION=Dh,i},Oh=function(s){return i0(this,k.obj.merge({},s))};k.registerPlugin("qualityLevels",Oh);Oh.VERSION=Dh;/*! @name @videojs/http-streaming @version 3.17.2 @license Apache-2.0 */const Oe=au,Sn=(s,e)=>e&&e.responseURL&&s!==e.responseURL?e.responseURL:s,Ge=s=>k.log.debug?k.log.debug.bind(k,"VHS:",`${s} >`):function(){};function Z(...s){const e=k.obj||k;return(e.merge||e.mergeOptions).apply(e,s)}function be(...s){const e=k.time||k;return(e.createTimeRanges||e.createTimeRanges).apply(e,s)}function s0(s){if(s.length===0)return"Buffered Ranges are empty";let e=`Buffered Ranges:
|
|
190
|
-
`;for(let t=0;t<s.length;t++){const i=s.start(t),n=s.end(t);e+=`${i} --> ${n}. Duration (${n-i})
|
|
191
|
-
`}return e}const rt=1/30,at=rt*3,Mh=function(s,e){const t=[];let i;if(s&&s.length)for(i=0;i<s.length;i++)e(s.start(i),s.end(i))&&t.push([s.start(i),s.end(i)]);return be(t)},ai=function(s,e){return Mh(s,function(t,i){return t-at<=e&&i+at>=e})},Js=function(s,e){return Mh(s,function(t){return t-rt>=e})},n0=function(s){if(s.length<2)return be();const e=[];for(let t=1;t<s.length;t++){const i=s.end(t-1),n=s.start(t);e.push([i,n])}return be(e)},r0=function(s,e){let t=null,i=null,n=0;const r=[],a=[];if(!s||!s.length||!e||!e.length)return be();let l=s.length;for(;l--;)r.push({time:s.start(l),type:"start"}),r.push({time:s.end(l),type:"end"});for(l=e.length;l--;)r.push({time:e.start(l),type:"start"}),r.push({time:e.end(l),type:"end"});for(r.sort(function(c,p){return c.time-p.time}),l=0;l<r.length;l++)r[l].type==="start"?(n++,n===2&&(t=r[l].time)):r[l].type==="end"&&(n--,n===1&&(i=r[l].time)),t!==null&&i!==null&&(a.push([t,i]),t=null,i=null);return be(a)},Rh=s=>{const e=[];if(!s||!s.length)return"";for(let t=0;t<s.length;t++)e.push(s.start(t)+" => "+s.end(t));return e.join(", ")},a0=function(s,e,t=1){return((s.length?s.end(s.length-1):0)-e)/t},zt=s=>{const e=[];for(let t=0;t<s.length;t++)e.push({start:s.start(t),end:s.end(t)});return e},o0=function(s,e){if(s===e)return!1;if(!s&&e||!e&&s||s.length!==e.length)return!0;for(let t=0;t<s.length;t++)if(s.start(t)!==e.start(t)||s.end(t)!==e.end(t))return!0;return!1},Pr=function(s){if(!(!s||!s.length||!s.end))return s.end(s.length-1)},Fa=function(s,e){let t=0;if(!s||!s.length)return t;for(let i=0;i<s.length;i++){const n=s.start(i),r=s.end(i);if(!(e>r)){if(e>n&&e<=r){t+=r-e;continue}t+=r-n}}return t},Na=(s,e)=>{if(!e.preload)return e.duration;let t=0;return(e.parts||[]).forEach(function(i){t+=i.duration}),(e.preloadHints||[]).forEach(function(i){i.type==="PART"&&(t+=s.partTargetDuration)}),t},Kr=s=>(s.segments||[]).reduce((e,t,i)=>(t.parts?t.parts.forEach(function(n,r){e.push({duration:n.duration,segmentIndex:i,partIndex:r,part:n,segment:t})}):e.push({duration:t.duration,segmentIndex:i,partIndex:null,segment:t,part:null}),e),[]),Bh=s=>{const e=s.segments&&s.segments.length&&s.segments[s.segments.length-1];return e&&e.parts||[]},Fh=({preloadSegment:s})=>{if(!s)return;const{parts:e,preloadHints:t}=s;let i=(t||[]).reduce((n,r)=>n+(r.type==="PART"?1:0),0);return i+=e&&e.length?e.length:0,i},Nh=(s,e)=>{if(e.endList)return 0;if(s&&s.suggestedPresentationDelay)return s.suggestedPresentationDelay;const t=Bh(e).length>0;return t&&e.serverControl&&e.serverControl.partHoldBack?e.serverControl.partHoldBack:t&&e.partTargetDuration?e.partTargetDuration*3:e.serverControl&&e.serverControl.holdBack?e.serverControl.holdBack:e.targetDuration?e.targetDuration*3:0},l0=function(s,e){let t=0,i=e-s.mediaSequence,n=s.segments[i];if(n){if(typeof n.start<"u")return{result:n.start,precise:!0};if(typeof n.end<"u")return{result:n.end-n.duration,precise:!0}}for(;i--;){if(n=s.segments[i],typeof n.end<"u")return{result:t+n.end,precise:!0};if(t+=Na(s,n),typeof n.start<"u")return{result:t+n.start,precise:!0}}return{result:t,precise:!1}},u0=function(s,e){let t=0,i,n=e-s.mediaSequence;for(;n<s.segments.length;n++){if(i=s.segments[n],typeof i.start<"u")return{result:i.start-t,precise:!0};if(t+=Na(s,i),typeof i.end<"u")return{result:i.end-t,precise:!0}}return{result:-1,precise:!1}},Uh=function(s,e,t){if(typeof e>"u"&&(e=s.mediaSequence+s.segments.length),e<s.mediaSequence)return 0;const i=l0(s,e);if(i.precise)return i.result;const n=u0(s,e);return n.precise?n.result:i.result+t},jh=function(s,e,t){if(!s)return 0;if(typeof t!="number"&&(t=0),typeof e>"u"){if(s.totalDuration)return s.totalDuration;if(!s.endList)return x.Infinity}return Uh(s,e,t)},hs=function({defaultDuration:s,durationList:e,startIndex:t,endIndex:i}){let n=0;if(t>i&&([t,i]=[i,t]),t<0){for(let r=t;r<Math.min(0,i);r++)n+=s;t=0}for(let r=t;r<i;r++)n+=e[r].duration;return n},$h=function(s,e,t,i){if(!s||!s.segments)return null;if(s.endList)return jh(s);if(e===null)return null;e=e||0;let n=Uh(s,s.mediaSequence+s.segments.length,e);return t&&(i=typeof i=="number"?i:Nh(null,s),n-=i),Math.max(0,n)},h0=function(s,e,t){const n=e||0;let r=$h(s,e,!0,t);return r===null?be():(r<n&&(r=n),be(n,r))},d0=function({playlist:s,currentTime:e,startingSegmentIndex:t,startingPartIndex:i,startTime:n,exactManifestTimings:r}){let a=e-n;const l=Kr(s);let c=0;for(let p=0;p<l.length;p++){const g=l[p];if(t===g.segmentIndex&&!(typeof i=="number"&&typeof g.partIndex=="number"&&i!==g.partIndex)){c=p;break}}if(a<0){if(c>0)for(let p=c-1;p>=0;p--){const g=l[p];if(a+=g.duration,r){if(a<0)continue}else if(a+rt<=0)continue;return{partIndex:g.partIndex,segmentIndex:g.segmentIndex,startTime:n-hs({defaultDuration:s.targetDuration,durationList:l,startIndex:c,endIndex:p})}}return{partIndex:l[0]&&l[0].partIndex||null,segmentIndex:l[0]&&l[0].segmentIndex||0,startTime:e}}if(c<0){for(let p=c;p<0;p++)if(a-=s.targetDuration,a<0)return{partIndex:l[0]&&l[0].partIndex||null,segmentIndex:l[0]&&l[0].segmentIndex||0,startTime:e};c=0}for(let p=c;p<l.length;p++){const g=l[p];a-=g.duration;const _=g.duration>rt,S=a===0,E=_&&a+rt>=0;if(!((S||E)&&p!==l.length-1)){if(r){if(a>0)continue}else if(a-rt>=0)continue;return{partIndex:g.partIndex,segmentIndex:g.segmentIndex,startTime:n+hs({defaultDuration:s.targetDuration,durationList:l,startIndex:c,endIndex:p})}}}return{segmentIndex:l[l.length-1].segmentIndex,partIndex:l[l.length-1].partIndex,startTime:e}},Hh=function(s){return s.excludeUntil&&s.excludeUntil>Date.now()},Ua=function(s){return s.excludeUntil&&s.excludeUntil===1/0},zn=function(s){const e=Hh(s);return!s.disabled&&!e},c0=function(s){return s.disabled},f0=function(s){for(let e=0;e<s.segments.length;e++)if(s.segments[e].key)return!0;return!1},Vh=function(s,e){return e.attributes&&e.attributes[s]},p0=function(s,e,t,i=0){return Vh("BANDWIDTH",t)?(s*t.attributes.BANDWIDTH-i*8)/e:NaN},Qr=(s,e)=>{if(s.playlists.length===1)return!0;const t=e.attributes.BANDWIDTH||Number.MAX_VALUE;return s.playlists.filter(i=>zn(i)?(i.attributes.BANDWIDTH||0)<t:!1).length===0},ja=(s,e)=>!s&&!e||!s&&e||s&&!e?!1:!!(s===e||s.id&&e.id&&s.id===e.id||s.resolvedUri&&e.resolvedUri&&s.resolvedUri===e.resolvedUri||s.uri&&e.uri&&s.uri===e.uri),Il=function(s,e){const t=s&&s.mediaGroups&&s.mediaGroups.AUDIO||{};let i=!1;for(const n in t){for(const r in t[n])if(i=e(t[n][r]),i)break;if(i)break}return!!i},vs=s=>{if(!s||!s.playlists||!s.playlists.length)return Il(s,t=>t.playlists&&t.playlists.length||t.uri);for(let e=0;e<s.playlists.length;e++){const t=s.playlists[e],i=t.attributes&&t.attributes.CODECS;if(!(i&&i.split(",").every(r=>lu(r))||Il(s,r=>ja(t,r))))return!1}return!0};var Me={liveEdgeDelay:Nh,duration:jh,seekable:h0,getMediaInfoForTime:d0,isEnabled:zn,isDisabled:c0,isExcluded:Hh,isIncompatible:Ua,playlistEnd:$h,isAes:f0,hasAttribute:Vh,estimateSegmentRequestTime:p0,isLowestEnabledRendition:Qr,isAudioOnly:vs,playlistMatch:ja,segmentDurationWithParts:Na};const{log:qh}=k,ci=(s,e)=>`${s}-${e}`,zh=(s,e,t)=>`placeholder-uri-${s}-${e}-${t}`,m0=({onwarn:s,oninfo:e,manifestString:t,customTagParsers:i=[],customTagMappers:n=[],llhls:r})=>{const a=new Pt.Parser;s&&a.on("warn",s),e&&a.on("info",e),i.forEach(p=>a.addParser(p)),n.forEach(p=>a.addTagMapper(p)),a.push(t),a.end();const l=a.manifest;if(r||(["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach(function(p){l.hasOwnProperty(p)&&delete l[p]}),l.segments&&l.segments.forEach(function(p){["parts","preloadHints"].forEach(function(g){p.hasOwnProperty(g)&&delete p[g]})})),!l.targetDuration){let p=10;l.segments&&l.segments.length&&(p=l.segments.reduce((g,_)=>Math.max(g,_.duration),0)),s&&s({message:`manifest has no targetDuration defaulting to ${p}`}),l.targetDuration=p}const c=Bh(l);if(c.length&&!l.partTargetDuration){const p=c.reduce((g,_)=>Math.max(g,_.duration),0);s&&(s({message:`manifest has no partTargetDuration defaulting to ${p}`}),qh.error("LL-HLS manifest has parts but lacks required #EXT-X-PART-INF:PART-TARGET value. See https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-09#section-4.4.3.7. Playback is not guaranteed.")),l.partTargetDuration=p}return l},Di=(s,e)=>{s.mediaGroups&&["AUDIO","SUBTITLES"].forEach(t=>{if(s.mediaGroups[t])for(const i in s.mediaGroups[t])for(const n in s.mediaGroups[t][i]){const r=s.mediaGroups[t][i][n];e(r,t,i,n)}})},Wh=({playlist:s,uri:e,id:t})=>{s.id=t,s.playlistErrors_=0,e&&(s.uri=e),s.attributes=s.attributes||{}},g0=s=>{let e=s.playlists.length;for(;e--;){const t=s.playlists[e];Wh({playlist:t,id:ci(e,t.uri)}),t.resolvedUri=Oe(s.uri,t.uri),s.playlists[t.id]=t,s.playlists[t.uri]=t,t.attributes.BANDWIDTH||qh.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}},_0=s=>{Di(s,e=>{e.uri&&(e.resolvedUri=Oe(s.uri,e.uri))})},y0=(s,e)=>{const t=ci(0,e),i={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:x.location.href,resolvedUri:x.location.href,playlists:[{uri:e,id:t,resolvedUri:e,attributes:{}}]};return i.playlists[t]=i.playlists[0],i.playlists[e]=i.playlists[0],i},Gh=(s,e,t=zh)=>{s.uri=e;for(let n=0;n<s.playlists.length;n++)if(!s.playlists[n].uri){const r=`placeholder-uri-${n}`;s.playlists[n].uri=r}const i=vs(s);Di(s,(n,r,a,l)=>{if(!n.playlists||!n.playlists.length){if(i&&r==="AUDIO"&&!n.uri)for(let c=0;c<s.playlists.length;c++){const p=s.playlists[c];if(p.attributes&&p.attributes.AUDIO&&p.attributes.AUDIO===a)return}n.playlists=[ve({},n)]}n.playlists.forEach(function(c,p){const g=t(r,a,l,c),_=ci(p,g);c.uri?c.resolvedUri=c.resolvedUri||Oe(s.uri,c.uri):(c.uri=p===0?g:_,c.resolvedUri=c.uri),c.id=c.id||_,c.attributes=c.attributes||{},s.playlists[c.id]=c,s.playlists[c.uri]=c})}),g0(s),_0(s)};class Pl{constructor(){this.offset_=null,this.pendingDateRanges_=new Map,this.processedDateRanges_=new Map}setOffset(e=[]){if(this.offset_!==null||!e.length)return;const[t]=e;t.programDateTime!==void 0&&(this.offset_=t.programDateTime/1e3)}setPendingDateRanges(e=[]){if(!e.length)return;const[t]=e,i=t.startDate.getTime();this.trimProcessedDateRanges_(i),this.pendingDateRanges_=e.reduce((n,r)=>(n.set(r.id,r),n),new Map)}processDateRange(e){this.pendingDateRanges_.delete(e.id),this.processedDateRanges_.set(e.id,e)}getDateRangesToProcess(){if(this.offset_===null)return[];const e={},t=[];this.pendingDateRanges_.forEach((i,n)=>{if(!this.processedDateRanges_.has(n)&&(i.startTime=i.startDate.getTime()/1e3-this.offset_,i.processDateRange=()=>this.processDateRange(i),t.push(i),!!i.class))if(e[i.class]){const r=e[i.class].push(i);i.classListIndex=r-1}else e[i.class]=[i],i.classListIndex=0});for(const i of t){const n=e[i.class]||[];i.endDate?i.endTime=i.endDate.getTime()/1e3-this.offset_:i.endOnNext&&n[i.classListIndex+1]?i.endTime=n[i.classListIndex+1].startTime:i.duration?i.endTime=i.startTime+i.duration:i.plannedDuration?i.endTime=i.startTime+i.plannedDuration:i.endTime=i.startTime}return t}trimProcessedDateRanges_(e){new Map(this.processedDateRanges_).forEach((i,n)=>{i.startDate.getTime()<e&&this.processedDateRanges_.delete(n)})}}const Kh=22,Xt=({requestType:s,request:e,error:t,parseFailure:i})=>{const n=e.status<200||e.status>299,r=e.status>=400&&e.status<=499,a={uri:e.uri,requestType:s},l=n&&!r||i;if(t&&r)a.error=ve({},t),a.errorType=k.Error.NetworkRequestFailed;else if(e.aborted)a.errorType=k.Error.NetworkRequestAborted;else if(e.timedout)a.errorType=k.Error.NetworkRequestTimeout;else if(l){const c=i?k.Error.NetworkBodyParserFailed:k.Error.NetworkBadStatus;a.errorType=c,a.status=e.status,a.headers=e.headers}return a},T0=Ge("CodecUtils"),Qh=function(s){const e=s.attributes||{};if(e.CODECS)return it(e.CODECS)},Xh=(s,e)=>{const t=e.attributes||{};return s&&s.mediaGroups&&s.mediaGroups.AUDIO&&t.AUDIO&&s.mediaGroups.AUDIO[t.AUDIO]},v0=(s,e)=>{if(!Xh(s,e))return!0;const t=e.attributes||{},i=s.mediaGroups.AUDIO[t.AUDIO];for(const n in i)if(!i[n].uri&&!i[n].playlists)return!0;return!1},ms=function(s){const e={};return s.forEach(({mediaType:t,type:i,details:n})=>{e[t]=e[t]||[],e[t].push(ou(`${i}${n}`))}),Object.keys(e).forEach(function(t){if(e[t].length>1){T0(`multiple ${t} codecs found as attributes: ${e[t].join(", ")}. Setting playlist codecs to null so that we wait for mux.js to probe segments for real codecs.`),e[t]=null;return}e[t]=e[t][0]}),e},Al=function(s){let e=0;return s.audio&&e++,s.video&&e++,e},ds=function(s,e){const t=e.attributes||{},i=ms(Qh(e)||[]);if(Xh(s,e)&&!i.audio&&!v0(s,e)){const n=ms(im(s,t.AUDIO)||[]);n.audio&&(i.audio=n.audio)}return i},{EventTarget:b0}=k,x0=(s,e)=>{if(e.endList||!e.serverControl)return s;const t={};if(e.serverControl.canBlockReload){const{preloadSegment:i}=e;let n=e.mediaSequence+e.segments.length;if(i){const r=i.parts||[],a=Fh(e)-1;a>-1&&a!==r.length-1&&(t._HLS_part=a),(a>-1||r.length)&&n--}t._HLS_msn=n}if(e.serverControl&&e.serverControl.canSkipUntil&&(t._HLS_skip=e.serverControl.canSkipDateranges?"v2":"YES"),Object.keys(t).length){const i=new x.URL(s);["_HLS_skip","_HLS_msn","_HLS_part"].forEach(function(n){t.hasOwnProperty(n)&&i.searchParams.set(n,t[n])}),s=i.toString()}return s},S0=(s,e)=>{if(!s)return e;const t=Z(s,e);if(s.preloadHints&&!e.preloadHints&&delete t.preloadHints,s.parts&&!e.parts)delete t.parts;else if(s.parts&&e.parts)for(let i=0;i<e.parts.length;i++)s.parts&&s.parts[i]&&(t.parts[i]=Z(s.parts[i],e.parts[i]));return!s.skipped&&e.skipped&&(t.skipped=!1),s.preload&&!e.preload&&(t.preload=!1),t},C0=(s,e,t)=>{const i=s.slice(),n=e.slice();t=t||0;const r=[];let a;for(let l=0;l<n.length;l++){const c=i[l+t],p=n[l];c?(a=c.map||a,r.push(S0(c,p))):(a&&!p.map&&(p.map=a),r.push(p))}return r},Yh=(s,e)=>{!s.resolvedUri&&s.uri&&(s.resolvedUri=Oe(e,s.uri)),s.key&&!s.key.resolvedUri&&(s.key.resolvedUri=Oe(e,s.key.uri)),s.map&&!s.map.resolvedUri&&(s.map.resolvedUri=Oe(e,s.map.uri)),s.map&&s.map.key&&!s.map.key.resolvedUri&&(s.map.key.resolvedUri=Oe(e,s.map.key.uri)),s.parts&&s.parts.length&&s.parts.forEach(t=>{t.resolvedUri||(t.resolvedUri=Oe(e,t.uri))}),s.preloadHints&&s.preloadHints.length&&s.preloadHints.forEach(t=>{t.resolvedUri||(t.resolvedUri=Oe(e,t.uri))})},Jh=function(s){const e=s.segments||[],t=s.preloadSegment;if(t&&t.parts&&t.parts.length){if(t.preloadHints){for(let i=0;i<t.preloadHints.length;i++)if(t.preloadHints[i].type==="MAP")return e}t.duration=s.targetDuration,t.preload=!0,e.push(t)}return e},Zh=(s,e)=>s===e||s.segments&&e.segments&&s.segments.length===e.segments.length&&s.endList===e.endList&&s.mediaSequence===e.mediaSequence&&s.preloadSegment===e.preloadSegment,Xr=(s,e,t=Zh)=>{const i=Z(s,{}),n=i.playlists[e.id];if(!n||t(n,e))return null;e.segments=Jh(e);const r=Z(n,e);if(r.preloadSegment&&!e.preloadSegment&&delete r.preloadSegment,n.segments){if(e.skip){e.segments=e.segments||[];for(let a=0;a<e.skip.skippedSegments;a++)e.segments.unshift({skipped:!0})}r.segments=C0(n.segments,e.segments,e.mediaSequence-n.mediaSequence)}r.segments.forEach(a=>{Yh(a,r.resolvedUri)});for(let a=0;a<i.playlists.length;a++)i.playlists[a].id===e.id&&(i.playlists[a]=r);return i.playlists[e.id]=r,i.playlists[e.uri]=r,Di(s,(a,l,c,p)=>{if(a.playlists)for(let g=0;g<a.playlists.length;g++)e.id===a.playlists[g].id&&(a.playlists[g]=r)}),i},Yr=(s,e)=>{const t=s.segments||[],i=t[t.length-1],n=i&&i.parts&&i.parts[i.parts.length-1],r=n&&n.duration||i&&i.duration;return e&&r?r*1e3:(s.partTargetDuration||s.targetDuration||10)*500},Ll=(s,e,t)=>{if(!s)return;const i=[];return s.forEach(n=>{if(!n.attributes)return;const{BANDWIDTH:r,RESOLUTION:a,CODECS:l}=n.attributes;i.push({id:n.id,bandwidth:r,resolution:a,codecs:l})}),{type:e,isLive:t,renditions:i}};class oi extends b0{constructor(e,t,i={}){if(super(),!e)throw new Error("A non-empty playlist URL or object is required");this.logger_=Ge("PlaylistLoader");const{withCredentials:n=!1}=i;this.src=e,this.vhs_=t,this.withCredentials=n,this.addDateRangesToTextTrack_=i.addDateRangesToTextTrack;const r=t.options_;this.customTagParsers=r&&r.customTagParsers||[],this.customTagMappers=r&&r.customTagMappers||[],this.llhls=r&&r.llhls,this.dateRangesStorage_=new Pl,this.state="HAVE_NOTHING",this.handleMediaupdatetimeout_=this.handleMediaupdatetimeout_.bind(this),this.on("mediaupdatetimeout",this.handleMediaupdatetimeout_),this.on("loadedplaylist",this.handleLoadedPlaylist_.bind(this))}handleLoadedPlaylist_(){const e=this.media();if(!e)return;this.dateRangesStorage_.setOffset(e.segments),this.dateRangesStorage_.setPendingDateRanges(e.dateRanges);const t=this.dateRangesStorage_.getDateRangesToProcess();!t.length||!this.addDateRangesToTextTrack_||this.addDateRangesToTextTrack_(t)}handleMediaupdatetimeout_(){if(this.state!=="HAVE_METADATA")return;const e=this.media();let t=Oe(this.main.uri,e.uri);this.llhls&&(t=x0(t,e)),this.state="HAVE_CURRENT_METADATA",this.request=this.vhs_.xhr({uri:t,withCredentials:this.withCredentials,requestType:"hls-playlist"},(i,n)=>{if(this.request){if(i)return this.playlistRequestError(this.request,this.media(),"HAVE_METADATA");this.haveMetadata({playlistString:this.request.responseText,url:this.media().uri,id:this.media().id})}})}playlistRequestError(e,t,i){const{uri:n,id:r}=t;this.request=null,i&&(this.state=i),this.error={playlist:this.main.playlists[r],status:e.status,message:`HLS playlist request error at URL: ${n}.`,responseText:e.responseText,code:e.status>=500?4:2,metadata:Xt({requestType:e.requestType,request:e,error:e.error})},this.trigger("error")}parseManifest_({url:e,manifestString:t}){try{const i=m0({onwarn:({message:n})=>this.logger_(`m3u8-parser warn for ${e}: ${n}`),oninfo:({message:n})=>this.logger_(`m3u8-parser info for ${e}: ${n}`),manifestString:t,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers,llhls:this.llhls});return!i.playlists||!i.playlists.length||this.excludeAudioOnlyVariants(i.playlists),i}catch(i){this.error=i,this.error.metadata={errorType:k.Error.StreamingHlsPlaylistParserError,error:i}}}excludeAudioOnlyVariants(e){const t=i=>{const n=i.attributes||{},{width:r,height:a}=n.RESOLUTION||{};if(r&&a)return!0;const l=Qh(i)||[];return!!ms(l).video};e.some(t)&&e.forEach(i=>{t(i)||(i.excludeUntil=1/0)})}haveMetadata({playlistString:e,playlistObject:t,url:i,id:n}){this.request=null,this.state="HAVE_METADATA";const r={playlistInfo:{type:"media",uri:i}};this.trigger({type:"playlistparsestart",metadata:r});const a=t||this.parseManifest_({url:i,manifestString:e});a.lastRequest=Date.now(),Wh({playlist:a,uri:i,id:n});const l=Xr(this.main,a);this.targetDuration=a.partTargetDuration||a.targetDuration,this.pendingMedia_=null,l?(this.main=l,this.media_=this.main.playlists[n]):this.trigger("playlistunchanged"),this.updateMediaUpdateTimeout_(Yr(this.media(),!!l)),r.parsedPlaylist=Ll(this.main.playlists,r.playlistInfo.type,!this.media_.endList),this.trigger({type:"playlistparsecomplete",metadata:r}),this.trigger("loadedplaylist")}dispose(){this.trigger("dispose"),this.stopRequest(),x.clearTimeout(this.mediaUpdateTimeout),x.clearTimeout(this.finalRenditionTimeout),this.dateRangesStorage_=new Pl,this.off()}stopRequest(){if(this.request){const e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}media(e,t){if(!e)return this.media_;if(this.state==="HAVE_NOTHING")throw new Error("Cannot switch media playlist from "+this.state);if(typeof e=="string"){if(!this.main.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.main.playlists[e]}if(x.clearTimeout(this.finalRenditionTimeout),t){const l=(e.partTargetDuration||e.targetDuration)/2*1e3||5e3;this.finalRenditionTimeout=x.setTimeout(this.media.bind(this,e,!1),l);return}const i=this.state,n=!this.media_||e.id!==this.media_.id,r=this.main.playlists[e.id];if(r&&r.endList||e.endList&&e.segments.length){this.request&&(this.request.onreadystatechange=null,this.request.abort(),this.request=null),this.state="HAVE_METADATA",this.media_=e,n&&(this.trigger("mediachanging"),i==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange"));return}if(this.updateMediaUpdateTimeout_(Yr(e,!0)),!n)return;if(this.state="SWITCHING_MEDIA",this.request){if(e.resolvedUri===this.request.url)return;this.request.onreadystatechange=null,this.request.abort(),this.request=null}this.media_&&this.trigger("mediachanging"),this.pendingMedia_=e;const a={playlistInfo:{type:"media",uri:e.uri}};this.trigger({type:"playlistrequeststart",metadata:a}),this.request=this.vhs_.xhr({uri:e.resolvedUri,withCredentials:this.withCredentials,requestType:"hls-playlist"},(l,c)=>{if(this.request){if(e.lastRequest=Date.now(),e.resolvedUri=Sn(e.resolvedUri,c),l)return this.playlistRequestError(this.request,e,i);this.trigger({type:"playlistrequestcomplete",metadata:a}),this.haveMetadata({playlistString:c.responseText,url:e.uri,id:e.id}),i==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange")}})}pause(){this.mediaUpdateTimeout&&(x.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.stopRequest(),this.state==="HAVE_NOTHING"&&(this.started=!1),this.state==="SWITCHING_MEDIA"?this.media_?this.state="HAVE_METADATA":this.state="HAVE_MAIN_MANIFEST":this.state==="HAVE_CURRENT_METADATA"&&(this.state="HAVE_METADATA")}load(e){this.mediaUpdateTimeout&&(x.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);const t=this.media();if(e){const i=t?(t.partTargetDuration||t.targetDuration)/2*1e3:5e3;this.mediaUpdateTimeout=x.setTimeout(()=>{this.mediaUpdateTimeout=null,this.load()},i);return}if(!this.started){this.start();return}t&&!t.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist")}updateMediaUpdateTimeout_(e){this.mediaUpdateTimeout&&(x.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),!(!this.media()||this.media().endList)&&(this.mediaUpdateTimeout=x.setTimeout(()=>{this.mediaUpdateTimeout=null,this.trigger("mediaupdatetimeout"),this.updateMediaUpdateTimeout_(e)},e))}start(){if(this.started=!0,typeof this.src=="object"){this.src.uri||(this.src.uri=x.location.href),this.src.resolvedUri=this.src.uri,setTimeout(()=>{this.setupInitialPlaylist(this.src)},0);return}const e={playlistInfo:{type:"multivariant",uri:this.src}};this.trigger({type:"playlistrequeststart",metadata:e}),this.request=this.vhs_.xhr({uri:this.src,withCredentials:this.withCredentials,requestType:"hls-playlist"},(t,i)=>{if(!this.request)return;if(this.request=null,t)return this.error={status:i.status,message:`HLS playlist request error at URL: ${this.src}.`,responseText:i.responseText,code:2,metadata:Xt({requestType:i.requestType,request:i,error:t})},this.state==="HAVE_NOTHING"&&(this.started=!1),this.trigger("error");this.trigger({type:"playlistrequestcomplete",metadata:e}),this.src=Sn(this.src,i),this.trigger({type:"playlistparsestart",metadata:e});const n=this.parseManifest_({manifestString:i.responseText,url:this.src});e.parsedPlaylist=Ll(n.playlists,e.playlistInfo.type,!1),this.trigger({type:"playlistparsecomplete",metadata:e}),this.setupInitialPlaylist(n)})}srcUri(){return typeof this.src=="string"?this.src:this.src.uri}setupInitialPlaylist(e){if(this.state="HAVE_MAIN_MANIFEST",e.playlists){this.main=e,Gh(this.main,this.srcUri()),e.playlists.forEach(i=>{i.segments=Jh(i),i.segments.forEach(n=>{Yh(n,i.resolvedUri)})}),this.trigger("loadedplaylist"),this.request||this.media(this.main.playlists[0]);return}const t=this.srcUri()||x.location.href;this.main=y0(e,t),this.haveMetadata({playlistObject:e,url:t,id:this.main.playlists[0].id}),this.trigger("loadedmetadata")}updateOrDeleteClone(e,t){const i=this.main,n=e.ID;let r=i.playlists.length;for(;r--;){const a=i.playlists[r];if(a.attributes["PATHWAY-ID"]===n){const l=a.resolvedUri,c=a.id;if(t){const p=this.createCloneURI_(a.resolvedUri,e),g=ci(n,p),_=this.createCloneAttributes_(n,a.attributes),S=this.createClonePlaylist_(a,g,e,_);i.playlists[r]=S,i.playlists[g]=S,i.playlists[p]=S}else i.playlists.splice(r,1);delete i.playlists[c],delete i.playlists[l]}}this.updateOrDeleteCloneMedia(e,t)}updateOrDeleteCloneMedia(e,t){const i=this.main,n=e.ID;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(r=>{if(!(!i.mediaGroups[r]||!i.mediaGroups[r][n])){for(const a in i.mediaGroups[r])if(a===n){for(const l in i.mediaGroups[r][a])i.mediaGroups[r][a][l].playlists.forEach((p,g)=>{const _=i.playlists[p.id],S=_.id,E=_.resolvedUri;delete i.playlists[S],delete i.playlists[E]});delete i.mediaGroups[r][a]}}}),t&&this.createClonedMediaGroups_(e)}addClonePathway(e,t={}){const i=this.main,n=i.playlists.length,r=this.createCloneURI_(t.resolvedUri,e),a=ci(e.ID,r),l=this.createCloneAttributes_(e.ID,t.attributes),c=this.createClonePlaylist_(t,a,e,l);i.playlists[n]=c,i.playlists[a]=c,i.playlists[r]=c,this.createClonedMediaGroups_(e)}createClonedMediaGroups_(e){const t=e.ID,i=e["BASE-ID"],n=this.main;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(r=>{if(!(!n.mediaGroups[r]||n.mediaGroups[r][t]))for(const a in n.mediaGroups[r]){if(a===i)n.mediaGroups[r][t]={};else continue;for(const l in n.mediaGroups[r][a]){const c=n.mediaGroups[r][a][l];n.mediaGroups[r][t][l]=ve({},c);const p=n.mediaGroups[r][t][l],g=this.createCloneURI_(c.resolvedUri,e);p.resolvedUri=g,p.uri=g,p.playlists=[],c.playlists.forEach((_,S)=>{const E=n.playlists[_.id],w=zh(r,t,l),I=ci(t,w);if(E&&!n.playlists[I]){const L=this.createClonePlaylist_(E,I,e),P=L.resolvedUri;n.playlists[I]=L,n.playlists[P]=L}p.playlists[S]=this.createClonePlaylist_(_,I,e)})}}})}createClonePlaylist_(e,t,i,n){const r=this.createCloneURI_(e.resolvedUri,i),a={resolvedUri:r,uri:r,id:t};return e.segments&&(a.segments=[]),n&&(a.attributes=n),Z(e,a)}createCloneURI_(e,t){const i=new URL(e);i.hostname=t["URI-REPLACEMENT"].HOST;const n=t["URI-REPLACEMENT"].PARAMS;for(const r of Object.keys(n))i.searchParams.set(r,n[r]);return i.href}createCloneAttributes_(e,t){const i={"PATHWAY-ID":e};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(n=>{t[n]&&(i[n]=e)}),i}getKeyIdSet(e){const t=new Set;if(!e||!e.contentProtection)return t;for(const i in e.contentProtection)if(e.contentProtection[i]&&e.contentProtection[i].attributes&&e.contentProtection[i].attributes.keyId){const n=e.contentProtection[i].attributes.keyId;t.add(n.toLowerCase())}return t}}const Jr=function(s,e,t,i){const n=s.responseType==="arraybuffer"?s.response:s.responseText;!e&&n&&(s.responseTime=Date.now(),s.roundTripTime=s.responseTime-s.requestTime,s.bytesReceived=n.byteLength||n.length,s.bandwidth||(s.bandwidth=Math.floor(s.bytesReceived/s.roundTripTime*8*1e3))),t.headers&&(s.responseHeaders=t.headers),e&&e.code==="ETIMEDOUT"&&(s.timedout=!0),!e&&!s.aborted&&t.statusCode!==200&&t.statusCode!==206&&t.statusCode!==0&&(e=new Error("XHR Failed with a response of: "+(s&&(n||s.responseText)))),i(e,s)},E0=(s,e)=>{if(!s||!s.size)return;let t=e;return s.forEach(i=>{t=i(t)}),t},w0=(s,e,t,i)=>{!s||!s.size||s.forEach(n=>{n(e,t,i)})},ed=function(){const s=function e(t,i){t=Z({timeout:45e3},t);const n=e.beforeRequest||k.Vhs.xhr.beforeRequest,r=e._requestCallbackSet||k.Vhs.xhr._requestCallbackSet||new Set,a=e._responseCallbackSet||k.Vhs.xhr._responseCallbackSet;n&&typeof n=="function"&&(k.log.warn("beforeRequest is deprecated, use onRequest instead."),r.add(n));const l=k.Vhs.xhr.original===!0?k.xhr:k.Vhs.xhr,c=E0(r,t);r.delete(n);const p=l(c||t,function(_,S){return w0(a,p,_,S),Jr(p,_,S,i)}),g=p.abort;return p.abort=function(){return p.aborted=!0,g.apply(p,arguments)},p.uri=t.uri,p.requestType=t.requestType,p.requestTime=Date.now(),p};return s.original=!0,s},k0=function(s){let e;const t=s.offset;return typeof s.offset=="bigint"||typeof s.length=="bigint"?e=x.BigInt(s.offset)+x.BigInt(s.length)-x.BigInt(1):e=s.offset+s.length-1,"bytes="+t+"-"+e},Zr=function(s){const e={};return s.byterange&&(e.Range=k0(s.byterange)),e},I0=function(s,e){return s.start(e)+"-"+s.end(e)},P0=function(s,e){const t=s.toString(16);return"00".substring(0,2-t.length)+t+(e%2?" ":"")},A0=function(s){return s>=32&&s<126?String.fromCharCode(s):"."},td=function(s){const e={};return Object.keys(s).forEach(t=>{const i=s[t];hu(i)?e[t]={bytes:i.buffer,byteOffset:i.byteOffset,byteLength:i.byteLength}:e[t]=i}),e},Cn=function(s){const e=s.byterange||{length:1/0,offset:0};return[e.length,e.offset,s.resolvedUri].join(",")},id=function(s){return s.resolvedUri},sd=s=>{const e=Array.prototype.slice.call(s),t=16;let i="",n,r;for(let a=0;a<e.length/t;a++)n=e.slice(a*t,a*t+t).map(P0).join(""),r=e.slice(a*t,a*t+t).map(A0).join(""),i+=n+" "+r+`
|
|
192
|
-
`;return i},L0=({bytes:s})=>sd(s),D0=s=>{let e="",t;for(t=0;t<s.length;t++)e+=I0(s,t)+" ";return e};var O0=Object.freeze({__proto__:null,createTransferableMessage:td,initSegmentId:Cn,segmentKeyId:id,hexDump:sd,tagDump:L0,textRanges:D0});const nd=.25,M0=(s,e)=>{if(!e.dateTimeObject)return null;const t=e.videoTimingInfo.transmuxerPrependedSeconds,n=e.videoTimingInfo.transmuxedPresentationStart+t,r=s-n;return new Date(e.dateTimeObject.getTime()+r*1e3)},R0=s=>s.transmuxedPresentationEnd-s.transmuxedPresentationStart-s.transmuxerPrependedSeconds,B0=(s,e)=>{let t;try{t=new Date(s)}catch{return null}if(!e||!e.segments||e.segments.length===0)return null;let i=e.segments[0];if(t<new Date(i.dateTimeObject))return null;for(let c=0;c<e.segments.length-1;c++){i=e.segments[c];const p=new Date(e.segments[c+1].dateTimeObject);if(t<p)break}const n=e.segments[e.segments.length-1],r=n.dateTimeObject,a=n.videoTimingInfo?R0(n.videoTimingInfo):n.duration+n.duration*nd,l=new Date(r.getTime()+a*1e3);return t>l?null:(t>new Date(r)&&(i=n),{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:Me.duration(e,e.mediaSequence+e.segments.indexOf(i)),type:i.videoTimingInfo?"accurate":"estimate"})},F0=(s,e)=>{if(!e||!e.segments||e.segments.length===0)return null;let t=0,i;for(let r=0;r<e.segments.length&&(i=e.segments[r],t=i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationEnd:t+i.duration,!(s<=t));r++);const n=e.segments[e.segments.length-1];if(n.videoTimingInfo&&n.videoTimingInfo.transmuxedPresentationEnd<s)return null;if(s>t){if(s>t+n.duration*nd)return null;i=n}return{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:t-i.duration,type:i.videoTimingInfo?"accurate":"estimate"}},N0=(s,e)=>{let t,i;try{t=new Date(s),i=new Date(e)}catch{}const n=t.getTime();return(i.getTime()-n)/1e3},U0=s=>{if(!s.segments||s.segments.length===0)return!1;for(let e=0;e<s.segments.length;e++)if(!s.segments[e].dateTimeObject)return!1;return!0},j0=({playlist:s,time:e=void 0,callback:t})=>{if(!t)throw new Error("getProgramTime: callback must be provided");if(!s||e===void 0)return t({message:"getProgramTime: playlist and time must be provided"});const i=F0(e,s);if(!i)return t({message:"valid programTime was not found"});if(i.type==="estimate")return t({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:i.estimatedStart});const n={mediaSeconds:e},r=M0(e,i.segment);return r&&(n.programDateTime=r.toISOString()),t(null,n)},rd=({programTime:s,playlist:e,retryCount:t=2,seekTo:i,pauseAfterSeek:n=!0,tech:r,callback:a})=>{if(!a)throw new Error("seekToProgramTime: callback must be provided");if(typeof s>"u"||!e||!i)return a({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"});if(!e.endList&&!r.hasStarted_)return a({message:"player must be playing a live stream to start buffering"});if(!U0(e))return a({message:"programDateTime tags must be provided in the manifest "+e.resolvedUri});const l=B0(s,e);if(!l)return a({message:`${s} was not found in the stream`});const c=l.segment,p=N0(c.dateTimeObject,s);if(l.type==="estimate"){if(t===0)return a({message:`${s} is not buffered yet. Try again`});i(l.estimatedStart+p),r.one("seeked",()=>{rd({programTime:s,playlist:e,retryCount:t-1,seekTo:i,pauseAfterSeek:n,tech:r,callback:a})});return}const g=c.start+p,_=()=>a(null,r.currentTime());r.one("seeked",_),n&&r.pause(),i(g)},Ar=(s,e)=>{if(s.readyState===4)return e()},$0=(s,e,t,i)=>{let n=[],r,a=!1;const l=function(_,S,E,w){return S.abort(),a=!0,t(_,S,E,w)},c=function(_,S){if(a)return;if(_)return _.metadata=Xt({requestType:i,request:S,error:_}),l(_,S,"",n);const E=S.responseText.substring(n&&n.byteLength||0,S.responseText.length);if(n=cm(n,du(E,!0)),r=r||is(n),n.length<10||r&&n.length<r+2)return Ar(S,()=>l(_,S,"",n));const w=ha(n);return w==="ts"&&n.length<188?Ar(S,()=>l(_,S,"",n)):!w&&n.length<376?Ar(S,()=>l(_,S,"",n)):l(null,S,w,n)},g=e({uri:s,beforeSend(_){_.overrideMimeType("text/plain; charset=x-user-defined"),_.addEventListener("progress",function({total:S,loaded:E}){return Jr(_,null,{statusCode:_.status},c)})}},function(_,S){return Jr(g,_,S,c)});return g},{EventTarget:H0}=k,Dl=function(s,e){if(!Zh(s,e)||s.sidx&&e.sidx&&(s.sidx.offset!==e.sidx.offset||s.sidx.length!==e.sidx.length))return!1;if(!s.sidx&&e.sidx||s.sidx&&!e.sidx||s.segments&&!e.segments||!s.segments&&e.segments)return!1;if(!s.segments&&!e.segments)return!0;for(let t=0;t<s.segments.length;t++){const i=s.segments[t],n=e.segments[t];if(i.uri!==n.uri)return!1;if(!i.byterange&&!n.byterange)continue;const r=i.byterange,a=n.byterange;if(r&&!a||!r&&a||r.offset!==a.offset||r.length!==a.length)return!1}return!0},V0=(s,e,t,i)=>{const n=i.attributes.NAME||t;return`placeholder-uri-${s}-${e}-${n}`},q0=({mainXml:s,srcUrl:e,clientOffset:t,sidxMapping:i,previousManifest:n})=>{const r=Pt.parse(s,{manifestUri:e,clientOffset:t,sidxMapping:i,previousManifest:n});return Gh(r,e,V0),r},z0=(s,e)=>{Di(s,(t,i,n,r)=>{(!e.mediaGroups[i][n]||!(r in e.mediaGroups[i][n]))&&delete s.mediaGroups[i][n][r]})},W0=(s,e,t)=>{let i=!0,n=Z(s,{duration:e.duration,minimumUpdatePeriod:e.minimumUpdatePeriod,timelineStarts:e.timelineStarts});for(let r=0;r<e.playlists.length;r++){const a=e.playlists[r];if(a.sidx){const c=Pt.generateSidxKey(a.sidx);t&&t[c]&&t[c].sidx&&Pt.addSidxSegmentsToPlaylist$1(a,t[c].sidx,a.sidx.resolvedUri)}const l=Xr(n,a,Dl);l&&(n=l,i=!1)}return Di(e,(r,a,l,c)=>{if(r.playlists&&r.playlists.length){const p=r.playlists[0].id,g=Xr(n,r.playlists[0],Dl);g&&(n=g,c in n.mediaGroups[a][l]||(n.mediaGroups[a][l][c]=r),n.mediaGroups[a][l][c].playlists[0]=n.playlists[p],i=!1)}}),z0(n,e),e.minimumUpdatePeriod!==s.minimumUpdatePeriod&&(i=!1),i?null:n},G0=(s,e)=>(!s.map&&!e.map||!!(s.map&&e.map&&s.map.byterange.offset===e.map.byterange.offset&&s.map.byterange.length===e.map.byterange.length))&&s.uri===e.uri&&s.byterange.offset===e.byterange.offset&&s.byterange.length===e.byterange.length,Ol=(s,e)=>{const t={};for(const i in s){const r=s[i].sidx;if(r){const a=Pt.generateSidxKey(r);if(!e[a])break;const l=e[a].sidxInfo;G0(l,r)&&(t[a]=e[a])}}return t},K0=(s,e)=>{let i=Ol(s.playlists,e);return Di(s,(n,r,a,l)=>{if(n.playlists&&n.playlists.length){const c=n.playlists;i=Z(i,Ol(c,e))}}),i};class ea extends H0{constructor(e,t,i={},n){super(),this.isPaused_=!0,this.mainPlaylistLoader_=n||this,n||(this.isMain_=!0);const{withCredentials:r=!1}=i;if(this.vhs_=t,this.withCredentials=r,this.addMetadataToTextTrack=i.addMetadataToTextTrack,!e)throw new Error("A non-empty playlist URL or object is required");this.on("minimumUpdatePeriod",()=>{this.refreshXml_()}),this.on("mediaupdatetimeout",()=>{this.refreshMedia_(this.media().id)}),this.state="HAVE_NOTHING",this.loadedPlaylists_={},this.logger_=Ge("DashPlaylistLoader"),this.isMain_?(this.mainPlaylistLoader_.srcUrl=e,this.mainPlaylistLoader_.sidxMapping_={}):this.childPlaylist_=e}get isPaused(){return this.isPaused_}requestErrored_(e,t,i){if(!this.request)return!0;if(this.request=null,e)return this.error=typeof e=="object"&&!(e instanceof Error)?e:{status:t.status,message:"DASH request error at URL: "+t.uri,response:t.response,code:2,metadata:e.metadata},i&&(this.state=i),this.trigger("error"),!0}addSidxSegments_(e,t,i){const n=e.sidx&&Pt.generateSidxKey(e.sidx);if(!e.sidx||!n||this.mainPlaylistLoader_.sidxMapping_[n]){x.clearTimeout(this.mediaRequest_),this.mediaRequest_=x.setTimeout(()=>i(!1),0);return}const r=Sn(e.sidx.resolvedUri),a=(c,p)=>{if(this.requestErrored_(c,p,t))return;const g=this.mainPlaylistLoader_.sidxMapping_,{requestType:_}=p;let S;try{S=ym(W(p.response).subarray(8))}catch(E){E.metadata=Xt({requestType:_,request:p,parseFailure:!0}),this.requestErrored_(E,p,t);return}return g[n]={sidxInfo:e.sidx,sidx:S},Pt.addSidxSegmentsToPlaylist$1(e,S,e.sidx.resolvedUri),i(!0)},l="dash-sidx";this.request=$0(r,this.vhs_.xhr,(c,p,g,_)=>{if(c)return a(c,p);if(!g||g!=="mp4"){const w=g||"unknown";return a({status:p.status,message:`Unsupported ${w} container type for sidx segment at URL: ${r}`,response:"",playlist:e,internal:!0,playlistExclusionDuration:1/0,code:2},p)}const{offset:S,length:E}=e.sidx.byterange;if(_.length>=E+S)return a(c,{response:_.subarray(S,S+E),status:p.status,uri:p.uri});this.request=this.vhs_.xhr({uri:r,responseType:"arraybuffer",requestType:"dash-sidx",headers:Zr({byterange:e.sidx.byterange})},a)},l)}dispose(){this.isPaused_=!0,this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},x.clearTimeout(this.minimumUpdatePeriodTimeout_),x.clearTimeout(this.mediaRequest_),x.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.mediaRequest_=null,this.minimumUpdatePeriodTimeout_=null,this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.off()}hasPendingRequest(){return this.request||this.mediaRequest_}stopRequest(){if(this.request){const e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}media(e){if(!e)return this.media_;if(this.state==="HAVE_NOTHING")throw new Error("Cannot switch media playlist from "+this.state);const t=this.state;if(typeof e=="string"){if(!this.mainPlaylistLoader_.main.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.mainPlaylistLoader_.main.playlists[e]}const i=!this.media_||e.id!==this.media_.id;if(i&&this.loadedPlaylists_[e.id]&&this.loadedPlaylists_[e.id].endList){this.state="HAVE_METADATA",this.media_=e,i&&(this.trigger("mediachanging"),this.trigger("mediachange"));return}i&&(this.media_&&this.trigger("mediachanging"),this.addSidxSegments_(e,t,n=>{this.haveMetadata({startingState:t,playlist:e})}))}haveMetadata({startingState:e,playlist:t}){this.state="HAVE_METADATA",this.loadedPlaylists_[t.id]=t,x.clearTimeout(this.mediaRequest_),this.mediaRequest_=null,this.refreshMedia_(t.id),e==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange")}pause(){this.isPaused_=!0,this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.stopRequest(),x.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMain_&&(x.clearTimeout(this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_),this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_=null),this.state==="HAVE_NOTHING"&&(this.started=!1)}load(e){this.isPaused_=!1,x.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;const t=this.media();if(e){const i=t?t.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=x.setTimeout(()=>this.load(),i);return}if(!this.started){this.start();return}t&&!t.endList?(this.isMain_&&!this.minimumUpdatePeriodTimeout_&&(this.trigger("minimumUpdatePeriod"),this.updateMinimumUpdatePeriodTimeout_()),this.trigger("mediaupdatetimeout")):this.trigger("loadedplaylist")}start(){if(this.started=!0,!this.isMain_){x.clearTimeout(this.mediaRequest_),this.mediaRequest_=x.setTimeout(()=>this.haveMain_(),0);return}this.requestMain_((e,t)=>{this.haveMain_(),!this.hasPendingRequest()&&!this.media_&&this.media(this.mainPlaylistLoader_.main.playlists[0])})}requestMain_(e){const t={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestrequeststart",metadata:t}),this.request=this.vhs_.xhr({uri:this.mainPlaylistLoader_.srcUrl,withCredentials:this.withCredentials,requestType:"dash-manifest"},(i,n)=>{if(i){const{requestType:a}=n;i.metadata=Xt({requestType:a,request:n,error:i})}if(this.requestErrored_(i,n)){this.state==="HAVE_NOTHING"&&(this.started=!1);return}this.trigger({type:"manifestrequestcomplete",metadata:t});const r=n.responseText!==this.mainPlaylistLoader_.mainXml_;if(this.mainPlaylistLoader_.mainXml_=n.responseText,n.responseHeaders&&n.responseHeaders.date?this.mainLoaded_=Date.parse(n.responseHeaders.date):this.mainLoaded_=Date.now(),this.mainPlaylistLoader_.srcUrl=Sn(this.mainPlaylistLoader_.srcUrl,n),r){this.handleMain_(),this.syncClientServerClock_(()=>e(n,r));return}return e(n,r)})}syncClientServerClock_(e){const t=Pt.parseUTCTiming(this.mainPlaylistLoader_.mainXml_);if(t===null)return this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e();if(t.method==="DIRECT")return this.mainPlaylistLoader_.clientOffset_=t.value-Date.now(),e();this.request=this.vhs_.xhr({uri:Oe(this.mainPlaylistLoader_.srcUrl,t.value),method:t.method,withCredentials:this.withCredentials,requestType:"dash-clock-sync"},(i,n)=>{if(!this.request)return;if(i){const{requestType:a}=n;return this.error.metadata=Xt({requestType:a,request:n,error:i}),this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e()}let r;t.method==="HEAD"?!n.responseHeaders||!n.responseHeaders.date?r=this.mainLoaded_:r=Date.parse(n.responseHeaders.date):r=Date.parse(n.responseText),this.mainPlaylistLoader_.clientOffset_=r-Date.now(),e()})}haveMain_(){this.state="HAVE_MAIN_MANIFEST",this.isMain_?this.trigger("loadedplaylist"):this.media_||this.media(this.childPlaylist_)}handleMain_(){x.clearTimeout(this.mediaRequest_),this.mediaRequest_=null;const e=this.mainPlaylistLoader_.main,t={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestparsestart",metadata:t});let i;try{i=q0({mainXml:this.mainPlaylistLoader_.mainXml_,srcUrl:this.mainPlaylistLoader_.srcUrl,clientOffset:this.mainPlaylistLoader_.clientOffset_,sidxMapping:this.mainPlaylistLoader_.sidxMapping_,previousManifest:e})}catch(r){this.error=r,this.error.metadata={errorType:k.Error.StreamingDashManifestParserError,error:r},this.trigger("error")}e&&(i=W0(e,i,this.mainPlaylistLoader_.sidxMapping_)),this.mainPlaylistLoader_.main=i||e;const n=this.mainPlaylistLoader_.main.locations&&this.mainPlaylistLoader_.main.locations[0];if(n&&n!==this.mainPlaylistLoader_.srcUrl&&(this.mainPlaylistLoader_.srcUrl=n),(!e||i&&i.minimumUpdatePeriod!==e.minimumUpdatePeriod)&&this.updateMinimumUpdatePeriodTimeout_(),this.addEventStreamToMetadataTrack_(i),i){const{duration:r,endList:a}=i,l=[];i.playlists.forEach(p=>{l.push({id:p.id,bandwidth:p.attributes.BANDWIDTH,resolution:p.attributes.RESOLUTION,codecs:p.attributes.CODECS})});const c={duration:r,isLive:!a,renditions:l};t.parsedManifest=c,this.trigger({type:"manifestparsecomplete",metadata:t})}return!!i}updateMinimumUpdatePeriodTimeout_(){const e=this.mainPlaylistLoader_;e.createMupOnMedia_&&(e.off("loadedmetadata",e.createMupOnMedia_),e.createMupOnMedia_=null),e.minimumUpdatePeriodTimeout_&&(x.clearTimeout(e.minimumUpdatePeriodTimeout_),e.minimumUpdatePeriodTimeout_=null);let t=e.main&&e.main.minimumUpdatePeriod;if(t===0&&(e.media()?t=e.media().targetDuration*1e3:(e.createMupOnMedia_=e.updateMinimumUpdatePeriodTimeout_,e.one("loadedmetadata",e.createMupOnMedia_))),typeof t!="number"||t<=0){t<0&&this.logger_(`found invalid minimumUpdatePeriod of ${t}, not setting a timeout`);return}this.createMUPTimeout_(t)}createMUPTimeout_(e){const t=this.mainPlaylistLoader_;t.minimumUpdatePeriodTimeout_=x.setTimeout(()=>{t.minimumUpdatePeriodTimeout_=null,t.trigger("minimumUpdatePeriod"),t.createMUPTimeout_(e)},e)}refreshXml_(){this.requestMain_((e,t)=>{t&&(this.media_&&(this.media_=this.mainPlaylistLoader_.main.playlists[this.media_.id]),this.mainPlaylistLoader_.sidxMapping_=K0(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.sidxMapping_),this.addSidxSegments_(this.media(),this.state,i=>{this.refreshMedia_(this.media().id)}))})}refreshMedia_(e){if(!e)throw new Error("refreshMedia_ must take a media id");this.media_&&this.isMain_&&this.handleMain_();const t=this.mainPlaylistLoader_.main.playlists,i=!this.media_||this.media_!==t[e];if(i?this.media_=t[e]:this.trigger("playlistunchanged"),!this.mediaUpdateTimeout){const n=()=>{this.media().endList||(this.mediaUpdateTimeout=x.setTimeout(()=>{this.trigger("mediaupdatetimeout"),n()},Yr(this.media(),!!i)))};n()}this.trigger("loadedplaylist")}addEventStreamToMetadataTrack_(e){if(e&&this.mainPlaylistLoader_.main.eventStream){const t=this.mainPlaylistLoader_.main.eventStream.map(i=>({cueTime:i.start,frames:[{data:i.messageData}]}));this.addMetadataToTextTrack("EventStream",t,this.mainPlaylistLoader_.main.duration)}}getKeyIdSet(e){if(e.contentProtection){const t=new Set;for(const i in e.contentProtection){const n=e.contentProtection[i].attributes["cenc:default_KID"];n&&t.add(n.replace(/-/g,"").toLowerCase())}return t}}}var Te={GOAL_BUFFER_LENGTH:30,MAX_GOAL_BUFFER_LENGTH:60,BACK_BUFFER_LENGTH:30,GOAL_BUFFER_LENGTH_RATE:1,INITIAL_BANDWIDTH:4194304,BANDWIDTH_VARIANCE:1.2,BUFFER_LOW_WATER_LINE:0,MAX_BUFFER_LOW_WATER_LINE:30,EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:16,BUFFER_LOW_WATER_LINE_RATE:1,BUFFER_HIGH_WATER_LINE:30};const Q0=s=>{const e=new Uint8Array(new ArrayBuffer(s.length));for(let t=0;t<s.length;t++)e[t]=s.charCodeAt(t);return e.buffer},ad=function(s){return s.on=s.addEventListener,s.off=s.removeEventListener,s},X0=function(s){try{return URL.createObjectURL(new Blob([s],{type:"application/javascript"}))}catch{const t=new BlobBuilder;return t.append(s),URL.createObjectURL(t.getBlob())}},od=function(s){return function(){const e=X0(s),t=ad(new Worker(e));t.objURL=e;const i=t.terminate;return t.on=t.addEventListener,t.off=t.removeEventListener,t.terminate=function(){return URL.revokeObjectURL(e),i.call(this)},t}},ld=function(s){return`var browserWorkerPolyFill = ${ad.toString()};
|
|
193
|
-
browserWorkerPolyFill(self);
|
|
194
|
-
`+s},ud=function(s){return s.toString().replace(/^function.+?{/,"").slice(0,-1)},Y0=ld(ud(function(){var s=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},e=function(){this.init=function(){var o={};this.on=function(u,d){o[u]||(o[u]=[]),o[u]=o[u].concat(d)},this.off=function(u,d){var h;return o[u]?(h=o[u].indexOf(d),o[u]=o[u].slice(),o[u].splice(h,1),h>-1):!1},this.trigger=function(u){var d,h,f,m;if(d=o[u],!!d)if(arguments.length===2)for(f=d.length,h=0;h<f;++h)d[h].call(this,arguments[1]);else{for(m=[],h=arguments.length,h=1;h<arguments.length;++h)m.push(arguments[h]);for(f=d.length,h=0;h<f;++h)d[h].apply(this,m)}},this.dispose=function(){o={}}}};e.prototype.pipe=function(o){return this.on("data",function(u){o.push(u)}),this.on("done",function(u){o.flush(u)}),this.on("partialdone",function(u){o.partialFlush(u)}),this.on("endedtimeline",function(u){o.endTimeline(u)}),this.on("reset",function(u){o.reset(u)}),o},e.prototype.push=function(o){this.trigger("data",o)},e.prototype.flush=function(o){this.trigger("done",o)},e.prototype.partialFlush=function(o){this.trigger("partialdone",o)},e.prototype.endTimeline=function(o){this.trigger("endedtimeline",o)},e.prototype.reset=function(o){this.trigger("reset",o)};var t=e,i=Math.pow(2,32),n=function(o){var u=new DataView(o.buffer,o.byteOffset,o.byteLength),d;return u.getBigUint64?(d=u.getBigUint64(0),d<Number.MAX_SAFE_INTEGER?Number(d):d):u.getUint32(0)*i+u.getUint32(4)},r={getUint64:n,MAX_UINT32:i},a=r.MAX_UINT32,l,c,p,g,_,S,E,w,I,L,P,F,$,B,O,j,R,U,Y,le,_e,ue,q,ee,He,dt,Tt,Ot,Mt,Rt,Bt,Ft,bs,Va,qa,za;(function(){var o;if(q={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],pasp:[],sdtp:[],smhd:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],styp:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[]},!(typeof Uint8Array>"u")){for(o in q)q.hasOwnProperty(o)&&(q[o]=[o.charCodeAt(0),o.charCodeAt(1),o.charCodeAt(2),o.charCodeAt(3)]);ee=new Uint8Array([105,115,111,109]),dt=new Uint8Array([97,118,99,49]),He=new Uint8Array([0,0,0,1]),Tt=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]),Ot=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]),Mt={video:Tt,audio:Ot},Ft=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),Bt=new Uint8Array([0,0,0,0,0,0,0,0]),bs=new Uint8Array([0,0,0,0,0,0,0,0]),Va=bs,qa=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),za=bs,Rt=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}})(),l=function(o){var u=[],d=0,h,f,m;for(h=1;h<arguments.length;h++)u.push(arguments[h]);for(h=u.length;h--;)d+=u[h].byteLength;for(f=new Uint8Array(d+8),m=new DataView(f.buffer,f.byteOffset,f.byteLength),m.setUint32(0,f.byteLength),f.set(o,4),h=0,d=8;h<u.length;h++)f.set(u[h],d),d+=u[h].byteLength;return f},c=function(){return l(q.dinf,l(q.dref,Ft))},p=function(o){return l(q.esds,new Uint8Array([0,0,0,0,3,25,0,0,0,4,17,64,21,0,6,0,0,0,218,192,0,0,218,192,5,2,o.audioobjecttype<<3|o.samplingfrequencyindex>>>1,o.samplingfrequencyindex<<7|o.channelcount<<3,6,1,2]))},g=function(){return l(q.ftyp,ee,He,ee,dt)},j=function(o){return l(q.hdlr,Mt[o])},_=function(o){return l(q.mdat,o)},O=function(o){var u=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,o.duration>>>24&255,o.duration>>>16&255,o.duration>>>8&255,o.duration&255,85,196,0,0]);return o.samplerate&&(u[12]=o.samplerate>>>24&255,u[13]=o.samplerate>>>16&255,u[14]=o.samplerate>>>8&255,u[15]=o.samplerate&255),l(q.mdhd,u)},B=function(o){return l(q.mdia,O(o),j(o.type),E(o))},S=function(o){return l(q.mfhd,new Uint8Array([0,0,0,0,(o&4278190080)>>24,(o&16711680)>>16,(o&65280)>>8,o&255]))},E=function(o){return l(q.minf,o.type==="video"?l(q.vmhd,Rt):l(q.smhd,Bt),c(),U(o))},w=function(o,u){for(var d=[],h=u.length;h--;)d[h]=le(u[h]);return l.apply(null,[q.moof,S(o)].concat(d))},I=function(o){for(var u=o.length,d=[];u--;)d[u]=F(o[u]);return l.apply(null,[q.moov,P(4294967295)].concat(d).concat(L(o)))},L=function(o){for(var u=o.length,d=[];u--;)d[u]=_e(o[u]);return l.apply(null,[q.mvex].concat(d))},P=function(o){var u=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(o&4278190080)>>24,(o&16711680)>>16,(o&65280)>>8,o&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return l(q.mvhd,u)},R=function(o){var u=o.samples||[],d=new Uint8Array(4+u.length),h,f;for(f=0;f<u.length;f++)h=u[f].flags,d[f+4]=h.dependsOn<<4|h.isDependedOn<<2|h.hasRedundancy;return l(q.sdtp,d)},U=function(o){return l(q.stbl,Y(o),l(q.stts,za),l(q.stsc,Va),l(q.stsz,qa),l(q.stco,bs))},function(){var o,u;Y=function(d){return l(q.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),d.type==="video"?o(d):u(d))},o=function(d){var h=d.sps||[],f=d.pps||[],m=[],y=[],T,v;for(T=0;T<h.length;T++)m.push((h[T].byteLength&65280)>>>8),m.push(h[T].byteLength&255),m=m.concat(Array.prototype.slice.call(h[T]));for(T=0;T<f.length;T++)y.push((f[T].byteLength&65280)>>>8),y.push(f[T].byteLength&255),y=y.concat(Array.prototype.slice.call(f[T]));if(v=[q.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,(d.width&65280)>>8,d.width&255,(d.height&65280)>>8,d.height&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),l(q.avcC,new Uint8Array([1,d.profileIdc,d.profileCompatibility,d.levelIdc,255].concat([h.length],m,[f.length],y))),l(q.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],d.sarRatio){var b=d.sarRatio[0],C=d.sarRatio[1];v.push(l(q.pasp,new Uint8Array([(b&4278190080)>>24,(b&16711680)>>16,(b&65280)>>8,b&255,(C&4278190080)>>24,(C&16711680)>>16,(C&65280)>>8,C&255])))}return l.apply(null,v)},u=function(d){return l(q.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(d.channelcount&65280)>>8,d.channelcount&255,(d.samplesize&65280)>>8,d.samplesize&255,0,0,0,0,(d.samplerate&65280)>>8,d.samplerate&255,0,0]),p(d))}}(),$=function(o){var u=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(o.id&4278190080)>>24,(o.id&16711680)>>16,(o.id&65280)>>8,o.id&255,0,0,0,0,(o.duration&4278190080)>>24,(o.duration&16711680)>>16,(o.duration&65280)>>8,o.duration&255,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,(o.width&65280)>>8,o.width&255,0,0,(o.height&65280)>>8,o.height&255,0,0]);return l(q.tkhd,u)},le=function(o){var u,d,h,f,m,y,T;return u=l(q.tfhd,new Uint8Array([0,0,0,58,(o.id&4278190080)>>24,(o.id&16711680)>>16,(o.id&65280)>>8,o.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),y=Math.floor(o.baseMediaDecodeTime/a),T=Math.floor(o.baseMediaDecodeTime%a),d=l(q.tfdt,new Uint8Array([1,0,0,0,y>>>24&255,y>>>16&255,y>>>8&255,y&255,T>>>24&255,T>>>16&255,T>>>8&255,T&255])),m=92,o.type==="audio"?(h=ue(o,m),l(q.traf,u,d,h)):(f=R(o),h=ue(o,f.length+m),l(q.traf,u,d,h,f))},F=function(o){return o.duration=o.duration||4294967295,l(q.trak,$(o),B(o))},_e=function(o){var u=new Uint8Array([0,0,0,0,(o.id&4278190080)>>24,(o.id&16711680)>>16,(o.id&65280)>>8,o.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return o.type!=="video"&&(u[u.length-1]=0),l(q.trex,u)},function(){var o,u,d;d=function(h,f){var m=0,y=0,T=0,v=0;return h.length&&(h[0].duration!==void 0&&(m=1),h[0].size!==void 0&&(y=2),h[0].flags!==void 0&&(T=4),h[0].compositionTimeOffset!==void 0&&(v=8)),[0,0,m|y|T|v,1,(h.length&4278190080)>>>24,(h.length&16711680)>>>16,(h.length&65280)>>>8,h.length&255,(f&4278190080)>>>24,(f&16711680)>>>16,(f&65280)>>>8,f&255]},u=function(h,f){var m,y,T,v,b,C;for(v=h.samples||[],f+=20+16*v.length,T=d(v,f),y=new Uint8Array(T.length+v.length*16),y.set(T),m=T.length,C=0;C<v.length;C++)b=v[C],y[m++]=(b.duration&4278190080)>>>24,y[m++]=(b.duration&16711680)>>>16,y[m++]=(b.duration&65280)>>>8,y[m++]=b.duration&255,y[m++]=(b.size&4278190080)>>>24,y[m++]=(b.size&16711680)>>>16,y[m++]=(b.size&65280)>>>8,y[m++]=b.size&255,y[m++]=b.flags.isLeading<<2|b.flags.dependsOn,y[m++]=b.flags.isDependedOn<<6|b.flags.hasRedundancy<<4|b.flags.paddingValue<<1|b.flags.isNonSyncSample,y[m++]=b.flags.degradationPriority&61440,y[m++]=b.flags.degradationPriority&15,y[m++]=(b.compositionTimeOffset&4278190080)>>>24,y[m++]=(b.compositionTimeOffset&16711680)>>>16,y[m++]=(b.compositionTimeOffset&65280)>>>8,y[m++]=b.compositionTimeOffset&255;return l(q.trun,y)},o=function(h,f){var m,y,T,v,b,C;for(v=h.samples||[],f+=20+8*v.length,T=d(v,f),m=new Uint8Array(T.length+v.length*8),m.set(T),y=T.length,C=0;C<v.length;C++)b=v[C],m[y++]=(b.duration&4278190080)>>>24,m[y++]=(b.duration&16711680)>>>16,m[y++]=(b.duration&65280)>>>8,m[y++]=b.duration&255,m[y++]=(b.size&4278190080)>>>24,m[y++]=(b.size&16711680)>>>16,m[y++]=(b.size&65280)>>>8,m[y++]=b.size&255;return l(q.trun,m)},ue=function(h,f){return h.type==="audio"?o(h,f):u(h,f)}}();var Bd={ftyp:g,mdat:_,moof:w,moov:I,initSegment:function(o){var u=g(),d=I(o),h;return h=new Uint8Array(u.byteLength+d.byteLength),h.set(u),h.set(d,u.byteLength),h}},Fd=function(o){var u,d,h=[],f=[];for(f.byteLength=0,f.nalCount=0,f.duration=0,h.byteLength=0,u=0;u<o.length;u++)d=o[u],d.nalUnitType==="access_unit_delimiter_rbsp"?(h.length&&(h.duration=d.dts-h.dts,f.byteLength+=h.byteLength,f.nalCount+=h.length,f.duration+=h.duration,f.push(h)),h=[d],h.byteLength=d.data.byteLength,h.pts=d.pts,h.dts=d.dts):(d.nalUnitType==="slice_layer_without_partitioning_rbsp_idr"&&(h.keyFrame=!0),h.duration=d.dts-h.dts,h.byteLength+=d.data.byteLength,h.push(d));return f.length&&(!h.duration||h.duration<=0)&&(h.duration=f[f.length-1].duration),f.byteLength+=h.byteLength,f.nalCount+=h.length,f.duration+=h.duration,f.push(h),f},Nd=function(o){var u,d,h=[],f=[];for(h.byteLength=0,h.nalCount=0,h.duration=0,h.pts=o[0].pts,h.dts=o[0].dts,f.byteLength=0,f.nalCount=0,f.duration=0,f.pts=o[0].pts,f.dts=o[0].dts,u=0;u<o.length;u++)d=o[u],d.keyFrame?(h.length&&(f.push(h),f.byteLength+=h.byteLength,f.nalCount+=h.nalCount,f.duration+=h.duration),h=[d],h.nalCount=d.length,h.byteLength=d.byteLength,h.pts=d.pts,h.dts=d.dts,h.duration=d.duration):(h.duration+=d.duration,h.nalCount+=d.length,h.byteLength+=d.byteLength,h.push(d));return f.length&&h.duration<=0&&(h.duration=f[f.length-1].duration),f.byteLength+=h.byteLength,f.nalCount+=h.nalCount,f.duration+=h.duration,f.push(h),f},Ud=function(o){var u;return!o[0][0].keyFrame&&o.length>1&&(u=o.shift(),o.byteLength-=u.byteLength,o.nalCount-=u.nalCount,o[0][0].dts=u.dts,o[0][0].pts=u.pts,o[0][0].duration+=u.duration),o},jd=function(){return{size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}},Wa=function(o,u){var d=jd();return d.dataOffset=u,d.compositionTimeOffset=o.pts-o.dts,d.duration=o.duration,d.size=4*o.length,d.size+=o.byteLength,o.keyFrame&&(d.flags.dependsOn=2,d.flags.isNonSyncSample=0),d},$d=function(o,u){var d,h,f,m,y,T=u||0,v=[];for(d=0;d<o.length;d++)for(m=o[d],h=0;h<m.length;h++)y=m[h],f=Wa(y,T),T+=f.size,v.push(f);return v},Hd=function(o){var u,d,h,f,m,y,T=0,v=o.byteLength,b=o.nalCount,C=v+4*b,A=new Uint8Array(C),H=new DataView(A.buffer);for(u=0;u<o.length;u++)for(f=o[u],d=0;d<f.length;d++)for(m=f[d],h=0;h<m.length;h++)y=m[h],H.setUint32(T,y.data.byteLength),T+=4,A.set(y.data,T),T+=y.data.byteLength;return A},Vd=function(o,u){var d,h=u||0,f=[];return d=Wa(o,h),f.push(d),f},qd=function(o){var u,d,h=0,f=o.byteLength,m=o.length,y=f+4*m,T=new Uint8Array(y),v=new DataView(T.buffer);for(u=0;u<o.length;u++)d=o[u],v.setUint32(h,d.data.byteLength),h+=4,T.set(d.data,h),h+=d.data.byteLength;return T},zd={groupNalsIntoFrames:Fd,groupFramesIntoGops:Nd,extendFirstKeyFrame:Ud,generateSampleTable:$d,concatenateNalData:Hd,generateSampleTableForFrame:Vd,concatenateNalDataForFrame:qd},vt=[33,16,5,32,164,27],Wn=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],te=function(o){for(var u=[];o--;)u.push(0);return u},Wd=function(o){return Object.keys(o).reduce(function(u,d){return u[d]=new Uint8Array(o[d].reduce(function(h,f){return h.concat(f)},[])),u},{})},Gn,Gd=function(){if(!Gn){var o={96e3:[vt,[227,64],te(154),[56]],88200:[vt,[231],te(170),[56]],64e3:[vt,[248,192],te(240),[56]],48e3:[vt,[255,192],te(268),[55,148,128],te(54),[112]],44100:[vt,[255,192],te(268),[55,163,128],te(84),[112]],32e3:[vt,[255,192],te(268),[55,234],te(226),[112]],24e3:[vt,[255,192],te(268),[55,255,128],te(268),[111,112],te(126),[224]],16e3:[vt,[255,192],te(268),[55,255,128],te(268),[111,255],te(269),[223,108],te(195),[1,192]],12e3:[Wn,te(268),[3,127,248],te(268),[6,255,240],te(268),[13,255,224],te(268),[27,253,128],te(259),[56]],11025:[Wn,te(268),[3,127,248],te(268),[6,255,240],te(268),[13,255,224],te(268),[27,255,192],te(268),[55,175,128],te(108),[112]],8e3:[Wn,te(268),[3,121,16],te(47),[7]]};Gn=Wd(o)}return Gn},Kn=9e4,Qn,Xn,xs,Yn,Ga,Ka,Qa;Qn=function(o){return o*Kn},Xn=function(o,u){return o*u},xs=function(o){return o/Kn},Yn=function(o,u){return o/u},Ga=function(o,u){return Qn(Yn(o,u))},Ka=function(o,u){return Xn(xs(o),u)},Qa=function(o,u,d){return xs(d?o:o-u)};var ae={ONE_SECOND_IN_TS:Kn,secondsToVideoTs:Qn,secondsToAudioTs:Xn,videoTsToSeconds:xs,audioTsToSeconds:Yn,audioTsToVideoTs:Ga,videoTsToAudioTs:Ka,metadataTsToSeconds:Qa},Kd=Gd,Ss=ae,Qd=function(o){var u,d,h=0;for(u=0;u<o.length;u++)d=o[u],h+=d.data.byteLength;return h},Xd=function(o,u,d,h){var f,m=0,y=0,T=0,v=0,b,C,A;if(u.length&&(f=Ss.audioTsToVideoTs(o.baseMediaDecodeTime,o.samplerate),m=Math.ceil(Ss.ONE_SECOND_IN_TS/(o.samplerate/1024)),d&&h&&(y=f-Math.max(d,h),T=Math.floor(y/m),v=T*m),!(T<1||v>Ss.ONE_SECOND_IN_TS/2))){for(b=Kd()[o.samplerate],b||(b=u[0].data),C=0;C<T;C++)A=u[0],u.splice(0,0,{data:b,dts:A.dts-m,pts:A.pts-m});return o.baseMediaDecodeTime-=Math.floor(Ss.videoTsToAudioTs(v,o.samplerate)),v}},Yd=function(o,u,d){return u.minSegmentDts>=d?o:(u.minSegmentDts=1/0,o.filter(function(h){return h.dts>=d?(u.minSegmentDts=Math.min(u.minSegmentDts,h.dts),u.minSegmentPts=u.minSegmentDts,!0):!1}))},Jd=function(o){var u,d,h=[];for(u=0;u<o.length;u++)d=o[u],h.push({size:d.data.byteLength,duration:1024});return h},Zd=function(o){var u,d,h=0,f=new Uint8Array(Qd(o));for(u=0;u<o.length;u++)d=o[u],f.set(d.data,h),h+=d.data.byteLength;return f},ec={prefixWithSilence:Xd,trimAdtsFramesByEarliestDts:Yd,generateSampleTable:Jd,concatenateFrameData:Zd},tc=ae.ONE_SECOND_IN_TS,ic=function(o,u){typeof u.pts=="number"&&(o.timelineStartInfo.pts===void 0&&(o.timelineStartInfo.pts=u.pts),o.minSegmentPts===void 0?o.minSegmentPts=u.pts:o.minSegmentPts=Math.min(o.minSegmentPts,u.pts),o.maxSegmentPts===void 0?o.maxSegmentPts=u.pts:o.maxSegmentPts=Math.max(o.maxSegmentPts,u.pts)),typeof u.dts=="number"&&(o.timelineStartInfo.dts===void 0&&(o.timelineStartInfo.dts=u.dts),o.minSegmentDts===void 0?o.minSegmentDts=u.dts:o.minSegmentDts=Math.min(o.minSegmentDts,u.dts),o.maxSegmentDts===void 0?o.maxSegmentDts=u.dts:o.maxSegmentDts=Math.max(o.maxSegmentDts,u.dts))},sc=function(o){delete o.minSegmentDts,delete o.maxSegmentDts,delete o.minSegmentPts,delete o.maxSegmentPts},nc=function(o,u){var d,h,f=o.minSegmentDts;return u||(f-=o.timelineStartInfo.dts),d=o.timelineStartInfo.baseMediaDecodeTime,d+=f,d=Math.max(0,d),o.type==="audio"&&(h=o.samplerate/tc,d*=h,d=Math.floor(d)),d},rc={clearDtsInfo:sc,calculateTrackBaseMediaDecodeTime:nc,collectDtsInfo:ic},Xa=4,ac=128,oc=function(o){for(var u=0,d={payloadType:-1,payloadSize:0},h=0,f=0;u<o.byteLength&&o[u]!==ac;){for(;o[u]===255;)h+=255,u++;for(h+=o[u++];o[u]===255;)f+=255,u++;if(f+=o[u++],!d.payload&&h===Xa){var m=String.fromCharCode(o[u+3],o[u+4],o[u+5],o[u+6]);if(m==="GA94"){d.payloadType=h,d.payloadSize=f,d.payload=o.subarray(u,u+f);break}else d.payload=void 0}u+=f,h=0,f=0}return d},lc=function(o){return o.payload[0]!==181||(o.payload[1]<<8|o.payload[2])!==49||String.fromCharCode(o.payload[3],o.payload[4],o.payload[5],o.payload[6])!=="GA94"||o.payload[7]!==3?null:o.payload.subarray(8,o.payload.length-1)},uc=function(o,u){var d=[],h,f,m,y;if(!(u[0]&64))return d;for(f=u[0]&31,h=0;h<f;h++)m=h*3,y={type:u[m+2]&3,pts:o},u[m+2]&4&&(y.ccData=u[m+3]<<8|u[m+4],d.push(y));return d},hc=function(o){for(var u=o.byteLength,d=[],h=1,f,m;h<u-2;)o[h]===0&&o[h+1]===0&&o[h+2]===3?(d.push(h+2),h+=2):h++;if(d.length===0)return o;f=u-d.length,m=new Uint8Array(f);var y=0;for(h=0;h<f;y++,h++)y===d[0]&&(y++,d.shift()),m[h]=o[y];return m},Ya={parseSei:oc,parseUserData:lc,parseCaptionPackets:uc,discardEmulationPreventionBytes:hc,USER_DATA_REGISTERED_ITU_T_T35:Xa},Jn=t,Cs=Ya,Le=function(o){o=o||{},Le.prototype.init.call(this),this.parse708captions_=typeof o.parse708captions=="boolean"?o.parse708captions:!0,this.captionPackets_=[],this.ccStreams_=[new he(0,0),new he(0,1),new he(1,0),new he(1,1)],this.parse708captions_&&(this.cc708Stream_=new ne({captionServices:o.captionServices})),this.reset(),this.ccStreams_.forEach(function(u){u.on("data",this.trigger.bind(this,"data")),u.on("partialdone",this.trigger.bind(this,"partialdone")),u.on("done",this.trigger.bind(this,"done"))},this),this.parse708captions_&&(this.cc708Stream_.on("data",this.trigger.bind(this,"data")),this.cc708Stream_.on("partialdone",this.trigger.bind(this,"partialdone")),this.cc708Stream_.on("done",this.trigger.bind(this,"done")))};Le.prototype=new Jn,Le.prototype.push=function(o){var u,d,h;if(o.nalUnitType==="sei_rbsp"&&(u=Cs.parseSei(o.escapedRBSP),!!u.payload&&u.payloadType===Cs.USER_DATA_REGISTERED_ITU_T_T35&&(d=Cs.parseUserData(u),!!d))){if(o.dts<this.latestDts_){this.ignoreNextEqualDts_=!0;return}else if(o.dts===this.latestDts_&&this.ignoreNextEqualDts_){this.numSameDts_--,this.numSameDts_||(this.ignoreNextEqualDts_=!1);return}h=Cs.parseCaptionPackets(o.pts,d),this.captionPackets_=this.captionPackets_.concat(h),this.latestDts_!==o.dts&&(this.numSameDts_=0),this.numSameDts_++,this.latestDts_=o.dts}},Le.prototype.flushCCStreams=function(o){this.ccStreams_.forEach(function(u){return o==="flush"?u.flush():u.partialFlush()},this)},Le.prototype.flushStream=function(o){if(!this.captionPackets_.length){this.flushCCStreams(o);return}this.captionPackets_.forEach(function(u,d){u.presortIndex=d}),this.captionPackets_.sort(function(u,d){return u.pts===d.pts?u.presortIndex-d.presortIndex:u.pts-d.pts}),this.captionPackets_.forEach(function(u){u.type<2?this.dispatchCea608Packet(u):this.dispatchCea708Packet(u)},this),this.captionPackets_.length=0,this.flushCCStreams(o)},Le.prototype.flush=function(){return this.flushStream("flush")},Le.prototype.partialFlush=function(){return this.flushStream("partialFlush")},Le.prototype.reset=function(){this.latestDts_=null,this.ignoreNextEqualDts_=!1,this.numSameDts_=0,this.activeCea608Channel_=[null,null],this.ccStreams_.forEach(function(o){o.reset()})},Le.prototype.dispatchCea608Packet=function(o){this.setsTextOrXDSActive(o)?this.activeCea608Channel_[o.type]=null:this.setsChannel1Active(o)?this.activeCea608Channel_[o.type]=0:this.setsChannel2Active(o)&&(this.activeCea608Channel_[o.type]=1),this.activeCea608Channel_[o.type]!==null&&this.ccStreams_[(o.type<<1)+this.activeCea608Channel_[o.type]].push(o)},Le.prototype.setsChannel1Active=function(o){return(o.ccData&30720)===4096},Le.prototype.setsChannel2Active=function(o){return(o.ccData&30720)===6144},Le.prototype.setsTextOrXDSActive=function(o){return(o.ccData&28928)===256||(o.ccData&30974)===4138||(o.ccData&30974)===6186},Le.prototype.dispatchCea708Packet=function(o){this.parse708captions_&&this.cc708Stream_.push(o)};var dc={127:9834,4128:32,4129:160,4133:8230,4138:352,4140:338,4144:9608,4145:8216,4146:8217,4147:8220,4148:8221,4149:8226,4153:8482,4154:353,4156:339,4157:8480,4159:376,4214:8539,4215:8540,4216:8541,4217:8542,4218:9168,4219:9124,4220:9123,4221:9135,4222:9126,4223:9121,4256:12600},cc=function(o){var u=dc[o]||o;return o&4096&&o===u?"":String.fromCharCode(u)},Es=function(o){return 32<=o&&o<=127||160<=o&&o<=255},ct=function(o){this.windowNum=o,this.reset()};ct.prototype.reset=function(){this.clearText(),this.pendingNewLine=!1,this.winAttr={},this.penAttr={},this.penLoc={},this.penColor={},this.visible=0,this.rowLock=0,this.columnLock=0,this.priority=0,this.relativePositioning=0,this.anchorVertical=0,this.anchorHorizontal=0,this.anchorPoint=0,this.rowCount=1,this.virtualRowCount=this.rowCount+1,this.columnCount=41,this.windowStyle=0,this.penStyle=0},ct.prototype.getText=function(){return this.rows.join(`
|
|
195
|
-
`)},ct.prototype.clearText=function(){this.rows=[""],this.rowIdx=0},ct.prototype.newLine=function(o){for(this.rows.length>=this.virtualRowCount&&typeof this.beforeRowOverflow=="function"&&this.beforeRowOverflow(o),this.rows.length>0&&(this.rows.push(""),this.rowIdx++);this.rows.length>this.virtualRowCount;)this.rows.shift(),this.rowIdx--},ct.prototype.isEmpty=function(){return this.rows.length===0?!0:this.rows.length===1?this.rows[0]==="":!1},ct.prototype.addText=function(o){this.rows[this.rowIdx]+=o},ct.prototype.backspace=function(){if(!this.isEmpty()){var o=this.rows[this.rowIdx];this.rows[this.rowIdx]=o.substr(0,o.length-1)}};var ws=function(o,u,d){this.serviceNum=o,this.text="",this.currentWindow=new ct(-1),this.windows=[],this.stream=d,typeof u=="string"&&this.createTextDecoder(u)};ws.prototype.init=function(o,u){this.startPts=o;for(var d=0;d<8;d++)this.windows[d]=new ct(d),typeof u=="function"&&(this.windows[d].beforeRowOverflow=u)},ws.prototype.setCurrentWindow=function(o){this.currentWindow=this.windows[o]},ws.prototype.createTextDecoder=function(o){if(typeof TextDecoder>"u")this.stream.trigger("log",{level:"warn",message:"The `encoding` option is unsupported without TextDecoder support"});else try{this.textDecoder_=new TextDecoder(o)}catch(u){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+o+" encoding. "+u})}};var ne=function(o){o=o||{},ne.prototype.init.call(this);var u=this,d=o.captionServices||{},h={},f;Object.keys(d).forEach(m=>{f=d[m],/^SERVICE/.test(m)&&(h[m]=f.encoding)}),this.serviceEncodings=h,this.current708Packet=null,this.services={},this.push=function(m){m.type===3?(u.new708Packet(),u.add708Bytes(m)):(u.current708Packet===null&&u.new708Packet(),u.add708Bytes(m))}};ne.prototype=new Jn,ne.prototype.new708Packet=function(){this.current708Packet!==null&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},ne.prototype.add708Bytes=function(o){var u=o.ccData,d=u>>>8,h=u&255;this.current708Packet.ptsVals.push(o.pts),this.current708Packet.data.push(d),this.current708Packet.data.push(h)},ne.prototype.push708Packet=function(){var o=this.current708Packet,u=o.data,d=null,h=null,f=0,m=u[f++];for(o.seq=m>>6,o.sizeCode=m&63;f<u.length;f++)m=u[f++],d=m>>5,h=m&31,d===7&&h>0&&(m=u[f++],d=m),this.pushServiceBlock(d,f,h),h>0&&(f+=h-1)},ne.prototype.pushServiceBlock=function(o,u,d){var h,f=u,m=this.current708Packet.data,y=this.services[o];for(y||(y=this.initService(o,f));f<u+d&&f<m.length;f++)h=m[f],Es(h)?f=this.handleText(f,y):h===24?f=this.multiByteCharacter(f,y):h===16?f=this.extendedCommands(f,y):128<=h&&h<=135?f=this.setCurrentWindow(f,y):152<=h&&h<=159?f=this.defineWindow(f,y):h===136?f=this.clearWindows(f,y):h===140?f=this.deleteWindows(f,y):h===137?f=this.displayWindows(f,y):h===138?f=this.hideWindows(f,y):h===139?f=this.toggleWindows(f,y):h===151?f=this.setWindowAttributes(f,y):h===144?f=this.setPenAttributes(f,y):h===145?f=this.setPenColor(f,y):h===146?f=this.setPenLocation(f,y):h===143?y=this.reset(f,y):h===8?y.currentWindow.backspace():h===12?y.currentWindow.clearText():h===13?y.currentWindow.pendingNewLine=!0:h===14?y.currentWindow.clearText():h===141&&f++},ne.prototype.extendedCommands=function(o,u){var d=this.current708Packet.data,h=d[++o];return Es(h)&&(o=this.handleText(o,u,{isExtended:!0})),o},ne.prototype.getPts=function(o){return this.current708Packet.ptsVals[Math.floor(o/2)]},ne.prototype.initService=function(o,u){var h="SERVICE"+o,d=this,h,f;return h in this.serviceEncodings&&(f=this.serviceEncodings[h]),this.services[o]=new ws(o,f,d),this.services[o].init(this.getPts(u),function(m){d.flushDisplayed(m,d.services[o])}),this.services[o]},ne.prototype.handleText=function(o,u,d){var h=d&&d.isExtended,f=d&&d.isMultiByte,m=this.current708Packet.data,y=h?4096:0,T=m[o],v=m[o+1],b=u.currentWindow,C,A;function H(M){return M.map(z=>("0"+(z&255).toString(16)).slice(-2)).join("")}if(f?(A=[T,v],o++):A=[T],u.textDecoder_&&!h)C=u.textDecoder_.decode(new Uint8Array(A));else if(f){const M=H(A);C=String.fromCharCode(parseInt(M,16))}else C=cc(y|T);return b.pendingNewLine&&!b.isEmpty()&&b.newLine(this.getPts(o)),b.pendingNewLine=!1,b.addText(C),o},ne.prototype.multiByteCharacter=function(o,u){var d=this.current708Packet.data,h=d[o+1],f=d[o+2];return Es(h)&&Es(f)&&(o=this.handleText(++o,u,{isMultiByte:!0})),o},ne.prototype.setCurrentWindow=function(o,u){var d=this.current708Packet.data,h=d[o],f=h&7;return u.setCurrentWindow(f),o},ne.prototype.defineWindow=function(o,u){var d=this.current708Packet.data,h=d[o],f=h&7;u.setCurrentWindow(f);var m=u.currentWindow;return h=d[++o],m.visible=(h&32)>>5,m.rowLock=(h&16)>>4,m.columnLock=(h&8)>>3,m.priority=h&7,h=d[++o],m.relativePositioning=(h&128)>>7,m.anchorVertical=h&127,h=d[++o],m.anchorHorizontal=h,h=d[++o],m.anchorPoint=(h&240)>>4,m.rowCount=h&15,h=d[++o],m.columnCount=h&63,h=d[++o],m.windowStyle=(h&56)>>3,m.penStyle=h&7,m.virtualRowCount=m.rowCount+1,o},ne.prototype.setWindowAttributes=function(o,u){var d=this.current708Packet.data,h=d[o],f=u.currentWindow.winAttr;return h=d[++o],f.fillOpacity=(h&192)>>6,f.fillRed=(h&48)>>4,f.fillGreen=(h&12)>>2,f.fillBlue=h&3,h=d[++o],f.borderType=(h&192)>>6,f.borderRed=(h&48)>>4,f.borderGreen=(h&12)>>2,f.borderBlue=h&3,h=d[++o],f.borderType+=(h&128)>>5,f.wordWrap=(h&64)>>6,f.printDirection=(h&48)>>4,f.scrollDirection=(h&12)>>2,f.justify=h&3,h=d[++o],f.effectSpeed=(h&240)>>4,f.effectDirection=(h&12)>>2,f.displayEffect=h&3,o},ne.prototype.flushDisplayed=function(o,u){for(var d=[],h=0;h<8;h++)u.windows[h].visible&&!u.windows[h].isEmpty()&&d.push(u.windows[h].getText());u.endPts=o,u.text=d.join(`
|
|
196
|
-
|
|
197
|
-
`),this.pushCaption(u),u.startPts=o},ne.prototype.pushCaption=function(o){o.text!==""&&(this.trigger("data",{startPts:o.startPts,endPts:o.endPts,text:o.text,stream:"cc708_"+o.serviceNum}),o.text="",o.startPts=o.endPts)},ne.prototype.displayWindows=function(o,u){var d=this.current708Packet.data,h=d[++o],f=this.getPts(o);this.flushDisplayed(f,u);for(var m=0;m<8;m++)h&1<<m&&(u.windows[m].visible=1);return o},ne.prototype.hideWindows=function(o,u){var d=this.current708Packet.data,h=d[++o],f=this.getPts(o);this.flushDisplayed(f,u);for(var m=0;m<8;m++)h&1<<m&&(u.windows[m].visible=0);return o},ne.prototype.toggleWindows=function(o,u){var d=this.current708Packet.data,h=d[++o],f=this.getPts(o);this.flushDisplayed(f,u);for(var m=0;m<8;m++)h&1<<m&&(u.windows[m].visible^=1);return o},ne.prototype.clearWindows=function(o,u){var d=this.current708Packet.data,h=d[++o],f=this.getPts(o);this.flushDisplayed(f,u);for(var m=0;m<8;m++)h&1<<m&&u.windows[m].clearText();return o},ne.prototype.deleteWindows=function(o,u){var d=this.current708Packet.data,h=d[++o],f=this.getPts(o);this.flushDisplayed(f,u);for(var m=0;m<8;m++)h&1<<m&&u.windows[m].reset();return o},ne.prototype.setPenAttributes=function(o,u){var d=this.current708Packet.data,h=d[o],f=u.currentWindow.penAttr;return h=d[++o],f.textTag=(h&240)>>4,f.offset=(h&12)>>2,f.penSize=h&3,h=d[++o],f.italics=(h&128)>>7,f.underline=(h&64)>>6,f.edgeType=(h&56)>>3,f.fontStyle=h&7,o},ne.prototype.setPenColor=function(o,u){var d=this.current708Packet.data,h=d[o],f=u.currentWindow.penColor;return h=d[++o],f.fgOpacity=(h&192)>>6,f.fgRed=(h&48)>>4,f.fgGreen=(h&12)>>2,f.fgBlue=h&3,h=d[++o],f.bgOpacity=(h&192)>>6,f.bgRed=(h&48)>>4,f.bgGreen=(h&12)>>2,f.bgBlue=h&3,h=d[++o],f.edgeRed=(h&48)>>4,f.edgeGreen=(h&12)>>2,f.edgeBlue=h&3,o},ne.prototype.setPenLocation=function(o,u){var d=this.current708Packet.data,h=d[o],f=u.currentWindow.penLoc;return u.currentWindow.pendingNewLine=!0,h=d[++o],f.row=h&15,h=d[++o],f.column=h&63,o},ne.prototype.reset=function(o,u){var d=this.getPts(o);return this.flushDisplayed(d,u),this.initService(u.serviceNum,o)};var fc={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,304:174,305:176,306:189,307:191,308:8482,309:162,310:163,311:9834,312:224,313:160,314:232,315:226,316:234,317:238,318:244,319:251,544:193,545:201,546:211,547:218,548:220,549:252,550:8216,551:161,552:42,553:39,554:8212,555:169,556:8480,557:8226,558:8220,559:8221,560:192,561:194,562:199,563:200,564:202,565:203,566:235,567:206,568:207,569:239,570:212,571:217,572:249,573:219,574:171,575:187,800:195,801:227,802:205,803:204,804:236,805:210,806:242,807:213,808:245,809:123,810:125,811:92,812:94,813:95,814:124,815:126,816:196,817:228,818:214,819:246,820:223,821:165,822:164,823:9474,824:197,825:229,826:216,827:248,828:9484,829:9488,830:9492,831:9496},ks=function(o){return o===null?"":(o=fc[o]||o,String.fromCharCode(o))},Is=14,pc=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],Nt=function(){for(var o=[],u=Is+1;u--;)o.push({text:"",indent:0,offset:0});return o},he=function(o,u){he.prototype.init.call(this),this.field_=o||0,this.dataChannel_=u||0,this.name_="CC"+((this.field_<<1|this.dataChannel_)+1),this.setConstants(),this.reset(),this.push=function(d){var h,f,m,y,T;if(h=d.ccData&32639,h===this.lastControlCode_){this.lastControlCode_=null;return}if((h&61440)===4096?this.lastControlCode_=h:h!==this.PADDING_&&(this.lastControlCode_=null),m=h>>>8,y=h&255,h!==this.PADDING_)if(h===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(h===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(d.pts),this.flushDisplayed(d.pts),f=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=f,this.startPts_=d.pts;else if(h===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(d.pts);else if(h===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(d.pts);else if(h===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(d.pts);else if(h===this.CARRIAGE_RETURN_)this.clearFormatting(d.pts),this.flushDisplayed(d.pts),this.shiftRowsUp_(),this.startPts_=d.pts;else if(h===this.BACKSPACE_)this.mode_==="popOn"?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1);else if(h===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(d.pts),this.displayed_=Nt();else if(h===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=Nt();else if(h===this.RESUME_DIRECT_CAPTIONING_)this.mode_!=="paintOn"&&(this.flushDisplayed(d.pts),this.displayed_=Nt()),this.mode_="paintOn",this.startPts_=d.pts;else if(this.isSpecialCharacter(m,y))m=(m&3)<<8,T=ks(m|y),this[this.mode_](d.pts,T),this.column_++;else if(this.isExtCharacter(m,y))this.mode_==="popOn"?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1),m=(m&3)<<8,T=ks(m|y),this[this.mode_](d.pts,T),this.column_++;else if(this.isMidRowCode(m,y))this.clearFormatting(d.pts),this[this.mode_](d.pts," "),this.column_++,(y&14)===14&&this.addFormatting(d.pts,["i"]),(y&1)===1&&this.addFormatting(d.pts,["u"]);else if(this.isOffsetControlCode(m,y)){const b=y&3;this.nonDisplayed_[this.row_].offset=b,this.column_+=b}else if(this.isPAC(m,y)){var v=pc.indexOf(h&7968);if(this.mode_==="rollUp"&&(v-this.rollUpRows_+1<0&&(v=this.rollUpRows_-1),this.setRollUp(d.pts,v)),v!==this.row_&&v>=0&&v<=14&&(this.clearFormatting(d.pts),this.row_=v),y&1&&this.formatting_.indexOf("u")===-1&&this.addFormatting(d.pts,["u"]),(h&16)===16){const b=(h&14)>>1;this.column_=b*4,this.nonDisplayed_[this.row_].indent+=b}this.isColorPAC(y)&&(y&14)===14&&this.addFormatting(d.pts,["i"])}else this.isNormalChar(m)&&(y===0&&(y=null),T=ks(m),T+=ks(y),this[this.mode_](d.pts,T),this.column_+=T.length)}};he.prototype=new Jn,he.prototype.flushDisplayed=function(o){const u=h=>{this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+h+"."})},d=[];this.displayed_.forEach((h,f)=>{if(h&&h.text&&h.text.length){try{h.text=h.text.trim()}catch{u(f)}h.text.length&&d.push({text:h.text,line:f+1,position:10+Math.min(70,h.indent*10)+h.offset*2.5})}else h==null&&u(f)}),d.length&&this.trigger("data",{startPts:this.startPts_,endPts:o,content:d,stream:this.name_})},he.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=Nt(),this.nonDisplayed_=Nt(),this.lastControlCode_=null,this.column_=0,this.row_=Is,this.rollUpRows_=2,this.formatting_=[]},he.prototype.setConstants=function(){this.dataChannel_===0?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):this.dataChannel_===1&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=this.CONTROL_|32,this.END_OF_CAPTION_=this.CONTROL_|47,this.ROLL_UP_2_ROWS_=this.CONTROL_|37,this.ROLL_UP_3_ROWS_=this.CONTROL_|38,this.ROLL_UP_4_ROWS_=this.CONTROL_|39,this.CARRIAGE_RETURN_=this.CONTROL_|45,this.RESUME_DIRECT_CAPTIONING_=this.CONTROL_|41,this.BACKSPACE_=this.CONTROL_|33,this.ERASE_DISPLAYED_MEMORY_=this.CONTROL_|44,this.ERASE_NON_DISPLAYED_MEMORY_=this.CONTROL_|46},he.prototype.isSpecialCharacter=function(o,u){return o===this.EXT_&&u>=48&&u<=63},he.prototype.isExtCharacter=function(o,u){return(o===this.EXT_+1||o===this.EXT_+2)&&u>=32&&u<=63},he.prototype.isMidRowCode=function(o,u){return o===this.EXT_&&u>=32&&u<=47},he.prototype.isOffsetControlCode=function(o,u){return o===this.OFFSET_&&u>=33&&u<=35},he.prototype.isPAC=function(o,u){return o>=this.BASE_&&o<this.BASE_+8&&u>=64&&u<=127},he.prototype.isColorPAC=function(o){return o>=64&&o<=79||o>=96&&o<=127},he.prototype.isNormalChar=function(o){return o>=32&&o<=127},he.prototype.setRollUp=function(o,u){if(this.mode_!=="rollUp"&&(this.row_=Is,this.mode_="rollUp",this.flushDisplayed(o),this.nonDisplayed_=Nt(),this.displayed_=Nt()),u!==void 0&&u!==this.row_)for(var d=0;d<this.rollUpRows_;d++)this.displayed_[u-d]=this.displayed_[this.row_-d],this.displayed_[this.row_-d]={text:"",indent:0,offset:0};u===void 0&&(u=this.row_),this.topRow_=u-this.rollUpRows_+1},he.prototype.addFormatting=function(o,u){this.formatting_=this.formatting_.concat(u);var d=u.reduce(function(h,f){return h+"<"+f+">"},"");this[this.mode_](o,d)},he.prototype.clearFormatting=function(o){if(this.formatting_.length){var u=this.formatting_.reverse().reduce(function(d,h){return d+"</"+h+">"},"");this.formatting_=[],this[this.mode_](o,u)}},he.prototype.popOn=function(o,u){var d=this.nonDisplayed_[this.row_].text;d+=u,this.nonDisplayed_[this.row_].text=d},he.prototype.rollUp=function(o,u){var d=this.displayed_[this.row_].text;d+=u,this.displayed_[this.row_].text=d},he.prototype.shiftRowsUp_=function(){var o;for(o=0;o<this.topRow_;o++)this.displayed_[o]={text:"",indent:0,offset:0};for(o=this.row_+1;o<Is+1;o++)this.displayed_[o]={text:"",indent:0,offset:0};for(o=this.topRow_;o<this.row_;o++)this.displayed_[o]=this.displayed_[o+1];this.displayed_[this.row_]={text:"",indent:0,offset:0}},he.prototype.paintOn=function(o,u){var d=this.displayed_[this.row_].text;d+=u,this.displayed_[this.row_].text=d};var Ja={CaptionStream:Le,Cea608Stream:he,Cea708Stream:ne},Ps={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21},mc=t,gc=8589934592,_c=4294967296,Za="shared",Zn=function(o,u){var d=1;for(o>u&&(d=-1);Math.abs(u-o)>_c;)o+=d*gc;return o},er=function(o){var u,d;er.prototype.init.call(this),this.type_=o||Za,this.push=function(h){if(h.type==="metadata"){this.trigger("data",h);return}this.type_!==Za&&h.type!==this.type_||(d===void 0&&(d=h.dts),h.dts=Zn(h.dts,d),h.pts=Zn(h.pts,d),u=h.dts,this.trigger("data",h))},this.flush=function(){d=u,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){d=void 0,u=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};er.prototype=new mc;var eo={TimestampRolloverStream:er,handleRollover:Zn},yc=(o,u,d)=>{if(!o)return-1;for(var h=d;h<o.length;h++)if(o[h]===u)return h;return-1},Tc={typedArrayIndexOf:yc},As=Tc.typedArrayIndexOf,Ls={Utf8:3},to=function(o,u,d){var h,f="";for(h=u;h<d;h++)f+="%"+("00"+o[h].toString(16)).slice(-2);return f},Oi=function(o,u,d){return decodeURIComponent(to(o,u,d))},Mi=function(o,u,d){return unescape(to(o,u,d))},Ri=function(o){return o[0]<<21|o[1]<<14|o[2]<<7|o[3]},Bi={APIC:function(o){var u=1,d,h,f="-->";o.data[0]===Ls.Utf8&&(d=As(o.data,0,u),!(d<0)&&(o.mimeType=Mi(o.data,u,d),u=d+1,o.pictureType=o.data[u],u++,h=As(o.data,0,u),!(h<0)&&(o.description=Oi(o.data,u,h),u=h+1,o.mimeType===f?o.url=Mi(o.data,u,o.data.length):o.pictureData=o.data.subarray(u,o.data.length))))},"T*":function(o){o.data[0]===Ls.Utf8&&(o.value=Oi(o.data,1,o.data.length).replace(/\0*$/,""),o.values=o.value.split("\0"))},TXXX:function(o){var u;o.data[0]===Ls.Utf8&&(u=As(o.data,0,1),u!==-1&&(o.description=Oi(o.data,1,u),o.value=Oi(o.data,u+1,o.data.length).replace(/\0*$/,""),o.data=o.value))},"W*":function(o){o.url=Mi(o.data,0,o.data.length).replace(/\0.*$/,"")},WXXX:function(o){var u;o.data[0]===Ls.Utf8&&(u=As(o.data,0,1),u!==-1&&(o.description=Oi(o.data,1,u),o.url=Mi(o.data,u+1,o.data.length).replace(/\0.*$/,"")))},PRIV:function(o){var u;for(u=0;u<o.data.length;u++)if(o.data[u]===0){o.owner=Mi(o.data,0,u);break}o.privateData=o.data.subarray(u+1),o.data=o.privateData}},vc=function(o){var u,d,h=10,f=0,m=[];if(!(o.length<10||o[0]!==73||o[1]!==68||o[2]!==51)){f=Ri(o.subarray(6,10)),f+=10;var y=o[5]&64;y&&(h+=4,h+=Ri(o.subarray(10,14)),f-=Ri(o.subarray(16,20)));do{if(u=Ri(o.subarray(h+4,h+8)),u<1)break;d=String.fromCharCode(o[h],o[h+1],o[h+2],o[h+3]);var T={id:d,data:o.subarray(h+10,h+u+10)};T.key=T.id,Bi[T.id]?Bi[T.id](T):T.id[0]==="T"?Bi["T*"](T):T.id[0]==="W"&&Bi["W*"](T),m.push(T),h+=10,h+=u}while(h<f);return m}},io={parseId3Frames:vc,parseSyncSafeInteger:Ri,frameParsers:Bi},bc=t,xc=Ps,bt=io,Ds;Ds=function(o){var u={descriptor:o&&o.descriptor},d=0,h=[],f=0,m;if(Ds.prototype.init.call(this),this.dispatchType=xc.METADATA_STREAM_TYPE.toString(16),u.descriptor)for(m=0;m<u.descriptor.length;m++)this.dispatchType+=("00"+u.descriptor[m].toString(16)).slice(-2);this.push=function(y){var T,v,b,C,A,H;if(y.type==="timed-metadata"){if(y.dataAlignmentIndicator&&(f=0,h.length=0),h.length===0&&(y.data.length<10||y.data[0]!==73||y.data[1]!==68||y.data[2]!==51)){this.trigger("log",{level:"warn",message:"Skipping unrecognized metadata packet"});return}if(h.push(y),f+=y.data.byteLength,h.length===1&&(d=bt.parseSyncSafeInteger(y.data.subarray(6,10)),d+=10),!(f<d)){for(T={data:new Uint8Array(d),frames:[],pts:h[0].pts,dts:h[0].dts},A=0;A<d;)T.data.set(h[0].data.subarray(0,d-A),A),A+=h[0].data.byteLength,f-=h[0].data.byteLength,h.shift();v=10,T.data[5]&64&&(v+=4,v+=bt.parseSyncSafeInteger(T.data.subarray(10,14)),d-=bt.parseSyncSafeInteger(T.data.subarray(16,20)));do{if(b=bt.parseSyncSafeInteger(T.data.subarray(v+4,v+8)),b<1){this.trigger("log",{level:"warn",message:"Malformed ID3 frame encountered. Skipping remaining metadata parsing."});break}if(H=String.fromCharCode(T.data[v],T.data[v+1],T.data[v+2],T.data[v+3]),C={id:H,data:T.data.subarray(v+10,v+b+10)},C.key=C.id,bt.frameParsers[C.id]?bt.frameParsers[C.id](C):C.id[0]==="T"?bt.frameParsers["T*"](C):C.id[0]==="W"&&bt.frameParsers["W*"](C),C.owner==="com.apple.streaming.transportStreamTimestamp"){var M=C.data,z=(M[3]&1)<<30|M[4]<<22|M[5]<<14|M[6]<<6|M[7]>>>2;z*=4,z+=M[7]&3,C.timeStamp=z,T.pts===void 0&&T.dts===void 0&&(T.pts=C.timeStamp,T.dts=C.timeStamp),this.trigger("timestamp",C)}T.frames.push(C),v+=10,v+=b}while(v<d);this.trigger("data",T)}}}},Ds.prototype=new bc;var Sc=Ds,tr=t,ir=Ja,Ke=Ps,Cc=eo.TimestampRolloverStream,Os,Fi,Ms,ei=188,sr=71;Os=function(){var o=new Uint8Array(ei),u=0;Os.prototype.init.call(this),this.push=function(d){var h=0,f=ei,m;for(u?(m=new Uint8Array(d.byteLength+u),m.set(o.subarray(0,u)),m.set(d,u),u=0):m=d;f<m.byteLength;){if(m[h]===sr&&m[f]===sr){this.trigger("data",m.subarray(h,f)),h+=ei,f+=ei;continue}h++,f++}h<m.byteLength&&(o.set(m.subarray(h),0),u=m.byteLength-h)},this.flush=function(){u===ei&&o[0]===sr&&(this.trigger("data",o),u=0),this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.reset=function(){u=0,this.trigger("reset")}},Os.prototype=new tr,Fi=function(){var o,u,d,h;Fi.prototype.init.call(this),h=this,this.packetsWaitingForPmt=[],this.programMapTable=void 0,o=function(f,m){var y=0;m.payloadUnitStartIndicator&&(y+=f[y]+1),m.type==="pat"?u(f.subarray(y),m):d(f.subarray(y),m)},u=function(f,m){m.section_number=f[7],m.last_section_number=f[8],h.pmtPid=(f[10]&31)<<8|f[11],m.pmtPid=h.pmtPid},d=function(f,m){var y,T,v,b;if(f[5]&1){for(h.programMapTable={video:null,audio:null,"timed-metadata":{}},y=(f[1]&15)<<8|f[2],T=3+y-4,v=(f[10]&15)<<8|f[11],b=12+v;b<T;){var C=f[b],A=(f[b+1]&31)<<8|f[b+2];C===Ke.H264_STREAM_TYPE&&h.programMapTable.video===null?h.programMapTable.video=A:C===Ke.ADTS_STREAM_TYPE&&h.programMapTable.audio===null?h.programMapTable.audio=A:C===Ke.METADATA_STREAM_TYPE&&(h.programMapTable["timed-metadata"][A]=C),b+=((f[b+3]&15)<<8|f[b+4])+5}m.programMapTable=h.programMapTable}},this.push=function(f){var m={},y=4;if(m.payloadUnitStartIndicator=!!(f[1]&64),m.pid=f[1]&31,m.pid<<=8,m.pid|=f[2],(f[3]&48)>>>4>1&&(y+=f[y]+1),m.pid===0)m.type="pat",o(f.subarray(y),m),this.trigger("data",m);else if(m.pid===this.pmtPid)for(m.type="pmt",o(f.subarray(y),m),this.trigger("data",m);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else this.programMapTable===void 0?this.packetsWaitingForPmt.push([f,y,m]):this.processPes_(f,y,m)},this.processPes_=function(f,m,y){y.pid===this.programMapTable.video?y.streamType=Ke.H264_STREAM_TYPE:y.pid===this.programMapTable.audio?y.streamType=Ke.ADTS_STREAM_TYPE:y.streamType=this.programMapTable["timed-metadata"][y.pid],y.type="pes",y.data=f.subarray(m),this.trigger("data",y)}},Fi.prototype=new tr,Fi.STREAM_TYPES={h264:27,adts:15},Ms=function(){var o=this,u=!1,d={data:[],size:0},h={data:[],size:0},f={data:[],size:0},m,y=function(v,b){var C;const A=v[0]<<16|v[1]<<8|v[2];b.data=new Uint8Array,A===1&&(b.packetLength=6+(v[4]<<8|v[5]),b.dataAlignmentIndicator=(v[6]&4)!==0,C=v[7],C&192&&(b.pts=(v[9]&14)<<27|(v[10]&255)<<20|(v[11]&254)<<12|(v[12]&255)<<5|(v[13]&254)>>>3,b.pts*=4,b.pts+=(v[13]&6)>>>1,b.dts=b.pts,C&64&&(b.dts=(v[14]&14)<<27|(v[15]&255)<<20|(v[16]&254)<<12|(v[17]&255)<<5|(v[18]&254)>>>3,b.dts*=4,b.dts+=(v[18]&6)>>>1)),b.data=v.subarray(9+v[8]))},T=function(v,b,C){var A=new Uint8Array(v.size),H={type:b},M=0,z=0,Q=!1,ye;if(!(!v.data.length||v.size<9)){for(H.trackId=v.data[0].pid,M=0;M<v.data.length;M++)ye=v.data[M],A.set(ye.data,z),z+=ye.data.byteLength;y(A,H),Q=b==="video"||H.packetLength<=v.size,(C||Q)&&(v.size=0,v.data.length=0),Q&&o.trigger("data",H)}};Ms.prototype.init.call(this),this.push=function(v){({pat:function(){},pes:function(){var b,C;switch(v.streamType){case Ke.H264_STREAM_TYPE:b=d,C="video";break;case Ke.ADTS_STREAM_TYPE:b=h,C="audio";break;case Ke.METADATA_STREAM_TYPE:b=f,C="timed-metadata";break;default:return}v.payloadUnitStartIndicator&&T(b,C,!0),b.data.push(v),b.size+=v.data.byteLength},pmt:function(){var b={type:"metadata",tracks:[]};m=v.programMapTable,m.video!==null&&b.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+m.video,codec:"avc",type:"video"}),m.audio!==null&&b.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+m.audio,codec:"adts",type:"audio"}),u=!0,o.trigger("data",b)}})[v.type]()},this.reset=function(){d.size=0,d.data.length=0,h.size=0,h.data.length=0,this.trigger("reset")},this.flushStreams_=function(){T(d,"video"),T(h,"audio"),T(f,"timed-metadata")},this.flush=function(){if(!u&&m){var v={type:"metadata",tracks:[]};m.video!==null&&v.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+m.video,codec:"avc",type:"video"}),m.audio!==null&&v.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+m.audio,codec:"adts",type:"audio"}),o.trigger("data",v)}u=!1,this.flushStreams_(),this.trigger("done")}},Ms.prototype=new tr;var so={PAT_PID:0,MP2T_PACKET_LENGTH:ei,TransportPacketStream:Os,TransportParseStream:Fi,ElementaryStream:Ms,TimestampRolloverStream:Cc,CaptionStream:ir.CaptionStream,Cea608Stream:ir.Cea608Stream,Cea708Stream:ir.Cea708Stream,MetadataStream:Sc};for(var nr in Ke)Ke.hasOwnProperty(nr)&&(so[nr]=Ke[nr]);var Ec=so,wc=t,kc=ae.ONE_SECOND_IN_TS,Rs,no=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];Rs=function(o){var u,d=0;Rs.prototype.init.call(this),this.skipWarn_=function(h,f){this.trigger("log",{level:"warn",message:`adts skiping bytes ${h} to ${f} in frame ${d} outside syncword`})},this.push=function(h){var f=0,m,y,T,v,b;if(o||(d=0),h.type==="audio"){u&&u.length?(T=u,u=new Uint8Array(T.byteLength+h.data.byteLength),u.set(T),u.set(h.data,T.byteLength)):u=h.data;for(var C;f+7<u.length;){if(u[f]!==255||(u[f+1]&246)!==240){typeof C!="number"&&(C=f),f++;continue}if(typeof C=="number"&&(this.skipWarn_(C,f),C=null),y=(~u[f+1]&1)*2,m=(u[f+3]&3)<<11|u[f+4]<<3|(u[f+5]&224)>>5,v=((u[f+6]&3)+1)*1024,b=v*kc/no[(u[f+2]&60)>>>2],u.byteLength-f<m)break;this.trigger("data",{pts:h.pts+d*b,dts:h.dts+d*b,sampleCount:v,audioobjecttype:(u[f+2]>>>6&3)+1,channelcount:(u[f+2]&1)<<2|(u[f+3]&192)>>>6,samplerate:no[(u[f+2]&60)>>>2],samplingfrequencyindex:(u[f+2]&60)>>>2,samplesize:16,data:u.subarray(f+7+y,f+m)}),d++,f+=m}typeof C=="number"&&(this.skipWarn_(C,f),C=null),u=u.subarray(f)}},this.flush=function(){d=0,this.trigger("done")},this.reset=function(){u=void 0,this.trigger("reset")},this.endTimeline=function(){u=void 0,this.trigger("endedtimeline")}},Rs.prototype=new wc;var Ic=Rs,ro;ro=function(o){var u=o.byteLength,d=0,h=0;this.length=function(){return 8*u},this.bitsAvailable=function(){return 8*u+h},this.loadWord=function(){var f=o.byteLength-u,m=new Uint8Array(4),y=Math.min(4,u);if(y===0)throw new Error("no bytes available");m.set(o.subarray(f,f+y)),d=new DataView(m.buffer).getUint32(0),h=y*8,u-=y},this.skipBits=function(f){var m;h>f?(d<<=f,h-=f):(f-=h,m=Math.floor(f/8),f-=m*8,u-=m,this.loadWord(),d<<=f,h-=f)},this.readBits=function(f){var m=Math.min(h,f),y=d>>>32-m;return h-=m,h>0?d<<=m:u>0&&this.loadWord(),m=f-m,m>0?y<<m|this.readBits(m):y},this.skipLeadingZeros=function(){var f;for(f=0;f<h;++f)if(d&2147483648>>>f)return d<<=f,h-=f,f;return this.loadWord(),f+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var f=this.skipLeadingZeros();return this.readBits(f+1)-1},this.readExpGolomb=function(){var f=this.readUnsignedExpGolomb();return 1&f?1+f>>>1:-1*(f>>>1)},this.readBoolean=function(){return this.readBits(1)===1},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};var Pc=ro,ao=t,Ac=Pc,Bs,Fs,oo;Fs=function(){var o=0,u,d;Fs.prototype.init.call(this),this.push=function(h){var f;d?(f=new Uint8Array(d.byteLength+h.data.byteLength),f.set(d),f.set(h.data,d.byteLength),d=f):d=h.data;for(var m=d.byteLength;o<m-3;o++)if(d[o+2]===1){u=o+5;break}for(;u<m;)switch(d[u]){case 0:if(d[u-1]!==0){u+=2;break}else if(d[u-2]!==0){u++;break}o+3!==u-2&&this.trigger("data",d.subarray(o+3,u-2));do u++;while(d[u]!==1&&u<m);o=u-2,u+=3;break;case 1:if(d[u-1]!==0||d[u-2]!==0){u+=3;break}this.trigger("data",d.subarray(o+3,u-2)),o=u-2,u+=3;break;default:u+=3;break}d=d.subarray(o),u-=o,o=0},this.reset=function(){d=null,o=0,this.trigger("reset")},this.flush=function(){d&&d.byteLength>3&&this.trigger("data",d.subarray(o+3)),d=null,o=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}},Fs.prototype=new ao,oo={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},Bs=function(){var o=new Fs,u,d,h,f,m,y,T;Bs.prototype.init.call(this),u=this,this.push=function(v){v.type==="video"&&(d=v.trackId,h=v.pts,f=v.dts,o.push(v))},o.on("data",function(v){var b={trackId:d,pts:h,dts:f,data:v,nalUnitTypeCode:v[0]&31};switch(b.nalUnitTypeCode){case 5:b.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:b.nalUnitType="sei_rbsp",b.escapedRBSP=m(v.subarray(1));break;case 7:b.nalUnitType="seq_parameter_set_rbsp",b.escapedRBSP=m(v.subarray(1)),b.config=y(b.escapedRBSP);break;case 8:b.nalUnitType="pic_parameter_set_rbsp";break;case 9:b.nalUnitType="access_unit_delimiter_rbsp";break}u.trigger("data",b)}),o.on("done",function(){u.trigger("done")}),o.on("partialdone",function(){u.trigger("partialdone")}),o.on("reset",function(){u.trigger("reset")}),o.on("endedtimeline",function(){u.trigger("endedtimeline")}),this.flush=function(){o.flush()},this.partialFlush=function(){o.partialFlush()},this.reset=function(){o.reset()},this.endTimeline=function(){o.endTimeline()},T=function(v,b){var C=8,A=8,H,M;for(H=0;H<v;H++)A!==0&&(M=b.readExpGolomb(),A=(C+M+256)%256),C=A===0?C:A},m=function(v){for(var b=v.byteLength,C=[],A=1,H,M;A<b-2;)v[A]===0&&v[A+1]===0&&v[A+2]===3?(C.push(A+2),A+=2):A++;if(C.length===0)return v;H=b-C.length,M=new Uint8Array(H);var z=0;for(A=0;A<H;z++,A++)z===C[0]&&(z++,C.shift()),M[A]=v[z];return M},y=function(v){var b=0,C=0,A=0,H=0,M,z,Q,ye,Be,St,qi,zi,Wi,Gi,Qs,oe=[1,1],Ki,Xe;if(M=new Ac(v),z=M.readUnsignedByte(),ye=M.readUnsignedByte(),Q=M.readUnsignedByte(),M.skipUnsignedExpGolomb(),oo[z]&&(Be=M.readUnsignedExpGolomb(),Be===3&&M.skipBits(1),M.skipUnsignedExpGolomb(),M.skipUnsignedExpGolomb(),M.skipBits(1),M.readBoolean()))for(Qs=Be!==3?8:12,Xe=0;Xe<Qs;Xe++)M.readBoolean()&&(Xe<6?T(16,M):T(64,M));if(M.skipUnsignedExpGolomb(),St=M.readUnsignedExpGolomb(),St===0)M.readUnsignedExpGolomb();else if(St===1)for(M.skipBits(1),M.skipExpGolomb(),M.skipExpGolomb(),qi=M.readUnsignedExpGolomb(),Xe=0;Xe<qi;Xe++)M.skipExpGolomb();if(M.skipUnsignedExpGolomb(),M.skipBits(1),zi=M.readUnsignedExpGolomb(),Wi=M.readUnsignedExpGolomb(),Gi=M.readBits(1),Gi===0&&M.skipBits(1),M.skipBits(1),M.readBoolean()&&(b=M.readUnsignedExpGolomb(),C=M.readUnsignedExpGolomb(),A=M.readUnsignedExpGolomb(),H=M.readUnsignedExpGolomb()),M.readBoolean()&&M.readBoolean()){switch(Ki=M.readUnsignedByte(),Ki){case 1:oe=[1,1];break;case 2:oe=[12,11];break;case 3:oe=[10,11];break;case 4:oe=[16,11];break;case 5:oe=[40,33];break;case 6:oe=[24,11];break;case 7:oe=[20,11];break;case 8:oe=[32,11];break;case 9:oe=[80,33];break;case 10:oe=[18,11];break;case 11:oe=[15,11];break;case 12:oe=[64,33];break;case 13:oe=[160,99];break;case 14:oe=[4,3];break;case 15:oe=[3,2];break;case 16:oe=[2,1];break;case 255:{oe=[M.readUnsignedByte()<<8|M.readUnsignedByte(),M.readUnsignedByte()<<8|M.readUnsignedByte()];break}}oe&&oe[0]/oe[1]}return{profileIdc:z,levelIdc:Q,profileCompatibility:ye,width:(zi+1)*16-b*2-C*2,height:(2-Gi)*(Wi+1)*16-A*2-H*2,sarRatio:oe}}},Bs.prototype=new ao;var Lc={H264Stream:Bs},Dc=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],lo=function(o,u){var d=o[u+6]<<21|o[u+7]<<14|o[u+8]<<7|o[u+9],h=o[u+5],f=(h&16)>>4;return d=d>=0?d:0,f?d+20:d+10},uo=function(o,u){return o.length-u<10||o[u]!==73||o[u+1]!==68||o[u+2]!==51?u:(u+=lo(o,u),uo(o,u))},Oc=function(o){var u=uo(o,0);return o.length>=u+2&&(o[u]&255)===255&&(o[u+1]&240)===240&&(o[u+1]&22)===16},ho=function(o){return o[0]<<21|o[1]<<14|o[2]<<7|o[3]},Mc=function(o,u,d){var h,f="";for(h=u;h<d;h++)f+="%"+("00"+o[h].toString(16)).slice(-2);return f},Rc=function(o,u,d){return unescape(Mc(o,u,d))},Bc=function(o,u){var d=(o[u+5]&224)>>5,h=o[u+4]<<3,f=o[u+3]&6144;return f|h|d},Fc=function(o,u){return o[u]===73&&o[u+1]===68&&o[u+2]===51?"timed-metadata":o[u]&!0&&(o[u+1]&240)===240?"audio":null},Nc=function(o){for(var u=0;u+5<o.length;){if(o[u]!==255||(o[u+1]&246)!==240){u++;continue}return Dc[(o[u+2]&60)>>>2]}return null},Uc=function(o){var u,d,h,f;u=10,o[5]&64&&(u+=4,u+=ho(o.subarray(10,14)));do{if(d=ho(o.subarray(u+4,u+8)),d<1)return null;if(f=String.fromCharCode(o[u],o[u+1],o[u+2],o[u+3]),f==="PRIV"){h=o.subarray(u+10,u+d+10);for(var m=0;m<h.byteLength;m++)if(h[m]===0){var y=Rc(h,0,m);if(y==="com.apple.streaming.transportStreamTimestamp"){var T=h.subarray(m+1),v=(T[3]&1)<<30|T[4]<<22|T[5]<<14|T[6]<<6|T[7]>>>2;return v*=4,v+=T[7]&3,v}break}}u+=10,u+=d}while(u<o.byteLength);return null},rr={isLikelyAacData:Oc,parseId3TagSize:lo,parseAdtsSize:Bc,parseType:Fc,parseSampleRate:Nc,parseAacTimestamp:Uc},jc=t,co=rr,Ns;Ns=function(){var o=new Uint8Array,u=0;Ns.prototype.init.call(this),this.setTimestamp=function(d){u=d},this.push=function(d){var h=0,f=0,m,y,T,v;for(o.length?(v=o.length,o=new Uint8Array(d.byteLength+v),o.set(o.subarray(0,v)),o.set(d,v)):o=d;o.length-f>=3;){if(o[f]===73&&o[f+1]===68&&o[f+2]===51){if(o.length-f<10||(h=co.parseId3TagSize(o,f),f+h>o.length))break;y={type:"timed-metadata",data:o.subarray(f,f+h)},this.trigger("data",y),f+=h;continue}else if((o[f]&255)===255&&(o[f+1]&240)===240){if(o.length-f<7||(h=co.parseAdtsSize(o,f),f+h>o.length))break;T={type:"audio",data:o.subarray(f,f+h),pts:u,dts:u},this.trigger("data",T),f+=h;continue}f++}m=o.length-f,m>0?o=o.subarray(f):o=new Uint8Array},this.reset=function(){o=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){o=new Uint8Array,this.trigger("endedtimeline")}},Ns.prototype=new jc;var $c=Ns,Hc=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],Vc=Hc,qc=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],zc=qc,Us=t,Ni=Bd,Ui=zd,js=ec,Qe=rc,ft=Ec,$s=ae,fo=Ic,Wc=Lc.H264Stream,Gc=$c,Kc=rr.isLikelyAacData,Qc=ae.ONE_SECOND_IN_TS,po=Vc,mo=zc,Hs,ji,Vs,Ut,Xc=function(o,u){u.stream=o,this.trigger("log",u)},go=function(o,u){for(var d=Object.keys(u),h=0;h<d.length;h++){var f=d[h];f==="headOfPipeline"||!u[f].on||u[f].on("log",Xc.bind(o,f))}},_o=function(o,u){var d;if(o.length!==u.length)return!1;for(d=0;d<o.length;d++)if(o[d]!==u[d])return!1;return!0},yo=function(o,u,d,h,f,m){var y=d-u,T=h-u,v=f-d;return{start:{dts:o,pts:o+y},end:{dts:o+T,pts:o+v},prependedContentDuration:m,baseMediaDecodeTime:o}};ji=function(o,u){var d=[],h,f=0,m=0,y=1/0;u=u||{},h=u.firstSequenceNumber||0,ji.prototype.init.call(this),this.push=function(T){Qe.collectDtsInfo(o,T),o&&po.forEach(function(v){o[v]=T[v]}),d.push(T)},this.setEarliestDts=function(T){f=T},this.setVideoBaseMediaDecodeTime=function(T){y=T},this.setAudioAppendStart=function(T){m=T},this.flush=function(){var T,v,b,C,A,H,M;if(d.length===0){this.trigger("done","AudioSegmentStream");return}T=js.trimAdtsFramesByEarliestDts(d,o,f),o.baseMediaDecodeTime=Qe.calculateTrackBaseMediaDecodeTime(o,u.keepOriginalTimestamps),M=js.prefixWithSilence(o,T,m,y),o.samples=js.generateSampleTable(T),b=Ni.mdat(js.concatenateFrameData(T)),d=[],v=Ni.moof(h,[o]),C=new Uint8Array(v.byteLength+b.byteLength),h++,C.set(v),C.set(b,v.byteLength),Qe.clearDtsInfo(o),A=Math.ceil(Qc*1024/o.samplerate),T.length&&(H=T.length*A,this.trigger("segmentTimingInfo",yo($s.audioTsToVideoTs(o.baseMediaDecodeTime,o.samplerate),T[0].dts,T[0].pts,T[0].dts+H,T[0].pts+H,M||0)),this.trigger("timingInfo",{start:T[0].pts,end:T[0].pts+H})),this.trigger("data",{track:o,boxes:C}),this.trigger("done","AudioSegmentStream")},this.reset=function(){Qe.clearDtsInfo(o),d=[],this.trigger("reset")}},ji.prototype=new Us,Hs=function(o,u){var d,h=[],f=[],m,y;u=u||{},d=u.firstSequenceNumber||0,Hs.prototype.init.call(this),delete o.minPTS,this.gopCache_=[],this.push=function(T){Qe.collectDtsInfo(o,T),T.nalUnitType==="seq_parameter_set_rbsp"&&!m&&(m=T.config,o.sps=[T.data],mo.forEach(function(v){o[v]=m[v]},this)),T.nalUnitType==="pic_parameter_set_rbsp"&&!y&&(y=T.data,o.pps=[T.data]),h.push(T)},this.flush=function(){for(var T,v,b,C,A,H,M=0,z,Q;h.length&&h[0].nalUnitType!=="access_unit_delimiter_rbsp";)h.shift();if(h.length===0){this.resetStream_(),this.trigger("done","VideoSegmentStream");return}if(T=Ui.groupNalsIntoFrames(h),b=Ui.groupFramesIntoGops(T),b[0][0].keyFrame||(v=this.getGopForFusion_(h[0],o),v?(M=v.duration,b.unshift(v),b.byteLength+=v.byteLength,b.nalCount+=v.nalCount,b.pts=v.pts,b.dts=v.dts,b.duration+=v.duration):b=Ui.extendFirstKeyFrame(b)),f.length){var ye;if(u.alignGopsAtEnd?ye=this.alignGopsAtEnd_(b):ye=this.alignGopsAtStart_(b),!ye){this.gopCache_.unshift({gop:b.pop(),pps:o.pps,sps:o.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),h=[],this.resetStream_(),this.trigger("done","VideoSegmentStream");return}Qe.clearDtsInfo(o),b=ye}Qe.collectDtsInfo(o,b),o.samples=Ui.generateSampleTable(b),A=Ni.mdat(Ui.concatenateNalData(b)),o.baseMediaDecodeTime=Qe.calculateTrackBaseMediaDecodeTime(o,u.keepOriginalTimestamps),this.trigger("processedGopsInfo",b.map(function(Be){return{pts:Be.pts,dts:Be.dts,byteLength:Be.byteLength}})),z=b[0],Q=b[b.length-1],this.trigger("segmentTimingInfo",yo(o.baseMediaDecodeTime,z.dts,z.pts,Q.dts+Q.duration,Q.pts+Q.duration,M)),this.trigger("timingInfo",{start:b[0].pts,end:b[b.length-1].pts+b[b.length-1].duration}),this.gopCache_.unshift({gop:b.pop(),pps:o.pps,sps:o.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),h=[],this.trigger("baseMediaDecodeTime",o.baseMediaDecodeTime),this.trigger("timelineStartInfo",o.timelineStartInfo),C=Ni.moof(d,[o]),H=new Uint8Array(C.byteLength+A.byteLength),d++,H.set(C),H.set(A,C.byteLength),this.trigger("data",{track:o,boxes:H}),this.resetStream_(),this.trigger("done","VideoSegmentStream")},this.reset=function(){this.resetStream_(),h=[],this.gopCache_.length=0,f.length=0,this.trigger("reset")},this.resetStream_=function(){Qe.clearDtsInfo(o),m=void 0,y=void 0},this.getGopForFusion_=function(T){var v=45e3,b=1/0,C,A,H,M,z;for(z=0;z<this.gopCache_.length;z++)M=this.gopCache_[z],H=M.gop,!(!(o.pps&&_o(o.pps[0],M.pps[0]))||!(o.sps&&_o(o.sps[0],M.sps[0])))&&(H.dts<o.timelineStartInfo.dts||(C=T.dts-H.dts-H.duration,C>=-1e4&&C<=v&&(!A||b>C)&&(A=M,b=C)));return A?A.gop:null},this.alignGopsAtStart_=function(T){var v,b,C,A,H,M,z,Q;for(H=T.byteLength,M=T.nalCount,z=T.duration,v=b=0;v<f.length&&b<T.length&&(C=f[v],A=T[b],C.pts!==A.pts);){if(A.pts>C.pts){v++;continue}b++,H-=A.byteLength,M-=A.nalCount,z-=A.duration}return b===0?T:b===T.length?null:(Q=T.slice(b),Q.byteLength=H,Q.duration=z,Q.nalCount=M,Q.pts=Q[0].pts,Q.dts=Q[0].dts,Q)},this.alignGopsAtEnd_=function(T){var v,b,C,A,H,M;for(v=f.length-1,b=T.length-1,H=null,M=!1;v>=0&&b>=0;){if(C=f[v],A=T[b],C.pts===A.pts){M=!0;break}if(C.pts>A.pts){v--;continue}v===f.length-1&&(H=b),b--}if(!M&&H===null)return null;var z;if(M?z=b:z=H,z===0)return T;var Q=T.slice(z),ye=Q.reduce(function(Be,St){return Be.byteLength+=St.byteLength,Be.duration+=St.duration,Be.nalCount+=St.nalCount,Be},{byteLength:0,duration:0,nalCount:0});return Q.byteLength=ye.byteLength,Q.duration=ye.duration,Q.nalCount=ye.nalCount,Q.pts=Q[0].pts,Q.dts=Q[0].dts,Q},this.alignGopsWith=function(T){f=T}},Hs.prototype=new Us,Ut=function(o,u){this.numberOfTracks=0,this.metadataStream=u,o=o||{},typeof o.remux<"u"?this.remuxTracks=!!o.remux:this.remuxTracks=!0,typeof o.keepOriginalTimestamps=="boolean"?this.keepOriginalTimestamps=o.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,Ut.prototype.init.call(this),this.push=function(d){if(d.content||d.text)return this.pendingCaptions.push(d);if(d.frames)return this.pendingMetadata.push(d);this.pendingTracks.push(d.track),this.pendingBytes+=d.boxes.byteLength,d.track.type==="video"&&(this.videoTrack=d.track,this.pendingBoxes.push(d.boxes)),d.track.type==="audio"&&(this.audioTrack=d.track,this.pendingBoxes.unshift(d.boxes))}},Ut.prototype=new Us,Ut.prototype.flush=function(o){var u=0,d={captions:[],captionStreams:{},metadata:[],info:{}},h,f,m,y=0,T;if(this.pendingTracks.length<this.numberOfTracks){if(o!=="VideoSegmentStream"&&o!=="AudioSegmentStream")return;if(this.remuxTracks)return;if(this.pendingTracks.length===0){this.emittedTracks++,this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0);return}}if(this.videoTrack?(y=this.videoTrack.timelineStartInfo.pts,mo.forEach(function(v){d.info[v]=this.videoTrack[v]},this)):this.audioTrack&&(y=this.audioTrack.timelineStartInfo.pts,po.forEach(function(v){d.info[v]=this.audioTrack[v]},this)),this.videoTrack||this.audioTrack){for(this.pendingTracks.length===1?d.type=this.pendingTracks[0].type:d.type="combined",this.emittedTracks+=this.pendingTracks.length,m=Ni.initSegment(this.pendingTracks),d.initSegment=new Uint8Array(m.byteLength),d.initSegment.set(m),d.data=new Uint8Array(this.pendingBytes),T=0;T<this.pendingBoxes.length;T++)d.data.set(this.pendingBoxes[T],u),u+=this.pendingBoxes[T].byteLength;for(T=0;T<this.pendingCaptions.length;T++)h=this.pendingCaptions[T],h.startTime=$s.metadataTsToSeconds(h.startPts,y,this.keepOriginalTimestamps),h.endTime=$s.metadataTsToSeconds(h.endPts,y,this.keepOriginalTimestamps),d.captionStreams[h.stream]=!0,d.captions.push(h);for(T=0;T<this.pendingMetadata.length;T++)f=this.pendingMetadata[T],f.cueTime=$s.metadataTsToSeconds(f.pts,y,this.keepOriginalTimestamps),d.metadata.push(f);for(d.metadata.dispatchType=this.metadataStream.dispatchType,this.pendingTracks.length=0,this.videoTrack=null,this.pendingBoxes.length=0,this.pendingCaptions.length=0,this.pendingBytes=0,this.pendingMetadata.length=0,this.trigger("data",d),T=0;T<d.captions.length;T++)h=d.captions[T],this.trigger("caption",h);for(T=0;T<d.metadata.length;T++)f=d.metadata[T],this.trigger("id3Frame",f)}this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},Ut.prototype.setRemux=function(o){this.remuxTracks=o},Vs=function(o){var u=this,d=!0,h,f;Vs.prototype.init.call(this),o=o||{},this.baseMediaDecodeTime=o.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var m={};this.transmuxPipeline_=m,m.type="aac",m.metadataStream=new ft.MetadataStream,m.aacStream=new Gc,m.audioTimestampRolloverStream=new ft.TimestampRolloverStream("audio"),m.timedMetadataTimestampRolloverStream=new ft.TimestampRolloverStream("timed-metadata"),m.adtsStream=new fo,m.coalesceStream=new Ut(o,m.metadataStream),m.headOfPipeline=m.aacStream,m.aacStream.pipe(m.audioTimestampRolloverStream).pipe(m.adtsStream),m.aacStream.pipe(m.timedMetadataTimestampRolloverStream).pipe(m.metadataStream).pipe(m.coalesceStream),m.metadataStream.on("timestamp",function(y){m.aacStream.setTimestamp(y.timeStamp)}),m.aacStream.on("data",function(y){y.type!=="timed-metadata"&&y.type!=="audio"||m.audioSegmentStream||(f=f||{timelineStartInfo:{baseMediaDecodeTime:u.baseMediaDecodeTime},codec:"adts",type:"audio"},m.coalesceStream.numberOfTracks++,m.audioSegmentStream=new ji(f,o),m.audioSegmentStream.on("log",u.getLogTrigger_("audioSegmentStream")),m.audioSegmentStream.on("timingInfo",u.trigger.bind(u,"audioTimingInfo")),m.adtsStream.pipe(m.audioSegmentStream).pipe(m.coalesceStream),u.trigger("trackinfo",{hasAudio:!!f,hasVideo:!!h}))}),m.coalesceStream.on("data",this.trigger.bind(this,"data")),m.coalesceStream.on("done",this.trigger.bind(this,"done")),go(this,m)},this.setupTsPipeline=function(){var m={};this.transmuxPipeline_=m,m.type="ts",m.metadataStream=new ft.MetadataStream,m.packetStream=new ft.TransportPacketStream,m.parseStream=new ft.TransportParseStream,m.elementaryStream=new ft.ElementaryStream,m.timestampRolloverStream=new ft.TimestampRolloverStream,m.adtsStream=new fo,m.h264Stream=new Wc,m.captionStream=new ft.CaptionStream(o),m.coalesceStream=new Ut(o,m.metadataStream),m.headOfPipeline=m.packetStream,m.packetStream.pipe(m.parseStream).pipe(m.elementaryStream).pipe(m.timestampRolloverStream),m.timestampRolloverStream.pipe(m.h264Stream),m.timestampRolloverStream.pipe(m.adtsStream),m.timestampRolloverStream.pipe(m.metadataStream).pipe(m.coalesceStream),m.h264Stream.pipe(m.captionStream).pipe(m.coalesceStream),m.elementaryStream.on("data",function(y){var T;if(y.type==="metadata"){for(T=y.tracks.length;T--;)!h&&y.tracks[T].type==="video"?(h=y.tracks[T],h.timelineStartInfo.baseMediaDecodeTime=u.baseMediaDecodeTime):!f&&y.tracks[T].type==="audio"&&(f=y.tracks[T],f.timelineStartInfo.baseMediaDecodeTime=u.baseMediaDecodeTime);h&&!m.videoSegmentStream&&(m.coalesceStream.numberOfTracks++,m.videoSegmentStream=new Hs(h,o),m.videoSegmentStream.on("log",u.getLogTrigger_("videoSegmentStream")),m.videoSegmentStream.on("timelineStartInfo",function(v){f&&!o.keepOriginalTimestamps&&(f.timelineStartInfo=v,m.audioSegmentStream.setEarliestDts(v.dts-u.baseMediaDecodeTime))}),m.videoSegmentStream.on("processedGopsInfo",u.trigger.bind(u,"gopInfo")),m.videoSegmentStream.on("segmentTimingInfo",u.trigger.bind(u,"videoSegmentTimingInfo")),m.videoSegmentStream.on("baseMediaDecodeTime",function(v){f&&m.audioSegmentStream.setVideoBaseMediaDecodeTime(v)}),m.videoSegmentStream.on("timingInfo",u.trigger.bind(u,"videoTimingInfo")),m.h264Stream.pipe(m.videoSegmentStream).pipe(m.coalesceStream)),f&&!m.audioSegmentStream&&(m.coalesceStream.numberOfTracks++,m.audioSegmentStream=new ji(f,o),m.audioSegmentStream.on("log",u.getLogTrigger_("audioSegmentStream")),m.audioSegmentStream.on("timingInfo",u.trigger.bind(u,"audioTimingInfo")),m.audioSegmentStream.on("segmentTimingInfo",u.trigger.bind(u,"audioSegmentTimingInfo")),m.adtsStream.pipe(m.audioSegmentStream).pipe(m.coalesceStream)),u.trigger("trackinfo",{hasAudio:!!f,hasVideo:!!h})}}),m.coalesceStream.on("data",this.trigger.bind(this,"data")),m.coalesceStream.on("id3Frame",function(y){y.dispatchType=m.metadataStream.dispatchType,u.trigger("id3Frame",y)}),m.coalesceStream.on("caption",this.trigger.bind(this,"caption")),m.coalesceStream.on("done",this.trigger.bind(this,"done")),go(this,m)},this.setBaseMediaDecodeTime=function(m){var y=this.transmuxPipeline_;o.keepOriginalTimestamps||(this.baseMediaDecodeTime=m),f&&(f.timelineStartInfo.dts=void 0,f.timelineStartInfo.pts=void 0,Qe.clearDtsInfo(f),y.audioTimestampRolloverStream&&y.audioTimestampRolloverStream.discontinuity()),h&&(y.videoSegmentStream&&(y.videoSegmentStream.gopCache_=[]),h.timelineStartInfo.dts=void 0,h.timelineStartInfo.pts=void 0,Qe.clearDtsInfo(h),y.captionStream.reset()),y.timestampRolloverStream&&y.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(m){f&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(m)},this.setRemux=function(m){var y=this.transmuxPipeline_;o.remux=m,y&&y.coalesceStream&&y.coalesceStream.setRemux(m)},this.alignGopsWith=function(m){h&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(m)},this.getLogTrigger_=function(m){var y=this;return function(T){T.stream=m,y.trigger("log",T)}},this.push=function(m){if(d){var y=Kc(m);y&&this.transmuxPipeline_.type!=="aac"?this.setupAacPipeline():!y&&this.transmuxPipeline_.type!=="ts"&&this.setupTsPipeline(),d=!1}this.transmuxPipeline_.headOfPipeline.push(m)},this.flush=function(){d=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.endTimeline=function(){this.transmuxPipeline_.headOfPipeline.endTimeline()},this.reset=function(){this.transmuxPipeline_.headOfPipeline&&this.transmuxPipeline_.headOfPipeline.reset()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}},Vs.prototype=new Us;var Yc={Transmuxer:Vs},Jc=function(o){return o>>>0},Zc=function(o){return("00"+o.toString(16)).slice(-2)},qs={toUnsigned:Jc,toHexString:Zc},ef=function(o){var u="";return u+=String.fromCharCode(o[0]),u+=String.fromCharCode(o[1]),u+=String.fromCharCode(o[2]),u+=String.fromCharCode(o[3]),u},To=ef,tf=qs.toUnsigned,sf=To,vo=function(o,u){var d=[],h,f,m,y,T;if(!u.length)return null;for(h=0;h<o.byteLength;)f=tf(o[h]<<24|o[h+1]<<16|o[h+2]<<8|o[h+3]),m=sf(o.subarray(h+4,h+8)),y=f>1?h+f:o.byteLength,m===u[0]&&(u.length===1?d.push(o.subarray(h+8,y)):(T=vo(o.subarray(h+8,y),u.slice(1)),T.length&&(d=d.concat(T)))),h=y;return d},ar=vo,nf=qs.toUnsigned,rf=r.getUint64,af=function(o){var u={version:o[0],flags:new Uint8Array(o.subarray(1,4))};return u.version===1?u.baseMediaDecodeTime=rf(o.subarray(4)):u.baseMediaDecodeTime=nf(o[4]<<24|o[5]<<16|o[6]<<8|o[7]),u},or=af,of=function(o){var u=new DataView(o.buffer,o.byteOffset,o.byteLength),d={version:o[0],flags:new Uint8Array(o.subarray(1,4)),trackId:u.getUint32(4)},h=d.flags[2]&1,f=d.flags[2]&2,m=d.flags[2]&8,y=d.flags[2]&16,T=d.flags[2]&32,v=d.flags[0]&65536,b=d.flags[0]&131072,C;return C=8,h&&(C+=4,d.baseDataOffset=u.getUint32(12),C+=4),f&&(d.sampleDescriptionIndex=u.getUint32(C),C+=4),m&&(d.defaultSampleDuration=u.getUint32(C),C+=4),y&&(d.defaultSampleSize=u.getUint32(C),C+=4),T&&(d.defaultSampleFlags=u.getUint32(C)),v&&(d.durationIsEmpty=!0),!h&&b&&(d.baseDataOffsetIsMoof=!0),d},bo=of,lf=function(o){return{isLeading:(o[0]&12)>>>2,dependsOn:o[0]&3,isDependedOn:(o[1]&192)>>>6,hasRedundancy:(o[1]&48)>>>4,paddingValue:(o[1]&14)>>>1,isNonSyncSample:o[1]&1,degradationPriority:o[2]<<8|o[3]}},uf=lf,xo=uf,hf=function(o){var u={version:o[0],flags:new Uint8Array(o.subarray(1,4)),samples:[]},d=new DataView(o.buffer,o.byteOffset,o.byteLength),h=u.flags[2]&1,f=u.flags[2]&4,m=u.flags[1]&1,y=u.flags[1]&2,T=u.flags[1]&4,v=u.flags[1]&8,b=d.getUint32(4),C=8,A;for(h&&(u.dataOffset=d.getInt32(C),C+=4),f&&b&&(A={flags:xo(o.subarray(C,C+4))},C+=4,m&&(A.duration=d.getUint32(C),C+=4),y&&(A.size=d.getUint32(C),C+=4),v&&(u.version===1?A.compositionTimeOffset=d.getInt32(C):A.compositionTimeOffset=d.getUint32(C),C+=4),u.samples.push(A),b--);b--;)A={},m&&(A.duration=d.getUint32(C),C+=4),y&&(A.size=d.getUint32(C),C+=4),T&&(A.flags=xo(o.subarray(C,C+4)),C+=4),v&&(u.version===1?A.compositionTimeOffset=d.getInt32(C):A.compositionTimeOffset=d.getUint32(C),C+=4),u.samples.push(A);return u},So=hf,Co={tfdt:or,trun:So},Eo={parseTfdt:Co.tfdt,parseTrun:Co.trun},df=function(o){for(var u=0,d=String.fromCharCode(o[u]),h="";d!=="\0";)h+=d,u++,d=String.fromCharCode(o[u]);return h+=d,h},cf={uint8ToCString:df},zs=cf.uint8ToCString,ff=r.getUint64,pf=function(o){var u=4,d=o[0],h,f,m,y,T,v,b,C;if(d===0){h=zs(o.subarray(u)),u+=h.length,f=zs(o.subarray(u)),u+=f.length;var A=new DataView(o.buffer);m=A.getUint32(u),u+=4,T=A.getUint32(u),u+=4,v=A.getUint32(u),u+=4,b=A.getUint32(u),u+=4}else if(d===1){var A=new DataView(o.buffer);m=A.getUint32(u),u+=4,y=ff(o.subarray(u)),u+=8,v=A.getUint32(u),u+=4,b=A.getUint32(u),u+=4,h=zs(o.subarray(u)),u+=h.length,f=zs(o.subarray(u)),u+=f.length}C=new Uint8Array(o.subarray(u,o.byteLength));var H={scheme_id_uri:h,value:f,timescale:m||1,presentation_time:y,presentation_time_delta:T,event_duration:v,id:b,message_data:C};return gf(d,H)?H:void 0},mf=function(o,u,d,h){return o||o===0?o/u:h+d/u},gf=function(o,u){var d=u.scheme_id_uri!=="\0",h=o===0&&wo(u.presentation_time_delta)&&d,f=o===1&&wo(u.presentation_time)&&d;return!(o>1)&&h||f},wo=function(o){return o!==void 0||o!==null},_f={parseEmsgBox:pf,scaleTime:mf},$i;typeof window<"u"?$i=window:typeof s<"u"?$i=s:typeof self<"u"?$i=self:$i={};var ko=$i,Ws=qs.toUnsigned,Hi=qs.toHexString,me=ar,ti=To,lr=_f,yf=bo,Tf=So,vf=or,bf=r.getUint64,Io,Po,Ao,Lo,Do,ur,Oo,hr=ko,xf=io.parseId3Frames;Io=function(o){var u={},d=me(o,["moov","trak"]);return d.reduce(function(h,f){var m,y,T,v,b;return m=me(f,["tkhd"])[0],!m||(y=m[0],T=y===0?12:20,v=Ws(m[T]<<24|m[T+1]<<16|m[T+2]<<8|m[T+3]),b=me(f,["mdia","mdhd"])[0],!b)?null:(y=b[0],T=y===0?12:20,h[v]=Ws(b[T]<<24|b[T+1]<<16|b[T+2]<<8|b[T+3]),h)},u)},Po=function(o,u){var d;d=me(u,["moof","traf"]);var h=d.reduce(function(f,m){var y=me(m,["tfhd"])[0],T=Ws(y[4]<<24|y[5]<<16|y[6]<<8|y[7]),v=o[T]||9e4,b=me(m,["tfdt"])[0],C=new DataView(b.buffer,b.byteOffset,b.byteLength),A;b[0]===1?A=bf(b.subarray(4,12)):A=C.getUint32(4);let H;return typeof A=="bigint"?H=A/hr.BigInt(v):typeof A=="number"&&!isNaN(A)&&(H=A/v),H<Number.MAX_SAFE_INTEGER&&(H=Number(H)),H<f&&(f=H),f},1/0);return typeof h=="bigint"||isFinite(h)?h:0},Ao=function(o,u){var d=me(u,["moof","traf"]),h=0,f=0,m;if(d&&d.length){var y=me(d[0],["tfhd"])[0],T=me(d[0],["trun"])[0],v=me(d[0],["tfdt"])[0];if(y){var b=yf(y);m=b.trackId}if(v){var C=vf(v);h=C.baseMediaDecodeTime}if(T){var A=Tf(T);A.samples&&A.samples.length&&(f=A.samples[0].compositionTimeOffset||0)}}var H=o[m]||9e4;typeof h=="bigint"&&(f=hr.BigInt(f),H=hr.BigInt(H));var M=(h+f)/H;return typeof M=="bigint"&&M<Number.MAX_SAFE_INTEGER&&(M=Number(M)),M},Lo=function(o){var u=me(o,["moov","trak"]),d=[];return u.forEach(function(h){var f=me(h,["mdia","hdlr"]),m=me(h,["tkhd"]);f.forEach(function(y,T){var v=ti(y.subarray(8,12)),b=m[T],C,A,H;v==="vide"&&(C=new DataView(b.buffer,b.byteOffset,b.byteLength),A=C.getUint8(0),H=A===0?C.getUint32(12):C.getUint32(20),d.push(H))})}),d},ur=function(o){var u=o[0],d=u===0?12:20;return Ws(o[d]<<24|o[d+1]<<16|o[d+2]<<8|o[d+3])},Do=function(o){var u=me(o,["moov","trak"]),d=[];return u.forEach(function(h){var f={},m=me(h,["tkhd"])[0],y,T;m&&(y=new DataView(m.buffer,m.byteOffset,m.byteLength),T=y.getUint8(0),f.id=T===0?y.getUint32(12):y.getUint32(20));var v=me(h,["mdia","hdlr"])[0];if(v){var b=ti(v.subarray(8,12));b==="vide"?f.type="video":b==="soun"?f.type="audio":f.type=b}var C=me(h,["mdia","minf","stbl","stsd"])[0];if(C){var A=C.subarray(8);f.codec=ti(A.subarray(4,8));var H=me(A,[f.codec])[0],M,z;H&&(/^[asm]vc[1-9]$/i.test(f.codec)?(M=H.subarray(78),z=ti(M.subarray(4,8)),z==="avcC"&&M.length>11?(f.codec+=".",f.codec+=Hi(M[9]),f.codec+=Hi(M[10]),f.codec+=Hi(M[11])):f.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(f.codec)?(M=H.subarray(28),z=ti(M.subarray(4,8)),z==="esds"&&M.length>20&&M[19]!==0?(f.codec+="."+Hi(M[19]),f.codec+="."+Hi(M[20]>>>2&63).replace(/^0/,"")):f.codec="mp4a.40.2"):f.codec=f.codec.toLowerCase())}var Q=me(h,["mdia","mdhd"])[0];Q&&(f.timescale=ur(Q)),d.push(f)}),d},Oo=function(o,u=0){var d=me(o,["emsg"]);return d.map(h=>{var f=lr.parseEmsgBox(new Uint8Array(h)),m=xf(f.message_data);return{cueTime:lr.scaleTime(f.presentation_time,f.timescale,f.presentation_time_delta,u),duration:lr.scaleTime(f.event_duration,f.timescale),frames:m}})};var Vi={findBox:me,parseType:ti,timescale:Io,startTime:Po,compositionStartTime:Ao,videoTrackIds:Lo,tracks:Do,getTimescaleFromMediaHeader:ur,getEmsgID3:Oo};const{parseTrun:Sf}=Eo,{findBox:Mo}=Vi;var Ro=ko,Cf=function(o){var u=Mo(o,["moof","traf"]),d=Mo(o,["mdat"]),h=[];return d.forEach(function(f,m){var y=u[m];h.push({mdat:f,traf:y})}),h},Ef=function(o,u,d){var h=u,f=d.defaultSampleDuration||0,m=d.defaultSampleSize||0,y=d.trackId,T=[];return o.forEach(function(v){var b=Sf(v),C=b.samples;C.forEach(function(A){A.duration===void 0&&(A.duration=f),A.size===void 0&&(A.size=m),A.trackId=y,A.dts=h,A.compositionTimeOffset===void 0&&(A.compositionTimeOffset=0),typeof h=="bigint"?(A.pts=h+Ro.BigInt(A.compositionTimeOffset),h+=Ro.BigInt(A.duration)):(A.pts=h+A.compositionTimeOffset,h+=A.duration)}),T=T.concat(C)}),T},Bo={getMdatTrafPairs:Cf,parseSamples:Ef},wf=Ya.discardEmulationPreventionBytes,kf=Ja.CaptionStream,dr=ar,If=or,Pf=bo,{getMdatTrafPairs:Af,parseSamples:Lf}=Bo,Df=function(o,u){for(var d=o,h=0;h<u.length;h++){var f=u[h];if(d<f.size)return f;d-=f.size}return null},Of=function(o,u,d){var h=new DataView(o.buffer,o.byteOffset,o.byteLength),f={logs:[],seiNals:[]},m,y,T,v;for(y=0;y+4<o.length;y+=T)if(T=h.getUint32(y),y+=4,!(T<=0))switch(o[y]&31){case 6:var b=o.subarray(y+1,y+1+T),C=Df(y,u);if(m={nalUnitType:"sei_rbsp",size:T,data:b,escapedRBSP:wf(b),trackId:d},C)m.pts=C.pts,m.dts=C.dts,v=C;else if(v)m.pts=v.pts,m.dts=v.dts;else{f.logs.push({level:"warn",message:"We've encountered a nal unit without data at "+y+" for trackId "+d+". See mux.js#223."});break}f.seiNals.push(m);break}return f},Mf=function(o,u){var d={},h=Af(o);return h.forEach(function(f){var m=f.mdat,y=f.traf,T=dr(y,["tfhd"]),v=Pf(T[0]),b=v.trackId,C=dr(y,["tfdt"]),A=C.length>0?If(C[0]).baseMediaDecodeTime:0,H=dr(y,["trun"]),M,z;u===b&&H.length>0&&(M=Lf(H,A,v),z=Of(m,M,b),d[b]||(d[b]={seiNals:[],logs:[]}),d[b].seiNals=d[b].seiNals.concat(z.seiNals),d[b].logs=d[b].logs.concat(z.logs))}),d},Rf=function(o,u,d){var h;if(u===null)return null;h=Mf(o,u);var f=h[u]||{};return{seiNals:f.seiNals,logs:f.logs,timescale:d}},Bf=function(){var o=!1,u,d,h,f,m,y;this.isInitialized=function(){return o},this.init=function(T){u=new kf,o=!0,y=T?T.isPartial:!1,u.on("data",function(v){v.startTime=v.startPts/f,v.endTime=v.endPts/f,m.captions.push(v),m.captionStreams[v.stream]=!0}),u.on("log",function(v){m.logs.push(v)})},this.isNewInit=function(T,v){return T&&T.length===0||v&&typeof v=="object"&&Object.keys(v).length===0?!1:h!==T[0]||f!==v[h]},this.parse=function(T,v,b){var C;if(this.isInitialized()){if(!v||!b)return null;if(this.isNewInit(v,b))h=v[0],f=b[h];else if(h===null||!f)return d.push(T),null}else return null;for(;d.length>0;){var A=d.shift();this.parse(A,v,b)}return C=Rf(T,h,f),C&&C.logs&&(m.logs=m.logs.concat(C.logs)),C===null||!C.seiNals?m.logs.length?{logs:m.logs,captions:[],captionStreams:[]}:null:(this.pushNals(C.seiNals),this.flushStream(),m)},this.pushNals=function(T){if(!this.isInitialized()||!T||T.length===0)return null;T.forEach(function(v){u.push(v)})},this.flushStream=function(){if(!this.isInitialized())return null;y?u.partialFlush():u.flush()},this.clearParsedCaptions=function(){m.captions=[],m.captionStreams={},m.logs=[]},this.resetCaptionStream=function(){if(!this.isInitialized())return null;u.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){d=[],h=null,f=null,m?this.clearParsedCaptions():m={captions:[],captionStreams:{},logs:[]},this.resetCaptionStream()},this.reset()},Ff=Bf;const{parseTfdt:Nf}=Eo,xt=ar,{getTimescaleFromMediaHeader:Uf}=Vi,{parseSamples:jf,getMdatTrafPairs:$f}=Bo;var Fo=function(){let o=9e4;this.init=function(u){const d=xt(u,["moov","trak","mdia","mdhd"])[0];d&&(o=Uf(d))},this.parseSegment=function(u){const d=[],h=$f(u);let f=0;return h.forEach(function(m){const y=m.mdat,T=m.traf,v=xt(T,["tfdt"])[0],b=xt(T,["tfhd"])[0],C=xt(T,["trun"]);if(v&&(f=Nf(v).baseMediaDecodeTime),C.length&&b){const A=jf(C,f,b);let H=0;A.forEach(function(M){const z="utf-8",Q=new TextDecoder(z),ye=y.slice(H,H+M.size);if(xt(ye,["vtte"])[0]){H+=M.size;return}xt(ye,["vttc"]).forEach(function(qi){const zi=xt(qi,["payl"])[0],Wi=xt(qi,["sttg"])[0],Gi=M.pts/o,Qs=(M.pts+M.duration)/o;let oe,Ki;if(zi)try{oe=Q.decode(zi)}catch(Xe){console.error(Xe)}if(Wi)try{Ki=Q.decode(Wi)}catch(Xe){console.error(Xe)}M.duration&&oe&&d.push({cueText:oe,start:Gi,end:Qs,settings:Ki})}),H+=M.size})}}),d}},cr=Ps,No=function(o){var u=o[1]&31;return u<<=8,u|=o[2],u},Gs=function(o){return!!(o[1]&64)},Ks=function(o){var u=0;return(o[3]&48)>>>4>1&&(u+=o[4]+1),u},Hf=function(o,u){var d=No(o);return d===0?"pat":d===u?"pmt":u?"pes":null},Vf=function(o){var u=Gs(o),d=4+Ks(o);return u&&(d+=o[d]+1),(o[d+10]&31)<<8|o[d+11]},qf=function(o){var u={},d=Gs(o),h=4+Ks(o);if(d&&(h+=o[h]+1),!!(o[h+5]&1)){var f,m,y;f=(o[h+1]&15)<<8|o[h+2],m=3+f-4,y=(o[h+10]&15)<<8|o[h+11];for(var T=12+y;T<m;){var v=h+T;u[(o[v+1]&31)<<8|o[v+2]]=o[v],T+=((o[v+3]&15)<<8|o[v+4])+5}return u}},zf=function(o,u){var d=No(o),h=u[d];switch(h){case cr.H264_STREAM_TYPE:return"video";case cr.ADTS_STREAM_TYPE:return"audio";case cr.METADATA_STREAM_TYPE:return"timed-metadata";default:return null}},Wf=function(o){var u=Gs(o);if(!u)return null;var d=4+Ks(o);if(d>=o.byteLength)return null;var h=null,f;return f=o[d+7],f&192&&(h={},h.pts=(o[d+9]&14)<<27|(o[d+10]&255)<<20|(o[d+11]&254)<<12|(o[d+12]&255)<<5|(o[d+13]&254)>>>3,h.pts*=4,h.pts+=(o[d+13]&6)>>>1,h.dts=h.pts,f&64&&(h.dts=(o[d+14]&14)<<27|(o[d+15]&255)<<20|(o[d+16]&254)<<12|(o[d+17]&255)<<5|(o[d+18]&254)>>>3,h.dts*=4,h.dts+=(o[d+18]&6)>>>1)),h},fr=function(o){switch(o){case 5:return"slice_layer_without_partitioning_rbsp_idr";case 6:return"sei_rbsp";case 7:return"seq_parameter_set_rbsp";case 8:return"pic_parameter_set_rbsp";case 9:return"access_unit_delimiter_rbsp";default:return null}},Gf=function(o){for(var u=4+Ks(o),d=o.subarray(u),h=0,f=0,m=!1,y;f<d.byteLength-3;f++)if(d[f+2]===1){h=f+5;break}for(;h<d.byteLength;)switch(d[h]){case 0:if(d[h-1]!==0){h+=2;break}else if(d[h-2]!==0){h++;break}f+3!==h-2&&(y=fr(d[f+3]&31),y==="slice_layer_without_partitioning_rbsp_idr"&&(m=!0));do h++;while(d[h]!==1&&h<d.length);f=h-2,h+=3;break;case 1:if(d[h-1]!==0||d[h-2]!==0){h+=3;break}y=fr(d[f+3]&31),y==="slice_layer_without_partitioning_rbsp_idr"&&(m=!0),f=h-2,h+=3;break;default:h+=3;break}return d=d.subarray(f),h-=f,f=0,d&&d.byteLength>3&&(y=fr(d[f+3]&31),y==="slice_layer_without_partitioning_rbsp_idr"&&(m=!0)),m},Kf={parseType:Hf,parsePat:Vf,parsePmt:qf,parsePayloadUnitStartIndicator:Gs,parsePesType:zf,parsePesTime:Wf,videoPacketContainsKeyFrame:Gf},Uo=Ps,ii=eo.handleRollover,ie={};ie.ts=Kf,ie.aac=rr;var jt=ae.ONE_SECOND_IN_TS,we=188,et=71,Qf=function(o,u){for(var d=0,h=we,f,m;h<o.byteLength;){if(o[d]===et&&o[h]===et){switch(f=o.subarray(d,h),m=ie.ts.parseType(f,u.pid),m){case"pat":u.pid=ie.ts.parsePat(f);break;case"pmt":var y=ie.ts.parsePmt(f);u.table=u.table||{},Object.keys(y).forEach(function(T){u.table[T]=y[T]});break}d+=we,h+=we;continue}d++,h++}},jo=function(o,u,d){for(var h=0,f=we,m,y,T,v,b,C=!1;f<=o.byteLength;){if(o[h]===et&&(o[f]===et||f===o.byteLength)){switch(m=o.subarray(h,f),y=ie.ts.parseType(m,u.pid),y){case"pes":T=ie.ts.parsePesType(m,u.table),v=ie.ts.parsePayloadUnitStartIndicator(m),T==="audio"&&v&&(b=ie.ts.parsePesTime(m),b&&(b.type="audio",d.audio.push(b),C=!0));break}if(C)break;h+=we,f+=we;continue}h++,f++}for(f=o.byteLength,h=f-we,C=!1;h>=0;){if(o[h]===et&&(o[f]===et||f===o.byteLength)){switch(m=o.subarray(h,f),y=ie.ts.parseType(m,u.pid),y){case"pes":T=ie.ts.parsePesType(m,u.table),v=ie.ts.parsePayloadUnitStartIndicator(m),T==="audio"&&v&&(b=ie.ts.parsePesTime(m),b&&(b.type="audio",d.audio.push(b),C=!0));break}if(C)break;h-=we,f-=we;continue}h--,f--}},Xf=function(o,u,d){for(var h=0,f=we,m,y,T,v,b,C,A,H,M=!1,z={data:[],size:0};f<o.byteLength;){if(o[h]===et&&o[f]===et){switch(m=o.subarray(h,f),y=ie.ts.parseType(m,u.pid),y){case"pes":if(T=ie.ts.parsePesType(m,u.table),v=ie.ts.parsePayloadUnitStartIndicator(m),T==="video"&&(v&&!M&&(b=ie.ts.parsePesTime(m),b&&(b.type="video",d.video.push(b),M=!0)),!d.firstKeyFrame)){if(v&&z.size!==0){for(C=new Uint8Array(z.size),A=0;z.data.length;)H=z.data.shift(),C.set(H,A),A+=H.byteLength;if(ie.ts.videoPacketContainsKeyFrame(C)){var Q=ie.ts.parsePesTime(C);Q?(d.firstKeyFrame=Q,d.firstKeyFrame.type="video"):console.warn("Failed to extract PTS/DTS from PES at first keyframe. This could be an unusual TS segment, or else mux.js did not parse your TS segment correctly. If you know your TS segments do contain PTS/DTS on keyframes please file a bug report! You can try ffprobe to double check for yourself.")}z.size=0}z.data.push(m),z.size+=m.byteLength}break}if(M&&d.firstKeyFrame)break;h+=we,f+=we;continue}h++,f++}for(f=o.byteLength,h=f-we,M=!1;h>=0;){if(o[h]===et&&o[f]===et){switch(m=o.subarray(h,f),y=ie.ts.parseType(m,u.pid),y){case"pes":T=ie.ts.parsePesType(m,u.table),v=ie.ts.parsePayloadUnitStartIndicator(m),T==="video"&&v&&(b=ie.ts.parsePesTime(m),b&&(b.type="video",d.video.push(b),M=!0));break}if(M)break;h-=we,f-=we;continue}h--,f--}},Yf=function(o,u){if(o.audio&&o.audio.length){var d=u;(typeof d>"u"||isNaN(d))&&(d=o.audio[0].dts),o.audio.forEach(function(m){m.dts=ii(m.dts,d),m.pts=ii(m.pts,d),m.dtsTime=m.dts/jt,m.ptsTime=m.pts/jt})}if(o.video&&o.video.length){var h=u;if((typeof h>"u"||isNaN(h))&&(h=o.video[0].dts),o.video.forEach(function(m){m.dts=ii(m.dts,h),m.pts=ii(m.pts,h),m.dtsTime=m.dts/jt,m.ptsTime=m.pts/jt}),o.firstKeyFrame){var f=o.firstKeyFrame;f.dts=ii(f.dts,h),f.pts=ii(f.pts,h),f.dtsTime=f.dts/jt,f.ptsTime=f.pts/jt}}},Jf=function(o){for(var u=!1,d=0,h=null,f=null,m=0,y=0,T;o.length-y>=3;){var v=ie.aac.parseType(o,y);switch(v){case"timed-metadata":if(o.length-y<10){u=!0;break}if(m=ie.aac.parseId3TagSize(o,y),m>o.length){u=!0;break}f===null&&(T=o.subarray(y,y+m),f=ie.aac.parseAacTimestamp(T)),y+=m;break;case"audio":if(o.length-y<7){u=!0;break}if(m=ie.aac.parseAdtsSize(o,y),m>o.length){u=!0;break}h===null&&(T=o.subarray(y,y+m),h=ie.aac.parseSampleRate(T)),d++,y+=m;break;default:y++;break}if(u)return null}if(h===null||f===null)return null;var b=jt/h,C={audio:[{type:"audio",dts:f,pts:f},{type:"audio",dts:f+d*1024*b,pts:f+d*1024*b}]};return C},Zf=function(o){var u={pid:null,table:null},d={};Qf(o,u);for(var h in u.table)if(u.table.hasOwnProperty(h)){var f=u.table[h];switch(f){case Uo.H264_STREAM_TYPE:d.video=[],Xf(o,u,d),d.video.length===0&&delete d.video;break;case Uo.ADTS_STREAM_TYPE:d.audio=[],jo(o,u,d),d.audio.length===0&&delete d.audio;break}}return d},ep=function(o,u){var d=ie.aac.isLikelyAacData(o),h;return d?h=Jf(o):h=Zf(o),!h||!h.audio&&!h.video?null:(Yf(h,u),h)},tp={inspect:ep,parseAudioPes_:jo};const ip=function(o,u){u.on("data",function(d){const h=d.initSegment;d.initSegment={data:h.buffer,byteOffset:h.byteOffset,byteLength:h.byteLength};const f=d.data;d.data=f.buffer,o.postMessage({action:"data",segment:d,byteOffset:f.byteOffset,byteLength:f.byteLength},[d.data])}),u.on("done",function(d){o.postMessage({action:"done"})}),u.on("gopInfo",function(d){o.postMessage({action:"gopInfo",gopInfo:d})}),u.on("videoSegmentTimingInfo",function(d){const h={start:{decode:ae.videoTsToSeconds(d.start.dts),presentation:ae.videoTsToSeconds(d.start.pts)},end:{decode:ae.videoTsToSeconds(d.end.dts),presentation:ae.videoTsToSeconds(d.end.pts)},baseMediaDecodeTime:ae.videoTsToSeconds(d.baseMediaDecodeTime)};d.prependedContentDuration&&(h.prependedContentDuration=ae.videoTsToSeconds(d.prependedContentDuration)),o.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:h})}),u.on("audioSegmentTimingInfo",function(d){const h={start:{decode:ae.videoTsToSeconds(d.start.dts),presentation:ae.videoTsToSeconds(d.start.pts)},end:{decode:ae.videoTsToSeconds(d.end.dts),presentation:ae.videoTsToSeconds(d.end.pts)},baseMediaDecodeTime:ae.videoTsToSeconds(d.baseMediaDecodeTime)};d.prependedContentDuration&&(h.prependedContentDuration=ae.videoTsToSeconds(d.prependedContentDuration)),o.postMessage({action:"audioSegmentTimingInfo",audioSegmentTimingInfo:h})}),u.on("id3Frame",function(d){o.postMessage({action:"id3Frame",id3Frame:d})}),u.on("caption",function(d){o.postMessage({action:"caption",caption:d})}),u.on("trackinfo",function(d){o.postMessage({action:"trackinfo",trackInfo:d})}),u.on("audioTimingInfo",function(d){o.postMessage({action:"audioTimingInfo",audioTimingInfo:{start:ae.videoTsToSeconds(d.start),end:ae.videoTsToSeconds(d.end)}})}),u.on("videoTimingInfo",function(d){o.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:ae.videoTsToSeconds(d.start),end:ae.videoTsToSeconds(d.end)}})}),u.on("log",function(d){o.postMessage({action:"log",log:d})})};class $o{constructor(u,d){this.options=d||{},this.self=u,this.init()}init(){this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new Yc.Transmuxer(this.options),ip(this.self,this.transmuxer)}pushMp4Captions(u){this.captionParser||(this.captionParser=new Ff,this.captionParser.init());const d=new Uint8Array(u.data,u.byteOffset,u.byteLength),h=this.captionParser.parse(d,u.trackIds,u.timescales);this.self.postMessage({action:"mp4Captions",captions:h&&h.captions||[],logs:h&&h.logs||[],data:d.buffer},[d.buffer])}initMp4WebVttParser(u){this.webVttParser||(this.webVttParser=new Fo);const d=new Uint8Array(u.data,u.byteOffset,u.byteLength);this.webVttParser.init(d)}getMp4WebVttText(u){this.webVttParser||(this.webVttParser=new Fo);const d=new Uint8Array(u.data,u.byteOffset,u.byteLength),h=this.webVttParser.parseSegment(d);this.self.postMessage({action:"getMp4WebVttText",mp4VttCues:h||[],data:d.buffer},[d.buffer])}probeMp4StartTime({timescales:u,data:d}){const h=Vi.startTime(u,d);this.self.postMessage({action:"probeMp4StartTime",startTime:h,data:d},[d.buffer])}probeMp4Tracks({data:u}){const d=Vi.tracks(u);this.self.postMessage({action:"probeMp4Tracks",tracks:d,data:u},[u.buffer])}probeEmsgID3({data:u,offset:d}){const h=Vi.getEmsgID3(u,d);this.self.postMessage({action:"probeEmsgID3",id3Frames:h,emsgData:u},[u.buffer])}probeTs({data:u,baseStartTime:d}){const h=typeof d=="number"&&!isNaN(d)?d*ae.ONE_SECOND_IN_TS:void 0,f=tp.inspect(u,h);let m=null;f&&(m={hasVideo:f.video&&f.video.length===2||!1,hasAudio:f.audio&&f.audio.length===2||!1},m.hasVideo&&(m.videoStart=f.video[0].ptsTime),m.hasAudio&&(m.audioStart=f.audio[0].ptsTime)),this.self.postMessage({action:"probeTs",result:m,data:u},[u.buffer])}clearAllMp4Captions(){this.captionParser&&this.captionParser.clearAllCaptions()}clearParsedMp4Captions(){this.captionParser&&this.captionParser.clearParsedCaptions()}push(u){const d=new Uint8Array(u.data,u.byteOffset,u.byteLength);this.transmuxer.push(d)}reset(){this.transmuxer.reset()}setTimestampOffset(u){const d=u.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(ae.secondsToVideoTs(d)))}setAudioAppendStart(u){this.transmuxer.setAudioAppendStart(Math.ceil(ae.secondsToVideoTs(u.appendStart)))}setRemux(u){this.transmuxer.setRemux(u.remux)}flush(u){this.transmuxer.flush(),self.postMessage({action:"done",type:"transmuxed"})}endTimeline(){this.transmuxer.endTimeline(),self.postMessage({action:"endedtimeline",type:"transmuxed"})}alignGopsWith(u){this.transmuxer.alignGopsWith(u.gopsToAlignWith.slice())}}self.onmessage=function(o){if(o.data.action==="init"&&o.data.options){this.messageHandlers=new $o(self,o.data.options);return}this.messageHandlers||(this.messageHandlers=new $o(self)),o.data&&o.data.action&&o.data.action!=="init"&&this.messageHandlers[o.data.action]&&this.messageHandlers[o.data.action](o.data)}}));var J0=od(Y0);const Z0=(s,e,t)=>{const{type:i,initSegment:n,captions:r,captionStreams:a,metadata:l,videoFrameDtsTime:c,videoFramePtsTime:p}=s.data.segment;e.buffer.push({captions:r,captionStreams:a,metadata:l});const g=s.data.segment.boxes||{data:s.data.segment.data},_={type:i,data:new Uint8Array(g.data,g.data.byteOffset,g.data.byteLength),initSegment:new Uint8Array(n.data,n.byteOffset,n.byteLength)};typeof c<"u"&&(_.videoFrameDtsTime=c),typeof p<"u"&&(_.videoFramePtsTime=p),t(_)},e_=({transmuxedData:s,callback:e})=>{s.buffer=[],e(s)},t_=(s,e)=>{e.gopInfo=s.data.gopInfo},hd=s=>{const{transmuxer:e,bytes:t,audioAppendStart:i,gopsToAlignWith:n,remux:r,onData:a,onTrackInfo:l,onAudioTimingInfo:c,onVideoTimingInfo:p,onVideoSegmentTimingInfo:g,onAudioSegmentTimingInfo:_,onId3:S,onCaptions:E,onDone:w,onEndedTimeline:I,onTransmuxerLog:L,isEndOfTimeline:P,segment:F,triggerSegmentEventFn:$}=s,B={buffer:[]};let O=P;const j=U=>{e.currentTransmux===s&&(U.data.action==="data"&&Z0(U,B,a),U.data.action==="trackinfo"&&l(U.data.trackInfo),U.data.action==="gopInfo"&&t_(U,B),U.data.action==="audioTimingInfo"&&c(U.data.audioTimingInfo),U.data.action==="videoTimingInfo"&&p(U.data.videoTimingInfo),U.data.action==="videoSegmentTimingInfo"&&g(U.data.videoSegmentTimingInfo),U.data.action==="audioSegmentTimingInfo"&&_(U.data.audioSegmentTimingInfo),U.data.action==="id3Frame"&&S([U.data.id3Frame],U.data.id3Frame.dispatchType),U.data.action==="caption"&&E(U.data.caption),U.data.action==="endedtimeline"&&(O=!1,I()),U.data.action==="log"&&L(U.data.log),U.data.type==="transmuxed"&&(O||(e.onmessage=null,e_({transmuxedData:B,callback:w}),dd(e))))},R=()=>{const U={message:"Received an error message from the transmuxer worker",metadata:{errorType:k.Error.StreamingFailedToTransmuxSegment,segmentInfo:Vt({segment:F})}};w(null,U)};if(e.onmessage=j,e.onerror=R,i&&e.postMessage({action:"setAudioAppendStart",appendStart:i}),Array.isArray(n)&&e.postMessage({action:"alignGopsWith",gopsToAlignWith:n}),typeof r<"u"&&e.postMessage({action:"setRemux",remux:r}),t.byteLength){const U=t instanceof ArrayBuffer?t:t.buffer,Y=t instanceof ArrayBuffer?0:t.byteOffset;$({type:"segmenttransmuxingstart",segment:F}),e.postMessage({action:"push",data:U,byteOffset:Y,byteLength:t.byteLength},[U])}P&&e.postMessage({action:"endTimeline"}),e.postMessage({action:"flush"})},dd=s=>{s.currentTransmux=null,s.transmuxQueue.length&&(s.currentTransmux=s.transmuxQueue.shift(),typeof s.currentTransmux=="function"?s.currentTransmux():hd(s.currentTransmux))},Ml=(s,e)=>{s.postMessage({action:e}),dd(s)},cd=(s,e)=>{if(!e.currentTransmux){e.currentTransmux=s,Ml(e,s);return}e.transmuxQueue.push(Ml.bind(null,e,s))},i_=s=>{cd("reset",s)},s_=s=>{cd("endTimeline",s)},fd=s=>{if(!s.transmuxer.currentTransmux){s.transmuxer.currentTransmux=s,hd(s);return}s.transmuxer.transmuxQueue.push(s)},n_=s=>{const e=new J0;e.currentTransmux=null,e.transmuxQueue=[];const t=e.terminate;return e.terminate=()=>(e.currentTransmux=null,e.transmuxQueue.length=0,t.call(e)),e.postMessage({action:"init",options:s}),e};var Lr={reset:i_,endTimeline:s_,transmux:fd,createTransmuxer:n_};const fi=function(s){const e=s.transmuxer,t=s.endAction||s.action,i=s.callback,n=ve({},s,{endAction:null,transmuxer:null,callback:null}),r=a=>{a.data.action===t&&(e.removeEventListener("message",r),a.data.data&&(a.data.data=new Uint8Array(a.data.data,s.byteOffset||0,s.byteLength||a.data.data.byteLength),s.data&&(s.data=a.data.data)),i(a.data))};if(e.addEventListener("message",r),s.data){const a=s.data instanceof ArrayBuffer;n.byteOffset=a?0:s.data.byteOffset,n.byteLength=s.data.byteLength;const l=[a?s.data:s.data.buffer];e.postMessage(n,l)}else e.postMessage(n)},ot={FAILURE:2,TIMEOUT:-101,ABORTED:-102},pd="wvtt",ta=s=>{s.forEach(e=>{e.abort()})},r_=s=>({bandwidth:s.bandwidth,bytesReceived:s.bytesReceived||0,roundTripTime:s.roundTripTime||0}),a_=s=>{const e=s.target,i={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-e.requestTime||0};return i.bytesReceived=s.loaded,i.bandwidth=Math.floor(i.bytesReceived/i.roundTripTime*8*1e3),i},$a=(s,e)=>{const{requestType:t}=e,i=Xt({requestType:t,request:e,error:s});return e.timedout?{status:e.status,message:"HLS request timed-out at URL: "+e.uri,code:ot.TIMEOUT,xhr:e,metadata:i}:e.aborted?{status:e.status,message:"HLS request aborted at URL: "+e.uri,code:ot.ABORTED,xhr:e,metadata:i}:s?{status:e.status,message:"HLS request errored at URL: "+e.uri,code:ot.FAILURE,xhr:e,metadata:i}:e.responseType==="arraybuffer"&&e.response.byteLength===0?{status:e.status,message:"Empty HLS response at URL: "+e.uri,code:ot.FAILURE,xhr:e,metadata:i}:null},Rl=(s,e,t,i)=>(n,r)=>{const a=r.response,l=$a(n,r);if(l)return t(l,s);if(a.byteLength!==16)return t({status:r.status,message:"Invalid HLS key at URL: "+r.uri,code:ot.FAILURE,xhr:r},s);const c=new DataView(a),p=new Uint32Array([c.getUint32(0),c.getUint32(4),c.getUint32(8),c.getUint32(12)]);for(let _=0;_<e.length;_++)e[_].bytes=p;const g={uri:r.uri};return i({type:"segmentkeyloadcomplete",segment:s,keyInfo:g}),t(null,s)},o_=(s,e)=>{e===pd&&s.transmuxer.postMessage({action:"initMp4WebVttParser",data:s.map.bytes})},l_=(s,e,t)=>{e===pd&&fi({action:"getMp4WebVttText",data:s.bytes,transmuxer:s.transmuxer,callback:({data:i,mp4VttCues:n})=>{s.bytes=i,t(null,s,{mp4VttCues:n})}})},md=(s,e)=>{const t=ha(s.map.bytes);if(t!=="mp4"){const i=s.map.resolvedUri||s.map.uri,n=t||"unknown";return e({internal:!0,message:`Found unsupported ${n} container for initialization segment at URL: ${i}`,code:ot.FAILURE,metadata:{mediaType:n}})}fi({action:"probeMp4Tracks",data:s.map.bytes,transmuxer:s.transmuxer,callback:({tracks:i,data:n})=>(s.map.bytes=n,i.forEach(function(r){s.map.tracks=s.map.tracks||{},!s.map.tracks[r.type]&&(s.map.tracks[r.type]=r,typeof r.id=="number"&&r.timescale&&(s.map.timescales=s.map.timescales||{},s.map.timescales[r.id]=r.timescale),r.type==="text"&&o_(s,r.codec))}),e(null))})},u_=({segment:s,finishProcessingFn:e,triggerSegmentEventFn:t})=>(i,n)=>{const r=$a(i,n);if(r)return e(r,s);const a=new Uint8Array(n.response);if(t({type:"segmentloaded",segment:s}),s.map.key)return s.map.encryptedBytes=a,e(null,s);s.map.bytes=a,md(s,function(l){if(l)return l.xhr=n,l.status=n.status,e(l,s);e(null,s)})},h_=({segment:s,finishProcessingFn:e,responseType:t,triggerSegmentEventFn:i})=>(n,r)=>{const a=$a(n,r);if(a)return e(a,s);i({type:"segmentloaded",segment:s});const l=t==="arraybuffer"||!r.responseText?r.response:Q0(r.responseText.substring(s.lastReachedChar||0));return s.stats=r_(r),s.key?s.encryptedBytes=new Uint8Array(l):s.bytes=new Uint8Array(l),e(null,s)},d_=({segment:s,bytes:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:r,id3Fn:a,captionsFn:l,isEndOfTimeline:c,endedTimelineFn:p,dataFn:g,doneFn:_,onTransmuxerLog:S,triggerSegmentEventFn:E})=>{const w=s.map&&s.map.tracks||{},I=!!(w.audio&&w.video);let L=i.bind(null,s,"audio","start");const P=i.bind(null,s,"audio","end");let F=i.bind(null,s,"video","start");const $=i.bind(null,s,"video","end"),B=()=>fd({bytes:e,transmuxer:s.transmuxer,audioAppendStart:s.audioAppendStart,gopsToAlignWith:s.gopsToAlignWith,remux:I,onData:O=>{O.type=O.type==="combined"?"video":O.type,g(s,O)},onTrackInfo:O=>{t&&(I&&(O.isMuxed=!0),t(s,O))},onAudioTimingInfo:O=>{L&&typeof O.start<"u"&&(L(O.start),L=null),P&&typeof O.end<"u"&&P(O.end)},onVideoTimingInfo:O=>{F&&typeof O.start<"u"&&(F(O.start),F=null),$&&typeof O.end<"u"&&$(O.end)},onVideoSegmentTimingInfo:O=>{const j={pts:{start:O.start.presentation,end:O.end.presentation},dts:{start:O.start.decode,end:O.end.decode}};E({type:"segmenttransmuxingtiminginfoavailable",segment:s,timingInfo:j}),n(O)},onAudioSegmentTimingInfo:O=>{const j={pts:{start:O.start.pts,end:O.end.pts},dts:{start:O.start.dts,end:O.end.dts}};E({type:"segmenttransmuxingtiminginfoavailable",segment:s,timingInfo:j}),r(O)},onId3:(O,j)=>{a(s,O,j)},onCaptions:O=>{l(s,[O])},isEndOfTimeline:c,onEndedTimeline:()=>{p()},onTransmuxerLog:S,onDone:(O,j)=>{_&&(O.type=O.type==="combined"?"video":O.type,E({type:"segmenttransmuxingcomplete",segment:s}),_(j,s,O))},segment:s,triggerSegmentEventFn:E});fi({action:"probeTs",transmuxer:s.transmuxer,data:e,baseStartTime:s.baseStartTime,callback:O=>{s.bytes=e=O.data;const j=O.result;j&&(t(s,{hasAudio:j.hasAudio,hasVideo:j.hasVideo,isMuxed:I}),t=null),B()}})},gd=({segment:s,bytes:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:r,id3Fn:a,captionsFn:l,isEndOfTimeline:c,endedTimelineFn:p,dataFn:g,doneFn:_,onTransmuxerLog:S,triggerSegmentEventFn:E})=>{let w=new Uint8Array(e);if(Om(w)){s.isFmp4=!0;const{tracks:I}=s.map;if(I.text&&(!I.audio||!I.video)){g(s,{data:w,type:"text"}),l_(s,I.text.codec,_);return}const P={isFmp4:!0,hasVideo:!!I.video,hasAudio:!!I.audio};I.audio&&I.audio.codec&&I.audio.codec!=="enca"&&(P.audioCodec=I.audio.codec),I.video&&I.video.codec&&I.video.codec!=="encv"&&(P.videoCodec=I.video.codec),I.video&&I.audio&&(P.isMuxed=!0),t(s,P);const F=($,B)=>{g(s,{data:w,type:P.hasAudio&&!P.isMuxed?"audio":"video"}),B&&B.length&&a(s,B),$&&$.length&&l(s,$),_(null,s,{})};fi({action:"probeMp4StartTime",timescales:s.map.timescales,data:w,transmuxer:s.transmuxer,callback:({data:$,startTime:B})=>{e=$.buffer,s.bytes=w=$,P.hasAudio&&!P.isMuxed&&i(s,"audio","start",B),P.hasVideo&&i(s,"video","start",B),fi({action:"probeEmsgID3",data:w,transmuxer:s.transmuxer,offset:B,callback:({emsgData:O,id3Frames:j})=>{if(e=O.buffer,s.bytes=w=O,!I.video||!O.byteLength||!s.transmuxer){F(void 0,j);return}fi({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:s.transmuxer,data:w,timescales:s.map.timescales,trackIds:[I.video.id],callback:R=>{e=R.data.buffer,s.bytes=w=R.data,R.logs.forEach(function(U){S(Z(U,{stream:"mp4CaptionParser"}))}),F(R.captions,j)}})}})}});return}if(!s.transmuxer){_(null,s,{});return}if(typeof s.container>"u"&&(s.container=ha(w)),s.container!=="ts"&&s.container!=="aac"){t(s,{hasAudio:!1,hasVideo:!1}),_(null,s,{});return}d_({segment:s,bytes:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:r,id3Fn:a,captionsFn:l,isEndOfTimeline:c,endedTimelineFn:p,dataFn:g,doneFn:_,onTransmuxerLog:S,triggerSegmentEventFn:E})},_d=function({id:s,key:e,encryptedBytes:t,decryptionWorker:i,segment:n,doneFn:r},a){const l=p=>{if(p.data.source===s){i.removeEventListener("message",l);const g=p.data.decrypted;a(new Uint8Array(g.bytes,g.byteOffset,g.byteLength))}};i.onerror=()=>{const p="An error occurred in the decryption worker",g=Vt({segment:n}),_={message:p,metadata:{error:new Error(p),errorType:k.Error.StreamingFailedToDecryptSegment,segmentInfo:g,keyInfo:{uri:n.key.resolvedUri||n.map.key.resolvedUri}}};r(_,n)},i.addEventListener("message",l);let c;e.bytes.slice?c=e.bytes.slice():c=new Uint32Array(Array.prototype.slice.call(e.bytes)),i.postMessage(td({source:s,encrypted:t,key:c,iv:e.iv}),[t.buffer,c.buffer])},c_=({decryptionWorker:s,segment:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:r,id3Fn:a,captionsFn:l,isEndOfTimeline:c,endedTimelineFn:p,dataFn:g,doneFn:_,onTransmuxerLog:S,triggerSegmentEventFn:E})=>{E({type:"segmentdecryptionstart"}),_d({id:e.requestId,key:e.key,encryptedBytes:e.encryptedBytes,decryptionWorker:s,segment:e,doneFn:_},w=>{e.bytes=w,E({type:"segmentdecryptioncomplete",segment:e}),gd({segment:e,bytes:e.bytes,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:r,id3Fn:a,captionsFn:l,isEndOfTimeline:c,endedTimelineFn:p,dataFn:g,doneFn:_,onTransmuxerLog:S,triggerSegmentEventFn:E})})},f_=({activeXhrs:s,decryptionWorker:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:r,id3Fn:a,captionsFn:l,isEndOfTimeline:c,endedTimelineFn:p,dataFn:g,doneFn:_,onTransmuxerLog:S,triggerSegmentEventFn:E})=>{let w=0,I=!1;return(L,P)=>{if(!I){if(L)return I=!0,ta(s),_(L,P);if(w+=1,w===s.length){const F=function(){if(P.encryptedBytes)return c_({decryptionWorker:e,segment:P,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:r,id3Fn:a,captionsFn:l,isEndOfTimeline:c,endedTimelineFn:p,dataFn:g,doneFn:_,onTransmuxerLog:S,triggerSegmentEventFn:E});gd({segment:P,bytes:P.bytes,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:r,id3Fn:a,captionsFn:l,isEndOfTimeline:c,endedTimelineFn:p,dataFn:g,doneFn:_,onTransmuxerLog:S,triggerSegmentEventFn:E})};if(P.endOfAllRequests=Date.now(),P.map&&P.map.encryptedBytes&&!P.map.bytes)return E({type:"segmentdecryptionstart",segment:P}),_d({decryptionWorker:e,id:P.requestId+"-init",encryptedBytes:P.map.encryptedBytes,key:P.map.key,segment:P,doneFn:_},$=>{P.map.bytes=$,E({type:"segmentdecryptioncomplete",segment:P}),md(P,B=>{if(B)return ta(s),_(B,P);F()})});F()}}}},p_=({loadendState:s,abortFn:e})=>t=>{t.target.aborted&&e&&!s.calledAbortFn&&(e(),s.calledAbortFn=!0)},m_=({segment:s,progressFn:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:r,id3Fn:a,captionsFn:l,isEndOfTimeline:c,endedTimelineFn:p,dataFn:g})=>_=>{if(!_.target.aborted)return s.stats=Z(s.stats,a_(_)),!s.stats.firstBytesReceivedAt&&s.stats.bytesReceived&&(s.stats.firstBytesReceivedAt=Date.now()),e(_,s)},g_=({xhr:s,xhrOptions:e,decryptionWorker:t,segment:i,abortFn:n,progressFn:r,trackInfoFn:a,timingInfoFn:l,videoSegmentTimingInfoFn:c,audioSegmentTimingInfoFn:p,id3Fn:g,captionsFn:_,isEndOfTimeline:S,endedTimelineFn:E,dataFn:w,doneFn:I,onTransmuxerLog:L,triggerSegmentEventFn:P})=>{const F=[],$=f_({activeXhrs:F,decryptionWorker:t,trackInfoFn:a,timingInfoFn:l,videoSegmentTimingInfoFn:c,audioSegmentTimingInfoFn:p,id3Fn:g,captionsFn:_,isEndOfTimeline:S,endedTimelineFn:E,dataFn:w,doneFn:I,onTransmuxerLog:L,triggerSegmentEventFn:P});if(i.key&&!i.key.bytes){const U=[i.key];i.map&&!i.map.bytes&&i.map.key&&i.map.key.resolvedUri===i.key.resolvedUri&&U.push(i.map.key);const Y=Z(e,{uri:i.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),le=Rl(i,U,$,P),_e={uri:i.key.resolvedUri};P({type:"segmentkeyloadstart",segment:i,keyInfo:_e});const ue=s(Y,le);F.push(ue)}if(i.map&&!i.map.bytes){if(i.map.key&&(!i.key||i.key.resolvedUri!==i.map.key.resolvedUri)){const ue=Z(e,{uri:i.map.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),q=Rl(i,[i.map.key],$,P),ee={uri:i.map.key.resolvedUri};P({type:"segmentkeyloadstart",segment:i,keyInfo:ee});const He=s(ue,q);F.push(He)}const Y=Z(e,{uri:i.map.resolvedUri,responseType:"arraybuffer",headers:Zr(i.map),requestType:"segment-media-initialization"}),le=u_({segment:i,finishProcessingFn:$,triggerSegmentEventFn:P});P({type:"segmentloadstart",segment:i});const _e=s(Y,le);F.push(_e)}const B=Z(e,{uri:i.part&&i.part.resolvedUri||i.resolvedUri,responseType:"arraybuffer",headers:Zr(i),requestType:"segment"}),O=h_({segment:i,finishProcessingFn:$,responseType:B.responseType,triggerSegmentEventFn:P});P({type:"segmentloadstart",segment:i});const j=s(B,O);j.addEventListener("progress",m_({segment:i,progressFn:r,trackInfoFn:a,timingInfoFn:l,videoSegmentTimingInfoFn:c,audioSegmentTimingInfoFn:p,id3Fn:g,captionsFn:_,isEndOfTimeline:S,endedTimelineFn:E,dataFn:w})),F.push(j);const R={};return F.forEach(U=>{U.addEventListener("loadend",p_({loadendState:R,abortFn:n}))}),()=>ta(F)},Zs=Ge("PlaylistSelector"),Bl=function(s){if(!s||!s.playlist)return;const e=s.playlist;return JSON.stringify({id:e.id,bandwidth:s.bandwidth,width:s.width,height:s.height,codecs:e.attributes&&e.attributes.CODECS||""})},pi=function(s,e){if(!s)return"";const t=x.getComputedStyle(s);return t?t[e]:""},mi=function(s,e){const t=s.slice();s.sort(function(i,n){const r=e(i,n);return r===0?t.indexOf(i)-t.indexOf(n):r})},Ha=function(s,e){let t,i;return s.attributes.BANDWIDTH&&(t=s.attributes.BANDWIDTH),t=t||x.Number.MAX_VALUE,e.attributes.BANDWIDTH&&(i=e.attributes.BANDWIDTH),i=i||x.Number.MAX_VALUE,t-i},__=function(s,e){let t,i;return s.attributes.RESOLUTION&&s.attributes.RESOLUTION.width&&(t=s.attributes.RESOLUTION.width),t=t||x.Number.MAX_VALUE,e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width&&(i=e.attributes.RESOLUTION.width),i=i||x.Number.MAX_VALUE,t===i&&s.attributes.BANDWIDTH&&e.attributes.BANDWIDTH?s.attributes.BANDWIDTH-e.attributes.BANDWIDTH:t-i};let yd=function(s){const{main:e,bandwidth:t,playerWidth:i,playerHeight:n,playerObjectFit:r,limitRenditionByPlayerDimensions:a,playlistController:l}=s;if(!e)return;const c={bandwidth:t,width:i,height:n,limitRenditionByPlayerDimensions:a};let p=e.playlists;Me.isAudioOnly(e)&&(p=l.getAudioTrackPlaylists_(),c.audioOnly=!0);let g=p.map(R=>{let U;const Y=R.attributes&&R.attributes.RESOLUTION&&R.attributes.RESOLUTION.width,le=R.attributes&&R.attributes.RESOLUTION&&R.attributes.RESOLUTION.height;return U=R.attributes&&R.attributes.BANDWIDTH,U=U||x.Number.MAX_VALUE,{bandwidth:U,width:Y,height:le,playlist:R}});mi(g,(R,U)=>R.bandwidth-U.bandwidth),g=g.filter(R=>!Me.isIncompatible(R.playlist));let _=g.filter(R=>Me.isEnabled(R.playlist));_.length||(_=g.filter(R=>!Me.isDisabled(R.playlist)));const S=_.filter(R=>R.bandwidth*Te.BANDWIDTH_VARIANCE<t);let E=S[S.length-1];const w=S.filter(R=>R.bandwidth===E.bandwidth)[0];if(a===!1){const R=w||_[0]||g[0];if(R&&R.playlist){let U="sortedPlaylistReps";return w&&(U="bandwidthBestRep"),_[0]&&(U="enabledPlaylistReps"),Zs(`choosing ${Bl(R)} using ${U} with options`,c),R.playlist}return Zs("could not choose a playlist with options",c),null}const I=S.filter(R=>R.width&&R.height);mi(I,(R,U)=>R.width-U.width);const L=I.filter(R=>R.width===i&&R.height===n);E=L[L.length-1];const P=L.filter(R=>R.bandwidth===E.bandwidth)[0];let F,$,B;P||(F=I.filter(R=>r==="cover"?R.width>i&&R.height>n:R.width>i||R.height>n),$=F.filter(R=>R.width===F[0].width&&R.height===F[0].height),E=$[$.length-1],B=$.filter(R=>R.bandwidth===E.bandwidth)[0]);let O;if(l.leastPixelDiffSelector){const R=I.map(U=>(U.pixelDiff=Math.abs(U.width-i)+Math.abs(U.height-n),U));mi(R,(U,Y)=>U.pixelDiff===Y.pixelDiff?Y.bandwidth-U.bandwidth:U.pixelDiff-Y.pixelDiff),O=R[0]}const j=O||B||P||w||_[0]||g[0];if(j&&j.playlist){let R="sortedPlaylistReps";return O?R="leastPixelDiffRep":B?R="resolutionPlusOneRep":P?R="resolutionBestRep":w?R="bandwidthBestRep":_[0]&&(R="enabledPlaylistReps"),Zs(`choosing ${Bl(j)} using ${R} with options`,c),j.playlist}return Zs("could not choose a playlist with options",c),null};const Fl=function(){let s=this.useDevicePixelRatio&&x.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(s=this.customPixelRatio),yd({main:this.playlists.main,bandwidth:this.systemBandwidth,playerWidth:parseInt(pi(this.tech_.el(),"width"),10)*s,playerHeight:parseInt(pi(this.tech_.el(),"height"),10)*s,playerObjectFit:this.usePlayerObjectFit?pi(this.tech_.el(),"objectFit"):"",limitRenditionByPlayerDimensions:this.limitRenditionByPlayerDimensions,playlistController:this.playlistController_})},y_=function(s){let e=-1,t=-1;if(s<0||s>1)throw new Error("Moving average bandwidth decay must be between 0 and 1.");return function(){let i=this.useDevicePixelRatio&&x.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(i=this.customPixelRatio),e<0&&(e=this.systemBandwidth,t=this.systemBandwidth),this.systemBandwidth>0&&this.systemBandwidth!==t&&(e=s*this.systemBandwidth+(1-s)*e,t=this.systemBandwidth),yd({main:this.playlists.main,bandwidth:e,playerWidth:parseInt(pi(this.tech_.el(),"width"),10)*i,playerHeight:parseInt(pi(this.tech_.el(),"height"),10)*i,playerObjectFit:this.usePlayerObjectFit?pi(this.tech_.el(),"objectFit"):"",limitRenditionByPlayerDimensions:this.limitRenditionByPlayerDimensions,playlistController:this.playlistController_})}},T_=function(s){const{main:e,currentTime:t,bandwidth:i,duration:n,segmentDuration:r,timeUntilRebuffer:a,currentTimeline:l,syncController:c}=s,p=e.playlists.filter(w=>!Me.isIncompatible(w));let g=p.filter(Me.isEnabled);g.length||(g=p.filter(w=>!Me.isDisabled(w)));const S=g.filter(Me.hasAttribute.bind(null,"BANDWIDTH")).map(w=>{const L=c.getSyncPoint(w,n,l,t)?1:2,F=Me.estimateSegmentRequestTime(r,i,w)*L-a;return{playlist:w,rebufferingImpact:F}}),E=S.filter(w=>w.rebufferingImpact<=0);return mi(E,(w,I)=>Ha(I.playlist,w.playlist)),E.length?E[0]:(mi(S,(w,I)=>w.rebufferingImpact-I.rebufferingImpact),S[0]||null)},v_=function(){const s=this.playlists.main.playlists.filter(Me.isEnabled);return mi(s,(t,i)=>Ha(t,i)),s.filter(t=>!!ds(this.playlists.main,t).video)[0]||null},b_=s=>{let e=0,t;return s.bytes&&(t=new Uint8Array(s.bytes),s.segments.forEach(i=>{t.set(i,e),e+=i.byteLength})),t};function Td(s){try{return new URL(s).pathname.split("/").slice(-2).join("/")}catch{return""}}const x_=function(s,e,t){if(!s[t]){e.trigger({type:"usage",name:"vhs-608"});let i=t;/^cc708_/.test(t)&&(i="SERVICE"+t.split("_")[1]);const n=e.textTracks().getTrackById(i);if(n)s[t]=n;else{const r=e.options_.vhs&&e.options_.vhs.captionServices||{};let a=t,l=t,c=!1;const p=r[i];p&&(a=p.label,l=p.language,c=p.default),s[t]=e.addRemoteTextTrack({kind:"captions",id:i,default:c,label:a,language:l},!1).track}}},S_=function({inbandTextTracks:s,captionArray:e,timestampOffset:t}){if(!e)return;const i=x.WebKitDataCue||x.VTTCue;e.forEach(n=>{const r=n.stream;n.content?n.content.forEach(a=>{const l=new i(n.startTime+t,n.endTime+t,a.text);l.line=a.line,l.align="left",l.position=a.position,l.positionAlign="line-left",s[r].addCue(l)}):s[r].addCue(new i(n.startTime+t,n.endTime+t,n.text))})},C_=function(s){Object.defineProperties(s.frame,{id:{get(){return k.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),s.value.key}},value:{get(){return k.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),s.value.data}},privateData:{get(){return k.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),s.value.data}}})},E_=({inbandTextTracks:s,metadataArray:e,timestampOffset:t,videoDuration:i})=>{if(!e)return;const n=x.WebKitDataCue||x.VTTCue,r=s.metadataTrack_;if(!r||(e.forEach(g=>{const _=g.cueTime+t;typeof _!="number"||x.isNaN(_)||_<0||!(_<1/0)||!g.frames||!g.frames.length||g.frames.forEach(S=>{const E=new n(_,_,S.value||S.url||S.data||"");E.frame=S,E.value=S,C_(E),r.addCue(E)})}),!r.cues||!r.cues.length))return;const a=r.cues,l=[];for(let g=0;g<a.length;g++)a[g]&&l.push(a[g]);const c=l.reduce((g,_)=>{const S=g[_.startTime]||[];return S.push(_),g[_.startTime]=S,g},{}),p=Object.keys(c).sort((g,_)=>Number(g)-Number(_));p.forEach((g,_)=>{const S=c[g],E=isFinite(i)?i:g,w=Number(p[_+1])||E;S.forEach(I=>{I.endTime=w})})},w_={id:"ID",class:"CLASS",startDate:"START-DATE",duration:"DURATION",endDate:"END-DATE",endOnNext:"END-ON-NEXT",plannedDuration:"PLANNED-DURATION",scte35Out:"SCTE35-OUT",scte35In:"SCTE35-IN"},k_=new Set(["id","class","startDate","duration","endDate","endOnNext","startTime","endTime","processDateRange"]),I_=({inbandTextTracks:s,dateRanges:e})=>{const t=s.metadataTrack_;if(!t)return;const i=x.WebKitDataCue||x.VTTCue;e.forEach(n=>{for(const r of Object.keys(n)){if(k_.has(r))continue;const a=new i(n.startTime,n.endTime,"");a.id=n.id,a.type="com.apple.quicktime.HLS",a.value={key:w_[r],data:n[r]},(r==="scte35Out"||r==="scte35In")&&(a.value.data=new Uint8Array(a.value.data.match(/[\da-f]{2}/gi)).buffer),t.addCue(a)}n.processDateRange()})},Nl=(s,e,t)=>{s.metadataTrack_||(s.metadataTrack_=t.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,k.browser.IS_ANY_SAFARI||(s.metadataTrack_.inBandMetadataTrackDispatchType=e))},ns=function(s,e,t){let i,n;if(t&&t.cues)for(i=t.cues.length;i--;)n=t.cues[i],n.startTime>=s&&n.endTime<=e&&t.removeCue(n)},P_=function(s){const e=s.cues;if(!e)return;const t={};for(let i=e.length-1;i>=0;i--){const n=e[i],r=`${n.startTime}-${n.endTime}-${n.text}`;t[r]?s.removeCue(n):t[r]=n}},A_=(s,e,t)=>{if(typeof e>"u"||e===null||!s.length)return[];const i=Math.ceil((e-t+3)*qt.ONE_SECOND_IN_TS);let n;for(n=0;n<s.length&&!(s[n].pts>i);n++);return s.slice(n)},L_=(s,e,t)=>{if(!e.length)return s;if(t)return e.slice();const i=e[0].pts;let n=0;for(n;n<s.length&&!(s[n].pts>=i);n++);return s.slice(0,n).concat(e)},D_=(s,e,t,i)=>{const n=Math.ceil((e-i)*qt.ONE_SECOND_IN_TS),r=Math.ceil((t-i)*qt.ONE_SECOND_IN_TS),a=s.slice();let l=s.length;for(;l--&&!(s[l].pts<=r););if(l===-1)return a;let c=l+1;for(;c--&&!(s[c].pts<=n););return c=Math.max(c,0),a.splice(c,l-c+1),a},O_=function(s,e){if(!s&&!e||!s&&e||s&&!e)return!1;if(s===e)return!0;const t=Object.keys(s).sort(),i=Object.keys(e).sort();if(t.length!==i.length)return!1;for(let n=0;n<t.length;n++){const r=t[n];if(r!==i[n]||s[r]!==e[r])return!1}return!0},M_=function(s,e,t){e=e||[];const i=[];let n=0;for(let r=0;r<e.length;r++){const a=e[r];if(s===a.timeline&&(i.push(r),n+=a.duration,n>t))return r}return i.length===0?0:i[i.length-1]},Ji=1,R_=500,Ul=s=>typeof s=="number"&&isFinite(s),en=1/60,B_=(s,e,t)=>s!=="main"||!e||!t?null:!t.hasAudio&&!t.hasVideo?"Neither audio nor video found in segment.":e.hasVideo&&!t.hasVideo?"Only audio found in segment when we expected video. We can't switch to audio only from a stream that had video. To get rid of this message, please add codec information to the manifest.":!e.hasVideo&&t.hasVideo?"Video found in segment when we expected only audio. We can't switch to a stream with video from an audio only stream. To get rid of this message, please add codec information to the manifest.":null,F_=(s,e,t)=>{let i=e-Te.BACK_BUFFER_LENGTH;s.length&&(i=Math.max(i,s.start(0)));const n=e-t;return Math.min(n,i)},ni=s=>{const{startOfSegment:e,duration:t,segment:i,part:n,playlist:{mediaSequence:r,id:a,segments:l=[]},mediaIndex:c,partIndex:p,timeline:g}=s,_=l.length-1;let S="mediaIndex/partIndex increment";s.getMediaInfoForTime?S=`getMediaInfoForTime (${s.getMediaInfoForTime})`:s.isSyncRequest&&(S="getSyncSegmentCandidate (isSyncRequest)"),s.independent&&(S+=` with independent ${s.independent}`);const E=typeof p=="number",w=s.segment.uri?"segment":"pre-segment",I=E?Fh({preloadSegment:i})-1:0;return`${w} [${r+c}/${r+_}]`+(E?` part [${p}/${I}]`:"")+` segment start/end [${i.start} => ${i.end}]`+(E?` part start/end [${n.start} => ${n.end}]`:"")+` startOfSegment [${e}] duration [${t}] timeline [${g}] selected by [${S}] playlist [${a}]`},jl=s=>`${s}TimingInfo`,N_=({segmentTimeline:s,currentTimeline:e,startOfSegment:t,buffered:i,overrideCheck:n})=>!n&&s===e?null:s<e?t:i.length?i.end(i.length-1):t,ia=({timelineChangeController:s,currentTimeline:e,segmentTimeline:t,loaderType:i,audioDisabled:n})=>{if(e===t)return!1;if(i==="audio"){const r=s.lastTimelineChange({type:"main"});return!r||r.to!==t}if(i==="main"&&n){const r=s.pendingTimelineChange({type:"audio"});return!(r&&r.to===t)}return!1},U_=s=>{if(!s)return!1;const e=s.pendingTimelineChange({type:"audio"}),t=s.pendingTimelineChange({type:"main"}),i=e&&t,n=i&&e.to!==t.to;return!!(i&&e.from!==-1&&t.from!==-1&&n)},j_=s=>{const e=s.timelineChangeController_.pendingTimelineChange({type:"audio"}),t=s.timelineChangeController_.pendingTimelineChange({type:"main"});return e&&t&&e.to<t.to},Et=s=>{const e=s.pendingSegment_;if(!e)return;if(ia({timelineChangeController:s.timelineChangeController_,currentTimeline:s.currentTimeline_,segmentTimeline:e.timeline,loaderType:s.loaderType_,audioDisabled:s.audioDisabled_})&&U_(s.timelineChangeController_)){if(j_(s)){s.timelineChangeController_.trigger("audioTimelineBehind");return}s.timelineChangeController_.trigger("fixBadTimelineChange")}},$_=s=>{let e=0;return["video","audio"].forEach(function(t){const i=s[`${t}TimingInfo`];if(!i)return;const{start:n,end:r}=i;let a;typeof n=="bigint"||typeof r=="bigint"?a=x.BigInt(r)-x.BigInt(n):typeof n=="number"&&typeof r=="number"&&(a=r-n),typeof a<"u"&&a>e&&(e=a)}),typeof e=="bigint"&&e<Number.MAX_SAFE_INTEGER&&(e=Number(e)),e},$l=({segmentDuration:s,maxDuration:e})=>s?Math.round(s)>e+rt:!1,H_=(s,e)=>{if(e!=="hls")return null;const t=$_({audioTimingInfo:s.audioTimingInfo,videoTimingInfo:s.videoTimingInfo});if(!t)return null;const i=s.playlist.targetDuration,n=$l({segmentDuration:t,maxDuration:i*2}),r=$l({segmentDuration:t,maxDuration:i}),a=`Segment with index ${s.mediaIndex} from playlist ${s.playlist.id} has a duration of ${t} when the reported duration is ${s.duration} and the target duration is ${i}. For HLS content, a duration in excess of the target duration may result in playback issues. See the HLS specification section on EXT-X-TARGETDURATION for more details: https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.3.1`;return n||r?{severity:n?"warn":"info",message:a}:null},Vt=({type:s,segment:e})=>{if(!e)return;const t=!!(e.key||e.map&&e.map.ke),i=!!(e.map&&!e.map.bytes),n=e.startOfSegment===void 0?e.start:e.startOfSegment;return{type:s||e.type,uri:e.resolvedUri||e.uri,start:n,duration:e.duration,isEncrypted:t,isMediaInitialization:i}};class sa extends k.EventTarget{constructor(e,t={}){if(super(),!e)throw new TypeError("Initialization settings are required");if(typeof e.currentTime!="function")throw new TypeError("No currentTime getter specified");if(!e.mediaSource)throw new TypeError("No MediaSource specified");this.bandwidth=e.bandwidth,this.throughput={rate:0,count:0},this.roundTrip=NaN,this.resetStats_(),this.mediaIndex=null,this.partIndex=null,this.hasPlayed_=e.hasPlayed,this.currentTime_=e.currentTime,this.seekable_=e.seekable,this.seeking_=e.seeking,this.duration_=e.duration,this.mediaSource_=e.mediaSource,this.vhs_=e.vhs,this.loaderType_=e.loaderType,this.currentMediaInfo_=void 0,this.startingMediaInfo_=void 0,this.segmentMetadataTrack_=e.segmentMetadataTrack,this.goalBufferLength_=e.goalBufferLength,this.sourceType_=e.sourceType,this.sourceUpdater_=e.sourceUpdater,this.inbandTextTracks_=e.inbandTextTracks,this.state_="INIT",this.timelineChangeController_=e.timelineChangeController,this.shouldSaveSegmentTimingInfo_=!0,this.parse708captions_=e.parse708captions,this.useDtsForTimestampOffset_=e.useDtsForTimestampOffset,this.captionServices_=e.captionServices,this.exactManifestTimings=e.exactManifestTimings,this.addMetadataToTextTrack=e.addMetadataToTextTrack,this.checkBufferTimeout_=null,this.error_=void 0,this.currentTimeline_=-1,this.shouldForceTimestampOffsetAfterResync_=!1,this.pendingSegment_=null,this.xhrOptions_=null,this.pendingSegments_=[],this.audioDisabled_=!1,this.isPendingTimestampOffset_=!1,this.gopBuffer_=[],this.timeMapping_=0,this.safeAppend_=!1,this.appendInitSegment_={audio:!0,video:!0},this.playlistOfLastInitSegment_={audio:null,video:null},this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_={id3:[],caption:[]},this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=null,this.activeInitSegmentId_=null,this.initSegments_={},this.cacheEncryptionKeys_=e.cacheEncryptionKeys,this.keyCache_={},this.decrypter_=e.decrypter,this.syncController_=e.syncController,this.syncPoint_={segmentIndex:0,time:0},this.transmuxer_=this.createTransmuxer_(),this.triggerSyncInfoUpdate_=()=>this.trigger("syncinfoupdate"),this.syncController_.on("syncinfoupdate",this.triggerSyncInfoUpdate_),this.mediaSource_.addEventListener("sourceopen",()=>{this.isEndOfStream_()||(this.ended_=!1)}),this.fetchAtBuffer_=!1,this.logger_=Ge(`SegmentLoader[${this.loaderType_}]`),Object.defineProperty(this,"state",{get(){return this.state_},set(i){i!==this.state_&&(this.logger_(`${this.state_} -> ${i}`),this.state_=i,this.trigger("statechange"))}}),this.sourceUpdater_.on("ready",()=>{this.hasEnoughInfoToAppend_()?this.processCallQueue_():Et(this)}),this.sourceUpdater_.on("codecschange",i=>{this.trigger(ve({type:"codecschange"},i))}),this.loaderType_==="main"&&this.timelineChangeController_.on("pendingtimelinechange",()=>{this.hasEnoughInfoToAppend_()?this.processCallQueue_():Et(this)}),this.loaderType_==="audio"&&this.timelineChangeController_.on("timelinechange",i=>{this.trigger(ve({type:"timelinechange"},i)),this.hasEnoughInfoToLoad_()?this.processLoadQueue_():Et(this),this.hasEnoughInfoToAppend_()?this.processCallQueue_():Et(this)})}get mediaSequenceSync_(){return this.syncController_.getMediaSequenceSync(this.loaderType_)}createTransmuxer_(){return Lr.createTransmuxer({remux:!1,alignGopsAtEnd:this.safeAppend_,keepOriginalTimestamps:!0,parse708captions:this.parse708captions_,captionServices:this.captionServices_})}resetStats_(){this.mediaBytesTransferred=0,this.mediaRequests=0,this.mediaRequestsAborted=0,this.mediaRequestsTimedout=0,this.mediaRequestsErrored=0,this.mediaTransferDuration=0,this.mediaSecondsLoaded=0,this.mediaAppends=0}dispose(){this.trigger("dispose"),this.state="DISPOSED",this.pause(),this.abort_(),this.transmuxer_&&this.transmuxer_.terminate(),this.resetStats_(),this.checkBufferTimeout_&&x.clearTimeout(this.checkBufferTimeout_),this.syncController_&&this.triggerSyncInfoUpdate_&&this.syncController_.off("syncinfoupdate",this.triggerSyncInfoUpdate_),this.off()}setAudio(e){this.audioDisabled_=!e,e?this.appendInitSegment_.audio=!0:this.sourceUpdater_.removeAudio(0,this.duration_())}abort(){if(this.state!=="WAITING"){this.pendingSegment_&&(this.pendingSegment_=null),this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_);return}this.abort_(),this.state="READY",this.paused()||this.monitorBuffer_()}abort_(){this.pendingSegment_&&this.pendingSegment_.abortRequests&&this.pendingSegment_.abortRequests(),this.pendingSegment_=null,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_),this.waitingOnRemove_=!1,x.clearTimeout(this.quotaExceededErrorRetryTimeout_),this.quotaExceededErrorRetryTimeout_=null}checkForAbort_(e){return this.state==="APPENDING"&&!this.pendingSegment_?(this.state="READY",!0):!this.pendingSegment_||this.pendingSegment_.requestId!==e}error(e){return typeof e<"u"&&(this.logger_("error occurred:",e),this.error_=e),this.pendingSegment_=null,this.error_}endOfStream(){this.ended_=!0,this.transmuxer_&&Lr.reset(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")}buffered_(){const e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return be();if(this.loaderType_==="main"){const{hasAudio:t,hasVideo:i,isMuxed:n}=e;if(i&&t&&!this.audioDisabled_&&!n)return this.sourceUpdater_.buffered();if(i)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()}initSegmentForMap(e,t=!1){if(!e)return null;const i=Cn(e);let n=this.initSegments_[i];return t&&!n&&e.bytes&&(this.initSegments_[i]=n={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes,tracks:e.tracks,timescales:e.timescales}),n||e}segmentKey(e,t=!1){if(!e)return null;const i=id(e);let n=this.keyCache_[i];this.cacheEncryptionKeys_&&t&&!n&&e.bytes&&(this.keyCache_[i]=n={resolvedUri:e.resolvedUri,bytes:e.bytes});const r={resolvedUri:(n||e).resolvedUri};return n&&(r.bytes=n.bytes),r}couldBeginLoading_(){return this.playlist_&&!this.paused()}load(){if(this.monitorBuffer_(),!!this.playlist_){if(this.state==="INIT"&&this.couldBeginLoading_())return this.init_();!this.couldBeginLoading_()||this.state!=="READY"&&this.state!=="INIT"||(this.state="READY")}}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}playlist(e,t={}){if(!e||this.playlist_&&this.playlist_.endList&&e.endList&&this.playlist_.uri===e.uri)return;const i=this.playlist_,n=this.pendingSegment_;this.playlist_=e,this.xhrOptions_=t,this.state==="INIT"&&(e.syncInfo={mediaSequence:e.mediaSequence,time:0},this.loaderType_==="main"&&this.syncController_.setDateTimeMappingForStart(e));let r=null;if(i&&(i.id?r=i.id:i.uri&&(r=i.uri)),this.logger_(`playlist update [${r} => ${e.id||e.uri}]`),this.mediaSequenceSync_&&(this.mediaSequenceSync_.update(e,this.currentTime_()),this.logger_(`Playlist update:
|
|
198
|
-
currentTime: ${this.currentTime_()}
|
|
199
|
-
bufferedEnd: ${Pr(this.buffered_())}
|
|
200
|
-
`,this.mediaSequenceSync_.diagnostics)),this.trigger("syncinfoupdate"),this.state==="INIT"&&this.couldBeginLoading_())return this.init_();if(!i||i.uri!==e.uri){this.mediaIndex!==null&&(!e.endList&&typeof e.partTargetDuration=="number"?this.resetLoader():this.resyncLoader()),this.currentMediaInfo_=void 0,this.trigger("playlistupdate");return}const a=e.mediaSequence-i.mediaSequence;if(this.logger_(`live window shift [${a}]`),this.mediaIndex!==null)if(this.mediaIndex-=a,this.mediaIndex<0)this.mediaIndex=null,this.partIndex=null;else{const l=this.playlist_.segments[this.mediaIndex];if(this.partIndex&&(!l.parts||!l.parts.length||!l.parts[this.partIndex])){const c=this.mediaIndex;this.logger_(`currently processing part (index ${this.partIndex}) no longer exists.`),this.resetLoader(),this.mediaIndex=c}}n&&(n.mediaIndex-=a,n.mediaIndex<0?(n.mediaIndex=null,n.partIndex=null):(n.mediaIndex>=0&&(n.segment=e.segments[n.mediaIndex]),n.partIndex>=0&&n.segment.parts&&(n.part=n.segment.parts[n.partIndex]))),this.syncController_.saveExpiredSegmentInfo(i,e)}pause(){this.checkBufferTimeout_&&(x.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)}paused(){return this.checkBufferTimeout_===null}resetEverything(e){this.ended_=!1,this.activeInitSegmentId_=null,this.appendInitSegment_={audio:!0,video:!0},this.resetLoader(),this.remove(0,1/0,e),this.transmuxer_&&(this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.transmuxer_.postMessage({action:"reset"}))}resetLoader(){this.fetchAtBuffer_=!1,this.mediaSequenceSync_&&this.mediaSequenceSync_.resetAppendedStatus(),this.resyncLoader()}resyncLoader(){this.transmuxer_&&Lr.reset(this.transmuxer_),this.mediaIndex=null,this.partIndex=null,this.syncPoint_=null,this.isPendingTimestampOffset_=!1;const e=this.currentMediaInfo_&&this.currentMediaInfo_.isFmp4;this.sourceType_==="hls"&&!e&&(this.shouldForceTimestampOffsetAfterResync_=!0),this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.abort(),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}remove(e,t,i=()=>{},n=!1){if(t===1/0&&(t=this.duration_()),t<=e){this.logger_("skipping remove because end ${end} is <= start ${start}");return}if(!this.sourceUpdater_||!this.getMediaInfo_()){this.logger_("skipping remove because no source updater or starting media info");return}let r=1;const a=()=>{r--,r===0&&i()};(n||!this.audioDisabled_)&&(r++,this.sourceUpdater_.removeAudio(e,t,a)),(n||this.loaderType_==="main")&&(this.gopBuffer_=D_(this.gopBuffer_,e,t,this.timeMapping_),r++,this.sourceUpdater_.removeVideo(e,t,a));for(const l in this.inbandTextTracks_)ns(e,t,this.inbandTextTracks_[l]);ns(e,t,this.segmentMetadataTrack_),a()}monitorBuffer_(){this.checkBufferTimeout_&&x.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=x.setTimeout(this.monitorBufferTick_.bind(this),1)}monitorBufferTick_(){this.state==="READY"&&this.fillBuffer_(),this.checkBufferTimeout_&&x.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=x.setTimeout(this.monitorBufferTick_.bind(this),R_)}fillBuffer_(){if(this.sourceUpdater_.updating())return;const e=this.chooseNextRequest_();if(!e)return;const t={segmentInfo:Vt({type:this.loaderType_,segment:e})};this.trigger({type:"segmentselected",metadata:t}),typeof e.timestampOffset=="number"&&(this.isPendingTimestampOffset_=!1,this.timelineChangeController_.pendingTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline})),this.loadSegment_(e)}isEndOfStream_(e=this.mediaIndex,t=this.playlist_,i=this.partIndex){if(!t||!this.mediaSource_)return!1;const n=typeof e=="number"&&t.segments[e],r=e+1===t.segments.length,a=!n||!n.parts||i+1===n.parts.length;return t.endList&&this.mediaSource_.readyState==="open"&&r&&a}chooseNextRequest_(){const e=this.buffered_(),t=Pr(e)||0,i=Fa(e,this.currentTime_()),n=!this.hasPlayed_()&&i>=1,r=i>=this.goalBufferLength_(),a=this.playlist_.segments;if(!a.length||n||r)return null;this.syncPoint_=this.syncPoint_||this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_(),this.loaderType_);const l={partIndex:null,mediaIndex:null,startOfSegment:null,playlist:this.playlist_,isSyncRequest:!this.syncPoint_};if(l.isSyncRequest)l.mediaIndex=M_(this.currentTimeline_,a,t),this.logger_(`choose next request. Can not find sync point. Fallback to media Index: ${l.mediaIndex}`);else if(this.mediaIndex!==null){const S=a[this.mediaIndex],E=typeof this.partIndex=="number"?this.partIndex:-1;l.startOfSegment=S.end?S.end:t,S.parts&&S.parts[E+1]?(l.mediaIndex=this.mediaIndex,l.partIndex=E+1):l.mediaIndex=this.mediaIndex+1}else{let S,E,w;const I=this.fetchAtBuffer_?t:this.currentTime_();if(this.mediaSequenceSync_&&this.logger_(`chooseNextRequest_ request after Quality Switch:
|
|
201
|
-
For TargetTime: ${I}.
|
|
202
|
-
CurrentTime: ${this.currentTime_()}
|
|
203
|
-
BufferedEnd: ${t}
|
|
204
|
-
Fetch At Buffer: ${this.fetchAtBuffer_}
|
|
205
|
-
`,this.mediaSequenceSync_.diagnostics),this.mediaSequenceSync_&&this.mediaSequenceSync_.isReliable){const L=this.getSyncInfoFromMediaSequenceSync_(I);if(!L){const P="No sync info found while using media sequence sync";return this.error({message:P,metadata:{errorType:k.Error.StreamingFailedToSelectNextSegment,error:new Error(P)}}),this.logger_("chooseNextRequest_ - no sync info found using media sequence sync"),null}this.logger_(`chooseNextRequest_ mediaSequence syncInfo (${L.start} --> ${L.end})`),S=L.segmentIndex,E=L.partIndex,w=L.start}else{this.logger_("chooseNextRequest_ - fallback to a regular segment selection algorithm, based on a syncPoint.");const L=Me.getMediaInfoForTime({exactManifestTimings:this.exactManifestTimings,playlist:this.playlist_,currentTime:I,startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time});S=L.segmentIndex,E=L.partIndex,w=L.startTime}l.getMediaInfoForTime=this.fetchAtBuffer_?`bufferedEnd ${I}`:`currentTime ${I}`,l.mediaIndex=S,l.startOfSegment=w,l.partIndex=E,this.logger_(`choose next request. Playlist switched and we have a sync point. Media Index: ${l.mediaIndex} `)}const c=a[l.mediaIndex];let p=c&&typeof l.partIndex=="number"&&c.parts&&c.parts[l.partIndex];if(!c||typeof l.partIndex=="number"&&!p)return null;typeof l.partIndex!="number"&&c.parts&&(l.partIndex=0,p=c.parts[0]);const g=this.vhs_.playlists&&this.vhs_.playlists.main&&this.vhs_.playlists.main.independentSegments||this.playlist_.independentSegments;if(!i&&p&&!g&&!p.independent)if(l.partIndex===0){const S=a[l.mediaIndex-1],E=S.parts&&S.parts.length&&S.parts[S.parts.length-1];E&&E.independent&&(l.mediaIndex-=1,l.partIndex=S.parts.length-1,l.independent="previous segment")}else c.parts[l.partIndex-1].independent&&(l.partIndex-=1,l.independent="previous part");const _=this.mediaSource_&&this.mediaSource_.readyState==="ended";return l.mediaIndex>=a.length-1&&_&&!this.seeking_()?null:(this.shouldForceTimestampOffsetAfterResync_&&(this.shouldForceTimestampOffsetAfterResync_=!1,l.forceTimestampOffset=!0,this.logger_("choose next request. Force timestamp offset after loader resync")),this.generateSegmentInfo_(l))}getSyncInfoFromMediaSequenceSync_(e){if(!this.mediaSequenceSync_)return null;const t=Math.max(e,this.mediaSequenceSync_.start);e!==t&&this.logger_(`getSyncInfoFromMediaSequenceSync_. Pulled target time from ${e} to ${t}`);const i=this.mediaSequenceSync_.getSyncInfoForTime(t);if(!i)return null;if(!i.isAppended)return i;const n=this.mediaSequenceSync_.getSyncInfoForTime(i.end);return n?(n.isAppended&&this.logger_("getSyncInfoFromMediaSequenceSync_: We encounter unexpected scenario where next media sequence sync info is also appended!"),n):null}generateSegmentInfo_(e){const{independent:t,playlist:i,mediaIndex:n,startOfSegment:r,isSyncRequest:a,partIndex:l,forceTimestampOffset:c,getMediaInfoForTime:p}=e,g=i.segments[n],_=typeof l=="number"&&g.parts[l],S={requestId:"segment-loader-"+Math.random(),uri:_&&_.resolvedUri||g.resolvedUri,mediaIndex:n,partIndex:_?l:null,isSyncRequest:a,startOfSegment:r,playlist:i,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:g.timeline,duration:_&&_.duration||g.duration,segment:g,part:_,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:p,independent:t},E=typeof c<"u"?c:this.isPendingTimestampOffset_;S.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:g.timeline,currentTimeline:this.currentTimeline_,startOfSegment:r,buffered:this.buffered_(),overrideCheck:E});const w=Pr(this.sourceUpdater_.audioBuffered());return typeof w=="number"&&(S.audioAppendStart=w-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(S.gopsToAlignWith=A_(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),S}timestampOffsetForSegment_(e){return N_(e)}earlyAbortWhenNeeded_(e){if(this.vhs_.tech_.paused()||!this.xhrOptions_.timeout||!this.playlist_.attributes.BANDWIDTH||Date.now()-(e.firstBytesReceivedAt||Date.now())<1e3)return;const t=this.currentTime_(),i=e.bandwidth,n=this.pendingSegment_.duration,r=Me.estimateSegmentRequestTime(n,i,this.playlist_,e.bytesReceived),a=a0(this.buffered_(),t,this.vhs_.tech_.playbackRate())-1;if(r<=a)return;const l=T_({main:this.vhs_.playlists.main,currentTime:t,bandwidth:i,duration:this.duration_(),segmentDuration:n,timeUntilRebuffer:a,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(!l)return;const p=r-a-l.rebufferingImpact;let g=.5;a<=rt&&(g=1),!(!l.playlist||l.playlist.uri===this.playlist_.uri||p<g)&&(this.bandwidth=l.playlist.attributes.BANDWIDTH*Te.BANDWIDTH_VARIANCE+1,this.trigger("earlyabort"))}handleAbort_(e){this.logger_(`Aborting ${ni(e)}`),this.mediaRequestsAborted+=1}handleProgress_(e,t){this.earlyAbortWhenNeeded_(t.stats),!this.checkForAbort_(t.requestId)&&this.trigger("progress")}handleTrackInfo_(e,t){const{hasAudio:i,hasVideo:n}=t,r={segmentInfo:Vt({type:this.loaderType_,segment:e}),trackInfo:{hasAudio:i,hasVideo:n}};this.trigger({type:"segmenttransmuxingtrackinfoavailable",metadata:r}),this.earlyAbortWhenNeeded_(e.stats),!this.checkForAbort_(e.requestId)&&(this.checkForIllegalMediaSwitch(t)||(t=t||{},O_(this.currentMediaInfo_,t)||(this.appendInitSegment_={audio:!0,video:!0},this.startingMediaInfo_=t,this.currentMediaInfo_=t,this.logger_("trackinfo update",t),this.trigger("trackinfo")),!this.checkForAbort_(e.requestId)&&(this.pendingSegment_.trackInfo=t,this.hasEnoughInfoToAppend_()?this.processCallQueue_():Et(this))))}handleTimingInfo_(e,t,i,n){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;const r=this.pendingSegment_,a=jl(t);r[a]=r[a]||{},r[a][i]=n,this.logger_(`timinginfo: ${t} - ${i} - ${n}`),this.hasEnoughInfoToAppend_()?this.processCallQueue_():Et(this)}handleCaptions_(e,t){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(t.length===0){this.logger_("SegmentLoader received no captions from a caption event");return}if(!this.pendingSegment_.hasAppendedData_){this.metadataQueue_.caption.push(this.handleCaptions_.bind(this,e,t));return}const n=this.sourceUpdater_.videoTimestampOffset()===null?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset(),r={};t.forEach(a=>{r[a.stream]=r[a.stream]||{startTime:1/0,captions:[],endTime:0};const l=r[a.stream];l.startTime=Math.min(l.startTime,a.startTime+n),l.endTime=Math.max(l.endTime,a.endTime+n),l.captions.push(a)}),Object.keys(r).forEach(a=>{const{startTime:l,endTime:c,captions:p}=r[a],g=this.inbandTextTracks_;this.logger_(`adding cues from ${l} -> ${c} for ${a}`),x_(g,this.vhs_.tech_,a),ns(l,c,g[a]),S_({captionArray:p,inbandTextTracks:g,timestampOffset:n})}),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}handleId3_(e,t,i){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(!this.pendingSegment_.hasAppendedData_){this.metadataQueue_.id3.push(this.handleId3_.bind(this,e,t,i));return}this.addMetadataToTextTrack(i,t,this.duration_())}processMetadataQueue_(){this.metadataQueue_.id3.forEach(e=>e()),this.metadataQueue_.caption.forEach(e=>e()),this.metadataQueue_.id3=[],this.metadataQueue_.caption=[]}processCallQueue_(){const e=this.callQueue_;this.callQueue_=[],e.forEach(t=>t())}processLoadQueue_(){const e=this.loadQueue_;this.loadQueue_=[],e.forEach(t=>t())}hasEnoughInfoToLoad_(){if(this.loaderType_!=="audio")return!0;const e=this.pendingSegment_;return e?this.getCurrentMediaInfo_()?!ia({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}):!0:!1}getCurrentMediaInfo_(e=this.pendingSegment_){return e&&e.trackInfo||this.currentMediaInfo_}getMediaInfo_(e=this.pendingSegment_){return this.getCurrentMediaInfo_(e)||this.startingMediaInfo_}getPendingSegmentPlaylist(){return this.pendingSegment_?this.pendingSegment_.playlist:null}hasEnoughInfoToAppend_(){if(!this.sourceUpdater_.ready()||this.waitingOnRemove_||this.quotaExceededErrorRetryTimeout_)return!1;const e=this.pendingSegment_,t=this.getCurrentMediaInfo_();if(!e||!t)return!1;const{hasAudio:i,hasVideo:n,isMuxed:r}=t;return!(n&&!e.videoTimingInfo||i&&!this.audioDisabled_&&!r&&!e.audioTimingInfo||ia({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))}handleData_(e,t){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(this.callQueue_.length||!this.hasEnoughInfoToAppend_()){Et(this),this.callQueue_.push(this.handleData_.bind(this,e,t));return}const i=this.pendingSegment_;if(this.setTimeMapping_(i.timeline),this.updateMediaSecondsLoaded_(i.part||i.segment),this.mediaSource_.readyState!=="closed"){if(e.map&&(e.map=this.initSegmentForMap(e.map,!0),i.segment.map=e.map),e.key&&this.segmentKey(e.key,!0),i.isFmp4=e.isFmp4,i.timingInfo=i.timingInfo||{},i.isFmp4)this.trigger("fmp4"),i.timingInfo.start=i[jl(t.type)].start;else{const n=this.getCurrentMediaInfo_(),r=this.loaderType_==="main"&&n&&n.hasVideo;let a;r&&(a=i.videoTimingInfo.start),i.timingInfo.start=this.trueSegmentStart_({currentStart:i.timingInfo.start,playlist:i.playlist,mediaIndex:i.mediaIndex,currentVideoTimestampOffset:this.sourceUpdater_.videoTimestampOffset(),useVideoTimingInfo:r,firstVideoFrameTimeForData:a,videoTimingInfo:i.videoTimingInfo,audioTimingInfo:i.audioTimingInfo})}if(this.updateAppendInitSegmentStatus(i,t.type),this.updateSourceBufferTimestampOffset_(i),i.isSyncRequest){this.updateTimingInfoEnd_(i),this.syncController_.saveSegmentTimingInfo({segmentInfo:i,shouldSaveTimelineMapping:this.loaderType_==="main"});const n=this.chooseNextRequest_();if(n.mediaIndex!==i.mediaIndex||n.partIndex!==i.partIndex){this.logger_("sync segment was incorrect, not appending");return}this.logger_("sync segment was correct, appending")}i.hasAppendedData_=!0,this.processMetadataQueue_(),this.appendData_(i,t)}}updateAppendInitSegmentStatus(e,t){this.loaderType_==="main"&&typeof e.timestampOffset=="number"&&!e.changedTimestampOffset&&(this.appendInitSegment_={audio:!0,video:!0}),this.playlistOfLastInitSegment_[t]!==e.playlist&&(this.appendInitSegment_[t]=!0)}getInitSegmentAndUpdateState_({type:e,initSegment:t,map:i,playlist:n}){if(i){const r=Cn(i);if(this.activeInitSegmentId_===r)return null;t=this.initSegmentForMap(i,!0).bytes,this.activeInitSegmentId_=r}return t&&this.appendInitSegment_[e]?(this.playlistOfLastInitSegment_[e]=n,this.appendInitSegment_[e]=!1,this.activeInitSegmentId_=null,t):null}handleQuotaExceededError_({segmentInfo:e,type:t,bytes:i},n){const r=this.sourceUpdater_.audioBuffered(),a=this.sourceUpdater_.videoBuffered();r.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: "+zt(r).join(", ")),a.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: "+zt(a).join(", "));const l=r.length?r.start(0):0,c=r.length?r.end(r.length-1):0,p=a.length?a.start(0):0,g=a.length?a.end(a.length-1):0;if(c-l<=Ji&&g-p<=Ji){this.logger_(`On QUOTA_EXCEEDED_ERR, single segment too large to append to buffer, triggering an error. Appended byte length: ${i.byteLength}, audio buffer: ${zt(r).join(", ")}, video buffer: ${zt(a).join(", ")}, `),this.error({message:"Quota exceeded error with append of a single segment of content",excludeUntil:1/0}),this.trigger("error");return}this.waitingOnRemove_=!0,this.callQueue_.push(this.appendToSourceBuffer_.bind(this,{segmentInfo:e,type:t,bytes:i}));const S=this.currentTime_()-Ji;this.logger_(`On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to ${S}`),this.remove(0,S,()=>{this.logger_(`On QUOTA_EXCEEDED_ERR, retrying append in ${Ji}s`),this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=x.setTimeout(()=>{this.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),this.quotaExceededErrorRetryTimeout_=null,this.processCallQueue_()},Ji*1e3)},!0)}handleAppendError_({segmentInfo:e,type:t,bytes:i},n){if(n){if(n.code===Kh){this.handleQuotaExceededError_({segmentInfo:e,type:t,bytes:i});return}this.logger_("Received non QUOTA_EXCEEDED_ERR on append",n),this.error({message:`${t} append of ${i.length}b failed for segment #${e.mediaIndex} in playlist ${e.playlist.id}`,metadata:{errorType:k.Error.StreamingFailedToAppendSegment}}),this.trigger("appenderror")}}appendToSourceBuffer_({segmentInfo:e,type:t,initSegment:i,data:n,bytes:r}){if(!r){const l=[n];let c=n.byteLength;i&&(l.unshift(i),c+=i.byteLength),r=b_({bytes:c,segments:l})}const a={segmentInfo:Vt({type:this.loaderType_,segment:e})};this.trigger({type:"segmentappendstart",metadata:a}),this.sourceUpdater_.appendBuffer({segmentInfo:e,type:t,bytes:r},this.handleAppendError_.bind(this,{segmentInfo:e,type:t,bytes:r}))}handleSegmentTimingInfo_(e,t,i){if(!this.pendingSegment_||t!==this.pendingSegment_.requestId)return;const n=this.pendingSegment_.segment,r=`${e}TimingInfo`;n[r]||(n[r]={}),n[r].transmuxerPrependedSeconds=i.prependedContentDuration||0,n[r].transmuxedPresentationStart=i.start.presentation,n[r].transmuxedDecodeStart=i.start.decode,n[r].transmuxedPresentationEnd=i.end.presentation,n[r].transmuxedDecodeEnd=i.end.decode,n[r].baseMediaDecodeTime=i.baseMediaDecodeTime}appendData_(e,t){const{type:i,data:n}=t;if(!n||!n.byteLength||i==="audio"&&this.audioDisabled_)return;const r=this.getInitSegmentAndUpdateState_({type:i,initSegment:t.initSegment,playlist:e.playlist,map:e.isFmp4?e.segment.map:null});this.appendToSourceBuffer_({segmentInfo:e,type:i,initSegment:r,data:n})}loadSegment_(e){if(this.state="WAITING",this.pendingSegment_=e,this.trimBackBuffer_(e),typeof e.timestampOffset=="number"&&this.transmuxer_&&this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),!this.hasEnoughInfoToLoad_()){Et(this),this.loadQueue_.push(()=>{const t=ve({},e,{forceTimestampOffset:!0});ve(e,this.generateSegmentInfo_(t)),this.isPendingTimestampOffset_=!1,this.updateTransmuxerAndRequestSegment_(e)});return}this.updateTransmuxerAndRequestSegment_(e)}updateTransmuxerAndRequestSegment_(e){this.shouldUpdateTransmuxerTimestampOffset_(e.timestampOffset)&&(this.gopBuffer_.length=0,e.gopsToAlignWith=[],this.timeMapping_=0,this.transmuxer_.postMessage({action:"reset"}),this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:e.timestampOffset}));const t=this.createSimplifiedSegmentObj_(e),i=this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex),n=this.mediaIndex!==null,r=e.timeline!==this.currentTimeline_&&e.timeline>0,a=i||n&&r;this.logger_(`Requesting
|
|
206
|
-
${Td(e.uri)}
|
|
207
|
-
${ni(e)}`),t.map&&!t.map.bytes&&(this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0}),e.abortRequests=g_({xhr:this.vhs_.xhr,xhrOptions:this.xhrOptions_,decryptionWorker:this.decrypter_,segment:t,abortFn:this.handleAbort_.bind(this,e),progressFn:this.handleProgress_.bind(this),trackInfoFn:this.handleTrackInfo_.bind(this),timingInfoFn:this.handleTimingInfo_.bind(this),videoSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"video",e.requestId),audioSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"audio",e.requestId),captionsFn:this.handleCaptions_.bind(this),isEndOfTimeline:a,endedTimelineFn:()=>{this.logger_("received endedtimeline callback")},id3Fn:this.handleId3_.bind(this),dataFn:this.handleData_.bind(this),doneFn:this.segmentRequestFinished_.bind(this),onTransmuxerLog:({message:l,level:c,stream:p})=>{this.logger_(`${ni(e)} logged from transmuxer stream ${p} as a ${c}: ${l}`)},triggerSegmentEventFn:({type:l,segment:c,keyInfo:p,trackInfo:g,timingInfo:_})=>{const E={segmentInfo:Vt({segment:c})};p&&(E.keyInfo=p),g&&(E.trackInfo=g),_&&(E.timingInfo=_),this.trigger({type:l,metadata:E})}})}trimBackBuffer_(e){const t=F_(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);t>0&&this.remove(0,t)}createSimplifiedSegmentObj_(e){const t=e.segment,i=e.part,n=e.segment.key||e.segment.map&&e.segment.map.key,r=e.segment.map&&!e.segment.map.bytes,a={resolvedUri:i?i.resolvedUri:t.resolvedUri,byterange:i?i.byterange:t.byterange,requestId:e.requestId,transmuxer:e.transmuxer,audioAppendStart:e.audioAppendStart,gopsToAlignWith:e.gopsToAlignWith,part:e.part,type:this.loaderType_,start:e.startOfSegment,duration:e.duration,isEncrypted:n,isMediaInitialization:r},l=e.playlist.segments[e.mediaIndex-1];if(l&&l.timeline===t.timeline&&(l.videoTimingInfo?a.baseStartTime=l.videoTimingInfo.transmuxedDecodeEnd:l.audioTimingInfo&&(a.baseStartTime=l.audioTimingInfo.transmuxedDecodeEnd)),t.key){const c=t.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]);a.key=this.segmentKey(t.key),a.key.iv=c}return t.map&&(a.map=this.initSegmentForMap(t.map)),a}saveTransferStats_(e){this.mediaRequests+=1,e&&(this.mediaBytesTransferred+=e.bytesReceived,this.mediaTransferDuration+=e.roundTripTime)}saveBandwidthRelatedStats_(e,t){if(this.pendingSegment_.byteLength=t.bytesReceived,e<en){this.logger_(`Ignoring segment's bandwidth because its duration of ${e} is less than the min to record ${en}`);return}const i={bandwidthInfo:{from:this.bandwidth,to:t.bandwidth}};this.trigger({type:"bandwidthupdated",metadata:i}),this.bandwidth=t.bandwidth,this.roundTrip=t.roundTripTime}handleTimeout_(){this.mediaRequestsTimedout+=1,this.bandwidth=1,this.roundTrip=NaN,this.trigger("bandwidthupdate"),this.trigger("timeout")}segmentRequestFinished_(e,t,i){if(this.callQueue_.length){this.callQueue_.push(this.segmentRequestFinished_.bind(this,e,t,i));return}if(this.saveTransferStats_(t.stats),!this.pendingSegment_||t.requestId!==this.pendingSegment_.requestId)return;if(e){if(this.pendingSegment_=null,this.state="READY",e.code===ot.ABORTED)return;if(this.pause(),e.code===ot.TIMEOUT){this.handleTimeout_();return}this.mediaRequestsErrored+=1,this.error(e),this.trigger("error");return}const n=this.pendingSegment_;this.saveBandwidthRelatedStats_(n.duration,t.stats),n.endOfAllRequests=t.endOfAllRequests,i.gopInfo&&(this.gopBuffer_=L_(this.gopBuffer_,i.gopInfo,this.safeAppend_)),this.state="APPENDING",this.trigger("appending"),this.waitForAppendsToComplete_(n)}setTimeMapping_(e){const t=this.syncController_.mappingForTimeline(e);t!==null&&(this.timeMapping_=t)}updateMediaSecondsLoaded_(e){typeof e.start=="number"&&typeof e.end=="number"?this.mediaSecondsLoaded+=e.end-e.start:this.mediaSecondsLoaded+=e.duration}shouldUpdateTransmuxerTimestampOffset_(e){return e===null?!1:this.loaderType_==="main"&&e!==this.sourceUpdater_.videoTimestampOffset()||!this.audioDisabled_&&e!==this.sourceUpdater_.audioTimestampOffset()}trueSegmentStart_({currentStart:e,playlist:t,mediaIndex:i,firstVideoFrameTimeForData:n,currentVideoTimestampOffset:r,useVideoTimingInfo:a,videoTimingInfo:l,audioTimingInfo:c}){if(typeof e<"u")return e;if(!a)return c.start;const p=t.segments[i-1];return i===0||!p||typeof p.start>"u"||p.end!==n+r?n:l.start}waitForAppendsToComplete_(e){const t=this.getCurrentMediaInfo_(e);if(!t){this.error({message:"No starting media returned, likely due to an unsupported media format.",playlistExclusionDuration:1/0}),this.trigger("error");return}const{hasAudio:i,hasVideo:n,isMuxed:r}=t,a=this.loaderType_==="main"&&n,l=!this.audioDisabled_&&i&&!r;if(e.waitingOnAppends=0,!e.hasAppendedData_){!e.timingInfo&&typeof e.timestampOffset=="number"&&(this.isPendingTimestampOffset_=!0),e.timingInfo={start:0},e.waitingOnAppends++,this.isPendingTimestampOffset_||(this.updateSourceBufferTimestampOffset_(e),this.processMetadataQueue_()),this.checkAppendsDone_(e);return}a&&e.waitingOnAppends++,l&&e.waitingOnAppends++,a&&this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this,e)),l&&this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this,e))}checkAppendsDone_(e){this.checkForAbort_(e.requestId)||(e.waitingOnAppends--,e.waitingOnAppends===0&&this.handleAppendsDone_())}checkForIllegalMediaSwitch(e){const t=B_(this.loaderType_,this.getCurrentMediaInfo_(),e);return t?(this.error({message:t,playlistExclusionDuration:1/0}),this.trigger("error"),!0):!1}updateSourceBufferTimestampOffset_(e){if(e.timestampOffset===null||typeof e.timingInfo.start!="number"||e.changedTimestampOffset||this.loaderType_!=="main")return;let t=!1;e.timestampOffset-=this.getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e.segment.videoTimingInfo,audioTimingInfo:e.segment.audioTimingInfo,timingInfo:e.timingInfo}),e.changedTimestampOffset=!0,e.timestampOffset!==this.sourceUpdater_.videoTimestampOffset()&&(this.sourceUpdater_.videoTimestampOffset(e.timestampOffset),t=!0),e.timestampOffset!==this.sourceUpdater_.audioTimestampOffset()&&(this.sourceUpdater_.audioTimestampOffset(e.timestampOffset),t=!0),t&&this.trigger("timestampoffset")}getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e,audioTimingInfo:t,timingInfo:i}){return this.useDtsForTimestampOffset_?e&&typeof e.transmuxedDecodeStart=="number"?e.transmuxedDecodeStart:t&&typeof t.transmuxedDecodeStart=="number"?t.transmuxedDecodeStart:i.start:i.start}updateTimingInfoEnd_(e){e.timingInfo=e.timingInfo||{};const t=this.getMediaInfo_(),n=this.loaderType_==="main"&&t&&t.hasVideo&&e.videoTimingInfo?e.videoTimingInfo:e.audioTimingInfo;n&&(e.timingInfo.end=typeof n.end=="number"?n.end:n.start+e.duration)}handleAppendsDone_(){if(this.pendingSegment_){const c={segmentInfo:Vt({type:this.loaderType_,segment:this.pendingSegment_})};this.trigger({type:"appendsdone",metadata:c})}if(!this.pendingSegment_){this.state="READY",this.paused()||this.monitorBuffer_();return}const e=this.pendingSegment_;e.part&&e.part.syncInfo?e.part.syncInfo.markAppended():e.segment.syncInfo&&e.segment.syncInfo.markAppended(),this.updateTimingInfoEnd_(e),this.shouldSaveSegmentTimingInfo_&&this.syncController_.saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:this.loaderType_==="main"});const t=H_(e,this.sourceType_);if(t&&(t.severity==="warn"?k.log.warn(t.message):this.logger_(t.message)),this.recordThroughput_(e),this.pendingSegment_=null,this.state="READY",e.isSyncRequest&&(this.trigger("syncinfoupdate"),!e.hasAppendedData_)){this.logger_(`Throwing away un-appended sync request ${ni(e)}`);return}this.logger_(`Appended ${ni(e)}`),this.addSegmentMetadataCue_(e),this.fetchAtBuffer_=!0,this.currentTimeline_!==e.timeline&&(this.timelineChangeController_.lastTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline}),this.loaderType_==="main"&&!this.audioDisabled_&&this.timelineChangeController_.lastTimelineChange({type:"audio",from:this.currentTimeline_,to:e.timeline})),this.currentTimeline_=e.timeline,this.trigger("syncinfoupdate");const i=e.segment,n=e.part,r=i.end&&this.currentTime_()-i.end>e.playlist.targetDuration*3,a=n&&n.end&&this.currentTime_()-n.end>e.playlist.partTargetDuration*3;if(r||a){this.logger_(`bad ${r?"segment":"part"} ${ni(e)}`),this.resetEverything();return}this.mediaIndex!==null&&this.trigger("bandwidthupdate"),this.trigger("progress"),this.mediaIndex=e.mediaIndex,this.partIndex=e.partIndex,this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex)&&this.endOfStream(),this.trigger("appended"),e.hasAppendedData_&&this.mediaAppends++,this.paused()||this.monitorBuffer_()}recordThroughput_(e){if(e.duration<en){this.logger_(`Ignoring segment's throughput because its duration of ${e.duration} is less than the min to record ${en}`);return}const t=this.throughput.rate,i=Date.now()-e.endOfAllRequests+1,n=Math.floor(e.byteLength/i*8*1e3);this.throughput.rate+=(n-t)/++this.throughput.count}addSegmentMetadataCue_(e){if(!this.segmentMetadataTrack_)return;const t=e.segment,i=t.start,n=t.end;if(!Ul(i)||!Ul(n))return;ns(i,n,this.segmentMetadataTrack_);const r=x.WebKitDataCue||x.VTTCue,a={custom:t.custom,dateTimeObject:t.dateTimeObject,dateTimeString:t.dateTimeString,programDateTime:t.programDateTime,bandwidth:e.playlist.attributes.BANDWIDTH,resolution:e.playlist.attributes.RESOLUTION,codecs:e.playlist.attributes.CODECS,byteLength:e.byteLength,uri:e.uri,timeline:e.timeline,playlist:e.playlist.id,start:i,end:n},l=JSON.stringify(a),c=new r(i,n,l);c.value=a,this.segmentMetadataTrack_.addCue(c)}}function mt(){}const vd=function(s){return typeof s!="string"?s:s.replace(/./,e=>e.toUpperCase())},V_=["video","audio"],na=(s,e)=>{const t=e[`${s}Buffer`];return t&&t.updating||e.queuePending[s]},q_=(s,e)=>{for(let t=0;t<e.length;t++){const i=e[t];if(i.type==="mediaSource")return null;if(i.type===s)return t}return null},gi=(s,e)=>{if(e.queue.length===0)return;let t=0,i=e.queue[t];if(i.type==="mediaSource"){!e.updating()&&e.mediaSource.readyState!=="closed"&&(e.queue.shift(),i.action(e),i.doneFn&&i.doneFn(),gi("audio",e),gi("video",e));return}if(s!=="mediaSource"&&!(!e.ready()||e.mediaSource.readyState==="closed"||na(s,e))){if(i.type!==s){if(t=q_(s,e.queue),t===null)return;i=e.queue[t]}if(e.queue.splice(t,1),e.queuePending[s]=i,i.action(s,e),!i.doneFn){e.queuePending[s]=null,gi(s,e);return}}},bd=(s,e)=>{const t=e[`${s}Buffer`],i=vd(s);t&&(t.removeEventListener("updateend",e[`on${i}UpdateEnd_`]),t.removeEventListener("error",e[`on${i}Error_`]),e.codecs[s]=null,e[`${s}Buffer`]=null)},st=(s,e)=>s&&e&&Array.prototype.indexOf.call(s.sourceBuffers,e)!==-1,Fe={appendBuffer:(s,e,t)=>(i,n)=>{const r=n[`${i}Buffer`];if(st(n.mediaSource,r)){n.logger_(`Appending segment ${e.mediaIndex}'s ${s.length} bytes to ${i}Buffer`);try{r.appendBuffer(s)}catch(a){n.logger_(`Error with code ${a.code} `+(a.code===Kh?"(QUOTA_EXCEEDED_ERR) ":"")+`when appending segment ${e.mediaIndex} to ${i}Buffer`),n.queuePending[i]=null,t(a)}}},remove:(s,e)=>(t,i)=>{const n=i[`${t}Buffer`];if(st(i.mediaSource,n)){i.logger_(`Removing ${s} to ${e} from ${t}Buffer`);try{n.remove(s,e)}catch{i.logger_(`Remove ${s} to ${e} from ${t}Buffer failed`)}}},timestampOffset:s=>(e,t)=>{const i=t[`${e}Buffer`];st(t.mediaSource,i)&&(t.logger_(`Setting ${e}timestampOffset to ${s}`),i.timestampOffset=s)},callback:s=>(e,t)=>{s()},endOfStream:s=>e=>{if(e.mediaSource.readyState==="open"){e.logger_(`Calling mediaSource endOfStream(${s||""})`);try{e.mediaSource.endOfStream(s)}catch(t){k.log.warn("Failed to call media source endOfStream",t)}}},duration:s=>e=>{e.logger_(`Setting mediaSource duration to ${s}`);try{e.mediaSource.duration=s}catch(t){k.log.warn("Failed to set media source duration",t)}},abort:()=>(s,e)=>{if(e.mediaSource.readyState!=="open")return;const t=e[`${s}Buffer`];if(st(e.mediaSource,t)){e.logger_(`calling abort on ${s}Buffer`);try{t.abort()}catch(i){k.log.warn(`Failed to abort on ${s}Buffer`,i)}}},addSourceBuffer:(s,e)=>t=>{const i=vd(s),n=_i(e);t.logger_(`Adding ${s}Buffer with codec ${e} to mediaSource`);const r=t.mediaSource.addSourceBuffer(n);r.addEventListener("updateend",t[`on${i}UpdateEnd_`]),r.addEventListener("error",t[`on${i}Error_`]),t.codecs[s]=e,t[`${s}Buffer`]=r},removeSourceBuffer:s=>e=>{const t=e[`${s}Buffer`];if(bd(s,e),!!st(e.mediaSource,t)){e.logger_(`Removing ${s}Buffer with codec ${e.codecs[s]} from mediaSource`);try{e.mediaSource.removeSourceBuffer(t)}catch(i){k.log.warn(`Failed to removeSourceBuffer ${s}Buffer`,i)}}},changeType:s=>(e,t)=>{const i=t[`${e}Buffer`],n=_i(s);if(!st(t.mediaSource,i))return;const r=s.substring(0,s.indexOf(".")),a=t.codecs[e];if(a.substring(0,a.indexOf("."))===r)return;const c={codecsChangeInfo:{from:a,to:s}};t.trigger({type:"codecschange",metadata:c}),t.logger_(`changing ${e}Buffer codec from ${a} to ${s}`);try{i.changeType(n),t.codecs[e]=s}catch(p){c.errorType=k.Error.StreamingCodecsChangeError,c.error=p,p.metadata=c,t.error_=p,t.trigger("error"),k.log.warn(`Failed to changeType on ${e}Buffer`,p)}}},Ne=({type:s,sourceUpdater:e,action:t,doneFn:i,name:n})=>{e.queue.push({type:s,action:t,doneFn:i,name:n}),gi(s,e)},Hl=(s,e)=>t=>{const i=e[`${s}Buffered`](),n=s0(i);if(e.logger_(`received "updateend" event for ${s} Source Buffer: `,n),e.queuePending[s]){const r=e.queuePending[s].doneFn;e.queuePending[s]=null,r&&r(e[`${s}Error_`])}gi(s,e)};class xd extends k.EventTarget{constructor(e){super(),this.mediaSource=e,this.sourceopenListener_=()=>gi("mediaSource",this),this.mediaSource.addEventListener("sourceopen",this.sourceopenListener_),this.logger_=Ge("SourceUpdater"),this.audioTimestampOffset_=0,this.videoTimestampOffset_=0,this.queue=[],this.queuePending={audio:null,video:null},this.delayedAudioAppendQueue_=[],this.videoAppendQueued_=!1,this.codecs={},this.onVideoUpdateEnd_=Hl("video",this),this.onAudioUpdateEnd_=Hl("audio",this),this.onVideoError_=t=>{this.videoError_=t},this.onAudioError_=t=>{this.audioError_=t},this.createdSourceBuffers_=!1,this.initializedEme_=!1,this.triggeredReady_=!1}initializedEme(){this.initializedEme_=!0,this.triggerReady()}hasCreatedSourceBuffers(){return this.createdSourceBuffers_}hasInitializedAnyEme(){return this.initializedEme_}ready(){return this.hasCreatedSourceBuffers()&&this.hasInitializedAnyEme()}createSourceBuffers(e){this.hasCreatedSourceBuffers()||(this.addOrChangeSourceBuffers(e),this.createdSourceBuffers_=!0,this.trigger("createdsourcebuffers"),this.triggerReady())}triggerReady(){this.ready()&&!this.triggeredReady_&&(this.triggeredReady_=!0,this.trigger("ready"))}addSourceBuffer(e,t){Ne({type:"mediaSource",sourceUpdater:this,action:Fe.addSourceBuffer(e,t),name:"addSourceBuffer"})}abort(e){Ne({type:e,sourceUpdater:this,action:Fe.abort(e),name:"abort"})}removeSourceBuffer(e){if(!this.canRemoveSourceBuffer()){k.log.error("removeSourceBuffer is not supported!");return}Ne({type:"mediaSource",sourceUpdater:this,action:Fe.removeSourceBuffer(e),name:"removeSourceBuffer"})}canRemoveSourceBuffer(){return!k.browser.IS_FIREFOX&&x.MediaSource&&x.MediaSource.prototype&&typeof x.MediaSource.prototype.removeSourceBuffer=="function"}static canChangeType(){return x.SourceBuffer&&x.SourceBuffer.prototype&&typeof x.SourceBuffer.prototype.changeType=="function"}canChangeType(){return this.constructor.canChangeType()}changeType(e,t){if(!this.canChangeType()){k.log.error("changeType is not supported!");return}Ne({type:e,sourceUpdater:this,action:Fe.changeType(t),name:"changeType"})}addOrChangeSourceBuffers(e){if(!e||typeof e!="object"||Object.keys(e).length===0)throw new Error("Cannot addOrChangeSourceBuffers to undefined codecs");Object.keys(e).forEach(t=>{const i=e[t];if(!this.hasCreatedSourceBuffers())return this.addSourceBuffer(t,i);this.canChangeType()&&this.changeType(t,i)})}appendBuffer(e,t){const{segmentInfo:i,type:n,bytes:r}=e;if(this.processedAppend_=!0,n==="audio"&&this.videoBuffer&&!this.videoAppendQueued_){this.delayedAudioAppendQueue_.push([e,t]),this.logger_(`delayed audio append of ${r.length} until video append`);return}const a=t;if(Ne({type:n,sourceUpdater:this,action:Fe.appendBuffer(r,i||{mediaIndex:-1},a),doneFn:t,name:"appendBuffer"}),n==="video"){if(this.videoAppendQueued_=!0,!this.delayedAudioAppendQueue_.length)return;const l=this.delayedAudioAppendQueue_.slice();this.logger_(`queuing delayed audio ${l.length} appendBuffers`),this.delayedAudioAppendQueue_.length=0,l.forEach(c=>{this.appendBuffer.apply(this,c)})}}audioBuffered(){return st(this.mediaSource,this.audioBuffer)&&this.audioBuffer.buffered?this.audioBuffer.buffered:be()}videoBuffered(){return st(this.mediaSource,this.videoBuffer)&&this.videoBuffer.buffered?this.videoBuffer.buffered:be()}buffered(){const e=st(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,t=st(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;return t&&!e?this.audioBuffered():e&&!t?this.videoBuffered():r0(this.audioBuffered(),this.videoBuffered())}setDuration(e,t=mt){Ne({type:"mediaSource",sourceUpdater:this,action:Fe.duration(e),name:"duration",doneFn:t})}endOfStream(e=null,t=mt){typeof e!="string"&&(e=void 0),Ne({type:"mediaSource",sourceUpdater:this,action:Fe.endOfStream(e),name:"endOfStream",doneFn:t})}removeAudio(e,t,i=mt){if(!this.audioBuffered().length||this.audioBuffered().end(0)===0){i();return}Ne({type:"audio",sourceUpdater:this,action:Fe.remove(e,t),doneFn:i,name:"remove"})}removeVideo(e,t,i=mt){if(!this.videoBuffered().length||this.videoBuffered().end(0)===0){i();return}Ne({type:"video",sourceUpdater:this,action:Fe.remove(e,t),doneFn:i,name:"remove"})}updating(){return!!(na("audio",this)||na("video",this))}audioTimestampOffset(e){return typeof e<"u"&&this.audioBuffer&&this.audioTimestampOffset_!==e&&(Ne({type:"audio",sourceUpdater:this,action:Fe.timestampOffset(e),name:"timestampOffset"}),this.audioTimestampOffset_=e),this.audioTimestampOffset_}videoTimestampOffset(e){return typeof e<"u"&&this.videoBuffer&&this.videoTimestampOffset_!==e&&(Ne({type:"video",sourceUpdater:this,action:Fe.timestampOffset(e),name:"timestampOffset"}),this.videoTimestampOffset_=e),this.videoTimestampOffset_}audioQueueCallback(e){this.audioBuffer&&Ne({type:"audio",sourceUpdater:this,action:Fe.callback(e),name:"callback"})}videoQueueCallback(e){this.videoBuffer&&Ne({type:"video",sourceUpdater:this,action:Fe.callback(e),name:"callback"})}dispose(){this.trigger("dispose"),V_.forEach(e=>{this.abort(e),this.canRemoveSourceBuffer()?this.removeSourceBuffer(e):this[`${e}QueueCallback`](()=>bd(e,this))}),this.videoAppendQueued_=!1,this.delayedAudioAppendQueue_.length=0,this.sourceopenListener_&&this.mediaSource.removeEventListener("sourceopen",this.sourceopenListener_),this.off()}}const Vl=s=>decodeURIComponent(escape(String.fromCharCode.apply(null,s))),z_=s=>{const e=new Uint8Array(s);return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")},ql=new Uint8Array(`
|
|
208
|
-
|
|
209
|
-
`.split("").map(s=>s.charCodeAt(0)));class W_ extends Error{constructor(){super("Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.")}}class G_ extends sa{constructor(e,t={}){super(e,t),this.mediaSource_=null,this.subtitlesTrack_=null,this.featuresNativeTextTracks_=e.featuresNativeTextTracks,this.loadVttJs=e.loadVttJs,this.shouldSaveSegmentTimingInfo_=!1}buffered_(){if(!this.subtitlesTrack_||!this.subtitlesTrack_.cues||!this.subtitlesTrack_.cues.length)return be();const e=this.subtitlesTrack_.cues,t=e[0].startTime,i=e[e.length-1].startTime;return be([[t,i]])}initSegmentForMap(e,t=!1){if(!e)return null;const i=Cn(e);let n=this.initSegments_[i];if(t&&!n&&e.bytes){const r=ql.byteLength+e.bytes.byteLength,a=new Uint8Array(r);a.set(e.bytes),a.set(ql,e.bytes.byteLength),this.initSegments_[i]=n={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:a}}return n||e}couldBeginLoading_(){return this.playlist_&&this.subtitlesTrack_&&!this.paused()}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}track(e){return typeof e>"u"?this.subtitlesTrack_:(this.subtitlesTrack_=e,this.state==="INIT"&&this.couldBeginLoading_()&&this.init_(),this.subtitlesTrack_)}remove(e,t){ns(e,t,this.subtitlesTrack_)}fillBuffer_(){const e=this.chooseNextRequest_();if(e){if(this.syncController_.timestampOffsetForTimeline(e.timeline)===null){const t=()=>{this.state="READY",this.paused()||this.monitorBuffer_()};this.syncController_.one("timestampoffset",t),this.state="WAITING_ON_TIMELINE";return}this.loadSegment_(e)}}timestampOffsetForSegment_(){return null}chooseNextRequest_(){return this.skipEmptySegments_(super.chooseNextRequest_())}skipEmptySegments_(e){for(;e&&e.segment.empty;){if(e.mediaIndex+1>=e.playlist.segments.length){e=null;break}e=this.generateSegmentInfo_({playlist:e.playlist,mediaIndex:e.mediaIndex+1,startOfSegment:e.startOfSegment+e.duration,isSyncRequest:e.isSyncRequest})}return e}stopForError(e){this.error(e),this.state="READY",this.pause(),this.trigger("error")}segmentRequestFinished_(e,t,i){if(!this.subtitlesTrack_){this.state="READY";return}if(this.saveTransferStats_(t.stats),!this.pendingSegment_){this.state="READY",this.mediaRequestsAborted+=1;return}if(e){e.code===ot.TIMEOUT&&this.handleTimeout_(),e.code===ot.ABORTED?this.mediaRequestsAborted+=1:this.mediaRequestsErrored+=1,this.stopForError(e);return}const n=this.pendingSegment_,r=i.mp4VttCues&&i.mp4VttCues.length;r&&(n.mp4VttCues=i.mp4VttCues),this.saveBandwidthRelatedStats_(n.duration,t.stats),t.key&&this.segmentKey(t.key,!0),this.state="APPENDING",this.trigger("appending");const a=n.segment;if(a.map&&(a.map.bytes=t.map.bytes),n.bytes=t.bytes,typeof x.WebVTT!="function"&&typeof this.loadVttJs=="function"){this.state="WAITING_ON_VTTJS",this.loadVttJs().then(()=>this.segmentRequestFinished_(e,t,i),()=>this.stopForError({message:"Error loading vtt.js"}));return}a.requested=!0;try{this.parseVTTCues_(n)}catch(l){this.stopForError({message:l.message,metadata:{errorType:k.Error.StreamingVttParserError,error:l}});return}if(r||this.updateTimeMapping_(n,this.syncController_.timelines[n.timeline],this.playlist_),n.cues.length?n.timingInfo={start:n.cues[0].startTime,end:n.cues[n.cues.length-1].endTime}:n.timingInfo={start:n.startOfSegment,end:n.startOfSegment+n.duration},n.isSyncRequest){this.trigger("syncinfoupdate"),this.pendingSegment_=null,this.state="READY";return}n.byteLength=n.bytes.byteLength,this.mediaSecondsLoaded+=a.duration,n.cues.forEach(l=>{this.subtitlesTrack_.addCue(this.featuresNativeTextTracks_?new x.VTTCue(l.startTime,l.endTime,l.text):l)}),P_(this.subtitlesTrack_),this.handleAppendsDone_()}handleData_(e,t){const i=e&&e.type==="vtt",n=t&&t.type==="text";i&&n&&super.handleData_(e,t)}updateTimingInfoEnd_(){}parseMp4VttCues_(e){const t=this.sourceUpdater_.videoTimestampOffset()===null?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset();e.mp4VttCues.forEach(i=>{const n=i.start+t,r=i.end+t,a=new x.VTTCue(n,r,i.cueText);i.settings&&i.settings.split(" ").forEach(l=>{const c=l.split(":"),p=c[0],g=c[1];a[p]=isNaN(g)?g:Number(g)}),e.cues.push(a)})}parseVTTCues_(e){let t,i=!1;if(typeof x.WebVTT!="function")throw new W_;if(e.cues=[],e.timestampmap={MPEGTS:0,LOCAL:0},e.mp4VttCues){this.parseMp4VttCues_(e);return}typeof x.TextDecoder=="function"?t=new x.TextDecoder("utf8"):(t=x.WebVTT.StringDecoder(),i=!0);const n=new x.WebVTT.Parser(x,x.vttjs,t);if(n.oncue=e.cues.push.bind(e.cues),n.ontimestampmap=a=>{e.timestampmap=a},n.onparsingerror=a=>{k.log.warn("Error encountered when parsing cues: "+a.message)},e.segment.map){let a=e.segment.map.bytes;i&&(a=Vl(a)),n.parse(a)}let r=e.bytes;i&&(r=Vl(r)),n.parse(r),n.flush()}updateTimeMapping_(e,t,i){const n=e.segment;if(!t)return;if(!e.cues.length){n.empty=!0;return}const{MPEGTS:r,LOCAL:a}=e.timestampmap,c=r/qt.ONE_SECOND_IN_TS-a+t.mapping;if(e.cues.forEach(p=>{const g=p.endTime-p.startTime,_=this.handleRollover_(p.startTime+c,t.time);p.startTime=Math.max(_,0),p.endTime=Math.max(_+g,0)}),!i.syncInfo){const p=e.cues[0].startTime,g=e.cues[e.cues.length-1].startTime;i.syncInfo={mediaSequence:i.mediaSequence+e.mediaIndex,time:Math.min(p,g-n.duration)}}}handleRollover_(e,t){if(t===null)return e;let i=e*qt.ONE_SECOND_IN_TS;const n=t*qt.ONE_SECOND_IN_TS;let r;for(n<i?r=-8589934592:r=8589934592;Math.abs(i-n)>4294967296;)i+=r;return i/qt.ONE_SECOND_IN_TS}}const K_=function(s,e){const t=s.cues;for(let i=0;i<t.length;i++){const n=t[i];if(e>=n.adStartTime&&e<=n.adEndTime)return n}return null},Q_=function(s,e,t=0){if(!s.segments)return;let i=t,n;for(let r=0;r<s.segments.length;r++){const a=s.segments[r];if(n||(n=K_(e,i+a.duration/2)),n){if("cueIn"in a){n.endTime=i,n.adEndTime=i,i+=a.duration,n=null;continue}if(i<n.endTime){i+=a.duration;continue}n.endTime+=a.duration}else if("cueOut"in a&&(n=new x.VTTCue(i,i+a.duration,a.cueOut),n.adStartTime=i,n.adEndTime=i+parseFloat(a.cueOut),e.addCue(n)),"cueOutCont"in a){const[l,c]=a.cueOutCont.split("/").map(parseFloat);n=new x.VTTCue(i,i+a.duration,""),n.adStartTime=i-l,n.adEndTime=n.adStartTime+c,e.addCue(n)}i+=a.duration}};class zl{constructor({start:e,end:t,segmentIndex:i,partIndex:n=null,appended:r=!1}){this.start_=e,this.end_=t,this.segmentIndex_=i,this.partIndex_=n,this.appended_=r}isInRange(e){return e>=this.start&&e<this.end}markAppended(){this.appended_=!0}resetAppendedStatus(){this.appended_=!1}get isAppended(){return this.appended_}get start(){return this.start_}get end(){return this.end_}get segmentIndex(){return this.segmentIndex_}get partIndex(){return this.partIndex_}}class X_{constructor(e,t=[]){this.segmentSyncInfo_=e,this.partsSyncInfo_=t}get segmentSyncInfo(){return this.segmentSyncInfo_}get partsSyncInfo(){return this.partsSyncInfo_}get hasPartsSyncInfo(){return this.partsSyncInfo_.length>0}resetAppendStatus(){this.segmentSyncInfo_.resetAppendedStatus(),this.partsSyncInfo_.forEach(e=>e.resetAppendedStatus())}}class Sd{constructor(){this.storage_=new Map,this.diagnostics_="",this.isReliable_=!1,this.start_=-1/0,this.end_=1/0}get start(){return this.start_}get end(){return this.end_}get diagnostics(){return this.diagnostics_}get isReliable(){return this.isReliable_}resetAppendedStatus(){this.storage_.forEach(e=>e.resetAppendStatus())}update(e,t){const{mediaSequence:i,segments:n}=e;if(this.isReliable_=this.isReliablePlaylist_(i,n),!!this.isReliable_)return this.updateStorage_(n,i,this.calculateBaseTime_(i,n,t))}getSyncInfoForTime(e){for(const{segmentSyncInfo:t,partsSyncInfo:i}of this.storage_.values())if(i.length){for(const n of i)if(n.isInRange(e))return n}else if(t.isInRange(e))return t;return null}getSyncInfoForMediaSequence(e){return this.storage_.get(e)}updateStorage_(e,t,i){const n=new Map;let r=`
|
|
210
|
-
`,a=i,l=t;this.start_=a,e.forEach((c,p)=>{const g=this.storage_.get(l),_=a,S=_+c.duration,E=!!(g&&g.segmentSyncInfo&&g.segmentSyncInfo.isAppended),w=new zl({start:_,end:S,appended:E,segmentIndex:p});c.syncInfo=w;let I=a;const L=(c.parts||[]).map((P,F)=>{const $=I,B=I+P.duration,O=!!(g&&g.partsSyncInfo&&g.partsSyncInfo[F]&&g.partsSyncInfo[F].isAppended),j=new zl({start:$,end:B,appended:O,segmentIndex:p,partIndex:F});return I=B,r+=`Media Sequence: ${l}.${F} | Range: ${$} --> ${B} | Appended: ${O}
|
|
211
|
-
`,P.syncInfo=j,j});n.set(l,new X_(w,L)),r+=`${Td(c.resolvedUri)} | Media Sequence: ${l} | Range: ${_} --> ${S} | Appended: ${E}
|
|
212
|
-
`,l++,a=S}),this.end_=a,this.storage_=n,this.diagnostics_=r}calculateBaseTime_(e,t,i){if(!this.storage_.size)return 0;if(this.storage_.has(e))return this.storage_.get(e).segmentSyncInfo.start;const n=Math.min(...this.storage_.keys());if(e<n){const r=n-e;let a=this.storage_.get(n).segmentSyncInfo.start;for(let l=0;l<r;l++){const c=t[l];a-=c.duration}return a}return i}isReliablePlaylist_(e,t){return e!=null&&Array.isArray(t)&&t.length}}class Wl extends Sd{constructor(e){super(),this.parent_=e}calculateBaseTime_(e,t,i){if(!this.storage_.size){const n=this.parent_.getSyncInfoForMediaSequence(e);return n?n.segmentSyncInfo.start:0}return super.calculateBaseTime_(e,t,i)}}const Y_=86400,Dr=[{name:"VOD",run:(s,e,t,i,n)=>t!==1/0?{time:0,segmentIndex:0,partIndex:null}:null},{name:"MediaSequence",run:(s,e,t,i,n,r)=>{const a=s.getMediaSequenceSync(r);if(!a||!a.isReliable)return null;const l=a.getSyncInfoForTime(n);return l?{time:l.start,partIndex:l.partIndex,segmentIndex:l.segmentIndex}:null}},{name:"ProgramDateTime",run:(s,e,t,i,n)=>{if(!Object.keys(s.timelineToDatetimeMappings).length)return null;let r=null,a=null;const l=Kr(e);n=n||0;for(let c=0;c<l.length;c++){const p=e.endList||n===0?c:l.length-(c+1),g=l[p],_=g.segment,S=s.timelineToDatetimeMappings[_.timeline];if(!S||!_.dateTimeObject)continue;let w=_.dateTimeObject.getTime()/1e3+S;if(_.parts&&typeof g.partIndex=="number")for(let L=0;L<g.partIndex;L++)w+=_.parts[L].duration;const I=Math.abs(n-w);if(a!==null&&(I===0||a<I))break;a=I,r={time:w,segmentIndex:g.segmentIndex,partIndex:g.partIndex}}return r}},{name:"Segment",run:(s,e,t,i,n)=>{let r=null,a=null;n=n||0;const l=Kr(e);for(let c=0;c<l.length;c++){const p=e.endList||n===0?c:l.length-(c+1),g=l[p],_=g.segment,S=g.part&&g.part.start||_&&_.start;if(_.timeline===i&&typeof S<"u"){const E=Math.abs(n-S);if(a!==null&&a<E)break;(!r||a===null||a>=E)&&(a=E,r={time:S,segmentIndex:g.segmentIndex,partIndex:g.partIndex})}}return r}},{name:"Discontinuity",run:(s,e,t,i,n)=>{let r=null;if(n=n||0,e.discontinuityStarts&&e.discontinuityStarts.length){let a=null;for(let l=0;l<e.discontinuityStarts.length;l++){const c=e.discontinuityStarts[l],p=e.discontinuitySequence+l+1,g=s.discontinuities[p];if(g){const _=Math.abs(n-g.time);if(a!==null&&a<_)break;(!r||a===null||a>=_)&&(a=_,r={time:g.time,segmentIndex:c,partIndex:null})}}}return r}},{name:"Playlist",run:(s,e,t,i,n)=>e.syncInfo?{time:e.syncInfo.time,segmentIndex:e.syncInfo.mediaSequence-e.mediaSequence,partIndex:null}:null}];class J_ extends k.EventTarget{constructor(e={}){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={};const t=new Sd,i=new Wl(t),n=new Wl(t);this.mediaSequenceStorage_={main:t,audio:i,vtt:n},this.logger_=Ge("SyncController")}getMediaSequenceSync(e){return this.mediaSequenceStorage_[e]||null}getSyncPoint(e,t,i,n,r){if(t!==1/0)return Dr.find(({name:c})=>c==="VOD").run(this,e,t);const a=this.runStrategies_(e,t,i,n,r);if(!a.length)return null;for(const l of a){const{syncPoint:c,strategy:p}=l,{segmentIndex:g,time:_}=c;if(g<0)continue;const S=e.segments[g],E=_,w=E+S.duration;if(this.logger_(`Strategy: ${p}. Current time: ${n}. selected segment: ${g}. Time: [${E} -> ${w}]}`),n>=E&&n<w)return this.logger_("Found sync point with exact match: ",c),c}return this.selectSyncPoint_(a,{key:"time",value:n})}getExpiredTime(e,t){if(!e||!e.segments)return null;const i=this.runStrategies_(e,t,e.discontinuitySequence,0);if(!i.length)return null;const n=this.selectSyncPoint_(i,{key:"segmentIndex",value:0});return n.segmentIndex>0&&(n.time*=-1),Math.abs(n.time+hs({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:n.segmentIndex,endIndex:0}))}runStrategies_(e,t,i,n,r){const a=[];for(let l=0;l<Dr.length;l++){const c=Dr[l],p=c.run(this,e,t,i,n,r);p&&(p.strategy=c.name,a.push({strategy:c.name,syncPoint:p}))}return a}selectSyncPoint_(e,t){let i=e[0].syncPoint,n=Math.abs(e[0].syncPoint[t.key]-t.value),r=e[0].strategy;for(let a=1;a<e.length;a++){const l=Math.abs(e[a].syncPoint[t.key]-t.value);l<n&&(n=l,i=e[a].syncPoint,r=e[a].strategy)}return this.logger_(`syncPoint for [${t.key}: ${t.value}] chosen with strategy [${r}]: [time:${i.time}, segmentIndex:${i.segmentIndex}`+(typeof i.partIndex=="number"?`,partIndex:${i.partIndex}`:"")+"]"),i}saveExpiredSegmentInfo(e,t){const i=t.mediaSequence-e.mediaSequence;if(i>Y_){k.log.warn(`Not saving expired segment info. Media sequence gap ${i} is too large.`);return}for(let n=i-1;n>=0;n--){const r=e.segments[n];if(r&&typeof r.start<"u"){t.syncInfo={mediaSequence:e.mediaSequence+n,time:r.start},this.logger_(`playlist refresh sync: [time:${t.syncInfo.time}, mediaSequence: ${t.syncInfo.mediaSequence}]`),this.trigger("syncinfoupdate");break}}}setDateTimeMappingForStart(e){if(this.timelineToDatetimeMappings={},e.segments&&e.segments.length&&e.segments[0].dateTimeObject){const t=e.segments[0],i=t.dateTimeObject.getTime()/1e3;this.timelineToDatetimeMappings[t.timeline]=-i}}saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:t}){const i=this.calculateSegmentTimeMapping_(e,e.timingInfo,t),n=e.segment;i&&(this.saveDiscontinuitySyncInfo_(e),e.playlist.syncInfo||(e.playlist.syncInfo={mediaSequence:e.playlist.mediaSequence+e.mediaIndex,time:n.start}));const r=n.dateTimeObject;n.discontinuity&&t&&r&&(this.timelineToDatetimeMappings[n.timeline]=-(r.getTime()/1e3))}timestampOffsetForTimeline(e){return typeof this.timelines[e]>"u"?null:this.timelines[e].time}mappingForTimeline(e){return typeof this.timelines[e]>"u"?null:this.timelines[e].mapping}calculateSegmentTimeMapping_(e,t,i){const n=e.segment,r=e.part;let a=this.timelines[e.timeline],l,c;if(typeof e.timestampOffset=="number")a={time:e.startOfSegment,mapping:e.startOfSegment-t.start},i&&(this.timelines[e.timeline]=a,this.trigger("timestampoffset"),this.logger_(`time mapping for timeline ${e.timeline}: [time: ${a.time}] [mapping: ${a.mapping}]`)),l=e.startOfSegment,c=t.end+a.mapping;else if(a)l=t.start+a.mapping,c=t.end+a.mapping;else return!1;return r&&(r.start=l,r.end=c),(!n.start||l<n.start)&&(n.start=l),n.end=c,!0}saveDiscontinuitySyncInfo_(e){const t=e.playlist,i=e.segment;if(i.discontinuity)this.discontinuities[i.timeline]={time:i.start,accuracy:0};else if(t.discontinuityStarts&&t.discontinuityStarts.length)for(let n=0;n<t.discontinuityStarts.length;n++){const r=t.discontinuityStarts[n],a=t.discontinuitySequence+n+1,l=r-e.mediaIndex,c=Math.abs(l);if(!this.discontinuities[a]||this.discontinuities[a].accuracy>c){let p;l<0?p=i.start-hs({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex,endIndex:r}):p=i.end+hs({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex+1,endIndex:r}),this.discontinuities[a]={time:p,accuracy:c}}}}dispose(){this.trigger("dispose"),this.off()}}class Z_ extends k.EventTarget{constructor(){super(),this.pendingTimelineChanges_={},this.lastTimelineChanges_={}}clearPendingTimelineChange(e){this.pendingTimelineChanges_[e]=null,this.trigger("pendingtimelinechange")}pendingTimelineChange({type:e,from:t,to:i}){return typeof t=="number"&&typeof i=="number"&&(this.pendingTimelineChanges_[e]={type:e,from:t,to:i},this.trigger("pendingtimelinechange")),this.pendingTimelineChanges_[e]}lastTimelineChange({type:e,from:t,to:i}){if(typeof t=="number"&&typeof i=="number"){this.lastTimelineChanges_[e]={type:e,from:t,to:i},delete this.pendingTimelineChanges_[e];const n={timelineChangeInfo:{from:t,to:i}};this.trigger({type:"timelinechange",metadata:n})}return this.lastTimelineChanges_[e]}dispose(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()}}const ey=ld(ud(function(){var s=function(){function I(){this.listeners={}}var L=I.prototype;return L.on=function(F,$){this.listeners[F]||(this.listeners[F]=[]),this.listeners[F].push($)},L.off=function(F,$){if(!this.listeners[F])return!1;var B=this.listeners[F].indexOf($);return this.listeners[F]=this.listeners[F].slice(0),this.listeners[F].splice(B,1),B>-1},L.trigger=function(F){var $=this.listeners[F];if($)if(arguments.length===2)for(var B=$.length,O=0;O<B;++O)$[O].call(this,arguments[1]);else for(var j=Array.prototype.slice.call(arguments,1),R=$.length,U=0;U<R;++U)$[U].apply(this,j)},L.dispose=function(){this.listeners={}},L.pipe=function(F){this.on("data",function($){F.push($)})},I}();/*! @name pkcs7 @version 1.0.4 @license Apache-2.0 */function e(I){return I.subarray(0,I.byteLength-I[I.byteLength-1])}/*! @name aes-decrypter @version 4.0.2 @license Apache-2.0 */const t=function(){const I=[[[],[],[],[],[]],[[],[],[],[],[]]],L=I[0],P=I[1],F=L[4],$=P[4];let B,O,j;const R=[],U=[];let Y,le,_e,ue,q,ee;for(B=0;B<256;B++)U[(R[B]=B<<1^(B>>7)*283)^B]=B;for(O=j=0;!F[O];O^=Y||1,j=U[j]||1)for(ue=j^j<<1^j<<2^j<<3^j<<4,ue=ue>>8^ue&255^99,F[O]=ue,$[ue]=O,_e=R[le=R[Y=R[O]]],ee=_e*16843009^le*65537^Y*257^O*16843008,q=R[ue]*257^ue*16843008,B=0;B<4;B++)L[B][O]=q=q<<24^q>>>8,P[B][ue]=ee=ee<<24^ee>>>8;for(B=0;B<5;B++)L[B]=L[B].slice(0),P[B]=P[B].slice(0);return I};let i=null;class n{constructor(L){i||(i=t()),this._tables=[[i[0][0].slice(),i[0][1].slice(),i[0][2].slice(),i[0][3].slice(),i[0][4].slice()],[i[1][0].slice(),i[1][1].slice(),i[1][2].slice(),i[1][3].slice(),i[1][4].slice()]];let P,F,$;const B=this._tables[0][4],O=this._tables[1],j=L.length;let R=1;if(j!==4&&j!==6&&j!==8)throw new Error("Invalid aes key size");const U=L.slice(0),Y=[];for(this._key=[U,Y],P=j;P<4*j+28;P++)$=U[P-1],(P%j===0||j===8&&P%j===4)&&($=B[$>>>24]<<24^B[$>>16&255]<<16^B[$>>8&255]<<8^B[$&255],P%j===0&&($=$<<8^$>>>24^R<<24,R=R<<1^(R>>7)*283)),U[P]=U[P-j]^$;for(F=0;P;F++,P--)$=U[F&3?P:P-4],P<=4||F<4?Y[F]=$:Y[F]=O[0][B[$>>>24]]^O[1][B[$>>16&255]]^O[2][B[$>>8&255]]^O[3][B[$&255]]}decrypt(L,P,F,$,B,O){const j=this._key[1];let R=L^j[0],U=$^j[1],Y=F^j[2],le=P^j[3],_e,ue,q;const ee=j.length/4-2;let He,dt=4;const Tt=this._tables[1],Ot=Tt[0],Mt=Tt[1],Rt=Tt[2],Bt=Tt[3],Ft=Tt[4];for(He=0;He<ee;He++)_e=Ot[R>>>24]^Mt[U>>16&255]^Rt[Y>>8&255]^Bt[le&255]^j[dt],ue=Ot[U>>>24]^Mt[Y>>16&255]^Rt[le>>8&255]^Bt[R&255]^j[dt+1],q=Ot[Y>>>24]^Mt[le>>16&255]^Rt[R>>8&255]^Bt[U&255]^j[dt+2],le=Ot[le>>>24]^Mt[R>>16&255]^Rt[U>>8&255]^Bt[Y&255]^j[dt+3],dt+=4,R=_e,U=ue,Y=q;for(He=0;He<4;He++)B[(3&-He)+O]=Ft[R>>>24]<<24^Ft[U>>16&255]<<16^Ft[Y>>8&255]<<8^Ft[le&255]^j[dt++],_e=R,R=U,U=Y,Y=le,le=_e}}class r extends s{constructor(){super(s),this.jobs=[],this.delay=1,this.timeout_=null}processJob_(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null}push(L){this.jobs.push(L),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))}}const a=function(I){return I<<24|(I&65280)<<8|(I&16711680)>>8|I>>>24},l=function(I,L,P){const F=new Int32Array(I.buffer,I.byteOffset,I.byteLength>>2),$=new n(Array.prototype.slice.call(L)),B=new Uint8Array(I.byteLength),O=new Int32Array(B.buffer);let j,R,U,Y,le,_e,ue,q,ee;for(j=P[0],R=P[1],U=P[2],Y=P[3],ee=0;ee<F.length;ee+=4)le=a(F[ee]),_e=a(F[ee+1]),ue=a(F[ee+2]),q=a(F[ee+3]),$.decrypt(le,_e,ue,q,O,ee),O[ee]=a(O[ee]^j),O[ee+1]=a(O[ee+1]^R),O[ee+2]=a(O[ee+2]^U),O[ee+3]=a(O[ee+3]^Y),j=le,R=_e,U=ue,Y=q;return B};class c{constructor(L,P,F,$){const B=c.STEP,O=new Int32Array(L.buffer),j=new Uint8Array(L.byteLength);let R=0;for(this.asyncStream_=new r,this.asyncStream_.push(this.decryptChunk_(O.subarray(R,R+B),P,F,j)),R=B;R<O.length;R+=B)F=new Uint32Array([a(O[R-4]),a(O[R-3]),a(O[R-2]),a(O[R-1])]),this.asyncStream_.push(this.decryptChunk_(O.subarray(R,R+B),P,F,j));this.asyncStream_.push(function(){$(null,e(j))})}static get STEP(){return 32e3}decryptChunk_(L,P,F,$){return function(){const B=l(L,P,F);$.set(B,L.byteOffset)}}}var p=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},g;typeof window<"u"?g=window:typeof p<"u"?g=p:typeof self<"u"?g=self:g={};var _=g,S=function(L){return ArrayBuffer.isView==="function"?ArrayBuffer.isView(L):L&&L.buffer instanceof ArrayBuffer},E=_.BigInt||Number;E("0x1"),E("0x100"),E("0x10000"),E("0x1000000"),E("0x100000000"),E("0x10000000000"),E("0x1000000000000"),E("0x100000000000000"),E("0x10000000000000000"),function(){var I=new Uint16Array([65484]),L=new Uint8Array(I.buffer,I.byteOffset,I.byteLength);return L[0]===255?"big":L[0]===204?"little":"unknown"}();const w=function(I){const L={};return Object.keys(I).forEach(P=>{const F=I[P];S(F)?L[P]={bytes:F.buffer,byteOffset:F.byteOffset,byteLength:F.byteLength}:L[P]=F}),L};self.onmessage=function(I){const L=I.data,P=new Uint8Array(L.encrypted.bytes,L.encrypted.byteOffset,L.encrypted.byteLength),F=new Uint32Array(L.key.bytes,L.key.byteOffset,L.key.byteLength/4),$=new Uint32Array(L.iv.bytes,L.iv.byteOffset,L.iv.byteLength/4);new c(P,F,$,function(B,O){self.postMessage(w({source:L.source,decrypted:O}),[O.buffer])})}}));var ty=od(ey);const iy=s=>{let e=s.default?"main":"alternative";return s.characteristics&&s.characteristics.indexOf("public.accessibility.describes-video")>=0&&(e="main-desc"),e},Cd=(s,e)=>{s.abort(),s.pause(),e&&e.activePlaylistLoader&&(e.activePlaylistLoader.pause(),e.activePlaylistLoader=null)},ra=(s,e)=>{e.activePlaylistLoader=s,s.load()},sy=(s,e)=>()=>{const{segmentLoaders:{[s]:t,main:i},mediaTypes:{[s]:n}}=e,r=n.activeTrack(),a=n.getActiveGroup(),l=n.activePlaylistLoader,c=n.lastGroup_;if(!(a&&c&&a.id===c.id)&&(n.lastGroup_=a,n.lastTrack_=r,Cd(t,n),!(!a||a.isMainPlaylist))){if(!a.playlistLoader){l&&i.resetEverything();return}t.resyncLoader(),ra(a.playlistLoader,n)}},ny=(s,e)=>()=>{const{segmentLoaders:{[s]:t},mediaTypes:{[s]:i}}=e;i.lastGroup_=null,t.abort(),t.pause()},ry=(s,e)=>()=>{const{mainPlaylistLoader:t,segmentLoaders:{[s]:i,main:n},mediaTypes:{[s]:r}}=e,a=r.activeTrack(),l=r.getActiveGroup(),c=r.activePlaylistLoader,p=r.lastTrack_;if(!(p&&a&&p.id===a.id)&&(r.lastGroup_=l,r.lastTrack_=a,Cd(i,r),!!l)){if(l.isMainPlaylist){if(!a||!p||a.id===p.id)return;const g=e.vhs.playlistController_,_=g.selectPlaylist();if(g.media()===_)return;r.logger_(`track change. Switching main audio from ${p.id} to ${a.id}`),t.pause(),n.resetEverything(),g.fastQualityChange_(_);return}if(s==="AUDIO"){if(!l.playlistLoader){n.setAudio(!0),n.resetEverything();return}i.setAudio(!0),n.setAudio(!1)}if(c===l.playlistLoader){ra(l.playlistLoader,r);return}i.track&&i.track(a),i.resetEverything(),ra(l.playlistLoader,r)}},En={AUDIO:(s,e)=>()=>{const{mediaTypes:{[s]:t},excludePlaylist:i}=e,n=t.activeTrack(),r=t.activeGroup(),a=(r.filter(c=>c.default)[0]||r[0]).id,l=t.tracks[a];if(n===l){i({error:{message:"Problem encountered loading the default audio track."}});return}k.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");for(const c in t.tracks)t.tracks[c].enabled=t.tracks[c]===l;t.onTrackChanged()},SUBTITLES:(s,e)=>()=>{const{mediaTypes:{[s]:t}}=e;k.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track.");const i=t.activeTrack();i&&(i.mode="disabled"),t.onTrackChanged()}},Gl={AUDIO:(s,e,t)=>{if(!e)return;const{tech:i,requestOptions:n,segmentLoaders:{[s]:r}}=t;e.on("loadedmetadata",()=>{const a=e.media();r.playlist(a,n),(!i.paused()||a.endList&&i.preload()!=="none")&&r.load()}),e.on("loadedplaylist",()=>{r.playlist(e.media(),n),i.paused()||r.load()}),e.on("error",En[s](s,t))},SUBTITLES:(s,e,t)=>{const{tech:i,requestOptions:n,segmentLoaders:{[s]:r},mediaTypes:{[s]:a}}=t;e.on("loadedmetadata",()=>{const l=e.media();r.playlist(l,n),r.track(a.activeTrack()),(!i.paused()||l.endList&&i.preload()!=="none")&&r.load()}),e.on("loadedplaylist",()=>{r.playlist(e.media(),n),i.paused()||r.load()}),e.on("error",En[s](s,t))}},ay={AUDIO:(s,e)=>{const{vhs:t,sourceType:i,segmentLoaders:{[s]:n},requestOptions:r,main:{mediaGroups:a},mediaTypes:{[s]:{groups:l,tracks:c,logger_:p}},mainPlaylistLoader:g}=e,_=vs(g.main);(!a[s]||Object.keys(a[s]).length===0)&&(a[s]={main:{default:{default:!0}}},_&&(a[s].main.default.playlists=g.main.playlists));for(const S in a[s]){l[S]||(l[S]=[]);for(const E in a[s][S]){let w=a[s][S][E],I;if(_?(p(`AUDIO group '${S}' label '${E}' is a main playlist`),w.isMainPlaylist=!0,I=null):i==="vhs-json"&&w.playlists?I=new oi(w.playlists[0],t,r):w.resolvedUri?I=new oi(w.resolvedUri,t,r):w.playlists&&i==="dash"?I=new ea(w.playlists[0],t,r,g):I=null,w=Z({id:E,playlistLoader:I},w),Gl[s](s,w.playlistLoader,e),l[S].push(w),typeof c[E]>"u"){const L=new k.AudioTrack({id:E,kind:iy(w),enabled:!1,language:w.language,default:w.default,label:E});c[E]=L}}}n.on("error",En[s](s,e))},SUBTITLES:(s,e)=>{const{tech:t,vhs:i,sourceType:n,segmentLoaders:{[s]:r},requestOptions:a,main:{mediaGroups:l},mediaTypes:{[s]:{groups:c,tracks:p}},mainPlaylistLoader:g}=e;for(const _ in l[s]){c[_]||(c[_]=[]);for(const S in l[s][_]){if(!i.options_.useForcedSubtitles&&l[s][_][S].forced)continue;let E=l[s][_][S],w;if(n==="hls")w=new oi(E.resolvedUri,i,a);else if(n==="dash"){if(!E.playlists.filter(L=>L.excludeUntil!==1/0).length)return;w=new ea(E.playlists[0],i,a,g)}else n==="vhs-json"&&(w=new oi(E.playlists?E.playlists[0]:E.resolvedUri,i,a));if(E=Z({id:S,playlistLoader:w},E),Gl[s](s,E.playlistLoader,e),c[_].push(E),typeof p[S]>"u"){const I=t.addRemoteTextTrack({id:S,kind:"subtitles",default:E.default&&E.autoselect,language:E.language,label:S},!1).track;p[S]=I}}}r.on("error",En[s](s,e))},"CLOSED-CAPTIONS":(s,e)=>{const{tech:t,main:{mediaGroups:i},mediaTypes:{[s]:{groups:n,tracks:r}}}=e;for(const a in i[s]){n[a]||(n[a]=[]);for(const l in i[s][a]){const c=i[s][a][l];if(!/^(?:CC|SERVICE)/.test(c.instreamId))continue;const p=t.options_.vhs&&t.options_.vhs.captionServices||{};let g={label:l,language:c.language,instreamId:c.instreamId,default:c.default&&c.autoselect};if(p[g.instreamId]&&(g=Z(g,p[g.instreamId])),g.default===void 0&&delete g.default,n[a].push(Z({id:l},c)),typeof r[l]>"u"){const _=t.addRemoteTextTrack({id:g.instreamId,kind:"captions",default:g.default,language:g.language,label:g.label},!1).track;r[l]=_}}}}},Ed=(s,e)=>{for(let t=0;t<s.length;t++)if(ja(e,s[t])||s[t].playlists&&Ed(s[t].playlists,e))return!0;return!1},oy=(s,e)=>t=>{const{mainPlaylistLoader:i,mediaTypes:{[s]:{groups:n}}}=e,r=i.media();if(!r)return null;let a=null;r.attributes[s]&&(a=n[r.attributes[s]]);const l=Object.keys(n);if(!a)if(s==="AUDIO"&&l.length>1&&vs(e.main))for(let c=0;c<l.length;c++){const p=n[l[c]];if(Ed(p,r)){a=p;break}}else n.main?a=n.main:l.length===1&&(a=n[l[0]]);return typeof t>"u"?a:t===null||!a?null:a.filter(c=>c.id===t.id)[0]||null},ly={AUDIO:(s,e)=>()=>{const{mediaTypes:{[s]:{tracks:t}}}=e;for(const i in t)if(t[i].enabled)return t[i];return null},SUBTITLES:(s,e)=>()=>{const{mediaTypes:{[s]:{tracks:t}}}=e;for(const i in t)if(t[i].mode==="showing"||t[i].mode==="hidden")return t[i];return null}},uy=(s,{mediaTypes:e})=>()=>{const t=e[s].activeTrack();return t?e[s].activeGroup(t):null},hy=s=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(p=>{ay[p](p,s)});const{mediaTypes:e,mainPlaylistLoader:t,tech:i,vhs:n,segmentLoaders:{["AUDIO"]:r,main:a}}=s;["AUDIO","SUBTITLES"].forEach(p=>{e[p].activeGroup=oy(p,s),e[p].activeTrack=ly[p](p,s),e[p].onGroupChanged=sy(p,s),e[p].onGroupChanging=ny(p,s),e[p].onTrackChanged=ry(p,s),e[p].getActiveGroup=uy(p,s)});const l=e.AUDIO.activeGroup();if(l){const p=(l.filter(_=>_.default)[0]||l[0]).id;e.AUDIO.tracks[p].enabled=!0,e.AUDIO.onGroupChanged(),e.AUDIO.onTrackChanged(),e.AUDIO.getActiveGroup().playlistLoader?(a.setAudio(!1),r.setAudio(!0)):a.setAudio(!0)}t.on("mediachange",()=>{["AUDIO","SUBTITLES"].forEach(p=>e[p].onGroupChanged())}),t.on("mediachanging",()=>{["AUDIO","SUBTITLES"].forEach(p=>e[p].onGroupChanging())});const c=()=>{e.AUDIO.onTrackChanged(),i.trigger({type:"usage",name:"vhs-audio-change"})};i.audioTracks().addEventListener("change",c),i.remoteTextTracks().addEventListener("change",e.SUBTITLES.onTrackChanged),n.on("dispose",()=>{i.audioTracks().removeEventListener("change",c),i.remoteTextTracks().removeEventListener("change",e.SUBTITLES.onTrackChanged)}),i.clearTracks("audio");for(const p in e.AUDIO.tracks)i.audioTracks().addTrack(e.AUDIO.tracks[p])},dy=()=>{const s={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{s[e]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:mt,activeTrack:mt,getActiveGroup:mt,onGroupChanged:mt,onTrackChanged:mt,lastTrack_:null,logger_:Ge(`MediaGroups[${e}]`)}}),s};class Kl{constructor(){this.priority_=[],this.pathwayClones_=new Map}set version(e){e===1&&(this.version_=e)}set ttl(e){this.ttl_=e||300}set reloadUri(e){e&&(this.reloadUri_=Oe(this.reloadUri_,e))}set priority(e){e&&e.length&&(this.priority_=e)}set pathwayClones(e){e&&e.length&&(this.pathwayClones_=new Map(e.map(t=>[t.ID,t])))}get version(){return this.version_}get ttl(){return this.ttl_}get reloadUri(){return this.reloadUri_}get priority(){return this.priority_}get pathwayClones(){return this.pathwayClones_}}class cy extends k.EventTarget{constructor(e,t){super(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=!1,this.availablePathways_=new Set,this.steeringManifest=new Kl,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.currentPathwayClones=new Map,this.nextPathwayClones=new Map,this.excludedSteeringManifestURLs=new Set,this.logger_=Ge("Content Steering"),this.xhr_=e,this.getBandwidth_=t}assignTagProperties(e,t){this.manifestType_=t.serverUri?"HLS":"DASH";const i=t.serverUri||t.serverURL;if(!i){this.logger_(`steering manifest URL is ${i}, cannot request steering manifest.`),this.trigger("error");return}if(i.startsWith("data:")){this.decodeDataUriManifest_(i.substring(i.indexOf(",")+1));return}this.steeringManifest.reloadUri=Oe(e,i),this.defaultPathway=t.pathwayId||t.defaultServiceLocation,this.queryBeforeStart=t.queryBeforeStart,this.proxyServerUrl_=t.proxyServerURL,this.defaultPathway&&!this.queryBeforeStart&&this.trigger("content-steering")}requestSteeringManifest(e){const t=this.steeringManifest.reloadUri;if(!t)return;const i=e?t:this.getRequestURI(t);if(!i){this.logger_("No valid content steering manifest URIs. Stopping content steering."),this.trigger("error"),this.dispose();return}const n={contentSteeringInfo:{uri:i}};this.trigger({type:"contentsteeringloadstart",metadata:n}),this.request_=this.xhr_({uri:i,requestType:"content-steering-manifest"},(r,a)=>{if(r){if(a.status===410){this.logger_(`manifest request 410 ${r}.`),this.logger_(`There will be no more content steering requests to ${i} this session.`),this.excludedSteeringManifestURLs.add(i);return}if(a.status===429){const p=a.responseHeaders["retry-after"];this.logger_(`manifest request 429 ${r}.`),this.logger_(`content steering will retry in ${p} seconds.`),this.startTTLTimeout_(parseInt(p,10));return}this.logger_(`manifest failed to load ${r}.`),this.startTTLTimeout_();return}this.trigger({type:"contentsteeringloadcomplete",metadata:n});let l;try{l=JSON.parse(this.request_.responseText)}catch(p){const g={errorType:k.Error.StreamingContentSteeringParserError,error:p};this.trigger({type:"error",metadata:g})}this.assignSteeringProperties_(l);const c={contentSteeringInfo:n.contentSteeringInfo,contentSteeringManifest:{version:this.steeringManifest.version,reloadUri:this.steeringManifest.reloadUri,priority:this.steeringManifest.priority}};this.trigger({type:"contentsteeringparsed",metadata:c}),this.startTTLTimeout_()})}setProxyServerUrl_(e){const t=new x.URL(e),i=new x.URL(this.proxyServerUrl_);return i.searchParams.set("url",encodeURI(t.toString())),this.setSteeringParams_(i.toString())}decodeDataUriManifest_(e){const t=JSON.parse(x.atob(e));this.assignSteeringProperties_(t)}setSteeringParams_(e){const t=new x.URL(e),i=this.getPathway(),n=this.getBandwidth_();if(i){const r=`_${this.manifestType_}_pathway`;t.searchParams.set(r,i)}if(n){const r=`_${this.manifestType_}_throughput`;t.searchParams.set(r,n)}return t.toString()}assignSteeringProperties_(e){if(this.steeringManifest.version=e.VERSION,!this.steeringManifest.version){this.logger_(`manifest version is ${e.VERSION}, which is not supported.`),this.trigger("error");return}this.steeringManifest.ttl=e.TTL,this.steeringManifest.reloadUri=e["RELOAD-URI"],this.steeringManifest.priority=e["PATHWAY-PRIORITY"]||e["SERVICE-LOCATION-PRIORITY"],this.steeringManifest.pathwayClones=e["PATHWAY-CLONES"],this.nextPathwayClones=this.steeringManifest.pathwayClones,this.availablePathways_.size||(this.logger_("There are no available pathways for content steering. Ending content steering."),this.trigger("error"),this.dispose());const i=(n=>{for(const r of n)if(this.availablePathways_.has(r))return r;return[...this.availablePathways_][0]})(this.steeringManifest.priority);this.currentPathway!==i&&(this.currentPathway=i,this.trigger("content-steering"))}getPathway(){return this.currentPathway||this.defaultPathway}getRequestURI(e){if(!e)return null;const t=n=>this.excludedSteeringManifestURLs.has(n);if(this.proxyServerUrl_){const n=this.setProxyServerUrl_(e);if(!t(n))return n}const i=this.setSteeringParams_(e);return t(i)?null:i}startTTLTimeout_(e=this.steeringManifest.ttl){const t=e*1e3;this.ttlTimeout_=x.setTimeout(()=>{this.requestSteeringManifest()},t)}clearTTLTimeout_(){x.clearTimeout(this.ttlTimeout_),this.ttlTimeout_=null}abort(){this.request_&&this.request_.abort(),this.request_=null}dispose(){this.off("content-steering"),this.off("error"),this.abort(),this.clearTTLTimeout_(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=null,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.excludedSteeringManifestURLs=new Set,this.availablePathways_=new Set,this.steeringManifest=new Kl}addAvailablePathway(e){e&&this.availablePathways_.add(e)}clearAvailablePathways(){this.availablePathways_.clear()}excludePathway(e){return this.availablePathways_.delete(e)}didDASHTagChange(e,t){return!t&&this.steeringManifest.reloadUri||t&&(Oe(e,t.serverURL)!==this.steeringManifest.reloadUri||t.defaultServiceLocation!==this.defaultPathway||t.queryBeforeStart!==this.queryBeforeStart||t.proxyServerURL!==this.proxyServerUrl_)}getAvailablePathways(){return this.availablePathways_}}const fy=(s,e)=>{let t=null;return(...i)=>{clearTimeout(t),t=setTimeout(()=>{s.apply(null,i)},e)}},py=10;let wt;const my=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],gy=function(s){return this.audioSegmentLoader_[s]+this.mainSegmentLoader_[s]},_y=function({currentPlaylist:s,buffered:e,currentTime:t,nextPlaylist:i,bufferLowWaterLine:n,bufferHighWaterLine:r,duration:a,bufferBasedABR:l,log:c}){if(!i)return k.log.warn("We received no playlist to switch to. Please check your stream."),!1;const p=`allowing switch ${s&&s.id||"null"} -> ${i.id}`;if(!s)return c(`${p} as current playlist is not set`),!0;if(i.id===s.id)return!1;const g=!!ai(e,t).length;if(!s.endList)return!g&&typeof s.partTargetDuration=="number"?(c(`not ${p} as current playlist is live llhls, but currentTime isn't in buffered.`),!1):(c(`${p} as current playlist is live`),!0);const _=Fa(e,t),S=l?Te.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:Te.MAX_BUFFER_LOW_WATER_LINE;if(a<S)return c(`${p} as duration < max low water line (${a} < ${S})`),!0;const E=i.attributes.BANDWIDTH,w=s.attributes.BANDWIDTH;if(E<w&&(!l||_<r)){let I=`${p} as next bandwidth < current bandwidth (${E} < ${w})`;return l&&(I+=` and forwardBuffer < bufferHighWaterLine (${_} < ${r})`),c(I),!0}if((!l||E>w)&&_>=n){let I=`${p} as forwardBuffer >= bufferLowWaterLine (${_} >= ${n})`;return l&&(I+=` and next bandwidth > current bandwidth (${E} > ${w})`),c(I),!0}return c(`not ${p} as no switching criteria met`),!1};class yy extends k.EventTarget{constructor(e){super(),this.fastQualityChange_=fy(this.fastQualityChange_.bind(this),100);const{src:t,withCredentials:i,tech:n,bandwidth:r,externVhs:a,useCueTags:l,playlistExclusionDuration:c,enableLowInitialPlaylist:p,sourceType:g,cacheEncryptionKeys:_,bufferBasedABR:S,leastPixelDiffSelector:E,captionServices:w,experimentalUseMMS:I}=e;if(!t)throw new Error("A non-empty playlist URL or JSON manifest string is required");let{maxPlaylistRetries:L}=e;(L===null||typeof L>"u")&&(L=1/0),wt=a,this.bufferBasedABR=!!S,this.leastPixelDiffSelector=!!E,this.withCredentials=i,this.tech_=n,this.vhs_=n.vhs,this.player_=e.player_,this.sourceType_=g,this.useCueTags_=l,this.playlistExclusionDuration=c,this.maxPlaylistRetries=L,this.enableLowInitialPlaylist=p,this.usingManagedMediaSource_=!1,this.useCueTags_&&(this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues"),this.cueTagsTrack_.inBandMetadataTrackDispatchType=""),this.requestOptions_={withCredentials:i,maxPlaylistRetries:L,timeout:null},this.on("error",this.pauseLoading),this.mediaTypes_=dy(),I&&x.ManagedMediaSource?(this.tech_.el_.disableRemotePlayback=!0,this.mediaSource=new x.ManagedMediaSource,this.usingManagedMediaSource_=!0,k.log("Using ManagedMediaSource")):x.MediaSource&&(this.mediaSource=new x.MediaSource),this.handleDurationChange_=this.handleDurationChange_.bind(this),this.handleSourceOpen_=this.handleSourceOpen_.bind(this),this.handleSourceEnded_=this.handleSourceEnded_.bind(this),this.load=this.load.bind(this),this.pause=this.pause.bind(this),this.mediaSource.addEventListener("durationchange",this.handleDurationChange_),this.mediaSource.addEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.addEventListener("sourceended",this.handleSourceEnded_),this.mediaSource.addEventListener("startstreaming",this.load),this.mediaSource.addEventListener("endstreaming",this.pause),this.seekable_=be(),this.hasPlayed_=!1,this.syncController_=new J_(e),this.segmentMetadataTrack_=n.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.segmentMetadataTrack_.mode="hidden",this.decrypter_=new ty,this.sourceUpdater_=new xd(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new Z_,this.keyStatusMap_=new Map;const P={vhs:this.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,captionServices:w,mediaSource:this.mediaSource,currentTime:this.tech_.currentTime.bind(this.tech_),seekable:()=>this.seekable(),seeking:()=>this.tech_.seeking(),duration:()=>this.duration(),hasPlayed:()=>this.hasPlayed_,goalBufferLength:()=>this.goalBufferLength(),bandwidth:r,syncController:this.syncController_,decrypter:this.decrypter_,sourceType:this.sourceType_,inbandTextTracks:this.inbandTextTracks_,cacheEncryptionKeys:_,sourceUpdater:this.sourceUpdater_,timelineChangeController:this.timelineChangeController_,exactManifestTimings:e.exactManifestTimings,addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)};this.mainPlaylistLoader_=this.sourceType_==="dash"?new ea(t,this.vhs_,Z(this.requestOptions_,{addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)})):new oi(t,this.vhs_,Z(this.requestOptions_,{addDateRangesToTextTrack:this.addDateRangesToTextTrack_.bind(this)})),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new sa(Z(P,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new sa(Z(P,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new G_(Z(P,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise((B,O)=>{function j(){n.off("vttjserror",R),B()}function R(){n.off("vttjsloaded",j),O()}n.one("vttjsloaded",j),n.one("vttjserror",R),n.addWebVttScript_()})}),e);const F=()=>this.mainSegmentLoader_.bandwidth;this.contentSteeringController_=new cy(this.vhs_.xhr,F),this.setupSegmentLoaderListeners_(),this.bufferBasedABR&&(this.mainPlaylistLoader_.one("loadedplaylist",()=>this.startABRTimer_()),this.tech_.on("pause",()=>this.stopABRTimer_()),this.tech_.on("play",()=>this.startABRTimer_())),my.forEach(B=>{this[B+"_"]=gy.bind(this,B)}),this.logger_=Ge("pc"),this.triggeredFmp4Usage=!1,this.tech_.preload()==="none"?(this.loadOnPlay_=()=>{this.loadOnPlay_=null,this.mainPlaylistLoader_.load()},this.tech_.one("play",this.loadOnPlay_)):this.mainPlaylistLoader_.load(),this.timeToLoadedData__=-1,this.mainAppendsToLoadedData__=-1,this.audioAppendsToLoadedData__=-1;const $=this.tech_.preload()==="none"?"play":"loadstart";this.tech_.one($,()=>{const B=Date.now();this.tech_.one("loadeddata",()=>{this.timeToLoadedData__=Date.now()-B,this.mainAppendsToLoadedData__=this.mainSegmentLoader_.mediaAppends,this.audioAppendsToLoadedData__=this.audioSegmentLoader_.mediaAppends})})}mainAppendsToLoadedData_(){return this.mainAppendsToLoadedData__}audioAppendsToLoadedData_(){return this.audioAppendsToLoadedData__}appendsToLoadedData_(){const e=this.mainAppendsToLoadedData_(),t=this.audioAppendsToLoadedData_();return e===-1||t===-1?-1:e+t}timeToLoadedData_(){return this.timeToLoadedData__}checkABR_(e="abr"){const t=this.selectPlaylist();t&&this.shouldSwitchToMedia_(t)&&this.switchMedia_(t,e)}switchMedia_(e,t,i){const n=this.media(),r=n&&(n.id||n.uri),a=e&&(e.id||e.uri);if(r&&r!==a){this.logger_(`switch media ${r} -> ${a} from ${t}`);const l={renditionInfo:{id:a,bandwidth:e.attributes.BANDWIDTH,resolution:e.attributes.RESOLUTION,codecs:e.attributes.CODECS},cause:t};this.trigger({type:"renditionselected",metadata:l}),this.tech_.trigger({type:"usage",name:`vhs-rendition-change-${t}`})}this.mainPlaylistLoader_.media(e,i)}switchMediaForDASHContentSteering_(){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{const t=this.mediaTypes_[e],i=t?t.activeGroup():null,n=this.contentSteeringController_.getPathway();if(i&&n){const a=(i.length?i[0].playlists:i.playlists).filter(l=>l.attributes.serviceLocation===n);a.length&&this.mediaTypes_[e].activePlaylistLoader.media(a[0])}})}startABRTimer_(){this.stopABRTimer_(),this.abrTimer_=x.setInterval(()=>this.checkABR_(),250)}stopABRTimer_(){this.tech_.scrubbing&&this.tech_.scrubbing()||(x.clearInterval(this.abrTimer_),this.abrTimer_=null)}getAudioTrackPlaylists_(){const e=this.main(),t=e&&e.playlists||[];if(!e||!e.mediaGroups||!e.mediaGroups.AUDIO)return t;const i=e.mediaGroups.AUDIO,n=Object.keys(i);let r;if(Object.keys(this.mediaTypes_.AUDIO.groups).length)r=this.mediaTypes_.AUDIO.activeTrack();else{const l=i.main||n.length&&i[n[0]];for(const c in l)if(l[c].default){r={label:c};break}}if(!r)return t;const a=[];for(const l in i)if(i[l][r.label]){const c=i[l][r.label];if(c.playlists&&c.playlists.length)a.push.apply(a,c.playlists);else if(c.uri)a.push(c);else if(e.playlists.length)for(let p=0;p<e.playlists.length;p++){const g=e.playlists[p];g.attributes&&g.attributes.AUDIO&&g.attributes.AUDIO===l&&a.push(g)}}return a.length?a:t}setupMainPlaylistLoaderListeners_(){this.mainPlaylistLoader_.on("loadedmetadata",()=>{const t=this.mainPlaylistLoader_.media(),i=t.targetDuration*1.5*1e3;Qr(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=i,t.endList&&this.tech_.preload()!=="none"&&(this.mainSegmentLoader_.playlist(t,this.requestOptions_),this.mainSegmentLoader_.load()),hy({sourceType:this.sourceType_,segmentLoaders:{AUDIO:this.audioSegmentLoader_,SUBTITLES:this.subtitleSegmentLoader_,main:this.mainSegmentLoader_},tech:this.tech_,requestOptions:this.requestOptions_,mainPlaylistLoader:this.mainPlaylistLoader_,vhs:this.vhs_,main:this.main(),mediaTypes:this.mediaTypes_,excludePlaylist:this.excludePlaylist.bind(this)}),this.triggerPresenceUsage_(this.main(),t),this.setupFirstPlay(),!this.mediaTypes_.AUDIO.activePlaylistLoader||this.mediaTypes_.AUDIO.activePlaylistLoader.media()?this.trigger("selectedinitialmedia"):this.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata",()=>{this.trigger("selectedinitialmedia")})}),this.mainPlaylistLoader_.on("loadedplaylist",()=>{this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_);let t=this.mainPlaylistLoader_.media();if(!t){this.attachContentSteeringListeners_(),this.initContentSteeringController_(),this.excludeUnsupportedVariants_();let i;if(this.enableLowInitialPlaylist&&(i=this.selectInitialPlaylist()),i||(i=this.selectPlaylist()),!i||!this.shouldSwitchToMedia_(i)||(this.initialMedia_=i,this.switchMedia_(this.initialMedia_,"initial"),!(this.sourceType_==="vhs-json"&&this.initialMedia_.segments)))return;t=this.initialMedia_}this.handleUpdatedMediaPlaylist(t)}),this.mainPlaylistLoader_.on("error",()=>{const t=this.mainPlaylistLoader_.error;this.excludePlaylist({playlistToExclude:t.playlist,error:t})}),this.mainPlaylistLoader_.on("mediachanging",()=>{this.mainSegmentLoader_.abort(),this.mainSegmentLoader_.pause()}),this.mainPlaylistLoader_.on("mediachange",()=>{const t=this.mainPlaylistLoader_.media(),i=t.targetDuration*1.5*1e3;Qr(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=i,this.sourceType_==="dash"&&this.mainPlaylistLoader_.isPaused&&this.mainPlaylistLoader_.load(),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(t,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_?this.runFastQualitySwitch_():this.mainSegmentLoader_.load(),this.tech_.trigger({type:"mediachange",bubbles:!0})}),this.mainPlaylistLoader_.on("playlistunchanged",()=>{const t=this.mainPlaylistLoader_.media();if(t.lastExcludeReason_==="playlist-unchanged")return;this.stuckAtPlaylistEnd_(t)&&(this.excludePlaylist({error:{message:"Playlist no longer updating.",reason:"playlist-unchanged"}}),this.tech_.trigger("playliststuck"))}),this.mainPlaylistLoader_.on("renditiondisabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-disabled"})}),this.mainPlaylistLoader_.on("renditionenabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-enabled"})}),["manifestrequeststart","manifestrequestcomplete","manifestparsestart","manifestparsecomplete","playlistrequeststart","playlistrequestcomplete","playlistparsestart","playlistparsecomplete","renditiondisabled","renditionenabled"].forEach(t=>{this.mainPlaylistLoader_.on(t,i=>{this.player_.trigger(ve({},i))})})}handleUpdatedMediaPlaylist(e){this.useCueTags_&&this.updateAdCues_(e),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_&&this.runFastQualitySwitch_(),this.updateDuration(!e.endList),this.tech_.paused()||(this.mainSegmentLoader_.load(),this.audioSegmentLoader_&&this.audioSegmentLoader_.load())}triggerPresenceUsage_(e,t){const i=e.mediaGroups||{};let n=!0;const r=Object.keys(i.AUDIO);for(const a in i.AUDIO)for(const l in i.AUDIO[a])i.AUDIO[a][l].uri||(n=!1);n&&this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),Object.keys(i.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),wt.Playlist.isAes(t)&&this.tech_.trigger({type:"usage",name:"vhs-aes"}),r.length&&Object.keys(i.AUDIO[r[0]]).length>1&&this.tech_.trigger({type:"usage",name:"vhs-alternate-audio"}),this.useCueTags_&&this.tech_.trigger({type:"usage",name:"vhs-playlist-cue-tags"})}shouldSwitchToMedia_(e){const t=this.mainPlaylistLoader_.media()||this.mainPlaylistLoader_.pendingMedia_,i=this.tech_.currentTime(),n=this.bufferLowWaterLine(),r=this.bufferHighWaterLine(),a=this.tech_.buffered();return _y({buffered:a,currentTime:i,currentPlaylist:t,nextPlaylist:e,bufferLowWaterLine:n,bufferHighWaterLine:r,duration:this.duration(),bufferBasedABR:this.bufferBasedABR,log:this.logger_})}setupSegmentLoaderListeners_(){this.mainSegmentLoader_.on("bandwidthupdate",()=>{this.checkABR_("bandwidthupdate"),this.tech_.trigger("bandwidthupdate")}),this.mainSegmentLoader_.on("timeout",()=>{this.bufferBasedABR&&this.mainSegmentLoader_.load()}),this.bufferBasedABR||this.mainSegmentLoader_.on("progress",()=>{this.trigger("progress")}),this.mainSegmentLoader_.on("error",()=>{const i=this.mainSegmentLoader_.error();this.excludePlaylist({playlistToExclude:i.playlist,error:i})}),this.mainSegmentLoader_.on("appenderror",()=>{this.error=this.mainSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.mainSegmentLoader_.on("timestampoffset",()=>{this.tech_.trigger({type:"usage",name:"vhs-timestamp-offset"})}),this.audioSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.audioSegmentLoader_.on("appenderror",()=>{this.error=this.audioSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("ended",()=>{this.logger_("main segment loader ended"),this.onEndOfStream()}),this.timelineChangeController_.on("audioTimelineBehind",()=>{const i=this.audioSegmentLoader_.pendingSegment_;if(!i||!i.segment||!i.segment.syncInfo)return;const n=i.segment.syncInfo.end+.01;this.tech_.setCurrentTime(n)}),this.timelineChangeController_.on("fixBadTimelineChange",()=>{this.logger_("Fix bad timeline change. Restarting al segment loaders..."),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),this.load()}),this.mainSegmentLoader_.on("earlyabort",i=>{this.bufferBasedABR||(this.delegateLoaders_("all",["abort"]),this.excludePlaylist({error:{message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},playlistExclusionDuration:py}))});const e=()=>{if(!this.sourceUpdater_.hasCreatedSourceBuffers())return this.tryToCreateSourceBuffers_();const i=this.getCodecsOrExclude_();i&&this.sourceUpdater_.addOrChangeSourceBuffers(i)};this.mainSegmentLoader_.on("trackinfo",e),this.audioSegmentLoader_.on("trackinfo",e),this.mainSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("ended",()=>{this.logger_("audioSegmentLoader ended"),this.onEndOfStream()}),["segmentselected","segmentloadstart","segmentloaded","segmentkeyloadstart","segmentkeyloadcomplete","segmentdecryptionstart","segmentdecryptioncomplete","segmenttransmuxingstart","segmenttransmuxingcomplete","segmenttransmuxingtrackinfoavailable","segmenttransmuxingtiminginfoavailable","segmentappendstart","appendsdone","bandwidthupdated","timelinechange","codecschange"].forEach(i=>{this.mainSegmentLoader_.on(i,n=>{this.player_.trigger(ve({},n))}),this.audioSegmentLoader_.on(i,n=>{this.player_.trigger(ve({},n))}),this.subtitleSegmentLoader_.on(i,n=>{this.player_.trigger(ve({},n))})})}mediaSecondsLoaded_(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)}load(){this.mainSegmentLoader_.load(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.load(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.load()}pause(){this.mainSegmentLoader_.pause(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.pause(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.pause()}fastQualityChange_(e=this.selectPlaylist()){if(e&&e===this.mainPlaylistLoader_.media()){this.logger_("skipping fastQualityChange because new media is same as old");return}this.switchMedia_(e,"fast-quality"),this.waitingForFastQualityPlaylistReceived_=!0}runFastQualitySwitch_(){this.waitingForFastQualityPlaylistReceived_=!1,this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),this.load()}play(){if(this.setupFirstPlay())return;this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_&&this.load();const e=this.tech_.seekable();if(this.tech_.duration()===1/0&&this.tech_.currentTime()<e.start(0))return this.tech_.setCurrentTime(e.end(e.length-1))}setupFirstPlay(){const e=this.mainPlaylistLoader_.media();if(!e||this.tech_.paused()||this.hasPlayed_)return!1;if(!e.endList||e.start){const t=this.seekable();if(!t.length)return!1;const i=t.end(0);let n=i;if(e.start){const r=e.start.timeOffset;r<0?n=Math.max(i+r,t.start(0)):n=Math.min(i,r)}this.trigger("firstplay"),this.tech_.setCurrentTime(n)}return this.hasPlayed_=!0,this.load(),!0}handleSourceOpen_(){if(this.tryToCreateSourceBuffers_(),this.tech_.autoplay()){const e=this.tech_.play();typeof e<"u"&&typeof e.then=="function"&&e.then(null,t=>{})}this.trigger("sourceopen")}handleSourceEnded_(){if(!this.inbandTextTracks_.metadataTrack_)return;const e=this.inbandTextTracks_.metadataTrack_.cues;if(!e||!e.length)return;const t=this.duration();e[e.length-1].endTime=isNaN(t)||Math.abs(t)===1/0?Number.MAX_VALUE:t}handleDurationChange_(){this.tech_.trigger("durationchange")}onEndOfStream(){let e=this.mainSegmentLoader_.ended_;if(this.mediaTypes_.AUDIO.activePlaylistLoader){const t=this.mainSegmentLoader_.getCurrentMediaInfo_();!t||t.hasVideo?e=e&&this.audioSegmentLoader_.ended_:e=this.audioSegmentLoader_.ended_}e&&(this.stopABRTimer_(),this.sourceUpdater_.endOfStream())}stuckAtPlaylistEnd_(e){if(!this.seekable().length)return!1;const i=this.syncController_.getExpiredTime(e,this.duration());if(i===null)return!1;const n=wt.Playlist.playlistEnd(e,i),r=this.tech_.currentTime(),a=this.tech_.buffered();if(!a.length)return n-r<=at;const l=a.end(a.length-1);return l-r<=at&&n-l<=at}excludePlaylist({playlistToExclude:e=this.mainPlaylistLoader_.media(),error:t={},playlistExclusionDuration:i}){if(e=e||this.mainPlaylistLoader_.media(),i=i||t.playlistExclusionDuration||this.playlistExclusionDuration,!e){this.error=t,this.mediaSource.readyState!=="open"?this.trigger("error"):this.sourceUpdater_.endOfStream("network");return}e.playlistErrors_++;const n=this.mainPlaylistLoader_.main.playlists,r=n.filter(zn),a=r.length===1&&r[0]===e;if(n.length===1&&i!==1/0)return k.log.warn(`Problem encountered with playlist ${e.id}. Trying again since it is the only playlist.`),this.tech_.trigger("retryplaylist"),this.mainPlaylistLoader_.load(a);if(a){if(this.main().contentSteering){const w=this.pathwayAttribute_(e),I=this.contentSteeringController_.steeringManifest.ttl*1e3;this.contentSteeringController_.excludePathway(w),this.excludeThenChangePathway_(),setTimeout(()=>{this.contentSteeringController_.addAvailablePathway(w)},I);return}let E=!1;n.forEach(w=>{if(w===e)return;const I=w.excludeUntil;typeof I<"u"&&I!==1/0&&(E=!0,delete w.excludeUntil)}),E&&(k.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}let l;e.playlistErrors_>this.maxPlaylistRetries?l=1/0:l=Date.now()+i*1e3,e.excludeUntil=l,t.reason&&(e.lastExcludeReason_=t.reason),this.tech_.trigger("excludeplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-excluded"});const c=this.selectPlaylist();if(!c){this.error="Playback cannot continue. No available working or supported playlists.",this.trigger("error");return}const p=t.internal?this.logger_:k.log.warn,g=t.message?" "+t.message:"";p(`${t.internal?"Internal problem":"Problem"} encountered with playlist ${e.id}.${g} Switching to playlist ${c.id}.`),c.attributes.AUDIO!==e.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),c.attributes.SUBTITLES!==e.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]);const _=c.targetDuration/2*1e3||5*1e3,S=typeof c.lastRequest=="number"&&Date.now()-c.lastRequest<=_;return this.switchMedia_(c,"exclude",a||S)}pauseLoading(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()}delegateLoaders_(e,t){const i=[],n=e==="all";(n||e==="main")&&i.push(this.mainPlaylistLoader_);const r=[];(n||e==="audio")&&r.push("AUDIO"),(n||e==="subtitle")&&(r.push("CLOSED-CAPTIONS"),r.push("SUBTITLES")),r.forEach(a=>{const l=this.mediaTypes_[a]&&this.mediaTypes_[a].activePlaylistLoader;l&&i.push(l)}),["main","audio","subtitle"].forEach(a=>{const l=this[`${a}SegmentLoader_`];l&&(e===a||e==="all")&&i.push(l)}),i.forEach(a=>t.forEach(l=>{typeof a[l]=="function"&&a[l]()}))}setCurrentTime(e){const t=ai(this.tech_.buffered(),e);if(!(this.mainPlaylistLoader_&&this.mainPlaylistLoader_.media())||!this.mainPlaylistLoader_.media().segments)return 0;if(t&&t.length)return e;this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),this.load()}duration(){if(!this.mainPlaylistLoader_)return 0;const e=this.mainPlaylistLoader_.media();return e?e.endList?this.mediaSource?this.mediaSource.duration:wt.Playlist.duration(e):1/0:0}seekable(){return this.seekable_}getSeekableRange_(e,t){const i=e.media();if(!i)return null;const n=this.syncController_.getMediaSequenceSync(t);if(n&&n.isReliable){const l=n.start,c=n.end;if(!isFinite(l)||!isFinite(c))return null;const p=wt.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,i),g=Math.max(l,c-p);return be([[l,g]])}const r=this.syncController_.getExpiredTime(i,this.duration());if(r===null)return null;const a=wt.Playlist.seekable(i,r,wt.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,i));return a.length?a:null}computeFinalSeekable_(e,t){if(!t)return e;const i=e.start(0),n=e.end(0),r=t.start(0),a=t.end(0);return r>n||i>a?e:be([[Math.max(i,r),Math.min(n,a)]])}onSyncInfoUpdate_(){if(!this.mainPlaylistLoader_)return;const e=this.getSeekableRange_(this.mainPlaylistLoader_,"main");if(!e)return;let t;if(this.mediaTypes_.AUDIO.activePlaylistLoader&&(t=this.getSeekableRange_(this.mediaTypes_.AUDIO.activePlaylistLoader,"audio"),!t))return;const i=this.seekable_;if(this.seekable_=this.computeFinalSeekable_(e,t),!this.seekable_||i&&i.length&&this.seekable_.length&&i.start(0)===this.seekable_.start(0)&&i.end(0)===this.seekable_.end(0))return;this.logger_(`seekable updated [${Rh(this.seekable_)}]`);const n={seekableRanges:this.seekable_};this.trigger({type:"seekablerangeschanged",metadata:n}),this.tech_.trigger("seekablechanged")}updateDuration(e){if(this.updateDuration_&&(this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.updateDuration_=null),this.mediaSource.readyState!=="open"){this.updateDuration_=this.updateDuration.bind(this,e),this.mediaSource.addEventListener("sourceopen",this.updateDuration_);return}if(e){const n=this.seekable();if(!n.length)return;(isNaN(this.mediaSource.duration)||this.mediaSource.duration<n.end(n.length-1))&&this.sourceUpdater_.setDuration(n.end(n.length-1));return}const t=this.tech_.buffered();let i=wt.Playlist.duration(this.mainPlaylistLoader_.media());t.length>0&&(i=Math.max(i,t.end(t.length-1))),this.mediaSource.duration!==i&&this.sourceUpdater_.setDuration(i)}dispose(){this.trigger("dispose"),this.decrypter_.terminate(),this.mainPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),this.contentSteeringController_.dispose(),this.keyStatusMap_.clear(),this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_),["AUDIO","SUBTITLES"].forEach(e=>{const t=this.mediaTypes_[e].groups;for(const i in t)t[i].forEach(n=>{n.playlistLoader&&n.playlistLoader.dispose()})}),this.audioSegmentLoader_.dispose(),this.subtitleSegmentLoader_.dispose(),this.sourceUpdater_.dispose(),this.timelineChangeController_.dispose(),this.stopABRTimer_(),this.updateDuration_&&this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.mediaSource.removeEventListener("durationchange",this.handleDurationChange_),this.mediaSource.removeEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.removeEventListener("sourceended",this.handleSourceEnded_),this.off()}main(){return this.mainPlaylistLoader_.main}media(){return this.mainPlaylistLoader_.media()||this.initialMedia_}areMediaTypesKnown_(){const e=!!this.mediaTypes_.AUDIO.activePlaylistLoader,t=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),i=e?!!this.audioSegmentLoader_.getCurrentMediaInfo_():!0;return!(!t||!i)}getCodecsOrExclude_(){const e={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}},t=this.mainSegmentLoader_.getPendingSegmentPlaylist()||this.media();e.video=e.main;const i=ds(this.main(),t),n={},r=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(e.main.hasVideo&&(n.video=i.video||e.main.videoCodec||nm),e.main.isMuxed&&(n.video+=`,${i.audio||e.main.audioCodec||Jo}`),(e.main.hasAudio&&!e.main.isMuxed||e.audio.hasAudio||r)&&(n.audio=i.audio||e.main.audioCodec||e.audio.audioCodec||Jo,e.audio.isFmp4=e.main.hasAudio&&!e.main.isMuxed?e.main.isFmp4:e.audio.isFmp4),!n.audio&&!n.video){this.excludePlaylist({playlistToExclude:t,error:{message:"Could not determine codecs for playlist."},playlistExclusionDuration:1/0});return}const a=(p,g)=>p?as(g,this.usingManagedMediaSource_):_r(g),l={};let c;if(["video","audio"].forEach(function(p){if(n.hasOwnProperty(p)&&!a(e[p].isFmp4,n[p])){const g=e[p].isFmp4?"browser":"muxer";l[g]=l[g]||[],l[g].push(n[p]),p==="audio"&&(c=g)}}),r&&c&&t.attributes.AUDIO){const p=t.attributes.AUDIO;this.main().playlists.forEach(g=>{(g.attributes&&g.attributes.AUDIO)===p&&g!==t&&(g.excludeUntil=1/0)}),this.logger_(`excluding audio group ${p} as ${c} does not support codec(s): "${n.audio}"`)}if(Object.keys(l).length){const p=Object.keys(l).reduce((g,_)=>(g&&(g+=", "),g+=`${_} does not support codec(s): "${l[_].join(",")}"`,g),"")+".";this.excludePlaylist({playlistToExclude:t,error:{internal:!0,message:p},playlistExclusionDuration:1/0});return}if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){const p=[];if(["video","audio"].forEach(g=>{const _=(it(this.sourceUpdater_.codecs[g]||"")[0]||{}).type,S=(it(n[g]||"")[0]||{}).type;_&&S&&_.toLowerCase()!==S.toLowerCase()&&p.push(`"${this.sourceUpdater_.codecs[g]}" -> "${n[g]}"`)}),p.length){this.excludePlaylist({playlistToExclude:t,error:{message:`Codec switching not supported: ${p.join(", ")}.`,internal:!0},playlistExclusionDuration:1/0});return}}return n}tryToCreateSourceBuffers_(){if(this.mediaSource.readyState!=="open"||this.sourceUpdater_.hasCreatedSourceBuffers()||!this.areMediaTypesKnown_())return;const e=this.getCodecsOrExclude_();if(!e)return;this.sourceUpdater_.createSourceBuffers(e);const t=[e.video,e.audio].filter(Boolean).join(",");this.excludeIncompatibleVariants_(t)}excludeUnsupportedVariants_(){const e=this.main().playlists,t=[];Object.keys(e).forEach(i=>{const n=e[i];if(t.indexOf(n.id)!==-1)return;t.push(n.id);const r=ds(this.main,n),a=[];r.audio&&!_r(r.audio)&&!as(r.audio,this.usingManagedMediaSource_)&&a.push(`audio codec ${r.audio}`),r.video&&!_r(r.video)&&!as(r.video,this.usingManagedMediaSource_)&&a.push(`video codec ${r.video}`),r.text&&r.text==="stpp.ttml.im1t"&&a.push(`text codec ${r.text}`),a.length&&(n.excludeUntil=1/0,this.logger_(`excluding ${n.id} for unsupported: ${a.join(", ")}`))})}excludeIncompatibleVariants_(e){const t=[],i=this.main().playlists,n=ms(it(e)),r=Al(n),a=n.video&&it(n.video)[0]||null,l=n.audio&&it(n.audio)[0]||null;Object.keys(i).forEach(c=>{const p=i[c];if(t.indexOf(p.id)!==-1||p.excludeUntil===1/0)return;t.push(p.id);const g=[],_=ds(this.mainPlaylistLoader_.main,p),S=Al(_);if(!(!_.audio&&!_.video)){if(S!==r&&g.push(`codec count "${S}" !== "${r}"`),!this.sourceUpdater_.canChangeType()){const E=_.video&&it(_.video)[0]||null,w=_.audio&&it(_.audio)[0]||null;E&&a&&E.type.toLowerCase()!==a.type.toLowerCase()&&g.push(`video codec "${E.type}" !== "${a.type}"`),w&&l&&w.type.toLowerCase()!==l.type.toLowerCase()&&g.push(`audio codec "${w.type}" !== "${l.type}"`)}g.length&&(p.excludeUntil=1/0,this.logger_(`excluding ${p.id}: ${g.join(" && ")}`))}})}updateAdCues_(e){let t=0;const i=this.seekable();i.length&&(t=i.start(0)),Q_(e,this.cueTagsTrack_,t)}goalBufferLength(){const e=this.tech_.currentTime(),t=Te.GOAL_BUFFER_LENGTH,i=Te.GOAL_BUFFER_LENGTH_RATE,n=Math.max(t,Te.MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*i,n)}bufferLowWaterLine(){const e=this.tech_.currentTime(),t=Te.BUFFER_LOW_WATER_LINE,i=Te.BUFFER_LOW_WATER_LINE_RATE,n=Math.max(t,Te.MAX_BUFFER_LOW_WATER_LINE),r=Math.max(t,Te.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*i,this.bufferBasedABR?r:n)}bufferHighWaterLine(){return Te.BUFFER_HIGH_WATER_LINE}addDateRangesToTextTrack_(e){Nl(this.inbandTextTracks_,"com.apple.streaming",this.tech_),I_({inbandTextTracks:this.inbandTextTracks_,dateRanges:e})}addMetadataToTextTrack(e,t,i){const n=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();Nl(this.inbandTextTracks_,e,this.tech_),E_({inbandTextTracks:this.inbandTextTracks_,metadataArray:t,timestampOffset:n,videoDuration:i})}pathwayAttribute_(e){return e.attributes["PATHWAY-ID"]||e.attributes.serviceLocation}initContentSteeringController_(){const e=this.main();if(e.contentSteering){for(const t of e.playlists)this.contentSteeringController_.addAvailablePathway(this.pathwayAttribute_(t));if(this.contentSteeringController_.assignTagProperties(e.uri,e.contentSteering),this.contentSteeringController_.queryBeforeStart){this.contentSteeringController_.requestSteeringManifest(!0);return}this.tech_.one("canplay",()=>{this.contentSteeringController_.requestSteeringManifest()})}}resetContentSteeringController_(){this.contentSteeringController_.clearAvailablePathways(),this.contentSteeringController_.dispose(),this.initContentSteeringController_()}attachContentSteeringListeners_(){this.contentSteeringController_.on("content-steering",this.excludeThenChangePathway_.bind(this)),["contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"].forEach(t=>{this.contentSteeringController_.on(t,i=>{this.trigger(ve({},i))})}),this.sourceType_==="dash"&&this.mainPlaylistLoader_.on("loadedplaylist",()=>{const t=this.main();(this.contentSteeringController_.didDASHTagChange(t.uri,t.contentSteering)||(()=>{const r=this.contentSteeringController_.getAvailablePathways(),a=[];for(const l of t.playlists){const c=l.attributes.serviceLocation;if(c&&(a.push(c),!r.has(c)))return!0}return!!(!a.length&&r.size)})())&&this.resetContentSteeringController_()})}excludeThenChangePathway_(){const e=this.contentSteeringController_.getPathway();if(!e)return;this.handlePathwayClones_();const i=this.main().playlists,n=new Set;let r=!1;Object.keys(i).forEach(a=>{const l=i[a],c=this.pathwayAttribute_(l),p=c&&e!==c;l.excludeUntil===1/0&&l.lastExcludeReason_==="content-steering"&&!p&&(delete l.excludeUntil,delete l.lastExcludeReason_,r=!0);const _=!l.excludeUntil&&l.excludeUntil!==1/0;!n.has(l.id)&&p&&_&&(n.add(l.id),l.excludeUntil=1/0,l.lastExcludeReason_="content-steering",this.logger_(`excluding ${l.id} for ${l.lastExcludeReason_}`))}),this.contentSteeringController_.manifestType_==="DASH"&&Object.keys(this.mediaTypes_).forEach(a=>{const l=this.mediaTypes_[a];if(l.activePlaylistLoader){const c=l.activePlaylistLoader.media_;c&&c.attributes.serviceLocation!==e&&(r=!0)}}),r&&this.changeSegmentPathway_()}handlePathwayClones_(){const t=this.main().playlists,i=this.contentSteeringController_.currentPathwayClones,n=this.contentSteeringController_.nextPathwayClones;if(i&&i.size||n&&n.size){for(const[a,l]of i.entries())n.get(a)||(this.mainPlaylistLoader_.updateOrDeleteClone(l),this.contentSteeringController_.excludePathway(a));for(const[a,l]of n.entries()){const c=i.get(a);if(!c){t.filter(g=>g.attributes["PATHWAY-ID"]===l["BASE-ID"]).forEach(g=>{this.mainPlaylistLoader_.addClonePathway(l,g)}),this.contentSteeringController_.addAvailablePathway(a);continue}this.equalPathwayClones_(c,l)||(this.mainPlaylistLoader_.updateOrDeleteClone(l,!0),this.contentSteeringController_.addAvailablePathway(a))}this.contentSteeringController_.currentPathwayClones=new Map(JSON.parse(JSON.stringify([...n])))}}equalPathwayClones_(e,t){if(e["BASE-ID"]!==t["BASE-ID"]||e.ID!==t.ID||e["URI-REPLACEMENT"].HOST!==t["URI-REPLACEMENT"].HOST)return!1;const i=e["URI-REPLACEMENT"].PARAMS,n=t["URI-REPLACEMENT"].PARAMS;for(const r in i)if(i[r]!==n[r])return!1;for(const r in n)if(i[r]!==n[r])return!1;return!0}changeSegmentPathway_(){const e=this.selectPlaylist();this.pauseLoading(),this.contentSteeringController_.manifestType_==="DASH"&&this.switchMediaForDASHContentSteering_(),this.switchMedia_(e,"content-steering")}excludeNonUsablePlaylistsByKeyId_(){if(!this.mainPlaylistLoader_||!this.mainPlaylistLoader_.main)return;let e=0;const t="non-usable";this.mainPlaylistLoader_.main.playlists.forEach(i=>{const n=this.mainPlaylistLoader_.getKeyIdSet(i);!n||!n.size||n.forEach(r=>{const a="usable",l=this.keyStatusMap_.has(r)&&this.keyStatusMap_.get(r)===a,c=i.lastExcludeReason_===t&&i.excludeUntil===1/0;l?l&&c&&(delete i.excludeUntil,delete i.lastExcludeReason_,this.logger_(`enabling playlist ${i.id} because key ID ${r} is ${a}`)):(i.excludeUntil!==1/0&&i.lastExcludeReason_!==t&&(i.excludeUntil=1/0,i.lastExcludeReason_=t,this.logger_(`excluding playlist ${i.id} because the key ID ${r} doesn't exist in the keyStatusMap or is not ${a}`)),e++)})}),e>=this.mainPlaylistLoader_.main.playlists.length&&this.mainPlaylistLoader_.main.playlists.forEach(i=>{const n=i&&i.attributes&&i.attributes.RESOLUTION&&i.attributes.RESOLUTION.height<720,r=i.excludeUntil===1/0&&i.lastExcludeReason_===t;n&&r&&(delete i.excludeUntil,k.log.warn(`enabling non-HD playlist ${i.id} because all playlists were excluded due to ${t} key IDs`))})}addKeyStatus_(e,t){const r=(typeof e=="string"?e:z_(e)).slice(0,32).toLowerCase();this.logger_(`KeyStatus '${t}' with key ID ${r} added to the keyStatusMap`),this.keyStatusMap_.set(r,t)}updatePlaylistByKeyStatus(e,t){this.addKeyStatus_(e,t),this.waitingForFastQualityPlaylistReceived_||this.excludeNonUsableThenChangePlaylist_(),this.mainPlaylistLoader_.off("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this)),this.mainPlaylistLoader_.on("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this))}excludeNonUsableThenChangePlaylist_(){this.excludeNonUsablePlaylistsByKeyId_(),this.fastQualityChange_()}}const Ty=(s,e,t)=>i=>{const n=s.main.playlists[e],r=Ua(n),a=zn(n);if(typeof i>"u")return a;i?delete n.disabled:n.disabled=!0;const l={renditionInfo:{id:e,bandwidth:n.attributes.BANDWIDTH,resolution:n.attributes.RESOLUTION,codecs:n.attributes.CODECS},cause:"fast-quality"};return i!==a&&!r&&(i?(t(n),s.trigger({type:"renditionenabled",metadata:l})):s.trigger({type:"renditiondisabled",metadata:l})),i};class vy{constructor(e,t,i){const{playlistController_:n}=e,r=n.fastQualityChange_.bind(n);if(t.attributes){const a=t.attributes.RESOLUTION;this.width=a&&a.width,this.height=a&&a.height,this.bandwidth=t.attributes.BANDWIDTH,this.frameRate=t.attributes["FRAME-RATE"]}this.codecs=ds(n.main(),t),this.playlist=t,this.id=i,this.enabled=Ty(e.playlists,t.id,r)}}const by=function(s){s.representations=()=>{const e=s.playlistController_.main(),t=vs(e)?s.playlistController_.getAudioTrackPlaylists_():e.playlists;return t?t.filter(i=>!Ua(i)).map((i,n)=>new vy(s,i,i.id)):[]}},Ql=["seeking","seeked","pause","playing","error"];class xy extends k.EventTarget{constructor(e){super(),this.playlistController_=e.playlistController,this.tech_=e.tech,this.seekable=e.seekable,this.allowSeeksWithinUnsafeLiveWindow=e.allowSeeksWithinUnsafeLiveWindow,this.liveRangeSafeTimeDelta=e.liveRangeSafeTimeDelta,this.media=e.media,this.playedRanges_=[],this.consecutiveUpdates=0,this.lastRecordedTime=null,this.checkCurrentTimeTimeout_=null,this.logger_=Ge("PlaybackWatcher"),this.logger_("initialize");const t=()=>this.monitorCurrentTime_(),i=()=>this.monitorCurrentTime_(),n=()=>this.techWaiting_(),r=()=>this.resetTimeUpdate_(),a=this.playlistController_,l=["main","subtitle","audio"],c={};l.forEach(g=>{c[g]={reset:()=>this.resetSegmentDownloads_(g),updateend:()=>this.checkSegmentDownloads_(g)},a[`${g}SegmentLoader_`].on("appendsdone",c[g].updateend),a[`${g}SegmentLoader_`].on("playlistupdate",c[g].reset),this.tech_.on(["seeked","seeking"],c[g].reset)});const p=g=>{["main","audio"].forEach(_=>{a[`${_}SegmentLoader_`][g]("appended",this.seekingAppendCheck_)})};this.seekingAppendCheck_=()=>{this.fixesBadSeeks_()&&(this.consecutiveUpdates=0,this.lastRecordedTime=this.tech_.currentTime(),p("off"))},this.clearSeekingAppendCheck_=()=>p("off"),this.watchForBadSeeking_=()=>{this.clearSeekingAppendCheck_(),p("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",n),this.tech_.on(Ql,r),this.tech_.on("canplay",i),this.tech_.one("play",t),this.dispose=()=>{this.clearSeekingAppendCheck_(),this.logger_("dispose"),this.tech_.off("waiting",n),this.tech_.off(Ql,r),this.tech_.off("canplay",i),this.tech_.off("play",t),this.tech_.off("seeking",this.watchForBadSeeking_),this.tech_.off("seeked",this.clearSeekingAppendCheck_),l.forEach(g=>{a[`${g}SegmentLoader_`].off("appendsdone",c[g].updateend),a[`${g}SegmentLoader_`].off("playlistupdate",c[g].reset),this.tech_.off(["seeked","seeking"],c[g].reset)}),this.checkCurrentTimeTimeout_&&x.clearTimeout(this.checkCurrentTimeTimeout_),this.resetTimeUpdate_()}}monitorCurrentTime_(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&x.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=x.setTimeout(this.monitorCurrentTime_.bind(this),250)}resetSegmentDownloads_(e){const t=this.playlistController_[`${e}SegmentLoader_`];this[`${e}StalledDownloads_`]>0&&this.logger_(`resetting possible stalled download count for ${e} loader`),this[`${e}StalledDownloads_`]=0,this[`${e}Buffered_`]=t.buffered_()}checkSegmentDownloads_(e){const t=this.playlistController_,i=t[`${e}SegmentLoader_`],n=i.buffered_(),r=o0(this[`${e}Buffered_`],n);if(this[`${e}Buffered_`]=n,r){const a={bufferedRanges:n};t.trigger({type:"bufferedrangeschanged",metadata:a}),this.resetSegmentDownloads_(e);return}this[`${e}StalledDownloads_`]++,this.logger_(`found #${this[`${e}StalledDownloads_`]} ${e} appends that did not increase buffer (possible stalled download)`,{playlistId:i.playlist_&&i.playlist_.id,buffered:zt(n)}),!(this[`${e}StalledDownloads_`]<10)&&(this.logger_(`${e} loader stalled download exclusion`),this.resetSegmentDownloads_(e),this.tech_.trigger({type:"usage",name:`vhs-${e}-download-exclusion`}),e!=="subtitle"&&t.excludePlaylist({error:{message:`Excessive ${e} segment downloading detected.`},playlistExclusionDuration:1/0}))}checkCurrentTime_(){if(this.tech_.paused()||this.tech_.seeking())return;const e=this.tech_.currentTime(),t=this.tech_.buffered();if(this.lastRecordedTime===e&&(!t.length||e+at>=t.end(t.length-1)))return this.techWaiting_();if(this.consecutiveUpdates>=5&&e===this.lastRecordedTime)this.consecutiveUpdates++,this.waiting_();else if(e===this.lastRecordedTime)this.consecutiveUpdates++;else{this.playedRanges_.push(be([this.lastRecordedTime,e]));const i={playedRanges:this.playedRanges_};this.playlistController_.trigger({type:"playedrangeschanged",metadata:i}),this.consecutiveUpdates=0,this.lastRecordedTime=e}}resetTimeUpdate_(){this.consecutiveUpdates=0}fixesBadSeeks_(){if(!this.tech_.seeking())return!1;const t=this.seekable(),i=this.tech_.currentTime(),n=this.afterSeekableWindow_(t,i,this.media(),this.allowSeeksWithinUnsafeLiveWindow);let r;if(n&&(r=t.end(t.length-1)),this.beforeSeekableWindow_(t,i)){const w=t.start(0);r=w+(w===t.end(0)?0:at)}if(typeof r<"u")return this.logger_(`Trying to seek outside of seekable at time ${i} with seekable range ${Rh(t)}. Seeking to ${r}.`),this.tech_.setCurrentTime(r),!0;const a=this.playlistController_.sourceUpdater_,l=this.tech_.buffered(),c=a.audioBuffer?a.audioBuffered():null,p=a.videoBuffer?a.videoBuffered():null,g=this.media(),_=g.partTargetDuration?g.partTargetDuration:(g.targetDuration-rt)*2,S=[c,p];for(let w=0;w<S.length;w++){if(!S[w])continue;if(Fa(S[w],i)<_)return!1}const E=Js(l,i);return E.length===0?!1:(r=E.start(0)+at,this.logger_(`Buffered region starts (${E.start(0)}) just beyond seek point (${i}). Seeking to ${r}.`),this.tech_.setCurrentTime(r),!0)}waiting_(){if(this.techWaiting_())return;const e=this.tech_.currentTime(),t=this.tech_.buffered(),i=ai(t,e);if(i.length&&e+3<=i.end(0)){this.resetTimeUpdate_(),this.tech_.setCurrentTime(e),this.logger_(`Stopped at ${e} while inside a buffered region [${i.start(0)} -> ${i.end(0)}]. Attempting to resume playback by seeking to the current time.`),this.tech_.trigger({type:"usage",name:"vhs-unknown-waiting"});return}}techWaiting_(){const e=this.seekable(),t=this.tech_.currentTime();if(this.tech_.seeking())return!0;if(this.beforeSeekableWindow_(e,t)){const l=e.end(e.length-1);return this.logger_(`Fell out of live window at time ${t}. Seeking to live point (seekable end) ${l}`),this.resetTimeUpdate_(),this.tech_.setCurrentTime(l),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),!0}const i=this.tech_.vhs.playlistController_.sourceUpdater_,n=this.tech_.buffered();if(this.videoUnderflow_({audioBuffered:i.audioBuffered(),videoBuffered:i.videoBuffered(),currentTime:t}))return this.resetTimeUpdate_(),this.tech_.setCurrentTime(t),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),!0;const a=Js(n,t);return a.length>0?(this.logger_(`Stopped at ${t} and seeking to ${a.start(0)}`),this.resetTimeUpdate_(),this.skipTheGap_(t),!0):!1}afterSeekableWindow_(e,t,i,n=!1){if(!e.length)return!1;let r=e.end(e.length-1)+at;const a=!i.endList,l=typeof i.partTargetDuration=="number";return a&&(l||n)&&(r=e.end(e.length-1)+i.targetDuration*3),t>r}beforeSeekableWindow_(e,t){return!!(e.length&&e.start(0)>0&&t<e.start(0)-this.liveRangeSafeTimeDelta)}videoUnderflow_({videoBuffered:e,audioBuffered:t,currentTime:i}){if(!e)return;let n;if(e.length&&t.length){const r=ai(e,i-3),a=ai(e,i),l=ai(t,i);l.length&&!a.length&&r.length&&(n={start:r.end(0),end:l.end(0)})}else Js(e,i).length||(n=this.gapFromVideoUnderflow_(e,i));return n?(this.logger_(`Encountered a gap in video from ${n.start} to ${n.end}. Seeking to current time ${i}`),!0):!1}skipTheGap_(e){const t=this.tech_.buffered(),i=this.tech_.currentTime(),n=Js(t,i);if(this.resetTimeUpdate_(),n.length===0||i!==e)return;this.logger_("skipTheGap_:","currentTime:",i,"scheduled currentTime:",e,"nextRange start:",n.start(0)),this.tech_.setCurrentTime(n.start(0)+rt);const r={gapInfo:{from:i,to:n.start(0)}};this.playlistController_.trigger({type:"gapjumped",metadata:r}),this.tech_.trigger({type:"usage",name:"vhs-gap-skip"})}gapFromVideoUnderflow_(e,t){const i=n0(e);for(let n=0;n<i.length;n++){const r=i.start(n),a=i.end(n);if(t-r<4&&t-r>2)return{start:r,end:a}}return null}}const Sy={errorInterval:30,getSource(s){const t=this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource();return s(t)}},wd=function(s,e){let t=0,i=0;const n=Z(Sy,e);s.ready(()=>{s.trigger({type:"usage",name:"vhs-error-reload-initialized"})});const r=function(){i&&s.currentTime(i)},a=function(g){g!=null&&(i=s.duration()!==1/0&&s.currentTime()||0,s.one("loadedmetadata",r),s.src(g),s.trigger({type:"usage",name:"vhs-error-reload"}),s.play())},l=function(){if(Date.now()-t<n.errorInterval*1e3){s.trigger({type:"usage",name:"vhs-error-reload-canceled"});return}if(!n.getSource||typeof n.getSource!="function"){k.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!");return}return t=Date.now(),n.getSource.call(s,a)},c=function(){s.off("loadedmetadata",r),s.off("error",l),s.off("dispose",c)},p=function(g){c(),wd(s,g)};s.on("error",l),s.on("dispose",c),s.reloadSourceOnError=p},Cy=function(s){wd(this,s)};var kd="3.17.2",Ey="7.1.0",wy="1.3.1",ky="7.2.0",Iy="4.0.2";const ce={PlaylistLoader:oi,Playlist:Me,utils:O0,STANDARD_PLAYLIST_SELECTOR:Fl,INITIAL_PLAYLIST_SELECTOR:v_,lastBandwidthSelector:Fl,movingAverageBandwidthSelector:y_,comparePlaylistBandwidth:Ha,comparePlaylistResolution:__,xhr:ed()};Object.keys(Te).forEach(s=>{Object.defineProperty(ce,s,{get(){return k.log.warn(`using Vhs.${s} is UNSAFE be sure you know what you are doing`),Te[s]},set(e){if(k.log.warn(`using Vhs.${s} is UNSAFE be sure you know what you are doing`),typeof e!="number"||e<0){k.log.warn(`value of Vhs.${s} must be greater than or equal to 0`);return}Te[s]=e}})});const Id="videojs-vhs",Pd=function(s,e){const t=e.media();let i=-1;for(let n=0;n<s.length;n++)if(s[n].id===t.id){i=n;break}s.selectedIndex_=i,s.trigger({selectedIndex:i,type:"change"})},Py=function(s,e){e.representations().forEach(t=>{s.addQualityLevel(t)}),Pd(s,e.playlists)};ce.canPlaySource=function(){return k.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};const Ay=(s,e,t)=>{if(!s)return s;let i={};e&&e.attributes&&e.attributes.CODECS&&(i=ms(it(e.attributes.CODECS))),t&&t.attributes&&t.attributes.CODECS&&(i.audio=t.attributes.CODECS);const n=_i(i.video),r=_i(i.audio),a={};for(const l in s)a[l]={},r&&(a[l].audioContentType=r),n&&(a[l].videoContentType=n),e.contentProtection&&e.contentProtection[l]&&e.contentProtection[l].pssh&&(a[l].pssh=e.contentProtection[l].pssh),typeof s[l]=="string"&&(a[l].url=s[l]);return Z(s,a)},Ly=(s,e)=>s.reduce((t,i)=>{if(!i.contentProtection)return t;const n=e.reduce((r,a)=>{const l=i.contentProtection[a];return l&&l.pssh&&(r[a]={pssh:l.pssh}),r},{});return Object.keys(n).length&&t.push(n),t},[]),Dy=({player:s,sourceKeySystems:e,audioMedia:t,mainPlaylists:i})=>{if(!s.eme.initializeMediaKeys)return Promise.resolve();const n=t?i.concat([t]):i,r=Ly(n,Object.keys(e)),a=[],l=[];return r.forEach(c=>{l.push(new Promise((p,g)=>{s.tech_.one("keysessioncreated",p)})),a.push(new Promise((p,g)=>{s.eme.initializeMediaKeys({keySystems:c},_=>{if(_){g(_);return}p()})}))}),Promise.race([Promise.all(a),Promise.race(l)])},Oy=({player:s,sourceKeySystems:e,media:t,audioMedia:i})=>{const n=Ay(e,t,i);return n?(s.currentSource().keySystems=n,n&&!s.eme?(k.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),!1):!0):!1},Ad=()=>{if(!x.localStorage)return null;const s=x.localStorage.getItem(Id);if(!s)return null;try{return JSON.parse(s)}catch{return null}},My=s=>{if(!x.localStorage)return!1;let e=Ad();e=e?Z(e,s):s;try{x.localStorage.setItem(Id,JSON.stringify(e))}catch{return!1}return e},Ry=s=>s.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")===0?JSON.parse(s.substring(s.indexOf(",")+1)):s,Ld=(s,e)=>{s._requestCallbackSet||(s._requestCallbackSet=new Set),s._requestCallbackSet.add(e)},Dd=(s,e)=>{s._responseCallbackSet||(s._responseCallbackSet=new Set),s._responseCallbackSet.add(e)},Od=(s,e)=>{s._requestCallbackSet&&(s._requestCallbackSet.delete(e),s._requestCallbackSet.size||delete s._requestCallbackSet)},Md=(s,e)=>{s._responseCallbackSet&&(s._responseCallbackSet.delete(e),s._responseCallbackSet.size||delete s._responseCallbackSet)};ce.supportsNativeHls=function(){if(!N||!N.createElement)return!1;const s=N.createElement("video");return k.getTech("Html5").isSupported()?["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some(function(t){return/maybe|probably/i.test(s.canPlayType(t))}):!1}();ce.supportsNativeDash=function(){return!N||!N.createElement||!k.getTech("Html5").isSupported()?!1:/maybe|probably/i.test(N.createElement("video").canPlayType("application/dash+xml"))}();ce.supportsTypeNatively=s=>s==="hls"?ce.supportsNativeHls:s==="dash"?ce.supportsNativeDash:!1;ce.isSupported=function(){return k.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};ce.xhr.onRequest=function(s){Ld(ce.xhr,s)};ce.xhr.onResponse=function(s){Dd(ce.xhr,s)};ce.xhr.offRequest=function(s){Od(ce.xhr,s)};ce.xhr.offResponse=function(s){Md(ce.xhr,s)};const By=k.getComponent("Component");class Rd extends By{constructor(e,t,i){if(super(t,i.vhs),typeof i.initialBandwidth=="number"&&(this.options_.bandwidth=i.initialBandwidth),this.logger_=Ge("VhsHandler"),t.options_&&t.options_.playerId){const n=k.getPlayer(t.options_.playerId);this.player_=n}if(this.tech_=t,this.source_=e,this.stats={},this.ignoreNextSeekingEvent_=!1,this.setOptions_(),this.options_.overrideNative&&t.overrideNativeAudioTracks&&t.overrideNativeVideoTracks)t.overrideNativeAudioTracks(!0),t.overrideNativeVideoTracks(!0);else if(this.options_.overrideNative&&(t.featuresNativeVideoTracks||t.featuresNativeAudioTracks))throw new Error("Overriding native VHS requires emulated tracks. See https://git.io/vMpjB");this.on(N,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],n=>{const r=N.fullscreenElement||N.webkitFullscreenElement||N.mozFullScreenElement||N.msFullscreenElement;r&&r.contains(this.tech_.el())?this.playlistController_.fastQualityChange_():this.playlistController_.checkABR_()}),this.on(this.tech_,"seeking",function(){if(this.ignoreNextSeekingEvent_){this.ignoreNextSeekingEvent_=!1;return}this.setCurrentTime(this.tech_.currentTime())}),this.on(this.tech_,"error",function(){this.tech_.error()&&this.playlistController_&&this.playlistController_.pauseLoading()}),this.on(this.tech_,"play",this.play)}setOptions_(e={}){if(this.options_=Z(this.options_,e),this.options_.withCredentials=this.options_.withCredentials||!1,this.options_.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions!==!1,this.options_.useDevicePixelRatio=this.options_.useDevicePixelRatio||!1,this.options_.usePlayerObjectFit=this.options_.usePlayerObjectFit||!1,this.options_.useBandwidthFromLocalStorage=typeof this.source_.useBandwidthFromLocalStorage<"u"?this.source_.useBandwidthFromLocalStorage:this.options_.useBandwidthFromLocalStorage||!1,this.options_.useForcedSubtitles=this.options_.useForcedSubtitles||!1,this.options_.useNetworkInformationApi=typeof this.options_.useNetworkInformationApi<"u"?this.options_.useNetworkInformationApi:!0,this.options_.useDtsForTimestampOffset=this.options_.useDtsForTimestampOffset||!1,this.options_.customTagParsers=this.options_.customTagParsers||[],this.options_.customTagMappers=this.options_.customTagMappers||[],this.options_.cacheEncryptionKeys=this.options_.cacheEncryptionKeys||!1,this.options_.llhls=this.options_.llhls!==!1,this.options_.bufferBasedABR=this.options_.bufferBasedABR||!1,typeof this.options_.playlistExclusionDuration!="number"&&(this.options_.playlistExclusionDuration=60),typeof this.options_.bandwidth!="number"&&this.options_.useBandwidthFromLocalStorage){const i=Ad();i&&i.bandwidth&&(this.options_.bandwidth=i.bandwidth,this.tech_.trigger({type:"usage",name:"vhs-bandwidth-from-local-storage"})),i&&i.throughput&&(this.options_.throughput=i.throughput,this.tech_.trigger({type:"usage",name:"vhs-throughput-from-local-storage"}))}typeof this.options_.bandwidth!="number"&&(this.options_.bandwidth=Te.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===Te.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","usePlayerObjectFit","customPixelRatio","limitRenditionByPlayerDimensions","bandwidth","customTagParsers","customTagMappers","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","bufferBasedABR","liveRangeSafeTimeDelta","llhls","useForcedSubtitles","useNetworkInformationApi","useDtsForTimestampOffset","exactManifestTimings","leastPixelDiffSelector"].forEach(i=>{typeof this.source_[i]<"u"&&(this.options_[i]=this.source_[i])}),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions,this.useDevicePixelRatio=this.options_.useDevicePixelRatio,this.usePlayerObjectFit=this.options_.usePlayerObjectFit;const t=this.options_.customPixelRatio;typeof t=="number"&&t>=0&&(this.customPixelRatio=t)}setOptions(e={}){this.setOptions_(e)}src(e,t){if(!e)return;this.setOptions_(),this.options_.src=Ry(this.source_.src),this.options_.tech=this.tech_,this.options_.externVhs=ce,this.options_.sourceType=uu(t),this.options_.seekTo=r=>{this.tech_.setCurrentTime(r)},this.options_.player_=this.player_,this.playlistController_=new yy(this.options_);const i=Z({liveRangeSafeTimeDelta:at},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_});this.playbackWatcher_=new xy(i),this.attachStreamingEventListeners_(),this.playlistController_.on("error",()=>{const r=k.players[this.tech_.options_.playerId];let a=this.playlistController_.error;typeof a=="object"&&!a.code?a.code=3:typeof a=="string"&&(a={message:a,code:3}),r.error(a)});const n=this.options_.bufferBasedABR?ce.movingAverageBandwidthSelector(.55):ce.STANDARD_PLAYLIST_SELECTOR;this.playlistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):n.bind(this),this.playlistController_.selectInitialPlaylist=ce.INITIAL_PLAYLIST_SELECTOR.bind(this),this.playlists=this.playlistController_.mainPlaylistLoader_,this.mediaSource=this.playlistController_.mediaSource,Object.defineProperties(this,{selectPlaylist:{get(){return this.playlistController_.selectPlaylist},set(r){this.playlistController_.selectPlaylist=r.bind(this)}},throughput:{get(){return this.playlistController_.mainSegmentLoader_.throughput.rate},set(r){this.playlistController_.mainSegmentLoader_.throughput.rate=r,this.playlistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get(){let r=this.playlistController_.mainSegmentLoader_.bandwidth;const a=x.navigator.connection||x.navigator.mozConnection||x.navigator.webkitConnection,l=1e7;if(this.options_.useNetworkInformationApi&&a){const c=a.downlink*1e3*1e3;c>=l&&r>=l?r=Math.max(r,c):r=c}return r},set(r){this.playlistController_.mainSegmentLoader_.bandwidth=r,this.playlistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get(){const r=1/(this.bandwidth||1);let a;return this.throughput>0?a=1/this.throughput:a=0,Math.floor(1/(r+a))},set(){k.log.error('The "systemBandwidth" property is read-only')}}}),this.options_.bandwidth&&(this.bandwidth=this.options_.bandwidth),this.options_.throughput&&(this.throughput=this.options_.throughput),Object.defineProperties(this.stats,{bandwidth:{get:()=>this.bandwidth||0,enumerable:!0},mediaRequests:{get:()=>this.playlistController_.mediaRequests_()||0,enumerable:!0},mediaRequestsAborted:{get:()=>this.playlistController_.mediaRequestsAborted_()||0,enumerable:!0},mediaRequestsTimedout:{get:()=>this.playlistController_.mediaRequestsTimedout_()||0,enumerable:!0},mediaRequestsErrored:{get:()=>this.playlistController_.mediaRequestsErrored_()||0,enumerable:!0},mediaTransferDuration:{get:()=>this.playlistController_.mediaTransferDuration_()||0,enumerable:!0},mediaBytesTransferred:{get:()=>this.playlistController_.mediaBytesTransferred_()||0,enumerable:!0},mediaSecondsLoaded:{get:()=>this.playlistController_.mediaSecondsLoaded_()||0,enumerable:!0},mediaAppends:{get:()=>this.playlistController_.mediaAppends_()||0,enumerable:!0},mainAppendsToLoadedData:{get:()=>this.playlistController_.mainAppendsToLoadedData_()||0,enumerable:!0},audioAppendsToLoadedData:{get:()=>this.playlistController_.audioAppendsToLoadedData_()||0,enumerable:!0},appendsToLoadedData:{get:()=>this.playlistController_.appendsToLoadedData_()||0,enumerable:!0},timeToLoadedData:{get:()=>this.playlistController_.timeToLoadedData_()||0,enumerable:!0},buffered:{get:()=>zt(this.tech_.buffered()),enumerable:!0},currentTime:{get:()=>this.tech_.currentTime(),enumerable:!0},currentSource:{get:()=>this.tech_.currentSource_,enumerable:!0},currentTech:{get:()=>this.tech_.name_,enumerable:!0},duration:{get:()=>this.tech_.duration(),enumerable:!0},main:{get:()=>this.playlists.main,enumerable:!0},playerDimensions:{get:()=>this.tech_.currentDimensions(),enumerable:!0},seekable:{get:()=>zt(this.tech_.seekable()),enumerable:!0},timestamp:{get:()=>Date.now(),enumerable:!0},videoPlaybackQuality:{get:()=>this.tech_.getVideoPlaybackQuality(),enumerable:!0}}),this.tech_.one("canplay",this.playlistController_.setupFirstPlay.bind(this.playlistController_)),this.tech_.on("bandwidthupdate",()=>{this.options_.useBandwidthFromLocalStorage&&My({bandwidth:this.bandwidth,throughput:Math.round(this.throughput)})}),this.playlistController_.on("selectedinitialmedia",()=>{by(this)}),this.playlistController_.sourceUpdater_.on("createdsourcebuffers",()=>{this.setupEme_()}),this.on(this.playlistController_,"progress",function(){this.tech_.trigger("progress")}),this.on(this.playlistController_,"firstplay",function(){this.ignoreNextSeekingEvent_=!0}),this.setupQualityLevels_(),this.tech_.el()&&(this.mediaSourceUrl_=x.URL.createObjectURL(this.playlistController_.mediaSource),(k.browser.IS_ANY_SAFARI||k.browser.IS_IOS)&&this.options_.overrideNative&&this.options_.sourceType==="hls"&&typeof this.tech_.addSourceElement=="function"?(this.tech_.addSourceElement(this.mediaSourceUrl_),this.tech_.addSourceElement(this.source_.src)):this.tech_.src(this.mediaSourceUrl_))}createKeySessions_(){const e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;this.logger_("waiting for EME key session creation"),Dy({player:this.player_,sourceKeySystems:this.source_.keySystems,audioMedia:e&&e.media(),mainPlaylists:this.playlists.main.playlists}).then(()=>{this.logger_("created EME key session"),this.playlistController_.sourceUpdater_.initializedEme()}).catch(t=>{this.logger_("error while creating EME key session",t),this.player_.error({message:"Failed to initialize media keys for EME",code:3})})}handleWaitingForKey_(){this.logger_("waitingforkey fired, attempting to create any new key sessions"),this.createKeySessions_()}setupEme_(){const e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader,t=Oy({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:e&&e.media()});if(this.player_.tech_.on("keystatuschange",i=>{this.playlistController_.updatePlaylistByKeyStatus(i.keyId,i.status)}),this.handleWaitingForKey_=this.handleWaitingForKey_.bind(this),this.player_.tech_.on("waitingforkey",this.handleWaitingForKey_),!t){this.playlistController_.sourceUpdater_.initializedEme();return}this.createKeySessions_()}setupQualityLevels_(){const e=k.players[this.tech_.options_.playerId];!e||!e.qualityLevels||this.qualityLevels_||(this.qualityLevels_=e.qualityLevels(),this.playlistController_.on("selectedinitialmedia",()=>{Py(this.qualityLevels_,this)}),this.playlists.on("mediachange",()=>{Pd(this.qualityLevels_,this.playlists)}))}static version(){return{"@videojs/http-streaming":kd,"mux.js":Ey,"mpd-parser":wy,"m3u8-parser":ky,"aes-decrypter":Iy}}version(){return this.constructor.version()}canChangeType(){return xd.canChangeType()}play(){this.playlistController_.play()}setCurrentTime(e){this.playlistController_.setCurrentTime(e)}duration(){return this.playlistController_.duration()}seekable(){return this.playlistController_.seekable()}dispose(){this.playbackWatcher_&&this.playbackWatcher_.dispose(),this.playlistController_&&this.playlistController_.dispose(),this.qualityLevels_&&this.qualityLevels_.dispose(),this.tech_&&this.tech_.vhs&&delete this.tech_.vhs,this.mediaSourceUrl_&&x.URL.revokeObjectURL&&(x.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),super.dispose()}convertToProgramTime(e,t){return j0({playlist:this.playlistController_.media(),time:e,callback:t})}seekToProgramTime(e,t,i=!0,n=2){return rd({programTime:e,playlist:this.playlistController_.media(),retryCount:n,pauseAfterSeek:i,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})}setupXhrHooks_(){this.xhr.onRequest=e=>{Ld(this.xhr,e)},this.xhr.onResponse=e=>{Dd(this.xhr,e)},this.xhr.offRequest=e=>{Od(this.xhr,e)},this.xhr.offResponse=e=>{Md(this.xhr,e)},this.player_.trigger("xhr-hooks-ready")}attachStreamingEventListeners_(){const e=["seekablerangeschanged","bufferedrangeschanged","contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"],t=["gapjumped","playedrangeschanged"];e.forEach(i=>{this.playlistController_.on(i,n=>{this.player_.trigger(ve({},n))})}),t.forEach(i=>{this.playbackWatcher_.on(i,n=>{this.player_.trigger(ve({},n))})})}}const wn={name:"videojs-http-streaming",VERSION:kd,canHandleSource(s,e={}){const t=Z(k.options,e);return!t.vhs.experimentalUseMMS&&!as("avc1.4d400d,mp4a.40.2",!1)?!1:wn.canPlayType(s.type,t)},handleSource(s,e,t={}){const i=Z(k.options,t);return e.vhs=new Rd(s,e,i),e.vhs.xhr=ed(),e.vhs.setupXhrHooks_(),e.vhs.src(s.src,s.type),e.vhs},canPlayType(s,e){const t=uu(s);if(!t)return"";const i=wn.getOverrideNative(e);return!ce.supportsTypeNatively(t)||i?"maybe":""},getOverrideNative(s={}){const{vhs:e={}}=s,t=!(k.browser.IS_ANY_SAFARI||k.browser.IS_IOS),{overrideNative:i=t}=e;return i}},Fy=()=>as("avc1.4d400d,mp4a.40.2",!0);Fy()&&k.getTech("Html5").registerSourceHandler(wn,0);k.VhsHandler=Rd;k.VhsSourceHandler=wn;k.Vhs=ce;k.use||k.registerComponent("Vhs",ce);k.options.vhs=k.options.vhs||{};(!k.getPlugin||!k.getPlugin("reloadSourceOnError"))&&k.registerPlugin("reloadSourceOnError",Cy);exports._extends=ve;exports.getAugmentedNamespace=Xl;exports.getDefaultExportFromCjs=Ci;exports.require_extends=Yl;exports.resolveUrl=au;exports.videojs=k;exports.window$1=x;
|
|
213
|
-
//# sourceMappingURL=video-De6bH9lK.js.map
|