diff --git a/frontend-tools/video-js/src/components/markers/ChapterMarkers.js b/frontend-tools/video-js/src/components/markers/ChapterMarkers.js index 1e78af84..2d090d7c 100644 --- a/frontend-tools/video-js/src/components/markers/ChapterMarkers.js +++ b/frontend-tools/video-js/src/components/markers/ChapterMarkers.js @@ -11,6 +11,7 @@ class ChapterMarkers extends Component { this.chaptersData = []; this.tooltip = null; this.isHovering = false; + this.previewSprite = options.previewSprite || null; } createEl() { @@ -72,9 +73,7 @@ class ChapterMarkers extends Component { } setupProgressBarHover() { - const progressControl = this.player() - .getChild('controlBar') - .getChild('progressControl'); + const progressControl = this.player().getChild('controlBar').getChild('progressControl'); if (!progressControl) return; const seekBar = progressControl.getChild('seekBar'); @@ -103,11 +102,61 @@ class ChapterMarkers extends Component { bottom: '45px', transform: 'translateX(-50%)', display: 'none', - maxWidth: '250px', + minWidth: '200px', + maxWidth: '280px', + width: 'auto', textAlign: 'center', border: '1px solid rgba(255, 255, 255, 0.2)', boxShadow: '0 2px 8px rgba(0, 0, 0, 0.3)', }); + + // Create stable DOM structure to avoid trembling + this.chapterTitle = videojs.dom.createEl('div', { + className: 'chapter-title', + }); + Object.assign(this.chapterTitle.style, { + fontWeight: 'bold', + marginBottom: '4px', + color: '#fff', + }); + + this.chapterInfo = videojs.dom.createEl('div', { + className: 'chapter-info', + }); + Object.assign(this.chapterInfo.style, { + fontSize: '11px', + opacity: '0.8', + marginBottom: '2px', + }); + + this.positionInfo = videojs.dom.createEl('div', { + className: 'position-info', + }); + Object.assign(this.positionInfo.style, { + fontSize: '10px', + opacity: '0.6', + }); + + this.chapterImage = videojs.dom.createEl('div', { + className: 'chapter-image-sprite', + }); + Object.assign(this.chapterImage.style, { + width: '160px', + height: '90px', + marginTop: '8px', + borderRadius: '4px', + border: '1px solid rgba(255,255,255,0.1)', + display: 'block', + overflow: 'hidden', + backgroundRepeat: 'no-repeat', + backgroundSize: 'auto', + }); + + // Append all elements to tooltip + this.tooltip.appendChild(this.chapterTitle); + this.tooltip.appendChild(this.chapterInfo); + this.tooltip.appendChild(this.positionInfo); + this.tooltip.appendChild(this.chapterImage); } // Add tooltip to seekBar if not already added @@ -124,18 +173,9 @@ class ChapterMarkers extends Component { const progressControlEl = progressControl.el(); // Remove existing listeners to prevent duplicates - progressControlEl.removeEventListener( - 'mouseenter', - this.handleMouseEnter - ); - progressControlEl.removeEventListener( - 'mouseleave', - this.handleMouseLeave - ); - progressControlEl.removeEventListener( - 'mousemove', - this.handleMouseMove - ); + progressControlEl.removeEventListener('mouseenter', this.handleMouseEnter); + progressControlEl.removeEventListener('mouseleave', this.handleMouseLeave); + progressControlEl.removeEventListener('mousemove', this.handleMouseMove); // Bind methods to preserve context this.handleMouseEnter = () => { @@ -171,10 +211,7 @@ class ChapterMarkers extends Component { // Use seekBar for horizontal calculation but allow vertical tolerance const offsetX = event.clientX - seekBarRect.left; - const percentage = Math.max( - 0, - Math.min(1, offsetX / seekBarRect.width) - ); + const percentage = Math.max(0, Math.min(1, offsetX / seekBarRect.width)); const currentTime = percentage * duration; // Position tooltip relative to progress control area @@ -195,21 +232,49 @@ class ChapterMarkers extends Component { const endTime = formatTime(currentChapter.endTime); const timeAtPosition = formatTime(currentTime); - this.tooltip.innerHTML = ` -
${currentChapter.text}
-
Chapter: ${startTime} - ${endTime}
-
Position: ${timeAtPosition}
- `; + // Update text content without rebuilding DOM + this.chapterTitle.textContent = currentChapter.text; + this.chapterInfo.textContent = `Chapter: ${startTime} - ${endTime}`; + this.positionInfo.textContent = `Position: ${timeAtPosition}`; + + // Update sprite thumbnail + this.updateSpriteThumbnail(currentTime); + this.chapterImage.style.display = 'block'; } else { const timeAtPosition = this.formatTime(currentTime); - this.tooltip.innerHTML = ` -
No Chapter
-
Position: ${timeAtPosition}
- `; + this.chapterTitle.textContent = 'No Chapter'; + this.chapterInfo.textContent = ''; + this.positionInfo.textContent = `Position: ${timeAtPosition}`; + + // Still show sprite thumbnail even when not in a chapter + this.updateSpriteThumbnail(currentTime); + this.chapterImage.style.display = 'block'; } - // Position tooltip relative to progress control container - this.tooltip.style.left = `${tooltipOffsetX}px`; + // Position tooltip with smart boundary detection + // Force tooltip to be visible momentarily to get accurate dimensions + this.tooltip.style.visibility = 'hidden'; + this.tooltip.style.display = 'block'; + + const tooltipWidth = this.tooltip.offsetWidth || 240; // Fallback width + const progressControlWidth = progressControlRect.width; + const halfTooltipWidth = tooltipWidth / 2; + + // Calculate ideal position (where mouse is) + let idealLeft = tooltipOffsetX; + + // Check and adjust boundaries + if (idealLeft - halfTooltipWidth < 0) { + // Too far left - align to left edge with small margin + idealLeft = halfTooltipWidth + 5; + } else if (idealLeft + halfTooltipWidth > progressControlWidth) { + // Too far right - align to right edge with small margin + idealLeft = progressControlWidth - halfTooltipWidth - 5; + } + + // Apply position and make visible + this.tooltip.style.left = `${idealLeft}px`; + this.tooltip.style.visibility = 'visible'; this.tooltip.style.display = 'block'; } @@ -222,6 +287,61 @@ class ChapterMarkers extends Component { return null; } + updateSpriteThumbnail(currentTime) { + if (!this.previewSprite || !this.previewSprite.url) { + // Hide image if no sprite data available + this.chapterImage.style.display = 'none'; + console.log('No sprite data available:', this.previewSprite); + return; + } + + const { url, frame } = this.previewSprite; + const { width, height } = frame; + + // Calculate which frame to show based on current time + // Use sprite interval from frame data, fallback to 10 seconds + const frameInterval = frame.seconds || 10; + + // Try to detect total frames based on video duration vs frame interval + const videoDuration = this.player().duration() || 45; // fallback duration + const calculatedMaxFrames = Math.ceil(videoDuration / frameInterval); + const maxFrames = Math.min(calculatedMaxFrames, 6); // Cap at 6 frames to be safe + + let frameIndex = Math.floor(currentTime / frameInterval); + + // Clamp frameIndex to available frames to prevent showing empty areas + frameIndex = Math.min(frameIndex, maxFrames - 1); + + // Based on the sprite image you shared, it appears to have frames arranged vertically + // Let's try a vertical layout first (1 column, multiple rows) + const frameRow = frameIndex; // Each frame is on its own row + const frameCol = 0; // Always first (and only) column + + // Calculate background position (negative values to shift the sprite) + const xPos = -(frameCol * width); + const yPos = -(frameRow * height); + + console.log( + `Time: ${currentTime}s, Duration: ${this.player().duration()}s, Interval: ${frameInterval}s, Frame: ${frameIndex}/${maxFrames - 1}, Row: ${frameRow}, Col: ${frameCol}, Pos: ${xPos}px ${yPos}px, URL: ${url}` + ); + + // Apply sprite background + this.chapterImage.style.backgroundImage = `url("${url}")`; + this.chapterImage.style.backgroundPosition = `${xPos}px ${yPos}px`; + this.chapterImage.style.backgroundSize = 'auto'; + this.chapterImage.style.backgroundRepeat = 'no-repeat'; + + // Ensure the image is visible + this.chapterImage.style.display = 'block'; + + // Fallback: if we're beyond frame 3 (30s+), try showing frame 2 instead (20-30s frame) + if (frameIndex >= 3 && currentTime > 30) { + const fallbackYPos = -(2 * height); // Frame 2 (20-30s range) + this.chapterImage.style.backgroundPosition = `${xPos}px ${fallbackYPos}px`; + console.log(`Fallback: Using frame 2 instead of frame ${frameIndex} for time ${currentTime}s`); + } + } + formatTime(seconds) { const mins = Math.floor(seconds / 60); const secs = Math.floor(seconds % 60); @@ -259,23 +379,12 @@ class ChapterMarkers extends Component { dispose() { // Clean up event listeners - const progressControl = this.player() - .getChild('controlBar') - ?.getChild('progressControl'); + const progressControl = this.player().getChild('controlBar')?.getChild('progressControl'); if (progressControl) { const progressControlEl = progressControl.el(); - progressControlEl.removeEventListener( - 'mouseenter', - this.handleMouseEnter - ); - progressControlEl.removeEventListener( - 'mouseleave', - this.handleMouseLeave - ); - progressControlEl.removeEventListener( - 'mousemove', - this.handleMouseMove - ); + progressControlEl.removeEventListener('mouseenter', this.handleMouseEnter); + progressControlEl.removeEventListener('mouseleave', this.handleMouseLeave); + progressControlEl.removeEventListener('mousemove', this.handleMouseMove); } // Remove tooltip diff --git a/frontend-tools/video-js/src/components/video-player/VideoJSPlayer.jsx b/frontend-tools/video-js/src/components/video-player/VideoJSPlayer.jsx index 42105dad..1d98997b 100644 --- a/frontend-tools/video-js/src/components/video-player/VideoJSPlayer.jsx +++ b/frontend-tools/video-js/src/components/video-player/VideoJSPlayer.jsx @@ -23,6 +23,10 @@ function VideoJSPlayer() { ? window.MEDIA_DATA : { data: {}, + previewSprite: { + url: 'https://demo.mediacms.io/media/original/thumbnails/user/markos/fe4933d67b884d4da507dd60e77f7438.VID_20200909_141053.mp4sprites.jpg', + frame: { width: 160, height: 90, seconds: 10 }, + }, siteUrl: '', hasNextLink: true, }, @@ -38,9 +42,9 @@ function VideoJSPlayer() { { startTime: 15, endTime: 20, text: 'Parcel Discounts - EuroHPC' }, { startTime: 20, endTime: 25, text: 'Class Studies - EuroHPC' }, { startTime: 25, endTime: 30, text: 'Sustainability - EuroHPC' }, - { startTime: 30, endTime: 35, text: 'Funding and Finance - EuroHPC' }, + { startTime: 30, endTime: 31, text: 'Funding and - EuroHPC' } /* { startTime: 35, endTime: 40, text: 'Virtual HPC Academy - EuroHPC' }, - { startTime: 40, endTime: 45, text: 'Wrapping up - EuroHPC' }, + { startTime: 40, endTime: 45, text: 'Wrapping up - EuroHPC' }, */, ]; // Get video data from mediaData @@ -49,6 +53,7 @@ function VideoJSPlayer() { id: mediaData.data?.friendly_token || 'default-video', title: mediaData.data?.title || 'Video', poster: mediaData.siteUrl + mediaData.data?.poster_url || '', + previewSprite: mediaData?.previewSprite || {}, sources: mediaData.data?.original_media_url ? [ { @@ -640,7 +645,9 @@ function VideoJSPlayer() { // BEGIN: Add chapter markers to progress control if (progressControl && seekBar) { - const chapterMarkers = new ChapterMarkers(playerRef.current); + const chapterMarkers = new ChapterMarkers(playerRef.current, { + previewSprite: mediaData.previewSprite, + }); seekBar.addChild(chapterMarkers); } // END: Add chapter markers to progress control diff --git a/static/video_js/video-js.js b/static/video_js/video-js.js index 3383c3ae..82b5a4fc 100644 --- a/static/video_js/video-js.js +++ b/static/video_js/video-js.js @@ -6,7 +6,7 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */Wc.exports;var w_;function Ew(){return w_||(w_=1,function(s,e){(function(){function i(w,X){Object.defineProperty(u.prototype,w,{get:function(){console.warn("%s(...) is deprecated in plain JavaScript React classes. %s",X[0],X[1])}})}function r(w){return w===null||typeof w!="object"?null:(w=Ir&&w[Ir]||w["@@iterator"],typeof w=="function"?w:null)}function o(w,X){w=(w=w.constructor)&&(w.displayName||w.name)||"ReactClass";var me=w+"."+X;Ra[me]||(console.error("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",X,w),Ra[me]=!0)}function u(w,X,me){this.props=w,this.context=X,this.refs=Uo,this.updater=me||qs}function c(){}function p(w,X,me){this.props=w,this.context=X,this.refs=Uo,this.updater=me||qs}function g(w){return""+w}function b(w){try{g(w);var X=!1}catch{X=!0}if(X){X=console;var me=X.error,be=typeof Symbol=="function"&&Symbol.toStringTag&&w[Symbol.toStringTag]||w.constructor.name||"Object";return me.call(X,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",be),g(w)}}function S(w){if(w==null)return null;if(typeof w=="function")return w.$$typeof===Bo?null:w.displayName||w.name||null;if(typeof w=="string")return w;switch(w){case le:return"Fragment";case Ae:return"Profiler";case Me:return"StrictMode";case nt:return"Suspense";case Lr:return"SuspenseList";case cn:return"Activity"}if(typeof w=="object")switch(typeof w.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),w.$$typeof){case Ye:return"Portal";case xt:return(w.displayName||"Context")+".Provider";case rt:return(w._context.displayName||"Context")+".Consumer";case Ut:var X=w.render;return w=w.displayName,w||(w=X.displayName||X.name||"",w=w!==""?"ForwardRef("+w+")":"ForwardRef"),w;case Rt:return X=w.displayName||null,X!==null?X:S(w.type)||"Memo";case si:X=w._payload,w=w._init;try{return S(w(X))}catch{}}return null}function E(w){if(w===le)return"<>";if(typeof w=="object"&&w!==null&&w.$$typeof===si)return"<...>";try{var X=S(w);return X?"<"+X+">":"<...>"}catch{return"<...>"}}function A(){var w=Ce.A;return w===null?null:w.getOwner()}function M(){return Error("react-stack-top-frame")}function U(w){if(Nr.call(w,"key")){var X=Object.getOwnPropertyDescriptor(w,"key").get;if(X&&X.isReactWarning)return!1}return w.key!==void 0}function D(w,X){function me(){$s||($s=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",X))}me.isReactWarning=!0,Object.defineProperty(w,"key",{get:me,configurable:!0})}function z(){var w=S(this.type);return Pr[w]||(Pr[w]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),w=this.props.ref,w!==void 0?w:null}function H(w,X,me,be,Oe,Ge,He,it){return me=Ge.ref,w={$$typeof:Re,type:w,key:X,props:Ge,_owner:Oe},(me!==void 0?me:null)!==null?Object.defineProperty(w,"ref",{enumerable:!1,get:z}):Object.defineProperty(w,"ref",{enumerable:!1,value:null}),w._store={},Object.defineProperty(w._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(w,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(w,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:He}),Object.defineProperty(w,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:it}),Object.freeze&&(Object.freeze(w.props),Object.freeze(w)),w}function Y(w,X){return X=H(w.type,X,void 0,void 0,w._owner,w.props,w._debugStack,w._debugTask),w._store&&(X._store.validated=w._store.validated),X}function V(w){return typeof w=="object"&&w!==null&&w.$$typeof===Re}function Q(w){var X={"=":"=0",":":"=2"};return"$"+w.replace(/[=:]/g,function(me){return X[me]})}function Z(w,X){return typeof w=="object"&&w!==null&&w.key!=null?(b(w.key),Q(""+w.key)):X.toString(36)}function W(){}function G(w){switch(w.status){case"fulfilled":return w.value;case"rejected":throw w.reason;default:switch(typeof w.status=="string"?w.then(W,W):(w.status="pending",w.then(function(X){w.status==="pending"&&(w.status="fulfilled",w.value=X)},function(X){w.status==="pending"&&(w.status="rejected",w.reason=X)})),w.status){case"fulfilled":return w.value;case"rejected":throw w.reason}}throw w}function ee(w,X,me,be,Oe){var Ge=typeof w;(Ge==="undefined"||Ge==="boolean")&&(w=null);var He=!1;if(w===null)He=!0;else switch(Ge){case"bigint":case"string":case"number":He=!0;break;case"object":switch(w.$$typeof){case Re:case Ye:He=!0;break;case si:return He=w._init,ee(He(w._payload),X,me,be,Oe)}}if(He){He=w,Oe=Oe(He);var it=be===""?"."+Z(He,0):be;return _i(Oe)?(me="",it!=null&&(me=it.replace(Ia,"$&/")+"/"),ee(Oe,X,me,"",function(Yt){return Yt})):Oe!=null&&(V(Oe)&&(Oe.key!=null&&(He&&He.key===Oe.key||b(Oe.key)),me=Y(Oe,me+(Oe.key==null||He&&He.key===Oe.key?"":(""+Oe.key).replace(Ia,"$&/")+"/")+it),be!==""&&He!=null&&V(He)&&He.key==null&&He._store&&!He._store.validated&&(me._store.validated=2),Oe=me),X.push(Oe)),1}if(He=0,it=be===""?".":be+":",_i(w))for(var ze=0;ze";if(typeof w=="object"&&w!==null&&w.$$typeof===si)return"<...>";try{var X=S(w);return X?"<"+X+">":"<...>"}catch{return"<...>"}}function A(){var w=Ce.A;return w===null?null:w.getOwner()}function M(){return Error("react-stack-top-frame")}function U(w){if(Nr.call(w,"key")){var X=Object.getOwnPropertyDescriptor(w,"key").get;if(X&&X.isReactWarning)return!1}return w.key!==void 0}function D(w,X){function me(){$s||($s=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",X))}me.isReactWarning=!0,Object.defineProperty(w,"key",{get:me,configurable:!0})}function z(){var w=S(this.type);return Pr[w]||(Pr[w]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),w=this.props.ref,w!==void 0?w:null}function H(w,X,me,be,Oe,Ge,He,it){return me=Ge.ref,w={$$typeof:Re,type:w,key:X,props:Ge,_owner:Oe},(me!==void 0?me:null)!==null?Object.defineProperty(w,"ref",{enumerable:!1,get:z}):Object.defineProperty(w,"ref",{enumerable:!1,value:null}),w._store={},Object.defineProperty(w._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(w,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(w,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:He}),Object.defineProperty(w,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:it}),Object.freeze&&(Object.freeze(w.props),Object.freeze(w)),w}function Y(w,X){return X=H(w.type,X,void 0,void 0,w._owner,w.props,w._debugStack,w._debugTask),w._store&&(X._store.validated=w._store.validated),X}function $(w){return typeof w=="object"&&w!==null&&w.$$typeof===Re}function Q(w){var X={"=":"=0",":":"=2"};return"$"+w.replace(/[=:]/g,function(me){return X[me]})}function Z(w,X){return typeof w=="object"&&w!==null&&w.key!=null?(b(w.key),Q(""+w.key)):X.toString(36)}function W(){}function G(w){switch(w.status){case"fulfilled":return w.value;case"rejected":throw w.reason;default:switch(typeof w.status=="string"?w.then(W,W):(w.status="pending",w.then(function(X){w.status==="pending"&&(w.status="fulfilled",w.value=X)},function(X){w.status==="pending"&&(w.status="rejected",w.reason=X)})),w.status){case"fulfilled":return w.value;case"rejected":throw w.reason}}throw w}function ee(w,X,me,be,Oe){var Ge=typeof w;(Ge==="undefined"||Ge==="boolean")&&(w=null);var He=!1;if(w===null)He=!0;else switch(Ge){case"bigint":case"string":case"number":He=!0;break;case"object":switch(w.$$typeof){case Re:case Ye:He=!0;break;case si:return He=w._init,ee(He(w._payload),X,me,be,Oe)}}if(He){He=w,Oe=Oe(He);var it=be===""?"."+Z(He,0):be;return _i(Oe)?(me="",it!=null&&(me=it.replace(Ia,"$&/")+"/"),ee(Oe,X,me,"",function(Yt){return Yt})):Oe!=null&&($(Oe)&&(Oe.key!=null&&(He&&He.key===Oe.key||b(Oe.key)),me=Y(Oe,me+(Oe.key==null||He&&He.key===Oe.key?"":(""+Oe.key).replace(Ia,"$&/")+"/")+it),be!==""&&He!=null&&$(He)&&He.key==null&&He._store&&!He._store.validated&&(me._store.validated=2),Oe=me),X.push(Oe)),1}if(He=0,it=be===""?".":be+":",_i(w))for(var ze=0;ze import('./MyComponent')) @@ -18,7 +18,7 @@ Your code should look like: 1. You might have mismatching versions of React and the renderer (such as React DOM) 2. You might be breaking the Rules of Hooks 3. You might have more than one copy of React in the same app -See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.`),w}function xe(){}function ve(w){if(ot===null)try{var X=("require"+Math.random()).slice(0,7);ot=(s&&s[X]).call(s,"timers").setImmediate}catch{ot=function(be){Na===!1&&(Na=!0,typeof MessageChannel>"u"&&console.error("This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning."));var Oe=new MessageChannel;Oe.port1.onmessage=be,Oe.port2.postMessage(void 0)}}return ot(w)}function Ne(w){return 1 ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"))}),{then:function(ze,Yt){Oe=!0,He.then(function(ms){if(at(X,me),me===0){try{Ee(be),ve(function(){return de(ms,ze,Yt)})}catch(Pd){Ce.thrownErrors.push(Pd)}if(0 ...)"))}),Ce.actQueue=null),0Ce.recentlyCreatedOwnerStacks++;return H(w,Oe,void 0,void 0,A(),be,ze?Error("react-stack-top-frame"):La,ze?Vs(E(w)):Gs)},e.createRef=function(){var w={current:null};return Object.seal(w),w},e.forwardRef=function(w){w!=null&&w.$$typeof===Rt?console.error("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."):typeof w!="function"?console.error("forwardRef requires a render function but was given %s.",w===null?"null":typeof w):w.length!==0&&w.length!==2&&console.error("forwardRef render functions accept exactly two parameters: props and ref. %s",w.length===1?"Did you forget to use the ref parameter?":"Any additional parameter will be undefined."),w!=null&&w.defaultProps!=null&&console.error("forwardRef render functions do not support defaultProps. Did you accidentally pass a React component?");var X={$$typeof:Ut,render:w},me;return Object.defineProperty(X,"displayName",{enumerable:!1,configurable:!0,get:function(){return me},set:function(be){me=be,w.name||w.displayName||(Object.defineProperty(w,"name",{value:be}),w.displayName=be)}}),X},e.isValidElement=V,e.lazy=function(w){return{$$typeof:si,_payload:{_status:-1,_result:w},_init:_e}},e.memo=function(w,X){w==null&&console.error("memo: The first argument must be a component. Instead received: %s",w===null?"null":typeof w),X={$$typeof:Rt,type:w,compare:X===void 0?null:X};var me;return Object.defineProperty(X,"displayName",{enumerable:!1,configurable:!0,get:function(){return me},set:function(be){me=be,w.name||w.displayName||(Object.defineProperty(w,"name",{value:be}),w.displayName=be)}}),X},e.startTransition=function(w){var X=Ce.T,me={};Ce.T=me,me._updatedFibers=new Set;try{var be=w(),Oe=Ce.S;Oe!==null&&Oe(me,be),typeof be=="object"&&be!==null&&typeof be.then=="function"&&be.then(xe,Br)}catch(Ge){Br(Ge)}finally{X===null&&me._updatedFibers&&(w=me._updatedFibers.size,me._updatedFibers.clear(),10"u"&&console.error("This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning."));var Oe=new MessageChannel;Oe.port1.onmessage=be,Oe.port2.postMessage(void 0)}}return ot(w)}function Ne(w){return 1 ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"))}),{then:function(ze,Yt){Oe=!0,He.then(function(ms){if(at(X,me),me===0){try{Ee(be),ve(function(){return de(ms,ze,Yt)})}catch(Pd){Ce.thrownErrors.push(Pd)}if(0 ...)"))}),Ce.actQueue=null),0Ce.recentlyCreatedOwnerStacks++;return H(w,Oe,void 0,void 0,A(),be,ze?Error("react-stack-top-frame"):La,ze?Vs(E(w)):Gs)},e.createRef=function(){var w={current:null};return Object.seal(w),w},e.forwardRef=function(w){w!=null&&w.$$typeof===Rt?console.error("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."):typeof w!="function"?console.error("forwardRef requires a render function but was given %s.",w===null?"null":typeof w):w.length!==0&&w.length!==2&&console.error("forwardRef render functions accept exactly two parameters: props and ref. %s",w.length===1?"Did you forget to use the ref parameter?":"Any additional parameter will be undefined."),w!=null&&w.defaultProps!=null&&console.error("forwardRef render functions do not support defaultProps. Did you accidentally pass a React component?");var X={$$typeof:Ut,render:w},me;return Object.defineProperty(X,"displayName",{enumerable:!1,configurable:!0,get:function(){return me},set:function(be){me=be,w.name||w.displayName||(Object.defineProperty(w,"name",{value:be}),w.displayName=be)}}),X},e.isValidElement=$,e.lazy=function(w){return{$$typeof:si,_payload:{_status:-1,_result:w},_init:_e}},e.memo=function(w,X){w==null&&console.error("memo: The first argument must be a component. Instead received: %s",w===null?"null":typeof w),X={$$typeof:Rt,type:w,compare:X===void 0?null:X};var me;return Object.defineProperty(X,"displayName",{enumerable:!1,configurable:!0,get:function(){return me},set:function(be){me=be,w.name||w.displayName||(Object.defineProperty(w,"name",{value:be}),w.displayName=be)}}),X},e.startTransition=function(w){var X=Ce.T,me={};Ce.T=me,me._updatedFibers=new Set;try{var be=w(),Oe=Ce.S;Oe!==null&&Oe(me,be),typeof be=="object"&&be!==null&&typeof be.then=="function"&&be.then(xe,Br)}catch(Ge){Br(Ge)}finally{X===null&&me._updatedFibers&&(w=me._updatedFibers.size,me._updatedFibers.clear(),10";if(typeof le=="object"&&le!==null&&le.$$typeof===ee)return"<...>";try{var Me=s(le);return Me?"<"+Me+">":"<...>"}catch{return"<...>"}}function o(){var le=fe.A;return le===null?null:le.getOwner()}function u(){return Error("react-stack-top-frame")}function c(le){if(xe.call(le,"key")){var Me=Object.getOwnPropertyDescriptor(le,"key").get;if(Me&&Me.isReactWarning)return!1}return le.key!==void 0}function p(le,Me){function Ae(){at||(at=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",Me))}Ae.isReactWarning=!0,Object.defineProperty(le,"key",{get:Ae,configurable:!0})}function g(){var le=s(this.type);return de[le]||(de[le]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),le=this.props.ref,le!==void 0?le:null}function b(le,Me,Ae,rt,xt,Ut,nt,Lr){return Ae=Ut.ref,le={$$typeof:M,type:le,key:Me,props:Ut,_owner:xt},(Ae!==void 0?Ae:null)!==null?Object.defineProperty(le,"ref",{enumerable:!1,get:g}):Object.defineProperty(le,"ref",{enumerable:!1,value:null}),le._store={},Object.defineProperty(le._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(le,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(le,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:nt}),Object.defineProperty(le,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:Lr}),Object.freeze&&(Object.freeze(le.props),Object.freeze(le)),le}function S(le,Me,Ae,rt,xt,Ut,nt,Lr){var Rt=Me.children;if(Rt!==void 0)if(rt)if(ve(Rt)){for(rt=0;rt";if(typeof le=="object"&&le!==null&&le.$$typeof===ee)return"<...>";try{var Me=s(le);return Me?"<"+Me+">":"<...>"}catch{return"<...>"}}function o(){var le=fe.A;return le===null?null:le.getOwner()}function u(){return Error("react-stack-top-frame")}function c(le){if(xe.call(le,"key")){var Me=Object.getOwnPropertyDescriptor(le,"key").get;if(Me&&Me.isReactWarning)return!1}return le.key!==void 0}function p(le,Me){function Ae(){at||(at=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",Me))}Ae.isReactWarning=!0,Object.defineProperty(le,"key",{get:Ae,configurable:!0})}function g(){var le=s(this.type);return de[le]||(de[le]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),le=this.props.ref,le!==void 0?le:null}function b(le,Me,Ae,rt,xt,Ut,nt,Lr){return Ae=Ut.ref,le={$$typeof:M,type:le,key:Me,props:Ut,_owner:xt},(Ae!==void 0?Ae:null)!==null?Object.defineProperty(le,"ref",{enumerable:!1,get:g}):Object.defineProperty(le,"ref",{enumerable:!1,value:null}),le._store={},Object.defineProperty(le._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(le,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(le,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:nt}),Object.defineProperty(le,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:Lr}),Object.freeze&&(Object.freeze(le.props),Object.freeze(le)),le}function S(le,Me,Ae,rt,xt,Ut,nt,Lr){var Rt=Me.children;if(Rt!==void 0)if(rt)if(ve(Rt)){for(rt=0;rt React keys must be passed directly to JSX without using spread: let props = %s; - <%s key={someKey} {...props} />`,rt,Rt,si,Rt),Ye[Rt+rt]=!0)}if(Rt=null,Ae!==void 0&&(i(Ae),Rt=""+Ae),c(Me)&&(i(Me.key),Rt=""+Me.key),"key"in Me){Ae={};for(var cn in Me)cn!=="key"&&(Ae[cn]=Me[cn])}else Ae=Me;return Rt&&p(Ae,typeof le=="function"?le.displayName||le.name||"Unknown":le),b(le,Rt,Ut,xt,o(),Ae,nt,Lr)}function E(le){typeof le=="object"&&le!==null&&le.$$typeof===M&&le._store&&(le._store.validated=1)}var A=Hn,M=Symbol.for("react.transitional.element"),U=Symbol.for("react.portal"),D=Symbol.for("react.fragment"),z=Symbol.for("react.strict_mode"),H=Symbol.for("react.profiler"),Y=Symbol.for("react.consumer"),V=Symbol.for("react.context"),Q=Symbol.for("react.forward_ref"),Z=Symbol.for("react.suspense"),W=Symbol.for("react.suspense_list"),G=Symbol.for("react.memo"),ee=Symbol.for("react.lazy"),oe=Symbol.for("react.activity"),_e=Symbol.for("react.client.reference"),fe=A.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,xe=Object.prototype.hasOwnProperty,ve=Array.isArray,Ne=console.createTask?console.createTask:function(){return null};A={"react-stack-bottom-frame":function(le){return le()}};var at,de={},Ee=A["react-stack-bottom-frame"].bind(A,u)(),Re=Ne(r(u)),Ye={};Yc.Fragment=D,Yc.jsx=function(le,Me,Ae,rt,xt){var Ut=1e4>fe.recentlyCreatedOwnerStacks++;return S(le,Me,Ae,!1,rt,xt,Ut?Error("react-stack-top-frame"):Ee,Ut?Ne(r(le)):Re)},Yc.jsxs=function(le,Me,Ae,rt,xt){var Ut=1e4>fe.recentlyCreatedOwnerStacks++;return S(le,Me,Ae,!0,rt,xt,Ut?Error("react-stack-top-frame"):Ee,Ut?Ne(r(le)):Re)}}()),Yc}A_.exports=Cw();var Rf=A_.exports,O_={exports:{}},Ig={exports:{}},Ng={};/** + <%s key={someKey} {...props} />`,rt,Rt,si,Rt),Ye[Rt+rt]=!0)}if(Rt=null,Ae!==void 0&&(i(Ae),Rt=""+Ae),c(Me)&&(i(Me.key),Rt=""+Me.key),"key"in Me){Ae={};for(var cn in Me)cn!=="key"&&(Ae[cn]=Me[cn])}else Ae=Me;return Rt&&p(Ae,typeof le=="function"?le.displayName||le.name||"Unknown":le),b(le,Rt,Ut,xt,o(),Ae,nt,Lr)}function E(le){typeof le=="object"&&le!==null&&le.$$typeof===M&&le._store&&(le._store.validated=1)}var A=Hn,M=Symbol.for("react.transitional.element"),U=Symbol.for("react.portal"),D=Symbol.for("react.fragment"),z=Symbol.for("react.strict_mode"),H=Symbol.for("react.profiler"),Y=Symbol.for("react.consumer"),$=Symbol.for("react.context"),Q=Symbol.for("react.forward_ref"),Z=Symbol.for("react.suspense"),W=Symbol.for("react.suspense_list"),G=Symbol.for("react.memo"),ee=Symbol.for("react.lazy"),oe=Symbol.for("react.activity"),_e=Symbol.for("react.client.reference"),fe=A.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,xe=Object.prototype.hasOwnProperty,ve=Array.isArray,Ne=console.createTask?console.createTask:function(){return null};A={"react-stack-bottom-frame":function(le){return le()}};var at,de={},Ee=A["react-stack-bottom-frame"].bind(A,u)(),Re=Ne(r(u)),Ye={};Yc.Fragment=D,Yc.jsx=function(le,Me,Ae,rt,xt){var Ut=1e4>fe.recentlyCreatedOwnerStacks++;return S(le,Me,Ae,!1,rt,xt,Ut?Error("react-stack-top-frame"):Ee,Ut?Ne(r(le)):Re)},Yc.jsxs=function(le,Me,Ae,rt,xt){var Ut=1e4>fe.recentlyCreatedOwnerStacks++;return S(le,Me,Ae,!0,rt,xt,Ut?Error("react-stack-top-frame"):Ee,Ut?Ne(r(le)):Re)}}()),Yc}A_.exports=Cw();var Rf=A_.exports,O_={exports:{}},Ig={exports:{}},Ng={};/** * @license React * scheduler.development.js * @@ -39,7 +39,7 @@ React keys must be passed directly to JSX without using spread: * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var R_;function Aw(){return R_||(R_=1,function(s){(function(){function e(){if(Z=!1,oe){var de=s.unstable_now();xe=de;var Ee=!0;try{e:{V=!1,Q&&(Q=!1,G(_e),_e=-1),Y=!0;var Re=H;try{t:{for(c(de),z=r(M);z!==null&&!(z.expirationTime>de&&g());){var Ye=z.callback;if(typeof Ye=="function"){z.callback=null,H=z.priorityLevel;var le=Ye(z.expirationTime<=de);if(de=s.unstable_now(),typeof le=="function"){z.callback=le,c(de),Ee=!0;break t}z===r(M)&&o(M),c(de)}else o(M);z=r(M)}if(z!==null)Ee=!0;else{var Me=r(U);Me!==null&&b(p,Me.startTime-de),Ee=!1}}break e}finally{z=null,H=Re,Y=!1}Ee=void 0}}finally{Ee?ve():oe=!1}}}function i(de,Ee){var Re=de.length;de.push(Ee);e:for(;0>>1,le=de[Ye];if(0>>1;Yeu(rt,Re))xtu(Ut,rt)?(de[Ye]=Ut,de[xt]=Re,Ye=xt):(de[Ye]=rt,de[Ae]=Re,Ye=Ae);else if(xtu(Ut,Re))de[Ye]=Ut,de[xt]=Re,Ye=xt;else break e}}return Ee}function u(de,Ee){var Re=de.sortIndex-Ee.sortIndex;return Re!==0?Re:de.id-Ee.id}function c(de){for(var Ee=r(U);Ee!==null;){if(Ee.callback===null)o(U);else if(Ee.startTime<=de)o(U),Ee.sortIndex=Ee.expirationTime,i(M,Ee);else break;Ee=r(U)}}function p(de){if(Q=!1,c(de),!V)if(r(M)!==null)V=!0,oe||(oe=!0,ve());else{var Ee=r(U);Ee!==null&&b(p,Ee.startTime-de)}}function g(){return Z?!0:!(s.unstable_now()-xede||125Ye?(de.sortIndex=Re,i(U,de),r(M)===null&&de===r(U)&&(Q?(G(_e),_e=-1):Q=!0,b(p,Re-Ye))):(de.sortIndex=le,i(M,de),V||Y||(V=!0,oe||(oe=!0,ve()))),de},s.unstable_shouldYield=g,s.unstable_wrapCallback=function(de){var Ee=H;return function(){var Re=H;H=Ee;try{return de.apply(this,arguments)}finally{H=Re}}},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()}(Ng)),Ng}var M_;function Dw(){return M_||(M_=1,Ig.exports=Aw()),Ig.exports}var Pg={exports:{}},Mi={};/** + */var R_;function Aw(){return R_||(R_=1,function(s){(function(){function e(){if(Z=!1,oe){var de=s.unstable_now();xe=de;var Ee=!0;try{e:{$=!1,Q&&(Q=!1,G(_e),_e=-1),Y=!0;var Re=H;try{t:{for(c(de),z=r(M);z!==null&&!(z.expirationTime>de&&g());){var Ye=z.callback;if(typeof Ye=="function"){z.callback=null,H=z.priorityLevel;var le=Ye(z.expirationTime<=de);if(de=s.unstable_now(),typeof le=="function"){z.callback=le,c(de),Ee=!0;break t}z===r(M)&&o(M),c(de)}else o(M);z=r(M)}if(z!==null)Ee=!0;else{var Me=r(U);Me!==null&&b(p,Me.startTime-de),Ee=!1}}break e}finally{z=null,H=Re,Y=!1}Ee=void 0}}finally{Ee?ve():oe=!1}}}function i(de,Ee){var Re=de.length;de.push(Ee);e:for(;0>>1,le=de[Ye];if(0>>1;Yeu(rt,Re))xtu(Ut,rt)?(de[Ye]=Ut,de[xt]=Re,Ye=xt):(de[Ye]=rt,de[Ae]=Re,Ye=Ae);else if(xtu(Ut,Re))de[Ye]=Ut,de[xt]=Re,Ye=xt;else break e}}return Ee}function u(de,Ee){var Re=de.sortIndex-Ee.sortIndex;return Re!==0?Re:de.id-Ee.id}function c(de){for(var Ee=r(U);Ee!==null;){if(Ee.callback===null)o(U);else if(Ee.startTime<=de)o(U),Ee.sortIndex=Ee.expirationTime,i(M,Ee);else break;Ee=r(U)}}function p(de){if(Q=!1,c(de),!$)if(r(M)!==null)$=!0,oe||(oe=!0,ve());else{var Ee=r(U);Ee!==null&&b(p,Ee.startTime-de)}}function g(){return Z?!0:!(s.unstable_now()-xede||125Ye?(de.sortIndex=Re,i(U,de),r(M)===null&&de===r(U)&&(Q?(G(_e),_e=-1):Q=!0,b(p,Re-Ye))):(de.sortIndex=le,i(M,de),$||Y||($=!0,oe||(oe=!0,ve()))),de},s.unstable_shouldYield=g,s.unstable_wrapCallback=function(de){var Ee=H;return function(){var Re=H;H=Ee;try{return de.apply(this,arguments)}finally{H=Re}}},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()}(Ng)),Ng}var M_;function Dw(){return M_||(M_=1,Ig.exports=Aw()),Ig.exports}var Pg={exports:{}},Mi={};/** * @license React * react-dom.development.js * @@ -59,7 +59,7 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var N_;function Ow(){return N_||(N_=1,function(){function s(t,n){for(t=t.memoizedState;t!==null&&0=n.length)return l;var d=n[a],f=wi(t)?t.slice():Qe({},t);return f[d]=e(t[d],n,a+1,l),f}function i(t,n,a){if(n.length!==a.length)console.warn("copyWithRename() expects paths of the same length");else{for(var l=0;lra?console.error("Unexpected pop."):(n!==cb[ra]&&console.error("Unexpected Fiber popped."),t.current=ub[ra],ub[ra]=null,cb[ra]=null,ra--)}function xe(t,n,a){ra++,ub[ra]=t.current,cb[ra]=a,t.current=n}function ve(t){return t===null&&console.error("Expected host context to exist. This error is likely caused by a bug in React. Please file an issue."),t}function Ne(t,n){xe(so,n,t),xe(jh,t,t),xe(no,null,t);var a=n.nodeType;switch(a){case 9:case 11:a=a===9?"#document":"#fragment",n=(n=n.documentElement)&&(n=n.namespaceURI)?_C(n):ya;break;default:if(a=n.tagName,n=n.namespaceURI)n=_C(n),n=TC(n,a);else switch(a){case"svg":n=$c;break;case"math":n=Dg;break;default:n=ya}}a=a.toLowerCase(),a=hn(null,a),a={context:n,ancestorInfo:a},fe(no,t),xe(no,a,t)}function at(t){fe(no,t),fe(jh,t),fe(so,t)}function de(){return ve(no.current)}function Ee(t){t.memoizedState!==null&&xe(jm,t,t);var n=ve(no.current),a=t.type,l=TC(n.context,a);a=hn(n.ancestorInfo,a),l={context:l,ancestorInfo:a},n!==l&&(xe(jh,t,t),xe(no,l,t))}function Re(t){jh.current===t&&(fe(no,t),fe(jh,t)),jm.current===t&&(fe(jm,t),Df._currentValue=Bl)}function Ye(t){return typeof Symbol=="function"&&Symbol.toStringTag&&t[Symbol.toStringTag]||t.constructor.name||"Object"}function le(t){try{return Me(t),!1}catch{return!0}}function Me(t){return""+t}function Ae(t,n){if(le(t))return console.error("The provided `%s` attribute is an unsupported type %s. This value must be coerced to a string before using it here.",n,Ye(t)),Me(t)}function rt(t,n){if(le(t))return console.error("The provided `%s` CSS property is an unsupported type %s. This value must be coerced to a string before using it here.",n,Ye(t)),Me(t)}function xt(t){if(le(t))return console.error("Form field values (value, checked, defaultValue, or defaultChecked props) must be strings, not %s. This value must be coerced to a string before using it here.",Ye(t)),Me(t)}function Ut(t){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")return!1;var n=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(n.isDisabled)return!0;if(!n.supportsFiber)return console.error("The installed version of React DevTools is too old and will not work with the current version of React. Please update React DevTools. https://react.dev/link/react-devtools"),!0;try{hc=n.inject(t),Fi=n}catch(a){console.error("React instrumentation encountered an error: %s.",a)}return!!n.checkDCE}function nt(t){if(typeof nI=="function"&&sI(t),Fi&&typeof Fi.setStrictMode=="function")try{Fi.setStrictMode(hc,t)}catch(n){gr||(gr=!0,console.error("React instrumentation encountered an error: %s",n))}}function Lr(t){Te=t}function Rt(){Te!==null&&typeof Te.markCommitStopped=="function"&&Te.markCommitStopped()}function si(t){Te!==null&&typeof Te.markComponentRenderStarted=="function"&&Te.markComponentRenderStarted(t)}function cn(){Te!==null&&typeof Te.markComponentRenderStopped=="function"&&Te.markComponentRenderStopped()}function Ir(t){Te!==null&&typeof Te.markRenderStarted=="function"&&Te.markRenderStarted(t)}function Ra(){Te!==null&&typeof Te.markRenderStopped=="function"&&Te.markRenderStopped()}function qs(t,n){Te!==null&&typeof Te.markStateUpdateScheduled=="function"&&Te.markStateUpdateScheduled(t,n)}function Cu(t){return t>>>=0,t===0?32:31-(rI(t)/aI|0)|0}function Uo(t){if(t&1)return"SyncHydrationLane";if(t&2)return"Sync";if(t&4)return"InputContinuousHydration";if(t&8)return"InputContinuous";if(t&16)return"DefaultHydration";if(t&32)return"Default";if(t&128)return"TransitionHydration";if(t&4194048)return"Transition";if(t&62914560)return"Retry";if(t&67108864)return"SelectiveHydration";if(t&134217728)return"IdleHydration";if(t&268435456)return"Idle";if(t&536870912)return"Offscreen";if(t&1073741824)return"Deferred"}function zt(t){var n=t&42;if(n!==0)return n;switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194048;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return console.error("Should have found matching lanes. This is a bug in React."),t}}function ps(t,n,a){var l=t.pendingLanes;if(l===0)return 0;var d=0,f=t.suspendedLanes,T=t.pingedLanes;t=t.warmLanes;var C=l&134217727;return C!==0?(l=C&~f,l!==0?d=zt(l):(T&=C,T!==0?d=zt(T):a||(a=C&~t,a!==0&&(d=zt(a))))):(C=l&~f,C!==0?d=zt(C):T!==0?d=zt(T):a||(a=l&~t,a!==0&&(d=zt(a)))),d===0?0:n!==0&&n!==d&&!(n&f)&&(f=d&-d,a=n&-n,f>=a||f===32&&(a&4194048)!==0)?n:d}function _i(t,n){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&n)===0}function Bo(t,n){switch(t){case 1:case 2:case 4:case 8:case 64:return n+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return console.error("Should have found matching lanes. This is a bug in React."),-1}}function Ce(){var t=qm;return qm<<=1,!(qm&4194048)&&(qm=256),t}function Nr(){var t=Vm;return Vm<<=1,!(Vm&62914560)&&(Vm=4194304),t}function Vs(t){for(var n=[],a=0;31>a;a++)n.push(t);return n}function $s(t,n){t.pendingLanes|=n,n!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function Ma(t,n,a,l,d,f){var T=t.pendingLanes;t.pendingLanes=a,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=a,t.entangledLanes&=a,t.errorRecoveryDisabledLanes&=a,t.shellSuspendCounter=0;var C=t.entanglements,O=t.expirationTimes,L=t.hiddenUpdates;for(a=T&~a;0Vh&&console.error("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}function dn(t){if(yb===void 0)try{throw Error()}catch(a){var n=a.stack.trim().match(/\n( *(at )?)/);yb=n&&n[1]||"",sA=-1=n.length)return l;var d=n[a],f=wi(t)?t.slice():Qe({},t);return f[d]=e(t[d],n,a+1,l),f}function i(t,n,a){if(n.length!==a.length)console.warn("copyWithRename() expects paths of the same length");else{for(var l=0;lra?console.error("Unexpected pop."):(n!==cb[ra]&&console.error("Unexpected Fiber popped."),t.current=ub[ra],ub[ra]=null,cb[ra]=null,ra--)}function xe(t,n,a){ra++,ub[ra]=t.current,cb[ra]=a,t.current=n}function ve(t){return t===null&&console.error("Expected host context to exist. This error is likely caused by a bug in React. Please file an issue."),t}function Ne(t,n){xe(so,n,t),xe(jh,t,t),xe(no,null,t);var a=n.nodeType;switch(a){case 9:case 11:a=a===9?"#document":"#fragment",n=(n=n.documentElement)&&(n=n.namespaceURI)?_C(n):ya;break;default:if(a=n.tagName,n=n.namespaceURI)n=_C(n),n=TC(n,a);else switch(a){case"svg":n=$c;break;case"math":n=Dg;break;default:n=ya}}a=a.toLowerCase(),a=hn(null,a),a={context:n,ancestorInfo:a},fe(no,t),xe(no,a,t)}function at(t){fe(no,t),fe(jh,t),fe(so,t)}function de(){return ve(no.current)}function Ee(t){t.memoizedState!==null&&xe(jm,t,t);var n=ve(no.current),a=t.type,l=TC(n.context,a);a=hn(n.ancestorInfo,a),l={context:l,ancestorInfo:a},n!==l&&(xe(jh,t,t),xe(no,l,t))}function Re(t){jh.current===t&&(fe(no,t),fe(jh,t)),jm.current===t&&(fe(jm,t),Df._currentValue=Bl)}function Ye(t){return typeof Symbol=="function"&&Symbol.toStringTag&&t[Symbol.toStringTag]||t.constructor.name||"Object"}function le(t){try{return Me(t),!1}catch{return!0}}function Me(t){return""+t}function Ae(t,n){if(le(t))return console.error("The provided `%s` attribute is an unsupported type %s. This value must be coerced to a string before using it here.",n,Ye(t)),Me(t)}function rt(t,n){if(le(t))return console.error("The provided `%s` CSS property is an unsupported type %s. This value must be coerced to a string before using it here.",n,Ye(t)),Me(t)}function xt(t){if(le(t))return console.error("Form field values (value, checked, defaultValue, or defaultChecked props) must be strings, not %s. This value must be coerced to a string before using it here.",Ye(t)),Me(t)}function Ut(t){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")return!1;var n=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(n.isDisabled)return!0;if(!n.supportsFiber)return console.error("The installed version of React DevTools is too old and will not work with the current version of React. Please update React DevTools. https://react.dev/link/react-devtools"),!0;try{hc=n.inject(t),Fi=n}catch(a){console.error("React instrumentation encountered an error: %s.",a)}return!!n.checkDCE}function nt(t){if(typeof nI=="function"&&sI(t),Fi&&typeof Fi.setStrictMode=="function")try{Fi.setStrictMode(hc,t)}catch(n){gr||(gr=!0,console.error("React instrumentation encountered an error: %s",n))}}function Lr(t){Te=t}function Rt(){Te!==null&&typeof Te.markCommitStopped=="function"&&Te.markCommitStopped()}function si(t){Te!==null&&typeof Te.markComponentRenderStarted=="function"&&Te.markComponentRenderStarted(t)}function cn(){Te!==null&&typeof Te.markComponentRenderStopped=="function"&&Te.markComponentRenderStopped()}function Ir(t){Te!==null&&typeof Te.markRenderStarted=="function"&&Te.markRenderStarted(t)}function Ra(){Te!==null&&typeof Te.markRenderStopped=="function"&&Te.markRenderStopped()}function qs(t,n){Te!==null&&typeof Te.markStateUpdateScheduled=="function"&&Te.markStateUpdateScheduled(t,n)}function Cu(t){return t>>>=0,t===0?32:31-(rI(t)/aI|0)|0}function Uo(t){if(t&1)return"SyncHydrationLane";if(t&2)return"Sync";if(t&4)return"InputContinuousHydration";if(t&8)return"InputContinuous";if(t&16)return"DefaultHydration";if(t&32)return"Default";if(t&128)return"TransitionHydration";if(t&4194048)return"Transition";if(t&62914560)return"Retry";if(t&67108864)return"SelectiveHydration";if(t&134217728)return"IdleHydration";if(t&268435456)return"Idle";if(t&536870912)return"Offscreen";if(t&1073741824)return"Deferred"}function zt(t){var n=t&42;if(n!==0)return n;switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194048;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return console.error("Should have found matching lanes. This is a bug in React."),t}}function ps(t,n,a){var l=t.pendingLanes;if(l===0)return 0;var d=0,f=t.suspendedLanes,T=t.pingedLanes;t=t.warmLanes;var C=l&134217727;return C!==0?(l=C&~f,l!==0?d=zt(l):(T&=C,T!==0?d=zt(T):a||(a=C&~t,a!==0&&(d=zt(a))))):(C=l&~f,C!==0?d=zt(C):T!==0?d=zt(T):a||(a=l&~t,a!==0&&(d=zt(a)))),d===0?0:n!==0&&n!==d&&!(n&f)&&(f=d&-d,a=n&-n,f>=a||f===32&&(a&4194048)!==0)?n:d}function _i(t,n){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&n)===0}function Bo(t,n){switch(t){case 1:case 2:case 4:case 8:case 64:return n+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return console.error("Should have found matching lanes. This is a bug in React."),-1}}function Ce(){var t=qm;return qm<<=1,!(qm&4194048)&&(qm=256),t}function Nr(){var t=Vm;return Vm<<=1,!(Vm&62914560)&&(Vm=4194304),t}function Vs(t){for(var n=[],a=0;31>a;a++)n.push(t);return n}function $s(t,n){t.pendingLanes|=n,n!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function Ma(t,n,a,l,d,f){var T=t.pendingLanes;t.pendingLanes=a,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=a,t.entangledLanes&=a,t.errorRecoveryDisabledLanes&=a,t.shellSuspendCounter=0;var C=t.entanglements,O=t.expirationTimes,L=t.hiddenUpdates;for(a=T&~a;0Vh&&console.error("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}function dn(t){if(yb===void 0)try{throw Error()}catch(a){var n=a.stack.trim().match(/\n( *(at )?)/);yb=n&&n[1]||"",sA=-1)":-1 */var Zw=function(e){var i={};return e&&e.trim().split(` -`).forEach(function(r){var o=r.indexOf(":"),u=r.slice(0,o).trim().toLowerCase(),c=r.slice(o+1).trim();typeof i[u]>"u"?i[u]=c:Array.isArray(i[u])?i[u].push(c):i[u]=[i[u],c]}),i};Ug.exports=Gt,Ug.exports.default=Gt,Gt.XMLHttpRequest=F_.XMLHttpRequest||ik,Gt.XDomainRequest="withCredentials"in new Gt.XMLHttpRequest?Gt.XMLHttpRequest:F_.XDomainRequest,Jw(["get","put","post","patch","head","delete"],function(s){Gt[s==="delete"?"del":s]=function(e,i,r){return i=z_(e,i,r),i.method=s.toUpperCase(),Bg(i)}});function Jw(s,e){for(var i=0;i"u")throw new Error("callback argument missing");if(s.requestType&&Gt.requestInterceptorsStorage.getIsEnabled()){var e={uri:s.uri||s.url,headers:s.headers||{},body:s.body,metadata:s.metadata||{},retry:s.retry,timeout:s.timeout},i=Gt.requestInterceptorsStorage.execute(s.requestType,e);s.uri=i.uri,s.headers=i.headers,s.body=i.body,s.metadata=i.metadata,s.retry=i.retry,s.timeout=i.timeout}var r=!1,o=function(Z,W,G){r||(r=!0,s.callback(Z,W,G))};function u(){b.readyState===4&&!Gt.responseInterceptorsStorage.getIsEnabled()&&setTimeout(g,0)}function c(){var Q=void 0;if(b.response?Q=b.response:Q=b.responseText||tk(b),H)try{Q=JSON.parse(Q)}catch{}return Q}function p(Q){if(clearTimeout(Y),clearTimeout(s.retryTimeout),Q instanceof Error||(Q=new Error(""+(Q||"Unknown XMLHttpRequest Error"))),Q.statusCode=0,!E&&Gt.retryManager.getIsEnabled()&&s.retry&&s.retry.shouldRetry()){s.retryTimeout=setTimeout(function(){s.retry.moveToNextAttempt(),s.xhr=b,Bg(s)},s.retry.getCurrentFuzzedDelay());return}if(s.requestType&&Gt.responseInterceptorsStorage.getIsEnabled()){var Z={headers:V.headers||{},body:V.body,responseUrl:b.responseURL,responseType:b.responseType},W=Gt.responseInterceptorsStorage.execute(s.requestType,Z);V.body=W.body,V.headers=W.headers}return o(Q,V)}function g(){if(!E){var Q;clearTimeout(Y),clearTimeout(s.retryTimeout),s.useXDR&&b.status===void 0?Q=200:Q=b.status===1223?204:b.status;var Z=V,W=null;if(Q!==0?(Z={body:c(),statusCode:Q,method:M,headers:{},url:A,rawRequest:b},b.getAllResponseHeaders&&(Z.headers=Zw(b.getAllResponseHeaders()))):W=new Error("Internal XMLHttpRequest Error"),s.requestType&&Gt.responseInterceptorsStorage.getIsEnabled()){var G={headers:Z.headers||{},body:Z.body,responseUrl:b.responseURL,responseType:b.responseType},ee=Gt.responseInterceptorsStorage.execute(s.requestType,G);Z.body=ee.body,Z.headers=ee.headers}return o(W,Z,Z.body)}}var b=s.xhr||null;b||(s.cors||s.useXDR?b=new Gt.XDomainRequest:b=new Gt.XMLHttpRequest);var S,E,A=b.url=s.uri||s.url,M=b.method=s.method||"GET",U=s.body||s.data,D=b.headers=s.headers||{},z=!!s.sync,H=!1,Y,V={body:void 0,headers:{},statusCode:0,method:M,url:A,rawRequest:b};if("json"in s&&s.json!==!1&&(H=!0,D.accept||D.Accept||(D.Accept="application/json"),M!=="GET"&&M!=="HEAD"&&(D["content-type"]||D["Content-Type"]||(D["Content-Type"]="application/json"),U=JSON.stringify(s.json===!0?U:s.json))),b.onreadystatechange=u,b.onload=g,b.onerror=p,b.onprogress=function(){},b.onabort=function(){E=!0,clearTimeout(s.retryTimeout)},b.ontimeout=p,b.open(M,A,!z,s.username,s.password),z||(b.withCredentials=!!s.withCredentials),!z&&s.timeout>0&&(Y=setTimeout(function(){if(!E){E=!0,b.abort("timeout");var Q=new Error("XMLHttpRequest timeout");Q.code="ETIMEDOUT",p(Q)}},s.timeout)),b.setRequestHeader)for(S in D)D.hasOwnProperty(S)&&b.setRequestHeader(S,D[S]);else if(s.headers&&!ek(s.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in s&&(b.responseType=s.responseType),"beforeSend"in s&&typeof s.beforeSend=="function"&&s.beforeSend(b),b.send(U||null),b}function tk(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 ik(){}var nk=Ug.exports;const j_=Xc(nk);var q_={exports:{}},V_=U_,Fg=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 Tn(s,e){this.name="ParsingError",this.code=s.code,this.message=e||s.message}Tn.prototype=Fg(Error.prototype),Tn.prototype.constructor=Tn,Tn.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}};function Hg(s){function e(r,o,u,c){return(r|0)*3600+(o|0)*60+(u|0)+(c|0)/1e3}var i=s.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);return i?i[3]?e(i[1],i[2],i[3].replace(":",""),i[4]):i[1]>59?e(i[1],i[2],0,i[4]):e(0,i[1],i[2],i[4]):null}function Jc(){this.values=Fg(null)}Jc.prototype={set:function(s,e){!this.get(s)&&e!==""&&(this.values[s]=e)},get:function(s,e,i){return i?this.has(s)?this.values[s]:e[i]:this.has(s)?this.values[s]:e},has:function(s){return s in this.values},alt:function(s,e,i){for(var r=0;r=0&&e<=100)?(this.set(s,e),!0):!1}};function ed(s,e,i,r){var o=r?s.split(r):[s];for(var u in o)if(typeof o[u]=="string"){var c=o[u].split(i);if(c.length===2){var p=c[0].trim(),g=c[1].trim();e(p,g)}}}function sk(s,e,i){var r=s;function o(){var p=Hg(s);if(p===null)throw new Tn(Tn.Errors.BadTimeStamp,"Malformed timestamp: "+r);return s=s.replace(/^[^\sa-zA-Z-]+/,""),p}function u(p,g){var b=new Jc;ed(p,function(S,E){switch(S){case"region":for(var A=i.length-1;A>=0;A--)if(i[A].id===E){b.set(S,i[A].region);break}break;case"vertical":b.alt(S,E,["rl","lr"]);break;case"line":var M=E.split(","),U=M[0];b.integer(S,U),b.percent(S,U)&&b.set("snapToLines",!1),b.alt(S,U,["auto"]),M.length===2&&b.alt("lineAlign",M[1],["start","center","end"]);break;case"position":M=E.split(","),b.percent(S,M[0]),M.length===2&&b.alt("positionAlign",M[1],["start","center","end"]);break;case"size":b.percent(S,E);break;case"align":b.alt(S,E,["start","center","end","left","right"]);break}},/:/,/\s/),g.region=b.get("region",null),g.vertical=b.get("vertical","");try{g.line=b.get("line","auto")}catch{}g.lineAlign=b.get("lineAlign","start"),g.snapToLines=b.get("snapToLines",!0),g.size=b.get("size",100);try{g.align=b.get("align","center")}catch{g.align=b.get("align","middle")}try{g.position=b.get("position","auto")}catch{g.position=b.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},g.align)}g.positionAlign=b.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},g.align)}function c(){s=s.replace(/^\s+/,"")}if(c(),e.startTime=o(),c(),s.substr(0,3)!=="-->")throw new Tn(Tn.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '-->'): "+r);s=s.substr(3),c(),e.endTime=o(),c(),u(s,e)}var zg=V_.createElement&&V_.createElement("textarea"),rk={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},$_={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)"},ak={v:"title",lang:"lang"},G_={rt:"ruby"};function X_(s,e){function i(){if(!e)return null;function U(z){return e=e.substr(z.length),z}var D=e.match(/^([^<]*)(<[^>]*>?)?/);return U(D[1]?D[1]:D[2])}function r(U){return zg.innerHTML=U,U=zg.textContent,zg.textContent="",U}function o(U,D){return!G_[D.localName]||G_[D.localName]===U.localName}function u(U,D){var z=rk[U];if(!z)return null;var H=s.document.createElement(z),Y=ak[U];return Y&&D&&(H[Y]=D.trim()),H}for(var c=s.document.createElement("div"),p=c,g,b=[];(g=i())!==null;){if(g[0]==="<"){if(g[1]==="/"){b.length&&b[b.length-1]===g.substr(2).replace(">","")&&(b.pop(),p=p.parentNode);continue}var S=Hg(g.substr(1,g.length-2)),E;if(S){E=s.document.createProcessingInstruction("timestamp",S),p.appendChild(E);continue}var A=g.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!A||(E=u(A[1],A[3]),!E)||!o(p,E))continue;if(A[2]){var M=A[2].split(".");M.forEach(function(U){var D=/^bg_/.test(U),z=D?U.slice(3):U;if($_.hasOwnProperty(z)){var H=D?"background-color":"color",Y=$_[z];E.style[H]=Y}}),E.className=M.join(" ")}b.push(A[1]),p.appendChild(E),p=E;continue}p.appendChild(s.document.createTextNode(r(g)))}return c}var Y_=[[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 ok(s){for(var e=0;e=i[0]&&s<=i[1])return!0}return!1}function lk(s){var e=[],i="",r;if(!s||!s.childNodes)return"ltr";function o(p,g){for(var b=g.childNodes.length-1;b>=0;b--)p.push(g.childNodes[b])}function u(p){if(!p||!p.length)return null;var g=p.pop(),b=g.textContent||g.innerText;if(b){var S=b.match(/^.*(\n|\r)/);return S?(p.length=0,S[0]):b}if(g.tagName==="ruby")return u(p);if(g.childNodes)return o(p,g),u(p)}for(o(e,s);i=u(e);)for(var c=0;c=0&&s.line<=100))return s.line;if(!s.track||!s.track.textTrackList||!s.track.textTrackList.mediaElement)return-1;for(var e=s.track,i=e.textTrackList,r=0,o=0;os.left&&this.tops.top},ji.prototype.overlapsAny=function(s){for(var e=0;e=s.top&&this.bottom<=s.bottom&&this.left>=s.left&&this.right<=s.right},ji.prototype.overlapsOppositeAxis=function(s,e){switch(e){case"+x":return this.lefts.right;case"+y":return this.tops.bottom}},ji.prototype.intersectPercentage=function(s){var e=Math.max(0,Math.min(this.right,s.right)-Math.max(this.left,s.left)),i=Math.max(0,Math.min(this.bottom,s.bottom)-Math.max(this.top,s.top)),r=e*i;return r/(this.height*this.width)},ji.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}},ji.getSimpleBoxPosition=function(s){var e=s.div?s.div.offsetHeight:s.tagName?s.offsetHeight:0,i=s.div?s.div.offsetWidth:s.tagName?s.offsetWidth:0,r=s.div?s.div.offsetTop:s.tagName?s.offsetTop:0;s=s.div?s.div.getBoundingClientRect():s.tagName?s.getBoundingClientRect():s;var o={left:s.left,right:s.right,top:s.top||r,height:s.height||e,bottom:s.bottom||r+(s.height||e),width:s.width||i};return o};function ck(s,e,i,r){function o(z,H){for(var Y,V=new ji(z),Q=1,Z=0;ZW&&(Y=new ji(z),Q=W),z=new ji(V)}return Y||V}var u=new ji(e),c=e.cue,p=uk(c),g=[];if(c.snapToLines){var b;switch(c.vertical){case"":g=["+y","-y"],b="height";break;case"rl":g=["+x","-x"],b="width";break;case"lr":g=["-x","+x"],b="width";break}var S=u.lineHeight,E=S*Math.round(p),A=i[b]+S,M=g[0];Math.abs(E)>A&&(E=E<0?-1:1,E*=Math.ceil(A/S)*S),p<0&&(E+=c.vertical===""?i.height:i.width,g=g.reverse()),u.move(M,E)}else{var U=u.lineHeight/i.height*100;switch(c.lineAlign){case"center":p-=U/2;break;case"end":p-=U;break}switch(c.vertical){case"":e.applyStyles({top:e.formatStyle(p,"%")});break;case"rl":e.applyStyles({left:e.formatStyle(p,"%")});break;case"lr":e.applyStyles({right:e.formatStyle(p,"%")});break}g=["+y","-x","+x","-y"],u=new ji(e)}var D=o(u,g);e.move(D.toCSSCompatValues(i))}function Fl(){}Fl.StringDecoder=function(){return{decode:function(s){if(!s)return"";if(typeof s!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(s))}}},Fl.convertCueToDOMTree=function(s,e){return!s||!e?null:X_(s,e)};var dk=.05,hk="sans-serif",fk="1.5%";Fl.processCues=function(s,e,i){if(!s||!e||!i)return null;for(;i.firstChild;)i.removeChild(i.firstChild);var r=s.document.createElement("div");r.style.position="absolute",r.style.left="0",r.style.right="0",r.style.top="0",r.style.bottom="0",r.style.margin=fk,i.appendChild(r);function o(S){for(var E=0;E"u"?i[u]=c:Array.isArray(i[u])?i[u].push(c):i[u]=[i[u],c]}),i};Ug.exports=Gt,Ug.exports.default=Gt,Gt.XMLHttpRequest=F_.XMLHttpRequest||ik,Gt.XDomainRequest="withCredentials"in new Gt.XMLHttpRequest?Gt.XMLHttpRequest:F_.XDomainRequest,Jw(["get","put","post","patch","head","delete"],function(s){Gt[s==="delete"?"del":s]=function(e,i,r){return i=z_(e,i,r),i.method=s.toUpperCase(),Bg(i)}});function Jw(s,e){for(var i=0;i"u")throw new Error("callback argument missing");if(s.requestType&&Gt.requestInterceptorsStorage.getIsEnabled()){var e={uri:s.uri||s.url,headers:s.headers||{},body:s.body,metadata:s.metadata||{},retry:s.retry,timeout:s.timeout},i=Gt.requestInterceptorsStorage.execute(s.requestType,e);s.uri=i.uri,s.headers=i.headers,s.body=i.body,s.metadata=i.metadata,s.retry=i.retry,s.timeout=i.timeout}var r=!1,o=function(Z,W,G){r||(r=!0,s.callback(Z,W,G))};function u(){b.readyState===4&&!Gt.responseInterceptorsStorage.getIsEnabled()&&setTimeout(g,0)}function c(){var Q=void 0;if(b.response?Q=b.response:Q=b.responseText||tk(b),H)try{Q=JSON.parse(Q)}catch{}return Q}function p(Q){if(clearTimeout(Y),clearTimeout(s.retryTimeout),Q instanceof Error||(Q=new Error(""+(Q||"Unknown XMLHttpRequest Error"))),Q.statusCode=0,!E&&Gt.retryManager.getIsEnabled()&&s.retry&&s.retry.shouldRetry()){s.retryTimeout=setTimeout(function(){s.retry.moveToNextAttempt(),s.xhr=b,Bg(s)},s.retry.getCurrentFuzzedDelay());return}if(s.requestType&&Gt.responseInterceptorsStorage.getIsEnabled()){var Z={headers:$.headers||{},body:$.body,responseUrl:b.responseURL,responseType:b.responseType},W=Gt.responseInterceptorsStorage.execute(s.requestType,Z);$.body=W.body,$.headers=W.headers}return o(Q,$)}function g(){if(!E){var Q;clearTimeout(Y),clearTimeout(s.retryTimeout),s.useXDR&&b.status===void 0?Q=200:Q=b.status===1223?204:b.status;var Z=$,W=null;if(Q!==0?(Z={body:c(),statusCode:Q,method:M,headers:{},url:A,rawRequest:b},b.getAllResponseHeaders&&(Z.headers=Zw(b.getAllResponseHeaders()))):W=new Error("Internal XMLHttpRequest Error"),s.requestType&&Gt.responseInterceptorsStorage.getIsEnabled()){var G={headers:Z.headers||{},body:Z.body,responseUrl:b.responseURL,responseType:b.responseType},ee=Gt.responseInterceptorsStorage.execute(s.requestType,G);Z.body=ee.body,Z.headers=ee.headers}return o(W,Z,Z.body)}}var b=s.xhr||null;b||(s.cors||s.useXDR?b=new Gt.XDomainRequest:b=new Gt.XMLHttpRequest);var S,E,A=b.url=s.uri||s.url,M=b.method=s.method||"GET",U=s.body||s.data,D=b.headers=s.headers||{},z=!!s.sync,H=!1,Y,$={body:void 0,headers:{},statusCode:0,method:M,url:A,rawRequest:b};if("json"in s&&s.json!==!1&&(H=!0,D.accept||D.Accept||(D.Accept="application/json"),M!=="GET"&&M!=="HEAD"&&(D["content-type"]||D["Content-Type"]||(D["Content-Type"]="application/json"),U=JSON.stringify(s.json===!0?U:s.json))),b.onreadystatechange=u,b.onload=g,b.onerror=p,b.onprogress=function(){},b.onabort=function(){E=!0,clearTimeout(s.retryTimeout)},b.ontimeout=p,b.open(M,A,!z,s.username,s.password),z||(b.withCredentials=!!s.withCredentials),!z&&s.timeout>0&&(Y=setTimeout(function(){if(!E){E=!0,b.abort("timeout");var Q=new Error("XMLHttpRequest timeout");Q.code="ETIMEDOUT",p(Q)}},s.timeout)),b.setRequestHeader)for(S in D)D.hasOwnProperty(S)&&b.setRequestHeader(S,D[S]);else if(s.headers&&!ek(s.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in s&&(b.responseType=s.responseType),"beforeSend"in s&&typeof s.beforeSend=="function"&&s.beforeSend(b),b.send(U||null),b}function tk(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 ik(){}var nk=Ug.exports;const j_=Xc(nk);var q_={exports:{}},V_=U_,Fg=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 Tn(s,e){this.name="ParsingError",this.code=s.code,this.message=e||s.message}Tn.prototype=Fg(Error.prototype),Tn.prototype.constructor=Tn,Tn.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}};function Hg(s){function e(r,o,u,c){return(r|0)*3600+(o|0)*60+(u|0)+(c|0)/1e3}var i=s.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);return i?i[3]?e(i[1],i[2],i[3].replace(":",""),i[4]):i[1]>59?e(i[1],i[2],0,i[4]):e(0,i[1],i[2],i[4]):null}function Jc(){this.values=Fg(null)}Jc.prototype={set:function(s,e){!this.get(s)&&e!==""&&(this.values[s]=e)},get:function(s,e,i){return i?this.has(s)?this.values[s]:e[i]:this.has(s)?this.values[s]:e},has:function(s){return s in this.values},alt:function(s,e,i){for(var r=0;r=0&&e<=100)?(this.set(s,e),!0):!1}};function ed(s,e,i,r){var o=r?s.split(r):[s];for(var u in o)if(typeof o[u]=="string"){var c=o[u].split(i);if(c.length===2){var p=c[0].trim(),g=c[1].trim();e(p,g)}}}function sk(s,e,i){var r=s;function o(){var p=Hg(s);if(p===null)throw new Tn(Tn.Errors.BadTimeStamp,"Malformed timestamp: "+r);return s=s.replace(/^[^\sa-zA-Z-]+/,""),p}function u(p,g){var b=new Jc;ed(p,function(S,E){switch(S){case"region":for(var A=i.length-1;A>=0;A--)if(i[A].id===E){b.set(S,i[A].region);break}break;case"vertical":b.alt(S,E,["rl","lr"]);break;case"line":var M=E.split(","),U=M[0];b.integer(S,U),b.percent(S,U)&&b.set("snapToLines",!1),b.alt(S,U,["auto"]),M.length===2&&b.alt("lineAlign",M[1],["start","center","end"]);break;case"position":M=E.split(","),b.percent(S,M[0]),M.length===2&&b.alt("positionAlign",M[1],["start","center","end"]);break;case"size":b.percent(S,E);break;case"align":b.alt(S,E,["start","center","end","left","right"]);break}},/:/,/\s/),g.region=b.get("region",null),g.vertical=b.get("vertical","");try{g.line=b.get("line","auto")}catch{}g.lineAlign=b.get("lineAlign","start"),g.snapToLines=b.get("snapToLines",!0),g.size=b.get("size",100);try{g.align=b.get("align","center")}catch{g.align=b.get("align","middle")}try{g.position=b.get("position","auto")}catch{g.position=b.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},g.align)}g.positionAlign=b.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},g.align)}function c(){s=s.replace(/^\s+/,"")}if(c(),e.startTime=o(),c(),s.substr(0,3)!=="-->")throw new Tn(Tn.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '-->'): "+r);s=s.substr(3),c(),e.endTime=o(),c(),u(s,e)}var zg=V_.createElement&&V_.createElement("textarea"),rk={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},$_={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)"},ak={v:"title",lang:"lang"},G_={rt:"ruby"};function X_(s,e){function i(){if(!e)return null;function U(z){return e=e.substr(z.length),z}var D=e.match(/^([^<]*)(<[^>]*>?)?/);return U(D[1]?D[1]:D[2])}function r(U){return zg.innerHTML=U,U=zg.textContent,zg.textContent="",U}function o(U,D){return!G_[D.localName]||G_[D.localName]===U.localName}function u(U,D){var z=rk[U];if(!z)return null;var H=s.document.createElement(z),Y=ak[U];return Y&&D&&(H[Y]=D.trim()),H}for(var c=s.document.createElement("div"),p=c,g,b=[];(g=i())!==null;){if(g[0]==="<"){if(g[1]==="/"){b.length&&b[b.length-1]===g.substr(2).replace(">","")&&(b.pop(),p=p.parentNode);continue}var S=Hg(g.substr(1,g.length-2)),E;if(S){E=s.document.createProcessingInstruction("timestamp",S),p.appendChild(E);continue}var A=g.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!A||(E=u(A[1],A[3]),!E)||!o(p,E))continue;if(A[2]){var M=A[2].split(".");M.forEach(function(U){var D=/^bg_/.test(U),z=D?U.slice(3):U;if($_.hasOwnProperty(z)){var H=D?"background-color":"color",Y=$_[z];E.style[H]=Y}}),E.className=M.join(" ")}b.push(A[1]),p.appendChild(E),p=E;continue}p.appendChild(s.document.createTextNode(r(g)))}return c}var Y_=[[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 ok(s){for(var e=0;e=i[0]&&s<=i[1])return!0}return!1}function lk(s){var e=[],i="",r;if(!s||!s.childNodes)return"ltr";function o(p,g){for(var b=g.childNodes.length-1;b>=0;b--)p.push(g.childNodes[b])}function u(p){if(!p||!p.length)return null;var g=p.pop(),b=g.textContent||g.innerText;if(b){var S=b.match(/^.*(\n|\r)/);return S?(p.length=0,S[0]):b}if(g.tagName==="ruby")return u(p);if(g.childNodes)return o(p,g),u(p)}for(o(e,s);i=u(e);)for(var c=0;c=0&&s.line<=100))return s.line;if(!s.track||!s.track.textTrackList||!s.track.textTrackList.mediaElement)return-1;for(var e=s.track,i=e.textTrackList,r=0,o=0;os.left&&this.tops.top},ji.prototype.overlapsAny=function(s){for(var e=0;e=s.top&&this.bottom<=s.bottom&&this.left>=s.left&&this.right<=s.right},ji.prototype.overlapsOppositeAxis=function(s,e){switch(e){case"+x":return this.lefts.right;case"+y":return this.tops.bottom}},ji.prototype.intersectPercentage=function(s){var e=Math.max(0,Math.min(this.right,s.right)-Math.max(this.left,s.left)),i=Math.max(0,Math.min(this.bottom,s.bottom)-Math.max(this.top,s.top)),r=e*i;return r/(this.height*this.width)},ji.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}},ji.getSimpleBoxPosition=function(s){var e=s.div?s.div.offsetHeight:s.tagName?s.offsetHeight:0,i=s.div?s.div.offsetWidth:s.tagName?s.offsetWidth:0,r=s.div?s.div.offsetTop:s.tagName?s.offsetTop:0;s=s.div?s.div.getBoundingClientRect():s.tagName?s.getBoundingClientRect():s;var o={left:s.left,right:s.right,top:s.top||r,height:s.height||e,bottom:s.bottom||r+(s.height||e),width:s.width||i};return o};function ck(s,e,i,r){function o(z,H){for(var Y,$=new ji(z),Q=1,Z=0;ZW&&(Y=new ji(z),Q=W),z=new ji($)}return Y||$}var u=new ji(e),c=e.cue,p=uk(c),g=[];if(c.snapToLines){var b;switch(c.vertical){case"":g=["+y","-y"],b="height";break;case"rl":g=["+x","-x"],b="width";break;case"lr":g=["-x","+x"],b="width";break}var S=u.lineHeight,E=S*Math.round(p),A=i[b]+S,M=g[0];Math.abs(E)>A&&(E=E<0?-1:1,E*=Math.ceil(A/S)*S),p<0&&(E+=c.vertical===""?i.height:i.width,g=g.reverse()),u.move(M,E)}else{var U=u.lineHeight/i.height*100;switch(c.lineAlign){case"center":p-=U/2;break;case"end":p-=U;break}switch(c.vertical){case"":e.applyStyles({top:e.formatStyle(p,"%")});break;case"rl":e.applyStyles({left:e.formatStyle(p,"%")});break;case"lr":e.applyStyles({right:e.formatStyle(p,"%")});break}g=["+y","-x","+x","-y"],u=new ji(e)}var D=o(u,g);e.move(D.toCSSCompatValues(i))}function Fl(){}Fl.StringDecoder=function(){return{decode:function(s){if(!s)return"";if(typeof s!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(s))}}},Fl.convertCueToDOMTree=function(s,e){return!s||!e?null:X_(s,e)};var dk=.05,hk="sans-serif",fk="1.5%";Fl.processCues=function(s,e,i){if(!s||!e||!i)return null;for(;i.firstChild;)i.removeChild(i.firstChild);var r=s.document.createElement("div");r.style.position="absolute",r.style.left="0",r.style.right="0",r.style.top="0",r.style.bottom="0",r.style.margin=fk,i.appendChild(r);function o(S){for(var E=0;E")===-1){e.cue.id=c;continue}case"CUE":try{sk(c,e.cue,e.regionList)}catch(S){e.reportOrThrowError(S),e.cue=null,e.state="BADCUE";continue}e.state="CUETEXT";continue;case"CUETEXT":var b=c.indexOf("-->")!==-1;if(!c||b&&(g=!0)){e.oncue&&e.oncue(e.cue),e.cue=null,e.state="ID";continue}e.cue.text&&(e.cue.text+=` `),e.cue.text+=c.replace(/\u2028/g,` @@ -285,12 +285,12 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho `,s.parse()),s.state==="INITIAL")throw new Tn(Tn.Errors.BadSignature)}catch(e){s.reportOrThrowError(e)}return s.onflush&&s.onflush(),this}};var pk=Fl,mk="auto",gk={"":1,lr:1,rl:1},yk={start:1,center:1,end:1,left:1,right:1,auto:1,"line-left":1,"line-right":1};function vk(s){if(typeof s!="string")return!1;var e=gk[s.toLowerCase()];return e?s.toLowerCase():!1}function jg(s){if(typeof s!="string")return!1;var e=yk[s.toLowerCase()];return e?s.toLowerCase():!1}function W_(s,e,i){this.hasBeenReset=!1;var r="",o=!1,u=s,c=e,p=i,g=null,b="",S=!0,E="auto",A="start",M="auto",U="auto",D=100,z="center";Object.defineProperties(this,{id:{enumerable:!0,get:function(){return r},set:function(H){r=""+H}},pauseOnExit:{enumerable:!0,get:function(){return o},set:function(H){o=!!H}},startTime:{enumerable:!0,get:function(){return u},set:function(H){if(typeof H!="number")throw new TypeError("Start time must be set to a number.");u=H,this.hasBeenReset=!0}},endTime:{enumerable:!0,get:function(){return c},set:function(H){if(typeof H!="number")throw new TypeError("End time must be set to a number.");c=H,this.hasBeenReset=!0}},text:{enumerable:!0,get:function(){return p},set:function(H){p=""+H,this.hasBeenReset=!0}},region:{enumerable:!0,get:function(){return g},set:function(H){g=H,this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return b},set:function(H){var Y=vk(H);if(Y===!1)throw new SyntaxError("Vertical: an invalid or illegal direction string was specified.");b=Y,this.hasBeenReset=!0}},snapToLines:{enumerable:!0,get:function(){return S},set:function(H){S=!!H,this.hasBeenReset=!0}},line:{enumerable:!0,get:function(){return E},set:function(H){if(typeof H!="number"&&H!==mk)throw new SyntaxError("Line: an invalid number or illegal string was specified.");E=H,this.hasBeenReset=!0}},lineAlign:{enumerable:!0,get:function(){return A},set:function(H){var Y=jg(H);Y?(A=Y,this.hasBeenReset=!0):console.warn("lineAlign: an invalid or illegal string was specified.")}},position:{enumerable:!0,get:function(){return M},set:function(H){if(H<0||H>100)throw new Error("Position must be between 0 and 100.");M=H,this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return U},set:function(H){var Y=jg(H);Y?(U=Y,this.hasBeenReset=!0):console.warn("positionAlign: an invalid or illegal string was specified.")}},size:{enumerable:!0,get:function(){return D},set:function(H){if(H<0||H>100)throw new Error("Size must be between 0 and 100.");D=H,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return z},set:function(H){var Y=jg(H);if(!Y)throw new SyntaxError("align: an invalid or illegal alignment string was specified.");z=Y,this.hasBeenReset=!0}}}),this.displayState=void 0}W_.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)};var bk=W_,_k={"":!0,up:!0};function Tk(s){if(typeof s!="string")return!1;var e=_k[s.toLowerCase()];return e?s.toLowerCase():!1}function td(s){return typeof s=="number"&&s>=0&&s<=100}function Sk(){var s=100,e=3,i=0,r=100,o=0,u=100,c="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return s},set:function(p){if(!td(p))throw new Error("Width must be between 0 and 100.");s=p}},lines:{enumerable:!0,get:function(){return e},set:function(p){if(typeof p!="number")throw new TypeError("Lines must be set to a number.");e=p}},regionAnchorY:{enumerable:!0,get:function(){return r},set:function(p){if(!td(p))throw new Error("RegionAnchorX must be between 0 and 100.");r=p}},regionAnchorX:{enumerable:!0,get:function(){return i},set:function(p){if(!td(p))throw new Error("RegionAnchorY must be between 0 and 100.");i=p}},viewportAnchorY:{enumerable:!0,get:function(){return u},set:function(p){if(!td(p))throw new Error("ViewportAnchorY must be between 0 and 100.");u=p}},viewportAnchorX:{enumerable:!0,get:function(){return o},set:function(p){if(!td(p))throw new Error("ViewportAnchorX must be between 0 and 100.");o=p}},scroll:{enumerable:!0,get:function(){return c},set:function(p){var g=Tk(p);g===!1?console.warn("Scroll: an invalid or illegal string was specified."):c=g}}})}var xk=Sk,Er=Mf,xo=q_.exports={WebVTT:pk,VTTCue:bk,VTTRegion:xk};Er.vttjs=xo,Er.WebVTT=xo.WebVTT;var Ek=xo.VTTCue,Ck=xo.VTTRegion,Ak=Er.VTTCue,Dk=Er.VTTRegion;xo.shim=function(){Er.VTTCue=Ek,Er.VTTRegion=Ck},xo.restore=function(){Er.VTTCue=Ak,Er.VTTRegion=Dk},Er.VTTCue||xo.shim();var wk=q_.exports;const Q_=Xc(wk);var K_="https://example.com",Nf=function(e,i){if(/^[a-z]+:/i.test(i))return i;/^data:/.test(e)&&(e=P.location&&P.location.href||"");var r=/^\/\//.test(e),o=!P.location&&!/\/\//i.test(e);e=new P.URL(e,P.location||K_);var u=new URL(i,e);return o?u.href.slice(K_.length):r?u.href.slice(u.protocol.length):u.href},qg=function(){function s(){this.listeners={}}var e=s.prototype;return e.on=function(r,o){this.listeners[r]||(this.listeners[r]=[]),this.listeners[r].push(o)},e.off=function(r,o){if(!this.listeners[r])return!1;var u=this.listeners[r].indexOf(o);return this.listeners[r]=this.listeners[r].slice(0),this.listeners[r].splice(u,1),u>-1},e.trigger=function(r){var o=this.listeners[r];if(o)if(arguments.length===2)for(var u=o.length,c=0;c-1;i=this.buffer.indexOf(` -`))this.trigger("data",this.buffer.substring(0,i)),this.buffer=this.buffer.substring(i+1)}}const Rk=String.fromCharCode(9),Vg=function(s){const e=/([0-9.]*)?@?([0-9.]*)?/.exec(s||""),i={};return e[1]&&(i.length=parseInt(e[1],10)),e[2]&&(i.offset=parseInt(e[2],10)),i},Mk=function(){const s="[^=]*",e='"[^"]*"|[^,]*',i="(?:"+s+")=(?:"+e+")";return new RegExp("(?:^|,)("+i+")")},qi=function(s){const e={};if(!s)return e;const i=s.split(Mk());let r=i.length,o;for(;r--;)i[r]!==""&&(o=/([^=]*)=(.*)/.exec(i[r]).slice(1),o[0]=o[0].replace(/^\s+|\s+$/g,""),o[1]=o[1].replace(/^\s+|\s+$/g,""),o[1]=o[1].replace(/^['"](.*)['"]$/g,"$1"),e[o[0]]=o[1]);return e},J_=s=>{const e=s.split("x"),i={};return e[0]&&(i.width=parseInt(e[0],10)),e[1]&&(i.height=parseInt(e[1],10)),i};class Lk extends qg{constructor(){super(),this.customParsers=[],this.tagMappers=[]}push(e){let i,r;if(e=e.trim(),e.length===0)return;if(e[0]!=="#"){this.trigger("data",{type:"uri",uri:e});return}this.tagMappers.reduce((u,c)=>{const p=c(e);return p===e?u:u.concat([p])},[e]).forEach(u=>{for(let c=0;cu),this.customParsers.push(u=>{if(e.exec(u))return this.trigger("data",{type:"custom",data:r(u),customType:i,segment:o}),!0})}addTagMapper({expression:e,map:i}){const r=o=>e.test(o)?i(o):o;this.tagMappers.push(r)}}const Ik=s=>s.toLowerCase().replace(/-(\w)/g,e=>e[1].toUpperCase()),_a=function(s){const e={};return Object.keys(s).forEach(function(i){e[Ik(i)]=s[i]}),e},$g=function(s){const{serverControl:e,targetDuration:i,partTargetDuration:r}=s;if(!e)return;const o="#EXT-X-SERVER-CONTROL",u="holdBack",c="partHoldBack",p=i&&i*3,g=r&&r*2;i&&!e.hasOwnProperty(u)&&(e[u]=p,this.trigger("info",{message:`${o} defaulting HOLD-BACK to targetDuration * 3 (${p}).`})),p&&e[u]{o.uri||!o.parts&&!o.preloadHints||(!o.map&&u&&(o.map=u),!o.key&&c&&(o.key=c),!o.timeline&&typeof E=="number"&&(o.timeline=E),this.manifest.preloadSegment=o)}),this.parseStream.on("data",function(D){let z,H;if(i.manifest.definitions){for(const Y in i.manifest.definitions)if(D.uri&&(D.uri=D.uri.replace(`{$${Y}}`,i.manifest.definitions[Y])),D.attributes)for(const V in D.attributes)typeof D.attributes[V]=="string"&&(D.attributes[V]=D.attributes[V].replace(`{$${Y}}`,i.manifest.definitions[Y]))}({tag(){({version(){D.version&&(this.manifest.version=D.version)},"allow-cache"(){this.manifest.allowCache=D.allowed,"allowed"in D||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange(){const Y={};"length"in D&&(o.byterange=Y,Y.length=D.length,"offset"in D||(D.offset=A)),"offset"in D&&(o.byterange=Y,Y.offset=D.offset),A=Y.offset+Y.length},endlist(){this.manifest.endList=!0},inf(){"mediaSequence"in this.manifest||(this.manifest.mediaSequence=0,this.trigger("info",{message:"defaulting media sequence to zero"})),"discontinuitySequence"in this.manifest||(this.manifest.discontinuitySequence=0,this.trigger("info",{message:"defaulting discontinuity sequence to zero"})),D.title&&(o.title=D.title),D.duration>0&&(o.duration=D.duration),D.duration===0&&(o.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=r},key(){if(!D.attributes){this.trigger("warn",{message:"ignoring key declaration without attribute list"});return}if(D.attributes.METHOD==="NONE"){c=null;return}if(!D.attributes.URI){this.trigger("warn",{message:"ignoring key declaration without URI"});return}if(D.attributes.KEYFORMAT==="com.apple.streamingkeydelivery"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.apple.fps.1_0"]={attributes:D.attributes};return}if(D.attributes.KEYFORMAT==="com.microsoft.playready"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.microsoft.playready"]={uri:D.attributes.URI};return}if(D.attributes.KEYFORMAT===S){if(["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(D.attributes.METHOD)===-1){this.trigger("warn",{message:"invalid key method provided for Widevine"});return}if(D.attributes.METHOD==="SAMPLE-AES-CENC"&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),D.attributes.URI.substring(0,23)!=="data:text/plain;base64,"){this.trigger("warn",{message:"invalid key URI provided for Widevine"});return}if(!(D.attributes.KEYID&&D.attributes.KEYID.substring(0,2)==="0x")){this.trigger("warn",{message:"invalid key ID provided for Widevine"});return}this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.widevine.alpha"]={attributes:{schemeIdUri:D.attributes.KEYFORMAT,keyId:D.attributes.KEYID.substring(2)},pssh:Z_(D.attributes.URI.split(",")[1])};return}D.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),c={method:D.attributes.METHOD||"AES-128",uri:D.attributes.URI},typeof D.attributes.IV<"u"&&(c.iv=D.attributes.IV)},"media-sequence"(){if(!isFinite(D.number)){this.trigger("warn",{message:"ignoring invalid media sequence: "+D.number});return}this.manifest.mediaSequence=D.number},"discontinuity-sequence"(){if(!isFinite(D.number)){this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+D.number});return}this.manifest.discontinuitySequence=D.number,E=D.number},"playlist-type"(){if(!/VOD|EVENT/.test(D.playlistType)){this.trigger("warn",{message:"ignoring unknown playlist type: "+D.playlist});return}this.manifest.playlistType=D.playlistType},map(){u={},D.uri&&(u.uri=D.uri),D.byterange&&(u.byterange=D.byterange),c&&(u.key=c)},"stream-inf"(){if(this.manifest.playlists=r,this.manifest.mediaGroups=this.manifest.mediaGroups||b,!D.attributes){this.trigger("warn",{message:"ignoring empty stream-inf attributes"});return}o.attributes||(o.attributes={}),Ft(o.attributes,D.attributes)},media(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||b,!(D.attributes&&D.attributes.TYPE&&D.attributes["GROUP-ID"]&&D.attributes.NAME)){this.trigger("warn",{message:"ignoring incomplete or missing media group"});return}const Y=this.manifest.mediaGroups[D.attributes.TYPE];Y[D.attributes["GROUP-ID"]]=Y[D.attributes["GROUP-ID"]]||{},z=Y[D.attributes["GROUP-ID"]],H={default:/yes/i.test(D.attributes.DEFAULT)},H.default?H.autoselect=!0:H.autoselect=/yes/i.test(D.attributes.AUTOSELECT),D.attributes.LANGUAGE&&(H.language=D.attributes.LANGUAGE),D.attributes.URI&&(H.uri=D.attributes.URI),D.attributes["INSTREAM-ID"]&&(H.instreamId=D.attributes["INSTREAM-ID"]),D.attributes.CHARACTERISTICS&&(H.characteristics=D.attributes.CHARACTERISTICS),D.attributes.FORCED&&(H.forced=/yes/i.test(D.attributes.FORCED)),z[D.attributes.NAME]=H},discontinuity(){E+=1,o.discontinuity=!0,this.manifest.discontinuityStarts.push(r.length)},"program-date-time"(){typeof this.manifest.dateTimeString>"u"&&(this.manifest.dateTimeString=D.dateTimeString,this.manifest.dateTimeObject=D.dateTimeObject),o.dateTimeString=D.dateTimeString,o.dateTimeObject=D.dateTimeObject;const{lastProgramDateTime:Y}=this;this.lastProgramDateTime=new Date(D.dateTimeString).getTime(),Y===null&&this.manifest.segments.reduceRight((V,Q)=>(Q.programDateTime=V-Q.duration*1e3,Q.programDateTime),this.lastProgramDateTime)},targetduration(){if(!isFinite(D.duration)||D.duration<0){this.trigger("warn",{message:"ignoring invalid target duration: "+D.duration});return}this.manifest.targetDuration=D.duration,$g.call(this,this.manifest)},start(){if(!D.attributes||isNaN(D.attributes["TIME-OFFSET"])){this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"});return}this.manifest.start={timeOffset:D.attributes["TIME-OFFSET"],precise:D.attributes.PRECISE}},"cue-out"(){o.cueOut=D.data},"cue-out-cont"(){o.cueOutCont=D.data},"cue-in"(){o.cueIn=D.data},skip(){this.manifest.skip=_a(D.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",D.attributes,["SKIPPED-SEGMENTS"])},part(){p=!0;const Y=this.manifest.segments.length,V=_a(D.attributes);o.parts=o.parts||[],o.parts.push(V),V.byterange&&(V.byterange.hasOwnProperty("offset")||(V.byterange.offset=M),M=V.byterange.offset+V.byterange.length);const Q=o.parts.length-1;this.warnOnMissingAttributes_(`#EXT-X-PART #${Q} for segment #${Y}`,D.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach((Z,W)=>{Z.hasOwnProperty("lastPart")||this.trigger("warn",{message:`#EXT-X-RENDITION-REPORT #${W} lacks required attribute(s): LAST-PART`})})},"server-control"(){const Y=this.manifest.serverControl=_a(D.attributes);Y.hasOwnProperty("canBlockReload")||(Y.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),$g.call(this,this.manifest),Y.canSkipDateranges&&!Y.hasOwnProperty("canSkipUntil")&&this.trigger("warn",{message:"#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set"})},"preload-hint"(){const Y=this.manifest.segments.length,V=_a(D.attributes),Q=V.type&&V.type==="PART";o.preloadHints=o.preloadHints||[],o.preloadHints.push(V),V.byterange&&(V.byterange.hasOwnProperty("offset")||(V.byterange.offset=Q?M:0,Q&&(M=V.byterange.offset+V.byterange.length)));const Z=o.preloadHints.length-1;if(this.warnOnMissingAttributes_(`#EXT-X-PRELOAD-HINT #${Z} for segment #${Y}`,D.attributes,["TYPE","URI"]),!!V.type)for(let W=0;WW.id===V.id);this.manifest.dateRanges[Z]=Ft(this.manifest.dateRanges[Z],V),U[V.id]=Ft(U[V.id],V),this.manifest.dateRanges.pop()}},"independent-segments"(){this.manifest.independentSegments=!0},"i-frames-only"(){this.manifest.iFramesOnly=!0,this.requiredCompatibilityversion(this.manifest.version,4)},"content-steering"(){this.manifest.contentSteering=_a(D.attributes),this.warnOnMissingAttributes_("#EXT-X-CONTENT-STEERING",D.attributes,["SERVER-URI"])},define(){this.manifest.definitions=this.manifest.definitions||{};const Y=(V,Q)=>{if(V in this.manifest.definitions){this.trigger("error",{message:`EXT-X-DEFINE: Duplicate name ${V}`});return}this.manifest.definitions[V]=Q};if("QUERYPARAM"in D.attributes){if("NAME"in D.attributes||"IMPORT"in D.attributes){this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"});return}const V=this.params.get(D.attributes.QUERYPARAM);if(!V){this.trigger("error",{message:`EXT-X-DEFINE: No query param ${D.attributes.QUERYPARAM}`});return}Y(D.attributes.QUERYPARAM,decodeURIComponent(V));return}if("NAME"in D.attributes){if("IMPORT"in D.attributes){this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"});return}if(!("VALUE"in D.attributes)||typeof D.attributes.VALUE!="string"){this.trigger("error",{message:`EXT-X-DEFINE: No value for ${D.attributes.NAME}`});return}Y(D.attributes.NAME,D.attributes.VALUE);return}if("IMPORT"in D.attributes){if(!this.mainDefinitions[D.attributes.IMPORT]){this.trigger("error",{message:`EXT-X-DEFINE: No value ${D.attributes.IMPORT} to import, or IMPORT used on main playlist`});return}Y(D.attributes.IMPORT,this.mainDefinitions[D.attributes.IMPORT]);return}this.trigger("error",{message:"EXT-X-DEFINE: No attribute"})},"i-frame-playlist"(){this.manifest.iFramePlaylists.push({attributes:D.attributes,uri:D.uri,timeline:E}),this.warnOnMissingAttributes_("#EXT-X-I-FRAME-STREAM-INF",D.attributes,["BANDWIDTH","URI"])}}[D.tagType]||g).call(i)},uri(){o.uri=D.uri,r.push(o),this.manifest.targetDuration&&!("duration"in o)&&(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),o.duration=this.manifest.targetDuration),c&&(o.key=c),o.timeline=E,u&&(o.map=u),M=0,this.lastProgramDateTime!==null&&(o.programDateTime=this.lastProgramDateTime,this.lastProgramDateTime+=o.duration*1e3),o={}},comment(){},custom(){D.segment?(o.custom=o.custom||{},o.custom[D.customType]=D.data):(this.manifest.custom=this.manifest.custom||{},this.manifest.custom[D.customType]=D.data)}})[D.type].call(i)})}requiredCompatibilityversion(e,i){(eE&&(S-=E,S-=E,S-=bi(2))}return Number(S)},Gk=function(e,i){var r=i===void 0?{}:i,o=r.le,u=o===void 0?!1:o;(typeof e!="bigint"&&typeof e!="number"||typeof e=="number"&&e!==e)&&(e=0),e=bi(e);for(var c=qk(e),p=new Uint8Array(new ArrayBuffer(c)),g=0;g=i.length&&b.call(i,function(S,E){var A=g[E]?g[E]&e[c+E]:e[c+E];return S===A})},Yk=function(e,i,r){i.forEach(function(o){for(var u in e.mediaGroups[o])for(var c in e.mediaGroups[o][u]){var p=e.mediaGroups[o][u][c];r(p,o,u,c)}})},Ta={},Cr={};function Wk(s,e,i){if(i===void 0&&(i=Array.prototype),s&&typeof i.find=="function")return i.find.call(s,e);for(var r=0;r=0&&s=0){for(var o=e.length-1;r0},lookupPrefix:function(s){for(var e=this;e;){var i=e._nsMap;if(i){for(var r in i)if(Object.prototype.hasOwnProperty.call(i,r)&&i[r]===s)return r}e=e.nodeType==zl?e.ownerDocument:e.parentNode}return null},lookupNamespaceURI:function(s){for(var e=this;e;){var i=e._nsMap;if(i&&Object.prototype.hasOwnProperty.call(i,s))return i[s];e=e.nodeType==zl?e.ownerDocument:e.parentNode}return null},isDefaultNamespace:function(s){var e=this.lookupPrefix(s);return e==null}};function xT(s){return s=="<"&&"<"||s==">"&&">"||s=="&"&&"&"||s=='"'&&"""||"&#"+s.charCodeAt()+";"}sd(sn,yt),sd(sn,yt.prototype);function rd(s,e){if(e(s))return!0;if(s=s.firstChild)do if(rd(s,e))return!0;while(s=s.nextSibling)}function ad(){this.ownerDocument=this}function nO(s,e,i){s&&s._inc++;var r=i.namespaceURI;r===nd.XMLNS&&(e._nsMap[i.prefix?i.localName:""]=i.value)}function ET(s,e,i,r){s&&s._inc++;var o=i.namespaceURI;o===nd.XMLNS&&delete e._nsMap[i.prefix?i.localName:""]}function Qg(s,e,i){if(s&&s._inc){s._inc++;var r=e.childNodes;if(i)r[r.length++]=i;else{for(var o=e.firstChild,u=0;o;)r[u++]=o,o=o.nextSibling;r.length=u,delete r[r.length]}}}function CT(s,e){var i=e.previousSibling,r=e.nextSibling;return i?i.nextSibling=r:s.firstChild=r,r?r.previousSibling=i:s.lastChild=i,e.parentNode=null,e.previousSibling=null,e.nextSibling=null,Qg(s.ownerDocument,s),e}function sO(s){return s&&(s.nodeType===yt.DOCUMENT_NODE||s.nodeType===yt.DOCUMENT_FRAGMENT_NODE||s.nodeType===yt.ELEMENT_NODE)}function rO(s){return s&&(Ls(s)||Kg(s)||wr(s)||s.nodeType===yt.DOCUMENT_FRAGMENT_NODE||s.nodeType===yt.COMMENT_NODE||s.nodeType===yt.PROCESSING_INSTRUCTION_NODE)}function wr(s){return s&&s.nodeType===yt.DOCUMENT_TYPE_NODE}function Ls(s){return s&&s.nodeType===yt.ELEMENT_NODE}function Kg(s){return s&&s.nodeType===yt.TEXT_NODE}function AT(s,e){var i=s.childNodes||[];if(Ms(i,Ls)||wr(e))return!1;var r=Ms(i,wr);return!(e&&r&&i.indexOf(r)>i.indexOf(e))}function DT(s,e){var i=s.childNodes||[];function r(u){return Ls(u)&&u!==e}if(Ms(i,r))return!1;var o=Ms(i,wr);return!(e&&o&&i.indexOf(o)>i.indexOf(e))}function aO(s,e,i){if(!sO(s))throw new Xt(rn,"Unexpected parent node type "+s.nodeType);if(i&&i.parentNode!==s)throw new Xt(yT,"child not in parent");if(!rO(e)||wr(e)&&s.nodeType!==yt.DOCUMENT_NODE)throw new Xt(rn,"Unexpected node type "+e.nodeType+" for parent node type "+s.nodeType)}function oO(s,e,i){var r=s.childNodes||[],o=e.childNodes||[];if(e.nodeType===yt.DOCUMENT_FRAGMENT_NODE){var u=o.filter(Ls);if(u.length>1||Ms(o,Kg))throw new Xt(rn,"More than one element or text in fragment");if(u.length===1&&!AT(s,i))throw new Xt(rn,"Element in fragment can not be inserted before doctype")}if(Ls(e)&&!AT(s,i))throw new Xt(rn,"Only one element can be added and only after doctype");if(wr(e)){if(Ms(r,wr))throw new Xt(rn,"Only one doctype is allowed");var c=Ms(r,Ls);if(i&&r.indexOf(c)1||Ms(o,Kg))throw new Xt(rn,"More than one element or text in fragment");if(u.length===1&&!DT(s,i))throw new Xt(rn,"Element in fragment can not be inserted before doctype")}if(Ls(e)&&!DT(s,i))throw new Xt(rn,"Only one element can be added and only after doctype");if(wr(e)){if(Ms(r,function(g){return wr(g)&&g!==i}))throw new Xt(rn,"Only one doctype is allowed");var c=Ms(r,Ls);if(i&&r.indexOf(c)0&&rd(i.documentElement,function(o){if(o!==i&&o.nodeType===cs){var u=o.getAttribute("class");if(u){var c=s===u;if(!c){var p=cT(u);c=e.every(eO(p))}c&&r.push(o)}}}),r})},createElement:function(s){var e=new Co;e.ownerDocument=this,e.nodeName=s,e.tagName=s,e.localName=s,e.childNodes=new Dr;var i=e.attributes=new Uf;return i._ownerElement=e,e},createDocumentFragment:function(){var s=new zf;return s.ownerDocument=this,s.childNodes=new Dr,s},createTextNode:function(s){var e=new Zg;return e.ownerDocument=this,e.appendData(s),e},createComment:function(s){var e=new Jg;return e.ownerDocument=this,e.appendData(s),e},createCDATASection:function(s){var e=new e0;return e.ownerDocument=this,e.appendData(s),e},createProcessingInstruction:function(s,e){var i=new i0;return i.ownerDocument=this,i.tagName=i.nodeName=i.target=s,i.nodeValue=i.data=e,i},createAttribute:function(s){var e=new Ff;return e.ownerDocument=this,e.name=s,e.nodeName=s,e.localName=s,e.specified=!0,e},createEntityReference:function(s){var e=new t0;return e.ownerDocument=this,e.nodeName=s,e},createElementNS:function(s,e){var i=new Co,r=e.split(":"),o=i.attributes=new Uf;return i.childNodes=new Dr,i.ownerDocument=this,i.nodeName=e,i.tagName=e,i.namespaceURI=s,r.length==2?(i.prefix=r[0],i.localName=r[1]):i.localName=e,o._ownerElement=i,i},createAttributeNS:function(s,e){var i=new Ff,r=e.split(":");return i.ownerDocument=this,i.nodeName=e,i.name=e,i.namespaceURI=s,i.specified=!0,r.length==2?(i.prefix=r[0],i.localName=r[1]):i.localName=e,i}},nn(ad,yt);function Co(){this._nsMap={}}Co.prototype={nodeType:cs,hasAttribute:function(s){return this.getAttributeNode(s)!=null},getAttribute:function(s){var e=this.getAttributeNode(s);return e&&e.value||""},getAttributeNode:function(s){return this.attributes.getNamedItem(s)},setAttribute:function(s,e){var i=this.ownerDocument.createAttribute(s);i.value=i.nodeValue=""+e,this.setAttributeNode(i)},removeAttribute:function(s){var e=this.getAttributeNode(s);e&&this.removeAttributeNode(e)},appendChild:function(s){return s.nodeType===Ar?this.insertBefore(s,null):lO(this,s)},setAttributeNode:function(s){return this.attributes.setNamedItem(s)},setAttributeNodeNS:function(s){return this.attributes.setNamedItemNS(s)},removeAttributeNode:function(s){return this.attributes.removeNamedItem(s.nodeName)},removeAttributeNS:function(s,e){var i=this.getAttributeNodeNS(s,e);i&&this.removeAttributeNode(i)},hasAttributeNS:function(s,e){return this.getAttributeNodeNS(s,e)!=null},getAttributeNS:function(s,e){var i=this.getAttributeNodeNS(s,e);return i&&i.value||""},setAttributeNS:function(s,e,i){var r=this.ownerDocument.createAttributeNS(s,e);r.value=r.nodeValue=""+i,this.setAttributeNode(r)},getAttributeNodeNS:function(s,e){return this.attributes.getNamedItemNS(s,e)},getElementsByTagName:function(s){return new jl(this,function(e){var i=[];return rd(e,function(r){r!==e&&r.nodeType==cs&&(s==="*"||r.tagName==s)&&i.push(r)}),i})},getElementsByTagNameNS:function(s,e){return new jl(this,function(i){var r=[];return rd(i,function(o){o!==i&&o.nodeType===cs&&(s==="*"||o.namespaceURI===s)&&(e==="*"||o.localName==e)&&r.push(o)}),r})}},ad.prototype.getElementsByTagName=Co.prototype.getElementsByTagName,ad.prototype.getElementsByTagNameNS=Co.prototype.getElementsByTagNameNS,nn(Co,yt);function Ff(){}Ff.prototype.nodeType=zl,nn(Ff,yt);function od(){}od.prototype={data:"",substringData:function(s,e){return this.data.substring(s,s+e)},appendData:function(s){s=this.data+s,this.nodeValue=this.data=s,this.length=s.length},insertData:function(s,e){this.replaceData(s,0,e)},appendChild:function(s){throw new Error(ci[rn])},deleteData:function(s,e){this.replaceData(s,e,"")},replaceData:function(s,e,i){var r=this.data.substring(0,s),o=this.data.substring(s+e);i=r+i+o,this.nodeValue=this.data=i,this.length=i.length}},nn(od,yt);function Zg(){}Zg.prototype={nodeName:"#text",nodeType:Pf,splitText:function(s){var e=this.data,i=e.substring(s);e=e.substring(0,s),this.data=this.nodeValue=e,this.length=e.length;var r=this.ownerDocument.createTextNode(i);return this.parentNode&&this.parentNode.insertBefore(r,this.nextSibling),r}},nn(Zg,od);function Jg(){}Jg.prototype={nodeName:"#comment",nodeType:pT},nn(Jg,od);function e0(){}e0.prototype={nodeName:"#cdata-section",nodeType:dT},nn(e0,od);function Hf(){}Hf.prototype.nodeType=gT,nn(Hf,yt);function kT(){}kT.prototype.nodeType=iO,nn(kT,yt);function OT(){}OT.prototype.nodeType=tO,nn(OT,yt);function t0(){}t0.prototype.nodeType=hT,nn(t0,yt);function zf(){}zf.prototype.nodeName="#document-fragment",zf.prototype.nodeType=Ar,nn(zf,yt);function i0(){}i0.prototype.nodeType=fT,nn(i0,yt);function RT(){}RT.prototype.serializeToString=function(s,e,i){return MT.call(s,e,i)},yt.prototype.toString=MT;function MT(s,e){var i=[],r=this.nodeType==9&&this.documentElement||this,o=r.prefix,u=r.namespaceURI;if(u&&o==null){var o=r.lookupPrefix(u);if(o==null)var c=[{namespace:u,prefix:null}]}return ql(this,i,s,e,c),i.join("")}function LT(s,e,i){var r=s.prefix||"",o=s.namespaceURI;if(!o||r==="xml"&&o===nd.XML||o===nd.XMLNS)return!1;for(var u=i.length;u--;){var c=i[u];if(c.prefix===r)return c.namespace!==o}return!0}function n0(s,e,i){s.push(" ",e,'="',i.replace(/[<>&"\t\n\r]/g,xT),'"')}function ql(s,e,i,r,o){if(o||(o=[]),r)if(s=r(s),s){if(typeof s=="string"){e.push(s);return}}else return;switch(s.nodeType){case cs:var u=s.attributes,c=u.length,H=s.firstChild,p=s.tagName;i=nd.isHTML(s.namespaceURI)||i;var g=p;if(!i&&!s.prefix&&s.namespaceURI){for(var b,S=0;S=0;E--){var A=o[E];if(A.prefix===""&&A.namespace===s.namespaceURI){b=A.namespace;break}}if(b!==s.namespaceURI)for(var E=o.length-1;E>=0;E--){var A=o[E];if(A.namespace===s.namespaceURI){A.prefix&&(g=A.prefix+":"+p);break}}}e.push("<",g);for(var M=0;M"),i&&/^script$/i.test(p))for(;H;)H.data?e.push(H.data):ql(H,e,i,r,o.slice()),H=H.nextSibling;else for(;H;)ql(H,e,i,r,o.slice()),H=H.nextSibling;e.push("")}else e.push("/>");return;case mT:case Ar:for(var H=s.firstChild;H;)ql(H,e,i,r,o.slice()),H=H.nextSibling;return;case zl:return n0(e,s.name,s.value);case Pf:return e.push(s.data.replace(/[<&>]/g,xT));case dT:return e.push("");case pT:return e.push("");case gT:var Y=s.publicId,V=s.systemId;if(e.push("");else if(V&&V!=".")e.push(" SYSTEM ",V,">");else{var Q=s.internalSubset;Q&&e.push(" [",Q,"]"),e.push(">")}return;case fT:return e.push("");case hT:return e.push("&",s.nodeName,";");default:e.push("??",s.nodeName)}}function IT(s,e,i){var r;switch(e.nodeType){case cs:r=e.cloneNode(!1),r.ownerDocument=s;case Ar:break;case zl:i=!0;break}if(r||(r=e.cloneNode(!1)),r.ownerDocument=s,r.parentNode=null,i)for(var o=e.firstChild;o;)r.appendChild(IT(s,o,i)),o=o.nextSibling;return r}function s0(s,e,i){var r=new e.constructor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var u=e[o];typeof u!="object"&&u!=r[o]&&(r[o]=u)}switch(e.childNodes&&(r.childNodes=new Dr),r.ownerDocument=s,r.nodeType){case cs:var c=e.attributes,p=r.attributes=new Uf,g=c.length;p._ownerElement=r;for(var b=0;b",lt:"<",quot:'"'}),s.HTML_ENTITIES=e({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"⁡",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"⁡",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"⁣",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"⁣",InvisibleTimes:"⁢",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"⁢",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"‎",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"​",NegativeThickSpace:"​",NegativeThinSpace:"​",NegativeVeryThinSpace:"​",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:` -`,nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"⁠",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"‏",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"­",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:" ",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:"  ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"​",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"‍",zwnj:"‌"}),s.entityMap=s.HTML_ENTITIES})(PT);var r0={},ld=Cr.NAMESPACE,a0=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,UT=new RegExp("[\\-\\.0-9"+a0.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),BT=new RegExp("^"+a0.source+UT.source+"*(?::"+a0.source+UT.source+"*)?$"),ud=0,Sa=1,Vl=2,cd=3,$l=4,Gl=5,dd=6,qf=7;function Xl(s,e){this.message=s,this.locator=e,Error.captureStackTrace&&Error.captureStackTrace(this,Xl)}Xl.prototype=new Error,Xl.prototype.name=Xl.name;function FT(){}FT.prototype={parse:function(s,e,i){var r=this.domBuilder;r.startDocument(),jT(e,e={}),uO(s,e,i,r,this.errorHandler),r.endDocument()}};function uO(s,e,i,r,o){function u(de){if(de>65535){de-=65536;var Ee=55296+(de>>10),Re=56320+(de&1023);return String.fromCharCode(Ee,Re)}else return String.fromCharCode(de)}function c(de){var Ee=de.slice(1,-1);return Object.hasOwnProperty.call(i,Ee)?i[Ee]:Ee.charAt(0)==="#"?u(parseInt(Ee.substr(1).replace("x","0x"))):(o.error("entity not found:"+de),de)}function p(de){if(de>D){var Ee=s.substring(D,de).replace(/&#?\w+;/g,c);A&&g(D),r.characters(Ee,0,de-D),D=de}}function g(de,Ee){for(;de>=S&&(Ee=E.exec(s));)b=Ee.index,S=b+Ee[0].length,A.lineNumber++;A.columnNumber=de-b+1}for(var b=0,S=0,E=/.*(?:\r\n?|\n)|.*$/g,A=r.locator,M=[{currentNSMap:e}],U={},D=0;;){try{var z=s.indexOf("<",D);if(z<0){if(!s.substr(D).match(/^\s*$/)){var H=r.doc,Y=H.createTextNode(s.substr(D));H.appendChild(Y),r.currentElement=Y}return}switch(z>D&&p(z),s.charAt(z+1)){case"/":var fe=s.indexOf(">",z+3),V=s.substring(z+2,fe).replace(/[ \t\n\r]+$/g,""),Q=M.pop();fe<0?(V=s.substring(z+2).replace(/[\s<].*/,""),o.error("end tag name: "+V+" is not complete:"+Q.tagName),fe=z+1+V.length):V.match(/\sD?D=fe:p(Math.max(z,D)+1)}}function HT(s,e){return e.lineNumber=s.lineNumber,e.columnNumber=s.columnNumber,e}function cO(s,e,i,r,o,u){function c(A,M,U){i.attributeNames.hasOwnProperty(A)&&u.fatalError("Attribute "+A+" redefined"),i.addValue(A,M.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,o),U)}for(var p,g,b=++e,S=ud;;){var E=s.charAt(b);switch(E){case"=":if(S===Sa)p=s.slice(e,b),S=cd;else if(S===Vl)S=cd;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(S===cd||S===Sa)if(S===Sa&&(u.warning('attribute value must after "="'),p=s.slice(e,b)),e=b+1,b=s.indexOf(E,e),b>0)g=s.slice(e,b),c(p,g,e-1),S=Gl;else throw new Error("attribute value no end '"+E+"' match");else if(S==$l)g=s.slice(e,b),c(p,g,e),u.warning('attribute "'+p+'" missed start quot('+E+")!!"),e=b+1,S=Gl;else throw new Error('attribute value must after "="');break;case"/":switch(S){case ud:i.setTagName(s.slice(e,b));case Gl:case dd:case qf:S=qf,i.closed=!0;case $l:case Sa:break;case Vl:i.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return u.error("unexpected end of input"),S==ud&&i.setTagName(s.slice(e,b)),b;case">":switch(S){case ud:i.setTagName(s.slice(e,b));case Gl:case dd:case qf:break;case $l:case Sa:g=s.slice(e,b),g.slice(-1)==="/"&&(i.closed=!0,g=g.slice(0,-1));case Vl:S===Vl&&(g=p),S==$l?(u.warning('attribute "'+g+'" missed quot(")!'),c(p,g,e)):((!ld.isHTML(r[""])||!g.match(/^(?:disabled|checked|selected)$/i))&&u.warning('attribute "'+g+'" missed value!! "'+g+'" instead!!'),c(g,g,e));break;case cd:throw new Error("attribute value missed!!")}return b;case"€":E=" ";default:if(E<=" ")switch(S){case ud:i.setTagName(s.slice(e,b)),S=dd;break;case Sa:p=s.slice(e,b),S=Vl;break;case $l:var g=s.slice(e,b);u.warning('attribute "'+g+'" missed quot(")!!'),c(p,g,e);case Gl:S=dd;break}else switch(S){case Vl:i.tagName,(!ld.isHTML(r[""])||!p.match(/^(?:disabled|checked|selected)$/i))&&u.warning('attribute "'+p+'" missed value!! "'+p+'" instead2!!'),c(p,p,e),e=b,S=Sa;break;case Gl:u.warning('attribute space is required"'+p+'"!!');case dd:S=Sa,e=b;break;case cd:S=$l,e=b;break;case qf:throw new Error("elements closed character '/' and '>' must be connected to")}}b++}}function zT(s,e,i){for(var r=s.tagName,o=null,E=s.length;E--;){var u=s[E],c=u.qName,p=u.value,A=c.indexOf(":");if(A>0)var g=u.prefix=c.slice(0,A),b=c.slice(A+1),S=g==="xmlns"&&b;else b=c,g=null,S=c==="xmlns"&&"";u.localName=b,S!==!1&&(o==null&&(o={},jT(i,i={})),i[S]=o[S]=p,u.uri=ld.XMLNS,e.startPrefixMapping(S,p))}for(var E=s.length;E--;){u=s[E];var g=u.prefix;g&&(g==="xml"&&(u.uri=ld.XML),g!=="xmlns"&&(u.uri=i[g||""]))}var A=r.indexOf(":");A>0?(g=s.prefix=r.slice(0,A),b=s.localName=r.slice(A+1)):(g=null,b=s.localName=r);var M=s.uri=i[g||""];if(e.startElement(M,b,r,s),s.closed){if(e.endElement(M,b,r),o)for(g in o)Object.prototype.hasOwnProperty.call(o,g)&&e.endPrefixMapping(g)}else return s.currentNSMap=i,s.localNSMap=o,!0}function dO(s,e,i,r,o){if(/^(?:script|textarea)$/i.test(i)){var u=s.indexOf("",e),c=s.substring(e+1,u);if(/[&<]/.test(c))return/^script$/i.test(i)?(o.characters(c,0,c.length),u):(c=c.replace(/&#?\w+;/g,r),o.characters(c,0,c.length),u)}return e+1}function hO(s,e,i,r){var o=r[i];return o==null&&(o=s.lastIndexOf(""),o",e+4);return u>e?(i.comment(s,e+4,u-e-4),u+3):(r.error("Unclosed comment"),-1)}else return-1;default:if(s.substr(e+3,6)=="CDATA["){var u=s.indexOf("]]>",e+9);return i.startCDATA(),i.characters(s,e+9,u-e-9),i.endCDATA(),u+3}var c=mO(s,e),p=c.length;if(p>1&&/!doctype/i.test(c[0][0])){var g=c[1][0],b=!1,S=!1;p>3&&(/^public$/i.test(c[2][0])?(b=c[3][0],S=p>4&&c[4][0]):/^system$/i.test(c[2][0])&&(S=c[3][0]));var E=c[p-1];return i.startDTD(g,b,S),i.endDTD(),E.index+E[0].length}}return-1}function pO(s,e,i){var r=s.indexOf("?>",e);if(r){var o=s.substring(e,r).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return o?(o[0].length,i.processingInstruction(o[1],o[2]),r+2):-1}return-1}function qT(){this.attributeNames={}}qT.prototype={setTagName:function(s){if(!BT.test(s))throw new Error("invalid tagName:"+s);this.tagName=s},addValue:function(s,e,i){if(!BT.test(s))throw new Error("invalid attribute:"+s);this.attributeNames[s]=this.length,this[this.length++]={qName:s,value:e,offset:i}},length:0,getLocalName:function(s){return this[s].localName},getLocator:function(s){return this[s].locator},getQName:function(s){return this[s].qName},getURI:function(s){return this[s].uri},getValue:function(s){return this[s].value}};function mO(s,e){var i,r=[],o=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(o.lastIndex=e,o.exec(s);i=o.exec(s);)if(r.push(i),i[1])return r}r0.XMLReader=FT,r0.ParseError=Xl;var gO=Cr,yO=Ta,VT=PT,$T=r0,vO=yO.DOMImplementation,GT=gO.NAMESPACE,bO=$T.ParseError,_O=$T.XMLReader;function XT(s){return s.replace(/\r[\n\u0085]/g,` +`))this.trigger("data",this.buffer.substring(0,i)),this.buffer=this.buffer.substring(i+1)}}const Rk=String.fromCharCode(9),Vg=function(s){const e=/([0-9.]*)?@?([0-9.]*)?/.exec(s||""),i={};return e[1]&&(i.length=parseInt(e[1],10)),e[2]&&(i.offset=parseInt(e[2],10)),i},Mk=function(){const s="[^=]*",e='"[^"]*"|[^,]*',i="(?:"+s+")=(?:"+e+")";return new RegExp("(?:^|,)("+i+")")},qi=function(s){const e={};if(!s)return e;const i=s.split(Mk());let r=i.length,o;for(;r--;)i[r]!==""&&(o=/([^=]*)=(.*)/.exec(i[r]).slice(1),o[0]=o[0].replace(/^\s+|\s+$/g,""),o[1]=o[1].replace(/^\s+|\s+$/g,""),o[1]=o[1].replace(/^['"](.*)['"]$/g,"$1"),e[o[0]]=o[1]);return e},J_=s=>{const e=s.split("x"),i={};return e[0]&&(i.width=parseInt(e[0],10)),e[1]&&(i.height=parseInt(e[1],10)),i};class Lk extends qg{constructor(){super(),this.customParsers=[],this.tagMappers=[]}push(e){let i,r;if(e=e.trim(),e.length===0)return;if(e[0]!=="#"){this.trigger("data",{type:"uri",uri:e});return}this.tagMappers.reduce((u,c)=>{const p=c(e);return p===e?u:u.concat([p])},[e]).forEach(u=>{for(let c=0;cu),this.customParsers.push(u=>{if(e.exec(u))return this.trigger("data",{type:"custom",data:r(u),customType:i,segment:o}),!0})}addTagMapper({expression:e,map:i}){const r=o=>e.test(o)?i(o):o;this.tagMappers.push(r)}}const Ik=s=>s.toLowerCase().replace(/-(\w)/g,e=>e[1].toUpperCase()),_a=function(s){const e={};return Object.keys(s).forEach(function(i){e[Ik(i)]=s[i]}),e},$g=function(s){const{serverControl:e,targetDuration:i,partTargetDuration:r}=s;if(!e)return;const o="#EXT-X-SERVER-CONTROL",u="holdBack",c="partHoldBack",p=i&&i*3,g=r&&r*2;i&&!e.hasOwnProperty(u)&&(e[u]=p,this.trigger("info",{message:`${o} defaulting HOLD-BACK to targetDuration * 3 (${p}).`})),p&&e[u]{o.uri||!o.parts&&!o.preloadHints||(!o.map&&u&&(o.map=u),!o.key&&c&&(o.key=c),!o.timeline&&typeof E=="number"&&(o.timeline=E),this.manifest.preloadSegment=o)}),this.parseStream.on("data",function(D){let z,H;if(i.manifest.definitions){for(const Y in i.manifest.definitions)if(D.uri&&(D.uri=D.uri.replace(`{$${Y}}`,i.manifest.definitions[Y])),D.attributes)for(const $ in D.attributes)typeof D.attributes[$]=="string"&&(D.attributes[$]=D.attributes[$].replace(`{$${Y}}`,i.manifest.definitions[Y]))}({tag(){({version(){D.version&&(this.manifest.version=D.version)},"allow-cache"(){this.manifest.allowCache=D.allowed,"allowed"in D||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange(){const Y={};"length"in D&&(o.byterange=Y,Y.length=D.length,"offset"in D||(D.offset=A)),"offset"in D&&(o.byterange=Y,Y.offset=D.offset),A=Y.offset+Y.length},endlist(){this.manifest.endList=!0},inf(){"mediaSequence"in this.manifest||(this.manifest.mediaSequence=0,this.trigger("info",{message:"defaulting media sequence to zero"})),"discontinuitySequence"in this.manifest||(this.manifest.discontinuitySequence=0,this.trigger("info",{message:"defaulting discontinuity sequence to zero"})),D.title&&(o.title=D.title),D.duration>0&&(o.duration=D.duration),D.duration===0&&(o.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=r},key(){if(!D.attributes){this.trigger("warn",{message:"ignoring key declaration without attribute list"});return}if(D.attributes.METHOD==="NONE"){c=null;return}if(!D.attributes.URI){this.trigger("warn",{message:"ignoring key declaration without URI"});return}if(D.attributes.KEYFORMAT==="com.apple.streamingkeydelivery"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.apple.fps.1_0"]={attributes:D.attributes};return}if(D.attributes.KEYFORMAT==="com.microsoft.playready"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.microsoft.playready"]={uri:D.attributes.URI};return}if(D.attributes.KEYFORMAT===S){if(["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(D.attributes.METHOD)===-1){this.trigger("warn",{message:"invalid key method provided for Widevine"});return}if(D.attributes.METHOD==="SAMPLE-AES-CENC"&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),D.attributes.URI.substring(0,23)!=="data:text/plain;base64,"){this.trigger("warn",{message:"invalid key URI provided for Widevine"});return}if(!(D.attributes.KEYID&&D.attributes.KEYID.substring(0,2)==="0x")){this.trigger("warn",{message:"invalid key ID provided for Widevine"});return}this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.widevine.alpha"]={attributes:{schemeIdUri:D.attributes.KEYFORMAT,keyId:D.attributes.KEYID.substring(2)},pssh:Z_(D.attributes.URI.split(",")[1])};return}D.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),c={method:D.attributes.METHOD||"AES-128",uri:D.attributes.URI},typeof D.attributes.IV<"u"&&(c.iv=D.attributes.IV)},"media-sequence"(){if(!isFinite(D.number)){this.trigger("warn",{message:"ignoring invalid media sequence: "+D.number});return}this.manifest.mediaSequence=D.number},"discontinuity-sequence"(){if(!isFinite(D.number)){this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+D.number});return}this.manifest.discontinuitySequence=D.number,E=D.number},"playlist-type"(){if(!/VOD|EVENT/.test(D.playlistType)){this.trigger("warn",{message:"ignoring unknown playlist type: "+D.playlist});return}this.manifest.playlistType=D.playlistType},map(){u={},D.uri&&(u.uri=D.uri),D.byterange&&(u.byterange=D.byterange),c&&(u.key=c)},"stream-inf"(){if(this.manifest.playlists=r,this.manifest.mediaGroups=this.manifest.mediaGroups||b,!D.attributes){this.trigger("warn",{message:"ignoring empty stream-inf attributes"});return}o.attributes||(o.attributes={}),Ft(o.attributes,D.attributes)},media(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||b,!(D.attributes&&D.attributes.TYPE&&D.attributes["GROUP-ID"]&&D.attributes.NAME)){this.trigger("warn",{message:"ignoring incomplete or missing media group"});return}const Y=this.manifest.mediaGroups[D.attributes.TYPE];Y[D.attributes["GROUP-ID"]]=Y[D.attributes["GROUP-ID"]]||{},z=Y[D.attributes["GROUP-ID"]],H={default:/yes/i.test(D.attributes.DEFAULT)},H.default?H.autoselect=!0:H.autoselect=/yes/i.test(D.attributes.AUTOSELECT),D.attributes.LANGUAGE&&(H.language=D.attributes.LANGUAGE),D.attributes.URI&&(H.uri=D.attributes.URI),D.attributes["INSTREAM-ID"]&&(H.instreamId=D.attributes["INSTREAM-ID"]),D.attributes.CHARACTERISTICS&&(H.characteristics=D.attributes.CHARACTERISTICS),D.attributes.FORCED&&(H.forced=/yes/i.test(D.attributes.FORCED)),z[D.attributes.NAME]=H},discontinuity(){E+=1,o.discontinuity=!0,this.manifest.discontinuityStarts.push(r.length)},"program-date-time"(){typeof this.manifest.dateTimeString>"u"&&(this.manifest.dateTimeString=D.dateTimeString,this.manifest.dateTimeObject=D.dateTimeObject),o.dateTimeString=D.dateTimeString,o.dateTimeObject=D.dateTimeObject;const{lastProgramDateTime:Y}=this;this.lastProgramDateTime=new Date(D.dateTimeString).getTime(),Y===null&&this.manifest.segments.reduceRight(($,Q)=>(Q.programDateTime=$-Q.duration*1e3,Q.programDateTime),this.lastProgramDateTime)},targetduration(){if(!isFinite(D.duration)||D.duration<0){this.trigger("warn",{message:"ignoring invalid target duration: "+D.duration});return}this.manifest.targetDuration=D.duration,$g.call(this,this.manifest)},start(){if(!D.attributes||isNaN(D.attributes["TIME-OFFSET"])){this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"});return}this.manifest.start={timeOffset:D.attributes["TIME-OFFSET"],precise:D.attributes.PRECISE}},"cue-out"(){o.cueOut=D.data},"cue-out-cont"(){o.cueOutCont=D.data},"cue-in"(){o.cueIn=D.data},skip(){this.manifest.skip=_a(D.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",D.attributes,["SKIPPED-SEGMENTS"])},part(){p=!0;const Y=this.manifest.segments.length,$=_a(D.attributes);o.parts=o.parts||[],o.parts.push($),$.byterange&&($.byterange.hasOwnProperty("offset")||($.byterange.offset=M),M=$.byterange.offset+$.byterange.length);const Q=o.parts.length-1;this.warnOnMissingAttributes_(`#EXT-X-PART #${Q} for segment #${Y}`,D.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach((Z,W)=>{Z.hasOwnProperty("lastPart")||this.trigger("warn",{message:`#EXT-X-RENDITION-REPORT #${W} lacks required attribute(s): LAST-PART`})})},"server-control"(){const Y=this.manifest.serverControl=_a(D.attributes);Y.hasOwnProperty("canBlockReload")||(Y.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),$g.call(this,this.manifest),Y.canSkipDateranges&&!Y.hasOwnProperty("canSkipUntil")&&this.trigger("warn",{message:"#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set"})},"preload-hint"(){const Y=this.manifest.segments.length,$=_a(D.attributes),Q=$.type&&$.type==="PART";o.preloadHints=o.preloadHints||[],o.preloadHints.push($),$.byterange&&($.byterange.hasOwnProperty("offset")||($.byterange.offset=Q?M:0,Q&&(M=$.byterange.offset+$.byterange.length)));const Z=o.preloadHints.length-1;if(this.warnOnMissingAttributes_(`#EXT-X-PRELOAD-HINT #${Z} for segment #${Y}`,D.attributes,["TYPE","URI"]),!!$.type)for(let W=0;WW.id===$.id);this.manifest.dateRanges[Z]=Ft(this.manifest.dateRanges[Z],$),U[$.id]=Ft(U[$.id],$),this.manifest.dateRanges.pop()}},"independent-segments"(){this.manifest.independentSegments=!0},"i-frames-only"(){this.manifest.iFramesOnly=!0,this.requiredCompatibilityversion(this.manifest.version,4)},"content-steering"(){this.manifest.contentSteering=_a(D.attributes),this.warnOnMissingAttributes_("#EXT-X-CONTENT-STEERING",D.attributes,["SERVER-URI"])},define(){this.manifest.definitions=this.manifest.definitions||{};const Y=($,Q)=>{if($ in this.manifest.definitions){this.trigger("error",{message:`EXT-X-DEFINE: Duplicate name ${$}`});return}this.manifest.definitions[$]=Q};if("QUERYPARAM"in D.attributes){if("NAME"in D.attributes||"IMPORT"in D.attributes){this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"});return}const $=this.params.get(D.attributes.QUERYPARAM);if(!$){this.trigger("error",{message:`EXT-X-DEFINE: No query param ${D.attributes.QUERYPARAM}`});return}Y(D.attributes.QUERYPARAM,decodeURIComponent($));return}if("NAME"in D.attributes){if("IMPORT"in D.attributes){this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"});return}if(!("VALUE"in D.attributes)||typeof D.attributes.VALUE!="string"){this.trigger("error",{message:`EXT-X-DEFINE: No value for ${D.attributes.NAME}`});return}Y(D.attributes.NAME,D.attributes.VALUE);return}if("IMPORT"in D.attributes){if(!this.mainDefinitions[D.attributes.IMPORT]){this.trigger("error",{message:`EXT-X-DEFINE: No value ${D.attributes.IMPORT} to import, or IMPORT used on main playlist`});return}Y(D.attributes.IMPORT,this.mainDefinitions[D.attributes.IMPORT]);return}this.trigger("error",{message:"EXT-X-DEFINE: No attribute"})},"i-frame-playlist"(){this.manifest.iFramePlaylists.push({attributes:D.attributes,uri:D.uri,timeline:E}),this.warnOnMissingAttributes_("#EXT-X-I-FRAME-STREAM-INF",D.attributes,["BANDWIDTH","URI"])}}[D.tagType]||g).call(i)},uri(){o.uri=D.uri,r.push(o),this.manifest.targetDuration&&!("duration"in o)&&(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),o.duration=this.manifest.targetDuration),c&&(o.key=c),o.timeline=E,u&&(o.map=u),M=0,this.lastProgramDateTime!==null&&(o.programDateTime=this.lastProgramDateTime,this.lastProgramDateTime+=o.duration*1e3),o={}},comment(){},custom(){D.segment?(o.custom=o.custom||{},o.custom[D.customType]=D.data):(this.manifest.custom=this.manifest.custom||{},this.manifest.custom[D.customType]=D.data)}})[D.type].call(i)})}requiredCompatibilityversion(e,i){(eE&&(S-=E,S-=E,S-=bi(2))}return Number(S)},Gk=function(e,i){var r=i===void 0?{}:i,o=r.le,u=o===void 0?!1:o;(typeof e!="bigint"&&typeof e!="number"||typeof e=="number"&&e!==e)&&(e=0),e=bi(e);for(var c=qk(e),p=new Uint8Array(new ArrayBuffer(c)),g=0;g=i.length&&b.call(i,function(S,E){var A=g[E]?g[E]&e[c+E]:e[c+E];return S===A})},Yk=function(e,i,r){i.forEach(function(o){for(var u in e.mediaGroups[o])for(var c in e.mediaGroups[o][u]){var p=e.mediaGroups[o][u][c];r(p,o,u,c)}})},Ta={},Cr={};function Wk(s,e,i){if(i===void 0&&(i=Array.prototype),s&&typeof i.find=="function")return i.find.call(s,e);for(var r=0;r=0&&s=0){for(var o=e.length-1;r0},lookupPrefix:function(s){for(var e=this;e;){var i=e._nsMap;if(i){for(var r in i)if(Object.prototype.hasOwnProperty.call(i,r)&&i[r]===s)return r}e=e.nodeType==zl?e.ownerDocument:e.parentNode}return null},lookupNamespaceURI:function(s){for(var e=this;e;){var i=e._nsMap;if(i&&Object.prototype.hasOwnProperty.call(i,s))return i[s];e=e.nodeType==zl?e.ownerDocument:e.parentNode}return null},isDefaultNamespace:function(s){var e=this.lookupPrefix(s);return e==null}};function xT(s){return s=="<"&&"<"||s==">"&&">"||s=="&"&&"&"||s=='"'&&"""||"&#"+s.charCodeAt()+";"}sd(sn,yt),sd(sn,yt.prototype);function rd(s,e){if(e(s))return!0;if(s=s.firstChild)do if(rd(s,e))return!0;while(s=s.nextSibling)}function ad(){this.ownerDocument=this}function nO(s,e,i){s&&s._inc++;var r=i.namespaceURI;r===nd.XMLNS&&(e._nsMap[i.prefix?i.localName:""]=i.value)}function ET(s,e,i,r){s&&s._inc++;var o=i.namespaceURI;o===nd.XMLNS&&delete e._nsMap[i.prefix?i.localName:""]}function Qg(s,e,i){if(s&&s._inc){s._inc++;var r=e.childNodes;if(i)r[r.length++]=i;else{for(var o=e.firstChild,u=0;o;)r[u++]=o,o=o.nextSibling;r.length=u,delete r[r.length]}}}function CT(s,e){var i=e.previousSibling,r=e.nextSibling;return i?i.nextSibling=r:s.firstChild=r,r?r.previousSibling=i:s.lastChild=i,e.parentNode=null,e.previousSibling=null,e.nextSibling=null,Qg(s.ownerDocument,s),e}function sO(s){return s&&(s.nodeType===yt.DOCUMENT_NODE||s.nodeType===yt.DOCUMENT_FRAGMENT_NODE||s.nodeType===yt.ELEMENT_NODE)}function rO(s){return s&&(Ls(s)||Kg(s)||wr(s)||s.nodeType===yt.DOCUMENT_FRAGMENT_NODE||s.nodeType===yt.COMMENT_NODE||s.nodeType===yt.PROCESSING_INSTRUCTION_NODE)}function wr(s){return s&&s.nodeType===yt.DOCUMENT_TYPE_NODE}function Ls(s){return s&&s.nodeType===yt.ELEMENT_NODE}function Kg(s){return s&&s.nodeType===yt.TEXT_NODE}function AT(s,e){var i=s.childNodes||[];if(Ms(i,Ls)||wr(e))return!1;var r=Ms(i,wr);return!(e&&r&&i.indexOf(r)>i.indexOf(e))}function DT(s,e){var i=s.childNodes||[];function r(u){return Ls(u)&&u!==e}if(Ms(i,r))return!1;var o=Ms(i,wr);return!(e&&o&&i.indexOf(o)>i.indexOf(e))}function aO(s,e,i){if(!sO(s))throw new Xt(rn,"Unexpected parent node type "+s.nodeType);if(i&&i.parentNode!==s)throw new Xt(yT,"child not in parent");if(!rO(e)||wr(e)&&s.nodeType!==yt.DOCUMENT_NODE)throw new Xt(rn,"Unexpected node type "+e.nodeType+" for parent node type "+s.nodeType)}function oO(s,e,i){var r=s.childNodes||[],o=e.childNodes||[];if(e.nodeType===yt.DOCUMENT_FRAGMENT_NODE){var u=o.filter(Ls);if(u.length>1||Ms(o,Kg))throw new Xt(rn,"More than one element or text in fragment");if(u.length===1&&!AT(s,i))throw new Xt(rn,"Element in fragment can not be inserted before doctype")}if(Ls(e)&&!AT(s,i))throw new Xt(rn,"Only one element can be added and only after doctype");if(wr(e)){if(Ms(r,wr))throw new Xt(rn,"Only one doctype is allowed");var c=Ms(r,Ls);if(i&&r.indexOf(c)1||Ms(o,Kg))throw new Xt(rn,"More than one element or text in fragment");if(u.length===1&&!DT(s,i))throw new Xt(rn,"Element in fragment can not be inserted before doctype")}if(Ls(e)&&!DT(s,i))throw new Xt(rn,"Only one element can be added and only after doctype");if(wr(e)){if(Ms(r,function(g){return wr(g)&&g!==i}))throw new Xt(rn,"Only one doctype is allowed");var c=Ms(r,Ls);if(i&&r.indexOf(c)0&&rd(i.documentElement,function(o){if(o!==i&&o.nodeType===cs){var u=o.getAttribute("class");if(u){var c=s===u;if(!c){var p=cT(u);c=e.every(eO(p))}c&&r.push(o)}}}),r})},createElement:function(s){var e=new Co;e.ownerDocument=this,e.nodeName=s,e.tagName=s,e.localName=s,e.childNodes=new Dr;var i=e.attributes=new Uf;return i._ownerElement=e,e},createDocumentFragment:function(){var s=new zf;return s.ownerDocument=this,s.childNodes=new Dr,s},createTextNode:function(s){var e=new Zg;return e.ownerDocument=this,e.appendData(s),e},createComment:function(s){var e=new Jg;return e.ownerDocument=this,e.appendData(s),e},createCDATASection:function(s){var e=new e0;return e.ownerDocument=this,e.appendData(s),e},createProcessingInstruction:function(s,e){var i=new i0;return i.ownerDocument=this,i.tagName=i.nodeName=i.target=s,i.nodeValue=i.data=e,i},createAttribute:function(s){var e=new Ff;return e.ownerDocument=this,e.name=s,e.nodeName=s,e.localName=s,e.specified=!0,e},createEntityReference:function(s){var e=new t0;return e.ownerDocument=this,e.nodeName=s,e},createElementNS:function(s,e){var i=new Co,r=e.split(":"),o=i.attributes=new Uf;return i.childNodes=new Dr,i.ownerDocument=this,i.nodeName=e,i.tagName=e,i.namespaceURI=s,r.length==2?(i.prefix=r[0],i.localName=r[1]):i.localName=e,o._ownerElement=i,i},createAttributeNS:function(s,e){var i=new Ff,r=e.split(":");return i.ownerDocument=this,i.nodeName=e,i.name=e,i.namespaceURI=s,i.specified=!0,r.length==2?(i.prefix=r[0],i.localName=r[1]):i.localName=e,i}},nn(ad,yt);function Co(){this._nsMap={}}Co.prototype={nodeType:cs,hasAttribute:function(s){return this.getAttributeNode(s)!=null},getAttribute:function(s){var e=this.getAttributeNode(s);return e&&e.value||""},getAttributeNode:function(s){return this.attributes.getNamedItem(s)},setAttribute:function(s,e){var i=this.ownerDocument.createAttribute(s);i.value=i.nodeValue=""+e,this.setAttributeNode(i)},removeAttribute:function(s){var e=this.getAttributeNode(s);e&&this.removeAttributeNode(e)},appendChild:function(s){return s.nodeType===Ar?this.insertBefore(s,null):lO(this,s)},setAttributeNode:function(s){return this.attributes.setNamedItem(s)},setAttributeNodeNS:function(s){return this.attributes.setNamedItemNS(s)},removeAttributeNode:function(s){return this.attributes.removeNamedItem(s.nodeName)},removeAttributeNS:function(s,e){var i=this.getAttributeNodeNS(s,e);i&&this.removeAttributeNode(i)},hasAttributeNS:function(s,e){return this.getAttributeNodeNS(s,e)!=null},getAttributeNS:function(s,e){var i=this.getAttributeNodeNS(s,e);return i&&i.value||""},setAttributeNS:function(s,e,i){var r=this.ownerDocument.createAttributeNS(s,e);r.value=r.nodeValue=""+i,this.setAttributeNode(r)},getAttributeNodeNS:function(s,e){return this.attributes.getNamedItemNS(s,e)},getElementsByTagName:function(s){return new jl(this,function(e){var i=[];return rd(e,function(r){r!==e&&r.nodeType==cs&&(s==="*"||r.tagName==s)&&i.push(r)}),i})},getElementsByTagNameNS:function(s,e){return new jl(this,function(i){var r=[];return rd(i,function(o){o!==i&&o.nodeType===cs&&(s==="*"||o.namespaceURI===s)&&(e==="*"||o.localName==e)&&r.push(o)}),r})}},ad.prototype.getElementsByTagName=Co.prototype.getElementsByTagName,ad.prototype.getElementsByTagNameNS=Co.prototype.getElementsByTagNameNS,nn(Co,yt);function Ff(){}Ff.prototype.nodeType=zl,nn(Ff,yt);function od(){}od.prototype={data:"",substringData:function(s,e){return this.data.substring(s,s+e)},appendData:function(s){s=this.data+s,this.nodeValue=this.data=s,this.length=s.length},insertData:function(s,e){this.replaceData(s,0,e)},appendChild:function(s){throw new Error(ci[rn])},deleteData:function(s,e){this.replaceData(s,e,"")},replaceData:function(s,e,i){var r=this.data.substring(0,s),o=this.data.substring(s+e);i=r+i+o,this.nodeValue=this.data=i,this.length=i.length}},nn(od,yt);function Zg(){}Zg.prototype={nodeName:"#text",nodeType:Pf,splitText:function(s){var e=this.data,i=e.substring(s);e=e.substring(0,s),this.data=this.nodeValue=e,this.length=e.length;var r=this.ownerDocument.createTextNode(i);return this.parentNode&&this.parentNode.insertBefore(r,this.nextSibling),r}},nn(Zg,od);function Jg(){}Jg.prototype={nodeName:"#comment",nodeType:pT},nn(Jg,od);function e0(){}e0.prototype={nodeName:"#cdata-section",nodeType:dT},nn(e0,od);function Hf(){}Hf.prototype.nodeType=gT,nn(Hf,yt);function kT(){}kT.prototype.nodeType=iO,nn(kT,yt);function OT(){}OT.prototype.nodeType=tO,nn(OT,yt);function t0(){}t0.prototype.nodeType=hT,nn(t0,yt);function zf(){}zf.prototype.nodeName="#document-fragment",zf.prototype.nodeType=Ar,nn(zf,yt);function i0(){}i0.prototype.nodeType=fT,nn(i0,yt);function RT(){}RT.prototype.serializeToString=function(s,e,i){return MT.call(s,e,i)},yt.prototype.toString=MT;function MT(s,e){var i=[],r=this.nodeType==9&&this.documentElement||this,o=r.prefix,u=r.namespaceURI;if(u&&o==null){var o=r.lookupPrefix(u);if(o==null)var c=[{namespace:u,prefix:null}]}return ql(this,i,s,e,c),i.join("")}function LT(s,e,i){var r=s.prefix||"",o=s.namespaceURI;if(!o||r==="xml"&&o===nd.XML||o===nd.XMLNS)return!1;for(var u=i.length;u--;){var c=i[u];if(c.prefix===r)return c.namespace!==o}return!0}function n0(s,e,i){s.push(" ",e,'="',i.replace(/[<>&"\t\n\r]/g,xT),'"')}function ql(s,e,i,r,o){if(o||(o=[]),r)if(s=r(s),s){if(typeof s=="string"){e.push(s);return}}else return;switch(s.nodeType){case cs:var u=s.attributes,c=u.length,H=s.firstChild,p=s.tagName;i=nd.isHTML(s.namespaceURI)||i;var g=p;if(!i&&!s.prefix&&s.namespaceURI){for(var b,S=0;S=0;E--){var A=o[E];if(A.prefix===""&&A.namespace===s.namespaceURI){b=A.namespace;break}}if(b!==s.namespaceURI)for(var E=o.length-1;E>=0;E--){var A=o[E];if(A.namespace===s.namespaceURI){A.prefix&&(g=A.prefix+":"+p);break}}}e.push("<",g);for(var M=0;M"),i&&/^script$/i.test(p))for(;H;)H.data?e.push(H.data):ql(H,e,i,r,o.slice()),H=H.nextSibling;else for(;H;)ql(H,e,i,r,o.slice()),H=H.nextSibling;e.push("")}else e.push("/>");return;case mT:case Ar:for(var H=s.firstChild;H;)ql(H,e,i,r,o.slice()),H=H.nextSibling;return;case zl:return n0(e,s.name,s.value);case Pf:return e.push(s.data.replace(/[<&>]/g,xT));case dT:return e.push("");case pT:return e.push("");case gT:var Y=s.publicId,$=s.systemId;if(e.push("");else if($&&$!=".")e.push(" SYSTEM ",$,">");else{var Q=s.internalSubset;Q&&e.push(" [",Q,"]"),e.push(">")}return;case fT:return e.push("");case hT:return e.push("&",s.nodeName,";");default:e.push("??",s.nodeName)}}function IT(s,e,i){var r;switch(e.nodeType){case cs:r=e.cloneNode(!1),r.ownerDocument=s;case Ar:break;case zl:i=!0;break}if(r||(r=e.cloneNode(!1)),r.ownerDocument=s,r.parentNode=null,i)for(var o=e.firstChild;o;)r.appendChild(IT(s,o,i)),o=o.nextSibling;return r}function s0(s,e,i){var r=new e.constructor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var u=e[o];typeof u!="object"&&u!=r[o]&&(r[o]=u)}switch(e.childNodes&&(r.childNodes=new Dr),r.ownerDocument=s,r.nodeType){case cs:var c=e.attributes,p=r.attributes=new Uf,g=c.length;p._ownerElement=r;for(var b=0;b",lt:"<",quot:'"'}),s.HTML_ENTITIES=e({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"⁡",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"⁡",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"⁣",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"⁣",InvisibleTimes:"⁢",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"⁢",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"‎",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"​",NegativeThickSpace:"​",NegativeThinSpace:"​",NegativeVeryThinSpace:"​",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:` +`,nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"⁠",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"‏",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"­",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:" ",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:"  ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"​",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"‍",zwnj:"‌"}),s.entityMap=s.HTML_ENTITIES})(PT);var r0={},ld=Cr.NAMESPACE,a0=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,UT=new RegExp("[\\-\\.0-9"+a0.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),BT=new RegExp("^"+a0.source+UT.source+"*(?::"+a0.source+UT.source+"*)?$"),ud=0,Sa=1,Vl=2,cd=3,$l=4,Gl=5,dd=6,qf=7;function Xl(s,e){this.message=s,this.locator=e,Error.captureStackTrace&&Error.captureStackTrace(this,Xl)}Xl.prototype=new Error,Xl.prototype.name=Xl.name;function FT(){}FT.prototype={parse:function(s,e,i){var r=this.domBuilder;r.startDocument(),jT(e,e={}),uO(s,e,i,r,this.errorHandler),r.endDocument()}};function uO(s,e,i,r,o){function u(de){if(de>65535){de-=65536;var Ee=55296+(de>>10),Re=56320+(de&1023);return String.fromCharCode(Ee,Re)}else return String.fromCharCode(de)}function c(de){var Ee=de.slice(1,-1);return Object.hasOwnProperty.call(i,Ee)?i[Ee]:Ee.charAt(0)==="#"?u(parseInt(Ee.substr(1).replace("x","0x"))):(o.error("entity not found:"+de),de)}function p(de){if(de>D){var Ee=s.substring(D,de).replace(/&#?\w+;/g,c);A&&g(D),r.characters(Ee,0,de-D),D=de}}function g(de,Ee){for(;de>=S&&(Ee=E.exec(s));)b=Ee.index,S=b+Ee[0].length,A.lineNumber++;A.columnNumber=de-b+1}for(var b=0,S=0,E=/.*(?:\r\n?|\n)|.*$/g,A=r.locator,M=[{currentNSMap:e}],U={},D=0;;){try{var z=s.indexOf("<",D);if(z<0){if(!s.substr(D).match(/^\s*$/)){var H=r.doc,Y=H.createTextNode(s.substr(D));H.appendChild(Y),r.currentElement=Y}return}switch(z>D&&p(z),s.charAt(z+1)){case"/":var fe=s.indexOf(">",z+3),$=s.substring(z+2,fe).replace(/[ \t\n\r]+$/g,""),Q=M.pop();fe<0?($=s.substring(z+2).replace(/[\s<].*/,""),o.error("end tag name: "+$+" is not complete:"+Q.tagName),fe=z+1+$.length):$.match(/\sD?D=fe:p(Math.max(z,D)+1)}}function HT(s,e){return e.lineNumber=s.lineNumber,e.columnNumber=s.columnNumber,e}function cO(s,e,i,r,o,u){function c(A,M,U){i.attributeNames.hasOwnProperty(A)&&u.fatalError("Attribute "+A+" redefined"),i.addValue(A,M.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,o),U)}for(var p,g,b=++e,S=ud;;){var E=s.charAt(b);switch(E){case"=":if(S===Sa)p=s.slice(e,b),S=cd;else if(S===Vl)S=cd;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(S===cd||S===Sa)if(S===Sa&&(u.warning('attribute value must after "="'),p=s.slice(e,b)),e=b+1,b=s.indexOf(E,e),b>0)g=s.slice(e,b),c(p,g,e-1),S=Gl;else throw new Error("attribute value no end '"+E+"' match");else if(S==$l)g=s.slice(e,b),c(p,g,e),u.warning('attribute "'+p+'" missed start quot('+E+")!!"),e=b+1,S=Gl;else throw new Error('attribute value must after "="');break;case"/":switch(S){case ud:i.setTagName(s.slice(e,b));case Gl:case dd:case qf:S=qf,i.closed=!0;case $l:case Sa:break;case Vl:i.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return u.error("unexpected end of input"),S==ud&&i.setTagName(s.slice(e,b)),b;case">":switch(S){case ud:i.setTagName(s.slice(e,b));case Gl:case dd:case qf:break;case $l:case Sa:g=s.slice(e,b),g.slice(-1)==="/"&&(i.closed=!0,g=g.slice(0,-1));case Vl:S===Vl&&(g=p),S==$l?(u.warning('attribute "'+g+'" missed quot(")!'),c(p,g,e)):((!ld.isHTML(r[""])||!g.match(/^(?:disabled|checked|selected)$/i))&&u.warning('attribute "'+g+'" missed value!! "'+g+'" instead!!'),c(g,g,e));break;case cd:throw new Error("attribute value missed!!")}return b;case"€":E=" ";default:if(E<=" ")switch(S){case ud:i.setTagName(s.slice(e,b)),S=dd;break;case Sa:p=s.slice(e,b),S=Vl;break;case $l:var g=s.slice(e,b);u.warning('attribute "'+g+'" missed quot(")!!'),c(p,g,e);case Gl:S=dd;break}else switch(S){case Vl:i.tagName,(!ld.isHTML(r[""])||!p.match(/^(?:disabled|checked|selected)$/i))&&u.warning('attribute "'+p+'" missed value!! "'+p+'" instead2!!'),c(p,p,e),e=b,S=Sa;break;case Gl:u.warning('attribute space is required"'+p+'"!!');case dd:S=Sa,e=b;break;case cd:S=$l,e=b;break;case qf:throw new Error("elements closed character '/' and '>' must be connected to")}}b++}}function zT(s,e,i){for(var r=s.tagName,o=null,E=s.length;E--;){var u=s[E],c=u.qName,p=u.value,A=c.indexOf(":");if(A>0)var g=u.prefix=c.slice(0,A),b=c.slice(A+1),S=g==="xmlns"&&b;else b=c,g=null,S=c==="xmlns"&&"";u.localName=b,S!==!1&&(o==null&&(o={},jT(i,i={})),i[S]=o[S]=p,u.uri=ld.XMLNS,e.startPrefixMapping(S,p))}for(var E=s.length;E--;){u=s[E];var g=u.prefix;g&&(g==="xml"&&(u.uri=ld.XML),g!=="xmlns"&&(u.uri=i[g||""]))}var A=r.indexOf(":");A>0?(g=s.prefix=r.slice(0,A),b=s.localName=r.slice(A+1)):(g=null,b=s.localName=r);var M=s.uri=i[g||""];if(e.startElement(M,b,r,s),s.closed){if(e.endElement(M,b,r),o)for(g in o)Object.prototype.hasOwnProperty.call(o,g)&&e.endPrefixMapping(g)}else return s.currentNSMap=i,s.localNSMap=o,!0}function dO(s,e,i,r,o){if(/^(?:script|textarea)$/i.test(i)){var u=s.indexOf("",e),c=s.substring(e+1,u);if(/[&<]/.test(c))return/^script$/i.test(i)?(o.characters(c,0,c.length),u):(c=c.replace(/&#?\w+;/g,r),o.characters(c,0,c.length),u)}return e+1}function hO(s,e,i,r){var o=r[i];return o==null&&(o=s.lastIndexOf(""),o",e+4);return u>e?(i.comment(s,e+4,u-e-4),u+3):(r.error("Unclosed comment"),-1)}else return-1;default:if(s.substr(e+3,6)=="CDATA["){var u=s.indexOf("]]>",e+9);return i.startCDATA(),i.characters(s,e+9,u-e-9),i.endCDATA(),u+3}var c=mO(s,e),p=c.length;if(p>1&&/!doctype/i.test(c[0][0])){var g=c[1][0],b=!1,S=!1;p>3&&(/^public$/i.test(c[2][0])?(b=c[3][0],S=p>4&&c[4][0]):/^system$/i.test(c[2][0])&&(S=c[3][0]));var E=c[p-1];return i.startDTD(g,b,S),i.endDTD(),E.index+E[0].length}}return-1}function pO(s,e,i){var r=s.indexOf("?>",e);if(r){var o=s.substring(e,r).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return o?(o[0].length,i.processingInstruction(o[1],o[2]),r+2):-1}return-1}function qT(){this.attributeNames={}}qT.prototype={setTagName:function(s){if(!BT.test(s))throw new Error("invalid tagName:"+s);this.tagName=s},addValue:function(s,e,i){if(!BT.test(s))throw new Error("invalid attribute:"+s);this.attributeNames[s]=this.length,this[this.length++]={qName:s,value:e,offset:i}},length:0,getLocalName:function(s){return this[s].localName},getLocator:function(s){return this[s].locator},getQName:function(s){return this[s].qName},getURI:function(s){return this[s].uri},getValue:function(s){return this[s].value}};function mO(s,e){var i,r=[],o=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(o.lastIndex=e,o.exec(s);i=o.exec(s);)if(r.push(i),i[1])return r}r0.XMLReader=FT,r0.ParseError=Xl;var gO=Cr,yO=Ta,VT=PT,$T=r0,vO=yO.DOMImplementation,GT=gO.NAMESPACE,bO=$T.ParseError,_O=$T.XMLReader;function XT(s){return s.replace(/\r[\n\u0085]/g,` `).replace(/[\r\u0085\u2028]/g,` `)}function YT(s){this.options=s||{locator:{}}}YT.prototype.parseFromString=function(s,e){var i=this.options,r=new _O,o=i.domBuilder||new hd,u=i.errorHandler,c=i.locator,p=i.xmlns||{},g=/\/x?html?$/.test(e),b=g?VT.HTML_ENTITIES:VT.XML_ENTITIES;c&&o.setDocumentLocator(c),r.errorHandler=TO(u,o,c),r.domBuilder=i.domBuilder||o,g&&(p[""]=GT.HTML),p.xml=p.xml||GT.XML;var S=i.normalizeLineEndings||XT;return s&&typeof s=="string"?r.parse(S(s),p,b):r.errorHandler.error("invalid doc source"),o.doc};function TO(s,e,i){if(!s){if(e instanceof hd)return e;s=e}var r={},o=s instanceof Function;i=i||{};function u(c){var p=s[c];!p&&o&&(p=s.length==2?function(g){s(c,g)}:s),r[c]=p&&function(g){p("[xmldom "+c+"] "+g+o0(i))}||function(){}}return u("warning"),u("error"),u("fatalError"),r}function hd(){this.cdata=!1}function Yl(s,e){e.lineNumber=s.lineNumber,e.columnNumber=s.columnNumber}hd.prototype={startDocument:function(){this.doc=new vO().createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(s,e,i,r){var o=this.doc,u=o.createElementNS(s,i||e),c=r.length;Vf(this,u),this.currentElement=u,this.locator&&Yl(this.locator,u);for(var p=0;p=e+i||e?new java.lang.String(s,e,i)+"":s}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(s){hd.prototype[s]=function(){return null}});function Vf(s,e){s.currentElement?s.currentElement.appendChild(e):s.doc.appendChild(e)}jf.__DOMHandler=hd,jf.normalizeLineEndings=XT,jf.DOMParser=YT;var SO=jf.DOMParser;/*! @name mpd-parser @version 1.3.1 @license Apache-2.0 */const QT=s=>!!s&&typeof s=="object",di=(...s)=>s.reduce((e,i)=>(typeof i!="object"||Object.keys(i).forEach(r=>{Array.isArray(e[r])&&Array.isArray(i[r])?e[r]=e[r].concat(i[r]):QT(e[r])&&QT(i[r])?e[r]=di(e[r],i[r]):e[r]=i[r]}),e),{}),KT=s=>Object.keys(s).map(e=>s[e]),xO=(s,e)=>{const i=[];for(let r=s;rs.reduce((e,i)=>e.concat(i),[]),ZT=s=>{if(!s.length)return[];const e=[];for(let i=0;is.reduce((i,r,o)=>(r[e]&&i.push(o),i),[]),CO=(s,e)=>KT(s.reduce((i,r)=>(r.forEach(o=>{i[e(o)]=o}),i),{}));var Ql={INVALID_NUMBER_OF_PERIOD:"INVALID_NUMBER_OF_PERIOD",INVALID_NUMBER_OF_CONTENT_STEERING:"INVALID_NUMBER_OF_CONTENT_STEERING",DASH_EMPTY_MANIFEST:"DASH_EMPTY_MANIFEST",DASH_INVALID_XML:"DASH_INVALID_XML",NO_BASE_URL:"NO_BASE_URL",MISSING_SEGMENT_INFORMATION:"MISSING_SEGMENT_INFORMATION",SEGMENT_TIME_UNSPECIFIED:"SEGMENT_TIME_UNSPECIFIED",UNSUPPORTED_UTC_TIMING_SCHEME:"UNSUPPORTED_UTC_TIMING_SCHEME"};const fd=({baseUrl:s="",source:e="",range:i="",indexRange:r=""})=>{const o={uri:e,resolvedUri:Nf(s||"",e)};if(i||r){const c=(i||r).split("-");let p=P.BigInt?P.BigInt(c[0]):parseInt(c[0],10),g=P.BigInt?P.BigInt(c[1]):parseInt(c[1],10);p{let e;return typeof s.offset=="bigint"||typeof s.length=="bigint"?e=P.BigInt(s.offset)+P.BigInt(s.length)-P.BigInt(1):e=s.offset+s.length-1,`${s.offset}-${e}`},JT=s=>(s&&typeof s!="number"&&(s=parseInt(s,10)),isNaN(s)?null:s),DO={static(s){const{duration:e,timescale:i=1,sourceDuration:r,periodDuration:o}=s,u=JT(s.endNumber),c=e/i;return typeof u=="number"?{start:0,end:u}:typeof o=="number"?{start:0,end:o/c}:{start:0,end:r/c}},dynamic(s){const{NOW:e,clientOffset:i,availabilityStartTime:r,timescale:o=1,duration:u,periodStart:c=0,minimumUpdatePeriod:p=0,timeShiftBufferDepth:g=1/0}=s,b=JT(s.endNumber),S=(e+i)/1e3,E=r+c,M=S+p-E,U=Math.ceil(M*o/u),D=Math.floor((S-E-g)*o/u),z=Math.floor((S-E)*o/u);return{start:Math.max(0,D),end:typeof b=="number"?b:Math.min(U,z)}}},wO=s=>e=>{const{duration:i,timescale:r=1,periodStart:o,startNumber:u=1}=s;return{number:u+e,duration:i/r,timeline:o,time:e*i}},l0=s=>{const{type:e,duration:i,timescale:r=1,periodDuration:o,sourceDuration:u}=s,{start:c,end:p}=DO[e](s),g=xO(c,p).map(wO(s));if(e==="static"){const b=g.length-1,S=typeof o=="number"?o:u;g[b].duration=S-i/r*b}return g},e1=s=>{const{baseUrl:e,initialization:i={},sourceDuration:r,indexRange:o="",periodStart:u,presentationTime:c,number:p=0,duration:g}=s;if(!e)throw new Error(Ql.NO_BASE_URL);const b=fd({baseUrl:e,source:i.sourceURL,range:i.range}),S=fd({baseUrl:e,source:e,indexRange:o});if(S.map=b,g){const E=l0(s);E.length&&(S.duration=E[0].duration,S.timeline=E[0].timeline)}else r&&(S.duration=r,S.timeline=u);return S.presentationTime=c||u,S.number=p,[S]},u0=(s,e,i)=>{const r=s.sidx.map?s.sidx.map:null,o=s.sidx.duration,u=s.timeline||0,c=s.sidx.byterange,p=c.offset+c.length,g=e.timescale,b=e.references.filter(z=>z.referenceType!==1),S=[],E=s.endList?"static":"dynamic",A=s.sidx.timeline;let M=A,U=s.mediaSequence||0,D;typeof e.firstOffset=="bigint"?D=P.BigInt(p)+e.firstOffset:D=p+e.firstOffset;for(let z=0;zCO(s,({timeline:e})=>e).sort((e,i)=>e.timeline>i.timeline?1:-1),RO=(s,e)=>{for(let i=0;i{let e=[];return Yk(s,kO,(i,r,o,u)=>{e=e.concat(i.playlists||[])}),e},n1=({playlist:s,mediaSequence:e})=>{s.mediaSequence=e,s.segments.forEach((i,r)=>{i.number=s.mediaSequence+r})},MO=({oldPlaylists:s,newPlaylists:e,timelineStarts:i})=>{e.forEach(r=>{r.discontinuitySequence=i.findIndex(function({timeline:g}){return g===r.timeline});const o=RO(s,r.attributes.NAME);if(!o||r.sidx)return;const u=r.segments[0],c=o.segments.findIndex(function(g){return Math.abs(g.presentationTime-u.presentationTime)o.timeline||o.segments.length&&r.timeline>o.segments[o.segments.length-1].timeline)&&r.discontinuitySequence--;return}o.segments[c].discontinuity&&!u.discontinuity&&(u.discontinuity=!0,r.discontinuityStarts.unshift(0),r.discontinuitySequence--),n1({playlist:r,mediaSequence:o.segments[c].number})})},LO=({oldManifest:s,newManifest:e})=>{const i=s.playlists.concat(i1(s)),r=e.playlists.concat(i1(e));return e.timelineStarts=t1([s.timelineStarts,e.timelineStarts]),MO({oldPlaylists:i,newPlaylists:r,timelineStarts:e.timelineStarts}),e},$f=s=>s&&s.uri+"-"+AO(s.byterange),c0=s=>{const e=s.reduce(function(r,o){return r[o.attributes.baseUrl]||(r[o.attributes.baseUrl]=[]),r[o.attributes.baseUrl].push(o),r},{});let i=[];return Object.values(e).forEach(r=>{const o=KT(r.reduce((u,c)=>{const p=c.attributes.id+(c.attributes.lang||"");return u[p]?(c.segments&&(c.segments[0]&&(c.segments[0].discontinuity=!0),u[p].segments.push(...c.segments)),c.attributes.contentProtection&&(u[p].attributes.contentProtection=c.attributes.contentProtection)):(u[p]=c,u[p].attributes.timelineStarts=[]),u[p].attributes.timelineStarts.push({start:c.attributes.periodStart,timeline:c.attributes.periodStart}),u},{}));i=i.concat(o)}),i.map(r=>(r.discontinuityStarts=EO(r.segments||[],"discontinuity"),r))},d0=(s,e)=>{const i=$f(s.sidx),r=i&&e[i]&&e[i].sidx;return r&&u0(s,r,s.sidx.resolvedUri),s},IO=(s,e={})=>{if(!Object.keys(e).length)return s;for(const i in s)s[i]=d0(s[i],e);return s},NO=({attributes:s,segments:e,sidx:i,mediaSequence:r,discontinuitySequence:o,discontinuityStarts:u},c)=>{const p={attributes:{NAME:s.id,BANDWIDTH:s.bandwidth,CODECS:s.codecs,"PROGRAM-ID":1},uri:"",endList:s.type==="static",timeline:s.periodStart,resolvedUri:s.baseUrl||"",targetDuration:s.duration,discontinuitySequence:o,discontinuityStarts:u,timelineStarts:s.timelineStarts,mediaSequence:r,segments:e};return s.contentProtection&&(p.contentProtection=s.contentProtection),s.serviceLocation&&(p.attributes.serviceLocation=s.serviceLocation),i&&(p.sidx=i),c&&(p.attributes.AUDIO="audio",p.attributes.SUBTITLES="subs"),p},PO=({attributes:s,segments:e,mediaSequence:i,discontinuityStarts:r,discontinuitySequence:o})=>{typeof e>"u"&&(e=[{uri:s.baseUrl,timeline:s.periodStart,resolvedUri:s.baseUrl||"",duration:s.sourceDuration,number:0}],s.duration=s.sourceDuration);const u={NAME:s.id,BANDWIDTH:s.bandwidth,"PROGRAM-ID":1};s.codecs&&(u.CODECS=s.codecs);const c={attributes:u,uri:"",endList:s.type==="static",timeline:s.periodStart,resolvedUri:s.baseUrl||"",targetDuration:s.duration,timelineStarts:s.timelineStarts,discontinuityStarts:r,discontinuitySequence:o,mediaSequence:i,segments:e};return s.serviceLocation&&(c.attributes.serviceLocation=s.serviceLocation),c},UO=(s,e={},i=!1)=>{let r;const o=s.reduce((u,c)=>{const p=c.attributes.role&&c.attributes.role.value||"",g=c.attributes.lang||"";let b=c.attributes.label||"main";if(g&&!c.attributes.label){const E=p?` (${p})`:"";b=`${c.attributes.lang}${E}`}u[b]||(u[b]={language:g,autoselect:!0,default:p==="main",playlists:[],uri:""});const S=d0(NO(c,i),e);return u[b].playlists.push(S),typeof r>"u"&&p==="main"&&(r=c,r.default=!0),u},{});if(!r){const u=Object.keys(o)[0];o[u].default=!0}return o},BO=(s,e={})=>s.reduce((i,r)=>{const o=r.attributes.label||r.attributes.lang||"text",u=r.attributes.lang||"und";return i[o]||(i[o]={language:u,default:!1,autoselect:!1,playlists:[],uri:""}),i[o].playlists.push(d0(PO(r),e)),i},{}),FO=s=>s.reduce((e,i)=>(i&&i.forEach(r=>{const{channel:o,language:u}=r;e[u]={autoselect:!1,default:!1,instreamId:o,language:u},r.hasOwnProperty("aspectRatio")&&(e[u].aspectRatio=r.aspectRatio),r.hasOwnProperty("easyReader")&&(e[u].easyReader=r.easyReader),r.hasOwnProperty("3D")&&(e[u]["3D"]=r["3D"])}),e),{}),HO=({attributes:s,segments:e,sidx:i,discontinuityStarts:r})=>{const o={attributes:{NAME:s.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:s.width,height:s.height},CODECS:s.codecs,BANDWIDTH:s.bandwidth,"PROGRAM-ID":1},uri:"",endList:s.type==="static",timeline:s.periodStart,resolvedUri:s.baseUrl||"",targetDuration:s.duration,discontinuityStarts:r,timelineStarts:s.timelineStarts,segments:e};return s.frameRate&&(o.attributes["FRAME-RATE"]=s.frameRate),s.contentProtection&&(o.contentProtection=s.contentProtection),s.serviceLocation&&(o.attributes.serviceLocation=s.serviceLocation),i&&(o.sidx=i),o},zO=({attributes:s})=>s.mimeType==="video/mp4"||s.mimeType==="video/webm"||s.contentType==="video",jO=({attributes:s})=>s.mimeType==="audio/mp4"||s.mimeType==="audio/webm"||s.contentType==="audio",qO=({attributes:s})=>s.mimeType==="text/vtt"||s.contentType==="text",VO=(s,e)=>{s.forEach(i=>{i.mediaSequence=0,i.discontinuitySequence=e.findIndex(function({timeline:r}){return r===i.timeline}),i.segments&&i.segments.forEach((r,o)=>{r.number=o})})},s1=s=>s?Object.keys(s).reduce((e,i)=>{const r=s[i];return e.concat(r.playlists)},[]):[],$O=({dashPlaylists:s,locations:e,contentSteering:i,sidxMapping:r={},previousManifest:o,eventStream:u})=>{if(!s.length)return{};const{sourceDuration:c,type:p,suggestedPresentationDelay:g,minimumUpdatePeriod:b}=s[0].attributes,S=c0(s.filter(zO)).map(HO),E=c0(s.filter(jO)),A=c0(s.filter(qO)),M=s.map(Q=>Q.attributes.captionServices).filter(Boolean),U={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:"",duration:c,playlists:IO(S,r)};b>=0&&(U.minimumUpdatePeriod=b*1e3),e&&(U.locations=e),i&&(U.contentSteering=i),p==="dynamic"&&(U.suggestedPresentationDelay=g),u&&u.length>0&&(U.eventStream=u);const D=U.playlists.length===0,z=E.length?UO(E,r,D):null,H=A.length?BO(A,r):null,Y=S.concat(s1(z),s1(H)),V=Y.map(({timelineStarts:Q})=>Q);return U.timelineStarts=t1(V),VO(Y,U.timelineStarts),z&&(U.mediaGroups.AUDIO.audio=z),H&&(U.mediaGroups.SUBTITLES.subs=H),M.length&&(U.mediaGroups["CLOSED-CAPTIONS"].cc=FO(M)),o?LO({oldManifest:o,newManifest:U}):U},GO=(s,e,i)=>{const{NOW:r,clientOffset:o,availabilityStartTime:u,timescale:c=1,periodStart:p=0,minimumUpdatePeriod:g=0}=s,b=(r+o)/1e3,S=u+p,A=b+g-S;return Math.ceil((A*c-e)/i)},r1=(s,e)=>{const{type:i,minimumUpdatePeriod:r=0,media:o="",sourceDuration:u,timescale:c=1,startNumber:p=1,periodStart:g}=s,b=[];let S=-1;for(let E=0;ES&&(S=D);let z;if(U<0){const V=E+1;V===e.length?i==="dynamic"&&r>0&&o.indexOf("$Number$")>0?z=GO(s,S,M):z=(u*c-S)/M:z=(e[V].t-S)/M}else z=U+1;const H=p+b.length+z;let Y=p+b.length;for(;Y(e,i,r,o)=>{if(e==="$$")return"$";if(typeof s[i]>"u")return e;const u=""+s[i];return i==="RepresentationID"||(r?o=parseInt(o,10):o=1,u.length>=o)?u:`${new Array(o-u.length+1).join("0")}${u}`},a1=(s,e)=>s.replace(XO,YO(e)),WO=(s,e)=>!s.duration&&!e?[{number:s.startNumber||1,duration:s.sourceDuration,time:0,timeline:s.periodStart}]:s.duration?l0(s):r1(s,e),QO=(s,e)=>{const i={RepresentationID:s.id,Bandwidth:s.bandwidth||0},{initialization:r={sourceURL:"",range:""}}=s,o=fd({baseUrl:s.baseUrl,source:a1(r.sourceURL,i),range:r.range});return WO(s,e).map(c=>{i.Number=c.number,i.Time=c.time;const p=a1(s.media||"",i),g=s.timescale||1,b=s.presentationTimeOffset||0,S=s.periodStart+(c.time-b)/g;return{uri:p,timeline:c.timeline,duration:c.duration,resolvedUri:Nf(s.baseUrl||"",p),map:o,number:c.number,presentationTime:S}})},KO=(s,e)=>{const{baseUrl:i,initialization:r={}}=s,o=fd({baseUrl:i,source:r.sourceURL,range:r.range}),u=fd({baseUrl:i,source:e.media,range:e.mediaRange});return u.map=o,u},ZO=(s,e)=>{const{duration:i,segmentUrls:r=[],periodStart:o}=s;if(!i&&!e||i&&e)throw new Error(Ql.SEGMENT_TIME_UNSPECIFIED);const u=r.map(g=>KO(s,g));let c;return i&&(c=l0(s)),e&&(c=r1(s,e)),c.map((g,b)=>{if(u[b]){const S=u[b],E=s.timescale||1,A=s.presentationTimeOffset||0;return S.timeline=g.timeline,S.duration=g.duration,S.number=g.number,S.presentationTime=o+(g.time-A)/E,S}}).filter(g=>g)},JO=({attributes:s,segmentInfo:e})=>{let i,r;e.template?(r=QO,i=di(s,e.template)):e.base?(r=e1,i=di(s,e.base)):e.list&&(r=ZO,i=di(s,e.list));const o={attributes:s};if(!r)return o;const u=r(i,e.segmentTimeline);if(i.duration){const{duration:c,timescale:p=1}=i;i.duration=c/p}else u.length?i.duration=u.reduce((c,p)=>Math.max(c,Math.ceil(p.duration)),0):i.duration=0;return o.attributes=i,o.segments=u,e.base&&i.indexRange&&(o.sidx=u[0],o.segments=[]),o},eR=s=>s.map(JO),Lt=(s,e)=>ZT(s.childNodes).filter(({tagName:i})=>i===e),pd=s=>s.textContent.trim(),tR=s=>parseFloat(s.split("/").reduce((e,i)=>e/i)),Kl=s=>{const p=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(s);if(!p)return 0;const[g,b,S,E,A,M]=p.slice(1);return parseFloat(g||0)*31536e3+parseFloat(b||0)*2592e3+parseFloat(S||0)*86400+parseFloat(E||0)*3600+parseFloat(A||0)*60+parseFloat(M||0)},iR=s=>(/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(s)&&(s+="Z"),Date.parse(s)),o1={mediaPresentationDuration(s){return Kl(s)},availabilityStartTime(s){return iR(s)/1e3},minimumUpdatePeriod(s){return Kl(s)},suggestedPresentationDelay(s){return Kl(s)},type(s){return s},timeShiftBufferDepth(s){return Kl(s)},start(s){return Kl(s)},width(s){return parseInt(s,10)},height(s){return parseInt(s,10)},bandwidth(s){return parseInt(s,10)},frameRate(s){return tR(s)},startNumber(s){return parseInt(s,10)},timescale(s){return parseInt(s,10)},presentationTimeOffset(s){return parseInt(s,10)},duration(s){const e=parseInt(s,10);return isNaN(e)?Kl(s):e},d(s){return parseInt(s,10)},t(s){return parseInt(s,10)},r(s){return parseInt(s,10)},presentationTime(s){return parseInt(s,10)},DEFAULT(s){return s}},Jt=s=>s&&s.attributes?ZT(s.attributes).reduce((e,i)=>{const r=o1[i.name]||o1.DEFAULT;return e[i.name]=r(i.value),e},{}):{},nR={"urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b":"org.w3.clearkey","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":"com.widevine.alpha","urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":"com.microsoft.playready","urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb":"com.adobe.primetime","urn:mpeg:dash:mp4protection:2011":"mp4protection"},Gf=(s,e)=>e.length?Wl(s.map(function(i){return e.map(function(r){const o=pd(r),u=Nf(i.baseUrl,o),c=di(Jt(r),{baseUrl:u});return u!==o&&!c.serviceLocation&&i.serviceLocation&&(c.serviceLocation=i.serviceLocation),c})})):s,h0=s=>{const e=Lt(s,"SegmentTemplate")[0],i=Lt(s,"SegmentList")[0],r=i&&Lt(i,"SegmentURL").map(E=>di({tag:"SegmentURL"},Jt(E))),o=Lt(s,"SegmentBase")[0],u=i||e,c=u&&Lt(u,"SegmentTimeline")[0],p=i||o||e,g=p&&Lt(p,"Initialization")[0],b=e&&Jt(e);b&&g?b.initialization=g&&Jt(g):b&&b.initialization&&(b.initialization={sourceURL:b.initialization});const S={template:b,segmentTimeline:c&&Lt(c,"S").map(E=>Jt(E)),list:i&&di(Jt(i),{segmentUrls:r,initialization:Jt(g)}),base:o&&di(Jt(o),{initialization:Jt(g)})};return Object.keys(S).forEach(E=>{S[E]||delete S[E]}),S},sR=(s,e,i)=>r=>{const o=Lt(r,"BaseURL"),u=Gf(e,o),c=di(s,Jt(r)),p=h0(r);return u.map(g=>({segmentInfo:di(i,p),attributes:di(c,g)}))},rR=s=>s.reduce((e,i)=>{const r=Jt(i);r.schemeIdUri&&(r.schemeIdUri=r.schemeIdUri.toLowerCase());const o=nR[r.schemeIdUri];if(o){e[o]={attributes:r};const u=Lt(i,"cenc:pssh")[0];if(u){const c=pd(u);e[o].pssh=c&&Z_(c)}}return e},{}),aR=s=>{if(s.schemeIdUri==="urn:scte:dash:cc:cea-608:2015")return(typeof s.value!="string"?[]:s.value.split(";")).map(i=>{let r,o;return o=i,/^CC\d=/.test(i)?[r,o]=i.split("="):/^CC\d$/.test(i)&&(r=i),{channel:r,language:o}});if(s.schemeIdUri==="urn:scte:dash:cc:cea-708:2015")return(typeof s.value!="string"?[]:s.value.split(";")).map(i=>{const r={channel:void 0,language:void 0,aspectRatio:1,easyReader:0,"3D":0};if(/=/.test(i)){const[o,u=""]=i.split("=");r.channel=o,r.language=i,u.split(",").forEach(c=>{const[p,g]=c.split(":");p==="lang"?r.language=g:p==="er"?r.easyReader=Number(g):p==="war"?r.aspectRatio=Number(g):p==="3D"&&(r["3D"]=Number(g))})}else r.language=i;return r.channel&&(r.channel="SERVICE"+r.channel),r})},oR=s=>Wl(Lt(s.node,"EventStream").map(e=>{const i=Jt(e),r=i.schemeIdUri;return Lt(e,"Event").map(o=>{const u=Jt(o),c=u.presentationTime||0,p=i.timescale||1,g=u.duration||0,b=c/p+s.attributes.start;return{schemeIdUri:r,value:i.value,id:u.id,start:b,end:b+g/p,messageData:pd(o)||u.messageData,contentEncoding:i.contentEncoding,presentationTimeOffset:i.presentationTimeOffset||0}})})),lR=(s,e,i)=>r=>{const o=Jt(r),u=Gf(e,Lt(r,"BaseURL")),c=Lt(r,"Role")[0],p={role:Jt(c)};let g=di(s,o,p);const b=Lt(r,"Accessibility")[0],S=aR(Jt(b));S&&(g=di(g,{captionServices:S}));const E=Lt(r,"Label")[0];if(E&&E.childNodes.length){const z=E.childNodes[0].nodeValue.trim();g=di(g,{label:z})}const A=rR(Lt(r,"ContentProtection"));Object.keys(A).length&&(g=di(g,{contentProtection:A}));const M=h0(r),U=Lt(r,"Representation"),D=di(i,M);return Wl(U.map(sR(g,u,D)))},uR=(s,e)=>(i,r)=>{const o=Gf(e,Lt(i.node,"BaseURL")),u=di(s,{periodStart:i.attributes.start});typeof i.attributes.duration=="number"&&(u.periodDuration=i.attributes.duration);const c=Lt(i.node,"AdaptationSet"),p=h0(i.node);return Wl(c.map(lR(u,o,p)))},cR=(s,e)=>{if(s.length>1&&e({type:"warn",message:"The MPD manifest should contain no more than one ContentSteering tag"}),!s.length)return null;const i=di({serverURL:pd(s[0])},Jt(s[0]));return i.queryBeforeStart=i.queryBeforeStart==="true",i},dR=({attributes:s,priorPeriodAttributes:e,mpdType:i})=>typeof s.start=="number"?s.start:e&&typeof e.start=="number"&&typeof e.duration=="number"?e.start+e.duration:!e&&i==="static"?0:null,hR=(s,e={})=>{const{manifestUri:i="",NOW:r=Date.now(),clientOffset:o=0,eventHandler:u=function(){}}=e,c=Lt(s,"Period");if(!c.length)throw new Error(Ql.INVALID_NUMBER_OF_PERIOD);const p=Lt(s,"Location"),g=Jt(s),b=Gf([{baseUrl:i}],Lt(s,"BaseURL")),S=Lt(s,"ContentSteering");g.type=g.type||"static",g.sourceDuration=g.mediaPresentationDuration||0,g.NOW=r,g.clientOffset=o,p.length&&(g.locations=p.map(pd));const E=[];return c.forEach((A,M)=>{const U=Jt(A),D=E[M-1];U.start=dR({attributes:U,priorPeriodAttributes:D?D.attributes:null,mpdType:g.type}),E.push({node:A,attributes:U})}),{locations:g.locations,contentSteeringInfo:cR(S,u),representationInfo:Wl(E.map(uR(g,b))),eventStream:Wl(E.map(oR))}},l1=s=>{if(s==="")throw new Error(Ql.DASH_EMPTY_MANIFEST);const e=new SO;let i,r;try{i=e.parseFromString(s,"application/xml"),r=i&&i.documentElement.tagName==="MPD"?i.documentElement:null}catch{}if(!r||r&&r.getElementsByTagName("parsererror").length>0)throw new Error(Ql.DASH_INVALID_XML);return r},fR=s=>{const e=Lt(s,"UTCTiming")[0];if(!e)return null;const i=Jt(e);switch(i.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":i.method="HEAD";break;case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":i.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":i.method="DIRECT",i.value=Date.parse(i.value);break;case"urn:mpeg:dash:utc:http-ntp:2014":case"urn:mpeg:dash:utc:ntp:2014":case"urn:mpeg:dash:utc:sntp:2014":default:throw new Error(Ql.UNSUPPORTED_UTC_TIMING_SCHEME)}return i},pR=(s,e={})=>{const i=hR(l1(s),e),r=eR(i.representationInfo);return $O({dashPlaylists:r,locations:i.locations,contentSteering:i.contentSteeringInfo,sidxMapping:e.sidxMapping,previousManifest:e.previousManifest,eventStream:i.eventStream})},mR=s=>fR(l1(s));var u1=Math.pow(2,32),gR=function(s){var e=new DataView(s.buffer,s.byteOffset,s.byteLength),i;return e.getBigUint64?(i=e.getBigUint64(0),i0;r+=12,o--)i.references.push({referenceType:(s[r]&128)>>>7,referencedSize:e.getUint32(r)&2147483647,subsegmentDuration:e.getUint32(r+4),startsWithSap:!!(s[r+8]&128),sapType:(s[r+8]&112)>>>4,sapDeltaTime:e.getUint32(r+8)&268435455});return i},bR=vR;const _R=Xc(bR);var TR=Ie([73,68,51]),SR=function(e,i){i===void 0&&(i=0),e=Ie(e);var r=e[i+5],o=e[i+6]<<21|e[i+7]<<14|e[i+8]<<7|e[i+9],u=(r&16)>>4;return u?o+20:o+10},md=function s(e,i){return i===void 0&&(i=0),e=Ie(e),e.length-i<10||!Mt(e,TR,{offset:i})?i:(i+=SR(e,i),s(e,i))},d1=function(e){return typeof e=="string"?aT(e):e},xR=function(e){return Array.isArray(e)?e.map(function(i){return d1(i)}):[d1(e)]},ER=function s(e,i,r){r===void 0&&(r=!1),i=xR(i),e=Ie(e);var o=[];if(!i.length)return o;for(var u=0;u>>0,p=e.subarray(u+4,u+8);if(c===0)break;var g=u+c;if(g>e.length){if(r)break;g=e.length}var b=e.subarray(u+8,g);Mt(p,i[0])&&(i.length===1?o.push(b):o.push.apply(o,s(b,i.slice(1),r))),u=g}return o},Xf={EBML:Ie([26,69,223,163]),DocType:Ie([66,130]),Segment:Ie([24,83,128,103]),SegmentInfo:Ie([21,73,169,102]),Tracks:Ie([22,84,174,107]),Track:Ie([174]),TrackNumber:Ie([215]),DefaultDuration:Ie([35,227,131]),TrackEntry:Ie([174]),TrackType:Ie([131]),FlagDefault:Ie([136]),CodecID:Ie([134]),CodecPrivate:Ie([99,162]),VideoTrack:Ie([224]),AudioTrack:Ie([225]),Cluster:Ie([31,67,182,117]),Timestamp:Ie([231]),TimestampScale:Ie([42,215,177]),BlockGroup:Ie([160]),BlockDuration:Ie([155]),Block:Ie([161]),SimpleBlock:Ie([163])},f0=[128,64,32,16,8,4,2,1],CR=function(e){for(var i=1,r=0;r=i.length)return i.length;var o=Yf(i,r,!1);if(Mt(e.bytes,o.bytes))return r;var u=Yf(i,r+o.length);return s(e,i,r+u.length+u.value+o.length)},f1=function s(e,i){i=AR(i),e=Ie(e);var r=[];if(!i.length)return r;for(var o=0;oe.length?e.length:p+c.value,b=e.subarray(p,g);Mt(i[0],u.bytes)&&(i.length===1?r.push(b):r=r.concat(s(b,i.slice(1))));var S=u.length+c.length+b.length;o+=S}return r},wR=Ie([0,0,0,1]),kR=Ie([0,0,1]),OR=Ie([0,0,3]),RR=function(e){for(var i=[],r=1;r>1&63),r.indexOf(b)!==-1&&(c=u+g),u+=g+(i==="h264"?1:2)}return e.subarray(0,0)},MR=function(e,i,r){return p1(e,"h264",i,r)},LR=function(e,i,r){return p1(e,"h265",i,r)},Vi={webm:Ie([119,101,98,109]),matroska:Ie([109,97,116,114,111,115,107,97]),flac:Ie([102,76,97,67]),ogg:Ie([79,103,103,83]),ac3:Ie([11,119]),riff:Ie([82,73,70,70]),avi:Ie([65,86,73]),wav:Ie([87,65,86,69]),"3gp":Ie([102,116,121,112,51,103]),mp4:Ie([102,116,121,112]),fmp4:Ie([115,116,121,112]),mov:Ie([102,116,121,112,113,116]),moov:Ie([109,111,111,118]),moof:Ie([109,111,111,102])},Zl={aac:function(e){var i=md(e);return Mt(e,[255,16],{offset:i,mask:[255,22]})},mp3:function(e){var i=md(e);return Mt(e,[255,2],{offset:i,mask:[255,6]})},webm:function(e){var i=f1(e,[Xf.EBML,Xf.DocType])[0];return Mt(i,Vi.webm)},mkv:function(e){var i=f1(e,[Xf.EBML,Xf.DocType])[0];return Mt(i,Vi.matroska)},mp4:function(e){if(Zl["3gp"](e)||Zl.mov(e))return!1;if(Mt(e,Vi.mp4,{offset:4})||Mt(e,Vi.fmp4,{offset:4})||Mt(e,Vi.moof,{offset:4})||Mt(e,Vi.moov,{offset:4}))return!0},mov:function(e){return Mt(e,Vi.mov,{offset:4})},"3gp":function(e){return Mt(e,Vi["3gp"],{offset:4})},ac3:function(e){var i=md(e);return Mt(e,Vi.ac3,{offset:i})},ts:function(e){if(e.length<189&&e.length>=1)return e[0]===71;for(var i=0;i+1880},g0=9e4,y0,v0,Wf,b0,m1,g1,y1;y0=function(s){return s*g0},v0=function(s,e){return s*e},Wf=function(s){return s/g0},b0=function(s,e){return s/e},m1=function(s,e){return y0(b0(s,e))},g1=function(s,e){return v0(Wf(s),e)},y1=function(s,e,i){return Wf(i?s:s-e)};var Ao={ONE_SECOND_IN_TS:g0,secondsToVideoTs:y0,secondsToAudioTs:v0,videoTsToSeconds:Wf,audioTsToSeconds:b0,audioTsToVideoTs:m1,videoTsToAudioTs:g1,metadataTsToSeconds:y1};/** +@`+(s.systemId||"")+"#[line:"+s.lineNumber+",col:"+s.columnNumber+"]"}function WT(s,e,i){return typeof s=="string"?s.substr(e,i):s.length>=e+i||e?new java.lang.String(s,e,i)+"":s}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(s){hd.prototype[s]=function(){return null}});function Vf(s,e){s.currentElement?s.currentElement.appendChild(e):s.doc.appendChild(e)}jf.__DOMHandler=hd,jf.normalizeLineEndings=XT,jf.DOMParser=YT;var SO=jf.DOMParser;/*! @name mpd-parser @version 1.3.1 @license Apache-2.0 */const QT=s=>!!s&&typeof s=="object",di=(...s)=>s.reduce((e,i)=>(typeof i!="object"||Object.keys(i).forEach(r=>{Array.isArray(e[r])&&Array.isArray(i[r])?e[r]=e[r].concat(i[r]):QT(e[r])&&QT(i[r])?e[r]=di(e[r],i[r]):e[r]=i[r]}),e),{}),KT=s=>Object.keys(s).map(e=>s[e]),xO=(s,e)=>{const i=[];for(let r=s;rs.reduce((e,i)=>e.concat(i),[]),ZT=s=>{if(!s.length)return[];const e=[];for(let i=0;is.reduce((i,r,o)=>(r[e]&&i.push(o),i),[]),CO=(s,e)=>KT(s.reduce((i,r)=>(r.forEach(o=>{i[e(o)]=o}),i),{}));var Ql={INVALID_NUMBER_OF_PERIOD:"INVALID_NUMBER_OF_PERIOD",INVALID_NUMBER_OF_CONTENT_STEERING:"INVALID_NUMBER_OF_CONTENT_STEERING",DASH_EMPTY_MANIFEST:"DASH_EMPTY_MANIFEST",DASH_INVALID_XML:"DASH_INVALID_XML",NO_BASE_URL:"NO_BASE_URL",MISSING_SEGMENT_INFORMATION:"MISSING_SEGMENT_INFORMATION",SEGMENT_TIME_UNSPECIFIED:"SEGMENT_TIME_UNSPECIFIED",UNSUPPORTED_UTC_TIMING_SCHEME:"UNSUPPORTED_UTC_TIMING_SCHEME"};const fd=({baseUrl:s="",source:e="",range:i="",indexRange:r=""})=>{const o={uri:e,resolvedUri:Nf(s||"",e)};if(i||r){const c=(i||r).split("-");let p=P.BigInt?P.BigInt(c[0]):parseInt(c[0],10),g=P.BigInt?P.BigInt(c[1]):parseInt(c[1],10);p{let e;return typeof s.offset=="bigint"||typeof s.length=="bigint"?e=P.BigInt(s.offset)+P.BigInt(s.length)-P.BigInt(1):e=s.offset+s.length-1,`${s.offset}-${e}`},JT=s=>(s&&typeof s!="number"&&(s=parseInt(s,10)),isNaN(s)?null:s),DO={static(s){const{duration:e,timescale:i=1,sourceDuration:r,periodDuration:o}=s,u=JT(s.endNumber),c=e/i;return typeof u=="number"?{start:0,end:u}:typeof o=="number"?{start:0,end:o/c}:{start:0,end:r/c}},dynamic(s){const{NOW:e,clientOffset:i,availabilityStartTime:r,timescale:o=1,duration:u,periodStart:c=0,minimumUpdatePeriod:p=0,timeShiftBufferDepth:g=1/0}=s,b=JT(s.endNumber),S=(e+i)/1e3,E=r+c,M=S+p-E,U=Math.ceil(M*o/u),D=Math.floor((S-E-g)*o/u),z=Math.floor((S-E)*o/u);return{start:Math.max(0,D),end:typeof b=="number"?b:Math.min(U,z)}}},wO=s=>e=>{const{duration:i,timescale:r=1,periodStart:o,startNumber:u=1}=s;return{number:u+e,duration:i/r,timeline:o,time:e*i}},l0=s=>{const{type:e,duration:i,timescale:r=1,periodDuration:o,sourceDuration:u}=s,{start:c,end:p}=DO[e](s),g=xO(c,p).map(wO(s));if(e==="static"){const b=g.length-1,S=typeof o=="number"?o:u;g[b].duration=S-i/r*b}return g},e1=s=>{const{baseUrl:e,initialization:i={},sourceDuration:r,indexRange:o="",periodStart:u,presentationTime:c,number:p=0,duration:g}=s;if(!e)throw new Error(Ql.NO_BASE_URL);const b=fd({baseUrl:e,source:i.sourceURL,range:i.range}),S=fd({baseUrl:e,source:e,indexRange:o});if(S.map=b,g){const E=l0(s);E.length&&(S.duration=E[0].duration,S.timeline=E[0].timeline)}else r&&(S.duration=r,S.timeline=u);return S.presentationTime=c||u,S.number=p,[S]},u0=(s,e,i)=>{const r=s.sidx.map?s.sidx.map:null,o=s.sidx.duration,u=s.timeline||0,c=s.sidx.byterange,p=c.offset+c.length,g=e.timescale,b=e.references.filter(z=>z.referenceType!==1),S=[],E=s.endList?"static":"dynamic",A=s.sidx.timeline;let M=A,U=s.mediaSequence||0,D;typeof e.firstOffset=="bigint"?D=P.BigInt(p)+e.firstOffset:D=p+e.firstOffset;for(let z=0;zCO(s,({timeline:e})=>e).sort((e,i)=>e.timeline>i.timeline?1:-1),RO=(s,e)=>{for(let i=0;i{let e=[];return Yk(s,kO,(i,r,o,u)=>{e=e.concat(i.playlists||[])}),e},n1=({playlist:s,mediaSequence:e})=>{s.mediaSequence=e,s.segments.forEach((i,r)=>{i.number=s.mediaSequence+r})},MO=({oldPlaylists:s,newPlaylists:e,timelineStarts:i})=>{e.forEach(r=>{r.discontinuitySequence=i.findIndex(function({timeline:g}){return g===r.timeline});const o=RO(s,r.attributes.NAME);if(!o||r.sidx)return;const u=r.segments[0],c=o.segments.findIndex(function(g){return Math.abs(g.presentationTime-u.presentationTime)o.timeline||o.segments.length&&r.timeline>o.segments[o.segments.length-1].timeline)&&r.discontinuitySequence--;return}o.segments[c].discontinuity&&!u.discontinuity&&(u.discontinuity=!0,r.discontinuityStarts.unshift(0),r.discontinuitySequence--),n1({playlist:r,mediaSequence:o.segments[c].number})})},LO=({oldManifest:s,newManifest:e})=>{const i=s.playlists.concat(i1(s)),r=e.playlists.concat(i1(e));return e.timelineStarts=t1([s.timelineStarts,e.timelineStarts]),MO({oldPlaylists:i,newPlaylists:r,timelineStarts:e.timelineStarts}),e},$f=s=>s&&s.uri+"-"+AO(s.byterange),c0=s=>{const e=s.reduce(function(r,o){return r[o.attributes.baseUrl]||(r[o.attributes.baseUrl]=[]),r[o.attributes.baseUrl].push(o),r},{});let i=[];return Object.values(e).forEach(r=>{const o=KT(r.reduce((u,c)=>{const p=c.attributes.id+(c.attributes.lang||"");return u[p]?(c.segments&&(c.segments[0]&&(c.segments[0].discontinuity=!0),u[p].segments.push(...c.segments)),c.attributes.contentProtection&&(u[p].attributes.contentProtection=c.attributes.contentProtection)):(u[p]=c,u[p].attributes.timelineStarts=[]),u[p].attributes.timelineStarts.push({start:c.attributes.periodStart,timeline:c.attributes.periodStart}),u},{}));i=i.concat(o)}),i.map(r=>(r.discontinuityStarts=EO(r.segments||[],"discontinuity"),r))},d0=(s,e)=>{const i=$f(s.sidx),r=i&&e[i]&&e[i].sidx;return r&&u0(s,r,s.sidx.resolvedUri),s},IO=(s,e={})=>{if(!Object.keys(e).length)return s;for(const i in s)s[i]=d0(s[i],e);return s},NO=({attributes:s,segments:e,sidx:i,mediaSequence:r,discontinuitySequence:o,discontinuityStarts:u},c)=>{const p={attributes:{NAME:s.id,BANDWIDTH:s.bandwidth,CODECS:s.codecs,"PROGRAM-ID":1},uri:"",endList:s.type==="static",timeline:s.periodStart,resolvedUri:s.baseUrl||"",targetDuration:s.duration,discontinuitySequence:o,discontinuityStarts:u,timelineStarts:s.timelineStarts,mediaSequence:r,segments:e};return s.contentProtection&&(p.contentProtection=s.contentProtection),s.serviceLocation&&(p.attributes.serviceLocation=s.serviceLocation),i&&(p.sidx=i),c&&(p.attributes.AUDIO="audio",p.attributes.SUBTITLES="subs"),p},PO=({attributes:s,segments:e,mediaSequence:i,discontinuityStarts:r,discontinuitySequence:o})=>{typeof e>"u"&&(e=[{uri:s.baseUrl,timeline:s.periodStart,resolvedUri:s.baseUrl||"",duration:s.sourceDuration,number:0}],s.duration=s.sourceDuration);const u={NAME:s.id,BANDWIDTH:s.bandwidth,"PROGRAM-ID":1};s.codecs&&(u.CODECS=s.codecs);const c={attributes:u,uri:"",endList:s.type==="static",timeline:s.periodStart,resolvedUri:s.baseUrl||"",targetDuration:s.duration,timelineStarts:s.timelineStarts,discontinuityStarts:r,discontinuitySequence:o,mediaSequence:i,segments:e};return s.serviceLocation&&(c.attributes.serviceLocation=s.serviceLocation),c},UO=(s,e={},i=!1)=>{let r;const o=s.reduce((u,c)=>{const p=c.attributes.role&&c.attributes.role.value||"",g=c.attributes.lang||"";let b=c.attributes.label||"main";if(g&&!c.attributes.label){const E=p?` (${p})`:"";b=`${c.attributes.lang}${E}`}u[b]||(u[b]={language:g,autoselect:!0,default:p==="main",playlists:[],uri:""});const S=d0(NO(c,i),e);return u[b].playlists.push(S),typeof r>"u"&&p==="main"&&(r=c,r.default=!0),u},{});if(!r){const u=Object.keys(o)[0];o[u].default=!0}return o},BO=(s,e={})=>s.reduce((i,r)=>{const o=r.attributes.label||r.attributes.lang||"text",u=r.attributes.lang||"und";return i[o]||(i[o]={language:u,default:!1,autoselect:!1,playlists:[],uri:""}),i[o].playlists.push(d0(PO(r),e)),i},{}),FO=s=>s.reduce((e,i)=>(i&&i.forEach(r=>{const{channel:o,language:u}=r;e[u]={autoselect:!1,default:!1,instreamId:o,language:u},r.hasOwnProperty("aspectRatio")&&(e[u].aspectRatio=r.aspectRatio),r.hasOwnProperty("easyReader")&&(e[u].easyReader=r.easyReader),r.hasOwnProperty("3D")&&(e[u]["3D"]=r["3D"])}),e),{}),HO=({attributes:s,segments:e,sidx:i,discontinuityStarts:r})=>{const o={attributes:{NAME:s.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:s.width,height:s.height},CODECS:s.codecs,BANDWIDTH:s.bandwidth,"PROGRAM-ID":1},uri:"",endList:s.type==="static",timeline:s.periodStart,resolvedUri:s.baseUrl||"",targetDuration:s.duration,discontinuityStarts:r,timelineStarts:s.timelineStarts,segments:e};return s.frameRate&&(o.attributes["FRAME-RATE"]=s.frameRate),s.contentProtection&&(o.contentProtection=s.contentProtection),s.serviceLocation&&(o.attributes.serviceLocation=s.serviceLocation),i&&(o.sidx=i),o},zO=({attributes:s})=>s.mimeType==="video/mp4"||s.mimeType==="video/webm"||s.contentType==="video",jO=({attributes:s})=>s.mimeType==="audio/mp4"||s.mimeType==="audio/webm"||s.contentType==="audio",qO=({attributes:s})=>s.mimeType==="text/vtt"||s.contentType==="text",VO=(s,e)=>{s.forEach(i=>{i.mediaSequence=0,i.discontinuitySequence=e.findIndex(function({timeline:r}){return r===i.timeline}),i.segments&&i.segments.forEach((r,o)=>{r.number=o})})},s1=s=>s?Object.keys(s).reduce((e,i)=>{const r=s[i];return e.concat(r.playlists)},[]):[],$O=({dashPlaylists:s,locations:e,contentSteering:i,sidxMapping:r={},previousManifest:o,eventStream:u})=>{if(!s.length)return{};const{sourceDuration:c,type:p,suggestedPresentationDelay:g,minimumUpdatePeriod:b}=s[0].attributes,S=c0(s.filter(zO)).map(HO),E=c0(s.filter(jO)),A=c0(s.filter(qO)),M=s.map(Q=>Q.attributes.captionServices).filter(Boolean),U={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:"",duration:c,playlists:IO(S,r)};b>=0&&(U.minimumUpdatePeriod=b*1e3),e&&(U.locations=e),i&&(U.contentSteering=i),p==="dynamic"&&(U.suggestedPresentationDelay=g),u&&u.length>0&&(U.eventStream=u);const D=U.playlists.length===0,z=E.length?UO(E,r,D):null,H=A.length?BO(A,r):null,Y=S.concat(s1(z),s1(H)),$=Y.map(({timelineStarts:Q})=>Q);return U.timelineStarts=t1($),VO(Y,U.timelineStarts),z&&(U.mediaGroups.AUDIO.audio=z),H&&(U.mediaGroups.SUBTITLES.subs=H),M.length&&(U.mediaGroups["CLOSED-CAPTIONS"].cc=FO(M)),o?LO({oldManifest:o,newManifest:U}):U},GO=(s,e,i)=>{const{NOW:r,clientOffset:o,availabilityStartTime:u,timescale:c=1,periodStart:p=0,minimumUpdatePeriod:g=0}=s,b=(r+o)/1e3,S=u+p,A=b+g-S;return Math.ceil((A*c-e)/i)},r1=(s,e)=>{const{type:i,minimumUpdatePeriod:r=0,media:o="",sourceDuration:u,timescale:c=1,startNumber:p=1,periodStart:g}=s,b=[];let S=-1;for(let E=0;ES&&(S=D);let z;if(U<0){const $=E+1;$===e.length?i==="dynamic"&&r>0&&o.indexOf("$Number$")>0?z=GO(s,S,M):z=(u*c-S)/M:z=(e[$].t-S)/M}else z=U+1;const H=p+b.length+z;let Y=p+b.length;for(;Y(e,i,r,o)=>{if(e==="$$")return"$";if(typeof s[i]>"u")return e;const u=""+s[i];return i==="RepresentationID"||(r?o=parseInt(o,10):o=1,u.length>=o)?u:`${new Array(o-u.length+1).join("0")}${u}`},a1=(s,e)=>s.replace(XO,YO(e)),WO=(s,e)=>!s.duration&&!e?[{number:s.startNumber||1,duration:s.sourceDuration,time:0,timeline:s.periodStart}]:s.duration?l0(s):r1(s,e),QO=(s,e)=>{const i={RepresentationID:s.id,Bandwidth:s.bandwidth||0},{initialization:r={sourceURL:"",range:""}}=s,o=fd({baseUrl:s.baseUrl,source:a1(r.sourceURL,i),range:r.range});return WO(s,e).map(c=>{i.Number=c.number,i.Time=c.time;const p=a1(s.media||"",i),g=s.timescale||1,b=s.presentationTimeOffset||0,S=s.periodStart+(c.time-b)/g;return{uri:p,timeline:c.timeline,duration:c.duration,resolvedUri:Nf(s.baseUrl||"",p),map:o,number:c.number,presentationTime:S}})},KO=(s,e)=>{const{baseUrl:i,initialization:r={}}=s,o=fd({baseUrl:i,source:r.sourceURL,range:r.range}),u=fd({baseUrl:i,source:e.media,range:e.mediaRange});return u.map=o,u},ZO=(s,e)=>{const{duration:i,segmentUrls:r=[],periodStart:o}=s;if(!i&&!e||i&&e)throw new Error(Ql.SEGMENT_TIME_UNSPECIFIED);const u=r.map(g=>KO(s,g));let c;return i&&(c=l0(s)),e&&(c=r1(s,e)),c.map((g,b)=>{if(u[b]){const S=u[b],E=s.timescale||1,A=s.presentationTimeOffset||0;return S.timeline=g.timeline,S.duration=g.duration,S.number=g.number,S.presentationTime=o+(g.time-A)/E,S}}).filter(g=>g)},JO=({attributes:s,segmentInfo:e})=>{let i,r;e.template?(r=QO,i=di(s,e.template)):e.base?(r=e1,i=di(s,e.base)):e.list&&(r=ZO,i=di(s,e.list));const o={attributes:s};if(!r)return o;const u=r(i,e.segmentTimeline);if(i.duration){const{duration:c,timescale:p=1}=i;i.duration=c/p}else u.length?i.duration=u.reduce((c,p)=>Math.max(c,Math.ceil(p.duration)),0):i.duration=0;return o.attributes=i,o.segments=u,e.base&&i.indexRange&&(o.sidx=u[0],o.segments=[]),o},eR=s=>s.map(JO),Lt=(s,e)=>ZT(s.childNodes).filter(({tagName:i})=>i===e),pd=s=>s.textContent.trim(),tR=s=>parseFloat(s.split("/").reduce((e,i)=>e/i)),Kl=s=>{const p=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(s);if(!p)return 0;const[g,b,S,E,A,M]=p.slice(1);return parseFloat(g||0)*31536e3+parseFloat(b||0)*2592e3+parseFloat(S||0)*86400+parseFloat(E||0)*3600+parseFloat(A||0)*60+parseFloat(M||0)},iR=s=>(/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(s)&&(s+="Z"),Date.parse(s)),o1={mediaPresentationDuration(s){return Kl(s)},availabilityStartTime(s){return iR(s)/1e3},minimumUpdatePeriod(s){return Kl(s)},suggestedPresentationDelay(s){return Kl(s)},type(s){return s},timeShiftBufferDepth(s){return Kl(s)},start(s){return Kl(s)},width(s){return parseInt(s,10)},height(s){return parseInt(s,10)},bandwidth(s){return parseInt(s,10)},frameRate(s){return tR(s)},startNumber(s){return parseInt(s,10)},timescale(s){return parseInt(s,10)},presentationTimeOffset(s){return parseInt(s,10)},duration(s){const e=parseInt(s,10);return isNaN(e)?Kl(s):e},d(s){return parseInt(s,10)},t(s){return parseInt(s,10)},r(s){return parseInt(s,10)},presentationTime(s){return parseInt(s,10)},DEFAULT(s){return s}},Jt=s=>s&&s.attributes?ZT(s.attributes).reduce((e,i)=>{const r=o1[i.name]||o1.DEFAULT;return e[i.name]=r(i.value),e},{}):{},nR={"urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b":"org.w3.clearkey","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":"com.widevine.alpha","urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":"com.microsoft.playready","urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb":"com.adobe.primetime","urn:mpeg:dash:mp4protection:2011":"mp4protection"},Gf=(s,e)=>e.length?Wl(s.map(function(i){return e.map(function(r){const o=pd(r),u=Nf(i.baseUrl,o),c=di(Jt(r),{baseUrl:u});return u!==o&&!c.serviceLocation&&i.serviceLocation&&(c.serviceLocation=i.serviceLocation),c})})):s,h0=s=>{const e=Lt(s,"SegmentTemplate")[0],i=Lt(s,"SegmentList")[0],r=i&&Lt(i,"SegmentURL").map(E=>di({tag:"SegmentURL"},Jt(E))),o=Lt(s,"SegmentBase")[0],u=i||e,c=u&&Lt(u,"SegmentTimeline")[0],p=i||o||e,g=p&&Lt(p,"Initialization")[0],b=e&&Jt(e);b&&g?b.initialization=g&&Jt(g):b&&b.initialization&&(b.initialization={sourceURL:b.initialization});const S={template:b,segmentTimeline:c&&Lt(c,"S").map(E=>Jt(E)),list:i&&di(Jt(i),{segmentUrls:r,initialization:Jt(g)}),base:o&&di(Jt(o),{initialization:Jt(g)})};return Object.keys(S).forEach(E=>{S[E]||delete S[E]}),S},sR=(s,e,i)=>r=>{const o=Lt(r,"BaseURL"),u=Gf(e,o),c=di(s,Jt(r)),p=h0(r);return u.map(g=>({segmentInfo:di(i,p),attributes:di(c,g)}))},rR=s=>s.reduce((e,i)=>{const r=Jt(i);r.schemeIdUri&&(r.schemeIdUri=r.schemeIdUri.toLowerCase());const o=nR[r.schemeIdUri];if(o){e[o]={attributes:r};const u=Lt(i,"cenc:pssh")[0];if(u){const c=pd(u);e[o].pssh=c&&Z_(c)}}return e},{}),aR=s=>{if(s.schemeIdUri==="urn:scte:dash:cc:cea-608:2015")return(typeof s.value!="string"?[]:s.value.split(";")).map(i=>{let r,o;return o=i,/^CC\d=/.test(i)?[r,o]=i.split("="):/^CC\d$/.test(i)&&(r=i),{channel:r,language:o}});if(s.schemeIdUri==="urn:scte:dash:cc:cea-708:2015")return(typeof s.value!="string"?[]:s.value.split(";")).map(i=>{const r={channel:void 0,language:void 0,aspectRatio:1,easyReader:0,"3D":0};if(/=/.test(i)){const[o,u=""]=i.split("=");r.channel=o,r.language=i,u.split(",").forEach(c=>{const[p,g]=c.split(":");p==="lang"?r.language=g:p==="er"?r.easyReader=Number(g):p==="war"?r.aspectRatio=Number(g):p==="3D"&&(r["3D"]=Number(g))})}else r.language=i;return r.channel&&(r.channel="SERVICE"+r.channel),r})},oR=s=>Wl(Lt(s.node,"EventStream").map(e=>{const i=Jt(e),r=i.schemeIdUri;return Lt(e,"Event").map(o=>{const u=Jt(o),c=u.presentationTime||0,p=i.timescale||1,g=u.duration||0,b=c/p+s.attributes.start;return{schemeIdUri:r,value:i.value,id:u.id,start:b,end:b+g/p,messageData:pd(o)||u.messageData,contentEncoding:i.contentEncoding,presentationTimeOffset:i.presentationTimeOffset||0}})})),lR=(s,e,i)=>r=>{const o=Jt(r),u=Gf(e,Lt(r,"BaseURL")),c=Lt(r,"Role")[0],p={role:Jt(c)};let g=di(s,o,p);const b=Lt(r,"Accessibility")[0],S=aR(Jt(b));S&&(g=di(g,{captionServices:S}));const E=Lt(r,"Label")[0];if(E&&E.childNodes.length){const z=E.childNodes[0].nodeValue.trim();g=di(g,{label:z})}const A=rR(Lt(r,"ContentProtection"));Object.keys(A).length&&(g=di(g,{contentProtection:A}));const M=h0(r),U=Lt(r,"Representation"),D=di(i,M);return Wl(U.map(sR(g,u,D)))},uR=(s,e)=>(i,r)=>{const o=Gf(e,Lt(i.node,"BaseURL")),u=di(s,{periodStart:i.attributes.start});typeof i.attributes.duration=="number"&&(u.periodDuration=i.attributes.duration);const c=Lt(i.node,"AdaptationSet"),p=h0(i.node);return Wl(c.map(lR(u,o,p)))},cR=(s,e)=>{if(s.length>1&&e({type:"warn",message:"The MPD manifest should contain no more than one ContentSteering tag"}),!s.length)return null;const i=di({serverURL:pd(s[0])},Jt(s[0]));return i.queryBeforeStart=i.queryBeforeStart==="true",i},dR=({attributes:s,priorPeriodAttributes:e,mpdType:i})=>typeof s.start=="number"?s.start:e&&typeof e.start=="number"&&typeof e.duration=="number"?e.start+e.duration:!e&&i==="static"?0:null,hR=(s,e={})=>{const{manifestUri:i="",NOW:r=Date.now(),clientOffset:o=0,eventHandler:u=function(){}}=e,c=Lt(s,"Period");if(!c.length)throw new Error(Ql.INVALID_NUMBER_OF_PERIOD);const p=Lt(s,"Location"),g=Jt(s),b=Gf([{baseUrl:i}],Lt(s,"BaseURL")),S=Lt(s,"ContentSteering");g.type=g.type||"static",g.sourceDuration=g.mediaPresentationDuration||0,g.NOW=r,g.clientOffset=o,p.length&&(g.locations=p.map(pd));const E=[];return c.forEach((A,M)=>{const U=Jt(A),D=E[M-1];U.start=dR({attributes:U,priorPeriodAttributes:D?D.attributes:null,mpdType:g.type}),E.push({node:A,attributes:U})}),{locations:g.locations,contentSteeringInfo:cR(S,u),representationInfo:Wl(E.map(uR(g,b))),eventStream:Wl(E.map(oR))}},l1=s=>{if(s==="")throw new Error(Ql.DASH_EMPTY_MANIFEST);const e=new SO;let i,r;try{i=e.parseFromString(s,"application/xml"),r=i&&i.documentElement.tagName==="MPD"?i.documentElement:null}catch{}if(!r||r&&r.getElementsByTagName("parsererror").length>0)throw new Error(Ql.DASH_INVALID_XML);return r},fR=s=>{const e=Lt(s,"UTCTiming")[0];if(!e)return null;const i=Jt(e);switch(i.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":i.method="HEAD";break;case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":i.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":i.method="DIRECT",i.value=Date.parse(i.value);break;case"urn:mpeg:dash:utc:http-ntp:2014":case"urn:mpeg:dash:utc:ntp:2014":case"urn:mpeg:dash:utc:sntp:2014":default:throw new Error(Ql.UNSUPPORTED_UTC_TIMING_SCHEME)}return i},pR=(s,e={})=>{const i=hR(l1(s),e),r=eR(i.representationInfo);return $O({dashPlaylists:r,locations:i.locations,contentSteering:i.contentSteeringInfo,sidxMapping:e.sidxMapping,previousManifest:e.previousManifest,eventStream:i.eventStream})},mR=s=>fR(l1(s));var u1=Math.pow(2,32),gR=function(s){var e=new DataView(s.buffer,s.byteOffset,s.byteLength),i;return e.getBigUint64?(i=e.getBigUint64(0),i0;r+=12,o--)i.references.push({referenceType:(s[r]&128)>>>7,referencedSize:e.getUint32(r)&2147483647,subsegmentDuration:e.getUint32(r+4),startsWithSap:!!(s[r+8]&128),sapType:(s[r+8]&112)>>>4,sapDeltaTime:e.getUint32(r+8)&268435455});return i},bR=vR;const _R=Xc(bR);var TR=Ie([73,68,51]),SR=function(e,i){i===void 0&&(i=0),e=Ie(e);var r=e[i+5],o=e[i+6]<<21|e[i+7]<<14|e[i+8]<<7|e[i+9],u=(r&16)>>4;return u?o+20:o+10},md=function s(e,i){return i===void 0&&(i=0),e=Ie(e),e.length-i<10||!Mt(e,TR,{offset:i})?i:(i+=SR(e,i),s(e,i))},d1=function(e){return typeof e=="string"?aT(e):e},xR=function(e){return Array.isArray(e)?e.map(function(i){return d1(i)}):[d1(e)]},ER=function s(e,i,r){r===void 0&&(r=!1),i=xR(i),e=Ie(e);var o=[];if(!i.length)return o;for(var u=0;u>>0,p=e.subarray(u+4,u+8);if(c===0)break;var g=u+c;if(g>e.length){if(r)break;g=e.length}var b=e.subarray(u+8,g);Mt(p,i[0])&&(i.length===1?o.push(b):o.push.apply(o,s(b,i.slice(1),r))),u=g}return o},Xf={EBML:Ie([26,69,223,163]),DocType:Ie([66,130]),Segment:Ie([24,83,128,103]),SegmentInfo:Ie([21,73,169,102]),Tracks:Ie([22,84,174,107]),Track:Ie([174]),TrackNumber:Ie([215]),DefaultDuration:Ie([35,227,131]),TrackEntry:Ie([174]),TrackType:Ie([131]),FlagDefault:Ie([136]),CodecID:Ie([134]),CodecPrivate:Ie([99,162]),VideoTrack:Ie([224]),AudioTrack:Ie([225]),Cluster:Ie([31,67,182,117]),Timestamp:Ie([231]),TimestampScale:Ie([42,215,177]),BlockGroup:Ie([160]),BlockDuration:Ie([155]),Block:Ie([161]),SimpleBlock:Ie([163])},f0=[128,64,32,16,8,4,2,1],CR=function(e){for(var i=1,r=0;r=i.length)return i.length;var o=Yf(i,r,!1);if(Mt(e.bytes,o.bytes))return r;var u=Yf(i,r+o.length);return s(e,i,r+u.length+u.value+o.length)},f1=function s(e,i){i=AR(i),e=Ie(e);var r=[];if(!i.length)return r;for(var o=0;oe.length?e.length:p+c.value,b=e.subarray(p,g);Mt(i[0],u.bytes)&&(i.length===1?r.push(b):r=r.concat(s(b,i.slice(1))));var S=u.length+c.length+b.length;o+=S}return r},wR=Ie([0,0,0,1]),kR=Ie([0,0,1]),OR=Ie([0,0,3]),RR=function(e){for(var i=[],r=1;r>1&63),r.indexOf(b)!==-1&&(c=u+g),u+=g+(i==="h264"?1:2)}return e.subarray(0,0)},MR=function(e,i,r){return p1(e,"h264",i,r)},LR=function(e,i,r){return p1(e,"h265",i,r)},Vi={webm:Ie([119,101,98,109]),matroska:Ie([109,97,116,114,111,115,107,97]),flac:Ie([102,76,97,67]),ogg:Ie([79,103,103,83]),ac3:Ie([11,119]),riff:Ie([82,73,70,70]),avi:Ie([65,86,73]),wav:Ie([87,65,86,69]),"3gp":Ie([102,116,121,112,51,103]),mp4:Ie([102,116,121,112]),fmp4:Ie([115,116,121,112]),mov:Ie([102,116,121,112,113,116]),moov:Ie([109,111,111,118]),moof:Ie([109,111,111,102])},Zl={aac:function(e){var i=md(e);return Mt(e,[255,16],{offset:i,mask:[255,22]})},mp3:function(e){var i=md(e);return Mt(e,[255,2],{offset:i,mask:[255,6]})},webm:function(e){var i=f1(e,[Xf.EBML,Xf.DocType])[0];return Mt(i,Vi.webm)},mkv:function(e){var i=f1(e,[Xf.EBML,Xf.DocType])[0];return Mt(i,Vi.matroska)},mp4:function(e){if(Zl["3gp"](e)||Zl.mov(e))return!1;if(Mt(e,Vi.mp4,{offset:4})||Mt(e,Vi.fmp4,{offset:4})||Mt(e,Vi.moof,{offset:4})||Mt(e,Vi.moov,{offset:4}))return!0},mov:function(e){return Mt(e,Vi.mov,{offset:4})},"3gp":function(e){return Mt(e,Vi["3gp"],{offset:4})},ac3:function(e){var i=md(e);return Mt(e,Vi.ac3,{offset:i})},ts:function(e){if(e.length<189&&e.length>=1)return e[0]===71;for(var i=0;i+1880},g0=9e4,y0,v0,Wf,b0,m1,g1,y1;y0=function(s){return s*g0},v0=function(s,e){return s*e},Wf=function(s){return s/g0},b0=function(s,e){return s/e},m1=function(s,e){return y0(b0(s,e))},g1=function(s,e){return v0(Wf(s),e)},y1=function(s,e,i){return Wf(i?s:s-e)};var Ao={ONE_SECOND_IN_TS:g0,secondsToVideoTs:y0,secondsToAudioTs:v0,videoTsToSeconds:Wf,audioTsToSeconds:b0,audioTsToVideoTs:m1,videoTsToAudioTs:g1,metadataTsToSeconds:y1};/** * @license * Video.js 8.23.3 * Copyright Brightcove, Inc. @@ -454,7 +454,7 @@ This may prevent text tracks from loading.`),this.restoreMetadataTracksInIOSNati } `)}loadTech_(e,i){this.tech_&&this.unloadTech_();const r=Ht(e),o=e.charAt(0).toLowerCase()+e.slice(1);r!=="Html5"&&this.tag&&(Ve.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=r,this.isReady_=!1;let u=this.autoplay();(typeof this.autoplay()=="string"||this.autoplay()===!0&&this.options_.normalizeAutoplay)&&(u=!1);const c={source:i,autoplay:u,nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:`${this.id()}_${o}_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};Gi.names.forEach(g=>{const b=Gi[g];c[b.getterName]=this[b.privateName]}),Object.assign(c,this.options_[r]),Object.assign(c,this.options_[o]),Object.assign(c,this.options_[e.toLowerCase()]),this.tag&&(c.tag=this.tag),i&&i.src===this.cache_.src&&this.cache_.currentTime>0&&(c.startTime=this.cache_.currentTime);const p=Ve.getTech(e);if(!p)throw new Error(`No Tech named '${r}' exists! '${r}' should be registered using videojs.registerTech()'`);this.tech_=new p(c),this.tech_.ready(Dt(this,this.handleTechReady_),!0),U0.jsonToTextTracks(this.textTracksJson_||[],this.tech_),sS.forEach(g=>{this.on(this.tech_,g,b=>this[`handleTech${Ht(g)}_`](b))}),Object.keys(fy).forEach(g=>{this.on(this.tech_,g,b=>{if(this.tech_.playbackRate()===0&&this.tech_.seeking()){this.queuedCallbacks_.push({callback:this[`handleTech${fy[g]}_`].bind(this),event:b});return}this[`handleTech${fy[g]}_`](b)})}),this.on(this.tech_,"loadstart",g=>this.handleTechLoadStart_(g)),this.on(this.tech_,"sourceset",g=>this.handleTechSourceset_(g)),this.on(this.tech_,"waiting",g=>this.handleTechWaiting_(g)),this.on(this.tech_,"ended",g=>this.handleTechEnded_(g)),this.on(this.tech_,"seeking",g=>this.handleTechSeeking_(g)),this.on(this.tech_,"play",g=>this.handleTechPlay_(g)),this.on(this.tech_,"pause",g=>this.handleTechPause_(g)),this.on(this.tech_,"durationchange",g=>this.handleTechDurationChange_(g)),this.on(this.tech_,"fullscreenchange",(g,b)=>this.handleTechFullscreenChange_(g,b)),this.on(this.tech_,"fullscreenerror",(g,b)=>this.handleTechFullscreenError_(g,b)),this.on(this.tech_,"enterpictureinpicture",g=>this.handleTechEnterPictureInPicture_(g)),this.on(this.tech_,"leavepictureinpicture",g=>this.handleTechLeavePictureInPicture_(g)),this.on(this.tech_,"error",g=>this.handleTechError_(g)),this.on(this.tech_,"posterchange",g=>this.handleTechPosterChange_(g)),this.on(this.tech_,"textdata",g=>this.handleTechTextData_(g)),this.on(this.tech_,"ratechange",g=>this.handleTechRateChange_(g)),this.on(this.tech_,"loadedmetadata",this.boundUpdateStyleEl_),this.usingNativeControls(this.techGet_("controls")),this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_(),this.tech_.el().parentNode!==this.el()&&(r!=="Html5"||!this.tag)&&E0(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)}unloadTech_(){Gi.names.forEach(e=>{const i=Gi[e];this[i.privateName]=this[i.getterName]()}),this.textTracksJson_=U0.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&&Ke.warn(`Using the tech directly can be dangerous. I hope you know what you're doing. See https://github.com/videojs/video.js/issues/2617 for more info. -`),this.tech_}version(){return{"video.js":_0}}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 i=()=>{const o=this.muted();this.muted(!0);const u=()=>{this.muted(o)};this.playTerminatedQueue_.push(u);const c=this.play();if(xd(c))return c.catch(p=>{throw u(),new Error(`Rejection at manualAutoplay. Restoring muted value. ${p||""}`)})};let r;if(e==="any"&&!this.muted()?(r=this.play(),xd(r)&&(r=r.catch(i))):e==="muted"&&!this.muted()?r=i():r=this.play(),!!xd(r))return r.then(()=>{this.trigger({type:"autoplay-success",autoplay:e})}).catch(()=>{this.trigger({type:"autoplay-failure",autoplay:e})})}updateSourceCaches_(e=""){let i=e,r="";typeof i!="string"&&(i=e.src,r=e.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],i&&!r&&(r=v3(this,i)),this.cache_.source=vt({},e,{src:i,type:r});const o=this.cache_.sources.filter(g=>g.src&&g.src===i),u=[],c=this.$$("source"),p=[];for(let g=0;gthis.updateSourceCaches_(u);const r=this.currentSource().src,o=e.src;r&&!/^blob:/.test(r)&&/^blob:/.test(o)&&(!this.lastSource_||this.lastSource_.tech!==o&&this.lastSource_.player!==r)&&(i=()=>{}),i(o),e.src||this.tech_.any(["sourceset","loadstart"],u=>{if(u.type==="sourceset")return;const c=this.techGet_("currentSrc");this.lastSource_.tech=c,this.updateSourceCaches_(c)})}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(),i=()=>{e!==this.currentTime()&&(this.removeClass("vjs-waiting"),this.off("timeupdate",i))};this.on("timeupdate",i)}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()?Us(this.play()):this.pause())}handleTechDoubleClick_(e){if(!this.controls_)return;Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),r=>r.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()&&!pe.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 i=e.target.player;if(i&&i!==this)return;const r=this.el();let o=pe[this.fsApi_.fullscreenElement]===r;!o&&r.matches&&(o=r.matches(":"+this.fsApi_.fullscreen)),this.isFullscreen(o)}handleTechFullscreenChange_(e,i){i&&(i.nativeIOSFullscreen&&(this.addClass("vjs-ios-native-fs"),this.tech_.one("webkitendfullscreen",()=>{this.removeClass("vjs-ios-native-fs")})),this.isFullscreen(i.isFullscreen))}handleTechFullscreenError_(e,i){this.trigger("fullscreenerror",i)}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,i){this.ready(function(){if(e in f3)return d3(this.middleware_,this.tech_,e,i);if(e in h2)return d2(this.middleware_,this.tech_,e,i);try{this.tech_&&this.tech_[e](i)}catch(r){throw Ke(r),r}},!0)}techGet_(e){if(!(!this.tech_||!this.tech_.isReady_)){if(e in h3)return c3(this.middleware_,this.tech_,e);if(e in h2)return d2(this.middleware_,this.tech_,e);try{return this.tech_[e]()}catch(i){throw this.tech_[e]===void 0?(Ke(`Video.js: ${e} method not defined for ${this.techName_} playback technology.`,i),i):i.name==="TypeError"?(Ke(`Video.js: ${e} unavailable on ${this.techName_} playback technology element.`,i),this.tech_.isReady_=!1,i):(Ke(i),i)}}}play(){return new Promise(e=>{this.play_(e)})}play_(e=Us){this.playCallbacks_.push(e);const i=!!(!this.changingSrc_&&(this.src()||this.currentSrc())),r=!!(op||Ii);if(this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),!this.isReady_||!i){this.waitToPlay_=c=>{this.play_()},this.one(["ready","loadstart"],this.waitToPlay_),!i&&r&&this.load();return}const o=this.techGet_("play");r&&this.hasClass("vjs-ended")&&this.resetProgressBar_(),o===null?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(o)}runPlayTerminatedQueue_(){const e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],e.forEach(function(i){i()})}runPlayCallbacks_(e){const i=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],i.forEach(function(r){r(e)})}pause(){this.techCall_("pause")}paused(){return this.techGet_("paused")!==!1}played(){return this.techGet_("played")||hs(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=hs(0,0)),e}seekable(){let e=this.techGet_("seekable");return(!e||!e.length)&&(e=hs(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 i2(this.buffered(),this.duration())}bufferedEnd(){const e=this.buffered(),i=this.duration();let r=e.end(e.length-1);return r>i&&(r=i),r}volume(e){let i;if(e!==void 0){i=Math.max(0,Math.min(1,e)),this.cache_.volume=i,this.techCall_("setVolume",i),i>0&&this.lastVolume_(i);return}return i=parseFloat(this.techGet_("volume")),isNaN(i)?1:i}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 i=this.isFullscreen_;this.isFullscreen_=!!e,this.isFullscreen_!==i&&this.fsApi_.prefixed&&this.trigger("fullscreenchange"),this.toggleFullscreenClass_();return}return this.isFullscreen_}requestFullscreen(e){this.isInPictureInPicture()&&this.exitPictureInPicture();const i=this;return new Promise((r,o)=>{function u(){i.off("fullscreenerror",p),i.off("fullscreenchange",c)}function c(){u(),r()}function p(b,S){u(),o(S)}i.one("fullscreenchange",c),i.one("fullscreenerror",p);const g=i.requestFullscreenHelper_(e);g&&(g.then(u,u),g.then(r,o))})}requestFullscreenHelper_(e){let i;if(this.fsApi_.prefixed||(i=this.options_.fullscreen&&this.options_.fullscreen.options||{},e!==void 0&&(i=e)),this.fsApi_.requestFullscreen){const r=this.el_[this.fsApi_.requestFullscreen](i);return r&&r.then(()=>this.isFullscreen(!0),()=>this.isFullscreen(!1)),r}else this.tech_.supportsFullScreen()&&!this.options_.preferFullWindow?this.techCall_("enterFullScreen"):this.enterFullWindow()}exitFullscreen(){const e=this;return new Promise((i,r)=>{function o(){e.off("fullscreenerror",c),e.off("fullscreenchange",u)}function u(){o(),i()}function c(g,b){o(),r(b)}e.one("fullscreenchange",u),e.one("fullscreenerror",c);const p=e.exitFullscreenHelper_();p&&(p.then(o,o),p.then(i,r))})}exitFullscreenHelper_(){if(this.fsApi_.requestFullscreen){const e=pe[this.fsApi_.exitFullscreen]();return e&&Us(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=pe.documentElement.style.overflow,Sn(pe,"keydown",this.boundFullWindowOnEscKey_),pe.documentElement.style.overflow="hidden",Do(pe.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,Ni(pe,"keydown",this.boundFullWindowOnEscKey_),pe.documentElement.style.overflow=this.docOrigOverflow,lp(pe.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&&P.documentPictureInPicture){const e=pe.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(Ue("p",{className:"vjs-pip-text"},{},this.localize("Playing in picture-in-picture"))),P.documentPictureInPicture.requestWindow({width:this.videoWidth(),height:this.videoHeight()}).then(i=>(z1(i),this.el_.parentNode.insertBefore(e,this.el_),i.document.body.appendChild(this.el_),i.document.body.classList.add("vjs-pip-window"),this.player_.isInPictureInPicture(!0),this.player_.trigger({type:"enterpictureinpicture",pipWindow:i}),i.addEventListener("pagehide",r=>{const o=r.target.querySelector(".video-js");e.parentNode.replaceChild(o,e),this.player_.isInPictureInPicture(!1),this.player_.trigger("leavepictureinpicture")}),i))}return"pictureInPictureEnabled"in pe&&this.disablePictureInPicture()===!1?this.techGet_("requestPictureInPicture"):Promise.reject("No PiP mode is available")}exitPictureInPicture(){if(P.documentPictureInPicture&&P.documentPictureInPicture.window)return P.documentPictureInPicture.window.close(),Promise.resolve();if("pictureInPictureEnabled"in pe)return pe.exitPictureInPicture()}handleKeyDown(e){const{userActions:i}=this.options_;!i||!i.hotkeys||(o=>{const u=o.tagName.toLowerCase();if(o.isContentEditable)return!0;const c=["button","checkbox","hidden","radio","reset","submit"];return u==="input"?c.indexOf(o.type)===-1:["textarea"].indexOf(u)!==-1})(this.el_.ownerDocument.activeElement)||(typeof i.hotkeys=="function"?i.hotkeys.call(this,e):this.handleHotkeys(e))}handleHotkeys(e){const i=this.options_.userActions?this.options_.userActions.hotkeys:{},{fullscreenKey:r=c=>e.key.toLowerCase()==="f",muteKey:o=c=>e.key.toLowerCase()==="m",playPauseKey:u=c=>e.key.toLowerCase()==="k"||e.key.toLowerCase()===" "}=i;if(r.call(this,e)){e.preventDefault(),e.stopPropagation();const c=ce.getComponent("FullscreenToggle");pe[this.fsApi_.fullscreenEnabled]!==!1&&c.prototype.handleClick.call(this,e)}else o.call(this,e)?(e.preventDefault(),e.stopPropagation(),ce.getComponent("MuteToggle").prototype.handleClick.call(this,e)):u.call(this,e)&&(e.preventDefault(),e.stopPropagation(),ce.getComponent("PlayToggle").prototype.handleClick.call(this,e))}canPlayType(e){let i;for(let r=0,o=this.options_.techOrder;r[p,Ve.getTech(p)]).filter(([p,g])=>g?g.isSupported():(Ke.error(`The "${p}" tech is undefined. Skipped browser support check for that tech.`),!1)),r=function(p,g,b){let S;return p.some(E=>g.some(A=>{if(S=b(E,A),S)return!0})),S};let o;const u=p=>(g,b)=>p(b,g),c=([p,g],b)=>{if(g.canPlaySource(b,this.options_[p.toLowerCase()]))return{source:b,tech:p}};return this.options_.sourceOrder?o=r(e,i,u(c)):o=r(i,e,c),o||!1}handleSrc_(e,i){if(typeof e>"u")return this.cache_.src||"";this.resetRetryOnError_&&this.resetRetryOnError_();const r=f2(e);if(!r.length){this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0);return}if(this.changingSrc_=!0,i||(this.cache_.sources=r),this.updateSourceCaches_(r[0]),l3(this,r[0],(o,u)=>{if(this.middleware_=u,i||(this.cache_.sources=r),this.updateSourceCaches_(o),this.src_(o)){if(r.length>1)return this.handleSrc_(r.slice(1));this.changingSrc_=!1,this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0),this.triggerReady();return}u3(u,this.tech_)}),r.length>1){const o=()=>{this.error(null),this.handleSrc_(r.slice(1),!0)},u=()=>{this.off("error",o)};this.one("error",o),this.one("playing",u),this.resetRetryOnError_=()=>{this.off("error",o),this.off("playing",u)}}}src(e){return this.handleSrc_(e,!1)}src_(e){const i=this.selectSource([e]);return i?K1(i.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_(i.tech,i.source),this.tech_.ready(()=>{this.changingSrc_=!1}),!1):!0}addSourceElement(e,i){return this.tech_?this.tech_.addSourceElement(e,i):!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();Us(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}),Or(this)&&this.trigger("playerreset")}resetControlBarUI_(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()}resetProgressBar_(){this.currentTime(0);const{currentTimeDisplay:e,durationDisplay:i,progressControl:r,remainingTimeDisplay:o}=this.controlBar||{},{seekBar:u}=r||{};e&&e.updateContent(),i&&i.updateContent(),o&&o.updateContent(),u&&(u.update(),u.loadProgressBar&&u.loadProgressBar.update())}resetPlaybackRate_(){this.playbackRate(this.defaultPlaybackRate()),this.handleTechRateChange_()}resetVolumeBar_(){this.volume(1),this.trigger("volumechange")}currentSources(){const e=this.currentSource(),i=[];return Object.keys(e).length!==0&&i.push(e),this.cache_.sources||i}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 i;typeof e=="string"&&/(any|play|muted)/.test(e)||e===!0&&this.options_.normalizeAutoplay?(this.options_.autoplay=e,this.manualAutoplay_(typeof e=="string"?e:"play"),i=!1):e?this.options_.autoplay=!0:this.options_.autoplay=!1,i=typeof i>"u"?this.options_.autoplay:i,this.tech_&&this.techCall_("setAutoplay",i)}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(xa("beforeerror").forEach(i=>{const r=i(this,e);if(!(Is(r)&&!Array.isArray(r)||typeof r=="string"||typeof r=="number"||r===null)){this.log.error("please return a value that MediaError expects in beforeerror hooks");return}e=r}),this.options_.suppressNotSupportedError&&e&&e.code===4){const i=function(){this.error(e)};this.options_.suppressNotSupportedError=!1,this.any(["click","touchstart"],i),this.one("loadstart",function(){this.off(["click","touchstart"],i)});return}if(e===null){this.error_=null,this.removeClass("vjs-error"),this.errorDisplay&&this.errorDisplay.close();return}this.error_=new Nt(e),this.addClass("vjs-error"),Ke.error(`(CODE:${this.error_.code} ${Nt.errorTypes[this.error_.code]})`,this.error_.message,this.error_),this.trigger("error"),xa("error").forEach(i=>i(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(i){i.stopPropagation(),i.preventDefault()}),this.userActivity_=!1,this.removeClass("vjs-user-active"),this.addClass("vjs-user-inactive"),this.trigger("userinactive")}}listenForUserActivity_(){let e,i,r;const o=Dt(this,this.reportUserActivity),u=function(E){(E.screenX!==i||E.screenY!==r)&&(i=E.screenX,r=E.screenY,o())},c=function(){o(),this.clearInterval(e),e=this.setInterval(o,250)},p=function(E){o(),this.clearInterval(e)};this.on("mousedown",c),this.on("mousemove",u),this.on("mouseup",p),this.on("mouseleave",p);const g=this.getChild("controlBar");g&&!Ii&&!ds&&(g.on("mouseenter",function(E){this.player().options_.inactivityTimeout!==0&&(this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout),this.player().options_.inactivityTimeout=0}),g.on("mouseleave",function(E){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout})),this.on("keydown",o),this.on("keyup",o);let b;const S=function(){if(!this.userActivity_)return;this.userActivity_=!1,this.userActive(!0),this.clearTimeout(b);const E=this.options_.inactivityTimeout;E<=0||(b=this.setTimeout(function(){this.userActivity_||this.userActive(!1)},E))};this.setInterval(S,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(),i=this.getChild("ControlBar"),r=i&&i.currentHeight();e.forEach(o=>{o!==i&&o.el_&&!o.hasClass("vjs-hidden")&&(o.hide(),this.audioOnlyCache_.hiddenChildren.push(o))}),this.audioOnlyCache_.playerHeight=this.currentHeight(),this.audioOnlyCache_.controlBarHeight=r,this.on("playerresize",this.boundUpdatePlayerHeightOnAudioOnlyMode_),this.height(r),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 i=[];return this.isInPictureInPicture()&&i.push(this.exitPictureInPicture()),this.isFullscreen()&&i.push(this.exitFullscreen()),this.audioPosterMode()&&i.push(this.audioPosterMode(!1)),Promise.all(i).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,i,r){if(this.tech_)return this.tech_.addTextTrack(e,i,r)}addRemoteTextTrack(e,i){if(this.tech_)return this.tech_.addRemoteTextTrack(e,i)}removeRemoteTextTrack(e={}){let{track:i}=e;if(i||(i=e),this.tech_)return this.tech_.removeRemoteTextTrack(i)}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(),Or(this)&&this.trigger("languagechange"))}languages(){return vt(ft.prototype.options_.languages,this.languages_)}toJSON(){const e=vt(this.options_),i=e.tracks;e.tracks=[];for(let r=0;r{this.removeChild(r)}),r.open(),r}updateCurrentBreakpoint_(){if(!this.responsive())return;const e=this.currentBreakpoint(),i=this.currentWidth();for(let r=0;rthis.addRemoteTextTrack(E,!1)),this.titleBar&&this.titleBar.update({title:S,description:c||o||""}),this.ready(i)}getMedia(){if(!this.cache_.media){const e=this.poster(),i=this.currentSources(),r=Array.prototype.map.call(this.remoteTextTracks(),u=>({kind:u.kind,label:u.label,language:u.language,src:u.src})),o={src:i,textTracks:r};return e&&(o.poster=e,o.artwork=[{src:o.poster,type:Tp(o.poster)}]),o}return vt(this.cache_.media)}static getTagSettings(e){const i={sources:[],tracks:[]},r=Aa(e),o=r["data-setup"];if(vd(e,"vjs-fill")&&(r.fill=!0),vd(e,"vjs-fluid")&&(r.fluid=!0),o!==null)try{Object.assign(r,JSON.parse(o||"{}"))}catch(u){Ke.error("data-setup",u)}if(Object.assign(i,r),e.hasChildNodes()){const u=e.childNodes;for(let c=0,p=u.length;ctypeof i=="number")&&(this.cache_.playbackRates=e,this.trigger("playbackrateschange"))}}ft.prototype.videoTracks=()=>{},ft.prototype.audioTracks=()=>{},ft.prototype.textTracks=()=>{},ft.prototype.remoteTextTracks=()=>{},ft.prototype.remoteTextTrackEls=()=>{},Gi.names.forEach(function(s){const e=Gi[s];ft.prototype[e.getterName]=function(){return this.tech_?this.tech_[e.getterName]():(this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName])}}),ft.prototype.crossorigin=ft.prototype.crossOrigin,ft.players={};const wd=P.navigator;ft.prototype.options_={techOrder:Ve.defaultTechOrder_,html5:{},enableSourceset:!0,inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","titleBar","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:wd&&(wd.languages&&wd.languages[0]||wd.userLanguage||wd.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},sS.forEach(function(s){ft.prototype[`handleTech${Ht(s)}_`]=function(){return this.trigger(s)}}),ce.registerComponent("Player",ft);const Ap="plugin",pu="activePlugins_",mu={},Dp=s=>mu.hasOwnProperty(s),wp=s=>Dp(s)?mu[s]:void 0,rS=(s,e)=>{s[pu]=s[pu]||{},s[pu][e]=!0},kp=(s,e,i)=>{const r=(i?"before":"")+"pluginsetup";s.trigger(r,e),s.trigger(r+":"+e.name,e)},K3=function(s,e){const i=function(){kp(this,{name:s,plugin:e,instance:null},!0);const r=e.apply(this,arguments);return rS(this,s),kp(this,{name:s,plugin:e,instance:r}),r};return Object.keys(e).forEach(function(r){i[r]=e[r]}),i},aS=(s,e)=>(e.prototype.name=s,function(...i){kp(this,{name:s,plugin:e,instance:null},!0);const r=new e(this,...i);return this[s]=()=>r,kp(this,r.getEventHash()),r});class on{constructor(e){if(this.constructor===on)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=e,this.log||(this.log=this.player.log.createLogger(this.name)),L0(this),delete this.trigger,Q1(this,this.constructor.defaultState),rS(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,i={}){return lu(this.eventBusEl_,e,this.getEventHash(i))}handleStateChanged(e){}dispose(){const{name:e,player:i}=this;this.trigger("dispose"),this.off(),i.off("dispose",this.dispose),i[pu][e]=!1,this.player=this.state=null,i[e]=aS(e,mu[e])}static isBasic(e){const i=typeof e=="string"?wp(e):e;return typeof i=="function"&&!on.prototype.isPrototypeOf(i.prototype)}static registerPlugin(e,i){if(typeof e!="string")throw new Error(`Illegal plugin name, "${e}", must be a string, was ${typeof e}.`);if(Dp(e))Ke.warn(`A plugin named "${e}" already exists. You may want to avoid re-registering plugins!`);else if(ft.prototype.hasOwnProperty(e))throw new Error(`Illegal plugin name, "${e}", cannot share a name with an existing player method!`);if(typeof i!="function")throw new Error(`Illegal plugin for "${e}", must be a function, was ${typeof i}.`);return mu[e]=i,e!==Ap&&(on.isBasic(i)?ft.prototype[e]=K3(e,i):ft.prototype[e]=aS(e,i)),i}static deregisterPlugin(e){if(e===Ap)throw new Error("Cannot de-register base plugin.");Dp(e)&&(delete mu[e],delete ft.prototype[e])}static getPlugins(e=Object.keys(mu)){let i;return e.forEach(r=>{const o=wp(r);o&&(i=i||{},i[r]=o)}),i}static getPluginVersion(e){const i=wp(e);return i&&i.VERSION||""}}on.getPlugin=wp,on.BASE_PLUGIN_NAME=Ap,on.registerPlugin(Ap,on),ft.prototype.usingPlugin=function(s){return!!this[pu]&&this[pu][s]===!0},ft.prototype.hasPlugin=function(s){return!!Dp(s)};function Z3(s,e){let i=!1;return function(...r){return i||Ke.warn(s),i=!0,e.apply(this,r)}}function fs(s,e,i,r){return Z3(`${e} is deprecated and will be removed in ${s}.0; please use ${i} instead.`,r)}var J3={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 oS=s=>s.indexOf("#")===0?s.slice(1):s;function $(s,e,i){let r=$.getPlayer(s);if(r)return e&&Ke.warn(`Player "${s}" is already initialised. Options will not be applied.`),i&&r.ready(i),r;const o=typeof s=="string"?Da("#"+oS(s)):s;if(!su(o))throw new TypeError("The element or ID supplied is not valid. (videojs)");const c=("getRootNode"in o?o.getRootNode()instanceof P.ShadowRoot:!1)?o.getRootNode():o.ownerDocument.body;(!o.ownerDocument.defaultView||!c.contains(o))&&Ke.warn("The element supplied is not included in the DOM"),e=e||{},e.restoreEl===!0&&(e.restoreEl=(o.parentNode&&o.parentNode.hasAttribute&&o.parentNode.hasAttribute("data-vjs-player")?o.parentNode:o).cloneNode(!0)),xa("beforesetup").forEach(g=>{const b=g(o,vt(e));if(!Is(b)||Array.isArray(b)){Ke.error("please return an object in beforesetup hooks");return}e=vt(e,b)});const p=ce.getComponent("Player");return r=new p(o,e,i),xa("setup").forEach(g=>g(r)),r}if($.hooks_=kr,$.hooks=xa,$.hook=PR,$.hookOnce=UR,$.removeHook=v1,P.VIDEOJS_NO_DYNAMIC_STYLE!==!0&&nu()){let s=Da(".vjs-styles-defaults");if(!s){s=V1("vjs-styles-defaults");const e=Da("head");e&&e.insertBefore(s,e.firstChild),$1(s,` +`),this.tech_}version(){return{"video.js":_0}}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 i=()=>{const o=this.muted();this.muted(!0);const u=()=>{this.muted(o)};this.playTerminatedQueue_.push(u);const c=this.play();if(xd(c))return c.catch(p=>{throw u(),new Error(`Rejection at manualAutoplay. Restoring muted value. ${p||""}`)})};let r;if(e==="any"&&!this.muted()?(r=this.play(),xd(r)&&(r=r.catch(i))):e==="muted"&&!this.muted()?r=i():r=this.play(),!!xd(r))return r.then(()=>{this.trigger({type:"autoplay-success",autoplay:e})}).catch(()=>{this.trigger({type:"autoplay-failure",autoplay:e})})}updateSourceCaches_(e=""){let i=e,r="";typeof i!="string"&&(i=e.src,r=e.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],i&&!r&&(r=v3(this,i)),this.cache_.source=vt({},e,{src:i,type:r});const o=this.cache_.sources.filter(g=>g.src&&g.src===i),u=[],c=this.$$("source"),p=[];for(let g=0;gthis.updateSourceCaches_(u);const r=this.currentSource().src,o=e.src;r&&!/^blob:/.test(r)&&/^blob:/.test(o)&&(!this.lastSource_||this.lastSource_.tech!==o&&this.lastSource_.player!==r)&&(i=()=>{}),i(o),e.src||this.tech_.any(["sourceset","loadstart"],u=>{if(u.type==="sourceset")return;const c=this.techGet_("currentSrc");this.lastSource_.tech=c,this.updateSourceCaches_(c)})}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(),i=()=>{e!==this.currentTime()&&(this.removeClass("vjs-waiting"),this.off("timeupdate",i))};this.on("timeupdate",i)}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()?Us(this.play()):this.pause())}handleTechDoubleClick_(e){if(!this.controls_)return;Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),r=>r.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()&&!pe.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 i=e.target.player;if(i&&i!==this)return;const r=this.el();let o=pe[this.fsApi_.fullscreenElement]===r;!o&&r.matches&&(o=r.matches(":"+this.fsApi_.fullscreen)),this.isFullscreen(o)}handleTechFullscreenChange_(e,i){i&&(i.nativeIOSFullscreen&&(this.addClass("vjs-ios-native-fs"),this.tech_.one("webkitendfullscreen",()=>{this.removeClass("vjs-ios-native-fs")})),this.isFullscreen(i.isFullscreen))}handleTechFullscreenError_(e,i){this.trigger("fullscreenerror",i)}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,i){this.ready(function(){if(e in f3)return d3(this.middleware_,this.tech_,e,i);if(e in h2)return d2(this.middleware_,this.tech_,e,i);try{this.tech_&&this.tech_[e](i)}catch(r){throw Ke(r),r}},!0)}techGet_(e){if(!(!this.tech_||!this.tech_.isReady_)){if(e in h3)return c3(this.middleware_,this.tech_,e);if(e in h2)return d2(this.middleware_,this.tech_,e);try{return this.tech_[e]()}catch(i){throw this.tech_[e]===void 0?(Ke(`Video.js: ${e} method not defined for ${this.techName_} playback technology.`,i),i):i.name==="TypeError"?(Ke(`Video.js: ${e} unavailable on ${this.techName_} playback technology element.`,i),this.tech_.isReady_=!1,i):(Ke(i),i)}}}play(){return new Promise(e=>{this.play_(e)})}play_(e=Us){this.playCallbacks_.push(e);const i=!!(!this.changingSrc_&&(this.src()||this.currentSrc())),r=!!(op||Ii);if(this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),!this.isReady_||!i){this.waitToPlay_=c=>{this.play_()},this.one(["ready","loadstart"],this.waitToPlay_),!i&&r&&this.load();return}const o=this.techGet_("play");r&&this.hasClass("vjs-ended")&&this.resetProgressBar_(),o===null?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(o)}runPlayTerminatedQueue_(){const e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],e.forEach(function(i){i()})}runPlayCallbacks_(e){const i=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],i.forEach(function(r){r(e)})}pause(){this.techCall_("pause")}paused(){return this.techGet_("paused")!==!1}played(){return this.techGet_("played")||hs(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=hs(0,0)),e}seekable(){let e=this.techGet_("seekable");return(!e||!e.length)&&(e=hs(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 i2(this.buffered(),this.duration())}bufferedEnd(){const e=this.buffered(),i=this.duration();let r=e.end(e.length-1);return r>i&&(r=i),r}volume(e){let i;if(e!==void 0){i=Math.max(0,Math.min(1,e)),this.cache_.volume=i,this.techCall_("setVolume",i),i>0&&this.lastVolume_(i);return}return i=parseFloat(this.techGet_("volume")),isNaN(i)?1:i}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 i=this.isFullscreen_;this.isFullscreen_=!!e,this.isFullscreen_!==i&&this.fsApi_.prefixed&&this.trigger("fullscreenchange"),this.toggleFullscreenClass_();return}return this.isFullscreen_}requestFullscreen(e){this.isInPictureInPicture()&&this.exitPictureInPicture();const i=this;return new Promise((r,o)=>{function u(){i.off("fullscreenerror",p),i.off("fullscreenchange",c)}function c(){u(),r()}function p(b,S){u(),o(S)}i.one("fullscreenchange",c),i.one("fullscreenerror",p);const g=i.requestFullscreenHelper_(e);g&&(g.then(u,u),g.then(r,o))})}requestFullscreenHelper_(e){let i;if(this.fsApi_.prefixed||(i=this.options_.fullscreen&&this.options_.fullscreen.options||{},e!==void 0&&(i=e)),this.fsApi_.requestFullscreen){const r=this.el_[this.fsApi_.requestFullscreen](i);return r&&r.then(()=>this.isFullscreen(!0),()=>this.isFullscreen(!1)),r}else this.tech_.supportsFullScreen()&&!this.options_.preferFullWindow?this.techCall_("enterFullScreen"):this.enterFullWindow()}exitFullscreen(){const e=this;return new Promise((i,r)=>{function o(){e.off("fullscreenerror",c),e.off("fullscreenchange",u)}function u(){o(),i()}function c(g,b){o(),r(b)}e.one("fullscreenchange",u),e.one("fullscreenerror",c);const p=e.exitFullscreenHelper_();p&&(p.then(o,o),p.then(i,r))})}exitFullscreenHelper_(){if(this.fsApi_.requestFullscreen){const e=pe[this.fsApi_.exitFullscreen]();return e&&Us(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=pe.documentElement.style.overflow,Sn(pe,"keydown",this.boundFullWindowOnEscKey_),pe.documentElement.style.overflow="hidden",Do(pe.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,Ni(pe,"keydown",this.boundFullWindowOnEscKey_),pe.documentElement.style.overflow=this.docOrigOverflow,lp(pe.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&&P.documentPictureInPicture){const e=pe.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(Ue("p",{className:"vjs-pip-text"},{},this.localize("Playing in picture-in-picture"))),P.documentPictureInPicture.requestWindow({width:this.videoWidth(),height:this.videoHeight()}).then(i=>(z1(i),this.el_.parentNode.insertBefore(e,this.el_),i.document.body.appendChild(this.el_),i.document.body.classList.add("vjs-pip-window"),this.player_.isInPictureInPicture(!0),this.player_.trigger({type:"enterpictureinpicture",pipWindow:i}),i.addEventListener("pagehide",r=>{const o=r.target.querySelector(".video-js");e.parentNode.replaceChild(o,e),this.player_.isInPictureInPicture(!1),this.player_.trigger("leavepictureinpicture")}),i))}return"pictureInPictureEnabled"in pe&&this.disablePictureInPicture()===!1?this.techGet_("requestPictureInPicture"):Promise.reject("No PiP mode is available")}exitPictureInPicture(){if(P.documentPictureInPicture&&P.documentPictureInPicture.window)return P.documentPictureInPicture.window.close(),Promise.resolve();if("pictureInPictureEnabled"in pe)return pe.exitPictureInPicture()}handleKeyDown(e){const{userActions:i}=this.options_;!i||!i.hotkeys||(o=>{const u=o.tagName.toLowerCase();if(o.isContentEditable)return!0;const c=["button","checkbox","hidden","radio","reset","submit"];return u==="input"?c.indexOf(o.type)===-1:["textarea"].indexOf(u)!==-1})(this.el_.ownerDocument.activeElement)||(typeof i.hotkeys=="function"?i.hotkeys.call(this,e):this.handleHotkeys(e))}handleHotkeys(e){const i=this.options_.userActions?this.options_.userActions.hotkeys:{},{fullscreenKey:r=c=>e.key.toLowerCase()==="f",muteKey:o=c=>e.key.toLowerCase()==="m",playPauseKey:u=c=>e.key.toLowerCase()==="k"||e.key.toLowerCase()===" "}=i;if(r.call(this,e)){e.preventDefault(),e.stopPropagation();const c=ce.getComponent("FullscreenToggle");pe[this.fsApi_.fullscreenEnabled]!==!1&&c.prototype.handleClick.call(this,e)}else o.call(this,e)?(e.preventDefault(),e.stopPropagation(),ce.getComponent("MuteToggle").prototype.handleClick.call(this,e)):u.call(this,e)&&(e.preventDefault(),e.stopPropagation(),ce.getComponent("PlayToggle").prototype.handleClick.call(this,e))}canPlayType(e){let i;for(let r=0,o=this.options_.techOrder;r[p,Ve.getTech(p)]).filter(([p,g])=>g?g.isSupported():(Ke.error(`The "${p}" tech is undefined. Skipped browser support check for that tech.`),!1)),r=function(p,g,b){let S;return p.some(E=>g.some(A=>{if(S=b(E,A),S)return!0})),S};let o;const u=p=>(g,b)=>p(b,g),c=([p,g],b)=>{if(g.canPlaySource(b,this.options_[p.toLowerCase()]))return{source:b,tech:p}};return this.options_.sourceOrder?o=r(e,i,u(c)):o=r(i,e,c),o||!1}handleSrc_(e,i){if(typeof e>"u")return this.cache_.src||"";this.resetRetryOnError_&&this.resetRetryOnError_();const r=f2(e);if(!r.length){this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0);return}if(this.changingSrc_=!0,i||(this.cache_.sources=r),this.updateSourceCaches_(r[0]),l3(this,r[0],(o,u)=>{if(this.middleware_=u,i||(this.cache_.sources=r),this.updateSourceCaches_(o),this.src_(o)){if(r.length>1)return this.handleSrc_(r.slice(1));this.changingSrc_=!1,this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0),this.triggerReady();return}u3(u,this.tech_)}),r.length>1){const o=()=>{this.error(null),this.handleSrc_(r.slice(1),!0)},u=()=>{this.off("error",o)};this.one("error",o),this.one("playing",u),this.resetRetryOnError_=()=>{this.off("error",o),this.off("playing",u)}}}src(e){return this.handleSrc_(e,!1)}src_(e){const i=this.selectSource([e]);return i?K1(i.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_(i.tech,i.source),this.tech_.ready(()=>{this.changingSrc_=!1}),!1):!0}addSourceElement(e,i){return this.tech_?this.tech_.addSourceElement(e,i):!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();Us(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}),Or(this)&&this.trigger("playerreset")}resetControlBarUI_(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()}resetProgressBar_(){this.currentTime(0);const{currentTimeDisplay:e,durationDisplay:i,progressControl:r,remainingTimeDisplay:o}=this.controlBar||{},{seekBar:u}=r||{};e&&e.updateContent(),i&&i.updateContent(),o&&o.updateContent(),u&&(u.update(),u.loadProgressBar&&u.loadProgressBar.update())}resetPlaybackRate_(){this.playbackRate(this.defaultPlaybackRate()),this.handleTechRateChange_()}resetVolumeBar_(){this.volume(1),this.trigger("volumechange")}currentSources(){const e=this.currentSource(),i=[];return Object.keys(e).length!==0&&i.push(e),this.cache_.sources||i}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 i;typeof e=="string"&&/(any|play|muted)/.test(e)||e===!0&&this.options_.normalizeAutoplay?(this.options_.autoplay=e,this.manualAutoplay_(typeof e=="string"?e:"play"),i=!1):e?this.options_.autoplay=!0:this.options_.autoplay=!1,i=typeof i>"u"?this.options_.autoplay:i,this.tech_&&this.techCall_("setAutoplay",i)}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(xa("beforeerror").forEach(i=>{const r=i(this,e);if(!(Is(r)&&!Array.isArray(r)||typeof r=="string"||typeof r=="number"||r===null)){this.log.error("please return a value that MediaError expects in beforeerror hooks");return}e=r}),this.options_.suppressNotSupportedError&&e&&e.code===4){const i=function(){this.error(e)};this.options_.suppressNotSupportedError=!1,this.any(["click","touchstart"],i),this.one("loadstart",function(){this.off(["click","touchstart"],i)});return}if(e===null){this.error_=null,this.removeClass("vjs-error"),this.errorDisplay&&this.errorDisplay.close();return}this.error_=new Nt(e),this.addClass("vjs-error"),Ke.error(`(CODE:${this.error_.code} ${Nt.errorTypes[this.error_.code]})`,this.error_.message,this.error_),this.trigger("error"),xa("error").forEach(i=>i(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(i){i.stopPropagation(),i.preventDefault()}),this.userActivity_=!1,this.removeClass("vjs-user-active"),this.addClass("vjs-user-inactive"),this.trigger("userinactive")}}listenForUserActivity_(){let e,i,r;const o=Dt(this,this.reportUserActivity),u=function(E){(E.screenX!==i||E.screenY!==r)&&(i=E.screenX,r=E.screenY,o())},c=function(){o(),this.clearInterval(e),e=this.setInterval(o,250)},p=function(E){o(),this.clearInterval(e)};this.on("mousedown",c),this.on("mousemove",u),this.on("mouseup",p),this.on("mouseleave",p);const g=this.getChild("controlBar");g&&!Ii&&!ds&&(g.on("mouseenter",function(E){this.player().options_.inactivityTimeout!==0&&(this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout),this.player().options_.inactivityTimeout=0}),g.on("mouseleave",function(E){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout})),this.on("keydown",o),this.on("keyup",o);let b;const S=function(){if(!this.userActivity_)return;this.userActivity_=!1,this.userActive(!0),this.clearTimeout(b);const E=this.options_.inactivityTimeout;E<=0||(b=this.setTimeout(function(){this.userActivity_||this.userActive(!1)},E))};this.setInterval(S,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(),i=this.getChild("ControlBar"),r=i&&i.currentHeight();e.forEach(o=>{o!==i&&o.el_&&!o.hasClass("vjs-hidden")&&(o.hide(),this.audioOnlyCache_.hiddenChildren.push(o))}),this.audioOnlyCache_.playerHeight=this.currentHeight(),this.audioOnlyCache_.controlBarHeight=r,this.on("playerresize",this.boundUpdatePlayerHeightOnAudioOnlyMode_),this.height(r),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 i=[];return this.isInPictureInPicture()&&i.push(this.exitPictureInPicture()),this.isFullscreen()&&i.push(this.exitFullscreen()),this.audioPosterMode()&&i.push(this.audioPosterMode(!1)),Promise.all(i).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,i,r){if(this.tech_)return this.tech_.addTextTrack(e,i,r)}addRemoteTextTrack(e,i){if(this.tech_)return this.tech_.addRemoteTextTrack(e,i)}removeRemoteTextTrack(e={}){let{track:i}=e;if(i||(i=e),this.tech_)return this.tech_.removeRemoteTextTrack(i)}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(),Or(this)&&this.trigger("languagechange"))}languages(){return vt(ft.prototype.options_.languages,this.languages_)}toJSON(){const e=vt(this.options_),i=e.tracks;e.tracks=[];for(let r=0;r{this.removeChild(r)}),r.open(),r}updateCurrentBreakpoint_(){if(!this.responsive())return;const e=this.currentBreakpoint(),i=this.currentWidth();for(let r=0;rthis.addRemoteTextTrack(E,!1)),this.titleBar&&this.titleBar.update({title:S,description:c||o||""}),this.ready(i)}getMedia(){if(!this.cache_.media){const e=this.poster(),i=this.currentSources(),r=Array.prototype.map.call(this.remoteTextTracks(),u=>({kind:u.kind,label:u.label,language:u.language,src:u.src})),o={src:i,textTracks:r};return e&&(o.poster=e,o.artwork=[{src:o.poster,type:Tp(o.poster)}]),o}return vt(this.cache_.media)}static getTagSettings(e){const i={sources:[],tracks:[]},r=Aa(e),o=r["data-setup"];if(vd(e,"vjs-fill")&&(r.fill=!0),vd(e,"vjs-fluid")&&(r.fluid=!0),o!==null)try{Object.assign(r,JSON.parse(o||"{}"))}catch(u){Ke.error("data-setup",u)}if(Object.assign(i,r),e.hasChildNodes()){const u=e.childNodes;for(let c=0,p=u.length;ctypeof i=="number")&&(this.cache_.playbackRates=e,this.trigger("playbackrateschange"))}}ft.prototype.videoTracks=()=>{},ft.prototype.audioTracks=()=>{},ft.prototype.textTracks=()=>{},ft.prototype.remoteTextTracks=()=>{},ft.prototype.remoteTextTrackEls=()=>{},Gi.names.forEach(function(s){const e=Gi[s];ft.prototype[e.getterName]=function(){return this.tech_?this.tech_[e.getterName]():(this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName])}}),ft.prototype.crossorigin=ft.prototype.crossOrigin,ft.players={};const wd=P.navigator;ft.prototype.options_={techOrder:Ve.defaultTechOrder_,html5:{},enableSourceset:!0,inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","titleBar","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:wd&&(wd.languages&&wd.languages[0]||wd.userLanguage||wd.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},sS.forEach(function(s){ft.prototype[`handleTech${Ht(s)}_`]=function(){return this.trigger(s)}}),ce.registerComponent("Player",ft);const Ap="plugin",pu="activePlugins_",mu={},Dp=s=>mu.hasOwnProperty(s),wp=s=>Dp(s)?mu[s]:void 0,rS=(s,e)=>{s[pu]=s[pu]||{},s[pu][e]=!0},kp=(s,e,i)=>{const r=(i?"before":"")+"pluginsetup";s.trigger(r,e),s.trigger(r+":"+e.name,e)},K3=function(s,e){const i=function(){kp(this,{name:s,plugin:e,instance:null},!0);const r=e.apply(this,arguments);return rS(this,s),kp(this,{name:s,plugin:e,instance:r}),r};return Object.keys(e).forEach(function(r){i[r]=e[r]}),i},aS=(s,e)=>(e.prototype.name=s,function(...i){kp(this,{name:s,plugin:e,instance:null},!0);const r=new e(this,...i);return this[s]=()=>r,kp(this,r.getEventHash()),r});class on{constructor(e){if(this.constructor===on)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=e,this.log||(this.log=this.player.log.createLogger(this.name)),L0(this),delete this.trigger,Q1(this,this.constructor.defaultState),rS(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,i={}){return lu(this.eventBusEl_,e,this.getEventHash(i))}handleStateChanged(e){}dispose(){const{name:e,player:i}=this;this.trigger("dispose"),this.off(),i.off("dispose",this.dispose),i[pu][e]=!1,this.player=this.state=null,i[e]=aS(e,mu[e])}static isBasic(e){const i=typeof e=="string"?wp(e):e;return typeof i=="function"&&!on.prototype.isPrototypeOf(i.prototype)}static registerPlugin(e,i){if(typeof e!="string")throw new Error(`Illegal plugin name, "${e}", must be a string, was ${typeof e}.`);if(Dp(e))Ke.warn(`A plugin named "${e}" already exists. You may want to avoid re-registering plugins!`);else if(ft.prototype.hasOwnProperty(e))throw new Error(`Illegal plugin name, "${e}", cannot share a name with an existing player method!`);if(typeof i!="function")throw new Error(`Illegal plugin for "${e}", must be a function, was ${typeof i}.`);return mu[e]=i,e!==Ap&&(on.isBasic(i)?ft.prototype[e]=K3(e,i):ft.prototype[e]=aS(e,i)),i}static deregisterPlugin(e){if(e===Ap)throw new Error("Cannot de-register base plugin.");Dp(e)&&(delete mu[e],delete ft.prototype[e])}static getPlugins(e=Object.keys(mu)){let i;return e.forEach(r=>{const o=wp(r);o&&(i=i||{},i[r]=o)}),i}static getPluginVersion(e){const i=wp(e);return i&&i.VERSION||""}}on.getPlugin=wp,on.BASE_PLUGIN_NAME=Ap,on.registerPlugin(Ap,on),ft.prototype.usingPlugin=function(s){return!!this[pu]&&this[pu][s]===!0},ft.prototype.hasPlugin=function(s){return!!Dp(s)};function Z3(s,e){let i=!1;return function(...r){return i||Ke.warn(s),i=!0,e.apply(this,r)}}function fs(s,e,i,r){return Z3(`${e} is deprecated and will be removed in ${s}.0; please use ${i} instead.`,r)}var J3={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 oS=s=>s.indexOf("#")===0?s.slice(1):s;function V(s,e,i){let r=V.getPlayer(s);if(r)return e&&Ke.warn(`Player "${s}" is already initialised. Options will not be applied.`),i&&r.ready(i),r;const o=typeof s=="string"?Da("#"+oS(s)):s;if(!su(o))throw new TypeError("The element or ID supplied is not valid. (videojs)");const c=("getRootNode"in o?o.getRootNode()instanceof P.ShadowRoot:!1)?o.getRootNode():o.ownerDocument.body;(!o.ownerDocument.defaultView||!c.contains(o))&&Ke.warn("The element supplied is not included in the DOM"),e=e||{},e.restoreEl===!0&&(e.restoreEl=(o.parentNode&&o.parentNode.hasAttribute&&o.parentNode.hasAttribute("data-vjs-player")?o.parentNode:o).cloneNode(!0)),xa("beforesetup").forEach(g=>{const b=g(o,vt(e));if(!Is(b)||Array.isArray(b)){Ke.error("please return an object in beforesetup hooks");return}e=vt(e,b)});const p=ce.getComponent("Player");return r=new p(o,e,i),xa("setup").forEach(g=>g(r)),r}if(V.hooks_=kr,V.hooks=xa,V.hook=PR,V.hookOnce=UR,V.removeHook=v1,P.VIDEOJS_NO_DYNAMIC_STYLE!==!0&&nu()){let s=Da(".vjs-styles-defaults");if(!s){s=V1("vjs-styles-defaults");const e=Da("head");e&&e.insertBefore(s,e.firstChild),$1(s,` .video-js { width: 300px; height: 150px; @@ -463,12 +463,12 @@ See https://github.com/videojs/video.js/issues/2617 for more info. .vjs-fluid:not(.vjs-audio-only-mode) { padding-top: 56.25% } - `)}}D0(1,$),$.VERSION=_0,$.options=ft.prototype.options_,$.getPlayers=()=>ft.players,$.getPlayer=s=>{const e=ft.players;let i;if(typeof s=="string"){const r=oS(s),o=e[r];if(o)return o;i=Da("#"+r)}else i=s;if(su(i)){const{player:r,playerId:o}=i;if(r||e[o])return r||e[o]}},$.getAllPlayers=()=>Object.keys(ft.players).map(s=>ft.players[s]).filter(Boolean),$.players=ft.players,$.getComponent=ce.getComponent,$.registerComponent=(s,e)=>(Ve.isTech(e)&&Ke.warn(`The ${s} tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)`),ce.registerComponent.call(ce,s,e)),$.getTech=Ve.getTech,$.registerTech=Ve.registerTech,$.use=o3,Object.defineProperty($,"middleware",{value:{},writeable:!1,enumerable:!0}),Object.defineProperty($.middleware,"TERMINATOR",{value:_p,writeable:!1,enumerable:!0}),$.browser=w1,$.obj=HR,$.mergeOptions=fs(9,"videojs.mergeOptions","videojs.obj.merge",vt),$.defineLazyProperty=fs(9,"videojs.defineLazyProperty","videojs.obj.defineLazyProperty",Zf),$.bind=fs(9,"videojs.bind","native Function.prototype.bind",Dt),$.registerPlugin=on.registerPlugin,$.deregisterPlugin=on.deregisterPlugin,$.plugin=(s,e)=>(Ke.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),on.registerPlugin(s,e)),$.getPlugins=on.getPlugins,$.getPlugin=on.getPlugin,$.getPluginVersion=on.getPluginVersion,$.addLanguage=function(s,e){return s=(""+s).toLowerCase(),$.options.languages=vt($.options.languages,{[s]:e}),$.options.languages[s]},$.log=Ke,$.createLogger=_1,$.time=e3,$.createTimeRange=fs(9,"videojs.createTimeRange","videojs.time.createTimeRanges",hs),$.createTimeRanges=fs(9,"videojs.createTimeRanges","videojs.time.createTimeRanges",hs),$.formatTime=fs(9,"videojs.formatTime","videojs.time.formatTime",ko),$.setFormatTime=fs(9,"videojs.setFormatTime","videojs.time.setFormatTime",e2),$.resetFormatTime=fs(9,"videojs.resetFormatTime","videojs.time.resetFormatTime",t2),$.parseUrl=fs(9,"videojs.parseUrl","videojs.url.parseUrl",q0),$.isCrossOrigin=fs(9,"videojs.isCrossOrigin","videojs.url.isCrossOrigin",vp),$.EventTarget=xn,$.any=O0,$.on=Sn,$.one=pp,$.off=Ni,$.trigger=lu,$.xhr=j_,$.TrackList=Oo,$.TextTrack=Ed,$.TextTrackList=z0,$.AudioTrack=u2,$.AudioTrackList=n2,$.VideoTrack=c2,$.VideoTrackList=s2,["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach(s=>{$[s]=function(){return Ke.warn(`videojs.${s}() is deprecated; use videojs.dom.${s}() instead`),j1[s].apply(null,arguments)}}),$.computedStyle=fs(9,"videojs.computedStyle","videojs.dom.computedStyle",ou),$.dom=j1,$.fn=YR,$.num=w3,$.str=ZR,$.url=r3,$.Error=J3;/*! @name videojs-contrib-quality-levels @version 4.1.0 @license Apache-2.0 */class e4{constructor(e){let i=this;return i.id=e.id,i.label=i.id,i.width=e.width,i.height=e.height,i.bitrate=e.bandwidth,i.frameRate=e.frameRate,i.enabled_=e.enabled,Object.defineProperty(i,"enabled",{get(){return i.enabled_()},set(r){i.enabled_(r)}}),i}}class Op extends $.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 i=this.getQualityLevelById(e.id);if(i)return i;const r=this.levels_.length;return i=new e4(e),""+r in this||Object.defineProperty(this,r,{get(){return this.levels_[r]}}),this.levels_.push(i),this.trigger({qualityLevel:i,type:"addqualitylevel"}),i}removeQualityLevel(e){let i=null;for(let r=0,o=this.length;rr&&this.selectedIndex_--;break}return i&&this.trigger({qualityLevel:e,type:"removequalitylevel"}),i}getQualityLevelById(e){for(let i=0,r=this.length;ir,s.qualityLevels.VERSION=lS,r},uS=function(s){return t4(this,$.obj.merge({},s))};$.registerPlugin("qualityLevels",uS),uS.VERSION=lS;/*! @name @videojs/http-streaming @version 3.17.0 @license Apache-2.0 */const ln=Nf,Rp=(s,e)=>e&&e.responseURL&&s!==e.responseURL?e.responseURL:s,$n=s=>$.log.debug?$.log.debug.bind($,"VHS:",`${s} >`):function(){};function pt(...s){const e=$.obj||$;return(e.merge||e.mergeOptions).apply(e,s)}function hi(...s){const e=$.time||$;return(e.createTimeRanges||e.createTimeRanges).apply(e,s)}function i4(s){if(s.length===0)return"Buffered Ranges are empty";let e=`Buffered Ranges: + `)}}D0(1,V),V.VERSION=_0,V.options=ft.prototype.options_,V.getPlayers=()=>ft.players,V.getPlayer=s=>{const e=ft.players;let i;if(typeof s=="string"){const r=oS(s),o=e[r];if(o)return o;i=Da("#"+r)}else i=s;if(su(i)){const{player:r,playerId:o}=i;if(r||e[o])return r||e[o]}},V.getAllPlayers=()=>Object.keys(ft.players).map(s=>ft.players[s]).filter(Boolean),V.players=ft.players,V.getComponent=ce.getComponent,V.registerComponent=(s,e)=>(Ve.isTech(e)&&Ke.warn(`The ${s} tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)`),ce.registerComponent.call(ce,s,e)),V.getTech=Ve.getTech,V.registerTech=Ve.registerTech,V.use=o3,Object.defineProperty(V,"middleware",{value:{},writeable:!1,enumerable:!0}),Object.defineProperty(V.middleware,"TERMINATOR",{value:_p,writeable:!1,enumerable:!0}),V.browser=w1,V.obj=HR,V.mergeOptions=fs(9,"videojs.mergeOptions","videojs.obj.merge",vt),V.defineLazyProperty=fs(9,"videojs.defineLazyProperty","videojs.obj.defineLazyProperty",Zf),V.bind=fs(9,"videojs.bind","native Function.prototype.bind",Dt),V.registerPlugin=on.registerPlugin,V.deregisterPlugin=on.deregisterPlugin,V.plugin=(s,e)=>(Ke.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),on.registerPlugin(s,e)),V.getPlugins=on.getPlugins,V.getPlugin=on.getPlugin,V.getPluginVersion=on.getPluginVersion,V.addLanguage=function(s,e){return s=(""+s).toLowerCase(),V.options.languages=vt(V.options.languages,{[s]:e}),V.options.languages[s]},V.log=Ke,V.createLogger=_1,V.time=e3,V.createTimeRange=fs(9,"videojs.createTimeRange","videojs.time.createTimeRanges",hs),V.createTimeRanges=fs(9,"videojs.createTimeRanges","videojs.time.createTimeRanges",hs),V.formatTime=fs(9,"videojs.formatTime","videojs.time.formatTime",ko),V.setFormatTime=fs(9,"videojs.setFormatTime","videojs.time.setFormatTime",e2),V.resetFormatTime=fs(9,"videojs.resetFormatTime","videojs.time.resetFormatTime",t2),V.parseUrl=fs(9,"videojs.parseUrl","videojs.url.parseUrl",q0),V.isCrossOrigin=fs(9,"videojs.isCrossOrigin","videojs.url.isCrossOrigin",vp),V.EventTarget=xn,V.any=O0,V.on=Sn,V.one=pp,V.off=Ni,V.trigger=lu,V.xhr=j_,V.TrackList=Oo,V.TextTrack=Ed,V.TextTrackList=z0,V.AudioTrack=u2,V.AudioTrackList=n2,V.VideoTrack=c2,V.VideoTrackList=s2,["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach(s=>{V[s]=function(){return Ke.warn(`videojs.${s}() is deprecated; use videojs.dom.${s}() instead`),j1[s].apply(null,arguments)}}),V.computedStyle=fs(9,"videojs.computedStyle","videojs.dom.computedStyle",ou),V.dom=j1,V.fn=YR,V.num=w3,V.str=ZR,V.url=r3,V.Error=J3;/*! @name videojs-contrib-quality-levels @version 4.1.0 @license Apache-2.0 */class e4{constructor(e){let i=this;return i.id=e.id,i.label=i.id,i.width=e.width,i.height=e.height,i.bitrate=e.bandwidth,i.frameRate=e.frameRate,i.enabled_=e.enabled,Object.defineProperty(i,"enabled",{get(){return i.enabled_()},set(r){i.enabled_(r)}}),i}}class Op extends V.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 i=this.getQualityLevelById(e.id);if(i)return i;const r=this.levels_.length;return i=new e4(e),""+r in this||Object.defineProperty(this,r,{get(){return this.levels_[r]}}),this.levels_.push(i),this.trigger({qualityLevel:i,type:"addqualitylevel"}),i}removeQualityLevel(e){let i=null;for(let r=0,o=this.length;rr&&this.selectedIndex_--;break}return i&&this.trigger({qualityLevel:e,type:"removequalitylevel"}),i}getQualityLevelById(e){for(let i=0,r=this.length;ir,s.qualityLevels.VERSION=lS,r},uS=function(s){return t4(this,V.obj.merge({},s))};V.registerPlugin("qualityLevels",uS),uS.VERSION=lS;/*! @name @videojs/http-streaming @version 3.17.0 @license Apache-2.0 */const ln=Nf,Rp=(s,e)=>e&&e.responseURL&&s!==e.responseURL?e.responseURL:s,$n=s=>V.log.debug?V.log.debug.bind(V,"VHS:",`${s} >`):function(){};function pt(...s){const e=V.obj||V;return(e.merge||e.mergeOptions).apply(e,s)}function hi(...s){const e=V.time||V;return(e.createTimeRanges||e.createTimeRanges).apply(e,s)}function i4(s){if(s.length===0)return"Buffered Ranges are empty";let e=`Buffered Ranges: `;for(let i=0;i ${o}. Duration (${o-r}) -`}return e}const Fs=1/30,Hs=Fs*3,cS=function(s,e){const i=[];let r;if(s&&s.length)for(r=0;r=e})},Mp=function(s,e){return cS(s,function(i){return i-Fs>=e})},n4=function(s){if(s.length<2)return hi();const e=[];for(let i=1;i{const e=[];if(!s||!s.length)return"";for(let i=0;i "+s.end(i));return e.join(", ")},r4=function(s,e,i=1){return((s.length?s.end(s.length-1):0)-e)/i},Io=s=>{const e=[];for(let i=0;iu)){if(e>o&&e<=u){i+=u-e;continue}i+=u-o}}return i},yy=(s,e)=>{if(!e.preload)return e.duration;let i=0;return(e.parts||[]).forEach(function(r){i+=r.duration}),(e.preloadHints||[]).forEach(function(r){r.type==="PART"&&(i+=s.partTargetDuration)}),i},vy=s=>(s.segments||[]).reduce((e,i,r)=>(i.parts?i.parts.forEach(function(o,u){e.push({duration:o.duration,segmentIndex:r,partIndex:u,part:o,segment:i})}):e.push({duration:i.duration,segmentIndex:r,partIndex:null,segment:i,part:null}),e),[]),hS=s=>{const e=s.segments&&s.segments.length&&s.segments[s.segments.length-1];return e&&e.parts||[]},fS=({preloadSegment:s})=>{if(!s)return;const{parts:e,preloadHints:i}=s;let r=(i||[]).reduce((o,u)=>o+(u.type==="PART"?1:0),0);return r+=e&&e.length?e.length:0,r},pS=(s,e)=>{if(e.endList)return 0;if(s&&s.suggestedPresentationDelay)return s.suggestedPresentationDelay;const i=hS(e).length>0;return i&&e.serverControl&&e.serverControl.partHoldBack?e.serverControl.partHoldBack:i&&e.partTargetDuration?e.partTargetDuration*3:e.serverControl&&e.serverControl.holdBack?e.serverControl.holdBack:e.targetDuration?e.targetDuration*3:0},o4=function(s,e){let i=0,r=e-s.mediaSequence,o=s.segments[r];if(o){if(typeof o.start<"u")return{result:o.start,precise:!0};if(typeof o.end<"u")return{result:o.end-o.duration,precise:!0}}for(;r--;){if(o=s.segments[r],typeof o.end<"u")return{result:i+o.end,precise:!0};if(i+=yy(s,o),typeof o.start<"u")return{result:i+o.start,precise:!0}}return{result:i,precise:!1}},l4=function(s,e){let i=0,r,o=e-s.mediaSequence;for(;o"u"&&(e=s.mediaSequence+s.segments.length),e"u"){if(s.totalDuration)return s.totalDuration;if(!s.endList)return P.Infinity}return mS(s,e,i)},kd=function({defaultDuration:s,durationList:e,startIndex:i,endIndex:r}){let o=0;if(i>r&&([i,r]=[r,i]),i<0){for(let u=i;u0)for(let b=g-1;b>=0;b--){const S=p[b];if(c+=S.duration,u){if(c<0)continue}else if(c+Fs<=0)continue;return{partIndex:S.partIndex,segmentIndex:S.segmentIndex,startTime:o-kd({defaultDuration:s.targetDuration,durationList:p,startIndex:g,endIndex:b})}}return{partIndex:p[0]&&p[0].partIndex||null,segmentIndex:p[0]&&p[0].segmentIndex||0,startTime:e}}if(g<0){for(let b=g;b<0;b++)if(c-=s.targetDuration,c<0)return{partIndex:p[0]&&p[0].partIndex||null,segmentIndex:p[0]&&p[0].segmentIndex||0,startTime:e};g=0}for(let b=g;bFs,A=c===0,M=E&&c+Fs>=0;if(!((A||M)&&b!==p.length-1)){if(u){if(c>0)continue}else if(c-Fs>=0)continue;return{partIndex:S.partIndex,segmentIndex:S.segmentIndex,startTime:o+kd({defaultDuration:s.targetDuration,durationList:p,startIndex:g,endIndex:b})}}}return{segmentIndex:p[p.length-1].segmentIndex,partIndex:p[p.length-1].partIndex,startTime:e}},vS=function(s){return s.excludeUntil&&s.excludeUntil>Date.now()},by=function(s){return s.excludeUntil&&s.excludeUntil===1/0},Lp=function(s){const e=vS(s);return!s.disabled&&!e},d4=function(s){return s.disabled},h4=function(s){for(let e=0;e{if(s.playlists.length===1)return!0;const i=e.attributes.BANDWIDTH||Number.MAX_VALUE;return s.playlists.filter(r=>Lp(r)?(r.attributes.BANDWIDTH||0)!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),_S=function(s,e){const i=s&&s.mediaGroups&&s.mediaGroups.AUDIO||{};let r=!1;for(const o in i){for(const u in i[o])if(r=e(i[o][u]),r)break;if(r)break}return!!r},Od=s=>{if(!s||!s.playlists||!s.playlists.length)return _S(s,i=>i.playlists&&i.playlists.length||i.uri);for(let e=0;eiT(u))||_S(s,u=>Ty(i,u))))return!1}return!0};var un={liveEdgeDelay:pS,duration:gS,seekable:u4,getMediaInfoForTime:c4,isEnabled:Lp,isDisabled:d4,isExcluded:vS,isIncompatible:by,playlistEnd:yS,isAes:h4,hasAttribute:bS,estimateSegmentRequestTime:f4,isLowestEnabledRendition:_y,isAudioOnly:Od,playlistMatch:Ty,segmentDurationWithParts:yy};const{log:TS}=$,yu=(s,e)=>`${s}-${e}`,SS=(s,e,i)=>`placeholder-uri-${s}-${e}-${i}`,p4=({onwarn:s,oninfo:e,manifestString:i,customTagParsers:r=[],customTagMappers:o=[],llhls:u})=>{const c=new Nk;s&&c.on("warn",s),e&&c.on("info",e),r.forEach(b=>c.addParser(b)),o.forEach(b=>c.addTagMapper(b)),c.push(i),c.end();const p=c.manifest;if(u||(["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach(function(b){p.hasOwnProperty(b)&&delete p[b]}),p.segments&&p.segments.forEach(function(b){["parts","preloadHints"].forEach(function(S){b.hasOwnProperty(S)&&delete b[S]})})),!p.targetDuration){let b=10;p.segments&&p.segments.length&&(b=p.segments.reduce((S,E)=>Math.max(S,E.duration),0)),s&&s({message:`manifest has no targetDuration defaulting to ${b}`}),p.targetDuration=b}const g=hS(p);if(g.length&&!p.partTargetDuration){const b=g.reduce((S,E)=>Math.max(S,E.duration),0);s&&(s({message:`manifest has no partTargetDuration defaulting to ${b}`}),TS.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.")),p.partTargetDuration=b}return p},vu=(s,e)=>{s.mediaGroups&&["AUDIO","SUBTITLES"].forEach(i=>{if(s.mediaGroups[i])for(const r in s.mediaGroups[i])for(const o in s.mediaGroups[i][r]){const u=s.mediaGroups[i][r][o];e(u,i,r,o)}})},xS=({playlist:s,uri:e,id:i})=>{s.id=i,s.playlistErrors_=0,e&&(s.uri=e),s.attributes=s.attributes||{}},m4=s=>{let e=s.playlists.length;for(;e--;){const i=s.playlists[e];xS({playlist:i,id:yu(e,i.uri)}),i.resolvedUri=ln(s.uri,i.uri),s.playlists[i.id]=i,s.playlists[i.uri]=i,i.attributes.BANDWIDTH||TS.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}},g4=s=>{vu(s,e=>{e.uri&&(e.resolvedUri=ln(s.uri,e.uri))})},y4=(s,e)=>{const i=yu(0,e),r={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:P.location.href,resolvedUri:P.location.href,playlists:[{uri:e,id:i,resolvedUri:e,attributes:{}}]};return r.playlists[i]=r.playlists[0],r.playlists[e]=r.playlists[0],r},ES=(s,e,i=SS)=>{s.uri=e;for(let o=0;o{if(!o.playlists||!o.playlists.length){if(r&&u==="AUDIO"&&!o.uri)for(let g=0;g(o.set(u.id,u),o),new Map)}processDateRange(e){this.pendingDateRanges_.delete(e.id),this.processedDateRanges_.set(e.id,e)}getDateRangesToProcess(){if(this.offset_===null)return[];const e={},i=[];this.pendingDateRanges_.forEach((r,o)=>{if(!this.processedDateRanges_.has(o)&&(r.startTime=r.startDate.getTime()/1e3-this.offset_,r.processDateRange=()=>this.processDateRange(r),i.push(r),!!r.class))if(e[r.class]){const u=e[r.class].push(r);r.classListIndex=u-1}else e[r.class]=[r],r.classListIndex=0});for(const r of i){const o=e[r.class]||[];r.endDate?r.endTime=r.endDate.getTime()/1e3-this.offset_:r.endOnNext&&o[r.classListIndex+1]?r.endTime=o[r.classListIndex+1].startTime:r.duration?r.endTime=r.startTime+r.duration:r.plannedDuration?r.endTime=r.startTime+r.plannedDuration:r.endTime=r.startTime}return i}trimProcessedDateRanges_(e){new Map(this.processedDateRanges_).forEach((r,o)=>{r.startDate.getTime(){const o=e.status<200||e.status>299,u=e.status>=400&&e.status<=499,c={uri:e.uri,requestType:s},p=o&&!u||r;if(i&&u)c.error=Ft({},i),c.errorType=$.Error.NetworkRequestFailed;else if(e.aborted)c.errorType=$.Error.NetworkRequestAborted;else if(e.timedout)c.erroType=$.Error.NetworkRequestTimeout;else if(p){const g=r?$.Error.NetworkBodyParserFailed:$.Error.NetworkBadStatus;c.errorType=g,c.status=e.status,c.headers=e.headers}return c},v4=$n("CodecUtils"),DS=function(s){const e=s.attributes||{};if(e.CODECS)return Rs(e.CODECS)},wS=(s,e)=>{const i=e.attributes||{};return s&&s.mediaGroups&&s.mediaGroups.AUDIO&&i.AUDIO&&s.mediaGroups.AUDIO[i.AUDIO]},b4=(s,e)=>{if(!wS(s,e))return!0;const i=e.attributes||{},r=s.mediaGroups.AUDIO[i.AUDIO];for(const o in r)if(!r[o].uri&&!r[o].playlists)return!0;return!1},Rd=function(s){const e={};return s.forEach(({mediaType:i,type:r,details:o})=>{e[i]=e[i]||[],e[i].push(tT(`${r}${o}`))}),Object.keys(e).forEach(function(i){if(e[i].length>1){v4(`multiple ${i} codecs found as attributes: ${e[i].join(", ")}. Setting playlist codecs to null so that we wait for mux.js to probe segments for real codecs.`),e[i]=null;return}e[i]=e[i][0]}),e},kS=function(s){let e=0;return s.audio&&e++,s.video&&e++,e},Md=function(s,e){const i=e.attributes||{},r=Rd(DS(e)||[]);if(wS(s,e)&&!r.audio&&!b4(s,e)){const o=Rd(Uk(s,i.AUDIO)||[]);o.audio&&(r.audio=o.audio)}return r},{EventTarget:_4}=$,T4=(s,e)=>{if(e.endList||!e.serverControl)return s;const i={};if(e.serverControl.canBlockReload){const{preloadSegment:r}=e;let o=e.mediaSequence+e.segments.length;if(r){const u=r.parts||[],c=fS(e)-1;c>-1&&c!==u.length-1&&(i._HLS_part=c),(c>-1||u.length)&&o--}i._HLS_msn=o}if(e.serverControl&&e.serverControl.canSkipUntil&&(i._HLS_skip=e.serverControl.canSkipDateranges?"v2":"YES"),Object.keys(i).length){const r=new P.URL(s);["_HLS_skip","_HLS_msn","_HLS_part"].forEach(function(o){i.hasOwnProperty(o)&&r.searchParams.set(o,i[o])}),s=r.toString()}return s},S4=(s,e)=>{if(!s)return e;const i=pt(s,e);if(s.preloadHints&&!e.preloadHints&&delete i.preloadHints,s.parts&&!e.parts)delete i.parts;else if(s.parts&&e.parts)for(let r=0;r{const r=s.slice(),o=e.slice();i=i||0;const u=[];let c;for(let p=0;p{!s.resolvedUri&&s.uri&&(s.resolvedUri=ln(e,s.uri)),s.key&&!s.key.resolvedUri&&(s.key.resolvedUri=ln(e,s.key.uri)),s.map&&!s.map.resolvedUri&&(s.map.resolvedUri=ln(e,s.map.uri)),s.map&&s.map.key&&!s.map.key.resolvedUri&&(s.map.key.resolvedUri=ln(e,s.map.key.uri)),s.parts&&s.parts.length&&s.parts.forEach(i=>{i.resolvedUri||(i.resolvedUri=ln(e,i.uri))}),s.preloadHints&&s.preloadHints.length&&s.preloadHints.forEach(i=>{i.resolvedUri||(i.resolvedUri=ln(e,i.uri))})},RS=function(s){const e=s.segments||[],i=s.preloadSegment;if(i&&i.parts&&i.parts.length){if(i.preloadHints){for(let r=0;rs===e||s.segments&&e.segments&&s.segments.length===e.segments.length&&s.endList===e.endList&&s.mediaSequence===e.mediaSequence&&s.preloadSegment===e.preloadSegment,Sy=(s,e,i=MS)=>{const r=pt(s,{}),o=r.playlists[e.id];if(!o||i(o,e))return null;e.segments=RS(e);const u=pt(o,e);if(u.preloadSegment&&!e.preloadSegment&&delete u.preloadSegment,o.segments){if(e.skip){e.segments=e.segments||[];for(let c=0;c{OS(c,u.resolvedUri)});for(let c=0;c{if(c.playlists)for(let S=0;S{const i=s.segments||[],r=i[i.length-1],o=r&&r.parts&&r.parts[r.parts.length-1],u=o&&o.duration||r&&r.duration;return e&&u?u*1e3:(s.partTargetDuration||s.targetDuration||10)*500},LS=(s,e,i)=>{if(!s)return;const r=[];return s.forEach(o=>{if(!o.attributes)return;const{BANDWIDTH:u,RESOLUTION:c,CODECS:p}=o.attributes;r.push({id:o.id,bandwidth:u,resolution:c,codecs:p})}),{type:e,isLive:i,renditions:r}};class bu extends _4{constructor(e,i,r={}){if(super(),!e)throw new Error("A non-empty playlist URL or object is required");this.logger_=$n("PlaylistLoader");const{withCredentials:o=!1}=r;this.src=e,this.vhs_=i,this.withCredentials=o,this.addDateRangesToTextTrack_=r.addDateRangesToTextTrack;const u=i.options_;this.customTagParsers=u&&u.customTagParsers||[],this.customTagMappers=u&&u.customTagMappers||[],this.llhls=u&&u.llhls,this.dateRangesStorage_=new CS,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 i=this.dateRangesStorage_.getDateRangesToProcess();!i.length||!this.addDateRangesToTextTrack_||this.addDateRangesToTextTrack_(i)}handleMediaupdatetimeout_(){if(this.state!=="HAVE_METADATA")return;const e=this.media();let i=ln(this.main.uri,e.uri);this.llhls&&(i=T4(i,e)),this.state="HAVE_CURRENT_METADATA",this.request=this.vhs_.xhr({uri:i,withCredentials:this.withCredentials,requestType:"hls-playlist"},(r,o)=>{if(this.request){if(r)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,i,r){const{uri:o,id:u}=i;this.request=null,r&&(this.state=r),this.error={playlist:this.main.playlists[u],status:e.status,message:`HLS playlist request error at URL: ${o}.`,responseText:e.responseText,code:e.status>=500?4:2,metadata:No({requestType:e.requestType,request:e,error:e.error})},this.trigger("error")}parseManifest_({url:e,manifestString:i}){try{const r=p4({onwarn:({message:o})=>this.logger_(`m3u8-parser warn for ${e}: ${o}`),oninfo:({message:o})=>this.logger_(`m3u8-parser info for ${e}: ${o}`),manifestString:i,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers,llhls:this.llhls});return!r.playlists||!r.playlists.length||this.excludeAudioOnlyVariants(r.playlists),r}catch(r){this.error=r,this.error.metadata={errorType:$.Error.StreamingHlsPlaylistParserError,error:r}}}excludeAudioOnlyVariants(e){const i=r=>{const o=r.attributes||{},{width:u,height:c}=o.RESOLUTION||{};if(u&&c)return!0;const p=DS(r)||[];return!!Rd(p).video};e.some(i)&&e.forEach(r=>{i(r)||(r.excludeUntil=1/0)})}haveMetadata({playlistString:e,playlistObject:i,url:r,id:o}){this.request=null,this.state="HAVE_METADATA";const u={playlistInfo:{type:"media",uri:r}};this.trigger({type:"playlistparsestart",metadata:u});const c=i||this.parseManifest_({url:r,manifestString:e});c.lastRequest=Date.now(),xS({playlist:c,uri:r,id:o});const p=Sy(this.main,c);this.targetDuration=c.partTargetDuration||c.targetDuration,this.pendingMedia_=null,p?(this.main=p,this.media_=this.main.playlists[o]):this.trigger("playlistunchanged"),this.updateMediaUpdateTimeout_(xy(this.media(),!!p)),u.parsedPlaylist=LS(this.main.playlists,u.playlistInfo.type,!this.media_.endList),this.trigger({type:"playlistparsecomplete",metadata:u}),this.trigger("loadedplaylist")}dispose(){this.trigger("dispose"),this.stopRequest(),P.clearTimeout(this.mediaUpdateTimeout),P.clearTimeout(this.finalRenditionTimeout),this.dateRangesStorage_=new CS,this.off()}stopRequest(){if(this.request){const e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}media(e,i){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(P.clearTimeout(this.finalRenditionTimeout),i){const p=(e.partTargetDuration||e.targetDuration)/2*1e3||5e3;this.finalRenditionTimeout=P.setTimeout(this.media.bind(this,e,!1),p);return}const r=this.state,o=!this.media_||e.id!==this.media_.id,u=this.main.playlists[e.id];if(u&&u.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,o&&(this.trigger("mediachanging"),r==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange"));return}if(this.updateMediaUpdateTimeout_(xy(e,!0)),!o)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 c={playlistInfo:{type:"media",uri:e.uri}};this.trigger({type:"playlistrequeststart",metadata:c}),this.request=this.vhs_.xhr({uri:e.resolvedUri,withCredentials:this.withCredentials,requestType:"hls-playlist"},(p,g)=>{if(this.request){if(e.lastRequest=Date.now(),e.resolvedUri=Rp(e.resolvedUri,g),p)return this.playlistRequestError(this.request,e,r);this.trigger({type:"playlistrequestcomplete",metadata:c}),this.haveMetadata({playlistString:g.responseText,url:e.uri,id:e.id}),r==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange")}})}pause(){this.mediaUpdateTimeout&&(P.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&&(P.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);const i=this.media();if(e){const r=i?(i.partTargetDuration||i.targetDuration)/2*1e3:5e3;this.mediaUpdateTimeout=P.setTimeout(()=>{this.mediaUpdateTimeout=null,this.load()},r);return}if(!this.started){this.start();return}i&&!i.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist")}updateMediaUpdateTimeout_(e){this.mediaUpdateTimeout&&(P.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),!(!this.media()||this.media().endList)&&(this.mediaUpdateTimeout=P.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=P.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"},(i,r)=>{if(!this.request)return;if(this.request=null,i)return this.error={status:r.status,message:`HLS playlist request error at URL: ${this.src}.`,responseText:r.responseText,code:2,metadata:No({requestType:r.requestType,request:r,error:i})},this.state==="HAVE_NOTHING"&&(this.started=!1),this.trigger("error");this.trigger({type:"playlistrequestcomplete",metadata:e}),this.src=Rp(this.src,r),this.trigger({type:"playlistparsestart",metadata:e});const o=this.parseManifest_({manifestString:r.responseText,url:this.src});e.parsedPlaylist=LS(o.playlists,e.playlistInfo.type,!1),this.trigger({type:"playlistparsecomplete",metadata:e}),this.setupInitialPlaylist(o)})}srcUri(){return typeof this.src=="string"?this.src:this.src.uri}setupInitialPlaylist(e){if(this.state="HAVE_MAIN_MANIFEST",e.playlists){this.main=e,ES(this.main,this.srcUri()),e.playlists.forEach(r=>{r.segments=RS(r),r.segments.forEach(o=>{OS(o,r.resolvedUri)})}),this.trigger("loadedplaylist"),this.request||this.media(this.main.playlists[0]);return}const i=this.srcUri()||P.location.href;this.main=y4(e,i),this.haveMetadata({playlistObject:e,url:i,id:this.main.playlists[0].id}),this.trigger("loadedmetadata")}updateOrDeleteClone(e,i){const r=this.main,o=e.ID;let u=r.playlists.length;for(;u--;){const c=r.playlists[u];if(c.attributes["PATHWAY-ID"]===o){const p=c.resolvedUri,g=c.id;if(i){const b=this.createCloneURI_(c.resolvedUri,e),S=yu(o,b),E=this.createCloneAttributes_(o,c.attributes),A=this.createClonePlaylist_(c,S,e,E);r.playlists[u]=A,r.playlists[S]=A,r.playlists[b]=A}else r.playlists.splice(u,1);delete r.playlists[g],delete r.playlists[p]}}this.updateOrDeleteCloneMedia(e,i)}updateOrDeleteCloneMedia(e,i){const r=this.main,o=e.ID;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(u=>{if(!(!r.mediaGroups[u]||!r.mediaGroups[u][o])){for(const c in r.mediaGroups[u])if(c===o){for(const p in r.mediaGroups[u][c])r.mediaGroups[u][c][p].playlists.forEach((b,S)=>{const E=r.playlists[b.id],A=E.id,M=E.resolvedUri;delete r.playlists[A],delete r.playlists[M]});delete r.mediaGroups[u][c]}}}),i&&this.createClonedMediaGroups_(e)}addClonePathway(e,i={}){const r=this.main,o=r.playlists.length,u=this.createCloneURI_(i.resolvedUri,e),c=yu(e.ID,u),p=this.createCloneAttributes_(e.ID,i.attributes),g=this.createClonePlaylist_(i,c,e,p);r.playlists[o]=g,r.playlists[c]=g,r.playlists[u]=g,this.createClonedMediaGroups_(e)}createClonedMediaGroups_(e){const i=e.ID,r=e["BASE-ID"],o=this.main;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(u=>{if(!(!o.mediaGroups[u]||o.mediaGroups[u][i]))for(const c in o.mediaGroups[u]){if(c===r)o.mediaGroups[u][i]={};else continue;for(const p in o.mediaGroups[u][c]){const g=o.mediaGroups[u][c][p];o.mediaGroups[u][i][p]=Ft({},g);const b=o.mediaGroups[u][i][p],S=this.createCloneURI_(g.resolvedUri,e);b.resolvedUri=S,b.uri=S,b.playlists=[],g.playlists.forEach((E,A)=>{const M=o.playlists[E.id],U=SS(u,i,p),D=yu(i,U);if(M&&!o.playlists[D]){const z=this.createClonePlaylist_(M,D,e),H=z.resolvedUri;o.playlists[D]=z,o.playlists[H]=z}b.playlists[A]=this.createClonePlaylist_(E,D,e)})}}})}createClonePlaylist_(e,i,r,o){const u=this.createCloneURI_(e.resolvedUri,r),c={resolvedUri:u,uri:u,id:i};return e.segments&&(c.segments=[]),o&&(c.attributes=o),pt(e,c)}createCloneURI_(e,i){const r=new URL(e);r.hostname=i["URI-REPLACEMENT"].HOST;const o=i["URI-REPLACEMENT"].PARAMS;for(const u of Object.keys(o))r.searchParams.set(u,o[u]);return r.href}createCloneAttributes_(e,i){const r={"PATHWAY-ID":e};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(o=>{i[o]&&(r[o]=e)}),r}getKeyIdSet(e){if(e.contentProtection){const i=new Set;for(const r in e.contentProtection){const o=e.contentProtection[r].attributes.keyId;o&&i.add(o.toLowerCase())}return i}}}const Ey=function(s,e,i,r){const o=s.responseType==="arraybuffer"?s.response:s.responseText;!e&&o&&(s.responseTime=Date.now(),s.roundTripTime=s.responseTime-s.requestTime,s.bytesReceived=o.byteLength||o.length,s.bandwidth||(s.bandwidth=Math.floor(s.bytesReceived/s.roundTripTime*8*1e3))),i.headers&&(s.responseHeaders=i.headers),e&&e.code==="ETIMEDOUT"&&(s.timedout=!0),!e&&!s.aborted&&i.statusCode!==200&&i.statusCode!==206&&i.statusCode!==0&&(e=new Error("XHR Failed with a response of: "+(s&&(o||s.responseText)))),r(e,s)},E4=(s,e)=>{if(!s||!s.size)return;let i=e;return s.forEach(r=>{i=r(i)}),i},C4=(s,e,i,r)=>{!s||!s.size||s.forEach(o=>{o(e,i,r)})},IS=function(){const s=function e(i,r){i=pt({timeout:45e3},i);const o=e.beforeRequest||$.Vhs.xhr.beforeRequest,u=e._requestCallbackSet||$.Vhs.xhr._requestCallbackSet||new Set,c=e._responseCallbackSet||$.Vhs.xhr._responseCallbackSet;o&&typeof o=="function"&&($.log.warn("beforeRequest is deprecated, use onRequest instead."),u.add(o));const p=$.Vhs.xhr.original===!0?$.xhr:$.Vhs.xhr,g=E4(u,i);u.delete(o);const b=p(g||i,function(E,A){return C4(c,b,E,A),Ey(b,E,A,r)}),S=b.abort;return b.abort=function(){return b.aborted=!0,S.apply(b,arguments)},b.uri=i.uri,b.requestType=i.requestType,b.requestTime=Date.now(),b};return s.original=!0,s},A4=function(s){let e;const i=s.offset;return typeof s.offset=="bigint"||typeof s.length=="bigint"?e=P.BigInt(s.offset)+P.BigInt(s.length)-P.BigInt(1):e=s.offset+s.length-1,"bytes="+i+"-"+e},Cy=function(s){const e={};return s.byterange&&(e.Range=A4(s.byterange)),e},D4=function(s,e){return s.start(e)+"-"+s.end(e)},w4=function(s,e){const i=s.toString(16);return"00".substring(0,2-i.length)+i+(e%2?" ":"")},k4=function(s){return s>=32&&s<126?String.fromCharCode(s):"."},NS=function(s){const e={};return Object.keys(s).forEach(i=>{const r=s[i];rT(r)?e[i]={bytes:r.buffer,byteOffset:r.byteOffset,byteLength:r.byteLength}:e[i]=r}),e},Ip=function(s){const e=s.byterange||{length:1/0,offset:0};return[e.length,e.offset,s.resolvedUri].join(",")},PS=function(s){return s.resolvedUri},US=s=>{const e=Array.prototype.slice.call(s),i=16;let r="",o,u;for(let c=0;cUS(s),textRanges:s=>{let e="",i;for(i=0;i{if(!e.dateTimeObject)return null;const i=e.videoTimingInfo.transmuxerPrependedSeconds,o=e.videoTimingInfo.transmuxedPresentationStart+i,u=s-o;return new Date(e.dateTimeObject.getTime()+u*1e3)},M4=s=>s.transmuxedPresentationEnd-s.transmuxedPresentationStart-s.transmuxerPrependedSeconds,L4=(s,e)=>{let i;try{i=new Date(s)}catch{return null}if(!e||!e.segments||e.segments.length===0)return null;let r=e.segments[0];if(ip?null:(i>new Date(u)&&(r=o),{segment:r,estimatedStart:r.videoTimingInfo?r.videoTimingInfo.transmuxedPresentationStart:un.duration(e,e.mediaSequence+e.segments.indexOf(r)),type:r.videoTimingInfo?"accurate":"estimate"})},I4=(s,e)=>{if(!e||!e.segments||e.segments.length===0)return null;let i=0,r;for(let u=0;ui){if(s>i+o.duration*BS)return null;r=o}return{segment:r,estimatedStart:r.videoTimingInfo?r.videoTimingInfo.transmuxedPresentationStart:i-r.duration,type:r.videoTimingInfo?"accurate":"estimate"}},N4=(s,e)=>{let i,r;try{i=new Date(s),r=new Date(e)}catch{}const o=i.getTime();return(r.getTime()-o)/1e3},P4=s=>{if(!s.segments||s.segments.length===0)return!1;for(let e=0;e{if(!i)throw new Error("getProgramTime: callback must be provided");if(!s||e===void 0)return i({message:"getProgramTime: playlist and time must be provided"});const r=I4(e,s);if(!r)return i({message:"valid programTime was not found"});if(r.type==="estimate")return i({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:r.estimatedStart});const o={mediaSeconds:e},u=R4(e,r.segment);return u&&(o.programDateTime=u.toISOString()),i(null,o)},FS=({programTime:s,playlist:e,retryCount:i=2,seekTo:r,pauseAfterSeek:o=!0,tech:u,callback:c})=>{if(!c)throw new Error("seekToProgramTime: callback must be provided");if(typeof s>"u"||!e||!r)return c({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"});if(!e.endList&&!u.hasStarted_)return c({message:"player must be playing a live stream to start buffering"});if(!P4(e))return c({message:"programDateTime tags must be provided in the manifest "+e.resolvedUri});const p=L4(s,e);if(!p)return c({message:`${s} was not found in the stream`});const g=p.segment,b=N4(g.dateTimeObject,s);if(p.type==="estimate"){if(i===0)return c({message:`${s} is not buffered yet. Try again`});r(p.estimatedStart+b),u.one("seeked",()=>{FS({programTime:s,playlist:e,retryCount:i-1,seekTo:r,pauseAfterSeek:o,tech:u,callback:c})});return}const S=g.start+b,E=()=>c(null,u.currentTime());u.one("seeked",E),o&&u.pause(),r(S)},Ay=(s,e)=>{if(s.readyState===4)return e()},B4=(s,e,i,r)=>{let o=[],u,c=!1;const p=function(E,A,M,U){return A.abort(),c=!0,i(E,A,M,U)},g=function(E,A){if(c)return;if(E)return E.metadata=No({requestType:r,request:A,error:E}),p(E,A,"",o);const M=A.responseText.substring(o&&o.byteLength||0,A.responseText.length);if(o=Xk(o,aT(M,!0)),u=u||md(o),o.length<10||u&&o.lengthp(E,A,"",o));const U=m0(o);return U==="ts"&&o.length<188?Ay(A,()=>p(E,A,"",o)):!U&&o.length<376?Ay(A,()=>p(E,A,"",o)):p(null,A,U,o)},S=e({uri:s,beforeSend(E){E.overrideMimeType("text/plain; charset=x-user-defined"),E.addEventListener("progress",function({total:A,loaded:M}){return Ey(E,null,{statusCode:E.status},g)})}},function(E,A){return Ey(S,E,A,g)});return S},{EventTarget:F4}=$,HS=function(s,e){if(!MS(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 i=0;i{const o=r.attributes.NAME||i;return`placeholder-uri-${s}-${e}-${o}`},z4=({mainXml:s,srcUrl:e,clientOffset:i,sidxMapping:r,previousManifest:o})=>{const u=pR(s,{manifestUri:e,clientOffset:i,sidxMapping:r,previousManifest:o});return ES(u,e,H4),u},j4=(s,e)=>{vu(s,(i,r,o,u)=>{(!e.mediaGroups[r][o]||!(u in e.mediaGroups[r][o]))&&delete s.mediaGroups[r][o][u]})},q4=(s,e,i)=>{let r=!0,o=pt(s,{duration:e.duration,minimumUpdatePeriod:e.minimumUpdatePeriod,timelineStarts:e.timelineStarts});for(let u=0;u{if(u.playlists&&u.playlists.length){const b=u.playlists[0].id,S=Sy(o,u.playlists[0],HS);S&&(o=S,g in o.mediaGroups[c][p]||(o.mediaGroups[c][p][g]=u),o.mediaGroups[c][p][g].playlists[0]=o.playlists[b],r=!1)}}),j4(o,e),e.minimumUpdatePeriod!==s.minimumUpdatePeriod&&(r=!1),r?null:o},V4=(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,zS=(s,e)=>{const i={};for(const r in s){const u=s[r].sidx;if(u){const c=$f(u);if(!e[c])break;const p=e[c].sidxInfo;V4(p,u)&&(i[c]=e[c])}}return i},$4=(s,e)=>{let r=zS(s.playlists,e);return vu(s,(o,u,c,p)=>{if(o.playlists&&o.playlists.length){const g=o.playlists;r=pt(r,zS(g,e))}}),r};class Dy extends F4{constructor(e,i,r={},o){super(),this.isPaused_=!0,this.mainPlaylistLoader_=o||this,o||(this.isMain_=!0);const{withCredentials:u=!1}=r;if(this.vhs_=i,this.withCredentials=u,this.addMetadataToTextTrack=r.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_=$n("DashPlaylistLoader"),this.isMain_?(this.mainPlaylistLoader_.srcUrl=e,this.mainPlaylistLoader_.sidxMapping_={}):this.childPlaylist_=e}get isPaused(){return this.isPaused_}requestErrored_(e,i,r){if(!this.request)return!0;if(this.request=null,e)return this.error=typeof e=="object"&&!(e instanceof Error)?e:{status:i.status,message:"DASH request error at URL: "+i.uri,response:i.response,code:2,metadata:e.metadata},r&&(this.state=r),this.trigger("error"),!0}addSidxSegments_(e,i,r){const o=e.sidx&&$f(e.sidx);if(!e.sidx||!o||this.mainPlaylistLoader_.sidxMapping_[o]){P.clearTimeout(this.mediaRequest_),this.mediaRequest_=P.setTimeout(()=>r(!1),0);return}const u=Rp(e.sidx.resolvedUri),c=(g,b)=>{if(this.requestErrored_(g,b,i))return;const S=this.mainPlaylistLoader_.sidxMapping_,{requestType:E}=b;let A;try{A=_R(Ie(b.response).subarray(8))}catch(M){M.metadata=No({requestType:E,request:b,parseFailure:!0}),this.requestErrored_(M,b,i);return}return S[o]={sidxInfo:e.sidx,sidx:A},u0(e,A,e.sidx.resolvedUri),r(!0)},p="dash-sidx";this.request=B4(u,this.vhs_.xhr,(g,b,S,E)=>{if(g)return c(g,b);if(!S||S!=="mp4"){const U=S||"unknown";return c({status:b.status,message:`Unsupported ${U} container type for sidx segment at URL: ${u}`,response:"",playlist:e,internal:!0,playlistExclusionDuration:1/0,code:2},b)}const{offset:A,length:M}=e.sidx.byterange;if(E.length>=M+A)return c(g,{response:E.subarray(A,A+M),status:b.status,uri:b.uri});this.request=this.vhs_.xhr({uri:u,responseType:"arraybuffer",requestType:"dash-sidx",headers:Cy({byterange:e.sidx.byterange})},c)},p)}dispose(){this.isPaused_=!0,this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},P.clearTimeout(this.minimumUpdatePeriodTimeout_),P.clearTimeout(this.mediaRequest_),P.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 i=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 r=!this.media_||e.id!==this.media_.id;if(r&&this.loadedPlaylists_[e.id]&&this.loadedPlaylists_[e.id].endList){this.state="HAVE_METADATA",this.media_=e,r&&(this.trigger("mediachanging"),this.trigger("mediachange"));return}r&&(this.media_&&this.trigger("mediachanging"),this.addSidxSegments_(e,i,o=>{this.haveMetadata({startingState:i,playlist:e})}))}haveMetadata({startingState:e,playlist:i}){this.state="HAVE_METADATA",this.loadedPlaylists_[i.id]=i,P.clearTimeout(this.mediaRequest_),this.mediaRequest_=null,this.refreshMedia_(i.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(),P.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMain_&&(P.clearTimeout(this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_),this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_=null),this.state==="HAVE_NOTHING"&&(this.started=!1)}load(e){this.isPaused_=!1,P.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;const i=this.media();if(e){const r=i?i.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=P.setTimeout(()=>this.load(),r);return}if(!this.started){this.start();return}i&&!i.endList?(this.isMain_&&!this.minimumUpdatePeriodTimeout_&&(this.trigger("minimumUpdatePeriod"),this.updateMinimumUpdatePeriodTimeout_()),this.trigger("mediaupdatetimeout")):this.trigger("loadedplaylist")}start(){if(this.started=!0,!this.isMain_){P.clearTimeout(this.mediaRequest_),this.mediaRequest_=P.setTimeout(()=>this.haveMain_(),0);return}this.requestMain_((e,i)=>{this.haveMain_(),!this.hasPendingRequest()&&!this.media_&&this.media(this.mainPlaylistLoader_.main.playlists[0])})}requestMain_(e){const i={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestrequeststart",metadata:i}),this.request=this.vhs_.xhr({uri:this.mainPlaylistLoader_.srcUrl,withCredentials:this.withCredentials,requestType:"dash-manifest"},(r,o)=>{if(r){const{requestType:c}=o;r.metadata=No({requestType:c,request:o,error:r})}if(this.requestErrored_(r,o)){this.state==="HAVE_NOTHING"&&(this.started=!1);return}this.trigger({type:"manifestrequestcomplete",metadata:i});const u=o.responseText!==this.mainPlaylistLoader_.mainXml_;if(this.mainPlaylistLoader_.mainXml_=o.responseText,o.responseHeaders&&o.responseHeaders.date?this.mainLoaded_=Date.parse(o.responseHeaders.date):this.mainLoaded_=Date.now(),this.mainPlaylistLoader_.srcUrl=Rp(this.mainPlaylistLoader_.srcUrl,o),u){this.handleMain_(),this.syncClientServerClock_(()=>e(o,u));return}return e(o,u)})}syncClientServerClock_(e){const i=mR(this.mainPlaylistLoader_.mainXml_);if(i===null)return this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e();if(i.method==="DIRECT")return this.mainPlaylistLoader_.clientOffset_=i.value-Date.now(),e();this.request=this.vhs_.xhr({uri:ln(this.mainPlaylistLoader_.srcUrl,i.value),method:i.method,withCredentials:this.withCredentials,requestType:"dash-clock-sync"},(r,o)=>{if(!this.request)return;if(r){const{requestType:c}=o;return this.error.metadata=No({requestType:c,request:o,error:r}),this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e()}let u;i.method==="HEAD"?!o.responseHeaders||!o.responseHeaders.date?u=this.mainLoaded_:u=Date.parse(o.responseHeaders.date):u=Date.parse(o.responseText),this.mainPlaylistLoader_.clientOffset_=u-Date.now(),e()})}haveMain_(){this.state="HAVE_MAIN_MANIFEST",this.isMain_?this.trigger("loadedplaylist"):this.media_||this.media(this.childPlaylist_)}handleMain_(){P.clearTimeout(this.mediaRequest_),this.mediaRequest_=null;const e=this.mainPlaylistLoader_.main,i={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestparsestart",metadata:i});let r;try{r=z4({mainXml:this.mainPlaylistLoader_.mainXml_,srcUrl:this.mainPlaylistLoader_.srcUrl,clientOffset:this.mainPlaylistLoader_.clientOffset_,sidxMapping:this.mainPlaylistLoader_.sidxMapping_,previousManifest:e})}catch(u){this.error=u,this.error.metadata={errorType:$.Error.StreamingDashManifestParserError,error:u},this.trigger("error")}e&&(r=q4(e,r,this.mainPlaylistLoader_.sidxMapping_)),this.mainPlaylistLoader_.main=r||e;const o=this.mainPlaylistLoader_.main.locations&&this.mainPlaylistLoader_.main.locations[0];if(o&&o!==this.mainPlaylistLoader_.srcUrl&&(this.mainPlaylistLoader_.srcUrl=o),(!e||r&&r.minimumUpdatePeriod!==e.minimumUpdatePeriod)&&this.updateMinimumUpdatePeriodTimeout_(),this.addEventStreamToMetadataTrack_(r),r){const{duration:u,endList:c}=r,p=[];r.playlists.forEach(b=>{p.push({id:b.id,bandwidth:b.attributes.BANDWIDTH,resolution:b.attributes.RESOLUTION,codecs:b.attributes.CODECS})});const g={duration:u,isLive:!c,renditions:p};i.parsedManifest=g,this.trigger({type:"manifestparsecomplete",metadata:i})}return!!r}updateMinimumUpdatePeriodTimeout_(){const e=this.mainPlaylistLoader_;e.createMupOnMedia_&&(e.off("loadedmetadata",e.createMupOnMedia_),e.createMupOnMedia_=null),e.minimumUpdatePeriodTimeout_&&(P.clearTimeout(e.minimumUpdatePeriodTimeout_),e.minimumUpdatePeriodTimeout_=null);let i=e.main&&e.main.minimumUpdatePeriod;if(i===0&&(e.media()?i=e.media().targetDuration*1e3:(e.createMupOnMedia_=e.updateMinimumUpdatePeriodTimeout_,e.one("loadedmetadata",e.createMupOnMedia_))),typeof i!="number"||i<=0){i<0&&this.logger_(`found invalid minimumUpdatePeriod of ${i}, not setting a timeout`);return}this.createMUPTimeout_(i)}createMUPTimeout_(e){const i=this.mainPlaylistLoader_;i.minimumUpdatePeriodTimeout_=P.setTimeout(()=>{i.minimumUpdatePeriodTimeout_=null,i.trigger("minimumUpdatePeriod"),i.createMUPTimeout_(e)},e)}refreshXml_(){this.requestMain_((e,i)=>{i&&(this.media_&&(this.media_=this.mainPlaylistLoader_.main.playlists[this.media_.id]),this.mainPlaylistLoader_.sidxMapping_=$4(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.sidxMapping_),this.addSidxSegments_(this.media(),this.state,r=>{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 i=this.mainPlaylistLoader_.main.playlists,r=!this.media_||this.media_!==i[e];if(r?this.media_=i[e]:this.trigger("playlistunchanged"),!this.mediaUpdateTimeout){const o=()=>{this.media().endList||(this.mediaUpdateTimeout=P.setTimeout(()=>{this.trigger("mediaupdatetimeout"),o()},xy(this.media(),!!r)))};o()}this.trigger("loadedplaylist")}addEventStreamToMetadataTrack_(e){if(e&&this.mainPlaylistLoader_.main.eventStream){const i=this.mainPlaylistLoader_.main.eventStream.map(r=>({cueTime:r.start,frames:[{data:r.messageData}]}));this.addMetadataToTextTrack("EventStream",i,this.mainPlaylistLoader_.main.duration)}}getKeyIdSet(e){if(e.contentProtection){const i=new Set;for(const r in e.contentProtection){const o=e.contentProtection[r].attributes["cenc:default_KID"];o&&i.add(o.replace(/-/g,"").toLowerCase())}return i}}}var fi={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 G4=s=>{const e=new Uint8Array(new ArrayBuffer(s.length));for(let i=0;i=e})},Mp=function(s,e){return cS(s,function(i){return i-Fs>=e})},n4=function(s){if(s.length<2)return hi();const e=[];for(let i=1;i{const e=[];if(!s||!s.length)return"";for(let i=0;i "+s.end(i));return e.join(", ")},r4=function(s,e,i=1){return((s.length?s.end(s.length-1):0)-e)/i},Io=s=>{const e=[];for(let i=0;iu)){if(e>o&&e<=u){i+=u-e;continue}i+=u-o}}return i},yy=(s,e)=>{if(!e.preload)return e.duration;let i=0;return(e.parts||[]).forEach(function(r){i+=r.duration}),(e.preloadHints||[]).forEach(function(r){r.type==="PART"&&(i+=s.partTargetDuration)}),i},vy=s=>(s.segments||[]).reduce((e,i,r)=>(i.parts?i.parts.forEach(function(o,u){e.push({duration:o.duration,segmentIndex:r,partIndex:u,part:o,segment:i})}):e.push({duration:i.duration,segmentIndex:r,partIndex:null,segment:i,part:null}),e),[]),hS=s=>{const e=s.segments&&s.segments.length&&s.segments[s.segments.length-1];return e&&e.parts||[]},fS=({preloadSegment:s})=>{if(!s)return;const{parts:e,preloadHints:i}=s;let r=(i||[]).reduce((o,u)=>o+(u.type==="PART"?1:0),0);return r+=e&&e.length?e.length:0,r},pS=(s,e)=>{if(e.endList)return 0;if(s&&s.suggestedPresentationDelay)return s.suggestedPresentationDelay;const i=hS(e).length>0;return i&&e.serverControl&&e.serverControl.partHoldBack?e.serverControl.partHoldBack:i&&e.partTargetDuration?e.partTargetDuration*3:e.serverControl&&e.serverControl.holdBack?e.serverControl.holdBack:e.targetDuration?e.targetDuration*3:0},o4=function(s,e){let i=0,r=e-s.mediaSequence,o=s.segments[r];if(o){if(typeof o.start<"u")return{result:o.start,precise:!0};if(typeof o.end<"u")return{result:o.end-o.duration,precise:!0}}for(;r--;){if(o=s.segments[r],typeof o.end<"u")return{result:i+o.end,precise:!0};if(i+=yy(s,o),typeof o.start<"u")return{result:i+o.start,precise:!0}}return{result:i,precise:!1}},l4=function(s,e){let i=0,r,o=e-s.mediaSequence;for(;o"u"&&(e=s.mediaSequence+s.segments.length),e"u"){if(s.totalDuration)return s.totalDuration;if(!s.endList)return P.Infinity}return mS(s,e,i)},kd=function({defaultDuration:s,durationList:e,startIndex:i,endIndex:r}){let o=0;if(i>r&&([i,r]=[r,i]),i<0){for(let u=i;u0)for(let b=g-1;b>=0;b--){const S=p[b];if(c+=S.duration,u){if(c<0)continue}else if(c+Fs<=0)continue;return{partIndex:S.partIndex,segmentIndex:S.segmentIndex,startTime:o-kd({defaultDuration:s.targetDuration,durationList:p,startIndex:g,endIndex:b})}}return{partIndex:p[0]&&p[0].partIndex||null,segmentIndex:p[0]&&p[0].segmentIndex||0,startTime:e}}if(g<0){for(let b=g;b<0;b++)if(c-=s.targetDuration,c<0)return{partIndex:p[0]&&p[0].partIndex||null,segmentIndex:p[0]&&p[0].segmentIndex||0,startTime:e};g=0}for(let b=g;bFs,A=c===0,M=E&&c+Fs>=0;if(!((A||M)&&b!==p.length-1)){if(u){if(c>0)continue}else if(c-Fs>=0)continue;return{partIndex:S.partIndex,segmentIndex:S.segmentIndex,startTime:o+kd({defaultDuration:s.targetDuration,durationList:p,startIndex:g,endIndex:b})}}}return{segmentIndex:p[p.length-1].segmentIndex,partIndex:p[p.length-1].partIndex,startTime:e}},vS=function(s){return s.excludeUntil&&s.excludeUntil>Date.now()},by=function(s){return s.excludeUntil&&s.excludeUntil===1/0},Lp=function(s){const e=vS(s);return!s.disabled&&!e},d4=function(s){return s.disabled},h4=function(s){for(let e=0;e{if(s.playlists.length===1)return!0;const i=e.attributes.BANDWIDTH||Number.MAX_VALUE;return s.playlists.filter(r=>Lp(r)?(r.attributes.BANDWIDTH||0)!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),_S=function(s,e){const i=s&&s.mediaGroups&&s.mediaGroups.AUDIO||{};let r=!1;for(const o in i){for(const u in i[o])if(r=e(i[o][u]),r)break;if(r)break}return!!r},Od=s=>{if(!s||!s.playlists||!s.playlists.length)return _S(s,i=>i.playlists&&i.playlists.length||i.uri);for(let e=0;eiT(u))||_S(s,u=>Ty(i,u))))return!1}return!0};var un={liveEdgeDelay:pS,duration:gS,seekable:u4,getMediaInfoForTime:c4,isEnabled:Lp,isDisabled:d4,isExcluded:vS,isIncompatible:by,playlistEnd:yS,isAes:h4,hasAttribute:bS,estimateSegmentRequestTime:f4,isLowestEnabledRendition:_y,isAudioOnly:Od,playlistMatch:Ty,segmentDurationWithParts:yy};const{log:TS}=V,yu=(s,e)=>`${s}-${e}`,SS=(s,e,i)=>`placeholder-uri-${s}-${e}-${i}`,p4=({onwarn:s,oninfo:e,manifestString:i,customTagParsers:r=[],customTagMappers:o=[],llhls:u})=>{const c=new Nk;s&&c.on("warn",s),e&&c.on("info",e),r.forEach(b=>c.addParser(b)),o.forEach(b=>c.addTagMapper(b)),c.push(i),c.end();const p=c.manifest;if(u||(["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach(function(b){p.hasOwnProperty(b)&&delete p[b]}),p.segments&&p.segments.forEach(function(b){["parts","preloadHints"].forEach(function(S){b.hasOwnProperty(S)&&delete b[S]})})),!p.targetDuration){let b=10;p.segments&&p.segments.length&&(b=p.segments.reduce((S,E)=>Math.max(S,E.duration),0)),s&&s({message:`manifest has no targetDuration defaulting to ${b}`}),p.targetDuration=b}const g=hS(p);if(g.length&&!p.partTargetDuration){const b=g.reduce((S,E)=>Math.max(S,E.duration),0);s&&(s({message:`manifest has no partTargetDuration defaulting to ${b}`}),TS.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.")),p.partTargetDuration=b}return p},vu=(s,e)=>{s.mediaGroups&&["AUDIO","SUBTITLES"].forEach(i=>{if(s.mediaGroups[i])for(const r in s.mediaGroups[i])for(const o in s.mediaGroups[i][r]){const u=s.mediaGroups[i][r][o];e(u,i,r,o)}})},xS=({playlist:s,uri:e,id:i})=>{s.id=i,s.playlistErrors_=0,e&&(s.uri=e),s.attributes=s.attributes||{}},m4=s=>{let e=s.playlists.length;for(;e--;){const i=s.playlists[e];xS({playlist:i,id:yu(e,i.uri)}),i.resolvedUri=ln(s.uri,i.uri),s.playlists[i.id]=i,s.playlists[i.uri]=i,i.attributes.BANDWIDTH||TS.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}},g4=s=>{vu(s,e=>{e.uri&&(e.resolvedUri=ln(s.uri,e.uri))})},y4=(s,e)=>{const i=yu(0,e),r={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:P.location.href,resolvedUri:P.location.href,playlists:[{uri:e,id:i,resolvedUri:e,attributes:{}}]};return r.playlists[i]=r.playlists[0],r.playlists[e]=r.playlists[0],r},ES=(s,e,i=SS)=>{s.uri=e;for(let o=0;o{if(!o.playlists||!o.playlists.length){if(r&&u==="AUDIO"&&!o.uri)for(let g=0;g(o.set(u.id,u),o),new Map)}processDateRange(e){this.pendingDateRanges_.delete(e.id),this.processedDateRanges_.set(e.id,e)}getDateRangesToProcess(){if(this.offset_===null)return[];const e={},i=[];this.pendingDateRanges_.forEach((r,o)=>{if(!this.processedDateRanges_.has(o)&&(r.startTime=r.startDate.getTime()/1e3-this.offset_,r.processDateRange=()=>this.processDateRange(r),i.push(r),!!r.class))if(e[r.class]){const u=e[r.class].push(r);r.classListIndex=u-1}else e[r.class]=[r],r.classListIndex=0});for(const r of i){const o=e[r.class]||[];r.endDate?r.endTime=r.endDate.getTime()/1e3-this.offset_:r.endOnNext&&o[r.classListIndex+1]?r.endTime=o[r.classListIndex+1].startTime:r.duration?r.endTime=r.startTime+r.duration:r.plannedDuration?r.endTime=r.startTime+r.plannedDuration:r.endTime=r.startTime}return i}trimProcessedDateRanges_(e){new Map(this.processedDateRanges_).forEach((r,o)=>{r.startDate.getTime(){const o=e.status<200||e.status>299,u=e.status>=400&&e.status<=499,c={uri:e.uri,requestType:s},p=o&&!u||r;if(i&&u)c.error=Ft({},i),c.errorType=V.Error.NetworkRequestFailed;else if(e.aborted)c.errorType=V.Error.NetworkRequestAborted;else if(e.timedout)c.erroType=V.Error.NetworkRequestTimeout;else if(p){const g=r?V.Error.NetworkBodyParserFailed:V.Error.NetworkBadStatus;c.errorType=g,c.status=e.status,c.headers=e.headers}return c},v4=$n("CodecUtils"),DS=function(s){const e=s.attributes||{};if(e.CODECS)return Rs(e.CODECS)},wS=(s,e)=>{const i=e.attributes||{};return s&&s.mediaGroups&&s.mediaGroups.AUDIO&&i.AUDIO&&s.mediaGroups.AUDIO[i.AUDIO]},b4=(s,e)=>{if(!wS(s,e))return!0;const i=e.attributes||{},r=s.mediaGroups.AUDIO[i.AUDIO];for(const o in r)if(!r[o].uri&&!r[o].playlists)return!0;return!1},Rd=function(s){const e={};return s.forEach(({mediaType:i,type:r,details:o})=>{e[i]=e[i]||[],e[i].push(tT(`${r}${o}`))}),Object.keys(e).forEach(function(i){if(e[i].length>1){v4(`multiple ${i} codecs found as attributes: ${e[i].join(", ")}. Setting playlist codecs to null so that we wait for mux.js to probe segments for real codecs.`),e[i]=null;return}e[i]=e[i][0]}),e},kS=function(s){let e=0;return s.audio&&e++,s.video&&e++,e},Md=function(s,e){const i=e.attributes||{},r=Rd(DS(e)||[]);if(wS(s,e)&&!r.audio&&!b4(s,e)){const o=Rd(Uk(s,i.AUDIO)||[]);o.audio&&(r.audio=o.audio)}return r},{EventTarget:_4}=V,T4=(s,e)=>{if(e.endList||!e.serverControl)return s;const i={};if(e.serverControl.canBlockReload){const{preloadSegment:r}=e;let o=e.mediaSequence+e.segments.length;if(r){const u=r.parts||[],c=fS(e)-1;c>-1&&c!==u.length-1&&(i._HLS_part=c),(c>-1||u.length)&&o--}i._HLS_msn=o}if(e.serverControl&&e.serverControl.canSkipUntil&&(i._HLS_skip=e.serverControl.canSkipDateranges?"v2":"YES"),Object.keys(i).length){const r=new P.URL(s);["_HLS_skip","_HLS_msn","_HLS_part"].forEach(function(o){i.hasOwnProperty(o)&&r.searchParams.set(o,i[o])}),s=r.toString()}return s},S4=(s,e)=>{if(!s)return e;const i=pt(s,e);if(s.preloadHints&&!e.preloadHints&&delete i.preloadHints,s.parts&&!e.parts)delete i.parts;else if(s.parts&&e.parts)for(let r=0;r{const r=s.slice(),o=e.slice();i=i||0;const u=[];let c;for(let p=0;p{!s.resolvedUri&&s.uri&&(s.resolvedUri=ln(e,s.uri)),s.key&&!s.key.resolvedUri&&(s.key.resolvedUri=ln(e,s.key.uri)),s.map&&!s.map.resolvedUri&&(s.map.resolvedUri=ln(e,s.map.uri)),s.map&&s.map.key&&!s.map.key.resolvedUri&&(s.map.key.resolvedUri=ln(e,s.map.key.uri)),s.parts&&s.parts.length&&s.parts.forEach(i=>{i.resolvedUri||(i.resolvedUri=ln(e,i.uri))}),s.preloadHints&&s.preloadHints.length&&s.preloadHints.forEach(i=>{i.resolvedUri||(i.resolvedUri=ln(e,i.uri))})},RS=function(s){const e=s.segments||[],i=s.preloadSegment;if(i&&i.parts&&i.parts.length){if(i.preloadHints){for(let r=0;rs===e||s.segments&&e.segments&&s.segments.length===e.segments.length&&s.endList===e.endList&&s.mediaSequence===e.mediaSequence&&s.preloadSegment===e.preloadSegment,Sy=(s,e,i=MS)=>{const r=pt(s,{}),o=r.playlists[e.id];if(!o||i(o,e))return null;e.segments=RS(e);const u=pt(o,e);if(u.preloadSegment&&!e.preloadSegment&&delete u.preloadSegment,o.segments){if(e.skip){e.segments=e.segments||[];for(let c=0;c{OS(c,u.resolvedUri)});for(let c=0;c{if(c.playlists)for(let S=0;S{const i=s.segments||[],r=i[i.length-1],o=r&&r.parts&&r.parts[r.parts.length-1],u=o&&o.duration||r&&r.duration;return e&&u?u*1e3:(s.partTargetDuration||s.targetDuration||10)*500},LS=(s,e,i)=>{if(!s)return;const r=[];return s.forEach(o=>{if(!o.attributes)return;const{BANDWIDTH:u,RESOLUTION:c,CODECS:p}=o.attributes;r.push({id:o.id,bandwidth:u,resolution:c,codecs:p})}),{type:e,isLive:i,renditions:r}};class bu extends _4{constructor(e,i,r={}){if(super(),!e)throw new Error("A non-empty playlist URL or object is required");this.logger_=$n("PlaylistLoader");const{withCredentials:o=!1}=r;this.src=e,this.vhs_=i,this.withCredentials=o,this.addDateRangesToTextTrack_=r.addDateRangesToTextTrack;const u=i.options_;this.customTagParsers=u&&u.customTagParsers||[],this.customTagMappers=u&&u.customTagMappers||[],this.llhls=u&&u.llhls,this.dateRangesStorage_=new CS,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 i=this.dateRangesStorage_.getDateRangesToProcess();!i.length||!this.addDateRangesToTextTrack_||this.addDateRangesToTextTrack_(i)}handleMediaupdatetimeout_(){if(this.state!=="HAVE_METADATA")return;const e=this.media();let i=ln(this.main.uri,e.uri);this.llhls&&(i=T4(i,e)),this.state="HAVE_CURRENT_METADATA",this.request=this.vhs_.xhr({uri:i,withCredentials:this.withCredentials,requestType:"hls-playlist"},(r,o)=>{if(this.request){if(r)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,i,r){const{uri:o,id:u}=i;this.request=null,r&&(this.state=r),this.error={playlist:this.main.playlists[u],status:e.status,message:`HLS playlist request error at URL: ${o}.`,responseText:e.responseText,code:e.status>=500?4:2,metadata:No({requestType:e.requestType,request:e,error:e.error})},this.trigger("error")}parseManifest_({url:e,manifestString:i}){try{const r=p4({onwarn:({message:o})=>this.logger_(`m3u8-parser warn for ${e}: ${o}`),oninfo:({message:o})=>this.logger_(`m3u8-parser info for ${e}: ${o}`),manifestString:i,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers,llhls:this.llhls});return!r.playlists||!r.playlists.length||this.excludeAudioOnlyVariants(r.playlists),r}catch(r){this.error=r,this.error.metadata={errorType:V.Error.StreamingHlsPlaylistParserError,error:r}}}excludeAudioOnlyVariants(e){const i=r=>{const o=r.attributes||{},{width:u,height:c}=o.RESOLUTION||{};if(u&&c)return!0;const p=DS(r)||[];return!!Rd(p).video};e.some(i)&&e.forEach(r=>{i(r)||(r.excludeUntil=1/0)})}haveMetadata({playlistString:e,playlistObject:i,url:r,id:o}){this.request=null,this.state="HAVE_METADATA";const u={playlistInfo:{type:"media",uri:r}};this.trigger({type:"playlistparsestart",metadata:u});const c=i||this.parseManifest_({url:r,manifestString:e});c.lastRequest=Date.now(),xS({playlist:c,uri:r,id:o});const p=Sy(this.main,c);this.targetDuration=c.partTargetDuration||c.targetDuration,this.pendingMedia_=null,p?(this.main=p,this.media_=this.main.playlists[o]):this.trigger("playlistunchanged"),this.updateMediaUpdateTimeout_(xy(this.media(),!!p)),u.parsedPlaylist=LS(this.main.playlists,u.playlistInfo.type,!this.media_.endList),this.trigger({type:"playlistparsecomplete",metadata:u}),this.trigger("loadedplaylist")}dispose(){this.trigger("dispose"),this.stopRequest(),P.clearTimeout(this.mediaUpdateTimeout),P.clearTimeout(this.finalRenditionTimeout),this.dateRangesStorage_=new CS,this.off()}stopRequest(){if(this.request){const e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}media(e,i){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(P.clearTimeout(this.finalRenditionTimeout),i){const p=(e.partTargetDuration||e.targetDuration)/2*1e3||5e3;this.finalRenditionTimeout=P.setTimeout(this.media.bind(this,e,!1),p);return}const r=this.state,o=!this.media_||e.id!==this.media_.id,u=this.main.playlists[e.id];if(u&&u.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,o&&(this.trigger("mediachanging"),r==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange"));return}if(this.updateMediaUpdateTimeout_(xy(e,!0)),!o)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 c={playlistInfo:{type:"media",uri:e.uri}};this.trigger({type:"playlistrequeststart",metadata:c}),this.request=this.vhs_.xhr({uri:e.resolvedUri,withCredentials:this.withCredentials,requestType:"hls-playlist"},(p,g)=>{if(this.request){if(e.lastRequest=Date.now(),e.resolvedUri=Rp(e.resolvedUri,g),p)return this.playlistRequestError(this.request,e,r);this.trigger({type:"playlistrequestcomplete",metadata:c}),this.haveMetadata({playlistString:g.responseText,url:e.uri,id:e.id}),r==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange")}})}pause(){this.mediaUpdateTimeout&&(P.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&&(P.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);const i=this.media();if(e){const r=i?(i.partTargetDuration||i.targetDuration)/2*1e3:5e3;this.mediaUpdateTimeout=P.setTimeout(()=>{this.mediaUpdateTimeout=null,this.load()},r);return}if(!this.started){this.start();return}i&&!i.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist")}updateMediaUpdateTimeout_(e){this.mediaUpdateTimeout&&(P.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),!(!this.media()||this.media().endList)&&(this.mediaUpdateTimeout=P.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=P.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"},(i,r)=>{if(!this.request)return;if(this.request=null,i)return this.error={status:r.status,message:`HLS playlist request error at URL: ${this.src}.`,responseText:r.responseText,code:2,metadata:No({requestType:r.requestType,request:r,error:i})},this.state==="HAVE_NOTHING"&&(this.started=!1),this.trigger("error");this.trigger({type:"playlistrequestcomplete",metadata:e}),this.src=Rp(this.src,r),this.trigger({type:"playlistparsestart",metadata:e});const o=this.parseManifest_({manifestString:r.responseText,url:this.src});e.parsedPlaylist=LS(o.playlists,e.playlistInfo.type,!1),this.trigger({type:"playlistparsecomplete",metadata:e}),this.setupInitialPlaylist(o)})}srcUri(){return typeof this.src=="string"?this.src:this.src.uri}setupInitialPlaylist(e){if(this.state="HAVE_MAIN_MANIFEST",e.playlists){this.main=e,ES(this.main,this.srcUri()),e.playlists.forEach(r=>{r.segments=RS(r),r.segments.forEach(o=>{OS(o,r.resolvedUri)})}),this.trigger("loadedplaylist"),this.request||this.media(this.main.playlists[0]);return}const i=this.srcUri()||P.location.href;this.main=y4(e,i),this.haveMetadata({playlistObject:e,url:i,id:this.main.playlists[0].id}),this.trigger("loadedmetadata")}updateOrDeleteClone(e,i){const r=this.main,o=e.ID;let u=r.playlists.length;for(;u--;){const c=r.playlists[u];if(c.attributes["PATHWAY-ID"]===o){const p=c.resolvedUri,g=c.id;if(i){const b=this.createCloneURI_(c.resolvedUri,e),S=yu(o,b),E=this.createCloneAttributes_(o,c.attributes),A=this.createClonePlaylist_(c,S,e,E);r.playlists[u]=A,r.playlists[S]=A,r.playlists[b]=A}else r.playlists.splice(u,1);delete r.playlists[g],delete r.playlists[p]}}this.updateOrDeleteCloneMedia(e,i)}updateOrDeleteCloneMedia(e,i){const r=this.main,o=e.ID;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(u=>{if(!(!r.mediaGroups[u]||!r.mediaGroups[u][o])){for(const c in r.mediaGroups[u])if(c===o){for(const p in r.mediaGroups[u][c])r.mediaGroups[u][c][p].playlists.forEach((b,S)=>{const E=r.playlists[b.id],A=E.id,M=E.resolvedUri;delete r.playlists[A],delete r.playlists[M]});delete r.mediaGroups[u][c]}}}),i&&this.createClonedMediaGroups_(e)}addClonePathway(e,i={}){const r=this.main,o=r.playlists.length,u=this.createCloneURI_(i.resolvedUri,e),c=yu(e.ID,u),p=this.createCloneAttributes_(e.ID,i.attributes),g=this.createClonePlaylist_(i,c,e,p);r.playlists[o]=g,r.playlists[c]=g,r.playlists[u]=g,this.createClonedMediaGroups_(e)}createClonedMediaGroups_(e){const i=e.ID,r=e["BASE-ID"],o=this.main;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(u=>{if(!(!o.mediaGroups[u]||o.mediaGroups[u][i]))for(const c in o.mediaGroups[u]){if(c===r)o.mediaGroups[u][i]={};else continue;for(const p in o.mediaGroups[u][c]){const g=o.mediaGroups[u][c][p];o.mediaGroups[u][i][p]=Ft({},g);const b=o.mediaGroups[u][i][p],S=this.createCloneURI_(g.resolvedUri,e);b.resolvedUri=S,b.uri=S,b.playlists=[],g.playlists.forEach((E,A)=>{const M=o.playlists[E.id],U=SS(u,i,p),D=yu(i,U);if(M&&!o.playlists[D]){const z=this.createClonePlaylist_(M,D,e),H=z.resolvedUri;o.playlists[D]=z,o.playlists[H]=z}b.playlists[A]=this.createClonePlaylist_(E,D,e)})}}})}createClonePlaylist_(e,i,r,o){const u=this.createCloneURI_(e.resolvedUri,r),c={resolvedUri:u,uri:u,id:i};return e.segments&&(c.segments=[]),o&&(c.attributes=o),pt(e,c)}createCloneURI_(e,i){const r=new URL(e);r.hostname=i["URI-REPLACEMENT"].HOST;const o=i["URI-REPLACEMENT"].PARAMS;for(const u of Object.keys(o))r.searchParams.set(u,o[u]);return r.href}createCloneAttributes_(e,i){const r={"PATHWAY-ID":e};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(o=>{i[o]&&(r[o]=e)}),r}getKeyIdSet(e){if(e.contentProtection){const i=new Set;for(const r in e.contentProtection){const o=e.contentProtection[r].attributes.keyId;o&&i.add(o.toLowerCase())}return i}}}const Ey=function(s,e,i,r){const o=s.responseType==="arraybuffer"?s.response:s.responseText;!e&&o&&(s.responseTime=Date.now(),s.roundTripTime=s.responseTime-s.requestTime,s.bytesReceived=o.byteLength||o.length,s.bandwidth||(s.bandwidth=Math.floor(s.bytesReceived/s.roundTripTime*8*1e3))),i.headers&&(s.responseHeaders=i.headers),e&&e.code==="ETIMEDOUT"&&(s.timedout=!0),!e&&!s.aborted&&i.statusCode!==200&&i.statusCode!==206&&i.statusCode!==0&&(e=new Error("XHR Failed with a response of: "+(s&&(o||s.responseText)))),r(e,s)},E4=(s,e)=>{if(!s||!s.size)return;let i=e;return s.forEach(r=>{i=r(i)}),i},C4=(s,e,i,r)=>{!s||!s.size||s.forEach(o=>{o(e,i,r)})},IS=function(){const s=function e(i,r){i=pt({timeout:45e3},i);const o=e.beforeRequest||V.Vhs.xhr.beforeRequest,u=e._requestCallbackSet||V.Vhs.xhr._requestCallbackSet||new Set,c=e._responseCallbackSet||V.Vhs.xhr._responseCallbackSet;o&&typeof o=="function"&&(V.log.warn("beforeRequest is deprecated, use onRequest instead."),u.add(o));const p=V.Vhs.xhr.original===!0?V.xhr:V.Vhs.xhr,g=E4(u,i);u.delete(o);const b=p(g||i,function(E,A){return C4(c,b,E,A),Ey(b,E,A,r)}),S=b.abort;return b.abort=function(){return b.aborted=!0,S.apply(b,arguments)},b.uri=i.uri,b.requestType=i.requestType,b.requestTime=Date.now(),b};return s.original=!0,s},A4=function(s){let e;const i=s.offset;return typeof s.offset=="bigint"||typeof s.length=="bigint"?e=P.BigInt(s.offset)+P.BigInt(s.length)-P.BigInt(1):e=s.offset+s.length-1,"bytes="+i+"-"+e},Cy=function(s){const e={};return s.byterange&&(e.Range=A4(s.byterange)),e},D4=function(s,e){return s.start(e)+"-"+s.end(e)},w4=function(s,e){const i=s.toString(16);return"00".substring(0,2-i.length)+i+(e%2?" ":"")},k4=function(s){return s>=32&&s<126?String.fromCharCode(s):"."},NS=function(s){const e={};return Object.keys(s).forEach(i=>{const r=s[i];rT(r)?e[i]={bytes:r.buffer,byteOffset:r.byteOffset,byteLength:r.byteLength}:e[i]=r}),e},Ip=function(s){const e=s.byterange||{length:1/0,offset:0};return[e.length,e.offset,s.resolvedUri].join(",")},PS=function(s){return s.resolvedUri},US=s=>{const e=Array.prototype.slice.call(s),i=16;let r="",o,u;for(let c=0;cUS(s),textRanges:s=>{let e="",i;for(i=0;i{if(!e.dateTimeObject)return null;const i=e.videoTimingInfo.transmuxerPrependedSeconds,o=e.videoTimingInfo.transmuxedPresentationStart+i,u=s-o;return new Date(e.dateTimeObject.getTime()+u*1e3)},M4=s=>s.transmuxedPresentationEnd-s.transmuxedPresentationStart-s.transmuxerPrependedSeconds,L4=(s,e)=>{let i;try{i=new Date(s)}catch{return null}if(!e||!e.segments||e.segments.length===0)return null;let r=e.segments[0];if(ip?null:(i>new Date(u)&&(r=o),{segment:r,estimatedStart:r.videoTimingInfo?r.videoTimingInfo.transmuxedPresentationStart:un.duration(e,e.mediaSequence+e.segments.indexOf(r)),type:r.videoTimingInfo?"accurate":"estimate"})},I4=(s,e)=>{if(!e||!e.segments||e.segments.length===0)return null;let i=0,r;for(let u=0;ui){if(s>i+o.duration*BS)return null;r=o}return{segment:r,estimatedStart:r.videoTimingInfo?r.videoTimingInfo.transmuxedPresentationStart:i-r.duration,type:r.videoTimingInfo?"accurate":"estimate"}},N4=(s,e)=>{let i,r;try{i=new Date(s),r=new Date(e)}catch{}const o=i.getTime();return(r.getTime()-o)/1e3},P4=s=>{if(!s.segments||s.segments.length===0)return!1;for(let e=0;e{if(!i)throw new Error("getProgramTime: callback must be provided");if(!s||e===void 0)return i({message:"getProgramTime: playlist and time must be provided"});const r=I4(e,s);if(!r)return i({message:"valid programTime was not found"});if(r.type==="estimate")return i({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:r.estimatedStart});const o={mediaSeconds:e},u=R4(e,r.segment);return u&&(o.programDateTime=u.toISOString()),i(null,o)},FS=({programTime:s,playlist:e,retryCount:i=2,seekTo:r,pauseAfterSeek:o=!0,tech:u,callback:c})=>{if(!c)throw new Error("seekToProgramTime: callback must be provided");if(typeof s>"u"||!e||!r)return c({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"});if(!e.endList&&!u.hasStarted_)return c({message:"player must be playing a live stream to start buffering"});if(!P4(e))return c({message:"programDateTime tags must be provided in the manifest "+e.resolvedUri});const p=L4(s,e);if(!p)return c({message:`${s} was not found in the stream`});const g=p.segment,b=N4(g.dateTimeObject,s);if(p.type==="estimate"){if(i===0)return c({message:`${s} is not buffered yet. Try again`});r(p.estimatedStart+b),u.one("seeked",()=>{FS({programTime:s,playlist:e,retryCount:i-1,seekTo:r,pauseAfterSeek:o,tech:u,callback:c})});return}const S=g.start+b,E=()=>c(null,u.currentTime());u.one("seeked",E),o&&u.pause(),r(S)},Ay=(s,e)=>{if(s.readyState===4)return e()},B4=(s,e,i,r)=>{let o=[],u,c=!1;const p=function(E,A,M,U){return A.abort(),c=!0,i(E,A,M,U)},g=function(E,A){if(c)return;if(E)return E.metadata=No({requestType:r,request:A,error:E}),p(E,A,"",o);const M=A.responseText.substring(o&&o.byteLength||0,A.responseText.length);if(o=Xk(o,aT(M,!0)),u=u||md(o),o.length<10||u&&o.lengthp(E,A,"",o));const U=m0(o);return U==="ts"&&o.length<188?Ay(A,()=>p(E,A,"",o)):!U&&o.length<376?Ay(A,()=>p(E,A,"",o)):p(null,A,U,o)},S=e({uri:s,beforeSend(E){E.overrideMimeType("text/plain; charset=x-user-defined"),E.addEventListener("progress",function({total:A,loaded:M}){return Ey(E,null,{statusCode:E.status},g)})}},function(E,A){return Ey(S,E,A,g)});return S},{EventTarget:F4}=V,HS=function(s,e){if(!MS(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 i=0;i{const o=r.attributes.NAME||i;return`placeholder-uri-${s}-${e}-${o}`},z4=({mainXml:s,srcUrl:e,clientOffset:i,sidxMapping:r,previousManifest:o})=>{const u=pR(s,{manifestUri:e,clientOffset:i,sidxMapping:r,previousManifest:o});return ES(u,e,H4),u},j4=(s,e)=>{vu(s,(i,r,o,u)=>{(!e.mediaGroups[r][o]||!(u in e.mediaGroups[r][o]))&&delete s.mediaGroups[r][o][u]})},q4=(s,e,i)=>{let r=!0,o=pt(s,{duration:e.duration,minimumUpdatePeriod:e.minimumUpdatePeriod,timelineStarts:e.timelineStarts});for(let u=0;u{if(u.playlists&&u.playlists.length){const b=u.playlists[0].id,S=Sy(o,u.playlists[0],HS);S&&(o=S,g in o.mediaGroups[c][p]||(o.mediaGroups[c][p][g]=u),o.mediaGroups[c][p][g].playlists[0]=o.playlists[b],r=!1)}}),j4(o,e),e.minimumUpdatePeriod!==s.minimumUpdatePeriod&&(r=!1),r?null:o},V4=(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,zS=(s,e)=>{const i={};for(const r in s){const u=s[r].sidx;if(u){const c=$f(u);if(!e[c])break;const p=e[c].sidxInfo;V4(p,u)&&(i[c]=e[c])}}return i},$4=(s,e)=>{let r=zS(s.playlists,e);return vu(s,(o,u,c,p)=>{if(o.playlists&&o.playlists.length){const g=o.playlists;r=pt(r,zS(g,e))}}),r};class Dy extends F4{constructor(e,i,r={},o){super(),this.isPaused_=!0,this.mainPlaylistLoader_=o||this,o||(this.isMain_=!0);const{withCredentials:u=!1}=r;if(this.vhs_=i,this.withCredentials=u,this.addMetadataToTextTrack=r.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_=$n("DashPlaylistLoader"),this.isMain_?(this.mainPlaylistLoader_.srcUrl=e,this.mainPlaylistLoader_.sidxMapping_={}):this.childPlaylist_=e}get isPaused(){return this.isPaused_}requestErrored_(e,i,r){if(!this.request)return!0;if(this.request=null,e)return this.error=typeof e=="object"&&!(e instanceof Error)?e:{status:i.status,message:"DASH request error at URL: "+i.uri,response:i.response,code:2,metadata:e.metadata},r&&(this.state=r),this.trigger("error"),!0}addSidxSegments_(e,i,r){const o=e.sidx&&$f(e.sidx);if(!e.sidx||!o||this.mainPlaylistLoader_.sidxMapping_[o]){P.clearTimeout(this.mediaRequest_),this.mediaRequest_=P.setTimeout(()=>r(!1),0);return}const u=Rp(e.sidx.resolvedUri),c=(g,b)=>{if(this.requestErrored_(g,b,i))return;const S=this.mainPlaylistLoader_.sidxMapping_,{requestType:E}=b;let A;try{A=_R(Ie(b.response).subarray(8))}catch(M){M.metadata=No({requestType:E,request:b,parseFailure:!0}),this.requestErrored_(M,b,i);return}return S[o]={sidxInfo:e.sidx,sidx:A},u0(e,A,e.sidx.resolvedUri),r(!0)},p="dash-sidx";this.request=B4(u,this.vhs_.xhr,(g,b,S,E)=>{if(g)return c(g,b);if(!S||S!=="mp4"){const U=S||"unknown";return c({status:b.status,message:`Unsupported ${U} container type for sidx segment at URL: ${u}`,response:"",playlist:e,internal:!0,playlistExclusionDuration:1/0,code:2},b)}const{offset:A,length:M}=e.sidx.byterange;if(E.length>=M+A)return c(g,{response:E.subarray(A,A+M),status:b.status,uri:b.uri});this.request=this.vhs_.xhr({uri:u,responseType:"arraybuffer",requestType:"dash-sidx",headers:Cy({byterange:e.sidx.byterange})},c)},p)}dispose(){this.isPaused_=!0,this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},P.clearTimeout(this.minimumUpdatePeriodTimeout_),P.clearTimeout(this.mediaRequest_),P.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 i=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 r=!this.media_||e.id!==this.media_.id;if(r&&this.loadedPlaylists_[e.id]&&this.loadedPlaylists_[e.id].endList){this.state="HAVE_METADATA",this.media_=e,r&&(this.trigger("mediachanging"),this.trigger("mediachange"));return}r&&(this.media_&&this.trigger("mediachanging"),this.addSidxSegments_(e,i,o=>{this.haveMetadata({startingState:i,playlist:e})}))}haveMetadata({startingState:e,playlist:i}){this.state="HAVE_METADATA",this.loadedPlaylists_[i.id]=i,P.clearTimeout(this.mediaRequest_),this.mediaRequest_=null,this.refreshMedia_(i.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(),P.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMain_&&(P.clearTimeout(this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_),this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_=null),this.state==="HAVE_NOTHING"&&(this.started=!1)}load(e){this.isPaused_=!1,P.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;const i=this.media();if(e){const r=i?i.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=P.setTimeout(()=>this.load(),r);return}if(!this.started){this.start();return}i&&!i.endList?(this.isMain_&&!this.minimumUpdatePeriodTimeout_&&(this.trigger("minimumUpdatePeriod"),this.updateMinimumUpdatePeriodTimeout_()),this.trigger("mediaupdatetimeout")):this.trigger("loadedplaylist")}start(){if(this.started=!0,!this.isMain_){P.clearTimeout(this.mediaRequest_),this.mediaRequest_=P.setTimeout(()=>this.haveMain_(),0);return}this.requestMain_((e,i)=>{this.haveMain_(),!this.hasPendingRequest()&&!this.media_&&this.media(this.mainPlaylistLoader_.main.playlists[0])})}requestMain_(e){const i={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestrequeststart",metadata:i}),this.request=this.vhs_.xhr({uri:this.mainPlaylistLoader_.srcUrl,withCredentials:this.withCredentials,requestType:"dash-manifest"},(r,o)=>{if(r){const{requestType:c}=o;r.metadata=No({requestType:c,request:o,error:r})}if(this.requestErrored_(r,o)){this.state==="HAVE_NOTHING"&&(this.started=!1);return}this.trigger({type:"manifestrequestcomplete",metadata:i});const u=o.responseText!==this.mainPlaylistLoader_.mainXml_;if(this.mainPlaylistLoader_.mainXml_=o.responseText,o.responseHeaders&&o.responseHeaders.date?this.mainLoaded_=Date.parse(o.responseHeaders.date):this.mainLoaded_=Date.now(),this.mainPlaylistLoader_.srcUrl=Rp(this.mainPlaylistLoader_.srcUrl,o),u){this.handleMain_(),this.syncClientServerClock_(()=>e(o,u));return}return e(o,u)})}syncClientServerClock_(e){const i=mR(this.mainPlaylistLoader_.mainXml_);if(i===null)return this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e();if(i.method==="DIRECT")return this.mainPlaylistLoader_.clientOffset_=i.value-Date.now(),e();this.request=this.vhs_.xhr({uri:ln(this.mainPlaylistLoader_.srcUrl,i.value),method:i.method,withCredentials:this.withCredentials,requestType:"dash-clock-sync"},(r,o)=>{if(!this.request)return;if(r){const{requestType:c}=o;return this.error.metadata=No({requestType:c,request:o,error:r}),this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e()}let u;i.method==="HEAD"?!o.responseHeaders||!o.responseHeaders.date?u=this.mainLoaded_:u=Date.parse(o.responseHeaders.date):u=Date.parse(o.responseText),this.mainPlaylistLoader_.clientOffset_=u-Date.now(),e()})}haveMain_(){this.state="HAVE_MAIN_MANIFEST",this.isMain_?this.trigger("loadedplaylist"):this.media_||this.media(this.childPlaylist_)}handleMain_(){P.clearTimeout(this.mediaRequest_),this.mediaRequest_=null;const e=this.mainPlaylistLoader_.main,i={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestparsestart",metadata:i});let r;try{r=z4({mainXml:this.mainPlaylistLoader_.mainXml_,srcUrl:this.mainPlaylistLoader_.srcUrl,clientOffset:this.mainPlaylistLoader_.clientOffset_,sidxMapping:this.mainPlaylistLoader_.sidxMapping_,previousManifest:e})}catch(u){this.error=u,this.error.metadata={errorType:V.Error.StreamingDashManifestParserError,error:u},this.trigger("error")}e&&(r=q4(e,r,this.mainPlaylistLoader_.sidxMapping_)),this.mainPlaylistLoader_.main=r||e;const o=this.mainPlaylistLoader_.main.locations&&this.mainPlaylistLoader_.main.locations[0];if(o&&o!==this.mainPlaylistLoader_.srcUrl&&(this.mainPlaylistLoader_.srcUrl=o),(!e||r&&r.minimumUpdatePeriod!==e.minimumUpdatePeriod)&&this.updateMinimumUpdatePeriodTimeout_(),this.addEventStreamToMetadataTrack_(r),r){const{duration:u,endList:c}=r,p=[];r.playlists.forEach(b=>{p.push({id:b.id,bandwidth:b.attributes.BANDWIDTH,resolution:b.attributes.RESOLUTION,codecs:b.attributes.CODECS})});const g={duration:u,isLive:!c,renditions:p};i.parsedManifest=g,this.trigger({type:"manifestparsecomplete",metadata:i})}return!!r}updateMinimumUpdatePeriodTimeout_(){const e=this.mainPlaylistLoader_;e.createMupOnMedia_&&(e.off("loadedmetadata",e.createMupOnMedia_),e.createMupOnMedia_=null),e.minimumUpdatePeriodTimeout_&&(P.clearTimeout(e.minimumUpdatePeriodTimeout_),e.minimumUpdatePeriodTimeout_=null);let i=e.main&&e.main.minimumUpdatePeriod;if(i===0&&(e.media()?i=e.media().targetDuration*1e3:(e.createMupOnMedia_=e.updateMinimumUpdatePeriodTimeout_,e.one("loadedmetadata",e.createMupOnMedia_))),typeof i!="number"||i<=0){i<0&&this.logger_(`found invalid minimumUpdatePeriod of ${i}, not setting a timeout`);return}this.createMUPTimeout_(i)}createMUPTimeout_(e){const i=this.mainPlaylistLoader_;i.minimumUpdatePeriodTimeout_=P.setTimeout(()=>{i.minimumUpdatePeriodTimeout_=null,i.trigger("minimumUpdatePeriod"),i.createMUPTimeout_(e)},e)}refreshXml_(){this.requestMain_((e,i)=>{i&&(this.media_&&(this.media_=this.mainPlaylistLoader_.main.playlists[this.media_.id]),this.mainPlaylistLoader_.sidxMapping_=$4(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.sidxMapping_),this.addSidxSegments_(this.media(),this.state,r=>{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 i=this.mainPlaylistLoader_.main.playlists,r=!this.media_||this.media_!==i[e];if(r?this.media_=i[e]:this.trigger("playlistunchanged"),!this.mediaUpdateTimeout){const o=()=>{this.media().endList||(this.mediaUpdateTimeout=P.setTimeout(()=>{this.trigger("mediaupdatetimeout"),o()},xy(this.media(),!!r)))};o()}this.trigger("loadedplaylist")}addEventStreamToMetadataTrack_(e){if(e&&this.mainPlaylistLoader_.main.eventStream){const i=this.mainPlaylistLoader_.main.eventStream.map(r=>({cueTime:r.start,frames:[{data:r.messageData}]}));this.addMetadataToTextTrack("EventStream",i,this.mainPlaylistLoader_.main.duration)}}getKeyIdSet(e){if(e.contentProtection){const i=new Set;for(const r in e.contentProtection){const o=e.contentProtection[r].attributes["cenc:default_KID"];o&&i.add(o.replace(/-/g,"").toLowerCase())}return i}}}var fi={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 G4=s=>{const e=new Uint8Array(new ArrayBuffer(s.length));for(let i=0;i-1):!1},this.trigger=function(m){var y,v,_,x;if(y=h[m],!!y)if(arguments.length===2)for(_=y.length,v=0;v<_;++v)y[v].call(this,arguments[1]);else{for(x=[],v=arguments.length,v=1;v"u")){for(h in ve)ve.hasOwnProperty(h)&&(ve[h]=[h.charCodeAt(0),h.charCodeAt(1),h.charCodeAt(2),h.charCodeAt(3)]);Ne=new Uint8Array(["i".charCodeAt(0),"s".charCodeAt(0),"o".charCodeAt(0),"m".charCodeAt(0)]),de=new Uint8Array(["a".charCodeAt(0),"v".charCodeAt(0),"c".charCodeAt(0),"1".charCodeAt(0)]),at=new Uint8Array([0,0,0,1]),Ee=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]),Re=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]),Ye={video:Ee,audio:Re},Ae=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),Me=new Uint8Array([0,0,0,0,0,0,0,0]),rt=new Uint8Array([0,0,0,0,0,0,0,0]),xt=rt,Ut=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),nt=rt,le=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}})(),p=function(h){var m=[],y=0,v,_,x;for(v=1;v>>1,h.samplingfrequencyindex<<7|h.channelcount<<3,6,1,2]))},S=function(){return p(ve.ftyp,Ne,at,Ne,de)},W=function(h){return p(ve.hdlr,Ye[h])},E=function(h){return p(ve.mdat,h)},Z=function(h){var m=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,h.duration>>>24&255,h.duration>>>16&255,h.duration>>>8&255,h.duration&255,85,196,0,0]);return h.samplerate&&(m[12]=h.samplerate>>>24&255,m[13]=h.samplerate>>>16&255,m[14]=h.samplerate>>>8&255,m[15]=h.samplerate&255),p(ve.mdhd,m)},Q=function(h){return p(ve.mdia,Z(h),W(h.type),M(h))},A=function(h){return p(ve.mfhd,new Uint8Array([0,0,0,0,(h&4278190080)>>24,(h&16711680)>>16,(h&65280)>>8,h&255]))},M=function(h){return p(ve.minf,h.type==="video"?p(ve.vmhd,le):p(ve.smhd,Me),g(),ee(h))},U=function(h,m){for(var y=[],v=m.length;v--;)y[v]=_e(m[v]);return p.apply(null,[ve.moof,A(h)].concat(y))},D=function(h){for(var m=h.length,y=[];m--;)y[m]=Y(h[m]);return p.apply(null,[ve.moov,H(4294967295)].concat(y).concat(z(h)))},z=function(h){for(var m=h.length,y=[];m--;)y[m]=fe(h[m]);return p.apply(null,[ve.mvex].concat(y))},H=function(h){var m=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(h&4278190080)>>24,(h&16711680)>>16,(h&65280)>>8,h&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 p(ve.mvhd,m)},G=function(h){var m=h.samples||[],y=new Uint8Array(4+m.length),v,_;for(_=0;_>>8),x.push(v[R].byteLength&255),x=x.concat(Array.prototype.slice.call(v[R]));for(R=0;R<_.length;R++)k.push((_[R].byteLength&65280)>>>8),k.push(_[R].byteLength&255),k=k.concat(Array.prototype.slice.call(_[R]));if(I=[ve.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,(y.width&65280)>>8,y.width&255,(y.height&65280)>>8,y.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]),p(ve.avcC,new Uint8Array([1,y.profileIdc,y.profileCompatibility,y.levelIdc,255].concat([v.length],x,[_.length],k))),p(ve.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],y.sarRatio){var N=y.sarRatio[0],j=y.sarRatio[1];I.push(p(ve.pasp,new Uint8Array([(N&4278190080)>>24,(N&16711680)>>16,(N&65280)>>8,N&255,(j&4278190080)>>24,(j&16711680)>>16,(j&65280)>>8,j&255])))}return p.apply(null,I)},m=function(y){return p(ve.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(y.channelcount&65280)>>8,y.channelcount&255,(y.samplesize&65280)>>8,y.samplesize&255,0,0,0,0,(y.samplerate&65280)>>8,y.samplerate&255,0,0]),b(y))}}(),V=function(h){var m=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(h.id&4278190080)>>24,(h.id&16711680)>>16,(h.id&65280)>>8,h.id&255,0,0,0,0,(h.duration&4278190080)>>24,(h.duration&16711680)>>16,(h.duration&65280)>>8,h.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,(h.width&65280)>>8,h.width&255,0,0,(h.height&65280)>>8,h.height&255,0,0]);return p(ve.tkhd,m)},_e=function(h){var m,y,v,_,x,k,R;return m=p(ve.tfhd,new Uint8Array([0,0,0,58,(h.id&4278190080)>>24,(h.id&16711680)>>16,(h.id&65280)>>8,h.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),k=Math.floor(h.baseMediaDecodeTime/c),R=Math.floor(h.baseMediaDecodeTime%c),y=p(ve.tfdt,new Uint8Array([1,0,0,0,k>>>24&255,k>>>16&255,k>>>8&255,k&255,R>>>24&255,R>>>16&255,R>>>8&255,R&255])),x=32+20+8+16+8+8,h.type==="audio"?(v=xe(h,x),p(ve.traf,m,y,v)):(_=G(h),v=xe(h,_.length+x),p(ve.traf,m,y,v,_))},Y=function(h){return h.duration=h.duration||4294967295,p(ve.trak,V(h),Q(h))},fe=function(h){var m=new Uint8Array([0,0,0,0,(h.id&4278190080)>>24,(h.id&16711680)>>16,(h.id&65280)>>8,h.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return h.type!=="video"&&(m[m.length-1]=0),p(ve.trex,m)},function(){var h,m,y;y=function(v,_){var x=0,k=0,R=0,I=0;return v.length&&(v[0].duration!==void 0&&(x=1),v[0].size!==void 0&&(k=2),v[0].flags!==void 0&&(R=4),v[0].compositionTimeOffset!==void 0&&(I=8)),[0,0,x|k|R|I,1,(v.length&4278190080)>>>24,(v.length&16711680)>>>16,(v.length&65280)>>>8,v.length&255,(_&4278190080)>>>24,(_&16711680)>>>16,(_&65280)>>>8,_&255]},m=function(v,_){var x,k,R,I,N,j;for(I=v.samples||[],_+=8+12+16*I.length,R=y(I,_),k=new Uint8Array(R.length+I.length*16),k.set(R),x=R.length,j=0;j>>24,k[x++]=(N.duration&16711680)>>>16,k[x++]=(N.duration&65280)>>>8,k[x++]=N.duration&255,k[x++]=(N.size&4278190080)>>>24,k[x++]=(N.size&16711680)>>>16,k[x++]=(N.size&65280)>>>8,k[x++]=N.size&255,k[x++]=N.flags.isLeading<<2|N.flags.dependsOn,k[x++]=N.flags.isDependedOn<<6|N.flags.hasRedundancy<<4|N.flags.paddingValue<<1|N.flags.isNonSyncSample,k[x++]=N.flags.degradationPriority&61440,k[x++]=N.flags.degradationPriority&15,k[x++]=(N.compositionTimeOffset&4278190080)>>>24,k[x++]=(N.compositionTimeOffset&16711680)>>>16,k[x++]=(N.compositionTimeOffset&65280)>>>8,k[x++]=N.compositionTimeOffset&255;return p(ve.trun,k)},h=function(v,_){var x,k,R,I,N,j;for(I=v.samples||[],_+=8+12+8*I.length,R=y(I,_),x=new Uint8Array(R.length+I.length*8),x.set(R),k=R.length,j=0;j>>24,x[k++]=(N.duration&16711680)>>>16,x[k++]=(N.duration&65280)>>>8,x[k++]=N.duration&255,x[k++]=(N.size&4278190080)>>>24,x[k++]=(N.size&16711680)>>>16,x[k++]=(N.size&65280)>>>8,x[k++]=N.size&255;return p(ve.trun,x)},xe=function(v,_){return v.type==="audio"?h(v,_):m(v,_)}}();var Lr={ftyp:S,mdat:E,moof:U,moov:D,initSegment:function(h){var m=S(),y=D(h),v;return v=new Uint8Array(m.byteLength+y.byteLength),v.set(m),v.set(y,m.byteLength),v}},Rt=function(h){var m,y,v=[],_=[];for(_.byteLength=0,_.nalCount=0,_.duration=0,v.byteLength=0,m=0;m1&&(m=h.shift(),h.byteLength-=m.byteLength,h.nalCount-=m.nalCount,h[0][0].dts=m.dts,h[0][0].pts=m.pts,h[0][0].duration+=m.duration),h},Ir=function(){return{size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}},Ra=function(h,m){var y=Ir();return y.dataOffset=m,y.compositionTimeOffset=h.pts-h.dts,y.duration=h.duration,y.size=4*h.length,y.size+=h.byteLength,h.keyFrame&&(y.flags.dependsOn=2,y.flags.isNonSyncSample=0),y},qs=function(h,m){var y,v,_,x,k,R=m||0,I=[];for(y=0;yUi.ONE_SECOND_IN_TS/2))){for(N=Xs()[h.samplerate],N||(N=m[0].data),j=0;j=y?h:(m.minSegmentDts=1/0,h.filter(function(v){return v.dts>=y?(m.minSegmentDts=Math.min(m.minSegmentDts,v.dts),m.minSegmentPts=m.minSegmentDts,!0):!1}))},X=function(h){var m,y,v=[];for(m=0;m-1):!1},this.trigger=function(m){var y,v,_,x;if(y=h[m],!!y)if(arguments.length===2)for(_=y.length,v=0;v<_;++v)y[v].call(this,arguments[1]);else{for(x=[],v=arguments.length,v=1;v"u")){for(h in ve)ve.hasOwnProperty(h)&&(ve[h]=[h.charCodeAt(0),h.charCodeAt(1),h.charCodeAt(2),h.charCodeAt(3)]);Ne=new Uint8Array(["i".charCodeAt(0),"s".charCodeAt(0),"o".charCodeAt(0),"m".charCodeAt(0)]),de=new Uint8Array(["a".charCodeAt(0),"v".charCodeAt(0),"c".charCodeAt(0),"1".charCodeAt(0)]),at=new Uint8Array([0,0,0,1]),Ee=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]),Re=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]),Ye={video:Ee,audio:Re},Ae=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),Me=new Uint8Array([0,0,0,0,0,0,0,0]),rt=new Uint8Array([0,0,0,0,0,0,0,0]),xt=rt,Ut=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),nt=rt,le=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}})(),p=function(h){var m=[],y=0,v,_,x;for(v=1;v>>1,h.samplingfrequencyindex<<7|h.channelcount<<3,6,1,2]))},S=function(){return p(ve.ftyp,Ne,at,Ne,de)},W=function(h){return p(ve.hdlr,Ye[h])},E=function(h){return p(ve.mdat,h)},Z=function(h){var m=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,h.duration>>>24&255,h.duration>>>16&255,h.duration>>>8&255,h.duration&255,85,196,0,0]);return h.samplerate&&(m[12]=h.samplerate>>>24&255,m[13]=h.samplerate>>>16&255,m[14]=h.samplerate>>>8&255,m[15]=h.samplerate&255),p(ve.mdhd,m)},Q=function(h){return p(ve.mdia,Z(h),W(h.type),M(h))},A=function(h){return p(ve.mfhd,new Uint8Array([0,0,0,0,(h&4278190080)>>24,(h&16711680)>>16,(h&65280)>>8,h&255]))},M=function(h){return p(ve.minf,h.type==="video"?p(ve.vmhd,le):p(ve.smhd,Me),g(),ee(h))},U=function(h,m){for(var y=[],v=m.length;v--;)y[v]=_e(m[v]);return p.apply(null,[ve.moof,A(h)].concat(y))},D=function(h){for(var m=h.length,y=[];m--;)y[m]=Y(h[m]);return p.apply(null,[ve.moov,H(4294967295)].concat(y).concat(z(h)))},z=function(h){for(var m=h.length,y=[];m--;)y[m]=fe(h[m]);return p.apply(null,[ve.mvex].concat(y))},H=function(h){var m=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(h&4278190080)>>24,(h&16711680)>>16,(h&65280)>>8,h&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 p(ve.mvhd,m)},G=function(h){var m=h.samples||[],y=new Uint8Array(4+m.length),v,_;for(_=0;_>>8),x.push(v[R].byteLength&255),x=x.concat(Array.prototype.slice.call(v[R]));for(R=0;R<_.length;R++)k.push((_[R].byteLength&65280)>>>8),k.push(_[R].byteLength&255),k=k.concat(Array.prototype.slice.call(_[R]));if(I=[ve.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,(y.width&65280)>>8,y.width&255,(y.height&65280)>>8,y.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]),p(ve.avcC,new Uint8Array([1,y.profileIdc,y.profileCompatibility,y.levelIdc,255].concat([v.length],x,[_.length],k))),p(ve.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],y.sarRatio){var N=y.sarRatio[0],j=y.sarRatio[1];I.push(p(ve.pasp,new Uint8Array([(N&4278190080)>>24,(N&16711680)>>16,(N&65280)>>8,N&255,(j&4278190080)>>24,(j&16711680)>>16,(j&65280)>>8,j&255])))}return p.apply(null,I)},m=function(y){return p(ve.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(y.channelcount&65280)>>8,y.channelcount&255,(y.samplesize&65280)>>8,y.samplesize&255,0,0,0,0,(y.samplerate&65280)>>8,y.samplerate&255,0,0]),b(y))}}(),$=function(h){var m=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(h.id&4278190080)>>24,(h.id&16711680)>>16,(h.id&65280)>>8,h.id&255,0,0,0,0,(h.duration&4278190080)>>24,(h.duration&16711680)>>16,(h.duration&65280)>>8,h.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,(h.width&65280)>>8,h.width&255,0,0,(h.height&65280)>>8,h.height&255,0,0]);return p(ve.tkhd,m)},_e=function(h){var m,y,v,_,x,k,R;return m=p(ve.tfhd,new Uint8Array([0,0,0,58,(h.id&4278190080)>>24,(h.id&16711680)>>16,(h.id&65280)>>8,h.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),k=Math.floor(h.baseMediaDecodeTime/c),R=Math.floor(h.baseMediaDecodeTime%c),y=p(ve.tfdt,new Uint8Array([1,0,0,0,k>>>24&255,k>>>16&255,k>>>8&255,k&255,R>>>24&255,R>>>16&255,R>>>8&255,R&255])),x=32+20+8+16+8+8,h.type==="audio"?(v=xe(h,x),p(ve.traf,m,y,v)):(_=G(h),v=xe(h,_.length+x),p(ve.traf,m,y,v,_))},Y=function(h){return h.duration=h.duration||4294967295,p(ve.trak,$(h),Q(h))},fe=function(h){var m=new Uint8Array([0,0,0,0,(h.id&4278190080)>>24,(h.id&16711680)>>16,(h.id&65280)>>8,h.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return h.type!=="video"&&(m[m.length-1]=0),p(ve.trex,m)},function(){var h,m,y;y=function(v,_){var x=0,k=0,R=0,I=0;return v.length&&(v[0].duration!==void 0&&(x=1),v[0].size!==void 0&&(k=2),v[0].flags!==void 0&&(R=4),v[0].compositionTimeOffset!==void 0&&(I=8)),[0,0,x|k|R|I,1,(v.length&4278190080)>>>24,(v.length&16711680)>>>16,(v.length&65280)>>>8,v.length&255,(_&4278190080)>>>24,(_&16711680)>>>16,(_&65280)>>>8,_&255]},m=function(v,_){var x,k,R,I,N,j;for(I=v.samples||[],_+=8+12+16*I.length,R=y(I,_),k=new Uint8Array(R.length+I.length*16),k.set(R),x=R.length,j=0;j>>24,k[x++]=(N.duration&16711680)>>>16,k[x++]=(N.duration&65280)>>>8,k[x++]=N.duration&255,k[x++]=(N.size&4278190080)>>>24,k[x++]=(N.size&16711680)>>>16,k[x++]=(N.size&65280)>>>8,k[x++]=N.size&255,k[x++]=N.flags.isLeading<<2|N.flags.dependsOn,k[x++]=N.flags.isDependedOn<<6|N.flags.hasRedundancy<<4|N.flags.paddingValue<<1|N.flags.isNonSyncSample,k[x++]=N.flags.degradationPriority&61440,k[x++]=N.flags.degradationPriority&15,k[x++]=(N.compositionTimeOffset&4278190080)>>>24,k[x++]=(N.compositionTimeOffset&16711680)>>>16,k[x++]=(N.compositionTimeOffset&65280)>>>8,k[x++]=N.compositionTimeOffset&255;return p(ve.trun,k)},h=function(v,_){var x,k,R,I,N,j;for(I=v.samples||[],_+=8+12+8*I.length,R=y(I,_),x=new Uint8Array(R.length+I.length*8),x.set(R),k=R.length,j=0;j>>24,x[k++]=(N.duration&16711680)>>>16,x[k++]=(N.duration&65280)>>>8,x[k++]=N.duration&255,x[k++]=(N.size&4278190080)>>>24,x[k++]=(N.size&16711680)>>>16,x[k++]=(N.size&65280)>>>8,x[k++]=N.size&255;return p(ve.trun,x)},xe=function(v,_){return v.type==="audio"?h(v,_):m(v,_)}}();var Lr={ftyp:S,mdat:E,moof:U,moov:D,initSegment:function(h){var m=S(),y=D(h),v;return v=new Uint8Array(m.byteLength+y.byteLength),v.set(m),v.set(y,m.byteLength),v}},Rt=function(h){var m,y,v=[],_=[];for(_.byteLength=0,_.nalCount=0,_.duration=0,v.byteLength=0,m=0;m1&&(m=h.shift(),h.byteLength-=m.byteLength,h.nalCount-=m.nalCount,h[0][0].dts=m.dts,h[0][0].pts=m.pts,h[0][0].duration+=m.duration),h},Ir=function(){return{size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}},Ra=function(h,m){var y=Ir();return y.dataOffset=m,y.compositionTimeOffset=h.pts-h.dts,y.duration=h.duration,y.size=4*h.length,y.size+=h.byteLength,h.keyFrame&&(y.flags.dependsOn=2,y.flags.isNonSyncSample=0),y},qs=function(h,m){var y,v,_,x,k,R=m||0,I=[];for(y=0;yUi.ONE_SECOND_IN_TS/2))){for(N=Xs()[h.samplerate],N||(N=m[0].data),j=0;j=y?h:(m.minSegmentDts=1/0,h.filter(function(v){return v.dts>=y?(m.minSegmentDts=Math.min(m.minSegmentDts,v.dts),m.minSegmentPts=m.minSegmentDts,!0):!1}))},X=function(h){var m,y,v=[];for(m=0;m=this.virtualRowCount&&typeof this.beforeRowOverflow=="function"&&this.beforeRowOverflow(h),this.rows.length>0&&(this.rows.push(""),this.rowIdx++);this.rows.length>this.virtualRowCount;)this.rows.shift(),this.rowIdx--},Dn.prototype.isEmpty=function(){return this.rows.length===0?!0:this.rows.length===1?this.rows[0]==="":!1},Dn.prototype.addText=function(h){this.rows[this.rowIdx]+=h},Dn.prototype.backspace=function(){if(!this.isEmpty()){var h=this.rows[this.rowIdx];this.rows[this.rowIdx]=h.substr(0,h.length-1)}};var Si=function(h,m,y){this.serviceNum=h,this.text="",this.currentWindow=new Dn(-1),this.windows=[],this.stream=y,typeof m=="string"&&this.createTextDecoder(m)};Si.prototype.init=function(h,m){this.startPts=h;for(var y=0;y<8;y++)this.windows[y]=new Dn(y),typeof m=="function"&&(this.windows[y].beforeRowOverflow=m)},Si.prototype.setCurrentWindow=function(h){this.currentWindow=this.windows[h]},Si.prototype.createTextDecoder=function(h){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(h)}catch(m){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+h+" encoding. "+m})}};var mt=function(h){h=h||{},mt.prototype.init.call(this);var m=this,y=h.captionServices||{},v={},_;Object.keys(y).forEach(x=>{_=y[x],/^SERVICE/.test(x)&&(v[x]=_.encoding)}),this.serviceEncodings=v,this.current708Packet=null,this.services={},this.push=function(x){x.type===3?(m.new708Packet(),m.add708Bytes(x)):(m.current708Packet===null&&m.new708Packet(),m.add708Bytes(x))}};mt.prototype=new Fd,mt.prototype.new708Packet=function(){this.current708Packet!==null&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},mt.prototype.add708Bytes=function(h){var m=h.ccData,y=m>>>8,v=m&255;this.current708Packet.ptsVals.push(h.pts),this.current708Packet.data.push(y),this.current708Packet.data.push(v)},mt.prototype.push708Packet=function(){var h=this.current708Packet,m=h.data,y=null,v=null,_=0,x=m[_++];for(h.seq=x>>6,h.sizeCode=x&63;_>5,v=x&31,y===7&&v>0&&(x=m[_++],y=x),this.pushServiceBlock(y,_,v),v>0&&(_+=v-1)},mt.prototype.pushServiceBlock=function(h,m,y){var v,_=m,x=this.current708Packet.data,k=this.services[h];for(k||(k=this.initService(h,_));_("0"+(Le&255).toString(16)).slice(-2)).join("")}if(_?(te=[R,I],h++):te=[R],m.textDecoder_&&!v)j=m.textDecoder_.decode(new Uint8Array(te));else if(_){const ue=ge(te);j=String.fromCharCode(parseInt(ue,16))}else j=Hy(k|R);return N.pendingNewLine&&!N.isEmpty()&&N.newLine(this.getPts(h)),N.pendingNewLine=!1,N.addText(j),h},mt.prototype.multiByteCharacter=function(h,m){var y=this.current708Packet.data,v=y[h+1],_=y[h+2];return ke(v)&&ke(_)&&(h=this.handleText(++h,m,{isMultiByte:!0})),h},mt.prototype.setCurrentWindow=function(h,m){var y=this.current708Packet.data,v=y[h],_=v&7;return m.setCurrentWindow(_),h},mt.prototype.defineWindow=function(h,m){var y=this.current708Packet.data,v=y[h],_=v&7;m.setCurrentWindow(_);var x=m.currentWindow;return v=y[++h],x.visible=(v&32)>>5,x.rowLock=(v&16)>>4,x.columnLock=(v&8)>>3,x.priority=v&7,v=y[++h],x.relativePositioning=(v&128)>>7,x.anchorVertical=v&127,v=y[++h],x.anchorHorizontal=v,v=y[++h],x.anchorPoint=(v&240)>>4,x.rowCount=v&15,v=y[++h],x.columnCount=v&63,v=y[++h],x.windowStyle=(v&56)>>3,x.penStyle=v&7,x.virtualRowCount=x.rowCount+1,h},mt.prototype.setWindowAttributes=function(h,m){var y=this.current708Packet.data,v=y[h],_=m.currentWindow.winAttr;return v=y[++h],_.fillOpacity=(v&192)>>6,_.fillRed=(v&48)>>4,_.fillGreen=(v&12)>>2,_.fillBlue=v&3,v=y[++h],_.borderType=(v&192)>>6,_.borderRed=(v&48)>>4,_.borderGreen=(v&12)>>2,_.borderBlue=v&3,v=y[++h],_.borderType+=(v&128)>>5,_.wordWrap=(v&64)>>6,_.printDirection=(v&48)>>4,_.scrollDirection=(v&12)>>2,_.justify=v&3,v=y[++h],_.effectSpeed=(v&240)>>4,_.effectDirection=(v&12)>>2,_.displayEffect=v&3,h},mt.prototype.flushDisplayed=function(h,m){for(var y=[],v=0;v<8;v++)m.windows[v].visible&&!m.windows[v].isEmpty()&&y.push(m.windows[v].getText());m.endPts=h,m.text=y.join(` `),this.pushCaption(m),m.startPts=h},mt.prototype.pushCaption=function(h){h.text!==""&&(this.trigger("data",{startPts:h.startPts,endPts:h.endPts,text:h.text,stream:"cc708_"+h.serviceNum}),h.text="",h.startPts=h.endPts)},mt.prototype.displayWindows=function(h,m){var y=this.current708Packet.data,v=y[++h],_=this.getPts(h);this.flushDisplayed(_,m);for(var x=0;x<8;x++)v&1<>4,_.offset=(v&12)>>2,_.penSize=v&3,v=y[++h],_.italics=(v&128)>>7,_.underline=(v&64)>>6,_.edgeType=(v&56)>>3,_.fontStyle=v&7,h},mt.prototype.setPenColor=function(h,m){var y=this.current708Packet.data,v=y[h],_=m.currentWindow.penColor;return v=y[++h],_.fgOpacity=(v&192)>>6,_.fgRed=(v&48)>>4,_.fgGreen=(v&12)>>2,_.fgBlue=v&3,v=y[++h],_.bgOpacity=(v&192)>>6,_.bgRed=(v&48)>>4,_.bgGreen=(v&12)>>2,_.bgBlue=v&3,v=y[++h],_.edgeRed=(v&48)>>4,_.edgeGreen=(v&12)>>2,_.edgeBlue=v&3,h},mt.prototype.setPenLocation=function(h,m){var y=this.current708Packet.data,v=y[h],_=m.currentWindow.penLoc;return m.currentWindow.pendingNewLine=!0,v=y[++h],_.row=v&15,v=y[++h],_.column=v&63,h},mt.prototype.reset=function(h,m){var y=this.getPts(h);return this.flushDisplayed(y,m),this.initService(m.serviceNum,h)};var zy={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},Fr=function(h){return h===null?"":(h=zy[h]||h,String.fromCharCode(h))},Ho=14,Du=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],ei=function(){for(var h=[],m=Ho+1;m--;)h.push({text:"",indent:0,offset:0});return h},Et=function(h,m){Et.prototype.init.call(this),this.field_=h||0,this.dataChannel_=m||0,this.name_="CC"+((this.field_<<1|this.dataChannel_)+1),this.setConstants(),this.reset(),this.push=function(y){var v,_,x,k,R;if(v=y.ccData&32639,v===this.lastControlCode_){this.lastControlCode_=null;return}if((v&61440)===4096?this.lastControlCode_=v:v!==this.PADDING_&&(this.lastControlCode_=null),x=v>>>8,k=v&255,v!==this.PADDING_)if(v===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(v===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(y.pts),this.flushDisplayed(y.pts),_=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=_,this.startPts_=y.pts;else if(v===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(y.pts);else if(v===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(y.pts);else if(v===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(y.pts);else if(v===this.CARRIAGE_RETURN_)this.clearFormatting(y.pts),this.flushDisplayed(y.pts),this.shiftRowsUp_(),this.startPts_=y.pts;else if(v===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(v===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(y.pts),this.displayed_=ei();else if(v===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=ei();else if(v===this.RESUME_DIRECT_CAPTIONING_)this.mode_!=="paintOn"&&(this.flushDisplayed(y.pts),this.displayed_=ei()),this.mode_="paintOn",this.startPts_=y.pts;else if(this.isSpecialCharacter(x,k))x=(x&3)<<8,R=Fr(x|k),this[this.mode_](y.pts,R),this.column_++;else if(this.isExtCharacter(x,k))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),x=(x&3)<<8,R=Fr(x|k),this[this.mode_](y.pts,R),this.column_++;else if(this.isMidRowCode(x,k))this.clearFormatting(y.pts),this[this.mode_](y.pts," "),this.column_++,(k&14)===14&&this.addFormatting(y.pts,["i"]),(k&1)===1&&this.addFormatting(y.pts,["u"]);else if(this.isOffsetControlCode(x,k)){const N=k&3;this.nonDisplayed_[this.row_].offset=N,this.column_+=N}else if(this.isPAC(x,k)){var I=Du.indexOf(v&7968);if(this.mode_==="rollUp"&&(I-this.rollUpRows_+1<0&&(I=this.rollUpRows_-1),this.setRollUp(y.pts,I)),I!==this.row_&&I>=0&&I<=14&&(this.clearFormatting(y.pts),this.row_=I),k&1&&this.formatting_.indexOf("u")===-1&&this.addFormatting(y.pts,["u"]),(v&16)===16){const N=(v&14)>>1;this.column_=N*4,this.nonDisplayed_[this.row_].indent+=N}this.isColorPAC(k)&&(k&14)===14&&this.addFormatting(y.pts,["i"])}else this.isNormalChar(x)&&(k===0&&(k=null),R=Fr(x),R+=Fr(k),this[this.mode_](y.pts,R),this.column_+=R.length)}};Et.prototype=new Fd,Et.prototype.flushDisplayed=function(h){const m=v=>{this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+v+"."})},y=[];this.displayed_.forEach((v,_)=>{if(v&&v.text&&v.text.length){try{v.text=v.text.trim()}catch{m(_)}v.text.length&&y.push({text:v.text,line:_+1,position:10+Math.min(70,v.indent*10)+v.offset*2.5})}else v==null&&m(_)}),y.length&&this.trigger("data",{startPts:this.startPts_,endPts:h,content:y,stream:this.name_})},Et.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=ei(),this.nonDisplayed_=ei(),this.lastControlCode_=null,this.column_=0,this.row_=Ho,this.rollUpRows_=2,this.formatting_=[]},Et.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},Et.prototype.isSpecialCharacter=function(h,m){return h===this.EXT_&&m>=48&&m<=63},Et.prototype.isExtCharacter=function(h,m){return(h===this.EXT_+1||h===this.EXT_+2)&&m>=32&&m<=63},Et.prototype.isMidRowCode=function(h,m){return h===this.EXT_&&m>=32&&m<=47},Et.prototype.isOffsetControlCode=function(h,m){return h===this.OFFSET_&&m>=33&&m<=35},Et.prototype.isPAC=function(h,m){return h>=this.BASE_&&h=64&&m<=127},Et.prototype.isColorPAC=function(h){return h>=64&&h<=79||h>=96&&h<=127},Et.prototype.isNormalChar=function(h){return h>=32&&h<=127},Et.prototype.setRollUp=function(h,m){if(this.mode_!=="rollUp"&&(this.row_=Ho,this.mode_="rollUp",this.flushDisplayed(h),this.nonDisplayed_=ei(),this.displayed_=ei()),m!==void 0&&m!==this.row_)for(var y=0;y"},"");this[this.mode_](h,y)},Et.prototype.clearFormatting=function(h){if(this.formatting_.length){var m=this.formatting_.reverse().reduce(function(y,v){return y+""},"");this.formatting_=[],this[this.mode_](h,m)}},Et.prototype.popOn=function(h,m){var y=this.nonDisplayed_[this.row_].text;y+=m,this.nonDisplayed_[this.row_].text=y},Et.prototype.rollUp=function(h,m){var y=this.displayed_[this.row_].text;y+=m,this.displayed_[this.row_].text=y},Et.prototype.shiftRowsUp_=function(){var h;for(h=0;hm&&(y=-1);Math.abs(m-h)>Hp;)h+=y*Fp;return h},Ou=function(h){var m,y;Ou.prototype.init.call(this),this.type_=h||Hr,this.push=function(v){if(v.type==="metadata"){this.trigger("data",v);return}this.type_!==Hr&&v.type!==this.type_||(y===void 0&&(y=v.dts),v.dts=ku(v.dts,y),v.pts=ku(v.pts,y),m=v.dts,this.trigger("data",v))},this.flush=function(){y=m,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){y=void 0,m=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};Ou.prototype=new Hd;var zd={TimestampRolloverStream:Ou,handleRollover:ku},zp=(h,m,y)=>{if(!h)return-1;for(var v=y;v";h.data[0]===gs.Utf8&&(y=pi(h.data,0,m),!(y<0)&&(h.mimeType=ys(h.data,m,y),m=y+1,h.pictureType=h.data[m],m++,v=pi(h.data,0,m),!(v<0)&&(h.description=Pa(h.data,m,v),m=v+1,h.mimeType===_?h.url=ys(h.data,m,h.data.length):h.pictureData=h.data.subarray(m,h.data.length))))},"T*":function(h){h.data[0]===gs.Utf8&&(h.value=Pa(h.data,1,h.data.length).replace(/\0*$/,""),h.values=h.value.split("\0"))},TXXX:function(h){var m;h.data[0]===gs.Utf8&&(m=pi(h.data,0,1),m!==-1&&(h.description=Pa(h.data,1,m),h.value=Pa(h.data,m+1,h.data.length).replace(/\0*$/,""),h.data=h.value))},"W*":function(h){h.url=ys(h.data,0,h.data.length).replace(/\0.*$/,"")},WXXX:function(h){var m;h.data[0]===gs.Utf8&&(m=pi(h.data,0,1),m!==-1&&(h.description=Pa(h.data,1,m),h.url=ys(h.data,m+1,h.data.length).replace(/\0.*$/,"")))},PRIV:function(h){var m;for(m=0;m>>2;Le*=4,Le+=ue[7]&3,j.timeStamp=Le,R.pts===void 0&&R.dts===void 0&&(R.pts=j.timeStamp,R.dts=j.timeStamp),this.trigger("timestamp",j)}R.frames.push(j),I+=10,I+=N}while(I>>4>1&&(k+=_[k]+1),x.pid===0)x.type="pat",h(_.subarray(k),x),this.trigger("data",x);else if(x.pid===this.pmtPid)for(x.type="pmt",h(_.subarray(k),x),this.trigger("data",x);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else this.programMapTable===void 0?this.packetsWaitingForPmt.push([_,k,x]):this.processPes_(_,k,x)},this.processPes_=function(_,x,k){k.pid===this.programMapTable.video?k.streamType=hn.H264_STREAM_TYPE:k.pid===this.programMapTable.audio?k.streamType=hn.ADTS_STREAM_TYPE:k.streamType=this.programMapTable["timed-metadata"][k.pid],k.type="pes",k.data=_.subarray(x),this.trigger("data",k)}},Ua.prototype=new Vo,Ua.STREAM_TYPES={h264:27,adts:15},Ba=function(){var h=this,m=!1,y={data:[],size:0},v={data:[],size:0},_={data:[],size:0},x,k=function(I,N){var j;const te=I[0]<<16|I[1]<<8|I[2];N.data=new Uint8Array,te===1&&(N.packetLength=6+(I[4]<<8|I[5]),N.dataAlignmentIndicator=(I[6]&4)!==0,j=I[7],j&192&&(N.pts=(I[9]&14)<<27|(I[10]&255)<<20|(I[11]&254)<<12|(I[12]&255)<<5|(I[13]&254)>>>3,N.pts*=4,N.pts+=(I[13]&6)>>>1,N.dts=N.pts,j&64&&(N.dts=(I[14]&14)<<27|(I[15]&255)<<20|(I[16]&254)<<12|(I[17]&255)<<5|(I[18]&254)>>>3,N.dts*=4,N.dts+=(I[18]&6)>>>1)),N.data=I.subarray(9+I[8]))},R=function(I,N,j){var te=new Uint8Array(I.size),ge={type:N},ue=0,Le=0,Pe=!1,qt;if(!(!I.data.length||I.size<9)){for(ge.trackId=I.data[0].pid,ue=0;ue>5,I=((m[_+6]&3)+1)*1024,N=I*Gp/Xp[(m[_+2]&60)>>>2],m.byteLength-_>>6&3)+1,channelcount:(m[_+2]&1)<<2|(m[_+3]&192)>>>6,samplerate:Xp[(m[_+2]&60)>>>2],samplingfrequencyindex:(m[_+2]&60)>>>2,samplesize:16,data:m.subarray(_+7+k,_+x)}),y++,_+=x}typeof j=="number"&&(this.skipWarn_(j,_),j=null),m=m.subarray(_)}},this.flush=function(){y=0,this.trigger("done")},this.reset=function(){m=void 0,this.trigger("reset")},this.endTimeline=function(){m=void 0,this.trigger("endedtimeline")}},Iu.prototype=new $o;var qy=Iu,Yp;Yp=function(h){var m=h.byteLength,y=0,v=0;this.length=function(){return 8*m},this.bitsAvailable=function(){return 8*m+v},this.loadWord=function(){var _=h.byteLength-m,x=new Uint8Array(4),k=Math.min(4,m);if(k===0)throw new Error("no bytes available");x.set(h.subarray(_,_+k)),y=new DataView(x.buffer).getUint32(0),v=k*8,m-=k},this.skipBits=function(_){var x;v>_?(y<<=_,v-=_):(_-=v,x=Math.floor(_/8),_-=x*8,m-=x,this.loadWord(),y<<=_,v-=_)},this.readBits=function(_){var x=Math.min(v,_),k=y>>>32-x;return v-=x,v>0?y<<=x:m>0&&this.loadWord(),x=_-x,x>0?k<>>_)return y<<=_,v-=_,_;return this.loadWord(),_+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var _=this.skipLeadingZeros();return this.readBits(_+1)-1},this.readExpGolomb=function(){var _=this.readUnsignedExpGolomb();return 1&_?1+_>>>1:-1*(_>>>1)},this.readBoolean=function(){return this.readBits(1)===1},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};var Go=Yp,Nu=i,Wp=Go,Xo,bs,Vd;bs=function(){var h=0,m,y;bs.prototype.init.call(this),this.push=function(v){var _;y?(_=new Uint8Array(y.byteLength+v.data.byteLength),_.set(y),_.set(v.data,y.byteLength),y=_):y=v.data;for(var x=y.byteLength;h3&&this.trigger("data",y.subarray(h+3)),y=null,h=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}},bs.prototype=new Nu,Vd={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},Xo=function(){var h=new bs,m,y,v,_,x,k,R;Xo.prototype.init.call(this),m=this,this.push=function(I){I.type==="video"&&(y=I.trackId,v=I.pts,_=I.dts,h.push(I))},h.on("data",function(I){var N={trackId:y,pts:v,dts:_,data:I,nalUnitTypeCode:I[0]&31};switch(N.nalUnitTypeCode){case 5:N.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:N.nalUnitType="sei_rbsp",N.escapedRBSP=x(I.subarray(1));break;case 7:N.nalUnitType="seq_parameter_set_rbsp",N.escapedRBSP=x(I.subarray(1)),N.config=k(N.escapedRBSP);break;case 8:N.nalUnitType="pic_parameter_set_rbsp";break;case 9:N.nalUnitType="access_unit_delimiter_rbsp";break}m.trigger("data",N)}),h.on("done",function(){m.trigger("done")}),h.on("partialdone",function(){m.trigger("partialdone")}),h.on("reset",function(){m.trigger("reset")}),h.on("endedtimeline",function(){m.trigger("endedtimeline")}),this.flush=function(){h.flush()},this.partialFlush=function(){h.partialFlush()},this.reset=function(){h.reset()},this.endTimeline=function(){h.endTimeline()},R=function(I,N){var j=8,te=8,ge,ue;for(ge=0;ge>4;return y=y>=0?y:0,_?y+20:y+10},xi=function(h,m){return h.length-m<10||h[m]!=="I".charCodeAt(0)||h[m+1]!=="D".charCodeAt(0)||h[m+2]!=="3".charCodeAt(0)?m:(m+=$d(h,m),xi(h,m))},Vy=function(h){var m=xi(h,0);return h.length>=m+2&&(h[m]&255)===255&&(h[m+1]&240)===240&&(h[m+1]&22)===16},Bu=function(h){return h[0]<<21|h[1]<<14|h[2]<<7|h[3]},Qp=function(h,m,y){var v,_="";for(v=m;v>5,v=h[m+4]<<3,_=h[m+3]&6144;return _|v|y},Gy=function(h,m){return h[m]==="I".charCodeAt(0)&&h[m+1]==="D".charCodeAt(0)&&h[m+2]==="3".charCodeAt(0)?"timed-metadata":h[m]&!0&&(h[m+1]&240)===240?"audio":null},Zp=function(h){for(var m=0;m+5>>2]}return null},Xy=function(h){var m,y,v,_;m=10,h[5]&64&&(m+=4,m+=Bu(h.subarray(10,14)));do{if(y=Bu(h.subarray(m+4,m+8)),y<1)return null;if(_=String.fromCharCode(h[m],h[m+1],h[m+2],h[m+3]),_==="PRIV"){v=h.subarray(m+10,m+y+10);for(var x=0;x>>2;return I*=4,I+=R[7]&3,I}break}}m+=10,m+=y}while(m=3;){if(h[_]==="I".charCodeAt(0)&&h[_+1]==="D".charCodeAt(0)&&h[_+2]==="3".charCodeAt(0)){if(h.length-_<10||(v=Yo.parseId3TagSize(h,_),_+v>h.length))break;k={type:"timed-metadata",data:h.subarray(_,_+v)},this.trigger("data",k),_+=v;continue}else if((h[_]&255)===255&&(h[_+1]&240)===240){if(h.length-_<7||(v=Yo.parseAdtsSize(h,_),_+v>h.length))break;R={type:"audio",data:h.subarray(_,_+v),pts:m,dts:m},this.trigger("data",R),_+=v;continue}_++}x=h.length-_,x>0?h=h.subarray(_):h=new Uint8Array},this.reset=function(){h=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){h=new Uint8Array,this.trigger("endedtimeline")}},Wo.prototype=new Yy;var Jp=Wo,em=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],Wy=em,Qy=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],Ky=Qy,Hu=i,Qo=Lr,_s=ps,Ko=be,fn=ze,Gn=$p,Zo=ot,zu=qy,tm=Pu.H264Stream,Vr=Jp,$r=Fu.isLikelyAacData,wn=ot.ONE_SECOND_IN_TS,Ei=Wy,Fa=Ky,Zs,Js,ri,er,ju=function(h,m){m.stream=h,this.trigger("log",m)},tr=function(h,m){for(var y=Object.keys(m),v=0;v=-N&&te<=I&&(!ge||j>te)&&(ge=Le,j=te)));return ge?ge.gop:null},this.alignGopsAtStart_=function(R){var I,N,j,te,ge,ue,Le,Pe;for(ge=R.byteLength,ue=R.nalCount,Le=R.duration,I=N=0;I<_.length&&Nj.pts){I++;continue}N++,ge-=te.byteLength,ue-=te.nalCount,Le-=te.duration}return N===0?R:N===R.length?null:(Pe=R.slice(N),Pe.byteLength=ge,Pe.duration=Le,Pe.nalCount=ue,Pe.pts=Pe[0].pts,Pe.dts=Pe[0].dts,Pe)},this.alignGopsAtEnd_=function(R){var I,N,j,te,ge,ue;for(I=_.length-1,N=R.length-1,ge=null,ue=!1;I>=0&&N>=0;){if(j=_[I],te=R[N],j.pts===te.pts){ue=!0;break}if(j.pts>te.pts){I--;continue}I===_.length-1&&(ge=N),N--}if(!ue&&ge===null)return null;var Le;if(ue?Le=N:Le=ge,Le===0)return R;var Pe=R.slice(Le),qt=Pe.reduce(function(mi,Wn){return mi.byteLength+=Wn.byteLength,mi.duration+=Wn.duration,mi.nalCount+=Wn.nalCount,mi},{byteLength:0,duration:0,nalCount:0});return Pe.byteLength=qt.byteLength,Pe.duration=qt.duration,Pe.nalCount=qt.nalCount,Pe.pts=Pe[0].pts,Pe.dts=Pe[0].dts,Pe},this.alignGopsWith=function(R){_=R}},Zs.prototype=new Hu,er=function(h,m){this.numberOfTracks=0,this.metadataStream=m,h=h||{},typeof h.remux<"u"?this.remuxTracks=!!h.remux:this.remuxTracks=!0,typeof h.keepOriginalTimestamps=="boolean"?this.keepOriginalTimestamps=h.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,er.prototype.init.call(this),this.push=function(y){if(y.content||y.text)return this.pendingCaptions.push(y);if(y.frames)return this.pendingMetadata.push(y);this.pendingTracks.push(y.track),this.pendingBytes+=y.boxes.byteLength,y.track.type==="video"&&(this.videoTrack=y.track,this.pendingBoxes.push(y.boxes)),y.track.type==="audio"&&(this.audioTrack=y.track,this.pendingBoxes.unshift(y.boxes))}},er.prototype=new Hu,er.prototype.flush=function(h){var m=0,y={captions:[],captionStreams:{},metadata:[],info:{}},v,_,x,k=0,R;if(this.pendingTracks.length=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0);return}}if(this.videoTrack?(k=this.videoTrack.timelineStartInfo.pts,Fa.forEach(function(I){y.info[I]=this.videoTrack[I]},this)):this.audioTrack&&(k=this.audioTrack.timelineStartInfo.pts,Ei.forEach(function(I){y.info[I]=this.audioTrack[I]},this)),this.videoTrack||this.audioTrack){for(this.pendingTracks.length===1?y.type=this.pendingTracks[0].type:y.type="combined",this.emittedTracks+=this.pendingTracks.length,x=Qo.initSegment(this.pendingTracks),y.initSegment=new Uint8Array(x.byteLength),y.initSegment.set(x),y.data=new Uint8Array(this.pendingBytes),R=0;R=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},er.prototype.setRemux=function(h){this.remuxTracks=h},ri=function(h){var m=this,y=!0,v,_;ri.prototype.init.call(this),h=h||{},this.baseMediaDecodeTime=h.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var x={};this.transmuxPipeline_=x,x.type="aac",x.metadataStream=new Gn.MetadataStream,x.aacStream=new Vr,x.audioTimestampRolloverStream=new Gn.TimestampRolloverStream("audio"),x.timedMetadataTimestampRolloverStream=new Gn.TimestampRolloverStream("timed-metadata"),x.adtsStream=new zu,x.coalesceStream=new er(h,x.metadataStream),x.headOfPipeline=x.aacStream,x.aacStream.pipe(x.audioTimestampRolloverStream).pipe(x.adtsStream),x.aacStream.pipe(x.timedMetadataTimestampRolloverStream).pipe(x.metadataStream).pipe(x.coalesceStream),x.metadataStream.on("timestamp",function(k){x.aacStream.setTimestamp(k.timeStamp)}),x.aacStream.on("data",function(k){k.type!=="timed-metadata"&&k.type!=="audio"||x.audioSegmentStream||(_=_||{timelineStartInfo:{baseMediaDecodeTime:m.baseMediaDecodeTime},codec:"adts",type:"audio"},x.coalesceStream.numberOfTracks++,x.audioSegmentStream=new Js(_,h),x.audioSegmentStream.on("log",m.getLogTrigger_("audioSegmentStream")),x.audioSegmentStream.on("timingInfo",m.trigger.bind(m,"audioTimingInfo")),x.adtsStream.pipe(x.audioSegmentStream).pipe(x.coalesceStream),m.trigger("trackinfo",{hasAudio:!!_,hasVideo:!!v}))}),x.coalesceStream.on("data",this.trigger.bind(this,"data")),x.coalesceStream.on("done",this.trigger.bind(this,"done")),tr(this,x)},this.setupTsPipeline=function(){var x={};this.transmuxPipeline_=x,x.type="ts",x.metadataStream=new Gn.MetadataStream,x.packetStream=new Gn.TransportPacketStream,x.parseStream=new Gn.TransportParseStream,x.elementaryStream=new Gn.ElementaryStream,x.timestampRolloverStream=new Gn.TimestampRolloverStream,x.adtsStream=new zu,x.h264Stream=new tm,x.captionStream=new Gn.CaptionStream(h),x.coalesceStream=new er(h,x.metadataStream),x.headOfPipeline=x.packetStream,x.packetStream.pipe(x.parseStream).pipe(x.elementaryStream).pipe(x.timestampRolloverStream),x.timestampRolloverStream.pipe(x.h264Stream),x.timestampRolloverStream.pipe(x.adtsStream),x.timestampRolloverStream.pipe(x.metadataStream).pipe(x.coalesceStream),x.h264Stream.pipe(x.captionStream).pipe(x.coalesceStream),x.elementaryStream.on("data",function(k){var R;if(k.type==="metadata"){for(R=k.tracks.length;R--;)!v&&k.tracks[R].type==="video"?(v=k.tracks[R],v.timelineStartInfo.baseMediaDecodeTime=m.baseMediaDecodeTime):!_&&k.tracks[R].type==="audio"&&(_=k.tracks[R],_.timelineStartInfo.baseMediaDecodeTime=m.baseMediaDecodeTime);v&&!x.videoSegmentStream&&(x.coalesceStream.numberOfTracks++,x.videoSegmentStream=new Zs(v,h),x.videoSegmentStream.on("log",m.getLogTrigger_("videoSegmentStream")),x.videoSegmentStream.on("timelineStartInfo",function(I){_&&!h.keepOriginalTimestamps&&(_.timelineStartInfo=I,x.audioSegmentStream.setEarliestDts(I.dts-m.baseMediaDecodeTime))}),x.videoSegmentStream.on("processedGopsInfo",m.trigger.bind(m,"gopInfo")),x.videoSegmentStream.on("segmentTimingInfo",m.trigger.bind(m,"videoSegmentTimingInfo")),x.videoSegmentStream.on("baseMediaDecodeTime",function(I){_&&x.audioSegmentStream.setVideoBaseMediaDecodeTime(I)}),x.videoSegmentStream.on("timingInfo",m.trigger.bind(m,"videoTimingInfo")),x.h264Stream.pipe(x.videoSegmentStream).pipe(x.coalesceStream)),_&&!x.audioSegmentStream&&(x.coalesceStream.numberOfTracks++,x.audioSegmentStream=new Js(_,h),x.audioSegmentStream.on("log",m.getLogTrigger_("audioSegmentStream")),x.audioSegmentStream.on("timingInfo",m.trigger.bind(m,"audioTimingInfo")),x.audioSegmentStream.on("segmentTimingInfo",m.trigger.bind(m,"audioSegmentTimingInfo")),x.adtsStream.pipe(x.audioSegmentStream).pipe(x.coalesceStream)),m.trigger("trackinfo",{hasAudio:!!_,hasVideo:!!v})}}),x.coalesceStream.on("data",this.trigger.bind(this,"data")),x.coalesceStream.on("id3Frame",function(k){k.dispatchType=x.metadataStream.dispatchType,m.trigger("id3Frame",k)}),x.coalesceStream.on("caption",this.trigger.bind(this,"caption")),x.coalesceStream.on("done",this.trigger.bind(this,"done")),tr(this,x)},this.setBaseMediaDecodeTime=function(x){var k=this.transmuxPipeline_;h.keepOriginalTimestamps||(this.baseMediaDecodeTime=x),_&&(_.timelineStartInfo.dts=void 0,_.timelineStartInfo.pts=void 0,fn.clearDtsInfo(_),k.audioTimestampRolloverStream&&k.audioTimestampRolloverStream.discontinuity()),v&&(k.videoSegmentStream&&(k.videoSegmentStream.gopCache_=[]),v.timelineStartInfo.dts=void 0,v.timelineStartInfo.pts=void 0,fn.clearDtsInfo(v),k.captionStream.reset()),k.timestampRolloverStream&&k.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(x){_&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(x)},this.setRemux=function(x){var k=this.transmuxPipeline_;h.remux=x,k&&k.coalesceStream&&k.coalesceStream.setRemux(x)},this.alignGopsWith=function(x){v&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(x)},this.getLogTrigger_=function(x){var k=this;return function(R){R.stream=x,k.trigger("log",R)}},this.push=function(x){if(y){var k=$r(x);k&&this.transmuxPipeline_.type!=="aac"?this.setupAacPipeline():!k&&this.transmuxPipeline_.type!=="ts"&&this.setupTsPipeline(),y=!1}this.transmuxPipeline_.headOfPipeline.push(x)},this.flush=function(){y=!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()}},ri.prototype=new Hu;var im={Transmuxer:ri,VideoSegmentStream:Zs,AudioSegmentStream:Js,AUDIO_PROPERTIES:Ei,VIDEO_PROPERTIES:Fa,generateSegmentTimingInfo:Vu},Gd=function(h){return h>>>0},Zy=function(h){return("00"+h.toString(16)).slice(-2)},Ha={toUnsigned:Gd,toHexString:Zy},Ts=function(h){var m="";return m+=String.fromCharCode(h[0]),m+=String.fromCharCode(h[1]),m+=String.fromCharCode(h[2]),m+=String.fromCharCode(h[3]),m},$u=Ts,Xd=Ha.toUnsigned,Gu=$u,ir=function(h,m){var y=[],v,_,x,k,R;if(!m.length)return null;for(v=0;v1?v+_:h.byteLength,x===m[0]&&(m.length===1?y.push(h.subarray(v+8,k)):(R=ir(h.subarray(v+8,k),m.slice(1)),R.length&&(y=y.concat(R)))),v=k;return y},za=ir,Yd=Ha.toUnsigned,Gr=u.getUint64,nm=function(h){var m={version:h[0],flags:new Uint8Array(h.subarray(1,4))};return m.version===1?m.baseMediaDecodeTime=Gr(h.subarray(4)):m.baseMediaDecodeTime=Yd(h[4]<<24|h[5]<<16|h[6]<<8|h[7]),m},Jo=nm,Wd=function(h){var m=new DataView(h.buffer,h.byteOffset,h.byteLength),y={version:h[0],flags:new Uint8Array(h.subarray(1,4)),trackId:m.getUint32(4)},v=y.flags[2]&1,_=y.flags[2]&2,x=y.flags[2]&8,k=y.flags[2]&16,R=y.flags[2]&32,I=y.flags[0]&65536,N=y.flags[0]&131072,j;return j=8,v&&(j+=4,y.baseDataOffset=m.getUint32(12),j+=4),_&&(y.sampleDescriptionIndex=m.getUint32(j),j+=4),x&&(y.defaultSampleDuration=m.getUint32(j),j+=4),k&&(y.defaultSampleSize=m.getUint32(j),j+=4),R&&(y.defaultSampleFlags=m.getUint32(j)),I&&(y.durationIsEmpty=!0),!v&&N&&(y.baseDataOffsetIsMoof=!0),y},Ss=Wd,nr=u.getUint64,Qd=function(h){var m=new DataView(h.buffer,h.byteOffset,h.byteLength),y={version:h[0],flags:new Uint8Array(h.subarray(1,4)),references:[],referenceId:m.getUint32(4),timescale:m.getUint32(8)},v=12;y.version===0?(y.earliestPresentationTime=m.getUint32(v),y.firstOffset=m.getUint32(v+4),v+=8):(y.earliestPresentationTime=nr(h.subarray(v)),y.firstOffset=nr(h.subarray(v+8)),v+=16),v+=2;var _=m.getUint16(v);for(v+=2;_>0;v+=12,_--)y.references.push({referenceType:(h[v]&128)>>>7,referencedSize:m.getUint32(v)&2147483647,subsegmentDuration:m.getUint32(v+4),startsWithSap:!!(h[v+8]&128),sapType:(h[v+8]&112)>>>4,sapDeltaTime:m.getUint32(v+8)&268435455});return y},Xr=Qd,sm=function(h){return{isLeading:(h[0]&12)>>>2,dependsOn:h[0]&3,isDependedOn:(h[1]&192)>>>6,hasRedundancy:(h[1]&48)>>>4,paddingValue:(h[1]&14)>>>1,isNonSyncSample:h[1]&1,degradationPriority:h[2]<<8|h[3]}},rm=sm,ja=rm,el=function(h){var m={version:h[0],flags:new Uint8Array(h.subarray(1,4)),samples:[]},y=new DataView(h.buffer,h.byteOffset,h.byteLength),v=m.flags[2]&1,_=m.flags[2]&4,x=m.flags[1]&1,k=m.flags[1]&2,R=m.flags[1]&4,I=m.flags[1]&8,N=y.getUint32(4),j=8,te;for(v&&(m.dataOffset=y.getInt32(j),j+=4),_&&N&&(te={flags:ja(h.subarray(j,j+4))},j+=4,x&&(te.duration=y.getUint32(j),j+=4),k&&(te.size=y.getUint32(j),j+=4),I&&(m.version===1?te.compositionTimeOffset=y.getInt32(j):te.compositionTimeOffset=y.getUint32(j),j+=4),m.samples.push(te),N--);N--;)te={},x&&(te.duration=y.getUint32(j),j+=4),k&&(te.size=y.getUint32(j),j+=4),R&&(te.flags=ja(h.subarray(j,j+4)),j+=4),I&&(m.version===1?te.compositionTimeOffset=y.getInt32(j):te.compositionTimeOffset=y.getUint32(j),j+=4),m.samples.push(te);return m},Kd=el,tl=u,Zd=tl.getUint64,Wt,Xn,jt=function(h){return new Date(h*1e3-20828448e5)},Yr=$u,Jd=za,il=function(h){var m=new DataView(h.buffer,h.byteOffset,h.byteLength),y=[],v,_;for(v=0;v+4MALFORMED DATA");continue}switch(h[v]&31){case 1:y.push("slice_layer_without_partitioning_rbsp");break;case 5:y.push("slice_layer_without_partitioning_rbsp_idr");break;case 6:y.push("sei_rbsp");break;case 7:y.push("seq_parameter_set_rbsp");break;case 8:y.push("pic_parameter_set_rbsp");break;case 9:y.push("access_unit_delimiter_rbsp");break;default:y.push("UNKNOWN NAL - "+h[v]&31);break}}return y},kn={avc1:function(h){var m=new DataView(h.buffer,h.byteOffset,h.byteLength);return{dataReferenceIndex:m.getUint16(6),width:m.getUint16(24),height:m.getUint16(26),horizresolution:m.getUint16(28)+m.getUint16(30)/16,vertresolution:m.getUint16(32)+m.getUint16(34)/16,frameCount:m.getUint16(40),depth:m.getUint16(74),config:Wt(h.subarray(78,h.byteLength))}},avcC:function(h){var m=new DataView(h.buffer,h.byteOffset,h.byteLength),y={configurationVersion:h[0],avcProfileIndication:h[1],profileCompatibility:h[2],avcLevelIndication:h[3],lengthSizeMinusOne:h[4]&3,sps:[],pps:[]},v=h[5]&31,_,x,k,R;for(k=6,R=0;R>>2&63,bufferSize:h[13]<<16|h[14]<<8|h[15],maxBitrate:h[16]<<24|h[17]<<16|h[18]<<8|h[19],avgBitrate:h[20]<<24|h[21]<<16|h[22]<<8|h[23],decoderConfigDescriptor:{tag:h[24],length:h[25],audioObjectType:h[26]>>>3&31,samplingFrequencyIndex:(h[26]&7)<<1|h[27]>>>7&1,channelConfiguration:h[27]>>>3&15}}}},ftyp:function(h){for(var m=new DataView(h.buffer,h.byteOffset,h.byteLength),y={majorBrand:Yr(h.subarray(0,4)),minorVersion:m.getUint32(4),compatibleBrands:[]},v=8;v>10)+96),_.language+=String.fromCharCode(((v&992)>>5)+96),_.language+=String.fromCharCode((v&31)+96),_},mdia:function(h){return{boxes:Wt(h)}},mfhd:function(h){return{version:h[0],flags:new Uint8Array(h.subarray(1,4)),sequenceNumber:h[4]<<24|h[5]<<16|h[6]<<8|h[7]}},minf:function(h){return{boxes:Wt(h)}},mp4a:function(h){var m=new DataView(h.buffer,h.byteOffset,h.byteLength),y={dataReferenceIndex:m.getUint16(6),channelcount:m.getUint16(16),samplesize:m.getUint16(18),samplerate:m.getUint16(24)+m.getUint16(26)/65536};return h.byteLength>28&&(y.streamDescriptor=Wt(h.subarray(28))[0]),y},moof:function(h){return{boxes:Wt(h)}},moov:function(h){return{boxes:Wt(h)}},mvex:function(h){return{boxes:Wt(h)}},mvhd:function(h){var m=new DataView(h.buffer,h.byteOffset,h.byteLength),y=4,v={version:m.getUint8(0),flags:new Uint8Array(h.subarray(1,4))};return v.version===1?(y+=4,v.creationTime=jt(m.getUint32(y)),y+=8,v.modificationTime=jt(m.getUint32(y)),y+=4,v.timescale=m.getUint32(y),y+=8,v.duration=m.getUint32(y)):(v.creationTime=jt(m.getUint32(y)),y+=4,v.modificationTime=jt(m.getUint32(y)),y+=4,v.timescale=m.getUint32(y),y+=4,v.duration=m.getUint32(y)),y+=4,v.rate=m.getUint16(y)+m.getUint16(y+2)/16,y+=4,v.volume=m.getUint8(y)+m.getUint8(y+1)/8,y+=2,y+=2,y+=2*4,v.matrix=new Uint32Array(h.subarray(y,y+9*4)),y+=9*4,y+=6*4,v.nextTrackId=m.getUint32(y),v},pdin:function(h){var m=new DataView(h.buffer,h.byteOffset,h.byteLength);return{version:m.getUint8(0),flags:new Uint8Array(h.subarray(1,4)),rate:m.getUint32(4),initialDelay:m.getUint32(8)}},sdtp:function(h){var m={version:h[0],flags:new Uint8Array(h.subarray(1,4)),samples:[]},y;for(y=4;y>4,isDependedOn:(h[y]&12)>>2,hasRedundancy:h[y]&3});return m},sidx:Xr,smhd:function(h){return{version:h[0],flags:new Uint8Array(h.subarray(1,4)),balance:h[4]+h[5]/256}},stbl:function(h){return{boxes:Wt(h)}},ctts:function(h){var m=new DataView(h.buffer,h.byteOffset,h.byteLength),y={version:m.getUint8(0),flags:new Uint8Array(h.subarray(1,4)),compositionOffsets:[]},v=m.getUint32(4),_;for(_=8;v;_+=8,v--)y.compositionOffsets.push({sampleCount:m.getUint32(_),sampleOffset:m[y.version===0?"getUint32":"getInt32"](_+4)});return y},stss:function(h){var m=new DataView(h.buffer,h.byteOffset,h.byteLength),y={version:m.getUint8(0),flags:new Uint8Array(h.subarray(1,4)),syncSamples:[]},v=m.getUint32(4),_;for(_=8;v;_+=4,v--)y.syncSamples.push(m.getUint32(_));return y},stco:function(h){var m=new DataView(h.buffer,h.byteOffset,h.byteLength),y={version:h[0],flags:new Uint8Array(h.subarray(1,4)),chunkOffsets:[]},v=m.getUint32(4),_;for(_=8;v;_+=4,v--)y.chunkOffsets.push(m.getUint32(_));return y},stsc:function(h){var m=new DataView(h.buffer,h.byteOffset,h.byteLength),y=m.getUint32(4),v={version:h[0],flags:new Uint8Array(h.subarray(1,4)),sampleToChunks:[]},_;for(_=8;y;_+=12,y--)v.sampleToChunks.push({firstChunk:m.getUint32(_),samplesPerChunk:m.getUint32(_+4),sampleDescriptionIndex:m.getUint32(_+8)});return v},stsd:function(h){return{version:h[0],flags:new Uint8Array(h.subarray(1,4)),sampleDescriptions:Wt(h.subarray(8))}},stsz:function(h){var m=new DataView(h.buffer,h.byteOffset,h.byteLength),y={version:h[0],flags:new Uint8Array(h.subarray(1,4)),sampleSize:m.getUint32(4),entries:[]},v;for(v=12;v>6,sampleHasRedundancy:(h[21]&48)>>4,samplePaddingValue:(h[21]&14)>>1,sampleIsDifferenceSample:!!(h[21]&1),sampleDegradationPriority:m.getUint16(22)}},trun:Kd,"url ":function(h){return{version:h[0],flags:new Uint8Array(h.subarray(1,4))}},vmhd:function(h){var m=new DataView(h.buffer,h.byteOffset,h.byteLength);return{version:h[0],flags:new Uint8Array(h.subarray(1,4)),graphicsmode:m.getUint16(4),opcolor:new Uint16Array([m.getUint16(6),m.getUint16(8),m.getUint16(10)])}}};Wt=function(h){for(var m=0,y=[],v,_,x,k,R,I=new ArrayBuffer(h.length),N=new Uint8Array(I),j=0;j1?m+_:h.byteLength,R=(kn[x]||function(te){return{data:te}})(h.subarray(m+8,k)),R.size=_,R.type=x,y.push(R),m=k;return y},Xn=function(h,m){var y;return m=m||0,y=new Array(m*2+1).join(" "),h.map(function(v,_){return y+v.type+` @@ -480,7 +480,7 @@ browserWorkerPolyFill(self); `)}).join(` `)+(v.boxes?` `+Xn(v.boxes,m+1):"")}).join(` -`)};var sr={inspect:Wt,textify:Xn,parseType:Yr,findBox:Jd,parseTraf:kn.traf,parseTfdt:kn.tfdt,parseHdlr:kn.hdlr,parseTfhd:kn.tfhd,parseTrun:kn.trun,parseSidx:kn.sidx},wt=function(h){for(var m=0,y=String.fromCharCode(h[m]),v="";y!=="\0";)v+=y,m++,y=String.fromCharCode(h[m]);return v+=y,v},Xu={uint8ToCString:wt},nl=Xu.uint8ToCString,eh=u.getUint64,Wr=function(h){var m=4,y=h[0],v,_,x,k,R,I,N,j;if(y===0){v=nl(h.subarray(m)),m+=v.length,_=nl(h.subarray(m)),m+=_.length;var te=new DataView(h.buffer);x=te.getUint32(m),m+=4,R=te.getUint32(m),m+=4,I=te.getUint32(m),m+=4,N=te.getUint32(m),m+=4}else if(y===1){var te=new DataView(h.buffer);x=te.getUint32(m),m+=4,k=eh(h.subarray(m)),m+=8,I=te.getUint32(m),m+=4,N=te.getUint32(m),m+=4,v=nl(h.subarray(m)),m+=v.length,_=nl(h.subarray(m)),m+=_.length}j=new Uint8Array(h.subarray(m,h.byteLength));var ge={scheme_id_uri:v,value:_,timescale:x||1,presentation_time:k,presentation_time_delta:R,event_duration:I,id:N,message_data:j};return xs(y,ge)?ge:void 0},sl=function(h,m,y,v){return h||h===0?h/m:v+y/m},xs=function(h,m){var y=m.scheme_id_uri!=="\0",v=h===0&&rl(m.presentation_time_delta)&&y,_=h===1&&rl(m.presentation_time)&&y;return!(h>1)&&v||_},rl=function(h){return h!==void 0||h!==null},al={parseEmsgBox:Wr,scaleTime:sl},Qr;typeof window<"u"?Qr=window:typeof s<"u"?Qr=s:typeof self<"u"?Qr=self:Qr={};var Yu=Qr,ol=Ha.toUnsigned,Bi=Ha.toHexString,lt=za,Es=$u,th=al,am=Ss,Jy=Kd,ih=Jo,Wu=u.getUint64,nh,sh,rh,ll,ah,Qu,oh,ul=Yu,lh=jr.parseId3Frames;nh=function(h){var m={},y=lt(h,["moov","trak"]);return y.reduce(function(v,_){var x,k,R,I,N;return x=lt(_,["tkhd"])[0],!x||(k=x[0],R=k===0?12:20,I=ol(x[R]<<24|x[R+1]<<16|x[R+2]<<8|x[R+3]),N=lt(_,["mdia","mdhd"])[0],!N)?null:(k=N[0],R=k===0?12:20,v[I]=ol(N[R]<<24|N[R+1]<<16|N[R+2]<<8|N[R+3]),v)},m)},sh=function(h,m){var y;y=lt(m,["moof","traf"]);var v=y.reduce(function(_,x){var k=lt(x,["tfhd"])[0],R=ol(k[4]<<24|k[5]<<16|k[6]<<8|k[7]),I=h[R]||9e4,N=lt(x,["tfdt"])[0],j=new DataView(N.buffer,N.byteOffset,N.byteLength),te;N[0]===1?te=Wu(N.subarray(4,12)):te=j.getUint32(4);let ge;return typeof te=="bigint"?ge=te/ul.BigInt(I):typeof te=="number"&&!isNaN(te)&&(ge=te/I),ge11?(_.codec+=".",_.codec+=Bi(ue[9]),_.codec+=Bi(ue[10]),_.codec+=Bi(ue[11])):_.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(_.codec)?(ue=ge.subarray(28),Le=Es(ue.subarray(4,8)),Le==="esds"&&ue.length>20&&ue[19]!==0?(_.codec+="."+Bi(ue[19]),_.codec+="."+Bi(ue[20]>>>2&63).replace(/^0/,"")):_.codec="mp4a.40.2"):_.codec=_.codec.toLowerCase())}var Pe=lt(v,["mdia","mdhd"])[0];Pe&&(_.timescale=Qu(Pe)),y.push(_)}),y},oh=function(h,m=0){var y=lt(h,["emsg"]);return y.map(v=>{var _=th.parseEmsgBox(new Uint8Array(v)),x=lh(_.message_data);return{cueTime:th.scaleTime(_.presentation_time,_.timescale,_.presentation_time_delta,m),duration:th.scaleTime(_.event_duration,_.timescale),frames:x}})};var pn={findBox:lt,parseType:Es,timescale:nh,startTime:sh,compositionStartTime:rh,videoTrackIds:ll,tracks:ah,getTimescaleFromMediaHeader:Qu,getEmsgID3:oh};const{parseTrun:rr}=sr,{findBox:qa}=pn;var cl=Yu,dl=function(h){var m=qa(h,["moof","traf"]),y=qa(h,["mdat"]),v=[];return y.forEach(function(_,x){var k=m[x];v.push({mdat:_,traf:k})}),v},hl=function(h,m,y){var v=m,_=y.defaultSampleDuration||0,x=y.defaultSampleSize||0,k=y.trackId,R=[];return h.forEach(function(I){var N=rr(I),j=N.samples;j.forEach(function(te){te.duration===void 0&&(te.duration=_),te.size===void 0&&(te.size=x),te.trackId=k,te.dts=v,te.compositionTimeOffset===void 0&&(te.compositionTimeOffset=0),typeof v=="bigint"?(te.pts=v+cl.BigInt(te.compositionTimeOffset),v+=cl.BigInt(te.duration)):(te.pts=v+te.compositionTimeOffset,v+=te.duration)}),R=R.concat(j)}),R},uh={getMdatTrafPairs:dl,parseSamples:hl},ev=Bd.discardEmulationPreventionBytes,om=wu.CaptionStream,Ku=za,ch=Jo,dh=Ss,{getMdatTrafPairs:We,parseSamples:he}=uh,Va=function(h,m){for(var y=h,v=0;v0?ch(j[0]).baseMediaDecodeTime:0,ge=Ku(k,["trun"]),ue,Le;m===N&&ge.length>0&&(ue=he(ge,te,I),Le=Zu(x,ue,N),y[N]||(y[N]={seiNals:[],logs:[]}),y[N].seiNals=y[N].seiNals.concat(Le.seiNals),y[N].logs=y[N].logs.concat(Le.logs))}),y},hh=function(h,m,y){var v;if(m===null)return null;v=Bt(h,m);var _=v[m]||{};return{seiNals:_.seiNals,logs:_.logs,timescale:y}},fh=function(){var h=!1,m,y,v,_,x,k;this.isInitialized=function(){return h},this.init=function(R){m=new om,h=!0,k=R?R.isPartial:!1,m.on("data",function(I){I.startTime=I.startPts/_,I.endTime=I.endPts/_,x.captions.push(I),x.captionStreams[I.stream]=!0}),m.on("log",function(I){x.logs.push(I)})},this.isNewInit=function(R,I){return R&&R.length===0||I&&typeof I=="object"&&Object.keys(I).length===0?!1:v!==R[0]||_!==I[v]},this.parse=function(R,I,N){var j;if(this.isInitialized()){if(!I||!N)return null;if(this.isNewInit(I,N))v=I[0],_=N[v];else if(v===null||!_)return y.push(R),null}else return null;for(;y.length>0;){var te=y.shift();this.parse(te,I,N)}return j=hh(R,v,_),j&&j.logs&&(x.logs=x.logs.concat(j.logs)),j===null||!j.seiNals?x.logs.length?{logs:x.logs,captions:[],captionStreams:[]}:null:(this.pushNals(j.seiNals),this.flushStream(),x)},this.pushNals=function(R){if(!this.isInitialized()||!R||R.length===0)return null;R.forEach(function(I){m.push(I)})},this.flushStream=function(){if(!this.isInitialized())return null;k?m.partialFlush():m.flush()},this.clearParsedCaptions=function(){x.captions=[],x.captionStreams={},x.logs=[]},this.resetCaptionStream=function(){if(!this.isInitialized())return null;m.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){y=[],v=null,_=null,x?this.clearParsedCaptions():x={captions:[],captionStreams:{},logs:[]},this.resetCaptionStream()},this.reset()},lm=fh;const{parseTfdt:ph}=sr,ar=za,{getTimescaleFromMediaHeader:mh}=pn,{parseSamples:gh,getMdatTrafPairs:yh}=uh;var ut=function(){let h=9e4;this.init=function(m){const y=ar(m,["moov","trak","mdia","mdhd"])[0];y&&(h=mh(y))},this.parseSegment=function(m){const y=[],v=yh(m);let _=0;return v.forEach(function(x){const k=x.mdat,R=x.traf,I=ar(R,["tfdt"])[0],N=ar(R,["tfhd"])[0],j=ar(R,["trun"]);if(I&&(_=ph(I).baseMediaDecodeTime),j.length&&N){const te=gh(j,_,N);let ge=0;te.forEach(function(ue){const Le="utf-8",Pe=new TextDecoder(Le),qt=k.slice(ge,ge+ue.size);if(ar(qt,["vtte"])[0]){ge+=ue.size;return}ar(qt,["vttc"]).forEach(function(lr){const Zr=ar(lr,["payl"])[0],Xa=ar(lr,["sttg"])[0],Ya=ue.pts/h,Wa=(ue.pts+ue.duration)/h;let bt,Qa;if(Zr)try{bt=Pe.decode(Zr)}catch(Yi){console.error(Yi)}if(Xa)try{Qa=Pe.decode(Xa)}catch(Yi){console.error(Yi)}ue.duration&&bt&&y.push({cueText:bt,start:Ya,end:Wa,settings:Qa})}),ge+=ue.size})}}),y}},fl=zo,$a=function(h){var m=h[1]&31;return m<<=8,m|=h[2],m},On=function(h){return!!(h[1]&64)},Yn=function(h){var m=0;return(h[3]&48)>>>4>1&&(m+=h[4]+1),m},Rn=function(h,m){var y=$a(h);return y===0?"pat":y===m?"pmt":m?"pes":null},vh=function(h){var m=On(h),y=4+Yn(h);return m&&(y+=h[y]+1),(h[y+10]&31)<<8|h[y+11]},Ga=function(h){var m={},y=On(h),v=4+Yn(h);if(y&&(v+=h[v]+1),!!(h[v+5]&1)){var _,x,k;_=(h[v+1]&15)<<8|h[v+2],x=3+_-4,k=(h[v+10]&15)<<8|h[v+11];for(var R=12+k;R=h.byteLength)return null;var v=null,_;return _=h[y+7],_&192&&(v={},v.pts=(h[y+9]&14)<<27|(h[y+10]&255)<<20|(h[y+11]&254)<<12|(h[y+12]&255)<<5|(h[y+13]&254)>>>3,v.pts*=4,v.pts+=(h[y+13]&6)>>>1,v.dts=v.pts,_&64&&(v.dts=(h[y+14]&14)<<27|(h[y+15]&255)<<20|(h[y+16]&254)<<12|(h[y+17]&255)<<5|(h[y+18]&254)>>>3,v.dts*=4,v.dts+=(h[y+18]&6)>>>1)),v},ml=function(h){switch(h){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}},Ju=function(h){for(var m=4+Yn(h),y=h.subarray(m),v=0,_=0,x=!1,k;_3&&(k=ml(y[_+3]&31),k==="slice_layer_without_partitioning_rbsp_idr"&&(x=!0)),x},um={parseType:Rn,parsePat:vh,parsePmt:Ga,parsePayloadUnitStartIndicator:On,parsePesType:bh,parsePesTime:pl,videoPacketContainsKeyFrame:Ju},_h=zo,Kr=zd.handleRollover,ct={};ct.ts=um,ct.aac=Fu;var or=ot.ONE_SECOND_IN_TS,ai=188,mn=71,Th=function(h,m){for(var y=0,v=ai,_,x;v=0;){if(h[v]===mn&&(h[_]===mn||_===h.byteLength)){switch(x=h.subarray(v,_),k=ct.ts.parseType(x,m.pid),k){case"pes":R=ct.ts.parsePesType(x,m.table),I=ct.ts.parsePayloadUnitStartIndicator(x),R==="audio"&&I&&(N=ct.ts.parsePesTime(x),N&&(N.type="audio",y.audio.push(N),j=!0));break}if(j)break;v-=ai,_-=ai;continue}v--,_--}},cm=function(h,m,y){for(var v=0,_=ai,x,k,R,I,N,j,te,ge,ue=!1,Le={data:[],size:0};_=0;){if(h[v]===mn&&h[_]===mn){switch(x=h.subarray(v,_),k=ct.ts.parseType(x,m.pid),k){case"pes":R=ct.ts.parsePesType(x,m.table),I=ct.ts.parsePayloadUnitStartIndicator(x),R==="video"&&I&&(N=ct.ts.parsePesTime(x),N&&(N.type="video",y.video.push(N),ue=!0));break}if(ue)break;v-=ai,_-=ai;continue}v--,_--}},dm=function(h,m){if(h.audio&&h.audio.length){var y=m;(typeof y>"u"||isNaN(y))&&(y=h.audio[0].dts),h.audio.forEach(function(x){x.dts=Kr(x.dts,y),x.pts=Kr(x.pts,y),x.dtsTime=x.dts/or,x.ptsTime=x.pts/or})}if(h.video&&h.video.length){var v=m;if((typeof v>"u"||isNaN(v))&&(v=h.video[0].dts),h.video.forEach(function(x){x.dts=Kr(x.dts,v),x.pts=Kr(x.pts,v),x.dtsTime=x.dts/or,x.ptsTime=x.pts/or}),h.firstKeyFrame){var _=h.firstKeyFrame;_.dts=Kr(_.dts,v),_.pts=Kr(_.pts,v),_.dtsTime=_.dts/or,_.ptsTime=_.pts/or}}},tv=function(h){for(var m=!1,y=0,v=null,_=null,x=0,k=0,R;h.length-k>=3;){var I=ct.aac.parseType(h,k);switch(I){case"timed-metadata":if(h.length-k<10){m=!0;break}if(x=ct.aac.parseId3TagSize(h,k),x>h.length){m=!0;break}_===null&&(R=h.subarray(k,k+x),_=ct.aac.parseAacTimestamp(R)),k+=x;break;case"audio":if(h.length-k<7){m=!0;break}if(x=ct.aac.parseAdtsSize(h,k),x>h.length){m=!0;break}v===null&&(R=h.subarray(k,k+x),v=ct.aac.parseSampleRate(R)),y++,k+=x;break;default:k++;break}if(m)return null}if(v===null||_===null)return null;var N=or/v,j={audio:[{type:"audio",dts:_,pts:_},{type:"audio",dts:_+y*1024*N,pts:_+y*1024*N}]};return j},hm=function(h){var m={pid:null,table:null},y={};Th(h,m);for(var v in m.table)if(m.table.hasOwnProperty(v)){var _=m.table[v];switch(_){case _h.H264_STREAM_TYPE:y.video=[],cm(h,m,y),y.video.length===0&&delete y.video;break;case _h.ADTS_STREAM_TYPE:y.audio=[],Sh(h,m,y),y.audio.length===0&&delete y.audio;break}}return y},fm=function(h,m){var y=ct.aac.isLikelyAacData(h),v;return y?v=tv(h):v=hm(h),!v||!v.audio&&!v.video?null:(dm(v,m),v)},pm={inspect:fm,parseAudioPes_:Sh};const xh=function(h,m){m.on("data",function(y){const v=y.initSegment;y.initSegment={data:v.buffer,byteOffset:v.byteOffset,byteLength:v.byteLength};const _=y.data;y.data=_.buffer,h.postMessage({action:"data",segment:y,byteOffset:_.byteOffset,byteLength:_.byteLength},[y.data])}),m.on("done",function(y){h.postMessage({action:"done"})}),m.on("gopInfo",function(y){h.postMessage({action:"gopInfo",gopInfo:y})}),m.on("videoSegmentTimingInfo",function(y){const v={start:{decode:ot.videoTsToSeconds(y.start.dts),presentation:ot.videoTsToSeconds(y.start.pts)},end:{decode:ot.videoTsToSeconds(y.end.dts),presentation:ot.videoTsToSeconds(y.end.pts)},baseMediaDecodeTime:ot.videoTsToSeconds(y.baseMediaDecodeTime)};y.prependedContentDuration&&(v.prependedContentDuration=ot.videoTsToSeconds(y.prependedContentDuration)),h.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:v})}),m.on("audioSegmentTimingInfo",function(y){const v={start:{decode:ot.videoTsToSeconds(y.start.dts),presentation:ot.videoTsToSeconds(y.start.pts)},end:{decode:ot.videoTsToSeconds(y.end.dts),presentation:ot.videoTsToSeconds(y.end.pts)},baseMediaDecodeTime:ot.videoTsToSeconds(y.baseMediaDecodeTime)};y.prependedContentDuration&&(v.prependedContentDuration=ot.videoTsToSeconds(y.prependedContentDuration)),h.postMessage({action:"audioSegmentTimingInfo",audioSegmentTimingInfo:v})}),m.on("id3Frame",function(y){h.postMessage({action:"id3Frame",id3Frame:y})}),m.on("caption",function(y){h.postMessage({action:"caption",caption:y})}),m.on("trackinfo",function(y){h.postMessage({action:"trackinfo",trackInfo:y})}),m.on("audioTimingInfo",function(y){h.postMessage({action:"audioTimingInfo",audioTimingInfo:{start:ot.videoTsToSeconds(y.start),end:ot.videoTsToSeconds(y.end)}})}),m.on("videoTimingInfo",function(y){h.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:ot.videoTsToSeconds(y.start),end:ot.videoTsToSeconds(y.end)}})}),m.on("log",function(y){h.postMessage({action:"log",log:y})})};class Eh{constructor(m,y){this.options=y||{},this.self=m,this.init()}init(){this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new im.Transmuxer(this.options),xh(this.self,this.transmuxer)}pushMp4Captions(m){this.captionParser||(this.captionParser=new lm,this.captionParser.init());const y=new Uint8Array(m.data,m.byteOffset,m.byteLength),v=this.captionParser.parse(y,m.trackIds,m.timescales);this.self.postMessage({action:"mp4Captions",captions:v&&v.captions||[],logs:v&&v.logs||[],data:y.buffer},[y.buffer])}initMp4WebVttParser(m){this.webVttParser||(this.webVttParser=new ut);const y=new Uint8Array(m.data,m.byteOffset,m.byteLength);this.webVttParser.init(y)}getMp4WebVttText(m){this.webVttParser||(this.webVttParser=new ut);const y=new Uint8Array(m.data,m.byteOffset,m.byteLength),v=this.webVttParser.parseSegment(y);this.self.postMessage({action:"getMp4WebVttText",mp4VttCues:v||[],data:y.buffer},[y.buffer])}probeMp4StartTime({timescales:m,data:y}){const v=pn.startTime(m,y);this.self.postMessage({action:"probeMp4StartTime",startTime:v,data:y},[y.buffer])}probeMp4Tracks({data:m}){const y=pn.tracks(m);this.self.postMessage({action:"probeMp4Tracks",tracks:y,data:m},[m.buffer])}probeEmsgID3({data:m,offset:y}){const v=pn.getEmsgID3(m,y);this.self.postMessage({action:"probeEmsgID3",id3Frames:v,emsgData:m},[m.buffer])}probeTs({data:m,baseStartTime:y}){const v=typeof y=="number"&&!isNaN(y)?y*ot.ONE_SECOND_IN_TS:void 0,_=pm.inspect(m,v);let x=null;_&&(x={hasVideo:_.video&&_.video.length===2||!1,hasAudio:_.audio&&_.audio.length===2||!1},x.hasVideo&&(x.videoStart=_.video[0].ptsTime),x.hasAudio&&(x.audioStart=_.audio[0].ptsTime)),this.self.postMessage({action:"probeTs",result:x,data:m},[m.buffer])}clearAllMp4Captions(){this.captionParser&&this.captionParser.clearAllCaptions()}clearParsedMp4Captions(){this.captionParser&&this.captionParser.clearParsedCaptions()}push(m){const y=new Uint8Array(m.data,m.byteOffset,m.byteLength);this.transmuxer.push(y)}reset(){this.transmuxer.reset()}setTimestampOffset(m){const y=m.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(ot.secondsToVideoTs(y)))}setAudioAppendStart(m){this.transmuxer.setAudioAppendStart(Math.ceil(ot.secondsToVideoTs(m.appendStart)))}setRemux(m){this.transmuxer.setRemux(m.remux)}flush(m){this.transmuxer.flush(),self.postMessage({action:"done",type:"transmuxed"})}endTimeline(){this.transmuxer.endTimeline(),self.postMessage({action:"endedtimeline",type:"transmuxed"})}alignGopsWith(m){this.transmuxer.alignGopsWith(m.gopsToAlignWith.slice())}}self.onmessage=function(h){if(h.data.action==="init"&&h.data.options){this.messageHandlers=new Eh(self,h.data.options);return}this.messageHandlers||(this.messageHandlers=new Eh(self)),h.data&&h.data.action&&h.data.action!=="init"&&this.messageHandlers[h.data.action]&&this.messageHandlers[h.data.action](h.data)}}));var W4=qS(Y4);const Q4=(s,e,i)=>{const{type:r,initSegment:o,captions:u,captionStreams:c,metadata:p,videoFrameDtsTime:g,videoFramePtsTime:b}=s.data.segment;e.buffer.push({captions:u,captionStreams:c,metadata:p});const S=s.data.segment.boxes||{data:s.data.segment.data},E={type:r,data:new Uint8Array(S.data,S.data.byteOffset,S.data.byteLength),initSegment:new Uint8Array(o.data,o.byteOffset,o.byteLength)};typeof g<"u"&&(E.videoFrameDtsTime=g),typeof b<"u"&&(E.videoFramePtsTime=b),i(E)},K4=({transmuxedData:s,callback:e})=>{s.buffer=[],e(s)},Z4=(s,e)=>{e.gopInfo=s.data.gopInfo},GS=s=>{const{transmuxer:e,bytes:i,audioAppendStart:r,gopsToAlignWith:o,remux:u,onData:c,onTrackInfo:p,onAudioTimingInfo:g,onVideoTimingInfo:b,onVideoSegmentTimingInfo:S,onAudioSegmentTimingInfo:E,onId3:A,onCaptions:M,onDone:U,onEndedTimeline:D,onTransmuxerLog:z,isEndOfTimeline:H,segment:Y,triggerSegmentEventFn:V}=s,Q={buffer:[]};let Z=H;const W=ee=>{e.currentTransmux===s&&(ee.data.action==="data"&&Q4(ee,Q,c),ee.data.action==="trackinfo"&&p(ee.data.trackInfo),ee.data.action==="gopInfo"&&Z4(ee,Q),ee.data.action==="audioTimingInfo"&&g(ee.data.audioTimingInfo),ee.data.action==="videoTimingInfo"&&b(ee.data.videoTimingInfo),ee.data.action==="videoSegmentTimingInfo"&&S(ee.data.videoSegmentTimingInfo),ee.data.action==="audioSegmentTimingInfo"&&E(ee.data.audioSegmentTimingInfo),ee.data.action==="id3Frame"&&A([ee.data.id3Frame],ee.data.id3Frame.dispatchType),ee.data.action==="caption"&&M(ee.data.caption),ee.data.action==="endedtimeline"&&(Z=!1,D()),ee.data.action==="log"&&z(ee.data.log),ee.data.type==="transmuxed"&&(Z||(e.onmessage=null,K4({transmuxedData:Q,callback:U}),XS(e))))},G=()=>{const ee={message:"Received an error message from the transmuxer worker",metadata:{errorType:$.Error.StreamingFailedToTransmuxSegment,segmentInfo:Po({segment:Y})}};U(null,ee)};if(e.onmessage=W,e.onerror=G,r&&e.postMessage({action:"setAudioAppendStart",appendStart:r}),Array.isArray(o)&&e.postMessage({action:"alignGopsWith",gopsToAlignWith:o}),typeof u<"u"&&e.postMessage({action:"setRemux",remux:u}),i.byteLength){const ee=i instanceof ArrayBuffer?i:i.buffer,oe=i instanceof ArrayBuffer?0:i.byteOffset;V({type:"segmenttransmuxingstart",segment:Y}),e.postMessage({action:"push",data:ee,byteOffset:oe,byteLength:i.byteLength},[ee])}H&&e.postMessage({action:"endTimeline"}),e.postMessage({action:"flush"})},XS=s=>{s.currentTransmux=null,s.transmuxQueue.length&&(s.currentTransmux=s.transmuxQueue.shift(),typeof s.currentTransmux=="function"?s.currentTransmux():GS(s.currentTransmux))},YS=(s,e)=>{s.postMessage({action:e}),XS(s)},WS=(s,e)=>{if(!e.currentTransmux){e.currentTransmux=s,YS(e,s);return}e.transmuxQueue.push(YS.bind(null,e,s))},J4=s=>{WS("reset",s)},eM=s=>{WS("endTimeline",s)},QS=s=>{if(!s.transmuxer.currentTransmux){s.transmuxer.currentTransmux=s,GS(s);return}s.transmuxer.transmuxQueue.push(s)};var wy={reset:J4,endTimeline:eM,transmux:QS,createTransmuxer:s=>{const e=new W4;e.currentTransmux=null,e.transmuxQueue=[];const i=e.terminate;return e.terminate=()=>(e.currentTransmux=null,e.transmuxQueue.length=0,i.call(e)),e.postMessage({action:"init",options:s}),e}};const _u=function(s){const e=s.transmuxer,i=s.endAction||s.action,r=s.callback,o=Ft({},s,{endAction:null,transmuxer:null,callback:null}),u=c=>{c.data.action===i&&(e.removeEventListener("message",u),c.data.data&&(c.data.data=new Uint8Array(c.data.data,s.byteOffset||0,s.byteLength||c.data.data.byteLength),s.data&&(s.data=c.data.data)),r(c.data))};if(e.addEventListener("message",u),s.data){const c=s.data instanceof ArrayBuffer;o.byteOffset=c?0:s.data.byteOffset,o.byteLength=s.data.byteLength;const p=[c?s.data:s.data.buffer];e.postMessage(o,p)}else e.postMessage(o)},zs={FAILURE:2,TIMEOUT:-101,ABORTED:-102},KS="wvtt",ky=s=>{s.forEach(e=>{e.abort()})},tM=s=>({bandwidth:s.bandwidth,bytesReceived:s.bytesReceived||0,roundTripTime:s.roundTripTime||0}),iM=s=>{const e=s.target,r={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-e.requestTime||0};return r.bytesReceived=s.loaded,r.bandwidth=Math.floor(r.bytesReceived/r.roundTripTime*8*1e3),r},Oy=(s,e)=>{const{requestType:i}=e,r=No({requestType:i,request:e,error:s});return e.timedout?{status:e.status,message:"HLS request timed-out at URL: "+e.uri,code:zs.TIMEOUT,xhr:e,metadata:r}:e.aborted?{status:e.status,message:"HLS request aborted at URL: "+e.uri,code:zs.ABORTED,xhr:e,metadata:r}:s?{status:e.status,message:"HLS request errored at URL: "+e.uri,code:zs.FAILURE,xhr:e,metadata:r}:e.responseType==="arraybuffer"&&e.response.byteLength===0?{status:e.status,message:"Empty HLS response at URL: "+e.uri,code:zs.FAILURE,xhr:e,metadata:r}:null},ZS=(s,e,i,r)=>(o,u)=>{const c=u.response,p=Oy(o,u);if(p)return i(p,s);if(c.byteLength!==16)return i({status:u.status,message:"Invalid HLS key at URL: "+u.uri,code:zs.FAILURE,xhr:u},s);const g=new DataView(c),b=new Uint32Array([g.getUint32(0),g.getUint32(4),g.getUint32(8),g.getUint32(12)]);for(let E=0;E{e===KS&&s.transmuxer.postMessage({action:"initMp4WebVttParser",data:s.map.bytes})},sM=(s,e,i)=>{e===KS&&_u({action:"getMp4WebVttText",data:s.bytes,transmuxer:s.transmuxer,callback:({data:r,mp4VttCues:o})=>{s.bytes=r,i(null,s,{mp4VttCues:o})}})},JS=(s,e)=>{const i=m0(s.map.bytes);if(i!=="mp4"){const r=s.map.resolvedUri||s.map.uri,o=i||"unknown";return e({internal:!0,message:`Found unsupported ${o} container for initialization segment at URL: ${r}`,code:zs.FAILURE,metadata:{mediaType:o}})}_u({action:"probeMp4Tracks",data:s.map.bytes,transmuxer:s.transmuxer,callback:({tracks:r,data:o})=>(s.map.bytes=o,r.forEach(function(u){s.map.tracks=s.map.tracks||{},!s.map.tracks[u.type]&&(s.map.tracks[u.type]=u,typeof u.id=="number"&&u.timescale&&(s.map.timescales=s.map.timescales||{},s.map.timescales[u.id]=u.timescale),u.type==="text"&&nM(s,u.codec))}),e(null))})},rM=({segment:s,finishProcessingFn:e,triggerSegmentEventFn:i})=>(r,o)=>{const u=Oy(r,o);if(u)return e(u,s);const c=new Uint8Array(o.response);if(i({type:"segmentloaded",segment:s}),s.map.key)return s.map.encryptedBytes=c,e(null,s);s.map.bytes=c,JS(s,function(p){if(p)return p.xhr=o,p.status=o.status,e(p,s);e(null,s)})},aM=({segment:s,finishProcessingFn:e,responseType:i,triggerSegmentEventFn:r})=>(o,u)=>{const c=Oy(o,u);if(c)return e(c,s);r({type:"segmentloaded",segment:s});const p=i==="arraybuffer"||!u.responseText?u.response:G4(u.responseText.substring(s.lastReachedChar||0));return s.stats=tM(u),s.key?s.encryptedBytes=new Uint8Array(p):s.bytes=new Uint8Array(p),e(null,s)},oM=({segment:s,bytes:e,trackInfoFn:i,timingInfoFn:r,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:u,id3Fn:c,captionsFn:p,isEndOfTimeline:g,endedTimelineFn:b,dataFn:S,doneFn:E,onTransmuxerLog:A,triggerSegmentEventFn:M})=>{const U=s.map&&s.map.tracks||{},D=!!(U.audio&&U.video);let z=r.bind(null,s,"audio","start");const H=r.bind(null,s,"audio","end");let Y=r.bind(null,s,"video","start");const V=r.bind(null,s,"video","end"),Q=()=>QS({bytes:e,transmuxer:s.transmuxer,audioAppendStart:s.audioAppendStart,gopsToAlignWith:s.gopsToAlignWith,remux:D,onData:Z=>{Z.type=Z.type==="combined"?"video":Z.type,S(s,Z)},onTrackInfo:Z=>{i&&(D&&(Z.isMuxed=!0),i(s,Z))},onAudioTimingInfo:Z=>{z&&typeof Z.start<"u"&&(z(Z.start),z=null),H&&typeof Z.end<"u"&&H(Z.end)},onVideoTimingInfo:Z=>{Y&&typeof Z.start<"u"&&(Y(Z.start),Y=null),V&&typeof Z.end<"u"&&V(Z.end)},onVideoSegmentTimingInfo:Z=>{const W={pts:{start:Z.start.presentation,end:Z.end.presentation},dts:{start:Z.start.decode,end:Z.end.decode}};M({type:"segmenttransmuxingtiminginfoavailable",segment:s,timingInfo:W}),o(Z)},onAudioSegmentTimingInfo:Z=>{const W={pts:{start:Z.start.pts,end:Z.end.pts},dts:{start:Z.start.dts,end:Z.end.dts}};M({type:"segmenttransmuxingtiminginfoavailable",segment:s,timingInfo:W}),u(Z)},onId3:(Z,W)=>{c(s,Z,W)},onCaptions:Z=>{p(s,[Z])},isEndOfTimeline:g,onEndedTimeline:()=>{b()},onTransmuxerLog:A,onDone:(Z,W)=>{E&&(Z.type=Z.type==="combined"?"video":Z.type,M({type:"segmenttransmuxingcomplete",segment:s}),E(W,s,Z))},segment:s,triggerSegmentEventFn:M});_u({action:"probeTs",transmuxer:s.transmuxer,data:e,baseStartTime:s.baseStartTime,callback:Z=>{s.bytes=e=Z.data;const W=Z.result;W&&(i(s,{hasAudio:W.hasAudio,hasVideo:W.hasVideo,isMuxed:D}),i=null),Q()}})},ex=({segment:s,bytes:e,trackInfoFn:i,timingInfoFn:r,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:u,id3Fn:c,captionsFn:p,isEndOfTimeline:g,endedTimelineFn:b,dataFn:S,doneFn:E,onTransmuxerLog:A,triggerSegmentEventFn:M})=>{let U=new Uint8Array(e);if(NR(U)){s.isFmp4=!0;const{tracks:D}=s.map;if(D.text&&(!D.audio||!D.video)){S(s,{data:U,type:"text"}),sM(s,D.text.codec,E);return}const H={isFmp4:!0,hasVideo:!!D.video,hasAudio:!!D.audio};D.audio&&D.audio.codec&&D.audio.codec!=="enca"&&(H.audioCodec=D.audio.codec),D.video&&D.video.codec&&D.video.codec!=="encv"&&(H.videoCodec=D.video.codec),D.video&&D.audio&&(H.isMuxed=!0),i(s,H);const Y=(V,Q)=>{S(s,{data:U,type:H.hasAudio&&!H.isMuxed?"audio":"video"}),Q&&Q.length&&c(s,Q),V&&V.length&&p(s,V),E(null,s,{})};_u({action:"probeMp4StartTime",timescales:s.map.timescales,data:U,transmuxer:s.transmuxer,callback:({data:V,startTime:Q})=>{e=V.buffer,s.bytes=U=V,H.hasAudio&&!H.isMuxed&&r(s,"audio","start",Q),H.hasVideo&&r(s,"video","start",Q),_u({action:"probeEmsgID3",data:U,transmuxer:s.transmuxer,offset:Q,callback:({emsgData:Z,id3Frames:W})=>{if(e=Z.buffer,s.bytes=U=Z,!D.video||!Z.byteLength||!s.transmuxer){Y(void 0,W);return}_u({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:s.transmuxer,data:U,timescales:s.map.timescales,trackIds:[D.video.id],callback:G=>{e=G.data.buffer,s.bytes=U=G.data,G.logs.forEach(function(ee){A(pt(ee,{stream:"mp4CaptionParser"}))}),Y(G.captions,W)}})}})}});return}if(!s.transmuxer){E(null,s,{});return}if(typeof s.container>"u"&&(s.container=m0(U)),s.container!=="ts"&&s.container!=="aac"){i(s,{hasAudio:!1,hasVideo:!1}),E(null,s,{});return}oM({segment:s,bytes:e,trackInfoFn:i,timingInfoFn:r,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:u,id3Fn:c,captionsFn:p,isEndOfTimeline:g,endedTimelineFn:b,dataFn:S,doneFn:E,onTransmuxerLog:A,triggerSegmentEventFn:M})},tx=function({id:s,key:e,encryptedBytes:i,decryptionWorker:r,segment:o,doneFn:u},c){const p=b=>{if(b.data.source===s){r.removeEventListener("message",p);const S=b.data.decrypted;c(new Uint8Array(S.bytes,S.byteOffset,S.byteLength))}};r.onerror=()=>{const b="An error occurred in the decryption worker",S=Po({segment:o}),E={message:b,metadata:{error:new Error(b),errorType:$.Error.StreamingFailedToDecryptSegment,segmentInfo:S,keyInfo:{uri:o.key.resolvedUri||o.map.key.resolvedUri}}};u(E,o)},r.addEventListener("message",p);let g;e.bytes.slice?g=e.bytes.slice():g=new Uint32Array(Array.prototype.slice.call(e.bytes)),r.postMessage(NS({source:s,encrypted:i,key:g,iv:e.iv}),[i.buffer,g.buffer])},lM=({decryptionWorker:s,segment:e,trackInfoFn:i,timingInfoFn:r,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:u,id3Fn:c,captionsFn:p,isEndOfTimeline:g,endedTimelineFn:b,dataFn:S,doneFn:E,onTransmuxerLog:A,triggerSegmentEventFn:M})=>{M({type:"segmentdecryptionstart"}),tx({id:e.requestId,key:e.key,encryptedBytes:e.encryptedBytes,decryptionWorker:s,segment:e,doneFn:E},U=>{e.bytes=U,M({type:"segmentdecryptioncomplete",segment:e}),ex({segment:e,bytes:e.bytes,trackInfoFn:i,timingInfoFn:r,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:u,id3Fn:c,captionsFn:p,isEndOfTimeline:g,endedTimelineFn:b,dataFn:S,doneFn:E,onTransmuxerLog:A,triggerSegmentEventFn:M})})},uM=({activeXhrs:s,decryptionWorker:e,trackInfoFn:i,timingInfoFn:r,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:u,id3Fn:c,captionsFn:p,isEndOfTimeline:g,endedTimelineFn:b,dataFn:S,doneFn:E,onTransmuxerLog:A,triggerSegmentEventFn:M})=>{let U=0,D=!1;return(z,H)=>{if(!D){if(z)return D=!0,ky(s),E(z,H);if(U+=1,U===s.length){const Y=function(){if(H.encryptedBytes)return lM({decryptionWorker:e,segment:H,trackInfoFn:i,timingInfoFn:r,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:u,id3Fn:c,captionsFn:p,isEndOfTimeline:g,endedTimelineFn:b,dataFn:S,doneFn:E,onTransmuxerLog:A,triggerSegmentEventFn:M});ex({segment:H,bytes:H.bytes,trackInfoFn:i,timingInfoFn:r,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:u,id3Fn:c,captionsFn:p,isEndOfTimeline:g,endedTimelineFn:b,dataFn:S,doneFn:E,onTransmuxerLog:A,triggerSegmentEventFn:M})};if(H.endOfAllRequests=Date.now(),H.map&&H.map.encryptedBytes&&!H.map.bytes)return M({type:"segmentdecryptionstart",segment:H}),tx({decryptionWorker:e,id:H.requestId+"-init",encryptedBytes:H.map.encryptedBytes,key:H.map.key,segment:H,doneFn:E},V=>{H.map.bytes=V,M({type:"segmentdecryptioncomplete",segment:H}),JS(H,Q=>{if(Q)return ky(s),E(Q,H);Y()})});Y()}}}},cM=({loadendState:s,abortFn:e})=>i=>{i.target.aborted&&e&&!s.calledAbortFn&&(e(),s.calledAbortFn=!0)},dM=({segment:s,progressFn:e,trackInfoFn:i,timingInfoFn:r,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:u,id3Fn:c,captionsFn:p,isEndOfTimeline:g,endedTimelineFn:b,dataFn:S})=>E=>{if(!E.target.aborted)return s.stats=pt(s.stats,iM(E)),!s.stats.firstBytesReceivedAt&&s.stats.bytesReceived&&(s.stats.firstBytesReceivedAt=Date.now()),e(E,s)},hM=({xhr:s,xhrOptions:e,decryptionWorker:i,segment:r,abortFn:o,progressFn:u,trackInfoFn:c,timingInfoFn:p,videoSegmentTimingInfoFn:g,audioSegmentTimingInfoFn:b,id3Fn:S,captionsFn:E,isEndOfTimeline:A,endedTimelineFn:M,dataFn:U,doneFn:D,onTransmuxerLog:z,triggerSegmentEventFn:H})=>{const Y=[],V=uM({activeXhrs:Y,decryptionWorker:i,trackInfoFn:c,timingInfoFn:p,videoSegmentTimingInfoFn:g,audioSegmentTimingInfoFn:b,id3Fn:S,captionsFn:E,isEndOfTimeline:A,endedTimelineFn:M,dataFn:U,doneFn:D,onTransmuxerLog:z,triggerSegmentEventFn:H});if(r.key&&!r.key.bytes){const ee=[r.key];r.map&&!r.map.bytes&&r.map.key&&r.map.key.resolvedUri===r.key.resolvedUri&&ee.push(r.map.key);const oe=pt(e,{uri:r.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),_e=ZS(r,ee,V,H),fe={uri:r.key.resolvedUri};H({type:"segmentkeyloadstart",segment:r,keyInfo:fe});const xe=s(oe,_e);Y.push(xe)}if(r.map&&!r.map.bytes){if(r.map.key&&(!r.key||r.key.resolvedUri!==r.map.key.resolvedUri)){const xe=pt(e,{uri:r.map.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),ve=ZS(r,[r.map.key],V,H),Ne={uri:r.map.key.resolvedUri};H({type:"segmentkeyloadstart",segment:r,keyInfo:Ne});const at=s(xe,ve);Y.push(at)}const oe=pt(e,{uri:r.map.resolvedUri,responseType:"arraybuffer",headers:Cy(r.map),requestType:"segment-media-initialization"}),_e=rM({segment:r,finishProcessingFn:V,triggerSegmentEventFn:H});H({type:"segmentloadstart",segment:r});const fe=s(oe,_e);Y.push(fe)}const Q=pt(e,{uri:r.part&&r.part.resolvedUri||r.resolvedUri,responseType:"arraybuffer",headers:Cy(r),requestType:"segment"}),Z=aM({segment:r,finishProcessingFn:V,responseType:Q.responseType,triggerSegmentEventFn:H});H({type:"segmentloadstart",segment:r});const W=s(Q,Z);W.addEventListener("progress",dM({segment:r,progressFn:u,trackInfoFn:c,timingInfoFn:p,videoSegmentTimingInfoFn:g,audioSegmentTimingInfoFn:b,id3Fn:S,captionsFn:E,isEndOfTimeline:A,endedTimelineFn:M,dataFn:U})),Y.push(W);const G={};return Y.forEach(ee=>{ee.addEventListener("loadend",cM({loadendState:G,abortFn:o}))}),()=>ky(Y)},Np=$n("PlaylistSelector"),ix=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||""})},Tu=function(s,e){if(!s)return"";const i=P.getComputedStyle(s);return i?i[e]:""},Su=function(s,e){const i=s.slice();s.sort(function(r,o){const u=e(r,o);return u===0?i.indexOf(r)-i.indexOf(o):u})},Ry=function(s,e){let i,r;return s.attributes.BANDWIDTH&&(i=s.attributes.BANDWIDTH),i=i||P.Number.MAX_VALUE,e.attributes.BANDWIDTH&&(r=e.attributes.BANDWIDTH),r=r||P.Number.MAX_VALUE,i-r},fM=function(s,e){let i,r;return s.attributes.RESOLUTION&&s.attributes.RESOLUTION.width&&(i=s.attributes.RESOLUTION.width),i=i||P.Number.MAX_VALUE,e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width&&(r=e.attributes.RESOLUTION.width),r=r||P.Number.MAX_VALUE,i===r&&s.attributes.BANDWIDTH&&e.attributes.BANDWIDTH?s.attributes.BANDWIDTH-e.attributes.BANDWIDTH:i-r};let nx=function(s){const{main:e,bandwidth:i,playerWidth:r,playerHeight:o,playerObjectFit:u,limitRenditionByPlayerDimensions:c,playlistController:p}=s;if(!e)return;const g={bandwidth:i,width:r,height:o,limitRenditionByPlayerDimensions:c};let b=e.playlists;un.isAudioOnly(e)&&(b=p.getAudioTrackPlaylists_(),g.audioOnly=!0);let S=b.map(G=>{let ee;const oe=G.attributes&&G.attributes.RESOLUTION&&G.attributes.RESOLUTION.width,_e=G.attributes&&G.attributes.RESOLUTION&&G.attributes.RESOLUTION.height;return ee=G.attributes&&G.attributes.BANDWIDTH,ee=ee||P.Number.MAX_VALUE,{bandwidth:ee,width:oe,height:_e,playlist:G}});Su(S,(G,ee)=>G.bandwidth-ee.bandwidth),S=S.filter(G=>!un.isIncompatible(G.playlist));let E=S.filter(G=>un.isEnabled(G.playlist));E.length||(E=S.filter(G=>!un.isDisabled(G.playlist)));const A=E.filter(G=>G.bandwidth*fi.BANDWIDTH_VARIANCEG.bandwidth===M.bandwidth)[0];if(c===!1){const G=U||E[0]||S[0];if(G&&G.playlist){let ee="sortedPlaylistReps";return U&&(ee="bandwidthBestRep"),E[0]&&(ee="enabledPlaylistReps"),Np(`choosing ${ix(G)} using ${ee} with options`,g),G.playlist}return Np("could not choose a playlist with options",g),null}const D=A.filter(G=>G.width&&G.height);Su(D,(G,ee)=>G.width-ee.width);const z=D.filter(G=>G.width===r&&G.height===o);M=z[z.length-1];const H=z.filter(G=>G.bandwidth===M.bandwidth)[0];let Y,V,Q;H||(Y=D.filter(G=>u==="cover"?G.width>r&&G.height>o:G.width>r||G.height>o),V=Y.filter(G=>G.width===Y[0].width&&G.height===Y[0].height),M=V[V.length-1],Q=V.filter(G=>G.bandwidth===M.bandwidth)[0]);let Z;if(p.leastPixelDiffSelector){const G=D.map(ee=>(ee.pixelDiff=Math.abs(ee.width-r)+Math.abs(ee.height-o),ee));Su(G,(ee,oe)=>ee.pixelDiff===oe.pixelDiff?oe.bandwidth-ee.bandwidth:ee.pixelDiff-oe.pixelDiff),Z=G[0]}const W=Z||Q||H||U||E[0]||S[0];if(W&&W.playlist){let G="sortedPlaylistReps";return Z?G="leastPixelDiffRep":Q?G="resolutionPlusOneRep":H?G="resolutionBestRep":U?G="bandwidthBestRep":E[0]&&(G="enabledPlaylistReps"),Np(`choosing ${ix(W)} using ${G} with options`,g),W.playlist}return Np("could not choose a playlist with options",g),null};const sx=function(){let s=this.useDevicePixelRatio&&P.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(s=this.customPixelRatio),nx({main:this.playlists.main,bandwidth:this.systemBandwidth,playerWidth:parseInt(Tu(this.tech_.el(),"width"),10)*s,playerHeight:parseInt(Tu(this.tech_.el(),"height"),10)*s,playerObjectFit:this.usePlayerObjectFit?Tu(this.tech_.el(),"objectFit"):"",limitRenditionByPlayerDimensions:this.limitRenditionByPlayerDimensions,playlistController:this.playlistController_})},pM=function(s){let e=-1,i=-1;if(s<0||s>1)throw new Error("Moving average bandwidth decay must be between 0 and 1.");return function(){let r=this.useDevicePixelRatio&&P.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(r=this.customPixelRatio),e<0&&(e=this.systemBandwidth,i=this.systemBandwidth),this.systemBandwidth>0&&this.systemBandwidth!==i&&(e=s*this.systemBandwidth+(1-s)*e,i=this.systemBandwidth),nx({main:this.playlists.main,bandwidth:e,playerWidth:parseInt(Tu(this.tech_.el(),"width"),10)*r,playerHeight:parseInt(Tu(this.tech_.el(),"height"),10)*r,playerObjectFit:this.usePlayerObjectFit?Tu(this.tech_.el(),"objectFit"):"",limitRenditionByPlayerDimensions:this.limitRenditionByPlayerDimensions,playlistController:this.playlistController_})}},mM=function(s){const{main:e,currentTime:i,bandwidth:r,duration:o,segmentDuration:u,timeUntilRebuffer:c,currentTimeline:p,syncController:g}=s,b=e.playlists.filter(U=>!un.isIncompatible(U));let S=b.filter(un.isEnabled);S.length||(S=b.filter(U=>!un.isDisabled(U)));const A=S.filter(un.hasAttribute.bind(null,"BANDWIDTH")).map(U=>{const z=g.getSyncPoint(U,o,p,i)?1:2,Y=un.estimateSegmentRequestTime(u,r,U)*z-c;return{playlist:U,rebufferingImpact:Y}}),M=A.filter(U=>U.rebufferingImpact<=0);return Su(M,(U,D)=>Ry(D.playlist,U.playlist)),M.length?M[0]:(Su(A,(U,D)=>U.rebufferingImpact-D.rebufferingImpact),A[0]||null)},gM=function(){const s=this.playlists.main.playlists.filter(un.isEnabled);return Su(s,(i,r)=>Ry(i,r)),s.filter(i=>!!Md(this.playlists.main,i).video)[0]||null},yM=s=>{let e=0,i;return s.bytes&&(i=new Uint8Array(s.bytes),s.segments.forEach(r=>{i.set(r,e),e+=r.byteLength})),i};function rx(s){try{return new URL(s).pathname.split("/").slice(-2).join("/")}catch{return""}}const vM=function(s,e,i){if(!s[i]){e.trigger({type:"usage",name:"vhs-608"});let r=i;/^cc708_/.test(i)&&(r="SERVICE"+i.split("_")[1]);const o=e.textTracks().getTrackById(r);if(o)s[i]=o;else{const u=e.options_.vhs&&e.options_.vhs.captionServices||{};let c=i,p=i,g=!1;const b=u[r];b&&(c=b.label,p=b.language,g=b.default),s[i]=e.addRemoteTextTrack({kind:"captions",id:r,default:g,label:c,language:p},!1).track}}},bM=function({inbandTextTracks:s,captionArray:e,timestampOffset:i}){if(!e)return;const r=P.WebKitDataCue||P.VTTCue;e.forEach(o=>{const u=o.stream;o.content?o.content.forEach(c=>{const p=new r(o.startTime+i,o.endTime+i,c.text);p.line=c.line,p.align="left",p.position=c.position,p.positionAlign="line-left",s[u].addCue(p)}):s[u].addCue(new r(o.startTime+i,o.endTime+i,o.text))})},_M=function(s){Object.defineProperties(s.frame,{id:{get(){return $.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),s.value.key}},value:{get(){return $.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),s.value.data}},privateData:{get(){return $.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),s.value.data}}})},TM=({inbandTextTracks:s,metadataArray:e,timestampOffset:i,videoDuration:r})=>{if(!e)return;const o=P.WebKitDataCue||P.VTTCue,u=s.metadataTrack_;if(!u||(e.forEach(S=>{const E=S.cueTime+i;typeof E!="number"||P.isNaN(E)||E<0||!(E<1/0)||!S.frames||!S.frames.length||S.frames.forEach(A=>{const M=new o(E,E,A.value||A.url||A.data||"");M.frame=A,M.value=A,_M(M),u.addCue(M)})}),!u.cues||!u.cues.length))return;const c=u.cues,p=[];for(let S=0;S{const A=S[E.startTime]||[];return A.push(E),S[E.startTime]=A,S},{}),b=Object.keys(g).sort((S,E)=>Number(S)-Number(E));b.forEach((S,E)=>{const A=g[S],M=isFinite(r)?r:S,U=Number(b[E+1])||M;A.forEach(D=>{D.endTime=U})})},SM={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"},xM=new Set(["id","class","startDate","duration","endDate","endOnNext","startTime","endTime","processDateRange"]),EM=({inbandTextTracks:s,dateRanges:e})=>{const i=s.metadataTrack_;if(!i)return;const r=P.WebKitDataCue||P.VTTCue;e.forEach(o=>{for(const u of Object.keys(o)){if(xM.has(u))continue;const c=new r(o.startTime,o.endTime,"");c.id=o.id,c.type="com.apple.quicktime.HLS",c.value={key:SM[u],data:o[u]},(u==="scte35Out"||u==="scte35In")&&(c.value.data=new Uint8Array(c.value.data.match(/[\da-f]{2}/gi)).buffer),i.addCue(c)}o.processDateRange()})},ax=(s,e,i)=>{s.metadataTrack_||(s.metadataTrack_=i.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,$.browser.IS_ANY_SAFARI||(s.metadataTrack_.inBandMetadataTrackDispatchType=e))},Ld=function(s,e,i){let r,o;if(i&&i.cues)for(r=i.cues.length;r--;)o=i.cues[r],o.startTime>=s&&o.endTime<=e&&i.removeCue(o)},CM=function(s){const e=s.cues;if(!e)return;const i={};for(let r=e.length-1;r>=0;r--){const o=e[r],u=`${o.startTime}-${o.endTime}-${o.text}`;i[u]?s.removeCue(o):i[u]=o}},AM=(s,e,i)=>{if(typeof e>"u"||e===null||!s.length)return[];const r=Math.ceil((e-i+3)*Ao.ONE_SECOND_IN_TS);let o;for(o=0;or);o++);return s.slice(o)},DM=(s,e,i)=>{if(!e.length)return s;if(i)return e.slice();const r=e[0].pts;let o=0;for(o;o=r);o++);return s.slice(0,o).concat(e)},wM=(s,e,i,r)=>{const o=Math.ceil((e-r)*Ao.ONE_SECOND_IN_TS),u=Math.ceil((i-r)*Ao.ONE_SECOND_IN_TS),c=s.slice();let p=s.length;for(;p--&&!(s[p].pts<=u););if(p===-1)return c;let g=p+1;for(;g--&&!(s[g].pts<=o););return g=Math.max(g,0),c.splice(g,p-g+1),c},kM=function(s,e){if(!s&&!e||!s&&e||s&&!e)return!1;if(s===e)return!0;const i=Object.keys(s).sort(),r=Object.keys(e).sort();if(i.length!==r.length)return!1;for(let o=0;oi))return u}return r.length===0?0:r[r.length-1]},Id=1,RM=500,ox=s=>typeof s=="number"&&isFinite(s),Pp=1/60,MM=(s,e,i)=>s!=="main"||!e||!i?null:!i.hasAudio&&!i.hasVideo?"Neither audio nor video found in segment.":e.hasVideo&&!i.hasVideo?"Only audio found in segment when we expected video. We can't switch to audio only from a stream that had video. To get rid of this message, please add codec information to the manifest.":!e.hasVideo&&i.hasVideo?"Video found in segment when we expected only audio. We can't switch to a stream with video from an audio only stream. To get rid of this message, please add codec information to the manifest.":null,LM=(s,e,i)=>{let r=e-fi.BACK_BUFFER_LENGTH;s.length&&(r=Math.max(r,s.start(0)));const o=e-i;return Math.min(o,r)},xu=s=>{const{startOfSegment:e,duration:i,segment:r,part:o,playlist:{mediaSequence:u,id:c,segments:p=[]},mediaIndex:g,partIndex:b,timeline:S}=s,E=p.length-1;let A="mediaIndex/partIndex increment";s.getMediaInfoForTime?A=`getMediaInfoForTime (${s.getMediaInfoForTime})`:s.isSyncRequest&&(A="getSyncSegmentCandidate (isSyncRequest)"),s.independent&&(A+=` with independent ${s.independent}`);const M=typeof b=="number",U=s.segment.uri?"segment":"pre-segment",D=M?fS({preloadSegment:r})-1:0;return`${U} [${u+g}/${u+E}]`+(M?` part [${b}/${D}]`:"")+` segment start/end [${r.start} => ${r.end}]`+(M?` part start/end [${o.start} => ${o.end}]`:"")+` startOfSegment [${e}] duration [${i}] timeline [${S}] selected by [${A}] playlist [${c}]`},lx=s=>`${s}TimingInfo`,IM=({segmentTimeline:s,currentTimeline:e,startOfSegment:i,buffered:r,overrideCheck:o})=>!o&&s===e?null:s{if(e===i)return!1;if(r==="audio"){const u=s.lastTimelineChange({type:"main"});return!u||u.to!==i}if(r==="main"&&o){const u=s.pendingTimelineChange({type:"audio"});return!(u&&u.to===i)}return!1},NM=s=>{if(!s)return!1;const e=s.pendingTimelineChange({type:"audio"}),i=s.pendingTimelineChange({type:"main"}),r=e&&i,o=r&&e.to!==i.to;return!!(r&&e.from!==-1&&i.from!==-1&&o)},PM=s=>{const e=s.timelineChangeController_.pendingTimelineChange({type:"audio"}),i=s.timelineChangeController_.pendingTimelineChange({type:"main"});return e&&i&&e.to{const e=s.pendingSegment_;if(!e)return;if(My({timelineChangeController:s.timelineChangeController_,currentTimeline:s.currentTimeline_,segmentTimeline:e.timeline,loaderType:s.loaderType_,audioDisabled:s.audioDisabled_})&&NM(s.timelineChangeController_)){if(PM(s)){s.timelineChangeController_.trigger("audioTimelineBehind");return}s.timelineChangeController_.trigger("fixBadTimelineChange")}},UM=s=>{let e=0;return["video","audio"].forEach(function(i){const r=s[`${i}TimingInfo`];if(!r)return;const{start:o,end:u}=r;let c;typeof o=="bigint"||typeof u=="bigint"?c=P.BigInt(u)-P.BigInt(o):typeof o=="number"&&typeof u=="number"&&(c=u-o),typeof c<"u"&&c>e&&(e=c)}),typeof e=="bigint"&&es?Math.round(s)>e+Fs:!1,BM=(s,e)=>{if(e!=="hls")return null;const i=UM({audioTimingInfo:s.audioTimingInfo,videoTimingInfo:s.videoTimingInfo});if(!i)return null;const r=s.playlist.targetDuration,o=ux({segmentDuration:i,maxDuration:r*2}),u=ux({segmentDuration:i,maxDuration:r}),c=`Segment with index ${s.mediaIndex} from playlist ${s.playlist.id} has a duration of ${i} when the reported duration is ${s.duration} and the target duration is ${r}. 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 o||u?{severity:o?"warn":"info",message:c}:null},Po=({type:s,segment:e})=>{if(!e)return;const i=!!(e.key||e.map&&e.map.ke),r=!!(e.map&&!e.map.bytes),o=e.startOfSegment===void 0?e.start:e.startOfSegment;return{type:s||e.type,uri:e.resolvedUri||e.uri,start:o,duration:e.duration,isEncrypted:i,isMediaInitialization:r}};class Ly extends $.EventTarget{constructor(e,i={}){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_=$n(`SegmentLoader[${this.loaderType_}]`),Object.defineProperty(this,"state",{get(){return this.state_},set(r){r!==this.state_&&(this.logger_(`${this.state_} -> ${r}`),this.state_=r,this.trigger("statechange"))}}),this.sourceUpdater_.on("ready",()=>{this.hasEnoughInfoToAppend_()?this.processCallQueue_():ka(this)}),this.sourceUpdater_.on("codecschange",r=>{this.trigger(Ft({type:"codecschange"},r))}),this.loaderType_==="main"&&this.timelineChangeController_.on("pendingtimelinechange",()=>{this.hasEnoughInfoToAppend_()?this.processCallQueue_():ka(this)}),this.loaderType_==="audio"&&this.timelineChangeController_.on("timelinechange",r=>{this.trigger(Ft({type:"timelinechange"},r)),this.hasEnoughInfoToLoad_()?this.processLoadQueue_():ka(this),this.hasEnoughInfoToAppend_()?this.processCallQueue_():ka(this)})}get mediaSequenceSync_(){return this.syncController_.getMediaSequenceSync(this.loaderType_)}createTransmuxer_(){return wy.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_&&P.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,P.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_&&wy.reset(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")}buffered_(){const e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return hi();if(this.loaderType_==="main"){const{hasAudio:i,hasVideo:r,isMuxed:o}=e;if(r&&i&&!this.audioDisabled_&&!o)return this.sourceUpdater_.buffered();if(r)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()}initSegmentForMap(e,i=!1){if(!e)return null;const r=Ip(e);let o=this.initSegments_[r];return i&&!o&&e.bytes&&(this.initSegments_[r]=o={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes,tracks:e.tracks,timescales:e.timescales}),o||e}segmentKey(e,i=!1){if(!e)return null;const r=PS(e);let o=this.keyCache_[r];this.cacheEncryptionKeys_&&i&&!o&&e.bytes&&(this.keyCache_[r]=o={resolvedUri:e.resolvedUri,bytes:e.bytes});const u={resolvedUri:(o||e).resolvedUri};return o&&(u.bytes=o.bytes),u}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,i={}){if(!e||this.playlist_&&this.playlist_.endList&&e.endList&&this.playlist_.uri===e.uri)return;const r=this.playlist_,o=this.pendingSegment_;this.playlist_=e,this.xhrOptions_=i,this.state==="INIT"&&(e.syncInfo={mediaSequence:e.mediaSequence,time:0},this.loaderType_==="main"&&this.syncController_.setDateTimeMappingForStart(e));let u=null;if(r&&(r.id?u=r.id:r.uri&&(u=r.uri)),this.logger_(`playlist update [${u} => ${e.id||e.uri}]`),this.mediaSequenceSync_&&(this.mediaSequenceSync_.update(e,this.currentTime_()),this.logger_(`Playlist update: +`)};var sr={inspect:Wt,textify:Xn,parseType:Yr,findBox:Jd,parseTraf:kn.traf,parseTfdt:kn.tfdt,parseHdlr:kn.hdlr,parseTfhd:kn.tfhd,parseTrun:kn.trun,parseSidx:kn.sidx},wt=function(h){for(var m=0,y=String.fromCharCode(h[m]),v="";y!=="\0";)v+=y,m++,y=String.fromCharCode(h[m]);return v+=y,v},Xu={uint8ToCString:wt},nl=Xu.uint8ToCString,eh=u.getUint64,Wr=function(h){var m=4,y=h[0],v,_,x,k,R,I,N,j;if(y===0){v=nl(h.subarray(m)),m+=v.length,_=nl(h.subarray(m)),m+=_.length;var te=new DataView(h.buffer);x=te.getUint32(m),m+=4,R=te.getUint32(m),m+=4,I=te.getUint32(m),m+=4,N=te.getUint32(m),m+=4}else if(y===1){var te=new DataView(h.buffer);x=te.getUint32(m),m+=4,k=eh(h.subarray(m)),m+=8,I=te.getUint32(m),m+=4,N=te.getUint32(m),m+=4,v=nl(h.subarray(m)),m+=v.length,_=nl(h.subarray(m)),m+=_.length}j=new Uint8Array(h.subarray(m,h.byteLength));var ge={scheme_id_uri:v,value:_,timescale:x||1,presentation_time:k,presentation_time_delta:R,event_duration:I,id:N,message_data:j};return xs(y,ge)?ge:void 0},sl=function(h,m,y,v){return h||h===0?h/m:v+y/m},xs=function(h,m){var y=m.scheme_id_uri!=="\0",v=h===0&&rl(m.presentation_time_delta)&&y,_=h===1&&rl(m.presentation_time)&&y;return!(h>1)&&v||_},rl=function(h){return h!==void 0||h!==null},al={parseEmsgBox:Wr,scaleTime:sl},Qr;typeof window<"u"?Qr=window:typeof s<"u"?Qr=s:typeof self<"u"?Qr=self:Qr={};var Yu=Qr,ol=Ha.toUnsigned,Bi=Ha.toHexString,lt=za,Es=$u,th=al,am=Ss,Jy=Kd,ih=Jo,Wu=u.getUint64,nh,sh,rh,ll,ah,Qu,oh,ul=Yu,lh=jr.parseId3Frames;nh=function(h){var m={},y=lt(h,["moov","trak"]);return y.reduce(function(v,_){var x,k,R,I,N;return x=lt(_,["tkhd"])[0],!x||(k=x[0],R=k===0?12:20,I=ol(x[R]<<24|x[R+1]<<16|x[R+2]<<8|x[R+3]),N=lt(_,["mdia","mdhd"])[0],!N)?null:(k=N[0],R=k===0?12:20,v[I]=ol(N[R]<<24|N[R+1]<<16|N[R+2]<<8|N[R+3]),v)},m)},sh=function(h,m){var y;y=lt(m,["moof","traf"]);var v=y.reduce(function(_,x){var k=lt(x,["tfhd"])[0],R=ol(k[4]<<24|k[5]<<16|k[6]<<8|k[7]),I=h[R]||9e4,N=lt(x,["tfdt"])[0],j=new DataView(N.buffer,N.byteOffset,N.byteLength),te;N[0]===1?te=Wu(N.subarray(4,12)):te=j.getUint32(4);let ge;return typeof te=="bigint"?ge=te/ul.BigInt(I):typeof te=="number"&&!isNaN(te)&&(ge=te/I),ge11?(_.codec+=".",_.codec+=Bi(ue[9]),_.codec+=Bi(ue[10]),_.codec+=Bi(ue[11])):_.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(_.codec)?(ue=ge.subarray(28),Le=Es(ue.subarray(4,8)),Le==="esds"&&ue.length>20&&ue[19]!==0?(_.codec+="."+Bi(ue[19]),_.codec+="."+Bi(ue[20]>>>2&63).replace(/^0/,"")):_.codec="mp4a.40.2"):_.codec=_.codec.toLowerCase())}var Pe=lt(v,["mdia","mdhd"])[0];Pe&&(_.timescale=Qu(Pe)),y.push(_)}),y},oh=function(h,m=0){var y=lt(h,["emsg"]);return y.map(v=>{var _=th.parseEmsgBox(new Uint8Array(v)),x=lh(_.message_data);return{cueTime:th.scaleTime(_.presentation_time,_.timescale,_.presentation_time_delta,m),duration:th.scaleTime(_.event_duration,_.timescale),frames:x}})};var pn={findBox:lt,parseType:Es,timescale:nh,startTime:sh,compositionStartTime:rh,videoTrackIds:ll,tracks:ah,getTimescaleFromMediaHeader:Qu,getEmsgID3:oh};const{parseTrun:rr}=sr,{findBox:qa}=pn;var cl=Yu,dl=function(h){var m=qa(h,["moof","traf"]),y=qa(h,["mdat"]),v=[];return y.forEach(function(_,x){var k=m[x];v.push({mdat:_,traf:k})}),v},hl=function(h,m,y){var v=m,_=y.defaultSampleDuration||0,x=y.defaultSampleSize||0,k=y.trackId,R=[];return h.forEach(function(I){var N=rr(I),j=N.samples;j.forEach(function(te){te.duration===void 0&&(te.duration=_),te.size===void 0&&(te.size=x),te.trackId=k,te.dts=v,te.compositionTimeOffset===void 0&&(te.compositionTimeOffset=0),typeof v=="bigint"?(te.pts=v+cl.BigInt(te.compositionTimeOffset),v+=cl.BigInt(te.duration)):(te.pts=v+te.compositionTimeOffset,v+=te.duration)}),R=R.concat(j)}),R},uh={getMdatTrafPairs:dl,parseSamples:hl},ev=Bd.discardEmulationPreventionBytes,om=wu.CaptionStream,Ku=za,ch=Jo,dh=Ss,{getMdatTrafPairs:We,parseSamples:he}=uh,Va=function(h,m){for(var y=h,v=0;v0?ch(j[0]).baseMediaDecodeTime:0,ge=Ku(k,["trun"]),ue,Le;m===N&&ge.length>0&&(ue=he(ge,te,I),Le=Zu(x,ue,N),y[N]||(y[N]={seiNals:[],logs:[]}),y[N].seiNals=y[N].seiNals.concat(Le.seiNals),y[N].logs=y[N].logs.concat(Le.logs))}),y},hh=function(h,m,y){var v;if(m===null)return null;v=Bt(h,m);var _=v[m]||{};return{seiNals:_.seiNals,logs:_.logs,timescale:y}},fh=function(){var h=!1,m,y,v,_,x,k;this.isInitialized=function(){return h},this.init=function(R){m=new om,h=!0,k=R?R.isPartial:!1,m.on("data",function(I){I.startTime=I.startPts/_,I.endTime=I.endPts/_,x.captions.push(I),x.captionStreams[I.stream]=!0}),m.on("log",function(I){x.logs.push(I)})},this.isNewInit=function(R,I){return R&&R.length===0||I&&typeof I=="object"&&Object.keys(I).length===0?!1:v!==R[0]||_!==I[v]},this.parse=function(R,I,N){var j;if(this.isInitialized()){if(!I||!N)return null;if(this.isNewInit(I,N))v=I[0],_=N[v];else if(v===null||!_)return y.push(R),null}else return null;for(;y.length>0;){var te=y.shift();this.parse(te,I,N)}return j=hh(R,v,_),j&&j.logs&&(x.logs=x.logs.concat(j.logs)),j===null||!j.seiNals?x.logs.length?{logs:x.logs,captions:[],captionStreams:[]}:null:(this.pushNals(j.seiNals),this.flushStream(),x)},this.pushNals=function(R){if(!this.isInitialized()||!R||R.length===0)return null;R.forEach(function(I){m.push(I)})},this.flushStream=function(){if(!this.isInitialized())return null;k?m.partialFlush():m.flush()},this.clearParsedCaptions=function(){x.captions=[],x.captionStreams={},x.logs=[]},this.resetCaptionStream=function(){if(!this.isInitialized())return null;m.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){y=[],v=null,_=null,x?this.clearParsedCaptions():x={captions:[],captionStreams:{},logs:[]},this.resetCaptionStream()},this.reset()},lm=fh;const{parseTfdt:ph}=sr,ar=za,{getTimescaleFromMediaHeader:mh}=pn,{parseSamples:gh,getMdatTrafPairs:yh}=uh;var ut=function(){let h=9e4;this.init=function(m){const y=ar(m,["moov","trak","mdia","mdhd"])[0];y&&(h=mh(y))},this.parseSegment=function(m){const y=[],v=yh(m);let _=0;return v.forEach(function(x){const k=x.mdat,R=x.traf,I=ar(R,["tfdt"])[0],N=ar(R,["tfhd"])[0],j=ar(R,["trun"]);if(I&&(_=ph(I).baseMediaDecodeTime),j.length&&N){const te=gh(j,_,N);let ge=0;te.forEach(function(ue){const Le="utf-8",Pe=new TextDecoder(Le),qt=k.slice(ge,ge+ue.size);if(ar(qt,["vtte"])[0]){ge+=ue.size;return}ar(qt,["vttc"]).forEach(function(lr){const Zr=ar(lr,["payl"])[0],Xa=ar(lr,["sttg"])[0],Ya=ue.pts/h,Wa=(ue.pts+ue.duration)/h;let bt,Qa;if(Zr)try{bt=Pe.decode(Zr)}catch(Yi){console.error(Yi)}if(Xa)try{Qa=Pe.decode(Xa)}catch(Yi){console.error(Yi)}ue.duration&&bt&&y.push({cueText:bt,start:Ya,end:Wa,settings:Qa})}),ge+=ue.size})}}),y}},fl=zo,$a=function(h){var m=h[1]&31;return m<<=8,m|=h[2],m},On=function(h){return!!(h[1]&64)},Yn=function(h){var m=0;return(h[3]&48)>>>4>1&&(m+=h[4]+1),m},Rn=function(h,m){var y=$a(h);return y===0?"pat":y===m?"pmt":m?"pes":null},vh=function(h){var m=On(h),y=4+Yn(h);return m&&(y+=h[y]+1),(h[y+10]&31)<<8|h[y+11]},Ga=function(h){var m={},y=On(h),v=4+Yn(h);if(y&&(v+=h[v]+1),!!(h[v+5]&1)){var _,x,k;_=(h[v+1]&15)<<8|h[v+2],x=3+_-4,k=(h[v+10]&15)<<8|h[v+11];for(var R=12+k;R=h.byteLength)return null;var v=null,_;return _=h[y+7],_&192&&(v={},v.pts=(h[y+9]&14)<<27|(h[y+10]&255)<<20|(h[y+11]&254)<<12|(h[y+12]&255)<<5|(h[y+13]&254)>>>3,v.pts*=4,v.pts+=(h[y+13]&6)>>>1,v.dts=v.pts,_&64&&(v.dts=(h[y+14]&14)<<27|(h[y+15]&255)<<20|(h[y+16]&254)<<12|(h[y+17]&255)<<5|(h[y+18]&254)>>>3,v.dts*=4,v.dts+=(h[y+18]&6)>>>1)),v},ml=function(h){switch(h){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}},Ju=function(h){for(var m=4+Yn(h),y=h.subarray(m),v=0,_=0,x=!1,k;_3&&(k=ml(y[_+3]&31),k==="slice_layer_without_partitioning_rbsp_idr"&&(x=!0)),x},um={parseType:Rn,parsePat:vh,parsePmt:Ga,parsePayloadUnitStartIndicator:On,parsePesType:bh,parsePesTime:pl,videoPacketContainsKeyFrame:Ju},_h=zo,Kr=zd.handleRollover,ct={};ct.ts=um,ct.aac=Fu;var or=ot.ONE_SECOND_IN_TS,ai=188,mn=71,Th=function(h,m){for(var y=0,v=ai,_,x;v=0;){if(h[v]===mn&&(h[_]===mn||_===h.byteLength)){switch(x=h.subarray(v,_),k=ct.ts.parseType(x,m.pid),k){case"pes":R=ct.ts.parsePesType(x,m.table),I=ct.ts.parsePayloadUnitStartIndicator(x),R==="audio"&&I&&(N=ct.ts.parsePesTime(x),N&&(N.type="audio",y.audio.push(N),j=!0));break}if(j)break;v-=ai,_-=ai;continue}v--,_--}},cm=function(h,m,y){for(var v=0,_=ai,x,k,R,I,N,j,te,ge,ue=!1,Le={data:[],size:0};_=0;){if(h[v]===mn&&h[_]===mn){switch(x=h.subarray(v,_),k=ct.ts.parseType(x,m.pid),k){case"pes":R=ct.ts.parsePesType(x,m.table),I=ct.ts.parsePayloadUnitStartIndicator(x),R==="video"&&I&&(N=ct.ts.parsePesTime(x),N&&(N.type="video",y.video.push(N),ue=!0));break}if(ue)break;v-=ai,_-=ai;continue}v--,_--}},dm=function(h,m){if(h.audio&&h.audio.length){var y=m;(typeof y>"u"||isNaN(y))&&(y=h.audio[0].dts),h.audio.forEach(function(x){x.dts=Kr(x.dts,y),x.pts=Kr(x.pts,y),x.dtsTime=x.dts/or,x.ptsTime=x.pts/or})}if(h.video&&h.video.length){var v=m;if((typeof v>"u"||isNaN(v))&&(v=h.video[0].dts),h.video.forEach(function(x){x.dts=Kr(x.dts,v),x.pts=Kr(x.pts,v),x.dtsTime=x.dts/or,x.ptsTime=x.pts/or}),h.firstKeyFrame){var _=h.firstKeyFrame;_.dts=Kr(_.dts,v),_.pts=Kr(_.pts,v),_.dtsTime=_.dts/or,_.ptsTime=_.pts/or}}},tv=function(h){for(var m=!1,y=0,v=null,_=null,x=0,k=0,R;h.length-k>=3;){var I=ct.aac.parseType(h,k);switch(I){case"timed-metadata":if(h.length-k<10){m=!0;break}if(x=ct.aac.parseId3TagSize(h,k),x>h.length){m=!0;break}_===null&&(R=h.subarray(k,k+x),_=ct.aac.parseAacTimestamp(R)),k+=x;break;case"audio":if(h.length-k<7){m=!0;break}if(x=ct.aac.parseAdtsSize(h,k),x>h.length){m=!0;break}v===null&&(R=h.subarray(k,k+x),v=ct.aac.parseSampleRate(R)),y++,k+=x;break;default:k++;break}if(m)return null}if(v===null||_===null)return null;var N=or/v,j={audio:[{type:"audio",dts:_,pts:_},{type:"audio",dts:_+y*1024*N,pts:_+y*1024*N}]};return j},hm=function(h){var m={pid:null,table:null},y={};Th(h,m);for(var v in m.table)if(m.table.hasOwnProperty(v)){var _=m.table[v];switch(_){case _h.H264_STREAM_TYPE:y.video=[],cm(h,m,y),y.video.length===0&&delete y.video;break;case _h.ADTS_STREAM_TYPE:y.audio=[],Sh(h,m,y),y.audio.length===0&&delete y.audio;break}}return y},fm=function(h,m){var y=ct.aac.isLikelyAacData(h),v;return y?v=tv(h):v=hm(h),!v||!v.audio&&!v.video?null:(dm(v,m),v)},pm={inspect:fm,parseAudioPes_:Sh};const xh=function(h,m){m.on("data",function(y){const v=y.initSegment;y.initSegment={data:v.buffer,byteOffset:v.byteOffset,byteLength:v.byteLength};const _=y.data;y.data=_.buffer,h.postMessage({action:"data",segment:y,byteOffset:_.byteOffset,byteLength:_.byteLength},[y.data])}),m.on("done",function(y){h.postMessage({action:"done"})}),m.on("gopInfo",function(y){h.postMessage({action:"gopInfo",gopInfo:y})}),m.on("videoSegmentTimingInfo",function(y){const v={start:{decode:ot.videoTsToSeconds(y.start.dts),presentation:ot.videoTsToSeconds(y.start.pts)},end:{decode:ot.videoTsToSeconds(y.end.dts),presentation:ot.videoTsToSeconds(y.end.pts)},baseMediaDecodeTime:ot.videoTsToSeconds(y.baseMediaDecodeTime)};y.prependedContentDuration&&(v.prependedContentDuration=ot.videoTsToSeconds(y.prependedContentDuration)),h.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:v})}),m.on("audioSegmentTimingInfo",function(y){const v={start:{decode:ot.videoTsToSeconds(y.start.dts),presentation:ot.videoTsToSeconds(y.start.pts)},end:{decode:ot.videoTsToSeconds(y.end.dts),presentation:ot.videoTsToSeconds(y.end.pts)},baseMediaDecodeTime:ot.videoTsToSeconds(y.baseMediaDecodeTime)};y.prependedContentDuration&&(v.prependedContentDuration=ot.videoTsToSeconds(y.prependedContentDuration)),h.postMessage({action:"audioSegmentTimingInfo",audioSegmentTimingInfo:v})}),m.on("id3Frame",function(y){h.postMessage({action:"id3Frame",id3Frame:y})}),m.on("caption",function(y){h.postMessage({action:"caption",caption:y})}),m.on("trackinfo",function(y){h.postMessage({action:"trackinfo",trackInfo:y})}),m.on("audioTimingInfo",function(y){h.postMessage({action:"audioTimingInfo",audioTimingInfo:{start:ot.videoTsToSeconds(y.start),end:ot.videoTsToSeconds(y.end)}})}),m.on("videoTimingInfo",function(y){h.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:ot.videoTsToSeconds(y.start),end:ot.videoTsToSeconds(y.end)}})}),m.on("log",function(y){h.postMessage({action:"log",log:y})})};class Eh{constructor(m,y){this.options=y||{},this.self=m,this.init()}init(){this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new im.Transmuxer(this.options),xh(this.self,this.transmuxer)}pushMp4Captions(m){this.captionParser||(this.captionParser=new lm,this.captionParser.init());const y=new Uint8Array(m.data,m.byteOffset,m.byteLength),v=this.captionParser.parse(y,m.trackIds,m.timescales);this.self.postMessage({action:"mp4Captions",captions:v&&v.captions||[],logs:v&&v.logs||[],data:y.buffer},[y.buffer])}initMp4WebVttParser(m){this.webVttParser||(this.webVttParser=new ut);const y=new Uint8Array(m.data,m.byteOffset,m.byteLength);this.webVttParser.init(y)}getMp4WebVttText(m){this.webVttParser||(this.webVttParser=new ut);const y=new Uint8Array(m.data,m.byteOffset,m.byteLength),v=this.webVttParser.parseSegment(y);this.self.postMessage({action:"getMp4WebVttText",mp4VttCues:v||[],data:y.buffer},[y.buffer])}probeMp4StartTime({timescales:m,data:y}){const v=pn.startTime(m,y);this.self.postMessage({action:"probeMp4StartTime",startTime:v,data:y},[y.buffer])}probeMp4Tracks({data:m}){const y=pn.tracks(m);this.self.postMessage({action:"probeMp4Tracks",tracks:y,data:m},[m.buffer])}probeEmsgID3({data:m,offset:y}){const v=pn.getEmsgID3(m,y);this.self.postMessage({action:"probeEmsgID3",id3Frames:v,emsgData:m},[m.buffer])}probeTs({data:m,baseStartTime:y}){const v=typeof y=="number"&&!isNaN(y)?y*ot.ONE_SECOND_IN_TS:void 0,_=pm.inspect(m,v);let x=null;_&&(x={hasVideo:_.video&&_.video.length===2||!1,hasAudio:_.audio&&_.audio.length===2||!1},x.hasVideo&&(x.videoStart=_.video[0].ptsTime),x.hasAudio&&(x.audioStart=_.audio[0].ptsTime)),this.self.postMessage({action:"probeTs",result:x,data:m},[m.buffer])}clearAllMp4Captions(){this.captionParser&&this.captionParser.clearAllCaptions()}clearParsedMp4Captions(){this.captionParser&&this.captionParser.clearParsedCaptions()}push(m){const y=new Uint8Array(m.data,m.byteOffset,m.byteLength);this.transmuxer.push(y)}reset(){this.transmuxer.reset()}setTimestampOffset(m){const y=m.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(ot.secondsToVideoTs(y)))}setAudioAppendStart(m){this.transmuxer.setAudioAppendStart(Math.ceil(ot.secondsToVideoTs(m.appendStart)))}setRemux(m){this.transmuxer.setRemux(m.remux)}flush(m){this.transmuxer.flush(),self.postMessage({action:"done",type:"transmuxed"})}endTimeline(){this.transmuxer.endTimeline(),self.postMessage({action:"endedtimeline",type:"transmuxed"})}alignGopsWith(m){this.transmuxer.alignGopsWith(m.gopsToAlignWith.slice())}}self.onmessage=function(h){if(h.data.action==="init"&&h.data.options){this.messageHandlers=new Eh(self,h.data.options);return}this.messageHandlers||(this.messageHandlers=new Eh(self)),h.data&&h.data.action&&h.data.action!=="init"&&this.messageHandlers[h.data.action]&&this.messageHandlers[h.data.action](h.data)}}));var W4=qS(Y4);const Q4=(s,e,i)=>{const{type:r,initSegment:o,captions:u,captionStreams:c,metadata:p,videoFrameDtsTime:g,videoFramePtsTime:b}=s.data.segment;e.buffer.push({captions:u,captionStreams:c,metadata:p});const S=s.data.segment.boxes||{data:s.data.segment.data},E={type:r,data:new Uint8Array(S.data,S.data.byteOffset,S.data.byteLength),initSegment:new Uint8Array(o.data,o.byteOffset,o.byteLength)};typeof g<"u"&&(E.videoFrameDtsTime=g),typeof b<"u"&&(E.videoFramePtsTime=b),i(E)},K4=({transmuxedData:s,callback:e})=>{s.buffer=[],e(s)},Z4=(s,e)=>{e.gopInfo=s.data.gopInfo},GS=s=>{const{transmuxer:e,bytes:i,audioAppendStart:r,gopsToAlignWith:o,remux:u,onData:c,onTrackInfo:p,onAudioTimingInfo:g,onVideoTimingInfo:b,onVideoSegmentTimingInfo:S,onAudioSegmentTimingInfo:E,onId3:A,onCaptions:M,onDone:U,onEndedTimeline:D,onTransmuxerLog:z,isEndOfTimeline:H,segment:Y,triggerSegmentEventFn:$}=s,Q={buffer:[]};let Z=H;const W=ee=>{e.currentTransmux===s&&(ee.data.action==="data"&&Q4(ee,Q,c),ee.data.action==="trackinfo"&&p(ee.data.trackInfo),ee.data.action==="gopInfo"&&Z4(ee,Q),ee.data.action==="audioTimingInfo"&&g(ee.data.audioTimingInfo),ee.data.action==="videoTimingInfo"&&b(ee.data.videoTimingInfo),ee.data.action==="videoSegmentTimingInfo"&&S(ee.data.videoSegmentTimingInfo),ee.data.action==="audioSegmentTimingInfo"&&E(ee.data.audioSegmentTimingInfo),ee.data.action==="id3Frame"&&A([ee.data.id3Frame],ee.data.id3Frame.dispatchType),ee.data.action==="caption"&&M(ee.data.caption),ee.data.action==="endedtimeline"&&(Z=!1,D()),ee.data.action==="log"&&z(ee.data.log),ee.data.type==="transmuxed"&&(Z||(e.onmessage=null,K4({transmuxedData:Q,callback:U}),XS(e))))},G=()=>{const ee={message:"Received an error message from the transmuxer worker",metadata:{errorType:V.Error.StreamingFailedToTransmuxSegment,segmentInfo:Po({segment:Y})}};U(null,ee)};if(e.onmessage=W,e.onerror=G,r&&e.postMessage({action:"setAudioAppendStart",appendStart:r}),Array.isArray(o)&&e.postMessage({action:"alignGopsWith",gopsToAlignWith:o}),typeof u<"u"&&e.postMessage({action:"setRemux",remux:u}),i.byteLength){const ee=i instanceof ArrayBuffer?i:i.buffer,oe=i instanceof ArrayBuffer?0:i.byteOffset;$({type:"segmenttransmuxingstart",segment:Y}),e.postMessage({action:"push",data:ee,byteOffset:oe,byteLength:i.byteLength},[ee])}H&&e.postMessage({action:"endTimeline"}),e.postMessage({action:"flush"})},XS=s=>{s.currentTransmux=null,s.transmuxQueue.length&&(s.currentTransmux=s.transmuxQueue.shift(),typeof s.currentTransmux=="function"?s.currentTransmux():GS(s.currentTransmux))},YS=(s,e)=>{s.postMessage({action:e}),XS(s)},WS=(s,e)=>{if(!e.currentTransmux){e.currentTransmux=s,YS(e,s);return}e.transmuxQueue.push(YS.bind(null,e,s))},J4=s=>{WS("reset",s)},eM=s=>{WS("endTimeline",s)},QS=s=>{if(!s.transmuxer.currentTransmux){s.transmuxer.currentTransmux=s,GS(s);return}s.transmuxer.transmuxQueue.push(s)};var wy={reset:J4,endTimeline:eM,transmux:QS,createTransmuxer:s=>{const e=new W4;e.currentTransmux=null,e.transmuxQueue=[];const i=e.terminate;return e.terminate=()=>(e.currentTransmux=null,e.transmuxQueue.length=0,i.call(e)),e.postMessage({action:"init",options:s}),e}};const _u=function(s){const e=s.transmuxer,i=s.endAction||s.action,r=s.callback,o=Ft({},s,{endAction:null,transmuxer:null,callback:null}),u=c=>{c.data.action===i&&(e.removeEventListener("message",u),c.data.data&&(c.data.data=new Uint8Array(c.data.data,s.byteOffset||0,s.byteLength||c.data.data.byteLength),s.data&&(s.data=c.data.data)),r(c.data))};if(e.addEventListener("message",u),s.data){const c=s.data instanceof ArrayBuffer;o.byteOffset=c?0:s.data.byteOffset,o.byteLength=s.data.byteLength;const p=[c?s.data:s.data.buffer];e.postMessage(o,p)}else e.postMessage(o)},zs={FAILURE:2,TIMEOUT:-101,ABORTED:-102},KS="wvtt",ky=s=>{s.forEach(e=>{e.abort()})},tM=s=>({bandwidth:s.bandwidth,bytesReceived:s.bytesReceived||0,roundTripTime:s.roundTripTime||0}),iM=s=>{const e=s.target,r={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-e.requestTime||0};return r.bytesReceived=s.loaded,r.bandwidth=Math.floor(r.bytesReceived/r.roundTripTime*8*1e3),r},Oy=(s,e)=>{const{requestType:i}=e,r=No({requestType:i,request:e,error:s});return e.timedout?{status:e.status,message:"HLS request timed-out at URL: "+e.uri,code:zs.TIMEOUT,xhr:e,metadata:r}:e.aborted?{status:e.status,message:"HLS request aborted at URL: "+e.uri,code:zs.ABORTED,xhr:e,metadata:r}:s?{status:e.status,message:"HLS request errored at URL: "+e.uri,code:zs.FAILURE,xhr:e,metadata:r}:e.responseType==="arraybuffer"&&e.response.byteLength===0?{status:e.status,message:"Empty HLS response at URL: "+e.uri,code:zs.FAILURE,xhr:e,metadata:r}:null},ZS=(s,e,i,r)=>(o,u)=>{const c=u.response,p=Oy(o,u);if(p)return i(p,s);if(c.byteLength!==16)return i({status:u.status,message:"Invalid HLS key at URL: "+u.uri,code:zs.FAILURE,xhr:u},s);const g=new DataView(c),b=new Uint32Array([g.getUint32(0),g.getUint32(4),g.getUint32(8),g.getUint32(12)]);for(let E=0;E{e===KS&&s.transmuxer.postMessage({action:"initMp4WebVttParser",data:s.map.bytes})},sM=(s,e,i)=>{e===KS&&_u({action:"getMp4WebVttText",data:s.bytes,transmuxer:s.transmuxer,callback:({data:r,mp4VttCues:o})=>{s.bytes=r,i(null,s,{mp4VttCues:o})}})},JS=(s,e)=>{const i=m0(s.map.bytes);if(i!=="mp4"){const r=s.map.resolvedUri||s.map.uri,o=i||"unknown";return e({internal:!0,message:`Found unsupported ${o} container for initialization segment at URL: ${r}`,code:zs.FAILURE,metadata:{mediaType:o}})}_u({action:"probeMp4Tracks",data:s.map.bytes,transmuxer:s.transmuxer,callback:({tracks:r,data:o})=>(s.map.bytes=o,r.forEach(function(u){s.map.tracks=s.map.tracks||{},!s.map.tracks[u.type]&&(s.map.tracks[u.type]=u,typeof u.id=="number"&&u.timescale&&(s.map.timescales=s.map.timescales||{},s.map.timescales[u.id]=u.timescale),u.type==="text"&&nM(s,u.codec))}),e(null))})},rM=({segment:s,finishProcessingFn:e,triggerSegmentEventFn:i})=>(r,o)=>{const u=Oy(r,o);if(u)return e(u,s);const c=new Uint8Array(o.response);if(i({type:"segmentloaded",segment:s}),s.map.key)return s.map.encryptedBytes=c,e(null,s);s.map.bytes=c,JS(s,function(p){if(p)return p.xhr=o,p.status=o.status,e(p,s);e(null,s)})},aM=({segment:s,finishProcessingFn:e,responseType:i,triggerSegmentEventFn:r})=>(o,u)=>{const c=Oy(o,u);if(c)return e(c,s);r({type:"segmentloaded",segment:s});const p=i==="arraybuffer"||!u.responseText?u.response:G4(u.responseText.substring(s.lastReachedChar||0));return s.stats=tM(u),s.key?s.encryptedBytes=new Uint8Array(p):s.bytes=new Uint8Array(p),e(null,s)},oM=({segment:s,bytes:e,trackInfoFn:i,timingInfoFn:r,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:u,id3Fn:c,captionsFn:p,isEndOfTimeline:g,endedTimelineFn:b,dataFn:S,doneFn:E,onTransmuxerLog:A,triggerSegmentEventFn:M})=>{const U=s.map&&s.map.tracks||{},D=!!(U.audio&&U.video);let z=r.bind(null,s,"audio","start");const H=r.bind(null,s,"audio","end");let Y=r.bind(null,s,"video","start");const $=r.bind(null,s,"video","end"),Q=()=>QS({bytes:e,transmuxer:s.transmuxer,audioAppendStart:s.audioAppendStart,gopsToAlignWith:s.gopsToAlignWith,remux:D,onData:Z=>{Z.type=Z.type==="combined"?"video":Z.type,S(s,Z)},onTrackInfo:Z=>{i&&(D&&(Z.isMuxed=!0),i(s,Z))},onAudioTimingInfo:Z=>{z&&typeof Z.start<"u"&&(z(Z.start),z=null),H&&typeof Z.end<"u"&&H(Z.end)},onVideoTimingInfo:Z=>{Y&&typeof Z.start<"u"&&(Y(Z.start),Y=null),$&&typeof Z.end<"u"&&$(Z.end)},onVideoSegmentTimingInfo:Z=>{const W={pts:{start:Z.start.presentation,end:Z.end.presentation},dts:{start:Z.start.decode,end:Z.end.decode}};M({type:"segmenttransmuxingtiminginfoavailable",segment:s,timingInfo:W}),o(Z)},onAudioSegmentTimingInfo:Z=>{const W={pts:{start:Z.start.pts,end:Z.end.pts},dts:{start:Z.start.dts,end:Z.end.dts}};M({type:"segmenttransmuxingtiminginfoavailable",segment:s,timingInfo:W}),u(Z)},onId3:(Z,W)=>{c(s,Z,W)},onCaptions:Z=>{p(s,[Z])},isEndOfTimeline:g,onEndedTimeline:()=>{b()},onTransmuxerLog:A,onDone:(Z,W)=>{E&&(Z.type=Z.type==="combined"?"video":Z.type,M({type:"segmenttransmuxingcomplete",segment:s}),E(W,s,Z))},segment:s,triggerSegmentEventFn:M});_u({action:"probeTs",transmuxer:s.transmuxer,data:e,baseStartTime:s.baseStartTime,callback:Z=>{s.bytes=e=Z.data;const W=Z.result;W&&(i(s,{hasAudio:W.hasAudio,hasVideo:W.hasVideo,isMuxed:D}),i=null),Q()}})},ex=({segment:s,bytes:e,trackInfoFn:i,timingInfoFn:r,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:u,id3Fn:c,captionsFn:p,isEndOfTimeline:g,endedTimelineFn:b,dataFn:S,doneFn:E,onTransmuxerLog:A,triggerSegmentEventFn:M})=>{let U=new Uint8Array(e);if(NR(U)){s.isFmp4=!0;const{tracks:D}=s.map;if(D.text&&(!D.audio||!D.video)){S(s,{data:U,type:"text"}),sM(s,D.text.codec,E);return}const H={isFmp4:!0,hasVideo:!!D.video,hasAudio:!!D.audio};D.audio&&D.audio.codec&&D.audio.codec!=="enca"&&(H.audioCodec=D.audio.codec),D.video&&D.video.codec&&D.video.codec!=="encv"&&(H.videoCodec=D.video.codec),D.video&&D.audio&&(H.isMuxed=!0),i(s,H);const Y=($,Q)=>{S(s,{data:U,type:H.hasAudio&&!H.isMuxed?"audio":"video"}),Q&&Q.length&&c(s,Q),$&&$.length&&p(s,$),E(null,s,{})};_u({action:"probeMp4StartTime",timescales:s.map.timescales,data:U,transmuxer:s.transmuxer,callback:({data:$,startTime:Q})=>{e=$.buffer,s.bytes=U=$,H.hasAudio&&!H.isMuxed&&r(s,"audio","start",Q),H.hasVideo&&r(s,"video","start",Q),_u({action:"probeEmsgID3",data:U,transmuxer:s.transmuxer,offset:Q,callback:({emsgData:Z,id3Frames:W})=>{if(e=Z.buffer,s.bytes=U=Z,!D.video||!Z.byteLength||!s.transmuxer){Y(void 0,W);return}_u({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:s.transmuxer,data:U,timescales:s.map.timescales,trackIds:[D.video.id],callback:G=>{e=G.data.buffer,s.bytes=U=G.data,G.logs.forEach(function(ee){A(pt(ee,{stream:"mp4CaptionParser"}))}),Y(G.captions,W)}})}})}});return}if(!s.transmuxer){E(null,s,{});return}if(typeof s.container>"u"&&(s.container=m0(U)),s.container!=="ts"&&s.container!=="aac"){i(s,{hasAudio:!1,hasVideo:!1}),E(null,s,{});return}oM({segment:s,bytes:e,trackInfoFn:i,timingInfoFn:r,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:u,id3Fn:c,captionsFn:p,isEndOfTimeline:g,endedTimelineFn:b,dataFn:S,doneFn:E,onTransmuxerLog:A,triggerSegmentEventFn:M})},tx=function({id:s,key:e,encryptedBytes:i,decryptionWorker:r,segment:o,doneFn:u},c){const p=b=>{if(b.data.source===s){r.removeEventListener("message",p);const S=b.data.decrypted;c(new Uint8Array(S.bytes,S.byteOffset,S.byteLength))}};r.onerror=()=>{const b="An error occurred in the decryption worker",S=Po({segment:o}),E={message:b,metadata:{error:new Error(b),errorType:V.Error.StreamingFailedToDecryptSegment,segmentInfo:S,keyInfo:{uri:o.key.resolvedUri||o.map.key.resolvedUri}}};u(E,o)},r.addEventListener("message",p);let g;e.bytes.slice?g=e.bytes.slice():g=new Uint32Array(Array.prototype.slice.call(e.bytes)),r.postMessage(NS({source:s,encrypted:i,key:g,iv:e.iv}),[i.buffer,g.buffer])},lM=({decryptionWorker:s,segment:e,trackInfoFn:i,timingInfoFn:r,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:u,id3Fn:c,captionsFn:p,isEndOfTimeline:g,endedTimelineFn:b,dataFn:S,doneFn:E,onTransmuxerLog:A,triggerSegmentEventFn:M})=>{M({type:"segmentdecryptionstart"}),tx({id:e.requestId,key:e.key,encryptedBytes:e.encryptedBytes,decryptionWorker:s,segment:e,doneFn:E},U=>{e.bytes=U,M({type:"segmentdecryptioncomplete",segment:e}),ex({segment:e,bytes:e.bytes,trackInfoFn:i,timingInfoFn:r,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:u,id3Fn:c,captionsFn:p,isEndOfTimeline:g,endedTimelineFn:b,dataFn:S,doneFn:E,onTransmuxerLog:A,triggerSegmentEventFn:M})})},uM=({activeXhrs:s,decryptionWorker:e,trackInfoFn:i,timingInfoFn:r,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:u,id3Fn:c,captionsFn:p,isEndOfTimeline:g,endedTimelineFn:b,dataFn:S,doneFn:E,onTransmuxerLog:A,triggerSegmentEventFn:M})=>{let U=0,D=!1;return(z,H)=>{if(!D){if(z)return D=!0,ky(s),E(z,H);if(U+=1,U===s.length){const Y=function(){if(H.encryptedBytes)return lM({decryptionWorker:e,segment:H,trackInfoFn:i,timingInfoFn:r,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:u,id3Fn:c,captionsFn:p,isEndOfTimeline:g,endedTimelineFn:b,dataFn:S,doneFn:E,onTransmuxerLog:A,triggerSegmentEventFn:M});ex({segment:H,bytes:H.bytes,trackInfoFn:i,timingInfoFn:r,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:u,id3Fn:c,captionsFn:p,isEndOfTimeline:g,endedTimelineFn:b,dataFn:S,doneFn:E,onTransmuxerLog:A,triggerSegmentEventFn:M})};if(H.endOfAllRequests=Date.now(),H.map&&H.map.encryptedBytes&&!H.map.bytes)return M({type:"segmentdecryptionstart",segment:H}),tx({decryptionWorker:e,id:H.requestId+"-init",encryptedBytes:H.map.encryptedBytes,key:H.map.key,segment:H,doneFn:E},$=>{H.map.bytes=$,M({type:"segmentdecryptioncomplete",segment:H}),JS(H,Q=>{if(Q)return ky(s),E(Q,H);Y()})});Y()}}}},cM=({loadendState:s,abortFn:e})=>i=>{i.target.aborted&&e&&!s.calledAbortFn&&(e(),s.calledAbortFn=!0)},dM=({segment:s,progressFn:e,trackInfoFn:i,timingInfoFn:r,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:u,id3Fn:c,captionsFn:p,isEndOfTimeline:g,endedTimelineFn:b,dataFn:S})=>E=>{if(!E.target.aborted)return s.stats=pt(s.stats,iM(E)),!s.stats.firstBytesReceivedAt&&s.stats.bytesReceived&&(s.stats.firstBytesReceivedAt=Date.now()),e(E,s)},hM=({xhr:s,xhrOptions:e,decryptionWorker:i,segment:r,abortFn:o,progressFn:u,trackInfoFn:c,timingInfoFn:p,videoSegmentTimingInfoFn:g,audioSegmentTimingInfoFn:b,id3Fn:S,captionsFn:E,isEndOfTimeline:A,endedTimelineFn:M,dataFn:U,doneFn:D,onTransmuxerLog:z,triggerSegmentEventFn:H})=>{const Y=[],$=uM({activeXhrs:Y,decryptionWorker:i,trackInfoFn:c,timingInfoFn:p,videoSegmentTimingInfoFn:g,audioSegmentTimingInfoFn:b,id3Fn:S,captionsFn:E,isEndOfTimeline:A,endedTimelineFn:M,dataFn:U,doneFn:D,onTransmuxerLog:z,triggerSegmentEventFn:H});if(r.key&&!r.key.bytes){const ee=[r.key];r.map&&!r.map.bytes&&r.map.key&&r.map.key.resolvedUri===r.key.resolvedUri&&ee.push(r.map.key);const oe=pt(e,{uri:r.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),_e=ZS(r,ee,$,H),fe={uri:r.key.resolvedUri};H({type:"segmentkeyloadstart",segment:r,keyInfo:fe});const xe=s(oe,_e);Y.push(xe)}if(r.map&&!r.map.bytes){if(r.map.key&&(!r.key||r.key.resolvedUri!==r.map.key.resolvedUri)){const xe=pt(e,{uri:r.map.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),ve=ZS(r,[r.map.key],$,H),Ne={uri:r.map.key.resolvedUri};H({type:"segmentkeyloadstart",segment:r,keyInfo:Ne});const at=s(xe,ve);Y.push(at)}const oe=pt(e,{uri:r.map.resolvedUri,responseType:"arraybuffer",headers:Cy(r.map),requestType:"segment-media-initialization"}),_e=rM({segment:r,finishProcessingFn:$,triggerSegmentEventFn:H});H({type:"segmentloadstart",segment:r});const fe=s(oe,_e);Y.push(fe)}const Q=pt(e,{uri:r.part&&r.part.resolvedUri||r.resolvedUri,responseType:"arraybuffer",headers:Cy(r),requestType:"segment"}),Z=aM({segment:r,finishProcessingFn:$,responseType:Q.responseType,triggerSegmentEventFn:H});H({type:"segmentloadstart",segment:r});const W=s(Q,Z);W.addEventListener("progress",dM({segment:r,progressFn:u,trackInfoFn:c,timingInfoFn:p,videoSegmentTimingInfoFn:g,audioSegmentTimingInfoFn:b,id3Fn:S,captionsFn:E,isEndOfTimeline:A,endedTimelineFn:M,dataFn:U})),Y.push(W);const G={};return Y.forEach(ee=>{ee.addEventListener("loadend",cM({loadendState:G,abortFn:o}))}),()=>ky(Y)},Np=$n("PlaylistSelector"),ix=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||""})},Tu=function(s,e){if(!s)return"";const i=P.getComputedStyle(s);return i?i[e]:""},Su=function(s,e){const i=s.slice();s.sort(function(r,o){const u=e(r,o);return u===0?i.indexOf(r)-i.indexOf(o):u})},Ry=function(s,e){let i,r;return s.attributes.BANDWIDTH&&(i=s.attributes.BANDWIDTH),i=i||P.Number.MAX_VALUE,e.attributes.BANDWIDTH&&(r=e.attributes.BANDWIDTH),r=r||P.Number.MAX_VALUE,i-r},fM=function(s,e){let i,r;return s.attributes.RESOLUTION&&s.attributes.RESOLUTION.width&&(i=s.attributes.RESOLUTION.width),i=i||P.Number.MAX_VALUE,e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width&&(r=e.attributes.RESOLUTION.width),r=r||P.Number.MAX_VALUE,i===r&&s.attributes.BANDWIDTH&&e.attributes.BANDWIDTH?s.attributes.BANDWIDTH-e.attributes.BANDWIDTH:i-r};let nx=function(s){const{main:e,bandwidth:i,playerWidth:r,playerHeight:o,playerObjectFit:u,limitRenditionByPlayerDimensions:c,playlistController:p}=s;if(!e)return;const g={bandwidth:i,width:r,height:o,limitRenditionByPlayerDimensions:c};let b=e.playlists;un.isAudioOnly(e)&&(b=p.getAudioTrackPlaylists_(),g.audioOnly=!0);let S=b.map(G=>{let ee;const oe=G.attributes&&G.attributes.RESOLUTION&&G.attributes.RESOLUTION.width,_e=G.attributes&&G.attributes.RESOLUTION&&G.attributes.RESOLUTION.height;return ee=G.attributes&&G.attributes.BANDWIDTH,ee=ee||P.Number.MAX_VALUE,{bandwidth:ee,width:oe,height:_e,playlist:G}});Su(S,(G,ee)=>G.bandwidth-ee.bandwidth),S=S.filter(G=>!un.isIncompatible(G.playlist));let E=S.filter(G=>un.isEnabled(G.playlist));E.length||(E=S.filter(G=>!un.isDisabled(G.playlist)));const A=E.filter(G=>G.bandwidth*fi.BANDWIDTH_VARIANCEG.bandwidth===M.bandwidth)[0];if(c===!1){const G=U||E[0]||S[0];if(G&&G.playlist){let ee="sortedPlaylistReps";return U&&(ee="bandwidthBestRep"),E[0]&&(ee="enabledPlaylistReps"),Np(`choosing ${ix(G)} using ${ee} with options`,g),G.playlist}return Np("could not choose a playlist with options",g),null}const D=A.filter(G=>G.width&&G.height);Su(D,(G,ee)=>G.width-ee.width);const z=D.filter(G=>G.width===r&&G.height===o);M=z[z.length-1];const H=z.filter(G=>G.bandwidth===M.bandwidth)[0];let Y,$,Q;H||(Y=D.filter(G=>u==="cover"?G.width>r&&G.height>o:G.width>r||G.height>o),$=Y.filter(G=>G.width===Y[0].width&&G.height===Y[0].height),M=$[$.length-1],Q=$.filter(G=>G.bandwidth===M.bandwidth)[0]);let Z;if(p.leastPixelDiffSelector){const G=D.map(ee=>(ee.pixelDiff=Math.abs(ee.width-r)+Math.abs(ee.height-o),ee));Su(G,(ee,oe)=>ee.pixelDiff===oe.pixelDiff?oe.bandwidth-ee.bandwidth:ee.pixelDiff-oe.pixelDiff),Z=G[0]}const W=Z||Q||H||U||E[0]||S[0];if(W&&W.playlist){let G="sortedPlaylistReps";return Z?G="leastPixelDiffRep":Q?G="resolutionPlusOneRep":H?G="resolutionBestRep":U?G="bandwidthBestRep":E[0]&&(G="enabledPlaylistReps"),Np(`choosing ${ix(W)} using ${G} with options`,g),W.playlist}return Np("could not choose a playlist with options",g),null};const sx=function(){let s=this.useDevicePixelRatio&&P.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(s=this.customPixelRatio),nx({main:this.playlists.main,bandwidth:this.systemBandwidth,playerWidth:parseInt(Tu(this.tech_.el(),"width"),10)*s,playerHeight:parseInt(Tu(this.tech_.el(),"height"),10)*s,playerObjectFit:this.usePlayerObjectFit?Tu(this.tech_.el(),"objectFit"):"",limitRenditionByPlayerDimensions:this.limitRenditionByPlayerDimensions,playlistController:this.playlistController_})},pM=function(s){let e=-1,i=-1;if(s<0||s>1)throw new Error("Moving average bandwidth decay must be between 0 and 1.");return function(){let r=this.useDevicePixelRatio&&P.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(r=this.customPixelRatio),e<0&&(e=this.systemBandwidth,i=this.systemBandwidth),this.systemBandwidth>0&&this.systemBandwidth!==i&&(e=s*this.systemBandwidth+(1-s)*e,i=this.systemBandwidth),nx({main:this.playlists.main,bandwidth:e,playerWidth:parseInt(Tu(this.tech_.el(),"width"),10)*r,playerHeight:parseInt(Tu(this.tech_.el(),"height"),10)*r,playerObjectFit:this.usePlayerObjectFit?Tu(this.tech_.el(),"objectFit"):"",limitRenditionByPlayerDimensions:this.limitRenditionByPlayerDimensions,playlistController:this.playlistController_})}},mM=function(s){const{main:e,currentTime:i,bandwidth:r,duration:o,segmentDuration:u,timeUntilRebuffer:c,currentTimeline:p,syncController:g}=s,b=e.playlists.filter(U=>!un.isIncompatible(U));let S=b.filter(un.isEnabled);S.length||(S=b.filter(U=>!un.isDisabled(U)));const A=S.filter(un.hasAttribute.bind(null,"BANDWIDTH")).map(U=>{const z=g.getSyncPoint(U,o,p,i)?1:2,Y=un.estimateSegmentRequestTime(u,r,U)*z-c;return{playlist:U,rebufferingImpact:Y}}),M=A.filter(U=>U.rebufferingImpact<=0);return Su(M,(U,D)=>Ry(D.playlist,U.playlist)),M.length?M[0]:(Su(A,(U,D)=>U.rebufferingImpact-D.rebufferingImpact),A[0]||null)},gM=function(){const s=this.playlists.main.playlists.filter(un.isEnabled);return Su(s,(i,r)=>Ry(i,r)),s.filter(i=>!!Md(this.playlists.main,i).video)[0]||null},yM=s=>{let e=0,i;return s.bytes&&(i=new Uint8Array(s.bytes),s.segments.forEach(r=>{i.set(r,e),e+=r.byteLength})),i};function rx(s){try{return new URL(s).pathname.split("/").slice(-2).join("/")}catch{return""}}const vM=function(s,e,i){if(!s[i]){e.trigger({type:"usage",name:"vhs-608"});let r=i;/^cc708_/.test(i)&&(r="SERVICE"+i.split("_")[1]);const o=e.textTracks().getTrackById(r);if(o)s[i]=o;else{const u=e.options_.vhs&&e.options_.vhs.captionServices||{};let c=i,p=i,g=!1;const b=u[r];b&&(c=b.label,p=b.language,g=b.default),s[i]=e.addRemoteTextTrack({kind:"captions",id:r,default:g,label:c,language:p},!1).track}}},bM=function({inbandTextTracks:s,captionArray:e,timestampOffset:i}){if(!e)return;const r=P.WebKitDataCue||P.VTTCue;e.forEach(o=>{const u=o.stream;o.content?o.content.forEach(c=>{const p=new r(o.startTime+i,o.endTime+i,c.text);p.line=c.line,p.align="left",p.position=c.position,p.positionAlign="line-left",s[u].addCue(p)}):s[u].addCue(new r(o.startTime+i,o.endTime+i,o.text))})},_M=function(s){Object.defineProperties(s.frame,{id:{get(){return V.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),s.value.key}},value:{get(){return V.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),s.value.data}},privateData:{get(){return V.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),s.value.data}}})},TM=({inbandTextTracks:s,metadataArray:e,timestampOffset:i,videoDuration:r})=>{if(!e)return;const o=P.WebKitDataCue||P.VTTCue,u=s.metadataTrack_;if(!u||(e.forEach(S=>{const E=S.cueTime+i;typeof E!="number"||P.isNaN(E)||E<0||!(E<1/0)||!S.frames||!S.frames.length||S.frames.forEach(A=>{const M=new o(E,E,A.value||A.url||A.data||"");M.frame=A,M.value=A,_M(M),u.addCue(M)})}),!u.cues||!u.cues.length))return;const c=u.cues,p=[];for(let S=0;S{const A=S[E.startTime]||[];return A.push(E),S[E.startTime]=A,S},{}),b=Object.keys(g).sort((S,E)=>Number(S)-Number(E));b.forEach((S,E)=>{const A=g[S],M=isFinite(r)?r:S,U=Number(b[E+1])||M;A.forEach(D=>{D.endTime=U})})},SM={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"},xM=new Set(["id","class","startDate","duration","endDate","endOnNext","startTime","endTime","processDateRange"]),EM=({inbandTextTracks:s,dateRanges:e})=>{const i=s.metadataTrack_;if(!i)return;const r=P.WebKitDataCue||P.VTTCue;e.forEach(o=>{for(const u of Object.keys(o)){if(xM.has(u))continue;const c=new r(o.startTime,o.endTime,"");c.id=o.id,c.type="com.apple.quicktime.HLS",c.value={key:SM[u],data:o[u]},(u==="scte35Out"||u==="scte35In")&&(c.value.data=new Uint8Array(c.value.data.match(/[\da-f]{2}/gi)).buffer),i.addCue(c)}o.processDateRange()})},ax=(s,e,i)=>{s.metadataTrack_||(s.metadataTrack_=i.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,V.browser.IS_ANY_SAFARI||(s.metadataTrack_.inBandMetadataTrackDispatchType=e))},Ld=function(s,e,i){let r,o;if(i&&i.cues)for(r=i.cues.length;r--;)o=i.cues[r],o.startTime>=s&&o.endTime<=e&&i.removeCue(o)},CM=function(s){const e=s.cues;if(!e)return;const i={};for(let r=e.length-1;r>=0;r--){const o=e[r],u=`${o.startTime}-${o.endTime}-${o.text}`;i[u]?s.removeCue(o):i[u]=o}},AM=(s,e,i)=>{if(typeof e>"u"||e===null||!s.length)return[];const r=Math.ceil((e-i+3)*Ao.ONE_SECOND_IN_TS);let o;for(o=0;or);o++);return s.slice(o)},DM=(s,e,i)=>{if(!e.length)return s;if(i)return e.slice();const r=e[0].pts;let o=0;for(o;o=r);o++);return s.slice(0,o).concat(e)},wM=(s,e,i,r)=>{const o=Math.ceil((e-r)*Ao.ONE_SECOND_IN_TS),u=Math.ceil((i-r)*Ao.ONE_SECOND_IN_TS),c=s.slice();let p=s.length;for(;p--&&!(s[p].pts<=u););if(p===-1)return c;let g=p+1;for(;g--&&!(s[g].pts<=o););return g=Math.max(g,0),c.splice(g,p-g+1),c},kM=function(s,e){if(!s&&!e||!s&&e||s&&!e)return!1;if(s===e)return!0;const i=Object.keys(s).sort(),r=Object.keys(e).sort();if(i.length!==r.length)return!1;for(let o=0;oi))return u}return r.length===0?0:r[r.length-1]},Id=1,RM=500,ox=s=>typeof s=="number"&&isFinite(s),Pp=1/60,MM=(s,e,i)=>s!=="main"||!e||!i?null:!i.hasAudio&&!i.hasVideo?"Neither audio nor video found in segment.":e.hasVideo&&!i.hasVideo?"Only audio found in segment when we expected video. We can't switch to audio only from a stream that had video. To get rid of this message, please add codec information to the manifest.":!e.hasVideo&&i.hasVideo?"Video found in segment when we expected only audio. We can't switch to a stream with video from an audio only stream. To get rid of this message, please add codec information to the manifest.":null,LM=(s,e,i)=>{let r=e-fi.BACK_BUFFER_LENGTH;s.length&&(r=Math.max(r,s.start(0)));const o=e-i;return Math.min(o,r)},xu=s=>{const{startOfSegment:e,duration:i,segment:r,part:o,playlist:{mediaSequence:u,id:c,segments:p=[]},mediaIndex:g,partIndex:b,timeline:S}=s,E=p.length-1;let A="mediaIndex/partIndex increment";s.getMediaInfoForTime?A=`getMediaInfoForTime (${s.getMediaInfoForTime})`:s.isSyncRequest&&(A="getSyncSegmentCandidate (isSyncRequest)"),s.independent&&(A+=` with independent ${s.independent}`);const M=typeof b=="number",U=s.segment.uri?"segment":"pre-segment",D=M?fS({preloadSegment:r})-1:0;return`${U} [${u+g}/${u+E}]`+(M?` part [${b}/${D}]`:"")+` segment start/end [${r.start} => ${r.end}]`+(M?` part start/end [${o.start} => ${o.end}]`:"")+` startOfSegment [${e}] duration [${i}] timeline [${S}] selected by [${A}] playlist [${c}]`},lx=s=>`${s}TimingInfo`,IM=({segmentTimeline:s,currentTimeline:e,startOfSegment:i,buffered:r,overrideCheck:o})=>!o&&s===e?null:s{if(e===i)return!1;if(r==="audio"){const u=s.lastTimelineChange({type:"main"});return!u||u.to!==i}if(r==="main"&&o){const u=s.pendingTimelineChange({type:"audio"});return!(u&&u.to===i)}return!1},NM=s=>{if(!s)return!1;const e=s.pendingTimelineChange({type:"audio"}),i=s.pendingTimelineChange({type:"main"}),r=e&&i,o=r&&e.to!==i.to;return!!(r&&e.from!==-1&&i.from!==-1&&o)},PM=s=>{const e=s.timelineChangeController_.pendingTimelineChange({type:"audio"}),i=s.timelineChangeController_.pendingTimelineChange({type:"main"});return e&&i&&e.to{const e=s.pendingSegment_;if(!e)return;if(My({timelineChangeController:s.timelineChangeController_,currentTimeline:s.currentTimeline_,segmentTimeline:e.timeline,loaderType:s.loaderType_,audioDisabled:s.audioDisabled_})&&NM(s.timelineChangeController_)){if(PM(s)){s.timelineChangeController_.trigger("audioTimelineBehind");return}s.timelineChangeController_.trigger("fixBadTimelineChange")}},UM=s=>{let e=0;return["video","audio"].forEach(function(i){const r=s[`${i}TimingInfo`];if(!r)return;const{start:o,end:u}=r;let c;typeof o=="bigint"||typeof u=="bigint"?c=P.BigInt(u)-P.BigInt(o):typeof o=="number"&&typeof u=="number"&&(c=u-o),typeof c<"u"&&c>e&&(e=c)}),typeof e=="bigint"&&es?Math.round(s)>e+Fs:!1,BM=(s,e)=>{if(e!=="hls")return null;const i=UM({audioTimingInfo:s.audioTimingInfo,videoTimingInfo:s.videoTimingInfo});if(!i)return null;const r=s.playlist.targetDuration,o=ux({segmentDuration:i,maxDuration:r*2}),u=ux({segmentDuration:i,maxDuration:r}),c=`Segment with index ${s.mediaIndex} from playlist ${s.playlist.id} has a duration of ${i} when the reported duration is ${s.duration} and the target duration is ${r}. 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 o||u?{severity:o?"warn":"info",message:c}:null},Po=({type:s,segment:e})=>{if(!e)return;const i=!!(e.key||e.map&&e.map.ke),r=!!(e.map&&!e.map.bytes),o=e.startOfSegment===void 0?e.start:e.startOfSegment;return{type:s||e.type,uri:e.resolvedUri||e.uri,start:o,duration:e.duration,isEncrypted:i,isMediaInitialization:r}};class Ly extends V.EventTarget{constructor(e,i={}){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_=$n(`SegmentLoader[${this.loaderType_}]`),Object.defineProperty(this,"state",{get(){return this.state_},set(r){r!==this.state_&&(this.logger_(`${this.state_} -> ${r}`),this.state_=r,this.trigger("statechange"))}}),this.sourceUpdater_.on("ready",()=>{this.hasEnoughInfoToAppend_()?this.processCallQueue_():ka(this)}),this.sourceUpdater_.on("codecschange",r=>{this.trigger(Ft({type:"codecschange"},r))}),this.loaderType_==="main"&&this.timelineChangeController_.on("pendingtimelinechange",()=>{this.hasEnoughInfoToAppend_()?this.processCallQueue_():ka(this)}),this.loaderType_==="audio"&&this.timelineChangeController_.on("timelinechange",r=>{this.trigger(Ft({type:"timelinechange"},r)),this.hasEnoughInfoToLoad_()?this.processLoadQueue_():ka(this),this.hasEnoughInfoToAppend_()?this.processCallQueue_():ka(this)})}get mediaSequenceSync_(){return this.syncController_.getMediaSequenceSync(this.loaderType_)}createTransmuxer_(){return wy.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_&&P.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,P.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_&&wy.reset(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")}buffered_(){const e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return hi();if(this.loaderType_==="main"){const{hasAudio:i,hasVideo:r,isMuxed:o}=e;if(r&&i&&!this.audioDisabled_&&!o)return this.sourceUpdater_.buffered();if(r)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()}initSegmentForMap(e,i=!1){if(!e)return null;const r=Ip(e);let o=this.initSegments_[r];return i&&!o&&e.bytes&&(this.initSegments_[r]=o={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes,tracks:e.tracks,timescales:e.timescales}),o||e}segmentKey(e,i=!1){if(!e)return null;const r=PS(e);let o=this.keyCache_[r];this.cacheEncryptionKeys_&&i&&!o&&e.bytes&&(this.keyCache_[r]=o={resolvedUri:e.resolvedUri,bytes:e.bytes});const u={resolvedUri:(o||e).resolvedUri};return o&&(u.bytes=o.bytes),u}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,i={}){if(!e||this.playlist_&&this.playlist_.endList&&e.endList&&this.playlist_.uri===e.uri)return;const r=this.playlist_,o=this.pendingSegment_;this.playlist_=e,this.xhrOptions_=i,this.state==="INIT"&&(e.syncInfo={mediaSequence:e.mediaSequence,time:0},this.loaderType_==="main"&&this.syncController_.setDateTimeMappingForStart(e));let u=null;if(r&&(r.id?u=r.id:r.uri&&(u=r.uri)),this.logger_(`playlist update [${u} => ${e.id||e.uri}]`),this.mediaSequenceSync_&&(this.mediaSequenceSync_.update(e,this.currentTime_()),this.logger_(`Playlist update: currentTime: ${this.currentTime_()} bufferedEnd: ${my(this.buffered_())} `,this.mediaSequenceSync_.diagnostics)),this.trigger("syncinfoupdate"),this.state==="INIT"&&this.couldBeginLoading_())return this.init_();if(!r||r.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 c=e.mediaSequence-r.mediaSequence;if(this.logger_(`live window shift [${c}]`),this.mediaIndex!==null)if(this.mediaIndex-=c,this.mediaIndex<0)this.mediaIndex=null,this.partIndex=null;else{const p=this.playlist_.segments[this.mediaIndex];if(this.partIndex&&(!p.parts||!p.parts.length||!p.parts[this.partIndex])){const g=this.mediaIndex;this.logger_(`currently processing part (index ${this.partIndex}) no longer exists.`),this.resetLoader(),this.mediaIndex=g}}o&&(o.mediaIndex-=c,o.mediaIndex<0?(o.mediaIndex=null,o.partIndex=null):(o.mediaIndex>=0&&(o.segment=e.segments[o.mediaIndex]),o.partIndex>=0&&o.segment.parts&&(o.part=o.segment.parts[o.partIndex]))),this.syncController_.saveExpiredSegmentInfo(r,e)}pause(){this.checkBufferTimeout_&&(P.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_&&wy.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,i,r=()=>{},o=!1){if(i===1/0&&(i=this.duration_()),i<=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 u=1;const c=()=>{u--,u===0&&r()};(o||!this.audioDisabled_)&&(u++,this.sourceUpdater_.removeAudio(e,i,c)),(o||this.loaderType_==="main")&&(this.gopBuffer_=wM(this.gopBuffer_,e,i,this.timeMapping_),u++,this.sourceUpdater_.removeVideo(e,i,c));for(const p in this.inbandTextTracks_)Ld(e,i,this.inbandTextTracks_[p]);Ld(e,i,this.segmentMetadataTrack_),c()}monitorBuffer_(){this.checkBufferTimeout_&&P.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=P.setTimeout(this.monitorBufferTick_.bind(this),1)}monitorBufferTick_(){this.state==="READY"&&this.fillBuffer_(),this.checkBufferTimeout_&&P.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=P.setTimeout(this.monitorBufferTick_.bind(this),RM)}fillBuffer_(){if(this.sourceUpdater_.updating())return;const e=this.chooseNextRequest_();if(!e)return;const i={segmentInfo:Po({type:this.loaderType_,segment:e})};this.trigger({type:"segmentselected",metadata:i}),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,i=this.playlist_,r=this.partIndex){if(!i||!this.mediaSource_)return!1;const o=typeof e=="number"&&i.segments[e],u=e+1===i.segments.length,c=!o||!o.parts||r+1===o.parts.length;return i.endList&&this.mediaSource_.readyState==="open"&&u&&c}chooseNextRequest_(){const e=this.buffered_(),i=my(e)||0,r=gy(e,this.currentTime_()),o=!this.hasPlayed_()&&r>=1,u=r>=this.goalBufferLength_(),c=this.playlist_.segments;if(!c.length||o||u)return null;this.syncPoint_=this.syncPoint_||this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_(),this.loaderType_);const p={partIndex:null,mediaIndex:null,startOfSegment:null,playlist:this.playlist_,isSyncRequest:!this.syncPoint_};if(p.isSyncRequest)p.mediaIndex=OM(this.currentTimeline_,c,i),this.logger_(`choose next request. Can not find sync point. Fallback to media Index: ${p.mediaIndex}`);else if(this.mediaIndex!==null){const A=c[this.mediaIndex],M=typeof this.partIndex=="number"?this.partIndex:-1;p.startOfSegment=A.end?A.end:i,A.parts&&A.parts[M+1]?(p.mediaIndex=this.mediaIndex,p.partIndex=M+1):p.mediaIndex=this.mediaIndex+1}else{let A,M,U;const D=this.fetchAtBuffer_?i:this.currentTime_();if(this.mediaSequenceSync_&&this.logger_(`chooseNextRequest_ request after Quality Switch: @@ -488,28 +488,21 @@ For TargetTime: ${D}. CurrentTime: ${this.currentTime_()} BufferedEnd: ${i} Fetch At Buffer: ${this.fetchAtBuffer_} -`,this.mediaSequenceSync_.diagnostics),this.mediaSequenceSync_&&this.mediaSequenceSync_.isReliable){const z=this.getSyncInfoFromMediaSequenceSync_(D);if(!z){const H="No sync info found while using media sequence sync";return this.error({message:H,metadata:{errorType:$.Error.StreamingFailedToSelectNextSegment,error:new Error(H)}}),this.logger_("chooseNextRequest_ - no sync info found using media sequence sync"),null}this.logger_(`chooseNextRequest_ mediaSequence syncInfo (${z.start} --> ${z.end})`),A=z.segmentIndex,M=z.partIndex,U=z.start}else{this.logger_("chooseNextRequest_ - fallback to a regular segment selection algorithm, based on a syncPoint.");const z=un.getMediaInfoForTime({exactManifestTimings:this.exactManifestTimings,playlist:this.playlist_,currentTime:D,startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time});A=z.segmentIndex,M=z.partIndex,U=z.startTime}p.getMediaInfoForTime=this.fetchAtBuffer_?`bufferedEnd ${D}`:`currentTime ${D}`,p.mediaIndex=A,p.startOfSegment=U,p.partIndex=M,this.logger_(`choose next request. Playlist switched and we have a sync point. Media Index: ${p.mediaIndex} `)}const g=c[p.mediaIndex];let b=g&&typeof p.partIndex=="number"&&g.parts&&g.parts[p.partIndex];if(!g||typeof p.partIndex=="number"&&!b)return null;typeof p.partIndex!="number"&&g.parts&&(p.partIndex=0,b=g.parts[0]);const S=this.vhs_.playlists&&this.vhs_.playlists.main&&this.vhs_.playlists.main.independentSegments||this.playlist_.independentSegments;if(!r&&b&&!S&&!b.independent)if(p.partIndex===0){const A=c[p.mediaIndex-1],M=A.parts&&A.parts.length&&A.parts[A.parts.length-1];M&&M.independent&&(p.mediaIndex-=1,p.partIndex=A.parts.length-1,p.independent="previous segment")}else g.parts[p.partIndex-1].independent&&(p.partIndex-=1,p.independent="previous part");const E=this.mediaSource_&&this.mediaSource_.readyState==="ended";return p.mediaIndex>=c.length-1&&E&&!this.seeking_()?null:(this.shouldForceTimestampOffsetAfterResync_&&(this.shouldForceTimestampOffsetAfterResync_=!1,p.forceTimestampOffset=!0,this.logger_("choose next request. Force timestamp offset after loader resync")),this.generateSegmentInfo_(p))}getSyncInfoFromMediaSequenceSync_(e){if(!this.mediaSequenceSync_)return null;const i=Math.max(e,this.mediaSequenceSync_.start);e!==i&&this.logger_(`getSyncInfoFromMediaSequenceSync_. Pulled target time from ${e} to ${i}`);const r=this.mediaSequenceSync_.getSyncInfoForTime(i);if(!r)return null;if(!r.isAppended)return r;const o=this.mediaSequenceSync_.getSyncInfoForTime(r.end);return o?(o.isAppended&&this.logger_("getSyncInfoFromMediaSequenceSync_: We encounter unexpected scenario where next media sequence sync info is also appended!"),o):null}generateSegmentInfo_(e){const{independent:i,playlist:r,mediaIndex:o,startOfSegment:u,isSyncRequest:c,partIndex:p,forceTimestampOffset:g,getMediaInfoForTime:b}=e,S=r.segments[o],E=typeof p=="number"&&S.parts[p],A={requestId:"segment-loader-"+Math.random(),uri:E&&E.resolvedUri||S.resolvedUri,mediaIndex:o,partIndex:E?p:null,isSyncRequest:c,startOfSegment:u,playlist:r,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:S.timeline,duration:E&&E.duration||S.duration,segment:S,part:E,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:b,independent:i},M=typeof g<"u"?g:this.isPendingTimestampOffset_;A.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:S.timeline,currentTimeline:this.currentTimeline_,startOfSegment:u,buffered:this.buffered_(),overrideCheck:M});const U=my(this.sourceUpdater_.audioBuffered());return typeof U=="number"&&(A.audioAppendStart=U-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(A.gopsToAlignWith=AM(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),A}timestampOffsetForSegment_(e){return IM(e)}earlyAbortWhenNeeded_(e){if(this.vhs_.tech_.paused()||!this.xhrOptions_.timeout||!this.playlist_.attributes.BANDWIDTH||Date.now()-(e.firstBytesReceivedAt||Date.now())<1e3)return;const i=this.currentTime_(),r=e.bandwidth,o=this.pendingSegment_.duration,u=un.estimateSegmentRequestTime(o,r,this.playlist_,e.bytesReceived),c=r4(this.buffered_(),i,this.vhs_.tech_.playbackRate())-1;if(u<=c)return;const p=mM({main:this.vhs_.playlists.main,currentTime:i,bandwidth:r,duration:this.duration_(),segmentDuration:o,timeUntilRebuffer:c,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(!p)return;const b=u-c-p.rebufferingImpact;let S=.5;c<=Fs&&(S=1),!(!p.playlist||p.playlist.uri===this.playlist_.uri||b{u[c.stream]=u[c.stream]||{startTime:1/0,captions:[],endTime:0};const p=u[c.stream];p.startTime=Math.min(p.startTime,c.startTime+o),p.endTime=Math.max(p.endTime,c.endTime+o),p.captions.push(c)}),Object.keys(u).forEach(c=>{const{startTime:p,endTime:g,captions:b}=u[c],S=this.inbandTextTracks_;this.logger_(`adding cues from ${p} -> ${g} for ${c}`),vM(S,this.vhs_.tech_,c),Ld(p,g,S[c]),bM({captionArray:b,inbandTextTracks:S,timestampOffset:o})}),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}handleId3_(e,i,r){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(!this.pendingSegment_.hasAppendedData_){this.metadataQueue_.id3.push(this.handleId3_.bind(this,e,i,r));return}this.addMetadataToTextTrack(r,i,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(i=>i())}processLoadQueue_(){const e=this.loadQueue_;this.loadQueue_=[],e.forEach(i=>i())}hasEnoughInfoToLoad_(){if(this.loaderType_!=="audio")return!0;const e=this.pendingSegment_;return e?this.getCurrentMediaInfo_()?!My({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_,i=this.getCurrentMediaInfo_();if(!e||!i)return!1;const{hasAudio:r,hasVideo:o,isMuxed:u}=i;return!(o&&!e.videoTimingInfo||r&&!this.audioDisabled_&&!u&&!e.audioTimingInfo||My({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))}handleData_(e,i){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(this.callQueue_.length||!this.hasEnoughInfoToAppend_()){ka(this),this.callQueue_.push(this.handleData_.bind(this,e,i));return}const r=this.pendingSegment_;if(this.setTimeMapping_(r.timeline),this.updateMediaSecondsLoaded_(r.part||r.segment),this.mediaSource_.readyState!=="closed"){if(e.map&&(e.map=this.initSegmentForMap(e.map,!0),r.segment.map=e.map),e.key&&this.segmentKey(e.key,!0),r.isFmp4=e.isFmp4,r.timingInfo=r.timingInfo||{},r.isFmp4)this.trigger("fmp4"),r.timingInfo.start=r[lx(i.type)].start;else{const o=this.getCurrentMediaInfo_(),u=this.loaderType_==="main"&&o&&o.hasVideo;let c;u&&(c=r.videoTimingInfo.start),r.timingInfo.start=this.trueSegmentStart_({currentStart:r.timingInfo.start,playlist:r.playlist,mediaIndex:r.mediaIndex,currentVideoTimestampOffset:this.sourceUpdater_.videoTimestampOffset(),useVideoTimingInfo:u,firstVideoFrameTimeForData:c,videoTimingInfo:r.videoTimingInfo,audioTimingInfo:r.audioTimingInfo})}if(this.updateAppendInitSegmentStatus(r,i.type),this.updateSourceBufferTimestampOffset_(r),r.isSyncRequest){this.updateTimingInfoEnd_(r),this.syncController_.saveSegmentTimingInfo({segmentInfo:r,shouldSaveTimelineMapping:this.loaderType_==="main"});const o=this.chooseNextRequest_();if(o.mediaIndex!==r.mediaIndex||o.partIndex!==r.partIndex){this.logger_("sync segment was incorrect, not appending");return}this.logger_("sync segment was correct, appending")}r.hasAppendedData_=!0,this.processMetadataQueue_(),this.appendData_(r,i)}}updateAppendInitSegmentStatus(e,i){this.loaderType_==="main"&&typeof e.timestampOffset=="number"&&!e.changedTimestampOffset&&(this.appendInitSegment_={audio:!0,video:!0}),this.playlistOfLastInitSegment_[i]!==e.playlist&&(this.appendInitSegment_[i]=!0)}getInitSegmentAndUpdateState_({type:e,initSegment:i,map:r,playlist:o}){if(r){const u=Ip(r);if(this.activeInitSegmentId_===u)return null;i=this.initSegmentForMap(r,!0).bytes,this.activeInitSegmentId_=u}return i&&this.appendInitSegment_[e]?(this.playlistOfLastInitSegment_[e]=o,this.appendInitSegment_[e]=!1,this.activeInitSegmentId_=null,i):null}handleQuotaExceededError_({segmentInfo:e,type:i,bytes:r},o){const u=this.sourceUpdater_.audioBuffered(),c=this.sourceUpdater_.videoBuffered();u.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: "+Io(u).join(", ")),c.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: "+Io(c).join(", "));const p=u.length?u.start(0):0,g=u.length?u.end(u.length-1):0,b=c.length?c.start(0):0,S=c.length?c.end(c.length-1):0;if(g-p<=Id&&S-b<=Id){this.logger_(`On QUOTA_EXCEEDED_ERR, single segment too large to append to buffer, triggering an error. Appended byte length: ${r.byteLength}, audio buffer: ${Io(u).join(", ")}, video buffer: ${Io(c).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:i,bytes:r}));const A=this.currentTime_()-Id;this.logger_(`On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to ${A}`),this.remove(0,A,()=>{this.logger_(`On QUOTA_EXCEEDED_ERR, retrying append in ${Id}s`),this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=P.setTimeout(()=>{this.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),this.quotaExceededErrorRetryTimeout_=null,this.processCallQueue_()},Id*1e3)},!0)}handleAppendError_({segmentInfo:e,type:i,bytes:r},o){if(o){if(o.code===AS){this.handleQuotaExceededError_({segmentInfo:e,type:i,bytes:r});return}this.logger_("Received non QUOTA_EXCEEDED_ERR on append",o),this.error({message:`${i} append of ${r.length}b failed for segment #${e.mediaIndex} in playlist ${e.playlist.id}`,metadata:{errorType:$.Error.StreamingFailedToAppendSegment}}),this.trigger("appenderror")}}appendToSourceBuffer_({segmentInfo:e,type:i,initSegment:r,data:o,bytes:u}){if(!u){const p=[o];let g=o.byteLength;r&&(p.unshift(r),g+=r.byteLength),u=yM({bytes:g,segments:p})}const c={segmentInfo:Po({type:this.loaderType_,segment:e})};this.trigger({type:"segmentappendstart",metadata:c}),this.sourceUpdater_.appendBuffer({segmentInfo:e,type:i,bytes:u},this.handleAppendError_.bind(this,{segmentInfo:e,type:i,bytes:u}))}handleSegmentTimingInfo_(e,i,r){if(!this.pendingSegment_||i!==this.pendingSegment_.requestId)return;const o=this.pendingSegment_.segment,u=`${e}TimingInfo`;o[u]||(o[u]={}),o[u].transmuxerPrependedSeconds=r.prependedContentDuration||0,o[u].transmuxedPresentationStart=r.start.presentation,o[u].transmuxedDecodeStart=r.start.decode,o[u].transmuxedPresentationEnd=r.end.presentation,o[u].transmuxedDecodeEnd=r.end.decode,o[u].baseMediaDecodeTime=r.baseMediaDecodeTime}appendData_(e,i){const{type:r,data:o}=i;if(!o||!o.byteLength||r==="audio"&&this.audioDisabled_)return;const u=this.getInitSegmentAndUpdateState_({type:r,initSegment:i.initSegment,playlist:e.playlist,map:e.isFmp4?e.segment.map:null});this.appendToSourceBuffer_({segmentInfo:e,type:r,initSegment:u,data:o})}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_()){ka(this),this.loadQueue_.push(()=>{const i=Ft({},e,{forceTimestampOffset:!0});Ft(e,this.generateSegmentInfo_(i)),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 i=this.createSimplifiedSegmentObj_(e),r=this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex),o=this.mediaIndex!==null,u=e.timeline!==this.currentTimeline_&&e.timeline>0,c=r||o&&u;this.logger_(`Requesting +`,this.mediaSequenceSync_.diagnostics),this.mediaSequenceSync_&&this.mediaSequenceSync_.isReliable){const z=this.getSyncInfoFromMediaSequenceSync_(D);if(!z){const H="No sync info found while using media sequence sync";return this.error({message:H,metadata:{errorType:V.Error.StreamingFailedToSelectNextSegment,error:new Error(H)}}),this.logger_("chooseNextRequest_ - no sync info found using media sequence sync"),null}this.logger_(`chooseNextRequest_ mediaSequence syncInfo (${z.start} --> ${z.end})`),A=z.segmentIndex,M=z.partIndex,U=z.start}else{this.logger_("chooseNextRequest_ - fallback to a regular segment selection algorithm, based on a syncPoint.");const z=un.getMediaInfoForTime({exactManifestTimings:this.exactManifestTimings,playlist:this.playlist_,currentTime:D,startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time});A=z.segmentIndex,M=z.partIndex,U=z.startTime}p.getMediaInfoForTime=this.fetchAtBuffer_?`bufferedEnd ${D}`:`currentTime ${D}`,p.mediaIndex=A,p.startOfSegment=U,p.partIndex=M,this.logger_(`choose next request. Playlist switched and we have a sync point. Media Index: ${p.mediaIndex} `)}const g=c[p.mediaIndex];let b=g&&typeof p.partIndex=="number"&&g.parts&&g.parts[p.partIndex];if(!g||typeof p.partIndex=="number"&&!b)return null;typeof p.partIndex!="number"&&g.parts&&(p.partIndex=0,b=g.parts[0]);const S=this.vhs_.playlists&&this.vhs_.playlists.main&&this.vhs_.playlists.main.independentSegments||this.playlist_.independentSegments;if(!r&&b&&!S&&!b.independent)if(p.partIndex===0){const A=c[p.mediaIndex-1],M=A.parts&&A.parts.length&&A.parts[A.parts.length-1];M&&M.independent&&(p.mediaIndex-=1,p.partIndex=A.parts.length-1,p.independent="previous segment")}else g.parts[p.partIndex-1].independent&&(p.partIndex-=1,p.independent="previous part");const E=this.mediaSource_&&this.mediaSource_.readyState==="ended";return p.mediaIndex>=c.length-1&&E&&!this.seeking_()?null:(this.shouldForceTimestampOffsetAfterResync_&&(this.shouldForceTimestampOffsetAfterResync_=!1,p.forceTimestampOffset=!0,this.logger_("choose next request. Force timestamp offset after loader resync")),this.generateSegmentInfo_(p))}getSyncInfoFromMediaSequenceSync_(e){if(!this.mediaSequenceSync_)return null;const i=Math.max(e,this.mediaSequenceSync_.start);e!==i&&this.logger_(`getSyncInfoFromMediaSequenceSync_. Pulled target time from ${e} to ${i}`);const r=this.mediaSequenceSync_.getSyncInfoForTime(i);if(!r)return null;if(!r.isAppended)return r;const o=this.mediaSequenceSync_.getSyncInfoForTime(r.end);return o?(o.isAppended&&this.logger_("getSyncInfoFromMediaSequenceSync_: We encounter unexpected scenario where next media sequence sync info is also appended!"),o):null}generateSegmentInfo_(e){const{independent:i,playlist:r,mediaIndex:o,startOfSegment:u,isSyncRequest:c,partIndex:p,forceTimestampOffset:g,getMediaInfoForTime:b}=e,S=r.segments[o],E=typeof p=="number"&&S.parts[p],A={requestId:"segment-loader-"+Math.random(),uri:E&&E.resolvedUri||S.resolvedUri,mediaIndex:o,partIndex:E?p:null,isSyncRequest:c,startOfSegment:u,playlist:r,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:S.timeline,duration:E&&E.duration||S.duration,segment:S,part:E,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:b,independent:i},M=typeof g<"u"?g:this.isPendingTimestampOffset_;A.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:S.timeline,currentTimeline:this.currentTimeline_,startOfSegment:u,buffered:this.buffered_(),overrideCheck:M});const U=my(this.sourceUpdater_.audioBuffered());return typeof U=="number"&&(A.audioAppendStart=U-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(A.gopsToAlignWith=AM(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),A}timestampOffsetForSegment_(e){return IM(e)}earlyAbortWhenNeeded_(e){if(this.vhs_.tech_.paused()||!this.xhrOptions_.timeout||!this.playlist_.attributes.BANDWIDTH||Date.now()-(e.firstBytesReceivedAt||Date.now())<1e3)return;const i=this.currentTime_(),r=e.bandwidth,o=this.pendingSegment_.duration,u=un.estimateSegmentRequestTime(o,r,this.playlist_,e.bytesReceived),c=r4(this.buffered_(),i,this.vhs_.tech_.playbackRate())-1;if(u<=c)return;const p=mM({main:this.vhs_.playlists.main,currentTime:i,bandwidth:r,duration:this.duration_(),segmentDuration:o,timeUntilRebuffer:c,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(!p)return;const b=u-c-p.rebufferingImpact;let S=.5;c<=Fs&&(S=1),!(!p.playlist||p.playlist.uri===this.playlist_.uri||b{u[c.stream]=u[c.stream]||{startTime:1/0,captions:[],endTime:0};const p=u[c.stream];p.startTime=Math.min(p.startTime,c.startTime+o),p.endTime=Math.max(p.endTime,c.endTime+o),p.captions.push(c)}),Object.keys(u).forEach(c=>{const{startTime:p,endTime:g,captions:b}=u[c],S=this.inbandTextTracks_;this.logger_(`adding cues from ${p} -> ${g} for ${c}`),vM(S,this.vhs_.tech_,c),Ld(p,g,S[c]),bM({captionArray:b,inbandTextTracks:S,timestampOffset:o})}),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}handleId3_(e,i,r){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(!this.pendingSegment_.hasAppendedData_){this.metadataQueue_.id3.push(this.handleId3_.bind(this,e,i,r));return}this.addMetadataToTextTrack(r,i,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(i=>i())}processLoadQueue_(){const e=this.loadQueue_;this.loadQueue_=[],e.forEach(i=>i())}hasEnoughInfoToLoad_(){if(this.loaderType_!=="audio")return!0;const e=this.pendingSegment_;return e?this.getCurrentMediaInfo_()?!My({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_,i=this.getCurrentMediaInfo_();if(!e||!i)return!1;const{hasAudio:r,hasVideo:o,isMuxed:u}=i;return!(o&&!e.videoTimingInfo||r&&!this.audioDisabled_&&!u&&!e.audioTimingInfo||My({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))}handleData_(e,i){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(this.callQueue_.length||!this.hasEnoughInfoToAppend_()){ka(this),this.callQueue_.push(this.handleData_.bind(this,e,i));return}const r=this.pendingSegment_;if(this.setTimeMapping_(r.timeline),this.updateMediaSecondsLoaded_(r.part||r.segment),this.mediaSource_.readyState!=="closed"){if(e.map&&(e.map=this.initSegmentForMap(e.map,!0),r.segment.map=e.map),e.key&&this.segmentKey(e.key,!0),r.isFmp4=e.isFmp4,r.timingInfo=r.timingInfo||{},r.isFmp4)this.trigger("fmp4"),r.timingInfo.start=r[lx(i.type)].start;else{const o=this.getCurrentMediaInfo_(),u=this.loaderType_==="main"&&o&&o.hasVideo;let c;u&&(c=r.videoTimingInfo.start),r.timingInfo.start=this.trueSegmentStart_({currentStart:r.timingInfo.start,playlist:r.playlist,mediaIndex:r.mediaIndex,currentVideoTimestampOffset:this.sourceUpdater_.videoTimestampOffset(),useVideoTimingInfo:u,firstVideoFrameTimeForData:c,videoTimingInfo:r.videoTimingInfo,audioTimingInfo:r.audioTimingInfo})}if(this.updateAppendInitSegmentStatus(r,i.type),this.updateSourceBufferTimestampOffset_(r),r.isSyncRequest){this.updateTimingInfoEnd_(r),this.syncController_.saveSegmentTimingInfo({segmentInfo:r,shouldSaveTimelineMapping:this.loaderType_==="main"});const o=this.chooseNextRequest_();if(o.mediaIndex!==r.mediaIndex||o.partIndex!==r.partIndex){this.logger_("sync segment was incorrect, not appending");return}this.logger_("sync segment was correct, appending")}r.hasAppendedData_=!0,this.processMetadataQueue_(),this.appendData_(r,i)}}updateAppendInitSegmentStatus(e,i){this.loaderType_==="main"&&typeof e.timestampOffset=="number"&&!e.changedTimestampOffset&&(this.appendInitSegment_={audio:!0,video:!0}),this.playlistOfLastInitSegment_[i]!==e.playlist&&(this.appendInitSegment_[i]=!0)}getInitSegmentAndUpdateState_({type:e,initSegment:i,map:r,playlist:o}){if(r){const u=Ip(r);if(this.activeInitSegmentId_===u)return null;i=this.initSegmentForMap(r,!0).bytes,this.activeInitSegmentId_=u}return i&&this.appendInitSegment_[e]?(this.playlistOfLastInitSegment_[e]=o,this.appendInitSegment_[e]=!1,this.activeInitSegmentId_=null,i):null}handleQuotaExceededError_({segmentInfo:e,type:i,bytes:r},o){const u=this.sourceUpdater_.audioBuffered(),c=this.sourceUpdater_.videoBuffered();u.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: "+Io(u).join(", ")),c.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: "+Io(c).join(", "));const p=u.length?u.start(0):0,g=u.length?u.end(u.length-1):0,b=c.length?c.start(0):0,S=c.length?c.end(c.length-1):0;if(g-p<=Id&&S-b<=Id){this.logger_(`On QUOTA_EXCEEDED_ERR, single segment too large to append to buffer, triggering an error. Appended byte length: ${r.byteLength}, audio buffer: ${Io(u).join(", ")}, video buffer: ${Io(c).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:i,bytes:r}));const A=this.currentTime_()-Id;this.logger_(`On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to ${A}`),this.remove(0,A,()=>{this.logger_(`On QUOTA_EXCEEDED_ERR, retrying append in ${Id}s`),this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=P.setTimeout(()=>{this.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),this.quotaExceededErrorRetryTimeout_=null,this.processCallQueue_()},Id*1e3)},!0)}handleAppendError_({segmentInfo:e,type:i,bytes:r},o){if(o){if(o.code===AS){this.handleQuotaExceededError_({segmentInfo:e,type:i,bytes:r});return}this.logger_("Received non QUOTA_EXCEEDED_ERR on append",o),this.error({message:`${i} append of ${r.length}b failed for segment #${e.mediaIndex} in playlist ${e.playlist.id}`,metadata:{errorType:V.Error.StreamingFailedToAppendSegment}}),this.trigger("appenderror")}}appendToSourceBuffer_({segmentInfo:e,type:i,initSegment:r,data:o,bytes:u}){if(!u){const p=[o];let g=o.byteLength;r&&(p.unshift(r),g+=r.byteLength),u=yM({bytes:g,segments:p})}const c={segmentInfo:Po({type:this.loaderType_,segment:e})};this.trigger({type:"segmentappendstart",metadata:c}),this.sourceUpdater_.appendBuffer({segmentInfo:e,type:i,bytes:u},this.handleAppendError_.bind(this,{segmentInfo:e,type:i,bytes:u}))}handleSegmentTimingInfo_(e,i,r){if(!this.pendingSegment_||i!==this.pendingSegment_.requestId)return;const o=this.pendingSegment_.segment,u=`${e}TimingInfo`;o[u]||(o[u]={}),o[u].transmuxerPrependedSeconds=r.prependedContentDuration||0,o[u].transmuxedPresentationStart=r.start.presentation,o[u].transmuxedDecodeStart=r.start.decode,o[u].transmuxedPresentationEnd=r.end.presentation,o[u].transmuxedDecodeEnd=r.end.decode,o[u].baseMediaDecodeTime=r.baseMediaDecodeTime}appendData_(e,i){const{type:r,data:o}=i;if(!o||!o.byteLength||r==="audio"&&this.audioDisabled_)return;const u=this.getInitSegmentAndUpdateState_({type:r,initSegment:i.initSegment,playlist:e.playlist,map:e.isFmp4?e.segment.map:null});this.appendToSourceBuffer_({segmentInfo:e,type:r,initSegment:u,data:o})}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_()){ka(this),this.loadQueue_.push(()=>{const i=Ft({},e,{forceTimestampOffset:!0});Ft(e,this.generateSegmentInfo_(i)),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 i=this.createSimplifiedSegmentObj_(e),r=this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex),o=this.mediaIndex!==null,u=e.timeline!==this.currentTimeline_&&e.timeline>0,c=r||o&&u;this.logger_(`Requesting ${rx(e.uri)} -${xu(e)}`),i.map&&!i.map.bytes&&(this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0}),e.abortRequests=hM({xhr:this.vhs_.xhr,xhrOptions:this.xhrOptions_,decryptionWorker:this.decrypter_,segment:i,abortFn:this.handleAbort_.bind(this,e),progressFn:this.handleProgress_.bind(this),trackInfoFn:this.handleTrackInfo_.bind(this),timingInfoFn:this.handleTimingInfo_.bind(this),videoSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"video",e.requestId),audioSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"audio",e.requestId),captionsFn:this.handleCaptions_.bind(this),isEndOfTimeline:c,endedTimelineFn:()=>{this.logger_("received endedtimeline callback")},id3Fn:this.handleId3_.bind(this),dataFn:this.handleData_.bind(this),doneFn:this.segmentRequestFinished_.bind(this),onTransmuxerLog:({message:p,level:g,stream:b})=>{this.logger_(`${xu(e)} logged from transmuxer stream ${b} as a ${g}: ${p}`)},triggerSegmentEventFn:({type:p,segment:g,keyInfo:b,trackInfo:S,timingInfo:E})=>{const M={segmentInfo:Po({segment:g})};b&&(M.keyInfo=b),S&&(M.trackInfo=S),E&&(M.timingInfo=E),this.trigger({type:p,metadata:M})}})}trimBackBuffer_(e){const i=LM(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);i>0&&this.remove(0,i)}createSimplifiedSegmentObj_(e){const i=e.segment,r=e.part,o=e.segment.key||e.segment.map&&e.segment.map.key,u=e.segment.map&&!e.segment.map.bytes,c={resolvedUri:r?r.resolvedUri:i.resolvedUri,byterange:r?r.byterange:i.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:o,isMediaInitialization:u},p=e.playlist.segments[e.mediaIndex-1];if(p&&p.timeline===i.timeline&&(p.videoTimingInfo?c.baseStartTime=p.videoTimingInfo.transmuxedDecodeEnd:p.audioTimingInfo&&(c.baseStartTime=p.audioTimingInfo.transmuxedDecodeEnd)),i.key){const g=i.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]);c.key=this.segmentKey(i.key),c.key.iv=g}return i.map&&(c.map=this.initSegmentForMap(i.map)),c}saveTransferStats_(e){this.mediaRequests+=1,e&&(this.mediaBytesTransferred+=e.bytesReceived,this.mediaTransferDuration+=e.roundTripTime)}saveBandwidthRelatedStats_(e,i){if(this.pendingSegment_.byteLength=i.bytesReceived,e"u"||b.end!==o+u?o:p.start}waitForAppendsToComplete_(e){const i=this.getCurrentMediaInfo_(e);if(!i){this.error({message:"No starting media returned, likely due to an unsupported media format.",playlistExclusionDuration:1/0}),this.trigger("error");return}const{hasAudio:r,hasVideo:o,isMuxed:u}=i,c=this.loaderType_==="main"&&o,p=!this.audioDisabled_&&r&&!u;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}c&&e.waitingOnAppends++,p&&e.waitingOnAppends++,c&&this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this,e)),p&&this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this,e))}checkAppendsDone_(e){this.checkForAbort_(e.requestId)||(e.waitingOnAppends--,e.waitingOnAppends===0&&this.handleAppendsDone_())}checkForIllegalMediaSwitch(e){const i=MM(this.loaderType_,this.getCurrentMediaInfo_(),e);return i?(this.error({message:i,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 i=!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),i=!0),e.timestampOffset!==this.sourceUpdater_.audioTimestampOffset()&&(this.sourceUpdater_.audioTimestampOffset(e.timestampOffset),i=!0),i&&this.trigger("timestampoffset")}getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e,audioTimingInfo:i,timingInfo:r}){return this.useDtsForTimestampOffset_?e&&typeof e.transmuxedDecodeStart=="number"?e.transmuxedDecodeStart:i&&typeof i.transmuxedDecodeStart=="number"?i.transmuxedDecodeStart:r.start:r.start}updateTimingInfoEnd_(e){e.timingInfo=e.timingInfo||{};const i=this.getMediaInfo_(),o=this.loaderType_==="main"&&i&&i.hasVideo&&e.videoTimingInfo?e.videoTimingInfo:e.audioTimingInfo;o&&(e.timingInfo.end=typeof o.end=="number"?o.end:o.start+e.duration)}handleAppendsDone_(){if(this.pendingSegment_){const g={segmentInfo:Po({type:this.loaderType_,segment:this.pendingSegment_})};this.trigger({type:"appendsdone",metadata:g})}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 i=BM(e,this.sourceType_);if(i&&(i.severity==="warn"?$.log.warn(i.message):this.logger_(i.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 ${xu(e)}`);return}this.logger_(`Appended ${xu(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 r=e.segment,o=e.part,u=r.end&&this.currentTime_()-r.end>e.playlist.targetDuration*3,c=o&&o.end&&this.currentTime_()-o.end>e.playlist.partTargetDuration*3;if(u||c){this.logger_(`bad ${u?"segment":"part"} ${xu(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.duratione.toUpperCase())},FM=["video","audio"],Iy=(s,e)=>{const i=e[`${s}Buffer`];return i&&i.updating||e.queuePending[s]},HM=(s,e)=>{for(let i=0;i{if(e.queue.length===0)return;let i=0,r=e.queue[i];if(r.type==="mediaSource"){!e.updating()&&e.mediaSource.readyState!=="closed"&&(e.queue.shift(),r.action(e),r.doneFn&&r.doneFn(),Eu("audio",e),Eu("video",e));return}if(s!=="mediaSource"&&!(!e.ready()||e.mediaSource.readyState==="closed"||Iy(s,e))){if(r.type!==s){if(i=HM(s,e.queue),i===null)return;r=e.queue[i]}if(e.queue.splice(i,1),e.queuePending[s]=r,r.action(s,e),!r.doneFn){e.queuePending[s]=null,Eu(s,e);return}}},dx=(s,e)=>{const i=e[`${s}Buffer`],r=cx(s);i&&(i.removeEventListener("updateend",e[`on${r}UpdateEnd_`]),i.removeEventListener("error",e[`on${r}Error_`]),e.codecs[s]=null,e[`${s}Buffer`]=null)},js=(s,e)=>s&&e&&Array.prototype.indexOf.call(s.sourceBuffers,e)!==-1,En={appendBuffer:(s,e,i)=>(r,o)=>{const u=o[`${r}Buffer`];if(js(o.mediaSource,u)){o.logger_(`Appending segment ${e.mediaIndex}'s ${s.length} bytes to ${r}Buffer`);try{u.appendBuffer(s)}catch(c){o.logger_(`Error with code ${c.code} `+(c.code===AS?"(QUOTA_EXCEEDED_ERR) ":"")+`when appending segment ${e.mediaIndex} to ${r}Buffer`),o.queuePending[r]=null,i(c)}}},remove:(s,e)=>(i,r)=>{const o=r[`${i}Buffer`];if(js(r.mediaSource,o)){r.logger_(`Removing ${s} to ${e} from ${i}Buffer`);try{o.remove(s,e)}catch{r.logger_(`Remove ${s} to ${e} from ${i}Buffer failed`)}}},timestampOffset:s=>(e,i)=>{const r=i[`${e}Buffer`];js(i.mediaSource,r)&&(i.logger_(`Setting ${e}timestampOffset to ${s}`),r.timestampOffset=s)},callback:s=>(e,i)=>{s()},endOfStream:s=>e=>{if(e.mediaSource.readyState==="open"){e.logger_(`Calling mediaSource endOfStream(${s||""})`);try{e.mediaSource.endOfStream(s)}catch(i){$.log.warn("Failed to call media source endOfStream",i)}}},duration:s=>e=>{e.logger_(`Setting mediaSource duration to ${s}`);try{e.mediaSource.duration=s}catch(i){$.log.warn("Failed to set media source duration",i)}},abort:()=>(s,e)=>{if(e.mediaSource.readyState!=="open")return;const i=e[`${s}Buffer`];if(js(e.mediaSource,i)){e.logger_(`calling abort on ${s}Buffer`);try{i.abort()}catch(r){$.log.warn(`Failed to abort on ${s}Buffer`,r)}}},addSourceBuffer:(s,e)=>i=>{const r=cx(s),o=Hl(e);i.logger_(`Adding ${s}Buffer with codec ${e} to mediaSource`);const u=i.mediaSource.addSourceBuffer(o);u.addEventListener("updateend",i[`on${r}UpdateEnd_`]),u.addEventListener("error",i[`on${r}Error_`]),i.codecs[s]=e,i[`${s}Buffer`]=u},removeSourceBuffer:s=>e=>{const i=e[`${s}Buffer`];if(dx(s,e),!!js(e.mediaSource,i)){e.logger_(`Removing ${s}Buffer with codec ${e.codecs[s]} from mediaSource`);try{e.mediaSource.removeSourceBuffer(i)}catch(r){$.log.warn(`Failed to removeSourceBuffer ${s}Buffer`,r)}}},changeType:s=>(e,i)=>{const r=i[`${e}Buffer`],o=Hl(s);if(!js(i.mediaSource,r))return;const u=s.substring(0,s.indexOf(".")),c=i.codecs[e];if(c.substring(0,c.indexOf("."))===u)return;const g={codecsChangeInfo:{from:c,to:s}};i.trigger({type:"codecschange",metadata:g}),i.logger_(`changing ${e}Buffer codec from ${c} to ${s}`);try{r.changeType(o),i.codecs[e]=s}catch(b){g.errorType=$.Error.StreamingCodecsChangeError,g.error=b,b.metadata=g,i.error_=b,i.trigger("error"),$.log.warn(`Failed to changeType on ${e}Buffer`,b)}}},Cn=({type:s,sourceUpdater:e,action:i,doneFn:r,name:o})=>{e.queue.push({type:s,action:i,doneFn:r,name:o}),Eu(s,e)},hx=(s,e)=>i=>{const r=e[`${s}Buffered`](),o=i4(r);if(e.logger_(`received "updateend" event for ${s} Source Buffer: `,o),e.queuePending[s]){const u=e.queuePending[s].doneFn;e.queuePending[s]=null,u&&u(e[`${s}Error_`])}Eu(s,e)};class fx extends $.EventTarget{constructor(e){super(),this.mediaSource=e,this.sourceopenListener_=()=>Eu("mediaSource",this),this.mediaSource.addEventListener("sourceopen",this.sourceopenListener_),this.logger_=$n("SourceUpdater"),this.audioTimestampOffset_=0,this.videoTimestampOffset_=0,this.queue=[],this.queuePending={audio:null,video:null},this.delayedAudioAppendQueue_=[],this.videoAppendQueued_=!1,this.codecs={},this.onVideoUpdateEnd_=hx("video",this),this.onAudioUpdateEnd_=hx("audio",this),this.onVideoError_=i=>{this.videoError_=i},this.onAudioError_=i=>{this.audioError_=i},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,i){Cn({type:"mediaSource",sourceUpdater:this,action:En.addSourceBuffer(e,i),name:"addSourceBuffer"})}abort(e){Cn({type:e,sourceUpdater:this,action:En.abort(e),name:"abort"})}removeSourceBuffer(e){if(!this.canRemoveSourceBuffer()){$.log.error("removeSourceBuffer is not supported!");return}Cn({type:"mediaSource",sourceUpdater:this,action:En.removeSourceBuffer(e),name:"removeSourceBuffer"})}canRemoveSourceBuffer(){return!$.browser.IS_FIREFOX&&P.MediaSource&&P.MediaSource.prototype&&typeof P.MediaSource.prototype.removeSourceBuffer=="function"}static canChangeType(){return P.SourceBuffer&&P.SourceBuffer.prototype&&typeof P.SourceBuffer.prototype.changeType=="function"}canChangeType(){return this.constructor.canChangeType()}changeType(e,i){if(!this.canChangeType()){$.log.error("changeType is not supported!");return}Cn({type:e,sourceUpdater:this,action:En.changeType(i),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(i=>{const r=e[i];if(!this.hasCreatedSourceBuffers())return this.addSourceBuffer(i,r);this.canChangeType()&&this.changeType(i,r)})}appendBuffer(e,i){const{segmentInfo:r,type:o,bytes:u}=e;if(this.processedAppend_=!0,o==="audio"&&this.videoBuffer&&!this.videoAppendQueued_){this.delayedAudioAppendQueue_.push([e,i]),this.logger_(`delayed audio append of ${u.length} until video append`);return}const c=i;if(Cn({type:o,sourceUpdater:this,action:En.appendBuffer(u,r||{mediaIndex:-1},c),doneFn:i,name:"appendBuffer"}),o==="video"){if(this.videoAppendQueued_=!0,!this.delayedAudioAppendQueue_.length)return;const p=this.delayedAudioAppendQueue_.slice();this.logger_(`queuing delayed audio ${p.length} appendBuffers`),this.delayedAudioAppendQueue_.length=0,p.forEach(g=>{this.appendBuffer.apply(this,g)})}}audioBuffered(){return js(this.mediaSource,this.audioBuffer)&&this.audioBuffer.buffered?this.audioBuffer.buffered:hi()}videoBuffered(){return js(this.mediaSource,this.videoBuffer)&&this.videoBuffer.buffered?this.videoBuffer.buffered:hi()}buffered(){const e=js(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,i=js(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;return i&&!e?this.audioBuffered():e&&!i?this.videoBuffered():s4(this.audioBuffered(),this.videoBuffered())}setDuration(e,i=Mr){Cn({type:"mediaSource",sourceUpdater:this,action:En.duration(e),name:"duration",doneFn:i})}endOfStream(e=null,i=Mr){typeof e!="string"&&(e=void 0),Cn({type:"mediaSource",sourceUpdater:this,action:En.endOfStream(e),name:"endOfStream",doneFn:i})}removeAudio(e,i,r=Mr){if(!this.audioBuffered().length||this.audioBuffered().end(0)===0){r();return}Cn({type:"audio",sourceUpdater:this,action:En.remove(e,i),doneFn:r,name:"remove"})}removeVideo(e,i,r=Mr){if(!this.videoBuffered().length||this.videoBuffered().end(0)===0){r();return}Cn({type:"video",sourceUpdater:this,action:En.remove(e,i),doneFn:r,name:"remove"})}updating(){return!!(Iy("audio",this)||Iy("video",this))}audioTimestampOffset(e){return typeof e<"u"&&this.audioBuffer&&this.audioTimestampOffset_!==e&&(Cn({type:"audio",sourceUpdater:this,action:En.timestampOffset(e),name:"timestampOffset"}),this.audioTimestampOffset_=e),this.audioTimestampOffset_}videoTimestampOffset(e){return typeof e<"u"&&this.videoBuffer&&this.videoTimestampOffset_!==e&&(Cn({type:"video",sourceUpdater:this,action:En.timestampOffset(e),name:"timestampOffset"}),this.videoTimestampOffset_=e),this.videoTimestampOffset_}audioQueueCallback(e){this.audioBuffer&&Cn({type:"audio",sourceUpdater:this,action:En.callback(e),name:"callback"})}videoQueueCallback(e){this.videoBuffer&&Cn({type:"video",sourceUpdater:this,action:En.callback(e),name:"callback"})}dispose(){this.trigger("dispose"),FM.forEach(e=>{this.abort(e),this.canRemoveSourceBuffer()?this.removeSourceBuffer(e):this[`${e}QueueCallback`](()=>dx(e,this))}),this.videoAppendQueued_=!1,this.delayedAudioAppendQueue_.length=0,this.sourceopenListener_&&this.mediaSource.removeEventListener("sourceopen",this.sourceopenListener_),this.off()}}const px=s=>decodeURIComponent(escape(String.fromCharCode.apply(null,s))),zM=s=>{const e=new Uint8Array(s);return Array.from(e).map(i=>i.toString(16).padStart(2,"0")).join("")},mx=new Uint8Array(` +${xu(e)}`),i.map&&!i.map.bytes&&(this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0}),e.abortRequests=hM({xhr:this.vhs_.xhr,xhrOptions:this.xhrOptions_,decryptionWorker:this.decrypter_,segment:i,abortFn:this.handleAbort_.bind(this,e),progressFn:this.handleProgress_.bind(this),trackInfoFn:this.handleTrackInfo_.bind(this),timingInfoFn:this.handleTimingInfo_.bind(this),videoSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"video",e.requestId),audioSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"audio",e.requestId),captionsFn:this.handleCaptions_.bind(this),isEndOfTimeline:c,endedTimelineFn:()=>{this.logger_("received endedtimeline callback")},id3Fn:this.handleId3_.bind(this),dataFn:this.handleData_.bind(this),doneFn:this.segmentRequestFinished_.bind(this),onTransmuxerLog:({message:p,level:g,stream:b})=>{this.logger_(`${xu(e)} logged from transmuxer stream ${b} as a ${g}: ${p}`)},triggerSegmentEventFn:({type:p,segment:g,keyInfo:b,trackInfo:S,timingInfo:E})=>{const M={segmentInfo:Po({segment:g})};b&&(M.keyInfo=b),S&&(M.trackInfo=S),E&&(M.timingInfo=E),this.trigger({type:p,metadata:M})}})}trimBackBuffer_(e){const i=LM(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);i>0&&this.remove(0,i)}createSimplifiedSegmentObj_(e){const i=e.segment,r=e.part,o=e.segment.key||e.segment.map&&e.segment.map.key,u=e.segment.map&&!e.segment.map.bytes,c={resolvedUri:r?r.resolvedUri:i.resolvedUri,byterange:r?r.byterange:i.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:o,isMediaInitialization:u},p=e.playlist.segments[e.mediaIndex-1];if(p&&p.timeline===i.timeline&&(p.videoTimingInfo?c.baseStartTime=p.videoTimingInfo.transmuxedDecodeEnd:p.audioTimingInfo&&(c.baseStartTime=p.audioTimingInfo.transmuxedDecodeEnd)),i.key){const g=i.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]);c.key=this.segmentKey(i.key),c.key.iv=g}return i.map&&(c.map=this.initSegmentForMap(i.map)),c}saveTransferStats_(e){this.mediaRequests+=1,e&&(this.mediaBytesTransferred+=e.bytesReceived,this.mediaTransferDuration+=e.roundTripTime)}saveBandwidthRelatedStats_(e,i){if(this.pendingSegment_.byteLength=i.bytesReceived,e"u"||b.end!==o+u?o:p.start}waitForAppendsToComplete_(e){const i=this.getCurrentMediaInfo_(e);if(!i){this.error({message:"No starting media returned, likely due to an unsupported media format.",playlistExclusionDuration:1/0}),this.trigger("error");return}const{hasAudio:r,hasVideo:o,isMuxed:u}=i,c=this.loaderType_==="main"&&o,p=!this.audioDisabled_&&r&&!u;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}c&&e.waitingOnAppends++,p&&e.waitingOnAppends++,c&&this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this,e)),p&&this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this,e))}checkAppendsDone_(e){this.checkForAbort_(e.requestId)||(e.waitingOnAppends--,e.waitingOnAppends===0&&this.handleAppendsDone_())}checkForIllegalMediaSwitch(e){const i=MM(this.loaderType_,this.getCurrentMediaInfo_(),e);return i?(this.error({message:i,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 i=!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),i=!0),e.timestampOffset!==this.sourceUpdater_.audioTimestampOffset()&&(this.sourceUpdater_.audioTimestampOffset(e.timestampOffset),i=!0),i&&this.trigger("timestampoffset")}getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e,audioTimingInfo:i,timingInfo:r}){return this.useDtsForTimestampOffset_?e&&typeof e.transmuxedDecodeStart=="number"?e.transmuxedDecodeStart:i&&typeof i.transmuxedDecodeStart=="number"?i.transmuxedDecodeStart:r.start:r.start}updateTimingInfoEnd_(e){e.timingInfo=e.timingInfo||{};const i=this.getMediaInfo_(),o=this.loaderType_==="main"&&i&&i.hasVideo&&e.videoTimingInfo?e.videoTimingInfo:e.audioTimingInfo;o&&(e.timingInfo.end=typeof o.end=="number"?o.end:o.start+e.duration)}handleAppendsDone_(){if(this.pendingSegment_){const g={segmentInfo:Po({type:this.loaderType_,segment:this.pendingSegment_})};this.trigger({type:"appendsdone",metadata:g})}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 i=BM(e,this.sourceType_);if(i&&(i.severity==="warn"?V.log.warn(i.message):this.logger_(i.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 ${xu(e)}`);return}this.logger_(`Appended ${xu(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 r=e.segment,o=e.part,u=r.end&&this.currentTime_()-r.end>e.playlist.targetDuration*3,c=o&&o.end&&this.currentTime_()-o.end>e.playlist.partTargetDuration*3;if(u||c){this.logger_(`bad ${u?"segment":"part"} ${xu(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.duratione.toUpperCase())},FM=["video","audio"],Iy=(s,e)=>{const i=e[`${s}Buffer`];return i&&i.updating||e.queuePending[s]},HM=(s,e)=>{for(let i=0;i{if(e.queue.length===0)return;let i=0,r=e.queue[i];if(r.type==="mediaSource"){!e.updating()&&e.mediaSource.readyState!=="closed"&&(e.queue.shift(),r.action(e),r.doneFn&&r.doneFn(),Eu("audio",e),Eu("video",e));return}if(s!=="mediaSource"&&!(!e.ready()||e.mediaSource.readyState==="closed"||Iy(s,e))){if(r.type!==s){if(i=HM(s,e.queue),i===null)return;r=e.queue[i]}if(e.queue.splice(i,1),e.queuePending[s]=r,r.action(s,e),!r.doneFn){e.queuePending[s]=null,Eu(s,e);return}}},dx=(s,e)=>{const i=e[`${s}Buffer`],r=cx(s);i&&(i.removeEventListener("updateend",e[`on${r}UpdateEnd_`]),i.removeEventListener("error",e[`on${r}Error_`]),e.codecs[s]=null,e[`${s}Buffer`]=null)},js=(s,e)=>s&&e&&Array.prototype.indexOf.call(s.sourceBuffers,e)!==-1,En={appendBuffer:(s,e,i)=>(r,o)=>{const u=o[`${r}Buffer`];if(js(o.mediaSource,u)){o.logger_(`Appending segment ${e.mediaIndex}'s ${s.length} bytes to ${r}Buffer`);try{u.appendBuffer(s)}catch(c){o.logger_(`Error with code ${c.code} `+(c.code===AS?"(QUOTA_EXCEEDED_ERR) ":"")+`when appending segment ${e.mediaIndex} to ${r}Buffer`),o.queuePending[r]=null,i(c)}}},remove:(s,e)=>(i,r)=>{const o=r[`${i}Buffer`];if(js(r.mediaSource,o)){r.logger_(`Removing ${s} to ${e} from ${i}Buffer`);try{o.remove(s,e)}catch{r.logger_(`Remove ${s} to ${e} from ${i}Buffer failed`)}}},timestampOffset:s=>(e,i)=>{const r=i[`${e}Buffer`];js(i.mediaSource,r)&&(i.logger_(`Setting ${e}timestampOffset to ${s}`),r.timestampOffset=s)},callback:s=>(e,i)=>{s()},endOfStream:s=>e=>{if(e.mediaSource.readyState==="open"){e.logger_(`Calling mediaSource endOfStream(${s||""})`);try{e.mediaSource.endOfStream(s)}catch(i){V.log.warn("Failed to call media source endOfStream",i)}}},duration:s=>e=>{e.logger_(`Setting mediaSource duration to ${s}`);try{e.mediaSource.duration=s}catch(i){V.log.warn("Failed to set media source duration",i)}},abort:()=>(s,e)=>{if(e.mediaSource.readyState!=="open")return;const i=e[`${s}Buffer`];if(js(e.mediaSource,i)){e.logger_(`calling abort on ${s}Buffer`);try{i.abort()}catch(r){V.log.warn(`Failed to abort on ${s}Buffer`,r)}}},addSourceBuffer:(s,e)=>i=>{const r=cx(s),o=Hl(e);i.logger_(`Adding ${s}Buffer with codec ${e} to mediaSource`);const u=i.mediaSource.addSourceBuffer(o);u.addEventListener("updateend",i[`on${r}UpdateEnd_`]),u.addEventListener("error",i[`on${r}Error_`]),i.codecs[s]=e,i[`${s}Buffer`]=u},removeSourceBuffer:s=>e=>{const i=e[`${s}Buffer`];if(dx(s,e),!!js(e.mediaSource,i)){e.logger_(`Removing ${s}Buffer with codec ${e.codecs[s]} from mediaSource`);try{e.mediaSource.removeSourceBuffer(i)}catch(r){V.log.warn(`Failed to removeSourceBuffer ${s}Buffer`,r)}}},changeType:s=>(e,i)=>{const r=i[`${e}Buffer`],o=Hl(s);if(!js(i.mediaSource,r))return;const u=s.substring(0,s.indexOf(".")),c=i.codecs[e];if(c.substring(0,c.indexOf("."))===u)return;const g={codecsChangeInfo:{from:c,to:s}};i.trigger({type:"codecschange",metadata:g}),i.logger_(`changing ${e}Buffer codec from ${c} to ${s}`);try{r.changeType(o),i.codecs[e]=s}catch(b){g.errorType=V.Error.StreamingCodecsChangeError,g.error=b,b.metadata=g,i.error_=b,i.trigger("error"),V.log.warn(`Failed to changeType on ${e}Buffer`,b)}}},Cn=({type:s,sourceUpdater:e,action:i,doneFn:r,name:o})=>{e.queue.push({type:s,action:i,doneFn:r,name:o}),Eu(s,e)},hx=(s,e)=>i=>{const r=e[`${s}Buffered`](),o=i4(r);if(e.logger_(`received "updateend" event for ${s} Source Buffer: `,o),e.queuePending[s]){const u=e.queuePending[s].doneFn;e.queuePending[s]=null,u&&u(e[`${s}Error_`])}Eu(s,e)};class fx extends V.EventTarget{constructor(e){super(),this.mediaSource=e,this.sourceopenListener_=()=>Eu("mediaSource",this),this.mediaSource.addEventListener("sourceopen",this.sourceopenListener_),this.logger_=$n("SourceUpdater"),this.audioTimestampOffset_=0,this.videoTimestampOffset_=0,this.queue=[],this.queuePending={audio:null,video:null},this.delayedAudioAppendQueue_=[],this.videoAppendQueued_=!1,this.codecs={},this.onVideoUpdateEnd_=hx("video",this),this.onAudioUpdateEnd_=hx("audio",this),this.onVideoError_=i=>{this.videoError_=i},this.onAudioError_=i=>{this.audioError_=i},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,i){Cn({type:"mediaSource",sourceUpdater:this,action:En.addSourceBuffer(e,i),name:"addSourceBuffer"})}abort(e){Cn({type:e,sourceUpdater:this,action:En.abort(e),name:"abort"})}removeSourceBuffer(e){if(!this.canRemoveSourceBuffer()){V.log.error("removeSourceBuffer is not supported!");return}Cn({type:"mediaSource",sourceUpdater:this,action:En.removeSourceBuffer(e),name:"removeSourceBuffer"})}canRemoveSourceBuffer(){return!V.browser.IS_FIREFOX&&P.MediaSource&&P.MediaSource.prototype&&typeof P.MediaSource.prototype.removeSourceBuffer=="function"}static canChangeType(){return P.SourceBuffer&&P.SourceBuffer.prototype&&typeof P.SourceBuffer.prototype.changeType=="function"}canChangeType(){return this.constructor.canChangeType()}changeType(e,i){if(!this.canChangeType()){V.log.error("changeType is not supported!");return}Cn({type:e,sourceUpdater:this,action:En.changeType(i),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(i=>{const r=e[i];if(!this.hasCreatedSourceBuffers())return this.addSourceBuffer(i,r);this.canChangeType()&&this.changeType(i,r)})}appendBuffer(e,i){const{segmentInfo:r,type:o,bytes:u}=e;if(this.processedAppend_=!0,o==="audio"&&this.videoBuffer&&!this.videoAppendQueued_){this.delayedAudioAppendQueue_.push([e,i]),this.logger_(`delayed audio append of ${u.length} until video append`);return}const c=i;if(Cn({type:o,sourceUpdater:this,action:En.appendBuffer(u,r||{mediaIndex:-1},c),doneFn:i,name:"appendBuffer"}),o==="video"){if(this.videoAppendQueued_=!0,!this.delayedAudioAppendQueue_.length)return;const p=this.delayedAudioAppendQueue_.slice();this.logger_(`queuing delayed audio ${p.length} appendBuffers`),this.delayedAudioAppendQueue_.length=0,p.forEach(g=>{this.appendBuffer.apply(this,g)})}}audioBuffered(){return js(this.mediaSource,this.audioBuffer)&&this.audioBuffer.buffered?this.audioBuffer.buffered:hi()}videoBuffered(){return js(this.mediaSource,this.videoBuffer)&&this.videoBuffer.buffered?this.videoBuffer.buffered:hi()}buffered(){const e=js(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,i=js(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;return i&&!e?this.audioBuffered():e&&!i?this.videoBuffered():s4(this.audioBuffered(),this.videoBuffered())}setDuration(e,i=Mr){Cn({type:"mediaSource",sourceUpdater:this,action:En.duration(e),name:"duration",doneFn:i})}endOfStream(e=null,i=Mr){typeof e!="string"&&(e=void 0),Cn({type:"mediaSource",sourceUpdater:this,action:En.endOfStream(e),name:"endOfStream",doneFn:i})}removeAudio(e,i,r=Mr){if(!this.audioBuffered().length||this.audioBuffered().end(0)===0){r();return}Cn({type:"audio",sourceUpdater:this,action:En.remove(e,i),doneFn:r,name:"remove"})}removeVideo(e,i,r=Mr){if(!this.videoBuffered().length||this.videoBuffered().end(0)===0){r();return}Cn({type:"video",sourceUpdater:this,action:En.remove(e,i),doneFn:r,name:"remove"})}updating(){return!!(Iy("audio",this)||Iy("video",this))}audioTimestampOffset(e){return typeof e<"u"&&this.audioBuffer&&this.audioTimestampOffset_!==e&&(Cn({type:"audio",sourceUpdater:this,action:En.timestampOffset(e),name:"timestampOffset"}),this.audioTimestampOffset_=e),this.audioTimestampOffset_}videoTimestampOffset(e){return typeof e<"u"&&this.videoBuffer&&this.videoTimestampOffset_!==e&&(Cn({type:"video",sourceUpdater:this,action:En.timestampOffset(e),name:"timestampOffset"}),this.videoTimestampOffset_=e),this.videoTimestampOffset_}audioQueueCallback(e){this.audioBuffer&&Cn({type:"audio",sourceUpdater:this,action:En.callback(e),name:"callback"})}videoQueueCallback(e){this.videoBuffer&&Cn({type:"video",sourceUpdater:this,action:En.callback(e),name:"callback"})}dispose(){this.trigger("dispose"),FM.forEach(e=>{this.abort(e),this.canRemoveSourceBuffer()?this.removeSourceBuffer(e):this[`${e}QueueCallback`](()=>dx(e,this))}),this.videoAppendQueued_=!1,this.delayedAudioAppendQueue_.length=0,this.sourceopenListener_&&this.mediaSource.removeEventListener("sourceopen",this.sourceopenListener_),this.off()}}const px=s=>decodeURIComponent(escape(String.fromCharCode.apply(null,s))),zM=s=>{const e=new Uint8Array(s);return Array.from(e).map(i=>i.toString(16).padStart(2,"0")).join("")},mx=new Uint8Array(` -`.split("").map(s=>s.charCodeAt(0)));class jM extends Error{constructor(){super("Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.")}}class qM extends Ly{constructor(e,i={}){super(e,i),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 hi();const e=this.subtitlesTrack_.cues,i=e[0].startTime,r=e[e.length-1].startTime;return hi([[i,r]])}initSegmentForMap(e,i=!1){if(!e)return null;const r=Ip(e);let o=this.initSegments_[r];if(i&&!o&&e.bytes){const u=mx.byteLength+e.bytes.byteLength,c=new Uint8Array(u);c.set(e.bytes),c.set(mx,e.bytes.byteLength),this.initSegments_[r]=o={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:c}}return o||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,i){Ld(e,i,this.subtitlesTrack_)}fillBuffer_(){const e=this.chooseNextRequest_();if(e){if(this.syncController_.timestampOffsetForTimeline(e.timeline)===null){const i=()=>{this.state="READY",this.paused()||this.monitorBuffer_()};this.syncController_.one("timestampoffset",i),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,i,r){if(!this.subtitlesTrack_){this.state="READY";return}if(this.saveTransferStats_(i.stats),!this.pendingSegment_){this.state="READY",this.mediaRequestsAborted+=1;return}if(e){e.code===zs.TIMEOUT&&this.handleTimeout_(),e.code===zs.ABORTED?this.mediaRequestsAborted+=1:this.mediaRequestsErrored+=1,this.stopForError(e);return}const o=this.pendingSegment_,u=r.mp4VttCues&&r.mp4VttCues.length;u&&(o.mp4VttCues=r.mp4VttCues),this.saveBandwidthRelatedStats_(o.duration,i.stats),i.key&&this.segmentKey(i.key,!0),this.state="APPENDING",this.trigger("appending");const c=o.segment;if(c.map&&(c.map.bytes=i.map.bytes),o.bytes=i.bytes,typeof P.WebVTT!="function"&&typeof this.loadVttJs=="function"){this.state="WAITING_ON_VTTJS",this.loadVttJs().then(()=>this.segmentRequestFinished_(e,i,r),()=>this.stopForError({message:"Error loading vtt.js"}));return}c.requested=!0;try{this.parseVTTCues_(o)}catch(p){this.stopForError({message:p.message,metadata:{errorType:$.Error.StreamingVttParserError,error:p}});return}if(u||this.updateTimeMapping_(o,this.syncController_.timelines[o.timeline],this.playlist_),o.cues.length?o.timingInfo={start:o.cues[0].startTime,end:o.cues[o.cues.length-1].endTime}:o.timingInfo={start:o.startOfSegment,end:o.startOfSegment+o.duration},o.isSyncRequest){this.trigger("syncinfoupdate"),this.pendingSegment_=null,this.state="READY";return}o.byteLength=o.bytes.byteLength,this.mediaSecondsLoaded+=c.duration,o.cues.forEach(p=>{this.subtitlesTrack_.addCue(this.featuresNativeTextTracks_?new P.VTTCue(p.startTime,p.endTime,p.text):p)}),CM(this.subtitlesTrack_),this.handleAppendsDone_()}handleData_(e,i){const r=e&&e.type==="vtt",o=i&&i.type==="text";r&&o&&super.handleData_(e,i)}updateTimingInfoEnd_(){}parseMp4VttCues_(e){const i=this.sourceUpdater_.videoTimestampOffset()===null?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset();e.mp4VttCues.forEach(r=>{const o=r.start+i,u=r.end+i,c=new P.VTTCue(o,u,r.cueText);r.settings&&r.settings.split(" ").forEach(p=>{const g=p.split(":"),b=g[0],S=g[1];c[b]=isNaN(S)?S:Number(S)}),e.cues.push(c)})}parseVTTCues_(e){let i,r=!1;if(typeof P.WebVTT!="function")throw new jM;if(e.cues=[],e.timestampmap={MPEGTS:0,LOCAL:0},e.mp4VttCues){this.parseMp4VttCues_(e);return}typeof P.TextDecoder=="function"?i=new P.TextDecoder("utf8"):(i=P.WebVTT.StringDecoder(),r=!0);const o=new P.WebVTT.Parser(P,P.vttjs,i);if(o.oncue=e.cues.push.bind(e.cues),o.ontimestampmap=c=>{e.timestampmap=c},o.onparsingerror=c=>{$.log.warn("Error encountered when parsing cues: "+c.message)},e.segment.map){let c=e.segment.map.bytes;r&&(c=px(c)),o.parse(c)}let u=e.bytes;r&&(u=px(u)),o.parse(u),o.flush()}updateTimeMapping_(e,i,r){const o=e.segment;if(!i)return;if(!e.cues.length){o.empty=!0;return}const{MPEGTS:u,LOCAL:c}=e.timestampmap,g=u/Ao.ONE_SECOND_IN_TS-c+i.mapping;if(e.cues.forEach(b=>{const S=b.endTime-b.startTime,E=this.handleRollover_(b.startTime+g,i.time);b.startTime=Math.max(E,0),b.endTime=Math.max(E+S,0)}),!r.syncInfo){const b=e.cues[0].startTime,S=e.cues[e.cues.length-1].startTime;r.syncInfo={mediaSequence:r.mediaSequence+e.mediaIndex,time:Math.min(b,S-o.duration)}}}handleRollover_(e,i){if(i===null)return e;let r=e*Ao.ONE_SECOND_IN_TS;const o=i*Ao.ONE_SECOND_IN_TS;let u;for(o4294967296;)r+=u;return r/Ao.ONE_SECOND_IN_TS}}const VM=function(s,e){const i=s.cues;for(let r=0;r=o.adStartTime&&e<=o.adEndTime)return o}return null},$M=function(s,e,i=0){if(!s.segments)return;let r=i,o;for(let u=0;u=this.start&&e0}resetAppendStatus(){this.segmentSyncInfo_.resetAppendedStatus(),this.partsSyncInfo_.forEach(e=>e.resetAppendedStatus())}}class yx{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,i){const{mediaSequence:r,segments:o}=e;if(this.isReliable_=this.isReliablePlaylist_(r,o),!!this.isReliable_)return this.updateStorage_(o,r,this.calculateBaseTime_(r,o,i))}getSyncInfoForTime(e){for(const{segmentSyncInfo:i,partsSyncInfo:r}of this.storage_.values())if(r.length){for(const o of r)if(o.isInRange(e))return o}else if(i.isInRange(e))return i;return null}getSyncInfoForMediaSequence(e){return this.storage_.get(e)}updateStorage_(e,i,r){const o=new Map;let u=` -`,c=r,p=i;this.start_=c,e.forEach((g,b)=>{const S=this.storage_.get(p),E=c,A=E+g.duration,M=!!(S&&S.segmentSyncInfo&&S.segmentSyncInfo.isAppended),U=new gx({start:E,end:A,appended:M,segmentIndex:b});g.syncInfo=U;let D=c;const z=(g.parts||[]).map((H,Y)=>{const V=D,Q=D+H.duration,Z=!!(S&&S.partsSyncInfo&&S.partsSyncInfo[Y]&&S.partsSyncInfo[Y].isAppended),W=new gx({start:V,end:Q,appended:Z,segmentIndex:b,partIndex:Y});return D=Q,u+=`Media Sequence: ${p}.${Y} | Range: ${V} --> ${Q} | Appended: ${Z} +`.split("").map(s=>s.charCodeAt(0)));class jM extends Error{constructor(){super("Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.")}}class qM extends Ly{constructor(e,i={}){super(e,i),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 hi();const e=this.subtitlesTrack_.cues,i=e[0].startTime,r=e[e.length-1].startTime;return hi([[i,r]])}initSegmentForMap(e,i=!1){if(!e)return null;const r=Ip(e);let o=this.initSegments_[r];if(i&&!o&&e.bytes){const u=mx.byteLength+e.bytes.byteLength,c=new Uint8Array(u);c.set(e.bytes),c.set(mx,e.bytes.byteLength),this.initSegments_[r]=o={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:c}}return o||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,i){Ld(e,i,this.subtitlesTrack_)}fillBuffer_(){const e=this.chooseNextRequest_();if(e){if(this.syncController_.timestampOffsetForTimeline(e.timeline)===null){const i=()=>{this.state="READY",this.paused()||this.monitorBuffer_()};this.syncController_.one("timestampoffset",i),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,i,r){if(!this.subtitlesTrack_){this.state="READY";return}if(this.saveTransferStats_(i.stats),!this.pendingSegment_){this.state="READY",this.mediaRequestsAborted+=1;return}if(e){e.code===zs.TIMEOUT&&this.handleTimeout_(),e.code===zs.ABORTED?this.mediaRequestsAborted+=1:this.mediaRequestsErrored+=1,this.stopForError(e);return}const o=this.pendingSegment_,u=r.mp4VttCues&&r.mp4VttCues.length;u&&(o.mp4VttCues=r.mp4VttCues),this.saveBandwidthRelatedStats_(o.duration,i.stats),i.key&&this.segmentKey(i.key,!0),this.state="APPENDING",this.trigger("appending");const c=o.segment;if(c.map&&(c.map.bytes=i.map.bytes),o.bytes=i.bytes,typeof P.WebVTT!="function"&&typeof this.loadVttJs=="function"){this.state="WAITING_ON_VTTJS",this.loadVttJs().then(()=>this.segmentRequestFinished_(e,i,r),()=>this.stopForError({message:"Error loading vtt.js"}));return}c.requested=!0;try{this.parseVTTCues_(o)}catch(p){this.stopForError({message:p.message,metadata:{errorType:V.Error.StreamingVttParserError,error:p}});return}if(u||this.updateTimeMapping_(o,this.syncController_.timelines[o.timeline],this.playlist_),o.cues.length?o.timingInfo={start:o.cues[0].startTime,end:o.cues[o.cues.length-1].endTime}:o.timingInfo={start:o.startOfSegment,end:o.startOfSegment+o.duration},o.isSyncRequest){this.trigger("syncinfoupdate"),this.pendingSegment_=null,this.state="READY";return}o.byteLength=o.bytes.byteLength,this.mediaSecondsLoaded+=c.duration,o.cues.forEach(p=>{this.subtitlesTrack_.addCue(this.featuresNativeTextTracks_?new P.VTTCue(p.startTime,p.endTime,p.text):p)}),CM(this.subtitlesTrack_),this.handleAppendsDone_()}handleData_(e,i){const r=e&&e.type==="vtt",o=i&&i.type==="text";r&&o&&super.handleData_(e,i)}updateTimingInfoEnd_(){}parseMp4VttCues_(e){const i=this.sourceUpdater_.videoTimestampOffset()===null?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset();e.mp4VttCues.forEach(r=>{const o=r.start+i,u=r.end+i,c=new P.VTTCue(o,u,r.cueText);r.settings&&r.settings.split(" ").forEach(p=>{const g=p.split(":"),b=g[0],S=g[1];c[b]=isNaN(S)?S:Number(S)}),e.cues.push(c)})}parseVTTCues_(e){let i,r=!1;if(typeof P.WebVTT!="function")throw new jM;if(e.cues=[],e.timestampmap={MPEGTS:0,LOCAL:0},e.mp4VttCues){this.parseMp4VttCues_(e);return}typeof P.TextDecoder=="function"?i=new P.TextDecoder("utf8"):(i=P.WebVTT.StringDecoder(),r=!0);const o=new P.WebVTT.Parser(P,P.vttjs,i);if(o.oncue=e.cues.push.bind(e.cues),o.ontimestampmap=c=>{e.timestampmap=c},o.onparsingerror=c=>{V.log.warn("Error encountered when parsing cues: "+c.message)},e.segment.map){let c=e.segment.map.bytes;r&&(c=px(c)),o.parse(c)}let u=e.bytes;r&&(u=px(u)),o.parse(u),o.flush()}updateTimeMapping_(e,i,r){const o=e.segment;if(!i)return;if(!e.cues.length){o.empty=!0;return}const{MPEGTS:u,LOCAL:c}=e.timestampmap,g=u/Ao.ONE_SECOND_IN_TS-c+i.mapping;if(e.cues.forEach(b=>{const S=b.endTime-b.startTime,E=this.handleRollover_(b.startTime+g,i.time);b.startTime=Math.max(E,0),b.endTime=Math.max(E+S,0)}),!r.syncInfo){const b=e.cues[0].startTime,S=e.cues[e.cues.length-1].startTime;r.syncInfo={mediaSequence:r.mediaSequence+e.mediaIndex,time:Math.min(b,S-o.duration)}}}handleRollover_(e,i){if(i===null)return e;let r=e*Ao.ONE_SECOND_IN_TS;const o=i*Ao.ONE_SECOND_IN_TS;let u;for(o4294967296;)r+=u;return r/Ao.ONE_SECOND_IN_TS}}const VM=function(s,e){const i=s.cues;for(let r=0;r=o.adStartTime&&e<=o.adEndTime)return o}return null},$M=function(s,e,i=0){if(!s.segments)return;let r=i,o;for(let u=0;u=this.start&&e0}resetAppendStatus(){this.segmentSyncInfo_.resetAppendedStatus(),this.partsSyncInfo_.forEach(e=>e.resetAppendedStatus())}}class yx{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,i){const{mediaSequence:r,segments:o}=e;if(this.isReliable_=this.isReliablePlaylist_(r,o),!!this.isReliable_)return this.updateStorage_(o,r,this.calculateBaseTime_(r,o,i))}getSyncInfoForTime(e){for(const{segmentSyncInfo:i,partsSyncInfo:r}of this.storage_.values())if(r.length){for(const o of r)if(o.isInRange(e))return o}else if(i.isInRange(e))return i;return null}getSyncInfoForMediaSequence(e){return this.storage_.get(e)}updateStorage_(e,i,r){const o=new Map;let u=` +`,c=r,p=i;this.start_=c,e.forEach((g,b)=>{const S=this.storage_.get(p),E=c,A=E+g.duration,M=!!(S&&S.segmentSyncInfo&&S.segmentSyncInfo.isAppended),U=new gx({start:E,end:A,appended:M,segmentIndex:b});g.syncInfo=U;let D=c;const z=(g.parts||[]).map((H,Y)=>{const $=D,Q=D+H.duration,Z=!!(S&&S.partsSyncInfo&&S.partsSyncInfo[Y]&&S.partsSyncInfo[Y].isAppended),W=new gx({start:$,end:Q,appended:Z,segmentIndex:b,partIndex:Y});return D=Q,u+=`Media Sequence: ${p}.${Y} | Range: ${$} --> ${Q} | Appended: ${Z} `,H.syncInfo=W,W});o.set(p,new GM(U,z)),u+=`${rx(g.resolvedUri)} | Media Sequence: ${p} | Range: ${E} --> ${A} | Appended: ${M} -`,p++,c=A}),this.end_=c,this.storage_=o,this.diagnostics_=u}calculateBaseTime_(e,i,r){if(!this.storage_.size)return 0;if(this.storage_.has(e))return this.storage_.get(e).segmentSyncInfo.start;const o=Math.min(...this.storage_.keys());if(ei!==1/0?{time:0,segmentIndex:0,partIndex:null}:null},{name:"MediaSequence",run:(s,e,i,r,o,u)=>{const c=s.getMediaSequenceSync(u);if(!c||!c.isReliable)return null;const p=c.getSyncInfoForTime(o);return p?{time:p.start,partIndex:p.partIndex,segmentIndex:p.segmentIndex}:null}},{name:"ProgramDateTime",run:(s,e,i,r,o)=>{if(!Object.keys(s.timelineToDatetimeMappings).length)return null;let u=null,c=null;const p=vy(e);o=o||0;for(let g=0;g{let u=null,c=null;o=o||0;const p=vy(e);for(let g=0;g=M)&&(c=M,u={time:A,segmentIndex:S.segmentIndex,partIndex:S.partIndex})}}return u}},{name:"Discontinuity",run:(s,e,i,r,o)=>{let u=null;if(o=o||0,e.discontinuityStarts&&e.discontinuityStarts.length){let c=null;for(let p=0;p=E)&&(c=E,u={time:S.time,segmentIndex:g,partIndex:null})}}}return u}},{name:"Playlist",run:(s,e,i,r,o)=>e.syncInfo?{time:e.syncInfo.time,segmentIndex:e.syncInfo.mediaSequence-e.mediaSequence,partIndex:null}:null}];class YM extends $.EventTarget{constructor(e={}){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={};const i=new yx,r=new vx(i),o=new vx(i);this.mediaSequenceStorage_={main:i,audio:r,vtt:o},this.logger_=$n("SyncController")}getMediaSequenceSync(e){return this.mediaSequenceStorage_[e]||null}getSyncPoint(e,i,r,o,u){if(i!==1/0)return Ny.find(({name:g})=>g==="VOD").run(this,e,i);const c=this.runStrategies_(e,i,r,o,u);if(!c.length)return null;for(const p of c){const{syncPoint:g,strategy:b}=p,{segmentIndex:S,time:E}=g;if(S<0)continue;const A=e.segments[S],M=E,U=M+A.duration;if(this.logger_(`Strategy: ${b}. Current time: ${o}. selected segment: ${S}. Time: [${M} -> ${U}]}`),o>=M&&o0&&(o.time*=-1),Math.abs(o.time+kd({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:o.segmentIndex,endIndex:0}))}runStrategies_(e,i,r,o,u){const c=[];for(let p=0;pXM){$.log.warn(`Not saving expired segment info. Media sequence gap ${r} is too large.`);return}for(let o=r-1;o>=0;o--){const u=e.segments[o];if(u&&typeof u.start<"u"){i.syncInfo={mediaSequence:e.mediaSequence+o,time:u.start},this.logger_(`playlist refresh sync: [time:${i.syncInfo.time}, mediaSequence: ${i.syncInfo.mediaSequence}]`),this.trigger("syncinfoupdate");break}}}setDateTimeMappingForStart(e){if(this.timelineToDatetimeMappings={},e.segments&&e.segments.length&&e.segments[0].dateTimeObject){const i=e.segments[0],r=i.dateTimeObject.getTime()/1e3;this.timelineToDatetimeMappings[i.timeline]=-r}}saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:i}){const r=this.calculateSegmentTimeMapping_(e,e.timingInfo,i),o=e.segment;r&&(this.saveDiscontinuitySyncInfo_(e),e.playlist.syncInfo||(e.playlist.syncInfo={mediaSequence:e.playlist.mediaSequence+e.mediaIndex,time:o.start}));const u=o.dateTimeObject;o.discontinuity&&i&&u&&(this.timelineToDatetimeMappings[o.timeline]=-(u.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,i,r){const o=e.segment,u=e.part;let c=this.timelines[e.timeline],p,g;if(typeof e.timestampOffset=="number")c={time:e.startOfSegment,mapping:e.startOfSegment-i.start},r&&(this.timelines[e.timeline]=c,this.trigger("timestampoffset"),this.logger_(`time mapping for timeline ${e.timeline}: [time: ${c.time}] [mapping: ${c.mapping}]`)),p=e.startOfSegment,g=i.end+c.mapping;else if(c)p=i.start+c.mapping,g=i.end+c.mapping;else return!1;return u&&(u.start=p,u.end=g),(!o.start||pg){let b;p<0?b=r.start-kd({defaultDuration:i.targetDuration,durationList:i.segments,startIndex:e.mediaIndex,endIndex:u}):b=r.end+kd({defaultDuration:i.targetDuration,durationList:i.segments,startIndex:e.mediaIndex+1,endIndex:u}),this.discontinuities[c]={time:b,accuracy:g}}}}dispose(){this.trigger("dispose"),this.off()}}class WM extends $.EventTarget{constructor(){super(),this.pendingTimelineChanges_={},this.lastTimelineChanges_={}}clearPendingTimelineChange(e){this.pendingTimelineChanges_[e]=null,this.trigger("pendingtimelinechange")}pendingTimelineChange({type:e,from:i,to:r}){return typeof i=="number"&&typeof r=="number"&&(this.pendingTimelineChanges_[e]={type:e,from:i,to:r},this.trigger("pendingtimelinechange")),this.pendingTimelineChanges_[e]}lastTimelineChange({type:e,from:i,to:r}){if(typeof i=="number"&&typeof r=="number"){this.lastTimelineChanges_[e]={type:e,from:i,to:r},delete this.pendingTimelineChanges_[e];const o={timelineChangeInfo:{from:i,to:r}};this.trigger({type:"timelinechange",metadata:o})}return this.lastTimelineChanges_[e]}dispose(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()}}const QM=VS($S(function(){var s=function(){function D(){this.listeners={}}var z=D.prototype;return z.on=function(Y,V){this.listeners[Y]||(this.listeners[Y]=[]),this.listeners[Y].push(V)},z.off=function(Y,V){if(!this.listeners[Y])return!1;var Q=this.listeners[Y].indexOf(V);return this.listeners[Y]=this.listeners[Y].slice(0),this.listeners[Y].splice(Q,1),Q>-1},z.trigger=function(Y){var V=this.listeners[Y];if(V)if(arguments.length===2)for(var Q=V.length,Z=0;Z>7)*283)^Q]=Q;for(Z=W=0;!Y[Z];Z^=oe||1,W=ee[W]||1)for(xe=W^W<<1^W<<2^W<<3^W<<4,xe=xe>>8^xe&255^99,Y[Z]=xe,V[xe]=Z,fe=G[_e=G[oe=G[Z]]],Ne=fe*16843009^_e*65537^oe*257^Z*16843008,ve=G[xe]*257^xe*16843008,Q=0;Q<4;Q++)z[Q][Z]=ve=ve<<24^ve>>>8,H[Q][xe]=Ne=Ne<<24^Ne>>>8;for(Q=0;Q<5;Q++)z[Q]=z[Q].slice(0),H[Q]=H[Q].slice(0);return D};let r=null;class o{constructor(z){r||(r=i()),this._tables=[[r[0][0].slice(),r[0][1].slice(),r[0][2].slice(),r[0][3].slice(),r[0][4].slice()],[r[1][0].slice(),r[1][1].slice(),r[1][2].slice(),r[1][3].slice(),r[1][4].slice()]];let H,Y,V;const Q=this._tables[0][4],Z=this._tables[1],W=z.length;let G=1;if(W!==4&&W!==6&&W!==8)throw new Error("Invalid aes key size");const ee=z.slice(0),oe=[];for(this._key=[ee,oe],H=W;H<4*W+28;H++)V=ee[H-1],(H%W===0||W===8&&H%W===4)&&(V=Q[V>>>24]<<24^Q[V>>16&255]<<16^Q[V>>8&255]<<8^Q[V&255],H%W===0&&(V=V<<8^V>>>24^G<<24,G=G<<1^(G>>7)*283)),ee[H]=ee[H-W]^V;for(Y=0;H;Y++,H--)V=ee[Y&3?H:H-4],H<=4||Y<4?oe[Y]=V:oe[Y]=Z[0][Q[V>>>24]]^Z[1][Q[V>>16&255]]^Z[2][Q[V>>8&255]]^Z[3][Q[V&255]]}decrypt(z,H,Y,V,Q,Z){const W=this._key[1];let G=z^W[0],ee=V^W[1],oe=Y^W[2],_e=H^W[3],fe,xe,ve;const Ne=W.length/4-2;let at,de=4;const Ee=this._tables[1],Re=Ee[0],Ye=Ee[1],le=Ee[2],Me=Ee[3],Ae=Ee[4];for(at=0;at>>24]^Ye[ee>>16&255]^le[oe>>8&255]^Me[_e&255]^W[de],xe=Re[ee>>>24]^Ye[oe>>16&255]^le[_e>>8&255]^Me[G&255]^W[de+1],ve=Re[oe>>>24]^Ye[_e>>16&255]^le[G>>8&255]^Me[ee&255]^W[de+2],_e=Re[_e>>>24]^Ye[G>>16&255]^le[ee>>8&255]^Me[oe&255]^W[de+3],de+=4,G=fe,ee=xe,oe=ve;for(at=0;at<4;at++)Q[(3&-at)+Z]=Ae[G>>>24]<<24^Ae[ee>>16&255]<<16^Ae[oe>>8&255]<<8^Ae[_e&255]^W[de++],fe=G,G=ee,ee=oe,oe=_e,_e=fe}}class u 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(z){this.jobs.push(z),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))}}const c=function(D){return D<<24|(D&65280)<<8|(D&16711680)>>8|D>>>24},p=function(D,z,H){const Y=new Int32Array(D.buffer,D.byteOffset,D.byteLength>>2),V=new o(Array.prototype.slice.call(z)),Q=new Uint8Array(D.byteLength),Z=new Int32Array(Q.buffer);let W,G,ee,oe,_e,fe,xe,ve,Ne;for(W=H[0],G=H[1],ee=H[2],oe=H[3],Ne=0;Ne{const Y=D[H];A(Y)?z[H]={bytes:Y.buffer,byteOffset:Y.byteOffset,byteLength:Y.byteLength}:z[H]=Y}),z};self.onmessage=function(D){const z=D.data,H=new Uint8Array(z.encrypted.bytes,z.encrypted.byteOffset,z.encrypted.byteLength),Y=new Uint32Array(z.key.bytes,z.key.byteOffset,z.key.byteLength/4),V=new Uint32Array(z.iv.bytes,z.iv.byteOffset,z.iv.byteLength/4);new g(H,Y,V,function(Q,Z){self.postMessage(U({source:z.source,decrypted:Z}),[Z.buffer])})}}));var KM=qS(QM);const ZM=s=>{let e=s.default?"main":"alternative";return s.characteristics&&s.characteristics.indexOf("public.accessibility.describes-video")>=0&&(e="main-desc"),e},bx=(s,e)=>{s.abort(),s.pause(),e&&e.activePlaylistLoader&&(e.activePlaylistLoader.pause(),e.activePlaylistLoader=null)},Py=(s,e)=>{e.activePlaylistLoader=s,s.load()},JM=(s,e)=>()=>{const{segmentLoaders:{[s]:i,main:r},mediaTypes:{[s]:o}}=e,u=o.activeTrack(),c=o.getActiveGroup(),p=o.activePlaylistLoader,g=o.lastGroup_;if(!(c&&g&&c.id===g.id)&&(o.lastGroup_=c,o.lastTrack_=u,bx(i,o),!(!c||c.isMainPlaylist))){if(!c.playlistLoader){p&&r.resetEverything();return}i.resyncLoader(),Py(c.playlistLoader,o)}},eL=(s,e)=>()=>{const{segmentLoaders:{[s]:i},mediaTypes:{[s]:r}}=e;r.lastGroup_=null,i.abort(),i.pause()},tL=(s,e)=>()=>{const{mainPlaylistLoader:i,segmentLoaders:{[s]:r,main:o},mediaTypes:{[s]:u}}=e,c=u.activeTrack(),p=u.getActiveGroup(),g=u.activePlaylistLoader,b=u.lastTrack_;if(!(b&&c&&b.id===c.id)&&(u.lastGroup_=p,u.lastTrack_=c,bx(r,u),!!p)){if(p.isMainPlaylist){if(!c||!b||c.id===b.id)return;const S=e.vhs.playlistController_,E=S.selectPlaylist();if(S.media()===E)return;u.logger_(`track change. Switching main audio from ${b.id} to ${c.id}`),i.pause(),o.resetEverything(),S.fastQualityChange_(E);return}if(s==="AUDIO"){if(!p.playlistLoader){o.setAudio(!0),o.resetEverything();return}r.setAudio(!0),o.setAudio(!1)}if(g===p.playlistLoader){Py(p.playlistLoader,u);return}r.track&&r.track(c),r.resetEverything(),Py(p.playlistLoader,u)}},Up={AUDIO:(s,e)=>()=>{const{mediaTypes:{[s]:i},excludePlaylist:r}=e,o=i.activeTrack(),u=i.activeGroup(),c=(u.filter(g=>g.default)[0]||u[0]).id,p=i.tracks[c];if(o===p){r({error:{message:"Problem encountered loading the default audio track."}});return}$.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");for(const g in i.tracks)i.tracks[g].enabled=i.tracks[g]===p;i.onTrackChanged()},SUBTITLES:(s,e)=>()=>{const{mediaTypes:{[s]:i}}=e;$.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track.");const r=i.activeTrack();r&&(r.mode="disabled"),i.onTrackChanged()}},_x={AUDIO:(s,e,i)=>{if(!e)return;const{tech:r,requestOptions:o,segmentLoaders:{[s]:u}}=i;e.on("loadedmetadata",()=>{const c=e.media();u.playlist(c,o),(!r.paused()||c.endList&&r.preload()!=="none")&&u.load()}),e.on("loadedplaylist",()=>{u.playlist(e.media(),o),r.paused()||u.load()}),e.on("error",Up[s](s,i))},SUBTITLES:(s,e,i)=>{const{tech:r,requestOptions:o,segmentLoaders:{[s]:u},mediaTypes:{[s]:c}}=i;e.on("loadedmetadata",()=>{const p=e.media();u.playlist(p,o),u.track(c.activeTrack()),(!r.paused()||p.endList&&r.preload()!=="none")&&u.load()}),e.on("loadedplaylist",()=>{u.playlist(e.media(),o),r.paused()||u.load()}),e.on("error",Up[s](s,i))}},iL={AUDIO:(s,e)=>{const{vhs:i,sourceType:r,segmentLoaders:{[s]:o},requestOptions:u,main:{mediaGroups:c},mediaTypes:{[s]:{groups:p,tracks:g,logger_:b}},mainPlaylistLoader:S}=e,E=Od(S.main);(!c[s]||Object.keys(c[s]).length===0)&&(c[s]={main:{default:{default:!0}}},E&&(c[s].main.default.playlists=S.main.playlists));for(const A in c[s]){p[A]||(p[A]=[]);for(const M in c[s][A]){let U=c[s][A][M],D;if(E?(b(`AUDIO group '${A}' label '${M}' is a main playlist`),U.isMainPlaylist=!0,D=null):r==="vhs-json"&&U.playlists?D=new bu(U.playlists[0],i,u):U.resolvedUri?D=new bu(U.resolvedUri,i,u):U.playlists&&r==="dash"?D=new Dy(U.playlists[0],i,u,S):D=null,U=pt({id:M,playlistLoader:D},U),_x[s](s,U.playlistLoader,e),p[A].push(U),typeof g[M]>"u"){const z=new $.AudioTrack({id:M,kind:ZM(U),enabled:!1,language:U.language,default:U.default,label:M});g[M]=z}}}o.on("error",Up[s](s,e))},SUBTITLES:(s,e)=>{const{tech:i,vhs:r,sourceType:o,segmentLoaders:{[s]:u},requestOptions:c,main:{mediaGroups:p},mediaTypes:{[s]:{groups:g,tracks:b}},mainPlaylistLoader:S}=e;for(const E in p[s]){g[E]||(g[E]=[]);for(const A in p[s][E]){if(!r.options_.useForcedSubtitles&&p[s][E][A].forced)continue;let M=p[s][E][A],U;if(o==="hls")U=new bu(M.resolvedUri,r,c);else if(o==="dash"){if(!M.playlists.filter(z=>z.excludeUntil!==1/0).length)return;U=new Dy(M.playlists[0],r,c,S)}else o==="vhs-json"&&(U=new bu(M.playlists?M.playlists[0]:M.resolvedUri,r,c));if(M=pt({id:A,playlistLoader:U},M),_x[s](s,M.playlistLoader,e),g[E].push(M),typeof b[A]>"u"){const D=i.addRemoteTextTrack({id:A,kind:"subtitles",default:M.default&&M.autoselect,language:M.language,label:A},!1).track;b[A]=D}}}u.on("error",Up[s](s,e))},"CLOSED-CAPTIONS":(s,e)=>{const{tech:i,main:{mediaGroups:r},mediaTypes:{[s]:{groups:o,tracks:u}}}=e;for(const c in r[s]){o[c]||(o[c]=[]);for(const p in r[s][c]){const g=r[s][c][p];if(!/^(?:CC|SERVICE)/.test(g.instreamId))continue;const b=i.options_.vhs&&i.options_.vhs.captionServices||{};let S={label:p,language:g.language,instreamId:g.instreamId,default:g.default&&g.autoselect};if(b[S.instreamId]&&(S=pt(S,b[S.instreamId])),S.default===void 0&&delete S.default,o[c].push(pt({id:p},g)),typeof u[p]>"u"){const E=i.addRemoteTextTrack({id:S.instreamId,kind:"captions",default:S.default,language:S.language,label:S.label},!1).track;u[p]=E}}}}},Tx=(s,e)=>{for(let i=0;ii=>{const{mainPlaylistLoader:r,mediaTypes:{[s]:{groups:o}}}=e,u=r.media();if(!u)return null;let c=null;u.attributes[s]&&(c=o[u.attributes[s]]);const p=Object.keys(o);if(!c)if(s==="AUDIO"&&p.length>1&&Od(e.main))for(let g=0;g"u"?c:i===null||!c?null:c.filter(g=>g.id===i.id)[0]||null},sL={AUDIO:(s,e)=>()=>{const{mediaTypes:{[s]:{tracks:i}}}=e;for(const r in i)if(i[r].enabled)return i[r];return null},SUBTITLES:(s,e)=>()=>{const{mediaTypes:{[s]:{tracks:i}}}=e;for(const r in i)if(i[r].mode==="showing"||i[r].mode==="hidden")return i[r];return null}},rL=(s,{mediaTypes:e})=>()=>{const i=e[s].activeTrack();return i?e[s].activeGroup(i):null},aL=s=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(b=>{iL[b](b,s)});const{mediaTypes:e,mainPlaylistLoader:i,tech:r,vhs:o,segmentLoaders:{["AUDIO"]:u,main:c}}=s;["AUDIO","SUBTITLES"].forEach(b=>{e[b].activeGroup=nL(b,s),e[b].activeTrack=sL[b](b,s),e[b].onGroupChanged=JM(b,s),e[b].onGroupChanging=eL(b,s),e[b].onTrackChanged=tL(b,s),e[b].getActiveGroup=rL(b,s)});const p=e.AUDIO.activeGroup();if(p){const b=(p.filter(E=>E.default)[0]||p[0]).id;e.AUDIO.tracks[b].enabled=!0,e.AUDIO.onGroupChanged(),e.AUDIO.onTrackChanged(),e.AUDIO.getActiveGroup().playlistLoader?(c.setAudio(!1),u.setAudio(!0)):c.setAudio(!0)}i.on("mediachange",()=>{["AUDIO","SUBTITLES"].forEach(b=>e[b].onGroupChanged())}),i.on("mediachanging",()=>{["AUDIO","SUBTITLES"].forEach(b=>e[b].onGroupChanging())});const g=()=>{e.AUDIO.onTrackChanged(),r.trigger({type:"usage",name:"vhs-audio-change"})};r.audioTracks().addEventListener("change",g),r.remoteTextTracks().addEventListener("change",e.SUBTITLES.onTrackChanged),o.on("dispose",()=>{r.audioTracks().removeEventListener("change",g),r.remoteTextTracks().removeEventListener("change",e.SUBTITLES.onTrackChanged)}),r.clearTracks("audio");for(const b in e.AUDIO.tracks)r.audioTracks().addTrack(e.AUDIO.tracks[b])},oL=()=>{const s={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{s[e]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:Mr,activeTrack:Mr,getActiveGroup:Mr,onGroupChanged:Mr,onTrackChanged:Mr,lastTrack_:null,logger_:$n(`MediaGroups[${e}]`)}}),s};class Sx{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_=ln(this.reloadUri_,e))}set priority(e){e&&e.length&&(this.priority_=e)}set pathwayClones(e){e&&e.length&&(this.pathwayClones_=new Map(e.map(i=>[i.ID,i])))}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 lL extends $.EventTarget{constructor(e,i){super(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=!1,this.availablePathways_=new Set,this.steeringManifest=new Sx,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_=$n("Content Steering"),this.xhr_=e,this.getBandwidth_=i}assignTagProperties(e,i){this.manifestType_=i.serverUri?"HLS":"DASH";const r=i.serverUri||i.serverURL;if(!r){this.logger_(`steering manifest URL is ${r}, cannot request steering manifest.`),this.trigger("error");return}if(r.startsWith("data:")){this.decodeDataUriManifest_(r.substring(r.indexOf(",")+1));return}this.steeringManifest.reloadUri=ln(e,r),this.defaultPathway=i.pathwayId||i.defaultServiceLocation,this.queryBeforeStart=i.queryBeforeStart,this.proxyServerUrl_=i.proxyServerURL,this.defaultPathway&&!this.queryBeforeStart&&this.trigger("content-steering")}requestSteeringManifest(e){const i=this.steeringManifest.reloadUri;if(!i)return;const r=e?i:this.getRequestURI(i);if(!r){this.logger_("No valid content steering manifest URIs. Stopping content steering."),this.trigger("error"),this.dispose();return}const o={contentSteeringInfo:{uri:r}};this.trigger({type:"contentsteeringloadstart",metadata:o}),this.request_=this.xhr_({uri:r,requestType:"content-steering-manifest"},(u,c)=>{if(u){if(c.status===410){this.logger_(`manifest request 410 ${u}.`),this.logger_(`There will be no more content steering requests to ${r} this session.`),this.excludedSteeringManifestURLs.add(r);return}if(c.status===429){const b=c.responseHeaders["retry-after"];this.logger_(`manifest request 429 ${u}.`),this.logger_(`content steering will retry in ${b} seconds.`),this.startTTLTimeout_(parseInt(b,10));return}this.logger_(`manifest failed to load ${u}.`),this.startTTLTimeout_();return}this.trigger({type:"contentsteeringloadcomplete",metadata:o});let p;try{p=JSON.parse(this.request_.responseText)}catch(b){const S={errorType:$.Error.StreamingContentSteeringParserError,error:b};this.trigger({type:"error",metadata:S})}this.assignSteeringProperties_(p);const g={contentSteeringInfo:o.contentSteeringInfo,contentSteeringManifest:{version:this.steeringManifest.version,reloadUri:this.steeringManifest.reloadUri,priority:this.steeringManifest.priority}};this.trigger({type:"contentsteeringparsed",metadata:g}),this.startTTLTimeout_()})}setProxyServerUrl_(e){const i=new P.URL(e),r=new P.URL(this.proxyServerUrl_);return r.searchParams.set("url",encodeURI(i.toString())),this.setSteeringParams_(r.toString())}decodeDataUriManifest_(e){const i=JSON.parse(P.atob(e));this.assignSteeringProperties_(i)}setSteeringParams_(e){const i=new P.URL(e),r=this.getPathway(),o=this.getBandwidth_();if(r){const u=`_${this.manifestType_}_pathway`;i.searchParams.set(u,r)}if(o){const u=`_${this.manifestType_}_throughput`;i.searchParams.set(u,o)}return i.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 r=(o=>{for(const u of o)if(this.availablePathways_.has(u))return u;return[...this.availablePathways_][0]})(this.steeringManifest.priority);this.currentPathway!==r&&(this.currentPathway=r,this.trigger("content-steering"))}getPathway(){return this.currentPathway||this.defaultPathway}getRequestURI(e){if(!e)return null;const i=o=>this.excludedSteeringManifestURLs.has(o);if(this.proxyServerUrl_){const o=this.setProxyServerUrl_(e);if(!i(o))return o}const r=this.setSteeringParams_(e);return i(r)?null:r}startTTLTimeout_(e=this.steeringManifest.ttl){const i=e*1e3;this.ttlTimeout_=P.setTimeout(()=>{this.requestSteeringManifest()},i)}clearTTLTimeout_(){P.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 Sx}addAvailablePathway(e){e&&this.availablePathways_.add(e)}clearAvailablePathways(){this.availablePathways_.clear()}excludePathway(e){return this.availablePathways_.delete(e)}didDASHTagChange(e,i){return!i&&this.steeringManifest.reloadUri||i&&(ln(e,i.serverURL)!==this.steeringManifest.reloadUri||i.defaultServiceLocation!==this.defaultPathway||i.queryBeforeStart!==this.queryBeforeStart||i.proxyServerURL!==this.proxyServerUrl_)}getAvailablePathways(){return this.availablePathways_}}const uL=(s,e)=>{let i=null;return(...r)=>{clearTimeout(i),i=setTimeout(()=>{s.apply(null,r)},e)}},cL=10;let Oa;const dL=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],hL=function(s){return this.audioSegmentLoader_[s]+this.mainSegmentLoader_[s]},fL=function({currentPlaylist:s,buffered:e,currentTime:i,nextPlaylist:r,bufferLowWaterLine:o,bufferHighWaterLine:u,duration:c,bufferBasedABR:p,log:g}){if(!r)return $.log.warn("We received no playlist to switch to. Please check your stream."),!1;const b=`allowing switch ${s&&s.id||"null"} -> ${r.id}`;if(!s)return g(`${b} as current playlist is not set`),!0;if(r.id===s.id)return!1;const S=!!gu(e,i).length;if(!s.endList)return!S&&typeof s.partTargetDuration=="number"?(g(`not ${b} as current playlist is live llhls, but currentTime isn't in buffered.`),!1):(g(`${b} as current playlist is live`),!0);const E=gy(e,i),A=p?fi.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:fi.MAX_BUFFER_LOW_WATER_LINE;if(cU)&&E>=o){let D=`${b} as forwardBuffer >= bufferLowWaterLine (${E} >= ${o})`;return p&&(D+=` and next bandwidth > current bandwidth (${M} > ${U})`),g(D),!0}return g(`not ${b} as no switching criteria met`),!1};class pL extends $.EventTarget{constructor(e){super(),this.fastQualityChange_=uL(this.fastQualityChange_.bind(this),100);const{src:i,withCredentials:r,tech:o,bandwidth:u,externVhs:c,useCueTags:p,playlistExclusionDuration:g,enableLowInitialPlaylist:b,sourceType:S,cacheEncryptionKeys:E,bufferBasedABR:A,leastPixelDiffSelector:M,captionServices:U,experimentalUseMMS:D}=e;if(!i)throw new Error("A non-empty playlist URL or JSON manifest string is required");let{maxPlaylistRetries:z}=e;(z===null||typeof z>"u")&&(z=1/0),Oa=c,this.bufferBasedABR=!!A,this.leastPixelDiffSelector=!!M,this.withCredentials=r,this.tech_=o,this.vhs_=o.vhs,this.player_=e.player_,this.sourceType_=S,this.useCueTags_=p,this.playlistExclusionDuration=g,this.maxPlaylistRetries=z,this.enableLowInitialPlaylist=b,this.usingManagedMediaSource_=!1,this.useCueTags_&&(this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues"),this.cueTagsTrack_.inBandMetadataTrackDispatchType=""),this.requestOptions_={withCredentials:r,maxPlaylistRetries:z,timeout:null},this.on("error",this.pauseLoading),this.mediaTypes_=oL(),D&&P.ManagedMediaSource?(this.tech_.el_.disableRemotePlayback=!0,this.mediaSource=new P.ManagedMediaSource,this.usingManagedMediaSource_=!0,$.log("Using ManagedMediaSource")):P.MediaSource&&(this.mediaSource=new P.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_=hi(),this.hasPlayed_=!1,this.syncController_=new YM(e),this.segmentMetadataTrack_=o.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.segmentMetadataTrack_.mode="hidden",this.decrypter_=new KM,this.sourceUpdater_=new fx(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new WM,this.keyStatusMap_=new Map;const H={vhs:this.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,captionServices:U,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:u,syncController:this.syncController_,decrypter:this.decrypter_,sourceType:this.sourceType_,inbandTextTracks:this.inbandTextTracks_,cacheEncryptionKeys:E,sourceUpdater:this.sourceUpdater_,timelineChangeController:this.timelineChangeController_,exactManifestTimings:e.exactManifestTimings,addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)};this.mainPlaylistLoader_=this.sourceType_==="dash"?new Dy(i,this.vhs_,pt(this.requestOptions_,{addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)})):new bu(i,this.vhs_,pt(this.requestOptions_,{addDateRangesToTextTrack:this.addDateRangesToTextTrack_.bind(this)})),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new Ly(pt(H,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new Ly(pt(H,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new qM(pt(H,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise((Q,Z)=>{function W(){o.off("vttjserror",G),Q()}function G(){o.off("vttjsloaded",W),Z()}o.one("vttjsloaded",W),o.one("vttjserror",G),o.addWebVttScript_()})}),e);const Y=()=>this.mainSegmentLoader_.bandwidth;this.contentSteeringController_=new lL(this.vhs_.xhr,Y),this.setupSegmentLoaderListeners_(),this.bufferBasedABR&&(this.mainPlaylistLoader_.one("loadedplaylist",()=>this.startABRTimer_()),this.tech_.on("pause",()=>this.stopABRTimer_()),this.tech_.on("play",()=>this.startABRTimer_())),dL.forEach(Q=>{this[Q+"_"]=hL.bind(this,Q)}),this.logger_=$n("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 V=this.tech_.preload()==="none"?"play":"loadstart";this.tech_.one(V,()=>{const Q=Date.now();this.tech_.one("loadeddata",()=>{this.timeToLoadedData__=Date.now()-Q,this.mainAppendsToLoadedData__=this.mainSegmentLoader_.mediaAppends,this.audioAppendsToLoadedData__=this.audioSegmentLoader_.mediaAppends})})}mainAppendsToLoadedData_(){return this.mainAppendsToLoadedData__}audioAppendsToLoadedData_(){return this.audioAppendsToLoadedData__}appendsToLoadedData_(){const e=this.mainAppendsToLoadedData_(),i=this.audioAppendsToLoadedData_();return e===-1||i===-1?-1:e+i}timeToLoadedData_(){return this.timeToLoadedData__}checkABR_(e="abr"){const i=this.selectPlaylist();i&&this.shouldSwitchToMedia_(i)&&this.switchMedia_(i,e)}switchMedia_(e,i,r){const o=this.media(),u=o&&(o.id||o.uri),c=e&&(e.id||e.uri);if(u&&u!==c){this.logger_(`switch media ${u} -> ${c} from ${i}`);const p={renditionInfo:{id:c,bandwidth:e.attributes.BANDWIDTH,resolution:e.attributes.RESOLUTION,codecs:e.attributes.CODECS},cause:i};this.trigger({type:"renditionselected",metadata:p}),this.tech_.trigger({type:"usage",name:`vhs-rendition-change-${i}`})}this.mainPlaylistLoader_.media(e,r)}switchMediaForDASHContentSteering_(){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{const i=this.mediaTypes_[e],r=i?i.activeGroup():null,o=this.contentSteeringController_.getPathway();if(r&&o){const c=(r.length?r[0].playlists:r.playlists).filter(p=>p.attributes.serviceLocation===o);c.length&&this.mediaTypes_[e].activePlaylistLoader.media(c[0])}})}startABRTimer_(){this.stopABRTimer_(),this.abrTimer_=P.setInterval(()=>this.checkABR_(),250)}stopABRTimer_(){this.tech_.scrubbing&&this.tech_.scrubbing()||(P.clearInterval(this.abrTimer_),this.abrTimer_=null)}getAudioTrackPlaylists_(){const e=this.main(),i=e&&e.playlists||[];if(!e||!e.mediaGroups||!e.mediaGroups.AUDIO)return i;const r=e.mediaGroups.AUDIO,o=Object.keys(r);let u;if(Object.keys(this.mediaTypes_.AUDIO.groups).length)u=this.mediaTypes_.AUDIO.activeTrack();else{const p=r.main||o.length&&r[o[0]];for(const g in p)if(p[g].default){u={label:g};break}}if(!u)return i;const c=[];for(const p in r)if(r[p][u.label]){const g=r[p][u.label];if(g.playlists&&g.playlists.length)c.push.apply(c,g.playlists);else if(g.uri)c.push(g);else if(e.playlists.length)for(let b=0;b{const i=this.mainPlaylistLoader_.media(),r=i.targetDuration*1.5*1e3;_y(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=r,i.endList&&this.tech_.preload()!=="none"&&(this.mainSegmentLoader_.playlist(i,this.requestOptions_),this.mainSegmentLoader_.load()),aL({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(),i),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 i=this.mainPlaylistLoader_.media();if(!i){this.attachContentSteeringListeners_(),this.initContentSteeringController_(),this.excludeUnsupportedVariants_();let r;if(this.enableLowInitialPlaylist&&(r=this.selectInitialPlaylist()),r||(r=this.selectPlaylist()),!r||!this.shouldSwitchToMedia_(r)||(this.initialMedia_=r,this.switchMedia_(this.initialMedia_,"initial"),!(this.sourceType_==="vhs-json"&&this.initialMedia_.segments)))return;i=this.initialMedia_}this.handleUpdatedMediaPlaylist(i)}),this.mainPlaylistLoader_.on("error",()=>{const i=this.mainPlaylistLoader_.error;this.excludePlaylist({playlistToExclude:i.playlist,error:i})}),this.mainPlaylistLoader_.on("mediachanging",()=>{this.mainSegmentLoader_.abort(),this.mainSegmentLoader_.pause()}),this.mainPlaylistLoader_.on("mediachange",()=>{const i=this.mainPlaylistLoader_.media(),r=i.targetDuration*1.5*1e3;_y(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=r,this.sourceType_==="dash"&&this.mainPlaylistLoader_.isPaused&&this.mainPlaylistLoader_.load(),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(i,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_?this.runFastQualitySwitch_():this.mainSegmentLoader_.load(),this.tech_.trigger({type:"mediachange",bubbles:!0})}),this.mainPlaylistLoader_.on("playlistunchanged",()=>{const i=this.mainPlaylistLoader_.media();if(i.lastExcludeReason_==="playlist-unchanged")return;this.stuckAtPlaylistEnd_(i)&&(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(i=>{this.mainPlaylistLoader_.on(i,r=>{this.player_.trigger(Ft({},r))})})}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,i){const r=e.mediaGroups||{};let o=!0;const u=Object.keys(r.AUDIO);for(const c in r.AUDIO)for(const p in r.AUDIO[c])r.AUDIO[c][p].uri||(o=!1);o&&this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),Object.keys(r.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),Oa.Playlist.isAes(i)&&this.tech_.trigger({type:"usage",name:"vhs-aes"}),u.length&&Object.keys(r.AUDIO[u[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 i=this.mainPlaylistLoader_.media()||this.mainPlaylistLoader_.pendingMedia_,r=this.tech_.currentTime(),o=this.bufferLowWaterLine(),u=this.bufferHighWaterLine(),c=this.tech_.buffered();return fL({buffered:c,currentTime:r,currentPlaylist:i,nextPlaylist:e,bufferLowWaterLine:o,bufferHighWaterLine:u,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 r=this.mainSegmentLoader_.error();this.excludePlaylist({playlistToExclude:r.playlist,error:r})}),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 r=this.audioSegmentLoader_.pendingSegment_;if(!r||!r.segment||!r.segment.syncInfo)return;const o=r.segment.syncInfo.end+.01;this.tech_.setCurrentTime(o)}),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",r=>{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:cL}))});const e=()=>{if(!this.sourceUpdater_.hasCreatedSourceBuffers())return this.tryToCreateSourceBuffers_();const r=this.getCodecsOrExclude_();r&&this.sourceUpdater_.addOrChangeSourceBuffers(r)};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(r=>{this.mainSegmentLoader_.on(r,o=>{this.player_.trigger(Ft({},o))}),this.audioSegmentLoader_.on(r,o=>{this.player_.trigger(Ft({},o))}),this.subtitleSegmentLoader_.on(r,o=>{this.player_.trigger(Ft({},o))})})}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(){})}this.trigger("sourceopen")}handleSourceEnded_(){if(!this.inbandTextTracks_.metadataTrack_)return;const e=this.inbandTextTracks_.metadataTrack_.cues;if(!e||!e.length)return;const i=this.duration();e[e.length-1].endTime=isNaN(i)||Math.abs(i)===1/0?Number.MAX_VALUE:i}handleDurationChange_(){this.tech_.trigger("durationchange")}onEndOfStream(){let e=this.mainSegmentLoader_.ended_;if(this.mediaTypes_.AUDIO.activePlaylistLoader){const i=this.mainSegmentLoader_.getCurrentMediaInfo_();!i||i.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 r=this.syncController_.getExpiredTime(e,this.duration());if(r===null)return!1;const o=Oa.Playlist.playlistEnd(e,r),u=this.tech_.currentTime(),c=this.tech_.buffered();if(!c.length)return o-u<=Hs;const p=c.end(c.length-1);return p-u<=Hs&&o-p<=Hs}excludePlaylist({playlistToExclude:e=this.mainPlaylistLoader_.media(),error:i={},playlistExclusionDuration:r}){if(e=e||this.mainPlaylistLoader_.media(),r=r||i.playlistExclusionDuration||this.playlistExclusionDuration,!e){this.error=i,this.mediaSource.readyState!=="open"?this.trigger("error"):this.sourceUpdater_.endOfStream("network");return}e.playlistErrors_++;const o=this.mainPlaylistLoader_.main.playlists,u=o.filter(Lp),c=u.length===1&&u[0]===e;if(o.length===1&&r!==1/0)return $.log.warn(`Problem encountered with playlist ${e.id}. Trying again since it is the only playlist.`),this.tech_.trigger("retryplaylist"),this.mainPlaylistLoader_.load(c);if(c){if(this.main().contentSteering){const U=this.pathwayAttribute_(e),D=this.contentSteeringController_.steeringManifest.ttl*1e3;this.contentSteeringController_.excludePathway(U),this.excludeThenChangePathway_(),setTimeout(()=>{this.contentSteeringController_.addAvailablePathway(U)},D);return}let M=!1;o.forEach(U=>{if(U===e)return;const D=U.excludeUntil;typeof D<"u"&&D!==1/0&&(M=!0,delete U.excludeUntil)}),M&&($.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}let p;e.playlistErrors_>this.maxPlaylistRetries?p=1/0:p=Date.now()+r*1e3,e.excludeUntil=p,i.reason&&(e.lastExcludeReason_=i.reason),this.tech_.trigger("excludeplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-excluded"});const g=this.selectPlaylist();if(!g){this.error="Playback cannot continue. No available working or supported playlists.",this.trigger("error");return}const b=i.internal?this.logger_:$.log.warn,S=i.message?" "+i.message:"";b(`${i.internal?"Internal problem":"Problem"} encountered with playlist ${e.id}.${S} Switching to playlist ${g.id}.`),g.attributes.AUDIO!==e.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),g.attributes.SUBTITLES!==e.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]);const E=g.targetDuration/2*1e3||5*1e3,A=typeof g.lastRequest=="number"&&Date.now()-g.lastRequest<=E;return this.switchMedia_(g,"exclude",c||A)}pauseLoading(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()}delegateLoaders_(e,i){const r=[],o=e==="all";(o||e==="main")&&r.push(this.mainPlaylistLoader_);const u=[];(o||e==="audio")&&u.push("AUDIO"),(o||e==="subtitle")&&(u.push("CLOSED-CAPTIONS"),u.push("SUBTITLES")),u.forEach(c=>{const p=this.mediaTypes_[c]&&this.mediaTypes_[c].activePlaylistLoader;p&&r.push(p)}),["main","audio","subtitle"].forEach(c=>{const p=this[`${c}SegmentLoader_`];p&&(e===c||e==="all")&&r.push(p)}),r.forEach(c=>i.forEach(p=>{typeof c[p]=="function"&&c[p]()}))}setCurrentTime(e){const i=gu(this.tech_.buffered(),e);if(!(this.mainPlaylistLoader_&&this.mainPlaylistLoader_.media())||!this.mainPlaylistLoader_.media().segments)return 0;if(i&&i.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:Oa.Playlist.duration(e):1/0:0}seekable(){return this.seekable_}getSeekableRange_(e,i){const r=e.media();if(!r)return null;const o=this.syncController_.getMediaSequenceSync(i);if(o&&o.isReliable){const p=o.start,g=o.end;if(!isFinite(p)||!isFinite(g))return null;const b=Oa.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,r),S=Math.max(p,g-b);return hi([[p,S]])}const u=this.syncController_.getExpiredTime(r,this.duration());if(u===null)return null;const c=Oa.Playlist.seekable(r,u,Oa.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,r));return c.length?c:null}computeFinalSeekable_(e,i){if(!i)return e;const r=e.start(0),o=e.end(0),u=i.start(0),c=i.end(0);return u>o||r>c?e:hi([[Math.max(r,u),Math.min(o,c)]])}onSyncInfoUpdate_(){if(!this.mainPlaylistLoader_)return;const e=this.getSeekableRange_(this.mainPlaylistLoader_,"main");if(!e)return;let i;if(this.mediaTypes_.AUDIO.activePlaylistLoader&&(i=this.getSeekableRange_(this.mediaTypes_.AUDIO.activePlaylistLoader,"audio"),!i))return;const r=this.seekable_;if(this.seekable_=this.computeFinalSeekable_(e,i),!this.seekable_||r&&r.length&&this.seekable_.length&&r.start(0)===this.seekable_.start(0)&&r.end(0)===this.seekable_.end(0))return;this.logger_(`seekable updated [${dS(this.seekable_)}]`);const o={seekableRanges:this.seekable_};this.trigger({type:"seekablerangeschanged",metadata:o}),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 o=this.seekable();if(!o.length)return;(isNaN(this.mediaSource.duration)||this.mediaSource.duration0&&(r=Math.max(r,i.end(i.length-1))),this.mediaSource.duration!==r&&this.sourceUpdater_.setDuration(r)}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 i=this.mediaTypes_[e].groups;for(const r in i)i[r].forEach(o=>{o.playlistLoader&&o.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,i=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),r=e?!!this.audioSegmentLoader_.getCurrentMediaInfo_():!0;return!(!i||!r)}getCodecsOrExclude_(){const e={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}},i=this.mainSegmentLoader_.getPendingSegmentPlaylist()||this.media();e.video=e.main;const r=Md(this.main(),i),o={},u=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(e.main.hasVideo&&(o.video=r.video||e.main.videoCodec||Fk),e.main.isMuxed&&(o.video+=`,${r.audio||e.main.audioCodec||nT}`),(e.main.hasAudio&&!e.main.isMuxed||e.audio.hasAudio||u)&&(o.audio=r.audio||e.main.audioCodec||e.audio.audioCodec||nT,e.audio.isFmp4=e.main.hasAudio&&!e.main.isMuxed?e.main.isFmp4:e.audio.isFmp4),!o.audio&&!o.video){this.excludePlaylist({playlistToExclude:i,error:{message:"Could not determine codecs for playlist."},playlistExclusionDuration:1/0});return}const c=(b,S)=>b?id(S,this.usingManagedMediaSource_):Gg(S),p={};let g;if(["video","audio"].forEach(function(b){if(o.hasOwnProperty(b)&&!c(e[b].isFmp4,o[b])){const S=e[b].isFmp4?"browser":"muxer";p[S]=p[S]||[],p[S].push(o[b]),b==="audio"&&(g=S)}}),u&&g&&i.attributes.AUDIO){const b=i.attributes.AUDIO;this.main().playlists.forEach(S=>{(S.attributes&&S.attributes.AUDIO)===b&&S!==i&&(S.excludeUntil=1/0)}),this.logger_(`excluding audio group ${b} as ${g} does not support codec(s): "${o.audio}"`)}if(Object.keys(p).length){const b=Object.keys(p).reduce((S,E)=>(S&&(S+=", "),S+=`${E} does not support codec(s): "${p[E].join(",")}"`,S),"")+".";this.excludePlaylist({playlistToExclude:i,error:{internal:!0,message:b},playlistExclusionDuration:1/0});return}if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){const b=[];if(["video","audio"].forEach(S=>{const E=(Rs(this.sourceUpdater_.codecs[S]||"")[0]||{}).type,A=(Rs(o[S]||"")[0]||{}).type;E&&A&&E.toLowerCase()!==A.toLowerCase()&&b.push(`"${this.sourceUpdater_.codecs[S]}" -> "${o[S]}"`)}),b.length){this.excludePlaylist({playlistToExclude:i,error:{message:`Codec switching not supported: ${b.join(", ")}.`,internal:!0},playlistExclusionDuration:1/0});return}}return o}tryToCreateSourceBuffers_(){if(this.mediaSource.readyState!=="open"||this.sourceUpdater_.hasCreatedSourceBuffers()||!this.areMediaTypesKnown_())return;const e=this.getCodecsOrExclude_();if(!e)return;this.sourceUpdater_.createSourceBuffers(e);const i=[e.video,e.audio].filter(Boolean).join(",");this.excludeIncompatibleVariants_(i)}excludeUnsupportedVariants_(){const e=this.main().playlists,i=[];Object.keys(e).forEach(r=>{const o=e[r];if(i.indexOf(o.id)!==-1)return;i.push(o.id);const u=Md(this.main,o),c=[];u.audio&&!Gg(u.audio)&&!id(u.audio,this.usingManagedMediaSource_)&&c.push(`audio codec ${u.audio}`),u.video&&!Gg(u.video)&&!id(u.video,this.usingManagedMediaSource_)&&c.push(`video codec ${u.video}`),u.text&&u.text==="stpp.ttml.im1t"&&c.push(`text codec ${u.text}`),c.length&&(o.excludeUntil=1/0,this.logger_(`excluding ${o.id} for unsupported: ${c.join(", ")}`))})}excludeIncompatibleVariants_(e){const i=[],r=this.main().playlists,o=Rd(Rs(e)),u=kS(o),c=o.video&&Rs(o.video)[0]||null,p=o.audio&&Rs(o.audio)[0]||null;Object.keys(r).forEach(g=>{const b=r[g];if(i.indexOf(b.id)!==-1||b.excludeUntil===1/0)return;i.push(b.id);const S=[],E=Md(this.mainPlaylistLoader_.main,b),A=kS(E);if(!(!E.audio&&!E.video)){if(A!==u&&S.push(`codec count "${A}" !== "${u}"`),!this.sourceUpdater_.canChangeType()){const M=E.video&&Rs(E.video)[0]||null,U=E.audio&&Rs(E.audio)[0]||null;M&&c&&M.type.toLowerCase()!==c.type.toLowerCase()&&S.push(`video codec "${M.type}" !== "${c.type}"`),U&&p&&U.type.toLowerCase()!==p.type.toLowerCase()&&S.push(`audio codec "${U.type}" !== "${p.type}"`)}S.length&&(b.excludeUntil=1/0,this.logger_(`excluding ${b.id}: ${S.join(" && ")}`))}})}updateAdCues_(e){let i=0;const r=this.seekable();r.length&&(i=r.start(0)),$M(e,this.cueTagsTrack_,i)}goalBufferLength(){const e=this.tech_.currentTime(),i=fi.GOAL_BUFFER_LENGTH,r=fi.GOAL_BUFFER_LENGTH_RATE,o=Math.max(i,fi.MAX_GOAL_BUFFER_LENGTH);return Math.min(i+e*r,o)}bufferLowWaterLine(){const e=this.tech_.currentTime(),i=fi.BUFFER_LOW_WATER_LINE,r=fi.BUFFER_LOW_WATER_LINE_RATE,o=Math.max(i,fi.MAX_BUFFER_LOW_WATER_LINE),u=Math.max(i,fi.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(i+e*r,this.bufferBasedABR?u:o)}bufferHighWaterLine(){return fi.BUFFER_HIGH_WATER_LINE}addDateRangesToTextTrack_(e){ax(this.inbandTextTracks_,"com.apple.streaming",this.tech_),EM({inbandTextTracks:this.inbandTextTracks_,dateRanges:e})}addMetadataToTextTrack(e,i,r){const o=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();ax(this.inbandTextTracks_,e,this.tech_),TM({inbandTextTracks:this.inbandTextTracks_,metadataArray:i,timestampOffset:o,videoDuration:r})}pathwayAttribute_(e){return e.attributes["PATHWAY-ID"]||e.attributes.serviceLocation}initContentSteeringController_(){const e=this.main();if(e.contentSteering){for(const i of e.playlists)this.contentSteeringController_.addAvailablePathway(this.pathwayAttribute_(i));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(i=>{this.contentSteeringController_.on(i,r=>{this.trigger(Ft({},r))})}),this.sourceType_==="dash"&&this.mainPlaylistLoader_.on("loadedplaylist",()=>{const i=this.main();(this.contentSteeringController_.didDASHTagChange(i.uri,i.contentSteering)||(()=>{const u=this.contentSteeringController_.getAvailablePathways(),c=[];for(const p of i.playlists){const g=p.attributes.serviceLocation;if(g&&(c.push(g),!u.has(g)))return!0}return!!(!c.length&&u.size)})())&&this.resetContentSteeringController_()})}excludeThenChangePathway_(){const e=this.contentSteeringController_.getPathway();if(!e)return;this.handlePathwayClones_();const r=this.main().playlists,o=new Set;let u=!1;Object.keys(r).forEach(c=>{const p=r[c],g=this.pathwayAttribute_(p),b=g&&e!==g;p.excludeUntil===1/0&&p.lastExcludeReason_==="content-steering"&&!b&&(delete p.excludeUntil,delete p.lastExcludeReason_,u=!0);const E=!p.excludeUntil&&p.excludeUntil!==1/0;!o.has(p.id)&&b&&E&&(o.add(p.id),p.excludeUntil=1/0,p.lastExcludeReason_="content-steering",this.logger_(`excluding ${p.id} for ${p.lastExcludeReason_}`))}),this.contentSteeringController_.manifestType_==="DASH"&&Object.keys(this.mediaTypes_).forEach(c=>{const p=this.mediaTypes_[c];if(p.activePlaylistLoader){const g=p.activePlaylistLoader.media_;g&&g.attributes.serviceLocation!==e&&(u=!0)}}),u&&this.changeSegmentPathway_()}handlePathwayClones_(){const i=this.main().playlists,r=this.contentSteeringController_.currentPathwayClones,o=this.contentSteeringController_.nextPathwayClones;if(r&&r.size||o&&o.size){for(const[c,p]of r.entries())o.get(c)||(this.mainPlaylistLoader_.updateOrDeleteClone(p),this.contentSteeringController_.excludePathway(c));for(const[c,p]of o.entries()){const g=r.get(c);if(!g){i.filter(S=>S.attributes["PATHWAY-ID"]===p["BASE-ID"]).forEach(S=>{this.mainPlaylistLoader_.addClonePathway(p,S)}),this.contentSteeringController_.addAvailablePathway(c);continue}this.equalPathwayClones_(g,p)||(this.mainPlaylistLoader_.updateOrDeleteClone(p,!0),this.contentSteeringController_.addAvailablePathway(c))}this.contentSteeringController_.currentPathwayClones=new Map(JSON.parse(JSON.stringify([...o])))}}equalPathwayClones_(e,i){if(e["BASE-ID"]!==i["BASE-ID"]||e.ID!==i.ID||e["URI-REPLACEMENT"].HOST!==i["URI-REPLACEMENT"].HOST)return!1;const r=e["URI-REPLACEMENT"].PARAMS,o=i["URI-REPLACEMENT"].PARAMS;for(const u in r)if(r[u]!==o[u])return!1;for(const u in o)if(r[u]!==o[u])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 i="non-usable";this.mainPlaylistLoader_.main.playlists.forEach(r=>{const o=this.mainPlaylistLoader_.getKeyIdSet(r);!o||!o.size||o.forEach(u=>{const c="usable",p=this.keyStatusMap_.has(u)&&this.keyStatusMap_.get(u)===c,g=r.lastExcludeReason_===i&&r.excludeUntil===1/0;p?p&&g&&(delete r.excludeUntil,delete r.lastExcludeReason_,this.logger_(`enabling playlist ${r.id} because key ID ${u} is ${c}`)):(r.excludeUntil!==1/0&&r.lastExcludeReason_!==i&&(r.excludeUntil=1/0,r.lastExcludeReason_=i,this.logger_(`excluding playlist ${r.id} because the key ID ${u} doesn't exist in the keyStatusMap or is not ${c}`)),e++)})}),e>=this.mainPlaylistLoader_.main.playlists.length&&this.mainPlaylistLoader_.main.playlists.forEach(r=>{const o=r&&r.attributes&&r.attributes.RESOLUTION&&r.attributes.RESOLUTION.height<720,u=r.excludeUntil===1/0&&r.lastExcludeReason_===i;o&&u&&(delete r.excludeUntil,$.log.warn(`enabling non-HD playlist ${r.id} because all playlists were excluded due to ${i} key IDs`))})}addKeyStatus_(e,i){const u=(typeof e=="string"?e:zM(e)).slice(0,32).toLowerCase();this.logger_(`KeyStatus '${i}' with key ID ${u} added to the keyStatusMap`),this.keyStatusMap_.set(u,i)}updatePlaylistByKeyStatus(e,i){this.addKeyStatus_(e,i),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 mL=(s,e,i)=>r=>{const o=s.main.playlists[e],u=by(o),c=Lp(o);if(typeof r>"u")return c;r?delete o.disabled:o.disabled=!0;const p={renditionInfo:{id:e,bandwidth:o.attributes.BANDWIDTH,resolution:o.attributes.RESOLUTION,codecs:o.attributes.CODECS},cause:"fast-quality"};return r!==c&&!u&&(r?(i(o),s.trigger({type:"renditionenabled",metadata:p})):s.trigger({type:"renditiondisabled",metadata:p})),r};class gL{constructor(e,i,r){const{playlistController_:o}=e,u=o.fastQualityChange_.bind(o);if(i.attributes){const c=i.attributes.RESOLUTION;this.width=c&&c.width,this.height=c&&c.height,this.bandwidth=i.attributes.BANDWIDTH,this.frameRate=i.attributes["FRAME-RATE"]}this.codecs=Md(o.main(),i),this.playlist=i,this.id=r,this.enabled=mL(e.playlists,i.id,u)}}const yL=function(s){s.representations=()=>{const e=s.playlistController_.main(),i=Od(e)?s.playlistController_.getAudioTrackPlaylists_():e.playlists;return i?i.filter(r=>!by(r)).map((r,o)=>new gL(s,r,r.id)):[]}},xx=["seeking","seeked","pause","playing","error"];class vL extends $.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_=$n("PlaybackWatcher"),this.logger_("initialize");const i=()=>this.monitorCurrentTime_(),r=()=>this.monitorCurrentTime_(),o=()=>this.techWaiting_(),u=()=>this.resetTimeUpdate_(),c=this.playlistController_,p=["main","subtitle","audio"],g={};p.forEach(S=>{g[S]={reset:()=>this.resetSegmentDownloads_(S),updateend:()=>this.checkSegmentDownloads_(S)},c[`${S}SegmentLoader_`].on("appendsdone",g[S].updateend),c[`${S}SegmentLoader_`].on("playlistupdate",g[S].reset),this.tech_.on(["seeked","seeking"],g[S].reset)});const b=S=>{["main","audio"].forEach(E=>{c[`${E}SegmentLoader_`][S]("appended",this.seekingAppendCheck_)})};this.seekingAppendCheck_=()=>{this.fixesBadSeeks_()&&(this.consecutiveUpdates=0,this.lastRecordedTime=this.tech_.currentTime(),b("off"))},this.clearSeekingAppendCheck_=()=>b("off"),this.watchForBadSeeking_=()=>{this.clearSeekingAppendCheck_(),b("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",o),this.tech_.on(xx,u),this.tech_.on("canplay",r),this.tech_.one("play",i),this.dispose=()=>{this.clearSeekingAppendCheck_(),this.logger_("dispose"),this.tech_.off("waiting",o),this.tech_.off(xx,u),this.tech_.off("canplay",r),this.tech_.off("play",i),this.tech_.off("seeking",this.watchForBadSeeking_),this.tech_.off("seeked",this.clearSeekingAppendCheck_),p.forEach(S=>{c[`${S}SegmentLoader_`].off("appendsdone",g[S].updateend),c[`${S}SegmentLoader_`].off("playlistupdate",g[S].reset),this.tech_.off(["seeked","seeking"],g[S].reset)}),this.checkCurrentTimeTimeout_&&P.clearTimeout(this.checkCurrentTimeTimeout_),this.resetTimeUpdate_()}}monitorCurrentTime_(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&P.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=P.setTimeout(this.monitorCurrentTime_.bind(this),250)}resetSegmentDownloads_(e){const i=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_`]=i.buffered_()}checkSegmentDownloads_(e){const i=this.playlistController_,r=i[`${e}SegmentLoader_`],o=r.buffered_(),u=a4(this[`${e}Buffered_`],o);if(this[`${e}Buffered_`]=o,u){const c={bufferedRanges:o};i.trigger({type:"bufferedrangeschanged",metadata:c}),this.resetSegmentDownloads_(e);return}this[`${e}StalledDownloads_`]++,this.logger_(`found #${this[`${e}StalledDownloads_`]} ${e} appends that did not increase buffer (possible stalled download)`,{playlistId:r.playlist_&&r.playlist_.id,buffered:Io(o)}),!(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"&&i.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(),i=this.tech_.buffered();if(this.lastRecordedTime===e&&(!i.length||e+Hs>=i.end(i.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(hi([this.lastRecordedTime,e]));const r={playedRanges:this.playedRanges_};this.playlistController_.trigger({type:"playedrangeschanged",metadata:r}),this.consecutiveUpdates=0,this.lastRecordedTime=e}}resetTimeUpdate_(){this.consecutiveUpdates=0}fixesBadSeeks_(){if(!this.tech_.seeking())return!1;const i=this.seekable(),r=this.tech_.currentTime(),o=this.afterSeekableWindow_(i,r,this.media(),this.allowSeeksWithinUnsafeLiveWindow);let u;if(o&&(u=i.end(i.length-1)),this.beforeSeekableWindow_(i,r)){const U=i.start(0);u=U+(U===i.end(0)?0:Hs)}if(typeof u<"u")return this.logger_(`Trying to seek outside of seekable at time ${r} with seekable range ${dS(i)}. Seeking to ${u}.`),this.tech_.setCurrentTime(u),!0;const c=this.playlistController_.sourceUpdater_,p=this.tech_.buffered(),g=c.audioBuffer?c.audioBuffered():null,b=c.videoBuffer?c.videoBuffered():null,S=this.media(),E=S.partTargetDuration?S.partTargetDuration:(S.targetDuration-Fs)*2,A=[g,b];for(let U=0;U ${r.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(),i=this.tech_.currentTime();if(this.tech_.seeking())return!0;if(this.beforeSeekableWindow_(e,i)){const p=e.end(e.length-1);return this.logger_(`Fell out of live window at time ${i}. Seeking to live point (seekable end) ${p}`),this.resetTimeUpdate_(),this.tech_.setCurrentTime(p),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),!0}const r=this.tech_.vhs.playlistController_.sourceUpdater_,o=this.tech_.buffered();if(this.videoUnderflow_({audioBuffered:r.audioBuffered(),videoBuffered:r.videoBuffered(),currentTime:i}))return this.resetTimeUpdate_(),this.tech_.setCurrentTime(i),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),!0;const c=Mp(o,i);return c.length>0?(this.logger_(`Stopped at ${i} and seeking to ${c.start(0)}`),this.resetTimeUpdate_(),this.skipTheGap_(i),!0):!1}afterSeekableWindow_(e,i,r,o=!1){if(!e.length)return!1;let u=e.end(e.length-1)+Hs;const c=!r.endList,p=typeof r.partTargetDuration=="number";return c&&(p||o)&&(u=e.end(e.length-1)+r.targetDuration*3),i>u}beforeSeekableWindow_(e,i){return!!(e.length&&e.start(0)>0&&i2)return{start:u,end:c}}return null}}const bL={errorInterval:30,getSource(s){const i=this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource();return s(i)}},Ex=function(s,e){let i=0,r=0;const o=pt(bL,e);s.ready(()=>{s.trigger({type:"usage",name:"vhs-error-reload-initialized"})});const u=function(){r&&s.currentTime(r)},c=function(S){S!=null&&(r=s.duration()!==1/0&&s.currentTime()||0,s.one("loadedmetadata",u),s.src(S),s.trigger({type:"usage",name:"vhs-error-reload"}),s.play())},p=function(){if(Date.now()-i{Object.defineProperty(Pt,s,{get(){return $.log.warn(`using Vhs.${s} is UNSAFE be sure you know what you are doing`),fi[s]},set(e){if($.log.warn(`using Vhs.${s} is UNSAFE be sure you know what you are doing`),typeof e!="number"||e<0){$.log.warn(`value of Vhs.${s} must be greater than or equal to 0`);return}fi[s]=e}})});const Ax="videojs-vhs",Dx=function(s,e){const i=e.media();let r=-1;for(let o=0;o{s.addQualityLevel(i)}),Dx(s,e.playlists)};Pt.canPlaySource=function(){return $.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};const AL=(s,e,i)=>{if(!s)return s;let r={};e&&e.attributes&&e.attributes.CODECS&&(r=Rd(Rs(e.attributes.CODECS))),i&&i.attributes&&i.attributes.CODECS&&(r.audio=i.attributes.CODECS);const o=Hl(r.video),u=Hl(r.audio),c={};for(const p in s)c[p]={},u&&(c[p].audioContentType=u),o&&(c[p].videoContentType=o),e.contentProtection&&e.contentProtection[p]&&e.contentProtection[p].pssh&&(c[p].pssh=e.contentProtection[p].pssh),typeof s[p]=="string"&&(c[p].url=s[p]);return pt(s,c)},DL=(s,e)=>s.reduce((i,r)=>{if(!r.contentProtection)return i;const o=e.reduce((u,c)=>{const p=r.contentProtection[c];return p&&p.pssh&&(u[c]={pssh:p.pssh}),u},{});return Object.keys(o).length&&i.push(o),i},[]),wL=({player:s,sourceKeySystems:e,audioMedia:i,mainPlaylists:r})=>{if(!s.eme.initializeMediaKeys)return Promise.resolve();const o=i?r.concat([i]):r,u=DL(o,Object.keys(e)),c=[],p=[];return u.forEach(g=>{p.push(new Promise((b,S)=>{s.tech_.one("keysessioncreated",b)})),c.push(new Promise((b,S)=>{s.eme.initializeMediaKeys({keySystems:g},E=>{if(E){S(E);return}b()})}))}),Promise.race([Promise.all(c),Promise.race(p)])},kL=({player:s,sourceKeySystems:e,media:i,audioMedia:r})=>{const o=AL(e,i,r);return o?(s.currentSource().keySystems=o,o&&!s.eme?($.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),!1):!0):!1},wx=()=>{if(!P.localStorage)return null;const s=P.localStorage.getItem(Ax);if(!s)return null;try{return JSON.parse(s)}catch{return null}},OL=s=>{if(!P.localStorage)return!1;let e=wx();e=e?pt(e,s):s;try{P.localStorage.setItem(Ax,JSON.stringify(e))}catch{return!1}return e},RL=s=>s.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")===0?JSON.parse(s.substring(s.indexOf(",")+1)):s,kx=(s,e)=>{s._requestCallbackSet||(s._requestCallbackSet=new Set),s._requestCallbackSet.add(e)},Ox=(s,e)=>{s._responseCallbackSet||(s._responseCallbackSet=new Set),s._responseCallbackSet.add(e)},Rx=(s,e)=>{s._requestCallbackSet&&(s._requestCallbackSet.delete(e),s._requestCallbackSet.size||delete s._requestCallbackSet)},Mx=(s,e)=>{s._responseCallbackSet&&(s._responseCallbackSet.delete(e),s._responseCallbackSet.size||delete s._responseCallbackSet)};Pt.supportsNativeHls=function(){if(!pe||!pe.createElement)return!1;const s=pe.createElement("video");return $.getTech("Html5").isSupported()?["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some(function(i){return/maybe|probably/i.test(s.canPlayType(i))}):!1}(),Pt.supportsNativeDash=function(){return!pe||!pe.createElement||!$.getTech("Html5").isSupported()?!1:/maybe|probably/i.test(pe.createElement("video").canPlayType("application/dash+xml"))}(),Pt.supportsTypeNatively=s=>s==="hls"?Pt.supportsNativeHls:s==="dash"?Pt.supportsNativeDash:!1,Pt.isSupported=function(){return $.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")},Pt.xhr.onRequest=function(s){kx(Pt.xhr,s)},Pt.xhr.onResponse=function(s){Ox(Pt.xhr,s)},Pt.xhr.offRequest=function(s){Rx(Pt.xhr,s)},Pt.xhr.offResponse=function(s){Mx(Pt.xhr,s)};const ML=$.getComponent("Component");class Lx extends ML{constructor(e,i,r){if(super(i,r.vhs),typeof r.initialBandwidth=="number"&&(this.options_.bandwidth=r.initialBandwidth),this.logger_=$n("VhsHandler"),i.options_&&i.options_.playerId){const o=$.getPlayer(i.options_.playerId);this.player_=o}if(this.tech_=i,this.source_=e,this.stats={},this.ignoreNextSeekingEvent_=!1,this.setOptions_(),this.options_.overrideNative&&i.overrideNativeAudioTracks&&i.overrideNativeVideoTracks)i.overrideNativeAudioTracks(!0),i.overrideNativeVideoTracks(!0);else if(this.options_.overrideNative&&(i.featuresNativeVideoTracks||i.featuresNativeAudioTracks))throw new Error("Overriding native VHS requires emulated tracks. See https://git.io/vMpjB");this.on(pe,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],o=>{const u=pe.fullscreenElement||pe.webkitFullscreenElement||pe.mozFullScreenElement||pe.msFullscreenElement;u&&u.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_=pt(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 r=wx();r&&r.bandwidth&&(this.options_.bandwidth=r.bandwidth,this.tech_.trigger({type:"usage",name:"vhs-bandwidth-from-local-storage"})),r&&r.throughput&&(this.options_.throughput=r.throughput,this.tech_.trigger({type:"usage",name:"vhs-throughput-from-local-storage"}))}typeof this.options_.bandwidth!="number"&&(this.options_.bandwidth=fi.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===fi.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","usePlayerObjectFit","customPixelRatio","limitRenditionByPlayerDimensions","bandwidth","customTagParsers","customTagMappers","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","bufferBasedABR","liveRangeSafeTimeDelta","llhls","useForcedSubtitles","useNetworkInformationApi","useDtsForTimestampOffset","exactManifestTimings","leastPixelDiffSelector"].forEach(r=>{typeof this.source_[r]<"u"&&(this.options_[r]=this.source_[r])}),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions,this.useDevicePixelRatio=this.options_.useDevicePixelRatio,this.usePlayerObjectFit=this.options_.usePlayerObjectFit;const i=this.options_.customPixelRatio;typeof i=="number"&&i>=0&&(this.customPixelRatio=i)}setOptions(e={}){this.setOptions_(e)}src(e,i){if(!e)return;this.setOptions_(),this.options_.src=RL(this.source_.src),this.options_.tech=this.tech_,this.options_.externVhs=Pt,this.options_.sourceType=sT(i),this.options_.seekTo=u=>{this.tech_.setCurrentTime(u)},this.options_.player_=this.player_,this.playlistController_=new pL(this.options_);const r=pt({liveRangeSafeTimeDelta:Hs},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_});this.playbackWatcher_=new vL(r),this.attachStreamingEventListeners_(),this.playlistController_.on("error",()=>{const u=$.players[this.tech_.options_.playerId];let c=this.playlistController_.error;typeof c=="object"&&!c.code?c.code=3:typeof c=="string"&&(c={message:c,code:3}),u.error(c)});const o=this.options_.bufferBasedABR?Pt.movingAverageBandwidthSelector(.55):Pt.STANDARD_PLAYLIST_SELECTOR;this.playlistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):o.bind(this),this.playlistController_.selectInitialPlaylist=Pt.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(u){this.playlistController_.selectPlaylist=u.bind(this)}},throughput:{get(){return this.playlistController_.mainSegmentLoader_.throughput.rate},set(u){this.playlistController_.mainSegmentLoader_.throughput.rate=u,this.playlistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get(){let u=this.playlistController_.mainSegmentLoader_.bandwidth;const c=P.navigator.connection||P.navigator.mozConnection||P.navigator.webkitConnection,p=1e7;if(this.options_.useNetworkInformationApi&&c){const g=c.downlink*1e3*1e3;g>=p&&u>=p?u=Math.max(u,g):u=g}return u},set(u){this.playlistController_.mainSegmentLoader_.bandwidth=u,this.playlistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get(){const u=1/(this.bandwidth||1);let c;return this.throughput>0?c=1/this.throughput:c=0,Math.floor(1/(u+c))},set(){$.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:()=>Io(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:()=>Io(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&&OL({bandwidth:this.bandwidth,throughput:Math.round(this.throughput)})}),this.playlistController_.on("selectedinitialmedia",()=>{yL(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_=P.URL.createObjectURL(this.playlistController_.mediaSource),($.browser.IS_ANY_SAFARI||$.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"),wL({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(i=>{this.logger_("error while creating EME key session",i),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,i=kL({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:e&&e.media()});if(this.player_.tech_.on("keystatuschange",r=>{this.playlistController_.updatePlaylistByKeyStatus(r.keyId,r.status)}),this.handleWaitingForKey_=this.handleWaitingForKey_.bind(this),this.player_.tech_.on("waitingforkey",this.handleWaitingForKey_),!i){this.playlistController_.sourceUpdater_.initializedEme();return}this.createKeySessions_()}setupQualityLevels_(){const e=$.players[this.tech_.options_.playerId];!e||!e.qualityLevels||this.qualityLevels_||(this.qualityLevels_=e.qualityLevels(),this.playlistController_.on("selectedinitialmedia",()=>{CL(this.qualityLevels_,this)}),this.playlists.on("mediachange",()=>{Dx(this.qualityLevels_,this.playlists)}))}static version(){return{"@videojs/http-streaming":Cx,"mux.js":TL,"mpd-parser":SL,"m3u8-parser":xL,"aes-decrypter":EL}}version(){return this.constructor.version()}canChangeType(){return fx.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_&&P.URL.revokeObjectURL&&(P.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),super.dispose()}convertToProgramTime(e,i){return U4({playlist:this.playlistController_.media(),time:e,callback:i})}seekToProgramTime(e,i,r=!0,o=2){return FS({programTime:e,playlist:this.playlistController_.media(),retryCount:o,pauseAfterSeek:r,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:i})}setupXhrHooks_(){this.xhr.onRequest=e=>{kx(this.xhr,e)},this.xhr.onResponse=e=>{Ox(this.xhr,e)},this.xhr.offRequest=e=>{Rx(this.xhr,e)},this.xhr.offResponse=e=>{Mx(this.xhr,e)},this.player_.trigger("xhr-hooks-ready")}attachStreamingEventListeners_(){const e=["seekablerangeschanged","bufferedrangeschanged","contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"],i=["gapjumped","playedrangeschanged"];e.forEach(r=>{this.playlistController_.on(r,o=>{this.player_.trigger(Ft({},o))})}),i.forEach(r=>{this.playbackWatcher_.on(r,o=>{this.player_.trigger(Ft({},o))})})}}const Bp={name:"videojs-http-streaming",VERSION:Cx,canHandleSource(s,e={}){const i=pt($.options,e);return!i.vhs.experimentalUseMMS&&!id("avc1.4d400d,mp4a.40.2",!1)?!1:Bp.canPlayType(s.type,i)},handleSource(s,e,i={}){const r=pt($.options,i);return e.vhs=new Lx(s,e,r),e.vhs.xhr=IS(),e.vhs.setupXhrHooks_(),e.vhs.src(s.src,s.type),e.vhs},canPlayType(s,e){const i=sT(s);if(!i)return"";const r=Bp.getOverrideNative(e);return!Pt.supportsTypeNatively(i)||r?"maybe":""},getOverrideNative(s={}){const{vhs:e={}}=s,i=!($.browser.IS_ANY_SAFARI||$.browser.IS_IOS),{overrideNative:r=i}=e;return r}};(()=>id("avc1.4d400d,mp4a.40.2",!0))()&&$.getTech("Html5").registerSourceHandler(Bp,0),$.VhsHandler=Lx,$.VhsSourceHandler=Bp,$.Vhs=Pt,$.use||$.registerComponent("Vhs",Pt),$.options.vhs=$.options.vhs||{},(!$.getPlugin||!$.getPlugin("reloadSourceOnError"))&&$.registerPlugin("reloadSourceOnError",_L);const X5="",LL=$.getComponent("Component");class Ix extends LL{constructor(e,i){i&&i.relatedVideos&&(i._relatedVideos=i.relatedVideos),super(e,i),this.relatedVideos=i&&i.relatedVideos?i.relatedVideos:[]}createEl(){const e=this.options_&&this.options_._relatedVideos?this.options_._relatedVideos:[],i=super.createEl("div",{className:"vjs-end-screen-overlay"}),r=$.dom.createEl("div",{className:"vjs-related-videos-grid"});if(e&&Array.isArray(e)&&e.length>0)e.forEach(o=>{const u=this.createVideoItem(o);r.appendChild(u)});else{const o=$.dom.createEl("div",{className:"vjs-no-related-videos"});o.textContent="No related videos available",o.style.color="white",o.style.textAlign="center",r.appendChild(o)}return i.appendChild(r),i}createVideoItem(e){const i=$.dom.createEl("div",{className:"vjs-related-video-item"}),r=$.dom.createEl("img",{className:"vjs-related-video-thumbnail",src:e.thumbnail,alt:e.title}),o=$.dom.createEl("div",{className:"vjs-related-video-overlay"}),u=$.dom.createEl("div",{className:"vjs-related-video-title"});u.textContent=e.title;const c=$.dom.createEl("div",{className:"vjs-related-video-author"});c.textContent=e.author;const p=$.dom.createEl("div",{className:"vjs-related-video-views"});return p.textContent=e.views,o.appendChild(u),o.appendChild(c),o.appendChild(p),i.appendChild(r),i.appendChild(o),i.addEventListener("click",()=>{window.location.href=`/view?m=${e.id}`}),i}show(){this.el().style.display="flex"}hide(){this.el().style.display="none"}}$.registerComponent("EndScreenOverlay",Ix);const IL=$.getComponent("Component");class Nx extends IL{constructor(e,i){super(e,i),this.on(e,"loadedmetadata",this.updateChapterMarkers),this.on(e,"texttrackchange",this.updateChapterMarkers),this.chaptersData=[],this.tooltip=null,this.isHovering=!1}createEl(){const e=super.createEl("div",{className:"vjs-chapter-markers-track"});return this.tooltip=null,e}updateChapterMarkers(){const e=this.player(),i=e.textTracks();let r=null;for(let u=0;u{this.isHovering=!0,this.tooltip.style.display="block"},this.handleMouseLeave=()=>{this.isHovering=!1,this.tooltip.style.display="none"},this.handleMouseMove=u=>{this.isHovering&&this.updateChapterTooltip(u,r,o)},o.addEventListener("mouseenter",this.handleMouseEnter),o.addEventListener("mouseleave",this.handleMouseLeave),o.addEventListener("mousemove",this.handleMouseMove)}updateChapterTooltip(e,i,r){if(!this.tooltip||!this.isHovering)return;const o=this.player().duration();if(!o)return;const u=i.getBoundingClientRect(),c=r.getBoundingClientRect(),p=e.clientX-u.left,b=Math.max(0,Math.min(1,p/u.width))*o,S=e.clientX-c.left,E=this.findChapterAtTime(b);if(E){const A=z=>{const H=Math.floor(z/60),Y=Math.floor(z%60);return`${H}:${Y.toString().padStart(2,"0")}`},M=A(E.startTime),U=A(E.endTime),D=A(b);this.tooltip.innerHTML=` -
${E.text}
-
Chapter: ${M} - ${U}
-
Position: ${D}
- `}else{const A=this.formatTime(b);this.tooltip.innerHTML=` -
No Chapter
-
Position: ${A}
- `}this.tooltip.style.left=`${S}px`,this.tooltip.style.display="block"}findChapterAtTime(e){for(const i of this.chaptersData)if(e>=i.startTime&&e{c.stopPropagation(),this.player().currentTime(e.startTime)}),r.style.pointerEvents="auto",r.style.cursor="pointer",r}dispose(){var i;const e=(i=this.player().getChild("controlBar"))==null?void 0:i.getChild("progressControl");if(e){const r=e.el();r.removeEventListener("mouseenter",this.handleMouseEnter),r.removeEventListener("mouseleave",this.handleMouseLeave),r.removeEventListener("mousemove",this.handleMouseMove)}this.tooltip&&this.tooltip.parentNode&&this.tooltip.parentNode.removeChild(this.tooltip),super.dispose()}}$.registerComponent("ChapterMarkers",Nx);const NL=$.getComponent("Button");class Px extends NL{constructor(e,i){super(e,i)}createEl(){const e=super.createEl("button",{className:"vjs-next-video-control vjs-control vjs-button",type:"button",title:"Next Video","aria-label":"Next Video"}),i=$.dom.createEl("span",{"aria-hidden":"true"});i.innerHTML=` +`,p++,c=A}),this.end_=c,this.storage_=o,this.diagnostics_=u}calculateBaseTime_(e,i,r){if(!this.storage_.size)return 0;if(this.storage_.has(e))return this.storage_.get(e).segmentSyncInfo.start;const o=Math.min(...this.storage_.keys());if(ei!==1/0?{time:0,segmentIndex:0,partIndex:null}:null},{name:"MediaSequence",run:(s,e,i,r,o,u)=>{const c=s.getMediaSequenceSync(u);if(!c||!c.isReliable)return null;const p=c.getSyncInfoForTime(o);return p?{time:p.start,partIndex:p.partIndex,segmentIndex:p.segmentIndex}:null}},{name:"ProgramDateTime",run:(s,e,i,r,o)=>{if(!Object.keys(s.timelineToDatetimeMappings).length)return null;let u=null,c=null;const p=vy(e);o=o||0;for(let g=0;g{let u=null,c=null;o=o||0;const p=vy(e);for(let g=0;g=M)&&(c=M,u={time:A,segmentIndex:S.segmentIndex,partIndex:S.partIndex})}}return u}},{name:"Discontinuity",run:(s,e,i,r,o)=>{let u=null;if(o=o||0,e.discontinuityStarts&&e.discontinuityStarts.length){let c=null;for(let p=0;p=E)&&(c=E,u={time:S.time,segmentIndex:g,partIndex:null})}}}return u}},{name:"Playlist",run:(s,e,i,r,o)=>e.syncInfo?{time:e.syncInfo.time,segmentIndex:e.syncInfo.mediaSequence-e.mediaSequence,partIndex:null}:null}];class YM extends V.EventTarget{constructor(e={}){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={};const i=new yx,r=new vx(i),o=new vx(i);this.mediaSequenceStorage_={main:i,audio:r,vtt:o},this.logger_=$n("SyncController")}getMediaSequenceSync(e){return this.mediaSequenceStorage_[e]||null}getSyncPoint(e,i,r,o,u){if(i!==1/0)return Ny.find(({name:g})=>g==="VOD").run(this,e,i);const c=this.runStrategies_(e,i,r,o,u);if(!c.length)return null;for(const p of c){const{syncPoint:g,strategy:b}=p,{segmentIndex:S,time:E}=g;if(S<0)continue;const A=e.segments[S],M=E,U=M+A.duration;if(this.logger_(`Strategy: ${b}. Current time: ${o}. selected segment: ${S}. Time: [${M} -> ${U}]}`),o>=M&&o0&&(o.time*=-1),Math.abs(o.time+kd({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:o.segmentIndex,endIndex:0}))}runStrategies_(e,i,r,o,u){const c=[];for(let p=0;pXM){V.log.warn(`Not saving expired segment info. Media sequence gap ${r} is too large.`);return}for(let o=r-1;o>=0;o--){const u=e.segments[o];if(u&&typeof u.start<"u"){i.syncInfo={mediaSequence:e.mediaSequence+o,time:u.start},this.logger_(`playlist refresh sync: [time:${i.syncInfo.time}, mediaSequence: ${i.syncInfo.mediaSequence}]`),this.trigger("syncinfoupdate");break}}}setDateTimeMappingForStart(e){if(this.timelineToDatetimeMappings={},e.segments&&e.segments.length&&e.segments[0].dateTimeObject){const i=e.segments[0],r=i.dateTimeObject.getTime()/1e3;this.timelineToDatetimeMappings[i.timeline]=-r}}saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:i}){const r=this.calculateSegmentTimeMapping_(e,e.timingInfo,i),o=e.segment;r&&(this.saveDiscontinuitySyncInfo_(e),e.playlist.syncInfo||(e.playlist.syncInfo={mediaSequence:e.playlist.mediaSequence+e.mediaIndex,time:o.start}));const u=o.dateTimeObject;o.discontinuity&&i&&u&&(this.timelineToDatetimeMappings[o.timeline]=-(u.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,i,r){const o=e.segment,u=e.part;let c=this.timelines[e.timeline],p,g;if(typeof e.timestampOffset=="number")c={time:e.startOfSegment,mapping:e.startOfSegment-i.start},r&&(this.timelines[e.timeline]=c,this.trigger("timestampoffset"),this.logger_(`time mapping for timeline ${e.timeline}: [time: ${c.time}] [mapping: ${c.mapping}]`)),p=e.startOfSegment,g=i.end+c.mapping;else if(c)p=i.start+c.mapping,g=i.end+c.mapping;else return!1;return u&&(u.start=p,u.end=g),(!o.start||pg){let b;p<0?b=r.start-kd({defaultDuration:i.targetDuration,durationList:i.segments,startIndex:e.mediaIndex,endIndex:u}):b=r.end+kd({defaultDuration:i.targetDuration,durationList:i.segments,startIndex:e.mediaIndex+1,endIndex:u}),this.discontinuities[c]={time:b,accuracy:g}}}}dispose(){this.trigger("dispose"),this.off()}}class WM extends V.EventTarget{constructor(){super(),this.pendingTimelineChanges_={},this.lastTimelineChanges_={}}clearPendingTimelineChange(e){this.pendingTimelineChanges_[e]=null,this.trigger("pendingtimelinechange")}pendingTimelineChange({type:e,from:i,to:r}){return typeof i=="number"&&typeof r=="number"&&(this.pendingTimelineChanges_[e]={type:e,from:i,to:r},this.trigger("pendingtimelinechange")),this.pendingTimelineChanges_[e]}lastTimelineChange({type:e,from:i,to:r}){if(typeof i=="number"&&typeof r=="number"){this.lastTimelineChanges_[e]={type:e,from:i,to:r},delete this.pendingTimelineChanges_[e];const o={timelineChangeInfo:{from:i,to:r}};this.trigger({type:"timelinechange",metadata:o})}return this.lastTimelineChanges_[e]}dispose(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()}}const QM=VS($S(function(){var s=function(){function D(){this.listeners={}}var z=D.prototype;return z.on=function(Y,$){this.listeners[Y]||(this.listeners[Y]=[]),this.listeners[Y].push($)},z.off=function(Y,$){if(!this.listeners[Y])return!1;var Q=this.listeners[Y].indexOf($);return this.listeners[Y]=this.listeners[Y].slice(0),this.listeners[Y].splice(Q,1),Q>-1},z.trigger=function(Y){var $=this.listeners[Y];if($)if(arguments.length===2)for(var Q=$.length,Z=0;Z>7)*283)^Q]=Q;for(Z=W=0;!Y[Z];Z^=oe||1,W=ee[W]||1)for(xe=W^W<<1^W<<2^W<<3^W<<4,xe=xe>>8^xe&255^99,Y[Z]=xe,$[xe]=Z,fe=G[_e=G[oe=G[Z]]],Ne=fe*16843009^_e*65537^oe*257^Z*16843008,ve=G[xe]*257^xe*16843008,Q=0;Q<4;Q++)z[Q][Z]=ve=ve<<24^ve>>>8,H[Q][xe]=Ne=Ne<<24^Ne>>>8;for(Q=0;Q<5;Q++)z[Q]=z[Q].slice(0),H[Q]=H[Q].slice(0);return D};let r=null;class o{constructor(z){r||(r=i()),this._tables=[[r[0][0].slice(),r[0][1].slice(),r[0][2].slice(),r[0][3].slice(),r[0][4].slice()],[r[1][0].slice(),r[1][1].slice(),r[1][2].slice(),r[1][3].slice(),r[1][4].slice()]];let H,Y,$;const Q=this._tables[0][4],Z=this._tables[1],W=z.length;let G=1;if(W!==4&&W!==6&&W!==8)throw new Error("Invalid aes key size");const ee=z.slice(0),oe=[];for(this._key=[ee,oe],H=W;H<4*W+28;H++)$=ee[H-1],(H%W===0||W===8&&H%W===4)&&($=Q[$>>>24]<<24^Q[$>>16&255]<<16^Q[$>>8&255]<<8^Q[$&255],H%W===0&&($=$<<8^$>>>24^G<<24,G=G<<1^(G>>7)*283)),ee[H]=ee[H-W]^$;for(Y=0;H;Y++,H--)$=ee[Y&3?H:H-4],H<=4||Y<4?oe[Y]=$:oe[Y]=Z[0][Q[$>>>24]]^Z[1][Q[$>>16&255]]^Z[2][Q[$>>8&255]]^Z[3][Q[$&255]]}decrypt(z,H,Y,$,Q,Z){const W=this._key[1];let G=z^W[0],ee=$^W[1],oe=Y^W[2],_e=H^W[3],fe,xe,ve;const Ne=W.length/4-2;let at,de=4;const Ee=this._tables[1],Re=Ee[0],Ye=Ee[1],le=Ee[2],Me=Ee[3],Ae=Ee[4];for(at=0;at>>24]^Ye[ee>>16&255]^le[oe>>8&255]^Me[_e&255]^W[de],xe=Re[ee>>>24]^Ye[oe>>16&255]^le[_e>>8&255]^Me[G&255]^W[de+1],ve=Re[oe>>>24]^Ye[_e>>16&255]^le[G>>8&255]^Me[ee&255]^W[de+2],_e=Re[_e>>>24]^Ye[G>>16&255]^le[ee>>8&255]^Me[oe&255]^W[de+3],de+=4,G=fe,ee=xe,oe=ve;for(at=0;at<4;at++)Q[(3&-at)+Z]=Ae[G>>>24]<<24^Ae[ee>>16&255]<<16^Ae[oe>>8&255]<<8^Ae[_e&255]^W[de++],fe=G,G=ee,ee=oe,oe=_e,_e=fe}}class u 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(z){this.jobs.push(z),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))}}const c=function(D){return D<<24|(D&65280)<<8|(D&16711680)>>8|D>>>24},p=function(D,z,H){const Y=new Int32Array(D.buffer,D.byteOffset,D.byteLength>>2),$=new o(Array.prototype.slice.call(z)),Q=new Uint8Array(D.byteLength),Z=new Int32Array(Q.buffer);let W,G,ee,oe,_e,fe,xe,ve,Ne;for(W=H[0],G=H[1],ee=H[2],oe=H[3],Ne=0;Ne{const Y=D[H];A(Y)?z[H]={bytes:Y.buffer,byteOffset:Y.byteOffset,byteLength:Y.byteLength}:z[H]=Y}),z};self.onmessage=function(D){const z=D.data,H=new Uint8Array(z.encrypted.bytes,z.encrypted.byteOffset,z.encrypted.byteLength),Y=new Uint32Array(z.key.bytes,z.key.byteOffset,z.key.byteLength/4),$=new Uint32Array(z.iv.bytes,z.iv.byteOffset,z.iv.byteLength/4);new g(H,Y,$,function(Q,Z){self.postMessage(U({source:z.source,decrypted:Z}),[Z.buffer])})}}));var KM=qS(QM);const ZM=s=>{let e=s.default?"main":"alternative";return s.characteristics&&s.characteristics.indexOf("public.accessibility.describes-video")>=0&&(e="main-desc"),e},bx=(s,e)=>{s.abort(),s.pause(),e&&e.activePlaylistLoader&&(e.activePlaylistLoader.pause(),e.activePlaylistLoader=null)},Py=(s,e)=>{e.activePlaylistLoader=s,s.load()},JM=(s,e)=>()=>{const{segmentLoaders:{[s]:i,main:r},mediaTypes:{[s]:o}}=e,u=o.activeTrack(),c=o.getActiveGroup(),p=o.activePlaylistLoader,g=o.lastGroup_;if(!(c&&g&&c.id===g.id)&&(o.lastGroup_=c,o.lastTrack_=u,bx(i,o),!(!c||c.isMainPlaylist))){if(!c.playlistLoader){p&&r.resetEverything();return}i.resyncLoader(),Py(c.playlistLoader,o)}},eL=(s,e)=>()=>{const{segmentLoaders:{[s]:i},mediaTypes:{[s]:r}}=e;r.lastGroup_=null,i.abort(),i.pause()},tL=(s,e)=>()=>{const{mainPlaylistLoader:i,segmentLoaders:{[s]:r,main:o},mediaTypes:{[s]:u}}=e,c=u.activeTrack(),p=u.getActiveGroup(),g=u.activePlaylistLoader,b=u.lastTrack_;if(!(b&&c&&b.id===c.id)&&(u.lastGroup_=p,u.lastTrack_=c,bx(r,u),!!p)){if(p.isMainPlaylist){if(!c||!b||c.id===b.id)return;const S=e.vhs.playlistController_,E=S.selectPlaylist();if(S.media()===E)return;u.logger_(`track change. Switching main audio from ${b.id} to ${c.id}`),i.pause(),o.resetEverything(),S.fastQualityChange_(E);return}if(s==="AUDIO"){if(!p.playlistLoader){o.setAudio(!0),o.resetEverything();return}r.setAudio(!0),o.setAudio(!1)}if(g===p.playlistLoader){Py(p.playlistLoader,u);return}r.track&&r.track(c),r.resetEverything(),Py(p.playlistLoader,u)}},Up={AUDIO:(s,e)=>()=>{const{mediaTypes:{[s]:i},excludePlaylist:r}=e,o=i.activeTrack(),u=i.activeGroup(),c=(u.filter(g=>g.default)[0]||u[0]).id,p=i.tracks[c];if(o===p){r({error:{message:"Problem encountered loading the default audio track."}});return}V.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");for(const g in i.tracks)i.tracks[g].enabled=i.tracks[g]===p;i.onTrackChanged()},SUBTITLES:(s,e)=>()=>{const{mediaTypes:{[s]:i}}=e;V.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track.");const r=i.activeTrack();r&&(r.mode="disabled"),i.onTrackChanged()}},_x={AUDIO:(s,e,i)=>{if(!e)return;const{tech:r,requestOptions:o,segmentLoaders:{[s]:u}}=i;e.on("loadedmetadata",()=>{const c=e.media();u.playlist(c,o),(!r.paused()||c.endList&&r.preload()!=="none")&&u.load()}),e.on("loadedplaylist",()=>{u.playlist(e.media(),o),r.paused()||u.load()}),e.on("error",Up[s](s,i))},SUBTITLES:(s,e,i)=>{const{tech:r,requestOptions:o,segmentLoaders:{[s]:u},mediaTypes:{[s]:c}}=i;e.on("loadedmetadata",()=>{const p=e.media();u.playlist(p,o),u.track(c.activeTrack()),(!r.paused()||p.endList&&r.preload()!=="none")&&u.load()}),e.on("loadedplaylist",()=>{u.playlist(e.media(),o),r.paused()||u.load()}),e.on("error",Up[s](s,i))}},iL={AUDIO:(s,e)=>{const{vhs:i,sourceType:r,segmentLoaders:{[s]:o},requestOptions:u,main:{mediaGroups:c},mediaTypes:{[s]:{groups:p,tracks:g,logger_:b}},mainPlaylistLoader:S}=e,E=Od(S.main);(!c[s]||Object.keys(c[s]).length===0)&&(c[s]={main:{default:{default:!0}}},E&&(c[s].main.default.playlists=S.main.playlists));for(const A in c[s]){p[A]||(p[A]=[]);for(const M in c[s][A]){let U=c[s][A][M],D;if(E?(b(`AUDIO group '${A}' label '${M}' is a main playlist`),U.isMainPlaylist=!0,D=null):r==="vhs-json"&&U.playlists?D=new bu(U.playlists[0],i,u):U.resolvedUri?D=new bu(U.resolvedUri,i,u):U.playlists&&r==="dash"?D=new Dy(U.playlists[0],i,u,S):D=null,U=pt({id:M,playlistLoader:D},U),_x[s](s,U.playlistLoader,e),p[A].push(U),typeof g[M]>"u"){const z=new V.AudioTrack({id:M,kind:ZM(U),enabled:!1,language:U.language,default:U.default,label:M});g[M]=z}}}o.on("error",Up[s](s,e))},SUBTITLES:(s,e)=>{const{tech:i,vhs:r,sourceType:o,segmentLoaders:{[s]:u},requestOptions:c,main:{mediaGroups:p},mediaTypes:{[s]:{groups:g,tracks:b}},mainPlaylistLoader:S}=e;for(const E in p[s]){g[E]||(g[E]=[]);for(const A in p[s][E]){if(!r.options_.useForcedSubtitles&&p[s][E][A].forced)continue;let M=p[s][E][A],U;if(o==="hls")U=new bu(M.resolvedUri,r,c);else if(o==="dash"){if(!M.playlists.filter(z=>z.excludeUntil!==1/0).length)return;U=new Dy(M.playlists[0],r,c,S)}else o==="vhs-json"&&(U=new bu(M.playlists?M.playlists[0]:M.resolvedUri,r,c));if(M=pt({id:A,playlistLoader:U},M),_x[s](s,M.playlistLoader,e),g[E].push(M),typeof b[A]>"u"){const D=i.addRemoteTextTrack({id:A,kind:"subtitles",default:M.default&&M.autoselect,language:M.language,label:A},!1).track;b[A]=D}}}u.on("error",Up[s](s,e))},"CLOSED-CAPTIONS":(s,e)=>{const{tech:i,main:{mediaGroups:r},mediaTypes:{[s]:{groups:o,tracks:u}}}=e;for(const c in r[s]){o[c]||(o[c]=[]);for(const p in r[s][c]){const g=r[s][c][p];if(!/^(?:CC|SERVICE)/.test(g.instreamId))continue;const b=i.options_.vhs&&i.options_.vhs.captionServices||{};let S={label:p,language:g.language,instreamId:g.instreamId,default:g.default&&g.autoselect};if(b[S.instreamId]&&(S=pt(S,b[S.instreamId])),S.default===void 0&&delete S.default,o[c].push(pt({id:p},g)),typeof u[p]>"u"){const E=i.addRemoteTextTrack({id:S.instreamId,kind:"captions",default:S.default,language:S.language,label:S.label},!1).track;u[p]=E}}}}},Tx=(s,e)=>{for(let i=0;ii=>{const{mainPlaylistLoader:r,mediaTypes:{[s]:{groups:o}}}=e,u=r.media();if(!u)return null;let c=null;u.attributes[s]&&(c=o[u.attributes[s]]);const p=Object.keys(o);if(!c)if(s==="AUDIO"&&p.length>1&&Od(e.main))for(let g=0;g"u"?c:i===null||!c?null:c.filter(g=>g.id===i.id)[0]||null},sL={AUDIO:(s,e)=>()=>{const{mediaTypes:{[s]:{tracks:i}}}=e;for(const r in i)if(i[r].enabled)return i[r];return null},SUBTITLES:(s,e)=>()=>{const{mediaTypes:{[s]:{tracks:i}}}=e;for(const r in i)if(i[r].mode==="showing"||i[r].mode==="hidden")return i[r];return null}},rL=(s,{mediaTypes:e})=>()=>{const i=e[s].activeTrack();return i?e[s].activeGroup(i):null},aL=s=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(b=>{iL[b](b,s)});const{mediaTypes:e,mainPlaylistLoader:i,tech:r,vhs:o,segmentLoaders:{["AUDIO"]:u,main:c}}=s;["AUDIO","SUBTITLES"].forEach(b=>{e[b].activeGroup=nL(b,s),e[b].activeTrack=sL[b](b,s),e[b].onGroupChanged=JM(b,s),e[b].onGroupChanging=eL(b,s),e[b].onTrackChanged=tL(b,s),e[b].getActiveGroup=rL(b,s)});const p=e.AUDIO.activeGroup();if(p){const b=(p.filter(E=>E.default)[0]||p[0]).id;e.AUDIO.tracks[b].enabled=!0,e.AUDIO.onGroupChanged(),e.AUDIO.onTrackChanged(),e.AUDIO.getActiveGroup().playlistLoader?(c.setAudio(!1),u.setAudio(!0)):c.setAudio(!0)}i.on("mediachange",()=>{["AUDIO","SUBTITLES"].forEach(b=>e[b].onGroupChanged())}),i.on("mediachanging",()=>{["AUDIO","SUBTITLES"].forEach(b=>e[b].onGroupChanging())});const g=()=>{e.AUDIO.onTrackChanged(),r.trigger({type:"usage",name:"vhs-audio-change"})};r.audioTracks().addEventListener("change",g),r.remoteTextTracks().addEventListener("change",e.SUBTITLES.onTrackChanged),o.on("dispose",()=>{r.audioTracks().removeEventListener("change",g),r.remoteTextTracks().removeEventListener("change",e.SUBTITLES.onTrackChanged)}),r.clearTracks("audio");for(const b in e.AUDIO.tracks)r.audioTracks().addTrack(e.AUDIO.tracks[b])},oL=()=>{const s={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{s[e]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:Mr,activeTrack:Mr,getActiveGroup:Mr,onGroupChanged:Mr,onTrackChanged:Mr,lastTrack_:null,logger_:$n(`MediaGroups[${e}]`)}}),s};class Sx{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_=ln(this.reloadUri_,e))}set priority(e){e&&e.length&&(this.priority_=e)}set pathwayClones(e){e&&e.length&&(this.pathwayClones_=new Map(e.map(i=>[i.ID,i])))}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 lL extends V.EventTarget{constructor(e,i){super(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=!1,this.availablePathways_=new Set,this.steeringManifest=new Sx,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_=$n("Content Steering"),this.xhr_=e,this.getBandwidth_=i}assignTagProperties(e,i){this.manifestType_=i.serverUri?"HLS":"DASH";const r=i.serverUri||i.serverURL;if(!r){this.logger_(`steering manifest URL is ${r}, cannot request steering manifest.`),this.trigger("error");return}if(r.startsWith("data:")){this.decodeDataUriManifest_(r.substring(r.indexOf(",")+1));return}this.steeringManifest.reloadUri=ln(e,r),this.defaultPathway=i.pathwayId||i.defaultServiceLocation,this.queryBeforeStart=i.queryBeforeStart,this.proxyServerUrl_=i.proxyServerURL,this.defaultPathway&&!this.queryBeforeStart&&this.trigger("content-steering")}requestSteeringManifest(e){const i=this.steeringManifest.reloadUri;if(!i)return;const r=e?i:this.getRequestURI(i);if(!r){this.logger_("No valid content steering manifest URIs. Stopping content steering."),this.trigger("error"),this.dispose();return}const o={contentSteeringInfo:{uri:r}};this.trigger({type:"contentsteeringloadstart",metadata:o}),this.request_=this.xhr_({uri:r,requestType:"content-steering-manifest"},(u,c)=>{if(u){if(c.status===410){this.logger_(`manifest request 410 ${u}.`),this.logger_(`There will be no more content steering requests to ${r} this session.`),this.excludedSteeringManifestURLs.add(r);return}if(c.status===429){const b=c.responseHeaders["retry-after"];this.logger_(`manifest request 429 ${u}.`),this.logger_(`content steering will retry in ${b} seconds.`),this.startTTLTimeout_(parseInt(b,10));return}this.logger_(`manifest failed to load ${u}.`),this.startTTLTimeout_();return}this.trigger({type:"contentsteeringloadcomplete",metadata:o});let p;try{p=JSON.parse(this.request_.responseText)}catch(b){const S={errorType:V.Error.StreamingContentSteeringParserError,error:b};this.trigger({type:"error",metadata:S})}this.assignSteeringProperties_(p);const g={contentSteeringInfo:o.contentSteeringInfo,contentSteeringManifest:{version:this.steeringManifest.version,reloadUri:this.steeringManifest.reloadUri,priority:this.steeringManifest.priority}};this.trigger({type:"contentsteeringparsed",metadata:g}),this.startTTLTimeout_()})}setProxyServerUrl_(e){const i=new P.URL(e),r=new P.URL(this.proxyServerUrl_);return r.searchParams.set("url",encodeURI(i.toString())),this.setSteeringParams_(r.toString())}decodeDataUriManifest_(e){const i=JSON.parse(P.atob(e));this.assignSteeringProperties_(i)}setSteeringParams_(e){const i=new P.URL(e),r=this.getPathway(),o=this.getBandwidth_();if(r){const u=`_${this.manifestType_}_pathway`;i.searchParams.set(u,r)}if(o){const u=`_${this.manifestType_}_throughput`;i.searchParams.set(u,o)}return i.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 r=(o=>{for(const u of o)if(this.availablePathways_.has(u))return u;return[...this.availablePathways_][0]})(this.steeringManifest.priority);this.currentPathway!==r&&(this.currentPathway=r,this.trigger("content-steering"))}getPathway(){return this.currentPathway||this.defaultPathway}getRequestURI(e){if(!e)return null;const i=o=>this.excludedSteeringManifestURLs.has(o);if(this.proxyServerUrl_){const o=this.setProxyServerUrl_(e);if(!i(o))return o}const r=this.setSteeringParams_(e);return i(r)?null:r}startTTLTimeout_(e=this.steeringManifest.ttl){const i=e*1e3;this.ttlTimeout_=P.setTimeout(()=>{this.requestSteeringManifest()},i)}clearTTLTimeout_(){P.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 Sx}addAvailablePathway(e){e&&this.availablePathways_.add(e)}clearAvailablePathways(){this.availablePathways_.clear()}excludePathway(e){return this.availablePathways_.delete(e)}didDASHTagChange(e,i){return!i&&this.steeringManifest.reloadUri||i&&(ln(e,i.serverURL)!==this.steeringManifest.reloadUri||i.defaultServiceLocation!==this.defaultPathway||i.queryBeforeStart!==this.queryBeforeStart||i.proxyServerURL!==this.proxyServerUrl_)}getAvailablePathways(){return this.availablePathways_}}const uL=(s,e)=>{let i=null;return(...r)=>{clearTimeout(i),i=setTimeout(()=>{s.apply(null,r)},e)}},cL=10;let Oa;const dL=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],hL=function(s){return this.audioSegmentLoader_[s]+this.mainSegmentLoader_[s]},fL=function({currentPlaylist:s,buffered:e,currentTime:i,nextPlaylist:r,bufferLowWaterLine:o,bufferHighWaterLine:u,duration:c,bufferBasedABR:p,log:g}){if(!r)return V.log.warn("We received no playlist to switch to. Please check your stream."),!1;const b=`allowing switch ${s&&s.id||"null"} -> ${r.id}`;if(!s)return g(`${b} as current playlist is not set`),!0;if(r.id===s.id)return!1;const S=!!gu(e,i).length;if(!s.endList)return!S&&typeof s.partTargetDuration=="number"?(g(`not ${b} as current playlist is live llhls, but currentTime isn't in buffered.`),!1):(g(`${b} as current playlist is live`),!0);const E=gy(e,i),A=p?fi.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:fi.MAX_BUFFER_LOW_WATER_LINE;if(cU)&&E>=o){let D=`${b} as forwardBuffer >= bufferLowWaterLine (${E} >= ${o})`;return p&&(D+=` and next bandwidth > current bandwidth (${M} > ${U})`),g(D),!0}return g(`not ${b} as no switching criteria met`),!1};class pL extends V.EventTarget{constructor(e){super(),this.fastQualityChange_=uL(this.fastQualityChange_.bind(this),100);const{src:i,withCredentials:r,tech:o,bandwidth:u,externVhs:c,useCueTags:p,playlistExclusionDuration:g,enableLowInitialPlaylist:b,sourceType:S,cacheEncryptionKeys:E,bufferBasedABR:A,leastPixelDiffSelector:M,captionServices:U,experimentalUseMMS:D}=e;if(!i)throw new Error("A non-empty playlist URL or JSON manifest string is required");let{maxPlaylistRetries:z}=e;(z===null||typeof z>"u")&&(z=1/0),Oa=c,this.bufferBasedABR=!!A,this.leastPixelDiffSelector=!!M,this.withCredentials=r,this.tech_=o,this.vhs_=o.vhs,this.player_=e.player_,this.sourceType_=S,this.useCueTags_=p,this.playlistExclusionDuration=g,this.maxPlaylistRetries=z,this.enableLowInitialPlaylist=b,this.usingManagedMediaSource_=!1,this.useCueTags_&&(this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues"),this.cueTagsTrack_.inBandMetadataTrackDispatchType=""),this.requestOptions_={withCredentials:r,maxPlaylistRetries:z,timeout:null},this.on("error",this.pauseLoading),this.mediaTypes_=oL(),D&&P.ManagedMediaSource?(this.tech_.el_.disableRemotePlayback=!0,this.mediaSource=new P.ManagedMediaSource,this.usingManagedMediaSource_=!0,V.log("Using ManagedMediaSource")):P.MediaSource&&(this.mediaSource=new P.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_=hi(),this.hasPlayed_=!1,this.syncController_=new YM(e),this.segmentMetadataTrack_=o.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.segmentMetadataTrack_.mode="hidden",this.decrypter_=new KM,this.sourceUpdater_=new fx(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new WM,this.keyStatusMap_=new Map;const H={vhs:this.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,captionServices:U,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:u,syncController:this.syncController_,decrypter:this.decrypter_,sourceType:this.sourceType_,inbandTextTracks:this.inbandTextTracks_,cacheEncryptionKeys:E,sourceUpdater:this.sourceUpdater_,timelineChangeController:this.timelineChangeController_,exactManifestTimings:e.exactManifestTimings,addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)};this.mainPlaylistLoader_=this.sourceType_==="dash"?new Dy(i,this.vhs_,pt(this.requestOptions_,{addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)})):new bu(i,this.vhs_,pt(this.requestOptions_,{addDateRangesToTextTrack:this.addDateRangesToTextTrack_.bind(this)})),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new Ly(pt(H,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new Ly(pt(H,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new qM(pt(H,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise((Q,Z)=>{function W(){o.off("vttjserror",G),Q()}function G(){o.off("vttjsloaded",W),Z()}o.one("vttjsloaded",W),o.one("vttjserror",G),o.addWebVttScript_()})}),e);const Y=()=>this.mainSegmentLoader_.bandwidth;this.contentSteeringController_=new lL(this.vhs_.xhr,Y),this.setupSegmentLoaderListeners_(),this.bufferBasedABR&&(this.mainPlaylistLoader_.one("loadedplaylist",()=>this.startABRTimer_()),this.tech_.on("pause",()=>this.stopABRTimer_()),this.tech_.on("play",()=>this.startABRTimer_())),dL.forEach(Q=>{this[Q+"_"]=hL.bind(this,Q)}),this.logger_=$n("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 Q=Date.now();this.tech_.one("loadeddata",()=>{this.timeToLoadedData__=Date.now()-Q,this.mainAppendsToLoadedData__=this.mainSegmentLoader_.mediaAppends,this.audioAppendsToLoadedData__=this.audioSegmentLoader_.mediaAppends})})}mainAppendsToLoadedData_(){return this.mainAppendsToLoadedData__}audioAppendsToLoadedData_(){return this.audioAppendsToLoadedData__}appendsToLoadedData_(){const e=this.mainAppendsToLoadedData_(),i=this.audioAppendsToLoadedData_();return e===-1||i===-1?-1:e+i}timeToLoadedData_(){return this.timeToLoadedData__}checkABR_(e="abr"){const i=this.selectPlaylist();i&&this.shouldSwitchToMedia_(i)&&this.switchMedia_(i,e)}switchMedia_(e,i,r){const o=this.media(),u=o&&(o.id||o.uri),c=e&&(e.id||e.uri);if(u&&u!==c){this.logger_(`switch media ${u} -> ${c} from ${i}`);const p={renditionInfo:{id:c,bandwidth:e.attributes.BANDWIDTH,resolution:e.attributes.RESOLUTION,codecs:e.attributes.CODECS},cause:i};this.trigger({type:"renditionselected",metadata:p}),this.tech_.trigger({type:"usage",name:`vhs-rendition-change-${i}`})}this.mainPlaylistLoader_.media(e,r)}switchMediaForDASHContentSteering_(){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{const i=this.mediaTypes_[e],r=i?i.activeGroup():null,o=this.contentSteeringController_.getPathway();if(r&&o){const c=(r.length?r[0].playlists:r.playlists).filter(p=>p.attributes.serviceLocation===o);c.length&&this.mediaTypes_[e].activePlaylistLoader.media(c[0])}})}startABRTimer_(){this.stopABRTimer_(),this.abrTimer_=P.setInterval(()=>this.checkABR_(),250)}stopABRTimer_(){this.tech_.scrubbing&&this.tech_.scrubbing()||(P.clearInterval(this.abrTimer_),this.abrTimer_=null)}getAudioTrackPlaylists_(){const e=this.main(),i=e&&e.playlists||[];if(!e||!e.mediaGroups||!e.mediaGroups.AUDIO)return i;const r=e.mediaGroups.AUDIO,o=Object.keys(r);let u;if(Object.keys(this.mediaTypes_.AUDIO.groups).length)u=this.mediaTypes_.AUDIO.activeTrack();else{const p=r.main||o.length&&r[o[0]];for(const g in p)if(p[g].default){u={label:g};break}}if(!u)return i;const c=[];for(const p in r)if(r[p][u.label]){const g=r[p][u.label];if(g.playlists&&g.playlists.length)c.push.apply(c,g.playlists);else if(g.uri)c.push(g);else if(e.playlists.length)for(let b=0;b{const i=this.mainPlaylistLoader_.media(),r=i.targetDuration*1.5*1e3;_y(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=r,i.endList&&this.tech_.preload()!=="none"&&(this.mainSegmentLoader_.playlist(i,this.requestOptions_),this.mainSegmentLoader_.load()),aL({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(),i),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 i=this.mainPlaylistLoader_.media();if(!i){this.attachContentSteeringListeners_(),this.initContentSteeringController_(),this.excludeUnsupportedVariants_();let r;if(this.enableLowInitialPlaylist&&(r=this.selectInitialPlaylist()),r||(r=this.selectPlaylist()),!r||!this.shouldSwitchToMedia_(r)||(this.initialMedia_=r,this.switchMedia_(this.initialMedia_,"initial"),!(this.sourceType_==="vhs-json"&&this.initialMedia_.segments)))return;i=this.initialMedia_}this.handleUpdatedMediaPlaylist(i)}),this.mainPlaylistLoader_.on("error",()=>{const i=this.mainPlaylistLoader_.error;this.excludePlaylist({playlistToExclude:i.playlist,error:i})}),this.mainPlaylistLoader_.on("mediachanging",()=>{this.mainSegmentLoader_.abort(),this.mainSegmentLoader_.pause()}),this.mainPlaylistLoader_.on("mediachange",()=>{const i=this.mainPlaylistLoader_.media(),r=i.targetDuration*1.5*1e3;_y(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=r,this.sourceType_==="dash"&&this.mainPlaylistLoader_.isPaused&&this.mainPlaylistLoader_.load(),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(i,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_?this.runFastQualitySwitch_():this.mainSegmentLoader_.load(),this.tech_.trigger({type:"mediachange",bubbles:!0})}),this.mainPlaylistLoader_.on("playlistunchanged",()=>{const i=this.mainPlaylistLoader_.media();if(i.lastExcludeReason_==="playlist-unchanged")return;this.stuckAtPlaylistEnd_(i)&&(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(i=>{this.mainPlaylistLoader_.on(i,r=>{this.player_.trigger(Ft({},r))})})}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,i){const r=e.mediaGroups||{};let o=!0;const u=Object.keys(r.AUDIO);for(const c in r.AUDIO)for(const p in r.AUDIO[c])r.AUDIO[c][p].uri||(o=!1);o&&this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),Object.keys(r.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),Oa.Playlist.isAes(i)&&this.tech_.trigger({type:"usage",name:"vhs-aes"}),u.length&&Object.keys(r.AUDIO[u[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 i=this.mainPlaylistLoader_.media()||this.mainPlaylistLoader_.pendingMedia_,r=this.tech_.currentTime(),o=this.bufferLowWaterLine(),u=this.bufferHighWaterLine(),c=this.tech_.buffered();return fL({buffered:c,currentTime:r,currentPlaylist:i,nextPlaylist:e,bufferLowWaterLine:o,bufferHighWaterLine:u,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 r=this.mainSegmentLoader_.error();this.excludePlaylist({playlistToExclude:r.playlist,error:r})}),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 r=this.audioSegmentLoader_.pendingSegment_;if(!r||!r.segment||!r.segment.syncInfo)return;const o=r.segment.syncInfo.end+.01;this.tech_.setCurrentTime(o)}),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",r=>{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:cL}))});const e=()=>{if(!this.sourceUpdater_.hasCreatedSourceBuffers())return this.tryToCreateSourceBuffers_();const r=this.getCodecsOrExclude_();r&&this.sourceUpdater_.addOrChangeSourceBuffers(r)};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(r=>{this.mainSegmentLoader_.on(r,o=>{this.player_.trigger(Ft({},o))}),this.audioSegmentLoader_.on(r,o=>{this.player_.trigger(Ft({},o))}),this.subtitleSegmentLoader_.on(r,o=>{this.player_.trigger(Ft({},o))})})}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(){})}this.trigger("sourceopen")}handleSourceEnded_(){if(!this.inbandTextTracks_.metadataTrack_)return;const e=this.inbandTextTracks_.metadataTrack_.cues;if(!e||!e.length)return;const i=this.duration();e[e.length-1].endTime=isNaN(i)||Math.abs(i)===1/0?Number.MAX_VALUE:i}handleDurationChange_(){this.tech_.trigger("durationchange")}onEndOfStream(){let e=this.mainSegmentLoader_.ended_;if(this.mediaTypes_.AUDIO.activePlaylistLoader){const i=this.mainSegmentLoader_.getCurrentMediaInfo_();!i||i.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 r=this.syncController_.getExpiredTime(e,this.duration());if(r===null)return!1;const o=Oa.Playlist.playlistEnd(e,r),u=this.tech_.currentTime(),c=this.tech_.buffered();if(!c.length)return o-u<=Hs;const p=c.end(c.length-1);return p-u<=Hs&&o-p<=Hs}excludePlaylist({playlistToExclude:e=this.mainPlaylistLoader_.media(),error:i={},playlistExclusionDuration:r}){if(e=e||this.mainPlaylistLoader_.media(),r=r||i.playlistExclusionDuration||this.playlistExclusionDuration,!e){this.error=i,this.mediaSource.readyState!=="open"?this.trigger("error"):this.sourceUpdater_.endOfStream("network");return}e.playlistErrors_++;const o=this.mainPlaylistLoader_.main.playlists,u=o.filter(Lp),c=u.length===1&&u[0]===e;if(o.length===1&&r!==1/0)return V.log.warn(`Problem encountered with playlist ${e.id}. Trying again since it is the only playlist.`),this.tech_.trigger("retryplaylist"),this.mainPlaylistLoader_.load(c);if(c){if(this.main().contentSteering){const U=this.pathwayAttribute_(e),D=this.contentSteeringController_.steeringManifest.ttl*1e3;this.contentSteeringController_.excludePathway(U),this.excludeThenChangePathway_(),setTimeout(()=>{this.contentSteeringController_.addAvailablePathway(U)},D);return}let M=!1;o.forEach(U=>{if(U===e)return;const D=U.excludeUntil;typeof D<"u"&&D!==1/0&&(M=!0,delete U.excludeUntil)}),M&&(V.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}let p;e.playlistErrors_>this.maxPlaylistRetries?p=1/0:p=Date.now()+r*1e3,e.excludeUntil=p,i.reason&&(e.lastExcludeReason_=i.reason),this.tech_.trigger("excludeplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-excluded"});const g=this.selectPlaylist();if(!g){this.error="Playback cannot continue. No available working or supported playlists.",this.trigger("error");return}const b=i.internal?this.logger_:V.log.warn,S=i.message?" "+i.message:"";b(`${i.internal?"Internal problem":"Problem"} encountered with playlist ${e.id}.${S} Switching to playlist ${g.id}.`),g.attributes.AUDIO!==e.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),g.attributes.SUBTITLES!==e.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]);const E=g.targetDuration/2*1e3||5*1e3,A=typeof g.lastRequest=="number"&&Date.now()-g.lastRequest<=E;return this.switchMedia_(g,"exclude",c||A)}pauseLoading(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()}delegateLoaders_(e,i){const r=[],o=e==="all";(o||e==="main")&&r.push(this.mainPlaylistLoader_);const u=[];(o||e==="audio")&&u.push("AUDIO"),(o||e==="subtitle")&&(u.push("CLOSED-CAPTIONS"),u.push("SUBTITLES")),u.forEach(c=>{const p=this.mediaTypes_[c]&&this.mediaTypes_[c].activePlaylistLoader;p&&r.push(p)}),["main","audio","subtitle"].forEach(c=>{const p=this[`${c}SegmentLoader_`];p&&(e===c||e==="all")&&r.push(p)}),r.forEach(c=>i.forEach(p=>{typeof c[p]=="function"&&c[p]()}))}setCurrentTime(e){const i=gu(this.tech_.buffered(),e);if(!(this.mainPlaylistLoader_&&this.mainPlaylistLoader_.media())||!this.mainPlaylistLoader_.media().segments)return 0;if(i&&i.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:Oa.Playlist.duration(e):1/0:0}seekable(){return this.seekable_}getSeekableRange_(e,i){const r=e.media();if(!r)return null;const o=this.syncController_.getMediaSequenceSync(i);if(o&&o.isReliable){const p=o.start,g=o.end;if(!isFinite(p)||!isFinite(g))return null;const b=Oa.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,r),S=Math.max(p,g-b);return hi([[p,S]])}const u=this.syncController_.getExpiredTime(r,this.duration());if(u===null)return null;const c=Oa.Playlist.seekable(r,u,Oa.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,r));return c.length?c:null}computeFinalSeekable_(e,i){if(!i)return e;const r=e.start(0),o=e.end(0),u=i.start(0),c=i.end(0);return u>o||r>c?e:hi([[Math.max(r,u),Math.min(o,c)]])}onSyncInfoUpdate_(){if(!this.mainPlaylistLoader_)return;const e=this.getSeekableRange_(this.mainPlaylistLoader_,"main");if(!e)return;let i;if(this.mediaTypes_.AUDIO.activePlaylistLoader&&(i=this.getSeekableRange_(this.mediaTypes_.AUDIO.activePlaylistLoader,"audio"),!i))return;const r=this.seekable_;if(this.seekable_=this.computeFinalSeekable_(e,i),!this.seekable_||r&&r.length&&this.seekable_.length&&r.start(0)===this.seekable_.start(0)&&r.end(0)===this.seekable_.end(0))return;this.logger_(`seekable updated [${dS(this.seekable_)}]`);const o={seekableRanges:this.seekable_};this.trigger({type:"seekablerangeschanged",metadata:o}),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 o=this.seekable();if(!o.length)return;(isNaN(this.mediaSource.duration)||this.mediaSource.duration0&&(r=Math.max(r,i.end(i.length-1))),this.mediaSource.duration!==r&&this.sourceUpdater_.setDuration(r)}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 i=this.mediaTypes_[e].groups;for(const r in i)i[r].forEach(o=>{o.playlistLoader&&o.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,i=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),r=e?!!this.audioSegmentLoader_.getCurrentMediaInfo_():!0;return!(!i||!r)}getCodecsOrExclude_(){const e={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}},i=this.mainSegmentLoader_.getPendingSegmentPlaylist()||this.media();e.video=e.main;const r=Md(this.main(),i),o={},u=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(e.main.hasVideo&&(o.video=r.video||e.main.videoCodec||Fk),e.main.isMuxed&&(o.video+=`,${r.audio||e.main.audioCodec||nT}`),(e.main.hasAudio&&!e.main.isMuxed||e.audio.hasAudio||u)&&(o.audio=r.audio||e.main.audioCodec||e.audio.audioCodec||nT,e.audio.isFmp4=e.main.hasAudio&&!e.main.isMuxed?e.main.isFmp4:e.audio.isFmp4),!o.audio&&!o.video){this.excludePlaylist({playlistToExclude:i,error:{message:"Could not determine codecs for playlist."},playlistExclusionDuration:1/0});return}const c=(b,S)=>b?id(S,this.usingManagedMediaSource_):Gg(S),p={};let g;if(["video","audio"].forEach(function(b){if(o.hasOwnProperty(b)&&!c(e[b].isFmp4,o[b])){const S=e[b].isFmp4?"browser":"muxer";p[S]=p[S]||[],p[S].push(o[b]),b==="audio"&&(g=S)}}),u&&g&&i.attributes.AUDIO){const b=i.attributes.AUDIO;this.main().playlists.forEach(S=>{(S.attributes&&S.attributes.AUDIO)===b&&S!==i&&(S.excludeUntil=1/0)}),this.logger_(`excluding audio group ${b} as ${g} does not support codec(s): "${o.audio}"`)}if(Object.keys(p).length){const b=Object.keys(p).reduce((S,E)=>(S&&(S+=", "),S+=`${E} does not support codec(s): "${p[E].join(",")}"`,S),"")+".";this.excludePlaylist({playlistToExclude:i,error:{internal:!0,message:b},playlistExclusionDuration:1/0});return}if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){const b=[];if(["video","audio"].forEach(S=>{const E=(Rs(this.sourceUpdater_.codecs[S]||"")[0]||{}).type,A=(Rs(o[S]||"")[0]||{}).type;E&&A&&E.toLowerCase()!==A.toLowerCase()&&b.push(`"${this.sourceUpdater_.codecs[S]}" -> "${o[S]}"`)}),b.length){this.excludePlaylist({playlistToExclude:i,error:{message:`Codec switching not supported: ${b.join(", ")}.`,internal:!0},playlistExclusionDuration:1/0});return}}return o}tryToCreateSourceBuffers_(){if(this.mediaSource.readyState!=="open"||this.sourceUpdater_.hasCreatedSourceBuffers()||!this.areMediaTypesKnown_())return;const e=this.getCodecsOrExclude_();if(!e)return;this.sourceUpdater_.createSourceBuffers(e);const i=[e.video,e.audio].filter(Boolean).join(",");this.excludeIncompatibleVariants_(i)}excludeUnsupportedVariants_(){const e=this.main().playlists,i=[];Object.keys(e).forEach(r=>{const o=e[r];if(i.indexOf(o.id)!==-1)return;i.push(o.id);const u=Md(this.main,o),c=[];u.audio&&!Gg(u.audio)&&!id(u.audio,this.usingManagedMediaSource_)&&c.push(`audio codec ${u.audio}`),u.video&&!Gg(u.video)&&!id(u.video,this.usingManagedMediaSource_)&&c.push(`video codec ${u.video}`),u.text&&u.text==="stpp.ttml.im1t"&&c.push(`text codec ${u.text}`),c.length&&(o.excludeUntil=1/0,this.logger_(`excluding ${o.id} for unsupported: ${c.join(", ")}`))})}excludeIncompatibleVariants_(e){const i=[],r=this.main().playlists,o=Rd(Rs(e)),u=kS(o),c=o.video&&Rs(o.video)[0]||null,p=o.audio&&Rs(o.audio)[0]||null;Object.keys(r).forEach(g=>{const b=r[g];if(i.indexOf(b.id)!==-1||b.excludeUntil===1/0)return;i.push(b.id);const S=[],E=Md(this.mainPlaylistLoader_.main,b),A=kS(E);if(!(!E.audio&&!E.video)){if(A!==u&&S.push(`codec count "${A}" !== "${u}"`),!this.sourceUpdater_.canChangeType()){const M=E.video&&Rs(E.video)[0]||null,U=E.audio&&Rs(E.audio)[0]||null;M&&c&&M.type.toLowerCase()!==c.type.toLowerCase()&&S.push(`video codec "${M.type}" !== "${c.type}"`),U&&p&&U.type.toLowerCase()!==p.type.toLowerCase()&&S.push(`audio codec "${U.type}" !== "${p.type}"`)}S.length&&(b.excludeUntil=1/0,this.logger_(`excluding ${b.id}: ${S.join(" && ")}`))}})}updateAdCues_(e){let i=0;const r=this.seekable();r.length&&(i=r.start(0)),$M(e,this.cueTagsTrack_,i)}goalBufferLength(){const e=this.tech_.currentTime(),i=fi.GOAL_BUFFER_LENGTH,r=fi.GOAL_BUFFER_LENGTH_RATE,o=Math.max(i,fi.MAX_GOAL_BUFFER_LENGTH);return Math.min(i+e*r,o)}bufferLowWaterLine(){const e=this.tech_.currentTime(),i=fi.BUFFER_LOW_WATER_LINE,r=fi.BUFFER_LOW_WATER_LINE_RATE,o=Math.max(i,fi.MAX_BUFFER_LOW_WATER_LINE),u=Math.max(i,fi.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(i+e*r,this.bufferBasedABR?u:o)}bufferHighWaterLine(){return fi.BUFFER_HIGH_WATER_LINE}addDateRangesToTextTrack_(e){ax(this.inbandTextTracks_,"com.apple.streaming",this.tech_),EM({inbandTextTracks:this.inbandTextTracks_,dateRanges:e})}addMetadataToTextTrack(e,i,r){const o=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();ax(this.inbandTextTracks_,e,this.tech_),TM({inbandTextTracks:this.inbandTextTracks_,metadataArray:i,timestampOffset:o,videoDuration:r})}pathwayAttribute_(e){return e.attributes["PATHWAY-ID"]||e.attributes.serviceLocation}initContentSteeringController_(){const e=this.main();if(e.contentSteering){for(const i of e.playlists)this.contentSteeringController_.addAvailablePathway(this.pathwayAttribute_(i));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(i=>{this.contentSteeringController_.on(i,r=>{this.trigger(Ft({},r))})}),this.sourceType_==="dash"&&this.mainPlaylistLoader_.on("loadedplaylist",()=>{const i=this.main();(this.contentSteeringController_.didDASHTagChange(i.uri,i.contentSteering)||(()=>{const u=this.contentSteeringController_.getAvailablePathways(),c=[];for(const p of i.playlists){const g=p.attributes.serviceLocation;if(g&&(c.push(g),!u.has(g)))return!0}return!!(!c.length&&u.size)})())&&this.resetContentSteeringController_()})}excludeThenChangePathway_(){const e=this.contentSteeringController_.getPathway();if(!e)return;this.handlePathwayClones_();const r=this.main().playlists,o=new Set;let u=!1;Object.keys(r).forEach(c=>{const p=r[c],g=this.pathwayAttribute_(p),b=g&&e!==g;p.excludeUntil===1/0&&p.lastExcludeReason_==="content-steering"&&!b&&(delete p.excludeUntil,delete p.lastExcludeReason_,u=!0);const E=!p.excludeUntil&&p.excludeUntil!==1/0;!o.has(p.id)&&b&&E&&(o.add(p.id),p.excludeUntil=1/0,p.lastExcludeReason_="content-steering",this.logger_(`excluding ${p.id} for ${p.lastExcludeReason_}`))}),this.contentSteeringController_.manifestType_==="DASH"&&Object.keys(this.mediaTypes_).forEach(c=>{const p=this.mediaTypes_[c];if(p.activePlaylistLoader){const g=p.activePlaylistLoader.media_;g&&g.attributes.serviceLocation!==e&&(u=!0)}}),u&&this.changeSegmentPathway_()}handlePathwayClones_(){const i=this.main().playlists,r=this.contentSteeringController_.currentPathwayClones,o=this.contentSteeringController_.nextPathwayClones;if(r&&r.size||o&&o.size){for(const[c,p]of r.entries())o.get(c)||(this.mainPlaylistLoader_.updateOrDeleteClone(p),this.contentSteeringController_.excludePathway(c));for(const[c,p]of o.entries()){const g=r.get(c);if(!g){i.filter(S=>S.attributes["PATHWAY-ID"]===p["BASE-ID"]).forEach(S=>{this.mainPlaylistLoader_.addClonePathway(p,S)}),this.contentSteeringController_.addAvailablePathway(c);continue}this.equalPathwayClones_(g,p)||(this.mainPlaylistLoader_.updateOrDeleteClone(p,!0),this.contentSteeringController_.addAvailablePathway(c))}this.contentSteeringController_.currentPathwayClones=new Map(JSON.parse(JSON.stringify([...o])))}}equalPathwayClones_(e,i){if(e["BASE-ID"]!==i["BASE-ID"]||e.ID!==i.ID||e["URI-REPLACEMENT"].HOST!==i["URI-REPLACEMENT"].HOST)return!1;const r=e["URI-REPLACEMENT"].PARAMS,o=i["URI-REPLACEMENT"].PARAMS;for(const u in r)if(r[u]!==o[u])return!1;for(const u in o)if(r[u]!==o[u])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 i="non-usable";this.mainPlaylistLoader_.main.playlists.forEach(r=>{const o=this.mainPlaylistLoader_.getKeyIdSet(r);!o||!o.size||o.forEach(u=>{const c="usable",p=this.keyStatusMap_.has(u)&&this.keyStatusMap_.get(u)===c,g=r.lastExcludeReason_===i&&r.excludeUntil===1/0;p?p&&g&&(delete r.excludeUntil,delete r.lastExcludeReason_,this.logger_(`enabling playlist ${r.id} because key ID ${u} is ${c}`)):(r.excludeUntil!==1/0&&r.lastExcludeReason_!==i&&(r.excludeUntil=1/0,r.lastExcludeReason_=i,this.logger_(`excluding playlist ${r.id} because the key ID ${u} doesn't exist in the keyStatusMap or is not ${c}`)),e++)})}),e>=this.mainPlaylistLoader_.main.playlists.length&&this.mainPlaylistLoader_.main.playlists.forEach(r=>{const o=r&&r.attributes&&r.attributes.RESOLUTION&&r.attributes.RESOLUTION.height<720,u=r.excludeUntil===1/0&&r.lastExcludeReason_===i;o&&u&&(delete r.excludeUntil,V.log.warn(`enabling non-HD playlist ${r.id} because all playlists were excluded due to ${i} key IDs`))})}addKeyStatus_(e,i){const u=(typeof e=="string"?e:zM(e)).slice(0,32).toLowerCase();this.logger_(`KeyStatus '${i}' with key ID ${u} added to the keyStatusMap`),this.keyStatusMap_.set(u,i)}updatePlaylistByKeyStatus(e,i){this.addKeyStatus_(e,i),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 mL=(s,e,i)=>r=>{const o=s.main.playlists[e],u=by(o),c=Lp(o);if(typeof r>"u")return c;r?delete o.disabled:o.disabled=!0;const p={renditionInfo:{id:e,bandwidth:o.attributes.BANDWIDTH,resolution:o.attributes.RESOLUTION,codecs:o.attributes.CODECS},cause:"fast-quality"};return r!==c&&!u&&(r?(i(o),s.trigger({type:"renditionenabled",metadata:p})):s.trigger({type:"renditiondisabled",metadata:p})),r};class gL{constructor(e,i,r){const{playlistController_:o}=e,u=o.fastQualityChange_.bind(o);if(i.attributes){const c=i.attributes.RESOLUTION;this.width=c&&c.width,this.height=c&&c.height,this.bandwidth=i.attributes.BANDWIDTH,this.frameRate=i.attributes["FRAME-RATE"]}this.codecs=Md(o.main(),i),this.playlist=i,this.id=r,this.enabled=mL(e.playlists,i.id,u)}}const yL=function(s){s.representations=()=>{const e=s.playlistController_.main(),i=Od(e)?s.playlistController_.getAudioTrackPlaylists_():e.playlists;return i?i.filter(r=>!by(r)).map((r,o)=>new gL(s,r,r.id)):[]}},xx=["seeking","seeked","pause","playing","error"];class vL extends V.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_=$n("PlaybackWatcher"),this.logger_("initialize");const i=()=>this.monitorCurrentTime_(),r=()=>this.monitorCurrentTime_(),o=()=>this.techWaiting_(),u=()=>this.resetTimeUpdate_(),c=this.playlistController_,p=["main","subtitle","audio"],g={};p.forEach(S=>{g[S]={reset:()=>this.resetSegmentDownloads_(S),updateend:()=>this.checkSegmentDownloads_(S)},c[`${S}SegmentLoader_`].on("appendsdone",g[S].updateend),c[`${S}SegmentLoader_`].on("playlistupdate",g[S].reset),this.tech_.on(["seeked","seeking"],g[S].reset)});const b=S=>{["main","audio"].forEach(E=>{c[`${E}SegmentLoader_`][S]("appended",this.seekingAppendCheck_)})};this.seekingAppendCheck_=()=>{this.fixesBadSeeks_()&&(this.consecutiveUpdates=0,this.lastRecordedTime=this.tech_.currentTime(),b("off"))},this.clearSeekingAppendCheck_=()=>b("off"),this.watchForBadSeeking_=()=>{this.clearSeekingAppendCheck_(),b("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",o),this.tech_.on(xx,u),this.tech_.on("canplay",r),this.tech_.one("play",i),this.dispose=()=>{this.clearSeekingAppendCheck_(),this.logger_("dispose"),this.tech_.off("waiting",o),this.tech_.off(xx,u),this.tech_.off("canplay",r),this.tech_.off("play",i),this.tech_.off("seeking",this.watchForBadSeeking_),this.tech_.off("seeked",this.clearSeekingAppendCheck_),p.forEach(S=>{c[`${S}SegmentLoader_`].off("appendsdone",g[S].updateend),c[`${S}SegmentLoader_`].off("playlistupdate",g[S].reset),this.tech_.off(["seeked","seeking"],g[S].reset)}),this.checkCurrentTimeTimeout_&&P.clearTimeout(this.checkCurrentTimeTimeout_),this.resetTimeUpdate_()}}monitorCurrentTime_(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&P.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=P.setTimeout(this.monitorCurrentTime_.bind(this),250)}resetSegmentDownloads_(e){const i=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_`]=i.buffered_()}checkSegmentDownloads_(e){const i=this.playlistController_,r=i[`${e}SegmentLoader_`],o=r.buffered_(),u=a4(this[`${e}Buffered_`],o);if(this[`${e}Buffered_`]=o,u){const c={bufferedRanges:o};i.trigger({type:"bufferedrangeschanged",metadata:c}),this.resetSegmentDownloads_(e);return}this[`${e}StalledDownloads_`]++,this.logger_(`found #${this[`${e}StalledDownloads_`]} ${e} appends that did not increase buffer (possible stalled download)`,{playlistId:r.playlist_&&r.playlist_.id,buffered:Io(o)}),!(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"&&i.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(),i=this.tech_.buffered();if(this.lastRecordedTime===e&&(!i.length||e+Hs>=i.end(i.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(hi([this.lastRecordedTime,e]));const r={playedRanges:this.playedRanges_};this.playlistController_.trigger({type:"playedrangeschanged",metadata:r}),this.consecutiveUpdates=0,this.lastRecordedTime=e}}resetTimeUpdate_(){this.consecutiveUpdates=0}fixesBadSeeks_(){if(!this.tech_.seeking())return!1;const i=this.seekable(),r=this.tech_.currentTime(),o=this.afterSeekableWindow_(i,r,this.media(),this.allowSeeksWithinUnsafeLiveWindow);let u;if(o&&(u=i.end(i.length-1)),this.beforeSeekableWindow_(i,r)){const U=i.start(0);u=U+(U===i.end(0)?0:Hs)}if(typeof u<"u")return this.logger_(`Trying to seek outside of seekable at time ${r} with seekable range ${dS(i)}. Seeking to ${u}.`),this.tech_.setCurrentTime(u),!0;const c=this.playlistController_.sourceUpdater_,p=this.tech_.buffered(),g=c.audioBuffer?c.audioBuffered():null,b=c.videoBuffer?c.videoBuffered():null,S=this.media(),E=S.partTargetDuration?S.partTargetDuration:(S.targetDuration-Fs)*2,A=[g,b];for(let U=0;U ${r.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(),i=this.tech_.currentTime();if(this.tech_.seeking())return!0;if(this.beforeSeekableWindow_(e,i)){const p=e.end(e.length-1);return this.logger_(`Fell out of live window at time ${i}. Seeking to live point (seekable end) ${p}`),this.resetTimeUpdate_(),this.tech_.setCurrentTime(p),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),!0}const r=this.tech_.vhs.playlistController_.sourceUpdater_,o=this.tech_.buffered();if(this.videoUnderflow_({audioBuffered:r.audioBuffered(),videoBuffered:r.videoBuffered(),currentTime:i}))return this.resetTimeUpdate_(),this.tech_.setCurrentTime(i),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),!0;const c=Mp(o,i);return c.length>0?(this.logger_(`Stopped at ${i} and seeking to ${c.start(0)}`),this.resetTimeUpdate_(),this.skipTheGap_(i),!0):!1}afterSeekableWindow_(e,i,r,o=!1){if(!e.length)return!1;let u=e.end(e.length-1)+Hs;const c=!r.endList,p=typeof r.partTargetDuration=="number";return c&&(p||o)&&(u=e.end(e.length-1)+r.targetDuration*3),i>u}beforeSeekableWindow_(e,i){return!!(e.length&&e.start(0)>0&&i2)return{start:u,end:c}}return null}}const bL={errorInterval:30,getSource(s){const i=this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource();return s(i)}},Ex=function(s,e){let i=0,r=0;const o=pt(bL,e);s.ready(()=>{s.trigger({type:"usage",name:"vhs-error-reload-initialized"})});const u=function(){r&&s.currentTime(r)},c=function(S){S!=null&&(r=s.duration()!==1/0&&s.currentTime()||0,s.one("loadedmetadata",u),s.src(S),s.trigger({type:"usage",name:"vhs-error-reload"}),s.play())},p=function(){if(Date.now()-i{Object.defineProperty(Pt,s,{get(){return V.log.warn(`using Vhs.${s} is UNSAFE be sure you know what you are doing`),fi[s]},set(e){if(V.log.warn(`using Vhs.${s} is UNSAFE be sure you know what you are doing`),typeof e!="number"||e<0){V.log.warn(`value of Vhs.${s} must be greater than or equal to 0`);return}fi[s]=e}})});const Ax="videojs-vhs",Dx=function(s,e){const i=e.media();let r=-1;for(let o=0;o{s.addQualityLevel(i)}),Dx(s,e.playlists)};Pt.canPlaySource=function(){return V.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};const AL=(s,e,i)=>{if(!s)return s;let r={};e&&e.attributes&&e.attributes.CODECS&&(r=Rd(Rs(e.attributes.CODECS))),i&&i.attributes&&i.attributes.CODECS&&(r.audio=i.attributes.CODECS);const o=Hl(r.video),u=Hl(r.audio),c={};for(const p in s)c[p]={},u&&(c[p].audioContentType=u),o&&(c[p].videoContentType=o),e.contentProtection&&e.contentProtection[p]&&e.contentProtection[p].pssh&&(c[p].pssh=e.contentProtection[p].pssh),typeof s[p]=="string"&&(c[p].url=s[p]);return pt(s,c)},DL=(s,e)=>s.reduce((i,r)=>{if(!r.contentProtection)return i;const o=e.reduce((u,c)=>{const p=r.contentProtection[c];return p&&p.pssh&&(u[c]={pssh:p.pssh}),u},{});return Object.keys(o).length&&i.push(o),i},[]),wL=({player:s,sourceKeySystems:e,audioMedia:i,mainPlaylists:r})=>{if(!s.eme.initializeMediaKeys)return Promise.resolve();const o=i?r.concat([i]):r,u=DL(o,Object.keys(e)),c=[],p=[];return u.forEach(g=>{p.push(new Promise((b,S)=>{s.tech_.one("keysessioncreated",b)})),c.push(new Promise((b,S)=>{s.eme.initializeMediaKeys({keySystems:g},E=>{if(E){S(E);return}b()})}))}),Promise.race([Promise.all(c),Promise.race(p)])},kL=({player:s,sourceKeySystems:e,media:i,audioMedia:r})=>{const o=AL(e,i,r);return o?(s.currentSource().keySystems=o,o&&!s.eme?(V.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),!1):!0):!1},wx=()=>{if(!P.localStorage)return null;const s=P.localStorage.getItem(Ax);if(!s)return null;try{return JSON.parse(s)}catch{return null}},OL=s=>{if(!P.localStorage)return!1;let e=wx();e=e?pt(e,s):s;try{P.localStorage.setItem(Ax,JSON.stringify(e))}catch{return!1}return e},RL=s=>s.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")===0?JSON.parse(s.substring(s.indexOf(",")+1)):s,kx=(s,e)=>{s._requestCallbackSet||(s._requestCallbackSet=new Set),s._requestCallbackSet.add(e)},Ox=(s,e)=>{s._responseCallbackSet||(s._responseCallbackSet=new Set),s._responseCallbackSet.add(e)},Rx=(s,e)=>{s._requestCallbackSet&&(s._requestCallbackSet.delete(e),s._requestCallbackSet.size||delete s._requestCallbackSet)},Mx=(s,e)=>{s._responseCallbackSet&&(s._responseCallbackSet.delete(e),s._responseCallbackSet.size||delete s._responseCallbackSet)};Pt.supportsNativeHls=function(){if(!pe||!pe.createElement)return!1;const s=pe.createElement("video");return V.getTech("Html5").isSupported()?["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some(function(i){return/maybe|probably/i.test(s.canPlayType(i))}):!1}(),Pt.supportsNativeDash=function(){return!pe||!pe.createElement||!V.getTech("Html5").isSupported()?!1:/maybe|probably/i.test(pe.createElement("video").canPlayType("application/dash+xml"))}(),Pt.supportsTypeNatively=s=>s==="hls"?Pt.supportsNativeHls:s==="dash"?Pt.supportsNativeDash:!1,Pt.isSupported=function(){return V.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")},Pt.xhr.onRequest=function(s){kx(Pt.xhr,s)},Pt.xhr.onResponse=function(s){Ox(Pt.xhr,s)},Pt.xhr.offRequest=function(s){Rx(Pt.xhr,s)},Pt.xhr.offResponse=function(s){Mx(Pt.xhr,s)};const ML=V.getComponent("Component");class Lx extends ML{constructor(e,i,r){if(super(i,r.vhs),typeof r.initialBandwidth=="number"&&(this.options_.bandwidth=r.initialBandwidth),this.logger_=$n("VhsHandler"),i.options_&&i.options_.playerId){const o=V.getPlayer(i.options_.playerId);this.player_=o}if(this.tech_=i,this.source_=e,this.stats={},this.ignoreNextSeekingEvent_=!1,this.setOptions_(),this.options_.overrideNative&&i.overrideNativeAudioTracks&&i.overrideNativeVideoTracks)i.overrideNativeAudioTracks(!0),i.overrideNativeVideoTracks(!0);else if(this.options_.overrideNative&&(i.featuresNativeVideoTracks||i.featuresNativeAudioTracks))throw new Error("Overriding native VHS requires emulated tracks. See https://git.io/vMpjB");this.on(pe,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],o=>{const u=pe.fullscreenElement||pe.webkitFullscreenElement||pe.mozFullScreenElement||pe.msFullscreenElement;u&&u.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_=pt(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 r=wx();r&&r.bandwidth&&(this.options_.bandwidth=r.bandwidth,this.tech_.trigger({type:"usage",name:"vhs-bandwidth-from-local-storage"})),r&&r.throughput&&(this.options_.throughput=r.throughput,this.tech_.trigger({type:"usage",name:"vhs-throughput-from-local-storage"}))}typeof this.options_.bandwidth!="number"&&(this.options_.bandwidth=fi.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===fi.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","usePlayerObjectFit","customPixelRatio","limitRenditionByPlayerDimensions","bandwidth","customTagParsers","customTagMappers","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","bufferBasedABR","liveRangeSafeTimeDelta","llhls","useForcedSubtitles","useNetworkInformationApi","useDtsForTimestampOffset","exactManifestTimings","leastPixelDiffSelector"].forEach(r=>{typeof this.source_[r]<"u"&&(this.options_[r]=this.source_[r])}),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions,this.useDevicePixelRatio=this.options_.useDevicePixelRatio,this.usePlayerObjectFit=this.options_.usePlayerObjectFit;const i=this.options_.customPixelRatio;typeof i=="number"&&i>=0&&(this.customPixelRatio=i)}setOptions(e={}){this.setOptions_(e)}src(e,i){if(!e)return;this.setOptions_(),this.options_.src=RL(this.source_.src),this.options_.tech=this.tech_,this.options_.externVhs=Pt,this.options_.sourceType=sT(i),this.options_.seekTo=u=>{this.tech_.setCurrentTime(u)},this.options_.player_=this.player_,this.playlistController_=new pL(this.options_);const r=pt({liveRangeSafeTimeDelta:Hs},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_});this.playbackWatcher_=new vL(r),this.attachStreamingEventListeners_(),this.playlistController_.on("error",()=>{const u=V.players[this.tech_.options_.playerId];let c=this.playlistController_.error;typeof c=="object"&&!c.code?c.code=3:typeof c=="string"&&(c={message:c,code:3}),u.error(c)});const o=this.options_.bufferBasedABR?Pt.movingAverageBandwidthSelector(.55):Pt.STANDARD_PLAYLIST_SELECTOR;this.playlistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):o.bind(this),this.playlistController_.selectInitialPlaylist=Pt.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(u){this.playlistController_.selectPlaylist=u.bind(this)}},throughput:{get(){return this.playlistController_.mainSegmentLoader_.throughput.rate},set(u){this.playlistController_.mainSegmentLoader_.throughput.rate=u,this.playlistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get(){let u=this.playlistController_.mainSegmentLoader_.bandwidth;const c=P.navigator.connection||P.navigator.mozConnection||P.navigator.webkitConnection,p=1e7;if(this.options_.useNetworkInformationApi&&c){const g=c.downlink*1e3*1e3;g>=p&&u>=p?u=Math.max(u,g):u=g}return u},set(u){this.playlistController_.mainSegmentLoader_.bandwidth=u,this.playlistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get(){const u=1/(this.bandwidth||1);let c;return this.throughput>0?c=1/this.throughput:c=0,Math.floor(1/(u+c))},set(){V.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:()=>Io(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:()=>Io(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&&OL({bandwidth:this.bandwidth,throughput:Math.round(this.throughput)})}),this.playlistController_.on("selectedinitialmedia",()=>{yL(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_=P.URL.createObjectURL(this.playlistController_.mediaSource),(V.browser.IS_ANY_SAFARI||V.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"),wL({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(i=>{this.logger_("error while creating EME key session",i),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,i=kL({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:e&&e.media()});if(this.player_.tech_.on("keystatuschange",r=>{this.playlistController_.updatePlaylistByKeyStatus(r.keyId,r.status)}),this.handleWaitingForKey_=this.handleWaitingForKey_.bind(this),this.player_.tech_.on("waitingforkey",this.handleWaitingForKey_),!i){this.playlistController_.sourceUpdater_.initializedEme();return}this.createKeySessions_()}setupQualityLevels_(){const e=V.players[this.tech_.options_.playerId];!e||!e.qualityLevels||this.qualityLevels_||(this.qualityLevels_=e.qualityLevels(),this.playlistController_.on("selectedinitialmedia",()=>{CL(this.qualityLevels_,this)}),this.playlists.on("mediachange",()=>{Dx(this.qualityLevels_,this.playlists)}))}static version(){return{"@videojs/http-streaming":Cx,"mux.js":TL,"mpd-parser":SL,"m3u8-parser":xL,"aes-decrypter":EL}}version(){return this.constructor.version()}canChangeType(){return fx.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_&&P.URL.revokeObjectURL&&(P.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),super.dispose()}convertToProgramTime(e,i){return U4({playlist:this.playlistController_.media(),time:e,callback:i})}seekToProgramTime(e,i,r=!0,o=2){return FS({programTime:e,playlist:this.playlistController_.media(),retryCount:o,pauseAfterSeek:r,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:i})}setupXhrHooks_(){this.xhr.onRequest=e=>{kx(this.xhr,e)},this.xhr.onResponse=e=>{Ox(this.xhr,e)},this.xhr.offRequest=e=>{Rx(this.xhr,e)},this.xhr.offResponse=e=>{Mx(this.xhr,e)},this.player_.trigger("xhr-hooks-ready")}attachStreamingEventListeners_(){const e=["seekablerangeschanged","bufferedrangeschanged","contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"],i=["gapjumped","playedrangeschanged"];e.forEach(r=>{this.playlistController_.on(r,o=>{this.player_.trigger(Ft({},o))})}),i.forEach(r=>{this.playbackWatcher_.on(r,o=>{this.player_.trigger(Ft({},o))})})}}const Bp={name:"videojs-http-streaming",VERSION:Cx,canHandleSource(s,e={}){const i=pt(V.options,e);return!i.vhs.experimentalUseMMS&&!id("avc1.4d400d,mp4a.40.2",!1)?!1:Bp.canPlayType(s.type,i)},handleSource(s,e,i={}){const r=pt(V.options,i);return e.vhs=new Lx(s,e,r),e.vhs.xhr=IS(),e.vhs.setupXhrHooks_(),e.vhs.src(s.src,s.type),e.vhs},canPlayType(s,e){const i=sT(s);if(!i)return"";const r=Bp.getOverrideNative(e);return!Pt.supportsTypeNatively(i)||r?"maybe":""},getOverrideNative(s={}){const{vhs:e={}}=s,i=!(V.browser.IS_ANY_SAFARI||V.browser.IS_IOS),{overrideNative:r=i}=e;return r}};(()=>id("avc1.4d400d,mp4a.40.2",!0))()&&V.getTech("Html5").registerSourceHandler(Bp,0),V.VhsHandler=Lx,V.VhsSourceHandler=Bp,V.Vhs=Pt,V.use||V.registerComponent("Vhs",Pt),V.options.vhs=V.options.vhs||{},(!V.getPlugin||!V.getPlugin("reloadSourceOnError"))&&V.registerPlugin("reloadSourceOnError",_L);const X5="",LL=V.getComponent("Component");class Ix extends LL{constructor(e,i){i&&i.relatedVideos&&(i._relatedVideos=i.relatedVideos),super(e,i),this.relatedVideos=i&&i.relatedVideos?i.relatedVideos:[]}createEl(){const e=this.options_&&this.options_._relatedVideos?this.options_._relatedVideos:[],i=super.createEl("div",{className:"vjs-end-screen-overlay"}),r=V.dom.createEl("div",{className:"vjs-related-videos-grid"});if(e&&Array.isArray(e)&&e.length>0)e.forEach(o=>{const u=this.createVideoItem(o);r.appendChild(u)});else{const o=V.dom.createEl("div",{className:"vjs-no-related-videos"});o.textContent="No related videos available",o.style.color="white",o.style.textAlign="center",r.appendChild(o)}return i.appendChild(r),i}createVideoItem(e){const i=V.dom.createEl("div",{className:"vjs-related-video-item"}),r=V.dom.createEl("img",{className:"vjs-related-video-thumbnail",src:e.thumbnail,alt:e.title}),o=V.dom.createEl("div",{className:"vjs-related-video-overlay"}),u=V.dom.createEl("div",{className:"vjs-related-video-title"});u.textContent=e.title;const c=V.dom.createEl("div",{className:"vjs-related-video-author"});c.textContent=e.author;const p=V.dom.createEl("div",{className:"vjs-related-video-views"});return p.textContent=e.views,o.appendChild(u),o.appendChild(c),o.appendChild(p),i.appendChild(r),i.appendChild(o),i.addEventListener("click",()=>{window.location.href=`/view?m=${e.id}`}),i}show(){this.el().style.display="flex"}hide(){this.el().style.display="none"}}V.registerComponent("EndScreenOverlay",Ix);const IL=V.getComponent("Component");class Nx extends IL{constructor(e,i){super(e,i),this.on(e,"loadedmetadata",this.updateChapterMarkers),this.on(e,"texttrackchange",this.updateChapterMarkers),this.chaptersData=[],this.tooltip=null,this.isHovering=!1,this.previewSprite=i.previewSprite||null,console.log("aaaaaaa",this.previewSprite)}createEl(){const e=super.createEl("div",{className:"vjs-chapter-markers-track"});return this.tooltip=null,e}updateChapterMarkers(){const e=this.player(),i=e.textTracks();let r=null;for(let u=0;u{this.isHovering=!0,this.tooltip.style.display="block"},this.handleMouseLeave=()=>{this.isHovering=!1,this.tooltip.style.display="none"},this.handleMouseMove=u=>{this.isHovering&&this.updateChapterTooltip(u,r,o)},o.addEventListener("mouseenter",this.handleMouseEnter),o.addEventListener("mouseleave",this.handleMouseLeave),o.addEventListener("mousemove",this.handleMouseMove)}updateChapterTooltip(e,i,r){if(!this.tooltip||!this.isHovering)return;const o=this.player().duration();if(!o)return;const u=i.getBoundingClientRect(),c=r.getBoundingClientRect(),p=e.clientX-u.left,b=Math.max(0,Math.min(1,p/u.width))*o,S=e.clientX-c.left,E=this.findChapterAtTime(b);if(E){const A=z=>{const H=Math.floor(z/60),Y=Math.floor(z%60);return`${H}:${Y.toString().padStart(2,"0")}`},M=A(E.startTime),U=A(E.endTime),D=A(b);this.chapterTitle.textContent=E.text,this.chapterInfo.textContent=`Chapter: ${M} - ${U}`,this.positionInfo.textContent=`Position2: ${D}`,this.updateSpriteThumbnail(b),console.log("chapterImagexxxxxx",this.chapterImage),this.chapterImage.style.display="block"}else{const A=this.formatTime(b);this.chapterTitle.textContent="No Chapter",this.chapterInfo.textContent="",this.positionInfo.textContent=`Position1: ${A}`,this.updateSpriteThumbnail(b),this.chapterImage.style.display="block"}this.tooltip.style.left=`${S}px`,this.tooltip.style.display="block"}findChapterAtTime(e){for(const i of this.chaptersData)if(e>=i.startTime&&e10&&(this.chapterImage.style.backgroundPosition="0px 0px")}formatTime(e){const i=Math.floor(e/60),r=Math.floor(e%60);return`${i}:${r.toString().padStart(2,"0")}`}createMarker(e,i){const r=V.dom.createEl("div",{className:"vjs-chapter-marker"}),o=e.startTime/i*100;r.style.left=o+"%";const u=V.dom.createEl("div",{className:"vjs-chapter-marker-tooltip"});return u.textContent=e.text,r.appendChild(u),r.addEventListener("click",c=>{c.stopPropagation(),this.player().currentTime(e.startTime)}),r.style.pointerEvents="auto",r.style.cursor="pointer",r}dispose(){var i;const e=(i=this.player().getChild("controlBar"))==null?void 0:i.getChild("progressControl");if(e){const r=e.el();r.removeEventListener("mouseenter",this.handleMouseEnter),r.removeEventListener("mouseleave",this.handleMouseLeave),r.removeEventListener("mousemove",this.handleMouseMove)}this.tooltip&&this.tooltip.parentNode&&this.tooltip.parentNode.removeChild(this.tooltip),super.dispose()}}V.registerComponent("ChapterMarkers",Nx);const NL=V.getComponent("Button");class Px extends NL{constructor(e,i){super(e,i)}createEl(){const e=super.createEl("button",{className:"vjs-next-video-control vjs-control vjs-button",type:"button",title:"Next Video","aria-label":"Next Video"}),i=V.dom.createEl("span",{"aria-hidden":"true"});i.innerHTML=` - `;const r=$.dom.createEl("span",{className:"vjs-control-text"});return r.textContent="Next Video",e.appendChild(i),e.appendChild(r),e}handleClick(){this.player().trigger("nextVideo")}}$.registerComponent("NextVideoButton",Px);const PL=$.getComponent("Component");class Uy extends PL{constructor(e,i){super(e,i),this.updateContent=this.updateContent.bind(this),this.on(e,"timeupdate",this.updateContent),this.on(e,"durationchange",this.updateContent),this.on(e,"loadedmetadata",this.updateContent),this.options_={displayNegative:!1,customPrefix:"",customSuffix:"",...i}}createEl(){const e=$.dom.createEl("div",{className:"vjs-remaining-time vjs-time-control vjs-control custom-remaining-time"});return e.innerHTML=` + `;const r=V.dom.createEl("span",{className:"vjs-control-text"});return r.textContent="Next Video",e.appendChild(i),e.appendChild(r),e}handleClick(){this.player().trigger("nextVideo")}}V.registerComponent("NextVideoButton",Px);const PL=V.getComponent("Component");class Uy extends PL{constructor(e,i){super(e,i),this.updateContent=this.updateContent.bind(this),this.on(e,"timeupdate",this.updateContent),this.on(e,"durationchange",this.updateContent),this.on(e,"loadedmetadata",this.updateContent),this.options_={displayNegative:!1,customPrefix:"",customSuffix:"",...i}}createEl(){const e=V.dom.createEl("div",{className:"vjs-remaining-time vjs-time-control vjs-control custom-remaining-time"});return e.innerHTML=` Time Display  0:00 / 0:00 - `,e}updateContent(){const e=this.player(),i=e.currentTime(),r=e.duration(),o=this.el().querySelector(".vjs-remaining-time-display");if(o){const u=this.formatTime(isNaN(i)?0:i),c=this.formatTime(isNaN(r)?0:r);o.textContent=`${u} / ${c}`}}formatTime(e){const{customPrefix:i,customSuffix:r}=this.options_,o=Math.floor(e/3600),u=Math.floor(e%3600/60),c=Math.floor(e%60);let p;return o>0?p=`${o}:${u.toString().padStart(2,"0")}:${c.toString().padStart(2,"0")}`:p=`${u}:${c.toString().padStart(2,"0")}`,`${i}${p}${r}`}handleClick(){console.log("Time display clicked")}dispose(){super.dispose()}}Uy.prototype.controlText_="Time Display",$.registerComponent("CustomRemainingTime",Uy);const UL=$.getComponent("Component");class By extends UL{constructor(e,i){super(e,i),this.chaptersData=i.chaptersData||[],this.overlay=null,this.chaptersList=null,this.createOverlay=this.createOverlay.bind(this),this.updateCurrentChapter=this.updateCurrentChapter.bind(this),this.toggleOverlay=this.toggleOverlay.bind(this),this.player().ready(()=>{this.createOverlay(),this.setupChaptersButton()})}createOverlay(){if(!this.chaptersData||this.chaptersData.length===0){console.log("⚠ No chapters data available for overlay");return}const e=this.player().el();this.overlay=document.createElement("div"),this.overlay.className="custom-chapters-overlay",this.overlay.style.cssText=` + `,e}updateContent(){const e=this.player(),i=e.currentTime(),r=e.duration(),o=this.el().querySelector(".vjs-remaining-time-display");if(o){const u=this.formatTime(isNaN(i)?0:i),c=this.formatTime(isNaN(r)?0:r);o.textContent=`${u} / ${c}`}}formatTime(e){const{customPrefix:i,customSuffix:r}=this.options_,o=Math.floor(e/3600),u=Math.floor(e%3600/60),c=Math.floor(e%60);let p;return o>0?p=`${o}:${u.toString().padStart(2,"0")}:${c.toString().padStart(2,"0")}`:p=`${u}:${c.toString().padStart(2,"0")}`,`${i}${p}${r}`}handleClick(){console.log("Time display clicked")}dispose(){super.dispose()}}Uy.prototype.controlText_="Time Display",V.registerComponent("CustomRemainingTime",Uy);const UL=V.getComponent("Component");class By extends UL{constructor(e,i){super(e,i),this.chaptersData=i.chaptersData||[],this.overlay=null,this.chaptersList=null,this.createOverlay=this.createOverlay.bind(this),this.updateCurrentChapter=this.updateCurrentChapter.bind(this),this.toggleOverlay=this.toggleOverlay.bind(this),this.player().ready(()=>{this.createOverlay(),this.setupChaptersButton()})}createOverlay(){if(!this.chaptersData||this.chaptersData.length===0){console.log("⚠ No chapters data available for overlay");return}const e=this.player().el();this.overlay=document.createElement("div"),this.overlay.className="custom-chapters-overlay",this.overlay.style.cssText=` position: absolute; top: 0; right: 0; @@ -554,7 +547,7 @@ ${xu(e)}`),i.map&&!i.map.bytes&&(this.logger_("going to request init segment."), transition: background 0.2s ease; font-size: 14px; line-height: 1.4; - `,u.textContent=o.text,u.onmouseenter=()=>{u.style.background="rgba(74, 144, 226, 0.2)"},u.onmouseleave=()=>{u.style.background="transparent"},u.onclick=()=>{this.player().currentTime(o.startTime),this.overlay.style.display="none",this.chaptersList.querySelectorAll("div").forEach(c=>{c.style.background="transparent",c.style.fontWeight="normal"}),u.style.background="rgba(74, 144, 226, 0.4)",u.style.fontWeight="bold"},this.chaptersList.appendChild(u)}),this.overlay.appendChild(this.chaptersList),e.appendChild(this.overlay),this.player().on("timeupdate",this.updateCurrentChapter),console.log("✓ Custom chapters overlay created")}setupChaptersButton(){const e=this.player().getChild("controlBar").getChild("chaptersButton");e&&(e.off("click"),e.on("click",this.toggleOverlay))}toggleOverlay(){this.overlay&&(this.overlay.style.display==="none"||!this.overlay.style.display?this.overlay.style.display="block":this.overlay.style.display="none")}updateCurrentChapter(){if(!this.chaptersList||!this.chaptersData)return;const e=this.player().currentTime();this.chaptersList.querySelectorAll("div").forEach((r,o)=>{const u=this.chaptersData[o];e>=u.startTime&&(o===this.chaptersData.length-1||e{this.subtitleAutoSaveDisabled=!1,console.log("🔓 Subtitle auto-save RE-ENABLED after initial load period")},3e3),typeof i.volume=="number"&&i.volume>=0&&i.volume<=1&&e.volume(i.volume),typeof i.muted=="boolean"&&e.muted(i.muted),typeof i.playbackRate=="number"&&i.playbackRate>0&&e.playbackRate(i.playbackRate),console.log("Applied user preferences to player:",i)}setupAutoSave(e){e.on("volumechange",()=>{this.setPreference("volume",e.volume()),this.setPreference("muted",e.muted())}),e.on("ratechange",()=>{this.setPreference("playbackRate",e.playbackRate())}),e.on("texttrackchange",()=>{if(this.isRestoringSubtitles){console.log("Skipping subtitle save - currently restoring preferences");return}setTimeout(()=>{const i=e.textTracks();let r=null;for(let o=0;o{const i=e.getChild("controlBar");console.log("=== Searching for subtitle controls ===");const r=["subtitlesButton","captionsButton","subsCapsButton","textTrackButton"];let o=null;for(const u of r){const c=i.getChild(u);if(c){console.log(`Found subtitle button: ${u}`),o=c;break}}o||(console.log("Scanning all control bar children..."),i.children().forEach((c,p)=>{const g=c.name_||c.constructor.name||"Unknown";console.log(`Child ${p}: ${g}`),(g.toLowerCase().includes("subtitle")||g.toLowerCase().includes("caption")||g.toLowerCase().includes("text"))&&(console.log(`Potential subtitle button found: ${g}`),o=c)})),o?(console.log("Found subtitles button, setting up menu listeners"),setTimeout(()=>{this.attachMenuItemListeners(e,o)},500),setTimeout(()=>{this.attachMenuItemListeners(e,o)},2e3)):(console.log("No subtitles button found after exhaustive search"),this.setupDOMBasedListeners(e))},1e3)}setupDOMBasedListeners(e){console.log("Setting up DOM-based subtitle listeners as fallback"),setTimeout(()=>{const i=e.el();i&&(i.addEventListener("click",r=>{const o=r.target;(o.closest(".vjs-subtitles-menu-item")||o.closest(".vjs-captions-menu-item")||o.closest(".vjs-menu-item")&&o.textContent.toLowerCase().includes("subtitle"))&&(console.log("Subtitle menu item clicked via DOM listener:",o.textContent),setTimeout(()=>{this.detectActiveSubtitleFromDOM(e,!0)},200)),o.closest(".vjs-menu-item")&&o.textContent.toLowerCase().includes("off")&&(console.log("Captions off clicked via DOM listener"),setTimeout(()=>{this.setPreference("subtitleLanguage",null,!0)},200))}),console.log("DOM-based subtitle listeners attached"))},1500)}detectActiveSubtitleFromDOM(e,i=!1){if(this.isRestoringSubtitles){console.log("Skipping DOM subtitle save - currently restoring preferences");return}const r=e.textTracks();let o=null;for(let u=0;u{if(o.track){const c=o.track;console.log(`Menu item ${u}: ${c.label} (${c.language})`);const p=o.handleClick.bind(o);o.handleClick=()=>{console.log("Subtitle menu item clicked:",c.label,c.language),p(),setTimeout(()=>{c.mode==="showing"?(console.log("Saving subtitle preference:",c.language),this.setPreference("subtitleLanguage",c.language,!0)):(console.log("Subtitle disabled, saving null"),this.setPreference("subtitleLanguage",null,!0))},100)}}else if(o.label&&o.label.toLowerCase().includes("off")){console.log("Found captions off menu item");const c=o.handleClick.bind(o);o.handleClick=()=>{console.log("Captions off clicked"),c(),setTimeout(()=>{console.log("Saving subtitle preference: null (off)"),this.setPreference("subtitleLanguage",null,!0)},100)}}})):console.log("Could not find subtitle menu or menu items")}catch(r){console.error("Error setting up subtitle menu listeners:",r)}}applySubtitlePreference(e){const i=this.getPreference("subtitleLanguage");if(i){this.isRestoringSubtitles=!0,console.log("isRestoringSubtitles",this.isRestoringSubtitles);const r=(o=1)=>{const u=e.textTracks();console.log(`Subtitle application attempt ${o}, found ${u.length} text tracks`);for(let p=0;p{this.isRestoringSubtitles=!1,console.log("✅ Subtitle restoration complete, auto-save re-enabled")},600),!c&&o<5?(console.log(`Subtitle language ${i} not found, retrying in ${o*200}ms...`),setTimeout(()=>r(o+1),o*200)):c||(console.warn("Could not find subtitle track for language:",i),this.isRestoringSubtitles=!1)};setTimeout(()=>r(),500)}else console.log("No saved subtitle language to apply")}updateSubtitleMenuUI(e,i){try{const o=e.getChild("controlBar").getChild("subtitlesButton");o&&o.menu&&o.menu.children_.forEach(c=>{c.track?c.track===i?(c.selected(!0),console.log("Updated menu UI for:",c.track.label)):c.selected(!1):c.label&&c.label.toLowerCase().includes("off")&&c.selected(!1)})}catch(r){console.error("Error updating subtitle menu UI:",r)}}getQualityPreference(){return this.getPreference("quality")}setQualityPreference(e){this.setPreference("quality",e)}forceSetSubtitleLanguage(e){console.log(`🚀 FORCE SAVING subtitle language: ${e}`);const r={...this.getPreferences(),subtitleLanguage:e};try{localStorage.setItem(this.storageKey,JSON.stringify(r)),console.log("✅ Force saved subtitle language:",e)}catch(o){console.error("❌ Error force saving subtitle language:",o)}}}const BL=$.getComponent("Component");class Fy extends BL{constructor(e,i){super(e,i),this.settingsButton=null,this.settingsOverlay=null,this.speedSubmenu=null,this.userPreferences=(i==null?void 0:i.userPreferences)||new Ux,this.createSettingsButton=this.createSettingsButton.bind(this),this.createSettingsOverlay=this.createSettingsOverlay.bind(this),this.positionButton=this.positionButton.bind(this),this.toggleSettings=this.toggleSettings.bind(this),this.handleSpeedChange=this.handleSpeedChange.bind(this),this.handleClickOutside=this.handleClickOutside.bind(this),this.player().ready(()=>{this.createSettingsButton(),this.createSettingsOverlay(),this.setupEventListeners()})}createSettingsButton(){const e=this.player().getChild("controlBar"),i=e.getChild("playbackRateMenuButton");i&&i.hide(),this.settingsButton=e.addChild("button",{controlText:"Settings",className:"vjs-settings-button"});const r=this.settingsButton.el();r.innerHTML=` + `,u.textContent=o.text,u.onmouseenter=()=>{u.style.background="rgba(74, 144, 226, 0.2)"},u.onmouseleave=()=>{u.style.background="transparent"},u.onclick=()=>{this.player().currentTime(o.startTime),this.overlay.style.display="none",this.chaptersList.querySelectorAll("div").forEach(c=>{c.style.background="transparent",c.style.fontWeight="normal"}),u.style.background="rgba(74, 144, 226, 0.4)",u.style.fontWeight="bold"},this.chaptersList.appendChild(u)}),this.overlay.appendChild(this.chaptersList),e.appendChild(this.overlay),this.player().on("timeupdate",this.updateCurrentChapter),console.log("✓ Custom chapters overlay created")}setupChaptersButton(){const e=this.player().getChild("controlBar").getChild("chaptersButton");e&&(e.off("click"),e.on("click",this.toggleOverlay))}toggleOverlay(){this.overlay&&(this.overlay.style.display==="none"||!this.overlay.style.display?this.overlay.style.display="block":this.overlay.style.display="none")}updateCurrentChapter(){if(!this.chaptersList||!this.chaptersData)return;const e=this.player().currentTime();this.chaptersList.querySelectorAll("div").forEach((r,o)=>{const u=this.chaptersData[o];e>=u.startTime&&(o===this.chaptersData.length-1||e{this.subtitleAutoSaveDisabled=!1,console.log("🔓 Subtitle auto-save RE-ENABLED after initial load period")},3e3),typeof i.volume=="number"&&i.volume>=0&&i.volume<=1&&e.volume(i.volume),typeof i.muted=="boolean"&&e.muted(i.muted),typeof i.playbackRate=="number"&&i.playbackRate>0&&e.playbackRate(i.playbackRate),console.log("Applied user preferences to player:",i)}setupAutoSave(e){e.on("volumechange",()=>{this.setPreference("volume",e.volume()),this.setPreference("muted",e.muted())}),e.on("ratechange",()=>{this.setPreference("playbackRate",e.playbackRate())}),e.on("texttrackchange",()=>{if(this.isRestoringSubtitles){console.log("Skipping subtitle save - currently restoring preferences");return}setTimeout(()=>{const i=e.textTracks();let r=null;for(let o=0;o{const i=e.getChild("controlBar");console.log("=== Searching for subtitle controls ===");const r=["subtitlesButton","captionsButton","subsCapsButton","textTrackButton"];let o=null;for(const u of r){const c=i.getChild(u);if(c){console.log(`Found subtitle button: ${u}`),o=c;break}}o||(console.log("Scanning all control bar children..."),i.children().forEach((c,p)=>{const g=c.name_||c.constructor.name||"Unknown";console.log(`Child ${p}: ${g}`),(g.toLowerCase().includes("subtitle")||g.toLowerCase().includes("caption")||g.toLowerCase().includes("text"))&&(console.log(`Potential subtitle button found: ${g}`),o=c)})),o?(console.log("Found subtitles button, setting up menu listeners"),setTimeout(()=>{this.attachMenuItemListeners(e,o)},500),setTimeout(()=>{this.attachMenuItemListeners(e,o)},2e3)):(console.log("No subtitles button found after exhaustive search"),this.setupDOMBasedListeners(e))},1e3)}setupDOMBasedListeners(e){console.log("Setting up DOM-based subtitle listeners as fallback"),setTimeout(()=>{const i=e.el();i&&(i.addEventListener("click",r=>{const o=r.target;(o.closest(".vjs-subtitles-menu-item")||o.closest(".vjs-captions-menu-item")||o.closest(".vjs-menu-item")&&o.textContent.toLowerCase().includes("subtitle"))&&(console.log("Subtitle menu item clicked via DOM listener:",o.textContent),setTimeout(()=>{this.detectActiveSubtitleFromDOM(e,!0)},200)),o.closest(".vjs-menu-item")&&o.textContent.toLowerCase().includes("off")&&(console.log("Captions off clicked via DOM listener"),setTimeout(()=>{this.setPreference("subtitleLanguage",null,!0)},200))}),console.log("DOM-based subtitle listeners attached"))},1500)}detectActiveSubtitleFromDOM(e,i=!1){if(this.isRestoringSubtitles){console.log("Skipping DOM subtitle save - currently restoring preferences");return}const r=e.textTracks();let o=null;for(let u=0;u{if(o.track){const c=o.track;console.log(`Menu item ${u}: ${c.label} (${c.language})`);const p=o.handleClick.bind(o);o.handleClick=()=>{console.log("Subtitle menu item clicked:",c.label,c.language),p(),setTimeout(()=>{c.mode==="showing"?(console.log("Saving subtitle preference:",c.language),this.setPreference("subtitleLanguage",c.language,!0)):(console.log("Subtitle disabled, saving null"),this.setPreference("subtitleLanguage",null,!0))},100)}}else if(o.label&&o.label.toLowerCase().includes("off")){console.log("Found captions off menu item");const c=o.handleClick.bind(o);o.handleClick=()=>{console.log("Captions off clicked"),c(),setTimeout(()=>{console.log("Saving subtitle preference: null (off)"),this.setPreference("subtitleLanguage",null,!0)},100)}}})):console.log("Could not find subtitle menu or menu items")}catch(r){console.error("Error setting up subtitle menu listeners:",r)}}applySubtitlePreference(e){const i=this.getPreference("subtitleLanguage");if(i){this.isRestoringSubtitles=!0,console.log("isRestoringSubtitles",this.isRestoringSubtitles);const r=(o=1)=>{const u=e.textTracks();console.log(`Subtitle application attempt ${o}, found ${u.length} text tracks`);for(let p=0;p{this.isRestoringSubtitles=!1,console.log("✅ Subtitle restoration complete, auto-save re-enabled")},600),!c&&o<5?(console.log(`Subtitle language ${i} not found, retrying in ${o*200}ms...`),setTimeout(()=>r(o+1),o*200)):c||(console.warn("Could not find subtitle track for language:",i),this.isRestoringSubtitles=!1)};setTimeout(()=>r(),500)}else console.log("No saved subtitle language to apply")}updateSubtitleMenuUI(e,i){try{const o=e.getChild("controlBar").getChild("subtitlesButton");o&&o.menu&&o.menu.children_.forEach(c=>{c.track?c.track===i?(c.selected(!0),console.log("Updated menu UI for:",c.track.label)):c.selected(!1):c.label&&c.label.toLowerCase().includes("off")&&c.selected(!1)})}catch(r){console.error("Error updating subtitle menu UI:",r)}}getQualityPreference(){return this.getPreference("quality")}setQualityPreference(e){this.setPreference("quality",e)}forceSetSubtitleLanguage(e){console.log(`🚀 FORCE SAVING subtitle language: ${e}`);const r={...this.getPreferences(),subtitleLanguage:e};try{localStorage.setItem(this.storageKey,JSON.stringify(r)),console.log("✅ Force saved subtitle language:",e)}catch(o){console.error("❌ Error force saving subtitle language:",o)}}}const BL=V.getComponent("Component");class Fy extends BL{constructor(e,i){super(e,i),this.settingsButton=null,this.settingsOverlay=null,this.speedSubmenu=null,this.userPreferences=(i==null?void 0:i.userPreferences)||new Ux,this.createSettingsButton=this.createSettingsButton.bind(this),this.createSettingsOverlay=this.createSettingsOverlay.bind(this),this.positionButton=this.positionButton.bind(this),this.toggleSettings=this.toggleSettings.bind(this),this.handleSpeedChange=this.handleSpeedChange.bind(this),this.handleClickOutside=this.handleClickOutside.bind(this),this.player().ready(()=>{this.createSettingsButton(),this.createSettingsOverlay(),this.setupEventListeners()})}createSettingsButton(){const e=this.player().getChild("controlBar"),i=e.getChild("playbackRateMenuButton");i&&i.hide(),this.settingsButton=e.addChild("button",{controlText:"Settings",className:"vjs-settings-button"});const r=this.settingsButton.el();r.innerHTML=` `,this.positionButton(),this.settingsButton.on("click",this.toggleSettings)}createSettingsOverlay(){const e=this.player().getChild("controlBar");this.settingsOverlay=document.createElement("div"),this.settingsOverlay.className="custom-settings-overlay";const i=this.userPreferences.getPreference("playbackRate"),r=this.userPreferences.getPreference("quality"),o=i===1?"Normal":`${i}`,u=r.charAt(0).toUpperCase()+r.slice(1);this.settingsOverlay.innerHTML=`
Settings
@@ -579,5 +572,5 @@ ${xu(e)}`),i.map&&!i.map.bytes&&(this.logger_("going to request init segment."), ${r.value===i?"":""} `).join("")} - `,this.settingsOverlay.appendChild(this.speedSubmenu)}positionButton(){const e=this.player().getChild("controlBar"),i=e.getChild("fullscreenToggle");this.settingsButton&&i&&setTimeout(()=>{const r=e.children().indexOf(i);e.removeChild(this.settingsButton),e.addChild(this.settingsButton,{},r+1),console.log("✓ Settings button positioned after fullscreen toggle")},50)}setupEventListeners(){this.settingsOverlay.addEventListener("click",e=>{e.stopPropagation(),e.target.closest('[data-setting="playback-speed"]')&&(this.speedSubmenu.style.display="flex")}),this.speedSubmenu.querySelector(".submenu-header").addEventListener("click",()=>{this.speedSubmenu.style.display="none"}),this.speedSubmenu.addEventListener("click",e=>{const i=e.target.closest(".speed-option");if(i){const r=parseFloat(i.dataset.speed);this.handleSpeedChange(r,i)}}),document.addEventListener("click",this.handleClickOutside),this.settingsOverlay.addEventListener("mouseover",e=>{const i=e.target.closest(".settings-item, .speed-option");i&&!i.style.background.includes("0.1")&&(i.style.background="rgba(255, 255, 255, 0.05)")}),this.settingsOverlay.addEventListener("mouseout",e=>{const i=e.target.closest(".settings-item, .speed-option");i&&!i.style.background.includes("0.1")&&(i.style.background="transparent")})}toggleSettings(e){e.stopPropagation();const i=this.settingsOverlay.style.display==="block";this.settingsOverlay.style.display=i?"none":"block",this.speedSubmenu.style.display="none"}handleSpeedChange(e,i){this.player().playbackRate(e),this.userPreferences.setPreference("playbackRate",e),document.querySelectorAll(".speed-option").forEach(u=>{var c;u.classList.remove("active"),u.style.background="transparent",(c=u.querySelector("span:last-child"))==null||c.remove()}),i.classList.add("active"),i.style.background="rgba(255, 255, 255, 0.1)",i.insertAdjacentHTML("beforeend","");const r=this.settingsOverlay.querySelector(".current-speed"),o=e===1?"Normal":`${e}`;r.textContent=o,this.settingsOverlay.style.display="none",this.speedSubmenu.style.display="none",console.log("Playback speed preference saved:",e)}handleClickOutside(e){this.settingsOverlay&&this.settingsButton&&!this.settingsOverlay.contains(e.target)&&!this.settingsButton.el().contains(e.target)&&(this.settingsOverlay.style.display="none",this.speedSubmenu.style.display="none")}dispose(){document.removeEventListener("click",this.handleClickOutside),this.settingsOverlay&&this.settingsOverlay.remove(),super.dispose()}}Fy.prototype.controlText_="Settings Menu",$.registerComponent("CustomSettingsMenu",Fy);function FL(){const s=Hn.useRef(null),e=Hn.useRef(null),i=Hn.useRef(new Ux),r=Hn.useMemo(()=>typeof window<"u"&&window.MEDIA_DATA?window.MEDIA_DATA:{data:{},siteUrl:"",hasNextLink:!0},[]),o=[{startTime:0,endTime:5,text:"Start111"},{startTime:5,endTime:10,text:"Introduction - EuroHPC"},{startTime:10,endTime:15,text:"Planning - EuroHPC"},{startTime:15,endTime:20,text:"Parcel Discounts - EuroHPC"},{startTime:20,endTime:25,text:"Class Studies - EuroHPC"},{startTime:25,endTime:30,text:"Sustainability - EuroHPC"},{startTime:30,endTime:35,text:"Funding and Finance - EuroHPC"},{startTime:35,endTime:40,text:"Virtual HPC Academy - EuroHPC"},{startTime:40,endTime:45,text:"Wrapping up - EuroHPC"}],u=Hn.useMemo(()=>{var g,b,S,E;return{id:((g=r.data)==null?void 0:g.friendly_token)||"default-video",title:((b=r.data)==null?void 0:b.title)||"Video",poster:r.siteUrl+((S=r.data)==null?void 0:S.poster_url)||"",sources:(E=r.data)!=null&&E.original_media_url?[{src:r.siteUrl+r.data.original_media_url,type:"video/mp4"}]:[{src:"/videos/sample-video.mp4",type:"video/mp4"}]}},[r]),[c]=Hn.useState([{id:"Otbc37Yj4",title:"Amazing Ocean Depths",author:"Marine Explorer",views:"2.1M views",thumbnail:"https://picsum.photos/320/180?random=1",category:"nature"},{id:"Kt9m2Pv8x",title:"Deep Sea Creatures",author:"Aquatic Life",views:"854K views",thumbnail:"https://picsum.photos/320/180?random=2",category:"nature"},{id:"Ln5q8Bw3r",title:"Coral Reef Paradise",author:"Ocean Films",views:"1.7M views",thumbnail:"https://picsum.photos/320/180?random=3",category:"nature"},{id:"Mz4x7Cy9p",title:"Underwater Adventure",author:"Sea Documentaries",views:"3.2M views",thumbnail:"https://picsum.photos/320/180?random=4",category:"nature"},{id:"Nx8v2Fk6w",title:"Marine Wildlife",author:"Nature Plus",views:"967K views",thumbnail:"https://picsum.photos/320/180?random=5",category:"nature"},{id:"Py7t4Mn1q",title:"Ocean Mysteries",author:"Discovery Zone",views:"1.4M views",thumbnail:"https://picsum.photos/320/180?random=6",category:"nature"},{id:"Qw5e8Rt2n",title:"Whales and Dolphins",author:"Ocean Planet",views:"2.8M views",thumbnail:"https://picsum.photos/320/180?random=7",category:"nature"},{id:"Uv3k9Lp7m",title:"Tropical Fish Paradise",author:"Aquatic World",views:"1.2M views",thumbnail:"https://picsum.photos/320/180?random=8",category:"nature"},{id:"Zx6c4Mn8b",title:"Deep Ocean Exploration",author:"Marine Science",views:"3.7M views",thumbnail:"https://picsum.photos/320/180?random=9",category:"nature"}]),p=()=>{console.log("Next video functionality disabled for single video mode"),r.onClickNextCallback&&typeof r.onClickNextCallback=="function"&&r.onClickNextCallback()};return Hn.useEffect(()=>{if(s.current&&!e.current){if(s.current.player)return;const g=setTimeout(()=>{if(!e.current&&s.current&&!s.current.player){e.current=$(s.current,{controls:!0,autoplay:!0,loop:!1,muted:!1,poster:u.poster,preload:"auto",sources:u.sources,aspectRatio:"16:9",audioOnlyMode:!1,audioPosterMode:!1,autoSetup:void 0,breakpoints:{tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:2561},disablePictureInPicture:!1,enableDocumentPictureInPicture:!1,enableSmoothSeeking:!1,experimentalSvgIcons:!1,fluid:!0,fullscreen:{options:{navigationUI:"hide"}},id:void 0,inactivityTimeout:2e3,language:"en",languages:{},liveui:!1,liveTracker:{trackingThreshold:20,liveTolerance:15},nativeControlsForTouch:!1,normalizeAutoplay:!1,notSupportedMessage:void 0,noUITitleAttributes:!1,playbackRates:[.25,.5,.75,1,1.25,1.5,1.75,2],playsinline:!0,plugins:{},posterImage:!0,preferFullWindow:!1,responsive:!0,restoreEl:!1,suppressNotSupportedError:!1,techCanOverridePoster:!1,techOrder:["html5"],userActions:{click:!0,doubleClick:!0,hotkeys:{fullscreenKey:function(S){return S.which===70},muteKey:function(S){return S.which===77},playPauseKey:function(S){return S.which===75||S.which===32}}},"vtt.js":void 0,spatialNavigation:{enabled:!1,horizontalSeek:!1},controlBar:{progressControl:{seekBar:{timeTooltip:{displayNegative:!1}}},remainingTimeDisplay:!1,volumePanel:{inline:!0,vertical:!1},fullscreenToggle:!0,pictureInPictureToggle:!0,playbackRateMenuButton:!0,descriptionsButton:!0,subtitlesButton:!1,captionsButton:!1,audioTrackButton:!0,liveDisplay:!0,seekToLive:!0,customControlSpacer:!0,chaptersButton:!0},html5:{nativeControlsForTouch:!1,nativeAudioTracks:!0,nativeTextTracks:!0,nativeVideoTracks:!0,preloadTextTracks:!0},children:["mediaLoader","posterImage","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"]}),e.current.ready(()=>{i.current.applyToPlayer(e.current),i.current.setupAutoSave(e.current);const S=e.current.getChild("controlBar"),E=S.getChild("playToggle"),A=S.getChild("currentTimeDisplay"),M=S.getChild("progressControl"),U=M.getChild("seekBar"),D=S.getChild("chaptersButton"),z=S.getChild("fullscreenToggle");if(new URLSearchParams(window.location.search).get("m")&&setTimeout(()=>{e.current&&!e.current.isDisposed()&&e.current.play().catch(W=>{console.log("Autoplay was prevented:",W)})},100),[{kind:"subtitles",src:"/sample-subtitles.vtt",srclang:"en",label:"English Subtitles",default:!1},{kind:"subtitles",src:"/sample-subtitles-greek.vtt",srclang:"el",label:"Greek Subtitles (Ελληνικά)",default:!1}].forEach(W=>{e.current.addRemoteTextTrack(W,!1)}),setTimeout(()=>{i.current.applySubtitlePreference(e.current)},1e3),o&&o.length>0){const W=e.current.addTextTrack("chapters","Chapters","en");o.forEach(G=>{const ee=new(window.VTTCue||window.TextTrackCue)(G.startTime,G.endTime,G.text);W.addCue(ee)})}const Q=new Uy(e.current,{displayNegative:!1,customPrefix:"",customSuffix:""});if(A){const W=S.children().indexOf(A);S.addChild(Q,{},W+1)}else S.addChild(Q,{},2);if(r.hasNextLink){const W=new Px(e.current),G=S.children().indexOf(E);S.addChild(W,{},G+1)}if(setTimeout(()=>{(()=>{["chaptersButton","subtitlesButton","playbackRateMenuButton"].forEach(ee=>{const oe=S.getChild(ee);if(oe&&oe.menuButton_){const _e=oe.menuButton_;_e.off("mouseenter"),_e.off("mouseleave"),_e.on("click",function(){this.menu.hasClass("vjs-lock-showing")?(this.menu.removeClass("vjs-lock-showing"),this.menu.hide()):(this.menu.addClass("vjs-lock-showing"),this.menu.show())}),console.log(`✓ Made ${ee} clickable`)}else if(oe){const _e=oe.el();_e&&(_e.addEventListener("click",function(fe){fe.preventDefault(),fe.stopPropagation();const xe=_e.querySelector(".vjs-menu");xe&&(xe.style.display==="block"?xe.style.display="none":(document.querySelectorAll(".vjs-menu").forEach(ve=>{ve!==xe&&(ve.style.display="none")}),xe.style.display="block"))}),console.log(`✓ Added click handler to ${ee}`))}})})()},1500),M&&U){const W=new Nx(e.current);U.addChild(W)}if(D&&z)try{const W=S.children().indexOf(z);S.addChild(D,{},W+1),console.log("✓ Chapters button moved after fullscreen toggle")}catch(W){console.log("✗ Failed to move chapters button:",W)}const Z={};o&&o.length>0?(Z.chaptersOverlay=new By(e.current,{chaptersData:o}),console.log("✓ Custom chapters overlay component created")):console.log("⚠ No chapters data available for overlay"),Z.settingsMenu=new Fy(e.current,{userPreferences:i.current}),console.log("✓ Custom settings menu component created"),console.log("Custom components initialized:",Object.keys(Z)),console.log("Current user preferences:",i.current.getPreferences()),window.debugSubtitles={showTracks:()=>{const W=e.current.textTracks();console.log("=== Available Text Tracks ===");for(let G=0;G{const W=e.current.textTracks();for(let G=0;G{const W=e.current.textTracks();for(let G=0;G{const W=e.current.textTracks();for(let G=0;G{console.log("Saved preferences:",i.current.getPreferences())},reapplyPrefs:()=>{i.current.applySubtitlePreference(e.current)},showMenu:()=>{const W=e.current.getChild("controlBar"),G=["subtitlesButton","captionsButton","subsCapsButton"];let ee=null;for(const oe of G){const _e=W.getChild(oe);if(_e){console.log(`Found subtitle button: ${oe}`),ee=_e;break}}if(ee&&ee.menu)console.log("=== Subtitle Menu Items ==="),ee.menu.children_.forEach((oe,_e)=>{oe.track?console.log(`${_e}: ${oe.track.label} (${oe.track.language}) - selected: ${oe.selected()}`):console.log(`${_e}: ${oe.label||"Unknown"} - selected: ${oe.selected()}`)});else{console.log("No subtitle menu found, checking DOM...");const oe=e.current.el().querySelectorAll(".vjs-menu-item");console.log(`Found ${oe.length} menu items in DOM`),oe.forEach((_e,fe)=>{(_e.textContent.toLowerCase().includes("subtitle")||_e.textContent.toLowerCase().includes("caption")||_e.textContent.toLowerCase().includes("off"))&&console.log(`DOM item ${fe}: ${_e.textContent} - classes: ${_e.className}`)})}},testMenuClick:W=>{const G=e.current.getChild("controlBar"),ee=["subtitlesButton","captionsButton","subsCapsButton"];let oe=null;for(const _e of ee){const fe=G.getChild(_e);if(fe){oe=fe;break}}if(oe&&oe.menu&&oe.menu.children_[W]){const _e=oe.menu.children_[W];console.log("Simulating click on menu item:",W),_e.handleClick()}else{console.log("Menu item not found at index:",W,"trying DOM approach...");const _e=e.current.el().querySelectorAll(".vjs-menu-item"),fe=Array.from(_e).filter(xe=>xe.textContent.toLowerCase().includes("subtitle")||xe.textContent.toLowerCase().includes("caption")||xe.textContent.toLowerCase().includes("off"));fe[W]?(console.log("Clicking DOM element:",fe[W].textContent),fe[W].click()):console.log("No DOM subtitle item found at index:",W)}},forceEnableEnglish:()=>{console.log("Force enabling English subtitles...");const W=e.current.textTracks();for(let G=0;G{console.log("👀 Watching subtitle preference changes...");const W=i.current.setPreference;i.current.setPreference=function(G,ee){return G==="subtitleLanguage"&&(console.log(`🎯 SUBTITLE CHANGE: ${ee} at ${new Date().toISOString()}`),console.trace("Change origin:")),W.call(this,G,ee)},console.log("Subtitle change monitoring activated")},checkRestorationFlag:()=>{console.log("Restoration flag:",i.current.isRestoringSubtitles),console.log("Auto-save disabled:",i.current.subtitleAutoSaveDisabled)},forceSaveGreek:()=>{console.log("🚀 Force saving Greek subtitle preference..."),i.current.forceSetSubtitleLanguage("el"),console.log("Check result:",i.current.getPreferences())},forceSaveEnglish:()=>{console.log("🚀 Force saving English subtitle preference..."),i.current.forceSetSubtitleLanguage("en"),console.log("Check result:",i.current.getPreferences())},forceSaveNull:()=>{console.log("🚀 Force saving null subtitle preference..."),i.current.forceSetSubtitleLanguage(null),console.log("Check result:",i.current.getPreferences())}}}),e.current.on("nextVideo",()=>{console.log("Next video requested"),p()}),e.current.on("play",()=>{console.log("Video started playing")}),e.current.on("pause",()=>{console.log("Video paused")});let b=null;e.current.on("ended",()=>{console.log("Video ended"),console.log("Available relatedVideos:",c),setTimeout(()=>{if(e.current&&!e.current.isDisposed()&&e.current.el()){const E=e.current.getChild("controlBar");E&&(E.show(),E.el().style.opacity="1",E.el().style.pointerEvents="auto")}},50),b&&(console.log("End screen already exists, removing previous one"),e.current.removeChild(b),b=null),b=new Ix(e.current,{relatedVideos:c}),b.relatedVideos=c,e.current.addChild(b),b.show()}),e.current.on("play",()=>{b&&b.hide()}),e.current.on("seeking",()=>{b&&b.hide()}),e.current.on("replay",()=>{b&&b.hide(),e.current.currentTime(0),e.current.play()}),e.current.on("error",S=>{console.error("Video.js error:",S)}),e.current.on("fullscreenchange",()=>{console.log("Fullscreen changed:",e.current.isFullscreen())}),e.current.on("volumechange",()=>{console.log("Volume changed:",e.current.volume(),"Muted:",e.current.muted())}),e.current.on("ratechange",()=>{console.log("Playback rate changed:",e.current.playbackRate())}),e.current.on("texttrackchange",()=>{console.log("Text track changed");const S=e.current.textTracks();for(let E=0;E{e.current.el()&&(e.current.el().focus(),console.log("Video player focused for keyboard controls")),e.current.autoplay()&&e.current.play().catch(S=>{console.log("Autoplay prevented by browser:",S)})})}},0);return()=>{clearTimeout(g)}}return()=>{e.current&&!e.current.isDisposed()&&(e.current.dispose(),e.current=null)}},[]),Hn.useEffect(()=>{const g=()=>{e.current&&e.current.el()&&(e.current.el().focus(),console.log("Video element focused for keyboard controls"))},b=()=>{document.hidden||setTimeout(g,100)},S=()=>{setTimeout(g,100)};return document.addEventListener("visibilitychange",b),window.addEventListener("focus",S),setTimeout(g,500),()=>{document.removeEventListener("visibilitychange",b),window.removeEventListener("focus",S)}},[]),Rf.jsx("video",{ref:s,className:"video-js vjs-default-skin",tabIndex:"0"})}function HL(){return Rf.jsx(FL,{})}const Bx=()=>{const s=document.getElementById("video-js-root");s&&Rw.createRoot(s).render(Rf.jsx(Hn.StrictMode,{children:Rf.jsx(HL,{})}))};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Bx):Bx()})(); + `,this.settingsOverlay.appendChild(this.speedSubmenu)}positionButton(){const e=this.player().getChild("controlBar"),i=e.getChild("fullscreenToggle");this.settingsButton&&i&&setTimeout(()=>{const r=e.children().indexOf(i);e.removeChild(this.settingsButton),e.addChild(this.settingsButton,{},r+1),console.log("✓ Settings button positioned after fullscreen toggle")},50)}setupEventListeners(){this.settingsOverlay.addEventListener("click",e=>{e.stopPropagation(),e.target.closest('[data-setting="playback-speed"]')&&(this.speedSubmenu.style.display="flex")}),this.speedSubmenu.querySelector(".submenu-header").addEventListener("click",()=>{this.speedSubmenu.style.display="none"}),this.speedSubmenu.addEventListener("click",e=>{const i=e.target.closest(".speed-option");if(i){const r=parseFloat(i.dataset.speed);this.handleSpeedChange(r,i)}}),document.addEventListener("click",this.handleClickOutside),this.settingsOverlay.addEventListener("mouseover",e=>{const i=e.target.closest(".settings-item, .speed-option");i&&!i.style.background.includes("0.1")&&(i.style.background="rgba(255, 255, 255, 0.05)")}),this.settingsOverlay.addEventListener("mouseout",e=>{const i=e.target.closest(".settings-item, .speed-option");i&&!i.style.background.includes("0.1")&&(i.style.background="transparent")})}toggleSettings(e){e.stopPropagation();const i=this.settingsOverlay.style.display==="block";this.settingsOverlay.style.display=i?"none":"block",this.speedSubmenu.style.display="none"}handleSpeedChange(e,i){this.player().playbackRate(e),this.userPreferences.setPreference("playbackRate",e),document.querySelectorAll(".speed-option").forEach(u=>{var c;u.classList.remove("active"),u.style.background="transparent",(c=u.querySelector("span:last-child"))==null||c.remove()}),i.classList.add("active"),i.style.background="rgba(255, 255, 255, 0.1)",i.insertAdjacentHTML("beforeend","");const r=this.settingsOverlay.querySelector(".current-speed"),o=e===1?"Normal":`${e}`;r.textContent=o,this.settingsOverlay.style.display="none",this.speedSubmenu.style.display="none",console.log("Playback speed preference saved:",e)}handleClickOutside(e){this.settingsOverlay&&this.settingsButton&&!this.settingsOverlay.contains(e.target)&&!this.settingsButton.el().contains(e.target)&&(this.settingsOverlay.style.display="none",this.speedSubmenu.style.display="none")}dispose(){document.removeEventListener("click",this.handleClickOutside),this.settingsOverlay&&this.settingsOverlay.remove(),super.dispose()}}Fy.prototype.controlText_="Settings Menu",V.registerComponent("CustomSettingsMenu",Fy);function FL(){const s=Hn.useRef(null),e=Hn.useRef(null),i=Hn.useRef(new Ux),r=Hn.useMemo(()=>typeof window<"u"&&window.MEDIA_DATA?window.MEDIA_DATA:{data:{},previewSprite:{url:"https://demo.mediacms.io/media/original/thumbnails/user/markos/fe4933d67b884d4da507dd60e77f7438.VID_20200909_141053.mp4sprites.jpg",frame:{width:160,height:90,seconds:10}},siteUrl:"",hasNextLink:!0},[]),o=[{startTime:0,endTime:5,text:"Start111"},{startTime:5,endTime:10,text:"Introduction - EuroHPC"},{startTime:10,endTime:15,text:"Planning - EuroHPC"},{startTime:15,endTime:20,text:"Parcel Discounts - EuroHPC"},{startTime:20,endTime:25,text:"Class Studies - EuroHPC"},{startTime:25,endTime:30,text:"Sustainability - EuroHPC"},{startTime:30,endTime:35,text:"Funding and Finance - EuroHPC"},{startTime:35,endTime:40,text:"Virtual HPC Academy - EuroHPC"},{startTime:40,endTime:45,text:"Wrapping up - EuroHPC"}],u=Hn.useMemo(()=>{var g,b,S,E;return{id:((g=r.data)==null?void 0:g.friendly_token)||"default-video",title:((b=r.data)==null?void 0:b.title)||"Video",poster:r.siteUrl+((S=r.data)==null?void 0:S.poster_url)||"",previewSprite:(r==null?void 0:r.previewSprite)||{url:"https://demo.mediacms.io/media/original/thumbnails/user/markos/fe4933d67b884d4da507dd60e77f7438.VID_20200909_141053.mp4sprites.jpg",frame:{width:160,height:90,seconds:10}},sources:(E=r.data)!=null&&E.original_media_url?[{src:r.siteUrl+r.data.original_media_url,type:"video/mp4"}]:[{src:"/videos/sample-video.mp4",type:"video/mp4"}]}},[r]),[c]=Hn.useState([{id:"Otbc37Yj4",title:"Amazing Ocean Depths",author:"Marine Explorer",views:"2.1M views",thumbnail:"https://picsum.photos/320/180?random=1",category:"nature"},{id:"Kt9m2Pv8x",title:"Deep Sea Creatures",author:"Aquatic Life",views:"854K views",thumbnail:"https://picsum.photos/320/180?random=2",category:"nature"},{id:"Ln5q8Bw3r",title:"Coral Reef Paradise",author:"Ocean Films",views:"1.7M views",thumbnail:"https://picsum.photos/320/180?random=3",category:"nature"},{id:"Mz4x7Cy9p",title:"Underwater Adventure",author:"Sea Documentaries",views:"3.2M views",thumbnail:"https://picsum.photos/320/180?random=4",category:"nature"},{id:"Nx8v2Fk6w",title:"Marine Wildlife",author:"Nature Plus",views:"967K views",thumbnail:"https://picsum.photos/320/180?random=5",category:"nature"},{id:"Py7t4Mn1q",title:"Ocean Mysteries",author:"Discovery Zone",views:"1.4M views",thumbnail:"https://picsum.photos/320/180?random=6",category:"nature"},{id:"Qw5e8Rt2n",title:"Whales and Dolphins",author:"Ocean Planet",views:"2.8M views",thumbnail:"https://picsum.photos/320/180?random=7",category:"nature"},{id:"Uv3k9Lp7m",title:"Tropical Fish Paradise",author:"Aquatic World",views:"1.2M views",thumbnail:"https://picsum.photos/320/180?random=8",category:"nature"},{id:"Zx6c4Mn8b",title:"Deep Ocean Exploration",author:"Marine Science",views:"3.7M views",thumbnail:"https://picsum.photos/320/180?random=9",category:"nature"}]),p=()=>{console.log("Next video functionality disabled for single video mode"),r.onClickNextCallback&&typeof r.onClickNextCallback=="function"&&r.onClickNextCallback()};return Hn.useEffect(()=>{if(s.current&&!e.current){if(s.current.player)return;const g=setTimeout(()=>{if(!e.current&&s.current&&!s.current.player){e.current=V(s.current,{controls:!0,autoplay:!0,loop:!1,muted:!1,poster:u.poster,preload:"auto",sources:u.sources,aspectRatio:"16:9",audioOnlyMode:!1,audioPosterMode:!1,autoSetup:void 0,breakpoints:{tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:2561},disablePictureInPicture:!1,enableDocumentPictureInPicture:!1,enableSmoothSeeking:!1,experimentalSvgIcons:!1,fluid:!0,fullscreen:{options:{navigationUI:"hide"}},id:void 0,inactivityTimeout:2e3,language:"en",languages:{},liveui:!1,liveTracker:{trackingThreshold:20,liveTolerance:15},nativeControlsForTouch:!1,normalizeAutoplay:!1,notSupportedMessage:void 0,noUITitleAttributes:!1,playbackRates:[.25,.5,.75,1,1.25,1.5,1.75,2],playsinline:!0,plugins:{},posterImage:!0,preferFullWindow:!1,responsive:!0,restoreEl:!1,suppressNotSupportedError:!1,techCanOverridePoster:!1,techOrder:["html5"],userActions:{click:!0,doubleClick:!0,hotkeys:{fullscreenKey:function(S){return S.which===70},muteKey:function(S){return S.which===77},playPauseKey:function(S){return S.which===75||S.which===32}}},"vtt.js":void 0,spatialNavigation:{enabled:!1,horizontalSeek:!1},controlBar:{progressControl:{seekBar:{timeTooltip:{displayNegative:!1}}},remainingTimeDisplay:!1,volumePanel:{inline:!0,vertical:!1},fullscreenToggle:!0,pictureInPictureToggle:!0,playbackRateMenuButton:!0,descriptionsButton:!0,subtitlesButton:!1,captionsButton:!1,audioTrackButton:!0,liveDisplay:!0,seekToLive:!0,customControlSpacer:!0,chaptersButton:!0},html5:{nativeControlsForTouch:!1,nativeAudioTracks:!0,nativeTextTracks:!0,nativeVideoTracks:!0,preloadTextTracks:!0},children:["mediaLoader","posterImage","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"]}),e.current.ready(()=>{i.current.applyToPlayer(e.current),i.current.setupAutoSave(e.current);const S=e.current.getChild("controlBar"),E=S.getChild("playToggle"),A=S.getChild("currentTimeDisplay"),M=S.getChild("progressControl"),U=M.getChild("seekBar"),D=S.getChild("chaptersButton"),z=S.getChild("fullscreenToggle");if(new URLSearchParams(window.location.search).get("m")&&setTimeout(()=>{e.current&&!e.current.isDisposed()&&e.current.play().catch(W=>{console.log("Autoplay was prevented:",W)})},100),[{kind:"subtitles",src:"/sample-subtitles.vtt",srclang:"en",label:"English Subtitles",default:!1},{kind:"subtitles",src:"/sample-subtitles-greek.vtt",srclang:"el",label:"Greek Subtitles (Ελληνικά)",default:!1}].forEach(W=>{e.current.addRemoteTextTrack(W,!1)}),setTimeout(()=>{i.current.applySubtitlePreference(e.current)},1e3),o&&o.length>0){const W=e.current.addTextTrack("chapters","Chapters","en");o.forEach(G=>{const ee=new(window.VTTCue||window.TextTrackCue)(G.startTime,G.endTime,G.text);W.addCue(ee)})}const Q=new Uy(e.current,{displayNegative:!1,customPrefix:"",customSuffix:""});if(A){const W=S.children().indexOf(A);S.addChild(Q,{},W+1)}else S.addChild(Q,{},2);if(r.hasNextLink){const W=new Px(e.current),G=S.children().indexOf(E);S.addChild(W,{},G+1)}if(setTimeout(()=>{(()=>{["chaptersButton","subtitlesButton","playbackRateMenuButton"].forEach(ee=>{const oe=S.getChild(ee);if(oe&&oe.menuButton_){const _e=oe.menuButton_;_e.off("mouseenter"),_e.off("mouseleave"),_e.on("click",function(){this.menu.hasClass("vjs-lock-showing")?(this.menu.removeClass("vjs-lock-showing"),this.menu.hide()):(this.menu.addClass("vjs-lock-showing"),this.menu.show())}),console.log(`✓ Made ${ee} clickable`)}else if(oe){const _e=oe.el();_e&&(_e.addEventListener("click",function(fe){fe.preventDefault(),fe.stopPropagation();const xe=_e.querySelector(".vjs-menu");xe&&(xe.style.display==="block"?xe.style.display="none":(document.querySelectorAll(".vjs-menu").forEach(ve=>{ve!==xe&&(ve.style.display="none")}),xe.style.display="block"))}),console.log(`✓ Added click handler to ${ee}`))}})})()},1500),M&&U){const W=new Nx(e.current,{previewSprite:r.previewSprite});U.addChild(W)}if(D&&z)try{const W=S.children().indexOf(z);S.addChild(D,{},W+1),console.log("✓ Chapters button moved after fullscreen toggle")}catch(W){console.log("✗ Failed to move chapters button:",W)}const Z={};o&&o.length>0?(Z.chaptersOverlay=new By(e.current,{chaptersData:o}),console.log("✓ Custom chapters overlay component created")):console.log("⚠ No chapters data available for overlay"),Z.settingsMenu=new Fy(e.current,{userPreferences:i.current}),console.log("✓ Custom settings menu component created"),console.log("Custom components initialized:",Object.keys(Z)),console.log("Current user preferences:",i.current.getPreferences()),window.debugSubtitles={showTracks:()=>{const W=e.current.textTracks();console.log("=== Available Text Tracks ===");for(let G=0;G{const W=e.current.textTracks();for(let G=0;G{const W=e.current.textTracks();for(let G=0;G{const W=e.current.textTracks();for(let G=0;G{console.log("Saved preferences:",i.current.getPreferences())},reapplyPrefs:()=>{i.current.applySubtitlePreference(e.current)},showMenu:()=>{const W=e.current.getChild("controlBar"),G=["subtitlesButton","captionsButton","subsCapsButton"];let ee=null;for(const oe of G){const _e=W.getChild(oe);if(_e){console.log(`Found subtitle button: ${oe}`),ee=_e;break}}if(ee&&ee.menu)console.log("=== Subtitle Menu Items ==="),ee.menu.children_.forEach((oe,_e)=>{oe.track?console.log(`${_e}: ${oe.track.label} (${oe.track.language}) - selected: ${oe.selected()}`):console.log(`${_e}: ${oe.label||"Unknown"} - selected: ${oe.selected()}`)});else{console.log("No subtitle menu found, checking DOM...");const oe=e.current.el().querySelectorAll(".vjs-menu-item");console.log(`Found ${oe.length} menu items in DOM`),oe.forEach((_e,fe)=>{(_e.textContent.toLowerCase().includes("subtitle")||_e.textContent.toLowerCase().includes("caption")||_e.textContent.toLowerCase().includes("off"))&&console.log(`DOM item ${fe}: ${_e.textContent} - classes: ${_e.className}`)})}},testMenuClick:W=>{const G=e.current.getChild("controlBar"),ee=["subtitlesButton","captionsButton","subsCapsButton"];let oe=null;for(const _e of ee){const fe=G.getChild(_e);if(fe){oe=fe;break}}if(oe&&oe.menu&&oe.menu.children_[W]){const _e=oe.menu.children_[W];console.log("Simulating click on menu item:",W),_e.handleClick()}else{console.log("Menu item not found at index:",W,"trying DOM approach...");const _e=e.current.el().querySelectorAll(".vjs-menu-item"),fe=Array.from(_e).filter(xe=>xe.textContent.toLowerCase().includes("subtitle")||xe.textContent.toLowerCase().includes("caption")||xe.textContent.toLowerCase().includes("off"));fe[W]?(console.log("Clicking DOM element:",fe[W].textContent),fe[W].click()):console.log("No DOM subtitle item found at index:",W)}},forceEnableEnglish:()=>{console.log("Force enabling English subtitles...");const W=e.current.textTracks();for(let G=0;G{console.log("👀 Watching subtitle preference changes...");const W=i.current.setPreference;i.current.setPreference=function(G,ee){return G==="subtitleLanguage"&&(console.log(`🎯 SUBTITLE CHANGE: ${ee} at ${new Date().toISOString()}`),console.trace("Change origin:")),W.call(this,G,ee)},console.log("Subtitle change monitoring activated")},checkRestorationFlag:()=>{console.log("Restoration flag:",i.current.isRestoringSubtitles),console.log("Auto-save disabled:",i.current.subtitleAutoSaveDisabled)},forceSaveGreek:()=>{console.log("🚀 Force saving Greek subtitle preference..."),i.current.forceSetSubtitleLanguage("el"),console.log("Check result:",i.current.getPreferences())},forceSaveEnglish:()=>{console.log("🚀 Force saving English subtitle preference..."),i.current.forceSetSubtitleLanguage("en"),console.log("Check result:",i.current.getPreferences())},forceSaveNull:()=>{console.log("🚀 Force saving null subtitle preference..."),i.current.forceSetSubtitleLanguage(null),console.log("Check result:",i.current.getPreferences())}}}),e.current.on("nextVideo",()=>{console.log("Next video requested"),p()}),e.current.on("play",()=>{console.log("Video started playing")}),e.current.on("pause",()=>{console.log("Video paused")});let b=null;e.current.on("ended",()=>{console.log("Video ended"),console.log("Available relatedVideos:",c),setTimeout(()=>{if(e.current&&!e.current.isDisposed()&&e.current.el()){const E=e.current.getChild("controlBar");E&&(E.show(),E.el().style.opacity="1",E.el().style.pointerEvents="auto")}},50),b&&(console.log("End screen already exists, removing previous one"),e.current.removeChild(b),b=null),b=new Ix(e.current,{relatedVideos:c}),b.relatedVideos=c,e.current.addChild(b),b.show()}),e.current.on("play",()=>{b&&b.hide()}),e.current.on("seeking",()=>{b&&b.hide()}),e.current.on("replay",()=>{b&&b.hide(),e.current.currentTime(0),e.current.play()}),e.current.on("error",S=>{console.error("Video.js error:",S)}),e.current.on("fullscreenchange",()=>{console.log("Fullscreen changed:",e.current.isFullscreen())}),e.current.on("volumechange",()=>{console.log("Volume changed:",e.current.volume(),"Muted:",e.current.muted())}),e.current.on("ratechange",()=>{console.log("Playback rate changed:",e.current.playbackRate())}),e.current.on("texttrackchange",()=>{console.log("Text track changed");const S=e.current.textTracks();for(let E=0;E{e.current.el()&&(e.current.el().focus(),console.log("Video player focused for keyboard controls")),e.current.autoplay()&&e.current.play().catch(S=>{console.log("Autoplay prevented by browser:",S)})})}},0);return()=>{clearTimeout(g)}}return()=>{e.current&&!e.current.isDisposed()&&(e.current.dispose(),e.current=null)}},[]),Hn.useEffect(()=>{const g=()=>{e.current&&e.current.el()&&(e.current.el().focus(),console.log("Video element focused for keyboard controls"))},b=()=>{document.hidden||setTimeout(g,100)},S=()=>{setTimeout(g,100)};return document.addEventListener("visibilitychange",b),window.addEventListener("focus",S),setTimeout(g,500),()=>{document.removeEventListener("visibilitychange",b),window.removeEventListener("focus",S)}},[]),Rf.jsx("video",{ref:s,className:"video-js vjs-default-skin",tabIndex:"0"})}function HL(){return Rf.jsx(FL,{})}const Bx=()=>{const s=document.getElementById("video-js-root");s&&Rw.createRoot(s).render(Rf.jsx(Hn.StrictMode,{children:Rf.jsx(HL,{})}))};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Bx):Bx()})(); //# sourceMappingURL=video-js.js.map diff --git a/static/video_js/video-js.js.map b/static/video_js/video-js.js.map index 8d75bca8..8c3aabad 100644 --- a/static/video_js/video-js.js.map +++ b/static/video_js/video-js.js.map @@ -1 +1 @@ -{"version":3,"file":"video-js.js","sources":["../../frontend-tools/video-js/node_modules/react/cjs/react.development.js","../../frontend-tools/video-js/node_modules/react/index.js","../../frontend-tools/video-js/node_modules/react/cjs/react-jsx-runtime.development.js","../../frontend-tools/video-js/node_modules/react/jsx-runtime.js","../../frontend-tools/video-js/node_modules/scheduler/cjs/scheduler.development.js","../../frontend-tools/video-js/node_modules/scheduler/index.js","../../frontend-tools/video-js/node_modules/react-dom/cjs/react-dom.development.js","../../frontend-tools/video-js/node_modules/react-dom/index.js","../../frontend-tools/video-js/node_modules/react-dom/cjs/react-dom-client.development.js","../../frontend-tools/video-js/node_modules/react-dom/client.js","../../frontend-tools/video-js/node_modules/global/window.js","../../frontend-tools/video-js/__vite-browser-external","../../frontend-tools/video-js/node_modules/global/document.js","../../frontend-tools/video-js/node_modules/@babel/runtime/helpers/esm/extends.js","../../frontend-tools/video-js/node_modules/is-function/index.js","../../frontend-tools/video-js/node_modules/@videojs/xhr/lib/interceptors.js","../../frontend-tools/video-js/node_modules/@videojs/xhr/lib/retry.js","../../frontend-tools/video-js/node_modules/@videojs/xhr/lib/http-handler.js","../../frontend-tools/video-js/node_modules/@videojs/xhr/lib/index.js","../../frontend-tools/video-js/node_modules/videojs-vtt.js/lib/vtt.js","../../frontend-tools/video-js/node_modules/videojs-vtt.js/lib/vttcue.js","../../frontend-tools/video-js/node_modules/videojs-vtt.js/lib/vttregion.js","../../frontend-tools/video-js/node_modules/videojs-vtt.js/lib/browser-index.js","../../frontend-tools/video-js/node_modules/@videojs/vhs-utils/es/resolve-url.js","../../frontend-tools/video-js/node_modules/@videojs/vhs-utils/es/stream.js","../../frontend-tools/video-js/node_modules/@videojs/vhs-utils/es/decode-b64-to-uint8-array.js","../../frontend-tools/video-js/node_modules/m3u8-parser/dist/m3u8-parser.es.js","../../frontend-tools/video-js/node_modules/@videojs/vhs-utils/es/codecs.js","../../frontend-tools/video-js/node_modules/@videojs/vhs-utils/es/media-types.js","../../frontend-tools/video-js/node_modules/@videojs/vhs-utils/es/byte-helpers.js","../../frontend-tools/video-js/node_modules/@videojs/vhs-utils/es/media-groups.js","../../frontend-tools/video-js/node_modules/@xmldom/xmldom/lib/conventions.js","../../frontend-tools/video-js/node_modules/@xmldom/xmldom/lib/dom.js","../../frontend-tools/video-js/node_modules/@xmldom/xmldom/lib/entities.js","../../frontend-tools/video-js/node_modules/@xmldom/xmldom/lib/sax.js","../../frontend-tools/video-js/node_modules/@xmldom/xmldom/lib/dom-parser.js","../../frontend-tools/video-js/node_modules/@xmldom/xmldom/lib/index.js","../../frontend-tools/video-js/node_modules/mpd-parser/dist/mpd-parser.es.js","../../frontend-tools/video-js/node_modules/mux.js/lib/utils/numbers.js","../../frontend-tools/video-js/node_modules/mux.js/lib/tools/parse-sidx.js","../../frontend-tools/video-js/node_modules/@videojs/vhs-utils/es/id3-helpers.js","../../frontend-tools/video-js/node_modules/@videojs/vhs-utils/es/mp4-helpers.js","../../frontend-tools/video-js/node_modules/@videojs/vhs-utils/es/ebml-helpers.js","../../frontend-tools/video-js/node_modules/@videojs/vhs-utils/es/nal-helpers.js","../../frontend-tools/video-js/node_modules/@videojs/vhs-utils/es/containers.js","../../frontend-tools/video-js/node_modules/mux.js/lib/utils/clock.js","../../frontend-tools/video-js/node_modules/video.js/dist/video.es.js","../../frontend-tools/video-js/src/components/overlays/EndScreenOverlay.js","../../frontend-tools/video-js/src/components/markers/ChapterMarkers.js","../../frontend-tools/video-js/src/components/controls/NextVideoButton.js","../../frontend-tools/video-js/src/components/controls/CustomRemainingTime.js","../../frontend-tools/video-js/src/components/controls/CustomChaptersOverlay.js","../../frontend-tools/video-js/src/utils/UserPreferences.js","../../frontend-tools/video-js/src/components/controls/CustomSettingsMenu.js","../../frontend-tools/video-js/src/components/video-player/VideoJSPlayer.jsx","../../frontend-tools/video-js/src/VideoJS.jsx","../../frontend-tools/video-js/src/main.jsx"],"sourcesContent":["/**\n * @license React\n * react.development.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\"use strict\";\n\"production\" !== process.env.NODE_ENV &&\n (function () {\n function defineDeprecationWarning(methodName, info) {\n Object.defineProperty(Component.prototype, methodName, {\n get: function () {\n console.warn(\n \"%s(...) is deprecated in plain JavaScript React classes. %s\",\n info[0],\n info[1]\n );\n }\n });\n }\n function getIteratorFn(maybeIterable) {\n if (null === maybeIterable || \"object\" !== typeof maybeIterable)\n return null;\n maybeIterable =\n (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) ||\n maybeIterable[\"@@iterator\"];\n return \"function\" === typeof maybeIterable ? maybeIterable : null;\n }\n function warnNoop(publicInstance, callerName) {\n publicInstance =\n ((publicInstance = publicInstance.constructor) &&\n (publicInstance.displayName || publicInstance.name)) ||\n \"ReactClass\";\n var warningKey = publicInstance + \".\" + callerName;\n didWarnStateUpdateForUnmountedComponent[warningKey] ||\n (console.error(\n \"Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.\",\n callerName,\n publicInstance\n ),\n (didWarnStateUpdateForUnmountedComponent[warningKey] = !0));\n }\n function Component(props, context, updater) {\n this.props = props;\n this.context = context;\n this.refs = emptyObject;\n this.updater = updater || ReactNoopUpdateQueue;\n }\n function ComponentDummy() {}\n function PureComponent(props, context, updater) {\n this.props = props;\n this.context = context;\n this.refs = emptyObject;\n this.updater = updater || ReactNoopUpdateQueue;\n }\n function testStringCoercion(value) {\n return \"\" + value;\n }\n function checkKeyStringCoercion(value) {\n try {\n testStringCoercion(value);\n var JSCompiler_inline_result = !1;\n } catch (e) {\n JSCompiler_inline_result = !0;\n }\n if (JSCompiler_inline_result) {\n JSCompiler_inline_result = console;\n var JSCompiler_temp_const = JSCompiler_inline_result.error;\n var JSCompiler_inline_result$jscomp$0 =\n (\"function\" === typeof Symbol &&\n Symbol.toStringTag &&\n value[Symbol.toStringTag]) ||\n value.constructor.name ||\n \"Object\";\n JSCompiler_temp_const.call(\n JSCompiler_inline_result,\n \"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.\",\n JSCompiler_inline_result$jscomp$0\n );\n return testStringCoercion(value);\n }\n }\n function getComponentNameFromType(type) {\n if (null == type) return null;\n if (\"function\" === typeof type)\n return type.$$typeof === REACT_CLIENT_REFERENCE\n ? null\n : type.displayName || type.name || null;\n if (\"string\" === typeof type) return type;\n switch (type) {\n case REACT_FRAGMENT_TYPE:\n return \"Fragment\";\n case REACT_PROFILER_TYPE:\n return \"Profiler\";\n case REACT_STRICT_MODE_TYPE:\n return \"StrictMode\";\n case REACT_SUSPENSE_TYPE:\n return \"Suspense\";\n case REACT_SUSPENSE_LIST_TYPE:\n return \"SuspenseList\";\n case REACT_ACTIVITY_TYPE:\n return \"Activity\";\n }\n if (\"object\" === typeof type)\n switch (\n (\"number\" === typeof type.tag &&\n console.error(\n \"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.\"\n ),\n type.$$typeof)\n ) {\n case REACT_PORTAL_TYPE:\n return \"Portal\";\n case REACT_CONTEXT_TYPE:\n return (type.displayName || \"Context\") + \".Provider\";\n case REACT_CONSUMER_TYPE:\n return (type._context.displayName || \"Context\") + \".Consumer\";\n case REACT_FORWARD_REF_TYPE:\n var innerType = type.render;\n type = type.displayName;\n type ||\n ((type = innerType.displayName || innerType.name || \"\"),\n (type = \"\" !== type ? \"ForwardRef(\" + type + \")\" : \"ForwardRef\"));\n return type;\n case REACT_MEMO_TYPE:\n return (\n (innerType = type.displayName || null),\n null !== innerType\n ? innerType\n : getComponentNameFromType(type.type) || \"Memo\"\n );\n case REACT_LAZY_TYPE:\n innerType = type._payload;\n type = type._init;\n try {\n return getComponentNameFromType(type(innerType));\n } catch (x) {}\n }\n return null;\n }\n function getTaskName(type) {\n if (type === REACT_FRAGMENT_TYPE) return \"<>\";\n if (\n \"object\" === typeof type &&\n null !== type &&\n type.$$typeof === REACT_LAZY_TYPE\n )\n return \"<...>\";\n try {\n var name = getComponentNameFromType(type);\n return name ? \"<\" + name + \">\" : \"<...>\";\n } catch (x) {\n return \"<...>\";\n }\n }\n function getOwner() {\n var dispatcher = ReactSharedInternals.A;\n return null === dispatcher ? null : dispatcher.getOwner();\n }\n function UnknownOwner() {\n return Error(\"react-stack-top-frame\");\n }\n function hasValidKey(config) {\n if (hasOwnProperty.call(config, \"key\")) {\n var getter = Object.getOwnPropertyDescriptor(config, \"key\").get;\n if (getter && getter.isReactWarning) return !1;\n }\n return void 0 !== config.key;\n }\n function defineKeyPropWarningGetter(props, displayName) {\n function warnAboutAccessingKey() {\n specialPropKeyWarningShown ||\n ((specialPropKeyWarningShown = !0),\n console.error(\n \"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)\",\n displayName\n ));\n }\n warnAboutAccessingKey.isReactWarning = !0;\n Object.defineProperty(props, \"key\", {\n get: warnAboutAccessingKey,\n configurable: !0\n });\n }\n function elementRefGetterWithDeprecationWarning() {\n var componentName = getComponentNameFromType(this.type);\n didWarnAboutElementRef[componentName] ||\n ((didWarnAboutElementRef[componentName] = !0),\n console.error(\n \"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.\"\n ));\n componentName = this.props.ref;\n return void 0 !== componentName ? componentName : null;\n }\n function ReactElement(\n type,\n key,\n self,\n source,\n owner,\n props,\n debugStack,\n debugTask\n ) {\n self = props.ref;\n type = {\n $$typeof: REACT_ELEMENT_TYPE,\n type: type,\n key: key,\n props: props,\n _owner: owner\n };\n null !== (void 0 !== self ? self : null)\n ? Object.defineProperty(type, \"ref\", {\n enumerable: !1,\n get: elementRefGetterWithDeprecationWarning\n })\n : Object.defineProperty(type, \"ref\", { enumerable: !1, value: null });\n type._store = {};\n Object.defineProperty(type._store, \"validated\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: 0\n });\n Object.defineProperty(type, \"_debugInfo\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: null\n });\n Object.defineProperty(type, \"_debugStack\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: debugStack\n });\n Object.defineProperty(type, \"_debugTask\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: debugTask\n });\n Object.freeze && (Object.freeze(type.props), Object.freeze(type));\n return type;\n }\n function cloneAndReplaceKey(oldElement, newKey) {\n newKey = ReactElement(\n oldElement.type,\n newKey,\n void 0,\n void 0,\n oldElement._owner,\n oldElement.props,\n oldElement._debugStack,\n oldElement._debugTask\n );\n oldElement._store &&\n (newKey._store.validated = oldElement._store.validated);\n return newKey;\n }\n function isValidElement(object) {\n return (\n \"object\" === typeof object &&\n null !== object &&\n object.$$typeof === REACT_ELEMENT_TYPE\n );\n }\n function escape(key) {\n var escaperLookup = { \"=\": \"=0\", \":\": \"=2\" };\n return (\n \"$\" +\n key.replace(/[=:]/g, function (match) {\n return escaperLookup[match];\n })\n );\n }\n function getElementKey(element, index) {\n return \"object\" === typeof element &&\n null !== element &&\n null != element.key\n ? (checkKeyStringCoercion(element.key), escape(\"\" + element.key))\n : index.toString(36);\n }\n function noop$1() {}\n function resolveThenable(thenable) {\n switch (thenable.status) {\n case \"fulfilled\":\n return thenable.value;\n case \"rejected\":\n throw thenable.reason;\n default:\n switch (\n (\"string\" === typeof thenable.status\n ? thenable.then(noop$1, noop$1)\n : ((thenable.status = \"pending\"),\n thenable.then(\n function (fulfilledValue) {\n \"pending\" === thenable.status &&\n ((thenable.status = \"fulfilled\"),\n (thenable.value = fulfilledValue));\n },\n function (error) {\n \"pending\" === thenable.status &&\n ((thenable.status = \"rejected\"),\n (thenable.reason = error));\n }\n )),\n thenable.status)\n ) {\n case \"fulfilled\":\n return thenable.value;\n case \"rejected\":\n throw thenable.reason;\n }\n }\n throw thenable;\n }\n function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {\n var type = typeof children;\n if (\"undefined\" === type || \"boolean\" === type) children = null;\n var invokeCallback = !1;\n if (null === children) invokeCallback = !0;\n else\n switch (type) {\n case \"bigint\":\n case \"string\":\n case \"number\":\n invokeCallback = !0;\n break;\n case \"object\":\n switch (children.$$typeof) {\n case REACT_ELEMENT_TYPE:\n case REACT_PORTAL_TYPE:\n invokeCallback = !0;\n break;\n case REACT_LAZY_TYPE:\n return (\n (invokeCallback = children._init),\n mapIntoArray(\n invokeCallback(children._payload),\n array,\n escapedPrefix,\n nameSoFar,\n callback\n )\n );\n }\n }\n if (invokeCallback) {\n invokeCallback = children;\n callback = callback(invokeCallback);\n var childKey =\n \"\" === nameSoFar ? \".\" + getElementKey(invokeCallback, 0) : nameSoFar;\n isArrayImpl(callback)\n ? ((escapedPrefix = \"\"),\n null != childKey &&\n (escapedPrefix =\n childKey.replace(userProvidedKeyEscapeRegex, \"$&/\") + \"/\"),\n mapIntoArray(callback, array, escapedPrefix, \"\", function (c) {\n return c;\n }))\n : null != callback &&\n (isValidElement(callback) &&\n (null != callback.key &&\n ((invokeCallback && invokeCallback.key === callback.key) ||\n checkKeyStringCoercion(callback.key)),\n (escapedPrefix = cloneAndReplaceKey(\n callback,\n escapedPrefix +\n (null == callback.key ||\n (invokeCallback && invokeCallback.key === callback.key)\n ? \"\"\n : (\"\" + callback.key).replace(\n userProvidedKeyEscapeRegex,\n \"$&/\"\n ) + \"/\") +\n childKey\n )),\n \"\" !== nameSoFar &&\n null != invokeCallback &&\n isValidElement(invokeCallback) &&\n null == invokeCallback.key &&\n invokeCallback._store &&\n !invokeCallback._store.validated &&\n (escapedPrefix._store.validated = 2),\n (callback = escapedPrefix)),\n array.push(callback));\n return 1;\n }\n invokeCallback = 0;\n childKey = \"\" === nameSoFar ? \".\" : nameSoFar + \":\";\n if (isArrayImpl(children))\n for (var i = 0; i < children.length; i++)\n (nameSoFar = children[i]),\n (type = childKey + getElementKey(nameSoFar, i)),\n (invokeCallback += mapIntoArray(\n nameSoFar,\n array,\n escapedPrefix,\n type,\n callback\n ));\n else if (((i = getIteratorFn(children)), \"function\" === typeof i))\n for (\n i === children.entries &&\n (didWarnAboutMaps ||\n console.warn(\n \"Using Maps as children is not supported. Use an array of keyed ReactElements instead.\"\n ),\n (didWarnAboutMaps = !0)),\n children = i.call(children),\n i = 0;\n !(nameSoFar = children.next()).done;\n\n )\n (nameSoFar = nameSoFar.value),\n (type = childKey + getElementKey(nameSoFar, i++)),\n (invokeCallback += mapIntoArray(\n nameSoFar,\n array,\n escapedPrefix,\n type,\n callback\n ));\n else if (\"object\" === type) {\n if (\"function\" === typeof children.then)\n return mapIntoArray(\n resolveThenable(children),\n array,\n escapedPrefix,\n nameSoFar,\n callback\n );\n array = String(children);\n throw Error(\n \"Objects are not valid as a React child (found: \" +\n (\"[object Object]\" === array\n ? \"object with keys {\" + Object.keys(children).join(\", \") + \"}\"\n : array) +\n \"). If you meant to render a collection of children, use an array instead.\"\n );\n }\n return invokeCallback;\n }\n function mapChildren(children, func, context) {\n if (null == children) return children;\n var result = [],\n count = 0;\n mapIntoArray(children, result, \"\", \"\", function (child) {\n return func.call(context, child, count++);\n });\n return result;\n }\n function lazyInitializer(payload) {\n if (-1 === payload._status) {\n var ctor = payload._result;\n ctor = ctor();\n ctor.then(\n function (moduleObject) {\n if (0 === payload._status || -1 === payload._status)\n (payload._status = 1), (payload._result = moduleObject);\n },\n function (error) {\n if (0 === payload._status || -1 === payload._status)\n (payload._status = 2), (payload._result = error);\n }\n );\n -1 === payload._status &&\n ((payload._status = 0), (payload._result = ctor));\n }\n if (1 === payload._status)\n return (\n (ctor = payload._result),\n void 0 === ctor &&\n console.error(\n \"lazy: Expected the result of a dynamic import() call. Instead received: %s\\n\\nYour code should look like: \\n const MyComponent = lazy(() => import('./MyComponent'))\\n\\nDid you accidentally put curly braces around the import?\",\n ctor\n ),\n \"default\" in ctor ||\n console.error(\n \"lazy: Expected the result of a dynamic import() call. Instead received: %s\\n\\nYour code should look like: \\n const MyComponent = lazy(() => import('./MyComponent'))\",\n ctor\n ),\n ctor.default\n );\n throw payload._result;\n }\n function resolveDispatcher() {\n var dispatcher = ReactSharedInternals.H;\n null === dispatcher &&\n console.error(\n \"Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\\n1. You might have mismatching versions of React and the renderer (such as React DOM)\\n2. You might be breaking the Rules of Hooks\\n3. You might have more than one copy of React in the same app\\nSee https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.\"\n );\n return dispatcher;\n }\n function noop() {}\n function enqueueTask(task) {\n if (null === enqueueTaskImpl)\n try {\n var requireString = (\"require\" + Math.random()).slice(0, 7);\n enqueueTaskImpl = (module && module[requireString]).call(\n module,\n \"timers\"\n ).setImmediate;\n } catch (_err) {\n enqueueTaskImpl = function (callback) {\n !1 === didWarnAboutMessageChannel &&\n ((didWarnAboutMessageChannel = !0),\n \"undefined\" === typeof MessageChannel &&\n console.error(\n \"This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning.\"\n ));\n var channel = new MessageChannel();\n channel.port1.onmessage = callback;\n channel.port2.postMessage(void 0);\n };\n }\n return enqueueTaskImpl(task);\n }\n function aggregateErrors(errors) {\n return 1 < errors.length && \"function\" === typeof AggregateError\n ? new AggregateError(errors)\n : errors[0];\n }\n function popActScope(prevActQueue, prevActScopeDepth) {\n prevActScopeDepth !== actScopeDepth - 1 &&\n console.error(\n \"You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. \"\n );\n actScopeDepth = prevActScopeDepth;\n }\n function recursivelyFlushAsyncActWork(returnValue, resolve, reject) {\n var queue = ReactSharedInternals.actQueue;\n if (null !== queue)\n if (0 !== queue.length)\n try {\n flushActQueue(queue);\n enqueueTask(function () {\n return recursivelyFlushAsyncActWork(returnValue, resolve, reject);\n });\n return;\n } catch (error) {\n ReactSharedInternals.thrownErrors.push(error);\n }\n else ReactSharedInternals.actQueue = null;\n 0 < ReactSharedInternals.thrownErrors.length\n ? ((queue = aggregateErrors(ReactSharedInternals.thrownErrors)),\n (ReactSharedInternals.thrownErrors.length = 0),\n reject(queue))\n : resolve(returnValue);\n }\n function flushActQueue(queue) {\n if (!isFlushing) {\n isFlushing = !0;\n var i = 0;\n try {\n for (; i < queue.length; i++) {\n var callback = queue[i];\n do {\n ReactSharedInternals.didUsePromise = !1;\n var continuation = callback(!1);\n if (null !== continuation) {\n if (ReactSharedInternals.didUsePromise) {\n queue[i] = callback;\n queue.splice(0, i);\n return;\n }\n callback = continuation;\n } else break;\n } while (1);\n }\n queue.length = 0;\n } catch (error) {\n queue.splice(0, i + 1), ReactSharedInternals.thrownErrors.push(error);\n } finally {\n isFlushing = !1;\n }\n }\n }\n \"undefined\" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&\n \"function\" ===\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart &&\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());\n var REACT_ELEMENT_TYPE = Symbol.for(\"react.transitional.element\"),\n REACT_PORTAL_TYPE = Symbol.for(\"react.portal\"),\n REACT_FRAGMENT_TYPE = Symbol.for(\"react.fragment\"),\n REACT_STRICT_MODE_TYPE = Symbol.for(\"react.strict_mode\"),\n REACT_PROFILER_TYPE = Symbol.for(\"react.profiler\");\n Symbol.for(\"react.provider\");\n var REACT_CONSUMER_TYPE = Symbol.for(\"react.consumer\"),\n REACT_CONTEXT_TYPE = Symbol.for(\"react.context\"),\n REACT_FORWARD_REF_TYPE = Symbol.for(\"react.forward_ref\"),\n REACT_SUSPENSE_TYPE = Symbol.for(\"react.suspense\"),\n REACT_SUSPENSE_LIST_TYPE = Symbol.for(\"react.suspense_list\"),\n REACT_MEMO_TYPE = Symbol.for(\"react.memo\"),\n REACT_LAZY_TYPE = Symbol.for(\"react.lazy\"),\n REACT_ACTIVITY_TYPE = Symbol.for(\"react.activity\"),\n MAYBE_ITERATOR_SYMBOL = Symbol.iterator,\n didWarnStateUpdateForUnmountedComponent = {},\n ReactNoopUpdateQueue = {\n isMounted: function () {\n return !1;\n },\n enqueueForceUpdate: function (publicInstance) {\n warnNoop(publicInstance, \"forceUpdate\");\n },\n enqueueReplaceState: function (publicInstance) {\n warnNoop(publicInstance, \"replaceState\");\n },\n enqueueSetState: function (publicInstance) {\n warnNoop(publicInstance, \"setState\");\n }\n },\n assign = Object.assign,\n emptyObject = {};\n Object.freeze(emptyObject);\n Component.prototype.isReactComponent = {};\n Component.prototype.setState = function (partialState, callback) {\n if (\n \"object\" !== typeof partialState &&\n \"function\" !== typeof partialState &&\n null != partialState\n )\n throw Error(\n \"takes an object of state variables to update or a function which returns an object of state variables.\"\n );\n this.updater.enqueueSetState(this, partialState, callback, \"setState\");\n };\n Component.prototype.forceUpdate = function (callback) {\n this.updater.enqueueForceUpdate(this, callback, \"forceUpdate\");\n };\n var deprecatedAPIs = {\n isMounted: [\n \"isMounted\",\n \"Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks.\"\n ],\n replaceState: [\n \"replaceState\",\n \"Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236).\"\n ]\n },\n fnName;\n for (fnName in deprecatedAPIs)\n deprecatedAPIs.hasOwnProperty(fnName) &&\n defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);\n ComponentDummy.prototype = Component.prototype;\n deprecatedAPIs = PureComponent.prototype = new ComponentDummy();\n deprecatedAPIs.constructor = PureComponent;\n assign(deprecatedAPIs, Component.prototype);\n deprecatedAPIs.isPureReactComponent = !0;\n var isArrayImpl = Array.isArray,\n REACT_CLIENT_REFERENCE = Symbol.for(\"react.client.reference\"),\n ReactSharedInternals = {\n H: null,\n A: null,\n T: null,\n S: null,\n V: null,\n actQueue: null,\n isBatchingLegacy: !1,\n didScheduleLegacyUpdate: !1,\n didUsePromise: !1,\n thrownErrors: [],\n getCurrentStack: null,\n recentlyCreatedOwnerStacks: 0\n },\n hasOwnProperty = Object.prototype.hasOwnProperty,\n createTask = console.createTask\n ? console.createTask\n : function () {\n return null;\n };\n deprecatedAPIs = {\n \"react-stack-bottom-frame\": function (callStackForError) {\n return callStackForError();\n }\n };\n var specialPropKeyWarningShown, didWarnAboutOldJSXRuntime;\n var didWarnAboutElementRef = {};\n var unknownOwnerDebugStack = deprecatedAPIs[\n \"react-stack-bottom-frame\"\n ].bind(deprecatedAPIs, UnknownOwner)();\n var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));\n var didWarnAboutMaps = !1,\n userProvidedKeyEscapeRegex = /\\/+/g,\n reportGlobalError =\n \"function\" === typeof reportError\n ? reportError\n : function (error) {\n if (\n \"object\" === typeof window &&\n \"function\" === typeof window.ErrorEvent\n ) {\n var event = new window.ErrorEvent(\"error\", {\n bubbles: !0,\n cancelable: !0,\n message:\n \"object\" === typeof error &&\n null !== error &&\n \"string\" === typeof error.message\n ? String(error.message)\n : String(error),\n error: error\n });\n if (!window.dispatchEvent(event)) return;\n } else if (\n \"object\" === typeof process &&\n \"function\" === typeof process.emit\n ) {\n process.emit(\"uncaughtException\", error);\n return;\n }\n console.error(error);\n },\n didWarnAboutMessageChannel = !1,\n enqueueTaskImpl = null,\n actScopeDepth = 0,\n didWarnNoAwaitAct = !1,\n isFlushing = !1,\n queueSeveralMicrotasks =\n \"function\" === typeof queueMicrotask\n ? function (callback) {\n queueMicrotask(function () {\n return queueMicrotask(callback);\n });\n }\n : enqueueTask;\n deprecatedAPIs = Object.freeze({\n __proto__: null,\n c: function (size) {\n return resolveDispatcher().useMemoCache(size);\n }\n });\n exports.Children = {\n map: mapChildren,\n forEach: function (children, forEachFunc, forEachContext) {\n mapChildren(\n children,\n function () {\n forEachFunc.apply(this, arguments);\n },\n forEachContext\n );\n },\n count: function (children) {\n var n = 0;\n mapChildren(children, function () {\n n++;\n });\n return n;\n },\n toArray: function (children) {\n return (\n mapChildren(children, function (child) {\n return child;\n }) || []\n );\n },\n only: function (children) {\n if (!isValidElement(children))\n throw Error(\n \"React.Children.only expected to receive a single React element child.\"\n );\n return children;\n }\n };\n exports.Component = Component;\n exports.Fragment = REACT_FRAGMENT_TYPE;\n exports.Profiler = REACT_PROFILER_TYPE;\n exports.PureComponent = PureComponent;\n exports.StrictMode = REACT_STRICT_MODE_TYPE;\n exports.Suspense = REACT_SUSPENSE_TYPE;\n exports.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE =\n ReactSharedInternals;\n exports.__COMPILER_RUNTIME = deprecatedAPIs;\n exports.act = function (callback) {\n var prevActQueue = ReactSharedInternals.actQueue,\n prevActScopeDepth = actScopeDepth;\n actScopeDepth++;\n var queue = (ReactSharedInternals.actQueue =\n null !== prevActQueue ? prevActQueue : []),\n didAwaitActCall = !1;\n try {\n var result = callback();\n } catch (error) {\n ReactSharedInternals.thrownErrors.push(error);\n }\n if (0 < ReactSharedInternals.thrownErrors.length)\n throw (\n (popActScope(prevActQueue, prevActScopeDepth),\n (callback = aggregateErrors(ReactSharedInternals.thrownErrors)),\n (ReactSharedInternals.thrownErrors.length = 0),\n callback)\n );\n if (\n null !== result &&\n \"object\" === typeof result &&\n \"function\" === typeof result.then\n ) {\n var thenable = result;\n queueSeveralMicrotasks(function () {\n didAwaitActCall ||\n didWarnNoAwaitAct ||\n ((didWarnNoAwaitAct = !0),\n console.error(\n \"You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);\"\n ));\n });\n return {\n then: function (resolve, reject) {\n didAwaitActCall = !0;\n thenable.then(\n function (returnValue) {\n popActScope(prevActQueue, prevActScopeDepth);\n if (0 === prevActScopeDepth) {\n try {\n flushActQueue(queue),\n enqueueTask(function () {\n return recursivelyFlushAsyncActWork(\n returnValue,\n resolve,\n reject\n );\n });\n } catch (error$0) {\n ReactSharedInternals.thrownErrors.push(error$0);\n }\n if (0 < ReactSharedInternals.thrownErrors.length) {\n var _thrownError = aggregateErrors(\n ReactSharedInternals.thrownErrors\n );\n ReactSharedInternals.thrownErrors.length = 0;\n reject(_thrownError);\n }\n } else resolve(returnValue);\n },\n function (error) {\n popActScope(prevActQueue, prevActScopeDepth);\n 0 < ReactSharedInternals.thrownErrors.length\n ? ((error = aggregateErrors(\n ReactSharedInternals.thrownErrors\n )),\n (ReactSharedInternals.thrownErrors.length = 0),\n reject(error))\n : reject(error);\n }\n );\n }\n };\n }\n var returnValue$jscomp$0 = result;\n popActScope(prevActQueue, prevActScopeDepth);\n 0 === prevActScopeDepth &&\n (flushActQueue(queue),\n 0 !== queue.length &&\n queueSeveralMicrotasks(function () {\n didAwaitActCall ||\n didWarnNoAwaitAct ||\n ((didWarnNoAwaitAct = !0),\n console.error(\n \"A component suspended inside an `act` scope, but the `act` call was not awaited. When testing React components that depend on asynchronous data, you must await the result:\\n\\nawait act(() => ...)\"\n ));\n }),\n (ReactSharedInternals.actQueue = null));\n if (0 < ReactSharedInternals.thrownErrors.length)\n throw (\n ((callback = aggregateErrors(ReactSharedInternals.thrownErrors)),\n (ReactSharedInternals.thrownErrors.length = 0),\n callback)\n );\n return {\n then: function (resolve, reject) {\n didAwaitActCall = !0;\n 0 === prevActScopeDepth\n ? ((ReactSharedInternals.actQueue = queue),\n enqueueTask(function () {\n return recursivelyFlushAsyncActWork(\n returnValue$jscomp$0,\n resolve,\n reject\n );\n }))\n : resolve(returnValue$jscomp$0);\n }\n };\n };\n exports.cache = function (fn) {\n return function () {\n return fn.apply(null, arguments);\n };\n };\n exports.captureOwnerStack = function () {\n var getCurrentStack = ReactSharedInternals.getCurrentStack;\n return null === getCurrentStack ? null : getCurrentStack();\n };\n exports.cloneElement = function (element, config, children) {\n if (null === element || void 0 === element)\n throw Error(\n \"The argument must be a React element, but you passed \" +\n element +\n \".\"\n );\n var props = assign({}, element.props),\n key = element.key,\n owner = element._owner;\n if (null != config) {\n var JSCompiler_inline_result;\n a: {\n if (\n hasOwnProperty.call(config, \"ref\") &&\n (JSCompiler_inline_result = Object.getOwnPropertyDescriptor(\n config,\n \"ref\"\n ).get) &&\n JSCompiler_inline_result.isReactWarning\n ) {\n JSCompiler_inline_result = !1;\n break a;\n }\n JSCompiler_inline_result = void 0 !== config.ref;\n }\n JSCompiler_inline_result && (owner = getOwner());\n hasValidKey(config) &&\n (checkKeyStringCoercion(config.key), (key = \"\" + config.key));\n for (propName in config)\n !hasOwnProperty.call(config, propName) ||\n \"key\" === propName ||\n \"__self\" === propName ||\n \"__source\" === propName ||\n (\"ref\" === propName && void 0 === config.ref) ||\n (props[propName] = config[propName]);\n }\n var propName = arguments.length - 2;\n if (1 === propName) props.children = children;\n else if (1 < propName) {\n JSCompiler_inline_result = Array(propName);\n for (var i = 0; i < propName; i++)\n JSCompiler_inline_result[i] = arguments[i + 2];\n props.children = JSCompiler_inline_result;\n }\n props = ReactElement(\n element.type,\n key,\n void 0,\n void 0,\n owner,\n props,\n element._debugStack,\n element._debugTask\n );\n for (key = 2; key < arguments.length; key++)\n (owner = arguments[key]),\n isValidElement(owner) && owner._store && (owner._store.validated = 1);\n return props;\n };\n exports.createContext = function (defaultValue) {\n defaultValue = {\n $$typeof: REACT_CONTEXT_TYPE,\n _currentValue: defaultValue,\n _currentValue2: defaultValue,\n _threadCount: 0,\n Provider: null,\n Consumer: null\n };\n defaultValue.Provider = defaultValue;\n defaultValue.Consumer = {\n $$typeof: REACT_CONSUMER_TYPE,\n _context: defaultValue\n };\n defaultValue._currentRenderer = null;\n defaultValue._currentRenderer2 = null;\n return defaultValue;\n };\n exports.createElement = function (type, config, children) {\n for (var i = 2; i < arguments.length; i++) {\n var node = arguments[i];\n isValidElement(node) && node._store && (node._store.validated = 1);\n }\n i = {};\n node = null;\n if (null != config)\n for (propName in (didWarnAboutOldJSXRuntime ||\n !(\"__self\" in config) ||\n \"key\" in config ||\n ((didWarnAboutOldJSXRuntime = !0),\n console.warn(\n \"Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance: https://react.dev/link/new-jsx-transform\"\n )),\n hasValidKey(config) &&\n (checkKeyStringCoercion(config.key), (node = \"\" + config.key)),\n config))\n hasOwnProperty.call(config, propName) &&\n \"key\" !== propName &&\n \"__self\" !== propName &&\n \"__source\" !== propName &&\n (i[propName] = config[propName]);\n var childrenLength = arguments.length - 2;\n if (1 === childrenLength) i.children = children;\n else if (1 < childrenLength) {\n for (\n var childArray = Array(childrenLength), _i = 0;\n _i < childrenLength;\n _i++\n )\n childArray[_i] = arguments[_i + 2];\n Object.freeze && Object.freeze(childArray);\n i.children = childArray;\n }\n if (type && type.defaultProps)\n for (propName in ((childrenLength = type.defaultProps), childrenLength))\n void 0 === i[propName] && (i[propName] = childrenLength[propName]);\n node &&\n defineKeyPropWarningGetter(\n i,\n \"function\" === typeof type\n ? type.displayName || type.name || \"Unknown\"\n : type\n );\n var propName = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;\n return ReactElement(\n type,\n node,\n void 0,\n void 0,\n getOwner(),\n i,\n propName ? Error(\"react-stack-top-frame\") : unknownOwnerDebugStack,\n propName ? createTask(getTaskName(type)) : unknownOwnerDebugTask\n );\n };\n exports.createRef = function () {\n var refObject = { current: null };\n Object.seal(refObject);\n return refObject;\n };\n exports.forwardRef = function (render) {\n null != render && render.$$typeof === REACT_MEMO_TYPE\n ? console.error(\n \"forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...)).\"\n )\n : \"function\" !== typeof render\n ? console.error(\n \"forwardRef requires a render function but was given %s.\",\n null === render ? \"null\" : typeof render\n )\n : 0 !== render.length &&\n 2 !== render.length &&\n console.error(\n \"forwardRef render functions accept exactly two parameters: props and ref. %s\",\n 1 === render.length\n ? \"Did you forget to use the ref parameter?\"\n : \"Any additional parameter will be undefined.\"\n );\n null != render &&\n null != render.defaultProps &&\n console.error(\n \"forwardRef render functions do not support defaultProps. Did you accidentally pass a React component?\"\n );\n var elementType = { $$typeof: REACT_FORWARD_REF_TYPE, render: render },\n ownName;\n Object.defineProperty(elementType, \"displayName\", {\n enumerable: !1,\n configurable: !0,\n get: function () {\n return ownName;\n },\n set: function (name) {\n ownName = name;\n render.name ||\n render.displayName ||\n (Object.defineProperty(render, \"name\", { value: name }),\n (render.displayName = name));\n }\n });\n return elementType;\n };\n exports.isValidElement = isValidElement;\n exports.lazy = function (ctor) {\n return {\n $$typeof: REACT_LAZY_TYPE,\n _payload: { _status: -1, _result: ctor },\n _init: lazyInitializer\n };\n };\n exports.memo = function (type, compare) {\n null == type &&\n console.error(\n \"memo: The first argument must be a component. Instead received: %s\",\n null === type ? \"null\" : typeof type\n );\n compare = {\n $$typeof: REACT_MEMO_TYPE,\n type: type,\n compare: void 0 === compare ? null : compare\n };\n var ownName;\n Object.defineProperty(compare, \"displayName\", {\n enumerable: !1,\n configurable: !0,\n get: function () {\n return ownName;\n },\n set: function (name) {\n ownName = name;\n type.name ||\n type.displayName ||\n (Object.defineProperty(type, \"name\", { value: name }),\n (type.displayName = name));\n }\n });\n return compare;\n };\n exports.startTransition = function (scope) {\n var prevTransition = ReactSharedInternals.T,\n currentTransition = {};\n ReactSharedInternals.T = currentTransition;\n currentTransition._updatedFibers = new Set();\n try {\n var returnValue = scope(),\n onStartTransitionFinish = ReactSharedInternals.S;\n null !== onStartTransitionFinish &&\n onStartTransitionFinish(currentTransition, returnValue);\n \"object\" === typeof returnValue &&\n null !== returnValue &&\n \"function\" === typeof returnValue.then &&\n returnValue.then(noop, reportGlobalError);\n } catch (error) {\n reportGlobalError(error);\n } finally {\n null === prevTransition &&\n currentTransition._updatedFibers &&\n ((scope = currentTransition._updatedFibers.size),\n currentTransition._updatedFibers.clear(),\n 10 < scope &&\n console.warn(\n \"Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table.\"\n )),\n (ReactSharedInternals.T = prevTransition);\n }\n };\n exports.unstable_useCacheRefresh = function () {\n return resolveDispatcher().useCacheRefresh();\n };\n exports.use = function (usable) {\n return resolveDispatcher().use(usable);\n };\n exports.useActionState = function (action, initialState, permalink) {\n return resolveDispatcher().useActionState(\n action,\n initialState,\n permalink\n );\n };\n exports.useCallback = function (callback, deps) {\n return resolveDispatcher().useCallback(callback, deps);\n };\n exports.useContext = function (Context) {\n var dispatcher = resolveDispatcher();\n Context.$$typeof === REACT_CONSUMER_TYPE &&\n console.error(\n \"Calling useContext(Context.Consumer) is not supported and will cause bugs. Did you mean to call useContext(Context) instead?\"\n );\n return dispatcher.useContext(Context);\n };\n exports.useDebugValue = function (value, formatterFn) {\n return resolveDispatcher().useDebugValue(value, formatterFn);\n };\n exports.useDeferredValue = function (value, initialValue) {\n return resolveDispatcher().useDeferredValue(value, initialValue);\n };\n exports.useEffect = function (create, createDeps, update) {\n null == create &&\n console.warn(\n \"React Hook useEffect requires an effect callback. Did you forget to pass a callback to the hook?\"\n );\n var dispatcher = resolveDispatcher();\n if (\"function\" === typeof update)\n throw Error(\n \"useEffect CRUD overload is not enabled in this build of React.\"\n );\n return dispatcher.useEffect(create, createDeps);\n };\n exports.useId = function () {\n return resolveDispatcher().useId();\n };\n exports.useImperativeHandle = function (ref, create, deps) {\n return resolveDispatcher().useImperativeHandle(ref, create, deps);\n };\n exports.useInsertionEffect = function (create, deps) {\n null == create &&\n console.warn(\n \"React Hook useInsertionEffect requires an effect callback. Did you forget to pass a callback to the hook?\"\n );\n return resolveDispatcher().useInsertionEffect(create, deps);\n };\n exports.useLayoutEffect = function (create, deps) {\n null == create &&\n console.warn(\n \"React Hook useLayoutEffect requires an effect callback. Did you forget to pass a callback to the hook?\"\n );\n return resolveDispatcher().useLayoutEffect(create, deps);\n };\n exports.useMemo = function (create, deps) {\n return resolveDispatcher().useMemo(create, deps);\n };\n exports.useOptimistic = function (passthrough, reducer) {\n return resolveDispatcher().useOptimistic(passthrough, reducer);\n };\n exports.useReducer = function (reducer, initialArg, init) {\n return resolveDispatcher().useReducer(reducer, initialArg, init);\n };\n exports.useRef = function (initialValue) {\n return resolveDispatcher().useRef(initialValue);\n };\n exports.useState = function (initialState) {\n return resolveDispatcher().useState(initialState);\n };\n exports.useSyncExternalStore = function (\n subscribe,\n getSnapshot,\n getServerSnapshot\n ) {\n return resolveDispatcher().useSyncExternalStore(\n subscribe,\n getSnapshot,\n getServerSnapshot\n );\n };\n exports.useTransition = function () {\n return resolveDispatcher().useTransition();\n };\n exports.version = \"19.1.0\";\n \"undefined\" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&\n \"function\" ===\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());\n })();\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react.production.js');\n} else {\n module.exports = require('./cjs/react.development.js');\n}\n","/**\n * @license React\n * react-jsx-runtime.development.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\"use strict\";\n\"production\" !== process.env.NODE_ENV &&\n (function () {\n function getComponentNameFromType(type) {\n if (null == type) return null;\n if (\"function\" === typeof type)\n return type.$$typeof === REACT_CLIENT_REFERENCE\n ? null\n : type.displayName || type.name || null;\n if (\"string\" === typeof type) return type;\n switch (type) {\n case REACT_FRAGMENT_TYPE:\n return \"Fragment\";\n case REACT_PROFILER_TYPE:\n return \"Profiler\";\n case REACT_STRICT_MODE_TYPE:\n return \"StrictMode\";\n case REACT_SUSPENSE_TYPE:\n return \"Suspense\";\n case REACT_SUSPENSE_LIST_TYPE:\n return \"SuspenseList\";\n case REACT_ACTIVITY_TYPE:\n return \"Activity\";\n }\n if (\"object\" === typeof type)\n switch (\n (\"number\" === typeof type.tag &&\n console.error(\n \"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.\"\n ),\n type.$$typeof)\n ) {\n case REACT_PORTAL_TYPE:\n return \"Portal\";\n case REACT_CONTEXT_TYPE:\n return (type.displayName || \"Context\") + \".Provider\";\n case REACT_CONSUMER_TYPE:\n return (type._context.displayName || \"Context\") + \".Consumer\";\n case REACT_FORWARD_REF_TYPE:\n var innerType = type.render;\n type = type.displayName;\n type ||\n ((type = innerType.displayName || innerType.name || \"\"),\n (type = \"\" !== type ? \"ForwardRef(\" + type + \")\" : \"ForwardRef\"));\n return type;\n case REACT_MEMO_TYPE:\n return (\n (innerType = type.displayName || null),\n null !== innerType\n ? innerType\n : getComponentNameFromType(type.type) || \"Memo\"\n );\n case REACT_LAZY_TYPE:\n innerType = type._payload;\n type = type._init;\n try {\n return getComponentNameFromType(type(innerType));\n } catch (x) {}\n }\n return null;\n }\n function testStringCoercion(value) {\n return \"\" + value;\n }\n function checkKeyStringCoercion(value) {\n try {\n testStringCoercion(value);\n var JSCompiler_inline_result = !1;\n } catch (e) {\n JSCompiler_inline_result = !0;\n }\n if (JSCompiler_inline_result) {\n JSCompiler_inline_result = console;\n var JSCompiler_temp_const = JSCompiler_inline_result.error;\n var JSCompiler_inline_result$jscomp$0 =\n (\"function\" === typeof Symbol &&\n Symbol.toStringTag &&\n value[Symbol.toStringTag]) ||\n value.constructor.name ||\n \"Object\";\n JSCompiler_temp_const.call(\n JSCompiler_inline_result,\n \"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.\",\n JSCompiler_inline_result$jscomp$0\n );\n return testStringCoercion(value);\n }\n }\n function getTaskName(type) {\n if (type === REACT_FRAGMENT_TYPE) return \"<>\";\n if (\n \"object\" === typeof type &&\n null !== type &&\n type.$$typeof === REACT_LAZY_TYPE\n )\n return \"<...>\";\n try {\n var name = getComponentNameFromType(type);\n return name ? \"<\" + name + \">\" : \"<...>\";\n } catch (x) {\n return \"<...>\";\n }\n }\n function getOwner() {\n var dispatcher = ReactSharedInternals.A;\n return null === dispatcher ? null : dispatcher.getOwner();\n }\n function UnknownOwner() {\n return Error(\"react-stack-top-frame\");\n }\n function hasValidKey(config) {\n if (hasOwnProperty.call(config, \"key\")) {\n var getter = Object.getOwnPropertyDescriptor(config, \"key\").get;\n if (getter && getter.isReactWarning) return !1;\n }\n return void 0 !== config.key;\n }\n function defineKeyPropWarningGetter(props, displayName) {\n function warnAboutAccessingKey() {\n specialPropKeyWarningShown ||\n ((specialPropKeyWarningShown = !0),\n console.error(\n \"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)\",\n displayName\n ));\n }\n warnAboutAccessingKey.isReactWarning = !0;\n Object.defineProperty(props, \"key\", {\n get: warnAboutAccessingKey,\n configurable: !0\n });\n }\n function elementRefGetterWithDeprecationWarning() {\n var componentName = getComponentNameFromType(this.type);\n didWarnAboutElementRef[componentName] ||\n ((didWarnAboutElementRef[componentName] = !0),\n console.error(\n \"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.\"\n ));\n componentName = this.props.ref;\n return void 0 !== componentName ? componentName : null;\n }\n function ReactElement(\n type,\n key,\n self,\n source,\n owner,\n props,\n debugStack,\n debugTask\n ) {\n self = props.ref;\n type = {\n $$typeof: REACT_ELEMENT_TYPE,\n type: type,\n key: key,\n props: props,\n _owner: owner\n };\n null !== (void 0 !== self ? self : null)\n ? Object.defineProperty(type, \"ref\", {\n enumerable: !1,\n get: elementRefGetterWithDeprecationWarning\n })\n : Object.defineProperty(type, \"ref\", { enumerable: !1, value: null });\n type._store = {};\n Object.defineProperty(type._store, \"validated\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: 0\n });\n Object.defineProperty(type, \"_debugInfo\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: null\n });\n Object.defineProperty(type, \"_debugStack\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: debugStack\n });\n Object.defineProperty(type, \"_debugTask\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: debugTask\n });\n Object.freeze && (Object.freeze(type.props), Object.freeze(type));\n return type;\n }\n function jsxDEVImpl(\n type,\n config,\n maybeKey,\n isStaticChildren,\n source,\n self,\n debugStack,\n debugTask\n ) {\n var children = config.children;\n if (void 0 !== children)\n if (isStaticChildren)\n if (isArrayImpl(children)) {\n for (\n isStaticChildren = 0;\n isStaticChildren < children.length;\n isStaticChildren++\n )\n validateChildKeys(children[isStaticChildren]);\n Object.freeze && Object.freeze(children);\n } else\n console.error(\n \"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.\"\n );\n else validateChildKeys(children);\n if (hasOwnProperty.call(config, \"key\")) {\n children = getComponentNameFromType(type);\n var keys = Object.keys(config).filter(function (k) {\n return \"key\" !== k;\n });\n isStaticChildren =\n 0 < keys.length\n ? \"{key: someKey, \" + keys.join(\": ..., \") + \": ...}\"\n : \"{key: someKey}\";\n didWarnAboutKeySpread[children + isStaticChildren] ||\n ((keys =\n 0 < keys.length ? \"{\" + keys.join(\": ..., \") + \": ...}\" : \"{}\"),\n console.error(\n 'A props object containing a \"key\" prop is being spread into JSX:\\n let props = %s;\\n <%s {...props} />\\nReact keys must be passed directly to JSX without using spread:\\n let props = %s;\\n <%s key={someKey} {...props} />',\n isStaticChildren,\n children,\n keys,\n children\n ),\n (didWarnAboutKeySpread[children + isStaticChildren] = !0));\n }\n children = null;\n void 0 !== maybeKey &&\n (checkKeyStringCoercion(maybeKey), (children = \"\" + maybeKey));\n hasValidKey(config) &&\n (checkKeyStringCoercion(config.key), (children = \"\" + config.key));\n if (\"key\" in config) {\n maybeKey = {};\n for (var propName in config)\n \"key\" !== propName && (maybeKey[propName] = config[propName]);\n } else maybeKey = config;\n children &&\n defineKeyPropWarningGetter(\n maybeKey,\n \"function\" === typeof type\n ? type.displayName || type.name || \"Unknown\"\n : type\n );\n return ReactElement(\n type,\n children,\n self,\n source,\n getOwner(),\n maybeKey,\n debugStack,\n debugTask\n );\n }\n function validateChildKeys(node) {\n \"object\" === typeof node &&\n null !== node &&\n node.$$typeof === REACT_ELEMENT_TYPE &&\n node._store &&\n (node._store.validated = 1);\n }\n var React = require(\"react\"),\n REACT_ELEMENT_TYPE = Symbol.for(\"react.transitional.element\"),\n REACT_PORTAL_TYPE = Symbol.for(\"react.portal\"),\n REACT_FRAGMENT_TYPE = Symbol.for(\"react.fragment\"),\n REACT_STRICT_MODE_TYPE = Symbol.for(\"react.strict_mode\"),\n REACT_PROFILER_TYPE = Symbol.for(\"react.profiler\");\n Symbol.for(\"react.provider\");\n var REACT_CONSUMER_TYPE = Symbol.for(\"react.consumer\"),\n REACT_CONTEXT_TYPE = Symbol.for(\"react.context\"),\n REACT_FORWARD_REF_TYPE = Symbol.for(\"react.forward_ref\"),\n REACT_SUSPENSE_TYPE = Symbol.for(\"react.suspense\"),\n REACT_SUSPENSE_LIST_TYPE = Symbol.for(\"react.suspense_list\"),\n REACT_MEMO_TYPE = Symbol.for(\"react.memo\"),\n REACT_LAZY_TYPE = Symbol.for(\"react.lazy\"),\n REACT_ACTIVITY_TYPE = Symbol.for(\"react.activity\"),\n REACT_CLIENT_REFERENCE = Symbol.for(\"react.client.reference\"),\n ReactSharedInternals =\n React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,\n hasOwnProperty = Object.prototype.hasOwnProperty,\n isArrayImpl = Array.isArray,\n createTask = console.createTask\n ? console.createTask\n : function () {\n return null;\n };\n React = {\n \"react-stack-bottom-frame\": function (callStackForError) {\n return callStackForError();\n }\n };\n var specialPropKeyWarningShown;\n var didWarnAboutElementRef = {};\n var unknownOwnerDebugStack = React[\"react-stack-bottom-frame\"].bind(\n React,\n UnknownOwner\n )();\n var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));\n var didWarnAboutKeySpread = {};\n exports.Fragment = REACT_FRAGMENT_TYPE;\n exports.jsx = function (type, config, maybeKey, source, self) {\n var trackActualOwner =\n 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;\n return jsxDEVImpl(\n type,\n config,\n maybeKey,\n !1,\n source,\n self,\n trackActualOwner\n ? Error(\"react-stack-top-frame\")\n : unknownOwnerDebugStack,\n trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask\n );\n };\n exports.jsxs = function (type, config, maybeKey, source, self) {\n var trackActualOwner =\n 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;\n return jsxDEVImpl(\n type,\n config,\n maybeKey,\n !0,\n source,\n self,\n trackActualOwner\n ? Error(\"react-stack-top-frame\")\n : unknownOwnerDebugStack,\n trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask\n );\n };\n })();\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-jsx-runtime.production.js');\n} else {\n module.exports = require('./cjs/react-jsx-runtime.development.js');\n}\n","/**\n * @license React\n * scheduler.development.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\"use strict\";\n\"production\" !== process.env.NODE_ENV &&\n (function () {\n function performWorkUntilDeadline() {\n needsPaint = !1;\n if (isMessageLoopRunning) {\n var currentTime = exports.unstable_now();\n startTime = currentTime;\n var hasMoreWork = !0;\n try {\n a: {\n isHostCallbackScheduled = !1;\n isHostTimeoutScheduled &&\n ((isHostTimeoutScheduled = !1),\n localClearTimeout(taskTimeoutID),\n (taskTimeoutID = -1));\n isPerformingWork = !0;\n var previousPriorityLevel = currentPriorityLevel;\n try {\n b: {\n advanceTimers(currentTime);\n for (\n currentTask = peek(taskQueue);\n null !== currentTask &&\n !(\n currentTask.expirationTime > currentTime &&\n shouldYieldToHost()\n );\n\n ) {\n var callback = currentTask.callback;\n if (\"function\" === typeof callback) {\n currentTask.callback = null;\n currentPriorityLevel = currentTask.priorityLevel;\n var continuationCallback = callback(\n currentTask.expirationTime <= currentTime\n );\n currentTime = exports.unstable_now();\n if (\"function\" === typeof continuationCallback) {\n currentTask.callback = continuationCallback;\n advanceTimers(currentTime);\n hasMoreWork = !0;\n break b;\n }\n currentTask === peek(taskQueue) && pop(taskQueue);\n advanceTimers(currentTime);\n } else pop(taskQueue);\n currentTask = peek(taskQueue);\n }\n if (null !== currentTask) hasMoreWork = !0;\n else {\n var firstTimer = peek(timerQueue);\n null !== firstTimer &&\n requestHostTimeout(\n handleTimeout,\n firstTimer.startTime - currentTime\n );\n hasMoreWork = !1;\n }\n }\n break a;\n } finally {\n (currentTask = null),\n (currentPriorityLevel = previousPriorityLevel),\n (isPerformingWork = !1);\n }\n hasMoreWork = void 0;\n }\n } finally {\n hasMoreWork\n ? schedulePerformWorkUntilDeadline()\n : (isMessageLoopRunning = !1);\n }\n }\n }\n function push(heap, node) {\n var index = heap.length;\n heap.push(node);\n a: for (; 0 < index; ) {\n var parentIndex = (index - 1) >>> 1,\n parent = heap[parentIndex];\n if (0 < compare(parent, node))\n (heap[parentIndex] = node),\n (heap[index] = parent),\n (index = parentIndex);\n else break a;\n }\n }\n function peek(heap) {\n return 0 === heap.length ? null : heap[0];\n }\n function pop(heap) {\n if (0 === heap.length) return null;\n var first = heap[0],\n last = heap.pop();\n if (last !== first) {\n heap[0] = last;\n a: for (\n var index = 0, length = heap.length, halfLength = length >>> 1;\n index < halfLength;\n\n ) {\n var leftIndex = 2 * (index + 1) - 1,\n left = heap[leftIndex],\n rightIndex = leftIndex + 1,\n right = heap[rightIndex];\n if (0 > compare(left, last))\n rightIndex < length && 0 > compare(right, left)\n ? ((heap[index] = right),\n (heap[rightIndex] = last),\n (index = rightIndex))\n : ((heap[index] = left),\n (heap[leftIndex] = last),\n (index = leftIndex));\n else if (rightIndex < length && 0 > compare(right, last))\n (heap[index] = right),\n (heap[rightIndex] = last),\n (index = rightIndex);\n else break a;\n }\n }\n return first;\n }\n function compare(a, b) {\n var diff = a.sortIndex - b.sortIndex;\n return 0 !== diff ? diff : a.id - b.id;\n }\n function advanceTimers(currentTime) {\n for (var timer = peek(timerQueue); null !== timer; ) {\n if (null === timer.callback) pop(timerQueue);\n else if (timer.startTime <= currentTime)\n pop(timerQueue),\n (timer.sortIndex = timer.expirationTime),\n push(taskQueue, timer);\n else break;\n timer = peek(timerQueue);\n }\n }\n function handleTimeout(currentTime) {\n isHostTimeoutScheduled = !1;\n advanceTimers(currentTime);\n if (!isHostCallbackScheduled)\n if (null !== peek(taskQueue))\n (isHostCallbackScheduled = !0),\n isMessageLoopRunning ||\n ((isMessageLoopRunning = !0), schedulePerformWorkUntilDeadline());\n else {\n var firstTimer = peek(timerQueue);\n null !== firstTimer &&\n requestHostTimeout(\n handleTimeout,\n firstTimer.startTime - currentTime\n );\n }\n }\n function shouldYieldToHost() {\n return needsPaint\n ? !0\n : exports.unstable_now() - startTime < frameInterval\n ? !1\n : !0;\n }\n function requestHostTimeout(callback, ms) {\n taskTimeoutID = localSetTimeout(function () {\n callback(exports.unstable_now());\n }, ms);\n }\n \"undefined\" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&\n \"function\" ===\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart &&\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());\n exports.unstable_now = void 0;\n if (\n \"object\" === typeof performance &&\n \"function\" === typeof performance.now\n ) {\n var localPerformance = performance;\n exports.unstable_now = function () {\n return localPerformance.now();\n };\n } else {\n var localDate = Date,\n initialTime = localDate.now();\n exports.unstable_now = function () {\n return localDate.now() - initialTime;\n };\n }\n var taskQueue = [],\n timerQueue = [],\n taskIdCounter = 1,\n currentTask = null,\n currentPriorityLevel = 3,\n isPerformingWork = !1,\n isHostCallbackScheduled = !1,\n isHostTimeoutScheduled = !1,\n needsPaint = !1,\n localSetTimeout = \"function\" === typeof setTimeout ? setTimeout : null,\n localClearTimeout =\n \"function\" === typeof clearTimeout ? clearTimeout : null,\n localSetImmediate =\n \"undefined\" !== typeof setImmediate ? setImmediate : null,\n isMessageLoopRunning = !1,\n taskTimeoutID = -1,\n frameInterval = 5,\n startTime = -1;\n if (\"function\" === typeof localSetImmediate)\n var schedulePerformWorkUntilDeadline = function () {\n localSetImmediate(performWorkUntilDeadline);\n };\n else if (\"undefined\" !== typeof MessageChannel) {\n var channel = new MessageChannel(),\n port = channel.port2;\n channel.port1.onmessage = performWorkUntilDeadline;\n schedulePerformWorkUntilDeadline = function () {\n port.postMessage(null);\n };\n } else\n schedulePerformWorkUntilDeadline = function () {\n localSetTimeout(performWorkUntilDeadline, 0);\n };\n exports.unstable_IdlePriority = 5;\n exports.unstable_ImmediatePriority = 1;\n exports.unstable_LowPriority = 4;\n exports.unstable_NormalPriority = 3;\n exports.unstable_Profiling = null;\n exports.unstable_UserBlockingPriority = 2;\n exports.unstable_cancelCallback = function (task) {\n task.callback = null;\n };\n exports.unstable_forceFrameRate = function (fps) {\n 0 > fps || 125 < fps\n ? console.error(\n \"forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported\"\n )\n : (frameInterval = 0 < fps ? Math.floor(1e3 / fps) : 5);\n };\n exports.unstable_getCurrentPriorityLevel = function () {\n return currentPriorityLevel;\n };\n exports.unstable_next = function (eventHandler) {\n switch (currentPriorityLevel) {\n case 1:\n case 2:\n case 3:\n var priorityLevel = 3;\n break;\n default:\n priorityLevel = currentPriorityLevel;\n }\n var previousPriorityLevel = currentPriorityLevel;\n currentPriorityLevel = priorityLevel;\n try {\n return eventHandler();\n } finally {\n currentPriorityLevel = previousPriorityLevel;\n }\n };\n exports.unstable_requestPaint = function () {\n needsPaint = !0;\n };\n exports.unstable_runWithPriority = function (priorityLevel, eventHandler) {\n switch (priorityLevel) {\n case 1:\n case 2:\n case 3:\n case 4:\n case 5:\n break;\n default:\n priorityLevel = 3;\n }\n var previousPriorityLevel = currentPriorityLevel;\n currentPriorityLevel = priorityLevel;\n try {\n return eventHandler();\n } finally {\n currentPriorityLevel = previousPriorityLevel;\n }\n };\n exports.unstable_scheduleCallback = function (\n priorityLevel,\n callback,\n options\n ) {\n var currentTime = exports.unstable_now();\n \"object\" === typeof options && null !== options\n ? ((options = options.delay),\n (options =\n \"number\" === typeof options && 0 < options\n ? currentTime + options\n : currentTime))\n : (options = currentTime);\n switch (priorityLevel) {\n case 1:\n var timeout = -1;\n break;\n case 2:\n timeout = 250;\n break;\n case 5:\n timeout = 1073741823;\n break;\n case 4:\n timeout = 1e4;\n break;\n default:\n timeout = 5e3;\n }\n timeout = options + timeout;\n priorityLevel = {\n id: taskIdCounter++,\n callback: callback,\n priorityLevel: priorityLevel,\n startTime: options,\n expirationTime: timeout,\n sortIndex: -1\n };\n options > currentTime\n ? ((priorityLevel.sortIndex = options),\n push(timerQueue, priorityLevel),\n null === peek(taskQueue) &&\n priorityLevel === peek(timerQueue) &&\n (isHostTimeoutScheduled\n ? (localClearTimeout(taskTimeoutID), (taskTimeoutID = -1))\n : (isHostTimeoutScheduled = !0),\n requestHostTimeout(handleTimeout, options - currentTime)))\n : ((priorityLevel.sortIndex = timeout),\n push(taskQueue, priorityLevel),\n isHostCallbackScheduled ||\n isPerformingWork ||\n ((isHostCallbackScheduled = !0),\n isMessageLoopRunning ||\n ((isMessageLoopRunning = !0),\n schedulePerformWorkUntilDeadline())));\n return priorityLevel;\n };\n exports.unstable_shouldYield = shouldYieldToHost;\n exports.unstable_wrapCallback = function (callback) {\n var parentPriorityLevel = currentPriorityLevel;\n return function () {\n var previousPriorityLevel = currentPriorityLevel;\n currentPriorityLevel = parentPriorityLevel;\n try {\n return callback.apply(this, arguments);\n } finally {\n currentPriorityLevel = previousPriorityLevel;\n }\n };\n };\n \"undefined\" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&\n \"function\" ===\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());\n })();\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/scheduler.production.js');\n} else {\n module.exports = require('./cjs/scheduler.development.js');\n}\n","/**\n * @license React\n * react-dom.development.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\"use strict\";\n\"production\" !== process.env.NODE_ENV &&\n (function () {\n function noop() {}\n function testStringCoercion(value) {\n return \"\" + value;\n }\n function createPortal$1(children, containerInfo, implementation) {\n var key =\n 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : null;\n try {\n testStringCoercion(key);\n var JSCompiler_inline_result = !1;\n } catch (e) {\n JSCompiler_inline_result = !0;\n }\n JSCompiler_inline_result &&\n (console.error(\n \"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.\",\n (\"function\" === typeof Symbol &&\n Symbol.toStringTag &&\n key[Symbol.toStringTag]) ||\n key.constructor.name ||\n \"Object\"\n ),\n testStringCoercion(key));\n return {\n $$typeof: REACT_PORTAL_TYPE,\n key: null == key ? null : \"\" + key,\n children: children,\n containerInfo: containerInfo,\n implementation: implementation\n };\n }\n function getCrossOriginStringAs(as, input) {\n if (\"font\" === as) return \"\";\n if (\"string\" === typeof input)\n return \"use-credentials\" === input ? input : \"\";\n }\n function getValueDescriptorExpectingObjectForWarning(thing) {\n return null === thing\n ? \"`null`\"\n : void 0 === thing\n ? \"`undefined`\"\n : \"\" === thing\n ? \"an empty string\"\n : 'something with type \"' + typeof thing + '\"';\n }\n function getValueDescriptorExpectingEnumForWarning(thing) {\n return null === thing\n ? \"`null`\"\n : void 0 === thing\n ? \"`undefined`\"\n : \"\" === thing\n ? \"an empty string\"\n : \"string\" === typeof thing\n ? JSON.stringify(thing)\n : \"number\" === typeof thing\n ? \"`\" + thing + \"`\"\n : 'something with type \"' + typeof thing + '\"';\n }\n function resolveDispatcher() {\n var dispatcher = ReactSharedInternals.H;\n null === dispatcher &&\n console.error(\n \"Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\\n1. You might have mismatching versions of React and the renderer (such as React DOM)\\n2. You might be breaking the Rules of Hooks\\n3. You might have more than one copy of React in the same app\\nSee https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.\"\n );\n return dispatcher;\n }\n \"undefined\" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&\n \"function\" ===\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart &&\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());\n var React = require(\"react\"),\n Internals = {\n d: {\n f: noop,\n r: function () {\n throw Error(\n \"Invalid form element. requestFormReset must be passed a form that was rendered by React.\"\n );\n },\n D: noop,\n C: noop,\n L: noop,\n m: noop,\n X: noop,\n S: noop,\n M: noop\n },\n p: 0,\n findDOMNode: null\n },\n REACT_PORTAL_TYPE = Symbol.for(\"react.portal\"),\n ReactSharedInternals =\n React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;\n (\"function\" === typeof Map &&\n null != Map.prototype &&\n \"function\" === typeof Map.prototype.forEach &&\n \"function\" === typeof Set &&\n null != Set.prototype &&\n \"function\" === typeof Set.prototype.clear &&\n \"function\" === typeof Set.prototype.forEach) ||\n console.error(\n \"React depends on Map and Set built-in types. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills\"\n );\n exports.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE =\n Internals;\n exports.createPortal = function (children, container) {\n var key =\n 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : null;\n if (\n !container ||\n (1 !== container.nodeType &&\n 9 !== container.nodeType &&\n 11 !== container.nodeType)\n )\n throw Error(\"Target container is not a DOM element.\");\n return createPortal$1(children, container, null, key);\n };\n exports.flushSync = function (fn) {\n var previousTransition = ReactSharedInternals.T,\n previousUpdatePriority = Internals.p;\n try {\n if (((ReactSharedInternals.T = null), (Internals.p = 2), fn))\n return fn();\n } finally {\n (ReactSharedInternals.T = previousTransition),\n (Internals.p = previousUpdatePriority),\n Internals.d.f() &&\n console.error(\n \"flushSync was called from inside a lifecycle method. React cannot flush when React is already rendering. Consider moving this call to a scheduler task or micro task.\"\n );\n }\n };\n exports.preconnect = function (href, options) {\n \"string\" === typeof href && href\n ? null != options && \"object\" !== typeof options\n ? console.error(\n \"ReactDOM.preconnect(): Expected the `options` argument (second) to be an object but encountered %s instead. The only supported option at this time is `crossOrigin` which accepts a string.\",\n getValueDescriptorExpectingEnumForWarning(options)\n )\n : null != options &&\n \"string\" !== typeof options.crossOrigin &&\n console.error(\n \"ReactDOM.preconnect(): Expected the `crossOrigin` option (second argument) to be a string but encountered %s instead. Try removing this option or passing a string value instead.\",\n getValueDescriptorExpectingObjectForWarning(options.crossOrigin)\n )\n : console.error(\n \"ReactDOM.preconnect(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.\",\n getValueDescriptorExpectingObjectForWarning(href)\n );\n \"string\" === typeof href &&\n (options\n ? ((options = options.crossOrigin),\n (options =\n \"string\" === typeof options\n ? \"use-credentials\" === options\n ? options\n : \"\"\n : void 0))\n : (options = null),\n Internals.d.C(href, options));\n };\n exports.prefetchDNS = function (href) {\n if (\"string\" !== typeof href || !href)\n console.error(\n \"ReactDOM.prefetchDNS(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.\",\n getValueDescriptorExpectingObjectForWarning(href)\n );\n else if (1 < arguments.length) {\n var options = arguments[1];\n \"object\" === typeof options && options.hasOwnProperty(\"crossOrigin\")\n ? console.error(\n \"ReactDOM.prefetchDNS(): Expected only one argument, `href`, but encountered %s as a second argument instead. This argument is reserved for future options and is currently disallowed. It looks like the you are attempting to set a crossOrigin property for this DNS lookup hint. Browsers do not perform DNS queries using CORS and setting this attribute on the resource hint has no effect. Try calling ReactDOM.prefetchDNS() with just a single string argument, `href`.\",\n getValueDescriptorExpectingEnumForWarning(options)\n )\n : console.error(\n \"ReactDOM.prefetchDNS(): Expected only one argument, `href`, but encountered %s as a second argument instead. This argument is reserved for future options and is currently disallowed. Try calling ReactDOM.prefetchDNS() with just a single string argument, `href`.\",\n getValueDescriptorExpectingEnumForWarning(options)\n );\n }\n \"string\" === typeof href && Internals.d.D(href);\n };\n exports.preinit = function (href, options) {\n \"string\" === typeof href && href\n ? null == options || \"object\" !== typeof options\n ? console.error(\n \"ReactDOM.preinit(): Expected the `options` argument (second) to be an object with an `as` property describing the type of resource to be preinitialized but encountered %s instead.\",\n getValueDescriptorExpectingEnumForWarning(options)\n )\n : \"style\" !== options.as &&\n \"script\" !== options.as &&\n console.error(\n 'ReactDOM.preinit(): Expected the `as` property in the `options` argument (second) to contain a valid value describing the type of resource to be preinitialized but encountered %s instead. Valid values for `as` are \"style\" and \"script\".',\n getValueDescriptorExpectingEnumForWarning(options.as)\n )\n : console.error(\n \"ReactDOM.preinit(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.\",\n getValueDescriptorExpectingObjectForWarning(href)\n );\n if (\n \"string\" === typeof href &&\n options &&\n \"string\" === typeof options.as\n ) {\n var as = options.as,\n crossOrigin = getCrossOriginStringAs(as, options.crossOrigin),\n integrity =\n \"string\" === typeof options.integrity ? options.integrity : void 0,\n fetchPriority =\n \"string\" === typeof options.fetchPriority\n ? options.fetchPriority\n : void 0;\n \"style\" === as\n ? Internals.d.S(\n href,\n \"string\" === typeof options.precedence\n ? options.precedence\n : void 0,\n {\n crossOrigin: crossOrigin,\n integrity: integrity,\n fetchPriority: fetchPriority\n }\n )\n : \"script\" === as &&\n Internals.d.X(href, {\n crossOrigin: crossOrigin,\n integrity: integrity,\n fetchPriority: fetchPriority,\n nonce: \"string\" === typeof options.nonce ? options.nonce : void 0\n });\n }\n };\n exports.preinitModule = function (href, options) {\n var encountered = \"\";\n (\"string\" === typeof href && href) ||\n (encountered +=\n \" The `href` argument encountered was \" +\n getValueDescriptorExpectingObjectForWarning(href) +\n \".\");\n void 0 !== options && \"object\" !== typeof options\n ? (encountered +=\n \" The `options` argument encountered was \" +\n getValueDescriptorExpectingObjectForWarning(options) +\n \".\")\n : options &&\n \"as\" in options &&\n \"script\" !== options.as &&\n (encountered +=\n \" The `as` option encountered was \" +\n getValueDescriptorExpectingEnumForWarning(options.as) +\n \".\");\n if (encountered)\n console.error(\n \"ReactDOM.preinitModule(): Expected up to two arguments, a non-empty `href` string and, optionally, an `options` object with a valid `as` property.%s\",\n encountered\n );\n else\n switch (\n ((encountered =\n options && \"string\" === typeof options.as ? options.as : \"script\"),\n encountered)\n ) {\n case \"script\":\n break;\n default:\n (encountered =\n getValueDescriptorExpectingEnumForWarning(encountered)),\n console.error(\n 'ReactDOM.preinitModule(): Currently the only supported \"as\" type for this function is \"script\" but received \"%s\" instead. This warning was generated for `href` \"%s\". In the future other module types will be supported, aligning with the import-attributes proposal. Learn more here: (https://github.com/tc39/proposal-import-attributes)',\n encountered,\n href\n );\n }\n if (\"string\" === typeof href)\n if (\"object\" === typeof options && null !== options) {\n if (null == options.as || \"script\" === options.as)\n (encountered = getCrossOriginStringAs(\n options.as,\n options.crossOrigin\n )),\n Internals.d.M(href, {\n crossOrigin: encountered,\n integrity:\n \"string\" === typeof options.integrity\n ? options.integrity\n : void 0,\n nonce:\n \"string\" === typeof options.nonce ? options.nonce : void 0\n });\n } else null == options && Internals.d.M(href);\n };\n exports.preload = function (href, options) {\n var encountered = \"\";\n (\"string\" === typeof href && href) ||\n (encountered +=\n \" The `href` argument encountered was \" +\n getValueDescriptorExpectingObjectForWarning(href) +\n \".\");\n null == options || \"object\" !== typeof options\n ? (encountered +=\n \" The `options` argument encountered was \" +\n getValueDescriptorExpectingObjectForWarning(options) +\n \".\")\n : (\"string\" === typeof options.as && options.as) ||\n (encountered +=\n \" The `as` option encountered was \" +\n getValueDescriptorExpectingObjectForWarning(options.as) +\n \".\");\n encountered &&\n console.error(\n 'ReactDOM.preload(): Expected two arguments, a non-empty `href` string and an `options` object with an `as` property valid for a `` tag.%s',\n encountered\n );\n if (\n \"string\" === typeof href &&\n \"object\" === typeof options &&\n null !== options &&\n \"string\" === typeof options.as\n ) {\n encountered = options.as;\n var crossOrigin = getCrossOriginStringAs(\n encountered,\n options.crossOrigin\n );\n Internals.d.L(href, encountered, {\n crossOrigin: crossOrigin,\n integrity:\n \"string\" === typeof options.integrity ? options.integrity : void 0,\n nonce: \"string\" === typeof options.nonce ? options.nonce : void 0,\n type: \"string\" === typeof options.type ? options.type : void 0,\n fetchPriority:\n \"string\" === typeof options.fetchPriority\n ? options.fetchPriority\n : void 0,\n referrerPolicy:\n \"string\" === typeof options.referrerPolicy\n ? options.referrerPolicy\n : void 0,\n imageSrcSet:\n \"string\" === typeof options.imageSrcSet\n ? options.imageSrcSet\n : void 0,\n imageSizes:\n \"string\" === typeof options.imageSizes\n ? options.imageSizes\n : void 0,\n media: \"string\" === typeof options.media ? options.media : void 0\n });\n }\n };\n exports.preloadModule = function (href, options) {\n var encountered = \"\";\n (\"string\" === typeof href && href) ||\n (encountered +=\n \" The `href` argument encountered was \" +\n getValueDescriptorExpectingObjectForWarning(href) +\n \".\");\n void 0 !== options && \"object\" !== typeof options\n ? (encountered +=\n \" The `options` argument encountered was \" +\n getValueDescriptorExpectingObjectForWarning(options) +\n \".\")\n : options &&\n \"as\" in options &&\n \"string\" !== typeof options.as &&\n (encountered +=\n \" The `as` option encountered was \" +\n getValueDescriptorExpectingObjectForWarning(options.as) +\n \".\");\n encountered &&\n console.error(\n 'ReactDOM.preloadModule(): Expected two arguments, a non-empty `href` string and, optionally, an `options` object with an `as` property valid for a `` tag.%s',\n encountered\n );\n \"string\" === typeof href &&\n (options\n ? ((encountered = getCrossOriginStringAs(\n options.as,\n options.crossOrigin\n )),\n Internals.d.m(href, {\n as:\n \"string\" === typeof options.as && \"script\" !== options.as\n ? options.as\n : void 0,\n crossOrigin: encountered,\n integrity:\n \"string\" === typeof options.integrity\n ? options.integrity\n : void 0\n }))\n : Internals.d.m(href));\n };\n exports.requestFormReset = function (form) {\n Internals.d.r(form);\n };\n exports.unstable_batchedUpdates = function (fn, a) {\n return fn(a);\n };\n exports.useFormState = function (action, initialState, permalink) {\n return resolveDispatcher().useFormState(action, initialState, permalink);\n };\n exports.useFormStatus = function () {\n return resolveDispatcher().useHostTransitionStatus();\n };\n exports.version = \"19.1.0\";\n \"undefined\" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&\n \"function\" ===\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());\n })();\n","'use strict';\n\nfunction checkDCE() {\n /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\n if (\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined' ||\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE !== 'function'\n ) {\n return;\n }\n if (process.env.NODE_ENV !== 'production') {\n // This branch is unreachable because this function is only called\n // in production, but the condition is true only in development.\n // Therefore if the branch is still here, dead code elimination wasn't\n // properly applied.\n // Don't change the message. React DevTools relies on it. Also make sure\n // this message doesn't occur elsewhere in this function, or it will cause\n // a false positive.\n throw new Error('^_^');\n }\n try {\n // Verify that the code above has been dead code eliminated (DCE'd).\n __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(checkDCE);\n } catch (err) {\n // DevTools shouldn't crash React, no matter what.\n // We should still report in case we break this code.\n console.error(err);\n }\n}\n\nif (process.env.NODE_ENV === 'production') {\n // DCE check should happen before ReactDOM bundle executes so that\n // DevTools can report bad minification during injection.\n checkDCE();\n module.exports = require('./cjs/react-dom.production.js');\n} else {\n module.exports = require('./cjs/react-dom.development.js');\n}\n","/**\n * @license React\n * react-dom-client.development.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n/*\n Modernizr 3.0.0pre (Custom Build) | MIT\n*/\n\"use strict\";\n\"production\" !== process.env.NODE_ENV &&\n (function () {\n function findHook(fiber, id) {\n for (fiber = fiber.memoizedState; null !== fiber && 0 < id; )\n (fiber = fiber.next), id--;\n return fiber;\n }\n function copyWithSetImpl(obj, path, index, value) {\n if (index >= path.length) return value;\n var key = path[index],\n updated = isArrayImpl(obj) ? obj.slice() : assign({}, obj);\n updated[key] = copyWithSetImpl(obj[key], path, index + 1, value);\n return updated;\n }\n function copyWithRename(obj, oldPath, newPath) {\n if (oldPath.length !== newPath.length)\n console.warn(\"copyWithRename() expects paths of the same length\");\n else {\n for (var i = 0; i < newPath.length - 1; i++)\n if (oldPath[i] !== newPath[i]) {\n console.warn(\n \"copyWithRename() expects paths to be the same except for the deepest key\"\n );\n return;\n }\n return copyWithRenameImpl(obj, oldPath, newPath, 0);\n }\n }\n function copyWithRenameImpl(obj, oldPath, newPath, index) {\n var oldKey = oldPath[index],\n updated = isArrayImpl(obj) ? obj.slice() : assign({}, obj);\n index + 1 === oldPath.length\n ? ((updated[newPath[index]] = updated[oldKey]),\n isArrayImpl(updated)\n ? updated.splice(oldKey, 1)\n : delete updated[oldKey])\n : (updated[oldKey] = copyWithRenameImpl(\n obj[oldKey],\n oldPath,\n newPath,\n index + 1\n ));\n return updated;\n }\n function copyWithDeleteImpl(obj, path, index) {\n var key = path[index],\n updated = isArrayImpl(obj) ? obj.slice() : assign({}, obj);\n if (index + 1 === path.length)\n return (\n isArrayImpl(updated) ? updated.splice(key, 1) : delete updated[key],\n updated\n );\n updated[key] = copyWithDeleteImpl(obj[key], path, index + 1);\n return updated;\n }\n function shouldSuspendImpl() {\n return !1;\n }\n function shouldErrorImpl() {\n return null;\n }\n function warnForMissingKey() {}\n function warnInvalidHookAccess() {\n console.error(\n \"Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks. You can only call Hooks at the top level of your React function. For more information, see https://react.dev/link/rules-of-hooks\"\n );\n }\n function warnInvalidContextAccess() {\n console.error(\n \"Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo().\"\n );\n }\n function noop$2() {}\n function setToSortedString(set) {\n var array = [];\n set.forEach(function (value) {\n array.push(value);\n });\n return array.sort().join(\", \");\n }\n function createFiber(tag, pendingProps, key, mode) {\n return new FiberNode(tag, pendingProps, key, mode);\n }\n function scheduleRoot(root, element) {\n root.context === emptyContextObject &&\n (updateContainerImpl(root.current, 2, element, root, null, null),\n flushSyncWork$1());\n }\n function scheduleRefresh(root, update) {\n if (null !== resolveFamily) {\n var staleFamilies = update.staleFamilies;\n update = update.updatedFamilies;\n flushPendingEffects();\n scheduleFibersWithFamiliesRecursively(\n root.current,\n update,\n staleFamilies\n );\n flushSyncWork$1();\n }\n }\n function setRefreshHandler(handler) {\n resolveFamily = handler;\n }\n function isValidContainer(node) {\n return !(\n !node ||\n (1 !== node.nodeType && 9 !== node.nodeType && 11 !== node.nodeType)\n );\n }\n function getNearestMountedFiber(fiber) {\n var node = fiber,\n nearestMounted = fiber;\n if (fiber.alternate) for (; node.return; ) node = node.return;\n else {\n fiber = node;\n do\n (node = fiber),\n 0 !== (node.flags & 4098) && (nearestMounted = node.return),\n (fiber = node.return);\n while (fiber);\n }\n return 3 === node.tag ? nearestMounted : null;\n }\n function getSuspenseInstanceFromFiber(fiber) {\n if (13 === fiber.tag) {\n var suspenseState = fiber.memoizedState;\n null === suspenseState &&\n ((fiber = fiber.alternate),\n null !== fiber && (suspenseState = fiber.memoizedState));\n if (null !== suspenseState) return suspenseState.dehydrated;\n }\n return null;\n }\n function assertIsMounted(fiber) {\n if (getNearestMountedFiber(fiber) !== fiber)\n throw Error(\"Unable to find node on an unmounted component.\");\n }\n function findCurrentFiberUsingSlowPath(fiber) {\n var alternate = fiber.alternate;\n if (!alternate) {\n alternate = getNearestMountedFiber(fiber);\n if (null === alternate)\n throw Error(\"Unable to find node on an unmounted component.\");\n return alternate !== fiber ? null : fiber;\n }\n for (var a = fiber, b = alternate; ; ) {\n var parentA = a.return;\n if (null === parentA) break;\n var parentB = parentA.alternate;\n if (null === parentB) {\n b = parentA.return;\n if (null !== b) {\n a = b;\n continue;\n }\n break;\n }\n if (parentA.child === parentB.child) {\n for (parentB = parentA.child; parentB; ) {\n if (parentB === a) return assertIsMounted(parentA), fiber;\n if (parentB === b) return assertIsMounted(parentA), alternate;\n parentB = parentB.sibling;\n }\n throw Error(\"Unable to find node on an unmounted component.\");\n }\n if (a.return !== b.return) (a = parentA), (b = parentB);\n else {\n for (var didFindChild = !1, _child = parentA.child; _child; ) {\n if (_child === a) {\n didFindChild = !0;\n a = parentA;\n b = parentB;\n break;\n }\n if (_child === b) {\n didFindChild = !0;\n b = parentA;\n a = parentB;\n break;\n }\n _child = _child.sibling;\n }\n if (!didFindChild) {\n for (_child = parentB.child; _child; ) {\n if (_child === a) {\n didFindChild = !0;\n a = parentB;\n b = parentA;\n break;\n }\n if (_child === b) {\n didFindChild = !0;\n b = parentB;\n a = parentA;\n break;\n }\n _child = _child.sibling;\n }\n if (!didFindChild)\n throw Error(\n \"Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue.\"\n );\n }\n }\n if (a.alternate !== b)\n throw Error(\n \"Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue.\"\n );\n }\n if (3 !== a.tag)\n throw Error(\"Unable to find node on an unmounted component.\");\n return a.stateNode.current === a ? fiber : alternate;\n }\n function findCurrentHostFiberImpl(node) {\n var tag = node.tag;\n if (5 === tag || 26 === tag || 27 === tag || 6 === tag) return node;\n for (node = node.child; null !== node; ) {\n tag = findCurrentHostFiberImpl(node);\n if (null !== tag) return tag;\n node = node.sibling;\n }\n return null;\n }\n function getIteratorFn(maybeIterable) {\n if (null === maybeIterable || \"object\" !== typeof maybeIterable)\n return null;\n maybeIterable =\n (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) ||\n maybeIterable[\"@@iterator\"];\n return \"function\" === typeof maybeIterable ? maybeIterable : null;\n }\n function getComponentNameFromType(type) {\n if (null == type) return null;\n if (\"function\" === typeof type)\n return type.$$typeof === REACT_CLIENT_REFERENCE\n ? null\n : type.displayName || type.name || null;\n if (\"string\" === typeof type) return type;\n switch (type) {\n case REACT_FRAGMENT_TYPE:\n return \"Fragment\";\n case REACT_PROFILER_TYPE:\n return \"Profiler\";\n case REACT_STRICT_MODE_TYPE:\n return \"StrictMode\";\n case REACT_SUSPENSE_TYPE:\n return \"Suspense\";\n case REACT_SUSPENSE_LIST_TYPE:\n return \"SuspenseList\";\n case REACT_ACTIVITY_TYPE:\n return \"Activity\";\n }\n if (\"object\" === typeof type)\n switch (\n (\"number\" === typeof type.tag &&\n console.error(\n \"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.\"\n ),\n type.$$typeof)\n ) {\n case REACT_PORTAL_TYPE:\n return \"Portal\";\n case REACT_CONTEXT_TYPE:\n return (type.displayName || \"Context\") + \".Provider\";\n case REACT_CONSUMER_TYPE:\n return (type._context.displayName || \"Context\") + \".Consumer\";\n case REACT_FORWARD_REF_TYPE:\n var innerType = type.render;\n type = type.displayName;\n type ||\n ((type = innerType.displayName || innerType.name || \"\"),\n (type = \"\" !== type ? \"ForwardRef(\" + type + \")\" : \"ForwardRef\"));\n return type;\n case REACT_MEMO_TYPE:\n return (\n (innerType = type.displayName || null),\n null !== innerType\n ? innerType\n : getComponentNameFromType(type.type) || \"Memo\"\n );\n case REACT_LAZY_TYPE:\n innerType = type._payload;\n type = type._init;\n try {\n return getComponentNameFromType(type(innerType));\n } catch (x) {}\n }\n return null;\n }\n function getComponentNameFromOwner(owner) {\n return \"number\" === typeof owner.tag\n ? getComponentNameFromFiber(owner)\n : \"string\" === typeof owner.name\n ? owner.name\n : null;\n }\n function getComponentNameFromFiber(fiber) {\n var type = fiber.type;\n switch (fiber.tag) {\n case 31:\n return \"Activity\";\n case 24:\n return \"Cache\";\n case 9:\n return (type._context.displayName || \"Context\") + \".Consumer\";\n case 10:\n return (type.displayName || \"Context\") + \".Provider\";\n case 18:\n return \"DehydratedFragment\";\n case 11:\n return (\n (fiber = type.render),\n (fiber = fiber.displayName || fiber.name || \"\"),\n type.displayName ||\n (\"\" !== fiber ? \"ForwardRef(\" + fiber + \")\" : \"ForwardRef\")\n );\n case 7:\n return \"Fragment\";\n case 26:\n case 27:\n case 5:\n return type;\n case 4:\n return \"Portal\";\n case 3:\n return \"Root\";\n case 6:\n return \"Text\";\n case 16:\n return getComponentNameFromType(type);\n case 8:\n return type === REACT_STRICT_MODE_TYPE ? \"StrictMode\" : \"Mode\";\n case 22:\n return \"Offscreen\";\n case 12:\n return \"Profiler\";\n case 21:\n return \"Scope\";\n case 13:\n return \"Suspense\";\n case 19:\n return \"SuspenseList\";\n case 25:\n return \"TracingMarker\";\n case 1:\n case 0:\n case 14:\n case 15:\n if (\"function\" === typeof type)\n return type.displayName || type.name || null;\n if (\"string\" === typeof type) return type;\n break;\n case 29:\n type = fiber._debugInfo;\n if (null != type)\n for (var i = type.length - 1; 0 <= i; i--)\n if (\"string\" === typeof type[i].name) return type[i].name;\n if (null !== fiber.return)\n return getComponentNameFromFiber(fiber.return);\n }\n return null;\n }\n function createCursor(defaultValue) {\n return { current: defaultValue };\n }\n function pop(cursor, fiber) {\n 0 > index$jscomp$0\n ? console.error(\"Unexpected pop.\")\n : (fiber !== fiberStack[index$jscomp$0] &&\n console.error(\"Unexpected Fiber popped.\"),\n (cursor.current = valueStack[index$jscomp$0]),\n (valueStack[index$jscomp$0] = null),\n (fiberStack[index$jscomp$0] = null),\n index$jscomp$0--);\n }\n function push(cursor, value, fiber) {\n index$jscomp$0++;\n valueStack[index$jscomp$0] = cursor.current;\n fiberStack[index$jscomp$0] = fiber;\n cursor.current = value;\n }\n function requiredContext(c) {\n null === c &&\n console.error(\n \"Expected host context to exist. This error is likely caused by a bug in React. Please file an issue.\"\n );\n return c;\n }\n function pushHostContainer(fiber, nextRootInstance) {\n push(rootInstanceStackCursor, nextRootInstance, fiber);\n push(contextFiberStackCursor, fiber, fiber);\n push(contextStackCursor, null, fiber);\n var nextRootContext = nextRootInstance.nodeType;\n switch (nextRootContext) {\n case 9:\n case 11:\n nextRootContext = 9 === nextRootContext ? \"#document\" : \"#fragment\";\n nextRootInstance = (nextRootInstance =\n nextRootInstance.documentElement)\n ? (nextRootInstance = nextRootInstance.namespaceURI)\n ? getOwnHostContext(nextRootInstance)\n : HostContextNamespaceNone\n : HostContextNamespaceNone;\n break;\n default:\n if (\n ((nextRootContext = nextRootInstance.tagName),\n (nextRootInstance = nextRootInstance.namespaceURI))\n )\n (nextRootInstance = getOwnHostContext(nextRootInstance)),\n (nextRootInstance = getChildHostContextProd(\n nextRootInstance,\n nextRootContext\n ));\n else\n switch (nextRootContext) {\n case \"svg\":\n nextRootInstance = HostContextNamespaceSvg;\n break;\n case \"math\":\n nextRootInstance = HostContextNamespaceMath;\n break;\n default:\n nextRootInstance = HostContextNamespaceNone;\n }\n }\n nextRootContext = nextRootContext.toLowerCase();\n nextRootContext = updatedAncestorInfoDev(null, nextRootContext);\n nextRootContext = {\n context: nextRootInstance,\n ancestorInfo: nextRootContext\n };\n pop(contextStackCursor, fiber);\n push(contextStackCursor, nextRootContext, fiber);\n }\n function popHostContainer(fiber) {\n pop(contextStackCursor, fiber);\n pop(contextFiberStackCursor, fiber);\n pop(rootInstanceStackCursor, fiber);\n }\n function getHostContext() {\n return requiredContext(contextStackCursor.current);\n }\n function pushHostContext(fiber) {\n null !== fiber.memoizedState &&\n push(hostTransitionProviderCursor, fiber, fiber);\n var context = requiredContext(contextStackCursor.current);\n var type = fiber.type;\n var nextContext = getChildHostContextProd(context.context, type);\n type = updatedAncestorInfoDev(context.ancestorInfo, type);\n nextContext = { context: nextContext, ancestorInfo: type };\n context !== nextContext &&\n (push(contextFiberStackCursor, fiber, fiber),\n push(contextStackCursor, nextContext, fiber));\n }\n function popHostContext(fiber) {\n contextFiberStackCursor.current === fiber &&\n (pop(contextStackCursor, fiber), pop(contextFiberStackCursor, fiber));\n hostTransitionProviderCursor.current === fiber &&\n (pop(hostTransitionProviderCursor, fiber),\n (HostTransitionContext._currentValue = NotPendingTransition));\n }\n function typeName(value) {\n return (\n (\"function\" === typeof Symbol &&\n Symbol.toStringTag &&\n value[Symbol.toStringTag]) ||\n value.constructor.name ||\n \"Object\"\n );\n }\n function willCoercionThrow(value) {\n try {\n return testStringCoercion(value), !1;\n } catch (e) {\n return !0;\n }\n }\n function testStringCoercion(value) {\n return \"\" + value;\n }\n function checkAttributeStringCoercion(value, attributeName) {\n if (willCoercionThrow(value))\n return (\n console.error(\n \"The provided `%s` attribute is an unsupported type %s. This value must be coerced to a string before using it here.\",\n attributeName,\n typeName(value)\n ),\n testStringCoercion(value)\n );\n }\n function checkCSSPropertyStringCoercion(value, propName) {\n if (willCoercionThrow(value))\n return (\n console.error(\n \"The provided `%s` CSS property is an unsupported type %s. This value must be coerced to a string before using it here.\",\n propName,\n typeName(value)\n ),\n testStringCoercion(value)\n );\n }\n function checkFormFieldValueStringCoercion(value) {\n if (willCoercionThrow(value))\n return (\n console.error(\n \"Form field values (value, checked, defaultValue, or defaultChecked props) must be strings, not %s. This value must be coerced to a string before using it here.\",\n typeName(value)\n ),\n testStringCoercion(value)\n );\n }\n function injectInternals(internals) {\n if (\"undefined\" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) return !1;\n var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__;\n if (hook.isDisabled) return !0;\n if (!hook.supportsFiber)\n return (\n console.error(\n \"The installed version of React DevTools is too old and will not work with the current version of React. Please update React DevTools. https://react.dev/link/react-devtools\"\n ),\n !0\n );\n try {\n (rendererID = hook.inject(internals)), (injectedHook = hook);\n } catch (err) {\n console.error(\"React instrumentation encountered an error: %s.\", err);\n }\n return hook.checkDCE ? !0 : !1;\n }\n function setIsStrictModeForDevtools(newIsStrictMode) {\n \"function\" === typeof log$1 &&\n unstable_setDisableYieldValue(newIsStrictMode);\n if (injectedHook && \"function\" === typeof injectedHook.setStrictMode)\n try {\n injectedHook.setStrictMode(rendererID, newIsStrictMode);\n } catch (err) {\n hasLoggedError ||\n ((hasLoggedError = !0),\n console.error(\n \"React instrumentation encountered an error: %s\",\n err\n ));\n }\n }\n function injectProfilingHooks(profilingHooks) {\n injectedProfilingHooks = profilingHooks;\n }\n function markCommitStopped() {\n null !== injectedProfilingHooks &&\n \"function\" === typeof injectedProfilingHooks.markCommitStopped &&\n injectedProfilingHooks.markCommitStopped();\n }\n function markComponentRenderStarted(fiber) {\n null !== injectedProfilingHooks &&\n \"function\" ===\n typeof injectedProfilingHooks.markComponentRenderStarted &&\n injectedProfilingHooks.markComponentRenderStarted(fiber);\n }\n function markComponentRenderStopped() {\n null !== injectedProfilingHooks &&\n \"function\" ===\n typeof injectedProfilingHooks.markComponentRenderStopped &&\n injectedProfilingHooks.markComponentRenderStopped();\n }\n function markRenderStarted(lanes) {\n null !== injectedProfilingHooks &&\n \"function\" === typeof injectedProfilingHooks.markRenderStarted &&\n injectedProfilingHooks.markRenderStarted(lanes);\n }\n function markRenderStopped() {\n null !== injectedProfilingHooks &&\n \"function\" === typeof injectedProfilingHooks.markRenderStopped &&\n injectedProfilingHooks.markRenderStopped();\n }\n function markStateUpdateScheduled(fiber, lane) {\n null !== injectedProfilingHooks &&\n \"function\" === typeof injectedProfilingHooks.markStateUpdateScheduled &&\n injectedProfilingHooks.markStateUpdateScheduled(fiber, lane);\n }\n function clz32Fallback(x) {\n x >>>= 0;\n return 0 === x ? 32 : (31 - ((log(x) / LN2) | 0)) | 0;\n }\n function getLabelForLane(lane) {\n if (lane & 1) return \"SyncHydrationLane\";\n if (lane & 2) return \"Sync\";\n if (lane & 4) return \"InputContinuousHydration\";\n if (lane & 8) return \"InputContinuous\";\n if (lane & 16) return \"DefaultHydration\";\n if (lane & 32) return \"Default\";\n if (lane & 128) return \"TransitionHydration\";\n if (lane & 4194048) return \"Transition\";\n if (lane & 62914560) return \"Retry\";\n if (lane & 67108864) return \"SelectiveHydration\";\n if (lane & 134217728) return \"IdleHydration\";\n if (lane & 268435456) return \"Idle\";\n if (lane & 536870912) return \"Offscreen\";\n if (lane & 1073741824) return \"Deferred\";\n }\n function getHighestPriorityLanes(lanes) {\n var pendingSyncLanes = lanes & 42;\n if (0 !== pendingSyncLanes) return pendingSyncLanes;\n switch (lanes & -lanes) {\n case 1:\n return 1;\n case 2:\n return 2;\n case 4:\n return 4;\n case 8:\n return 8;\n case 16:\n return 16;\n case 32:\n return 32;\n case 64:\n return 64;\n case 128:\n return 128;\n case 256:\n case 512:\n case 1024:\n case 2048:\n case 4096:\n case 8192:\n case 16384:\n case 32768:\n case 65536:\n case 131072:\n case 262144:\n case 524288:\n case 1048576:\n case 2097152:\n return lanes & 4194048;\n case 4194304:\n case 8388608:\n case 16777216:\n case 33554432:\n return lanes & 62914560;\n case 67108864:\n return 67108864;\n case 134217728:\n return 134217728;\n case 268435456:\n return 268435456;\n case 536870912:\n return 536870912;\n case 1073741824:\n return 0;\n default:\n return (\n console.error(\n \"Should have found matching lanes. This is a bug in React.\"\n ),\n lanes\n );\n }\n }\n function getNextLanes(root, wipLanes, rootHasPendingCommit) {\n var pendingLanes = root.pendingLanes;\n if (0 === pendingLanes) return 0;\n var nextLanes = 0,\n suspendedLanes = root.suspendedLanes,\n pingedLanes = root.pingedLanes;\n root = root.warmLanes;\n var nonIdlePendingLanes = pendingLanes & 134217727;\n 0 !== nonIdlePendingLanes\n ? ((pendingLanes = nonIdlePendingLanes & ~suspendedLanes),\n 0 !== pendingLanes\n ? (nextLanes = getHighestPriorityLanes(pendingLanes))\n : ((pingedLanes &= nonIdlePendingLanes),\n 0 !== pingedLanes\n ? (nextLanes = getHighestPriorityLanes(pingedLanes))\n : rootHasPendingCommit ||\n ((rootHasPendingCommit = nonIdlePendingLanes & ~root),\n 0 !== rootHasPendingCommit &&\n (nextLanes =\n getHighestPriorityLanes(rootHasPendingCommit)))))\n : ((nonIdlePendingLanes = pendingLanes & ~suspendedLanes),\n 0 !== nonIdlePendingLanes\n ? (nextLanes = getHighestPriorityLanes(nonIdlePendingLanes))\n : 0 !== pingedLanes\n ? (nextLanes = getHighestPriorityLanes(pingedLanes))\n : rootHasPendingCommit ||\n ((rootHasPendingCommit = pendingLanes & ~root),\n 0 !== rootHasPendingCommit &&\n (nextLanes = getHighestPriorityLanes(rootHasPendingCommit))));\n return 0 === nextLanes\n ? 0\n : 0 !== wipLanes &&\n wipLanes !== nextLanes &&\n 0 === (wipLanes & suspendedLanes) &&\n ((suspendedLanes = nextLanes & -nextLanes),\n (rootHasPendingCommit = wipLanes & -wipLanes),\n suspendedLanes >= rootHasPendingCommit ||\n (32 === suspendedLanes && 0 !== (rootHasPendingCommit & 4194048)))\n ? wipLanes\n : nextLanes;\n }\n function checkIfRootIsPrerendering(root, renderLanes) {\n return (\n 0 ===\n (root.pendingLanes &\n ~(root.suspendedLanes & ~root.pingedLanes) &\n renderLanes)\n );\n }\n function computeExpirationTime(lane, currentTime) {\n switch (lane) {\n case 1:\n case 2:\n case 4:\n case 8:\n case 64:\n return currentTime + 250;\n case 16:\n case 32:\n case 128:\n case 256:\n case 512:\n case 1024:\n case 2048:\n case 4096:\n case 8192:\n case 16384:\n case 32768:\n case 65536:\n case 131072:\n case 262144:\n case 524288:\n case 1048576:\n case 2097152:\n return currentTime + 5e3;\n case 4194304:\n case 8388608:\n case 16777216:\n case 33554432:\n return -1;\n case 67108864:\n case 134217728:\n case 268435456:\n case 536870912:\n case 1073741824:\n return -1;\n default:\n return (\n console.error(\n \"Should have found matching lanes. This is a bug in React.\"\n ),\n -1\n );\n }\n }\n function claimNextTransitionLane() {\n var lane = nextTransitionLane;\n nextTransitionLane <<= 1;\n 0 === (nextTransitionLane & 4194048) && (nextTransitionLane = 256);\n return lane;\n }\n function claimNextRetryLane() {\n var lane = nextRetryLane;\n nextRetryLane <<= 1;\n 0 === (nextRetryLane & 62914560) && (nextRetryLane = 4194304);\n return lane;\n }\n function createLaneMap(initial) {\n for (var laneMap = [], i = 0; 31 > i; i++) laneMap.push(initial);\n return laneMap;\n }\n function markRootUpdated$1(root, updateLane) {\n root.pendingLanes |= updateLane;\n 268435456 !== updateLane &&\n ((root.suspendedLanes = 0),\n (root.pingedLanes = 0),\n (root.warmLanes = 0));\n }\n function markRootFinished(\n root,\n finishedLanes,\n remainingLanes,\n spawnedLane,\n updatedLanes,\n suspendedRetryLanes\n ) {\n var previouslyPendingLanes = root.pendingLanes;\n root.pendingLanes = remainingLanes;\n root.suspendedLanes = 0;\n root.pingedLanes = 0;\n root.warmLanes = 0;\n root.expiredLanes &= remainingLanes;\n root.entangledLanes &= remainingLanes;\n root.errorRecoveryDisabledLanes &= remainingLanes;\n root.shellSuspendCounter = 0;\n var entanglements = root.entanglements,\n expirationTimes = root.expirationTimes,\n hiddenUpdates = root.hiddenUpdates;\n for (\n remainingLanes = previouslyPendingLanes & ~remainingLanes;\n 0 < remainingLanes;\n\n ) {\n var index = 31 - clz32(remainingLanes),\n lane = 1 << index;\n entanglements[index] = 0;\n expirationTimes[index] = -1;\n var hiddenUpdatesForLane = hiddenUpdates[index];\n if (null !== hiddenUpdatesForLane)\n for (\n hiddenUpdates[index] = null, index = 0;\n index < hiddenUpdatesForLane.length;\n index++\n ) {\n var update = hiddenUpdatesForLane[index];\n null !== update && (update.lane &= -536870913);\n }\n remainingLanes &= ~lane;\n }\n 0 !== spawnedLane && markSpawnedDeferredLane(root, spawnedLane, 0);\n 0 !== suspendedRetryLanes &&\n 0 === updatedLanes &&\n 0 !== root.tag &&\n (root.suspendedLanes |=\n suspendedRetryLanes & ~(previouslyPendingLanes & ~finishedLanes));\n }\n function markSpawnedDeferredLane(root, spawnedLane, entangledLanes) {\n root.pendingLanes |= spawnedLane;\n root.suspendedLanes &= ~spawnedLane;\n var spawnedLaneIndex = 31 - clz32(spawnedLane);\n root.entangledLanes |= spawnedLane;\n root.entanglements[spawnedLaneIndex] =\n root.entanglements[spawnedLaneIndex] |\n 1073741824 |\n (entangledLanes & 4194090);\n }\n function markRootEntangled(root, entangledLanes) {\n var rootEntangledLanes = (root.entangledLanes |= entangledLanes);\n for (root = root.entanglements; rootEntangledLanes; ) {\n var index = 31 - clz32(rootEntangledLanes),\n lane = 1 << index;\n (lane & entangledLanes) | (root[index] & entangledLanes) &&\n (root[index] |= entangledLanes);\n rootEntangledLanes &= ~lane;\n }\n }\n function getBumpedLaneForHydrationByLane(lane) {\n switch (lane) {\n case 2:\n lane = 1;\n break;\n case 8:\n lane = 4;\n break;\n case 32:\n lane = 16;\n break;\n case 256:\n case 512:\n case 1024:\n case 2048:\n case 4096:\n case 8192:\n case 16384:\n case 32768:\n case 65536:\n case 131072:\n case 262144:\n case 524288:\n case 1048576:\n case 2097152:\n case 4194304:\n case 8388608:\n case 16777216:\n case 33554432:\n lane = 128;\n break;\n case 268435456:\n lane = 134217728;\n break;\n default:\n lane = 0;\n }\n return lane;\n }\n function addFiberToLanesMap(root, fiber, lanes) {\n if (isDevToolsPresent)\n for (root = root.pendingUpdatersLaneMap; 0 < lanes; ) {\n var index = 31 - clz32(lanes),\n lane = 1 << index;\n root[index].add(fiber);\n lanes &= ~lane;\n }\n }\n function movePendingFibersToMemoized(root, lanes) {\n if (isDevToolsPresent)\n for (\n var pendingUpdatersLaneMap = root.pendingUpdatersLaneMap,\n memoizedUpdaters = root.memoizedUpdaters;\n 0 < lanes;\n\n ) {\n var index = 31 - clz32(lanes);\n root = 1 << index;\n index = pendingUpdatersLaneMap[index];\n 0 < index.size &&\n (index.forEach(function (fiber) {\n var alternate = fiber.alternate;\n (null !== alternate && memoizedUpdaters.has(alternate)) ||\n memoizedUpdaters.add(fiber);\n }),\n index.clear());\n lanes &= ~root;\n }\n }\n function lanesToEventPriority(lanes) {\n lanes &= -lanes;\n return 0 !== DiscreteEventPriority && DiscreteEventPriority < lanes\n ? 0 !== ContinuousEventPriority && ContinuousEventPriority < lanes\n ? 0 !== (lanes & 134217727)\n ? DefaultEventPriority\n : IdleEventPriority\n : ContinuousEventPriority\n : DiscreteEventPriority;\n }\n function resolveUpdatePriority() {\n var updatePriority = ReactDOMSharedInternals.p;\n if (0 !== updatePriority) return updatePriority;\n updatePriority = window.event;\n return void 0 === updatePriority\n ? DefaultEventPriority\n : getEventPriority(updatePriority.type);\n }\n function runWithPriority(priority, fn) {\n var previousPriority = ReactDOMSharedInternals.p;\n try {\n return (ReactDOMSharedInternals.p = priority), fn();\n } finally {\n ReactDOMSharedInternals.p = previousPriority;\n }\n }\n function detachDeletedInstance(node) {\n delete node[internalInstanceKey];\n delete node[internalPropsKey];\n delete node[internalEventHandlersKey];\n delete node[internalEventHandlerListenersKey];\n delete node[internalEventHandlesSetKey];\n }\n function getClosestInstanceFromNode(targetNode) {\n var targetInst = targetNode[internalInstanceKey];\n if (targetInst) return targetInst;\n for (var parentNode = targetNode.parentNode; parentNode; ) {\n if (\n (targetInst =\n parentNode[internalContainerInstanceKey] ||\n parentNode[internalInstanceKey])\n ) {\n parentNode = targetInst.alternate;\n if (\n null !== targetInst.child ||\n (null !== parentNode && null !== parentNode.child)\n )\n for (\n targetNode = getParentSuspenseInstance(targetNode);\n null !== targetNode;\n\n ) {\n if ((parentNode = targetNode[internalInstanceKey]))\n return parentNode;\n targetNode = getParentSuspenseInstance(targetNode);\n }\n return targetInst;\n }\n targetNode = parentNode;\n parentNode = targetNode.parentNode;\n }\n return null;\n }\n function getInstanceFromNode(node) {\n if (\n (node = node[internalInstanceKey] || node[internalContainerInstanceKey])\n ) {\n var tag = node.tag;\n if (\n 5 === tag ||\n 6 === tag ||\n 13 === tag ||\n 26 === tag ||\n 27 === tag ||\n 3 === tag\n )\n return node;\n }\n return null;\n }\n function getNodeFromInstance(inst) {\n var tag = inst.tag;\n if (5 === tag || 26 === tag || 27 === tag || 6 === tag)\n return inst.stateNode;\n throw Error(\"getNodeFromInstance: Invalid argument.\");\n }\n function getResourcesFromRoot(root) {\n var resources = root[internalRootNodeResourcesKey];\n resources ||\n (resources = root[internalRootNodeResourcesKey] =\n { hoistableStyles: new Map(), hoistableScripts: new Map() });\n return resources;\n }\n function markNodeAsHoistable(node) {\n node[internalHoistableMarker] = !0;\n }\n function registerTwoPhaseEvent(registrationName, dependencies) {\n registerDirectEvent(registrationName, dependencies);\n registerDirectEvent(registrationName + \"Capture\", dependencies);\n }\n function registerDirectEvent(registrationName, dependencies) {\n registrationNameDependencies[registrationName] &&\n console.error(\n \"EventRegistry: More than one plugin attempted to publish the same registration name, `%s`.\",\n registrationName\n );\n registrationNameDependencies[registrationName] = dependencies;\n var lowerCasedName = registrationName.toLowerCase();\n possibleRegistrationNames[lowerCasedName] = registrationName;\n \"onDoubleClick\" === registrationName &&\n (possibleRegistrationNames.ondblclick = registrationName);\n for (\n registrationName = 0;\n registrationName < dependencies.length;\n registrationName++\n )\n allNativeEvents.add(dependencies[registrationName]);\n }\n function checkControlledValueProps(tagName, props) {\n hasReadOnlyValue[props.type] ||\n props.onChange ||\n props.onInput ||\n props.readOnly ||\n props.disabled ||\n null == props.value ||\n (\"select\" === tagName\n ? console.error(\n \"You provided a `value` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultValue`. Otherwise, set `onChange`.\"\n )\n : console.error(\n \"You provided a `value` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultValue`. Otherwise, set either `onChange` or `readOnly`.\"\n ));\n props.onChange ||\n props.readOnly ||\n props.disabled ||\n null == props.checked ||\n console.error(\n \"You provided a `checked` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultChecked`. Otherwise, set either `onChange` or `readOnly`.\"\n );\n }\n function isAttributeNameSafe(attributeName) {\n if (hasOwnProperty.call(validatedAttributeNameCache, attributeName))\n return !0;\n if (hasOwnProperty.call(illegalAttributeNameCache, attributeName))\n return !1;\n if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName))\n return (validatedAttributeNameCache[attributeName] = !0);\n illegalAttributeNameCache[attributeName] = !0;\n console.error(\"Invalid attribute name: `%s`\", attributeName);\n return !1;\n }\n function getValueForAttributeOnCustomComponent(node, name, expected) {\n if (isAttributeNameSafe(name)) {\n if (!node.hasAttribute(name)) {\n switch (typeof expected) {\n case \"symbol\":\n case \"object\":\n return expected;\n case \"function\":\n return expected;\n case \"boolean\":\n if (!1 === expected) return expected;\n }\n return void 0 === expected ? void 0 : null;\n }\n node = node.getAttribute(name);\n if (\"\" === node && !0 === expected) return !0;\n checkAttributeStringCoercion(expected, name);\n return node === \"\" + expected ? expected : node;\n }\n }\n function setValueForAttribute(node, name, value) {\n if (isAttributeNameSafe(name))\n if (null === value) node.removeAttribute(name);\n else {\n switch (typeof value) {\n case \"undefined\":\n case \"function\":\n case \"symbol\":\n node.removeAttribute(name);\n return;\n case \"boolean\":\n var prefix = name.toLowerCase().slice(0, 5);\n if (\"data-\" !== prefix && \"aria-\" !== prefix) {\n node.removeAttribute(name);\n return;\n }\n }\n checkAttributeStringCoercion(value, name);\n node.setAttribute(name, \"\" + value);\n }\n }\n function setValueForKnownAttribute(node, name, value) {\n if (null === value) node.removeAttribute(name);\n else {\n switch (typeof value) {\n case \"undefined\":\n case \"function\":\n case \"symbol\":\n case \"boolean\":\n node.removeAttribute(name);\n return;\n }\n checkAttributeStringCoercion(value, name);\n node.setAttribute(name, \"\" + value);\n }\n }\n function setValueForNamespacedAttribute(node, namespace, name, value) {\n if (null === value) node.removeAttribute(name);\n else {\n switch (typeof value) {\n case \"undefined\":\n case \"function\":\n case \"symbol\":\n case \"boolean\":\n node.removeAttribute(name);\n return;\n }\n checkAttributeStringCoercion(value, name);\n node.setAttributeNS(namespace, name, \"\" + value);\n }\n }\n function disabledLog() {}\n function disableLogs() {\n if (0 === disabledDepth) {\n prevLog = console.log;\n prevInfo = console.info;\n prevWarn = console.warn;\n prevError = console.error;\n prevGroup = console.group;\n prevGroupCollapsed = console.groupCollapsed;\n prevGroupEnd = console.groupEnd;\n var props = {\n configurable: !0,\n enumerable: !0,\n value: disabledLog,\n writable: !0\n };\n Object.defineProperties(console, {\n info: props,\n log: props,\n warn: props,\n error: props,\n group: props,\n groupCollapsed: props,\n groupEnd: props\n });\n }\n disabledDepth++;\n }\n function reenableLogs() {\n disabledDepth--;\n if (0 === disabledDepth) {\n var props = { configurable: !0, enumerable: !0, writable: !0 };\n Object.defineProperties(console, {\n log: assign({}, props, { value: prevLog }),\n info: assign({}, props, { value: prevInfo }),\n warn: assign({}, props, { value: prevWarn }),\n error: assign({}, props, { value: prevError }),\n group: assign({}, props, { value: prevGroup }),\n groupCollapsed: assign({}, props, { value: prevGroupCollapsed }),\n groupEnd: assign({}, props, { value: prevGroupEnd })\n });\n }\n 0 > disabledDepth &&\n console.error(\n \"disabledDepth fell below zero. This is a bug in React. Please file an issue.\"\n );\n }\n function describeBuiltInComponentFrame(name) {\n if (void 0 === prefix)\n try {\n throw Error();\n } catch (x) {\n var match = x.stack.trim().match(/\\n( *(at )?)/);\n prefix = (match && match[1]) || \"\";\n suffix =\n -1 < x.stack.indexOf(\"\\n at\")\n ? \" ()\"\n : -1 < x.stack.indexOf(\"@\")\n ? \"@unknown:0:0\"\n : \"\";\n }\n return \"\\n\" + prefix + name + suffix;\n }\n function describeNativeComponentFrame(fn, construct) {\n if (!fn || reentry) return \"\";\n var frame = componentFrameCache.get(fn);\n if (void 0 !== frame) return frame;\n reentry = !0;\n frame = Error.prepareStackTrace;\n Error.prepareStackTrace = void 0;\n var previousDispatcher = null;\n previousDispatcher = ReactSharedInternals.H;\n ReactSharedInternals.H = null;\n disableLogs();\n try {\n var RunInRootFrame = {\n DetermineComponentFrameRoot: function () {\n try {\n if (construct) {\n var Fake = function () {\n throw Error();\n };\n Object.defineProperty(Fake.prototype, \"props\", {\n set: function () {\n throw Error();\n }\n });\n if (\"object\" === typeof Reflect && Reflect.construct) {\n try {\n Reflect.construct(Fake, []);\n } catch (x) {\n var control = x;\n }\n Reflect.construct(fn, [], Fake);\n } else {\n try {\n Fake.call();\n } catch (x$0) {\n control = x$0;\n }\n fn.call(Fake.prototype);\n }\n } else {\n try {\n throw Error();\n } catch (x$1) {\n control = x$1;\n }\n (Fake = fn()) &&\n \"function\" === typeof Fake.catch &&\n Fake.catch(function () {});\n }\n } catch (sample) {\n if (sample && control && \"string\" === typeof sample.stack)\n return [sample.stack, control.stack];\n }\n return [null, null];\n }\n };\n RunInRootFrame.DetermineComponentFrameRoot.displayName =\n \"DetermineComponentFrameRoot\";\n var namePropDescriptor = Object.getOwnPropertyDescriptor(\n RunInRootFrame.DetermineComponentFrameRoot,\n \"name\"\n );\n namePropDescriptor &&\n namePropDescriptor.configurable &&\n Object.defineProperty(\n RunInRootFrame.DetermineComponentFrameRoot,\n \"name\",\n { value: \"DetermineComponentFrameRoot\" }\n );\n var _RunInRootFrame$Deter =\n RunInRootFrame.DetermineComponentFrameRoot(),\n sampleStack = _RunInRootFrame$Deter[0],\n controlStack = _RunInRootFrame$Deter[1];\n if (sampleStack && controlStack) {\n var sampleLines = sampleStack.split(\"\\n\"),\n controlLines = controlStack.split(\"\\n\");\n for (\n _RunInRootFrame$Deter = namePropDescriptor = 0;\n namePropDescriptor < sampleLines.length &&\n !sampleLines[namePropDescriptor].includes(\n \"DetermineComponentFrameRoot\"\n );\n\n )\n namePropDescriptor++;\n for (\n ;\n _RunInRootFrame$Deter < controlLines.length &&\n !controlLines[_RunInRootFrame$Deter].includes(\n \"DetermineComponentFrameRoot\"\n );\n\n )\n _RunInRootFrame$Deter++;\n if (\n namePropDescriptor === sampleLines.length ||\n _RunInRootFrame$Deter === controlLines.length\n )\n for (\n namePropDescriptor = sampleLines.length - 1,\n _RunInRootFrame$Deter = controlLines.length - 1;\n 1 <= namePropDescriptor &&\n 0 <= _RunInRootFrame$Deter &&\n sampleLines[namePropDescriptor] !==\n controlLines[_RunInRootFrame$Deter];\n\n )\n _RunInRootFrame$Deter--;\n for (\n ;\n 1 <= namePropDescriptor && 0 <= _RunInRootFrame$Deter;\n namePropDescriptor--, _RunInRootFrame$Deter--\n )\n if (\n sampleLines[namePropDescriptor] !==\n controlLines[_RunInRootFrame$Deter]\n ) {\n if (1 !== namePropDescriptor || 1 !== _RunInRootFrame$Deter) {\n do\n if (\n (namePropDescriptor--,\n _RunInRootFrame$Deter--,\n 0 > _RunInRootFrame$Deter ||\n sampleLines[namePropDescriptor] !==\n controlLines[_RunInRootFrame$Deter])\n ) {\n var _frame =\n \"\\n\" +\n sampleLines[namePropDescriptor].replace(\n \" at new \",\n \" at \"\n );\n fn.displayName &&\n _frame.includes(\"\") &&\n (_frame = _frame.replace(\"\", fn.displayName));\n \"function\" === typeof fn &&\n componentFrameCache.set(fn, _frame);\n return _frame;\n }\n while (1 <= namePropDescriptor && 0 <= _RunInRootFrame$Deter);\n }\n break;\n }\n }\n } finally {\n (reentry = !1),\n (ReactSharedInternals.H = previousDispatcher),\n reenableLogs(),\n (Error.prepareStackTrace = frame);\n }\n sampleLines = (sampleLines = fn ? fn.displayName || fn.name : \"\")\n ? describeBuiltInComponentFrame(sampleLines)\n : \"\";\n \"function\" === typeof fn && componentFrameCache.set(fn, sampleLines);\n return sampleLines;\n }\n function formatOwnerStack(error) {\n var prevPrepareStackTrace = Error.prepareStackTrace;\n Error.prepareStackTrace = void 0;\n error = error.stack;\n Error.prepareStackTrace = prevPrepareStackTrace;\n error.startsWith(\"Error: react-stack-top-frame\\n\") &&\n (error = error.slice(29));\n prevPrepareStackTrace = error.indexOf(\"\\n\");\n -1 !== prevPrepareStackTrace &&\n (error = error.slice(prevPrepareStackTrace + 1));\n prevPrepareStackTrace = error.indexOf(\"react-stack-bottom-frame\");\n -1 !== prevPrepareStackTrace &&\n (prevPrepareStackTrace = error.lastIndexOf(\n \"\\n\",\n prevPrepareStackTrace\n ));\n if (-1 !== prevPrepareStackTrace)\n error = error.slice(0, prevPrepareStackTrace);\n else return \"\";\n return error;\n }\n function describeFiber(fiber) {\n switch (fiber.tag) {\n case 26:\n case 27:\n case 5:\n return describeBuiltInComponentFrame(fiber.type);\n case 16:\n return describeBuiltInComponentFrame(\"Lazy\");\n case 13:\n return describeBuiltInComponentFrame(\"Suspense\");\n case 19:\n return describeBuiltInComponentFrame(\"SuspenseList\");\n case 0:\n case 15:\n return describeNativeComponentFrame(fiber.type, !1);\n case 11:\n return describeNativeComponentFrame(fiber.type.render, !1);\n case 1:\n return describeNativeComponentFrame(fiber.type, !0);\n case 31:\n return describeBuiltInComponentFrame(\"Activity\");\n default:\n return \"\";\n }\n }\n function getStackByFiberInDevAndProd(workInProgress) {\n try {\n var info = \"\";\n do {\n info += describeFiber(workInProgress);\n var debugInfo = workInProgress._debugInfo;\n if (debugInfo)\n for (var i = debugInfo.length - 1; 0 <= i; i--) {\n var entry = debugInfo[i];\n if (\"string\" === typeof entry.name) {\n var JSCompiler_temp_const = info,\n env = entry.env;\n var JSCompiler_inline_result = describeBuiltInComponentFrame(\n entry.name + (env ? \" [\" + env + \"]\" : \"\")\n );\n info = JSCompiler_temp_const + JSCompiler_inline_result;\n }\n }\n workInProgress = workInProgress.return;\n } while (workInProgress);\n return info;\n } catch (x) {\n return \"\\nError generating stack: \" + x.message + \"\\n\" + x.stack;\n }\n }\n function describeFunctionComponentFrameWithoutLineNumber(fn) {\n return (fn = fn ? fn.displayName || fn.name : \"\")\n ? describeBuiltInComponentFrame(fn)\n : \"\";\n }\n function getCurrentFiberOwnerNameInDevOrNull() {\n if (null === current) return null;\n var owner = current._debugOwner;\n return null != owner ? getComponentNameFromOwner(owner) : null;\n }\n function getCurrentFiberStackInDev() {\n if (null === current) return \"\";\n var workInProgress = current;\n try {\n var info = \"\";\n 6 === workInProgress.tag && (workInProgress = workInProgress.return);\n switch (workInProgress.tag) {\n case 26:\n case 27:\n case 5:\n info += describeBuiltInComponentFrame(workInProgress.type);\n break;\n case 13:\n info += describeBuiltInComponentFrame(\"Suspense\");\n break;\n case 19:\n info += describeBuiltInComponentFrame(\"SuspenseList\");\n break;\n case 31:\n info += describeBuiltInComponentFrame(\"Activity\");\n break;\n case 30:\n case 0:\n case 15:\n case 1:\n workInProgress._debugOwner ||\n \"\" !== info ||\n (info += describeFunctionComponentFrameWithoutLineNumber(\n workInProgress.type\n ));\n break;\n case 11:\n workInProgress._debugOwner ||\n \"\" !== info ||\n (info += describeFunctionComponentFrameWithoutLineNumber(\n workInProgress.type.render\n ));\n }\n for (; workInProgress; )\n if (\"number\" === typeof workInProgress.tag) {\n var fiber = workInProgress;\n workInProgress = fiber._debugOwner;\n var debugStack = fiber._debugStack;\n workInProgress &&\n debugStack &&\n (\"string\" !== typeof debugStack &&\n (fiber._debugStack = debugStack = formatOwnerStack(debugStack)),\n \"\" !== debugStack && (info += \"\\n\" + debugStack));\n } else if (null != workInProgress.debugStack) {\n var ownerStack = workInProgress.debugStack;\n (workInProgress = workInProgress.owner) &&\n ownerStack &&\n (info += \"\\n\" + formatOwnerStack(ownerStack));\n } else break;\n var JSCompiler_inline_result = info;\n } catch (x) {\n JSCompiler_inline_result =\n \"\\nError generating stack: \" + x.message + \"\\n\" + x.stack;\n }\n return JSCompiler_inline_result;\n }\n function runWithFiberInDEV(fiber, callback, arg0, arg1, arg2, arg3, arg4) {\n var previousFiber = current;\n setCurrentFiber(fiber);\n try {\n return null !== fiber && fiber._debugTask\n ? fiber._debugTask.run(\n callback.bind(null, arg0, arg1, arg2, arg3, arg4)\n )\n : callback(arg0, arg1, arg2, arg3, arg4);\n } finally {\n setCurrentFiber(previousFiber);\n }\n throw Error(\n \"runWithFiberInDEV should never be called in production. This is a bug in React.\"\n );\n }\n function setCurrentFiber(fiber) {\n ReactSharedInternals.getCurrentStack =\n null === fiber ? null : getCurrentFiberStackInDev;\n isRendering = !1;\n current = fiber;\n }\n function getToStringValue(value) {\n switch (typeof value) {\n case \"bigint\":\n case \"boolean\":\n case \"number\":\n case \"string\":\n case \"undefined\":\n return value;\n case \"object\":\n return checkFormFieldValueStringCoercion(value), value;\n default:\n return \"\";\n }\n }\n function isCheckable(elem) {\n var type = elem.type;\n return (\n (elem = elem.nodeName) &&\n \"input\" === elem.toLowerCase() &&\n (\"checkbox\" === type || \"radio\" === type)\n );\n }\n function trackValueOnNode(node) {\n var valueField = isCheckable(node) ? \"checked\" : \"value\",\n descriptor = Object.getOwnPropertyDescriptor(\n node.constructor.prototype,\n valueField\n );\n checkFormFieldValueStringCoercion(node[valueField]);\n var currentValue = \"\" + node[valueField];\n if (\n !node.hasOwnProperty(valueField) &&\n \"undefined\" !== typeof descriptor &&\n \"function\" === typeof descriptor.get &&\n \"function\" === typeof descriptor.set\n ) {\n var get = descriptor.get,\n set = descriptor.set;\n Object.defineProperty(node, valueField, {\n configurable: !0,\n get: function () {\n return get.call(this);\n },\n set: function (value) {\n checkFormFieldValueStringCoercion(value);\n currentValue = \"\" + value;\n set.call(this, value);\n }\n });\n Object.defineProperty(node, valueField, {\n enumerable: descriptor.enumerable\n });\n return {\n getValue: function () {\n return currentValue;\n },\n setValue: function (value) {\n checkFormFieldValueStringCoercion(value);\n currentValue = \"\" + value;\n },\n stopTracking: function () {\n node._valueTracker = null;\n delete node[valueField];\n }\n };\n }\n }\n function track(node) {\n node._valueTracker || (node._valueTracker = trackValueOnNode(node));\n }\n function updateValueIfChanged(node) {\n if (!node) return !1;\n var tracker = node._valueTracker;\n if (!tracker) return !0;\n var lastValue = tracker.getValue();\n var value = \"\";\n node &&\n (value = isCheckable(node)\n ? node.checked\n ? \"true\"\n : \"false\"\n : node.value);\n node = value;\n return node !== lastValue ? (tracker.setValue(node), !0) : !1;\n }\n function getActiveElement(doc) {\n doc = doc || (\"undefined\" !== typeof document ? document : void 0);\n if (\"undefined\" === typeof doc) return null;\n try {\n return doc.activeElement || doc.body;\n } catch (e) {\n return doc.body;\n }\n }\n function escapeSelectorAttributeValueInsideDoubleQuotes(value) {\n return value.replace(\n escapeSelectorAttributeValueInsideDoubleQuotesRegex,\n function (ch) {\n return \"\\\\\" + ch.charCodeAt(0).toString(16) + \" \";\n }\n );\n }\n function validateInputProps(element, props) {\n void 0 === props.checked ||\n void 0 === props.defaultChecked ||\n didWarnCheckedDefaultChecked ||\n (console.error(\n \"%s contains an input of type %s with both checked and defaultChecked props. Input elements must be either controlled or uncontrolled (specify either the checked prop, or the defaultChecked prop, but not both). Decide between using a controlled or uncontrolled input element and remove one of these props. More info: https://react.dev/link/controlled-components\",\n getCurrentFiberOwnerNameInDevOrNull() || \"A component\",\n props.type\n ),\n (didWarnCheckedDefaultChecked = !0));\n void 0 === props.value ||\n void 0 === props.defaultValue ||\n didWarnValueDefaultValue$1 ||\n (console.error(\n \"%s contains an input of type %s with both value and defaultValue props. Input elements must be either controlled or uncontrolled (specify either the value prop, or the defaultValue prop, but not both). Decide between using a controlled or uncontrolled input element and remove one of these props. More info: https://react.dev/link/controlled-components\",\n getCurrentFiberOwnerNameInDevOrNull() || \"A component\",\n props.type\n ),\n (didWarnValueDefaultValue$1 = !0));\n }\n function updateInput(\n element,\n value,\n defaultValue,\n lastDefaultValue,\n checked,\n defaultChecked,\n type,\n name\n ) {\n element.name = \"\";\n null != type &&\n \"function\" !== typeof type &&\n \"symbol\" !== typeof type &&\n \"boolean\" !== typeof type\n ? (checkAttributeStringCoercion(type, \"type\"), (element.type = type))\n : element.removeAttribute(\"type\");\n if (null != value)\n if (\"number\" === type) {\n if ((0 === value && \"\" === element.value) || element.value != value)\n element.value = \"\" + getToStringValue(value);\n } else\n element.value !== \"\" + getToStringValue(value) &&\n (element.value = \"\" + getToStringValue(value));\n else\n (\"submit\" !== type && \"reset\" !== type) ||\n element.removeAttribute(\"value\");\n null != value\n ? setDefaultValue(element, type, getToStringValue(value))\n : null != defaultValue\n ? setDefaultValue(element, type, getToStringValue(defaultValue))\n : null != lastDefaultValue && element.removeAttribute(\"value\");\n null == checked &&\n null != defaultChecked &&\n (element.defaultChecked = !!defaultChecked);\n null != checked &&\n (element.checked =\n checked &&\n \"function\" !== typeof checked &&\n \"symbol\" !== typeof checked);\n null != name &&\n \"function\" !== typeof name &&\n \"symbol\" !== typeof name &&\n \"boolean\" !== typeof name\n ? (checkAttributeStringCoercion(name, \"name\"),\n (element.name = \"\" + getToStringValue(name)))\n : element.removeAttribute(\"name\");\n }\n function initInput(\n element,\n value,\n defaultValue,\n checked,\n defaultChecked,\n type,\n name,\n isHydrating\n ) {\n null != type &&\n \"function\" !== typeof type &&\n \"symbol\" !== typeof type &&\n \"boolean\" !== typeof type &&\n (checkAttributeStringCoercion(type, \"type\"), (element.type = type));\n if (null != value || null != defaultValue) {\n if (\n !(\n (\"submit\" !== type && \"reset\" !== type) ||\n (void 0 !== value && null !== value)\n )\n )\n return;\n defaultValue =\n null != defaultValue ? \"\" + getToStringValue(defaultValue) : \"\";\n value = null != value ? \"\" + getToStringValue(value) : defaultValue;\n isHydrating || value === element.value || (element.value = value);\n element.defaultValue = value;\n }\n checked = null != checked ? checked : defaultChecked;\n checked =\n \"function\" !== typeof checked &&\n \"symbol\" !== typeof checked &&\n !!checked;\n element.checked = isHydrating ? element.checked : !!checked;\n element.defaultChecked = !!checked;\n null != name &&\n \"function\" !== typeof name &&\n \"symbol\" !== typeof name &&\n \"boolean\" !== typeof name &&\n (checkAttributeStringCoercion(name, \"name\"), (element.name = name));\n }\n function setDefaultValue(node, type, value) {\n (\"number\" === type && getActiveElement(node.ownerDocument) === node) ||\n node.defaultValue === \"\" + value ||\n (node.defaultValue = \"\" + value);\n }\n function validateOptionProps(element, props) {\n null == props.value &&\n (\"object\" === typeof props.children && null !== props.children\n ? React.Children.forEach(props.children, function (child) {\n null == child ||\n \"string\" === typeof child ||\n \"number\" === typeof child ||\n \"bigint\" === typeof child ||\n didWarnInvalidChild ||\n ((didWarnInvalidChild = !0),\n console.error(\n \"Cannot infer the option value of complex children. Pass a `value` prop or use a plain string as children to